function elt(n,t){var u=document.createElement(n),r,i;for(t&&(u.className=t),r=2;r500&&(i=500);this.lastSavedId=n;r="http://volatileread.com/utilitylibrary/snippetcompiler?id="+n;u="#SNIPCOMP#"+n+"#H"+i+"#R"+(o?1:0)+(s?"#V6":"");this.ctnr.find(".permLink").html(""+r+"
Embed Key: "+u);this.ctnr.find(".permLinkSec").removeClass("hidden")};this.unexpected=function(){this.busyEnd();this.ctnr.find(".buildStatus").html("OOPS.. An unexpected error has occured. Please try again")};this.busyStart=function(){this.clear();this.ctnr.find(".tab-content").addClass("busyPanel");this.ctnr.find(".btnCompile").attr("disabled","disabled")};this.busyEnd=function(n){this.ctnr.find(".tab-content").removeClass("busyPanel");n!=!0&&this.ctnr.find(".btnCompile").removeAttr("disabled")};this.clear=function(){this.ctnr.find(".buildErrList").html("");this.ctnr.find(".warnList").html("");this.ctnr.find(".output").html("");this.ctnr.find(".buildSummary").html("");this.ctnr.find(".errorSummary").html("")};this.partialResult=null;this.lastSequence=0;this.processingMessage=!1;this.messageRecieved=function(n){var r=[],i=n.Data,t,u,e;this.partialResult==null?this.partialResult=i:(t=this.partialResult,t.SandboxerErrors=this.mergeAndSort(t.SandboxerErrors,i.SandboxerErrors),t.Errors=this.mergeAndSort(t.Errors,i.Errors),t.Warnings=this.mergeAndSort(t.Warnings,i.Warnings),t.Output=this.mergeAndSort(t.Output,i.Output));t=this.partialResult;r=this.addToSeqList(r,t.SandboxerErrors);r=this.addToSeqList(r,t.Errors);r=this.addToSeqList(r,t.Warnings);r=this.addToSeqList(r,t.Output);var o=Math.max.apply(null,r),s=Math.min.apply(null,r),f=[];for(u=s;u"+i.SandboxerErrors[r].Message+"";if(i.Errors!=undefined&&i.Errors.length>0){for(r=0;r"+i.Errors[r].Message+"";this.ctnr.find(".errorSummary").html(i.Errors.length+(i.Errors.length==1?" Error":" Errors"));this.ctnr.find(".buildSummary").html("Build Failed. Please correct the errors and try again");this.showTab("errorsTab")}else this.ctnr.find(".buildSummary").html("Compilation Succeded!"),this.ctnr.find(".errorSummary").html("0 Errors"),i.SandboxerErrors==undefined||i.SandboxerErrors.length==0?t?this.showTab("buildStatusTab"):this.showTab("outputTab"):this.showTab("errorsTab");if(i.Warnings!=undefined)for(r=0;r"+i.Warnings[r].Message+"";if(i.Output!=undefined)for(r=0;r',e=i.Output[r],e.MessageType=3),i.Output[r].Message!=undefined&&i.Output[r].Message!=null)&&(replOp=i.Output[r].Message.replace(/\\r\\n/g,"
"),s+=""+i.Output[r].Message+"");h.html(o);c.html(l);u.html(s);e!=null&&(f=u.find(".consoleIp"),f.focus(),f.keypress(function(t){var i,r;t.keyCode==13&&(i=f.text(),f.remove(),r=htmlEncode(i),u.html(u.html()+""+r+"
"),$.connection.snippetCompilerHub.server.writeToProcessStdIn(n,i).fail(function(n){console.warn("failed sending ipTxt. Err: "+n)}),e.Message=r+"\n")}))};this.compileSuccess=function(n){this.busyEnd(n.Running);this.updateMessageInUI(n);var t=this;if(this.ctnr.find(".errItem, .warnItem").click(function(){t.setGutter($(this).attr("l"),$(this).attr("c"))}),this.onSuccessfulResults!=null&&!n.Running)this.onSuccessfulResults(this.partialResult)};this.createMarker=function(){return this.pntrElem};this.showTab=function(t){var i=n+t;this.ctnr.find("[href=#"+i+"]").tab("show")};this.setGutter=function(n){this.myCodeMirror.focus();this.myCodeMirror.setCursor(n-1,0);this.myCodeMirror.setGutterMarker(n-1,"gutter",this.createMarker())};this.setBtnAttrForConn=function(n){var t=this.ctnr.find(".btnCompile"),i=this.ctnr.find(".con-status");n?(t.removeAttr("disabled"),i.addClass("hidden")):(t.attr("disabled","disabled"),i.removeClass("hidden"))};this.keyEvent=function(n,t){(t.keyCode==116||t.keyCode==119)&&t.type=="keydown"&&(CodeMirror.e_stop(t),this.compile());t.keyCode==190&&t.type=="keyup"&&CodeMirror.showHint(n.myCodeMirror,CodeMirror.hint.csharp,{async:!0,guid:n.containerId});t.keyCode==57&&t.type=="keyup"}}function initializeHub(){var t,n;if($.connection!=undefined&&window.useSignalR==!0){for(t=$.connection.snippetCompilerHub,t.client.onSnippetMessage=function(n,t){allSnippetObjs[n].messageRecieved(t)},t.client.onUserInputRequired=function(n,t){allSnippetObjs[n].messageRecieved(t)},n=0;n").text(n).html()}function handlepaste(n,t){t.preventDefault();var i=(t.originalEvent||t).clipboardData,r=i!=null&&i!=undefined?i.getData("text/plain")||prompt("Paste something.."):window.clipboardData.getData("Text");insertTextCmd(r)}function insertTextCmd(n){var u,t,r,i;if(document.body.createTextRange){try{document.execCommand("ms-beginUndoUnit",!1,null)}catch(f){}document.selection?t=document.selection.createRange():window.getSelection&&(u=window.getSelection(),r=u.getRangeAt(0),i=document.createElement("span"),i.innerHTML="FEFF;",r.deleteContents(),r.insertNode(i),t=document.body.createTextRange(),t.moveToElementText(i),i.parentNode.removeChild(i));t.text=n;t.collapse(!1);t.select();try{document.execCommand("ms-endUndoUnit",!1,null)}catch(f){}}else document.execCommand("insertText",!1,n)}(function(n){if(typeof exports=="object"&&typeof module=="object")module.exports=n();else{if(typeof define=="function"&&define.amd)return define([],n);this.CodeMirror=n()}})(function(){"use strict";function t(n,i){var r,h,u,o,f,e;if(!(this instanceof t))return new t(n,i);this.options=i=i?vt(i):{};vt(bv,i,!1);os(i);r=i.value;typeof r=="string"&&(r=new nt(r,i.mode,null,i.lineSeparator));this.doc=r;h=new t.inputStyles[i.inputStyle](this);u=this.display=new lw(n,r,h);u.wrapper.CodeMirror=this;rl(this);il(this);i.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");i.autofocus&&!eu&&u.input.focus();ul(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new kf,keySeq:null,specialChars:null};o=this;s&&a<11&&setTimeout(function(){o.display.input.reset(!0)},20);nk(this);ig();lr(this);this.curOp.forceUpdate=!0;ip(this,r);i.autofocus&&!eu||o.hasFocus()?setTimeout(ne(ah,this),20):gu(this);for(f in di)di.hasOwnProperty(f)&&di[f](this,i[f],wh);for(el(this),i.finishInit&&i.finishInit(this),e=0;et.maxLineLength&&(t.maxLineLength=i,t.maxLine=n)})}function os(n){var t=g(n.gutters,"CodeMirror-linenumbers");t==-1&&n.lineNumbers?n.gutters=n.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!n.lineNumbers&&(n.gutters=n.gutters.slice(0),n.gutters.splice(t,1))}function hu(n){var t=n.display,i=t.gutters.offsetWidth,r=Math.round(n.doc.height+rh(n.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:n.options.fixedGutter?i:0,docHeight:r,scrollHeight:r+yt(n)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}function ss(n,t,r){this.cm=r;var f=this.vert=i("div",[i("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),e=this.horiz=i("div",[i("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n(f);n(e);u(f,"scroll",function(){f.clientHeight&&t(f.scrollTop,"vertical")});u(e,"scroll",function(){e.clientWidth&&t(e.scrollLeft,"horizontal")});this.checkedOverlay=!1;s&&a<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function hs(){}function ul(n){n.display.scrollbars&&(n.display.scrollbars.clear(),n.display.scrollbars.addClass&&uu(n.display.wrapper,n.display.scrollbars.addClass));n.display.scrollbars=new t.scrollbarModel[n.options.scrollbarStyle](function(t){n.display.wrapper.insertBefore(t,n.display.scrollbarFiller);u(t,"mousedown",function(){n.state.focused&&setTimeout(function(){n.display.input.focus()},0)});t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?yr(n,t):ku(n,t)},n);n.display.scrollbars.addClass&&fu(n.display.wrapper,n.display.scrollbars.addClass)}function hr(n,t){var i,r,u;for(t||(t=hu(n)),i=n.display.barWidth,r=n.display.barHeight,fl(n,t),u=0;u<4&&i!=n.display.barWidth||r!=n.display.barHeight;u++)i!=n.display.barWidth&&n.options.lineWrapping&&ee(n),fl(n,hu(n)),i=n.display.barWidth,r=n.display.barHeight}function fl(n,t){var i=n.display,r=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=r.right)+"px";i.sizer.style.paddingBottom=(i.barHeight=r.bottom)+"px";r.right&&r.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=r.bottom+"px",i.scrollbarFiller.style.width=r.right+"px"):i.scrollbarFiller.style.display="";r.bottom&&n.options.coverGutterNextToScrollbar&&n.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=r.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}function cs(n,t,i){var f=i&&i.top!=null?Math.max(0,i.top):n.scroller.scrollTop,o,s;f=Math.floor(f-pe(n));var h=i&&i.bottom!=null?i.bottom:f+n.wrapper.clientHeight,u=ur(t,f),e=ur(t,h);return i&&i.ensure&&(o=i.ensure.from.line,s=i.ensure.to.line,o=e&&(u=ur(t,ei(r(t,s))-n.wrapper.clientHeight),e=s)),{from:u,to:Math.max(e,u+1)}}function ls(n){var t=n.display,r=t.view,i,u,f;if(t.alignWidgets||t.gutters.firstChild&&n.options.fixedGutter){var e=vs(t)-t.scroller.scrollLeft+n.doc.scrollLeft,s=t.gutters.offsetWidth,o=e+"px";for(i=0;i=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&nv(n)==0)return!1;el(n)&&(ci(n),t.dims=bs(n));var c=o.first+o.size,u=Math.max(t.visible.from-n.options.viewportMargin,o.first),f=Math.min(c,t.visible.to+n.options.viewportMargin);return(i.viewFromf&&i.viewTo-f<20&&(f=Math.min(c,i.viewTo)),si&&(u=dh(n.doc,u),f=oy(n.doc,f)),h=u!=i.viewFrom||f!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth,gb(n,u,f),i.viewOffset=ei(r(n.doc,i.viewFrom)),n.display.mover.style.top=i.viewOffset+"px",s=nv(n),!h&&s==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))?!1:(e=gt(),s>4&&(i.lineDiv.style.display="none"),yw(n,i.updateLineNumbers,t.dims),s>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,e&&gt()!=e&&e.offsetHeight&&e.focus(),or(i.cursorDiv),or(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,h&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,yu(n,400)),i.updateLineNumbers=null,!0)}function ol(n,t){for(var i=t.viewport,u,r=!0;;r=!1){if((!r||!n.options.lineWrapping||t.oldDisplayWidth==hi(n))&&(i&&i.top!=null&&(i={top:Math.min(n.doc.height+rh(n.display)-uh(n),i.top)}),t.visible=cs(n.display,n.doc,i),t.visible.from>=n.display.viewFrom&&t.visible.to<=n.display.viewTo))break;if(!ys(n,t))break;ee(n);u=hu(n);vu(n);ws(n,u);hr(n,u)}t.signal(n,"update",n);(n.display.viewFrom!=n.display.reportedViewFrom||n.display.viewTo!=n.display.reportedViewTo)&&(t.signal(n,"viewportChange",n,n.display.viewFrom,n.display.viewTo),n.display.reportedViewFrom=n.display.viewFrom,n.display.reportedViewTo=n.display.viewTo)}function ps(n,t){var i=new fe(n,t),r;ys(n,i)&&(ee(n),ol(n,i),r=hu(n),vu(n),ws(n,r),hr(n,r),i.finish())}function ws(n,t){n.display.sizer.style.minHeight=t.docHeight+"px";var i=t.docHeight+n.display.barHeight;n.display.heightForcer.style.top=i+"px";n.display.gutters.style.height=Math.max(i+yt(n),t.clientHeight)+"px"}function ee(n){for(var r=n.display,c=r.lineDiv.offsetTop,t,i,e,o,h,f,u=0;u.001||h-1&&(h=!1),hl(n,r,f,i));h&&(or(r.lineNumber),r.lineNumber.appendChild(document.createTextNode(as(n.options,f))));u=r.node.nextSibling}else a=kw(n,r,f,i),s.insertBefore(a,u);f+=r.size}while(u)u=c(u)}function hl(n,t,i,r){for(var u,f=0;f1)if(ut&&ut.join("\n")==i){if(f.ranges.length%ut.length==0)for(s=[],o=0;o=0;o--){var p=f.ranges[o],y=p.from(),c=p.to();p.empty()&&(u&&u>0?y=n(y.line,y.ch-u):t.state.overwrite&&!a&&(c=n(c.line,Math.min(r(l,c.line).text.length,c.ch+h(v).length))));b=t.curOp.updateInput;w={from:y,to:c,text:s?s[o%s.length]:v,origin:e||(a?"paste":t.state.cutIncoming?"cut":"+input")};pr(t.doc,w);tt(t,"inputRead",t,w)}i&&!a&&wl(t,i);br(t);t.curOp.updateInput=b;t.curOp.typing=!0;t.state.pasteIncoming=t.state.cutIncoming=!1}function pl(n,t){var i=n.clipboardData&&n.clipboardData.getData("text/plain");if(i)return n.preventDefault(),ft(t,function(){ce(t,i,0,null,"paste")}),!0}function wl(n,t){var e,u,i,f,o,s;if(n.options.electricChars&&n.options.smartIndent)for(e=n.doc.sel,u=e.ranges.length-1;u>=0;u--)if(i=e.ranges[u],!(i.head.ch>100)&&(!u||e.ranges[u-1].head.line!=i.head.line)){if(f=n.getModeAt(i.head),o=!1,f.electricChars){for(s=0;s-1){o=tf(n,i.head.line,"smart");break}}else f.electricInput&&f.electricInput.test(r(n.doc,i.head.line).text.slice(0,i.head.ch))&&(o=tf(n,i.head.line,"smart"));o&&tt(n,"electricInput",n,i.head.line)}}function bl(t){for(var f=[],e=[],u,r,i=0;i
u?(o=s,l=y,(b=h)&&(l+=1e3),w=a):(e=s,v=y,it=h,w-=a)}}function wi(n){var r,t;if(n.cachedTextHeight!=null)return n.cachedTextHeight;if(pi==null){for(pi=i("pre"),r=0;r<49;++r)pi.appendChild(document.createTextNode("x")),pi.appendChild(i("br"));pi.appendChild(document.createTextNode("x"))}return st(n.measure,pi),t=pi.offsetHeight/50,t>3&&(n.cachedTextHeight=t),or(n.measure),t||1}function bu(n){var r,f,u,t;return n.cachedCharWidth!=null?n.cachedCharWidth:(r=i("span","xxxxxxxxxx"),f=i("pre",[r]),st(n.measure,f),u=r.getBoundingClientRect(),t=(u.right-u.left)/10,t>2&&(n.cachedCharWidth=t),t||10)}function lr(n){n.curOp={cm:n,viewChanged:!1,startHeight:n.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++da};bi?bi.ops.push(n.curOp):n.curOp.ownsGroup=bi={ops:[n.curOp],delayedCallbacks:[]}}function vb(n){var u=n.delayedCallbacks,i=0,r,t;do{for(;i=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping;n.update=n.mustUpdate&&new fe(t,n.mustUpdate&&{top:n.scrollTop,ensure:n.scrollToPos},n.forceUpdate)}function wb(n){n.updatedDisplay=n.mustUpdate&&ys(n.cm,n.update)}function bb(n){var t=n.cm,i=t.display;n.updatedDisplay&&ee(t);n.barMeasure=hu(t);i.maxLineChanged&&!t.options.lineWrapping&&(n.adjustWidthTo=ca(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=n.adjustWidthTo,n.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+n.adjustWidthTo+yt(t)+t.display.barWidth),n.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+n.adjustWidthTo-hi(t)));(n.updatedDisplay||n.selectionChanged)&&(n.preparedSelection=i.input.prepareSelection())}function kb(n){var t=n.cm;n.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=n.adjustWidthTo+"px",n.maxScrollLeftt)&&(u.updateLineNumbers=t);n.curOp.viewChanged=!0;t>=u.viewTo?si&&dh(n.doc,t)u.viewFrom?ci(n):(u.viewFrom+=r,u.viewTo+=r):t<=u.viewFrom&&i>=u.viewTo?ci(n):t<=u.viewFrom?(f=de(n,i,i+r,1),f?(u.view=u.view.slice(f.index),u.viewFrom=f.lineN,u.viewTo+=r):ci(n)):i>=u.viewTo?(f=de(n,t,t,-1),f?(u.view=u.view.slice(0,f.index),u.viewTo=f.lineN):ci(n)):(o=de(n,t,t,-1),s=de(n,i,i+r,1),o&&s?(u.view=u.view.slice(0,o.index).concat(ke(n,o.lineN,s.lineN)).concat(u.view.slice(s.index)),u.viewTo+=r):ci(n));e=u.externalMeasured;e&&(i=u.lineN&&t=r.viewTo)||(f=r.view[ki(n,t)],f.node!=null)&&(e=f.changes||(f.changes=[]),g(e,i)==-1&&e.push(i))}function ci(n){n.display.viewFrom=n.display.viewTo=n.doc.first;n.display.view=[];n.display.viewOffset=0}function ki(n,t){var r,i;if(t>=n.display.viewTo||(t-=n.display.viewFrom,t<0))return null;for(r=n.display.view,i=0;i0){if(u==f.length-1)return null;o=e+f[u].size-t;u++}else o=e-t;t+=o;i+=o}while(dh(n.doc,i)!=i){if(u==(r<0?0:f.length-1))return null;i+=r*f[u-(r<0?1:0)].size;u+=r}return{index:u,lineN:i}}function gb(n,t,i){var r=n.display,u=r.view;u.length==0||t>=r.viewTo||i<=r.viewFrom?(r.view=ke(n,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=ke(n,t,r.viewFrom).concat(r.view):r.viewFromi&&(r.view=r.view.slice(0,ki(n,i))));r.viewTo=i}function nv(n){for(var r=n.display.view,u=0,i,t=0;t400}var i=t.display,e,f,r;u(i.scroller,"mousedown",v(t,tv));s&&a<11?u(i.scroller,"dblclick",v(t,function(n){var i,r;kt(t,n)||(i=vr(t,n),!i||rv(t,n)||ui(t.display,n))||(k(n),r=t.findWordAt(i),ae(t.doc,r.anchor,r.head))})):u(i.scroller,"dblclick",function(n){kt(t,n)||k(n)});is||u(i.scroller,"contextmenu",function(n){cv(t,n)});f={end:0};u(i.scroller,"touchstart",function(n){if(!p(n)){clearTimeout(e);var t=+new Date;i.activeTouch={start:t,moved:!1,prev:t-f.end<=300?f:null};n.touches.length==1&&(i.activeTouch.left=n.touches[0].pageX,i.activeTouch.top=n.touches[0].pageY)}});u(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)});u(i.scroller,"touchend",function(r){var u=i.activeTouch,f,e;u&&!ui(i,r)&&u.left!=null&&!u.moved&&new Date-u.start<300&&(f=t.coordsChar(i.activeTouch,"page"),e=!u.prev||c(u,u.prev)?new l(f,f):!u.prev.prev||c(u,u.prev.prev)?t.findWordAt(f):new l(n(f.line,0),o(t.doc,n(f.line+1,0))),t.setSelection(e.anchor,e.head),t.focus(),k(r));h()});u(i.scroller,"touchcancel",h);u(i.scroller,"scroll",function(){i.scroller.clientHeight&&(ku(t,i.scroller.scrollTop),yr(t,i.scroller.scrollLeft,!0),y(t,"scroll",t))});u(i.scroller,"mousewheel",function(n){uv(t,n)});u(i.scroller,"DOMMouseScroll",function(n){uv(t,n)});u(i.wrapper,"scroll",function(){i.wrapper.scrollTop=i.wrapper.scrollLeft=0});i.dragFunctions={simple:function(n){kt(t,n)||po(n)},start:function(n){ok(t,n)},drop:v(t,ek)};r=i.input.getField();u(r,"keyup",function(n){sv.call(t,n)});u(r,"keydown",v(t,ov));u(r,"keypress",v(t,hv));u(r,"focus",ne(ah,t));u(r,"blur",ne(gu,t))}function tk(n,i,r){var o=r&&r!=t.Init,f,e;!i!=!o&&(f=n.display.dragFunctions,e=i?u:bt,e(n.display.scroller,"dragstart",f.start),e(n.display.scroller,"dragenter",f.simple),e(n.display.scroller,"dragover",f.simple),e(n.display.scroller,"drop",f.drop))}function ik(n){var t=n.display;(t.lastWrapHeight!=t.wrapper.clientHeight||t.lastWrapWidth!=t.wrapper.clientWidth)&&(t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,n.setSize())}function ui(n,t){for(var i=pf(t);i!=n.wrapper;i=i.parentNode)if(!i||i.nodeType==1&&i.getAttribute("cm-ignore-events")=="true"||i.parentNode==n.sizer&&i!=n.mover)return!0}function vr(t,i,u,f){var a=t.display,s,c,h,e,o,l;if(!u&&pf(i).getAttribute("cm-not-content")=="true")return null;h=a.lineSpace.getBoundingClientRect();try{s=i.clientX-h.left;c=i.clientY-h.top}catch(i){return null}return e=hh(t,s,c),f&&e.xRel==1&&(o=r(t.doc,e.line).text).length==e.ch&&(l=ot(o,o.length,t.options.tabSize)-o.length,e=n(e.line,Math.max(0,Math.round((s-sa(t.display).left)/bu(t.display))-l))),e}function tv(n){var t=this,i=t.display,r;if((!i.activeTouch||!i.input.supportsTouch())&&!kt(t,n)){if(i.shift=n.shiftKey,ui(i,n)){p||(i.scroller.draggable=!1,setTimeout(function(){i.scroller.draggable=!0},100));return}if(!rv(t,n)){r=vr(t,n);window.focus();switch(cp(n)){case 1:r?rk(t,n,r):pf(n)==i.scroller&&k(n);break;case 2:p&&(t.state.lastMiddleDown=+new Date);r&&ae(t.doc,r);setTimeout(function(){i.input.focus()},20);k(n);break;case 3:is?cv(t,n):lk(t)}}}}function rk(n,t,i){var r,u,o,h,f;s?setTimeout(ne(yl,n),0):n.curOp.focus=gt();r=+new Date;no&&no.time>r-400&&e(no.pos,i)==0?u="triple":ge&&ge.time>r-400&&e(ge.pos,i)==0?(u="double",no={time:r,pos:i}):(u="single",ge={time:r,pos:i});o=n.doc.sel;h=ct?t.metaKey:t.ctrlKey;n.options.dragDrop&&nw&&!he(n)&&u=="single"&&(f=o.contains(i))>-1&&(e((f=o.ranges[f]).from(),i)<0||i.xRel>0)&&(e(f.to(),i)>0||i.xRel<0)?uk(n,t,i,h):fk(n,t,i,u,h)}function uk(n,t,i,r){var f=n.display,o=+new Date,e=v(n,function(u){p&&(f.scroller.draggable=!1);n.state.draggingText=!1;bt(document,"mouseup",e);bt(f.scroller,"drop",e);Math.abs(t.clientX-u.clientX)+Math.abs(t.clientY-u.clientY)<10&&(k(u),!r&&+new Date-200p&&u.push(new l(n(h,p),n(h,yp(d,et,k))));u.length||u.push(new l(f,f));w(c,lt(b.ranges.slice(0,a).concat(u),a),{origin:"*mouse",scroll:!1});t.scrollIntoView(i)}else{var nt=y,g=nt.anchor,tt=i;s!="single"&&(v=s=="double"?t.findWordAt(i):new l(n(i.line,0),o(c,n(i.line+1,0))),e(v.anchor,g)>0?(tt=v.head,g=se(nt.from(),v.anchor)):(tt=v.anchor,g=oe(nt.to(),v.head)));u=b.ranges.slice(0);u[a]=new l(o(c,g),tt);w(c,lt(u,a),ec)}}function ut(n){var f=++d,i=vr(t,n,!0,s=="rect"),r,u;i&&(e(i,it)!=0?(t.curOp.focus=gt(),ht(i),r=cs(g,c),(i.line>=r.to||i.linert.bottom?20:0,u&&setTimeout(v(t,function(){d==f&&(g.scroller.scrollTop+=u,ut(n))}),50)))}function st(n){d=Infinity;k(n);g.input.focus();bt(document,"mousemove",ft);bt(document,"mouseup",et);c.history.lastSelOrigin=null}var g=t.display,c=t.doc,y,a,b,p,nt,tt,it,rt,d,ft,et;k(i);b=c.sel;p=b.ranges;h&&!i.shiftKey?(a=c.sel.contains(f),y=a>-1?p[a]:new l(f,f)):(y=c.sel.primary(),a=c.sel.primIndex);i.altKey?(s="rect",h||(y=new l(f,f)),f=vr(t,i,!0,!0),a=-1):s=="double"?(nt=t.findWordAt(f),y=t.display.shift||c.extend?au(c,y,nt.anchor,nt.head):nt):s=="triple"?(tt=new l(n(f.line,0),o(c,n(f.line+1,0))),y=t.display.shift||c.extend?au(c,y,tt.anchor,tt.head):tt):y=au(c,y,f);h?a==-1?(a=p.length,w(c,lt(p.concat([y]),a),{scroll:!1,origin:"*mouse"})):p.length>1&&p[a].empty()&&s=="single"&&!i.shiftKey?(w(c,lt(p.slice(0,a).concat(p.slice(a+1)),0)),b=c.sel):th(c,a,y,ec):(a=0,w(c,new ni([y],0),ec),b=c.sel);it=f;rt=g.wrapper.getBoundingClientRect();d=0;ft=v(t,function(n){cp(n)?ut(n):st(n)});et=v(t,st);u(document,"mousemove",ft);u(document,"mouseup",et)}function iv(n,t,i,r,u){var s,e,o,h,f,c,l,a;try{s=t.clientX;e=t.clientY}catch(t){return!1}if(s>=Math.floor(n.display.gutters.getBoundingClientRect().right))return!1;if(r&&k(t),o=n.display,h=o.lineDiv.getBoundingClientRect(),e>h.bottom||!et(n,i))return fc(t);for(e-=h.top-o.viewOffset,f=0;f=s)return l=ur(n.doc,e),a=n.options.gutters[f],u(n,i,n,l,a,t),fc(t)}function rv(n,t){return iv(n,t,"gutterClick",!0,tt)}function ek(n){var t=this,r,f,u,e,i;if(!kt(t,n)&&!ui(t.display,n)&&(k(n),s&&(ch=+new Date),r=vr(t,n,!0),f=n.dataTransfer.files,r&&!he(t)))if(f&&f.length&&window.FileReader&&window.File){var h=f.length,u=Array(h),c=0,l=function(n,i){var f=new FileReader;f.onload=v(t,function(){if(u[i]=f.result,++c==h){r=o(t.doc,r);var n={from:r,to:r,text:t.doc.splitLines(u.join(t.doc.lineSeparator())),origin:"paste"};pr(t.doc,n);ra(t.doc,ti(r,li(n)))}});f.readAsText(n)};for(i=0;i-1){t.state.draggingText(n);setTimeout(function(){t.display.input.focus()},20);return}try{if(u=n.dataTransfer.getData("Text"),u){if(!t.state.draggingText||(ct?n.altKey:n.ctrlKey)||(e=t.listSelections()),ve(t.doc,ti(r,r)),e)for(i=0;ir.clientWidth||u&&r.scrollHeight>r.clientHeight){if(u&&ct&&p)n:for(f=t.target,h=i.view;f!=r;f=f.parentNode)for(o=0;o=0;--r)yv(n,{from:u[r].from,to:u[r].to,text:r?[""]:t.text});else yv(n,t)}function yv(n,t){var i,r;(t.text.length!=1||t.text[0]!=""||e(t.from,t.to)!=0)&&(i=vh(n,t),up(n,t,i,n.cm?n.cm.curOp.id:NaN),nf(n,t,i,kh(n,t)),r=[],ir(n,function(n,i){i||g(r,n.history)!=-1||(sp(n.history,t),r.push(n.history));nf(n,t,null,kh(n,t))}))}function uo(n,t,i){var c,v,u,f,y,l;if(!n.cm||!n.cm.state.suppressEdits){var e=n.history,r,a=n.sel,o=t=="undo"?e.done:e.undone,s=t=="undo"?e.undone:e.done;for(u=0;u=0;--u){if(f=r.changes[u],f.origin=t,v&&!vv(n,f,!1)){o.length=0;return}c.push(uc(n,f));y=u?vh(n,f):h(o);nf(n,f,y,ny(n,f));!u&&n.cm&&n.cm.scrollIntoView({from:f.from,to:li(f)});l=[];ir(n,function(n,t){t||g(l,n.history)!=-1||(sp(n.history,f),l.push(n.history));nf(n,f,null,ny(n,f))})}}}}function pv(t,i){if(i!=0&&(t.first+=i,t.sel=new ni(wo(t.sel.ranges,function(t){return new l(n(t.anchor.line+i,t.anchor.ch),n(t.head.line+i,t.head.ch))}),t.sel.primIndex),t.cm)){it(t.cm,t.first,t.first-i,i);for(var u=t.cm.display,r=u.viewFrom;rt.lastLine()||(i.from.linee&&(i={from:i.from,to:n(e,r(t,e).text.length),text:[i.text[0]],origin:i.origin}),i.removed=rr(t,i.from,i.to),u||(u=vh(t,i)),t.cm?yk(t.cm,i,f):ic(t,i,f),ve(t,u,dt))}function yk(n,t,i){var f=n.doc,e=n.display,u=t.from,o=t.to,s=!1,h=u.line,y,l,a,v;n.options.lineWrapping||(h=c(pt(r(f,u.line))),f.iter(h,o.line+1,function(n){if(n==e.maxLine)return s=!0,!0}));f.sel.contains(t.from,t.to)>-1&&lp(n);ic(f,t,i,tl(n));n.options.lineWrapping||(f.iter(h,u.line+t.text.length,function(n){var t=ue(n);t>e.maxLineLength&&(e.maxLine=n,e.maxLineLength=t,e.maxLineChanged=!0,s=!1)}),s&&(n.curOp.updateMaxLine=!0));f.frontier=Math.min(f.frontier,u.line);yu(n,400);y=t.text.length-(o.line-u.line)-1;t.full?it(n):u.line!=o.line||t.text.length!=1||gy(n.doc,t)?it(n,u.line,o.line+1,y):ri(n,u.line,"text");l=et(n,"changes");a=et(n,"change");(a||l)&&(v={from:u,to:o,text:t.text,removed:t.removed,origin:t.origin},a&&tt(n,"change",n,v),l&&(n.curOp.changeObjs||(n.curOp.changeObjs=[])).push(v));n.display.selForContextMenu=null}function wr(n,t,i,r,u){if(r||(r=i),e(r,i)<0){var f=r;r=i;i=f}typeof t=="string"&&(t=n.splitLines(t));pr(n,{from:i,to:r,text:t,origin:u})}function pk(n,t){var u;if(!kt(n,"scrollCursorIntoView")){var f=n.display,e=f.sizer.getBoundingClientRect(),r=null;t.top+e.top<0?r=!0:t.bottom+e.top>(window.innerHeight||document.documentElement.clientHeight)&&(r=!1);r==null||hw||(u=i("div","​",null,"position: absolute; top: "+(t.top-f.viewOffset-pe(n.display))+"px; height: "+(t.bottom-t.top+yt(n)+f.barHeight)+"px; left: "+t.left+"px; width: 2px;"),n.display.lineSpace.appendChild(u),u.scrollIntoView(r),n.display.lineSpace.removeChild(u))}}function wk(n,t,i,r){var o;for(r==null&&(r=0),o=0;o<5;o++){var s=!1,u=ii(n,t),f=!i||i==t?u:ii(n,i),e=fo(n,Math.min(u.left,f.left),Math.min(u.top,f.top)-r,Math.max(u.left,f.left),Math.max(u.bottom,f.bottom)+r),h=n.doc.scrollTop,c=n.doc.scrollLeft;if(e.scrollTop!=null&&(ku(n,e.scrollTop),Math.abs(n.doc.scrollTop-h)>1&&(s=!0)),e.scrollLeft!=null&&(yr(n,e.scrollLeft),Math.abs(n.doc.scrollLeft-c)>1&&(s=!0)),!s)break}return u}function bk(n,t,i,r,u){var f=fo(n,t,i,r,u);f.scrollTop!=null&&ku(n,f.scrollTop);f.scrollLeft!=null&&yr(n,f.scrollLeft)}function fo(n,t,i,r,u){var e=n.display,a=wi(n.display),c;i<0&&(i=0);var h=n.curOp&&n.curOp.scrollTop!=null?n.curOp.scrollTop:e.scroller.scrollTop,o=uh(n),f={};u-i>o&&(u=i+o);var v=n.doc.height+rh(e),p=iv-a;ih+o&&(c=Math.min(i,(w?v:u)-o),c!=h&&(f.scrollTop=c));var y=n.curOp&&n.curOp.scrollLeft!=null?n.curOp.scrollLeft:e.scroller.scrollLeft,s=hi(n)-(n.options.fixedGutter?e.gutters.offsetWidth:0),l=r-t>s;return l&&(r=t+s),t<10?f.scrollLeft=0:ts+y-3&&(f.scrollLeft=r+(l?0:10)-s),f}function yh(n,t,i){(t!=null||i!=null)&&eo(n);t!=null&&(n.curOp.scrollLeft=(n.curOp.scrollLeft==null?n.doc.scrollLeft:n.curOp.scrollLeft)+t);i!=null&&(n.curOp.scrollTop=(n.curOp.scrollTop==null?n.doc.scrollTop:n.curOp.scrollTop)+i)}function br(t){eo(t);var i=t.getCursor(),r=i,u=i;t.options.lineWrapping||(r=i.ch?n(i.line,i.ch-1):i,u=n(i.line,i.ch+1));t.curOp.scrollToPos={from:r,to:u,margin:t.options.cursorScrollMargin,isCursor:!0}}function eo(n){var t=n.curOp.scrollToPos;if(t){n.curOp.scrollToPos=null;var i=ka(n,t.from),r=ka(n,t.to),u=fo(n,Math.min(i.left,r.left),Math.min(i.top,r.top)-t.margin,Math.max(i.right,r.right),Math.max(i.bottom,r.bottom)+t.margin);n.scrollTo(u.scrollLeft,u.scrollTop)}}function tf(t,i,u,f){var o=t.doc,b,a,e,v,s,w,c;u==null&&(u="add");u=="smart"&&(o.mode.indent?b=pu(t,i):u="prev");var y=t.options.tabSize,h=r(o,i),p=ot(h.text,null,y);if(h.stateAfter&&(h.stateAfter=null),a=h.text.match(/^\s*/)[0],f||/\S/.test(h.text)){if(u=="smart"&&(e=o.mode.indent(b,h.text.slice(a.length),h.text),e==vp||e>150)){if(!f)return;u="prev"}}else e=0,u="not";if(u=="prev"?e=i>o.first?ot(r(o,i-1).text,null,y):0:u=="add"?e=p+t.options.indentUnit:u=="subtract"?e=p-t.options.indentUnit:typeof u=="number"&&(e=p+u),e=Math.max(0,e),v="",c=0,t.options.indentWithTabs)for(s=Math.floor(e/y);s;--s)c+=y,v+="\t";if(c=0;t--)wr(n.doc,"",i[t].from,i[t].to,"+delete");br(n)})}function ph(t,i,u,f,e){function d(){var n=a+u;return n=t.first+t.size?y=!1:(a=n,h=r(t,n))}function c(n){var t=(e?wc:uw)(h,o,u,!0);if(t==null)if(!n&&d())o=e?(u<0?ns:go)(h):u<0?h.text.length:0;else return y=!1;else o=t;return!0}var a=i.line,o=i.ch,k=u,h=r(t,a),y=!0,l,v,s,b;if(f=="char")c();else if(f=="column")c(!0);else if(f=="word"||f=="group"){var p=null,w=f=="group",g=t.cm&&t.cm.getHelper(i,"wordChars");for(l=!0;;l=!1){if(u<0&&!c(!l))break;if(v=h.text.charAt(o)||"\n",s=bo(v,g)?"w":w&&v=="\n"?"n":!w||/\s/.test(v)?null:"p",!w||l||s||(s="s"),p&&p!=s){u<0&&(u=1,c());break}if(s&&(p=s),u>0&&!c(!l))break}}return b=ye(t,n(a,o),k,!0),y||(b.hitSide=!0),b}function wv(n,t,i,r){var o=n.doc,s=t.left,u,e,f;for(r=="page"?(e=Math.min(n.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),u=t.top+i*(e-(i<0?1.5:.5)*wi(n.display))):r=="line"&&(u=i>0?t.bottom+3:t.top-3);;){if(f=hh(n,s,u),!f.outside)break;if(i<0?u<=0:u>=o.height){f.hitSide=!0;break}u+=i*5}return f}function f(n,i,r,u){t.defaults[n]=i;r&&(di[n]=u?function(n,t,i){i!=wh&&r(n,t,i)}:r)}function kk(n){for(var i=n.split(/-(?!$)/),n=i[i.length-1],u,f,e,o,t,r=0;r0||a==0&&s.clearWhenEmpty!==!1)return s;if(s.replacedWith&&(s.collapsed=!0,s.widgetNode=i("span",[s.replacedWith],"CodeMirror-widget"),f.handleMouseEvents||s.widgetNode.setAttribute("cm-ignore-events","true"),f.insertLeft&&(s.widgetNode.insertLeft=!0)),s.collapsed){if(ey(n,t.line,t,r,s)||t.line!=r.line&&ey(n,r.line,t,r,s))throw new Error("Inserting collapsed marker partially overlapping an existing one");si=!0}if(s.addToHistory&&up(n,{from:t,to:r,origin:"markText"},n.sel,NaN),c=t.line,h=n.cm,n.iter(c,r.line+1,function(n){h&&s.collapsed&&!h.options.lineWrapping&&pt(n)==h.display.maxLine&&(y=!0);s.collapsed&&c!=t.line&&wt(n,0);ud(n,new co(s,c==t.line?t.ch:null,c==r.line?r.ch:null));++c}),s.collapsed&&n.iter(t.line,r.line+1,function(t){tr(n,t)&&wt(t,0)}),s.clearOnEnter&&u(s,"beforeCursorEnter",function(){s.clear()}),s.readOnly&&(nl=!0,(n.history.done.length||n.history.undone.length)&&n.clearHistory()),s.collapsed&&(s.id=++ef,s.atomic=!0),h){if(y&&(h.curOp.updateMaxLine=!0),s.collapsed)it(h,t.line,r.line+1);else if(s.className||s.title||s.startStyle||s.endStyle||s.css)for(l=t.line;l<=r.line;l++)ri(h,l,"text");s.atomic&&fa(h.doc);tt(h,"markerAdded",h,s)}return s}function nd(n,t,i,r,u){r=vt(r);r.shared=!1;var f=[nu(n,t,i,r,u)],e=f[0],s=r.widgetNode;return ir(n,function(n){s&&(r.widgetNode=s.cloneNode(!0));f.push(nu(n,o(n,t),o(n,i),r,u));for(var c=0;c=t:r.to>t),(e||(e=[])).push(new co(f,r.from,o?null:r.to)))}return e}function ed(n,t,i){var u,e,o;if(n)for(u=0;u=t:r.to>t);(s||r.from==t&&f.type=="bookmark"&&(!i||r.marker.insertLeft))&&(o=r.from==null||(f.inclusiveLeft?r.from<=t:r.from0&&u)for(i=0;i0)){var l=[s,1],a=e(f.from,u.from),v=e(f.to,u.to);(a<0||!c.inclusiveLeft&&!a)&&l.push({from:f.from,to:u.from});(v>0||!c.inclusiveRight&&!v)&&l.push({from:u.to,to:f.to});o.splice.apply(o,l);s+=l.length-1}return o}function ty(n){var i=n.markedSpans,t;if(i){for(t=0;t=0)||!(a<=0))&&(!(c<=0)||!(a>=0))&&(c<=0&&(e(h.to,i)>0||o.marker.inclusiveRight&&f.inclusiveLeft)||c>=0&&(e(h.from,u)<0||o.marker.inclusiveLeft&&f.inclusiveRight)))return!0}}function pt(n){for(var t;t=fy(n);)n=t.find(-1,!0).line;return n}function sd(n){for(var i,t;i=hf(n);)n=i.find(1,!0).line,(t||(t=[])).push(n);return t}function dh(n,t){var i=r(n,t),u=pt(i);return i==u?t:c(u)}function oy(n,t){if(t>n.lastLine())return t;var i=r(n,t),u;if(!tr(n,i))return t;while(u=hf(i))i=u.find(1,!0).line;return c(i)+1}function tr(n,t){var u=si&&t.markedSpans,i,r;if(u)for(r=0;ri.start)return e;throw new Error("Mode "+n.name+" failed to advance stream.");}function ly(n,t,i,u){function c(n){return{start:f.start,end:f.pos,string:f.current(),type:l||null,state:n?nr(e.mode,s):s}}var e=n.doc,a=e.mode,l;t=o(e,t);var v=r(e,t.line),s=pu(n,t.line,i),f=new ff(v.text,n.options.tabSize),h;for(u&&(h=[]);(u||f.posn.options.maxHighlightLength?(c=!1,e&&tc(n,t,r,o.pos),o.pos=t.length,h=null):h=hy(nc(i,o,r,v),f),v&&(a=v[0].name,a&&(h="m-"+(h?a+" "+h:a))),!c||l!=h){while(sn&&u.splice(f,1,n,u[f+1],r),f+=2,h=Math.min(n,r);if(t)if(s.opaque)u.splice(i,f-i,n,"cm-overlay "+t),f=i+2;else for(;ih&&c.from<=h)break;if(c.to>=a)return n(i,r,u,f,e,o,s);n(i,r.slice(0,c.to-h),u,f,null,o,s);f=null;r=r.slice(c.to-h);h=c.to}}}function dy(n,t,i,r){var u=!r&&i.widgetNode;u&&n.map.push(n.pos,n.pos+t,u);!r&&n.cm.display.input.needsContentAttribute&&(u||(u=n.content.appendChild(document.createElement("span"))),u.setAttribute("cm-marker",i.id));u&&(n.cm.display.input.setUneditable(u),n.content.appendChild(u));n.pos+=t}function wd(n,t,i){var d=n.markedSpans,g=n.text,v=0,h,a,u,f,s,l,k,rt;if(!d){for(h=1;hr||f.collapsed&&u.to==r&&u.from==r)?(u.to!=null&&u.to!=r&&o>u.to&&(o=u.to,p=""),f.className&&(y+=" "+f.className),f.css&&(it=f.css),f.startStyle&&u.from==r&&(w+=" "+f.startStyle),f.endStyle&&u.to==o&&(p+=" "+f.endStyle),f.title&&!b&&(b=f.title),f.collapsed&&(!e||ry(e.marker,f)<0)&&(e=u)):u.from>r&&o>u.from&&(o=u.from);if(e&&(e.from||0)==r){if(dy(t,(e.to==null?nt+1:e.to)-r,e.marker,e.from==null),e.to==null)return;e.to==r&&(e=!1)}if(!e&&a.length)for(s=0;s=nt)break;for(l=Math.min(nt,o);;){if(c){if(k=r+c.length,e||(rt=k>l?c.slice(0,l-r):c,t.addToken(t,rt,tt?tt+y:y,w,r+rt.length==o?p:"",b,it)),k>=l){c=c.slice(l-r);r=l;break}r=k;w=""}c=g.slice(v,v=i[h++]);tt=by(i[h++],t.cm.options)}}}function gy(n,t){return t.from.ch==0&&t.to.ch==0&&h(t.text)==""&&(!n.cm||n.cm.options.wholeLineUpdateBefore)}function ic(n,t,i,u){function v(n){return i?i[n]:null}function c(n,i,r){cd(n,i,r,u);tt(n,"change",n,t)}function p(n,t){for(var i=n,r=[];i1&&n.remove(e.line+1,y-1),n.insert(e.line+1,s));tt(n,"change",n,t)}function af(n){this.lines=n;this.parent=null;for(var t=0,i=0;t=n.size)throw new Error("There is no line "+(t+n.first)+" in the document.");for(i=n;!i.lines;)for(r=0;;++r){if(u=i.children[r],f=u.chunkSize(),t1&&!n.done[n.done.length-2].ranges?(n.done.pop(),h(n.done)):void 0}function up(n,t,i,r){var u=n.history,s,f,o,c;if(u.undone.length=0,s=+new Date,(u.lastOp==r||u.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.cm&&u.lastModTime>s-n.cm.options.historyEventDelay||t.origin.charAt(0)=="*"))&&(f=bd(u,u.lastOp==r)))o=h(f.changes),e(t.from,t.to)==0&&e(t.from,o.to)==0?o.to=li(t):f.changes.push(uc(n,t));else for(c=h(u.done),c&&c.ranges||yo(n.sel,u.done),f={changes:[uc(n,t)],generation:u.generation},u.done.push(f);u.done.length>u.undoDepth;)u.done.shift(),u.done[0].ranges||u.done.shift();u.done.push(i);u.generation=++u.maxGeneration;u.lastModTime=u.lastSelTime=s;u.lastOp=u.lastSelOp=r;u.lastOrigin=u.lastSelOrigin=t.origin;o||y(n,"historyAdded")}function kd(n,t,i,r){var u=t.charAt(0);return u=="*"||u=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-n.history.lastSelTime<=(n.cm?n.cm.options.historyEventDelay:500)}function dd(n,t,i,r){var u=n.history,f=r&&r.origin;i==u.lastSelOp||f&&u.lastSelOrigin==f&&(u.lastModTime==u.lastSelTime&&u.lastOrigin==f||kd(n,f,h(u.done),t))?u.done[u.done.length-1]=t:yo(t,u.done);u.lastSelTime=+new Date;u.lastSelOrigin=f;u.lastSelOp=i;r&&r.clearRedo!==!1&&rp(u.undone)}function yo(n,t){var i=h(t);i&&i.ranges&&i.equals(n)||t.push(n)}function fp(n,t,i,r){var u=t["spans_"+n.id],f=0;n.iter(Math.max(n.first,i),Math.min(n.first+n.size,r),function(i){i.markedSpans&&((u||(u=t["spans_"+n.id]={}))[f]=i.markedSpans);++f})}function gd(n){if(!n)return null;for(var i=0,t;i-1&&(h(s)[f]=r[f],delete r[f])}return o}function ep(n,t,i,r){i0}function ru(n){n.prototype.on=function(n,t){u(this,n,t)};n.prototype.off=function(n,t){bt(this,n,t)}}function kf(){this.id=null}function yp(n,t,i){for(var f,e,r=0,u=0;;){if(f=n.indexOf("\t",r),f==-1&&(f=n.length),e=f-r,f==n.length||u+e>=t)return r+Math.min(e,t-u);if(u+=f-r,u+=i-u%i,r=f+1,u>=t)return r}}function pp(n){while(df.length<=n)df.push(h(df)+" ");return df[n]}function h(n){return n[n.length-1]}function g(n,t){for(var i=0;i-1&&oc(n)?!0:t.test(n):oc(n)}function kp(n){for(var t in n)if(n.hasOwnProperty(t)&&n[t])return!1;return!0}function te(n){return n.charCodeAt(0)>=768&&dp.test(n)}function i(n,t,i,r){var u=document.createElement(n),f;if(i&&(u.className=i),r&&(u.style.cssText=r),typeof t=="string")u.appendChild(document.createTextNode(t));else if(t)for(f=0;f0;--t)n.removeChild(n.firstChild);return n}function st(n,t){return or(n).appendChild(t)}function gt(){for(var n=document.activeElement;n&&n.root&&n.root.activeElement;)n=n.root.activeElement;return n}function ie(n){return new RegExp("(^|\\s)"+n+"(?:$|\\s)\\s*")}function sc(n,t){for(var r=n.split(" "),i=0;i2&&!(s&&a<8))),r=cc?i("span","​"):i("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px"),r.setAttribute("cm-text",""),r}function fg(n){var i,t,r;return lc!=null?lc:(i=st(n,document.createTextNode("AخA")),t=er(i,0,1).getBoundingClientRect(),!t||t.left==t.right)?!1:(r=er(i,1,2).getBoundingClientRect(),lc=r.right-t.right<3)}function sg(n){if(ac!=null)return ac;var t=st(n,i("span","x")),r=t.getBoundingClientRect(),u=er(t,0,1).getBoundingClientRect();return ac=Math.abs(r.left-u.left)>1}function hg(n,t,i,r){var e,f,u;if(!n)return r(t,i,"ltr");for(e=!1,f=0;ft||t==i&&u.to==t)&&(r(Math.max(u.from,t),Math.min(u.to,i),u.level==1?"rtl":"ltr"),e=!0);e||r(t,i,"ltr")}function vc(n){return n.level%2?n.to:n.from}function yc(n){return n.level%2?n.from:n.to}function go(n){var t=at(n);return t?vc(t[0]):0}function ns(n){var t=at(n);return t?yc(h(t)):n.text.length}function iw(t,i){var e=r(t.doc,i),u=pt(e),f,o;return u!=e&&(i=c(u)),f=at(u),o=f?f[0].level%2?ns(u):go(u):0,n(i,o)}function cg(t,i){for(var e,u=r(t.doc,i),f,o;e=hf(u);)u=e.find(1,!0).line,i=null;return f=at(u),o=f?f[0].level%2?go(u):ns(u):u.text.length,n(i==null?c(u):i,o)}function rw(t,i){var u=iw(t,i.line),e=r(t.doc,u.line),o=at(e),f,s;return!o||o[0].level==0?(f=Math.max(0,e.text.search(/\S/)),s=i.line==u.line&&i.ch<=f&&i.ch,n(u.line,s?0:f)):u}function lg(n,t,i){var r=n[0].level;return t==r?!0:i==r?!1:tt)return r;if(i.from==t||i.to==t)if(u==null)u=r;else return lg(n,i.level,n[u].level)?(i.from!=i.to&&(re=u),r):(i.from!=i.to&&(re=r),u)}return u}function pc(n,t,i,r){if(!r)return t+i;do t+=i;while(t>0&&te(n.text.charAt(t)));return t}function wc(n,t,i,r){var e=at(n);if(!e)return uw(n,t,i,r);for(var o=ts(e,t),u=e[o],f=pc(n,t,u.level%2?-i:i,r);;){if(f>u.from&&f0==u.level%2?u.to:u.from);if(u=e[o+=i],!u)return null;f=i>0==u.level%2?pc(n,u.to,-1,r):pc(n,u.from,1,r)}}function uw(n,t,i,r){var u=t+i;if(r)while(u>0&&te(n.text.charAt(u)))u+=i;return u<0||u>n.text.length?null:u}var vi=/gecko\/\d/i.test(navigator.userAgent),bc=/MSIE \d/.test(navigator.userAgent),kc=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),s=bc||kc,a=s&&(bc?document.documentMode||6:kc[1]),p=/WebKit\//.test(navigator.userAgent),ew=p&&/Qt\/\d+\.\d+/.test(navigator.userAgent),ow=/Chrome\//.test(navigator.userAgent),ht=/Opera\//.test(navigator.userAgent),dc=/Apple Computer/.test(navigator.vendor),sw=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),hw=/PhantomJS/.test(navigator.userAgent),sr=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),eu=sr||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),ct=sr||/Mac/.test(navigator.platform),cw=/win/i.test(navigator.platform),yi=ht&&navigator.userAgent.match(/Version\/(\d*\.\d*)/),n,e,ut,we,pi,bi,da,ge,no,ch,du,rt,lh,fv,ro,li,bv,di,wh,bh,dr,gr,so,gi,nr,kv,rf,fi,ff,ai,ef,of,cf,tu,py,wy,np,nt,tp,yf,k,hp,po,ot,df,fr,bp,oc,dp,er,ko,uu,fu,hc,nw,cc,lc,oi,re,fw;yi&&(yi=Number(yi[1]));yi&&yi>=15&&(ht=!1,p=!0);var gc=ct&&(ew||ht&&(yi==null||yi<12.11)),is=vi||s&&a>=9,nl=!1,si=!1;ss.prototype=vt({update:function(n){var i=n.scrollWidth>n.clientWidth+1,r=n.scrollHeight>n.clientHeight+1,t=n.nativeBarWidth,u,f;return r?(this.vert.style.display="block",this.vert.style.bottom=i?t+"px":"0",u=n.viewHeight-(i?t:0),this.vert.firstChild.style.height=Math.max(0,n.scrollHeight-n.clientHeight+u)+"px"):(this.vert.style.display="",this.vert.firstChild.style.height="0"),i?(this.horiz.style.display="block",this.horiz.style.right=r?t+"px":"0",this.horiz.style.left=n.barLeft+"px",f=n.viewWidth-n.barLeft-(r?t:0),this.horiz.firstChild.style.width=n.scrollWidth-n.clientWidth+f+"px"):(this.horiz.style.display="",this.horiz.firstChild.style.width="0"),!this.checkedOverlay&&n.clientHeight>0&&(t==0&&this.overlayHack(),this.checkedOverlay=!0),{right:r?t:0,bottom:i?t:0}},setScrollLeft:function(n){this.horiz.scrollLeft!=n&&(this.horiz.scrollLeft=n)},setScrollTop:function(n){this.vert.scrollTop!=n&&(this.vert.scrollTop=n)},overlayHack:function(){var i=ct&&!sw?"12px":"18px",n,t;this.horiz.style.minHeight=this.vert.style.minWidth=i;n=this;t=function(t){pf(t)!=n.vert&&pf(t)!=n.horiz&&v(n.cm,tv)(t)};u(this.vert,"mousedown",t);u(this.horiz,"mousedown",t)},clear:function(){var n=this.horiz.parentNode;n.removeChild(this.horiz);n.removeChild(this.vert)}},ss.prototype);hs.prototype=vt({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},hs.prototype);t.scrollbarModel={"native":ss,"null":hs};fe.prototype.signal=function(n,t){et(n,t)&&this.events.push(arguments)};fe.prototype.finish=function(){for(var n=0;n=9&&t.hasSelection&&(t.hasSelection=null);t.poll()});u(r,"paste",function(n){if(pl(n,i))return!0;i.state.pasteIncoming=!0;t.fastPoll()});u(r,"cut",e);u(r,"copy",e);u(n.scroller,"paste",function(r){ui(n,r)||(i.state.pasteIncoming=!0,t.focus())});u(n.lineSpace,"selectstart",function(t){ui(n,t)||k(t)});u(r,"compositionstart",function(){var n=i.getCursor("from");t.composing={start:n,range:i.markText(n,i.getCursor("to"),{className:"CodeMirror-composing"})}});u(r,"compositionend",function(){t.composing&&(t.poll(),t.composing.range.clear(),t.composing=null)})},prepareSelection:function(){var n=this.cm,t=n.display,e=n.doc,i=oa(n);if(n.options.moveInputWithCursor){var r=ii(n,e.sel.primary().head,"div"),u=t.wrapper.getBoundingClientRect(),f=t.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,r.top+f.top-u.top));i.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,r.left+f.left-u.left))}return i},showSelection:function(n){var i=this.cm,t=i.display;st(t.cursorDiv,n.cursors);st(t.selectionDiv,n.selection);n.teTop!=null&&(this.wrapper.style.top=n.teTop+"px",this.wrapper.style.left=n.teLeft+"px")},reset:function(n){var i,f,t,e,r,u;this.contextMenuPending||(t=this.cm,e=t.doc,t.somethingSelected()?(this.prevInput="",r=e.sel.primary(),i=tw&&(r.to().line-r.from().line>100||(f=t.getSelection()).length>1e3),u=i?"-":f||t.getSelection(),this.textarea.value=u,t.state.focused&&fr(this.textarea),s&&a>=9&&(this.hasSelection=u)):n||(this.prevInput=this.textarea.value="",s&&a>=9&&(this.hasSelection=null)),this.inaccurateSelection=i)},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if(this.cm.options.readOnly!="nocursor"&&(!eu||gt()!=this.textarea))try{this.textarea.focus()}catch(n){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var n=this;n.pollingFast||n.polling.set(this.cm.options.pollInterval,function(){n.poll();n.cm.state.focused&&n.slowPoll()})},fastPoll:function(){function i(){var r=n.poll();r||t?(n.pollingFast=!1,n.slowPoll()):(t=!0,n.polling.set(60,i))}var t=!1,n=this;n.pollingFast=!0;n.polling.set(20,i)},poll:function(){var n=this.cm,f=this.textarea,r=this.prevInput,t,e,u,o,i;if(this.contextMenuPending||!n.state.focused||og(f)&&!r&&!this.composing||he(n)||n.options.disableInput||n.state.keySeq||(t=f.value,t==r&&!n.somethingSelected()))return!1;if(s&&a>=9&&this.hasSelection===t||ct&&/[\uf700-\uf7ff]/.test(t))return n.display.input.reset(),!1;if(n.doc.sel==n.display.selForContextMenu&&(e=t.charCodeAt(0),e!=8203||r||(r="​"),e==8666))return this.reset(),this.cm.execCommand("undo");for(u=0,o=Math.min(r.length,t.length);u1e3||t.indexOf("\n")>-1?f.value=i.prevInput="":i.prevInput=t;i.composing&&(i.composing.range.clear(),i.composing.range=n.markText(i.composing.start,n.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){s&&a>=9&&(this.hasSelection=null);this.fastPoll()},onContextMenu:function(n){function y(){if(i.selectionStart!=null){var n=t.somethingSelected(),u="​"+(n?i.value:"");i.value="⇚";i.value=u;f.prevInput=n?"":"​";i.selectionStart=1;i.selectionEnd=u.length;r.selForContextMenu=t.doc.sel}}function b(){if(f.contextMenuPending=!1,f.wrapper.style.position="relative",i.style.cssText=c,s&&a<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=k),i.selectionStart!=null){(!s||s&&a<9)&&y();var u=0,n=function(){r.selForContextMenu==t.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&f.prevInput=="​"?v(t,rf.selectAll)(t):u++<10?r.detectingSelectAll=setTimeout(n,500):r.input.reset()};r.detectingSelectAll=setTimeout(n,200)}}var f=this,t=f.cm,r=t.display,i=f.textarea,e=vr(t,n),k=r.scroller.scrollTop,h,c,l,o;e&&!ht&&(h=t.options.resetSelectionOnContextMenu,h&&t.doc.sel.contains(e)==-1&&v(t,w)(t.doc,ti(e),dt),c=i.style.cssText,f.wrapper.style.position="absolute",i.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(n.clientY-5)+"px; left: "+(n.clientX-5)+"px; z-index: 1000; background: "+(s?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",p&&(l=window.scrollY),r.input.focus(),p&&window.scrollTo(null,l),r.input.reset(),t.somethingSelected()||(i.value=f.prevInput=" "),f.contextMenuPending=!0,r.selForContextMenu=t.doc.sel,clearTimeout(r.detectingSelectAll),s&&a>=9&&y(),is?(po(n),o=function(){bt(window,"mouseup",o);setTimeout(b,20)},u(window,"mouseup",o)):setTimeout(b,50))},setUneditable:gf,needsContentAttribute:!1},gs.prototype);nh.prototype=vt({init:function(t){function e(n){var r,t,u,f;if(i.somethingSelected())ut=i.getSelections(),n.type=="cut"&&i.replaceSelection("",null,"cut");else if(i.options.lineWiseCopyCut)r=bl(i),ut=r.text,n.type=="cut"&&i.operation(function(){i.setSelections(r.ranges,0,dt);i.replaceSelection("",null,"cut")});else return;n.clipboardData&&!sr?(n.preventDefault(),n.clipboardData.clearData(),n.clipboardData.setData("text/plain",ut.join("\n"))):(t=dl(),u=t.firstChild,i.display.lineSpace.insertBefore(t,i.display.lineSpace.firstChild),u.value=ut.join("\n"),f=document.activeElement,fr(u),setTimeout(function(){i.display.lineSpace.removeChild(t);f.focus()},50))}var r=this,i=r.cm,f=r.div=t.lineDiv;f.contentEditable="true";kl(f);u(f,"paste",function(n){pl(n,i)});u(f,"compositionstart",function(t){var u=t.data;if(r.composing={sel:i.doc.sel,data:u,startData:u},u){var f=i.doc.sel.primary(),o=i.getLine(f.head.line),e=o.indexOf(u,Math.max(0,f.head.ch-u.length));e>-1&&e<=f.head.ch&&(r.composing.sel=ti(n(f.head.line,e),n(f.head.line,e+u.length)))}});u(f,"compositionupdate",function(n){r.composing.data=n.data});u(f,"compositionend",function(n){var t=r.composing;t&&(n.data==t.startData||/\u200b/.test(n.data)||(t.data=n.data),setTimeout(function(){t.handled||r.applyComposition(t);r.composing==t&&(r.composing=null)},50))});u(f,"touchstart",function(){r.forceCompositionEnd()});u(f,"input",function(){r.composing||r.pollContent()||ft(r.cm,function(){it(i)})});u(f,"copy",e);u(f,"cut",e)},prepareSelection:function(){var n=oa(this.cm,!1);return n.focus=this.cm.state.focused,n},showSelection:function(n){n&&this.cm.display.view.length&&(n.focus&&this.showPrimarySelection(),this.showMultipleSelections(n))},showPrimarySelection:function(){var n=window.getSelection(),f=this.cm.doc.sel.primary(),o=le(this.cm,n.anchorNode,n.anchorOffset),s=le(this.cm,n.focusNode,n.focusOffset),i,r,h,c,u,t,l;if((!o||o.bad||!s||s.bad||e(se(o,s),f.from())!=0||e(oe(o,s),f.to())!=0)&&(i=gl(this.cm,f.from()),r=gl(this.cm,f.to()),i||r)){h=this.cm.display.view;c=n.rangeCount&&n.getRangeAt(0);i?r||(u=h[h.length-1].measure,t=u.maps?u.maps[u.maps.length-1]:u.map,r={node:t[t.length-1],offset:t[t.length-2]-t[t.length-3]}):i={node:h[0].measure.map[2],offset:0};try{l=er(i.node,i.offset,r.offset,r.node)}catch(a){}l&&(n.removeAllRanges(),n.addRange(l),c&&n.anchorNode==null?n.addRange(c):vi&&this.startGracePeriod());this.rememberSelection()}},startGracePeriod:function(){var n=this;clearTimeout(this.gracePeriod);this.gracePeriod=setTimeout(function(){n.gracePeriod=!1;n.selectionChanged()&&n.cm.operation(function(){n.cm.curOp.selectionChanged=!0})},20)},showMultipleSelections:function(n){st(this.cm.display.cursorDiv,n.cursors);st(this.cm.display.selectionDiv,n.selection)},rememberSelection:function(){var n=window.getSelection();this.lastAnchorNode=n.anchorNode;this.lastAnchorOffset=n.anchorOffset;this.lastFocusNode=n.focusNode;this.lastFocusOffset=n.focusOffset},selectionInEditor:function(){var n=window.getSelection(),t;return n.rangeCount?(t=n.getRangeAt(0).commonAncestorContainer,ko(this.div,t)):!1},focus:function(){this.cm.options.readOnly!="nocursor"&&this.div.focus()},blur:function(){this.div.blur()},getField:function(){return this.div},supportsTouch:function(){return!0},receivedFocus:function(){function t(){n.cm.state.focused&&(n.pollSelection(),n.polling.set(n.cm.options.pollInterval,t))}var n=this;this.selectionInEditor()?this.pollSelection():ft(this.cm,function(){n.cm.curOp.selectionChanged=!0});this.polling.set(this.cm.options.pollInterval,t)},selectionChanged:function(){var n=window.getSelection();return n.anchorNode!=this.lastAnchorNode||n.anchorOffset!=this.lastAnchorOffset||n.focusNode!=this.lastFocusNode||n.focusOffset!=this.lastFocusOffset},pollSelection:function(){var t,n,i,r;this.composing||this.gracePeriod||!this.selectionChanged()||(t=window.getSelection(),n=this.cm,this.rememberSelection(),i=le(n,t.anchorNode,t.anchorOffset),r=le(n,t.focusNode,t.focusOffset),i&&r&&ft(n,function(){w(n.doc,ti(i,r),dt);(i.bad||r.bad)&&(n.curOp.selectionChanged=!0)}))},pollContent:function(){var f=this.cm,i=f.display,tt=f.doc.sel.primary(),b=tt.from(),it=tt.to(),k,l,y,p,o,w,t,u,g,nt;if(b.linei.viewTo-1)return!1;for(b.line==i.viewFrom||(k=ki(f,b.line))==0?(l=c(i.view[0].line),y=i.view[0].node):(l=c(i.view[k].line),y=i.view[k-1].node.nextSibling),p=ki(f,it.line),p==i.view.length-1?(o=i.viewTo-1,w=i.lineDiv.lastChild):(o=c(i.view[p+1].line)-1,w=i.view[p+1].node.previousSibling),t=f.doc.splitLines(nb(f,y,w,l,o)),u=rr(f.doc,n(l,0),n(o,r(f.doc,o).text.length));t.length>1&&u.length>1;)if(h(t)==h(u))t.pop(),u.pop(),o--;else if(t[0]==u[0])t.shift(),u.shift(),l++;else break;for(var s=0,a=0,rt=t[0],ut=u[0],ft=Math.min(rt.length,ut.length);s1||t[0]||e(g,nt)?(wr(f.doc,t,g,nt,"+input"),!0):void 0},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){this.composing&&!this.composing.handled&&(this.applyComposition(this.composing),this.composing.handled=!0,this.div.blur(),this.div.focus())},applyComposition:function(n){n.data&&n.data!=n.startData&&v(this.cm,ce)(this.cm,n.data,0,n.sel)},setUneditable:function(n){n.setAttribute("contenteditable","false")},onKeyPress:function(n){n.preventDefault();v(this.cm,ce)(this.cm,String.fromCharCode(n.charCode==null?n.keyCode:n.charCode),0)},onContextMenu:gf,resetPosition:gf,needsContentAttribute:!0},nh.prototype);t.inputStyles={textarea:gs,contenteditable:nh};ni.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(n){var t,i,r;if(n==this)return!0;if(n.primIndex!=this.primIndex||n.ranges.length!=this.ranges.length)return!1;for(t=0;t=0&&e(n,r.to())<=0)return i;return-1}};l.prototype={from:function(){return se(this.anchor,this.head)},to:function(){return oe(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};we={left:0,right:0,top:0,bottom:0};bi=null;da=0;ch=0;du=0;rt=null;s?rt=-.53:vi?rt=15:ow?rt=-.7:dc&&(rt=-1/3);lh=function(n){var i=n.wheelDeltaX,t=n.wheelDeltaY;return i==null&&n.detail&&n.axis==n.HORIZONTAL_AXIS&&(i=n.detail),t==null&&n.detail&&n.axis==n.VERTICAL_AXIS?t=n.detail:t==null&&(t=n.wheelDelta),{x:i,y:t}};t.wheelEventPixels=function(n){var t=lh(n);return t.x*=rt,t.y*=rt,t};fv=new kf;ro=null;li=t.changeEnd=function(t){return t.text?n(t.from.line+t.text.length-1,h(t.text).length+(t.text.length==1?t.from.ch:0)):t.to};t.prototype={constructor:t,focus:function(){window.focus();this.display.input.focus()},setOption:function(n,t){var i=this.options,r=i[n];(i[n]!=t||n=="mode")&&(i[n]=t,di.hasOwnProperty(n)&&v(this,di[n])(this,t,r))},getOption:function(n){return this.options[n]},getDoc:function(){return this.doc},addKeyMap:function(n,t){this.state.keyMaps[t?"push":"unshift"](ho(n))},removeKeyMap:function(n){for(var i=this.state.keyMaps,t=0;tr&&(tf(this,i.head.line,n,!0),r=i.head.line,t==this.doc.sel.primIndex&&br(this));else{var o=i.from(),s=i.to(),h=Math.max(r,o.line);for(r=Math.min(this.lastLine(),s.line-(s.ch?0:1))+1,u=h;u0&&th(this.doc,t,new l(o,f[t].to()),dt)}}),getTokenAt:function(n,t){return ly(this,n,t)},getLineTokens:function(t,i){return ly(this,n(t),i,!0)},getTokenTypeAt:function(n){var t,f;n=o(this.doc,n);var u=yy(this,r(this.doc,n.line)),s=0,h=(u.length-1)/2,e=n.ch,i;if(e==0)i=u[2];else for(;;)if(t=s+h>>1,(t?u[t*2-1]:0)>=e)h=t;else if(u[t*2+1]u&&(n=u,f=!0),i=r(this.doc,n)):i=n,oh(this,i,{top:0,left:0},t||"page").top+(f?this.doc.height-ei(i):0)},defaultTextHeight:function(){return wi(this.display)},defaultCharWidth:function(){return bu(this.display)},setGutterMarker:b(function(n,t,i){return oo(this.doc,n,"gutter",function(n){var r=n.gutterMarkers||(n.gutterMarkers={});return r[t]=i,!i&&kp(r)&&(n.gutterMarkers=null),!0})}),clearGutter:b(function(n){var t=this,i=t.doc,r=i.first;i.iter(function(i){i.gutterMarkers&&i.gutterMarkers[n]&&(i.gutterMarkers[n]=null,ri(t,r,"gutter"),kp(i.gutterMarkers)&&(i.gutterMarkers=null));++r})}),lineInfo:function(n){var t;if(typeof n=="number"){if(!lu(this.doc,n)||(t=n,n=r(this.doc,n),!n))return null}else if(t=c(n),t==null)return null;return{line:t,handle:n,text:n.text,gutterMarkers:n.gutterMarkers,textClass:n.textClass,bgClass:n.bgClass,wrapClass:n.wrapClass,widgets:n.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(n,t,i,r,u){var s=this.display,e,f,h,c;n=ii(this,o(this.doc,n));e=n.bottom;f=n.left;t.style.position="absolute";t.setAttribute("cm-ignore-events","true");this.display.input.setUneditable(t);s.sizer.appendChild(t);r=="over"?e=n.top:(r=="above"||r=="near")&&(h=Math.max(s.wrapper.clientHeight,this.doc.height),c=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth),(r=="above"||n.bottom+t.offsetHeight>h)&&n.top>t.offsetHeight?e=n.top-t.offsetHeight:n.bottom+t.offsetHeight<=h&&(e=n.bottom),f+t.offsetWidth>c&&(f=c-t.offsetWidth));t.style.top=e+"px";t.style.left=t.style.right="";u=="right"?(f=s.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):(u=="left"?f=0:u=="middle"&&(f=(s.sizer.clientWidth-t.offsetWidth)/2),t.style.left=f+"px");i&&bk(this,f,e,f+t.offsetWidth,e+t.offsetHeight)},triggerOnKeyDown:b(ov),triggerOnKeyPress:b(hv),triggerOnKeyUp:sv,execCommand:function(n){if(rf.hasOwnProperty(n))return rf[n](this)},triggerElectric:b(function(n){wl(this,n)}),findPosH:function(n,t,i,r){var e=1,f,u;for(t<0&&(e=-1,t=-t),f=0,u=o(this.doc,n);f0&&s(u.charAt(i-1));)--i;while(f.5)&&us(this);y(this,"refresh",this)}),swapDoc:b(function(n){var t=this.doc;return t.cm=null,ip(this,n),wu(this),this.display.input.reset(),this.scrollTo(n.scrollLeft,n.scrollTop),this.curOp.forceScroll=!0,tt(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}};ru(t);bv=t.defaults={};di=t.optionHandlers={};wh=t.Init={toString:function(){return"CodeMirror.Init"}};f("value","",function(n,t){n.setValue(t)},!0);f("mode",null,function(n,t){n.doc.modeOption=t;rs(n)},!0);f("indentUnit",2,rs,!0);f("indentWithTabs",!1);f("smartIndent",!0);f("tabSize",4,function(n){ou(n);wu(n);it(n)},!0);f("lineSeparator",null,function(t,i){var r,f,u;if(t.doc.lineSep=i,i)for(r=[],f=t.doc.first,t.doc.iter(function(t){for(var u,e=0;;){if(u=t.text.indexOf(i,e),u==-1)break;e=u+i.length;r.push(n(f,u))}f++}),u=r.length-1;u>=0;u--)wr(t.doc,i,r[u],n(r[u].line,r[u].ch+i.length))});f("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(n,i,r){n.state.specialChars=new RegExp(i.source+(i.test("\t")?"":"|\t"),"g");r!=t.Init&&n.refresh()});f("specialCharPlaceholder",ad,function(n){n.refresh()},!0);f("electricChars",!0);f("inputStyle",eu?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor");},!0);f("rtlMoveVisually",!cw);f("wholeLineUpdateBefore",!0);f("theme","default",function(n){il(n);su(n)},!0);f("keyMap","default",function(n,i,r){var f=ho(i),u=r!=t.Init&&ho(r);u&&u.detach&&u.detach(n,f);f.attach&&f.attach(n,u||null)});f("extraKeys",null);f("lineWrapping",!1,aw,!0);f("gutters",[],function(n){os(n.options);su(n)},!0);f("fixedGutter",!0,function(n,t){n.display.gutters.style.left=t?vs(n.display)+"px":"0";n.refresh()},!0);f("coverGutterNextToScrollbar",!1,function(n){hr(n)},!0);f("scrollbarStyle","native",function(n){ul(n);hr(n);n.display.scrollbars.setScrollTop(n.doc.scrollTop);n.display.scrollbars.setScrollLeft(n.doc.scrollLeft)},!0);f("lineNumbers",!1,function(n){os(n.options);su(n)},!0);f("firstLineNumber",1,su,!0);f("lineNumberFormatter",function(n){return n},su,!0);f("showCursorWhenSelecting",!1,vu,!0);f("resetSelectionOnContextMenu",!0);f("lineWiseCopyCut",!0);f("readOnly",!1,function(n,t){t=="nocursor"?(gu(n),n.display.input.blur(),n.display.disabled=!0):(n.display.disabled=!1,t||n.display.input.reset())});f("disableInput",!1,function(n,t){t||n.display.input.reset()},!0);f("dragDrop",!0,tk);f("cursorBlinkRate",530);f("cursorScrollMargin",0);f("cursorHeight",1,vu,!0);f("singleCursorHeightPerLine",!0,vu,!0);f("workTime",100);f("workDelay",100);f("flattenSpans",!0,ou,!0);f("addModeClass",!1,ou,!0);f("pollInterval",100);f("undoDepth",200,function(n,t){n.doc.history.undoDepth=t});f("historyEventDelay",1250);f("viewportMargin",10,function(n){n.refresh()},!0);f("maxHighlightLength",1e4,ou,!0);f("moveInputWithCursor",!0,function(n,t){t||n.display.input.resetPosition()});f("tabindex",null,function(n,t){n.display.input.getField().tabIndex=t||""});f("autofocus",null);bh=t.modes={};dr=t.mimeModes={};t.defineMode=function(n,i){t.defaults.mode||n=="null"||(t.defaults.mode=n);arguments.length>2&&(i.dependencies=Array.prototype.slice.call(arguments,2));bh[n]=i};t.defineMIME=function(n,t){dr[n]=t};t.resolveMode=function(n){if(typeof n=="string"&&dr.hasOwnProperty(n))n=dr[n];else if(n&&typeof n.name=="string"&&dr.hasOwnProperty(n.name)){var i=dr[n.name];typeof i=="string"&&(i={name:i});n=wp(i,n);n.name=i.name}else if(typeof n=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(n))return t.resolveMode("application/xml");return typeof n=="string"?{name:n}:n||{name:"null"}};t.getMode=function(n,i){var i=t.resolveMode(i),e=bh[i.name],u,f,r;if(!e)return t.getMode(n,"text/plain");if(u=e(n,i),gr.hasOwnProperty(i.name)){f=gr[i.name];for(r in f)f.hasOwnProperty(r)&&(u.hasOwnProperty(r)&&(u["_"+r]=u[r]),u[r]=f[r])}if(u.name=i.name,i.helperType&&(u.helperType=i.helperType),i.modeProps)for(r in i.modeProps)u[r]=i.modeProps[r];return u};t.defineMode("null",function(){return{token:function(n){n.skipToEnd()}}});t.defineMIME("text/plain","null");gr=t.modeExtensions={};t.extendMode=function(n,t){var i=gr.hasOwnProperty(n)?gr[n]:gr[n]={};vt(t,i)};t.defineExtension=function(n,i){t.prototype[n]=i};t.defineDocExtension=function(n,t){nt.prototype[n]=t};t.defineOption=f;so=[];t.defineInitHook=function(n){so.push(n)};gi=t.helpers={};t.registerHelper=function(n,i,r){gi.hasOwnProperty(n)||(gi[n]=t[n]={_global:[]});gi[n][i]=r};t.registerGlobalHelper=function(n,i,r,u){t.registerHelper(n,i,u);gi[n]._global.push({pred:r,val:u})};nr=t.copyState=function(n,t){var r,u,i;if(t===!0)return t;if(n.copyState)return n.copyState(t);r={};for(u in t)i=t[u],i instanceof Array&&(i=i.concat([])),r[u]=i;return r};kv=t.startState=function(n,t,i){return n.startState?n.startState(t,i):!0};t.innerMode=function(n,t){while(n.innerMode){var i=n.innerMode(t);if(!i||i.mode==n)break;t=i.state;n=i.mode}return i||{mode:n,state:t}};rf=t.commands={selectAll:function(t){t.setSelection(n(t.firstLine(),0),n(t.lastLine()),dt)},singleSelection:function(n){n.setSelection(n.getCursor("anchor"),n.getCursor("head"),dt)},killLine:function(t){kr(t,function(i){if(i.empty()){var u=r(t.doc,i.head.line).text.length;return i.head.ch==u&&i.head.line0?(i=new n(i.line,i.ch+1),t.replaceRange(u.charAt(i.ch-1)+u.charAt(i.ch-2),n(i.line,i.ch-2),i,"+transpose")):i.line>t.doc.first&&(f=r(t.doc,i.line-1).text,f&&t.replaceRange(u.charAt(0)+t.doc.lineSeparator()+f.charAt(f.length-1),n(i.line-1,f.length-1),n(i.line,1),"+transpose"))),s.push(new l(i,i));t.setSelections(s)})},newlineAndIndent:function(n){ft(n,function(){for(var r=n.listSelections().length,i,t=0;t=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||undefined},next:function(){if(this.post},eatSpace:function(){for(var n=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>n},skipToEnd:function(){this.pos=this.string.length},skipTo:function(n){var t=this.string.indexOf(n,this.pos);if(t>-1)return this.pos=t,!0},backUp:function(n){this.pos-=n},column:function(){return this.lastColumnPos0)?null:(r&&t!==!1&&(this.pos+=r[0].length),r)},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(n,t){this.lineStart+=n;try{return t()}finally{this.lineStart-=n}}};ef=0;ai=t.TextMarker=function(n,t){this.lines=[];this.type=t;this.doc=n;this.id=++ef};ru(ai);ai.prototype.clear=function(){var n,e,u,f,o,i,r,t,s,h;if(!this.explicitlyCleared){for(n=this.doc.cm,e=n&&!n.curOp,e&&lr(n),et(this,"clear")&&(u=this.find(),u&&tt(this,"clear",u.from,u.to)),f=null,o=null,t=0;tn.display.maxLineLength&&(n.display.maxLine=s,n.display.maxLineLength=h,n.display.maxLineChanged=!0);f!=null&&n&&this.collapsed&&it(n,f,o+1);this.lines.length=0;this.explicitlyCleared=!0;this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,n&&fa(n.doc));n&&tt(n,"markerCleared",n,this);e&&ar(n);this.parent&&this.parent.clear()}};ai.prototype.find=function(t,i){var f,o,e,r,u;for(t==null&&this.type=="bookmark"&&(t=1),e=0;e1||!(this.children[0]instanceof af))&&(e=[],this.collapse(e),this.children=[new af(e)],this.children[0].parent=this)},collapse:function(n){for(var t=0;t50){while(r.lines.length>50)o=r.lines.splice(r.lines.length-25,25),f=new af(o),r.height-=f.height,this.children.splice(u+1,0,f),f.parent=this;this.maybeSpill()}break}n-=e}},maybeSpill:function(){var n,r,t,i,u;if(!(this.children.length<=10)){n=this;do r=n.children.splice(n.children.length-5,5),t=new vf(r),n.parent?(n.size-=t.size,n.height-=t.height,u=g(n.parent.children,n),n.parent.children.splice(u+1,0,t)):(i=new vf(n.children),i.parent=n,n.children=[i,t],n=i),t.parent=n.parent;while(n.children.length>10);n.parent.maybeSpill()}},iterN:function(n,t,i){for(var f,u,e,r=0;r=0;r--)pr(this,u[r]);e?ra(this,e):this.cm&&br(this.cm)}),undo:d(function(){uo(this,"undo")}),redo:d(function(){uo(this,"redo")}),undoSelection:d(function(){uo(this,"undo",!0)}),redoSelection:d(function(){uo(this,"redo",!0)}),setExtending:function(n){this.extend=n},getExtending:function(){return this.extend},historySize:function(){for(var t=this.history,i=0,r=0,n=0;n=n.ch)&&f.push(t.marker.parent||t.marker);return f},findMarks:function(n,t,i){n=o(this,n);t=o(this,t);var u=[],r=n.line;return this.iter(n.line,t.line+1,function(f){var s=f.markedSpans,o,e;if(s)for(o=0;oe.to||e.from==null&&r!=n.line||r==t.line&&e.from>t.ch||i&&!i(e.marker)||u.push(e.marker.parent||e.marker);++r}),u},getAllMarks:function(){var n=[];return this.iter(function(t){var r=t.markedSpans,i;if(r)for(i=0;it)return i=t,!0;t-=u;++r}),o(this,n(r,i))},indexFromPos:function(n){n=o(this,n);var t=n.ch;return n.linei&&(i=n.from),n.to!=null&&n.to=t)return e+(t-f);e+=o-f;e+=i-e%i;f=o+1}};df=[""];fr=function(n){n.select()};sr?fr=function(n){n.selectionStart=0;n.selectionEnd=n.value.length}:s&&(fr=function(n){try{n.select()}catch(t){}});bp=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;oc=t.isWordChar=function(n){return/\w/.test(n)||n>"€"&&(n.toUpperCase()!=n.toLowerCase()||bp.test(n))};dp=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;er=document.createRange?function(n,t,i,r){var u=document.createRange();return u.setEnd(r||n,i),u.setStart(n,t),u}:function(n,t,i){var r=document.body.createTextRange();try{r.moveToElementText(n.parentNode)}catch(u){return r}return r.collapse(!0),r.moveEnd("character",i),r.moveStart("character",t),r};ko=t.contains=function(n,t){if(t.nodeType==3&&(t=t.parentNode),n.contains)return n.contains(t);do if(t.nodeType==11&&(t=t.host),t==n)return!0;while(t=t.parentNode)};s&&a<11&&(gt=function(){try{return document.activeElement}catch(n){return document.body}});uu=t.rmClass=function(n,t){var r=n.className,i=ie(t).exec(r),u;i&&(u=r.slice(i.index+i[0].length),n.className=r.slice(0,i.index)+(u?i[1]+u:""))};fu=t.addClass=function(n,t){var i=n.className;ie(t).test(i)||(n.className+=(i?" ":"")+t)};hc=!1;nw=function(){if(s&&a<9)return!1;var n=i("div");return"draggable"in n||"dragDrop"in n}();var eg=t.splitLines="\n\nb".split(/\n/).length!=3?function(n){for(var i=0,f=[],e=n.length,t,r,u;i<=e;)t=n.indexOf("\n",i),t==-1&&(t=n.length),r=n.slice(i,n.charAt(t-1)=="\r"?t-1:t),u=r.indexOf("\r"),u!=-1?(f.push(r.slice(0,u)),i+=u+1):(f.push(r),i=t+1);return f}:function(n){return n.split(/\r\n?|\n/)},og=window.getSelection?function(n){try{return n.selectionStart!=n.selectionEnd}catch(t){return!1}}:function(n){try{var t=n.ownerDocument.selection.createRange()}catch(i){}return!t||t.parentElement()!=n?!1:t.compareEndPoints("StartToEnd",t)!=0},tw=function(){var n=i("div");return"oncopy"in n?!0:(n.setAttribute("oncopy","return;"),typeof n.oncopy=="function")}(),ac=null;return oi={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",107:"=",109:"-",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},t.keyNames=oi,function(){for(var n=0;n<10;n++)oi[n+48]=oi[n+96]=String(n);for(n=65;n<=90;n++)oi[n]=String.fromCharCode(n);for(n=1;n<=12;n++)oi[n+111]=oi[n+63235]="F"+n}(),fw=function(){function s(n){return n<=247?e.charAt(n):1424<=n&&n<=1524?"R":1536<=n&&n<=1773?o.charAt(n-1536):1774<=n&&n<=2220?"r":8192<=n&&n<=8203?"w":n==8204?"b":"L"}function n(n,t,i){this.level=n;this.from=t;this.to=i}var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",o="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",c=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,r=/[LRr]/,u=/[Lb1n]/,f=/[1n]/,t="L";return function(e){var p,l,b,nt,k,a,w,y,g,o,it,d,tt,v,rt;if(!c.test(e))return!1;for(p=e.length,l=[],o=0;o

!?|\/]/,r;return{startState:function(n){return{tokenize:null,context:new v((n||0)-e,0,"top",!1),indented:0,startOfLine:!0}},token:function(n,t){var i=t.context,e;if(n.sol()&&(i.align==null&&(i.align=!1),t.indented=n.indentation(),t.startOfLine=!0),n.eatSpace())return null;if(r=null,e=(t.tokenize||l)(n,t),e=="comment"||e=="meta")return e;if(i.align==null&&(i.align=!0),(r==";"||r==":"||r==",")&&i.type=="statement")u(t);else if(r=="{")f(t,n.column(),"}");else if(r=="[")f(t,n.column(),"]");else if(r=="(")f(t,n.column(),")");else if(r=="}"){while(i.type=="statement")i=u(t);for(i.type=="}"&&(i=u(t));i.type=="statement";)i=u(t)}else r==i.type?u(t):d&&((i.type=="}"||i.type=="top")&&r!=";"||i.type=="statement"&&r=="newstatement")&&f(t,n.column(),"statement");return t.startOfLine=!1,e},indent:function(t,i){var r,u,f;return t.tokenize!=l&&t.tokenize!=null?n.Pass:(r=t.context,u=i&&i.charAt(0),r.type=="statement"&&u=="}"&&(r=r.prev),f=u==r.type,r.type=="statement"?r.indented+(u=="{"?0:o):r.align&&(!y||r.type!=")")?r.column+(f?0:1):r.type!=")"||f?r.indented+(f?0:e):r.indented+o)},electricChars:"{}",blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",fold:"brace"}});var f="auto if break int case long char register continue return default short do sizeof double static else struct entry switch extern typedef float union for unsigned goto while enum void const signed volatile";i(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:t(f),blockKeywords:t("case do else for if switch while struct"),atoms:t("null"),hooks:{"#":r},modeProps:{fold:["brace","include"]}});i(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:t(f+" asm dynamic_cast namespace reinterpret_cast try bool explicit new static_cast typeid catch operator template typename class friend private this using const_cast inline public throw virtual delete mutable protected wchar_t alignas alignof constexpr decltype nullptr noexcept thread_local final static_assert override"),blockKeywords:t("catch class do else finally for if struct switch try while"),atoms:t("true false null"),hooks:{"#":r,u:u,U:u,L:u,R:u},modeProps:{fold:["brace","include"]}});i("text/x-java",{name:"clike",keywords:t("abstract assert boolean break byte case catch char class const continue default do double else enum extends final finally float for goto if implements import instanceof int interface long native new package private protected public return short static strictfp super switch synchronized this throw throws transient try void volatile while"),blockKeywords:t("catch class do else finally for if switch try while"),atoms:t("true false null"),hooks:{"@":function(n){return n.eatWhile(/[\w\$_]/),"meta"}},modeProps:{fold:["brace","import"]}});i("text/x-csharp",{name:"clike",keywords:t("abstract as base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in interface internal is lock namespace new operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),blockKeywords:t("catch class do else finally for foreach if struct switch try while"),builtin:t("Boolean Byte Char DateTime DateTimeOffset Decimal Double Guid Int16 Int32 Int64 Object SByte Single String TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),atoms:t("true false null"),hooks:{"@":function(n,t){return n.eat('"')?(t.tokenize=e,e(n,t)):(n.eatWhile(/[\w\$_]/),"meta")}}});i("text/x-scala",{name:"clike",keywords:t("abstract case catch class def do else extends false final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try trye type val var while with yield _ : = => : # @ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector :: #:: Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),multiLineStrings:!0,blockKeywords:t("catch class do else finally for forSome if match switch try while"),atoms:t("true false null"),indentStatements:!1,hooks:{"@":function(n){return n.eatWhile(/[\w\$_]/),"meta"},'"':function(n,t){return n.match('""')?(t.tokenize=s,t.tokenize(n,t)):!1}}});i(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:t("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4 sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadowconst attribute uniform varying break continue discard return for while do if else struct in out inout"),blockKeywords:t("for while do if else struct"),builtin:t("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smootstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:t("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragColor gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TexureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),hooks:{"#":r},modeProps:{fold:["brace","include"]}});i("text/x-nesc",{name:"clike",keywords:t(f+"as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),blockKeywords:t("case do else for if switch while struct"),atoms:t("null"),hooks:{"#":r},modeProps:{fold:["brace","include"]}})}),function(n){typeof exports=="object"&&typeof module=="object"?n(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],n):n(CodeMirror)}(function(n){"use strict";function r(n,t){this.cm=n;this.options=this.buildOptions(t);this.widget=null;this.debounce=0;this.tick=0;this.startPos=this.cm.getCursor();this.startLen=this.cm.getLine(this.startPos.line).length;var i=this;n.on("cursorActivity",this.activityFunc=function(){i.cursorActivity()})}function e(n){return typeof n=="string"?n:n.text}function c(n,t){function o(n,i){var r;r=typeof i!="string"?function(n){return i(n,t)}:f.hasOwnProperty(i)?f[i]:i;e[n]=r}var f={Up:function(){t.moveFocus(-1)},Down:function(){t.moveFocus(1)},PageUp:function(){t.moveFocus(-t.menuSize()+1,!0)},PageDown:function(){t.moveFocus(t.menuSize()-1,!0)},Home:function(){t.setFocus(0)},End:function(){t.setFocus(t.length-1)},Enter:t.pick,Tab:t.pick,Esc:t.close},r=n.options.customKeys,e=r?{}:f,u,i;if(r)for(i in r)r.hasOwnProperty(i)&&o(i,r[i]);if(u=n.options.extraKeys,u)for(i in u)u.hasOwnProperty(i)&&o(i,u[i]);return e}function o(n,t){while(t&&t!=n){if(t.nodeName.toUpperCase()==="LI"&&t.parentNode==n)return t;t=t.parentNode}}function s(i,r){var p,y,w,g,f,et,nt,ot,rt,tt,st,ut;this.completion=i;this.data=r;this.picked=!1;var l=this,s=i.cm,u=this.hints=document.createElement("ul");for(u.className="CodeMirror-hints",this.selectedHint=r.selectedHint||0,p=r.list,y=0;y

0&&(nt=f.bottom-f.top,ot=a.top-(a.bottom-f.top),ot-nt>0?(u.style.top=(d=a.top-nt)+"px",ft=!1):nt>g&&(u.style.height=g-5+"px",u.style.top=(d=a.bottom-f.top)+"px",rt=s.getCursor(),r.from.ch!=rt.ch&&(a=s.cursorCoords(rt),u.style.left=(k=a.left)+"px",f=u.getBoundingClientRect()))),tt=f.right-w,tt>0&&(f.right-f.left>w&&(u.style.width=w-5+"px",tt-=f.right-f.left-w),u.style.left=(k=a.left-tt)+"px"),s.addKeyMap(this.keyMap=c(i,{moveFocus:function(n,t){l.changeActive(l.selectedHint+n,t)},setFocus:function(n){l.changeActive(n)},menuSize:function(){return l.screenAmount()},length:p.length,close:function(){i.close()},pick:function(){l.pick()},data:r})),i.options.closeOnUnfocus){s.on("blur",this.onBlur=function(){st=setTimeout(function(){i.close()},100)});s.on("focus",this.onFocus=function(){clearTimeout(st)})}ut=s.getScrollInfo();s.on("scroll",this.onScroll=function(){var t=s.getScrollInfo(),r=s.getWrapperElement().getBoundingClientRect(),f=d+ut.top-t.top,n=f-(window.pageYOffset||(document.documentElement||document.body).scrollTop);if(ft||(n+=u.offsetHeight),n<=r.top||n>=r.bottom)return i.close();u.style.top=f+"px";u.style.left=k+ut.left-t.left+"px"});n.on(u,"dblclick",function(n){var t=o(u,n.target||n.srcElement);t&&t.hintId!=null&&(l.changeActive(t.hintId),l.pick())});n.on(u,"click",function(n){var t=o(u,n.target||n.srcElement);t&&t.hintId!=null&&(l.changeActive(t.hintId),i.options.completeOnSingleClick&&l.pick())});n.on(u,"mousedown",function(){setTimeout(function(){s.focus()},20)});return n.signal(r,"select",p[0],u.firstChild),!0}var h="CodeMirror-hint",t="CodeMirror-hint-active",u,f,i;n.showHint=function(n,t,i){var r,u;if(!t)return n.showHint(i);if(i&&i.async&&(t.async=!0),r={hint:t},i)for(u in i)r[u]=i[u];return n.showHint(r)};n.defineExtension("showHint",function(t){if(!(this.listSelections().length>1)&&!this.somethingSelected()){this.state.completionActive&&this.state.completionActive.close();var i=this.state.completionActive=new r(this,t);i.options.hint&&(n.signal(this,"startCompletion",this),i.update(!0))}});u=window.requestAnimationFrame||function(n){return setTimeout(n,1e3/60)};f=window.cancelAnimationFrame||clearTimeout;r.prototype={close:function(){this.active()&&(this.cm.lookupCache=null,this.cm.state.completionActive=null,this.tick=null,this.cm.off("cursorActivity",this.activityFunc),this.widget&&this.data&&n.signal(this.data,"close"),this.widget&&this.widget.close(),n.signal(this.cm,"endCompletion",this.cm))},active:function(){return this.cm.state.completionActive==this},pick:function(t,i){var r=t.list[i];r.hint?r.hint(this.cm,t,r):this.cm.replaceRange(e(r),r.from||t.from,r.to||t.to,"complete");n.signal(t,"pick",r,t);this.close()},cursorActivity:function(){var n,t,i;this.debounce&&(f(this.debounce),this.debounce=0);n=this.cm.getCursor();t=this.cm.getLine(n.line);n.line!=this.startPos.line||t.length-n.ch!=this.startLen-this.startPos.ch||n.ch=this.data.list.length?i=r?this.data.list.length-1:0:i<0&&(i=r?0:this.data.list.length-1),this.selectedHint!=i){var u=this.hints.childNodes[this.selectedHint];u.className=u.className.replace(" "+t,"");u=this.hints.childNodes[this.selectedHint=i];u.className+=" "+t;u.offsetTopthis.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=u.offsetTop+u.offsetHeight-this.hints.clientHeight+3);n.signal(this.data,"select",this.data.list[this.selectedHint],u)}},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1}};n.registerHelper("hint","auto",function(t,i){var f=t.getHelpers(t.getCursor(),"hint"),e,r,u;if(f.length){for(r=0;r,]/,closeOnUnfocus:!0,completeOnSingleClick:!1,container:null,customKeys:null,extraKeys:null};n.defineOption("hintOptions",null)}),function(){function u(n,i,r,u){var h,s;if(typeof n.lookupCache!="undefined"&&n.lookupCache!==null){var e=n.getCursor(),o=i(n,e),c=o,l=n.indexFromPos(e),f=n.lookupCache;if(f.to={line:e.line,ch:e.ch},h=[],o!=null&&o.string!=="."&&f.initial_list!=null&&f.initial_list.length>0){for(s=0;s1||n.Overloads.length==1&&n.Overloads[0].indexOf(",")>-1)&&(t.ch--,i.setCursor(t),u=i.cursorCoords(),remove(i.state.paramHintTooltip),i.state.overloads=n.Overloads,i.state.overloadIdx=0,i.state.hintTooltipStartPos={line:t.line,ch:t.ch-1},i.state.paramHintTooltip=f(i,u.right+window.pageXOffset-100,u.bottom+window.pageYOffset,n.Overloads)))}});if(i.state.keyHandlerAdded==undefined)CodeMirror.on(i,"keydown",function(t,r){i.state.overloads!=undefined&&i.state.overloads!=null&&((r.keyCode==38||r.keyCode==40)&&(n(i,r.keyCode==38?-1:1),r.preventDefault()),r.keyCode==27&&remove(i.state.paramHintTooltip))});i.state.keyHandlerAdded=!0;i.on("cursorActivity",function(){var t,r,n,u;if(i.state.paramHintTooltip!=null)for(curPos=i.getCursor(),strtPos=i.state.hintTooltipStartPos,t=i.getRange(strtPos,curPos),(strtPos.line>curPos.line||strtPos.length==curPos.length&&strtPos.ch>=curPos.ch)&&(remove(i.state.paramHintTooltip),i.state.overloads=null),r=[],n=0,u=t.length;nn.state.overloads.length-1&&(i=0);n.state.overloadIdx=i;r=$(n.state.paramHintTooltip);r.find(".overloads-counter").html(i+1+" of "+n.state.overloads.length);r.find(".fn-descr").text(n.state.overloads[i])}function r(n,t,i){return u(n,function(n,t){return n.getTokenAt(t)},t,i)}function f(t,i,r,u){var h;t.state.paramHintTooltip&&fadeOut(t.state.paramHintTooltip);var f=elt("div","overloads-ctnr"),e=elt("div","overloads-nav-ctnr"),o=elt("div","overload-up"),c=elt("div","overloads-counter","1 of "+u.length),s=elt("div","overload-dn");e.appendChild(o);e.appendChild(c);e.appendChild(s);h=elt("div","fn-descr",u[0]);f.appendChild(e);f.appendChild(h);i<0&&(i=0);f.style.left=i+"px";f.style.top=r+"px";document.body.appendChild(f);$(o).on("click",function(){n(t,1)});$(s).on("click",function(){n(t,-1)});return f}CodeMirror.defineExtension("csharpHint",r);CodeMirror.registerHelper("hint","csharp",r);$(function(){$.connection!=undefined&&window.useSignalR!=!1&&($.connection.snippetCompilerHub.client.onAutoComplete=function(n,r){var o=allSnippetObjs[n].myCodeMirror,e=o.getCursor(),a=JXG.decompress(r),s,h,c,l;for(lookupResult=jQuery.parseJSON(a),s=lookupResult.Lookups,i=0;i0)||!(h<=6)||f.string.length!=h))return u.list=[],u;if(c=f.string.indexOf("."),f.string.length>1&&c!==-1&&(f.string=f.string.substring(c+1),f.start=f.start+c+1),l=[],f!=null&&f.string!=="."&&u.initial_list!=null&&u.initial_list.length>0){for(i=0;i1e4&&checkConnectionAndReconnect();lastMouseMoveTime=$.now()}),function(){var i,t,n;(function(r){function e(n,t){return g.call(n,t)}function c(n,t){var e,s,o,u,v,h,p,i,c,y,r=t&&t.split("/"),l=f.map,a=l&&l["*"]||{};if(n&&"."===n.charAt(0))if(t){for(r=r.slice(0,r.length-1),n=r.concat(n.split("/")),i=0;n.length>i;i+=1)if(y=n[i],"."===y)n.splice(i,1),i-=1;else if(".."===y){if(1===i&&(".."===n[2]||".."===n[0]))break;i>0&&(n.splice(i-1,2),i-=2)}n=n.join("/")}else 0===n.indexOf("./")&&(n=n.substring(2));if((r||a)&&l){for(e=n.split("/"),i=e.length;i>0;i-=1){if(s=e.slice(0,i).join("/"),r)for(c=r.length;c>0;c-=1)if(o=l[r.slice(0,c).join("/")],o&&(o=o[s])){u=o;v=i;break}if(u)break;!h&&a&&a[s]&&(h=a[s],p=i)}!u&&h&&(u=h,v=p);u&&(e.splice(0,v,u),n=e.join("/"))}return n}function p(n,t){return function(){return o.apply(r,nt.call(arguments,0).concat([n,t]))}}function b(n){return function(t){return c(t,n)}}function k(n){return function(t){u[n]=t}}function l(n){if(e(h,n)){var t=h[n];delete h[n];y[n]=!0;a.apply(r,t)}if(!e(u,n)&&!e(y,n))throw Error("No "+n);return u[n]}function w(n){var i,t=n?n.indexOf("!"):-1;return t>-1&&(i=n.substring(0,t),n=n.substring(t+1,n.length)),[i,n]}function d(n){return function(){return f&&f.config&&f.config[n]||{}}}var a,o,v,s,u={},h={},f={},y={},g=Object.prototype.hasOwnProperty,nt=[].slice;v=function(n,t){var r,u=w(n),i=u[0];return n=u[1],i&&(i=c(i,t),r=l(i)),i?n=r&&r.normalize?r.normalize(n,b(t)):c(n,t):(n=c(n,t),u=w(n),i=u[0],n=u[1],i&&(r=l(i))),{f:i?i+"!"+n:n,n:n,pr:i,p:r}};s={require:function(n){return p(n)},exports:function(n){var t=u[n];return t!==void 0?t:u[n]={}},module:function(n){return{id:n,uri:"",exports:u[n],config:d(n)}}};a=function(n,t,i,f){var w,o,d,b,c,g,a=[];if(f=f||n,"function"==typeof i){for(t=!t.length&&i.length?["require","exports","module"]:t,c=0;t.length>c;c+=1)if(b=v(t[c],f),o=b.f,"require"===o)a[c]=s.require(n);else if("exports"===o)a[c]=s.exports(n),g=!0;else if("module"===o)w=a[c]=s.module(n);else if(e(u,o)||e(h,o)||e(y,o))a[c]=l(o);else{if(!b.p)throw Error(n+" missing "+o);b.p.load(b.n,p(f,!0),k(o),{});a[c]=u[o]}d=i.apply(u[n],a);n&&(w&&w.exports!==r&&w.exports!==u[n]?u[n]=w.exports:d===r&&g||(u[n]=d))}else n&&(u[n]=i)};i=t=o=function(n,t,i,u,e){return"string"==typeof n?s[n]?s[n](t):l(v(n,t).f):(n.splice||(f=n,t.splice?(n=t,t=i,i=null):n=r),t=t||function(){},"function"==typeof i&&(i=u,u=e),u?a(r,n,t,i):setTimeout(function(){a(r,n,t,i)},4),o)};o.config=function(n){return f=n,f.deps&&o(f.deps,f.callback),o};n=function(n,t,i){t.splice||(i=t,t=[]);e(u,n)||e(h,n)||(h[n]=[n,t,i])};n.amd={jQuery:!0}})();n("../node_modules/almond/almond",function(){});n("jxg",[],function(){var n={};return"object"!=typeof JXG||JXG.extend||(n=JXG),n.extend=function(n,t,i,r){var u,f;i=i||!1;r=r||!1;for(u in t)(!i||i&&t.hasOwnProperty(u))&&(f=r?u.toLowerCase():u,n[f]=t[u])},n.extend(n,{boards:{},readers:{},elements:{},registerElement:function(n,t){n=n.toLowerCase();this.elements[n]=t},registerReader:function(n,t){for(var r,i=0;t.length>i;i++)r=t[i].toLowerCase(),"function"!=typeof this.readers[r]&&(this.readers[r]=n)},shortcut:function(n,t){return function(){return n[t].apply(this,arguments)}},getRef:function(n,t){return n.select(t)},getReference:function(n,t){return n.select(t)},debugInt:function(){for(var t,n=0;arguments.length>n;n++)t=arguments[n],"object"==typeof window&&window.console&&console.log?console.log(t):"object"==typeof document&&document.getElementById("debug")&&(document.getElementById("debug").innerHTML+=t+"
")},debugWST:function(){var t=Error();n.debugInt.apply(this,arguments);t&&t.stack&&(n.debugInt("stacktrace"),n.debugInt(t.stack.split("\n").slice(1).join("\n")))},debugLine:function(){var t=Error();n.debugInt.apply(this,arguments);t&&t.stack&&n.debugInt("Called from",t.stack.split("\n").slice(2,3).join("\n"))},debug:function(){n.debugInt.apply(this,arguments)}}),n});n("utils/zip",["jxg"],function(n){var i=[0,128,64,192,32,160,96,224,16,144,80,208,48,176,112,240,8,136,72,200,40,168,104,232,24,152,88,216,56,184,120,248,4,132,68,196,36,164,100,228,20,148,84,212,52,180,116,244,12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252,2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242,10,138,74,202,42,170,106,234,26,154,90,218,58,186,122,250,6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246,14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254,1,129,65,193,33,161,97,225,17,145,81,209,49,177,113,241,9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249,5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245,13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253,3,131,67,195,35,163,99,227,19,147,83,211,51,179,115,243,11,139,75,203,43,171,107,235,27,155,91,219,59,187,123,251,7,135,71,199,39,167,103,231,23,151,87,215,55,183,119,247,15,143,79,207,47,175,111,239,31,159,95,223,63,191,127,255],r=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],u=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,99,99],f=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],t=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],o=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],e=256;return n.Util=n.Util||{},n.Util.Unzip=function(s){function h(){return ti+=8,ii>ni?s[ni++]:-1}function pt(){p=1}function nt(){var n;try{return ti++,n=1&p,p>>=1,0===p&&(p=h(),n=1&p,p=128|p>>1),n}catch(t){throw t;}}function c(n){var t=0,r=n;try{for(;r--;)t=t<<1|nt();n&&(t=i[t]>>8-n)}catch(u){throw u;}return t}function b(){k=0}function tt(n){bt++;vt[k++]=n;it.push(String.fromCharCode(n));32768===k&&(k=0)}function et(){this.b0=0;this.b1=0;this.jump=null;this.jumppos=-1}function wt(){for(;;){if(d[l]>=gt)return-1;if(dt[d[l]]===l)return d[l]++;d[l]++}}function ot(){var t,n=yt[ut];if(17===l)return-1;if(ut++,l++,t=wt(),t>=0)n.b0=t;else if(n.b0=32768,ot())return-1;if(t=wt(),t>=0)n.b1=t,n.jump=null;else if(n.b1=32768,n.jump=yt[ut],n.jumppos=ut,ot())return-1;return l--,0}function st(n,t,i){var r;for(yt=n,ut=0,dt=i,gt=t,r=0;17>r;r++)d[r]=0;return l=0,ot()?-1:0}function ht(n){for(var u,i,f,r=0,t=n[r];;)if(f=nt()){if(!(32768&t.b1))return t.b1;for(t=t.jump,u=n.length,i=0;u>i;i++)if(n[i]===t){r=i;break}}else{if(!(32768&t.b0))return t.b0;r++;t=n[r]}}function ct(){var ct,y,d,s,e,lt,l,ut,a,g,v,ft,it,p,ot,at,yt;do if(ct=nt(),d=c(2),0===d)for(pt(),g=h(),g|=h()<<8,ft=h(),ft|=h()<<8,65535&(g^~ft)&&n.debug("BlockLen checksum mismatch\n");g--;)y=h(),tt(y);else if(1===d)for(;;)if(e=i[c(7)]>>1,e>23?(e=e<<1|nt(),e>199?(e-=128,e=e<<1|nt()):(e-=48,e>143&&(e+=136))):e+=256,256>e)tt(e);else{if(256===e)break;for(e-=257,a=c(u[e])+r[e],e=i[c(5)]>>3,t[e]>8?(v=c(8),v|=c(t[e]-8)<<8):v=c(t[e]),v+=f[e],e=0;a>e;e++)y=vt[32767&k-v],tt(y)}else if(2===d){for(l=Array(320),p=257+c(5),ot=1+c(5),at=4+c(4),e=0;19>e;e++)l[e]=0;for(e=0;at>e;e++)l[o[e]]=c(3);for(a=w.length,s=0;a>s;s++)w[s]=new et;if(st(w,19,l,0))return b(),1;for(it=p+ot,s=0,yt=-1;it>s;)if(yt++,e=ht(w),16>e)l[s++]=e;else if(16===e){if(e=3+c(2),s+e>it)return b(),1;for(lt=s?l[s-1]:0;e--;)l[s++]=lt}else{if(e=17===e?3+c(3):11+c(7),s+e>it)return b(),1;for(;e--;)l[s++]=0}for(a=rt.length,s=0;a>s;s++)rt[s]=new et;if(st(rt,p,l,0))return b(),1;for(a=rt.length,s=0;a>s;s++)w[s]=new et;for(ut=[],s=p;l.length>s;s++)ut[s-p]=l[s];if(st(w,ot,ut,0))return b(),1;for(;;)if(e=ht(rt),e>=256){if(e-=256,0===e)break;for(e-=1,a=c(u[e])+r[e],e=ht(w),t[e]>8?(v=c(8),v|=c(t[e]-8)<<8):v=c(t[e]),v+=f[e];a--;)y=vt[32767&k-v],tt(y)}else tt(e)}while(!ct);return b(),pt(),0}function lt(){var t,i,o,s,r,u,f,c,n=[];try{if(it=[],ft=!1,n[0]=h(),n[1]=h(),120===n[0]&&218===n[1]&&(ct(),a[y]=[it.join(""),"geonext.gxt"],y++),31===n[0]&&139===n[1]&&(at(),a[y]=[it.join(""),"file"],y++),80===n[0]&&75===n[1]&&(ft=!0,n[2]=h(),n[3]=h(),3===n[2]&&4===n[3])){for(n[0]=h(),n[1]=h(),v=h(),v|=h()<<8,c=h(),c|=h()<<8,h(),h(),h(),h(),f=h(),f|=h()<<8,f|=h()<<16,f|=h()<<24,u=h(),u|=h()<<8,u|=h()<<16,u|=h()<<24,r=h(),r|=h()<<8,r|=h()<<16,r|=h()<<24,s=h(),s|=h()<<8,o=h(),o|=h()<<8,t=0,g=[];s--;)i=h(),"/"===i|":"===i?t=0:e-1>t&&(g[t++]=String.fromCharCode(i));for(kt||(kt=g),t=0;o>t;)i=h(),t++;bt=0;8===c&&(ct(),a[y]=Array(2),a[y][0]=it.join(""),a[y][1]=g.join(""),y++);at()}}catch(l){throw l;}}var v,bt,kt,dt,gt,at,it=[],y=0,a=[],vt=Array(32768),k=0,ft=!1,ii=s.length,ni=0,p=1,ti=0,rt=Array(288),w=Array(32),ut=0,yt=null,l=(Array(64),Array(64),0),d=Array(17),g=[];d[0]=0;at=function(){var t,f,r,o,u,i,n=[];if(8&v&&(n[0]=h(),n[1]=h(),n[2]=h(),n[3]=h(),80===n[0]&&75===n[1]&&7===n[2]&&8===n[3]?(t=h(),t|=h()<<8,t|=h()<<16,t|=h()<<24):t=n[0]|n[1]<<8|n[2]<<16|n[3]<<24,f=h(),f|=h()<<8,f|=h()<<16,f|=h()<<24,r=h(),r|=h()<<8,r|=h()<<16,r|=h()<<24),ft&&lt(),n[0]=h(),8===n[0]){if(v=h(),h(),h(),h(),h(),h(),o=h(),4&v)for(n[0]=h(),n[2]=h(),l=n[0]+256*n[1],u=0;l>u;u++)h();if(8&v)for(u=0,g=[],i=h();i;)("7"===i||":"===i)&&(u=0),e-1>u&&(g[u++]=i),i=h();if(16&v)for(i=h();i;)i=h();2&v&&(h(),h());ct();t=h();t|=h()<<8;t|=h()<<16;t|=h()<<24;r=h();r|=h()<<8;r|=h()<<16;r|=h()<<24;ft&&lt()}};n.Util.Unzip.prototype.unzipFile=function(n){var t;for(this.unzip(),t=0;a.length>t;t++)if(a[t][1]===n)return a[t][0];return""};n.Util.Unzip.prototype.unzip=function(){return lt(),a}},n.Util});n("utils/encoding",["jxg"],function(n){var t=0,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,10,3,3,3,3,3,3,3,3,3,3,3,3,4,3,3,11,6,6,6,5,8,8,8,8,8,8,8,8,8,8,8,0,12,24,36,60,96,84,12,12,12,48,72,12,12,12,12,12,12,12,12,12,12,12,12,12,0,12,12,12,12,12,0,12,0,12,12,12,24,12,12,12,12,12,24,12,24,12,12,12,12,12,12,12,12,12,24,12,12,12,12,12,24,12,12,12,12,12,12,12,24,12,12,12,12,12,12,12,12,12,36,12,36,12,12,12,36,12,12,12,12,12,36,12,36,12,12,12,36,12,12,12,12,12,12,12,12,12,12];return n.Util=n.Util||{},n.Util.UTF8={encode:function(n){var r,t,i="",u=n.length;if(n=n.replace(/\r\n/g,"\n"),"function"==typeof unescape&&"function"==typeof encodeURIComponent)return unescape(encodeURIComponent(n));for(r=0;u>r;r++)t=n.charCodeAt(r),128>t?i+=String.fromCharCode(t):t>127&&2048>t?(i+=String.fromCharCode(192|t>>6),i+=String.fromCharCode(128|63&t)):(i+=String.fromCharCode(224|t>>12),i+=String.fromCharCode(128|63&t>>6),i+=String.fromCharCode(128|63&t));return i},decode:function(n){for(var e,s,c=0,r=0,o=t,u=[],l=n.length,h=[],f=0;l>f;f++)e=n.charCodeAt(f),s=i[e],r=o!==t?63&e|r<<6:255>>s&e,o=i[256+o+s],o===t&&(r>65535?u.push(55232+(r>>10),56320+(1023&r)):u.push(r),c++,0==c%1e4&&(h.push(String.fromCharCode.apply(null,u)),u=[]));return h.push(String.fromCharCode.apply(null,u)),h.join("")},asciiCharCodeAt:function(n,t){var i=n.charCodeAt(t);if(i>255)switch(i){case 8364:i=128;break;case 8218:i=130;break;case 402:i=131;break;case 8222:i=132;break;case 8230:i=133;break;case 8224:i=134;break;case 8225:i=135;break;case 710:i=136;break;case 8240:i=137;break;case 352:i=138;break;case 8249:i=139;break;case 338:i=140;break;case 381:i=142;break;case 8216:i=145;break;case 8217:i=146;break;case 8220:i=147;break;case 8221:i=148;break;case 8226:i=149;break;case 8211:i=150;break;case 8212:i=151;break;case 732:i=152;break;case 8482:i=153;break;case 353:i=154;break;case 8250:i=155;break;case 339:i=156;break;case 382:i=158;break;case 376:i=159}return i}},n.Util.UTF8});n("utils/base64",["jxg","utils/encoding"],function(n,t){function u(n,t){return 255&n.charCodeAt(t)}function r(n,t){var r=i.indexOf(n.charAt(t));if(-1===r)throw Error("JSXGraph/utils/base64: Can't decode string (invalid character).");return r}var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f="=";return n.Util=n.Util||{},n.Util.Base64={encode:function(n){var o,r,s,c,e,h=[];for(e=t.encode(n),s=e.length,c=s%3,o=0;s-c>o;o+=3)r=u(e,o)<<16|u(e,o+1)<<8|u(e,o+2),h.push(i.charAt(r>>18),i.charAt(63&r>>12),i.charAt(63&r>>6),i.charAt(63&r));switch(c){case 1:r=u(e,s-1);h.push(i.charAt(r>>2),i.charAt(63&r<<4),f,f);break;case 2:r=u(e,s-2)<<8|u(e,s-1);h.push(i.charAt(r>>10),i.charAt(63&r>>4),i.charAt(63&r<<2),f)}return h.join("")},decode:function(n,i){var u,e,o,l,s,c,a=[],h=[];if(u=n.replace(/[^A-Za-z0-9\+\/=]/g,""),o=u.length,0!=o%4)throw Error("JSXGraph/utils/base64: Can't decode string (invalid input length).");for(u.charAt(o-1)===f&&(l=1,u.charAt(o-2)===f&&(l=2),o-=4),e=0;o>e;e+=4)s=r(u,e)<<18|r(u,e+1)<<12|r(u,e+2)<<6|r(u,e+3),h.push(s>>16,255&s>>8,255&s),0==e%1e4&&(a.push(String.fromCharCode.apply(null,h)),h=[]);switch(l){case 1:s=r(u,o)<<12|r(u,o+1)<<6|r(u,o+2);h.push(s>>10,255&s>>2);break;case 2:s=r(u,e)<<6|r(u,e+1);h.push(s>>4)}return a.push(String.fromCharCode.apply(null,h)),c=a.join(""),i&&(c=t.decode(c)),c},decodeAsArray:function(n){for(var i=this.decode(n),r=[],u=i.length,t=0;u>t;t++)r[t]=i.charCodeAt(t);return r}},n.Util.Base64});n("../build/compressor.deps.js",["jxg","utils/zip","utils/base64"],function(n,t,i){return n.decompress=function(n){return unescape(new t.Unzip(i.decodeAsArray(n)).unzip()[0][0])},n});window.JXG=t("../build/compressor.deps.js")}()