define("mixins/token_iterator",["require","exports","module"],function(a,k,l){var g=a("ace/token_iterator").TokenIterator,n=a("ace/range").Range;(function(){function a(b,a){return 1===b.length&&("{"===b||"("===b||"["===b||!!a&&"<"===b)}function f(b,a){return 1===b.length&&("}"===b||")"===b||"]"===b||!!a&&">"===b)}function d(b,a,e,d,c){for(var m=1,q,p=b.clone();q=e.call(p);)if(q=a(q),q===c){if(m--,0===m)return b.moveToTokenIterator(p),!0}else q===d&&m++;return!1}var b={"(":")","{":"}","[":"]","<":">",
")":"(","}":"{","]":"[",">":"<"};this.moveToPreviousToken=function(){var b=this.$rowTokens,a=this.$tokenIndex-1;if(0<=a)return this.$tokenIndex--,b[a];a=this.$session;var e=this.$row;if(0>e)return null;for(;;){e--;if(0>e)return null;if((b=a.getTokens(e))&&b.length)return this.$row=e,this.$tokenIndex=b.length-1,this.$rowTokens=b,b[b.length-1]}};this.moveToNextToken=function(){var b=this.$rowTokens,a=this.$tokenIndex+1;if(a<b.length)return this.$tokenIndex++,b[a];a=this.$session;var e=a.getLength(),
d=this.$row;if(d>=e)return null;for(;;){d++;if(d>=e)return null;if((b=a.getTokens(d))&&b.length)return this.$row=d,this.$tokenIndex=0,this.$rowTokens=b,b[0]}};this.moveToNextSignificantToken=function(){if(!this.moveToNextToken())return!1;for(var b=this.getCurrentToken();/^\s+$/.test(b.value)||/\bcomment\b/.test(b.type);){if(!this.moveToNextToken())return!1;b=this.getCurrentToken()}return!0};this.moveToPreviousSignificantToken=function(){if(!this.moveToPreviousToken())return!1;for(var b=this.getCurrentToken();/^\s+$/.test(b.value)||
/\bcomment\b/.test(b.type);){if(!this.moveToPreviousToken())return!1;b=this.getCurrentToken()}return!0};this.moveToStartOfRow=function(){this.$tokenIndex=0;return this.getCurrentToken()};this.moveToEndOfRow=function(){this.$tokenIndex=this.$rowTokens.length-1;return this.getCurrentToken()};this.moveToStartOfNextRowWithTokens=function(){for(var b=this.$row,a=this.$session,e=a.getLength();;){b++;if(b>=e)return null;var d=a.getTokens(b);if(d&&d.length)return this.$row=b,this.$tokenIndex=0,this.$rowTokens=
d,this.getCurrentToken()}};var c,e=0,t=0;this.tokenizeUpToRow=function(b){var a=this.$session.bgTokenizer;e=Math.min(e,a.currentLine);t=Math.max(t,b);for(var d=a.currentLine;d<=b;d++)a.$tokenizeRow(d);clearTimeout(c);c=setTimeout(function(){a.fireUpdateEvent(e,t);e=t;t=0},700)};this.moveToPosition=function(b,a){this.tokenizeUpToRow(b.row);var e=this.$session.getTokenAt(b.row,b.column);e&&a&&e.column<b.column&&(e=this.$session.getTokenAt(b.row,b.column+1));if(null==e){if(a)return this.$row=b.row,this.$rowTokens=
this.$session.getTokens(this.$row),this.$tokenIndex=this.$rowTokens.length-1,this.moveToNextToken();this.$row=b.row+1;this.$tokenIndex=0;this.$rowTokens=this.$session.getTokens(this.$row);return this.moveToPreviousToken()}this.$row=b.row;this.$rowTokens=this.$session.getTokens(this.$row);this.$tokenIndex=e.index;return this.getCurrentToken()};this.clone=function(){var b=new g(this.$session,0,0);b.moveToTokenIterator(this);return b};this.moveToTokenIterator=function(b){for(var a in b)b.hasOwnProperty(a)&&
(this[a]=b[a])};this.peekFwd=function(b){for(var a=this.clone(),e=null,d=0;d<b;d++)e=a.moveToNextToken();return e};this.peekBwd=function(b){for(var a=this.clone(),e=null,d=0;d<b;d++)e=a.moveToPreviousToken();return e};this.getCurrentToken=function(){var b=this.$rowTokens[this.$tokenIndex];b&&(b.row=this.$row);return b};this.getCurrentTokenValue=function(){return this.getCurrentToken().value};this.getCurrentTokenPosition=function(){return{row:this.getCurrentTokenRow(),column:this.getCurrentTokenColumn()}};
this.getCurrentTokenRange=function(){var b=this.getCurrentTokenPosition(),a={row:b.row,column:b.column+this.getCurrentToken().value.length};return n.fromPoints(b,a)};this.fwdToMatchingToken=function(){var e=this.getCurrentToken();return a(e.value,!0)?d(this,function(b){return b.value},this.moveToNextToken,e.value,b[e.value]):"support.function.codebegin"===e.type?d(this,function(b){return b.type},this.moveToNextToken,"support.function.codebegin","support.function.codeend"):!1};this.bwdToMatchingToken=
function(){var a=this.getCurrentToken();return f(a.value,!0)?d(this,function(b){return b.value},this.moveToPreviousToken,a.value,b[a.value]):"support.function.codeend"===a.type?d(this,function(b){return b.type},this.moveToPreviousToken,"support.function.codeend","support.function.codebegin"):!1};this.findTokenValueBwd=function(b,a){a=!!a;do if(!(a&&this.bwdToMatchingToken()||this.getCurrentToken().value!==b))return!0;while(this.moveToPreviousToken());return!1};this.findTokenValueFwd=function(b,a){a=
!!a;do if(!(a&&this.fwdToMatchingToken()||this.getCurrentToken().value!==b))return!0;while(this.moveToNextToken());return!1};this.findTokenTypeBwd=function(b,a){a=!!a;do if(!(a&&this.bwdToMatchingToken()||this.getCurrentToken().type!==b))return!0;while(this.moveToPreviousToken());return!1};this.findTokenTypeFwd=function(b,a){a=!!a;do if(!(a&&this.fwdToMatchingToken()||this.getCurrentToken().type!==b))return!0;while(this.moveToNextToken());return!1}}).call(g.prototype)});define("ace/token_tooltip",["require","exports","module"],function(a,k,l){function g(a){a.tokenTooltip||(f.call(this,a.container),a.tokenTooltip=this,this.editor=a,this.update=this.update.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onMouseOut=this.onMouseOut.bind(this),n.addListener(a.renderer.scroller,"mousemove",this.onMouseMove),n.addListener(a.renderer.content,"mouseout",this.onMouseOut))}a("ace/lib/dom");l=a("ace/lib/oop");var n=a("ace/lib/event"),h=a("ace/range").Range,f=a("ace/tooltip").Tooltip;
l.inherits(g,f);(function(){this.token={};this.range=new h;this.update=function(){this.$timer=null;var a=this.editor.renderer;1E3<this.lastT-(a.timeStamp||0)&&(a.rect=null,a.timeStamp=this.lastT,this.maxHeight=window.innerHeight,this.maxWidth=window.innerWidth);var b=a.rect||(a.rect=a.scroller.getBoundingClientRect()),c=this.editor.session;a=c.screenToDocumentPosition(Math.floor((this.y+a.scrollTop-b.top)/a.lineHeight),Math.round((this.x+a.scrollLeft-b.left-a.$padding)/a.characterWidth));(b=c.getTokenAt(a.row,
a.column))||c.getLine(a.row)||(b={type:"",value:"",state:c.bgTokenizer.getState(0)});if(b){var e=b.type;b.state&&(e+="|"+b.state);b.merge&&(e+="\n  merge");b.stateTransitions&&(e+="\n  "+b.stateTransitions.join("\n  "));this.tokenText!=e&&(this.setText(e),this.width=this.getWidth(),this.height=this.getHeight(),this.tokenText=e);this.show(null,this.x,this.y);this.token=b;c.removeMarker(this.marker);this.range=new h(a.row,b.start,a.row,b.start+b.value.length);this.marker=c.addMarker(this.range,"ace_bracket",
"text")}else c.removeMarker(this.marker),this.hide()};this.onMouseMove=function(a){this.x=a.clientX;this.y=a.clientY;this.isOpen&&(this.lastT=a.timeStamp,this.setPosition(this.x,this.y));this.$timer||(this.$timer=setTimeout(this.update,100))};this.onMouseOut=function(a){a&&a.currentTarget.contains(a.relatedTarget)||(this.hide(),this.editor.session.removeMarker(this.marker),this.$timer=clearTimeout(this.$timer))};this.setPosition=function(a,b){a+10+this.width>this.maxWidth&&(a=window.innerWidth-this.width-
10);if(b>.75*window.innerHeight||b+20+this.height>this.maxHeight)b=b-this.height-30;f.prototype.setPosition.call(this,a+10,b+20)};this.destroy=function(){this.onMouseOut();n.removeListener(this.editor.renderer.scroller,"mousemove",this.onMouseMove);n.removeListener(this.editor.renderer.content,"mouseout",this.onMouseOut);delete this.editor.tokenTooltip}}).call(g.prototype);k.TokenTooltip=g});define("mode/auto_brace_insert",["require","exports","module"],function(a,k,l){var g=a("ace/range").Range,n=a("ace/mode/text").Mode;(function(){this.$complements={"(":")","[":"]",'"':'"',"{":"}"};this.$reOpen=/^[(["{]$/;this.$reClose=/^[)\]"}]$/;this.$reStop=/^[;,\s)\]}]$/;this.wrapInsert=function(a,f,d,b){if(!this.insertMatching)return f.call(a,d,b);var c=a.selection.getCursor();if(c=a.selection.isEmpty()&&d.row==c.row&&d.column==c.column){var e=g.fromPoints(d,{row:d.row,column:d.column+1}),h=a.doc.getTextRange(e);
if(this.$reClose.test(h)&&h==b){a.selection.moveCursorTo(e.end.row,e.end.column,!1);return}}e=null;c&&(e=this.$moveLeft(a.doc,d),e=a.doc.getTextRange(g.fromPoints(e,d)));f=f.call(a,d,b);c&&this.$reOpen.test(b)?(d=g.fromPoints(f,{row:f.row,column:f.column+1}),d=a.doc.getTextRange(d),(this.$reStop.test(d)||0==d.length)&&this.allowAutoInsert(a,f,this.$complements[b])&&(a.doc.insert(f,this.$complements[b]),a.selection.moveCursorTo(f.row,f.column,!1))):c&&"\n"===b&&(b=this.$moveRight(a.doc,f),b=a.doc.getTextRange(g.fromPoints(f,
b)),c=e,b=(e=a.getTokenAt(d.row,d.column-1))&&"function"===e.value?!1:"{"===c&&"}"===b||"("===c&&")"===b||"["===c&&"]"===b,b&&(d=this.getIndentForOpenBrace?this.getIndentForOpenBrace(this.$moveLeft(a.doc,d)):this.$getIndent(a.doc.getLine(f.row-1)),a.doc.insert(f,"\n"+d),a.selection.moveCursorTo(f.row,f.column,!1)));return f};this.allowAutoInsert=function(a,f,d){return!0};this.smartAllowAutoInsert=function(a,f,d){return"'"!==d&&'"'!==d&&"`"!==d?!0:"`"===d?(f=a.doc.getTextRange({start:{row:f.row,column:0},
end:f}),f=f.replace(/\\./g,""),0!=f.match(/`/g).length%2):0==f.column?!0:(a=this.codeModel.getTokenForPos(f,!1,!0))&&"string"===a.type&&a.column===f.column-1};this.wrapRemove=function(a,f,d){var b=a.selection.getCursor(),c=a.session.getDocument();if(!this.insertMatching||"left"!=d||!a.selection.isEmpty()||a.$readOnly||0==b.column||c.getLine(b.row).length<=b.column)return f.call(a,d);var e=g.fromPoints(this.$moveLeft(c,b),b);b=g.fromPoints(b,this.$moveRight(c,b));e=c.getTextRange(e);c=this.$reOpen.test(e)&&
this.$complements[e]==c.getTextRange(b);f.call(a,d);c&&f.call(a,"right")};this.$moveLeft=function(a,f){if(0==f.row&&0==f.column)return f;var d=f.row,b=f.column;b?b--:(d--,b=a.getLine(d).length);return{row:d,column:b}};this.$moveRight=function(a,f){var d=f.row,b=f.column;a.getLine(d).length!=b?b++:(d++,b=0);return d>=a.getLength()?f:{row:d,column:b}}}).call(n.prototype);k.setInsertMatching=function(a){n.prototype.insertMatching=a}});define("mode/c_cpp",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");var g=a("ace/mode/text").Mode,n=a("ace/tokenizer").Tokenizer,h=a("ace/range").Range;a("mode/r_highlight_rules");var f=a("mode/c_cpp_highlight_rules").c_cppHighlightRules,d=a("mode/c_cpp_matching_brace_outdent").CppMatchingBraceOutdent,b=a("mode/behaviour/cstyle").CStyleBehaviour,c=null;window.NodeWebkit||(c=a("mode/c_cpp_fold_mode").FoldMode);var e=a("mode/r_code_model").RCodeModel,t=a("mode/r_matching_brace_outdent").RMatchingBraceOutdent,
q=a("mode/cpp_code_model").CppCodeModel;a("mode/token_cursor");var p=a("mode/utils");a=function(a,p){this.$session=p;this.$doc=p.getDocument();this.$tokenizer=new n((new f).getRules());this.r_codeModel=new e(p,this.$tokenizer,/^r-/,/^\s*\/\*{3,}\s*([Rr])\s*$/,/^\s*\*+\//);this.$r_outdent=new t(this.r_codeModel);this.codeModel=new q(p,this.$tokenizer);this.$behaviour=new b(this.codeModel);this.$cpp_outdent=new d(this.codeModel);window.NodeWebkit||(this.foldingRules=new c);this.$tokens=this.codeModel.$tokens;
this.getLineSansComments=this.codeModel.getLineSansComments};l.inherits(a,g);(function(){this.wrapInsert=function(a,b,e,d){return this.cursorInRLanguageMode()?g.prototype.wrapInsert(a,b,e,d):b.call(a,e,d)};this.wrapRemove=function(a,b,e){return this.cursorInRLanguageMode()?g.prototype.wrapRemove(a,b,e):b.call(a,e)};this.insertChunkInfo={value:"/*** R\n\n*/\n",position:{row:1,column:0},content_position:{row:1,column:0}};this.toggleCommentLines=function(a,b,e,d){var c=!0;a=/^(\s*)\/\//;for(var m=e;m<=
d;m++)if(!a.test(b.getLine(m))){c=!1;break}if(c)for(c=new h(0,0,0,0),m=e;m<=d;m++)e=b.getLine(m).match(a),c.start.row=m,c.end.row=m,c.end.column=e[0].length,b.replace(c,e[1]);else b.indentRows(e,d,"//")};this.getLanguageMode=function(a){return p.getPrimaryState(this.$session,a.row).match(/^r-/)?"R":"C_CPP"};this.cursorInRLanguageMode=function(){return"R"===this.getLanguageMode(this.$session.getSelection().getCursor())};this.inRLanguageMode=function(a){if(!a)return null;"object"===typeof a&&a.hasOwnProperty("length")&&
0<a.length&&(a=a[0]);return a.match(/^r-/)};this.getNextLineIndent=function(a,b,e,d,c){a=p.primaryState(a);return this.inRLanguageMode(a)?this.r_codeModel.getNextLineIndent(a,b,e,d):this.codeModel.getNextLineIndent(a,b,e,d,c)};this.checkOutdent=function(a,b,e){return this.inRLanguageMode(a)?this.$r_outdent.checkOutdent(a,b,e):this.$cpp_outdent.checkOutdent(a,b,e)};this.autoOutdent=function(a,b,e){return this.inRLanguageMode(a)?this.$r_outdent.autoOutdent(a,b,e,this.r_codeModel):this.$cpp_outdent.autoOutdent(a,
b,e)};this.$transformAction=this.transformAction;this.transformAction=function(a,b,e,d,c){a=p.primaryState(a);if(!this.inRLanguageMode(a))return this.$transformAction(a,b,e,d,c)};this.$id="mode/c_cpp"}).call(a.prototype);k.Mode=a});define("mode/c_cpp_fold_mode",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");var g=a("ace/range").Range;a=a("ace/mode/folding/fold_mode").FoldMode;k=k.FoldMode=function(){};l.inherits(k,a);(function(){function a(a,d,e,f){a=a.doc.$lines;for(var b=d+f,c=a[b],m=0<f?"*/":"/*",h;null!=c;){var t=c.indexOf(m);if(-1!==t){h=0<f?new g(d,e,b,t):new g(b,c.length,d,e);break}b+=f;c=a[b]}return h}function h(a,d,e,f,q){for(var b=d+q,c=a.doc.$lines;0<=b&&b<a.getLength();){for(var h=a.getTokens(b),
t=c[b],n=0;n<h.length;n++)if(h[n].type===f)return 0<q?new g(d,e,b,0):new g(b,t.length,d,e);b+=q}}var f=/(\{|\[)[^\}\]]*$/,d=/^[^\[\{]*(\}|\])/;this.getFoldWidget=function(a,c,e){c="markbeginend"===c?"end":"";e=a.getLine(e);if(f.test(e))return"start";if(d.test(e))return c;a=e.indexOf("/*");e=e.indexOf("*/");return-1!==a&&(-1===e||a>e)?"start":-1!==e&&(-1===a||e<a)?c:""};this.getFoldWidgetRange=function(b,c,e){var g=b.getLine(e),q;if(q=g.match(f))return this.openingBracketBlock(b,q[1],e,q.index);if(q=
"markbeginend"===c&&g.match(d))return this.closingBracketBlock(b,q[1],e,q.index+q[0].length);c=b.getTokens(e);for(q=0;q<c.length;q++){var p=c[q];if("support.function.codebegin"===p.type)return h(b,e,g.length,"support.function.codeend",1);if("support.function.codeend"===p.type)return h(b,e,0,"support.function.codebegin",-1)}c=g.indexOf("/*");if(-1!==c)return a(b,e,g.length,1);c=g.indexOf("*/");if(-1!==c)return a(b,e,c,-1)}}).call(k.prototype)});define("mode/c_cpp_highlight_rules",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");var g=a("ace/lib/lang"),n=a("mode/doc_comment_highlight_rules").DocCommentHighlightRules,h=a("ace/mode/text_highlight_rules").TextHighlightRules,f=a("mode/tex_highlight_rules").TexHighlightRules,d=a("mode/r_highlight_rules").RHighlightRules,b=a("mode/rainbow_paren_highlight_rules").RainbowParenHighlightRules;a=function(){function a(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}
var e=g.arrayToMap("alignas alignof and and_eq asm auto bitand bitor bool break case catch char char16_t char32_t class compl const constexpr const_cast continue decltype default delete do double dynamic_cast else enum explicit export extern false float for friend goto if inline int in long mutable namespace new noexcept not not_eq nullptr or or_eq private protected public register reinterpret_cast return short signed sizeof sizeof... static static_assert static_cast struct switch template this thread_local throw true try typedef typeid typeof typename union unsigned using virtual void volatile wchar_t while xor xor_eq".split(" ")),
h=g.arrayToMap(["NULL"]),q="new delete >>= <<= ->* ... << >> && || == != <= >= :: *= += -= /= ++ -- &= ^= %= -> .* ! $ & | + - * / ^ ~ = %".split(" "),p=q.map(function(b){return a(b)}).join("|");q=["->*"].concat(q).concat("< > , () [] ->".split(" ")).map(function(b){return a(b)});q=["new\\s*\\[\\]","delete\\s*\\[\\]"].concat(q);q="operator\\s*(?:"+q.join("|")+")|operator\\s+[\\w_]+(?:&&|&|\\*)?";this.$rules={start:[{token:"comment.doc.tag",regex:"\\/\\/\\s*\\[\\[.*\\]\\].*$"},{token:"comment",regex:"\\/\\/'",
next:"rd-start"},{token:"comment",regex:"\\/\\/.*$"},n.getStartRule("doc-start"),{token:"comment",merge:!0,regex:"\\/\\*",next:"comment"},{token:"string",regex:'(?:R|L|u8|u|U)?["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",merge:!0,regex:'(?:R|L|u8|u|U)?["].*\\\\$',next:"qqstring"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"string",merge:!0,regex:"['].*\\\\$",next:"qstring"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"0[bB][01']+\\b"},
{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(?:(?:[fF])|(?:(?:[uU]?(?:(?:l?l?)|(?:L?L?))?)|(?:(?:(?:l?l?)|(?:L?L?))[uU]?))|(?:_\\w+))?\\b"},{token:"keyword.preproc",regex:"#\\s*include\\b",next:"include"},{token:"keyword.preproc",regex:"(?:"+"include pragma line define defined undef ifdef ifndef if else elif endif warning error".split(" ").map(function(a){return"#\\s*"+a+"\\b"}).join("|")+")"},{token:"variable.language",regex:"\\b__\\S+__\\b"},{token:"keyword",regex:q},
{token:function(a){return"this"==a?"variable.language":e.hasOwnProperty(a)?"keyword":h.hasOwnProperty(a)?"constant.language":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",merge:!1,regex:p},{token:"keyword.punctuation.operator",merge:!1,regex:"\\?|\\:|\\,|\\;|\\.|\\\\"},b.getParenRule(),{token:"paren.keyword.operator",merge:!1,regex:"[<>]"},{token:"text",regex:"\\s+"}],comment:[{token:"comment",regex:".*?\\*\\/",next:"start"},{token:"comment",merge:!0,regex:".+"}],qqstring:[{token:"string",
regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"',next:"start"},{token:"string",merge:!0,regex:".+"}],qstring:[{token:"string",regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'",next:"start"},{token:"string",merge:!0,regex:".+"}],include:[{token:"string",regex:/<.+>/,next:"start"},{token:"string",regex:/".+"/,next:"start"}]};p=(new f("comment")).getRules();for(q=0;q<p.start.length;q++)p.start[q].token+=".virtual-comment";this.addRules(p,"rd-");this.$rules["rd-start"].unshift({token:"text",regex:"^",next:"start"});this.$rules["rd-start"].unshift({token:"keyword",
regex:"@(?!@)[^ ]*"});this.$rules["rd-start"].unshift({token:"comment",regex:"@@"});this.$rules["rd-start"].push({token:"comment",regex:"[^%\\\\[({\\])}]+"});this.embedRules(n,"doc-",[n.getEndRule("start")]);this.$rules.start.unshift({token:"support.function.codebegin",regex:"^\\s*\\/\\*{3,}\\s*[Rr]\\s*$",next:"r-start"});p=(new d).getRules();this.addRules(p,"r-");this.$rules["r-start"].unshift({token:"support.function.codeend",regex:"\\*\\/",next:"start"})};l.inherits(a,h);k.c_cppHighlightRules=
a});define("mode/c_cpp_matching_brace_outdent",["require","exports","module"],function(a,k,l){var g=a("ace/range").Range,n=a("mode/token_cursor").CppTokenCursor;l=function(a){this.codeModel=a};var h=a("mode/utils"),f=!0,d=!0,b=!0,c=!0,e=!0,t=!0,q=!0,p=!0,m=!0,v=!0,x=!0,y=!0;(function(){this.setIndent=function(a,b,e,d,c){a=a.getDocument();d="string"===typeof d?d:"";var m=a.$lines[e];e=this.$getIndent(a.$lines[b]);m=this.$getIndent(m);("function"!==typeof c||c(e,m))&&a.replace(new g(b,0,b,e.length),m+d)};
this.checkOutdent=function(a,b,e){return h.endsWith(a,"start")&&(":"===e||/^\s*[#\{\}>\]\)<.:]/.test(e)||"="===e)||h.endsWith(a,"comment")&&"/"==e?!0:!1};this.escapeRegExp=function(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")};this.alignStartToken=function(a,b,e,d,c){return null===c||null===d?!1:(new RegExp("^\\s*"+this.escapeRegExp(a))).test(d)&&(a=c.indexOf(a),0<=a)?(b=b.getDocument(),d=this.$getIndent(d),a=Array(a+1).join(" "),b.replace(new g(e,0,e,d.length),a),!0):!1};this.alignEquals=
function(a,b,e,d){if(null===d||null===e)return!1;var c=e.indexOf("=");if(c!==e.lastIndexOf("="))return!1;var m=d.indexOf("=");if(-1!==c&&-1!==m&&/,\s*$/.test(d)){a=a.getDocument();e=this.$getIndent(e);if(e.length>=m)return!1;c=m-c;if(0>=c)return!1;c=Array(e.length+c+1).join(" ");a.replace(new g(b,0,b,e.length),c);return!0}return!1};this.autoOutdent=function(a,p,w){a=p.doc;var z=a.getLine(w),A=null;0<w&&(A=a.getLine(w-1));if(!v||!this.alignStartToken("<<",p,w,z,A))if(!m||!this.alignStartToken(">>",
p,w,z,A))if(!q||!this.alignStartToken(".",p,w,z,A)){if(f&&/^\s*:/.test(a.getLine(w))&&!/^\s*::/.test(a.getLine(w))&&this.codeModel.$tokenUtils.$tokenizeUpToRow(w)){var k=new n(this.codeModel.$tokens,w,0),l=-1,B=k.cloneCursor();if(")"===B.peekBwd().currentValue()||"keyword"===B.peekBwd().currentType()){do{k=B.currentType();var r=B.currentValue();if("identifier"===k||";"===r){l=B.$row;break}"keyword"!==k&&B.bwdToMatchingToken()}while(B.moveToPreviousToken())}else k.moveToPreviousToken(),k.bwdOverClassySpecifiers()&&
(l=k.$row);0<=l&&this.setIndent(p,w,l,p.getTabString(),function(a,b){return a===b})}if(t&&/^\s*>/.test(z)&&!/^\s*>>/.test(z)&&(l=this.codeModel.getRowForMatchingEOLArrows(p,a,w),0<=l)){this.setIndent(p,w,l);return}if(c&&/^\s*\}/.test(z)&&(l=p.findMatchingBracket({row:w,column:z.indexOf("}")+1}),null!==l)){if(/^\s*\{/.test(a.$lines[l.row])){this.setIndent(p,w,l.row);return}l=this.codeModel.getRowForOpenBraceIndent(p,l.row);if(0<=l){this.setIndent(p,w,l);return}}if(d&&/^\s*\)/.exec(z)&&(l=p.findMatchingBracket({row:w,
column:z.indexOf(")")+1}))){this.setIndent(p,w,l.row);return}if(e&&/^\s*\]/.exec(z)&&(l=p.findMatchingBracket({row:w,column:z.indexOf("]")+1}))){this.setIndent(p,w,l.row);return}if(x&&/^\s*public\s*:\s*$|^\s*private\s*:\s*$|^\s*protected\s*:\s*$/.test(z)&&(B=p.$findOpeningBracket("}",{row:w,column:z.length},h.getTokenTypeRegex("paren")))){l=this.codeModel.getRowForOpenBraceIndent(p,B.row);0<=l?this.setIndent(p,w,l):this.setIndent(p,w,B.row);return}if(y&&(/^\s*case.+:/.test(z)||/^\s*default\s*:/.test(z))&&
(B=p.$findOpeningBracket("}",{row:w,column:/(\S)/.exec(z).index+1},h.getTokenTypeRegex("paren")))){l=this.codeModel.getRowForOpenBraceIndent(p,B.row);0<=l?this.setIndent(p,w,l):this.setIndent(p,w,B.row);return}if(b&&/^\s*\{/.test(z)&&!/;\s*$/.test(A)){if(this.codeModel.$tokenUtils.$tokenizeUpToRow(w)&&(k=new n(this.codeModel.$tokens),k.$row=w,k.$offset=0,k.moveToPreviousToken()&&"="===k.currentValue()))return;A=this.codeModel.getRowForOpenBraceIndent(p,w);if(0<=A){this.setIndent(p,w,A);return}}/^\s*#/.test(z)&&
(p=this.$getIndent(z),a.replace(new g(w,0,w,p.length),""))}};this.$getIndent=function(a){return(a=a.match(/^(\s+)/))?a[1]:""}}).call(l.prototype);k.CppMatchingBraceOutdent=l;k.getOutdentColon=function(){return f};k.setOutdentColon=function(a){f=a};k.getOutdentRightParen=function(){return d};k.setOutdentRightParen=function(a){d=a};k.getOutdentLeftBrace=function(){return b};k.setOutdentLeftBrace=function(a){b=a};k.getOutdentRightBrace=function(){return c};k.setOutdentRightBrace=function(a){c=a};k.getOutdentRightBracket=
function(){return e};k.setOutdentRightBracket=function(a){e=a};k.getOutdentRightArrow=function(){return t};k.setOutdentRightArrow=function(a){t=a};k.getAlignDots=function(){return q};k.setAlignDots=function(a){q=a};k.getAlignEquals=function(){return p};k.setAlignEquals=function(a){p=a};k.getAlignStreamIn=function(){return m};k.setAlignStreamIn=function(a){m=a};k.getAlignStreamOut=function(){return v};k.setAlignStreamOut=function(a){v=a};k.getAlignClassAccessModifiers=function(){return x};k.setAlignClassAccessModifiers=
function(a){x=a};k.getAlignCase=function(){return y};k.setAlignCase=function(a){y=a}});define("mode/behaviour/cstyle",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");var g=a("ace/mode/behaviour").Behaviour;a("mode/cpp_code_model");a("mode/token_cursor");a("ace/mode/text");var n=a("mode/utils"),h=!0;a=function(a){var d=a.$complements,b=function(a,b,c,p){var e=d[a];if(b==a)return b=c.getSelectionRange(),p=p.doc.getTextRange(b),""!==p?{text:a+p+e,selection:!1}:{text:a+e,selection:[1,1]};if(b==e&&(a=c.getCursorPosition(),p.doc.getLine(a.row)[a.column]==e&&(">"===e||null!==
p.findMatchingBracket({row:a.row,column:a.column+1}))))return{text:"",selection:[1,1]}},c=function(a,b,c){var e=d[a],m=c.doc.getTextRange(b);if(!b.isMultiLine()&&m==a&&c.doc.getLine(b.start.row).substring(b.start.column+1,b.start.column+2)==e)return b.end.column++,b};this.add("R","insertion",function(a,b,d,c,m){if("R"===m||"r"===m)if(a=d.getCursorPosition(),c=(new String(c.doc.getLine(a.row))).match(/^(\s*)\/\*{3,}\s*/))return{text:"R\n"+c[1]+"\n"+c[1]+"*/",selection:[1,c[1].length,1,c[1].length]}});
this.add("newline","insertion",function(b,d,c,p,m){if("\n"===m){var e=c.getCursorPosition();m=e.row;var f=e.column;d=p.getTabString();var h=p.doc.$lines;c=h[m];if(!this.codeModel.inMacro(h,m-1)){var q=/^(\s*\/\/'\s*)/.exec(c);if(q&&f>=q[1].length)return{text:"\n"+q[1]};if(/^\s*[/][*]+\s*$/.test(c)&&!/^\s*[*]/.test(h[m+1]||""))return p=this.$getIndent(c),d=p+" * ",{text:"\n"+d+"\n"+p+" */",selection:[1,d.length,1,d.length]};if(n.endsWith(b,"comment")||n.endsWith(b,"doc-start")){e&&e.row==m&&(c=c.substring(0,
e.column));if(b=/^(\s*)(\/\*)/.exec(c))return{text:"\n"+b[1]+" * "};if(b=/^(\s*\*+\s*)/.exec(c))return{text:"\n"+b[1],selection:[1,b[1].length,1,b[1].length]}}for(b=f-1;/\s/.test(c[b]);)--b;b=c[b];f=c[f];if(q=c.match(/\s*namespace\s*\w*\s*{/))return p=this.$getIndent(c),{text:"\n"+p,selection:[1,p.length,1,p.length]};if("("==b&&")"==f||"["==b&&"]"==f)return c=this.$getIndent(c),p=c+d,{text:"\n"+p+"\n"+c,selection:[1,p.length,1,p.length]};if("{"==b&&"}"==f){if(/^\s*{/.test(c))return c=this.$getIndent(c),
p=c+p.getTabString(),{text:"\n"+p+"\n"+c,selection:[1,p.length,1,p.length]};m=a.getRowForOpenBraceIndent(p,m);if(null!==m&&0<=m)return c=this.$getIndent(p.getDocument().getLine(m)),p=c+p.getTabString(),{text:"\n"+p+"\n"+c,selection:[1,p.length,1,p.length]};c=this.$getIndent(c);p=c+d;return{text:"\n"+p+"\n"+c,selection:[1,p.length,1,p.length]}}}}});this.add("braces","insertion",function(a,d,c,p,m){if(this.insertMatching){if("{"==m&&(a=c.getSelectionRange(),""===p.doc.getTextRange(a))){a=this.codeModel.getTokenCursor();
if(!a.moveToPosition(c.getCursorPosition()))return b("{",m,c,p);do if(!a.bwdToMatchingArrow()){d=a.currentValue();if(!d||!d.length)break;if("namespace"===d)return{text:"{",selection:[1,1]};if("class"===d||"struct"===d||"="===d)return{text:"{};",selection:[1,1]};if(h&&"do"===d)return{text:"{} while ();",selection:[1,1]};if(";"===d||"["===d||"]"===d||"("===d||")"===d||"{"===d||"}"===d||"if"===d||"else"===d||"#"===d[0])return{text:"{}",selection:[1,1]}}while(a.moveToPreviousToken())}return b("{",m,c,
p)}});this.add("braces","deletion",function(a,b,d,c,m){if(this.insertMatching&&(a=c.doc.getTextRange(m),!m.isMultiLine()&&"{"==a)){a=c.doc.getLine(m.start.row);if(/^\s*do\s*\{\} while \(\);\s*$/.test(a))return m.end.column=a.length,m;c=a.substring(m.end.column,m.end.column+1);a=a.substring(m.end.column+1,m.end.column+2);if("}"==c)return m.end.column++,";"==a&&m.end.column++,m}});this.add("parens","insertion",function(a,d,c,p,m){if(this.insertMatching)return b("(",m,c,p)});this.add("parens","deletion",
function(a,b,d,p,m){if(this.insertMatching)return c("(",m,p)});this.add("brackets","insertion",function(a,d,c,p,m){if(this.insertMatching)return b("[",m,c,p)});this.add("brackets","deletion",function(a,b,d,p,m){if(this.insertMatching)return c("[",m,p)});this.add("arrows","insertion",function(a,d,c,p,m){if(this.insertMatching&&(a=p.getLine(c.getCursorPosition().row),/^\s*#\s*include/.test(a)))return b("<",m,c,p)});this.add("arrows","deletion",function(a,b,d,p,m){if(this.insertMatching)return c("<",
m,p)});this.add("string_dquotes","insertion",function(a,b,d,c,m){if(this.insertMatching&&('"'==m||"'"==m)){a=d.getSelectionRange();b=c.doc.getTextRange(a);if(""!==b)return{text:m+b+m,selection:!1};d=d.getCursorPosition();b=c.doc.getLine(d.row);if("\\"==b.substring(d.column-1,d.column))return null;c=c.getTokens(a.start.row);for(var e=0,f,p=-1,h=0;h<c.length;h++){f=c[h];"string"==f.type?p=-1:0>p&&(p=f.value.indexOf(m));if(f.value.length+e>a.start.column)break;e+=c[h].value.length}if(!f||0>p&&"comment"!==
f.type&&("string"!==f.type||a.start.column!==f.value.length+e-1&&f.value.lastIndexOf(m)===f.value.length-1))return{text:m+m,selection:[1,1]};if(f&&"string"===f.type&&b.substring(d.column,d.column+1)==m)return{text:"",selection:[1,1]}}});this.add("string_dquotes","deletion",function(a,b,d,c,m){if(this.insertMatching&&(a=c.doc.getTextRange(m),!m.isMultiLine()&&('"'==a||"'"==a)&&(c=c.doc.getLine(m.start.row).substring(m.start.column+1,m.start.column+2),'"'===c||"'"===c)))return m.end.column++,m});this.add("punctuation.operator",
"insertion",function(a,b,d,c,m){if(this.insertMatching&&";"===m&&(a=d.selection.getCursor(),";"==c.getLine(a.row)[a.column]))return{text:"",selection:[1,1]}});this.add("macro","insertion",function(a,b,d,c,m){b=d.getPrintMarginColumn();b=Math.min(62,b);var e=c.getDocument().$lines,f=d.getCursorPosition(),p=f.row,h=e[p];d=h.substring(0,f.column);if(/^\s*#\s*define[^\\]*$/.test(h)&&"\\"==m)return a=b-d.length+1,0<=a?{text:Array(a+1).join(" ")+"\\\n"+this.$getIndent(h)+c.getTabString(),selection:!1}:
{text:"\\\n"+c.getTabString(),selection:!1};if(/^\s*#\s*define/.test(h)||this.codeModel.inMacro(e,p-1)){if("\\"==m&&/^\s*$/.test(h.substring(d.length,h.length)))return a=b-d.length+1,0<=a?{text:Array(a+1).join(" ")+"\\",selection:!1}:{text:"\\",selection:!1};if("\n"==m){if(/^\s*$/.test(h)||/^\s*#\s*define/.test(h)&&!/\\\s*$/.test(h))return{text:"\n",selection:!1};if(/\\\s*$/.test(h)&&!/\\\s*$/.test(d))return{text:"",selection:[1,f.column,1,f.column]};c=c.getMode().getNextLineIndent(a,h+"\\",c.getTabString(),
p,!1);a=b-d.length+1;m=/\\\s*$/.test(d)?"":"\\";return 0<=a?{text:Array(a+1).join(" ")+m+"\n"+c,selection:!1}:{text:m+"\n"+c,selection:!1}}}})};l.inherits(a,g);k.CStyleBehaviour=a;k.setFillinDoWhile=function(a){h=a};k.getFillinDoWhile=function(){return h}});define("mode/cpp_code_model",["require","exports","module"],function(a,k,l){a("ace/lib/oop");var g=a("ace/range").Range,n=a("mode/token_utils").TokenUtils;a("ace/token_iterator");var h=a("mode/token_cursor").CppTokenCursor,f=a("mode/cpp_scope_tree").CppScopeNode,d=a("mode/cpp_scope_tree").CppScopeManager,b=a("mode/r_code_model").getVerticallyAlignFunctionArgs,c=a("mode/utils");a=function(a,b,c,p,m){this.$session=a;this.$doc=a.getDocument();this.$tokenizer=b;this.$tokens=Array(this.$doc.getLength());
this.$statePattern=c;this.$codeBeginPattern=p;this.$codeEndPattern=m;this.$tokenUtils=new n(this.$doc,this.$tokenizer,this.$tokens,this.$statePattern,this.$codeBeginPattern);this.$scopes=new d(f);var e=!0,h=function(a,b){e?e=!1:(this.$doc.off("change",g),this.$session.off("changeMode",h))}.bind(this),g=function(a){this.$onDocChange(a)}.bind(this);this.$session.on("changeMode",h);this.$doc.on("change",g)};(function(){var a=c.contains;this.getTokenCursor=function(){return new h(this.$tokens,0,0,this)};
this.$tokenizeUpToRow=function(a){this.$tokenUtils.$tokenizeUpToRow(a)};var d=function(b,d){for(;;){var c=b.currentValue(),e=d.$doc.getLine(b.$row);if(a(["{","}",";"],c))break;if(":"===c&&(c=b.peekBwd().currentValue(),a(["public","private","protected"],c)))break;if(/^\s*#/.test(e))break;if(!b.moveToPreviousToken())break}},f="if else for do while struct class try catch switch".split(" "),p=function(a){a=a.trim();return a=a.replace(/[\n\s]+/g," ")},m=function(a,b){var d=p(a),c=b;"undefined"===typeof c&&
(c=80);d.length>c&&(d=d.substring(0,c)+"...");return d};this.$complements={"<":">",">":"<","{":"}","}":"{","[":"]","]":"[","(":")",")":"(","'":"'",'"':'"'};this.alignContinuationSlashes=function(a,b){"undefined"===typeof b&&(b={start:0,end:a.getLength()});var d=a.$lines;if(!(d instanceof Array))return!1;for(var c=b.start;c<b.end;c++)if(l.test(d[c])){var e=c;for(c+=1;l.test(d[c])&&c<=b.end;)c++;for(var m=c,f=d.slice(e,m).map(function(a){return a.lastIndexOf("\\")}),p=Math.max.apply(null,f),h=0;h<m-
e;h++){var g={row:e+h,column:f[h]},q=Array(p-f[h]+1).join(" ");a.insert(g,q)}}return!0};this.allIndicesOf=function(a,b){for(var d=[],c=0;c<a.length;c++)a[c]==b&&d.push(c);return d};this.getRowForMatchingEOLArrows=function(a,b,d){a=0;for(var c,e=1;100>e;e++){c=this.getLineSansComments(b,d-e);if(/;\s*$/.test(c))break;if(/<\s*$/.test(c)&&!/<<\s*$/.test(c)){if(0===a)return d-e;a--}else/^\s*>/.test(c)&&!/^\s*>>/.test(c)&&a++}return-1};var n=/^\s*#\s*define/,l=/\\\s*$/,y=/^\s*[+\-/&^%$!<>.?|=~]|^\s*\*[^/]|^\s*\/[^\*]/,
k=/[+\-*&^%$!<>.?|=~]\s*$|\*[^/]\s*$|\/[^\*]\s*$/,B=function(a){return y.test(a)||k.test(a)};this.inMacro=function(a,b){var c=a[b];return 0>b?!1:l.test(c)?n.test(c)?!0:this.inMacro(a,b-1):!1};this.$buildScopeTreeUpToRow=function(a){a=Math.min(a+30,this.$doc.getLength()-1);this.$tokenUtils.$tokenizeUpToRow(a);var b=this.getTokenCursor();if(b.seekToNearestToken(this.$scopes.parsePos,a)){do{this.$scopes.parsePos=b.currentPosition();this.$scopes.parsePos.column+=b.currentValue().length;var c=b.currentToken().type;
if(/\bsectionhead\b/.test(c)){if(c=/^\/\/'?[-=#\s]*(.*?)\s*[-=#]+\s*$/.exec(b.currentValue()))c=""+c[1],0==c.length&&(c="(Untitled)"),50<c.length&&(c=c.substring(0,50)+"..."),this.$scopes.onSectionStart(c,b.currentPosition())}else if(/\bcodebegin\b/.test(c)){c=b.currentPosition();var e={row:c.row+1,column:0};this.$scopes.getTopLevelScopeCount();this.$scopes.onChunkStart("(R Code Chunk)","(R Code Chunk)",c,e)}else if(/\bcodeend\b/.test(c)){for(c=b.currentPosition();this.$scopes.onScopeEnd(c););c.column+=
b.currentValue().length;this.$scopes.onChunkEnd(c)}else if("{"===b.currentValue())if(c=b.cloneCursor(),e=c.currentPosition(),c.isFirstSignificantTokenOnLine()&&(e.column=0),"namespace"===c.peekBwd(2).currentValue())c.moveToPreviousToken(),e=c.currentValue(),this.$scopes.onNamespaceScopeStart("namespace "+e,c.currentPosition(),b.currentPosition(),e);else if("namespace"===c.peekBwd().currentValue())this.$scopes.onNamespaceScopeStart("anonymous namespace",e,b.currentPosition(),"<anonymous>");else if("class"===
c.peekBwd(2).currentValue()||"struct"===c.peekBwd(2).currentValue()||c.bwdOverClassInheritance()){c.moveToPreviousToken();var f=c.cloneCursor();d(f,this);f=f.peekFwd().currentPosition();e=this.$session.getTextRange(new g(f.row,f.column,e.row,e.column));e=p(e);this.$scopes.onClassScopeStart(e,c.currentPosition(),b.currentPosition(),e)}else if(c.bwdOverConstNoexceptDecltype()&&c.bwdOverInitializationList()&&c.moveBackwardOverMatchingParens()||c.moveBackwardOverMatchingParens())if("identifier"===c.peekBwd().currentType()||
"]"===c.peekBwd().currentValue()||/^operator/.test(c.peekBwd().currentValue()))if("]"===c.peekBwd().currentValue())c=c.currentPosition(),c=this.$session.getTextRange(new g(c.row,c.column,e.row,e.column-1)),c=p("lambda "+c),this.$scopes.onLambdaScopeStart(c,e,b.currentPosition());else{if(c.moveToPreviousToken()){var h="";e=c.currentValue();f="";var r=this.$scopes.getActiveScopes(c.currentPosition());null!=r&&(r=r[r.length-1],r.isClass()&&r.label==="class "+e?"~"===c.peekBwd().currentValue()&&(e="~"+
e):(h=c.cloneCursor(),d(h,this),h.moveToNextToken(),h=h.currentPosition(),r=c.currentPosition(),h=this.$session.getTextRange(new g(h.row,h.column,r.row,r.column))));var q=c.peekFwd();r=q.currentPosition();q.fwdToMatchingToken()&&("const"===q.peekFwd().currentValue()&&q.moveToNextToken(),"noexcept"===q.peekFwd().currentValue()&&q.moveToNextToken(),"noexcept"===q.currentValue()&&"("===q.peekFwd().currentValue()&&(q.moveToNextToken(),q.fwdToMatchingToken()),(q=q.peekFwd().currentPosition())&&(f=this.$session.getTextRange(new g(r.row,
r.column,q.row,q.column))));h=0<h.length?m(e.trim()+f.trim()+": "+h.trim()):m(e.trim()+f.trim());this.$scopes.onFunctionScopeStart(h,c.currentPosition(),b.currentPosition(),e.trim(),f.split(","))}}else this.$scopes.onScopeStart(e);else this.$scopes.onScopeStart(e);else"}"===b.currentValue()&&(c=b.currentPosition(),b.isLastSignificantTokenOnLine()?c.column=this.$doc.getLine(c.row).length+1:c.column++,this.$scopes.onScopeEnd(c))}while(b.moveToNextToken(a))}};this.getCurrentScope=function(a,b){b||(b=
function(a){return!0});if(!a)return"";this.$buildScopeTreeUpToRow(a.row);var c=this.$scopes.getActiveScopes(a);if(c)for(var d=c.length-1;0<=d;d--)if(b(c[d]))return c[d];return null};this.getScopeTree=function(){this.$buildScopeTreeUpToRow(this.$doc.getLength()-1);return this.$scopes.getScopeList()};this.getRowForOpenBraceIndent=function(b,c,d){if(1>=b.getDocument().$lines.length)return-1;if(this.$tokenUtils.$tokenizeUpToRow(c))try{for(var e=Array(this.$tokens.length),m=0;m<this.$tokens.length;m++)if(null!=
this.$tokens[m]&&0<this.$tokens[m].length){var h=this.$tokens[m];"\\"===h[h.length-1].value&&(e[m]=this.$tokens[m].splice(h.length-1,1)[0])}var r=this.getTokenCursor();if(d){var p=b.getSelection().getCursor();if(!r.moveToPosition(p))return 0}else for(r.$row=c,m=r.$tokens[c].length-1,m=r.$tokens[c].length-1;0<=m&&(r.$offset=m,"{"!==r.currentValue());m--);if("{"===r.peekBwd().currentValue()||";"===r.currentValue())return-1;r.bwdOverInitializationList();r.bwdOverClassInheritance();if("{"===r.currentValue()&&
!r.moveToPreviousToken()||"{"===r.currentValue())return-1;for(;"keyword"===r.currentType();){var g=r.currentValue();if(a(f,g)||0===r.$row&&0===r.$offset)return r.$row;if(!r.moveToPreviousToken())return-1}if(":"===r.currentValue()){var q=r.peekBwd().currentValue();if(a(["public","private","protected"],q))return r.moveToNextToken(),r.$row}if(":"===r.currentValue())for(;r.moveToPreviousToken();){if(r.bwdToMatchingToken())if("keyword"===r.peekBwd().currentType())continue;else break;if("identifier"===
r.currentType())break}if(")"===r.currentValue()&&!r.bwdToMatchingToken()||"("===r.currentValue()&&!r.moveToPreviousToken())return-1;"="===r.currentValue()&&r.moveToPreviousToken();return r.$row}finally{for(m=0;m<e.length;m++)"undefined"!==typeof e[m]&&this.$tokens[m].push(e[m])}return-1};this.getLineSansComments=function(a,b,c){if(0>b)return"";a=a.getLine(b);var d=/(?!\\)"/g,e=a,m;for(b=[];m=d.exec(e);)b.push(m.index);if(0<b.length&&0===b.length%2)for(d=0;d<b.length/2;d+=2)e=b[d+1],a=a.substring(0,
b[d]+1)+a.substring(e,a.length);b=a.indexOf("//");-1!=b&&(a=a.substring(0,b));l.test(a)&&(a=a.substring(0,a.lastIndexOf("\\")));c&&(a=a.replace(/\bconst\b/,"").replace(/\bnoexcept\b/,""));return a};this.findStartOfCommentBlock=function(a,b,c){for(var d=0,e=/^\s*\/+\*/;0<=b&&d<c;){if(e.test(a[b]))return b;--b;++d}return-1};this.getNextLineIndent=function(d,e,m,f,h){var p=b(),r=this.$session,g=r.getTabSize(),q=r.getDocument();"number"!==typeof f&&(f=r.getSelection().getCursor().row-1);if(-1===f)return e=
q.getLine(0),0<e.length?this.$getIndent(e):"";if(0===e.length||/^\s*#/.test(e))return this.getNextLineIndent(c.getPrimaryState(r,f-1),q.getLine(f-1),m,f-1,h);var y=this.$getIndent(e),v=this.$getUnindent(e,g),t=q.$lines;if(c.endsWith(d,"comment")||c.endsWith(d,"doc-start")){k&&k.row==f&&(e=e.substring(0,k.column));if(/^\s*$/.test(e))return this.$getIndent(t[f]);k=this.findStartOfCommentBlock(t,f,200);if(null!==k)return this.$getIndent(t[k])+" "}if(c.endsWith(d,"start")){if(n.test(e))return/\\\s*$/.test(e)?
y+m:y;if(/^\s*#\s*\S/.test(e))return y;if(this.inMacro(t,f-1)&&!l.test(e))return v;e=this.getLineSansComments(q,f);var k=r.getSelection().getCursor();k&&k.row==f&&!h&&(e=e.substring(0,k.column));d=this.getLineSansComments(q,f-1);if("string"!==typeof e)return"";if(0===e.length||/^\s*$/.test(e))return this.$getIndent(t[f]);if(/\*\/\s*$/.test(e)&&(v=this.findStartOfCommentBlock(t,f,200),0<=v))return this.$getIndent(t[v]);if(/^\s*<</.test(e)){for(e=f-1;/^\s*<</.test(t[e]);)e--;return this.$getIndent(t[e])}if(/^\s*\./.test(e)){for(e=
f-1;/^\s*\./.test(t[e]);)e--;return this.$getIndent(t[e])}if(/\bnamespace\b.*\{\s*$/.test(e)||/\bswitch\b.*\{\s*$/.test(e))return y;if(e.match(/\(\s*$/))return-1!==e.indexOf("=")||/^\s*(return\s+)?[a-zA-Z0-9_.->:]+\(\s*$/.test(e)?y+m:y+m+m;if(/^\s*(class|struct).*\{\s*$/.test(e)||/^\s*(class|struct)\s+.+:\s*$/.test(e))return y+m;if((v=e.match(/(^\s*(?:class|struct)\s+.*\w[^:]):[^:]\s*.+/))&&!/,\s*/.test(e)||(v=e.match(/^(\s*(class|struct).*:\s*).*,\s*$/))||(v=e.match(/^(\s*:\s*)(\w+).*,\s*$/))||(v=
e.match(/^(\s*)[:,]\s*[\w\s]*$/)))return p?Array(v[1].length+1).join(" "):y+m;if(/<\s*$/.test(e))return y+m;if(/^\s*".*"\s*$/.test(e)||/^\s*template\s*<.*>\s*$/.test(e)&&e.split(">").length==e.split("<").length)return y;if(/([\[\{\(<]).+,\s*$/.exec(e)){var x=["(","{","[","<"];for(v=0;v<x.length;v++){var A=x[v],w=this.$complements[A];A=this.allIndicesOf(e,A);if(A.length&&(w=this.allIndicesOf(e,w),w=A.length-w.length-1,!(0>w)))return t=A[w],p?(e=e.substr(t+1).match(/([^\s])/),Array(t+e.index+2).join(" ")):
y+m}}for(v=f-1;0<=v&&/^\s*$|^\s*#/.test(d);)d=this.getLineSansComments(q,v),v--;if(B(e)&&B(d))return this.$getIndent(e);if(this.$tokenUtils.$tokenizeUpToRow(f+2)){x=Array(this.$tokens.length);try{for(v=0;v<this.$tokens.length;v++)if(null!=this.$tokens[v]&&0<this.$tokens[v].length){var z=this.$tokens[v];"\\"===z[z.length-1].value&&(x[v]=this.$tokens[v].splice(z.length-1,1)[0])}var u=this.getTokenCursor();h?(u.$row=f,u.$offset=this.$tokens[f].length-1):u.moveToPosition(k);for(;0>u.$offset&&0<u.$row;)u.$row--,
u.$offset=u.$tokens[u.$row].length-1;for(;0<u.$row&&/^\s*#/.test(q.getLine(u.$row));)u.$row--,u.$offset=u.$tokens[u.$row].length-1;h="";var G=u.cloneCursor(),E=G.currentValue(),F=G.currentType();if("constant"===F||"keyword"===F||"identifier"===F||a(["{",")",">",":"],E))h=m;for(;";"===u.currentValue()&&u.moveToPreviousToken(););var M=u.cloneCursor();if(p&&u.isLastSignificantTokenOnLine()&&("keyword.operator"===u.currentType()||"punctuation.operator"===u.currentType())){var P=u.cloneCursor();P.$offset=
0;if("keyword"===P.currentType()){var N=e.split("(").length-e.split(")").length;if(0<N){var L=e.match(/.*?\(\s*(\S)/);if(L)return Array(L[0].length).join(" ")}}}if(","===u.currentValue()){if(p){var H=u.peekBwd();if("]"===H.currentValue()&&H.bwdToMatchingToken())return Array(H.currentPosition().column+1).join(" ");N=e.split("(").length-e.split(")").length;if(0<N&&(L=e.match(/.*?\(\s*(\S)/)))return Array(L[0].length).join(" ")}if(/[,(]\s*$/.test(e)&&/[,(]\s*$/.test(d))return this.$getIndent(e);var C=
u.cloneCursor();return C.findOpeningBracket("{",!1)&&C.bwdOverClassySpecifiers()&&"enum"===C.currentValue()?this.$getIndent(t[C.$row])+m:-1!==e.indexOf("=")?this.$getIndent(e)+m:this.$getIndent(e)}if("keyword.operator"===F&&":"!==E)return this.$getIndent(t[f])+m;for(;;){if("undefined"===typeof u.currentValue())return"undefined"!==typeof M.currentValue()?this.$getIndent(t[M.$row])+h:h;M=u.cloneCursor();if(";"===u.currentValue()&&u.moveToNextToken()){for(f=u.$row;null!=t[f]&&/^\s*#/.test(t[f]);)++f;
return this.$getIndent(t[f])+h}if(a(["for","while","do","try"],u.currentValue())&&";"!==E)return this.$getIndent(t[u.$row])+h;H=u.peekBwd();if(":"===u.currentValue()){if(a(["public","private","protected"],H.currentValue()))return this.$getIndent(t[H.$row])+m;var Q=t[u.$row];if(/^\s*case/.test(Q))return this.$getIndent(Q)+m;if(")"===H.currentValue()&&(C=H.cloneCursor(),C.bwdToMatchingToken())){var D=C.peekBwd(1),R=C.peekBwd(2);if(null!==D&&"identifier"===D.currentType()&&null!==R&&!/\boperator\b/.test(R.currentType()))return this.$getIndent(t[C.peekBwd().$row])+
h}}if("]"===u.currentValue()&&"("===u.peekFwd().currentValue()&&(C=u.cloneCursor(),C.bwdToMatchingToken()))return this.$getIndent(t[C.$row])+h;if("("===u.currentValue()&&"for"===H.currentValue()&&";"===E)return u.peekFwd().cloneCursor(),p?Array(u.peekFwd().currentPosition().column+1).join(" "):this.$getIndent(t[u.peekFwd().$row])+m;if(p&&"("===u.currentValue()&&!u.isLastSignificantTokenOnLine())return u.moveToNextToken(),Array(u.currentPosition().column+1+g).join(" ");if("if"===u.currentValue()||
"else"===u.currentValue()||"template"===u.currentValue()&&"<"===u.peekFwd().currentValue())return this.$getIndent(t[u.$row])+h;if("{"===u.currentValue()){var S=this.getRowForOpenBraceIndent(r,u.$row);return 0<=S?(e=this.getLineSansComments(q,S),y=this.$getIndent(e),/\bnamespace\b/.test(e)?y:y+m):this.$getIndent(t[u.$row])+m}if(0===u.$row&&0===u.$offset)return this.$getIndent(t[0])+h;if(">"===u.currentValue()&&(C=u.cloneCursor(),C.bwdToMatchingArrow()&&"template"===C.peekBwd().currentValue()))return">"===
E&&(h=""),this.$getIndent(t[C.$row])+h;u.bwdToMatchingToken();if(!u.moveToPreviousToken())break;for(;0<u.$row&&/^\s*#/.test(t[u.$row]);)u.$row--,u.$offset=this.$tokens[u.$row].length-1}}finally{for(v=0;v<x.length;v++)"undefined"!==typeof x[v]&&this.$tokens[v].push(x[v])}}}return y};this.$onDocChange=function(a){"insert"===a.action?this.$tokenUtils.$insertNewRows(a.start.row,a.end.row-a.start.row):this.$tokenUtils.$removeRows(a.start.row,a.end.row-a.start.row);this.$tokenUtils.$invalidateRow(a.start.row);
this.$scopes.invalidateFrom(a.start)};this.$getIndent=function(a){return(a=/^([ \t]*)/.exec(a))?a[1]:""};this.$padIndent=function(a,b,c){b=Array(b+1).join(" ");b=a.replace("\t",b);return b>=c?a:a+Array(c-b+1).join(" ")};this.$getUnindent=function(a,b){var c=this.$getIndent(a);if(null===c||0===c.length)return"";var e=c.indexOf("\t");if(-1!=e)return c.substring(0,e)+c.substring(e+1,c.length);for(var d=e=0;d<b&&d<c.length;d++)" "===c[d]&&e++;return c.substring(e,c.length)}}).call(a.prototype);k.CppCodeModel=
a});define("mode/cpp_scope_tree",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");var g=a("mode/r_scope_tree");a=g.ScopeManager;var n=g.ScopeNode,h=function(a,d,b,c,e,h){this.label=a;this.start=d;this.preamble=b||d;this.end=null;this.scopeType=c;this.scopeCategory=e;this.attributes=h||{};this.parentScope=null;this.$children=[]};l.mixin(h.prototype,n.prototype);h.CATEGORY_CLASS=1;h.CATEGORY_NAMESPACE=2;h.CATEGORY_FUNCTION=3;h.CATEGORY_LAMBDA=4;h.CATEGORY_ANON=5;(function(){this.isClass=
function(){return this.scopeType==n.TYPE_BRACE&&this.scopeCategory==h.CATEGORY_CLASS};this.isNamespace=function(){return this.scopeType==n.TYPE_BRACE&&this.scopeCategory==h.CATEGORY_NAMESPACE};this.isFunction=function(){return this.scopeType==n.TYPE_BRACE&&this.scopeCategory==h.CATEGORY_FUNCTION};this.isLambda=function(){return this.scopeType==n.TYPE_BRACE&&this.scopeCategory==h.CATEGORY_LAMBDA}}).call(h.prototype);g=function(a){this.$ScopeNodeFactory=a;this.parsePos={row:0,column:0};this.$root=new a("(Top Level)",
this.parsePos,null,n.TYPE_ROOT)};l.mixin(g.prototype,a.prototype);(function(){this.onClassScopeStart=function(a,d,b,c){a=new this.$ScopeNodeFactory(a,b,d,n.TYPE_BRACE,h.CATEGORY_CLASS,{name:c});this.$root.addNode(a);this.printScopeTree()};this.onNamespaceScopeStart=function(a,d,b,c){a=new this.$ScopeNodeFactory(a,b,d,n.TYPE_BRACE,h.CATEGORY_NAMESPACE,{name:c});this.$root.addNode(a);this.printScopeTree()};this.onFunctionScopeStart=function(a,d,b,c,e){a=new this.$ScopeNodeFactory(a,b,d,n.TYPE_BRACE,
h.CATEGORY_FUNCTION,{name:c,args:e});this.$root.addNode(a);this.printScopeTree()};this.onLambdaScopeStart=function(a,d,b,c){a=new this.$ScopeNodeFactory(a,b,d,n.TYPE_BRACE,h.CATEGORY_LAMBDA,{args:c});this.$root.addNode(a);this.printScopeTree()};this.onScopeStart=function(a){this.$root.addNode(new this.$ScopeNodeFactory(null,a,null,n.TYPE_BRACE));this.printScopeTree()};this.onScopeEnd=function(a){a=this.$root.closeScope(a,n.TYPE_BRACE);this.printScopeTree();return a}}).call(g.prototype);k.CppScopeManager=
g;k.CppScopeNode=h});define("mode/dcf",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");var g=a("ace/mode/text").Mode,n=a("ace/tokenizer").Tokenizer,h=a("mode/dcf_highlight_rules").DcfHighlightRules;a=function(){this.$tokenizer=new n((new h).getRules())};l.inherits(a,g);(function(){this.getNextLineIndent=function(a,d,b){return this.$getIndent(d)}}).call(a.prototype);k.Mode=a});define("mode/dcf_highlight_rules",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");a=a("ace/mode/text_highlight_rules").TextHighlightRules;var g=function(){this.$rules={start:[{token:["keyword","text"],regex:"^([\\w@-]+)(\\:)"},{token:"text",regex:".+"}]}};l.inherits(g,a);k.DcfHighlightRules=g});define("mode/doc_comment_highlight_rules",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");a=a("ace/mode/text_highlight_rules").TextHighlightRules;var g=function(){this.$rules={start:[{token:"comment.doc.tag",regex:"[@\\\\][\\w\\d_]+"},{token:"comment.doc",merge:!0,regex:"\\s+"},{token:"comment.doc",merge:!0,regex:"TODO"},{token:"comment.doc",merge:!0,regex:"[^@\\\\\\*]+"},{token:"comment.doc",merge:!0,regex:"."}]}};l.inherits(g,a);g.getStartRule=function(a){return{token:"comment.doc",
merge:!0,regex:"\\/\\*[\\*\\!]",next:a}};g.getEndRule=function(a){return{token:"comment.doc",merge:!0,regex:"\\*\\/",next:a}};k.DocCommentHighlightRules=g});define("util/expand_selection",["require","exports","module"],function(a,k,l){k=a("ace/editor").Editor;var g=a("ace/range").Range;a("ace/keyboard/vim");var n=a("ace/token_iterator").TokenIterator,h=a("mode/utils");(function(){function a(a,b){for(var c=a.session.getTokens(b),e=0;e<c.length;e++){var d=c[e];if(!/^\s*$/.test(d.value))return/\bcomment\b/.test(d.type)}return!1}function d(a,b){var c=a.start.row<b.start.row||a.start.row===b.start.row&&a.start.column<b.start.column,e=a.start.row===b.start.row&&
a.start.column===b.start.column,d=a.end.row>b.end.row||a.end.row===b.end.row&&a.end.column>b.end.column,m=a.end.row===b.end.row&&a.end.column===b.end.column;return c?d||m:d?c||e:!1}function b(a,b){for(var c=a.getCurrentToken(),e=a.getCurrentTokenRow();a.moveToPreviousSignificantToken();){var d=a.getCurrentToken();if(e!==a.getCurrentTokenRow()&&0!==d.type.indexOf("keyword.operator")){if(!a.moveToNextSignificantToken())return!1;break}if(t.test(c.value)&&(t.test(d.value)||h.isOpeningBracket(d.value)||
h.contains(b,d.value))){if(!a.moveToNextSignificantToken())return!1;break}a.bwdToMatchingToken();c=a.getCurrentToken();e=a.getCurrentTokenRow()}return!0}function c(a,b,c){p.push({name:a,immediate:b,execute:c})}var e=this,t=/['"\w.]/,q=!1;this.$onClearSelectionHistory=function(){return e.$clearSelectionHistory()};this.$clearSelectionHistory=function(){this.$selectionRangeHistory=null;this.off("change",this.$clearSelectionHistory)};this.$acceptSelection=function(a,b,c){null==this.$selectionRangeHistory&&
(this.$selectionRangeHistory=[]);a.setSelectionRange(b);a.getRange().isEqual(c)||this.$selectionRangeHistory.push(c);this.isRowFullyVisible(b.start.row)&&this.isRowFullyVisible(b.end.row)||this.centerSelection(a);return b};var p=[];c("string",!0,function(a,b,c,e){return(a=b.getTokenAt(e.start.row,e.start.column+1))&&/\bstring\b/.test(a.type)?new g(e.start.row,a.column+1,e.start.row,a.column+a.value.length-1):null});c("token",!0,function(a,b,c,e){return(a=b.getTokenAt(e.start.row,e.start.column+1))&&
/[\d\w]/.test(a.value)?new g(e.start.row,a.column,e.start.row,a.column+a.value.length):null});c("comment",!0,function(b,c,e,d){c=d.start.row;d=d.end.row;for(e=c;e<=d;e++)if(!a(b,e))return null;for(;a(b,c);)c--;for(;a(b,d);)d++;b=b.getSession().getLine(d-1).length;return new g(c+1,0,d-1,b)});c("includeBoundaries",!0,function(a,b,c,e){a=new n(b);c=a.moveToPosition(e.start);0===e.start.column&&(c=a.moveToPreviousToken());b=new n(b);e=b.moveToPosition(e.end,!0);if(c&&e){var d="support.function.codebegin"===
c.type&&"support.function.codeend"===e.type;d||(d=h.isOpeningBracket(c.value)&&h.getComplement(c.value)===e.value);if(d)return a=a.getCurrentTokenPosition(),c=b.getCurrentTokenPosition(),c.column+=e.value.length,g.fromPoints(a,c)}return null});c("matching",!1,function(a,b,c,e){a=new n(b);e=a.moveToPosition(e.start);if(null==e)return null;do{if(null==e)break;if(!a.bwdToMatchingToken()&&(h.isOpeningBracket(e.value)||"support.function.codebegin"===e.type)){c=a.getCurrentTokenPosition();"support.function.codebegin"===
e.type?(c.row++,c.column=0):c.column+=e.value.length;var d=a.clone();if(d.fwdToMatchingToken())return a=d.getCurrentTokenPosition(),"support.function.codebegin"===e.type&&(a.row--,a.column=b.getLine(a.row).length),g.fromPoints(c,a)}}while(e=a.stepBackward());return null});c("statement",!1,function(a,c,e,d){a=new n(c);if(!a.moveToPosition(d.start,!0))return null;c=new n(c);if(!(e=!c.moveToPosition(d.end)||!b(a,[";",",","=","<-","<<-"]))){a:{e=[";",","];for(var f=c.getCurrentToken(),p=c.getCurrentTokenRow();c.moveToNextSignificantToken();){var m=
c.getCurrentToken();if(p!==c.getCurrentTokenRow()&&0!==f.type.indexOf("keyword.operator")){if(!c.moveToPreviousSignificantToken()){e=!1;break a}break}if(t.test(f.value)||h.isClosingBracket(f.value))if(t.test(m.value)||h.isClosingBracket(m.value)||h.contains(e,m.value)){if(!c.moveToPreviousSignificantToken()){e=!1;break a}break}c.fwdToMatchingToken();f=c.getCurrentToken();p=c.getCurrentTokenRow()}e=!0}e=!e}if(e)return null;e=a.getCurrentTokenPosition();f=c.getCurrentTokenPosition();if(e.row===d.start.row&&
e.column===d.start.column&&f.row===d.end.row&&f.column<=d.end.column&&!b(a,[";",","]))return null;d=a.getCurrentTokenPosition();a=c.getCurrentTokenPosition();a.column+=c.getCurrentTokenValue().length;return g.fromPoints(d,a)});c("scope",!1,function(a,b,c,e){c=b.getMode();if(null==c.codeModel||null==c.codeModel.getCurrentScope)return null;a=[];for(e=c.codeModel.getCurrentScope(e.start);null!=e;){c=e.preamble;var d=e.end;if(null==d&&e.parentScope)for(var f=e.parentScope.$children,h=f.length-2;0<=h;h--)if(f[h].equals(e)){d=
f[h+1].preamble;break}null==d&&(d={row:b.getLength(),column:0});a.push(g.fromPoints(c,d));e=e.parentScope}return 0===a.length?null:a});c("everything",!1,function(a,b,c,e){a=b.getLength();if(0===a)return new g(0,0,0,0);b=b.getLine(a-1);return new g(0,0,a-1,b.length)});this.$expandSelection=function(){q||(e.on("change",e.$onClearSelectionHistory),q=!0);for(var a=this.getSession(),b=this.getSelection(),c=b.getRange(),f=[],g=0;g<p.length;g++){var n=p[g],t=n.execute(this,a,b,c);h.isArray(t)||(t=[t]);for(var l=
0;l<t.length;l++){var k=t[l];if(k&&n.immediate&&d(k,c))return this.$acceptSelection(b,k,c);k&&d(k,c)&&f.push({name:n.name,range:k})}}f.sort(function(a,b){a=a.range;b=b.range;var c=a.end.row-a.start.row,e=b.end.row-b.start.row;return c!==e?c>e:a.end.column-a.start.column>b.end.column-b.start.column});return this.$acceptSelection(b,f[0].range,c)};this.$shrinkSelection=function(){var a=this.$selectionRangeHistory;if(a&&a.length)return a=a.pop(),this.getSelection().setSelectionRange(a),this.isRowFullyVisible(a.start.row)&&
this.isRowFullyVisible(a.end.row)||this.centerSelection(this.getSelection()),a;q&&(e.off("change",e.$onClearSelectionHistory),q=!1);return this.getSelectionRange()}}).call(k.prototype)});define("mode/markdown",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");var g=a("ace/mode/text").Mode,n=a("ace/mode/javascript").Mode,h=a("ace/mode/xml").Mode,f=a("ace/mode/html").Mode,d=a("mode/markdown_highlight_rules").MarkdownHighlightRules,b=a("mode/markdown_folding").FoldMode;a=function(){this.HighlightRules=d;this.createModeDelegates({"js-":n,"xml-":h,"html-":f});this.foldingRules=new b};l.inherits(a,g);(function(){this.type="text";this.blockComment={start:"\x3c!--",end:"--\x3e"};
this.getNextLineIndent=function(a,b,d){return this.$getIndent(b)};this.$id="mode/markdown"}).call(a.prototype);k.Mode=a});define("mode/markdown_folding",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");var g=a("ace/mode/folding/fold_mode").FoldMode,n=a("ace/range").Range;k=k.FoldMode=function(){};var h=a("mode/utils");l.inherits(k,g);(function(){this.foldingStartMarker=/^(?:[=-]+\s*$|#{1,6} |`{3})/;this.getFoldWidget=function(a,d,b){d="markbeginend"===d?"end":"";var c=a.getLine(b);return this.foldingStartMarker.test(c)?"`"==c[0]?"start"===h.getPrimaryState(a,b)?d:"start":"":""};this.getFoldWidgetRange=
function(a,d,b){function c(b){return(l=a.getTokens(b)[0])&&0===l.type.lastIndexOf(k,0)}function e(){var a=l.value[0];return"="==a?6:"-"==a?5:7-l.value.search(/[^#]/)}var f=a.getLine(b);d=f.length;var g=a.getLength(),p=b,m=b;if(f.match(this.foldingStartMarker)){if("`"==f[0]){if("start"!==h.getPrimaryState(a,b)){for(;++b<g&&!(f=a.getLine(b),"`"==f[0]&"```"==f.substring(0,3)););return new n(p,d,b,0)}for(;0<b--&&!(f=a.getLine(b),"`"==f[0]&"```"==f.substring(0,3)););return new n(b,f.length,p,0)}var l,
k="markup.heading";if(c(b)){for(m=e();++b<g&&!(c(b)&&e()>=m););m=b-(l&&-1!=["=","-"].indexOf(l.value[0])?2:1);if(m>p)for(;m>p&&/^\s*$/.test(a.getLine(m));)m--;if(m>p)return b=a.getLine(m).length,new n(p,d,m,b)}}}}).call(k.prototype)});define("mode/markdown_highlight_rules",["require","exports","module"],function(a,k,l){function g(a,b){return{token:"support.function",regex:"^\\s*```(?:\\{"+a+"[^\\}]*\\}|"+a+")\\s*$",push:b+"start"}}l=a("ace/lib/oop");var n=a("ace/lib/lang"),h=a("ace/mode/text_highlight_rules").TextHighlightRules,f=a("ace/mode/javascript_highlight_rules").JavaScriptHighlightRules,d=a("ace/mode/xml_highlight_rules").XmlHighlightRules,b=a("ace/mode/html_highlight_rules").HtmlHighlightRules,c=a("ace/mode/css_highlight_rules").CssHighlightRules,
e=a("ace/mode/perl_highlight_rules").PerlHighlightRules,t=a("mode/python_highlight_rules").PythonHighlightRules,q=a("ace/mode/ruby_highlight_rules").RubyHighlightRules,p=a("ace/mode/scala_highlight_rules").ScalaHighlightRules,m=a("mode/sh_highlight_rules").ShHighlightRules;a("mode/stan_highlight_rules");var v=a("mode/sql_highlight_rules").SqlHighlightRules,x=function(a){return"(?:[^"+n.escapeRegExp(a)+"\\\\]|\\\\.)*"};a=function(){var a=n.arrayToMap("title author date rtl depends autosize width height transition transition-speed font-family css class navigation incremental left right id audio video type at help-doc help-topic source console console-input execute pause".split(" ")),
h={token:["text","constant.numeric.text","constant.numeric.text","constant.numeric.text"],regex:"(^|\\s+)(_{2,3})(?![\\s_])(.*?)(?=_)(\\2)\\b"},l={token:["text","constant.language.boolean.text"],regex:"(^|\\s+)(_(?=[^\\s_]).*?_)\\b"},k={token:["constant.numeric.text","constant.numeric.text","constant.numeric.text"],regex:"([*]{2,3})(?![\\s*])(.*?)(?=[*])(\\1)"},z={token:["constant.language.boolean.text"],regex:"([*](?=[^\\s*]).*?[*])"},G={token:"text",regex:"\\^\\["+x("]")+"\\]"},E={token:"text constant text url string text".split(" "),
regex:'^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:["][^"]+["])?(\\s*))$'},F={token:["text","keyword","text","constant","text"],regex:"(\\s*\\[)("+x("]")+")(\\]\\[)("+x("]")+")(\\])"},I={token:"text keyword text markup.href string text paren.keyword.operator nospell paren.keyword.operator".split(" "),regex:"(\\s*\\[)("+x("]")+')(\\]\\()((?:[^\\)\\s\\\\]|\\\\.|\\s(?=[^"]))*)(\\s*"'+x('"')+'"\\s*)?(\\))(?:(\\s*{)((?:[^\\}]+))(\\s*}))?'},r={token:["text","keyword","text"],regex:"(<)((?:https?|ftp|dict):[^'\">\\s]+|(?:mailto:)?[-.\\w]+\\@[-a-z0-9]+(?:\\.[-a-z0-9]+)*\\.[a-z]+)(>)"};
this.$rules={basic:[{token:"constant.language.escape",regex:/\\[\\`*_{}[\]()#+\-.!]/},{token:"text",regex:/[?]`/},{token:"support.function.inline_r_chunk",regex:"`r (?:.*?[^`])`"},{token:["support.function","support.function","support.function"],regex:"(`+)(.*?[^`])(\\1)"},G,E,F,I,r,k,h,z,l],start:[{token:"empty_line",regex:"^\\s*$",next:"allowBlock"},{token:"text",regex:/[?]`/},{token:"support.function.inline_r_chunk",regex:"`r (?:.*?[^`])`"},{token:["support.function","support.function","support.function"],
regex:"(`+)([^\\r]*?[^`])(\\1)"},{token:"markup.heading.1",regex:"^\\={3,}\\s*$",next:"fieldblock"},{token:"markup.heading.1",regex:"^={3,}(?=\\s*$)"},{token:"markup.heading.2",regex:"^\\-{3,}(?=\\s*$)"},{token:function(a){return"markup.heading."+a.length},regex:/^#{1,6}(?=\s*[^ #]|\s+#.)/,next:"header"},g("(?:javascript|js)","jscode-"),g("xml","xmlcode-"),g("html","htmlcode-"),g("css","csscode-"),g("perl","perlcode-"),g("python","pythoncode-"),g("ruby","rubycode-"),g("scala","scalacode-"),g("sh",
"shcode-"),g("bash","bashcode-"),g("stan","stancode-"),g("sql","sqlcode-"),g("d3","jscode-"),{token:"support.function",regex:"^\\s*```\\s*\\S*(?:{.*?\\})?\\s*$",next:"githubblock"},{token:"string.blockquote",regex:"^\\s*>\\s*(?=[-])"},{token:"string.blockquote",regex:"^\\s*>\\s*",next:"blockquote"},G,E,F,{token:"constant.hr",regex:"^\\s*[*](?:\\s*[*]){2,}\\s*$",next:"allowBlock"},{token:"constant.hr",regex:"^\\s*[-](?:\\s*[-]){2,}\\s*$",next:"allowBlock"},{token:"constant.hr",regex:"^\\s*[_](?:\\s*[_]){2,}\\s*$",
next:"allowBlock"},{token:"latex.markup.list.string.begin",regex:"\\\\\\[",next:"mathjaxnativedisplay"},{token:"latex.markup.list.string.begin",regex:"\\\\\\(",next:"mathjaxnativeinline"},{token:"text",regex:"\\\\\\$"},{token:"latex.markup.list.string.begin",regex:"\\${2}",next:"mathjaxdisplay"},{token:["latex.markup.list.string.begin","latex.support.function","latex.markup.list.string.end"],regex:"(\\$)((?:(?:\\\\.)|(?:[^\\$\\\\]))*?)(\\$)"},{token:["text","keyword","text"],regex:"(<)((?:https?|ftp|dict):[^'\">\\s]+|(?:mailto:)?[-.\\w]+\\@[-a-z0-9]+(?:\\.[-a-z0-9]+)*\\.[a-z]+)(>)"},
{token:"keyword",regex:"\\\\(?:[a-zA-Z0-9]+|[^a-zA-Z0-9])"},{token:"paren.keyword.operator",regex:"[{}]"},{token:"markup.list",regex:"-?\\@[\\w\\d-]+"},{token:"text",regex:"[^\\*_%$`\\[#<>{}\\\\@\\s!]+"},{token:"text",regex:"\\\\"},{token:"text",regex:"^\\s*(?:[*+-]|\\d+\\.)\\s+",next:"listblock"},k,h,z,l,{token:"comment",regex:"<\\!--",next:"html-comment"},{include:"basic"}],"html-comment":[{token:"comment",regex:"--\x3e",next:"start"},{defaultToken:"comment.text"}],allowBlock:[{token:"support.function",
regex:"^ {4}.+",next:"allowBlock"},{token:"empty_line",regex:"^\\s*$",next:"allowBlock"},{token:"empty",regex:"",next:"start"}],header:[{regex:"$",next:"start"},{include:"basic"},{defaultToken:"heading"}],listblock:[{token:"empty_line",regex:"^\\s*$",next:"start"},{token:"text",regex:"^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",next:"listblock"},{token:["latex.markup.list.string.begin","latex.support.function","latex.markup.list.string.end"],regex:"(\\$)((?:(?:\\\\.)|(?:[^\\$\\\\]))*?)(\\$)"},{include:"basic",
noEscape:!0},{token:"support.function",regex:"^\\s*```\\s*[a-zA-Z]*(?:{.*?\\})?\\s*$",next:"githubblock"},{defaultToken:"text"}],blockquote:[{token:"empty_line",regex:"^\\s*$",next:"start"},{token:"constant.language.escape",regex:/\\[\\`*_{}[\]()#+\-.!]/},{token:"text",regex:/[?]`/},{token:"support.function.inline_r_chunk",regex:"`r (?:.*?[^`])`"},{token:["support.function","support.function","support.function"],regex:"(`+)(.*?[^`])(\\1)"},G,E,F,I,r,k,h,z,l,{defaultToken:"string.blockquote"}],githubblock:[{token:"support.function",
regex:"^\\s*```",next:"start"},{token:"support.function",regex:".+"}],fieldblock:[{token:function(b){b=b.slice(0,-1);return a[b]?"comment.doc.tag":"text"},regex:"^[\\w-]+\\:",next:"fieldblockvalue"},{token:"text",regex:"(?=.+)",next:"start"}],fieldblockvalue:[{token:"text",regex:"$",next:"fieldblock"},{token:"text",regex:"[^{}]+"}],mathjaxdisplay:[{token:"latex.markup.list.string.end",regex:"\\${2}",next:"start"},{token:"latex.support.function",regex:"[^\\$]+"}],mathjaxnativedisplay:[{token:"latex.markup.list.string.end",
regex:"\\\\\\]",next:"start"},{token:"latex.support.function",regex:"[\\s\\S]+?"}],mathjaxnativeinline:[{token:"latex.markup.list.string.end",regex:"\\\\\\)",next:"start"},{token:"latex.support.function",regex:"[\\s\\S]+?"}]};this.embedRules(f,"jscode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(b,"htmlcode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(c,"csscode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(d,
"xmlcode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(e,"perlcode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(t,"pythoncode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(q,"rubycode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(p,"scalacode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(m,"shcode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);
this.embedRules(m,"bashcode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(v,"sqlcode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(f,"jscode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.normalizeRules()};l.inherits(a,h);k.MarkdownHighlightRules=a});define("mode/mermaid",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");var g=a("ace/mode/text").Mode,n=a("ace/tokenizer").Tokenizer,h=a("mode/mermaid_highlight_rules").MermaidHighlightRules;a=function(){this.$highlightRules=new h;this.$tokenizer=new n(this.$highlightRules.getRules())};l.inherits(a,g);(function(){this.getNextLineIndent=function(a,d,b){return this.$getIndent(d)}}).call(a.prototype);k.Mode=a});define("mode/mermaid_highlight_rules",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");a=a("ace/mode/text_highlight_rules").TextHighlightRules;var g=function(){this.createKeywordMapper({keyword:"sequenceDiagram|participant|graph|subgraph|loop|alt|is|opt|else|end|style|linkStyle|classDef|class"},"identifier",!1);this.$rules={start:[{token:"keyword",merge:!1,regex:"^\\s*graph\\s+(?:TB|BT|RL|LR|TD)\\s*$"},{token:"keyword",merge:!1,regex:"^\\s*(?:sequenceDiagram|participant|subgraph|loop|alt(?:\\s+is)?|opt|else(?:\\s+is)?|end|style|linkStyle|classDef|class)"},
{token:"keyword.operator",merge:!1,regex:">|\\->|\\-\\->|\\-\\-\\-|\\-\\-|\\-\\.\\->|\\-\\.|\\.\\->|==>|==|\\->>|\\-\\->>|\\-x|\\-\\-x"},{token:"paren.keyword.operator",merge:!1,regex:"[[({\\|]"},{token:"paren.keyword.operator",merge:!1,regex:"[\\])}]"},{token:"markup.list",merge:!1,regex:"Note\\s+(?:left|right)\\s+of"},{token:"markup.list",merge:!1,regex:"<br/>"},{token:"text",regex:"\\s+",merge:!0}]}};l.inherits(g,a);k.MermaidHighlightRules=g});define("mode/python",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");var g=a("ace/mode/text").Mode,n=a("mode/python_highlight_rules").PythonHighlightRules,h=a("ace/mode/folding/pythonic").FoldMode,f=a("ace/range").Range;a=function(){this.HighlightRules=n;this.foldingRules=new h("\\:")};l.inherits(a,g);(function(){this.lineCommentStart="#";this.getLanguageMode=function(a){return"Python"};this.getNextLineIndent=function(a,b,c,e){a=this.$getIndent(b);if(/^\s*[#]/.test(b))return a;/[{([:]\s*(?:$|[#])/.test(b)&&
(a+=c);/^\s*(?:break|continue|pass|raise|return)\b/.test(b)&&(a=a.substring(0,a.length-c.length));return a};this.$performOutdent=function(a,b,c){var e=a.doc.$lines[c];c=this.$getIndent(a.doc.$lines[b]);e=this.$getIndent(e);e.length<c.length&&(b=new f(b,0,b,c.length),a.replace(b,e));return!0};this.$autoOutdentElse=function(a,b,c){a=b.doc.$lines[c].substring(0,b.selection.cursor.column);if(!/^\s*(?:else|elif)(?:\s|[:])/.test(a))return!1;for(a=c-1;0<=a;a--)if(/^\s*(?:if|elif|for|try)(?:\s|[:])/.test(b.doc.$lines[a]))return this.$performOutdent(b,
c,a)};this.$autoOutdentExceptFinally=function(a,b,c){a=b.doc.$lines[c].substring(0,b.selection.cursor.column);if(!/^\s*(?:except|finally)(?:\s|[:])/.test(a))return!1;for(a=c-1;0<=a;a--)if(/^\s*(?:try)(?:\s|[:])/.test(b.doc.$lines[a]))return this.$performOutdent(b,c,a)};this.checkOutdent=function(a,b,c){this.$lastInput=c;return":"===c||" "===c};this.$canAutoOutdent=function(a,b,c){a=b.selection.cursor;return 0===a.column?!1:":"===this.$lastInput?!0:" "===this.$lastInput?(b=b.getTokenAt(a.row,a.column-
1)||{},/\bkeyword\b/.test(b.type)):!1};this.autoOutdent=function(a,b,c){this.$canAutoOutdent(a,b,c)&&(this.$autoOutdentElse(a,b,c)||this.$autoOutdentExceptFinally(a,b,c))};this.transformAction=function(a,b,c,e,f){return!1};this.$id="mode/python"}).call(a.prototype);k.Mode=a});define("mode/python_highlight_rules",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");var g=a("ace/mode/text_highlight_rules").TextHighlightRules,n=a("mode/rainbow_paren_highlight_rules").RainbowParenHighlightRules;a=function(){this.$rules={start:[{token:"comment.doc.tag",regex:"#[|].*$",next:"start"},{token:"comment",regex:"#.*$"},{token:"constant.language",regex:"@[a-zA-Z_][a-zA-Z0-9._]*\\b"},{token:"string",regex:'(?:b|B|br|Br|bR|BR|rb|rB|Rb|RB|r|u|R|U|f|F|fr|Fr|fR|FR|rf|rF|Rf|RF)?"{3}',
next:"qqstring3"},{token:"string",regex:'(?:b|B|br|Br|bR|BR|rb|rB|Rb|RB|r|u|R|U|f|F|fr|Fr|fR|FR|rf|rF|Rf|RF)?"(?=.)',next:"qqstring"},{token:"string",regex:"(?:b|B|br|Br|bR|BR|rb|rB|Rb|RB|r|u|R|U|f|F|fr|Fr|fR|FR|rf|rF|Rf|RF)?'{3}",next:"qstring3"},{token:"string",regex:"(?:b|B|br|Br|bR|BR|rb|rB|Rb|RB|r|u|R|U|f|F|fr|Fr|fR|FR|rf|rF|Rf|RF)?'(?=.)",next:"qstring"},{token:"constant.numeric",regex:"(?:(?:(?:(?:(?:(?:(?:\\d+)?(?:\\.\\d+))|(?:(?:\\d+)\\.))|(?:\\d+))(?:[eE][+-]?\\d+))|(?:(?:(?:\\d+)?(?:\\.\\d+))|(?:(?:\\d+)\\.)))|\\d+)[jJ]\\b"},
{token:"constant.numeric",regex:"(?:(?:(?:(?:(?:(?:\\d+)?(?:\\.\\d+))|(?:(?:\\d+)\\.))|(?:\\d+))(?:[eE][+-]?\\d+))|(?:(?:(?:\\d+)?(?:\\.\\d+))|(?:(?:\\d+)\\.)))"},{token:"constant.numeric",regex:"(?:(?:(?:[1-9]\\d*)|(?:0))|(?:0[oO]?[0-7]+)|(?:0[xX][\\dA-Fa-f]+)|(?:0[bB][01]+))[lL]\\b"},{token:"constant.numeric",regex:"(?:(?:(?:[1-9]\\d*)|(?:0))|(?:0[oO]?[0-7]+)|(?:0[xX][\\dA-Fa-f]+)|(?:0[bB][01]+))\\b"},{token:this.createKeywordMapper({"invalid.deprecated":"debugger","support.function":"abs|all|any|ascii|basestring|bin|bool|breakpoint|bytearray|bytes|callable|chr|classmethod|cmp|compile|complex|delattr|dict|dir|divmod|eumerate|eval|execfile|exec|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|print|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip|__import__",
"constant.language":"NotImplemented|Ellipsis|__debug__",keyword:"False|None|True|and|as|assert|async|await|break|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|raise|return|try|while|with|yield"},"identifier"),regex:"[a-zA-Z_][a-zA-Z0-9_]*\\b"},{token:"keyword.operator",regex:"//=|\\*\\*=|>>=|<<=|//|\\*\\*|==|!=|>=|<=|:=|>>|<<|\\+=|-=|\\*=|/=|&=|%=|\\|=|\\^=|\\+|-|\\*|/|%|>|<|\\^|~|\\||&|=|:|\\.|;|,",merge:!1},n.getParenRule(),{token:"text",
regex:"\\s+"}],qqstring3:[{token:"constant.language.escape",regex:"\\\\(x[0-9A-Fa-f]{2}|[0-7]{3}|[\\\\abfnrtv'\"]|U[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})"},{token:"string",regex:'"{3}',next:"start"},{defaultToken:"string"}],qstring3:[{token:"constant.language.escape",regex:"\\\\(x[0-9A-Fa-f]{2}|[0-7]{3}|[\\\\abfnrtv'\"]|U[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})"},{token:"string",regex:"'{3}",next:"start"},{defaultToken:"string"}],qqstring:[{token:"constant.language.escape",regex:"\\\\(x[0-9A-Fa-f]{2}|[0-7]{3}|[\\\\abfnrtv'\"]|U[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})"},
{token:"string",regex:"\\\\$",next:"qqstring"},{token:"string",regex:'"|$',next:"start"},{defaultToken:"string"}],qstring:[{token:"constant.language.escape",regex:"\\\\(x[0-9A-Fa-f]{2}|[0-7]{3}|[\\\\abfnrtv'\"]|U[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})"},{token:"string",regex:"\\\\$",next:"qstring"},{token:"string",regex:"'|$",next:"start"},{defaultToken:"string"}]}};l.inherits(a,g);k.PythonHighlightRules=a});define("mode/r",["require","exports","module"],function(a,k,l){a("ace/editor");a("ace/edit_session");a("ace/range");l=a("ace/lib/oop");var g=a("ace/mode/text").Mode,n=a("ace/tokenizer").Tokenizer,h=a("ace/mode/text_highlight_rules").TextHighlightRules,f=a("mode/r_highlight_rules").RHighlightRules,d=a("mode/r_code_model").RCodeModel,b=a("mode/r_matching_brace_outdent").RMatchingBraceOutdent;a("mode/auto_brace_insert");var c=a("ace/unicode");a=function(a,c){this.$tokenizer=a?new n((new h).getRules()):
new n((new f).getRules());this.foldingRules=this.codeModel=new d(c,this.$tokenizer);this.$outdent=new b(this.codeModel)};l.inherits(a,g);(function(){this.getLanguageMode=function(a){return"R"};this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(a,b,c)};this.autoOutdent=function(a,b,c){return this.$outdent.autoOutdent(a,b,c)};this.tokenRe=new RegExp("^["+c.wordChars+"._]+","g");this.nonTokenRe=new RegExp("^(?:[^"+c.wordChars+"._]|\\s)+","g");this.$complements={"(":")","[":"]",'"':'"',
"'":"'","{":"}","`":"`"};this.$reOpen=/^[{(\["'`]$/;this.$reClose=/^[})\]"'`]$/;this.getNextLineIndent=function(a,b,c,d){return this.codeModel.getNextLineIndent(a,b,c,d)};this.allowAutoInsert=this.smartAllowAutoInsert;this.getIndentForOpenBrace=function(a){return this.codeModel.getIndentForOpenBrace(a)};this.$getIndent=function(a){return(a=a.match(/^(\s+)/))?a[1]:""};this.$id="mode/r"}).call(a.prototype);k.Mode=a});define("mode/r_code_model",["require","exports","module"],function(a,k,l){function g(a,b){for(var c=0;c<b.length;c++)if(a===b[c])return!0;return!1}function n(a){return"if"===a||"for"===a||"while"===a||"repeat"===a||"function"===a}var h=a("ace/range").Range,f=a("ace/token_iterator").TokenIterator,d=a("mode/token_cursor").RTokenCursor,b=a("mode/utils"),c=!1,e=a("mode/r_scope_tree").ScopeManager,t=a("mode/r_scope_tree").ScopeNode;a=function(a,b,c,d,f){this.$session=a;this.$doc=a.getDocument();this.$tokenizer=
b;this.$tokens=Array(this.$doc.getLength());this.$endStates=Array(this.$doc.getLength());this.$statePattern=c;this.$codeBeginPattern=d;this.$codeEndPattern=f;this.$scopes=new e(t);var h=!0,p=function(a,b){h?h=!1:(this.$doc.off("change",m),this.$session.off("changeMode",p))}.bind(this),m=function(a){this.$onDocChange(a)}.bind(this);this.$session.on("changeMode",p);this.$doc.on("change",m)};(function(){function a(a){return"keyword"==a.type&&"function"==a.value}function e(a){return/\boperator\b/.test(a.type)&&
/^(=|<-|<<-)$/.test(a.value)}function m(a){return/\bidentifier\b/.test(a.type)}function l(b){var c=b.cloneCursor();if("{"!==c.currentValue()||!c.moveBackwardOverMatchingParens()||!c.moveToPreviousToken()||!a(c.currentToken()))return!1;b.$row=c.$row;b.$offset=c.$offset;return!0}function k(a){for(;a.findOpeningBracket("(")&&a.moveToPreviousToken();)if(g(a.currentValue(),["if","for","while"]))return!0;return!1}function t(b){var c=b.cloneCursor();if(!(a(c.currentToken())&&c.moveToPreviousToken()&&e(c.currentToken())&&
c.moveToPreviousToken()))return!1;b.$row=c.$row;b.$offset=c.$offset;return!0}function A(a){return/\binfix\b/.test(a.type)||"|>"===a.value}function B(b){if(a(b.currentToken())&&!b.moveToNextToken()||"("===b.currentValue()&&!b.moveToNextToken()||")"===b.currentValue())return[];var c=[];for(m(b.currentToken())&&c.push(b.currentValue());b.moveToNextToken();)if(!b.fwdToMatchingToken()){if(")"===b.currentValue())break;if(","===b.currentValue()){for(;","===b.currentValue()&&b.moveToNextToken(););m(b.currentToken())&&
c.push(b.currentValue())}}return c}function w(a){for(var c=0,e=Math.min(a.getLength(),100),d="Title";c++<e;){var f=a.getLine(c);if(/^\s*[-]{3}\s*$/.test(f))break;f=/^\s*title:\s+(.*?)\s*$/.exec(f);if(null!==f){d=f[1];break}}return b.stripEnclosingQuotes(d.trim())}function z(a){return"keyword.operator"===a||"keyword.operator.infix"===a}var G=b.contains;this.getTokenCursor=function(){return new d(this.$tokens,0,0,this)};this.$complements={"(":")",")":"(","[":"]","]":"[","{":"}","}":"{"};var E=function(a){a=
a.trim();return a=a.replace(/[\n\s]+/g," ")};this.getFunctionsInScope=function(a){this.$buildScopeTreeUpToRow(a.row);return this.$scopes.getFunctionsInScope(a)};this.getAllFunctionScopes=function(a){"undefined"===typeof a&&(a=this.$doc.getLength());this.$buildScopeTreeUpToRow(a);return this.$scopes.getAllFunctionScopes()};this.getDplyrJoinContextFromInfixChain=function(a){var b=a.cloneCursor();a="";b.hasType("identifier")&&(a=b.currentValue());var c="left";"="===b.currentValue()&&(c="right");if(b.hasType("identifier")){if(!b.moveToPreviousToken())return null;
"="===b.currentValue()&&(c="right")}if(!b.findOpeningBracket("(",!0)||!b.moveToPreviousToken())return null;for(;b.findOpeningBracket("(",!0)&&b.moveToPreviousToken();)if(/_join$/.test(b.currentValue())){var e=b.currentValue();if(!b.moveToNextToken())break;if(!b.moveToNextToken())break;var d=b.currentValue();if(!1===this.moveToDataObjectFromInfixChain(b))break;b=b.currentValue();return{token:a,leftData:b,rightData:d,verb:e,cursorPos:c}}return null};this.getDataFromInfixChain=function(a){var b=this.moveToDataObjectFromInfixChain(a),
c=[],e=[],d="",f=!1;!1!==b&&(b.excludeArgsFromObject&&(f=b.excludeArgsFromObject),d=a.currentValue(),c=b.additionalArgs,e=b.excludeArgs);return{name:d,additionalArgs:c,excludeArgs:e,excludeArgsFromObject:f}};var F="mutate summarise summarize rename transmute select rename_vars inner_join left_join right_join semi_join anti_join outer_join full_join".split(" "),I=function(a,b,c,e){if(!a.moveToNextToken()||"("!==a.currentValue()||!a.moveToNextToken()||")"===a.currentValue())return!1;a.hasType("identifier")&&
b.additionalArgs.push(a.currentValue());if("rename"===e){if(!a.moveToNextToken())return!1;b.excludeArgs.push(a.currentValue())}"select"===e&&(b.excludeArgsFromObject=!0);do{if(")"===a.currentValue())break;if(a.$row>c.$row||a.$row===c.$row&&a.$offset>=c.$offset)break;if(a.fwdToMatchingToken()){if(!a.moveToNextToken())break}else if(","===a.currentValue()){if(!a.moveToNextToken())return!1;a.hasType("identifier")&&b.additionalArgs.push(a.currentValue());if(!a.moveToNextToken())return!1;if("="===a.currentValue()&&
g(e,["rename","rename_vars"])){if(!a.moveToNextToken())return!1;a.hasType("identifier")&&b.excludeArgs.push(a.currentValue())}}}while(a.moveToNextToken());return!0};this.moveToDataObjectFromInfixChain=function(a){var b=a.cloneCursor(),c;a:{for(c=b.cloneCursor();c.findOpeningBracket("(",!1)&&c.moveToPreviousToken()&&c.moveToPreviousToken();){if(":"===c.currentValue()){for(;":"===c.currentValue();)if(!c.moveToPreviousToken()){c=!1;break a}if(!c.moveToPreviousToken())break}if(A(c.currentToken())){b.$row=
c.$row;b.$offset=c.$offset;c=!0;break a}}c=!1}if(!c)return!1;for(c={additionalArgs:[],excludeArgs:[]};;){if(0===b.$row&&0===b.$offset)return a.$row=0,a.$offset=0,c;b.moveBackwardOverMatchingParens();if(!b.moveToPreviousToken())return!1;var e=b.currentValue();G(F,e)&&I(b.cloneCursor(),c,a,e);if(!b.moveToPreviousToken())return 0===b.$row&&0===b.$offset?(a.$row=0,a.$offset=0,c):!1;if(":"===b.currentValue()){for(;":"===b.currentValue();)if(!b.moveToPreviousToken())return!1;if(!b.moveToPreviousToken())return!1}if(!A(b.currentToken()))break}if(!b.moveToNextToken())return!1;
a.$row=b.$row;a.$offset=b.$offset;return c};this.getVariablesInScope=function(a){var b=this.getTokenCursor();if(!b.moveToPosition(a))return[];a=b.cloneCursor();a.findOpeningBracket("(",!0)&&a.moveToPreviousToken()&&"function"===a.currentValue()?(b.$row=a.$row,b.$offset=a.$offset,a=!0):a=!1;a&&t(b)&&b.findStartOfEvaluationContext();a={};do if(!b.bwdToMatchingToken()){var c=a,d=b.cloneCursor();if("for"===d.currentValue()&&d.moveToNextToken()&&"("===d.currentValue()&&d.moveToNextToken()){var f=d.currentValue();
d.moveToNextToken()&&"in"===d.currentValue()&&(c[f]="variable")}e(b.currentToken())&&(c="variable",d=b.cloneCursor(),d.moveToNextToken()&&"function"===d.currentValue()&&(c="function"),d=b.cloneCursor(),d.moveToPreviousToken()&&m(d.currentToken())&&(d=d.currentValue(),a[d]=c))}while(b.moveToPreviousToken());b=[];for(var h in a)b.push({token:h,type:a[h]});b.sort();return b};this.$buildScopeTreeUpToRow=function(a){function c(a,c){if("undefined"===typeof a)return"";var e=a.exec(c);if(!e)return null;var d=
e[1].split(",");if(0==d.length)return null;if(!/=/.test(d[0]))return d[0].replace(/(^\s+)|(\s+$)/g,"");for(var f=0;f<d.length;f++)if(e=/^\s*label\s*=\s*(.*)$/.exec(d[f]))return b.stripEnclosingQuotes(e[1].trim());return null}var e=this.$session.getMode().$id;a=Math.min(a+30,this.$doc.getLength()-1);var d=this.$scopes.parsePos.row;if(d>=a)return d;d=new f(this.$session);d.tokenizeUpToRow(a);this.$tokenizeUpToRow(a);var p=this.$scopes.parsePos.row;d.moveToPosition({row:p,column:this.$scopes.parsePos.column},
!0);var m=d.getCurrentToken();if(null==m)return p;var g=m.value,q=m.type,n=d.getCurrentTokenPosition();p=this.$scopes.getChunkCount();do{if(d.$row>a)break;g=m.value;q=m.type;n=d.getCurrentTokenPosition();m=b.getPrimaryState(this.$session,n.row);if("rd-start"===m)d.moveToEndOfRow();else{var k=!0;this.$codeBeginPattern&&(k=/^r-/.test(m));if(b.startsWith(q,"markup.heading")){q="";k={row:n.row,column:0};var r={row:n.row+1,column:0};m=0;if(/^\s*#+\s*$/.test(g))m=g.split("#").length-1,g=this.$session.getLine(n.row),
q=g.replace(/^\s*[#]+\s*/,"");else if(/^[-=]{3,}\s*$/.test(g)&&(m="="===g[0]?1:2,q=this.$session.getLine(n.row-1).trim(),k.row--,0===q.length))continue;0===q.length&&(q="(Untitled)");q=q.replace(/{.*}\s*$/,"");this.$scopes.onMarkdownHead(q,k,r,m,!0)}else if(k&&/\bsectionhead\b/.test(q)){q="(Untitled)";if(m=/[^#=-\s]/.exec(g))q=g.substr(m.index),q=q.replace(/\s*[#=-]+\s*$/,"");g=/^\s*([#]+)\s*\w/.exec(g);if(null!=g)if(m=g[1].length,6<m)this.$scopes.onSectionStart(q,n);else k={row:n.row,column:0},r=
{row:n.row,column:Infinity},this.$scopes.onMarkdownHead(q,k,r,m,!1);else this.$scopes.onSectionStart(q,n)}else if(k||"mode/sweave"!==e||"keyword"!==q||0!==n.column||0!==g.indexOf("\\")||"\\chapter"!==g&&"\\section"!==g&&"\\subsection"!==g&&"\\subsubsection"!==g)if(/\bcodebegin\b/.test(q)&&"---"===g)g=w(this.$session),this.$scopes.onSectionStart(g,n,{isYaml:!0});else if(/\bcodeend\b/.test(q)&&"---"===g)n.column=Infinity,this.$scopes.onSectionEnd(n);else if("mode/rmarkdown"===e&&/\bcodebegin\b/.test(q)&&
0===g.trim().indexOf("/***"))this.$scopes.onSectionStart("(R Code Chunk)",n);else if("mode/rmarkdown"===e&&/\bcodeend\b/.test(q)&&0===g.trim().indexOf("*/"))this.$scopes.onSectionEnd(n);else/\bcodebegin\b/.test(q)?(p++,q={row:n.row+1,column:0},k=p,m=c(this.$codeBeginPattern,g),k="Chunk "+k,m&&"YAML Header"!==g&&(k+=": "+m),this.$scopes.onChunkStart(m,k,n,q)):/\bcodeend\b/.test(q)?(n.column+=g.length,this.$scopes.onChunkEnd(n)):k&&"{"===g?(g=this.getTokenCursor(),g.moveToPosition(n,!0),q=g.cloneCursor(),
l(q)?(m=q.cloneCursor(),m.moveToNextToken(),n=null,t(q)&&(k=q.cloneCursor(),r=q.cloneCursor(),r.findStartOfEvaluationContext()&&(n=r.currentPosition(),r=k.currentPosition(),n.row!==r.row?(n.row=r.row,n.column=0,q.$row=n.row,q.$offset=0):q.moveToPosition(n,!0),n=this.$doc.getTextRange(new h(n.row,n.column,r.row,r.column+k.currentValue().length)))),k=q.currentPosition(),q.isFirstSignificantTokenOnLine()&&(k.column=0),q=B(m),m="("+q.join(", ")+")",m=null==n?E("<function>"+m):E(n+m),this.$scopes.onFunctionScopeStart(m,
k,g.currentPosition(),n,q)):(k=g.currentPosition(),g.isFirstSignificantTokenOnLine()&&(k.column=0),this.$scopes.onScopeStart(k))):k&&"}"===g&&(n.column+=1,this.$scopes.onScopeEnd(n));else m=1,"\\chapter"===g?m=2:"\\section"===g?m=3:"\\subsection"===g?m=4:"\\subsubsection"===g&&(m=5),g=this.$doc.getLine(n.row),g=/{([^}]*)}/.exec(g),q="",null!=g&&(q=g[1]),k={row:n.row,column:0},r={row:n.row,column:Infinity},this.$scopes.onMarkdownHead(q,k,r,m,!0)}}while(m=d.moveToNextToken());a=Math.max(a,d.$row);this.$scopes.parsePos=
{row:a,column:-1};return a};this.$getFoldToken=function(a,b,c){this.$tokenizeUpToRow(c);if(this.$statePattern&&!this.$statePattern.test(this.$endStates[c]))return"";a=this.$tokens[c];for(c=0;c<a.length;c++)if(/\bsectionhead\b/.test(a[c].type))return a[c];var e=0,d=null,f=null;for(c=0;c<a.length;c++){var h=a[c];if(/\bparen\b/.test(h.type))switch(h.value){case "{":e++;1==e&&(d=h);break;case "}":e--,0==e&&(d=null),0>e&&(f=h,e=0)}}return d?d:"markbeginend"==b&&f?f:1<=a.length&&(/\bcodebegin\b/.test(a[0].type)||
/\bcodeend\b/.test(a[0].type))?a[0]:null};this.getFoldWidget=function(a,b,c){a=this.$getFoldToken(a,b,c);return null==a?"":"{"==a.value?"start":"}"==a.value?"end":/\bcodebegin\b/.test(a.type)?"start":/\bcodeend\b/.test(a.type)?"end":/\bsectionhead\b/.test(a.type)?"start":""};this.getFoldWidgetRange=function(a,c,e){var d=this.$getFoldToken(a,c,e);if(d){c={row:e,column:d.column+1};if("{"==d.value)return(a=a.$findClosingBracket(d.value,c,b.getTokenTypeRegex("paren")))?h.fromPoints(c,a):void 0;if("}"==
d.value)return(a=a.$findOpeningBracket(d.value,c,b.getTokenTypeRegex("paren")))?h.fromPoints({row:a.row,column:a.column+1},{row:c.row,column:c.column-1}):void 0;if(/\bcodebegin\b/.test(d.type)){c=new f(a,e,0);for(var g;g=c.stepForward();)if(/\bcode(begin|end)\b/.test(g.type))return g=/\bcodebegin\b/.test(g.type),c=c.getCurrentTokenRow(),a=g?{row:c-1,column:a.getLine(c-1).length}:{row:c,column:a.getLine(c).length},h.fromPoints({row:e,column:d.column+d.value.length},a)}else if(/\bcodeend\b/.test(d.type))for(c=
new f(a,e,0);d=c.stepBackward();){if(/\bcodebegin\b/.test(d.type))return c=c.getCurrentTokenRow(),h.fromPoints({row:c,column:a.getLine(c).length},{row:e,column:a.getLine(e).length})}else if(/\bsectionhead\b/.test(d.type)){d=a.getLine(e);if(/^\s*[#=-]+\s*$/.test(d))d=d.length;else{d=/[#=-]+\s*$/.exec(d);if(!d)return;d=d.index}c.column=d;e=new f(a,e+1);for(e.$tokenIndex=-1;(token=e.stepForward())&&"}"!==token.value&&!/\bsectionhead\b/.test(token.type)&&!/\bcode(?:begin|end)/.test(token.type);)"{"===
token.value&&e.fwdToMatchingToken();e=e.getCurrentTokenRow();token&&e--;a={row:e,column:a.getLine(e).length};return h.fromPoints(c,a)}}};this.getCurrentScope=function(a,b){b||(b=function(a){return!0});if(!a)return"";this.$buildScopeTreeUpToRow(a.row);var c=this.$scopes.getActiveScopes(a);if(c)for(var e=c.length-1;0<=e;e--)if(b(c[e]))return c[e];return null};this.getScopeTree=function(){this.$buildScopeTreeUpToRow(this.$doc.getLength()-1);return this.$scopes.getScopeList()};this.findFunctionDefinitionFromUsage=
function(a,b){this.$buildScopeTreeUpToRow(this.$doc.getLength()-1);return this.$scopes.findFunctionDefinitionFromUsage(a,b)};this.getIndentForOpenBrace=function(a){if(this.$tokenizeUpToRow(a.row)){var b=this.getTokenCursor();if(b.seekToNearestToken(a,a.row)&&"{"==b.currentValue()&&b.moveBackwardOverMatchingParens())return this.$getIndent(this.$getLine(b.currentPosition().row))}return this.$getIndent(this.$getLine(a.row))};this.getIndentForRow=function(a){return this.getNextLineIndent("start",this.$getLine(a),
this.$session.getTabString(),a)};this.getNextLineIndent=function(a,d,f,h){if(b.endsWith(a,"qstring"))return this.$getIndent(d);"number"!==typeof h&&(h=this.$session.getSelection().getCursor().row-1);var m=this.$session.getTabSize();a=Array(m+1).join(" ");this.$lineOverrides=null;this.$doc.getLine(h)!==d&&(this.$lineOverrides={},this.$lineOverrides[h]=d,this.$invalidateRow(h));try{var p=0>h?"":this.$getIndent(this.$getLine(h));if(!this.$tokenizeUpToRow(h))return p;var q={row:h,column:this.$getLine(h).length},
l=this.$findPreviousSignificantToken(q,h-10);d=this.$session.getLine(h);if(/\bfunction\s*\(\s*$/.test(d))return this.$getIndent(h)+f+f;p="";var t=!1;if(l&&z(l.token.type))p=f,t=!0;else if(l&&/\bparen\b/.test(l.token.type)&&/\)$/.test(l.token.value)){var v=this.$walkParensBalanced(l.row,l.row-10,null,function(a,b,c){return 0===a.length});if(null!=v){var y=this.$findPreviousSignificantToken(v,0);if(y&&"keyword"===y.token.type&&/^(if|while|for|function)$/.test(y.token.value))return this.$getIndent(this.$getLine(y.row))+
f}}else if(l&&"keyword"===l.token.type&&("repeat"===l.token.value||"else"===l.token.value))return this.$getIndent(this.$getLine(l.row))+f;var r=this.getTokenCursor();if(!r.moveToPosition(q))return"";do{var A=r.currentType();if("support.function.codebegin"===A||"support.function.codeend"===A)return this.$getIndent(this.$doc.getLine(r.$row))+p;var w=r.currentValue();if(r.isAtStartOfNewExpression(!1)){if("{"===w||"["===w||"("===w)p+=f;return this.$getIndent(this.$doc.getLine(r.$row))+p}if("("===w&&r.isAtStartOfNewExpression(!0))return this.$getIndent(this.$doc.getLine(r.$row))+
f;if(!r.bwdToMatchingToken()){if("{"===w)break;if(G(["[","("],w)){var x=r.currentPosition();q=null;c&&(q=this.$findNextSignificantToken({row:x.row,column:x.column+1},h));if(q){d=this.$getLine(q.row);var B=d.replace(/[^\s].*$/,""),J=q.column-B.length,O=Math.floor(J/m);x=J-m*O;J="";for(d=0;d<O;d++)J+=f;for(f=0;f<x;f++)J+=" ";f=B+J;var K=f.replace("\t",a).length;for(d=q.row+1;d<=h;d++)if(/[^\s]/.test(this.$getLine(d))){var E=this.$endStates[d-1];if("qstring"!==E&&"qqstring"!==E){var C=this.$getLine(d).replace(/[^\s].*$/,
"");var F=C.replace("\t",a).length;F<K&&(f=C,K=F)}}return k(r)?f:f+p}return this.getIndentForOpenBrace(x)+f+p}}}while(r.moveToPreviousToken());if(!r.moveToPosition(q))return"";do if(!r.bwdToMatchingToken()){if("{"===r.currentValue())return this.getIndentForOpenBrace(r.currentPosition())+f+p;if(e(r.currentToken())){for(;e(r.currentToken())&&r.moveToPreviousToken()&&r.findStartOfEvaluationContext();){var D=r.cloneCursor();if(D.moveToPreviousToken()){if("else"===D.currentValue()||"repeat"===D.currentValue())return this.$getIndent(this.$doc.getLine(D.$row))+
p+p;if(")"===D.currentValue()&&D.bwdToMatchingToken()&&D.moveToPreviousToken()&&n(D.currentValue())){d=this.$doc.getLine(D.$row);if(!t)for(;D.moveToPreviousToken()&&")"===D.currentValue()&&D.bwdToMatchingToken()&&D.moveToPreviousToken()&&n(D.currentValue());)d=this.$doc.getLine(D.$row);return this.$getIndent(d)+p+p}}e(r.peekBwd().currentToken())&&r.moveToPreviousToken()}return this.$getIndent(this.$getLine(r.$row))+p}}while(r.moveToPreviousToken());if(t){K=0;r=this.getTokenCursor();r.moveToPosition(q);
r.moveToPreviousToken();do{if(g(r.currentValue(),["if","else"])){p+=f;break}if(r.hasType("constant","identifier")){if(!r.moveToPreviousToken())break;if(g(r.currentValue(),["if","else"])){p+=f;break}if(")"===r.currentValue()){if(!r.bwdToMatchingToken())break;if(!r.moveToPreviousToken())break;if(g(r.currentValue(),["if","else"])){p+=f;break}}if(!r.hasType("operator"))break}else if(!r.findStartOfEvaluationContext())break}while(r.moveToPreviousToken()&&20>K++)}var I=this.$findNextSignificantToken({row:0,
column:0},h);return I?this.$getIndent(this.$getLine(I.row))+p:""+p}finally{this.$lineOverrides&&(this.$lineOverrides=null,this.$invalidateRow(h))}};this.getBraceIndent=function(a){var b=this.getTokenCursor(),c={row:a,column:this.$getLine(a).length};if(!b.moveToPosition(c))return"";if(")"===b.currentValue()){if(b.bwdToMatchingToken()&&b.moveToPreviousToken()&&(c=b.currentValue(),g(c,["if","while","for","function"])))return this.$getIndent(this.$getLine(b.$row))}else if(g(b.currentValue(),["else","repeat"]))return this.$getIndent(this.$getLine(b.$row));
return this.getIndentForRow(a)};this.getTokenForPos=function(a,b,c){this.$tokenizeUpToRow(a.row);if(this.$tokens.length<=a.row)return null;for(var e=this.$tokens[a.row],d=0;d<e.length;d++){var f=e[d];if(b&&a.column==f.column)return f;if(a.column<=f.column)break;if(c&&a.column==f.column+f.value.length||a.column<f.column+f.value.length)return f}return null};this.$tokenizeUpToRow=function(a){a=Math.min(a,this.$endStates.length-1);for(var b=0,c=!0;b<=a;b++)if(!c||!this.$endStates[b]){c=!1;var e=0===b?
"start":this.$endStates[b-1],d=this.$getLine(b);d=this.$tokenizer.getLineTokens(d,e,b);!this.$statePattern||this.$statePattern.test(d.state)||this.$statePattern.test(e)?this.$tokens[b]=this.$filterWhitespaceAndComments(d.tokens):this.$tokens[b]=[];d.state===this.$endStates[b]?c=!0:this.$endStates[b]=d.state}c||b<this.$tokens.length&&this.$invalidateRow(b);return!0};this.$onDocChange=function(a){"insert"===a.action?this.$insertNewRows(a.start.row,a.end.row-a.start.row):this.$removeRows(a.start.row,
a.end.row-a.start.row);this.$invalidateRow(a.start.row);this.$scopes.invalidateFrom(a.start)};this.$invalidateRow=function(a){this.$tokens[a]=null;this.$endStates[a]=null};this.$insertNewRows=function(a,b){for(var c=[a,0],e=0;e<b;e++)c.push(null);this.$tokens.splice.apply(this.$tokens,c);this.$endStates.splice.apply(this.$endStates,c)};this.$removeRows=function(a,b){this.$tokens.splice(a,b);this.$endStates.splice(a,b)};this.$getIndent=function(a){return(a=/^([ \t]*)/.exec(a))?a[1]:""};this.$getLine=
function(a){return this.$lineOverrides&&"undefined"!=typeof this.$lineOverrides[a]?this.$lineOverrides[a]:this.$doc.getLine(a)};this.$walkParens=function(a,b,c){var e=/\bparen\b/;return a<b?function(){for(;a<=b;a++)for(var d=this.$tokens[a],f=0;f<d.length;f++)if(e.test(d[f].type)&&!c(d[f].value,{row:a,column:d[f].column}))return!1;return!0}.call(this):function(){a=Math.max(0,a);for(b=Math.max(0,b);a>=b;a--)for(var d=this.$tokens[a],f=d.length-1;0<=f;f--)if(e.test(d[f].type)&&!c(d[f].value,{row:a,
column:d[f].column}))return!1;return!0}.call(this)};this.$walkParensBalanced=function(a,b,c,e){var d=[],f=null,h=this;this.$walkParens(a,b,function(a,b){if(c&&c(d,a,b))return f=b,!1;if(/[\[({]/.test(a))if(d[d.length-1]===h.$complements[a])d.pop();else return!0;else d.push(a);return e&&e(d,a,b)?(f=b,!1):!0});return f};this.$findNextSignificantToken=function(a,b){if(0==this.$tokens.length)return null;b=Math.min(b,this.$tokens.length-1);for(var c=a.row,e=a.column;c<=b;c++){for(var d=this.$tokens[c],
f=0;f<d.length;f++)if(d[f].column+d[f].value.length>e)return{token:d[f],row:c,column:Math.max(d[f].column,e),offset:f};e=0}return null};this.findNextSignificantToken=function(a){return this.$findNextSignificantToken(a,this.$tokens.length-1)};this.$findPreviousSignificantToken=function(a,b){if(0===this.$tokens.length)return null;b=Math.max(0,b);for(var c=Math.min(a.row,this.$tokens.length-1);c>=b;c--){var e=this.$tokens[c];if(0!==e.length){if(c!=a.row)return{row:c,column:e[e.length-1].column,token:e[e.length-
1],offset:e.length-1};for(var d=e.length-1;0<=d;d--)if(e[d].column<a.column)return{row:c,column:e[d].column,token:e[d],offset:d}}}};this.$filterWhitespaceAndComments=function(a){a=a.filter(function(a){a=/\bcode(?:begin|end)\b/.test(a.type)?!1:/\bsectionhead\b/.test(a.type)?!1:/^\s*$/.test(a.value)||a.type.match(/\b(?:ace_virtual-)?comment\b/);return!a});for(var b=a.length-1;0<=b;b--)if(1<a[b].value.length&&/\bparen\b/.test(a[b].type)){var c=a[b];a.splice(b,1);for(var e=c.value.length-1;0<=e;e--){var d=
{type:c.type,value:c.value.charAt(e),column:c.column+e};a.splice(b,0,d)}}return a}}).call(a.prototype);k.RCodeModel=a;k.setVerticallyAlignFunctionArgs=function(a){c=a};k.getVerticallyAlignFunctionArgs=function(){return c}});var $colorFunctionCalls=!1;
define("mode/r_highlight_rules",["require","exports","module"],function(a,k,l){function g(a){for(var b=Array(a.length),c=0;c<a.length;c++)b[c]={include:a[c]};return b}l=a("ace/lib/oop");var n=a("ace/lib/lang"),h=a("ace/mode/text_highlight_rules").TextHighlightRules,f=a("mode/rainbow_paren_highlight_rules").RainbowParenHighlightRules,d=a("mode/utils"),b=function(){this.$rules={start:[{token:"comment",regex:"@@",merge:!1},{token:"keyword",regex:"\\\\[a-zA-Z0-9]+",merge:!1},{token:["keyword","comment"],
regex:"(@(?:export|inheritParams|name|param|rdname|slot|template|useDynLib))(\\s+)(?=[a-zA-Z0-9._-])",merge:!1,next:"rd-highlight"},{token:"keyword",regex:"@(?!@)[^ ]*",merge:!1},{token:["paren.keyword.operator","comment"],regex:"(\\[)(=)",merge:!1,next:"markdown-link"},{token:"paren.keyword.operator",regex:"\\[",merge:!1,next:"markdown-link"},{token:["support.function","support.function","support.function"],regex:"(`+)(.*?[^`])(\\1)",merge:!1},{token:["comment","constant.language.boolean"],regex:"(\\s+|^)(__.+?__)\\b",
merge:!1},{token:["comment","constant.language.boolean"],regex:"(\\s+|^)(_(?=[^_])(?:(?:\\\\.)|(?:[^_\\\\]))*?_)\\b",merge:!1},{token:["constant.numeric"],regex:"([*][*].+?[*][*])",merge:!1},{token:["constant.numeric"],regex:"([*](?=[^*])(?:(?:\\\\.)|(?:[^*\\\\]))*?[*])",merge:!1},{token:"paren.keyword.operator",regex:"(?:[[({]|[\\])}])",merge:!1},{defaultToken:"comment"}],highlight:[{token:"identifier.support.function",regex:"[^ ,]+"},{token:"comment",regex:","},{token:"comment",regex:"\\s*",next:"start"}],
"markdown-link":[{token:"paren.keyword.operator",regex:"\\]",next:"start"},{token:["identifier.support.class","comment"],regex:"([a-zA-Z0-9_.]+)(:{1,3})"},{token:"support.function",regex:"`.*?`"},{token:"support.function",regex:"[^{}()[\\]]+"},{token:"paren.keyword.operator",regex:"(?:[[({]|[\\])}])"},{defaultToken:"comment"}]};this.normalizeRules()};l.inherits(b,h);a=function(){var a=n.arrayToMap("\\ function if else in break next repeat for while".split(" ")),e=n.arrayToMap("return switch try tryCatch stop warning require library attach detach source setMethod setGeneric setGroupGeneric setClass setRefClass R6Class UseMethod NextMethod".split(" ")),
h=n.arrayToMap("NULL NA TRUE FALSE T F Inf NaN NA_integer_ NA_real_ NA_character_ NA_complex_".split(" ")),q={"{":"}","[":"]","(":")"},p={"#comment":[{token:"comment.sectionhead",regex:"#+(?!').*(?:----|====|####)\\s*$",next:"start"},{token:"comment.doc.tag",regex:"#[|].*$",next:"start"},{token:["comment","comment.keyword.operator"],regex:"(#+['*]\\s*)(TODO|FIXME)\\b",next:"rd-start"},{token:"comment",regex:"#+['*]",next:"rd-start"},{token:["comment","comment.keyword.operator","comment"],regex:"(#+\\s*)(TODO|FIXME)\\b(.*)$",
next:"start"},{token:"comment",regex:"#.*$",next:"start"}],"#string":[{token:"string",regex:"[rR]['\"][-]*[[({]",next:"rawstring",onMatch:function(a,b,c,e){c=c||[];c[0]=b;c[2]=q[a[a.length-1]]+a.substring(2,a.length-1)+a[1];return this.token}},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]',next:"start"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']",next:"start"},{token:"string",merge:!0,regex:'["]',next:"qqstring"},{token:"string",merge:!0,regex:"[']",next:"qstring"}],"#number":[{token:"constant.numeric",
regex:"0[xX][0-9a-fA-F]+[Li]?",merge:!1,next:"start"},{token:"constant.numeric",regex:"(?:(?:\\d+(?:\\.\\d*)?)|(?:\\.\\d+))(?:[eE][+\\-]?\\d*)?[iL]?",merge:!1,next:"start"}],"#quoted-identifier":[{token:"identifier",regex:"[`](?:(?:\\\\.)|(?:[^`\\\\]))*?[`]",merge:!1,next:"start"}],"#identifier":[{token:function(a){return h.hasOwnProperty(a)?"constant.language":a.match(/^\.\.\d+$/)?"variable.language":"identifier"},regex:"(?:\\\\|[a-zA-Z.][a-zA-Z0-9._]*)",next:"start"}],"#keyword-or-identifier":[{token:function(b){return h.hasOwnProperty(b)?
"constant.language":a.hasOwnProperty(b)?"keyword":b.match(/^\.\.\d+$/)?"variable.language":"identifier"},regex:"(?:\\\\|[a-zA-Z.][a-zA-Z0-9._]*)",next:"start"}],"#package-access":[{token:function(a){return $colorFunctionCalls?"identifier.support.class":"identifier"},regex:"(?:\\\\|[a-zA-Z.][a-zA-Z0-9._]*)(?=\\s*::)",next:"start"}],"#function-call":[{token:function(a){return $colorFunctionCalls?"identifier.support.function":"identifier"},regex:"(?:\\\\|[a-zA-Z.][a-zA-Z0-9._]*)(?=\\s*\\()",next:"start"}],
"#function-call-or-keyword":[{token:function(b){return e.hasOwnProperty(b)||a.hasOwnProperty(b)?"keyword":$colorFunctionCalls?"identifier.support.function":"identifier"},regex:"(?:\\\\|[a-zA-Z.][a-zA-Z0-9._]*)(?=\\s*\\()",next:"start"}]};p["#operator"]=[{token:"keyword.operator",regex:"\\$|@",merge:!1,next:"afterDollar"},{token:"keyword.operator",regex:":::|::|:=|\\|>|=>|%%|>=|<=|==|!=|<<\\-|\\->>|\\->|<\\-|\\|\\||&&|=|\\+|\\-|\\*\\*?|/|\\^|>|<|!|&|\\||~|\\$|:|@|\\?",merge:!1,next:"start"},{token:"keyword.operator.infix",
regex:"%.*?%",merge:!1,next:"start"},f.getParenRule(),{token:function(a){return $colorFunctionCalls?"punctuation.keyword.operator":"punctuation"},regex:"[;]",merge:!1,next:"start"},{token:function(a){return $colorFunctionCalls?"punctuation.keyword.operator":"punctuation"},regex:"[,]",merge:!1,next:"start"}];p["#knitr-embed"]=[{token:"constant.language",regex:"^[<][<][^>]+[>][>]$",merge:!1}];p["#text"]=[{token:"text",regex:"\\s+"}];p.start=g("#comment #string #number #package-access #quoted-identifier #function-call-or-keyword #keyword-or-identifier #knitr-embed #operator #text".split(" "));
p.afterDollar=g("#comment #string #number #quoted-identifier #function-call #keyword-or-identifier #operator #text".split(" "));p.rawstring=[{token:"string",regex:"[\\]})][-]*['\"]",onMatch:function(a,b,c,e){this.next=a===c[2]?c[0]:"rawstring";return this.token}},{defaultToken:"string"}];p.qqstring=[{token:"string",regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"',next:"start"},{token:"string",regex:".+",merge:!0}];p.qstring=[{token:"string",regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'",next:"start"},{token:"string",
regex:".+",merge:!0}];this.$rules=p;var m=(new b).getRules(),k;for(k in m){p=m[k];for(var l=0;l<p.length;l++)if(d.isArray(p[l].token))for(var y=0;y<p[l].token.length;y++)p[l].token[y]+=".virtual-comment";else p[l].token+=".virtual-comment"}this.embedRules(m,"rd-",[{token:"text",regex:"^",next:"start"}]);this.normalizeRules()};l.inherits(a,h);k.RHighlightRules=a;k.setHighlightRFunctionCalls=function(a){$colorFunctionCalls=a}});define("mode/r_matching_brace_outdent",["require","exports","module"],function(a,k,l){var g=a("ace/range").Range;a=function(a){this.codeModel=a};(function(){this.checkOutdent=function(a,h,f){return/^\s+$/.test(h)&&/^\s*[\{\}\)\]]/.test(f)||/^\s*}\s*$/.test(h)&&"\n"==f||/}\s*$/.test(h)&&/\n/.test(f)?!0:!1};this.autoOutdent=function(a,h,f){if(0!==f){a=h.getLine(f);var d=a.match(/^(\s*[\}\)\]])/);if(d){d=d[1].length;var b=h.findMatchingBracket({row:f,column:d});if(!b||b.row==f)return 0;b=this.codeModel.getIndentForOpenBrace(b);
h.replace(new g(f,0,f,d-1),b)}if(d=a.match(/^(\s*\{)/))d=d[1].length,b=this.codeModel.getBraceIndent(f-1),h.replace(new g(f,0,f,d-1),b)}}}).call(a.prototype);k.RMatchingBraceOutdent=a});define("mode/r_scope_tree",["require","exports","module"],function(a,k,l){function g(a,f){return a.row!=f.row?a.row-f.row:a.column-f.column}var n=function(a,f,d,b,c){this.label=a;if((this.start=f)&&d&&(d.row>f.row||d.row===f.row&&d.column>f.column))throw Error("Malformed preamble: should lie before start position");this.preamble=d||f;this.end=null;this.scopeType=b;this.parentScope=null;this.attributes=c||{};this.$children=[]};n.TYPE_ROOT=1;n.TYPE_BRACE=2;n.TYPE_CHUNK=3;n.TYPE_SECTION=4;(function(){this.isRoot=
function(){return this.scopeType==n.TYPE_ROOT};this.isBrace=function(){return this.scopeType==n.TYPE_BRACE};this.isChunk=function(){return this.scopeType==n.TYPE_CHUNK};this.isSection=function(){return this.scopeType==n.TYPE_SECTION};this.isFunction=function(){return this.isBrace()&&!!this.attributes.args};this.equals=function(a){return this.scopeType!==a.scopeType||this.start.row!==a.start.row||this.start.column!==a.start.column?!1:!0};this.addNode=function(a){a.end&&window.alert("[ASSERTION FAILED] New node is already closed");
0!=a.$children.length&&window.alert("[ASSERTION FAILED] New node already had children");if(!this.equals(a)){this.end=null;var f=this.$binarySearch(a.preamble);0<=f?this.$children[f].addNode(a):(f=-(f+1),f<this.$children.length&&(a.$children=this.$children.splice(f,this.$children.length-f)),a.parentScope=this,this.$children.push(a))}};this.closeScope=function(a,f){if(0==this.$children.length)return null;var d=this.$children[this.$children.length-1];if(d.end)return null;var b=d.closeScope(a,f);return b?
b:f==d.scopeType?(d.end=a,d.$forceDescendantsClosed(a),d):null};this.$forceDescendantsClosed=function(a){if(0!=this.$children.length){var f=this.$children[this.$children.length-1];f.end||(f.$forceDescendantsClosed(a),f.end=a)}};this.findNode=function(a){var f=this.$binarySearch(a);return 0<=f&&(a=this.$children[f].findNode(a))?(this.label&&a.unshift(this),a):this.label?[this]:null};this.$getFunctionStack=function(a){var f=this.$binarySearch(a);a=0<=f?this.$children[f].$getFunctionStack(a):[];this.isFunction()&&
a.push(this);return a};this.findFunctionDefinitionFromUsage=function(a,f){for(var d=this.$getFunctionStack(a),b=0;b<d.length;b++)for(var c=d[b],e=0;e<c.$children.length;e++)if(c.$children[e].label==f)return c.$children[e];return null};this.getFunctionsInScope=function(a){a=this.$getFunctionStack(a);for(var f=[],d=0;d<a.length;d++)f.push({name:a[d].attributes.name,args:a[d].attributes.args.slice()});return f};this.invalidateFrom=function(a){var f=this.$binarySearch(a);0<=f?0>=g(a,this.$children[f].start)?
a=this.$children[f].preamble:(a=this.$children[f].invalidateFrom(a),f++):f=-(f+1);f<this.$children.length&&this.$children.splice(f,this.$children.length-f);this.end=null;return a};this.$binarySearch=function(a,f,d){"undefined"===typeof f&&(f=0);"undefined"===typeof d&&(d=this.$children.length);if(f===d)return-(f+1);var b=Math.floor((f+d)/2),c=this.$children[b].comparePosition(a);return 0===c?b:0>c?this.$binarySearch(a,f,b):this.$binarySearch(a,b+1,d)};this.comparePosition=function(a){return 0>g(a,
this.preamble)?-1:null!=this.end&&0<=g(a,this.end)?1:0};this.printDebug=function(a){"undefined"===typeof a&&(a="");for(var f=0;f<this.$children.length;f++)this.$children[f].printDebug(a+"    ")}}).call(n.prototype);a=function(a){this.$ScopeNodeFactory=a||n;this.parsePos={row:0,column:0};this.$root=new this.$ScopeNodeFactory("(Top Level)",this.parsePos,null,n.TYPE_ROOT)};(function(){function a(d){count=d.isChunk()?1:0;d=d.$children||[];for(var b=0;b<d.length;b++)count+=a(d[b]);return count}this.getParsePosition=
function(){return this.parsePos};this.setParsePosition=function(a){this.parsePos=a};this.onSectionStart=function(a,b,c){"undefined"==typeof c&&(c={});var e=this.getActiveScopes(b);if(1<e.length){e=e[e.length-2].$children;for(var d=e.length-1;0<=d;d--)if(e[d].isSection()){this.$root.closeScope(b,n.TYPE_SECTION);break}}a=new this.$ScopeNodeFactory(a,b,b,n.TYPE_SECTION,c);this.$root.addNode(a)};this.onSectionEnd=function(a){this.$root.closeScope(a,n.TYPE_SECTION)};this.closeMarkdownHeaderScopes=function(a,
b,c){for(var e=a.$children,d=e.length-1;0<=d;d--){var f=e[d];if(f.isFunction()||f.isChunk())return;if(f.isSection()&&f.attributes.depth>=c)return this.$root.closeScope(b,n.TYPE_SECTION),f.attributes.depth===c||a.isRoot()||null==a?void 0:this.closeMarkdownHeaderScopes(a.parentScope,b,c)}a.isRoot()||null==a||this.closeMarkdownHeaderScopes(a.parentScope,b,c)};this.onMarkdownHead=function(a,b,c,e,f){var d=this.getActiveScopes(b);1<d.length&&this.closeMarkdownHeaderScopes(d[d.length-2],b,e);this.$root.addNode(new this.$ScopeNodeFactory(a,
c,b,n.TYPE_SECTION,{depth:e,isMarkdown:f}))};this.onChunkStart=function(a,b,c,e){this.$root.closeScope(c,n.TYPE_CHUNK);b=new this.$ScopeNodeFactory(b,e,c,n.TYPE_CHUNK);b.chunkLabel=a;this.$root.addNode(b);this.printScopeTree()};this.onChunkEnd=function(a){a=this.$root.closeScope(a,n.TYPE_CHUNK);this.printScopeTree();return a};this.onFunctionScopeStart=function(a,b,c,e,f){this.$root.addNode(new this.$ScopeNodeFactory(a,c,b,n.TYPE_BRACE,{name:e,args:f}));this.printScopeTree()};this.onNamedScopeStart=
function(a,b){this.$root.addNode(new this.$ScopeNodeFactory(a,b,null,n.TYPE_BRACE))};this.onScopeStart=function(a){this.$root.addNode(new this.$ScopeNodeFactory(null,a,null,n.TYPE_BRACE));this.printScopeTree()};this.onScopeEnd=function(a){a=this.$root.closeScope(a,n.TYPE_BRACE);this.printScopeTree();return a};this.getActiveScopes=function(a){return this.$root.findNode(a)};this.getScopeList=function(){return this.$root.$children};this.findFunctionDefinitionFromUsage=function(a,b){return this.$root.findFunctionDefinitionFromUsage(a,
b)};this.getFunctionsInScope=function(a,b){return this.$root.getFunctionsInScope(a,b)};this.invalidateFrom=function(a){a={row:Math.max(0,a.row-1),column:0};0<g(this.parsePos,a)&&(this.parsePos=this.$root.invalidateFrom(a));this.printScopeTree()};this.getChunkCount=function(d){return a(this.$root)};this.getTopLevelScopeCount=function(){return this.$root.$children.length};this.printScopeTree=function(){};this.getAllFunctionScopes=function(){var a=[];f(this.$root,a);return a};var f=function(a,b){a.isFunction()&&
b.push(a);for(var c=a.$children,e=0;e<c.length;e++)f(c[e],b)}}).call(a.prototype);k.ScopeManager=a;k.ScopeNode=n});var $rainbowParentheses=!1,$numParenColors=7;
define("mode/rainbow_paren_highlight_rules",["require","exports","module"],function(a,k,l){a=function(){};k.RainbowParenHighlightRules=a;k.setRainbowParentheses=function(a){$rainbowParentheses=a};k.getRainbowParentheses=function(){return $rainbowParentheses};k.setNumParenColors=function(a){$numParenColors=a};a.getParenRule=function(){return{token:"paren.keyword.operator.nomatch",regex:"[[({})\\]]",merge:!1,onMatch:function(a,n,h){if(!$rainbowParentheses)return this.token="paren.keyword.operator.nomatch";
h=h||[];h[0]=n;h[1]=h[1]||0;switch(a){case "[":case "{":case "(":this.token="paren.paren_color_"+h[1]%$numParenColors;h[1]+=1;break;case "]":case "}":case ")":h[1]=Math.max(0,h[1]-1),this.token="paren.paren_color_"+h[1]%$numParenColors}return this.token},next:"start"}}});define("mode/rdoc",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");var g=a("ace/mode/text").Mode,n=a("ace/tokenizer").Tokenizer,h=a("ace/mode/text_highlight_rules").TextHighlightRules,f=a("mode/rdoc_highlight_rules").RDocHighlightRules,d=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent;a=function(a){a?(this.$highlightRules=new h,this.$tokenizer=new n((new h).getRules())):(this.$highlightRules=new f,this.$tokenizer=new n((new f).getRules()));this.$outdent=new d};l.inherits(a,
g);(function(){this.getNextLineIndent=function(a,c,e){return this.$getIndent(c)}}).call(a.prototype);k.Mode=a});define("mode/rdoc_highlight_rules",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");a("ace/lib/lang");a=a("ace/mode/text_highlight_rules").TextHighlightRules;var g=function(){var a="\\"+"name|alias|method|S3method|S4method|item|code|preformatted|kbd|pkg|var|env|option|command|author|email|url|source|cite|acronym|href|code|preformatted|link|eqn|deqn|keyword|usage|examples|dontrun|dontshow|figure|if|ifelse|Sexpr|RdOpts|inputencoding|usepackage".replace(/\|/g,"|\\");this.createKeywordMapper({keyword:a},
"identifer");this.$rules={start:[{token:"comment",regex:"%.*$"},{token:"text",regex:"\\\\[$&%#\\{\\}]"},{token:"keyword",regex:"\\\\(?:name|alias|method|S3method|S4method|item|code|preformatted|kbd|pkg|var|env|option|command|author|email|url|source|cite|acronym|href|code|preformatted|link|eqn|deqn|keyword|usage|examples|dontrun|dontshow|figure|if|ifelse|Sexpr|RdOpts|inputencoding|usepackage)\\b",next:"nospell"},{token:"keyword",regex:"\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])"},{token:"paren.keyword.operator",
regex:"[[({]"},{token:"paren.keyword.operator",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],nospell:[{token:"comment",regex:"%.*$",next:"start"},{token:"nospell.text",regex:"\\\\[$&%#\\{\\}]"},{token:"keyword",regex:"\\\\(?:name|alias|method|S3method|S4method|item|code|preformatted|kbd|pkg|var|env|option|command|author|email|url|source|cite|acronym|href|code|preformatted|link|eqn|deqn|keyword|usage|examples|dontrun|dontshow|figure|if|ifelse|Sexpr|RdOpts|inputencoding|usepackage)\\b"},{token:"keyword",
regex:"\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])",next:"start"},{token:"paren.keyword.operator",regex:"[[({]"},{token:"paren.keyword.operator",regex:"[\\])]"},{token:"paren.keyword.operator",regex:"}",next:"start"},{token:"nospell.text",regex:"\\s+"},{token:"nospell.text",regex:"\\w+"}]}};l.inherits(g,a);k.RDocHighlightRules=g});define("mode/rhtml",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");var g=a("ace/mode/html").Mode,n=a("ace/tokenizer").Tokenizer,h=a("mode/rhtml_highlight_rules").RHtmlHighlightRules,f=a("mode/r_code_model").RCodeModel,d=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,b=a("mode/r_matching_brace_outdent").RMatchingBraceOutdent,c=a("mode/utils");a=function(a,c){this.$session=c;this.$tokenizer=new n((new h).getRules());this.codeModel=new f(c,this.$tokenizer,/^r-/,/^\x3c!--\s*begin.rcode\s*(.*)/,
/^\s*end.rcode\s*--\x3e/);this.$outdent=new d;this.$r_outdent=new b(this.codeModel);this.foldingRules=this.codeModel};l.inherits(a,g);(function(){this.insertChunkInfo={value:"\x3c!--begin.rcode\n\nend.rcode--\x3e\n",position:{row:0,column:15},content_position:{row:1,column:0}};this.checkOutdent=function(a,b,d){return"r"===c.activeMode(a,"html")?this.$r_outdent.checkOutdent(a,b,d):this.$outdent.checkOutdent(b,d)};this.autoOutdent=function(a,b,d){return"r"===c.activeMode(a,"html")?this.$r_outdent.autoOutdent(a,
b,d):this.$outdent.autoOutdent(b,d)};this.getLanguageMode=function(a){return c.getPrimaryState(this.$session,a.row).match(/^r-/)?"R":"HTML"};this.$getNextLineIndent=this.getNextLineIndent;this.getNextLineIndent=function(a,b,d,f){return"r"===c.activeMode(a,"html")?this.codeModel.getNextLineIndent(a,b,d,f):this.$getNextLineIndent(a,b,d)};this.$id="mode/rhtml"}).call(a.prototype);k.Mode=a});define("mode/rhtml_highlight_rules",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");var g=a("mode/r_highlight_rules").RHighlightRules,n=a("ace/mode/html_highlight_rules").HtmlHighlightRules;a=a("ace/mode/text_highlight_rules").TextHighlightRules;var h=function(){this.$rules=(new n).getRules();this.$rules.start.unshift({token:"support.function.codebegin",regex:"^\x3c!--\\s*begin.rcode\\s*(?:.*)",next:"r-start"});var a=(new g).getRules();this.addRules(a,"r-");this.$rules["r-start"].unshift({token:"support.function.codeend",
regex:"^\\s*end.rcode\\s*--\x3e",next:"start"})};l.inherits(h,a);k.RHtmlHighlightRules=h});define("mode/rmarkdown",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");var g=a("mode/markdown").Mode,n=a("ace/tokenizer").Tokenizer,h=a("mode/rmarkdown_highlight_rules").RMarkdownHighlightRules,f=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,d=a("mode/r_matching_brace_outdent").RMatchingBraceOutdent,b=a("mode/c_cpp_matching_brace_outdent").CppMatchingBraceOutdent,c=a("mode/r_code_model").RCodeModel,e=a("mode/cpp_code_model").CppCodeModel,t=a("mode/python").Mode,q=a("rstudio/folding/rmarkdown").FoldMode,
p=a("ace/mode/folding/cstyle").FoldMode;a("mode/auto_brace_insert");var m=a("mode/utils"),v=a("ace/unicode");a=function(a,g){var k=this;this.$session=g;this.$tokenizer=new n((new h).getRules());this.$outdent=new f;this.codeModel=new c(g,this.$tokenizer,/^r-/,new RegExp(h.prototype.$reChunkStartString),new RegExp(h.prototype.$reChunkEndString));this.$r_outdent=new d(this.codeModel);this.cpp_codeModel=new e(g,this.$tokenizer,/^r-cpp-/,new RegExp(h.prototype.$reCppChunkStartString),new RegExp(h.prototype.$reChunkEndString));
this.$cpp_outdent=new b(this.cpp_codeModel);this.$python=new t;var l=new q,v=new p;this.$tokenizer.getLineTokens=function(a,b,c){0===c&&(b="firstLine");return n.prototype.getLineTokens.call(this,a,b,c)};this.foldingRules={getFoldWidget:function(a,b,c){var e=k.getLanguageMode({row:c,column:0}),d=a.getLine(c);return"Markdown"===e||m.startsWith(d,"```")||0===c?l.getFoldWidget(a,b,c):"C_CPP"===e?v.getFoldWidget(a,b,c):k.codeModel.getFoldWidget(a,b,c)},getFoldWidgetRange:function(a,b,c){var e=k.getLanguageMode({row:c,
column:0}),d=a.getLine(c);return"Markdown"===e||m.startsWith(d,"```")||0===c?l.getFoldWidgetRange(a,b,c):"C_CPP"===e?v.getFoldWidgetRange(a,b,c):k.codeModel.getFoldWidgetRange(a,b,c)}}};l.inherits(a,g);(function(){function a(a){return m.activeMode(a,"markdown")}this.insertChunkInfo={value:"```{r}\n\n```\n",position:{row:0,column:5},content_position:{row:1,column:0}};this.getLanguageMode=function(b){b=m.getPrimaryState(this.$session,b.row);b=a(b);return"r"===b?"R":"r-cpp"===b?"C_CPP":"yaml"===b?"YAML":
"python"===b?"Python":"sql"==b?"SQL":"stan"===b?"Stan":"Markdown"};this.$getNextLineIndent=this.getNextLineIndent;this.getNextLineIndent=function(b,c,e,d,f){var p=a(b);return"r"===p?this.codeModel.getNextLineIndent(b,c,e,d):"r-cpp"===p?this.cpp_codeModel.getNextLineIndent(b,c,e,d,f):"yaml"===p?this.$getIndent(this.$session.getLine(d+1)):"python"===p?this.$python.getNextLineIndent(b,c,e,d):this.$getNextLineIndent(b,c,e)};this.checkOutdent=function(b,c,e){var d=a(b);return"r"===d?this.$r_outdent.checkOutdent(b,
c,e):"r-cpp"===d?this.$cpp_outdent.checkOutdent(b,c,e):"yaml"===d?!1:this.$outdent.checkOutdent(c,e)};this.autoOutdent=function(b,c,e){var d=a(b);if("r"===d)return this.$r_outdent.autoOutdent(b,c,e);if("r-cpp"===d)return this.$cpp_outdent.autoOutdent(b,c,e);if("yaml"!==d)return"python"===d?this.$python.autoOutdent(b,c,e):this.$outdent.autoOutdent(c,e)};this.getIndentForOpenBrace=function(b){var c=m.getPrimaryState(this.$session,b.row);if("r"===a(c))return this.codeModel.getIndentForOpenBrace(b);b=
this.$session.getLine(b.row1);return this.$getIndent(b)};this.transformAction=function(b,c,e,d,f){var p=a(b);return"markdown"===p?this.transformActionMarkdown(b,c,e,d,f):"r-cpp"===p?this.transformActionCpp(b,c,e,d,f):"yaml"===p?this.transformActionYaml(b,c,e,d,f):"python"===p?this.$python.transformAction(b,c,e,d,f):!1};this.transformActionMarkdown=function(a,b,c,e,d){if("insertion"===b)if("r"===d){if(a=c.getCursorPosition(),b=e.getLine(a.row),e=e.getTokenAt(a.row,a.column-1),null!==e&&-1===e.type.indexOf("support.function")&&
"`"===b[a.column-1])return{text:"r`",selection:[0,a.column+1,0,a.column+1]}}else if("`"===d&&(a=c.getCursorPosition(),b=e.getLine(a.row),e=e.getTokenAt(a.row,a.column+1),null!==e&&-1!==e.type.indexOf("support.function")&&"`"===b[a.column]))return{text:"",selection:[0,a.column+1,0,a.column+1]}};this.transformActionCpp=function(a,b,c,e,d){if("insertion"===b)if("\n"===d){if(a=c.getSelectionRange().start,(e=/^((\s*\/\/+')\s*)/.exec(e.doc.getLine(a.row)))&&c.getSelectionRange().start.column>=e[2].length)return{text:"\n"+
e[1]}}else if("R"===d&&(a=c.getSelectionRange().start,(e=/^(\s*\/\*{3,}\s*)/.exec(e.doc.getLine(a.row)))&&c.getSelectionRange().start.column>=e[1].length))return{text:"R\n\n*/\n",selection:[1,0,1,0]};return!1};this.transformActionYaml=function(a,b,c,e,d){return"insertion"===b&&"\n"===d?(a=c.getCursorPosition().row,a=e.getLine(a),e=this.$getIndent(a),/[:({[]$/.test(a)?(a=this.$session.getTabString(),{text:"\n"+e+a}):{text:"\n"+e}):!1};this.tokenRe=new RegExp("^["+v.wordChars+"._]+","g");this.nonTokenRe=
new RegExp("^(?:[^"+v.wordChars+"._]|\\s)+","g");this.allowAutoInsert=this.smartAllowAutoInsert;this.$id="mode/rmarkdown"}).call(a.prototype);k.Mode=a});define("rstudio/folding/rmarkdown",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");var g=a("ace/mode/folding/fold_mode").FoldMode,n=a("ace/range").Range;k=k.FoldMode=function(){};var h=a("mode/utils");l.inherits(k,g);(function(){this.getFoldWidget=function(a,b,c){b="markbeginend"===b?"end":"";var e=a.getLine(c),d=a.getState(c);a=0<c?a.getState(c-1):"start";if(h.startsWith(e,"===")||h.startsWith(e,"---")||h.startsWith(e,"..."))return h.startsWith(a,"yaml")?b:"start";if("start"===
d&&h.startsWith(e,"#"))return"start";a=e.trim();return h.startsWith(a,"```")?"start"===d?b:"start":""};var a=function(a,b,c,e,f){b=0===c?1:"start"===b?-1:1;var d={row:c,column:0};1===b&&(d.column=a.getLine(c).length);c+=b;for(var p=0<b?a.getLength():0;c!==p;){var g=a.getLine(c).trim();if(h.startsWith(g,e))break;if(f&&h.startsWith(g,f))break;c+=b}e={row:c,column:0};-1===b&&(e.column=a.getLine(c).length);return 1===b?n.fromPoints(d,e):n.fromPoints(e,d)};this.$getFoldWidgetRange=function(d,b,c){var e=
d.getState(c);b=d.getLine(c);var f=b.trim();if(h.startsWith(b,"```"))return a(d,e,c,"```");var g=0<c?d.getState(c-1):"start";f=0===c&&"---"===f;g=h.startsWith(g,"yaml");if(f||g)return a(d,e,c,"---",f?"...":void 0);if("="===b[0])g=1;else if("-"===b[0])g=2;else{g=/^(#+)(?:.*)$/.exec(b);if(!g)return;g=g[1].length}if(null!==g){a:{f=d.getLength();for(var p=c+1;p<f;p++)if(d.getState(p)===e){var m=d.getLine(p);if(1===g&&/^[=]{3,}\s*/.test(m)){e=p-2;break a}if(2===g&&/^[-]{3,}\s*/.test(m)){e=p-2;break a}if((m=
/^(#+)(?:.*)$/.exec(m))&&m[1].length<=g){e=p-1;break a}}e=f}return new n(c,b.length,e,d.getLine(e).length)}};this.getFoldWidgetRange=function(a,b,c){a=this.$getFoldWidgetRange(a,b,c);if(null!=a&&a.start.row!==a.end.row)return a}}).call(k.prototype)});define("mode/rmarkdown_highlight_rules",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");var g=a("mode/r_highlight_rules").RHighlightRules,n=a("mode/c_cpp_highlight_rules").c_cppHighlightRules,h=a("ace/mode/perl_highlight_rules").PerlHighlightRules,f=a("mode/python_highlight_rules").PythonHighlightRules,d=a("ace/mode/ruby_highlight_rules").RubyHighlightRules,b=a("mode/markdown_highlight_rules").MarkdownHighlightRules,c=a("ace/mode/text_highlight_rules").TextHighlightRules,e=a("mode/yaml_highlight_rules").YamlHighlightRules,
t=a("mode/sh_highlight_rules").ShHighlightRules,q=a("mode/stan_highlight_rules").StanHighlightRules,p=a("mode/sql_highlight_rules").SqlHighlightRules,m=a("ace/mode/javascript_highlight_rules").JavaScriptHighlightRules,v=a("ace/mode/css_highlight_rules").CssHighlightRules;c=a("ace/mode/text_highlight_rules").TextHighlightRules;var x=a("mode/utils");a=function(){this.$rules=(new b).getRules();this.$rules.firstLine=this.$rules.allowBlock.slice();x.embedRules(this,g,"r",this.$reChunkStartString,this.$reChunkEndString,
["start","listblock","allowBlock"]);x.embedRules(this,n,"r-cpp",this.$reCppChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);x.embedRules(this,h,"perl",this.$rePerlChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);x.embedRules(this,f,"python",this.$rePythonChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);x.embedRules(this,d,"ruby",this.$reRubyChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);x.embedRules(this,
b,"markdown",this.$reMarkdownChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);x.embedRules(this,t,"sh",this.$reShChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);x.embedRules(this,q,"stan",this.$reStanChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);x.embedRules(this,p,"sql",this.$reSqlChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);x.embedRules(this,m,"js",this.$reJavaScriptChunkStartString,
this.$reChunkEndString,["start","listblock","allowBlock"]);x.embedRules(this,v,"css",this.$reCssChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);x.embedRules(this,c,"text",this.$reTextChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);x.embedRules(this,e,"yaml","^\\s*---\\s*$","^\\s*(?:---|\\.\\.\\.)\\s*$",["firstLine"]);this.$rules["yaml-start"].unshift({token:["string"],regex:/((?:January|February|March|April|May|June|July|August|September|October|November|December)\s+\d+(?:st|nd|rd|s|n|r)?(?:\s*(?:,)?(?:\s*\d+)?)?)/});
this.$rules["yaml-start"].push({defaultToken:"text.nospell"});this.normalizeRules()};l.inherits(a,c);(function(){function a(a){return"^(?:[ ]{4})?`{3,}\\s*\\{[Rr]\\b(?:.*)engine\\s*\\=\\s*['\"]"+a+"['\"](?:.*)\\}\\s*$|^(?:[ ]{4})?`{3,}\\s*\\{"+a+"\\b(?:.*)\\}\\s*$"}this.$reChunkStartString="^(?:[ ]{4})?`{3,}\\s*\\{\\w+\\b(.*)\\}\\s*$";this.$reChunkEndString="^(?:[ ]{4})?`{3,}\\s*$";this.$reCppChunkStartString=a("(?:[rR][cC]pp|[cC](?:pp)?)\\d*");this.$reMarkdownChunkStartString=a("block");this.$rePerlChunkStartString=
a("perl");this.$rePythonChunkStartString=a("python");this.$reRubyChunkStartString=a("ruby");this.$reShChunkStartString=a("(?:bash|sh)");this.$reStanChunkStartString=a("stan");this.$reSqlChunkStartString=a("sql");this.$reJavaScriptChunkStartString=a("(?:d3|js|ojs|observable)");this.$reCssChunkStartString=a("css");this.$reTextChunkStartString=a("(?:asis|text)")}).call(a.prototype);k.RMarkdownHighlightRules=a});define("mode/sh",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");var g=a("ace/mode/text").Mode,n=a("mode/sh_highlight_rules").ShHighlightRules,h=a("ace/range").Range,f=a("ace/mode/folding/cstyle").FoldMode,d=a("ace/mode/behaviour/cstyle").CstyleBehaviour;a=function(){this.HighlightRules=n;this.foldingRules=new f;this.$behaviour=new d};l.inherits(a,g);(function(){this.lineCommentStart="#";this.getNextLineIndent=function(a,b,d){var c=this.$getIndent(b),e=this.getTokenizer().getLineTokens(b,
a).tokens;if(e.length&&"comment"==e[e.length-1].type)return c;"start"==a&&b.match(/^.*[\{\(\[:]\s*$/)&&(c+=d);return c};var a={pass:1,"return":1,raise:1,"break":1,"continue":1};this.checkOutdent=function(b,e,d){if("\r\n"!==d&&"\r"!==d&&"\n"!==d)return!1;b=this.getTokenizer().getLineTokens(e.trim(),b).tokens;if(!b)return!1;do e=b.pop();while(e&&("comment"==e.type||"text"==e.type&&e.value.match(/^\s+$/)));return e?"keyword"==e.type&&a[e.value]:!1};this.autoOutdent=function(a,b,d){d+=1;a=this.$getIndent(b.getLine(d));
var c=b.getTabString();a.slice(-c.length)==c&&b.remove(new h(d,a.length-c.length,d,a.length))};this.$id="mode/sh"}).call(a.prototype);k.Mode=a});define("mode/sh_highlight_rules",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");a=a("ace/mode/text_highlight_rules").TextHighlightRules;var g=k.reservedKeywords="!|{|}|case|do|done|elif|else|esac|fi|for|if|in|then|until|while|&|;|export|local|read|typeset|unset|elif|select|set|function|declare|readonly",n=k.languageConstructs="[|]|alias|bg|bind|break|builtin|cd|command|compgen|complete|continue|dirs|disown|echo|enable|eval|exec|exit|fc|fg|getopts|hash|help|history|jobs|kill|let|logout|popd|printf|pushd|pwd|return|set|shift|shopt|source|suspend|test|times|trap|type|ulimit|umask|unalias|wait",
h=function(){this.$rules={start:[{token:"constant",regex:/\\./},{token:["text","comment"],regex:/(^|\s)(#.*)$/},{token:"string.start",regex:'"',push:[{token:"constant.language.escape",regex:/\\(?:[$`"\\]|$)/},{include:"variables"},{token:"keyword.operator",regex:/`/},{token:"string.end",regex:'"',next:"pop"},{defaultToken:"string"}]},{token:"string",regex:"\\$'",push:[{token:"constant.language.escape",regex:/\\(?:[abeEfnrtv\\'"]|x[a-fA-F\d]{1,2}|u[a-fA-F\d]{4}([a-fA-F\d]{4})?|c.|\d{1,3})/},{token:"string",
regex:"'",next:"pop"},{defaultToken:"string"}]},{regex:"<<<",token:"keyword.operator"},{stateName:"heredoc",regex:"(<<-?)(\\s*)(['\"`]?)([\\w\\-]+)(['\"`]?)",onMatch:function(a,d,b){var c=d.substring(0,d.length-5);c="-"===a[2]?c+"indentedHeredoc":c+"heredoc";a=a.split(this.splitRegex);b.push(c,a[4],d);return[{type:"constant",value:a[1]},{type:"text",value:a[2]},{type:"string",value:a[3]},{type:"support.class",value:a[4]},{type:"string",value:a[5]}]},rules:{heredoc:[{onMatch:function(a,d,b){if(a===
b[1])return this.next=b[2],b.splice(-3),"support.class";this.next="";return"string"},regex:".*$"}],indentedHeredoc:[{token:"string",regex:"^\t+"},{onMatch:function(a,d,b){if(a===b[1])return this.next=b[2],b.splice(-3),"support.class";this.next="";return"string"},regex:".*$"}]}},{regex:"$",token:"empty",next:function(a,d){return/heredoc$/i.test(d[0])?d[0]:a}},{token:["keyword","text","text","text","variable"],regex:/(declare|local|readonly)(\s+)(?:(-[fixar]+)(\s+))?([a-zA-Z_][a-zA-Z0-9_]*\b)/},{token:"variable.language",
regex:"(?:\\$(?:SHLVL|\\$|\\!|\\?))"},{token:"variable",regex:"(?:[a-zA-Z_][a-zA-Z0-9_]*(?==))"},{include:"variables"},{token:"support.function",regex:"(?:[a-zA-Z_][a-zA-Z0-9_]*\\s*\\(\\))"},{token:"support.function",regex:"(?:&(?:\\d+))"},{token:"string",start:"'",end:"'"},{token:"constant.numeric",regex:"(?:(?:(?:(?:(?:(?:\\d+)?(?:\\.\\d+))|(?:(?:\\d+)\\.))|(?:\\d+)))|(?:(?:(?:\\d+)?(?:\\.\\d+))|(?:(?:\\d+)\\.)))"},{token:"constant.numeric",regex:"(?:(?:[1-9]\\d*)|(?:0))\\b"},{token:this.createKeywordMapper({keyword:g,
"support.function.builtin":n,"invalid.deprecated":"debugger"},"identifier"),regex:"[a-zA-Z_][a-zA-Z0-9_]*\\b"},{token:"keyword.operator",regex:"\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|~|<|>|<=|=>|=|!=|[%&|`]"},{token:"punctuation.operator",regex:";"},{token:"paren.lparen",regex:"[\\[\\(\\{]"},{token:"paren.rparen",regex:"[\\]]"},{token:"paren.rparen",regex:"[\\)\\}]",next:function(a,d){if(2>d.length)return a;d.shift();return d.shift()}}],variables:[{token:"variable",regex:/(\$)(\w+)/},{token:["variable","paren.lparen"],
regex:/(\$)(\()/,push:"start"},{token:["variable","paren.lparen","keyword.operator","variable","keyword.operator"],regex:/(\$)(\{)([#!]?)(\w+|[*@#?\-$!0_])(:[?+\-=]?|##?|%%?|,,?\/|\^\^?)?/,push:"start"},{token:"variable",regex:/\$[*@#?\-$!0_]/},{token:["variable","paren.lparen"],regex:/(\$)(\{)/,push:"start"}]};this.normalizeRules()};l.inherits(h,a);k.ShHighlightRules=h});define("mode/sql",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");var g=a("ace/mode/text").Mode,n=a("mode/sql_highlight_rules").SqlHighlightRules;a("ace/range");a=function(){this.HighlightRules=n};l.inherits(a,g);a.prototype.lineCommentStart="--";a.prototype.$id="mode/sql";k.Mode=a});define("mode/sql_highlight_rules",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");a("ace/lib/lang");a=a("ace/mode/text_highlight_rules").TextHighlightRules;var g=function(){this.$rules={start:[{token:"comment",regex:"--.*$"},{token:"comment",start:"/\\*",end:"\\*/"},{token:"comment",regex:"^#.*$"},{token:"comment.doc.tag",regex:"\\?[a-zA-Z_][a-zA-Z0-9_$]*"},{token:"paren.keyword.operator",merge:!1,regex:"[[({]",next:"start"},{token:"paren.keyword.operator",merge:!1,regex:"[\\])}]",
next:"start"},{token:"string",regex:'".*?"'},{token:"string",regex:"'.*?'"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:this.createKeywordMapper({"support.function":"avg|count|first|last|max|min|sum|ucase|lcase|mid|len|round|rank|now|format|coalesce|ifnull|isnull|nvl",keyword:"select|insert|update|delete|from|where|and|or|group|by|order|limit|offset|having|as|case|when|else|end|type|left|right|join|on|outer|desc|asc|union|create|table|primary|key|if|foreign|not|references|default|null|inner|cross|natural|database|drop|grant|into|values|between|like|in|alter|index|view|exists|full|distinct|top|truncate|all",
"constant.language":"true|false","storage.type":"int|numeric|decimal|date|varchar|char|bigint|float|double|bit|binary|text|set|timestamp|money|real|number|integer"},"identifier",!0),regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|=|\\."},{token:"paren.lparen",regex:"[\\(]"},{token:"paren.rparen",regex:"[\\)]"},{token:"text",regex:"\\s+"}]};this.normalizeRules()};l.inherits(g,a);k.SqlHighlightRules=g});define("mode/stan",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");var g=a("ace/mode/text").Mode,n=a("ace/tokenizer").Tokenizer,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,f=a("mode/stan_highlight_rules").StanHighlightRules,d=a("ace/mode/folding/cstyle").FoldMode;a=function(){this.$highlightRules=new f;this.$tokenizer=new n(this.$highlightRules.getRules());this.$outdent=new h;this.foldingRules=new d};l.inherits(a,g);(function(){this.lineCommentStart=["//","#"];this.blockComment=
{start:"/*",end:"*/"};this.toggleCommentLines=function(a,c,e,d){var b=!0;a=/^(\s*)\/\//;for(var f=e;f<=d;f++)if(!a.test(c.getLine(f))){b=!1;break}if(b)for(b=new Range(0,0,0,0),f=e;f<=d;f++)e=c.getLine(f).match(a),b.start.row=f,b.end.row=f,b.end.column=e[0].length,c.replace(b,e[1]);else c.indentRows(e,d,"//")};this.getLanguageMode=function(a){return"Stan"};this.getNextLineIndent=function(a,c,e){var b=this.$getIndent(c),d=this.getTokenizer().getLineTokens(c,a).tokens;if(d.length&&"comment"==d[d.length-
1].type)return b;"start"==a&&c.match(/^.*(?:[\{\(\[])\s*$/)&&(b+=e);return b};this.checkOutdent=function(a,c,e){return this.$outdent.checkOutdent(c,e)};this.autoOutdent=function(a,c,e){this.$outdent.autoOutdent(c,e)};this.$id="mode/stan"}).call(a.prototype);k.Mode=a});define("mode/stan_highlight_rules",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");a("ace/lib/lang");a=a("ace/mode/text_highlight_rules").TextHighlightRules;var g=function(){this.$rules={start:[{token:"comment.line.number-sign",regex:"\\/\\/.*$"},{token:"comment.line.double-dash",regex:"#.*$"},{token:"comment.block",regex:"\\/\\*",merge:!0,next:"comment"},{token:"keyword.other.block",regex:"\\b(functions|data|transformed\\s+data|parameters|transformed\\s+parameters|model|generated\\s+quantities)\\b"},
{token:"string.quoted.double",regex:'["][ a-zA-Z0-9~@#$%^&*_\'`\\-+={}[\\]()<>|/!?.,;:]*["]'},{token:"constant.numeric",regex:"(?:(?:\\d+(?:\\.\\d*)?)|(?:\\.\\d+))(?:[eE][+\\-]?\\d*)?\\b"},{token:"keyword.operator",regex:"\\bT(?=\\s*\\[)"},{token:["keyword.other","text","punctuation"],regex:"(lower|upper)(\\s*)(=)"},{token:["keyword.other","text","keyword.operator"],regex:"(target)(\\s*)(\\+=)"},{token:"keyword.control",regex:"\\b(for|in|while|if|then|else|return)\\b"},{token:"keyword.other",regex:"\\b(print|reject)\\b"},
{token:"storage.type",regex:"\\b(int|real|vector|simplex|unit_vector|ordered|positive_ordered|row_vector|matrix|cholesky_factor_cov|cholesky_factor_corr|corr_matrix|cov_matrix|void)\\b"},{token:"invalid.deprecated",regex:"\\b(bernoulli_ccdf_log|bernoulli_cdf_log|bernoulli_log|bernoulli_logit_log|beta_binomial_ccdf_log|beta_binomial_cdf_log|beta_binomial_log|beta_ccdf_log|beta_cdf_log|beta_log|binomial_ccdf_log|binomial_cdf_log|binomial_coefficient_log|binomial_log|binomial_logit_log|categorical_log|categorical_logit_log|cauchy_ccdf_log|cauchy_cdf_log|cauchy_log|chi_square_ccdf_log|chi_square_cdf_log|chi_square_log|dirichlet_log|double_exponential_ccdf_log|double_exponential_cdf_log|double_exponential_log|exp_mod_normal_ccdf_log|exp_mod_normal_cdf_log|exp_mod_normal_log|exponential_ccdf_log|exponential_cdf_log|exponential_log|frechet_ccdf_log|frechet_cdf_log|frechet_log|gamma_ccdf_log|gamma_cdf_log|gamma_log|gaussian_dlm_obs_log|get_lp|gumbel_ccdf_log|gumbel_cdf_log|gumbel_log|hypergeometric_log|increment_log_prob|integrate_ode|inv_chi_square_ccdf_log|inv_chi_square_cdf_log|inv_chi_square_log|inv_gamma_ccdf_log|inv_gamma_cdf_log|inv_gamma_log|inv_wishart_log|lkj_corr_cholesky_log|lkj_corr_log|logistic_ccdf_log|logistic_cdf_log|logistic_log|lognormal_ccdf_log|lognormal_cdf_log|lognormal_log|multi_gp_cholesky_log|multi_gp_log|multi_normal_cholesky_log|multi_normal_log|multi_normal_prec_log|multi_student_t_log|multinomial_log|multiply_log|neg_binomial_2_ccdf_log|neg_binomial_2_cdf_log|neg_binomial_2_log|neg_binomial_2_log_log|neg_binomial_ccdf_log|neg_binomial_cdf_log|neg_binomial_log|normal_ccdf_log|normal_cdf_log|normal_log|ordered_logistic_log|pareto_ccdf_log|pareto_cdf_log|pareto_log|pareto_type_2_ccdf_log|pareto_type_2_cdf_log|pareto_type_2_log|poisson_ccdf_log|poisson_cdf_log|poisson_log|poisson_log_log|rayleigh_ccdf_log|rayleigh_cdf_log|rayleigh_log|scaled_inv_chi_square_ccdf_log|scaled_inv_chi_square_cdf_log|scaled_inv_chi_square_log|skew_normal_ccdf_log|skew_normal_cdf_log|skew_normal_log|student_t_ccdf_log|student_t_cdf_log|student_t_log|uniform_ccdf_log|uniform_cdf_log|uniform_log|von_mises_log|weibull_ccdf_log|weibull_cdf_log|weibull_log|wiener_log|wishart_log)\\b"},
{token:["keyword.operator.sampling","text","support.function"],regex:"(~)(\\s*)(bernoulli|bernoulli_logit|beta|beta_binomial|binomial|binomial_logit|categorical|categorical_logit|cauchy|chi_square|dirichlet|double_exponential|exp_mod_normal|exponential|frechet|gamma|gaussian_dlm_obs|gumbel|hypergeometric|inv_chi_square|inv_gamma|inv_wishart|lkj_corr|lkj_corr_cholesky|logistic|lognormal|multi_gp|multi_gp_cholesky|multi_normal|multi_normal_cholesky|multi_normal_prec|multi_student_t|multinomial|neg_binomial|neg_binomial_2|neg_binomial_2_log|normal|ordered_logistic|pareto|pareto_type_2|poisson|poisson_log|rayleigh|scaled_inv_chi_square|skew_normal|student_t|uniform|von_mises|weibull|wiener|wishart)\\b"},
{token:"support.function",regex:"\\b(Phi|Phi_approx|abs|acos|acosh|append_col|append_row|asin|asinh|atan|atan2|atanh|bernoulli_cdf|bernoulli_lccdf|bernoulli_lcdf|bernoulli_logit_lpmf|bernoulli_lpmf|bernoulli_rng|bessel_first_kind|bessel_second_kind|beta_binomial_cdf|beta_binomial_lccdf|beta_binomial_lcdf|beta_binomial_lpmf|beta_binomial_rng|beta_cdf|beta_lccdf|beta_lcdf|beta_lpdf|beta_rng|binary_log_loss|binomial_cdf|binomial_lccdf|binomial_lcdf|binomial_logit_lpmf|binomial_lpmf|binomial_rng|block|categorical_logit_lpmf|categorical_lpmf|categorical_rng|cauchy_cdf|cauchy_lccdf|cauchy_lcdf|cauchy_lpdf|cauchy_rng|cbrt|ceil|chi_square_cdf|chi_square_lccdf|chi_square_lcdf|chi_square_lpdf|chi_square_rng|cholesky_decompose|col|cols|columns_dot_product|columns_dot_self|cos|cosh|cov_exp_quad|crossprod|csr_extract_u|csr_extract_v|csr_extract_w|csr_matrix_times_vector|csr_to_dense_matrix|cumulative_sum|determinant|diag_matrix|diag_post_multiply|diag_pre_multiply|diagonal|digamma|dims|dirichlet_lpdf|dirichlet_rng|distance|dot_product|dot_self|double_exponential_cdf|double_exponential_lccdf|double_exponential_lcdf|double_exponential_lpdf|double_exponential_rng|e|eigenvalues_sym|eigenvectors_sym|erf|erfc|exp|exp2|exp_mod_normal_cdf|exp_mod_normal_lccdf|exp_mod_normal_lcdf|exp_mod_normal_lpdf|exp_mod_normal_rng|expm1|exponential_cdf|exponential_lccdf|exponential_lcdf|exponential_lpdf|exponential_rng|fabs|falling_factorial|fdim|floor|fma|fmax|fmin|fmod|frechet_cdf|frechet_lccdf|frechet_lcdf|frechet_lpdf|frechet_rng|gamma_cdf|gamma_lccdf|gamma_lcdf|gamma_lpdf|gamma_p|gamma_q|gamma_rng|gaussian_dlm_obs_lpdf|gumbel_cdf|gumbel_lccdf|gumbel_lcdf|gumbel_lpdf|gumbel_rng|head|hypergeometric_lpmf|hypergeometric_rng|hypot|inc_beta|int_step|integrate_ode_bdf|integrate_ode_rk45|inv|inv_chi_square_cdf|inv_chi_square_lccdf|inv_chi_square_lcdf|inv_chi_square_lpdf|inv_chi_square_rng|inv_cloglog|inv_gamma_cdf|inv_gamma_lccdf|inv_gamma_lcdf|inv_gamma_lpdf|inv_gamma_rng|inv_logit|inv_phi|inv_sqrt|inv_square|inv_wishart_lpdf|inv_wishart_rng|inverse|inverse_spd|is_inf|is_nan|lbeta|lchoose|lgamma|lkj_corr_cholesky_lpdf|lkj_corr_cholesky_rng|lkj_corr_lpdf|lkj_corr_rng|lmgamma|lmultiply|log|log10|log1m|log1m_exp|log1m_inv_logit|log1p|log1p_exp|log2|log_determinant|log_diff_exp|log_falling_factorial|log_inv_logit|log_mix|log_rising_factorial|log_softmax|log_sum_exp|logistic_cdf|logistic_lccdf|logistic_lcdf|logistic_lpdf|logistic_rng|logit|lognormal_cdf|lognormal_lccdf|lognormal_lcdf|lognormal_lpdf|lognormal_rng|machine_precision|max|mdivide_left_spd|mdivide_left_tri_low|mdivide_right_spd|mdivide_right_tri_low|mean|min|modified_bessel_first_kind|modified_bessel_second_kind|multi_gp_cholesky_lpdf|multi_gp_lpdf|multi_normal_cholesky_lpdf|multi_normal_cholesky_rng|multi_normal_lpdf|multi_normal_prec_lpdf|multi_normal_rng|multi_student_t_lpdf|multi_student_t_rng|multinomial_lpmf|multinomial_rng|multiply_lower_tri_self_transpose|neg_binomial_2_cdf|neg_binomial_2_lccdf|neg_binomial_2_lcdf|neg_binomial_2_log_lpmf|neg_binomial_2_log_rng|neg_binomial_2_lpmf|neg_binomial_2_rng|neg_binomial_cdf|neg_binomial_lccdf|neg_binomial_lcdf|neg_binomial_lpmf|neg_binomial_rng|negative_infinity|normal_cdf|normal_lccdf|normal_lcdf|normal_lpdf|normal_rng|not_a_number|num_elements|ordered_logistic_lpmf|ordered_logistic_rng|owens_t|pareto_cdf|pareto_lccdf|pareto_lcdf|pareto_lpdf|pareto_rng|pareto_type_2_cdf|pareto_type_2_lccdf|pareto_type_2_lcdf|pareto_type_2_lpdf|pareto_type_2_rng|pi|poisson_cdf|poisson_lccdf|poisson_lcdf|poisson_log_lpmf|poisson_log_rng|poisson_lpmf|poisson_rng|positive_infinity|pow|prod|qr_Q|qr_R|quad_form|quad_form_diag|quad_form_sym|rank|rayleigh_cdf|rayleigh_lccdf|rayleigh_lcdf|rayleigh_lpdf|rayleigh_rng|rep_array|rep_matrix|rep_row_vector|rep_vector|rising_factorial|round|row|rows|rows_dot_product|rows_dot_self|scaled_inv_chi_square_cdf|scaled_inv_chi_square_lccdf|scaled_inv_chi_square_lcdf|scaled_inv_chi_square_lpdf|scaled_inv_chi_square_rng|sd|segment|sin|singular_values|sinh|size|skew_normal_cdf|skew_normal_lccdf|skew_normal_lcdf|skew_normal_lpdf|skew_normal_rng|softmax|sort_asc|sort_desc|sort_indices_asc|sort_indices_desc|sqrt|sqrt2|square|squared_distance|step|student_t_cdf|student_t_lccdf|student_t_lcdf|student_t_lpdf|student_t_rng|sub_col|sub_row|sum|tail|tan|tanh|target|tcrossprod|tgamma|to_array_1d|to_array_2d|to_matrix|to_row_vector|to_vector|trace|trace_gen_quad_form|trace_quad_form|trigamma|trunc|uniform_cdf|uniform_lccdf|uniform_lcdf|uniform_lpdf|uniform_rng|variance|von_mises_lpdf|von_mises_rng|weibull_cdf|weibull_lccdf|weibull_lcdf|weibull_lpdf|weibull_rng|wiener_lpdf|wishart_lpdf|wishart_rng)\\b"},
{token:"invalid.illegal",regex:"\\b(STAN_MAJOR|STAN_MATH_MAJOR|STAN_MATH_MINOR|STAN_MATH_PATCH|STAN_MINOR|STAN_PATCH|alignas|alignof|and|and_eq|asm|auto|bitand|bitor|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|const_cast|constexpr|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|false|float|for|friend|fvar|goto|if|in|inline|int|long|lp__|mutable|namespace|new|noexcept|not|not_eq|nullptr|operator|or|or_eq|private|protected|public|register|reinterpret_cast|repeat|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|then|this|thread_local|throw|true|try|typedef|typeid|typename|union|unsigned|until|using|var|virtual|void|volatile|wchar_t|while|xor|xor_eq)\\b"},
{token:"invalid.illegal",regex:"[a-zA-Z][a-zA-Z0-9_]*(?!__)\\b__\\b"},{token:"invalid.illegal",regex:"\\b(?:_|[_0-9][A-Za-z0-9_]+|[A-Za-z][A-Za-z0-9_]*__)\\b"},{token:"function",regex:"[a-zA-Z][a-zA-Z0-9_]*(?!__)\\b(?=\\s*\\()"},{token:"identifier",regex:"[a-zA-Z][a-zA-Z0-9_]*(?!__)\\b"},{token:"invalid.deprecated",regex:"<-"},{token:"keyword.operator",regex:"~|[|]{2}|&&|==?|!=|<=?|>=?|\\+|-|\\.?\\*|\\.?/|\\\\|\\^|!|'|%|\\?|:"},{token:"punctuation.operator",regex:",|;|[|]"},{token:"paren.lparen.keyword.operator",
regex:"[\\[\\(\\{]"},{token:"paren.rparen.keyword.operator",regex:"[\\]\\)\\}]"},{token:"text",regex:"\\s+"}],comment:[{token:"comment",regex:".*?\\*\\/",next:"start"},{token:"comment",merge:!0,regex:".+"}]}};l.inherits(g,a);k.StanHighlightRules=g});define("mode/sweave",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");var g=a("ace/mode/text").Mode,n=a("ace/tokenizer").Tokenizer,h=a("ace/mode/text_highlight_rules").TextHighlightRules,f=a("mode/sweave_highlight_rules").SweaveHighlightRules,d=a("mode/r_code_model").RCodeModel,b=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,c=a("mode/r_matching_brace_outdent").RMatchingBraceOutdent,e=a("ace/unicode"),t=a("mode/utils");a("mode/auto_brace_insert");a=function(a,e){this.$tokenizer=
a?new n((new h).getRules()):new n((new f).getRules());this.$session=e;this.$outdent=new b;this.codeModel=new d(e,this.$tokenizer,/^r-/,/<<(.*?)>>/,/^\s*@\s*$/);this.$r_outdent=new c(this.codeModel);this.foldingRules=this.codeModel};l.inherits(a,g);(function(){this.tokenRe=new RegExp("^["+e.wordChars+"._]+","g");this.nonTokenRe=new RegExp("^(?:[^"+e.wordChars+"._]|\\s)+","g");this.$complements={"(":")","[":"]",'"':'"',"'":"'","{":"}"};this.$reOpen=/^[(["'{]$/;this.$reClose=/^[)\]"'}]$/;this.insertChunkInfo=
{value:"<<>>=\n\n@\n",position:{row:0,column:2},content_position:{row:1,column:0}};this.getLanguageMode=function(a){return t.getPrimaryState(this.$session,a.row).match(/^r-/)?"R":"TeX"};this.$getNextLineIndent=this.getNextLineIndent;this.getNextLineIndent=function(a,b,c,e){return"r"===t.activeMode(a,"tex")?this.codeModel.getNextLineIndent(a,b,c,e):this.$getNextLineIndent(a,b,c)};this.checkOutdent=function(a,b,c){return"r"===t.activeMode(a,"tex")?this.$r_outdent.checkOutdent(a,b,c):this.$outdent.checkOutdent(b,
c)};this.autoOutdent=function(a,b,c){return"r"===t.activeMode(a,"tex")?this.$r_outdent.autoOutdent(a,b,c):this.$outdent.autoOutdent(b,c)};this.allowAutoInsert=this.smartAllowAutoInsert;this.$id="mode/sweave"}).call(a.prototype);k.Mode=a});define("mode/sweave_highlight_rules",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");var g=a("mode/tex_highlight_rules").TexHighlightRules,n=a("mode/r_highlight_rules").RHighlightRules;a=a("ace/mode/text_highlight_rules").TextHighlightRules;var h=function(){this.$rules=(new g).getRules();this.$rules.start.unshift({token:"comment.codebegin",regex:"^\\s*\\<\\<.*\\>\\>=.*$",next:"r-start"});this.$rules.start.unshift({token:"comment",regex:"^\\s*@(?:\\s.*)?$"});this.$rules.start.unshift({regex:"(\\\\Sexpr)([{])",
next:"r-start",onMatch:function(a,b,c,e){c.length=2;c[0]=b;c[1]=1;return[{type:"keyword",value:"\\Sexpr"},{type:"paren.keyword.operator",value:"{"}]}});var a=(new n).getRules();this.addRules(a,"r-");this.$rules["r-start"].unshift({token:"paren.keyword.operator",regex:"[{]",merge:!1,onMatch:function(a,b,c,e){c.length&&(c[1]+=1);return this.token}});this.$rules["r-start"].unshift({token:"paren.keyword.operator",regex:"[}]",merge:!1,onMatch:function(a,b,c,e){this.next="r-start";c.length&&(--c[1],0==
c[1]&&(this.next=c[0],c.splice(0)));return this.token}});this.$rules["r-start"].unshift({token:"comment.codeend",regex:"^\\s*@(?:\\s.*)?$",next:"start"});this.$rules["r-start"].unshift({token:"comment.codebegin",regex:"^\\<\\<.*\\>\\>=.*$",next:"r-start"})};l.inherits(h,a);k.SweaveHighlightRules=h});define("mode/tex",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");var g=a("ace/mode/text").Mode,n=a("ace/tokenizer").Tokenizer,h=a("ace/mode/text_highlight_rules").TextHighlightRules,f=a("mode/tex_highlight_rules").TexHighlightRules,d=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent;a=function(a){this.$tokenizer=a?new n((new h).getRules()):new n((new f).getRules());this.$outdent=new d};l.inherits(a,g);(function(){this.getNextLineIndent=function(a,c,e){return this.$getIndent(c)};
this.allowAutoInsert=function(){return!1}}).call(a.prototype);k.Mode=a});define("mode/tex_highlight_rules",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");a("ace/lib/lang");a=a("ace/mode/text_highlight_rules").TextHighlightRules;var g=function(a){a||(a="text");this.$rules={start:[{token:"comment",regex:"%.*$"},{token:a,regex:"\\\\[$&%#\\{\\}]"},{token:"keyword",regex:"\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\b",
next:"nospell"},{token:"keyword",regex:"\\\\(?:[a-zA-Z0-9]+|[^a-zA-Z0-9])"},{token:"paren.keyword.operator",regex:"[[({]"},{token:"paren.keyword.operator",regex:"[\\])}]"},{token:a,regex:"\\s+"}],nospell:[{token:"comment",regex:"%.*$",next:"start"},{token:"nospell."+a,regex:"\\\\[$&%#\\{\\}]"},{token:"keyword",regex:"\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\b"},
{token:"keyword",regex:"\\\\(?:[a-zA-Z0-9]+|[^a-zA-Z0-9])",next:"start"},{token:"paren.keyword.operator",regex:"[[({]"},{token:"paren.keyword.operator",regex:"[\\])]"},{token:"paren.keyword.operator",regex:"}",next:"start"},{token:"nospell."+a,regex:"\\s+"},{token:"nospell."+a,regex:"\\w+"}]}};l.inherits(g,a);k.TexHighlightRules=g});define("mode/token_cursor",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");var g=a("mode/utils"),n=g.getTokenTypeRegex("paren"),h=function(a,c,e){this.$tokens=a;this.$row=c||0;this.$offset=e||0};(function(){this.cloneCursor=function(){return new h(this.$tokens,this.$row,this.$offset)};var a=g.isArray,c=g.contains,e={"(":")","{":"}","<":">","[":"]",")":"(","}":"{",">":"<","]":"["},d=["(","[","{"],f=[")","]","}"];this.moveToStartOfRow=function(a){this.$row=a;this.$offset=0};this.moveToEndOfRow=
function(a){this.$row=a;this.$offset=(a=this.$tokens[a])&&a.length?a.length-1:0};this.moveToPreviousToken=function(){if(0>=this.$row&&0>=this.$offset)return this.$offset=this.$row=0,!1;if(0<this.$offset)return this.$offset--,!0;for(var a=this.$row-1,b=0;0<=a;){var c=this.$tokens[a];if(c&&0!==c.length){b=c.length;break}a--}if(0>a)return!1;this.$row=a;this.$offset=b-1;return!0};this.moveToNextToken=function(a){"undefined"===typeof a&&(a=(this.$tokens||[]).length);if(this.$row>a)return!1;null==this.$tokens[this.$row]&&
this.$codeModel&&this.$codeModel.$tokenizeUpToRow&&this.$codeModel.$tokenizeUpToRow.call(this.$codeModel,a);var b=this.$tokens[this.$row];if(b&&this.$offset<b.length-1)return this.$offset++,!0;for(var c=this.$row+1;c<=a&&(!(b=this.$tokens[c])||0===b.length);)c++;if(c>a)return!1;this.$row=c;this.$offset=0;return!0};this.peekBwd=function(a){"undefined"===typeof a&&(a=1);for(var b=this.cloneCursor(),c=0;c<a;c++)if(!b.moveToPreviousToken())return b.$invalidate();return b};this.peekFwd=function(a){"undefined"===
typeof a&&(a=1);for(var b=this.cloneCursor(),c=0;c<a;c++)if(!b.moveToNextToken())return b.$invalidate();return b};this.$invalidate=function(){this.$column=this.$row=0;this.$tokens=[];return this};this.seekToNearestToken=function(a,b){if(a.row>b)return!1;this.$row=a.row;var c=this.$tokens[this.$row]||[];for(this.$offset=0;this.$offset<c.length;this.$offset++)if(c[this.$offset].column>=a.column)return!0;return a.row<b?this.moveToNextToken(b):!1};this.bwdToNearestToken=function(a){this.$row=a.row;this.$offset=
a.column;for(var b=this.$tokens[this.$row]||[];0<=this.$offset;this.$offset--){var c=b[this.$offset];if("undefined"!==typeof c&&c.column<=a.column)return!0}return this.moveToPreviousToken()};this.bwdToMatchingToken=function(){var a=this.currentValue();if(!c(f,a))return!1;for(var b=e[a],d=0;this.moveToPreviousToken();){var g=this.currentValue();if(g===b){if(0===d)return!0;d--}else g===a&&d++}return!1};this.fwdToMatchingToken=function(){var a=this.currentValue();if(!c(d,a))return!1;for(var b=e[a],f=
0;this.moveToNextToken();){var g=this.currentValue();if(g===b){if(0===f)return!0;f--}else g===a&&f++}return!1};this.equals=function(a){return this.$row===a.$row&&this.$offset===a.$offset};this.moveBackwardOverMatchingParens=function(){if(!this.moveToPreviousToken())return!1;if(")"!==this.currentValue())return this.moveToNextToken(),!1;for(var a=!1,b=0;this.moveToPreviousToken();){var c=this.currentValue();if("("===c){if(0===b){a=!0;break}b--}else")"===c&&b++}return a};this.findToken=function(a,b){do{var c=
this.currentToken();if(c&&a(c))return c}while(this.moveToNextToken(b));return null};this.findTokenBwd=function(a,b){do{var c=this.currentToken();if(c&&a(c))return c}while(this.moveToPreviousToken(b));return null};this.currentToken=function(){var a=this.$tokens[this.$row];if(null==a)return{};a=a[this.$offset];return null==a?{}:a};this.currentValue=function(){return this.currentToken().value};this.currentType=function(){return this.currentToken().type};this.hasType=function(){var a=this.currentType();
if(null==a)return!1;for(var b=0;b<arguments.length;b++){var c=arguments[b];if(a===c||-1!==a.indexOf(c+".")||-1!==a.indexOf("."+c))return!0}return!1};this.currentPosition=function(){var a=this.currentToken();return null==a?null:{row:this.$row,column:a.column}};this.isFirstSignificantTokenOnLine=function(){return 0===this.$offset};this.isLastSignificantTokenOnLine=function(){return this.$offset==(this.$tokens[this.$row]||[]).length-1};this.bwdUntil=function(a){for(;!a(this);)this.moveToPreviousToken()};
this.bwdWhile=function(a){for(;a(this);)this.moveToPreviousToken()};this.moveToPosition=function(a,b){var c=a.row,e=a.column,d=this.$tokens[c];null==d&&this.$codeModel&&this.$codeModel.$tokenizeUpToRow&&(this.$codeModel.$tokenizeUpToRow.call(this.$codeModel,c),d=this.$tokens[c]);if(d&&0<d.length&&d[0].column<=e){for(var f=0;f<d.length&&!(d[f].column>=e);f++);this.$row=c;this.$offset=f===d.length?f-1:b&&d[f].column===e?f:f-1;return!0}e=this.cloneCursor();e.$row=c;e.$offset=0;return e.moveToPreviousToken()?
(this.$row=e.$row,this.$offset=e.$offset,!0):!1};this.findOpeningBracket=function(b,c){a(b)||(b=[b]);var e=this.cloneCursor();do if(!e.bwdToMatchingToken()){var d=e.currentValue();if(c&&"{"===d)break;for(var f=0;f<b.length;f++)if(d===b[f])return this.$row=e.$row,this.$offset=e.$offset,!0}while(e.moveToPreviousToken());return!1};this.findOpeningBracketCountCommas=function(b,c){a(b)||(b=[b]);var e=this.cloneCursor(),d=0;do if(!e.bwdToMatchingToken()){var f=e.currentValue();","===f&&(d+=1);if(c&&"{"===
f)break;for(var g=0;g<b.length;g++)if(f===b[g])return this.$row=e.$row,this.$offset=e.$offset,d}while(e.moveToPreviousToken());return-1}}).call(h.prototype);var f=function(a,c,e,d){this.$tokens=a;this.$row=c||0;this.$offset=e||0;this.$codeModel=d};l.mixin(f.prototype,h.prototype);(function(){this.cloneCursor=function(){return new f(this.$tokens,this.$row,this.$offset,this.$codeModel)};var a=g.contains;this.bwdOverConstNoexceptDecltype=function(){var a=this.cloneCursor();if("{"!==a.currentValue()||
!a.moveToPreviousToken())return!1;var b=a.cloneCursor();")"===b.currentValue()&&b.bwdToMatchingToken()&&b.moveToPreviousToken()&&"decltype"===b.currentValue()&&b.moveToPreviousToken()&&(a.$row=b.$row,a.$offset=b.$offset);b=a.cloneCursor();")"===b.currentValue()&&b.bwdToMatchingToken()&&b.moveToPreviousToken()&&"noexcept"===b.currentValue()&&(a.$row=b.$row,a.$offset=b.$offset);if("noexcept"===a.currentValue()&&!a.moveToPreviousToken()||"const"===a.currentValue()&&!a.moveToPreviousToken()||")"===a.currentValue()&&
!a.moveToNextToken())return!1;this.$row=a.$row;this.$offset=a.$offset;return!0};this.bwdToMatchingArrow=function(){if(">"!==this.currentValue())return!1;for(var a=0,b=this.cloneCursor();b.moveToPreviousToken();)if("<"===b.currentValue()){if(0===a)return this.$row=b.$row,this.$offset=b.$offset,!0;a--}else">"===b.currentValue()&&a++;return!1};this.bwdOverClassySpecifiers=function(){var a=this.currentValue();":"!==a&&","!==a&&"{"!==a||this.moveToPreviousToken();do{this.bwdToMatchingArrow()&&this.moveToPreviousToken();
a=this.currentType();var b=this.currentValue();if("keyword"!==a&&"::"!==b&&"identifier"!==a&&"constant"!==a)break;if("class"===b||"struct"===b||"enum"===b||":"===b||","===b)return!0}while(this.moveToPreviousToken());return!1};this.bwdOverClassInheritance=function(){var a=this.cloneCursor();return c(a,this)};var c=function(a,b){a.bwdOverClassySpecifiers();var e=a.currentValue();return","===e?c(a,b):":"===e?(b.$row=a.$row,b.$offset=a.$offset,!0):!1};this.bwdOverInitializationList=function(){var a=this.cloneCursor();
return this.doBwdOverInitializationList(a,this)};this.doBwdOverInitializationList=function(b,c){b.moveBackwardOverMatchingParens();if(!b.moveBackwardOverMatchingParens()&&!b.moveToPreviousToken())return!1;for(;"keyword"===b.currentType();)if(!b.moveToPreviousToken())return!1;if(b.moveToPreviousToken()){var e=b.currentValue();if(","===e)return this.doBwdOverInitializationList(b,c);if(":"===e&&(e=b.peekBwd().currentValue(),!a(["public","private","protected"],e)))return c.$row=b.$row,c.$offset=b.$offset,
!0}return!1}}).call(f.prototype);var d=function(a,c,e,d){this.$tokens=a;this.$row=c||0;this.$offset=e||0;this.$codeModel=d};l.mixin(d.prototype,h.prototype);(function(){function a(a){return 0===a.indexOf("'")?a.lastIndexOf("'")===a.length-1:0===a.indexOf('"')?a.lastIndexOf('"')===a.length-1:!1}function c(a){return"("===a||"["===a||"{"===a}function e(a){return")"===a||"]"===a||"}"===a}this.cloneCursor=function(){return new d(this.$tokens,this.$row,this.$offset,this.$codeModel)};var f=g.contains;this.isValidAsIdentifier=
function(){var a=this.currentType();return this.hasType("identifier","constant")||"symbol"===a||"keyword"===a||"string"===a};this.isExtractionOperator=function(){var a=this.currentValue();return"$"===a||"@"===a||"::"===a||":::"===a};this.findStartOfEvaluationContext=function(){var a=this.cloneCursor();do if(!a.bwdToMatchingToken()){if(a.isValidAsIdentifier()){if(!a.moveToPreviousToken())break;if(a.isExtractionOperator())continue;if(!a.moveToNextToken())return!1;break}return!1}while(a.moveToPreviousToken());
this.$row=a.$row;this.$offset=a.$offset;return!0};this.isLookingAtBinaryOp=function(){var a=this.currentType();return"keyword.operator"===a||"keyword.operator.infix"===a};this.moveToStartOfCurrentStatement=function(){for(var a=this.cloneCursor();a.isLookingAtBinaryOp();)if(!a.moveToPreviousToken())return!1;do if(!a.bwdToMatchingToken()){if(a.isValidAsIdentifier()){if(!a.moveToPreviousToken())break;if(a.isLookingAtBinaryOp()){for(;a.isLookingAtBinaryOp();)if(!a.moveToPreviousToken())return!1;if(!a.moveToNextToken())return!1;
continue}if(!a.moveToNextToken())return!1;break}return!1}while(a.moveToPreviousToken());this.$row=a.$row;this.$offset=a.$offset;return!0};this.moveToEndOfCurrentStatement=function(){for(var a=this.cloneCursor();a.isLookingAtBinaryOp();)if(!a.moveToNextToken())return!1;do if(!a.fwdToMatchingToken()){if(a.isValidAsIdentifier()){if(!a.moveToNextToken())break;if(a.isLookingAtBinaryOp()){for(;a.isLookingAtBinaryOp();)if(!a.moveToNextToken())return!1;if(!a.moveToPreviousToken())return!1;continue}if(!a.moveToPreviousToken())return!1;
break}return!1}while(a.moveToNextToken());this.$row=a.$row;this.$offset=a.$offset;return!0};this.isSingleLineString=function(){return a(this.currentValue())};this.isLeftBracket=function(){return c(this.currentValue())};this.isRightBracket=function(){return e(this.currentValue())};this.isValidForEndOfStatement=function(){var b=this.currentType(),c=this.currentValue();return-1!==b.search(n)?e(c):a(c)||this.hasType("identifier","constant","variable")};this.isValidForStartOfStatement=function(){var b=
this.currentType();this.currentValue();if(-1!==b.search(n))return c(this.currentValue());b=this.currentValue();return a(b)||this.hasType("identifier","constant","variable")};this.isConditionalControlFlowKeyword=function(){var a=this.currentValue();return f(["if","for","while","function"],a)};this.isControlFlowKeyword=function(){var a=this.currentValue();return f("if for while else function repeat break next".split(" "),a)};this.isAtStartOfNewExpression=function(a){var b=this.cloneCursor();return b.moveToPreviousToken()?
this.isValidForStartOfStatement()&&b.isValidForEndOfStatement()&&this.$row>b.$row?b.isControlFlowKeyword()||")"===b.currentValue()&&b.bwdToMatchingToken()&&b.moveToPreviousToken()&&b.isConditionalControlFlowKeyword()?!1:!0:!1:a}}).call(d.prototype);k.TokenCursor=h;k.CppTokenCursor=f;k.RTokenCursor=d});define("mode/token_utils",["require","exports","module"],function(a,k,l){a=function(a,n,h,f,d,b){this.$doc=a;this.$tokenizer=n;this.$tokens=h;this.$endStates=Array(a.getLength());this.$statePattern=f;this.$codeBeginPattern=d;this.$codeEndPattern=b};(function(){this.getTokenForPos=function(a,n,h){this.$tokenizeUpToRow(a.row);if(this.$tokens.length<=a.row)return null;for(var f=this.$tokens[a.row],d=0;d<f.length;d++){var b=f[d];if(n&&a.column==b.column)return b;if(a.column<=b.column)break;if(h&&a.column==
b.column+b.value.length||a.column<b.column+b.value.length)return b}return null};this.$tokenizeUpToRow=function(a){a=Math.min(a,this.$doc.getLength()-1);for(var g=0,h=!0;g<=a;g++)if(!h||!this.$endStates[g]){h=!1;var f=0===g?"start":this.$endStates[g-1],d=this.$doc.getLine(g);d=this.$tokenizer.getLineTokens(d,f,g);!this.$statePattern||this.$statePattern.test(d.state)||this.$statePattern.test(f)?this.$tokens[g]=this.$filterWhitespaceAndComments(d.tokens):this.$tokens[g]=[];d.state===this.$endStates[g]?
h=!0:this.$endStates[g]=d.state}h||g<this.$tokens.length&&this.$invalidateRow(g);return!0};this.$filterWhitespaceAndComments=function(a){a=a.filter(function(a){a=/\bcode(?:begin|end)\b/.test(a.type)?!1:/\bsectionhead\b/.test(a.type)?!1:/^\s*$/.test(a.value)||a.type.match(/\b(?:ace_virtual-)?comment\b/);return!a});for(var g=a.length-1;0<=g;g--)if(1<a[g].value.length&&/\bparen\b/.test(a[g].type)){var h=a[g];a.splice(g,1);for(var f=h.value.length-1;0<=f;f--){var d={type:h.type,value:h.value.charAt(f),
column:h.column+f};a.splice(g,0,d)}}return a};this.$invalidateRow=function(a){this.$tokens[a]=null;this.$endStates[a]=null};this.$insertNewRows=function(a,n){for(var g=[a,0],f=0;f<n;f++)g.push(null);this.$tokens.splice.apply(this.$tokens,g);this.$endStates.splice.apply(this.$endStates,g)};this.$removeRows=function(a,n){this.$tokens.splice(a,n);this.$endStates.splice(a,n)};this.$walkParens=function(a,n,h){var f=/\bparen\b/;return a<n?function(){for(;a<=n;a++)for(var d=this.$tokens[a],b=0;b<d.length;b++)if(f.test(d[b].type)&&
!h(d[b].value,{row:a,column:d[b].column}))return!1;return!0}.call(this):function(){a=Math.max(0,a);for(n=Math.max(0,n);a>=n;a--)for(var d=this.$tokens[a],b=d.length-1;0<=b;b--)if(f.test(d[b].type)&&!h(d[b].value,{row:a,column:d[b].column}))return!1;return!0}.call(this)};this.$walkParensBalanced=function(a,n,h,f,d){var b=[],c=null;this.$walkParens(a,n,function(a,g){if(h&&h(b,a,g))return c=g,!1;if(/[\[({]/.test(a))if(b[b.length-1]===d[a])b.pop();else return!0;else b.push(a);return f&&f(b,a,g)?(c=g,
!1):!0});return c};this.$findNextSignificantToken=function(a,n){if(0==this.$tokens.length)return null;n=Math.min(n,this.$tokens.length-1);for(var g=a.row,f=a.column;g<=n;g++){for(var d=this.$tokens[g],b=0;b<d.length;b++)if(d[b].column+d[b].value.length>f)return{token:d[b],row:g,column:Math.max(d[b].column,f),offset:b};f=0}return null};this.findNextSignificantToken=function(a){return this.$findNextSignificantToken(a,this.$tokens.length-1)};this.$findPreviousSignificantToken=function(a,n){if(0==this.$tokens.length)return null;
n=Math.max(0,n);for(var g=Math.min(a.row,this.$tokens.length-1);g>=n;g--){var f=this.$tokens[g];if(0!=f.length){if(g!=a.row)return{row:g,column:f[f.length-1].column,token:f[f.length-1],offset:f.length-1};for(var d=f.length-1;0<=d;d--)if(f[d].column<a.column)return{row:g,column:f[d].column,token:f[d],offset:d}}}return null}}).call(a.prototype);k.TokenUtils=a});define("mode/utils",["require","exports","module"],function(a,k,l){a("ace/range");var g=a("ace/token_iterator").TokenIterator,n=a("ace/unicode");(function(){var a=this,f=new RegExp("^["+n.wordChars+"._]+","");this.construct=function(a,c){function b(){return a.apply(this,c)}b.prototype=a.prototype;return new b};this.contains=function(a,c){for(var b=0;b<a.length;b++)if(a[b]===c)return!0;return!1};this.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)};this.asArray=function(b){return a.isArray(b)?
b:[b]};this.getPrimaryState=function(b,c){return a.primaryState(b.getState(c))};this.primaryState=function(b){if(a.isArray(b))for(var c=0;c<b.length;c++){var d=b[c];if("#tmp"!==d)return d||"start"}return b||"start"};this.activeMode=function(b,c){var d=a.primaryState(b),f=d.lastIndexOf("-");return-1===f?c:d.substring(0,f).toLowerCase()};this.endsWith=function(a,c){return-1!==a.indexOf(c,a.length-c.length)};this.escapeRegExp=function(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")};
this.embedRules=function(b,c,d,f,g,h,m){"undefined"===typeof h&&(h=["start"]);"undefined"===typeof m&&(m="start");h=a.asArray(h);m=b.$rules;for(var e=function(a,b,c,d){c.splice(0);return this.token},n=0;n<h.length;n++)m[h[n]].unshift({token:"support.function.codebegin",regex:f,onMatch:e,next:d+"-start"});b.embedRules(c,d+"-",[{token:"support.function.codeend",regex:g,onMatch:e,next:"start"}])};this.isSingleLineString=function(a){if(2>a.length)return!1;var b=a[0];return"'"!==b&&'"'!==b||a[a.length-
1]!==b||"\\"===a[a.length-2]&&"\\"!==a[a.length-3]?!1:!0};this.createTokenIterator=function(a){var b=a.getSelectionRange().start;a=a.getSession();return new g(a,b.row,b.column)};this.isWordCharacter=function(a){return f.test(a)};var d={"'":"'",'"':'"',"`":"`","{":"}","(":")","[":"]","<":">","}":"{",")":"(","]":"[",">":"<"};this.isBracket=function(a,c){return!c||"<"!==a&&">"!==a?"{"===a||"}"===a||"("===a||")"===a||"["===a||"]"===a:!0};this.isOpeningBracket=function(a,c){return"{"===a||"("===a||"["===
a||!!c&&"<"===a};this.isClosingBracket=function(a,c){return"}"===a||")"===a||"]"===a||!!c&&">"===a};this.getComplement=function(a,c){"undefined"===typeof c&&(c=d);var b=c[a];return"undefined"===typeof b?a:b};this.stripEnclosingQuotes=function(a){var b=a.length;if(2>b)return a;var d=a[0];return"'"!==d&&'"'!==d&&"`"!==d||a[b-1]!==d?a:a.substr(1,b-2)};this.startsWith=function(a,c){if("string"!==typeof a||"string"!==typeof c||a.length<c.length)return!1;for(var b=0;b<c.length;b++)if(a[b]!==c[b])return!1;
return!0};this.getTokenTypeRegex=function(a){return new RegExp("(?:^|[.])"+a+"(?:$|[.])","")}}).call(k)});define("mode/xml",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");var g=a("ace/mode/text").Mode,n=a("ace/tokenizer").Tokenizer,h=a("mode/xml_highlight_rules").XmlHighlightRules,f=a("mode/xml_behavior").XmlBehaviour,d=a("mode/xml_fold_mode").FoldMode;a=function(){this.$tokenizer=new n((new h).getRules());this.$behaviour=new f;this.foldingRules=new d};l.inherits(a,g);(function(){this.getNextLineIndent=function(a,c,d){return this.$getIndent(c)}}).call(a.prototype);k.Mode=a});define("mode/xml_behavior",["require","exports","module"],function(a,k,l){function g(a,b){var c=!0,d=a.type.split(".");b.split(".").forEach(function(a){if(-1==d.indexOf(a))return c=!1});return c}l=a("ace/lib/oop");var n=a("ace/mode/behaviour").Behaviour,h=a("ace/mode/behaviour/cstyle").CstyleBehaviour,f=a("ace/token_iterator").TokenIterator;a=function(){this.inherit(h,["string_dquotes"]);this.add("autoclosing","insertion",function(a,b,c,e,h){if(">"==h){a=c.getCursorPosition();c=new f(e,a.row,a.column);
e=c.getCurrentToken();b=!1;if(e&&(g(e,"meta.tag")||g(e,"text")&&e.value.match("/")))b=!0;else{do e=c.stepBackward();while(e&&(g(e,"string")||g(e,"keyword.operator")||g(e,"entity.attribute-name")||g(e,"text")))}if(e&&g(e,"meta.tag-name")&&!c.stepBackward().value.match("/"))return c=e.value,b&&(c=c.substring(0,a.column-e.start)),{text:"></"+c+">",selection:[1,1]}}});this.add("autoindent","insertion",function(a,b,c,e,f){if("\n"==f&&(b=c.getCursorPosition(),"</"==e.doc.getLine(b.row).substring(b.column,
b.column+2)))return a=this.$getIndent(e.doc.getLine(b.row))+e.getTabString(),e=this.$getIndent(e.doc.getLine(b.row)),{text:"\n"+a+"\n"+e,selection:[1,a.length,1,a.length]}})};l.inherits(a,n);k.XmlBehaviour=a});define("mode/xml_fold_mode",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");var g=a("ace/lib/lang"),n=a("ace/range").Range,h=a("ace/mode/folding/fold_mode").FoldMode,f=a("ace/token_iterator").TokenIterator;a=k.FoldMode=function(a){h.call(this);this.voidElements=a||{}};l.inherits(a,h);(function(){this.getFoldWidget=function(a,b,c){a=this._getFirstTagInLine(a,c);return a.closing?"markbeginend"==b?"end":"":!a.tagName||this.voidElements[a.tagName.toLowerCase()]||a.selfClosing||-1!==
a.value.indexOf("/"+a.tagName)?"":"start"};this._getFirstTagInLine=function(a,b){for(var c=a.getTokens(b),d="",f=0;f<c.length;f++){var h=c[f];d=0===h.type.indexOf("meta.tag")?d+h.value:d+g.stringRepeat(" ",h.value.length)}return this._parseTag(d)};this.tagRe=/^(\s*)(<?(\/?)([-_a-zA-Z0-9:!]*)\s*(\/?)>?)/;this._parseTag=function(a){var b=this.tagRe.exec(a),c=this.tagRe.lastIndex||0;this.tagRe.lastIndex=0;return{value:a,match:b?b[2]:"",closing:b?!!b[3]:!1,selfClosing:b?!!b[5]||"/>"==b[2]:!1,tagName:b?
b[4]:"",column:b[1]?c+b[1].length:c}};this._readTagForward=function(a){var b=a.getCurrentToken();if(!b)return null;var c="",d;do if(0===b.type.indexOf("meta.tag")&&(d||(d={row:a.getCurrentTokenRow(),column:a.getCurrentTokenColumn()}),c+=b.value,-1!==c.indexOf(">")))return c=this._parseTag(c),c.start=d,c.end={row:a.getCurrentTokenRow(),column:a.getCurrentTokenColumn()+b.value.length},a.stepForward(),c;while(b=a.stepForward());return null};this._readTagBackward=function(a){var b=a.getCurrentToken();
if(!b)return null;var c="",d;do if(0===b.type.indexOf("meta.tag")&&(d||(d={row:a.getCurrentTokenRow(),column:a.getCurrentTokenColumn()+b.value.length}),c=b.value+c,-1!==c.indexOf("<")))return b=this._parseTag(c),b.end=d,b.start={row:a.getCurrentTokenRow(),column:a.getCurrentTokenColumn()},a.stepBackward(),b;while(b=a.stepBackward());return null};this._pop=function(a,b){for(;a.length;){var c=a[a.length-1];if(b&&c.tagName!=b.tagName)if(this.voidElements[b.tagName])break;else if(this.voidElements[c.tagName])a.pop();
else return null;else return a.pop()}};this.getFoldWidgetRange=function(a,b,c){var d=this._getFirstTagInLine(a,c);if(!d.match)return null;b=[];if(d.closing||d.selfClosing)for(a=new f(a,c,d.column+d.match.length),d={row:c,column:d.column};c=this._readTagBackward(a);){if(c.selfClosing)if(b.length)continue;else return c.start.column+=c.tagName.length+2,c.end.column-=2,n.fromPoints(c.start,c.end);if(c.closing)b.push(c);else if(this._pop(b,c),0==b.length)return c.start.column+=c.tagName.length+2,n.fromPoints(c.start,
d)}else for(a=new f(a,c,d.column),d={row:c,column:d.column+d.tagName.length+2};c=this._readTagForward(a);){if(c.selfClosing)if(b.length)continue;else return c.start.column+=c.tagName.length+2,c.end.column-=2,n.fromPoints(c.start,c.end);if(c.closing){if(this._pop(b,c),0==b.length)return n.fromPoints(d,c.start)}else b.push(c)}}}).call(a.prototype)});define("mode/xml_highlight_rules",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");var g=a("mode/xml_util");a=a("ace/mode/text_highlight_rules").TextHighlightRules;var n=function(){this.$rules={start:[{token:"text",regex:"<\\!\\[CDATA\\[",next:"cdata"},{token:"xml_pe",regex:"<\\?.*?\\?>"},{token:"comment",merge:!0,regex:"<\\!--",next:"comment"},{token:"xml_pe",regex:"<\\!.*?>"},{token:"meta.tag",regex:"<\\/?",next:"tag"},{token:"text",regex:"\\s+"},{token:"constant.character.entity",
regex:"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"},{token:"text",regex:"[^<]+"}],cdata:[{token:"text",regex:"\\]\\]>",next:"start"},{token:"text",regex:"\\s+"},{token:"text",regex:"(?:[^\\]]|\\](?!\\]>))+"}],comment:[{token:"comment",regex:".*?--\x3e",next:"start"},{token:"comment",merge:!0,regex:".+"}]};g.tag(this.$rules,"tag","start")};l.inherits(n,a);k.XmlHighlightRules=n});define("mode/xml_util",["require","exports","module"],function(a,k,l){function g(a,g){return[{token:"string",merge:!0,regex:".*?"+a,next:g},{token:"string",merge:!0,regex:".+"}]}k.tag=function(a,h,f,d){a[h]=[{token:"text",regex:"\\s+"},{token:function(a){return d&&d[a]?"meta.tag.tag-name."+d[a]:"meta.tag.tag-name"},merge:!0,regex:"[-_a-zA-Z0-9:]+",next:h+"_embed_attribute_list"},{token:"empty",regex:"",next:h+"_embed_attribute_list"}];a[h+"_qstring"]=g("'",h+"_embed_attribute_list");a[h+"_qqstring"]=
g('"',h+"_embed_attribute_list");a[h+"_embed_attribute_list"]=[{token:"meta.tag",merge:!0,regex:"/?>",next:f},{token:"keyword.operator",regex:"="},{token:"entity.other.attribute-name",regex:"[-_a-zA-Z0-9:]+"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"text",regex:"\\s+"}].concat([{token:"string",regex:'".*?"'},{token:"string",merge:!0,regex:'["].*',next:h+"_qqstring"},{token:"string",regex:"'.*?'"},{token:"string",merge:!0,regex:"['].*",next:h+"_qstring"}])}});define("mode/yaml",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");var g=a("ace/mode/text").Mode,n=a("mode/yaml_highlight_rules").YamlHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,f=a("ace/mode/folding/coffee").FoldMode;a=function(){this.HighlightRules=n;this.$outdent=new h;this.foldingRules=new f;this.$behaviour=this.$defaultBehaviour};l.inherits(a,g);(function(){this.lineCommentStart="#";this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b);
"start"==a&&b.match(/^.*[\{\(\[]\s*$/)&&(d+=c);return d};this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)};this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)};this.$id="mode/yaml"}).call(a.prototype);k.Mode=a});define("mode/yaml_highlight_rules",["require","exports","module"],function(a,k,l){l=a("ace/lib/oop");a=a("ace/mode/text_highlight_rules").TextHighlightRules;var g=function(){this.$rules={start:[{token:["whitespace","comment"],regex:"(^|\\s+)(#.*)$"},{token:"list.markup",regex:/^(?:-{3}|\.{3})\s*(?=#|$)/},{token:"list.markup",regex:/^\s*[\-?](?:$|\s)/},{token:"constant",regex:"!![\\w//]+"},{token:"constant.language",regex:"[&\\*][a-zA-Z0-9-_]+"},{token:["meta.tag","keyword","meta.tag","keyword"],regex:/^(\s*\w.*?)(:{2,3})(\s*\w.*?)(:(?:\s+|$))/},
{token:["meta.tag","keyword"],regex:/^(\s*\w.*?)(:(?:\s+|$))/},{token:["meta.tag","keyword"],regex:/(\w+?)(\s*:(?:\s+|$))/},{token:"keyword.operator",regex:"<<\\w*:\\w*"},{token:"keyword.operator",regex:"-\\s*(?=[{])"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",regex:/[|>][-+\d\s]*$/,onMatch:function(a,g,f,d){a=/^\s*/.exec(d)[0];f.length=2;f[0]=g;f[1]=a.length;return this.token},next:"mlString"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"constant.numeric",
regex:/(\b|[+\-\.])[\d_]+(?:(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)/},{token:"constant.numeric",regex:/[+\-]?\.inf\b|NaN\b|0x[\dA-Fa-f_]+|0b[10_]+/},{token:"constant.language.boolean",regex:"\\b(?:true|false|TRUE|FALSE|True|False|yes|no)\\b"},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"}],mlString:[{token:"indent",regex:/^\s*$/},{token:"indent",regex:/^\s*/,onMatch:function(a,g,f){f[1]>=a.length?(this.next=f[0],f.splice(0)):this.next=g;return this.token},next:"mlString"},
{token:"string",regex:".+"}]};this.normalizeRules()};l.inherits(g,a);k.YamlHighlightRules=g});define("theme/default",["require","exports","module"],function(a,k,l){a("ace/lib/dom");k.cssClass="ace-rs"});if(!String.prototype.trimRight){var trimEndRegexp=/\s\s*$/;String.prototype.trimRight=function(){return String(this).replace(trimEndRegexp,"")}}
define("rstudio/loader",["require","exports","module"],function(a,k,l){var g=a("ace/edit_session").EditSession,n=a("ace/editor").Editor;a("ace/lib/event_emitter");a("util/expand_selection");var h=a("ace/range").Range,f=a("ace/virtual_renderer").VirtualRenderer,d=a("ace/mode/text").Mode,b=a("ace/undomanager").UndoManager,c=a("mode/utils");a("ace/lib/event");l=a("ace/lib/oop");a("mixins/token_iterator");var e=function(a,b){n.call(this,a,b);this.setBehavioursEnabled(!0)};l.inherits(e,n);(function(){this.$highlightBrackets=
function(){this.session.$bracketHighlight&&(this.session.removeMarker(this.session.$bracketHighlight),this.session.$bracketHighlight=null);this.session.selection.isEmpty()&&n.prototype.$highlightBrackets.call(this)};this.insert=function(a,b){if(!this.session.selection.isEmpty()){var d=[];"quotes"===this.$surroundSelection?d=["'",'"',"`"]:"quotes_and_brackets"===this.$surroundSelection&&(d="'\"`({[".split(""));if("quotes_and_brackets"===this.$surroundSelection){var e=this.session.$mode;if(/\/markdown$/.test(e.$id))d.push("*",
"_");else{var f=this.getCursorPosition();e.getLanguageMode&&"Markdown"===e.getLanguageMode(f)&&d.push("*","_")}}if(c.contains(d,a))return d=c.getComplement(a),this.session.replace(this.session.selection.getRange(),a+this.session.getTextRange()+d)}return n.prototype.insert.call(this,a,b)};this.remove=function(a){return this.session.getMode().wrapRemove?this.session.getMode().wrapRemove(this,n.prototype.remove,a):n.prototype.remove.call(this,a)};this.undo=function(){n.prototype.undo.call(this);this._dispatchEvent("undo")};
this.redo=function(){n.prototype.redo.call(this);this._dispatchEvent("redo")};this.onPaste=function(a,b){n.prototype.onPaste.call(this,a.replace(/\r\n|\n\r|\r/g,"\n"),b)}}).call(e.prototype);var t=function(a,b){g.call(this,a,b)};l.inherits(t,g);(function(){this.insert=function(a,b){return this.getMode().wrapInsert?this.getMode().wrapInsert(this,g.prototype.insert,a,b):g.prototype.insert.call(this,a,b)};this.reindent=function(a){var b=this.getMode();if(b.getNextLineIndent){var d=a.start.row;a=a.end.row;
0===d&&(this.applyIndent(0,""),d++);for(var e=d;e<=a;e++){var f=c.getPrimaryState(this,e-1);if(!c.endsWith(f,"qstring")){var g=b.getNextLineIndent(f,this.getLine(e-1),this.getTabString(),e-1,!0);this.applyIndent(e,g);b.autoOutdent(f,this,e)}}b=b.codeModel;"undefined"!==typeof b&&(b=b.alignContinuationSlashes,"undefined"!==typeof b&&b(this.getDocument(),{start:d,end:a}))}};this.applyIndent=function(a,b){var c=this.getLine(a).match(/^\s*/g)[0].length;this.replace(new h(a,0,a,c),b)};this.setDisableOverwrite=
function(a){a?(this.setOverwrite(!1),this.setOverwrite=function(){},this.getOverwrite=function(){return!1}):(this.setOverwrite=g.prototype.setOverwrite,this.getOverwrite=g.prototype.getOverwrite)}}).call(t.prototype);var q=function(){b.call(this)};l.inherits(q,b);(function(){this.peek=function(){return this.$undoStack.length?this.$undoStack[this.$undoStack.length-1]:null}}).call(q.prototype);var p=function(a,b){f.call(this,a,b)};l.inherits(p,f);(function(){this.setTheme=function(a){a&&f.prototype.setTheme.call(this,
a)}}).call(p.prototype);k.RStudioEditor=e;k.loadEditor=function(b){function c(a){f.editor.commands.removeCommand(a)}var f={};b.env=f;b=new p(b,"");var g=new t("");b=new e(b,g);f.editor=b;g=b.getSession();g.setMode(new d);g.setUndoManager(new q);b=a("ace/config");b.set("basePath","ace");b.set("workerPath","js/workers");b.setDefaultValue("session","useWorker",!1);c("findnext");c("findprevious");c("find");c("replace");c("togglecomment");c("gotoline");c("foldall");c("unfoldall");return f.editor}});define("rstudio/snippets",["require","exports","module"],function(a,k,l){k.toSnippetText=function(a){for(var g=a.length,h="",f=0;f<g;f++){var d=a[f];h+="snippet "+d.name+"\n\t"+d.content.replace(/\n/g,"\n\t")+"\n\n"}return h};k.normalizeSnippets=function(a){for(var g=a.length,h=0;h<g;h++){var f=a[h];null==f.tabTrigger&&(f.tabTrigger=f.name);f.content=f.content.replace("\n    ","\n\t")}}});define("rstudio/snippets/c_cpp",["require","exports","module"],function(a,k,l){l=a("rstudio/snippets");a=a("ace/snippets").snippetManager;var g=[{name:"once",content:"#ifndef ${1:`HeaderGuardFileName`}\n#define ${1:`HeaderGuardFileName`}\n\n${0}\n\n#endif /* ${1:`HeaderGuardFileName`} */"},{name:"ans",content:"namespace {\n${0}\n} // anonymous namespace"},{name:"ns",content:"namespace ${1:ns} {\n${0}\n} // namespace ${1:ns}"},{name:"cls",content:"class ${1:ClassName} {\npublic:\n    ${2}\nprivate:\n    ${3}\n};"},
{name:"str",content:"struct ${1} {\n    ${0}\n};"},{name:"ept",content:"// [[Rcpp::export]]\n"}];l.normalizeSnippets(g);k.snippetText=l.toSnippetText(g);a.register(g,"c_cpp")});define("rstudio/snippets/markdown",["require","exports","module"],function(a,k,l){l=a("rstudio/snippets");a=a("ace/snippets").snippetManager;var g=[{name:"[",content:"[${1:label}](${2:location})"},{name:"![",content:"![${1:label}](${2:location})"},{name:"r",content:"```{r ${1:label}, ${2:options}}\n${0}\n```"},{name:"rcpp",content:"```{r, engine='Rcpp'}\n#include <Rcpp.h>\nusing namespace Rcpp;\n\n${0}\n\n```"}];l.normalizeSnippets(g);k.snippetText=l.toSnippetText(g);a.register(g,"markdown")});define("rstudio/snippets/r",["require","exports","module"],function(a,k,l){l=a("rstudio/snippets");a=a("ace/snippets").snippetManager;var g=[{name:"lib",content:"library(${1:package})"},{name:"req",content:"require(${1:package})"},{name:"src",content:'source("${1:file.R}")'},{name:"ret",content:"return(${1:code})"},{name:"mat",content:"matrix(${1:data}, nrow = ${2:rows}, ncol = ${3:cols})"},{name:"sg",content:'setGeneric("${1:generic}", function(${2:x, ...}) {\n    standardGeneric("${1:generic}")\n})'},
{name:"sm",content:'setMethod("${1:generic}", ${2:class}, function(${2:x, ...}) {\n    ${0}\n})'},{name:"sc",content:'setClass("${1:Class}", slots = c(${2:name = "type"}))'},{name:"if",content:"if (${1:condition}) {\n    ${0}\n}"},{name:"el",content:"else {\n    ${0}\n}"},{name:"ei",content:"else if (${1:condition}) {\n    ${0}\n}"},{name:"fun",content:"${1:name} <- function(${2:variables}) {\n    ${0}\n}"},{name:"for",content:"for (${1:variable} in ${2:vector}) {\n    ${0}\n}"},{name:"while",content:"while (${1:condition}) {\n    ${0}\n}"},
{name:"switch",content:"switch (${1:object},\n    ${2:case} = ${3:action}\n)"},{name:"apply",content:"apply(${1:array}, ${2:margin}, ${3:...})"},{name:"lapply",content:"lapply(${1:list}, ${2:function})"},{name:"sapply",content:"sapply(${1:list}, ${2:function})"},{name:"mapply",content:"mapply(${1:function}, ${2:...})"},{name:"tapply",content:"tapply(${1:vector}, ${2:index}, ${3:function})"},{name:"vapply",content:"vapply(${1:list}, ${2:function}, FUN.VALUE = ${3:type}, ${4:...})"},{name:"rapply",
content:"rapply(${1:list}, ${2:function})"},{name:"ts",content:'`r paste("#", date(), "------------------------------\\n")`'},{name:"shinyapp",content:"library(shiny)\n\nui <- fluidPage(\n  ${0}\n)\n\nserver <- function(input, output, session) {\n  \n}\n\nshinyApp(ui, server)"},{name:"shinymod",content:"${1:name}UI <- function(id) {\n  ns <- NS(id)\n  tagList(\n    ${0}\n  )\n}\n\n${1:name}Server <- function(id) {\n  moduleServer(\n    id,\n    function(input, output, session) {\n      \n    }\n  )\n}"}];
l.normalizeSnippets(g);k.snippetText=l.toSnippetText(g);a.register(g,"r")});define("rstudio/snippets/stan",["require","exports","module"],function(a,k,l){l=a("rstudio/snippets");a=a("ace/snippets").snippetManager;var g=[{name:"for",content:"for (${1:var} in ${2:start}:${3:end}) {\n  ${0}\n}"},{name:"if",content:"if (${1:condition}) {\n  ${0}\n}"},{name:"el",content:"else (${1:condition}) {\n  ${0}\n}"},{name:"ei",content:"else if (${1:condition}) {\n  ${0}\n}"},{name:"<l",content:"<lower = ${1:expression}>${0}"},{name:"<u",content:"<upper = ${1:expression}>${0}"},{name:"<lu",
content:"<lower = ${1:expression}, upper = ${2:expression}>${0}"},{name:"while",content:"while (${1:condition}) {\n  ${0}\n}"},{name:"gen",content:"generated quantities {\n  ${0}\n}"},{name:"mdl",content:"model {\n  ${0}\n}"},{name:"par",content:"parameters {\n  ${0}\n}"},{name:"tpar",content:"transformed parameters {\n  ${0}\n}"},{name:"data",content:"data {\n  ${0}\n}"},{name:"tdata",content:"transformed data {\n  ${0}\n}"},{name:"ode",content:"integrate_ode(${1:function}, ${2:y0}, ${3:t0}, ${4:t}, ${5:theta}, ${6:x_r}, ${7:x_i});"},
{name:"funs",content:"functions {\n  ${0}\n}"},{name:"fun",content:"${1:return} ${2:name} (${3:args}) {\n  ${0}\n}"}];l.normalizeSnippets(g);k.snippetText=l.toSnippetText(g);a.register(g,"stan")});define("rstudio/snippets/yaml",["require","exports","module"],function(a,k,l){l=a("rstudio/snippets");a=a("ace/snippets").snippetManager;var g=[{name:"key",content:"${1:key}: ${2:value}"},{name:"list",content:"${1:key}:\n  - ${2:value1}\n  - ${3:value2}"}];l.normalizeSnippets(g);k.snippetText=l.toSnippetText(g);a.register(g,"yaml")});