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