var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(t,K,F){t instanceof String&&(t=String(t));for(var z=t.length,w=0;w<z;w++){var B=t[w];if(K.call(F,B,w,t))return{i:w,v:B}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.ISOLATE_POLYFILLS=!1;$jscomp.FORCE_POLYFILL_PROMISE=!1;$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1;
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(t,K,F){if(t==Array.prototype||t==Object.prototype)return t;t[K]=F.value;return t};$jscomp.getGlobal=function(t){t=["object"==typeof globalThis&&globalThis,t,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var K=0;K<t.length;++K){var F=t[K];if(F&&F.Math==Math)return F}throw Error("Cannot find global object");};$jscomp.global=$jscomp.getGlobal(this);
$jscomp.IS_SYMBOL_NATIVE="function"===typeof Symbol&&"symbol"===typeof Symbol("x");$jscomp.TRUST_ES6_POLYFILLS=!$jscomp.ISOLATE_POLYFILLS||$jscomp.IS_SYMBOL_NATIVE;$jscomp.polyfills={};$jscomp.propertyToPolyfillSymbol={};$jscomp.POLYFILL_PREFIX="$jscp$";var $jscomp$lookupPolyfilledValue=function(t,K){var F=$jscomp.propertyToPolyfillSymbol[K];if(null==F)return t[K];F=t[F];return void 0!==F?F:t[K]};
$jscomp.polyfill=function(t,K,F,z){K&&($jscomp.ISOLATE_POLYFILLS?$jscomp.polyfillIsolated(t,K,F,z):$jscomp.polyfillUnisolated(t,K,F,z))};$jscomp.polyfillUnisolated=function(t,K,F,z){F=$jscomp.global;t=t.split(".");for(z=0;z<t.length-1;z++){var w=t[z];if(!(w in F))return;F=F[w]}t=t[t.length-1];z=F[t];K=K(z);K!=z&&null!=K&&$jscomp.defineProperty(F,t,{configurable:!0,writable:!0,value:K})};
$jscomp.polyfillIsolated=function(t,K,F,z){var w=t.split(".");t=1===w.length;z=w[0];z=!t&&z in $jscomp.polyfills?$jscomp.polyfills:$jscomp.global;for(var B=0;B<w.length-1;B++){var I=w[B];if(!(I in z))return;z=z[I]}w=w[w.length-1];F=$jscomp.IS_SYMBOL_NATIVE&&"es6"===F?z[w]:null;K=K(F);null!=K&&(t?$jscomp.defineProperty($jscomp.polyfills,w,{configurable:!0,writable:!0,value:K}):K!==F&&(void 0===$jscomp.propertyToPolyfillSymbol[w]&&(F=1E9*Math.random()>>>0,$jscomp.propertyToPolyfillSymbol[w]=$jscomp.IS_SYMBOL_NATIVE?
$jscomp.global.Symbol(w):$jscomp.POLYFILL_PREFIX+F+"$"+w),$jscomp.defineProperty(z,$jscomp.propertyToPolyfillSymbol[w],{configurable:!0,writable:!0,value:K})))};$jscomp.polyfill("Array.prototype.find",function(t){return t?t:function(K,F){return $jscomp.findInternal(this,K,F).v}},"es6","es3");
(function(t,K){"object"===typeof exports&&"undefined"!==typeof module?module.exports=K():"function"===typeof define&&define.amd?define(K):(t=t||self,t.CodeMirror=K())})(this,function(){function t(a){return new RegExp("(^|\\s)"+a+"(?:$|\\s)\\s*")}function K(a){for(var b=a.childNodes.length;0<b;--b)a.removeChild(a.firstChild);return a}function F(a,b){return K(a).appendChild(b)}function z(a,b,d,c){a=document.createElement(a);d&&(a.className=d);c&&(a.style.cssText=c);if("string"==typeof b)a.appendChild(document.createTextNode(b));
else if(b)for(d=0;d<b.length;++d)a.appendChild(b[d]);return a}function w(a,b,d,c){a=z(a,b,d,c);a.setAttribute("role","presentation");return a}function B(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 I(a){var b=a.ownerDocument||a;try{var d=a.activeElement}catch(c){d=b.body||null}for(;d&&d.shadowRoot&&d.shadowRoot.activeElement;)d=d.shadowRoot.activeElement;return d}function D(a,b){var d=a.className;
t(b).test(d)||(a.className+=(d?" ":"")+b)}function M(a,b){a=a.split(" ");for(var d=0;d<a.length;d++)a[d]&&!t(a[d]).test(b)&&(b+=" "+a[d]);return b}function R(a){return a.display.wrapper.ownerDocument}function v(a){return a.getRootNode?a.getRootNode():a.ownerDocument}function A(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function n(a,b,d){b||(b={});for(var c in a)!a.hasOwnProperty(c)||!1===d&&b.hasOwnProperty(c)||(b[c]=a[c]);return b}function q(a,b,d,
c,e){null==b&&(b=a.search(/[^\s\u00a0]/),-1==b&&(b=a.length));c=c||0;for(e=e||0;;){var f=a.indexOf("\t",c);if(0>f||f>=b)return e+(b-c);e+=f-c;e+=d-e%d;c=f+1}}function x(a,b){for(var d=0;d<a.length;++d)if(a[d]==b)return d;return-1}function E(a,b,d){for(var c=0,e=0;;){var f=a.indexOf("\t",c);-1==f&&(f=a.length);var g=f-c;if(f==a.length||e+g>=b)return c+Math.min(g,b-e);e+=f-c;e+=d-e%d;c=f+1;if(e>=b)return c}}function L(a){for(;Mc.length<=a;)Mc.push(O(Mc)+" ");return Mc[a]}function O(a){return a[a.length-
1]}function J(a,b){for(var d=[],c=0;c<a.length;c++)d[c]=b(a[c],c);return d}function da(a,b,d){for(var c=0,e=d(b);c<a.length&&d(a[c])<=e;)c++;a.splice(c,0,b)}function aa(){}function ta(a,b){Object.create?a=Object.create(a):(aa.prototype=a,a=new aa);b&&n(b,a);return a}function fa(a){return/\w/.test(a)||"\u0080"<a&&(a.toUpperCase()!=a.toLowerCase()||Bg.test(a))}function za(a,b){return b?-1<b.source.indexOf("\\w")&&fa(a)?!0:b.test(a):fa(a)}function P(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;
return!0}function V(a){return 768<=a.charCodeAt(0)&&Cg.test(a)}function y(a,b,d){for(;(0>d?0<b:b<a.length)&&V(a.charAt(b));)b+=d;return b}function G(a,b,d){for(var c=b>d?-1:1;;){if(b==d)return b;var e=(b+d)/2;e=0>c?Math.ceil(e):Math.floor(e);if(e==b)return a(e)?b:d;a(e)?d=e:b=e+c}}function Q(a,b,d,c){if(!a)return c(b,d,"ltr",0);for(var e=!1,f=0;f<a.length;++f){var g=a[f];if(g.from<d&&g.to>b||b==d&&g.to==b)c(Math.max(g.from,b),Math.min(g.to,d),1==g.level?"rtl":"ltr",f),e=!0}e||c(b,d,"ltr")}function X(a,
b,d){var c;bc=null;for(var e=0;e<a.length;++e){var f=a[e];if(f.from<b&&f.to>b)return e;f.to==b&&(f.from!=f.to&&"before"==d?c=e:bc=e);f.from==b&&(f.from!=f.to&&"before"!=d?c=e:bc=e)}return null!=c?c:bc}function ea(a,b){var d=a.order;null==d&&(d=a.order=Dg(a.text,b));return d}function Z(a,b,d){if(a.removeEventListener)a.removeEventListener(b,d,!1);else if(a.detachEvent)a.detachEvent("on"+b,d);else{var c=(a=a._handlers)&&a[b];c&&(d=x(c,d),-1<d&&(a[b]=c.slice(0,d).concat(c.slice(d+1))))}}function S(a,
b){var d=a._handlers&&a._handlers[b]||Nc;if(d.length)for(var c=Array.prototype.slice.call(arguments,2),e=0;e<d.length;++e)d[e].apply(null,c)}function ja(a,b,d){"string"==typeof b&&(b={type:b,preventDefault:function(){this.defaultPrevented=!0}});S(a,d||b.type,a,b);return ud(b)||b.codemirrorIgnore}function Ba(a){var b=a._handlers&&a._handlers.cursorActivity;if(b){a=a.curOp.cursorActivityHandlers||(a.curOp.cursorActivityHandlers=[]);for(var d=0;d<b.length;++d)-1==x(a,b[d])&&a.push(b[d])}}function ia(a,
b){return 0<(a._handlers&&a._handlers[b]||Nc).length}function Pa(a){a.prototype.on=function(b,d){W(this,b,d)};a.prototype.off=function(b,d){Z(this,b,d)}}function ka(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function Ib(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function ud(a){return null!=a.defaultPrevented?a.defaultPrevented:0==a.returnValue}function cc(a){ka(a);Ib(a)}function ze(a){var b=a.which;null==b&&(a.button&1?b=1:a.button&2?b=3:a.button&4&&(b=2));Ua&&a.ctrlKey&&
1==b&&(b=3);return b}function Eg(a,b){2<arguments.length&&(b.dependencies=Array.prototype.slice.call(arguments,2));vd[a]=b}function Oc(a){if("string"==typeof a&&Jb.hasOwnProperty(a))a=Jb[a];else if(a&&"string"==typeof a.name&&Jb.hasOwnProperty(a.name)){var b=Jb[a.name];"string"==typeof b&&(b={name:b});a=ta(b,a);a.name=b.name}else{if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return Oc("application/xml");if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+json$/.test(a))return Oc("application/json")}return"string"==
typeof a?{name:a}:a||{name:"null"}}function wd(a,b){b=Oc(b);var d=vd[b.name];if(!d)return wd(a,"text/plain");a=d(a,b);if(Kb.hasOwnProperty(b.name)){d=Kb[b.name];for(var c in d)d.hasOwnProperty(c)&&(a.hasOwnProperty(c)&&(a["_"+c]=a[c]),a[c]=d[c])}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 Fg(a,b){a=Kb.hasOwnProperty(a)?Kb[a]:Kb[a]={};n(b,a)}function sb(a,b){if(!0===b)return b;if(a.copyState)return a.copyState(b);
a={};for(var d in b){var c=b[d];c instanceof Array&&(c=c.concat([]));a[d]=c}return a}function xd(a,b){for(var d;a.innerMode;){d=a.innerMode(b);if(!d||d.mode==a)break;b=d.state;a=d.mode}return d||{mode:a,state:b}}function Ae(a,b,d){return a.startState?a.startState(b,d):!0}function T(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 d=0;;++d){var c=a.children[d],e=c.chunkSize();if(b<e){a=c;break}b-=e}return a.lines[b]}function tb(a,
b,d){var c=[],e=b.line;a.iter(b.line,d.line+1,function(f){f=f.text;e==d.line&&(f=f.slice(0,d.ch));e==b.line&&(f=f.slice(b.ch));c.push(f);++e});return c}function yd(a,b,d){var c=[];a.iter(b,d,function(e){c.push(e.text)});return c}function $a(a,b){if(b-=a.height)for(;a;a=a.parent)a.height+=b}function qa(a){if(null==a.parent)return null;var b=a.parent;a=x(b.lines,a);for(var d=b.parent;d;b=d,d=d.parent)for(var c=0;d.children[c]!=b;++c)a+=d.children[c].chunkSize();return a+b.first}function ub(a,b){var d=
a.first;a:do{for(var c=0;c<a.children.length;++c){var e=a.children[c],f=e.height;if(b<f){a=e;continue a}b-=f;d+=e.chunkSize()}return d}while(!a.lines);for(c=0;c<a.lines.length;++c){e=a.lines[c].height;if(b<e)break;b-=e}return d+c}function dc(a,b){return b>=a.first&&b<a.first+a.size}function zd(a,b){return String(a.lineNumberFormatter(b+a.firstLineNumber))}function H(a,b,d){void 0===d&&(d=null);if(!(this instanceof H))return new H(a,b,d);this.line=a;this.ch=b;this.sticky=d}function ba(a,b){return a.line-
b.line||a.ch-b.ch}function Ad(a,b){return a.sticky==b.sticky&&0==ba(a,b)}function Bd(a){return H(a.line,a.ch)}function Pc(a,b){return 0>ba(a,b)?b:a}function Qc(a,b){return 0>ba(a,b)?a:b}function ca(a,b){if(b.line<a.first)return H(a.first,0);var d=a.first+a.size-1;if(b.line>d)return H(d,T(a,d).text.length);a=T(a,b.line).text.length;d=b.ch;b=null==d||d>a?H(b.line,a):0>d?H(b.line,0):b;return b}function Be(a,b){for(var d=[],c=0;c<b.length;c++)d[c]=ca(a,b[c]);return d}function Ce(a,b,d,c){var e=[a.state.modeGen],
f={};De(a,b.text,a.doc.mode,d,function(k,l){return e.push(k,l)},f,c);var g=d.state;c=function(k){d.baseTokens=e;var l=a.state.overlays[k],m=1,p=0;d.state=!0;De(a,b.text,l.mode,d,function(r,u){for(var C=m;p<r;){var N=e[m];N>r&&e.splice(m,1,r,e[m+1],N);m+=2;p=Math.min(r,N)}if(u)if(l.opaque)e.splice(C,m-C,r,"overlay "+u),m=C+2;else for(;C<m;C+=2)r=e[C+1],e[C+1]=(r?r+" ":"")+"overlay "+u},f);d.state=g;d.baseTokens=null;d.baseTokenPos=1};for(var h=0;h<a.state.overlays.length;++h)c(h);return{styles:e,classes:f.bgClass||
f.textClass?f:null}}function Ee(a,b,d){if(!b.styles||b.styles[0]!=a.state.modeGen){var c=ec(a,qa(b)),e=b.text.length>a.options.maxHighlightLength&&sb(a.doc.mode,c.state),f=Ce(a,b,c);e&&(c.state=e);b.stateAfter=c.save(!e);b.styles=f.styles;f.classes?b.styleClasses=f.classes:b.styleClasses&&(b.styleClasses=null);d===a.doc.highlightFrontier&&(a.doc.modeFrontier=Math.max(a.doc.modeFrontier,++a.doc.highlightFrontier))}return b.styles}function ec(a,b,d){var c=a.doc,e=a.display;if(!c.mode.startState)return new ab(c,
!0,b);var f=Gg(a,b,d),g=f>c.first&&T(c,f-1).stateAfter,h=g?ab.fromSaved(c,g,f):new ab(c,Ae(c.mode),f);c.iter(f,b,function(k){Cd(a,k.text,h);var l=h.line;k.stateAfter=l==b-1||0==l%5||l>=e.viewFrom&&l<e.viewTo?h.save():null;h.nextLine()});d&&(c.modeFrontier=h.line);return h}function Cd(a,b,d,c){var e=a.doc.mode;a=new Ca(b,a.options.tabSize,d);a.start=a.pos=c||0;for(""==b&&Fe(e,d.state);!a.eol();)Dd(e,a,d.state),a.start=a.pos}function Fe(a,b){if(a.blankLine)return a.blankLine(b);if(a.innerMode&&(a=xd(a,
b),a.mode.blankLine))return a.mode.blankLine(a.state)}function Dd(a,b,d,c){for(var e=0;10>e;e++){c&&(c[0]=xd(a,d).mode);var f=a.token(b,d);if(b.pos>b.start)return f}throw Error("Mode "+a.name+" failed to advance stream.");}function Ge(a,b,d,c){var e=a.doc,f=e.mode;b=ca(e,b);var g=T(e,b.line);d=ec(a,b.line,d);a=new Ca(g.text,a.options.tabSize,d);var h;for(c&&(h=[]);(c||a.pos<b.ch)&&!a.eol();){a.start=a.pos;var k=Dd(f,a,d.state);c&&h.push(new He(a,k,sb(e.mode,d.state)))}return c?h:new He(a,k,d.state)}
function Ie(a,b){if(a)for(;;){var d=a.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!d)break;a=a.slice(0,d.index)+a.slice(d.index+d[0].length);var c=d[1]?"bgClass":"textClass";null==b[c]?b[c]=d[2]:(new RegExp("(?:^|\\s)"+d[2]+"(?:$|\\s)")).test(b[c])||(b[c]+=" "+d[2])}return a}function De(a,b,d,c,e,f,g){var h=d.flattenSpans;null==h&&(h=a.options.flattenSpans);var k=0,l=null,m=new Ca(b,a.options.tabSize,c),p=a.options.addModeClass&&[null];for(""==b&&Ie(Fe(d,c.state),f);!m.eol();){if(m.pos>a.options.maxHighlightLength){h=
!1;g&&Cd(a,b,c,m.pos);m.pos=b.length;var r=null}else r=Ie(Dd(d,m,c.state,p),f);if(p){var u=p[0].name;u&&(r="m-"+(r?u+" "+r:u))}if(!h||l!=r){for(;k<m.start;)k=Math.min(m.start,k+5E3),e(k,l);l=r}m.start=m.pos}for(;k<m.pos;)a=Math.min(m.pos,k+5E3),e(a,l),k=a}function Gg(a,b,d){for(var c,e,f=a.doc,g=d?-1:b-(a.doc.mode.innerMode?1E3:100);b>g;--b){if(b<=f.first)return f.first;var h=T(f,b-1),k=h.stateAfter;if(k&&(!d||b+(k instanceof Rc?k.lookAhead:0)<=f.modeFrontier))return b;h=q(h.text,null,a.options.tabSize);
if(null==e||c>h)e=b-1,c=h}return e}function Hg(a,b){a.modeFrontier=Math.min(a.modeFrontier,b);if(!(a.highlightFrontier<b-10)){for(var d=a.first,c=b-1;c>d;c--){var e=T(a,c).stateAfter;if(e&&(!(e instanceof Rc)||c+e.lookAhead<b)){d=c+1;break}}a.highlightFrontier=Math.min(a.highlightFrontier,d)}}function Sc(a,b,d){this.marker=a;this.from=b;this.to=d}function fc(a,b){if(a)for(var d=0;d<a.length;++d){var c=a[d];if(c.marker==b)return c}}function Ed(a,b){if(b.full)return null;var d=dc(a,b.from.line)&&T(a,
b.from.line).markedSpans,c=dc(a,b.to.line)&&T(a,b.to.line).markedSpans;if(!d&&!c)return null;a=b.from.ch;var e=b.to.ch,f=0==ba(b.from,b.to),g;if(d)for(var h=0;h<d.length;++h){var k=d[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 Sc(l,k.from,m?null:k.to))}}d=g;var p;if(c)for(g=0;g<c.length;++g)if(h=c[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),(p||(p=[])).push(new Sc(k,l?null:h.from-e,null==h.to?null:h.to-e));c=1==b.text.length;e=O(b.text).length+(c?a:0);if(d)for(f=0;f<d.length;++f)if(g=d[f],null==g.to)(h=fc(p,g.marker),h)?c&&(g.to=null==h.to?null:h.to+e):g.to=a;if(p)for(a=0;a<p.length;++a)f=p[a],null!=f.to&&(f.to+=e),null==f.from?fc(d,f.marker)||(f.from=e,c&&(d||(d=[])).push(f)):(f.from+=e,c&&(d||(d=[])).push(f));d&&
(d=Je(d));p&&p!=d&&(p=Je(p));a=[d];if(!c){b=b.text.length-2;var r;if(0<b&&d)for(c=0;c<d.length;++c)null==d[c].to&&(r||(r=[])).push(new Sc(d[c].marker,null,null));for(d=0;d<b;++d)a.push(r);a.push(p)}return a}function Je(a){for(var b=0;b<a.length;++b){var d=a[b];null!=d.from&&d.from==d.to&&!1!==d.marker.clearWhenEmpty&&a.splice(b--,1)}return a.length?a:null}function Ig(a,b,d){var c=null;a.iter(b.line,d.line+1,function(m){if(m.markedSpans)for(var p=0;p<m.markedSpans.length;++p){var r=m.markedSpans[p].marker;
!r.readOnly||c&&-1!=x(c,r)||(c||(c=[])).push(r)}});if(!c)return null;a=[{from:b,to:d}];for(b=0;b<c.length;++b){d=c[b];for(var e=d.find(0),f=0;f<a.length;++f){var g=a[f];if(!(0>ba(g.to,e.from)||0<ba(g.from,e.to))){var h=[f,1],k=ba(g.from,e.from),l=ba(g.to,e.to);(0>k||!d.inclusiveLeft&&!k)&&h.push({from:g.from,to:e.from});(0<l||!d.inclusiveRight&&!l)&&h.push({from:e.to,to:g.to});a.splice.apply(a,h);f+=h.length-3}}}return a}function Ke(a){var b=a.markedSpans;if(b){for(var d=0;d<b.length;++d)b[d].marker.detachLine(a);
a.markedSpans=null}}function Le(a,b){if(b){for(var d=0;d<b.length;++d)b[d].marker.attachLine(a);a.markedSpans=b}}function Fd(a,b){var d=a.lines.length-b.lines.length;if(0!=d)return d;d=a.find();var c=b.find(),e=ba(d.from,c.from)||(a.inclusiveLeft?-1:0)-(b.inclusiveLeft?-1:0);return e?-e:(d=ba(d.to,c.to)||(a.inclusiveRight?1:0)-(b.inclusiveRight?1:0))?d:b.id-a.id}function Lb(a,b){a=eb&&a.markedSpans;if(a)for(var d,c=0;c<a.length;++c)if(d=a[c],d.marker.collapsed&&null==(b?d.from:d.to)&&(!e||0>Fd(e,
d.marker)))var e=d.marker;return e}function Me(a,b,d,c,e){a=T(a,b);if(a=eb&&a.markedSpans)for(b=0;b<a.length;++b){var f=a[b];if(f.marker.collapsed){var g=f.marker.find(0),h=ba(g.from,d)||(f.marker.inclusiveLeft?-1:0)-(e.inclusiveLeft?-1:0),k=ba(g.to,c)||(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<=ba(g.to,d):0<ba(g.to,d))||0<=h&&(f.marker.inclusiveRight&&e.inclusiveLeft?0>=ba(g.from,c):0>ba(g.from,c))))return!0}}}
function Va(a){for(var b;b=Lb(a,!0);)a=b.find(-1,!0).line;return a}function Gd(a,b){a=T(a,b);var d=Va(a);return a==d?b:qa(d)}function Ne(a,b){if(b>a.lastLine())return b;var d=T(a,b);if(!jb(a,d))return b;for(;a=Lb(d,!1);)d=a.find(1,!0).line;return qa(d)+1}function jb(a,b){var d=eb&&b.markedSpans;if(d)for(var c,e=0;e<d.length;++e)if(c=d[e],c.marker.collapsed&&(null==c.from||!c.marker.widgetNode&&0==c.from&&c.marker.inclusiveLeft&&Hd(a,b,c)))return!0}function Hd(a,b,d){if(null==d.to)return b=d.marker.find(1,
!0),Hd(a,b.line,fc(b.line.markedSpans,d.marker));if(d.marker.inclusiveRight&&d.to==b.text.length)return!0;for(var c,e=0;e<b.markedSpans.length;++e)if(c=b.markedSpans[e],c.marker.collapsed&&!c.marker.widgetNode&&c.from==d.to&&(null==c.to||c.to!=d.from)&&(c.marker.inclusiveLeft||d.marker.inclusiveRight)&&Hd(a,b,c))return!0}function bb(a){a=Va(a);for(var b=0,d=a.parent,c=0;c<d.lines.length;++c){var e=d.lines[c];if(e==a)break;else b+=e.height}for(a=d.parent;a;d=a,a=d.parent)for(c=0;c<a.children.length&&
(e=a.children[c],e!=d);++c)b+=e.height;return b}function Tc(a){if(0==a.height)return 0;for(var b=a.text.length,d,c=a;d=Lb(c,!0);)d=d.find(0,!0),c=d.from.line,b+=d.from.ch-d.to.ch;for(c=a;d=Lb(c,!1);)a=d.find(0,!0),b-=c.text.length-a.from.ch,c=a.to.line,b+=c.text.length-a.to.ch;return b}function Id(a){var b=a.display;a=a.doc;b.maxLine=T(a,a.first);b.maxLineLength=Tc(b.maxLine);b.maxLineChanged=!0;a.iter(function(d){var c=Tc(d);c>b.maxLineLength&&(b.maxLineLength=c,b.maxLine=d)})}function Oe(a,b){if(!a||
/^\s*$/.test(a))return null;b=b.addModeClass?Jg:Kg;return b[a]||(b[a]=a.replace(/\S+/g,"cm-$&"))}function Pe(a,b){var d=w("span",null,null,Ia?"padding-right: .1px":null);d={pre:w("pre",[d],"CodeMirror-line"),content:d,col:0,pos:0,cm:a,trailingSpace:!1,splitSpaces:a.getOption("lineWrapping")};b.measure={};for(var c=0;c<=(b.rest?b.rest.length:0);c++){var e=c?b.rest[c-1]:b.line,f=void 0;d.pos=0;d.addToken=Lg;var g=a.display.measure;if(null!=Jd)g=Jd;else{var h=F(g,document.createTextNode("A\u062eA")),
k=gc(h,0,1).getBoundingClientRect();h=gc(h,1,2).getBoundingClientRect();K(g);g=k&&k.left!=k.right?Jd=3>h.right-k.right:!1}g&&(f=ea(e,a.doc.direction))&&(d.addToken=Mg(d.addToken,f));d.map=[];var l=b!=a.display.externalMeasured&&qa(e);a:{var m=h=k=g=void 0,p=void 0,r=void 0,u=void 0;f=d;l=Ee(a,e,l);var C=e.markedSpans,N=e.text,Y=0;if(C)for(var Da=N.length,U=0,sa=1,oa="",ua=0;;){if(ua==U){p=m=h=r="";k=g=null;ua=Infinity;for(var wa=[],ha=void 0,va=0;va<C.length;++va){var ma=C[va],pa=ma.marker;if("bookmark"==
pa.type&&ma.from==U&&pa.widgetNode)wa.push(pa);else if(ma.from<=U&&(null==ma.to||ma.to>U||pa.collapsed&&ma.to==U&&ma.from==U)){null!=ma.to&&ma.to!=U&&ua>ma.to&&(ua=ma.to,m="");pa.className&&(p+=" "+pa.className);pa.css&&(r=(r?r+";":"")+pa.css);pa.startStyle&&ma.from==U&&(h+=" "+pa.startStyle);pa.endStyle&&ma.to==ua&&(ha||(ha=[])).push(pa.endStyle,ma.to);pa.title&&((g||(g={})).title=pa.title);if(pa.attributes)for(var Ja in pa.attributes)(g||(g={}))[Ja]=pa.attributes[Ja];pa.collapsed&&(!k||0>Fd(k.marker,
pa))&&(k=ma)}else ma.from>U&&ua>ma.from&&(ua=ma.from)}if(ha)for(va=0;va<ha.length;va+=2)ha[va+1]==ua&&(m+=" "+ha[va]);if(!k||k.from==U)for(ha=0;ha<wa.length;++ha)Qe(f,0,wa[ha]);if(k&&(k.from||0)==U){Qe(f,(null==k.to?Da+1:k.to)-U,k.marker,null==k.from);if(null==k.to)break a;k.to==U&&(k=!1)}}if(U>=Da)break;for(wa=Math.min(Da,ua);;){if(oa){ha=U+oa.length;k||(va=ha>wa?oa.slice(0,wa-U):oa,f.addToken(f,va,u?u+p:p,h,U+va.length==ua?m:"",r,g));if(ha>=wa){oa=oa.slice(wa-U);U=wa;break}U=ha;h=""}oa=N.slice(Y,
Y=l[sa++]);u=Oe(l[sa++],f.cm.options)}}else for(g=1;g<l.length;g+=2)f.addToken(f,N.slice(Y,Y=l[g]),Oe(l[g+1],f.cm.options))}e.styleClasses&&(e.styleClasses.bgClass&&(d.bgClass=M(e.styleClasses.bgClass,d.bgClass||"")),e.styleClasses.textClass&&(d.textClass=M(e.styleClasses.textClass,d.textClass||"")));0==d.map.length&&(e=d.map,f=e.push,g=d.content,k=g.appendChild,h=a.display.measure,null==Kd&&(m=z("span","\u200b"),F(h,z("span",[m,document.createTextNode("x")])),0!=h.firstChild.offsetHeight&&(Kd=1>=
m.offsetWidth&&2<m.offsetHeight&&!(la&&8>xa))),h=Kd?z("span","\u200b"):z("span","\u00a0",null,"display: inline-block; width: 1px; margin-right: -1px"),h.setAttribute("cm-text",""),f.call(e,0,0,k.call(g,h)));0==c?(b.measure.map=d.map,b.measure.cache={}):((b.measure.maps||(b.measure.maps=[])).push(d.map),(b.measure.caches||(b.measure.caches=[])).push({}))}Ia&&(Ja=d.content.lastChild,/\bcm-tab\b/.test(Ja.className)||Ja.querySelector&&Ja.querySelector(".cm-tab"))&&(d.content.className="cm-tab-wrap-hack");
S(a,"renderLine",a,b.line,d.pre);d.pre.className&&(d.textClass=M(d.pre.className,d.textClass||""));return d}function Ng(a){var b=z("span","\u2022","cm-invalidchar");b.title="\\u"+a.charCodeAt(0).toString(16);b.setAttribute("aria-label",b.title);return b}function Lg(a,b,d,c,e,f,g){if(b){if(a.splitSpaces){var h=a.trailingSpace;if(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 p=0;;){l.lastIndex=p;var r=l.exec(b),u=r?r.index-p:b.length-p;if(u){var C=document.createTextNode(k.slice(p,p+u));la&&9>xa?h.appendChild(z("span",[C])):h.appendChild(C);a.map.push(a.pos,a.pos+u,C);a.col+=u;a.pos+=u}if(!r)break;p+=u+1;"\t"==r[0]?(r=a.cm.options.tabSize,r-=a.col%r,u=h.appendChild(z("span",L(r),"cm-tab")),u.setAttribute("role","presentation"),u.setAttribute("cm-text","\t"),a.col+=r):("\r"==
r[0]||"\n"==r[0]?(u=h.appendChild(z("span","\r"==r[0]?"\u240d":"\u2424","cm-invalidchar")),u.setAttribute("cm-text",r[0])):(u=a.cm.options.specialCharPlaceholder(r[0]),u.setAttribute("cm-text",r[0]),la&&9>xa?h.appendChild(z("span",[u])):h.appendChild(u)),a.col+=1);a.map.push(a.pos,a.pos+1,u);a.pos++}}else a.col+=b.length,h=document.createTextNode(k),a.map.push(a.pos,a.pos+b.length,h),la&&9>xa&&(m=!0),a.pos+=b.length;a.trailingSpace=32==k.charCodeAt(b.length-1);if(d||c||e||m||f||g){b=d||"";c&&(b+=
c);e&&(b+=e);c=z("span",[h],b,f);if(g)for(var N in g)g.hasOwnProperty(N)&&"style"!=N&&"class"!=N&&c.setAttribute(N,g[N]);return a.content.appendChild(c)}a.content.appendChild(h)}}function Mg(a,b){return function(d,c,e,f,g,h,k){e=e?e+" cm-force-border":"cm-force-border";for(var l=d.pos,m=l+c.length;;){for(var p=void 0,r=0;r<b.length&&!(p=b[r],p.to>l&&p.from<=l);r++);if(p.to>=m)return a(d,c,e,f,g,h,k);a(d,c.slice(0,p.to-l),e,f,null,h,k);f=null;c=c.slice(p.to-l);l=p.to}}}function Qe(a,b,d,c){var e=!c&&
d.widgetNode;e&&a.map.push(a.pos,a.pos+b,e);!c&&a.cm.display.input.needsContentAttribute&&(e||(e=a.content.appendChild(document.createElement("span"))),e.setAttribute("cm-marker",d.id));e&&(a.cm.display.input.setUneditable(e),a.content.appendChild(e));a.pos+=b;a.trailingSpace=!1}function Re(a,b,d){for(var c=this.line=b,e;c=Lb(c,!1);)c=c.find(1,!0).line,(e||(e=[])).push(c);this.size=(this.rest=e)?qa(O(this.rest))-d+1:1;this.node=this.text=null;this.hidden=jb(a,b)}function Uc(a,b,d){var c=[],e;for(e=
b;e<d;)b=new Re(a.doc,T(a.doc,e),e),e+=b.size,c.push(b);return c}function Og(a,b){if(a=a.ownsGroup)try{var d=a.delayedCallbacks,c=0;do{for(;c<d.length;c++)d[c].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(c<d.length)}finally{Mb=null,b(a)}}function Ea(a,b){var d=a._handlers&&a._handlers[b]||Nc;if(d.length){var c=Array.prototype.slice.call(arguments,
2);if(Mb)var e=Mb.delayedCallbacks;else hc?e=hc:(e=hc=[],setTimeout(Pg,0));for(var f=function(h){e.push(function(){return d[h].apply(null,c)})},g=0;g<d.length;++g)f(g)}}function Pg(){var a=hc;hc=null;for(var b=0;b<a.length;++b)a[b]()}function Se(a,b,d,c){for(var e=0;e<b.changes.length;e++){var f=b.changes[e];if("text"==f){f=a;var g=b,h=g.text.className,k=Te(f,g);g.text==g.node&&(g.node=k.pre);g.text.parentNode.replaceChild(k.pre,g.text);g.text=k.pre;k.bgClass!=g.bgClass||k.textClass!=g.textClass?
(g.bgClass=k.bgClass,g.textClass=k.textClass,Ld(f,g)):h&&(g.text.className=h)}else if("gutter"==f)Ue(a,b,d,c);else if("class"==f)Ld(a,b);else if("widget"==f){f=a;g=b;h=c;g.alignable&&(g.alignable=null);k=t("CodeMirror-linewidget");for(var l=g.node.firstChild,m;l;l=m)m=l.nextSibling,k.test(l.className)&&g.node.removeChild(l);Ve(f,g,h)}}b.changes=null}function ic(a){a.node==a.text&&(a.node=z("div",null,null,"position: relative"),a.text.parentNode&&a.text.parentNode.replaceChild(a.node,a.text),a.node.appendChild(a.text),
la&&8>xa&&(a.node.style.zIndex=2));return a.node}function Te(a,b){var d=a.display.externalMeasured;return d&&d.line==b.line?(a.display.externalMeasured=null,b.measure=d.measure,d.built):Pe(a,b)}function Ld(a,b){var d=b.bgClass?b.bgClass+" "+(b.line.bgClass||""):b.line.bgClass;d&&(d+=" CodeMirror-linebackground");if(b.background)d?b.background.className=d:(b.background.parentNode.removeChild(b.background),b.background=null);else if(d){var c=ic(b);b.background=c.insertBefore(z("div",null,d),c.firstChild);
a.display.input.setUneditable(b.background)}b.line.wrapClass?ic(b).className=b.line.wrapClass:b.node!=b.text&&(b.node.className="");b.text.className=(b.textClass?b.textClass+" "+(b.line.textClass||""):b.line.textClass)||""}function Ue(a,b,d,c){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=ic(b);b.gutterBackground=z("div",null,"CodeMirror-gutter-background "+b.line.gutterClass,
"left: "+(a.options.fixedGutter?c.fixedPos:-c.gutterTotalWidth)+"px; width: "+c.gutterTotalWidth+"px");a.display.input.setUneditable(b.gutterBackground);e.insertBefore(b.gutterBackground,b.text)}e=b.line.gutterMarkers;if(a.options.lineNumbers||e){var f=ic(b),g=b.gutter=z("div",null,"CodeMirror-gutter-wrapper","left: "+(a.options.fixedGutter?c.fixedPos:-c.gutterTotalWidth)+"px");g.setAttribute("aria-hidden","true");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(z("div",zd(a.options,d),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+c.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+a.display.lineNumInnerWidth+"px")));if(e)for(b=0;b<a.display.gutterSpecs.length;++b)d=a.display.gutterSpecs[b].className,(f=e.hasOwnProperty(d)&&e[d])&&g.appendChild(z("div",[f],"CodeMirror-gutter-elt","left: "+c.gutterLeft[d]+"px; width: "+c.gutterWidth[d]+"px"))}}
function Qg(a,b,d,c){var e=Te(a,b);b.text=b.node=e.pre;e.bgClass&&(b.bgClass=e.bgClass);e.textClass&&(b.textClass=e.textClass);Ld(a,b);Ue(a,b,d,c);Ve(a,b,c);return b.node}function Ve(a,b,d){We(a,b.line,b,d,!0);if(b.rest)for(var c=0;c<b.rest.length;c++)We(a,b.rest[c],b,d,!1)}function We(a,b,d,c,e){if(b.widgets){var f=ic(d),g=0;for(b=b.widgets;g<b.length;++g){var h=b[g],k=z("div",[h.node],"CodeMirror-linewidget"+(h.className?" "+h.className:""));h.handleMouseEvents||k.setAttribute("cm-ignore-events",
"true");var l=h,m=k,p=c;if(l.noHScroll){(d.alignable||(d.alignable=[])).push(m);var r=p.wrapperWidth;m.style.left=p.fixedPos+"px";l.coverGutter||(r-=p.gutterTotalWidth,m.style.paddingLeft=p.gutterTotalWidth+"px");m.style.width=r+"px"}l.coverGutter&&(m.style.zIndex=5,m.style.position="relative",l.noHScroll||(m.style.marginLeft=-p.gutterTotalWidth+"px"));a.display.input.setUneditable(k);e&&h.above?f.insertBefore(k,d.gutter||d.text):f.appendChild(k);Ea(h,"redraw")}}}function jc(a){if(null!=a.height)return a.height;
var b=a.doc.cm;if(!b)return 0;if(!B(document.body,a.node)){var d="position: relative;";a.coverGutter&&(d+="margin-left: -"+b.display.gutters.offsetWidth+"px;");a.noHScroll&&(d+="width: "+b.display.wrapper.clientWidth+"px;");F(b.display.measure,z("div",[a.node],null,d))}return a.height=a.node.parentNode.offsetHeight}function fb(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 Md(a){return a.mover.offsetHeight-
a.lineSpace.offsetHeight}function Xe(a){if(a.cachedPaddingH)return a.cachedPaddingH;var b=F(a.measure,z("pre","x","CodeMirror-line-like"));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 cb(a){return 50-a.display.nativeBarWidth}function vb(a){return a.display.scroller.clientWidth-cb(a)-a.display.barWidth}function Nd(a){return a.display.scroller.clientHeight-
cb(a)-a.display.barHeight}function Ye(a,b,d){if(a.line==b)return{map:a.measure.map,cache:a.measure.cache};if(a.rest){for(var c=0;c<a.rest.length;c++)if(a.rest[c]==b)return{map:a.measure.maps[c],cache:a.measure.caches[c]};for(b=0;b<a.rest.length;b++)if(qa(a.rest[b])>d)return{map:a.measure.maps[b],cache:a.measure.caches[b],before:!0}}}function Od(a,b){if(b>=a.display.viewFrom&&b<a.display.viewTo)return a.display.view[wb(a,b)];if((a=a.display.externalMeasured)&&b>=a.lineN&&b<a.lineN+a.size)return a}
function xb(a,b){var d=qa(b),c=Od(a,d);c&&!c.text?c=null:c&&c.changes&&(Se(a,c,d,Pd(a)),a.curOp.forceUpdate=!0);if(!c){var e=Va(b);c=qa(e);e=a.display.externalMeasured=new Re(a.doc,e,c);e.lineN=c;c=e.built=Pe(a,e);e.text=c.pre;F(a.display.lineMeasure,c.pre);c=e}a=Ye(c,b,d);return{line:b,view:c,rect:null,map:a.map,cache:a.cache,before:a.before,hasHeights:!1}}function Wa(a,b,d,c,e){b.before&&(d=-1);var f=d+(c||"");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&&vb(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++){l=g[k];var p=g[k+1];2<Math.abs(l.bottom-p.bottom)&&m.push((l.bottom+p.top)/2-h.top)}m.push(h.bottom-h.top)}b.hasHeights=!0}m=c;g=Ze(b.map,d,m);c=g.node;h=g.start;k=g.end;d=g.collapse;if(3==c.nodeType){for(var r=0;4>r;r++){for(;h&&V(b.line.text.charAt(g.coverStart+h));)--h;
for(;g.coverStart+k<g.coverEnd&&V(b.line.text.charAt(g.coverStart+k));)++k;if(la&&9>xa&&0==h&&k==g.coverEnd-g.coverStart)var u=c.parentNode.getBoundingClientRect();else{u=gc(c,h,k).getClientRects();k=$e;if("left"==m)for(l=0;l<u.length&&(k=u[l]).left==k.right;l++);else for(l=u.length-1;0<=l&&(k=u[l]).left==k.right;l--);u=k}if(u.left||u.right||0==h)break;k=h;--h;d="right"}la&&11>xa&&((r=!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI)||(null!=Qd?r=Qd:(m=F(a.display.measure,
z("span","x")),r=m.getBoundingClientRect(),m=gc(m,0,1).getBoundingClientRect(),r=Qd=1<Math.abs(r.left-m.left)),r=!r),r||(r=screen.logicalXDPI/screen.deviceXDPI,m=screen.logicalYDPI/screen.deviceYDPI,u={left:u.left*r,right:u.right*r,top:u.top*m,bottom:u.bottom*m}))}else 0<h&&(d=m="right"),u=a.options.lineWrapping&&1<(r=c.getClientRects()).length?r["right"==m?r.length-1:0]:c.getBoundingClientRect();!(la&&9>xa)||h||u&&(u.left||u.right)||(u=(u=c.parentNode.getClientRects()[0])?{left:u.left,right:u.left+
Nb(a.display),top:u.top,bottom:u.bottom}:$e);c=u.top-b.rect.top;h=u.bottom-b.rect.top;r=(c+h)/2;m=b.view.measure.heights;for(g=0;g<m.length-1&&!(r<m[g]);g++);d={left:("right"==d?u.right:u.left)-b.rect.left,right:("left"==d?u.left:u.right)-b.rect.left,top:g?m[g-1]:0,bottom:m[g]};u.left||u.right||(d.bogus=!0);a.options.singleCursorHeightPerLine||(d.rtop=c,d.rbottom=h);a=d;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 Ze(a,b,d){for(var c,
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){c=a[l+2];h==k&&d==(c.insertLeft?"left":"right")&&(g=d);if("left"==d&&0==e)for(;l&&a[l-2]==a[l-3]&&a[l-1].insertLeft;)c=a[(l-=3)+2],g="left";if("right"==d&&e==k-h)for(;l<a.length-3&&a[l+3]==a[l+4]&&!a[l+5].insertLeft;)c=a[(l+=3)+2],g="right";break}}return{node:c,start:e,end:f,collapse:g,coverStart:h,coverEnd:k}}function af(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 bf(a){a.display.externalMeasure=null;K(a.display.lineMeasure);for(var b=0;b<a.display.view.length;b++)af(a.display.view[b])}function kc(a){bf(a);a.display.cachedCharWidth=a.display.cachedTextHeight=a.display.cachedPaddingH=null;a.options.lineWrapping||(a.display.maxLineChanged=!0);a.display.lineNumChars=null}function cf(a){return kb&&Vc?-(a.body.getBoundingClientRect().left-parseInt(getComputedStyle(a.body).marginLeft)):
a.defaultView.pageXOffset||(a.documentElement||a.body).scrollLeft}function df(a){return kb&&Vc?-(a.body.getBoundingClientRect().top-parseInt(getComputedStyle(a.body).marginTop)):a.defaultView.pageYOffset||(a.documentElement||a.body).scrollTop}function Rd(a){a=Va(a).widgets;var b=0;if(a)for(var d=0;d<a.length;++d)a[d].above&&(b+=jc(a[d]));return b}function Wc(a,b,d,c,e){e||(e=Rd(b),d.top+=e,d.bottom+=e);if("line"==c)return d;c||(c="local");b=bb(b);b="local"==c?b+a.display.lineSpace.offsetTop:b-a.display.viewOffset;
if("page"==c||"window"==c)e=a.display.lineSpace.getBoundingClientRect(),b+=e.top+("window"==c?0:df(R(a))),a=e.left+("window"==c?0:cf(R(a))),d.left+=a,d.right+=a;d.top+=b;d.bottom+=b;return d}function ef(a,b,d){if("div"==d)return b;var c=b.left;b=b.top;"page"==d?(c-=cf(R(a)),b-=df(R(a))):"local"!=d&&d||(d=a.display.sizer.getBoundingClientRect(),c+=d.left,b+=d.top);a=a.display.lineSpace.getBoundingClientRect();return{left:c-a.left,top:b-a.top}}function Xc(a,b,d,c,e){c||(c=T(a.doc,b.line));var f=c;b=
b.ch;c=Wa(a,xb(a,c),b,e);return Wc(a,f,c,d)}function Xa(a,b,d,c,e,f){function g(r,u){r=Wa(a,e,r,u?"right":"left",f);u?r.left=r.right:r.right=r.left;return Wc(a,c,r,d)}function h(r,u,C){return g(C?r-1:r,1==k[u].level!=C)}c=c||T(a.doc,b.line);e||(e=xb(a,c));var k=ea(c,a.doc.direction),l=b.ch;b=b.sticky;l>=c.text.length?(l=c.text.length,b="before"):0>=l&&(l=0,b="after");if(!k)return g("before"==b?l-1:l,"before"==b);var m=X(k,l,b),p=bc;m=h(l,m,"before"==b);null!=p&&(m.other=h(l,p,"before"!=b));return m}
function ff(a,b){var d=0;b=ca(a.doc,b);a.options.lineWrapping||(d=Nb(a.display)*b.ch);b=T(a.doc,b.line);a=bb(b)+a.display.lineSpace.offsetTop;return{left:d,right:d,top:a,bottom:a+b.height}}function Sd(a,b,d,c,e){a=H(a,b,d);a.xRel=e;c&&(a.outside=c);return a}function Td(a,b,d){var c=a.doc;d+=a.display.viewOffset;if(0>d)return Sd(c.first,0,null,-1,-1);var e=ub(c,d),f=c.first+c.size-1;if(e>f)return Sd(c.first+c.size-1,T(c,f).text.length,null,1,1);0>b&&(b=0);for(var g=T(c,e);;){f=Rg(a,g,e,b,d);var h=
void 0;var k=f.ch+(0<f.xRel||0<f.outside?1:0);if(g=eb&&g.markedSpans)for(var l=0;l<g.length;++l){var m=g[l];m.marker.collapsed&&(null==m.from||m.from<k)&&(null==m.to||m.to>k)&&(!h||0>Fd(h,m.marker))&&(h=m.marker)}if(!h)return f;f=h.find(1);if(f.line==e)return f;g=T(c,e=f.line)}}function gf(a,b,d,c){c-=Rd(b);b=b.text.length;var e=G(function(f){return Wa(a,d,f-1).bottom<=c},b,0);b=G(function(f){return Wa(a,d,f).top>c},e,b);return{begin:e,end:b}}function hf(a,b,d,c){d||(d=xb(a,b));c=Wc(a,b,Wa(a,d,c),
"line").top;return gf(a,b,d,c)}function Ud(a,b,d,c){return a.bottom<=d?!1:a.top>d?!0:(c?a.left:a.right)>b}function Rg(a,b,d,c,e){e-=bb(b);var f=xb(a,b),g=Rd(b),h=0,k=b.text.length,l=!0,m=ea(b,a.doc.direction);m&&(m=(a.options.lineWrapping?Sg:Tg)(a,b,d,f,m,c,e),h=(l=1!=m.level)?m.from:m.to-1,k=l?m.to:m.from-1);var p=null,r=null;m=G(function(C){var N=Wa(a,f,C);N.top+=g;N.bottom+=g;if(!Ud(N,c,e,!1))return!1;N.top<=e&&N.left<=c&&(p=C,r=N);return!0},h,k);var u=!1;r?(h=c-r.left<r.right-c,l=h==l,m=p+(l?
0:1),l=l?"after":"before",h=h?r.left:r.right):(l||m!=k&&m!=h||m++,l=0==m?"after":m==b.text.length?"before":Wa(a,f,m-(l?1:0)).bottom+g<=e==l?"after":"before",u=Xa(a,H(d,m,l),"line",b,f),h=u.left,u=e<u.top?-1:e>=u.bottom?1:0);m=y(b.text,m,1);return Sd(d,m,l,u,c-h)}function Tg(a,b,d,c,e,f,g){var h=G(function(m){m=e[m];var p=1!=m.level;return Ud(Xa(a,H(d,p?m.to:m.from,p?"before":"after"),"line",b,c),f,g,!0)},0,e.length-1),k=e[h];if(0<h){var l=1!=k.level;l=Xa(a,H(d,l?k.from:k.to,l?"after":"before"),"line",
b,c);Ud(l,f,g,!0)&&l.top>g&&(k=e[h-1])}return k}function Sg(a,b,d,c,e,f,g){g=gf(a,b,c,g);d=g.begin;g=g.end;/\s/.test(b.text.charAt(g-1))&&g--;for(var h=b=null,k=0;k<e.length;k++){var l=e[k];if(!(l.from>=g||l.to<=d)){var m=Wa(a,c,1!=l.level?Math.min(g,l.to)-1:Math.max(d,l.from)).right;m=m<f?f-m+1E9:m-f;if(!b||h>m)b=l,h=m}}b||(b=e[e.length-1]);b.from<d&&(b={from:d,to:b.to,level:b.level});b.to>g&&(b={from:b.from,to:g,level:b.level});return b}function Ob(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;
if(null==yb){yb=z("pre",null,"CodeMirror-line-like");for(var b=0;49>b;++b)yb.appendChild(document.createTextNode("x")),yb.appendChild(z("br"));yb.appendChild(document.createTextNode("x"))}F(a.measure,yb);b=yb.offsetHeight/50;3<b&&(a.cachedTextHeight=b);K(a.measure);return b||1}function Nb(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=z("span","xxxxxxxxxx"),d=z("pre",[b],"CodeMirror-line-like");F(a.measure,d);b=b.getBoundingClientRect();b=(b.right-b.left)/10;2<b&&(a.cachedCharWidth=
b);return b||10}function Pd(a){for(var b=a.display,d={},c={},e=b.gutters.clientLeft,f=b.gutters.firstChild,g=0;f;f=f.nextSibling,++g){var h=a.display.gutterSpecs[g].className;d[h]=f.offsetLeft+f.clientLeft+e;c[h]=f.clientWidth}return{fixedPos:Vd(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:d,gutterWidth:c,wrapperWidth:b.wrapper.clientWidth}}function Vd(a){return a.scroller.getBoundingClientRect().left-a.sizer.getBoundingClientRect().left}function jf(a){var b=Ob(a.display),d=a.options.lineWrapping,
c=d&&Math.max(5,a.display.scroller.clientWidth/Nb(a.display)-3);return function(e){if(jb(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 d?f+(Math.ceil(e.text.length/c)||1)*b:f+b}}function Wd(a){var b=a.doc,d=jf(a);b.iter(function(c){var e=d(c);e!=c.height&&$a(c,e)})}function zb(a,b,d,c){var e=a.display;if(!d&&"true"==(b.target||b.srcElement).getAttribute("cm-not-content"))return null;d=e.lineSpace.getBoundingClientRect();
try{var f=b.clientX-d.left;var g=b.clientY-d.top}catch(k){return null}b=Td(a,f,g);var h;c&&0<b.xRel&&(h=T(a.doc,b.line).text).length==b.ch&&(c=q(h,h.length,a.options.tabSize)-h.length,b=H(b.line,Math.max(0,Math.round((f-Xe(a.display).left)/Nb(a.display))-c)));return b}function wb(a,b){if(b>=a.display.viewTo)return null;b-=a.display.viewFrom;if(0>b)return null;a=a.display.view;for(var d=0;d<a.length;d++)if(b-=a[d].size,0>b)return d}function La(a,b,d,c){null==b&&(b=a.doc.first);null==d&&(d=a.doc.first+
a.doc.size);c||(c=0);var e=a.display;c&&d<e.viewTo&&(null==e.updateLineNumbers||e.updateLineNumbers>b)&&(e.updateLineNumbers=b);a.curOp.viewChanged=!0;if(b>=e.viewTo)eb&&Gd(a.doc,b)<e.viewTo&&lb(a);else if(d<=e.viewFrom)eb&&Ne(a.doc,d+c)>e.viewFrom?lb(a):(e.viewFrom+=c,e.viewTo+=c);else if(b<=e.viewFrom&&d>=e.viewTo)lb(a);else if(b<=e.viewFrom){var f=Yc(a,d,d+c,1);f?(e.view=e.view.slice(f.index),e.viewFrom=f.lineN,e.viewTo+=c):lb(a)}else if(d>=e.viewTo)(f=Yc(a,b,b,-1))?(e.view=e.view.slice(0,f.index),
e.viewTo=f.lineN):lb(a);else{f=Yc(a,b,b,-1);var g=Yc(a,d,d+c,1);f&&g?(e.view=e.view.slice(0,f.index).concat(Uc(a,f.lineN,g.lineN)).concat(e.view.slice(g.index)),e.viewTo+=c):lb(a)}if(a=e.externalMeasured)d<a.lineN?a.lineN+=c:b<a.lineN+a.size&&(e.externalMeasured=null)}function mb(a,b,d){a.curOp.viewChanged=!0;var c=a.display,e=a.display.externalMeasured;e&&b>=e.lineN&&b<e.lineN+e.size&&(c.externalMeasured=null);b<c.viewFrom||b>=c.viewTo||(a=c.view[wb(a,b)],null!=a.node&&(a=a.changes||(a.changes=[]),
-1==x(a,d)&&a.push(d)))}function lb(a){a.display.viewFrom=a.display.viewTo=a.doc.first;a.display.view=[];a.display.viewOffset=0}function Yc(a,b,d,c){var e=wb(a,b),f=a.display.view;if(!eb||d==a.doc.first+a.doc.size)return{index:e,lineN:d};for(var g=a.display.viewFrom,h=0;h<e;h++)g+=f[h].size;if(g!=b){if(0<c){if(e==f.length-1)return null;b=g+f[e].size-b;e++}else b=g-b;d+=b}for(;Gd(a.doc,d)!=d;){if(e==(0>c?0:f.length-1))return null;d+=c*f[e-(0>c?1:0)].size;e+=c}return{index:e,lineN:d}}function kf(a){a=
a.display.view;for(var b=0,d=0;d<a.length;d++){var c=a[d];c.hidden||c.node&&!c.changes||++b}return b}function lc(a){a.display.input.showSelection(a.display.input.prepareSelection())}function lf(a,b){void 0===b&&(b=!0);var d=a.doc,c={},e=c.cursors=document.createDocumentFragment(),f=c.selection=document.createDocumentFragment(),g=a.options.$customCursor;g&&(b=!0);for(var h=0;h<d.sel.ranges.length;h++)if(b||h!=d.sel.primIndex){var k=d.sel.ranges[h];if(!(k.from().line>=a.display.viewTo||k.to().line<
a.display.viewFrom)){var l=k.empty();if(g){var m=g(a,k);m&&Xd(a,m,e)}else(l||a.options.showCursorWhenSelecting)&&Xd(a,k.head,e);l||Ug(a,k,f)}}return c}function Xd(a,b,d){var c=Xa(a,b,"div",null,null,!a.options.singleCursorHeightPerLine),e=d.appendChild(z("div","\u00a0","CodeMirror-cursor"));e.style.left=c.left+"px";e.style.top=c.top+"px";e.style.height=Math.max(0,c.bottom-c.top)*a.options.cursorHeight+"px";/\bcm-fat-cursor\b/.test(a.getWrapperElement().className)&&(b=Xc(a,b,"div",null,null),b=b.right-
b.left,e.style.width=(0<b?b:a.defaultCharWidth())+"px");c.other&&(a=d.appendChild(z("div","\u00a0","CodeMirror-cursor CodeMirror-secondarycursor")),a.style.display="",a.style.left=c.other.left+"px",a.style.top=c.other.top+"px",a.style.height=.85*(c.other.bottom-c.other.top)+"px")}function Zc(a,b){return a.top-b.top||a.left-b.left}function Ug(a,b,d){function c(u,C,N,Y){0>C&&(C=0);C=Math.round(C);Y=Math.round(Y);h.appendChild(z("div",null,"CodeMirror-selected","position: absolute; left: "+u+"px;\n                             top: "+
C+"px; width: "+(null==N?m-u:N)+"px;\n                             height: "+(Y-C)+"px"))}function e(u,C,N){function Y(ha,va){return Xc(a,H(u,ha),"div",U,va)}function Da(ha,va,ma){ha=hf(a,U,null,ha);va="ltr"==va==("after"==ma)?"left":"right";ma="after"==ma?ha.begin:ha.end-(/\s/.test(U.text.charAt(ha.end-1))?2:1);return Y(ma,va)[va]}var U=T(g,u),sa=U.text.length,oa,ua,wa=ea(U,g.direction);Q(wa,C||0,null==N?sa:N,function(ha,va,ma,pa){var Ja="ltr"==ma,Ma=Y(ha,Ja?"left":"right"),Sa=Y(va-1,Ja?"right":
"left"),Ab=null==C&&0==ha,Bb=null==N&&va==sa,Yd=0==pa;pa=!wa||pa==wa.length-1;3>=Sa.top-Ma.top?(va=(p?Ab:Bb)&&Yd?l:(Ja?Ma:Sa).left,c(va,Ma.top,((p?Bb:Ab)&&pa?m:(Ja?Sa:Ma).right)-va,Ma.bottom)):(Ja?(Ja=p&&Ab&&Yd?l:Ma.left,Ab=p?m:Da(ha,ma,"before"),ha=p?l:Da(va,ma,"after"),Bb=p&&Bb&&pa?m:Sa.right):(Ja=p?Da(ha,ma,"before"):l,Ab=!p&&Ab&&Yd?m:Ma.right,ha=!p&&Bb&&pa?l:Sa.left,Bb=p?Da(va,ma,"after"):m),c(Ja,Ma.top,Ab-Ja,Ma.bottom),Ma.bottom<Sa.top&&c(l,Ma.bottom,null,Sa.top),c(ha,Sa.top,Bb-ha,Sa.bottom));
if(!oa||0>Zc(Ma,oa))oa=Ma;0>Zc(Sa,oa)&&(oa=Sa);if(!ua||0>Zc(Ma,ua))ua=Ma;0>Zc(Sa,ua)&&(ua=Sa)});return{start:oa,end:ua}}var f=a.display,g=a.doc,h=document.createDocumentFragment(),k=Xe(a.display),l=k.left,m=Math.max(f.sizerWidth,vb(a)-f.sizer.offsetLeft)-k.right,p="ltr"==g.direction;f=b.from();b=b.to();if(f.line==b.line)e(f.line,f.ch,b.ch);else{var r=T(g,f.line);k=T(g,b.line);k=Va(r)==Va(k);f=e(f.line,f.ch,k?r.text.length+1:null).end;b=e(b.line,k?0:null,b.ch).start;k&&(f.top<b.top-2?(c(f.right,f.top,
null,f.bottom),c(l,b.top,b.left,b.bottom)):c(f.right,f.top,b.left-f.right,f.bottom));f.bottom<b.top&&c(l,f.bottom,null,b.top)}d.appendChild(h)}function Zd(a){if(a.state.focused){var b=a.display;clearInterval(b.blinker);var d=!0;b.cursorDiv.style.visibility="";0<a.options.cursorBlinkRate?b.blinker=setInterval(function(){a.hasFocus()||Pb(a);b.cursorDiv.style.visibility=(d=!d)?"":"hidden"},a.options.cursorBlinkRate):0>a.options.cursorBlinkRate&&(b.cursorDiv.style.visibility="hidden")}}function mf(a){a.hasFocus()||
(a.display.input.focus(),a.state.focused||$d(a))}function ae(a){a.state.delayingBlurEvent=!0;setTimeout(function(){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1,a.state.focused&&Pb(a))},100)}function $d(a,b){a.state.delayingBlurEvent&&!a.state.draggingText&&(a.state.delayingBlurEvent=!1);"nocursor"!=a.options.readOnly&&(a.state.focused||(S(a,"focus",a,b),a.state.focused=!0,D(a.display.wrapper,"CodeMirror-focused"),a.curOp||a.display.selForContextMenu==a.doc.sel||(a.display.input.reset(),
Ia&&setTimeout(function(){return a.display.input.reset(!0)},20)),a.display.input.receivedFocus()),Zd(a))}function Pb(a,b){a.state.delayingBlurEvent||(a.state.focused&&(S(a,"blur",a,b),a.state.focused=!1,Cb(a.display.wrapper,"CodeMirror-focused")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.display.shift=!1)},150))}function $c(a){for(var b=a.display,d=b.lineDiv.offsetTop,c=Math.max(0,b.scroller.getBoundingClientRect().top),e=b.lineDiv.getBoundingClientRect().top,f=0,
g=0;g<b.view.length;g++){var h=b.view[g],k=a.options.lineWrapping,l=0;if(!h.hidden){e+=h.line.height;if(la&&8>xa){k=h.node.offsetTop+h.node.offsetHeight;var m=k-d;d=k}else{var p=h.node.getBoundingClientRect();m=p.bottom-p.top;!k&&h.text.firstChild&&(l=h.text.firstChild.getBoundingClientRect().right-p.left-1)}k=h.line.height-m;if(.005<k||-.005>k)if(e<c&&(f-=k),$a(h.line,m),nf(h.line),h.rest)for(m=0;m<h.rest.length;m++)nf(h.rest[m]);l>a.display.sizerWidth&&(l=Math.ceil(l/Nb(a.display)),l>a.display.maxLineLength&&
(a.display.maxLineLength=l,a.display.maxLine=h.line,a.display.maxLineChanged=!0))}}2<Math.abs(f)&&(b.scroller.scrollTop+=f)}function nf(a){if(a.widgets)for(var b=0;b<a.widgets.length;++b){var d=a.widgets[b],c=d.node.parentNode;c&&(d.height=c.offsetHeight)}}function ad(a,b,d){var c=d&&null!=d.top?Math.max(0,d.top):a.scroller.scrollTop;c=Math.floor(c-a.lineSpace.offsetTop);var e=d&&null!=d.bottom?d.bottom:c+a.wrapper.clientHeight;c=ub(b,c);e=ub(b,e);if(d&&d.ensure){var f=d.ensure.from.line;d=d.ensure.to.line;
f<c?(c=f,e=ub(b,bb(T(b,f))+a.wrapper.clientHeight)):Math.min(d,b.lastLine())>=e&&(c=ub(b,bb(T(b,d))-a.wrapper.clientHeight),e=d)}return{from:c,to:Math.max(e,c+1)}}function be(a,b){var d=a.display,c=Ob(a.display);0>b.top&&(b.top=0);var e=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:d.scroller.scrollTop,f=Nd(a),g={};b.bottom-b.top>f&&(b.bottom=b.top+f);var h=a.doc.height+Md(d),k=b.top<c;c=b.bottom>h-c;b.top<e?g.scrollTop=k?0:b.top:b.bottom>e+f&&(f=Math.min(b.top,(c?h:b.bottom)-f),f!=e&&(g.scrollTop=
f));e=a.options.fixedGutter?0:d.gutters.offsetWidth;f=a.curOp&&null!=a.curOp.scrollLeft?a.curOp.scrollLeft:d.scroller.scrollLeft-e;a=vb(a)-d.gutters.offsetWidth;if(d=b.right-b.left>a)b.right=b.left+a;10>b.left?g.scrollLeft=0:b.left<f?g.scrollLeft=Math.max(0,b.left+e-(d?0:10)):b.right>a+f-3&&(g.scrollLeft=b.right+(d?0:10)-a);return g}function bd(a,b){null!=b&&(cd(a),a.curOp.scrollTop=(null==a.curOp.scrollTop?a.doc.scrollTop:a.curOp.scrollTop)+b)}function Qb(a){cd(a);var b=a.getCursor();a.curOp.scrollToPos=
{from:b,to:b,margin:a.options.cursorScrollMargin}}function mc(a,b,d){null==b&&null==d||cd(a);null!=b&&(a.curOp.scrollLeft=b);null!=d&&(a.curOp.scrollTop=d)}function cd(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var d=ff(a,b.from),c=ff(a,b.to);of(a,d,c,b.margin)}}function of(a,b,d,c){b=be(a,{left:Math.min(b.left,d.left),top:Math.min(b.top,d.top)-c,right:Math.max(b.right,d.right),bottom:Math.max(b.bottom,d.bottom)+c});mc(a,b.scrollLeft,b.scrollTop)}function nc(a,b){2>Math.abs(a.doc.scrollTop-
b)||(gb||ce(a,{top:b}),pf(a,b,!0),gb&&ce(a),oc(a,100))}function pf(a,b,d){b=Math.max(0,Math.min(a.display.scroller.scrollHeight-a.display.scroller.clientHeight,b));if(a.display.scroller.scrollTop!=b||d)a.doc.scrollTop=b,a.display.scrollbars.setScrollTop(b),a.display.scroller.scrollTop!=b&&(a.display.scroller.scrollTop=b)}function Db(a,b,d,c){b=Math.max(0,Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth));(d?b==a.doc.scrollLeft:2>Math.abs(a.doc.scrollLeft-b))&&!c||(a.doc.scrollLeft=
b,qf(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbars.setScrollLeft(b))}function pc(a){var b=a.display,d=b.gutters.offsetWidth,c=Math.round(a.doc.height+Md(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?d:0,docHeight:c,scrollHeight:c+cb(a)+b.barHeight,nativeBarWidth:b.nativeBarWidth,
gutterWidth:d}}function Rb(a,b){b||(b=pc(a));var d=a.display.barWidth,c=a.display.barHeight;rf(a,b);for(b=0;4>b&&d!=a.display.barWidth||c!=a.display.barHeight;b++)d!=a.display.barWidth&&a.options.lineWrapping&&$c(a),rf(a,pc(a)),d=a.display.barWidth,c=a.display.barHeight}function rf(a,b){var d=a.display,c=d.scrollbars.update(b);d.sizer.style.paddingRight=(d.barWidth=c.right)+"px";d.sizer.style.paddingBottom=(d.barHeight=c.bottom)+"px";d.heightForcer.style.borderBottom=c.bottom+"px solid transparent";
c.right&&c.bottom?(d.scrollbarFiller.style.display="block",d.scrollbarFiller.style.height=c.bottom+"px",d.scrollbarFiller.style.width=c.right+"px"):d.scrollbarFiller.style.display="";c.bottom&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(d.gutterFiller.style.display="block",d.gutterFiller.style.height=c.bottom+"px",d.gutterFiller.style.width=b.gutterWidth+"px"):d.gutterFiller.style.display=""}function sf(a){a.display.scrollbars&&(a.display.scrollbars.clear(),a.display.scrollbars.addClass&&
Cb(a.display.wrapper,a.display.scrollbars.addClass));a.display.scrollbars=new tf[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,d){"horizontal"==d?Db(a,b):nc(a,b)},a);a.display.scrollbars.addClass&&D(a.display.wrapper,a.display.scrollbars.addClass)}function Eb(a){a.curOp={cm:a,viewChanged:!1,startHeight:a.doc.height,
forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Vg,markArrays:null};a=a.curOp;Mb?Mb.ops.push(a):a.ownsGroup=Mb={ops:[a],delayedCallbacks:[]}}function Fb(a){(a=a.curOp)&&Og(a,function(b){for(var d=0;d<b.ops.length;d++)b.ops[d].cm.curOp=null;b=b.ops;for(d=0;d<b.length;d++){var c=b[d],e=c.cm,f=e.display,g=e.display;!g.scrollbarsClipped&&g.scroller.offsetWidth&&
(g.nativeBarWidth=g.scroller.offsetWidth-g.scroller.clientWidth,g.heightForcer.style.height=cb(e)+"px",g.sizer.style.marginBottom=-g.nativeBarWidth+"px",g.sizer.style.borderRightWidth=cb(e)+"px",g.scrollbarsClipped=!0);c.updateMaxLine&&Id(e);c.mustUpdate=c.viewChanged||c.forceUpdate||null!=c.scrollTop||c.scrollToPos&&(c.scrollToPos.from.line<f.viewFrom||c.scrollToPos.to.line>=f.viewTo)||f.maxLineChanged&&e.options.lineWrapping;c.update=c.mustUpdate&&new dd(e,c.mustUpdate&&{top:c.scrollTop,ensure:c.scrollToPos},
c.forceUpdate)}for(d=0;d<b.length;d++)c=b[d],c.updatedDisplay=c.mustUpdate&&de(c.cm,c.update);for(d=0;d<b.length;d++)if(c=b[d],e=c.cm,f=e.display,c.updatedDisplay&&$c(e),c.barMeasure=pc(e),f.maxLineChanged&&!e.options.lineWrapping&&(g=f.maxLine.text.length,g=Wa(e,xb(e,f.maxLine),g,void 0),c.adjustWidthTo=g.left+3,e.display.sizerWidth=c.adjustWidthTo,c.barMeasure.scrollWidth=Math.max(f.scroller.clientWidth,f.sizer.offsetLeft+c.adjustWidthTo+cb(e)+e.display.barWidth),c.maxScrollLeft=Math.max(0,f.sizer.offsetLeft+
c.adjustWidthTo-vb(e))),c.updatedDisplay||c.selectionChanged)c.preparedSelection=f.input.prepareSelection();for(d=0;d<b.length;d++)c=b[d],e=c.cm,null!=c.adjustWidthTo&&(e.display.sizer.style.minWidth=c.adjustWidthTo+"px",c.maxScrollLeft<e.doc.scrollLeft&&Db(e,Math.min(e.display.scroller.scrollLeft,c.maxScrollLeft),!0),e.display.maxLineChanged=!1),f=c.focus&&c.focus==I(v(e.display.wrapper)),c.preparedSelection&&e.display.input.showSelection(c.preparedSelection,f),(c.updatedDisplay||c.startHeight!=
e.doc.height)&&Rb(e,c.barMeasure),c.updatedDisplay&&ee(e,c.barMeasure),c.selectionChanged&&Zd(e),e.state.focused&&c.updateInput&&e.display.input.reset(c.typing),f&&mf(c.cm);for(d=0;d<b.length;d++){var h=void 0;c=b[d];e=c.cm;f=e.display;g=e.doc;c.updatedDisplay&&uf(e,c.update);null==f.wheelStartX||null==c.scrollTop&&null==c.scrollLeft&&!c.scrollToPos||(f.wheelStartX=f.wheelStartY=null);null!=c.scrollTop&&pf(e,c.scrollTop,c.forceScroll);null!=c.scrollLeft&&Db(e,c.scrollLeft,!0,!0);if(c.scrollToPos){var k=
ca(g,c.scrollToPos.from);var l=ca(g,c.scrollToPos.to);var m=c.scrollToPos.margin;null==m&&(m=0);e.options.lineWrapping||k!=l||(l="before"==k.sticky?H(k.line,k.ch+1,"before"):k,k=k.ch?H(k.line,"before"==k.sticky?k.ch-1:k.ch,"after"):k);for(var p=0;5>p;p++){var r=!1;h=Xa(e,k);var u=l&&l!=k?Xa(e,l):h;h={left:Math.min(h.left,u.left),top:Math.min(h.top,u.top)-m,right:Math.max(h.left,u.left),bottom:Math.max(h.bottom,u.bottom)+m};u=be(e,h);var C=e.doc.scrollTop,N=e.doc.scrollLeft;null!=u.scrollTop&&(nc(e,
u.scrollTop),1<Math.abs(e.doc.scrollTop-C)&&(r=!0));null!=u.scrollLeft&&(Db(e,u.scrollLeft),1<Math.abs(e.doc.scrollLeft-N)&&(r=!0));if(!r)break}l=h;ja(e,"scrollCursorIntoView")||(m=e.display,p=m.sizer.getBoundingClientRect(),k=null,r=m.wrapper.ownerDocument,0>l.top+p.top?k=!0:l.bottom+p.top>(r.defaultView.innerHeight||r.documentElement.clientHeight)&&(k=!1),null==k||Wg||(l=z("div","\u200b",null,"position: absolute;\n                         top: "+(l.top-m.viewOffset-e.display.lineSpace.offsetTop)+
"px;\n                         height: "+(l.bottom-l.top+cb(e)+m.barHeight)+"px;\n                         left: "+l.left+"px; width: "+Math.max(2,l.right-l.left)+"px;"),e.display.lineSpace.appendChild(l),l.scrollIntoView(k),e.display.lineSpace.removeChild(l)))}l=c.maybeHiddenMarkers;k=c.maybeUnhiddenMarkers;if(l)for(m=0;m<l.length;++m)l[m].lines.length||S(l[m],"hide");if(k)for(l=0;l<k.length;++l)k[l].lines.length&&S(k[l],"unhide");f.wrapper.offsetHeight&&(g.scrollTop=e.display.scroller.scrollTop);
c.changeObjs&&S(e,"changes",e,c.changeObjs);c.update&&c.update.finish()}})}function Qa(a,b){if(a.curOp)return b();Eb(a);try{return b()}finally{Fb(a)}}function Fa(a,b){return function(){if(a.curOp)return b.apply(a,arguments);Eb(a);try{return b.apply(a,arguments)}finally{Fb(a)}}}function Ka(a){return function(){if(this.curOp)return a.apply(this,arguments);Eb(this);try{return a.apply(this,arguments)}finally{Fb(this)}}}function Ga(a){return function(){var b=this.cm;if(!b||b.curOp)return a.apply(this,
arguments);Eb(b);try{return a.apply(this,arguments)}finally{Fb(b)}}}function oc(a,b){a.doc.highlightFrontier<a.display.viewTo&&a.state.highlight.set(b,A(Xg,a))}function Xg(a){var b=a.doc;if(!(b.highlightFrontier>=a.display.viewTo)){var d=+new Date+a.options.workTime,c=ec(a,b.highlightFrontier),e=[];b.iter(c.line,Math.min(b.first+b.size,a.display.viewTo+500),function(f){if(c.line>=a.display.viewFrom){var g=f.styles,h=f.text.length>a.options.maxHighlightLength?sb(b.mode,c.state):null,k=Ce(a,f,c,!0);
h&&(c.state=h);f.styles=k.styles;h=f.styleClasses;(k=k.classes)?f.styleClasses=k:h&&(f.styleClasses=null);k=!g||g.length!=f.styles.length||h!=k&&(!h||!k||h.bgClass!=k.bgClass||h.textClass!=k.textClass);for(h=0;!k&&h<g.length;++h)k=g[h]!=f.styles[h];k&&e.push(c.line);f.stateAfter=c.save()}else f.text.length<=a.options.maxHighlightLength&&Cd(a,f.text,c),f.stateAfter=0==c.line%5?c.save():null;c.nextLine();if(+new Date>d)return oc(a,a.options.workDelay),!0});b.highlightFrontier=c.line;b.modeFrontier=
Math.max(b.modeFrontier,c.line);e.length&&Qa(a,function(){for(var f=0;f<e.length;f++)mb(a,e[f],"text")})}}function de(a,b){var d=a.display,c=a.doc;if(b.editorIsHidden)return lb(a),!1;if(!b.force&&b.visible.from>=d.viewFrom&&b.visible.to<=d.viewTo&&(null==d.updateLineNumbers||d.updateLineNumbers>=d.viewTo)&&d.renderedView==d.view&&0==kf(a))return!1;vf(a)&&(lb(a),b.dims=Pd(a));var e=c.first+c.size,f=Math.max(b.visible.from-a.options.viewportMargin,c.first),g=Math.min(e,b.visible.to+a.options.viewportMargin);
d.viewFrom<f&&20>f-d.viewFrom&&(f=Math.max(c.first,d.viewFrom));d.viewTo>g&&20>d.viewTo-g&&(g=Math.min(e,d.viewTo));eb&&(f=Gd(a.doc,f),g=Ne(a.doc,g));c=f!=d.viewFrom||g!=d.viewTo||d.lastWrapHeight!=b.wrapperHeight||d.lastWrapWidth!=b.wrapperWidth;e=a.display;0==e.view.length||f>=e.viewTo||g<=e.viewFrom?(e.view=Uc(a,f,g),e.viewFrom=f):(e.viewFrom>f?e.view=Uc(a,f,e.viewFrom).concat(e.view):e.viewFrom<f&&(e.view=e.view.slice(wb(a,f))),e.viewFrom=f,e.viewTo<g?e.view=e.view.concat(Uc(a,e.viewTo,g)):e.viewTo>
g&&(e.view=e.view.slice(0,wb(a,g))));e.viewTo=g;d.viewOffset=bb(T(a.doc,d.viewFrom));a.display.mover.style.top=d.viewOffset+"px";g=kf(a);if(!c&&0==g&&!b.force&&d.renderedView==d.view&&(null==d.updateLineNumbers||d.updateLineNumbers>=d.viewTo))return!1;a.hasFocus()?f=null:(f=I(v(a.display.wrapper)))&&B(a.display.lineDiv,f)?(f={activeElt:f},window.getSelection&&(e=R(a).defaultView.getSelection(),e.anchorNode&&e.extend&&B(a.display.lineDiv,e.anchorNode)&&(f.anchorNode=e.anchorNode,f.anchorOffset=e.anchorOffset,
f.focusNode=e.focusNode,f.focusOffset=e.focusOffset))):f=null;4<g&&(d.lineDiv.style.display="none");Yg(a,d.updateLineNumbers,b.dims);4<g&&(d.lineDiv.style.display="");d.renderedView=d.view;(g=f)&&g.activeElt&&g.activeElt!=I(v(g.activeElt))&&(g.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(g.activeElt.nodeName)&&g.anchorNode&&B(document.body,g.anchorNode)&&B(document.body,g.focusNode)&&(e=g.activeElt.ownerDocument,f=e.defaultView.getSelection(),e=e.createRange(),e.setEnd(g.anchorNode,g.anchorOffset),
e.collapse(!1),f.removeAllRanges(),f.addRange(e),f.extend(g.focusNode,g.focusOffset)));K(d.cursorDiv);K(d.selectionDiv);d.gutters.style.height=d.sizer.style.minHeight=0;c&&(d.lastWrapHeight=b.wrapperHeight,d.lastWrapWidth=b.wrapperWidth,oc(a,400));d.updateLineNumbers=null;return!0}function uf(a,b){for(var d=b.viewport,c=!0;;c=!1){if(c&&a.options.lineWrapping&&b.oldDisplayWidth!=vb(a))c&&(b.visible=ad(a.display,a.doc,d));else if(d&&null!=d.top&&(d={top:Math.min(a.doc.height+Md(a.display)-Nd(a),d.top)}),
b.visible=ad(a.display,a.doc,d),b.visible.from>=a.display.viewFrom&&b.visible.to<=a.display.viewTo)break;if(!de(a,b))break;$c(a);c=pc(a);lc(a);Rb(a,c);ee(a,c);b.force=!1}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 ce(a,b){b=new dd(a,b);if(de(a,b)){$c(a);uf(a,b);var d=
pc(a);lc(a);Rb(a,d);ee(a,d);b.finish()}}function Yg(a,b,d){function c(r){var u=r.nextSibling;Ia&&Ua&&a.display.currentWheelTarget==r?r.style.display="none":r.parentNode.removeChild(r);return u}var e=a.display,f=a.options.lineNumbers,g=e.lineDiv,h=g.firstChild,k=e.view;e=e.viewFrom;for(var 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=c(h);h=f&&null!=b&&b<=e&&m.lineNumber;m.changes&&(-1<x(m.changes,"gutter")&&(h=!1),Se(a,m,e,d));h&&(K(m.lineNumber),
m.lineNumber.appendChild(document.createTextNode(zd(a.options,e))));h=m.node.nextSibling}else{var p=Qg(a,m,e,d);g.insertBefore(p,h)}e+=m.size}for(;h;)h=c(h)}function fe(a){a.sizer.style.marginLeft=a.gutters.offsetWidth+"px";Ea(a,"gutterChanged",a)}function ee(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+cb(a)+"px"}function qf(a){var b=a.display,d=b.view;if(b.alignWidgets||b.gutters.firstChild&&
a.options.fixedGutter){for(var c=Vd(b)-b.scroller.scrollLeft+a.doc.scrollLeft,e=b.gutters.offsetWidth,f=c+"px",g=0;g<d.length;g++)if(!d[g].hidden){a.options.fixedGutter&&(d[g].gutter&&(d[g].gutter.style.left=f),d[g].gutterBackground&&(d[g].gutterBackground.style.left=f));var h=d[g].alignable;if(h)for(var k=0;k<h.length;k++)h[k].style.left=f}a.options.fixedGutter&&(b.gutters.style.left=c+e+"px")}}function vf(a){if(!a.options.lineNumbers)return!1;var b=a.doc;b=zd(a.options,b.first+b.size-1);var d=a.display;
if(b.length!=d.lineNumChars){var c=d.measure.appendChild(z("div",[z("div",b)],"CodeMirror-linenumber CodeMirror-gutter-elt")),e=c.firstChild.offsetWidth;c=c.offsetWidth-e;d.lineGutter.style.width="";d.lineNumInnerWidth=Math.max(e,d.lineGutter.offsetWidth-c)+1;d.lineNumWidth=d.lineNumInnerWidth+c;d.lineNumChars=d.lineNumInnerWidth?b.length:-1;d.lineGutter.style.width=d.lineNumWidth+"px";fe(a.display);return!0}return!1}function ge(a,b){for(var d=[],c=!1,e=0;e<a.length;e++){var f=a[e],g=null;"string"!=
typeof f&&(g=f.style,f=f.className);if("CodeMirror-linenumbers"==f)if(b)c=!0;else continue;d.push({className:f,style:g})}b&&!c&&d.push({className:"CodeMirror-linenumbers",style:null});return d}function wf(a){var b=a.gutters,d=a.gutterSpecs;K(b);a.lineGutter=null;for(var c=0;c<d.length;++c){var e=d[c],f=e.className;e=e.style;var g=b.appendChild(z("div",null,"CodeMirror-gutter "+f));e&&(g.style.cssText=e);"CodeMirror-linenumbers"==f&&(a.lineGutter=g,g.style.width=(a.lineNumWidth||1)+"px")}b.style.display=
d.length?"":"none";fe(a)}function qc(a){wf(a.display);La(a);qf(a)}function Zg(a,b,d,c){this.input=d;this.scrollbarFiller=z("div",null,"CodeMirror-scrollbar-filler");this.scrollbarFiller.setAttribute("cm-not-content","true");this.gutterFiller=z("div",null,"CodeMirror-gutter-filler");this.gutterFiller.setAttribute("cm-not-content","true");this.lineDiv=w("div",null,"CodeMirror-code");this.selectionDiv=z("div",null,null,"position: relative; z-index: 1");this.cursorDiv=z("div",null,"CodeMirror-cursors");
this.measure=z("div",null,"CodeMirror-measure");this.lineMeasure=z("div",null,"CodeMirror-measure");this.lineSpace=w("div",[this.measure,this.lineMeasure,this.selectionDiv,this.cursorDiv,this.lineDiv],null,"position: relative; outline: none");var e=w("div",[this.lineSpace],"CodeMirror-lines");this.mover=z("div",[e],null,"position: relative");this.sizer=z("div",[this.mover],"CodeMirror-sizer");this.sizerWidth=null;this.heightForcer=z("div",null,null,"position: absolute; height: 50px; width: 1px;");
this.gutters=z("div",null,"CodeMirror-gutters");this.lineGutter=null;this.scroller=z("div",[this.sizer,this.heightForcer,this.gutters],"CodeMirror-scroll");this.scroller.setAttribute("tabIndex","-1");this.wrapper=z("div",[this.scrollbarFiller,this.gutterFiller,this.scroller],"CodeMirror");kb&&105<=xf&&(this.wrapper.style.clipPath="inset(0px)");this.wrapper.setAttribute("translate","no");la&&8>xa&&(this.gutters.style.zIndex=-1,this.scroller.style.paddingRight=0);Ia||gb&&rc||(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;this.gutterSpecs=ge(c.gutters,c.lineNumbers);wf(this);d.init(this)}function yf(a){var b=a.wheelDeltaX,d=a.wheelDeltaY;null==b&&a.detail&&a.axis==a.HORIZONTAL_AXIS&&(b=a.detail);null==d&&a.detail&&a.axis==a.VERTICAL_AXIS?d=a.detail:null==d&&(d=a.wheelDelta);return{x:b,y:d}}function $g(a){a=yf(a);a.x*=hb;a.y*=
hb;return a}function zf(a,b){kb&&102==xf&&(null==a.display.chromeScrollHack?a.display.sizer.style.pointerEvents="none":clearTimeout(a.display.chromeScrollHack),a.display.chromeScrollHack=setTimeout(function(){a.display.chromeScrollHack=null;a.display.sizer.style.pointerEvents=""},100));var d=yf(b),c=d.x;d=d.y;var e=hb;0===b.deltaMode&&(c=b.deltaX,d=b.deltaY,e=1);var f=a.display,g=f.scroller,h=g.scrollWidth>g.clientWidth,k=g.scrollHeight>g.clientHeight;if(c&&h||d&&k){if(d&&Ua&&Ia){h=b.target;var l=
f.view;a:for(;h!=g;h=h.parentNode)for(var m=0;m<l.length;m++)if(l[m].node==h){a.display.currentWheelTarget=h;break a}}!c||gb||Ya||null==e?(d&&null!=e&&(e*=d,k=a.doc.scrollTop,h=k+f.wrapper.clientHeight,0>e?k=Math.max(0,k+e-50):h=Math.min(a.doc.height,h+e+50),ce(a,{top:k,bottom:h})),20>ed&&0!==b.deltaMode&&(null==f.wheelStartX?(f.wheelStartX=g.scrollLeft,f.wheelStartY=g.scrollTop,f.wheelDX=c,f.wheelDY=d,setTimeout(function(){if(null!=f.wheelStartX){var p=g.scrollLeft-f.wheelStartX,r=g.scrollTop-f.wheelStartY;
p=r&&f.wheelDY&&r/f.wheelDY||p&&f.wheelDX&&p/f.wheelDX;f.wheelStartX=f.wheelStartY=null;p&&(hb=(hb*ed+p)/(ed+1),++ed)}},200)):(f.wheelDX+=c,f.wheelDY+=d))):(d&&k&&nc(a,Math.max(0,g.scrollTop+d*e)),Db(a,Math.max(0,g.scrollLeft+c*e)),(!d||d&&k)&&ka(b),f.wheelStartX=null)}}function Za(a,b,d){a=a&&a.options.selectionsMayTouch;d=b[d];b.sort(function(k,l){return ba(k.from(),l.from())});d=x(b,d);for(var c=1;c<b.length;c++){var e=b[c],f=b[c-1],g=ba(f.to(),e.from());if(a&&!e.empty()?0<g:0<=g){g=Qc(f.from(),
e.from());var h=Pc(f.to(),e.to());e=f.empty()?e.from()==e.head:f.from()==f.head;c<=d&&--d;b.splice(--c,2,new na(e?h:g,e?g:h))}}return new Ta(b,d)}function ib(a,b){return new Ta([new na(a,b||a)],0)}function nb(a){return a.text?H(a.from.line+a.text.length-1,O(a.text).length+(1==a.text.length?a.from.ch:0)):a.to}function Af(a,b){if(0>ba(a,b.from))return a;if(0>=ba(a,b.to))return nb(b);var d=a.line+b.text.length-(b.to.line-b.from.line)-1,c=a.ch;a.line==b.to.line&&(c+=nb(b).ch-b.to.ch);return H(d,c)}function he(a,
b){for(var d=[],c=0;c<a.sel.ranges.length;c++){var e=a.sel.ranges[c];d.push(new na(Af(e.anchor,b),Af(e.head,b)))}return Za(a.cm,d,a.sel.primIndex)}function Bf(a,b,d){return a.line==b.line?H(d.line,a.ch-b.ch+d.ch):H(d.line+(a.line-b.line),a.ch)}function ie(a){a.doc.mode=wd(a.options,a.doc.modeOption);sc(a)}function sc(a){a.doc.iter(function(b){b.stateAfter&&(b.stateAfter=null);b.styles&&(b.styles=null)});a.doc.modeFrontier=a.doc.highlightFrontier=a.doc.first;oc(a,100);a.state.modeGen++;a.curOp&&La(a)}
function Cf(a,b){return 0==b.from.ch&&0==b.to.ch&&""==O(b.text)&&(!a.cm||a.cm.options.wholeLineUpdateBefore)}function je(a,b,d,c){function e(C,N,Y){C.text=N;C.stateAfter&&(C.stateAfter=null);C.styles&&(C.styles=null);null!=C.order&&(C.order=null);Ke(C);Le(C,Y);N=c?c(C):1;N!=C.height&&$a(C,N);Ea(C,"change",C,b)}function f(C,N){for(var Y=[];C<N;++C)Y.push(new Sb(k[C],d?d[C]:null,c));return Y}var g=b.from,h=b.to,k=b.text,l=T(a,g.line),m=T(a,h.line),p=O(k),r=d?d[k.length-1]:null,u=h.line-g.line;b.full?
(a.insert(0,f(0,k.length)),a.remove(k.length,a.size-k.length)):Cf(a,b)?(h=f(0,k.length-1),e(m,m.text,r),u&&a.remove(g.line,u),h.length&&a.insert(g.line,h)):l==m?1==k.length?e(l,l.text.slice(0,g.ch)+p+l.text.slice(h.ch),r):(u=f(1,k.length-1),u.push(new Sb(p+l.text.slice(h.ch),r,c)),e(l,l.text.slice(0,g.ch)+k[0],d?d[0]:null),a.insert(g.line+1,u)):1==k.length?(e(l,l.text.slice(0,g.ch)+k[0]+m.text.slice(h.ch),d?d[0]:null),a.remove(g.line+1,u)):(e(l,l.text.slice(0,g.ch)+k[0],d?d[0]:null),e(m,p+m.text.slice(h.ch),
r),r=f(1,k.length-1),1<u&&a.remove(g.line+1,u-1),a.insert(g.line+1,r));Ea(a,"change",a,b)}function ob(a,b,d){function c(e,f,g){if(e.linked)for(var h=0;h<e.linked.length;++h){var k=e.linked[h];if(k.doc!=f){var l=g&&k.sharedHist;if(!d||l)b(k.doc,l),c(k.doc,e,l)}}}c(a,null,!0)}function Df(a,b){if(b.cm)throw Error("This document is already in use.");a.doc=b;b.cm=a;Wd(a);ie(a);Ef(a);a.options.direction=b.direction;a.options.lineWrapping||Id(a);a.options.mode=b.modeOption;La(a)}function Ef(a){("rtl"==a.doc.direction?
D:Cb)(a.display.lineDiv,"CodeMirror-rtl")}function ah(a){Qa(a,function(){Ef(a);La(a)})}function fd(a){this.done=[];this.undone=[];this.undoDepth=a?a.undoDepth:Infinity;this.lastModTime=this.lastSelTime=0;this.lastOrigin=this.lastSelOrigin=this.lastOp=this.lastSelOp=null;this.generation=this.maxGeneration=a?a.maxGeneration:1}function ke(a,b){var d={from:Bd(b.from),to:nb(b),text:tb(a,b.from,b.to)};Ff(a,d,b.from.line,b.to.line+1);ob(a,function(c){return Ff(c,d,b.from.line,b.to.line+1)},!0);return d}
function Gf(a){for(;a.length;)if(O(a).ranges)a.pop();else break}function Hf(a,b,d,c){var e=a.history;e.undone.length=0;var f=+new Date,g;if(g=e.lastOp==c||e.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&e.lastModTime>f-(a.cm?a.cm.options.historyEventDelay:500)||"*"==b.origin.charAt(0))){if(e.lastOp==c){Gf(e.done);var h=O(e.done)}else e.done.length&&!O(e.done).ranges?h=O(e.done):1<e.done.length&&!e.done[e.done.length-2].ranges?(e.done.pop(),h=O(e.done)):h=void 0;g=h}if(g){var k=O(h.changes);
0==ba(b.from,b.to)&&0==ba(b.from,k.to)?k.to=nb(b):h.changes.push(ke(a,b))}else for((h=O(e.done))&&h.ranges||gd(a.sel,e.done),h={changes:[ke(a,b)],generation:e.generation},e.done.push(h);e.done.length>e.undoDepth;)e.done.shift(),e.done[0].ranges||e.done.shift();e.done.push(d);e.generation=++e.maxGeneration;e.lastModTime=e.lastSelTime=f;e.lastOp=e.lastSelOp=c;e.lastOrigin=e.lastSelOrigin=b.origin;k||S(a,"historyAdded")}function gd(a,b){var d=O(b);d&&d.ranges&&d.equals(a)||b.push(a)}function Ff(a,b,
d,c){var e=b["spans_"+a.id],f=0;a.iter(Math.max(a.first,d),Math.min(a.first+a.size,c),function(g){g.markedSpans&&((e||(e=b["spans_"+a.id]={}))[f]=g.markedSpans);++f})}function If(a,b){var d;if(d=b["spans_"+a.id]){for(var c=[],e=0;e<b.text.length;++e){var f=c,g=f.push;var h=void 0;var k=d[e];if(k){for(var l=0;l<k.length;++l)k[l].marker.explicitlyCleared?h||(h=k.slice(0,l)):h&&h.push(k[l]);h=h?h.length?h:null:k}else h=null;g.call(f,h)}d=c}else d=null;a=Ed(a,b);if(!d)return a;if(!a)return d;for(b=0;b<
d.length;++b)if(c=d[b],e=a[b],c&&e)a:for(f=0;f<e.length;++f){g=e[f];for(h=0;h<c.length;++h)if(c[h].marker==g.marker)continue a;c.push(g)}else e&&(d[b]=e);return d}function Tb(a,b,d){for(var c=[],e=0;e<a.length;++e){var f=a[e];if(f.ranges)c.push(d?Ta.prototype.deepCopy.call(f):f);else{f=f.changes;var g=[];c.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<x(b,Number(l[1]))&&(O(g)[m]=k[m],delete k[m])}}}return c}
function le(a,b,d,c){return c?(a=a.anchor,d&&(c=0>ba(b,a),c!=0>ba(d,a)?(a=b,b=d):c!=0>ba(b,d)&&(b=d)),new na(a,b)):new na(d||b,b)}function hd(a,b,d,c,e){null==e&&(e=a.cm&&(a.cm.display.shift||a.extend));Ha(a,new Ta([le(a.sel.primary(),b,d,e)],0),c)}function Jf(a,b,d){for(var c=[],e=a.cm&&(a.cm.display.shift||a.extend),f=0;f<a.sel.ranges.length;f++)c[f]=le(a.sel.ranges[f],b[f],null,e);b=Za(a.cm,c,a.sel.primIndex);Ha(a,b,d)}function me(a,b,d,c){var e=a.sel.ranges.slice(0);e[b]=d;Ha(a,Za(a.cm,e,a.sel.primIndex),
c)}function bh(a,b,d){d={ranges:b.ranges,update:function(c){this.ranges=[];for(var e=0;e<c.length;e++)this.ranges[e]=new na(ca(a,c[e].anchor),ca(a,c[e].head))},origin:d&&d.origin};S(a,"beforeSelectionChange",a,d);a.cm&&S(a.cm,"beforeSelectionChange",a.cm,d);return d.ranges!=b.ranges?Za(a.cm,d.ranges,d.ranges.length-1):b}function Kf(a,b,d){var c=a.history.done,e=O(c);e&&e.ranges?(c[c.length-1]=b,id(a,b,d)):Ha(a,b,d)}function Ha(a,b,d){id(a,b,d);b=a.sel;var c=a.cm?a.cm.curOp.id:NaN,e=a.history,f=d&&
d.origin,g;if(!(g=c==e.lastSelOp)&&(g=f&&e.lastSelOrigin==f)&&!(g=e.lastModTime==e.lastSelTime&&e.lastOrigin==f)){g=O(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:gd(b,e.done);e.lastSelTime=+new Date;e.lastSelOrigin=f;e.lastSelOp=c;d&&!1!==d.clearRedo&&Gf(e.undone)}function id(a,b,d){if(ia(a,"beforeSelectionChange")||a.cm&&
ia(a.cm,"beforeSelectionChange"))b=bh(a,b,d);var c=d&&d.bias||(0>ba(b.primary().head,a.sel.primary().head)?-1:1);Lf(a,Mf(a,b,c,!0));d&&!1===d.scroll||!a.cm||"nocursor"==a.cm.getOption("readOnly")||Qb(a.cm)}function Lf(a,b){b.equals(a.sel)||(a.sel=b,a.cm&&(a.cm.curOp.updateInput=1,a.cm.curOp.selectionChanged=!0,Ba(a.cm)),Ea(a,"cursorActivity",a))}function Nf(a){Lf(a,Mf(a,a.sel,null,!1))}function Mf(a,b,d,c){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=jd(a,g.anchor,h&&h.anchor,d,c);h=g.head==g.anchor?k:jd(a,g.head,h&&h.head,d,c);if(e||k!=g.anchor||h!=g.head)e||(e=b.ranges.slice(0,f)),e[f]=new na(k,h)}return e?Za(a.cm,e,b.primIndex):b}function Ub(a,b,d,c,e){var f=T(a,b.line);if(f.markedSpans)for(var g=0;g<f.markedSpans.length;++g){var h=f.markedSpans[g],k=h.marker,l="selectLeft"in k?!k.selectLeft:k.inclusiveLeft,m="selectRight"in k?!k.selectRight:k.inclusiveRight;if((null==h.from||(l?h.from<=b.ch:h.from<b.ch))&&(null==h.to||(m?
h.to>=b.ch:h.to>b.ch))){if(e&&(S(k,"beforeCursorEnter"),k.explicitlyCleared))if(f.markedSpans){--g;continue}else break;if(k.atomic){if(d){g=k.find(0>c?1:-1);h=void 0;if(0>c?m:l)g=Of(a,g,-c,g&&g.line==b.line?f:null);if(g&&g.line==b.line&&(h=ba(g,d))&&(0>c?0>h:0<h))return Ub(a,g,b,c,e)}d=k.find(0>c?-1:1);if(0>c?l:m)d=Of(a,d,c,d.line==b.line?f:null);return d?Ub(a,d,b,c,e):null}}}return b}function jd(a,b,d,c,e){c=c||1;b=Ub(a,b,d,c,e)||!e&&Ub(a,b,d,c,!0)||Ub(a,b,d,-c,e)||!e&&Ub(a,b,d,-c,!0);return b?b:
(a.cantEdit=!0,H(a.first,0))}function Of(a,b,d,c){return 0>d&&0==b.ch?b.line>a.first?ca(a,H(b.line-1)):null:0<d&&b.ch==(c||T(a,b.line)).text.length?b.line<a.first+a.size-1?H(b.line+1,0):null:new H(b.line,b.ch+d)}function Pf(a){a.setSelection(H(a.firstLine(),0),H(a.lastLine()),db)}function Qf(a,b,d){var c={canceled:!1,from:b.from,to:b.to,text:b.text,origin:b.origin,cancel:function(){return c.canceled=!0}};d&&(c.update=function(e,f,g,h){e&&(c.from=ca(a,e));f&&(c.to=ca(a,f));g&&(c.text=g);void 0!==h&&
(c.origin=h)});S(a,"beforeChange",a,c);a.cm&&S(a.cm,"beforeChange",a.cm,c);return c.canceled?(a.cm&&(a.cm.curOp.updateInput=2),null):{from:c.from,to:c.to,text:c.text,origin:c.origin}}function Vb(a,b,d){if(a.cm){if(!a.cm.curOp)return Fa(a.cm,Vb)(a,b,d);if(a.cm.state.suppressEdits)return}if(ia(a,"beforeChange")||a.cm&&ia(a.cm,"beforeChange"))if(b=Qf(a,b,!0),!b)return;if(d=Rf&&!d&&Ig(a,b.from,b.to))for(var c=d.length-1;0<=c;--c)Sf(a,{from:d[c].from,to:d[c].to,text:c?[""]:b.text,origin:b.origin});else Sf(a,
b)}function Sf(a,b){if(1!=b.text.length||""!=b.text[0]||0!=ba(b.from,b.to)){var d=he(a,b);Hf(a,b,d,a.cm?a.cm.curOp.id:NaN);tc(a,b,d,Ed(a,b));var c=[];ob(a,function(e,f){f||-1!=x(c,e.history)||(Tf(e.history,b),c.push(e.history));tc(e,b,null,Ed(e,b))})}}function kd(a,b,d){var c=a.cm&&a.cm.state.suppressEdits;if(!c||d){for(var e=a.history,f,g=a.sel,h="undo"==b?e.done:e.undone,k="undo"==b?e.undone:e.done,l=0;l<h.length&&(f=h[l],d?!f.ranges||f.equals(a.sel):f.ranges);l++);if(l!=h.length){for(e.lastOrigin=
e.lastSelOrigin=null;;)if(f=h.pop(),f.ranges){gd(f,k);if(d&&!f.equals(a.sel)){Ha(a,f,{clearRedo:!1});return}g=f}else{if(c){h.push(f);return}break}var m=[];gd(g,k);k.push({changes:m,generation:e.generation});e.generation=f.generation||++e.maxGeneration;var p=ia(a,"beforeChange")||a.cm&&ia(a.cm,"beforeChange");d=function(r){var u=f.changes[r];u.origin=b;if(p&&!Qf(a,u,!1))return h.length=0,{};m.push(ke(a,u));var C=r?he(a,u):O(h);tc(a,u,C,If(a,u));!r&&a.cm&&a.cm.scrollIntoView({from:u.from,to:nb(u)});
var N=[];ob(a,function(Y,Da){Da||-1!=x(N,Y.history)||(Tf(Y.history,u),N.push(Y.history));tc(Y,u,null,If(Y,u))})};for(c=f.changes.length-1;0<=c;--c)if(e=d(c))return e.v}}}function Uf(a,b){if(0!=b&&(a.first+=b,a.sel=new Ta(J(a.sel.ranges,function(e){return new na(H(e.anchor.line+b,e.anchor.ch),H(e.head.line+b,e.head.ch))}),a.sel.primIndex),a.cm)){La(a.cm,a.first,a.first-b,b);for(var d=a.cm.display,c=d.viewFrom;c<d.viewTo;c++)mb(a.cm,c,"gutter")}}function tc(a,b,d,c){if(a.cm&&!a.cm.curOp)return Fa(a.cm,
tc)(a,b,d,c);if(b.to.line<a.first)Uf(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);Uf(a,e);b={from:H(a.first,0),to:H(b.to.line+e,b.to.ch),text:[O(b.text)],origin:b.origin}}e=a.lastLine();b.to.line>e&&(b={from:b.from,to:H(e,T(a,e).text.length),text:[b.text[0]],origin:b.origin});b.removed=tb(a,b.from,b.to);d||(d=he(a,b));a.cm?ch(a.cm,b,c):je(a,b,c);id(a,d,db);a.cantEdit&&jd(a,H(a.firstLine(),0))&&(a.cantEdit=
!1)}}function ch(a,b,d){var c=a.doc,e=a.display,f=b.from,g=b.to,h=!1,k=f.line;a.options.lineWrapping||(k=qa(Va(T(c,f.line))),c.iter(k,g.line+1,function(l){if(l==e.maxLine)return h=!0}));-1<c.sel.contains(b.from,b.to)&&Ba(a);je(c,b,d,jf(a));a.options.lineWrapping||(c.iter(k,f.line+b.text.length,function(l){var m=Tc(l);m>e.maxLineLength&&(e.maxLine=l,e.maxLineLength=m,e.maxLineChanged=!0,h=!1)}),h&&(a.curOp.updateMaxLine=!0));Hg(c,f.line);oc(a,400);d=b.text.length-(g.line-f.line)-1;b.full?La(a):f.line!=
g.line||1!=b.text.length||Cf(a.doc,b)?La(a,f.line,g.line+1,d):mb(a,f.line,"text");d=ia(a,"changes");if((c=ia(a,"change"))||d)b={from:f,to:g,text:b.text,removed:b.removed,origin:b.origin},c&&Ea(a,"change",a,b),d&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(b);a.display.selForContextMenu=null}function Wb(a,b,d,c,e){c||(c=d);0>ba(c,d)&&(c=[c,d],d=c[0],c=c[1]);"string"==typeof b&&(b=a.splitLines(b));Vb(a,{from:d,to:c,text:b,origin:e})}function Vf(a,b,d,c){d<a.line?a.line+=c:b<a.line&&(a.line=b,
a.ch=0)}function Wf(a,b,d,c){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++)Vf(f.ranges[g].anchor,b,d,c),Vf(f.ranges[g].head,b,d,c);else{for(var h=0;h<f.changes.length;++h){var k=f.changes[h];if(d<k.from.line)k.from=H(k.from.line+c,k.from.ch),k.to=H(k.to.line+c,k.to.ch);else if(b<=k.to.line){g=!1;break}}g||(a.splice(0,e+1),e=0)}}}function Tf(a,b){var d=b.from.line,c=b.to.line;b=b.text.length-(c-d)-1;Wf(a.done,d,c,b);
Wf(a.undone,d,c,b)}function uc(a,b,d,c){var e=b,f=b;"number"==typeof b?f=T(a,Math.max(a.first,Math.min(b,a.first+a.size-1))):e=qa(b);if(null==e)return null;c(f,e)&&a.cm&&mb(a.cm,e,d);return f}function vc(a){this.lines=a;this.parent=null;for(var b=0,d=0;d<a.length;++d)a[d].parent=this,b+=a[d].height;this.height=b}function wc(a){this.children=a;for(var b=0,d=0,c=0;c<a.length;++c){var e=a[c];b+=e.chunkSize();d+=e.height;e.parent=this}this.size=b;this.height=d;this.parent=null}function dh(a,b,d,c){var e=
new xc(a,d,c),f=a.cm;f&&e.noHScroll&&(f.display.alignWidgets=!0);uc(a,b,"widget",function(g){var h=g.widgets||(g.widgets=[]);null==e.insertAt?h.push(e):h.splice(Math.min(h.length,Math.max(0,e.insertAt)),0,e);e.line=g;f&&!jb(a,g)&&(h=bb(g)<a.scrollTop,$a(g,g.height+jc(e)),h&&bd(f,e.height),f.curOp.forceUpdate=!0);return!0});f&&Ea(f,"lineWidgetAdded",f,e,"number"==typeof b?b:qa(b));return e}function Xb(a,b,d,c,e){if(c&&c.shared)return eh(a,b,d,c,e);if(a.cm&&!a.cm.curOp)return Fa(a.cm,Xb)(a,b,d,c,e);
var f=new pb(a,e);e=ba(b,d);c&&n(c,f,!1);if(0<e||0==e&&!1!==f.clearWhenEmpty)return f;f.replacedWith&&(f.collapsed=!0,f.widgetNode=w("span",[f.replacedWith],"CodeMirror-widget"),c.handleMouseEvents||f.widgetNode.setAttribute("cm-ignore-events","true"),c.insertLeft&&(f.widgetNode.insertLeft=!0));if(f.collapsed){if(Me(a,b.line,b,d,f)||b.line!=d.line&&Me(a,d.line,b,d,f))throw Error("Inserting collapsed marker partially overlapping an existing one");eb=!0}f.addToHistory&&Hf(a,{from:b,to:d,origin:"markText"},
a.sel,NaN);var g=b.line,h=a.cm,k;a.iter(g,d.line+1,function(l){h&&f.collapsed&&!h.options.lineWrapping&&Va(l)==h.display.maxLine&&(k=!0);f.collapsed&&g!=b.line&&$a(l,0);var m=new Sc(f,g==b.line?b.ch:null,g==d.line?d.ch:null),p=a.cm&&a.cm.curOp;(p=p&&window.WeakSet&&(p.markedSpans||(p.markedSpans=new WeakSet)))&&l.markedSpans&&p.has(l.markedSpans)?l.markedSpans.push(m):(l.markedSpans=l.markedSpans?l.markedSpans.concat([m]):[m],p&&p.add(l.markedSpans));m.marker.attachLine(l);++g});f.collapsed&&a.iter(b.line,
d.line+1,function(l){jb(a,l)&&$a(l,0)});f.clearOnEnter&&W(f,"beforeCursorEnter",function(){return f.clear()});f.readOnly&&(Rf=!0,(a.history.done.length||a.history.undone.length)&&a.clearHistory());f.collapsed&&(f.id=++Xf,f.atomic=!0);if(h){k&&(h.curOp.updateMaxLine=!0);if(f.collapsed)La(h,b.line,d.line+1);else if(f.className||f.startStyle||f.endStyle||f.css||f.attributes||f.title)for(c=b.line;c<=d.line;c++)mb(h,c,"text");f.atomic&&Nf(h.doc);Ea(h,"markerAdded",h,f)}return f}function eh(a,b,d,c,e){c=
n(c);c.shared=!1;var f=[Xb(a,b,d,c,e)],g=f[0],h=c.widgetNode;ob(a,function(k){h&&(c.widgetNode=h.cloneNode(!0));f.push(Xb(k,ca(k,b),ca(k,d),c,e));for(var l=0;l<k.linked.length;++l)if(k.linked[l].isParent)return;g=O(f)});return new yc(f,g)}function Yf(a){return a.findMarks(H(a.first,0),a.clipPos(H(a.lastLine())),function(b){return b.parent})}function fh(a){for(var b=function(c){c=a[c];var e=[c.primary.doc];ob(c.primary.doc,function(h){return e.push(h)});for(var f=0;f<c.markers.length;f++){var g=c.markers[f];
-1==x(e,g.doc)&&(g.parent=null,c.markers.splice(f--,1))}},d=0;d<a.length;d++)b(d)}function gh(a){var b=this;Zf(b);if(!ja(b,a)&&!fb(b.display,a)){ka(a);la&&($f=+new Date);var d=zb(b,a,!0),c=a.dataTransfer.files;if(d&&!b.isReadOnly())if(c&&c.length&&window.FileReader&&window.File)for(var e=c.length,f=Array(e),g=0,h=function(){++g==e&&Fa(b,function(){d=ca(b.doc,d);var m={from:d,to:d,text:b.doc.splitLines(f.filter(function(p){return null!=p}).join(b.doc.lineSeparator())),origin:"paste"};Vb(b.doc,m);Kf(b.doc,
ib(ca(b.doc,d),ca(b.doc,nb(m))))})()},k=function(m,p){if(b.options.allowDropFileTypes&&-1==x(b.options.allowDropFileTypes,m.type))h();else{var r=new FileReader;r.onerror=function(){return h()};r.onload=function(){var u=r.result;/[\x00-\x08\x0e-\x1f]{2}/.test(u)||(f[p]=u);h()};r.readAsText(m)}},l=0;l<c.length;l++)k(c[l],l);else if(b.state.draggingText&&-1<b.doc.sel.contains(d))b.state.draggingText(a),setTimeout(function(){return b.display.input.focus()},20);else try{if(k=a.dataTransfer.getData("Text")){b.state.draggingText&&
!b.state.draggingText.copy&&(l=b.listSelections());id(b.doc,ib(d,d));if(l)for(c=0;c<l.length;++c)Wb(b.doc,"",l[c].anchor,l[c].head,"drag");b.replaceSelection(k,"around","paste");b.display.input.focus()}}catch(m){}}}function Zf(a){a.display.dragCursor&&(a.display.lineSpace.removeChild(a.display.dragCursor),a.display.dragCursor=null)}function ag(a){if(document.getElementsByClassName){for(var b=document.getElementsByClassName("CodeMirror"),d=[],c=0;c<b.length;c++){var e=b[c].CodeMirror;e&&d.push(e)}d.length&&
d[0].operation(function(){for(var f=0;f<d.length;f++)a(d[f])})}}function hh(){var a;W(window,"resize",function(){null==a&&(a=setTimeout(function(){a=null;ag(ih)},100))});W(window,"blur",function(){return ag(Pb)})}function ih(a){var b=a.display;b.cachedCharWidth=b.cachedTextHeight=b.cachedPaddingH=null;b.scrollbarsClipped=!1;a.setSize()}function jh(a){var b=a.split(/-(?!$)/);a=b[b.length-1];for(var d,c,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))d=
!0;else if(/^(c|ctrl|control)$/i.test(h))c=!0;else if(/^s(hift)?$/i.test(h))e=!0;else throw Error("Unrecognized modifier name: "+h);}d&&(a="Alt-"+a);c&&(a="Ctrl-"+a);f&&(a="Cmd-"+a);e&&(a="Shift-"+a);return a}function kh(a){var b={},d;for(d in a)if(a.hasOwnProperty(d)){var c=a[d];if(!/^(name|fallthrough|(de|at)tach)$/.test(d)){if("..."!=c)for(var e=J(d.split(" "),jh),f=0;f<e.length;f++){if(f==e.length-1){var g=e.join(" ");var h=c}else g=e.slice(0,f+1).join(" "),h="...";var k=b[g];if(!k)b[g]=h;else if(k!=
h)throw Error("Inconsistent bindings for "+g);}delete a[d]}}for(var l in b)a[l]=b[l];return a}function Yb(a,b,d,c){b=ld(b);var e=b.call?b.call(a,c):b[a];if(!1===e)return"nothing";if("..."===e)return"multi";if(null!=e&&d(e))return"handled";if(b.fallthrough){if("[object Array]"!=Object.prototype.toString.call(b.fallthrough))return Yb(a,b.fallthrough,d,c);for(e=0;e<b.fallthrough.length;e++){var f=Yb(a,b.fallthrough[e],d,c);if(f)return f}}}function bg(a){a="string"==typeof a?a:qb[a.keyCode];return"Ctrl"==
a||"Alt"==a||"Shift"==a||"Mod"==a}function cg(a,b,d){var c=a;b.altKey&&"Alt"!=c&&(a="Alt-"+a);(dg?b.metaKey:b.ctrlKey)&&"Ctrl"!=c&&(a="Ctrl-"+a);(dg?b.ctrlKey:b.metaKey)&&"Mod"!=c&&(a="Cmd-"+a);!d&&b.shiftKey&&"Shift"!=c&&(a="Shift-"+a);return a}function eg(a,b){if(Ya&&34==a.keyCode&&a["char"])return!1;var d=qb[a.keyCode];if(null==d||a.altGraphKey)return!1;3==a.keyCode&&a.code&&(d=a.code);return cg(d,a,b)}function ld(a){return"string"==typeof a?zc[a]:a}function Zb(a,b){for(var d=a.doc.sel.ranges,
c=[],e=0;e<d.length;e++){for(var f=b(d[e]);c.length&&0>=ba(f.from,O(c).to);){var g=c.pop();if(0>ba(g.from,f.from)){f.from=g.from;break}}c.push(f)}Qa(a,function(){for(var h=c.length-1;0<=h;h--)Wb(a.doc,"",c[h].from,c[h].to,"+delete");Qb(a)})}function ne(a,b,d){b=y(a.text,b+d,d);return 0>b||b>a.text.length?null:b}function oe(a,b,d){a=ne(a,b.ch,d);return null==a?null:new H(b.line,a,0>d?"after":"before")}function pe(a,b,d,c,e){if(a&&("rtl"==b.doc.direction&&(e=-e),a=ea(d,b.doc.direction))){a=0>e?O(a):
a[0];var f=0>e==(1==a.level)?"after":"before";if(0<a.level||"rtl"==b.doc.direction){var g=xb(b,d);var h=0>e?d.text.length-1:0;var k=Wa(b,g,h).top;h=G(function(l){return Wa(b,g,l).top==k},0>e==(1==a.level)?a.from:a.to-1,h);"before"==f&&(h=ne(d,h,1))}else h=0>e?a.to:a.from;return new H(c,h,f)}return new H(c,0>e?d.text.length:0,0>e?"before":"after")}function lh(a,b,d,c){var e=ea(b,a.doc.direction);if(!e)return oe(b,d,c);d.ch>=b.text.length?(d.ch=b.text.length,d.sticky="before"):0>=d.ch&&(d.ch=0,d.sticky=
"after");var f=X(e,d.ch,d.sticky),g=e[f];if("ltr"==a.doc.direction&&0==g.level%2&&(0<c?g.to>d.ch:g.from<d.ch))return oe(b,d,c);var h=function(u,C){return ne(b,u instanceof H?u.ch:u,C)},k,l=function(u){if(!a.options.lineWrapping)return{begin:0,end:b.text.length};k=k||xb(a,b);return hf(a,b,k,u)},m=l("before"==d.sticky?h(d,-1):d.ch);if("rtl"==a.doc.direction||1==g.level){var p=1==g.level==0>c,r=h(d,p?1:-1);if(null!=r&&(p?r<=g.to&&r<=m.end:r>=g.from&&r>=m.begin))return new H(d.line,r,p?"before":"after")}g=
function(u,C,N){for(var Y=function(oa,ua){return ua?new H(d.line,h(oa,1),"before"):new H(d.line,oa,"after")};0<=u&&u<e.length;u+=C){var Da=e[u],U=0<C==(1!=Da.level),sa=U?N.begin:h(N.end,-1);if(Da.from<=sa&&sa<Da.to)return Y(sa,U);sa=U?Da.from:h(Da.to,-1);if(N.begin<=sa&&sa<N.end)return Y(sa,U)}};if(f=g(f+c,c,m))return f;m=0<c?m.end:h(m.begin,-1);return null==m||0<c&&m==b.text.length||!(f=g(0<c?0:e.length-1,c,l(m)))?null:f}function fg(a,b){var d=T(a.doc,b),c=Va(d);c!=d&&(b=qa(c));return pe(!0,a,c,
b,1)}function gg(a,b){var d=fg(a,b.line),c=T(a.doc,d.line);a=ea(c,a.doc.direction);return a&&0!=a[0].level?d:(c=Math.max(d.ch,c.text.search(/\S/)),H(d.line,b.line==d.line&&b.ch<=c&&b.ch?0:c,d.sticky))}function md(a,b,d){if("string"==typeof b&&(b=Ac[b],!b))return!1;a.display.input.ensurePolled();var c=a.display.shift,e=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),d&&(a.display.shift=!1),e=b(a)!=nd}finally{a.display.shift=c,a.state.suppressEdits=!1}return e}function Bc(a,b,d,c){var e=a.state.keySeq;
if(e){if(bg(b))return"handled";/'$/.test(b)?a.state.keySeq=null:mh.set(50,function(){a.state.keySeq==e&&(a.state.keySeq=null,a.display.input.reset())});if(hg(a,e+" "+b,d,c))return!0}return hg(a,b,d,c)}function hg(a,b,d,c){a:{for(var e=0;e<a.state.keyMaps.length;e++){var f=Yb(b,a.state.keyMaps[e],c,a);if(f){c=f;break a}}c=a.options.extraKeys&&Yb(b,a.options.extraKeys,c,a)||Yb(b,a.options.keyMap,c,a)}"multi"==c&&(a.state.keySeq=b);"handled"==c&&Ea(a,"keyHandled",a,b,d);if("handled"==c||"multi"==c)ka(d),
Zd(a);return!!c}function ig(a,b){var d=eg(b,!0);return d?b.shiftKey&&!a.state.keySeq?Bc(a,"Shift-"+d,b,function(c){return md(a,c,!0)})||Bc(a,d,b,function(c){if("string"==typeof c?/^go[A-Z]/.test(c):c.motion)return md(a,c)}):Bc(a,d,b,function(c){return md(a,c)}):!1}function nh(a,b,d){return Bc(a,"'"+d+"'",b,function(c){return md(a,c,!0)})}function jg(a){if(!a.target||a.target==this.display.input.getField())if(this.curOp.focus=I(v(this.display.wrapper)),!ja(this,a)){la&&11>xa&&27==a.keyCode&&(a.returnValue=
!1);var b=a.keyCode;this.display.shift=16==b||a.shiftKey;var d=ig(this,a);Ya&&(qe=d?b:null,!d&&88==b&&!oh&&(Ua?a.metaKey:a.ctrlKey)&&this.replaceSelection("",null,"cut"));gb&&!Ua&&!d&&46==b&&a.shiftKey&&!a.ctrlKey&&document.execCommand&&document.execCommand("cut");18!=b||/\bCodeMirror-crosshair\b/.test(this.display.lineDiv.className)||ph(this)}}function ph(a){function b(c){18!=c.keyCode&&c.altKey||(Cb(d,"CodeMirror-crosshair"),Z(document,"keyup",b),Z(document,"mouseover",b))}var d=a.display.lineDiv;
D(d,"CodeMirror-crosshair");W(document,"keyup",b);W(document,"mouseover",b)}function kg(a){16==a.keyCode&&(this.doc.sel.shift=!1);ja(this,a)}function lg(a){if(!(a.target&&a.target!=this.display.input.getField()||fb(this.display,a)||ja(this,a)||a.ctrlKey&&!a.altKey||Ua&&a.metaKey)){var b=a.keyCode,d=a.charCode;if(Ya&&b==qe)qe=null,ka(a);else if(!Ya||a.which&&!(10>a.which)||!ig(this,a))if(b=String.fromCharCode(null==d?b:d),"\b"!=b&&!nh(this,a,b))this.display.input.onKeyPress(a)}}function qh(a,b){var d=
+new Date;if(Cc&&Cc.compare(d,a,b))return Dc=Cc=null,"triple";if(Dc&&Dc.compare(d,a,b))return Cc=new re(d,a,b),Dc=null,"double";Dc=new re(d,a,b);Cc=null;return"single"}function mg(a){var b=this.display;if(!(ja(this,a)||b.activeTouch&&b.input.supportsTouch()))if(b.input.ensurePolled(),b.shift=a.shiftKey,fb(b,a))Ia||(b.scroller.draggable=!1,setTimeout(function(){return b.scroller.draggable=!0},100));else if(!od(this,a,"gutterClick",!0)){var d=zb(this,a),c=ze(a),e=d?qh(d,c):"single";R(this).defaultView.focus();
1==c&&this.state.selectingText&&this.state.selectingText(a);if(!d||!rh(this,c,d,e,a))if(1==c)d?sh(this,d,e,a):(a.target||a.srcElement)==b.scroller&&ka(a);else if(2==c)d&&hd(this.doc,d),setTimeout(function(){return b.input.focus()},20);else if(3==c)if(se)this.display.input.onContextMenu(a);else ae(this)}}function rh(a,b,d,c,e){var f="Click";"double"==c?f="Double"+f:"triple"==c&&(f="Triple"+f);return Bc(a,cg((1==b?"Left":2==b?"Middle":"Right")+f,e),e,function(g){"string"==typeof g&&(g=Ac[g]);if(!g)return!1;
var h=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),h=g(a,d)!=nd}finally{a.state.suppressEdits=!1}return h})}function sh(a,b,d,c){la?setTimeout(A(mf,a),0):a.curOp.focus=I(v(a.display.wrapper));var e=a.getOption("configureMouse");e=e?e(a,d,c):{};null==e.unit&&(e.unit=(th?c.shiftKey&&c.metaKey:c.altKey)?"rectangle":"single"==d?"char":"double"==d?"word":"line");if(null==e.extend||a.doc.extend)e.extend=a.doc.extend||c.shiftKey;null==e.addNew&&(e.addNew=Ua?c.metaKey:c.ctrlKey);null==e.moveOnDrag&&
(e.moveOnDrag=!(Ua?c.altKey:c.ctrlKey));var f=a.doc.sel,g;a.options.dragDrop&&uh&&!a.isReadOnly()&&"single"==d&&-1<(g=f.contains(b))&&(0>ba((g=f.ranges[g]).from(),b)||0<b.xRel)&&(0<ba(g.to(),b)||0>b.xRel)?vh(a,c,b,e):wh(a,c,b,e)}function vh(a,b,d,c){var e=a.display,f=!1,g=Fa(a,function(l){Ia&&(e.scroller.draggable=!1);a.state.draggingText=!1;a.state.delayingBlurEvent&&(a.hasFocus()?a.state.delayingBlurEvent=!1:ae(a));Z(e.wrapper.ownerDocument,"mouseup",g);Z(e.wrapper.ownerDocument,"mousemove",h);
Z(e.scroller,"dragstart",k);Z(e.scroller,"drop",g);f||(ka(l),c.addNew||hd(a.doc,d,null,null,c.extend),Ia&&!pd||la&&9==xa?setTimeout(function(){e.wrapper.ownerDocument.body.focus({preventScroll:!0});e.input.focus()},20):e.input.focus())}),h=function(l){f=f||10<=Math.abs(b.clientX-l.clientX)+Math.abs(b.clientY-l.clientY)},k=function(){return f=!0};Ia&&(e.scroller.draggable=!0);a.state.draggingText=g;g.copy=!c.moveOnDrag;W(e.wrapper.ownerDocument,"mouseup",g);W(e.wrapper.ownerDocument,"mousemove",h);
W(e.scroller,"dragstart",k);W(e.scroller,"drop",g);a.state.delayingBlurEvent=!0;setTimeout(function(){return e.input.focus()},20);e.scroller.dragDrop&&e.scroller.dragDrop()}function ng(a,b,d){if("char"==d)return new na(b,b);if("word"==d)return a.findWordAt(b);if("line"==d)return new na(H(b.line,0),ca(a.doc,H(b.line+1,0)));a=d(a,b);return new na(a.from,a.to)}function wh(a,b,d,c){function e(U){if(0!=ba(u,U))if(u=U,"rectangle"==c.unit){var sa=[],oa=a.options.tabSize,ua=q(T(k,d.line).text,d.ch,oa),wa=
q(T(k,U.line).text,U.ch,oa),ha=Math.min(ua,wa);ua=Math.max(ua,wa);wa=Math.min(d.line,U.line);for(var va=Math.min(a.lastLine(),Math.max(d.line,U.line));wa<=va;wa++){var ma=T(k,wa).text,pa=E(ma,ha,oa);ha==ua?sa.push(new na(H(wa,pa),H(wa,pa))):ma.length>pa&&sa.push(new na(H(wa,pa),H(wa,E(ma,ua,oa))))}sa.length||sa.push(new na(d,d));Ha(k,Za(a,l.ranges.slice(0,p).concat(sa),p),{origin:"*mouse",scroll:!1});a.scrollIntoView(U)}else sa=r,ha=ng(a,U,c.unit),U=sa.anchor,0<ba(ha.anchor,U)?(oa=ha.head,U=Qc(sa.from(),
ha.anchor)):(oa=ha.anchor,U=Pc(sa.to(),ha.head)),sa=l.ranges.slice(0),sa[p]=xh(a,new na(ca(k,U),oa)),Ha(k,Za(a,sa,p),te)}function f(U){var sa=++N,oa=zb(a,U,!0,"rectangle"==c.unit);if(oa)if(0!=ba(oa,u)){a.curOp.focus=I(v(a.display.wrapper));e(oa);var ua=ad(h,k);(oa.line>=ua.to||oa.line<ua.from)&&setTimeout(Fa(a,function(){N==sa&&f(U)}),150)}else{var wa=U.clientY<C.top?-20:U.clientY>C.bottom?20:0;wa&&setTimeout(Fa(a,function(){N==sa&&(h.scroller.scrollTop+=wa,f(U))}),50)}}function g(U){a.state.selectingText=
!1;N=Infinity;U&&(ka(U),h.input.focus());Z(h.wrapper.ownerDocument,"mousemove",Y);Z(h.wrapper.ownerDocument,"mouseup",Da);k.history.lastSelOrigin=null}la&&ae(a);var h=a.display,k=a.doc;ka(b);var l=k.sel,m=l.ranges;if(c.addNew&&!c.extend){var p=k.sel.contains(d);var r=-1<p?m[p]:new na(d,d)}else r=k.sel.primary(),p=k.sel.primIndex;"rectangle"==c.unit?(c.addNew||(r=new na(d,d)),d=zb(a,b,!0,!0),p=-1):(b=ng(a,d,c.unit),r=c.extend?le(r,b.anchor,b.head,c.extend):b);c.addNew?-1==p?(p=m.length,Ha(k,Za(a,m.concat([r]),
p),{scroll:!1,origin:"*mouse"})):1<m.length&&m[p].empty()&&"char"==c.unit&&!c.extend?(Ha(k,Za(a,m.slice(0,p).concat(m.slice(p+1)),0),{scroll:!1,origin:"*mouse"}),l=k.sel):me(k,p,r,te):(p=0,Ha(k,new Ta([r],0),te),l=k.sel);var u=d,C=h.wrapper.getBoundingClientRect(),N=0,Y=Fa(a,function(U){0!==U.buttons&&ze(U)?f(U):g(U)}),Da=Fa(a,g);a.state.selectingText=Da;W(h.wrapper.ownerDocument,"mousemove",Y);W(h.wrapper.ownerDocument,"mouseup",Da)}function xh(a,b){var d=b.anchor,c=b.head,e=T(a.doc,d.line);if(0==
ba(d,c)&&d.sticky==c.sticky)return b;e=ea(e);if(!e)return b;var f=X(e,d.ch,d.sticky),g=e[f];if(g.from!=d.ch&&g.to!=d.ch)return b;var h=f+(g.from==d.ch==(1!=g.level)?0:1);if(0==h||h==e.length)return b;c.line!=d.line?a=0<(c.line-d.line)*("ltr"==a.doc.direction?1:-1):(a=X(e,c.ch,c.sticky),f=a-f||(c.ch-d.ch)*(1==g.level?-1:1),a=a==h-1||a==h?0>f:0<f);e=e[h+(a?-1:0)];e=(h=a==(1==e.level))?e.from:e.to;h=h?"after":"before";return d.ch==e&&d.sticky==h?b:new na(new H(d.line,e,h),c)}function od(a,b,d,c){if(b.touches){var e=
b.touches[0].clientX;var f=b.touches[0].clientY}else try{e=b.clientX,f=b.clientY}catch(k){return!1}if(e>=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;c&&ka(b);c=a.display;var g=c.lineDiv.getBoundingClientRect();if(f>g.bottom||!ia(a,d))return ud(b);f-=g.top-c.viewOffset;for(g=0;g<a.display.gutterSpecs.length;++g){var h=c.gutters.childNodes[g];if(h&&h.getBoundingClientRect().right>=e)return e=ub(a.doc,f),S(a,d,a,e,a.display.gutterSpecs[g].className,b),ud(b)}}function og(a,b){var d;
(d=fb(a.display,b))||(d=ia(a,"gutterContextMenu")?od(a,b,"gutterContextMenu",!1):!1);if(!d&&!ja(a,b,"contextmenu")&&!se)a.display.input.onContextMenu(b)}function pg(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-");kc(a)}function yh(a,b,d){!b!=!(d&&d!=$b)&&(d=a.display.dragFunctions,b=b?W:Z,b(a.display.scroller,"dragstart",d.start),b(a.display.scroller,"dragenter",d.enter),b(a.display.scroller,"dragover",d.over),b(a.display.scroller,
"dragleave",d.leave),b(a.display.scroller,"drop",d.drop))}function zh(a){a.options.lineWrapping?(D(a.display.wrapper,"CodeMirror-wrap"),a.display.sizer.style.minWidth="",a.display.sizerWidth=null):(Cb(a.display.wrapper,"CodeMirror-wrap"),Id(a));Wd(a);La(a);kc(a);setTimeout(function(){return Rb(a)},100)}function ya(a,b){var d=this;if(!(this instanceof ya))return new ya(a,b);this.options=b=b?n(b):{};n(qg,b,!1);var c=b.value;"string"==typeof c?c=new Na(c,b.mode,null,b.lineSeparator,b.direction):b.mode&&
(c.modeOption=b.mode);this.doc=c;var e=new ya.inputStyles[b.inputStyle](this);a=this.display=new Zg(a,c,e,b);a.wrapper.CodeMirror=this;pg(this);b.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");sf(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 rb,keySeq:null,specialChars:null};b.autofocus&&!rc&&a.input.focus();la&&11>xa&&setTimeout(function(){return d.display.input.reset(!0)},
20);Ah(this);rg||(hh(),rg=!0);Eb(this);this.curOp.forceUpdate=!0;Df(this,c);b.autofocus&&!rc||this.hasFocus()?setTimeout(function(){d.hasFocus()&&!d.state.focused&&$d(d)},20):Pb(this);for(var f in qd)if(qd.hasOwnProperty(f))qd[f](this,b[f],$b);vf(this);b.finishInit&&b.finishInit(this);for(c=0;c<ue.length;++c)ue[c](this);Fb(this);Ia&&b.lineWrapping&&"optimizelegibility"==getComputedStyle(a.lineDiv).textRendering&&(a.lineDiv.style.textRendering="auto")}function Ah(a){function b(){c.activeTouch&&(e=
setTimeout(function(){return c.activeTouch=null},1E3),f=c.activeTouch,f.end=+new Date)}function d(h,k){if(null==k.left)return!0;var l=k.left-h.left;h=k.top-h.top;return 400<l*l+h*h}var c=a.display;W(c.scroller,"mousedown",Fa(a,mg));la&&11>xa?W(c.scroller,"dblclick",Fa(a,function(h){if(!ja(a,h)){var k=zb(a,h);!k||od(a,h,"gutterClick",!0)||fb(a.display,h)||(ka(h),h=a.findWordAt(k),hd(a.doc,h.anchor,h.head))}})):W(c.scroller,"dblclick",function(h){return ja(a,h)||ka(h)});W(c.scroller,"contextmenu",function(h){return og(a,
h)});W(c.input.getField(),"contextmenu",function(h){c.scroller.contains(h.target)||og(a,h)});var e,f={end:0};W(c.scroller,"touchstart",function(h){var k;if(k=!ja(a,h))1!=h.touches.length?k=!1:(k=h.touches[0],k=1>=k.radiusX&&1>=k.radiusY),k=!k;k&&!od(a,h,"gutterClick",!0)&&(c.input.ensurePolled(),clearTimeout(e),k=+new Date,c.activeTouch={start:k,moved:!1,prev:300>=k-f.end?f:null},1==h.touches.length&&(c.activeTouch.left=h.touches[0].pageX,c.activeTouch.top=h.touches[0].pageY))});W(c.scroller,"touchmove",
function(){c.activeTouch&&(c.activeTouch.moved=!0)});W(c.scroller,"touchend",function(h){var k=c.activeTouch;if(k&&!fb(c,h)&&null!=k.left&&!k.moved&&300>new Date-k.start){var l=a.coordsChar(c.activeTouch,"page");k=!k.prev||d(k,k.prev)?new na(l,l):!k.prev.prev||d(k,k.prev.prev)?a.findWordAt(l):new na(H(l.line,0),ca(a.doc,H(l.line+1,0)));a.setSelection(k.anchor,k.head);a.focus();ka(h)}b()});W(c.scroller,"touchcancel",b);W(c.scroller,"scroll",function(){c.scroller.clientHeight&&(nc(a,c.scroller.scrollTop),
Db(a,c.scroller.scrollLeft,!0),S(a,"scroll",a))});W(c.scroller,"mousewheel",function(h){return zf(a,h)});W(c.scroller,"DOMMouseScroll",function(h){return zf(a,h)});W(c.wrapper,"scroll",function(){return c.wrapper.scrollTop=c.wrapper.scrollLeft=0});c.dragFunctions={enter:function(h){ja(a,h)||cc(h)},over:function(h){if(!ja(a,h)){var k=zb(a,h);if(k){var l=document.createDocumentFragment();Xd(a,k,l);a.display.dragCursor||(a.display.dragCursor=z("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),
a.display.lineSpace.insertBefore(a.display.dragCursor,a.display.cursorDiv));F(a.display.dragCursor,l)}cc(h)}},start:function(h){if(la&&(!a.state.draggingText||100>+new Date-$f))cc(h);else if(!ja(a,h)&&!fb(a.display,h)&&(h.dataTransfer.setData("Text",a.getSelection()),h.dataTransfer.effectAllowed="copyMove",h.dataTransfer.setDragImage&&!pd)){var k=z("img",null,null,"position: fixed; left: 0; top: 0;");k.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";Ya&&(k.width=k.height=
1,a.display.wrapper.appendChild(k),k._top=k.offsetTop);h.dataTransfer.setDragImage(k,0,0);Ya&&k.parentNode.removeChild(k)}},drop:Fa(a,gh),leave:function(h){ja(a,h)||Zf(a)}};var g=c.input.getField();W(g,"keyup",function(h){return kg.call(a,h)});W(g,"keydown",Fa(a,jg));W(g,"keypress",Fa(a,lg));W(g,"focus",function(h){return $d(a,h)});W(g,"blur",function(h){return Pb(a,h)})}function Ec(a,b,d,c){var e=a.doc,f;null==d&&(d="add");"smart"==d&&(e.mode.indent?f=ec(a,b).state:d="prev");var g=a.options.tabSize,
h=T(e,b),k=q(h.text,null,g);h.stateAfter&&(h.stateAfter=null);var l=h.text.match(/^\s*/)[0];if(!c&&!/\S/.test(h.text)){var m=0;d="not"}else if("smart"==d&&(m=e.mode.indent(f,h.text.slice(l.length),h.text),m==nd||150<m)){if(!c)return;d="prev"}"prev"==d?m=b>e.first?q(T(e,b-1).text,null,g):0:"add"==d?m=k+a.options.indentUnit:"subtract"==d?m=k-a.options.indentUnit:"number"==typeof d&&(m=k+d);m=Math.max(0,m);d="";c=0;if(a.options.indentWithTabs)for(a=Math.floor(m/g);a;--a)c+=g,d+="\t";c<m&&(d+=L(m-c));
if(d!=l)return Wb(e,d,H(b,0),H(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=H(b,l.length);me(e,g,new na(b,b));break}}function ve(a,b,d,c,e){var f=a.doc;a.display.shift=!1;c||(c=f.sel);var g=+new Date-200,h="paste"==e||a.state.pasteIncoming>g,k=we(b),l=null;if(h&&1<c.ranges.length)if(Ra&&Ra.text.join("\n")==b){if(0==c.ranges.length%Ra.text.length){l=[];for(var m=0;m<Ra.text.length;m++)l.push(f.splitLines(Ra.text[m]))}}else k.length==
c.ranges.length&&a.options.pasteLinesPerSelection&&(l=J(k,function(N){return[N]}));m=a.curOp.updateInput;for(var p=c.ranges.length-1;0<=p;p--){var r=c.ranges[p],u=r.from(),C=r.to();r.empty()&&(d&&0<d?u=H(u.line,u.ch-d):a.state.overwrite&&!h?C=H(C.line,Math.min(T(f,C.line).text.length,C.ch+O(k).length)):h&&Ra&&Ra.lineWise&&Ra.text.join("\n")==k.join("\n")&&(u=C=H(u.line,0)));r={from:u,to:C,text:l?l[p%l.length]:k,origin:e||(h?"paste":a.state.cutIncoming>g?"cut":"+input")};Vb(a.doc,r);Ea(a,"inputRead",
a,r)}b&&!h&&sg(a,b);Qb(a);2>a.curOp.updateInput&&(a.curOp.updateInput=m);a.curOp.typing=!0;a.state.pasteIncoming=a.state.cutIncoming=-1}function tg(a,b){var d=a.clipboardData&&a.clipboardData.getData("Text");if(d)return a.preventDefault(),b.isReadOnly()||b.options.disableInput||!b.hasFocus()||Qa(b,function(){return ve(b,d,0,null,"paste")}),!0}function sg(a,b){if(a.options.electricChars&&a.options.smartIndent)for(var d=a.doc.sel,c=d.ranges.length-1;0<=c;c--){var e=d.ranges[c];if(!(100<e.head.ch||c&&
d.ranges[c-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=Ec(a,e.head.line,"smart");break}}else f.electricInput&&f.electricInput.test(T(a.doc,e.head.line).text.slice(0,e.head.ch))&&(g=Ec(a,e.head.line,"smart"));g&&Ea(a,"electricInput",a,e.head.line)}}}function ug(a){for(var b=[],d=[],c=0;c<a.doc.sel.ranges.length;c++){var e=a.doc.sel.ranges[c].head.line;e={anchor:H(e,0),head:H(e+
1,0)};d.push(e);b.push(a.getRange(e.anchor,e.head))}return{text:b,ranges:d}}function xe(a,b,d,c){a.setAttribute("autocorrect",d?"on":"off");a.setAttribute("autocapitalize",c?"on":"off");a.setAttribute("spellcheck",!!b)}function vg(){var a=z("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none"),b=z("div",[a],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");Ia?a.style.width="1000px":a.setAttribute("wrap","off");
Fc&&(a.style.border="1px solid black");return b}function ye(a,b,d,c,e){function f(N){if("codepoint"==c){var Y=k.text.charCodeAt(b.ch+(0<d?0:-1));Y=isNaN(Y)?null:new H(b.line,Math.max(0,Math.min(k.text.length,b.ch+d*((0<d?55296<=Y&&56320>Y:56320<=Y&&57343>Y)?2:1))),-d)}else Y=e?lh(a.cm,k,b,d):oe(k,b,d);if(null==Y){if(N=!N)N=b.line+l,N<a.first||N>=a.first+a.size?N=!1:(b=new H(N,b.ch,b.sticky),N=k=T(a,N));if(N)b=pe(e,a.cm,k,b.line,l);else return!1}else b=Y;return!0}var g=b,h=d,k=T(a,b.line),l=e&&"rtl"==
a.direction?-d:d;if("char"==c||"codepoint"==c)f();else if("column"==c)f(!0);else if("word"==c||"group"==c)for(var m=null,p="group"==c,r=a.cm&&a.cm.getHelper(b,"wordChars"),u=!0;!(0>d)||f(!u);u=!1){var C=k.text.charAt(b.ch)||"\n";C=za(C,r)?"w":p&&"\n"==C?"n":!p||/\s/.test(C)?null:"p";!p||u||C||(C="s");if(m&&m!=C){0>d&&(d=1,f(),b.sticky="after");break}C&&(m=C);if(0<d&&!f(!u))break}h=jd(a,b,g,h,!0);Ad(g,h)&&(h.hitSide=!0);return h}function wg(a,b,d,c){var e=a.doc,f=b.left;if("page"==c){var g=Math.min(a.display.wrapper.clientHeight,
R(a).defaultView.innerHeight||e(a).documentElement.clientHeight);g=Math.max(g-.5*Ob(a.display),3);g=(0<d?b.bottom:b.top)+d*g}else"line"==c&&(g=0<d?b.bottom+3:b.top-3);for(;;){b=Td(a,f,g);if(!b.outside)break;if(0>d?0>=g:g>=e.height){b.hitSide=!0;break}g+=5*d}return b}function xg(a,b){var d=Od(a,b.line);if(!d||d.hidden)return null;var c=T(a.doc,b.line);d=Ye(d,c,b.line);a=ea(c,a.doc.direction);c="left";a&&(c=X(a,b.ch)%2?"right":"left");b=Ze(d.map,b.ch,c);b.offset="right"==b.collapse?b.end:b.start;return b}
function Bh(a){for(;a;a=a.parentNode)if(/CodeMirror-gutter-wrapper/.test(a.className))return!0;return!1}function ac(a,b){b&&(a.bad=!0);return a}function Ch(a,b,d,c,e){function f(u){return function(C){return C.id==u}}function g(){m&&(l+=p,r&&(l+=p),m=r=!1)}function h(u){u&&(g(),l+=u)}function k(u){if(1==u.nodeType){var C=u.getAttribute("cm-text");if(C)h(C);else{C=u.getAttribute("cm-marker");var N;if(C)u=a.findMarks(H(c,0),H(e+1,0),f(+C)),u.length&&(N=u[0].find(0))&&h(tb(a.doc,N.from,N.to).join(p));
else if("false"!=u.getAttribute("contenteditable")&&(N=/^(pre|div|p|li|table|br)$/i.test(u.nodeName),/^br$/i.test(u.nodeName)||0!=u.textContent.length)){N&&g();for(C=0;C<u.childNodes.length;C++)k(u.childNodes[C]);/^(pre|p)$/i.test(u.nodeName)&&(r=!0);N&&(m=!0)}}}else 3==u.nodeType&&h(u.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(var l="",m=!1,p=a.doc.lineSeparator(),r=!1;;){k(b);if(b==d)break;b=b.nextSibling;r=!1}return l}function rd(a,b,d){if(b==a.display.lineDiv){var c=a.display.lineDiv.childNodes[d];
if(!c)return ac(a.clipPos(H(a.display.viewTo-1)),!0);b=null;d=0}else for(c=b;;c=c.parentNode){if(!c||c==a.display.lineDiv)return null;if(c.parentNode&&c.parentNode==a.display.lineDiv)break}for(var e=0;e<a.display.view.length;e++){var f=a.display.view[e];if(f.node==c)return Dh(f,b,d)}}function Dh(a,b,d){function c(m,p,r){for(var u=-1;u<(l?l.length:0);u++)for(var C=0>u?k.map:l[u],N=0;N<C.length;N+=3){var Y=C[N+2];if(Y==m||Y==p){p=qa(0>u?a.line:a.rest[u]);u=C[N]+r;if(0>r||Y!=m)u=C[N+(r?1:0)];return H(p,
u)}}}var e=a.text.firstChild,f=!1;if(!b||!B(e,b))return ac(H(qa(a.line),0),!0);if(b==e&&(f=!0,b=e.childNodes[d],d=0,!b))return d=a.rest?O(a.rest):a.line,ac(H(qa(d),d.text.length),f);var g=3==b.nodeType?b:null,h=b;g||1!=b.childNodes.length||3!=b.firstChild.nodeType||(g=b.firstChild,d&&(d=g.nodeValue.length));for(;h.parentNode!=e;)h=h.parentNode;var k=a.measure,l=k.maps;if(b=c(g,h,d))return ac(b,f);e=h.nextSibling;for(g=g?g.nodeValue.length-d:0;e;e=e.nextSibling){if(b=c(e,e.firstChild,0))return ac(H(b.line,
b.ch-g),f);g+=e.textContent.length}for(h=h.previousSibling;h;h=h.previousSibling){if(b=c(h,h.firstChild,-1))return ac(H(b.line,b.ch+d),f);d+=h.textContent.length}}var Oa=navigator.userAgent,yg=navigator.platform,gb=/gecko\/\d/i.test(Oa),zg=/MSIE \d/.test(Oa),Ag=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Oa),sd=/Edge\/(\d+)/.exec(Oa),la=zg||Ag||sd,xa=la&&(zg?document.documentMode||6:+(sd||Ag)[1]),Ia=!sd&&/WebKit\//.test(Oa),Eh=Ia&&/Qt\/\d+\.\d+/.test(Oa),kb=!sd&&/Chrome\/(\d+)/.exec(Oa),xf=kb&&+kb[1],
Ya=/Opera\//.test(Oa),pd=/Apple Computer/.test(navigator.vendor),Fh=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(Oa),Wg=/PhantomJS/.test(Oa),Fc=pd&&(/Mobile\/\w+/.test(Oa)||2<navigator.maxTouchPoints),Vc=/Android/.test(Oa),rc=Fc||Vc||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(Oa),Ua=Fc||/Mac/.test(yg),th=/\bCrOS\b/.test(Oa),Gh=/win/i.test(yg),Gb=Ya&&Oa.match(/Version\/(\d*\.\d*)/);Gb&&(Gb=Number(Gb[1]));Gb&&15<=Gb&&(Ya=!1,Ia=!0);var dg=Ua&&(Eh||Ya&&(null==Gb||12.11>Gb)),se=gb||la&&9<=xa,Cb=function(a,
b){var d=a.className;if(b=t(b).exec(d)){var c=d.slice(b.index+b[0].length);a.className=d.slice(0,b.index)+(c?b[1]+c:"")}};var gc=document.createRange?function(a,b,d,c){var e=document.createRange();e.setEnd(c||a,d);e.setStart(a,b);return e}:function(a,b,d){var c=document.body.createTextRange();try{c.moveToElementText(a.parentNode)}catch(e){return c}c.collapse(!0);c.moveEnd("character",d);c.moveStart("character",b);return c};var Gc=function(a){a.select()};Fc?Gc=function(a){a.selectionStart=0;a.selectionEnd=
a.value.length}:la&&(Gc=function(a){try{a.select()}catch(b){}});var rb=function(){this.f=this.id=null;this.time=0;this.handler=A(this.onTimeout,this)};rb.prototype.onTimeout=function(a){a.id=0;a.time<=+new Date?a.f():setTimeout(a.handler,a.time-+new Date)};rb.prototype.set=function(a,b){this.f=b;b=+new Date+a;if(!this.id||b<this.time)clearTimeout(this.id),this.id=setTimeout(this.handler,a),this.time=b};var nd={toString:function(){return"CodeMirror.Pass"}},db={scroll:!1},te={origin:"*mouse"},Hc={origin:"+move"},
Mc=[""],Bg=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Cg=/[\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]/,
bc=null,Dg=function(){function a(g,h,k){this.level=g;this.from=h;this.to=k}var b=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,d=/[stwN]/,c=/[LRr]/,e=/[Lb1n]/,f=/[1n]/;return function(g,h){var k="ltr"==h?"L":"R";if(0==g.length||"ltr"==h&&!b.test(g))return!1;for(var l=g.length,m=[],p=0;p<l;++p){var r=m,u=r.push;var C=g.charCodeAt(p);C=247>=C?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(C):
1424<=C&&1524>=C?"R":1536<=C&&1785>=C?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(C-1536):1774<=C&&2220>=C?"r":8192<=C&&8203>=C?"w":8204==C?"b":"L";u.call(r,C)}p=0;for(r=k;p<l;++p)u=m[p],"m"==u?m[p]=r:r=u;p=0;for(r=k;p<l;++p)u=m[p],"1"==u&&"r"==r?m[p]="n":c.test(u)&&(r=u,"r"==u&&(m[p]=
"R"));p=1;for(r=m[0];p<l-1;++p)u=m[p],"+"==u&&"1"==r&&"1"==m[p+1]?m[p]="1":","!=u||r!=m[p+1]||"1"!=r&&"n"!=r||(m[p]=r),r=u;for(p=0;p<l;++p)if(r=m[p],","==r)m[p]="N";else if("%"==r){for(r=p+1;r<l&&"%"==m[r];++r);for(u=p&&"!"==m[p-1]||r<l&&"1"==m[r]?"1":"N";p<r;++p)m[p]=u;p=r-1}p=0;for(r=k;p<l;++p)u=m[p],"L"==r&&"1"==u?m[p]="L":c.test(u)&&(r=u);for(r=0;r<l;++r)if(d.test(m[r])){for(p=r+1;p<l&&d.test(m[p]);++p);u="L"==(r?m[r-1]:k);for(u=u==("L"==(p<l?m[p]:k))?u?"L":"R":k;r<p;++r)m[r]=u;r=p-1}k=[];var N;
for(p=0;p<l;)if(e.test(m[p])){r=p;for(++p;p<l&&e.test(m[p]);++p);k.push(new a(0,r,p))}else{var Y=p;r=k.length;u="rtl"==h?1:0;for(++p;p<l&&"L"!=m[p];++p);for(C=Y;C<p;)if(f.test(m[C])){Y<C&&(k.splice(r,0,new a(1,Y,C)),r+=u);Y=C;for(++C;C<p&&f.test(m[C]);++C);k.splice(r,0,new a(2,Y,C));r+=u;Y=C}else++C;Y<p&&k.splice(r,0,new a(1,Y,p))}"ltr"==h&&(1==k[0].level&&(N=g.match(/^\s+/))&&(k[0].from=N[0].length,k.unshift(new a(0,0,N[0].length))),1==O(k).level&&(N=g.match(/\s+$/))&&(O(k).to-=N[0].length,k.push(new a(0,
l-N[0].length,l))));return"rtl"==h?k.reverse():k}}(),Nc=[],W=function(a,b,d){a.addEventListener?a.addEventListener(b,d,!1):a.attachEvent?a.attachEvent("on"+b,d):(a=a._handlers||(a._handlers={}),a[b]=(a[b]||Nc).concat(d))},uh=function(){if(la&&9>xa)return!1;var a=z("div");return"draggable"in a||"dragDrop"in a}(),Kd,Jd,we=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,d=[],c=a.length;b<=c;){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?(d.push(f.slice(0,g)),b+=g+1):(d.push(f),b=e+1)}return d}:function(a){return a.split(/\r\n?|\n/)},Hh=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(d){}return b&&b.parentElement()==a?0!=b.compareEndPoints("StartToEnd",b):!1},oh=function(){var a=z("div");if("oncopy"in a)return!0;a.setAttribute("oncopy","return;");return"function"==typeof a.oncopy}(),Qd=null,vd={},Jb={},Kb={},Ca=
function(a,b,d){this.pos=this.start=0;this.string=a;this.tabSize=b||8;this.lineStart=this.lastColumnPos=this.lastColumnValue=0;this.lineOracle=d};Ca.prototype.eol=function(){return this.pos>=this.string.length};Ca.prototype.sol=function(){return this.pos==this.lineStart};Ca.prototype.peek=function(){return this.string.charAt(this.pos)||void 0};Ca.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)};Ca.prototype.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};Ca.prototype.eatWhile=function(a){for(var b=this.pos;this.eat(a););return this.pos>b};Ca.prototype.eatSpace=function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a};Ca.prototype.skipToEnd=function(){this.pos=this.string.length};Ca.prototype.skipTo=function(a){a=this.string.indexOf(a,this.pos);if(-1<a)return this.pos=a,!0};Ca.prototype.backUp=function(a){this.pos-=a};Ca.prototype.column=
function(){this.lastColumnPos<this.start&&(this.lastColumnValue=q(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start);return this.lastColumnValue-(this.lineStart?q(this.string,this.lineStart,this.tabSize):0)};Ca.prototype.indentation=function(){return q(this.string,null,this.tabSize)-(this.lineStart?q(this.string,this.lineStart,this.tabSize):0)};Ca.prototype.match=function(a,b,d){if("string"==typeof a){var c=function(f){return d?f.toLowerCase():
f},e=this.string.substr(this.pos,a.length);if(c(e)==c(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}};Ca.prototype.current=function(){return this.string.slice(this.start,this.pos)};Ca.prototype.hideFirstChars=function(a,b){this.lineStart+=a;try{return b()}finally{this.lineStart-=a}};Ca.prototype.lookAhead=function(a){var b=this.lineOracle;return b&&b.lookAhead(a)};Ca.prototype.baseToken=
function(){var a=this.lineOracle;return a&&a.baseToken(this.pos)};var Rc=function(a,b){this.state=a;this.lookAhead=b},ab=function(a,b,d,c){this.state=b;this.doc=a;this.line=d;this.maxLookAhead=c||0;this.baseTokens=null;this.baseTokenPos=1};ab.prototype.lookAhead=function(a){var b=this.doc.getLine(this.line+a);null!=b&&a>this.maxLookAhead&&(this.maxLookAhead=a);return b};ab.prototype.baseToken=function(a){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=a;)this.baseTokenPos+=
2;var b=this.baseTokens[this.baseTokenPos+1];return{type:b&&b.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-a}};ab.prototype.nextLine=function(){this.line++;0<this.maxLookAhead&&this.maxLookAhead--};ab.fromSaved=function(a,b,d){return b instanceof Rc?new ab(a,sb(a.mode,b.state),d,b.lookAhead):new ab(a,sb(a.mode,b),d)};ab.prototype.save=function(a){a=!1!==a?sb(this.doc.mode,this.state):this.state;return 0<this.maxLookAhead?new Rc(a,this.maxLookAhead):a};var He=function(a,b,
d){this.start=a.start;this.end=a.pos;this.string=a.current();this.type=b||null;this.state=d},Rf=!1,eb=!1,Sb=function(a,b,d){this.text=a;Le(this,b);this.height=d?d(this):1};Sb.prototype.lineNo=function(){return qa(this)};Pa(Sb);var Kg={},Jg={},Mb=null,hc=null,$e={left:0,right:0,top:0,bottom:0},yb,Hb=function(a,b,d){this.cm=d;var c=this.vert=z("div",[z("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),e=this.horiz=z("div",[z("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");
c.tabIndex=e.tabIndex=-1;a(c);a(e);W(c,"scroll",function(){c.clientHeight&&b(c.scrollTop,"vertical")});W(e,"scroll",function(){e.clientWidth&&b(e.scrollLeft,"horizontal")});this.checkedZeroWidth=!1;la&&8>xa&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Hb.prototype.update=function(a){var b=a.scrollWidth>a.clientWidth+1,d=a.scrollHeight>a.clientHeight+1,c=a.nativeBarWidth;d?(this.vert.style.display="block",this.vert.style.bottom=b?c+"px":"0",this.vert.firstChild.style.height=Math.max(0,
a.scrollHeight-a.clientHeight+(a.viewHeight-(b?c:0)))+"px"):(this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0");b?(this.horiz.style.display="block",this.horiz.style.right=d?c+"px":"0",this.horiz.style.left=a.barLeft+"px",this.horiz.firstChild.style.width=Math.max(0,a.scrollWidth-a.clientWidth+(a.viewWidth-a.barLeft-(d?c:0)))+"px"):(this.horiz.style.display="",this.horiz.firstChild.style.width="0");!this.checkedZeroWidth&&0<a.clientHeight&&(0==c&&this.zeroWidthHack(),
this.checkedZeroWidth=!0);return{right:d?c:0,bottom:b?c:0}};Hb.prototype.setScrollLeft=function(a){this.horiz.scrollLeft!=a&&(this.horiz.scrollLeft=a);this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")};Hb.prototype.setScrollTop=function(a){this.vert.scrollTop!=a&&(this.vert.scrollTop=a);this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")};Hb.prototype.zeroWidthHack=function(){this.horiz.style.height=this.vert.style.width=Ua&&!Fh?"12px":"18px";
this.horiz.style.visibility=this.vert.style.visibility="hidden";this.disableHoriz=new rb;this.disableVert=new rb};Hb.prototype.enableZeroWidthBar=function(a,b,d){function c(){var e=a.getBoundingClientRect();("vert"==d?document.elementFromPoint(e.right-1,(e.top+e.bottom)/2):document.elementFromPoint((e.right+e.left)/2,e.bottom-1))!=a?a.style.visibility="hidden":b.set(1E3,c)}a.style.visibility="";b.set(1E3,c)};Hb.prototype.clear=function(){var a=this.horiz.parentNode;a.removeChild(this.horiz);a.removeChild(this.vert)};
var Ic=function(){};Ic.prototype.update=function(){return{bottom:0,right:0}};Ic.prototype.setScrollLeft=function(){};Ic.prototype.setScrollTop=function(){};Ic.prototype.clear=function(){};var tf={"native":Hb,"null":Ic},Vg=0,dd=function(a,b,d){var c=a.display;this.viewport=b;this.visible=ad(c,a.doc,b);this.editorIsHidden=!c.wrapper.offsetWidth;this.wrapperHeight=c.wrapper.clientHeight;this.wrapperWidth=c.wrapper.clientWidth;this.oldDisplayWidth=vb(a);this.force=d;this.dims=Pd(a);this.events=[]};dd.prototype.signal=
function(a,b){ia(a,b)&&this.events.push(arguments)};dd.prototype.finish=function(){for(var a=0;a<this.events.length;a++)S.apply(null,this.events[a])};var ed=0,hb=null;la?hb=-.53:gb?hb=15:kb?hb=-.7:pd&&(hb=-1/3);var Ta=function(a,b){this.ranges=a;this.primIndex=b};Ta.prototype.primary=function(){return this.ranges[this.primIndex]};Ta.prototype.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 d=
this.ranges[b],c=a.ranges[b];if(!Ad(d.anchor,c.anchor)||!Ad(d.head,c.head))return!1}return!0};Ta.prototype.deepCopy=function(){for(var a=[],b=0;b<this.ranges.length;b++)a[b]=new na(Bd(this.ranges[b].anchor),Bd(this.ranges[b].head));return new Ta(a,this.primIndex)};Ta.prototype.somethingSelected=function(){for(var a=0;a<this.ranges.length;a++)if(!this.ranges[a].empty())return!0;return!1};Ta.prototype.contains=function(a,b){b||(b=a);for(var d=0;d<this.ranges.length;d++){var c=this.ranges[d];if(0<=ba(b,
c.from())&&0>=ba(a,c.to()))return d}return-1};var na=function(a,b){this.anchor=a;this.head=b};na.prototype.from=function(){return Qc(this.anchor,this.head)};na.prototype.to=function(){return Pc(this.anchor,this.head)};na.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};vc.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,b){for(var d=a,c=a+b;d<c;++d){var e=this.lines[d];this.height-=e.height;var f=e;f.parent=null;Ke(f);
Ea(e,"delete")}this.lines.splice(a,b)},collapse:function(a){a.push.apply(a,this.lines)},insertInner:function(a,b,d){this.height+=d;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,d){for(b=a+b;a<b;++a)if(d(this.lines[a]))return!0}};wc.prototype={chunkSize:function(){return this.size},removeInner:function(a,b){this.size-=b;for(var d=0;d<this.children.length;++d){var c=this.children[d],e=c.chunkSize();if(a<e){var f=Math.min(b,
e-a),g=c.height;c.removeInner(a,f);this.height-=g-c.height;e==f&&(this.children.splice(d--,1),c.parent=null);if(0==(b-=f))break;a=0}else a-=e}25>this.size-b&&(1<this.children.length||!(this.children[0]instanceof vc))&&(a=[],this.collapse(a),this.children=[new vc(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,d){this.size+=b.length;this.height+=d;for(var c=0;c<this.children.length;++c){var e=this.children[c],
f=e.chunkSize();if(a<=f){e.insertInner(a,b,d);if(e.lines&&50<e.lines.length){for(b=a=e.lines.length%25+25;b<e.lines.length;)d=new vc(e.lines.slice(b,b+=25)),e.height-=d.height,this.children.splice(++c,0,d),d.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 wc(b);if(a.parent){a.size-=b.size;a.height-=b.height;var d=x(a.parent.children,a);a.parent.children.splice(d+
1,0,b)}else d=new wc(a.children),d.parent=a,a.children=[d,b],a=d;b.parent=a.parent}while(10<a.children.length);a.parent.maybeSpill()}},iterN:function(a,b,d){for(var c=0;c<this.children.length;++c){var e=this.children[c],f=e.chunkSize();if(a<f){f=Math.min(b,f-a);if(e.iterN(a,f,d))return!0;if(0==(b-=f))break;a=0}else a-=f}}};var xc=function(a,b,d){if(d)for(var c in d)d.hasOwnProperty(c)&&(this[c]=d[c]);this.doc=a;this.node=b};xc.prototype.clear=function(){var a=this.doc.cm,b=this.line.widgets,d=this.line,
c=qa(d);if(null!=c&&b){for(var e=0;e<b.length;++e)b[e]==this&&b.splice(e--,1);b.length||(d.widgets=null);var f=jc(this);$a(d,Math.max(0,d.height-f));a&&(Qa(a,function(){var g=-f;bb(d)<(a.curOp&&a.curOp.scrollTop||a.doc.scrollTop)&&bd(a,g);mb(a,c,"widget")}),Ea(a,"lineWidgetCleared",a,this,c))}};xc.prototype.changed=function(){var a=this,b=this.height,d=this.doc.cm,c=this.line;this.height=null;var e=jc(this)-b;e&&(jb(this.doc,c)||$a(c,c.height+e),d&&Qa(d,function(){d.curOp.forceUpdate=!0;bb(c)<(d.curOp&&
d.curOp.scrollTop||d.doc.scrollTop)&&bd(d,e);Ea(d,"lineWidgetChanged",d,a,qa(c))}))};Pa(xc);var Xf=0,pb=function(a,b){this.lines=[];this.type=b;this.doc=a;this.id=++Xf};pb.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;b&&Eb(a);if(ia(this,"clear")){var d=this.find();d&&Ea(this,"clear",d.from,d.to)}for(var c=d=null,e=0;e<this.lines.length;++e){var f=this.lines[e],g=fc(f.markedSpans,this);a&&!this.collapsed?mb(a,qa(f),"text"):a&&(null!=g.to&&(c=qa(f)),null!=g.from&&
(d=qa(f)));for(var h=f,k=void 0,l=f.markedSpans,m=g,p=0;p<l.length;++p)l[p]!=m&&(k||(k=[])).push(l[p]);h.markedSpans=k;null==g.from&&this.collapsed&&!jb(this.doc,f)&&a&&$a(f,Ob(a.display))}if(a&&this.collapsed&&!a.options.lineWrapping)for(e=0;e<this.lines.length;++e)f=Va(this.lines[e]),g=Tc(f),g>a.display.maxLineLength&&(a.display.maxLine=f,a.display.maxLineLength=g,a.display.maxLineChanged=!0);null!=d&&a&&this.collapsed&&La(a,d,c+1);this.lines.length=0;this.explicitlyCleared=!0;this.atomic&&this.doc.cantEdit&&
(this.doc.cantEdit=!1,a&&Nf(a.doc));a&&Ea(a,"markerCleared",a,this,d,c);b&&Fb(a);this.parent&&this.parent.clear()}};pb.prototype.find=function(a,b){null==a&&"bookmark"==this.type&&(a=1);for(var d,c,e=0;e<this.lines.length;++e){var f=this.lines[e],g=fc(f.markedSpans,this);if(null!=g.from&&(d=H(b?f:qa(f),g.from),-1==a))return d;if(null!=g.to&&(c=H(b?f:qa(f),g.to),1==a))return c}return d&&{from:d,to:c}};pb.prototype.changed=function(){var a=this,b=this.find(-1,!0),d=this,c=this.doc.cm;b&&c&&Qa(c,function(){var e=
b.line,f=qa(b.line);if(f=Od(c,f))af(f),c.curOp.selectionChanged=c.curOp.forceUpdate=!0;c.curOp.updateMaxLine=!0;jb(d.doc,e)||null==d.height||(f=d.height,d.height=null,(f=jc(d)-f)&&$a(e,e.height+f));Ea(c,"markerChanged",c,a)})};pb.prototype.attachLine=function(a){if(!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;b.maybeHiddenMarkers&&-1!=x(b.maybeHiddenMarkers,this)||(b.maybeUnhiddenMarkers||(b.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(a)};pb.prototype.detachLine=function(a){this.lines.splice(x(this.lines,
a),1);!this.lines.length&&this.doc.cm&&(a=this.doc.cm.curOp,(a.maybeHiddenMarkers||(a.maybeHiddenMarkers=[])).push(this))};Pa(pb);var yc=function(a,b){this.markers=a;this.primary=b;for(b=0;b<a.length;++b)a[b].parent=this};yc.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var a=0;a<this.markers.length;++a)this.markers[a].clear();Ea(this,"clear")}};yc.prototype.find=function(a,b){return this.primary.find(a,b)};Pa(yc);var Ih=0,Na=function(a,b,d,c,e){if(!(this instanceof
Na))return new Na(a,b,d,c,e);null==d&&(d=0);wc.call(this,[new vc([new Sb("",null)])]);this.first=d;this.scrollTop=this.scrollLeft=0;this.cantEdit=!1;this.cleanGeneration=1;this.modeFrontier=this.highlightFrontier=d;d=H(d,0);this.sel=ib(d);this.history=new fd(null);this.id=++Ih;this.modeOption=b;this.lineSep=c;this.direction="rtl"==e?"rtl":"ltr";this.extend=!1;"string"==typeof a&&(a=this.splitLines(a));je(this,{from:d,to:d,text:a});Ha(this,ib(d),db)};Na.prototype=ta(wc.prototype,{constructor:Na,iter:function(a,
b,d){d?this.iterN(a-this.first,b-a,d):this.iterN(this.first,this.first+this.size,a)},insert:function(a,b){for(var d=0,c=0;c<b.length;++c)d+=b[c].height;this.insertInner(a-this.first,b,d)},remove:function(a,b){this.removeInner(a-this.first,b)},getValue:function(a){var b=yd(this,this.first,this.first+this.size);return!1===a?b:b.join(a||this.lineSeparator())},setValue:Ga(function(a){var b=H(this.first,0),d=this.first+this.size-1;Vb(this,{from:b,to:H(d,T(this,d).text.length),text:this.splitLines(a),origin:"setValue",
full:!0},!0);this.cm&&mc(this.cm,0,0);Ha(this,ib(b),db)}),replaceRange:function(a,b,d,c){b=ca(this,b);d=d?ca(this,d):b;Wb(this,a,b,d,c)},getRange:function(a,b,d){a=tb(this,ca(this,a),ca(this,b));return!1===d?a:""===d?a.join(""):a.join(d||this.lineSeparator())},getLine:function(a){return(a=this.getLineHandle(a))&&a.text},getLineHandle:function(a){if(dc(this,a))return T(this,a)},getLineNumber:function(a){return qa(a)},getLineHandleVisualStart:function(a){"number"==typeof a&&(a=T(this,a));return Va(a)},
lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(a){return ca(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:Ga(function(a,b,d){a=ca(this,"number"==typeof a?H(a,b||0):a);Ha(this,
ib(a,null),d)}),setSelection:Ga(function(a,b,d){var c=ca(this,a);a=ca(this,b||a);Ha(this,ib(c,a),d)}),extendSelection:Ga(function(a,b,d){hd(this,ca(this,a),b&&ca(this,b),d)}),extendSelections:Ga(function(a,b){Jf(this,Be(this,a),b)}),extendSelectionsBy:Ga(function(a,b){a=J(this.sel.ranges,a);Jf(this,Be(this,a),b)}),setSelections:Ga(function(a,b,d){if(a.length){for(var c=[],e=0;e<a.length;e++)c[e]=new na(ca(this,a[e].anchor),ca(this,a[e].head||a[e].anchor));null==b&&(b=Math.min(a.length-1,this.sel.primIndex));
Ha(this,Za(this.cm,c,b),d)}}),addSelection:Ga(function(a,b,d){var c=this.sel.ranges.slice(0);c.push(new na(ca(this,a),ca(this,b||a)));Ha(this,Za(this.cm,c,c.length-1),d)}),getSelection:function(a){for(var b=this.sel.ranges,d,c=0;c<b.length;c++){var e=tb(this,b[c].from(),b[c].to());d=d?d.concat(e):e}return!1===a?d:d.join(a||this.lineSeparator())},getSelections:function(a){for(var b=[],d=this.sel.ranges,c=0;c<d.length;c++){var e=tb(this,d[c].from(),d[c].to());!1!==a&&(e=e.join(a||this.lineSeparator()));
b[c]=e}return b},replaceSelection:function(a,b,d){for(var c=[],e=0;e<this.sel.ranges.length;e++)c[e]=a;this.replaceSelections(c,b,d||"+input")},replaceSelections:Ga(function(a,b,d){for(var c=[],e=this.sel,f=0;f<e.ranges.length;f++){var g=e.ranges[f];c[f]={from:g.from(),to:g.to(),text:this.splitLines(a[f]),origin:d}}if(a=b&&"end"!=b){a=[];e=d=H(this.first,0);for(f=0;f<c.length;f++){var h=c[f];g=Bf(h.from,d,e);var k=Bf(nb(h),d,e);d=h.to;e=k;"around"==b?(h=this.sel.ranges[f],h=0>ba(h.head,h.anchor),
a[f]=new na(h?k:g,h?g:k)):a[f]=new na(g,g)}a=new Ta(a,this.sel.primIndex)}b=a;for(a=c.length-1;0<=a;a--)Vb(this,c[a]);b?Kf(this,b):this.cm&&Qb(this.cm)}),undo:Ga(function(){kd(this,"undo")}),redo:Ga(function(){kd(this,"redo")}),undoSelection:Ga(function(){kd(this,"undo",!0)}),redoSelection:Ga(function(){kd(this,"redo",!0)}),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},historySize:function(){for(var a=this.history,b=0,d=0,c=0;c<a.done.length;c++)a.done[c].ranges||
++b;for(c=0;c<a.undone.length;c++)a.undone[c].ranges||++d;return{undo:b,redo:d}},clearHistory:function(){var a=this;this.history=new fd(this.history);ob(this,function(b){return b.history=a.history},!0)},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:Tb(this.history.done),
undone:Tb(this.history.undone)}},setHistory:function(a){var b=this.history=new fd(this.history);b.done=Tb(a.done.slice(0),null,!0);b.undone=Tb(a.undone.slice(0),null,!0)},setGutterMarker:Ga(function(a,b,d){return uc(this,a,"gutter",function(c){var e=c.gutterMarkers||(c.gutterMarkers={});e[b]=d;!d&&P(e)&&(c.gutterMarkers=null);return!0})}),clearGutter:Ga(function(a){var b=this;this.iter(function(d){d.gutterMarkers&&d.gutterMarkers[a]&&uc(b,d,"gutter",function(){d.gutterMarkers[a]=null;P(d.gutterMarkers)&&
(d.gutterMarkers=null);return!0})})}),lineInfo:function(a){if("number"==typeof a){if(!dc(this,a))return null;var b=a;a=T(this,a);if(!a)return null}else if(b=qa(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:Ga(function(a,b,d){return uc(this,a,"gutter"==b?"gutter":"class",function(c){var e="text"==b?"textClass":"background"==b?"bgClass":"gutter"==b?"gutterClass":"wrapClass";
if(c[e]){if(t(d).test(c[e]))return!1;c[e]+=" "+d}else c[e]=d;return!0})}),removeLineClass:Ga(function(a,b,d){return uc(this,a,"gutter"==b?"gutter":"class",function(c){var e="text"==b?"textClass":"background"==b?"bgClass":"gutter"==b?"gutterClass":"wrapClass",f=c[e];if(f)if(null==d)c[e]=null;else{var g=f.match(t(d));if(!g)return!1;var h=g.index+g[0].length;c[e]=f.slice(0,g.index)+(g.index&&h!=f.length?" ":"")+f.slice(h)||null}else return!1;return!0})}),addLineWidget:Ga(function(a,b,d){return dh(this,
a,b,d)}),removeLineWidget:function(a){a.clear()},markText:function(a,b,d){return Xb(this,ca(this,a),ca(this,b),d,d&&d.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=ca(this,a);return Xb(this,a,a,b,"bookmark")},findMarksAt:function(a){a=ca(this,a);var b=[],d=T(this,a.line).markedSpans;if(d)for(var c=0;c<d.length;++c){var e=d[c];(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,d){a=ca(this,a);b=ca(this,b);var c=[],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||d&&!d(h.marker)||c.push(h.marker.parent||h.marker)}++e});return c},getAllMarks:function(){var a=[];this.iter(function(b){if(b=b.markedSpans)for(var d=0;d<b.length;++d)null!=
b[d].from&&a.push(b[d].marker)});return a},posFromIndex:function(a){var b,d=this.first,c=this.lineSeparator().length;this.iter(function(e){e=e.text.length+c;if(e>a)return b=a,!0;a-=e;++d});return ca(this,H(d,b))},indexFromPos:function(a){a=ca(this,a);var b=a.ch;if(a.line<this.first||0>a.ch)return 0;var d=this.lineSeparator().length;this.iter(this.first,a.line,function(c){b+=c.text.length+d});return b},copy:function(a){var b=new Na(yd(this,this.first,this.first+this.size),this.modeOption,this.first,
this.lineSep,this.direction);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,d=this.first+this.size;null!=a.from&&a.from>b&&(b=a.from);null!=a.to&&a.to<d&&(d=a.to);b=new Na(yd(this,b,d),a.mode||this.modeOption,b,this.lineSep,this.direction);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=Yf(this);for(d=0;d<a.length;d++){var c=a[d],e=c.find(),f=b.clipPos(e.from);e=b.clipPos(e.to);ba(f,e)&&(f=Xb(b,f,e,c.primary,c.primary.type),c.markers.push(f),f.parent=c)}return b},unlinkDoc:function(a){a instanceof ya&&(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);fh(Yf(this));break}if(a.history==this.history){var d=[a.id];ob(a,function(c){return d.push(c.id)},
!0);a.history=new fd(null);a.history.done=Tb(this.history.done,d);a.history.undone=Tb(this.history.undone,d)}},iterLinkedDocs:function(a){ob(this,a)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(a){return this.lineSep?a.split(this.lineSep):we(a)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:Ga(function(a){"rtl"!=a&&(a="ltr");a!=this.direction&&(this.direction=a,this.iter(function(b){return b.order=null}),this.cm&&ah(this.cm))})});
Na.prototype.eachLine=Na.prototype.iter;for(var $f=0,rg=!1,qb={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",
63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Jc=0;10>Jc;Jc++)qb[Jc+48]=qb[Jc+96]=String(Jc);for(var td=65;90>=td;td++)qb[td]=String.fromCharCode(td);for(var Kc=1;12>=Kc;Kc++)qb[Kc+111]=qb[Kc+63235]="F"+Kc;var zc={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","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore",
"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"]}};zc["default"]=Ua?zc.macDefault:zc.pcDefault;var Ac={selectAll:Pf,singleSelection:function(a){return a.setSelection(a.getCursor("anchor"),a.getCursor("head"),
db)},killLine:function(a){return Zb(a,function(b){if(b.empty()){var d=T(a.doc,b.head.line).text.length;return b.head.ch==d&&b.head.line<a.lastLine()?{from:b.head,to:H(b.head.line+1,0)}:{from:b.head,to:H(b.head.line,d)}}return{from:b.from(),to:b.to()}})},deleteLine:function(a){return Zb(a,function(b){return{from:H(b.from().line,0),to:ca(a.doc,H(b.to().line+1,0))}})},delLineLeft:function(a){return Zb(a,function(b){return{from:H(b.from().line,0),to:b.from()}})},delWrappedLineLeft:function(a){return Zb(a,
function(b){var d=a.charCoords(b.head,"div").top+5;return{from:a.coordsChar({left:0,top:d},"div"),to:b.from()}})},delWrappedLineRight:function(a){return Zb(a,function(b){var d=a.charCoords(b.head,"div").top+5;d=a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:d},"div");return{from:b.from(),to:d}})},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(H(a.firstLine(),
0))},goDocEnd:function(a){return a.extendSelection(H(a.lastLine()))},goLineStart:function(a){return a.extendSelectionsBy(function(b){return fg(a,b.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(a){return a.extendSelectionsBy(function(b){return gg(a,b.head)},{origin:"+move",bias:1})},goLineEnd:function(a){return a.extendSelectionsBy(function(b){b=b.head.line;var d=T(a.doc,b);var c=d;for(var e;e=Lb(c,!1);)c=e.find(1,!0).line;c!=d&&(b=qa(c));return pe(!0,a,d,b,-1)},{origin:"+move",bias:-1})},
goLineRight:function(a){return a.extendSelectionsBy(function(b){b=a.cursorCoords(b.head,"div").top+5;return a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:b},"div")},Hc)},goLineLeft:function(a){return a.extendSelectionsBy(function(b){b=a.cursorCoords(b.head,"div").top+5;return a.coordsChar({left:0,top:b},"div")},Hc)},goLineLeftSmart:function(a){return a.extendSelectionsBy(function(b){var d=a.cursorCoords(b.head,"div").top+5;d=a.coordsChar({left:0,top:d},"div");return d.ch<a.getLine(d.line).search(/\S/)?
gg(a,b.head):d},Hc)},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,"codepoint")},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=[],d=a.listSelections(),c=a.options.tabSize,e=0;e<d.length;e++){var f=d[e].from();f=q(a.getLine(f.line),f.ch,c);b.push(L(c-f%c))}a.replaceSelections(b)},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.execCommand("insertTab")},transposeChars:function(a){return Qa(a,function(){for(var b=
a.listSelections(),d=[],c=0;c<b.length;c++)if(b[c].empty()){var e=b[c].head,f=T(a.doc,e.line).text;if(f)if(e.ch==f.length&&(e=new H(e.line,e.ch-1)),0<e.ch)e=new H(e.line,e.ch+1),a.replaceRange(f.charAt(e.ch-1)+f.charAt(e.ch-2),H(e.line,e.ch-2),e,"+transpose");else if(e.line>a.doc.first){var g=T(a.doc,e.line-1).text;g&&(e=new H(e.line,1),a.replaceRange(f.charAt(0)+a.doc.lineSeparator()+g.charAt(g.length-1),H(e.line-1,g.length-1),e,"+transpose"))}d.push(new na(e,e))}a.setSelections(d)})},newlineAndIndent:function(a){return Qa(a,
function(){for(var b=a.listSelections(),d=b.length-1;0<=d;d--)a.replaceRange(a.doc.lineSeparator(),b[d].anchor,b[d].head,"+input");b=a.listSelections();for(d=0;d<b.length;d++)a.indentLine(b[d].from().line,null,!0);Qb(a)})},openLine:function(a){return a.replaceSelection("\n","start")},toggleOverwrite:function(a){return a.toggleOverwrite()}},mh=new rb,qe=null,re=function(a,b,d){this.time=a;this.pos=b;this.button=d};re.prototype.compare=function(a,b,d){return this.time+400>a&&0==ba(b,this.pos)&&d==this.button};
var Dc,Cc,$b={toString:function(){return"CodeMirror.Init"}},qg={},qd={};ya.defaults=qg;ya.optionHandlers=qd;var ue=[];ya.defineInitHook=function(a){return ue.push(a)};var Ra=null,ra=function(a){this.cm=a;this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null;this.polling=new rb;this.composing=null;this.gracePeriod=!1;this.readDOMTimeout=null};ra.prototype.init=function(a){function b(h){for(h=h.target;h;h=h.parentNode){if(h==g)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(h.className))break}return!1}
function d(h){if(b(h)&&!ja(f,h)){if(f.somethingSelected())Ra={lineWise:!1,text:f.getSelections()},"cut"==h.type&&f.replaceSelection("",null,"cut");else if(f.options.lineWiseCopyCut){var k=ug(f);Ra={lineWise:!0,text:k.text};"cut"==h.type&&f.operation(function(){f.setSelections(k.ranges,0,db);f.replaceSelection("",null,"cut")})}else return;if(h.clipboardData){h.clipboardData.clearData();var l=Ra.text.join("\n");h.clipboardData.setData("Text",l);if(h.clipboardData.getData("Text")==l){h.preventDefault();
return}}var m=vg();h=m.firstChild;xe(h);f.display.lineSpace.insertBefore(m,f.display.lineSpace.firstChild);h.value=Ra.text.join("\n");var p=I(v(g));Gc(h);setTimeout(function(){f.display.lineSpace.removeChild(m);p.focus();p==g&&e.showPrimarySelection()},50)}}var c=this,e=this,f=e.cm,g=e.div=a.lineDiv;g.contentEditable=!0;xe(g,f.options.spellcheck,f.options.autocorrect,f.options.autocapitalize);W(g,"paste",function(h){!b(h)||ja(f,h)||tg(h,f)||11>=xa&&setTimeout(Fa(f,function(){return c.updateFromDOM()}),
20)});W(g,"compositionstart",function(h){c.composing={data:h.data,done:!1}});W(g,"compositionupdate",function(h){c.composing||(c.composing={data:h.data,done:!1})});W(g,"compositionend",function(h){c.composing&&(h.data!=c.composing.data&&c.readFromDOMSoon(),c.composing.done=!0)});W(g,"touchstart",function(){return e.forceCompositionEnd()});W(g,"input",function(){c.composing||c.readFromDOMSoon()});W(g,"copy",d);W(g,"cut",d)};ra.prototype.screenReaderLabelChanged=function(a){a?this.div.setAttribute("aria-label",
a):this.div.removeAttribute("aria-label")};ra.prototype.prepareSelection=function(){var a=lf(this.cm,!1);a.focus=I(v(this.div))==this.div;return a};ra.prototype.showSelection=function(a,b){a&&this.cm.display.view.length&&((a.focus||b)&&this.showPrimarySelection(),this.showMultipleSelections(a))};ra.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()};ra.prototype.showPrimarySelection=function(){var a=this.getSelection(),b=this.cm,d=b.doc.sel.primary(),c=d.from();
d=d.to();if(b.display.viewTo==b.display.viewFrom||c.line>=b.display.viewTo||d.line<b.display.viewFrom)a.removeAllRanges();else{var e=rd(b,a.anchorNode,a.anchorOffset),f=rd(b,a.focusNode,a.focusOffset);if(!e||e.bad||!f||f.bad||0!=ba(Qc(e,f),c)||0!=ba(Pc(e,f),d))if(e=b.display.view,c=c.line>=b.display.viewFrom&&xg(b,c)||{node:e[0].measure.map[2],offset:0},d=d.line<b.display.viewTo&&xg(b,d),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&&d){e=a.rangeCount&&a.getRangeAt(0);try{var g=gc(c.node,c.offset,d.offset,d.node)}catch(h){}g&&(!gb&&b.state.focused?(a.collapse(c.node,c.offset),g.collapsed||(a.removeAllRanges(),a.addRange(g))):(a.removeAllRanges(),a.addRange(g)),e&&null==a.anchorNode?a.addRange(e):gb&&this.startGracePeriod());this.rememberSelection()}else a.removeAllRanges()}};ra.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)};ra.prototype.showMultipleSelections=function(a){F(this.cm.display.cursorDiv,a.cursors);F(this.cm.display.selectionDiv,a.selection)};ra.prototype.rememberSelection=function(){var a=this.getSelection();this.lastAnchorNode=a.anchorNode;this.lastAnchorOffset=a.anchorOffset;this.lastFocusNode=a.focusNode;this.lastFocusOffset=a.focusOffset};ra.prototype.selectionInEditor=function(){var a=this.getSelection();
if(!a.rangeCount)return!1;a=a.getRangeAt(0).commonAncestorContainer;return B(this.div,a)};ra.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()&&I(v(this.div))==this.div||this.showSelection(this.prepareSelection(),!0),this.div.focus())};ra.prototype.blur=function(){this.div.blur()};ra.prototype.getField=function(){return this.div};ra.prototype.supportsTouch=function(){return!0};ra.prototype.receivedFocus=function(){function a(){d.cm.state.focused&&(d.pollSelection(),
d.polling.set(d.cm.options.pollInterval,a))}var b=this,d=this;this.selectionInEditor()?setTimeout(function(){return b.pollSelection()},20):Qa(this.cm,function(){return d.cm.curOp.selectionChanged=!0});this.polling.set(this.cm.options.pollInterval,a)};ra.prototype.selectionChanged=function(){var a=this.getSelection();return a.anchorNode!=this.lastAnchorNode||a.anchorOffset!=this.lastAnchorOffset||a.focusNode!=this.lastFocusNode||a.focusOffset!=this.lastFocusOffset};ra.prototype.pollSelection=function(){if(null==
this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var a=this.getSelection(),b=this.cm;if(Vc&&kb&&this.cm.display.gutterSpecs.length&&Bh(a.anchorNode))this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();else if(!this.composing){this.rememberSelection();var d=rd(b,a.anchorNode,a.anchorOffset),c=rd(b,a.focusNode,a.focusOffset);d&&c&&Qa(b,function(){Ha(b.doc,ib(d,c),db);if(d.bad||c.bad)b.curOp.selectionChanged=!0})}}};ra.prototype.pollContent=
function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var a=this.cm,b=a.display,d=a.doc.sel.primary(),c=d.from(),e=d.to();0==c.ch&&c.line>a.firstLine()&&(c=H(c.line-1,T(a.doc,c.line-1).length));e.ch==T(a.doc,e.line).text.length&&e.line<a.lastLine()&&(e=H(e.line+1,0));if(c.line<b.viewFrom||e.line>b.viewTo-1)return!1;var f;c.line==b.viewFrom||0==(f=wb(a,c.line))?(d=qa(b.view[0].line),f=b.view[0].node):(d=qa(b.view[f].line),f=b.view[f-1].node.nextSibling);
var g=wb(a,e.line);g==b.view.length-1?(e=b.viewTo-1,b=b.lineDiv.lastChild):(e=qa(b.view[g+1].line)-1,b=b.view[g+1].node.previousSibling);if(!f)return!1;b=a.doc.splitLines(Ch(a,f,b,d,e));for(f=tb(a.doc,H(d,0),H(e,T(a.doc,e).text.length));1<b.length&&1<f.length;)if(O(b)==O(f))b.pop(),f.pop(),e--;else if(b[0]==f[0])b.shift(),f.shift(),d++;else break;var h=0;g=0;for(var k=b[0],l=f[0],m=Math.min(k.length,l.length);h<m&&k.charCodeAt(h)==l.charCodeAt(h);)++h;k=O(b);l=O(f);for(m=Math.min(k.length-(1==b.length?
h:0),l.length-(1==f.length?h:0));g<m&&k.charCodeAt(k.length-g-1)==l.charCodeAt(l.length-g-1);)++g;if(1==b.length&&1==f.length&&d==c.line)for(;h&&h>c.ch&&k.charCodeAt(k.length-g-1)==l.charCodeAt(l.length-g-1);)h--,g++;b[b.length-1]=k.slice(0,k.length-g).replace(/^\u200b+/,"");b[0]=b[0].slice(h).replace(/\u200b+$/,"");c=H(d,h);d=H(e,f.length?O(f).length-g:0);if(1<b.length||b[0]||ba(c,d))return Wb(a.doc,b,c,d,"+input"),!0};ra.prototype.ensurePolled=function(){this.forceCompositionEnd()};ra.prototype.reset=
function(){this.forceCompositionEnd()};ra.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())};ra.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.updateFromDOM()},80))};ra.prototype.updateFromDOM=function(){var a=this;!this.cm.isReadOnly()&&
this.pollContent()||Qa(this.cm,function(){return La(a.cm)})};ra.prototype.setUneditable=function(a){a.contentEditable="false"};ra.prototype.onKeyPress=function(a){0==a.charCode||this.composing||(a.preventDefault(),this.cm.isReadOnly()||Fa(this.cm,ve)(this.cm,String.fromCharCode(null==a.charCode?a.keyCode:a.charCode),0))};ra.prototype.readOnlyChanged=function(a){this.div.contentEditable=String("nocursor"!=a)};ra.prototype.onContextMenu=function(){};ra.prototype.resetPosition=function(){};ra.prototype.needsContentAttribute=
!0;var Aa=function(a){this.cm=a;this.prevInput="";this.pollingFast=!1;this.polling=new rb;this.hasSelection=!1;this.composing=null;this.resetting=!1};Aa.prototype.init=function(a){function b(g){if(!ja(e,g)){if(e.somethingSelected())Ra={lineWise:!1,text:e.getSelections()};else if(e.options.lineWiseCopyCut){var h=ug(e);Ra={lineWise:!0,text:h.text};"cut"==g.type?e.setSelections(h.ranges,null,db):(c.prevInput="",f.value=h.text.join("\n"),Gc(f))}else return;"cut"==g.type&&(e.state.cutIncoming=+new Date)}}
var d=this,c=this,e=this.cm;this.createField(a);var f=this.textarea;a.wrapper.insertBefore(this.wrapper,a.wrapper.firstChild);Fc&&(f.style.width="0px");W(f,"input",function(){la&&9<=xa&&d.hasSelection&&(d.hasSelection=null);c.poll()});W(f,"paste",function(g){ja(e,g)||tg(g,e)||(e.state.pasteIncoming=+new Date,c.fastPoll())});W(f,"cut",b);W(f,"copy",b);W(a.scroller,"paste",function(g){if(!fb(a,g)&&!ja(e,g))if(f.dispatchEvent){var h=new Event("paste");h.clipboardData=g.clipboardData;f.dispatchEvent(h)}else e.state.pasteIncoming=
+new Date,c.focus()});W(a.lineSpace,"selectstart",function(g){fb(a,g)||ka(g)});W(f,"compositionstart",function(){var g=e.getCursor("from");c.composing&&c.composing.range.clear();c.composing={start:g,range:e.markText(g,e.getCursor("to"),{className:"CodeMirror-composing"})}});W(f,"compositionend",function(){c.composing&&(c.poll(),c.composing.range.clear(),c.composing=null)})};Aa.prototype.createField=function(a){this.wrapper=vg();this.textarea=this.wrapper.firstChild;a=this.cm.options;xe(this.textarea,
a.spellcheck,a.autocorrect,a.autocapitalize)};Aa.prototype.screenReaderLabelChanged=function(a){a?this.textarea.setAttribute("aria-label",a):this.textarea.removeAttribute("aria-label")};Aa.prototype.prepareSelection=function(){var a=this.cm,b=a.display,d=a.doc,c=lf(a);if(a.options.moveInputWithCursor){a=Xa(a,d.sel.primary().head,"div");d=b.wrapper.getBoundingClientRect();var e=b.lineDiv.getBoundingClientRect();c.teTop=Math.max(0,Math.min(b.wrapper.clientHeight-10,a.top+e.top-d.top));c.teLeft=Math.max(0,
Math.min(b.wrapper.clientWidth-10,a.left+e.left-d.left))}return c};Aa.prototype.showSelection=function(a){var b=this.cm.display;F(b.cursorDiv,a.cursors);F(b.selectionDiv,a.selection);null!=a.teTop&&(this.wrapper.style.top=a.teTop+"px",this.wrapper.style.left=a.teLeft+"px")};Aa.prototype.reset=function(a){if(!(this.contextMenuPending||this.composing&&a)){var b=this.cm;this.resetting=!0;b.somethingSelected()?(this.prevInput="",a=b.getSelection(),this.textarea.value=a,b.state.focused&&Gc(this.textarea),
la&&9<=xa&&(this.hasSelection=a)):a||(this.prevInput=this.textarea.value="",la&&9<=xa&&(this.hasSelection=null));this.resetting=!1}};Aa.prototype.getField=function(){return this.textarea};Aa.prototype.supportsTouch=function(){return!1};Aa.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!rc||I(v(this.textarea))!=this.textarea))try{this.textarea.focus()}catch(a){}};Aa.prototype.blur=function(){this.textarea.blur()};Aa.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=
0};Aa.prototype.receivedFocus=function(){this.slowPoll()};Aa.prototype.slowPoll=function(){var a=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){a.poll();a.cm.state.focused&&a.slowPoll()})};Aa.prototype.fastPoll=function(){function a(){d.poll()||b?(d.pollingFast=!1,d.slowPoll()):(b=!0,d.polling.set(60,a))}var b=!1,d=this;d.pollingFast=!0;d.polling.set(20,a)};Aa.prototype.poll=function(){var a=this,b=this.cm,d=this.textarea,c=this.prevInput;if(this.contextMenuPending||
this.resetting||!b.state.focused||Hh(d)&&!c&&!this.composing||b.isReadOnly()||b.options.disableInput||b.state.keySeq)return!1;var e=d.value;if(e==c&&!b.somethingSelected())return!1;if(la&&9<=xa&&this.hasSelection===e||Ua&&/[\uf700-\uf7ff]/.test(e))return b.display.input.reset(),!1;if(b.doc.sel==b.display.selForContextMenu){var f=e.charCodeAt(0);8203!=f||c||(c="\u200b");if(8666==f)return this.reset(),this.cm.execCommand("undo")}var g=0;for(f=Math.min(c.length,e.length);g<f&&c.charCodeAt(g)==e.charCodeAt(g);)++g;
Qa(b,function(){ve(b,e.slice(g),c.length-g,null,a.composing?"*compose":null);1E3<e.length||-1<e.indexOf("\n")?d.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};Aa.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)};Aa.prototype.onKeyPress=function(){la&&9<=xa&&(this.hasSelection=null);this.fastPoll()};Aa.prototype.onContextMenu=
function(a){function b(){if(null!=g.selectionStart){var u=e.somethingSelected(),C="\u200b"+(u?g.value:"");g.value="\u21da";g.value=C;c.prevInput=u?"":"\u200b";g.selectionStart=1;g.selectionEnd=C.length;f.selForContextMenu=e.doc.sel}}function d(){if(c.contextMenuPending==d&&(c.contextMenuPending=!1,c.wrapper.style.cssText=m,g.style.cssText=l,la&&9>xa&&f.scrollbars.setScrollTop(f.scroller.scrollTop=k),null!=g.selectionStart)){(!la||la&&9>xa)&&b();var u=0,C=function(){f.selForContextMenu==e.doc.sel&&
0==g.selectionStart&&0<g.selectionEnd&&"\u200b"==c.prevInput?Fa(e,Pf)(e):10>u++?f.detectingSelectAll=setTimeout(C,500):(f.selForContextMenu=null,f.input.reset())};f.detectingSelectAll=setTimeout(C,200)}}var c=this,e=c.cm,f=e.display,g=c.textarea;c.contextMenuPending&&c.contextMenuPending();var h=zb(e,a),k=f.scroller.scrollTop;if(h&&!Ya){e.options.resetSelectionOnContextMenu&&-1==e.doc.sel.contains(h)&&Fa(e,Ha)(e.doc,ib(h),db);var l=g.style.cssText,m=c.wrapper.style.cssText;h=c.wrapper.offsetParent.getBoundingClientRect();
c.wrapper.style.cssText="position: static";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: "+(la?"rgba(255, 255, 255, .05)":"transparent")+";\n      outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";if(Ia)var p=g.ownerDocument.defaultView.scrollY;f.input.focus();Ia&&g.ownerDocument.defaultView.scrollTo(null,p);f.input.reset();
e.somethingSelected()||(g.value=c.prevInput=" ");c.contextMenuPending=d;f.selForContextMenu=e.doc.sel;clearTimeout(f.detectingSelectAll);la&&9<=xa&&b();if(se){cc(a);var r=function(){Z(window,"mouseup",r);setTimeout(d,20)};W(window,"mouseup",r)}else setTimeout(d,50)}};Aa.prototype.readOnlyChanged=function(a){a||this.reset();this.textarea.disabled="nocursor"==a;this.textarea.readOnly=!!a};Aa.prototype.setUneditable=function(){};Aa.prototype.needsContentAttribute=!1;(function(a){function b(c,e,f,g){a.defaults[c]=
e;f&&(d[c]=g?function(h,k,l){l!=$b&&f(h,k,l)}:f)}var d=a.optionHandlers;a.defineOption=b;a.Init=$b;b("value","",function(c,e){return c.setValue(e)},!0);b("mode",null,function(c,e){c.doc.modeOption=e;ie(c)},!0);b("indentUnit",2,ie,!0);b("indentWithTabs",!1);b("smartIndent",!0);b("tabSize",4,function(c){sc(c);kc(c);La(c)},!0);b("lineSeparator",null,function(c,e){if(c.doc.lineSep=e){var f=[],g=c.doc.first;c.doc.iter(function(k){for(var l=0;;){var m=k.text.indexOf(e,l);if(-1==m)break;l=m+e.length;f.push(H(g,
m))}g++});for(var h=f.length-1;0<=h;h--)Wb(c.doc,e,f[h],H(f[h].line,f[h].ch+e.length))}});b("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(c,e,f){c.state.specialChars=new RegExp(e.source+(e.test("\t")?"":"|\t"),"g");f!=$b&&c.refresh()});b("specialCharPlaceholder",Ng,function(c){return c.refresh()},!0);b("electricChars",!0);b("inputStyle",rc?"contenteditable":"textarea",function(){throw Error("inputStyle can not (yet) be changed in a running editor");
},!0);b("spellcheck",!1,function(c,e){return c.getInputField().spellcheck=e},!0);b("autocorrect",!1,function(c,e){return c.getInputField().autocorrect=e},!0);b("autocapitalize",!1,function(c,e){return c.getInputField().autocapitalize=e},!0);b("rtlMoveVisually",!Gh);b("wholeLineUpdateBefore",!0);b("theme","default",function(c){pg(c);qc(c)},!0);b("keyMap","default",function(c,e,f){e=ld(e);(f=f!=$b&&ld(f))&&f.detach&&f.detach(c,e);e.attach&&e.attach(c,f||null)});b("extraKeys",null);b("configureMouse",
null);b("lineWrapping",!1,zh,!0);b("gutters",[],function(c,e){c.display.gutterSpecs=ge(e,c.options.lineNumbers);qc(c)},!0);b("fixedGutter",!0,function(c,e){c.display.gutters.style.left=e?Vd(c.display)+"px":"0";c.refresh()},!0);b("coverGutterNextToScrollbar",!1,function(c){return Rb(c)},!0);b("scrollbarStyle","native",function(c){sf(c);Rb(c);c.display.scrollbars.setScrollTop(c.doc.scrollTop);c.display.scrollbars.setScrollLeft(c.doc.scrollLeft)},!0);b("lineNumbers",!1,function(c,e){c.display.gutterSpecs=
ge(c.options.gutters,e);qc(c)},!0);b("firstLineNumber",1,qc,!0);b("lineNumberFormatter",function(c){return c},qc,!0);b("showCursorWhenSelecting",!1,lc,!0);b("resetSelectionOnContextMenu",!0);b("lineWiseCopyCut",!0);b("pasteLinesPerSelection",!0);b("selectionsMayTouch",!1);b("readOnly",!1,function(c,e){"nocursor"==e&&(Pb(c),c.display.input.blur());c.display.input.readOnlyChanged(e)});b("screenReaderLabel",null,function(c,e){c.display.input.screenReaderLabelChanged(""===e?null:e)});b("disableInput",
!1,function(c,e){e||c.display.input.reset()},!0);b("dragDrop",!0,yh);b("allowDropFileTypes",null);b("cursorBlinkRate",530);b("cursorScrollMargin",0);b("cursorHeight",1,lc,!0);b("singleCursorHeightPerLine",!0,lc,!0);b("workTime",100);b("workDelay",100);b("flattenSpans",!0,sc,!0);b("addModeClass",!1,sc,!0);b("pollInterval",100);b("undoDepth",200,function(c,e){return c.doc.history.undoDepth=e});b("historyEventDelay",1250);b("viewportMargin",10,function(c){return c.refresh()},!0);b("maxHighlightLength",
1E4,sc,!0);b("moveInputWithCursor",!0,function(c,e){e||c.display.input.resetPosition()});b("tabindex",null,function(c,e){return c.display.input.getField().tabIndex=e||""});b("autofocus",null);b("direction","ltr",function(c,e){return c.doc.setDirection(e)},!0);b("phrases",null)})(ya);(function(a){var b=a.optionHandlers,d=a.helpers={};a.prototype={constructor:a,focus:function(){R(this).defaultView.focus();this.display.input.focus()},setOption:function(c,e){var f=this.options,g=f[c];if(f[c]!=e||"mode"==
c)f[c]=e,b.hasOwnProperty(c)&&Fa(this,b[c])(this,e,g),S(this,"optionChange",this,c)},getOption:function(c){return this.options[c]},getDoc:function(){return this.doc},addKeyMap:function(c,e){this.state.keyMaps[e?"push":"unshift"](ld(c))},removeKeyMap:function(c){for(var e=this.state.keyMaps,f=0;f<e.length;++f)if(e[f]==c||e[f].name==c)return e.splice(f,1),!0},addOverlay:Ka(function(c,e){var f=c.token?c:a.getMode(this.options,c);if(f.startState)throw Error("Overlays may not be stateful.");da(this.state.overlays,
{mode:f,modeSpec:c,opaque:e&&e.opaque,priority:e&&e.priority||0},function(g){return g.priority});this.state.modeGen++;La(this)}),removeOverlay:Ka(function(c){for(var e=this.state.overlays,f=0;f<e.length;++f){var g=e[f].modeSpec;if(g==c||"string"==typeof c&&g.name==c){e.splice(f,1);this.state.modeGen++;La(this);break}}}),indentLine:Ka(function(c,e,f){"string"!=typeof e&&"number"!=typeof e&&(e=null==e?this.options.smartIndent?"smart":"prev":e?"add":"subtract");dc(this.doc,c)&&Ec(this,c,e,f)}),indentSelection:Ka(function(c){for(var e=
this.doc.sel.ranges,f=-1,g=0;g<e.length;g++){var h=e[g];if(h.empty())h.head.line>f&&(Ec(this,h.head.line,c,!0),f=h.head.line,g==this.doc.sel.primIndex&&Qb(this));else{var k=h.from();h=h.to();var l=Math.max(f,k.line);f=Math.min(this.lastLine(),h.line-(h.ch?0:1))+1;for(h=l;h<f;++h)Ec(this,h,c);h=this.doc.sel.ranges;0==k.ch&&e.length==h.length&&0<h[g].from().ch&&me(this.doc,g,new na(k,h[g].to()),db)}}}),getTokenAt:function(c,e){return Ge(this,c,e)},getLineTokens:function(c,e){return Ge(this,H(c),e,!0)},
getTokenTypeAt:function(c){c=ca(this.doc,c);var e=Ee(this,T(this.doc,c.line)),f=0,g=(e.length-1)/2;c=c.ch;if(0==c)e=e[2];else for(;;){var h=f+g>>1;if((h?e[2*h-1]:0)>=c)g=h;else if(e[2*h+1]<c)f=h+1;else{e=e[2*h+2];break}}f=e?e.indexOf("overlay "):-1;return 0>f?e:0==f?null:e.slice(0,f-1)},getModeAt:function(c){var e=this.doc.mode;return e.innerMode?a.innerMode(e,this.getTokenAt(c).state).mode:e},getHelper:function(c,e){return this.getHelpers(c,e)[0]},getHelpers:function(c,e){var f=[];if(!d.hasOwnProperty(e))return f;
var g=d[e];c=this.getModeAt(c);if("string"==typeof c[e])g[c[e]]&&f.push(g[c[e]]);else if(c[e])for(var h=0;h<c[e].length;h++){var k=g[c[e][h]];k&&f.push(k)}else c.helperType&&g[c.helperType]?f.push(g[c.helperType]):g[c.name]&&f.push(g[c.name]);for(e=0;e<g._global.length;e++)h=g._global[e],h.pred(c,this)&&-1==x(f,h.val)&&f.push(h.val);return f},getStateAfter:function(c,e){var f=this.doc;c=Math.max(f.first,Math.min(null==c?f.first+f.size-1:c,f.first+f.size-1));return ec(this,c+1,e).state},cursorCoords:function(c,
e){var f=this.doc.sel.primary();c=null==c?f.head:"object"==typeof c?ca(this.doc,c):c?f.from():f.to();return Xa(this,c,e||"page")},charCoords:function(c,e){return Xc(this,ca(this.doc,c),e||"page")},coordsChar:function(c,e){c=ef(this,c,e||"page");return Td(this,c.left,c.top)},lineAtHeight:function(c,e){c=ef(this,{top:c,left:0},e||"page").top;return ub(this.doc,c+this.display.viewOffset)},heightAtLine:function(c,e,f){var g=!1;if("number"==typeof c){var h=this.doc.first+this.doc.size-1;c<this.doc.first?
c=this.doc.first:c>h&&(c=h,g=!0);c=T(this.doc,c)}return Wc(this,c,{top:0,left:0},e||"page",f||g).top+(g?this.doc.height-bb(c):0)},defaultTextHeight:function(){return Ob(this.display)},defaultCharWidth:function(){return Nb(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(c,e,f,g,h){var k=this.display;c=Xa(this,ca(this.doc,c));var l=c.bottom,m=c.left;e.style.position="absolute";e.setAttribute("cm-ignore-events","true");this.display.input.setUneditable(e);
k.sizer.appendChild(e);if("over"==g)l=c.top;else if("above"==g||"near"==g){var p=Math.max(k.wrapper.clientHeight,this.doc.height),r=Math.max(k.sizer.clientWidth,k.lineSpace.clientWidth);("above"==g||c.bottom+e.offsetHeight>p)&&c.top>e.offsetHeight?l=c.top-e.offsetHeight:c.bottom+e.offsetHeight<=p&&(l=c.bottom);m+e.offsetWidth>r&&(m=r-e.offsetWidth)}e.style.top=l+"px";e.style.left=e.style.right="";"right"==h?(m=k.sizer.clientWidth-e.offsetWidth,e.style.right="0px"):("left"==h?m=0:"middle"==h&&(m=(k.sizer.clientWidth-
e.offsetWidth)/2),e.style.left=m+"px");f&&(c=be(this,{left:m,top:l,right:m+e.offsetWidth,bottom:l+e.offsetHeight}),null!=c.scrollTop&&nc(this,c.scrollTop),null!=c.scrollLeft&&Db(this,c.scrollLeft))},triggerOnKeyDown:Ka(jg),triggerOnKeyPress:Ka(lg),triggerOnKeyUp:kg,triggerOnMouseDown:Ka(mg),execCommand:function(c){if(Ac.hasOwnProperty(c))return Ac[c].call(null,this)},triggerElectric:Ka(function(c){sg(this,c)}),findPosH:function(c,e,f,g){var h=1;0>e&&(h=-1,e=-e);c=ca(this.doc,c);for(var k=0;k<e&&(c=
ye(this.doc,c,h,f,g),!c.hitSide);++k);return c},moveH:Ka(function(c,e){var f=this;this.extendSelectionsBy(function(g){return f.display.shift||f.doc.extend||g.empty()?ye(f.doc,g.head,c,e,f.options.rtlMoveVisually):0>c?g.from():g.to()},Hc)}),deleteH:Ka(function(c,e){var f=this.doc;this.doc.sel.somethingSelected()?f.replaceSelection("",null,"+delete"):Zb(this,function(g){var h=ye(f,g.head,c,e,!1);return 0>c?{from:h,to:g.head}:{from:g.head,to:h}})}),findPosV:function(c,e,f,g){var h=1;0>e&&(h=-1,e=-e);
var k=ca(this.doc,c);for(c=0;c<e&&(k=Xa(this,k,"div"),null==g?g=k.left:k.left=g,k=wg(this,k,h,f),!k.hitSide);++c);return k},moveV:Ka(function(c,e){var f=this,g=this.doc,h=[],k=!this.display.shift&&!g.extend&&g.sel.somethingSelected();g.extendSelectionsBy(function(m){if(k)return 0>c?m.from():m.to();var p=Xa(f,m.head,"div");null!=m.goalColumn&&(p.left=m.goalColumn);h.push(p.left);var r=wg(f,p,c,e);"page"==e&&m==g.sel.primary()&&bd(f,Xc(f,r,"div").top-p.top);return r},Hc);if(h.length)for(var l=0;l<g.sel.ranges.length;l++)g.sel.ranges[l].goalColumn=
h[l]}),findWordAt:function(c){var e=T(this.doc,c.line).text,f=c.ch,g=c.ch;if(e){var h=this.getHelper(c,"wordChars");"before"!=c.sticky&&g!=e.length||!f?++g:--f;var k=e.charAt(f);for(k=za(k,h)?function(l){return za(l,h)}:/\s/.test(k)?function(l){return/\s/.test(l)}:function(l){return!/\s/.test(l)&&!za(l)};0<f&&k(e.charAt(f-1));)--f;for(;g<e.length&&k(e.charAt(g));)++g}return new na(H(c.line,f),H(c.line,g))},toggleOverwrite:function(c){if(null==c||c!=this.state.overwrite)(this.state.overwrite=!this.state.overwrite)?
D(this.display.cursorDiv,"CodeMirror-overwrite"):Cb(this.display.cursorDiv,"CodeMirror-overwrite"),S(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==I(v(this.display.wrapper))},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:Ka(function(c,e){mc(this,c,e)}),getScrollInfo:function(){var c=this.display.scroller;return{left:c.scrollLeft,top:c.scrollTop,height:c.scrollHeight-cb(this)-this.display.barHeight,
width:c.scrollWidth-cb(this)-this.display.barWidth,clientHeight:Nd(this),clientWidth:vb(this)}},scrollIntoView:Ka(function(c,e){null==c?(c={from:this.doc.sel.primary().head,to:null},null==e&&(e=this.options.cursorScrollMargin)):"number"==typeof c?c={from:H(c,0),to:null}:null==c.from&&(c={from:c,to:null});c.to||(c.to=c.from);c.margin=e||0;null!=c.from.line?(cd(this),this.curOp.scrollToPos=c):of(this,c.from,c.to,c.margin)}),setSize:Ka(function(c,e){var f=this,g=function(k){return"number"==typeof k||
/^\d+$/.test(String(k))?k+"px":k};null!=c&&(this.display.wrapper.style.width=g(c));null!=e&&(this.display.wrapper.style.height=g(e));this.options.lineWrapping&&bf(this);var h=this.display.viewFrom;this.doc.iter(h,this.display.viewTo,function(k){if(k.widgets)for(var l=0;l<k.widgets.length;l++)if(k.widgets[l].noHScroll){mb(f,h,"widget");break}++h});this.curOp.forceUpdate=!0;S(this,"refresh",this)}),operation:function(c){return Qa(this,c)},startOperation:function(){return Eb(this)},endOperation:function(){return Fb(this)},
refresh:Ka(function(){var c=this.display.cachedTextHeight;La(this);this.curOp.forceUpdate=!0;kc(this);mc(this,this.doc.scrollLeft,this.doc.scrollTop);fe(this.display);(null==c||.5<Math.abs(c-Ob(this.display))||this.options.lineWrapping)&&Wd(this);S(this,"refresh",this)}),swapDoc:Ka(function(c){var e=this.doc;e.cm=null;this.state.selectingText&&this.state.selectingText();Df(this,c);kc(this);this.display.input.reset();mc(this,c.scrollLeft,c.scrollTop);this.curOp.forceScroll=!0;Ea(this,"swapDoc",this,
e);return e}),phrase:function(c){var e=this.options.phrases;return e&&Object.prototype.hasOwnProperty.call(e,c)?e[c]:c},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}};Pa(a);a.registerHelper=function(c,e,f){d.hasOwnProperty(c)||(d[c]=a[c]={_global:[]});d[c][e]=f};a.registerGlobalHelper=function(c,e,f,g){a.registerHelper(c,
e,g);d[c]._global.push({pred:f,val:g})}})(ya);var Jh="iter insert remove copy getEditor constructor".split(" "),Lc;for(Lc in Na.prototype)Na.prototype.hasOwnProperty(Lc)&&0>x(Jh,Lc)&&(ya.prototype[Lc]=function(a){return function(){return a.apply(this.doc,arguments)}}(Na.prototype[Lc]));Pa(Na);ya.inputStyles={textarea:Aa,contenteditable:ra};ya.defineMode=function(a){ya.defaults.mode||"null"==a||(ya.defaults.mode=a);Eg.apply(this,arguments)};ya.defineMIME=function(a,b){Jb[a]=b};ya.defineMode("null",
function(){return{token:function(a){return a.skipToEnd()}}});ya.defineMIME("text/plain","null");ya.defineExtension=function(a,b){ya.prototype[a]=b};ya.defineDocExtension=function(a,b){Na.prototype[a]=b};ya.fromTextArea=function(a,b){function d(){a.value=h.getValue()}b=b?n(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 c=I(v(a));b.autofocus=c==a||null!=a.getAttribute("autofocus")&&c==document.body}if(a.form&&
(W(a.form,"submit",d),!b.leaveSubmitMethodAlone)){var e=a.form;var f=e.submit;try{var g=e.submit=function(){d();e.submit=f;e.submit();e.submit=g}}catch(k){}}b.finishInit=function(k){k.save=d;k.getTextArea=function(){return a};k.toTextArea=function(){k.toTextArea=isNaN;d();a.parentNode.removeChild(k.getWrapperElement());a.style.display="";a.form&&(Z(a.form,"submit",d),b.leaveSubmitMethodAlone||"function"!=typeof a.form.submit||(a.form.submit=f))}};a.style.display="none";var h=ya(function(k){return a.parentNode.insertBefore(k,
a.nextSibling)},b);return h};(function(a){a.off=Z;a.on=W;a.wheelEventPixels=$g;a.Doc=Na;a.splitLines=we;a.countColumn=q;a.findColumn=E;a.isWordChar=fa;a.Pass=nd;a.signal=S;a.Line=Sb;a.changeEnd=nb;a.scrollbarModel=tf;a.Pos=H;a.cmpPos=ba;a.modes=vd;a.mimeModes=Jb;a.resolveMode=Oc;a.getMode=wd;a.modeExtensions=Kb;a.extendMode=Fg;a.copyState=sb;a.startState=Ae;a.innerMode=xd;a.commands=Ac;a.keyMap=zc;a.keyName=eg;a.isModifierKey=bg;a.lookupKey=Yb;a.normalizeKeyMap=kh;a.StringStream=Ca;a.SharedTextMarker=
yc;a.TextMarker=pb;a.LineWidget=xc;a.e_preventDefault=ka;a.e_stopPropagation=Ib;a.e_stop=cc;a.addClass=D;a.contains=B;a.rmClass=Cb;a.keyNames=qb})(ya);ya.version="5.65.16";return ya});(function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){function K(D){for(var M;null!=(M=D.next());)if("`"==M&&!D.eat("`"))return"variable-2";D.backUp(D.current().length-1);return D.eatWhile(/\w/)?"variable-2":null}function F(D){D.eat("@")&&(D.match("session."),D.match("local."),D.match("global."));return D.eat("'")?(D.match(/^.*'/),"variable-2"):D.eat('"')?
(D.match(/^.*"/),"variable-2"):D.eat("`")?(D.match(/^.*`/),"variable-2"):D.match(/^[0-9a-zA-Z$\._]+/)?"variable-2":null}function z(D){return D.eat("N")?"atom":D.match(/^[a-zA-Z.#!?]/)?"variable-2":null}function w(D){var M={};D=D.split(" ");for(var R=0;R<D.length;++R)M[D[R]]=!0;return M}t.defineMode("sql",function(D,M){function R(P,V){var y=P.next();if(da[y]){var G=da[y](P,V);if(!1!==G)return G}if(J.hexNumber&&("0"==y&&P.match(/^[xX][0-9a-fA-F]+/)||("x"==y||"X"==y)&&P.match(/^'[0-9a-fA-F]*'/))||J.binaryNumber&&
(("b"==y||"B"==y)&&P.match(/^'[01]*'/)||"0"==y&&P.match(/^b[01]+/)))return"number";if(47<y.charCodeAt(0)&&58>y.charCodeAt(0))return P.match(/^[0-9]*(\.[0-9]+)?([eE][-+]?[0-9]+)?/),J.decimallessFloat&&P.match(/^\.(?!\.)/),"number";if("@"==y||"$"==y)return P.match(/^[^ \t)/,]*/),"error";if("?"==y&&(P.eatSpace()||P.eol()||P.eat(";")))return"variable-3";if("'"==y||'"'==y&&J.doubleQuote)return V.tokenize=v(y),V.tokenize(P,V);if(!(J.nCharCast&&("n"==y||"N"==y)||J.charsetCast&&"_"==y&&P.match(/[a-z][a-z0-9]*/i))||
"'"!=P.peek()&&'"'!=P.peek()){if(J.escapeConstant&&("e"==y||"E"==y)&&("'"==P.peek()||'"'==P.peek()&&J.doubleQuote))return V.tokenize=function(Q,X){return(X.tokenize=v(Q.next(),!0))(Q,X)},"keyword";if(J.commentSlashSlash&&"/"==y&&P.eat("/")||J.commentHash&&"#"==y||"-"==y&&P.eat("-")&&(!J.commentSpaceRequired||P.eat(" ")))return P.skipToEnd(),"comment";if("/"==y&&P.eat("*"))return V.tokenize=A(1),V.tokenize(P,V);if("."==y){if(J.zerolessFloat&&P.match(/^(?:\d+(?:e[+-]?\d+)?)/i))return"number";if(P.match(/^\.+/))return null;
if(P.match(/^[\w\d_$#]+/))return"variable-2"}else{if(O.test(y))return P.eatWhile(O),"operator";if(fa.test(y))return"bracket";if(za.test(y))return P.eatWhile(za),"punctuation";if("{"==y&&(P.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/)||P.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/)))return"number";P.eatWhile(/^[_\w\d]/);V=P.current().toLowerCase();return aa.hasOwnProperty(V)&&(P.match(/^( )+'[^']*'/)||P.match(/^( )+"[^"]*"/))?"number":x.hasOwnProperty(V)?"atom":E.hasOwnProperty(V)?"type":L.hasOwnProperty(V)?
"keyword":q.hasOwnProperty(V)?"builtin":null}}else return"keyword"}function v(P,V){return function(y,G){for(var Q=!1,X;null!=(X=y.next());){if(X==P&&!Q){G.tokenize=R;break}Q=(ta||V)&&!Q&&"\\"==X}return"error"}}function A(P){return function(V,y){var G=V.match(/^.*?(\/\*|\*\/)/);G?y.tokenize="/*"==G[1]?A(P+1):1<P?A(P-1):R:V.skipToEnd();return"comment"}}function n(P,V,y){V.context={prev:V.context,indent:P.indentation(),col:P.column(),type:y}}var q=M.client||{},x=M.atoms||{"false":!0,"true":!0,"null":!0},
E=M.builtin||w(I),L=M.keywords||w(B),O=M.operatorChars||/^[*+\-%<>!=&|~^\/]/,J=M.support||{},da=M.hooks||{},aa=M.dateSQL||{date:!0,time:!0,timestamp:!0},ta=!1!==M.backslashStringEscapes,fa=M.brackets||/^[\{}\(\)\[\]]/,za=M.punctuation||/^[;.,:]/;return{startState:function(){return{tokenize:R,context:null}},token:function(P,V){P.sol()&&V.context&&null==V.context.align&&(V.context.align=!1);if(V.tokenize==R&&P.eatSpace())return null;var y=V.tokenize(P,V);if("comment"==y)return y;V.context&&null==V.context.align&&
(V.context.align=!0);var G=P.current();"("==G?n(P,V,")"):"["==G?n(P,V,"]"):V.context&&V.context.type==G&&(V.indent=V.context.indent,V.context=V.context.prev);return y},indent:function(P,V){P=P.context;if(!P)return t.Pass;V=V.charAt(0)==P.type;return P.align?P.col+(V?0:1):P.indent+(V?0:D.indentUnit)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:J.commentSlashSlash?"//":J.commentHash?"#":"--",closeBrackets:"()[]{}''\"\"``",config:M}});var B="alter and as asc between by count create delete desc distinct drop from group having in insert into is join like not on or order select set table union update values where limit ",
I="bool boolean bit blob enum long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision real date datetime year unsigned signed decimal numeric";t.defineMIME("text/k-sql",{name:"sql",keywords:w("with all top null and as asc between by count desc distinct from group having in is left right inner outter join like not on or order select union where limit avg max min sum abs celling cos exp floor log pi sign sin sqrt tan log10 round mod nullif isnull ascii char case left length ltrim rtrim ucase substring concat replace charindex curdate curtime dayofmonth dayofweek dayofyear hour minute month now quarter second week year dayname monthname convert dateadd datediff "),
builtin:w(I),atoms:w("false true null unknown"),dateSQL:w("date time timestamp"),support:w("doubleQuote binaryNumber hexNumber")});t.defineMIME("text/o-sql",{name:"sql",keywords:w("with all top null and as asc between by count desc distinct from group having in is like not or order select where limit avg max min sum abs celling cos exp floor log pi sign sin sqrt tan log10 round mod nullif isnull ascii char case left length ltrim rtrim ucase substring concat replace charindex curdate curtime dayofmonth dayofweek dayofyear hour minute month now quarter second week year dayname monthname convert dateadd datediff "),
builtin:w(I),atoms:w("false true null unknown"),dateSQL:w("date time timestamp"),support:w("doubleQuote binaryNumber hexNumber")});t.defineMIME("text/x-sql",{name:"sql",keywords:w(B+"begin"),builtin:w(I),atoms:w("false true null unknown"),dateSQL:w("date time timestamp"),support:w("doubleQuote binaryNumber hexNumber")});t.defineMIME("text/x-mssql",{name:"sql",client:w("$partition binary_checksum checksum connectionproperty context_info current_request_id error_line error_message error_number error_procedure error_severity error_state formatmessage get_filestream_transaction_context getansinull host_id host_name isnull isnumeric min_active_rowversion newid newsequentialid rowcount_big xact_state object_id"),
keywords:w(B+"begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered declare exec go if use index holdlock nolock nowait paglock readcommitted readcommittedlock readpast readuncommitted repeatableread rowlock serializable snapshot tablock tablockx updlock with"),builtin:w("bigint numeric bit smallint decimal smallmoney int tinyint money float real char varchar text nchar nvarchar ntext binary varbinary image cursor timestamp hierarchyid uniqueidentifier sql_variant xml table "),
atoms:w("is not null like and or in left right between inner outer join all any some cross unpivot pivot exists"),operatorChars:/^[*+\-%<>!=^&|\/]/,brackets:/^[\{}\(\)]/,punctuation:/^[;.,:/]/,backslashStringEscapes:!1,dateSQL:w("date datetimeoffset datetime2 smalldatetime datetime time"),hooks:{"@":F}});t.defineMIME("text/x-mysql",{name:"sql",client:w("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:w(B+"accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general get global grant grants group group_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),
builtin:w("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:w("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:w("date time timestamp"),support:w("decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),
hooks:{"@":F,"`":K,"\\":z}});t.defineMIME("text/x-mariadb",{name:"sql",client:w("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:w(B+"accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated get global grant grants group group_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show shutdown signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),
builtin:w("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:w("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:w("date time timestamp"),support:w("decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),
hooks:{"@":F,"`":K,"\\":z}});t.defineMIME("text/x-sqlite",{name:"sql",client:w("auth backup bail binary changes check clone databases dbinfo dump echo eqp exit explain fullschema headers help import imposter indexes iotrace limit lint load log mode nullvalue once open output print prompt quit read restore save scanstats schema separator session shell show stats system tables testcase timeout timer trace vfsinfo vfslist vfsname width"),keywords:w(B+"abort action add after all analyze attach autoincrement before begin cascade case cast check collate column commit conflict constraint cross current_date current_time current_timestamp database default deferrable deferred detach each else end escape except exclusive exists explain fail for foreign full glob if ignore immediate index indexed initially inner instead intersect isnull key left limit match natural no notnull null of offset outer plan pragma primary query raise recursive references regexp reindex release rename replace restrict right rollback row savepoint temp temporary then to transaction trigger unique using vacuum view virtual when with without"),
builtin:w("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text clob bigint int int2 int8 integer float double char varchar date datetime year unsigned signed numeric real"),atoms:w("null current_date current_time current_timestamp"),operatorChars:/^[*+\-%<>!=&|/~]/,dateSQL:w("date time timestamp datetime"),support:w("decimallessFloat zerolessFloat"),identifierQuote:'"',hooks:{"@":F,":":F,"?":F,$:F,'"':function(D){for(var M;null!=
(M=D.next());)if('"'==M&&!D.eat('"'))return"variable-2";D.backUp(D.current().length-1);return D.eatWhile(/\w/)?"variable-2":null},"`":K}});t.defineMIME("text/x-cassandra",{name:"sql",client:{},keywords:w("add all allow alter and any apply as asc authorize batch begin by clustering columnfamily compact consistency count create custom delete desc distinct drop each_quorum exists filtering from grant if in index insert into key keyspace keyspaces level limit local_one local_quorum modify nan norecursive nosuperuser not of on one order password permission permissions primary quorum rename revoke schema select set storage superuser table three to token truncate ttl two type unlogged update use user users using values where with writetime"),
builtin:w("ascii bigint blob boolean counter decimal double float frozen inet int list map static text timestamp timeuuid tuple uuid varchar varint"),atoms:w("false true infinity NaN"),operatorChars:/^[<>=]/,dateSQL:{},support:w("commentSlashSlash decimallessFloat"),hooks:{}});t.defineMIME("text/x-plsql",{name:"sql",client:w("appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap"),
keywords:w("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elseif elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning returns reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"),
builtin:w("abs acos add_months ascii asin atan atan2 average bfile bfilename bigserial bit blob ceil character chartorowid chr clob concat convert cos cosh count dec decode deref dual dump dup_val_on_index empty error exp false float floor found glb greatest hextoraw initcap instr instrb int integer isopen last_day least length lengthb ln lower lpad ltrim lub make_ref max min mlslabel mod months_between natural naturaln nchar nclob new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null number numeric nvarchar2 nvl others power rawtohex real reftohex round rowcount rowidtochar rowtype rpad rtrim serial sign signtype sin sinh smallint soundex sqlcode sqlerrm sqrt stddev string substr substrb sum sysdate tan tanh to_char text to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid unlogged upper user userenv varchar varchar2 variance varying vsize xml"),
operatorChars:/^[*\/+\-%<>!=~]/,dateSQL:w("date time timestamp"),support:w("doubleQuote nCharCast zerolessFloat binaryNumber hexNumber")});t.defineMIME("text/x-hive",{name:"sql",keywords:w("select alter $elem$ $key$ $value$ add after all analyze and archive as asc before between binary both bucket buckets by cascade case cast change cluster clustered clusterstatus collection column columns comment compute concatenate continue create cross cursor data database databases dbproperties deferred delete delimited desc describe directory disable distinct distribute drop else enable end escaped exclusive exists explain export extended external fetch fields fileformat first format formatted from full function functions grant group having hold_ddltime idxproperties if import in index indexes inpath inputdriver inputformat insert intersect into is items join keys lateral left like limit lines load local location lock locks mapjoin materialized minus msck no_drop nocompress not of offline on option or order out outer outputdriver outputformat overwrite partition partitioned partitions percent plus preserve procedure purge range rcfile read readonly reads rebuild recordreader recordwriter recover reduce regexp rename repair replace restrict revoke right rlike row schema schemas semi sequencefile serde serdeproperties set shared show show_database sort sorted ssl statistics stored streamtable table tables tablesample tblproperties temporary terminated textfile then tmp to touch transform trigger unarchive undo union uniquejoin unlock update use using utc utc_tmestamp view when where while with admin authorization char compact compactions conf cube current current_date current_timestamp day decimal defined dependency directories elem_type exchange file following for grouping hour ignore inner interval jar less logical macro minute month more none noscan over owner partialscan preceding pretty principals protection reload rewrite role roles rollup rows second server sets skewed transactions truncate unbounded unset uri user values window year"),
builtin:w("bool boolean long timestamp tinyint smallint bigint int float double date datetime unsigned string array struct map uniontype key_type utctimestamp value_type varchar"),atoms:w("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:w("date timestamp"),support:w("doubleQuote binaryNumber hexNumber")});t.defineMIME("text/x-pgsql",{name:"sql",client:w("source"),keywords:w(B+"a abort abs absent absolute access according action ada add admin after aggregate alias all allocate also alter always analyse analyze and any are array array_agg array_max_cardinality as asc asensitive assert assertion assignment asymmetric at atomic attach attribute attributes authorization avg backward base64 before begin begin_frame begin_partition bernoulli between bigint binary bit bit_length blob blocked bom boolean both breadth by c cache call called cardinality cascade cascaded case cast catalog catalog_name ceil ceiling chain char char_length character character_length character_set_catalog character_set_name character_set_schema characteristics characters check checkpoint class class_origin clob close cluster coalesce cobol collate collation collation_catalog collation_name collation_schema collect column column_name columns command_function command_function_code comment comments commit committed concurrently condition condition_number configuration conflict connect connection connection_name constant constraint constraint_catalog constraint_name constraint_schema constraints constructor contains content continue control conversion convert copy corr corresponding cost count covar_pop covar_samp create cross csv cube cume_dist current current_catalog current_date current_default_transform_group current_path current_role current_row current_schema current_time current_timestamp current_transform_group_for_type current_user cursor cursor_name cycle data database datalink datatype date datetime_interval_code datetime_interval_precision day db deallocate debug dec decimal declare default defaults deferrable deferred defined definer degree delete delimiter delimiters dense_rank depends depth deref derived desc describe descriptor detach detail deterministic diagnostics dictionary disable discard disconnect dispatch distinct dlnewcopy dlpreviouscopy dlurlcomplete dlurlcompleteonly dlurlcompletewrite dlurlpath dlurlpathonly dlurlpathwrite dlurlscheme dlurlserver dlvalue do document domain double drop dump dynamic dynamic_function dynamic_function_code each element else elseif elsif empty enable encoding encrypted end end_frame end_partition endexec enforced enum equals errcode error escape event every except exception exclude excluding exclusive exec execute exists exit exp explain expression extension external extract false family fetch file filter final first first_value flag float floor following for force foreach foreign fortran forward found frame_row free freeze from fs full function functions fusion g general generated get global go goto grant granted greatest group grouping groups handler having header hex hierarchy hint hold hour id identity if ignore ilike immediate immediately immutable implementation implicit import in include including increment indent index indexes indicator info inherit inherits initially inline inner inout input insensitive insert instance instantiable instead int integer integrity intersect intersection interval into invoker is isnull isolation join k key key_member key_type label lag language large last last_value lateral lead leading leakproof least left length level library like like_regex limit link listen ln load local localtime localtimestamp location locator lock locked log logged loop lower m map mapping match matched materialized max max_cardinality maxvalue member merge message message_length message_octet_length message_text method min minute minvalue mod mode modifies module month more move multiset mumps name names namespace national natural nchar nclob nesting new next nfc nfd nfkc nfkd nil no none normalize normalized not nothing notice notify notnull nowait nth_value ntile null nullable nullif nulls number numeric object occurrences_regex octet_length octets of off offset oids old on only open operator option options or order ordering ordinality others out outer output over overlaps overlay overriding owned owner p pad parallel parameter parameter_mode parameter_name parameter_ordinal_position parameter_specific_catalog parameter_specific_name parameter_specific_schema parser partial partition pascal passing passthrough password path percent percent_rank percentile_cont percentile_disc perform period permission pg_context pg_datatype_name pg_exception_context pg_exception_detail pg_exception_hint placing plans pli policy portion position position_regex power precedes preceding precision prepare prepared preserve primary print_strict_params prior privileges procedural procedure procedures program public publication query quote raise range rank read reads real reassign recheck recovery recursive ref references referencing refresh regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy reindex relative release rename repeatable replace replica requiring reset respect restart restore restrict result result_oid return returned_cardinality returned_length returned_octet_length returned_sqlstate returning returns reverse revoke right role rollback rollup routine routine_catalog routine_name routine_schema routines row row_count row_number rows rowtype rule savepoint scale schema schema_name schemas scope scope_catalog scope_name scope_schema scroll search second section security select selective self sensitive sequence sequences serializable server server_name session session_user set setof sets share show similar simple size skip slice smallint snapshot some source space specific specific_name specifictype sql sqlcode sqlerror sqlexception sqlstate sqlwarning sqrt stable stacked standalone start state statement static statistics stddev_pop stddev_samp stdin stdout storage strict strip structure style subclass_origin submultiset subscription substring substring_regex succeeds sum symmetric sysid system system_time system_user t table table_name tables tablesample tablespace temp template temporary text then ties time timestamp timezone_hour timezone_minute to token top_level_count trailing transaction transaction_active transactions_committed transactions_rolled_back transform transforms translate translate_regex translation treat trigger trigger_catalog trigger_name trigger_schema trim trim_array true truncate trusted type types uescape unbounded uncommitted under unencrypted union unique unknown unlink unlisten unlogged unnamed unnest until untyped update upper uri usage use_column use_variable user user_defined_type_catalog user_defined_type_code user_defined_type_name user_defined_type_schema using vacuum valid validate validator value value_of values var_pop var_samp varbinary varchar variable_conflict variadic varying verbose version versioning view views volatile warning when whenever where while whitespace width_bucket window with within without work wrapper write xml xmlagg xmlattributes xmlbinary xmlcast xmlcomment xmlconcat xmldeclaration xmldocument xmlelement xmlexists xmlforest xmliterate xmlnamespaces xmlparse xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltext xmlvalidate year yes zone"),
builtin:w("bigint int8 bigserial serial8 bit varying varbit boolean bool box bytea character char varchar cidr circle date double precision float8 inet integer int int4 interval json jsonb line lseg macaddr macaddr8 money numeric decimal path pg_lsn point polygon real float4 smallint int2 smallserial serial2 serial serial4 text time zone timetz timestamp timestamptz tsquery tsvector txid_snapshot uuid xml"),atoms:w("false true null unknown"),operatorChars:/^[*\/+\-%<>!=&|^\/#@?~]/,backslashStringEscapes:!1,
dateSQL:w("date time timestamp"),support:w("decimallessFloat zerolessFloat binaryNumber hexNumber nCharCast charsetCast escapeConstant")});t.defineMIME("text/x-gql",{name:"sql",keywords:w("ancestor and asc by contains desc descendant distinct from group has in is limit offset on order select superset where"),atoms:w("false true"),builtin:w("blob datetime first key __key__ string integer double boolean null"),operatorChars:/^[*+\-%<>!=]/});t.defineMIME("text/x-gpsql",{name:"sql",client:w("source"),
keywords:w("abort absolute access action active add admin after aggregate all also alter always analyse analyze and any array as asc assertion assignment asymmetric at authorization backward before begin between bigint binary bit boolean both by cache called cascade cascaded case cast chain char character characteristics check checkpoint class close cluster coalesce codegen collate column comment commit committed concurrency concurrently configuration connection constraint constraints contains content continue conversion copy cost cpu_rate_limit create createdb createexttable createrole createuser cross csv cube current current_catalog current_date current_role current_schema current_time current_timestamp current_user cursor cycle data database day deallocate dec decimal declare decode default defaults deferrable deferred definer delete delimiter delimiters deny desc dictionary disable discard distinct distributed do document domain double drop dxl each else enable encoding encrypted end enum errors escape every except exchange exclude excluding exclusive execute exists explain extension external extract false family fetch fields filespace fill filter first float following for force foreign format forward freeze from full function global grant granted greatest group group_id grouping handler hash having header hold host hour identity if ignore ilike immediate immutable implicit in including inclusive increment index indexes inherit inherits initially inline inner inout input insensitive insert instead int integer intersect interval into invoker is isnull isolation join key language large last leading least left level like limit list listen load local localtime localtimestamp location lock log login mapping master match maxvalue median merge minute minvalue missing mode modifies modify month move name names national natural nchar new newline next no nocreatedb nocreateexttable nocreaterole nocreateuser noinherit nologin none noovercommit nosuperuser not nothing notify notnull nowait null nullif nulls numeric object of off offset oids old on only operator option options or order ordered others out outer over overcommit overlaps overlay owned owner parser partial partition partitions passing password percent percentile_cont percentile_disc placing plans position preceding precision prepare prepared preserve primary prior privileges procedural procedure protocol queue quote randomly range read readable reads real reassign recheck recursive ref references reindex reject relative release rename repeatable replace replica reset resource restart restrict returning returns revoke right role rollback rollup rootpartition row rows rule savepoint scatter schema scroll search second security segment select sequence serializable session session_user set setof sets share show similar simple smallint some split sql stable standalone start statement statistics stdin stdout storage strict strip subpartition subpartitions substring superuser symmetric sysid system table tablespace temp template temporary text then threshold ties time timestamp to trailing transaction treat trigger trim true truncate trusted type unbounded uncommitted unencrypted union unique unknown unlisten until update user using vacuum valid validation validator value values varchar variadic varying verbose version view volatile web when where whitespace window with within without work writable write xml xmlattributes xmlconcat xmlelement xmlexists xmlforest xmlparse xmlpi xmlroot xmlserialize year yes zone"),
builtin:w("bigint int8 bigserial serial8 bit varying varbit boolean bool box bytea character char varchar cidr circle date double precision float float8 inet integer int int4 interval json jsonb line lseg macaddr macaddr8 money numeric decimal path pg_lsn point polygon real float4 smallint int2 smallserial serial2 serial serial4 text time without zone with timetz timestamp timestamptz tsquery tsvector txid_snapshot uuid xml"),atoms:w("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^\/#@?~]/,
dateSQL:w("date time timestamp"),support:w("decimallessFloat zerolessFloat binaryNumber hexNumber nCharCast charsetCast")});t.defineMIME("text/x-sparksql",{name:"sql",keywords:w("add after all alter analyze and anti archive array as asc at between bucket buckets by cache cascade case cast change clear cluster clustered codegen collection column columns comment commit compact compactions compute concatenate cost create cross cube current current_date current_timestamp database databases data dbproperties defined delete delimited deny desc describe dfs directories distinct distribute drop else end escaped except exchange exists explain export extended external false fields fileformat first following for format formatted from full function functions global grant group grouping having if ignore import in index indexes inner inpath inputformat insert intersect interval into is items join keys last lateral lazy left like limit lines list load local location lock locks logical macro map minus msck natural no not null nulls of on optimize option options or order out outer outputformat over overwrite partition partitioned partitions percent preceding principals purge range recordreader recordwriter recover reduce refresh regexp rename repair replace reset restrict revoke right rlike role roles rollback rollup row rows schema schemas select semi separated serde serdeproperties set sets show skewed sort sorted start statistics stored stratify struct table tables tablesample tblproperties temp temporary terminated then to touch transaction transactions transform true truncate unarchive unbounded uncache union unlock unset use using values view when where window with"),
builtin:w("abs acos acosh add_months aggregate and any approx_count_distinct approx_percentile array array_contains array_distinct array_except array_intersect array_join array_max array_min array_position array_remove array_repeat array_sort array_union arrays_overlap arrays_zip ascii asin asinh assert_true atan atan2 atanh avg base64 between bigint bin binary bit_and bit_count bit_get bit_length bit_or bit_xor bool_and bool_or boolean bround btrim cardinality case cast cbrt ceil ceiling char char_length character_length chr coalesce collect_list collect_set concat concat_ws conv corr cos cosh cot count count_if count_min_sketch covar_pop covar_samp crc32 cume_dist current_catalog current_database current_date current_timestamp current_timezone current_user date date_add date_format date_from_unix_date date_part date_sub date_trunc datediff day dayofmonth dayofweek dayofyear decimal decode degrees delimited dense_rank div double e element_at elt encode every exists exp explode explode_outer expm1 extract factorial filter find_in_set first first_value flatten float floor forall format_number format_string from_csv from_json from_unixtime from_utc_timestamp get_json_object getbit greatest grouping grouping_id hash hex hour hypot if ifnull in initcap inline inline_outer input_file_block_length input_file_block_start input_file_name inputformat instr int isnan isnotnull isnull java_method json_array_length json_object_keys json_tuple kurtosis lag last last_day last_value lcase lead least left length levenshtein like ln locate log log10 log1p log2 lower lpad ltrim make_date make_dt_interval make_interval make_timestamp make_ym_interval map map_concat map_entries map_filter map_from_arrays map_from_entries map_keys map_values map_zip_with max max_by md5 mean min min_by minute mod monotonically_increasing_id month months_between named_struct nanvl negative next_day not now nth_value ntile nullif nvl nvl2 octet_length or outputformat overlay parse_url percent_rank percentile percentile_approx pi pmod posexplode posexplode_outer position positive pow power printf quarter radians raise_error rand randn random rank rcfile reflect regexp regexp_extract regexp_extract_all regexp_like regexp_replace repeat replace reverse right rint rlike round row_number rpad rtrim schema_of_csv schema_of_json second sentences sequence sequencefile serde session_window sha sha1 sha2 shiftleft shiftright shiftrightunsigned shuffle sign signum sin sinh size skewness slice smallint some sort_array soundex space spark_partition_id split sqrt stack std stddev stddev_pop stddev_samp str_to_map string struct substr substring substring_index sum tan tanh textfile timestamp timestamp_micros timestamp_millis timestamp_seconds tinyint to_csv to_date to_json to_timestamp to_unix_timestamp to_utc_timestamp transform transform_keys transform_values translate trim trunc try_add try_divide typeof ucase unbase64 unhex uniontype unix_date unix_micros unix_millis unix_seconds unix_timestamp upper uuid var_pop var_samp variance version weekday weekofyear when width_bucket window xpath xpath_boolean xpath_double xpath_float xpath_int xpath_long xpath_number xpath_short xpath_string xxhash64 year zip_with"),
atoms:w("false true null"),operatorChars:/^[*\/+\-%<>!=~&|^]/,dateSQL:w("date time timestamp"),support:w("doubleQuote zerolessFloat")});t.defineMIME("text/x-esper",{name:"sql",client:w("source"),keywords:w("alter and as asc between by count create delete desc distinct drop from group having in insert into is join like not on or order select set table union update values where limit after all and as at asc avedev avg between by case cast coalesce count create current_timestamp day days delete define desc distinct else end escape events every exists false first from full group having hour hours in inner insert instanceof into irstream is istream join last lastweekday left limit like max match_recognize matches median measures metadatasql min minute minutes msec millisecond milliseconds not null offset on or order outer output partition pattern prev prior regexp retain-union retain-intersection right rstream sec second seconds select set some snapshot sql stddev sum then true unidirectional until update variable weekday when where window"),
builtin:{},atoms:w("false true null"),operatorChars:/^[*+\-%<>!=&|^\/#@?~]/,dateSQL:w("time"),support:w("decimallessFloat zerolessFloat binaryNumber hexNumber")});t.defineMIME("text/x-trino",{name:"sql",keywords:w("abs absent acos add admin after all all_match alter analyze and any any_match approx_distinct approx_most_frequent approx_percentile approx_set arbitrary array_agg array_distinct array_except array_intersect array_join array_max array_min array_position array_remove array_sort array_union arrays_overlap as asc asin at at_timezone atan atan2 authorization avg bar bernoulli beta_cdf between bing_tile bing_tile_at bing_tile_coordinates bing_tile_polygon bing_tile_quadkey bing_tile_zoom_level bing_tiles_around bit_count bitwise_and bitwise_and_agg bitwise_left_shift bitwise_not bitwise_or bitwise_or_agg bitwise_right_shift bitwise_right_shift_arithmetic bitwise_xor bool_and bool_or both by call cardinality cascade case cast catalogs cbrt ceil ceiling char2hexint checksum chr classify coalesce codepoint column columns combinations comment commit committed concat concat_ws conditional constraint contains contains_sequence convex_hull_agg copartition corr cos cosh cosine_similarity count count_if covar_pop covar_samp crc32 create cross cube cume_dist current current_catalog current_date current_groups current_path current_role current_schema current_time current_timestamp current_timezone current_user data date_add date_diff date_format date_parse date_trunc day day_of_month day_of_week day_of_year deallocate default define definer degrees delete dense_rank deny desc describe descriptor distinct distributed dow doy drop e element_at else empty empty_approx_set encoding end error escape evaluate_classifier_predictions every except excluding execute exists exp explain extract false features fetch filter final first first_value flatten floor following for format format_datetime format_number from from_base from_base32 from_base64 from_base64url from_big_endian_32 from_big_endian_64 from_encoded_polyline from_geojson_geometry from_hex from_ieee754_32 from_ieee754_64 from_iso8601_date from_iso8601_timestamp from_iso8601_timestamp_nanos from_unixtime from_unixtime_nanos from_utf8 full functions geometric_mean geometry_from_hadoop_shape geometry_invalid_reason geometry_nearest_points geometry_to_bing_tiles geometry_union geometry_union_agg grant granted grants graphviz great_circle_distance greatest group grouping groups hamming_distance hash_counts having histogram hmac_md5 hmac_sha1 hmac_sha256 hmac_sha512 hour human_readable_seconds if ignore in including index infinity initial inner input insert intersect intersection_cardinality into inverse_beta_cdf inverse_normal_cdf invoker io is is_finite is_infinite is_json_scalar is_nan isolation jaccard_index join json_array json_array_contains json_array_get json_array_length json_exists json_extract json_extract_scalar json_format json_object json_parse json_query json_size json_value keep key keys kurtosis lag last last_day_of_month last_value lateral lead leading learn_classifier learn_libsvm_classifier learn_libsvm_regressor learn_regressor least left length level levenshtein_distance like limit line_interpolate_point line_interpolate_points line_locate_point listagg ln local localtime localtimestamp log log10 log2 logical lower lpad ltrim luhn_check make_set_digest map_agg map_concat map_entries map_filter map_from_entries map_keys map_union map_values map_zip_with match match_recognize matched matches materialized max max_by md5 measures merge merge_set_digest millisecond min min_by minute mod month multimap_agg multimap_from_entries murmur3 nan natural next nfc nfd nfkc nfkd ngrams no none none_match normal_cdf normalize not now nth_value ntile null nullif nulls numeric_histogram object objectid_timestamp of offset omit on one only option or order ordinality outer output over overflow parse_data_size parse_datetime parse_duration partition partitions passing past path pattern per percent_rank permute pi position pow power preceding prepare privileges properties prune qdigest_agg quarter quotes radians rand random range rank read recursive reduce reduce_agg refresh regexp_count regexp_extract regexp_extract_all regexp_like regexp_position regexp_replace regexp_split regr_intercept regr_slope regress rename render repeat repeatable replace reset respect restrict returning reverse revoke rgb right role roles rollback rollup round row_number rows rpad rtrim running scalar schema schemas second security seek select sequence serializable session set sets sha1 sha256 sha512 show shuffle sign simplify_geometry sin skewness skip slice some soundex spatial_partitioning spatial_partitions split split_part split_to_map split_to_multimap spooky_hash_v2_32 spooky_hash_v2_64 sqrt st_area st_asbinary st_astext st_boundary st_buffer st_centroid st_contains st_convexhull st_coorddim st_crosses st_difference st_dimension st_disjoint st_distance st_endpoint st_envelope st_envelopeaspts st_equals st_exteriorring st_geometries st_geometryfromtext st_geometryn st_geometrytype st_geomfrombinary st_interiorringn st_interiorrings st_intersection st_intersects st_isclosed st_isempty st_isring st_issimple st_isvalid st_length st_linefromtext st_linestring st_multipoint st_numgeometries st_numinteriorring st_numpoints st_overlaps st_point st_pointn st_points st_polygon st_relate st_startpoint st_symdifference st_touches st_union st_within st_x st_xmax st_xmin st_y st_ymax st_ymin start starts_with stats stddev stddev_pop stddev_samp string strpos subset substr substring sum system table tables tablesample tan tanh tdigest_agg text then ties timestamp_objectid timezone_hour timezone_minute to to_base to_base32 to_base64 to_base64url to_big_endian_32 to_big_endian_64 to_char to_date to_encoded_polyline to_geojson_geometry to_geometry to_hex to_ieee754_32 to_ieee754_64 to_iso8601 to_milliseconds to_spherical_geography to_timestamp to_unixtime to_utf8 trailing transaction transform transform_keys transform_values translate trim trim_array true truncate try try_cast type typeof uescape unbounded uncommitted unconditional union unique unknown unmatched unnest update upper url_decode url_encode url_extract_fragment url_extract_host url_extract_parameter url_extract_path url_extract_port url_extract_protocol url_extract_query use user using utf16 utf32 utf8 validate value value_at_quantile values values_at_quantiles var_pop var_samp variance verbose version view week week_of_year when where width_bucket wilson_interval_lower wilson_interval_upper window with with_timezone within without word_stem work wrapper write xxhash64 year year_of_week yow zip zip_with"),
builtin:w("array bigint bingtile boolean char codepoints color date decimal double function geometry hyperloglog int integer interval ipaddress joniregexp json json2016 jsonpath kdbtree likepattern map model objectid p4hyperloglog precision qdigest re2jregexp real regressor row setdigest smallint sphericalgeography tdigest time timestamp tinyint uuid varbinary varchar zone"),atoms:w("false true null unknown"),operatorChars:/^[[\]|<>=!\-+*/%]/,dateSQL:w("date time timestamp zone"),support:w("decimallessFloat zerolessFloat hexNumber")})});(function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){function K(v,A){this.cm=v;this.options=A;this.widget=null;this.tick=this.debounce=0;this.startPos=this.cm.getCursor("start");this.startLen=this.cm.getLine(this.startPos.line).length-this.cm.getSelection().length;if(this.options.updateOnCursorActivity){var n=this;v.on("cursorActivity",this.activityFunc=
function(){n.cursorActivity()})}}function F(v,A){function n(O,J){var da="string"!=typeof J?function(aa){return J(aa,A)}:q.hasOwnProperty(J)?q[J]:J;E[O]=da}var q={Up:function(){A.moveFocus(-1)},Down:function(){A.moveFocus(1)},PageUp:function(){A.moveFocus(-A.menuSize()+1,!0)},PageDown:function(){A.moveFocus(A.menuSize()-1,!0)},Home:function(){A.setFocus(0)},End:function(){A.setFocus(A.length-1)},Enter:A.pick,Tab:A.pick,Esc:A.close};/Mac/.test(navigator.platform)&&(q["Ctrl-P"]=function(){A.moveFocus(-1)},
q["Ctrl-N"]=function(){A.moveFocus(1)});var x=v.options.customKeys,E=x?{}:q;if(x)for(var L in x)x.hasOwnProperty(L)&&n(L,x[L]);if(v=v.options.extraKeys)for(L in v)v.hasOwnProperty(L)&&n(L,v[L]);return E}function z(v,A){for(;A&&A!=v;){if("LI"===A.nodeName.toUpperCase()&&A.parentNode==v)return A;A=A.parentNode}}function w(v,A){this.id="cm-complete-"+Math.floor(Math.random(1E6));this.completion=v;this.data=A;this.picked=!1;var n=this,q=v.cm,x=q.getInputField().ownerDocument,E=x.defaultView||x.parentWindow,
L=this.hints=x.createElement("ul");L.setAttribute("role","listbox");L.setAttribute("aria-expanded","true");L.id=this.id;L.className="CodeMirror-hints "+v.cm.options.theme;this.selectedHint=A.selectedHint||0;for(var O=A.list,J=0;J<O.length;++J){var da=L.appendChild(x.createElement("li")),aa=O[J],ta="CodeMirror-hint"+(J!=this.selectedHint?"":" CodeMirror-hint-active");null!=aa.className&&(ta=aa.className+" "+ta);da.className=ta;J==this.selectedHint&&da.setAttribute("aria-selected","true");da.id=this.id+
"-"+J;da.setAttribute("role","option");aa.render?aa.render(da,A,aa):da.appendChild(x.createTextNode(aa.displayText||("string"==typeof aa?aa:aa.text)));da.hintId=J}var fa=v.options.container||x.body;J=q.cursorCoords(v.options.alignWithWord?A.from:null);var za=J.left,P=J.bottom,V=!0;ta=da=0;if(fa!==x.body){aa=-1!==["absolute","relative","fixed"].indexOf(E.getComputedStyle(fa).position)?fa:fa.offsetParent;ta=aa.getBoundingClientRect();var y=x.body.getBoundingClientRect();da=ta.left-y.left-aa.scrollLeft;
ta=ta.top-y.top-aa.scrollTop}L.style.left=za-da+"px";L.style.top=P-ta+"px";aa=E.innerWidth||Math.max(x.body.offsetWidth,x.documentElement.offsetWidth);y=E.innerHeight||Math.max(x.body.offsetHeight,x.documentElement.offsetHeight);fa.appendChild(L);q.getInputField().setAttribute("aria-autocomplete","list");q.getInputField().setAttribute("aria-owns",this.id);q.getInputField().setAttribute("aria-activedescendant",this.id+"-"+this.selectedHint);fa=v.options.moveOnOverlap?L.getBoundingClientRect():new DOMRect;
var G=v.options.paddingForScrollbar?L.scrollHeight>L.clientHeight+1:!1,Q;setTimeout(function(){Q=q.getScrollInfo()});if(0<fa.bottom-y){var X=fa.bottom-fa.top,ea=fa.top-(J.bottom-J.top)-2;y-fa.top<ea?(X>ea&&(L.style.height=(X=ea)+"px"),L.style.top=(P=J.top-X)+ta+"px",V=!1):L.style.height=y-fa.top-2+"px"}ta=fa.right-aa;G&&(ta+=q.display.nativeBarWidth);0<ta&&(fa.right-fa.left>aa&&(L.style.width=aa-5+"px",ta-=fa.right-fa.left-aa),L.style.left=(za=Math.max(J.left-ta-da,0))+"px");if(G)for(J=L.firstChild;J;J=
J.nextSibling)J.style.paddingRight=q.display.nativeBarWidth+"px";q.addKeyMap(this.keyMap=F(v,{moveFocus:function(S,ja){n.changeActive(n.selectedHint+S,ja)},setFocus:function(S){n.changeActive(S)},menuSize:function(){return n.screenAmount()},length:O.length,close:function(){v.close()},pick:function(){n.pick()},data:A}));if(v.options.closeOnUnfocus){var Z;q.on("blur",this.onBlur=function(){Z=setTimeout(function(){v.close()},100)});q.on("focus",this.onFocus=function(){clearTimeout(Z)})}q.on("scroll",
this.onScroll=function(){var S=q.getScrollInfo(),ja=q.getWrapperElement().getBoundingClientRect();Q||(Q=q.getScrollInfo());var Ba=P+Q.top-S.top,ia=Ba-(E.pageYOffset||(x.documentElement||x.body).scrollTop);V||(ia+=L.offsetHeight);if(ia<=ja.top||ia>=ja.bottom)return v.close();L.style.top=Ba+"px";L.style.left=za+Q.left-S.left+"px"});t.on(L,"dblclick",function(S){(S=z(L,S.target||S.srcElement))&&null!=S.hintId&&(n.changeActive(S.hintId),n.pick())});t.on(L,"click",function(S){(S=z(L,S.target||S.srcElement))&&
null!=S.hintId&&(n.changeActive(S.hintId),v.options.completeOnSingleClick&&n.pick())});t.on(L,"mousedown",function(){setTimeout(function(){q.focus()},20)});J=this.getSelectedHintRange();0===J.from&&0===J.to||this.scrollToActive();t.signal(A,"select",O[this.selectedHint],L.childNodes[this.selectedHint]);return!0}function B(v,A){if(!v.somethingSelected())return A;v=[];for(var n=0;n<A.length;n++)A[n].supportsSelection&&v.push(A[n]);return v}function I(v,A,n,q){v.async?v(A,q,n):(v=v(A,n))&&v.then?v.then(q):
q(v)}t.showHint=function(v,A,n){if(!A)return v.showHint(n);n&&n.async&&(A.async=!0);A={hint:A};if(n)for(var q in n)A[q]=n[q];return v.showHint(A)};t.defineExtension("showHint",function(v){var A=this.getCursor("start"),n=this.options.hintOptions,q={},x;for(x in R)q[x]=R[x];if(n)for(x in n)void 0!==n[x]&&(q[x]=n[x]);if(v)for(x in v)void 0!==v[x]&&(q[x]=v[x]);q.hint.resolve&&(q.hint=q.hint.resolve(this,A));v=q;A=this.listSelections();if(!(1<A.length)){if(this.somethingSelected()){if(!v.hint.supportsSelection)return;
for(x=0;x<A.length;x++)if(A[x].head.line!=A[x].anchor.line)return}this.state.completionActive&&this.state.completionActive.close();A=this.state.completionActive=new K(this,v);A.options.hint&&(t.signal(this,"startCompletion",this),A.update(!0))}});t.defineExtension("closeHint",function(){this.state.completionActive&&this.state.completionActive.close()});var D=window.requestAnimationFrame||function(v){return setTimeout(v,1E3/60)},M=window.cancelAnimationFrame||clearTimeout;K.prototype={close:function(){this.active()&&
(this.tick=this.cm.state.completionActive=null,this.options.updateOnCursorActivity&&this.cm.off("cursorActivity",this.activityFunc),this.widget&&this.data&&t.signal(this.data,"close"),this.widget&&this.widget.close(),t.signal(this.cm,"endCompletion",this.cm))},active:function(){return this.cm.state.completionActive==this},pick:function(v,A){var n=v.list[A],q=this;this.cm.operation(function(){n.hint?n.hint(q.cm,v,n):q.cm.replaceRange("string"==typeof n?n:n.text,n.from||v.from,n.to||v.to,"complete");
t.signal(v,"pick",n);q.cm.scrollIntoView()});this.options.closeOnPick&&this.close()},cursorActivity:function(){this.debounce&&(M(this.debounce),this.debounce=0);var v=this.startPos;this.data&&(v=this.data.from);var A=this.cm.getCursor(),n=this.cm.getLine(A.line);if(A.line!=this.startPos.line||n.length-A.ch!=this.startLen-this.startPos.ch||A.ch<v.ch||this.cm.somethingSelected()||!A.ch||this.options.closeCharacters.test(n.charAt(A.ch-1)))this.close();else{var q=this;this.debounce=D(function(){q.update()});
this.widget&&this.widget.disable()}},update:function(v){if(null!=this.tick){var A=this,n=++this.tick;I(this.options.hint,this.cm,this.options,function(q){A.tick==n&&A.finishUpdate(q,v)})}},finishUpdate:function(v,A){this.data&&t.signal(this.data,"update");A=this.widget&&this.widget.picked||A&&this.options.completeSingle;this.widget&&this.widget.close();(this.data=v)&&v.list.length&&(A&&1==v.list.length?this.pick(v,0):(this.widget=new w(this,v),t.signal(v,"shown")))}};w.prototype={close:function(){if(this.completion.widget==
this){this.completion.widget=null;this.hints.parentNode&&this.hints.parentNode.removeChild(this.hints);this.completion.cm.removeKeyMap(this.keyMap);var v=this.completion.cm.getInputField();v.removeAttribute("aria-activedescendant");v.removeAttribute("aria-owns");v=this.completion.cm;this.completion.options.closeOnUnfocus&&(v.off("blur",this.onBlur),v.off("focus",this.onFocus));v.off("scroll",this.onScroll)}},disable:function(){this.completion.cm.removeKeyMap(this.keyMap);var v=this;this.keyMap={Enter:function(){v.picked=
!0}};this.completion.cm.addKeyMap(this.keyMap)},pick:function(){this.completion.pick(this.data,this.selectedHint)},changeActive:function(v,A){v>=this.data.list.length?v=A?this.data.list.length-1:0:0>v&&(v=A?0:this.data.list.length-1);if(this.selectedHint!=v){if(A=this.hints.childNodes[this.selectedHint])A.className=A.className.replace(" CodeMirror-hint-active",""),A.removeAttribute("aria-selected");A=this.hints.childNodes[this.selectedHint=v];A.className+=" CodeMirror-hint-active";A.setAttribute("aria-selected",
"true");this.completion.cm.getInputField().setAttribute("aria-activedescendant",A.id);this.scrollToActive();t.signal(this.data,"select",this.data.list[this.selectedHint],A)}},scrollToActive:function(){var v=this.getSelectedHintRange(),A=this.hints.childNodes[v.from];v=this.hints.childNodes[v.to];var n=this.hints.firstChild;A.offsetTop<this.hints.scrollTop?this.hints.scrollTop=A.offsetTop-n.offsetTop:v.offsetTop+v.offsetHeight>this.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=v.offsetTop+
v.offsetHeight-this.hints.clientHeight+n.offsetTop)},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1},getSelectedHintRange:function(){var v=this.completion.options.scrollMargin||0;return{from:Math.max(0,this.selectedHint-v),to:Math.min(this.data.list.length-1,this.selectedHint+v)}}};t.registerHelper("hint","auto",{resolve:function(v,A){var n=v.getHelpers(A,"hint"),q;return n.length?(v=function(x,E,L){function O(da){if(da==J.length)return E(null);
I(J[da],x,L,function(aa){aa&&0<aa.list.length?E(aa):O(da+1)})}var J=B(x,n);O(0)},v.async=!0,v.supportsSelection=!0,v):(q=v.getHelper(v.getCursor(),"hintWords"))?function(x){return t.hint.fromList(x,{words:q})}:t.hint.anyword?function(x,E){return t.hint.anyword(x,E)}:function(){}}});t.registerHelper("hint","fromList",function(v,A){var n=v.getCursor(),q=v.getTokenAt(n);v=t.Pos(n.line,q.start);q.start<n.ch&&/\w/.test(q.string.charAt(n.ch-q.start-1))?q=q.string.substr(0,n.ch-q.start):(q="",v=n);for(var x=
[],E=0;E<A.words.length;E++){var L=A.words[E];L.slice(0,q.length)==q&&x.push(L)}if(x.length)return{list:x,from:v,to:n}});t.commands.autocomplete=t.showHint;var R={hint:t.hint.auto,completeSingle:!0,alignWithWord:!0,closeCharacters:/[\s()\[\]{};:>,]/,closeOnPick:!0,closeOnUnfocus:!0,updateOnCursorActivity:!0,completeOnSingleClick:!0,container:null,customKeys:null,extraKeys:null,paddingForScrollbar:!0,moveOnOverlap:!0};t.defineOption("hintOptions",null)});(function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror"),require("../../mode/sql/sql")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../../mode/sql/sql"],t):t(CodeMirror)})(function(t){function K(y){return"[object Array]"==Object.prototype.toString.call(y)}function F(y,G){return y.getModeAt(y.getCursor()).config[G]||t.resolveMode("text/x-sql")[G]}function z(y){return"string"==typeof y?y:y.text}function w(y,G){K(G)&&(G={columns:G});G.text||
(G.text=y);return G}function B(y){return y?K(y)?y:[y]:[]}function I(y){var G={};if(K(y))for(var Q=y.length-1;0<=Q;Q--){var X=y[Q];G[z(X).toUpperCase()]=w(z(X),X)}else if(y)for(Q in y)G[Q.toUpperCase()]=w(Q,y[Q]);return G}function D(y){var G={},Q;for(Q in y)y.hasOwnProperty(Q)&&(G[Q]=y[Q]);return G}function M(y,G){var Q=y.length;G=z(G).substr(0,Q);return y.toUpperCase()===G.toUpperCase()}function R(y,G,Q,X){if(K(Q))for(var ea=0;ea<Q.length;ea++)M(G,Q[ea])&&y.push(X(Q[ea]));else for(ea in Q)if(Q.hasOwnProperty(ea)){var Z=
Q[ea];Z=Z&&!0!==Z?Z.displayText?{text:Z.text,displayText:Z.displayText}:Z.text:ea;M(G,Z)&&y.push(X(Z))}}function v(y){"."==y.charAt(0)&&(y=y.substr(1));y=y.split(fa+fa);for(var G=0;G<y.length;G++)y[G]=y[G].replace(new RegExp(fa,"g"),"");return y.join(fa)}function A(y){for(var G=z(y).split("."),Q=0;Q<G.length;Q++)G[Q]=fa+G[Q].replace(new RegExp(fa,"g"),fa+fa)+fa;G=G.join(".");if("string"==typeof y)return G;y=D(y);y.text=G;return y}function n(y,G,Q,X){for(var ea=!1,Z=[],S=G.start,ja=!0;ja;)ja="."==
G.string.charAt(0),ea=ea||G.string.charAt(0)==fa,S=G.start,Z.unshift(v(G.string)),G=X.getTokenAt(P(y.line,G.start)),"."==G.string&&(ja=!0,G=X.getTokenAt(P(y.line,G.start)));y=Z.join(".");R(Q,y,da,function(ka){return ea?A(ka):ka});R(Q,y,aa,function(ka){return ea?A(ka):ka});y=Z.pop();var Ba=Z.join("."),ia=!1,Pa=Ba;da[Ba.toUpperCase()]||(Z=Ba,Ba=L(Ba,X),Ba!==Z&&(ia=!0));(X=da[Ba.toUpperCase()])&&X.columns&&(X=X.columns);X&&R(Q,y,X,function(ka){var Ib=Ba;1==ia&&(Ib=Pa);"string"==typeof ka?ka=Ib+"."+ka:
(ka=D(ka),ka.text=Ib+"."+ka.text);return ea?A(ka):ka});return S}function q(y,G,Q,X,ea){G=Q.start+1;Q=x(y,Q.string);var Z=function(S,ja){"object"===typeof S?S.className=ja:S={text:S,className:ja};return S};"@"==y?R(X,Q,O,function(S){return Z(S,"CodeMirror-hint-table")}):"$"==y&&R(X,Q,J,function(S){return Z(S,"CodeMirror-hint-table")});return G}function x(y,G){G.charAt(0)==y&&(G=G.substr(1));return G}function E(y,G){y=y.split(/\s+/);for(var Q=0;Q<y.length;Q++)y[Q]&&G(y[Q].replace(/[`,;]/g,""))}function L(y,
G){var Q=G.doc,X=Q.getValue(),ea=y.toUpperCase(),Z="",S="";y=[];for(var ja=P(0,0),Ba=P(G.lastLine(),G.getLineHandle(G.lastLine()).length),ia=X.indexOf(za.QUERY_DIV);-1!=ia;)y.push(Q.posFromIndex(ia)),ia=X.indexOf(za.QUERY_DIV,ia+1);y.unshift(P(0,0));y.push(P(G.lastLine(),G.getLineHandle(G.lastLine()).text.length));X=null;ia=G.getCursor();for(G=0;G<y.length;G++){if((null==X||0<V(ia,X))&&0>=V(ia,y[G])){ja=X;Ba=y[G];break}X=y[G]}if(ja)for(Q=Q.getRange(ja,Ba,!1),G=0;G<Q.length&&(E(Q[G],function(Pa){var ka=
Pa.toUpperCase();ka===ea&&da[Z.toUpperCase()]&&(S=Z);ka!==za.ALIAS_KEYWORD&&(Z=Pa)}),!S);G++);return S}var O,J,da,aa,ta,fa,za={QUERY_DIV:";",ALIAS_KEYWORD:"AS"},P=t.Pos,V=t.cmpPos;t.registerHelper("hint","sql",function(y,G){O=B(y.options.atHintOptions&&y.options.atHintOptions.atVariables);J=B(y.options.dollarHintOptions&&y.options.dollarHintOptions.dollarVariables);da=I(G&&G.tables);var Q=G&&G.defaultTable;G=G&&G.disableKeywords;aa=Q&&da[Q.toUpperCase()];ta=F(y,"keywords")||[];fa=F(y,"identifierQuote")||
"`";Q&&!aa&&(aa=L(Q,y));aa=aa||[];aa.columns&&(aa=aa.columns);Q=y.getCursor();var X=[],ea=y.getTokenAt(Q);ea.end>Q.ch&&(ea.end=Q.ch,ea.string=ea.string.slice(0,Q.ch-ea.start));if(ea.string.match(/^[.`"'\w@$][\w$#]*$/g)){var Z=ea.string;var S=ea.start;var ja=ea.end}else S=ja=Q.ch,Z="";if("."==Z.charAt(0)||Z.charAt(0)==fa)S=n(Q,ea,X,y);else if("@"==Z.charAt(0))S=q("@",Q,ea,X,y);else if("$"==Z.charAt(0))S=q("$",Q,ea,X,y);else{var Ba=function(ia,Pa){"object"===typeof ia?ia.className=Pa:ia={text:ia,className:Pa};
return ia};R(X,Z,aa,function(ia){return Ba(ia,"CodeMirror-hint-table CodeMirror-hint-default-table")});R(X,Z,da,function(ia){return Ba(ia,"CodeMirror-hint-table")});G||R(X,Z,ta,function(ia){return Ba(ia.toUpperCase(),"CodeMirror-hint-keyword")})}return{list:X,from:P(Q.line,S),to:P(Q.line,ja)}})});(function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){function K(F){return function(z,w){function B(n){var q=w.ch;for(var x=0;;){var E=0>=q?-1:M.lastIndexOf(n[0],q-1);if(-1==E){if(1==x)break;x=1;q=M.length}else{if(1==x&&E<w.ch)break;q=z.getTokenTypeAt(t.Pos(D,E+1));if(!/^(comment|string)/.test(q))return{ch:E+1,tokenType:q,pair:n};q=E-1}}}function I(n){var q=
1,x=z.lastLine(),E=n.ch,L=D;a:for(;L<=x;++L)for(var O=z.getLine(L),J=L==D?E:0;;){var da=O.indexOf(n.pair[0],J);J=O.indexOf(n.pair[1],J);0>da&&(da=O.length);0>J&&(J=O.length);J=Math.min(da,J);if(J==O.length)break;if(z.getTokenTypeAt(t.Pos(L,J+1))==n.tokenType)if(J==da)++q;else if(!--q){var aa=L;var ta=J;break a}++J}return null==aa||D==aa?null:{from:t.Pos(D,E),to:t.Pos(aa,ta)}}for(var D=w.line,M=z.getLine(D),R=[],v=0;v<F.length;v++){var A=B(F[v]);A&&R.push(A)}R.sort(function(n,q){return n.ch-q.ch});
for(v=0;v<R.length;v++)if(A=I(R[v]))return A;return null}}t.registerHelper("fold","brace",K([["{","}"],["[","]"]]));t.registerHelper("fold","brace-paren",K([["{","}"],["[","]"],["(",")"]]));t.registerHelper("fold","import",function(F,z){function w(M){if(M<F.firstLine()||M>F.lastLine())return null;var R=F.getTokenAt(t.Pos(M,1));/\S/.test(R.string)||(R=F.getTokenAt(t.Pos(M,R.end+1)));if("keyword"!=R.type||"import"!=R.string)return null;var v=M;for(M=Math.min(F.lastLine(),M+10);v<=M;++v){var A=F.getLine(v).indexOf(";");
if(-1!=A)return{startCh:R.end,end:t.Pos(v,A)}}}z=z.line;var B=w(z),I;if(!B||w(z-1)||(I=w(z-2))&&I.end.line==z-1)return null;for(I=B.end;;){var D=w(I.line+1);if(null==D)break;I=D.end}return{from:F.clipPos(t.Pos(z,B.startCh+1)),to:I}});t.registerHelper("fold","include",function(F,z){function w(D){if(D<F.firstLine()||D>F.lastLine())return null;var M=F.getTokenAt(t.Pos(D,1));/\S/.test(M.string)||(M=F.getTokenAt(t.Pos(D,M.end+1)));if("meta"==M.type&&"#include"==M.string.slice(0,8))return M.start+8}z=z.line;
var B=w(z);if(null==B||null!=w(z-1))return null;for(var I=z;null!=w(I+1);)++I;return{from:t.Pos(z,B+1),to:F.clipPos(t.Pos(I))}})});(function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){t.registerGlobalHelper("fold","comment",function(K){return K.blockCommentStart&&K.blockCommentEnd},function(K,F){var z=K.getModeAt(F),w=z.blockCommentStart;z=z.blockCommentEnd;if(w&&z){for(var B=F.line,I=K.getLine(B),D=F.ch,M=0;;)if(D=0>=D?-1:I.lastIndexOf(w,D-1),-1==D){if(1==M)return;M=1;D=I.length}else{if(1==
M&&D<F.ch)return;if(/comment/.test(K.getTokenTypeAt(t.Pos(B,D+1)))&&(0==D||I.slice(D-z.length,D)==z||!/comment/.test(K.getTokenTypeAt(t.Pos(B,D))))){F=D+w.length;break}--D}I=1;M=K.lastLine();D=B;a:for(;D<=M;++D)for(var R=K.getLine(D),v=D==B?F:0;;){var A=R.indexOf(w,v);v=R.indexOf(z,v);0>A&&(A=R.length);0>v&&(v=R.length);v=Math.min(A,v);if(v==R.length)break;if(v==A)++I;else if(!--I){var n=D;var q=v;break a}++v}if(null!=n&&(B!=n||q!=F))return{from:t.Pos(B,F),to:t.Pos(n,q)}}})});(function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){function K(B,I,D,M){function R(E){var L=v(B,I);if(!L||L.to.line-L.from.line<A)return null;if("fold"===M)return L;for(var O=B.findMarksAt(L.from),J=0;J<O.length;++J)if(O[J].__isFold){if(!E)return null;L.cleared=!0;O[J].clear()}return L}if(D&&D.call){var v=D;D=null}else v=z(B,D,"rangeFinder");"number"==
typeof I&&(I=t.Pos(I,0));var A=z(B,D,"minFoldSize"),n=R(!0);if(z(B,D,"scanUp"))for(;!n&&I.line>B.firstLine();)I=t.Pos(I.line-1,0),n=R(!1);if(n&&!n.cleared&&"unfold"!==M){var q=F(B,D,n);t.on(q,"mousedown",function(E){x.clear();t.e_preventDefault(E)});var x=B.markText(n.from,n.to,{replacedWith:q,clearOnEnter:z(B,D,"clearOnEnter"),__isFold:!0});x.on("clear",function(E,L){t.signal(B,"unfold",B,E,L)});t.signal(B,"fold",B,n.from,n.to)}}function F(B,I,D){B=z(B,I,"widget");"function"==typeof B&&(B=B(D.from,
D.to));"string"==typeof B?(D=document.createTextNode(B),B=document.createElement("span"),B.appendChild(D),B.className="CodeMirror-foldmarker"):B&&(B=B.cloneNode(!0));return B}function z(B,I,D){return I&&void 0!==I[D]?I[D]:(B=B.options.foldOptions)&&void 0!==B[D]?B[D]:w[D]}t.newFoldFunction=function(B,I){return function(D,M){K(D,M,{rangeFinder:B,widget:I})}};t.defineExtension("foldCode",function(B,I,D){K(this,B,I,D)});t.defineExtension("isFolded",function(B){B=this.findMarksAt(B);for(var I=0;I<B.length;++I)if(B[I].__isFold)return!0});
t.commands.toggleFold=function(B){B.foldCode(B.getCursor())};t.commands.fold=function(B){B.foldCode(B.getCursor(),null,"fold")};t.commands.unfold=function(B){B.foldCode(B.getCursor(),{scanUp:!1},"unfold")};t.commands.foldAll=function(B){B.operation(function(){for(var I=B.firstLine(),D=B.lastLine();I<=D;I++)B.foldCode(t.Pos(I,0),{scanUp:!1},"fold")})};t.commands.unfoldAll=function(B){B.operation(function(){for(var I=B.firstLine(),D=B.lastLine();I<=D;I++)B.foldCode(t.Pos(I,0),{scanUp:!1},"unfold")})};
t.registerHelper("fold","combine",function(){var B=Array.prototype.slice.call(arguments,0);return function(I,D){for(var M=0;M<B.length;++M){var R=B[M](I,D);if(R)return R}}});t.registerHelper("fold","auto",function(B,I){for(var D=B.getHelpers(I,"fold"),M=0;M<D.length;M++){var R=D[M](B,I);if(R)return R}});var w={rangeFinder:t.fold.auto,widget:"\u2194",minFoldSize:0,scanUp:!1,clearOnEnter:!0};t.defineOption("foldOptions",null);t.defineExtension("foldOption",function(B,I){return z(this,B,I)})});(function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror"),require("./foldcode")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./foldcode"],t):t(CodeMirror)})(function(t){function K(n){this.options=n;this.from=this.to=0}function F(n,q){n=n.findMarks(A(q,0),A(q+1,0));for(var x=0;x<n.length;++x)if(n[x].__isFold){var E=n[x].find(-1);if(E&&E.line===q)return n[x]}}function z(n){if("string"==typeof n){var q=document.createElement("div");q.className=
n+" CodeMirror-guttermarker-subtle";return q}return n.cloneNode(!0)}function w(n,q,x){var E=n.state.foldGutter.options,L=q-1,O=n.foldOption(E,"minFoldSize"),J=n.foldOption(E,"rangeFinder"),da="string"==typeof E.indicatorFolded&&new RegExp("(^|\\s)"+E.indicatorFolded+"(?:$|\\s)\\s*"),aa="string"==typeof E.indicatorOpen&&new RegExp("(^|\\s)"+E.indicatorOpen+"(?:$|\\s)\\s*");n.eachLine(q,x,function(ta){++L;var fa=null,za=ta.gutterMarkers;za&&(za=za[E.gutter]);if(F(n,L)){if(da&&za&&da.test(za.className))return;
fa=z(E.indicatorFolded)}else{var P=A(L,0);if((P=J&&J(n,P))&&P.to.line-P.from.line>=O){if(aa&&za&&aa.test(za.className))return;fa=z(E.indicatorOpen)}}(fa||za)&&n.setGutterMarker(ta,E.gutter,fa)})}function B(n){var q=n.getViewport(),x=n.state.foldGutter;x&&(n.operation(function(){w(n,q.from,q.to)}),x.from=q.from,x.to=q.to)}function I(n,q,x){var E=n.state.foldGutter;E&&(E=E.options,x==E.gutter&&((x=F(n,q))?x.clear():n.foldCode(A(q,0),E)))}function D(n,q){"mode"==q&&M(n)}function M(n){var q=n.state.foldGutter;
if(q){var x=q.options;q.from=q.to=0;clearTimeout(q.changeUpdate);q.changeUpdate=setTimeout(function(){B(n)},x.foldOnChangeTimeSpan||600)}}function R(n){var q=n.state.foldGutter;if(q){var x=q.options;clearTimeout(q.changeUpdate);q.changeUpdate=setTimeout(function(){var E=n.getViewport();q.from==q.to||20<E.from-q.to||20<q.from-E.to?B(n):n.operation(function(){E.from<q.from&&(w(n,E.from,q.from),q.from=E.from);E.to>q.to&&(w(n,q.to,E.to),q.to=E.to)})},x.updateViewportTimeSpan||400)}}function v(n,q){var x=
n.state.foldGutter;x&&(q=q.line,q>=x.from&&q<x.to&&w(n,q,q+1))}t.defineOption("foldGutter",!1,function(n,q,x){x&&x!=t.Init&&(n.clearGutter(n.state.foldGutter.options.gutter),n.state.foldGutter=null,n.off("gutterClick",I),n.off("changes",M),n.off("viewportChange",R),n.off("fold",v),n.off("unfold",v),n.off("swapDoc",M),n.off("optionChange",D));q&&(x=n.state,!0===q&&(q={}),null==q.gutter&&(q.gutter="CodeMirror-foldgutter"),null==q.indicatorOpen&&(q.indicatorOpen="CodeMirror-foldgutter-open"),null==q.indicatorFolded&&
(q.indicatorFolded="CodeMirror-foldgutter-folded"),x.foldGutter=new K(q),B(n),n.on("gutterClick",I),n.on("changes",M),n.on("viewportChange",R),n.on("fold",v),n.on("unfold",v),n.on("swapDoc",M),n.on("optionChange",D))});var A=t.Pos});(function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){function K(F,z){var w=F.getLine(z),B=w.search(/\S/);return-1==B||/\bcomment\b/.test(F.getTokenTypeAt(t.Pos(z,B+1)))?-1:t.countColumn(w,null,F.getOption("tabSize"))}t.registerHelper("fold","indent",function(F,z){var w=K(F,z.line);if(!(0>w)){for(var B=null,I=z.line+1,D=F.lastLine();I<=D;++I){var M=K(F,I);
if(-1!=M)if(M>w)B=I;else break}if(B)return{from:t.Pos(z.line,F.getLine(z.line).length),to:t.Pos(B,F.getLine(B).length)}}})});(function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){t.registerHelper("fold","markdown",function(K,F){function z(A){return(A=K.getTokenTypeAt(t.Pos(A,0)))&&/\bheader\b/.test(A)}function w(A,n,q){return(n=n&&n.match(/^#+/))&&z(A)?n[0].length:(n=q&&q.match(/^[=\-]+\s*$/))&&z(A+1)?"="==q[0]?1:2:100}var B=K.getLine(F.line),I=K.getLine(F.line+1),D=w(F.line,B,
I);if(100!==D){for(var M=K.lastLine(),R=F.line,v=K.getLine(R+2);R<M&&!(w(R+1,I,v)<=D);)++R,I=v,v=K.getLine(R+2);return{from:t.Pos(F.line,B.length),to:t.Pos(R,K.getLine(R).length)}}})});(function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})(function(t){function K(n,q,x,E){this.line=q;this.ch=x;this.cm=n;this.text=n.getLine(q);this.min=E?Math.max(E.from,n.firstLine()):n.firstLine();this.max=E?Math.min(E.to-1,n.lastLine()):n.lastLine()}function F(n,q){return(n=n.cm.getTokenTypeAt(v(n.line,q)))&&/\btag\b/.test(n)}function z(n){if(!(n.line>=n.max))return n.ch=
0,n.text=n.cm.getLine(++n.line),!0}function w(n){if(!(n.line<=n.min))return n.text=n.cm.getLine(--n.line),n.ch=n.text.length,!0}function B(n){for(;;){var q=n.text.indexOf(">",n.ch);if(-1==q)if(z(n))continue;else break;if(F(n,q+1)){var x=n.text.lastIndexOf("/",q);x=-1<x&&!/\S/.test(n.text.slice(x+1,q));n.ch=q+1;return x?"selfClose":"regular"}n.ch=q+1}}function I(n){for(;;){var q=n.ch?n.text.lastIndexOf("<",n.ch-1):-1;if(-1==q)if(w(n))continue;else break;if(F(n,q+1)){A.lastIndex=q;n.ch=q;var x=A.exec(n.text);
if(x&&x.index==q)return x}else n.ch=q}}function D(n){for(;;){A.lastIndex=n.ch;var q=A.exec(n.text);if(!q)if(z(n))continue;else break;if(F(n,q.index+1))return n.ch=q.index+q[0].length,q;n.ch=q.index+1}}function M(n,q){for(var x=[];;){var E=D(n),L,O=n.line,J=n.ch-(E?E[0].length:0);if(!E||!(L=B(n)))break;if("selfClose"!=L)if(E[1]){for(var da=x.length-1;0<=da;--da)if(x[da]==E[2]){x.length=da;break}if(0>da&&(!q||q==E[2]))return{tag:E[2],from:v(O,J),to:v(n.line,n.ch)}}else x.push(E[2])}}function R(n,q){for(var x=
[];;){var E;a:for(E=n;;){var L=E.ch?E.text.lastIndexOf(">",E.ch-1):-1;if(-1==L)if(w(E))continue;else{E=void 0;break a}if(F(E,L+1)){var O=E.text.lastIndexOf("/",L);O=-1<O&&!/\S/.test(E.text.slice(O+1,L));E.ch=L+1;E=O?"selfClose":"regular";break a}else E.ch=L}if(!E)break;if("selfClose"==E)I(n);else{E=n.line;L=n.ch;O=I(n);if(!O)break;if(O[1])x.push(O[2]);else{for(var J=x.length-1;0<=J;--J)if(x[J]==O[2]){x.length=J;break}if(0>J&&(!q||q==O[2]))return{tag:O[2],from:v(n.line,n.ch),to:v(E,L)}}}}}var v=t.Pos,
A=RegExp("<(/?)([A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*)","g");t.registerHelper("fold","xml",function(n,q){for(n=new K(n,q.line,0);;){var x=D(n);if(!x||
n.line!=q.line)break;var E=B(n);if(!E)break;if(!x[1]&&"selfClose"!=E){q=v(n.line,n.ch);if(x=n=M(n,x[2]))x=n.from,x=0<(x.line-q.line||x.ch-q.ch);return x?{from:q,to:n.from}:null}}});t.findMatchingTag=function(n,q,x){var E=new K(n,q.line,q.ch,x);if(-1!=E.text.indexOf(">")||-1!=E.text.indexOf("<")){var L=B(E),O=L&&v(E.line,E.ch),J=L&&I(E);if(L&&J&&!(0<(E.line-q.line||E.ch-q.ch))){q={from:v(E.line,E.ch),to:O,tag:J[2]};if("selfClose"==L)return{open:q,close:null,at:"open"};if(J[1])return{open:R(E,J[2]),
close:q,at:"close"};E=new K(n,O.line,O.ch,x);return{open:q,close:M(E,J[2]),at:"open"}}}};t.findEnclosingTag=function(n,q,x,E){for(var L=new K(n,q.line,q.ch,x);;){var O=R(L,E);if(!O)break;var J=new K(n,q.line,q.ch,x);if(J=M(J,O.tag))return{open:O,close:J}}};t.scanForClosingTag=function(n,q,x,E){n=new K(n,q.line,q.ch,E?{from:0,to:E}:null);return M(n,x)}});
//qingVersionTag: 20250415