define("mixins/token_iterator",["require","exports","module"],function(a,m,k){var h=a("ace/token_iterator").TokenIterator,p=a("ace/range").Range;(function(){function a(b,a){return 1===b.length&&("{"===b||"("===b||"["===b||!!a&&"<"===b)}function n(b,a){return 1===b.length&&("}"===b||")"===b||"]"===b||!!a&&">"===b)}function d(b,a,e,d,c){for(var l=1,q,g=b.clone();q=e.call(g);)if(q=a(q),q===c){if(l--,0===l)return b.moveToTokenIterator(g),!0}else q===d&&l++;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,r=0;this.tokenizeUpToRow=function(b){var a=this.$session.bgTokenizer;e=Math.min(e,a.currentLine);r=Math.max(r,b);for(var d=a.currentLine;d<=b;d++)a.$tokenizeRow(d);clearTimeout(c);c=setTimeout(function(){a.fireUpdateEvent(e,r);e=r;r=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 h(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 p.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 n(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(h.prototype)});define("ace/token_tooltip",["require","exports","module"],function(a,m,k){function h(a){a.tokenTooltip||(n.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),p.addListener(a.renderer.scroller,"mousemove",this.onMouseMove),p.addListener(a.renderer.content,"mouseout",this.onMouseOut))}a("ace/lib/dom");k=a("ace/lib/oop");var p=a("ace/lib/event"),f=a("ace/range").Range,n=a("ace/tooltip").Tooltip;
k.inherits(h,n);(function(){this.token={};this.range=new f;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 f(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;n.prototype.setPosition.call(this,a+10,b+20)};this.destroy=function(){this.onMouseOut();p.removeListener(this.editor.renderer.scroller,"mousemove",this.onMouseMove);p.removeListener(this.editor.renderer.content,"mouseout",this.onMouseOut);delete this.editor.tokenTooltip}}).call(h.prototype);m.TokenTooltip=h});define("mode/auto_brace_insert",["require","exports","module"],function(a,m,k){var h=a("ace/range").Range,p=a("ace/mode/text").Mode;(function(){this.$complements={"(":")","[":"]",'"':'"',"{":"}"};this.$reOpen=/^[(["{]$/;this.$reClose=/^[)\]"}]$/;this.$reStop=/^[;,\s)\]}]$/;this.wrapInsert=function(a,n,d,b){if(!this.insertMatching)return n.call(a,d,b);var c=a.selection.getCursor();if(c=a.selection.isEmpty()&&d.row==c.row&&d.column==c.column){var e=h.fromPoints(d,{row:d.row,column:d.column+1}),f=a.doc.getTextRange(e);
if(this.$reClose.test(f)&&f==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(h.fromPoints(e,d)));n=n.call(a,d,b);c&&this.$reOpen.test(b)?(d=h.fromPoints(n,{row:n.row,column:n.column+1}),d=a.doc.getTextRange(d),(this.$reStop.test(d)||0==d.length)&&this.allowAutoInsert(a,n,this.$complements[b])&&(a.doc.insert(n,this.$complements[b]),a.selection.moveCursorTo(n.row,n.column,!1))):c&&"\n"===b&&(b=this.$moveRight(a.doc,n),b=a.doc.getTextRange(h.fromPoints(n,
b)),"{"===e&&"}"===b||"("===e&&")"===b||"["===e&&"]"===b)&&(d=this.getIndentForOpenBrace?this.getIndentForOpenBrace(this.$moveLeft(a.doc,d)):this.$getIndent(a.doc.getLine(n.row-1)),a.doc.insert(n,"\n"+d),a.selection.moveCursorTo(n.row,n.column,!1));return n};this.allowAutoInsert=function(a,n,d){return!0};this.smartAllowAutoInsert=function(a,n,d){return"'"!==d&&'"'!==d&&"`"!==d?!0:"`"===d?(n=a.doc.getTextRange({start:{row:n.row,column:0},end:n}),n=n.replace(/\\./g,""),0!=n.match(/`/g).length%2):0==
n.column?!0:(a=this.codeModel.getTokenForPos(n,!1,!0))&&"string"===a.type&&a.column===n.column-1};this.wrapRemove=function(a,n,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 n.call(a,d);var e=h.fromPoints(this.$moveLeft(c,b),b);b=h.fromPoints(b,this.$moveRight(c,b));e=c.getTextRange(e);c=this.$reOpen.test(e)&&this.$complements[e]==c.getTextRange(b);n.call(a,d);
c&&n.call(a,"right")};this.$moveLeft=function(a,n){if(0==n.row&&0==n.column)return n;var d=n.row,b=n.column;b?b--:(d--,b=a.getLine(d).length);return{row:d,column:b}};this.$moveRight=function(a,n){var d=n.row,b=n.column;a.getLine(d).length!=b?b++:(d++,b=0);return d>=a.getLength()?n:{row:d,column:b}}}).call(p.prototype);m.setInsertMatching=function(a){p.prototype.insertMatching=a}});define("mode/c_cpp",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");var h=a("ace/mode/text").Mode,p=a("ace/tokenizer").Tokenizer,f=a("ace/range").Range;a("mode/r_highlight_rules");var n=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,r=a("mode/r_matching_brace_outdent").RMatchingBraceOutdent,
q=a("mode/cpp_code_model").CppCodeModel;a("mode/token_cursor");var g=a("mode/utils");a=function(a,g){this.$session=g;this.$doc=g.getDocument();this.$tokenizer=new p((new n).getRules());this.r_codeModel=new e(g,this.$tokenizer,/^r-/,/^\s*\/\*{3,}\s*([Rr])\s*$/,/^\s*\*+\//);this.$r_outdent=new r(this.r_codeModel);this.codeModel=new q(g,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};k.inherits(a,h);(function(){this.wrapInsert=function(a,b,e,d){return this.cursorInRLanguageMode()?h.prototype.wrapInsert(a,b,e,d):b.call(a,e,d)};this.wrapRemove=function(a,b,e){return this.cursorInRLanguageMode()?h.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 l=e;l<=
d;l++)if(!a.test(b.getLine(l))){c=!1;break}if(c)for(c=new f(0,0,0,0),l=e;l<=d;l++)e=b.getLine(l).match(a),c.start.row=l,c.end.row=l,c.end.column=e[0].length,b.replace(c,e[1]);else b.indentRows(e,d,"//")};this.getLanguageMode=function(a){return g.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=g.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=g.primaryState(a);if(!this.inRLanguageMode(a))return this.$transformAction(a,b,e,d,c)};this.$id="mode/c_cpp"}).call(a.prototype);m.Mode=a});define("mode/c_cpp_fold_mode",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");var h=a("ace/range").Range;a=a("ace/mode/folding/fold_mode").FoldMode;m=m.FoldMode=function(){};k.inherits(m,a);(function(){function a(a,d,e,n){a=a.doc.$lines;for(var b=d+n,c=a[b],l=0<n?"*/":"/*",f;null!=c;){var r=c.indexOf(l);if(-1!==r){f=0<n?new h(d,e,b,r):new h(b,c.length,d,e);break}b+=n;c=a[b]}return f}function f(a,d,e,n,q){for(var b=d+q,c=a.doc.$lines;0<=b&&b<a.getLength();){for(var f=a.getTokens(b),
r=c[b],p=0;p<f.length;p++)if(f[p].type===n)return 0<q?new h(d,e,b,0):new h(b,r.length,d,e);b+=q}}var n=/(\{|\[)[^\}\]]*$/,d=/^[^\[\{]*(\}|\])/;this.getFoldWidget=function(a,c,e){c="markbeginend"===c?"end":"";e=a.getLine(e);if(n.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 h=b.getLine(e),q;if(q=h.match(n))return this.openingBracketBlock(b,q[1],e,q.index);if(q=
"markbeginend"===c&&h.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 g=c[q];if("support.function.codebegin"===g.type)return f(b,e,h.length,"support.function.codeend",1);if("support.function.codeend"===g.type)return f(b,e,0,"support.function.codebegin",-1)}c=h.indexOf("/*");if(-1!==c)return a(b,e,h.length,1);c=h.indexOf("*/");if(-1!==c)return a(b,e,c,-1)}}).call(m.prototype)});define("mode/c_cpp_highlight_rules",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");var h=a("ace/lib/lang"),p=a("mode/doc_comment_highlight_rules").DocCommentHighlightRules,f=a("ace/mode/text_highlight_rules").TextHighlightRules,n=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=h.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(" ")),
f=h.arrayToMap(["NULL"]),q="new delete >>= <<= ->* ... << >> && || == != <= >= :: *= += -= /= ++ -- &= ^= %= -> .* ! $ & | + - * / ^ ~ = %".split(" "),g=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:"\\/\\/.*$"},p.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":f.hasOwnProperty(a)?"constant.language":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",merge:!1,regex:g},{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"}]};g=(new n("comment")).getRules();for(q=0;q<g.start.length;q++)g.start[q].token+=".virtual-comment";this.addRules(g,"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(p,"doc-",[p.getEndRule("start")]);this.$rules.start.unshift({token:"support.function.codebegin",regex:"^\\s*\\/\\*{3,}\\s*[Rr]\\s*$",next:"r-start"});g=(new d).getRules();this.addRules(g,"r-");this.$rules["r-start"].unshift({token:"support.function.codeend",regex:"\\*\\/",next:"start"})};k.inherits(a,f);m.c_cppHighlightRules=
a});define("mode/c_cpp_matching_brace_outdent",["require","exports","module"],function(a,m,k){var h=a("ace/range").Range,p=a("mode/token_cursor").CppTokenCursor;k=function(a){this.codeModel=a};var f=a("mode/utils"),n=!0,d=!0,b=!0,c=!0,e=!0,r=!0,q=!0,g=!0,l=!0,w=!0,z=!0,x=!0;(function(){this.setIndent=function(a,b,e,d,c){a=a.getDocument();d="string"===typeof d?d:"";var l=a.$lines[e];e=this.$getIndent(a.$lines[b]);l=this.$getIndent(l);("function"!==typeof c||c(e,l))&&a.replace(new h(b,0,b,e.length),l+d)};
this.checkOutdent=function(a,b,e){return f.endsWith(a,"start")&&(":"===e||/^\s*[#\{\}>\]\)<.:]/.test(e)||"="===e)||f.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 h(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 l=d.indexOf("=");if(-1!==c&&-1!==l&&/,\s*$/.test(d)){a=a.getDocument();e=this.$getIndent(e);if(e.length>=l)return!1;c=l-c;if(0>=c)return!1;c=Array(e.length+c+1).join(" ");a.replace(new h(b,0,b,e.length),c);return!0}return!1};this.autoOutdent=function(a,g,v){a=g.doc;var y=a.getLine(v),B=null;0<v&&(B=a.getLine(v-1));if(!w||!this.alignStartToken("<<",g,v,y,B))if(!l||!this.alignStartToken(">>",
g,v,y,B))if(!q||!this.alignStartToken(".",g,v,y,B)){if(n&&/^\s*:/.test(a.getLine(v))&&!/^\s*::/.test(a.getLine(v))&&this.codeModel.$tokenUtils.$tokenizeUpToRow(v)){var m=new p(this.codeModel.$tokens,v,0),k=-1,t=m.cloneCursor();if(")"===t.peekBwd().currentValue()||"keyword"===t.peekBwd().currentType()){do{m=t.currentType();var A=t.currentValue();if("identifier"===m||";"===A){k=t.$row;break}"keyword"!==m&&t.bwdToMatchingToken()}while(t.moveToPreviousToken())}else m.moveToPreviousToken(),m.bwdOverClassySpecifiers()&&
(k=m.$row);0<=k&&this.setIndent(g,v,k,g.getTabString(),function(a,b){return a===b})}if(r&&/^\s*>/.test(y)&&!/^\s*>>/.test(y)&&(k=this.codeModel.getRowForMatchingEOLArrows(g,a,v),0<=k)){this.setIndent(g,v,k);return}if(c&&/^\s*\}/.test(y)&&(k=g.findMatchingBracket({row:v,column:y.indexOf("}")+1}),null!==k)){if(/^\s*\{/.test(a.$lines[k.row])){this.setIndent(g,v,k.row);return}k=this.codeModel.getRowForOpenBraceIndent(g,k.row);if(0<=k){this.setIndent(g,v,k);return}}if(d&&/^\s*\)/.exec(y)&&(k=g.findMatchingBracket({row:v,
column:y.indexOf(")")+1}))){this.setIndent(g,v,k.row);return}if(e&&/^\s*\]/.exec(y)&&(k=g.findMatchingBracket({row:v,column:y.indexOf("]")+1}))){this.setIndent(g,v,k.row);return}if(z&&/^\s*public\s*:\s*$|^\s*private\s*:\s*$|^\s*protected\s*:\s*$/.test(y)&&(t=g.$findOpeningBracket("}",{row:v,column:y.length},f.getTokenTypeRegex("paren")))){k=this.codeModel.getRowForOpenBraceIndent(g,t.row);0<=k?this.setIndent(g,v,k):this.setIndent(g,v,t.row);return}if(x&&(/^\s*case.+:/.test(y)||/^\s*default\s*:/.test(y))&&
(t=g.$findOpeningBracket("}",{row:v,column:/(\S)/.exec(y).index+1},f.getTokenTypeRegex("paren")))){k=this.codeModel.getRowForOpenBraceIndent(g,t.row);0<=k?this.setIndent(g,v,k):this.setIndent(g,v,t.row);return}if(b&&/^\s*\{/.test(y)&&!/;\s*$/.test(B)){if(this.codeModel.$tokenUtils.$tokenizeUpToRow(v)&&(m=new p(this.codeModel.$tokens),m.$row=v,m.$offset=0,m.moveToPreviousToken()&&"="===m.currentValue()))return;B=this.codeModel.getRowForOpenBraceIndent(g,v);if(0<=B){this.setIndent(g,v,B);return}}/^\s*#/.test(y)&&
(g=this.$getIndent(y),a.replace(new h(v,0,v,g.length),""))}};this.$getIndent=function(a){return(a=a.match(/^(\s+)/))?a[1]:""}}).call(k.prototype);m.CppMatchingBraceOutdent=k;m.getOutdentColon=function(){return n};m.setOutdentColon=function(a){n=a};m.getOutdentRightParen=function(){return d};m.setOutdentRightParen=function(a){d=a};m.getOutdentLeftBrace=function(){return b};m.setOutdentLeftBrace=function(a){b=a};m.getOutdentRightBrace=function(){return c};m.setOutdentRightBrace=function(a){c=a};m.getOutdentRightBracket=
function(){return e};m.setOutdentRightBracket=function(a){e=a};m.getOutdentRightArrow=function(){return r};m.setOutdentRightArrow=function(a){r=a};m.getAlignDots=function(){return q};m.setAlignDots=function(a){q=a};m.getAlignEquals=function(){return g};m.setAlignEquals=function(a){g=a};m.getAlignStreamIn=function(){return l};m.setAlignStreamIn=function(a){l=a};m.getAlignStreamOut=function(){return w};m.setAlignStreamOut=function(a){w=a};m.getAlignClassAccessModifiers=function(){return z};m.setAlignClassAccessModifiers=
function(a){z=a};m.getAlignCase=function(){return x};m.setAlignCase=function(a){x=a}});define("mode/behaviour/cstyle",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");var h=a("ace/mode/behaviour").Behaviour;a("mode/cpp_code_model");a("mode/token_cursor");a("ace/mode/text");var p=a("mode/utils"),f=!0;a=function(a){var d=a.$complements,b=function(a,b,c,g){var e=d[a];if(b==a)return b=c.getSelectionRange(),g=g.doc.getTextRange(b),""!==g?{text:a+g+e,selection:!1}:{text:a+e,selection:[1,1]};if(b==e&&(a=c.getCursorPosition(),g.doc.getLine(a.row)[a.column]==e&&(">"===e||null!==
g.findMatchingBracket({row:a.row,column:a.column+1}))))return{text:"",selection:[1,1]}},c=function(a,b,c){var e=d[a],l=c.doc.getTextRange(b);if(!b.isMultiLine()&&l==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,l){if("R"===l||"r"===l)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,g,l){if("\n"===l){var e=c.getCursorPosition();l=e.row;var n=e.column;d=g.getTabString();var f=g.doc.$lines;c=f[l];if(!this.codeModel.inMacro(f,l-1)){var q=/^(\s*\/\/'\s*)/.exec(c);if(q&&n>=q[1].length)return{text:"\n"+q[1]};if(/^\s*[/][*]+\s*$/.test(c)&&!/^\s*[*]/.test(f[l+1]||""))return g=this.$getIndent(c),d=g+" * ",{text:"\n"+d+"\n"+g+" */",selection:[1,d.length,1,d.length]};if(p.endsWith(b,"comment")||p.endsWith(b,"doc-start")){e&&e.row==l&&(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=n-1;/\s/.test(c[b]);)--b;b=c[b];n=c[n];if(q=c.match(/\s*namespace\s*\w*\s*{/))return g=this.$getIndent(c),{text:"\n"+g,selection:[1,g.length,1,g.length]};if("("==b&&")"==n||"["==b&&"]"==n)return c=this.$getIndent(c),g=c+d,{text:"\n"+g+"\n"+c,selection:[1,g.length,1,g.length]};if("{"==b&&"}"==n){if(/^\s*{/.test(c))return c=this.$getIndent(c),
g=c+g.getTabString(),{text:"\n"+g+"\n"+c,selection:[1,g.length,1,g.length]};l=a.getRowForOpenBraceIndent(g,l);if(null!==l&&0<=l)return c=this.$getIndent(g.getDocument().getLine(l)),g=c+g.getTabString(),{text:"\n"+g+"\n"+c,selection:[1,g.length,1,g.length]};c=this.$getIndent(c);g=c+d;return{text:"\n"+g+"\n"+c,selection:[1,g.length,1,g.length]}}}}});this.add("braces","insertion",function(a,d,c,g,l){if(this.insertMatching){if("{"==l&&(a=c.getSelectionRange(),""===g.doc.getTextRange(a))){a=this.codeModel.getTokenCursor();
if(!a.moveToPosition(c.getCursorPosition()))return b("{",l,c,g);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(f&&"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("{",l,c,
g)}});this.add("braces","deletion",function(a,b,d,c,l){if(this.insertMatching&&(a=c.doc.getTextRange(l),!l.isMultiLine()&&"{"==a)){a=c.doc.getLine(l.start.row);if(/^\s*do\s*\{\} while \(\);\s*$/.test(a))return l.end.column=a.length,l;c=a.substring(l.end.column,l.end.column+1);a=a.substring(l.end.column+1,l.end.column+2);if("}"==c)return l.end.column++,";"==a&&l.end.column++,l}});this.add("parens","insertion",function(a,d,c,g,l){if(this.insertMatching)return b("(",l,c,g)});this.add("parens","deletion",
function(a,b,d,g,l){if(this.insertMatching)return c("(",l,g)});this.add("brackets","insertion",function(a,d,c,g,l){if(this.insertMatching)return b("[",l,c,g)});this.add("brackets","deletion",function(a,b,d,g,l){if(this.insertMatching)return c("[",l,g)});this.add("arrows","insertion",function(a,d,c,g,l){if(this.insertMatching&&(a=g.getLine(c.getCursorPosition().row),/^\s*#\s*include/.test(a)))return b("<",l,c,g)});this.add("arrows","deletion",function(a,b,d,g,l){if(this.insertMatching)return c("<",
l,g)});this.add("string_dquotes","insertion",function(a,b,d,c,l){if(this.insertMatching&&('"'==l||"'"==l)){a=d.getSelectionRange();b=c.doc.getTextRange(a);if(""!==b)return{text:l+b+l,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,g,n=-1,f=0;f<c.length;f++){g=c[f];"string"==g.type?n=-1:0>n&&(n=g.value.indexOf(l));if(g.value.length+e>a.start.column)break;e+=c[f].value.length}if(!g||0>n&&"comment"!==
g.type&&("string"!==g.type||a.start.column!==g.value.length+e-1&&g.value.lastIndexOf(l)===g.value.length-1))return{text:l+l,selection:[1,1]};if(g&&"string"===g.type&&b.substring(d.column,d.column+1)==l)return{text:"",selection:[1,1]}}});this.add("string_dquotes","deletion",function(a,b,d,c,l){if(this.insertMatching&&(a=c.doc.getTextRange(l),!l.isMultiLine()&&('"'==a||"'"==a)&&(c=c.doc.getLine(l.start.row).substring(l.start.column+1,l.start.column+2),'"'===c||"'"===c)))return l.end.column++,l});this.add("punctuation.operator",
"insertion",function(a,b,d,c,l){if(this.insertMatching&&";"===l&&(a=d.selection.getCursor(),";"==c.getLine(a.row)[a.column]))return{text:"",selection:[1,1]}});this.add("macro","insertion",function(a,b,d,c,l){b=d.getPrintMarginColumn();b=Math.min(62,b);var e=c.getDocument().$lines,n=d.getCursorPosition(),g=n.row,f=e[g];d=f.substring(0,n.column);if(/^\s*#\s*define[^\\]*$/.test(f)&&"\\"==l)return a=b-d.length+1,0<=a?{text:Array(a+1).join(" ")+"\\\n"+this.$getIndent(f)+c.getTabString(),selection:!1}:
{text:"\\\n"+c.getTabString(),selection:!1};if(/^\s*#\s*define/.test(f)||this.codeModel.inMacro(e,g-1)){if("\\"==l&&/^\s*$/.test(f.substring(d.length,f.length)))return a=b-d.length+1,0<=a?{text:Array(a+1).join(" ")+"\\",selection:!1}:{text:"\\",selection:!1};if("\n"==l){if(/^\s*$/.test(f)||/^\s*#\s*define/.test(f)&&!/\\\s*$/.test(f))return{text:"\n",selection:!1};if(/\\\s*$/.test(f)&&!/\\\s*$/.test(d))return{text:"",selection:[1,n.column,1,n.column]};c=c.getMode().getNextLineIndent(a,f+"\\",c.getTabString(),
g,!1);a=b-d.length+1;l=/\\\s*$/.test(d)?"":"\\";return 0<=a?{text:Array(a+1).join(" ")+l+"\n"+c,selection:!1}:{text:l+"\n"+c,selection:!1}}}})};k.inherits(a,h);m.CStyleBehaviour=a;m.setFillinDoWhile=function(a){f=a};m.getFillinDoWhile=function(){return f}});define("mode/cpp_code_model",["require","exports","module"],function(a,m,k){a("ace/lib/oop");var h=a("ace/range").Range,p=a("mode/token_utils").TokenUtils;a("ace/token_iterator");var f=a("mode/token_cursor").CppTokenCursor,n=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,g,l){this.$session=a;this.$doc=a.getDocument();this.$tokenizer=b;this.$tokens=Array(this.$doc.getLength());
this.$statePattern=c;this.$codeBeginPattern=g;this.$codeEndPattern=l;this.$tokenUtils=new p(this.$doc,this.$tokenizer,this.$tokens,this.$statePattern,this.$codeBeginPattern);this.$scopes=new d(n);var e=!0,f=function(a,b){e?e=!1:(this.$doc.off("change",h),this.$session.off("changeMode",f))}.bind(this),h=function(a){this.$onDocChange(a)}.bind(this);this.$session.on("changeMode",f);this.$doc.on("change",h)};(function(){var a=c.contains;this.getTokenCursor=function(){return new f(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}},n="if else for do while struct class try catch switch".split(" "),g=function(a){a=a.trim();return a=a.replace(/[\n\s]+/g," ")},l=function(a,b){var d=g(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(k.test(d[c])){var e=c;for(c+=1;k.test(d[c])&&c<=b.end;)c++;for(var l=c,n=d.slice(e,l).map(function(a){return a.lastIndexOf("\\")}),g=Math.max.apply(null,n),f=0;f<l-
e;f++){var h={row:e+f,column:n[f]},q=Array(g-n[f]+1).join(" ");a.insert(h,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 p=/^\s*#\s*define/,k=/\\\s*$/,x=/^\s*[+\-/&^%$!<>.?|=~]|^\s*\*[^/]|^\s*\/[^\*]/,
m=/[+\-*&^%$!<>.?|=~]\s*$|\*[^/]\s*$|\/[^\*]\s*$/,I=function(a){return x.test(a)||m.test(a)};this.inMacro=function(a,b){var d=a[b];return 0>b?!1:k.test(d)?p.test(d)?!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 n=c.cloneCursor();d(n,this);n=n.peekFwd().currentPosition();e=this.$session.getTextRange(new h(n.row,n.column,e.row,e.column));e=g(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 h(c.row,c.column,e.row,e.column-1)),c=g("lambda "+c),this.$scopes.onLambdaScopeStart(c,e,b.currentPosition());else{if(c.moveToPreviousToken()){var f="";e=c.currentValue();n="";var A=this.$scopes.getActiveScopes(c.currentPosition());null!=A&&(A=A[A.length-1],A.isClass()&&A.label==="class "+e?"~"===c.peekBwd().currentValue()&&(e="~"+
e):(f=c.cloneCursor(),d(f,this),f.moveToNextToken(),f=f.currentPosition(),A=c.currentPosition(),f=this.$session.getTextRange(new h(f.row,f.column,A.row,A.column))));var q=c.peekFwd();A=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())&&(n=this.$session.getTextRange(new h(A.row,
A.column,q.row,q.column))));f=0<f.length?l(e.trim()+n.trim()+": "+f.trim()):l(e.trim()+n.trim());this.$scopes.onFunctionScopeStart(f,c.currentPosition(),b.currentPosition(),e.trim(),n.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),l=0;l<this.$tokens.length;l++)if(null!=
this.$tokens[l]&&0<this.$tokens[l].length){var f=this.$tokens[l];"\\"===f[f.length-1].value&&(e[l]=this.$tokens[l].splice(f.length-1,1)[0])}var g=this.getTokenCursor();if(d){var h=b.getSelection().getCursor();if(!g.moveToPosition(h))return 0}else for(g.$row=c,l=g.$tokens[c].length-1,l=g.$tokens[c].length-1;0<=l&&(g.$offset=l,"{"!==g.currentValue());l--);if("{"===g.peekBwd().currentValue()||";"===g.currentValue())return-1;g.bwdOverInitializationList();g.bwdOverClassInheritance();if("{"===g.currentValue()&&
!g.moveToPreviousToken()||"{"===g.currentValue())return-1;for(;"keyword"===g.currentType();){var q=g.currentValue();if(a(n,q)||0===g.$row&&0===g.$offset)return g.$row;if(!g.moveToPreviousToken())return-1}if(":"===g.currentValue()){var p=g.peekBwd().currentValue();if(a(["public","private","protected"],p))return g.moveToNextToken(),g.$row}if(":"===g.currentValue())for(;g.moveToPreviousToken();){if(g.bwdToMatchingToken())if("keyword"===g.peekBwd().currentType())continue;else break;if("identifier"===
g.currentType())break}if(")"===g.currentValue()&&!g.bwdToMatchingToken()||"("===g.currentValue()&&!g.moveToPreviousToken())return-1;"="===g.currentValue()&&g.moveToPreviousToken();return g.$row}finally{for(l=0;l<e.length;l++)"undefined"!==typeof e[l]&&this.$tokens[l].push(e[l])}return-1};this.getLineSansComments=function(a,b,c){if(0>b)return"";a=a.getLine(b);var d=/(?!\\)"/g,e=a,l;for(b=[];l=d.exec(e);)b.push(l.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));k.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,l,g,n){var f=b(),h=this.$session,q=h.getTabSize(),w=h.getDocument();"number"!==typeof g&&(g=h.getSelection().getCursor().row-1);if(-1===g)return e=
w.getLine(0),0<e.length?this.$getIndent(e):"";if(0===e.length||/^\s*#/.test(e))return this.getNextLineIndent(c.getPrimaryState(h,g-1),w.getLine(g-1),l,g-1,n);var x=this.$getIndent(e),r=this.$getUnindent(e,q),m=w.$lines;if(c.endsWith(d,"comment")||c.endsWith(d,"doc-start")){z&&z.row==g&&(e=e.substring(0,z.column));if(/^\s*$/.test(e))return this.$getIndent(m[g]);z=this.findStartOfCommentBlock(m,g,200);if(null!==z)return this.$getIndent(m[z])+" "}if(c.endsWith(d,"start")){if(p.test(e))return/\\\s*$/.test(e)?
x+l:x;if(/^\s*#\s*\S/.test(e))return x;if(this.inMacro(m,g-1)&&!k.test(e))return r;e=this.getLineSansComments(w,g);var z=h.getSelection().getCursor();z&&z.row==g&&!n&&(e=e.substring(0,z.column));d=this.getLineSansComments(w,g-1);if("string"!==typeof e)return"";if(0===e.length||/^\s*$/.test(e))return this.$getIndent(m[g]);if(/\*\/\s*$/.test(e)&&(r=this.findStartOfCommentBlock(m,g,200),0<=r))return this.$getIndent(m[r]);if(/^\s*<</.test(e)){for(e=g-1;/^\s*<</.test(m[e]);)e--;return this.$getIndent(m[e])}if(/^\s*\./.test(e)){for(e=
g-1;/^\s*\./.test(m[e]);)e--;return this.$getIndent(m[e])}if(/\bnamespace\b.*\{\s*$/.test(e)||/\bswitch\b.*\{\s*$/.test(e))return x;if(e.match(/\(\s*$/))return-1!==e.indexOf("=")||/^\s*(return\s+)?[a-zA-Z0-9_.->:]+\(\s*$/.test(e)?x+l:x+l+l;if(/^\s*(class|struct).*\{\s*$/.test(e)||/^\s*(class|struct)\s+.+:\s*$/.test(e))return x+l;if((r=e.match(/(^\s*(?:class|struct)\s+.*\w[^:]):[^:]\s*.+/))&&!/,\s*/.test(e)||(r=e.match(/^(\s*(class|struct).*:\s*).*,\s*$/))||(r=e.match(/^(\s*:\s*)(\w+).*,\s*$/))||(r=
e.match(/^(\s*)[:,]\s*[\w\s]*$/)))return f?Array(r[1].length+1).join(" "):x+l;if(/<\s*$/.test(e))return x+l;if(/^\s*".*"\s*$/.test(e)||/^\s*template\s*<.*>\s*$/.test(e)&&e.split(">").length==e.split("<").length)return x;if(/([\[\{\(<]).+,\s*$/.exec(e)){var B=["(","{","[","<"];for(r=0;r<B.length;r++){var v=B[r],y=this.$complements[v];v=this.allIndicesOf(e,v);if(v.length&&(y=this.allIndicesOf(e,y),y=v.length-y.length-1,!(0>y)))return m=v[y],f?(e=e.substr(m+1).match(/([^\s])/),Array(m+e.index+2).join(" ")):
x+l}}for(r=g-1;0<=r&&/^\s*$|^\s*#/.test(d);)d=this.getLineSansComments(w,r),r--;if(I(e)&&I(d))return this.$getIndent(e);if(this.$tokenUtils.$tokenizeUpToRow(g+2)){B=Array(this.$tokens.length);try{for(r=0;r<this.$tokens.length;r++)if(null!=this.$tokens[r]&&0<this.$tokens[r].length){var E=this.$tokens[r];"\\"===E[E.length-1].value&&(B[r]=this.$tokens[r].splice(E.length-1,1)[0])}var u=this.getTokenCursor();n?(u.$row=g,u.$offset=this.$tokens[g].length-1):u.moveToPosition(z);for(;0>u.$offset&&0<u.$row;)u.$row--,
u.$offset=u.$tokens[u.$row].length-1;for(;0<u.$row&&/^\s*#/.test(w.getLine(u.$row));)u.$row--,u.$offset=u.$tokens[u.$row].length-1;n="";var G=u.cloneCursor(),F=G.currentValue(),L=G.currentType();if("constant"===L||"keyword"===L||"identifier"===L||a(["{",")",">",":"],F))n=l;for(;";"===u.currentValue()&&u.moveToPreviousToken(););var N=u.cloneCursor();if(f&&u.isLastSignificantTokenOnLine()&&("keyword.operator"===u.currentType()||"punctuation.operator"===u.currentType())){var Q=u.cloneCursor();Q.$offset=
0;if("keyword"===Q.currentType()){var O=e.split("(").length-e.split(")").length;if(0<O){var M=e.match(/.*?\(\s*(\S)/);if(M)return Array(M[0].length).join(" ")}}}if(","===u.currentValue()){if(f){var H=u.peekBwd();if("]"===H.currentValue()&&H.bwdToMatchingToken())return Array(H.currentPosition().column+1).join(" ");O=e.split("(").length-e.split(")").length;if(0<O&&(M=e.match(/.*?\(\s*(\S)/)))return Array(M[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(m[C.$row])+l:-1!==e.indexOf("=")?this.$getIndent(e)+l:this.$getIndent(e)}if("keyword.operator"===L&&":"!==F)return this.$getIndent(m[g])+l;for(;;){if("undefined"===typeof u.currentValue())return"undefined"!==typeof N.currentValue()?this.$getIndent(m[N.$row])+n:n;N=u.cloneCursor();if(";"===u.currentValue()&&u.moveToNextToken()){for(g=u.$row;null!=m[g]&&/^\s*#/.test(m[g]);)++g;
return this.$getIndent(m[g])+n}if(a(["for","while","do","try"],u.currentValue())&&";"!==F)return this.$getIndent(m[u.$row])+n;H=u.peekBwd();if(":"===u.currentValue()){if(a(["public","private","protected"],H.currentValue()))return this.$getIndent(m[H.$row])+l;var D=m[u.$row];if(/^\s*case/.test(D))return this.$getIndent(D)+l;if(")"===H.currentValue()&&(C=H.cloneCursor(),C.bwdToMatchingToken())){var K=C.peekBwd(1),R=C.peekBwd(2);if(null!==K&&"identifier"===K.currentType()&&null!==R&&!/\boperator\b/.test(R.currentType()))return this.$getIndent(m[C.peekBwd().$row])+
n}}if("]"===u.currentValue()&&"("===u.peekFwd().currentValue()&&(C=u.cloneCursor(),C.bwdToMatchingToken()))return this.$getIndent(m[C.$row])+n;if("("===u.currentValue()&&"for"===H.currentValue()&&";"===F)return u.peekFwd().cloneCursor(),f?Array(u.peekFwd().currentPosition().column+1).join(" "):this.$getIndent(m[u.peekFwd().$row])+l;if(f&&"("===u.currentValue()&&!u.isLastSignificantTokenOnLine())return u.moveToNextToken(),Array(u.currentPosition().column+1+q).join(" ");if("if"===u.currentValue()||
"else"===u.currentValue()||"template"===u.currentValue()&&"<"===u.peekFwd().currentValue())return this.$getIndent(m[u.$row])+n;if("{"===u.currentValue()){var S=this.getRowForOpenBraceIndent(h,u.$row);return 0<=S?(e=this.getLineSansComments(w,S),x=this.$getIndent(e),/\bnamespace\b/.test(e)?x:x+l):this.$getIndent(m[u.$row])+l}if(0===u.$row&&0===u.$offset)return this.$getIndent(m[0])+n;if(">"===u.currentValue()&&(C=u.cloneCursor(),C.bwdToMatchingArrow()&&"template"===C.peekBwd().currentValue()))return">"===
F&&(n=""),this.$getIndent(m[C.$row])+n;u.bwdToMatchingToken();if(!u.moveToPreviousToken())break;for(;0<u.$row&&/^\s*#/.test(m[u.$row]);)u.$row--,u.$offset=this.$tokens[u.$row].length-1}}finally{for(r=0;r<B.length;r++)"undefined"!==typeof B[r]&&this.$tokens[r].push(B[r])}}}return x};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);m.CppCodeModel=
a});define("mode/cpp_scope_tree",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");var h=a("mode/r_scope_tree");a=h.ScopeManager;var p=h.ScopeNode,f=function(a,d,b,c,e,f){this.label=a;this.start=d;this.preamble=b||d;this.end=null;this.scopeType=c;this.scopeCategory=e;this.attributes=f||{};this.parentScope=null;this.$children=[]};k.mixin(f.prototype,p.prototype);f.CATEGORY_CLASS=1;f.CATEGORY_NAMESPACE=2;f.CATEGORY_FUNCTION=3;f.CATEGORY_LAMBDA=4;f.CATEGORY_ANON=5;(function(){this.isClass=
function(){return this.scopeType==p.TYPE_BRACE&&this.scopeCategory==f.CATEGORY_CLASS};this.isNamespace=function(){return this.scopeType==p.TYPE_BRACE&&this.scopeCategory==f.CATEGORY_NAMESPACE};this.isFunction=function(){return this.scopeType==p.TYPE_BRACE&&this.scopeCategory==f.CATEGORY_FUNCTION};this.isLambda=function(){return this.scopeType==p.TYPE_BRACE&&this.scopeCategory==f.CATEGORY_LAMBDA}}).call(f.prototype);h=function(a){this.$ScopeNodeFactory=a;this.parsePos={row:0,column:0};this.$root=new a("(Top Level)",
this.parsePos,null,p.TYPE_ROOT)};k.mixin(h.prototype,a.prototype);(function(){this.onClassScopeStart=function(a,d,b,c){a=new this.$ScopeNodeFactory(a,b,d,p.TYPE_BRACE,f.CATEGORY_CLASS,{name:c});this.$root.addNode(a);this.printScopeTree()};this.onNamespaceScopeStart=function(a,d,b,c){a=new this.$ScopeNodeFactory(a,b,d,p.TYPE_BRACE,f.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,p.TYPE_BRACE,
f.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,p.TYPE_BRACE,f.CATEGORY_LAMBDA,{args:c});this.$root.addNode(a);this.printScopeTree()};this.onScopeStart=function(a){this.$root.addNode(new this.$ScopeNodeFactory(null,a,null,p.TYPE_BRACE));this.printScopeTree()};this.onScopeEnd=function(a){a=this.$root.closeScope(a,p.TYPE_BRACE);this.printScopeTree();return a}}).call(h.prototype);m.CppScopeManager=
h;m.CppScopeNode=f});define("mode/dcf",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");var h=a("ace/mode/text").Mode,p=a("ace/tokenizer").Tokenizer,f=a("mode/dcf_highlight_rules").DcfHighlightRules;a=function(){this.$tokenizer=new p((new f).getRules())};k.inherits(a,h);(function(){this.getNextLineIndent=function(a,d,b){return this.$getIndent(d)}}).call(a.prototype);m.Mode=a});define("mode/dcf_highlight_rules",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");a=a("ace/mode/text_highlight_rules").TextHighlightRules;var h=function(){this.$rules={start:[{token:["keyword","text"],regex:"^([\\w@-]+)(\\:)"},{token:"text",regex:".+"}]}};k.inherits(h,a);m.DcfHighlightRules=h});define("mode/doc_comment_highlight_rules",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");a=a("ace/mode/text_highlight_rules").TextHighlightRules;var h=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:"."}]}};k.inherits(h,a);h.getStartRule=function(a){return{token:"comment.doc",
merge:!0,regex:"\\/\\*[\\*\\!]",next:a}};h.getEndRule=function(a){return{token:"comment.doc",merge:!0,regex:"\\*\\/",next:a}};m.DocCommentHighlightRules=h});define("util/expand_selection",["require","exports","module"],function(a,m,k){m=a("ace/editor").Editor;var h=a("ace/range").Range;a("ace/keyboard/vim");var p=a("ace/token_iterator").TokenIterator,f=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,g=a.end.row===b.end.row&&a.end.column===b.end.column;return c?d||g: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(r.test(c.value)&&(r.test(d.value)||f.isOpeningBracket(d.value)||
f.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){g.push({name:a,immediate:b,execute:c})}var e=this,r=/['"\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 g=[];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 h(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 h(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 h(c+1,0,d-1,b)});c("includeBoundaries",!0,function(a,b,c,e){a=new p(b);c=a.moveToPosition(e.start);0===e.start.column&&(c=a.moveToPreviousToken());b=new p(b);e=b.moveToPosition(e.end,!0);if(c&&e){var d="support.function.codebegin"===
c.type&&"support.function.codeend"===e.type;d||(d=f.isOpeningBracket(c.value)&&f.getComplement(c.value)===e.value);if(d)return a=a.getCurrentTokenPosition(),c=b.getCurrentTokenPosition(),c.column+=e.value.length,h.fromPoints(a,c)}return null});c("matching",!1,function(a,b,c,e){a=new p(b);e=a.moveToPosition(e.start);if(null==e)return null;do{if(null==e)break;if(!a.bwdToMatchingToken()&&(f.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),h.fromPoints(c,a)}}while(e=a.stepBackward());return null});c("statement",!1,function(a,c,e,d){a=new p(c);if(!a.moveToPosition(d.start,!0))return null;c=new p(c);if(!(e=!c.moveToPosition(d.end)||!b(a,[";",",","=","<-","<<-"]))){a:{e=[";",","];for(var g=c.getCurrentToken(),n=c.getCurrentTokenRow();c.moveToNextSignificantToken();){var l=
c.getCurrentToken();if(n!==c.getCurrentTokenRow()&&0!==g.type.indexOf("keyword.operator")){if(!c.moveToPreviousSignificantToken()){e=!1;break a}break}if(r.test(g.value)||f.isClosingBracket(g.value))if(r.test(l.value)||f.isClosingBracket(l.value)||f.contains(e,l.value)){if(!c.moveToPreviousSignificantToken()){e=!1;break a}break}c.fwdToMatchingToken();g=c.getCurrentToken();n=c.getCurrentTokenRow()}e=!0}e=!e}if(e)return null;e=a.getCurrentTokenPosition();g=c.getCurrentTokenPosition();if(e.row===d.start.row&&
e.column===d.start.column&&g.row===d.end.row&&g.column<=d.end.column&&!b(a,[";",","]))return null;d=a.getCurrentTokenPosition();a=c.getCurrentTokenPosition();a.column+=c.getCurrentTokenValue().length;return h.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 g=e.parentScope.$children,f=g.length-2;0<=f;f--)if(g[f].equals(e)){d=
g[f+1].preamble;break}null==d&&(d={row:b.getLength(),column:0});a.push(h.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 h(0,0,0,0);b=b.getLine(a-1);return new h(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(),n=[],h=0;h<g.length;h++){var p=g[h],r=p.execute(this,a,b,c);f.isArray(r)||(r=[r]);for(var m=
0;m<r.length;m++){var k=r[m];if(k&&p.immediate&&d(k,c))return this.$acceptSelection(b,k,c);k&&d(k,c)&&n.push({name:p.name,range:k})}}n.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,n[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(m.prototype)});define("mode/markdown",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");var h=a("ace/mode/text").Mode,p=a("ace/mode/javascript").Mode,f=a("ace/mode/xml").Mode,n=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-":p,"xml-":f,"html-":n});this.foldingRules=new b};k.inherits(a,h);(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);m.Mode=a});define("mode/markdown_folding",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");var h=a("ace/mode/folding/fold_mode").FoldMode,p=a("ace/range").Range;m=m.FoldMode=function(){};var f=a("mode/utils");k.inherits(m,h);(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"===f.getPrimaryState(a,b)?d:"start":"":""};this.getFoldWidgetRange=
function(a,d,b){function c(b){return(m=a.getTokens(b)[0])&&0===m.type.lastIndexOf(k,0)}function e(){var a=m.value[0];return"="==a?6:"-"==a?5:7-m.value.search(/[^#]/)}var n=a.getLine(b);d=n.length;var h=a.getLength(),g=b,l=b;if(n.match(this.foldingStartMarker)){if("`"==n[0]){if("start"!==f.getPrimaryState(a,b)){for(;++b<h&&!(n=a.getLine(b),"`"==n[0]&"```"==n.substring(0,3)););return new p(g,d,b,0)}for(;0<b--&&!(n=a.getLine(b),"`"==n[0]&"```"==n.substring(0,3)););return new p(b,n.length,g,0)}var m,
k="markup.heading";if(c(b)){for(l=e();++b<h&&!(c(b)&&e()>=l););l=b-(m&&-1!=["=","-"].indexOf(m.value[0])?2:1);if(l>g)for(;l>g&&/^\s*$/.test(a.getLine(l));)l--;if(l>g)return b=a.getLine(l).length,new p(g,d,l,b)}}}}).call(m.prototype)});define("mode/markdown_highlight_rules",["require","exports","module"],function(a,m,k){function h(a,b){return{token:"support.function",regex:"^\\s*```(?:\\{"+a+"[^\\}]*\\}|"+a+")\\s*$",push:b+"start"}}k=a("ace/lib/oop");var p=a("ace/lib/lang"),f=a("ace/mode/text_highlight_rules").TextHighlightRules,n=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,r=a("mode/python_highlight_rules").PythonHighlightRules,q=a("ace/mode/ruby_highlight_rules").RubyHighlightRules,g=a("ace/mode/scala_highlight_rules").ScalaHighlightRules,l=a("mode/sh_highlight_rules").ShHighlightRules;a("mode/stan_highlight_rules");var w=a("mode/sql_highlight_rules").SqlHighlightRules,z=function(a){return"(?:[^"+p.escapeRegExp(a)+"\\\\]|\\\\.)*"};a=function(){var a=p.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(" ")),
f={token:["text","constant.numeric.text","constant.numeric.text","constant.numeric.text"],regex:"(^|\\s+)(_{2,3})(?![\\s_])(.*?)(?=_)(\\2)\\b"},m={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)"},y={token:["constant.language.boolean.text"],regex:"([*](?=[^\\s*]).*?[*])"},E={token:"text",regex:"\\^\\["+z("]")+"\\]"},G={token:"text constant text url string text".split(" "),
regex:'^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:["][^"]+["])?(\\s*))$'},F={token:["text","keyword","text","constant","text"],regex:"(\\s*\\[)("+z("]")+")(\\]\\[)("+z("]")+")(\\])"},t={token:"text keyword text markup.href string text paren.keyword.operator nospell paren.keyword.operator".split(" "),regex:"(\\s*\\[)("+z("]")+')(\\]\\()((?:[^\\)\\s\\\\]|\\\\.|\\s(?=[^"]))*)(\\s*"'+z('"')+'"\\s*)?(\\))(?:(\\s*{)((?:[^\\}]+))(\\s*}))?'},A={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)"},E,G,F,t,A,k,f,y,m],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"},h("(?:javascript|js)","jscode-"),h("xml","xmlcode-"),h("html","htmlcode-"),h("css","csscode-"),h("perl","perlcode-"),h("python","pythoncode-"),h("ruby","rubycode-"),h("scala","scalacode-"),h("sh",
"shcode-"),h("bash","bashcode-"),h("stan","stancode-"),h("sql","sqlcode-"),h("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"},E,G,F,{token:"constant",regex:"^\\s*[*](?:\\s*[*]){2,}\\s*$",next:"allowBlock"},{token:"constant",regex:"^\\s*[-](?:\\s*[-]){2,}\\s*$",next:"allowBlock"},{token:"constant",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,f,y,m,{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)"},E,G,F,t,A,k,f,y,m,{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(n,"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(r,"pythoncode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(q,"rubycode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(g,"scalacode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(l,"shcode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);
this.embedRules(l,"bashcode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(w,"sqlcode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(n,"jscode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.normalizeRules()};k.inherits(a,f);m.MarkdownHighlightRules=a});define("mode/mermaid",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");var h=a("ace/mode/text").Mode,p=a("ace/tokenizer").Tokenizer,f=a("mode/mermaid_highlight_rules").MermaidHighlightRules;a=function(){this.$highlightRules=new f;this.$tokenizer=new p(this.$highlightRules.getRules())};k.inherits(a,h);(function(){this.getNextLineIndent=function(a,d,b){return this.$getIndent(d)}}).call(a.prototype);m.Mode=a});define("mode/mermaid_highlight_rules",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");a=a("ace/mode/text_highlight_rules").TextHighlightRules;var h=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}]}};k.inherits(h,a);m.MermaidHighlightRules=h});define("mode/python",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");var h=a("ace/mode/text").Mode,p=a("mode/python_highlight_rules").PythonHighlightRules,f=a("ace/mode/folding/pythonic").FoldMode,n=a("ace/range").Range;a=function(){this.HighlightRules=p;this.foldingRules=new f("\\:")};k.inherits(a,h);(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 n(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);m.Mode=a});define("mode/python_highlight_rules",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");var h=a("ace/mode/text_highlight_rules").TextHighlightRules,p=a("mode/rainbow_paren_highlight_rules").RainbowParenHighlightRules;a=function(){this.$rules={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},p.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"}]}};k.inherits(a,h);m.PythonHighlightRules=a});define("mode/r",["require","exports","module"],function(a,m,k){a("ace/editor");a("ace/edit_session");a("ace/range");k=a("ace/lib/oop");var h=a("ace/mode/text").Mode,p=a("ace/tokenizer").Tokenizer,f=a("ace/mode/text_highlight_rules").TextHighlightRules,n=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 p((new f).getRules()):
new p((new n).getRules());this.foldingRules=this.codeModel=new d(c,this.$tokenizer);this.$outdent=new b(this.codeModel)};k.inherits(a,h);(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.transformAction=function(a,b,c,d,f){return"insertion"===b&&"\n"===f&&(a=c.getSelectionRange().start,d=d.doc.getLine(a.row),(a=
/^((\s*#+')\s*)/.exec(d))&&c.getSelectionRange().start.column>=a[2].length||(a=/^((\s*#+\*)\s*)/.exec(d))&&c.getSelectionRange().start.column>=a[2].length)?{text:"\n"+a[1]}:!1};this.$id="mode/r"}).call(a.prototype);m.Mode=a});define("mode/r_code_model",["require","exports","module"],function(a,m,k){function h(a,b){for(var c=0;c<b.length;c++)if(a===b[c])return!0;return!1}function p(a){return"if"===a||"for"===a||"while"===a||"repeat"===a||"function"===a}var f=a("ace/range").Range,n=a("ace/token_iterator").TokenIterator,d=a("mode/token_cursor").RTokenCursor,b=a("mode/utils"),c=!1,e=a("mode/r_scope_tree").ScopeManager,r=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(r);var g=!0,n=function(a,b){g?g=!1:(this.$doc.off("change",h),this.$session.off("changeMode",n))}.bind(this),h=function(a){this.$onDocChange(a)}.bind(this);this.$session.on("changeMode",n);this.$doc.on("change",h)};(function(){function a(a){return"keyword"==a.type&&"function"==a.value}function e(a){return/\boperator\b/.test(a.type)&&
/^(=|<-|<<-)$/.test(a.value)}function l(a){return/\bidentifier\b/.test(a.type)}function m(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(h(a.currentValue(),["if","for","while"]))return!0;return!1}function r(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 B(b){if(a(b.currentToken())&&!b.moveToNextToken()||"("===b.currentValue()&&!b.moveToNextToken()||")"===b.currentValue())return[];var c=[];for(l(b.currentToken())&&c.push(b.currentValue());b.moveToNextToken();)if(!b.fwdToMatchingToken()){if(")"===b.currentValue())break;if(","===b.currentValue()){for(;","===b.currentValue()&&b.moveToNextToken(););l(b.currentToken())&&c.push(b.currentValue())}}return c}function I(a){for(var c=
0,e=Math.min(a.getLength(),100),d="Title";c++<e;){var g=a.getLine(c);if(/^\s*[-]{3}\s*$/.test(g))break;g=/^\s*title:\s+(.*?)\s*$/.exec(g);if(null!==g){d=g[1];break}}return b.stripEnclosingQuotes(d.trim())}function v(a){return"keyword.operator"===a||"keyword.operator.infix"===a}var y=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="",g=!1;!1!==b&&(b.excludeArgsFromObject&&(g=b.excludeArgsFromObject),d=a.currentValue(),c=b.additionalArgs,e=b.excludeArgs);return{name:d,additionalArgs:c,excludeArgs:e,excludeArgsFromObject:g}};var G="mutate summarise summarize rename transmute select rename_vars inner_join left_join right_join semi_join anti_join outer_join full_join".split(" "),F=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()&&
h(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(/\binfix\b/.test(c.currentToken().type)){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();y(G,e)&&F(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(!/\binfix\b/.test(b.currentToken().type))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&&r(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 g=d.currentValue();
d.moveToNextToken()&&"in"===d.currentValue()&&(c[g]="variable")}e(b.currentToken())&&(c="variable",d=b.cloneCursor(),d.moveToNextToken()&&"function"===d.currentValue()&&(c="function"),d=b.cloneCursor(),d.moveToPreviousToken()&&l(d.currentToken())&&(d=d.currentValue(),a[d]=c))}while(b.moveToPreviousToken());b=[];for(var f in a)b.push({token:f,type:a[f]});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 g=0;g<d.length;g++)if(e=/^\s*label\s*=\s*(.*)$/.exec(d[g]))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 n(this.$session);d.tokenizeUpToRow(a);this.$tokenizeUpToRow(a);var g=this.$scopes.parsePos.row;d.moveToPosition({row:g,column:this.$scopes.parsePos.column},
!0);var h=d.getCurrentToken();if(null==h)return g;var l=h.value,p=h.type,q=d.getCurrentTokenPosition();g=this.$scopes.getChunkCount();do{if(d.$row>a)break;l=h.value;p=h.type;q=d.getCurrentTokenPosition();h=b.getPrimaryState(this.$session,q.row);if("rd-start"===h)d.moveToEndOfRow();else{var k=!0;this.$codeBeginPattern&&(k=/^r-/.test(h));if(b.startsWith(p,"markup.heading")){p="";k={row:q.row,column:0};var t={row:q.row+1,column:0};h=0;if(/^\s*#+\s*$/.test(l))h=l.split("#").length-1,l=this.$session.getLine(q.row),
p=l.replace(/^\s*[#]+\s*/,"");else if(/^[-=]{3,}\s*$/.test(l)&&(h="="===l[0]?1:2,p=this.$session.getLine(q.row-1).trim(),k.row--,0===p.length))continue;0===p.length&&(p="(Untitled)");p=p.replace(/{.*}\s*$/,"");this.$scopes.onMarkdownHead(p,k,t,h,!0)}else if(k&&/\bsectionhead\b/.test(p)){p="(Untitled)";if(h=/[^#=-\s]/.exec(l))p=l.substr(h.index),p=p.replace(/\s*[#=-]+\s*$/,"");l=/^\s*([#]+)\s*\w/.exec(l);if(null!=l)if(h=l[1].length,6<h)this.$scopes.onSectionStart(p,q);else k={row:q.row,column:0},t=
{row:q.row,column:Infinity},this.$scopes.onMarkdownHead(p,k,t,h,!1);else this.$scopes.onSectionStart(p,q)}else if(k||"mode/sweave"!==e||"keyword"!==p||0!==q.column||0!==l.indexOf("\\")||"\\chapter"!==l&&"\\section"!==l&&"\\subsection"!==l&&"\\subsubsection"!==l)if(/\bcodebegin\b/.test(p)&&"---"===l)l=I(this.$session),this.$scopes.onSectionStart(l,q,{isYaml:!0});else if(/\bcodeend\b/.test(p)&&"---"===l)q.column=Infinity,this.$scopes.onSectionEnd(q);else if("mode/rmarkdown"===e&&/\bcodebegin\b/.test(p)&&
0===l.trim().indexOf("/***"))this.$scopes.onSectionStart("(R Code Chunk)",q);else if("mode/rmarkdown"===e&&/\bcodeend\b/.test(p)&&0===l.trim().indexOf("*/"))this.$scopes.onSectionEnd(q);else/\bcodebegin\b/.test(p)?(g++,p={row:q.row+1,column:0},k=g,h=c(this.$codeBeginPattern,l),k="Chunk "+k,h&&"YAML Header"!==l&&(k+=": "+h),this.$scopes.onChunkStart(h,k,q,p)):/\bcodeend\b/.test(p)?(q.column+=l.length,this.$scopes.onChunkEnd(q)):k&&"{"===l?(l=this.getTokenCursor(),l.moveToPosition(q,!0),p=l.cloneCursor(),
m(p)?(h=p.cloneCursor(),h.moveToNextToken(),q=null,r(p)&&(k=p.cloneCursor(),t=p.cloneCursor(),t.findStartOfEvaluationContext()&&(q=t.currentPosition(),t=k.currentPosition(),q.row!==t.row?(q.row=t.row,q.column=0,p.$row=q.row,p.$offset=0):p.moveToPosition(q,!0),q=this.$doc.getTextRange(new f(q.row,q.column,t.row,t.column+k.currentValue().length)))),k=p.currentPosition(),p.isFirstSignificantTokenOnLine()&&(k.column=0),p=B(h),h="("+p.join(", ")+")",h=null==q?E("<function>"+h):E(q+h),this.$scopes.onFunctionScopeStart(h,
k,l.currentPosition(),q,p)):(k=l.currentPosition(),l.isFirstSignificantTokenOnLine()&&(k.column=0),this.$scopes.onScopeStart(k))):k&&"}"===l&&(q.column+=1,this.$scopes.onScopeEnd(q));else h=1,"\\chapter"===l?h=2:"\\section"===l?h=3:"\\subsection"===l?h=4:"\\subsubsection"===l&&(h=5),l=this.$doc.getLine(q.row),l=/{([^}]*)}/.exec(l),p="",null!=l&&(p=l[1]),k={row:q.row,column:0},t={row:q.row,column:Infinity},this.$scopes.onMarkdownHead(p,k,t,h,!0)}}while(h=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,g=null;for(c=0;c<a.length;c++){var f=a[c];if(/\bparen\b/.test(f.type))switch(f.value){case "{":e++;1==e&&(d=f);break;case "}":e--,0==e&&(d=null),0>e&&(g=f,e=0)}}return d?d:"markbeginend"==b&&g?g: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")))?f.fromPoints(c,a):void 0;if("}"==
d.value)return(a=a.$findOpeningBracket(d.value,c,b.getTokenTypeRegex("paren")))?f.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 n(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},f.fromPoints({row:e,column:d.column+d.value.length},a)}else if(/\bcodeend\b/.test(d.type))for(c=
new n(a,e,0);d=c.stepBackward();){if(/\bcodebegin\b/.test(d.type))return c=c.getCurrentTokenRow(),f.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 n(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 f.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,g,f){if(b.endsWith(a,"qstring"))return this.$getIndent(d);"number"!==typeof f&&(f=this.$session.getSelection().getCursor().row-1);var n=this.$session.getTabSize();a=Array(n+1).join(" ");this.$lineOverrides=null;this.$doc.getLine(f)!==d&&(this.$lineOverrides={},this.$lineOverrides[f]=d,this.$invalidateRow(f));try{var l=0>f?"":this.$getIndent(this.$getLine(f));if(!this.$tokenizeUpToRow(f))return l;var q={row:f,column:this.$getLine(f).length},
m=this.$findPreviousSignificantToken(q,f-10);l="";var r=!1;if(m&&v(m.token.type))l=g,r=!0;else if(m&&/\bparen\b/.test(m.token.type)&&/\)$/.test(m.token.value)){var w=this.$walkParensBalanced(m.row,m.row-10,null,function(a,b,c){return 0===a.length});if(null!=w){var x=this.$findPreviousSignificantToken(w,0);if(x&&"keyword"===x.token.type&&/^(if|while|for|function)$/.test(x.token.value))return this.$getIndent(this.$getLine(x.row))+g}}else if(m&&"keyword"===m.token.type&&("repeat"===m.token.value||"else"===
m.token.value))return this.$getIndent(this.$getLine(m.row))+g;var t=this.getTokenCursor();if(!t.moveToPosition(q))return"";do{var B=t.currentType();if("support.function.codebegin"===B||"support.function.codeend"===B)return this.$getIndent(this.$doc.getLine(t.$row))+l;var z=t.currentValue();if(t.isAtStartOfNewExpression(!1)){if("{"===z||"["===z||"("===z)l+=g;return this.$getIndent(this.$doc.getLine(t.$row))+l}if("("===z&&t.isAtStartOfNewExpression(!0))return this.$getIndent(this.$doc.getLine(t.$row))+
g;if(!t.bwdToMatchingToken()){if("{"===z)break;if(y(["[","("],z)){var A=t.currentPosition();q=null;c&&(q=this.$findNextSignificantToken({row:A.row,column:A.column+1},f));if(q){d=this.$getLine(q.row);var I=d.replace(/[^\s].*$/,""),J=q.column-I.length,P=Math.floor(J/n);A=J-n*P;J="";for(d=0;d<P;d++)J+=g;for(g=0;g<A;g++)J+=" ";g=I+J;var E=g.replace("\t",a).length;for(d=q.row+1;d<=f;d++)if(/[^\s]/.test(this.$getLine(d))){var G=this.$endStates[d-1];if("qstring"!==G&&"qqstring"!==G){var F=this.$getLine(d).replace(/[^\s].*$/,
"");var C=F.replace("\t",a).length;C<E&&(g=F,E=C)}}return k(t)?g:g+l}return this.getIndentForOpenBrace(A)+g+l}}}while(t.moveToPreviousToken());if(!t.moveToPosition(q))return"";do if(!t.bwdToMatchingToken()){if("{"===t.currentValue())return this.getIndentForOpenBrace(t.currentPosition())+g+l;if(e(t.currentToken())){for(;e(t.currentToken())&&t.moveToPreviousToken()&&t.findStartOfEvaluationContext();){var D=t.cloneCursor();if(D.moveToPreviousToken()){if("else"===D.currentValue()||"repeat"===D.currentValue())return this.$getIndent(this.$doc.getLine(D.$row))+
l+l;if(")"===D.currentValue()&&D.bwdToMatchingToken()&&D.moveToPreviousToken()&&p(D.currentValue())){d=this.$doc.getLine(D.$row);if(!r)for(;D.moveToPreviousToken()&&")"===D.currentValue()&&D.bwdToMatchingToken()&&D.moveToPreviousToken()&&p(D.currentValue());)d=this.$doc.getLine(D.$row);return this.$getIndent(d)+l+l}}e(t.peekBwd().currentToken())&&t.moveToPreviousToken()}return this.$getIndent(this.$getLine(t.$row))+l}}while(t.moveToPreviousToken());if(r){E=0;t=this.getTokenCursor();t.moveToPosition(q);
t.moveToPreviousToken();do{if(h(t.currentValue(),["if","else"])){l+=g;break}if(t.hasType("constant","identifier")){if(!t.moveToPreviousToken())break;if(h(t.currentValue(),["if","else"])){l+=g;break}if(")"===t.currentValue()){if(!t.bwdToMatchingToken())break;if(!t.moveToPreviousToken())break;if(h(t.currentValue(),["if","else"])){l+=g;break}}if(!t.hasType("operator"))break}else if(!t.findStartOfEvaluationContext())break}while(t.moveToPreviousToken()&&20>E++)}var K=this.$findNextSignificantToken({row:0,
column:0},f);return K?this.$getIndent(this.$getLine(K.row))+l:""+l}finally{this.$lineOverrides&&(this.$lineOverrides=null,this.$invalidateRow(f))}};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(),h(c,["if","while","for","function"])))return this.$getIndent(this.$getLine(b.$row))}else if(h(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 g=e[d];if(b&&a.column==g.column)return g;if(a.column<=g.column)break;if(c&&a.column==g.column+g.value.length||a.column<g.column+g.value.length)return g}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],g=0;g<d.length;g++)if(e.test(d[g].type)&&!c(d[g].value,{row:a,column:d[g].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],g=d.length-1;0<=g;g--)if(e.test(d[g].type)&&!c(d[g].value,{row:a,
column:d[g].column}))return!1;return!0}.call(this)};this.$walkParensBalanced=function(a,b,c,e){var d=[],g=null,f=this;this.$walkParens(a,b,function(a,b){if(c&&c(d,a,b))return g=b,!1;if(/[\[({]/.test(a))if(d[d.length-1]===f.$complements[a])d.pop();else return!0;else d.push(a);return e&&e(d,a,b)?(g=b,!1):!0});return g};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],
g=0;g<d.length;g++)if(d[g].column+d[g].value.length>e)return{token:d[g],row:c,column:Math.max(d[g].column,e),offset:g};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);m.RCodeModel=a;m.setVerticallyAlignFunctionArgs=function(a){c=a};m.getVerticallyAlignFunctionArgs=function(){return c}});var $colorFunctionCalls=!1;
define("mode/r_highlight_rules",["require","exports","module"],function(a,m,k){function h(a){for(var b=Array(a.length),c=0;c<a.length;c++)b[c]={include:a[c]};return b}k=a("ace/lib/oop");var p=a("ace/lib/lang"),f=a("ace/mode/text_highlight_rules").TextHighlightRules,n=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()};k.inherits(b,f);a=function(){var a=p.arrayToMap("\\ function if else in break next repeat for while".split(" ")),e=p.arrayToMap("return switch try tryCatch stop warning require library attach detach source setMethod setGeneric setGroupGeneric setClass setRefClass R6Class UseMethod NextMethod".split(" ")),
f=p.arrayToMap("NULL NA TRUE FALSE T F Inf NaN NA_integer_ NA_real_ NA_character_ NA_complex_".split(" ")),q={"{":"}","[":"]","(":")"},g={"#comment":[{token:"comment.sectionhead",regex:"#+(?!').*(?:----|====|####)\\s*$",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 f.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 f.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"}]};g["#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"},n.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"}];g["#text"]=[{token:"text",regex:"\\s+"}];g.start=h("#comment #string #number #package-access #quoted-identifier #function-call-or-keyword #keyword-or-identifier #operator #text".split(" "));g.afterDollar=h("#comment #string #number #quoted-identifier #function-call #keyword-or-identifier #operator #text".split(" "));
g.rawstring=[{token:"string",regex:"[\\]})][-]*['\"]",onMatch:function(a,b,c,e){this.next=a===c[2]?c[0]:"rawstring";return this.token}},{defaultToken:"string"}];g.qqstring=[{token:"string",regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"',next:"start"},{token:"string",regex:".+",merge:!0}];g.qstring=[{token:"string",regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'",next:"start"},{token:"string",regex:".+",merge:!0}];this.$rules=g;var l=(new b).getRules(),m;for(m in l){g=l[m];for(var k=0;k<g.length;k++)if(d.isArray(g[k].token))for(var x=
0;x<g[k].token.length;x++)g[k].token[x]+=".virtual-comment";else g[k].token+=".virtual-comment"}this.embedRules(l,"rd-",[{token:"text",regex:"^",next:"start"}]);this.normalizeRules()};k.inherits(a,f);m.RHighlightRules=a;m.setHighlightRFunctionCalls=function(a){$colorFunctionCalls=a}});define("mode/r_matching_brace_outdent",["require","exports","module"],function(a,m,k){var h=a("ace/range").Range;a=function(a){this.codeModel=a};(function(){this.checkOutdent=function(a,f,n){return/^\s+$/.test(f)&&/^\s*[\{\}\)\]]/.test(n)||/^\s*}\s*$/.test(f)&&"\n"==n||/}\s*$/.test(f)&&/\n/.test(n)?!0:!1};this.autoOutdent=function(a,f,n){if(0===n)return 0;a=f.getLine(n);var d=a.match(/^(\s*[\}\)\]])/);if(d){d=d[1].length;var b=f.findMatchingBracket({row:n,column:d});if(!b||b.row==n)return 0;b=this.codeModel.getIndentForOpenBrace(b);
f.replace(new h(n,0,n,d-1),b)}if(d=a.match(/^(\s*\{)/))d=d[1].length,b=this.codeModel.getBraceIndent(n-1),f.replace(new h(n,0,n,d-1),b)}}).call(a.prototype);m.RMatchingBraceOutdent=a});define("mode/r_scope_tree",["require","exports","module"],function(a,m,k){function h(a,n){return a.row!=n.row?a.row-n.row:a.column-n.column}var p=function(a,n,d,b,c){this.label=a;if((this.start=n)&&d&&(d.row>n.row||d.row===n.row&&d.column>n.column))throw Error("Malformed preamble: should lie before start position");this.preamble=d||n;this.end=null;this.scopeType=b;this.parentScope=null;this.attributes=c||{};this.$children=[]};p.TYPE_ROOT=1;p.TYPE_BRACE=2;p.TYPE_CHUNK=3;p.TYPE_SECTION=4;(function(){this.isRoot=
function(){return this.scopeType==p.TYPE_ROOT};this.isBrace=function(){return this.scopeType==p.TYPE_BRACE};this.isChunk=function(){return this.scopeType==p.TYPE_CHUNK};this.isSection=function(){return this.scopeType==p.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,n){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,n);return b?
b:n==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,h){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==h)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>=h(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,h,d){"undefined"===typeof h&&(h=0);"undefined"===typeof d&&(d=this.$children.length);if(h===d)return-(h+1);var b=Math.floor((h+d)/2),c=this.$children[b].comparePosition(a);return 0===c?b:0>c?this.$binarySearch(a,h,b):this.$binarySearch(a,b+1,d)};this.comparePosition=function(a){return 0>h(a,
this.preamble)?-1:null!=this.end&&0<=h(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(p.prototype);a=function(a){this.$ScopeNodeFactory=a||p;this.parsePos={row:0,column:0};this.$root=new this.$ScopeNodeFactory("(Top Level)",this.parsePos,null,p.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,p.TYPE_SECTION);break}}a=new this.$ScopeNodeFactory(a,b,b,p.TYPE_SECTION,c);this.$root.addNode(a)};this.onSectionEnd=function(a){this.$root.closeScope(a,p.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,p.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,p.TYPE_SECTION,{depth:e,isMarkdown:f}))};this.onChunkStart=function(a,b,c,e){this.$root.closeScope(c,p.TYPE_CHUNK);b=new this.$ScopeNodeFactory(b,e,c,p.TYPE_CHUNK);b.chunkLabel=a;this.$root.addNode(b);this.printScopeTree()};this.onChunkEnd=function(a){a=this.$root.closeScope(a,p.TYPE_CHUNK);this.printScopeTree();return a};this.onFunctionScopeStart=function(a,b,c,e,f){this.$root.addNode(new this.$ScopeNodeFactory(a,c,b,p.TYPE_BRACE,{name:e,args:f}));this.printScopeTree()};this.onNamedScopeStart=
function(a,b){this.$root.addNode(new this.$ScopeNodeFactory(a,b,null,p.TYPE_BRACE))};this.onScopeStart=function(a){this.$root.addNode(new this.$ScopeNodeFactory(null,a,null,p.TYPE_BRACE));this.printScopeTree()};this.onScopeEnd=function(a){a=this.$root.closeScope(a,p.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<h(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=[];n(this.$root,a);return a};var n=function(a,b){a.isFunction()&&
b.push(a);for(var c=a.$children,e=0;e<c.length;e++)n(c[e],b)}}).call(a.prototype);m.ScopeManager=a;m.ScopeNode=p});var $rainbowParentheses=!1,$numParenColors=7;
define("mode/rainbow_paren_highlight_rules",["require","exports","module"],function(a,m,k){a=function(){};m.RainbowParenHighlightRules=a;m.setRainbowParentheses=function(a){$rainbowParentheses=a};m.getRainbowParentheses=function(){return $rainbowParentheses};m.setNumParenColors=function(a){$numParenColors=a};a.getParenRule=function(){return{token:"paren.keyword.operator.nomatch",regex:"[[({})\\]]",merge:!1,onMatch:function(a,p,f){if(!$rainbowParentheses)return this.token="paren.keyword.operator.nomatch";
f=f||[];f[0]=p;f[1]=f[1]||0;switch(a){case "[":case "{":case "(":this.token="paren.paren_color_"+f[1]%$numParenColors;f[1]+=1;break;case "]":case "}":case ")":f[1]=Math.max(0,f[1]-1),this.token="paren.paren_color_"+f[1]%$numParenColors}return this.token},next:"start"}}});define("mode/rdoc",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");var h=a("ace/mode/text").Mode,p=a("ace/tokenizer").Tokenizer,f=a("ace/mode/text_highlight_rules").TextHighlightRules,n=a("mode/rdoc_highlight_rules").RDocHighlightRules,d=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent;a=function(a){a?(this.$highlightRules=new f,this.$tokenizer=new p((new f).getRules())):(this.$highlightRules=new n,this.$tokenizer=new p((new n).getRules()));this.$outdent=new d};k.inherits(a,
h);(function(){this.getNextLineIndent=function(a,c,e){return this.$getIndent(c)}}).call(a.prototype);m.Mode=a});define("mode/rdoc_highlight_rules",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");a("ace/lib/lang");a=a("ace/mode/text_highlight_rules").TextHighlightRules;var h=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+"}]}};k.inherits(h,a);m.RDocHighlightRules=h});define("mode/rhtml",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");var h=a("ace/mode/html").Mode,p=a("ace/tokenizer").Tokenizer,f=a("mode/rhtml_highlight_rules").RHtmlHighlightRules,n=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 p((new f).getRules());this.codeModel=new n(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};k.inherits(a,h);(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,g){return"r"===c.activeMode(a,"html")?this.codeModel.getNextLineIndent(a,b,d,g):this.$getNextLineIndent(a,b,d)};this.$id="mode/rhtml"}).call(a.prototype);m.Mode=a});define("mode/rhtml_highlight_rules",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");var h=a("mode/r_highlight_rules").RHighlightRules,p=a("ace/mode/html_highlight_rules").HtmlHighlightRules;a=a("ace/mode/text_highlight_rules").TextHighlightRules;var f=function(){this.$rules=(new p).getRules();this.$rules.start.unshift({token:"support.function.codebegin",regex:"^\x3c!--\\s*begin.rcode\\s*(?:.*)",next:"r-start"});var a=(new h).getRules();this.addRules(a,"r-");this.$rules["r-start"].unshift({token:"support.function.codeend",
regex:"^\\s*end.rcode\\s*--\x3e",next:"start"})};k.inherits(f,a);m.RHtmlHighlightRules=f});define("mode/rmarkdown",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");var h=a("mode/markdown").Mode,p=a("ace/tokenizer").Tokenizer,f=a("mode/rmarkdown_highlight_rules").RMarkdownHighlightRules,n=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,r=a("mode/python").Mode,q=a("rstudio/folding/rmarkdown").FoldMode,
g=a("ace/mode/folding/cstyle").FoldMode;a("mode/auto_brace_insert");var l=a("mode/utils"),w=a("ace/unicode");a=function(a,h){var k=this;this.$session=h;this.$tokenizer=new p((new f).getRules());this.$outdent=new n;this.codeModel=new c(h,this.$tokenizer,/^r-/,new RegExp(f.prototype.$reChunkStartString),new RegExp(f.prototype.$reChunkEndString));this.$r_outdent=new d(this.codeModel);this.cpp_codeModel=new e(h,this.$tokenizer,/^r-cpp-/,new RegExp(f.prototype.$reCppChunkStartString),new RegExp(f.prototype.$reChunkEndString));
this.$cpp_outdent=new b(this.cpp_codeModel);this.$python=new r;var m=new q,w=new g;this.$tokenizer.getLineTokens=function(a,b,c){0===c&&(b="firstLine");return p.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||l.startsWith(d,"```")||0===c?m.getFoldWidget(a,b,c):"C_CPP"===e?w.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||l.startsWith(d,"```")||0===c?m.getFoldWidgetRange(a,b,c):"C_CPP"===e?w.getFoldWidgetRange(a,b,c):k.codeModel.getFoldWidgetRange(a,b,c)}}};k.inherits(a,h);(function(){function a(a){return l.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=l.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,g){var f=a(b);return"r"===f?this.codeModel.getNextLineIndent(b,c,e,d):"r-cpp"===f?this.cpp_codeModel.getNextLineIndent(b,c,e,d,g):"yaml"===f?this.$getIndent(this.$session.getLine(d+1)):"python"===f?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.transformAction=function(b,c,e,d,g){var f=a(b);return"markdown"===f?this.transformActionMarkdown(b,c,e,d,g):"r-cpp"===f?this.transformActionCpp(b,
c,e,d,g):"yaml"===f?this.transformActionYaml(b,c,e,d,g):"python"===f?this.$python.transformAction(b,c,e,d,g):!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("^["+w.wordChars+"._]+","g");this.nonTokenRe=new RegExp("^(?:[^"+w.wordChars+"._]|\\s)+","g");this.allowAutoInsert=this.smartAllowAutoInsert;this.$id="mode/rmarkdown"}).call(a.prototype);m.Mode=a});define("rstudio/folding/rmarkdown",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");var h=a("ace/mode/folding/fold_mode").FoldMode,p=a("ace/range").Range;m=m.FoldMode=function(){};var f=a("mode/utils");k.inherits(m,h);(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(f.startsWith(e,"===")||f.startsWith(e,"---")||f.startsWith(e,"..."))return f.startsWith(a,"yaml")?b:"start";if("start"===
d&&f.startsWith(e,"#"))return"start";a=e.trim();return f.startsWith(a,"```")?"start"===d?b:"start":""};var a=function(a,b,c,e,h){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 g=0<b?a.getLength():0;c!==g;){var l=a.getLine(c).trim();if(f.startsWith(l,e))break;if(h&&f.startsWith(l,h))break;c+=b}e={row:c,column:0};-1===b&&(e.column=a.getLine(c).length);return 1===b?p.fromPoints(d,e):p.fromPoints(e,d)};this.$getFoldWidgetRange=function(d,b,c){var e=
d.getState(c);b=d.getLine(c);var h=b.trim();if(f.startsWith(b,"```"))return a(d,e,c,"```");var n=0<c?d.getState(c-1):"start";h=0===c&&"---"===h;n=f.startsWith(n,"yaml");if(h||n)return a(d,e,c,"---",h?"...":void 0);if("="===b[0])n=1;else if("-"===b[0])n=2;else{n=/^(#+)(?:.*)$/.exec(b);if(!n)return;n=n[1].length}if(null!==n){a:{h=d.getLength();for(var g=c+1;g<h;g++)if(d.getState(g)===e){var l=d.getLine(g);if(1===n&&/^[=]{3,}\s*/.test(l)){e=g-2;break a}if(2===n&&/^[-]{3,}\s*/.test(l)){e=g-2;break a}if((l=
/^(#+)(?:.*)$/.exec(l))&&l[1].length<=n){e=g-1;break a}}e=h}return new p(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(m.prototype)});define("mode/rmarkdown_highlight_rules",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");var h=a("mode/r_highlight_rules").RHighlightRules,p=a("mode/c_cpp_highlight_rules").c_cppHighlightRules,f=a("ace/mode/perl_highlight_rules").PerlHighlightRules,n=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,
r=a("mode/sh_highlight_rules").ShHighlightRules,q=a("mode/stan_highlight_rules").StanHighlightRules,g=a("mode/sql_highlight_rules").SqlHighlightRules,l=a("ace/mode/javascript_highlight_rules").JavaScriptHighlightRules,w=a("mode/utils");a=function(){this.$rules=(new b).getRules();this.$rules.firstLine=this.$rules.allowBlock.slice();w.embedRules(this,h,"r",this.$reChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);w.embedRules(this,p,"r-cpp",this.$reCppChunkStartString,this.$reChunkEndString,
["start","listblock","allowBlock"]);w.embedRules(this,f,"perl",this.$rePerlChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);w.embedRules(this,n,"python",this.$rePythonChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);w.embedRules(this,d,"ruby",this.$reRubyChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);w.embedRules(this,b,"markdown",this.$reMarkdownChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);
w.embedRules(this,r,"sh",this.$reShChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);w.embedRules(this,q,"stan",this.$reStanChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);w.embedRules(this,g,"sql",this.$reSqlChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);w.embedRules(this,l,"js",this.$reJavaScriptChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);w.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()};k.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)")}).call(a.prototype);m.RMarkdownHighlightRules=a});define("mode/sh",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");var h=a("ace/mode/text").Mode,p=a("mode/sh_highlight_rules").ShHighlightRules,f=a("ace/range").Range,n=a("ace/mode/folding/cstyle").FoldMode,d=a("ace/mode/behaviour/cstyle").CstyleBehaviour;a=function(){this.HighlightRules=p;this.foldingRules=new n;this.$behaviour=new d};k.inherits(a,h);(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 f(d,a.length-c.length,d,a.length))};this.$id="mode/sh"}).call(a.prototype);m.Mode=a});define("mode/sh_highlight_rules",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");a=a("ace/mode/text_highlight_rules").TextHighlightRules;var h=m.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",p=m.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",
f=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:h,
"support.function.builtin":p,"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()};k.inherits(f,a);m.ShHighlightRules=f});define("mode/sql",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");var h=a("ace/mode/text").Mode,p=a("mode/sql_highlight_rules").SqlHighlightRules;a("ace/range");a=function(){this.HighlightRules=p};k.inherits(a,h);a.prototype.lineCommentStart="--";a.prototype.$id="mode/sql";m.Mode=a});define("mode/sql_highlight_rules",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");a("ace/lib/lang");a=a("ace/mode/text_highlight_rules").TextHighlightRules;var h=function(){this.$rules={start:[{token:"comment",regex:"--.*$"},{token:"comment",start:"/\\*",end:"\\*/"},{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()};k.inherits(h,a);m.SqlHighlightRules=h});define("mode/stan",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");var h=a("ace/mode/text").Mode,p=a("ace/tokenizer").Tokenizer,f=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,n=a("mode/stan_highlight_rules").StanHighlightRules,d=a("ace/mode/folding/cstyle").FoldMode;a=function(){this.$highlightRules=new n;this.$tokenizer=new p(this.$highlightRules.getRules());this.$outdent=new f;this.foldingRules=new d};k.inherits(a,h);(function(){this.lineCommentStart=["//","#"];this.blockComment=
{start:"/*",end:"*/"};this.toggleCommentLines=function(a,c,e,d){var b=!0;a=/^(\s*)\/\//;for(var g=e;g<=d;g++)if(!a.test(c.getLine(g))){b=!1;break}if(b)for(b=new Range(0,0,0,0),g=e;g<=d;g++)e=c.getLine(g).match(a),b.start.row=g,b.end.row=g,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);m.Mode=a});define("mode/stan_highlight_rules",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");a("ace/lib/lang");a=a("ace/mode/text_highlight_rules").TextHighlightRules;var h=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:".+"}]}};k.inherits(h,a);m.StanHighlightRules=h});define("mode/sweave",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");var h=a("ace/mode/text").Mode,p=a("ace/tokenizer").Tokenizer,f=a("ace/mode/text_highlight_rules").TextHighlightRules,n=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"),r=a("mode/utils");a("mode/auto_brace_insert");a=function(a,e){this.$tokenizer=
a?new p((new f).getRules()):new p((new n).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};k.inherits(a,h);(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 r.getPrimaryState(this.$session,a.row).match(/^r-/)?"R":"TeX"};this.$getNextLineIndent=this.getNextLineIndent;this.getNextLineIndent=function(a,b,c,e){return"r"===r.activeMode(a,"tex")?this.codeModel.getNextLineIndent(a,b,c,e):this.$getNextLineIndent(a,b,c)};this.checkOutdent=function(a,b,c){return"r"===r.activeMode(a,"tex")?this.$r_outdent.checkOutdent(a,b,c):this.$outdent.checkOutdent(b,
c)};this.autoOutdent=function(a,b,c){return"r"===r.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);m.Mode=a});define("mode/sweave_highlight_rules",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");var h=a("mode/tex_highlight_rules").TexHighlightRules,p=a("mode/r_highlight_rules").RHighlightRules;a=a("ace/mode/text_highlight_rules").TextHighlightRules;var f=function(){this.$rules=(new h).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 p).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"})};k.inherits(f,a);m.SweaveHighlightRules=f});define("mode/tex",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");var h=a("ace/mode/text").Mode,p=a("ace/tokenizer").Tokenizer,f=a("ace/mode/text_highlight_rules").TextHighlightRules,n=a("mode/tex_highlight_rules").TexHighlightRules,d=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent;a=function(a){this.$tokenizer=a?new p((new f).getRules()):new p((new n).getRules());this.$outdent=new d};k.inherits(a,h);(function(){this.getNextLineIndent=function(a,c,e){return this.$getIndent(c)};
this.allowAutoInsert=function(){return!1}}).call(a.prototype);m.Mode=a});define("mode/tex_highlight_rules",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");a("ace/lib/lang");a=a("ace/mode/text_highlight_rules").TextHighlightRules;var h=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+"}]}};k.inherits(h,a);m.TexHighlightRules=h});define("mode/token_cursor",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");var h=a("mode/utils"),p=h.getTokenTypeRegex("paren"),f=function(a,c,e){this.$tokens=a;this.$row=c||0;this.$offset=e||0};(function(){this.cloneCursor=function(){return new f(this.$tokens,this.$row,this.$offset)};var a=h.isArray,c=h.contains,e={"(":")","{":"}","<":">","[":"]",")":"(","}":"{",">":"<","]":"["},d=["(","[","{"],n=[")","]","}"];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(n,a))return!1;for(var b=e[a],d=0;this.moveToPreviousToken();){var f=this.currentValue();if(f===b){if(0===d)return!0;d--}else f===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 h=this.currentValue();if(h===b){if(0===f)return!0;f--}else h===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 g=0;g<d.length&&!(d[g].column>=e);g++);this.$row=c;this.$offset=g===d.length?g-1:b&&d[g].column===e?g:g-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 g=0;g<b.length;g++)if(d===b[g])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 g=e.currentValue();","===g&&(d+=1);if(c&&"{"===
g)break;for(var f=0;f<b.length;f++)if(g===b[f])return this.$row=e.$row,this.$offset=e.$offset,d}while(e.moveToPreviousToken());return-1}}).call(f.prototype);var n=function(a,c,e,d){this.$tokens=a;this.$row=c||0;this.$offset=e||0;this.$codeModel=d};k.mixin(n.prototype,f.prototype);(function(){this.cloneCursor=function(){return new n(this.$tokens,this.$row,this.$offset,this.$codeModel)};var a=h.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(n.prototype);var d=function(a,c,e,d){this.$tokens=a;this.$row=c||0;this.$offset=e||0;this.$codeModel=d};k.mixin(d.prototype,f.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=h.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(p)?e(c):a(c)||this.hasType("identifier","constant","variable")};this.isValidForStartOfStatement=function(){var b=
this.currentType();this.currentValue();if(-1!==b.search(p))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);m.TokenCursor=f;m.CppTokenCursor=n;m.RTokenCursor=d});define("mode/token_utils",["require","exports","module"],function(a,m,k){a=function(a,p,f,n,d,b){this.$doc=a;this.$tokenizer=p;this.$tokens=f;this.$endStates=Array(a.getLength());this.$statePattern=n;this.$codeBeginPattern=d;this.$codeEndPattern=b};(function(){this.getTokenForPos=function(a,p,f){this.$tokenizeUpToRow(a.row);if(this.$tokens.length<=a.row)return null;for(var h=this.$tokens[a.row],d=0;d<h.length;d++){var b=h[d];if(p&&a.column==b.column)return b;if(a.column<=b.column)break;if(f&&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 h=0,f=!0;h<=a;h++)if(!f||!this.$endStates[h]){f=!1;var n=0===h?"start":this.$endStates[h-1],d=this.$doc.getLine(h);d=this.$tokenizer.getLineTokens(d,n,h);!this.$statePattern||this.$statePattern.test(d.state)||this.$statePattern.test(n)?this.$tokens[h]=this.$filterWhitespaceAndComments(d.tokens):this.$tokens[h]=[];d.state===this.$endStates[h]?
f=!0:this.$endStates[h]=d.state}f||h<this.$tokens.length&&this.$invalidateRow(h);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 h=a.length-1;0<=h;h--)if(1<a[h].value.length&&/\bparen\b/.test(a[h].type)){var f=a[h];a.splice(h,1);for(var n=f.value.length-1;0<=n;n--){var d={type:f.type,value:f.value.charAt(n),
column:f.column+n};a.splice(h,0,d)}}return a};this.$invalidateRow=function(a){this.$tokens[a]=null;this.$endStates[a]=null};this.$insertNewRows=function(a,k){for(var f=[a,0],h=0;h<k;h++)f.push(null);this.$tokens.splice.apply(this.$tokens,f);this.$endStates.splice.apply(this.$endStates,f)};this.$removeRows=function(a,k){this.$tokens.splice(a,k);this.$endStates.splice(a,k)};this.$walkParens=function(a,k,f){var h=/\bparen\b/;return a<k?function(){for(;a<=k;a++)for(var d=this.$tokens[a],b=0;b<d.length;b++)if(h.test(d[b].type)&&
!f(d[b].value,{row:a,column:d[b].column}))return!1;return!0}.call(this):function(){a=Math.max(0,a);for(k=Math.max(0,k);a>=k;a--)for(var d=this.$tokens[a],b=d.length-1;0<=b;b--)if(h.test(d[b].type)&&!f(d[b].value,{row:a,column:d[b].column}))return!1;return!0}.call(this)};this.$walkParensBalanced=function(a,k,f,n,d){var b=[],c=null;this.$walkParens(a,k,function(a,h){if(f&&f(b,a,h))return c=h,!1;if(/[\[({]/.test(a))if(b[b.length-1]===d[a])b.pop();else return!0;else b.push(a);return n&&n(b,a,h)?(c=h,
!1):!0});return c};this.$findNextSignificantToken=function(a,k){if(0==this.$tokens.length)return null;k=Math.min(k,this.$tokens.length-1);for(var f=a.row,h=a.column;f<=k;f++){for(var d=this.$tokens[f],b=0;b<d.length;b++)if(d[b].column+d[b].value.length>h)return{token:d[b],row:f,column:Math.max(d[b].column,h),offset:b};h=0}return null};this.findNextSignificantToken=function(a){return this.$findNextSignificantToken(a,this.$tokens.length-1)};this.$findPreviousSignificantToken=function(a,k){if(0==this.$tokens.length)return null;
k=Math.max(0,k);for(var f=Math.min(a.row,this.$tokens.length-1);f>=k;f--){var h=this.$tokens[f];if(0!=h.length){if(f!=a.row)return{row:f,column:h[h.length-1].column,token:h[h.length-1],offset:h.length-1};for(var d=h.length-1;0<=d;d--)if(h[d].column<a.column)return{row:f,column:h[d].column,token:h[d],offset:d}}}return null}}).call(a.prototype);m.TokenUtils=a});define("mode/utils",["require","exports","module"],function(a,m,k){a("ace/range");var h=a("ace/token_iterator").TokenIterator,p=a("ace/unicode");(function(){var a=this,k=new RegExp("^["+p.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,h,g,l){"undefined"===typeof g&&(g=["start"]);"undefined"===typeof l&&(l="start");g=a.asArray(g);l=b.$rules;for(var e=function(a,b,c,d){c.splice(0);return this.token},k=0;k<g.length;k++)l[g[k]].unshift({token:"support.function.codebegin",regex:f,onMatch:e,next:d+"-start"});b.embedRules(c,d+"-",[{token:"support.function.codeend",regex:h,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 h(a,b.row,b.column)};this.isWordCharacter=function(a){return k.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(m)});define("mode/xml",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");var h=a("ace/mode/text").Mode,p=a("ace/tokenizer").Tokenizer,f=a("mode/xml_highlight_rules").XmlHighlightRules,n=a("mode/xml_behavior").XmlBehaviour,d=a("mode/xml_fold_mode").FoldMode;a=function(){this.$tokenizer=new p((new f).getRules());this.$behaviour=new n;this.foldingRules=new d};k.inherits(a,h);(function(){this.getNextLineIndent=function(a,c,d){return this.$getIndent(c)}}).call(a.prototype);m.Mode=a});define("mode/xml_behavior",["require","exports","module"],function(a,m,k){function h(a,b){var c=!0,d=a.type.split(".");b.split(".").forEach(function(a){if(-1==d.indexOf(a))return c=!1});return c}k=a("ace/lib/oop");var p=a("ace/mode/behaviour").Behaviour,f=a("ace/mode/behaviour/cstyle").CstyleBehaviour,n=a("ace/token_iterator").TokenIterator;a=function(){this.inherit(f,["string_dquotes"]);this.add("autoclosing","insertion",function(a,b,c,e,f){if(">"==f){a=c.getCursorPosition();c=new n(e,a.row,a.column);
e=c.getCurrentToken();b=!1;if(e&&(h(e,"meta.tag")||h(e,"text")&&e.value.match("/")))b=!0;else{do e=c.stepBackward();while(e&&(h(e,"string")||h(e,"keyword.operator")||h(e,"entity.attribute-name")||h(e,"text")))}if(e&&h(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]}})};k.inherits(a,p);m.XmlBehaviour=a});define("mode/xml_fold_mode",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");var h=a("ace/lib/lang"),p=a("ace/range").Range,f=a("ace/mode/folding/fold_mode").FoldMode,n=a("ace/token_iterator").TokenIterator;a=m.FoldMode=function(a){f.call(this);this.voidElements=a||{}};k.inherits(a,f);(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 k=c[f];d=0===k.type.indexOf("meta.tag")?d+k.value:d+h.stringRepeat(" ",k.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 n(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,p.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,p.fromPoints(c.start,
d)}else for(a=new n(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,p.fromPoints(c.start,c.end);if(c.closing){if(this._pop(b,c),0==b.length)return p.fromPoints(d,c.start)}else b.push(c)}}}).call(a.prototype)});define("mode/xml_highlight_rules",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");var h=a("mode/xml_util");a=a("ace/mode/text_highlight_rules").TextHighlightRules;var p=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:".+"}]};h.tag(this.$rules,"tag","start")};k.inherits(p,a);m.XmlHighlightRules=p});define("mode/xml_util",["require","exports","module"],function(a,m,k){function h(a,f){return[{token:"string",merge:!0,regex:".*?"+a,next:f},{token:"string",merge:!0,regex:".+"}]}m.tag=function(a,f,k,d){a[f]=[{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:f+"_embed_attribute_list"},{token:"empty",regex:"",next:f+"_embed_attribute_list"}];a[f+"_qstring"]=h("'",f+"_embed_attribute_list");a[f+"_qqstring"]=
h('"',f+"_embed_attribute_list");a[f+"_embed_attribute_list"]=[{token:"meta.tag",merge:!0,regex:"/?>",next:k},{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:f+"_qqstring"},{token:"string",regex:"'.*?'"},{token:"string",merge:!0,regex:"['].*",next:f+"_qstring"}])}});define("mode/yaml",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");var h=a("ace/mode/text").Mode,p=a("mode/yaml_highlight_rules").YamlHighlightRules,f=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,n=a("ace/mode/folding/coffee").FoldMode;a=function(){this.HighlightRules=p;this.$outdent=new f;this.foldingRules=new n;this.$behaviour=this.$defaultBehaviour};k.inherits(a,h);(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);m.Mode=a});define("mode/yaml_highlight_rules",["require","exports","module"],function(a,m,k){k=a("ace/lib/oop");a=a("ace/mode/text_highlight_rules").TextHighlightRules;var h=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,f,h,d){a=/^\s*/.exec(d)[0];h.length=2;h[0]=f;h[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,f,h){h[1]>=a.length?(this.next=h[0],h.splice(0)):this.next=f;return this.token},next:"mlString"},
{token:"string",regex:".+"}]};this.normalizeRules()};k.inherits(h,a);m.YamlHighlightRules=h});define("theme/default",["require","exports","module"],function(a,m,k){a("ace/lib/dom");m.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,m,k){var h=a("ace/edit_session").EditSession,p=a("ace/editor").Editor;a("ace/lib/event_emitter");a("util/expand_selection");var f=a("ace/range").Range,n=a("ace/virtual_renderer").VirtualRenderer,d=a("ace/mode/text").Mode,b=a("ace/undomanager").UndoManager,c=a("mode/utils");a("ace/lib/event");k=a("ace/lib/oop");a("mixins/token_iterator");var e=function(a,b){p.call(this,a,b);this.setBehavioursEnabled(!0)};k.inherits(e,p);(function(){this.$highlightBrackets=
function(){this.session.$bracketHighlight&&(this.session.removeMarker(this.session.$bracketHighlight),this.session.$bracketHighlight=null);this.session.selection.isEmpty()&&p.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 p.prototype.insert.call(this,a,b)};this.remove=function(a){return this.session.getMode().wrapRemove?this.session.getMode().wrapRemove(this,p.prototype.remove,a):p.prototype.remove.call(this,a)};this.undo=function(){p.prototype.undo.call(this);this._dispatchEvent("undo")};
this.redo=function(){p.prototype.redo.call(this);this._dispatchEvent("redo")};this.onPaste=function(a,b){p.prototype.onPaste.call(this,a.replace(/\r\n|\n\r|\r/g,"\n"),b)}}).call(e.prototype);var r=function(a,b){h.call(this,a,b)};k.inherits(r,h);(function(){this.insert=function(a,b){return this.getMode().wrapInsert?this.getMode().wrapInsert(this,h.prototype.insert,a,b):h.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 f(a,0,a,c),b)};this.setDisableOverwrite=
function(a){a?(this.setOverwrite(!1),this.setOverwrite=function(){},this.getOverwrite=function(){return!1}):(this.setOverwrite=h.prototype.setOverwrite,this.getOverwrite=h.prototype.getOverwrite)}}).call(r.prototype);var q=function(){b.call(this)};k.inherits(q,b);(function(){this.peek=function(){return this.$undoStack.length?this.$undoStack[this.$undoStack.length-1]:null}}).call(q.prototype);var g=function(a,b){n.call(this,a,b)};k.inherits(g,n);(function(){this.setTheme=function(a){a&&n.prototype.setTheme.call(this,
a)}}).call(g.prototype);m.RStudioEditor=e;m.loadEditor=function(b){function c(a){f.editor.commands.removeCommand(a)}var f={};b.env=f;b=new g(b,"");var h=new r("");b=new e(b,h);f.editor=b;h=b.getSession();h.setMode(new d);h.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,m,k){m.toSnippetText=function(a){for(var h=a.length,f="",k=0;k<h;k++){var d=a[k];f+="snippet "+d.name+"\n\t"+d.content.replace(/\n/g,"\n\t")+"\n\n"}return f};m.normalizeSnippets=function(a){for(var h=a.length,f=0;f<h;f++){var k=a[f];null==k.tabTrigger&&(k.tabTrigger=k.name);k.content=k.content.replace("\n    ","\n\t")}}});define("rstudio/snippets/c_cpp",["require","exports","module"],function(a,m,k){k=a("rstudio/snippets");a=a("ace/snippets").snippetManager;var h=[{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"}];k.normalizeSnippets(h);m.snippetText=k.toSnippetText(h);a.register(h,"c_cpp")});define("rstudio/snippets/markdown",["require","exports","module"],function(a,m,k){k=a("rstudio/snippets");a=a("ace/snippets").snippetManager;var h=[{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```"}];k.normalizeSnippets(h);m.snippetText=k.toSnippetText(h);a.register(h,"markdown")});define("rstudio/snippets/r",["require","exports","module"],function(a,m,k){k=a("rstudio/snippets");a=a("ace/snippets").snippetManager;var h=[{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} <- function(input, output, session) {\n  \n}"}];k.normalizeSnippets(h);m.snippetText=k.toSnippetText(h);a.register(h,
"r")});define("rstudio/snippets/stan",["require","exports","module"],function(a,m,k){k=a("rstudio/snippets");a=a("ace/snippets").snippetManager;var h=[{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}"}];k.normalizeSnippets(h);m.snippetText=k.toSnippetText(h);a.register(h,"stan")});define("rstudio/snippets/yaml",["require","exports","module"],function(a,m,k){k=a("rstudio/snippets");a=a("ace/snippets").snippetManager;var h=[{name:"key",content:"${1:key}: ${2:value}"},{name:"list",content:"${1:key}:\n  - ${2:value1}\n  - ${3:value2}"}];k.normalizeSnippets(h);m.snippetText=k.toSnippetText(h);a.register(h,"yaml")});