Software: Apache. PHP/8.1.30 uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root) Safe-mode: OFF (not secure) /home/picotech/domains/ecom1.picotech.app/public_html_ecom1/public/dist/plugins/codemirror/lib/ drwxr-xr-x |
Viewing file: Select action/file-type: (function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.CodeMirror=t()})(this,function(){'use strict';function e(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function t(t){for(var e=t.childNodes.length;0<e;--e)t.removeChild(t.firstChild);return t}function n(i,n){return t(i).appendChild(n)}function o(t,n,o,r){var l=document.createElement(t);if(o&&(l.className=o),r&&(l.style.cssText=r),"string"==typeof n)l.appendChild(document.createTextNode(n));else if(n)for(var e=0;e<n.length;++e)l.appendChild(n[e]);return l}function r(t,i,n,r){var l=o(t,i,n,r);return l.setAttribute("role","presentation"),l}function l(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do if(11==t.nodeType&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function s(){var t;try{t=document.activeElement}catch(i){t=document.body||null}for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t}function d(t,i){var n=t.className;e(i).test(n)||(t.className+=(n?" ":"")+i)}function a(t,n){for(var o=t.split(" "),r=0;r<o.length;r++)o[r]&&!e(o[r]).test(n)&&(n+=" "+o[r]);return n}function p(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function c(e,t,i){for(var n in t||(t={}),e)e.hasOwnProperty(n)&&(!1!==i||!t.hasOwnProperty(n))&&(t[n]=e[n]);return t}function h(e,t,o,r,l){null==t&&(t=e.search(/[^\s\u00a0]/),-1==t&&(t=e.length));for(var s=r||0,d=l||0,a;;){if(a=e.indexOf("\t",s),0>a||a>=t)return d+(t-s);d+=a-s,d+=o-d%o,s=a+1}}function g(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}function u(e,t,i){for(var n=0,o=0,r;;){r=e.indexOf("\t",n),-1==r&&(r=e.length);var l=r-n;if(r==e.length||o+l>=t)return n+Math.min(l,t-o);if(o+=r-n,o+=i-o%i,n=r+1,o>=t)return n}}function f(e){for(;Kl.length<=e;)Kl.push(y(Kl)+" ");return Kl[e]}function y(e){return e[e.length-1]}function x(e,t){for(var n=[],o=0;o<e.length;o++)n[o]=t(e[o],o);return n}function v(e,t,i){for(var n=0,o=i(t);n<e.length&&i(e[n])<=o;)n++;e.splice(n,0,t)}function b(){}function C(e,t){var i;return Object.create?i=Object.create(e):(b.prototype=e,i=new b),t&&c(t,i),i}function w(e){return /\w/.test(e)||"\x80"<e&&(e.toUpperCase()!=e.toLowerCase()||Xl.test(e))}function S(e,t){return t?!!(-1<t.source.indexOf("\\w")&&w(e))||t.test(e):w(e)}function L(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function k(e){return 768<=e.charCodeAt(0)&&Yl.test(e)}function T(e,t,i){for(;(0>i?0<t:t<e.length)&&k(e.charAt(t));)t+=i;return t}function N(e,t,i){for(var n=t>i?-1:1;;){if(t==i)return t;var o=(t+i)/2,r=0>n?Math.ceil(o):Math.floor(o);if(r==t)return e(r)?t:i;e(r)?i=r:t=r+n}}function O(e,t,n,o){if(!e)return o(t,n,"ltr",0);for(var r=!1,l=0,s;l<e.length;++l)s=e[l],(s.from<n&&s.to>t||t==n&&s.to==t)&&(o(Math.max(s.from,t),Math.min(s.to,n),1==s.level?"rtl":"ltr",l),r=!0);r||o(t,n,"ltr")}function A(e,t,n){var o;_l=null;for(var r=0,l;r<e.length;++r){if(l=e[r],l.from<t&&l.to>t)return r;l.to==t&&(l.from!=l.to&&"before"==n?o=r:_l=r),l.from==t&&(l.from!=l.to&&"before"!=n?o=r:_l=r)}return null==o?_l:o}function M(e,t){var i=e.order;return null==i&&(i=e.order=ql(e.text,t)),i}function W(e,t){return e._handlers&&e._handlers[t]||Zl}function D(e,t,i){if(e.removeEventListener)e.removeEventListener(t,i,!1);else if(e.detachEvent)e.detachEvent("on"+t,i);else{var n=e._handlers,o=n&&n[t];if(o){var r=g(o,i);-1<r&&(n[t]=o.slice(0,r).concat(o.slice(r+1)))}}}function H(e,t){var n=W(e,t);if(n.length)for(var o=Array.prototype.slice.call(arguments,2),r=0;r<n.length;++r)n[r].apply(null,o)}function F(t,i,n){return"string"==typeof i&&(i={type:i,preventDefault:function(){this.defaultPrevented=!0}}),H(t,n||i.type,t,i),B(i)||i.codemirrorIgnore}function P(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),o=0;o<t.length;++o)-1==g(n,t[o])&&n.push(t[o])}function I(e,t){return 0<W(e,t).length}function z(e){e.prototype.on=function(e,t){Ql(this,e,t)},e.prototype.off=function(e,t){D(this,e,t)}}function E(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function R(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}function B(t){return null==t.defaultPrevented?!1==t.returnValue:t.defaultPrevented}function G(t){E(t),R(t)}function U(t){return t.target||t.srcElement}function $(t){var e=t.which;return null==e&&(1&t.button?e=1:2&t.button?e=3:4&t.button&&(e=2)),Dl&&t.ctrlKey&&1==e&&(e=3),e}function j(e){if(null==ls){var t=o("span","\u200B");n(e,o("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(ls=1>=t.offsetWidth&&2<t.offsetHeight&&!(Sl&&8>ie))}var i=ls?o("span","\u200B"):o("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}function V(e){if(null!=ss)return ss;var i=n(e,document.createTextNode("A\u062EA")),o=Rl(i,0,1).getBoundingClientRect(),r=Rl(i,1,2).getBoundingClientRect();return t(e),!!(o&&o.left!=o.right)&&(ss=3>r.right-o.right)}function K(e){if(null!=ts)return ts;var t=n(e,o("span","x")),i=t.getBoundingClientRect(),r=Rl(t,0,1).getBoundingClientRect();return ts=1<Math.abs(i.left-r.left)}function X(e,t){2<arguments.length&&(t.dependencies=Array.prototype.slice.call(arguments,2)),is[e]=t}function Y(e){if("string"==typeof e&&ns.hasOwnProperty(e))e=ns[e];else if(e&&"string"==typeof e.name&&ns.hasOwnProperty(e.name)){var t=ns[e.name];"string"==typeof t&&(t={name:t}),e=C(t,e),e.name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Y("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Y("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function _(e,t){t=Y(t);var i=is[t.name];if(!i)return _(e,"text/plain");var n=i(e,t);if(os.hasOwnProperty(t.name)){var o=os[t.name];for(var r in o)o.hasOwnProperty(r)&&(n.hasOwnProperty(r)&&(n["_"+r]=n[r]),n[r]=o[r])}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var l in t.modeProps)n[l]=t.modeProps[l];return n}function q(e,t){var i=os.hasOwnProperty(e)?os[e]:os[e]={};c(t,i)}function Z(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var i={};for(var o in t){var n=t[o];n instanceof Array&&(n=n.concat([])),i[o]=n}return i}function Q(e,t){for(var i;e.innerMode&&(i=e.innerMode(t),i&&i.mode!=e);)t=i.state,e=i.mode;return i||{mode:e,state:t}}function J(e,t,i){return!e.startState||e.startState(t,i)}function ee(e,t){if(t-=e.first,0>t||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var o=e;!o.lines;)for(var r=0;;++r){var l=o.children[r],s=l.chunkSize();if(t<s){o=l;break}t-=s}return o.lines[t]}function te(e,t,i){var o=[],r=t.line;return e.iter(t.line,i.line+1,function(e){var n=e.text;r==i.line&&(n=n.slice(0,i.ch)),r==t.line&&(n=n.slice(t.ch)),o.push(n),++r}),o}function ne(e,t,i){var n=[];return e.iter(t,i,function(e){n.push(e.text)}),n}function oe(e,t){var i=t-e.height;if(i)for(var o=e;o;o=o.parent)o.height+=i}function re(e){if(null==e.parent)return null;for(var t=e.parent,n=g(t.lines,e),o=t.parent;o;t=o,o=o.parent)for(var r=0;;++r){if(o.children[r]==t)break;n+=o.children[r].chunkSize()}return n+t.first}function le(e,t){var o=e.first;outer:do{for(var r=0;r<e.children.length;++r){var l=e.children[r],s=l.height;if(t<s){e=l;continue outer}t-=s,o+=l.chunkSize()}return o}while(!e.lines);for(var d=0;d<e.lines.length;++d){var a=e.lines[d],p=a.height;if(t<p)break;t-=p}return o+d}function se(e,t){return t>=e.first&&t<e.first+e.size}function de(e,t){return e.lineNumberFormatter(t+e.firstLineNumber)+""}function ae(e,t,i){return void 0===i&&(i=null),this instanceof ae?void(this.line=e,this.ch=t,this.sticky=i):new ae(e,t,i)}function pe(e,t){return e.line-t.line||e.ch-t.ch}function ce(e,t){return e.sticky==t.sticky&&0==pe(e,t)}function he(e){return ae(e.line,e.ch)}function ge(e,t){return 0>pe(e,t)?t:e}function ue(e,t){return 0>pe(e,t)?e:t}function fe(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function me(e,t){if(t.line<e.first)return ae(e.first,0);var i=e.first+e.size-1;return t.line>i?ae(i,ee(e,i).text.length):ye(t,ee(e,t.line).text.length)}function ye(e,t){var i=e.ch;return null==i||i>t?ae(e.line,t):0>i?ae(e.line,0):e}function xe(e,t){for(var n=[],o=0;o<t.length;o++)n[o]=me(e,t[o]);return n}function ve(e,t,n,r){var l=[e.state.modeGen],s={};Ne(e,t.text,e.doc.mode,n,function(e,t){return l.push(e,t)},s,r);for(var d=n.state,a=function(r){n.baseTokens=l;var o=e.state.overlays[r],a=1,p=0;n.state=!0,Ne(e,t.text,o.mode,n,function(e,t){for(var i=a,n;p<e;)n=l[a],n>e&&l.splice(a,1,e,l[a+1],n),a+=2,p=Math.min(e,n);if(t)if(o.opaque)l.splice(i,a-i,e,"overlay "+t),a=i+2;else for(;i<a;i+=2){var r=l[i+1];l[i+1]=(r?r+" ":"")+"overlay "+t}},s),n.state=d,n.baseTokens=null,n.baseTokenPos=1},p=0;p<e.state.overlays.length;++p)a(p);return{styles:l,classes:s.bgClass||s.textClass?s:null}}function be(e,t,i){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=Ce(e,re(t)),o=t.text.length>e.options.maxHighlightLength&&Z(e.doc.mode,n.state),r=ve(e,t,n);o&&(n.state=o),t.stateAfter=n.save(!o),t.styles=r.styles,r.classes?t.styleClasses=r.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Ce(e,t,i){var n=e.doc,o=e.display;if(!n.mode.startState)return new as(n,!0,t);var r=Oe(e,t,i),l=r>n.first&&ee(n,r-1).stateAfter,s=l?as.fromSaved(n,l,r):new as(n,J(n.mode),r);return n.iter(r,t,function(i){we(e,i.text,s);var n=s.line;i.stateAfter=n==t-1||0==n%5||n>=o.viewFrom&&n<o.viewTo?s.save():null,s.nextLine()}),i&&(n.modeFrontier=s.line),s}function we(e,t,i,n){var o=e.doc.mode,r=new rs(t,e.options.tabSize,i);for(r.start=r.pos=n||0,""==t&&Se(o,i.state);!r.eol();)Le(o,r,i.state),r.start=r.pos}function Se(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var i=Q(e,t);if(i.mode.blankLine)return i.mode.blankLine(i.state)}}function Le(e,t,n,o){for(var r=0;10>r;r++){o&&(o[0]=Q(e,n).mode);var l=e.token(t,n);if(t.pos>t.start)return l}throw new Error("Mode "+e.name+" failed to advance stream.")}function ke(e,t,i,n){var o=e.doc,r=o.mode,l;t=me(o,t);var s=ee(o,t.line),d=Ce(e,t.line,i),a=new rs(s.text,e.options.tabSize,d),p;for(n&&(p=[]);(n||a.pos<t.ch)&&!a.eol();)a.start=a.pos,l=Le(r,a,d.state),n&&p.push(new ps(a,l,Z(o.mode,d.state)));return n?p:new ps(a,l,d.state)}function Te(e,t){if(e)for(;;){var i=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!i)break;e=e.slice(0,i.index)+e.slice(i.index+i[0].length);var n=i[1]?"bgClass":"textClass";null==t[n]?t[n]=i[2]:!new RegExp("(?:^|\\s)"+i[2]+"(?:$|\\s)").test(t[n])&&(t[n]+=" "+i[2])}return e}function Ne(e,t,i,n,o,r,l){var s=i.flattenSpans;null==s&&(s=e.options.flattenSpans);var d=0,a=null,p=new rs(t,e.options.tabSize,n),c=e.options.addModeClass&&[null],h;for(""==t&&Te(Se(i,n.state),r);!p.eol();){if(p.pos>e.options.maxHighlightLength?(s=!1,l&&we(e,t,n,p.pos),p.pos=t.length,h=null):h=Te(Le(i,p,n.state,c),r),c){var g=c[0].name;g&&(h="m-"+(h?g+" "+h:g))}if(!s||a!=h){for(;d<p.start;)d=Math.min(p.start,d+5e3),o(d,a);a=h}p.start=p.pos}for(;d<p.pos;){var u=Math.min(p.pos,d+5e3);o(u,a),d=u}}function Oe(e,t,i){for(var n=e.doc,o=i?-1:t-(e.doc.mode.innerMode?1e3:100),r=t,l,s;r>o;--r){if(r<=n.first)return n.first;var d=ee(n,r-1),a=d.stateAfter;if(a&&(!i||r+(a instanceof ds?a.lookAhead:0)<=n.modeFrontier))return r;var p=h(d.text,null,e.options.tabSize);(null==s||l>p)&&(s=r-1,l=p)}return s}function Ae(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var i=e.first,n=t-1,o;n>i;n--)if(o=ee(e,n).stateAfter,o&&(!(o instanceof ds)||n+o.lookAhead<t)){i=n+1;break}e.highlightFrontier=Math.min(e.highlightFrontier,i)}}function Me(){cs=!0}function We(){hs=!0}function De(e,t,i){this.marker=e,this.from=t,this.to=i}function He(e,t){if(e)for(var n=0,o;n<e.length;++n)if(o=e[n],o.marker==t)return o}function Fe(e,t){for(var n=0,o;n<e.length;++n)e[n]!=t&&(o||(o=[])).push(e[n]);return o}function Pe(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Ie(e,t,n){var o;if(e)for(var r=0;r<e.length;++r){var l=e[r],s=l.marker,d=null==l.from||(s.inclusiveLeft?l.from<=t:l.from<t);if(d||l.from==t&&"bookmark"==s.type&&(!n||!l.marker.insertLeft)){var a=null==l.to||(s.inclusiveRight?l.to>=t:l.to>t);(o||(o=[])).push(new De(s,l.from,a?null:l.to))}}return o}function ze(e,t,n){var o;if(e)for(var r=0;r<e.length;++r){var l=e[r],s=l.marker,d=null==l.to||(s.inclusiveRight?l.to>=t:l.to>t);if(d||l.from==t&&"bookmark"==s.type&&(!n||l.marker.insertLeft)){var a=null==l.from||(s.inclusiveLeft?l.from<=t:l.from<t);(o||(o=[])).push(new De(s,a?null:l.from-t,null==l.to?null:l.to-t))}}return o}function Ee(e,t){if(t.full)return null;var n=se(e,t.from.line)&&ee(e,t.from.line).markedSpans,o=se(e,t.to.line)&&ee(e,t.to.line).markedSpans;if(!n&&!o)return null;var r=t.from.ch,l=t.to.ch,s=0==pe(t.from,t.to),d=Ie(n,r,s),a=ze(o,l,s),p=1==t.text.length,c=y(t.text).length+(p?r:0);if(d)for(var h=0,g;h<d.length;++h)if(g=d[h],null==g.to){var u=He(a,g.marker);u?p&&(g.to=null==u.to?null:u.to+c):g.to=r}if(a)for(var f=0,m;f<a.length;++f)if(m=a[f],null!=m.to&&(m.to+=c),null==m.from){var x=He(d,m.marker);x||(m.from=c,p&&(d||(d=[])).push(m))}else m.from+=c,p&&(d||(d=[])).push(m);d&&(d=Re(d)),a&&a!=d&&(a=Re(a));var v=[d];if(!p){var b=t.text.length-2,C;if(0<b&&d)for(var w=0;w<d.length;++w)null==d[w].to&&(C||(C=[])).push(new De(d[w].marker,null,null));for(var S=0;S<b;++S)v.push(C);v.push(a)}return v}function Re(e){for(var t=0,n;t<e.length;++t)n=e[t],null!=n.from&&n.from==n.to&&!1!==n.marker.clearWhenEmpty&&e.splice(t--,1);return e.length?e:null}function Be(e,t,n){var o=null;if(e.iter(t.line,n.line+1,function(e){if(e.markedSpans)for(var t=0,n;t<e.markedSpans.length;++t)n=e.markedSpans[t].marker,n.readOnly&&(!o||-1==g(o,n))&&(o||(o=[])).push(n)}),!o)return null;for(var r=[{from:t,to:n}],l=0;l<o.length;++l)for(var s=o[l],d=s.find(0),a=0,c;a<r.length;++a)if(c=r[a],!(0>pe(c.to,d.from)||0<pe(c.from,d.to))){var h=[a,1],u=pe(c.from,d.from),f=pe(c.to,d.to);!(0>u)&&(s.inclusiveLeft||u)||h.push({from:c.from,to:d.from}),!(0<f)&&(s.inclusiveRight||f)||h.push({from:d.to,to:c.to}),r.splice.apply(r,h),a+=h.length-3}return r}function Ge(e){var t=e.markedSpans;if(t){for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}}function Ue(e,t){if(t){for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}}function $e(e){return e.inclusiveLeft?-1:0}function je(e){return e.inclusiveRight?1:0}function Ve(e,t){var i=e.lines.length-t.lines.length;if(0!=i)return i;var n=e.find(),o=t.find(),r=pe(n.from,o.from)||$e(e)-$e(t);if(r)return-r;var l=pe(n.to,o.to)||je(e)-je(t);return l?l:t.id-e.id}function Ke(e,t){var n=hs&&e.markedSpans,o;if(n)for(var r=void 0,l=0;l<n.length;++l)r=n[l],r.marker.collapsed&&null==(t?r.from:r.to)&&(!o||0>Ve(o,r.marker))&&(o=r.marker);return o}function Xe(e){return Ke(e,!0)}function Ye(e){return Ke(e,!1)}function _e(e,t){var n=hs&&e.markedSpans,o;if(n)for(var r=0,l;r<n.length;++r)l=n[r],l.marker.collapsed&&(null==l.from||l.from<t)&&(null==l.to||l.to>t)&&(!o||0>Ve(o,l.marker))&&(o=l.marker);return o}function qe(e,t,n,o,r){var l=ee(e,t),s=hs&&l.markedSpans;if(s)for(var d=0,a;d<s.length;++d)if(a=s[d],!!a.marker.collapsed){var p=a.marker.find(0),c=pe(p.from,n)||$e(a.marker)-$e(r),h=pe(p.to,o)||je(a.marker)-je(r);if(!(0<=c&&0>=h||0>=c&&0<=h)&&(0>=c&&(a.marker.inclusiveRight&&r.inclusiveLeft?0<=pe(p.to,n):0<pe(p.to,n))||0<=c&&(a.marker.inclusiveRight&&r.inclusiveLeft?0>=pe(p.from,o):0>pe(p.from,o))))return!0}}function Ze(e){for(var t;t=Xe(e);)e=t.find(-1,!0).line;return e}function Qe(e){for(var t;t=Ye(e);)e=t.find(1,!0).line;return e}function Je(e){for(var t,i;t=Ye(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function et(e,t){var i=ee(e,t),n=Ze(i);return i==n?t:re(n)}function tt(e,t){if(t>e.lastLine())return t;var i=ee(e,t),n;if(!it(e,i))return t;for(;n=Ye(i);)i=n.find(1,!0).line;return re(i)+1}function it(e,t){var n=hs&&t.markedSpans;if(n)for(var o=void 0,r=0;r<n.length;++r)if(o=n[r],!!o.marker.collapsed){if(null==o.from)return!0;if(!o.marker.widgetNode&&0==o.from&&o.marker.inclusiveLeft&&nt(e,t,o))return!0}}function nt(e,t,n){if(null==n.to){var o=n.marker.find(1,!0);return nt(e,o.line,He(o.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var r=void 0,l=0;l<t.markedSpans.length;++l)if(r=t.markedSpans[l],r.marker.collapsed&&!r.marker.widgetNode&&r.from==n.to&&(null==r.to||r.to!=n.from)&&(r.marker.inclusiveLeft||n.marker.inclusiveRight)&&nt(e,t,r))return!0}function ot(e){e=Ze(e);for(var t=0,n=e.parent,o=0,r;o<n.lines.length&&(r=n.lines[o],r!=e);++o)t+=r.height;for(var l=n.parent;l;n=l,l=n.parent)for(var s=0,d;s<l.children.length&&(d=l.children[s],d!=n);++s)t+=d.height;return t}function rt(e){if(0==e.height)return 0;for(var t=e.text.length,i=e,n,o;n=Xe(i);)o=n.find(0,!0),i=o.from.line,t+=o.from.ch-o.to.ch;for(i=e;n=Ye(i);){var r=n.find(0,!0);t-=i.text.length-r.from.ch,i=r.to.line,t+=i.text.length-r.to.ch}return t}function lt(e){var t=e.display,i=e.doc;t.maxLine=ee(i,i.first),t.maxLineLength=rt(t.maxLine),t.maxLineChanged=!0,i.iter(function(e){var i=rt(e);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=e)})}function st(e,t,i,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),Ge(e),Ue(e,i);var o=n?n(e):1;o!=e.height&&oe(e,o)}function dt(e){e.parent=null,Ge(e)}function pt(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?fs:us;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function ct(e,t){var n=r("span",null,null,at?"padding-right: .1px":null),o={pre:r("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var l=0;l<=(t.rest?t.rest.length:0);l++){var s=l?t.rest[l-1]:t.line,d=void 0;o.pos=0,o.addToken=gt,V(e.display.measure)&&(d=M(s,e.doc.direction))&&(o.addToken=ft(o.addToken,d)),o.map=[];var p=t!=e.display.externalMeasured&&re(s);yt(s,o,be(e,s,p)),s.styleClasses&&(s.styleClasses.bgClass&&(o.bgClass=a(s.styleClasses.bgClass,o.bgClass||"")),s.styleClasses.textClass&&(o.textClass=a(s.styleClasses.textClass,o.textClass||""))),0==o.map.length&&o.map.push(0,0,o.content.appendChild(j(e.display.measure))),0==l?(t.measure.map=o.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(o.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(at){var c=o.content.lastChild;(/\bcm-tab\b/.test(c.className)||c.querySelector&&c.querySelector(".cm-tab"))&&(o.content.className="cm-tab-wrap-hack")}return H(e,"renderLine",e,t.line,o.pre),o.pre.className&&(o.textClass=a(o.pre.className,o.textClass||"")),o}function ht(e){var t=o("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function gt(e,t,i,n,r,l,s){if(t){var d=e.splitSpaces?ut(t,e.trailingSpace):t,a=e.cm.state.specialChars,p=!1,c;if(!a.test(t))e.col+=t.length,c=document.createTextNode(d),e.map.push(e.pos,e.pos+t.length,c),Sl&&9>ie&&(p=!0),e.pos+=t.length;else{c=document.createDocumentFragment();for(var h=0;;){a.lastIndex=h;var g=a.exec(t),u=g?g.index-h:t.length-h;if(u){var m=document.createTextNode(d.slice(h,h+u));Sl&&9>ie?c.appendChild(o("span",[m])):c.appendChild(m),e.map.push(e.pos,e.pos+u,m),e.col+=u,e.pos+=u}if(!g)break;h+=u+1;var y=void 0;if("\t"==g[0]){var x=e.cm.options.tabSize,v=x-e.col%x;y=c.appendChild(o("span",f(v),"cm-tab")),y.setAttribute("role","presentation"),y.setAttribute("cm-text","\t"),e.col+=v}else"\r"==g[0]||"\n"==g[0]?(y=c.appendChild(o("span","\r"==g[0]?"\u240D":"\u2424","cm-invalidchar")),y.setAttribute("cm-text",g[0]),e.col+=1):(y=e.cm.options.specialCharPlaceholder(g[0]),y.setAttribute("cm-text",g[0]),Sl&&9>ie?c.appendChild(o("span",[y])):c.appendChild(y),e.col+=1);e.map.push(e.pos,e.pos+1,y),e.pos++}}if(e.trailingSpace=32==d.charCodeAt(t.length-1),i||n||r||p||l){var b=i||"";n&&(b+=n),r&&(b+=r);var C=o("span",[c],b,l);if(s)for(var w in s)s.hasOwnProperty(w)&&"style"!=w&&"class"!=w&&C.setAttribute(w,s[w]);return e.content.appendChild(C)}e.content.appendChild(c)}}function ut(e,t){if(1<e.length&&!/ /.test(e))return e;for(var n=t,o="",r=0,l;r<e.length;r++)l=e.charAt(r)," "==l&&n&&(r==e.length-1||32==e.charCodeAt(r+1))&&(l="\xA0"),o+=l,n=" "==l;return o}function ft(e,t){return function(n,o,r,l,s,d,a){r=r?r+" cm-force-border":"cm-force-border";for(var p=n.pos,c=p+o.length;;){for(var h=void 0,g=0;g<t.length&&(h=t[g],!(h.to>p&&h.from<=p));g++);if(h.to>=c)return e(n,o,r,l,s,d,a);e(n,o.slice(0,h.to-p),r,l,null,d,a),l=null,o=o.slice(h.to-p),p=h.to}}}function mt(e,t,i,n){var o=!n&&i.widgetNode;o&&e.map.push(e.pos,e.pos+t,o),!n&&e.cm.display.input.needsContentAttribute&&(!o&&(o=e.content.appendChild(document.createElement("span"))),o.setAttribute("cm-marker",i.id)),o&&(e.cm.display.input.setUneditable(o),e.content.appendChild(o)),e.pos+=t,e.trailingSpace=!1}function yt(e,t,n){var o=e.markedSpans,r=e.text,l=0;if(!o){for(var s=1;s<n.length;s+=2)t.addToken(t,r.slice(l,l=n[s]),pt(n[s+1],t.cm.options));return}for(var d=r.length,a=0,p=1,c="",h=0,g,u,f,y,x,v,b;;){if(h==a){f=y=x=u="",b=null,v=null,h=1/0;for(var C=[],w=void 0,S=0;S<o.length;++S){var L=o[S],k=L.marker;if("bookmark"==k.type&&L.from==a&&k.widgetNode)C.push(k);else if(L.from<=a&&(null==L.to||L.to>a||k.collapsed&&L.to==a&&L.from==a)){if(null!=L.to&&L.to!=a&&h>L.to&&(h=L.to,y=""),k.className&&(f+=" "+k.className),k.css&&(u=(u?u+";":"")+k.css),k.startStyle&&L.from==a&&(x+=" "+k.startStyle),k.endStyle&&L.to==h&&(w||(w=[])).push(k.endStyle,L.to),k.title&&((b||(b={})).title=k.title),k.attributes)for(var m in k.attributes)(b||(b={}))[m]=k.attributes[m];k.collapsed&&(!v||0>Ve(v.marker,k))&&(v=L)}else L.from>a&&h>L.from&&(h=L.from)}if(w)for(var T=0;T<w.length;T+=2)w[T+1]==h&&(y+=" "+w[T]);if(!v||v.from==a)for(var N=0;N<C.length;++N)mt(t,0,C[N]);if(v&&(v.from||0)==a){if(mt(t,(null==v.to?d+1:v.to)-a,v.marker,null==v.from),null==v.to)return;v.to==a&&(v=!1)}}if(a>=d)break;for(var O=Math.min(d,h);;){if(c){var A=a+c.length;if(!v){var M=A>O?c.slice(0,O-a):c;t.addToken(t,M,g?g+f:f,x,a+M.length==h?y:"",u,b)}if(A>=O){c=c.slice(O-a),a=O;break}a=A,x=""}c=r.slice(l,l=n[p++]),g=pt(n[p++],t.cm.options)}}}function xt(e,t,i){this.line=t,this.rest=Je(t),this.size=this.rest?re(y(this.rest))-i+1:1,this.node=this.text=null,this.hidden=it(e,t)}function vt(e,t,i){for(var n=[],o=t,r,l;o<i;o=r)l=new xt(e.doc,ee(e.doc,o),o),r=o+l.size,n.push(l);return n}function bt(e){ms?ms.ops.push(e):e.ownsGroup=ms={ops:[e],delayedCallbacks:[]}}function Ct(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var o=0,r;o<e.ops.length;o++)if(r=e.ops[o],r.cursorActivityHandlers)for(;r.cursorActivityCalled<r.cursorActivityHandlers.length;)r.cursorActivityHandlers[r.cursorActivityCalled++].call(null,r.cm)}while(n<t.length)}function wt(e,t){var i=e.ownsGroup;if(i)try{Ct(i)}finally{ms=null,t(i)}}function St(e,t){var n=W(e,t);if(n.length){var o=Array.prototype.slice.call(arguments,2),r;ms?r=ms.delayedCallbacks:ys?r=ys:(r=ys=[],setTimeout(Lt,0));for(var l=function(e){r.push(function(){return n[e].apply(null,o)})},s=0;s<n.length;++s)l(s)}}function Lt(){var e=ys;ys=null;for(var t=0;t<e.length;++t)e[t]()}function kt(e,t,i,n){for(var o=0,r;o<t.changes.length;o++)r=t.changes[o],"text"==r?At(e,t):"gutter"==r?Wt(e,t,i,n):"class"==r?Mt(e,t):"widget"==r&&Dt(e,t,n);t.changes=null}function Tt(e){return e.node==e.text&&(e.node=o("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),Sl&&8>ie&&(e.node.style.zIndex=2)),e.node}function Nt(e,t){var i=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(i&&(i+=" CodeMirror-linebackground"),t.background)i?t.background.className=i:(t.background.parentNode.removeChild(t.background),t.background=null);else if(i){var n=Tt(t);t.background=n.insertBefore(o("div",null,i),n.firstChild),e.display.input.setUneditable(t.background)}}function Ot(e,t){var i=e.display.externalMeasured;return i&&i.line==t.line?(e.display.externalMeasured=null,t.measure=i.measure,i.built):ct(e,t)}function At(e,t){var i=t.text.className,n=Ot(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,Mt(e,t)):i&&(t.text.className=i)}function Mt(e,t){Nt(e,t),t.line.wrapClass?Tt(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var i=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=i||""}function Wt(e,t,i,n){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var r=Tt(t);t.gutterBackground=o("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),r.insertBefore(t.gutterBackground,t.text)}var l=t.line.gutterMarkers;if(e.options.lineNumbers||l){var s=Tt(t),d=t.gutter=o("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(d),s.insertBefore(d,t.text),t.line.gutterClass&&(d.className+=" "+t.line.gutterClass),!e.options.lineNumbers||l&&l["CodeMirror-linenumbers"]||(t.lineNumber=d.appendChild(o("div",de(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),l)for(var a=0;a<e.display.gutterSpecs.length;++a){var p=e.display.gutterSpecs[a].className,c=l.hasOwnProperty(p)&&l[p];c&&d.appendChild(o("div",[c],"CodeMirror-gutter-elt","left: "+n.gutterLeft[p]+"px; width: "+n.gutterWidth[p]+"px"))}}}function Dt(t,i,n){i.alignable&&(i.alignable=null);for(var o=e("CodeMirror-linewidget"),r=i.node.firstChild,l=void 0;r;r=l)l=r.nextSibling,o.test(r.className)&&i.node.removeChild(r);Ft(t,i,n)}function Ht(e,t,i,n){var o=Ot(e,t);return t.text=t.node=o.pre,o.bgClass&&(t.bgClass=o.bgClass),o.textClass&&(t.textClass=o.textClass),Mt(e,t),Wt(e,t,i,n),Ft(e,t,n),t.node}function Ft(e,t,n){if(Pt(e,t.line,t,n,!0),t.rest)for(var o=0;o<t.rest.length;o++)Pt(e,t.rest[o],t,n,!1)}function Pt(e,t,n,r,l){if(t.widgets)for(var s=Tt(n),d=0,a=t.widgets;d<(void 0).length;++d){var p=(void 0)[d],c=o("div",[p.node],"CodeMirror-linewidget"+(p.className?" "+p.className:""));p.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),It(p,c,n,r),e.display.input.setUneditable(c),l&&p.above?s.insertBefore(c,n.gutter||n.text):s.appendChild(c),St(p,"redraw")}}function It(e,t,i,n){if(e.noHScroll){(i.alignable||(i.alignable=[])).push(t);var o=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(o-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=o+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",!e.noHScroll&&(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function zt(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!l(document.body,e.node)){var i="position: relative;";e.coverGutter&&(i+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(i+="width: "+t.display.wrapper.clientWidth+"px;"),n(t.display.measure,o("div",[e.node],null,i))}return e.height=e.node.parentNode.offsetHeight}function Et(t,i){for(var e=U(i);e!=t.wrapper;e=e.parentNode)if(!e||1==e.nodeType&&"true"==e.getAttribute("cm-ignore-events")||e.parentNode==t.sizer&&e!=t.mover)return!0}function Rt(e){return e.lineSpace.offsetTop}function Bt(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Gt(t){if(t.cachedPaddingH)return t.cachedPaddingH;var i=n(t.measure,o("pre","x","CodeMirror-line-like")),e=window.getComputedStyle?window.getComputedStyle(i):i.currentStyle,r={left:parseInt(e.paddingLeft),right:parseInt(e.paddingRight)};return isNaN(r.left)||isNaN(r.right)||(t.cachedPaddingH=r),r}function Ut(e){return 50-e.display.nativeBarWidth}function $t(e){return e.display.scroller.clientWidth-Ut(e)-e.display.barWidth}function jt(e){return e.display.scroller.clientHeight-Ut(e)-e.display.barHeight}function Vt(e,t,n){var o=e.options.lineWrapping,r=o&&$t(e);if(!t.measure.heights||o&&t.measure.width!=r){var l=t.measure.heights=[];if(o){t.measure.width=r;for(var s=t.text.firstChild.getClientRects(),d=0;d<s.length-1;d++){var a=s[d],p=s[d+1];2<Math.abs(a.bottom-p.bottom)&&l.push((a.bottom+p.top)/2-n.top)}}l.push(n.bottom-n.top)}}function Kt(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var o=0;o<e.rest.length;o++)if(e.rest[o]==t)return{map:e.measure.maps[o],cache:e.measure.caches[o]};for(var r=0;r<e.rest.length;r++)if(re(e.rest[r])>n)return{map:e.measure.maps[r],cache:e.measure.caches[r],before:!0}}function Xt(e,t){t=Ze(t);var i=re(t),o=e.display.externalMeasured=new xt(e.doc,t,i);o.lineN=i;var r=o.built=ct(e,o);return o.text=r.pre,n(e.display.lineMeasure,r.pre),o}function Yt(e,t,i,n){return Zt(e,qt(e,t),i,n)}function _t(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Oi(e,t)];var i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size)return i}function qt(e,t){var i=re(t),n=_t(e,i);n&&!n.text?n=null:n&&n.changes&&(kt(e,n,i,Si(e)),e.curOp.forceUpdate=!0),n||(n=Xt(e,t));var o=Kt(n,t,i);return{line:t,view:n,rect:null,map:o.map,cache:o.cache,before:o.before,hasHeights:!1}}function Zt(e,t,i,n,o){t.before&&(i=-1);var r=i+(n||""),l;return t.cache.hasOwnProperty(r)?l=t.cache[r]:(!t.rect&&(t.rect=t.view.text.getBoundingClientRect()),!t.hasHeights&&(Vt(e,t.view,t.rect),t.hasHeights=!0),l=ei(e,t,i,n),!l.bogus&&(t.cache[r]=l)),{left:l.left,right:l.right,top:o?l.rtop:l.top,bottom:o?l.rbottom:l.bottom}}function Qt(e,t,n){for(var o=0,r,l,s,d,a,p;o<e.length;o+=3)if(a=e[o],p=e[o+1],t<a?(l=0,s=1,d="left"):t<p?(l=t-a,s=l+1):(o==e.length-3||t==p&&e[o+3]>t)&&(s=p-a,l=s-1,t>=p&&(d="right")),null!=l){if(r=e[o+2],a==p&&n==(r.insertLeft?"left":"right")&&(d=n),"left"==n&&0==l)for(;o&&e[o-2]==e[o-3]&&e[o-1].insertLeft;)r=e[(o-=3)+2],d="left";if("right"==n&&l==p-a)for(;o<e.length-3&&e[o+3]==e[o+4]&&!e[o+5].insertLeft;)r=e[(o+=3)+2],d="right";break}return{node:r,start:l,end:s,collapse:d,coverStart:a,coverEnd:p}}function Jt(e,t){var n=xs;if("left"==t)for(var o=0;o<e.length&&(n=e[o]).left==n.right;o++);else for(var r=e.length-1;0<=r&&(n=e[r]).left==n.right;r--);return n}function ei(e,t,n,o){var r=Qt(t.map,n,o),l=r.node,s=r.start,d=r.end,a=r.collapse,p;if(3==l.nodeType){for(var c=0;4>c;c++){for(;s&&k(t.line.text.charAt(r.coverStart+s));)--s;for(;r.coverStart+d<r.coverEnd&&k(t.line.text.charAt(r.coverStart+d));)++d;if(p=Sl&&9>ie&&0==s&&d==r.coverEnd-r.coverStart?l.parentNode.getBoundingClientRect():Jt(Rl(l,s,d).getClientRects(),o),p.left||p.right||0==s)break;d=s,--s,a="right"}Sl&&11>ie&&(p=ti(e.display.measure,p))}else{0<s&&(a=o="right");var h;p=e.options.lineWrapping&&1<(h=l.getClientRects()).length?h["right"==o?h.length-1:0]:l.getBoundingClientRect()}if(Sl&&9>ie&&!s&&(!p||!p.left&&!p.right)){var g=l.parentNode.getClientRects()[0];p=g?{left:g.left,right:g.left+wi(e.display),top:g.top,bottom:g.bottom}:xs}for(var u=p.top-t.rect.top,f=p.bottom-t.rect.top,m=t.view.measure.heights,y=0;y<m.length-1&&!((u+f)/2<m[y]);y++);var x=y?m[y-1]:0,v=m[y],b={left:("right"==a?p.right:p.left)-t.rect.left,right:("left"==a?p.left:p.right)-t.rect.left,top:x,bottom:v};return p.left||p.right||(b.bogus=!0),e.options.singleCursorHeightPerLine||(b.rtop=u,b.rbottom=f),b}function ti(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!K(e))return t;var i=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*i,right:t.right*i,top:t.top*n,bottom:t.bottom*n}}function ii(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function ni(e){e.display.externalMeasure=null,t(e.display.lineMeasure);for(var n=0;n<e.display.view.length;n++)ii(e.display.view[n])}function oi(e){ni(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function ri(){return Ll&&Ml?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function li(){return Ll&&Ml?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function si(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=zt(e.widgets[n]));return t}function di(e,t,i,n,o){if(!o){var r=si(t);i.top+=r,i.bottom+=r}if("line"==n)return i;n||(n="local");var l=ot(t);if("local"==n?l+=Rt(e.display):l-=e.display.viewOffset,"page"==n||"window"==n){var s=e.display.lineSpace.getBoundingClientRect();l+=s.top+("window"==n?0:li());var d=s.left+("window"==n?0:ri());i.left+=d,i.right+=d}return i.top+=l,i.bottom+=l,i}function ai(e,t,i){if("div"==i)return t;var n=t.left,o=t.top;if("page"==i)n-=ri(),o-=li();else if("local"==i||!i){var r=e.display.sizer.getBoundingClientRect();n+=r.left,o+=r.top}var l=e.display.lineSpace.getBoundingClientRect();return{left:n-l.left,top:o-l.top}}function pi(e,t,i,n,o){return n||(n=ee(e.doc,t.line)),di(e,n,Yt(e,n,t.ch,o),i)}function ci(e,t,i,n,o,r){function l(t,l){var s=Zt(e,o,t,l?"right":"left",r);return l?s.left=s.right:s.right=s.left,di(e,n,s,i)}function s(e,t,i){var n=d[t],o=1==n.level;return l(i?e-1:e,o!=i)}n=n||ee(e.doc,t.line),o||(o=qt(e,n));var d=M(n,e.doc.direction),a=t.ch,p=t.sticky;if(a>=n.text.length?(a=n.text.length,p="before"):0>=a&&(a=0,p="after"),!d)return l("before"==p?a-1:a,"before"==p);var c=A(d,a,p),h=_l,g=s(a,c,"before"==p);return null!=h&&(g.other=s(a,h,"before"!=p)),g}function hi(e,t){var i=0;t=me(e.doc,t),e.options.lineWrapping||(i=wi(e.display)*t.ch);var n=ee(e.doc,t.line),o=ot(n)+Rt(e.display);return{left:i,right:i,top:o,bottom:o+n.height}}function gi(e,t,i,n,o){var r=ae(e,t,i);return r.xRel=o,n&&(r.outside=n),r}function ui(e,t,i){var n=e.doc;if(i+=e.display.viewOffset,0>i)return gi(n.first,0,null,-1,-1);var o=le(n,i),r=n.first+n.size-1;if(o>r)return gi(n.first+n.size-1,ee(n,r).text.length,null,1,1);0>t&&(t=0);for(var l=ee(n,o);;){var s=xi(e,l,o,t,i),d=_e(l,s.ch+(0<s.xRel||0<s.outside?1:0));if(!d)return s;var a=d.find(1);if(a.line==o)return a;l=ee(n,o=a.line)}}function fi(e,t,i,n){n-=si(t);var o=t.text.length,r=N(function(t){return Zt(e,i,t-1).bottom<=n},o,0);return o=N(function(t){return Zt(e,i,t).top>n},r,o),{begin:r,end:o}}function mi(e,t,i,n){i||(i=qt(e,t));var o=di(e,t,Zt(e,i,n),"line").top;return fi(e,t,i,o)}function yi(e,t,i,n){return!(e.bottom<=i)&&(!!(e.top>i)||(n?e.left:e.right)>t)}function xi(e,t,i,n,o){o-=ot(t);var r=qt(e,t),l=si(t),s=0,d=t.text.length,a=!0,p=M(t,e.doc.direction);if(p){var c=(e.options.lineWrapping?bi:vi)(e,t,i,r,p,n,o);a=1!=c.level,s=a?c.from:c.to-1,d=a?c.to:c.from-1}var h=null,g=null,u=N(function(t){var i=Zt(e,r,t);return(i.top+=l,i.bottom+=l,!!yi(i,n,o,!1))&&(i.top<=o&&i.left<=n&&(h=t,g=i),!0)},s,d),f=!1,m,x;if(g){var v=n-g.left<g.right-n,b=v==a;u=h+(b?0:1),x=b?"after":"before",m=v?g.left:g.right}else{a||u!=d&&u!=s||u++,x=0==u?"after":u==t.text.length?"before":Zt(e,r,u-(a?1:0)).bottom+l<=o==a?"after":"before";var C=ci(e,ae(i,u,x),"line",t,r);m=C.left,f=o<C.top?-1:o>=C.bottom?1:0}return u=T(t.text,u,1),gi(i,u,x,f,n-m)}function vi(e,t,n,o,r,l,s){var i=N(function(d){var i=r[d],a=1!=i.level;return yi(ci(e,ae(n,a?i.to:i.from,a?"before":"after"),"line",t,o),l,s,!0)},0,r.length-1),d=r[i];if(0<i){var a=1!=d.level,p=ci(e,ae(n,a?d.from:d.to,a?"after":"before"),"line",t,o);yi(p,l,s,!0)&&p.top>s&&(d=r[i-1])}return d}function bi(e,t,n,o,r,l,s){var d=fi(e,t,o,s),a=d.begin,c=d.end;/\s/.test(t.text.charAt(c-1))&&c--;for(var h=null,g=null,u=0,f;u<r.length;u++)if(f=r[u],!(f.from>=c||f.to<=a)){var m=1!=f.level,y=Zt(e,o,m?Math.min(c,f.to)-1:Math.max(a,f.from)).right,x=y<l?l-y+1e9:y-l;(!h||g>x)&&(h=f,g=x)}return h||(h=r[r.length-1]),h.from<a&&(h={from:a,to:h.to,level:h.level}),h.to>c&&(h={from:h.from,to:c,level:h.level}),h}function Ci(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==bs){bs=o("pre",null,"CodeMirror-line-like");for(var r=0;49>r;++r)bs.appendChild(document.createTextNode("x")),bs.appendChild(o("br"));bs.appendChild(document.createTextNode("x"))}n(e.measure,bs);var l=bs.offsetHeight/50;return 3<l&&(e.cachedTextHeight=l),t(e.measure),l||1}function wi(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=o("span","xxxxxxxxxx"),i=o("pre",[t],"CodeMirror-line-like");n(e.measure,i);var r=t.getBoundingClientRect(),l=(r.right-r.left)/10;return 2<l&&(e.cachedCharWidth=l),l||10}function Si(e){for(var t=e.display,o={},r={},l=t.gutters.clientLeft,s=t.gutters.firstChild,d=0,a;s;s=s.nextSibling,++d)a=e.display.gutterSpecs[d].className,o[a]=s.offsetLeft+s.clientLeft+l,r[a]=s.clientWidth;return{fixedPos:Li(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:o,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Li(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function ki(e){var t=Ci(e.display),n=e.options.lineWrapping,o=n&&Math.max(5,e.display.scroller.clientWidth/wi(e.display)-3);return function(r){if(it(e.doc,r))return 0;var l=0;if(r.widgets)for(var s=0;s<r.widgets.length;s++)r.widgets[s].height&&(l+=r.widgets[s].height);return n?l+(Math.ceil(r.text.length/o)||1)*t:l+t}}function Ti(e){var t=e.doc,i=ki(e);t.iter(function(e){var t=i(e);t!=e.height&&oe(e,t)})}function Ni(t,i,e,n){var o=t.display;if(!e&&"true"==U(i).getAttribute("cm-not-content"))return null;var r=o.lineSpace.getBoundingClientRect(),l,s;try{l=i.clientX-r.left,s=i.clientY-r.top}catch(t){return null}var d=ui(t,l,s),a;if(n&&0<d.xRel&&(a=ee(t.doc,d.line).text).length==d.ch){var p=h(a,a.length,t.options.tabSize)-a.length;d=ae(d.line,Math.max(0,Math.round((l-Gt(t.display).left)/wi(t.display))-p))}return d}function Oi(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,0>t)return null;for(var o=e.display.view,r=0;r<o.length;r++)if(t-=o[r].size,0>t)return r}function Ai(e,t,i,n){null==t&&(t=e.doc.first),null==i&&(i=e.doc.first+e.doc.size),n||(n=0);var o=e.display;if(n&&i<o.viewTo&&(null==o.updateLineNumbers||o.updateLineNumbers>t)&&(o.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=o.viewTo)hs&&et(e.doc,t)<o.viewTo&&Wi(e);else if(i<=o.viewFrom)hs&&tt(e.doc,i+n)>o.viewFrom?Wi(e):(o.viewFrom+=n,o.viewTo+=n);else if(t<=o.viewFrom&&i>=o.viewTo)Wi(e);else if(t<=o.viewFrom){var r=Di(e,i,i+n,1);r?(o.view=o.view.slice(r.index),o.viewFrom=r.lineN,o.viewTo+=n):Wi(e)}else if(i>=o.viewTo){var l=Di(e,t,t,-1);l?(o.view=o.view.slice(0,l.index),o.viewTo=l.lineN):Wi(e)}else{var s=Di(e,t,t,-1),d=Di(e,i,i+n,1);s&&d?(o.view=o.view.slice(0,s.index).concat(vt(e,s.lineN,d.lineN)).concat(o.view.slice(d.index)),o.viewTo+=n):Wi(e)}var a=o.externalMeasured;a&&(i<a.lineN?a.lineN+=n:t<a.lineN+a.size&&(o.externalMeasured=null))}function Mi(e,t,i){e.curOp.viewChanged=!0;var n=e.display,o=e.display.externalMeasured;if(o&&t>=o.lineN&&t<o.lineN+o.size&&(n.externalMeasured=null),!(t<n.viewFrom||t>=n.viewTo)){var r=n.view[Oi(e,t)];if(null!=r.node){var l=r.changes||(r.changes=[]);-1==g(l,i)&&l.push(i)}}}function Wi(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Di(e,t,o,r){var l=Oi(e,t),s=e.display.view,d;if(!hs||o==e.doc.first+e.doc.size)return{index:l,lineN:o};for(var a=e.display.viewFrom,p=0;p<l;p++)a+=s[p].size;if(a!=t){if(0<r){if(l==s.length-1)return null;d=a+s[l].size-t,l++}else d=a-t;t+=d,o+=d}for(;et(e.doc,o)!=o;){if(l==(0>r?0:s.length-1))return null;o+=r*s[l-(0>r?1:0)].size,l+=r}return{index:l,lineN:o}}function Hi(e,t,i){var n=e.display,o=n.view;0==o.length||t>=n.viewTo||i<=n.viewFrom?(n.view=vt(e,t,i),n.viewFrom=t):(n.viewFrom>t?n.view=vt(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(Oi(e,t))),n.viewFrom=t,n.viewTo<i?n.view=n.view.concat(vt(e,n.viewTo,i)):n.viewTo>i&&(n.view=n.view.slice(0,Oi(e,i)))),n.viewTo=i}function Fi(e){for(var t=e.display.view,n=0,o=0,r;o<t.length;o++)r=t[o],r.hidden||r.node&&!r.changes||++n;return n}function Pi(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Ii(e,t){void 0===t&&(t=!0);for(var n=e.doc,o={},r=o.cursors=document.createDocumentFragment(),l=o.selection=document.createDocumentFragment(),s=0;s<n.sel.ranges.length;s++)if(t||s!=n.sel.primIndex){var d=n.sel.ranges[s];if(!(d.from().line>=e.display.viewTo||d.to().line<e.display.viewFrom)){var a=d.empty();(a||e.options.showCursorWhenSelecting)&&zi(e,d.head,r),a||Ri(e,d,l)}}return o}function zi(e,t,i){var n=ci(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),r=i.appendChild(o("div","\xA0","CodeMirror-cursor"));if(r.style.left=n.left+"px",r.style.top=n.top+"px",r.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var l=i.appendChild(o("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));l.style.display="",l.style.left=n.other.left+"px",l.style.top=n.other.top+"px",l.style.height=.85*(n.other.bottom-n.other.top)+"px"}}function Ei(e,t){return e.top-t.top||e.left-t.left}function Ri(e,t,i){function n(e,t,i,n){0>t&&(t=0),t=Math.round(t),n=Math.round(n),d.appendChild(o("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==i?c-e:i)+"px;\n height: "+(n-t)+"px"))}function r(t,o,r){function l(i,n){return pi(e,ae(t,i),"div",a,n)}function d(t,i,n){var o=mi(e,a,null,t),r="ltr"==i==("after"==n)?"left":"right",s="after"==n?o.begin:o.end-(/\s/.test(a.text.charAt(o.end-1))?2:1);return l(s,r)[r]}var a=ee(s,t),g=a.text.length,u=M(a,s.direction),f,m;return O(u,o||0,null==r?g:r,function(e,t,s,a){var i="ltr"==s,y=l(e,i?"left":"right"),x=l(t-1,i?"right":"left"),v=null==o&&0==e,b=null==r&&t==g,C=0==a,w=!u||a==u.length-1;if(3>=x.top-y.top){var S=(h?v:b)&&C,L=(h?b:v)&&w,k=S?p:(i?y:x).left,T=L?c:(i?x:y).right;n(k,y.top,T-k,y.bottom)}else{var N,O,A,M;i?(N=h&&v&&C?p:y.left,O=h?c:d(e,s,"before"),A=h?p:d(t,s,"after"),M=h&&b&&w?c:x.right):(N=h?d(e,s,"before"):p,O=!h&&v&&C?c:y.right,A=!h&&b&&w?p:x.left,M=h?d(t,s,"after"):c),n(N,y.top,O-N,y.bottom),y.bottom<x.top&&n(p,y.bottom,null,x.top),n(A,x.top,M-A,x.bottom)}(!f||0>Ei(y,f))&&(f=y),0>Ei(x,f)&&(f=x),(!m||0>Ei(y,m))&&(m=y),0>Ei(x,m)&&(m=x)}),{start:f,end:m}}var l=e.display,s=e.doc,d=document.createDocumentFragment(),a=Gt(e.display),p=a.left,c=Math.max(l.sizerWidth,$t(e)-l.sizer.offsetLeft)-a.right,h="ltr"==s.direction,g=t.from(),u=t.to();if(g.line==u.line)r(g.line,g.ch,u.ch);else{var f=ee(s,g.line),m=ee(s,u.line),y=Ze(f)==Ze(m),x=r(g.line,g.ch,y?f.text.length+1:null).end,v=r(u.line,y?0:null,u.ch).start;y&&(x.top<v.top-2?(n(x.right,x.top,null,x.bottom),n(p,v.top,v.left,v.bottom)):n(x.right,x.top,v.left-x.right,x.bottom)),x.bottom<v.top&&n(p,x.bottom,null,v.top)}i.appendChild(d)}function Bi(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var i=!0;t.cursorDiv.style.visibility="",0<e.options.cursorBlinkRate?t.blinker=setInterval(function(){return t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):0>e.options.cursorBlinkRate&&(t.cursorDiv.style.visibility="hidden")}}function Gi(e){e.state.focused||(e.display.input.focus(),$i(e))}function Ui(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,ji(e))},100)}function $i(t,i){t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1),"nocursor"==t.options.readOnly||(!t.state.focused&&(H(t,"focus",t,i),t.state.focused=!0,d(t.display.wrapper,"CodeMirror-focused"),!t.curOp&&t.display.selForContextMenu!=t.doc.sel&&(t.display.input.reset(),at&&setTimeout(function(){return t.display.input.reset(!0)},20)),t.display.input.receivedFocus()),Bi(t))}function ji(t,i){t.state.delayingBlurEvent||(t.state.focused&&(H(t,"blur",t,i),t.state.focused=!1,El(t.display.wrapper,"CodeMirror-focused")),clearInterval(t.display.blinker),setTimeout(function(){t.state.focused||(t.display.shift=!1)},150))}function Vi(e){for(var t=e.display,n=t.lineDiv.offsetTop,o=0;o<t.view.length;o++){var r=t.view[o],l=e.options.lineWrapping,s=void 0,d=0;if(!r.hidden){if(Sl&&8>ie){var a=r.node.offsetTop+r.node.offsetHeight;s=a-n,n=a}else{var p=r.node.getBoundingClientRect();s=p.bottom-p.top,!l&&r.text.firstChild&&(d=r.text.firstChild.getBoundingClientRect().right-p.left-1)}var c=r.line.height-s;if((.005<c||-.005>c)&&(oe(r.line,s),Ki(r.line),r.rest))for(var h=0;h<r.rest.length;h++)Ki(r.rest[h]);if(d>e.display.sizerWidth){var g=Math.ceil(d/wi(e.display));g>e.display.maxLineLength&&(e.display.maxLineLength=g,e.display.maxLine=r.line,e.display.maxLineChanged=!0)}}}}function Ki(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],o=n.node.parentNode;o&&(n.height=o.offsetHeight)}}function Xi(e,t,i){var n=i&&null!=i.top?Math.max(0,i.top):e.scroller.scrollTop;n=Math.floor(n-Rt(e));var o=i&&null!=i.bottom?i.bottom:n+e.wrapper.clientHeight,r=le(t,n),l=le(t,o);if(i&&i.ensure){var s=i.ensure.from.line,d=i.ensure.to.line;s<r?(r=s,l=le(t,ot(ee(t,s))+e.wrapper.clientHeight)):Math.min(d,t.lastLine())>=l&&(r=le(t,ot(ee(t,d))-e.wrapper.clientHeight),l=d)}return{from:r,to:Math.max(l,r+1)}}function Yi(e,t){if(!F(e,"scrollCursorIntoView")){var i=e.display,n=i.sizer.getBoundingClientRect(),r=null;if(0>t.top+n.top?r=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(r=!1),null!=r&&!Ol){var l=o("div","\u200B",null,"position: absolute;\n top: "+(t.top-i.viewOffset-Rt(e.display))+"px;\n height: "+(t.bottom-t.top+Ut(e)+i.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(l),l.scrollIntoView(r),e.display.lineSpace.removeChild(l)}}}function _i(e,t,i,n){null==n&&(n=0);var o;e.options.lineWrapping||t!=i||(t=t.ch?ae(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t,i="before"==t.sticky?ae(t.line,t.ch+1,"before"):t);for(var r=0;5>r;r++){var l=!1,s=ci(e,t),d=i&&i!=t?ci(e,i):s;o={left:Math.min(s.left,d.left),top:Math.min(s.top,d.top)-n,right:Math.max(s.left,d.left),bottom:Math.max(s.bottom,d.bottom)+n};var a=Zi(e,o),p=e.doc.scrollTop,c=e.doc.scrollLeft;if(null!=a.scrollTop&&(ln(e,a.scrollTop),1<Math.abs(e.doc.scrollTop-p)&&(l=!0)),null!=a.scrollLeft&&(dn(e,a.scrollLeft),1<Math.abs(e.doc.scrollLeft-c)&&(l=!0)),!l)break}return o}function qi(e,t){var i=Zi(e,t);null!=i.scrollTop&&ln(e,i.scrollTop),null!=i.scrollLeft&&dn(e,i.scrollLeft)}function Zi(e,t){var i=e.display,n=Ci(e.display);0>t.top&&(t.top=0);var o=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:i.scroller.scrollTop,r=jt(e),l={};t.bottom-t.top>r&&(t.bottom=t.top+r);var s=e.doc.height+Bt(i),d=t.top<n,a=t.bottom>s-n;if(t.top<o)l.scrollTop=d?0:t.top;else if(t.bottom>o+r){var p=Math.min(t.top,(a?s:t.bottom)-r);p!=o&&(l.scrollTop=p)}var c=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:i.scroller.scrollLeft,h=$t(e)-(e.options.fixedGutter?i.gutters.offsetWidth:0),g=t.right-t.left>h;return g&&(t.right=t.left+h),10>t.left?l.scrollLeft=0:t.left<c?l.scrollLeft=Math.max(0,t.left-(g?0:10)):t.right>h+c-3&&(l.scrollLeft=t.right+(g?0:10)-h),l}function Qi(e,t){null==t||(nn(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Ji(e){nn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function en(e,t,i){(null!=t||null!=i)&&nn(e),null!=t&&(e.curOp.scrollLeft=t),null!=i&&(e.curOp.scrollTop=i)}function tn(e,t){nn(e),e.curOp.scrollToPos=t}function nn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=hi(e,t.from),n=hi(e,t.to);rn(e,i,n,t.margin)}}function rn(e,t,i,n){var o=Zi(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-n,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+n});en(e,o.scrollLeft,o.scrollTop)}function ln(e,t){2>Math.abs(e.doc.scrollTop-t)||(!vl&&Dn(e,{top:t}),sn(e,t,!0),vl&&Dn(e),kn(e,100))}function sn(e,t,i){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),(e.display.scroller.scrollTop!=t||i)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function dn(e,t,i,n){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(i?t==e.doc.scrollLeft:2>Math.abs(e.doc.scrollLeft-t))&&!n||(e.doc.scrollLeft=t,In(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function an(e){var t=e.display,i=t.gutters.offsetWidth,n=Math.round(e.doc.height+Bt(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?i:0,docHeight:n,scrollHeight:n+Ut(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}function pn(e,t){t||(t=an(e));var n=e.display.barWidth,o=e.display.barHeight;cn(e,t);for(var r=0;4>r&&n!=e.display.barWidth||o!=e.display.barHeight;r++)n!=e.display.barWidth&&e.options.lineWrapping&&Vi(e),cn(e,an(e)),n=e.display.barWidth,o=e.display.barHeight}function cn(e,t){var i=e.display,n=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=n.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=n.bottom)+"px",i.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=n.bottom+"px",i.scrollbarFiller.style.width=n.right+"px"):i.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=n.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}function hn(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&El(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new ws[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Ql(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,i){"horizontal"==i?dn(e,t):ln(e,t)},e),e.display.scrollbars.addClass&&d(e.display.wrapper,e.display.scrollbars.addClass)}function gn(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Ss},bt(e.curOp)}function un(e){var t=e.curOp;t&&wt(t,function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null;fn(e)})}function fn(e){for(var t=e.ops,n=0;n<t.length;n++)mn(t[n]);for(var o=0;o<t.length;o++)yn(t[o]);for(var r=0;r<t.length;r++)xn(t[r]);for(var l=0;l<t.length;l++)vn(t[l]);for(var s=0;s<t.length;s++)bn(t[s])}function mn(e){var t=e.cm,i=t.display;Nn(t),e.updateMaxLine&<(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<i.viewFrom||e.scrollToPos.to.line>=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Ls(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function yn(e){e.updatedDisplay=e.mustUpdate&&Mn(e.cm,e.update)}function xn(e){var t=e.cm,i=t.display;e.updatedDisplay&&Vi(t),e.barMeasure=an(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Yt(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+Ut(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-$t(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function vn(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&dn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var i=e.focus&&e.focus==s();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,i),(e.updatedDisplay||e.startHeight!=t.doc.height)&&pn(t,e.barMeasure),e.updatedDisplay&&Pn(t,e.barMeasure),e.selectionChanged&&Bi(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),i&&Gi(e.cm)}function bn(e){var t=e.cm,n=t.display,o=t.doc;if(e.updatedDisplay&&Wn(t,e.update),null!=n.wheelStartX&&(null!=e.scrollTop||null!=e.scrollLeft||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),null!=e.scrollTop&&sn(t,e.scrollTop,e.forceScroll),null!=e.scrollLeft&&dn(t,e.scrollLeft,!0,!0),e.scrollToPos){var r=_i(t,me(o,e.scrollToPos.from),me(o,e.scrollToPos.to),e.scrollToPos.margin);Yi(t,r)}var l=e.maybeHiddenMarkers,s=e.maybeUnhiddenMarkers;if(l)for(var d=0;d<l.length;++d)l[d].lines.length||H(l[d],"hide");if(s)for(var a=0;a<s.length;++a)s[a].lines.length&&H(s[a],"unhide");n.wrapper.offsetHeight&&(o.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&H(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Cn(e,t){if(e.curOp)return t();gn(e);try{return t()}finally{un(e)}}function wn(e,t){return function(){if(e.curOp)return t.apply(e,arguments);gn(e);try{return t.apply(e,arguments)}finally{un(e)}}}function Sn(e){return function(){if(this.curOp)return e.apply(this,arguments);gn(this);try{return e.apply(this,arguments)}finally{un(this)}}}function Ln(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);gn(t);try{return e.apply(this,arguments)}finally{un(t)}}}function kn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,p(Tn,e))}function Tn(e){var t=e.doc;if(!(t.highlightFrontier>=e.display.viewTo)){var n=+new Date+e.options.workTime,o=Ce(e,t.highlightFrontier),r=[];t.iter(o.line,Math.min(t.first+t.size,e.display.viewTo+500),function(l){if(o.line>=e.display.viewFrom){var s=l.styles,d=l.text.length>e.options.maxHighlightLength?Z(t.mode,o.state):null,a=ve(e,l,o,!0);d&&(o.state=d),l.styles=a.styles;var p=l.styleClasses,c=a.classes;c?l.styleClasses=c:p&&(l.styleClasses=null);for(var h=!s||s.length!=l.styles.length||p!=c&&(!p||!c||p.bgClass!=c.bgClass||p.textClass!=c.textClass),g=0;!h&&g<s.length;++g)h=s[g]!=l.styles[g];h&&r.push(o.line),l.stateAfter=o.save(),o.nextLine()}else l.text.length<=e.options.maxHighlightLength&&we(e,l.text,o),l.stateAfter=0==o.line%5?o.save():null,o.nextLine();return+new Date>n?(kn(e,e.options.workDelay),!0):void 0}),t.highlightFrontier=o.line,t.modeFrontier=Math.max(t.modeFrontier,o.line),r.length&&Cn(e,function(){for(var t=0;t<r.length;t++)Mi(e,r[t],"text")})}}function Nn(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Ut(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Ut(e)+"px",t.scrollbarsClipped=!0)}function On(e){if(e.hasFocus())return null;var t=s();if(!t||!l(e.display.lineDiv,t))return null;var i={activeElt:t};if(window.getSelection){var n=window.getSelection();n.anchorNode&&n.extend&&l(e.display.lineDiv,n.anchorNode)&&(i.anchorNode=n.anchorNode,i.anchorOffset=n.anchorOffset,i.focusNode=n.focusNode,i.focusOffset=n.focusOffset)}return i}function An(e){if(e&&e.activeElt&&e.activeElt!=s()&&(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&l(document.body,e.anchorNode)&&l(document.body,e.focusNode))){var t=window.getSelection(),i=document.createRange();i.setEnd(e.anchorNode,e.anchorOffset),i.collapse(!1),t.removeAllRanges(),t.addRange(i),t.extend(e.focusNode,e.focusOffset)}}function Mn(e,i){var n=e.display,o=e.doc;if(i.editorIsHidden)return Wi(e),!1;if(!i.force&&i.visible.from>=n.viewFrom&&i.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==Fi(e))return!1;zn(e)&&(Wi(e),i.dims=Si(e));var r=o.first+o.size,l=Math.max(i.visible.from-e.options.viewportMargin,o.first),s=Math.min(r,i.visible.to+e.options.viewportMargin);n.viewFrom<l&&20>l-n.viewFrom&&(l=Math.max(o.first,n.viewFrom)),n.viewTo>s&&20>n.viewTo-s&&(s=Math.min(r,n.viewTo)),hs&&(l=et(e.doc,l),s=tt(e.doc,s));var d=l!=n.viewFrom||s!=n.viewTo||n.lastWrapHeight!=i.wrapperHeight||n.lastWrapWidth!=i.wrapperWidth;Hi(e,l,s),n.viewOffset=ot(ee(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var a=Fi(e);if(!d&&0==a&&!i.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var p=On(e);return 4<a&&(n.lineDiv.style.display="none"),Hn(e,n.updateLineNumbers,i.dims),4<a&&(n.lineDiv.style.display=""),n.renderedView=n.view,An(p),t(n.cursorDiv),t(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,d&&(n.lastWrapHeight=i.wrapperHeight,n.lastWrapWidth=i.wrapperWidth,kn(e,400)),n.updateLineNumbers=null,!0}function Wn(e,t){for(var i=t.viewport,n=!0;;n=!1){if(n&&e.options.lineWrapping&&t.oldDisplayWidth!=$t(e))n&&(t.visible=Xi(e.display,e.doc,i));else if(i&&null!=i.top&&(i={top:Math.min(e.doc.height+Bt(e.display)-jt(e),i.top)}),t.visible=Xi(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!Mn(e,t))break;Vi(e);var o=an(e);Pi(e),pn(e,o),Pn(e,o),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Dn(e,t){var i=new Ls(e,t);if(Mn(e,i)){Vi(e),Wn(e,i);var n=an(e);Pi(e),pn(e,n),Pn(e,n),i.finish()}}function Hn(e,n,o){function r(t){var i=t.nextSibling;return at&&Dl&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),i}for(var l=e.display,s=e.options.lineNumbers,d=l.lineDiv,a=d.firstChild,p=l.view,c=l.viewFrom,h=0,u;h<p.length;h++){if(u=p[h],u.hidden);else if(!u.node||u.node.parentNode!=d){var f=Ht(e,u,c,o);d.insertBefore(f,a)}else{for(;a!=u.node;)a=r(a);var m=s&&null!=n&&n<=c&&u.lineNumber;u.changes&&(-1<g(u.changes,"gutter")&&(m=!1),kt(e,u,c,o)),m&&(t(u.lineNumber),u.lineNumber.appendChild(document.createTextNode(de(e.options,c)))),a=u.node.nextSibling}c+=u.size}for(;a;)a=r(a)}function Fn(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Pn(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Ut(e)+"px"}function In(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var o=Li(t)-t.scroller.scrollLeft+e.doc.scrollLeft,r=t.gutters.offsetWidth,l=o+"px",s=0;s<n.length;s++)if(!n[s].hidden){e.options.fixedGutter&&(n[s].gutter&&(n[s].gutter.style.left=l),n[s].gutterBackground&&(n[s].gutterBackground.style.left=l));var d=n[s].alignable;if(d)for(var a=0;a<d.length;a++)d[a].style.left=l}e.options.fixedGutter&&(t.gutters.style.left=o+r+"px")}}function zn(e){if(!e.options.lineNumbers)return!1;var t=e.doc,i=de(e.options,t.first+t.size-1),n=e.display;if(i.length!=n.lineNumChars){var r=n.measure.appendChild(o("div",[o("div",i)],"CodeMirror-linenumber CodeMirror-gutter-elt")),l=r.firstChild.offsetWidth,s=r.offsetWidth-l;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(l,n.lineGutter.offsetWidth-s)+1,n.lineNumWidth=n.lineNumInnerWidth+s,n.lineNumChars=n.lineNumInnerWidth?i.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",Fn(e.display),!0}return!1}function En(e,t){for(var n=[],o=!1,r=0;r<e.length;r++){var l=e[r],s=null;if("string"!=typeof l&&(s=l.style,l=l.className),"CodeMirror-linenumbers"==l)if(!t)continue;else o=!0;n.push({className:l,style:s})}return t&&!o&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Rn(e){var n=e.gutters,r=e.gutterSpecs;t(n),e.lineGutter=null;for(var l=0;l<r.length;++l){var s=r[l],d=s.className,a=s.style,p=n.appendChild(o("div",null,"CodeMirror-gutter "+d));a&&(p.style.cssText=a),"CodeMirror-linenumbers"==d&&(e.lineGutter=p,p.style.width=(e.lineNumWidth||1)+"px")}n.style.display=r.length?"":"none",Fn(e)}function Bn(e){Rn(e.display),Ai(e),In(e)}function Gn(e,t,i,n){var l=this;this.input=i,l.scrollbarFiller=o("div",null,"CodeMirror-scrollbar-filler"),l.scrollbarFiller.setAttribute("cm-not-content","true"),l.gutterFiller=o("div",null,"CodeMirror-gutter-filler"),l.gutterFiller.setAttribute("cm-not-content","true"),l.lineDiv=r("div",null,"CodeMirror-code"),l.selectionDiv=o("div",null,null,"position: relative; z-index: 1"),l.cursorDiv=o("div",null,"CodeMirror-cursors"),l.measure=o("div",null,"CodeMirror-measure"),l.lineMeasure=o("div",null,"CodeMirror-measure"),l.lineSpace=r("div",[l.measure,l.lineMeasure,l.selectionDiv,l.cursorDiv,l.lineDiv],null,"position: relative; outline: none");var s=r("div",[l.lineSpace],"CodeMirror-lines");l.mover=o("div",[s],null,"position: relative"),l.sizer=o("div",[l.mover],"CodeMirror-sizer"),l.sizerWidth=null,l.heightForcer=o("div",null,null,"position: absolute; height: 50px; width: 1px;"),l.gutters=o("div",null,"CodeMirror-gutters"),l.lineGutter=null,l.scroller=o("div",[l.sizer,l.heightForcer,l.gutters],"CodeMirror-scroll"),l.scroller.setAttribute("tabIndex","-1"),l.wrapper=o("div",[l.scrollbarFiller,l.gutterFiller,l.scroller],"CodeMirror"),Sl&&8>ie&&(l.gutters.style.zIndex=-1,l.scroller.style.paddingRight=0),at||vl&&Wl||(l.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(l.wrapper):e(l.wrapper)),l.viewFrom=l.viewTo=t.first,l.reportedViewFrom=l.reportedViewTo=t.first,l.view=[],l.renderedView=null,l.externalMeasured=null,l.viewOffset=0,l.lastWrapHeight=l.lastWrapWidth=0,l.updateLineNumbers=null,l.nativeBarWidth=l.barHeight=l.barWidth=0,l.scrollbarsClipped=!1,l.lineNumWidth=l.lineNumInnerWidth=l.lineNumChars=null,l.alignWidgets=!1,l.cachedCharWidth=l.cachedTextHeight=l.cachedPaddingH=null,l.maxLine=null,l.maxLineLength=0,l.maxLineChanged=!1,l.wheelDX=l.wheelDY=l.wheelStartX=l.wheelStartY=null,l.shift=!1,l.selForContextMenu=null,l.activeTouch=null,l.gutterSpecs=En(n.gutters,n.lineNumbers),Rn(l),i.init(l)}function Un(t){var e=t.wheelDeltaX,i=t.wheelDeltaY;return null==e&&t.detail&&t.axis==t.HORIZONTAL_AXIS&&(e=t.detail),null==i&&t.detail&&t.axis==t.VERTICAL_AXIS?i=t.detail:null==i&&(i=t.wheelDelta),{x:e,y:i}}function $n(t){var e=Un(t);return e.x*=Ts,e.y*=Ts,e}function jn(t,n){var e=Un(n),o=e.x,r=e.y,l=t.display,s=l.scroller,d=s.scrollWidth>s.clientWidth,a=s.scrollHeight>s.clientHeight;if(o&&d||r&&a){if(r&&Dl&&at)outer:for(var p=n.target,c=l.view;p!=s;p=p.parentNode)for(var h=0;h<c.length;h++)if(c[h].node==p){t.display.currentWheelTarget=p;break outer}if(o&&!vl&&!kl&&null!=Ts)return r&&a&&ln(t,Math.max(0,s.scrollTop+r*Ts)),dn(t,Math.max(0,s.scrollLeft+o*Ts)),(!r||r&&a)&&E(n),void(l.wheelStartX=null);if(r&&null!=Ts){var g=r*Ts,u=t.doc.scrollTop,f=u+l.wrapper.clientHeight;0>g?u=Math.max(0,u+g-50):f=Math.min(t.doc.height,f+g+50),Dn(t,{top:u,bottom:f})}20>ks&&(null==l.wheelStartX?(l.wheelStartX=s.scrollLeft,l.wheelStartY=s.scrollTop,l.wheelDX=o,l.wheelDY=r,setTimeout(function(){if(null!=l.wheelStartX){var e=s.scrollLeft-l.wheelStartX,t=s.scrollTop-l.wheelStartY,i=t&&l.wheelDY&&t/l.wheelDY||e&&l.wheelDX&&e/l.wheelDX;l.wheelStartX=l.wheelStartY=null,i&&(Ts=(Ts*ks+i)/(ks+1),++ks)}},200)):(l.wheelDX+=o,l.wheelDY+=r))}}function Vn(e,t,n){var o=e&&e.options.selectionsMayTouch,r=t[n];t.sort(function(e,t){return pe(e.from(),t.from())}),n=g(t,r);for(var l=1;l<t.length;l++){var s=t[l],d=t[l-1],a=pe(d.to(),s.from());if(o&&!s.empty()?0<a:0<=a){var p=ue(d.from(),s.from()),c=ge(d.to(),s.to()),h=d.empty()?s.from()==s.head:d.from()==d.head;l<=n&&--n,t.splice(--l,2,new Os(h?c:p,h?p:c))}}return new Ns(t,n)}function Kn(e,t){return new Ns([new Os(e,t||e)],0)}function Xn(e){return e.text?ae(e.from.line+e.text.length-1,y(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function Yn(e,t){if(0>pe(e,t.from))return e;if(0>=pe(e,t.to))return Xn(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=Xn(t).ch-t.to.ch),ae(i,n)}function _n(e,t){for(var n=[],o=0,r;o<e.sel.ranges.length;o++)r=e.sel.ranges[o],n.push(new Os(Yn(r.anchor,t),Yn(r.head,t)));return Vn(e.cm,n,e.sel.primIndex)}function qn(e,t,i){return e.line==t.line?ae(i.line,e.ch-t.ch+i.ch):ae(i.line+(e.line-t.line),e.ch)}function Zn(e,t,n){for(var o=[],r=ae(e.first,0),l=r,s=0;s<t.length;s++){var d=t[s],a=qn(d.from,r,l),p=qn(Xn(d),r,l);if(r=d.to,l=p,"around"==n){var c=e.sel.ranges[s],h=0>pe(c.head,c.anchor);o[s]=new Os(h?p:a,h?a:p)}else o[s]=new Os(a,a)}return new Ns(o,e.sel.primIndex)}function Qn(e){e.doc.mode=_(e.options,e.doc.modeOption),Jn(e)}function Jn(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,kn(e,100),e.state.modeGen++,e.curOp&&Ai(e)}function eo(e,t){return 0==t.from.ch&&0==t.to.ch&&""==y(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function io(e,t,i,n){function o(e){return i?i[e]:null}function r(e,i,o){st(e,i,o,n),St(e,"change",e,t)}function l(e,t){for(var r=[],l=e;l<t;++l)r.push(new gs(a[l],o(l),n));return r}var s=t.from,d=t.to,a=t.text,p=ee(e,s.line),c=ee(e,d.line),h=y(a),g=o(a.length-1),u=d.line-s.line;if(t.full)e.insert(0,l(0,a.length)),e.remove(a.length,e.size-a.length);else if(eo(e,t)){var f=l(0,a.length-1);r(c,c.text,g),u&&e.remove(s.line,u),f.length&&e.insert(s.line,f)}else if(p==c){if(1==a.length)r(p,p.text.slice(0,s.ch)+h+p.text.slice(d.ch),g);else{var m=l(1,a.length-1);m.push(new gs(h+p.text.slice(d.ch),g,n)),r(p,p.text.slice(0,s.ch)+a[0],o(0)),e.insert(s.line+1,m)}}else if(1==a.length)r(p,p.text.slice(0,s.ch)+a[0]+c.text.slice(d.ch),o(0)),e.remove(s.line+1,u);else{r(p,p.text.slice(0,s.ch)+a[0],o(0)),r(c,h+c.text.slice(d.ch),g);var x=l(1,a.length-1);1<u&&e.remove(s.line+1,u-1),e.insert(s.line+1,x)}St(e,"change",e,t)}function no(e,t,i){function n(e,o,r){if(e.linked)for(var l=0,s;l<e.linked.length;++l)if(s=e.linked[l],s.doc!=o){var d=r&&s.sharedHist;(!i||d)&&(t(s.doc,d),n(s.doc,e,d))}}n(e,null,!0)}function oo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ti(e),Qn(e),ro(e),e.options.lineWrapping||lt(e),e.options.mode=t.modeOption,Ai(e)}function ro(e){("rtl"==e.doc.direction?d:El)(e.display.lineDiv,"CodeMirror-rtl")}function lo(e){Cn(e,function(){ro(e),Ai(e)})}function so(e){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=e||1}function ao(e,t){var i={from:he(t.from),to:Xn(t),text:te(e,t.from,t.to)};return mo(e,i,t.from.line,t.to.line+1),no(e,function(e){return mo(e,i,t.from.line,t.to.line+1)},!0),i}function po(e){for(;e.length;){var t=y(e);if(t.ranges)e.pop();else break}}function co(e,t){return t?(po(e.done),y(e.done)):e.done.length&&!y(e.done).ranges?y(e.done):1<e.done.length&&!e.done[e.done.length-2].ranges?(e.done.pop(),y(e.done)):void 0}function ho(e,t,i,n){var o=e.history;o.undone.length=0;var r=+new Date,l,s;if((o.lastOp==n||o.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&o.lastModTime>r-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(l=co(o,o.lastOp==n)))s=y(l.changes),0==pe(t.from,t.to)&&0==pe(t.from,s.to)?s.to=Xn(t):l.changes.push(ao(e,t));else{var d=y(o.done);for(d&&d.ranges||fo(e.sel,o.done),l={changes:[ao(e,t)],generation:o.generation},o.done.push(l);o.done.length>o.undoDepth;)o.done.shift(),o.done[0].ranges||o.done.shift()}o.done.push(i),o.generation=++o.maxGeneration,o.lastModTime=o.lastSelTime=r,o.lastOp=o.lastSelOp=n,o.lastOrigin=o.lastSelOrigin=t.origin,s||H(e,"historyAdded")}function go(e,t,i,n){var o=t.charAt(0);return"*"==o||"+"==o&&i.ranges.length==n.ranges.length&&i.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function uo(e,t,i,n){var o=e.history,r=n&&n.origin;i==o.lastSelOp||r&&o.lastSelOrigin==r&&(o.lastModTime==o.lastSelTime&&o.lastOrigin==r||go(e,r,y(o.done),t))?o.done[o.done.length-1]=t:fo(t,o.done),o.lastSelTime=+new Date,o.lastSelOrigin=r,o.lastSelOp=i,n&&!1!==n.clearRedo&&po(o.undone)}function fo(e,t){var i=y(t);i&&i.ranges&&i.equals(e)||t.push(e)}function mo(e,t,i,o){var r=t["spans_"+e.id],l=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,o),function(i){i.markedSpans&&((r||(r=t["spans_"+e.id]={}))[l]=i.markedSpans),++l})}function yo(e){if(!e)return null;for(var t=0,n;t<e.length;++t)e[t].marker.explicitlyCleared?n||(n=e.slice(0,t)):n&&n.push(e[t]);return n?n.length?n:null:e}function xo(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var o=[],r=0;r<t.text.length;++r)o.push(yo(n[r]));return o}function vo(e,t){var n=xo(e,t),o=Ee(e,t);if(!n)return o;if(!o)return n;for(var r=0;r<n.length;++r){var l=n[r],s=o[r];if(l&&s)spans:for(var d=0,a;d<s.length;++d){a=s[d];for(var p=0;p<l.length;++p)if(l[p].marker==a.marker)continue spans;l.push(a)}else s&&(n[r]=s)}return n}function bo(e,t,n){for(var o=[],r=0,l;r<e.length;++r){if(l=e[r],l.ranges){o.push(n?Ns.prototype.deepCopy.call(l):l);continue}var s=l.changes,d=[];o.push({changes:d});for(var a=0;a<s.length;++a){var p=s[a],c=void 0;if(d.push({from:p.from,to:p.to,text:p.text}),t)for(var h in p)(c=h.match(/^spans_(\d+)$/))&&-1<g(t,+c[1])&&(y(d)[h]=p[h],delete p[h])}}return o}function Co(e,t,i,n){if(n){var o=e.anchor;if(i){var r=0>pe(t,o);r==0>pe(i,o)?r!=0>pe(t,i)&&(t=i):(o=t,t=i)}return new Os(o,t)}return new Os(i||t,t)}function wo(e,t,i,n,o){null==o&&(o=e.cm&&(e.cm.display.shift||e.extend)),Oo(e,new Ns([Co(e.sel.primary(),t,i,o)],0),n)}function So(e,t,n){for(var o=[],r=e.cm&&(e.cm.display.shift||e.extend),l=0;l<e.sel.ranges.length;l++)o[l]=Co(e.sel.ranges[l],t[l],null,r);var s=Vn(e.cm,o,e.sel.primIndex);Oo(e,s,n)}function Lo(e,t,i,n){var o=e.sel.ranges.slice(0);o[t]=i,Oo(e,Vn(e.cm,o,e.sel.primIndex),n)}function ko(e,t,i,n){Oo(e,Kn(t,i),n)}function To(e,t,i){var n={ranges:t.ranges,update:function(t){var n=this;this.ranges=[];for(var o=0;o<t.length;o++)n.ranges[o]=new Os(me(e,t[o].anchor),me(e,t[o].head))},origin:i&&i.origin};return H(e,"beforeSelectionChange",e,n),e.cm&&H(e.cm,"beforeSelectionChange",e.cm,n),n.ranges==t.ranges?t:Vn(e.cm,n.ranges,n.ranges.length-1)}function No(e,t,i){var n=e.history.done,o=y(n);o&&o.ranges?(n[n.length-1]=t,Ao(e,t,i)):Oo(e,t,i)}function Oo(e,t,i){Ao(e,t,i),uo(e,e.sel,e.cm?e.cm.curOp.id:NaN,i)}function Ao(e,t,i){(I(e,"beforeSelectionChange")||e.cm&&I(e.cm,"beforeSelectionChange"))&&(t=To(e,t,i));var n=i&&i.bias||(0>pe(t.primary().head,e.sel.primary().head)?-1:1);Mo(e,Do(e,t,n,!0)),!(i&&!1===i.scroll)&&e.cm&&Ji(e.cm)}function Mo(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,P(e.cm)),St(e,"cursorActivity",e))}function Wo(e){Mo(e,Do(e,e.sel,null,!1))}function Do(e,t,n,o){for(var r=0,l;r<t.ranges.length;r++){var s=t.ranges[r],d=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[r],a=Fo(e,s.anchor,d&&d.anchor,n,o),p=Fo(e,s.head,d&&d.head,n,o);(l||a!=s.anchor||p!=s.head)&&(!l&&(l=t.ranges.slice(0,r)),l[r]=new Os(a,p))}return l?Vn(e.cm,l,t.primIndex):t}function Ho(e,t,n,o,r){var l=ee(e,t.line);if(l.markedSpans)for(var s=0;s<l.markedSpans.length;++s){var d=l.markedSpans[s],a=d.marker,p="selectLeft"in a?!a.selectLeft:a.inclusiveLeft,c="selectRight"in a?!a.selectRight:a.inclusiveRight;if((null==d.from||(p?d.from<=t.ch:d.from<t.ch))&&(null==d.to||(c?d.to>=t.ch:d.to>t.ch))){if(r&&(H(a,"beforeCursorEnter"),a.explicitlyCleared))if(!l.markedSpans)break;else{--s;continue}if(!a.atomic)continue;if(n){var h=a.find(0>o?1:-1),g=void 0;if((0>o?c:p)&&(h=Po(e,h,-o,h&&h.line==t.line?l:null)),h&&h.line==t.line&&(g=pe(h,n))&&(0>o?0>g:0<g))return Ho(e,h,t,o,r)}var u=a.find(0>o?-1:1);return(0>o?p:c)&&(u=Po(e,u,o,u.line==t.line?l:null)),u?Ho(e,u,t,o,r):null}}return t}function Fo(e,t,i,n,o){var r=n||1,l=Ho(e,t,i,r,o)||!o&&Ho(e,t,i,r,!0)||Ho(e,t,i,-r,o)||!o&&Ho(e,t,i,-r,!0);return l?l:(e.cantEdit=!0,ae(e.first,0))}function Po(e,t,i,n){return 0>i&&0==t.ch?t.line>e.first?me(e,ae(t.line-1)):null:0<i&&t.ch==(n||ee(e,t.line)).text.length?t.line<e.first+e.size-1?ae(t.line+1,0):null:new ae(t.line,t.ch+i)}function Io(e){e.setSelection(ae(e.firstLine(),0),ae(e.lastLine()),$l)}function zo(e,t,i){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return n.canceled=!0}};return i&&(n.update=function(t,i,o,r){t&&(n.from=me(e,t)),i&&(n.to=me(e,i)),o&&(n.text=o),void 0!==r&&(n.origin=r)}),H(e,"beforeChange",e,n),e.cm&&H(e.cm,"beforeChange",e.cm,n),n.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:n.from,to:n.to,text:n.text,origin:n.origin}}function Eo(e,t,n){if(e.cm){if(!e.cm.curOp)return wn(e.cm,Eo)(e,t,n);if(e.cm.state.suppressEdits)return}if(!((I(e,"beforeChange")||e.cm&&I(e.cm,"beforeChange"))&&(t=zo(e,t,!0),!t))){var o=cs&&!n&&Be(e,t.from,t.to);if(o)for(var r=o.length-1;0<=r;--r)Ro(e,{from:o[r].from,to:o[r].to,text:r?[""]:t.text,origin:t.origin});else Ro(e,t)}}function Ro(e,t){if(1!=t.text.length||""!=t.text[0]||0!=pe(t.from,t.to)){var i=_n(e,t);ho(e,t,i,e.cm?e.cm.curOp.id:NaN),Uo(e,t,i,Ee(e,t));var n=[];no(e,function(e,i){i||-1!=g(n,e.history)||(Xo(e.history,t),n.push(e.history)),Uo(e,t,null,Ee(e,t))})}}function Bo(e,t,n){var o=e.cm&&e.cm.state.suppressEdits;if(!o||n){for(var r=e.history,l=e.sel,s="undo"==t?r.done:r.undone,d="undo"==t?r.undone:r.done,a=0,p;a<s.length&&(p=s[a],n?!p.ranges||p.equals(e.sel):!!p.ranges);a++);if(a!=s.length){for(r.lastOrigin=r.lastSelOrigin=null;;)if(p=s.pop(),p.ranges){if(fo(p,d),n&&!p.equals(e.sel))return void Oo(e,p,{clearRedo:!1});l=p}else{if(o)return void s.push(p);break}var c=[];fo(l,d),d.push({changes:c,generation:r.generation}),r.generation=p.generation||++r.maxGeneration;for(var h=I(e,"beforeChange")||e.cm&&I(e.cm,"beforeChange"),u=function(n){var i=p.changes[n];if(i.origin=t,h&&!zo(e,i,!1))return s.length=0,{};c.push(ao(e,i));var o=n?_n(e,i):y(s);Uo(e,i,o,vo(e,i)),!n&&e.cm&&e.cm.scrollIntoView({from:i.from,to:Xn(i)});var r=[];no(e,function(e,t){t||-1!=g(r,e.history)||(Xo(e.history,i),r.push(e.history)),Uo(e,i,null,vo(e,i))})},f=p.changes.length-1,m;0<=f;--f)if(m=u(f),m)return m.v}}}function Go(e,t){if(0!=t&&(e.first+=t,e.sel=new Ns(x(e.sel.ranges,function(e){return new Os(ae(e.anchor.line+t,e.anchor.ch),ae(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Ai(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,n=i.viewFrom;n<i.viewTo;n++)Mi(e.cm,n,"gutter")}}function Uo(e,t,i,n){if(e.cm&&!e.cm.curOp)return wn(e.cm,Uo)(e,t,i,n);if(t.to.line<e.first)return void Go(e,t.text.length-1-(t.to.line-t.from.line));if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var o=t.text.length-1-(e.first-t.from.line);Go(e,o),t={from:ae(e.first,0),to:ae(t.to.line+o,t.to.ch),text:[y(t.text)],origin:t.origin}}var r=e.lastLine();t.to.line>r&&(t={from:t.from,to:ae(r,ee(e,r).text.length),text:[t.text[0]],origin:t.origin}),t.removed=te(e,t.from,t.to),i||(i=_n(e,t)),e.cm?$o(e.cm,t,n):io(e,t,n),Ao(e,i,$l),e.cantEdit&&Fo(e,ae(e.firstLine(),0))&&(e.cantEdit=!1)}}function $o(e,t,i){var n=e.doc,o=e.display,r=t.from,l=t.to,s=!1,d=r.line;e.options.lineWrapping||(d=re(Ze(ee(n,r.line))),n.iter(d,l.line+1,function(e){if(e==o.maxLine)return s=!0,!0})),-1<n.sel.contains(t.from,t.to)&&P(e),io(n,t,i,ki(e)),e.options.lineWrapping||(n.iter(d,r.line+t.text.length,function(e){var t=rt(e);t>o.maxLineLength&&(o.maxLine=e,o.maxLineLength=t,o.maxLineChanged=!0,s=!1)}),s&&(e.curOp.updateMaxLine=!0)),Ae(n,r.line),kn(e,400);var a=t.text.length-(l.line-r.line)-1;t.full?Ai(e):r.line!=l.line||1!=t.text.length||eo(e.doc,t)?Ai(e,r.line,l.line+1,a):Mi(e,r.line,"text");var p=I(e,"changes"),c=I(e,"change");if(c||p){var h={from:r,to:l,text:t.text,removed:t.removed,origin:t.origin};c&&St(e,"change",e,h),p&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(h)}e.display.selForContextMenu=null}function jo(e,t,i,n,o){var r;n||(n=i),0>pe(n,i)&&(r=[n,i],i=r[0],n=r[1]),"string"==typeof t&&(t=e.splitLines(t)),Eo(e,{from:i,to:n,text:t,origin:o})}function Vo(e,t,i,n){i<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function Ko(e,t,n,o){for(var r=0;r<e.length;++r){var l=e[r],s=!0;if(l.ranges){l.copied||(l=e[r]=l.deepCopy(),l.copied=!0);for(var d=0;d<l.ranges.length;d++)Vo(l.ranges[d].anchor,t,n,o),Vo(l.ranges[d].head,t,n,o);continue}for(var a=0,p;a<l.changes.length;++a)if(p=l.changes[a],n<p.from.line)p.from=ae(p.from.line+o,p.from.ch),p.to=ae(p.to.line+o,p.to.ch);else if(t<=p.to.line){s=!1;break}s||(e.splice(0,r+1),r=0)}}function Xo(e,t){var i=t.from.line,n=t.to.line,o=t.text.length-(n-i)-1;Ko(e.done,i,n,o),Ko(e.undone,i,n,o)}function Yo(e,t,i,n){var o=t,r=t;return("number"==typeof t?r=ee(e,fe(e,t)):o=re(t),null==o)?null:(n(r,o)&&e.cm&&Mi(e.cm,o,i),r)}function _o(e){var t=this;this.lines=e,this.parent=null;for(var n=0,o=0;o<e.length;++o)e[o].parent=t,n+=e[o].height;this.height=n}function qo(e){var t=this;this.children=e;for(var n=0,o=0,r=0,l;r<e.length;++r)l=e[r],n+=l.chunkSize(),o+=l.height,l.parent=t;this.size=n,this.height=o,this.parent=null}function Zo(e,t,i){ot(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Qi(e,i)}function Qo(e,t,i,n){var o=new As(e,i,n),r=e.cm;return r&&o.noHScroll&&(r.display.alignWidgets=!0),Yo(e,t,"widget",function(t){var i=t.widgets||(t.widgets=[]);if(null==o.insertAt?i.push(o):i.splice(Math.min(i.length-1,Math.max(0,o.insertAt)),0,o),o.line=t,r&&!it(e,t)){var n=ot(t)<e.scrollTop;oe(t,t.height+zt(o)),n&&Qi(r,o.height),r.curOp.forceUpdate=!0}return!0}),r&&St(r,"lineWidgetAdded",r,o,"number"==typeof t?t:re(t)),o}function Jo(e,t,n,o,l){if(o&&o.shared)return er(e,t,n,o,l);if(e.cm&&!e.cm.curOp)return wn(e.cm,Jo)(e,t,n,o,l);var s=new Ws(e,l),d=pe(t,n);if(o&&c(o,s,!1),0<d||0==d&&!1!==s.clearWhenEmpty)return s;if(s.replacedWith&&(s.collapsed=!0,s.widgetNode=r("span",[s.replacedWith],"CodeMirror-widget"),!o.handleMouseEvents&&s.widgetNode.setAttribute("cm-ignore-events","true"),o.insertLeft&&(s.widgetNode.insertLeft=!0)),s.collapsed){if(qe(e,t.line,t,n,s)||t.line!=n.line&&qe(e,n.line,t,n,s))throw new Error("Inserting collapsed marker partially overlapping an existing one");We()}s.addToHistory&&ho(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var a=t.line,p=e.cm,h;if(e.iter(a,n.line+1,function(e){p&&s.collapsed&&!p.options.lineWrapping&&Ze(e)==p.display.maxLine&&(h=!0),s.collapsed&&a!=t.line&&oe(e,0),Pe(e,new De(s,a==t.line?t.ch:null,a==n.line?n.ch:null)),++a}),s.collapsed&&e.iter(t.line,n.line+1,function(t){it(e,t)&&oe(t,0)}),s.clearOnEnter&&Ql(s,"beforeCursorEnter",function(){return s.clear()}),s.readOnly&&(Me(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),s.collapsed&&(s.id=++Ms,s.atomic=!0),p){if(h&&(p.curOp.updateMaxLine=!0),s.collapsed)Ai(p,t.line,n.line+1);else if(s.className||s.startStyle||s.endStyle||s.css||s.attributes||s.title)for(var g=t.line;g<=n.line;g++)Mi(p,g,"text");s.atomic&&Wo(p.doc),St(p,"markerAdded",p,s)}return s}function er(e,t,n,o,r){o=c(o),o.shared=!1;var l=[Jo(e,t,n,o,r)],s=l[0],d=o.widgetNode;return no(e,function(e){d&&(o.widgetNode=d.cloneNode(!0)),l.push(Jo(e,me(e,t),me(e,n),o,r));for(var a=0;a<e.linked.length;++a)if(e.linked[a].isParent)return;s=y(l)}),new Ds(l,s)}function tr(e){return e.findMarks(ae(e.first,0),e.clipPos(ae(e.lastLine())),function(e){return e.parent})}function ir(e,t){for(var n=0;n<t.length;n++){var o=t[n],r=o.find(),l=e.clipPos(r.from),s=e.clipPos(r.to);if(pe(l,s)){var d=Jo(e,l,s,o.primary,o.primary.type);o.markers.push(d),d.parent=o}}}function nr(e){for(var t=function(t){var i=e[t],n=[i.primary.doc];no(i.primary.doc,function(e){return n.push(e)});for(var o=0,r;o<i.markers.length;o++)r=i.markers[o],-1==g(n,r.doc)&&(r.parent=null,i.markers.splice(o--,1))},n=0;n<e.length;n++)t(n)}function or(t){var e=this;if(sr(e),!(F(e,t)||Et(e.display,t))){E(t),Sl&&(Ps=+new Date);var o=Ni(e,t,!0),r=t.dataTransfer.files;if(o&&!e.isReadOnly())if(r&&r.length&&window.FileReader&&window.File)for(var l=r.length,n=Array(l),s=0,d=function(){++s==l&&wn(e,function(){o=me(e.doc,o);var t={from:o,to:o,text:e.doc.splitLines(n.filter(function(e){return null!=e}).join(e.doc.lineSeparator())),origin:"paste"};Eo(e.doc,t),No(e.doc,Kn(me(e.doc,o),me(e.doc,Xn(t))))})()},a=function(t,o){if(e.options.allowDropFileTypes&&-1==g(e.options.allowDropFileTypes,t.type))return void d();var i=new FileReader;i.onerror=function(){return d()},i.onload=function(){var e=i.result;return /[\x00-\x08\x0e-\x1f]{2}/.test(e)?void d():void(n[o]=e,d())},i.readAsText(t)},p=0;p<r.length;p++)a(r[p],p);else{if(e.state.draggingText&&-1<e.doc.sel.contains(o))return e.state.draggingText(t),void setTimeout(function(){return e.display.input.focus()},20);try{var c=t.dataTransfer.getData("Text");if(c){var h;if(e.state.draggingText&&!e.state.draggingText.copy&&(h=e.listSelections()),Ao(e.doc,Kn(o,o)),h)for(var u=0;u<h.length;++u)jo(e.doc,"",h[u].anchor,h[u].head,"drag");e.replaceSelection(c,"around","paste"),e.display.input.focus()}}catch(t){}}}}function rr(t,i){if(Sl&&(!t.state.draggingText||100>+new Date-Ps))return void G(i);if(!(F(t,i)||Et(t.display,i))&&(i.dataTransfer.setData("Text",t.getSelection()),i.dataTransfer.effectAllowed="copyMove",i.dataTransfer.setDragImage&&!Tl)){var e=o("img",null,null,"position: fixed; left: 0; top: 0;");e.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",kl&&(e.width=e.height=1,t.display.wrapper.appendChild(e),e._top=e.offsetTop),i.dataTransfer.setDragImage(e,0,0),kl&&e.parentNode.removeChild(e)}}function lr(t,i){var e=Ni(t,i);if(e){var r=document.createDocumentFragment();zi(t,e,r),t.display.dragCursor||(t.display.dragCursor=o("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),t.display.lineSpace.insertBefore(t.display.dragCursor,t.display.cursorDiv)),n(t.display.dragCursor,r)}}function sr(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function dr(e){if(document.getElementsByClassName){for(var t=document.getElementsByClassName("CodeMirror"),n=[],o=0,r;o<t.length;o++)r=t[o].CodeMirror,r&&n.push(r);n.length&&n[0].operation(function(){for(var t=0;t<n.length;t++)e(n[t])})}}function ar(){Is||(pr(),Is=!0)}function pr(){var e;Ql(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,dr(cr)},100))}),Ql(window,"blur",function(){return dr(ji)})}function cr(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}function hr(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n=0,o,r,l,s,d;n<t.length-1;n++)if(d=t[n],/^(cmd|meta|m)$/i.test(d))s=!0;else if(/^a(lt)?$/i.test(d))o=!0;else if(/^(c|ctrl|control)$/i.test(d))r=!0;else if(/^s(hift)?$/i.test(d))l=!0;else throw new Error("Unrecognized modifier name: "+d);return o&&(e="Alt-"+e),r&&(e="Ctrl-"+e),s&&(e="Cmd-"+e),l&&(e="Shift-"+e),e}function gr(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var o=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if("..."==o){delete e[n];continue}for(var r=x(n.split(" "),hr),l=0;l<r.length;l++){var s=void 0,d=void 0;l==r.length-1?(d=r.join(" "),s=o):(d=r.slice(0,l+1).join(" "),s="...");var a=t[d];if(!a)t[d]=s;else if(a!=s)throw new Error("Inconsistent bindings for "+d)}delete e[n]}for(var p in t)e[p]=t[p];return e}function ur(e,t,n,o){t=xr(t);var r=t.call?t.call(e,o):t[e];if(!1===r)return"nothing";if("..."===r)return"multi";if(null!=r&&n(r))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return ur(e,t.fallthrough,n,o);for(var l=0,s;l<t.fallthrough.length;l++)if(s=ur(e,t.fallthrough[l],n,o),s)return s}}function fr(e){var t="string"==typeof e?e:zs[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function mr(e,t,i){var n=e;return t.altKey&&"Alt"!=n&&(e="Alt-"+e),(Il?t.metaKey:t.ctrlKey)&&"Ctrl"!=n&&(e="Ctrl-"+e),(Il?t.ctrlKey:t.metaKey)&&"Cmd"!=n&&(e="Cmd-"+e),!i&&t.shiftKey&&"Shift"!=n&&(e="Shift-"+e),e}function yr(e,t){if(kl&&34==e.keyCode&&e.char)return!1;var i=zs[e.keyCode];return!(null==i||e.altGraphKey)&&(3==e.keyCode&&e.code&&(i=e.code),mr(i,e,t))}function xr(e){return"string"==typeof e?Gs[e]:e}function vr(e,t){for(var n=e.doc.sel.ranges,o=[],r=0,l;r<n.length;r++){for(l=t(n[r]);o.length&&0>=pe(l.from,y(o).to);){var s=o.pop();if(0>pe(s.from,l.from)){l.from=s.from;break}}o.push(l)}Cn(e,function(){for(var t=o.length-1;0<=t;t--)jo(e.doc,"",o[t].from,o[t].to,"+delete");Ji(e)})}function br(e,t,i){var n=T(e.text,t+i,i);return 0>n||n>e.text.length?null:n}function Cr(e,t,i){var n=br(e,t.ch,i);return null==n?null:new ae(t.line,n,0>i?"after":"before")}function wr(e,t,i,n,o){if(e){"rtl"==t.doc.direction&&(o=-o);var r=M(i,t.doc.direction);if(r){var l=0>o?y(r):r[0],s=0>o==(1==l.level),d=s?"after":"before",a;if(0<l.level||"rtl"==t.doc.direction){var p=qt(t,i);a=0>o?i.text.length-1:0;var c=Zt(t,p,a).top;a=N(function(e){return Zt(t,p,e).top==c},0>o==(1==l.level)?l.from:l.to-1,a),"before"==d&&(a=br(i,a,1))}else a=0>o?l.to:l.from;return new ae(n,a,d)}}return new ae(n,0>o?i.text.length:0,0>o?"before":"after")}function Sr(e,t,i,n){var o=M(t,e.doc.direction);if(!o)return Cr(t,i,n);i.ch>=t.text.length?(i.ch=t.text.length,i.sticky="before"):0>=i.ch&&(i.ch=0,i.sticky="after");var r=A(o,i.ch,i.sticky),l=o[r];if("ltr"==e.doc.direction&&0==l.level%2&&(0<n?l.to>i.ch:l.from<i.ch))return Cr(t,i,n);var s=function(e,i){return br(t,e instanceof ae?e.ch:e,i)},d=function(i){return e.options.lineWrapping?(p=p||qt(e,t),mi(e,t,p,i)):{begin:0,end:t.text.length}},a=d("before"==i.sticky?s(i,-1):i.ch),p;if("rtl"==e.doc.direction||1==l.level){var c=1==l.level==0>n,h=s(i,c?1:-1);if(null!=h&&(c?h<=l.to&&h<=a.end:h>=l.from&&h>=a.begin)){var g=c?"before":"after";return new ae(i.line,h,g)}}var u=function(e,t,n){for(var r=function(e,t){return t?new ae(i.line,s(e,1),"before"):new ae(i.line,e,"after")};0<=e&&e<o.length;e+=t){var l=o[e],d=0<t==(1!=l.level),a=d?n.begin:s(n.end,-1);if(l.from<=a&&a<l.to)return r(a,d);if(a=d?l.from:s(l.to,-1),n.begin<=a&&a<n.end)return r(a,d)}},f=u(r+n,n,a);if(f)return f;var m=0<n?a.end:s(a.begin,-1);return null!=m&&!(0<n&&m==t.text.length)&&(f=u(0<n?0:o.length-1,n,d(m)),f)?f:null}function Lr(e,t){var i=ee(e.doc,t),n=Ze(i);return n!=i&&(t=re(n)),wr(!0,e,n,t,1)}function kr(e,t){var i=ee(e.doc,t),n=Qe(i);return n!=i&&(t=re(n)),wr(!0,e,i,t,-1)}function Tr(e,t){var i=Lr(e,t.line),n=ee(e.doc,i.line),o=M(n,e.doc.direction);if(!o||0==o[0].level){var r=Math.max(i.ch,n.text.search(/\S/)),l=t.line==i.line&&t.ch<=r&&t.ch;return ae(i.line,l?0:r,i.sticky)}return i}function Nr(e,t,i){if("string"==typeof t&&(t=Us[t],!t))return!1;e.display.input.ensurePolled();var n=e.display.shift,o=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),i&&(e.display.shift=!1),o=t(e)!=Ul}finally{e.display.shift=n,e.state.suppressEdits=!1}return o}function Or(e,t,n){for(var o=0,r;o<e.state.keyMaps.length;o++)if(r=ur(t,e.state.keyMaps[o],n,e),r)return r;return e.options.extraKeys&&ur(t,e.options.extraKeys,n,e)||ur(t,e.options.keyMap,n,e)}function Ar(t,i,n,e){var o=t.state.keySeq;if(o){if(fr(i))return"handled";if(/\'$/.test(i)?t.state.keySeq=null:$s.set(50,function(){t.state.keySeq==o&&(t.state.keySeq=null,t.display.input.reset())}),Mr(t,o+" "+i,n,e))return!0}return Mr(t,i,n,e)}function Mr(t,i,n,e){var o=Or(t,i,e);return"multi"==o&&(t.state.keySeq=i),"handled"==o&&St(t,"keyHandled",t,i,n),("handled"==o||"multi"==o)&&(E(n),Bi(t)),!!o}function Wr(t,i){var e=yr(i,!0);return!!e&&(i.shiftKey&&!t.state.keySeq?Ar(t,"Shift-"+e,i,function(e){return Nr(t,e,!0)})||Ar(t,e,i,function(e){if("string"==typeof e?/^go[A-Z]/.test(e):e.motion)return Nr(t,e)}):Ar(t,e,i,function(e){return Nr(t,e)}))}function Dr(t,i,e){return Ar(t,"'"+e+"'",i,function(e){return Nr(t,e,!0)})}function Hr(t){var e=this;if(!(t.target&&t.target!=e.display.input.getField())&&(e.curOp.focus=s(),!F(e,t))){Sl&&11>ie&&27==t.keyCode&&(t.returnValue=!1);var i=t.keyCode;e.display.shift=16==i||t.shiftKey;var n=Wr(e,t);kl&&(js=n?i:null,!n&&88==i&&!es&&(Dl?t.metaKey:t.ctrlKey)&&e.replaceSelection("",null,"cut")),vl&&!Dl&&!n&&46==i&&t.shiftKey&&!t.ctrlKey&&document.execCommand&&document.execCommand("cut"),18!=i||/\bCodeMirror-crosshair\b/.test(e.display.lineDiv.className)||Fr(e)}}function Fr(e){function t(n){18!=n.keyCode&&n.altKey||(El(i,"CodeMirror-crosshair"),D(document,"keyup",t),D(document,"mouseover",t))}var i=e.display.lineDiv;d(i,"CodeMirror-crosshair"),Ql(document,"keyup",t),Ql(document,"mouseover",t)}function Pr(t){16==t.keyCode&&(this.doc.sel.shift=!1),F(this,t)}function Ir(t){var e=this;if(!(t.target&&t.target!=e.display.input.getField())&&!(Et(e.display,t)||F(e,t)||t.ctrlKey&&!t.altKey||Dl&&t.metaKey)){var i=t.keyCode,n=t.charCode;if(kl&&i==js)return js=null,void E(t);if(!(kl&&(!t.which||10>t.which)&&Wr(e,t))){var o=String.fromCharCode(null==n?i:n);"\b"==o||Dr(e,t,o)||e.display.input.onKeyPress(t)}}}function zr(e,t){var i=+new Date;return qs&&qs.compare(i,e,t)?(_s=qs=null,"triple"):_s&&_s.compare(i,e,t)?(qs=new Vs(i,e,t),_s=null,"double"):(_s=new Vs(i,e,t),qs=null,"single")}function Er(t){var e=this,i=e.display;if(!(F(e,t)||i.activeTouch&&i.input.supportsTouch())){if(i.input.ensurePolled(),i.shift=t.shiftKey,Et(i,t))return void(at||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100)));if(!Xr(e,t)){var n=Ni(e,t),o=$(t),r=n?zr(n,o):"single";window.focus(),1==o&&e.state.selectingText&&e.state.selectingText(t),n&&Rr(e,o,n,r,t)||(1==o?n?Gr(e,n,r,t):U(t)==i.scroller&&E(t):2==o?(n&&wo(e.doc,n),setTimeout(function(){return i.input.focus()},20)):3==o&&(zl?e.display.input.onContextMenu(t):Ui(e)))}}}function Rr(e,t,i,n,o){var r="Click";return"double"==n?r="Double"+r:"triple"==n&&(r="Triple"+r),r=(1==t?"Left":2==t?"Middle":"Right")+r,Ar(e,mr(r,o),o,function(t){if("string"==typeof t&&(t=Us[t]),!t)return!1;var n=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n=t(e,i)!=Ul}finally{e.state.suppressEdits=!1}return n})}function Br(e,t,i){var n=e.getOption("configureMouse"),o=n?n(e,t,i):{};if(null==o.unit){var r=Hl?i.shiftKey&&i.metaKey:i.altKey;o.unit=r?"rectangle":"single"==t?"char":"double"==t?"word":"line"}return(null==o.extend||e.doc.extend)&&(o.extend=e.doc.extend||i.shiftKey),null==o.addNew&&(o.addNew=Dl?i.metaKey:i.ctrlKey),null==o.moveOnDrag&&(o.moveOnDrag=Dl?!i.altKey:!i.ctrlKey),o}function Gr(e,t,i,n){Sl?setTimeout(p(Gi,e),0):e.curOp.focus=s();var o=Br(e,i,n),r=e.doc.sel,l;e.options.dragDrop&&m&&!e.isReadOnly()&&"single"==i&&-1<(l=r.contains(t))&&(0>pe((l=r.ranges[l]).from(),t)||0<t.xRel)&&(0<pe(l.to(),t)||0>t.xRel)?Ur(e,n,t,o):jr(e,n,t,o)}function Ur(t,e,i,n){var o=t.display,r=!1,l=wn(t,function(a){at&&(o.scroller.draggable=!1),t.state.draggingText=!1,D(o.wrapper.ownerDocument,"mouseup",l),D(o.wrapper.ownerDocument,"mousemove",s),D(o.scroller,"dragstart",d),D(o.scroller,"drop",l),r||(E(a),!n.addNew&&wo(t.doc,i,null,null,n.extend),at&&!Tl||Sl&&9==ie?setTimeout(function(){o.wrapper.ownerDocument.body.focus({preventScroll:!0}),o.input.focus()},20):o.input.focus())}),s=function(t){r=r||10<=Math.abs(e.clientX-t.clientX)+Math.abs(e.clientY-t.clientY)},d=function(){return r=!0};at&&(o.scroller.draggable=!0),t.state.draggingText=l,l.copy=!n.moveOnDrag,o.scroller.dragDrop&&o.scroller.dragDrop(),Ql(o.wrapper.ownerDocument,"mouseup",l),Ql(o.wrapper.ownerDocument,"mousemove",s),Ql(o.scroller,"dragstart",d),Ql(o.scroller,"drop",l),Ui(t),setTimeout(function(){return o.input.focus()},20)}function $r(e,t,i){if("char"==i)return new Os(t,t);if("word"==i)return e.findWordAt(t);if("line"==i)return new Os(ae(t.line,0),me(e.doc,ae(t.line+1,0)));var n=i(e,t);return new Os(n.from,n.to)}function jr(t,e,i,n){function o(e){if(0!=pe(y,e))if(y=e,"rectangle"==n.unit){for(var o=[],r=t.options.tabSize,l=h(ee(a,i.line).text,i.ch,r),s=h(ee(a,e.line).text,e.ch,r),d=Math.min(l,s),c=Math.max(l,s),m=Math.min(i.line,e.line),x=Math.min(t.lastLine(),Math.max(i.line,e.line));m<=x;m++){var v=ee(a,m).text,b=u(v,d,r);d==c?o.push(new Os(ae(m,b),ae(m,b))):v.length>b&&o.push(new Os(ae(m,b),ae(m,u(v,c,r))))}o.length||o.push(new Os(i,i)),Oo(a,Vn(t,p.ranges.slice(0,f).concat(o),f),{origin:"*mouse",scroll:!1}),t.scrollIntoView(e)}else{var C=g,w=$r(t,e,n.unit),S=C.anchor,L;0<pe(w.anchor,S)?(L=w.head,S=ue(C.from(),w.anchor)):(L=w.anchor,S=ge(C.to(),w.head));var k=p.ranges.slice(0);k[f]=Vr(t,new Os(me(a,S),L)),Oo(a,Vn(t,k,f),jl)}}function r(i){var e=++v,l=Ni(t,i,!0,"rectangle"==n.unit);if(l)if(0!=pe(l,y)){t.curOp.focus=s(),o(l);var p=Xi(d,a);(l.line>=p.to||l.line<p.from)&&setTimeout(wn(t,function(){v==e&&r(i)}),150)}else{var c=i.clientY<x.top?-20:i.clientY>x.bottom?20:0;c&&setTimeout(wn(t,function(){v!=e||(d.scroller.scrollTop+=c,r(i))}),50)}}function l(i){t.state.selectingText=!1,v=1/0,i&&(E(i),d.input.focus()),D(d.wrapper.ownerDocument,"mousemove",b),D(d.wrapper.ownerDocument,"mouseup",C),a.history.lastSelOrigin=null}var d=t.display,a=t.doc;E(e);var p=a.sel,c=p.ranges,g,f;if(n.addNew&&!n.extend?(f=a.sel.contains(i),g=-1<f?c[f]:new Os(i,i)):(g=a.sel.primary(),f=a.sel.primIndex),"rectangle"==n.unit)n.addNew||(g=new Os(i,i)),i=Ni(t,e,!0,!0),f=-1;else{var m=$r(t,i,n.unit);g=n.extend?Co(g,m.anchor,m.head,n.extend):m}n.addNew?-1==f?(f=c.length,Oo(a,Vn(t,c.concat([g]),f),{scroll:!1,origin:"*mouse"})):1<c.length&&c[f].empty()&&"char"==n.unit&&!n.extend?(Oo(a,Vn(t,c.slice(0,f).concat(c.slice(f+1)),0),{scroll:!1,origin:"*mouse"}),p=a.sel):Lo(a,f,g,jl):(f=0,Oo(a,new Ns([g],0),jl),p=a.sel);var y=i,x=d.wrapper.getBoundingClientRect(),v=0,b=wn(t,function(t){0!==t.buttons&&$(t)?r(t):l(t)}),C=wn(t,l);t.state.selectingText=C,Ql(d.wrapper.ownerDocument,"mousemove",b),Ql(d.wrapper.ownerDocument,"mouseup",C)}function Vr(e,t){var i=t.anchor,n=t.head,o=ee(e.doc,i.line);if(0==pe(i,n)&&i.sticky==n.sticky)return t;var r=M(o);if(!r)return t;var l=A(r,i.ch,i.sticky),s=r[l];if(s.from!=i.ch&&s.to!=i.ch)return t;var d=l+(s.from==i.ch==(1!=s.level)?0:1);if(0==d||d==r.length)return t;var a;if(n.line!=i.line)a=0<(n.line-i.line)*("ltr"==e.doc.direction?1:-1);else{var p=A(r,n.ch,n.sticky),c=p-l||(n.ch-i.ch)*(1==s.level?-1:1);a=p==d-1||p==d?0>c:0<c}var h=r[d+(a?-1:0)],g=a==(1==h.level),u=g?h.from:h.to,f=g?"after":"before";return i.ch==u&&i.sticky==f?t:new Os(new ae(i.line,u,f),n)}function Kr(t,n,e,o){var r,l;if(n.touches)r=n.touches[0].clientX,l=n.touches[0].clientY;else try{r=n.clientX,l=n.clientY}catch(t){return!1}if(r>=Math.floor(t.display.gutters.getBoundingClientRect().right))return!1;o&&E(n);var s=t.display,d=s.lineDiv.getBoundingClientRect();if(l>d.bottom||!I(t,e))return B(n);l-=d.top-s.viewOffset;for(var a=0,p;a<t.display.gutterSpecs.length;++a)if(p=s.gutters.childNodes[a],p&&p.getBoundingClientRect().right>=r){var c=le(t.doc,l),h=t.display.gutterSpecs[a];return H(t,e,t,c,h.className,n),B(n)}}function Xr(t,i){return Kr(t,i,"gutterClick",!0)}function Yr(t,i){Et(t.display,i)||_r(t,i)||F(t,i,"contextmenu")||!zl&&t.display.input.onContextMenu(i)}function _r(t,i){return!!I(t,"gutterContextMenu")&&Kr(t,i,"gutterContextMenu",!1)}function qr(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),oi(e)}function Zr(e,t,i){if(!t!=!(i&&i!=Ks)){var n=e.display.dragFunctions,o=t?Ql:D;o(e.display.scroller,"dragstart",n.start),o(e.display.scroller,"dragenter",n.enter),o(e.display.scroller,"dragover",n.over),o(e.display.scroller,"dragleave",n.leave),o(e.display.scroller,"drop",n.drop)}}function Qr(e){e.options.lineWrapping?(d(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(El(e.display.wrapper,"CodeMirror-wrap"),lt(e)),Ti(e),Ai(e),oi(e),setTimeout(function(){return pn(e)},100)}function Jr(e,t){var n=this;if(!(this instanceof Jr))return new Jr(e,t);this.options=t=t?c(t):{},c(Xs,t,!1);var o=t.value;"string"==typeof o?o=new Fs(o,t.mode,null,t.lineSeparator,t.direction):t.mode&&(o.modeOption=t.mode),this.doc=o;var r=new Jr.inputStyles[t.inputStyle](this),l=this.display=new Gn(e,o,r,t);for(var s in l.wrapper.CodeMirror=this,qr(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),hn(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 Gl,keySeq:null,specialChars:null},t.autofocus&&!Wl&&l.input.focus(),Sl&&11>ie&&setTimeout(function(){return n.display.input.reset(!0)},20),el(this),ar(),gn(this),this.curOp.forceUpdate=!0,oo(this,o),t.autofocus&&!Wl||this.hasFocus()?setTimeout(p($i,this),20):ji(this),Ys)Ys.hasOwnProperty(s)&&Ys[s](n,t[s],Ks);zn(this),t.finishInit&&t.finishInit(this);for(var d=0;d<Zs.length;++d)Zs[d](n);un(this),at&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(l.lineDiv).textRendering&&(l.lineDiv.style.textRendering="auto")}function el(t){function i(){r.activeTouch&&(s=setTimeout(function(){return r.activeTouch=null},1e3),l=r.activeTouch,l.end=+new Date)}function n(t){if(1!=t.touches.length)return!1;var e=t.touches[0];return 1>=e.radiusX&&1>=e.radiusY}function o(e,t){if(null==t.left)return!0;var i=t.left-e.left,n=t.top-e.top;return 400<i*i+n*n}var r=t.display;Ql(r.scroller,"mousedown",wn(t,Er)),Sl&&11>ie?Ql(r.scroller,"dblclick",wn(t,function(i){if(!F(t,i)){var e=Ni(t,i);if(!(!e||Xr(t,i)||Et(t.display,i))){E(i);var n=t.findWordAt(e);wo(t.doc,n.anchor,n.head)}}})):Ql(r.scroller,"dblclick",function(i){return F(t,i)||E(i)}),Ql(r.scroller,"contextmenu",function(i){return Yr(t,i)}),Ql(r.input.getField(),"contextmenu",function(i){r.scroller.contains(i.target)||Yr(t,i)});var l={end:0},s;Ql(r.scroller,"touchstart",function(i){if(!F(t,i)&&!n(i)&&!Xr(t,i)){r.input.ensurePolled(),clearTimeout(s);var e=+new Date;r.activeTouch={start:e,moved:!1,prev:300>=e-l.end?l:null},1==i.touches.length&&(r.activeTouch.left=i.touches[0].pageX,r.activeTouch.top=i.touches[0].pageY)}}),Ql(r.scroller,"touchmove",function(){r.activeTouch&&(r.activeTouch.moved=!0)}),Ql(r.scroller,"touchend",function(n){var e=r.activeTouch;if(e&&!Et(r,n)&&null!=e.left&&!e.moved&&300>new Date-e.start){var l=t.coordsChar(r.activeTouch,"page"),s;s=!e.prev||o(e,e.prev)?new Os(l,l):!e.prev.prev||o(e,e.prev.prev)?t.findWordAt(l):new Os(ae(l.line,0),me(t.doc,ae(l.line+1,0))),t.setSelection(s.anchor,s.head),t.focus(),E(n)}i()}),Ql(r.scroller,"touchcancel",i),Ql(r.scroller,"scroll",function(){r.scroller.clientHeight&&(ln(t,r.scroller.scrollTop),dn(t,r.scroller.scrollLeft,!0),H(t,"scroll",t))}),Ql(r.scroller,"mousewheel",function(i){return jn(t,i)}),Ql(r.scroller,"DOMMouseScroll",function(i){return jn(t,i)}),Ql(r.wrapper,"scroll",function(){return r.wrapper.scrollTop=r.wrapper.scrollLeft=0}),r.dragFunctions={enter:function(i){F(t,i)||G(i)},over:function(i){F(t,i)||(lr(t,i),G(i))},start:function(i){return rr(t,i)},drop:wn(t,or),leave:function(i){F(t,i)||sr(t)}};var d=r.input.getField();Ql(d,"keyup",function(i){return Pr.call(t,i)}),Ql(d,"keydown",wn(t,Hr)),Ql(d,"keypress",wn(t,Ir)),Ql(d,"focus",function(i){return $i(t,i)}),Ql(d,"blur",function(i){return ji(t,i)})}function tl(e,t,n,o){var r=e.doc,l;null==n&&(n="add"),"smart"==n&&(r.mode.indent?l=Ce(e,t).state:n="prev");var s=e.options.tabSize,d=ee(r,t),a=h(d.text,null,s);d.stateAfter&&(d.stateAfter=null);var p=d.text.match(/^\s*/)[0],c;if(!o&&!/\S/.test(d.text))c=0,n="not";else if("smart"==n&&(c=r.mode.indent(l,d.text.slice(p.length),d.text),c==Ul||150<c)){if(!o)return;n="prev"}"prev"==n?t>r.first?c=h(ee(r,t-1).text,null,s):c=0:"add"==n?c=a+e.options.indentUnit:"subtract"==n?c=a-e.options.indentUnit:"number"==typeof n&&(c=a+n),c=Math.max(0,c);var g="",u=0;if(e.options.indentWithTabs)for(var m=Math.floor(c/s);m;--m)u+=s,g+="\t";if(u<c&&(g+=f(c-u)),g!=p)return jo(r,g,ae(t,0),ae(t,p.length),"+input"),d.stateAfter=null,!0;for(var y=0,x;y<r.sel.ranges.length;y++)if(x=r.sel.ranges[y],x.head.line==t&&x.head.ch<p.length){var v=ae(t,p.length);Lo(r,y,new Os(v,v));break}}function il(e){Qs=e}function nl(e,t,n,o,r){var l=e.doc;e.display.shift=!1,o||(o=l.sel);var s=+new Date-200,d="paste"==r||e.state.pasteIncoming>s,a=on(t),p=null;if(d&&1<o.ranges.length)if(!(Qs&&Qs.text.join("\n")==t))a.length==o.ranges.length&&e.options.pasteLinesPerSelection&&(p=x(a,function(e){return[e]}));else if(0==o.ranges.length%Qs.text.length){p=[];for(var c=0;c<Qs.text.length;c++)p.push(l.splitLines(Qs.text[c]))}for(var h=e.curOp.updateInput,g=o.ranges.length-1;0<=g;g--){var u=o.ranges[g],f=u.from(),m=u.to();u.empty()&&(n&&0<n?f=ae(f.line,f.ch-n):e.state.overwrite&&!d?m=ae(m.line,Math.min(ee(l,m.line).text.length,m.ch+y(a).length)):d&&Qs&&Qs.lineWise&&Qs.text.join("\n")==t&&(f=m=ae(f.line,0)));var v={from:f,to:m,text:p?p[g%p.length]:a,origin:r||(d?"paste":e.state.cutIncoming>s?"cut":"+input")};Eo(e.doc,v),St(e,"inputRead",e,v)}t&&!d&&rl(e,t),Ji(e),2>e.curOp.updateInput&&(e.curOp.updateInput=h),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ol(t,e){var i=t.clipboardData&&t.clipboardData.getData("Text");if(i)return t.preventDefault(),e.isReadOnly()||e.options.disableInput||Cn(e,function(){return nl(e,i,0,null,"paste")}),!0}function rl(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,o=n.ranges.length-1,r;0<=o;o--)if(r=n.ranges[o],!(100<r.head.ch||o&&n.ranges[o-1].head.line==r.head.line)){var l=e.getModeAt(r.head),s=!1;if(l.electricChars){for(var d=0;d<l.electricChars.length;d++)if(-1<t.indexOf(l.electricChars.charAt(d))){s=tl(e,r.head.line,"smart");break}}else l.electricInput&&l.electricInput.test(ee(e.doc,r.head.line).text.slice(0,r.head.ch))&&(s=tl(e,r.head.line,"smart"));s&&St(e,"electricInput",e,r.head.line)}}function ll(e){for(var t=[],n=[],o=0;o<e.doc.sel.ranges.length;o++){var r=e.doc.sel.ranges[o].head.line,l={anchor:ae(r,0),head:ae(r+1,0)};n.push(l),t.push(e.getRange(l.anchor,l.head))}return{text:t,ranges:n}}function sl(e,t,i,n){e.setAttribute("autocorrect",i?"":"off"),e.setAttribute("autocapitalize",n?"":"off"),e.setAttribute("spellcheck",!!t)}function dl(){var e=o("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=o("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return at?e.style.width="1000px":e.setAttribute("wrap","off"),Al&&(e.style.border="1px solid black"),sl(e),t}function al(e,t,i,n,o){function r(){var i=t.line+p;return!(i<e.first||i>=e.first+e.size)&&(t=new ae(i,t.ch,t.sticky),a=ee(e,i))}function l(n){var l;if(l=o?Sr(e.cm,a,t,i):Cr(a,t,i),null!=l)t=l;else if(!n&&r())t=wr(o,e.cm,a,t.line,p);else return!1;return!0}var s=t,d=i,a=ee(e,t.line),p=o&&"rtl"==e.direction?-i:i;if("char"==n)l();else if("column"==n)l(!0);else if("word"==n||"group"==n)for(var c=null,h="group"==n,g=e.cm&&e.cm.getHelper(t,"wordChars"),u=!0;;u=!1){if(0>i&&!l(!u))break;var f=a.text.charAt(t.ch)||"\n",m=S(f,g)?"w":h&&"\n"==f?"n":!h||/\s/.test(f)?null:"p";if(!h||u||m||(m="s"),c&&c!=m){0>i&&(i=1,l(),t.sticky="after");break}if(m&&(c=m),0<i&&!l(!u))break}var y=Fo(e,t,s,d,!0);return ce(s,y)&&(y.hitSide=!0),y}function pl(e,t,i,n){var o=e.doc,r=t.left,l;if("page"==n){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),d=Math.max(s-.5*Ci(e.display),3);l=(0<i?t.bottom:t.top)+i*d}else"line"==n&&(l=0<i?t.bottom+3:t.top-3);for(var a;;){if(a=ui(e,r,l),!a.outside)break;if(0>i?0>=l:l>=o.height){a.hitSide=!0;break}l+=5*i}return a}function cl(e,t){var i=_t(e,t.line);if(!i||i.hidden)return null;var n=ee(e.doc,t.line),o=Kt(i,n,t.line),r=M(n,e.doc.direction),l="left";if(r){var s=A(r,t.ch);l=s%2?"right":"left"}var d=Qt(o.map,t.ch,l);return d.offset="right"==d.collapse?d.end:d.start,d}function hl(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function gl(e,t){return t&&(e.bad=!0),e}function ul(e,t,i,n,o){function r(e){return function(t){return t.id==e}}function l(){p&&(a+=c,h&&(a+=c),p=h=!1)}function s(e){e&&(l(),a+=e)}function d(t){if(1==t.nodeType){var a=t.getAttribute("cm-text");if(a)return void s(a);var g=t.getAttribute("cm-marker"),u;if(g){var f=e.findMarks(ae(n,0),ae(o+1,0),r(+g));return void(f.length&&(u=f[0].find(0))&&s(te(e.doc,u.from,u.to).join(c)))}if("false"==t.getAttribute("contenteditable"))return;var m=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;m&&l();for(var y=0;y<t.childNodes.length;y++)d(t.childNodes[y]);/^(pre|p)$/i.test(t.nodeName)&&(h=!0),m&&(p=!0)}else 3==t.nodeType&&s(t.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(var a="",p=!1,c=e.doc.lineSeparator(),h=!1;;){if(d(t),t==i)break;t=t.nextSibling,h=!1}return a}function fl(e,t,n){var o;if(t==e.display.lineDiv){if(o=e.display.lineDiv.childNodes[n],!o)return gl(e.clipPos(ae(e.display.viewTo-1)),!0);t=null,n=0}else for(o=t;;o=o.parentNode){if(!o||o==e.display.lineDiv)return null;if(o.parentNode&&o.parentNode==e.display.lineDiv)break}for(var r=0,l;r<e.display.view.length;r++)if(l=e.display.view[r],l.node==o)return ml(l,t,n)}function ml(e,t,i){function n(t,n,o){for(var r=-1,l;r<(c?c.length:0);r++){l=0>r?p.map:c[r];for(var s=0,d;s<l.length;s+=3)if(d=l[s+2],d==t||d==n){var a=re(0>r?e.line:e.rest[r]),h=l[s]+o;return(0>o||d!=t)&&(h=l[s+(o?1:0)]),ae(a,h)}}}var o=e.text.firstChild,r=!1;if(!t||!l(o,t))return gl(ae(re(e.line),0),!0);if(t==o&&(r=!0,t=o.childNodes[i],i=0,!t)){var s=e.rest?y(e.rest):e.line;return gl(ae(re(s),s.text.length),r)}var d=3==t.nodeType?t:null,a=t;for(d||1!=t.childNodes.length||3!=t.firstChild.nodeType||(d=t.firstChild,i&&(i=d.nodeValue.length));a.parentNode!=o;)a=a.parentNode;var p=e.measure,c=p.maps,h=n(d,a,i);if(h)return gl(h,r);for(var g=a.nextSibling,u=d?d.nodeValue.length-i:0;g;g=g.nextSibling){if(h=n(g,g.firstChild,0),h)return gl(ae(h.line,h.ch-u),r);u+=g.textContent.length}for(var f=a.previousSibling,m=i;f;f=f.previousSibling){if(h=n(f,f.firstChild,-1),h)return gl(ae(h.line,h.ch+m),r);m+=f.textContent.length}}var yl=navigator.userAgent,xl=navigator.platform,vl=/gecko\/\d/i.test(yl),bl=/MSIE \d/.test(yl),Cl=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(yl),wl=/Edge\/(\d+)/.exec(yl),Sl=bl||Cl||wl,ie=Sl&&(bl?document.documentMode||6:+(wl||Cl)[1]),at=!wl&&/WebKit\//.test(yl),to=at&&/Qt\/\d+\.\d+/.test(yl),Ll=!wl&&/Chrome\//.test(yl),kl=/Opera\//.test(yl),Tl=/Apple Computer/.test(navigator.vendor),Nl=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(yl),Ol=/PhantomJS/.test(yl),Al=!wl&&/AppleWebKit/.test(yl)&&/Mobile\/\w+/.test(yl),Ml=/Android/.test(yl),Wl=Al||Ml||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(yl),Dl=Al||/Mac/.test(xl),Hl=/\bCrOS\b/.test(yl),Fl=/win/i.test(xl),Pl=kl&&yl.match(/Version\/(\d*\.\d*)/);Pl&&(Pl=+Pl[1]),Pl&&15<=Pl&&(kl=!1,at=!0);var Il=Dl&&(to||kl&&(null==Pl||12.11>Pl)),zl=vl||Sl&&9<=ie,El=function(t,i){var n=t.className,o=e(i).exec(n);if(o){var r=n.slice(o.index+o[0].length);t.className=n.slice(0,o.index)+(r?o[1]+r:"")}},Rl;Rl=document.createRange?function(e,t,i,n){var o=document.createRange();return o.setEnd(n||e,i),o.setStart(e,t),o}:function(e,t,i){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(t){return n}return n.collapse(!0),n.moveEnd("character",i),n.moveStart("character",t),n};var Bl=function(e){e.select()};Al?Bl=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:Sl&&(Bl=function(e){try{e.select()}catch(e){}});var Gl=function(){this.id=null,this.f=null,this.time=0,this.handler=p(this.onTimeout,this)};Gl.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Gl.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=i)};var Ul={toString:function(){return"CodeMirror.Pass"}},$l={scroll:!1},jl={origin:"*mouse"},Vl={origin:"+move"},Kl=[""],Xl=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Yl=/[\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]/,_l=null,ql=function(){function e(e){return 247>=e?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(e):1424<=e&&1524>=e?"R":1536<=e&&1785>=e?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(e-1536):1774<=e&&2220>=e?"r":8192<=e&&8203>=e?"w":8204==e?"b":"L"}function t(e,t,i){this.level=e,this.from=t,this.to=i}var i=/[stwN]/,n=/[LRr]/,o=/[Lb1n]/,r=/[1n]/;return function(l,s){var d="ltr"==s?"L":"R";if(0==l.length||"ltr"==s&&!/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/.test(l))return!1;for(var a=l.length,p=[],c=0;c<a;++c)p.push(e(l.charCodeAt(c)));for(var h=0,g=d,u;h<a;++h)u=p[h],"m"==u?p[h]=g:g=u;for(var f=0,x=d,v;f<a;++f)v=p[f],"1"==v&&"r"==x?p[f]="n":n.test(v)&&(x=v,"r"==v&&(p[f]="R"));for(var b=1,C=p[0],w;b<a-1;++b)w=p[b],"+"==w&&"1"==C&&"1"==p[b+1]?p[b]="1":","==w&&C==p[b+1]&&("1"==C||"n"==C)&&(p[b]=C),C=w;for(var S=0,L;S<a;++S)if(L=p[S],","==L)p[S]="N";else if("%"==L){var k=void 0;for(k=S+1;k<a&&"%"==p[k];++k);for(var T=S&&"!"==p[S-1]||k<a&&"1"==p[k]?"1":"N",N=S;N<k;++N)p[N]=T;S=k-1}for(var O=0,A=d,M;O<a;++O)M=p[O],"L"==A&&"1"==M?p[O]="L":n.test(M)&&(A=M);for(var W=0;W<a;++W)if(i.test(p[W])){var D=void 0;for(D=W+1;D<a&&i.test(p[D]);++D);for(var H="L"==(W?p[W-1]:d),F="L"==(D<a?p[D]:d),P=H==F?H?"L":"R":d,I=W;I<D;++I)p[I]=P;W=D-1}for(var z=[],E=0,R;E<a;)if(o.test(p[E])){var B=E;for(++E;E<a&&o.test(p[E]);++E);z.push(new t(0,B,E))}else{var G=E,U=z.length,$="rtl"==s?1:0;for(++E;E<a&&"L"!=p[E];++E);for(var V=G;V<E;)if(r.test(p[V])){G<V&&(z.splice(U,0,new t(1,G,V)),U+=$);var K=V;for(++V;V<E&&r.test(p[V]);++V);z.splice(U,0,new t(2,K,V)),U+=$,G=V}else++V;G<E&&z.splice(U,0,new t(1,G,E))}return"ltr"==s&&(1==z[0].level&&(R=l.match(/^\s+/))&&(z[0].from=R[0].length,z.unshift(new t(0,0,R[0].length))),1==y(z).level&&(R=l.match(/\s+$/))&&(y(z).to-=R[0].length,z.push(new t(0,a-R[0].length,a)))),"rtl"==s?z.reverse():z}}(),Zl=[],Ql=function(e,t,i){if(e.addEventListener)e.addEventListener(t,i,!1);else if(e.attachEvent)e.attachEvent("on"+t,i);else{var n=e._handlers||(e._handlers={});n[t]=(n[t]||Zl).concat(i)}},m=function(){if(Sl&&9>ie)return!1;var e=o("div");return"draggable"in e||"dragDrop"in e}(),on=3=="\n\nb".split(/\n/).length?function(e){return e.split(/\r\n?|\n/)}:function(e){for(var t=0,i=[],n=e.length,o;t<=n;){o=e.indexOf("\n",t),-1==o&&(o=e.length);var r=e.slice(t,"\r"==e.charAt(o-1)?o-1:o),l=r.indexOf("\r");-1==l?(i.push(r),t=o+1):(i.push(r.slice(0,l)),t+=l+1)}return i},Jl=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(t){}return!!(t&&t.parentElement()==e)&&0!=t.compareEndPoints("StartToEnd",t)},es=function(){var t=o("div");return!!("oncopy"in t)||(t.setAttribute("oncopy","return;"),"function"==typeof t.oncopy)}(),ts=null,is={},ns={},os={},rs=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i},ls,ss;rs.prototype.eol=function(){return this.pos>=this.string.length},rs.prototype.sol=function(){return this.pos==this.lineStart},rs.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},rs.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},rs.prototype.eat=function(e){var t=this.string.charAt(this.pos),i;if(i="string"==typeof e?t==e:t&&(e.test?e.test(t):e(t)),i)return++this.pos,t},rs.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},rs.prototype.eatSpace=function(){for(var e=this,t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++e.pos;return this.pos>t},rs.prototype.skipToEnd=function(){this.pos=this.string.length},rs.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(-1<t)return this.pos=t,!0},rs.prototype.backUp=function(e){this.pos-=e},rs.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=h(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?h(this.string,this.lineStart,this.tabSize):0)},rs.prototype.indentation=function(){return h(this.string,null,this.tabSize)-(this.lineStart?h(this.string,this.lineStart,this.tabSize):0)},rs.prototype.match=function(e,t,i){if("string"==typeof e){var n=function(e){return i?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);if(n(o)==n(e))return!1!==t&&(this.pos+=e.length),!0}else{var r=this.string.slice(this.pos).match(e);return r&&0<r.index?null:(r&&!1!==t&&(this.pos+=r[0].length),r)}},rs.prototype.current=function(){return this.string.slice(this.start,this.pos)},rs.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},rs.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},rs.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var ds=function(e,t){this.state=e,this.lookAhead=t},as=function(e,t,i,n){this.state=t,this.doc=e,this.line=i,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};as.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},as.prototype.baseToken=function(e){var t=this;if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)t.baseTokenPos+=2;var i=this.baseTokens[this.baseTokenPos+1];return{type:i&&i.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},as.prototype.nextLine=function(){this.line++,0<this.maxLookAhead&&this.maxLookAhead--},as.fromSaved=function(e,t,i){return t instanceof ds?new as(e,Z(e.mode,t.state),i,t.lookAhead):new as(e,Z(e.mode,t),i)},as.prototype.save=function(e){var t=!1===e?this.state:Z(this.doc.mode,this.state);return 0<this.maxLookAhead?new ds(t,this.maxLookAhead):t};var ps=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i},cs=!1,hs=!1,gs=function(e,t,i){this.text=e,Ue(this,t),this.height=i?i(this):1};gs.prototype.lineNo=function(){return re(this)},z(gs);var us={},fs={},ms=null,ys=null,xs={left:0,right:0,top:0,bottom:0},vs=function(e,t,i){this.cm=i;var n=this.vert=o("div",[o("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),r=this.horiz=o("div",[o("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=r.tabIndex=-1,e(n),e(r),Ql(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),Ql(r,"scroll",function(){r.clientWidth&&t(r.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,Sl&&8>ie&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")},bs;vs.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var o=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+o)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=i?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var r=e.viewWidth-e.barLeft-(i?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+r)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&0<e.clientHeight&&(0==n&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?n:0,bottom:t?n:0}},vs.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},vs.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},vs.prototype.zeroWidthHack=function(){var e=Dl&&!Nl?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Gl,this.disableVert=new Gl},vs.prototype.enableZeroWidthBar=function(e,t,i){function n(){var o=e.getBoundingClientRect(),r="vert"==i?document.elementFromPoint(o.right-1,(o.top+o.bottom)/2):document.elementFromPoint((o.right+o.left)/2,o.bottom-1);r==e?t.set(1e3,n):e.style.pointerEvents="none"}e.style.pointerEvents="auto",t.set(1e3,n)},vs.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Cs=function(){};Cs.prototype.update=function(){return{bottom:0,right:0}},Cs.prototype.setScrollLeft=function(){},Cs.prototype.setScrollTop=function(){},Cs.prototype.clear=function(){};var ws={native:vs,null:Cs},Ss=0,Ls=function(e,t,i){var n=e.display;this.viewport=t,this.visible=Xi(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=$t(e),this.force=i,this.dims=Si(e),this.events=[]};Ls.prototype.signal=function(e,t){I(e,t)&&this.events.push(arguments)},Ls.prototype.finish=function(){for(var e=this,t=0;t<this.events.length;t++)H.apply(null,e.events[t])};var ks=0,Ts=null;Sl?Ts=-.53:vl?Ts=15:Ll?Ts=-.7:Tl&&(Ts=-1/3);var Ns=function(e,t){this.ranges=e,this.primIndex=t};Ns.prototype.primary=function(){return this.ranges[this.primIndex]},Ns.prototype.equals=function(e){var t=this;if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var n=0;n<this.ranges.length;n++){var o=t.ranges[n],r=e.ranges[n];if(!ce(o.anchor,r.anchor)||!ce(o.head,r.head))return!1}return!0},Ns.prototype.deepCopy=function(){for(var e=this,t=[],n=0;n<this.ranges.length;n++)t[n]=new Os(he(e.ranges[n].anchor),he(e.ranges[n].head));return new Ns(t,this.primIndex)},Ns.prototype.somethingSelected=function(){for(var e=this,t=0;t<this.ranges.length;t++)if(!e.ranges[t].empty())return!0;return!1},Ns.prototype.contains=function(e,t){var n=this;t||(t=e);for(var o=0,r;o<this.ranges.length;o++)if(r=n.ranges[o],0<=pe(t,r.from())&&0>=pe(e,r.to()))return o;return-1};var Os=function(e,t){this.anchor=e,this.head=t};Os.prototype.from=function(){return ue(this.anchor,this.head)},Os.prototype.to=function(){return ge(this.anchor,this.head)},Os.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},_o.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=this,o=e,r;o<e+t;++o)r=n.lines[o],n.height-=r.height,dt(r),St(r,"delete");this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){var o=this;this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=o},iterN:function(t,i,n){for(var o=this,r=t+i;t<r;++t)if(n(o.lines[t]))return!0}},qo.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){var o=this;this.size-=t;for(var r=0;r<this.children.length;++r){var l=o.children[r],s=l.chunkSize();if(e<s){var d=Math.min(t,s-e),a=l.height;if(l.removeInner(e,d),o.height-=a-l.height,s==d&&(o.children.splice(r--,1),l.parent=null),0==(t-=d))break;e=0}else e-=s}if(25>this.size-t&&(1<this.children.length||!(this.children[0]instanceof _o))){var p=[];this.collapse(p),this.children=[new _o(p)],this.children[0].parent=this}},collapse:function(e){for(var t=this,n=0;n<this.children.length;++n)t.children[n].collapse(e)},insertInner:function(e,t,n){var o=this;this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var l=o.children[r],s=l.chunkSize();if(e<=s){if(l.insertInner(e,t,n),l.lines&&50<l.lines.length){for(var d=l.lines.length%25+25,a=d,p;a<l.lines.length;)p=new _o(l.lines.slice(a,a+=25)),l.height-=p.height,o.children.splice(++r,0,p),p.parent=o;l.lines=l.lines.slice(0,d),o.maybeSpill()}break}e-=s}},maybeSpill:function(){if(!(10>=this.children.length)){var e=this;do{var t=e.children.splice(e.children.length-5,5),i=new qo(t);if(!e.parent){var n=new qo(e.children);n.parent=e,e.children=[n,i],e=n}else{e.size-=i.size,e.height-=i.height;var o=g(e.parent.children,e);e.parent.children.splice(o+1,0,i)}i.parent=e.parent}while(10<e.children.length);e.parent.maybeSpill()}},iterN:function(e,t,o){for(var r=this,l=0;l<this.children.length;++l){var s=r.children[l],d=s.chunkSize();if(e<d){var a=Math.min(t,d-e);if(s.iterN(e,a,o))return!0;if(0==(t-=a))break;e=0}else e-=d}}};var As=function(e,t,i){var n=this;if(i)for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o]);this.doc=e,this.node=t};As.prototype.clear=function(){var e=this,t=this.doc.cm,n=this.line.widgets,o=this.line,r=re(o);if(null!=r&&n){for(var l=0;l<n.length;++l)n[l]==e&&n.splice(l--,1);n.length||(o.widgets=null);var s=zt(this);oe(o,Math.max(0,o.height-s)),t&&(Cn(t,function(){Zo(t,o,-s),Mi(t,r,"widget")}),St(t,"lineWidgetCleared",t,this,r))}},As.prototype.changed=function(){var e=this,t=this.height,i=this.doc.cm,n=this.line;this.height=null;var o=zt(this)-t;o&&(!it(this.doc,n)&&oe(n,n.height+o),i&&Cn(i,function(){i.curOp.forceUpdate=!0,Zo(i,n,o),St(i,"lineWidgetChanged",i,e,re(n))}))},z(As);var Ms=0,Ws=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++Ms};Ws.prototype.clear=function(){var e=this;if(!this.explicitlyCleared){var t=this.doc.cm,n=t&&!t.curOp;if(n&&gn(t),I(this,"clear")){var o=this.find();o&&St(this,"clear",o.from,o.to)}for(var r=null,l=null,s=0;s<this.lines.length;++s){var d=e.lines[s],a=He(d.markedSpans,e);t&&!e.collapsed?Mi(t,re(d),"text"):t&&(null!=a.to&&(l=re(d)),null!=a.from&&(r=re(d))),d.markedSpans=Fe(d.markedSpans,a),null==a.from&&e.collapsed&&!it(e.doc,d)&&t&&oe(d,Ci(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var p=0;p<this.lines.length;++p){var c=Ze(e.lines[p]),h=rt(c);h>t.display.maxLineLength&&(t.display.maxLine=c,t.display.maxLineLength=h,t.display.maxLineChanged=!0)}null!=r&&t&&this.collapsed&&Ai(t,r,l+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&Wo(t.doc)),t&&St(t,"markerCleared",t,this,r,l),n&&un(t),this.parent&&this.parent.clear()}},Ws.prototype.find=function(e,t){var n=this;null==e&&"bookmark"==this.type&&(e=1);for(var o=0,r,l;o<this.lines.length;++o){var s=n.lines[o],d=He(s.markedSpans,n);if(null!=d.from&&(r=ae(t?s:re(s),d.from),-1==e))return r;if(null!=d.to&&(l=ae(t?s:re(s),d.to),1==e))return l}return r&&{from:r,to:l}},Ws.prototype.changed=function(){var e=this,t=this.find(-1,!0),i=this,n=this.doc.cm;t&&n&&Cn(n,function(){var o=t.line,r=re(t.line),l=_t(n,r);if(l&&(ii(l),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!it(i.doc,o)&&null!=i.height){var s=i.height;i.height=null;var d=zt(i)-s;d&&oe(o,o.height+d)}St(n,"markerChanged",n,e)})},Ws.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=g(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Ws.prototype.detachLine=function(e){if(this.lines.splice(g(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},z(Ws);var Ds=function(e,t){var n=this;this.markers=e,this.primary=t;for(var o=0;o<e.length;++o)e[o].parent=n};Ds.prototype.clear=function(){var e=this;if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var t=0;t<this.markers.length;++t)e.markers[t].clear();St(this,"clear")}},Ds.prototype.find=function(e,t){return this.primary.find(e,t)},z(Ds);var Hs=0,Fs=function(e,t,i,n,o){if(!(this instanceof Fs))return new Fs(e,t,i,n,o);null==i&&(i=0),qo.call(this,[new _o([new gs("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=i;var r=ae(i,0);this.sel=Kn(r),this.history=new so(null),this.id=++Hs,this.modeOption=t,this.lineSep=n,this.direction="rtl"==o?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),io(this,{from:r,to:r,text:e}),Oo(this,Kn(r),$l)};Fs.prototype=C(qo.prototype,{constructor:Fs,iter:function(e,t,i){i?this.iterN(e-this.first,t-e,i):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,o=0;o<t.length;++o)n+=t[o].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=ne(this,this.first,this.first+this.size);return!1===e?t:t.join(e||this.lineSeparator())},setValue:Ln(function(e){var t=ae(this.first,0),i=this.first+this.size-1;Eo(this,{from:t,to:ae(i,ee(this,i).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&en(this.cm,0,0),Oo(this,Kn(t),$l)}),replaceRange:function(e,t,i,n){t=me(this,t),i=i?me(this,i):t,jo(this,e,t,i,n)},getRange:function(e,t,i){var n=te(this,me(this,e),me(this,t));return!1===i?n:n.join(i||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(se(this,e))return ee(this,e)},getLineNumber:function(e){return re(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=ee(this,e)),Ze(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return me(this,e)},getCursor:function(e){var t=this.sel.primary(),i;return i=null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||"to"==e||!1===e?t.to():t.from(),i},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Ln(function(e,t,i){ko(this,me(this,"number"==typeof e?ae(e,t||0):e),null,i)}),setSelection:Ln(function(e,t,i){ko(this,me(this,e),me(this,t||e),i)}),extendSelection:Ln(function(e,t,i){wo(this,me(this,e),t&&me(this,t),i)}),extendSelections:Ln(function(e,t){So(this,xe(this,e),t)}),extendSelectionsBy:Ln(function(e,t){var i=x(this.sel.ranges,e);So(this,xe(this,i),t)}),setSelections:Ln(function(e,t,n){var o=this;if(e.length){for(var r=[],l=0;l<e.length;l++)r[l]=new Os(me(o,e[l].anchor),me(o,e[l].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),Oo(this,Vn(this.cm,r,t),n)}}),addSelection:Ln(function(e,t,i){var n=this.sel.ranges.slice(0);n.push(new Os(me(this,e),me(this,t||e))),Oo(this,Vn(this.cm,n,n.length-1),i)}),getSelection:function(e){for(var t=this,n=this.sel.ranges,o=0,r,l;o<n.length;o++)l=te(t,n[o].from(),n[o].to()),r=r?r.concat(l):l;return!1===e?r:r.join(e||this.lineSeparator())},getSelections:function(e){for(var t=this,n=[],o=this.sel.ranges,r=0,l;r<o.length;r++)l=te(t,o[r].from(),o[r].to()),!1!==e&&(l=l.join(e||t.lineSeparator())),n[r]=l;return n},replaceSelection:function(e,t,n){for(var o=[],r=0;r<this.sel.ranges.length;r++)o[r]=e;this.replaceSelections(o,t,n||"+input")},replaceSelections:Ln(function(e,t,n){for(var o=this,r=[],l=this.sel,s=0,d;s<l.ranges.length;s++)d=l.ranges[s],r[s]={from:d.from(),to:d.to(),text:o.splitLines(e[s]),origin:n};for(var a=t&&"end"!=t&&Zn(this,r,t),p=r.length-1;0<=p;p--)Eo(o,r[p]);a?No(this,a):this.cm&&Ji(this.cm)}),undo:Ln(function(){Bo(this,"undo")}),redo:Ln(function(){Bo(this,"redo")}),undoSelection:Ln(function(){Bo(this,"undo",!0)}),redoSelection:Ln(function(){Bo(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,o=0;o<e.done.length;o++)e.done[o].ranges||++t;for(var r=0;r<e.undone.length;r++)e.undone[r].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new so(this.history.maxGeneration),no(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:bo(this.history.done),undone:bo(this.history.undone)}},setHistory:function(e){var t=this.history=new so(this.history.maxGeneration);t.done=bo(e.done.slice(0),null,!0),t.undone=bo(e.undone.slice(0),null,!0)},setGutterMarker:Ln(function(e,t,i){return Yo(this,e,"gutter",function(e){var n=e.gutterMarkers||(e.gutterMarkers={});return n[t]=i,!i&&L(n)&&(e.gutterMarkers=null),!0})}),clearGutter:Ln(function(e){var t=this;this.iter(function(i){i.gutterMarkers&&i.gutterMarkers[e]&&Yo(t,i,"gutter",function(){return i.gutterMarkers[e]=null,L(i.gutterMarkers)&&(i.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if("number"==typeof e){if(!se(this,e))return null;if(t=e,e=ee(this,e),!e)return null}else if(t=re(e),null==t)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:Ln(function(t,i,n){return Yo(this,t,"gutter"==i?"gutter":"class",function(t){var o="text"==i?"textClass":"background"==i?"bgClass":"gutter"==i?"gutterClass":"wrapClass";if(!t[o])t[o]=n;else{if(e(n).test(t[o]))return!1;t[o]+=" "+n}return!0})}),removeLineClass:Ln(function(t,i,n){return Yo(this,t,"gutter"==i?"gutter":"class",function(t){var o="text"==i?"textClass":"background"==i?"bgClass":"gutter"==i?"gutterClass":"wrapClass",r=t[o];if(!r)return!1;if(null==n)t[o]=null;else{var l=r.match(e(n));if(!l)return!1;var s=l.index+l[0].length;t[o]=r.slice(0,l.index)+(l.index&&s!=r.length?" ":"")+r.slice(s)||null}return!0})}),addLineWidget:Ln(function(e,t,i){return Qo(this,e,t,i)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,i){return Jo(this,me(this,e),me(this,t),i,i&&i.type||"range")},setBookmark:function(e,t){var i={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=me(this,e),Jo(this,e,e,i,"bookmark")},findMarksAt:function(e){e=me(this,e);var t=[],n=ee(this,e.line).markedSpans;if(n)for(var o=0,r;o<n.length;++o)r=n[o],(null==r.from||r.from<=e.ch)&&(null==r.to||r.to>=e.ch)&&t.push(r.marker.parent||r.marker);return t},findMarks:function(e,t,n){e=me(this,e),t=me(this,t);var o=[],r=e.line;return this.iter(e.line,t.line+1,function(l){var s=l.markedSpans;if(s)for(var d=0,a;d<s.length;d++)a=s[d],null!=a.to&&r==e.line&&e.ch>=a.to||null==a.from&&r!=e.line||null!=a.from&&r==t.line&&a.from>=t.ch||n&&!n(a.marker)||o.push(a.marker.parent||a.marker);++r}),o},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var o=0;o<n.length;++o)null!=n[o].from&&e.push(n[o].marker)}),e},posFromIndex:function(e){var t=this.first,i=this.lineSeparator().length,n;return this.iter(function(o){var r=o.text.length+i;return r>e?(n=e,!0):void(e-=r,++t)}),me(this,ae(t,n))},indexFromPos:function(e){e=me(this,e);var t=e.ch;if(e.line<this.first||0>e.ch)return 0;var i=this.lineSeparator().length;return this.iter(this.first,e.line,function(e){t+=e.text.length+i}),t},copy:function(e){var t=new Fs(ne(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,i=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<i&&(i=e.to);var n=new Fs(ne(this,t,i),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],ir(n,tr(this)),n},unlinkDoc:function(e){var t=this;if(e instanceof Jr&&(e=e.doc),this.linked)for(var n=0,o;n<this.linked.length;++n)if(o=t.linked[n],o.doc==e){t.linked.splice(n,1),e.unlinkDoc(t),nr(tr(t));break}if(e.history==this.history){var r=[e.id];no(e,function(e){return r.push(e.id)},!0),e.history=new so(null),e.history.done=bo(this.history.done,r),e.history.undone=bo(this.history.undone,r)}},iterLinkedDocs:function(e){no(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):on(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:Ln(function(e){"rtl"!=e&&(e="ltr"),e==this.direction||(this.direction=e,this.iter(function(e){return e.order=null}),this.cm&&lo(this.cm))})}),Fs.prototype.eachLine=Fs.prototype.iter;for(var Ps=0,Is=!1,zs={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Es=0;10>Es;Es++)zs[Es+48]=zs[Es+96]=Es+"";for(var Rs=65;90>=Rs;Rs++)zs[Rs]=String.fromCharCode(Rs);for(var Bs=1;12>=Bs;Bs++)zs[Bs+111]=zs[Bs+63235]="F"+Bs;var Gs={};Gs.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"},Gs.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"},Gs.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"},Gs.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"]},Gs["default"]=Dl?Gs.macDefault:Gs.pcDefault;var Us={selectAll:Io,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),$l)},killLine:function(e){return vr(e,function(t){if(t.empty()){var i=ee(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line<e.lastLine()?{from:t.head,to:ae(t.head.line+1,0)}:{from:t.head,to:ae(t.head.line,i)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){return vr(e,function(t){return{from:ae(t.from().line,0),to:me(e.doc,ae(t.to().line+1,0))}})},delLineLeft:function(e){return vr(e,function(e){return{from:ae(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(e){return vr(e,function(t){var i=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:i},"div");return{from:n,to:t.from()}})},delWrappedLineRight:function(e){return vr(e,function(t){var i=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div");return{from:t.from(),to:n}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(ae(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(ae(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return Lr(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return Tr(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return kr(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div")},Vl)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:i},"div")},Vl)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:i},"div");return n.ch<e.getLine(n.line).search(/\S/)?Tr(e,t.head):n},Vl)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"char")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection("\t")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),o=e.options.tabSize,r=0;r<n.length;r++){var l=n[r].from(),s=h(e.getLine(l.line),l.ch,o);t.push(f(o-s%o))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Cn(e,function(){for(var t=e.listSelections(),n=[],o=0;o<t.length;o++)if(t[o].empty()){var r=t[o].head,l=ee(e.doc,r.line).text;if(l)if(r.ch==l.length&&(r=new ae(r.line,r.ch-1)),0<r.ch)r=new ae(r.line,r.ch+1),e.replaceRange(l.charAt(r.ch-1)+l.charAt(r.ch-2),ae(r.line,r.ch-2),r,"+transpose");else if(r.line>e.doc.first){var s=ee(e.doc,r.line-1).text;s&&(r=new ae(r.line,1),e.replaceRange(l.charAt(0)+e.doc.lineSeparator()+s.charAt(s.length-1),ae(r.line-1,s.length-1),r,"+transpose"))}n.push(new Os(r,r))}e.setSelections(n)})},newlineAndIndent:function(e){return Cn(e,function(){for(var t=e.listSelections(),n=t.length-1;0<=n;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var o=0;o<t.length;o++)e.indentLine(t[o].from().line,null,!0);Ji(e)})},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}},$s=new Gl,js=null,Vs=function(e,t,i){this.time=e,this.pos=t,this.button=i};Vs.prototype.compare=function(e,t,i){return this.time+400>e&&0==pe(t,this.pos)&&i==this.button};var Ks={toString:function(){return"CodeMirror.Init"}},Xs={},Ys={},_s,qs;Jr.defaults=Xs,Jr.optionHandlers=Ys;var Zs=[];Jr.defineInitHook=function(e){return Zs.push(e)};var Qs=null,Js=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Gl,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Js.prototype.init=function(e){function t(i){for(var e=i.target;e;e=e.parentNode){if(e==l)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(e.className))break}return!1}function i(i){if(t(i)&&!F(r,i)){if(r.somethingSelected())il({lineWise:!1,text:r.getSelections()}),"cut"==i.type&&r.replaceSelection("",null,"cut");else{if(!r.options.lineWiseCopyCut)return;var e=ll(r);il({lineWise:!0,text:e.text}),"cut"==i.type&&r.operation(function(){r.setSelections(e.ranges,0,$l),r.replaceSelection("",null,"cut")})}if(i.clipboardData){i.clipboardData.clearData();var n=Qs.text.join("\n");if(i.clipboardData.setData("Text",n),i.clipboardData.getData("Text")==n)return void i.preventDefault()}var s=dl(),d=s.firstChild;r.display.lineSpace.insertBefore(s,r.display.lineSpace.firstChild),d.value=Qs.text.join("\n");var a=document.activeElement;Bl(d),setTimeout(function(){r.display.lineSpace.removeChild(s),a.focus(),a==l&&o.showPrimarySelection()},50)}}var n=this,o=this,r=o.cm,l=o.div=e.lineDiv;sl(l,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize),Ql(l,"paste",function(i){!t(i)||F(r,i)||ol(i,r)||11>=ie&&setTimeout(wn(r,function(){return n.updateFromDOM()}),20)}),Ql(l,"compositionstart",function(t){n.composing={data:t.data,done:!1}}),Ql(l,"compositionupdate",function(t){n.composing||(n.composing={data:t.data,done:!1})}),Ql(l,"compositionend",function(t){n.composing&&(t.data!=n.composing.data&&n.readFromDOMSoon(),n.composing.done=!0)}),Ql(l,"touchstart",function(){return o.forceCompositionEnd()}),Ql(l,"input",function(){n.composing||n.readFromDOMSoon()}),Ql(l,"copy",i),Ql(l,"cut",i)},Js.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Js.prototype.prepareSelection=function(){var e=Ii(this.cm,!1);return e.focus=document.activeElement==this.div,e},Js.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Js.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Js.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),n=i.from(),o=i.to();if(t.display.viewTo==t.display.viewFrom||n.line>=t.display.viewTo||o.line<t.display.viewFrom)return void e.removeAllRanges();var r=fl(t,e.anchorNode,e.anchorOffset),l=fl(t,e.focusNode,e.focusOffset);if(!r||r.bad||!l||l.bad||0!=pe(ue(r,l),n)||0!=pe(ge(r,l),o)){var s=t.display.view,d=n.line>=t.display.viewFrom&&cl(t,n)||{node:s[0].measure.map[2],offset:0},a=o.line<t.display.viewTo&&cl(t,o);if(!a){var p=s[s.length-1].measure,c=p.maps?p.maps[p.maps.length-1]:p.map;a={node:c[c.length-1],offset:c[c.length-2]-c[c.length-3]}}if(!d||!a)return void e.removeAllRanges();var h=e.rangeCount&&e.getRangeAt(0),g;try{g=Rl(d.node,d.offset,a.offset,a.node)}catch(t){}g&&(!vl&&t.state.focused?(e.collapse(d.node,d.offset),!g.collapsed&&(e.removeAllRanges(),e.addRange(g))):(e.removeAllRanges(),e.addRange(g)),h&&null==e.anchorNode?e.addRange(h):vl&&this.startGracePeriod()),this.rememberSelection()}},Js.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},Js.prototype.showMultipleSelections=function(e){n(this.cm.display.cursorDiv,e.cursors),n(this.cm.display.selectionDiv,e.selection)},Js.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Js.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return l(this.div,t)},Js.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Js.prototype.blur=function(){this.div.blur()},Js.prototype.getField=function(){return this.div},Js.prototype.supportsTouch=function(){return!0},Js.prototype.receivedFocus=function(){function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))}var t=this;this.selectionInEditor()?this.pollSelection():Cn(this.cm,function(){return t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,e)},Js.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Js.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e=this.getSelection(),t=this.cm;if(Ml&&Ll&&this.cm.display.gutterSpecs.length&&hl(e.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var i=fl(t,e.anchorNode,e.anchorOffset),n=fl(t,e.focusNode,e.focusOffset);i&&n&&Cn(t,function(){Oo(t.doc,Kn(i,n),$l),(i.bad||n.bad)&&(t.curOp.selectionChanged=!0)})}}},Js.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,i=e.doc.sel.primary(),n=i.from(),o=i.to();if(0==n.ch&&n.line>e.firstLine()&&(n=ae(n.line-1,ee(e.doc,n.line-1).length)),o.ch==ee(e.doc,o.line).text.length&&o.line<e.lastLine()&&(o=ae(o.line+1,0)),n.line<t.viewFrom||o.line>t.viewTo-1)return!1;var r,l,s;n.line==t.viewFrom||0==(r=Oi(e,n.line))?(l=re(t.view[0].line),s=t.view[0].node):(l=re(t.view[r].line),s=t.view[r-1].node.nextSibling);var d=Oi(e,o.line),a,p;if(d==t.view.length-1?(a=t.viewTo-1,p=t.lineDiv.lastChild):(a=re(t.view[d+1].line)-1,p=t.view[d+1].node.previousSibling),!s)return!1;for(var c=e.doc.splitLines(ul(e,s,p,l,a)),h=te(e.doc,ae(l,0),ae(a,ee(e.doc,a).text.length));1<c.length&&1<h.length;)if(y(c)==y(h))c.pop(),h.pop(),a--;else if(c[0]==h[0])c.shift(),h.shift(),l++;else break;for(var g=0,u=0,f=c[0],m=h[0],x=Math.min(f.length,m.length);g<x&&f.charCodeAt(g)==m.charCodeAt(g);)++g;for(var v=y(c),b=y(h),C=Math.min(v.length-(1==c.length?g:0),b.length-(1==h.length?g:0));u<C&&v.charCodeAt(v.length-u-1)==b.charCodeAt(b.length-u-1);)++u;if(1==c.length&&1==h.length&&l==n.line)for(;g&&g>n.ch&&v.charCodeAt(v.length-u-1)==b.charCodeAt(b.length-u-1);)g--,u++;c[c.length-1]=v.slice(0,v.length-u).replace(/^\u200b+/,""),c[0]=c[0].slice(g).replace(/\u200b+$/,"");var w=ae(l,g),S=ae(a,h.length?y(h).length-u:0);if(1<c.length||c[0]||pe(w,S))return jo(e.doc,c,w,S,"+input"),!0},Js.prototype.ensurePolled=function(){this.forceCompositionEnd()},Js.prototype.reset=function(){this.forceCompositionEnd()},Js.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Js.prototype.readFromDOMSoon=function(){var e=this;null!=this.readDOMTimeout||(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80))},Js.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Cn(this.cm,function(){return Ai(e.cm)})},Js.prototype.setUneditable=function(e){e.contentEditable="false"},Js.prototype.onKeyPress=function(t){0==t.charCode||this.composing||(t.preventDefault(),!this.cm.isReadOnly()&&wn(this.cm,nl)(this.cm,String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),0))},Js.prototype.readOnlyChanged=function(e){this.div.contentEditable=("nocursor"!=e)+""},Js.prototype.onContextMenu=function(){},Js.prototype.resetPosition=function(){},Js.prototype.needsContentAttribute=!0;var ed=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Gl,this.hasSelection=!1,this.composing=null};ed.prototype.init=function(t){function i(t){if(!F(r,t)){if(r.somethingSelected())il({lineWise:!1,text:r.getSelections()});else{if(!r.options.lineWiseCopyCut)return;var e=ll(r);il({lineWise:!0,text:e.text}),"cut"==t.type?r.setSelections(e.ranges,null,$l):(o.prevInput="",l.value=e.text.join("\n"),Bl(l))}"cut"==t.type&&(r.state.cutIncoming=+new Date)}}var n=this,o=this,r=this.cm;this.createField(t);var l=this.textarea;t.wrapper.insertBefore(this.wrapper,t.wrapper.firstChild),Al&&(l.style.width="0px"),Ql(l,"input",function(){Sl&&9<=ie&&n.hasSelection&&(n.hasSelection=null),o.poll()}),Ql(l,"paste",function(t){F(r,t)||ol(t,r)||(r.state.pasteIncoming=+new Date,o.fastPoll())}),Ql(l,"cut",i),Ql(l,"copy",i),Ql(t.scroller,"paste",function(i){if(!(Et(t,i)||F(r,i))){if(!l.dispatchEvent)return r.state.pasteIncoming=+new Date,void o.focus();var e=new Event("paste");e.clipboardData=i.clipboardData,l.dispatchEvent(e)}}),Ql(t.lineSpace,"selectstart",function(i){Et(t,i)||E(i)}),Ql(l,"compositionstart",function(){var e=r.getCursor("from");o.composing&&o.composing.range.clear(),o.composing={start:e,range:r.markText(e,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Ql(l,"compositionend",function(){o.composing&&(o.poll(),o.composing.range.clear(),o.composing=null)})},ed.prototype.createField=function(){this.wrapper=dl(),this.textarea=this.wrapper.firstChild},ed.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},ed.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,n=Ii(e);if(e.options.moveInputWithCursor){var o=ci(e,i.sel.primary().head,"div"),r=t.wrapper.getBoundingClientRect(),l=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,o.top+l.top-r.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,o.left+l.left-r.left))}return n},ed.prototype.showSelection=function(e){var t=this.cm,i=t.display;n(i.cursorDiv,e.cursors),n(i.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},ed.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing)){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i,t.state.focused&&Bl(this.textarea),Sl&&9<=ie&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",Sl&&9<=ie&&(this.hasSelection=null))}},ed.prototype.getField=function(){return this.textarea},ed.prototype.supportsTouch=function(){return!1},ed.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!Wl||s()!=this.textarea))try{this.textarea.focus()}catch(t){}},ed.prototype.blur=function(){this.textarea.blur()},ed.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},ed.prototype.receivedFocus=function(){this.slowPoll()},ed.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},ed.prototype.fastPoll=function(){function e(){var n=i.poll();n||t?(i.pollingFast=!1,i.slowPoll()):(t=!0,i.polling.set(60,e))}var t=!1,i=this;i.pollingFast=!0,i.polling.set(20,e)},ed.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||Jl(i)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var o=i.value;if(o==n&&!t.somethingSelected())return!1;if(Sl&&9<=ie&&this.hasSelection===o||Dl&&/[\uf700-\uf7ff]/.test(o))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var r=o.charCodeAt(0);if(8203!=r||n||(n="\u200B"),8666==r)return this.reset(),this.cm.execCommand("undo")}for(var s=0,d=Math.min(n.length,o.length);s<d&&n.charCodeAt(s)==o.charCodeAt(s);)++s;return Cn(t,function(){nl(t,o.slice(s),n.length-s,null,e.composing?"*compose":null),1e3<o.length||-1<o.indexOf("\n")?i.value=e.prevInput="":e.prevInput=o,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ed.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},ed.prototype.onKeyPress=function(){Sl&&9<=ie&&(this.hasSelection=null),this.fastPoll()},ed.prototype.onContextMenu=function(t){function e(){if(null!=s.selectionStart){var e=r.somethingSelected(),t="\u200B"+(e?s.value:"");s.value="\u21DA",s.value=t,o.prevInput=e?"":"\u200B",s.selectionStart=1,s.selectionEnd=t.length,l.selForContextMenu=r.doc.sel}}function n(){if(o.contextMenuPending==n&&(o.contextMenuPending=!1,o.wrapper.style.cssText=c,s.style.cssText=p,Sl&&9>ie&&l.scrollbars.setScrollTop(l.scroller.scrollTop=d),null!=s.selectionStart)){(!Sl||Sl&&9>ie)&&e();var t=0,a=function(){l.selForContextMenu==r.doc.sel&&0==s.selectionStart&&0<s.selectionEnd&&"\u200B"==o.prevInput?wn(r,Io)(r):10>t++?l.detectingSelectAll=setTimeout(a,500):(l.selForContextMenu=null,l.input.reset())};l.detectingSelectAll=setTimeout(a,200)}}var o=this,r=o.cm,l=r.display,s=o.textarea;o.contextMenuPending&&o.contextMenuPending();var i=Ni(r,t),d=l.scroller.scrollTop;if(i&&!kl){var a=r.options.resetSelectionOnContextMenu;a&&-1==r.doc.sel.contains(i)&&wn(r,Oo)(r.doc,Kn(i),$l);var p=s.style.cssText,c=o.wrapper.style.cssText,h=o.wrapper.offsetParent.getBoundingClientRect();o.wrapper.style.cssText="position: static",s.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(t.clientY-h.top-5)+"px; left: "+(t.clientX-h.left-5)+"px;\n z-index: 1000; background: "+(Sl?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";var g;if(at&&(g=window.scrollY),l.input.focus(),at&&window.scrollTo(null,g),l.input.reset(),r.somethingSelected()||(s.value=o.prevInput=" "),o.contextMenuPending=n,l.selForContextMenu=r.doc.sel,clearTimeout(l.detectingSelectAll),Sl&&9<=ie&&e(),zl){G(t);var u=function(){D(window,"mouseup",u),setTimeout(n,20)};Ql(window,"mouseup",u)}else setTimeout(n,50)}},ed.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},ed.prototype.setUneditable=function(){},ed.prototype.needsContentAttribute=!1,function(e){function t(t,n,o,r){e.defaults[t]=n,o&&(i[t]=r?function(e,t,i){i!=Ks&&o(e,t,i)}:o)}var i=e.optionHandlers;e.defineOption=t,e.Init=Ks,t("value","",function(e,t){return e.setValue(t)},!0),t("mode",null,function(e,t){e.doc.modeOption=t,Qn(e)},!0),t("indentUnit",2,Qn,!0),t("indentWithTabs",!1),t("smartIndent",!0),t("tabSize",4,function(e){Jn(e),oi(e),Ai(e)},!0),t("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,!!t){var n=[],o=e.doc.first;e.doc.iter(function(e){for(var i=0,r;;){if(r=e.text.indexOf(t,i),-1==r)break;i=r+t.length,n.push(ae(o,r))}o++});for(var r=n.length-1;0<=r;r--)jo(e.doc,t,n[r],ae(n[r].line,n[r].ch+t.length))}}),t("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(e,t,i){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),i!=Ks&&e.refresh()}),t("specialCharPlaceholder",ht,function(e){return e.refresh()},!0),t("electricChars",!0),t("inputStyle",Wl?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),t("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),t("autocorrect",!1,function(e,t){return e.getInputField().autocorrect=t},!0),t("autocapitalize",!1,function(e,t){return e.getInputField().autocapitalize=t},!0),t("rtlMoveVisually",!Fl),t("wholeLineUpdateBefore",!0),t("theme","default",function(e){qr(e),Bn(e)},!0),t("keyMap","default",function(e,t,i){var n=xr(t),o=i!=Ks&&xr(i);o&&o.detach&&o.detach(e,n),n.attach&&n.attach(e,o||null)}),t("extraKeys",null),t("configureMouse",null),t("lineWrapping",!1,Qr,!0),t("gutters",[],function(e,t){e.display.gutterSpecs=En(t,e.options.lineNumbers),Bn(e)},!0),t("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?Li(e.display)+"px":"0",e.refresh()},!0),t("coverGutterNextToScrollbar",!1,function(e){return pn(e)},!0),t("scrollbarStyle","native",function(e){hn(e),pn(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),t("lineNumbers",!1,function(e,t){e.display.gutterSpecs=En(e.options.gutters,t),Bn(e)},!0),t("firstLineNumber",1,Bn,!0),t("lineNumberFormatter",function(e){return e},Bn,!0),t("showCursorWhenSelecting",!1,Pi,!0),t("resetSelectionOnContextMenu",!0),t("lineWiseCopyCut",!0),t("pasteLinesPerSelection",!0),t("selectionsMayTouch",!1),t("readOnly",!1,function(e,t){"nocursor"==t&&(ji(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),t("screenReaderLabel",null,function(e,t){t=""===t?null:t,e.display.input.screenReaderLabelChanged(t)}),t("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),t("dragDrop",!0,Zr),t("allowDropFileTypes",null),t("cursorBlinkRate",530),t("cursorScrollMargin",0),t("cursorHeight",1,Pi,!0),t("singleCursorHeightPerLine",!0,Pi,!0),t("workTime",100),t("workDelay",100),t("flattenSpans",!0,Jn,!0),t("addModeClass",!1,Jn,!0),t("pollInterval",100),t("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),t("historyEventDelay",1250),t("viewportMargin",10,function(e){return e.refresh()},!0),t("maxHighlightLength",1e4,Jn,!0),t("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),t("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),t("autofocus",null),t("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0),t("phrases",null)}(Jr),function(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,i){var n=this.options,o=n[e];n[e]==i&&"mode"!=e||(n[e]=i,t.hasOwnProperty(e)&&wn(this,t[e])(this,i,o),H(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](xr(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;n<t.length;++n)if(t[n]==e||t[n].name==e)return t.splice(n,1),!0},addOverlay:Sn(function(t,i){var n=t.token?t:e.getMode(this.options,t);if(n.startState)throw new Error("Overlays may not be stateful.");v(this.state.overlays,{mode:n,modeSpec:t,opaque:i&&i.opaque,priority:i&&i.priority||0},function(e){return e.priority}),this.state.modeGen++,Ai(this)}),removeOverlay:Sn(function(e){for(var t=this,n=this.state.overlays,o=0,r;o<n.length;++o)if(r=n[o].modeSpec,r==e||"string"==typeof e&&r.name==e)return n.splice(o,1),t.state.modeGen++,void Ai(t)}),indentLine:Sn(function(e,t,i){"string"!=typeof t&&"number"!=typeof t&&(null==t?t=this.options.smartIndent?"smart":"prev":t=t?"add":"subtract"),se(this.doc,e)&&tl(this,e,t,i)}),indentSelection:Sn(function(e){for(var t=this,n=this.doc.sel.ranges,o=-1,r=0,l;r<n.length;r++)if(l=n[r],!l.empty()){var s=l.from(),d=l.to(),a=Math.max(o,s.line);o=Math.min(t.lastLine(),d.line-(d.ch?0:1))+1;for(var p=a;p<o;++p)tl(t,p,e);var c=t.doc.sel.ranges;0==s.ch&&n.length==c.length&&0<c[r].from().ch&&Lo(t.doc,r,new Os(s,c[r].to()),$l)}else l.head.line>o&&(tl(t,l.head.line,e,!0),o=l.head.line,r==t.doc.sel.primIndex&&Ji(t))}),getTokenAt:function(e,t){return ke(this,e,t)},getLineTokens:function(e,t){return ke(this,ae(e),t,!0)},getTokenTypeAt:function(e){e=me(this.doc,e);var t=be(this,ee(this.doc,e.line)),i=0,n=(t.length-1)/2,o=e.ch,r;if(0==o)r=t[2];else for(;;){var l=i+n>>1;if((l?t[2*l-1]:0)>=o)n=l;else if(t[2*l+1]<o)i=l+1;else{r=t[2*l+2];break}}var s=r?r.indexOf("overlay "):-1;return 0>s?r:0==s?null:r.slice(0,s-1)},getModeAt:function(t){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(t).state).mode:i},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var o=this,r=[];if(!n.hasOwnProperty(t))return r;var l=n[t],s=this.getModeAt(e);if("string"==typeof s[t])l[s[t]]&&r.push(l[s[t]]);else if(s[t])for(var d=0,a;d<s[t].length;d++)a=l[s[t][d]],a&&r.push(a);else s.helperType&&l[s.helperType]?r.push(l[s.helperType]):l[s.name]&&r.push(l[s.name]);for(var p=0,c;p<l._global.length;p++)c=l._global[p],c.pred(s,o)&&-1==g(r,c.val)&&r.push(c.val);return r},getStateAfter:function(e,t){var i=this.doc;return e=fe(i,null==e?i.first+i.size-1:e),Ce(this,e+1,t).state},cursorCoords:function(e,t){var i=this.doc.sel.primary(),n;return n=null==e?i.head:"object"==typeof e?me(this.doc,e):e?i.from():i.to(),ci(this,n,t||"page")},charCoords:function(e,t){return pi(this,me(this.doc,e),t||"page")},coordsChar:function(e,t){return e=ai(this,e,t||"page"),ui(this,e.left,e.top)},lineAtHeight:function(e,t){return e=ai(this,{top:e,left:0},t||"page").top,le(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,i){var n=!1,o;if("number"==typeof e){var r=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>r&&(e=r,n=!0),o=ee(this.doc,e)}else o=e;return di(this,o,{top:0,left:0},t||"page",i||n).top+(n?this.doc.height-ot(o):0)},defaultTextHeight:function(){return Ci(this.display)},defaultCharWidth:function(){return wi(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,i,n,o){var r=this.display;e=ci(this,me(this.doc,e));var l=e.bottom,s=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),r.sizer.appendChild(t),"over"==n)l=e.top;else if("above"==n||"near"==n){var d=Math.max(r.wrapper.clientHeight,this.doc.height),a=Math.max(r.sizer.clientWidth,r.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>d)&&e.top>t.offsetHeight?l=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=d&&(l=e.bottom),s+t.offsetWidth>a&&(s=a-t.offsetWidth)}t.style.top=l+"px",t.style.left=t.style.right="","right"==o?(s=r.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==o?s=0:"middle"==o&&(s=(r.sizer.clientWidth-t.offsetWidth)/2),t.style.left=s+"px"),i&&qi(this,{left:s,top:l,right:s+t.offsetWidth,bottom:l+t.offsetHeight})},triggerOnKeyDown:Sn(Hr),triggerOnKeyPress:Sn(Ir),triggerOnKeyUp:Pr,triggerOnMouseDown:Sn(Er),execCommand:function(e){if(Us.hasOwnProperty(e))return Us[e].call(null,this)},triggerElectric:Sn(function(e){rl(this,e)}),findPosH:function(e,t,n,o){var r=this,l=1;0>t&&(l=-1,t=-t);for(var s=me(this.doc,e),d=0;d<t&&(s=al(r.doc,s,l,n,o),!s.hitSide);++d);return s},moveH:Sn(function(e,t){var i=this;this.extendSelectionsBy(function(n){return i.display.shift||i.doc.extend||n.empty()?al(i.doc,n.head,e,t,i.options.rtlMoveVisually):0>e?n.from():n.to()},Vl)}),deleteH:Sn(function(e,t){var i=this.doc.sel,n=this.doc;i.somethingSelected()?n.replaceSelection("",null,"+delete"):vr(this,function(i){var o=al(n,i.head,e,t,!1);return 0>e?{from:o,to:i.head}:{from:i.head,to:o}})}),findPosV:function(e,t,n,o){var r=this,l=1,s=o;0>t&&(l=-1,t=-t);for(var d=me(this.doc,e),a=0,p;a<t&&(p=ci(r,d,"div"),null==s?s=p.left:p.left=s,d=pl(r,p,l,n),!d.hitSide);++a);return d},moveV:Sn(function(e,t){var n=this,o=this.doc,r=[],l=!this.display.shift&&!o.extend&&o.sel.somethingSelected();if(o.extendSelectionsBy(function(i){if(l)return 0>e?i.from():i.to();var s=ci(n,i.head,"div");null!=i.goalColumn&&(s.left=i.goalColumn),r.push(s.left);var d=pl(n,s,e,t);return"page"==t&&i==o.sel.primary()&&Qi(n,pi(n,d,"div").top-s.top),d},Vl),r.length)for(var s=0;s<o.sel.ranges.length;s++)o.sel.ranges[s].goalColumn=r[s]}),findWordAt:function(e){var t=this.doc,i=ee(t,e.line).text,n=e.ch,o=e.ch;if(i){var r=this.getHelper(e,"wordChars");("before"==e.sticky||o==i.length)&&n?--n:++o;for(var l=i.charAt(n),s=S(l,r)?function(e){return S(e,r)}:/\s/.test(l)?function(e){return /\s/.test(e)}:function(e){return!/\s/.test(e)&&!S(e)};0<n&&s(i.charAt(n-1));)--n;for(;o<i.length&&s(i.charAt(o));)++o}return new Os(ae(e.line,n),ae(e.line,o))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?d(this.display.cursorDiv,"CodeMirror-overwrite"):El(this.display.cursorDiv,"CodeMirror-overwrite"),H(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==s()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Sn(function(e,t){en(this,e,t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-Ut(this)-this.display.barHeight,width:e.scrollWidth-Ut(this)-this.display.barWidth,clientHeight:jt(this),clientWidth:$t(this)}},scrollIntoView:Sn(function(e,t){null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:ae(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null==e.from.line?rn(this,e.from,e.to,e.margin):tn(this,e)}),setSize:Sn(function(e,t){var i=this,n=function(e){return"number"==typeof e||/^\d+$/.test(e+"")?e+"px":e};null!=e&&(this.display.wrapper.style.width=n(e)),null!=t&&(this.display.wrapper.style.height=n(t)),this.options.lineWrapping&&ni(this);var o=this.display.viewFrom;this.doc.iter(o,this.display.viewTo,function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){Mi(i,o,"widget");break}++o}),this.curOp.forceUpdate=!0,H(this,"refresh",this)}),operation:function(e){return Cn(this,e)},startOperation:function(){return gn(this)},endOperation:function(){return un(this)},refresh:Sn(function(){var e=this.display.cachedTextHeight;Ai(this),this.curOp.forceUpdate=!0,oi(this),en(this,this.doc.scrollLeft,this.doc.scrollTop),Fn(this.display),(null==e||.5<Math.abs(e-Ci(this.display))||this.options.lineWrapping)&&Ti(this),H(this,"refresh",this)}),swapDoc:Sn(function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),oo(this,e),oi(this),this.display.input.reset(),en(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,St(this,"swapDoc",this,t),t}),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},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}},z(e),e.registerHelper=function(t,i,o){n.hasOwnProperty(t)||(n[t]=e[t]={_global:[]}),n[t][i]=o},e.registerGlobalHelper=function(t,i,o,r){e.registerHelper(t,i,r),n[t]._global.push({pred:o,val:r})}}(Jr);var td=["iter","insert","remove","copy","getEditor","constructor"];for(var id in Fs.prototype)Fs.prototype.hasOwnProperty(id)&&0>g(td,id)&&(Jr.prototype[id]=function(e){return function(){return e.apply(this.doc,arguments)}}(Fs.prototype[id]));return z(Fs),Jr.inputStyles={textarea:ed,contenteditable:Js},Jr.defineMode=function(e){Jr.defaults.mode||"null"==e||(Jr.defaults.mode=e),X.apply(this,arguments)},Jr.defineMIME=function(e,t){ns[e]=t},Jr.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Jr.defineMIME("text/plain","null"),Jr.defineExtension=function(e,t){Jr.prototype[e]=t},Jr.defineDocExtension=function(e,t){Fs.prototype[e]=t},Jr.fromTextArea=function(e,t){function i(){e.value=d.getValue()}if(t=t?c(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var n=s();t.autofocus=n==e||null!=e.getAttribute("autofocus")&&n==document.body}var o;if(e.form&&(Ql(e.form,"submit",i),!t.leaveSubmitMethodAlone)){var r=e.form;o=r.submit;try{var l=r.submit=function(){i(),r.submit=o,r.submit(),r.submit=l}}catch(t){}}t.finishInit=function(n){n.save=i,n.getTextArea=function(){return e},n.toTextArea=function(){n.toTextArea=isNaN,i(),e.parentNode.removeChild(n.getWrapperElement()),e.style.display="",e.form&&(D(e.form,"submit",i),!t.leaveSubmitMethodAlone&&"function"==typeof e.form.submit&&(e.form.submit=o))}},e.style.display="none";var d=Jr(function(t){return e.parentNode.insertBefore(t,e.nextSibling)},t);return d},function(e){e.off=D,e.on=Ql,e.wheelEventPixels=$n,e.Doc=Fs,e.splitLines=on,e.countColumn=h,e.findColumn=u,e.isWordChar=w,e.Pass=Ul,e.signal=H,e.Line=gs,e.changeEnd=Xn,e.scrollbarModel=ws,e.Pos=ae,e.cmpPos=pe,e.modes=is,e.mimeModes=ns,e.resolveMode=Y,e.getMode=_,e.modeExtensions=os,e.extendMode=q,e.copyState=Z,e.startState=J,e.innerMode=Q,e.commands=Us,e.keyMap=Gs,e.keyName=yr,e.isModifierKey=fr,e.lookupKey=ur,e.normalizeKeyMap=gr,e.StringStream=rs,e.SharedTextMarker=Ds,e.TextMarker=Ws,e.LineWidget=As,e.e_preventDefault=E,e.e_stopPropagation=R,e.e_stop=G,e.addClass=d,e.contains=l,e.rmClass=El,e.keyNames=zs}(Jr),Jr.version="5.54.0",Jr}); |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.009 ]-- |