﻿(function(b,a){typeof exports==="object"&&typeof module!=="undefined"?module.exports=a():typeof define==="function"&&define.amd?define("codemirror.js",a):(b.CodeMirror=a())}(this,(function(){var eC=navigator.userAgent;var eN=navigator.platform;var cR=/gecko\/\d/i.test(eC);var fw=/MSIE \d/.test(eC);var b4=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(eC);var c5=/Edge\/(\d+)/.exec(eC);var ei=fw||b4||c5;var m=ei&&(fw?document.documentMode||6:+(c5||b4)[1]);var dv=!c5&&/WebKit\//.test(eC);var el=dv&&/Qt\/\d+\.\d+/.test(eC);var dL=!c5&&/Chrome\//.test(eC);var eE=/Opera\//.test(eC);var aM=/Apple Computer/.test(navigator.vendor);var dD=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(eC);var gi=/PhantomJS/.test(eC);var fQ=!c5&&/AppleWebKit/.test(eC)&&/Mobile\/\w+/.test(eC);var aY=/Android/.test(eC);var eT=fQ||aY||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(eC);var cu=fQ||/Mac/.test(eN);var gC=/\bCrOS\b/.test(eC);var a1=/win/i.test(eN);var bc=eE&&eC.match(/Version\/(\d*\.\d*)/);if(bc){bc=Number(bc[1])}if(bc&&bc>=15){eE=false;dv=true}var cc=cu&&(el||eE&&(bc==null||bc<12.11));var hf=cR||(ei&&m>=9);function Y(i){return new RegExp("(^|\\s)"+i+"(?:$|\\s)\\s*")}var h=function(hr,i){var hs=hr.className;var hq=Y(i).exec(hs);if(hq){var ht=hs.slice(hq.index+hq[0].length);hr.className=hs.slice(0,hq.index)+(ht?hq[1]+ht:"")}};function eD(hq){for(var i=hq.childNodes.length;i>0;--i){hq.removeChild(hq.firstChild)}return hq}function ce(i,hq){return eD(i).appendChild(hq)}function g5(hq,hu,ht,hs){var hv=document.createElement(hq);if(ht){hv.className=ht}if(hs){hv.style.cssText=hs}if(typeof hu=="string"){hv.appendChild(document.createTextNode(hu))}else{if(hu){for(var hr=0;hr<hu.length;++hr){hv.appendChild(hu[hr])}}}return hv}function hc(i,hs,hr,hq){var ht=g5(i,hs,hr,hq);ht.setAttribute("role","presentation");return ht}var cO;if(document.createRange){cO=function(hs,ht,hq,i){var hr=document.createRange();hr.setEnd(i||hs,hq);hr.setStart(hs,ht);return hr}}else{cO=function(hr,ht,i){var hq=document.body.createTextRange();try{hq.moveToElementText(hr.parentNode)}catch(hs){return hq}hq.collapse(true);hq.moveEnd("character",i);hq.moveStart("character",ht);return hq}}function hg(i,hq){if(hq.nodeType==3){hq=hq.parentNode}if(i.contains){return i.contains(hq)}do{if(hq.nodeType==11){hq=hq.host}if(hq==i){return true}}while(hq=hq.parentNode)}function em(){var i;try{i=document.activeElement}catch(hq){i=document.body||null}while(i&&i.shadowRoot&&i.shadowRoot.activeElement){i=i.shadowRoot.activeElement}return i}function gs(hq,i){var hr=hq.className;if(!Y(i).test(hr)){hq.className+=(hr?" ":"")+i}}function gS(hs,hq){var hr=hs.split(" ");for(var ht=0;ht<hr.length;ht++){if(hr[ht]&&!Y(hr[ht]).test(hq)){hq+=" "+hr[ht]}}return hq}var ej=function(i){i.select()};if(fQ){ej=function(i){i.selectionStart=0;i.selectionEnd=i.value.length}}else{if(ei){ej=function(hq){try{hq.select()}catch(i){}}}}function cY(hq){var i=Array.prototype.slice.call(arguments,1);return function(){return hq.apply(null,i)}}function aZ(hr,hq,i){if(!hq){hq={}}for(var hs in hr){if(hr.hasOwnProperty(hs)&&(i!==false||!hq.hasOwnProperty(hs))){hq[hs]=hr[hs]}}return hq}function cd(ht,hr,hv,hw,hs){if(hr==null){hr=ht.search(/[^\s\u00a0]/);if(hr==-1){hr=ht.length}}for(var hu=hw||0,hx=hs||0;;){var hq=ht.indexOf("\t",hu);if(hq<0||hq>=hr){return hx+(hr-hu)}hx+=hq-hu;hx+=hv-(hx%hv);hu=hq+1}}var hp=function(){this.id=null};hp.prototype.set=function(i,hq){clearTimeout(this.id);this.id=setTimeout(hq,i)};function dR(hs,hq){for(var hr=0;hr<hs.length;++hr){if(hs[hr]==hq){return hr}}return -1}var eg=30;var cz={toString:function(){return"CodeMirror.Pass"}};var ah={scroll:false};var R={origin:"*mouse"};var dr={origin:"+move"};function e5(ht,hs,hu){for(var hv=0,hr=0;;){var hq=ht.indexOf("\t",hv);if(hq==-1){hq=ht.length}var i=hq-hv;if(hq==ht.length||hr+i>=hs){return hv+Math.min(i,hs-hr)}hr+=hq-hv;hr+=hu-(hr%hu);hv=hq+1;if(hr>=hs){return hv}}}var bd=[""];function cS(i){while(bd.length<=i){bd.push(gy(bd)+" ")}return bd[i]}function gy(i){return i[i.length-1]}function cf(ht,hs){var hq=[];for(var hr=0;hr<ht.length;hr++){hq[hr]=hs(ht[hr],hr)}return hq}function cx(ht,hq,hr){var hs=0,i=hr(hq);while(hs<ht.length&&hr(ht[hs])<=i){hs++}ht.splice(hs,0,hq)}function gT(){}function cM(hr,i){var hq;if(Object.create){hq=Object.create(hr)}else{gT.prototype=hr;hq=new gT()}if(i){aZ(i,hq)}return hq}var bp=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function gv(i){return/\w/.test(i)||i>"\x80"&&(i.toUpperCase()!=i.toLowerCase()||bp.test(i))}function c3(i,hq){if(!hq){return gv(i)}if(hq.source.indexOf("\\w")>-1&&gv(i)){return true}return hq.test(i)}function fI(i){for(var hq in i){if(i.hasOwnProperty(hq)&&i[hq]){return false}}return true}var fv=/[\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]/;function gd(i){return i.charCodeAt(0)>=768&&fv.test(i)}function eX(hq,hr,i){while((i<0?hr>0:hr<hq.length)&&gd(hq.charAt(hr))){hr+=i}return hr}function cP(i,hu,ht){var hr=hu>ht?-1:1;for(;;){if(hu==ht){return hu}var hs=(hu+ht)/2,hq=hr<0?Math.ceil(hs):Math.floor(hs);if(hq==hu){return i(hq)?hu:ht}if(i(hq)){ht=hq}else{hu=hq+hr}}}function ft(hq,hs,hr){var ht=this;this.input=hr;ht.scrollbarFiller=g5("div",null,"CodeMirror-scrollbar-filler");ht.scrollbarFiller.setAttribute("cm-not-content","true");ht.gutterFiller=g5("div",null,"CodeMirror-gutter-filler");ht.gutterFiller.setAttribute("cm-not-content","true");ht.lineDiv=hc("div",null,"CodeMirror-code");ht.selectionDiv=g5("div",null,null,"position: relative; z-index: 1");ht.cursorDiv=g5("div",null,"CodeMirror-cursors");ht.measure=g5("div",null,"CodeMirror-measure");ht.lineMeasure=g5("div",null,"CodeMirror-measure");ht.lineSpace=hc("div",[ht.measure,ht.lineMeasure,ht.selectionDiv,ht.cursorDiv,ht.lineDiv],null,"position: relative; outline: none");var i=hc("div",[ht.lineSpace],"CodeMirror-lines");ht.mover=g5("div",[i],null,"position: relative");ht.sizer=g5("div",[ht.mover],"CodeMirror-sizer");ht.sizerWidth=null;ht.heightForcer=g5("div",null,null,"position: absolute; height: "+eg+"px; width: 1px;");ht.gutters=g5("div",null,"CodeMirror-gutters");ht.lineGutter=null;ht.scroller=g5("div",[ht.sizer,ht.heightForcer,ht.gutters],"CodeMirror-scroll");ht.scroller.setAttribute("tabIndex","-1");ht.wrapper=g5("div",[ht.scrollbarFiller,ht.gutterFiller,ht.scroller],"CodeMirror");if(ei&&m<8){ht.gutters.style.zIndex=-1;ht.scroller.style.paddingRight=0}if(!dv&&!(cR&&eT)){ht.scroller.draggable=true}if(hq){if(hq.appendChild){hq.appendChild(ht.wrapper)}else{hq(ht.wrapper)}}ht.viewFrom=ht.viewTo=hs.first;ht.reportedViewFrom=ht.reportedViewTo=hs.first;ht.view=[];ht.renderedView=null;ht.externalMeasured=null;ht.viewOffset=0;ht.lastWrapHeight=ht.lastWrapWidth=0;ht.updateLineNumbers=null;ht.nativeBarWidth=ht.barHeight=ht.barWidth=0;ht.scrollbarsClipped=false;ht.lineNumWidth=ht.lineNumInnerWidth=ht.lineNumChars=null;ht.alignWidgets=false;ht.cachedCharWidth=ht.cachedTextHeight=ht.cachedPaddingH=null;ht.maxLine=null;ht.maxLineLength=0;ht.maxLineChanged=false;ht.wheelDX=ht.wheelDY=ht.wheelStartX=ht.wheelStartY=null;ht.shift=false;ht.selForContextMenu=null;ht.activeTouch=null;hr.init(ht)}function f4(ht,hv){hv-=ht.first;if(hv<0||hv>=ht.size){throw new Error("There is no line "+(hv+ht.first)+" in the document.")}var hq=ht;while(!hq.lines){for(var hr=0;;++hr){var hu=hq.children[hr],hs=hu.chunkSize();if(hv<hs){hq=hu;break}hv-=hs}}return hq.lines[hv]}function g8(hr,ht,i){var hq=[],hs=ht.line;hr.iter(ht.line,i.line+1,function(hu){var hv=hu.text;if(hs==i.line){hv=hv.slice(0,i.ch)}if(hs==ht.line){hv=hv.slice(ht.ch)}hq.push(hv);++hs});return hq}function bf(hq,hs,hr){var i=[];hq.iter(hs,hr,function(ht){i.push(ht.text)});return i}function hb(hq,i){var hr=i-hq.height;if(hr){for(var hs=hq;hs;hs=hs.parent){hs.height+=hr}}}function b8(hq){if(hq.parent==null){return null}var hu=hq.parent,ht=dR(hu.lines,hq);for(var hr=hu.parent;hr;hu=hr,hr=hr.parent){for(var hs=0;;++hs){if(hr.children[hs]==hu){break}ht+=hr.children[hs].chunkSize()}}return ht+hu.first}function b1(hw,hv){var ht=hw.first;outer:do{for(var hs=0;hs<hw.children.length;++hs){var hr=hw.children[hs],hq=hr.height;if(hv<hq){hw=hr;continue outer}hv-=hq;ht+=hr.chunkSize()}return ht}while(!hw.lines);var hu=0;for(;hu<hw.lines.length;++hu){var hy=hw.lines[hu],hx=hy.height;if(hv<hx){break}hv-=hx}return ht+hu}function cw(hq,i){return i>=hq.first&&i<hq.first+hq.size}function e8(hq,hr){return String(hq.lineNumberFormatter(hr+hq.firstLineNumber))}function ac(i,hq,hr){if(hr===void 0){hr=null}if(!(this instanceof ac)){return new ac(i,hq,hr)}this.line=i;this.ch=hq;this.sticky=hr}function cF(hq,i){return hq.line-i.line||hq.ch-i.ch}function ad(hq,i){return hq.sticky==i.sticky&&cF(hq,i)==0}function cI(i){return ac(i.line,i.ch)}function bR(hq,i){return cF(hq,i)<0?i:hq}function aB(hq,i){return cF(hq,i)<0?hq:i}function dA(i,hq){return Math.max(i.first,Math.min(hq,i.first+i.size-1))}function gD(hq,hr){if(hr.line<hq.first){return ac(hq.first,0)}var i=hq.first+hq.size-1;if(hr.line>i){return ac(i,f4(hq,i).text.length)}return gg(hr,f4(hq,hr.line).text.length)}function gg(hr,hq){var i=hr.ch;if(i==null||i>hq){return ac(hr.line,hq)}else{if(i<0){return ac(hr.line,0)}else{return hr}}}function eB(hs,ht){var hq=[];for(var hr=0;hr<ht.length;hr++){hq[hr]=gD(hs,ht[hr])}return hq}var hk=false;var bk=false;function gq(){hk=true}function bQ(){bk=true}function eW(i,hr,hq){this.marker=i;this.from=hr;this.to=hq}function fZ(hs,hq){if(hs){for(var hr=0;hr<hs.length;++hr){var ht=hs[hr];if(ht.marker==hq){return ht}}}}function fs(hr,hs){var ht;for(var hq=0;hq<hr.length;++hq){if(hr[hq]!=hs){(ht||(ht=[])).push(hr[hq])}}return ht}function cC(i,hq){i.markedSpans=i.markedSpans?i.markedSpans.concat([hq]):[hq];hq.marker.attachLine(i)}function a3(hr,hs,hw){var hx;if(hr){for(var hu=0;hu<hr.length;++hu){var hy=hr[hu],hv=hy.marker;var hq=hy.from==null||(hv.inclusiveLeft?hy.from<=hs:hy.from<hs);if(hq||hy.from==hs&&hv.type=="bookmark"&&(!hw||!hy.marker.insertLeft)){var ht=hy.to==null||(hv.inclusiveRight?hy.to>=hs:hy.to>hs);(hx||(hx=[])).push(new eW(hv,hy.from,ht?null:hy.to))}}}return hx}function aL(hr,ht,hw){var hx;if(hr){for(var hu=0;hu<hr.length;++hu){var hy=hr[hu],hv=hy.marker;var hs=hy.to==null||(hv.inclusiveRight?hy.to>=ht:hy.to>ht);if(hs||hy.from==ht&&hv.type=="bookmark"&&(!hw||hy.marker.insertLeft)){var hq=hy.from==null||(hv.inclusiveLeft?hy.from<=ht:hy.from<ht);(hx||(hx=[])).push(new eW(hv,hq?null:hy.from-ht,hy.to==null?null:hy.to-ht))}}}return hx}function eY(hL,hB){if(hB.full){return null}var hs=cw(hL,hB.from.line)&&f4(hL,hB.from.line).markedSpans;var hz=cw(hL,hB.to.line)&&f4(hL,hB.to.line).markedSpans;if(!hs&&!hz){return null}var hy=hB.from.ch,hG=hB.to.ch,hD=cF(hB.from,hB.to)==0;var hx=a3(hs,hy,hD);var hA=aL(hz,hG,hD);var hE=hB.text.length==1,hv=gy(hB.text).length+(hE?hy:0);if(hx){for(var hJ=0;hJ<hx.length;++hJ){var hI=hx[hJ];if(hI.to==null){var hC=fZ(hA,hI.marker);if(!hC){hI.to=hy}else{if(hE){hI.to=hC.to==null?null:hC.to+hv}}}}}if(hA){for(var hw=0;hw<hA.length;++hw){var hH=hA[hw];if(hH.to!=null){hH.to+=hv}if(hH.from==null){var hr=fZ(hx,hH.marker);if(!hr){hH.from=hv;if(hE){(hx||(hx=[])).push(hH)}}}else{hH.from+=hv;if(hE){(hx||(hx=[])).push(hH)}}}}if(hx){hx=s(hx)}if(hA&&hA!=hx){hA=s(hA)}var hK=[hx];if(!hE){var hF=hB.text.length-2,hq;if(hF>0&&hx){for(var hu=0;hu<hx.length;++hu){if(hx[hu].to==null){(hq||(hq=[])).push(new eW(hx[hu].marker,null,null))}}}for(var ht=0;ht<hF;++ht){hK.push(hq)}hK.push(hA)}return hK}function s(hr){for(var hq=0;hq<hr.length;++hq){var hs=hr[hq];if(hs.from!=null&&hs.from==hs.to&&hs.marker.clearWhenEmpty!==false){hr.splice(hq--,1)}}if(!hr.length){return null}return hr}function dc(hC,hA,hB){var hu=null;hC.iter(hA.line,hB.line+1,function(hD){if(hD.markedSpans){for(var hE=0;hE<hD.markedSpans.length;++hE){var hF=hD.markedSpans[hE].marker;if(hF.readOnly&&(!hu||dR(hu,hF)==-1)){(hu||(hu=[])).push(hF)}}}});if(!hu){return null}var hv=[{from:hA,to:hB}];for(var hw=0;hw<hu.length;++hw){var hx=hu[hw],hs=hx.find(0);for(var ht=0;ht<hv.length;++ht){var hr=hv[ht];if(cF(hr.to,hs.from)<0||cF(hr.from,hs.to)>0){continue}var hz=[ht,1],hq=cF(hr.from,hs.from),hy=cF(hr.to,hs.to);if(hq<0||!hx.inclusiveLeft&&!hq){hz.push({from:hr.from,to:hs.from})}if(hy>0||!hx.inclusiveRight&&!hy){hz.push({from:hs.to,to:hr.to})}hv.splice.apply(hv,hz);ht+=hz.length-3}}return hv}function he(hq){var hs=hq.markedSpans;if(!hs){return}for(var hr=0;hr<hs.length;++hr){hs[hr].marker.detachLine(hq)}hq.markedSpans=null}function dy(hq,hs){if(!hs){return}for(var hr=0;hr<hs.length;++hr){hs[hr].marker.attachLine(hq)}hq.markedSpans=hs}function w(i){return i.inclusiveLeft?-1:0}function ci(i){return i.inclusiveRight?1:0}function eq(hs,hq){var hu=hs.lines.length-hq.lines.length;if(hu!=0){return hu}var hr=hs.find(),hv=hq.find();var i=cF(hr.from,hv.from)||w(hs)-w(hq);if(i){return -i}var ht=cF(hr.to,hv.to)||ci(hs)-ci(hq);if(ht){return ht}return hq.id-hs.id}function bj(hr,hv){var hq=bk&&hr.markedSpans,hu;if(hq){for(var ht=(void 0),hs=0;hs<hq.length;++hs){ht=hq[hs];if(ht.marker.collapsed&&(hv?ht.from:ht.to)==null&&(!hu||eq(hu,ht.marker)<0)){hu=ht.marker}}}return hu}function fC(i){return bj(i,true)}function fd(i){return bj(i,false)}function cE(hr,ht){var hq=bk&&hr.markedSpans,hv;if(hq){for(var hs=0;hs<hq.length;++hs){var hu=hq[hs];if(hu.marker.collapsed&&(hu.from==null||hu.from<ht)&&(hu.to==null||hu.to>ht)&&(!hv||eq(hv,hu.marker)<0)){hv=hu.marker}}}return hv}function A(hy,hs,hw,hx,hu){var hB=f4(hy,hs);var hq=bk&&hB.markedSpans;if(hq){for(var ht=0;ht<hq.length;++ht){var hr=hq[ht];if(!hr.marker.collapsed){continue}var hA=hr.marker.find(0);var hz=cF(hA.from,hw)||w(hr.marker)-w(hu);var hv=cF(hA.to,hx)||ci(hr.marker)-ci(hu);if(hz>=0&&hv<=0||hz<=0&&hv>=0){continue}if(hz<=0&&(hr.marker.inclusiveRight&&hu.inclusiveLeft?cF(hA.to,hw)>=0:cF(hA.to,hw)>0)||hz>=0&&(hr.marker.inclusiveRight&&hu.inclusiveLeft?cF(hA.from,hx)<=0:cF(hA.from,hx)<0)){return true}}}}function z(hq){var i;while(i=fC(hq)){hq=i.find(-1,true).line}return hq}function cL(hq){var i;while(i=fd(hq)){hq=i.find(1,true).line}return hq}function g(hr){var i,hq;while(i=fd(hr)){hr=i.find(1,true).line;(hq||(hq=[])).push(hr)}return hq}function a9(hs,hq){var i=f4(hs,hq),hr=z(i);if(i==hr){return hq}return b8(hr)}function eF(hs,hr){if(hr>hs.lastLine()){return hr}var hq=f4(hs,hr),i;if(!gl(hs,hq)){return hr}while(i=fd(hq)){hq=i.find(1,true).line}return b8(hq)+1}function gl(hu,hr){var hq=bk&&hr.markedSpans;if(hq){for(var ht=(void 0),hs=0;hs<hq.length;++hs){ht=hq[hs];if(!ht.marker.collapsed){continue}if(ht.from==null){return true}if(ht.marker.widgetNode){continue}if(ht.from==0&&ht.marker.inclusiveLeft&&Z(hu,hr,ht)){return true}}}}function Z(hv,hr,ht){if(ht.to==null){var hq=ht.marker.find(1,true);return Z(hv,hq.line,fZ(hq.line.markedSpans,ht.marker))}if(ht.marker.inclusiveRight&&ht.to==hr.text.length){return true}for(var hu=(void 0),hs=0;hs<hr.markedSpans.length;++hs){hu=hr.markedSpans[hs];if(hu.marker.collapsed&&!hu.marker.widgetNode&&hu.from==ht.to&&(hu.to==null||hu.to!=ht.from)&&(hu.marker.inclusiveLeft||ht.marker.inclusiveRight)&&Z(hv,hr,hu)){return true}}}function b7(hs){hs=z(hs);var hu=0,hr=hs.parent;for(var ht=0;ht<hr.lines.length;++ht){var hq=hr.lines[ht];if(hq==hs){break}else{hu+=hq.height}}for(var hv=hr.parent;hv;hr=hv,hv=hr.parent){for(var hx=0;hx<hv.children.length;++hx){var hw=hv.children[hx];if(hw==hr){break}else{hu+=hw.height}}}return hu}function e1(hr){if(hr.height==0){return 0}var hq=hr.text.length,i,hu=hr;while(i=fC(hu)){var hs=i.find(0,true);hu=hs.from.line;hq+=hs.from.ch-hs.to.ch}hu=hr;while(i=fd(hu)){var ht=i.find(0,true);hq-=hu.text.length-ht.from.ch;hu=ht.to.line;hq+=hu.text.length-ht.to.ch}return hq}function f(i){var hr=i.display,hq=i.doc;hr.maxLine=f4(hq,hq.first);hr.maxLineLength=e1(hr.maxLine);hr.maxLineChanged=true;hq.iter(function(ht){var hs=e1(ht);if(hs>hr.maxLineLength){hr.maxLineLength=hs;hr.maxLine=ht}})}function eG(hq,hw,hv,hu){if(!hq){return hu(hw,hv,"ltr",0)}var ht=false;for(var hs=0;hs<hq.length;++hs){var hr=hq[hs];if(hr.from<hv&&hr.to>hw||hw==hv&&hr.to==hw){hu(Math.max(hr.from,hw),Math.min(hr.to,hv),hr.level==1?"rtl":"ltr",hs);ht=true}}if(!ht){hu(hw,hv,"ltr")}}var fS=null;function aS(hq,hs,hu){var ht;fS=null;for(var hr=0;hr<hq.length;++hr){var hv=hq[hr];if(hv.from<hs&&hv.to>hs){return hr}if(hv.to==hs){if(hv.from!=hv.to&&hu=="before"){ht=hr}else{fS=hr}}if(hv.from==hs){if(hv.from!=hv.to&&hu!="before"){ht=hr}else{fS=hr}}}return ht!=null?ht:fS}var bv=(function(){var hv="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN";var ht="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function hs(hy){if(hy<=247){return hv.charAt(hy)}else{if(1424<=hy&&hy<=1524){return"R"}else{if(1536<=hy&&hy<=1785){return ht.charAt(hy-1536)}else{if(1774<=hy&&hy<=2220){return"r"}else{if(8192<=hy&&hy<=8203){return"w"}else{if(hy==8204){return"b"}else{return"L"}}}}}}}var i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;var hx=/[stwN]/,hr=/[LRr]/,hq=/[Lb1n]/,hu=/[1n]/;function hw(hA,hz,hy){this.level=hA;this.from=hz;this.to=hy}return function(hV,hB){var hK=hB=="ltr"?"L":"R";if(hV.length==0||hB=="ltr"&&!i.test(hV)){return false}var hE=hV.length,h4=[];for(var h7=0;h7<hE;++h7){h4.push(hs(hV.charCodeAt(h7)))}for(var hS=0,hR=hK;hS<hE;++hS){var h8=h4[hS];if(h8=="m"){h4[hS]=hR}else{hR=h8}}for(var hQ=0,hA=hK;hQ<hE;++hQ){var h3=h4[hQ];if(h3=="1"&&hA=="r"){h4[hQ]="n"}else{if(hr.test(h3)){hA=h3;if(h3=="r"){h4[hQ]="R"}}}}for(var hP=1,hz=h4[0];hP<hE-1;++hP){var h2=h4[hP];if(h2=="+"&&hz=="1"&&h4[hP+1]=="1"){h4[hP]="1"}else{if(h2==","&&hz==h4[hP+1]&&(hz=="1"||hz=="n")){h4[hP]=hz}}hz=h2}for(var hO=0;hO<hE;++hO){var h1=h4[hO];if(h1==","){h4[hO]="N"}else{if(h1=="%"){var hD=(void 0);for(hD=hO+1;hD<hE&&h4[hD]=="%";++hD){}var hI=(hO&&h4[hO-1]=="!")||(hD<hE&&h4[hD]=="1")?"1":"N";for(var h6=hO;h6<hD;++h6){h4[h6]=hI}hO=hD-1}}}for(var hN=0,hH=hK;hN<hE;++hN){var hZ=h4[hN];if(hH=="L"&&hZ=="1"){h4[hN]="L"}else{if(hr.test(hZ)){hH=hZ}}}for(var hM=0;hM<hE;++hM){if(hx.test(h4[hM])){var hW=(void 0);for(hW=hM+1;hW<hE&&hx.test(h4[hW]);++hW){}var hY=(hM?h4[hM-1]:hK)=="L";var h0=(hW<hE?h4[hW]:hK)=="L";var hU=hY==h0?(hY?"L":"R"):hK;for(var hG=hM;hG<hW;++hG){h4[hG]=hU}hM=hW-1}}var hX=[],h5;for(var hL=0;hL<hE;){if(hq.test(h4[hL])){var hJ=hL;for(++hL;hL<hE&&hq.test(h4[hL]);++hL){}hX.push(new hw(0,hJ,hL))}else{var hT=hL,hy=hX.length;for(++hL;hL<hE&&h4[hL]!="L";++hL){}for(var hF=hT;hF<hL;){if(hu.test(h4[hF])){if(hT<hF){hX.splice(hy,0,new hw(1,hT,hF))}var hC=hF;for(++hF;hF<hL&&hu.test(h4[hF]);++hF){}hX.splice(hy,0,new hw(2,hC,hF));hT=hF}else{++hF}}if(hT<hL){hX.splice(hy,0,new hw(1,hT,hL))}}}if(hB=="ltr"){if(hX[0].level==1&&(h5=hV.match(/^\s+/))){hX[0].from=h5[0].length;hX.unshift(new hw(0,0,h5[0].length))}if(gy(hX).level==1&&(h5=hV.match(/\s+$/))){gy(hX).to-=h5[0].length;hX.push(new hw(0,hE-h5[0].length,hE))}}return hB=="rtl"?hX.reverse():hX}})();function a(hq,hr){var i=hq.order;if(i==null){i=hq.order=bv(hq.text,hr)}return i}var fV=[];var cj=function(hr,i,hq){if(hr.addEventListener){hr.addEventListener(i,hq,false)}else{if(hr.attachEvent){hr.attachEvent("on"+i,hq)}else{var hs=hr._handlers||(hr._handlers={});hs[i]=(hs[i]||fV).concat(hq)}}};function eZ(hq,i){return hq._handlers&&hq._handlers[i]||fV}function eS(ht,hr,hs){if(ht.removeEventListener){ht.removeEventListener(hr,hs,false)}else{if(ht.detachEvent){ht.detachEvent("on"+hr,hs)}else{var hu=ht._handlers,i=hu&&hu[hr];if(i){var hq=dR(i,hs);if(hq>-1){hu[hr]=i.slice(0,hq).concat(i.slice(hq+1))}}}}}function aO(hu,ht){var hq=eZ(hu,ht);if(!hq.length){return}var hr=Array.prototype.slice.call(arguments,2);for(var hs=0;hs<hq.length;++hs){hq[hs].apply(null,hr)}}function a4(i,hr,hq){if(typeof hr=="string"){hr={type:hr,preventDefault:function(){this.defaultPrevented=true}}}aO(i,hq||hr.type,i,hr);return b6(hr)||hr.codemirrorIgnore}function ab(hr){var hq=hr._handlers&&hr._handlers.cursorActivity;if(!hq){return}var ht=hr.curOp.cursorActivityHandlers||(hr.curOp.cursorActivityHandlers=[]);for(var hs=0;hs<hq.length;++hs){if(dR(ht,hq[hs])==-1){ht.push(hq[hs])}}}function f9(hq,i){return eZ(hq,i).length>0}function bT(i){i.prototype.on=function(hq,hr){cj(this,hq,hr)};i.prototype.off=function(hq,hr){eS(this,hq,hr)}}function c9(i){if(i.preventDefault){i.preventDefault()}else{i.returnValue=false}}function dZ(i){if(i.stopPropagation){i.stopPropagation()}else{i.cancelBubble=true}}function b6(i){return i.defaultPrevented!=null?i.defaultPrevented:i.returnValue==false}function e6(i){c9(i);dZ(i)}function Q(i){return i.target||i.srcElement}function gJ(hq){var i=hq.which;if(i==null){if(hq.button&1){i=1}else{if(hq.button&2){i=3}else{if(hq.button&4){i=2}}}}if(cu&&hq.ctrlKey&&i==1){i=3}return i}var fx=function(){if(ei&&m<9){return false}var i=g5("div");return"draggable" in i||"dragDrop" in i}();var gH;function bF(i){if(gH==null){var hr=g5("span","\u200b");ce(i,g5("span",[hr,document.createTextNode("x")]));if(i.firstChild.offsetHeight!=0){gH=hr.offsetWidth<=1&&hr.offsetHeight>2&&!(ei&&m<8)}}var hq=gH?g5("span","\u200b"):g5("span","\u00a0",null,"display: inline-block; width: 1px; margin-right: -1px");hq.setAttribute("cm-text","");return hq}var gI;function b9(hs){if(gI!=null){return gI}var i=ce(hs,document.createTextNode("A\u062eA"));var hr=cO(i,0,1).getBoundingClientRect();var hq=cO(i,1,2).getBoundingClientRect();eD(hs);if(!hr||hr.left==hr.right){return false}return gI=(hq.right-hr.right<3)}var gO="\n\nb".split(/\n/).length!=3?function(hu){var hv=0,i=[],ht=hu.length;while(hv<=ht){var hs=hu.indexOf("\n",hv);if(hs==-1){hs=hu.length}var hr=hu.slice(hv,hu.charAt(hs-1)=="\r"?hs-1:hs);var hq=hr.indexOf("\r");if(hq!=-1){i.push(hr.slice(0,hq));hv+=hq+1}else{i.push(hr);hv=hs+1}}return i}:function(i){return i.split(/\r\n?|\n/)};var bL=window.getSelection?function(hq){try{return hq.selectionStart!=hq.selectionEnd}catch(i){return false}}:function(hr){var i;try{i=hr.ownerDocument.selection.createRange()}catch(hq){}if(!i||i.parentElement()!=hr){return false}return i.compareEndPoints("StartToEnd",i)!=0};var dI=(function(){var i=g5("div");if("oncopy" in i){return true}i.setAttribute("oncopy","return;");return typeof i.oncopy=="function"})();var fW=null;function aW(hq){if(fW!=null){return fW}var hr=ce(hq,g5("span","x"));var hs=hr.getBoundingClientRect();var i=cO(hr,0,1).getBoundingClientRect();return fW=Math.abs(hs.left-i.left)>1}var d1={};var a5={};function fa(i,hq){if(arguments.length>2){hq.dependencies=Array.prototype.slice.call(arguments,2)}d1[i]=hq}function bE(hq,i){a5[hq]=i}function hh(i){if(typeof i=="string"&&a5.hasOwnProperty(i)){i=a5[i]}else{if(i&&typeof i.name=="string"&&a5.hasOwnProperty(i.name)){var hq=a5[i.name];if(typeof hq=="string"){hq={name:hq}}i=cM(hq,i);i.name=hq.name}else{if(typeof i=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(i)){return hh("application/xml")}else{if(typeof i=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(i)){return hh("application/json")}}}}if(typeof i=="string"){return{name:i}}else{return i||{name:"null"}}}function gr(hr,hq){hq=hh(hq);var ht=d1[hq.name];if(!ht){return gr(hr,"text/plain")}var hu=ht(hr,hq);if(dY.hasOwnProperty(hq.name)){var hs=dY[hq.name];for(var hv in hs){if(!hs.hasOwnProperty(hv)){continue}if(hu.hasOwnProperty(hv)){hu["_"+hv]=hu[hv]}hu[hv]=hs[hv]}}hu.name=hq.name;if(hq.helperType){hu.helperType=hq.helperType}if(hq.modeProps){for(var i in hq.modeProps){hu[i]=hq.modeProps[i]}}return hu}var dY={};function fn(hr,hq){var i=dY.hasOwnProperty(hr)?dY[hr]:(dY[hr]={});aZ(hq,i)}function cq(hs,i){if(i===true){return i}if(hs.copyState){return hs.copyState(i)}var hr={};for(var ht in i){var hq=i[ht];if(hq instanceof Array){hq=hq.concat([])}hr[ht]=hq}return hr}function hd(hr,i){var hq;while(hr.innerMode){hq=hr.innerMode(i);if(!hq||hq.mode==hr){break}i=hq.state;hr=hq.mode}return hq||{mode:hr,state:i}}function cn(hr,hq,i){return hr.startState?hr.startState(hq,i):true}var fH=function(i,hr,hq){this.pos=this.start=0;this.string=i;this.tabSize=hr||8;this.lastColumnPos=this.lastColumnValue=0;this.lineStart=0;this.lineOracle=hq};fH.prototype.eol=function(){return this.pos>=this.string.length};fH.prototype.sol=function(){return this.pos==this.lineStart};fH.prototype.peek=function(){return this.string.charAt(this.pos)||undefined};fH.prototype.next=function(){if(this.pos<this.string.length){return this.string.charAt(this.pos++)}};fH.prototype.eat=function(i){var hr=this.string.charAt(this.pos);var hq;if(typeof i=="string"){hq=hr==i}else{hq=hr&&(i.test?i.test(hr):i(hr))}if(hq){++this.pos;return hr}};fH.prototype.eatWhile=function(i){var hq=this.pos;while(this.eat(i)){}return this.pos>hq};fH.prototype.eatSpace=function(){var hq=this;var i=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos))){++hq.pos}return this.pos>i};fH.prototype.skipToEnd=function(){this.pos=this.string.length};fH.prototype.skipTo=function(i){var hq=this.string.indexOf(i,this.pos);if(hq>-1){this.pos=hq;return true}};fH.prototype.backUp=function(i){this.pos-=i};fH.prototype.column=function(){if(this.lastColumnPos<this.start){this.lastColumnValue=cd(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue);this.lastColumnPos=this.start}return this.lastColumnValue-(this.lineStart?cd(this.string,this.lineStart,this.tabSize):0)};fH.prototype.indentation=function(){return cd(this.string,null,this.tabSize)-(this.lineStart?cd(this.string,this.lineStart,this.tabSize):0)};fH.prototype.match=function(ht,hq,i){if(typeof ht=="string"){var hu=function(hv){return i?hv.toLowerCase():hv};var hs=this.string.substr(this.pos,ht.length);if(hu(hs)==hu(ht)){if(hq!==false){this.pos+=ht.length}return true}}else{var hr=this.string.slice(this.pos).match(ht);if(hr&&hr.index>0){return null}if(hr&&hq!==false){this.pos+=hr[0].length}return hr}};fH.prototype.current=function(){return this.string.slice(this.start,this.pos)};fH.prototype.hideFirstChars=function(hq,i){this.lineStart+=hq;try{return i()}finally{this.lineStart-=hq}};fH.prototype.lookAhead=function(hq){var i=this.lineOracle;return i&&i.lookAhead(hq)};fH.prototype.baseToken=function(){var i=this.lineOracle;return i&&i.baseToken(this.pos)};var aQ=function(hq,i){this.state=hq;this.lookAhead=i};var ag=function(hs,hr,i,hq){this.state=hr;this.doc=hs;this.line=i;this.maxLookAhead=hq||0;this.baseTokens=null;this.baseTokenPos=1};ag.prototype.lookAhead=function(hq){var i=this.doc.getLine(this.line+hq);if(i!=null&&hq>this.maxLookAhead){this.maxLookAhead=hq}return i};ag.prototype.baseToken=function(hr){var hq=this;if(!this.baseTokens){return null}while(this.baseTokens[this.baseTokenPos]<=hr){hq.baseTokenPos+=2}var i=this.baseTokens[this.baseTokenPos+1];return{type:i&&i.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-hr}};ag.prototype.nextLine=function(){this.line++;if(this.maxLookAhead>0){this.maxLookAhead--}};ag.fromSaved=function(hr,hq,i){if(hq instanceof aQ){return new ag(hr,cq(hr.mode,hq.state),i,hq.lookAhead)}else{return new ag(hr,cq(hr.mode,hq),i)}};ag.prototype.save=function(hq){var i=hq!==false?cq(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new aQ(i,this.maxLookAhead):i};function gp(hv,hx,hq,ht){var hw=[hv.state.modeGen],hs={};x(hv,hx.text,hv.doc.mode,hq,function(hy,hz){return hw.push(hy,hz)},hs,ht);var i=hq.state;var hu=function(hB){hq.baseTokens=hw;var hz=hv.state.overlays[hB],hA=1,hy=0;hq.state=true;x(hv,hx.text,hz.mode,hq,function(hC,hE){var hG=hA;while(hy<hC){var hD=hw[hA];if(hD>hC){hw.splice(hA,1,hC,hw[hA+1],hD)}hA+=2;hy=Math.min(hC,hD)}if(!hE){return}if(hz.opaque){hw.splice(hG,hA-hG,hC,"overlay "+hE);hA=hG+2}else{for(;hG<hA;hG+=2){var hF=hw[hG+1];hw[hG+1]=(hF?hF+" ":"")+"overlay "+hE}}},hs);hq.state=i;hq.baseTokens=null;hq.baseTokenPos=1};for(var hr=0;hr<hv.state.overlays.length;++hr){hu(hr)}return{styles:hw,classes:hs.bgClass||hs.textClass?hs:null}}function dE(hq,hs,hu){if(!hs.styles||hs.styles[0]!=hq.state.modeGen){var ht=fL(hq,b8(hs));var hr=hs.text.length>hq.options.maxHighlightLength&&cq(hq.doc.mode,ht.state);var i=gp(hq,hs,ht);if(hr){ht.state=hr}hs.stateAfter=ht.save(!hr);hs.styles=i.styles;if(i.classes){hs.styleClasses=i.classes}else{if(hs.styleClasses){hs.styleClasses=null}}if(hu===hq.doc.highlightFrontier){hq.doc.modeFrontier=Math.max(hq.doc.modeFrontier,++hq.doc.highlightFrontier)}}return hs.styles}function fL(i,hw,hq){var hu=i.doc,ht=i.display;if(!hu.mode.startState){return new ag(hu,true,hw)}var hv=c1(i,hw,hq);var hs=hv>hu.first&&f4(hu,hv-1).stateAfter;var hr=hs?ag.fromSaved(hu,hs,hv):new ag(hu,cn(hu.mode),hv);hu.iter(hv,hw,function(hx){d6(i,hx.text,hr);var hy=hr.line;hx.stateAfter=hy==hw-1||hy%5==0||hy>=ht.viewFrom&&hy<ht.viewTo?hr.save():null;hr.nextLine()});if(hq){hu.modeFrontier=hr.line}return hr}function d6(i,hu,hr,hq){var ht=i.doc.mode;var hs=new fH(hu,i.options.tabSize,hr);hs.start=hs.pos=hq||0;if(hu==""){ge(ht,hr.state)}while(!hs.eol()){fl(ht,hs,hr.state);hs.start=hs.pos}}function ge(hr,hq){if(hr.blankLine){return hr.blankLine(hq)}if(!hr.innerMode){return}var i=hd(hr,hq);if(i.mode.blankLine){return i.mode.blankLine(i.state)}}function fl(hv,hu,ht,hq){for(var hr=0;hr<10;hr++){if(hq){hq[0]=hd(hv,ht).mode}var hs=hv.token(hu,ht);if(hu.pos>hu.start){return hs}}throw new Error("Mode "+hv.name+" failed to advance stream.")}var dH=function(hr,i,hq){this.start=hr.start;this.end=hr.pos;this.string=hr.current();this.type=i||null;this.state=hq};function cT(hx,hv,hs,hr){var hw=hx.doc,ht=hw.mode,i;hv=gD(hw,hv);var hz=f4(hw,hv.line),hq=fL(hx,hv.line,hs);var hy=new fH(hz.text,hx.options.tabSize,hq),hu;if(hr){hu=[]}while((hr||hy.pos<hv.ch)&&!hy.eol()){hy.start=hy.pos;i=fl(ht,hy,hq.state);if(hr){hu.push(new dH(hy,i,cq(hw.mode,hq.state)))}}return hr?hu:new dH(hy,i,hq.state)}function dS(hr,hq){if(hr){for(;;){var i=hr.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!i){break}hr=hr.slice(0,i.index)+hr.slice(i.index+i[0].length);var hs=i[1]?"bgClass":"textClass";if(hq[hs]==null){hq[hs]=i[2]}else{if(!(new RegExp("(?:^|s)"+i[2]+"(?:$|s)")).test(hq[hs])){hq[hs]+=" "+i[2]}}}}return hr}function x(hz,hB,hu,hr,hv,hs,ht){var hq=hu.flattenSpans;if(hq==null){hq=hz.options.flattenSpans}var hx=0,hw=null;var hA=new fH(hB,hz.options.tabSize,hr),i;var hD=hz.options.addModeClass&&[null];if(hB==""){dS(ge(hu,hr.state),hs)}while(!hA.eol()){if(hA.pos>hz.options.maxHighlightLength){hq=false;if(ht){d6(hz,hB,hr,hA.pos)}hA.pos=hB.length;i=null}else{i=dS(fl(hu,hA,hr.state,hD),hs)}if(hD){var hC=hD[0].name;if(hC){i="m-"+(i?hC+" "+i:hC)}}if(!hq||hw!=i){while(hx<hA.start){hx=Math.min(hA.start,hx+5000);hv(hx,hw)}hw=i}hA.start=hA.pos}while(hx<hA.pos){var hy=Math.min(hA.pos,hx+5000);hv(hy,hw);hx=hy}}function c1(hw,hq,ht){var hr,hu,hv=hw.doc;var hs=ht?-1:hq-(hw.doc.mode.innerMode?1000:100);for(var hz=hq;hz>hs;--hz){if(hz<=hv.first){return hv.first}var hy=f4(hv,hz-1),i=hy.stateAfter;if(i&&(!ht||hz+(i instanceof aQ?i.lookAhead:0)<=hv.modeFrontier)){return hz}var hx=cd(hy.text,null,hw.options.tabSize);if(hu==null||hr>hx){hu=hz-1;hr=hx}}return hu}function hj(hr,ht){hr.modeFrontier=Math.min(hr.modeFrontier,ht);if(hr.highlightFrontier<ht-10){return}var hs=hr.first;for(var i=ht-1;i>hs;i--){var hq=f4(hr,i).stateAfter;if(hq&&(!(hq instanceof aQ)||i+hq.lookAhead<ht)){hs=i+1;break}}hr.highlightFrontier=Math.min(hr.highlightFrontier,hs)}var ha=function(hr,hq,i){this.text=hr;dy(this,hq);this.height=i?i(this):1};ha.prototype.lineNo=function(){return b8(this)};bT(ha);function e2(hq,ht,hr,i){hq.text=ht;if(hq.stateAfter){hq.stateAfter=null}if(hq.styles){hq.styles=null}if(hq.order!=null){hq.order=null}he(hq);dy(hq,hr);var hs=i?i(hq):1;if(hs!=hq.height){hb(hq,hs)}}function bV(i){i.parent=null;he(i)}var ew={};var cp={};function fK(hr,hq){if(!hr||/^\s*$/.test(hr)){return null}var i=hq.addModeClass?cp:ew;return i[hr]||(i[hr]=hr.replace(/\S+/g,"cm-$&"))}function fF(hw,hv){var hu=hc("span",null,null,dv?"padding-right: .1px":null);var ht={pre:hc("pre",[hu],"CodeMirror-line"),content:hu,col:0,pos:0,cm:hw,trailingSpace:false,splitSpaces:(ei||dv)&&hw.getOption("lineWrapping")};hv.measure={};for(var hs=0;hs<=(hv.rest?hv.rest.length:0);hs++){var hy=hs?hv.rest[hs-1]:hv.line,hr=(void 0);ht.pos=0;ht.addToken=u;if(b9(hw.display.measure)&&(hr=a(hy,hw.doc.direction))){ht.addToken=aa(ht.addToken,hr)}ht.map=[];var hq=hv!=hw.display.externalMeasured&&b8(hy);bG(hy,ht,dE(hw,hy,hq));if(hy.styleClasses){if(hy.styleClasses.bgClass){ht.bgClass=gS(hy.styleClasses.bgClass,ht.bgClass||"")}if(hy.styleClasses.textClass){ht.textClass=gS(hy.styleClasses.textClass,ht.textClass||"")}}if(ht.map.length==0){ht.map.push(0,0,ht.content.appendChild(bF(hw.display.measure)))}if(hs==0){hv.measure.map=ht.map;hv.measure.cache={}}else{(hv.measure.maps||(hv.measure.maps=[])).push(ht.map);(hv.measure.caches||(hv.measure.caches=[])).push({})}}if(dv){var hx=ht.content.lastChild;if(/\bcm-tab\b/.test(hx.className)||(hx.querySelector&&hx.querySelector(".cm-tab"))){ht.content.className="cm-tab-wrap-hack"}}aO(hw,"renderLine",hw,hv.line,ht.pre);if(ht.pre.className){ht.textClass=gS(ht.pre.className,ht.textClass||"")}return ht}function f3(hq){var i=g5("span","\u2022","cm-invalidchar");i.title="\\u"+hq.charCodeAt(0).toString(16);i.setAttribute("aria-label",i.title);return i}function u(hA,hv,hF,hC,hy,hI,hu){if(!hv){return}var hE=hA.splitSpaces?c8(hv,hA.trailingSpace):hv;var i=hA.cm.state.specialChars,hq=false;var hD;if(!i.test(hv)){hA.col+=hv.length;hD=document.createTextNode(hE);hA.map.push(hA.pos,hA.pos+hv.length,hD);if(ei&&m<9){hq=true}hA.pos+=hv.length}else{hD=document.createDocumentFragment();var hs=0;while(true){i.lastIndex=hs;var hB=i.exec(hv);var hH=hB?hB.index-hs:hv.length-hs;if(hH){var hx=document.createTextNode(hE.slice(hs,hs+hH));if(ei&&m<9){hD.appendChild(g5("span",[hx]))}else{hD.appendChild(hx)}hA.map.push(hA.pos,hA.pos+hH,hx);hA.col+=hH;hA.pos+=hH}if(!hB){break}hs+=hH+1;var hG=(void 0);if(hB[0]=="\t"){var hz=hA.cm.options.tabSize,hw=hz-hA.col%hz;hG=hD.appendChild(g5("span",cS(hw),"cm-tab"));hG.setAttribute("role","presentation");hG.setAttribute("cm-text","\t");hA.col+=hw}else{if(hB[0]=="\r"||hB[0]=="\n"){hG=hD.appendChild(g5("span",hB[0]=="\r"?"\u240d":"\u2424","cm-invalidchar"));hG.setAttribute("cm-text",hB[0]);hA.col+=1}else{hG=hA.cm.options.specialCharPlaceholder(hB[0]);hG.setAttribute("cm-text",hB[0]);if(ei&&m<9){hD.appendChild(g5("span",[hG]))}else{hD.appendChild(hG)}hA.col+=1}}hA.map.push(hA.pos,hA.pos+1,hG);hA.pos++}}hA.trailingSpace=hE.charCodeAt(hv.length-1)==32;if(hF||hC||hy||hq||hu){var hr=hF||"";if(hC){hr+=hC}if(hy){hr+=hy}var ht=g5("span",[hD],hr,hu);if(hI){ht.title=hI}return hA.content.appendChild(ht)}hA.content.appendChild(hD)}function c8(hv,hu){if(hv.length>1&&!/  /.test(hv)){return hv}var hr=hu,hq="";for(var hs=0;hs<hv.length;hs++){var ht=hv.charAt(hs);if(ht==" "&&hr&&(hs==hv.length-1||hv.charCodeAt(hs+1)==32)){ht="\u00a0"}hq+=ht;hr=ht==" "}return hq}function aa(hq,i){return function(hy,hA,hr,hv,hB,hz,hx){hr=hr?hr+" cm-force-border":"cm-force-border";var hs=hy.pos,hu=hs+hA.length;for(;;){var ht=(void 0);for(var hw=0;hw<i.length;hw++){ht=i[hw];if(ht.to>hs&&ht.from<=hs){break}}if(ht.to>=hu){return hq(hy,hA,hr,hv,hB,hz,hx)}hq(hy,hA.slice(0,ht.to-hs),hr,hv,null,hz,hx);hv=null;hA=hA.slice(ht.to-hs);hs=ht.to}}}function al(hq,hs,i,hr){var ht=!hr&&i.widgetNode;if(ht){hq.map.push(hq.pos,hq.pos+hs,ht)}if(!hr&&hq.cm.display.input.needsContentAttribute){if(!ht){ht=hq.content.appendChild(document.createElement("span"))}ht.setAttribute("cm-marker",i.id)}if(ht){hq.cm.display.input.setUneditable(ht);hq.content.appendChild(ht)}hq.pos+=hs;hq.trailingSpace=false}function bG(hB,hI,hA){var hv=hB.markedSpans,hy=hB.text,hG=0;if(!hv){for(var hw=1;hw<hA.length;hw+=2){hI.addToken(hI,hy.slice(hG,hG=hA[hw]),fK(hA[hw+1],hI.cm.options))}return}var hM=hy.length,hu=0,hL=1,hE="",hN,hC;var hR=0,hq,hQ,hF,hS,hs;for(;;){if(hR==hu){hq=hQ=hF=hS=hC="";hs=null;hR=Infinity;var hx=[],hz=(void 0);for(var hJ=0;hJ<hv.length;++hJ){var hK=hv[hJ],hH=hK.marker;if(hH.type=="bookmark"&&hK.from==hu&&hH.widgetNode){hx.push(hH)}else{if(hK.from<=hu&&(hK.to==null||hK.to>hu||hH.collapsed&&hK.to==hu&&hK.from==hu)){if(hK.to!=null&&hK.to!=hu&&hR>hK.to){hR=hK.to;hQ=""}if(hH.className){hq+=" "+hH.className}if(hH.css){hC=(hC?hC+";":"")+hH.css}if(hH.startStyle&&hK.from==hu){hF+=" "+hH.startStyle}if(hH.endStyle&&hK.to==hR){(hz||(hz=[])).push(hH.endStyle,hK.to)}if(hH.title&&!hS){hS=hH.title}if(hH.collapsed&&(!hs||eq(hs.marker,hH)<0)){hs=hK}}else{if(hK.from>hu&&hR>hK.from){hR=hK.from}}}}if(hz){for(var hP=0;hP<hz.length;hP+=2){if(hz[hP+1]==hR){hQ+=" "+hz[hP]}}}if(!hs||hs.from==hu){for(var hO=0;hO<hx.length;++hO){al(hI,0,hx[hO])}}if(hs&&(hs.from||0)==hu){al(hI,(hs.to==null?hM+1:hs.to)-hu,hs.marker,hs.from==null);if(hs.to==null){return}if(hs.to==hu){hs=false}}}if(hu>=hM){break}var hD=Math.min(hM,hR);while(true){if(hE){var hr=hu+hE.length;if(!hs){var ht=hr>hD?hE.slice(0,hD-hu):hE;hI.addToken(hI,ht,hN?hN+hq:hq,hF,hu+ht.length==hR?hQ:"",hS,hC)}if(hr>=hD){hE=hE.slice(hD-hu);hu=hD;break}hu=hr;hF=""}hE=hy.slice(hG,hG=hA[hL++]);hN=fK(hA[hL++],hI.cm.options)}}}function bO(hr,i,hq){this.line=i;this.rest=g(i);this.size=this.rest?b8(gy(this.rest))-hq+1:1;this.node=this.text=null;this.hidden=gl(hr,i)}function fJ(i,hv,hu){var ht=[],hr;for(var hs=hv;hs<hu;hs=hr){var hq=new bO(i.doc,f4(i.doc,hs),hs);hr=hs+hq.size;ht.push(hq)}return ht}var bI=null;function fg(i){if(bI){bI.ops.push(i)}else{i.ownsGroup=bI={ops:[i],delayedCallbacks:[]}}}function dp(ht){var hs=ht.delayedCallbacks,hr=0;do{for(;hr<hs.length;hr++){hs[hr].call(null)}for(var hq=0;hq<ht.ops.length;hq++){var hu=ht.ops[hq];if(hu.cursorActivityHandlers){while(hu.cursorActivityCalled<hu.cursorActivityHandlers.length){hu.cursorActivityHandlers[hu.cursorActivityCalled++].call(null,hu.cm)}}}}while(hr<hs.length)}function ck(hr,hq){var i=hr.ownsGroup;if(!i){return}try{dp(i)}finally{bI=null;hq(i)}}var bS=null;function am(hw,hu){var hq=eZ(hw,hu);if(!hq.length){return}var hs=Array.prototype.slice.call(arguments,2),hv;if(bI){hv=bI.delayedCallbacks}else{if(bS){hv=bS}else{hv=bS=[];setTimeout(aX,0)}}var hr=function(hx){hv.push(function(){return hq[hx].apply(null,hs)})};for(var ht=0;ht<hq.length;++ht){hr(ht)}}function aX(){var hq=bS;bS=null;for(var hr=0;hr<hq.length;++hr){hq[hr]()}}function aj(i,hr,ht,hu){for(var hq=0;hq<hr.changes.length;hq++){var hs=hr.changes[hq];if(hs=="text"){ga(i,hr)}else{if(hs=="gutter"){dO(i,hr,ht,hu)}else{if(hs=="class"){ed(i,hr)}else{if(hs=="widget"){ax(i,hr,hu)}}}}}hr.changes=null}function gA(i){if(i.node==i.text){i.node=g5("div",null,null,"position: relative");if(i.text.parentNode){i.text.parentNode.replaceChild(i.node,i.text)}i.node.appendChild(i.text);if(ei&&m<8){i.node.style.zIndex=2}}return i.node}function fc(i,hr){var hq=hr.bgClass?hr.bgClass+" "+(hr.line.bgClass||""):hr.line.bgClass;if(hq){hq+=" CodeMirror-linebackground"}if(hr.background){if(hq){hr.background.className=hq}else{hr.background.parentNode.removeChild(hr.background);hr.background=null}}else{if(hq){var hs=gA(hr);hr.background=hs.insertBefore(g5("div",null,hq),hs.firstChild);i.display.input.setUneditable(hr.background)}}}function ev(i,hq){var hr=i.display.externalMeasured;if(hr&&hr.line==hq.line){i.display.externalMeasured=null;hq.measure=hr.measure;return hr.built}return fF(i,hq)}function ga(i,hs){var hq=hs.text.className;var hr=ev(i,hs);if(hs.text==hs.node){hs.node=hr.pre}hs.text.parentNode.replaceChild(hr.pre,hs.text);hs.text=hr.pre;if(hr.bgClass!=hs.bgClass||hr.textClass!=hs.textClass){hs.bgClass=hr.bgClass;hs.textClass=hr.textClass;ed(i,hs)}else{if(hq){hs.text.className=hq}}}function ed(hq,hr){fc(hq,hr);if(hr.line.wrapClass){gA(hr).className=hr.line.wrapClass}else{if(hr.node!=hr.text){hr.node.className=""}}var i=hr.textClass?hr.textClass+" "+(hr.line.textClass||""):hr.line.textClass;hr.text.className=i||""}function dO(hx,hv,hu,hw){if(hv.gutter){hv.node.removeChild(hv.gutter);hv.gutter=null}if(hv.gutterBackground){hv.node.removeChild(hv.gutterBackground);hv.gutterBackground=null}if(hv.line.gutterClass){var hq=gA(hv);hv.gutterBackground=g5("div",null,"CodeMirror-gutter-background "+hv.line.gutterClass,("left: "+(hx.options.fixedGutter?hw.fixedPos:-hw.gutterTotalWidth)+"px; width: "+(hw.gutterTotalWidth)+"px"));hx.display.input.setUneditable(hv.gutterBackground);hq.insertBefore(hv.gutterBackground,hv.text)}var hs=hv.line.gutterMarkers;if(hx.options.lineNumbers||hs){var hy=gA(hv);var ht=hv.gutter=g5("div",null,"CodeMirror-gutter-wrapper",("left: "+(hx.options.fixedGutter?hw.fixedPos:-hw.gutterTotalWidth)+"px"));hx.display.input.setUneditable(ht);hy.insertBefore(ht,hv.text);if(hv.line.gutterClass){ht.className+=" "+hv.line.gutterClass}if(hx.options.lineNumbers&&(!hs||!hs["CodeMirror-linenumbers"])){hv.lineNumber=ht.appendChild(g5("div",e8(hx.options,hu),"CodeMirror-linenumber CodeMirror-gutter-elt",("left: "+(hw.gutterLeft["CodeMirror-linenumbers"])+"px; width: "+(hx.display.lineNumInnerWidth)+"px")))}if(hs){for(var hr=0;hr<hx.options.gutters.length;++hr){var i=hx.options.gutters[hr],hz=hs.hasOwnProperty(i)&&hs[i];if(hz){ht.appendChild(g5("div",[hz],"CodeMirror-gutter-elt",("left: "+(hw.gutterLeft[i])+"px; width: "+(hw.gutterWidth[i])+"px")))}}}}}function ax(i,hq,ht){if(hq.alignable){hq.alignable=null}for(var hs=hq.node.firstChild,hr=(void 0);hs;hs=hr){hr=hs.nextSibling;if(hs.className=="CodeMirror-linewidget"){hq.node.removeChild(hs)}}gh(i,hq,ht)}function aP(i,hr,hs,ht){var hq=ev(i,hr);hr.text=hr.node=hq.pre;if(hq.bgClass){hr.bgClass=hq.bgClass}if(hq.textClass){hr.textClass=hq.textClass}ed(i,hr);dO(i,hr,hs,ht);gh(i,hr,ht);return hr.node}function gh(hq,hs,ht){g9(hq,hs.line,hs,ht,true);if(hs.rest){for(var hr=0;hr<hs.rest.length;hr++){g9(hq,hs.rest[hr],hs,ht,false)}}}function g9(hy,hz,hv,hx,ht){if(!hz.widgets){return}var hq=gA(hv);for(var hs=0,hw=hz.widgets;hs<hw.length;++hs){var hu=hw[hs],hr=g5("div",[hu.node],"CodeMirror-linewidget");if(!hu.handleMouseEvents){hr.setAttribute("cm-ignore-events","true")}bZ(hu,hr,hv,hx);hy.display.input.setUneditable(hr);if(ht&&hu.above){hq.insertBefore(hr,hv.gutter||hv.text)}else{hq.appendChild(hr)}am(hu,"redraw")}}function bZ(hs,hr,i,ht){if(hs.noHScroll){(i.alignable||(i.alignable=[])).push(hr);var hq=ht.wrapperWidth;hr.style.left=ht.fixedPos+"px";if(!hs.coverGutter){hq-=ht.gutterTotalWidth;hr.style.paddingLeft=ht.gutterTotalWidth+"px"}hr.style.width=hq+"px"}if(hs.coverGutter){hr.style.zIndex=5;hr.style.position="relative";if(!hs.noHScroll){hr.style.marginLeft=-ht.gutterTotalWidth+"px"}}}function dt(hr){if(hr.height!=null){return hr.height}var i=hr.doc.cm;if(!i){return 0}if(!hg(document.body,hr.node)){var hq="position: relative;";if(hr.coverGutter){hq+="margin-left: -"+i.display.gutters.offsetWidth+"px;"}if(hr.noHScroll){hq+="width: "+i.display.wrapper.clientWidth+"px;"}ce(i.display.measure,g5("div",[hr.node],null,hq))}return hr.height=hr.node.parentNode.offsetHeight}function bo(hq,i){for(var hr=Q(i);hr!=hq.wrapper;hr=hr.parentNode){if(!hr||(hr.nodeType==1&&hr.getAttribute("cm-ignore-events")=="true")||(hr.parentNode==hq.sizer&&hr!=hq.mover)){return true}}}function fY(i){return i.lineSpace.offsetTop}function b2(i){return i.mover.offsetHeight-i.lineSpace.offsetHeight}function fU(hs){if(hs.cachedPaddingH){return hs.cachedPaddingH}var hr=ce(hs.measure,g5("pre","x"));var i=window.getComputedStyle?window.getComputedStyle(hr):hr.currentStyle;var hq={left:parseInt(i.paddingLeft),right:parseInt(i.paddingRight)};if(!isNaN(hq.left)&&!isNaN(hq.right)){hs.cachedPaddingH=hq}return hq}function dn(i){return eg-i.display.nativeBarWidth}function dU(i){return i.display.scroller.clientWidth-dn(i)-i.display.barWidth}function dq(i){return i.display.scroller.clientHeight-dn(i)-i.display.barHeight}function cH(hx,ht,hw){var hs=hx.options.lineWrapping;var hu=hs&&dU(hx);if(!ht.measure.heights||hs&&ht.measure.width!=hu){var hv=ht.measure.heights=[];if(hs){ht.measure.width=hu;var hz=ht.text.firstChild.getClientRects();for(var hq=0;hq<hz.length-1;hq++){var hy=hz[hq],hr=hz[hq+1];if(Math.abs(hy.bottom-hr.bottom)>2){hv.push((hy.bottom+hr.top)/2-hw.top)}}}hv.push(hw.bottom-hw.top)}}function cW(hs,hq,ht){if(hs.line==hq){return{map:hs.measure.map,cache:hs.measure.cache}}for(var hr=0;hr<hs.rest.length;hr++){if(hs.rest[hr]==hq){return{map:hs.measure.maps[hr],cache:hs.measure.caches[hr]}}}for(var hu=0;hu<hs.rest.length;hu++){if(b8(hs.rest[hu])>ht){return{map:hs.measure.maps[hu],cache:hs.measure.caches[hu],before:true}}}}function dx(i,hr){hr=z(hr);var ht=b8(hr);var hq=i.display.externalMeasured=new bO(i.doc,hr,ht);hq.lineN=ht;var hs=hq.built=fF(i,hq);hq.text=hs.pre;ce(i.display.lineMeasure,hs.pre);return hq}function eU(i,hq,hs,hr){return F(i,bi(i,hq),hs,hr)}function f1(i,hr){if(hr>=i.display.viewFrom&&hr<i.display.viewTo){return i.display.view[d0(i,hr)]}var hq=i.display.externalMeasured;if(hq&&hr>=hq.lineN&&hr<hq.lineN+hq.size){return hq}}function bi(i,hr){var hs=b8(hr);var hq=f1(i,hs);if(hq&&!hq.text){hq=null}else{if(hq&&hq.changes){aj(i,hq,hs,f2(i));i.curOp.forceUpdate=true}}if(!hq){hq=dx(i,hr)}var ht=cW(hq,hr,hs);return{line:hr,view:hq,rect:null,map:ht.map,cache:ht.cache,before:ht.before,hasHeights:false}}function F(i,hv,ht,hq,hs){if(hv.before){ht=-1}var hr=ht+(hq||""),hu;if(hv.cache.hasOwnProperty(hr)){hu=hv.cache[hr]}else{if(!hv.rect){hv.rect=hv.view.text.getBoundingClientRect()}if(!hv.hasHeights){cH(i,hv.view,hv.rect);hv.hasHeights=true}hu=l(i,hv,ht,hq);if(!hu.bogus){hv.cache[hr]=hu}}return{left:hu.left,right:hu.right,top:hs?hu.rtop:hu.top,bottom:hs?hu.rbottom:hu.bottom}}var fk={left:0,right:0,top:0,bottom:0};function aV(hr,hq,hx){var ht,hs,hv,hy,hu,hz;for(var hw=0;hw<hr.length;hw+=3){hu=hr[hw];hz=hr[hw+1];if(hq<hu){hs=0;hv=1;hy="left"}else{if(hq<hz){hs=hq-hu;hv=hs+1}else{if(hw==hr.length-3||hq==hz&&hr[hw+3]>hq){hv=hz-hu;hs=hv-1;if(hq>=hz){hy="right"}}}}if(hs!=null){ht=hr[hw+2];if(hu==hz&&hx==(ht.insertLeft?"left":"right")){hy=hx}if(hx=="left"&&hs==0){while(hw&&hr[hw-2]==hr[hw-3]&&hr[hw-1].insertLeft){ht=hr[(hw-=3)+2];hy="left"}}if(hx=="right"&&hs==hz-hu){while(hw<hr.length-3&&hr[hw+3]==hr[hw+4]&&!hr[hw+5].insertLeft){ht=hr[(hw+=3)+2];hy="right"}}break}}return{node:ht,start:hs,end:hv,collapse:hy,coverStart:hu,coverEnd:hz}}function fG(hr,hq){var ht=fk;if(hq=="left"){for(var hs=0;hs<hr.length;hs++){if((ht=hr[hs]).left!=ht.right){break}}}else{for(var hu=hr.length-1;hu>=0;hu--){if((ht=hr[hu]).left!=ht.right){break}}}return ht}function l(hy,hI,hB,hv){var hz=aV(hI.map,hB,hv);var hG=hz.node,hu=hz.start,ht=hz.end,hq=hz.collapse;var hr;if(hG.nodeType==3){for(var hw=0;hw<4;hw++){while(hu&&gd(hI.line.text.charAt(hz.coverStart+hu))){--hu}while(hz.coverStart+ht<hz.coverEnd&&gd(hI.line.text.charAt(hz.coverStart+ht))){++ht}if(ei&&m<9&&hu==0&&ht==hz.coverEnd-hz.coverStart){hr=hG.parentNode.getBoundingClientRect()}else{hr=fG(cO(hG,hu,ht).getClientRects(),hv)}if(hr.left||hr.right||hu==0){break}ht=hu;hu=hu-1;hq="right"}if(ei&&m<11){hr=fA(hy.display.measure,hr)}}else{if(hu>0){hq=hv="right"}var hs;if(hy.options.lineWrapping&&(hs=hG.getClientRects()).length>1){hr=hs[hv=="right"?hs.length-1:0]}else{hr=hG.getBoundingClientRect()}}if(ei&&m<9&&!hu&&(!hr||!hr.left&&!hr.right)){var hx=hG.parentNode.getClientRects()[0];if(hx){hr={left:hx.left,right:hx.left+ea(hy.display),top:hx.top,bottom:hx.bottom}}else{hr=fk}}var hE=hr.top-hI.rect.top,hC=hr.bottom-hI.rect.top;var hK=(hE+hC)/2;var hJ=hI.view.measure.heights;var hH=0;for(;hH<hJ.length-1;hH++){if(hK<hJ[hH]){break}}var hF=hH?hJ[hH-1]:0,hD=hJ[hH];var hA={left:(hq=="right"?hr.right:hr.left)-hI.rect.left,right:(hq=="left"?hr.left:hr.right)-hI.rect.left,top:hF,bottom:hD};if(!hr.left&&!hr.right){hA.bogus=true}if(!hy.options.singleCursorHeightPerLine){hA.rtop=hE;hA.rbottom=hC}return hA}function fA(hr,hs){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!aW(hr)){return hs}var hq=screen.logicalXDPI/screen.deviceXDPI;var i=screen.logicalYDPI/screen.deviceYDPI;return{left:hs.left*hq,right:hs.right*hq,top:hs.top*i,bottom:hs.bottom*i}}function aE(hr){if(hr.measure){hr.measure.cache={};hr.measure.heights=null;if(hr.rest){for(var hq=0;hq<hr.rest.length;hq++){hr.measure.caches[hq]={}}}}}function a0(hq){hq.display.externalMeasure=null;eD(hq.display.lineMeasure);for(var hr=0;hr<hq.display.view.length;hr++){aE(hq.display.view[hr])}}function ar(i){a0(i);i.display.cachedCharWidth=i.display.cachedTextHeight=i.display.cachedPaddingH=null;if(!i.options.lineWrapping){i.display.maxLineChanged=true}i.display.lineNumChars=null}function cX(){if(dL&&aY){return -(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft))}return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function cV(){if(dL&&aY){return -(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop))}return window.pageYOffset||(document.documentElement||document.body).scrollTop}function eh(hr){var hq=0;if(hr.widgets){for(var hs=0;hs<hr.widgets.length;++hs){if(hr.widgets[hs].above){hq+=dt(hr.widgets[hs])}}}return hq}function fD(hv,hs,hu,hq,hr){if(!hr){var hw=eh(hs);hu.top+=hw;hu.bottom+=hw}if(hq=="line"){return hu}if(!hq){hq="local"}var ht=b7(hs);if(hq=="local"){ht+=fY(hv.display)}else{ht-=hv.display.viewOffset}if(hq=="page"||hq=="window"){var i=hv.display.lineSpace.getBoundingClientRect();ht+=i.top+(hq=="window"?0:cV());var hx=i.left+(hq=="window"?0:cX());hu.left+=hx;hu.right+=hx}hu.top+=ht;hu.bottom+=ht;return hu}function hl(hq,ht,hr){if(hr=="div"){return ht}var hv=ht.left,hu=ht.top;if(hr=="page"){hv-=cX();hu-=cV()}else{if(hr=="local"||!hr){var hs=hq.display.sizer.getBoundingClientRect();hv+=hs.left;hu+=hs.top}}var i=hq.display.lineSpace.getBoundingClientRect();return{left:hv-i.left,top:hu-i.top}}function de(i,ht,hs,hr,hq){if(!hr){hr=f4(i.doc,ht.line)}return fD(i,hr,eU(i,hr,ht.ch,hq),hs)}function eu(hA,hy,hr,hv,hC,hw){hv=hv||f4(hA.doc,hy.line);if(!hC){hC=bi(hA,hv)}function ht(hF,hE){var hD=F(hA,hC,hF,hE?"right":"left",hw);if(hE){hD.left=hD.right}else{hD.right=hD.left}return fD(hA,hv,hD,hr)}var hu=a(hv,hA.doc.direction),i=hy.ch,hz=hy.sticky;if(i>=hv.text.length){i=hv.text.length;hz="before"}else{if(i<=0){i=0;hz="after"}}if(!hu){return ht(hz=="before"?i-1:i,hz=="before")}function hB(hG,hD,hH){var hE=hu[hD],hF=hE.level==1;return ht(hH?hG-1:hG,hF!=hH)}var hq=aS(hu,i,hz);var hx=fS;var hs=hB(i,hq,hz=="before");if(hx!=null){hs.other=hB(i,hx,hz!="before")}return hs}function ee(i,ht){var hs=0;ht=gD(i.doc,ht);if(!i.options.lineWrapping){hs=ea(i.display)*ht.ch}var hq=f4(i.doc,ht.line);var hr=b7(hq)+fY(i.display);return{left:hs,right:hs,top:hr,bottom:hr+hq.height}}function g3(i,hq,hs,hr,hu){var ht=ac(i,hq,hs);ht.xRel=hu;if(hr){ht.outside=true}return ht}function gL(hw,hu,ht){var hv=hw.doc;ht+=hw.display.viewOffset;if(ht<0){return g3(hv.first,0,null,true,-1)}var hs=b1(hv,ht),hx=hv.first+hv.size-1;if(hs>hx){return g3(hv.first+hv.size-1,f4(hv,hx).text.length,null,true,1)}if(hu<0){hu=0}var hr=f4(hv,hs);for(;;){var hy=du(hw,hr,hs,hu,ht);var hq=cE(hr,hy.ch+(hy.xRel>0?1:0));if(!hq){return hy}var i=hq.find(1);if(i.line==hs){return i}hr=f4(hv,hs=i.line)}}function bD(i,hr,ht,hu){hu-=eh(hr);var hq=hr.text.length;var hs=cP(function(hv){return F(i,ht,hv-1).bottom<=hu},hq,0);hq=cP(function(hv){return F(i,ht,hv).top>hu},hs,hq);return{begin:hs,end:hq}}function bB(i,hq,hs,ht){if(!hs){hs=bi(i,hq)}var hr=fD(i,hq,F(i,hs,ht),"line").top;return bD(i,hq,hs,hr)}function aA(hq,i,hs,hr){return hq.bottom<=hs?false:hq.top>hs?true:(hr?hq.left:hq.right)>i}function du(hs,hq,hw,hv,hu){hu-=b7(hq);var hA=bi(hs,hq);var hJ=eh(hq);var hH=0,hr=hq.text.length,hE=true;var hC=a(hq,hs.doc.direction);if(hC){var hB=(hs.options.lineWrapping?g0:gF)(hs,hq,hw,hA,hC,hv,hu);hE=hB.level!=1;hH=hE?hB.from:hB.to-1;hr=hE?hB.to:hB.from-1}var ht=null,hy=null;var hz=cP(function(hK){var hL=F(hs,hA,hK);hL.top+=hJ;hL.bottom+=hJ;if(!aA(hL,hv,hu,false)){return false}if(hL.top<=hu&&hL.left<=hv){ht=hK;hy=hL}return true},hH,hr);var i,hI,hG=false;if(hy){var hF=hv-hy.left<hy.right-hv,hx=hF==hE;hz=ht+(hx?0:1);hI=hx?"after":"before";i=hF?hy.left:hy.right}else{if(!hE&&(hz==hr||hz==hH)){hz++}hI=hz==0?"after":hz==hq.text.length?"before":(F(hs,hA,hz-(hE?1:0)).bottom+hJ<=hu)==hE?"after":"before";var hD=eu(hs,ac(hw,hz,hI),"line",hq,hA);i=hD.left;hG=hu<hD.top||hu>=hD.bottom}hz=eX(hq.text,hz,1);return g3(hw,hz,hI,hG,hv-i)}function gF(hy,hu,ht,hz,hs,hx,hw){var hv=cP(function(hC){var hA=hs[hC],hB=hA.level!=1;return aA(eu(hy,ac(ht,hB?hA.to:hA.from,hB?"before":"after"),"line",hu,hz),hx,hw,true)},0,hs.length-1);var hr=hs[hv];if(hv>0){var hq=hr.level!=1;var i=eu(hy,ac(ht,hq?hr.from:hr.to,hq?"after":"before"),"line",hu,hz);if(aA(i,hx,hw,true)&&i.top>hw){hr=hs[hv-1]}}return hr}function g0(hD,hy,hB,hG,hv,hC,hA){var hu=bD(hD,hy,hG,hA);var ht=hu.begin;var hw=hu.end;if(/\s/.test(hy.text.charAt(hw-1))){hw--}var hs=null,hE=null;for(var hx=0;hx<hv.length;hx++){var hq=hv[hx];if(hq.from>=hw||hq.to<=ht){continue}var hr=hq.level!=1;var hF=F(hD,hG,hr?Math.min(hw,hq.to)-1:Math.max(ht,hq.from)).right;var hz=hF<hC?hC-hF+1000000000:hF-hC;if(!hs||hE>hz){hs=hq;hE=hz}}if(!hs){hs=hv[hv.length-1]}if(hs.from<ht){hs={from:ht,to:hs.to,level:hs.level}}if(hs.to>hw){hs={from:hs.from,to:hw,level:hs.level}}return hs}var aR;function bb(hs){if(hs.cachedTextHeight!=null){return hs.cachedTextHeight}if(aR==null){aR=g5("pre");for(var hr=0;hr<49;++hr){aR.appendChild(document.createTextNode("x"));aR.appendChild(g5("br"))}aR.appendChild(document.createTextNode("x"))}ce(hs.measure,aR);var hq=aR.offsetHeight/50;if(hq>3){hs.cachedTextHeight=hq}eD(hs.measure);return hq||1}function ea(ht){if(ht.cachedCharWidth!=null){return ht.cachedCharWidth}var i=g5("span","xxxxxxxxxx");var hs=g5("pre",[i]);ce(ht.measure,hs);var hr=i.getBoundingClientRect(),hq=(hr.right-hr.left)/10;if(hq>2){ht.cachedCharWidth=hq}return hq||10}function f2(hq){var hv=hq.display,ht={},hs={};var hu=hv.gutters.clientLeft;for(var hw=hv.gutters.firstChild,hr=0;hw;hw=hw.nextSibling,++hr){ht[hq.options.gutters[hr]]=hw.offsetLeft+hw.clientLeft+hu;hs[hq.options.gutters[hr]]=hw.clientWidth}return{fixedPos:ey(hv),gutterTotalWidth:hv.gutters.offsetWidth,gutterLeft:ht,gutterWidth:hs,wrapperWidth:hv.wrapper.clientWidth}}function ey(i){return i.scroller.getBoundingClientRect().left-i.sizer.getBoundingClientRect().left}function br(i){var hr=bb(i.display),hq=i.options.lineWrapping;var hs=hq&&Math.max(5,i.display.scroller.clientWidth/ea(i.display)-3);return function(hu){if(gl(i.doc,hu)){return 0}var ht=0;if(hu.widgets){for(var hv=0;hv<hu.widgets.length;hv++){if(hu.widgets[hv].height){ht+=hu.widgets[hv].height}}}if(hq){return ht+(Math.ceil(hu.text.length/hs)||1)*hr}else{return ht+hr}}}function af(i){var hr=i.doc,hq=br(i);hr.iter(function(hs){var ht=hq(hs);if(ht!=hs.height){hb(hs,ht)}})}function cQ(hy,ht,hq,hr){var hu=hy.display;if(!hq&&Q(ht).getAttribute("cm-not-content")=="true"){return null}var hx,hv,i=hu.lineSpace.getBoundingClientRect();try{hx=ht.clientX-i.left;hv=ht.clientY-i.top}catch(ht){return null}var hw=gL(hy,hx,hv),hz;if(hr&&hw.xRel==1&&(hz=f4(hy.doc,hw.line).text).length==hw.ch){var hs=cd(hz,hz.length,hy.options.tabSize)-hz.length;hw=ac(hw.line,Math.max(0,Math.round((hx-fU(hy.display).left)/ea(hy.display))-hs))}return hw}function d0(hq,ht){if(ht>=hq.display.viewTo){return null}ht-=hq.display.viewFrom;if(ht<0){return null}var hr=hq.display.view;for(var hs=0;hs<hr.length;hs++){ht-=hr[hs].size;if(ht<0){return hs}}}function bW(i){i.display.input.showSelection(i.display.input.prepareSelection())}function gB(hx,hq){if(hq===void 0){hq=true}var hw=hx.doc,hy={};var hv=hy.cursors=document.createDocumentFragment();var hr=hy.selection=document.createDocumentFragment();for(var ht=0;ht<hw.sel.ranges.length;ht++){if(!hq&&ht==hw.sel.primIndex){continue}var hu=hw.sel.ranges[ht];if(hu.from().line>=hx.display.viewTo||hu.to().line<hx.display.viewFrom){continue}var hs=hu.empty();if(hs||hx.options.showCursorWhenSelecting){C(hx,hu.head,hv)}if(!hs){bX(hx,hu,hr)}}return hy}function C(i,hs,hr){var hu=eu(i,hs,"div",null,null,!i.options.singleCursorHeightPerLine);var ht=hr.appendChild(g5("div","\u00a0","CodeMirror-cursor"));ht.style.left=hu.left+"px";ht.style.top=hu.top+"px";ht.style.height=Math.max(0,hu.bottom-hu.top)*i.options.cursorHeight+"px";if(hu.other){var hq=hr.appendChild(g5("div","\u00a0","CodeMirror-cursor CodeMirror-secondarycursor"));hq.style.display="";hq.style.left=hu.other.left+"px";hq.style.top=hu.other.top+"px";hq.style.height=(hu.other.bottom-hu.other.top)*0.85+"px"}}function gV(hq,i){return hq.top-i.top||hq.left-i.left}function bX(hu,hA,hv){var hD=hu.display,hH=hu.doc;var i=document.createDocumentFragment();var hz=fU(hu.display),hs=hz.left;var hE=Math.max(hD.sizerWidth,dU(hu)-hD.sizer.offsetLeft)-hz.right;var ht=hH.direction=="ltr";function hB(hL,hK,hJ,hI){if(hK<0){hK=0}hK=Math.round(hK);hI=Math.round(hI);i.appendChild(g5("div",null,"CodeMirror-selected",("position: absolute; left: "+hL+"px;\n                             top: "+hK+"px; width: "+(hJ==null?hE-hL:hJ)+"px;\n                             height: "+(hI-hK)+"px")))}function hq(hR,hJ,hQ){var hN=f4(hH,hR);var hO=hN.text.length;var hI,hM;function hP(hT,hS){return de(hu,ac(hR,hT),"div",hN,hS)}function hK(hX,hS,hT){var hV=bB(hu,hN,null,hX);var hW=(hS=="ltr")==(hT=="after")?"left":"right";var hU=hT=="after"?hV.begin:hV.end-(/\s/.test(hN.text.charAt(hV.end-1))?2:1);return hP(hU,hW)[hW]}var hL=a(hN,hH.direction);eG(hL,hJ||0,hQ==null?hO:hQ,function(h3,hS,hY,h6){var h9=hY=="ltr";var h4=hP(h3,h9?"left":"right");var h2=hP(hS-1,h9?"right":"left");var h8=hJ==null&&h3==0,h5=hQ==null&&hS==hO;var hU=h6==0,hW=!hL||h6==hL.length-1;if(h2.top-h4.top<=3){var hV=(ht?h8:h5)&&hU;var hX=(ht?h5:h8)&&hW;var hT=hV?hs:(h9?h4:h2).left;var ia=hX?hE:(h9?h2:h4).right;hB(hT,h4.top,ia-hT,h4.bottom)}else{var h0,hZ,h7,h1;if(h9){h0=ht&&h8&&hU?hs:h4.left;hZ=ht?hE:hK(h3,hY,"before");h7=ht?hs:hK(hS,hY,"after");h1=ht&&h5&&hW?hE:h2.right}else{h0=!ht?hs:hK(h3,hY,"before");hZ=!ht&&h8&&hU?hE:h4.right;h7=!ht&&h5&&hW?hs:h2.left;h1=!ht?hE:hK(hS,hY,"after")}hB(h0,h4.top,hZ-h0,h4.bottom);if(h4.bottom<h2.top){hB(hs,h4.bottom,null,h2.top)}hB(h7,h2.top,h1-h7,h2.bottom)}if(!hI||gV(h4,hI)<0){hI=h4}if(gV(h2,hI)<0){hI=h2}if(!hM||gV(h4,hM)<0){hM=h4}if(gV(h2,hM)<0){hM=h2}});return{start:hI,end:hM}}var hG=hA.from(),hF=hA.to();if(hG.line==hF.line){hq(hG.line,hG.ch,hF.ch)}else{var hr=f4(hH,hG.line),hx=f4(hH,hF.line);var hw=z(hr)==z(hx);var hy=hq(hG.line,hG.ch,hw?hr.text.length+1:null).end;var hC=hq(hF.line,hw?0:null,hF.ch).start;if(hw){if(hy.top<hC.top-2){hB(hy.right,hy.top,null,hy.bottom);hB(hs,hC.top,hC.left,hC.bottom)}else{hB(hy.right,hy.top,hC.left-hy.right,hy.bottom)}}if(hy.bottom<hC.top){hB(hs,hy.bottom,null,hC.top)}}hv.appendChild(i)}function q(i){if(!i.state.focused){return}var hr=i.display;clearInterval(hr.blinker);var hq=true;hr.cursorDiv.style.visibility="";if(i.options.cursorBlinkRate>0){hr.blinker=setInterval(function(){return hr.cursorDiv.style.visibility=(hq=!hq)?"":"hidden"},i.options.cursorBlinkRate)}else{if(i.options.cursorBlinkRate<0){hr.cursorDiv.style.visibility="hidden"}}}function t(i){if(!i.state.focused){i.display.input.focus();c4(i)}}function at(i){i.state.delayingBlurEvent=true;setTimeout(function(){if(i.state.delayingBlurEvent){i.state.delayingBlurEvent=false;a8(i)}},100)}function c4(i,hq){if(i.state.delayingBlurEvent){i.state.delayingBlurEvent=false}if(i.options.readOnly=="nocursor"){return}if(!i.state.focused){aO(i,"focus",i,hq);i.state.focused=true;gs(i.display.wrapper,"CodeMirror-focused");if(!i.curOp&&i.display.selForContextMenu!=i.doc.sel){i.display.input.reset();if(dv){setTimeout(function(){return i.display.input.reset(true)},20)}}i.display.input.receivedFocus()}q(i)}function a8(i,hq){if(i.state.delayingBlurEvent){return}if(i.state.focused){aO(i,"blur",i,hq);i.state.focused=false;h(i.display.wrapper,"CodeMirror-focused")}clearInterval(i.display.blinker);setTimeout(function(){if(!i.state.focused){i.display.shift=false}},150)}function bm(hx){var hv=hx.display;var hr=hv.lineDiv.offsetTop;for(var hs=0;hs<hv.view.length;hs++){var hy=hv.view[hs],hz=(void 0);if(hy.hidden){continue}if(ei&&m<8){var hu=hy.node.offsetTop+hy.node.offsetHeight;hz=hu-hr;hr=hu}else{var ht=hy.node.getBoundingClientRect();hz=ht.bottom-ht.top}var hw=hy.line.height-hz;if(hz<2){hz=bb(hv)}if(hw>0.005||hw<-0.005){hb(hy.line,hz);cy(hy.line);if(hy.rest){for(var hq=0;hq<hy.rest.length;hq++){cy(hy.rest[hq])}}}}}function cy(hr){if(hr.widgets){for(var hs=0;hs<hr.widgets.length;++hs){var hq=hr.widgets[hs],ht=hq.node.parentNode;if(ht){hq.height=ht.offsetHeight}}}}function ct(hs,hw,hr){var ht=hr&&hr.top!=null?Math.max(0,hr.top):hs.scroller.scrollTop;ht=Math.floor(ht-fY(hs));var i=hr&&hr.bottom!=null?hr.bottom:ht+hs.wrapper.clientHeight;var hu=b1(hw,ht),hv=b1(hw,i);if(hr&&hr.ensure){var hq=hr.ensure.from.line,hx=hr.ensure.to.line;if(hq<hu){hu=hq;hv=b1(hw,b7(f4(hw,hq))+hs.wrapper.clientHeight)}else{if(Math.min(hx,hw.lastLine())>=hv){hu=b1(hw,b7(f4(hw,hx))-hs.wrapper.clientHeight);hv=hx}}}return{from:hu,to:Math.max(hv,hu+1)}}function fo(hy){var hw=hy.display,hx=hw.view;if(!hw.alignWidgets&&(!hw.gutters.firstChild||!hy.options.fixedGutter)){return}var hu=ey(hw)-hw.scroller.scrollLeft+hy.doc.scrollLeft;var hq=hw.gutters.offsetWidth,hr=hu+"px";for(var ht=0;ht<hx.length;ht++){if(!hx[ht].hidden){if(hy.options.fixedGutter){if(hx[ht].gutter){hx[ht].gutter.style.left=hr}if(hx[ht].gutterBackground){hx[ht].gutterBackground.style.left=hr}}var hv=hx[ht].alignable;if(hv){for(var hs=0;hs<hv.length;hs++){hv[hs].style.left=hr}}}}if(hy.options.fixedGutter){hw.gutters.style.left=(hu+hq)+"px"}}function eH(i){if(!i.options.lineNumbers){return false}var hu=i.doc,hq=e8(i.options,hu.first+hu.size-1),ht=i.display;if(hq.length!=ht.lineNumChars){var hv=ht.measure.appendChild(g5("div",[g5("div",hq)],"CodeMirror-linenumber CodeMirror-gutter-elt"));var hr=hv.firstChild.offsetWidth,hs=hv.offsetWidth-hr;ht.lineGutter.style.width="";ht.lineNumInnerWidth=Math.max(hr,ht.lineGutter.offsetWidth-hs)+1;ht.lineNumWidth=ht.lineNumInnerWidth+hs;ht.lineNumChars=ht.lineNumInnerWidth?hq.length:-1;ht.lineGutter.style.width=ht.lineNumWidth+"px";dz(i);return true}return false}function eI(hq,hs){if(a4(hq,"scrollCursorIntoView")){return}var hu=hq.display,hr=hu.sizer.getBoundingClientRect(),i=null;if(hs.top+hr.top<0){i=true}else{if(hs.bottom+hr.top>(window.innerHeight||document.documentElement.clientHeight)){i=false}}if(i!=null&&!gi){var ht=g5("div","\u200b",null,("position: absolute;\n                         top: "+(hs.top-hu.viewOffset-fY(hq.display))+"px;\n                         height: "+(hs.bottom-hs.top+dn(hq)+hu.barHeight)+"px;\n                         left: "+(hs.left)+"px; width: "+(Math.max(2,hs.right-hs.left))+"px;"));hq.display.lineSpace.appendChild(ht);ht.scrollIntoView(i);hq.display.lineSpace.removeChild(ht)}}function G(hA,hx,ht,hs){if(hs==null){hs=0}var hy;if(!hA.options.lineWrapping&&hx==ht){hx=hx.ch?ac(hx.line,hx.sticky=="before"?hx.ch-1:hx.ch,"after"):hx;ht=hx.sticky=="before"?ac(hx.line,hx.ch+1,"before"):hx}for(var hu=0;hu<5;hu++){var hv=false;var hz=eu(hA,hx);var i=!ht||ht==hx?hz:eu(hA,ht);hy={left:Math.min(hz.left,i.left),top:Math.min(hz.top,i.top)-hs,right:Math.max(hz.left,i.left),bottom:Math.max(hz.bottom,i.bottom)+hs};var hr=L(hA,hy);var hw=hA.doc.scrollTop,hq=hA.doc.scrollLeft;if(hr.scrollTop!=null){B(hA,hr.scrollTop);if(Math.abs(hA.doc.scrollTop-hw)>1){hv=true}}if(hr.scrollLeft!=null){bY(hA,hr.scrollLeft);if(Math.abs(hA.doc.scrollLeft-hq)>1){hv=true}}if(!hv){break}}return hy}function H(i,hq){var hr=L(i,hq);if(hr.scrollTop!=null){B(i,hr.scrollTop)}if(hr.scrollLeft!=null){bY(i,hr.scrollLeft)}}function L(hy,hx){var hv=hy.display,ht=bb(hy.display);if(hx.top<0){hx.top=0}var hr=hy.curOp&&hy.curOp.scrollTop!=null?hy.curOp.scrollTop:hv.scroller.scrollTop;var hA=dq(hy),hC={};if(hx.bottom-hx.top>hA){hx.bottom=hx.top+hA}var hq=hy.doc.height+b2(hv);var i=hx.top<ht,hu=hx.bottom>hq-ht;if(hx.top<hr){hC.scrollTop=i?0:hx.top}else{if(hx.bottom>hr+hA){var hw=Math.min(hx.top,(hu?hq:hx.bottom)-hA);if(hw!=hr){hC.scrollTop=hw}}}var hB=hy.curOp&&hy.curOp.scrollLeft!=null?hy.curOp.scrollLeft:hv.scroller.scrollLeft;var hz=dU(hy)-(hy.options.fixedGutter?hv.gutters.offsetWidth:0);var hs=hx.right-hx.left>hz;if(hs){hx.right=hx.left+hz}if(hx.left<10){hC.scrollLeft=0}else{if(hx.left<hB){hC.scrollLeft=Math.max(0,hx.left-(hs?0:10))}else{if(hx.right>hz+hB-3){hC.scrollLeft=hx.right+(hs?0:10)-hz}}}return hC}function db(i,hq){if(hq==null){return}gu(i);i.curOp.scrollTop=(i.curOp.scrollTop==null?i.doc.scrollTop:i.curOp.scrollTop)+hq}function gx(i){gu(i);var hq=i.getCursor();i.curOp.scrollToPos={from:hq,to:hq,margin:i.options.cursorScrollMargin}}function fy(hq,i,hr){if(i!=null||hr!=null){gu(hq)}if(i!=null){hq.curOp.scrollLeft=i}if(hr!=null){hq.curOp.scrollTop=hr}}function cB(i,hq){gu(i);i.curOp.scrollToPos=hq}function gu(i){var hq=i.curOp.scrollToPos;if(hq){i.curOp.scrollToPos=null;var hs=ee(i,hq.from),hr=ee(i,hq.to);cb(i,hs,hr,hq.margin)}}function cb(i,ht,hs,hr){var hq=L(i,{left:Math.min(ht.left,hs.left),top:Math.min(ht.top,hs.top)-hr,right:Math.max(ht.right,hs.right),bottom:Math.max(ht.bottom,hs.bottom)+hr});fy(i,hq.scrollLeft,hq.scrollTop)}function B(i,hq){if(Math.abs(i.doc.scrollTop-hq)<2){return}if(!cR){et(i,{top:hq})}T(i,hq,true);if(cR){et(i)}eR(i,100)}function T(i,hr,hq){hr=Math.min(i.display.scroller.scrollHeight-i.display.scroller.clientHeight,hr);if(i.display.scroller.scrollTop==hr&&!hq){return}i.doc.scrollTop=hr;i.display.scrollbars.setScrollTop(hr);if(i.display.scroller.scrollTop!=hr){i.display.scroller.scrollTop=hr}}function bY(i,hs,hr,hq){hs=Math.min(hs,i.display.scroller.scrollWidth-i.display.scroller.clientWidth);if((hr?hs==i.doc.scrollLeft:Math.abs(i.doc.scrollLeft-hs)<2)&&!hq){return}i.doc.scrollLeft=hs;fo(i);if(i.display.scroller.scrollLeft!=hs){i.display.scroller.scrollLeft=hs}i.display.scrollbars.setScrollLeft(hs)}function d8(i){var hs=i.display,hr=hs.gutters.offsetWidth;var hq=Math.round(i.doc.height+b2(i.display));return{clientHeight:hs.scroller.clientHeight,viewHeight:hs.wrapper.clientHeight,scrollWidth:hs.scroller.scrollWidth,clientWidth:hs.scroller.clientWidth,viewWidth:hs.wrapper.clientWidth,barLeft:i.options.fixedGutter?hr:0,docHeight:hq,scrollHeight:hq+dn(i)+hs.barHeight,nativeBarWidth:hs.nativeBarWidth,gutterWidth:hr}}var dT=function(hr,hq,i){this.cm=i;var hs=this.vert=g5("div",[g5("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar");var ht=this.horiz=g5("div",[g5("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");hs.tabIndex=ht.tabIndex=-1;hr(hs);hr(ht);cj(hs,"scroll",function(){if(hs.clientHeight){hq(hs.scrollTop,"vertical")}});cj(ht,"scroll",function(){if(ht.clientWidth){hq(ht.scrollLeft,"horizontal")}});this.checkedZeroWidth=false;if(ei&&m<8){this.horiz.style.minHeight=this.vert.style.minWidth="18px"}};dT.prototype.update=function(hs){var ht=hs.scrollWidth>hs.clientWidth+1;var hr=hs.scrollHeight>hs.clientHeight+1;var hu=hs.nativeBarWidth;if(hr){this.vert.style.display="block";this.vert.style.bottom=ht?hu+"px":"0";var hq=hs.viewHeight-(ht?hu:0);this.vert.firstChild.style.height=Math.max(0,hs.scrollHeight-hs.clientHeight+hq)+"px"}else{this.vert.style.display="";this.vert.firstChild.style.height="0"}if(ht){this.horiz.style.display="block";this.horiz.style.right=hr?hu+"px":"0";this.horiz.style.left=hs.barLeft+"px";var i=hs.viewWidth-hs.barLeft-(hr?hu:0);this.horiz.firstChild.style.width=Math.max(0,hs.scrollWidth-hs.clientWidth+i)+"px"}else{this.horiz.style.display="";this.horiz.firstChild.style.width="0"}if(!this.checkedZeroWidth&&hs.clientHeight>0){if(hu==0){this.zeroWidthHack()}this.checkedZeroWidth=true}return{right:hr?hu:0,bottom:ht?hu:0}};dT.prototype.setScrollLeft=function(i){if(this.horiz.scrollLeft!=i){this.horiz.scrollLeft=i}if(this.disableHoriz){this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")}};dT.prototype.setScrollTop=function(i){if(this.vert.scrollTop!=i){this.vert.scrollTop=i}if(this.disableVert){this.enableZeroWidthBar(this.vert,this.disableVert,"vert")}};dT.prototype.zeroWidthHack=function(){var i=cu&&!dD?"12px":"18px";this.horiz.style.height=this.vert.style.width=i;this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none";this.disableHoriz=new hp;this.disableVert=new hp};dT.prototype.enableZeroWidthBar=function(hr,i,hq){hr.style.pointerEvents="auto";function hs(){var hu=hr.getBoundingClientRect();var ht=hq=="vert"?document.elementFromPoint(hu.right-1,(hu.top+hu.bottom)/2):document.elementFromPoint((hu.right+hu.left)/2,hu.bottom-1);if(ht!=hr){hr.style.pointerEvents="none"}else{i.set(1000,hs)}}i.set(1000,hs)};dT.prototype.clear=function(){var i=this.horiz.parentNode;i.removeChild(this.horiz);i.removeChild(this.vert)};var fT=function(){};fT.prototype.update=function(){return{bottom:0,right:0}};fT.prototype.setScrollLeft=function(){};fT.prototype.setScrollTop=function(){};fT.prototype.clear=function(){};function fN(hs,hu){if(!hu){hu=d8(hs)}var hr=hs.display.barWidth,hq=hs.display.barHeight;a7(hs,hu);for(var ht=0;ht<4&&hr!=hs.display.barWidth||hq!=hs.display.barHeight;ht++){if(hr!=hs.display.barWidth&&hs.options.lineWrapping){bm(hs)}a7(hs,d8(hs));hr=hs.display.barWidth;hq=hs.display.barHeight}}function a7(i,hq){var hs=i.display;var hr=hs.scrollbars.update(hq);hs.sizer.style.paddingRight=(hs.barWidth=hr.right)+"px";hs.sizer.style.paddingBottom=(hs.barHeight=hr.bottom)+"px";hs.heightForcer.style.borderBottom=hr.bottom+"px solid transparent";if(hr.right&&hr.bottom){hs.scrollbarFiller.style.display="block";hs.scrollbarFiller.style.height=hr.bottom+"px";hs.scrollbarFiller.style.width=hr.right+"px"}else{hs.scrollbarFiller.style.display=""}if(hr.bottom&&i.options.coverGutterNextToScrollbar&&i.options.fixedGutter){hs.gutterFiller.style.display="block";hs.gutterFiller.style.height=hr.bottom+"px";hs.gutterFiller.style.width=hq.gutterWidth+"px"}else{hs.gutterFiller.style.display=""}}var bA={"native":dT,"null":fT};function aN(i){if(i.display.scrollbars){i.display.scrollbars.clear();if(i.display.scrollbars.addClass){h(i.display.wrapper,i.display.scrollbars.addClass)}}i.display.scrollbars=new bA[i.options.scrollbarStyle](function(hq){i.display.wrapper.insertBefore(hq,i.display.scrollbarFiller);cj(hq,"mousedown",function(){if(i.state.focused){setTimeout(function(){return i.display.input.focus()},0)}});hq.setAttribute("cm-not-content","true")},function(hr,hq){if(hq=="horizontal"){bY(i,hr)}else{B(i,hr)}},i);if(i.display.scrollbars.addClass){gs(i.display.wrapper,i.display.scrollbars.addClass)}}var eM=0;function dd(i){i.curOp={cm:i,viewChanged:false,startHeight:i.doc.height,forceUpdate:false,updateInput:null,typing:false,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:false,updateMaxLine:false,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:false,id:++eM};fg(i.curOp)}function aw(i){var hq=i.curOp;ck(hq,function(hs){for(var hr=0;hr<hs.ops.length;hr++){hs.ops[hr].cm.curOp=null}dg(hs)})}function dg(hv){var hr=hv.ops;for(var hq=0;hq<hr.length;hq++){cs(hr[hq])}for(var hw=0;hw<hr.length;hw++){az(hr[hw])}for(var hu=0;hu<hr.length;hu++){co(hr[hu])}for(var ht=0;ht<hr.length;ht++){ay(hr[ht])}for(var hs=0;hs<hr.length;hs++){fP(hr[hs])}}function cs(hr){var i=hr.cm,hq=i.display;N(i);if(hr.updateMaxLine){f(i)}hr.mustUpdate=hr.viewChanged||hr.forceUpdate||hr.scrollTop!=null||hr.scrollToPos&&(hr.scrollToPos.from.line<hq.viewFrom||hr.scrollToPos.to.line>=hq.viewTo)||hq.maxLineChanged&&i.options.lineWrapping;hr.update=hr.mustUpdate&&new aU(i,hr.mustUpdate&&{top:hr.scrollTop,ensure:hr.scrollToPos},hr.forceUpdate)}function az(i){i.updatedDisplay=i.mustUpdate&&E(i.cm,i.update)}function co(hr){var i=hr.cm,hq=i.display;if(hr.updatedDisplay){bm(i)}hr.barMeasure=d8(i);if(hq.maxLineChanged&&!i.options.lineWrapping){hr.adjustWidthTo=eU(i,hq.maxLine,hq.maxLine.text.length).left+3;i.display.sizerWidth=hr.adjustWidthTo;hr.barMeasure.scrollWidth=Math.max(hq.scroller.clientWidth,hq.sizer.offsetLeft+hr.adjustWidthTo+dn(i)+i.display.barWidth);hr.maxScrollLeft=Math.max(0,hq.sizer.offsetLeft+hr.adjustWidthTo-dU(i))}if(hr.updatedDisplay||hr.selectionChanged){hr.preparedSelection=hq.input.prepareSelection()}}function ay(hr){var i=hr.cm;if(hr.adjustWidthTo!=null){i.display.sizer.style.minWidth=hr.adjustWidthTo+"px";if(hr.maxScrollLeft<i.doc.scrollLeft){bY(i,Math.min(i.display.scroller.scrollLeft,hr.maxScrollLeft),true)}i.display.maxLineChanged=false}var hq=hr.focus&&hr.focus==em();if(hr.preparedSelection){i.display.input.showSelection(hr.preparedSelection,hq)}if(hr.updatedDisplay||hr.startHeight!=i.doc.height){fN(i,hr.barMeasure)}if(hr.updatedDisplay){d7(i,hr.barMeasure)}if(hr.selectionChanged){q(i)}if(i.state.focused&&hr.updateInput){i.display.input.reset(hr.typing)}if(hq){t(hr.cm)}}function fP(ht){var hy=ht.cm,hv=hy.display,hx=hy.doc;if(ht.updatedDisplay){cK(hy,ht.update)}if(hv.wheelStartX!=null&&(ht.scrollTop!=null||ht.scrollLeft!=null||ht.scrollToPos)){hv.wheelStartX=hv.wheelStartY=null}if(ht.scrollTop!=null){T(hy,ht.scrollTop,ht.forceScroll)}if(ht.scrollLeft!=null){bY(hy,ht.scrollLeft,true,true)}if(ht.scrollToPos){var hw=G(hy,gD(hx,ht.scrollToPos.from),gD(hx,ht.scrollToPos.to),ht.scrollToPos.margin);eI(hy,hw)}var hu=ht.maybeHiddenMarkers,hq=ht.maybeUnhiddenMarkers;if(hu){for(var hs=0;hs<hu.length;++hs){if(!hu[hs].lines.length){aO(hu[hs],"hide")}}}if(hq){for(var hr=0;hr<hq.length;++hr){if(hq[hr].lines.length){aO(hq[hr],"unhide")}}}if(hv.wrapper.offsetHeight){hx.scrollTop=hy.display.scroller.scrollTop}if(ht.changeObjs){aO(hy,"changes",hy,ht.changeObjs)}if(ht.update){ht.update.finish()}}function dh(i,hq){if(i.curOp){return hq()}dd(i);try{return hq()}finally{aw(i)}}function dw(i,hq){return function(){if(i.curOp){return hq.apply(i,arguments)}dd(i);try{return hq.apply(i,arguments)}finally{aw(i)}}}function dG(i){return function(){if(this.curOp){return i.apply(this,arguments)}dd(this);try{return i.apply(this,arguments)}finally{aw(this)}}}function c7(i){return function(){var hq=this.cm;if(!hq||hq.curOp){return i.apply(this,arguments)}dd(hq);try{return i.apply(this,arguments)}finally{aw(hq)}}}function ap(hx,hv,hw,hy){if(hv==null){hv=hx.doc.first}if(hw==null){hw=hx.doc.first+hx.doc.size}if(!hy){hy=0}var hs=hx.display;if(hy&&hw<hs.viewTo&&(hs.updateLineNumbers==null||hs.updateLineNumbers>hv)){hs.updateLineNumbers=hv}hx.curOp.viewChanged=true;if(hv>=hs.viewTo){if(bk&&a9(hx.doc,hv)<hs.viewTo){fe(hx)}}else{if(hw<=hs.viewFrom){if(bk&&eF(hx.doc,hw+hy)>hs.viewFrom){fe(hx)}else{hs.viewFrom+=hy;hs.viewTo+=hy}}else{if(hv<=hs.viewFrom&&hw>=hs.viewTo){fe(hx)}else{if(hv<=hs.viewFrom){var hu=dN(hx,hw,hw+hy,1);if(hu){hs.view=hs.view.slice(hu.index);hs.viewFrom=hu.lineN;hs.viewTo+=hy}else{fe(hx)}}else{if(hw>=hs.viewTo){var hq=dN(hx,hv,hv,-1);if(hq){hs.view=hs.view.slice(0,hq.index);hs.viewTo=hq.lineN}else{fe(hx)}}else{var ht=dN(hx,hv,hv,-1);var hr=dN(hx,hw,hw+hy,1);if(ht&&hr){hs.view=hs.view.slice(0,ht.index).concat(fJ(hx,ht.lineN,hr.lineN)).concat(hs.view.slice(hr.index));hs.viewTo+=hy}else{fe(hx)}}}}}}var i=hs.externalMeasured;if(i){if(hw<i.lineN){i.lineN+=hy}else{if(hv<i.lineN+i.size){hs.externalMeasured=null}}}}function W(hq,hr,hu){hq.curOp.viewChanged=true;var hv=hq.display,ht=hq.display.externalMeasured;if(ht&&hr>=ht.lineN&&hr<ht.lineN+ht.size){hv.externalMeasured=null}if(hr<hv.viewFrom||hr>=hv.viewTo){return}var hs=hv.view[d0(hq,hr)];if(hs.node==null){return}var i=hs.changes||(hs.changes=[]);if(dR(i,hu)==-1){i.push(hu)}}function fe(i){i.display.viewFrom=i.display.viewTo=i.doc.first;i.display.view=[];i.display.viewOffset=0}function dN(hy,hs,hu,hr){var hv=d0(hy,hs),hx,hw=hy.display.view;if(!bk||hu==hy.doc.first+hy.doc.size){return{index:hv,lineN:hu}}var hq=hy.display.viewFrom;for(var ht=0;ht<hv;ht++){hq+=hw[ht].size}if(hq!=hs){if(hr>0){if(hv==hw.length-1){return null}hx=(hq+hw[hv].size)-hs;hv++}else{hx=hq-hs}hs+=hx;hu+=hx}while(a9(hy.doc,hu)!=hu){if(hv==(hr<0?0:hw.length-1)){return null}hu+=hr*hw[hv-(hr<0?1:0)].size;hv+=hr}return{index:hv,lineN:hu}}function dm(i,ht,hs){var hr=i.display,hq=hr.view;if(hq.length==0||ht>=hr.viewTo||hs<=hr.viewFrom){hr.view=fJ(i,ht,hs);hr.viewFrom=ht}else{if(hr.viewFrom>ht){hr.view=fJ(i,ht,hr.viewFrom).concat(hr.view)}else{if(hr.viewFrom<ht){hr.view=hr.view.slice(d0(i,ht))}}hr.viewFrom=ht;if(hr.viewTo<hs){hr.view=hr.view.concat(fJ(i,hr.viewTo,hs))}else{if(hr.viewTo>hs){hr.view=hr.view.slice(0,d0(i,hs))}}}hr.viewTo=hs}function dK(hq){var hr=hq.display.view,hu=0;for(var ht=0;ht<hr.length;ht++){var hs=hr[ht];if(!hs.hidden&&(!hs.node||hs.changes)){++hu}}return hu}function eR(i,hq){if(i.doc.highlightFrontier<i.display.viewTo){i.state.highlight.set(hq,cY(dl,i))}}function dl(i){var ht=i.doc;if(ht.highlightFrontier>=i.display.viewTo){return}var hr=+new Date+i.options.workTime;var hs=fL(i,ht.highlightFrontier);var hq=[];ht.iter(hs.line,Math.min(ht.first+ht.size,i.display.viewTo+500),function(hv){if(hs.line>=i.display.viewFrom){var hy=hv.styles;var hu=hv.text.length>i.options.maxHighlightLength?cq(ht.mode,hs.state):null;var hA=gp(i,hv,hs,true);if(hu){hs.state=hu}hv.styles=hA.styles;var hx=hv.styleClasses,hz=hA.classes;if(hz){hv.styleClasses=hz}else{if(hx){hv.styleClasses=null}}var hB=!hy||hy.length!=hv.styles.length||hx!=hz&&(!hx||!hz||hx.bgClass!=hz.bgClass||hx.textClass!=hz.textClass);for(var hw=0;!hB&&hw<hy.length;++hw){hB=hy[hw]!=hv.styles[hw]}if(hB){hq.push(hs.line)}hv.stateAfter=hs.save();hs.nextLine()}else{if(hv.text.length<=i.options.maxHighlightLength){d6(i,hv.text,hs)}hv.stateAfter=hs.line%5==0?hs.save():null;hs.nextLine()}if(+new Date>hr){eR(i,i.options.workDelay);return true}});ht.highlightFrontier=hs.line;ht.modeFrontier=Math.max(ht.modeFrontier,hs.line);if(hq.length){dh(i,function(){for(var hu=0;hu<hq.length;hu++){W(i,hq[hu],"text")}})}}var aU=function(hq,i,hr){var hs=hq.display;this.viewport=i;this.visible=ct(hs,hq.doc,i);this.editorIsHidden=!hs.wrapper.offsetWidth;this.wrapperHeight=hs.wrapper.clientHeight;this.wrapperWidth=hs.wrapper.clientWidth;this.oldDisplayWidth=dU(hq);this.force=hr;this.dims=f2(hq);this.events=[]};aU.prototype.signal=function(hq,i){if(f9(hq,i)){this.events.push(arguments)}};aU.prototype.finish=function(){var hr=this;for(var hq=0;hq<this.events.length;hq++){aO.apply(null,hr.events[hq])}};function N(i){var hq=i.display;if(!hq.scrollbarsClipped&&hq.scroller.offsetWidth){hq.nativeBarWidth=hq.scroller.offsetWidth-hq.scroller.clientWidth;hq.heightForcer.style.height=dn(i)+"px";hq.sizer.style.marginBottom=-hq.nativeBarWidth+"px";hq.sizer.style.borderRightWidth=dn(i)+"px";hq.scrollbarsClipped=true}}function bC(hq){if(hq.hasFocus()){return null}var hs=em();if(!hs||!hg(hq.display.lineDiv,hs)){return null}var i={activeElt:hs};if(window.getSelection){var hr=window.getSelection();if(hr.anchorNode&&hr.extend&&hg(hq.display.lineDiv,hr.anchorNode)){i.anchorNode=hr.anchorNode;i.anchorOffset=hr.anchorOffset;i.focusNode=hr.focusNode;i.focusOffset=hr.focusOffset}}return i}function j(hq){if(!hq||!hq.activeElt||hq.activeElt==em()){return}hq.activeElt.focus();if(hq.anchorNode&&hg(document.body,hq.anchorNode)&&hg(document.body,hq.focusNode)){var hr=window.getSelection(),i=document.createRange();i.setEnd(hq.anchorNode,hq.anchorOffset);i.collapse(false);hr.removeAllRanges();hr.addRange(i);hr.extend(hq.focusNode,hq.focusOffset)}}function E(hy,hs){var ht=hy.display,hx=hy.doc;if(hs.editorIsHidden){fe(hy);return false}if(!hs.force&&hs.visible.from>=ht.viewFrom&&hs.visible.to<=ht.viewTo&&(ht.updateLineNumbers==null||ht.updateLineNumbers>=ht.viewTo)&&ht.renderedView==ht.view&&dK(hy)==0){return false}if(eH(hy)){fe(hy);hs.dims=f2(hy)}var hr=hx.first+hx.size;var hv=Math.max(hs.visible.from-hy.options.viewportMargin,hx.first);var hw=Math.min(hr,hs.visible.to+hy.options.viewportMargin);if(ht.viewFrom<hv&&hv-ht.viewFrom<20){hv=Math.max(hx.first,ht.viewFrom)}if(ht.viewTo>hw&&ht.viewTo-hw<20){hw=Math.min(hr,ht.viewTo)}if(bk){hv=a9(hy.doc,hv);hw=eF(hy.doc,hw)}var hq=hv!=ht.viewFrom||hw!=ht.viewTo||ht.lastWrapHeight!=hs.wrapperHeight||ht.lastWrapWidth!=hs.wrapperWidth;dm(hy,hv,hw);ht.viewOffset=b7(f4(hy.doc,ht.viewFrom));hy.display.mover.style.top=ht.viewOffset+"px";var i=dK(hy);if(!hq&&i==0&&!hs.force&&ht.renderedView==ht.view&&(ht.updateLineNumbers==null||ht.updateLineNumbers>=ht.viewTo)){return false}var hu=bC(hy);if(i>4){ht.lineDiv.style.display="none"}cN(hy,ht.updateLineNumbers,hs.dims);if(i>4){ht.lineDiv.style.display=""}ht.renderedView=ht.view;j(hu);eD(ht.cursorDiv);eD(ht.selectionDiv);ht.gutters.style.height=ht.sizer.style.minHeight=0;if(hq){ht.lastWrapHeight=hs.wrapperHeight;ht.lastWrapWidth=hs.wrapperWidth;eR(hy,400)}ht.updateLineNumbers=null;return true}function cK(hq,ht){var i=ht.viewport;for(var hs=true;;hs=false){if(!hs||!hq.options.lineWrapping||ht.oldDisplayWidth==dU(hq)){if(i&&i.top!=null){i={top:Math.min(hq.doc.height+b2(hq.display)-dq(hq),i.top)}}ht.visible=ct(hq.display,hq.doc,i);if(ht.visible.from>=hq.display.viewFrom&&ht.visible.to<=hq.display.viewTo){break}}if(!E(hq,ht)){break}bm(hq);var hr=d8(hq);bW(hq);fN(hq,hr);d7(hq,hr);ht.force=false}ht.signal(hq,"update",hq);if(hq.display.viewFrom!=hq.display.reportedViewFrom||hq.display.viewTo!=hq.display.reportedViewTo){ht.signal(hq,"viewportChange",hq,hq.display.viewFrom,hq.display.viewTo);hq.display.reportedViewFrom=hq.display.viewFrom;hq.display.reportedViewTo=hq.display.viewTo}}function et(hq,i){var hs=new aU(hq,i);if(E(hq,hs)){bm(hq);cK(hq,hs);var hr=d8(hq);bW(hq);fN(hq,hr);d7(hq,hr);hs.finish()}}function cN(hB,hs,hA){var hx=hB.display,hD=hB.options.lineNumbers;var hq=hx.lineDiv,hC=hq.firstChild;function hw(hE){var i=hE.nextSibling;if(dv&&cu&&hB.display.currentWheelTarget==hE){hE.style.display="none"}else{hE.parentNode.removeChild(hE)}return i}var hy=hx.view,hv=hx.viewFrom;for(var ht=0;ht<hy.length;ht++){var hu=hy[ht];if(hu.hidden){}else{if(!hu.node||hu.node.parentNode!=hq){var hr=aP(hB,hu,hv,hA);hq.insertBefore(hr,hC)}else{while(hC!=hu.node){hC=hw(hC)}var hz=hD&&hs!=null&&hs<=hv&&hu.lineNumber;if(hu.changes){if(dR(hu.changes,"gutter")>-1){hz=false}aj(hB,hu,hv,hA)}if(hz){eD(hu.lineNumber);hu.lineNumber.appendChild(document.createTextNode(e8(hB.options,hv)))}hC=hu.node.nextSibling}}hv+=hu.size}while(hC){hC=hw(hC)}}function dz(i){var hq=i.display.gutters.offsetWidth;i.display.sizer.style.marginLeft=hq+"px"}function d7(i,hq){i.display.sizer.style.minHeight=hq.docHeight+"px";i.display.heightForcer.style.top=hq.docHeight+"px";i.display.gutters.style.height=(hq.docHeight+i.display.barHeight+dn(i))+"px"}function eP(hq){var hr=hq.display.gutters,hv=hq.options.gutters;eD(hr);var hs=0;for(;hs<hv.length;++hs){var ht=hv[hs];var hu=hr.appendChild(g5("div",null,"CodeMirror-gutter "+ht));if(ht=="CodeMirror-linenumbers"){hq.display.lineGutter=hu;hu.style.width=(hq.display.lineNumWidth||1)+"px"}}hr.style.display=hs?"":"none";dz(hq)}function cD(i){var hq=dR(i.gutters,"CodeMirror-linenumbers");if(hq==-1&&i.lineNumbers){i.gutters=i.gutters.concat(["CodeMirror-linenumbers"])}else{if(hq>-1&&!i.lineNumbers){i.gutters=i.gutters.slice(0);i.gutters.splice(hq,1)}}}var gb=0;var cG=null;if(ei){cG=-0.53}else{if(cR){cG=15}else{if(dL){cG=-0.7}else{if(aM){cG=-1/3}}}}function dk(hr){var hq=hr.wheelDeltaX,i=hr.wheelDeltaY;if(hq==null&&hr.detail&&hr.axis==hr.HORIZONTAL_AXIS){hq=hr.detail}if(i==null&&hr.detail&&hr.axis==hr.VERTICAL_AXIS){i=hr.detail}else{if(i==null){i=hr.wheelDelta}}return{x:hq,y:i}}function aJ(i){var hq=dk(i);hq.x*=cG;hq.y*=cG;return hq}function c(hA,hu){var hC=dk(hu),hE=hC.x,hD=hC.y;var hw=hA.display,hz=hw.scroller;var ht=hz.scrollWidth>hz.clientWidth;var hs=hz.scrollHeight>hz.clientHeight;if(!(hE&&ht||hD&&hs)){return}if(hD&&cu&&dv){outer:for(var hB=hu.target,hy=hw.view;hB!=hz;hB=hB.parentNode){for(var hr=0;hr<hy.length;hr++){if(hy[hr].node==hB){hA.display.currentWheelTarget=hB;break outer}}}}if(hE&&!cR&&!eE&&cG!=null){if(hD&&hs){B(hA,Math.max(0,hz.scrollTop+hD*cG))}bY(hA,Math.max(0,hz.scrollLeft+hE*cG));if(!hD||(hD&&hs)){c9(hu)}hw.wheelStartX=null;return}if(hD&&cG!=null){var hq=hD*cG;var hx=hA.doc.scrollTop,hv=hx+hw.wrapper.clientHeight;if(hq<0){hx=Math.max(0,hx+hq-50)}else{hv=Math.min(hA.doc.height,hv+hq+50)}et(hA,{top:hx,bottom:hv})}if(gb<20){if(hw.wheelStartX==null){hw.wheelStartX=hz.scrollLeft;hw.wheelStartY=hz.scrollTop;hw.wheelDX=hE;hw.wheelDY=hD;setTimeout(function(){if(hw.wheelStartX==null){return}var i=hz.scrollLeft-hw.wheelStartX;var hG=hz.scrollTop-hw.wheelStartY;var hF=(hG&&hw.wheelDY&&hG/hw.wheelDY)||(i&&hw.wheelDX&&i/hw.wheelDX);hw.wheelStartX=hw.wheelStartY=null;if(!hF){return}cG=(cG*gb+hF)/(gb+1);++gb},200)}else{hw.wheelDX+=hE;hw.wheelDY+=hD}}}var g4=function(i,hq){this.ranges=i;this.primIndex=hq};g4.prototype.primary=function(){return this.ranges[this.primIndex]};g4.prototype.equals=function(hq){var hu=this;if(hq==this){return true}if(hq.primIndex!=this.primIndex||hq.ranges.length!=this.ranges.length){return false}for(var hs=0;hs<this.ranges.length;hs++){var hr=hu.ranges[hs],ht=hq.ranges[hs];if(!ad(hr.anchor,ht.anchor)||!ad(hr.head,ht.head)){return false}}return true};g4.prototype.deepCopy=function(){var hs=this;var hq=[];for(var hr=0;hr<this.ranges.length;hr++){hq[hr]=new ex(cI(hs.ranges[hr].anchor),cI(hs.ranges[hr].head))}return new g4(hq,this.primIndex)};g4.prototype.somethingSelected=function(){var hr=this;for(var hq=0;hq<this.ranges.length;hq++){if(!hr.ranges[hq].empty()){return true}}return false};g4.prototype.contains=function(hu,hq){var ht=this;if(!hq){hq=hu}for(var hs=0;hs<this.ranges.length;hs++){var hr=ht.ranges[hs];if(cF(hq,hr.from())>=0&&cF(hu,hr.to())<=0){return hs}}return -1};var ex=function(i,hq){this.anchor=i;this.head=hq};ex.prototype.from=function(){return aB(this.anchor,this.head)};ex.prototype.to=function(){return bR(this.anchor,this.head)};ex.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function cZ(hq,hx){var hs=hq[hx];hq.sort(function(hz,i){return cF(hz.from(),i.from())});hx=dR(hq,hs);for(var hu=1;hu<hq.length;hu++){var hy=hq[hu],hr=hq[hu-1];if(cF(hr.to(),hy.from())>=0){var hv=aB(hr.from(),hy.from()),hw=bR(hr.to(),hy.to());var ht=hr.empty()?hy.from()==hy.head:hr.from()==hr.head;if(hu<=hx){--hx}hq.splice(--hu,2,new ex(ht?hw:hv,ht?hv:hw))}}return new g4(hq,hx)}function fE(i,hq){return new g4([new ex(i,hq||i)],0)}function ds(i){if(!i.text){return i.to}return ac(i.from.line+i.text.length-1,gy(i.text).length+(i.text.length==1?i.from.ch:0))}function cm(hs,hr){if(cF(hs,hr.from)<0){return hs}if(cF(hs,hr.to)<=0){return ds(hr)}var i=hs.line+hr.text.length-(hr.to.line-hr.from.line)-1,hq=hs.ch;if(hs.line==hr.to.line){hq+=ds(hr).ch-hr.to.ch}return ac(i,hq)}function f8(ht,hu){var hr=[];for(var hs=0;hs<ht.sel.ranges.length;hs++){var hq=ht.sel.ranges[hs];hr.push(new ex(cm(hq.anchor,hu),cm(hq.head,hu)))}return cZ(hr,ht.sel.primIndex)}function bN(hr,hq,i){if(hr.line==hq.line){return ac(i.line,hr.ch-hq.ch+i.ch)}else{return ac(i.line+(hr.line-hq.line),hr.ch)}}function an(hA,hx,hr){var hs=[];var hq=ac(hA.first,0),hB=hq;for(var hu=0;hu<hx.length;hu++){var hw=hx[hu];var hz=bN(hw.from,hq,hB);var hy=bN(ds(hw),hq,hB);hq=hw.to;hB=hy;if(hr=="around"){var hv=hA.sel.ranges[hu],ht=cF(hv.head,hv.anchor)<0;hs[hu]=new ex(ht?hy:hz,ht?hz:hy)}else{hs[hu]=new ex(hz,hz)}}return new g4(hs,hA.sel.primIndex)}function bK(i){i.doc.mode=gr(i.options,i.doc.modeOption);e0(i)}function e0(i){i.doc.iter(function(hq){if(hq.stateAfter){hq.stateAfter=null}if(hq.styles){hq.styles=null}});i.doc.modeFrontier=i.doc.highlightFrontier=i.doc.first;eR(i,100);i.state.modeGen++;if(i.curOp){ap(i)}}function er(i,hq){return hq.from.ch==0&&hq.to.ch==0&&gy(hq.text)==""&&(!i.cm||i.cm.options.wholeLineUpdateBefore)}function go(hG,hz,ht,hx){function hs(hH){return ht?ht[hH]:null}function hy(hH,hJ,hI){e2(hH,hJ,hI,hx);am(hH,"change",hH,hz)}function hD(hK,hI){var hH=[];for(var hJ=hK;hJ<hI;++hJ){hH.push(new ha(hB[hJ],hs(hJ),hx))}return hH}var hE=hz.from,hq=hz.to,hB=hz.text;var hA=f4(hG,hE.line),i=f4(hG,hq.line);var hr=gy(hB),hF=hs(hB.length-1),hC=hq.line-hE.line;if(hz.full){hG.insert(0,hD(0,hB.length));hG.remove(hB.length,hG.size-hB.length)}else{if(er(hG,hz)){var hw=hD(0,hB.length-1);hy(i,i.text,hF);if(hC){hG.remove(hE.line,hC)}if(hw.length){hG.insert(hE.line,hw)}}else{if(hA==i){if(hB.length==1){hy(hA,hA.text.slice(0,hE.ch)+hr+hA.text.slice(hq.ch),hF)}else{var hv=hD(1,hB.length-1);hv.push(new ha(hr+hA.text.slice(hq.ch),hF,hx));hy(hA,hA.text.slice(0,hE.ch)+hB[0],hs(0));hG.insert(hE.line+1,hv)}}else{if(hB.length==1){hy(hA,hA.text.slice(0,hE.ch)+hB[0]+i.text.slice(hq.ch),hs(0));hG.remove(hE.line+1,hC)}else{hy(hA,hA.text.slice(0,hE.ch)+hB[0],hs(0));hy(i,hr+i.text.slice(hq.ch),hF);var hu=hD(1,hB.length-1);if(hC>1){hG.remove(hE.line+1,hC-1)}hG.insert(hE.line+1,hu)}}}}am(hG,"change",hG,hz)}function eJ(hs,hr,hq){function i(hy,hw,hu){if(hy.linked){for(var hv=0;hv<hy.linked.length;++hv){var ht=hy.linked[hv];if(ht.doc==hw){continue}var hx=hu&&ht.sharedHist;if(hq&&!hx){continue}hr(ht.doc,hx);i(ht.doc,hy,hx)}}}i(hs,null,true)}function eO(i,hq){if(hq.cm){throw new Error("This document is already in use.")}i.doc=hq;hq.cm=i;af(i);bK(i);D(i);if(!i.options.lineWrapping){f(i)}i.options.mode=hq.modeOption;ap(i)}function D(i){(i.doc.direction=="rtl"?gs:h)(i.display.lineDiv,"CodeMirror-rtl")}function eA(i){dh(i,function(){D(i);ap(i)})}function gR(i){this.done=[];this.undone=[];this.undoDepth=Infinity;this.lastModTime=this.lastSelTime=0;this.lastOp=this.lastSelOp=null;this.lastOrigin=this.lastSelOrigin=null;this.generation=this.maxGeneration=i||1}function d4(i,hr){var hq={from:cI(hr.from),to:ds(hr),text:g8(i,hr.from,hr.to)};cl(i,hq,hr.from.line,hr.to.line+1);eJ(i,function(hs){return cl(hs,hq,hr.from.line,hr.to.line+1)},true);return hq}function gt(hq){while(hq.length){var i=gy(hq);if(i.ranges){hq.pop()}else{break}}}function fz(hq,i){if(i){gt(hq.done);return gy(hq.done)}else{if(hq.done.length&&!gy(hq.done).ranges){return gy(hq.done)}else{if(hq.done.length>1&&!hq.done[hq.done.length-2].ranges){hq.done.pop();return gy(hq.done)}}}}function gG(hv,ht,i,hs){var hr=hv.history;hr.undone.length=0;var hq=+new Date,hw;var hx;if((hr.lastOp==hs||hr.lastOrigin==ht.origin&&ht.origin&&((ht.origin.charAt(0)=="+"&&hr.lastModTime>hq-(hv.cm?hv.cm.options.historyEventDelay:500))||ht.origin.charAt(0)=="*"))&&(hw=fz(hr,hr.lastOp==hs))){hx=gy(hw.changes);if(cF(ht.from,ht.to)==0&&cF(ht.from,hx.to)==0){hx.to=ds(ht)}else{hw.changes.push(d4(hv,ht))}}else{var hu=gy(hr.done);if(!hu||!hu.ranges){dj(hv.sel,hr.done)}hw={changes:[d4(hv,ht)],generation:hr.generation};hr.done.push(hw);while(hr.done.length>hr.undoDepth){hr.done.shift();if(!hr.done[0].ranges){hr.done.shift()}}}hr.done.push(i);hr.generation=++hr.maxGeneration;hr.lastModTime=hr.lastSelTime=hq;hr.lastOp=hr.lastSelOp=hs;hr.lastOrigin=hr.lastSelOrigin=ht.origin;if(!hx){aO(hv,"historyAdded")}}function bU(ht,i,hr,hs){var hq=i.charAt(0);return hq=="*"||hq=="+"&&hr.ranges.length==hs.ranges.length&&hr.somethingSelected()==hs.somethingSelected()&&new Date-ht.history.lastSelTime<=(ht.cm?ht.cm.options.historyEventDelay:500)}function hi(hu,hs,i,hr){var ht=hu.history,hq=hr&&hr.origin;if(i==ht.lastSelOp||(hq&&ht.lastSelOrigin==hq&&(ht.lastModTime==ht.lastSelTime&&ht.lastOrigin==hq||bU(hu,hq,gy(ht.done),hs)))){ht.done[ht.done.length-1]=hs}else{dj(hs,ht.done)}ht.lastSelTime=+new Date;ht.lastSelOrigin=hq;ht.lastSelOp=i;if(hr&&hr.clearRedo!==false){gt(ht.undone)}}function dj(hq,i){var hr=gy(i);if(!(hr&&hr.ranges&&hr.equals(hq))){i.push(hq)}}function cl(hq,hu,ht,hs){var i=hu["spans_"+hq.id],hr=0;hq.iter(Math.max(hq.first,ht),Math.min(hq.first+hq.size,hs),function(hv){if(hv.markedSpans){(i||(i=hu["spans_"+hq.id]={}))[hr]=hv.markedSpans}++hr})}function by(hs){if(!hs){return null}var hq;for(var hr=0;hr<hs.length;++hr){if(hs[hr].marker.explicitlyCleared){if(!hq){hq=hs.slice(0,hr)}}else{if(hq){hq.push(hs[hr])}}}return !hq?hs:hq.length?hq:null}function cr(ht,hu){var hs=hu["spans_"+ht.id];if(!hs){return null}var hq=[];for(var hr=0;hr<hu.text.length;++hr){hq.push(by(hs[hr]))}return hq}function eL(hy,hw){var hq=cr(hy,hw);var hz=eY(hy,hw);if(!hq){return hz}if(!hz){return hq}for(var ht=0;ht<hq.length;++ht){var hu=hq[ht],hv=hz[ht];if(hu&&hv){spans:for(var hs=0;hs<hv.length;++hs){var hx=hv[hs];for(var hr=0;hr<hu.length;++hr){if(hu[hr].marker==hx.marker){continue spans}}hu.push(hx)}}else{if(hv){hq[ht]=hv}}}return hq}function ca(hB,ht,hA){var hr=[];for(var hw=0;hw<hB.length;++hw){var hs=hB[hw];if(hs.ranges){hr.push(hA?g4.prototype.deepCopy.call(hs):hs);continue}var hy=hs.changes,hz=[];hr.push({changes:hz});for(var hv=0;hv<hy.length;++hv){var hx=hy[hv],hu=(void 0);hz.push({from:hx.from,to:hx.to,text:hx.text});if(ht){for(var hq in hx){if(hu=hq.match(/^spans_(\d+)$/)){if(dR(ht,Number(hu[1]))>-1){gy(hz)[hq]=hx[hq];delete hx[hq]}}}}}}return hr}function gj(hq,ht,i,hu){if(hu){var hs=hq.anchor;if(i){var hr=cF(ht,hs)<0;if(hr!=(cF(i,hs)<0)){hs=ht;ht=i}else{if(hr!=(cF(ht,i)<0)){ht=i}}}return new ex(hs,ht)}else{return new ex(i||ht,ht)}}function gX(hs,hr,i,hq,ht){if(ht==null){ht=hs.cm&&(hs.cm.display.shift||hs.extend)}cg(hs,new g4([gj(hs.sel.primary(),hr,i,ht)],0),hq)}function aF(hv,hu,hs){var hr=[];var hw=hv.cm&&(hv.cm.display.shift||hv.extend);for(var ht=0;ht<hv.sel.ranges.length;ht++){hr[ht]=gj(hv.sel.ranges[ht],hu[ht],null,hw)}var hq=cZ(hr,hv.sel.primIndex);cg(hv,hq,hs)}function e(hu,ht,hr,hs){var hq=hu.sel.ranges.slice(0);hq[ht]=hr;cg(hu,cZ(hq,hu.sel.primIndex),hs)}function J(hs,hq,hr,i){cg(hs,fE(hq,hr),i)}function b(hs,hq,i){var hr={ranges:hq.ranges,update:function(ht){var hv=this;this.ranges=[];for(var hu=0;hu<ht.length;hu++){hv.ranges[hu]=new ex(gD(hs,ht[hu].anchor),gD(hs,ht[hu].head))}},origin:i&&i.origin};aO(hs,"beforeSelectionChange",hs,hr);if(hs.cm){aO(hs.cm,"beforeSelectionChange",hs.cm,hr)}if(hr.ranges!=hq.ranges){return cZ(hr.ranges,hr.ranges.length-1)}else{return hq}}function fX(ht,hs,hq){var i=ht.history.done,hr=gy(i);if(hr&&hr.ranges){i[i.length-1]=hs;e4(ht,hs,hq)}else{cg(ht,hs,hq)}}function cg(hr,hq,i){e4(hr,hq,i);hi(hr,hr.sel,hr.cm?hr.cm.curOp.id:NaN,i)}function e4(hs,hr,hq){if(f9(hs,"beforeSelectionChange")||hs.cm&&f9(hs.cm,"beforeSelectionChange")){hr=b(hs,hr,hq)}var i=hq&&hq.bias||(cF(hr.primary().head,hs.sel.primary().head)<0?-1:1);dF(hs,p(hs,hr,i,true));if(!(hq&&hq.scroll===false)&&hs.cm){gx(hs.cm)}}function dF(hq,i){if(i.equals(hq.sel)){return}hq.sel=i;if(hq.cm){hq.cm.curOp.updateInput=hq.cm.curOp.selectionChanged=true;ab(hq.cm)}am(hq,"cursorActivity",hq)}function ff(i){dF(i,p(i,i.sel,null,false))}function p(hz,hq,hw,hx){var ht;for(var hu=0;hu<hq.ranges.length;hu++){var hv=hq.ranges[hu];var hr=hq.ranges.length==hz.sel.ranges.length&&hz.sel.ranges[hu];var hy=ch(hz,hv.anchor,hr&&hr.anchor,hw,hx);var hs=ch(hz,hv.head,hr&&hr.head,hw,hx);if(ht||hy!=hv.anchor||hs!=hv.head){if(!ht){ht=hq.ranges.slice(0,hu)}ht[hu]=new ex(hy,hs)}}return ht?cZ(ht,hq.primIndex):hq}function fu(hA,hy,ht,hs,hw){var hB=f4(hA,hy.line);if(hB.markedSpans){for(var hu=0;hu<hB.markedSpans.length;++hu){var hq=hB.markedSpans[hu],hr=hq.marker;if((hq.from==null||(hr.inclusiveLeft?hq.from<=hy.ch:hq.from<hy.ch))&&(hq.to==null||(hr.inclusiveRight?hq.to>=hy.ch:hq.to>hy.ch))){if(hw){aO(hr,"beforeCursorEnter");if(hr.explicitlyCleared){if(!hB.markedSpans){break}else{--hu;continue}}}if(!hr.atomic){continue}if(ht){var hx=hr.find(hs<0?1:-1),hz=(void 0);if(hs<0?hr.inclusiveRight:hr.inclusiveLeft){hx=hm(hA,hx,-hs,hx&&hx.line==hy.line?hB:null)}if(hx&&hx.line==hy.line&&(hz=cF(hx,ht))&&(hs<0?hz<0:hz>0)){return fu(hA,hx,hy,hs,hw)}}var hv=hr.find(hs<0?-1:1);if(hs<0?hr.inclusiveLeft:hr.inclusiveRight){hv=hm(hA,hv,hs,hv.line==hy.line?hB:null)}return hv?fu(hA,hv,hy,hs,hw):null}}}return hy}function ch(hu,hv,hs,hq,i){var hr=hq||1;var ht=fu(hu,hv,hs,hr,i)||(!i&&fu(hu,hv,hs,hr,true))||fu(hu,hv,hs,-hr,i)||(!i&&fu(hu,hv,hs,-hr,true));if(!ht){hu.cantEdit=true;return ac(hu.first,0)}return ht}function hm(hr,hs,hq,i){if(hq<0&&hs.ch==0){if(hs.line>hr.first){return gD(hr,ac(hs.line-1))}else{return null}}else{if(hq>0&&hs.ch==(i||f4(hr,hs.line)).text.length){if(hs.line<hr.first+hr.size-1){return ac(hs.line+1,0)}else{return null}}else{return new ac(hs.line,hs.ch+hq)}}}function av(i){i.setSelection(ac(i.firstLine(),0),ac(i.lastLine()),ah)}function ep(hq,hs,hr){var i={canceled:false,from:hs.from,to:hs.to,text:hs.text,origin:hs.origin,cancel:function(){return i.canceled=true}};if(hr){i.update=function(hw,hv,hu,ht){if(hw){i.from=gD(hq,hw)}if(hv){i.to=gD(hq,hv)}if(hu){i.text=hu}if(ht!==undefined){i.origin=ht}}}aO(hq,"beforeChange",hq,i);if(hq.cm){aO(hq.cm,"beforeChange",hq.cm,i)}if(i.canceled){return null}return{from:i.from,to:i.to,text:i.text,origin:i.origin}}function bt(ht,hu,hs){if(ht.cm){if(!ht.cm.curOp){return dw(ht.cm,bt)(ht,hu,hs)}if(ht.cm.state.suppressEdits){return}}if(f9(ht,"beforeChange")||ht.cm&&f9(ht.cm,"beforeChange")){hu=ep(ht,hu,true);if(!hu){return}}var hr=hk&&!hs&&dc(ht,hu.from,hu.to);if(hr){for(var hq=hr.length-1;hq>=0;--hq){P(ht,{from:hr[hq].from,to:hr[hq].to,text:hq?[""]:hu.text,origin:hu.origin})}}else{P(ht,hu)}}function P(hr,hs){if(hs.text.length==1&&hs.text[0]==""&&cF(hs.from,hs.to)==0){return}var hq=f8(hr,hs);gG(hr,hs,hq,hr.cm?hr.cm.curOp.id:NaN);eQ(hr,hs,hq,eY(hr,hs));var i=[];eJ(hr,function(hu,ht){if(!ht&&dR(i,hu.history)==-1){eb(hu.history,hs);i.push(hu.history)}eQ(hu,hs,null,eY(hu,hs))})}function cv(hD,hA,hE){var hB=hD.cm&&hD.cm.state.suppressEdits;if(hB&&!hE){return}var hz=hD.history,hr,ht=hD.sel;var hq=hA=="undo"?hz.done:hz.undone,hC=hA=="undo"?hz.undone:hz.done;var hw=0;for(;hw<hq.length;hw++){hr=hq[hw];if(hE?hr.ranges&&!hr.equals(hD.sel):!hr.ranges){break}}if(hw==hq.length){return}hz.lastOrigin=hz.lastSelOrigin=null;for(;;){hr=hq.pop();if(hr.ranges){dj(hr,hC);if(hE&&!hr.equals(hD.sel)){cg(hD,hr,{clearRedo:false});return}ht=hr}else{if(hB){hq.push(hr);return}else{break}}}var hy=[];dj(ht,hC);hC.push({changes:hy,generation:hz.generation});hz.generation=hr.generation||++hz.maxGeneration;var hs=f9(hD,"beforeChange")||hD.cm&&f9(hD.cm,"beforeChange");var hx=function(hF){var hI=hr.changes[hF];hI.origin=hA;if(hs&&!ep(hD,hI,false)){hq.length=0;return{}}hy.push(d4(hD,hI));var hH=hF?f8(hD,hI):gy(hq);eQ(hD,hI,hH,eL(hD,hI));if(!hF&&hD.cm){hD.cm.scrollIntoView({from:hI.from,to:ds(hI)})}var hG=[];eJ(hD,function(hJ,i){if(!i&&dR(hG,hJ.history)==-1){eb(hJ.history,hI);hG.push(hJ.history)}eQ(hJ,hI,null,eL(hJ,hI))})};for(var hu=hr.changes.length-1;hu>=0;--hu){var hv=hx(hu);if(hv){return hv.v}}}function gc(hq,hs){if(hs==0){return}hq.first+=hs;hq.sel=new g4(cf(hq.sel.ranges,function(ht){return new ex(ac(ht.anchor.line+hs,ht.anchor.ch),ac(ht.head.line+hs,ht.head.ch))}),hq.sel.primIndex);if(hq.cm){ap(hq.cm,hq.first,hq.first-hs,hs);for(var hr=hq.cm.display,i=hr.viewFrom;i<hr.viewTo;i++){W(hq.cm,i,"gutter")}}}function eQ(ht,hu,hs,hq){if(ht.cm&&!ht.cm.curOp){return dw(ht.cm,eQ)(ht,hu,hs,hq)}if(hu.to.line<ht.first){gc(ht,hu.text.length-1-(hu.to.line-hu.from.line));return}if(hu.from.line>ht.lastLine()){return}if(hu.from.line<ht.first){var i=hu.text.length-1-(ht.first-hu.from.line);gc(ht,i);hu={from:ac(ht.first,0),to:ac(hu.to.line+i,hu.to.ch),text:[gy(hu.text)],origin:hu.origin}}var hr=ht.lastLine();if(hu.to.line>hr){hu={from:hu.from,to:ac(hr,f4(ht,hr).text.length),text:[hu.text[0]],origin:hu.origin}}hu.removed=g8(ht,hu.from,hu.to);if(!hs){hs=f8(ht,hu)}if(ht.cm){aT(ht.cm,hu,hq)}else{go(ht,hu,hq)}e4(ht,hs,ah)}function aT(hA,hw,hu){var hz=hA.doc,hv=hA.display,hx=hw.from,hy=hw.to;var i=false,ht=hx.line;if(!hA.options.lineWrapping){ht=b8(z(f4(hz,hx.line)));hz.iter(ht,hy.line+1,function(hC){if(hC==hv.maxLine){i=true;return true}})}if(hz.sel.contains(hw.from,hw.to)>-1){ab(hA)}go(hz,hw,hu,br(hA));if(!hA.options.lineWrapping){hz.iter(ht,hx.line+hw.text.length,function(hD){var hC=e1(hD);if(hC>hv.maxLineLength){hv.maxLine=hD;hv.maxLineLength=hC;hv.maxLineChanged=true;i=false}});if(i){hA.curOp.updateMaxLine=true}}hj(hz,hx.line);eR(hA,400);var hB=hw.text.length-(hy.line-hx.line)-1;if(hw.full){ap(hA)}else{if(hx.line==hy.line&&hw.text.length==1&&!er(hA.doc,hw)){W(hA,hx.line,"text")}else{ap(hA,hx.line,hy.line+1,hB)}}var hr=f9(hA,"changes"),hs=f9(hA,"change");if(hs||hr){var hq={from:hx,to:hy,text:hw.text,removed:hw.removed,origin:hw.origin};if(hs){am(hA,"change",hA,hq)}if(hr){(hA.curOp.changeObjs||(hA.curOp.changeObjs=[])).push(hq)}}hA.display.selForContextMenu=null}function be(hs,hr,hu,ht,hq){if(!ht){ht=hu}if(cF(ht,hu)<0){var i;(i=[ht,hu],hu=i[0],ht=i[1],i)}if(typeof hr=="string"){hr=hs.splitLines(hr)}bt(hs,{from:hu,to:ht,text:hr,origin:hq})}function M(hs,hr,hq,i){if(hq<hs.line){hs.line+=i}else{if(hr<hs.line){hs.line=hr;hs.ch=0}}}function f6(hu,hw,hx,hy){for(var ht=0;ht<hu.length;++ht){var hq=hu[ht],hv=true;if(hq.ranges){if(!hq.copied){hq=hu[ht]=hq.deepCopy();hq.copied=true}for(var hs=0;hs<hq.ranges.length;hs++){M(hq.ranges[hs].anchor,hw,hx,hy);M(hq.ranges[hs].head,hw,hx,hy)}continue}for(var hr=0;hr<hq.changes.length;++hr){var hz=hq.changes[hr];if(hx<hz.from.line){hz.from=ac(hz.from.line+hy,hz.from.ch);hz.to=ac(hz.to.line+hy,hz.to.ch)}else{if(hw<=hz.to.line){hv=false;break}}}if(!hv){hu.splice(0,ht+1);ht=0}}}function eb(hq,ht){var hs=ht.from.line,hr=ht.to.line,i=ht.text.length-(hr-hs)-1;f6(hq.done,hs,hr,i);f6(hq.undone,hs,hr,i)}function fi(hs,hr,i,hu){var ht=hr,hq=hr;if(typeof hr=="number"){hq=f4(hs,dA(hs,hr))}else{ht=b8(hr)}if(ht==null){return null}if(hu(hq,ht)&&hs.cm){W(hs.cm,ht,i)}return hq}function fO(hr){var ht=this;this.lines=hr;this.parent=null;var hq=0;for(var hs=0;hs<hr.length;++hs){hr[hs].parent=ht;hq+=hr[hs].height}this.height=hq}fO.prototype={chunkSize:function X(){return this.lines.length},removeInner:function O(hq,hv){var hu=this;for(var hs=hq,ht=hq+hv;hs<ht;++hs){var hr=hu.lines[hs];hu.height-=hr.height;bV(hr);am(hr,"delete")}this.lines.splice(hq,hv)},collapse:function gk(i){i.push.apply(i,this.lines)},insertInner:function a2(hr,hs,hq){var hu=this;this.height+=hq;this.lines=this.lines.slice(0,hr).concat(hs).concat(this.lines.slice(hr));for(var ht=0;ht<hs.length;++ht){hs[ht].parent=hu}},iterN:function g6(i,ht,hs){var hr=this;for(var hq=i+ht;i<hq;++i){if(hs(hr.lines[i])){return true}}}};function gn(ht){var hv=this;this.children=ht;var hs=0,hq=0;for(var hr=0;hr<ht.length;++hr){var hu=ht[hr];hs+=hu.chunkSize();hq+=hu.height;hu.parent=hv}this.size=hs;this.height=hq;this.parent=null}gn.prototype={chunkSize:function X(){return this.size},removeInner:function O(hs,hr){var hu=this;this.size-=hr;for(var ht=0;ht<this.children.length;++ht){var hq=hu.children[ht],hw=hq.chunkSize();if(hs<hw){var hv=Math.min(hr,hw-hs),hx=hq.height;hq.removeInner(hs,hv);hu.height-=hx-hq.height;if(hw==hv){hu.children.splice(ht--,1);hq.parent=null}if((hr-=hv)==0){break}hs=0}else{hs-=hw}}if(this.size-hr<25&&(this.children.length>1||!(this.children[0] instanceof fO))){var hy=[];this.collapse(hy);this.children=[new fO(hy)];this.children[0].parent=this}},collapse:function gk(hq){var hs=this;for(var hr=0;hr<this.children.length;++hr){hs.children[hr].collapse(hq)}},insertInner:function a2(hr,hz,hy){var hu=this;this.size+=hz.length;this.height+=hy;for(var ht=0;ht<this.children.length;++ht){var hq=hu.children[ht],hw=hq.chunkSize();if(hr<=hw){hq.insertInner(hr,hz,hy);if(hq.lines&&hq.lines.length>50){var hs=hq.lines.length%25+25;for(var hx=hs;hx<hq.lines.length;){var hv=new fO(hq.lines.slice(hx,hx+=25));hq.height-=hv.height;hu.children.splice(++ht,0,hv);hv.parent=hu}hq.lines=hq.lines.slice(0,hs);hu.maybeSpill()}break}hr-=hw}},maybeSpill:function e9(){if(this.children.length<=10){return}var hs=this;do{var hq=hs.children.splice(hs.children.length-5,5);var hr=new gn(hq);if(!hs.parent){var ht=new gn(hs.children);ht.parent=hs;hs.children=[ht,hr];hs=ht}else{hs.size-=hr.size;hs.height-=hr.height;var i=dR(hs.parent.children,hs);hs.parent.children.splice(i+1,0,hr)}hr.parent=hs.parent}while(hs.children.length>10);hs.parent.maybeSpill()},iterN:function g6(hq,hx,hw){var hv=this;for(var hr=0;hr<this.children.length;++hr){var hu=hv.children[hr],ht=hu.chunkSize();if(hq<ht){var hs=Math.min(hx,ht-hq);if(hu.iterN(hq,hs,hw)){return true}if((hx-=hs)==0){break}hq=0}else{hq-=ht}}}};var d9=function(hs,hr,i){var ht=this;if(i){for(var hq in i){if(i.hasOwnProperty(hq)){ht[hq]=i[hq]}}}this.doc=hs;this.node=hr};d9.prototype.clear=function(){var hw=this;var hr=this.doc.cm,ht=this.line.widgets,hs=this.line,hv=b8(hs);if(hv==null||!ht){return}for(var hu=0;hu<ht.length;++hu){if(ht[hu]==hw){ht.splice(hu--,1)}}if(!ht.length){hs.widgets=null}var hq=dt(this);hb(hs,Math.max(0,hs.height-hq));if(hr){dh(hr,function(){ez(hr,hs,-hq);W(hr,hv,"widget")});am(hr,"lineWidgetCleared",hr,this,hv)}};d9.prototype.changed=function(){var ht=this;var hq=this.height,i=this.doc.cm,hr=this.line;this.height=null;var hs=dt(this)-hq;if(!hs){return}hb(hr,hr.height+hs);if(i){dh(i,function(){i.curOp.forceUpdate=true;ez(i,hr,hs);am(i,"lineWidgetChanged",i,ht,b8(hr))})}};bT(d9);function ez(i,hq,hr){if(b7(hq)<((i.curOp&&i.curOp.scrollTop)||i.doc.scrollTop)){db(i,hr)}}function b0(hu,ht,hr,hq){var hs=new d9(hu,hr,hq);var i=hu.cm;if(i&&hs.noHScroll){i.display.alignWidgets=true}fi(hu,ht,"widget",function(hw){var hx=hw.widgets||(hw.widgets=[]);if(hs.insertAt==null){hx.push(hs)}else{hx.splice(Math.min(hx.length-1,Math.max(0,hs.insertAt)),0,hs)}hs.line=hw;if(i&&!gl(hu,hw)){var hv=b7(hw)<hu.scrollTop;hb(hw,hw.height+dt(hs));if(hv){db(i,hs.height)}i.curOp.forceUpdate=true}return true});if(i){am(i,"lineWidgetAdded",i,hs,typeof ht=="number"?ht:b8(ht))}return hs}var bh=0;var V=function(hq,i){this.lines=[];this.type=i;this.doc=hq;this.id=++bh};V.prototype.clear=function(){var hv=this;if(this.explicitlyCleared){return}var hz=this.doc.cm,hs=hz&&!hz.curOp;if(hs){dd(hz)}if(f9(this,"clear")){var hA=this.find();if(hA){am(this,"clear",hA.from,hA.to)}}var ht=null,hx=null;for(var hu=0;hu<this.lines.length;++hu){var hB=hv.lines[hu];var hy=fZ(hB.markedSpans,hv);if(hz&&!hv.collapsed){W(hz,b8(hB),"text")}else{if(hz){if(hy.to!=null){hx=b8(hB)}if(hy.from!=null){ht=b8(hB)}}}hB.markedSpans=fs(hB.markedSpans,hy);if(hy.from==null&&hv.collapsed&&!gl(hv.doc,hB)&&hz){hb(hB,bb(hz.display))}}if(hz&&this.collapsed&&!hz.options.lineWrapping){for(var hr=0;hr<this.lines.length;++hr){var hq=z(hv.lines[hr]),hw=e1(hq);if(hw>hz.display.maxLineLength){hz.display.maxLine=hq;hz.display.maxLineLength=hw;hz.display.maxLineChanged=true}}}if(ht!=null&&hz&&this.collapsed){ap(hz,ht,hx+1)}this.lines.length=0;this.explicitlyCleared=true;if(this.atomic&&this.doc.cantEdit){this.doc.cantEdit=false;if(hz){ff(hz.doc)}}if(hz){am(hz,"markerCleared",hz,this,ht,hx)}if(hs){aw(hz)}if(this.parent){this.parent.clear()}};V.prototype.find=function(ht,hr){var hx=this;if(ht==null&&this.type=="bookmark"){ht=1}var hw,hv;for(var hs=0;hs<this.lines.length;++hs){var hq=hx.lines[hs];var hu=fZ(hq.markedSpans,hx);if(hu.from!=null){hw=ac(hr?hq:b8(hq),hu.from);if(ht==-1){return hw}}if(hu.to!=null){hv=ac(hr?hq:b8(hq),hu.to);if(ht==1){return hv}}}return hw&&{from:hw,to:hv}};V.prototype.changed=function(){var hs=this;var hr=this.find(-1,true),hq=this,i=this.doc.cm;if(!hr||!i){return}dh(i,function(){var hu=hr.line,hv=b8(hr.line);var ht=f1(i,hv);if(ht){aE(ht);i.curOp.selectionChanged=i.curOp.forceUpdate=true}i.curOp.updateMaxLine=true;if(!gl(hq.doc,hu)&&hq.height!=null){var hx=hq.height;hq.height=null;var hw=dt(hq)-hx;if(hw){hb(hu,hu.height+hw)}}am(i,"markerChanged",i,hs)})};V.prototype.attachLine=function(i){if(!this.lines.length&&this.doc.cm){var hq=this.doc.cm.curOp;if(!hq.maybeHiddenMarkers||dR(hq.maybeHiddenMarkers,this)==-1){(hq.maybeUnhiddenMarkers||(hq.maybeUnhiddenMarkers=[])).push(this)}}this.lines.push(i)};V.prototype.detachLine=function(i){this.lines.splice(dR(this.lines,i),1);if(!this.lines.length&&this.doc.cm){var hq=this.doc.cm.curOp;(hq.maybeHiddenMarkers||(hq.maybeHiddenMarkers=[])).push(this)}};bT(V);function fp(hy,hw,hx,hA,hu){if(hA&&hA.shared){return S(hy,hw,hx,hA,hu)}if(hy.cm&&!hy.cm.curOp){return dw(hy.cm,fp)(hy,hw,hx,hA,hu)}var ht=new V(hy,hu),hz=cF(hw,hx);if(hA){aZ(hA,ht,false)}if(hz>0||hz==0&&ht.clearWhenEmpty!==false){return ht}if(ht.replacedWith){ht.collapsed=true;ht.widgetNode=hc("span",[ht.replacedWith],"CodeMirror-widget");if(!hA.handleMouseEvents){ht.widgetNode.setAttribute("cm-ignore-events","true")}if(hA.insertLeft){ht.widgetNode.insertLeft=true}}if(ht.collapsed){if(A(hy,hw.line,hw,hx,ht)||hw.line!=hx.line&&A(hy,hx.line,hw,hx,ht)){throw new Error("Inserting collapsed marker partially overlapping an existing one")}bQ()}if(ht.addToHistory){gG(hy,{from:hw,to:hx,origin:"markText"},hy.sel,NaN)}var hr=hw.line,hv=hy.cm,hq;hy.iter(hr,hx.line+1,function(i){if(hv&&ht.collapsed&&!hv.options.lineWrapping&&z(i)==hv.display.maxLine){hq=true}if(ht.collapsed&&hr!=hw.line){hb(i,0)}cC(i,new eW(ht,hr==hw.line?hw.ch:null,hr==hx.line?hx.ch:null));++hr});if(ht.collapsed){hy.iter(hw.line,hx.line+1,function(i){if(gl(hy,i)){hb(i,0)}})}if(ht.clearOnEnter){cj(ht,"beforeCursorEnter",function(){return ht.clear()})}if(ht.readOnly){gq();if(hy.history.done.length||hy.history.undone.length){hy.clearHistory()}}if(ht.collapsed){ht.id=++bh;ht.atomic=true}if(hv){if(hq){hv.curOp.updateMaxLine=true}if(ht.collapsed){ap(hv,hw.line,hx.line+1)}else{if(ht.className||ht.title||ht.startStyle||ht.endStyle||ht.css){for(var hs=hw.line;hs<=hx.line;hs++){W(hv,hs,"text")}}}if(ht.atomic){ff(hv.doc)}am(hv,"markerAdded",hv,ht)}return ht}var y=function(hs,hr){var ht=this;this.markers=hs;this.primary=hr;for(var hq=0;hq<hs.length;++hq){hs[hq].parent=ht}};y.prototype.clear=function(){var hr=this;if(this.explicitlyCleared){return}this.explicitlyCleared=true;for(var hq=0;hq<this.markers.length;++hq){hr.markers[hq].clear()}am(this,"clear")};y.prototype.find=function(hq,i){return this.primary.find(hq,i)};bT(y);function S(ht,hw,hv,i,hr){i=aZ(i);i.shared=false;var hu=[fp(ht,hw,hv,i,hr)],hq=hu[0];var hs=i.widgetNode;eJ(ht,function(hy){if(hs){i.widgetNode=hs.cloneNode(true)}hu.push(fp(hy,gD(hy,hw),gD(hy,hv),i,hr));for(var hx=0;hx<hy.linked.length;++hx){if(hy.linked[hx].isParent){return}}hq=gy(hu)});return new y(hu,hq)}function fB(i){return i.findMarks(ac(i.first,0),i.clipPos(ac(i.lastLine())),function(hq){return hq.parent})}function ec(hv,hw){for(var ht=0;ht<hw.length;ht++){var hr=hw[ht],hx=hr.find();var hq=hv.clipPos(hx.from),hu=hv.clipPos(hx.to);if(cF(hq,hu)){var hs=fp(hv,hq,hu,hr.primary,hr.primary.type);hr.markers.push(hs);hs.parent=hr}}}function e3(hs){var hq=function(hv){var ht=hs[hv],hx=[ht.primary.doc];eJ(ht.primary.doc,function(i){return hx.push(i)});for(var hu=0;hu<ht.markers.length;hu++){var hw=ht.markers[hu];if(dR(hx,hw.doc)==-1){hw.parent=null;ht.markers.splice(hu--,1)}}};for(var hr=0;hr<hs.length;hr++){hq(hr)}}var cU=0;var aD=function(ht,hs,i,hr,hq){if(!(this instanceof aD)){return new aD(ht,hs,i,hr,hq)}if(i==null){i=0}gn.call(this,[new fO([new ha("",null)])]);this.first=i;this.scrollTop=this.scrollLeft=0;this.cantEdit=false;this.cleanGeneration=1;this.modeFrontier=this.highlightFrontier=i;var hu=ac(i,0);this.sel=fE(hu);this.history=new gR(null);this.id=++cU;this.modeOption=hs;this.lineSep=hr;this.direction=(hq=="rtl")?"rtl":"ltr";this.extend=false;if(typeof ht=="string"){ht=this.splitLines(ht)}go(this,{from:hu,to:hu,text:ht});cg(this,fE(hu),ah)};aD.prototype=cM(gn.prototype,{constructor:aD,iter:function(hr,hq,i){if(i){this.iterN(hr-this.first,hq-hr,i)}else{this.iterN(this.first,this.first+this.size,hr)}},insert:function(hr,hs){var hq=0;for(var ht=0;ht<hs.length;++ht){hq+=hs[ht].height}this.insertInner(hr-this.first,hs,hq)},remove:function(i,hq){this.removeInner(i-this.first,hq)},getValue:function(hq){var i=bf(this,this.first,this.first+this.size);if(hq===false){return i}return i.join(hq||this.lineSeparator())},setValue:c7(function(hq){var hr=ac(this.first,0),i=this.first+this.size-1;bt(this,{from:hr,to:ac(i,f4(this,i).text.length),text:this.splitLines(hq),origin:"setValue",full:true},true);if(this.cm){fy(this.cm,0,0)}cg(this,fE(hr),ah)}),replaceRange:function(hq,hs,hr,i){hs=gD(this,hs);hr=hr?gD(this,hr):hs;be(this,hq,hs,hr,i)},getRange:function(hs,hr,hq){var i=g8(this,gD(this,hs),gD(this,hr));if(hq===false){return i}return i.join(hq||this.lineSeparator())},getLine:function(hq){var i=this.getLineHandle(hq);return i&&i.text},getLineHandle:function(i){if(cw(this,i)){return f4(this,i)}},getLineNumber:function(i){return b8(i)},getLineHandleVisualStart:function(i){if(typeof i=="number"){i=f4(this,i)}return z(i)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(i){return gD(this,i)},getCursor:function(hr){var i=this.sel.primary(),hq;if(hr==null||hr=="head"){hq=i.head}else{if(hr=="anchor"){hq=i.anchor}else{if(hr=="end"||hr=="to"||hr===false){hq=i.to()}else{hq=i.from()}}}return hq},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:c7(function(i,hr,hq){J(this,gD(this,typeof i=="number"?ac(i,hr||0):i),null,hq)}),setSelection:c7(function(hq,hr,i){J(this,gD(this,hq),gD(this,hr||hq),i)}),extendSelection:c7(function(hr,i,hq){gX(this,gD(this,hr),i&&gD(this,i),hq)}),extendSelections:c7(function(hq,i){aF(this,eB(this,hq),i)}),extendSelectionsBy:c7(function(hr,i){var hq=cf(this.sel.ranges,hr);aF(this,eB(this,hq),i)}),setSelections:c7(function(hq,hu,hs){var hv=this;if(!hq.length){return}var hr=[];for(var ht=0;ht<hq.length;ht++){hr[ht]=new ex(gD(hv,hq[ht].anchor),gD(hv,hq[ht].head))}if(hu==null){hu=Math.min(hq.length-1,this.sel.primIndex)}cg(this,cZ(hr,hu),hs)}),addSelection:c7(function(hr,hs,hq){var i=this.sel.ranges.slice(0);i.push(new ex(gD(this,hr),gD(this,hs||hr)));cg(this,cZ(i,i.length-1),hq)}),getSelection:function(hu){var hv=this;var hr=this.sel.ranges,hq;for(var hs=0;hs<hr.length;hs++){var ht=g8(hv,hr[hs].from(),hr[hs].to());hq=hq?hq.concat(ht):ht}if(hu===false){return hq}else{return hq.join(hu||this.lineSeparator())}},getSelections:function(hu){var hv=this;var ht=[],hq=this.sel.ranges;for(var hr=0;hr<hq.length;hr++){var hs=g8(hv,hq[hr].from(),hq[hr].to());if(hu!==false){hs=hs.join(hu||hv.lineSeparator())}ht[hr]=hs}return ht},replaceSelection:function(hs,hu,hq){var ht=[];for(var hr=0;hr<this.sel.ranges.length;hr++){ht[hr]=hs}this.replaceSelections(ht,hu,hq||"+input")},replaceSelections:c7(function(hr,hx,hz){var hv=this;var hy=[],ht=this.sel;for(var hu=0;hu<ht.ranges.length;hu++){var hw=ht.ranges[hu];hy[hu]={from:hw.from(),to:hw.to(),text:hv.splitLines(hr[hu]),origin:hz}}var hq=hx&&hx!="end"&&an(this,hy,hx);for(var hs=hy.length-1;hs>=0;hs--){bt(hv,hy[hs])}if(hq){fX(this,hq)}else{if(this.cm){gx(this.cm)}}}),undo:c7(function(){cv(this,"undo")}),redo:c7(function(){cv(this,"redo")}),undoSelection:c7(function(){cv(this,"undo",true)}),redoSelection:c7(function(){cv(this,"redo",true)}),setExtending:function(i){this.extend=i},getExtending:function(){return this.extend},historySize:function(){var ht=this.history,hq=0,hs=0;for(var hr=0;hr<ht.done.length;hr++){if(!ht.done[hr].ranges){++hq}}for(var hu=0;hu<ht.undone.length;hu++){if(!ht.undone[hu].ranges){++hs}}return{undo:hq,redo:hs}},clearHistory:function(){this.history=new gR(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(true)},changeGeneration:function(i){if(i){this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null}return this.history.generation},isClean:function(i){return this.history.generation==(i||this.cleanGeneration)},getHistory:function(){return{done:ca(this.history.done),undone:ca(this.history.undone)}},setHistory:function(hq){var i=this.history=new gR(this.history.maxGeneration);i.done=ca(hq.done.slice(0),null,true);i.undone=ca(hq.undone.slice(0),null,true)},setGutterMarker:c7(function(i,hq,hr){return fi(this,i,"gutter",function(hs){var ht=hs.gutterMarkers||(hs.gutterMarkers={});ht[hq]=hr;if(!hr&&fI(ht)){hs.gutterMarkers=null}return true})}),clearGutter:c7(function(i){var hq=this;this.iter(function(hr){if(hr.gutterMarkers&&hr.gutterMarkers[i]){fi(hq,hr,"gutter",function(){hr.gutterMarkers[i]=null;if(fI(hr.gutterMarkers)){hr.gutterMarkers=null}return true})}})}),lineInfo:function(i){var hq;if(typeof i=="number"){if(!cw(this,i)){return null}hq=i;i=f4(this,i);if(!i){return null}}else{hq=b8(i);if(hq==null){return null}}return{line:hq,handle:i,text:i.text,gutterMarkers:i.gutterMarkers,textClass:i.textClass,bgClass:i.bgClass,wrapClass:i.wrapClass,widgets:i.widgets}},addLineClass:c7(function(hr,hq,i){return fi(this,hr,hq=="gutter"?"gutter":"class",function(hs){var ht=hq=="text"?"textClass":hq=="background"?"bgClass":hq=="gutter"?"gutterClass":"wrapClass";if(!hs[ht]){hs[ht]=i}else{if(Y(i).test(hs[ht])){return false}else{hs[ht]+=" "+i}}return true})}),removeLineClass:c7(function(hr,hq,i){return fi(this,hr,hq=="gutter"?"gutter":"class",function(ht){var hw=hq=="text"?"textClass":hq=="background"?"bgClass":hq=="gutter"?"gutterClass":"wrapClass";var hv=ht[hw];if(!hv){return false}else{if(i==null){ht[hw]=null}else{var hu=hv.match(Y(i));if(!hu){return false}var hs=hu.index+hu[0].length;ht[hw]=hv.slice(0,hu.index)+(!hu.index||hs==hv.length?"":" ")+hv.slice(hs)||null}}return true})}),addLineWidget:c7(function(hr,hq,i){return b0(this,hr,hq,i)}),removeLineWidget:function(i){i.clear()},markText:function(hr,hq,i){return fp(this,gD(this,hr),gD(this,hq),i,i&&i.type||"range")},setBookmark:function(hr,i){var hq={replacedWith:i&&(i.nodeType==null?i.widget:i),insertLeft:i&&i.insertLeft,clearWhenEmpty:false,shared:i&&i.shared,handleMouseEvents:i&&i.handleMouseEvents};hr=gD(this,hr);return fp(this,hr,hr,hq,"bookmark")},findMarksAt:function(hu){hu=gD(this,hu);var ht=[],hr=f4(this,hu.line).markedSpans;if(hr){for(var hq=0;hq<hr.length;++hq){var hs=hr[hq];if((hs.from==null||hs.from<=hu.ch)&&(hs.to==null||hs.to>=hu.ch)){ht.push(hs.marker.parent||hs.marker)}}}return ht},findMarks:function(ht,hs,i){ht=gD(this,ht);hs=gD(this,hs);var hq=[],hr=ht.line;this.iter(ht.line,hs.line+1,function(hu){var hw=hu.markedSpans;if(hw){for(var hv=0;hv<hw.length;hv++){var hx=hw[hv];if(!(hx.to!=null&&hr==ht.line&&ht.ch>=hx.to||hx.from==null&&hr!=ht.line||hx.from!=null&&hr==hs.line&&hx.from>=hs.ch)&&(!i||i(hx.marker))){hq.push(hx.marker.parent||hx.marker)}}}++hr});return hq},getAllMarks:function(){var i=[];this.iter(function(hr){var hq=hr.markedSpans;if(hq){for(var hs=0;hs<hq.length;++hs){if(hq[hs].from!=null){i.push(hq[hs].marker)}}}});return i},posFromIndex:function(hr){var i,hs=this.first,hq=this.lineSeparator().length;this.iter(function(ht){var hu=ht.text.length+hq;if(hu>hr){i=hr;return true}hr-=hu;++hs});return gD(this,ac(hs,i))},indexFromPos:function(hr){hr=gD(this,hr);var i=hr.ch;if(hr.line<this.first||hr.ch<0){return 0}var hq=this.lineSeparator().length;this.iter(this.first,hr.line,function(hs){i+=hs.text.length+hq});return i},copy:function(i){var hq=new aD(bf(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);hq.scrollTop=this.scrollTop;hq.scrollLeft=this.scrollLeft;hq.sel=this.sel;hq.extend=false;if(i){hq.history.undoDepth=this.history.undoDepth;hq.setHistory(this.getHistory())}return hq},linkedDoc:function(i){if(!i){i={}}var hs=this.first,hr=this.first+this.size;if(i.from!=null&&i.from>hs){hs=i.from}if(i.to!=null&&i.to<hr){hr=i.to}var hq=new aD(bf(this,hs,hr),i.mode||this.modeOption,hs,this.lineSep,this.direction);if(i.sharedHist){hq.history=this.history}(this.linked||(this.linked=[])).push({doc:hq,sharedHist:i.sharedHist});hq.linked=[{doc:this,isParent:true,sharedHist:i.sharedHist}];ec(hq,fB(this));return hq},unlinkDoc:function(hr){var hu=this;if(hr instanceof K){hr=hr.doc}if(this.linked){for(var hs=0;hs<this.linked.length;++hs){var ht=hu.linked[hs];if(ht.doc!=hr){continue}hu.linked.splice(hs,1);hr.unlinkDoc(hu);e3(fB(hu));break}}if(hr.history==this.history){var hq=[hr.id];eJ(hr,function(i){return hq.push(i.id)},true);hr.history=new gR(null);hr.history.done=ca(this.history.done,hq);hr.history.undone=ca(this.history.undone,hq)}},iterLinkedDocs:function(i){eJ(this,i)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(i){if(this.lineSep){return i.split(this.lineSep)}return gO(i)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:c7(function(i){if(i!="rtl"){i="ltr"}if(i==this.direction){return}this.direction=i;this.iter(function(hq){return hq.order=null});if(this.cm){eA(this.cm)}})});aD.prototype.eachLine=aD.prototype.iter;var ao=0;function bx(hy){var hA=this;dJ(hA);if(a4(hA,hy)||bo(hA.display,hy)){return}c9(hy);if(ei){ao=+new Date}var hz=cQ(hA,hy,true),hr=hy.dataTransfer.files;if(!hz||hA.isReadOnly()){return}if(hr&&hr.length&&window.FileReader&&window.File){var hu=hr.length,hB=Array(hu),hs=0;var hw=function(hE,hD){if(hA.options.allowDropFileTypes&&dR(hA.options.allowDropFileTypes,hE.type)==-1){return}var hC=new FileReader;hC.onload=dw(hA,function(){var i=hC.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(i)){i=""}hB[hD]=i;if(++hs==hu){hz=gD(hA.doc,hz);var hF={from:hz,to:hz,text:hA.doc.splitLines(hB.join(hA.doc.lineSeparator())),origin:"paste"};bt(hA.doc,hF);fX(hA.doc,fE(hz,ds(hF)))}});hC.readAsText(hE)};for(var hx=0;hx<hu;++hx){hw(hr[hx],hx)}}else{if(hA.state.draggingText&&hA.doc.sel.contains(hz)>-1){hA.state.draggingText(hy);setTimeout(function(){return hA.display.input.focus()},20);return}try{var hq=hy.dataTransfer.getData("Text");if(hq){var hv;if(hA.state.draggingText&&!hA.state.draggingText.copy){hv=hA.listSelections()}e4(hA.doc,fE(hz,hz));if(hv){for(var ht=0;ht<hv.length;++ht){be(hA.doc,"",hv[ht].anchor,hv[ht].head,"drag")}}hA.replaceSelection(hq,"around","paste");hA.display.input.focus()}}catch(hy){}}}function U(i,hr){if(ei&&(!i.state.draggingText||+new Date-ao<100)){e6(hr);return}if(a4(i,hr)||bo(i.display,hr)){return}hr.dataTransfer.setData("Text",i.getSelection());hr.dataTransfer.effectAllowed="copyMove";if(hr.dataTransfer.setDragImage&&!aM){var hq=g5("img",null,null,"position: fixed; left: 0; top: 0;");hq.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";if(eE){hq.width=hq.height=1;i.display.wrapper.appendChild(hq);hq._top=hq.offsetTop}hr.dataTransfer.setDragImage(hq,0,0);if(eE){hq.parentNode.removeChild(hq)}}}function hn(i,hq){var hs=cQ(i,hq);if(!hs){return}var hr=document.createDocumentFragment();C(i,hs,hr);if(!i.display.dragCursor){i.display.dragCursor=g5("div",null,"CodeMirror-cursors CodeMirror-dragcursors");i.display.lineSpace.insertBefore(i.display.dragCursor,i.display.cursorDiv)}ce(i.display.dragCursor,hr)}function dJ(i){if(i.display.dragCursor){i.display.lineSpace.removeChild(i.display.dragCursor);i.display.dragCursor=null}}function aK(ht){if(!document.getElementsByClassName){return}var hs=document.getElementsByClassName("CodeMirror");for(var hr=0;hr<hs.length;hr++){var hq=hs[hr].CodeMirror;if(hq){ht(hq)}}}var c6=false;function bw(){if(c6){return}gw();c6=true}function gw(){var i;cj(window,"resize",function(){if(i==null){i=setTimeout(function(){i=null;aK(a6)},100)}});cj(window,"blur",function(){return aK(a8)})}function a6(i){var hq=i.display;hq.cachedCharWidth=hq.cachedTextHeight=hq.cachedPaddingH=null;hq.scrollbarsClipped=false;i.setSize()}var f5={3:"Pause",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",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",145:"ScrollLock",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"};for(var gm=0;gm<10;gm++){f5[gm+48]=f5[gm+96]=String(gm)}for(var gQ=65;gQ<=90;gQ++){f5[gQ]=String.fromCharCode(gQ)}for(var gP=1;gP<=12;gP++){f5[gP+111]=f5[gP+63235]="F"+gP}var f0={};f0.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"};f0.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"};f0.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"};f0.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]};f0["default"]=cu?f0.macDefault:f0.pcDefault;function d2(hr){var hx=hr.split(/-(?!$)/);hr=hx[hx.length-1];var hw,hv,hq,hu;for(var ht=0;ht<hx.length-1;ht++){var hs=hx[ht];if(/^(cmd|meta|m)$/i.test(hs)){hu=true}else{if(/^a(lt)?$/i.test(hs)){hw=true}else{if(/^(c|ctrl|control)$/i.test(hs)){hv=true}else{if(/^s(hift)?$/i.test(hs)){hq=true}else{throw new Error("Unrecognized modifier name: "+hs)}}}}}if(hw){hr="Alt-"+hr}if(hv){hr="Ctrl-"+hr}if(hu){hr="Cmd-"+hr}if(hq){hr="Shift-"+hr}return hr}function da(hx){var hr={};for(var hw in hx){if(hx.hasOwnProperty(hw)){var hy=hx[hw];if(/^(name|fallthrough|(de|at)tach)$/.test(hw)){continue}if(hy=="..."){delete hx[hw];continue}var hz=cf(hw.split(" "),d2);for(var hv=0;hv<hz.length;hv++){var ht=(void 0),hs=(void 0);if(hv==hz.length-1){hs=hz.join(" ");ht=hy}else{hs=hz.slice(0,hv+1).join(" ");ht="..."}var hu=hr[hs];if(!hu){hr[hs]=ht}else{if(hu!=ht){throw new Error("Inconsistent bindings for "+hs)}}}delete hx[hw]}}for(var hq in hr){hx[hq]=hr[hq]}return hx}function k(ht,hw,hv,hs){hw=gW(hw);var hu=hw.call?hw.call(ht,hs):hw[ht];if(hu===false){return"nothing"}if(hu==="..."){return"multi"}if(hu!=null&&hv(hu)){return"handled"}if(hw.fallthrough){if(Object.prototype.toString.call(hw.fallthrough)!="[object Array]"){return k(ht,hw.fallthrough,hv,hs)}for(var hr=0;hr<hw.fallthrough.length;hr++){var hq=k(ht,hw.fallthrough[hr],hv,hs);if(hq){return hq}}}}function fj(hq){var i=typeof hq=="string"?hq:f5[hq.keyCode];return i=="Ctrl"||i=="Alt"||i=="Shift"||i=="Mod"}function gZ(i,hq,hs){var hr=i;if(hq.altKey&&hr!="Alt"){i="Alt-"+i}if((cc?hq.metaKey:hq.ctrlKey)&&hr!="Ctrl"){i="Ctrl-"+i}if((cc?hq.ctrlKey:hq.metaKey)&&hr!="Cmd"){i="Cmd-"+i}if(!hs&&hq.shiftKey&&hr!="Shift"){i="Shift-"+i}return i}function gf(hq,hr){if(eE&&hq.keyCode==34&&hq["char"]){return false}var i=f5[hq.keyCode];if(i==null||hq.altGraphKey){return false}if(hq.keyCode==3&&hq.code){i=hq.code}return gZ(i,hq,hr)}function gW(i){return typeof i=="string"?f0[i]:i}function fM(hq,hw){var hr=hq.doc.sel.ranges,hu=[];for(var ht=0;ht<hr.length;ht++){var hs=hw(hr[ht]);while(hu.length&&cF(hs.from,gy(hu).to)<=0){var hv=hu.pop();if(cF(hv.from,hs.from)<0){hs.from=hv.from;break}}hu.push(hs)}dh(hq,function(){for(var hx=hu.length-1;hx>=0;hx--){be(hq.doc,"",hu[hx].from,hu[hx].to,"+delete")}gx(hq)})}function bH(i,hr,hq){var hs=eX(i.text,hr+hq,hq);return hs<0||hs>i.text.length?null:hs}function aq(i,hs,hq){var hr=bH(i,hs.ch,hq);return hr==null?null:new ac(hs.line,hr,hq<0?"after":"before")}function fh(hq,hy,hv,hu,hs){if(hq){var ht=a(hv,hy.doc.direction);if(ht){var hr=hs<0?gy(ht):ht[0];var hA=(hs<0)==(hr.level==1);var hx=hA?"after":"before";var i;if(hr.level>0||hy.doc.direction=="rtl"){var hw=bi(hy,hv);i=hs<0?hv.text.length-1:0;var hz=F(hy,hw,i).top;i=cP(function(hB){return F(hy,hw,hB).top==hz},(hs<0)==(hr.level==1)?hr.from:hr.to-1,i);if(hx=="before"){i=bH(hv,i,1)}}else{i=hs<0?hr.to:hr.from}return new ac(hu,i,hx)}}return new ac(hu,hs<0?hv.text.length:0,hs<0?"before":"after")}function v(hA,hF,ht,hw){var hC=a(hF,hA.doc.direction);if(!hC){return aq(hF,ht,hw)}if(ht.ch>=hF.text.length){ht.ch=hF.text.length;ht.sticky="before"}else{if(ht.ch<=0){ht.ch=0;ht.sticky="after"}}var hs=aS(hC,ht.ch,ht.sticky),hu=hC[hs];if(hA.doc.direction=="ltr"&&hu.level%2==0&&(hw>0?hu.to>ht.ch:hu.from<ht.ch)){return aq(hF,ht,hw)}var hD=function(hH,hG){return bH(hF,hH instanceof ac?hH.ch:hH,hG)};var hx;var hB=function(hG){if(!hA.options.lineWrapping){return{begin:0,end:hF.text.length}}hx=hx||bi(hA,hF);return bB(hA,hF,hx,hG)};var hv=hB(ht.sticky=="before"?hD(ht,-1):ht.ch);if(hA.doc.direction=="rtl"||hu.level==1){var hE=(hu.level==1)==(hw<0);var hq=hD(ht,hE?1:-1);if(hq!=null&&(!hE?hq>=hu.from&&hq>=hv.begin:hq<=hu.to&&hq<=hv.end)){var hz=hE?"before":"after";return new ac(ht.line,hq,hz)}}var hr=function(hG,hJ,hM){var hI=function(hO,hN){return hN?new ac(ht.line,hD(hO,1),"before"):new ac(ht.line,hO,"after")};for(;hG>=0&&hG<hC.length;hG+=hJ){var hH=hC[hG];var hK=(hJ>0)==(hH.level!=1);var hL=hK?hM.begin:hD(hM.end,-1);if(hH.from<=hL&&hL<hH.to){return hI(hL,hK)}hL=hK?hH.from:hD(hH.to,-1);if(hM.begin<=hL&&hL<hM.end){return hI(hL,hK)}}};var hy=hr(hs+hw,hw,hv);if(hy){return hy}var i=hw>0?hv.end:hD(hv.begin,-1);if(i!=null&&!(hw>0&&i==hF.text.length)){hy=hr(hw>0?0:hC.length-1,hw,hB(i));if(hy){return hy}}return null}var fm={selectAll:av,singleSelection:function(i){return i.setSelection(i.getCursor("anchor"),i.getCursor("head"),ah)},killLine:function(i){return fM(i,function(hr){if(hr.empty()){var hq=f4(i.doc,hr.head.line).text.length;if(hr.head.ch==hq&&hr.head.line<i.lastLine()){return{from:hr.head,to:ac(hr.head.line+1,0)}}else{return{from:hr.head,to:ac(hr.head.line,hq)}}}else{return{from:hr.from(),to:hr.to()}}})},deleteLine:function(i){return fM(i,function(hq){return({from:ac(hq.from().line,0),to:gD(i.doc,ac(hq.to().line+1,0))})})},delLineLeft:function(i){return fM(i,function(hq){return({from:ac(hq.from().line,0),to:hq.from()})})},delWrappedLineLeft:function(i){return fM(i,function(hq){var hs=i.charCoords(hq.head,"div").top+5;var hr=i.coordsChar({left:0,top:hs},"div");return{from:hr,to:hq.from()}})},delWrappedLineRight:function(i){return fM(i,function(hq){var hs=i.charCoords(hq.head,"div").top+5;var hr=i.coordsChar({left:i.display.lineDiv.offsetWidth+100,top:hs},"div");return{from:hq.from(),to:hr}})},undo:function(i){return i.undo()},redo:function(i){return i.redo()},undoSelection:function(i){return i.undoSelection()},redoSelection:function(i){return i.redoSelection()},goDocStart:function(i){return i.extendSelection(ac(i.firstLine(),0))},goDocEnd:function(i){return i.extendSelection(ac(i.lastLine()))},goLineStart:function(i){return i.extendSelectionsBy(function(hq){return bM(i,hq.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(i){return i.extendSelectionsBy(function(hq){return ef(i,hq.head)},{origin:"+move",bias:1})},goLineEnd:function(i){return i.extendSelectionsBy(function(hq){return eo(i,hq.head.line)},{origin:"+move",bias:-1})},goLineRight:function(i){return i.extendSelectionsBy(function(hq){var hr=i.cursorCoords(hq.head,"div").top+5;return i.coordsChar({left:i.display.lineDiv.offsetWidth+100,top:hr},"div")},dr)},goLineLeft:function(i){return i.extendSelectionsBy(function(hq){var hr=i.cursorCoords(hq.head,"div").top+5;return i.coordsChar({left:0,top:hr},"div")},dr)},goLineLeftSmart:function(i){return i.extendSelectionsBy(function(hq){var hr=i.cursorCoords(hq.head,"div").top+5;var hs=i.coordsChar({left:0,top:hr},"div");if(hs.ch<i.getLine(hs.line).search(/\S/)){return ef(i,hq.head)}return hs},dr)},goLineUp:function(i){return i.moveV(-1,"line")},goLineDown:function(i){return i.moveV(1,"line")},goPageUp:function(i){return i.moveV(-1,"page")},goPageDown:function(i){return i.moveV(1,"page")},goCharLeft:function(i){return i.moveH(-1,"char")},goCharRight:function(i){return i.moveH(1,"char")},goColumnLeft:function(i){return i.moveH(-1,"column")},goColumnRight:function(i){return i.moveH(1,"column")},goWordLeft:function(i){return i.moveH(-1,"word")},goGroupRight:function(i){return i.moveH(1,"group")},goGroupLeft:function(i){return i.moveH(-1,"group")},goWordRight:function(i){return i.moveH(1,"word")},delCharBefore:function(i){return i.deleteH(-1,"char")},delCharAfter:function(i){return i.deleteH(1,"char")},delWordBefore:function(i){return i.deleteH(-1,"word")},delWordAfter:function(i){return i.deleteH(1,"word")},delGroupBefore:function(i){return i.deleteH(-1,"group")},delGroupAfter:function(i){return i.deleteH(1,"group")},indentAuto:function(i){return i.indentSelection("smart")},indentMore:function(i){return i.indentSelection("add")},indentLess:function(i){return i.indentSelection("subtract")},insertTab:function(i){return i.replaceSelection("\t")},insertSoftTab:function(hq){var hs=[],hr=hq.listSelections(),hv=hq.options.tabSize;for(var hu=0;hu<hr.length;hu++){var hw=hr[hu].from();var ht=cd(hq.getLine(hw.line),hw.ch,hv);hs.push(cS(hv-ht%hv))}hq.replaceSelections(hs)},defaultTab:function(i){if(i.somethingSelected()){i.indentSelection("add")}else{i.execCommand("insertTab")}},transposeChars:function(i){return dh(i,function(){var hs=i.listSelections(),hr=[];for(var ht=0;ht<hs.length;ht++){if(!hs[ht].empty()){continue}var hv=hs[ht].head,hq=f4(i.doc,hv.line).text;if(hq){if(hv.ch==hq.length){hv=new ac(hv.line,hv.ch-1)}if(hv.ch>0){hv=new ac(hv.line,hv.ch+1);i.replaceRange(hq.charAt(hv.ch-1)+hq.charAt(hv.ch-2),ac(hv.line,hv.ch-2),hv,"+transpose")}else{if(hv.line>i.doc.first){var hu=f4(i.doc,hv.line-1).text;if(hu){hv=new ac(hv.line,1);i.replaceRange(hq.charAt(0)+i.doc.lineSeparator()+hu.charAt(hu.length-1),ac(hv.line-1,hu.length-1),hv,"+transpose")}}}}hr.push(new ex(hv,hv))}i.setSelections(hr)})},newlineAndIndent:function(i){return dh(i,function(){var hq=i.listSelections();for(var hr=hq.length-1;hr>=0;hr--){i.replaceRange(i.doc.lineSeparator(),hq[hr].anchor,hq[hr].head,"+input")}hq=i.listSelections();for(var hs=0;hs<hq.length;hs++){i.indentLine(hq[hs].from().line,null,true)}gx(i)})},openLine:function(i){return i.replaceSelection("\n","start")},toggleOverwrite:function(i){return i.toggleOverwrite()}};function bM(i,hr){var hq=f4(i.doc,hr);var hs=z(hq);if(hs!=hq){hr=b8(hs)}return fh(true,i,hs,hr,1)}function eo(i,hr){var hq=f4(i.doc,hr);var hs=cL(hq);if(hs!=hq){hr=b8(hs)}return fh(true,i,hq,hr,-1)}function ef(hq,hv){var hu=bM(hq,hv.line);var hr=f4(hq.doc,hu.line);var i=a(hr,hq.doc.direction);if(!i||i[0].level==0){var ht=Math.max(0,hr.text.search(/\S/));var hs=hv.line==hu.line&&hv.ch<=ht&&hv.ch;return ac(hu.line,hs?0:ht,hu.sticky)}return hu}function gN(hq,ht,i){if(typeof ht=="string"){ht=fm[ht];if(!ht){return false}}hq.display.input.ensurePolled();var hs=hq.display.shift,hr=false;try{if(hq.isReadOnly()){hq.state.suppressEdits=true}if(i){hq.display.shift=false}hr=ht(hq)!=cz}finally{hq.display.shift=hs;hq.state.suppressEdits=false}return hr}function eK(hr,hs,hu){for(var ht=0;ht<hr.state.keyMaps.length;ht++){var hq=k(hs,hr.state.keyMaps[ht],hu,hr);if(hq){return hq}}return(hr.options.extraKeys&&k(hs,hr.options.extraKeys,hu,hr))||k(hs,hr.options.keyMap,hu,hr)}var ek=new hp;function bq(i,hr,ht,hs){var hq=i.state.keySeq;if(hq){if(fj(hr)){return"handled"}if(/\'$/.test(hr)){i.state.keySeq=null}else{ek.set(50,function(){if(i.state.keySeq==hq){i.state.keySeq=null;i.display.input.reset()}})}if(cJ(i,hq+" "+hr,ht,hs)){return true}}return cJ(i,hr,ht,hs)}function cJ(hq,hr,ht,hs){var i=eK(hq,hr,hs);if(i=="multi"){hq.state.keySeq=hr}if(i=="handled"){am(hq,"keyHandled",hq,hr,ht)}if(i=="handled"||i=="multi"){c9(ht);q(hq)}return !!i}function f7(i,hr){var hq=gf(hr,true);if(!hq){return false}if(hr.shiftKey&&!i.state.keySeq){return bq(i,"Shift-"+hq,hr,function(hs){return gN(i,hs,true)})||bq(i,hq,hr,function(hs){if(typeof hs=="string"?/^go[A-Z]/.test(hs):hs.motion){return gN(i,hs)}})}else{return bq(i,hq,hr,function(hs){return gN(i,hs)})}}function eV(i,hr,hq){return bq(i,"'"+hq+"'",hr,function(hs){return gN(i,hs,true)})}var dX=null;function r(hs){var i=this;i.curOp.focus=em();if(a4(i,hs)){return}if(ei&&m<11&&hs.keyCode==27){hs.returnValue=false}var hq=hs.keyCode;i.display.shift=hq==16||hs.shiftKey;var hr=f7(i,hs);if(eE){dX=hr?hq:null;if(!hr&&hq==88&&!dI&&(cu?hs.metaKey:hs.ctrlKey)){i.replaceSelection("",null,"cut")}}if(hq==18&&!/\bCodeMirror-crosshair\b/.test(i.display.lineDiv.className)){aC(i)}}function aC(hq){var hr=hq.display.lineDiv;gs(hr,"CodeMirror-crosshair");function i(hs){if(hs.keyCode==18||!hs.altKey){h(hr,"CodeMirror-crosshair");eS(document,"keyup",i);eS(document,"mouseover",i)}}cj(document,"keyup",i);cj(document,"mouseover",i)}function bu(i){if(i.keyCode==16){this.doc.sel.shift=false}a4(this,i)}function c0(ht){var i=this;if(bo(i.display,ht)||a4(i,ht)||ht.ctrlKey&&!ht.altKey||cu&&ht.metaKey){return}var hs=ht.keyCode,hq=ht.charCode;if(eE&&hs==dX){dX=null;c9(ht);return}if((eE&&(!ht.which||ht.which<10))&&f7(i,ht)){return}var hr=String.fromCharCode(hq==null?hs:hq);if(hr=="\x08"){return}if(eV(i,ht,hr)){return}i.display.input.onKeyPress(ht)}var dB=400;var dV=function(hq,hr,i){this.time=hq;this.pos=hr;this.button=i};dV.prototype.compare=function(hq,hr,i){return this.time+dB>hq&&cF(hr,this.pos)==0&&i==this.button};var dW;var dM;function I(hr,hq){var i=+new Date;if(dM&&dM.compare(i,hr,hq)){dW=dM=null;return"triple"}else{if(dW&&dW.compare(i,hr,hq)){dM=new dV(i,hr,hq);dW=null;return"double"}else{dW=new dV(i,hr,hq);dM=null;return"single"}}}function fb(ht){var i=this,hs=i.display;if(a4(i,ht)||hs.activeTouch&&hs.input.supportsTouch()){return}hs.input.ensurePolled();hs.shift=ht.shiftKey;if(bo(hs,ht)){if(!dv){hs.scroller.draggable=false;setTimeout(function(){return hs.scroller.draggable=true},100)}return}if(n(i,ht)){return}var hu=cQ(i,ht),hq=gJ(ht),hr=hu?I(hu,hq):"single";window.focus();if(hq==1&&i.state.selectingText){i.state.selectingText(ht)}if(hu&&df(i,hq,hu,hr,ht)){return}if(hq==1){if(hu){aG(i,hu,hr,ht)}else{if(Q(ht)==hs.scroller){c9(ht)}}}else{if(hq==2){if(hu){gX(i.doc,hu)}setTimeout(function(){return hs.input.focus()},20)}else{if(hq==3){if(hf){aH(i,ht)}else{at(i)}}}}}function df(i,hr,hu,ht,hs){var hq="Click";if(ht=="double"){hq="Double"+hq}else{if(ht=="triple"){hq="Triple"+hq}}hq=(hr==1?"Left":hr==2?"Middle":"Right")+hq;return bq(i,gZ(hq,hs),hs,function(hw){if(typeof hw=="string"){hw=fm[hw]}if(!hw){return false}var hv=false;try{if(i.isReadOnly()){i.state.suppressEdits=true}hv=hw(i,hu)!=cz}finally{i.state.suppressEdits=false}return hv})}function b3(i,hu,hs){var hq=i.getOption("configureMouse");var ht=hq?hq(i,hu,hs):{};if(ht.unit==null){var hr=gC?hs.shiftKey&&hs.metaKey:hs.altKey;ht.unit=hr?"rectangle":hu=="single"?"char":hu=="double"?"word":"line"}if(ht.extend==null||i.doc.extend){ht.extend=i.doc.extend||hs.shiftKey}if(ht.addNew==null){ht.addNew=cu?hs.metaKey:hs.ctrlKey}if(ht.moveOnDrag==null){ht.moveOnDrag=!(cu?hs.altKey:hs.ctrlKey)}return ht}function aG(i,hv,hu,hs){if(ei){setTimeout(cY(t,i),0)}else{i.curOp.focus=em()}var hr=b3(i,hu,hs);var ht=i.doc.sel,hq;if(i.options.dragDrop&&fx&&!i.isReadOnly()&&hu=="single"&&(hq=ht.contains(hv))>-1&&(cF((hq=ht.ranges[hq]).from(),hv)<0||hv.xRel>0)&&(cF(hq.to(),hv)>0||hv.xRel<0)){bg(i,hs,hv,hr)}else{o(i,hs,hv,hr)}}function bg(hw,i,ht,hq){var hs=hw.display,hu=false;var hr=dw(hw,function(hy){if(dv){hs.scroller.draggable=false}hw.state.draggingText=false;eS(hs.wrapper.ownerDocument,"mouseup",hr);eS(hs.wrapper.ownerDocument,"mousemove",hx);eS(hs.scroller,"dragstart",hv);eS(hs.scroller,"drop",hr);if(!hu){c9(hy);if(!hq.addNew){gX(hw.doc,ht,null,null,hq.extend)}if(dv||ei&&m==9){setTimeout(function(){hs.wrapper.ownerDocument.body.focus();hs.input.focus()},20)}else{hs.input.focus()}}});var hx=function(hy){hu=hu||Math.abs(i.clientX-hy.clientX)+Math.abs(i.clientY-hy.clientY)>=10};var hv=function(){return hu=true};if(dv){hs.scroller.draggable=true}hw.state.draggingText=hr;hr.copy=!hq.moveOnDrag;if(hs.scroller.dragDrop){hs.scroller.dragDrop()}cj(hs.wrapper.ownerDocument,"mouseup",hr);cj(hs.wrapper.ownerDocument,"mousemove",hx);cj(hs.scroller,"dragstart",hv);cj(hs.scroller,"drop",hr);at(hw);setTimeout(function(){return hs.input.focus()},20)}function es(hq,hs,hr){if(hr=="char"){return new ex(hs,hs)}if(hr=="word"){return hq.findWordAt(hs)}if(hr=="line"){return new ex(ac(hs.line,0),gD(hq.doc,ac(hs.line+1,0)))}var i=hr(hq,hs);return new ex(i.from,i.to)}function o(hs,hE,hr,hw){var hD=hs.display,hH=hs.doc;c9(hE);var hq,hG,ht=hH.sel,i=ht.ranges;if(hw.addNew&&!hw.extend){hG=hH.sel.contains(hr);if(hG>-1){hq=i[hG]}else{hq=new ex(hr,hr)}}else{hq=hH.sel.primary();hG=hH.sel.primIndex}if(hw.unit=="rectangle"){if(!hw.addNew){hq=new ex(hr,hr)}hr=cQ(hs,hE,true,true);hG=-1}else{var hx=es(hs,hr,hw.unit);if(hw.extend){hq=gj(hq,hx.anchor,hx.head,hw.extend)}else{hq=hx}}if(!hw.addNew){hG=0;cg(hH,new g4([hq],0),R);ht=hH.sel}else{if(hG==-1){hG=i.length;cg(hH,cZ(i.concat([hq]),hG),{scroll:false,origin:"*mouse"})}else{if(i.length>1&&i[hG].empty()&&hw.unit=="char"&&!hw.extend){cg(hH,cZ(i.slice(0,hG).concat(i.slice(hG+1)),0),{scroll:false,origin:"*mouse"});ht=hH.sel}else{e(hH,hG,hq,R)}}}var hC=hr;function hB(hT){if(cF(hC,hT)==0){return}hC=hT;if(hw.unit=="rectangle"){var hK=[],hQ=hs.options.tabSize;var hJ=cd(f4(hH,hr.line).text,hr.ch,hQ);var hW=cd(f4(hH,hT.line).text,hT.ch,hQ);var hL=Math.min(hJ,hW),hU=Math.max(hJ,hW);for(var hX=Math.min(hr.line,hT.line),hN=Math.min(hs.lastLine(),Math.max(hr.line,hT.line));hX<=hN;hX++){var hV=f4(hH,hX).text,hM=e5(hV,hL,hQ);if(hL==hU){hK.push(new ex(ac(hX,hM),ac(hX,hM)))}else{if(hV.length>hM){hK.push(new ex(ac(hX,hM),ac(hX,e5(hV,hU,hQ))))}}}if(!hK.length){hK.push(new ex(hr,hr))}cg(hH,cZ(ht.ranges.slice(0,hG).concat(hK),hG),{origin:"*mouse",scroll:false});hs.scrollIntoView(hT)}else{var hR=hq;var hP=es(hs,hT,hw.unit);var hO=hR.anchor,hS;if(cF(hP.anchor,hO)>0){hS=hP.head;hO=aB(hR.from(),hP.anchor)}else{hS=hP.anchor;hO=bR(hR.to(),hP.head)}var hI=ht.ranges.slice(0);hI[hG]=au(hs,new ex(gD(hH,hO),hS));cg(hH,cZ(hI,hG),R)}}var hz=hD.wrapper.getBoundingClientRect();var hu=0;function hF(hK){var hI=++hu;var hM=cQ(hs,hK,true,hw.unit=="rectangle");if(!hM){return}if(cF(hM,hC)!=0){hs.curOp.focus=em();hB(hM);var hL=ct(hD,hH);if(hM.line>=hL.to||hM.line<hL.from){setTimeout(dw(hs,function(){if(hu==hI){hF(hK)}}),150)}}else{var hJ=hK.clientY<hz.top?-20:hK.clientY>hz.bottom?20:0;if(hJ){setTimeout(dw(hs,function(){if(hu!=hI){return}hD.scroller.scrollTop+=hJ;hF(hK)}),50)}}}function hy(hI){hs.state.selectingText=false;hu=Infinity;c9(hI);hD.input.focus();eS(hD.wrapper.ownerDocument,"mousemove",hA);eS(hD.wrapper.ownerDocument,"mouseup",hv);hH.history.lastSelOrigin=null}var hA=dw(hs,function(hI){if(hI.buttons===0||!gJ(hI)){hy(hI)}else{hF(hI)}});var hv=dw(hs,hy);hs.state.selectingText=hv;cj(hD.wrapper.ownerDocument,"mousemove",hA);cj(hD.wrapper.ownerDocument,"mouseup",hv)}function au(hE,hx){var hw=hx.anchor;var hB=hx.head;var hA=f4(hE.doc,hw.line);if(cF(hw,hB)==0&&hw.sticky==hB.sticky){return hx}var ht=a(hA);if(!ht){return hx}var hz=aS(ht,hw.ch,hw.sticky),hr=ht[hz];if(hr.from!=hw.ch&&hr.to!=hw.ch){return hx}var hq=hz+((hr.from==hw.ch)==(hr.level!=1)?0:1);if(hq==0||hq==ht.length){return hx}var hy;if(hB.line!=hw.line){hy=(hB.line-hw.line)*(hE.doc.direction=="ltr"?1:-1)>0}else{var hv=aS(ht,hB.ch,hB.sticky);var hs=hv-hz||(hB.ch-hw.ch)*(hr.level==1?-1:1);if(hv==hq-1||hv==hq){hy=hs<0}else{hy=hs>0}}var hu=ht[hq+(hy?-1:0)];var hD=hy==(hu.level==1);var i=hD?hu.from:hu.to,hC=hD?"after":"before";return hw.ch==i&&hw.sticky==hC?hx:new ex(new ac(hw.line,i,hC),hB)}function ho(hA,hw,hy,hz){var hr,hq;if(hw.touches){hr=hw.touches[0].clientX;hq=hw.touches[0].clientY}else{try{hr=hw.clientX;hq=hw.clientY}catch(hw){return false}}if(hr>=Math.floor(hA.display.gutters.getBoundingClientRect().right)){return false}if(hz){c9(hw)}var hx=hA.display;var hv=hx.lineDiv.getBoundingClientRect();if(hq>hv.bottom||!f9(hA,hy)){return b6(hw)}hq-=hv.top-hx.viewOffset;for(var ht=0;ht<hA.options.gutters.length;++ht){var hu=hx.gutters.childNodes[ht];if(hu&&hu.getBoundingClientRect().right>=hr){var hB=b1(hA.doc,hq);var hs=hA.options.gutters[ht];aO(hA,hy,hA,hB,hs,hw);return b6(hw)}}}function n(i,hq){return ho(i,hq,"gutterClick",true)}function aH(i,hq){if(bo(i.display,hq)||dP(i,hq)){return}if(a4(i,hq,"contextmenu")){return}i.display.input.onContextMenu(hq)}function dP(i,hq){if(!f9(i,"gutterContextMenu")){return false}return ho(i,hq,"gutterContextMenu",false)}function di(i){i.display.wrapper.className=i.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+i.options.theme.replace(/(^|\s)\s*/g," cm-s-");ar(i)}var cA={toString:function(){return"CodeMirror.Init"}};var fR={};var bs={};function fr(i){var hr=i.optionHandlers;function hq(hs,hv,hu,ht){i.defaults[hs]=hv;if(hu){hr[hs]=ht?function(hw,hy,hx){if(hx!=cA){hu(hw,hy,hx)}}:hu}}i.defineOption=hq;i.Init=cA;hq("value","",function(hs,ht){return hs.setValue(ht)},true);hq("mode",null,function(hs,ht){hs.doc.modeOption=ht;bK(hs)},true);hq("indentUnit",2,bK,true);hq("indentWithTabs",false);hq("smartIndent",true);hq("tabSize",4,function(hs){e0(hs);ar(hs);ap(hs)},true);hq("lineSeparator",null,function(hs,hv){hs.doc.lineSep=hv;if(!hv){return}var hu=[],hw=hs.doc.first;hs.doc.iter(function(hx){for(var hz=0;;){var hy=hx.text.indexOf(hv,hz);if(hy==-1){break}hz=hy+hv.length;hu.push(ac(hw,hy))}hw++});for(var ht=hu.length-1;ht>=0;ht--){be(hs.doc,hv,hu[ht],ac(hu[ht].line,hu[ht].ch+hv.length))}});hq("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(hs,hu,ht){hs.state.specialChars=new RegExp(hu.source+(hu.test("\t")?"":"|\t"),"g");if(ht!=cA){hs.refresh()}});hq("specialCharPlaceholder",f3,function(hs){return hs.refresh()},true);hq("electricChars",true);hq("inputStyle",eT?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},true);hq("spellcheck",false,function(hs,ht){return hs.getInputField().spellcheck=ht},true);hq("rtlMoveVisually",!a1);hq("wholeLineUpdateBefore",true);hq("theme","default",function(hs){di(hs);d5(hs)},true);hq("keyMap","default",function(hs,hw,ht){var hu=gW(hw);var hv=ht!=cA&&gW(ht);if(hv&&hv.detach){hv.detach(hs,hu)}if(hu.attach){hu.attach(hs,hv||null)}});hq("extraKeys",null);hq("configureMouse",null);hq("lineWrapping",false,fq,true);hq("gutters",[],function(hs){cD(hs.options);d5(hs)},true);hq("fixedGutter",true,function(hs,ht){hs.display.gutters.style.left=ht?ey(hs.display)+"px":"0";hs.refresh()},true);hq("coverGutterNextToScrollbar",false,function(hs){return fN(hs)},true);hq("scrollbarStyle","native",function(hs){aN(hs);fN(hs);hs.display.scrollbars.setScrollTop(hs.doc.scrollTop);hs.display.scrollbars.setScrollLeft(hs.doc.scrollLeft)},true);hq("lineNumbers",false,function(hs){cD(hs.options);d5(hs)},true);hq("firstLineNumber",1,d5,true);hq("lineNumberFormatter",function(hs){return hs},d5,true);hq("showCursorWhenSelecting",false,bW,true);hq("resetSelectionOnContextMenu",true);hq("lineWiseCopyCut",true);hq("pasteLinesPerSelection",true);hq("readOnly",false,function(hs,ht){if(ht=="nocursor"){a8(hs);hs.display.input.blur()}hs.display.input.readOnlyChanged(ht)});hq("disableInput",false,function(hs,ht){if(!ht){hs.display.input.reset()}},true);hq("dragDrop",true,g2);hq("allowDropFileTypes",null);hq("cursorBlinkRate",530);hq("cursorScrollMargin",0);hq("cursorHeight",1,bW,true);hq("singleCursorHeightPerLine",true,bW,true);hq("workTime",100);hq("workDelay",100);hq("flattenSpans",true,e0,true);hq("addModeClass",false,e0,true);hq("pollInterval",100);hq("undoDepth",200,function(hs,ht){return hs.doc.history.undoDepth=ht});hq("historyEventDelay",1250);hq("viewportMargin",10,function(hs){return hs.refresh()},true);hq("maxHighlightLength",10000,e0,true);hq("moveInputWithCursor",true,function(hs,ht){if(!ht){hs.display.input.resetPosition()}});hq("tabindex",null,function(hs,ht){return hs.display.input.getField().tabIndex=ht||""});hq("autofocus",null);hq("direction","ltr",function(hs,ht){return hs.doc.setDirection(ht)},true)}function d5(i){eP(i);ap(i);fo(i)}function g2(hq,ht,hr){var hu=hr&&hr!=cA;if(!ht!=!hu){var hs=hq.display.dragFunctions;var i=ht?cj:eS;i(hq.display.scroller,"dragstart",hs.start);i(hq.display.scroller,"dragenter",hs.enter);i(hq.display.scroller,"dragover",hs.over);i(hq.display.scroller,"dragleave",hs.leave);i(hq.display.scroller,"drop",hs.drop)}}function fq(i){if(i.options.lineWrapping){gs(i.display.wrapper,"CodeMirror-wrap");i.display.sizer.style.minWidth="";i.display.sizerWidth=null}else{h(i.display.wrapper,"CodeMirror-wrap");f(i)}af(i);ap(i);ar(i);setTimeout(function(){return fN(i)},100)}function K(hq,hs){var hx=this;if(!(this instanceof K)){return new K(hq,hs)}this.options=hs=hs?aZ(hs):{};aZ(fR,hs,false);cD(hs);var hw=hs.value;if(typeof hw=="string"){hw=new aD(hw,hs.mode,null,hs.lineSeparator,hs.direction)}this.doc=hw;var hr=new K.inputStyles[hs.inputStyle](this);var hv=this.display=new ft(hq,hw,hr);hv.wrapper.CodeMirror=this;eP(this);di(this);if(hs.lineWrapping){this.display.wrapper.className+=" CodeMirror-wrap"}aN(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:false,delayingBlurEvent:false,focused:false,suppressEdits:false,pasteIncoming:false,cutIncoming:false,selectingText:false,draggingText:false,highlight:new hp(),keySeq:null,specialChars:null};if(hs.autofocus&&!eT){hv.input.focus()}if(ei&&m<11){setTimeout(function(){return hx.display.input.reset(true)},20)}gM(this);bw();dd(this);this.curOp.forceUpdate=true;eO(this,hw);if((hs.autofocus&&!eT)||this.hasFocus()){setTimeout(cY(c4,this),20)}else{a8(this)}for(var hu in bs){if(bs.hasOwnProperty(hu)){bs[hu](hx,hs[hu],cA)}}eH(this);if(hs.finishInit){hs.finishInit(this)}for(var ht=0;ht<bl.length;++ht){bl[ht](hx)}aw(this);if(dv&&hs.lineWrapping&&getComputedStyle(hv.lineDiv).textRendering=="optimizelegibility"){hv.lineDiv.style.textRendering="auto"}}K.defaults=fR;K.optionHandlers=bs;function gM(hq){var hu=hq.display;cj(hu.scroller,"mousedown",dw(hq,fb));if(ei&&m<11){cj(hu.scroller,"dblclick",dw(hq,function(hy){if(a4(hq,hy)){return}var hz=cQ(hq,hy);if(!hz||n(hq,hy)||bo(hq.display,hy)){return}c9(hy);var hx=hq.findWordAt(hz);gX(hq.doc,hx.anchor,hx.head)}))}else{cj(hu.scroller,"dblclick",function(hx){return a4(hq,hx)||c9(hx)})}if(!hf){cj(hu.scroller,"contextmenu",function(hx){return aH(hq,hx)})}var hw,i={end:0};function hv(){if(hu.activeTouch){hw=setTimeout(function(){return hu.activeTouch=null},1000);i=hu.activeTouch;i.end=+new Date}}function hs(hx){if(hx.touches.length!=1){return false}var hy=hx.touches[0];return hy.radiusX<=1&&hy.radiusY<=1}function hr(hA,hx){if(hx.left==null){return true}var hz=hx.left-hA.left,hy=hx.top-hA.top;return hz*hz+hy*hy>20*20}cj(hu.scroller,"touchstart",function(hy){if(!a4(hq,hy)&&!hs(hy)&&!n(hq,hy)){hu.input.ensurePolled();clearTimeout(hw);var hx=+new Date;hu.activeTouch={start:hx,moved:false,prev:hx-i.end<=300?i:null};if(hy.touches.length==1){hu.activeTouch.left=hy.touches[0].pageX;hu.activeTouch.top=hy.touches[0].pageY}}});cj(hu.scroller,"touchmove",function(){if(hu.activeTouch){hu.activeTouch.moved=true}});cj(hu.scroller,"touchend",function(hy){var hA=hu.activeTouch;if(hA&&!bo(hu,hy)&&hA.left!=null&&!hA.moved&&new Date-hA.start<300){var hz=hq.coordsChar(hu.activeTouch,"page"),hx;if(!hA.prev||hr(hA,hA.prev)){hx=new ex(hz,hz)}else{if(!hA.prev.prev||hr(hA,hA.prev.prev)){hx=hq.findWordAt(hz)}else{hx=new ex(ac(hz.line,0),gD(hq.doc,ac(hz.line+1,0)))}}hq.setSelection(hx.anchor,hx.head);hq.focus();c9(hy)}hv()});cj(hu.scroller,"touchcancel",hv);cj(hu.scroller,"scroll",function(){if(hu.scroller.clientHeight){B(hq,hu.scroller.scrollTop);bY(hq,hu.scroller.scrollLeft,true);aO(hq,"scroll",hq)}});cj(hu.scroller,"mousewheel",function(hx){return c(hq,hx)});cj(hu.scroller,"DOMMouseScroll",function(hx){return c(hq,hx)});cj(hu.wrapper,"scroll",function(){return hu.wrapper.scrollTop=hu.wrapper.scrollLeft=0});hu.dragFunctions={enter:function(hx){if(!a4(hq,hx)){e6(hx)}},over:function(hx){if(!a4(hq,hx)){hn(hq,hx);e6(hx)}},start:function(hx){return U(hq,hx)},drop:dw(hq,bx),leave:function(hx){if(!a4(hq,hx)){dJ(hq)}}};var ht=hu.input.getField();cj(ht,"keyup",function(hx){return bu.call(hq,hx)});cj(ht,"keydown",dw(hq,r));cj(ht,"keypress",dw(hq,c0));cj(ht,"focus",function(hx){return c4(hq,hx)});cj(ht,"blur",function(hx){return a8(hq,hx)})}var bl=[];K.defineInitHook=function(i){return bl.push(i)};function ak(hF,hu,hE,hs){var hD=hF.doc,hr;if(hE==null){hE="add"}if(hE=="smart"){if(!hD.mode.indent){hE="prev"}else{hr=fL(hF,hu).state}}var hy=hF.options.tabSize;var hG=f4(hD,hu),hx=cd(hG.text,null,hy);if(hG.stateAfter){hG.stateAfter=null}var hq=hG.text.match(/^\s*/)[0],hB;if(!hs&&!/\S/.test(hG.text)){hB=0;hE="not"}else{if(hE=="smart"){hB=hD.mode.indent(hr,hG.text.slice(hq.length),hG.text);if(hB==cz||hB>150){if(!hs){return}hE="prev"}}}if(hE=="prev"){if(hu>hD.first){hB=cd(f4(hD,hu-1).text,null,hy)}else{hB=0}}else{if(hE=="add"){hB=hx+hF.options.indentUnit}else{if(hE=="subtract"){hB=hx-hF.options.indentUnit}else{if(typeof hE=="number"){hB=hx+hE}}}}hB=Math.max(0,hB);var hC="",hA=0;if(hF.options.indentWithTabs){for(var hv=Math.floor(hB/hy);hv;--hv){hA+=hy;hC+="\t"}}if(hA<hB){hC+=cS(hB-hA)}if(hC!=hq){be(hD,hC,ac(hu,0),ac(hu,hq.length),"+input");hG.stateAfter=null;return true}else{for(var ht=0;ht<hD.sel.ranges.length;ht++){var hw=hD.sel.ranges[ht];if(hw.head.line==hu&&hw.head.ch<hq.length){var hz=ac(hu,hq.length);e(hD,ht,new ex(hz,hz));break}}}}var bz=null;function dC(i){bz=i}function gY(hF,hv,ht,hs,hE){var hD=hF.doc;hF.display.shift=false;if(!hs){hs=hD.sel}var hu=hF.state.pasteIncoming||hE=="paste";var hy=gO(hv),hq=null;if(hu&&hs.ranges.length>1){if(bz&&bz.text.join("\n")==hv){if(hs.ranges.length%bz.text.length==0){hq=[];for(var hw=0;hw<bz.text.length;hw++){hq.push(hD.splitLines(bz.text[hw]))}}}else{if(hy.length==hs.ranges.length&&hF.options.pasteLinesPerSelection){hq=cf(hy,function(i){return[i]})}}}var hz;for(var hr=hs.ranges.length-1;hr>=0;hr--){var hx=hs.ranges[hr];var hC=hx.from(),hB=hx.to();if(hx.empty()){if(ht&&ht>0){hC=ac(hC.line,hC.ch-ht)}else{if(hF.state.overwrite&&!hu){hB=ac(hB.line,Math.min(f4(hD,hB.line).text.length,hB.ch+gy(hy).length))}else{if(bz&&bz.lineWise&&bz.text.join("\n")==hv){hC=hB=ac(hC.line,0)}}}}hz=hF.curOp.updateInput;var hA={from:hC,to:hB,text:hq?hq[hr%hq.length]:hy,origin:hE||(hu?"paste":hF.state.cutIncoming?"cut":"+input")};bt(hF.doc,hA);am(hF,"inputRead",hF,hA)}if(hv&&!hu){gU(hF,hv)}gx(hF);hF.curOp.updateInput=hz;hF.curOp.typing=true;hF.state.pasteIncoming=hF.state.cutIncoming=false}function bn(hr,i){var hq=hr.clipboardData&&hr.clipboardData.getData("Text");if(hq){hr.preventDefault();if(!i.isReadOnly()&&!i.options.disableInput){dh(i,function(){return gY(i,hq,0,null,"paste")})}return true}}function gU(hq,hu){if(!hq.options.electricChars||!hq.options.smartIndent){return}var hv=hq.doc.sel;for(var ht=hv.ranges.length-1;ht>=0;ht--){var hr=hv.ranges[ht];if(hr.head.ch>100||(ht&&hv.ranges[ht-1].head.line==hr.head.line)){continue}var hw=hq.getModeAt(hr.head);var hx=false;if(hw.electricChars){for(var hs=0;hs<hw.electricChars.length;hs++){if(hu.indexOf(hw.electricChars.charAt(hs))>-1){hx=ak(hq,hr.head.line,"smart");break}}}else{if(hw.electricInput){if(hw.electricInput.test(f4(hq.doc,hr.head.line).text.slice(0,hr.head.ch))){hx=ak(hq,hr.head.line,"smart")}}}if(hx){am(hq,"electricInput",hq,hr.head.line)}}}function dQ(hq){var hv=[],hs=[];for(var ht=0;ht<hq.doc.sel.ranges.length;ht++){var hr=hq.doc.sel.ranges[ht].head.line;var hu={anchor:ac(hr,0),head:ac(hr+1,0)};hs.push(hu);hv.push(hq.getRange(hu.anchor,hu.head))}return{text:hv,ranges:hs}}function gK(hq,i){hq.setAttribute("autocorrect","off");hq.setAttribute("autocapitalize","off");hq.setAttribute("spellcheck",!!i)}function ba(){var i=g5("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none");var hq=g5("div",[i],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");if(dv){i.style.width="1000px"}else{i.setAttribute("wrap","off")}if(fQ){i.style.border="1px solid black"}gK(i);return hq}function en(i){var hq=i.optionHandlers;var hr=i.helpers={};i.prototype={constructor:i,focus:function(){window.focus();this.display.input.focus()},setOption:function(hu,hv){var ht=this.options,hs=ht[hu];if(ht[hu]==hv&&hu!="mode"){return}ht[hu]=hv;if(hq.hasOwnProperty(hu)){dw(this,hq[hu])(this,hv,hs)}aO(this,"optionChange",this,hu)},getOption:function(hs){return this.options[hs]},getDoc:function(){return this.doc},addKeyMap:function(ht,hs){this.state.keyMaps[hs?"push":"unshift"](gW(ht))},removeKeyMap:function(ht){var hu=this.state.keyMaps;for(var hs=0;hs<hu.length;++hs){if(hu[hs]==ht||hu[hs].name==ht){hu.splice(hs,1);return true}}},addOverlay:dG(function(hs,ht){var hu=hs.token?hs:i.getMode(this.options,hs);if(hu.startState){throw new Error("Overlays may not be stateful.")}cx(this.state.overlays,{mode:hu,modeSpec:hs,opaque:ht&&ht.opaque,priority:(ht&&ht.priority)||0},function(hv){return hv.priority});this.state.modeGen++;ap(this)}),removeOverlay:dG(function(hs){var hw=this;var hu=this.state.overlays;for(var ht=0;ht<hu.length;++ht){var hv=hu[ht].modeSpec;if(hv==hs||typeof hs=="string"&&hv.name==hs){hu.splice(ht,1);hw.state.modeGen++;ap(hw);return}}}),indentLine:dG(function(hu,hs,ht){if(typeof hs!="string"&&typeof hs!="number"){if(hs==null){hs=this.options.smartIndent?"smart":"prev"}else{hs=hs?"add":"subtract"}}if(cw(this.doc,hu)){ak(this,hu,hs,ht)}}),indentSelection:dG(function(hC){var hy=this;var hs=this.doc.sel.ranges,hv=-1;for(var hx=0;hx<hs.length;hx++){var hz=hs[hx];if(!hz.empty()){var hA=hz.from(),hB=hz.to();var ht=Math.max(hv,hA.line);hv=Math.min(hy.lastLine(),hB.line-(hB.ch?0:1))+1;for(var hw=ht;hw<hv;++hw){ak(hy,hw,hC)}var hu=hy.doc.sel.ranges;if(hA.ch==0&&hs.length==hu.length&&hu[hx].from().ch>0){e(hy.doc,hx,new ex(hA,hu[hx].to()),ah)}}else{if(hz.head.line>hv){ak(hy,hz.head.line,hC,true);hv=hz.head.line;if(hx==hy.doc.sel.primIndex){gx(hy)}}}}}),getTokenAt:function(ht,hs){return cT(this,ht,hs)},getLineTokens:function(ht,hs){return cT(this,ac(ht),hs,true)},getTokenTypeAt:function(hz){hz=gD(this.doc,hz);var hv=dE(this,f4(this.doc,hz.line));var hx=0,hy=(hv.length-1)/2,hu=hz.ch;var ht;if(hu==0){ht=hv[2]}else{for(;;){var hs=(hx+hy)>>1;if((hs?hv[hs*2-1]:0)>=hu){hy=hs}else{if(hv[hs*2+1]<hu){hx=hs+1}else{ht=hv[hs*2+2];break}}}}var hw=ht?ht.indexOf("overlay "):-1;return hw<0?ht:hw==0?null:ht.slice(0,hw-1)},getModeAt:function(ht){var hs=this.doc.mode;if(!hs.innerMode){return hs}return i.innerMode(hs,this.getTokenAt(ht).state).mode},getHelper:function(ht,hs){return this.getHelpers(ht,hs)[0]},getHelpers:function(hz,hy){var hw=this;var hB=[];if(!hr.hasOwnProperty(hy)){return hB}var hu=hr[hy],hx=this.getModeAt(hz);if(typeof hx[hy]=="string"){if(hu[hx[hy]]){hB.push(hu[hx[hy]])}}else{if(hx[hy]){for(var hv=0;hv<hx[hy].length;hv++){var ht=hu[hx[hy][hv]];if(ht){hB.push(ht)}}}else{if(hx.helperType&&hu[hx.helperType]){hB.push(hu[hx.helperType])}else{if(hu[hx.name]){hB.push(hu[hx.name])}}}}for(var hs=0;hs<hu._global.length;hs++){var hA=hu._global[hs];if(hA.pred(hx,hw)&&dR(hB,hA.val)==-1){hB.push(hA.val)}}return hB},getStateAfter:function(ht,hs){var hu=this.doc;ht=dA(hu,ht==null?hu.first+hu.size-1:ht);return fL(this,ht+1,hs).state},cursorCoords:function(hv,ht){var hu,hs=this.doc.sel.primary();if(hv==null){hu=hs.head}else{if(typeof hv=="object"){hu=gD(this.doc,hv)}else{hu=hv?hs.from():hs.to()}}return eu(this,hu,ht||"page")},charCoords:function(ht,hs){return de(this,gD(this.doc,ht),hs||"page")},coordsChar:function(hs,ht){hs=hl(this,hs,ht||"page");return gL(this,hs.left,hs.top)},lineAtHeight:function(hs,ht){hs=hl(this,{top:hs,left:0},ht||"page").top;return b1(this.doc,hs+this.display.viewOffset)},heightAtLine:function(ht,hx,hw){var hs=false,hu;if(typeof ht=="number"){var hv=this.doc.first+this.doc.size-1;if(ht<this.doc.first){ht=this.doc.first}else{if(ht>hv){ht=hv;hs=true}}hu=f4(this.doc,ht)}else{hu=ht}return fD(this,hu,{top:0,left:0},hx||"page",hw||hs).top+(hs?this.doc.height-b7(hu):0)},defaultTextHeight:function(){return bb(this.display)},defaultCharWidth:function(){return ea(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(hx,hu,hz,hv,hB){var hw=this.display;hx=eu(this,gD(this.doc,hx));var hy=hx.bottom,ht=hx.left;hu.style.position="absolute";hu.setAttribute("cm-ignore-events","true");this.display.input.setUneditable(hu);hw.sizer.appendChild(hu);if(hv=="over"){hy=hx.top}else{if(hv=="above"||hv=="near"){var hs=Math.max(hw.wrapper.clientHeight,this.doc.height),hA=Math.max(hw.sizer.clientWidth,hw.lineSpace.clientWidth);if((hv=="above"||hx.bottom+hu.offsetHeight>hs)&&hx.top>hu.offsetHeight){hy=hx.top-hu.offsetHeight}else{if(hx.bottom+hu.offsetHeight<=hs){hy=hx.bottom}}if(ht+hu.offsetWidth>hA){ht=hA-hu.offsetWidth}}}hu.style.top=hy+"px";hu.style.left=hu.style.right="";if(hB=="right"){ht=hw.sizer.clientWidth-hu.offsetWidth;hu.style.right="0px"}else{if(hB=="left"){ht=0}else{if(hB=="middle"){ht=(hw.sizer.clientWidth-hu.offsetWidth)/2}}hu.style.left=ht+"px"}if(hz){H(this,{left:ht,top:hy,right:ht+hu.offsetWidth,bottom:hy+hu.offsetHeight})}},triggerOnKeyDown:dG(r),triggerOnKeyPress:dG(c0),triggerOnKeyUp:bu,triggerOnMouseDown:dG(fb),execCommand:function(hs){if(fm.hasOwnProperty(hs)){return fm[hs].call(null,this)}},triggerElectric:dG(function(hs){gU(this,hs)}),findPosH:function(hz,hv,hw,ht){var hy=this;var hs=1;if(hv<0){hs=-1;hv=-hv}var hx=gD(this.doc,hz);for(var hu=0;hu<hv;++hu){hx=bP(hy.doc,hx,hs,hw,ht);if(hx.hitSide){break}}return hx},moveH:dG(function(hs,ht){var hu=this;this.extendSelectionsBy(function(hv){if(hu.display.shift||hu.doc.extend||hv.empty()){return bP(hu.doc,hv.head,hs,ht,hu.options.rtlMoveVisually)}else{return hs<0?hv.from():hv.to()}},dr)}),deleteH:dG(function(hs,ht){var hu=this.doc.sel,hv=this.doc;if(hu.somethingSelected()){hv.replaceSelection("",null,"+delete")}else{fM(this,function(hx){var hw=bP(hv,hx.head,hs,ht,false);return hs<0?{from:hw,to:hx.head}:{from:hx.head,to:hw}})}}),findPosV:function(hy,hv,hz,hB){var hu=this;var hs=1,hx=hB;if(hv<0){hs=-1;hv=-hv}var hA=gD(this.doc,hy);for(var ht=0;ht<hv;++ht){var hw=eu(hu,hA,"div");if(hx==null){hx=hw.left}else{hw.left=hx}hA=bJ(hu,hw,hs,hz);if(hA.hitSide){break}}return hA},moveV:dG(function(hs,hu){var hy=this;var hw=this.doc,hv=[];var hx=!this.display.shift&&!hw.extend&&hw.sel.somethingSelected();hw.extendSelectionsBy(function(hz){if(hx){return hs<0?hz.from():hz.to()}var hB=eu(hy,hz.head,"div");if(hz.goalColumn!=null){hB.left=hz.goalColumn}hv.push(hB.left);var hA=bJ(hy,hB,hs,hu);if(hu=="page"&&hz==hw.sel.primary()){db(hy,de(hy,hA,"div").top-hB.top)}return hA},dr);if(hv.length){for(var ht=0;ht<hw.sel.ranges.length;ht++){hw.sel.ranges[ht].goalColumn=hv[ht]}}}),findWordAt:function(hz){var hx=this.doc,hv=f4(hx,hz.line).text;var hy=hz.ch,hu=hz.ch;if(hv){var hw=this.getHelper(hz,"wordChars");if((hz.sticky=="before"||hu==hv.length)&&hy){--hy}else{++hu}var ht=hv.charAt(hy);var hs=c3(ht,hw)?function(hA){return c3(hA,hw)}:/\s/.test(ht)?function(hA){return/\s/.test(hA)}:function(hA){return(!/\s/.test(hA)&&!c3(hA))};while(hy>0&&hs(hv.charAt(hy-1))){--hy}while(hu<hv.length&&hs(hv.charAt(hu))){++hu}}return new ex(ac(hz.line,hy),ac(hz.line,hu))},toggleOverwrite:function(hs){if(hs!=null&&hs==this.state.overwrite){return}if(this.state.overwrite=!this.state.overwrite){gs(this.display.cursorDiv,"CodeMirror-overwrite")}else{h(this.display.cursorDiv,"CodeMirror-overwrite")}aO(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==em()},isReadOnly:function(){return !!(this.options.readOnly||this.doc.cantEdit)},scrollTo:dG(function(hs,ht){fy(this,hs,ht)}),getScrollInfo:function(){var hs=this.display.scroller;return{left:hs.scrollLeft,top:hs.scrollTop,height:hs.scrollHeight-dn(this)-this.display.barHeight,width:hs.scrollWidth-dn(this)-this.display.barWidth,clientHeight:dq(this),clientWidth:dU(this)}},scrollIntoView:dG(function(hs,ht){if(hs==null){hs={from:this.doc.sel.primary().head,to:null};if(ht==null){ht=this.options.cursorScrollMargin}}else{if(typeof hs=="number"){hs={from:ac(hs,0),to:null}}else{if(hs.from==null){hs={from:hs,to:null}}}}if(!hs.to){hs.to=hs.from}hs.margin=ht||0;if(hs.from.line!=null){cB(this,hs)}else{cb(this,hs.from,hs.to,hs.margin)}}),setSize:dG(function(hu,hs){var hw=this;var ht=function(hx){return typeof hx=="number"||/^\d+$/.test(String(hx))?hx+"px":hx};if(hu!=null){this.display.wrapper.style.width=ht(hu)}if(hs!=null){this.display.wrapper.style.height=ht(hs)}if(this.options.lineWrapping){a0(this)}var hv=this.display.viewFrom;this.doc.iter(hv,this.display.viewTo,function(hx){if(hx.widgets){for(var hy=0;hy<hx.widgets.length;hy++){if(hx.widgets[hy].noHScroll){W(hw,hv,"widget");break}}}++hv});this.curOp.forceUpdate=true;aO(this,"refresh",this)}),operation:function(hs){return dh(this,hs)},startOperation:function(){return dd(this)},endOperation:function(){return aw(this)},refresh:dG(function(){var hs=this.display.cachedTextHeight;ap(this);this.curOp.forceUpdate=true;ar(this);fy(this,this.doc.scrollLeft,this.doc.scrollTop);dz(this);if(hs==null||Math.abs(hs-bb(this.display))>0.5){af(this)}aO(this,"refresh",this)}),swapDoc:dG(function(ht){var hs=this.doc;hs.cm=null;eO(this,ht);ar(this);this.display.input.reset();fy(this,ht.scrollLeft,ht.scrollTop);this.curOp.forceScroll=true;am(this,"swapDoc",this,hs);return hs}),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}};bT(i);i.registerHelper=function(ht,hs,hu){if(!hr.hasOwnProperty(ht)){hr[ht]=i[ht]={_global:[]}}hr[ht][hs]=hu};i.registerGlobalHelper=function(hu,ht,hs,hv){i.registerHelper(hu,ht,hv);hr[hu]._global.push({pred:hs,val:hv})}}function bP(hB,hA,hs,hC,hq){var ht=hA;var hx=hs;var hw=f4(hB,hA.line);function i(){var hG=hA.line+hs;if(hG<hB.first||hG>=hB.first+hB.size){return false}hA=new ac(hG,hA.ch,hA.sticky);return hw=f4(hB,hG)}function hu(hH){var hG;if(hq){hG=v(hB.cm,hw,hA,hs)}else{hG=aq(hw,hA,hs)}if(hG==null){if(!hH&&i()){hA=fh(hq,hB.cm,hw,hA.line,hs)}else{return false}}else{hA=hG}return true}if(hC=="char"){hu()}else{if(hC=="column"){hu(true)}else{if(hC=="word"||hC=="group"){var hz=null,hE=hC=="group";var hr=hB.cm&&hB.cm.getHelper(hA,"wordChars");for(var hv=true;;hv=false){if(hs<0&&!hu(!hv)){break}var hD=hw.text.charAt(hA.ch)||"\n";var hy=c3(hD,hr)?"w":hE&&hD=="\n"?"n":!hE||/\s/.test(hD)?null:"p";if(hE&&!hv&&!hy){hy="s"}if(hz&&hz!=hy){if(hs<0){hs=1;hu();hA.sticky="after"}break}if(hy){hz=hy}if(hs>0&&!hu(!hv)){break}}}}}var hF=ch(hB,hA,ht,hx,true);if(ad(ht,hF)){hF.hitSide=true}return hF}function bJ(hy,ht,hq,hx){var hw=hy.doc,hv=ht.left,hu;if(hx=="page"){var hs=Math.min(hy.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);var i=Math.max(hs-0.5*bb(hy.display),3);hu=(hq>0?ht.bottom:ht.top)+hq*i}else{if(hx=="line"){hu=hq>0?ht.bottom+3:ht.top-3}}var hr;for(;;){hr=gL(hy,hv,hu);if(!hr.outside){break}if(hq<0?hu<=0:hu>=hw.height){hr.hitSide=true;break}hu+=hq*5}return hr}var d3=function(i){this.cm=i;this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null;this.polling=new hp();this.composing=null;this.gracePeriod=false;this.readDOMTimeout=null};d3.prototype.init=function(hs){var hu=this;var hr=this,i=hr.cm;var ht=hr.div=hs.lineDiv;gK(ht,i.options.spellcheck);cj(ht,"paste",function(hv){if(a4(i,hv)||bn(hv,i)){return}if(m<=11){setTimeout(dw(i,function(){return hu.updateFromDOM()}),20)}});cj(ht,"compositionstart",function(hv){hu.composing={data:hv.data,done:false}});cj(ht,"compositionupdate",function(hv){if(!hu.composing){hu.composing={data:hv.data,done:false}}});cj(ht,"compositionend",function(hv){if(hu.composing){if(hv.data!=hu.composing.data){hu.readFromDOMSoon()}hu.composing.done=true}});cj(ht,"touchstart",function(){return hr.forceCompositionEnd()});cj(ht,"input",function(){if(!hu.composing){hu.readFromDOMSoon()}});function hq(hz){if(a4(i,hz)){return}if(i.somethingSelected()){dC({lineWise:false,text:i.getSelections()});if(hz.type=="cut"){i.replaceSelection("",null,"cut")}}else{if(!i.options.lineWiseCopyCut){return}else{var hw=dQ(i);dC({lineWise:true,text:hw.text});if(hz.type=="cut"){i.operation(function(){i.setSelections(hw.ranges,0,ah);i.replaceSelection("",null,"cut")})}}}if(hz.clipboardData){hz.clipboardData.clearData();var hy=bz.text.join("\n");hz.clipboardData.setData("Text",hy);if(hz.clipboardData.getData("Text")==hy){hz.preventDefault();return}}var hx=ba(),hA=hx.firstChild;i.display.lineSpace.insertBefore(hx,i.display.lineSpace.firstChild);hA.value=bz.text.join("\n");var hv=document.activeElement;ej(hA);setTimeout(function(){i.display.lineSpace.removeChild(hx);hv.focus();if(hv==ht){hr.showPrimarySelection()}},50)}cj(ht,"copy",hq);cj(ht,"cut",hq)};d3.prototype.prepareSelection=function(){var i=gB(this.cm,false);i.focus=this.cm.state.focused;return i};d3.prototype.showSelection=function(hq,i){if(!hq||!this.cm.display.view.length){return}if(hq.focus||i){this.showPrimarySelection()}this.showMultipleSelections(hq)};d3.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()};d3.prototype.showPrimarySelection=function(){var ht=this.getSelection(),hD=this.cm,hw=hD.doc.sel.primary();var hB=hw.from(),hC=hw.to();if(hD.display.viewTo==hD.display.viewFrom||hB.line>=hD.display.viewTo||hC.line<hD.display.viewFrom){ht.removeAllRanges();return}var hu=aI(hD,ht.anchorNode,ht.anchorOffset);var hy=aI(hD,ht.focusNode,ht.focusOffset);if(hu&&!hu.bad&&hy&&!hy.bad&&cF(aB(hu,hy),hB)==0&&cF(bR(hu,hy),hC)==0){return}var hA=hD.display.view;var hs=(hB.line>=hD.display.viewFrom&&c2(hD,hB))||{node:hA[0].measure.map[2],offset:0};var hx=hC.line<hD.display.viewTo&&c2(hD,hC);if(!hx){var hr=hA[hA.length-1].measure;var hq=hr.maps?hr.maps[hr.maps.length-1]:hr.map;hx={node:hq[hq.length-1],offset:hq[hq.length-2]-hq[hq.length-3]}}if(!hs||!hx){ht.removeAllRanges();return}var hv=ht.rangeCount&&ht.getRangeAt(0),i;try{i=cO(hs.node,hs.offset,hx.offset,hx.node)}catch(hz){}if(i){if(!cR&&hD.state.focused){ht.collapse(hs.node,hs.offset);if(!i.collapsed){ht.removeAllRanges();ht.addRange(i)}}else{ht.removeAllRanges();ht.addRange(i)}if(hv&&ht.anchorNode==null){ht.addRange(hv)}else{if(cR){this.startGracePeriod()}}}this.rememberSelection()};d3.prototype.startGracePeriod=function(){var i=this;clearTimeout(this.gracePeriod);this.gracePeriod=setTimeout(function(){i.gracePeriod=false;if(i.selectionChanged()){i.cm.operation(function(){return i.cm.curOp.selectionChanged=true})}},20)};d3.prototype.showMultipleSelections=function(i){ce(this.cm.display.cursorDiv,i.cursors);ce(this.cm.display.selectionDiv,i.selection)};d3.prototype.rememberSelection=function(){var i=this.getSelection();this.lastAnchorNode=i.anchorNode;this.lastAnchorOffset=i.anchorOffset;this.lastFocusNode=i.focusNode;this.lastFocusOffset=i.focusOffset};d3.prototype.selectionInEditor=function(){var hq=this.getSelection();if(!hq.rangeCount){return false}var i=hq.getRangeAt(0).commonAncestorContainer;return hg(this.div,i)};d3.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"){if(!this.selectionInEditor()){this.showSelection(this.prepareSelection(),true)}this.div.focus()}};d3.prototype.blur=function(){this.div.blur()};d3.prototype.getField=function(){return this.div};d3.prototype.supportsTouch=function(){return true};d3.prototype.receivedFocus=function(){var i=this;if(this.selectionInEditor()){this.pollSelection()}else{dh(this.cm,function(){return i.cm.curOp.selectionChanged=true})}function hq(){if(i.cm.state.focused){i.pollSelection();i.polling.set(i.cm.options.pollInterval,hq)}}this.polling.set(this.cm.options.pollInterval,hq)};d3.prototype.selectionChanged=function(){var i=this.getSelection();return i.anchorNode!=this.lastAnchorNode||i.anchorOffset!=this.lastAnchorOffset||i.focusNode!=this.lastFocusNode||i.focusOffset!=this.lastFocusOffset};d3.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged()){return}var hs=this.getSelection(),i=this.cm;if(aY&&dL&&this.cm.options.gutters.length&&g7(hs.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs});this.blur();this.focus();return}if(this.composing){return}this.rememberSelection();var hq=aI(i,hs.anchorNode,hs.anchorOffset);var hr=aI(i,hs.focusNode,hs.focusOffset);if(hq&&hr){dh(i,function(){cg(i.doc,fE(hq,hr),ah);if(hq.bad||hr.bad){i.curOp.selectionChanged=true}})}};d3.prototype.pollContent=function(){if(this.readDOMTimeout!=null){clearTimeout(this.readDOMTimeout);this.readDOMTimeout=null}var hz=this.cm,hJ=hz.display,hH=hz.doc.sel.primary();var hI=hH.from(),ht=hH.to();if(hI.ch==0&&hI.line>hz.firstLine()){hI=ac(hI.line-1,f4(hz.doc,hI.line-1).length)}if(ht.ch==f4(hz.doc,ht.line).text.length&&ht.line<hz.lastLine()){ht=ac(ht.line+1,0)}if(hI.line<hJ.viewFrom||ht.line>hJ.viewTo-1){return false}var hw,hu,hy;if(hI.line==hJ.viewFrom||(hw=d0(hz,hI.line))==0){hu=b8(hJ.view[0].line);hy=hJ.view[0].node}else{hu=b8(hJ.view[hw].line);hy=hJ.view[hw-1].node.nextSibling}var hG=d0(hz,ht.line);var hB,hE;if(hG==hJ.view.length-1){hB=hJ.viewTo-1;hE=hJ.lineDiv.lastChild}else{hB=b8(hJ.view[hG+1].line)-1;hE=hJ.view[hG+1].node.previousSibling}if(!hy){return false}var hK=hz.doc.splitLines(g1(hz,hy,hE,hu,hB));var hD=g8(hz.doc,ac(hu,0),ac(hB,f4(hz.doc,hB).text.length));while(hK.length>1&&hD.length>1){if(gy(hK)==gy(hD)){hK.pop();hD.pop();hB--}else{if(hK[0]==hD[0]){hK.shift();hD.shift();hu++}else{break}}}var hF=0,hr=0;var hA=hK[0],hq=hD[0],i=Math.min(hA.length,hq.length);while(hF<i&&hA.charCodeAt(hF)==hq.charCodeAt(hF)){++hF}var hx=gy(hK),hL=gy(hD);var hs=Math.min(hx.length-(hK.length==1?hF:0),hL.length-(hD.length==1?hF:0));while(hr<hs&&hx.charCodeAt(hx.length-hr-1)==hL.charCodeAt(hL.length-hr-1)){++hr}if(hK.length==1&&hD.length==1&&hu==hI.line){while(hF&&hF>hI.ch&&hx.charCodeAt(hx.length-hr-1)==hL.charCodeAt(hL.length-hr-1)){hF--;hr++}}hK[hK.length-1]=hx.slice(0,hx.length-hr).replace(/^\u200b+/,"");hK[0]=hK[0].slice(hF).replace(/\u200b+$/,"");var hv=ac(hu,hF);var hC=ac(hB,hD.length?gy(hD).length-hr:0);if(hK.length>1||hK[0]||cF(hv,hC)){be(hz.doc,hK,hv,hC,"+input");return true}};d3.prototype.ensurePolled=function(){this.forceCompositionEnd()};d3.prototype.reset=function(){this.forceCompositionEnd()};d3.prototype.forceCompositionEnd=function(){if(!this.composing){return}clearTimeout(this.readDOMTimeout);this.composing=null;this.updateFromDOM();this.div.blur();this.div.focus()};d3.prototype.readFromDOMSoon=function(){var i=this;if(this.readDOMTimeout!=null){return}this.readDOMTimeout=setTimeout(function(){i.readDOMTimeout=null;if(i.composing){if(i.composing.done){i.composing=null}else{return}}i.updateFromDOM()},80)};d3.prototype.updateFromDOM=function(){var i=this;if(this.cm.isReadOnly()||!this.pollContent()){dh(this.cm,function(){return ap(i.cm)})}};d3.prototype.setUneditable=function(i){i.contentEditable="false"};d3.prototype.onKeyPress=function(i){if(i.charCode==0||this.composing){return}i.preventDefault();if(!this.cm.isReadOnly()){dw(this.cm,gY)(this.cm,String.fromCharCode(i.charCode==null?i.keyCode:i.charCode),0)}};d3.prototype.readOnlyChanged=function(i){this.div.contentEditable=String(i!="nocursor")};d3.prototype.onContextMenu=function(){};d3.prototype.resetPosition=function(){};d3.prototype.needsContentAttribute=true;function c2(hv,ht){var hu=f1(hv,ht.line);if(!hu||hu.hidden){return null}var hx=f4(hv.doc,ht.line);var hq=cW(hu,hx,ht.line);var hr=a(hx,hv.doc.direction),hs="left";if(hr){var i=aS(hr,ht.ch);hs=i%2?"right":"left"}var hw=aV(hq.map,ht.ch,hs);hw.offset=hw.collapse=="right"?hw.end:hw.start;return hw}function g7(hq){for(var i=hq;i;i=i.parentNode){if(/CodeMirror-gutter-wrapper/.test(i.className)){return true}}return false}function e7(hq,i){if(i){hq.bad=true}return hq}function g1(hy,hw,hx,hs,hq){var hA="",hr=false,i=hy.doc.lineSeparator(),ht=false;function hu(hC){return function(hD){return hD.id==hC}}function hB(){if(hr){hA+=i;if(ht){hA+=i}hr=ht=false}}function hz(hC){if(hC){hB();hA+=hC}}function hv(hH){if(hH.nodeType==1){var hE=hH.getAttribute("cm-text");if(hE){hz(hE);return}var hG=hH.getAttribute("cm-marker"),hD;if(hG){var hI=hy.findMarks(ac(hs,0),ac(hq+1,0),hu(+hG));if(hI.length&&(hD=hI[0].find(0))){hz(g8(hy.doc,hD.from,hD.to).join(i))}return}if(hH.getAttribute("contenteditable")=="false"){return}var hC=/^(pre|div|p|li|table|br)$/i.test(hH.nodeName);if(!/^br$/i.test(hH.nodeName)&&hH.textContent.length==0){return}if(hC){hB()}for(var hF=0;hF<hH.childNodes.length;hF++){hv(hH.childNodes[hF])}if(/^(pre|p)$/i.test(hH.nodeName)){ht=true}if(hC){hr=true}}else{if(hH.nodeType==3){hz(hH.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}}}for(;;){hv(hw);if(hw==hx){break}hw=hw.nextSibling;ht=false}return hA}function aI(hq,ht,hv){var hu;if(ht==hq.display.lineDiv){hu=hq.display.lineDiv.childNodes[hv];if(!hu){return e7(hq.clipPos(ac(hq.display.viewTo-1)),true)}ht=null;hv=0}else{for(hu=ht;;hu=hu.parentNode){if(!hu||hu==hq.display.lineDiv){return null}if(hu.parentNode&&hu.parentNode==hq.display.lineDiv){break}}}for(var hs=0;hs<hq.display.view.length;hs++){var hr=hq.display.view[hs];if(hr.node==hu){return ai(hr,ht,hv)}}}function ai(hy,hu,hw){var hr=hy.text.firstChild,ht=false;if(!hu||!hg(hr,hu)){return e7(ac(b8(hy.line),0),true)}if(hu==hr){ht=true;hu=hr.childNodes[hw];hw=0;if(!hu){var hE=hy.rest?gy(hy.rest):hy.line;return e7(ac(b8(hE),hE.text.length),ht)}}var hv=hu.nodeType==3?hu:null,hC=hu;if(!hv&&hu.childNodes.length==1&&hu.firstChild.nodeType==3){hv=hu.firstChild;if(hw){hw=hv.nodeValue.length}}while(hC.parentNode!=hr){hC=hC.parentNode}var hq=hy.measure,hA=hq.maps;function hx(hH,hM,hJ){for(var hL=-1;hL<(hA?hA.length:0);hL++){var hG=hL<0?hq.map:hA[hL];for(var hK=0;hK<hG.length;hK+=3){var hI=hG[hK+2];if(hI==hH||hI==hM){var hN=b8(hL<0?hy.line:hy.rest[hL]);var hF=hG[hK]+hJ;if(hJ<0||hI!=hH){hF=hG[hK+(hJ?1:0)]}return ac(hN,hF)}}}}var hD=hx(hv,hC,hw);if(hD){return e7(hD,ht)}for(var i=hC.nextSibling,hz=hv?hv.nodeValue.length-hw:0;i;i=i.nextSibling){hD=hx(i,i.firstChild,0);if(hD){return e7(ac(hD.line,hD.ch-hz),ht)}else{hz+=i.textContent.length}}for(var hB=hC.previousSibling,hs=hw;hB;hB=hB.previousSibling){hD=hx(hB,hB.firstChild,-1);if(hD){return e7(ac(hD.line,hD.ch+hs),ht)}else{hs+=hB.textContent.length}}}var ae=function(i){this.cm=i;this.prevInput="";this.pollingFast=false;this.polling=new hp();this.hasSelection=false;this.composing=null};ae.prototype.init=function(hr){var hu=this;var hq=this,i=this.cm;this.createField(hr);var hs=this.textarea;hr.wrapper.insertBefore(this.wrapper,hr.wrapper.firstChild);if(fQ){hs.style.width="0px"}cj(hs,"input",function(){if(ei&&m>=9&&hu.hasSelection){hu.hasSelection=null}hq.poll()});cj(hs,"paste",function(hv){if(a4(i,hv)||bn(hv,i)){return}i.state.pasteIncoming=true;hq.fastPoll()});function ht(hw){if(a4(i,hw)){return}if(i.somethingSelected()){dC({lineWise:false,text:i.getSelections()})}else{if(!i.options.lineWiseCopyCut){return}else{var hv=dQ(i);dC({lineWise:true,text:hv.text});if(hw.type=="cut"){i.setSelections(hv.ranges,null,ah)}else{hq.prevInput="";hs.value=hv.text.join("\n");ej(hs)}}}if(hw.type=="cut"){i.state.cutIncoming=true}}cj(hs,"cut",ht);cj(hs,"copy",ht);cj(hr.scroller,"paste",function(hv){if(bo(hr,hv)||a4(i,hv)){return}i.state.pasteIncoming=true;hq.focus()});cj(hr.lineSpace,"selectstart",function(hv){if(!bo(hr,hv)){c9(hv)}});cj(hs,"compositionstart",function(){var hv=i.getCursor("from");if(hq.composing){hq.composing.range.clear()}hq.composing={start:hv,range:i.markText(hv,i.getCursor("to"),{className:"CodeMirror-composing"})}});cj(hs,"compositionend",function(){if(hq.composing){hq.poll();hq.composing.range.clear();hq.composing=null}})};ae.prototype.createField=function(i){this.wrapper=ba();this.textarea=this.wrapper.firstChild};ae.prototype.prepareSelection=function(){var hq=this.cm,hu=hq.display,ht=hq.doc;var i=gB(hq);if(hq.options.moveInputWithCursor){var hv=eu(hq,ht.sel.primary().head,"div");var hr=hu.wrapper.getBoundingClientRect(),hs=hu.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(hu.wrapper.clientHeight-10,hv.top+hs.top-hr.top));i.teLeft=Math.max(0,Math.min(hu.wrapper.clientWidth-10,hv.left+hs.left-hr.left))}return i};ae.prototype.showSelection=function(hr){var i=this.cm,hq=i.display;ce(hq.cursorDiv,hr.cursors);ce(hq.selectionDiv,hr.selection);if(hr.teTop!=null){this.wrapper.style.top=hr.teTop+"px";this.wrapper.style.left=hr.teLeft+"px"}};ae.prototype.reset=function(hq){if(this.contextMenuPending||this.composing){return}var i=this.cm;if(i.somethingSelected()){this.prevInput="";var hr=i.getSelection();this.textarea.value=hr;if(i.state.focused){ej(this.textarea)}if(ei&&m>=9){this.hasSelection=hr}}else{if(!hq){this.prevInput=this.textarea.value="";if(ei&&m>=9){this.hasSelection=null}}}};ae.prototype.getField=function(){return this.textarea};ae.prototype.supportsTouch=function(){return false};ae.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!eT||em()!=this.textarea)){try{this.textarea.focus()}catch(i){}}};ae.prototype.blur=function(){this.textarea.blur()};ae.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0};ae.prototype.receivedFocus=function(){this.slowPoll()};ae.prototype.slowPoll=function(){var i=this;if(this.pollingFast){return}this.polling.set(this.cm.options.pollInterval,function(){i.poll();if(i.cm.state.focused){i.slowPoll()}})};ae.prototype.fastPoll=function(){var hq=false,i=this;i.pollingFast=true;function hr(){var hs=i.poll();if(!hs&&!hq){hq=true;i.polling.set(60,hr)}else{i.pollingFast=false;i.slowPoll()}}i.polling.set(20,hr)};ae.prototype.poll=function(){var hw=this;var i=this.cm,hr=this.textarea,hs=this.prevInput;if(this.contextMenuPending||!i.state.focused||(bL(hr)&&!hs&&!this.composing)||i.isReadOnly()||i.options.disableInput||i.state.keySeq){return false}var hu=hr.value;if(hu==hs&&!i.somethingSelected()){return false}if(ei&&m>=9&&this.hasSelection===hu||cu&&/[\uf700-\uf7ff]/.test(hu)){i.display.input.reset();return false}if(i.doc.sel==i.display.selForContextMenu){var ht=hu.charCodeAt(0);if(ht==8203&&!hs){hs="\u200b"}if(ht==8666){this.reset();return this.cm.execCommand("undo")}}var hv=0,hq=Math.min(hs.length,hu.length);while(hv<hq&&hs.charCodeAt(hv)==hu.charCodeAt(hv)){++hv}dh(i,function(){gY(i,hu.slice(hv),hs.length-hv,null,hw.composing?"*compose":null);if(hu.length>1000||hu.indexOf("\n")>-1){hr.value=hw.prevInput=""}else{hw.prevInput=hu}if(hw.composing){hw.composing.range.clear();hw.composing.range=i.markText(hw.composing.start,i.getCursor("to"),{className:"CodeMirror-composing"})}});return true};ae.prototype.ensurePolled=function(){if(this.pollingFast&&this.poll()){this.pollingFast=false}};ae.prototype.onKeyPress=function(){if(ei&&m>=9){this.hasSelection=null}this.fastPoll()};ae.prototype.onContextMenu=function(hu){var hz=this,hA=hz.cm,hw=hA.display,hq=hz.textarea;var hy=cQ(hA,hu),i=hw.scroller.scrollTop;if(!hy||eE){return}var ht=hA.options.resetSelectionOnContextMenu;if(ht&&hA.doc.sel.contains(hy)==-1){dw(hA,cg)(hA.doc,fE(hy),ah)}var hv=hq.style.cssText,hD=hz.wrapper.style.cssText;hz.wrapper.style.cssText="position: absolute";var hC=hz.wrapper.getBoundingClientRect();hq.style.cssText="position: absolute; width: 30px; height: 30px;\n      top: "+(hu.clientY-hC.top-5)+"px; left: "+(hu.clientX-hC.left-5)+"px;\n      z-index: 1000; background: "+(ei?"rgba(255, 255, 255, .05)":"transparent")+";\n      outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";var hB;if(dv){hB=window.scrollY}hw.input.focus();if(dv){window.scrollTo(null,hB)}hw.input.reset();if(!hA.somethingSelected()){hq.value=hz.prevInput=" "}hz.contextMenuPending=true;hw.selForContextMenu=hA.doc.sel;clearTimeout(hw.detectingSelectAll);function hs(){if(hq.selectionStart!=null){var hE=hA.somethingSelected();var hF="\u200b"+(hE?hq.value:"");hq.value="\u21da";hq.value=hF;hz.prevInput=hE?"":"\u200b";hq.selectionStart=1;hq.selectionEnd=hF.length;hw.selForContextMenu=hA.doc.sel}}function hx(){hz.contextMenuPending=false;hz.wrapper.style.cssText=hD;hq.style.cssText=hv;if(ei&&m<9){hw.scrollbars.setScrollTop(hw.scroller.scrollTop=i)}if(hq.selectionStart!=null){if(!ei||(ei&&m<9)){hs()}var hE=0,hF=function(){if(hw.selForContextMenu==hA.doc.sel&&hq.selectionStart==0&&hq.selectionEnd>0&&hz.prevInput=="\u200b"){dw(hA,av)(hA)}else{if(hE++<10){hw.detectingSelectAll=setTimeout(hF,500)}else{hw.selForContextMenu=null;hw.input.reset()}}};hw.detectingSelectAll=setTimeout(hF,200)}}if(ei&&m>=9){hs()}if(hf){e6(hu);var hr=function(){eS(window,"mouseup",hr);setTimeout(hx,20)};cj(window,"mouseup",hr)}else{setTimeout(hx,50)}};ae.prototype.readOnlyChanged=function(i){if(!i){this.reset()}this.textarea.disabled=i=="nocursor"};ae.prototype.setUneditable=function(){};ae.prototype.needsContentAttribute=false;function gz(hw,hx){hx=hx?aZ(hx):{};hx.value=hw.value;if(!hx.tabindex&&hw.tabIndex){hx.tabindex=hw.tabIndex}if(!hx.placeholder&&hw.placeholder){hx.placeholder=hw.placeholder}if(hx.autofocus==null){var i=em();hx.autofocus=i==hw||hw.getAttribute("autofocus")!=null&&i==document.body}function ht(){hw.value=hv.getValue()}var hu;if(hw.form){cj(hw.form,"submit",ht);if(!hx.leaveSubmitMethodAlone){var hq=hw.form;hu=hq.submit;try{var hs=hq.submit=function(){ht();hq.submit=hu;hq.trigger('submit');hq.submit=hs}}catch(hr){}}}hx.finishInit=function(hy){hy.save=ht;hy.getTextArea=function(){return hw};hy.toTextArea=function(){hy.toTextArea=isNaN;ht();hw.parentNode.removeChild(hy.getWrapperElement());hw.style.display="";if(hw.form){eS(hw.form,"submit",ht);if(typeof hw.form.submit=="function"){hw.form.submit=hu}}}};hw.style.display="none";var hv=K(function(hy){return hw.parentNode.insertBefore(hy,hw.nextSibling)},hx);return hv}function gE(i){i.off=eS;i.on=cj;i.wheelEventPixels=aJ;i.Doc=aD;i.splitLines=gO;i.countColumn=cd;i.findColumn=e5;i.isWordChar=gv;i.Pass=cz;i.signal=aO;i.Line=ha;i.changeEnd=ds;i.scrollbarModel=bA;i.Pos=ac;i.cmpPos=cF;i.modes=d1;i.mimeModes=a5;i.resolveMode=hh;i.getMode=gr;i.modeExtensions=dY;i.extendMode=fn;i.copyState=cq;i.startState=cn;i.innerMode=hd;i.commands=fm;i.keyMap=f0;i.keyName=gf;i.isModifierKey=fj;i.lookupKey=k;i.normalizeKeyMap=da;i.StringStream=fH;i.SharedTextMarker=y;i.TextMarker=V;i.LineWidget=d9;i.e_preventDefault=c9;i.e_stopPropagation=dZ;i.e_stop=e6;i.addClass=gs;i.contains=hg;i.rmClass=h;i.keyNames=f5}fr(K);en(K);var d="iter insert remove copy getEditor constructor".split(" ");for(var b5 in aD.prototype){if(aD.prototype.hasOwnProperty(b5)&&dR(d,b5)<0){K.prototype[b5]=(function(i){return function(){return i.apply(this.doc,arguments)}})(aD.prototype[b5])}}bT(aD);K.inputStyles={textarea:ae,contenteditable:d3};K.defineMode=function(i){if(!K.defaults.mode&&i!="null"){K.defaults.mode=i}fa.apply(this,arguments)};K.defineMIME=bE;K.defineMode("null",function(){return({token:function(i){return i.skipToEnd()}})});K.defineMIME("text/plain","null");K.defineExtension=function(i,hq){K.prototype[i]=hq};K.defineDocExtension=function(i,hq){aD.prototype[i]=hq};K.fromTextArea=gz;gE(K);K.version="5.39.0";return K})));(function(a){"function"==typeof a.define&&a.define("core",["codemirror.js"],function(b){a.CodeMirror=b})})(this);
