Private
Server IP : 195.201.23.43  /  Your IP : 18.119.28.119
Web Server : Apache
System : Linux webserver2.vercom.be 5.4.0-192-generic #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 x86_64
User : kdecoratie ( 1041)
PHP Version : 7.1.33-63+ubuntu20.04.1+deb.sury.org+1
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/kdecoratie/public_html/media/editors/codemirror/lib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

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