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