1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-6dff9be1","chunk-b7b74f52","chunk-b7b74f52"],{"408a":function(e,t,n){var r=n("e330");e.exports=r(1..valueOf)},"56b3":function(e,t,n){(function(t,n){e.exports=n()})(0,(function(){"use strict";var e=navigator.userAgent,t=navigator.platform,n=/gecko\/\d/i.test(e),r=/MSIE \d/.test(e),i=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),o=/Edge\/(\d+)/.exec(e),l=r||i||o,a=l&&(r?document.documentMode||6:+(o||i)[1]),s=!o&&/WebKit\//.test(e),u=s&&/Qt\/\d+\.\d+/.test(e),c=!o&&/Chrome\//.test(e),h=/Opera\//.test(e),f=/Apple Computer/.test(navigator.vendor),d=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),p=/PhantomJS/.test(e),g=f&&(/Mobile\/\w+/.test(e)||navigator.maxTouchPoints>2),v=/Android/.test(e),m=g||v||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),y=g||/Mac/.test(t),b=/\bCrOS\b/.test(e),w=/win/i.test(t),x=h&&e.match(/Version\/(\d*\.\d*)/);x&&(x=Number(x[1])),x&&x>=15&&(h=!1,s=!0);var C=y&&(u||h&&(null==x||x<12.11)),S=n||l&&a>=9;function k(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var L,T=function(e,t){var n=e.className,r=k(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function M(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function N(e,t){return M(e).appendChild(t)}function O(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function A(e,t,n,r){var i=O(e,t,n,r);return i.setAttribute("role","presentation"),i}function D(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do{if(11==t.nodeType&&(t=t.host),t==e)return!0}while(t=t.parentNode)}function W(){var e;try{e=document.activeElement}catch(t){e=document.body||null}while(e&&e.shadowRoot&&e.shadowRoot.activeElement)e=e.shadowRoot.activeElement;return e}function E(e,t){var n=e.className;k(t).test(n)||(e.className+=(n?" ":"")+t)}function F(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!k(n[r]).test(t)&&(t+=" "+n[r]);return t}L=document.createRange?function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};var H=function(e){e.select()};function I(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function P(e,t,n){for(var r in t||(t={}),e)!e.hasOwnProperty(r)||!1===n&&t.hasOwnProperty(r)||(t[r]=e[r]);return t}function z(e,t,n,r,i){null==t&&(t=e.search(/[^\s\u00a0]/),-1==t&&(t=e.length));for(var o=r||0,l=i||0;;){var a=e.indexOf("\t",o);if(a<0||a>=t)return l+(t-o);l+=a-o,l+=n-l%n,o=a+1}}g?H=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:l&&(H=function(e){try{e.select()}catch(t){}});var R=function(){this.id=null,this.f=null,this.time=0,this.handler=I(this.onTimeout,this)};function B(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}R.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},R.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};var _=50,G={toString:function(){return"CodeMirror.Pass"}},U={scroll:!1},V={origin:"*mouse"},j={origin:"+move"};function K(e,t,n){for(var r=0,i=0;;){var o=e.indexOf("\t",r);-1==o&&(o=e.length);var l=o-r;if(o==e.length||i+l>=t)return r+Math.min(l,t-i);if(i+=o-r,i+=n-i%n,r=o+1,i>=t)return r}}var $=[""];function X(e){while($.length<=e)$.push(Y($)+" ");return $[e]}function Y(e){return e[e.length-1]}function q(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Z(e,t,n){var r=0,i=n(t);while(r<e.length&&n(e[r])<=i)r++;e.splice(r,0,t)}function J(){}function Q(e,t){var n;return Object.create?n=Object.create(e):(J.prototype=e,n=new J),t&&P(t,n),n}var ee=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function te(e){return/\w/.test(e)||e>""&&(e.toUpperCase()!=e.toLowerCase()||ee.test(e))}function ne(e,t){return t?!!(t.source.indexOf("\\w")>-1&&te(e))||t.test(e):te(e)}function re(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ie=/[\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]/;function oe(e){return e.charCodeAt(0)>=768&&ie.test(e)}function le(e,t,n){while((n<0?t>0:t<e.length)&&oe(e.charAt(t)))t+=n;return t}function ae(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,o=r<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:n;e(o)?n=o:t=o+r}}function se(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,o=0;o<e.length;++o){var l=e[o];(l.from<n&&l.to>t||t==n&&l.to==t)&&(r(Math.max(l.from,t),Math.min(l.to,n),1==l.level?"rtl":"ltr",o),i=!0)}i||r(t,n,"ltr")}var ue=null;function ce(e,t,n){var r;ue=null;for(var i=0;i<e.length;++i){var o=e[i];if(o.from<t&&o.to>t)return i;o.to==t&&(o.from!=o.to&&"before"==n?r=i:ue=i),o.from==t&&(o.from!=o.to&&"before"!=n?r=i:ue=i)}return null!=r?r:ue}var he=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(n){return n<=247?e.charAt(n):1424<=n&&n<=1524?"R":1536<=n&&n<=1785?t.charAt(n-1536):1774<=n&&n<=2220?"r":8192<=n&&n<=8203?"w":8204==n?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,o=/[LRr]/,l=/[Lb1n]/,a=/[1n]/;function s(e,t,n){this.level=e,this.from=t,this.to=n}return function(e,t){var u="ltr"==t?"L":"R";if(0==e.length||"ltr"==t&&!r.test(e))return!1;for(var c=e.length,h=[],f=0;f<c;++f)h.push(n(e.charCodeAt(f)));for(var d=0,p=u;d<c;++d){var g=h[d];"m"==g?h[d]=p:p=g}for(var v=0,m=u;v<c;++v){var y=h[v];"1"==y&&"r"==m?h[v]="n":o.test(y)&&(m=y,"r"==y&&(h[v]="R"))}for(var b=1,w=h[0];b<c-1;++b){var x=h[b];"+"==x&&"1"==w&&"1"==h[b+1]?h[b]="1":","!=x||w!=h[b+1]||"1"!=w&&"n"!=w||(h[b]=w),w=x}for(var C=0;C<c;++C){var S=h[C];if(","==S)h[C]="N";else if("%"==S){var k=void 0;for(k=C+1;k<c&&"%"==h[k];++k);for(var L=C&&"!"==h[C-1]||k<c&&"1"==h[k]?"1":"N",T=C;T<k;++T)h[T]=L;C=k-1}}for(var M=0,N=u;M<c;++M){var O=h[M];"L"==N&&"1"==O?h[M]="L":o.test(O)&&(N=O)}for(var A=0;A<c;++A)if(i.test(h[A])){var D=void 0;for(D=A+1;D<c&&i.test(h[D]);++D);for(var W="L"==(A?h[A-1]:u),E="L"==(D<c?h[D]:u),F=W==E?W?"L":"R":u,H=A;H<D;++H)h[H]=F;A=D-1}for(var I,P=[],z=0;z<c;)if(l.test(h[z])){var R=z;for(++z;z<c&&l.test(h[z]);++z);P.push(new s(0,R,z))}else{var B=z,_=P.length,G="rtl"==t?1:0;for(++z;z<c&&"L"!=h[z];++z);for(var U=B;U<z;)if(a.test(h[U])){B<U&&(P.splice(_,0,new s(1,B,U)),_+=G);var V=U;for(++U;U<z&&a.test(h[U]);++U);P.splice(_,0,new s(2,V,U)),_+=G,B=U}else++U;B<z&&P.splice(_,0,new s(1,B,z))}return"ltr"==t&&(1==P[0].level&&(I=e.match(/^\s+/))&&(P[0].from=I[0].length,P.unshift(new s(0,0,I[0].length))),1==Y(P).level&&(I=e.match(/\s+$/))&&(Y(P).to-=I[0].length,P.push(new s(0,c-I[0].length,c)))),"rtl"==t?P.reverse():P}}();function fe(e,t){var n=e.order;return null==n&&(n=e.order=he(e.text,t)),n}var de=[],pe=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||de).concat(n)}};function ge(e,t){return e._handlers&&e._handlers[t]||de}function ve(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var o=B(i,n);o>-1&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function me(e,t){var n=ge(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function ye(e,t,n){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),me(e,n||t.type,e,t),ke(t)||t.codemirrorIgnore}function be(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)-1==B(n,t[r])&&n.push(t[r])}function we(e,t){return ge(e,t).length>0}function xe(e){e.prototype.on=function(e,t){pe(this,e,t)},e.prototype.off=function(e,t){ve(this,e,t)}}function Ce(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Se(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ke(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Le(e){Ce(e),Se(e)}function Te(e){return e.target||e.srcElement}function Me(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),y&&e.ctrlKey&&1==t&&(t=3),t}var Ne,Oe,Ae=function(){if(l&&a<9)return!1;var e=O("div");return"draggable"in e||"dragDrop"in e}();function De(e){if(null==Ne){var t=O("span","");N(e,O("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Ne=t.offsetWidth<=1&&t.offsetHeight>2&&!(l&&a<8))}var n=Ne?O("span",""):O("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function We(e){if(null!=Oe)return Oe;var t=N(e,document.createTextNode("AخA")),n=L(t,0,1).getBoundingClientRect(),r=L(t,1,2).getBoundingClientRect();return M(e),!(!n||n.left==n.right)&&(Oe=r.right-n.right<3)}var Ee=3!="\n\nb".split(/\n/).length?function(e){var t=0,n=[],r=e.length;while(t<=r){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),l=o.indexOf("\r");-1!=l?(n.push(o.slice(0,l)),t+=l+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Fe=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(n){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},He=function(){var e=O("div");return"oncopy"in e||(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),Ie=null;function Pe(e){if(null!=Ie)return Ie;var t=N(e,O("span","x")),n=t.getBoundingClientRect(),r=L(t,0,1).getBoundingClientRect();return Ie=Math.abs(n.left-r.left)>1}var ze={},Re={};function Be(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),ze[e]=t}function _e(e,t){Re[e]=t}function Ge(e){if("string"==typeof e&&Re.hasOwnProperty(e))e=Re[e];else if(e&&"string"==typeof e.name&&Re.hasOwnProperty(e.name)){var t=Re[e.name];"string"==typeof t&&(t={name:t}),e=Q(t,e),e.name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ge("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ge("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Ue(e,t){t=Ge(t);var n=ze[t.name];if(!n)return Ue(e,"text/plain");var r=n(e,t);if(Ve.hasOwnProperty(t.name)){var i=Ve[t.name];for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var l in t.modeProps)r[l]=t.modeProps[l];return r}var Ve={};function je(e,t){var n=Ve.hasOwnProperty(e)?Ve[e]:Ve[e]={};P(t,n)}function Ke(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function $e(e,t){var n;while(e.innerMode){if(n=e.innerMode(t),!n||n.mode==e)break;t=n.state,e=n.mode}return n||{mode:e,state:t}}function Xe(e,t,n){return!e.startState||e.startState(t,n)}var Ye=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};function qe(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");var n=e;while(!n.lines)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(t<o){n=i;break}t-=o}return n.lines[t]}function Ze(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,(function(e){var o=e.text;i==n.line&&(o=o.slice(0,n.ch)),i==t.line&&(o=o.slice(t.ch)),r.push(o),++i})),r}function Je(e,t,n){var r=[];return e.iter(t,n,(function(e){r.push(e.text)})),r}function Qe(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function et(e){if(null==e.parent)return null;for(var t=e.parent,n=B(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;;++i){if(r.children[i]==t)break;n+=r.children[i].chunkSize()}return n+t.first}function tt(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],o=i.height;if(t<o){e=i;continue e}t-=o,n+=i.chunkSize()}return n}while(!e.lines);for(var l=0;l<e.lines.length;++l){var a=e.lines[l],s=a.height;if(t<s)break;t-=s}return n+l}function nt(e,t){return t>=e.first&&t<e.first+e.size}function rt(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function it(e,t,n){if(void 0===n&&(n=null),!(this instanceof it))return new it(e,t,n);this.line=e,this.ch=t,this.sticky=n}function ot(e,t){return e.line-t.line||e.ch-t.ch}function lt(e,t){return e.sticky==t.sticky&&0==ot(e,t)}function at(e){return it(e.line,e.ch)}function st(e,t){return ot(e,t)<0?t:e}function ut(e,t){return ot(e,t)<0?e:t}function ct(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ht(e,t){if(t.line<e.first)return it(e.first,0);var n=e.first+e.size-1;return t.line>n?it(n,qe(e,n).text.length):ft(t,qe(e,t.line).text.length)}function ft(e,t){var n=e.ch;return null==n||n>t?it(e.line,t):n<0?it(e.line,0):e}function dt(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=ht(e,t[r]);return n}Ye.prototype.eol=function(){return this.pos>=this.string.length},Ye.prototype.sol=function(){return this.pos==this.lineStart},Ye.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ye.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ye.prototype.eat=function(e){var t,n=this.string.charAt(this.pos);if(t="string"==typeof e?n==e:n&&(e.test?e.test(n):e(n)),t)return++this.pos,n},Ye.prototype.eatWhile=function(e){var t=this.pos;while(this.eat(e));return this.pos>t},Ye.prototype.eatSpace=function(){var e=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos)))++this.pos;return this.pos>e},Ye.prototype.skipToEnd=function(){this.pos=this.string.length},Ye.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ye.prototype.backUp=function(e){this.pos-=e},Ye.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=z(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?z(this.string,this.lineStart,this.tabSize):0)},Ye.prototype.indentation=function(){return z(this.string,null,this.tabSize)-(this.lineStart?z(this.string,this.lineStart,this.tabSize):0)},Ye.prototype.match=function(e,t,n){if("string"!=typeof e){var r=this.string.slice(this.pos).match(e);return r&&r.index>0?null:(r&&!1!==t&&(this.pos+=r[0].length),r)}var i=function(e){return n?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);if(i(o)==i(e))return!1!==t&&(this.pos+=e.length),!0},Ye.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ye.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ye.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ye.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var pt=function(e,t){this.state=e,this.lookAhead=t},gt=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};function vt(e,t,n,r){var i=[e.state.modeGen],o={};Lt(e,t.text,e.doc.mode,n,(function(e,t){return i.push(e,t)}),o,r);for(var l=n.state,a=function(r){n.baseTokens=i;var a=e.state.overlays[r],s=1,u=0;n.state=!0,Lt(e,t.text,a.mode,n,(function(e,t){var n=s;while(u<e){var r=i[s];r>e&&i.splice(s,1,e,i[s+1],r),s+=2,u=Math.min(e,r)}if(t)if(a.opaque)i.splice(n,s-n,e,"overlay "+t),s=n+2;else for(;n<s;n+=2){var o=i[n+1];i[n+1]=(o?o+" ":"")+"overlay "+t}}),o),n.state=l,n.baseTokens=null,n.baseTokenPos=1},s=0;s<e.state.overlays.length;++s)a(s);return{styles:i,classes:o.bgClass||o.textClass?o:null}}function mt(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=yt(e,et(t)),i=t.text.length>e.options.maxHighlightLength&&Ke(e.doc.mode,r.state),o=vt(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function yt(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new gt(r,!0,t);var o=Tt(e,t,n),l=o>r.first&&qe(r,o-1).stateAfter,a=l?gt.fromSaved(r,l,o):new gt(r,Xe(r.mode),o);return r.iter(o,t,(function(n){bt(e,n.text,a);var r=a.line;n.stateAfter=r==t-1||r%5==0||r>=i.viewFrom&&r<i.viewTo?a.save():null,a.nextLine()})),n&&(r.modeFrontier=a.line),a}function bt(e,t,n,r){var i=e.doc.mode,o=new Ye(t,e.options.tabSize,n);o.start=o.pos=r||0,""==t&&wt(i,n.state);while(!o.eol())xt(i,o,n.state),o.start=o.pos}function wt(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var n=$e(e,t);return n.mode.blankLine?n.mode.blankLine(n.state):void 0}}function xt(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=$e(e,n).mode);var o=e.token(t,n);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}gt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},gt.prototype.baseToken=function(e){if(!this.baseTokens)return null;while(this.baseTokens[this.baseTokenPos]<=e)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},gt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},gt.fromSaved=function(e,t,n){return t instanceof pt?new gt(e,Ke(e.mode,t.state),n,t.lookAhead):new gt(e,Ke(e.mode,t),n)},gt.prototype.save=function(e){var t=!1!==e?Ke(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new pt(t,this.maxLookAhead):t};var Ct=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function St(e,t,n,r){var i,o=e.doc,l=o.mode;t=ht(o,t);var a,s=qe(o,t.line),u=yt(e,t.line,n),c=new Ye(s.text,e.options.tabSize,u);r&&(a=[]);while((r||c.pos<t.ch)&&!c.eol())c.start=c.pos,i=xt(l,c,u.state),r&&a.push(new Ct(c,i,Ke(o.mode,u.state)));return r?a:new Ct(c,i,u.state)}function kt(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";null==t[r]?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function Lt(e,t,n,r,i,o,l){var a=n.flattenSpans;null==a&&(a=e.options.flattenSpans);var s,u=0,c=null,h=new Ye(t,e.options.tabSize,r),f=e.options.addModeClass&&[null];""==t&&kt(wt(n,r.state),o);while(!h.eol()){if(h.pos>e.options.maxHighlightLength?(a=!1,l&&bt(e,t,r,h.pos),h.pos=t.length,s=null):s=kt(xt(n,h,r.state,f),o),f){var d=f[0].name;d&&(s="m-"+(s?d+" "+s:d))}if(!a||c!=s){while(u<h.start)u=Math.min(h.start,u+5e3),i(u,c);c=s}h.start=h.pos}while(u<h.pos){var p=Math.min(h.pos,u+5e3);i(p,c),u=p}}function Tt(e,t,n){for(var r,i,o=e.doc,l=n?-1:t-(e.doc.mode.innerMode?1e3:100),a=t;a>l;--a){if(a<=o.first)return o.first;var s=qe(o,a-1),u=s.stateAfter;if(u&&(!n||a+(u instanceof pt?u.lookAhead:0)<=o.modeFrontier))return a;var c=z(s.text,null,e.options.tabSize);(null==i||r>c)&&(i=a-1,r=c)}return i}function Mt(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var n=e.first,r=t-1;r>n;r--){var i=qe(e,r).stateAfter;if(i&&(!(i instanceof pt)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}}var Nt=!1,Ot=!1;function At(){Nt=!0}function Dt(){Ot=!0}function Wt(e,t,n){this.marker=e,this.from=t,this.to=n}function Et(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Ft(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Ht(e,t,n){var r=n&&window.WeakSet&&(n.markedSpans||(n.markedSpans=new WeakSet));r&&r.has(e.markedSpans)?e.markedSpans.push(t):(e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],r&&r.add(e.markedSpans)),t.marker.attachLine(e)}function It(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o=e[i],l=o.marker,a=null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t);if(a||o.from==t&&"bookmark"==l.type&&(!n||!o.marker.insertLeft)){var s=null==o.to||(l.inclusiveRight?o.to>=t:o.to>t);(r||(r=[])).push(new Wt(l,o.from,s?null:o.to))}}return r}function Pt(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o=e[i],l=o.marker,a=null==o.to||(l.inclusiveRight?o.to>=t:o.to>t);if(a||o.from==t&&"bookmark"==l.type&&(!n||o.marker.insertLeft)){var s=null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t);(r||(r=[])).push(new Wt(l,s?null:o.from-t,null==o.to?null:o.to-t))}}return r}function zt(e,t){if(t.full)return null;var n=nt(e,t.from.line)&&qe(e,t.from.line).markedSpans,r=nt(e,t.to.line)&&qe(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,o=t.to.ch,l=0==ot(t.from,t.to),a=It(n,i,l),s=Pt(r,o,l),u=1==t.text.length,c=Y(t.text).length+(u?i:0);if(a)for(var h=0;h<a.length;++h){var f=a[h];if(null==f.to){var d=Et(s,f.marker);d?u&&(f.to=null==d.to?null:d.to+c):f.to=i}}if(s)for(var p=0;p<s.length;++p){var g=s[p];if(null!=g.to&&(g.to+=c),null==g.from){var v=Et(a,g.marker);v||(g.from=c,u&&(a||(a=[])).push(g))}else g.from+=c,u&&(a||(a=[])).push(g)}a&&(a=Rt(a)),s&&s!=a&&(s=Rt(s));var m=[a];if(!u){var y,b=t.text.length-2;if(b>0&&a)for(var w=0;w<a.length;++w)null==a[w].to&&(y||(y=[])).push(new Wt(a[w].marker,null,null));for(var x=0;x<b;++x)m.push(y);m.push(s)}return m}function Rt(e){for(var t=0;t<e.length;++t){var n=e[t];null!=n.from&&n.from==n.to&&!1!==n.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function Bt(e,t,n){var r=null;if(e.iter(t.line,n.line+1,(function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var n=e.markedSpans[t].marker;!n.readOnly||r&&-1!=B(r,n)||(r||(r=[])).push(n)}})),!r)return null;for(var i=[{from:t,to:n}],o=0;o<r.length;++o)for(var l=r[o],a=l.find(0),s=0;s<i.length;++s){var u=i[s];if(!(ot(u.to,a.from)<0||ot(u.from,a.to)>0)){var c=[s,1],h=ot(u.from,a.from),f=ot(u.to,a.to);(h<0||!l.inclusiveLeft&&!h)&&c.push({from:u.from,to:a.from}),(f>0||!l.inclusiveRight&&!f)&&c.push({from:a.to,to:u.to}),i.splice.apply(i,c),s+=c.length-3}}return i}function _t(e){var t=e.markedSpans;if(t){for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}}function Gt(e,t){if(t){for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}}function Ut(e){return e.inclusiveLeft?-1:0}function Vt(e){return e.inclusiveRight?1:0}function jt(e,t){var n=e.lines.length-t.lines.length;if(0!=n)return n;var r=e.find(),i=t.find(),o=ot(r.from,i.from)||Ut(e)-Ut(t);if(o)return-o;var l=ot(r.to,i.to)||Vt(e)-Vt(t);return l||t.id-e.id}function Kt(e,t){var n,r=Ot&&e.markedSpans;if(r)for(var i=void 0,o=0;o<r.length;++o)i=r[o],i.marker.collapsed&&null==(t?i.from:i.to)&&(!n||jt(n,i.marker)<0)&&(n=i.marker);return n}function $t(e){return Kt(e,!0)}function Xt(e){return Kt(e,!1)}function Yt(e,t){var n,r=Ot&&e.markedSpans;if(r)for(var i=0;i<r.length;++i){var o=r[i];o.marker.collapsed&&(null==o.from||o.from<t)&&(null==o.to||o.to>t)&&(!n||jt(n,o.marker)<0)&&(n=o.marker)}return n}function qt(e,t,n,r,i){var o=qe(e,t),l=Ot&&o.markedSpans;if(l)for(var a=0;a<l.length;++a){var s=l[a];if(s.marker.collapsed){var u=s.marker.find(0),c=ot(u.from,n)||Ut(s.marker)-Ut(i),h=ot(u.to,r)||Vt(s.marker)-Vt(i);if(!(c>=0&&h<=0||c<=0&&h>=0)&&(c<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?ot(u.to,n)>=0:ot(u.to,n)>0)||c>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?ot(u.from,r)<=0:ot(u.from,r)<0)))return!0}}}function Zt(e){var t;while(t=$t(e))e=t.find(-1,!0).line;return e}function Jt(e){var t;while(t=Xt(e))e=t.find(1,!0).line;return e}function Qt(e){var t,n;while(t=Xt(e))e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function en(e,t){var n=qe(e,t),r=Zt(n);return n==r?t:et(r)}function tn(e,t){if(t>e.lastLine())return t;var n,r=qe(e,t);if(!nn(e,r))return t;while(n=Xt(r))r=n.find(1,!0).line;return et(r)+1}function nn(e,t){var n=Ot&&t.markedSpans;if(n)for(var r=void 0,i=0;i<n.length;++i)if(r=n[i],r.marker.collapsed){if(null==r.from)return!0;if(!r.marker.widgetNode&&0==r.from&&r.marker.inclusiveLeft&&rn(e,t,r))return!0}}function rn(e,t,n){if(null==n.to){var r=n.marker.find(1,!0);return rn(e,r.line,Et(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,o=0;o<t.markedSpans.length;++o)if(i=t.markedSpans[o],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(null==i.to||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&rn(e,t,i))return!0}function on(e){e=Zt(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var o=n.parent;o;n=o,o=n.parent)for(var l=0;l<o.children.length;++l){var a=o.children[l];if(a==n)break;t+=a.height}return t}function ln(e){if(0==e.height)return 0;var t,n=e.text.length,r=e;while(t=$t(r)){var i=t.find(0,!0);r=i.from.line,n+=i.from.ch-i.to.ch}r=e;while(t=Xt(r)){var o=t.find(0,!0);n-=r.text.length-o.from.ch,r=o.to.line,n+=r.text.length-o.to.ch}return n}function an(e){var t=e.display,n=e.doc;t.maxLine=qe(n,n.first),t.maxLineLength=ln(t.maxLine),t.maxLineChanged=!0,n.iter((function(e){var n=ln(e);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)}))}var sn=function(e,t,n){this.text=e,Gt(this,t),this.height=n?n(this):1};function un(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),_t(e),Gt(e,n);var i=r?r(e):1;i!=e.height&&Qe(e,i)}function cn(e){e.parent=null,_t(e)}sn.prototype.lineNo=function(){return et(this)},xe(sn);var hn={},fn={};function dn(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?fn:hn;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function pn(e,t){var n=A("span",null,null,s?"padding-right: .1px":null),r={pre:A("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,l=void 0;r.pos=0,r.addToken=vn,We(e.display.measure)&&(l=fe(o,e.doc.direction))&&(r.addToken=yn(r.addToken,l)),r.map=[];var a=t!=e.display.externalMeasured&&et(o);wn(o,r,mt(e,o,a)),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=F(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=F(o.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(De(e.display.measure))),0==i?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(s){var u=r.content.lastChild;(/\bcm-tab\b/.test(u.className)||u.querySelector&&u.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return me(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=F(r.pre.className,r.textClass||"")),r}function gn(e){var t=O("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function vn(e,t,n,r,i,o,s){if(t){var u,c=e.splitSpaces?mn(t,e.trailingSpace):t,h=e.cm.state.specialChars,f=!1;if(h.test(t)){u=document.createDocumentFragment();var d=0;while(1){h.lastIndex=d;var p=h.exec(t),g=p?p.index-d:t.length-d;if(g){var v=document.createTextNode(c.slice(d,d+g));l&&a<9?u.appendChild(O("span",[v])):u.appendChild(v),e.map.push(e.pos,e.pos+g,v),e.col+=g,e.pos+=g}if(!p)break;d+=g+1;var m=void 0;if("\t"==p[0]){var y=e.cm.options.tabSize,b=y-e.col%y;m=u.appendChild(O("span",X(b),"cm-tab")),m.setAttribute("role","presentation"),m.setAttribute("cm-text","\t"),e.col+=b}else"\r"==p[0]||"\n"==p[0]?(m=u.appendChild(O("span","\r"==p[0]?"␍":"","cm-invalidchar")),m.setAttribute("cm-text",p[0]),e.col+=1):(m=e.cm.options.specialCharPlaceholder(p[0]),m.setAttribute("cm-text",p[0]),l&&a<9?u.appendChild(O("span",[m])):u.appendChild(m),e.col+=1);e.map.push(e.pos,e.pos+1,m),e.pos++}}else e.col+=t.length,u=document.createTextNode(c),e.map.push(e.pos,e.pos+t.length,u),l&&a<9&&(f=!0),e.pos+=t.length;if(e.trailingSpace=32==c.charCodeAt(t.length-1),n||r||i||f||o||s){var w=n||"";r&&(w+=r),i&&(w+=i);var x=O("span",[u],w,o);if(s)for(var C in s)s.hasOwnProperty(C)&&"style"!=C&&"class"!=C&&x.setAttribute(C,s[C]);return e.content.appendChild(x)}e.content.appendChild(u)}}function mn(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var o=e.charAt(i);" "!=o||!n||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" "),r+=o,n=" "==o}return r}function yn(e,t){return function(n,r,i,o,l,a,s){i=i?i+" cm-force-border":"cm-force-border";for(var u=n.pos,c=u+r.length;;){for(var h=void 0,f=0;f<t.length;f++)if(h=t[f],h.to>u&&h.from<=u)break;if(h.to>=c)return e(n,r,i,o,l,a,s);e(n,r.slice(0,h.to-u),i,o,null,a,s),o=null,r=r.slice(h.to-u),u=h.to}}}function bn(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function wn(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(r)for(var l,a,s,u,c,h,f,d=i.length,p=0,g=1,v="",m=0;;){if(m==p){s=u=c=a="",f=null,h=null,m=1/0;for(var y=[],b=void 0,w=0;w<r.length;++w){var x=r[w],C=x.marker;if("bookmark"==C.type&&x.from==p&&C.widgetNode)y.push(C);else if(x.from<=p&&(null==x.to||x.to>p||C.collapsed&&x.to==p&&x.from==p)){if(null!=x.to&&x.to!=p&&m>x.to&&(m=x.to,u=""),C.className&&(s+=" "+C.className),C.css&&(a=(a?a+";":"")+C.css),C.startStyle&&x.from==p&&(c+=" "+C.startStyle),C.endStyle&&x.to==m&&(b||(b=[])).push(C.endStyle,x.to),C.title&&((f||(f={})).title=C.title),C.attributes)for(var S in C.attributes)(f||(f={}))[S]=C.attributes[S];C.collapsed&&(!h||jt(h.marker,C)<0)&&(h=x)}else x.from>p&&m>x.from&&(m=x.from)}if(b)for(var k=0;k<b.length;k+=2)b[k+1]==m&&(u+=" "+b[k]);if(!h||h.from==p)for(var L=0;L<y.length;++L)bn(t,0,y[L]);if(h&&(h.from||0)==p){if(bn(t,(null==h.to?d+1:h.to)-p,h.marker,null==h.from),null==h.to)return;h.to==p&&(h=!1)}}if(p>=d)break;var T=Math.min(d,m);while(1){if(v){var M=p+v.length;if(!h){var N=M>T?v.slice(0,T-p):v;t.addToken(t,N,l?l+s:s,c,p+N.length==m?u:"",a,f)}if(M>=T){v=v.slice(T-p),p=T;break}p=M,c=""}v=i.slice(o,o=n[g++]),l=dn(n[g++],t.cm.options)}}else for(var O=1;O<n.length;O+=2)t.addToken(t,i.slice(o,o=n[O]),dn(n[O+1],t.cm.options))}function xn(e,t,n){this.line=t,this.rest=Qt(t),this.size=this.rest?et(Y(this.rest))-n+1:1,this.node=this.text=null,this.hidden=nn(e,t)}function Cn(e,t,n){for(var r,i=[],o=t;o<n;o=r){var l=new xn(e.doc,qe(e.doc,o),o);r=o+l.size,i.push(l)}return i}var Sn=null;function kn(e){Sn?Sn.ops.push(e):e.ownsGroup=Sn={ops:[e],delayedCallbacks:[]}}function Ln(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)while(i.cursorActivityCalled<i.cursorActivityHandlers.length)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}function Tn(e,t){var n=e.ownsGroup;if(n)try{Ln(n)}finally{Sn=null,t(n)}}var Mn=null;function Nn(e,t){var n=ge(e,t);if(n.length){var r,i=Array.prototype.slice.call(arguments,2);Sn?r=Sn.delayedCallbacks:Mn?r=Mn:(r=Mn=[],setTimeout(On,0));for(var o=function(e){r.push((function(){return n[e].apply(null,i)}))},l=0;l<n.length;++l)o(l)}}function On(){var e=Mn;Mn=null;for(var t=0;t<e.length;++t)e[t]()}function An(e,t,n,r){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?Fn(e,t):"gutter"==o?In(e,t,n,r):"class"==o?Hn(e,t):"widget"==o&&Pn(e,t,r)}t.changes=null}function Dn(e){return e.node==e.text&&(e.node=O("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),l&&a<8&&(e.node.style.zIndex=2)),e.node}function Wn(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=Dn(t);t.background=r.insertBefore(O("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function En(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):pn(e,t)}function Fn(e,t){var n=t.text.className,r=En(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,Hn(e,t)):n&&(t.text.className=n)}function Hn(e,t){Wn(e,t),t.line.wrapClass?Dn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function In(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=Dn(t);t.gutterBackground=O("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var l=Dn(t),a=t.gutter=O("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(a.setAttribute("aria-hidden","true"),e.display.input.setUneditable(a),l.insertBefore(a,t.text),t.line.gutterClass&&(a.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=a.appendChild(O("div",rt(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var s=0;s<e.display.gutterSpecs.length;++s){var u=e.display.gutterSpecs[s].className,c=o.hasOwnProperty(u)&&o[u];c&&a.appendChild(O("div",[c],"CodeMirror-gutter-elt","left: "+r.gutterLeft[u]+"px; width: "+r.gutterWidth[u]+"px"))}}}function Pn(e,t,n){t.alignable&&(t.alignable=null);for(var r=k("CodeMirror-linewidget"),i=t.node.firstChild,o=void 0;i;i=o)o=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);Rn(e,t,n)}function zn(e,t,n,r){var i=En(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),Hn(e,t),In(e,t,n,r),Rn(e,t,r),t.node}function Rn(e,t,n){if(Bn(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)Bn(e,t.rest[r],t,n,!1)}function Bn(e,t,n,r,i){if(t.widgets)for(var o=Dn(n),l=0,a=t.widgets;l<a.length;++l){var s=a[l],u=O("div",[s.node],"CodeMirror-linewidget"+(s.className?" "+s.className:""));s.handleMouseEvents||u.setAttribute("cm-ignore-events","true"),_n(s,u,n,r),e.display.input.setUneditable(u),i&&s.above?o.insertBefore(u,n.gutter||n.text):o.appendChild(u),Nn(s,"redraw")}}function _n(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function Gn(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!D(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),N(t.display.measure,O("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function Un(e,t){for(var n=Te(t);n!=e.wrapper;n=n.parentNode)if(!n||1==n.nodeType&&"true"==n.getAttribute("cm-ignore-events")||n.parentNode==e.sizer&&n!=e.mover)return!0}function Vn(e){return e.lineSpace.offsetTop}function jn(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Kn(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=N(e.measure,O("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return isNaN(r.left)||isNaN(r.right)||(e.cachedPaddingH=r),r}function $n(e){return _-e.display.nativeBarWidth}function Xn(e){return e.display.scroller.clientWidth-$n(e)-e.display.barWidth}function Yn(e){return e.display.scroller.clientHeight-$n(e)-e.display.barHeight}function qn(e,t,n){var r=e.options.lineWrapping,i=r&&Xn(e);if(!t.measure.heights||r&&t.measure.width!=i){var o=t.measure.heights=[];if(r){t.measure.width=i;for(var l=t.text.firstChild.getClientRects(),a=0;a<l.length-1;a++){var s=l[a],u=l[a+1];Math.abs(s.bottom-u.bottom)>2&&o.push((s.bottom+u.top)/2-n.top)}}o.push(n.bottom-n.top)}}function Zn(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(et(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Jn(e,t){t=Zt(t);var n=et(t),r=e.display.externalMeasured=new xn(e.doc,t,n);r.lineN=n;var i=r.built=pn(e,r);return r.text=i.pre,N(e.display.lineMeasure,i.pre),r}function Qn(e,t,n,r){return nr(e,tr(e,t),n,r)}function er(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Hr(e,t)];var n=e.display.externalMeasured;return n&&t>=n.lineN&&t<n.lineN+n.size?n:void 0}function tr(e,t){var n=et(t),r=er(e,n);r&&!r.text?r=null:r&&r.changes&&(An(e,r,n,Ar(e)),e.curOp.forceUpdate=!0),r||(r=Jn(e,t));var i=Zn(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function nr(e,t,n,r,i){t.before&&(n=-1);var o,l=n+(r||"");return t.cache.hasOwnProperty(l)?o=t.cache[l]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(qn(e,t.view,t.rect),t.hasHeights=!0),o=ar(e,t,n,r),o.bogus||(t.cache[l]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}var rr,ir={left:0,right:0,top:0,bottom:0};function or(e,t,n){for(var r,i,o,l,a,s,u=0;u<e.length;u+=3)if(a=e[u],s=e[u+1],t<a?(i=0,o=1,l="left"):t<s?(i=t-a,o=i+1):(u==e.length-3||t==s&&e[u+3]>t)&&(o=s-a,i=o-1,t>=s&&(l="right")),null!=i){if(r=e[u+2],a==s&&n==(r.insertLeft?"left":"right")&&(l=n),"left"==n&&0==i)while(u&&e[u-2]==e[u-3]&&e[u-1].insertLeft)r=e[2+(u-=3)],l="left";if("right"==n&&i==s-a)while(u<e.length-3&&e[u+3]==e[u+4]&&!e[u+5].insertLeft)r=e[(u+=3)+2],l="right";break}return{node:r,start:i,end:o,collapse:l,coverStart:a,coverEnd:s}}function lr(e,t){var n=ir;if("left"==t){for(var r=0;r<e.length;r++)if((n=e[r]).left!=n.right)break}else for(var i=e.length-1;i>=0;i--)if((n=e[i]).left!=n.right)break;return n}function ar(e,t,n,r){var i,o=or(t.map,n,r),s=o.node,u=o.start,c=o.end,h=o.collapse;if(3==s.nodeType){for(var f=0;f<4;f++){while(u&&oe(t.line.text.charAt(o.coverStart+u)))--u;while(o.coverStart+c<o.coverEnd&&oe(t.line.text.charAt(o.coverStart+c)))++c;if(i=l&&a<9&&0==u&&c==o.coverEnd-o.coverStart?s.parentNode.getBoundingClientRect():lr(L(s,u,c).getClientRects(),r),i.left||i.right||0==u)break;c=u,u-=1,h="right"}l&&a<11&&(i=sr(e.display.measure,i))}else{var d;u>0&&(h=r="right"),i=e.options.lineWrapping&&(d=s.getClientRects()).length>1?d["right"==r?d.length-1:0]:s.getBoundingClientRect()}if(l&&a<9&&!u&&(!i||!i.left&&!i.right)){var p=s.parentNode.getClientRects()[0];i=p?{left:p.left,right:p.left+Or(e.display),top:p.top,bottom:p.bottom}:ir}for(var g=i.top-t.rect.top,v=i.bottom-t.rect.top,m=(g+v)/2,y=t.view.measure.heights,b=0;b<y.length-1;b++)if(m<y[b])break;var w=b?y[b-1]:0,x=y[b],C={left:("right"==h?i.right:i.left)-t.rect.left,right:("left"==h?i.left:i.right)-t.rect.left,top:w,bottom:x};return i.left||i.right||(C.bogus=!0),e.options.singleCursorHeightPerLine||(C.rtop=g,C.rbottom=v),C}function sr(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!Pe(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function ur(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function cr(e){e.display.externalMeasure=null,M(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)ur(e.display.view[t])}function hr(e){cr(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function fr(){return c&&v?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function dr(){return c&&v?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function pr(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=Gn(e.widgets[n]));return t}function gr(e,t,n,r,i){if(!i){var o=pr(t);n.top+=o,n.bottom+=o}if("line"==r)return n;r||(r="local");var l=on(t);if("local"==r?l+=Vn(e.display):l-=e.display.viewOffset,"page"==r||"window"==r){var a=e.display.lineSpace.getBoundingClientRect();l+=a.top+("window"==r?0:dr());var s=a.left+("window"==r?0:fr());n.left+=s,n.right+=s}return n.top+=l,n.bottom+=l,n}function vr(e,t,n){if("div"==n)return t;var r=t.left,i=t.top;if("page"==n)r-=fr(),i-=dr();else if("local"==n||!n){var o=e.display.sizer.getBoundingClientRect();r+=o.left,i+=o.top}var l=e.display.lineSpace.getBoundingClientRect();return{left:r-l.left,top:i-l.top}}function mr(e,t,n,r,i){return r||(r=qe(e.doc,t.line)),gr(e,r,Qn(e,r,t.ch,i),n)}function yr(e,t,n,r,i,o){function l(t,l){var a=nr(e,i,t,l?"right":"left",o);return l?a.left=a.right:a.right=a.left,gr(e,r,a,n)}r=r||qe(e.doc,t.line),i||(i=tr(e,r));var a=fe(r,e.doc.direction),s=t.ch,u=t.sticky;if(s>=r.text.length?(s=r.text.length,u="before"):s<=0&&(s=0,u="after"),!a)return l("before"==u?s-1:s,"before"==u);function c(e,t,n){var r=a[t],i=1==r.level;return l(n?e-1:e,i!=n)}var h=ce(a,s,u),f=ue,d=c(s,h,"before"==u);return null!=f&&(d.other=c(s,f,"before"!=u)),d}function br(e,t){var n=0;t=ht(e.doc,t),e.options.lineWrapping||(n=Or(e.display)*t.ch);var r=qe(e.doc,t.line),i=on(r)+Vn(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function wr(e,t,n,r,i){var o=it(e,t,n);return o.xRel=i,r&&(o.outside=r),o}function xr(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return wr(r.first,0,null,-1,-1);var i=tt(r,n),o=r.first+r.size-1;if(i>o)return wr(r.first+r.size-1,qe(r,o).text.length,null,1,1);t<0&&(t=0);for(var l=qe(r,i);;){var a=Lr(e,l,i,t,n),s=Yt(l,a.ch+(a.xRel>0||a.outside>0?1:0));if(!s)return a;var u=s.find(1);if(u.line==i)return u;l=qe(r,i=u.line)}}function Cr(e,t,n,r){r-=pr(t);var i=t.text.length,o=ae((function(t){return nr(e,n,t-1).bottom<=r}),i,0);return i=ae((function(t){return nr(e,n,t).top>r}),o,i),{begin:o,end:i}}function Sr(e,t,n,r){n||(n=tr(e,t));var i=gr(e,t,nr(e,n,r),"line").top;return Cr(e,t,n,i)}function kr(e,t,n,r){return!(e.bottom<=n)&&(e.top>n||(r?e.left:e.right)>t)}function Lr(e,t,n,r,i){i-=on(t);var o=tr(e,t),l=pr(t),a=0,s=t.text.length,u=!0,c=fe(t,e.doc.direction);if(c){var h=(e.options.lineWrapping?Mr:Tr)(e,t,n,o,c,r,i);u=1!=h.level,a=u?h.from:h.to-1,s=u?h.to:h.from-1}var f,d,p=null,g=null,v=ae((function(t){var n=nr(e,o,t);return n.top+=l,n.bottom+=l,!!kr(n,r,i,!1)&&(n.top<=i&&n.left<=r&&(p=t,g=n),!0)}),a,s),m=!1;if(g){var y=r-g.left<g.right-r,b=y==u;v=p+(b?0:1),d=b?"after":"before",f=y?g.left:g.right}else{u||v!=s&&v!=a||v++,d=0==v?"after":v==t.text.length?"before":nr(e,o,v-(u?1:0)).bottom+l<=i==u?"after":"before";var w=yr(e,it(n,v,d),"line",t,o);f=w.left,m=i<w.top?-1:i>=w.bottom?1:0}return v=le(t.text,v,1),wr(n,v,d,m,r-f)}function Tr(e,t,n,r,i,o,l){var a=ae((function(a){var s=i[a],u=1!=s.level;return kr(yr(e,it(n,u?s.to:s.from,u?"before":"after"),"line",t,r),o,l,!0)}),0,i.length-1),s=i[a];if(a>0){var u=1!=s.level,c=yr(e,it(n,u?s.from:s.to,u?"after":"before"),"line",t,r);kr(c,o,l,!0)&&c.top>l&&(s=i[a-1])}return s}function Mr(e,t,n,r,i,o,l){var a=Cr(e,t,r,l),s=a.begin,u=a.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var c=null,h=null,f=0;f<i.length;f++){var d=i[f];if(!(d.from>=u||d.to<=s)){var p=1!=d.level,g=nr(e,r,p?Math.min(u,d.to)-1:Math.max(s,d.from)).right,v=g<o?o-g+1e9:g-o;(!c||h>v)&&(c=d,h=v)}}return c||(c=i[i.length-1]),c.from<s&&(c={from:s,to:c.to,level:c.level}),c.to>u&&(c={from:c.from,to:u,level:c.level}),c}function Nr(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==rr){rr=O("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)rr.appendChild(document.createTextNode("x")),rr.appendChild(O("br"));rr.appendChild(document.createTextNode("x"))}N(e.measure,rr);var n=rr.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),M(e.measure),n||1}function Or(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=O("span","xxxxxxxxxx"),n=O("pre",[t],"CodeMirror-line-like");N(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Ar(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,l=0;o;o=o.nextSibling,++l){var a=e.display.gutterSpecs[l].className;n[a]=o.offsetLeft+o.clientLeft+i,r[a]=o.clientWidth}return{fixedPos:Dr(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Dr(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Wr(e){var t=Nr(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Or(e.display)-3);return function(i){if(nn(e.doc,i))return 0;var o=0;if(i.widgets)for(var l=0;l<i.widgets.length;l++)i.widgets[l].height&&(o+=i.widgets[l].height);return n?o+(Math.ceil(i.text.length/r)||1)*t:o+t}}function Er(e){var t=e.doc,n=Wr(e);t.iter((function(e){var t=n(e);t!=e.height&&Qe(e,t)}))}function Fr(e,t,n,r){var i=e.display;if(!n&&"true"==Te(t).getAttribute("cm-not-content"))return null;var o,l,a=i.lineSpace.getBoundingClientRect();try{o=t.clientX-a.left,l=t.clientY-a.top}catch(h){return null}var s,u=xr(e,o,l);if(r&&u.xRel>0&&(s=qe(e.doc,u.line).text).length==u.ch){var c=z(s,s.length,e.options.tabSize)-s.length;u=it(u.line,Math.max(0,Math.round((o-Kn(e.display).left)/Or(e.display))-c))}return u}function Hr(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function Ir(e,t,n,r){null==t&&(t=e.doc.first),null==n&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&n<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Ot&&en(e.doc,t)<i.viewTo&&zr(e);else if(n<=i.viewFrom)Ot&&tn(e.doc,n+r)>i.viewFrom?zr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)zr(e);else if(t<=i.viewFrom){var o=Rr(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):zr(e)}else if(n>=i.viewTo){var l=Rr(e,t,t,-1);l?(i.view=i.view.slice(0,l.index),i.viewTo=l.lineN):zr(e)}else{var a=Rr(e,t,t,-1),s=Rr(e,n,n+r,1);a&&s?(i.view=i.view.slice(0,a.index).concat(Cn(e,a.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=r):zr(e)}var u=i.externalMeasured;u&&(n<u.lineN?u.lineN+=r:t<u.lineN+u.size&&(i.externalMeasured=null))}function Pr(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),!(t<r.viewFrom||t>=r.viewTo)){var o=r.view[Hr(e,t)];if(null!=o.node){var l=o.changes||(o.changes=[]);-1==B(l,n)&&l.push(n)}}}function zr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Rr(e,t,n,r){var i,o=Hr(e,t),l=e.display.view;if(!Ot||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var a=e.display.viewFrom,s=0;s<o;s++)a+=l[s].size;if(a!=t){if(r>0){if(o==l.length-1)return null;i=a+l[o].size-t,o++}else i=a-t;t+=i,n+=i}while(en(e.doc,n)!=n){if(o==(r<0?0:l.length-1))return null;n+=r*l[o-(r<0?1:0)].size,o+=r}return{index:o,lineN:n}}function Br(e,t,n){var r=e.display,i=r.view;0==i.length||t>=r.viewTo||n<=r.viewFrom?(r.view=Cn(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Cn(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Hr(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(Cn(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,Hr(e,n)))),r.viewTo=n}function _r(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];i.hidden||i.node&&!i.changes||++n}return n}function Gr(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Ur(e,t){void 0===t&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),o=r.selection=document.createDocumentFragment(),l=0;l<n.sel.ranges.length;l++)if(t||l!=n.sel.primIndex){var a=n.sel.ranges[l];if(!(a.from().line>=e.display.viewTo||a.to().line<e.display.viewFrom)){var s=a.empty();(s||e.options.showCursorWhenSelecting)&&Vr(e,a.head,i),s||Kr(e,a,o)}}return r}function Vr(e,t,n){var r=yr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(O("div"," ","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",/\bcm-fat-cursor\b/.test(e.getWrapperElement().className)){var o=mr(e,t,"div",null,null);o.right-o.left>0&&(i.style.width=o.right-o.left+"px")}if(r.other){var l=n.appendChild(O("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));l.style.display="",l.style.left=r.other.left+"px",l.style.top=r.other.top+"px",l.style.height=.85*(r.other.bottom-r.other.top)+"px"}}function jr(e,t){return e.top-t.top||e.left-t.left}function Kr(e,t,n){var r=e.display,i=e.doc,o=document.createDocumentFragment(),l=Kn(e.display),a=l.left,s=Math.max(r.sizerWidth,Xn(e)-r.sizer.offsetLeft)-l.right,u="ltr"==i.direction;function c(e,t,n,r){t<0&&(t=0),t=Math.round(t),r=Math.round(r),o.appendChild(O("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==n?s-e:n)+"px;\n height: "+(r-t)+"px"))}function h(t,n,r){var o,l,h=qe(i,t),f=h.text.length;function d(n,r){return mr(e,it(t,n),"div",h,r)}function p(t,n,r){var i=Sr(e,h,null,t),o="ltr"==n==("after"==r)?"left":"right",l="after"==r?i.begin:i.end-(/\s/.test(h.text.charAt(i.end-1))?2:1);return d(l,o)[o]}var g=fe(h,i.direction);return se(g,n||0,null==r?f:r,(function(e,t,i,h){var v="ltr"==i,m=d(e,v?"left":"right"),y=d(t-1,v?"right":"left"),b=null==n&&0==e,w=null==r&&t==f,x=0==h,C=!g||h==g.length-1;if(y.top-m.top<=3){var S=(u?b:w)&&x,k=(u?w:b)&&C,L=S?a:(v?m:y).left,T=k?s:(v?y:m).right;c(L,m.top,T-L,m.bottom)}else{var M,N,O,A;v?(M=u&&b&&x?a:m.left,N=u?s:p(e,i,"before"),O=u?a:p(t,i,"after"),A=u&&w&&C?s:y.right):(M=u?p(e,i,"before"):a,N=!u&&b&&x?s:m.right,O=!u&&w&&C?a:y.left,A=u?p(t,i,"after"):s),c(M,m.top,N-M,m.bottom),m.bottom<y.top&&c(a,m.bottom,null,y.top),c(O,y.top,A-O,y.bottom)}(!o||jr(m,o)<0)&&(o=m),jr(y,o)<0&&(o=y),(!l||jr(m,l)<0)&&(l=m),jr(y,l)<0&&(l=y)})),{start:o,end:l}}var f=t.from(),d=t.to();if(f.line==d.line)h(f.line,f.ch,d.ch);else{var p=qe(i,f.line),g=qe(i,d.line),v=Zt(p)==Zt(g),m=h(f.line,f.ch,v?p.text.length+1:null).end,y=h(d.line,v?0:null,d.ch).start;v&&(m.top<y.top-2?(c(m.right,m.top,null,m.bottom),c(a,y.top,y.left,y.bottom)):c(m.right,m.top,y.left-m.right,m.bottom)),m.bottom<y.top&&c(a,m.bottom,null,y.top)}n.appendChild(o)}function $r(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval((function(){e.hasFocus()||Zr(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"}),e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Xr(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||qr(e))}function Yr(e){e.state.delayingBlurEvent=!0,setTimeout((function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&Zr(e))}),100)}function qr(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(me(e,"focus",e,t),e.state.focused=!0,E(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),s&&setTimeout((function(){return e.display.input.reset(!0)}),20)),e.display.input.receivedFocus()),$r(e))}function Zr(e,t){e.state.delayingBlurEvent||(e.state.focused&&(me(e,"blur",e,t),e.state.focused=!1,T(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout((function(){e.state.focused||(e.display.shift=!1)}),150))}function Jr(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),i=t.lineDiv.getBoundingClientRect().top,o=0,s=0;s<t.view.length;s++){var u=t.view[s],c=e.options.lineWrapping,h=void 0,f=0;if(!u.hidden){if(i+=u.line.height,l&&a<8){var d=u.node.offsetTop+u.node.offsetHeight;h=d-n,n=d}else{var p=u.node.getBoundingClientRect();h=p.bottom-p.top,!c&&u.text.firstChild&&(f=u.text.firstChild.getBoundingClientRect().right-p.left-1)}var g=u.line.height-h;if((g>.005||g<-.005)&&(i<r&&(o-=g),Qe(u.line,h),Qr(u.line),u.rest))for(var v=0;v<u.rest.length;v++)Qr(u.rest[v]);if(f>e.display.sizerWidth){var m=Math.ceil(f/Or(e.display));m>e.display.maxLineLength&&(e.display.maxLineLength=m,e.display.maxLine=u.line,e.display.maxLineChanged=!0)}}}Math.abs(o)>2&&(t.scroller.scrollTop+=o)}function Qr(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function ei(e,t,n){var r=n&&null!=n.top?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Vn(e));var i=n&&null!=n.bottom?n.bottom:r+e.wrapper.clientHeight,o=tt(t,r),l=tt(t,i);if(n&&n.ensure){var a=n.ensure.from.line,s=n.ensure.to.line;a<o?(o=a,l=tt(t,on(qe(t,a))+e.wrapper.clientHeight)):Math.min(s,t.lastLine())>=l&&(o=tt(t,on(qe(t,s))-e.wrapper.clientHeight),l=s)}return{from:o,to:Math.max(l,o+1)}}function ti(e,t){if(!ye(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!p){var o=O("div","",null,"position: absolute;\n top: "+(t.top-n.viewOffset-Vn(e.display))+"px;\n height: "+(t.bottom-t.top+$n(e)+n.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}function ni(e,t,n,r){var i;null==r&&(r=0),e.options.lineWrapping||t!=n||(n="before"==t.sticky?it(t.line,t.ch+1,"before"):t,t=t.ch?it(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t);for(var o=0;o<5;o++){var l=!1,a=yr(e,t),s=n&&n!=t?yr(e,n):a;i={left:Math.min(a.left,s.left),top:Math.min(a.top,s.top)-r,right:Math.max(a.left,s.left),bottom:Math.max(a.bottom,s.bottom)+r};var u=ii(e,i),c=e.doc.scrollTop,h=e.doc.scrollLeft;if(null!=u.scrollTop&&(hi(e,u.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(l=!0)),null!=u.scrollLeft&&(di(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-h)>1&&(l=!0)),!l)break}return i}function ri(e,t){var n=ii(e,t);null!=n.scrollTop&&hi(e,n.scrollTop),null!=n.scrollLeft&&di(e,n.scrollLeft)}function ii(e,t){var n=e.display,r=Nr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:n.scroller.scrollTop,o=Yn(e),l={};t.bottom-t.top>o&&(t.bottom=t.top+o);var a=e.doc.height+jn(n),s=t.top<r,u=t.bottom>a-r;if(t.top<i)l.scrollTop=s?0:t.top;else if(t.bottom>i+o){var c=Math.min(t.top,(u?a:t.bottom)-o);c!=i&&(l.scrollTop=c)}var h=e.options.fixedGutter?0:n.gutters.offsetWidth,f=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft-h,d=Xn(e)-n.gutters.offsetWidth,p=t.right-t.left>d;return p&&(t.right=t.left+d),t.left<10?l.scrollLeft=0:t.left<f?l.scrollLeft=Math.max(0,t.left+h-(p?0:10)):t.right>d+f-3&&(l.scrollLeft=t.right+(p?0:10)-d),l}function oi(e,t){null!=t&&(ui(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function li(e){ui(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function ai(e,t,n){null==t&&null==n||ui(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function si(e,t){ui(e),e.curOp.scrollToPos=t}function ui(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=br(e,t.from),r=br(e,t.to);ci(e,n,r,t.margin)}}function ci(e,t,n,r){var i=ii(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});ai(e,i.scrollLeft,i.scrollTop)}function hi(e,t){Math.abs(e.doc.scrollTop-t)<2||(n||Gi(e,{top:t}),fi(e,t,!0),n&&Gi(e),Fi(e,100))}function fi(e,t,n){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),(e.display.scroller.scrollTop!=t||n)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function di(e,t,n,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r||(e.doc.scrollLeft=t,Ki(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function pi(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+jn(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+$n(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var gi=function(e,t,n){this.cm=n;var r=this.vert=O("div",[O("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=O("div",[O("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),pe(r,"scroll",(function(){r.clientHeight&&t(r.scrollTop,"vertical")})),pe(i,"scroll",(function(){i.clientWidth&&t(i.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,l&&a<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};gi.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==r&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},gi.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},gi.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},gi.prototype.zeroWidthHack=function(){var e=y&&!d?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new R,this.disableVert=new R},gi.prototype.enableZeroWidthBar=function(e,t,n){function r(){var i=e.getBoundingClientRect(),o="vert"==n?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);o!=e?e.style.pointerEvents="none":t.set(1e3,r)}e.style.pointerEvents="auto",t.set(1e3,r)},gi.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var vi=function(){};function mi(e,t){t||(t=pi(e));var n=e.display.barWidth,r=e.display.barHeight;yi(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Jr(e),yi(e,pi(e)),n=e.display.barWidth,r=e.display.barHeight}function yi(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}vi.prototype.update=function(){return{bottom:0,right:0}},vi.prototype.setScrollLeft=function(){},vi.prototype.setScrollTop=function(){},vi.prototype.clear=function(){};var bi={native:gi,null:vi};function wi(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&T(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new bi[e.options.scrollbarStyle]((function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),pe(t,"mousedown",(function(){e.state.focused&&setTimeout((function(){return e.display.input.focus()}),0)})),t.setAttribute("cm-not-content","true")}),(function(t,n){"horizontal"==n?di(e,t):hi(e,t)}),e),e.display.scrollbars.addClass&&E(e.display.wrapper,e.display.scrollbars.addClass)}var xi=0;function Ci(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++xi,markArrays:null},kn(e.curOp)}function Si(e){var t=e.curOp;t&&Tn(t,(function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null;ki(e)}))}function ki(e){for(var t=e.ops,n=0;n<t.length;n++)Li(t[n]);for(var r=0;r<t.length;r++)Ti(t[r]);for(var i=0;i<t.length;i++)Mi(t[i]);for(var o=0;o<t.length;o++)Ni(t[o]);for(var l=0;l<t.length;l++)Oi(t[l])}function Li(e){var t=e.cm,n=t.display;Pi(t),e.updateMaxLine&&an(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Ii(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Ti(e){e.updatedDisplay=e.mustUpdate&&Bi(e.cm,e.update)}function Mi(e){var t=e.cm,n=t.display;e.updatedDisplay&&Jr(t),e.barMeasure=pi(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Qn(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+$n(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Xn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Ni(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&di(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==W();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&mi(t,e.barMeasure),e.updatedDisplay&&ji(t,e.barMeasure),e.selectionChanged&&$r(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&Xr(e.cm)}function Oi(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&_i(t,e.update),null==n.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(n.wheelStartX=n.wheelStartY=null),null!=e.scrollTop&&fi(t,e.scrollTop,e.forceScroll),null!=e.scrollLeft&&di(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=ni(t,ht(r,e.scrollToPos.from),ht(r,e.scrollToPos.to),e.scrollToPos.margin);ti(t,i)}var o=e.maybeHiddenMarkers,l=e.maybeUnhiddenMarkers;if(o)for(var a=0;a<o.length;++a)o[a].lines.length||me(o[a],"hide");if(l)for(var s=0;s<l.length;++s)l[s].lines.length&&me(l[s],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&me(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Ai(e,t){if(e.curOp)return t();Ci(e);try{return t()}finally{Si(e)}}function Di(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Ci(e);try{return t.apply(e,arguments)}finally{Si(e)}}}function Wi(e){return function(){if(this.curOp)return e.apply(this,arguments);Ci(this);try{return e.apply(this,arguments)}finally{Si(this)}}}function Ei(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Ci(t);try{return e.apply(this,arguments)}finally{Si(t)}}}function Fi(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,I(Hi,e))}function Hi(e){var t=e.doc;if(!(t.highlightFrontier>=e.display.viewTo)){var n=+new Date+e.options.workTime,r=yt(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),(function(o){if(r.line>=e.display.viewFrom){var l=o.styles,a=o.text.length>e.options.maxHighlightLength?Ke(t.mode,r.state):null,s=vt(e,o,r,!0);a&&(r.state=a),o.styles=s.styles;var u=o.styleClasses,c=s.classes;c?o.styleClasses=c:u&&(o.styleClasses=null);for(var h=!l||l.length!=o.styles.length||u!=c&&(!u||!c||u.bgClass!=c.bgClass||u.textClass!=c.textClass),f=0;!h&&f<l.length;++f)h=l[f]!=o.styles[f];h&&i.push(r.line),o.stateAfter=r.save(),r.nextLine()}else o.text.length<=e.options.maxHighlightLength&&bt(e,o.text,r),o.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return Fi(e,e.options.workDelay),!0})),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&Ai(e,(function(){for(var t=0;t<i.length;t++)Pr(e,i[t],"text")}))}}var Ii=function(e,t,n){var r=e.display;this.viewport=t,this.visible=ei(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Xn(e),this.force=n,this.dims=Ar(e),this.events=[]};function Pi(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=$n(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=$n(e)+"px",t.scrollbarsClipped=!0)}function zi(e){if(e.hasFocus())return null;var t=W();if(!t||!D(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&D(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function Ri(e){if(e&&e.activeElt&&e.activeElt!=W()&&(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&D(document.body,e.anchorNode)&&D(document.body,e.focusNode))){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}function Bi(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return zr(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==_r(e))return!1;$i(e)&&(zr(e),t.dims=Ar(e));var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),l=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<o&&o-n.viewFrom<20&&(o=Math.max(r.first,n.viewFrom)),n.viewTo>l&&n.viewTo-l<20&&(l=Math.min(i,n.viewTo)),Ot&&(o=en(e.doc,o),l=tn(e.doc,l));var a=o!=n.viewFrom||l!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Br(e,o,l),n.viewOffset=on(qe(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var s=_r(e);if(!a&&0==s&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var u=zi(e);return s>4&&(n.lineDiv.style.display="none"),Ui(e,n.updateLineNumbers,t.dims),s>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,Ri(u),M(n.cursorDiv),M(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,a&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,Fi(e,400)),n.updateLineNumbers=null,!0}function _i(e,t){for(var n=t.viewport,r=!0;;r=!1){if(r&&e.options.lineWrapping&&t.oldDisplayWidth!=Xn(e))r&&(t.visible=ei(e.display,e.doc,n));else if(n&&null!=n.top&&(n={top:Math.min(e.doc.height+jn(e.display)-Yn(e),n.top)}),t.visible=ei(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!Bi(e,t))break;Jr(e);var i=pi(e);Gr(e),mi(e,i),ji(e,i),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Gi(e,t){var n=new Ii(e,t);if(Bi(e,n)){Jr(e),_i(e,n);var r=pi(e);Gr(e),mi(e,r),ji(e,r),n.finish()}}function Ui(e,t,n){var r=e.display,i=e.options.lineNumbers,o=r.lineDiv,l=o.firstChild;function a(t){var n=t.nextSibling;return s&&y&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),n}for(var u=r.view,c=r.viewFrom,h=0;h<u.length;h++){var f=u[h];if(f.hidden);else if(f.node&&f.node.parentNode==o){while(l!=f.node)l=a(l);var d=i&&null!=t&&t<=c&&f.lineNumber;f.changes&&(B(f.changes,"gutter")>-1&&(d=!1),An(e,f,c,n)),d&&(M(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(rt(e.options,c)))),l=f.node.nextSibling}else{var p=zn(e,f,c,n);o.insertBefore(p,l)}c+=f.size}while(l)l=a(l)}function Vi(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",Nn(e,"gutterChanged",e)}function ji(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+$n(e)+"px"}function Ki(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=Dr(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",l=0;l<n.length;l++)if(!n[l].hidden){e.options.fixedGutter&&(n[l].gutter&&(n[l].gutter.style.left=o),n[l].gutterBackground&&(n[l].gutterBackground.style.left=o));var a=n[l].alignable;if(a)for(var s=0;s<a.length;s++)a[s].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}}function $i(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=rt(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(O("div",[O("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,l=i.offsetWidth-o;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(o,r.lineGutter.offsetWidth-l)+1,r.lineNumWidth=r.lineNumInnerWidth+l,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Vi(e.display),!0}return!1}function Xi(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var o=e[i],l=null;if("string"!=typeof o&&(l=o.style,o=o.className),"CodeMirror-linenumbers"==o){if(!t)continue;r=!0}n.push({className:o,style:l})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Yi(e){var t=e.gutters,n=e.gutterSpecs;M(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],o=i.className,l=i.style,a=t.appendChild(O("div",null,"CodeMirror-gutter "+o));l&&(a.style.cssText=l),"CodeMirror-linenumbers"==o&&(e.lineGutter=a,a.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Vi(e)}function qi(e){Yi(e.display),Ir(e),Ki(e)}function Zi(e,t,r,i){var o=this;this.input=r,o.scrollbarFiller=O("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=O("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=A("div",null,"CodeMirror-code"),o.selectionDiv=O("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=O("div",null,"CodeMirror-cursors"),o.measure=O("div",null,"CodeMirror-measure"),o.lineMeasure=O("div",null,"CodeMirror-measure"),o.lineSpace=A("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");var u=A("div",[o.lineSpace],"CodeMirror-lines");o.mover=O("div",[u],null,"position: relative"),o.sizer=O("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=O("div",null,null,"position: absolute; height: "+_+"px; width: 1px;"),o.gutters=O("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=O("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=O("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),o.wrapper.setAttribute("translate","no"),l&&a<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),s||n&&m||(o.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(o.wrapper):e(o.wrapper)),o.viewFrom=o.viewTo=t.first,o.reportedViewFrom=o.reportedViewTo=t.first,o.view=[],o.renderedView=null,o.externalMeasured=null,o.viewOffset=0,o.lastWrapHeight=o.lastWrapWidth=0,o.updateLineNumbers=null,o.nativeBarWidth=o.barHeight=o.barWidth=0,o.scrollbarsClipped=!1,o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null,o.alignWidgets=!1,o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null,o.maxLine=null,o.maxLineLength=0,o.maxLineChanged=!1,o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null,o.shift=!1,o.selForContextMenu=null,o.activeTouch=null,o.gutterSpecs=Xi(i.gutters,i.lineNumbers),Yi(o),r.init(o)}Ii.prototype.signal=function(e,t){we(e,t)&&this.events.push(arguments)},Ii.prototype.finish=function(){for(var e=0;e<this.events.length;e++)me.apply(null,this.events[e])};var Ji=0,Qi=null;function eo(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==n&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:null==n&&(n=e.wheelDelta),{x:t,y:n}}function to(e){var t=eo(e);return t.x*=Qi,t.y*=Qi,t}function no(e,t){var r=eo(t),i=r.x,o=r.y,l=Qi;0===t.deltaMode&&(i=t.deltaX,o=t.deltaY,l=1);var a=e.display,u=a.scroller,c=u.scrollWidth>u.clientWidth,f=u.scrollHeight>u.clientHeight;if(i&&c||o&&f){if(o&&y&&s)e:for(var d=t.target,p=a.view;d!=u;d=d.parentNode)for(var g=0;g<p.length;g++)if(p[g].node==d){e.display.currentWheelTarget=d;break e}if(i&&!n&&!h&&null!=l)return o&&f&&hi(e,Math.max(0,u.scrollTop+o*l)),di(e,Math.max(0,u.scrollLeft+i*l)),(!o||o&&f)&&Ce(t),void(a.wheelStartX=null);if(o&&null!=l){var v=o*l,m=e.doc.scrollTop,b=m+a.wrapper.clientHeight;v<0?m=Math.max(0,m+v-50):b=Math.min(e.doc.height,b+v+50),Gi(e,{top:m,bottom:b})}Ji<20&&0!==t.deltaMode&&(null==a.wheelStartX?(a.wheelStartX=u.scrollLeft,a.wheelStartY=u.scrollTop,a.wheelDX=i,a.wheelDY=o,setTimeout((function(){if(null!=a.wheelStartX){var e=u.scrollLeft-a.wheelStartX,t=u.scrollTop-a.wheelStartY,n=t&&a.wheelDY&&t/a.wheelDY||e&&a.wheelDX&&e/a.wheelDX;a.wheelStartX=a.wheelStartY=null,n&&(Qi=(Qi*Ji+n)/(Ji+1),++Ji)}}),200)):(a.wheelDX+=i,a.wheelDY+=o))}}l?Qi=-.53:n?Qi=15:c?Qi=-.7:f&&(Qi=-1/3);var ro=function(e,t){this.ranges=e,this.primIndex=t};ro.prototype.primary=function(){return this.ranges[this.primIndex]},ro.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(!lt(n.anchor,r.anchor)||!lt(n.head,r.head))return!1}return!0},ro.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new io(at(this.ranges[t].anchor),at(this.ranges[t].head));return new ro(e,this.primIndex)},ro.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},ro.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(ot(t,r.from())>=0&&ot(e,r.to())<=0)return n}return-1};var io=function(e,t){this.anchor=e,this.head=t};function oo(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort((function(e,t){return ot(e.from(),t.from())})),n=B(t,i);for(var o=1;o<t.length;o++){var l=t[o],a=t[o-1],s=ot(a.to(),l.from());if(r&&!l.empty()?s>0:s>=0){var u=ut(a.from(),l.from()),c=st(a.to(),l.to()),h=a.empty()?l.from()==l.head:a.from()==a.head;o<=n&&--n,t.splice(--o,2,new io(h?c:u,h?u:c))}}return new ro(t,n)}function lo(e,t){return new ro([new io(e,t||e)],0)}function ao(e){return e.text?it(e.from.line+e.text.length-1,Y(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function so(e,t){if(ot(e,t.from)<0)return e;if(ot(e,t.to)<=0)return ao(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=ao(t).ch-t.to.ch),it(n,r)}function uo(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new io(so(i.anchor,t),so(i.head,t)))}return oo(e.cm,n,e.sel.primIndex)}function co(e,t,n){return e.line==t.line?it(n.line,e.ch-t.ch+n.ch):it(n.line+(e.line-t.line),e.ch)}function ho(e,t,n){for(var r=[],i=it(e.first,0),o=i,l=0;l<t.length;l++){var a=t[l],s=co(a.from,i,o),u=co(ao(a),i,o);if(i=a.to,o=u,"around"==n){var c=e.sel.ranges[l],h=ot(c.head,c.anchor)<0;r[l]=new io(h?u:s,h?s:u)}else r[l]=new io(s,s)}return new ro(r,e.sel.primIndex)}function fo(e){e.doc.mode=Ue(e.options,e.doc.modeOption),po(e)}function po(e){e.doc.iter((function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)})),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,Fi(e,100),e.state.modeGen++,e.curOp&&Ir(e)}function go(e,t){return 0==t.from.ch&&0==t.to.ch&&""==Y(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function vo(e,t,n,r){function i(e){return n?n[e]:null}function o(e,n,i){un(e,n,i,r),Nn(e,"change",e,t)}function l(e,t){for(var n=[],o=e;o<t;++o)n.push(new sn(u[o],i(o),r));return n}var a=t.from,s=t.to,u=t.text,c=qe(e,a.line),h=qe(e,s.line),f=Y(u),d=i(u.length-1),p=s.line-a.line;if(t.full)e.insert(0,l(0,u.length)),e.remove(u.length,e.size-u.length);else if(go(e,t)){var g=l(0,u.length-1);o(h,h.text,d),p&&e.remove(a.line,p),g.length&&e.insert(a.line,g)}else if(c==h)if(1==u.length)o(c,c.text.slice(0,a.ch)+f+c.text.slice(s.ch),d);else{var v=l(1,u.length-1);v.push(new sn(f+c.text.slice(s.ch),d,r)),o(c,c.text.slice(0,a.ch)+u[0],i(0)),e.insert(a.line+1,v)}else if(1==u.length)o(c,c.text.slice(0,a.ch)+u[0]+h.text.slice(s.ch),i(0)),e.remove(a.line+1,p);else{o(c,c.text.slice(0,a.ch)+u[0],i(0)),o(h,f+h.text.slice(s.ch),d);var m=l(1,u.length-1);p>1&&e.remove(a.line+1,p-1),e.insert(a.line+1,m)}Nn(e,"change",e,t)}function mo(e,t,n){function r(e,i,o){if(e.linked)for(var l=0;l<e.linked.length;++l){var a=e.linked[l];if(a.doc!=i){var s=o&&a.sharedHist;n&&!s||(t(a.doc,s),r(a.doc,e,s))}}}r(e,null,!0)}function yo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Er(e),fo(e),bo(e),e.options.direction=t.direction,e.options.lineWrapping||an(e),e.options.mode=t.modeOption,Ir(e)}function bo(e){("rtl"==e.doc.direction?E:T)(e.display.lineDiv,"CodeMirror-rtl")}function wo(e){Ai(e,(function(){bo(e),Ir(e)}))}function xo(e){this.done=[],this.undone=[],this.undoDepth=e?e.undoDepth:1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e?e.maxGeneration:1}function Co(e,t){var n={from:at(t.from),to:ao(t),text:Ze(e,t.from,t.to)};return Oo(e,n,t.from.line,t.to.line+1),mo(e,(function(e){return Oo(e,n,t.from.line,t.to.line+1)}),!0),n}function So(e){while(e.length){var t=Y(e);if(!t.ranges)break;e.pop()}}function ko(e,t){return t?(So(e.done),Y(e.done)):e.done.length&&!Y(e.done).ranges?Y(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),Y(e.done)):void 0}function Lo(e,t,n,r){var i=e.history;i.undone.length=0;var o,l,a=+new Date;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&i.lastModTime>a-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=ko(i,i.lastOp==r)))l=Y(o.changes),0==ot(t.from,t.to)&&0==ot(t.from,l.to)?l.to=ao(t):o.changes.push(Co(e,t));else{var s=Y(i.done);s&&s.ranges||No(e.sel,i.done),o={changes:[Co(e,t)],generation:i.generation},i.done.push(o);while(i.done.length>i.undoDepth)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=a,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,l||me(e,"historyAdded")}function To(e,t,n,r){var i=t.charAt(0);return"*"==i||"+"==i&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function Mo(e,t,n,r){var i=e.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||To(e,o,Y(i.done),t))?i.done[i.done.length-1]=t:No(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&!1!==r.clearRedo&&So(i.undone)}function No(e,t){var n=Y(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Oo(e,t,n,r){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),(function(n){n.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=n.markedSpans),++o}))}function Ao(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function Do(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(Ao(n[i]));return r}function Wo(e,t){var n=Do(e,t),r=zt(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var o=n[i],l=r[i];if(o&&l)e:for(var a=0;a<l.length;++a){for(var s=l[a],u=0;u<o.length;++u)if(o[u].marker==s.marker)continue e;o.push(s)}else l&&(n[i]=l)}return n}function Eo(e,t,n){for(var r=[],i=0;i<e.length;++i){var o=e[i];if(o.ranges)r.push(n?ro.prototype.deepCopy.call(o):o);else{var l=o.changes,a=[];r.push({changes:a});for(var s=0;s<l.length;++s){var u=l[s],c=void 0;if(a.push({from:u.from,to:u.to,text:u.text}),t)for(var h in u)(c=h.match(/^spans_(\d+)$/))&&B(t,Number(c[1]))>-1&&(Y(a)[h]=u[h],delete u[h])}}}return r}function Fo(e,t,n,r){if(r){var i=e.anchor;if(n){var o=ot(t,i)<0;o!=ot(n,i)<0?(i=t,t=n):o!=ot(t,n)<0&&(t=n)}return new io(i,t)}return new io(n||t,t)}function Ho(e,t,n,r,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),_o(e,new ro([Fo(e.sel.primary(),t,n,i)],0),r)}function Io(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o<e.sel.ranges.length;o++)r[o]=Fo(e.sel.ranges[o],t[o],null,i);var l=oo(e.cm,r,e.sel.primIndex);_o(e,l,n)}function Po(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,_o(e,oo(e.cm,i,e.sel.primIndex),r)}function zo(e,t,n,r){_o(e,lo(t,n),r)}function Ro(e,t,n){var r={ranges:t.ranges,update:function(t){this.ranges=[];for(var n=0;n<t.length;n++)this.ranges[n]=new io(ht(e,t[n].anchor),ht(e,t[n].head))},origin:n&&n.origin};return me(e,"beforeSelectionChange",e,r),e.cm&&me(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?oo(e.cm,r.ranges,r.ranges.length-1):t}function Bo(e,t,n){var r=e.history.done,i=Y(r);i&&i.ranges?(r[r.length-1]=t,Go(e,t,n)):_o(e,t,n)}function _o(e,t,n){Go(e,t,n),Mo(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Go(e,t,n){(we(e,"beforeSelectionChange")||e.cm&&we(e.cm,"beforeSelectionChange"))&&(t=Ro(e,t,n));var r=n&&n.bias||(ot(t.primary().head,e.sel.primary().head)<0?-1:1);Uo(e,jo(e,t,r,!0)),n&&!1===n.scroll||!e.cm||"nocursor"==e.cm.getOption("readOnly")||li(e.cm)}function Uo(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,be(e.cm)),Nn(e,"cursorActivity",e))}function Vo(e){Uo(e,jo(e,e.sel,null,!1))}function jo(e,t,n,r){for(var i,o=0;o<t.ranges.length;o++){var l=t.ranges[o],a=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],s=$o(e,l.anchor,a&&a.anchor,n,r),u=$o(e,l.head,a&&a.head,n,r);(i||s!=l.anchor||u!=l.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new io(s,u))}return i?oo(e.cm,i,t.primIndex):t}function Ko(e,t,n,r,i){var o=qe(e,t.line);if(o.markedSpans)for(var l=0;l<o.markedSpans.length;++l){var a=o.markedSpans[l],s=a.marker,u="selectLeft"in s?!s.selectLeft:s.inclusiveLeft,c="selectRight"in s?!s.selectRight:s.inclusiveRight;if((null==a.from||(u?a.from<=t.ch:a.from<t.ch))&&(null==a.to||(c?a.to>=t.ch:a.to>t.ch))){if(i&&(me(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--l;continue}break}if(!s.atomic)continue;if(n){var h=s.find(r<0?1:-1),f=void 0;if((r<0?c:u)&&(h=Xo(e,h,-r,h&&h.line==t.line?o:null)),h&&h.line==t.line&&(f=ot(h,n))&&(r<0?f<0:f>0))return Ko(e,h,t,r,i)}var d=s.find(r<0?-1:1);return(r<0?u:c)&&(d=Xo(e,d,r,d.line==t.line?o:null)),d?Ko(e,d,t,r,i):null}}return t}function $o(e,t,n,r,i){var o=r||1,l=Ko(e,t,n,o,i)||!i&&Ko(e,t,n,o,!0)||Ko(e,t,n,-o,i)||!i&&Ko(e,t,n,-o,!0);return l||(e.cantEdit=!0,it(e.first,0))}function Xo(e,t,n,r){return n<0&&0==t.ch?t.line>e.first?ht(e,it(t.line-1)):null:n>0&&t.ch==(r||qe(e,t.line)).text.length?t.line<e.first+e.size-1?it(t.line+1,0):null:new it(t.line,t.ch+n)}function Yo(e){e.setSelection(it(e.firstLine(),0),it(e.lastLine()),U)}function qo(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(t,n,i,o){t&&(r.from=ht(e,t)),n&&(r.to=ht(e,n)),i&&(r.text=i),void 0!==o&&(r.origin=o)}),me(e,"beforeChange",e,r),e.cm&&me(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function Zo(e,t,n){if(e.cm){if(!e.cm.curOp)return Di(e.cm,Zo)(e,t,n);if(e.cm.state.suppressEdits)return}if(!(we(e,"beforeChange")||e.cm&&we(e.cm,"beforeChange"))||(t=qo(e,t,!0),t)){var r=Nt&&!n&&Bt(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)Jo(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Jo(e,t)}}function Jo(e,t){if(1!=t.text.length||""!=t.text[0]||0!=ot(t.from,t.to)){var n=uo(e,t);Lo(e,t,n,e.cm?e.cm.curOp.id:NaN),tl(e,t,n,zt(e,t));var r=[];mo(e,(function(e,n){n||-1!=B(r,e.history)||(ll(e.history,t),r.push(e.history)),tl(e,t,null,zt(e,t))}))}}function Qo(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(!r||n){for(var i,o=e.history,l=e.sel,a="undo"==t?o.done:o.undone,s="undo"==t?o.undone:o.done,u=0;u<a.length;u++)if(i=a[u],n?i.ranges&&!i.equals(e.sel):!i.ranges)break;if(u!=a.length){for(o.lastOrigin=o.lastSelOrigin=null;;){if(i=a.pop(),!i.ranges){if(r)return void a.push(i);break}if(No(i,s),n&&!i.equals(e.sel))return void _o(e,i,{clearRedo:!1});l=i}var c=[];No(l,s),s.push({changes:c,generation:o.generation}),o.generation=i.generation||++o.maxGeneration;for(var h=we(e,"beforeChange")||e.cm&&we(e.cm,"beforeChange"),f=function(n){var r=i.changes[n];if(r.origin=t,h&&!qo(e,r,!1))return a.length=0,{};c.push(Co(e,r));var o=n?uo(e,r):Y(a);tl(e,r,o,Wo(e,r)),!n&&e.cm&&e.cm.scrollIntoView({from:r.from,to:ao(r)});var l=[];mo(e,(function(e,t){t||-1!=B(l,e.history)||(ll(e.history,r),l.push(e.history)),tl(e,r,null,Wo(e,r))}))},d=i.changes.length-1;d>=0;--d){var p=f(d);if(p)return p.v}}}}function el(e,t){if(0!=t&&(e.first+=t,e.sel=new ro(q(e.sel.ranges,(function(e){return new io(it(e.anchor.line+t,e.anchor.ch),it(e.head.line+t,e.head.ch))})),e.sel.primIndex),e.cm)){Ir(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Pr(e.cm,r,"gutter")}}function tl(e,t,n,r){if(e.cm&&!e.cm.curOp)return Di(e.cm,tl)(e,t,n,r);if(t.to.line<e.first)el(e,t.text.length-1-(t.to.line-t.from.line));else if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);el(e,i),t={from:it(e.first,0),to:it(t.to.line+i,t.to.ch),text:[Y(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:it(o,qe(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Ze(e,t.from,t.to),n||(n=uo(e,t)),e.cm?nl(e.cm,t,r):vo(e,t,r),Go(e,n,U),e.cantEdit&&$o(e,it(e.firstLine(),0))&&(e.cantEdit=!1)}}function nl(e,t,n){var r=e.doc,i=e.display,o=t.from,l=t.to,a=!1,s=o.line;e.options.lineWrapping||(s=et(Zt(qe(r,o.line))),r.iter(s,l.line+1,(function(e){if(e==i.maxLine)return a=!0,!0}))),r.sel.contains(t.from,t.to)>-1&&be(e),vo(r,t,n,Wr(e)),e.options.lineWrapping||(r.iter(s,o.line+t.text.length,(function(e){var t=ln(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,a=!1)})),a&&(e.curOp.updateMaxLine=!0)),Mt(r,o.line),Fi(e,400);var u=t.text.length-(l.line-o.line)-1;t.full?Ir(e):o.line!=l.line||1!=t.text.length||go(e.doc,t)?Ir(e,o.line,l.line+1,u):Pr(e,o.line,"text");var c=we(e,"changes"),h=we(e,"change");if(h||c){var f={from:o,to:l,text:t.text,removed:t.removed,origin:t.origin};h&&Nn(e,"change",e,f),c&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(f)}e.display.selForContextMenu=null}function rl(e,t,n,r,i){var o;r||(r=n),ot(r,n)<0&&(o=[r,n],n=o[0],r=o[1]),"string"==typeof t&&(t=e.splitLines(t)),Zo(e,{from:n,to:r,text:t,origin:i})}function il(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function ol(e,t,n,r){for(var i=0;i<e.length;++i){var o=e[i],l=!0;if(o.ranges){o.copied||(o=e[i]=o.deepCopy(),o.copied=!0);for(var a=0;a<o.ranges.length;a++)il(o.ranges[a].anchor,t,n,r),il(o.ranges[a].head,t,n,r)}else{for(var s=0;s<o.changes.length;++s){var u=o.changes[s];if(n<u.from.line)u.from=it(u.from.line+r,u.from.ch),u.to=it(u.to.line+r,u.to.ch);else if(t<=u.to.line){l=!1;break}}l||(e.splice(0,i+1),i=0)}}}function ll(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;ol(e.done,n,r,i),ol(e.undone,n,r,i)}function al(e,t,n,r){var i=t,o=t;return"number"==typeof t?o=qe(e,ct(e,t)):i=et(t),null==i?null:(r(o,i)&&e.cm&&Pr(e.cm,i,n),o)}function sl(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}function ul(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}io.prototype.from=function(){return ut(this.anchor,this.head)},io.prototype.to=function(){return st(this.anchor,this.head)},io.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},sl.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,cn(i),Nn(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}},ul.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var o=Math.min(t,i-e),l=r.height;if(r.removeInner(e,o),this.height-=l-r.height,i==o&&(this.children.splice(n--,1),r.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof sl))){var a=[];this.collapse(a),this.children=[new sl(a)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(e<=o){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var l=i.lines.length%25+25,a=l;a<i.lines.length;){var s=new sl(i.lines.slice(a,a+=25));i.height-=s.height,this.children.splice(++r,0,s),s.parent=this}i.lines=i.lines.slice(0,l),this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new ul(t);if(e.parent){e.size-=n.size,e.height-=n.height;var r=B(e.parent.children,e);e.parent.children.splice(r+1,0,n)}else{var i=new ul(e.children);i.parent=e,e.children=[i,n],e=i}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(e<o){var l=Math.min(t,o-e);if(i.iterN(e,l,n))return!0;if(0==(t-=l))break;e=0}else e-=o}}};var cl=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};function hl(e,t,n){on(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&oi(e,n)}function fl(e,t,n,r){var i=new cl(e,n,r),o=e.cm;return o&&i.noHScroll&&(o.display.alignWidgets=!0),al(e,t,"widget",(function(t){var n=t.widgets||(t.widgets=[]);if(null==i.insertAt?n.push(i):n.splice(Math.min(n.length,Math.max(0,i.insertAt)),0,i),i.line=t,o&&!nn(e,t)){var r=on(t)<e.scrollTop;Qe(t,t.height+Gn(i)),r&&oi(o,i.height),o.curOp.forceUpdate=!0}return!0})),o&&Nn(o,"lineWidgetAdded",o,i,"number"==typeof t?t:et(t)),i}cl.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=et(n);if(null!=r&&t){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var o=Gn(this);Qe(n,Math.max(0,n.height-o)),e&&(Ai(e,(function(){hl(e,n,-o),Pr(e,r,"widget")})),Nn(e,"lineWidgetCleared",e,this,r))}},cl.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=Gn(this)-t;i&&(nn(this.doc,r)||Qe(r,r.height+i),n&&Ai(n,(function(){n.curOp.forceUpdate=!0,hl(n,r,i),Nn(n,"lineWidgetChanged",n,e,et(r))})))},xe(cl);var dl=0,pl=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++dl};function gl(e,t,n,r,i){if(r&&r.shared)return ml(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Di(e.cm,gl)(e,t,n,r,i);var o=new pl(e,i),l=ot(t,n);if(r&&P(r,o,!1),l>0||0==l&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=A("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(qt(e,t.line,t,n,o)||t.line!=n.line&&qt(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Dt()}o.addToHistory&&Lo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var a,s=t.line,u=e.cm;if(e.iter(s,n.line+1,(function(r){u&&o.collapsed&&!u.options.lineWrapping&&Zt(r)==u.display.maxLine&&(a=!0),o.collapsed&&s!=t.line&&Qe(r,0),Ht(r,new Wt(o,s==t.line?t.ch:null,s==n.line?n.ch:null),e.cm&&e.cm.curOp),++s})),o.collapsed&&e.iter(t.line,n.line+1,(function(t){nn(e,t)&&Qe(t,0)})),o.clearOnEnter&&pe(o,"beforeCursorEnter",(function(){return o.clear()})),o.readOnly&&(At(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++dl,o.atomic=!0),u){if(a&&(u.curOp.updateMaxLine=!0),o.collapsed)Ir(u,t.line,n.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var c=t.line;c<=n.line;c++)Pr(u,c,"text");o.atomic&&Vo(u.doc),Nn(u,"markerAdded",u,o)}return o}pl.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Ci(e),we(this,"clear")){var n=this.find();n&&Nn(this,"clear",n.from,n.to)}for(var r=null,i=null,o=0;o<this.lines.length;++o){var l=this.lines[o],a=Et(l.markedSpans,this);e&&!this.collapsed?Pr(e,et(l),"text"):e&&(null!=a.to&&(i=et(l)),null!=a.from&&(r=et(l))),l.markedSpans=Ft(l.markedSpans,a),null==a.from&&this.collapsed&&!nn(this.doc,l)&&e&&Qe(l,Nr(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var s=0;s<this.lines.length;++s){var u=Zt(this.lines[s]),c=ln(u);c>e.display.maxLineLength&&(e.display.maxLine=u,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=r&&e&&this.collapsed&&Ir(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Vo(e.doc)),e&&Nn(e,"markerCleared",e,this,r,i),t&&Si(e),this.parent&&this.parent.clear()}},pl.prototype.find=function(e,t){var n,r;null==e&&"bookmark"==this.type&&(e=1);for(var i=0;i<this.lines.length;++i){var o=this.lines[i],l=Et(o.markedSpans,this);if(null!=l.from&&(n=it(t?o:et(o),l.from),-1==e))return n;if(null!=l.to&&(r=it(t?o:et(o),l.to),1==e))return r}return n&&{from:n,to:r}},pl.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;t&&r&&Ai(r,(function(){var i=t.line,o=et(t.line),l=er(r,o);if(l&&(ur(l),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!nn(n.doc,i)&&null!=n.height){var a=n.height;n.height=null;var s=Gn(n)-a;s&&Qe(i,i.height+s)}Nn(r,"markerChanged",r,e)}))},pl.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=B(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},pl.prototype.detachLine=function(e){if(this.lines.splice(B(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},xe(pl);var vl=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};function ml(e,t,n,r,i){r=P(r),r.shared=!1;var o=[gl(e,t,n,r,i)],l=o[0],a=r.widgetNode;return mo(e,(function(e){a&&(r.widgetNode=a.cloneNode(!0)),o.push(gl(e,ht(e,t),ht(e,n),r,i));for(var s=0;s<e.linked.length;++s)if(e.linked[s].isParent)return;l=Y(o)})),new vl(o,l)}function yl(e){return e.findMarks(it(e.first,0),e.clipPos(it(e.lastLine())),(function(e){return e.parent}))}function bl(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),o=e.clipPos(i.from),l=e.clipPos(i.to);if(ot(o,l)){var a=gl(e,o,l,r.primary,r.primary.type);r.markers.push(a),a.parent=r}}}function wl(e){for(var t=function(t){var n=e[t],r=[n.primary.doc];mo(n.primary.doc,(function(e){return r.push(e)}));for(var i=0;i<n.markers.length;i++){var o=n.markers[i];-1==B(r,o.doc)&&(o.parent=null,n.markers.splice(i--,1))}},n=0;n<e.length;n++)t(n)}vl.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Nn(this,"clear")}},vl.prototype.find=function(e,t){return this.primary.find(e,t)},xe(vl);var xl=0,Cl=function(e,t,n,r,i){if(!(this instanceof Cl))return new Cl(e,t,n,r,i);null==n&&(n=0),ul.call(this,[new sl([new sn("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var o=it(n,0);this.sel=lo(o),this.history=new xo(null),this.id=++xl,this.modeOption=t,this.lineSep=r,this.direction="rtl"==i?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),vo(this,{from:o,to:o,text:e}),_o(this,lo(o),U)};Cl.prototype=Q(ul.prototype,{constructor:Cl,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Je(this,this.first,this.first+this.size);return!1===e?t:t.join(e||this.lineSeparator())},setValue:Ei((function(e){var t=it(this.first,0),n=this.first+this.size-1;Zo(this,{from:t,to:it(n,qe(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&ai(this.cm,0,0),_o(this,lo(t),U)})),replaceRange:function(e,t,n,r){t=ht(this,t),n=n?ht(this,n):t,rl(this,e,t,n,r)},getRange:function(e,t,n){var r=Ze(this,ht(this,e),ht(this,t));return!1===n?r:""===n?r.join(""):r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(nt(this,e))return qe(this,e)},getLineNumber:function(e){return et(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=qe(this,e)),Zt(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ht(this,e)},getCursor:function(e){var t,n=this.sel.primary();return t=null==e||"head"==e?n.head:"anchor"==e?n.anchor:"end"==e||"to"==e||!1===e?n.to():n.from(),t},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Ei((function(e,t,n){zo(this,ht(this,"number"==typeof e?it(e,t||0):e),null,n)})),setSelection:Ei((function(e,t,n){zo(this,ht(this,e),ht(this,t||e),n)})),extendSelection:Ei((function(e,t,n){Ho(this,ht(this,e),t&&ht(this,t),n)})),extendSelections:Ei((function(e,t){Io(this,dt(this,e),t)})),extendSelectionsBy:Ei((function(e,t){var n=q(this.sel.ranges,e);Io(this,dt(this,n),t)})),setSelections:Ei((function(e,t,n){if(e.length){for(var r=[],i=0;i<e.length;i++)r[i]=new io(ht(this,e[i].anchor),ht(this,e[i].head||e[i].anchor));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),_o(this,oo(this.cm,r,t),n)}})),addSelection:Ei((function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new io(ht(this,e),ht(this,t||e))),_o(this,oo(this.cm,r,r.length-1),n)})),getSelection:function(e){for(var t,n=this.sel.ranges,r=0;r<n.length;r++){var i=Ze(this,n[r].from(),n[r].to());t=t?t.concat(i):i}return!1===e?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=Ze(this,n[r].from(),n[r].to());!1!==e&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:Ei((function(e,t,n){for(var r=[],i=this.sel,o=0;o<i.ranges.length;o++){var l=i.ranges[o];r[o]={from:l.from(),to:l.to(),text:this.splitLines(e[o]),origin:n}}for(var a=t&&"end"!=t&&ho(this,r,t),s=r.length-1;s>=0;s--)Zo(this,r[s]);a?Bo(this,a):this.cm&&li(this.cm)})),undo:Ei((function(){Qo(this,"undo")})),redo:Ei((function(){Qo(this,"redo")})),undoSelection:Ei((function(){Qo(this,"undo",!0)})),redoSelection:Ei((function(){Qo(this,"redo",!0)})),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new xo(this.history),mo(this,(function(t){return t.history=e.history}),!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Eo(this.history.done),undone:Eo(this.history.undone)}},setHistory:function(e){var t=this.history=new xo(this.history);t.done=Eo(e.done.slice(0),null,!0),t.undone=Eo(e.undone.slice(0),null,!0)},setGutterMarker:Ei((function(e,t,n){return al(this,e,"gutter",(function(e){var r=e.gutterMarkers||(e.gutterMarkers={});return r[t]=n,!n&&re(r)&&(e.gutterMarkers=null),!0}))})),clearGutter:Ei((function(e){var t=this;this.iter((function(n){n.gutterMarkers&&n.gutterMarkers[e]&&al(t,n,"gutter",(function(){return n.gutterMarkers[e]=null,re(n.gutterMarkers)&&(n.gutterMarkers=null),!0}))}))})),lineInfo:function(e){var t;if("number"==typeof e){if(!nt(this,e))return null;if(t=e,e=qe(this,e),!e)return null}else if(t=et(e),null==t)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:Ei((function(e,t,n){return al(this,e,"gutter"==t?"gutter":"class",(function(e){var r="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(e[r]){if(k(n).test(e[r]))return!1;e[r]+=" "+n}else e[r]=n;return!0}))})),removeLineClass:Ei((function(e,t,n){return al(this,e,"gutter"==t?"gutter":"class",(function(e){var r="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass",i=e[r];if(!i)return!1;if(null==n)e[r]=null;else{var o=i.match(k(n));if(!o)return!1;var l=o.index+o[0].length;e[r]=i.slice(0,o.index)+(o.index&&l!=i.length?" ":"")+i.slice(l)||null}return!0}))})),addLineWidget:Ei((function(e,t,n){return fl(this,e,t,n)})),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return gl(this,ht(this,e),ht(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=ht(this,e),gl(this,e,e,n,"bookmark")},findMarksAt:function(e){e=ht(this,e);var t=[],n=qe(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=ht(this,e),t=ht(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,(function(o){var l=o.markedSpans;if(l)for(var a=0;a<l.length;a++){var s=l[a];null!=s.to&&i==e.line&&e.ch>=s.to||null==s.from&&i!=e.line||null!=s.from&&i==t.line&&s.from>=t.ch||n&&!n(s.marker)||r.push(s.marker.parent||s.marker)}++i})),r},getAllMarks:function(){var e=[];return this.iter((function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)null!=n[r].from&&e.push(n[r].marker)})),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter((function(i){var o=i.text.length+r;if(o>e)return t=e,!0;e-=o,++n})),ht(this,it(n,t))},indexFromPos:function(e){e=ht(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,(function(e){t+=e.text.length+n})),t},copy:function(e){var t=new Cl(Je(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<n&&(n=e.to);var r=new Cl(Je(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],bl(r,yl(this)),r},unlinkDoc:function(e){if(e instanceof Ia&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc==e){this.linked.splice(t,1),e.unlinkDoc(this),wl(yl(this));break}}if(e.history==this.history){var r=[e.id];mo(e,(function(e){return r.push(e.id)}),!0),e.history=new xo(null),e.history.done=Eo(this.history.done,r),e.history.undone=Eo(this.history.undone,r)}},iterLinkedDocs:function(e){mo(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Ee(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:Ei((function(e){"rtl"!=e&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter((function(e){return e.order=null})),this.cm&&wo(this.cm))}))}),Cl.prototype.eachLine=Cl.prototype.iter;var Sl=0;function kl(e){var t=this;if(Ml(t),!ye(t,e)&&!Un(t.display,e)){Ce(e),l&&(Sl=+new Date);var n=Fr(t,e,!0),r=e.dataTransfer.files;if(n&&!t.isReadOnly())if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,o=Array(i),a=0,s=function(){++a==i&&Di(t,(function(){n=ht(t.doc,n);var e={from:n,to:n,text:t.doc.splitLines(o.filter((function(e){return null!=e})).join(t.doc.lineSeparator())),origin:"paste"};Zo(t.doc,e),Bo(t.doc,lo(ht(t.doc,n),ht(t.doc,ao(e))))}))()},u=function(e,n){if(t.options.allowDropFileTypes&&-1==B(t.options.allowDropFileTypes,e.type))s();else{var r=new FileReader;r.onerror=function(){return s()},r.onload=function(){var e=r.result;/[\x00-\x08\x0e-\x1f]{2}/.test(e)||(o[n]=e),s()},r.readAsText(e)}},c=0;c<r.length;c++)u(r[c],c);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1)return t.state.draggingText(e),void setTimeout((function(){return t.display.input.focus()}),20);try{var h=e.dataTransfer.getData("Text");if(h){var f;if(t.state.draggingText&&!t.state.draggingText.copy&&(f=t.listSelections()),Go(t.doc,lo(n,n)),f)for(var d=0;d<f.length;++d)rl(t.doc,"",f[d].anchor,f[d].head,"drag");t.replaceSelection(h,"around","paste"),t.display.input.focus()}}catch(p){}}}}function Ll(e,t){if(l&&(!e.state.draggingText||+new Date-Sl<100))Le(t);else if(!ye(e,t)&&!Un(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!f)){var n=O("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",h&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),h&&n.parentNode.removeChild(n)}}function Tl(e,t){var n=Fr(e,t);if(n){var r=document.createDocumentFragment();Vr(e,n,r),e.display.dragCursor||(e.display.dragCursor=O("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),N(e.display.dragCursor,r)}}function Ml(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function Nl(e){if(document.getElementsByClassName){for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation((function(){for(var t=0;t<n.length;t++)e(n[t])}))}}var Ol=!1;function Al(){Ol||(Dl(),Ol=!0)}function Dl(){var e;pe(window,"resize",(function(){null==e&&(e=setTimeout((function(){e=null,Nl(Wl)}),100))})),pe(window,"blur",(function(){return Nl(Zr)}))}function Wl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var El={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"},Fl=0;Fl<10;Fl++)El[Fl+48]=El[Fl+96]=String(Fl);for(var Hl=65;Hl<=90;Hl++)El[Hl]=String.fromCharCode(Hl);for(var Il=1;Il<=12;Il++)El[Il+111]=El[Il+63235]="F"+Il;var Pl={};function zl(e){var t,n,r,i,o=e.split(/-(?!$)/);e=o[o.length-1];for(var l=0;l<o.length-1;l++){var a=o[l];if(/^(cmd|meta|m)$/i.test(a))i=!0;else if(/^a(lt)?$/i.test(a))t=!0;else if(/^(c|ctrl|control)$/i.test(a))n=!0;else{if(!/^s(hift)?$/i.test(a))throw new Error("Unrecognized modifier name: "+a);r=!0}}return t&&(e="Alt-"+e),n&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),r&&(e="Shift-"+e),e}function Rl(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if("..."==r){delete e[n];continue}for(var i=q(n.split(" "),zl),o=0;o<i.length;o++){var l=void 0,a=void 0;o==i.length-1?(a=i.join(" "),l=r):(a=i.slice(0,o+1).join(" "),l="...");var s=t[a];if(s){if(s!=l)throw new Error("Inconsistent bindings for "+a)}else t[a]=l}delete e[n]}for(var u in t)e[u]=t[u];return e}function Bl(e,t,n,r){t=Vl(t);var i=t.call?t.call(e,r):t[e];if(!1===i)return"nothing";if("..."===i)return"multi";if(null!=i&&n(i))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return Bl(e,t.fallthrough,n,r);for(var o=0;o<t.fallthrough.length;o++){var l=Bl(e,t.fallthrough[o],n,r);if(l)return l}}}function _l(e){var t="string"==typeof e?e:El[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function Gl(e,t,n){var r=e;return t.altKey&&"Alt"!=r&&(e="Alt-"+e),(C?t.metaKey:t.ctrlKey)&&"Ctrl"!=r&&(e="Ctrl-"+e),(C?t.ctrlKey:t.metaKey)&&"Mod"!=r&&(e="Cmd-"+e),!n&&t.shiftKey&&"Shift"!=r&&(e="Shift-"+e),e}function Ul(e,t){if(h&&34==e.keyCode&&e["char"])return!1;var n=El[e.keyCode];return null!=n&&!e.altGraphKey&&(3==e.keyCode&&e.code&&(n=e.code),Gl(n,e,t))}function Vl(e){return"string"==typeof e?Pl[e]:e}function jl(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){var o=t(n[i]);while(r.length&&ot(o.from,Y(r).to)<=0){var l=r.pop();if(ot(l.from,o.from)<0){o.from=l.from;break}}r.push(o)}Ai(e,(function(){for(var t=r.length-1;t>=0;t--)rl(e.doc,"",r[t].from,r[t].to,"+delete");li(e)}))}function Kl(e,t,n){var r=le(e.text,t+n,n);return r<0||r>e.text.length?null:r}function $l(e,t,n){var r=Kl(e,t.ch,n);return null==r?null:new it(t.line,r,n<0?"after":"before")}function Xl(e,t,n,r,i){if(e){"rtl"==t.doc.direction&&(i=-i);var o=fe(n,t.doc.direction);if(o){var l,a=i<0?Y(o):o[0],s=i<0==(1==a.level),u=s?"after":"before";if(a.level>0||"rtl"==t.doc.direction){var c=tr(t,n);l=i<0?n.text.length-1:0;var h=nr(t,c,l).top;l=ae((function(e){return nr(t,c,e).top==h}),i<0==(1==a.level)?a.from:a.to-1,l),"before"==u&&(l=Kl(n,l,1))}else l=i<0?a.to:a.from;return new it(r,l,u)}}return new it(r,i<0?n.text.length:0,i<0?"before":"after")}function Yl(e,t,n,r){var i=fe(t,e.doc.direction);if(!i)return $l(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=ce(i,n.ch,n.sticky),l=i[o];if("ltr"==e.doc.direction&&l.level%2==0&&(r>0?l.to>n.ch:l.from<n.ch))return $l(t,n,r);var a,s=function(e,n){return Kl(t,e instanceof it?e.ch:e,n)},u=function(n){return e.options.lineWrapping?(a=a||tr(e,t),Sr(e,t,a,n)):{begin:0,end:t.text.length}},c=u("before"==n.sticky?s(n,-1):n.ch);if("rtl"==e.doc.direction||1==l.level){var h=1==l.level==r<0,f=s(n,h?1:-1);if(null!=f&&(h?f<=l.to&&f<=c.end:f>=l.from&&f>=c.begin)){var d=h?"before":"after";return new it(n.line,f,d)}}var p=function(e,t,r){for(var o=function(e,t){return t?new it(n.line,s(e,1),"before"):new it(n.line,e,"after")};e>=0&&e<i.length;e+=t){var l=i[e],a=t>0==(1!=l.level),u=a?r.begin:s(r.end,-1);if(l.from<=u&&u<l.to)return o(u,a);if(u=a?l.from:s(l.to,-1),r.begin<=u&&u<r.end)return o(u,a)}},g=p(o+r,r,c);if(g)return g;var v=r>0?c.end:s(c.begin,-1);return null==v||r>0&&v==t.text.length||(g=p(r>0?0:i.length-1,r,u(v)),!g)?null:g}Pl.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"},Pl.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"},Pl.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Pl.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"]},Pl["default"]=y?Pl.macDefault:Pl.pcDefault;var ql={selectAll:Yo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),U)},killLine:function(e){return jl(e,(function(t){if(t.empty()){var n=qe(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:it(t.head.line+1,0)}:{from:t.head,to:it(t.head.line,n)}}return{from:t.from(),to:t.to()}}))},deleteLine:function(e){return jl(e,(function(t){return{from:it(t.from().line,0),to:ht(e.doc,it(t.to().line+1,0))}}))},delLineLeft:function(e){return jl(e,(function(e){return{from:it(e.from().line,0),to:e.from()}}))},delWrappedLineLeft:function(e){return jl(e,(function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return{from:r,to:t.from()}}))},delWrappedLineRight:function(e){return jl(e,(function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}}))},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(it(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(it(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy((function(t){return Zl(e,t.head.line)}),{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy((function(t){return Ql(e,t.head)}),{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy((function(t){return Jl(e,t.head.line)}),{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy((function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")}),j)},goLineLeft:function(e){return e.extendSelectionsBy((function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")}),j)},goLineLeftSmart:function(e){return e.extendSelectionsBy((function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?Ql(e,t.head):r}),j)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection("\t")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var o=n[i].from(),l=z(e.getLine(o.line),o.ch,r);t.push(X(r-l%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Ai(e,(function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++)if(t[r].empty()){var i=t[r].head,o=qe(e.doc,i.line).text;if(o)if(i.ch==o.length&&(i=new it(i.line,i.ch-1)),i.ch>0)i=new it(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),it(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var l=qe(e.doc,i.line-1).text;l&&(i=new it(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+l.charAt(l.length-1),it(i.line-1,l.length-1),i,"+transpose"))}n.push(new io(i,i))}e.setSelections(n)}))},newlineAndIndent:function(e){return Ai(e,(function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);li(e)}))},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function Zl(e,t){var n=qe(e.doc,t),r=Zt(n);return r!=n&&(t=et(r)),Xl(!0,e,r,t,1)}function Jl(e,t){var n=qe(e.doc,t),r=Jt(n);return r!=n&&(t=et(r)),Xl(!0,e,n,t,-1)}function Ql(e,t){var n=Zl(e,t.line),r=qe(e.doc,n.line),i=fe(r,e.doc.direction);if(!i||0==i[0].level){var o=Math.max(n.ch,r.text.search(/\S/)),l=t.line==n.line&&t.ch<=o&&t.ch;return it(n.line,l?0:o,n.sticky)}return n}function ea(e,t,n){if("string"==typeof t&&(t=ql[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=G}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function ta(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Bl(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Bl(t,e.options.extraKeys,n,e)||Bl(t,e.options.keyMap,n,e)}var na=new R;function ra(e,t,n,r){var i=e.state.keySeq;if(i){if(_l(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:na.set(50,(function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())})),ia(e,i+" "+t,n,r))return!0}return ia(e,t,n,r)}function ia(e,t,n,r){var i=ta(e,t,r);return"multi"==i&&(e.state.keySeq=t),"handled"==i&&Nn(e,"keyHandled",e,t,n),"handled"!=i&&"multi"!=i||(Ce(n),$r(e)),!!i}function oa(e,t){var n=Ul(t,!0);return!!n&&(t.shiftKey&&!e.state.keySeq?ra(e,"Shift-"+n,t,(function(t){return ea(e,t,!0)}))||ra(e,n,t,(function(t){if("string"==typeof t?/^go[A-Z]/.test(t):t.motion)return ea(e,t)})):ra(e,n,t,(function(t){return ea(e,t)})))}function la(e,t,n){return ra(e,"'"+n+"'",t,(function(t){return ea(e,t,!0)}))}var aa=null;function sa(e){var t=this;if((!e.target||e.target==t.display.input.getField())&&(t.curOp.focus=W(),!ye(t,e))){l&&a<11&&27==e.keyCode&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=16==r||e.shiftKey;var i=oa(t,e);h&&(aa=i?r:null,i||88!=r||He||!(y?e.metaKey:e.ctrlKey)||t.replaceSelection("",null,"cut")),n&&!y&&!i&&46==r&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),18!=r||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||ua(t)}}function ua(e){var t=e.display.lineDiv;function n(e){18!=e.keyCode&&e.altKey||(T(t,"CodeMirror-crosshair"),ve(document,"keyup",n),ve(document,"mouseover",n))}E(t,"CodeMirror-crosshair"),pe(document,"keyup",n),pe(document,"mouseover",n)}function ca(e){16==e.keyCode&&(this.doc.sel.shift=!1),ye(this,e)}function ha(e){var t=this;if((!e.target||e.target==t.display.input.getField())&&!(Un(t.display,e)||ye(t,e)||e.ctrlKey&&!e.altKey||y&&e.metaKey)){var n=e.keyCode,r=e.charCode;if(h&&n==aa)return aa=null,void Ce(e);if(!h||e.which&&!(e.which<10)||!oa(t,e)){var i=String.fromCharCode(null==r?n:r);"\b"!=i&&(la(t,e,i)||t.display.input.onKeyPress(e))}}}var fa,da,pa=400,ga=function(e,t,n){this.time=e,this.pos=t,this.button=n};function va(e,t){var n=+new Date;return da&&da.compare(n,e,t)?(fa=da=null,"triple"):fa&&fa.compare(n,e,t)?(da=new ga(n,e,t),fa=null,"double"):(fa=new ga(n,e,t),da=null,"single")}function ma(e){var t=this,n=t.display;if(!(ye(t,e)||n.activeTouch&&n.input.supportsTouch()))if(n.input.ensurePolled(),n.shift=e.shiftKey,Un(n,e))s||(n.scroller.draggable=!1,setTimeout((function(){return n.scroller.draggable=!0}),100));else if(!Ta(t,e)){var r=Fr(t,e),i=Me(e),o=r?va(r,i):"single";window.focus(),1==i&&t.state.selectingText&&t.state.selectingText(e),r&&ya(t,i,r,o,e)||(1==i?r?wa(t,r,o,e):Te(e)==n.scroller&&Ce(e):2==i?(r&&Ho(t.doc,r),setTimeout((function(){return n.input.focus()}),20)):3==i&&(S?t.display.input.onContextMenu(e):Yr(t)))}}function ya(e,t,n,r,i){var o="Click";return"double"==r?o="Double"+o:"triple"==r&&(o="Triple"+o),o=(1==t?"Left":2==t?"Middle":"Right")+o,ra(e,Gl(o,i),i,(function(t){if("string"==typeof t&&(t=ql[t]),!t)return!1;var r=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r=t(e,n)!=G}finally{e.state.suppressEdits=!1}return r}))}function ba(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(null==i.unit){var o=b?n.shiftKey&&n.metaKey:n.altKey;i.unit=o?"rectangle":"single"==t?"char":"double"==t?"word":"line"}return(null==i.extend||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),null==i.addNew&&(i.addNew=y?n.metaKey:n.ctrlKey),null==i.moveOnDrag&&(i.moveOnDrag=!(y?n.altKey:n.ctrlKey)),i}function wa(e,t,n,r){l?setTimeout(I(Xr,e),0):e.curOp.focus=W();var i,o=ba(e,n,r),a=e.doc.sel;e.options.dragDrop&&Ae&&!e.isReadOnly()&&"single"==n&&(i=a.contains(t))>-1&&(ot((i=a.ranges[i]).from(),t)<0||t.xRel>0)&&(ot(i.to(),t)>0||t.xRel<0)?xa(e,r,t,o):Sa(e,r,t,o)}function xa(e,t,n,r){var i=e.display,o=!1,u=Di(e,(function(t){s&&(i.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:Yr(e)),ve(i.wrapper.ownerDocument,"mouseup",u),ve(i.wrapper.ownerDocument,"mousemove",c),ve(i.scroller,"dragstart",h),ve(i.scroller,"drop",u),o||(Ce(t),r.addNew||Ho(e.doc,n,null,null,r.extend),s&&!f||l&&9==a?setTimeout((function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()}),20):i.input.focus())})),c=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},h=function(){return o=!0};s&&(i.scroller.draggable=!0),e.state.draggingText=u,u.copy=!r.moveOnDrag,pe(i.wrapper.ownerDocument,"mouseup",u),pe(i.wrapper.ownerDocument,"mousemove",c),pe(i.scroller,"dragstart",h),pe(i.scroller,"drop",u),e.state.delayingBlurEvent=!0,setTimeout((function(){return i.input.focus()}),20),i.scroller.dragDrop&&i.scroller.dragDrop()}function Ca(e,t,n){if("char"==n)return new io(t,t);if("word"==n)return e.findWordAt(t);if("line"==n)return new io(it(t.line,0),ht(e.doc,it(t.line+1,0)));var r=n(e,t);return new io(r.from,r.to)}function Sa(e,t,n,r){l&&Yr(e);var i=e.display,o=e.doc;Ce(t);var a,s,u=o.sel,c=u.ranges;if(r.addNew&&!r.extend?(s=o.sel.contains(n),a=s>-1?c[s]:new io(n,n)):(a=o.sel.primary(),s=o.sel.primIndex),"rectangle"==r.unit)r.addNew||(a=new io(n,n)),n=Fr(e,t,!0,!0),s=-1;else{var h=Ca(e,n,r.unit);a=r.extend?Fo(a,h.anchor,h.head,r.extend):h}r.addNew?-1==s?(s=c.length,_o(o,oo(e,c.concat([a]),s),{scroll:!1,origin:"*mouse"})):c.length>1&&c[s].empty()&&"char"==r.unit&&!r.extend?(_o(o,oo(e,c.slice(0,s).concat(c.slice(s+1)),0),{scroll:!1,origin:"*mouse"}),u=o.sel):Po(o,s,a,V):(s=0,_o(o,new ro([a],0),V),u=o.sel);var f=n;function d(t){if(0!=ot(f,t))if(f=t,"rectangle"==r.unit){for(var i=[],l=e.options.tabSize,c=z(qe(o,n.line).text,n.ch,l),h=z(qe(o,t.line).text,t.ch,l),d=Math.min(c,h),p=Math.max(c,h),g=Math.min(n.line,t.line),v=Math.min(e.lastLine(),Math.max(n.line,t.line));g<=v;g++){var m=qe(o,g).text,y=K(m,d,l);d==p?i.push(new io(it(g,y),it(g,y))):m.length>y&&i.push(new io(it(g,y),it(g,K(m,p,l))))}i.length||i.push(new io(n,n)),_o(o,oo(e,u.ranges.slice(0,s).concat(i),s),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b,w=a,x=Ca(e,t,r.unit),C=w.anchor;ot(x.anchor,C)>0?(b=x.head,C=ut(w.from(),x.anchor)):(b=x.anchor,C=st(w.to(),x.head));var S=u.ranges.slice(0);S[s]=ka(e,new io(ht(o,C),b)),_o(o,oo(e,S,s),V)}}var p=i.wrapper.getBoundingClientRect(),g=0;function v(t){var n=++g,l=Fr(e,t,!0,"rectangle"==r.unit);if(l)if(0!=ot(l,f)){e.curOp.focus=W(),d(l);var a=ei(i,o);(l.line>=a.to||l.line<a.from)&&setTimeout(Di(e,(function(){g==n&&v(t)})),150)}else{var s=t.clientY<p.top?-20:t.clientY>p.bottom?20:0;s&&setTimeout(Di(e,(function(){g==n&&(i.scroller.scrollTop+=s,v(t))})),50)}}function m(t){e.state.selectingText=!1,g=1/0,t&&(Ce(t),i.input.focus()),ve(i.wrapper.ownerDocument,"mousemove",y),ve(i.wrapper.ownerDocument,"mouseup",b),o.history.lastSelOrigin=null}var y=Di(e,(function(e){0!==e.buttons&&Me(e)?v(e):m(e)})),b=Di(e,m);e.state.selectingText=b,pe(i.wrapper.ownerDocument,"mousemove",y),pe(i.wrapper.ownerDocument,"mouseup",b)}function ka(e,t){var n=t.anchor,r=t.head,i=qe(e.doc,n.line);if(0==ot(n,r)&&n.sticky==r.sticky)return t;var o=fe(i);if(!o)return t;var l=ce(o,n.ch,n.sticky),a=o[l];if(a.from!=n.ch&&a.to!=n.ch)return t;var s,u=l+(a.from==n.ch==(1!=a.level)?0:1);if(0==u||u==o.length)return t;if(r.line!=n.line)s=(r.line-n.line)*("ltr"==e.doc.direction?1:-1)>0;else{var c=ce(o,r.ch,r.sticky),h=c-l||(r.ch-n.ch)*(1==a.level?-1:1);s=c==u-1||c==u?h<0:h>0}var f=o[u+(s?-1:0)],d=s==(1==f.level),p=d?f.from:f.to,g=d?"after":"before";return n.ch==p&&n.sticky==g?t:new io(new it(n.line,p,g),r)}function La(e,t,n,r){var i,o;if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY;else try{i=t.clientX,o=t.clientY}catch(f){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Ce(t);var l=e.display,a=l.lineDiv.getBoundingClientRect();if(o>a.bottom||!we(e,n))return ke(t);o-=a.top-l.viewOffset;for(var s=0;s<e.display.gutterSpecs.length;++s){var u=l.gutters.childNodes[s];if(u&&u.getBoundingClientRect().right>=i){var c=tt(e.doc,o),h=e.display.gutterSpecs[s];return me(e,n,e,c,h.className,t),ke(t)}}}function Ta(e,t){return La(e,t,"gutterClick",!0)}function Ma(e,t){Un(e.display,t)||Na(e,t)||ye(e,t,"contextmenu")||S||e.display.input.onContextMenu(t)}function Na(e,t){return!!we(e,"gutterContextMenu")&&La(e,t,"gutterContextMenu",!1)}function Oa(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),hr(e)}ga.prototype.compare=function(e,t,n){return this.time+pa>e&&0==ot(t,this.pos)&&n==this.button};var Aa={toString:function(){return"CodeMirror.Init"}},Da={},Wa={};function Ea(e){var t=e.optionHandlers;function n(n,r,i,o){e.defaults[n]=r,i&&(t[n]=o?function(e,t,n){n!=Aa&&i(e,t,n)}:i)}e.defineOption=n,e.Init=Aa,n("value","",(function(e,t){return e.setValue(t)}),!0),n("mode",null,(function(e,t){e.doc.modeOption=t,fo(e)}),!0),n("indentUnit",2,fo,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,(function(e){po(e),hr(e),Ir(e)}),!0),n("lineSeparator",null,(function(e,t){if(e.doc.lineSep=t,t){var n=[],r=e.doc.first;e.doc.iter((function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(-1==o)break;i=o+t.length,n.push(it(r,o))}r++}));for(var i=n.length-1;i>=0;i--)rl(e.doc,t,n[i],it(n[i].line,n[i].ch+t.length))}})),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,(function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),n!=Aa&&e.refresh()})),n("specialCharPlaceholder",gn,(function(e){return e.refresh()}),!0),n("electricChars",!0),n("inputStyle",m?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),n("spellcheck",!1,(function(e,t){return e.getInputField().spellcheck=t}),!0),n("autocorrect",!1,(function(e,t){return e.getInputField().autocorrect=t}),!0),n("autocapitalize",!1,(function(e,t){return e.getInputField().autocapitalize=t}),!0),n("rtlMoveVisually",!w),n("wholeLineUpdateBefore",!0),n("theme","default",(function(e){Oa(e),qi(e)}),!0),n("keyMap","default",(function(e,t,n){var r=Vl(t),i=n!=Aa&&Vl(n);i&&i.detach&&i.detach(e,r),r.attach&&r.attach(e,i||null)})),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Ha,!0),n("gutters",[],(function(e,t){e.display.gutterSpecs=Xi(t,e.options.lineNumbers),qi(e)}),!0),n("fixedGutter",!0,(function(e,t){e.display.gutters.style.left=t?Dr(e.display)+"px":"0",e.refresh()}),!0),n("coverGutterNextToScrollbar",!1,(function(e){return mi(e)}),!0),n("scrollbarStyle","native",(function(e){wi(e),mi(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)}),!0),n("lineNumbers",!1,(function(e,t){e.display.gutterSpecs=Xi(e.options.gutters,t),qi(e)}),!0),n("firstLineNumber",1,qi,!0),n("lineNumberFormatter",(function(e){return e}),qi,!0),n("showCursorWhenSelecting",!1,Gr,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,(function(e,t){"nocursor"==t&&(Zr(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)})),n("screenReaderLabel",null,(function(e,t){t=""===t?null:t,e.display.input.screenReaderLabelChanged(t)})),n("disableInput",!1,(function(e,t){t||e.display.input.reset()}),!0),n("dragDrop",!0,Fa),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,Gr,!0),n("singleCursorHeightPerLine",!0,Gr,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,po,!0),n("addModeClass",!1,po,!0),n("pollInterval",100),n("undoDepth",200,(function(e,t){return e.doc.history.undoDepth=t})),n("historyEventDelay",1250),n("viewportMargin",10,(function(e){return e.refresh()}),!0),n("maxHighlightLength",1e4,po,!0),n("moveInputWithCursor",!0,(function(e,t){t||e.display.input.resetPosition()})),n("tabindex",null,(function(e,t){return e.display.input.getField().tabIndex=t||""})),n("autofocus",null),n("direction","ltr",(function(e,t){return e.doc.setDirection(t)}),!0),n("phrases",null)}function Fa(e,t,n){var r=n&&n!=Aa;if(!t!=!r){var i=e.display.dragFunctions,o=t?pe:ve;o(e.display.scroller,"dragstart",i.start),o(e.display.scroller,"dragenter",i.enter),o(e.display.scroller,"dragover",i.over),o(e.display.scroller,"dragleave",i.leave),o(e.display.scroller,"drop",i.drop)}}function Ha(e){e.options.lineWrapping?(E(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(T(e.display.wrapper,"CodeMirror-wrap"),an(e)),Er(e),Ir(e),hr(e),setTimeout((function(){return mi(e)}),100)}function Ia(e,t){var n=this;if(!(this instanceof Ia))return new Ia(e,t);this.options=t=t?P(t):{},P(Da,t,!1);var r=t.value;"string"==typeof r?r=new Cl(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Ia.inputStyles[t.inputStyle](this),o=this.display=new Zi(e,r,i,t);for(var u in o.wrapper.CodeMirror=this,Oa(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),wi(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 R,keySeq:null,specialChars:null},t.autofocus&&!m&&o.input.focus(),l&&a<11&&setTimeout((function(){return n.display.input.reset(!0)}),20),Pa(this),Al(),Ci(this),this.curOp.forceUpdate=!0,yo(this,r),t.autofocus&&!m||this.hasFocus()?setTimeout((function(){n.hasFocus()&&!n.state.focused&&qr(n)}),20):Zr(this),Wa)Wa.hasOwnProperty(u)&&Wa[u](this,t[u],Aa);$i(this),t.finishInit&&t.finishInit(this);for(var c=0;c<za.length;++c)za[c](this);Si(this),s&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}function Pa(e){var t=e.display;pe(t.scroller,"mousedown",Di(e,ma)),pe(t.scroller,"dblclick",l&&a<11?Di(e,(function(t){if(!ye(e,t)){var n=Fr(e,t);if(n&&!Ta(e,t)&&!Un(e.display,t)){Ce(t);var r=e.findWordAt(n);Ho(e.doc,r.anchor,r.head)}}})):function(t){return ye(e,t)||Ce(t)}),pe(t.scroller,"contextmenu",(function(t){return Ma(e,t)})),pe(t.input.getField(),"contextmenu",(function(n){t.scroller.contains(n.target)||Ma(e,n)}));var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout((function(){return t.activeTouch=null}),1e3),r=t.activeTouch,r.end=+new Date)}function o(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}function s(e,t){if(null==t.left)return!0;var n=t.left-e.left,r=t.top-e.top;return n*n+r*r>400}pe(t.scroller,"touchstart",(function(i){if(!ye(e,i)&&!o(i)&&!Ta(e,i)){t.input.ensurePolled(),clearTimeout(n);var l=+new Date;t.activeTouch={start:l,moved:!1,prev:l-r.end<=300?r:null},1==i.touches.length&&(t.activeTouch.left=i.touches[0].pageX,t.activeTouch.top=i.touches[0].pageY)}})),pe(t.scroller,"touchmove",(function(){t.activeTouch&&(t.activeTouch.moved=!0)})),pe(t.scroller,"touchend",(function(n){var r=t.activeTouch;if(r&&!Un(t,n)&&null!=r.left&&!r.moved&&new Date-r.start<300){var o,l=e.coordsChar(t.activeTouch,"page");o=!r.prev||s(r,r.prev)?new io(l,l):!r.prev.prev||s(r,r.prev.prev)?e.findWordAt(l):new io(it(l.line,0),ht(e.doc,it(l.line+1,0))),e.setSelection(o.anchor,o.head),e.focus(),Ce(n)}i()})),pe(t.scroller,"touchcancel",i),pe(t.scroller,"scroll",(function(){t.scroller.clientHeight&&(hi(e,t.scroller.scrollTop),di(e,t.scroller.scrollLeft,!0),me(e,"scroll",e))})),pe(t.scroller,"mousewheel",(function(t){return no(e,t)})),pe(t.scroller,"DOMMouseScroll",(function(t){return no(e,t)})),pe(t.wrapper,"scroll",(function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0})),t.dragFunctions={enter:function(t){ye(e,t)||Le(t)},over:function(t){ye(e,t)||(Tl(e,t),Le(t))},start:function(t){return Ll(e,t)},drop:Di(e,kl),leave:function(t){ye(e,t)||Ml(e)}};var u=t.input.getField();pe(u,"keyup",(function(t){return ca.call(e,t)})),pe(u,"keydown",Di(e,sa)),pe(u,"keypress",Di(e,ha)),pe(u,"focus",(function(t){return qr(e,t)})),pe(u,"blur",(function(t){return Zr(e,t)}))}Ia.defaults=Da,Ia.optionHandlers=Wa;var za=[];function Ra(e,t,n,r){var i,o=e.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?i=yt(e,t).state:n="prev");var l=e.options.tabSize,a=qe(o,t),s=z(a.text,null,l);a.stateAfter&&(a.stateAfter=null);var u,c=a.text.match(/^\s*/)[0];if(r||/\S/.test(a.text)){if("smart"==n&&(u=o.mode.indent(i,a.text.slice(c.length),a.text),u==G||u>150)){if(!r)return;n="prev"}}else u=0,n="not";"prev"==n?u=t>o.first?z(qe(o,t-1).text,null,l):0:"add"==n?u=s+e.options.indentUnit:"subtract"==n?u=s-e.options.indentUnit:"number"==typeof n&&(u=s+n),u=Math.max(0,u);var h="",f=0;if(e.options.indentWithTabs)for(var d=Math.floor(u/l);d;--d)f+=l,h+="\t";if(f<u&&(h+=X(u-f)),h!=c)return rl(o,h,it(t,0),it(t,c.length),"+input"),a.stateAfter=null,!0;for(var p=0;p<o.sel.ranges.length;p++){var g=o.sel.ranges[p];if(g.head.line==t&&g.head.ch<c.length){var v=it(t,c.length);Po(o,p,new io(v,v));break}}}Ia.defineInitHook=function(e){return za.push(e)};var Ba=null;function _a(e){Ba=e}function Ga(e,t,n,r,i){var o=e.doc;e.display.shift=!1,r||(r=o.sel);var l=+new Date-200,a="paste"==i||e.state.pasteIncoming>l,s=Ee(t),u=null;if(a&&r.ranges.length>1)if(Ba&&Ba.text.join("\n")==t){if(r.ranges.length%Ba.text.length==0){u=[];for(var c=0;c<Ba.text.length;c++)u.push(o.splitLines(Ba.text[c]))}}else s.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(u=q(s,(function(e){return[e]})));for(var h=e.curOp.updateInput,f=r.ranges.length-1;f>=0;f--){var d=r.ranges[f],p=d.from(),g=d.to();d.empty()&&(n&&n>0?p=it(p.line,p.ch-n):e.state.overwrite&&!a?g=it(g.line,Math.min(qe(o,g.line).text.length,g.ch+Y(s).length)):a&&Ba&&Ba.lineWise&&Ba.text.join("\n")==s.join("\n")&&(p=g=it(p.line,0)));var v={from:p,to:g,text:u?u[f%u.length]:s,origin:i||(a?"paste":e.state.cutIncoming>l?"cut":"+input")};Zo(e.doc,v),Nn(e,"inputRead",e,v)}t&&!a&&Va(e,t),li(e),e.curOp.updateInput<2&&(e.curOp.updateInput=h),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Ua(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Ai(t,(function(){return Ga(t,n,0,null,"paste")})),!0}function Va(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var o=e.getModeAt(i.head),l=!1;if(o.electricChars){for(var a=0;a<o.electricChars.length;a++)if(t.indexOf(o.electricChars.charAt(a))>-1){l=Ra(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(qe(e.doc,i.head.line).text.slice(0,i.head.ch))&&(l=Ra(e,i.head.line,"smart"));l&&Nn(e,"electricInput",e,i.head.line)}}}function ja(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,o={anchor:it(i,0),head:it(i+1,0)};n.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:n}}function Ka(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function $a(){var e=O("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none"),t=O("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return s?e.style.width="1000px":e.setAttribute("wrap","off"),g&&(e.style.border="1px solid black"),Ka(e),t}function Xa(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,n){var r=this.options,i=r[e];r[e]==n&&"mode"!=e||(r[e]=n,t.hasOwnProperty(e)&&Di(this,t[e])(this,n,i),me(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Vl(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;n<t.length;++n)if(t[n]==e||t[n].name==e)return t.splice(n,1),!0},addOverlay:Wi((function(t,n){var r=t.token?t:e.getMode(this.options,t);if(r.startState)throw new Error("Overlays may not be stateful.");Z(this.state.overlays,{mode:r,modeSpec:t,opaque:n&&n.opaque,priority:n&&n.priority||0},(function(e){return e.priority})),this.state.modeGen++,Ir(this)})),removeOverlay:Wi((function(e){for(var t=this.state.overlays,n=0;n<t.length;++n){var r=t[n].modeSpec;if(r==e||"string"==typeof e&&r.name==e)return t.splice(n,1),this.state.modeGen++,void Ir(this)}})),indentLine:Wi((function(e,t,n){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),nt(this.doc,e)&&Ra(this,e,t,n)})),indentSelection:Wi((function(e){for(var t=this.doc.sel.ranges,n=-1,r=0;r<t.length;r++){var i=t[r];if(i.empty())i.head.line>n&&(Ra(this,i.head.line,e,!0),n=i.head.line,r==this.doc.sel.primIndex&&li(this));else{var o=i.from(),l=i.to(),a=Math.max(n,o.line);n=Math.min(this.lastLine(),l.line-(l.ch?0:1))+1;for(var s=a;s<n;++s)Ra(this,s,e);var u=this.doc.sel.ranges;0==o.ch&&t.length==u.length&&u[r].from().ch>0&&Po(this.doc,r,new io(o,u[r].to()),U)}}})),getTokenAt:function(e,t){return St(this,e,t)},getLineTokens:function(e,t){return St(this,it(e),t,!0)},getTokenTypeAt:function(e){e=ht(this.doc,e);var t,n=mt(this,qe(this.doc,e.line)),r=0,i=(n.length-1)/2,o=e.ch;if(0==o)t=n[2];else for(;;){var l=r+i>>1;if((l?n[2*l-1]:0)>=o)i=l;else{if(!(n[2*l+1]<o)){t=n[2*l+2];break}r=l+1}}var a=t?t.indexOf("overlay "):-1;return a<0?t:0==a?null:t.slice(0,a-1)},getModeAt:function(t){var n=this.doc.mode;return n.innerMode?e.innerMode(n,this.getTokenAt(t).state).mode:n},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var r=[];if(!n.hasOwnProperty(t))return r;var i=n[t],o=this.getModeAt(e);if("string"==typeof o[t])i[o[t]]&&r.push(i[o[t]]);else if(o[t])for(var l=0;l<o[t].length;l++){var a=i[o[t][l]];a&&r.push(a)}else o.helperType&&i[o.helperType]?r.push(i[o.helperType]):i[o.name]&&r.push(i[o.name]);for(var s=0;s<i._global.length;s++){var u=i._global[s];u.pred(o,this)&&-1==B(r,u.val)&&r.push(u.val)}return r},getStateAfter:function(e,t){var n=this.doc;return e=ct(n,null==e?n.first+n.size-1:e),yt(this,e+1,t).state},cursorCoords:function(e,t){var n,r=this.doc.sel.primary();return n=null==e?r.head:"object"==typeof e?ht(this.doc,e):e?r.from():r.to(),yr(this,n,t||"page")},charCoords:function(e,t){return mr(this,ht(this.doc,e),t||"page")},coordsChar:function(e,t){return e=vr(this,e,t||"page"),xr(this,e.left,e.top)},lineAtHeight:function(e,t){return e=vr(this,{top:e,left:0},t||"page").top,tt(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,n){var r,i=!1;if("number"==typeof e){var o=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>o&&(e=o,i=!0),r=qe(this.doc,e)}else r=e;return gr(this,r,{top:0,left:0},t||"page",n||i).top+(i?this.doc.height-on(r):0)},defaultTextHeight:function(){return Nr(this.display)},defaultCharWidth:function(){return Or(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,r,i){var o=this.display;e=yr(this,ht(this.doc,e));var l=e.bottom,a=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==r)l=e.top;else if("above"==r||"near"==r){var s=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==r||e.bottom+t.offsetHeight>s)&&e.top>t.offsetHeight?l=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=s&&(l=e.bottom),a+t.offsetWidth>u&&(a=u-t.offsetWidth)}t.style.top=l+"px",t.style.left=t.style.right="","right"==i?(a=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?a=0:"middle"==i&&(a=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=a+"px"),n&&ri(this,{left:a,top:l,right:a+t.offsetWidth,bottom:l+t.offsetHeight})},triggerOnKeyDown:Wi(sa),triggerOnKeyPress:Wi(ha),triggerOnKeyUp:ca,triggerOnMouseDown:Wi(ma),execCommand:function(e){if(ql.hasOwnProperty(e))return ql[e].call(null,this)},triggerElectric:Wi((function(e){Va(this,e)})),findPosH:function(e,t,n,r){var i=1;t<0&&(i=-1,t=-t);for(var o=ht(this.doc,e),l=0;l<t;++l)if(o=Ya(this.doc,o,i,n,r),o.hitSide)break;return o},moveH:Wi((function(e,t){var n=this;this.extendSelectionsBy((function(r){return n.display.shift||n.doc.extend||r.empty()?Ya(n.doc,r.head,e,t,n.options.rtlMoveVisually):e<0?r.from():r.to()}),j)})),deleteH:Wi((function(e,t){var n=this.doc.sel,r=this.doc;n.somethingSelected()?r.replaceSelection("",null,"+delete"):jl(this,(function(n){var i=Ya(r,n.head,e,t,!1);return e<0?{from:i,to:n.head}:{from:n.head,to:i}}))})),findPosV:function(e,t,n,r){var i=1,o=r;t<0&&(i=-1,t=-t);for(var l=ht(this.doc,e),a=0;a<t;++a){var s=yr(this,l,"div");if(null==o?o=s.left:s.left=o,l=qa(this,s,i,n),l.hitSide)break}return l},moveV:Wi((function(e,t){var n=this,r=this.doc,i=[],o=!this.display.shift&&!r.extend&&r.sel.somethingSelected();if(r.extendSelectionsBy((function(l){if(o)return e<0?l.from():l.to();var a=yr(n,l.head,"div");null!=l.goalColumn&&(a.left=l.goalColumn),i.push(a.left);var s=qa(n,a,e,t);return"page"==t&&l==r.sel.primary()&&oi(n,mr(n,s,"div").top-a.top),s}),j),i.length)for(var l=0;l<r.sel.ranges.length;l++)r.sel.ranges[l].goalColumn=i[l]})),findWordAt:function(e){var t=this.doc,n=qe(t,e.line).text,r=e.ch,i=e.ch;if(n){var o=this.getHelper(e,"wordChars");"before"!=e.sticky&&i!=n.length||!r?++i:--r;var l=n.charAt(r),a=ne(l,o)?function(e){return ne(e,o)}:/\s/.test(l)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!ne(e)};while(r>0&&a(n.charAt(r-1)))--r;while(i<n.length&&a(n.charAt(i)))++i}return new io(it(e.line,r),it(e.line,i))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?E(this.display.cursorDiv,"CodeMirror-overwrite"):T(this.display.cursorDiv,"CodeMirror-overwrite"),me(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==W()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:Wi((function(e,t){ai(this,e,t)})),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-$n(this)-this.display.barHeight,width:e.scrollWidth-$n(this)-this.display.barWidth,clientHeight:Yn(this),clientWidth:Xn(this)}},scrollIntoView:Wi((function(e,t){null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:it(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null!=e.from.line?si(this,e):ci(this,e.from,e.to,e.margin)})),setSize:Wi((function(e,t){var n=this,r=function(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e};null!=e&&(this.display.wrapper.style.width=r(e)),null!=t&&(this.display.wrapper.style.height=r(t)),this.options.lineWrapping&&cr(this);var i=this.display.viewFrom;this.doc.iter(i,this.display.viewTo,(function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){Pr(n,i,"widget");break}++i})),this.curOp.forceUpdate=!0,me(this,"refresh",this)})),operation:function(e){return Ai(this,e)},startOperation:function(){return Ci(this)},endOperation:function(){return Si(this)},refresh:Wi((function(){var e=this.display.cachedTextHeight;Ir(this),this.curOp.forceUpdate=!0,hr(this),ai(this,this.doc.scrollLeft,this.doc.scrollTop),Vi(this.display),(null==e||Math.abs(e-Nr(this.display))>.5||this.options.lineWrapping)&&Er(this),me(this,"refresh",this)})),swapDoc:Wi((function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),yo(this,e),hr(this),this.display.input.reset(),ai(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,Nn(this,"swapDoc",this,t),t})),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},xe(e),e.registerHelper=function(t,r,i){n.hasOwnProperty(t)||(n[t]=e[t]={_global:[]}),n[t][r]=i},e.registerGlobalHelper=function(t,r,i,o){e.registerHelper(t,r,o),n[t]._global.push({pred:i,val:o})}}function Ya(e,t,n,r,i){var o=t,l=n,a=qe(e,t.line),s=i&&"rtl"==e.direction?-n:n;function u(){var n=t.line+s;return!(n<e.first||n>=e.first+e.size)&&(t=new it(n,t.ch,t.sticky),a=qe(e,n))}function c(o){var l;if("codepoint"==r){var c=a.text.charCodeAt(t.ch+(n>0?0:-1));if(isNaN(c))l=null;else{var h=n>0?c>=55296&&c<56320:c>=56320&&c<57343;l=new it(t.line,Math.max(0,Math.min(a.text.length,t.ch+n*(h?2:1))),-n)}}else l=i?Yl(e.cm,a,t,n):$l(a,t,n);if(null==l){if(o||!u())return!1;t=Xl(i,e.cm,a,t.line,s)}else t=l;return!0}if("char"==r||"codepoint"==r)c();else if("column"==r)c(!0);else if("word"==r||"group"==r)for(var h=null,f="group"==r,d=e.cm&&e.cm.getHelper(t,"wordChars"),p=!0;;p=!1){if(n<0&&!c(!p))break;var g=a.text.charAt(t.ch)||"\n",v=ne(g,d)?"w":f&&"\n"==g?"n":!f||/\s/.test(g)?null:"p";if(!f||p||v||(v="s"),h&&h!=v){n<0&&(n=1,c(),t.sticky="after");break}if(v&&(h=v),n>0&&!c(!p))break}var m=$o(e,t,o,l,!0);return lt(o,m)&&(m.hitSide=!0),m}function qa(e,t,n,r){var i,o,l=e.doc,a=t.left;if("page"==r){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),u=Math.max(s-.5*Nr(e.display),3);i=(n>0?t.bottom:t.top)+n*u}else"line"==r&&(i=n>0?t.bottom+3:t.top-3);for(;;){if(o=xr(e,a,i),!o.outside)break;if(n<0?i<=0:i>=l.height){o.hitSide=!0;break}i+=5*n}return o}var Za=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new R,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Ja(e,t){var n=er(e,t.line);if(!n||n.hidden)return null;var r=qe(e.doc,t.line),i=Zn(n,r,t.line),o=fe(r,e.doc.direction),l="left";if(o){var a=ce(o,t.ch);l=a%2?"right":"left"}var s=or(i.map,t.ch,l);return s.offset="right"==s.collapse?s.end:s.start,s}function Qa(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function es(e,t){return t&&(e.bad=!0),e}function ts(e,t,n,r,i){var o="",l=!1,a=e.doc.lineSeparator(),s=!1;function u(e){return function(t){return t.id==e}}function c(){l&&(o+=a,s&&(o+=a),l=s=!1)}function h(e){e&&(c(),o+=e)}function f(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(n)return void h(n);var o,d=t.getAttribute("cm-marker");if(d){var p=e.findMarks(it(r,0),it(i+1,0),u(+d));return void(p.length&&(o=p[0].find(0))&&h(Ze(e.doc,o.from,o.to).join(a)))}if("false"==t.getAttribute("contenteditable"))return;var g=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;g&&c();for(var v=0;v<t.childNodes.length;v++)f(t.childNodes[v]);/^(pre|p)$/i.test(t.nodeName)&&(s=!0),g&&(l=!0)}else 3==t.nodeType&&h(t.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;;){if(f(t),t==n)break;t=t.nextSibling,s=!1}return o}function ns(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return es(e.clipPos(it(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==r)return rs(o,t,n)}}function rs(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!D(r,t))return es(it(et(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var o=e.rest?Y(e.rest):e.line;return es(it(et(o),o.text.length),i)}var l=3==t.nodeType?t:null,a=t;l||1!=t.childNodes.length||3!=t.firstChild.nodeType||(l=t.firstChild,n&&(n=l.nodeValue.length));while(a.parentNode!=r)a=a.parentNode;var s=e.measure,u=s.maps;function c(t,n,r){for(var i=-1;i<(u?u.length:0);i++)for(var o=i<0?s.map:u[i],l=0;l<o.length;l+=3){var a=o[l+2];if(a==t||a==n){var c=et(i<0?e.line:e.rest[i]),h=o[l]+r;return(r<0||a!=t)&&(h=o[l+(r?1:0)]),it(c,h)}}}var h=c(l,a,n);if(h)return es(h,i);for(var f=a.nextSibling,d=l?l.nodeValue.length-n:0;f;f=f.nextSibling){if(h=c(f,f.firstChild,0),h)return es(it(h.line,h.ch-d),i);d+=f.textContent.length}for(var p=a.previousSibling,g=n;p;p=p.previousSibling){if(h=c(p,p.firstChild,-1),h)return es(it(h.line,h.ch+g),i);g+=p.textContent.length}}Za.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;function o(e){for(var t=e.target;t;t=t.parentNode){if(t==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(t.className))break}return!1}function l(e){if(o(e)&&!ye(r,e)){if(r.somethingSelected())_a({lineWise:!1,text:r.getSelections()}),"cut"==e.type&&r.replaceSelection("",null,"cut");else{if(!r.options.lineWiseCopyCut)return;var t=ja(r);_a({lineWise:!0,text:t.text}),"cut"==e.type&&r.operation((function(){r.setSelections(t.ranges,0,U),r.replaceSelection("",null,"cut")}))}if(e.clipboardData){e.clipboardData.clearData();var l=Ba.text.join("\n");if(e.clipboardData.setData("Text",l),e.clipboardData.getData("Text")==l)return void e.preventDefault()}var a=$a(),s=a.firstChild;r.display.lineSpace.insertBefore(a,r.display.lineSpace.firstChild),s.value=Ba.text.join("\n");var u=W();H(s),setTimeout((function(){r.display.lineSpace.removeChild(a),u.focus(),u==i&&n.showPrimarySelection()}),50)}}i.contentEditable=!0,Ka(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize),pe(i,"paste",(function(e){!o(e)||ye(r,e)||Ua(e,r)||a<=11&&setTimeout(Di(r,(function(){return t.updateFromDOM()})),20)})),pe(i,"compositionstart",(function(e){t.composing={data:e.data,done:!1}})),pe(i,"compositionupdate",(function(e){t.composing||(t.composing={data:e.data,done:!1})})),pe(i,"compositionend",(function(e){t.composing&&(e.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)})),pe(i,"touchstart",(function(){return n.forceCompositionEnd()})),pe(i,"input",(function(){t.composing||t.readFromDOMSoon()})),pe(i,"copy",l),pe(i,"cut",l)},Za.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Za.prototype.prepareSelection=function(){var e=Ur(this.cm,!1);return e.focus=W()==this.div,e},Za.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Za.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Za.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,r=t.doc.sel.primary(),i=r.from(),o=r.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||o.line<t.display.viewFrom)e.removeAllRanges();else{var l=ns(t,e.anchorNode,e.anchorOffset),a=ns(t,e.focusNode,e.focusOffset);if(!l||l.bad||!a||a.bad||0!=ot(ut(l,a),i)||0!=ot(st(l,a),o)){var s=t.display.view,u=i.line>=t.display.viewFrom&&Ja(t,i)||{node:s[0].measure.map[2],offset:0},c=o.line<t.display.viewTo&&Ja(t,o);if(!c){var h=s[s.length-1].measure,f=h.maps?h.maps[h.maps.length-1]:h.map;c={node:f[f.length-1],offset:f[f.length-2]-f[f.length-3]}}if(u&&c){var d,p=e.rangeCount&&e.getRangeAt(0);try{d=L(u.node,u.offset,c.offset,c.node)}catch(g){}d&&(!n&&t.state.focused?(e.collapse(u.node,u.offset),d.collapsed||(e.removeAllRanges(),e.addRange(d))):(e.removeAllRanges(),e.addRange(d)),p&&null==e.anchorNode?e.addRange(p):n&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},Za.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout((function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation((function(){return e.cm.curOp.selectionChanged=!0}))}),20)},Za.prototype.showMultipleSelections=function(e){N(this.cm.display.cursorDiv,e.cursors),N(this.cm.display.selectionDiv,e.selection)},Za.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Za.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return D(this.div,t)},Za.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()&&W()==this.div||this.showSelection(this.prepareSelection(),!0),this.div.focus())},Za.prototype.blur=function(){this.div.blur()},Za.prototype.getField=function(){return this.div},Za.prototype.supportsTouch=function(){return!0},Za.prototype.receivedFocus=function(){var e=this,t=this;function n(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,n))}this.selectionInEditor()?setTimeout((function(){return e.pollSelection()}),20):Ai(this.cm,(function(){return t.cm.curOp.selectionChanged=!0})),this.polling.set(this.cm.options.pollInterval,n)},Za.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Za.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e=this.getSelection(),t=this.cm;if(v&&c&&this.cm.display.gutterSpecs.length&&Qa(e.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var n=ns(t,e.anchorNode,e.anchorOffset),r=ns(t,e.focusNode,e.focusOffset);n&&r&&Ai(t,(function(){_o(t.doc,lo(n,r),U),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)}))}}},Za.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e,t,n,r=this.cm,i=r.display,o=r.doc.sel.primary(),l=o.from(),a=o.to();if(0==l.ch&&l.line>r.firstLine()&&(l=it(l.line-1,qe(r.doc,l.line-1).length)),a.ch==qe(r.doc,a.line).text.length&&a.line<r.lastLine()&&(a=it(a.line+1,0)),l.line<i.viewFrom||a.line>i.viewTo-1)return!1;l.line==i.viewFrom||0==(e=Hr(r,l.line))?(t=et(i.view[0].line),n=i.view[0].node):(t=et(i.view[e].line),n=i.view[e-1].node.nextSibling);var s,u,c=Hr(r,a.line);if(c==i.view.length-1?(s=i.viewTo-1,u=i.lineDiv.lastChild):(s=et(i.view[c+1].line)-1,u=i.view[c+1].node.previousSibling),!n)return!1;var h=r.doc.splitLines(ts(r,n,u,t,s)),f=Ze(r.doc,it(t,0),it(s,qe(r.doc,s).text.length));while(h.length>1&&f.length>1)if(Y(h)==Y(f))h.pop(),f.pop(),s--;else{if(h[0]!=f[0])break;h.shift(),f.shift(),t++}var d=0,p=0,g=h[0],v=f[0],m=Math.min(g.length,v.length);while(d<m&&g.charCodeAt(d)==v.charCodeAt(d))++d;var y=Y(h),b=Y(f),w=Math.min(y.length-(1==h.length?d:0),b.length-(1==f.length?d:0));while(p<w&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1))++p;if(1==h.length&&1==f.length&&t==l.line)while(d&&d>l.ch&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1))d--,p++;h[h.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),h[0]=h[0].slice(d).replace(/\u200b+$/,"");var x=it(t,d),C=it(s,f.length?Y(f).length-p:0);return h.length>1||h[0]||ot(x,C)?(rl(r.doc,h,x,C,"+input"),!0):void 0},Za.prototype.ensurePolled=function(){this.forceCompositionEnd()},Za.prototype.reset=function(){this.forceCompositionEnd()},Za.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Za.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout((function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()}),80))},Za.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Ai(this.cm,(function(){return Ir(e.cm)}))},Za.prototype.setUneditable=function(e){e.contentEditable="false"},Za.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||Di(this.cm,Ga)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Za.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Za.prototype.onContextMenu=function(){},Za.prototype.resetPosition=function(){},Za.prototype.needsContentAttribute=!0;var is=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new R,this.hasSelection=!1,this.composing=null};function os(e,t){if(t=t?P(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var n=W();t.autofocus=n==e||null!=e.getAttribute("autofocus")&&n==document.body}function r(){e.value=a.getValue()}var i;if(e.form&&(pe(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var o=e.form;i=o.submit;try{var l=o.submit=function(){r(),o.submit=i,o.submit(),o.submit=l}}catch(s){}}t.finishInit=function(n){n.save=r,n.getTextArea=function(){return e},n.toTextArea=function(){n.toTextArea=isNaN,r(),e.parentNode.removeChild(n.getWrapperElement()),e.style.display="",e.form&&(ve(e.form,"submit",r),t.leaveSubmitMethodAlone||"function"!=typeof e.form.submit||(e.form.submit=i))}},e.style.display="none";var a=Ia((function(t){return e.parentNode.insertBefore(t,e.nextSibling)}),t);return a}function ls(e){e.off=ve,e.on=pe,e.wheelEventPixels=to,e.Doc=Cl,e.splitLines=Ee,e.countColumn=z,e.findColumn=K,e.isWordChar=te,e.Pass=G,e.signal=me,e.Line=sn,e.changeEnd=ao,e.scrollbarModel=bi,e.Pos=it,e.cmpPos=ot,e.modes=ze,e.mimeModes=Re,e.resolveMode=Ge,e.getMode=Ue,e.modeExtensions=Ve,e.extendMode=je,e.copyState=Ke,e.startState=Xe,e.innerMode=$e,e.commands=ql,e.keyMap=Pl,e.keyName=Ul,e.isModifierKey=_l,e.lookupKey=Bl,e.normalizeKeyMap=Rl,e.StringStream=Ye,e.SharedTextMarker=vl,e.TextMarker=pl,e.LineWidget=cl,e.e_preventDefault=Ce,e.e_stopPropagation=Se,e.e_stop=Le,e.addClass=E,e.contains=D,e.rmClass=T,e.keyNames=El}is.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;function o(e){if(!ye(r,e)){if(r.somethingSelected())_a({lineWise:!1,text:r.getSelections()});else{if(!r.options.lineWiseCopyCut)return;var t=ja(r);_a({lineWise:!0,text:t.text}),"cut"==e.type?r.setSelections(t.ranges,null,U):(n.prevInput="",i.value=t.text.join("\n"),H(i))}"cut"==e.type&&(r.state.cutIncoming=+new Date)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),g&&(i.style.width="0px"),pe(i,"input",(function(){l&&a>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()})),pe(i,"paste",(function(e){ye(r,e)||Ua(e,r)||(r.state.pasteIncoming=+new Date,n.fastPoll())})),pe(i,"cut",o),pe(i,"copy",o),pe(e.scroller,"paste",(function(t){if(!Un(e,t)&&!ye(r,t)){if(!i.dispatchEvent)return r.state.pasteIncoming=+new Date,void n.focus();var o=new Event("paste");o.clipboardData=t.clipboardData,i.dispatchEvent(o)}})),pe(e.lineSpace,"selectstart",(function(t){Un(e,t)||Ce(t)})),pe(i,"compositionstart",(function(){var e=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:e,range:r.markText(e,r.getCursor("to"),{className:"CodeMirror-composing"})}})),pe(i,"compositionend",(function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)}))},is.prototype.createField=function(e){this.wrapper=$a(),this.textarea=this.wrapper.firstChild},is.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},is.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=Ur(e);if(e.options.moveInputWithCursor){var i=yr(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),l=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+l.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+l.left-o.left))}return r},is.prototype.showSelection=function(e){var t=this.cm,n=t.display;N(n.cursorDiv,e.cursors),N(n.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},is.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&H(this.textarea),l&&a>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",l&&a>=9&&(this.hasSelection=null))}},is.prototype.getField=function(){return this.textarea},is.prototype.supportsTouch=function(){return!1},is.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!m||W()!=this.textarea))try{this.textarea.focus()}catch(e){}},is.prototype.blur=function(){this.textarea.blur()},is.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},is.prototype.receivedFocus=function(){this.slowPoll()},is.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){e.poll(),e.cm.state.focused&&e.slowPoll()}))},is.prototype.fastPoll=function(){var e=!1,t=this;function n(){var r=t.poll();r||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,n))}t.pollingFast=!0,t.polling.set(20,n)},is.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||Fe(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(l&&a>=9&&this.hasSelection===i||y&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(8203!=o||r||(r=""),8666==o)return this.reset(),this.cm.execCommand("undo")}var s=0,u=Math.min(r.length,i.length);while(s<u&&r.charCodeAt(s)==i.charCodeAt(s))++s;return Ai(t,(function(){Ga(t,i.slice(s),r.length-s,null,e.composing?"*compose":null),i.length>1e3||i.indexOf("\n")>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))})),!0},is.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},is.prototype.onKeyPress=function(){l&&a>=9&&(this.hasSelection=null),this.fastPoll()},is.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var o=Fr(n,e),u=r.scroller.scrollTop;if(o&&!h){var c=n.options.resetSelectionOnContextMenu;c&&-1==n.doc.sel.contains(o)&&Di(n,_o)(n.doc,lo(o),U);var f,d=i.style.cssText,p=t.wrapper.style.cssText,g=t.wrapper.offsetParent.getBoundingClientRect();if(t.wrapper.style.cssText="position: static",i.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-g.top-5)+"px; left: "+(e.clientX-g.left-5)+"px;\n z-index: 1000; background: "+(l?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",s&&(f=window.scrollY),r.input.focus(),s&&window.scrollTo(null,f),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=y,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll),l&&a>=9&&m(),S){Le(e);var v=function(){ve(window,"mouseup",v),setTimeout(y,20)};pe(window,"mouseup",v)}else setTimeout(y,50)}function m(){if(null!=i.selectionStart){var e=n.somethingSelected(),o=""+(e?i.value:"");i.value="⇚",i.value=o,t.prevInput=e?"":"",i.selectionStart=1,i.selectionEnd=o.length,r.selForContextMenu=n.doc.sel}}function y(){if(t.contextMenuPending==y&&(t.contextMenuPending=!1,t.wrapper.style.cssText=p,i.style.cssText=d,l&&a<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=u),null!=i.selectionStart)){(!l||l&&a<9)&&m();var e=0,o=function(){r.selForContextMenu==n.doc.sel&&0==i.selectionStart&&i.selectionEnd>0&&""==t.prevInput?Di(n,Yo)(n):e++<10?r.detectingSelectAll=setTimeout(o,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(o,200)}}},is.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e,this.textarea.readOnly=!!e},is.prototype.setUneditable=function(){},is.prototype.needsContentAttribute=!1,Ea(Ia),Xa(Ia);var as="iter insert remove copy getEditor constructor".split(" ");for(var ss in Cl.prototype)Cl.prototype.hasOwnProperty(ss)&&B(as,ss)<0&&(Ia.prototype[ss]=function(e){return function(){return e.apply(this.doc,arguments)}}(Cl.prototype[ss]));return xe(Cl),Ia.inputStyles={textarea:is,contenteditable:Za},Ia.defineMode=function(e){Ia.defaults.mode||"null"==e||(Ia.defaults.mode=e),Be.apply(this,arguments)},Ia.defineMIME=_e,Ia.defineMode("null",(function(){return{token:function(e){return e.skipToEnd()}}})),Ia.defineMIME("text/plain","null"),Ia.defineExtension=function(e,t){Ia.prototype[e]=t},Ia.defineDocExtension=function(e,t){Cl.prototype[e]=t},Ia.fromTextArea=os,ls(Ia),Ia.version="5.63.3",Ia}))},5899:function(e,t){e.exports="\t\n\v\f\r \u2028\u2029\ufeff"},"58a8":function(e,t,n){var r=n("e330"),i=n("1d80"),o=n("577e"),l=n("5899"),a=r("".replace),s="["+l+"]",u=RegExp("^"+s+s+"*"),c=RegExp(s+s+"*$"),h=function(e){return function(t){var n=o(i(t));return 1&e&&(n=a(n,u,"")),2&e&&(n=a(n,c,"")),n}};e.exports={start:h(1),end:h(2),trim:h(3)}},"8f94":function(e,t,n){!function(t,r){e.exports=r(n("56b3"))}(0,(function(e){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/",t(t.s=3)}([function(t,n){t.exports=e},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(e){return e&&e.__esModule?e:{default:e}}(r),o=window.CodeMirror||i.default;"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(e),r=1;r<arguments.length;r++){var i=arguments[r];if(null!=i)for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])}return n},writable:!0,configurable:!0}),t.default={name:"codemirror",data:function(){return{content:"",codemirror:null,cminstance:null}},props:{code:String,value:String,marker:Function,unseenLines:Array,name:{type:String,default:"codemirror"},placeholder:{type:String,default:""},merge:{type:Boolean,default:!1},options:{type:Object,default:function(){return{}}},events:{type:Array,default:function(){return[]}},globalOptions:{type:Object,default:function(){return{}}},globalEvents:{type:Array,default:function(){return[]}}},watch:{options:{deep:!0,handler:function(e){for(var t in e)this.cminstance.setOption(t,e[t])}},merge:function(){this.$nextTick(this.switchMerge)},code:function(e){this.handerCodeChange(e)},value:function(e){this.handerCodeChange(e)}},methods:{initialize:function(){var e=this,t=Object.assign({},this.globalOptions,this.options);this.merge?(this.codemirror=o.MergeView(this.$refs.mergeview,t),this.cminstance=this.codemirror.edit):(this.codemirror=o.fromTextArea(this.$refs.textarea,t),this.cminstance=this.codemirror,this.cminstance.setValue(this.code||this.value||this.content)),this.cminstance.on("change",(function(t){e.content=t.getValue(),e.$emit&&e.$emit("input",e.content)}));var n={};["scroll","changes","beforeChange","cursorActivity","keyHandled","inputRead","electricInput","beforeSelectionChange","viewportChange","swapDoc","gutterClick","gutterContextMenu","focus","blur","refresh","optionChange","scrollCursorIntoView","update"].concat(this.events).concat(this.globalEvents).filter((function(e){return!n[e]&&(n[e]=!0)})).forEach((function(t){e.cminstance.on(t,(function(){for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];e.$emit.apply(e,[t].concat(r));var o=t.replace(/([A-Z])/g,"-$1").toLowerCase();o!==t&&e.$emit.apply(e,[o].concat(r))}))})),this.$emit("ready",this.codemirror),this.unseenLineMarkers(),this.refresh()},refresh:function(){var e=this;this.$nextTick((function(){e.cminstance.refresh()}))},destroy:function(){var e=this.cminstance.doc.cm.getWrapperElement();e&&e.remove&&e.remove()},handerCodeChange:function(e){if(e!==this.cminstance.getValue()){var t=this.cminstance.getScrollInfo();this.cminstance.setValue(e),this.content=e,this.cminstance.scrollTo(t.left,t.top)}this.unseenLineMarkers()},unseenLineMarkers:function(){var e=this;void 0!==this.unseenLines&&void 0!==this.marker&&this.unseenLines.forEach((function(t){var n=e.cminstance.lineInfo(t);e.cminstance.setGutterMarker(t,"breakpoints",n.gutterMarkers?null:e.marker())}))},switchMerge:function(){var e=this.cminstance.doc.history,t=this.cminstance.doc.cleanGeneration;this.options.value=this.cminstance.getValue(),this.destroy(),this.initialize(),this.cminstance.doc.history=e,this.cminstance.doc.cleanGeneration=t}},mounted:function(){this.initialize()},beforeDestroy:function(){this.destroy()}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),i=n.n(r);for(var o in r)["default","default"].indexOf(o)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(o);var l=n(5),a=n(4),s=a(i.a,l.a,!1,null,null,null);t.default=s.exports},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.install=t.codemirror=t.CodeMirror=void 0;var i=n(0),o=r(i),l=n(2),a=r(l),s=window.CodeMirror||o.default,u=function(e,t){t&&(t.options&&(a.default.props.globalOptions.default=function(){return t.options}),t.events&&(a.default.props.globalEvents.default=function(){return t.events})),e.component(a.default.name,a.default)},c={CodeMirror:s,codemirror:a.default,install:u};t.default=c,t.CodeMirror=s,t.codemirror=a.default,t.install=u},function(e,t){e.exports=function(e,t,n,r,i,o){var l,a=e=e||{},s=typeof e.default;"object"!==s&&"function"!==s||(l=e,a=e.default);var u,c="function"==typeof a?a.options:a;if(t&&(c.render=t.render,c.staticRenderFns=t.staticRenderFns,c._compiled=!0),n&&(c.functional=!0),i&&(c._scopeId=i),o?(u=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),r&&r.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(o)},c._ssrRegister=u):r&&(u=r),u){var h=c.functional,f=h?c.render:c.beforeCreate;h?(c._injectStyles=u,c.render=function(e,t){return u.call(t),f(e,t)}):c.beforeCreate=f?[].concat(f,u):[u]}return{esModule:l,exports:a,options:c}}},function(e,t,n){"use strict";var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"vue-codemirror",class:{merge:e.merge}},[e.merge?n("div",{ref:"mergeview"}):n("textarea",{ref:"textarea",attrs:{name:e.name,placeholder:e.placeholder}})])},i=[],o={render:r,staticRenderFns:i};t.a=o}])}))},a434:function(e,t,n){"use strict";var r=n("23e7"),i=n("da84"),o=n("23cb"),l=n("5926"),a=n("07fa"),s=n("7b0b"),u=n("65f0"),c=n("8418"),h=n("1dde"),f=h("splice"),d=i.TypeError,p=Math.max,g=Math.min,v=9007199254740991,m="Maximum allowed length exceeded";r({target:"Array",proto:!0,forced:!f},{splice:function(e,t){var n,r,i,h,f,y,b=s(this),w=a(b),x=o(e,w),C=arguments.length;if(0===C?n=r=0:1===C?(n=0,r=w-x):(n=C-2,r=g(p(l(t),0),w-x)),w+n-r>v)throw d(m);for(i=u(b,r),h=0;h<r;h++)f=x+h,f in b&&c(i,h,b[f]);if(i.length=r,n<r){for(h=x;h<w-r;h++)f=h+r,y=h+n,f in b?b[y]=b[f]:delete b[y];for(h=w;h>w-r+n;h--)delete b[h-1]}else if(n>r)for(h=w-r;h>x;h--)f=h+r-1,y=h+n-1,f in b?b[y]=b[f]:delete b[y];for(h=0;h<n;h++)b[h+x]=arguments[h+2];return b.length=w-r+n,i}})},a7be:function(e,t,n){},a9e3:function(e,t,n){"use strict";var r=n("83ab"),i=n("da84"),o=n("e330"),l=n("94ca"),a=n("6eeb"),s=n("1a2d"),u=n("7156"),c=n("3a9b"),h=n("d9b5"),f=n("c04e"),d=n("d039"),p=n("241c").f,g=n("06cf").f,v=n("9bf2").f,m=n("408a"),y=n("58a8").trim,b="Number",w=i[b],x=w.prototype,C=i.TypeError,S=o("".slice),k=o("".charCodeAt),L=function(e){var t=f(e,"number");return"bigint"==typeof t?t:T(t)},T=function(e){var t,n,r,i,o,l,a,s,u=f(e,"number");if(h(u))throw C("Cannot convert a Symbol value to a number");if("string"==typeof u&&u.length>2)if(u=y(u),t=k(u,0),43===t||45===t){if(n=k(u,2),88===n||120===n)return NaN}else if(48===t){switch(k(u,1)){case 66:case 98:r=2,i=49;break;case 79:case 111:r=8,i=55;break;default:return+u}for(o=S(u,2),l=o.length,a=0;a<l;a++)if(s=k(o,a),s<48||s>i)return NaN;return parseInt(o,r)}return+u};if(l(b,!w(" 0o1")||!w("0b1")||w("+0x1"))){for(var M,N=function(e){var t=arguments.length<1?0:w(L(e)),n=this;return c(x,n)&&d((function(){m(n)}))?u(Object(t),n,N):t},O=r?p(w):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),A=0;O.length>A;A++)s(w,M=O[A])&&!s(N,M)&&v(N,M,g(w,M));N.prototype=x,x.constructor=N,a(i,b,N)}},acdf:function(e,t,n){},db91:function(e,t,n){(function(e){e(n("56b3"))})((function(e){"use strict";function t(e){return new RegExp("^(("+e.join(")|(")+"))\\b")}var n=t(["and","or","not","is"]),r=["as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","lambda","pass","raise","return","try","while","with","yield","in"],i=["abs","all","any","bin","bool","bytearray","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip","__import__","NotImplemented","Ellipsis","__debug__"];function o(e){return e.scopes[e.scopes.length-1]}e.registerHelper("hintWords","python",r.concat(i)),e.defineMode("python",(function(l,a){for(var s="error",u=a.delimiters||a.singleDelimiters||/^[\(\)\[\]\{\}@,:`=;\.\\]/,c=[a.singleOperators,a.doubleOperators,a.doubleDelimiters,a.tripleDelimiters,a.operators||/^([-+*/%\/&|^]=?|[<>=]+|\/\/=?|\*\*=?|!=|[~!@]|\.\.\.)/],h=0;h<c.length;h++)c[h]||c.splice(h--,1);var f=a.hangingIndent||l.indentUnit,d=r,p=i;void 0!=a.extra_keywords&&(d=d.concat(a.extra_keywords)),void 0!=a.extra_builtins&&(p=p.concat(a.extra_builtins));var g=!(a.version&&Number(a.version)<3);if(g){var v=a.identifiers||/^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/;d=d.concat(["nonlocal","False","True","None","async","await"]),p=p.concat(["ascii","bytes","exec","print"]);var m=new RegExp("^(([rbuf]|(br)|(rb)|(fr)|(rf))?('{3}|\"{3}|['\"]))","i")}else{v=a.identifiers||/^[_A-Za-z][_A-Za-z0-9]*/;d=d.concat(["exec","print"]),p=p.concat(["apply","basestring","buffer","cmp","coerce","execfile","file","intern","long","raw_input","reduce","reload","unichr","unicode","xrange","False","True","None"]);m=new RegExp("^(([rubf]|(ur)|(br))?('{3}|\"{3}|['\"]))","i")}var y=t(d),b=t(p);function w(e,t){var n=e.sol()&&"\\"!=t.lastToken;if(n&&(t.indent=e.indentation()),n&&"py"==o(t).type){var r=o(t).offset;if(e.eatSpace()){var i=e.indentation();return i>r?k(t):i<r&&T(e,t)&&"#"!=e.peek()&&(t.errorToken=!0),null}var l=x(e,t);return r>0&&T(e,t)&&(l+=" "+s),l}return x(e,t)}function x(e,t,r){if(e.eatSpace())return null;if(!r&&e.match(/^#.*/))return"comment";if(e.match(/^[0-9\.]/,!1)){var i=!1;if(e.match(/^[\d_]*\.\d+(e[\+\-]?\d+)?/i)&&(i=!0),e.match(/^[\d_]+\.\d*/)&&(i=!0),e.match(/^\.\d+/)&&(i=!0),i)return e.eat(/J/i),"number";var o=!1;if(e.match(/^0x[0-9a-f_]+/i)&&(o=!0),e.match(/^0b[01_]+/i)&&(o=!0),e.match(/^0o[0-7_]+/i)&&(o=!0),e.match(/^[1-9][\d_]*(e[\+\-]?[\d_]+)?/)&&(e.eat(/J/i),o=!0),e.match(/^0(?![\dx])/i)&&(o=!0),o)return e.eat(/L/i),"number"}if(e.match(m)){var l=-1!==e.current().toLowerCase().indexOf("f");return l?(t.tokenize=C(e.current(),t.tokenize),t.tokenize(e,t)):(t.tokenize=S(e.current(),t.tokenize),t.tokenize(e,t))}for(var a=0;a<c.length;a++)if(e.match(c[a]))return"operator";return e.match(u)?"punctuation":"."==t.lastToken&&e.match(v)?"property":e.match(y)||e.match(n)?"keyword":e.match(b)?"builtin":e.match(/^(self|cls)\b/)?"variable-2":e.match(v)?"def"==t.lastToken||"class"==t.lastToken?"def":"variable":(e.next(),r?null:s)}function C(e,t){while("rubf".indexOf(e.charAt(0).toLowerCase())>=0)e=e.substr(1);var n=1==e.length,r="string";function i(e){return function(t,n){var r=x(t,n,!0);return"punctuation"==r&&("{"==t.current()?n.tokenize=i(e+1):"}"==t.current()&&(n.tokenize=e>1?i(e-1):o)),r}}function o(o,l){while(!o.eol())if(o.eatWhile(/[^'"\{\}\\]/),o.eat("\\")){if(o.next(),n&&o.eol())return r}else{if(o.match(e))return l.tokenize=t,r;if(o.match("{{"))return r;if(o.match("{",!1))return l.tokenize=i(0),o.current()?r:l.tokenize(o,l);if(o.match("}}"))return r;if(o.match("}"))return s;o.eat(/['"]/)}if(n){if(a.singleLineStringErrors)return s;l.tokenize=t}return r}return o.isString=!0,o}function S(e,t){while("rubf".indexOf(e.charAt(0).toLowerCase())>=0)e=e.substr(1);var n=1==e.length,r="string";function i(i,o){while(!i.eol())if(i.eatWhile(/[^'"\\]/),i.eat("\\")){if(i.next(),n&&i.eol())return r}else{if(i.match(e))return o.tokenize=t,r;i.eat(/['"]/)}if(n){if(a.singleLineStringErrors)return s;o.tokenize=t}return r}return i.isString=!0,i}function k(e){while("py"!=o(e).type)e.scopes.pop();e.scopes.push({offset:o(e).offset+l.indentUnit,type:"py",align:null})}function L(e,t,n){var r=e.match(/^[\s\[\{\(]*(?:#|$)/,!1)?null:e.column()+1;t.scopes.push({offset:t.indent+f,type:n,align:r})}function T(e,t){var n=e.indentation();while(t.scopes.length>1&&o(t).offset>n){if("py"!=o(t).type)return!0;t.scopes.pop()}return o(t).offset!=n}function M(e,t){e.sol()&&(t.beginningOfLine=!0,t.dedent=!1);var n=t.tokenize(e,t),r=e.current();if(t.beginningOfLine&&"@"==r)return e.match(v,!1)?"meta":g?"operator":s;if(/\S/.test(r)&&(t.beginningOfLine=!1),"variable"!=n&&"builtin"!=n||"meta"!=t.lastToken||(n="meta"),"pass"!=r&&"return"!=r||(t.dedent=!0),"lambda"==r&&(t.lambda=!0),":"==r&&!t.lambda&&"py"==o(t).type&&e.match(/^\s*(?:#|$)/,!1)&&k(t),1==r.length&&!/string|comment/.test(n)){var i="[({".indexOf(r);if(-1!=i&&L(e,t,"])}".slice(i,i+1)),i="])}".indexOf(r),-1!=i){if(o(t).type!=r)return s;t.indent=t.scopes.pop().offset-f}}return t.dedent&&e.eol()&&"py"==o(t).type&&t.scopes.length>1&&t.scopes.pop(),n}var N={startState:function(e){return{tokenize:w,scopes:[{offset:e||0,type:"py",align:null}],indent:e||0,lastToken:null,lambda:!1,dedent:0}},token:function(e,t){var n=t.errorToken;n&&(t.errorToken=!1);var r=M(e,t);return r&&"comment"!=r&&(t.lastToken="keyword"==r||"punctuation"==r?e.current():r),"punctuation"==r&&(r=null),e.eol()&&t.lambda&&(t.lambda=!1),n?r+" "+s:r},indent:function(t,n){if(t.tokenize!=w)return t.tokenize.isString?e.Pass:0;var r=o(t),i=r.type==n.charAt(0)||"py"==r.type&&!t.dedent&&/^(else:|elif |except |finally:)/.test(n);return null!=r.align?r.align-(i?1:0):r.offset-(i?f:0)},electricInput:/^\s*([\}\]\)]|else:|elif |except |finally:)$/,closeBrackets:{triples:"'\""},lineComment:"#",fold:"indent"};return N})),e.defineMIME("text/x-python","python");var l=function(e){return e.split(" ")};e.defineMIME("text/x-cython",{name:"python",extra_keywords:l("by cdef cimport cpdef ctypedef enum except extern gil include nogil property public readonly struct union DEF IF ELIF ELSE")})}))}}]);
|