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