'use strict';var $jscomp={scope:{},findInternal:function(y,H,D){y instanceof String&&(y=String(y));for(var r=y.length,V=0;V<r;V++){var ba=y[V];if(H.call(D,ba,V,y))return{i:V,v:ba}}return{i:-1,v:void 0}}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(y,H,D){if(D.get||D.set)throw new TypeError("ES3 does not support getters and setters.");y!=Array.prototype&&y!=Object.prototype&&(y[H]=D.value)};
$jscomp.getGlobal=function(y){return"undefined"!=typeof window&&window===y?y:"undefined"!=typeof global&&null!=global?global:y};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(y,H,D,r){if(H){D=$jscomp.global;y=y.split(".");for(r=0;r<y.length-1;r++){var V=y[r];V in D||(D[V]={});D=D[V]}y=y[y.length-1];r=D[y];H=H(r);H!=r&&null!=H&&$jscomp.defineProperty(D,y,{configurable:!0,writable:!0,value:H})}};
$jscomp.polyfill("Array.prototype.find",function(y){return y?y:function(y,D){return $jscomp.findInternal(this,y,D).v}},"es6-impl","es3");
(function(y,H){"object"===typeof exports&&"undefined"!==typeof module?module.exports=H():"function"===typeof define&&define.amd?define(H):y.CodeMirror=H()})(this,function(){function y(a){return new RegExp("(^|\\s)"+a+"(?:$|\\s)\\s*")}function H(a){for(var b=a.childNodes.length;0<b;--b)a.removeChild(a.firstChild);return a}function D(a,b){return H(a).appendChild(b)}function r(a,b,c,d){a=document.createElement(a);c&&(a.className=c);d&&(a.style.cssText=d);if("string"==typeof b)a.appendChild(document.createTextNode(b));
else if(b)for(c=0;c<b.length;++c)a.appendChild(b[c]);return a}function V(a,b){3==b.nodeType&&(b=b.parentNode);if(a.contains)return a.contains(b);do if(11==b.nodeType&&(b=b.host),b==a)return!0;while(b=b.parentNode)}function ba(){var a;try{a=document.activeElement}catch(b){a=document.body||null}for(;a&&a.root&&a.root.activeElement;)a=a.root.activeElement;return a}function Sa(a,b){var c=a.className;y(b).test(c)||(a.className+=(c?" ":"")+b)}function Ic(a,b){a=a.split(" ");for(var c=0;c<a.length;c++)a[c]&&
!y(a[c]).test(b)&&(b+=" "+a[c]);return b}function Jc(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function Da(a,b,c){b||(b={});for(var d in a)!a.hasOwnProperty(d)||!1===c&&b.hasOwnProperty(d)||(b[d]=a[d]);return b}function ca(a,b,c,d,e){null==b&&(b=a.search(/[^\s\u00a0]/),-1==b&&(b=a.length));d=d||0;for(e=e||0;;){var f=a.indexOf("\t",d);if(0>f||f>=b)return e+(b-d);e+=f-d;e+=c-e%c;d=f+1}}function Ea(){this.id=null}function M(a,b){for(var c=0;c<a.length;++c)if(a[c]==
b)return c;return-1}function Kc(a,b,c){for(var d=0,e=0;;){var f=a.indexOf("\t",d);-1==f&&(f=a.length);var g=f-d;if(f==a.length||e+g>=b)return d+Math.min(g,b-e);e+=f-d;e+=c-e%c;d=f+1;if(e>=b)return d}}function Lc(a){for(;Xb.length<=a;)Xb.push(x(Xb)+" ");return Xb[a]}function x(a){return a[a.length-1]}function Yb(a,b){for(var c=[],d=0;d<a.length;d++)c[d]=b(a[d],d);return c}function Nf(a,b,c){for(var d=0,e=c(b);d<a.length&&c(a[d])<=e;)d++;a.splice(d,0,b)}function Od(){}function Pd(a,b){Object.create?
a=Object.create(a):(Od.prototype=a,a=new Od);b&&Da(b,a);return a}function Mc(a){return/\w/.test(a)||"\u0080"<a&&(a.toUpperCase()!=a.toLowerCase()||Of.test(a))}function Zb(a,b){return b?-1<b.source.indexOf("\\w")&&Mc(a)?!0:b.test(a):Mc(a)}function Qd(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function ob(a){return 768<=a.charCodeAt(0)&&Pf.test(a)}function Qf(a,b,c){this.input=c;this.scrollbarFiller=r("div",null,"CodeMirror-scrollbar-filler");this.scrollbarFiller.setAttribute("cm-not-content",
"true");this.gutterFiller=r("div",null,"CodeMirror-gutter-filler");this.gutterFiller.setAttribute("cm-not-content","true");this.lineDiv=r("div",null,"CodeMirror-code");this.selectionDiv=r("div",null,null,"position: relative; z-index: 1");this.cursorDiv=r("div",null,"CodeMirror-cursors");this.measure=r("div",null,"CodeMirror-measure");this.lineMeasure=r("div",null,"CodeMirror-measure");this.lineSpace=r("div",[this.measure,this.lineMeasure,this.selectionDiv,this.cursorDiv,this.lineDiv],null,"position: relative; outline: none");
this.mover=r("div",[r("div",[this.lineSpace],"CodeMirror-lines")],null,"position: relative");this.sizer=r("div",[this.mover],"CodeMirror-sizer");this.sizerWidth=null;this.heightForcer=r("div",null,null,"position: absolute; height: 30px; width: 1px;");this.gutters=r("div",null,"CodeMirror-gutters");this.lineGutter=null;this.scroller=r("div",[this.sizer,this.heightForcer,this.gutters],"CodeMirror-scroll");this.scroller.setAttribute("tabIndex","-1");this.wrapper=r("div",[this.scrollbarFiller,this.gutterFiller,
this.scroller],"CodeMirror");B&&8>F&&(this.gutters.style.zIndex=-1,this.scroller.style.paddingRight=0);N||wa&&pb||(this.scroller.draggable=!0);a&&(a.appendChild?a.appendChild(this.wrapper):a(this.wrapper));this.reportedViewFrom=this.reportedViewTo=this.viewFrom=this.viewTo=b.first;this.view=[];this.externalMeasured=this.renderedView=null;this.lastWrapHeight=this.lastWrapWidth=this.viewOffset=0;this.updateLineNumbers=null;this.nativeBarWidth=this.barHeight=this.barWidth=0;this.scrollbarsClipped=!1;
this.lineNumWidth=this.lineNumInnerWidth=this.lineNumChars=null;this.alignWidgets=!1;this.maxLine=this.cachedCharWidth=this.cachedTextHeight=this.cachedPaddingH=null;this.maxLineLength=0;this.maxLineChanged=!1;this.wheelDX=this.wheelDY=this.wheelStartX=this.wheelStartY=null;this.shift=!1;this.activeTouch=this.selForContextMenu=null;c.init(this)}function v(a,b){b-=a.first;if(0>b||b>=a.size)throw Error("There is no line "+(b+a.first)+" in the document.");for(;!a.lines;)for(var c=0;;++c){var d=a.children[c],
e=d.chunkSize();if(b<e){a=d;break}b-=e}return a.lines[b]}function Fa(a,b,c){var d=[],e=b.line;a.iter(b.line,c.line+1,function(a){a=a.text;e==c.line&&(a=a.slice(0,c.ch));e==b.line&&(a=a.slice(b.ch));d.push(a);++e});return d}function Nc(a,b,c){var d=[];a.iter(b,c,function(a){d.push(a.text)});return d}function ja(a,b){if(b-=a.height)for(;a;a=a.parent)a.height+=b}function C(a){if(null==a.parent)return null;var b=a.parent;a=M(b.lines,a);for(var c=b.parent;c;b=c,c=c.parent)for(var d=0;c.children[d]!=b;++d)a+=
c.children[d].chunkSize();return a+b.first}function Ga(a,b){var c=a.first;a:do{for(var d=0;d<a.children.length;++d){var e=a.children[d],f=e.height;if(b<f){a=e;continue a}b-=f;c+=e.chunkSize()}return c}while(!a.lines);for(d=0;d<a.lines.length;++d){e=a.lines[d].height;if(b<e)break;b-=e}return c+d}function qb(a,b){return b>=a.first&&b<a.first+a.size}function Oc(a,b){return String(a.lineNumberFormatter(b+a.firstLineNumber))}function q(a,b){if(!(this instanceof q))return new q(a,b);this.line=a;this.ch=
b}function u(a,b){return a.line-b.line||a.ch-b.ch}function Pc(a){return q(a.line,a.ch)}function $b(a,b){return 0>u(a,b)?b:a}function ac(a,b){return 0>u(a,b)?a:b}function z(a,b){if(b.line<a.first)return q(a.first,0);var c=a.first+a.size-1;if(b.line>c)return q(c,v(a,c).text.length);a=v(a,b.line).text.length;c=b.ch;b=null==c||c>a?q(b.line,a):0>c?q(b.line,0):b;return b}function Rd(a,b){for(var c=[],d=0;d<b.length;d++)c[d]=z(a,b[d]);return c}function bc(a,b,c){this.marker=a;this.from=b;this.to=c}function rb(a,
b){if(a)for(var c=0;c<a.length;++c){var d=a[c];if(d.marker==b)return d}}function Qc(a,b){if(b.full)return null;var c=qb(a,b.from.line)&&v(a,b.from.line).markedSpans,d=qb(a,b.to.line)&&v(a,b.to.line).markedSpans;if(!c&&!d)return null;a=b.from.ch;var e=b.to.ch,f=0==u(b.from,b.to),g;if(c)for(var h=0;h<c.length;++h){var k=c[h],l=k.marker;if(null==k.from||(l.inclusiveLeft?k.from<=a:k.from<a)||!(k.from!=a||"bookmark"!=l.type||f&&k.marker.insertLeft)){var m=null==k.to||(l.inclusiveRight?k.to>=a:k.to>a);
(g||(g=[])).push(new bc(l,k.from,m?null:k.to))}}var c=g,n;if(d)for(g=0;g<d.length;++g)if(h=d[g],k=h.marker,null==h.to||(k.inclusiveRight?h.to>=e:h.to>e)||h.from==e&&"bookmark"==k.type&&(!f||h.marker.insertLeft))l=null==h.from||(k.inclusiveLeft?h.from<=e:h.from<e),(n||(n=[])).push(new bc(k,l?null:h.from-e,null==h.to?null:h.to-e));d=1==b.text.length;e=x(b.text).length+(d?a:0);if(c)for(f=0;f<c.length;++f)if(g=c[f],null==g.to)(h=rb(n,g.marker),h)?d&&(g.to=null==h.to?null:h.to+e):g.to=a;if(n)for(a=0;a<
n.length;++a)f=n[a],null!=f.to&&(f.to+=e),null==f.from?rb(c,f.marker)||(f.from=e,d&&(c||(c=[])).push(f)):(f.from+=e,d&&(c||(c=[])).push(f));c&&(c=Sd(c));n&&n!=c&&(n=Sd(n));a=[c];if(!d){b=b.text.length-2;var p;if(0<b&&c)for(d=0;d<c.length;++d)null==c[d].to&&(p||(p=[])).push(new bc(c[d].marker,null,null));for(c=0;c<b;++c)a.push(p);a.push(n)}return a}function Sd(a){for(var b=0;b<a.length;++b){var c=a[b];null!=c.from&&c.from==c.to&&!1!==c.marker.clearWhenEmpty&&a.splice(b--,1)}return a.length?a:null}
function Rf(a,b,c){var d=null;a.iter(b.line,c.line+1,function(a){if(a.markedSpans)for(var b=0;b<a.markedSpans.length;++b){var c=a.markedSpans[b].marker;!c.readOnly||d&&-1!=M(d,c)||(d||(d=[])).push(c)}});if(!d)return null;a=[{from:b,to:c}];for(b=0;b<d.length;++b){c=d[b];for(var e=c.find(0),f=0;f<a.length;++f){var g=a[f];if(!(0>u(g.to,e.from)||0<u(g.from,e.to))){var h=[f,1],k=u(g.from,e.from),l=u(g.to,e.to);(0>k||!c.inclusiveLeft&&!k)&&h.push({from:g.from,to:e.from});(0<l||!c.inclusiveRight&&!l)&&h.push({from:e.to,
to:g.to});a.splice.apply(a,h);f+=h.length-1}}}return a}function Td(a){var b=a.markedSpans;if(b){for(var c=0;c<b.length;++c)b[c].marker.detachLine(a);a.markedSpans=null}}function Ud(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.attachLine(a);a.markedSpans=b}}function Vd(a,b){var c=a.lines.length-b.lines.length;if(0!=c)return c;var c=a.find(),d=b.find(),e=u(c.from,d.from)||(a.inclusiveLeft?-1:0)-(b.inclusiveLeft?-1:0);return e?-e:(c=u(c.to,d.to)||(a.inclusiveRight?1:0)-(b.inclusiveRight?1:0))?c:
b.id-a.id}function Ha(a,b){a=xa&&a.markedSpans;var c;if(a)for(var d,e=0;e<a.length;++e)d=a[e],d.marker.collapsed&&null==(b?d.from:d.to)&&(!c||0>Vd(c,d.marker))&&(c=d.marker);return c}function Wd(a,b,c,d,e){a=v(a,b);if(a=xa&&a.markedSpans)for(b=0;b<a.length;++b){var f=a[b];if(f.marker.collapsed){var g=f.marker.find(0),h=u(g.from,c)||(f.marker.inclusiveLeft?-1:0)-(e.inclusiveLeft?-1:0),k=u(g.to,d)||(f.marker.inclusiveRight?1:0)-(e.inclusiveRight?1:0);if(!(0<=h&&0>=k||0>=h&&0<=k)&&(0>=h&&(f.marker.inclusiveRight&&
e.inclusiveLeft?0<=u(g.to,c):0<u(g.to,c))||0<=h&&(f.marker.inclusiveRight&&e.inclusiveLeft?0>=u(g.from,d):0>u(g.from,d))))return!0}}}function ka(a){for(var b;b=Ha(a,!0);)a=b.find(-1,!0).line;return a}function Rc(a,b){a=v(a,b);var c=ka(a);return a==c?b:C(c)}function Xd(a,b){if(b>a.lastLine())return b;var c=v(a,b);if(!Ia(a,c))return b;for(;a=Ha(c,!1);)c=a.find(1,!0).line;return C(c)+1}function Ia(a,b){var c=xa&&b.markedSpans;if(c)for(var d,e=0;e<c.length;++e)if(d=c[e],d.marker.collapsed&&(null==d.from||
!d.marker.widgetNode&&0==d.from&&d.marker.inclusiveLeft&&Sc(a,b,d)))return!0}function Sc(a,b,c){if(null==c.to)return b=c.marker.find(1,!0),Sc(a,b.line,rb(b.line.markedSpans,c.marker));if(c.marker.inclusiveRight&&c.to==b.text.length)return!0;for(var d,e=0;e<b.markedSpans.length;++e)if(d=b.markedSpans[e],d.marker.collapsed&&!d.marker.widgetNode&&d.from==c.to&&(null==d.to||d.to!=c.from)&&(d.marker.inclusiveLeft||c.marker.inclusiveRight)&&Sc(a,b,d))return!0}function la(a){a=ka(a);for(var b=0,c=a.parent,
d=0;d<c.lines.length;++d){var e=c.lines[d];if(e==a)break;else b+=e.height}for(a=c.parent;a;c=a,a=c.parent)for(d=0;d<a.children.length&&(e=a.children[d],e!=c);++d)b+=e.height;return b}function cc(a){if(0==a.height)return 0;for(var b=a.text.length,c,d=a;c=Ha(d,!0);)c=c.find(0,!0),d=c.from.line,b+=c.from.ch-c.to.ch;for(d=a;c=Ha(d,!1);)a=c.find(0,!0),b-=d.text.length-a.from.ch,d=a.to.line,b+=d.text.length-a.to.ch;return b}function Tc(a){var b=a.display;a=a.doc;b.maxLine=v(a,a.first);b.maxLineLength=cc(b.maxLine);
b.maxLineChanged=!0;a.iter(function(a){var d=cc(a);d>b.maxLineLength&&(b.maxLineLength=d,b.maxLine=a)})}function Sf(a,b,c,d){if(!a)return d(b,c,"ltr");for(var e=!1,f=0;f<a.length;++f){var g=a[f];if(g.from<c&&g.to>b||b==c&&g.to==b)d(Math.max(g.from,b),Math.min(g.to,c),1==g.level?"rtl":"ltr"),e=!0}e||d(b,c,"ltr")}function Uc(a){return a.level%2?a.to:a.from}function Vc(a){return a.level%2?a.from:a.to}function dc(a){return(a=ea(a))?Uc(a[0]):0}function ec(a){var b=ea(a);return b?Vc(x(b)):a.text.length}
function fc(a,b){var c;sb=null;for(var d=0;d<a.length;++d){var e=a[d];if(e.from<b&&e.to>b)return d;if(e.from==b||e.to==b)if(null==c)c=d;else{b=e.level;var f=a[c].level;a=a[0].level;a=b==a?!0:f==a?!1:b<f;if(a)return e.from!=e.to&&(sb=c),d;e.from!=e.to&&(sb=d);break}}return c}function Wc(a,b,c,d){if(!d)return b+c;do b+=c;while(0<b&&ob(a.text.charAt(b)));return b}function Xc(a,b,c,d){var e=ea(a);if(!e)return Yd(a,b,c,d);var f=fc(e,b),g=e[f];for(b=Wc(a,b,g.level%2?-c:c,d);;){if(b>g.from&&b<g.to)return b;
if(b==g.from||b==g.to){if(fc(e,b)==f)return b;g=e[f+c];return 0<c==g.level%2?g.to:g.from}g=e[f+=c];if(!g)return null;b=0<c==g.level%2?Wc(a,g.to,-1,d):Wc(a,g.from,1,d)}}function Yd(a,b,c,d){b+=c;if(d)for(;0<b&&ob(a.text.charAt(b));)b+=c;return 0>b||b>a.text.length?null:b}function ea(a){var b=a.order;null==b&&(b=a.order=Tf(a.text));return b}function fa(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,!1);else if(a.detachEvent)a.detachEvent("on"+b,c);else{var d=(a=a._handlers)&&a[b];d&&(c=M(d,
c),-1<c&&(a[b]=d.slice(0,c).concat(d.slice(c+1))))}}function I(a,b){var c=a._handlers&&a._handlers[b]||gc;if(c.length)for(var d=Array.prototype.slice.call(arguments,2),e=0;e<c.length;++e)c[e].apply(null,d)}function K(a,b,c){"string"==typeof b&&(b={type:b,preventDefault:function(){this.defaultPrevented=!0}});I(a,c||b.type,a,b);return Yc(b)||b.codemirrorIgnore}function Zd(a){var b=a._handlers&&a._handlers.cursorActivity;if(b){a=a.curOp.cursorActivityHandlers||(a.curOp.cursorActivityHandlers=[]);for(var c=
0;c<b.length;++c)-1==M(a,b[c])&&a.push(b[c])}}function da(a,b){return 0<(a._handlers&&a._handlers[b]||gc).length}function Ta(a){a.prototype.on=function(a,c){w(this,a,c)};a.prototype.off=function(a,c){fa(this,a,c)}}function Q(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function $d(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function Yc(a){return null!=a.defaultPrevented?a.defaultPrevented:0==a.returnValue}function tb(a){Q(a);$d(a)}function ae(a){var b=a.which;null==b&&(a.button&
1?b=1:a.button&2?b=3:a.button&4&&(b=2));ga&&a.ctrlKey&&1==b&&(b=3);return b}function Uf(a){if(null==Zc){var b=r("span","\u200b");D(a,r("span",[b,document.createTextNode("x")]));0!=a.firstChild.offsetHeight&&(Zc=1>=b.offsetWidth&&2<b.offsetHeight&&!(B&&8>F))}a=Zc?r("span","\u200b"):r("span","\u00a0",null,"display: inline-block; width: 1px; margin-right: -1px");a.setAttribute("cm-text","");return a}function Vf(a,b){2<arguments.length&&(b.dependencies=Array.prototype.slice.call(arguments,2));$c[a]=b}
function hc(a){if("string"==typeof a&&Ua.hasOwnProperty(a))a=Ua[a];else if(a&&"string"==typeof a.name&&Ua.hasOwnProperty(a.name)){var b=Ua[a.name];"string"==typeof b&&(b={name:b});a=Pd(b,a);a.name=b.name}else{if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return hc("application/xml");if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+json$/.test(a))return hc("application/json")}return"string"==typeof a?{name:a}:a||{name:"null"}}function ad(a,b){b=hc(b);var c=$c[b.name];if(!c)return ad(a,"text/plain");
a=c(a,b);if(Va.hasOwnProperty(b.name)){var c=Va[b.name],d;for(d in c)c.hasOwnProperty(d)&&(a.hasOwnProperty(d)&&(a["_"+d]=a[d]),a[d]=c[d])}a.name=b.name;b.helperType&&(a.helperType=b.helperType);if(b.modeProps)for(var e in b.modeProps)a[e]=b.modeProps[e];return a}function Wf(a,b){a=Va.hasOwnProperty(a)?Va[a]:Va[a]={};Da(b,a)}function qa(a,b){if(!0===b)return b;if(a.copyState)return a.copyState(b);a={};for(var c in b){var d=b[c];d instanceof Array&&(d=d.concat([]));a[c]=d}return a}function bd(a,b){for(var c;a.innerMode;){c=
a.innerMode(b);if(!c||c.mode==a)break;b=c.state;a=c.mode}return c||{mode:a,state:b}}function be(a,b,c){return a.startState?a.startState(b,c):!0}function ce(a,b,c,d){var e=[a.state.modeGen],f={};de(a,b.text,a.doc.mode,c,function(a,b){return e.push(a,b)},f,d);c=function(d){var c=a.state.overlays[d],g=1,l=0;de(a,b.text,c.mode,!0,function(a,b){for(var d=g;l<a;){var f=e[g];f>a&&e.splice(g,1,a,e[g+1],f);g+=2;l=Math.min(a,f)}if(b)if(c.opaque)e.splice(d,g-d,a,"overlay "+b),g=d+2;else for(;d<g;d+=2)a=e[d+
1],e[d+1]=(a?a+" ":"")+"overlay "+b},f)};for(d=0;d<a.state.overlays.length;++d)c(d);return{styles:e,classes:f.bgClass||f.textClass?f:null}}function ee(a,b,c){if(!b.styles||b.styles[0]!=a.state.modeGen){var d=ub(a,C(b)),e=ce(a,b,b.text.length>a.options.maxHighlightLength?qa(a.doc.mode,d):d);b.stateAfter=d;b.styles=e.styles;e.classes?b.styleClasses=e.classes:b.styleClasses&&(b.styleClasses=null);c===a.doc.frontier&&a.doc.frontier++}return b.styles}function ub(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return!0;
var f=Xf(a,b,c),g=f>d.first&&v(d,f-1).stateAfter,g=g?qa(d.mode,g):be(d.mode);d.iter(f,b,function(c){cd(a,c.text,g);c.stateAfter=f==b-1||0==f%5||f>=e.viewFrom&&f<e.viewTo?qa(d.mode,g):null;++f});c&&(d.frontier=f);return g}function cd(a,b,c,d){var e=a.doc.mode;a=new vb(b,a.options.tabSize);a.start=a.pos=d||0;for(""==b&&fe(e,c);!a.eol();)dd(e,a,c),a.start=a.pos}function fe(a,b){if(a.blankLine)return a.blankLine(b);if(a.innerMode&&(a=bd(a,b),a.mode.blankLine))return a.mode.blankLine(a.state)}function dd(a,
b,c,d){for(var e=0;10>e;e++){d&&(d[0]=bd(a,c).mode);var f=a.token(b,c);if(b.pos>b.start)return f}throw Error("Mode "+a.name+" failed to advance stream.");}function ge(a,b,c,d){var e=function(a){return{start:m.start,end:m.pos,string:m.current(),type:h||null,state:a?qa(f.mode,l):l}},f=a.doc,g=f.mode,h;b=z(f,b);var k=v(f,b.line),l=ub(a,b.line,c),m=new vb(k.text,a.options.tabSize),n;for(d&&(n=[]);(d||m.pos<b.ch)&&!m.eol();)m.start=m.pos,h=dd(g,m,l),d&&n.push(e(!0));return d?n:e()}function he(a,b){if(a)for(;;){var c=
a.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!c)break;a=a.slice(0,c.index)+a.slice(c.index+c[0].length);var d=c[1]?"bgClass":"textClass";null==b[d]?b[d]=c[2]:(new RegExp("(?:^|s)"+c[2]+"(?:$|s)")).test(b[d])||(b[d]+=" "+c[2])}return a}function de(a,b,c,d,e,f,g){var h=c.flattenSpans;null==h&&(h=a.options.flattenSpans);var k=0,l=null,m=new vb(b,a.options.tabSize),n,p=a.options.addModeClass&&[null];for(""==b&&he(fe(c,d),f);!m.eol();){m.pos>a.options.maxHighlightLength?(h=!1,g&&cd(a,b,d,m.pos),m.pos=
b.length,n=null):n=he(dd(c,m,d,p),f);if(p){var t=p[0].name;t&&(n="m-"+(n?t+" "+n:t))}if(!h||l!=n){for(;k<m.start;)k=Math.min(m.start,k+5E3),e(k,l);l=n}m.start=m.pos}for(;k<m.pos;)a=Math.min(m.pos,k+5E3),e(a,l),k=a}function Xf(a,b,c){for(var d,e,f=a.doc,g=c?-1:b-(a.doc.mode.innerMode?1E3:100);b>g;--b){if(b<=f.first)return f.first;var h=v(f,b-1);if(h.stateAfter&&(!c||b<=f.frontier))return b;h=ca(h.text,null,a.options.tabSize);if(null==e||d>h)e=b-1,d=h}return e}function Wa(a,b,c){this.text=a;Ud(this,
b);this.height=c?c(this):1}function ie(a,b){if(!a||/^\s*$/.test(a))return null;b=b.addModeClass?Yf:Zf;return b[a]||(b[a]=a.replace(/\S+/g,"cm-$&"))}function je(a,b){var c=r("span",null,null,N?"padding-right: .1px":null),c={pre:r("pre",[c],"CodeMirror-line"),content:c,col:0,pos:0,cm:a,trailingSpace:!1,splitSpaces:(B||N)&&a.getOption("lineWrapping")};b.measure={};for(var d=0;d<=(b.rest?b.rest.length:0);d++){var e=d?b.rest[d-1]:b.line,f=void 0;c.pos=0;c.addToken=$f;var g;g=a.display.measure;if(null!=
ed)g=ed;else{var h=D(g,document.createTextNode("A\u062eA")),k=Xa(h,0,1).getBoundingClientRect(),h=Xa(h,1,2).getBoundingClientRect();H(g);g=k&&k.left!=k.right?ed=3>h.right-k.right:!1}g&&(f=ea(e))&&(c.addToken=ag(c.addToken,f));c.map=[];var l=b!=a.display.externalMeasured&&C(e);a:{var m=h=k=g=void 0,n=void 0,p=void 0,t=void 0,f=c,l=ee(a,e,l),q=e.markedSpans,fd=e.text,v=0;if(q)for(var w=fd.length,u=0,z=1,Ja="",na=0;;){if(na==u){n=m=h=k=p="";g=null;for(var na=Infinity,ra=[],W=void 0,y=0;y<q.length;++y){var x=
q[y],A=x.marker;"bookmark"==A.type&&x.from==u&&A.widgetNode?ra.push(A):x.from<=u&&(null==x.to||x.to>u||A.collapsed&&x.to==u&&x.from==u)?(null!=x.to&&x.to!=u&&na>x.to&&(na=x.to,m=""),A.className&&(n+=" "+A.className),A.css&&(p=(p?p+";":"")+A.css),A.startStyle&&x.from==u&&(h+=" "+A.startStyle),A.endStyle&&x.to==na&&(W||(W=[])).push(A.endStyle,x.to),A.title&&!k&&(k=A.title),A.collapsed&&(!g||0>Vd(g.marker,A))&&(g=x)):x.from>u&&na>x.from&&(na=x.from)}if(W)for(y=0;y<W.length;y+=2)W[y+1]==na&&(m+=" "+W[y]);
if(!g||g.from==u)for(W=0;W<ra.length;++W)ke(f,0,ra[W]);if(g&&(g.from||0)==u){ke(f,(null==g.to?w+1:g.to)-u,g.marker,null==g.from);if(null==g.to)break a;g.to==u&&(g=!1)}}if(u>=w)break;for(ra=Math.min(w,na);;){if(Ja){W=u+Ja.length;g||(y=W>ra?Ja.slice(0,ra-u):Ja,f.addToken(f,y,t?t+n:n,h,u+y.length==na?m:"",k,p));if(W>=ra){Ja=Ja.slice(ra-u);u=ra;break}u=W;h=""}Ja=fd.slice(v,v=l[z++]);t=ie(l[z++],f.cm.options)}}else for(g=1;g<l.length;g+=2)f.addToken(f,fd.slice(v,v=l[g]),ie(l[g+1],f.cm.options))}e.styleClasses&&
(e.styleClasses.bgClass&&(c.bgClass=Ic(e.styleClasses.bgClass,c.bgClass||"")),e.styleClasses.textClass&&(c.textClass=Ic(e.styleClasses.textClass,c.textClass||"")));0==c.map.length&&c.map.push(0,0,c.content.appendChild(Uf(a.display.measure)));0==d?(b.measure.map=c.map,b.measure.cache={}):((b.measure.maps||(b.measure.maps=[])).push(c.map),(b.measure.caches||(b.measure.caches=[])).push({}))}N&&(d=c.content.lastChild,/\bcm-tab\b/.test(d.className)||d.querySelector&&d.querySelector(".cm-tab"))&&(c.content.className=
"cm-tab-wrap-hack");I(a,"renderLine",a,b.line,c.pre);c.pre.className&&(c.textClass=Ic(c.pre.className,c.textClass||""));return c}function bg(a){var b=r("span","\u2022","cm-invalidchar");b.title="\\u"+a.charCodeAt(0).toString(16);b.setAttribute("aria-label",b.title);return b}function $f(a,b,c,d,e,f,g){if(b){var h;if(a.splitSpaces)if(h=a.trailingSpace,1<b.length&&!/  /.test(b))h=b;else{for(var k="",l=0;l<b.length;l++){var m=b.charAt(l);" "!=m||!h||l!=b.length-1&&32!=b.charCodeAt(l+1)||(m="\u00a0");
k+=m;h=" "==m}h=k}else h=b;k=h;l=a.cm.state.specialChars;m=!1;if(l.test(b)){h=document.createDocumentFragment();for(var n=0;;){l.lastIndex=n;var p=l.exec(b),t=p?p.index-n:b.length-n;if(t){var q=document.createTextNode(k.slice(n,n+t));B&&9>F?h.appendChild(r("span",[q])):h.appendChild(q);a.map.push(a.pos,a.pos+t,q);a.col+=t;a.pos+=t}if(!p)break;n+=t+1;"\t"==p[0]?(p=a.cm.options.tabSize,p-=a.col%p,t=h.appendChild(r("span",Lc(p),"cm-tab")),t.setAttribute("role","presentation"),t.setAttribute("cm-text",
"\t"),a.col+=p):("\r"==p[0]||"\n"==p[0]?(t=h.appendChild(r("span","\r"==p[0]?"\u240d":"\u2424","cm-invalidchar")),t.setAttribute("cm-text",p[0])):(t=a.cm.options.specialCharPlaceholder(p[0]),t.setAttribute("cm-text",p[0]),B&&9>F?h.appendChild(r("span",[t])):h.appendChild(t)),a.col+=1);a.map.push(a.pos,a.pos+1,t);a.pos++}}else a.col+=b.length,h=document.createTextNode(k),a.map.push(a.pos,a.pos+b.length,h),B&&9>F&&(m=!0),a.pos+=b.length;a.trailingSpace=32==k.charCodeAt(b.length-1);if(c||d||e||m||g)return b=
c||"",d&&(b+=d),e&&(b+=e),d=r("span",[h],b,g),f&&(d.title=f),a.content.appendChild(d);a.content.appendChild(h)}}function ag(a,b){return function(c,d,e,f,g,h,k){e=e?e+" cm-force-border":"cm-force-border";for(var l=c.pos,m=l+d.length;;){for(var n=void 0,p=0;p<b.length&&!(n=b[p],n.to>l&&n.from<=l);p++);if(n.to>=m)return a(c,d,e,f,g,h,k);a(c,d.slice(0,n.to-l),e,f,null,h,k);f=null;d=d.slice(n.to-l);l=n.to}}}function ke(a,b,c,d){var e=!d&&c.widgetNode;e&&a.map.push(a.pos,a.pos+b,e);!d&&a.cm.display.input.needsContentAttribute&&
(e||(e=a.content.appendChild(document.createElement("span"))),e.setAttribute("cm-marker",c.id));e&&(a.cm.display.input.setUneditable(e),a.content.appendChild(e));a.pos+=b;a.trailingSpace=!1}function le(a,b,c){for(var d=this.line=b,e;d=Ha(d,!1);)d=d.find(1,!0).line,(e||(e=[])).push(d);this.size=(this.rest=e)?C(x(this.rest))-c+1:1;this.node=this.text=null;this.hidden=Ia(a,b)}function ic(a,b,c){var d=[],e;for(e=b;e<c;)b=new le(a.doc,v(a.doc,e),e),e+=b.size,d.push(b);return d}function cg(a,b){if(a=a.ownsGroup)try{var c=
a.delayedCallbacks,d=0;do{for(;d<c.length;d++)c[d].call(null);for(var e=0;e<a.ops.length;e++){var f=a.ops[e];if(f.cursorActivityHandlers)for(;f.cursorActivityCalled<f.cursorActivityHandlers.length;)f.cursorActivityHandlers[f.cursorActivityCalled++].call(null,f.cm)}}while(d<c.length)}finally{Ya=null,b(a)}}function X(a,b){var c=a._handlers&&a._handlers[b]||gc;if(c.length){var d=Array.prototype.slice.call(arguments,2),e;Ya?e=Ya.delayedCallbacks:wb?e=wb:(e=wb=[],setTimeout(dg,0));for(var f=function(a){e.push(function(){return c[a].apply(null,
d)})},g=0;g<c.length;++g)f(g)}}function dg(){var a=wb;wb=null;for(var b=0;b<a.length;++b)a[b]()}function me(a,b,c,d){for(var e=0;e<b.changes.length;e++){var f=b.changes[e];if("text"==f){var f=b,g=f.text.className,h=ne(a,f);f.text==f.node&&(f.node=h.pre);f.text.parentNode.replaceChild(h.pre,f.text);f.text=h.pre;h.bgClass!=f.bgClass||h.textClass!=f.textClass?(f.bgClass=h.bgClass,f.textClass=h.textClass,gd(f)):g&&(f.text.className=g)}else if("gutter"==f)oe(a,b,c,d);else if("class"==f)gd(b);else if("widget"==
f){f=a;g=b;h=d;g.alignable&&(g.alignable=null);for(var k=g.node.firstChild,l;k;k=l)l=k.nextSibling,"CodeMirror-linewidget"==k.className&&g.node.removeChild(k);pe(f,g,h)}}b.changes=null}function xb(a){a.node==a.text&&(a.node=r("div",null,null,"position: relative"),a.text.parentNode&&a.text.parentNode.replaceChild(a.node,a.text),a.node.appendChild(a.text),B&&8>F&&(a.node.style.zIndex=2));return a.node}function ne(a,b){var c=a.display.externalMeasured;return c&&c.line==b.line?(a.display.externalMeasured=
null,b.measure=c.measure,c.built):je(a,b)}function gd(a){var b=a.bgClass?a.bgClass+" "+(a.line.bgClass||""):a.line.bgClass;b&&(b+=" CodeMirror-linebackground");if(a.background)b?a.background.className=b:(a.background.parentNode.removeChild(a.background),a.background=null);else if(b){var c=xb(a);a.background=c.insertBefore(r("div",null,b),c.firstChild)}a.line.wrapClass?xb(a).className=a.line.wrapClass:a.node!=a.text&&(a.node.className="");a.text.className=(a.textClass?a.textClass+" "+(a.line.textClass||
""):a.line.textClass)||""}function oe(a,b,c,d){b.gutter&&(b.node.removeChild(b.gutter),b.gutter=null);b.gutterBackground&&(b.node.removeChild(b.gutterBackground),b.gutterBackground=null);if(b.line.gutterClass){var e=xb(b);b.gutterBackground=r("div",null,"CodeMirror-gutter-background "+b.line.gutterClass,"left: "+(a.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+"px; width: "+d.gutterTotalWidth+"px");e.insertBefore(b.gutterBackground,b.text)}e=b.line.gutterMarkers;if(a.options.lineNumbers||e){var f=
xb(b),g=b.gutter=r("div",null,"CodeMirror-gutter-wrapper","left: "+(a.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+"px");a.display.input.setUneditable(g);f.insertBefore(g,b.text);b.line.gutterClass&&(g.className+=" "+b.line.gutterClass);!a.options.lineNumbers||e&&e["CodeMirror-linenumbers"]||(b.lineNumber=g.appendChild(r("div",Oc(a.options,c),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+d.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+a.display.lineNumInnerWidth+"px")));if(e)for(b=
0;b<a.options.gutters.length;++b)c=a.options.gutters[b],(f=e.hasOwnProperty(c)&&e[c])&&g.appendChild(r("div",[f],"CodeMirror-gutter-elt","left: "+d.gutterLeft[c]+"px; width: "+d.gutterWidth[c]+"px"))}}function eg(a,b,c,d){var e=ne(a,b);b.text=b.node=e.pre;e.bgClass&&(b.bgClass=e.bgClass);e.textClass&&(b.textClass=e.textClass);gd(b);oe(a,b,c,d);pe(a,b,d);return b.node}function pe(a,b,c){qe(a,b.line,b,c,!0);if(b.rest)for(var d=0;d<b.rest.length;d++)qe(a,b.rest[d],b,c,!1)}function qe(a,b,c,d,e){if(b.widgets){var f=
xb(c),g=0;for(b=b.widgets;g<b.length;++g){var h=b[g],k=r("div",[h.node],"CodeMirror-linewidget");h.handleMouseEvents||k.setAttribute("cm-ignore-events","true");var l=h,m=k,n=d;if(l.noHScroll){(c.alignable||(c.alignable=[])).push(m);var p=n.wrapperWidth;m.style.left=n.fixedPos+"px";l.coverGutter||(p-=n.gutterTotalWidth,m.style.paddingLeft=n.gutterTotalWidth+"px");m.style.width=p+"px"}l.coverGutter&&(m.style.zIndex=5,m.style.position="relative",l.noHScroll||(m.style.marginLeft=-n.gutterTotalWidth+"px"));
a.display.input.setUneditable(k);e&&h.above?f.insertBefore(k,c.gutter||c.text):f.appendChild(k);X(h,"redraw")}}}function yb(a){if(null!=a.height)return a.height;var b=a.doc.cm;if(!b)return 0;if(!V(document.body,a.node)){var c="position: relative;";a.coverGutter&&(c+="margin-left: -"+b.display.gutters.offsetWidth+"px;");a.noHScroll&&(c+="width: "+b.display.wrapper.clientWidth+"px;");D(b.display.measure,r("div",[a.node],null,c))}return a.height=a.node.parentNode.offsetHeight}function sa(a,b){for(b=
b.target||b.srcElement;b!=a.wrapper;b=b.parentNode)if(!b||1==b.nodeType&&"true"==b.getAttribute("cm-ignore-events")||b.parentNode==a.sizer&&b!=a.mover)return!0}function hd(a){return a.mover.offsetHeight-a.lineSpace.offsetHeight}function re(a){if(a.cachedPaddingH)return a.cachedPaddingH;var b=D(a.measure,r("pre","x")),b=window.getComputedStyle?window.getComputedStyle(b):b.currentStyle,b={left:parseInt(b.paddingLeft),right:parseInt(b.paddingRight)};isNaN(b.left)||isNaN(b.right)||(a.cachedPaddingH=b);
return b}function oa(a){return 30-a.display.nativeBarWidth}function Ka(a){return a.display.scroller.clientWidth-oa(a)-a.display.barWidth}function id(a){return a.display.scroller.clientHeight-oa(a)-a.display.barHeight}function se(a,b,c){if(a.line==b)return{map:a.measure.map,cache:a.measure.cache};for(var d=0;d<a.rest.length;d++)if(a.rest[d]==b)return{map:a.measure.maps[d],cache:a.measure.caches[d]};for(b=0;b<a.rest.length;b++)if(C(a.rest[b])>c)return{map:a.measure.maps[b],cache:a.measure.caches[b],
before:!0}}function jd(a,b){if(b>=a.display.viewFrom&&b<a.display.viewTo)return a.display.view[La(a,b)];if((a=a.display.externalMeasured)&&b>=a.lineN&&b<a.lineN+a.size)return a}function jc(a,b){var c=C(b),d=jd(a,c);d&&!d.text?d=null:d&&d.changes&&(me(a,d,c,kd(a)),a.curOp.forceUpdate=!0);if(!d){var e;e=ka(b);d=C(e);e=a.display.externalMeasured=new le(a.doc,e,d);e.lineN=d;d=e.built=je(a,e);e.text=d.pre;D(a.display.lineMeasure,d.pre);d=e}a=se(d,b,c);return{line:b,view:d,rect:null,map:a.map,cache:a.cache,
before:a.before,hasHeights:!1}}function kc(a,b,c,d,e){b.before&&(c=-1);var f=c+(d||"");if(b.cache.hasOwnProperty(f))a=b.cache[f];else{b.rect||(b.rect=b.view.text.getBoundingClientRect());if(!b.hasHeights){var g=b.view,h=b.rect,k=a.options.lineWrapping,l=k&&Ka(a);if(!g.measure.heights||k&&g.measure.width!=l){var m=g.measure.heights=[];if(k)for(g.measure.width=l,g=g.text.firstChild.getClientRects(),k=0;k<g.length-1;k++){var l=g[k],n=g[k+1];2<Math.abs(l.bottom-n.bottom)&&m.push((l.bottom+n.top)/2-h.top)}m.push(h.bottom-
h.top)}b.hasHeights=!0}m=d;g=te(b.map,c,m);d=g.node;h=g.start;k=g.end;c=g.collapse;var p;if(3==d.nodeType){for(var t=0;4>t;t++){for(;h&&ob(b.line.text.charAt(g.coverStart+h));)--h;for(;g.coverStart+k<g.coverEnd&&ob(b.line.text.charAt(g.coverStart+k));)++k;if(B&&9>F&&0==h&&k==g.coverEnd-g.coverStart)p=d.parentNode.getBoundingClientRect();else{p=Xa(d,h,k).getClientRects();k=ue;if("left"==m)for(l=0;l<p.length&&(k=p[l]).left==k.right;l++);else for(l=p.length-1;0<=l&&(k=p[l]).left==k.right;l--);p=k}if(p.left||
p.right||0==h)break;k=h;--h;c="right"}B&&11>F&&((t=!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI)||(null!=ld?t=ld:(m=D(a.display.measure,r("span","x")),t=m.getBoundingClientRect(),m=Xa(m,0,1).getBoundingClientRect(),t=ld=1<Math.abs(t.left-m.left)),t=!t),t||(t=screen.logicalXDPI/screen.deviceXDPI,m=screen.logicalYDPI/screen.deviceYDPI,p={left:p.left*t,right:p.right*t,top:p.top*m,bottom:p.bottom*m}))}else 0<h&&(c=m="right"),p=a.options.lineWrapping&&1<(t=d.getClientRects()).length?
t["right"==m?t.length-1:0]:d.getBoundingClientRect();!(B&&9>F)||h||p&&(p.left||p.right)||(p=(p=d.parentNode.getClientRects()[0])?{left:p.left,right:p.left+zb(a.display),top:p.top,bottom:p.bottom}:ue);d=p.top-b.rect.top;h=p.bottom-b.rect.top;t=(d+h)/2;m=b.view.measure.heights;for(g=0;g<m.length-1&&!(t<m[g]);g++);c={left:("right"==c?p.right:p.left)-b.rect.left,right:("left"==c?p.left:p.right)-b.rect.left,top:g?m[g-1]:0,bottom:m[g]};p.left||p.right||(c.bogus=!0);a.options.singleCursorHeightPerLine||
(c.rtop=d,c.rbottom=h);a=c;a.bogus||(b.cache[f]=a)}return{left:a.left,right:a.right,top:e?a.rtop:a.top,bottom:e?a.rbottom:a.bottom}}function te(a,b,c){for(var d,e,f,g,h,k,l=0;l<a.length;l+=3){h=a[l];k=a[l+1];if(b<h)e=0,f=1,g="left";else if(b<k)e=b-h,f=e+1;else if(l==a.length-3||b==k&&a[l+3]>b)f=k-h,e=f-1,b>=k&&(g="right");if(null!=e){d=a[l+2];h==k&&c==(d.insertLeft?"left":"right")&&(g=c);if("left"==c&&0==e)for(;l&&a[l-2]==a[l-3]&&a[l-1].insertLeft;)d=a[(l-=3)+2],g="left";if("right"==c&&e==k-h)for(;l<
a.length-3&&a[l+3]==a[l+4]&&!a[l+5].insertLeft;)d=a[(l+=3)+2],g="right";break}}return{node:d,start:e,end:f,collapse:g,coverStart:h,coverEnd:k}}function ve(a){if(a.measure&&(a.measure.cache={},a.measure.heights=null,a.rest))for(var b=0;b<a.rest.length;b++)a.measure.caches[b]={}}function we(a){a.display.externalMeasure=null;H(a.display.lineMeasure);for(var b=0;b<a.display.view.length;b++)ve(a.display.view[b])}function Ab(a){we(a);a.display.cachedCharWidth=a.display.cachedTextHeight=a.display.cachedPaddingH=
null;a.options.lineWrapping||(a.display.maxLineChanged=!0);a.display.lineNumChars=null}function md(a,b,c,d,e){if(!e&&b.widgets)for(e=0;e<b.widgets.length;++e)if(b.widgets[e].above){var f=yb(b.widgets[e]);c.top+=f;c.bottom+=f}if("line"==d)return c;d||(d="local");b=la(b);b="local"==d?b+a.display.lineSpace.offsetTop:b-a.display.viewOffset;if("page"==d||"window"==d)a=a.display.lineSpace.getBoundingClientRect(),b+=a.top+("window"==d?0:window.pageYOffset||(document.documentElement||document.body).scrollTop),
d=a.left+("window"==d?0:window.pageXOffset||(document.documentElement||document.body).scrollLeft),c.left+=d,c.right+=d;c.top+=b;c.bottom+=b;return c}function xe(a,b,c){if("div"==c)return b;var d=b.left;b=b.top;"page"==c?(d-=window.pageXOffset||(document.documentElement||document.body).scrollLeft,b-=window.pageYOffset||(document.documentElement||document.body).scrollTop):"local"!=c&&c||(c=a.display.sizer.getBoundingClientRect(),d+=c.left,b+=c.top);a=a.display.lineSpace.getBoundingClientRect();return{left:d-
a.left,top:b-a.top}}function lc(a,b,c,d,e){d||(d=v(a.doc,b.line));var f=d;b=b.ch;d=kc(a,jc(a,d),b,e);return md(a,f,d,c)}function ta(a,b,c,d,e,f){function g(b,g){b=kc(a,e,b,g?"right":"left",f);g?b.left=b.right:b.right=b.left;return md(a,d,b,c)}function h(a,b){var d=k[b],c=d.level%2;a==Uc(d)&&b&&d.level<k[b-1].level?(d=k[--b],a=Vc(d)-(d.level%2?0:1),c=!0):a==Vc(d)&&b<k.length-1&&d.level<k[b+1].level&&(d=k[++b],a=Uc(d)-d.level%2,c=!1);return c&&a==d.to&&a>d.from?g(a-1):g(a,c)}d=d||v(a.doc,b.line);e||
(e=jc(a,d));var k=ea(d);b=b.ch;if(!k)return g(b);var l=fc(k,b),l=h(b,l);null!=sb&&(l.other=h(b,sb));return l}function ye(a,b){var c=0;b=z(a.doc,b);a.options.lineWrapping||(c=zb(a.display)*b.ch);b=v(a.doc,b.line);a=la(b)+a.display.lineSpace.offsetTop;return{left:c,right:c,top:a,bottom:a+b.height}}function mc(a,b,c,d){a=q(a,b);a.xRel=d;c&&(a.outside=!0);return a}function nd(a,b,c){var d=a.doc;c+=a.display.viewOffset;if(0>c)return mc(d.first,0,!0,-1);var e=Ga(d,c),f=d.first+d.size-1;if(e>f)return mc(d.first+
d.size-1,v(d,f).text.length,!0,1);0>b&&(b=0);for(d=v(d,e);;)if(e=fg(a,d,e,b,c),f=(d=Ha(d,!1))&&d.find(0,!0),d&&(e.ch>f.from.ch||e.ch==f.from.ch&&0<e.xRel))e=C(d=f.to.line);else return e}function fg(a,b,c,d,e){function f(d){d=ta(a,q(c,d),"line",b,l);h=!0;if(g>d.bottom)return d.left-k;if(g<d.top)return d.left+k;h=!1;return d.left}var g=e-la(b),h=!1,k=2*a.display.wrapper.clientWidth,l=jc(a,b);e=ea(b);var m=b.text.length,n=dc(b),p=ec(b),t=f(n),ma=h,u=f(p),r=h;if(d>u)return mc(c,p,r,1);for(;;){if(e?p==
n||p==Xc(b,n,1):1>=p-n){m=d<t||d-t<=u-d?n:p;ma=m==n?ma:r;n=d-(m==n?t:u);r&&!e&&!/\s/.test(b.text.charAt(m))&&0<n&&m<b.text.length&&1<l.view.measure.heights.length&&(e=kc(a,l,m,"right"),g<=e.bottom&&g>=e.top&&Math.abs(d-e.right)<n&&(ma=!1,m++,n=d-e.right));for(;ob(b.text.charAt(m));)++m;return mc(c,m,ma,-1>n?-1:1<n?1:0)}var v=Math.ceil(m/2),w=n+v;if(e)for(var w=n,x=0;x<v;++x)w=Xc(b,w,1);x=f(w);if(x>d){p=w;u=x;if(r=h)u+=1E3;m=v}else n=w,t=x,ma=h,m-=v}}function Ma(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;
if(null==Na){Na=r("pre");for(var b=0;49>b;++b)Na.appendChild(document.createTextNode("x")),Na.appendChild(r("br"));Na.appendChild(document.createTextNode("x"))}D(a.measure,Na);b=Na.offsetHeight/50;3<b&&(a.cachedTextHeight=b);H(a.measure);return b||1}function zb(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=r("span","xxxxxxxxxx"),c=r("pre",[b]);D(a.measure,c);b=b.getBoundingClientRect();b=(b.right-b.left)/10;2<b&&(a.cachedCharWidth=b);return b||10}function kd(a){for(var b=a.display,
c={},d={},e=b.gutters.clientLeft,f=b.gutters.firstChild,g=0;f;f=f.nextSibling,++g)c[a.options.gutters[g]]=f.offsetLeft+f.clientLeft+e,d[a.options.gutters[g]]=f.clientWidth;return{fixedPos:od(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d,wrapperWidth:b.wrapper.clientWidth}}function od(a){return a.scroller.getBoundingClientRect().left-a.sizer.getBoundingClientRect().left}function ze(a){var b=Ma(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/
zb(a.display)-3);return function(e){if(Ia(a.doc,e))return 0;var f=0;if(e.widgets)for(var g=0;g<e.widgets.length;g++)e.widgets[g].height&&(f+=e.widgets[g].height);return c?f+(Math.ceil(e.text.length/d)||1)*b:f+b}}function pd(a){var b=a.doc,c=ze(a);b.iter(function(a){var b=c(a);b!=a.height&&ja(a,b)})}function Oa(a,b,c,d){var e=a.display;if(!c&&"true"==(b.target||b.srcElement).getAttribute("cm-not-content"))return null;var f,g;c=e.lineSpace.getBoundingClientRect();try{f=b.clientX-c.left,g=b.clientY-
c.top}catch(k){return null}b=nd(a,f,g);var h;d&&1==b.xRel&&(h=v(a.doc,b.line).text).length==b.ch&&(d=ca(h,h.length,a.options.tabSize)-h.length,b=q(b.line,Math.max(0,Math.round((f-re(a.display).left)/zb(a.display))-d)));return b}function La(a,b){if(b>=a.display.viewTo)return null;b-=a.display.viewFrom;if(0>b)return null;a=a.display.view;for(var c=0;c<a.length;c++)if(b-=a[c].size,0>b)return c}function Bb(a){a.display.input.showSelection(a.display.input.prepareSelection())}function Ae(a,b){for(var c=
a.doc,d={},e=d.cursors=document.createDocumentFragment(),f=d.selection=document.createDocumentFragment(),g=0;g<c.sel.ranges.length;g++)if(!1!==b||g!=c.sel.primIndex){var h=c.sel.ranges[g];if(!(h.from().line>=a.display.viewTo||h.to().line<a.display.viewFrom)){var k=h.empty();(k||a.options.showCursorWhenSelecting)&&Be(a,h.head,e);k||gg(a,h,f)}}return d}function Be(a,b,c){b=ta(a,b,"div",null,null,!a.options.singleCursorHeightPerLine);var d=c.appendChild(r("div","\u00a0","CodeMirror-cursor"));d.style.left=
b.left+"px";d.style.top=b.top+"px";d.style.height=Math.max(0,b.bottom-b.top)*a.options.cursorHeight+"px";b.other&&(a=c.appendChild(r("div","\u00a0","CodeMirror-cursor CodeMirror-secondarycursor")),a.style.display="",a.style.left=b.other.left+"px",a.style.top=b.other.top+"px",a.style.height=.85*(b.other.bottom-b.other.top)+"px")}function gg(a,b,c){function d(a,b,d,c){0>b&&(b=0);b=Math.round(b);c=Math.round(c);h.appendChild(r("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px;\n                             top: "+
b+"px; width: "+(null==d?m-a:d)+"px;\n                             height: "+(c-b)+"px"))}function e(b,c,e){var f=v(g,b),h=f.text.length,k,n;Sf(ea(f),c||0,null==e?h:e,function(g,p,t){var u=lc(a,q(b,g),"div",f,"left"),r,ma;g==p?(r=u,t=ma=u.left):(r=lc(a,q(b,p-1),"div",f,"right"),"rtl"==t&&(t=u,u=r,r=t),t=u.left,ma=r.right);null==c&&0==g&&(t=l);3<r.top-u.top&&(d(t,u.top,null,u.bottom),t=l,u.bottom<r.top&&d(t,u.bottom,null,r.top));null==e&&p==h&&(ma=m);if(!k||u.top<k.top||u.top==k.top&&u.left<k.left)k=
u;if(!n||r.bottom>n.bottom||r.bottom==n.bottom&&r.right>n.right)n=r;t<l+1&&(t=l);d(t,r.top,ma-t,r.bottom)});return{start:k,end:n}}var f=a.display,g=a.doc,h=document.createDocumentFragment(),k=re(a.display),l=k.left,m=Math.max(f.sizerWidth,Ka(a)-f.sizer.offsetLeft)-k.right,f=b.from();b=b.to();if(f.line==b.line)e(f.line,f.ch,b.ch);else{var n=v(g,f.line),k=v(g,b.line),k=ka(n)==ka(k),f=e(f.line,f.ch,k?n.text.length+1:null).end;b=e(b.line,k?0:null,b.ch).start;k&&(f.top<b.top-2?(d(f.right,f.top,null,f.bottom),
d(l,b.top,b.left,b.bottom)):d(f.right,f.top,b.left-f.right,f.bottom));f.bottom<b.top&&d(l,f.bottom,null,b.top)}c.appendChild(h)}function qd(a){if(a.state.focused){var b=a.display;clearInterval(b.blinker);var c=!0;b.cursorDiv.style.visibility="";0<a.options.cursorBlinkRate?b.blinker=setInterval(function(){return b.cursorDiv.style.visibility=(c=!c)?"":"hidden"},a.options.cursorBlinkRate):0>a.options.cursorBlinkRate&&(b.cursorDiv.style.visibility="hidden")}}function Ce(a){a.state.focused||(a.display.input.focus(),
rd(a))}function hg(a){a.state.delayingBlurEvent=!0;setTimeout(function(){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1,Cb(a))},100)}function rd(a,b){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1);"nocursor"!=a.options.readOnly&&(a.state.focused||(I(a,"focus",a,b),a.state.focused=!0,Sa(a.display.wrapper,"CodeMirror-focused"),a.curOp||a.display.selForContextMenu==a.doc.sel||(a.display.input.reset(),N&&setTimeout(function(){return a.display.input.reset(!0)},20)),a.display.input.receivedFocus()),
qd(a))}function Cb(a,b){a.state.delayingBlurEvent||(a.state.focused&&(I(a,"blur",a,b),a.state.focused=!1,Za(a.display.wrapper,"CodeMirror-focused")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.display.shift=!1)},150))}function sd(a){var b=a.display,c=b.view;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var d=od(b)-b.scroller.scrollLeft+a.doc.scrollLeft,e=b.gutters.offsetWidth,f=d+"px",g=0;g<c.length;g++)if(!c[g].hidden){a.options.fixedGutter&&(c[g].gutter&&
(c[g].gutter.style.left=f),c[g].gutterBackground&&(c[g].gutterBackground.style.left=f));var h=c[g].alignable;if(h)for(var k=0;k<h.length;k++)h[k].style.left=f}a.options.fixedGutter&&(b.gutters.style.left=d+e+"px")}}function De(a){if(!a.options.lineNumbers)return!1;var b=a.doc,b=Oc(a.options,b.first+b.size-1),c=a.display;if(b.length!=c.lineNumChars){var d=c.measure.appendChild(r("div",[r("div",b)],"CodeMirror-linenumber CodeMirror-gutter-elt")),e=d.firstChild.offsetWidth,d=d.offsetWidth-e;c.lineGutter.style.width=
"";c.lineNumInnerWidth=Math.max(e,c.lineGutter.offsetWidth-d)+1;c.lineNumWidth=c.lineNumInnerWidth+d;c.lineNumChars=c.lineNumInnerWidth?b.length:-1;c.lineGutter.style.width=c.lineNumWidth+"px";td(a);return!0}return!1}function nc(a){a=a.display;for(var b=a.lineDiv.offsetTop,c=0;c<a.view.length;c++){var d=a.view[c],e;if(!d.hidden){if(B&&8>F){var f=d.node.offsetTop+d.node.offsetHeight;e=f-b;b=f}else e=d.node.getBoundingClientRect(),e=e.bottom-e.top;f=d.line.height-e;2>e&&(e=Ma(a));if(.001<f||-.001>f)if(ja(d.line,
e),Ee(d.line),d.rest)for(e=0;e<d.rest.length;e++)Ee(d.rest[e])}}}function Ee(a){if(a.widgets)for(var b=0;b<a.widgets.length;++b)a.widgets[b].height=a.widgets[b].node.parentNode.offsetHeight}function ud(a,b,c){var d=c&&null!=c.top?Math.max(0,c.top):a.scroller.scrollTop,d=Math.floor(d-a.lineSpace.offsetTop),e=c&&null!=c.bottom?c.bottom:d+a.wrapper.clientHeight,d=Ga(b,d),e=Ga(b,e);if(c&&c.ensure){var f=c.ensure.from.line;c=c.ensure.to.line;f<d?(d=f,e=Ga(b,la(v(b,f))+a.wrapper.clientHeight)):Math.min(c,
b.lastLine())>=e&&(d=Ga(b,la(v(b,c))-a.wrapper.clientHeight),e=c)}return{from:d,to:Math.max(e,d+1)}}function Db(a,b){2>Math.abs(a.doc.scrollTop-b)||(a.doc.scrollTop=b,wa||vd(a,{top:b}),a.display.scroller.scrollTop!=b&&(a.display.scroller.scrollTop=b),a.display.scrollbars.setScrollTop(b),wa&&vd(a),Eb(a,100))}function $a(a,b,c){(c?b==a.doc.scrollLeft:2>Math.abs(a.doc.scrollLeft-b))||(b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth),a.doc.scrollLeft=b,sd(a),a.display.scroller.scrollLeft!=
b&&(a.display.scroller.scrollLeft=b),a.display.scrollbars.setScrollLeft(b))}function Fe(a){var b=a.wheelDeltaX,c=a.wheelDeltaY;null==b&&a.detail&&a.axis==a.HORIZONTAL_AXIS&&(b=a.detail);null==c&&a.detail&&a.axis==a.VERTICAL_AXIS?c=a.detail:null==c&&(c=a.wheelDelta);return{x:b,y:c}}function ig(a){a=Fe(a);a.x*=Z;a.y*=Z;return a}function Ge(a,b){var c=Fe(b),d=c.x,c=c.y,e=a.display,f=e.scroller,g=f.scrollWidth>f.clientWidth,h=f.scrollHeight>f.clientHeight;if(d&&g||c&&h){if(c&&ga&&N){var g=b.target,k=
e.view;a:for(;g!=f;g=g.parentNode)for(var l=0;l<k.length;l++)if(k[l].node==g){a.display.currentWheelTarget=g;break a}}!d||wa||ha||null==Z?(c&&null!=Z&&(b=c*Z,h=a.doc.scrollTop,g=h+e.wrapper.clientHeight,0>b?h=Math.max(0,h+b-50):g=Math.min(a.doc.height,g+b+50),vd(a,{top:h,bottom:g})),20>oc&&(null==e.wheelStartX?(e.wheelStartX=f.scrollLeft,e.wheelStartY=f.scrollTop,e.wheelDX=d,e.wheelDY=c,setTimeout(function(){if(null!=e.wheelStartX){var a=f.scrollLeft-e.wheelStartX,b=f.scrollTop-e.wheelStartY,a=b&&
e.wheelDY&&b/e.wheelDY||a&&e.wheelDX&&a/e.wheelDX;e.wheelStartX=e.wheelStartY=null;a&&(Z=(Z*oc+a)/(oc+1),++oc)}},200)):(e.wheelDX+=d,e.wheelDY+=c))):(c&&h&&Db(a,Math.max(0,Math.min(f.scrollTop+c*Z,f.scrollHeight-f.clientHeight))),$a(a,Math.max(0,Math.min(f.scrollLeft+d*Z,f.scrollWidth-f.clientWidth))),(!c||c&&h)&&Q(b),e.wheelStartX=null)}}function Fb(a){var b=a.display,c=b.gutters.offsetWidth,d=Math.round(a.doc.height+hd(a.display));return{clientHeight:b.scroller.clientHeight,viewHeight:b.wrapper.clientHeight,
scrollWidth:b.scroller.scrollWidth,clientWidth:b.scroller.clientWidth,viewWidth:b.wrapper.clientWidth,barLeft:a.options.fixedGutter?c:0,docHeight:d,scrollHeight:d+oa(a)+b.barHeight,nativeBarWidth:b.nativeBarWidth,gutterWidth:c}}function ab(a,b){b||(b=Fb(a));var c=a.display.barWidth,d=a.display.barHeight;He(a,b);for(b=0;4>b&&c!=a.display.barWidth||d!=a.display.barHeight;b++)c!=a.display.barWidth&&a.options.lineWrapping&&nc(a),He(a,Fb(a)),c=a.display.barWidth,d=a.display.barHeight}function He(a,b){var c=
a.display,d=c.scrollbars.update(b);c.sizer.style.paddingRight=(c.barWidth=d.right)+"px";c.sizer.style.paddingBottom=(c.barHeight=d.bottom)+"px";c.heightForcer.style.borderBottom=d.bottom+"px solid transparent";d.right&&d.bottom?(c.scrollbarFiller.style.display="block",c.scrollbarFiller.style.height=d.bottom+"px",c.scrollbarFiller.style.width=d.right+"px"):c.scrollbarFiller.style.display="";d.bottom&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(c.gutterFiller.style.display="block",
c.gutterFiller.style.height=d.bottom+"px",c.gutterFiller.style.width=b.gutterWidth+"px"):c.gutterFiller.style.display=""}function Ie(a){a.display.scrollbars&&(a.display.scrollbars.clear(),a.display.scrollbars.addClass&&Za(a.display.wrapper,a.display.scrollbars.addClass));a.display.scrollbars=new Je[a.options.scrollbarStyle](function(b){a.display.wrapper.insertBefore(b,a.display.scrollbarFiller);w(b,"mousedown",function(){a.state.focused&&setTimeout(function(){return a.display.input.focus()},0)});
b.setAttribute("cm-not-content","true")},function(b,c){"horizontal"==c?$a(a,b):Db(a,b)},a);a.display.scrollbars.addClass&&Sa(a.display.wrapper,a.display.scrollbars.addClass)}function pc(a,b,c,d,e){var f=a.display,g=Ma(a.display);0>c&&(c=0);var h=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:f.scroller.scrollTop,k=id(a),l={};e-c>k&&(e=c+k);var m=a.doc.height+hd(f),n=c<g,g=e>m-g;c<h?l.scrollTop=n?0:c:e>h+k&&(c=Math.min(c,(g?m:e)-k),c!=h&&(l.scrollTop=c));h=a.curOp&&null!=a.curOp.scrollLeft?a.curOp.scrollLeft:
f.scroller.scrollLeft;a=Ka(a)-(a.options.fixedGutter?f.gutters.offsetWidth:0);(f=d-b>a)&&(d=b+a);10>b?l.scrollLeft=0:b<h?l.scrollLeft=Math.max(0,b-(f?0:10)):d>a+h-3&&(l.scrollLeft=d+(f?0:10)-a);return l}function qc(a,b,c){null==b&&null==c||rc(a);null!=b&&(a.curOp.scrollLeft=(null==a.curOp.scrollLeft?a.doc.scrollLeft:a.curOp.scrollLeft)+b);null!=c&&(a.curOp.scrollTop=(null==a.curOp.scrollTop?a.doc.scrollTop:a.curOp.scrollTop)+c)}function bb(a){rc(a);var b=a.getCursor(),c=b,d=b;a.options.lineWrapping||
(c=b.ch?q(b.line,b.ch-1):b,d=q(b.line,b.ch+1));a.curOp.scrollToPos={from:c,to:d,margin:a.options.cursorScrollMargin,isCursor:!0}}function rc(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var c=ye(a,b.from),d=ye(a,b.to),b=pc(a,Math.min(c.left,d.left),Math.min(c.top,d.top)-b.margin,Math.max(c.right,d.right),Math.max(c.bottom,d.bottom)+b.margin);a.scrollTo(b.scrollLeft,b.scrollTop)}}function cb(a){a.curOp={cm:a,viewChanged:!1,startHeight:a.doc.height,forceUpdate:!1,updateInput:null,typing:!1,
changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++jg};a=a.curOp;Ya?Ya.ops.push(a):a.ownsGroup=Ya={ops:[a],delayedCallbacks:[]}}function db(a){cg(a.curOp,function(a){for(var b=0;b<a.ops.length;b++)a.ops[b].cm.curOp=null;a=a.ops;for(b=0;b<a.length;b++){var d=a[b],e=d.cm,f=e.display,g=e.display;!g.scrollbarsClipped&&g.scroller.offsetWidth&&(g.nativeBarWidth=g.scroller.offsetWidth-g.scroller.clientWidth,
g.heightForcer.style.height=oa(e)+"px",g.sizer.style.marginBottom=-g.nativeBarWidth+"px",g.sizer.style.borderRightWidth=oa(e)+"px",g.scrollbarsClipped=!0);d.updateMaxLine&&Tc(e);d.mustUpdate=d.viewChanged||d.forceUpdate||null!=d.scrollTop||d.scrollToPos&&(d.scrollToPos.from.line<f.viewFrom||d.scrollToPos.to.line>=f.viewTo)||f.maxLineChanged&&e.options.lineWrapping;d.update=d.mustUpdate&&new sc(e,d.mustUpdate&&{top:d.scrollTop,ensure:d.scrollToPos},d.forceUpdate)}for(b=0;b<a.length;b++)d=a[b],d.updatedDisplay=
d.mustUpdate&&wd(d.cm,d.update);for(b=0;b<a.length;b++)if(d=a[b],e=d.cm,f=e.display,d.updatedDisplay&&nc(e),d.barMeasure=Fb(e),f.maxLineChanged&&!e.options.lineWrapping&&(g=f.maxLine.text.length,g=kc(e,jc(e,f.maxLine),g,void 0),d.adjustWidthTo=g.left+3,e.display.sizerWidth=d.adjustWidthTo,d.barMeasure.scrollWidth=Math.max(f.scroller.clientWidth,f.sizer.offsetLeft+d.adjustWidthTo+oa(e)+e.display.barWidth),d.maxScrollLeft=Math.max(0,f.sizer.offsetLeft+d.adjustWidthTo-Ka(e))),d.updatedDisplay||d.selectionChanged)d.preparedSelection=
f.input.prepareSelection(d.focus);for(b=0;b<a.length;b++)d=a[b],e=d.cm,null!=d.adjustWidthTo&&(e.display.sizer.style.minWidth=d.adjustWidthTo+"px",d.maxScrollLeft<e.doc.scrollLeft&&$a(e,Math.min(e.display.scroller.scrollLeft,d.maxScrollLeft),!0),e.display.maxLineChanged=!1),f=d.focus&&d.focus==ba()&&(!document.hasFocus||document.hasFocus()),d.preparedSelection&&e.display.input.showSelection(d.preparedSelection,f),(d.updatedDisplay||d.startHeight!=e.doc.height)&&ab(e,d.barMeasure),d.updatedDisplay&&
xd(e,d.barMeasure),d.selectionChanged&&qd(e),e.state.focused&&d.updateInput&&e.display.input.reset(d.typing),f&&Ce(d.cm);for(b=0;b<a.length;b++){var h=void 0,k,d=a[b],e=d.cm,f=e.display,g=e.doc;d.updatedDisplay&&Ke(e,d.update);null==f.wheelStartX||null==d.scrollTop&&null==d.scrollLeft&&!d.scrollToPos||(f.wheelStartX=f.wheelStartY=null);null==d.scrollTop||f.scroller.scrollTop==d.scrollTop&&!d.forceScroll||(g.scrollTop=Math.max(0,Math.min(f.scroller.scrollHeight-f.scroller.clientHeight,d.scrollTop)),
f.scrollbars.setScrollTop(g.scrollTop),f.scroller.scrollTop=g.scrollTop);null==d.scrollLeft||f.scroller.scrollLeft==d.scrollLeft&&!d.forceScroll||(g.scrollLeft=Math.max(0,Math.min(f.scroller.scrollWidth-f.scroller.clientWidth,d.scrollLeft)),f.scrollbars.setScrollLeft(g.scrollLeft),f.scroller.scrollLeft=g.scrollLeft,sd(e));if(d.scrollToPos){k=z(g,d.scrollToPos.from);var l=z(g,d.scrollToPos.to),m=d.scrollToPos.margin;null==m&&(m=0);for(var n=0;5>n;n++){var p=!1,h=ta(e,k),t=l&&l!=k?ta(e,l):h,t=pc(e,
Math.min(h.left,t.left),Math.min(h.top,t.top)-m,Math.max(h.left,t.left),Math.max(h.bottom,t.bottom)+m),q=e.doc.scrollTop,u=e.doc.scrollLeft;null!=t.scrollTop&&(Db(e,t.scrollTop),1<Math.abs(e.doc.scrollTop-q)&&(p=!0));null!=t.scrollLeft&&($a(e,t.scrollLeft),1<Math.abs(e.doc.scrollLeft-u)&&(p=!0));if(!p)break}k=h;d.scrollToPos.isCursor&&e.state.focused&&(K(e,"scrollCursorIntoView")||(l=e.display,m=l.sizer.getBoundingClientRect(),h=null,0>k.top+m.top?h=!0:k.bottom+m.top>(window.innerHeight||document.documentElement.clientHeight)&&
(h=!1),null==h||kg||(k=r("div","\u200b",null,"position: absolute;\n                         top: "+(k.top-l.viewOffset-e.display.lineSpace.offsetTop)+"px;\n                         height: "+(k.bottom-k.top+oa(e)+l.barHeight)+"px;\n                         left: "+k.left+"px; width: 2px;"),e.display.lineSpace.appendChild(k),k.scrollIntoView(h),e.display.lineSpace.removeChild(k))))}k=d.maybeHiddenMarkers;h=d.maybeUnhiddenMarkers;if(k)for(l=0;l<k.length;++l)k[l].lines.length||I(k[l],"hide");if(h)for(k=
0;k<h.length;++k)h[k].lines.length&&I(h[k],"unhide");f.wrapper.offsetHeight&&(g.scrollTop=e.display.scroller.scrollTop);d.changeObjs&&I(e,"changes",e,d.changeObjs);d.update&&d.update.finish()}})}function aa(a,b){if(a.curOp)return b();cb(a);try{return b()}finally{db(a)}}function L(a,b){return function(){if(a.curOp)return b.apply(a,arguments);cb(a);try{return b.apply(a,arguments)}finally{db(a)}}}function S(a){return function(){if(this.curOp)return a.apply(this,arguments);cb(this);try{return a.apply(this,
arguments)}finally{db(this)}}}function O(a){return function(){var b=this.cm;if(!b||b.curOp)return a.apply(this,arguments);cb(b);try{return a.apply(this,arguments)}finally{db(b)}}}function R(a,b,c,d){null==b&&(b=a.doc.first);null==c&&(c=a.doc.first+a.doc.size);d||(d=0);var e=a.display;d&&c<e.viewTo&&(null==e.updateLineNumbers||e.updateLineNumbers>b)&&(e.updateLineNumbers=b);a.curOp.viewChanged=!0;if(b>=e.viewTo)xa&&Rc(a.doc,b)<e.viewTo&&ya(a);else if(c<=e.viewFrom)xa&&Xd(a.doc,c+d)>e.viewFrom?ya(a):
(e.viewFrom+=d,e.viewTo+=d);else if(b<=e.viewFrom&&c>=e.viewTo)ya(a);else if(b<=e.viewFrom){var f=tc(a,c,c+d,1);f?(e.view=e.view.slice(f.index),e.viewFrom=f.lineN,e.viewTo+=d):ya(a)}else if(c>=e.viewTo)(f=tc(a,b,b,-1))?(e.view=e.view.slice(0,f.index),e.viewTo=f.lineN):ya(a);else{var f=tc(a,b,b,-1),g=tc(a,c,c+d,1);f&&g?(e.view=e.view.slice(0,f.index).concat(ic(a,f.lineN,g.lineN)).concat(e.view.slice(g.index)),e.viewTo+=d):ya(a)}if(a=e.externalMeasured)c<a.lineN?a.lineN+=d:b<a.lineN+a.size&&(e.externalMeasured=
null)}function za(a,b,c){a.curOp.viewChanged=!0;var d=a.display,e=a.display.externalMeasured;e&&b>=e.lineN&&b<e.lineN+e.size&&(d.externalMeasured=null);b<d.viewFrom||b>=d.viewTo||(a=d.view[La(a,b)],null!=a.node&&(a=a.changes||(a.changes=[]),-1==M(a,c)&&a.push(c)))}function ya(a){a.display.viewFrom=a.display.viewTo=a.doc.first;a.display.view=[];a.display.viewOffset=0}function tc(a,b,c,d){var e=La(a,b),f=a.display.view;if(!xa||c==a.doc.first+a.doc.size)return{index:e,lineN:c};for(var g=a.display.viewFrom,
h=0;h<e;h++)g+=f[h].size;if(g!=b){if(0<d){if(e==f.length-1)return null;b=g+f[e].size-b;e++}else b=g-b;c+=b}for(;Rc(a.doc,c)!=c;){if(e==(0>d?0:f.length-1))return null;c+=d*f[e-(0>d?1:0)].size;e+=d}return{index:e,lineN:c}}function Le(a){a=a.display.view;for(var b=0,c=0;c<a.length;c++){var d=a[c];d.hidden||d.node&&!d.changes||++b}return b}function Eb(a,b){a.doc.mode.startState&&a.doc.frontier<a.display.viewTo&&a.state.highlight.set(b,Jc(lg,a))}function lg(a){var b=a.doc;b.frontier<b.first&&(b.frontier=
b.first);if(!(b.frontier>=a.display.viewTo)){var c=+new Date+a.options.workTime,d=qa(b.mode,ub(a,b.frontier)),e=[];b.iter(b.frontier,Math.min(b.first+b.size,a.display.viewTo+500),function(f){if(b.frontier>=a.display.viewFrom){var g=f.styles,h=f.text.length>a.options.maxHighlightLength,k=ce(a,f,h?qa(b.mode,d):d,!0);f.styles=k.styles;var l=f.styleClasses;(k=k.classes)?f.styleClasses=k:l&&(f.styleClasses=null);l=!g||g.length!=f.styles.length||l!=k&&(!l||!k||l.bgClass!=k.bgClass||l.textClass!=k.textClass);
for(k=0;!l&&k<g.length;++k)l=g[k]!=f.styles[k];l&&e.push(b.frontier);f.stateAfter=h?d:qa(b.mode,d)}else f.text.length<=a.options.maxHighlightLength&&cd(a,f.text,d),f.stateAfter=0==b.frontier%5?qa(b.mode,d):null;++b.frontier;if(+new Date>c)return Eb(a,a.options.workDelay),!0});e.length&&aa(a,function(){for(var b=0;b<e.length;b++)za(a,e[b],"text")})}}function wd(a,b){var c=a.display,d=a.doc;if(b.editorIsHidden)return ya(a),!1;if(!b.force&&b.visible.from>=c.viewFrom&&b.visible.to<=c.viewTo&&(null==c.updateLineNumbers||
c.updateLineNumbers>=c.viewTo)&&c.renderedView==c.view&&0==Le(a))return!1;De(a)&&(ya(a),b.dims=kd(a));var e=d.first+d.size,f=Math.max(b.visible.from-a.options.viewportMargin,d.first),g=Math.min(e,b.visible.to+a.options.viewportMargin);c.viewFrom<f&&20>f-c.viewFrom&&(f=Math.max(d.first,c.viewFrom));c.viewTo>g&&20>c.viewTo-g&&(g=Math.min(e,c.viewTo));xa&&(f=Rc(a.doc,f),g=Xd(a.doc,g));d=f!=c.viewFrom||g!=c.viewTo||c.lastWrapHeight!=b.wrapperHeight||c.lastWrapWidth!=b.wrapperWidth;e=a.display;0==e.view.length||
f>=e.viewTo||g<=e.viewFrom?(e.view=ic(a,f,g),e.viewFrom=f):(e.viewFrom>f?e.view=ic(a,f,e.viewFrom).concat(e.view):e.viewFrom<f&&(e.view=e.view.slice(La(a,f))),e.viewFrom=f,e.viewTo<g?e.view=e.view.concat(ic(a,e.viewTo,g)):e.viewTo>g&&(e.view=e.view.slice(0,La(a,g))));e.viewTo=g;c.viewOffset=la(v(a.doc,c.viewFrom));a.display.mover.style.top=c.viewOffset+"px";g=Le(a);if(!d&&0==g&&!b.force&&c.renderedView==c.view&&(null==c.updateLineNumbers||c.updateLineNumbers>=c.viewTo))return!1;f=ba();4<g&&(c.lineDiv.style.display=
"none");mg(a,c.updateLineNumbers,b.dims);4<g&&(c.lineDiv.style.display="");c.renderedView=c.view;f&&ba()!=f&&f.offsetHeight&&f.focus();H(c.cursorDiv);H(c.selectionDiv);c.gutters.style.height=c.sizer.style.minHeight=0;d&&(c.lastWrapHeight=b.wrapperHeight,c.lastWrapWidth=b.wrapperWidth,Eb(a,400));c.updateLineNumbers=null;return!0}function Ke(a,b){for(var c=b.viewport,d=!0;;d=!1){if(!d||!a.options.lineWrapping||b.oldDisplayWidth==Ka(a))if(c&&null!=c.top&&(c={top:Math.min(a.doc.height+hd(a.display)-id(a),
c.top)}),b.visible=ud(a.display,a.doc,c),b.visible.from>=a.display.viewFrom&&b.visible.to<=a.display.viewTo)break;if(!wd(a,b))break;nc(a);d=Fb(a);Bb(a);ab(a,d);xd(a,d)}b.signal(a,"update",a);if(a.display.viewFrom!=a.display.reportedViewFrom||a.display.viewTo!=a.display.reportedViewTo)b.signal(a,"viewportChange",a,a.display.viewFrom,a.display.viewTo),a.display.reportedViewFrom=a.display.viewFrom,a.display.reportedViewTo=a.display.viewTo}function vd(a,b){b=new sc(a,b);if(wd(a,b)){nc(a);Ke(a,b);var c=
Fb(a);Bb(a);ab(a,c);xd(a,c);b.finish()}}function mg(a,b,c){function d(b){var d=b.nextSibling;N&&ga&&a.display.currentWheelTarget==b?b.style.display="none":b.parentNode.removeChild(b);return d}for(var e=a.display,f=a.options.lineNumbers,g=e.lineDiv,h=g.firstChild,k=e.view,e=e.viewFrom,l=0;l<k.length;l++){var m=k[l];if(!m.hidden)if(m.node&&m.node.parentNode==g){for(;h!=m.node;)h=d(h);h=f&&null!=b&&b<=e&&m.lineNumber;m.changes&&(-1<M(m.changes,"gutter")&&(h=!1),me(a,m,e,c));h&&(H(m.lineNumber),m.lineNumber.appendChild(document.createTextNode(Oc(a.options,
e))));h=m.node.nextSibling}else{var n=eg(a,m,e,c);g.insertBefore(n,h)}e+=m.size}for(;h;)h=d(h)}function td(a){a.display.sizer.style.marginLeft=a.display.gutters.offsetWidth+"px"}function xd(a,b){a.display.sizer.style.minHeight=b.docHeight+"px";a.display.heightForcer.style.top=b.docHeight+"px";a.display.gutters.style.height=b.docHeight+a.display.barHeight+oa(a)+"px"}function Me(a){var b=a.display.gutters,c=a.options.gutters;H(b);for(var d=0;d<c.length;++d){var e=c[d],f=b.appendChild(r("div",null,"CodeMirror-gutter "+
e));"CodeMirror-linenumbers"==e&&(a.display.lineGutter=f,f.style.width=(a.display.lineNumWidth||1)+"px")}b.style.display=d?"":"none";td(a)}function yd(a){var b=M(a.gutters,"CodeMirror-linenumbers");-1==b&&a.lineNumbers?a.gutters=a.gutters.concat(["CodeMirror-linenumbers"]):-1<b&&!a.lineNumbers&&(a.gutters=a.gutters.slice(0),a.gutters.splice(b,1))}function ua(a,b){this.ranges=a;this.primIndex=b}function A(a,b){this.anchor=a;this.head=b}function ia(a,b){b=a[b];a.sort(function(a,b){return u(a.from(),
b.from())});b=M(a,b);for(var c=1;c<a.length;c++){var d=a[c],e=a[c-1];if(0<=u(e.to(),d.from())){var f=ac(e.from(),d.from()),g=$b(e.to(),d.to()),d=e.empty()?d.from()==d.head:e.from()==e.head;c<=b&&--b;a.splice(--c,2,new A(d?g:f,d?f:g))}}return new ua(a,b)}function va(a,b){return new ua([new A(a,b||a)],0)}function Aa(a){return a.text?q(a.from.line+a.text.length-1,x(a.text).length+(1==a.text.length?a.from.ch:0)):a.to}function Ne(a,b){if(0>u(a,b.from))return a;if(0>=u(a,b.to))return Aa(b);var c=a.line+
b.text.length-(b.to.line-b.from.line)-1,d=a.ch;a.line==b.to.line&&(d+=Aa(b).ch-b.to.ch);return q(c,d)}function zd(a,b){for(var c=[],d=0;d<a.sel.ranges.length;d++){var e=a.sel.ranges[d];c.push(new A(Ne(e.anchor,b),Ne(e.head,b)))}return ia(c,a.sel.primIndex)}function Oe(a,b,c){return a.line==b.line?q(c.line,a.ch-b.ch+c.ch):q(c.line+(a.line-b.line),a.ch)}function Ad(a){a.doc.mode=ad(a.options,a.doc.modeOption);Gb(a)}function Gb(a){a.doc.iter(function(a){a.stateAfter&&(a.stateAfter=null);a.styles&&(a.styles=
null)});a.doc.frontier=a.doc.first;Eb(a,100);a.state.modeGen++;a.curOp&&R(a)}function Pe(a,b){return 0==b.from.ch&&0==b.to.ch&&""==x(b.text)&&(!a.cm||a.cm.options.wholeLineUpdateBefore)}function Bd(a,b,c,d){function e(a,c,e){a.text=c;a.stateAfter&&(a.stateAfter=null);a.styles&&(a.styles=null);null!=a.order&&(a.order=null);Td(a);Ud(a,e);c=d?d(a):1;c!=a.height&&ja(a,c);X(a,"change",a,b)}function f(a,b){for(var e=[];a<b;++a)e.push(new Wa(k[a],c?c[a]:null,d));return e}var g=b.from,h=b.to,k=b.text,l=v(a,
g.line),m=v(a,h.line),n=x(k),p=c?c[k.length-1]:null,t=h.line-g.line;b.full?(a.insert(0,f(0,k.length)),a.remove(k.length,a.size-k.length)):Pe(a,b)?(h=f(0,k.length-1),e(m,m.text,p),t&&a.remove(g.line,t),h.length&&a.insert(g.line,h)):l==m?1==k.length?e(l,l.text.slice(0,g.ch)+n+l.text.slice(h.ch),p):(t=f(1,k.length-1),t.push(new Wa(n+l.text.slice(h.ch),p,d)),e(l,l.text.slice(0,g.ch)+k[0],c?c[0]:null),a.insert(g.line+1,t)):1==k.length?(e(l,l.text.slice(0,g.ch)+k[0]+m.text.slice(h.ch),c?c[0]:null),a.remove(g.line+
1,t)):(e(l,l.text.slice(0,g.ch)+k[0],c?c[0]:null),e(m,n+m.text.slice(h.ch),p),p=f(1,k.length-1),1<t&&a.remove(g.line+1,t-1),a.insert(g.line+1,p));X(a,"change",a,b)}function Pa(a,b,c){function d(a,f,g){if(a.linked)for(var e=0;e<a.linked.length;++e){var k=a.linked[e];if(k.doc!=f){var l=g&&k.sharedHist;if(!c||l)b(k.doc,l),d(k.doc,a,l)}}}d(a,null,!0)}function Qe(a,b){if(b.cm)throw Error("This document is already in use.");a.doc=b;b.cm=a;pd(a);Ad(a);a.options.lineWrapping||Tc(a);a.options.mode=b.modeOption;
R(a)}function uc(a){this.done=[];this.undone=[];this.undoDepth=Infinity;this.lastModTime=this.lastSelTime=0;this.lastOrigin=this.lastSelOrigin=this.lastOp=this.lastSelOp=null;this.generation=this.maxGeneration=a||1}function Cd(a,b){var c={from:Pc(b.from),to:Aa(b),text:Fa(a,b.from,b.to)};Re(a,c,b.from.line,b.to.line+1);Pa(a,function(a){return Re(a,c,b.from.line,b.to.line+1)},!0);return c}function Se(a){for(;a.length;)if(x(a).ranges)a.pop();else break}function Te(a,b,c,d){var e=a.history;e.undone.length=
0;var f=+new Date,g,h,k;if(k=e.lastOp==d||e.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&a.cm&&e.lastModTime>f-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0)))e.lastOp==d?(Se(e.done),g=x(e.done)):e.done.length&&!x(e.done).ranges?g=x(e.done):1<e.done.length&&!e.done[e.done.length-2].ranges?(e.done.pop(),g=x(e.done)):g=void 0,k=g;if(k)h=x(g.changes),0==u(b.from,b.to)&&0==u(b.from,h.to)?h.to=Aa(b):g.changes.push(Cd(a,b));else for((g=x(e.done))&&g.ranges||vc(a.sel,e.done),g={changes:[Cd(a,
b)],generation:e.generation},e.done.push(g);e.done.length>e.undoDepth;)e.done.shift(),e.done[0].ranges||e.done.shift();e.done.push(c);e.generation=++e.maxGeneration;e.lastModTime=e.lastSelTime=f;e.lastOp=e.lastSelOp=d;e.lastOrigin=e.lastSelOrigin=b.origin;h||I(a,"historyAdded")}function vc(a,b){var c=x(b);c&&c.ranges&&c.equals(a)||b.push(a)}function Re(a,b,c,d){var e=b["spans_"+a.id],f=0;a.iter(Math.max(a.first,c),Math.min(a.first+a.size,d),function(d){d.markedSpans&&((e||(e=b["spans_"+a.id]={}))[f]=
d.markedSpans);++f})}function ng(a){if(!a)return null;for(var b,c=0;c<a.length;++c)a[c].marker.explicitlyCleared?b||(b=a.slice(0,c)):b&&b.push(a[c]);return b?b.length?b:null:a}function Ue(a,b){var c;if(c=b["spans_"+a.id]){for(var d=[],e=0;e<b.text.length;++e)d.push(ng(c[e]));c=d}else c=null;a=Qc(a,b);if(!c)return a;if(!a)return c;for(b=0;b<c.length;++b)if(d=c[b],e=a[b],d&&e){var f=0;a:for(;f<e.length;++f){for(var g=e[f],h=0;h<d.length;++h)if(d[h].marker==g.marker)continue a;d.push(g)}}else e&&(c[b]=
e);return c}function eb(a,b,c){for(var d=[],e=0;e<a.length;++e){var f=a[e];if(f.ranges)d.push(c?ua.prototype.deepCopy.call(f):f);else{var f=f.changes,g=[];d.push({changes:g});for(var h=0;h<f.length;++h){var k=f[h],l;g.push({from:k.from,to:k.to,text:k.text});if(b)for(var m in k)(l=m.match(/^spans_(\d+)$/))&&-1<M(b,Number(l[1]))&&(x(g)[m]=k[m],delete k[m])}}}return d}function Hb(a,b,c,d){return a.cm&&a.cm.display.shift||a.extend?(a=b.anchor,d&&(b=0>u(c,a),b!=0>u(d,a)?(a=c,c=d):b!=0>u(c,d)&&(c=d)),new A(a,
c)):new A(d||c,c)}function wc(a,b,c,d){P(a,new ua([Hb(a,a.sel.primary(),b,c)],0),d)}function Ve(a,b,c){for(var d=[],e=0;e<a.sel.ranges.length;e++)d[e]=Hb(a,a.sel.ranges[e],b[e],null);b=ia(d,a.sel.primIndex);P(a,b,c)}function Dd(a,b,c,d){var e=a.sel.ranges.slice(0);e[b]=c;P(a,ia(e,a.sel.primIndex),d)}function og(a,b,c){c={ranges:b.ranges,update:function(b){this.ranges=[];for(var d=0;d<b.length;d++)this.ranges[d]=new A(z(a,b[d].anchor),z(a,b[d].head))},origin:c&&c.origin};I(a,"beforeSelectionChange",
a,c);a.cm&&I(a.cm,"beforeSelectionChange",a.cm,c);return c.ranges!=b.ranges?ia(c.ranges,c.ranges.length-1):b}function We(a,b,c){var d=a.history.done,e=x(d);e&&e.ranges?(d[d.length-1]=b,xc(a,b,c)):P(a,b,c)}function P(a,b,c){xc(a,b,c);b=a.sel;var d=a.cm?a.cm.curOp.id:NaN,e=a.history,f=c&&c.origin,g;if(!(g=d==e.lastSelOp)&&(g=f&&e.lastSelOrigin==f)&&!(g=e.lastModTime==e.lastSelTime&&e.lastOrigin==f)){g=x(e.done);var h=f.charAt(0);g="*"==h||"+"==h&&g.ranges.length==b.ranges.length&&g.somethingSelected()==
b.somethingSelected()&&new Date-a.history.lastSelTime<=(a.cm?a.cm.options.historyEventDelay:500)}g?e.done[e.done.length-1]=b:vc(b,e.done);e.lastSelTime=+new Date;e.lastSelOrigin=f;e.lastSelOp=d;c&&!1!==c.clearRedo&&Se(e.undone)}function xc(a,b,c){if(da(a,"beforeSelectionChange")||a.cm&&da(a.cm,"beforeSelectionChange"))b=og(a,b,c);var d=c&&c.bias||(0>u(b.primary().head,a.sel.primary().head)?-1:1);Xe(a,Ye(a,b,d,!0));c&&!1===c.scroll||!a.cm||bb(a.cm)}function Xe(a,b){b.equals(a.sel)||(a.sel=b,a.cm&&
(a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=!0,Zd(a.cm)),X(a,"cursorActivity",a))}function Ze(a){Xe(a,Ye(a,a.sel,null,!1),pa)}function Ye(a,b,c,d){for(var e,f=0;f<b.ranges.length;f++){var g=b.ranges[f],h=b.ranges.length==a.sel.ranges.length&&a.sel.ranges[f],k=Ed(a,g.anchor,h&&h.anchor,c,d),h=Ed(a,g.head,h&&h.head,c,d);if(e||k!=g.anchor||h!=g.head)e||(e=b.ranges.slice(0,f)),e[f]=new A(k,h)}return e?ia(e,b.primIndex):b}function fb(a,b,c,d,e){var f=v(a,b.line);if(f.markedSpans)for(var g=0;g<
f.markedSpans.length;++g){var h=f.markedSpans[g],k=h.marker;if((null==h.from||(k.inclusiveLeft?h.from<=b.ch:h.from<b.ch))&&(null==h.to||(k.inclusiveRight?h.to>=b.ch:h.to>b.ch))){if(e&&(I(k,"beforeCursorEnter"),k.explicitlyCleared))if(f.markedSpans){--g;continue}else break;if(k.atomic){if(c){g=k.find(0>d?1:-1);h=void 0;if(0>d?k.inclusiveRight:k.inclusiveLeft)g=$e(a,g,-d,g&&g.line==b.line?f:null);if(g&&g.line==b.line&&(h=u(g,c))&&(0>d?0>h:0<h))return fb(a,g,b,d,e)}c=k.find(0>d?-1:1);if(0>d?k.inclusiveLeft:
k.inclusiveRight)c=$e(a,c,d,c.line==b.line?f:null);return c?fb(a,c,b,d,e):null}}}return b}function Ed(a,b,c,d,e){d=d||1;b=fb(a,b,c,d,e)||!e&&fb(a,b,c,d,!0)||fb(a,b,c,-d,e)||!e&&fb(a,b,c,-d,!0);return b?b:(a.cantEdit=!0,q(a.first,0))}function $e(a,b,c,d){return 0>c&&0==b.ch?b.line>a.first?z(a,q(b.line-1)):null:0<c&&b.ch==(d||v(a,b.line)).text.length?b.line<a.first+a.size-1?q(b.line+1,0):null:new q(b.line,b.ch+c)}function af(a){a.setSelection(q(a.firstLine(),0),q(a.lastLine()),pa)}function bf(a,b,c){var d=
{canceled:!1,from:b.from,to:b.to,text:b.text,origin:b.origin,cancel:function(){return d.canceled=!0}};c&&(d.update=function(b,c,g,h){b&&(d.from=z(a,b));c&&(d.to=z(a,c));g&&(d.text=g);void 0!==h&&(d.origin=h)});I(a,"beforeChange",a,d);a.cm&&I(a.cm,"beforeChange",a.cm,d);return d.canceled?null:{from:d.from,to:d.to,text:d.text,origin:d.origin}}function gb(a,b,c){if(a.cm){if(!a.cm.curOp)return L(a.cm,gb)(a,b,c);if(a.cm.state.suppressEdits)return}if(da(a,"beforeChange")||a.cm&&da(a.cm,"beforeChange"))if(b=
bf(a,b,!0),!b)return;if(c=cf&&!c&&Rf(a,b.from,b.to))for(var d=c.length-1;0<=d;--d)df(a,{from:c[d].from,to:c[d].to,text:d?[""]:b.text});else df(a,b)}function df(a,b){if(1!=b.text.length||""!=b.text[0]||0!=u(b.from,b.to)){var c=zd(a,b);Te(a,b,c,a.cm?a.cm.curOp.id:NaN);Ib(a,b,c,Qc(a,b));var d=[];Pa(a,function(a,c){c||-1!=M(d,a.history)||(ef(a.history,b),d.push(a.history));Ib(a,b,null,Qc(a,b))})}}function yc(a,b,c){if(!a.cm||!a.cm.state.suppressEdits||c){for(var d=a.history,e,f=a.sel,g="undo"==b?d.done:
d.undone,h="undo"==b?d.undone:d.done,k=0;k<g.length&&(e=g[k],c?!e.ranges||e.equals(a.sel):e.ranges);k++);if(k!=g.length){for(d.lastOrigin=d.lastSelOrigin=null;;)if(e=g.pop(),e.ranges){vc(e,h);if(c&&!e.equals(a.sel)){P(a,e,{clearRedo:!1});return}f=e}else break;var l=[];vc(f,h);h.push({changes:l,generation:d.generation});d.generation=e.generation||++d.maxGeneration;var m=da(a,"beforeChange")||a.cm&&da(a.cm,"beforeChange");c=function(d){var c=e.changes[d];c.origin=b;if(m&&!bf(a,c,!1))return g.length=
0,{};l.push(Cd(a,c));var f=d?zd(a,c):x(g);Ib(a,c,f,Ue(a,c));!d&&a.cm&&a.cm.scrollIntoView({from:c.from,to:Aa(c)});var h=[];Pa(a,function(a,b){b||-1!=M(h,a.history)||(ef(a.history,c),h.push(a.history));Ib(a,c,null,Ue(a,c))})};for(d=e.changes.length-1;0<=d;--d)if(f=c(d))return f.v}}}function ff(a,b){if(0!=b&&(a.first+=b,a.sel=new ua(Yb(a.sel.ranges,function(a){return new A(q(a.anchor.line+b,a.anchor.ch),q(a.head.line+b,a.head.ch))}),a.sel.primIndex),a.cm)){R(a.cm,a.first,a.first-b,b);for(var c=a.cm.display,
d=c.viewFrom;d<c.viewTo;d++)za(a.cm,d,"gutter")}}function Ib(a,b,c,d){if(a.cm&&!a.cm.curOp)return L(a.cm,Ib)(a,b,c,d);if(b.to.line<a.first)ff(a,b.text.length-1-(b.to.line-b.from.line));else if(!(b.from.line>a.lastLine())){if(b.from.line<a.first){var e=b.text.length-1-(a.first-b.from.line);ff(a,e);b={from:q(a.first,0),to:q(b.to.line+e,b.to.ch),text:[x(b.text)],origin:b.origin}}e=a.lastLine();b.to.line>e&&(b={from:b.from,to:q(e,v(a,e).text.length),text:[b.text[0]],origin:b.origin});b.removed=Fa(a,b.from,
b.to);c||(c=zd(a,b));a.cm?pg(a.cm,b,d):Bd(a,b,d);xc(a,c,pa)}}function pg(a,b,c){var d=a.doc,e=a.display,f=b.from,g=b.to,h=!1,k=f.line;a.options.lineWrapping||(k=C(ka(v(d,f.line))),d.iter(k,g.line+1,function(a){if(a==e.maxLine)return h=!0}));-1<d.sel.contains(b.from,b.to)&&Zd(a);Bd(d,b,c,ze(a));a.options.lineWrapping||(d.iter(k,f.line+b.text.length,function(a){var b=cc(a);b>e.maxLineLength&&(e.maxLine=a,e.maxLineLength=b,e.maxLineChanged=!0,h=!1)}),h&&(a.curOp.updateMaxLine=!0));d.frontier=Math.min(d.frontier,
f.line);Eb(a,400);c=b.text.length-(g.line-f.line)-1;b.full?R(a):f.line!=g.line||1!=b.text.length||Pe(a.doc,b)?R(a,f.line,g.line+1,c):za(a,f.line,"text");c=da(a,"changes");if((d=da(a,"change"))||c)b={from:f,to:g,text:b.text,removed:b.removed,origin:b.origin},d&&X(a,"change",a,b),c&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(b);a.display.selForContextMenu=null}function hb(a,b,c,d,e){d||(d=c);if(0>u(d,c)){var f=d;d=c;c=f}"string"==typeof b&&(b=a.splitLines(b));gb(a,{from:c,to:d,text:b,origin:e})}
function gf(a,b,c,d){c<a.line?a.line+=d:b<a.line&&(a.line=b,a.ch=0)}function hf(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e],g=!0;if(f.ranges)for(f.copied||(f=a[e]=f.deepCopy(),f.copied=!0),g=0;g<f.ranges.length;g++)gf(f.ranges[g].anchor,b,c,d),gf(f.ranges[g].head,b,c,d);else{for(var h=0;h<f.changes.length;++h){var k=f.changes[h];if(c<k.from.line)k.from=q(k.from.line+d,k.from.ch),k.to=q(k.to.line+d,k.to.ch);else if(b<=k.to.line){g=!1;break}}g||(a.splice(0,e+1),e=0)}}}function ef(a,b){var c=b.from.line,
d=b.to.line;b=b.text.length-(d-c)-1;hf(a.done,c,d,b);hf(a.undone,c,d,b)}function Jb(a,b,c,d){var e=b,f=b;"number"==typeof b?f=v(a,Math.max(a.first,Math.min(b,a.first+a.size-1))):e=C(b);if(null==e)return null;d(f,e)&&a.cm&&za(a.cm,e,c);return f}function Kb(a){this.lines=a;this.parent=null;for(var b=0,c=0;c<a.length;++c)a[c].parent=this,b+=a[c].height;this.height=b}function Lb(a){this.children=a;for(var b=0,c=0,d=0;d<a.length;++d){var e=a[d],b=b+e.chunkSize(),c=c+e.height;e.parent=this}this.size=b;
this.height=c;this.parent=null}function Mb(a,b,c){if(c)for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d]);this.doc=a;this.node=b}function qg(a,b,c,d){var e=new Mb(a,c,d),f=a.cm;f&&e.noHScroll&&(f.display.alignWidgets=!0);Jb(a,b,"widget",function(b){var d=b.widgets||(b.widgets=[]);null==e.insertAt?d.push(e):d.splice(Math.min(d.length-1,Math.max(0,e.insertAt)),0,e);e.line=b;f&&!Ia(a,b)&&(d=la(b)<a.scrollTop,ja(b,b.height+yb(e)),d&&qc(f,null,e.height),f.curOp.forceUpdate=!0);return!0});return e}function Ba(a,
b){this.lines=[];this.type=b;this.doc=a;this.id=++jf}function ib(a,b,c,d,e){if(d&&d.shared)return rg(a,b,c,d,e);if(a.cm&&!a.cm.curOp)return L(a.cm,ib)(a,b,c,d,e);var f=new Ba(a,e);e=u(b,c);d&&Da(d,f,!1);if(0<e||0==e&&!1!==f.clearWhenEmpty)return f;f.replacedWith&&(f.collapsed=!0,f.widgetNode=r("span",[f.replacedWith],"CodeMirror-widget"),d.handleMouseEvents||f.widgetNode.setAttribute("cm-ignore-events","true"),d.insertLeft&&(f.widgetNode.insertLeft=!0));if(f.collapsed){if(Wd(a,b.line,b,c,f)||b.line!=
c.line&&Wd(a,c.line,b,c,f))throw Error("Inserting collapsed marker partially overlapping an existing one");xa=!0}f.addToHistory&&Te(a,{from:b,to:c,origin:"markText"},a.sel,NaN);var g=b.line,h=a.cm,k;a.iter(g,c.line+1,function(a){h&&f.collapsed&&!h.options.lineWrapping&&ka(a)==h.display.maxLine&&(k=!0);f.collapsed&&g!=b.line&&ja(a,0);var d=new bc(f,g==b.line?b.ch:null,g==c.line?c.ch:null);a.markedSpans=a.markedSpans?a.markedSpans.concat([d]):[d];d.marker.attachLine(a);++g});f.collapsed&&a.iter(b.line,
c.line+1,function(b){Ia(a,b)&&ja(b,0)});f.clearOnEnter&&w(f,"beforeCursorEnter",function(){return f.clear()});f.readOnly&&(cf=!0,(a.history.done.length||a.history.undone.length)&&a.clearHistory());f.collapsed&&(f.id=++jf,f.atomic=!0);if(h){k&&(h.curOp.updateMaxLine=!0);if(f.collapsed)R(h,b.line,c.line+1);else if(f.className||f.title||f.startStyle||f.endStyle||f.css)for(d=b.line;d<=c.line;d++)za(h,d,"text");f.atomic&&Ze(h.doc);X(h,"markerAdded",h,f)}return f}function Nb(a,b){this.markers=a;this.primary=
b;for(b=0;b<a.length;++b)a[b].parent=this}function rg(a,b,c,d,e){d=Da(d);d.shared=!1;var f=[ib(a,b,c,d,e)],g=f[0],h=d.widgetNode;Pa(a,function(a){h&&(d.widgetNode=h.cloneNode(!0));f.push(ib(a,z(a,b),z(a,c),d,e));for(var k=0;k<a.linked.length;++k)if(a.linked[k].isParent)return;g=x(f)});return new Nb(f,g)}function kf(a){return a.findMarks(q(a.first,0),a.clipPos(q(a.lastLine())),function(a){return a.parent})}function sg(a){for(var b=function(b){b=a[b];var d=[b.primary.doc];Pa(b.primary.doc,function(a){return d.push(a)});
for(var c=0;c<b.markers.length;c++){var g=b.markers[c];-1==M(d,g.doc)&&(g.parent=null,b.markers.splice(c--,1))}},c=0;c<a.length;c++)b(c)}function tg(a){var b=this;lf(b);if(!K(b,a)&&!sa(b.display,a)){Q(a);B&&(mf=+new Date);var c=Oa(b,a,!0),d=a.dataTransfer.files;if(c&&!b.isReadOnly())if(d&&d.length&&window.FileReader&&window.File)for(var e=d.length,f=Array(e),g=0,h=function(a,d){if(!b.options.allowDropFileTypes||-1!=M(b.options.allowDropFileTypes,a.type)){var h=new FileReader;h.onload=L(b,function(){var a=
h.result;/[\x00-\x08\x0e-\x1f]{2}/.test(a)&&(a="");f[d]=a;++g==e&&(c=z(b.doc,c),a={from:c,to:c,text:b.doc.splitLines(f.join(b.doc.lineSeparator())),origin:"paste"},gb(b.doc,a),We(b.doc,va(c,Aa(a))))});h.readAsText(a)}},k=0;k<e;++k)h(d[k],k);else if(b.state.draggingText&&-1<b.doc.sel.contains(c))b.state.draggingText(a),setTimeout(function(){return b.display.input.focus()},20);else try{if(h=a.dataTransfer.getData("Text")){b.state.draggingText&&!b.state.draggingText.copy&&(k=b.listSelections());xc(b.doc,
va(c,c));if(k)for(d=0;d<k.length;++d)hb(b.doc,"",k[d].anchor,k[d].head,"drag");b.replaceSelection(h,"around","paste");b.display.input.focus()}}catch(l){}}}function lf(a){a.display.dragCursor&&(a.display.lineSpace.removeChild(a.display.dragCursor),a.display.dragCursor=null)}function nf(a){if(document.body.getElementsByClassName)for(var b=document.body.getElementsByClassName("CodeMirror"),c=0;c<b.length;c++){var d=b[c].CodeMirror;d&&a(d)}}function ug(){var a;w(window,"resize",function(){null==a&&(a=
setTimeout(function(){a=null;nf(vg)},100))});w(window,"blur",function(){return nf(Cb)})}function vg(a){var b=a.display;if(b.lastWrapHeight!=b.wrapper.clientHeight||b.lastWrapWidth!=b.wrapper.clientWidth)b.cachedCharWidth=b.cachedTextHeight=b.cachedPaddingH=null,b.scrollbarsClipped=!1,a.setSize()}function wg(a){var b=a.split(/-(?!$)/);a=b[b.length-1];for(var c,d,e,f,g=0;g<b.length-1;g++){var h=b[g];if(/^(cmd|meta|m)$/i.test(h))f=!0;else if(/^a(lt)?$/i.test(h))c=!0;else if(/^(c|ctrl|control)$/i.test(h))d=
!0;else if(/^s(hift)?$/i.test(h))e=!0;else throw Error("Unrecognized modifier name: "+h);}c&&(a="Alt-"+a);d&&(a="Ctrl-"+a);f&&(a="Cmd-"+a);e&&(a="Shift-"+a);return a}function xg(a){var b={},c;for(c in a)if(a.hasOwnProperty(c)){var d=a[c];if(!/^(name|fallthrough|(de|at)tach)$/.test(c)){if("..."!=d)for(var e=Yb(c.split(" "),wg),f=0;f<e.length;f++){var g,h;f==e.length-1?(h=e.join(" "),g=d):(h=e.slice(0,f+1).join(" "),g="...");var k=b[h];if(!k)b[h]=g;else if(k!=g)throw Error("Inconsistent bindings for "+
h);}delete a[c]}}for(var l in b)a[l]=b[l];return a}function jb(a,b,c,d){b=zc(b);var e=b.call?b.call(a,d):b[a];if(!1===e)return"nothing";if("..."===e)return"multi";if(null!=e&&c(e))return"handled";if(b.fallthrough){if("[object Array]"!=Object.prototype.toString.call(b.fallthrough))return jb(a,b.fallthrough,c,d);for(e=0;e<b.fallthrough.length;e++){var f=jb(a,b.fallthrough[e],c,d);if(f)return f}}}function of(a){a="string"==typeof a?a:Ca[a.keyCode];return"Ctrl"==a||"Alt"==a||"Shift"==a||"Mod"==a}function pf(a,
b){if(ha&&34==a.keyCode&&a["char"])return!1;var c=Ca[a.keyCode],d=c;if(null==d||a.altGraphKey)return!1;a.altKey&&"Alt"!=c&&(d="Alt-"+d);(qf?a.metaKey:a.ctrlKey)&&"Ctrl"!=c&&(d="Ctrl-"+d);(qf?a.ctrlKey:a.metaKey)&&"Cmd"!=c&&(d="Cmd-"+d);!b&&a.shiftKey&&"Shift"!=c&&(d="Shift-"+d);return d}function zc(a){return"string"==typeof a?Ob[a]:a}function kb(a,b){for(var c=a.doc.sel.ranges,d=[],e=0;e<c.length;e++){for(var f=b(c[e]);d.length&&0>=u(f.from,x(d).to);){var g=d.pop();if(0>u(g.from,f.from)){f.from=g.from;
break}}d.push(f)}aa(a,function(){for(var b=d.length-1;0<=b;b--)hb(a.doc,"",d[b].from,d[b].to,"+delete");bb(a)})}function rf(a,b){var c=v(a.doc,b);a=ka(c);a!=c&&(b=C(a));a=(c=ea(a))?c[0].level%2?ec(a):dc(a):0;return q(b,a)}function sf(a,b){var c=rf(a,b.line);a=v(a.doc,c.line);var d=ea(a);return d&&0!=d[0].level?c:(a=Math.max(0,a.text.search(/\S/)),q(c.line,b.line==c.line&&b.ch<=a&&b.ch?0:a))}function Ac(a,b,c){if("string"==typeof b&&(b=Bc[b],!b))return!1;a.display.input.ensurePolled();var d=a.display.shift,
e=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),c&&(a.display.shift=!1),e=b(a)!=Fd}finally{a.display.shift=d,a.state.suppressEdits=!1}return e}function yg(a,b,c){for(var d=0;d<a.state.keyMaps.length;d++){var e=jb(b,a.state.keyMaps[d],c,a);if(e)return e}return a.options.extraKeys&&jb(b,a.options.extraKeys,c,a)||jb(b,a.options.keyMap,c,a)}function Cc(a,b,c,d){var e=a.state.keySeq;if(e){if(of(b))return"handled";zg.set(50,function(){a.state.keySeq==e&&(a.state.keySeq=null,a.display.input.reset())});
b=e+" "+b}d=yg(a,b,d);"multi"==d&&(a.state.keySeq=b);"handled"==d&&X(a,"keyHandled",a,b,c);if("handled"==d||"multi"==d)Q(c),qd(a);return e&&!d&&/\'$/.test(b)?(Q(c),!0):!!d}function tf(a,b){var c=pf(b,!0);return c?b.shiftKey&&!a.state.keySeq?Cc(a,"Shift-"+c,b,function(b){return Ac(a,b,!0)})||Cc(a,c,b,function(b){if("string"==typeof b?/^go[A-Z]/.test(b):b.motion)return Ac(a,b)}):Cc(a,c,b,function(b){return Ac(a,b)}):!1}function Ag(a,b,c){return Cc(a,"'"+c+"'",b,function(b){return Ac(a,b,!0)})}function uf(a){this.curOp.focus=
ba();if(!K(this,a)){B&&11>F&&27==a.keyCode&&(a.returnValue=!1);var b=a.keyCode;this.display.shift=16==b||a.shiftKey;var c=tf(this,a);ha&&(Gd=c?b:null,!c&&88==b&&!vf&&(ga?a.metaKey:a.ctrlKey)&&this.replaceSelection("",null,"cut"));18!=b||/\bCodeMirror-crosshair\b/.test(this.display.lineDiv.className)||Bg(this)}}function Bg(a){function b(a){18!=a.keyCode&&a.altKey||(Za(c,"CodeMirror-crosshair"),fa(document,"keyup",b),fa(document,"mouseover",b))}var c=a.display.lineDiv;Sa(c,"CodeMirror-crosshair");w(document,
"keyup",b);w(document,"mouseover",b)}function wf(a){16==a.keyCode&&(this.doc.sel.shift=!1);K(this,a)}function xf(a){if(!(sa(this.display,a)||K(this,a)||a.ctrlKey&&!a.altKey||ga&&a.metaKey)){var b=a.keyCode,c=a.charCode;if(ha&&b==Gd)Gd=null,Q(a);else if(!ha||a.which&&!(10>a.which)||!tf(this,a))if(b=String.fromCharCode(null==c?b:c),"\b"!=b&&!Ag(this,a,b))this.display.input.onKeyPress(a)}}function Cg(a){var b=this.display;if(!(K(this,a)||b.activeTouch&&b.input.supportsTouch()))if(b.input.ensurePolled(),
b.shift=a.shiftKey,sa(b,a))N||(b.scroller.draggable=!1,setTimeout(function(){return b.scroller.draggable=!0},100));else if(!Hd(this,a,"gutterClick",!0)){var c=Oa(this,a);window.focus();switch(ae(a)){case 1:this.state.selectingText?this.state.selectingText(a):c?Dg(this,a,c):(a.target||a.srcElement)==b.scroller&&Q(a);break;case 2:N&&(this.state.lastMiddleDown=+new Date);c&&wc(this.doc,c);setTimeout(function(){return b.input.focus()},20);Q(a);break;case 3:Id?yf(this,a):hg(this)}}}function Dg(a,b,c){B?
setTimeout(Jc(Ce,a),0):a.curOp.focus=ba();var d=+new Date,e;Dc&&Dc.time>d-400&&0==u(Dc.pos,c)?e="triple":Ec&&Ec.time>d-400&&0==u(Ec.pos,c)?(e="double",Dc={time:d,pos:c}):(e="single",Ec={time:d,pos:c});var d=a.doc.sel,f=ga?b.metaKey:b.ctrlKey,g;a.options.dragDrop&&Eg&&!a.isReadOnly()&&"single"==e&&-1<(g=d.contains(c))&&(0>u((g=d.ranges[g]).from(),c)||0<c.xRel)&&(0<u(g.to(),c)||0>c.xRel)?Fg(a,b,c,f):Gg(a,b,c,e,f)}function Fg(a,b,c,d){var e=a.display,f=+new Date,g=L(a,function(h){N&&(e.scroller.draggable=
!1);a.state.draggingText=!1;fa(document,"mouseup",g);fa(e.scroller,"drop",g);10>Math.abs(b.clientX-h.clientX)+Math.abs(b.clientY-h.clientY)&&(Q(h),!d&&+new Date-200<f&&wc(a.doc,c),N||B&&9==F?setTimeout(function(){document.body.focus();e.input.focus()},20):e.input.focus())});N&&(e.scroller.draggable=!0);a.state.draggingText=g;g.copy=ga?b.altKey:b.ctrlKey;e.scroller.dragDrop&&e.scroller.dragDrop();w(document,"mouseup",g);w(e.scroller,"drop",g)}function Gg(a,b,c,d,e){function f(b){if(0!=u(x,b))if(x=
b,"rect"==d){for(var e=[],f=a.options.tabSize,g=ca(v(l,c.line).text,c.ch,f),h=ca(v(l,b.line).text,b.ch,f),k=Math.min(g,h),g=Math.max(g,h),h=Math.min(c.line,b.line),t=Math.min(a.lastLine(),Math.max(c.line,b.line));h<=t;h++){var r=v(l,h).text,w=Kc(r,k,f);k==g?e.push(new A(q(h,w),q(h,w))):r.length>w&&e.push(new A(q(h,w),q(h,Kc(r,g,f))))}e.length||e.push(new A(c,c));P(l,ia(p.ranges.slice(0,n).concat(e),n),{origin:"*mouse",scroll:!1});a.scrollIntoView(b)}else k=m,e=k.anchor,f=b,"single"!=d&&(b="double"==
d?a.findWordAt(b):new A(q(b.line,0),z(l,q(b.line+1,0))),0<u(b.anchor,e)?(f=b.head,e=ac(k.from(),b.anchor)):(f=b.anchor,e=$b(k.to(),b.head))),b=p.ranges.slice(0),b[n]=new A(z(l,e),f),P(l,ia(b,n),Jd)}function g(b){var c=++B,e=Oa(a,b,!0,"rect"==d);if(e)if(0!=u(e,x)){a.curOp.focus=ba();f(e);var h=ud(k,l);(e.line>=h.to||e.line<h.from)&&setTimeout(L(a,function(){B==c&&g(b)}),150)}else{var m=b.clientY<y.top?-20:b.clientY>y.bottom?20:0;m&&setTimeout(L(a,function(){B==c&&(k.scroller.scrollTop+=m,g(b))}),50)}}
function h(b){a.state.selectingText=!1;B=Infinity;Q(b);k.input.focus();fa(document,"mousemove",D);fa(document,"mouseup",C);l.history.lastSelOrigin=null}var k=a.display,l=a.doc;Q(b);var m,n,p=l.sel,t=p.ranges;e&&!b.shiftKey?(n=l.sel.contains(c),m=-1<n?t[n]:new A(c,c)):(m=l.sel.primary(),n=l.sel.primIndex);if(Hg?b.shiftKey&&b.metaKey:b.altKey)d="rect",e||(m=new A(c,c)),c=Oa(a,b,!0,!0),n=-1;else if("double"==d){var r=a.findWordAt(c);m=a.display.shift||l.extend?Hb(l,m,r.anchor,r.head):r}else"triple"==
d?(r=new A(q(c.line,0),z(l,q(c.line+1,0))),m=a.display.shift||l.extend?Hb(l,m,r.anchor,r.head):r):m=Hb(l,m,c);e?-1==n?(n=t.length,P(l,ia(t.concat([m]),n),{scroll:!1,origin:"*mouse"})):1<t.length&&t[n].empty()&&"single"==d&&!b.shiftKey?(P(l,ia(t.slice(0,n).concat(t.slice(n+1)),0),{scroll:!1,origin:"*mouse"}),p=l.sel):Dd(l,n,m,Jd):(n=0,P(l,new ua([m],0),Jd),p=l.sel);var x=c,y=k.wrapper.getBoundingClientRect(),B=0,D=L(a,function(a){ae(a)?g(a):h(a)}),C=L(a,h);a.state.selectingText=C;w(document,"mousemove",
D);w(document,"mouseup",C)}function Hd(a,b,c,d){var e,f;try{e=b.clientX,f=b.clientY}catch(k){return!1}if(e>=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;d&&Q(b);d=a.display;var g=d.lineDiv.getBoundingClientRect();if(f>g.bottom||!da(a,c))return Yc(b);f-=g.top-d.viewOffset;for(g=0;g<a.options.gutters.length;++g){var h=d.gutters.childNodes[g];if(h&&h.getBoundingClientRect().right>=e)return e=Ga(a.doc,f),I(a,c,a,e,a.options.gutters[g],b),Yc(b)}}function yf(a,b){var c;(c=sa(a.display,
b))||(c=da(a,"gutterContextMenu")?Hd(a,b,"gutterContextMenu",!1):!1);if(!c&&!K(a,b,"contextmenu"))a.display.input.onContextMenu(b)}function zf(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-");Ab(a)}function Pb(a){Me(a);R(a);sd(a)}function Ig(a,b,c){!b!=!(c&&c!=lb)&&(c=a.display.dragFunctions,b=b?w:fa,b(a.display.scroller,"dragstart",c.start),b(a.display.scroller,"dragenter",c.enter),b(a.display.scroller,"dragover",
c.over),b(a.display.scroller,"dragleave",c.leave),b(a.display.scroller,"drop",c.drop))}function Jg(a){a.options.lineWrapping?(Sa(a.display.wrapper,"CodeMirror-wrap"),a.display.sizer.style.minWidth="",a.display.sizerWidth=null):(Za(a.display.wrapper,"CodeMirror-wrap"),Tc(a));pd(a);R(a);Ab(a);setTimeout(function(){return ab(a)},100)}function G(a,b){var c=this;if(!(this instanceof G))return new G(a,b);this.options=b=b?Da(b):{};Da(Af,b,!1);yd(b);var d=b.value;"string"==typeof d&&(d=new T(d,b.mode,null,
b.lineSeparator));this.doc=d;var e=new G.inputStyles[b.inputStyle](this);a=this.display=new Qf(a,d,e);a.wrapper.CodeMirror=this;Me(this);zf(this);b.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");Ie(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new Ea,keySeq:null,specialChars:null};b.autofocus&&!pb&&a.input.focus();B&&11>F&&setTimeout(function(){return c.display.input.reset(!0)},
20);Kg(this);Bf||(ug(),Bf=!0);cb(this);this.curOp.forceUpdate=!0;Qe(this,d);b.autofocus&&!pb||this.hasFocus()?setTimeout(Jc(rd,this),20):Cb(this);for(var f in Fc)if(Fc.hasOwnProperty(f))Fc[f](c,b[f],lb);De(this);b.finishInit&&b.finishInit(this);for(d=0;d<Kd.length;++d)Kd[d](c);db(this);N&&b.lineWrapping&&"optimizelegibility"==getComputedStyle(a.lineDiv).textRendering&&(a.lineDiv.style.textRendering="auto")}function Kg(a){function b(){d.activeTouch&&(e=setTimeout(function(){return d.activeTouch=null},
1E3),f=d.activeTouch,f.end=+new Date)}function c(a,b){if(null==b.left)return!0;var d=b.left-a.left;a=b.top-a.top;return 400<d*d+a*a}var d=a.display;w(d.scroller,"mousedown",L(a,Cg));B&&11>F?w(d.scroller,"dblclick",L(a,function(b){if(!K(a,b)){var d=Oa(a,b);!d||Hd(a,b,"gutterClick",!0)||sa(a.display,b)||(Q(b),b=a.findWordAt(d),wc(a.doc,b.anchor,b.head))}})):w(d.scroller,"dblclick",function(b){return K(a,b)||Q(b)});Id||w(d.scroller,"contextmenu",function(b){return yf(a,b)});var e,f={end:0};w(d.scroller,
"touchstart",function(b){var c;if(c=!K(a,b))1!=b.touches.length?c=!1:(c=b.touches[0],c=1>=c.radiusX&&1>=c.radiusY),c=!c;c&&(d.input.ensurePolled(),clearTimeout(e),c=+new Date,d.activeTouch={start:c,moved:!1,prev:300>=c-f.end?f:null},1==b.touches.length&&(d.activeTouch.left=b.touches[0].pageX,d.activeTouch.top=b.touches[0].pageY))});w(d.scroller,"touchmove",function(){d.activeTouch&&(d.activeTouch.moved=!0)});w(d.scroller,"touchend",function(e){var f=d.activeTouch;if(f&&!sa(d,e)&&null!=f.left&&!f.moved&&
300>new Date-f.start){var g=a.coordsChar(d.activeTouch,"page"),f=!f.prev||c(f,f.prev)?new A(g,g):!f.prev.prev||c(f,f.prev.prev)?a.findWordAt(g):new A(q(g.line,0),z(a.doc,q(g.line+1,0)));a.setSelection(f.anchor,f.head);a.focus();Q(e)}b()});w(d.scroller,"touchcancel",b);w(d.scroller,"scroll",function(){d.scroller.clientHeight&&(Db(a,d.scroller.scrollTop),$a(a,d.scroller.scrollLeft,!0),I(a,"scroll",a))});w(d.scroller,"mousewheel",function(b){return Ge(a,b)});w(d.scroller,"DOMMouseScroll",function(b){return Ge(a,
b)});w(d.wrapper,"scroll",function(){return d.wrapper.scrollTop=d.wrapper.scrollLeft=0});d.dragFunctions={enter:function(b){K(a,b)||tb(b)},over:function(b){if(!K(a,b)){var d=Oa(a,b);if(d){var c=document.createDocumentFragment();Be(a,d,c);a.display.dragCursor||(a.display.dragCursor=r("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),a.display.lineSpace.insertBefore(a.display.dragCursor,a.display.cursorDiv));D(a.display.dragCursor,c)}tb(b)}},start:function(b){if(B&&(!a.state.draggingText||100>
+new Date-mf))tb(b);else if(!K(a,b)&&!sa(a.display,b)&&(b.dataTransfer.setData("Text",a.getSelection()),b.dataTransfer.effectAllowed="copyMove",b.dataTransfer.setDragImage&&!Cf)){var d=r("img",null,null,"position: fixed; left: 0; top: 0;");d.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";ha&&(d.width=d.height=1,a.display.wrapper.appendChild(d),d._top=d.offsetTop);b.dataTransfer.setDragImage(d,0,0);ha&&d.parentNode.removeChild(d)}},drop:L(a,tg),leave:function(b){K(a,
b)||lf(a)}};var g=d.input.getField();w(g,"keyup",function(b){return wf.call(a,b)});w(g,"keydown",L(a,uf));w(g,"keypress",L(a,xf));w(g,"focus",function(b){return rd(a,b)});w(g,"blur",function(b){return Cb(a,b)})}function Qb(a,b,c,d){var e=a.doc,f;null==c&&(c="add");"smart"==c&&(e.mode.indent?f=ub(a,b):c="prev");var g=a.options.tabSize,h=v(e,b),k=ca(h.text,null,g);h.stateAfter&&(h.stateAfter=null);var l=h.text.match(/^\s*/)[0],m;if(!d&&!/\S/.test(h.text))m=0,c="not";else if("smart"==c&&(m=e.mode.indent(f,
h.text.slice(l.length),h.text),m==Fd||150<m)){if(!d)return;c="prev"}"prev"==c?m=b>e.first?ca(v(e,b-1).text,null,g):0:"add"==c?m=k+a.options.indentUnit:"subtract"==c?m=k-a.options.indentUnit:"number"==typeof c&&(m=k+c);m=Math.max(0,m);c="";d=0;if(a.options.indentWithTabs)for(a=Math.floor(m/g);a;--a)d+=g,c+="\t";d<m&&(c+=Lc(m-d));if(c!=l)return hb(e,c,q(b,0),q(b,l.length),"+input"),h.stateAfter=null,!0;for(g=0;g<e.sel.ranges.length;g++)if(h=e.sel.ranges[g],h.head.line==b&&h.head.ch<l.length){b=q(b,
l.length);Dd(e,g,new A(b,b));break}}function Ld(a,b,c,d,e){var f=a.doc;a.display.shift=!1;d||(d=f.sel);var g=a.state.pasteIncoming||"paste"==e,h=Md(b),k=null;if(g&&1<d.ranges.length)if(U&&U.text.join("\n")==b){if(0==d.ranges.length%U.text.length)for(var k=[],l=0;l<U.text.length;l++)k.push(f.splitLines(U.text[l]))}else h.length==d.ranges.length&&(k=Yb(h,function(a){return[a]}));for(var m,l=d.ranges.length-1;0<=l;l--){m=d.ranges[l];var n=m.from(),p=m.to();m.empty()&&(c&&0<c?n=q(n.line,n.ch-c):a.state.overwrite&&
!g?p=q(p.line,Math.min(v(f,p.line).text.length,p.ch+x(h).length)):U&&U.lineWise&&U.text.join("\n")==b&&(n=p=q(n.line,0)));m=a.curOp.updateInput;n={from:n,to:p,text:k?k[l%k.length]:h,origin:e||(g?"paste":a.state.cutIncoming?"cut":"+input")};gb(a.doc,n);X(a,"inputRead",a,n)}b&&!g&&Df(a,b);bb(a);a.curOp.updateInput=m;a.curOp.typing=!0;a.state.pasteIncoming=a.state.cutIncoming=!1}function Ef(a,b){var c=a.clipboardData&&a.clipboardData.getData("Text");if(c)return a.preventDefault(),b.isReadOnly()||b.options.disableInput||
aa(b,function(){return Ld(b,c,0,null,"paste")}),!0}function Df(a,b){if(a.options.electricChars&&a.options.smartIndent)for(var c=a.doc.sel,d=c.ranges.length-1;0<=d;d--){var e=c.ranges[d];if(!(100<e.head.ch||d&&c.ranges[d-1].head.line==e.head.line)){var f=a.getModeAt(e.head),g=!1;if(f.electricChars)for(var h=0;h<f.electricChars.length;h++){if(-1<b.indexOf(f.electricChars.charAt(h))){g=Qb(a,e.head.line,"smart");break}}else f.electricInput&&f.electricInput.test(v(a.doc,e.head.line).text.slice(0,e.head.ch))&&
(g=Qb(a,e.head.line,"smart"));g&&X(a,"electricInput",a,e.head.line)}}}function Ff(a){for(var b=[],c=[],d=0;d<a.doc.sel.ranges.length;d++){var e=a.doc.sel.ranges[d].head.line,e={anchor:q(e,0),head:q(e+1,0)};c.push(e);b.push(a.getRange(e.anchor,e.head))}return{text:b,ranges:c}}function Gf(a,b){a.setAttribute("autocorrect","off");a.setAttribute("autocapitalize","off");a.setAttribute("spellcheck",!!b)}function Hf(){var a=r("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),
b=r("div",[a],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");N?a.style.width="1000px":a.setAttribute("wrap","off");Rb&&(a.style.border="1px solid black");Gf(a);return b}function Nd(a,b,c,d,e){function f(b){var d=(e?Xc:Yd)(l,h,c,!0);if(null==d){if(b=!b)b=g+c,b<a.first||b>=a.first+a.size?b=!1:(g=b,b=l=v(a,b));if(b)h=e?(0>c?ec:dc)(l):0>c?l.text.length:0;else return!1}else h=d;return!0}var g=b.line,h=b.ch,k=c,l=v(a,g);if("char"==d)f();else if("column"==d)f(!0);else if("word"==
d||"group"==d){var m=null;d="group"==d;for(var n=a.cm&&a.cm.getHelper(b,"wordChars"),p=!0;!(0>c)||f(!p);p=!1){var t=l.text.charAt(h)||"\n",t=Zb(t,n)?"w":d&&"\n"==t?"n":!d||/\s/.test(t)?null:"p";!d||p||t||(t="s");if(m&&m!=t){0>c&&(c=1,f());break}t&&(m=t);if(0<c&&!f(!p))break}}k=Ed(a,q(g,h),b,k,!0);u(b,k)||(k.hitSide=!0);return k}function If(a,b,c,d){var e=a.doc,f=b.left,g;"page"==d?(g=Math.max(Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight)-.5*Ma(a.display),
3),g=(0<c?b.bottom:b.top)+c*g):"line"==d&&(g=0<c?b.bottom+3:b.top-3);for(;;){b=nd(a,f,g);if(!b.outside)break;if(0>c?0>=g:g>=e.height){b.hitSide=!0;break}g+=5*c}return b}function Jf(a,b){var c=jd(a,b.line);if(!c||c.hidden)return null;a=v(a.doc,b.line);c=se(c,a,b.line);a=ea(a);var d="left";a&&(d=fc(a,b.ch)%2?"right":"left");b=te(c.map,b.ch,d);b.offset="right"==b.collapse?b.end:b.start;return b}function mb(a,b){b&&(a.bad=!0);return a}function Lg(a,b,c,d,e){function f(a){return function(b){return b.id==
a}}function g(b){if(1==b.nodeType){var c=b.getAttribute("cm-text");if(null!=c)h=""==c?h+b.textContent.replace(/\u200b/g,""):h+c;else{var c=b.getAttribute("cm-marker"),m;if(c)b=a.findMarks(q(d,0),q(e+1,0),f(+c)),b.length&&(m=b[0].find())&&(h+=Fa(a.doc,m.from,m.to).join(l));else if("false"!=b.getAttribute("contenteditable")){for(m=0;m<b.childNodes.length;m++)g(b.childNodes[m]);/^(pre|div|p)$/i.test(b.nodeName)&&(k=!0)}}}else 3==b.nodeType&&(b=b.nodeValue)&&(k&&(h+=l,k=!1),h+=b)}for(var h="",k=!1,l=
a.doc.lineSeparator();;){g(b);if(b==c)break;b=b.nextSibling}return h}function Gc(a,b,c){var d;if(b==a.display.lineDiv){d=a.display.lineDiv.childNodes[c];if(!d)return mb(a.clipPos(q(a.display.viewTo-1)),!0);b=null;c=0}else for(d=b;;d=d.parentNode){if(!d||d==a.display.lineDiv)return null;if(d.parentNode&&d.parentNode==a.display.lineDiv)break}for(var e=0;e<a.display.view.length;e++){var f=a.display.view[e];if(f.node==d)return Mg(f,b,c)}}function Mg(a,b,c){function d(b,d,c){for(var e=-1;e<(l?l.length:
0);e++)for(var f=0>e?k.map:l[e],g=0;g<f.length;g+=3){var h=f[g+2];if(h==b||h==d){d=C(0>e?a.line:a.rest[e]);e=f[g]+c;if(0>c||h!=b)e=f[g+(c?1:0)];return q(d,e)}}}var e=a.text.firstChild,f=!1;if(!b||!V(e,b))return mb(q(C(a.line),0),!0);if(b==e&&(f=!0,b=e.childNodes[c],c=0,!b))return c=a.rest?x(a.rest):a.line,mb(q(C(c),c.text.length),f);var g=3==b.nodeType?b:null,h=b;g||1!=b.childNodes.length||3!=b.firstChild.nodeType||(g=b.firstChild,c&&(c=g.nodeValue.length));for(;h.parentNode!=e;)h=h.parentNode;var k=
a.measure,l=k.maps;if(b=d(g,h,c))return mb(b,f);e=h.nextSibling;for(g=g?g.nodeValue.length-c:0;e;e=e.nextSibling){if(b=d(e,e.firstChild,0))return mb(q(b.line,b.ch-g),f);g+=e.textContent.length}for(h=h.previousSibling;h;h=h.previousSibling){if(b=d(h,h.firstChild,-1))return mb(q(b.line,b.ch+c),f);c+=h.textContent.length}}var Y=navigator.userAgent,Kf=navigator.platform,wa=/gecko\/\d/i.test(Y),Lf=/MSIE \d/.test(Y),Mf=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Y),B=Lf||Mf,F=B&&(Lf?document.documentMode||
6:Mf[1]),N=/WebKit\//.test(Y),Ng=N&&/Qt\/\d+\.\d+/.test(Y),Og=/Chrome\//.test(Y),ha=/Opera\//.test(Y),Cf=/Apple Computer/.test(navigator.vendor),Pg=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(Y),kg=/PhantomJS/.test(Y),Rb=/AppleWebKit/.test(Y)&&/Mobile\/\w+/.test(Y),pb=Rb||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(Y),ga=Rb||/Mac/.test(Kf),Hg=/\bCrOS\b/.test(Y),Qg=/win/i.test(Kf),Qa=ha&&Y.match(/Version\/(\d*\.\d*)/);Qa&&(Qa=Number(Qa[1]));Qa&&15<=Qa&&(ha=!1,N=!0);var qf=ga&&(Ng||ha&&
(null==Qa||12.11>Qa)),Id=wa||B&&9<=F,Za=function(a,b){var c=a.className;if(b=y(b).exec(c)){var d=c.slice(b.index+b[0].length);a.className=c.slice(0,b.index)+(d?b[1]+d:"")}},Xa;Xa=document.createRange?function(a,b,c,d){var e=document.createRange();e.setEnd(d||a,c);e.setStart(a,b);return e}:function(a,b,c){var d=document.body.createTextRange();try{d.moveToElementText(a.parentNode)}catch(e){return d}d.collapse(!0);d.moveEnd("character",c);d.moveStart("character",b);return d};var nb=function(a){a.select()};
Rb?nb=function(a){a.selectionStart=0;a.selectionEnd=a.value.length}:B&&(nb=function(a){try{a.select()}catch(b){}});Ea.prototype.set=function(a,b){clearTimeout(this.id);this.id=setTimeout(b,a)};var Fd={toString:function(){return"CodeMirror.Pass"}},pa={scroll:!1},Jd={origin:"*mouse"},Sb={origin:"+move"},Xb=[""],Of=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Pf=/[\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]/,
cf=!1,xa=!1,sb=null,Tf=function(){function a(a){return 247>=a?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(a):1424<=a&&1524>=a?"R":1536<=a&&1785>=a?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(a-
1536):1774<=a&&2220>=a?"r":8192<=a&&8203>=a?"w":8204==a?"b":"L"}function b(a,b,d){this.level=a;this.from=b;this.to=d}var c=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,d=/[stwN]/,e=/[LRr]/,f=/[Lb1n]/,g=/[1n]/;return function(h){if(!c.test(h))return!1;for(var k=h.length,l=[],m=0;m<k;++m)l.push(a(h.charCodeAt(m)));for(var m=0,n="L";m<k;++m){var p=l[m];"m"==p?l[m]=n:n=p}m=0;for(n="L";m<k;++m)p=l[m],"1"==p&&"r"==n?l[m]="n":e.test(p)&&(n=p,"r"==p&&(l[m]="R"));m=1;for(n=l[0];m<k-1;++m)p=l[m],"+"==p&&"1"==
n&&"1"==l[m+1]?l[m]="1":","!=p||n!=l[m+1]||"1"!=n&&"n"!=n||(l[m]=n),n=p;for(m=0;m<k;++m)if(n=l[m],","==n)l[m]="N";else if("%"==n){for(n=m+1;n<k&&"%"==l[n];++n);for(p=m&&"!"==l[m-1]||n<k&&"1"==l[n]?"1":"N";m<n;++m)l[m]=p;m=n-1}m=0;for(n="L";m<k;++m)p=l[m],"L"==n&&"1"==p?l[m]="L":e.test(p)&&(n=p);for(n=0;n<k;++n)if(d.test(l[n])){for(m=n+1;m<k&&d.test(l[m]);++m);p="L"==(m<k?l[m]:"L");for(p="L"==(n?l[n-1]:"L")||p?"L":"R";n<m;++n)l[n]=p;n=m-1}for(var m=[],t,n=0;n<k;)if(f.test(l[n])){p=n;for(++n;n<k&&f.test(l[n]);++n);
m.push(new b(0,p,n))}else{var q=n,p=m.length;for(++n;n<k&&"L"!=l[n];++n);for(var r=q;r<n;)if(g.test(l[r])){q<r&&m.splice(p,0,new b(1,q,r));q=r;for(++r;r<n&&g.test(l[r]);++r);m.splice(p,0,new b(2,q,r));q=r}else++r;q<n&&m.splice(p,0,new b(1,q,n))}1==m[0].level&&(t=h.match(/^\s+/))&&(m[0].from=t[0].length,m.unshift(new b(0,0,t[0].length)));1==x(m).level&&(t=h.match(/\s+$/))&&(x(m).to-=t[0].length,m.push(new b(0,k-t[0].length,k)));2==m[0].level&&m.unshift(new b(1,m[0].to,m[0].to));m[0].level!=x(m).level&&
m.push(new b(m[0].level,k,k));return m}}(),gc=[],w=function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):(a=a._handlers||(a._handlers={}),a[b]=(a[b]||gc).concat(c))},Eg=function(){if(B&&9>F)return!1;var a=r("div");return"draggable"in a||"dragDrop"in a}(),Zc,ed,Md=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,c=[],d=a.length;b<=d;){var e=a.indexOf("\n",b);-1==e&&(e=a.length);var f=a.slice(b,"\r"==a.charAt(e-1)?e-1:e),g=f.indexOf("\r");-1!=g?(c.push(f.slice(0,
g)),b+=g+1):(c.push(f),b=e+1)}return c}:function(a){return a.split(/\r\n?|\n/)},Rg=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return!1}}:function(a){var b;try{b=a.ownerDocument.selection.createRange()}catch(c){}return b&&b.parentElement()==a?0!=b.compareEndPoints("StartToEnd",b):!1},vf=function(){var a=r("div");if("oncopy"in a)return!0;a.setAttribute("oncopy","return;");return"function"==typeof a.oncopy}(),ld=null,$c={},Ua={},Va={},vb=function(a,b){this.pos=
this.start=0;this.string=a;this.tabSize=b||8;this.lineStart=this.lastColumnPos=this.lastColumnValue=0};vb.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(a){var b=this.string.charAt(this.pos);if("string"==typeof a?b==a:b&&(a.test?a.test(b):a(b)))return++this.pos,b},eatWhile:function(a){for(var b=
this.pos;this.eat(a););return this.pos>b},eatSpace:function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){a=this.string.indexOf(a,this.pos);if(-1<a)return this.pos=a,!0},backUp:function(a){this.pos-=a},column:function(){this.lastColumnPos<this.start&&(this.lastColumnValue=ca(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start);
return this.lastColumnValue-(this.lineStart?ca(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return ca(this.string,null,this.tabSize)-(this.lineStart?ca(this.string,this.lineStart,this.tabSize):0)},match:function(a,b,c){if("string"==typeof a){var d=function(a){return c?a.toLowerCase():a},e=this.string.substr(this.pos,a.length);if(d(e)==d(a))return!1!==b&&(this.pos+=a.length),!0}else{if((a=this.string.slice(this.pos).match(a))&&0<a.index)return null;a&&!1!==b&&(this.pos+=a[0].length);
return a}},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(a,b){this.lineStart+=a;try{return b()}finally{this.lineStart-=a}}};Ta(Wa);Wa.prototype.lineNo=function(){return C(this)};var Zf={},Yf={},Ya=null,wb=null,ue={left:0,right:0,top:0,bottom:0},Na,oc=0,Z=null;B?Z=-.53:wa?Z=15:Og?Z=-.7:Cf&&(Z=-1/3);var Ra=function(a,b,c){this.cm=c;var d=this.vert=r("div",[r("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),e=this.horiz=r("div",[r("div",null,null,
"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");a(d);a(e);w(d,"scroll",function(){d.clientHeight&&b(d.scrollTop,"vertical")});w(e,"scroll",function(){e.clientWidth&&b(e.scrollLeft,"horizontal")});this.checkedZeroWidth=!1;B&&8>F&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Ra.prototype.update=function(a){var b=a.scrollWidth>a.clientWidth+1,c=a.scrollHeight>a.clientHeight+1,d=a.nativeBarWidth;c?(this.vert.style.display="block",this.vert.style.bottom=b?d+"px":"0",this.vert.firstChild.style.height=
Math.max(0,a.scrollHeight-a.clientHeight+(a.viewHeight-(b?d:0)))+"px"):(this.vert.style.display="",this.vert.firstChild.style.height="0");b?(this.horiz.style.display="block",this.horiz.style.right=c?d+"px":"0",this.horiz.style.left=a.barLeft+"px",this.horiz.firstChild.style.width=a.scrollWidth-a.clientWidth+(a.viewWidth-a.barLeft-(c?d:0))+"px"):(this.horiz.style.display="",this.horiz.firstChild.style.width="0");!this.checkedZeroWidth&&0<a.clientHeight&&(0==d&&this.zeroWidthHack(),this.checkedZeroWidth=
!0);return{right:c?d:0,bottom:b?d:0}};Ra.prototype.setScrollLeft=function(a){this.horiz.scrollLeft!=a&&(this.horiz.scrollLeft=a);this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz)};Ra.prototype.setScrollTop=function(a){this.vert.scrollTop!=a&&(this.vert.scrollTop=a);this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert)};Ra.prototype.zeroWidthHack=function(){this.horiz.style.height=this.vert.style.width=ga&&!Pg?"12px":"18px";this.horiz.style.pointerEvents=this.vert.style.pointerEvents=
"none";this.disableHoriz=new Ea;this.disableVert=new Ea};Ra.prototype.enableZeroWidthBar=function(a,b){function c(){var d=a.getBoundingClientRect();document.elementFromPoint(d.left+1,d.bottom-1)!=a?a.style.pointerEvents="none":b.set(1E3,c)}a.style.pointerEvents="auto";b.set(1E3,c)};Ra.prototype.clear=function(){var a=this.horiz.parentNode;a.removeChild(this.horiz);a.removeChild(this.vert)};var Tb=function(){};Tb.prototype.update=function(){return{bottom:0,right:0}};Tb.prototype.setScrollLeft=function(){};
Tb.prototype.setScrollTop=function(){};Tb.prototype.clear=function(){};var Je={"native":Ra,"null":Tb},jg=0,sc=function(a,b,c){var d=a.display;this.viewport=b;this.visible=ud(d,a.doc,b);this.editorIsHidden=!d.wrapper.offsetWidth;this.wrapperHeight=d.wrapper.clientHeight;this.wrapperWidth=d.wrapper.clientWidth;this.oldDisplayWidth=Ka(a);this.force=c;this.dims=kd(a);this.events=[]};sc.prototype.signal=function(a,b){da(a,b)&&this.events.push(arguments)};sc.prototype.finish=function(){for(var a=0;a<this.events.length;a++)I.apply(null,
this.events[a])};ua.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(a){if(a==this)return!0;if(a.primIndex!=this.primIndex||a.ranges.length!=this.ranges.length)return!1;for(var b=0;b<this.ranges.length;b++){var c=this.ranges[b],d=a.ranges[b];if(0!=u(c.anchor,d.anchor)||0!=u(c.head,d.head))return!1}return!0},deepCopy:function(){for(var a=[],b=0;b<this.ranges.length;b++)a[b]=new A(Pc(this.ranges[b].anchor),Pc(this.ranges[b].head));return new ua(a,this.primIndex)},somethingSelected:function(){for(var a=
0;a<this.ranges.length;a++)if(!this.ranges[a].empty())return!0;return!1},contains:function(a,b){b||(b=a);for(var c=0;c<this.ranges.length;c++){var d=this.ranges[c];if(0<=u(b,d.from())&&0>=u(a,d.to()))return c}return-1}};A.prototype={from:function(){return ac(this.anchor,this.head)},to:function(){return $b(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};Kb.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,
b){for(var c=a,d=a+b;c<d;++c){var e=this.lines[c];this.height-=e.height;var f=e;f.parent=null;Td(f);X(e,"delete")}this.lines.splice(a,b)},collapse:function(a){a.push.apply(a,this.lines)},insertInner:function(a,b,c){this.height+=c;this.lines=this.lines.slice(0,a).concat(b).concat(this.lines.slice(a));for(a=0;a<b.length;++a)b[a].parent=this},iterN:function(a,b,c){for(b=a+b;a<b;++a)if(c(this.lines[a]))return!0}};Lb.prototype={chunkSize:function(){return this.size},removeInner:function(a,b){this.size-=
b;for(var c=0;c<this.children.length;++c){var d=this.children[c],e=d.chunkSize();if(a<e){var f=Math.min(b,e-a),g=d.height;d.removeInner(a,f);this.height-=g-d.height;e==f&&(this.children.splice(c--,1),d.parent=null);if(0==(b-=f))break;a=0}else a-=e}25>this.size-b&&(1<this.children.length||!(this.children[0]instanceof Kb))&&(a=[],this.collapse(a),this.children=[new Kb(a)],this.children[0].parent=this)},collapse:function(a){for(var b=0;b<this.children.length;++b)this.children[b].collapse(a)},insertInner:function(a,
b,c){this.size+=b.length;this.height+=c;for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(a<=f){e.insertInner(a,b,c);if(e.lines&&50<e.lines.length){for(b=a=e.lines.length%25+25;b<e.lines.length;)c=new Kb(e.lines.slice(b,b+=25)),e.height-=c.height,this.children.splice(++d,0,c),c.parent=this;e.lines=e.lines.slice(0,a);this.maybeSpill()}break}a-=f}},maybeSpill:function(){if(!(10>=this.children.length)){var a=this;do{var b=a.children.splice(a.children.length-5,5),b=new Lb(b);
if(a.parent){a.size-=b.size;a.height-=b.height;var c=M(a.parent.children,a);a.parent.children.splice(c+1,0,b)}else c=new Lb(a.children),c.parent=a,a.children=[c,b],a=c;b.parent=a.parent}while(10<a.children.length);a.parent.maybeSpill()}},iterN:function(a,b,c){for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(a<f){f=Math.min(b,f-a);if(e.iterN(a,f,c))return!0;if(0==(b-=f))break;a=0}else a-=f}}};Ta(Mb);Mb.prototype.clear=function(){var a=this.doc.cm,b=this.line.widgets,
c=this.line,d=C(c);if(null!=d&&b){for(var e=0;e<b.length;++e)b[e]==this&&b.splice(e--,1);b.length||(c.widgets=null);var f=yb(this);ja(c,Math.max(0,c.height-f));a&&aa(a,function(){var b=-f;la(c)<(a.curOp&&a.curOp.scrollTop||a.doc.scrollTop)&&qc(a,null,b);za(a,d,"widget")})}};Mb.prototype.changed=function(){var a=this.height,b=this.doc.cm,c=this.line;this.height=null;var d=yb(this)-a;d&&(ja(c,c.height+d),b&&aa(b,function(){b.curOp.forceUpdate=!0;la(c)<(b.curOp&&b.curOp.scrollTop||b.doc.scrollTop)&&
qc(b,null,d)}))};var jf=0;Ta(Ba);Ba.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;b&&cb(a);if(da(this,"clear")){var c=this.find();c&&X(this,"clear",c.from,c.to)}for(var d=c=null,e=0;e<this.lines.length;++e){var f=this.lines[e],g=rb(f.markedSpans,this);a&&!this.collapsed?za(a,C(f),"text"):a&&(null!=g.to&&(d=C(f)),null!=g.from&&(c=C(f)));for(var h=f,k=void 0,l=f.markedSpans,m=g,n=0;n<l.length;++n)l[n]!=m&&(k||(k=[])).push(l[n]);h.markedSpans=k;null==g.from&&
this.collapsed&&!Ia(this.doc,f)&&a&&ja(f,Ma(a.display))}if(a&&this.collapsed&&!a.options.lineWrapping)for(e=0;e<this.lines.length;++e)f=ka(this.lines[e]),g=cc(f),g>a.display.maxLineLength&&(a.display.maxLine=f,a.display.maxLineLength=g,a.display.maxLineChanged=!0);null!=c&&a&&this.collapsed&&R(a,c,d+1);this.lines.length=0;this.explicitlyCleared=!0;this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&Ze(a.doc));a&&X(a,"markerCleared",a,this);b&&db(a);this.parent&&this.parent.clear()}};Ba.prototype.find=
function(a,b){null==a&&"bookmark"==this.type&&(a=1);for(var c,d,e=0;e<this.lines.length;++e){var f=this.lines[e],g=rb(f.markedSpans,this);if(null!=g.from&&(c=q(b?f:C(f),g.from),-1==a))return c;if(null!=g.to&&(d=q(b?f:C(f),g.to),1==a))return d}return c&&{from:c,to:d}};Ba.prototype.changed=function(){var a=this.find(-1,!0),b=this,c=this.doc.cm;a&&c&&aa(c,function(){var d=a.line,e=C(a.line);if(e=jd(c,e))ve(e),c.curOp.selectionChanged=c.curOp.forceUpdate=!0;c.curOp.updateMaxLine=!0;Ia(b.doc,d)||null==
b.height||(e=b.height,b.height=null,(e=yb(b)-e)&&ja(d,d.height+e))})};Ba.prototype.attachLine=function(a){if(!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;b.maybeHiddenMarkers&&-1!=M(b.maybeHiddenMarkers,this)||(b.maybeUnhiddenMarkers||(b.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(a)};Ba.prototype.detachLine=function(a){this.lines.splice(M(this.lines,a),1);!this.lines.length&&this.doc.cm&&(a=this.doc.cm.curOp,(a.maybeHiddenMarkers||(a.maybeHiddenMarkers=[])).push(this))};Ta(Nb);
Nb.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var a=0;a<this.markers.length;++a)this.markers[a].clear();X(this,"clear")}};Nb.prototype.find=function(a,b){return this.primary.find(a,b)};var Sg=0,T=function(a,b,c,d){if(!(this instanceof T))return new T(a,b,c,d);null==c&&(c=0);Lb.call(this,[new Kb([new Wa("",null)])]);this.first=c;this.scrollTop=this.scrollLeft=0;this.cantEdit=!1;this.cleanGeneration=1;this.frontier=c;c=q(c,0);this.sel=va(c);this.history=new uc(null);
this.id=++Sg;this.modeOption=b;this.lineSep=d;this.extend=!1;"string"==typeof a&&(a=this.splitLines(a));Bd(this,{from:c,to:c,text:a});P(this,va(c),pa)};T.prototype=Pd(Lb.prototype,{constructor:T,iter:function(a,b,c){c?this.iterN(a-this.first,b-a,c):this.iterN(this.first,this.first+this.size,a)},insert:function(a,b){for(var c=0,d=0;d<b.length;++d)c+=b[d].height;this.insertInner(a-this.first,b,c)},remove:function(a,b){this.removeInner(a-this.first,b)},getValue:function(a){var b=Nc(this,this.first,this.first+
this.size);return!1===a?b:b.join(a||this.lineSeparator())},setValue:O(function(a){var b=q(this.first,0),c=this.first+this.size-1;gb(this,{from:b,to:q(c,v(this,c).text.length),text:this.splitLines(a),origin:"setValue",full:!0},!0);P(this,va(b))}),replaceRange:function(a,b,c,d){b=z(this,b);c=c?z(this,c):b;hb(this,a,b,c,d)},getRange:function(a,b,c){a=Fa(this,z(this,a),z(this,b));return!1===c?a:a.join(c||this.lineSeparator())},getLine:function(a){return(a=this.getLineHandle(a))&&a.text},getLineHandle:function(a){if(qb(this,
a))return v(this,a)},getLineNumber:function(a){return C(a)},getLineHandleVisualStart:function(a){"number"==typeof a&&(a=v(this,a));return ka(a)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(a){return z(this,a)},getCursor:function(a){var b=this.sel.primary();return null==a||"head"==a?b.head:"anchor"==a?b.anchor:"end"==a||"to"==a||!1===a?b.to():b.from()},listSelections:function(){return this.sel.ranges},
somethingSelected:function(){return this.sel.somethingSelected()},setCursor:O(function(a,b,c){a=z(this,"number"==typeof a?q(a,b||0):a);P(this,va(a,null),c)}),setSelection:O(function(a,b,c){var d=z(this,a);a=z(this,b||a);P(this,va(d,a),c)}),extendSelection:O(function(a,b,c){wc(this,z(this,a),b&&z(this,b),c)}),extendSelections:O(function(a,b){Ve(this,Rd(this,a),b)}),extendSelectionsBy:O(function(a,b){a=Yb(this.sel.ranges,a);Ve(this,Rd(this,a),b)}),setSelections:O(function(a,b,c){if(a.length){for(var d=
[],e=0;e<a.length;e++)d[e]=new A(z(this,a[e].anchor),z(this,a[e].head));null==b&&(b=Math.min(a.length-1,this.sel.primIndex));P(this,ia(d,b),c)}}),addSelection:O(function(a,b,c){var d=this.sel.ranges.slice(0);d.push(new A(z(this,a),z(this,b||a)));P(this,ia(d,d.length-1),c)}),getSelection:function(a){for(var b=this.sel.ranges,c,d=0;d<b.length;d++){var e=Fa(this,b[d].from(),b[d].to());c=c?c.concat(e):e}return!1===a?c:c.join(a||this.lineSeparator())},getSelections:function(a){for(var b=[],c=this.sel.ranges,
d=0;d<c.length;d++){var e=Fa(this,c[d].from(),c[d].to());!1!==a&&(e=e.join(a||this.lineSeparator()));b[d]=e}return b},replaceSelection:function(a,b,c){for(var d=[],e=0;e<this.sel.ranges.length;e++)d[e]=a;this.replaceSelections(d,b,c||"+input")},replaceSelections:O(function(a,b,c){for(var d=[],e=this.sel,f=0;f<e.ranges.length;f++){var g=e.ranges[f];d[f]={from:g.from(),to:g.to(),text:this.splitLines(a[f]),origin:c}}if(a=b&&"end"!=b){a=[];e=c=q(this.first,0);for(f=0;f<d.length;f++){var h=d[f],g=Oe(h.from,
c,e),k=Oe(Aa(h),c,e);c=h.to;e=k;"around"==b?(h=this.sel.ranges[f],h=0>u(h.head,h.anchor),a[f]=new A(h?k:g,h?g:k)):a[f]=new A(g,g)}a=new ua(a,this.sel.primIndex)}b=a;for(a=d.length-1;0<=a;a--)gb(this,d[a]);b?We(this,b):this.cm&&bb(this.cm)}),undo:O(function(){yc(this,"undo")}),redo:O(function(){yc(this,"redo")}),undoSelection:O(function(){yc(this,"undo",!0)}),redoSelection:O(function(){yc(this,"redo",!0)}),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},historySize:function(){for(var a=
this.history,b=0,c=0,d=0;d<a.done.length;d++)a.done[d].ranges||++b;for(d=0;d<a.undone.length;d++)a.undone[d].ranges||++c;return{undo:b,redo:c}},clearHistory:function(){this.history=new uc(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(a){a&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null);return this.history.generation},isClean:function(a){return this.history.generation==(a||this.cleanGeneration)},
getHistory:function(){return{done:eb(this.history.done),undone:eb(this.history.undone)}},setHistory:function(a){var b=this.history=new uc(this.history.maxGeneration);b.done=eb(a.done.slice(0),null,!0);b.undone=eb(a.undone.slice(0),null,!0)},setGutterMarker:O(function(a,b,c){return Jb(this,a,"gutter",function(a){var d=a.gutterMarkers||(a.gutterMarkers={});d[b]=c;!c&&Qd(d)&&(a.gutterMarkers=null);return!0})}),clearGutter:O(function(a){var b=this,c=this.first;this.iter(function(d){d.gutterMarkers&&d.gutterMarkers[a]&&
Jb(b,d,"gutter",function(){d.gutterMarkers[a]=null;Qd(d.gutterMarkers)&&(d.gutterMarkers=null);return!0});++c})}),lineInfo:function(a){var b;if("number"==typeof a){if(!qb(this,a))return null;b=a;a=v(this,a);if(!a)return null}else if(b=C(a),null==b)return null;return{line:b,handle:a,text:a.text,gutterMarkers:a.gutterMarkers,textClass:a.textClass,bgClass:a.bgClass,wrapClass:a.wrapClass,widgets:a.widgets}},addLineClass:O(function(a,b,c){return Jb(this,a,"gutter"==b?"gutter":"class",function(a){var d=
"text"==b?"textClass":"background"==b?"bgClass":"gutter"==b?"gutterClass":"wrapClass";if(a[d]){if(y(c).test(a[d]))return!1;a[d]+=" "+c}else a[d]=c;return!0})}),removeLineClass:O(function(a,b,c){return Jb(this,a,"gutter"==b?"gutter":"class",function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"gutter"==b?"gutterClass":"wrapClass",f=a[d];if(f)if(null==c)a[d]=null;else{var g=f.match(y(c));if(!g)return!1;var h=g.index+g[0].length;a[d]=f.slice(0,g.index)+(g.index&&h!=f.length?" ":"")+f.slice(h)||
null}else return!1;return!0})}),addLineWidget:O(function(a,b,c){return qg(this,a,b,c)}),removeLineWidget:function(a){a.clear()},markText:function(a,b,c){return ib(this,z(this,a),z(this,b),c,c&&c.type||"range")},setBookmark:function(a,b){b={replacedWith:b&&(null==b.nodeType?b.widget:b),insertLeft:b&&b.insertLeft,clearWhenEmpty:!1,shared:b&&b.shared,handleMouseEvents:b&&b.handleMouseEvents};a=z(this,a);return ib(this,a,a,b,"bookmark")},findMarksAt:function(a){a=z(this,a);var b=[],c=v(this,a.line).markedSpans;
if(c)for(var d=0;d<c.length;++d){var e=c[d];(null==e.from||e.from<=a.ch)&&(null==e.to||e.to>=a.ch)&&b.push(e.marker.parent||e.marker)}return b},findMarks:function(a,b,c){a=z(this,a);b=z(this,b);var d=[],e=a.line;this.iter(a.line,b.line+1,function(f){if(f=f.markedSpans)for(var g=0;g<f.length;g++){var h=f[g];null!=h.to&&e==a.line&&a.ch>=h.to||null==h.from&&e!=a.line||null!=h.from&&e==b.line&&h.from>=b.ch||c&&!c(h.marker)||d.push(h.marker.parent||h.marker)}++e});return d},getAllMarks:function(){var a=
[];this.iter(function(b){if(b=b.markedSpans)for(var c=0;c<b.length;++c)null!=b[c].from&&a.push(b[c].marker)});return a},posFromIndex:function(a){var b,c=this.first,d=this.lineSeparator().length;this.iter(function(e){e=e.text.length+d;if(e>a)return b=a,!0;a-=e;++c});return z(this,q(c,b))},indexFromPos:function(a){a=z(this,a);var b=a.ch;if(a.line<this.first||0>a.ch)return 0;var c=this.lineSeparator().length;this.iter(this.first,a.line,function(a){b+=a.text.length+c});return b},copy:function(a){var b=
new T(Nc(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep);b.scrollTop=this.scrollTop;b.scrollLeft=this.scrollLeft;b.sel=this.sel;b.extend=!1;a&&(b.history.undoDepth=this.history.undoDepth,b.setHistory(this.getHistory()));return b},linkedDoc:function(a){a||(a={});var b=this.first,c=this.first+this.size;null!=a.from&&a.from>b&&(b=a.from);null!=a.to&&a.to<c&&(c=a.to);b=new T(Nc(this,b,c),a.mode||this.modeOption,b,this.lineSep);a.sharedHist&&(b.history=this.history);(this.linked||
(this.linked=[])).push({doc:b,sharedHist:a.sharedHist});b.linked=[{doc:this,isParent:!0,sharedHist:a.sharedHist}];a=kf(this);for(c=0;c<a.length;c++){var d=a[c],e=d.find(),f=b.clipPos(e.from),e=b.clipPos(e.to);u(f,e)&&(f=ib(b,f,e,d.primary,d.primary.type),d.markers.push(f),f.parent=d)}return b},unlinkDoc:function(a){a instanceof G&&(a=a.doc);if(this.linked)for(var b=0;b<this.linked.length;++b)if(this.linked[b].doc==a){this.linked.splice(b,1);a.unlinkDoc(this);sg(kf(this));break}if(a.history==this.history){var c=
[a.id];Pa(a,function(a){return c.push(a.id)},!0);a.history=new uc(null);a.history.done=eb(this.history.done,c);a.history.undone=eb(this.history.undone,c)}},iterLinkedDocs:function(a){Pa(this,a)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(a){return this.lineSep?a.split(this.lineSep):Md(a)},lineSeparator:function(){return this.lineSep||"\n"}});T.prototype.eachLine=T.prototype.iter;for(var mf=0,Bf=!1,Ca={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",
17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",
63302:"Insert"},Ub=0;10>Ub;Ub++)Ca[Ub+48]=Ca[Ub+96]=String(Ub);for(var Hc=65;90>=Hc;Hc++)Ca[Hc]=String.fromCharCode(Hc);for(var Vb=1;12>=Vb;Vb++)Ca[Vb+111]=Ca[Vb+63235]="F"+Vb;var Ob={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"},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"},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"},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"]}};Ob["default"]=ga?Ob.macDefault:Ob.pcDefault;var Bc={selectAll:af,singleSelection:function(a){return a.setSelection(a.getCursor("anchor"),a.getCursor("head"),pa)},killLine:function(a){return kb(a,function(b){if(b.empty()){var c=
v(a.doc,b.head.line).text.length;return b.head.ch==c&&b.head.line<a.lastLine()?{from:b.head,to:q(b.head.line+1,0)}:{from:b.head,to:q(b.head.line,c)}}return{from:b.from(),to:b.to()}})},deleteLine:function(a){return kb(a,function(b){return{from:q(b.from().line,0),to:z(a.doc,q(b.to().line+1,0))}})},delLineLeft:function(a){return kb(a,function(a){return{from:q(a.from().line,0),to:a.from()}})},delWrappedLineLeft:function(a){return kb(a,function(b){var c=a.charCoords(b.head,"div").top+5;return{from:a.coordsChar({left:0,
top:c},"div"),to:b.from()}})},delWrappedLineRight:function(a){return kb(a,function(b){var c=a.charCoords(b.head,"div").top+5,c=a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:c},"div");return{from:b.from(),to:c}})},undo:function(a){return a.undo()},redo:function(a){return a.redo()},undoSelection:function(a){return a.undoSelection()},redoSelection:function(a){return a.redoSelection()},goDocStart:function(a){return a.extendSelection(q(a.firstLine(),0))},goDocEnd:function(a){return a.extendSelection(q(a.lastLine()))},
goLineStart:function(a){return a.extendSelectionsBy(function(b){return rf(a,b.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(a){return a.extendSelectionsBy(function(b){return sf(a,b.head)},{origin:"+move",bias:1})},goLineEnd:function(a){return a.extendSelectionsBy(function(b){b=b.head.line;for(var c,d=v(a.doc,b);c=Ha(d,!1);)d=c.find(1,!0).line,b=null;c=(c=ea(d))?c[0].level%2?dc(d):ec(d):d.text.length;return q(null==b?C(d):b,c)},{origin:"+move",bias:-1})},goLineRight:function(a){return a.extendSelectionsBy(function(b){b=
a.charCoords(b.head,"div").top+5;return a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:b},"div")},Sb)},goLineLeft:function(a){return a.extendSelectionsBy(function(b){b=a.charCoords(b.head,"div").top+5;return a.coordsChar({left:0,top:b},"div")},Sb)},goLineLeftSmart:function(a){return a.extendSelectionsBy(function(b){var c=a.charCoords(b.head,"div").top+5,c=a.coordsChar({left:0,top:c},"div");return c.ch<a.getLine(c.line).search(/\S/)?sf(a,b.head):c},Sb)},goLineUp:function(a){return a.moveV(-1,
"line")},goLineDown:function(a){return a.moveV(1,"line")},goPageUp:function(a){return a.moveV(-1,"page")},goPageDown:function(a){return a.moveV(1,"page")},goCharLeft:function(a){return a.moveH(-1,"char")},goCharRight:function(a){return a.moveH(1,"char")},goColumnLeft:function(a){return a.moveH(-1,"column")},goColumnRight:function(a){return a.moveH(1,"column")},goWordLeft:function(a){return a.moveH(-1,"word")},goGroupRight:function(a){return a.moveH(1,"group")},goGroupLeft:function(a){return a.moveH(-1,
"group")},goWordRight:function(a){return a.moveH(1,"word")},delCharBefore:function(a){return a.deleteH(-1,"char")},delCharAfter:function(a){return a.deleteH(1,"char")},delWordBefore:function(a){return a.deleteH(-1,"word")},delWordAfter:function(a){return a.deleteH(1,"word")},delGroupBefore:function(a){return a.deleteH(-1,"group")},delGroupAfter:function(a){return a.deleteH(1,"group")},indentAuto:function(a){return a.indentSelection("smart")},indentMore:function(a){return a.indentSelection("add")},
indentLess:function(a){return a.indentSelection("subtract")},insertTab:function(a){return a.replaceSelection("\t")},insertSoftTab:function(a){for(var b=[],c=a.listSelections(),d=a.options.tabSize,e=0;e<c.length;e++){var f=c[e].from(),f=ca(a.getLine(f.line),f.ch,d);b.push(Lc(d-f%d))}a.replaceSelections(b)},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.execCommand("insertTab")},transposeChars:function(a){return aa(a,function(){for(var b=a.listSelections(),c=[],d=0;d<b.length;d++)if(b[d].empty()){var e=
b[d].head,f=v(a.doc,e.line).text;if(f)if(e.ch==f.length&&(e=new q(e.line,e.ch-1)),0<e.ch)e=new q(e.line,e.ch+1),a.replaceRange(f.charAt(e.ch-1)+f.charAt(e.ch-2),q(e.line,e.ch-2),e,"+transpose");else if(e.line>a.doc.first){var g=v(a.doc,e.line-1).text;g&&(e=new q(e.line,1),a.replaceRange(f.charAt(0)+a.doc.lineSeparator()+g.charAt(g.length-1),q(e.line-1,g.length-1),e,"+transpose"))}c.push(new A(e,e))}a.setSelections(c)})},newlineAndIndent:function(a){return aa(a,function(){for(var b=a.listSelections(),
c=b.length-1;0<=c;c--)a.replaceRange(a.doc.lineSeparator(),b[c].anchor,b[c].head,"+input");b=a.listSelections();for(c=0;c<b.length;c++)a.indentLine(b[c].from().line,null,!0);bb(a)})},openLine:function(a){return a.replaceSelection("\n","start")},toggleOverwrite:function(a){return a.toggleOverwrite()}},zg=new Ea,Gd=null,Ec,Dc,lb={toString:function(){return"CodeMirror.Init"}},Af={},Fc={};G.defaults=Af;G.optionHandlers=Fc;var Kd=[];G.defineInitHook=function(a){return Kd.push(a)};var U=null,E=function(a){this.cm=
a;this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null;this.polling=new Ea;this.composing=null;this.gracePeriod=!1;this.readDOMTimeout=null};E.prototype.init=function(a){function b(a){if(!K(e,a)){if(e.somethingSelected())U={lineWise:!1,text:e.getSelections()},"cut"==a.type&&e.replaceSelection("",null,"cut");else if(e.options.lineWiseCopyCut){var b=Ff(e);U={lineWise:!0,text:b.text};"cut"==a.type&&e.operation(function(){e.setSelections(b.ranges,0,pa);e.replaceSelection("",
null,"cut")})}else return;if(a.clipboardData){a.clipboardData.clearData();var c=U.text.join("\n");a.clipboardData.setData("Text",c);if(a.clipboardData.getData("Text")==c){a.preventDefault();return}}var g=Hf();a=g.firstChild;e.display.lineSpace.insertBefore(g,e.display.lineSpace.firstChild);a.value=U.text.join("\n");var m=document.activeElement;nb(a);setTimeout(function(){e.display.lineSpace.removeChild(g);m.focus();m==f&&d.showPrimarySelection()},50)}}var c=this,d=this,e=d.cm,f=d.div=a.lineDiv;Gf(f,
e.options.spellcheck);w(f,"paste",function(a){K(e,a)||Ef(a,e)||11>=F&&setTimeout(L(e,function(){d.pollContent()||R(e)}),20)});w(f,"compositionstart",function(a){c.composing={data:a.data,done:!1}});w(f,"compositionupdate",function(a){c.composing||(c.composing={data:a.data,done:!1})});w(f,"compositionend",function(a){c.composing&&(a.data!=c.composing.data&&c.readFromDOMSoon(),c.composing.done=!0)});w(f,"touchstart",function(){return d.forceCompositionEnd()});w(f,"input",function(){c.composing||c.readFromDOMSoon()});
w(f,"copy",b);w(f,"cut",b)};E.prototype.prepareSelection=function(){var a=Ae(this.cm,!1);a.focus=this.cm.state.focused;return a};E.prototype.showSelection=function(a,b){a&&this.cm.display.view.length&&((a.focus||b)&&this.showPrimarySelection(),this.showMultipleSelections(a))};E.prototype.showPrimarySelection=function(){var a=window.getSelection(),b=this.cm.doc.sel.primary(),c=Gc(this.cm,a.anchorNode,a.anchorOffset),d=Gc(this.cm,a.focusNode,a.focusOffset);if(!c||c.bad||!d||d.bad||0!=u(ac(c,d),b.from())||
0!=u($b(c,d),b.to()))if(c=Jf(this.cm,b.from()),d=Jf(this.cm,b.to()),c||d){var e=this.cm.display.view,b=a.rangeCount&&a.getRangeAt(0);c?d||(d=e[e.length-1].measure,d=d.maps?d.maps[d.maps.length-1]:d.map,d={node:d[d.length-1],offset:d[d.length-2]-d[d.length-3]}):c={node:e[0].measure.map[2],offset:0};var f;try{f=Xa(c.node,c.offset,d.offset,d.node)}catch(g){}f&&(!wa&&this.cm.state.focused?(a.collapse(c.node,c.offset),f.collapsed||(a.removeAllRanges(),a.addRange(f))):(a.removeAllRanges(),a.addRange(f)),
b&&null==a.anchorNode?a.addRange(b):wa&&this.startGracePeriod());this.rememberSelection()}};E.prototype.startGracePeriod=function(){var a=this;clearTimeout(this.gracePeriod);this.gracePeriod=setTimeout(function(){a.gracePeriod=!1;a.selectionChanged()&&a.cm.operation(function(){return a.cm.curOp.selectionChanged=!0})},20)};E.prototype.showMultipleSelections=function(a){D(this.cm.display.cursorDiv,a.cursors);D(this.cm.display.selectionDiv,a.selection)};E.prototype.rememberSelection=function(){var a=
window.getSelection();this.lastAnchorNode=a.anchorNode;this.lastAnchorOffset=a.anchorOffset;this.lastFocusNode=a.focusNode;this.lastFocusOffset=a.focusOffset};E.prototype.selectionInEditor=function(){var a=window.getSelection();if(!a.rangeCount)return!1;a=a.getRangeAt(0).commonAncestorContainer;return V(this.div,a)};E.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())};E.prototype.blur=function(){this.div.blur()};
E.prototype.getField=function(){return this.div};E.prototype.supportsTouch=function(){return!0};E.prototype.receivedFocus=function(){function a(){b.cm.state.focused&&(b.pollSelection(),b.polling.set(b.cm.options.pollInterval,a))}var b=this;this.selectionInEditor()?this.pollSelection():aa(this.cm,function(){return b.cm.curOp.selectionChanged=!0});this.polling.set(this.cm.options.pollInterval,a)};E.prototype.selectionChanged=function(){var a=window.getSelection();return a.anchorNode!=this.lastAnchorNode||
a.anchorOffset!=this.lastAnchorOffset||a.focusNode!=this.lastFocusNode||a.focusOffset!=this.lastFocusOffset};E.prototype.pollSelection=function(){if(!this.composing&&null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var a=window.getSelection(),b=this.cm;this.rememberSelection();var c=Gc(b,a.anchorNode,a.anchorOffset),d=Gc(b,a.focusNode,a.focusOffset);c&&d&&aa(b,function(){P(b.doc,va(c,d),pa);if(c.bad||d.bad)b.curOp.selectionChanged=!0})}};E.prototype.pollContent=function(){null!=
this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var a=this.cm,b=a.display,c=a.doc.sel.primary(),d=c.from(),c=c.to();0==d.ch&&d.line>a.firstLine()&&(d=q(d.line-1,v(a.doc,d.line-1).length));c.ch==v(a.doc,c.line).text.length&&c.line<a.lastLine()&&(c=q(c.line+1,0));if(d.line<b.viewFrom||c.line>b.viewTo-1)return!1;var e;d.line==b.viewFrom||0==(e=La(a,d.line))?(d=C(b.view[0].line),e=b.view[0].node):(d=C(b.view[e].line),e=b.view[e-1].node.nextSibling);var f=La(a,c.line);
f==b.view.length-1?(c=b.viewTo-1,b=b.lineDiv.lastChild):(c=C(b.view[f+1].line)-1,b=b.view[f+1].node.previousSibling);if(!e)return!1;b=a.doc.splitLines(Lg(a,e,b,d,c));for(e=Fa(a.doc,q(d,0),q(c,v(a.doc,c).text.length));1<b.length&&1<e.length;)if(x(b)==x(e))b.pop(),e.pop(),c--;else if(b[0]==e[0])b.shift(),e.shift(),d++;else break;for(var g=0,f=0,h=b[0],k=e[0],l=Math.min(h.length,k.length);g<l&&h.charCodeAt(g)==k.charCodeAt(g);)++g;h=x(b);k=x(e);for(l=Math.min(h.length-(1==b.length?g:0),k.length-(1==
e.length?g:0));f<l&&h.charCodeAt(h.length-f-1)==k.charCodeAt(k.length-f-1);)++f;b[b.length-1]=h.slice(0,h.length-f).replace(/^\u200b+/,"");b[0]=b[0].slice(g).replace(/\u200b+$/,"");d=q(d,g);c=q(c,e.length?x(e).length-f:0);if(1<b.length||b[0]||u(d,c))return hb(a.doc,b,d,c,"+input"),!0};E.prototype.ensurePolled=function(){this.forceCompositionEnd()};E.prototype.reset=function(){this.forceCompositionEnd()};E.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),
this.composing=null,this.pollContent()||R(this.cm),this.div.blur(),this.div.focus())};E.prototype.readFromDOMSoon=function(){var a=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){a.readDOMTimeout=null;if(a.composing)if(a.composing.done)a.composing=null;else return;!a.cm.isReadOnly()&&a.pollContent()||aa(a.cm,function(){return R(a.cm)})},80))};E.prototype.setUneditable=function(a){a.contentEditable="false"};E.prototype.onKeyPress=function(a){a.preventDefault();this.cm.isReadOnly()||
L(this.cm,Ld)(this.cm,String.fromCharCode(null==a.charCode?a.keyCode:a.charCode),0)};E.prototype.readOnlyChanged=function(a){this.div.contentEditable=String("nocursor"!=a)};E.prototype.onContextMenu=function(){};E.prototype.resetPosition=function(){};E.prototype.needsContentAttribute=!0;var J=function(a){this.cm=a;this.prevInput="";this.pollingFast=!1;this.polling=new Ea;this.hasSelection=this.inaccurateSelection=!1;this.composing=null};J.prototype.init=function(a){function b(a){if(!K(e,a)){if(e.somethingSelected())U=
{lineWise:!1,text:e.getSelections()},d.inaccurateSelection&&(d.prevInput="",d.inaccurateSelection=!1,g.value=U.text.join("\n"),nb(g));else if(e.options.lineWiseCopyCut){var b=Ff(e);U={lineWise:!0,text:b.text};"cut"==a.type?e.setSelections(b.ranges,null,pa):(d.prevInput="",g.value=b.text.join("\n"),nb(g))}else return;"cut"==a.type&&(e.state.cutIncoming=!0)}}var c=this,d=this,e=this.cm,f=this.wrapper=Hf(),g=this.textarea=f.firstChild;a.wrapper.insertBefore(f,a.wrapper.firstChild);Rb&&(g.style.width=
"0px");w(g,"input",function(){B&&9<=F&&c.hasSelection&&(c.hasSelection=null);d.poll()});w(g,"paste",function(a){K(e,a)||Ef(a,e)||(e.state.pasteIncoming=!0,d.fastPoll())});w(g,"cut",b);w(g,"copy",b);w(a.scroller,"paste",function(b){sa(a,b)||K(e,b)||(e.state.pasteIncoming=!0,d.focus())});w(a.lineSpace,"selectstart",function(b){sa(a,b)||Q(b)});w(g,"compositionstart",function(){var a=e.getCursor("from");d.composing&&d.composing.range.clear();d.composing={start:a,range:e.markText(a,e.getCursor("to"),{className:"CodeMirror-composing"})}});
w(g,"compositionend",function(){d.composing&&(d.poll(),d.composing.range.clear(),d.composing=null)})};J.prototype.prepareSelection=function(){var a=this.cm,b=a.display,c=a.doc,d=Ae(a);if(a.options.moveInputWithCursor){var a=ta(a,c.sel.primary().head,"div"),c=b.wrapper.getBoundingClientRect(),e=b.lineDiv.getBoundingClientRect();d.teTop=Math.max(0,Math.min(b.wrapper.clientHeight-10,a.top+e.top-c.top));d.teLeft=Math.max(0,Math.min(b.wrapper.clientWidth-10,a.left+e.left-c.left))}return d};J.prototype.showSelection=
function(a){var b=this.cm.display;D(b.cursorDiv,a.cursors);D(b.selectionDiv,a.selection);null!=a.teTop&&(this.wrapper.style.top=a.teTop+"px",this.wrapper.style.left=a.teLeft+"px")};J.prototype.reset=function(a){if(!this.contextMenuPending){var b,c,d=this.cm,e=d.doc;d.somethingSelected()?(this.prevInput="",b=e.sel.primary(),c=(b=vf&&(100<b.to().line-b.from().line||1E3<(c=d.getSelection()).length))?"-":c||d.getSelection(),this.textarea.value=c,d.state.focused&&nb(this.textarea),B&&9<=F&&(this.hasSelection=
c)):a||(this.prevInput=this.textarea.value="",B&&9<=F&&(this.hasSelection=null));this.inaccurateSelection=b}};J.prototype.getField=function(){return this.textarea};J.prototype.supportsTouch=function(){return!1};J.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!pb||ba()!=this.textarea))try{this.textarea.focus()}catch(a){}};J.prototype.blur=function(){this.textarea.blur()};J.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0};J.prototype.receivedFocus=
function(){this.slowPoll()};J.prototype.slowPoll=function(){var a=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){a.poll();a.cm.state.focused&&a.slowPoll()})};J.prototype.fastPoll=function(){function a(){c.poll()||b?(c.pollingFast=!1,c.slowPoll()):(b=!0,c.polling.set(60,a))}var b=!1,c=this;c.pollingFast=!0;c.polling.set(20,a)};J.prototype.poll=function(){var a=this,b=this.cm,c=this.textarea,d=this.prevInput;if(this.contextMenuPending||!b.state.focused||Rg(c)&&!d&&!this.composing||
b.isReadOnly()||b.options.disableInput||b.state.keySeq)return!1;var e=c.value;if(e==d&&!b.somethingSelected())return!1;if(B&&9<=F&&this.hasSelection===e||ga&&/[\uf700-\uf7ff]/.test(e))return b.display.input.reset(),!1;if(b.doc.sel==b.display.selForContextMenu){var f=e.charCodeAt(0);8203!=f||d||(d="\u200b");if(8666==f)return this.reset(),this.cm.execCommand("undo")}for(var g=0,f=Math.min(d.length,e.length);g<f&&d.charCodeAt(g)==e.charCodeAt(g);)++g;aa(b,function(){Ld(b,e.slice(g),d.length-g,null,a.composing?
"*compose":null);1E3<e.length||-1<e.indexOf("\n")?c.value=a.prevInput="":a.prevInput=e;a.composing&&(a.composing.range.clear(),a.composing.range=b.markText(a.composing.start,b.getCursor("to"),{className:"CodeMirror-composing"}))});return!0};J.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)};J.prototype.onKeyPress=function(){B&&9<=F&&(this.hasSelection=null);this.fastPoll()};J.prototype.onContextMenu=function(a){function b(){if(null!=g.selectionStart){var a=e.somethingSelected(),
b="\u200b"+(a?g.value:"");g.value="\u21da";g.value=b;d.prevInput=a?"":"\u200b";g.selectionStart=1;g.selectionEnd=b.length;f.selForContextMenu=e.doc.sel}}function c(){d.contextMenuPending=!1;d.wrapper.style.cssText=m;g.style.cssText=l;B&&9>F&&f.scrollbars.setScrollTop(f.scroller.scrollTop=k);if(null!=g.selectionStart){(!B||B&&9>F)&&b();var a=0,c=function(){f.selForContextMenu==e.doc.sel&&0==g.selectionStart&&0<g.selectionEnd&&"\u200b"==d.prevInput?L(e,af)(e):10>a++?f.detectingSelectAll=setTimeout(c,
500):f.input.reset()};f.detectingSelectAll=setTimeout(c,200)}}var d=this,e=d.cm,f=e.display,g=d.textarea,h=Oa(e,a),k=f.scroller.scrollTop;if(h&&!ha){e.options.resetSelectionOnContextMenu&&-1==e.doc.sel.contains(h)&&L(e,P)(e.doc,va(h),pa);var l=g.style.cssText,m=d.wrapper.style.cssText;d.wrapper.style.cssText="position: absolute";h=d.wrapper.getBoundingClientRect();g.style.cssText="position: absolute; width: 30px; height: 30px;\n      top: "+(a.clientY-h.top-5)+"px; left: "+(a.clientX-h.left-5)+"px;\n      z-index: 1000; background: "+
(B?"rgba(255, 255, 255, .05)":"transparent")+";\n      outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";var n;N&&(n=window.scrollY);f.input.focus();N&&window.scrollTo(null,n);f.input.reset();e.somethingSelected()||(g.value=d.prevInput=" ");d.contextMenuPending=!0;f.selForContextMenu=e.doc.sel;clearTimeout(f.detectingSelectAll);B&&9<=F&&b();if(Id){tb(a);var p=function(){fa(window,"mouseup",p);setTimeout(c,20)};w(window,"mouseup",p)}else setTimeout(c,
50)}};J.prototype.readOnlyChanged=function(a){a||this.reset()};J.prototype.setUneditable=function(){};J.prototype.needsContentAttribute=!1;(function(a){function b(b,e,f,g){a.defaults[b]=e;f&&(c[b]=g?function(a,b,d){d!=lb&&f(a,b,d)}:f)}var c=a.optionHandlers;a.defineOption=b;a.Init=lb;b("value","",function(a,b){return a.setValue(b)},!0);b("mode",null,function(a,b){a.doc.modeOption=b;Ad(a)},!0);b("indentUnit",2,Ad,!0);b("indentWithTabs",!1);b("smartIndent",!0);b("tabSize",4,function(a){Gb(a);Ab(a);
R(a)},!0);b("lineSeparator",null,function(a,b){if(a.doc.lineSep=b){var d=[],c=a.doc.first;a.doc.iter(function(a){for(var e=0;;){var f=a.text.indexOf(b,e);if(-1==f)break;e=f+b.length;d.push(q(c,f))}c++});for(var e=d.length-1;0<=e;e--)hb(a.doc,b,d[e],q(d[e].line,d[e].ch+b.length))}});b("specialChars",/[\u0000-\u001f\u007f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(a,b,c){a.state.specialChars=new RegExp(b.source+(b.test("\t")?"":"|\t"),"g");c!=lb&&a.refresh()});b("specialCharPlaceholder",
bg,function(a){return a.refresh()},!0);b("electricChars",!0);b("inputStyle",pb?"contenteditable":"textarea",function(){throw Error("inputStyle can not (yet) be changed in a running editor");},!0);b("spellcheck",!1,function(a,b){return a.getInputField().spellcheck=b},!0);b("rtlMoveVisually",!Qg);b("wholeLineUpdateBefore",!0);b("theme","default",function(a){zf(a);Pb(a)},!0);b("keyMap","default",function(a,b,c){b=zc(b);(c=c!=lb&&zc(c))&&c.detach&&c.detach(a,b);b.attach&&b.attach(a,c||null)});b("extraKeys",
null);b("lineWrapping",!1,Jg,!0);b("gutters",[],function(a){yd(a.options);Pb(a)},!0);b("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?od(a.display)+"px":"0";a.refresh()},!0);b("coverGutterNextToScrollbar",!1,function(a){return ab(a)},!0);b("scrollbarStyle","native",function(a){Ie(a);ab(a);a.display.scrollbars.setScrollTop(a.doc.scrollTop);a.display.scrollbars.setScrollLeft(a.doc.scrollLeft)},!0);b("lineNumbers",!1,function(a){yd(a.options);Pb(a)},!0);b("firstLineNumber",1,Pb,!0);b("lineNumberFormatter",
function(a){return a},Pb,!0);b("showCursorWhenSelecting",!1,Bb,!0);b("resetSelectionOnContextMenu",!0);b("lineWiseCopyCut",!0);b("readOnly",!1,function(a,b){"nocursor"==b?(Cb(a),a.display.input.blur(),a.display.disabled=!0):a.display.disabled=!1;a.display.input.readOnlyChanged(b)});b("disableInput",!1,function(a,b){b||a.display.input.reset()},!0);b("dragDrop",!0,Ig);b("allowDropFileTypes",null);b("cursorBlinkRate",530);b("cursorScrollMargin",0);b("cursorHeight",1,Bb,!0);b("singleCursorHeightPerLine",
!0,Bb,!0);b("workTime",100);b("workDelay",100);b("flattenSpans",!0,Gb,!0);b("addModeClass",!1,Gb,!0);b("pollInterval",100);b("undoDepth",200,function(a,b){return a.doc.history.undoDepth=b});b("historyEventDelay",1250);b("viewportMargin",10,function(a){return a.refresh()},!0);b("maxHighlightLength",1E4,Gb,!0);b("moveInputWithCursor",!0,function(a,b){b||a.display.input.resetPosition()});b("tabindex",null,function(a,b){return a.display.input.getField().tabIndex=b||""});b("autofocus",null)})(G);(function(a){var b=
a.optionHandlers,c=a.helpers={};a.prototype={constructor:a,focus:function(){window.focus();this.display.input.focus()},setOption:function(a,c){var d=this.options,e=d[a];if(d[a]!=c||"mode"==a)d[a]=c,b.hasOwnProperty(a)&&L(this,b[a])(this,c,e),I(this,"optionChange",this,a)},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](zc(a))},removeKeyMap:function(a){for(var b=this.state.keyMaps,d=0;d<b.length;++d)if(b[d]==
a||b[d].name==a)return b.splice(d,1),!0},addOverlay:S(function(b,c){var d=b.token?b:a.getMode(this.options,b);if(d.startState)throw Error("Overlays may not be stateful.");Nf(this.state.overlays,{mode:d,modeSpec:b,opaque:c&&c.opaque,priority:c&&c.priority||0},function(a){return a.priority});this.state.modeGen++;R(this)}),removeOverlay:S(function(a){for(var b=this.state.overlays,d=0;d<b.length;++d){var c=b[d].modeSpec;if(c==a||"string"==typeof a&&c.name==a){b.splice(d,1);this.state.modeGen++;R(this);
break}}}),indentLine:S(function(a,b,c){"string"!=typeof b&&"number"!=typeof b&&(b=null==b?this.options.smartIndent?"smart":"prev":b?"add":"subtract");qb(this.doc,a)&&Qb(this,a,b,c)}),indentSelection:S(function(a){for(var b=this.doc.sel.ranges,d=-1,c=0;c<b.length;c++){var h=b[c];if(h.empty())h.head.line>d&&(Qb(this,h.head.line,a,!0),d=h.head.line,c==this.doc.sel.primIndex&&bb(this));else{for(var k=h.from(),h=h.to(),l=Math.max(d,k.line),d=Math.min(this.lastLine(),h.line-(h.ch?0:1))+1,h=l;h<d;++h)Qb(this,
h,a);h=this.doc.sel.ranges;0==k.ch&&b.length==h.length&&0<h[c].from().ch&&Dd(this.doc,c,new A(k,h[c].to()),pa)}}}),getTokenAt:function(a,b){return ge(this,a,b)},getLineTokens:function(a,b){return ge(this,q(a),b,!0)},getTokenTypeAt:function(a){a=z(this.doc,a);var b=ee(this,v(this.doc,a.line)),d=0,c=(b.length-1)/2;a=a.ch;if(0==a)b=b[2];else for(;;){var h=d+c>>1;if((h?b[2*h-1]:0)>=a)c=h;else if(b[2*h+1]<a)d=h+1;else{b=b[2*h+2];break}}d=b?b.indexOf("overlay "):-1;return 0>d?b:0==d?null:b.slice(0,d-1)},
getModeAt:function(b){var d=this.doc.mode;return d.innerMode?a.innerMode(d,this.getTokenAt(b).state).mode:d},getHelper:function(a,b){return this.getHelpers(a,b)[0]},getHelpers:function(a,b){var d=[];if(!c.hasOwnProperty(b))return d;var e=c[b];a=this.getModeAt(a);if("string"==typeof a[b])e[a[b]]&&d.push(e[a[b]]);else if(a[b])for(var h=0;h<a[b].length;h++){var k=e[a[b][h]];k&&d.push(k)}else a.helperType&&e[a.helperType]?d.push(e[a.helperType]):e[a.name]&&d.push(e[a.name]);for(b=0;b<e._global.length;b++)h=
e._global[b],h.pred(a,this)&&-1==M(d,h.val)&&d.push(h.val);return d},getStateAfter:function(a,b){var d=this.doc;a=Math.max(d.first,Math.min(null==a?d.first+d.size-1:a,d.first+d.size-1));return ub(this,a+1,b)},cursorCoords:function(a,b){var d=this.doc.sel.primary();a=null==a?d.head:"object"==typeof a?z(this.doc,a):a?d.from():d.to();return ta(this,a,b||"page")},charCoords:function(a,b){return lc(this,z(this.doc,a),b||"page")},coordsChar:function(a,b){a=xe(this,a,b||"page");return nd(this,a.left,a.top)},
lineAtHeight:function(a,b){a=xe(this,{top:a,left:0},b||"page").top;return Ga(this.doc,a+this.display.viewOffset)},heightAtLine:function(a,b,c){var d=!1;if("number"==typeof a){var e=this.doc.first+this.doc.size-1;a<this.doc.first?a=this.doc.first:a>e&&(a=e,d=!0);a=v(this.doc,a)}return md(this,a,{top:0,left:0},b||"page",c).top+(d?this.doc.height-la(a):0)},defaultTextHeight:function(){return Ma(this.display)},defaultCharWidth:function(){return zb(this.display)},getViewport:function(){return{from:this.display.viewFrom,
to:this.display.viewTo}},addWidget:function(a,b,c,g,h){var d=this.display;a=ta(this,z(this.doc,a));var e=a.bottom,f=a.left;b.style.position="absolute";b.setAttribute("cm-ignore-events","true");this.display.input.setUneditable(b);d.sizer.appendChild(b);if("over"==g)e=a.top;else if("above"==g||"near"==g){var n=Math.max(d.wrapper.clientHeight,this.doc.height),p=Math.max(d.sizer.clientWidth,d.lineSpace.clientWidth);("above"==g||a.bottom+b.offsetHeight>n)&&a.top>b.offsetHeight?e=a.top-b.offsetHeight:a.bottom+
b.offsetHeight<=n&&(e=a.bottom);f+b.offsetWidth>p&&(f=p-b.offsetWidth)}b.style.top=e+"px";b.style.left=b.style.right="";"right"==h?(f=d.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==h?f=0:"middle"==h&&(f=(d.sizer.clientWidth-b.offsetWidth)/2),b.style.left=f+"px");c&&(a=pc(this,f,e,f+b.offsetWidth,e+b.offsetHeight),null!=a.scrollTop&&Db(this,a.scrollTop),null!=a.scrollLeft&&$a(this,a.scrollLeft))},triggerOnKeyDown:S(uf),triggerOnKeyPress:S(xf),triggerOnKeyUp:wf,execCommand:function(a){if(Bc.hasOwnProperty(a))return Bc[a].call(null,
this)},triggerElectric:S(function(a){Df(this,a)}),findPosH:function(a,b,c,g){var d=1;0>b&&(d=-1,b=-b);a=z(this.doc,a);for(var e=0;e<b&&(a=Nd(this.doc,a,d,c,g),!a.hitSide);++e);return a},moveH:S(function(a,b){var c=this;this.extendSelectionsBy(function(d){return c.display.shift||c.doc.extend||d.empty()?Nd(c.doc,d.head,a,b,c.options.rtlMoveVisually):0>a?d.from():d.to()},Sb)}),deleteH:S(function(a,b){var c=this.doc;this.doc.sel.somethingSelected()?c.replaceSelection("",null,"+delete"):kb(this,function(d){var e=
Nd(c,d.head,a,b,!1);return 0>a?{from:e,to:d.head}:{from:d.head,to:e}})}),findPosV:function(a,b,c,g){var d=1;0>b&&(d=-1,b=-b);var e=z(this.doc,a);for(a=0;a<b&&(e=ta(this,e,"div"),null==g?g=e.left:e.left=g,e=If(this,e,d,c),!e.hitSide);++a);return e},moveV:S(function(a,b){var c=this,d=this.doc,e=[],k=!this.display.shift&&!d.extend&&d.sel.somethingSelected();d.extendSelectionsBy(function(f){if(k)return 0>a?f.from():f.to();var g=ta(c,f.head,"div");null!=f.goalColumn&&(g.left=f.goalColumn);e.push(g.left);
var h=If(c,g,a,b);"page"==b&&f==d.sel.primary()&&qc(c,null,lc(c,h,"div").top-g.top);return h},Sb);if(e.length)for(var l=0;l<d.sel.ranges.length;l++)d.sel.ranges[l].goalColumn=e[l]}),findWordAt:function(a){var b=v(this.doc,a.line).text,c=a.ch,d=a.ch;if(b){var h=this.getHelper(a,"wordChars");(0>a.xRel||d==b.length)&&c?--c:++d;for(var k=b.charAt(c),k=Zb(k,h)?function(a){return Zb(a,h)}:/\s/.test(k)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!Zb(a)};0<c&&k(b.charAt(c-1));)--c;for(;d<
b.length&&k(b.charAt(d));)++d}return new A(q(a.line,c),q(a.line,d))},toggleOverwrite:function(a){if(null==a||a!=this.state.overwrite)(this.state.overwrite=!this.state.overwrite)?Sa(this.display.cursorDiv,"CodeMirror-overwrite"):Za(this.display.cursorDiv,"CodeMirror-overwrite"),I(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==ba()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:S(function(a,b){null==
a&&null==b||rc(this);null!=a&&(this.curOp.scrollLeft=a);null!=b&&(this.curOp.scrollTop=b)}),getScrollInfo:function(){var a=this.display.scroller;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-oa(this)-this.display.barHeight,width:a.scrollWidth-oa(this)-this.display.barWidth,clientHeight:id(this),clientWidth:Ka(this)}},scrollIntoView:S(function(a,b){null==a?(a={from:this.doc.sel.primary().head,to:null},null==b&&(b=this.options.cursorScrollMargin)):"number"==typeof a?a={from:q(a,0),
to:null}:null==a.from&&(a={from:a,to:null});a.to||(a.to=a.from);a.margin=b||0;null!=a.from.line?(rc(this),this.curOp.scrollToPos=a):(a=pc(this,Math.min(a.from.left,a.to.left),Math.min(a.from.top,a.to.top)-a.margin,Math.max(a.from.right,a.to.right),Math.max(a.from.bottom,a.to.bottom)+a.margin),this.scrollTo(a.scrollLeft,a.scrollTop))}),setSize:S(function(a,b){var c=this,d=function(a){return"number"==typeof a||/^\d+$/.test(String(a))?a+"px":a};null!=a&&(this.display.wrapper.style.width=d(a));null!=
b&&(this.display.wrapper.style.height=d(b));this.options.lineWrapping&&we(this);var e=this.display.viewFrom;this.doc.iter(e,this.display.viewTo,function(a){if(a.widgets)for(var b=0;b<a.widgets.length;b++)if(a.widgets[b].noHScroll){za(c,e,"widget");break}++e});this.curOp.forceUpdate=!0;I(this,"refresh",this)}),operation:function(a){return aa(this,a)},refresh:S(function(){var a=this.display.cachedTextHeight;R(this);this.curOp.forceUpdate=!0;Ab(this);this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop);
td(this);(null==a||.5<Math.abs(a-Ma(this.display)))&&pd(this);I(this,"refresh",this)}),swapDoc:S(function(a){var b=this.doc;b.cm=null;Qe(this,a);Ab(this);this.display.input.reset();this.scrollTo(a.scrollLeft,a.scrollTop);this.curOp.forceScroll=!0;X(this,"swapDoc",this,b);return b}),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}};
Ta(a);a.registerHelper=function(b,e,f){c.hasOwnProperty(b)||(c[b]=a[b]={_global:[]});c[b][e]=f};a.registerGlobalHelper=function(b,e,f,g){a.registerHelper(b,e,g);c[b]._global.push({pred:f,val:g})}})(G);var Tg="iter insert remove copy getEditor constructor".split(" "),Wb;for(Wb in T.prototype)T.prototype.hasOwnProperty(Wb)&&0>M(Tg,Wb)&&(G.prototype[Wb]=function(a){return function(){return a.apply(this.doc,arguments)}}(T.prototype[Wb]));Ta(T);G.inputStyles={textarea:J,contenteditable:E};G.defineMode=
function(a){G.defaults.mode||"null"==a||(G.defaults.mode=a);Vf.apply(this,arguments)};G.defineMIME=function(a,b){Ua[a]=b};G.defineMode("null",function(){return{token:function(a){return a.skipToEnd()}}});G.defineMIME("text/plain","null");G.defineExtension=function(a,b){G.prototype[a]=b};G.defineDocExtension=function(a,b){T.prototype[a]=b};G.fromTextArea=function(a,b){function c(){a.value=h.getValue()}b=b?Da(b):{};b.value=a.value;!b.tabindex&&a.tabIndex&&(b.tabindex=a.tabIndex);!b.placeholder&&a.placeholder&&
(b.placeholder=a.placeholder);if(null==b.autofocus){var d=ba();b.autofocus=d==a||null!=a.getAttribute("autofocus")&&d==document.body}var e;if(a.form&&(w(a.form,"submit",c),!b.leaveSubmitMethodAlone)){var f=a.form;e=f.submit;try{var g=f.submit=function(){c();f.submit=e;f.submit();f.submit=g}}catch(k){}}b.finishInit=function(b){b.save=c;b.getTextArea=function(){return a};b.toTextArea=function(){b.toTextArea=isNaN;c();a.parentNode.removeChild(b.getWrapperElement());a.style.display="";a.form&&(fa(a.form,
"submit",c),"function"==typeof a.form.submit&&(a.form.submit=e))}};a.style.display="none";var h=G(function(b){return a.parentNode.insertBefore(b,a.nextSibling)},b);return h};(function(a){a.off=fa;a.on=w;a.wheelEventPixels=ig;a.Doc=T;a.splitLines=Md;a.countColumn=ca;a.findColumn=Kc;a.isWordChar=Mc;a.Pass=Fd;a.signal=I;a.Line=Wa;a.changeEnd=Aa;a.scrollbarModel=Je;a.Pos=q;a.cmpPos=u;a.modes=$c;a.mimeModes=Ua;a.resolveMode=hc;a.getMode=ad;a.modeExtensions=Va;a.extendMode=Wf;a.copyState=qa;a.startState=
be;a.innerMode=bd;a.commands=Bc;a.keyMap=Ob;a.keyName=pf;a.isModifierKey=of;a.lookupKey=jb;a.normalizeKeyMap=xg;a.StringStream=vb;a.SharedTextMarker=Nb;a.TextMarker=Ba;a.LineWidget=Mb;a.e_preventDefault=Q;a.e_stopPropagation=$d;a.e_stop=tb;a.addClass=Sa;a.contains=V;a.rmClass=Za;a.keyNames=Ca})(G);G.version="5.22.0";return G});
