define("mixins/token_iterator",["require","exports","module"],function(b){var k=b("ace/token_iterator").TokenIterator,i=b("ace/range").Range;(function(){function b(a,d,c,e,l){for(var n=1,p,o=a.clone();p=c.call(o);)if(p=d(p),p===l){if(n--,0===n)return a.moveToTokenIterator(o),!0}else p===e&&n++;return!1}var g={"(":")","{":"}","[":"]","<":">",")":"(","}":"{","]":"[",">":"<"};this.moveToPreviousToken=function(){var a=this.$rowTokens,d=this.$tokenIndex-1;if(0<=d)return this.$tokenIndex--,a[d];var d=this.$session,
c=this.$row;if(0>c)return null;for(;;){c--;if(0>c)return null;if((a=d.getTokens(c))&&a.length)return this.$row=c,this.$tokenIndex=a.length-1,this.$rowTokens=a,a[a.length-1]}};this.moveToNextToken=function(){var a=this.$rowTokens,d=this.$tokenIndex+1;if(d<a.length)return this.$tokenIndex++,a[d];var d=this.$session,c=d.getLength(),e=this.$row;if(e>=c)return null;for(;;){e++;if(e>=c)return null;if((a=d.getTokens(e))&&a.length)return this.$row=e,this.$tokenIndex=0,this.$rowTokens=a,a[0]}};this.moveToNextSignificantToken=
function(){if(!this.moveToNextToken())return!1;for(var a=this.getCurrentToken();/^\s+$/.test(a.value)||/\bcomment\b/.test(a.type);){if(!this.moveToNextToken())return!1;a=this.getCurrentToken()}return!0};this.moveToPreviousSignificantToken=function(){if(!this.moveToPreviousToken())return!1;for(var a=this.getCurrentToken();/^\s+$/.test(a.value)||/\bcomment\b/.test(a.type);){if(!this.moveToPreviousToken())return!1;a=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 a=this.$row,d=this.$session,c=d.getLength();;){a++;if(a>=c)return null;var e=d.getTokens(a);if(e&&e.length)return this.$row=a,this.$tokenIndex=0,this.$rowTokens=e,this.getCurrentToken()}};var f,j=0,c=0;this.tokenizeUpToRow=function(a){var d=this.$session.bgTokenizer;j=Math.min(j,d.currentLine);c=Math.max(c,a);
for(var h=d.currentLine;h<=a;h++)d.$tokenizeRow(h);clearTimeout(f);f=setTimeout(function(){d.fireUpdateEvent(j,c);j=c;c=0},700)};this.moveToPosition=function(a,d){this.tokenizeUpToRow(a.row);var c=this.$session.getTokenAt(a.row,a.column);c&&d&&c.column<a.column&&(c=this.$session.getTokenAt(a.row,a.column+1));if(null==c){if(d)return this.$row=a.row,this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=this.$rowTokens.length-1,this.moveToNextToken();this.$row=a.row+1;this.$tokenIndex=
0;this.$rowTokens=this.$session.getTokens(this.$row);return this.moveToPreviousToken()}this.$row=a.row;this.$rowTokens=this.$session.getTokens(this.$row);this.$tokenIndex=c.index;return this.getCurrentToken()};this.clone=function(){var a=new k(this.$session,0,0);a.moveToTokenIterator(this);return a};this.moveToTokenIterator=function(a){for(var d in a)a.hasOwnProperty(d)&&(this[d]=a[d])};this.peekFwd=function(a){for(var d=this.clone(),c=null,e=0;e<a;e++)c=d.moveToNextToken();return c};this.peekBwd=
function(a){for(var d=this.clone(),c=null,e=0;e<a;e++)c=d.moveToPreviousToken();return c};this.getCurrentToken=function(){var a=this.$rowTokens[this.$tokenIndex];a&&(a.row=this.$row);return a};this.getCurrentTokenValue=function(){return this.getCurrentToken().value};this.getCurrentTokenPosition=function(){return{row:this.getCurrentTokenRow(),column:this.getCurrentTokenColumn()}};this.getCurrentTokenRange=function(){var a=this.getCurrentTokenPosition(),d={row:a.row,column:a.column+this.getCurrentToken().value.length};
return i.fromPoints(a,d)};this.fwdToMatchingToken=function(){var a=this.getCurrentToken();return 1===a.value.length&&("{"===a.value||"("===a.value||"["===a.value||"<"===a.value)?b(this,function(a){return a.value},this.moveToNextToken,a.value,g[a.value]):"support.function.codebegin"===a.type?b(this,function(a){return a.type},this.moveToNextToken,"support.function.codebegin","support.function.codeend"):!1};this.bwdToMatchingToken=function(){var a=this.getCurrentToken();return 1===a.value.length&&("}"===
a.value||")"===a.value||"]"===a.value||">"===a.value)?b(this,function(a){return a.value},this.moveToPreviousToken,a.value,g[a.value]):"support.function.codeend"===a.type?b(this,function(a){return a.type},this.moveToPreviousToken,"support.function.codeend","support.function.codebegin"):!1};this.findTokenBwd=function(a,d){d=!!d;do if((!d||!this.bwdToMatchingToken())&&this.getCurrentToken().value===a)return!0;while(this.moveToPreviousToken());return!1};this.findTokenFwd=function(a,d){d=!!d;do if((!d||
!this.fwdToMatchingToken())&&this.getCurrentToken().value===a)return!0;while(this.moveToNextToken());return!1}}).call(k.prototype)});define("ace/token_tooltip",["require","exports","module"],function(b,k){function i(c){c.tokenTooltip||(j.call(this,c.container),c.tokenTooltip=this,this.editor=c,this.update=this.update.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onMouseOut=this.onMouseOut.bind(this),g.addListener(c.renderer.scroller,"mousemove",this.onMouseMove),g.addListener(c.renderer.content,"mouseout",this.onMouseOut))}b("ace/lib/dom");var m=b("ace/lib/oop"),g=b("ace/lib/event"),f=b("ace/range").Range,j=b("ace/tooltip").Tooltip;
m.inherits(i,j);(function(){this.token={};this.range=new f;this.update=function(){this.$timer=null;var c=this.editor.renderer;if(1E3<this.lastT-(c.timeStamp||0))c.rect=null,c.timeStamp=this.lastT,this.maxHeight=window.innerHeight,this.maxWidth=window.innerWidth;var a=c.rect||(c.rect=c.scroller.getBoundingClientRect()),d=Math.floor((this.y+c.scrollTop-a.top)/c.lineHeight),a=Math.round((this.x+c.scrollLeft-a.left-c.$padding)/c.characterWidth),c=this.editor.session,d=c.screenToDocumentPosition(d,a),
a=c.getTokenAt(d.row,d.column);!a&&!c.getLine(d.row)&&(a={type:"",value:"",state:c.bgTokenizer.getState(0)});if(a){var h=a.type;a.state&&(h+="|"+a.state);a.merge&&(h+="\n  merge");a.stateTransitions&&(h+="\n  "+a.stateTransitions.join("\n  "));this.tokenText!=h&&(this.setText(h),this.width=this.getWidth(),this.height=this.getHeight(),this.tokenText=h);this.show(null,this.x,this.y);this.token=a;c.removeMarker(this.marker);this.range=new f(d.row,a.start,d.row,a.start+a.value.length);this.marker=c.addMarker(this.range,
"ace_bracket","text")}else c.removeMarker(this.marker),this.hide()};this.onMouseMove=function(c){this.x=c.clientX;this.y=c.clientY;this.isOpen&&(this.lastT=c.timeStamp,this.setPosition(this.x,this.y));this.$timer||(this.$timer=setTimeout(this.update,100))};this.onMouseOut=function(c){if(!c||!c.currentTarget.contains(c.relatedTarget))this.hide(),this.editor.session.removeMarker(this.marker),this.$timer=clearTimeout(this.$timer)};this.setPosition=function(c,a){c+10+this.width>this.maxWidth&&(c=window.innerWidth-
this.width-10);if(a>0.75*window.innerHeight||a+20+this.height>this.maxHeight)a=a-this.height-30;j.prototype.setPosition.call(this,c+10,a+20)};this.destroy=function(){this.onMouseOut();g.removeListener(this.editor.renderer.scroller,"mousemove",this.onMouseMove);g.removeListener(this.editor.renderer.content,"mouseout",this.onMouseOut);delete this.editor.tokenTooltip}}).call(i.prototype);k.TokenTooltip=i});define("mode/auto_brace_insert",["require","exports","module"],function(b,k){var i=b("ace/range").Range,m=b("ace/mode/text").Mode;(function(){this.$complements={"(":")","[":"]",'"':'"',"{":"}"};this.$reOpen=/^[(["{]$/;this.$reClose=/^[)\]"}]$/;this.$reStop=/^[;,\s)\]}]$/;this.wrapInsert=function(b,f,j,c){if(!this.insertMatching)return f.call(b,j,c);var a=b.selection.getCursor();if(a=b.selection.isEmpty()&&j.row==a.row&&j.column==a.column){var d=i.fromPoints(j,{row:j.row,column:j.column+1}),h=b.doc.getTextRange(d);
if(this.$reClose.test(h)&&h==c){b.selection.moveCursorTo(d.end.row,d.end.column,!1);return}}d=null;a&&(d=this.$moveLeft(b.doc,j),d=b.doc.getTextRange(i.fromPoints(d,j)));f=f.call(b,j,c);if(a&&this.$reOpen.test(c)){if(j=i.fromPoints(f,{row:f.row,column:f.column+1}),j=b.doc.getTextRange(j),(this.$reStop.test(j)||0==j.length)&&this.allowAutoInsert(b,f,this.$complements[c]))b.doc.insert(f,this.$complements[c]),b.selection.moveCursorTo(f.row,f.column,!1)}else if(a&&"\n"===c&&(c=this.$moveRight(b.doc,f),
c=b.doc.getTextRange(i.fromPoints(f,c)),"{"===d&&"}"===c||"("===d&&")"===c||"["===d&&"]"===c))j=this.getIndentForOpenBrace?this.getIndentForOpenBrace(this.$moveLeft(b.doc,j)):this.$getIndent(b.doc.getLine(f.row-1)),b.doc.insert(f,"\n"+j),b.selection.moveCursorTo(f.row,f.column,!1);return f};this.allowAutoInsert=function(){return!0};this.smartAllowAutoInsert=function(b,f,j){return"'"!==j&&'"'!==j||0==f.column?!0:(b=this.codeModel.getTokenForPos(f,!1,!0))&&"string"===b.type&&b.column===f.column-1};
this.wrapRemove=function(b,f,j){var c=b.selection.getCursor(),a=b.session.getDocument();if(!this.insertMatching||"left"!=j||!b.selection.isEmpty()||b.$readOnly||0==c.column||a.getLine(c.row).length<=c.column)return f.call(b,j);var d=i.fromPoints(this.$moveLeft(a,c),c),c=i.fromPoints(c,this.$moveRight(a,c)),d=a.getTextRange(d),a=this.$reOpen.test(d)&&this.$complements[d]==a.getTextRange(c);f.call(b,j);a&&f.call(b,"right")};this.$moveLeft=function(b,f){if(0==f.row&&0==f.column)return f;var j=f.row,
c=f.column;c?c--:(j--,c=b.getLine(j).length);return{row:j,column:c}};this.$moveRight=function(b,f){var j=f.row,c=f.column;b.getLine(j).length!=c?c++:(j++,c=0);return j>=b.getLength()?f:{row:j,column:c}}}).call(m.prototype);k.setInsertMatching=function(b){m.prototype.insertMatching=b}});define("mode/c_cpp",["require","exports","module"],function(b,k){var i=b("ace/lib/oop"),m=b("ace/mode/text").Mode,g=b("ace/tokenizer").Tokenizer,f=b("ace/range").Range;b("mode/r_highlight_rules");var j=b("mode/c_cpp_highlight_rules").c_cppHighlightRules,c=b("mode/c_cpp_matching_brace_outdent").CppMatchingBraceOutdent,a=b("mode/behaviour/cstyle").CStyleBehaviour,d=null;window.NodeWebkit||(d=b("mode/c_cpp_fold_mode").FoldMode);var h=b("mode/r_code_model").RCodeModel,e=b("mode/r_matching_brace_outdent").RMatchingBraceOutdent,
l=b("mode/cpp_code_model").CppCodeModel;b("mode/token_cursor");var n=b("mode/utils"),p=function(b,p){this.$session=p;this.$doc=p.getDocument();this.$tokenizer=new g((new j).getRules());this.r_codeModel=new h(p,this.$tokenizer,/^r-/,/^\s*\/\*{3,}\s*([Rr])\s*$/,/^\s*\*+\//);this.$r_outdent=new e(this.r_codeModel);this.codeModel=new l(p,this.$tokenizer);this.$behaviour=new a(this.codeModel);this.$cpp_outdent=new c(this.codeModel);window.NodeWebkit||(this.foldingRules=new d);this.$tokens=this.codeModel.$tokens;
this.getLineSansComments=this.codeModel.getLineSansComments};i.inherits(p,m);(function(){this.wrapInsert=function(a,d,e,c){return this.cursorInRLanguageMode()?m.prototype.wrapInsert(a,d,e,c):d.call(a,e,c)};this.wrapRemove=function(a,d,e){return this.cursorInRLanguageMode()?m.prototype.wrapRemove(a,d,e):d.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,d,e,c){for(var l=!0,a=/^(\s*)\/\//,b=e;b<=c;b++)if(!a.test(d.getLine(b))){l=
!1;break}if(l){l=new f(0,0,0,0);for(b=e;b<=c;b++)e=d.getLine(b).match(a),l.start.row=b,l.end.row=b,l.end.column=e[0].length,d.replace(l,e[1])}else d.indentRows(e,c,"//")};this.getLanguageMode=function(a){return n.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){return a.match(/^r-/)};this.getNextLineIndent=function(a,d,e,c,l){a=n.primaryState(a);
return this.inRLanguageMode(a)?this.r_codeModel.getNextLineIndent(a,d,e,c):this.codeModel.getNextLineIndent(a,d,e,c,l)};this.checkOutdent=function(a,d,e){return this.inRLanguageMode(a)?this.$r_outdent.checkOutdent(a,d,e):this.$cpp_outdent.checkOutdent(a,d,e)};this.autoOutdent=function(a,d,e){return this.inRLanguageMode(a)?this.$r_outdent.autoOutdent(a,d,e,this.r_codeModel):this.$cpp_outdent.autoOutdent(a,d,e)};this.$transformAction=this.transformAction;this.transformAction=function(a,d,e,c,l){a=n.primaryState(a);
if(!this.inRLanguageMode(a))return this.$transformAction(a,d,e,c,l)};this.$id="mode/c_cpp"}).call(p.prototype);k.Mode=p});define("mode/c_cpp_fold_mode",["require","exports","module"],function(b,k){var i=b("ace/lib/oop"),m=b("ace/range").Range,g=b("ace/mode/folding/fold_mode").FoldMode,f=k.FoldMode=function(){};i.inherits(f,g);(function(){function b(a,d,c,n){for(var a=a.doc.$lines,p=d+n,o=a[p],g=0<n?"*/":"/*",j;null!=o;){var f=o.indexOf(g);if(-1!==f){j=0<n?new m(d,c,p,f):new m(p,o.length,d,c);break}p+=n;o=a[p]}return j}function c(a,d,c,b,p){for(var o=d+p,g=a.doc.$lines;0<=o&&o<a.getLength();){for(var j=a.getTokens(o),
f=g[o],r=0;r<j.length;r++)if(j[r].type===b)return 0<p?new m(d,c,o,0):new m(o,f.length,d,c);o+=p}}var a=/(\{|\[)[^\}\]]*$/,d=/^[^\[\{]*(\}|\])/;this.getFoldWidget=function(c,e,l){e="markbeginend"===e?"end":"";l=c.getLine(l);if(a.test(l))return"start";if(d.test(l))return e;c=l.indexOf("/*");l=l.indexOf("*/");return-1!==c&&(-1===l||c>l)?"start":-1!==l&&(-1===c||l<c)?e:""};this.getFoldWidgetRange=function(h,e,l){var n=h.getLine(l),p;if(p=n.match(a))return this.openingBracketBlock(h,p[1],l,p.index);if(p=
"markbeginend"===e&&n.match(d))return this.closingBracketBlock(h,p[1],l,p.index+p[0].length);e=h.getTokens(l);for(p=0;p<e.length;p++){var o=e[p];if("support.function.codebegin"===o.type)return c(h,l,n.length,"support.function.codeend",1);if("support.function.codeend"===o.type)return c(h,l,0,"support.function.codebegin",-1)}e=n.indexOf("/*");if(-1!==e)return b(h,l,n.length,1);e=n.indexOf("*/");if(-1!==e)return b(h,l,e,-1)}}).call(f.prototype)});define("mode/c_cpp_highlight_rules",["require","exports","module"],function(b,k){var i=b("ace/lib/oop"),m=b("ace/lib/lang"),g=b("mode/doc_comment_highlight_rules").DocCommentHighlightRules,f=b("ace/mode/text_highlight_rules").TextHighlightRules,j=b("mode/tex_highlight_rules").TexHighlightRules,c=b("mode/r_highlight_rules").RHighlightRules,a=function(){function a(d){return d.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var b=m.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(",")),
e=m.arrayToMap(["NULL"]),l="new,delete,>>=,<<=,->*,...,<<,>>,&&,||,==,!=,<=,>=,::,*=,+=,-=,/=,++,--,&=,^=,%=,->,.*,!,$,&,|,+,-,*,/,^,~,=,%".split(","),n=l.map(function(e){return a(e)}).join("|"),l=["->*"].concat(l).concat("< > , () [] ->".split(" ")).map(function(e){return a(e)}),l=["new\\s*\\[\\]","delete\\s*\\[\\]"].concat(l),l="operator\\s*(?:"+l.join("|")+")|operator\\s+[\\w_]+(?:&&|&|\\*)?";this.$rules={start:[{token:"comment.doc.tag",regex:"\\/\\/\\s*\\[\\[.*\\]\\].*$"},{token:"comment",regex:"\\/\\/'",
next:"rd-start"},{token:"comment",regex:"\\/\\/.*$"},g.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:l},
{token:function(a){return"this"==a?"variable.language":b.hasOwnProperty(a)?"keyword":e.hasOwnProperty(a)?"constant.language":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",merge:!1,regex:n},{token:"keyword.punctuation.operator",merge:!1,regex:"\\?|\\:|\\,|\\;|\\.|\\\\"},{token:"paren.keyword.operator",merge:!1,regex:"[[({<]"},{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"}]};n=(new j("comment")).getRules();for(l=0;l<n.start.length;l++)n.start[l].token+=".virtual-comment";this.addRules(n,"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(g,"doc-",[g.getEndRule("start")]);this.$rules.start.unshift({token:"support.function.codebegin",regex:"^\\s*\\/\\*{3,}\\s*[Rr]\\s*$",next:"r-start"});this.addRules((new c).getRules(),"r-");this.$rules["r-start"].unshift({token:"support.function.codeend",
regex:"\\*\\/",next:"start"})};i.inherits(a,f);k.c_cppHighlightRules=a});define("mode/c_cpp_matching_brace_outdent",["require","exports","module"],function(b,k){var i=b("ace/range").Range,m=b("mode/token_cursor").CppTokenCursor,g=function(a){this.codeModel=a},f=b("mode/utils"),j=!0,c=!0,a=!0,d=!0,h=!0,e=!0,l=!0,n=!0,p=!0,o=!0,u=!0,w=!0;(function(){this.setIndent=function(a,d,e,c,l){var a=a.getDocument(),c="string"===typeof c?c:"",b=a.$lines[e],e=this.$getIndent(a.$lines[d]),b=this.$getIndent(b);("function"!==typeof l||l(e,b))&&a.replace(new i(d,0,d,e.length),b+c)};this.checkOutdent=
function(a,d,e){return f.endsWith(a,"start")&&(":"===e||/^\s*[#\{\}\>\]\)<.:]/.test(e)||"="===e)?!0:f.endsWith(a,"comment")&&"/"==e?!0:!1};this.escapeRegExp=function(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")};this.alignStartToken=function(a,d,e,c,l){if(null===l||null===c)return!1;return RegExp("^\\s*"+this.escapeRegExp(a)).test(c)&&(a=l.indexOf(a),0<=a)?(d=d.getDocument(),c=this.$getIndent(c),a=Array(a+1).join(" "),d.replace(new i(e,0,e,c.length),a),!0):!1};this.alignEquals=
function(a,d,e,c){if(null===c||null===e)return!1;var l=e.indexOf("=");if(l!==e.lastIndexOf("="))return!1;var b=c.indexOf("=");if(-1!==l&&-1!==b&&/,\s*$/.test(c)){a=a.getDocument();e=this.$getIndent(e);if(e.length>=b)return!1;l=b-l;if(0>=l)return!1;l=Array(e.length+l+1).join(" ");a.replace(new i(d,0,d,e.length),l);return!0}return!1};this.autoOutdent=function(b,n,g){var b=n.doc,f=b.getLine(g),x=null;0<g&&(x=b.getLine(g-1));this.$getIndent(f);if(!(o&&this.alignStartToken("<<",n,g,f,x)||p&&this.alignStartToken(">>",
n,g,f,x)))if(!l||!this.alignStartToken(".",n,g,f,x)){if(j&&/^\s*:/.test(b.getLine(g))&&!/^\s*::/.test(b.getLine(g))&&this.codeModel.$tokenUtils.$tokenizeUpToRow(g)){var k=new m(this.codeModel.$tokens,g,0),s=-1,z=k.cloneCursor();if(")"===z.peekBwd().currentValue()||"keyword"===z.peekBwd().currentType()){do{var k=z.currentType(),V=z.currentValue();if("identifier"===k||";"===V){s=z.$row;break}"keyword"!==k&&z.bwdToMatchingToken()}while(z.moveToPreviousToken())}else k.moveToPreviousToken(),k.bwdOverClassySpecifiers()&&
(s=k.$row);0<=s&&this.setIndent(n,g,s,n.getTabString(),function(a,d){return a===d})}if(e&&/^\s*>/.test(f)&&!/^\s*>>/.test(f)&&(s=this.codeModel.getRowForMatchingEOLArrows(n,b,g),0<=s)){this.setIndent(n,g,s);return}if(d&&/^\s*\}/.test(f)&&(s=n.findMatchingBracket({row:g,column:f.indexOf("}")+1}),null!==s)){if(/^\s*\{/.test(b.$lines[s.row])){this.setIndent(n,g,s.row);return}s=this.codeModel.getRowForOpenBraceIndent(n,s.row);if(0<=s){this.setIndent(n,g,s);return}}if(c&&/^\s*\)/.exec(f)&&(s=n.findMatchingBracket({row:g,
column:f.indexOf(")")+1}))){this.setIndent(n,g,s.row);return}if(h&&/^\s*\]/.exec(f)&&(s=n.findMatchingBracket({row:g,column:f.indexOf("]")+1}))){this.setIndent(n,g,s.row);return}if(u&&/^\s*public\s*:\s*$|^\s*private\s*:\s*$|^\s*protected\s*:\s*$/.test(f)&&(z=n.$findOpeningBracket("}",{row:g,column:f.length},RegExp(/paren\.keyword\.operator/)))){s=this.codeModel.getRowForOpenBraceIndent(n,z.row);0<=s?this.setIndent(n,g,s):this.setIndent(n,g,z.row);return}if(w&&(/^\s*case.+:/.test(f)||/^\s*default\s*:/.test(f)))if(z=
n.$findOpeningBracket("}",{row:g,column:/(\S)/.exec(f).index+1})){s=this.codeModel.getRowForOpenBraceIndent(n,z.row);0<=s?this.setIndent(n,g,s):this.setIndent(n,g,z.row);return}if(a&&/^\s*\{/.test(f)&&!/;\s*$/.test(x)){if(this.codeModel.$tokenUtils.$tokenizeUpToRow(g)&&(k=new m(this.codeModel.$tokens),k.$row=g,k.$offset=0,k.moveToPreviousToken()&&"="===k.currentValue()))return;x=this.codeModel.getRowForOpenBraceIndent(n,g);if(0<=x){this.setIndent(n,g,x);return}}/^\s*#/.test(f)&&(n=this.$getIndent(f),
b.replace(new i(g,0,g,n.length),""))}};this.$getIndent=function(a){return(a=a.match(/^(\s+)/))?a[1]:""}}).call(g.prototype);k.CppMatchingBraceOutdent=g;k.getOutdentColon=function(){return j};k.setOutdentColon=function(a){j=a};k.getOutdentRightParen=function(){return c};k.setOutdentRightParen=function(a){c=a};k.getOutdentLeftBrace=function(){return a};k.setOutdentLeftBrace=function(d){a=d};k.getOutdentRightBrace=function(){return d};k.setOutdentRightBrace=function(a){d=a};k.getOutdentRightBracket=
function(){return h};k.setOutdentRightBracket=function(a){h=a};k.getOutdentRightArrow=function(){return e};k.setOutdentRightArrow=function(a){e=a};k.getAlignDots=function(){return l};k.setAlignDots=function(a){l=a};k.getAlignEquals=function(){return n};k.setAlignEquals=function(a){n=a};k.getAlignStreamIn=function(){return p};k.setAlignStreamIn=function(a){p=a};k.getAlignStreamOut=function(){return o};k.setAlignStreamOut=function(a){o=a};k.getAlignClassAccessModifiers=function(){return u};k.setAlignClassAccessModifiers=
function(a){u=a};k.getAlignCase=function(){return w};k.setAlignCase=function(a){w=a}});define("mode/behaviour/cstyle",["require","exports","module"],function(b,k){var i=b("ace/lib/oop"),m=b("ace/mode/behaviour").Behaviour;b("mode/cpp_code_model");b("mode/token_cursor");b("ace/mode/text");var g=b("mode/utils"),f=!0,j=function(c){var a=c.$complements,d=function(d,c,b,h){var o=a[d];if(c==d)return c=b.getSelectionRange(),h=h.doc.getTextRange(c),""!==h?{text:d+h+o,selection:!1}:{text:d+o,selection:[1,1]};if(c==o&&(d=b.getCursorPosition(),h.doc.getLine(d.row)[d.column]==o&&(">"===o||null!==
h.findMatchingBracket({row:d.row,column:d.column+1}))))return{text:"",selection:[1,1]}},b=function(d,c,b){var h=a[d],o=b.doc.getTextRange(c);if(!c.isMultiLine()&&o==d&&b.doc.getLine(c.start.row).substring(c.start.column+1,c.start.column+2)==h)return c.end.column++,c};this.add("R","insertion",function(a,d,c,b,h){if("R"===h||"r"===h)if(a=c.getCursorPosition(),b=(new String(b.doc.getLine(a.row))).match(/^(\s*)\/\*{3,}\s*/))return{text:"R\n"+b[1]+"\n"+b[1]+"*/",selection:[1,b[1].length,1,b[1].length]}});
this.add("newline","insertion",function(a,d,b,h,o){if("\n"===o){var o=b.selection.getCursor().row,f=b.selection.getCursor().column,d=h.getTabString(),j=b.getCursorPosition(),b=h.doc.getLine(j.row);if(!this.codeModel.inMacro(h.getDocument().$lines,o-1)){var m=/^(\s*\/\/'\s*)/.exec(b);if(m&&f>=m[1].length)return{text:"\n"+m[1]};if(/^\s*\/\*/.test(b)&&(-1!==b.indexOf("*/")||!/^\s*\*/.test(h.getLine(o+1))))return h=this.$getIndent(b),d=h+" * ",{text:"\n"+d+"\n"+h+" */",selection:[1,d.length,1,d.length]};
if(g.endsWith(a,"comment")||g.endsWith(a,"doc-start")){j&&j.row==o&&(b=b.substring(0,j.column));if(a=/^(\s*)(\/\*)/.exec(b))return{text:"\n"+a[1]+" * "};if(a=/^(\s*\*+\s*)/.exec(b))return{text:"\n"+a[1],selection:[1,a[1].length,1,a[1].length]}}for(a=f-1;/\s/.test(b[a]);)--a;a=b[a];f=b[f];if(m=b.match(/\s*namespace\s*\w*\s*{/))return h=this.$getIndent(b),{text:"\n"+h,selection:[1,h.length,1,h.length]};if("("==a&&")"==f||"["==a&&"]"==f)return o=this.$getIndent(b),h=o+d,{text:"\n"+h+"\n"+o,selection:[1,
h.length,1,h.length]};if("{"==a&&"}"==f){if(/^\s*{/.test(b))return o=this.$getIndent(b),h=o+h.getTabString(),{text:"\n"+h+"\n"+o,selection:[1,h.length,1,h.length]};o=c.getRowForOpenBraceIndent(h,o);if(null!==o&&0<=o)return o=this.$getIndent(h.getDocument().getLine(o)),h=o+h.getTabString(),{text:"\n"+h+"\n"+o,selection:[1,h.length,1,h.length]};o=this.$getIndent(b);h=o+d;return{text:"\n"+h+"\n"+o,selection:[1,h.length,1,h.length]}}}}});this.add("braces","insertion",function(a,c,b,h,o){if(this.insertMatching){if("{"==
o&&(a=b.getSelectionRange(),""===h.doc.getTextRange(a))){a=this.codeModel.getTokenCursor();if(!a.moveToPosition(b.getCursorPosition()))return d("{",o,b,h);do if(!a.bwdToMatchingArrow()){c=a.currentValue();if(!c||!c.length)break;if("namespace"===c)return{text:"{",selection:[1,1]};if("class"===c||"struct"===c||"="===c)return{text:"{};",selection:[1,1]};if(f&&"do"===c)return{text:"{} while ();",selection:[1,1]};if(";"===c||"["===c||"]"===c||"("===c||")"===c||"{"===c||"}"===c||"if"===c||"else"===c||"#"===
c[0])return{text:"{}",selection:[1,1]}}while(a.moveToPreviousToken())}return d("{",o,b,h)}});this.add("braces","deletion",function(a,d,c,b,h){if(this.insertMatching&&(a=b.doc.getTextRange(h),!h.isMultiLine()&&"{"==a)){a=b.doc.getLine(h.start.row);if(/^\s*do\s*\{\} while \(\);\s*$/.test(a))return h.end.column=a.length,h;b=a.substring(h.end.column,h.end.column+1);a=a.substring(h.end.column+1,h.end.column+2);if("}"==b)return h.end.column++,";"==a&&h.end.column++,h}});this.add("parens","insertion",function(a,
c,b,h,o){return!this.insertMatching?void 0:d("(",o,b,h)});this.add("parens","deletion",function(a,d,c,g,o){return!this.insertMatching?void 0:b("(",o,g)});this.add("brackets","insertion",function(a,c,b,h,o){return!this.insertMatching?void 0:d("[",o,b,h)});this.add("brackets","deletion",function(a,d,c,g,o){return!this.insertMatching?void 0:b("[",o,g)});this.add("arrows","insertion",function(a,c,b,h,o){if(this.insertMatching)return!/^\s*#\s*include/.test(h.getLine(b.getCursorPosition().row))?void 0:
d("<",o,b,h)});this.add("arrows","deletion",function(a,d,c,g,o){return!this.insertMatching?void 0:b("<",o,g)});this.add("string_dquotes","insertion",function(a,d,c,b,h){if(this.insertMatching&&('"'==h||"'"==h)){a=c.getSelectionRange();d=b.doc.getTextRange(a);if(""!==d)return{text:h+d+h,selection:!1};c=c.getCursorPosition();d=b.doc.getLine(c.row);if("\\"==d.substring(c.column-1,c.column))return null;for(var b=b.getTokens(a.start.row),g=0,f,j=-1,r=0;r<b.length;r++){f=b[r];"string"==f.type?j=-1:0>j&&
(j=f.value.indexOf(h));if(f.value.length+g>a.start.column)break;g+=b[r].value.length}if(!f||0>j&&"comment"!==f.type&&("string"!==f.type||a.start.column!==f.value.length+g-1&&f.value.lastIndexOf(h)===f.value.length-1))return{text:h+h,selection:[1,1]};if(f&&"string"===f.type&&d.substring(c.column,c.column+1)==h)return{text:"",selection:[1,1]}}});this.add("string_dquotes","deletion",function(a,d,c,b,h){if(this.insertMatching&&(a=b.doc.getTextRange(h),!h.isMultiLine()&&('"'==a||"'"==a)))if(b=b.doc.getLine(h.start.row).substring(h.start.column+
1,h.start.column+2),'"'===b||"'"===b)return h.end.column++,h});this.add("punctuation.operator","insertion",function(a,d,c,b,h){if(this.insertMatching&&";"===h&&(a=c.selection.getCursor(),";"==b.getLine(a.row)[a.column]))return{text:"",selection:[1,1]}});this.add("macro","insertion",function(a,d,c,b,h){var d=c.getPrintMarginColumn(),d=Math.min(62,d),g=b.getDocument().$lines,f=c.getCursorPosition(),j=f.row,r=g[j],c=r.substring(0,f.column);if(/^\s*#\s*define[^\\]*$/.test(r)&&"\\"==h)return a=d-c.length+
1,0<=a?{text:Array(a+1).join(" ")+"\\\n"+this.$getIndent(r)+b.getTabString(),selection:!1}:{text:"\\\n"+b.getTabString(),selection:!1};if(/^\s*#\s*define/.test(r)||this.codeModel.inMacro(g,j-1)){if("\\"==h&&/^\s*$/.test(r.substring(c.length,r.length)))return a=d-c.length+1,0<=a?{text:Array(a+1).join(" ")+"\\",selection:!1}:{text:"\\",selection:!1};if("\n"==h){if(/^\s*$/.test(r)||/^\s*#\s*define/.test(r)&&!/\\\s*$/.test(r))return{text:"\n",selection:!1};if(/\\\s*$/.test(r)&&!/\\\s*$/.test(c))return{text:"",
selection:[1,f.column,1,f.column]};b=b.getMode().getNextLineIndent(a,r+"\\",b.getTabString(),j,!1);a=d-c.length+1;h=/\\\s*$/.test(c)?"":"\\";return 0<=a?{text:Array(a+1).join(" ")+h+"\n"+b,selection:!1}:{text:h+"\n"+b,selection:!1}}}})};i.inherits(j,m);k.CStyleBehaviour=j;k.setFillinDoWhile=function(c){f=c};k.getFillinDoWhile=function(){return f}});define("mode/cpp_code_model",["require","exports","module"],function(b,k){b("ace/lib/oop");var i=b("ace/range").Range,m=b("mode/token_utils").TokenUtils;b("ace/token_iterator");var g=b("mode/token_cursor").CppTokenCursor,f=b("mode/cpp_scope_tree").CppScopeNode,j=b("mode/cpp_scope_tree").CppScopeManager,c=b("mode/r_code_model").getVerticallyAlignFunctionArgs,a=b("mode/utils"),d=function(a,d,c,b,g){this.$session=a;this.$doc=a.getDocument();this.$tokenizer=d;this.$tokens=Array(this.$doc.getLength());
this.$statePattern=c;this.$codeBeginPattern=b;this.$codeEndPattern=g;this.$tokenUtils=new m(this.$doc,this.$tokenizer,this.$tokens,this.$statePattern,this.$codeBeginPattern);this.$scopes=new j(f);var o=!0,i=function(){o?o=!1:(this.$doc.off("change",k),this.$session.off("changeMode",i))}.bind(this),k=function(a){this.$onDocChange(a)}.bind(this);this.$session.on("changeMode",i);this.$doc.on("change",k)};(function(){var d=a.contains;this.getTokenCursor=function(){return new g(this.$tokens,0,0,this)};
this.$tokenizeUpToRow=function(a){this.$tokenUtils.$tokenizeUpToRow(a)};var b=function(a,c){for(;;){var b=a.currentValue(),e=c.$doc.getLine(a.$row);if(d(["{","}",";"],b))break;if(":"===b&&(b=a.peekBwd().currentValue(),d(["public","private","protected"],b)))break;if(/^\s*#/.test(e))break;if(!a.moveToPreviousToken())break}},l="if,else,for,do,while,struct,class,try,catch,switch".split(","),f=function(a){a=a.trim();return a=a.replace(/[\n\s]+/g," ")},j=function(a,d){var c=f(a),b=d;"undefined"===typeof b&&
(b=80);c.length>b&&(c=c.substring(0,b)+"...");return c};this.$complements={"<":">",">":"<","{":"}","}":"{","[":"]","]":"[","(":")",")":"(","'":"'",'"':'"'};this.alignContinuationSlashes=function(a,d){"undefined"===typeof d&&(d={start:0,end:a.getLength()});var c=a.$lines;if(!(c instanceof Array))return!1;for(var b=d.start;b<d.end;b++)if(m.test(c[b])){for(var h=b,b=b+1;m.test(c[b])&&b<=d.end;)b++;for(var e=b,l=c.slice(h,e).map(function(a){return a.lastIndexOf("\\")}),g=Math.max.apply(null,l),f=0;f<
e-h;f++){var o={row:h+f,column:l[f]},j=Array(g-l[f]+1).join(" ");a.insert(o,j)}}return!0};this.allIndicesOf=function(a,d){for(var c=[],b=0;b<a.length;b++)a[b]==d&&c.push(b);return c};this.getRowForMatchingEOLArrows=function(a,d,c){for(var a=0,b="",h=1;100>h;h++){b=this.getLineSansComments(d,c-h);if(/;\s*$/.test(b))break;if(/<\s*$/.test(b)&&!/<<\s*$/.test(b)){if(0===a)return c-h;a--}else/^\s*>/.test(b)&&!/^\s*>>/.test(b)&&a++}return-1};var o=/^\s*#\s*define/,m=/\\\s*$/,k=/^\s*[+\-/&^%$!<\>.?|=~]|^\s*\*[^/]|^\s*\/[^\*]/,
y=/[+\-*&^%$!<\>.?|=~]\s*$|\*[^/]\s*$|\/[^\*]\s*$/;this.inMacro=function(a,d){var c=a[d];return 0>d?!1:m.test(c)?o.test(c)?!0:this.inMacro(a,d-1):!1};this.$buildScopeTreeUpToRow=function(a){a=Math.min(a+30,this.$doc.getLength()-1);this.$tokenUtils.$tokenizeUpToRow(a);var d=this.getTokenCursor();if(d.seekToNearestToken(this.$scopes.parsePos,a)){do{this.$scopes.parsePos=d.currentPosition();this.$scopes.parsePos.column+=d.currentValue().length;var c=d.currentToken().type;if(/\bsectionhead\b/.test(c)){if(c=
/^\/\/'?[-=#\s]*(.*?)\s*[-=#]+\s*$/.exec(d.currentValue()))c=""+c[1],0==c.length&&(c="(Untitled)"),50<c.length&&(c=c.substring(0,50)+"..."),this.$scopes.onSectionHead(c,d.currentPosition())}else if(/\bcodebegin\b/.test(c)){var c=d.currentPosition(),h={row:c.row+1,column:0};this.$scopes.getTopLevelScopeCount();this.$scopes.onChunkStart("(R Code Chunk)","(R Code Chunk)",c,h)}else if(/\bcodeend\b/.test(c)){for(c=d.currentPosition();this.$scopes.onScopeEnd(c););c.column+=d.currentValue().length;this.$scopes.onChunkEnd(c)}else if("{"===
d.currentValue())if(c=d.cloneCursor(),h=c.currentPosition(),c.isFirstSignificantTokenOnLine()&&(h.column=0),"namespace"===c.peekBwd(2).currentValue())c.moveToPreviousToken(),h=c.currentValue(),this.$scopes.onNamespaceScopeStart("namespace "+h,c.currentPosition(),d.currentPosition(),h);else if("namespace"===c.peekBwd().currentValue())this.$scopes.onNamespaceScopeStart("anonymous namespace",h,d.currentPosition(),"<anonymous>");else if("class"===c.peekBwd(2).currentValue()||"struct"===c.peekBwd(2).currentValue()||
c.bwdOverClassInheritance()){c.moveToPreviousToken();var l=c.cloneCursor();b(l,this);l=l.peekFwd().currentPosition();h=this.$session.getTextRange(new i(l.row,l.column,h.row,h.column));h=f(h);this.$scopes.onClassScopeStart(h,c.currentPosition(),d.currentPosition(),h)}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 i(c.row,c.column,h.row,h.column-1)),c=f("lambda "+c),this.$scopes.onLambdaScopeStart(c,h,d.currentPosition());else{if(c.moveToPreviousToken()){var s="",h=c.currentValue(),l="",g=this.$scopes.getActiveScopes(c.currentPosition());null!=g&&(g=g[g.length-1],g.isClass()&&g.label==="class "+h?"~"===c.peekBwd().currentValue()&&(h="~"+h):(s=c.cloneCursor(),b(s,this),s.moveToNextToken(),s=s.currentPosition(),g=c.currentPosition(),
s=this.$session.getTextRange(new i(s.row,s.column,g.row,g.column))));var o=c.peekFwd(),g=o.currentPosition();o.fwdToMatchingToken()&&("const"===o.peekFwd().currentValue()&&o.moveToNextToken(),"noexcept"===o.peekFwd().currentValue()&&o.moveToNextToken(),"noexcept"===o.currentValue()&&"("===o.peekFwd().currentValue()&&(o.moveToNextToken(),o.fwdToMatchingToken()),(o=o.peekFwd().currentPosition())&&(l=this.$session.getTextRange(new i(g.row,g.column,o.row,o.column))));this.$scopes.onFunctionScopeStart(0<
s.length?j(h.trim()+l.trim()+": "+s.trim()):j(h.trim()+l.trim()),c.currentPosition(),d.currentPosition(),h.trim(),l.split(","))}}else this.$scopes.onScopeStart(h);else this.$scopes.onScopeStart(h);else"}"===d.currentValue()&&(c=d.currentPosition(),d.isLastSignificantTokenOnLine()?c.column=this.$doc.getLine(c.row).length+1:c.column++,this.$scopes.onScopeEnd(c))}while(d.moveToNextToken(a))}};this.getCurrentScope=function(a,c){c||(c=function(){return!0});if(!a)return"";this.$buildScopeTreeUpToRow(a.row);
var d=this.$scopes.getActiveScopes(a);if(d)for(var b=d.length-1;0<=b;b--)if(c(d[b]))return d[b];return null};this.getScopeTree=function(){this.$buildScopeTreeUpToRow(this.$doc.getLength()-1);return this.$scopes.getScopeList()};this.getRowForOpenBraceIndent=function(a,c,b){if(1>=a.getDocument().$lines.length)return-1;if(this.$tokenUtils.$tokenizeUpToRow(c))try{for(var e=Array(this.$tokens.length),g=0;g<this.$tokens.length;g++)if(null!=this.$tokens[g]&&0<this.$tokens[g].length){var s=this.$tokens[g];
"\\"===s[s.length-1].value&&(e[g]=this.$tokens[g].splice(s.length-1,1)[0])}var f=this.getTokenCursor();if(b){var o=a.getSelection().getCursor();if(!f.moveToPosition(o))return 0}else{f.$row=c;g=f.$tokens[c].length-1;for(g=f.$tokens[c].length-1;0<=g&&!(f.$offset=g,"{"===f.currentValue());g--);}if("{"===f.peekBwd().currentValue()||";"===f.currentValue())return-1;f.bwdOverInitializationList();f.bwdOverClassInheritance();if("{"===f.currentValue()&&!f.moveToPreviousToken()||"{"===f.currentValue())return-1;
for(;"keyword"===f.currentType();){var j=f.currentValue();if(d(l,j)||0===f.$row&&0===f.$offset)return f.$row;if(!f.moveToPreviousToken())return-1}if(":"===f.currentValue()){var n=f.peekBwd().currentValue();if(d(["public","private","protected"],n))return f.moveToNextToken(),f.$row}if(":"===f.currentValue())for(;f.moveToPreviousToken();){if(f.bwdToMatchingToken())if("keyword"===f.peekBwd().currentType())continue;else break;if("identifier"===f.currentType())break}if(")"===f.currentValue()&&!f.bwdToMatchingToken()||
"("===f.currentValue()&&!f.moveToPreviousToken())return-1;"="===f.currentValue()&&f.moveToPreviousToken();return f.$row}finally{for(g=0;g<e.length;g++)"undefined"!==typeof e[g]&&this.$tokens[g].push(e[g])}return-1};this.getLineSansComments=function(a,c,d){if(0>c)return"";for(var a=a.getLine(c),b=/(?!\\)\"/g,h=a,e=null,c=[];e=b.exec(h);)c.push(e.index);if(0<c.length&&0===c.length%2)for(b=0;b<c.length/2;b+=2)h=c[b+1],a=a.substring(0,c[b]+1)+a.substring(h,a.length);c=a.indexOf("//");-1!=c&&(a=a.substring(0,
c));m.test(a)&&(a=a.substring(0,a.lastIndexOf("\\")));d&&(a=a.replace(/\bconst\b/,"").replace(/\bnoexcept\b/,""));return a};this.findStartOfCommentBlock=function(a,c,d){for(var b=0,h=/^\s*\/+\*/;0<=c&&b<d;){if(h.test(a[c]))return c;--c;++b}return-1};this.getNextLineIndent=function(b,e,l,g,f){var s=c(),j=this.$session,n=j.getTabSize(),p=j.getDocument();"number"!==typeof g&&(g=j.getSelection().getCursor().row-1);if(-1===g)return e=p.getLine(0),0<e.length?this.$getIndent(e):"";if(0===e.length||/^\s*#/.test(e))return this.getNextLineIndent(a.getPrimaryState(j,
g-1),p.getLine(g-1),l,g-1,f);var i=this.$getIndent(e),H=this.$getUnindent(e,n),t=p.$lines;if(a.endsWith(b,"comment")||a.endsWith(b,"doc-start")){E&&E.row==g&&(e=e.substring(0,E.column));if(/^\s*$/.test(e))return this.$getIndent(t[g]);E=this.findStartOfCommentBlock(t,g,200);if(null!==E)return this.$getIndent(t[E])+" "}if(a.endsWith(b,"start")){b=null;if(o.test(e))return/\\\s*$/.test(e)?i+l:i;if(/^\s*#\s*\S/.test(e))return i;if(this.inMacro(t,g-1)&&!m.test(e))return H;var e=this.getLineSansComments(p,
g),E=j.getSelection().getCursor();E&&E.row==g&&!f&&(e=e.substring(0,E.column));H=this.getLineSansComments(p,g-1);if("string"!==typeof e)return"";if(0===e.length||/^\s*$/.test(e))return this.$getIndent(t[g]);if(/\*\/\s*$/.test(e)&&(b=this.findStartOfCommentBlock(t,g,200),0<=b))return this.$getIndent(t[b]);if(/^\s*<</.test(e)){for(e=g-1;/^\s*<</.test(t[e]);)e--;return this.$getIndent(t[e])}if(/^\s*\./.test(e)){for(e=g-1;/^\s*\./.test(t[e]);)e--;return this.$getIndent(t[e])}if(/\bnamespace\b.*\{\s*$/.test(e)||
/\bswitch\b.*\{\s*$/.test(e))return i;if(e.match(/\(\s*$/))return-1!==e.indexOf("=")||/^\s*(return\s+)?[a-zA-Z0-9_.->:]+\(\s*$/.test(e)?i+l:i+l+l;if(/^\s*(class|struct).*\{\s*$/.test(e)||/^\s*(class|struct)\s+.+:\s*$/.test(e))return i+l;if((b=e.match(/(^\s*(?:class|struct)\s+.*\w[^:]):[^:]\s*.+/))&&!/,\s*/.test(e)||(b=e.match(/^(\s*(class|struct).*:\s*).*,\s*$/)))return s?Array(b[1].length+1).join(" "):i+l;if(b=e.match(/^(\s*:\s*)(\w+).*,\s*$/))return s?Array(b[1].length+1).join(" "):i+l;if(b=e.match(/^(\s*)[:,]\s*[\w\s]*$/))return s?
Array(b[1].length+1).join(" "):i+l;if(/<\s*$/.test(e))return i+l;if(/^\s*\".*\"\s*$/.test(e)||/^\s*template\s*<.*>\s*$/.test(e)&&e.split(">").length==e.split("<").length)return i;if(/([\[\{\(<]).+,\s*$/.exec(e))for(var I=["(","{","[","<"],b=0;b<I.length;b++){var J=I[b],K=this.$complements[J],J=this.allIndicesOf(e,J);if(J.length&&(K=this.allIndicesOf(e,K),K=J.length-K.length-1,!(0>K))){t=J[K];return s?(e=e.substr(t+1).match(/([^\s])/),Array(t+e.index+2).join(" ")):i+l}}for(b=g-1;0<=b&&/^\s*$|^\s*#/.test(H);)H=
this.getLineSansComments(p,b),b--;if((k.test(e)||y.test(e))&&(k.test(H)||y.test(H)))return this.$getIndent(e);if(this.$tokenUtils.$tokenizeUpToRow(g+2)){I=Array(this.$tokens.length);try{for(b=0;b<this.$tokens.length;b++)if(null!=this.$tokens[b]&&0<this.$tokens[b].length){var Q=this.$tokens[b];"\\"===Q[Q.length-1].value&&(I[b]=this.$tokens[b].splice(Q.length-1,1)[0])}var q=this.getTokenCursor();f?(q.$row=g,q.$offset=this.$tokens[g].length-1):q.moveToPosition(E);for(;0>q.$offset&&0<q.$row;)q.$row--,
q.$offset=q.$tokens[q.$row].length-1;for(;0<q.$row&&/^\s*#/.test(p.getLine(q.$row));)q.$row--,q.$offset=q.$tokens[q.$row].length-1;var f="",S=q.cloneCursor(),L=S.currentValue(),O=S.currentType();if("constant"===O||"keyword"===O||"identifier"===O||d(["{",")",">",":"],L))f=l;for(;";"===q.currentValue()&&q.moveToPreviousToken(););var R=q.cloneCursor();if(s&&q.isLastSignificantTokenOnLine()&&("keyword.operator"===q.currentType()||"punctuation.operator"===q.currentType())){var M=q.cloneCursor();M.$offset=
0;if("keyword"===M.currentType()){var F=e.split("(").length-e.split(")").length;if(0<F){var G=e.match(/.*?\(\s*(\S)/);if(G)return Array(G[0].length).join(" ")}}}if(","===q.currentValue()){if(s){var A=q.peekBwd();if("]"===A.currentValue()&&A.bwdToMatchingToken())return Array(A.currentPosition().column+1).join(" ");F=e.split("(").length-e.split(")").length;if(0<F&&(G=e.match(/.*?\(\s*(\S)/)))return Array(G[0].length).join(" ")}if(/[,(]\s*$/.test(e)&&/[,(]\s*$/.test(H))return this.$getIndent(e);var v=
q.cloneCursor();return v.findOpeningBracket("{",!1)&&v.bwdOverClassySpecifiers()&&"enum"===v.currentValue()?this.$getIndent(t[v.$row])+l:-1!==e.indexOf("=")?this.$getIndent(e)+l:this.$getIndent(e)}if("keyword.operator"===O&&":"!==L)return this.$getIndent(t[g])+l;for(;;){if("undefined"===typeof q.currentValue())return"undefined"!==typeof R.currentValue()?this.$getIndent(t[R.$row])+f:f;R=q.cloneCursor();if(";"===q.currentValue()&&q.moveToNextToken()){for(g=q.$row;null!=t[g]&&/^\s*#/.test(t[g]);)++g;
return this.$getIndent(t[g])+f}if(d(["for","while","do","try"],q.currentValue())&&";"!==L)return this.$getIndent(t[q.$row])+f;A=q.peekBwd();if(":"===q.currentValue()){if(d(["public","private","protected"],A.currentValue()))return this.$getIndent(t[A.$row])+l;var B=t[q.$row];if(/^\s*case/.test(B))return this.$getIndent(B)+l;if(")"===A.currentValue()&&(v=A.cloneCursor(),v.bwdToMatchingToken())){var N=v.peekBwd(1),T=v.peekBwd(2);if(null!==N&&"identifier"===N.currentType()&&null!==T&&!/\boperator\b/.test(T.currentType()))return this.$getIndent(t[v.peekBwd().$row])+
f}}if("]"===q.currentValue()&&"("===q.peekFwd().currentValue()&&(v=q.cloneCursor(),v.bwdToMatchingToken()))return this.$getIndent(t[v.$row])+f;if("("===q.currentValue()&&"for"===A.currentValue()&&";"===L)return q.peekFwd().cloneCursor(),s?Array(q.peekFwd().currentPosition().column+1).join(" "):this.$getIndent(t[q.peekFwd().$row])+l;if(s&&"("===q.currentValue()&&!q.isLastSignificantTokenOnLine())return q.moveToNextToken(),Array(q.currentPosition().column+1+n).join(" ");if("if"===q.currentValue()||
"else"===q.currentValue()||"template"===q.currentValue()&&"<"===q.peekFwd().currentValue())return this.$getIndent(t[q.$row])+f;if("{"===q.currentValue()){var U=this.getRowForOpenBraceIndent(j,q.$row);return 0<=U?(e=this.getLineSansComments(p,U),i=this.$getIndent(e),/\bnamespace\b/.test(e)?i:i+l):this.$getIndent(t[q.$row])+l}if(0===q.$row&&0===q.$offset)return this.$getIndent(t[0])+f;if(">"===q.currentValue()&&(v=q.cloneCursor(),v.bwdToMatchingArrow()&&"template"===v.peekBwd().currentValue()))return">"===
L&&(f=""),this.$getIndent(t[v.$row])+f;q.bwdToMatchingToken();if(!q.moveToPreviousToken())break;for(;0<q.$row&&/^\s*#/.test(t[q.$row]);)q.$row--,q.$offset=this.$tokens[q.$row].length-1}}finally{for(b=0;b<I.length;b++)"undefined"!==typeof I[b]&&this.$tokens[b].push(I[b])}}}return i};this.$onDocChange=function(a){a=a.data;"insertLines"===a.action?this.$tokenUtils.$insertNewRows(a.range.start.row,a.range.end.row-a.range.start.row):"insertText"===a.action?this.$doc.isNewLine(a.text)?(this.$tokenUtils.$invalidateRow(a.range.start.row),
this.$tokenUtils.$insertNewRows(a.range.end.row,1)):this.$tokenUtils.$invalidateRow(a.range.start.row):"removeLines"===a.action?(this.$tokenUtils.$removeRows(a.range.start.row,a.range.end.row-a.range.start.row),this.$tokenUtils.$invalidateRow(a.range.start.row)):"removeText"===a.action&&(this.$doc.isNewLine(a.text)&&this.$tokenUtils.$removeRows(a.range.end.row,1),this.$tokenUtils.$invalidateRow(a.range.start.row));this.$scopes.invalidateFrom(a.range.start)};this.$getIndent=function(a){return(a=/^([ \t]*)/.exec(a))?
a[1]:""};this.$padIndent=function(a,c,d){c=Array(c+1).join(" ");c=a.replace("\t",c);return c>=d?a:a+Array(d-c+1).join(" ")};this.$getUnindent=function(a,c){var d=this.$getIndent(a);if(null===d||0===d.length)return"";var b=d.indexOf("\t");if(-1!=b)return d.substring(0,b)+d.substring(b+1,d.length);for(var e=b=0;e<c&&e<d.length;e++)" "===d[e]&&b++;return d.substring(b,d.length)}}).call(d.prototype);k.CppCodeModel=d});define("mode/cpp_scope_tree",["require","exports","module"],function(b,k){var i=b("ace/lib/oop"),m=b("mode/r_scope_tree"),g=m.ScopeManager,f=m.ScopeNode,j=function(c,a,d,b,e,l){this.label=c;this.start=a;this.preamble=d||a;this.end=null;this.scopeType=b;this.scopeCategory=e;this.attributes=l||{};this.parentScope=null;this.$children=[]};i.mixin(j.prototype,f.prototype);j.CATEGORY_CLASS=1;j.CATEGORY_NAMESPACE=2;j.CATEGORY_FUNCTION=3;j.CATEGORY_LAMBDA=4;j.CATEGORY_ANON=5;(function(){this.isClass=function(){return this.scopeType==
f.TYPE_BRACE&&this.scopeCategory==j.CATEGORY_CLASS};this.isNamespace=function(){return this.scopeType==f.TYPE_BRACE&&this.scopeCategory==j.CATEGORY_NAMESPACE};this.isFunction=function(){return this.scopeType==f.TYPE_BRACE&&this.scopeCategory==j.CATEGORY_FUNCTION};this.isLambda=function(){return this.scopeType==f.TYPE_BRACE&&this.scopeCategory==j.CATEGORY_LAMBDA}}).call(j.prototype);m=function(c){this.$ScopeNodeFactory=c;this.parsePos={row:0,column:0};this.$root=new c("(Top Level)",this.parsePos,null,
f.TYPE_ROOT)};i.mixin(m.prototype,g.prototype);(function(){this.onClassScopeStart=function(c,a,d,b){this.$root.addNode(new this.$ScopeNodeFactory(c,d,a,f.TYPE_BRACE,j.CATEGORY_CLASS,{name:b}));this.printScopeTree()};this.onNamespaceScopeStart=function(c,a,d,b){this.$root.addNode(new this.$ScopeNodeFactory(c,d,a,f.TYPE_BRACE,j.CATEGORY_NAMESPACE,{name:b}));this.printScopeTree()};this.onFunctionScopeStart=function(c,a,d,b,e){this.$root.addNode(new this.$ScopeNodeFactory(c,d,a,f.TYPE_BRACE,j.CATEGORY_FUNCTION,
{name:b,args:e}));this.printScopeTree()};this.onLambdaScopeStart=function(c,a,d,b){this.$root.addNode(new this.$ScopeNodeFactory(c,d,a,f.TYPE_BRACE,j.CATEGORY_LAMBDA,{args:b}));this.printScopeTree()};this.onScopeStart=function(c){this.$root.addNode(new this.$ScopeNodeFactory(null,c,null,f.TYPE_BRACE));this.printScopeTree()};this.onScopeEnd=function(c){c=this.$root.closeScope(c,f.TYPE_BRACE);this.printScopeTree();return c}}).call(m.prototype);k.CppScopeManager=m;k.CppScopeNode=j});define("mode/dcf",["require","exports","module"],function(b,k){var i=b("ace/lib/oop"),m=b("ace/mode/text").Mode,g=b("ace/tokenizer").Tokenizer,f=b("mode/dcf_highlight_rules").DcfHighlightRules,j=function(){this.$tokenizer=new g((new f).getRules())};i.inherits(j,m);(function(){this.getNextLineIndent=function(c,a){return this.$getIndent(a)}}).call(j.prototype);k.Mode=j});define("mode/dcf_highlight_rules",["require","exports","module"],function(b,k){var i=b("ace/lib/oop"),m=b("ace/mode/text_highlight_rules").TextHighlightRules,g=function(){this.$rules={start:[{token:["keyword","text"],regex:"^([\\w@-]+)(\\:)"},{token:"text",regex:".+"}]}};i.inherits(g,m);k.DcfHighlightRules=g});define("mode/doc_comment_highlight_rules",["require","exports","module"],function(b,k){var i=b("ace/lib/oop"),m=b("ace/mode/text_highlight_rules").TextHighlightRules,g=function(){this.$rules={start:[{token:"comment.doc.tag",regex:"[@\\\\][\\w\\d_]+"},{token:"comment.doc",merge:!0,regex:"\\s+"},{token:"comment.doc",merge:!0,regex:"TODO"},{token:"comment.doc",merge:!0,regex:"[^@\\\\\\*]+"},{token:"comment.doc",merge:!0,regex:"."}]}};i.inherits(g,m);g.getStartRule=function(b){return{token:"comment.doc",
merge:!0,regex:"\\/\\*[\\*\\!]",next:b}};g.getEndRule=function(b){return{token:"comment.doc",merge:!0,regex:"\\*\\/",next:b}};k.DocCommentHighlightRules=g});define("util/expand_selection",["require","exports","module"],function(b){var k=b("ace/editor").Editor,i=b("ace/range").Range;b("ace/keyboard/vim");var m=b("ace/token_iterator").TokenIterator,g=b("mode/utils");(function(){function b(){if(e)for(var a=0;a<arguments.length;a++)console.log(arguments[a])}function j(a,c){for(var d=a.session.getTokens(c),b=0;b<d.length;b++){var e=d[b];if(!/^\s*$/.test(e.value))return/\bcomment\b/.test(e.type)}return!1}function c(a,c){var d=a.start.row<c.start.row||a.start.row===
c.start.row&&a.start.column<c.start.column,b=a.start.row===c.start.row&&a.start.column===c.start.column,e=a.end.row>c.end.row||a.end.row===c.end.row&&a.end.column>c.end.column,h=a.end.row===c.end.row&&a.end.column===c.end.column;return d?e||h:e?d||b:!1}function a(a,c){for(var d=a.getCurrentToken(),b=a.getCurrentTokenRow();a.moveToPreviousSignificantToken();){var e=a.getCurrentToken();if(b!==a.getCurrentTokenRow()&&0!==e.type.indexOf("keyword.operator")){if(!a.moveToNextSignificantToken())return!1;
break}if(l.test(d.value)&&(l.test(e.value)||g.isOpeningBracket(e.value)||g.contains(c,e.value))){if(!a.moveToNextSignificantToken())return!1;break}a.bwdToMatchingToken();d=a.getCurrentToken();b=a.getCurrentTokenRow()}return!0}function d(a,c,d){p.push({name:a,immediate:c,execute:d})}var h=this,e=!1,l=/['"\w.]/,n=!1;this.$onClearSelectionHistory=function(){return h.$clearSelectionHistory()};this.$clearSelectionHistory=function(){this.$selectionRangeHistory=null;this.off("change",this.$clearSelectionHistory)};
this.$acceptSelection=function(a,c,d){b("Accepting selection: ",d,c);null==this.$selectionRangeHistory&&(this.$selectionRangeHistory=[]);a.setSelectionRange(c);a.getRange().isEqual(d)||this.$selectionRangeHistory.push(d);(!this.isRowFullyVisible(c.start.row)||!this.isRowFullyVisible(c.end.row))&&this.centerSelection(a);return c};var p=[];d("string",!0,function(a,c,d,b){return(a=c.getTokenAt(b.start.row,b.start.column+1))&&/\bstring\b/.test(a.type)?new i(b.start.row,a.column+1,b.start.row,a.column+
a.value.length-1):null});d("token",!0,function(a,c,d,b){return(a=c.getTokenAt(b.start.row,b.start.column+1))&&/[\d\w]/.test(a.value)?new i(b.start.row,a.column,b.start.row,a.column+a.value.length):null});d("comment",!0,function(a,c,d,b){c=b.start.row;b=b.end.row;for(d=c;d<=b;d++)if(!j(a,d))return null;for(;j(a,c);)c--;for(;j(a,b);)b++;a=a.getSession().getLine(b-1).length;return new i(c+1,0,b-1,a)});d("includeBoundaries",!0,function(a,c,d,e){a=new m(c);d=a.moveToPosition(e.start);0===e.start.column&&
(d=a.moveToPreviousToken());c=new m(c);e=c.moveToPosition(e.end,!0);if(d&&e){var h="support.function.codebegin"===d.type&&"support.function.codeend"===e.type;h||(h=g.isOpeningBracket(d.value)&&g.getComplement(d.value)===e.value);if(h)return b("Expanding to match selection"),a=a.getCurrentTokenPosition(),d=c.getCurrentTokenPosition(),d.column+=e.value.length,i.fromPoints(a,d)}return null});d("matching",!1,function(a,c,d,b){a=new m(c);b=a.moveToPosition(b.start);if(null==b)return null;do{if(null==b)break;
if(!a.bwdToMatchingToken()&&(g.isOpeningBracket(b.value)||"support.function.codebegin"===b.type)){d=a.getCurrentTokenPosition();"support.function.codebegin"===b.type?(d.row++,d.column=0):d.column+=b.value.length;var e=a.clone();if(e.fwdToMatchingToken())return a=e.getCurrentTokenPosition(),"support.function.codebegin"===b.type&&(a.row--,a.column=c.getLine(a.row).length),i.fromPoints(d,a)}}while(b=a.stepBackward());return null});d("statement",!1,function(c,d,b,e){c=new m(d);if(!c.moveToPosition(e.start,
!0))return null;d=new m(d);if(!d.moveToPosition(e.end)||!a(c,[";",",","=","<-","<<-"]))return null;a:{for(var b=[";",","],h=d.getCurrentToken(),f=d.getCurrentTokenRow();d.moveToNextSignificantToken();){var j=d.getCurrentToken();if(f!==d.getCurrentTokenRow()&&0!==h.type.indexOf("keyword.operator")){if(!d.moveToPreviousSignificantToken()){b=!1;break a}break}if(l.test(h.value)||g.isClosingBracket(h.value))if(l.test(j.value)||g.isClosingBracket(j.value)||g.contains(b,j.value)){if(!d.moveToPreviousSignificantToken()){b=
!1;break a}break}d.fwdToMatchingToken();h=d.getCurrentToken();f=d.getCurrentTokenRow()}b=!0}if(!b)return null;b=c.getCurrentTokenPosition();h=d.getCurrentTokenPosition();if(b.row===e.start.row&&b.column===e.start.column&&h.row===e.end.row&&h.column<=e.end.column&&!a(c,[";",","]))return null;e=c.getCurrentTokenPosition();c=d.getCurrentTokenPosition();c.column+=d.getCurrentTokenValue().length;return i.fromPoints(e,c)});d("scope",!1,function(a,c,d,b){d=c.getMode();if(null==d.codeModel||null==d.codeModel.getCurrentScope)return null;
a=[];for(b=d.codeModel.getCurrentScope(b.start);null!=b;){var d=b.preamble,e=b.end;if(null==e&&b.parentScope)for(var h=b.parentScope.$children,l=h.length-2;0<=l;l--)if(h[l].equals(b)){e=h[l+1].preamble;break}null==e&&(e={row:c.getLength(),column:0});a.push(i.fromPoints(d,e));b=b.parentScope}return 0===a.length?null:a});d("everything",!1,function(a,c){var d=c.getLength();if(0===d)return new i(0,0,0,0);var b=c.getLine(d-1);return new i(0,0,d-1,b.length)});this.$expandSelection=function(){b("Begin new expand selection session");
b("----------------------------------");n||(h.on("change",h.$onClearSelectionHistory),n=!0);for(var a=this.getSession(),d=this.getSelection(),e=d.getRange(),l=[],j=0;j<p.length;j++){var m=p[j],i=m.execute(this,a,d,e);g.isArray(i)||(i=[i]);for(var k=0;k<i.length;k++){var D=i[k];if(D&&m.immediate&&c(D,e))return b("Accepting immediate expansion: '"+m.name+"'"),this.$acceptSelection(d,D,e);D&&c(D,e)&&l.push({name:m.name,range:D})}}l.sort(function(a,c){var a=a.range,c=c.range,d=a.end.row-a.start.row,b=
c.end.row-c.start.row;return d!==b?d>b:a.end.column-a.start.column>c.end.column-c.start.column});a=l[0].range;b("Selected candidate '"+l[0].name+"'",a);return this.$acceptSelection(d,a,e)};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;n&&(h.off("change",h.$onClearSelectionHistory),n=!1);
return this.getSelectionRange()}}).call(k.prototype)});define("mode/markdown",["require","exports","module"],function(b,k){var i=b("ace/lib/oop"),m=b("ace/mode/text").Mode,g=b("ace/mode/javascript").Mode,f=b("ace/mode/xml").Mode,j=b("ace/mode/html").Mode,c=b("mode/markdown_highlight_rules").MarkdownHighlightRules,a=b("mode/markdown_folding").FoldMode,d=function(){this.HighlightRules=c;this.createModeDelegates({"js-":g,"xml-":f,"html-":j});this.foldingRules=new a};i.inherits(d,m);(function(){this.type="text";this.blockComment={start:"<\!--",end:"--\>"};
this.getNextLineIndent=function(a,c){return this.$getIndent(c)};this.$id="mode/markdown"}).call(d.prototype);k.Mode=d});define("mode/markdown_folding",["require","exports","module"],function(b,k){var i=b("ace/lib/oop"),m=b("ace/mode/folding/fold_mode").FoldMode,g=b("ace/range").Range,f=k.FoldMode=function(){},j=b("mode/utils");i.inherits(f,m);(function(){this.foldingStartMarker=/^(?:[=-]+\s*$|#{1,6} |`{3})/;this.getFoldWidget=function(c,a,d){var a="markbeginend"===a?"end":"",b=c.getLine(d);return!this.foldingStartMarker.test(b)?"":"`"==b[0]?"start"===j.getPrimaryState(c,d)?a:"start":""};this.getFoldWidgetRange=function(c,
a,d){function b(a){return(k=c.getTokens(a)[0])&&0===k.type.lastIndexOf(w,0)}function e(){var a=k.value[0];return"="==a?6:"-"==a?5:7-k.value.search(/[^#]/)}var l=c.getLine(d),a=l.length,f=c.getLength(),m=d,i=d;if(l.match(this.foldingStartMarker)){if("`"==l[0]){if("start"!==j.getPrimaryState(c,d)){for(;++d<f&&!(l=c.getLine(d),"`"==l[0]&"```"==l.substring(0,3)););return new g(m,a,d,0)}for(;0<d--&&!(l=c.getLine(d),"`"==l[0]&"```"==l.substring(0,3)););return new g(d,l.length,m,0)}var k,w="markup.heading";
if(b(d)){for(i=e();++d<f&&!(b(d)&&e()>=i););i=d-(!k||-1==["=","-"].indexOf(k.value[0])?1:2);if(i>m)for(;i>m&&/^\s*$/.test(c.getLine(i));)i--;if(i>m)return d=c.getLine(i).length,new g(m,a,i,d)}}}}).call(f.prototype)});define("mode/markdown_highlight_rules",["require","exports","module"],function(b,k){function i(a,c){return{token:"support.function",regex:"^\\s*```(?:\\{"+a+"[^\\}]*\\}|"+a+")\\s*$",push:c+"start"}}var m=b("ace/lib/oop"),g=b("ace/lib/lang"),f=b("ace/mode/text_highlight_rules").TextHighlightRules,j=b("ace/mode/javascript_highlight_rules").JavaScriptHighlightRules,c=b("ace/mode/xml_highlight_rules").XmlHighlightRules,a=b("ace/mode/html_highlight_rules").HtmlHighlightRules,d=b("ace/mode/css_highlight_rules").CssHighlightRules,
h=b("ace/mode/perl_highlight_rules").PerlHighlightRules,e=b("ace/mode/python_highlight_rules").PythonHighlightRules,l=b("ace/mode/ruby_highlight_rules").RubyHighlightRules,n=b("ace/mode/scala_highlight_rules").ScalaHighlightRules,p=b("ace/mode/sh_highlight_rules").ShHighlightRules;b("mode/stan_highlight_rules");var o=b("mode/sql_highlight_rules").SqlHighlightRules,u=function(a){return"(?:[^"+g.escapeRegExp(a)+"\\\\]|\\\\.)*"},w=function(){var b=g.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"],regex:"(\\s+|^)(__.+?__)\\b"},m={token:["text","constant.language.boolean"],regex:"(\\s+|^)(_(?=[^_])(?:(?:\\\\.)|(?:[^_\\\\]))*?_)\\b"},k={token:["constant.numeric"],regex:"([*][*].+?[*][*])"},w={token:["constant.language.boolean"],regex:"([*](?=[^*])(?:(?:\\\\.)|(?:[^*\\\\]))*?[*])"};this.$rules={basic:[{token:"constant.language.escape",regex:/\\[\\`*_{}\[\]()#+\-.!]/},{token:"support.function.inline_r_chunk",regex:"`r (?:.*?[^`])`"},{token:["support.function",
"support.function","support.function"],regex:"(`+)(.*?[^`])(\\1)"},{token:"text,constant,text,url,string,text".split(","),regex:'^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:["][^"]+["])?(\\s*))$'},{token:["text","keyword","text","constant","text"],regex:"((?:[^^]|^)\\[)("+u("]")+")(\\]s*\\[)("+u("]")+")(\\])"},{token:"text,keyword,text,markup.href,string,text".split(","),regex:"((?:[^^]|^)\\[)("+u("]")+')(\\]\\()((?:[^\\)\\s\\\\]|\\\\.|\\s(?=[^"]))*)(\\s*"'+u('"')+'"\\s*)?(\\))'},{token:["text",
"keyword","text"],regex:"(<)((?:https?|ftp|dict):[^'\">\\s]+|(?:mailto:)?[-.\\w]+\\@[-a-z0-9]+(?:\\.[-a-z0-9]+)*\\.[a-z]+)(>)"},k,f,w,m],start:[{token:"empty_line",regex:"^\\s*$",next:"allowBlock"},{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"},i("(?:javascript|js)","jscode-"),i("xml","xmlcode-"),i("html","htmlcode-"),i("css","csscode-"),i("perl","perlcode-"),i("python","pythoncode-"),i("ruby","rubycode-"),i("scala","scalacode-"),i("sh","shcode-"),i("bash","bashcode-"),i("stan","stancode-"),i("sql","sqlcode-"),{token:"support.function",regex:"^\\s*```\\s*\\S*(?:{.*?\\})?\\s*$",next:"githubblock"},{token:"string.blockquote",
regex:"^\\s*>\\s*(?=[-])"},{token:"string.blockquote",regex:"^\\s*>\\s*",next:"blockquote"},{token:"text,constant,text,url,string,text".split(","),regex:'^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:["][^"]+["])?(\\s*))$'},{token:["text","keyword","text","constant","text"],regex:"(\\[)((?:[[^\\]]*\\]|[^\\[\\]])*)(\\][ ]?(?:\\n[ ]*)?\\[)(.*?)(\\])"},{token:"constant",regex:"^[ ]{0,2}(?:[ ]?\\*[ ]?){3,}\\s*$"},{token:"constant",regex:"^[ ]{0,2}(?:[ ]?\\-[ ]?){3,}\\s*$"},{token:"constant",regex:"^[ ]{0,2}(?:[ ]?\\_[ ]?){3,}\\s*$"},
{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:"constant",regex:"^ {0,2}(?:(?: ?\\* ?){3,}|(?: ?\\- ?){3,}|(?: ?\\_ ?){3,})\\s*$",next:"allowBlock"},{token:"text",regex:"^\\s*(?:[*+-]|\\d+\\.)\\s+",next:"listblock"},k,f,w,m,{token:"comment",regex:"<\\!--",next:"html-comment"},{include:"basic"}],"html-comment":[{token:"comment",
regex:"--\>",next:"start"},{defaultToken:"comment"}],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"},{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:"support.function.inline_r_chunk",regex:"`r (?:.*?[^`])`"},{token:["support.function","support.function","support.function"],regex:"(`+)(.*?[^`])(\\1)"},{token:"text,constant,text,url,string,text".split(","),regex:'^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:["][^"]+["])?(\\s*))$'},{token:["text","keyword","text","constant",
"text"],regex:"((?:[^^]|^)\\[)("+u("]")+")(\\]s*\\[)("+u("]")+")(\\])"},{token:"text,keyword,text,markup.href,string,text".split(","),regex:"((?:[^^]|^)\\[)("+u("]")+')(\\]\\()((?:[^\\)\\s\\\\]|\\\\.|\\s(?=[^"]))*)(\\s*"'+u('"')+'"\\s*)?(\\))'},{token:["text","keyword","text"],regex:"(<)((?:https?|ftp|dict):[^'\">\\s]+|(?:mailto:)?[-.\\w]+\\@[-a-z0-9]+(?:\\.[-a-z0-9]+)*\\.[a-z]+)(>)"},k,f,w,m,{defaultToken:"string.blockquote"}],githubblock:[{token:"support.function",regex:"^\\s*```",next:"start"},
{token:"support.function",regex:".+"}],fieldblock:[{token:function(a){a=a.slice(0,-1);return b[a]?"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(j,"jscode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(a,"htmlcode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(d,"csscode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(c,"xmlcode-",[{token:"support.function",
regex:"^\\s*```",next:"pop"}]);this.embedRules(h,"perlcode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(e,"pythoncode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(l,"rubycode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(n,"scalacode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(p,"shcode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(p,"bashcode-",
[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.embedRules(o,"sqlcode-",[{token:"support.function",regex:"^\\s*```",next:"pop"}]);this.normalizeRules()};m.inherits(w,f);k.MarkdownHighlightRules=w});define("mode/mermaid",["require","exports","module"],function(b,k){var i=b("ace/lib/oop"),m=b("ace/mode/text").Mode,g=b("ace/tokenizer").Tokenizer,f=b("mode/mermaid_highlight_rules").MermaidHighlightRules,j=function(){this.$highlightRules=new f;this.$tokenizer=new g(this.$highlightRules.getRules())};i.inherits(j,m);(function(){this.getNextLineIndent=function(c,a){return this.$getIndent(a)}}).call(j.prototype);k.Mode=j});define("mode/mermaid_highlight_rules",["require","exports","module"],function(b,k){var i=b("ace/lib/oop"),m=b("ace/mode/text_highlight_rules").TextHighlightRules,g=function(){this.createKeywordMapper({keyword:"sequenceDiagram|participant|graph|subgraph|loop|alt|is|opt|else|end|style|linkStyle|classDef|class"},"identifier",!1);this.$rules={start:[{token:"keyword",merge:!1,regex:"^\\s*graph\\s+(?:TB|BT|RL|LR|TD)\\s*$"},{token:"keyword",merge:!1,regex:"^\\s*(?:sequenceDiagram|participant|subgraph|loop|alt(?:\\s+is)?|opt|else(?:\\s+is)?|end|style|linkStyle|classDef|class)"},
{token:"keyword.operator",merge:!1,regex:">|\\->|\\-\\->|\\-\\-\\-|\\-\\-|\\-\\.\\->|\\-\\.|\\.\\->|==>|==|\\->>|\\-\\->>|\\-x|\\-\\-x"},{token:"paren.keyword.operator",merge:!1,regex:"[[({\\|]"},{token:"paren.keyword.operator",merge:!1,regex:"[\\])}]"},{token:"markup.list",merge:!1,regex:"Note\\s+(?:left|right)\\s+of"},{token:"markup.list",merge:!1,regex:"<br/>"},{token:"text",regex:"\\s+",merge:!0}]}};i.inherits(g,m);k.MermaidHighlightRules=g});define("mode/r",["require","exports","module"],function(b,k){b("ace/editor");b("ace/edit_session");b("ace/range");var i=b("ace/lib/oop"),m=b("ace/mode/text").Mode,g=b("ace/tokenizer").Tokenizer,f=b("ace/mode/text_highlight_rules").TextHighlightRules,j=b("mode/r_highlight_rules").RHighlightRules,c=b("mode/r_code_model").RCodeModel,a=b("mode/r_matching_brace_outdent").RMatchingBraceOutdent;b("mode/auto_brace_insert");var d=b("ace/unicode"),h=function(d,b){this.$tokenizer=d?new g((new f).getRules()):
new g((new j).getRules());this.foldingRules=this.codeModel=new c(b,this.$tokenizer);this.$outdent=new a(this.codeModel)};i.inherits(h,m);(function(){this.checkOutdent=function(a,c,d){return this.$outdent.checkOutdent(a,c,d)};this.autoOutdent=function(a,c,d){return this.$outdent.autoOutdent(a,c,d)};this.tokenRe=RegExp("^["+d.packages.L+d.packages.Mn+d.packages.Mc+d.packages.Nd+d.packages.Pc+"._]+","g");this.nonTokenRe=RegExp("^(?:[^"+d.packages.L+d.packages.Mn+d.packages.Mc+d.packages.Nd+d.packages.Pc+
"._]|\\s])+","g");this.$complements={"(":")","[":"]",'"':'"',"'":"'","{":"}","`":"`"};this.$reOpen=/^[{(\["'`]$/;this.$reClose=/^[})\]"'`]$/;this.getNextLineIndent=function(a,c,d,b){return this.codeModel.getNextLineIndent(a,c,d,b)};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,c,d,b,h){return"insertion"===c&&"\n"===
h&&(a=d.getSelectionRange().start,(b=/^((\s*#+')\s*)/.exec(b.doc.getLine(a.row)))&&d.getSelectionRange().start.column>=b[2].length)?{text:"\n"+b[1]}:!1};this.$id="mode/r"}).call(h.prototype);k.Mode=h});define("mode/r_code_model",["require","exports","module"],function(b,k){function i(a,c){for(var d=0;d<c.length;d++)if(a===c[d])return!0;return!1}var m=b("ace/range").Range,g=b("ace/token_iterator").TokenIterator,f=b("mode/token_cursor").RTokenCursor,j=b("mode/utils"),c=!1,a=b("mode/r_scope_tree").ScopeManager,d=b("mode/r_scope_tree").ScopeNode,h=function(c,b,h,g,f){this.$session=c;this.$doc=c.getDocument();this.$tokenizer=b;this.$tokens=Array(this.$doc.getLength());this.$endStates=Array(this.$doc.getLength());
this.$statePattern=h;this.$codeBeginPattern=g;this.$codeEndPattern=f;this.$scopes=new a(d);var j=!0,m=function(){j?j=!1:(this.$doc.off("change",i),this.$session.off("changeMode",m))}.bind(this),i=function(a){this.$onDocChange(a)}.bind(this);this.$session.on("changeMode",m);this.$doc.on("change",i)};(function(){function a(c){return"keyword"==c.type&&"function"==c.value}function d(a){return/\boperator\b/.test(a.type)&&/^(=|<-|<<-)$/.test(a.value)}function b(a){return/\bidentifier\b/.test(a.type)}function h(c){var d=
c.cloneCursor();if("{"!==d.currentValue()||!d.moveBackwardOverMatchingParens()||!d.moveToPreviousToken()||!a(d.currentToken()))return!1;c.$row=d.$row;c.$offset=d.$offset;return!0}function k(a){for(;a.findOpeningBracket("(")&&a.moveToPreviousToken();)if(i(a.currentValue(),["if","for","while"]))return!0;return!1}function u(c){var b=c.cloneCursor();if(!a(b.currentToken())||!b.moveToPreviousToken()||!d(b.currentToken())||!b.moveToPreviousToken())return!1;c.$row=b.$row;c.$offset=b.$offset;return!0}function w(a){return/\binfix\b/.test(a.type)}
function y(c){if(a(c.currentToken())&&!c.moveToNextToken()||"("===c.currentValue()&&!c.moveToNextToken()||")"===c.currentValue())return[];var d=[];for(b(c.currentToken())&&d.push(c.currentValue());c.moveToNextToken();)if(!c.fwdToMatchingToken()){if(")"===c.currentValue())break;if(","===c.currentValue()){for(;","===c.currentValue()&&c.moveToNextToken(););b(c.currentToken())&&d.push(c.currentValue())}}return d}function r(a){for(var c=0,d=Math.min(a.getLength(),100),b="Title";c++<d;){var e=a.getLine(c);
if(/^\s*[-]{3}\s*$/.test(e))break;e=/^\s*title:\s+(.*?)\s*$/.exec(e);if(null!==e){b=e[1];break}}return j.stripEnclosingQuotes(b.trim())}var P=j.contains;this.getTokenCursor=function(){return new f(this.$tokens,0,0,this)};this.$complements={"(":")",")":"(","[":"]","]":"[","{":"}","}":"{"};var C=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 a=a.cloneCursor(),c="";a.hasType("identifier")&&(c=a.currentValue());var d="left";"="===a.currentValue()&&(d="right");if(a.hasType("identifier")){if(!a.moveToPreviousToken())return null;"="===a.currentValue()&&(d="right")}if(!a.findOpeningBracket("(",!0)||!a.moveToPreviousToken())return null;for(;a.findOpeningBracket("(",!0)&&a.moveToPreviousToken();)if(/_join$/.test(a.currentValue())){var b=
a.currentValue();if(!a.moveToNextToken())break;if(!a.moveToNextToken())break;var e=a.currentValue(),h="";if(!1===this.moveToDataObjectFromInfixChain(a))break;h=a.currentValue();return{token:c,leftData:h,rightData:e,verb:b,cursorPos:d}}return null};this.getDataFromInfixChain=function(a){var c=this.moveToDataObjectFromInfixChain(a),d=[],b=[],e="",h=!1;!1!==c&&(c.excludeArgsFromObject&&(h=c.excludeArgsFromObject),e=a.currentValue(),d=c.additionalArgs,b=c.excludeArgs);return{name:e,additionalArgs:d,excludeArgs:b,
excludeArgsFromObject:h}};var x="mutate,summarise,summarize,rename,transmute,select,rename_vars,inner_join,left_join,right_join,semi_join,anti_join,outer_join,full_join".split(","),D=function(a,c,d,b){if(!a.moveToNextToken()||"("!==a.currentValue()||!a.moveToNextToken()||")"===a.currentValue())return!1;a.hasType("identifier")&&c.additionalArgs.push(a.currentValue());if("rename"===b){if(!a.moveToNextToken())return!1;c.excludeArgs.push(a.currentValue())}"select"===b&&(c.excludeArgsFromObject=!0);do{if(")"===
a.currentValue())break;if(a.$row>d.$row||a.$row===d.$row&&a.$offset>=d.$offset)break;if(a.fwdToMatchingToken()){if(!a.moveToNextToken())break}else if(","===a.currentValue()){if(!a.moveToNextToken())return!1;a.hasType("identifier")&&c.additionalArgs.push(a.currentValue());if(!a.moveToNextToken())return!1;if("="===a.currentValue()&&i(b,["rename","rename_vars"])){if(!a.moveToNextToken())return!1;a.hasType("identifier")&&c.excludeArgs.push(a.currentValue())}}}while(a.moveToNextToken());return!0};this.moveToDataObjectFromInfixChain=
function(a){var c=a.cloneCursor(),d;a:{for(d=c.cloneCursor();d.findOpeningBracket("(",!1)&&d.moveToPreviousToken();){if(!d.moveToPreviousToken())break;if(":"===d.currentValue()){for(;":"===d.currentValue();)if(!d.moveToPreviousToken()){d=!1;break a}if(!d.moveToPreviousToken())break}if(w(d.currentToken())){c.$row=d.$row;c.$offset=d.$offset;d=!0;break a}}d=!1}if(!d)return!1;for(d={additionalArgs:[],excludeArgs:[]};;){if(0===c.$row&&0===c.$offset)return a.$row=0,a.$offset=0,d;c.moveBackwardOverMatchingParens();
if(!c.moveToPreviousToken())return!1;var b=c.currentValue();P(x,b)&&D(c.cloneCursor(),d,a,b);if(!c.moveToPreviousToken())return 0===c.$row&&0===c.$offset?(a.$row=0,a.$offset=0,d):!1;if(":"===c.currentValue()){for(;":"===c.currentValue();)if(!c.moveToPreviousToken())return!1;if(!c.moveToPreviousToken())return!1}if(!w(c.currentToken()))break}if(!c.moveToNextToken())return!1;a.$row=c.$row;a.$offset=c.$offset;return d};this.getVariablesInScope=function(a){var c=this.getTokenCursor();if(!c.moveToPosition(a))return[];
a=c.cloneCursor();!a.findOpeningBracket("(",!0)||!a.moveToPreviousToken()?a=!1:"function"!==a.currentValue()?a=!1:(c.$row=a.$row,c.$offset=a.$offset,a=!0);a&&u(c)&&c.findStartOfEvaluationContext();a={};do if(!c.bwdToMatchingToken()){var e=a,h=c.cloneCursor();if(!("for"!==h.currentValue()||!h.moveToNextToken()||"("!==h.currentValue())&&h.moveToNextToken()){var g=h.currentValue();h.moveToNextToken()&&"in"===h.currentValue()&&(e[g]="variable")}d(c.currentToken())&&(e="variable",h=c.cloneCursor(),h.moveToNextToken()&&
"function"===h.currentValue()&&(e="function"),h=c.cloneCursor(),h.moveToPreviousToken()&&b(h.currentToken())&&(h=h.currentValue(),a[h]=e))}while(c.moveToPreviousToken());var c=[],f;for(f in a)c.push({token:f,type:a[f]});c.sort();return c};this.$buildScopeTreeUpToRow=function(a){function c(a,d){if("undefined"===typeof a)return"";var b=a.exec(d);if(!b)return null;var e=b[1].split(",");if(0==e.length)return null;if(!/=/.test(e[0]))return e[0].replace(/(^\s+)|(\s+$)/g,"");for(var h=0;h<e.length;h++)if(b=
/^\s*label\s*=\s*(.*)$/.exec(e[h]))return j.stripEnclosingQuotes(b[1].trim());return null}var d=this.$session.getMode().$id,a=Math.min(a+30,this.$doc.getLength()-1),b=this.$scopes.parsePos.row;if(b>=a)return b;b=new g(this.$session);b.tokenizeUpToRow(a);this.$tokenizeUpToRow(a);var e=this.$scopes.parsePos.row;b.moveToPosition({row:e,column:this.$scopes.parsePos.column},!0);var l=b.getCurrentToken();if(null==l)return e;var f=l.value,n=l.type,i=b.getCurrentTokenPosition(),e=this.$scopes.getChunkCount();
do{if(b.$row>a)break;f=l.value;n=l.type;i=b.getCurrentTokenPosition();if("rd-start"===this.$session.getState(i.row))b.moveToEndOfRow();else if(l=!0,this.$codeBeginPattern&&(l=/^r-/.test(this.$session.getState(b.$row))),j.startsWith(n,"markup.heading")){var l="",k={row:i.row,column:0},o={row:i.row+1,column:0},n=0;if(/^\s*#+\s*$/.test(f))n=f.split("#").length-1,f=this.$session.getLine(i.row),l=f.replace(/^\s*[#]+\s*/,"");else if(/^[-=]{3,}\s*$/.test(f)&&(n="="===f[0]?1:2,l=this.$session.getLine(i.row-
1).trim(),k.row--,0===l.length))continue;0===l.length&&(l="(Untitled)");l=l.replace(/{.*}\s*$/,"");this.$scopes.onMarkdownHead(l,k,o,n)}else if(l&&/\bsectionhead\b/.test(n)){l="(Untitled)";if(n=/[^#=-\s]/.exec(f))l=f.substr(n.index),l=l.replace(/\s*[#=-]+\s*$/,"");this.$scopes.onSectionHead(l,i)}else if(!l&&"mode/sweave"===d&&"keyword"===n&&0===f.indexOf("\\")&&("\\chapter"===f||"\\section"===f||"\\subsection"===f||"\\subsubsection"===f))n=1,"\\chapter"===f?n=2:"\\section"===f?n=3:"\\subsection"===
f?n=4:"\\subsubsection"===f&&(n=5),f=this.$doc.getLine(i.row),f=/{([^}]*)}/.exec(f),l="",null!=f&&(l=f[1]),k={row:i.row,column:0},o={row:i.row,column:Infinity},this.$scopes.onMarkdownHead(l,k,o,n);else if(/\bcodebegin\b/.test(n)&&"---"===f)this.$scopes.onSectionHead(r(this.$session),i,{isYaml:!0});else if(/\bcodeend\b/.test(n)&&"---"===f)i.column=Infinity,this.$scopes.onSectionEnd(i);else if("mode/rmarkdown"===d&&/\bcodebegin\b/.test(n)&&0===f.trim().indexOf("/***"))this.$scopes.onSectionHead("(R Code Chunk)",
i);else if("mode/rmarkdown"===d&&/\bcodeend\b/.test(n)&&0===f.trim().indexOf("*/"))this.$scopes.onSectionEnd(i);else/\bcodebegin\b/.test(n)?(e++,l={row:i.row+1,column:0},k=e,n=c(this.$codeBeginPattern,f),k="Chunk "+k,n&&"YAML Header"!==f&&(k+=": "+n),this.$scopes.onChunkStart(n,k,i,l)):/\bcodeend\b/.test(n)?(i.column+=f.length,this.$scopes.onChunkEnd(i)):l&&"{"===f?(f=this.getTokenCursor(),f.moveToPosition(i,!0),i=f.cloneCursor(),h(i)?(l=i.cloneCursor(),l.moveToNextToken(),n=null,u(i)&&(k=i.cloneCursor(),
o=i.cloneCursor(),o.findStartOfEvaluationContext()&&(n=o.currentPosition(),o=k.currentPosition(),n.row!==o.row?(n.row=o.row,n.column=0,i.$row=n.row,i.$offset=0):i.moveToPosition(n,!0),n=this.$doc.getTextRange(new m(n.row,n.column,o.row,o.column+k.currentValue().length)))),k=i.currentPosition(),i.isFirstSignificantTokenOnLine()&&(k.column=0),i=y(l),l="("+i.join(", ")+")",this.$scopes.onFunctionScopeStart(null==n?C("<function>"+l):C(n+l),k,f.currentPosition(),n,i)):(k=f.currentPosition(),f.isFirstSignificantTokenOnLine()&&
(k.column=0),this.$scopes.onScopeStart(k))):l&&"}"===f&&(i.column+=1,this.$scopes.onScopeEnd(i))}while(l=b.moveToNextToken());a=Math.max(a,b.$row);this.$scopes.parsePos={row:a,column:-1};return a};this.$getFoldToken=function(a,c,d){this.$tokenizeUpToRow(d);if(this.$statePattern&&!this.$statePattern.test(this.$endStates[d]))return"";a=this.$tokens[d];for(d=0;d<a.length;d++)if(/\bsectionhead\b/.test(a[d].type))return a[d];for(var b=0,e=null,h=null,d=0;d<a.length;d++){var l=a[d];if(/\bparen\b/.test(l.type))switch(l.value){case "{":b++;
1==b&&(e=l);break;case "}":b--,0==b&&(e=null),0>b&&(h=l,b=0)}}return e?e:"markbeginend"==c&&h?h:1<=a.length&&(/\bcodebegin\b/.test(a[0].type)||/\bcodeend\b/.test(a[0].type))?a[0]:null};this.getFoldWidget=function(a,c,d){a=this.$getFoldToken(a,c,d);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,d){var b=this.$getFoldToken(a,c,d);if(b){c={row:d,
column:b.column+1};if("{"==b.value)return a=a.$findClosingBracket(b.value,c),!a?void 0:m.fromPoints(c,a);if("}"==b.value)return a=a.$findOpeningBracket(b.value,c),!a?void 0:m.fromPoints({row:a.row,column:a.column+1},{row:c.row,column:c.column-1});if(/\bcodebegin\b/.test(b.type))for(var c=new g(a,d,0),e;e=c.stepForward();){if(/\bcode(begin|end)\b/.test(e.type))return e=/\bcodebegin\b/.test(e.type),c=c.getCurrentTokenRow(),a=e?{row:c-1,column:a.getLine(c-1).length}:{row:c,column:a.getLine(c).length},
m.fromPoints({row:d,column:b.column+b.value.length},a)}else if(/\bcodeend\b/.test(b.type))for(c=new g(a,d,0);b=c.stepBackward();){if(/\bcodebegin\b/.test(b.type))return c=c.getCurrentTokenRow(),m.fromPoints({row:c,column:a.getLine(c).length},{row:d,column:a.getLine(d).length})}else if(/\bsectionhead\b/.test(b.type)){b=a.getLine(d);if(/^\s*[#=-]+\s*$/.test(b))b=b.length;else{b=/[#=-]+\s*$/.exec(b);if(!b)return;b=b.index}c.column=b;d=new g(a,d+1);for(d.$tokenIndex=-1;(token=d.stepForward())&&!("}"===
token.value||/\bsectionhead\b/.test(token.type)||/\bcode(?:begin|end)/.test(token.type));)"{"===token.value&&d.fwdToMatchingToken();d=d.getCurrentTokenRow();token&&d--;a={row:d,column:a.getLine(d).length};return m.fromPoints(c,a)}}};this.getCurrentScope=function(a,c){c||(c=function(){return!0});if(!a)return"";this.$buildScopeTreeUpToRow(a.row);var d=this.$scopes.getActiveScopes(a);if(d)for(var b=d.length-1;0<=b;b--)if(c(d[b]))return d[b];return null};this.getScopeTree=function(){this.$buildScopeTreeUpToRow(this.$doc.getLength()-
1);return this.$scopes.getScopeList()};this.findFunctionDefinitionFromUsage=function(a,c){this.$buildScopeTreeUpToRow(this.$doc.getLength()-1);return this.$scopes.findFunctionDefinitionFromUsage(a,c)};this.getIndentForOpenBrace=function(a){if(this.$tokenizeUpToRow(a.row)){var c=this.getTokenCursor();if(c.seekToNearestToken(a,a.row)&&"{"==c.currentValue()&&c.moveBackwardOverMatchingParens())return this.$getIndent(this.$getLine(c.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,b,e,h){if(j.endsWith(a,"qstring"))return"";"number"!==typeof h&&(h=this.$session.getSelection().getCursor().row-1);var f=this.$session.getTabSize(),a=Array(f+1).join(" ");this.$lineOverrides=null;this.$doc.getLine(h)!==b&&(this.$lineOverrides={},this.$lineOverrides[h]=b,this.$invalidateRow(h));try{var g=0>h?"":this.$getIndent(this.$getLine(h));
if(!this.$tokenizeUpToRow(h))return g;var n={row:h,column:this.$getLine(h).length},m=this.$findPreviousSignificantToken(n,h-10),g="",p=!1;if(m&&("keyword.operator"===m.token.type||"keyword.operator.infix"===m.token.type))g=e,p=!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){return 0===a.length});if(null!=w){var u=this.$findPreviousSignificantToken(w,0);if(u&&"keyword"===u.token.type&&/^(if|while|for|function)$/.test(u.token.value))return this.$getIndent(this.$getLine(u.row))+
e}}else if(m&&"keyword"===m.token.type&&("repeat"===m.token.value||"else"===m.token.value))return this.$getIndent(this.$getLine(m.row))+e;var r=this.getTokenCursor();if(!r.moveToPosition(n))return"";do{var q=r.currentType();if("support.function.codebegin"===q||"support.function.codeend"===q)return this.$getIndent(this.$doc.getLine(r.$row))+g;var y=r.currentValue();if(r.isAtStartOfNewExpression(!1)){if("{"===y||"["===y||"("===y)g+=e;return this.$getIndent(this.$doc.getLine(r.$row))+g}if("("===y&&r.isAtStartOfNewExpression(!0))return this.$getIndent(this.$doc.getLine(r.$row))+
e;if(!r.bwdToMatchingToken()){if("{"===y)break;if(P(["[","("],y)){var x=r.currentPosition(),n=null;c&&(n=this.$findNextSignificantToken({row:x.row,column:x.column+1},h));if(n){for(var b=this.$getLine(n.row),D=b.replace(/[^\s].*$/,""),C=n.column-D.length,M=Math.floor(C/f),x=C-f*M,C="",b=0;b<M;b++)C+=e;for(e=0;e<x;e++)C+=" ";for(var e=D+C,F=e.replace("\t",a).length,G,b=n.row+1;b<=h;b++)if(/[^\s]/.test(this.$getLine(b))){var A=this.$endStates[b-1];if(!("qstring"===A||"qqstring"===A)){G=this.$getLine(b).replace(/[^\s].*$/,
"");var v=G.replace("\t",a).length;v<F&&(e=G,F=v)}}return k(r)?e:e+g}return this.getIndentForOpenBrace(x)+e+g}}}while(r.moveToPreviousToken());if(!r.moveToPosition(n))return"";do if(!r.bwdToMatchingToken()){if("{"===r.currentValue())return this.getIndentForOpenBrace(r.currentPosition())+e+g;if(d(r.currentToken())){for(;d(r.currentToken())&&r.moveToPreviousToken();){if(!r.findStartOfEvaluationContext())break;var B=r.cloneCursor();if(B.moveToPreviousToken()&&("else"===B.currentValue()||"repeat"===B.currentValue()||
")"===B.currentValue()&&B.bwdToMatchingToken()&&B.moveToPreviousToken()&&(y=B.currentValue(),P(["if","for","while","repeat","else"],y))))return this.$getIndent(this.$doc.getLine(B.$row))+g+g;d(r.peekBwd().currentToken())&&r.moveToPreviousToken()}return this.$getIndent(this.$getLine(r.$row))+g}}while(r.moveToPreviousToken());if(p){F=0;r=this.getTokenCursor();r.moveToPosition(n);r.moveToPreviousToken();do{if(i(r.currentValue(),["if","else"])){g+=e;break}if(r.hasType("constant","identifier")){if(!r.moveToPreviousToken())break;
if(i(r.currentValue(),["if","else"])){g+=e;break}if(")"===r.currentValue()){if(!r.bwdToMatchingToken())break;if(!r.moveToPreviousToken())break;if(i(r.currentValue(),["if","else"])){g+=e;break}}if(!r.hasType("operator"))break}else if(!r.findStartOfEvaluationContext())break}while(r.moveToPreviousToken()&&20>F++)}var N=this.$findNextSignificantToken({row:0,column:0},h);return N?this.$getIndent(this.$getLine(N.row))+g:""+g}finally{this.$lineOverrides&&(this.$lineOverrides=null,this.$invalidateRow(h))}};
this.getBraceIndent=function(a){var c=this.getTokenCursor(),d={row:a,column:this.$getLine(a).length};if(!c.moveToPosition(d))return"";if(")"===c.currentValue()){if(c.bwdToMatchingToken()&&c.moveToPreviousToken()&&(d=c.currentValue(),i(d,["if","while","for","function"])))return this.$getIndent(this.$getLine(c.$row))}else if(i(c.currentValue(),["else","repeat","<-","<<-","="])||c.hasType("infix")||"keyword.operator"===c.currentType())return this.$getIndent(this.$getLine(c.$row));return this.getIndentForRow(a)};
this.getTokenForPos=function(a,c,d){this.$tokenizeUpToRow(a.row);if(this.$tokens.length<=a.row)return null;for(var b=this.$tokens[a.row],e=0;e<b.length;e++){var h=b[e];if(c&&a.column==h.column)return h;if(a.column<=h.column)break;if(d&&a.column==h.column+h.value.length||a.column<h.column+h.value.length)return h}return null};this.$tokenizeUpToRow=function(a){for(var a=Math.min(a,this.$endStates.length-1),c=0,d=!0;c<=a;c++)if(!d||!this.$endStates[c]){var d=!1,b=0===c?"start":this.$endStates[c-1],e=
this.$tokenizer.getLineTokens(this.$getLine(c),b,c);this.$tokens[c]=!this.$statePattern||this.$statePattern.test(e.state)||this.$statePattern.test(b)?this.$filterWhitespaceAndComments(e.tokens):[];e.state===this.$endStates[c]?d=!0:this.$endStates[c]=e.state}d||c<this.$tokens.length&&this.$invalidateRow(c);return!0};this.$onDocChange=function(a){a=a.data;"insertLines"===a.action?this.$insertNewRows(a.range.start.row,a.range.end.row-a.range.start.row):"insertText"===a.action?this.$doc.isNewLine(a.text)?
(this.$invalidateRow(a.range.start.row),this.$insertNewRows(a.range.end.row,1)):this.$invalidateRow(a.range.start.row):"removeLines"===a.action?(this.$removeRows(a.range.start.row,a.range.end.row-a.range.start.row),this.$invalidateRow(a.range.start.row)):"removeText"===a.action&&(this.$doc.isNewLine(a.text)&&this.$removeRows(a.range.end.row,1),this.$invalidateRow(a.range.start.row));this.$scopes.invalidateFrom(a.range.start)};this.$invalidateRow=function(a){this.$tokens[a]=null;this.$endStates[a]=
null};this.$insertNewRows=function(a,c){for(var d=[a,0],b=0;b<c;b++)d.push(null);this.$tokens.splice.apply(this.$tokens,d);this.$endStates.splice.apply(this.$endStates,d)};this.$removeRows=function(a,c){this.$tokens.splice(a,c);this.$endStates.splice(a,c)};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,c,d){var b=
/\bparen\b/;return a<c?function(){for(;a<=c;a++)for(var e=this.$tokens[a],h=0;h<e.length;h++)if(b.test(e[h].type)&&!d(e[h].value,{row:a,column:e[h].column}))return!1;return!0}.call(this):function(){a=Math.max(0,a);for(c=Math.max(0,c);a>=c;a--)for(var e=this.$tokens[a],h=e.length-1;0<=h;h--)if(b.test(e[h].type)&&!d(e[h].value,{row:a,column:e[h].column}))return!1;return!0}.call(this)};this.$walkParensBalanced=function(a,c,d,b){var e=[],h=null,l=this;this.$walkParens(a,c,function(a,c){if(d&&d(e,a,c))return h=
c,!1;if(/[\[({]/.test(a))if(e[e.length-1]===l.$complements[a])e.pop();else return!0;else e.push(a);return b&&b(e,a,c)?(h=c,!1):!0});return h};this.$findNextSignificantToken=function(a,c){if(0==this.$tokens.length)return null;for(var c=Math.min(c,this.$tokens.length-1),d=a.row,b=a.column;d<=c;d++){for(var e=this.$tokens[d],h=0;h<e.length;h++)if(e[h].column+e[h].value.length>b)return{token:e[h],row:d,column:Math.max(e[h].column,b),offset:h};b=0}return null};this.findNextSignificantToken=function(a){return this.$findNextSignificantToken(a,
this.$tokens.length-1)};this.$findPreviousSignificantToken=function(a,c){if(0===this.$tokens.length)return null;for(var c=Math.max(0,c),d=Math.min(a.row,this.$tokens.length-1);d>=c;d--){var b=this.$tokens[d];if(0!==b.length){if(d!=a.row)return{row:d,column:b[b.length-1].column,token:b[b.length-1],offset:b.length-1};for(var e=b.length-1;0<=e;e--)if(b[e].column<a.column)return{row:d,column:b[e].column,token:b[e],offset:e}}}};this.$filterWhitespaceAndComments=function(a){for(var a=a.filter(function(a){a=
/\bcode(?:begin|end)\b/.test(a.type)||/\bsectionhead\b/.test(a.type)?!1:/^\s*$/.test(a.value)||a.type.match(/\b(?:ace_virtual-)?comment\b/);return!a}),c=a.length-1;0<=c;c--)if(1<a[c].value.length&&/\bparen\b/.test(a[c].type)){var d=a[c];a.splice(c,1);for(var b=d.value.length-1;0<=b;b--){var e={type:d.type,value:d.value.charAt(b),column:d.column+b};a.splice(c,0,e)}}return a}}).call(h.prototype);k.RCodeModel=h;k.setVerticallyAlignFunctionArgs=function(a){c=a};k.getVerticallyAlignFunctionArgs=function(){return c}});var $colorFunctionCalls=!1;
define("mode/r_highlight_rules",["require","exports","module"],function(b,k){function i(a){for(var c=Array(a.length),b=0;b<a.length;b++)c[b]={include:a[b]};return c}var m=b("ace/lib/oop"),g=b("ace/lib/lang"),f=b("ace/mode/text_highlight_rules").TextHighlightRules,j=b("mode/utils"),c=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()};m.inherits(c,f);var a=function(){var a=g.arrayToMap("function,if,else,in,break,next,repeat,for,while".split(",")),b=g.arrayToMap("return,switch,try,tryCatch,stop,warning,require,library,attach,detach,source,setMethod,setGeneric,setGroupGeneric,setClass,setRefClass,R6Class,UseMethod,NextMethod".split(",")),
e=g.arrayToMap("NULL,NA,TRUE,FALSE,T,F,Inf,NaN,NA_integer_,NA_real_,NA_character_,NA_complex_".split(",")),l={"#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:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]',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 e.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(c){return e.hasOwnProperty(c)?"constant.language":a.hasOwnProperty(c)?"keyword":c.match(/^\.\.\d+$/)?"variable.language":"identifier"},regex:"[a-zA-Z.][a-zA-Z0-9._]*",next:"start"}],"#package-access":[{token:function(){return $colorFunctionCalls?"identifier.support.class":
"identifier"},regex:"[a-zA-Z.][a-zA-Z0-9._]*(?=\\s*::)",next:"start"}],"#function-call":[{token:function(){return $colorFunctionCalls?"identifier.support.function":"identifier"},regex:"[a-zA-Z.][a-zA-Z0-9._]*(?=\\s*\\()",next:"start"}],"#function-call-or-keyword":[{token:function(c){return b.hasOwnProperty(c)||a.hasOwnProperty(c)?"keyword":$colorFunctionCalls?"identifier.support.function":"identifier"},regex:"[a-zA-Z.][a-zA-Z0-9._]*(?=\\s*\\()",next:"start"}],"#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"},{token:"paren.keyword.operator",merge:!1,regex:"[[({]",next:"start"},{token:"paren.keyword.operator",merge:!1,regex:"[\\])}]",next:"start"},{token:function(){return $colorFunctionCalls?"punctuation.keyword.operator":"punctuation"},
regex:"[;]",merge:!1,next:"start"},{token:function(){return $colorFunctionCalls?"punctuation.keyword.operator":"punctuation"},regex:"[,]",merge:!1,next:"start"}],"#text":[{token:"text",regex:"\\s+"}]};l.start=i("#comment,#string,#number,#package-access,#quoted-identifier,#function-call-or-keyword,#keyword-or-identifier,#operator,#text".split(","));l.afterDollar=i("#comment,#string,#number,#quoted-identifier,#function-call,#keyword-or-identifier,#operator,#text".split(","));l.qqstring=[{token:"string",
regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"',next:"start"},{token:"string",regex:".+",merge:!0}];l.qstring=[{token:"string",regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'",next:"start"},{token:"string",regex:".+",merge:!0}];this.$rules=l;var f=(new c).getRules(),m;for(m in f)for(var l=f[m],k=0;k<l.length;k++)if(j.isArray(l[k].token))for(var u=0;u<l[k].token.length;u++)l[k].token[u]+=".virtual-comment";else l[k].token+=".virtual-comment";this.embedRules(f,"rd-",[{token:"text",regex:"^",next:"start"}]);this.normalizeRules()};
m.inherits(a,f);k.RHighlightRules=a;k.setHighlightRFunctionCalls=function(a){$colorFunctionCalls=a}});define("mode/r_matching_brace_outdent",["require","exports","module"],function(b,k){var i=b("ace/range").Range,m=function(b){this.codeModel=b};(function(){this.checkOutdent=function(b,f,j){return/^\s+$/.test(f)&&/^\s*[\{\}\)]/.test(j)||/^\s*}\s*$/.test(f)&&"\n"==j||/}\s*$/.test(f)&&/\n/.test(j)?!0:!1};this.autoOutdent=function(b,f,j){if(0===j)return 0;var b=f.getLine(j),c=b.match(/^(\s*[\}\)])/);if(c){var c=c[1].length,a=f.findMatchingBracket({row:j,column:c});if(!a||a.row==j)return 0;a=this.codeModel.getIndentForOpenBrace(a);
f.replace(new i(j,0,j,c-1),a)}if(c=b.match(/^(\s*\{)/))c=c[1].length,a=this.codeModel.getBraceIndent(j-1),f.replace(new i(j,0,j,c-1),a)}}).call(m.prototype);k.RMatchingBraceOutdent=m});define("mode/r_scope_tree",["require","exports","module"],function(b,k){function i(c){g&&console.log(c)}function m(c,a){return c.row!=a.row?c.row-a.row:c.column-a.column}var g=!1,f=function(c){this.$ScopeNodeFactory=c;this.parsePos={row:0,column:0};this.$root=new this.$ScopeNodeFactory("(Top Level)",this.parsePos,null,j.TYPE_ROOT)};(function(){function c(a){count=a.isChunk()?1:0;for(var a=a.$children||[],b=0;b<a.length;b++)count+=c(a[b]);return count}this.onSectionHead=function(a,c,b){"undefined"==
typeof b&&(b={});var l=this.getActiveScopes(c);if(1<l.length)for(var l=l[l.length-2].$children,f=l.length-1;0<=f;f--)if(l[f].isSection()){this.$root.closeScope(c,j.TYPE_SECTION);break}this.$root.addNode(new this.$ScopeNodeFactory(a,c,c,j.TYPE_SECTION,b))};this.onSectionEnd=function(a){this.$root.closeScope(a,j.TYPE_SECTION)};this.closeMarkdownHeaderScopes=function(a,c,b){for(var l=a.$children,f=l.length-1;0<=f;f--){var g=l[f];if(g.isSection()&&g.attributes.depth>=b)return i("Closing Markdown scope: '"+
g.label+"'"),this.$root.closeScope(c,j.TYPE_SECTION),g.attributes.depth===b||a.isRoot()||null==a?void 0:this.closeMarkdownHeaderScopes(a.parentScope,c,b)}a.isRoot()||null==a||this.closeMarkdownHeaderScopes(a.parentScope,c,b)};this.onMarkdownHead=function(a,c,b,l){i("Adding Markdown header: '"+a+"' ["+l+"]");var f=this.getActiveScopes(c);1<f.length&&this.closeMarkdownHeaderScopes(f[f.length-2],c,l);this.$root.addNode(new this.$ScopeNodeFactory(a,b,c,j.TYPE_SECTION,{depth:l,isMarkdown:!0}))};this.onChunkStart=
function(a,c,b,l){var f=this.$root.closeScope(b,j.TYPE_CHUNK);f&&i("chunk-scope implicit end: "+f.label);i("adding chunk-scope "+c);c=new this.$ScopeNodeFactory(c,l,b,j.TYPE_CHUNK);c.chunkLabel=a;this.$root.addNode(c);this.printScopeTree()};this.onChunkEnd=function(a){(a=this.$root.closeScope(a,j.TYPE_CHUNK))?i("chunk-scope end: "+a.label):i("extra chunk-scope end");this.printScopeTree();return a};this.onFunctionScopeStart=function(a,c,b,l,f){i("adding function brace-scope "+a);this.$root.addNode(new this.$ScopeNodeFactory(a,
b,c,j.TYPE_BRACE,{name:l,args:f}));this.printScopeTree()};this.onNamedScopeStart=function(a,c){this.$root.addNode(new this.$ScopeNodeFactory(a,c,null,j.TYPE_BRACE))};this.onScopeStart=function(a){i("adding anon brace-scope");this.$root.addNode(new this.$ScopeNodeFactory(null,a,null,j.TYPE_BRACE));this.printScopeTree()};this.onScopeEnd=function(a){(a=this.$root.closeScope(a,j.TYPE_BRACE))?i("brace-scope end: "+a.label):i("extra brace-scope end");this.printScopeTree();return a};this.getActiveScopes=
function(a){return this.$root.findNode(a)};this.getScopeList=function(){return this.$root.$children};this.findFunctionDefinitionFromUsage=function(a,c){return this.$root.findFunctionDefinitionFromUsage(a,c)};this.getFunctionsInScope=function(a,c){return this.$root.getFunctionsInScope(a,c)};this.invalidateFrom=function(a){a={row:Math.max(0,a.row-1),column:0};i("Invalidate from "+a.row+", "+a.column);0<m(this.parsePos,a)&&(this.parsePos=this.$root.invalidateFrom(a));this.printScopeTree()};this.getChunkCount=
function(){return c(this.$root)};this.getTopLevelScopeCount=function(){return this.$root.$children.length};this.printScopeTree=function(){g&&this.$root.printDebug()};this.getAllFunctionScopes=function(){var c=[];a(this.$root,c);return c};var a=function(c,b){c.isFunction()&&b.push(c);for(var e=c.$children,l=0;l<e.length;l++)a(e[l],b)}}).call(f.prototype);var j=function(c,a,b,h,e){this.label=c;if((this.start=a)&&b&&(b.row>a.row||b.row===a.row&&b.column>a.column))throw Error("Malformed preamble: should lie before start position");
this.preamble=b||a;this.end=null;this.scopeType=h;this.parentScope=null;this.attributes=e||{};this.$children=[]};j.TYPE_ROOT=1;j.TYPE_BRACE=2;j.TYPE_CHUNK=3;j.TYPE_SECTION=4;(function(){this.isRoot=function(){return this.scopeType==j.TYPE_ROOT};this.isBrace=function(){return this.scopeType==j.TYPE_BRACE};this.isChunk=function(){return this.scopeType==j.TYPE_CHUNK};this.isSection=function(){return this.scopeType==j.TYPE_SECTION};this.isFunction=function(){return this.isBrace()&&!!this.label};this.equals=
function(c){return this.scopeType!==c.scopeType||this.start.row!==c.start.row||this.start.column!==c.start.column?!1:!0};this.addNode=function(c){!c.end||window.alert("[ASSERTION FAILED] New node is already closed");0==c.$children.length||window.alert("[ASSERTION FAILED] New node already had children");if(!this.equals(c)){this.end=null;var a=this.$binarySearch(c.preamble);0<=a?this.$children[a].addNode(c):(a=-(a+1),a<this.$children.length&&(c.$children=this.$children.splice(a,this.$children.length-
a)),c.parentScope=this,this.$children.push(c))}};this.closeScope=function(c,a){if(0==this.$children.length)return null;var b=this.$children[this.$children.length-1];if(b.end)return null;var h=b.closeScope(c,a);if(h)return h;return a==b.scopeType?(b.end=c,b.$forceDescendantsClosed(c),b):null};this.$forceDescendantsClosed=function(c){if(0!=this.$children.length){var a=this.$children[this.$children.length-1];a.end||(a.$forceDescendantsClosed(c),a.end=c)}};this.findNode=function(c){var a=this.$binarySearch(c);
return 0<=a&&(c=this.$children[a].findNode(c))?(this.label&&c.unshift(this),c):this.label?[this]:null};this.$getFunctionStack=function(c){var a=this.$binarySearch(c),c=0<=a?this.$children[a].$getFunctionStack(c):[];this.isFunction()&&c.push(this);return c};this.findFunctionDefinitionFromUsage=function(c,a){for(var b=this.$getFunctionStack(c),h=0;h<b.length;h++)for(var e=b[h],l=0;l<e.$children.length;l++)if(e.$children[l].label==a)return e.$children[l];return null};this.getFunctionsInScope=function(c){for(var c=
this.$getFunctionStack(c),a=[],b=0;b<c.length;b++)a.push({name:c[b].attributes.name,args:c[b].attributes.args.slice()});return a};this.invalidateFrom=function(c){var a=this.$binarySearch(c);0<=a?0>=m(c,this.$children[a].start)?c=this.$children[a].preamble:(c=this.$children[a].invalidateFrom(c),a++):a=-(a+1);a<this.$children.length&&this.$children.splice(a,this.$children.length-a);this.end=null;return c};this.$binarySearch=function(c,a,b){"undefined"===typeof a&&(a=0);"undefined"===typeof b&&(b=this.$children.length);
if(a===b)return-(a+1);var h=Math.floor((a+b)/2),e=this.$children[h].comparePosition(c);return 0===e?h:0>e?this.$binarySearch(c,a,h):this.$binarySearch(c,h+1,b)};this.comparePosition=function(c){return 0>m(c,this.preamble)?-1:null!=this.end&&0<=m(c,this.end)?1:0};this.printDebug=function(c){"undefined"===typeof c&&(c="");i(c+'"'+this.label+'" ['+this.preamble.row+"x"+this.preamble.column+(this.start?"-"+this.start.row+"x"+this.start.column:"")+", "+(this.end?this.end.row+"x"+this.end.column:"null")+
"]");for(var a=0;a<this.$children.length;a++)this.$children[a].printDebug(c+"    ")}}).call(j.prototype);k.ScopeManager=f;k.ScopeNode=j});define("mode/rdoc",["require","exports","module"],function(b,k){var i=b("ace/lib/oop"),m=b("ace/mode/text").Mode,g=b("ace/tokenizer").Tokenizer,f=b("ace/mode/text_highlight_rules").TextHighlightRules,j=b("mode/rdoc_highlight_rules").RDocHighlightRules,c=b("ace/mode/matching_brace_outdent").MatchingBraceOutdent,a=function(a){a?(this.$highlightRules=new f,this.$tokenizer=new g((new f).getRules())):(this.$highlightRules=new j,this.$tokenizer=new g((new j).getRules()));this.$outdent=new c};i.inherits(a,
m);(function(){this.getNextLineIndent=function(a,c){return this.$getIndent(c)}}).call(a.prototype);k.Mode=a});define("mode/rdoc_highlight_rules",["require","exports","module"],function(b,k){var i=b("ace/lib/oop");b("ace/lib/lang");var m=b("ace/mode/text_highlight_rules").TextHighlightRules,g=function(){var b;b="\\"+"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:b},
"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+"}]}};i.inherits(g,m);k.RDocHighlightRules=g});define("mode/rhtml",["require","exports","module"],function(b,k){var i=b("ace/lib/oop"),m=b("ace/mode/html").Mode,g=b("ace/tokenizer").Tokenizer,f=b("mode/rhtml_highlight_rules").RHtmlHighlightRules,j=b("mode/r_code_model").RCodeModel,c=b("ace/mode/matching_brace_outdent").MatchingBraceOutdent,a=b("mode/r_matching_brace_outdent").RMatchingBraceOutdent,d=b("mode/utils"),h=function(b,d){this.$session=d;this.$tokenizer=new g((new f).getRules());this.codeModel=new j(d,this.$tokenizer,/^r-/,/^<\!--\s*begin.rcode\s*(.*)/,
/^\s*end.rcode\s*--\>/);this.$outdent=new c;this.$r_outdent=new a(this.codeModel);this.foldingRules=this.codeModel};i.inherits(h,m);(function(){this.insertChunkInfo={value:"<\!--begin.rcode\n\nend.rcode--\>\n",position:{row:0,column:15},content_position:{row:1,column:0}};this.checkOutdent=function(a,c,b){return"r"===d.activeMode(a,"html")?this.$r_outdent.checkOutdent(a,c,b):this.$outdent.checkOutdent(c,b)};this.autoOutdent=function(a,c,b){return"r"===d.activeMode(a,"html")?this.$r_outdent.autoOutdent(a,
c,b):this.$outdent.autoOutdent(c,b)};this.getLanguageMode=function(a){return d.getPrimaryState(this.$session,a.row).match(/^r-/)?"R":"HTML"};this.$getNextLineIndent=this.getNextLineIndent;this.getNextLineIndent=function(a,c,b,h){return"r"===d.activeMode(a,"html")?this.codeModel.getNextLineIndent(a,c,b,h):this.$getNextLineIndent(a,c,b)};this.$id="mode/rhtml"}).call(h.prototype);k.Mode=h});define("mode/rhtml_highlight_rules",["require","exports","module"],function(b,k){var i=b("ace/lib/oop"),m=b("mode/r_highlight_rules").RHighlightRules,g=b("ace/mode/html_highlight_rules").HtmlHighlightRules,f=b("ace/mode/text_highlight_rules").TextHighlightRules,j=function(){this.$rules=(new g).getRules();this.$rules.start.unshift({token:"support.function.codebegin",regex:"^<\!--\\s*begin.rcode\\s*(?:.*)",next:"r-start"});this.addRules((new m).getRules(),"r-");this.$rules["r-start"].unshift({token:"support.function.codeend",
regex:"^\\s*end.rcode\\s*--\>",next:"start"})};i.inherits(j,f);k.RHtmlHighlightRules=j});define("mode/rmarkdown",["require","exports","module"],function(b,k){var i=b("ace/lib/oop"),m=b("mode/markdown").Mode,g=b("ace/tokenizer").Tokenizer,f=b("mode/rmarkdown_highlight_rules").RMarkdownHighlightRules,j=b("ace/mode/matching_brace_outdent").MatchingBraceOutdent,c=b("mode/r_matching_brace_outdent").RMatchingBraceOutdent,a=b("mode/c_cpp_matching_brace_outdent").CppMatchingBraceOutdent,d=b("mode/r_code_model").RCodeModel,h=b("mode/cpp_code_model").CppCodeModel,e=b("rstudio/folding/rmarkdown").FoldMode,
l=b("ace/mode/folding/cstyle").FoldMode,n=b("mode/utils"),p=b("ace/unicode"),o=function(b,i){var m=this;this.$session=i;this.$tokenizer=new g((new f).getRules());this.$outdent=new j;this.codeModel=new d(i,this.$tokenizer,/^r-/,RegExp(f.prototype.$reChunkStartString),RegExp(f.prototype.$reChunkEndString));this.$r_outdent=new c(this.codeModel);this.cpp_codeModel=new h(i,this.$tokenizer,/^r-cpp-/,RegExp(f.prototype.$reCppChunkStartString),RegExp(f.prototype.$reChunkEndString));this.$cpp_outdent=new a(this.cpp_codeModel);
var k=new e,p=new l;this.$tokenizer.getLineTokens=function(a,c,b){0===b&&(c="firstLine");return g.prototype.getLineTokens.call(this,a,c,b)};this.foldingRules={getFoldWidget:function(a,c,b){var d=m.getLanguageMode({row:b,column:0}),e=a.getLine(b);return"Markdown"===d||n.startsWith(e,"```")||0===b?k.getFoldWidget(a,c,b):"C_CPP"===d?p.getFoldWidget(a,c,b):m.codeModel.getFoldWidget(a,c,b)},getFoldWidgetRange:function(a,c,b){var d=m.getLanguageMode({row:b,column:0}),e=a.getLine(b);return"Markdown"===d||
n.startsWith(e,"```")||0===b?k.getFoldWidgetRange(a,c,b):"C_CPP"===d?p.getFoldWidgetRange(a,c,b):m.codeModel.getFoldWidgetRange(a,c,b)}}};i.inherits(o,m);(function(){function a(c){return n.activeMode(c,"markdown")}this.insertChunkInfo={value:"```{r}\n\n```\n",position:{row:0,column:5},content_position:{row:1,column:0}};this.getLanguageMode=function(c){c=n.getPrimaryState(this.$session,c.row);c=a(c);return"r"===c?"R":"r-cpp"===c?"C_CPP":"yaml"===c?"YAML":"Markdown"};this.$getNextLineIndent=this.getNextLineIndent;
this.getNextLineIndent=function(c,b,d,e,h){var f=a(c);return"r"===f?this.codeModel.getNextLineIndent(c,b,d,e):"r-cpp"===f?this.cpp_codeModel.getNextLineIndent(c,b,d,e,h):"yaml"===f?this.$getIndent(this.$session.getLine(e+1)):this.$getNextLineIndent(c,b,d)};this.checkOutdent=function(c,b,d){var e=a(c);return"r"===e?this.$r_outdent.checkOutdent(c,b,d):"r-cpp"===e?this.$cpp_outdent.checkOutdent(c,b,d):"yaml"===e?!1:this.$outdent.checkOutdent(b,d)};this.autoOutdent=function(c,b,d){var e=a(c);if("r"===
e)return this.$r_outdent.autoOutdent(c,b,d);if("r-cpp"===e)return this.$cpp_outdent.autoOutdent(c,b,d);if("yaml"!==e)return this.$outdent.autoOutdent(b,d)};this.transformAction=function(c,b,d,e,h){var f=a(c);return"r-cpp"===f?this.transformActionCpp(c,b,d,e,h):"yaml"===f?this.transformActionYaml(c,b,d,e,h):!1};this.transformActionCpp=function(a,c,b,d,e){if("insertion"===c)if("\n"===e){if(a=b.getSelectionRange().start,(d=/^((\s*\/\/+')\s*)/.exec(d.doc.getLine(a.row)))&&b.getSelectionRange().start.column>=
d[2].length)return{text:"\n"+d[1]}}else if("R"===e&&(a=b.getSelectionRange().start,(d=/^(\s*\/\*{3,}\s*)/.exec(d.doc.getLine(a.row)))&&b.getSelectionRange().start.column>=d[1].length))return{text:"R\n\n*/\n",selection:[1,0,1,0]};return!1};this.transformActionYaml=function(a,c,b,d,e){if("insertion"===c&&"\n"===e){a=b.getCursorPosition().row;a=d.getLine(a);d=this.$getIndent(a);return/[:({[]$/.test(a)?(a=this.$session.getTabString(),{text:"\n"+d+a}):{text:"\n"+d}}return!1};this.tokenRe=RegExp("^["+p.packages.L+
p.packages.Mn+p.packages.Mc+p.packages.Nd+p.packages.Pc+"._]+","g");this.nonTokenRe=RegExp("^(?:[^"+p.packages.L+p.packages.Mn+p.packages.Mc+p.packages.Nd+p.packages.Pc+"._]|\\s])+","g");this.$id="mode/rmarkdown"}).call(o.prototype);k.Mode=o});define("rstudio/folding/rmarkdown",["require","exports","module"],function(b,k){var i=b("ace/lib/oop"),m=b("ace/mode/folding/fold_mode").FoldMode,g=b("ace/range").Range,f=k.FoldMode=function(){},j=b("mode/utils");i.inherits(f,m);(function(){this.getFoldWidget=function(a,c,b){var c="markbeginend"===c?"end":"",e=a.getLine(b),f=a.getState(b),a=0<b?a.getState(b-1):"start";if(j.startsWith(e,"===")||j.startsWith(e,"---")||j.startsWith(e,"..."))return j.startsWith(a,"yaml")?c:"start";if("start"===f&&j.startsWith(e,
"#"))return"start";a=e.trim();return j.startsWith(a,"```")?"start"===f?c:"start":""};var c=function(a,c,b,e,f){var c=0===b?1:"start"===c?-1:1,i={row:b,column:0};1===c&&(i.column=a.getLine(b).length);for(var b=b+c,m=0<c?a.getLength():0;!(b===m);){var k=a.getLine(b).trim();if(j.startsWith(k,e))break;if(f&&j.startsWith(k,f))break;b+=c}e={row:b,column:0};-1===c&&(e.column=a.getLine(b).length);return 1===c?g.fromPoints(i,e):g.fromPoints(e,i)};this.$getFoldWidgetRange=function(a,b,h){var e=a.getState(h),
b=a.getLine(h),f=b.trim();if(j.startsWith(b,"```"))return c(a,e,h,"```");var i=0<h?a.getState(h-1):"start",f=0===h&&"---"===f,i=j.startsWith(i,"yaml");if(f||i)return c(a,e,h,"---",f?"...":void 0);if("="===b[0])i=1;else if("-"===b[0])i=2;else{i=/^(#+)(?:.*)$/.exec(b);if(!i)return;i=i[1].length}if(null!==i){a:{for(var f=a.getLength(),m=h+1;m<f;m++)if(a.getState(m)===e){var k=a.getLine(m);if(1===i&&/^[=]{3,}\s*/.test(k)||2===i&&/^[-]{3,}\s*/.test(k)){e=m-2;break a}if((k=/^(#+)(?:.*)$/.exec(k))&&k[1].length<=
i){e=m-1;break a}}e=f}return new g(h,b.length,e,a.getLine(e).length)}};this.getFoldWidgetRange=function(a,c,b){a=this.$getFoldWidgetRange(a,c,b);if(!(null==a||a.start.row===a.end.row))return a}}).call(f.prototype)});define("mode/rmarkdown_highlight_rules",["require","exports","module"],function(b,k){var i=b("ace/lib/oop"),m=b("mode/r_highlight_rules").RHighlightRules,g=b("mode/c_cpp_highlight_rules").c_cppHighlightRules,f=b("ace/mode/perl_highlight_rules").PerlHighlightRules,j=b("ace/mode/python_highlight_rules").PythonHighlightRules,c=b("ace/mode/ruby_highlight_rules").RubyHighlightRules,a=b("mode/markdown_highlight_rules").MarkdownHighlightRules,d=b("ace/mode/text_highlight_rules").TextHighlightRules,h=b("mode/yaml_highlight_rules").YamlHighlightRules,
e=b("ace/mode/sh_highlight_rules").ShHighlightRules,l=b("mode/stan_highlight_rules").StanHighlightRules,n=b("mode/sql_highlight_rules").SqlHighlightRules,p=b("mode/utils"),o=function(){this.$rules=(new a).getRules();this.$rules.firstLine=this.$rules.allowBlock.slice();p.embedRules(this,m,"r",this.$reChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);p.embedRules(this,g,"r-cpp",this.$reCppChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);p.embedRules(this,
f,"perl",this.$rePerlChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);p.embedRules(this,j,"python",this.$rePythonChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);p.embedRules(this,c,"ruby",this.$reRubyChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);p.embedRules(this,a,"markdown",this.$reMarkdownChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);p.embedRules(this,e,"sh",this.$reShChunkStartString,
this.$reChunkEndString,["start","listblock","allowBlock"]);p.embedRules(this,l,"stan",this.$reStanChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);p.embedRules(this,n,"sql",this.$reSqlChunkStartString,this.$reChunkEndString,["start","listblock","allowBlock"]);p.embedRules(this,h,"yaml","^\\s*---\\s*$","^\\s*(?:---|\\.\\.\\.)\\s*$",["firstLine"]);this.$rules["yaml-start"].unshift({token:["string"],regex:RegExp("((?: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"})};i.inherits(o,d);(function(){function a(c){return"^(?:[ ]{4})?`{3,}\\s*\\{[Rr]\\b(?:.*)engine\\s*\\=\\s*['\"]"+c+"['\"](?:.*)\\}\\s*$|^(?:[ ]{4})?`{3,}\\s*\\{"+c+"\\b(?:.*)\\}\\s*$"}this.$reChunkStartString="^(?:[ ]{4})?`{3,}\\s*\\{\\w+\\b(.*)\\}\\s*$";this.$reChunkEndString="^(?:[ ]{4})?`{3,}\\s*$";this.$reCppChunkStartString=a("[Rr]cpp");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")}).call(o.prototype);k.RMarkdownHighlightRules=o});define("mode/sql",["require","exports","module"],function(b,k){var i=b("ace/lib/oop"),m=b("ace/mode/text").Mode,g=b("mode/sql_highlight_rules").SqlHighlightRules;b("ace/range");var f=function(){this.HighlightRules=g};i.inherits(f,m);(function(){this.lineCommentStart="--";this.$id="mode/sql"}).call(f.prototype);k.Mode=f});define("mode/sql_highlight_rules",["require","exports","module"],function(b,k){var i=b("ace/lib/oop");b("ace/lib/lang");var m=b("ace/mode/text_highlight_rules").TextHighlightRules,g=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()};i.inherits(g,m);k.SqlHighlightRules=g});define("mode/stan",["require","exports","module"],function(b,k){var i=b("ace/lib/oop"),m=b("ace/mode/text").Mode,g=b("ace/tokenizer").Tokenizer,f=b("ace/mode/matching_brace_outdent").MatchingBraceOutdent,j=b("mode/stan_highlight_rules").StanHighlightRules,c=b("ace/mode/folding/cstyle").FoldMode,a=function(){this.$highlightRules=new j;this.$tokenizer=new g(this.$highlightRules.getRules());this.$outdent=new f;this.foldingRules=new c};i.inherits(a,m);(function(){this.lineCommentStart=["//","#"];this.blockComment=
{start:"/*",end:"*/"};this.toggleCommentLines=function(a,c,b,f){for(var g=!0,a=/^(\s*)\/\//,i=b;i<=f;i++)if(!a.test(c.getLine(i))){g=!1;break}if(g){g=new Range(0,0,0,0);for(i=b;i<=f;i++)b=c.getLine(i).match(a),g.start.row=i,g.end.row=i,g.end.column=b[0].length,c.replace(g,b[1])}else c.indentRows(b,f,"//")};this.getLanguageMode=function(){return"Stan"};this.getNextLineIndent=function(a,c,b){var f=this.$getIndent(c),g=this.getTokenizer().getLineTokens(c,a).tokens;if(g.length&&"comment"==g[g.length-
1].type)return f;"start"==a&&c.match(/^.*(?:[\{\(\[])\s*$/)&&(f+=b);return f};this.checkOutdent=function(a,c,b){return this.$outdent.checkOutdent(c,b)};this.autoOutdent=function(a,c,b){this.$outdent.autoOutdent(c,b)};this.$id="mode/stan"}).call(a.prototype);k.Mode=a});define("mode/stan_highlight_rules",["require","exports","module"],function(b,k){var i=b("ace/lib/oop");b("ace/lib/lang");var m=b("ace/mode/text_highlight_rules").TextHighlightRules,g=function(){this.$rules={start:[{token:"comment.line.number-sign",regex:"\\/\\/.*$"},{token:"comment.line.double-dash",regex:"#.*$"},{token:"comment.block",regex:"\\/\\*",merge:!0,next:"comment"},{token:"keyword.other.block",regex:"\\b(functions|data|transformed\\s+data|parameters|transformed\\s+parameters|model|generated\\s+quantities)\\b"},
{token:"string.quoted.double",regex:'["][ a-zA-Z0-9~@#$%^&*_\'`\\-+={}[\\]()<>|/!?.,;:]*["]'},{token:"constant.numeric",regex:"(?:(?:\\d+(?:\\.\\d*)?)|(?:\\.\\d+))(?:[eE][+\\-]?\\d*)?\\b"},{token:"keyword.operator",regex:"\\bT(?=\\s*\\[)"},{token:["keyword.other","text","punctuation"],regex:"(lower|upper)(\\s*)(=)"},{token:["keyword.other","text","keyword.operator"],regex:"(target)(\\s*)(\\+=)"},{token:"keyword.control",regex:"\\b(for|in|while|if|then|else|return)\\b"},{token:"keyword.other",regex:"\\b(print|reject)\\b"},
{token:"storage.type",regex:"\\b(int|real|vector|simplex|unit_vector|ordered|positive_ordered|row_vector|matrix|cholesky_factor_cov|cholesky_factor_corr|corr_matrix|cov_matrix|void)\\b"},{token:"invalid.deprecated",regex:"\\b(bernoulli_ccdf_log|bernoulli_cdf_log|bernoulli_log|bernoulli_logit_log|beta_binomial_ccdf_log|beta_binomial_cdf_log|beta_binomial_log|beta_ccdf_log|beta_cdf_log|beta_log|binomial_ccdf_log|binomial_cdf_log|binomial_coefficient_log|binomial_log|binomial_logit_log|categorical_log|categorical_logit_log|cauchy_ccdf_log|cauchy_cdf_log|cauchy_log|chi_square_ccdf_log|chi_square_cdf_log|chi_square_log|dirichlet_log|double_exponential_ccdf_log|double_exponential_cdf_log|double_exponential_log|exp_mod_normal_ccdf_log|exp_mod_normal_cdf_log|exp_mod_normal_log|exponential_ccdf_log|exponential_cdf_log|exponential_log|frechet_ccdf_log|frechet_cdf_log|frechet_log|gamma_ccdf_log|gamma_cdf_log|gamma_log|gaussian_dlm_obs_log|get_lp|gumbel_ccdf_log|gumbel_cdf_log|gumbel_log|hypergeometric_log|increment_log_prob|integrate_ode|inv_chi_square_ccdf_log|inv_chi_square_cdf_log|inv_chi_square_log|inv_gamma_ccdf_log|inv_gamma_cdf_log|inv_gamma_log|inv_wishart_log|lkj_corr_cholesky_log|lkj_corr_log|logistic_ccdf_log|logistic_cdf_log|logistic_log|lognormal_ccdf_log|lognormal_cdf_log|lognormal_log|multi_gp_cholesky_log|multi_gp_log|multi_normal_cholesky_log|multi_normal_log|multi_normal_prec_log|multi_student_t_log|multinomial_log|multiply_log|neg_binomial_2_ccdf_log|neg_binomial_2_cdf_log|neg_binomial_2_log|neg_binomial_2_log_log|neg_binomial_ccdf_log|neg_binomial_cdf_log|neg_binomial_log|normal_ccdf_log|normal_cdf_log|normal_log|ordered_logistic_log|pareto_ccdf_log|pareto_cdf_log|pareto_log|pareto_type_2_ccdf_log|pareto_type_2_cdf_log|pareto_type_2_log|poisson_ccdf_log|poisson_cdf_log|poisson_log|poisson_log_log|rayleigh_ccdf_log|rayleigh_cdf_log|rayleigh_log|scaled_inv_chi_square_ccdf_log|scaled_inv_chi_square_cdf_log|scaled_inv_chi_square_log|skew_normal_ccdf_log|skew_normal_cdf_log|skew_normal_log|student_t_ccdf_log|student_t_cdf_log|student_t_log|uniform_ccdf_log|uniform_cdf_log|uniform_log|von_mises_log|weibull_ccdf_log|weibull_cdf_log|weibull_log|wiener_log|wishart_log)\\b"},
{token:["keyword.operator.sampling","text","support.function"],regex:"(~)(\\s*)(bernoulli|bernoulli_logit|beta|beta_binomial|binomial|binomial_logit|categorical|categorical_logit|cauchy|chi_square|dirichlet|double_exponential|exp_mod_normal|exponential|frechet|gamma|gaussian_dlm_obs|gumbel|hypergeometric|inv_chi_square|inv_gamma|inv_wishart|lkj_corr|lkj_corr_cholesky|logistic|lognormal|multi_gp|multi_gp_cholesky|multi_normal|multi_normal_cholesky|multi_normal_prec|multi_student_t|multinomial|neg_binomial|neg_binomial_2|neg_binomial_2_log|normal|ordered_logistic|pareto|pareto_type_2|poisson|poisson_log|rayleigh|scaled_inv_chi_square|skew_normal|student_t|uniform|von_mises|weibull|wiener|wishart)\\b"},
{token:"support.function",regex:"\\b(Phi|Phi_approx|abs|acos|acosh|append_col|append_row|asin|asinh|atan|atan2|atanh|bernoulli_cdf|bernoulli_lccdf|bernoulli_lcdf|bernoulli_logit_lpmf|bernoulli_lpmf|bernoulli_rng|bessel_first_kind|bessel_second_kind|beta_binomial_cdf|beta_binomial_lccdf|beta_binomial_lcdf|beta_binomial_lpmf|beta_binomial_rng|beta_cdf|beta_lccdf|beta_lcdf|beta_lpdf|beta_rng|binary_log_loss|binomial_cdf|binomial_lccdf|binomial_lcdf|binomial_logit_lpmf|binomial_lpmf|binomial_rng|block|categorical_logit_lpmf|categorical_lpmf|categorical_rng|cauchy_cdf|cauchy_lccdf|cauchy_lcdf|cauchy_lpdf|cauchy_rng|cbrt|ceil|chi_square_cdf|chi_square_lccdf|chi_square_lcdf|chi_square_lpdf|chi_square_rng|cholesky_decompose|col|cols|columns_dot_product|columns_dot_self|cos|cosh|cov_exp_quad|crossprod|csr_extract_u|csr_extract_v|csr_extract_w|csr_matrix_times_vector|csr_to_dense_matrix|cumulative_sum|determinant|diag_matrix|diag_post_multiply|diag_pre_multiply|diagonal|digamma|dims|dirichlet_lpdf|dirichlet_rng|distance|dot_product|dot_self|double_exponential_cdf|double_exponential_lccdf|double_exponential_lcdf|double_exponential_lpdf|double_exponential_rng|e|eigenvalues_sym|eigenvectors_sym|erf|erfc|exp|exp2|exp_mod_normal_cdf|exp_mod_normal_lccdf|exp_mod_normal_lcdf|exp_mod_normal_lpdf|exp_mod_normal_rng|expm1|exponential_cdf|exponential_lccdf|exponential_lcdf|exponential_lpdf|exponential_rng|fabs|falling_factorial|fdim|floor|fma|fmax|fmin|fmod|frechet_cdf|frechet_lccdf|frechet_lcdf|frechet_lpdf|frechet_rng|gamma_cdf|gamma_lccdf|gamma_lcdf|gamma_lpdf|gamma_p|gamma_q|gamma_rng|gaussian_dlm_obs_lpdf|gumbel_cdf|gumbel_lccdf|gumbel_lcdf|gumbel_lpdf|gumbel_rng|head|hypergeometric_lpmf|hypergeometric_rng|hypot|inc_beta|int_step|integrate_ode_bdf|integrate_ode_rk45|inv|inv_chi_square_cdf|inv_chi_square_lccdf|inv_chi_square_lcdf|inv_chi_square_lpdf|inv_chi_square_rng|inv_cloglog|inv_gamma_cdf|inv_gamma_lccdf|inv_gamma_lcdf|inv_gamma_lpdf|inv_gamma_rng|inv_logit|inv_phi|inv_sqrt|inv_square|inv_wishart_lpdf|inv_wishart_rng|inverse|inverse_spd|is_inf|is_nan|lbeta|lchoose|lgamma|lkj_corr_cholesky_lpdf|lkj_corr_cholesky_rng|lkj_corr_lpdf|lkj_corr_rng|lmgamma|lmultiply|log|log10|log1m|log1m_exp|log1m_inv_logit|log1p|log1p_exp|log2|log_determinant|log_diff_exp|log_falling_factorial|log_inv_logit|log_mix|log_rising_factorial|log_softmax|log_sum_exp|logistic_cdf|logistic_lccdf|logistic_lcdf|logistic_lpdf|logistic_rng|logit|lognormal_cdf|lognormal_lccdf|lognormal_lcdf|lognormal_lpdf|lognormal_rng|machine_precision|max|mdivide_left_spd|mdivide_left_tri_low|mdivide_right_spd|mdivide_right_tri_low|mean|min|modified_bessel_first_kind|modified_bessel_second_kind|multi_gp_cholesky_lpdf|multi_gp_lpdf|multi_normal_cholesky_lpdf|multi_normal_cholesky_rng|multi_normal_lpdf|multi_normal_prec_lpdf|multi_normal_rng|multi_student_t_lpdf|multi_student_t_rng|multinomial_lpmf|multinomial_rng|multiply_lower_tri_self_transpose|neg_binomial_2_cdf|neg_binomial_2_lccdf|neg_binomial_2_lcdf|neg_binomial_2_log_lpmf|neg_binomial_2_log_rng|neg_binomial_2_lpmf|neg_binomial_2_rng|neg_binomial_cdf|neg_binomial_lccdf|neg_binomial_lcdf|neg_binomial_lpmf|neg_binomial_rng|negative_infinity|normal_cdf|normal_lccdf|normal_lcdf|normal_lpdf|normal_rng|not_a_number|num_elements|ordered_logistic_lpmf|ordered_logistic_rng|owens_t|pareto_cdf|pareto_lccdf|pareto_lcdf|pareto_lpdf|pareto_rng|pareto_type_2_cdf|pareto_type_2_lccdf|pareto_type_2_lcdf|pareto_type_2_lpdf|pareto_type_2_rng|pi|poisson_cdf|poisson_lccdf|poisson_lcdf|poisson_log_lpmf|poisson_log_rng|poisson_lpmf|poisson_rng|positive_infinity|pow|prod|qr_Q|qr_R|quad_form|quad_form_diag|quad_form_sym|rank|rayleigh_cdf|rayleigh_lccdf|rayleigh_lcdf|rayleigh_lpdf|rayleigh_rng|rep_array|rep_matrix|rep_row_vector|rep_vector|rising_factorial|round|row|rows|rows_dot_product|rows_dot_self|scaled_inv_chi_square_cdf|scaled_inv_chi_square_lccdf|scaled_inv_chi_square_lcdf|scaled_inv_chi_square_lpdf|scaled_inv_chi_square_rng|sd|segment|sin|singular_values|sinh|size|skew_normal_cdf|skew_normal_lccdf|skew_normal_lcdf|skew_normal_lpdf|skew_normal_rng|softmax|sort_asc|sort_desc|sort_indices_asc|sort_indices_desc|sqrt|sqrt2|square|squared_distance|step|student_t_cdf|student_t_lccdf|student_t_lcdf|student_t_lpdf|student_t_rng|sub_col|sub_row|sum|tail|tan|tanh|target|tcrossprod|tgamma|to_array_1d|to_array_2d|to_matrix|to_row_vector|to_vector|trace|trace_gen_quad_form|trace_quad_form|trigamma|trunc|uniform_cdf|uniform_lccdf|uniform_lcdf|uniform_lpdf|uniform_rng|variance|von_mises_lpdf|von_mises_rng|weibull_cdf|weibull_lccdf|weibull_lcdf|weibull_lpdf|weibull_rng|wiener_lpdf|wishart_lpdf|wishart_rng)\\b"},
{token:"invalid.illegal",regex:"\\b(STAN_MAJOR|STAN_MATH_MAJOR|STAN_MATH_MINOR|STAN_MATH_PATCH|STAN_MINOR|STAN_PATCH|alignas|alignof|and|and_eq|asm|auto|bitand|bitor|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|const_cast|constexpr|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|false|float|for|friend|fvar|goto|if|in|inline|int|long|lp__|mutable|namespace|new|noexcept|not|not_eq|nullptr|operator|or|or_eq|private|protected|public|register|reinterpret_cast|repeat|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|then|this|thread_local|throw|true|try|typedef|typeid|typename|union|unsigned|until|using|var|virtual|void|volatile|wchar_t|while|xor|xor_eq)\\b"},
{token:"invalid.illegal",regex:"[a-zA-Z][a-zA-Z0-9_]*(?!__)\\b__\\b"},{token:"invalid.illegal",regex:"\\b(?:_|[_0-9][A-Za-z0-9_]+|[A-Za-z][A-Za-z0-9_]*__)\\b"},{token:"function",regex:"[a-zA-Z][a-zA-Z0-9_]*(?!__)\\b(?=\\s*\\()"},{token:"identifier",regex:"[a-zA-Z][a-zA-Z0-9_]*(?!__)\\b"},{token:"invalid.deprecated",regex:"<-"},{token:"keyword.operator",regex:"~|[|]{2}|&&|==?|!=|<=?|>=?|\\+|-|\\.?\\*|\\.?/|\\\\|\\^|!|'|%|\\?|:"},{token:"punctuation.operator",regex:",|;|[|]"},{token:"paren.lparen.keyword.operator",
regex:"[\\[\\(\\{]"},{token:"paren.rparen.keyword.operator",regex:"[\\]\\)\\}]"},{token:"text",regex:"\\s+"}],comment:[{token:"comment",regex:".*?\\*\\/",next:"start"},{token:"comment",merge:!0,regex:".+"}]}};i.inherits(g,m);k.StanHighlightRules=g});define("mode/sweave",["require","exports","module"],function(b,k){var i=b("ace/lib/oop"),m=b("ace/mode/text").Mode,g=b("ace/tokenizer").Tokenizer,f=b("ace/mode/text_highlight_rules").TextHighlightRules,j=b("mode/sweave_highlight_rules").SweaveHighlightRules,c=b("mode/r_code_model").RCodeModel,a=b("ace/mode/matching_brace_outdent").MatchingBraceOutdent,d=b("mode/r_matching_brace_outdent").RMatchingBraceOutdent,h=b("ace/unicode"),e=b("mode/utils");b("mode/auto_brace_insert");var l=function(b,e){this.$tokenizer=
b?new g((new f).getRules()):new g((new j).getRules());this.$session=e;this.$outdent=new a;this.codeModel=new c(e,this.$tokenizer,/^r-/,/<<(.*?)>>/,/^\s*@\s*$/);this.$r_outdent=new d(this.codeModel);this.foldingRules=this.codeModel};i.inherits(l,m);(function(){this.tokenRe=RegExp("^["+h.packages.L+h.packages.Mn+h.packages.Mc+h.packages.Nd+h.packages.Pc+"._]+","g");this.nonTokenRe=RegExp("^(?:[^"+h.packages.L+h.packages.Mn+h.packages.Mc+h.packages.Nd+h.packages.Pc+"._]|\\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 e.getPrimaryState(this.$session,a.row).match(/^r-/)?"R":"TeX"};this.$getNextLineIndent=this.getNextLineIndent;this.getNextLineIndent=function(a,c,b,d){return"r"===e.activeMode(a,"tex")?this.codeModel.getNextLineIndent(a,c,b,d):this.$getNextLineIndent(a,c,b)};this.checkOutdent=
function(a,c,b){return"r"===e.activeMode(a,"tex")?this.$r_outdent.checkOutdent(a,c,b):this.$outdent.checkOutdent(c,b)};this.autoOutdent=function(a,c,b){return"r"===e.activeMode(a,"tex")?this.$r_outdent.autoOutdent(a,c,b):this.$outdent.autoOutdent(c,b)};this.allowAutoInsert=this.smartAllowAutoInsert;this.$id="mode/sweave"}).call(l.prototype);k.Mode=l});define("mode/sweave_highlight_rules",["require","exports","module"],function(b,k){var i=b("ace/lib/oop"),m=b("mode/tex_highlight_rules").TexHighlightRules,g=b("mode/r_highlight_rules").RHighlightRules,f=b("ace/mode/text_highlight_rules").TextHighlightRules,j=function(){this.$rules=(new m).getRules();this.$rules.start.unshift({token:"comment.codebegin",regex:"^\\s*\\<\\<.*\\>\\>=.*$",next:"r-start"});this.$rules.start.unshift({token:"comment",regex:"^\\s*@(?:\\s.*)?$"});this.addRules((new g).getRules(),
"r-");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"})};i.inherits(j,f);k.SweaveHighlightRules=j});define("mode/tex",["require","exports","module"],function(b,k){var i=b("ace/lib/oop"),m=b("ace/mode/text").Mode,g=b("ace/tokenizer").Tokenizer,f=b("ace/mode/text_highlight_rules").TextHighlightRules,j=b("mode/tex_highlight_rules").TexHighlightRules,c=b("ace/mode/matching_brace_outdent").MatchingBraceOutdent,a=function(a){this.$tokenizer=a?new g((new f).getRules()):new g((new j).getRules());this.$outdent=new c};i.inherits(a,m);(function(){this.getNextLineIndent=function(a,c){return this.$getIndent(c)};
this.allowAutoInsert=function(){return!1}}).call(a.prototype);k.Mode=a});define("mode/tex_highlight_rules",["require","exports","module"],function(b,k){var i=b("ace/lib/oop");b("ace/lib/lang");var m=b("ace/mode/text_highlight_rules").TextHighlightRules,g=function(b){b||(b="text");this.$rules={start:[{token:"comment",regex:"%.*$"},{token:b,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:b,regex:"\\s+"}],nospell:[{token:"comment",regex:"%.*$",next:"start"},{token:"nospell."+b,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."+b,regex:"\\s+"},{token:"nospell."+b,regex:"\\w+"}]}};i.inherits(g,m);k.TexHighlightRules=g});define("mode/token_cursor",["require","exports","module"],function(b,k){var i=b("ace/lib/oop"),m=b("mode/utils"),g=function(c,a,b){this.$tokens=c;this.$row=a||0;this.$offset=b||0};(function(){this.cloneCursor=function(){return new g(this.$tokens,this.$row,this.$offset)};var c=m.isArray,a=m.contains,b={"(":")","{":"}","<":">","[":"]",")":"(","}":"{",">":"<","]":"["},h=["(","[","{"],e=[")","]","}"];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,c=0;0<=a;){var b=this.$tokens[a];if(b&&0!==b.length){c=b.length;break}a--}if(0>a)return!1;this.$row=a;this.$offset=c-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 c=this.$tokens[this.$row];if(c&&this.$offset<c.length-1)return this.$offset++,!0;for(var b=this.$row+1;b<=a&&!((c=this.$tokens[b])&&0!==c.length);)b++;if(b>a)return!1;this.$row=b;this.$offset=0;return!0};this.peekBwd=function(a){"undefined"===typeof a&&(a=1);for(var c=this.cloneCursor(),b=0;b<a;b++)if(!c.moveToPreviousToken())return c.$invalidate();return c};this.peekFwd=function(a){"undefined"===typeof a&&
(a=1);for(var c=this.cloneCursor(),b=0;b<a;b++)if(!c.moveToNextToken())return c.$invalidate();return c};this.$invalidate=function(){this.$column=this.$row=0;this.$tokens=[];return this};this.seekToNearestToken=function(a,c){if(a.row>c)return!1;this.$row=a.row;var b=this.$tokens[this.$row]||[];for(this.$offset=0;this.$offset<b.length;this.$offset++)if(b[this.$offset].column>=a.column)return!0;return a.row<c?this.moveToNextToken(c):!1};this.bwdToNearestToken=function(a){this.$row=a.row;this.$offset=
a.column;for(var c=this.$tokens[this.$row]||[];0<=this.$offset;this.$offset--){var b=c[this.$offset];if("undefined"!==typeof b&&b.column<=a.column)return!0}return this.moveToPreviousToken()};this.bwdToMatchingToken=function(){var c=this.currentValue();if(!a(e,c))return!1;for(var h=b[c],f=0;this.moveToPreviousToken();){var g=this.currentValue();if(g===h){if(0===f)return!0;f--}else g===c&&f++}return!1};this.fwdToMatchingToken=function(){var c=this.currentValue();if(!a(h,c))return!1;for(var e=b[c],f=
0;this.moveToNextToken();){var g=this.currentValue();if(g===e){if(0===f)return!0;f--}else g===c&&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,c=0;this.moveToPreviousToken();){var b=this.currentValue();if("("===b){if(0===c){a=!0;break}c--}else")"===b&&c++}return a};this.findToken=function(a,c){do{var b=
this.currentToken();if(b&&a(b))return b}while(this.moveToNextToken(c));return null};this.findTokenBwd=function(a,c){do{var b=this.currentToken();if(b&&a(b))return b}while(this.moveToPreviousToken(c));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 c=0;c<arguments.length;c++){var b=arguments[c];if(a===b||-1!==a.indexOf(b+".")||-1!==a.indexOf("."+b))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,c){var b=a.row,d=a.column,e=this.$tokens[b];null==e&&this.$codeModel&&this.$codeModel.$tokenizeUpToRow&&(this.$codeModel.$tokenizeUpToRow.call(this.$codeModel,b),e=this.$tokens[b]);if(e&&0<e.length&&e[0].column<=d){for(var h=0;h<e.length&&!(e[h].column>=d);h++);this.$row=b;this.$offset=h===e.length?h-1:c&&e[h].column===d?h:h-1;return!0}d=this.cloneCursor();d.$row=b;d.$offset=0;return d.moveToPreviousToken()?
(this.$row=d.$row,this.$offset=d.$offset,!0):!1};this.findOpeningBracket=function(a,b){c(a)||(a=[a]);var d=this.cloneCursor();do if(!d.bwdToMatchingToken()){var e=d.currentValue();if(b&&"{"===e)break;for(var h=0;h<a.length;h++)if(e===a[h])return this.$row=d.$row,this.$offset=d.$offset,!0}while(d.moveToPreviousToken());return!1};this.findOpeningBracketCountCommas=function(a,b){c(a)||(a=[a]);var d=this.cloneCursor(),e=0;do if(!d.bwdToMatchingToken()){var h=d.currentValue();","===h&&(e+=1);if(b&&"{"===
h)break;for(var f=0;f<a.length;f++)if(h===a[f])return this.$row=d.$row,this.$offset=d.$offset,e}while(d.moveToPreviousToken());return-1}}).call(g.prototype);var f=function(c,a,b,h){this.$tokens=c;this.$row=a||0;this.$offset=b||0;this.$codeModel=h};i.mixin(f.prototype,g.prototype);(function(){this.cloneCursor=function(){return new f(this.$tokens,this.$row,this.$offset,this.$codeModel)};var c=m.contains;this.bwdOverConstNoexceptDecltype=function(){var a=this.cloneCursor();if("{"!==a.currentValue()||
!a.moveToPreviousToken())return!1;var c=a.cloneCursor();")"===c.currentValue()&&c.bwdToMatchingToken()&&c.moveToPreviousToken()&&"decltype"===c.currentValue()&&c.moveToPreviousToken()&&(a.$row=c.$row,a.$offset=c.$offset);c=a.cloneCursor();")"===c.currentValue()&&c.bwdToMatchingToken()&&c.moveToPreviousToken()&&"noexcept"===c.currentValue()&&(a.$row=c.$row,a.$offset=c.$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,c=this.cloneCursor();c.moveToPreviousToken();)if("<"===c.currentValue()){if(0===a)return this.$row=c.$row,this.$offset=c.$offset,!0;a--}else">"===c.currentValue()&&a++;return!1};this.bwdOverClassySpecifiers=function(){var a=this.currentValue();(":"===a||","===a||"{"===a)&&this.moveToPreviousToken();do{this.bwdToMatchingArrow()&&this.moveToPreviousToken();
var a=this.currentType(),c=this.currentValue();if(!("keyword"===a||"::"===c||"identifier"===a||"constant"===a))break;if("class"===c||"struct"===c||"enum"===c||":"===c||","===c)return!0}while(this.moveToPreviousToken());return!1};this.bwdOverClassInheritance=function(){var c=this.cloneCursor();return a(c,this)};var a=function(c,b){c.bwdOverClassySpecifiers();var e=c.currentValue();if(","===e)return a(c,b);return":"===e?(b.$row=c.$row,b.$offset=c.$offset,!0):!1};this.bwdOverInitializationList=function(){return this.doBwdOverInitializationList(this.cloneCursor(),
this)};this.doBwdOverInitializationList=function(a,b){a.moveBackwardOverMatchingParens();if(!a.moveBackwardOverMatchingParens()&&!a.moveToPreviousToken())return!1;for(;"keyword"===a.currentType();)if(!a.moveToPreviousToken())return!1;if(a.moveToPreviousToken()){var e=a.currentValue();if(","===e)return this.doBwdOverInitializationList(a,b);if(":"===e&&(e=a.peekBwd().currentValue(),!c(["public","private","protected"],e)))return b.$row=a.$row,b.$offset=a.$offset,!0}return!1}}).call(f.prototype);var j=
function(c,a,b,h){this.$tokens=c;this.$row=a||0;this.$offset=b||0;this.$codeModel=h};i.mixin(j.prototype,g.prototype);(function(){function c(a){return 0===a.indexOf("'")?a.lastIndexOf("'")===a.length-1:0===a.indexOf('"')?a.lastIndexOf('"')===a.length-1:!1}function a(a){return"("===a||"["===a||"{"===a}function b(a){return")"===a||"]"===a||"}"===a}this.cloneCursor=function(){return new j(this.$tokens,this.$row,this.$offset,this.$codeModel)};var h=m.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 c(this.currentValue())};this.isLeftBracket=function(){return a(this.currentValue())};this.isRightBracket=function(){return b(this.currentValue())};this.isValidForEndOfStatement=function(){if("paren.keyword.operator"===this.currentType())return b(this.currentValue());var a=this.currentValue();return c(a)||this.hasType("identifier","constant","variable")};this.isValidForStartOfStatement=
function(){if("paren.keyword.operator"===this.currentType())return a(this.currentValue());var b=this.currentValue();return c(b)||this.hasType("identifier","constant","variable")};this.isConditionalControlFlowKeyword=function(){var a=this.currentValue();return h(["if","for","while","function"],a)};this.isControlFlowKeyword=function(){var a=this.currentValue();return h("if,for,while,else,function,repeat,break,next".split(","),a)};this.isAtStartOfNewExpression=function(a){var c=this.cloneCursor();return!c.moveToPreviousToken()?
a:this.isValidForStartOfStatement()&&c.isValidForEndOfStatement()&&this.$row>c.$row?c.isControlFlowKeyword()||")"===c.currentValue()&&c.bwdToMatchingToken()&&c.moveToPreviousToken()&&c.isConditionalControlFlowKeyword()?!1:!0:!1}}).call(j.prototype);k.TokenCursor=g;k.CppTokenCursor=f;k.RTokenCursor=j});define("mode/token_utils",["require","exports","module"],function(b,k){var i=function(b,g,f,i,c,a){this.$doc=b;this.$tokenizer=g;this.$tokens=f;this.$endStates=Array(b.getLength());this.$statePattern=i;this.$codeBeginPattern=c;this.$codeEndPattern=a};(function(){this.getTokenForPos=function(b,g,f){this.$tokenizeUpToRow(b.row);if(this.$tokens.length<=b.row)return null;for(var i=this.$tokens[b.row],c=0;c<i.length;c++){var a=i[c];if(g&&b.column==a.column)return a;if(b.column<=a.column)break;if(f&&b.column==
a.column+a.value.length||b.column<a.column+a.value.length)return a}return null};this.$tokenizeUpToRow=function(b){for(var b=Math.min(b,this.$doc.getLength()-1),g=0,f=!0;g<=b;g++)if(!f||!this.$endStates[g]){var f=!1,i=0===g?"start":this.$endStates[g-1],c=this.$tokenizer.getLineTokens(this.$doc.getLine(g),i,g);this.$tokens[g]=!this.$statePattern||this.$statePattern.test(c.state)||this.$statePattern.test(i)?this.$filterWhitespaceAndComments(c.tokens):[];c.state===this.$endStates[g]?f=!0:this.$endStates[g]=
c.state}f||g<this.$tokens.length&&this.$invalidateRow(g);return!0};this.$filterWhitespaceAndComments=function(b){for(var b=b.filter(function(a){a=/\bcode(?:begin|end)\b/.test(a.type)||/\bsectionhead\b/.test(a.type)?!1:/^\s*$/.test(a.value)||a.type.match(/\b(?:ace_virtual-)?comment\b/);return!a}),g=b.length-1;0<=g;g--)if(1<b[g].value.length&&/\bparen\b/.test(b[g].type)){var f=b[g];b.splice(g,1);for(var i=f.value.length-1;0<=i;i--){var c={type:f.type,value:f.value.charAt(i),column:f.column+i};b.splice(g,
0,c)}}return b};this.$invalidateRow=function(b){this.$tokens[b]=null;this.$endStates[b]=null};this.$insertNewRows=function(b,g){for(var f=[b,0],i=0;i<g;i++)f.push(null);this.$tokens.splice.apply(this.$tokens,f);this.$endStates.splice.apply(this.$endStates,f)};this.$removeRows=function(b,g){this.$tokens.splice(b,g);this.$endStates.splice(b,g)};this.$walkParens=function(b,g,f){var i=/\bparen\b/;return b<g?function(){for(;b<=g;b++)for(var c=this.$tokens[b],a=0;a<c.length;a++)if(i.test(c[a].type)&&!f(c[a].value,
{row:b,column:c[a].column}))return!1;return!0}.call(this):function(){b=Math.max(0,b);for(g=Math.max(0,g);b>=g;b--)for(var c=this.$tokens[b],a=c.length-1;0<=a;a--)if(i.test(c[a].type)&&!f(c[a].value,{row:b,column:c[a].column}))return!1;return!0}.call(this)};this.$walkParensBalanced=function(b,g,f,i,c){var a=[],d=null;this.$walkParens(b,g,function(b,e){if(f&&f(a,b,e))return d=e,!1;if(/[\[({]/.test(b))if(a[a.length-1]===c[b])a.pop();else return!0;else a.push(b);return i&&i(a,b,e)?(d=e,!1):!0});return d};
this.$findNextSignificantToken=function(b,g){if(0==this.$tokens.length)return null;for(var g=Math.min(g,this.$tokens.length-1),f=b.row,i=b.column;f<=g;f++){for(var c=this.$tokens[f],a=0;a<c.length;a++)if(c[a].column+c[a].value.length>i)return{token:c[a],row:f,column:Math.max(c[a].column,i),offset:a};i=0}return null};this.findNextSignificantToken=function(b){return this.$findNextSignificantToken(b,this.$tokens.length-1)};this.$findPreviousSignificantToken=function(b,g){if(0==this.$tokens.length)return null;
for(var g=Math.max(0,g),f=Math.min(b.row,this.$tokens.length-1);f>=g;f--){var i=this.$tokens[f];if(0!=i.length){if(f!=b.row)return{row:f,column:i[i.length-1].column,token:i[i.length-1],offset:i.length-1};for(var c=i.length-1;0<=c;c--)if(i[c].column<b.column)return{row:f,column:i[c].column,token:i[c],offset:c}}}return null}}).call(i.prototype);k.TokenUtils=i});define("mode/utils",["require","exports","module"],function(b,k){b("ace/range");var i=b("ace/token_iterator").TokenIterator,m=b("ace/unicode").packages;(function(){var b=this,f=RegExp("^["+m.L+m.Mn+m.Mc+m.Nd+m.Pc+"._]+","");this.construct=function(c,a){function b(){return c.apply(this,a)}b.prototype=c.prototype;return new b};this.contains=function(c,a){for(var b=0;b<c.length;b++)if(c[b]===a)return!0;return!1};this.isArray=function(c){return"[object Array]"===Object.prototype.toString.call(c)};this.asArray=
function(c){return b.isArray(c)?c:[c]};this.getPrimaryState=function(c,a){return b.primaryState(c.getState(a))};this.primaryState=function(c){return b.isArray(c)?c[0]:c};this.activeMode=function(c,a){var d=b.primaryState(c),h=d.lastIndexOf("-");return-1===h?a:d.substring(0,h).toLowerCase()};this.endsWith=function(c,a){return-1!==c.indexOf(a,c.length-a.length)};this.escapeRegExp=function(c){return c.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")};this.embedRules=function(c,a,d,h,e,f,i){"undefined"===
typeof f&&(f=["start"]);"undefined"===typeof i&&(i="start");for(var f=b.asArray(f),i=c.$rules,j=function(a,c,b){b.splice(0);return this.token},k=0;k<f.length;k++)i[f[k]].unshift({token:"support.function.codebegin",regex:h,onMatch:j,next:d+"-start"});c.embedRules(a,d+"-",[{token:"support.function.codeend",regex:e,onMatch:j,next:"start"}])};this.isSingleLineString=function(c){if(2>c.length)return!1;var a=c[0];return"'"!==a&&'"'!==a||c[c.length-1]!==a?!1:"\\"===c[c.length-2]&&"\\"!==c[c.length-3]?!1:
!0};this.createTokenIterator=function(c){var a=c.getSelectionRange().start,c=c.getSession();return new i(c,a.row,a.column)};this.isWordCharacter=function(c){return f.test(c)};var j={"'":"'",'"':'"',"`":"`","{":"}","(":")","[":"]","<":">","}":"{",")":"(","]":"[",">":"<"};this.isBracket=function(c,a){return a&&("<"===c||">"===c)?!0:"{"===c||"}"===c||"("===c||")"===c||"["===c||"]"===c};this.isOpeningBracket=function(c,a){return"{"===c||"("===c||"["===c||!!a&&"<"===c};this.isClosingBracket=function(c,
a){return"}"===c||")"===c||"]"===c||!!a&&">"===c};this.getComplement=function(c,a){"undefined"===typeof a&&(a=j);var b=a[c];return"undefined"===typeof b?c:b};this.stripEnclosingQuotes=function(c){var a=c.length;if(2>a)return c;var b=c[0];return!("'"===b||'"'===b||"`"===b)?c:c[a-1]!==b?c:c.substr(1,a-2)};this.startsWith=function(c,a){if("string"!==typeof c||"string"!==typeof a||c.length<a.length)return!1;for(var b=0;b<a.length;b++)if(c[b]!==a[b])return!1;return!0}}).call(k)});define("mode/xml",["require","exports","module"],function(b,k){var i=b("ace/lib/oop"),m=b("ace/mode/text").Mode,g=b("ace/tokenizer").Tokenizer,f=b("mode/xml_highlight_rules").XmlHighlightRules,j=b("mode/xml_behavior").XmlBehaviour,c=b("mode/xml_fold_mode").FoldMode,a=function(){this.$tokenizer=new g((new f).getRules());this.$behaviour=new j;this.foldingRules=new c};i.inherits(a,m);(function(){this.getNextLineIndent=function(a,c){return this.$getIndent(c)}}).call(a.prototype);k.Mode=a});define("mode/xml_behavior",["require","exports","module"],function(b,k){function i(a,c){var b=!0,e=a.type.split(".");c.split(".").forEach(function(a){if(-1==e.indexOf(a))return b=!1});return b}var m=b("ace/lib/oop"),g=b("ace/mode/behaviour").Behaviour,f=b("ace/mode/behaviour/cstyle").CstyleBehaviour,j=b("ace/token_iterator").TokenIterator,c=function(){this.inherit(f,["string_dquotes"]);this.add("autoclosing","insertion",function(a,c,b,e,f){if(">"==f){a=b.getCursorPosition();b=new j(e,a.row,a.column);
e=b.getCurrentToken();c=!1;if(!e||!i(e,"meta.tag")&&(!i(e,"text")||!e.value.match("/"))){do e=b.stepBackward();while(e&&(i(e,"string")||i(e,"keyword.operator")||i(e,"entity.attribute-name")||i(e,"text")))}else c=!0;if(e&&i(e,"meta.tag-name")&&!b.stepBackward().value.match("/"))return b=e.value,c&&(b=b.substring(0,a.column-e.start)),{text:"></"+b+">",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]}})};m.inherits(c,g);k.XmlBehaviour=c});define("mode/xml_fold_mode",["require","exports","module"],function(b,k){var i=b("ace/lib/oop"),m=b("ace/lib/lang"),g=b("ace/range").Range,f=b("ace/mode/folding/fold_mode").FoldMode,j=b("ace/token_iterator").TokenIterator,c=k.FoldMode=function(a){f.call(this);this.voidElements=a||{}};i.inherits(c,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),e="",f=0;f<c.length;f++)var g=c[f],e=0===g.type.indexOf("meta.tag")?e+g.value:e+m.stringRepeat(" ",g.value.length);return this._parseTag(e)};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="",e;do if(0===b.type.indexOf("meta.tag")&&(e||(e={row:a.getCurrentTokenRow(),column:a.getCurrentTokenColumn()}),c+=b.value,-1!==c.indexOf(">")))return c=this._parseTag(c),c.start=e,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=
"",e;do if(0===b.type.indexOf("meta.tag")&&(e||(e={row:a.getCurrentTokenRow(),column:a.getCurrentTokenColumn()+b.value.length}),c=b.value+c,-1!==c.indexOf("<")))return b=this._parseTag(c),b.end=e,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)return a.pop();if(this.voidElements[b.tagName])break;else if(this.voidElements[c.tagName])a.pop();
else return null}};this.getFoldWidgetRange=function(a,b,c){var e=this._getFirstTagInLine(a,c);if(!e.match)return null;b=[];if(e.closing||e.selfClosing){a=new j(a,c,e.column+e.match.length);for(e={row:c,column:e.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,g.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,g.fromPoints(c.start,e)}}else{a=
new j(a,c,e.column);for(e={row:c,column:e.column+e.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,g.fromPoints(c.start,c.end);if(c.closing){if(this._pop(b,c),0==b.length)return g.fromPoints(e,c.start)}else b.push(c)}}}}).call(c.prototype)});define("mode/xml_highlight_rules",["require","exports","module"],function(b,k){var i=b("ace/lib/oop"),m=b("mode/xml_util"),g=b("ace/mode/text_highlight_rules").TextHighlightRules,f=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:".*?--\>",next:"start"},{token:"comment",merge:!0,regex:".+"}]};m.tag(this.$rules,"tag","start")};i.inherits(f,g);k.XmlHighlightRules=f});define("mode/xml_util",["require","exports","module"],function(b,k){function i(b,g){return[{token:"string",merge:!0,regex:".*?"+b,next:g},{token:"string",merge:!0,regex:".+"}]}k.tag=function(b,g,f,j){b[g]=[{token:"text",regex:"\\s+"},{token:function(c){return j&&j[c]?"meta.tag.tag-name."+j[c]:"meta.tag.tag-name"},merge:!0,regex:"[-_a-zA-Z0-9:]+",next:g+"_embed_attribute_list"},{token:"empty",regex:"",next:g+"_embed_attribute_list"}];b[g+"_qstring"]=i("'",g+"_embed_attribute_list");b[g+"_qqstring"]=
i('"',g+"_embed_attribute_list");b[g+"_embed_attribute_list"]=[{token:"meta.tag",merge:!0,regex:"/?>",next:f},{token:"keyword.operator",regex:"="},{token:"entity.other.attribute-name",regex:"[-_a-zA-Z0-9:]+"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"text",regex:"\\s+"}].concat([{token:"string",regex:'".*?"'},{token:"string",merge:!0,regex:'["].*',next:g+"_qqstring"},{token:"string",regex:"'.*?'"},{token:"string",merge:!0,regex:"['].*",next:g+"_qstring"}])}});define("mode/yaml",["require","exports","module"],function(b,k){var i=b("ace/lib/oop"),m=b("ace/mode/text").Mode,g=b("mode/yaml_highlight_rules").YamlHighlightRules,f=b("ace/mode/matching_brace_outdent").MatchingBraceOutdent,j=b("ace/mode/folding/coffee").FoldMode,c=function(){this.HighlightRules=g;this.$outdent=new f;this.foldingRules=new j;this.$behaviour=this.$defaultBehaviour};i.inherits(c,m);(function(){this.lineCommentStart="#";this.getNextLineIndent=function(a,c,b){var e=this.$getIndent(c);
"start"==a&&c.match(/^.*[\{\(\[]\s*$/)&&(e+=b);return e};this.checkOutdent=function(a,c,b){return this.$outdent.checkOutdent(c,b)};this.autoOutdent=function(a,c,b){this.$outdent.autoOutdent(c,b)};this.$id="mode/yaml"}).call(c.prototype);k.Mode=c});define("mode/yaml_highlight_rules",["require","exports","module"],function(b,k){var i=b("ace/lib/oop"),m=b("ace/mode/text_highlight_rules").TextHighlightRules,g=function(){this.$rules={start:[{token:"comment",regex:"#.*$"},{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(b,g,c,a){b=/^\s*/.exec(a)[0];c.length=2;c[0]=g;c[1]=b.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(b,g,c){c[1]>=b.length?(this.next=c[0],c.splice(0)):this.next=g;return this.token},next:"mlString"},
{token:"string",regex:".+"}]};this.normalizeRules()};i.inherits(g,m);k.YamlHighlightRules=g});define("theme/default",["require","exports","module"],function(b,k){b("ace/lib/dom");k.cssClass="ace-rs"});if(!String.prototype.trimRight){var trimEndRegexp=/\s\s*$/;String.prototype.trimRight=function(){return(""+this).replace(trimEndRegexp,"")}}
define("rstudio/loader",["require","exports","module"],function(b,k){var i=b("ace/lib/oop");b("ace/lib/event");b("ace/lib/event_emitter");var m=b("ace/editor").Editor,g=b("ace/edit_session").EditSession,f=b("ace/undomanager").UndoManager,j=b("ace/range").Range,c=b("mode/utils");b("util/expand_selection");b("mixins/token_iterator");var a=function(a,b){m.call(this,a,b);this.setBehavioursEnabled(!0)};i.inherits(a,m);(function(){this.$highlightBrackets=function(){this.session.$bracketHighlight&&(this.session.removeMarker(this.session.$bracketHighlight),
this.session.$bracketHighlight=null);this.session.selection.isEmpty()&&m.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=["'",'"',"(","{","["]);var f=this.session.$mode;if(/\/markdown$/.test(f.$id))d.push("*","_");else{var g=this.getCursorPosition();f.getLanguageMode&&"Markdown"===f.getLanguageMode(g)&&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 m.prototype.insert.call(this,a,b)};this.remove=function(a){return this.session.getMode().wrapRemove?this.session.getMode().wrapRemove(this,m.prototype.remove,a):m.prototype.remove.call(this,a)};this.undo=function(){m.prototype.undo.call(this);this._dispatchEvent("undo")};this.redo=function(){m.prototype.redo.call(this);this._dispatchEvent("redo")};this.onPaste=function(a,b){m.prototype.onPaste.call(this,
a.replace(/\r\n|\n\r|\r/g,"\n"),b)}}).call(a.prototype);var d=function(a,b){g.call(this,a,b)};i.inherits(d,g);(function(){this.insert=function(a,b){return this.getMode().wrapInsert?this.getMode().wrapInsert(this,g.prototype.insert,a,b):g.prototype.insert.call(this,a,b)};this.reindent=function(a){var b=this.getMode();if(b.getNextLineIndent){var d=a.start.row,a=a.end.row;0===d&&(this.applyIndent(0,""),d++);for(var f=d;f<=a;f++){var g=c.getPrimaryState(this,f-1);if(!c.endsWith(g,"qstring")){var h=b.getNextLineIndent(g,
this.getLine(f-1),this.getTabString(),f-1,!0);this.applyIndent(f,h);b.autoOutdent(g,this,f)}}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 j(a,0,a,c),b)};this.setDisableOverwrite=function(a){a?(this.setOverwrite(!1),this.setOverwrite=function(){},this.getOverwrite=function(){return!1}):(this.setOverwrite=g.prototype.setOverwrite,
this.getOverwrite=g.prototype.getOverwrite)}}).call(d.prototype);var h=function(){f.call(this)};i.inherits(h,f);(function(){this.peek=function(){return this.$undoStack.length?this.$undoStack[this.$undoStack.length-1]:null}}).call(h.prototype);k.RStudioEditor=a;k.loadEditor=function(c){function f(a){g.editor.commands.removeCommand(a)}var g={};c.env=g;var i=b("ace/virtual_renderer").VirtualRenderer,j=b("ace/mode/text").Mode;g.editor=new a(new i(c,{}),new d(""));c=g.editor.getSession();c.setMode(new j);
c.setUndoManager(new h);j=b("ace/config");j.set("workerPath","js/workers");j.setDefaultValue("session","useWorker",!1);f("findnext");f("findprevious");f("find");f("replace");f("togglecomment");f("gotoline");f("foldall");f("unfoldall");f("touppercase");f("tolowercase");return g.editor}});define("rstudio/snippets",["require","exports","module"],function(b,k){k.toSnippetText=function(b){for(var k=b.length,g="",f=0;f<k;f++)var j=b[f],g=g+("snippet "+j.name+"\n\t"+j.content.replace(/\n/g,"\n\t")+"\n\n");return g};k.normalizeSnippets=function(b){for(var k=b.length,g=0;g<k;g++){var f=b[g];null==f.tabTrigger&&(f.tabTrigger=f.name);f.content=f.content.replace("\n    ","\n\t")}}});define("rstudio/snippets/c_cpp",["require","exports","module"],function(b,k){var i=b("rstudio/snippets"),m=b("ace/snippets").snippetManager,g=[{name:"once",content:"#ifndef ${1:`HeaderGuardFileName`}\n#define ${1:`HeaderGuardFileName`}\n\n${0}\n\n#endif /* ${1:`HeaderGuardFileName`} */"},{name:"ans",content:"namespace {\n${0}\n} // anonymous namespace"},{name:"ns",content:"namespace ${1:ns} {\n${0}\n} // namespace ${1:ns}"},{name:"cls",content:"class ${1:ClassName} {\npublic:\n    ${2}\nprivate:\n    ${3}\n};"},
{name:"str",content:"struct ${1} {\n    ${0}\n};"},{name:"ept",content:"// [[Rcpp::export]]\n"}];i.normalizeSnippets(g);k.snippetText=i.toSnippetText(g);m.register(g,"c_cpp")});define("rstudio/snippets/markdown",["require","exports","module"],function(b,k){var i=b("rstudio/snippets"),m=b("ace/snippets").snippetManager,g=[{name:"[",content:"[${1:label}](${2:location})"},{name:"![",content:"![${1:label}](${2:location})"},{name:"r",content:"```{r ${1:label}, ${2:options}}\n${0}\n```"},{name:"rcpp",content:"```{r, engine='Rcpp'}\n#include <Rcpp.h>\nusing namespace Rcpp;\n\n${0}\n\n```"}];i.normalizeSnippets(g);k.snippetText=i.toSnippetText(g);m.register(g,"markdown")});define("rstudio/snippets/r",["require","exports","module"],function(b,k){var i=b("rstudio/snippets"),m=b("ace/snippets").snippetManager,g=[{name:"lib",content:"library(${1:package})"},{name:"req",content:"require(${1:package})"},{name:"src",content:'source("${1:file.R}")'},{name:"ret",content:"return(${1:code})"},{name:"mat",content:"matrix(${1:data}, nrow = ${2:rows}, ncol = ${3:cols})"},{name:"sg",content:'setGeneric("${1:generic}", function(${2:x, ...}) {\n    standardGeneric("${1:generic}")\n})'},
{name:"sm",content:'setMethod("${1:generic}", ${2:class}, function(${2:x, ...}) {\n    ${0}\n})'},{name:"sc",content:'setClass("${1:Class}", slots = c(${2:name = "type"}))'},{name:"if",content:"if (${1:condition}) {\n    ${0}\n}"},{name:"el",content:"else {\n    ${0}\n}"},{name:"ei",content:"else if (${1:condition}) {\n    ${0}\n}"},{name:"fun",content:"${1:name} <- function(${2:variables}) {\n    ${0}\n}"},{name:"for",content:"for (${1:variable} in ${2:vector}) {\n    ${0}\n}"},{name:"while",content:"while (${1:condition}) {\n    ${0}\n}"},
{name:"switch",content:"switch (${1:object},\n    ${2:case} = ${3:action}\n)"},{name:"apply",content:"apply(${1:array}, ${2:margin}, ${3:...})"},{name:"lapply",content:"lapply(${1:list}, ${2:function})"},{name:"sapply",content:"sapply(${1:list}, ${2:function})"},{name:"mapply",content:"mapply(${1:function}, ${2:...})"},{name:"tapply",content:"tapply(${1:vector}, ${2:index}, ${3:function})"},{name:"vapply",content:"vapply(${1:list}, ${2:function}, FUN.VALUE = ${3:type}, ${4:...})"},{name:"rapply",
content:"rapply(${1:list}, ${2:function})"},{name:"ts",content:'`r paste("#", date(), "------------------------------\\n")`'},{name:"shinyapp",content:"library(shiny)\n\nui <- fluidPage(\n  ${0}\n)\n\nserver <- function(input, output, session) {\n  \n}\n\nshinyApp(ui, server)"}];i.normalizeSnippets(g);k.snippetText=i.toSnippetText(g);m.register(g,"r")});define("rstudio/snippets/stan",["require","exports","module"],function(b,k){var i=b("rstudio/snippets"),m=b("ace/snippets").snippetManager,g=[{name:"for",content:"for (${1:var} in ${2:start}:${3:end}) {\n  ${0}\n}"},{name:"if",content:"if (${1:condition}) {\n  ${0}\n}"},{name:"el",content:"else (${1:condition}) {\n  ${0}\n}"},{name:"ei",content:"else if (${1:condition}) {\n  ${0}\n}"},{name:"<l",content:"<lower = ${1:expression}>${0}"},{name:"<u",content:"<upper = ${1:expression}>${0}"},{name:"<lu",
content:"<lower = ${1:expression}, upper = ${2:expression}>${0}"},{name:"while",content:"while (${1:condition}) {\n  ${0}\n}"},{name:"gen",content:"generated quantities {\n  ${0}\n}"},{name:"mdl",content:"model {\n  ${0}\n}"},{name:"par",content:"parameters {\n  ${0}\n}"},{name:"tpar",content:"transformed parameters {\n  ${0}\n}"},{name:"data",content:"data {\n  ${0}\n}"},{name:"tdata",content:"transformed data {\n  ${0}\n}"},{name:"ode",content:"integrate_ode(${1:function}, ${2:y0}, ${3:t0}, ${4:t}, ${5:theta}, ${6:x_r}, ${7:x_i});"},
{name:"funs",content:"functions {\n  ${0}\n}"},{name:"fun",content:"${1:return} ${2:name} (${3:args}) {\n  ${0}\n}"}];i.normalizeSnippets(g);k.snippetText=i.toSnippetText(g);m.register(g,"stan");m.files["mode/stan"]=!0});