Files
----/后端源码/yifan.action-ai.cn/index/js/codemirror.CR5zRbyM.js

129 lines
278 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{bA as e,bB as t,o as r,r as n,A as i,aa as o,t as a,H as l,v as s,P as c,u,W as d,L as f,M as h,O as p,b as m,D as g,c as v,B as y,a3 as b}from"./.pnpm.DGfAnZKL.js";var x,w,_={},k={exports:{}};function C(){return x||(x=1,k.exports=function(){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),a=n||i||o,l=a&&(n?document.documentMode||6:+(o||i)[1]),s=!o&&/WebKit\//.test(e),c=s&&/Qt\/\d+\.\d+/.test(e),u=!o&&/Chrome\/(\d+)/.exec(e),d=u&&+u[1],f=/Opera\//.test(e),h=/Apple Computer/.test(navigator.vendor),p=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),m=/PhantomJS/.test(e),g=h&&(/Mobile\/\w+/.test(e)||navigator.maxTouchPoints>2),v=/Android/.test(e),y=g||v||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),b=g||/Mac/.test(t),x=/\bCrOS\b/.test(e),w=/win/i.test(t),_=f&&e.match(/Version\/(\d*\.\d*)/);_&&(_=Number(_[1])),_&&_>=15&&(f=!1,s=!0);var k=b&&(c||f&&(null==_||_<12.11)),C=r||a&&l>=9;function S(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var L,M=function(e,t){var r=e.className,n=S(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 T(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function N(e,t){return T(e).appendChild(t)}function O(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 A(e,t,r,n){var i=O(e,t,r,n);return i.setAttribute("role","presentation"),i}function D(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do{if(11==t.nodeType&&(t=t.host),t==e)return!0}while(t=t.parentNode)}function z(e){var t,r=e.ownerDocument||e;try{t=e.activeElement}catch(He){t=r.body||null}for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t}function F(e,t){var r=e.className;S(t).test(r)||(e.className+=(r?" ":"")+t)}function E(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!S(r[n]).test(t)&&(t+=" "+r[n]);return t}L=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(He){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};var W=function(e){e.select()};function I(e){return e.display.wrapper.ownerDocument}function H(e){return P(e.display.wrapper)}function P(e){return e.getRootNode?e.getRootNode():e.ownerDocument}function R(e){return I(e).defaultView}function q(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function j(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 B(e,t,r,n,i){null==t&&-1==(t=e.search(/[^\s\u00a0]/))&&(t=e.length);for(var o=n||0,a=i||0;;){var l=e.indexOf("\t",o);if(l<0||l>=t)return a+(t-o);a+=l-o,a+=r-a%r,o=l+1}}g?W=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:a&&(W=function(e){try{e.select()}catch(t){}});var V=function(){this.id=null,this.f=null,this.time=0,this.handler=q(this.onTimeout,this)};function U(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}V.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},V.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 G=50,$={toString:function(){return"CodeMirror.Pass"}},K={scroll:!1},X={origin:"*mouse"},Q={origin:"+move"};function Y(e,t,r){for(var n=0,i=0;;){var o=e.indexOf("\t",n);-1==o&&(o=e.length);var a=o-n;if(o==e.length||i+a>=t)return n+Math.min(a,t-i);if(i+=o-n,n=o+1,(i+=r-i%r)>=t)return n}}var Z=[""];function J(e){for(;Z.length<=e;)Z.push(ee(Z)+" ");return Z[e]}function ee(e){return e[e.length-1]}function te(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function re(e,t,r){for(var n=0,i=r(t);n<e.length&&r(e[n])<=i;)n++;e.splice(n,0,t)}function ne(){}function ie(e,t){var r;return Object.create?r=Object.create(e):(ne.prototype=e,r=new ne),t&&j(t,r),r}var oe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ae(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||oe.test(e))}function le(e,t){return t?!!(t.source.indexOf("\\w")>-1&&ae(e))||t.test(e):ae(e)}function se(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ce=/[\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 ue(e){return e.charCodeAt(0)>=768&&ce.test(e)}function de(e,t,r){for(;(r<0?t>0:t<e.length)&&ue(e.charAt(t));)t+=r;return t}function fe(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 a=e[o];(a.from<r&&a.to>t||t==r&&a.to==t)&&(n(Math.max(a.from,t),Math.min(a.to,r),1==a.level?"rtl":"ltr",o),i=!0)}i||n(t,r,"ltr")}var pe=null;function me(e,t,r){var n;pe=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:pe=i),o.from==t&&(o.from!=o.to&&"before"!=r?n=i:pe=i)}return null!=n?n:pe}var ge=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]/,a=/[Lb1n]/,l=/[1n]/;function s(e,t,r){this.level=e,this.from=t,this.to=r}return function(e,t){var c="ltr"==t?"L":"R";if(0==e.length||"ltr"==t&&!n.test(e))return!1;for(var u=e.length,d=[],f=0;f<u;++f)d.push(r(e.charCodeAt(f)));for(var h=0,p=c;h<u;++h){var m=d[h];"m"==m?d[h]=p:p=m}for(var g=0,v=c;g<u;++g){var y=d[g];"1"==y&&"r"==v?d[g]="n":o.test(y)&&(v=y,"r"==y&&(d[g]="R"))}for(var b=1,x=d[0];b<u-1;++b){var w=d[b];"+"==w&&"1"==x&&"1"==d[b+1]?d[b]="1":","!=w||x!=d[b+1]||"1"!=x&&"n"!=x||(d[b]=x),x=w}for(var _=0;_<u;++_){var k=d[_];if(","==k)d[_]="N";else if("%"==k){var C=void 0;for(C=_+1;C<u&&"%"==d[C];++C);for(var S=_&&"!"==d[_-1]||C<u&&"1"==d[C]?"1":"N",L=_;L<C;++L)d[L]=S;_=C-1}}for(var M=0,T=c;M<u;++M){var N=d[M];"L"==T&&"1"==N?d[M]="L":o.test(N)&&(T=N)}for(var O=0;O<u;++O)if(i.test(d[O])){var A=void 0;for(A=O+1;A<u&&i.test(d[A]);++A);for(var D="L"==(O?d[O-1]:c),z=D==("L"==(A<u?d[A]:c))?D?"L":"R":c,F=O;F<A;++F)d[F]=z;O=A-1}for(var E,W=[],I=0;I<u;)if(a.test(d[I])){var H=I;for(++I;I<u&&a.test(d[I]);++I);W.push(new s(0,H,I))}else{var P=I,R=W.length,q="rtl"==t?1:0;for(++I;I<u&&"L"!=d[I];++I);for(var j=P;j<I;)if(l.test(d[j])){P<j&&(W.splice(R,0,new s(1,P,j)),R+=q);var B=j;for(++j;j<I&&l.test(d[j]);++j);W.splice(R,0,new s(2,B,j)),R+=q,P=j}else++j;P<I&&W.splice(R,0,new s(1,P,I))}return"ltr"==t&&(1==W[0].level&&(E=e.match(/^\s+/))&&(W[0].from=E[0].length,W.unshift(new s(0,0,E[0].length))),1==ee(W).level&&(E=e.match(/\s+$/))&&(ee(W).to-=E[0].length,W.push(new s(0,u-E[0].length,u)))),"rtl"==t?W.reverse():W}}();function ve(e,t){var r=e.order;return null==r&&(r=e.order=ge(e.text,t)),r}var ye=[],be=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]||ye).concat(r)}};function xe(e,t){return e._handlers&&e._handlers[t]||ye}function we(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=U(i,r);o>-1&&(n[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function _e(e,t){var r=xe(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 ke(e,t,r){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),_e(e,r||t.type,e,t),Ne(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==U(r,t[n])&&r.push(t[n])}function Se(e,t){return xe(e,t).length>0}function Le(e){e.prototype.on=function(e,t){be(this,e,t)},e.prototype.off=function(e,t){we(this,e,t)}}function Me(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Te(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Ne(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Oe(e){Me(e),Te(e)}function Ae(e){return e.target||e.srcElement}function De(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 ze,Fe,Ee=function(){if(a&&l<9)return!1;var e=O("div");return"draggable"in e||"dragDrop"in e}();function We(e){if(null==ze){var t=O("span","");N(e,O("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(ze=t.offsetWidth<=1&&t.offsetHeight>2&&!(a&&l<8))}var r=ze?O("span",""):O("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function Ie(e){if(null!=Fe)return Fe;var t=N(e,document.createTextNode("AخA")),r=L(t,0,1).getBoundingClientRect(),n=L(t,1,2).getBoundingClientRect();return T(e),!(!r||r.left==r.right)&&(Fe=n.right-r.right<3)}var He,Pe=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;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),a=o.indexOf("\r");-1!=a?(r.push(o.slice(0,a)),t+=a+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},Re=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(He){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(He){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},qe="oncopy"in(He=O("div"))||(He.setAttribute("oncopy","return;"),"function"==typeof He.oncopy),je=null;function Be(e){if(null!=je)return je;var t=N(e,O("span","x")),r=t.getBoundingClientRect(),n=L(t,0,1).getBoundingClientRect();return je=Math.abs(r.left-n.left)>1}var Ve={},Ue={};function Ge(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ve[e]=t}function $e(e,t){Ue[e]=t}function Ke(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=ie(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ke("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ke("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Xe(e,t){t=Ke(t);var r=Ve[t.name];if(!r)return Xe(e,"text/plain");var n=r(e,t);if(Qe.hasOwnProperty(t.name)){var i=Qe[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 a in t.modeProps)n[a]=t.modeProps[a];return n}var Qe={};function Ye(e,t){j(t,Qe.hasOwnProperty(e)?Qe[e]:Qe[e]={})}function Ze(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 Je(e,t){for(var r;e.innerMode&&(r=e.innerMode(t))&&r.mode!=e;)t=r.state,e=r.mode;return r||{mode:e,state:t}}function et(e,t,r){return!e.startState||e.startState(t,r)}var tt=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 rt(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!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 nt(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 it(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function ot(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function at(e){if(null==e.parent)return null;for(var t=e.parent,r=U(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize();return r+t.first}function lt(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 a=0;a<e.lines.length;++a){var l=e.lines[a].height;if(t<l)break;t-=l}return r+a}function st(e,t){return t>=e.first&&t<e.first+e.size}function ct(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function ut(e,t,r){if(void 0===r&&(r=null),!(this instanceof ut))return new ut(e,t,r);this.line=e,this.ch=t,this.sticky=r}function dt(e,t){return e.line-t.line||e.ch-t.ch}function ft(e,t){return e.sticky==t.sticky&&0==dt(e,t)}function ht(e){return ut(e.line,e.ch)}function pt(e,t){return dt(e,t)<0?t:e}function mt(e,t){return dt(e,t)<0?e:t}function gt(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function vt(e,t){if(t.line<e.first)return ut(e.first,0);var r=e.first+e.size-1;return t.line>r?ut(r,rt(e,r).text.length):yt(t,rt(e,t.line).text.length)}function yt(e,t){var r=e.ch;return null==r||r>t?ut(e.line,t):r<0?ut(e.line,0):e}function bt(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=vt(e,t[n]);return r}tt.prototype.eol=function(){return this.pos>=this.string.length},tt.prototype.sol=function(){return this.pos==this.lineStart},tt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},tt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},tt.prototype.eat=function(e){var t=this.string.charAt(this.pos);if("string"==typeof e?t==e:t&&(e.test?e.test(t):e(t)))return++this.pos,t},tt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},tt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},tt.prototype.skipToEnd=function(){this.pos=this.string.length},tt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},tt.prototype.backUp=function(e){this.pos-=e},tt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=B(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?B(this.string,this.lineStart,this.tabSize):0)},tt.prototype.indentation=function(){return B(this.string,null,this.tabSize)-(this.lineStart?B(this.string,this.lineStart,this.tabSize):0)},tt.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};if(i(this.string.substr(this.pos,e.length))==i(e))return!1!==t&&(this.pos+=e.length),!0},tt.prototype.current=function(){return this.string.slice(this.start,this.pos)},tt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},tt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},tt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var xt=function(e,t){this.state=e,this.lookAhead=t},wt=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 _t(e,t,r,n){var i=[e.state.modeGen],o={};At(e,t.text,e.doc.mode,r,function(e,t){return i.push(e,t)},o,n);for(var a=r.state,l=function(n){r.baseTokens=i;var l=e.state.overlays[n],s=1,c=0;r.state=!0,At(e,t.text,l.mode,r,function(e,t){for(var r=s;c<e;){var n=i[s];n>e&&i.splice(s,1,e,i[s+1],n),s+=2,c=Math.min(e,n)}if(t)if(l.opaque)i.splice(r,s-r,e,"overlay "+t),s=r+2;else for(;r<s;r+=2){var o=i[r+1];i[r+1]=(o?o+" ":"")+"overlay "+t}},o),r.state=a,r.baseTokens=null,r.baseTokenPos=1},s=0;s<e.state.overlays.length;++s)l(s);return{styles:i,classes:o.bgClass||o.textClass?o:null}}function kt(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=Ct(e,at(t)),i=t.text.length>e.options.maxHighlightLength&&Ze(e.doc.mode,n.state),o=_t(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 Ct(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return new wt(n,!0,t);var o=Dt(e,t,r),a=o>n.first&&rt(n,o-1).stateAfter,l=a?wt.fromSaved(n,a,o):new wt(n,et(n.mode),o);return n.iter(o,t,function(r){St(e,r.text,l);var n=l.line;r.stateAfter=n==t-1||n%5==0||n>=i.viewFrom&&n<i.viewTo?l.save():null,l.nextLine()}),r&&(n.modeFrontier=l.line),l}function St(e,t,r,n){var i=e.doc.mode,o=new tt(t,e.options.tabSize,r);for(o.start=o.pos=n||0,""==t&&Lt(i,r.state);!o.eol();)Mt(i,o,r.state),o.start=o.pos}function Lt(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var r=Je(e,t);return r.mode.blankLine?r.mode.blankLine(r.state):void 0}}function Mt(e,t,r,n){for(var i=0;i<10;i++){n&&(n[0]=Je(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.")}wt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},wt.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;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}},wt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},wt.fromSaved=function(e,t,r){return t instanceof xt?new wt(e,Ze(e.mode,t.state),r,t.lookAhead):new wt(e,Ze(e.mode,t),r)},wt.prototype.save=function(e){var t=!1!==e?Ze(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new xt(t,this.maxLookAhead):t};var Tt=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function Nt(e,t,r,n){var i,o,a=e.doc,l=a.mode,s=rt(a,(t=vt(a,t)).line),c=Ct(e,t.line,r),u=new tt(s.text,e.options.tabSize,c);for(n&&(o=[]);(n||u.pos<t.ch)&&!u.eol();)u.start=u.pos,i=Mt(l,u,c.state),n&&o.push(new Tt(u,i,Ze(a.mode,c.state)));return n?o:new Tt(u,i,c.state)}function Ot(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 At(e,t,r,n,i,o,a){var l=r.flattenSpans;null==l&&(l=e.options.flattenSpans);var s,c=0,u=null,d=new tt(t,e.options.tabSize,n),f=e.options.addModeClass&&[null];for(""==t&&Ot(Lt(r,n.state),o);!d.eol();){if(d.pos>e.options.maxHighlightLength?(l=!1,a&&St(e,t,n,d.pos),d.pos=t.length,s=null):s=Ot(Mt(r,d,n.state,f),o),f){var h=f[0].name;h&&(s="m-"+(s?h+" "+s:h))}if(!l||u!=s){for(;c<d.start;)i(c=Math.min(d.start,c+5e3),u);u=s}d.start=d.pos}for(;c<d.pos;){var p=Math.min(d.pos,c+5e3);i(p,u),c=p}}function Dt(e,t,r){for(var n,i,o=e.doc,a=r?-1:t-(e.doc.mode.innerMode?1e3:100),l=t;l>a;--l){if(l<=o.first)return o.first;var s=rt(o,l-1),c=s.stateAfter;if(c&&(!r||l+(c instanceof xt?c.lookAhead:0)<=o.modeFrontier))return l;var u=B(s.text,null,e.options.tabSize);(null==i||n>u)&&(i=l-1,n=u)}return i}function zt(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=rt(e,n).stateAfter;if(i&&(!(i instanceof xt)||n+i.lookAhead<t)){r=n+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}}var Ft=!1,Et=!1;function Wt(){Ft=!0}function It(){Et=!0}function Ht(e,t,r){this.marker=e,this.from=t,this.to=r}function Pt(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function Rt(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function qt(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 jt(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker;if(null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t)||o.from==t&&"bookmark"==a.type&&(!r||!o.marker.insertLeft)){var l=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);(n||(n=[])).push(new Ht(a,o.from,l?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],a=o.marker;if(null==o.to||(a.inclusiveRight?o.to>=t:o.to>t)||o.from==t&&"bookmark"==a.type&&(!r||o.marker.insertLeft)){var l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);(n||(n=[])).push(new Ht(a,l?null:o.from-t,null==o.to?null:o.to-t))}}return n}function Vt(e,t){if(t.full)return null;var r=st(e,t.from.line)&&rt(e,t.from.line).markedSpans,n=st(e,t.to.line)&&rt(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,o=t.to.ch,a=0==dt(t.from,t.to),l=jt(r,i,a),s=Bt(n,o,a),c=1==t.text.length,u=ee(t.text).length+(c?i:0);if(l)for(var d=0;d<l.length;++d){var f=l[d];if(null==f.to){var h=Pt(s,f.marker);h?c&&(f.to=null==h.to?null:h.to+u):f.to=i}}if(s)for(var p=0;p<s.length;++p){var m=s[p];null!=m.to&&(m.to+=u),null==m.from?Pt(l,m.marker)||(m.from=u,c&&(l||(l=[])).push(m)):(m.from+=u,c&&(l||(l=[])).push(m))}l&&(l=Ut(l)),s&&s!=l&&(s=Ut(s));var g=[l];if(!c){var v,y=t.text.length-2;if(y>0&&l)for(var b=0;b<l.length;++b)null==l[b].to&&(v||(v=[])).push(new Ht(l[b].marker,null,null));for(var x=0;x<y;++x)g.push(v);g.push(s)}return g}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 Gt(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!=U(n,r)||(n||(n=[])).push(r)}}),!n)return null;for(var i=[{from:t,to:r}],o=0;o<n.length;++o)for(var a=n[o],l=a.find(0),s=0;s<i.length;++s){var c=i[s];if(!(dt(c.to,l.from)<0||dt(c.from,l.to)>0)){var u=[s,1],d=dt(c.from,l.from),f=dt(c.to,l.to);(d<0||!a.inclusiveLeft&&!d)&&u.push({from:c.from,to:l.from}),(f>0||!a.inclusiveRight&&!f)&&u.push({from:l.to,to:c.to}),i.splice.apply(i,u),s+=u.length-3}}return i}function $t(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function Kt(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 Qt(e){return e.inclusiveRight?1:0}function Yt(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var n=e.find(),i=t.find(),o=dt(n.from,i.from)||Xt(e)-Xt(t);if(o)return-o;var a=dt(n.to,i.to)||Qt(e)-Qt(t);return a||t.id-e.id}function Zt(e,t){var r,n=Et&&e.markedSpans;if(n)for(var i=void 0,o=0;o<n.length;++o)(i=n[o]).marker.collapsed&&null==(t?i.from:i.to)&&(!r||Yt(r,i.marker)<0)&&(r=i.marker);return r}function Jt(e){return Zt(e,!0)}function er(e){return Zt(e,!1)}function tr(e,t){var r,n=Et&&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||Yt(r,o.marker)<0)&&(r=o.marker)}return r}function rr(e,t,r,n,i){var o=rt(e,t),a=Et&&o.markedSpans;if(a)for(var l=0;l<a.length;++l){var s=a[l];if(s.marker.collapsed){var c=s.marker.find(0),u=dt(c.from,r)||Xt(s.marker)-Xt(i),d=dt(c.to,n)||Qt(s.marker)-Qt(i);if(!(u>=0&&d<=0||u<=0&&d>=0)&&(u<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?dt(c.to,r)>=0:dt(c.to,r)>0)||u>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?dt(c.from,n)<=0:dt(c.from,n)<0)))return!0}}}function nr(e){for(var t;t=Jt(e);)e=t.find(-1,!0).line;return e}function ir(e){for(var t;t=er(e);)e=t.find(1,!0).line;return e}function or(e){for(var t,r;t=er(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function ar(e,t){var r=rt(e,t),n=nr(r);return r==n?t:at(n)}function lr(e,t){if(t>e.lastLine())return t;var r,n=rt(e,t);if(!sr(e,n))return t;for(;r=er(n);)n=r.find(1,!0).line;return at(n)+1}function sr(e,t){var r=Et&&t.markedSpans;if(r)for(var n=void 0,i=0;i<r.length;++i)if((n=r[i]).marker.collapsed){if(null==n.from)return!0;if(!n.marker.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&cr(e,t,n))return!0}}function cr(e,t,r){if(null==r.to){var n=r.marker.find(1,!0);return cr(e,n.line,Pt(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]).marker.collapsed&&!i.marker.widgetNode&&i.from==r.to&&(null==i.to||i.to!=r.from)&&(i.marker.inclusiveLeft||r.marker.inclusiveRight)&&cr(e,t,i))return!0}function ur(e){for(var t=0,r=(e=nr(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;o=(r=o).parent)for(var a=0;a<o.children.length;++a){var l=o.children[a];if(l==r)break;t+=l.height}return t}function dr(e){if(0==e.height)return 0;for(var t,r=e.text.length,n=e;t=Jt(n);){var i=t.find(0,!0);n=i.from.line,r+=i.from.ch-i.to.ch}for(n=e;t=er(n);){var o=t.find(0,!0);r-=n.text.length-o.from.ch,r+=(n=o.to.line).text.length-o.to.ch}return r}function fr(e){var t=e.display,r=e.doc;t.maxLine=rt(r,r.first),t.maxLineLength=dr(t.maxLine),t.maxLineChanged=!0,r.iter(function(e){var r=dr(e);r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)})}var hr=function(e,t,r){this.text=e,Kt(this,t),this.height=r?r(this):1};function pr(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),$t(e),Kt(e,r);var i=n?n(e):1;i!=e.height&&ot(e,i)}function mr(e){e.parent=null,$t(e)}hr.prototype.lineNo=function(){return at(this)},Le(hr);var gr={},vr={};function yr(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?vr:gr;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function br(e,t){var r=A("span",null,null,s?"padding-right: .1px":null),n={pre:A("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,a=void 0;n.pos=0,n.addToken=wr,Ie(e.display.measure)&&(a=ve(o,e.doc.direction))&&(n.addToken=kr(n.addToken,a)),n.map=[],Sr(o,n,kt(e,o,t!=e.display.externalMeasured&&at(o))),o.styleClasses&&(o.styleClasses.bgClass&&(n.bgClass=E(o.styleClasses.bgClass,n.bgClass||"")),o.styleClasses.textClass&&(n.textClass=E(o.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(We(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(s){var l=n.content.lastChild;(/\bcm-tab\b/.test(l.className)||l.querySelector&&l.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return _e(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=E(n.pre.className,n.textClass||"")),n}function xr(e){var t=O("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function wr(e,t,r,n,i,o,s){if(t){var c,u=e.splitSpaces?_r(t,e.trailingSpace):t,d=e.cm.state.specialChars,f=!1;if(d.test(t)){c=document.createDocumentFragment();for(var h=0;;){d.lastIndex=h;var p=d.exec(t),m=p?p.index-h:t.length-h;if(m){var g=document.createTextNode(u.slice(h,h+m));a&&l<9?c.appendChild(O("span",[g])):c.appendChild(g),e.map.push(e.pos,e.pos+m,g),e.col+=m,e.pos+=m}if(!p)break;h+=m+1;var v=void 0;if("\t"==p[0]){var y=e.cm.options.tabSize,b=y-e.col%y;(v=c.appendChild(O("span",J(b),"cm-tab"))).setAttribute("role","presentation"),v.setAttribute("cm-text","\t"),e.col+=b}else"\r"==p[0]||"\n"==p[0]?((v=c.appendChild(O("span","\r"==p[0]?"␍":"␤","cm-invalidchar"))).setAttribute("cm-text",p[0]),e.col+=1):((v=e.cm.options.specialCharPlaceholder(p[0])).setAttribute("cm-text",p[0]),a&&l<9?c.appendChild(O("span",[v])):c.appendChild(v),e.col+=1);e.map.push(e.pos,e.pos+1,v),e.pos++}}else e.col+=t.length,c=document.createTextNode(u),e.map.push(e.pos,e.pos+t.length,c),a&&l<9&&(f=!0),e.pos+=t.length;if(e.trailingSpace=32==u.charCodeAt(t.length-1),r||n||i||f||o||s){var x=r||"";n&&(x+=n),i&&(x+=i);var w=O("span",[c],x,o);if(s)for(var _ in s)s.hasOwnProperty(_)&&"style"!=_&&"class"!=_&&w.setAttribute(_,s[_]);return e.content.appendChild(w)}e.content.appendChild(c)}}function _r(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 kr(e,t){return function(r,n,i,o,a,l,s){i=i?i+" cm-force-border":"cm-force-border";for(var c=r.pos,u=c+n.length;;){for(var d=void 0,f=0;f<t.length&&!((d=t[f]).to>c&&d.from<=c);f++);if(d.to>=u)return e(r,n,i,o,a,l,s);e(r,n.slice(0,d.to-c),i,o,null,l,s),o=null,n=n.slice(d.to-c),c=d.to}}}function Cr(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 Sr(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var a,l,s,c,u,d,f,h=i.length,p=0,m=1,g="",v=0;;){if(v==p){s=c=u=l="",f=null,d=null,v=Infinity;for(var y=[],b=void 0,x=0;x<n.length;++x){var w=n[x],_=w.marker;if("bookmark"==_.type&&w.from==p&&_.widgetNode)y.push(_);else if(w.from<=p&&(null==w.to||w.to>p||_.collapsed&&w.to==p&&w.from==p)){if(null!=w.to&&w.to!=p&&v>w.to&&(v=w.to,c=""),_.className&&(s+=" "+_.className),_.css&&(l=(l?l+";":"")+_.css),_.startStyle&&w.from==p&&(u+=" "+_.startStyle),_.endStyle&&w.to==v&&(b||(b=[])).push(_.endStyle,w.to),_.title&&((f||(f={})).title=_.title),_.attributes)for(var k in _.attributes)(f||(f={}))[k]=_.attributes[k];_.collapsed&&(!d||Yt(d.marker,_)<0)&&(d=w)}else w.from>p&&v>w.from&&(v=w.from)}if(b)for(var C=0;C<b.length;C+=2)b[C+1]==v&&(c+=" "+b[C]);if(!d||d.from==p)for(var S=0;S<y.length;++S)Cr(t,0,y[S]);if(d&&(d.from||0)==p){if(Cr(t,(null==d.to?h+1:d.to)-p,d.marker,null==d.from),null==d.to)return;d.to==p&&(d=!1)}}if(p>=h)break;for(var L=Math.min(h,v);;){if(g){var M=p+g.length;if(!d){var T=M>L?g.slice(0,L-p):g;t.addToken(t,T,a?a+s:s,u,p+T.length==v?c:"",l,f)}if(M>=L){g=g.slice(L-p),p=L;break}p=M,u=""}g=i.slice(o,o=r[m++]),a=yr(r[m++],t.cm.options)}}else for(var N=1;N<r.length;N+=2)t.addToken(t,i.slice(o,o=r[N]),yr(r[N+1],t.cm.options))}function Lr(e,t,r){this.line=t,this.rest=or(t),this.size=this.rest?at(ee(this.rest))-r+1:1,this.node=this.text=null,this.hidden=sr(e,t)}function Mr(e,t,r){for(var n,i=[],o=t;o<r;o=n){var a=new Lr(e.doc,rt(e.doc,o),o);n=o+a.size,i.push(a)}return i}var Tr=null;function Nr(e){Tr?Tr.ops.push(e):e.ownsGroup=Tr={ops:[e],delayedCallbacks:[]}}function Or(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)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(r<t.length)}function Ar(e,t){var r=e.ownsGroup;if(r)try{Or(r)}finally{Tr=null,t(r)}}var Dr=null;function zr(e,t){var r=xe(e,t);if(r.length){var n,i=Array.prototype.slice.call(arguments,2);Tr?n=Tr.delayedCallbacks:Dr?n=Dr:(n=Dr=[],setTimeout(Fr,0));for(var o=function(e){n.push(function(){return r[e].apply(null,i)})},a=0;a<r.length;++a)o(a)}}function Fr(){var e=Dr;Dr=null;for(var t=0;t<e.length;++t)e[t]()}function Er(e,t,r,n){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?Pr(e,t):"gutter"==o?qr(e,t,r,n):"class"==o?Rr(e,t):"widget"==o&&jr(e,t,n)}t.changes=null}function Wr(e){return e.node==e.text&&(e.node=O("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),a&&l<8&&(e.node.style.zIndex=2)),e.node}function Ir(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=Wr(t);t.background=n.insertBefore(O("div",null,r),n.firstChild),e.display.input.setUneditable(t.background)}}function Hr(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):br(e,t)}function Pr(e,t){var r=t.text.className,n=Hr(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,Rr(e,t)):r&&(t.text.className=r)}function Rr(e,t){Ir(e,t),t.line.wrapClass?Wr(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 qr(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=Wr(t);t.gutterBackground=O("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var a=Wr(t),l=t.gutter=O("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(l.setAttribute("aria-hidden","true"),e.display.input.setUneditable(l),a.insertBefore(l,t.text),t.line.gutterClass&&(l.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=l.appendChild(O("div",ct(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var s=0;s<e.display.gutterSpecs.length;++s){var c=e.display.gutterSpecs[s].className,u=o.hasOwnProperty(c)&&o[c];u&&l.appendChild(O("div",[u],"CodeMirror-gutter-elt","left: "+n.gutterLeft[c]+"px; width: "+n.gutterWidth[c]+"px"))}}}function jr(e,t,r){t.alignable&&(t.alignable=null);for(var n=S("CodeMirror-linewidget"),i=t.node.firstChild,o=void 0;i;i=o)o=i.nextSibling,n.test(i.className)&&t.node.removeChild(i);Vr(e,t,r)}function Br(e,t,r,n){var i=Hr(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),Rr(e,t),qr(e,t,r,n),Vr(e,t,n),t.node}function Vr(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=Wr(r),a=0,l=t.widgets;a<l.length;++a){var s=l[a],c=O("div",[s.node],"CodeMirror-linewidget"+(s.className?" "+s.className:""));s.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),Gr(s,c,r,n),e.display.input.setUneditable(c),i&&s.above?o.insertBefore(c,r.gutter||r.text):o.appendChild(c),zr(s,"redraw")}}function Gr(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 $r(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!D(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;"),N(t.display.measure,O("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function Kr(e,t){for(var r=Ae(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 Qr(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Yr(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=N(e.measure,O("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 Zr(e){return G-e.display.nativeBarWidth}function Jr(e){return e.display.scroller.clientWidth-Zr(e)-e.display.barWidth}function en(e){return e.display.scroller.clientHeight-Zr(e)-e.display.barHeight}function tn(e,t,r){var n=e.options.lineWrapping,i=n&&Jr(e);if(!t.measure.heights||n&&t.measure.width!=i){var o=t.measure.heights=[];if(n){t.measure.width=i;for(var a=t.text.firstChild.getClientRects(),l=0;l<a.length-1;l++){var s=a[l],c=a[l+1];Math.abs(s.bottom-c.bottom)>2&&o.push((s.bottom+c.top)/2-r.top)}}o.push(r.bottom-r.top)}}function rn(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(at(e.rest[i])>r)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}}function nn(e,t){var r=at(t=nr(t)),n=e.display.externalMeasured=new Lr(e.doc,t,r);n.lineN=r;var i=n.built=br(e,n);return n.text=i.pre,N(e.display.lineMeasure,i.pre),n}function on(e,t,r,n){return sn(e,ln(e,t),r,n)}function an(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[qn(e,t)];var r=e.display.externalMeasured;return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function ln(e,t){var r=at(t),n=an(e,r);n&&!n.text?n=null:n&&n.changes&&(Er(e,n,r,Wn(e)),e.curOp.forceUpdate=!0),n||(n=nn(e,t));var i=rn(n,t,r);return{line:t,view:n,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function sn(e,t,r,n,i){t.before&&(r=-1);var o,a=r+(n||"");return t.cache.hasOwnProperty(a)?o=t.cache[a]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(tn(e,t.view,t.rect),t.hasHeights=!0),(o=hn(e,t,r,n)).bogus||(t.cache[a]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}var cn,un={left:0,right:0,top:0,bottom:0};function dn(e,t,r){for(var n,i,o,a,l,s,c=0;c<e.length;c+=3)if(l=e[c],s=e[c+1],t<l?(i=0,o=1,a="left"):t<s?o=1+(i=t-l):(c==e.length-3||t==s&&e[c+3]>t)&&(i=(o=s-l)-1,t>=s&&(a="right")),null!=i){if(n=e[c+2],l==s&&r==(n.insertLeft?"left":"right")&&(a=r),"left"==r&&0==i)for(;c&&e[c-2]==e[c-3]&&e[c-1].insertLeft;)n=e[2+(c-=3)],a="left";if("right"==r&&i==s-l)for(;c<e.length-3&&e[c+3]==e[c+4]&&!e[c+5].insertLeft;)n=e[(c+=3)+2],a="right";break}return{node:n,start:i,end:o,collapse:a,coverStart:l,coverEnd:s}}function fn(e,t){var r=un;if("left"==t)for(var n=0;n<e.length&&(r=e[n]).left==r.right;n++);else for(var i=e.length-1;i>=0&&(r=e[i]).left==r.right;i--);return r}function hn(e,t,r,n){var i,o=dn(t.map,r,n),s=o.node,c=o.start,u=o.end,d=o.collapse;if(3==s.nodeType){for(var f=0;f<4;f++){for(;c&&ue(t.line.text.charAt(o.coverStart+c));)--c;for(;o.coverStart+u<o.coverEnd&&ue(t.line.text.charAt(o.coverStart+u));)++u;if((i=a&&l<9&&0==c&&u==o.coverEnd-o.coverStart?s.parentNode.getBoundingClientRect():fn(L(s,c,u).getClientRects(),n)).left||i.right||0==c)break;u=c,c-=1,d="right"}a&&l<11&&(i=pn(e.display.measure,i))}else{var h;c>0&&(d=n="right"),i=e.options.lineWrapping&&(h=s.getClientRects()).length>1?h["right"==n?h.length-1:0]:s.getBoundingClientRect()}if(a&&l<9&&!c&&(!i||!i.left&&!i.right)){var p=s.parentNode.getClientRects()[0];i=p?{left:p.left,right:p.left+En(e.display),top:p.top,bottom:p.bottom}:un}for(var m=i.top-t.rect.top,g=i.bottom-t.rect.top,v=(m+g)/2,y=t.view.measure.heights,b=0;b<y.length-1&&!(v<y[b]);b++);var x=b?y[b-1]:0,w=y[b],_={left:("right"==d?i.right:i.left)-t.rect.left,right:("left"==d?i.left:i.right)-t.rect.left,top:x,bottom:w};return i.left||i.right||(_.bogus=!0),e.options.singleCursorHeightPerLine||(_.rtop=m,_.rbottom=g),_}function pn(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 mn(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 gn(e){e.display.externalMeasure=null,T(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)mn(e.display.view[t])}function vn(e){gn(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function yn(e){return u&&v?-(e.body.getBoundingClientRect().left-parseInt(getComputedStyle(e.body).marginLeft)):e.defaultView.pageXOffset||(e.documentElement||e.body).scrollLeft}function bn(e){return u&&v?-(e.body.getBoundingClientRect().top-parseInt(getComputedStyle(e.body).marginTop)):e.defaultView.pageYOffset||(e.documentElement||e.body).scrollTop}function xn(e){var t=nr(e).widgets,r=0;if(t)for(var n=0;n<t.length;++n)t[n].above&&(r+=$r(t[n]));return r}function wn(e,t,r,n,i){if(!i){var o=xn(t);r.top+=o,r.bottom+=o}if("line"==n)return r;n||(n="local");var a=ur(t);if("local"==n?a+=Xr(e.display):a-=e.display.viewOffset,"page"==n||"window"==n){var l=e.display.lineSpace.getBoundingClientRect();a+=l.top+("window"==n?0:bn(I(e)));var s=l.left+("window"==n?0:yn(I(e)));r.left+=s,r.right+=s}return r.top+=a,r.bottom+=a,r}function _n(e,t,r){if("div"==r)return t;var n=t.left,i=t.top;if("page"==r)n-=yn(I(e)),i-=bn(I(e));else if("local"==r||!r){var o=e.display.sizer.getBoundingClientRect();n+=o.left,i+=o.top}var a=e.display.lineSpace.getBoundingClientRect();return{left:n-a.left,top:i-a.top}}function kn(e,t,r,n,i){return n||(n=rt(e.doc,t.line)),wn(e,n,on(e,n,t.ch,i),r)}function Cn(e,t,r,n,i,o){function a(t,a){var l=sn(e,i,t,a?"right":"left",o);return a?l.left=l.right:l.right=l.left,wn(e,n,l,r)}n=n||rt(e.doc,t.line),i||(i=ln(e,n));var l=ve(n,e.doc.direction),s=t.ch,c=t.sticky;if(s>=n.text.length?(s=n.text.length,c="before"):s<=0&&(s=0,c="after"),!l)return a("before"==c?s-1:s,"before"==c);function u(e,t,r){return a(r?e-1:e,1==l[t].level!=r)}var d=me(l,s,c),f=pe,h=u(s,d,"before"==c);return null!=f&&(h.other=u(s,f,"before"!=c)),h}function Sn(e,t){var r=0;t=vt(e.doc,t),e.options.lineWrapping||(r=En(e.display)*t.ch);var n=rt(e.doc,t.line),i=ur(n)+Xr(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function Ln(e,t,r,n,i){var o=ut(e,t,r);return o.xRel=i,n&&(o.outside=n),o}function Mn(e,t,r){var n=e.doc;if((r+=e.display.viewOffset)<0)return Ln(n.first,0,null,-1,-1);var i=lt(n,r),o=n.first+n.size-1;if(i>o)return Ln(n.first+n.size-1,rt(n,o).text.length,null,1,1);t<0&&(t=0);for(var a=rt(n,i);;){var l=An(e,a,i,t,r),s=tr(a,l.ch+(l.xRel>0||l.outside>0?1:0));if(!s)return l;var c=s.find(1);if(c.line==i)return c;a=rt(n,i=c.line)}}function Tn(e,t,r,n){n-=xn(t);var i=t.text.length,o=fe(function(t){return sn(e,r,t-1).bottom<=n},i,0);return{begin:o,end:i=fe(function(t){return sn(e,r,t).top>n},o,i)}}function Nn(e,t,r,n){return r||(r=ln(e,t)),Tn(e,t,r,wn(e,t,sn(e,r,n),"line").top)}function On(e,t,r,n){return!(e.bottom<=r)&&(e.top>r||(n?e.left:e.right)>t)}function An(e,t,r,n,i){i-=ur(t);var o=ln(e,t),a=xn(t),l=0,s=t.text.length,c=!0,u=ve(t,e.doc.direction);if(u){var d=(e.options.lineWrapping?zn:Dn)(e,t,r,o,u,n,i);l=(c=1!=d.level)?d.from:d.to-1,s=c?d.to:d.from-1}var f,h,p=null,m=null,g=fe(function(t){var r=sn(e,o,t);return r.top+=a,r.bottom+=a,!!On(r,n,i,!1)&&(r.top<=i&&r.left<=n&&(p=t,m=r),!0)},l,s),v=!1;if(m){var y=n-m.left<m.right-n,b=y==c;g=p+(b?0:1),h=b?"after":"before",f=y?m.left:m.right}else{c||g!=s&&g!=l||g++,h=0==g?"after":g==t.text.length?"before":sn(e,o,g-(c?1:0)).bottom+a<=i==c?"after":"before";var x=Cn(e,ut(r,g,h),"line",t,o);f=x.left,v=i<x.top?-1:i>=x.bottom?1:0}return Ln(r,g=de(t.text,g,1),h,v,n-f)}function Dn(e,t,r,n,i,o,a){var l=fe(function(l){var s=i[l],c=1!=s.level;return On(Cn(e,ut(r,c?s.to:s.from,c?"before":"after"),"line",t,n),o,a,!0)},0,i.length-1),s=i[l];if(l>0){var c=1!=s.level,u=Cn(e,ut(r,c?s.from:s.to,c?"after":"before"),"line",t,n);On(u,o,a,!0)&&u.top>a&&(s=i[l-1])}return s}function zn(e,t,r,n,i,o,a){var l=Tn(e,t,n,a),s=l.begin,c=l.end;/\s/.test(t.text.charAt(c-1))&&c--;for(var u=null,d=null,f=0;f<i.length;f++){var h=i[f];if(!(h.from>=c||h.to<=s)){var p=sn(e,n,1!=h.level?Math.min(c,h.to)-1:Math.max(s,h.from)).right,m=p<o?o-p+1e9:p-o;(!u||d>m)&&(u=h,d=m)}}return u||(u=i[i.length-1]),u.from<s&&(u={from:s,to:u.to,level:u.level}),u.to>c&&(u={from:u.from,to:c,level:u.level}),u}function Fn(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==cn){cn=O("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)cn.appendChild(document.createTextNode("x")),cn.appendChild(O("br"));cn.appendChild(document.createTextNode("x"))}N(e.measure,cn);var r=cn.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),T(e.measure),r||1}function En(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=O("span","xxxxxxxxxx"),r=O("pre",[t],"CodeMirror-line-like");N(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Wn(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a){var l=e.display.gutterSpecs[a].className;r[l]=o.offsetLeft+o.clientLeft+i,n[l]=o.clientWidth}return{fixedPos:In(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function In(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Hn(e){var t=Fn(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/En(e.display)-3);return function(i){if(sr(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a<i.widgets.length;a++)i.widgets[a].height&&(o+=i.widgets[a].height);return r?o+(Math.ceil(i.text.length/n)||1)*t:o+t}}function Pn(e){var t=e.doc,r=Hn(e);t.iter(function(e){var t=r(e);t!=e.height&&ot(e,t)})}function Rn(e,t,r,n){var i=e.display;if(!r&&"true"==Ae(t).getAttribute("cm-not-content"))return null;var o,a,l=i.lineSpace.getBoundingClientRect();try{o=t.clientX-l.left,a=t.clientY-l.top}catch(d){return null}var s,c=Mn(e,o,a);if(n&&c.xRel>0&&(s=rt(e.doc,c.line).text).length==c.ch){var u=B(s,s.length,e.options.tabSize)-s.length;c=ut(c.line,Math.max(0,Math.round((o-Yr(e.display).left)/En(e.display))-u))}return c}function qn(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var r=e.display.view,n=0;n<r.length;n++)if((t-=r[n].size)<0)return n}function jn(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)Et&&ar(e.doc,t)<i.viewTo&&Vn(e);else if(r<=i.viewFrom)Et&&lr(e.doc,r+n)>i.viewFrom?Vn(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)Vn(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):Vn(e)}else if(r>=i.viewTo){var a=Un(e,t,t,-1);a?(i.view=i.view.slice(0,a.index),i.viewTo=a.lineN):Vn(e)}else{var l=Un(e,t,t,-1),s=Un(e,r,r+n,1);l&&s?(i.view=i.view.slice(0,l.index).concat(Mr(e,l.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=n):Vn(e)}var c=i.externalMeasured;c&&(r<c.lineN?c.lineN+=n:t<c.lineN+c.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[qn(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==U(a,r)&&a.push(r)}}}function Vn(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=qn(e,t),a=e.display.view;if(!Et||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var l=e.display.viewFrom,s=0;s<o;s++)l+=a[s].size;if(l!=t){if(n>0){if(o==a.length-1)return null;i=l+a[o].size-t,o++}else i=l-t;t+=i,r+=i}for(;ar(e.doc,r)!=r;){if(o==(n<0?0:a.length-1))return null;r+=n*a[o-(n<0?1:0)].size,o+=n}return{index:o,lineN:r}}function Gn(e,t,r){var n=e.display;0==n.view.length||t>=n.viewTo||r<=n.viewFrom?(n.view=Mr(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=Mr(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(qn(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(Mr(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,qn(e,r)))),n.viewTo=r}function $n(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 Kn(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(),a=e.options.$customCursor;a&&(t=!0);for(var l=0;l<r.sel.ranges.length;l++)if(t||l!=r.sel.primIndex){var s=r.sel.ranges[l];if(!(s.from().line>=e.display.viewTo||s.to().line<e.display.viewFrom)){var c=s.empty();if(a){var u=a(e,s);u&&Qn(e,u,i)}else(c||e.options.showCursorWhenSelecting)&&Qn(e,s.head,i);c||Zn(e,s,o)}}return n}function Qn(e,t,r){var n=Cn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=r.appendChild(O("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=kn(e,t,"div",null,null),a=o.right-o.left;i.style.width=(a>0?a:e.defaultCharWidth())+"px"}if(n.other){var l=r.appendChild(O("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));l.style.display="",l.style.left=n.other.left+"px",l.style.top=n.other.top+"px",l.style.height=.85*(n.other.bottom-n.other.top)+"px"}}function Yn(e,t){return e.top-t.top||e.left-t.left}function Zn(e,t,r){var n=e.display,i=e.doc,o=document.createDocumentFragment(),a=Yr(e.display),l=a.left,s=Math.max(n.sizerWidth,Jr(e)-n.sizer.offsetLeft)-a.right,c="ltr"==i.direction;function u(e,t,r,n){t<0&&(t=0),t=Math.round(t),n=Math.round(n),o.appendChild(O("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==r?s-e:r)+"px;\n height: "+(n-t)+"px"))}function d(t,r,n){var o,a,d=rt(i,t),f=d.text.length;function h(r,n){return kn(e,ut(t,r),"div",d,n)}function p(t,r,n){var i=Nn(e,d,null,t),o="ltr"==r==("after"==n)?"left":"right";return h("after"==n?i.begin:i.end-(/\s/.test(d.text.charAt(i.end-1))?2:1),o)[o]}var m=ve(d,i.direction);return he(m,r||0,null==n?f:n,function(e,t,i,d){var g="ltr"==i,v=h(e,g?"left":"right"),y=h(t-1,g?"right":"left"),b=null==r&&0==e,x=null==n&&t==f,w=0==d,_=!m||d==m.length-1;if(y.top-v.top<=3){var k=(c?x:b)&&_,C=(c?b:x)&&w?l:(g?v:y).left,S=k?s:(g?y:v).right;u(C,v.top,S-C,v.bottom)}else{var L,M,T,N;g?(L=c&&b&&w?l:v.left,M=c?s:p(e,i,"before"),T=c?l:p(t,i,"after"),N=c&&x&&_?s:y.right):(L=c?p(e,i,"before"):l,M=!c&&b&&w?s:v.right,T=!c&&x&&_?l:y.left,N=c?p(t,i,"after"):s),u(L,v.top,M-L,v.bottom),v.bottom<y.top&&u(l,v.bottom,null,y.top),u(T,y.top,N-T,y.bottom)}(!o||Yn(v,o)<0)&&(o=v),Yn(y,o)<0&&(o=y),(!a||Yn(v,a)<0)&&(a=v),Yn(y,a)<0&&(a=y)}),{start:o,end:a}}var f=t.from(),h=t.to();if(f.line==h.line)d(f.line,f.ch,h.ch);else{var p=rt(i,f.line),m=rt(i,h.line),g=nr(p)==nr(m),v=d(f.line,f.ch,g?p.text.length+1:null).end,y=d(h.line,g?0:null,h.ch).start;g&&(v.top<y.top-2?(u(v.right,v.top,null,v.bottom),u(l,y.top,y.left,y.bottom)):u(v.right,v.top,y.left-v.right,v.bottom)),v.bottom<y.top&&u(l,v.bottom,null,y.top)}r.appendChild(o)}function Jn(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()||ni(e),t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function ei(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||ri(e))}function ti(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&ni(e))},100)}function ri(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(_e(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(),s&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Jn(e))}function ni(e,t){e.state.delayingBlurEvent||(e.state.focused&&(_e(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 ii(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,s=0;s<t.view.length;s++){var c=t.view[s],u=e.options.lineWrapping,d=void 0,f=0;if(!c.hidden){if(i+=c.line.height,a&&l<8){var h=c.node.offsetTop+c.node.offsetHeight;d=h-r,r=h}else{var p=c.node.getBoundingClientRect();d=p.bottom-p.top,!u&&c.text.firstChild&&(f=c.text.firstChild.getBoundingClientRect().right-p.left-1)}var m=c.line.height-d;if((m>.005||m<-.005)&&(i<n&&(o-=m),ot(c.line,d),oi(c.line),c.rest))for(var g=0;g<c.rest.length;g++)oi(c.rest[g]);if(f>e.display.sizerWidth){var v=Math.ceil(f/En(e.display));v>e.display.maxLineLength&&(e.display.maxLineLength=v,e.display.maxLine=c.line,e.display.maxLineChanged=!0)}}}Math.abs(o)>2&&(t.scroller.scrollTop+=o)}function oi(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 ai(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=lt(t,n),a=lt(t,i);if(r&&r.ensure){var l=r.ensure.from.line,s=r.ensure.to.line;l<o?(o=l,a=lt(t,ur(rt(t,l))+e.wrapper.clientHeight)):Math.min(s,t.lastLine())>=a&&(o=lt(t,ur(rt(t,s))-e.wrapper.clientHeight),a=s)}return{from:o,to:Math.max(a,o+1)}}function li(e,t){if(!ke(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&&!m){var a=O("div","",null,"position: absolute;\n top: "+(t.top-r.viewOffset-Xr(e.display))+"px;\n height: "+(t.bottom-t.top+Zr(e)+r.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(a),a.scrollIntoView(i),e.display.lineSpace.removeChild(a)}}}function si(e,t,r,n){var i;null==n&&(n=0),e.options.lineWrapping||t!=r||(r="before"==t.sticky?ut(t.line,t.ch+1,"before"):t,t=t.ch?ut(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t);for(var o=0;o<5;o++){var a=!1,l=Cn(e,t),s=r&&r!=t?Cn(e,r):l,c=ui(e,i={left:Math.min(l.left,s.left),top:Math.min(l.top,s.top)-n,right:Math.max(l.left,s.left),bottom:Math.max(l.bottom,s.bottom)+n}),u=e.doc.scrollTop,d=e.doc.scrollLeft;if(null!=c.scrollTop&&(vi(e,c.scrollTop),Math.abs(e.doc.scrollTop-u)>1&&(a=!0)),null!=c.scrollLeft&&(bi(e,c.scrollLeft),Math.abs(e.doc.scrollLeft-d)>1&&(a=!0)),!a)break}return i}function ci(e,t){var r=ui(e,t);null!=r.scrollTop&&vi(e,r.scrollTop),null!=r.scrollLeft&&bi(e,r.scrollLeft)}function ui(e,t){var r=e.display,n=Fn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:r.scroller.scrollTop,o=en(e),a={};t.bottom-t.top>o&&(t.bottom=t.top+o);var l=e.doc.height+Qr(r),s=t.top<n,c=t.bottom>l-n;if(t.top<i)a.scrollTop=s?0:t.top;else if(t.bottom>i+o){var u=Math.min(t.top,(c?l:t.bottom)-o);u!=i&&(a.scrollTop=u)}var d=e.options.fixedGutter?0:r.gutters.offsetWidth,f=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:r.scroller.scrollLeft-d,h=Jr(e)-r.gutters.offsetWidth,p=t.right-t.left>h;return p&&(t.right=t.left+h),t.left<10?a.scrollLeft=0:t.left<f?a.scrollLeft=Math.max(0,t.left+d-(p?0:10)):t.right>h+f-3&&(a.scrollLeft=t.right+(p?0:10)-h),a}function di(e,t){null!=t&&(mi(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function fi(e){mi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function hi(e,t,r){null==t&&null==r||mi(e),null!=t&&(e.curOp.scrollLeft=t),null!=r&&(e.curOp.scrollTop=r)}function pi(e,t){mi(e),e.curOp.scrollToPos=t}function mi(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,gi(e,Sn(e,t.from),Sn(e,t.to),t.margin))}function gi(e,t,r,n){var i=ui(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});hi(e,i.scrollLeft,i.scrollTop)}function vi(e,t){Math.abs(e.doc.scrollTop-t)<2||(r||Ki(e,{top:t}),yi(e,t,!0),r&&Ki(e),Ri(e,100))}function yi(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 bi(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,Zi(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function xi(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+Qr(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+Zr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var wi=function(e,t,r){this.cm=r;var n=this.vert=O("div",[O("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=O("div",[O("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=i.tabIndex=-1,e(n),e(i),be(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),be(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,a&&l<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};wi.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}},wi.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},wi.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},wi.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 V,this.disableVert=new V},wi.prototype.enableZeroWidthBar=function(e,t,r){function n(){var i=e.getBoundingClientRect();("vert"==r?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1))!=e?e.style.visibility="hidden":t.set(1e3,n)}e.style.visibility="",t.set(1e3,n)},wi.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var _i=function(){};function ki(e,t){t||(t=xi(e));var r=e.display.barWidth,n=e.display.barHeight;Ci(e,t);for(var i=0;i<4&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&ii(e),Ci(e,xi(e)),r=e.display.barWidth,n=e.display.barHeight}function Ci(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=""}_i.prototype.update=function(){return{bottom:0,right:0}},_i.prototype.setScrollLeft=function(){},_i.prototype.setScrollTop=function(){},_i.prototype.clear=function(){};var Si={native:wi,null:_i};function Li(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&M(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Si[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),be(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?bi(e,t):vi(e,t)},e),e.display.scrollbars.addClass&&F(e.display.wrapper,e.display.scrollbars.addClass)}var Mi=0;function Ti(e){e.curOp={cm:e,viewChanged:!1,
// Flag that indicates that lines might need to be redrawn
startHeight:e.doc.height,
// Used to detect need to update scrollbar
forceUpdate:!1,
// Used to force a redraw
updateInput:0,
// Whether to reset the input textarea
typing:!1,
// Whether this reset should be careful to leave existing text (for compositing)
changeObjs:null,
// Accumulated changes, for firing change events
cursorActivityHandlers:null,
// Set of handlers to fire cursorActivity on
cursorActivityCalled:0,
// Tracks which cursorActivity handlers have been called already
selectionChanged:!1,
// Whether the selection needs to be redrawn
updateMaxLine:!1,
// Set when the widest line needs to be determined anew
scrollLeft:null,scrollTop:null,
// Intermediate scroll position, not pushed to DOM yet
scrollToPos:null,
// Used to scroll to a specific position
focus:!1,id:++Mi,
// Unique ID
markArrays:null},Nr(e.curOp)}function Ni(e){var t=e.curOp;t&&Ar(t,function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null;Oi(e)})}function Oi(e){for(var t=e.ops,r=0;r<t.length;r++)Ai(t[r]);for(var n=0;n<t.length;n++)Di(t[n]);for(var i=0;i<t.length;i++)zi(t[i]);for(var o=0;o<t.length;o++)Fi(t[o]);for(var a=0;a<t.length;a++)Ei(t[a])}function Ai(e){var t=e.cm,r=t.display;Bi(t),e.updateMaxLine&&fr(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 ji(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Di(e){e.updatedDisplay=e.mustUpdate&&Gi(e.cm,e.update)}function zi(e){var t=e.cm,r=t.display;e.updatedDisplay&&ii(t),e.barMeasure=xi(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=on(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+Zr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Jr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function Fi(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&bi(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==z(H(t));e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&ki(t,e.barMeasure),e.updatedDisplay&&Yi(t,e.barMeasure),e.selectionChanged&&Jn(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&ei(e.cm)}function Ei(e){var t=e.cm,r=t.display,n=t.doc;e.updatedDisplay&&$i(t,e.update),null==r.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(r.wheelStartX=r.wheelStartY=null),null!=e.scrollTop&&yi(t,e.scrollTop,e.forceScroll),null!=e.scrollLeft&&bi(t,e.scrollLeft,!0,!0),e.scrollToPos&&li(t,si(t,vt(n,e.scrollToPos.from),vt(n,e.scrollToPos.to),e.scrollToPos.margin));var i=e.maybeHiddenMarkers,o=e.maybeUnhiddenMarkers;if(i)for(var a=0;a<i.length;++a)i[a].lines.length||_e(i[a],"hide");if(o)for(var l=0;l<o.length;++l)o[l].lines.length&&_e(o[l],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&_e(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Wi(e,t){if(e.curOp)return t();Ti(e);try{return t()}finally{Ni(e)}}function Ii(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Ti(e);try{return t.apply(e,arguments)}finally{Ni(e)}}}function Hi(e){return function(){if(this.curOp)return e.apply(this,arguments);Ti(this);try{return e.apply(this,arguments)}finally{Ni(this)}}}function Pi(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Ti(t);try{return e.apply(this,arguments)}finally{Ni(t)}}}function Ri(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,q(qi,e))}function qi(e){var t=e.doc;if(!(t.highlightFrontier>=e.display.viewTo)){var r=+new Date+e.options.workTime,n=Ct(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 a=o.styles,l=o.text.length>e.options.maxHighlightLength?Ze(t.mode,n.state):null,s=_t(e,o,n,!0);l&&(n.state=l),o.styles=s.styles;var c=o.styleClasses,u=s.classes;u?o.styleClasses=u:c&&(o.styleClasses=null);for(var d=!a||a.length!=o.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),f=0;!d&&f<a.length;++f)d=a[f]!=o.styles[f];d&&i.push(n.line),o.stateAfter=n.save(),n.nextLine()}else o.text.length<=e.options.maxHighlightLength&&St(e,o.text,n),o.stateAfter=n.line%5==0?n.save():null,n.nextLine();if(+new Date>r)return Ri(e,e.options.workDelay),!0}),t.highlightFrontier=n.line,t.modeFrontier=Math.max(t.modeFrontier,n.line),i.length&&Wi(e,function(){for(var t=0;t<i.length;t++)Bn(e,i[t],"text")})}}var ji=function(e,t,r){var n=e.display;this.viewport=t,this.visible=ai(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=Jr(e),this.force=r,this.dims=Wn(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=Zr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Zr(e)+"px",t.scrollbarsClipped=!0)}function Vi(e){if(e.hasFocus())return null;var t=z(H(e));if(!t||!D(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var n=R(e).getSelection();n.anchorNode&&n.extend&&D(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!=z(P(e.activeElt))&&(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&D(document.body,e.anchorNode)&&D(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 Gi(e,t){var r=e.display,n=e.doc;if(t.editorIsHidden)return Vn(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==$n(e))return!1;Ji(e)&&(Vn(e),t.dims=Wn(e));var i=n.first+n.size,o=Math.max(t.visible.from-e.options.viewportMargin,n.first),a=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>a&&r.viewTo-a<20&&(a=Math.min(i,r.viewTo)),Et&&(o=ar(e.doc,o),a=lr(e.doc,a));var l=o!=r.viewFrom||a!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Gn(e,o,a),r.viewOffset=ur(rt(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var s=$n(e);if(!l&&0==s&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var c=Vi(e);return s>4&&(r.lineDiv.style.display="none"),Xi(e,r.updateLineNumbers,t.dims),s>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,Ui(c),T(r.cursorDiv),T(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,l&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,Ri(e,400)),r.updateLineNumbers=null,!0}function $i(e,t){for(var r=t.viewport,n=!0;;n=!1){if(n&&e.options.lineWrapping&&t.oldDisplayWidth!=Jr(e))n&&(t.visible=ai(e.display,e.doc,r));else if(r&&null!=r.top&&(r={top:Math.min(e.doc.height+Qr(e.display)-en(e),r.top)}),t.visible=ai(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!Gi(e,t))break;ii(e);var i=xi(e);Kn(e),ki(e,i),Yi(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 Ki(e,t){var r=new ji(e,t);if(Gi(e,r)){ii(e),$i(e,r);var n=xi(e);Kn(e),ki(e,n),Yi(e,n),r.finish()}}function Xi(e,t,r){var n=e.display,i=e.options.lineNumbers,o=n.lineDiv,a=o.firstChild;function l(t){var r=t.nextSibling;return s&&b&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),r}for(var c=n.view,u=n.viewFrom,d=0;d<c.length;d++){var f=c[d];if(f.hidden);else if(f.node&&f.node.parentNode==o){for(;a!=f.node;)a=l(a);var h=i&&null!=t&&t<=u&&f.lineNumber;f.changes&&(U(f.changes,"gutter")>-1&&(h=!1),Er(e,f,u,r)),h&&(T(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(ct(e.options,u)))),a=f.node.nextSibling}else{var p=Br(e,f,u,r);o.insertBefore(p,a)}u+=f.size}for(;a;)a=l(a)}function Qi(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",zr(e,"gutterChanged",e)}function Yi(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+Zr(e)+"px"}function Zi(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=In(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",a=0;a<r.length;a++)if(!r[a].hidden){e.options.fixedGutter&&(r[a].gutter&&(r[a].gutter.style.left=o),r[a].gutterBackground&&(r[a].gutterBackground.style.left=o));var l=r[a].alignable;if(l)for(var s=0;s<l.length;s++)l[s].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=n+i+"px")}}function Ji(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=ct(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var i=n.measure.appendChild(O("div",[O("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,a=i.offsetWidth-o;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(o,n.lineGutter.offsetWidth-a)+1,n.lineNumWidth=n.lineNumInnerWidth+a,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",Qi(e.display),!0}return!1}function eo(e,t){for(var r=[],n=!1,i=0;i<e.length;i++){var o=e[i],a=null;if("string"!=typeof o&&(a=o.style,o=o.className),"CodeMirror-linenumbers"==o){if(!t)continue;n=!0}r.push({className:o,style:a})}return t&&!n&&r.push({className:"CodeMirror-linenumbers",style:null}),r}function to(e){var t=e.gutters,r=e.gutterSpecs;T(t),e.lineGutter=null;for(var n=0;n<r.length;++n){var i=r[n],o=i.className,a=i.style,l=t.appendChild(O("div",null,"CodeMirror-gutter "+o));a&&(l.style.cssText=a),"CodeMirror-linenumbers"==o&&(e.lineGutter=l,l.style.width=(e.lineNumWidth||1)+"px")}t.style.display=r.length?"":"none",Qi(e)}function ro(e){to(e.display),jn(e),Zi(e)}function no(e,t,n,i){var o=this;this.input=n,o.scrollbarFiller=O("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=O("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=A("div",null,"CodeMirror-code"),o.selectionDiv=O("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=O("div",null,"CodeMirror-cursors"),o.measure=O("div",null,"CodeMirror-measure"),o.lineMeasure=O("div",null,"CodeMirror-measure"),o.lineSpace=A("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");var c=A("div",[o.lineSpace],"CodeMirror-lines");o.mover=O("div",[c],null,"position: relative"),o.sizer=O("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=O("div",null,null,"position: absolute; height: "+G+"px; width: 1px;"),o.gutters=O("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=O("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=O("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),u&&105===d&&(o.wrapper.style.clipPath="inset(0px)"),o.wrapper.setAttribute("translate","no"),a&&l<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),s||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=eo(i.gutters,i.lineNumbers),to(o),n.init(o)}ji.prototype.signal=function(e,t){Se(e,t)&&this.events.push(arguments)},ji.prototype.finish=function(){for(var e=0;e<this.events.length;e++)_e.apply(null,this.events[e])};var io=0,oo=null;function ao(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 lo(e){var t=ao(e);return t.x*=oo,t.y*=oo,t}function so(e,t){u&&102==d&&(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=ao(t),i=n.x,o=n.y,a=oo;0===t.deltaMode&&(i=t.deltaX,o=t.deltaY,a=1);var l=e.display,c=l.scroller,h=c.scrollWidth>c.clientWidth,p=c.scrollHeight>c.clientHeight;if(i&&h||o&&p){if(o&&b&&s)e:for(var m=t.target,g=l.view;m!=c;m=m.parentNode)for(var v=0;v<g.length;v++)if(g[v].node==m){e.display.currentWheelTarget=m;break e}if(i&&!r&&!f&&null!=a)return o&&p&&vi(e,Math.max(0,c.scrollTop+o*a)),bi(e,Math.max(0,c.scrollLeft+i*a)),(!o||o&&p)&&Me(t),void(l.wheelStartX=null);if(o&&null!=a){var y=o*a,x=e.doc.scrollTop,w=x+l.wrapper.clientHeight;y<0?x=Math.max(0,x+y-50):w=Math.min(e.doc.height,w+y+50),Ki(e,{top:x,bottom:w})}io<20&&0!==t.deltaMode&&(null==l.wheelStartX?(l.wheelStartX=c.scrollLeft,l.wheelStartY=c.scrollTop,l.wheelDX=i,l.wheelDY=o,setTimeout(function(){if(null!=l.wheelStartX){var e=c.scrollLeft-l.wheelStartX,t=c.scrollTop-l.wheelStartY,r=t&&l.wheelDY&&t/l.wheelDY||e&&l.wheelDX&&e/l.wheelDX;l.wheelStartX=l.wheelStartY=null,r&&(oo=(oo*io+r)/(io+1),++io)}},200)):(l.wheelDX+=i,l.wheelDY+=o))}}a?oo=-.53:r?oo=15:u?oo=-.7:h&&(oo=-1/3);var co=function(e,t){this.ranges=e,this.primIndex=t};co.prototype.primary=function(){return this.ranges[this.primIndex]},co.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(!ft(r.anchor,n.anchor)||!ft(r.head,n.head))return!1}return!0},co.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new uo(ht(this.ranges[t].anchor),ht(this.ranges[t].head));return new co(e,this.primIndex)},co.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},co.prototype.contains=function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(dt(t,n.from())>=0&&dt(e,n.to())<=0)return r}return-1};var uo=function(e,t){this.anchor=e,this.head=t};function fo(e,t,r){var n=e&&e.options.selectionsMayTouch,i=t[r];t.sort(function(e,t){return dt(e.from(),t.from())}),r=U(t,i);for(var o=1;o<t.length;o++){var a=t[o],l=t[o-1],s=dt(l.to(),a.from());if(n&&!a.empty()?s>0:s>=0){var c=mt(l.from(),a.from()),u=pt(l.to(),a.to()),d=l.empty()?a.from()==a.head:l.from()==l.head;o<=r&&--r,t.splice(--o,2,new uo(d?u:c,d?c:u))}}return new co(t,r)}function ho(e,t){return new co([new uo(e,t||e)],0)}function po(e){return e.text?ut(e.from.line+e.text.length-1,ee(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function mo(e,t){if(dt(e,t.from)<0)return e;if(dt(e,t.to)<=0)return po(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+=po(t).ch-t.to.ch),ut(r,n)}function go(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var i=e.sel.ranges[n];r.push(new uo(mo(i.anchor,t),mo(i.head,t)))}return fo(e.cm,r,e.sel.primIndex)}function vo(e,t,r){return e.line==t.line?ut(r.line,e.ch-t.ch+r.ch):ut(r.line+(e.line-t.line),e.ch)}function yo(e,t,r){for(var n=[],i=ut(e.first,0),o=i,a=0;a<t.length;a++){var l=t[a],s=vo(l.from,i,o),c=vo(po(l),i,o);if(i=l.to,o=c,"around"==r){var u=e.sel.ranges[a],d=dt(u.head,u.anchor)<0;n[a]=new uo(d?c:s,d?s:c)}else n[a]=new uo(s,s)}return new co(n,e.sel.primIndex)}function bo(e){e.doc.mode=Xe(e.options,e.doc.modeOption),xo(e)}function xo(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,Ri(e,100),e.state.modeGen++,e.curOp&&jn(e)}function wo(e,t){return 0==t.from.ch&&0==t.to.ch&&""==ee(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function _o(e,t,r,n){function i(e){return r?r[e]:null}function o(e,r,i){pr(e,r,i,n),zr(e,"change",e,t)}function a(e,t){for(var r=[],o=e;o<t;++o)r.push(new hr(c[o],i(o),n));return r}var l=t.from,s=t.to,c=t.text,u=rt(e,l.line),d=rt(e,s.line),f=ee(c),h=i(c.length-1),p=s.line-l.line;if(t.full)e.insert(0,a(0,c.length)),e.remove(c.length,e.size-c.length);else if(wo(e,t)){var m=a(0,c.length-1);o(d,d.text,h),p&&e.remove(l.line,p),m.length&&e.insert(l.line,m)}else if(u==d)if(1==c.length)o(u,u.text.slice(0,l.ch)+f+u.text.slice(s.ch),h);else{var g=a(1,c.length-1);g.push(new hr(f+u.text.slice(s.ch),h,n)),o(u,u.text.slice(0,l.ch)+c[0],i(0)),e.insert(l.line+1,g)}else if(1==c.length)o(u,u.text.slice(0,l.ch)+c[0]+d.text.slice(s.ch),i(0)),e.remove(l.line+1,p);else{o(u,u.text.slice(0,l.ch)+c[0],i(0)),o(d,f+d.text.slice(s.ch),h);var v=a(1,c.length-1);p>1&&e.remove(l.line+1,p-1),e.insert(l.line+1,v)}zr(e,"change",e,t)}function ko(e,t,r){function n(e,i,o){if(e.linked)for(var a=0;a<e.linked.length;++a){var l=e.linked[a];if(l.doc!=i){var s=o&&l.sharedHist;r&&!s||(t(l.doc,s),n(l.doc,e,s))}}}n(e,null,!0)}function Co(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Pn(e),bo(e),So(e),e.options.direction=t.direction,e.options.lineWrapping||fr(e),e.options.mode=t.modeOption,jn(e)}function So(e){("rtl"==e.doc.direction?F:M)(e.display.lineDiv,"CodeMirror-rtl")}function Lo(e){Wi(e,function(){So(e),jn(e)})}function Mo(e){this.done=[],this.undone=[],this.undoDepth=e?e.undoDepth:Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e?e.maxGeneration:1}function To(e,t){var r={from:ht(t.from),to:po(t),text:nt(e,t.from,t.to)};return Eo(e,r,t.from.line,t.to.line+1),ko(e,function(e){return Eo(e,r,t.from.line,t.to.line+1)},!0),r}function No(e){for(;e.length&&ee(e).ranges;)e.pop()}function Oo(e,t){return t?(No(e.done),ee(e.done)):e.done.length&&!ee(e.done).ranges?ee(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),ee(e.done)):void 0}function Ao(e,t,r,n){var i=e.history;i.undone.length=0;var o,a,l=+new Date;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&i.lastModTime>l-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=Oo(i,i.lastOp==n)))a=ee(o.changes),0==dt(t.from,t.to)&&0==dt(t.from,a.to)?a.to=po(t):o.changes.push(To(e,t));else{var s=ee(i.done);for(s&&s.ranges||Fo(e.sel,i.done),o={changes:[To(e,t)],generation:i.generation},i.done.push(o);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=l,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,a||_e(e,"historyAdded")}function Do(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 zo(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||Do(e,o,ee(i.done),t))?i.done[i.done.length-1]=t:Fo(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=r,n&&!1!==n.clearRedo&&No(i.undone)}function Fo(e,t){var r=ee(t);r&&r.ranges&&r.equals(e)||t.push(e)}function Eo(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 Wo(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 Io(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=[],i=0;i<t.text.length;++i)n.push(Wo(r[i]));return n}function Ho(e,t){var r=Io(e,t),n=Vt(e,t);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var o=r[i],a=n[i];if(o&&a)e:for(var l=0;l<a.length;++l){for(var s=a[l],c=0;c<o.length;++c)if(o[c].marker==s.marker)continue e;o.push(s)}else a&&(r[i]=a)}return r}function Po(e,t,r){for(var n=[],i=0;i<e.length;++i){var o=e[i];if(o.ranges)n.push(r?co.prototype.deepCopy.call(o):o);else{var a=o.changes,l=[];n.push({changes:l});for(var s=0;s<a.length;++s){var c=a[s],u=void 0;if(l.push({from:c.from,to:c.to,text:c.text}),t)for(var d in c)(u=d.match(/^spans_(\d+)$/))&&U(t,Number(u[1]))>-1&&(ee(l)[d]=c[d],delete c[d])}}}return n}function Ro(e,t,r,n){if(n){var i=e.anchor;if(r){var o=dt(t,i)<0;o!=dt(r,i)<0?(i=t,t=r):o!=dt(t,r)<0&&(t=r)}return new uo(i,t)}return new uo(r||t,t)}function qo(e,t,r,n,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),$o(e,new co([Ro(e.sel.primary(),t,r,i)],0),n)}function jo(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]=Ro(e.sel.ranges[o],t[o],null,i);$o(e,fo(e.cm,n,e.sel.primIndex),r)}function Bo(e,t,r,n){var i=e.sel.ranges.slice(0);i[t]=r,$o(e,fo(e.cm,i,e.sel.primIndex),n)}function Vo(e,t,r,n){$o(e,ho(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 uo(vt(e,t[r].anchor),vt(e,t[r].head))},origin:r&&r.origin};return _e(e,"beforeSelectionChange",e,n),e.cm&&_e(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?fo(e.cm,n.ranges,n.ranges.length-1):t}function Go(e,t,r){var n=e.history.done,i=ee(n);i&&i.ranges?(n[n.length-1]=t,Ko(e,t,r)):$o(e,t,r)}function $o(e,t,r){Ko(e,t,r),zo(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function Ko(e,t,r){(Se(e,"beforeSelectionChange")||e.cm&&Se(e.cm,"beforeSelectionChange"))&&(t=Uo(e,t,r));var n=r&&r.bias||(dt(t.primary().head,e.sel.primary().head)<0?-1:1);Xo(e,Yo(e,t,n,!0)),r&&!1===r.scroll||!e.cm||"nocursor"==e.cm.getOption("readOnly")||fi(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)),zr(e,"cursorActivity",e))}function Qo(e){Xo(e,Yo(e,e.sel,null,!1))}function Yo(e,t,r,n){for(var i,o=0;o<t.ranges.length;o++){var a=t.ranges[o],l=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],s=Jo(e,a.anchor,l&&l.anchor,r,n),c=a.head==a.anchor?s:Jo(e,a.head,l&&l.head,r,n);(i||s!=a.anchor||c!=a.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new uo(s,c))}return i?fo(e.cm,i,t.primIndex):t}function Zo(e,t,r,n,i){var o=rt(e,t.line);if(o.markedSpans)for(var a=0;a<o.markedSpans.length;++a){var l=o.markedSpans[a],s=l.marker,c="selectLeft"in s?!s.selectLeft:s.inclusiveLeft,u="selectRight"in s?!s.selectRight:s.inclusiveRight;if((null==l.from||(c?l.from<=t.ch:l.from<t.ch))&&(null==l.to||(u?l.to>=t.ch:l.to>t.ch))){if(i&&(_e(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!s.atomic)continue;if(r){var d=s.find(n<0?1:-1),f=void 0;if((n<0?u:c)&&(d=ea(e,d,-n,d&&d.line==t.line?o:null)),d&&d.line==t.line&&(f=dt(d,r))&&(n<0?f<0:f>0))return Zo(e,d,t,n,i)}var h=s.find(n<0?-1:1);return(n<0?c:u)&&(h=ea(e,h,n,h.line==t.line?o:null)),h?Zo(e,h,t,n,i):null}}return t}function Jo(e,t,r,n,i){var o=n||1,a=Zo(e,t,r,o,i)||!i&&Zo(e,t,r,o,!0)||Zo(e,t,r,-o,i)||!i&&Zo(e,t,r,-o,!0);return a||(e.cantEdit=!0,ut(e.first,0))}function ea(e,t,r,n){return r<0&&0==t.ch?t.line>e.first?vt(e,ut(t.line-1)):null:r>0&&t.ch==(n||rt(e,t.line)).text.length?t.line<e.first+e.size-1?ut(t.line+1,0):null:new ut(t.line,t.ch+r)}function ta(e){e.setSelection(ut(e.firstLine(),0),ut(e.lastLine()),K)}function ra(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=vt(e,t)),r&&(n.to=vt(e,r)),i&&(n.text=i),void 0!==o&&(n.origin=o)}),_e(e,"beforeChange",e,n),e.cm&&_e(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 na(e,t,r){if(e.cm){if(!e.cm.curOp)return Ii(e.cm,na)(e,t,r);if(e.cm.state.suppressEdits)return}if(!(Se(e,"beforeChange")||e.cm&&Se(e.cm,"beforeChange"))||(t=ra(e,t,!0))){var n=Ft&&!r&&Gt(e,t.from,t.to);if(n)for(var i=n.length-1;i>=0;--i)ia(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text,origin:t.origin});else ia(e,t)}}function ia(e,t){if(1!=t.text.length||""!=t.text[0]||0!=dt(t.from,t.to)){var r=go(e,t);Ao(e,t,r,e.cm?e.cm.curOp.id:NaN),la(e,t,r,Vt(e,t));var n=[];ko(e,function(e,r){r||-1!=U(n,e.history)||(fa(e.history,t),n.push(e.history)),la(e,t,null,Vt(e,t))})}}function oa(e,t,r){var n=e.cm&&e.cm.state.suppressEdits;if(!n||r){for(var i,o=e.history,a=e.sel,l="undo"==t?o.done:o.undone,s="undo"==t?o.undone:o.done,c=0;c<l.length&&(i=l[c],r?!i.ranges||i.equals(e.sel):i.ranges);c++);if(c!=l.length){for(o.lastOrigin=o.lastSelOrigin=null;;){if(!(i=l.pop()).ranges){if(n)return void l.push(i);break}if(Fo(i,s),r&&!i.equals(e.sel))return void $o(e,i,{clearRedo:!1});a=i}var u=[];Fo(a,s),s.push({changes:u,generation:o.generation}),o.generation=i.generation||++o.maxGeneration;for(var d=Se(e,"beforeChange")||e.cm&&Se(e.cm,"beforeChange"),f=function(r){var n=i.changes[r];if(n.origin=t,d&&!ra(e,n,!1))return l.length=0,{};u.push(To(e,n));var o=r?go(e,n):ee(l);la(e,n,o,Ho(e,n)),!r&&e.cm&&e.cm.scrollIntoView({from:n.from,to:po(n)});var a=[];ko(e,function(e,t){t||-1!=U(a,e.history)||(fa(e.history,n),a.push(e.history)),la(e,n,null,Ho(e,n))})},h=i.changes.length-1;h>=0;--h){var p=f(h);if(p)return p.v}}}}function aa(e,t){if(0!=t&&(e.first+=t,e.sel=new co(te(e.sel.ranges,function(e){return new uo(ut(e.anchor.line+t,e.anchor.ch),ut(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){jn(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 la(e,t,r,n){if(e.cm&&!e.cm.curOp)return Ii(e.cm,la)(e,t,r,n);if(t.to.line<e.first)aa(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);aa(e,i),t={from:ut(e.first,0),to:ut(t.to.line+i,t.to.ch),text:[ee(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:ut(o,rt(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=nt(e,t.from,t.to),r||(r=go(e,t)),e.cm?sa(e.cm,t,n):_o(e,t,n),Ko(e,r,K),e.cantEdit&&Jo(e,ut(e.firstLine(),0))&&(e.cantEdit=!1)}}function sa(e,t,r){var n=e.doc,i=e.display,o=t.from,a=t.to,l=!1,s=o.line;e.options.lineWrapping||(s=at(nr(rt(n,o.line))),n.iter(s,a.line+1,function(e){if(e==i.maxLine)return l=!0,!0})),n.sel.contains(t.from,t.to)>-1&&Ce(e),_o(n,t,r,Hn(e)),e.options.lineWrapping||(n.iter(s,o.line+t.text.length,function(e){var t=dr(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,l=!1)}),l&&(e.curOp.updateMaxLine=!0)),zt(n,o.line),Ri(e,400);var c=t.text.length-(a.line-o.line)-1;t.full?jn(e):o.line!=a.line||1!=t.text.length||wo(e.doc,t)?jn(e,o.line,a.line+1,c):Bn(e,o.line,"text");var u=Se(e,"changes"),d=Se(e,"change");if(d||u){var f={from:o,to:a,text:t.text,removed:t.removed,origin:t.origin};d&&zr(e,"change",e,f),u&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(f)}e.display.selForContextMenu=null}function ca(e,t,r,n,i){var o;n||(n=r),dt(n,r)<0&&(r=(o=[n,r])[0],n=o[1]),"string"==typeof t&&(t=e.splitLines(t)),na(e,{from:r,to:n,text:t,origin:i})}function ua(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function da(e,t,r,n){for(var i=0;i<e.length;++i){var o=e[i],a=!0;if(o.ranges){o.copied||((o=e[i]=o.deepCopy()).copied=!0);for(var l=0;l<o.ranges.length;l++)ua(o.ranges[l].anchor,t,r,n),ua(o.ranges[l].head,t,r,n)}else{for(var s=0;s<o.changes.length;++s){var c=o.changes[s];if(r<c.from.line)c.from=ut(c.from.line+n,c.from.ch),c.to=ut(c.to.line+n,c.to.ch);else if(t<=c.to.line){a=!1;break}}a||(e.splice(0,i+1),i=0)}}}function fa(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;da(e.done,r,n,i),da(e.undone,r,n,i)}function ha(e,t,r,n){var i=t,o=t;return"number"==typeof t?o=rt(e,gt(e,t)):i=at(t),null==i?null:(n(o,i)&&e.cm&&Bn(e.cm,i,r),o)}function pa(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 ma(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}uo.prototype.from=function(){return mt(this.anchor,this.head)},uo.prototype.to=function(){return pt(this.anchor,this.head)},uo.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},pa.prototype={chunkSize:function(){return this.lines.length},
// Remove the n lines at offset 'at'.
removeInner:function(e,t){for(var r=e,n=e+t;r<n;++r){var i=this.lines[r];this.height-=i.height,mr(i),zr(i,"delete")}this.lines.splice(e,t)},
// Helper used to collapse a small branch into a single leaf.
collapse:function(e){e.push.apply(e,this.lines)},
// Insert the given array of lines at offset 'at', count them as
// having the given height.
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},
// Used to iterate over a part of the tree.
iterN:function(e,t,r){for(var n=e+t;e<n;++e)if(r(this.lines[e]))return!0}},ma.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),a=n.height;if(n.removeInner(e,o),this.height-=a-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 pa))){var l=[];this.collapse(l),this.children=[new pa(l)],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 a=i.lines.length%25+25,l=a;l<i.lines.length;){var s=new pa(i.lines.slice(l,l+=25));i.height-=s.height,this.children.splice(++n,0,s),s.parent=this}i.lines=i.lines.slice(0,a),this.maybeSpill()}break}e-=o}},
// When a node has grown, check whether it should be split.
maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=new ma(e.children.splice(e.children.length-5,5));if(e.parent){e.size-=t.size,e.height-=t.height;var r=U(e.parent.children,e);e.parent.children.splice(r+1,0,t)}else{var n=new ma(e.children);n.parent=e,e.children=[n,t],e=n}t.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 a=Math.min(t,o-e);if(i.iterN(e,a,r))return!0;if(0==(t-=a))break;e=0}else e-=o}}};var ga=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 va(e,t,r){ur(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&di(e,r)}function ya(e,t,r,n){var i=new ga(e,r,n),o=e.cm;return o&&i.noHScroll&&(o.display.alignWidgets=!0),ha(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&&!sr(e,t)){var n=ur(t)<e.scrollTop;ot(t,t.height+$r(i)),n&&di(o,i.height),o.curOp.forceUpdate=!0}return!0}),o&&zr(o,"lineWidgetAdded",o,i,"number"==typeof t?t:at(t)),i}ga.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,n=at(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=$r(this);ot(r,Math.max(0,r.height-o)),e&&(Wi(e,function(){va(e,r,-o),Bn(e,n,"widget")}),zr(e,"lineWidgetCleared",e,this,n))}},ga.prototype.changed=function(){var e=this,t=this.height,r=this.doc.cm,n=this.line;this.height=null;var i=$r(this)-t;i&&(sr(this.doc,n)||ot(n,n.height+i),r&&Wi(r,function(){r.curOp.forceUpdate=!0,va(r,n,i),zr(r,"lineWidgetChanged",r,e,at(n))}))},Le(ga);var ba=0,xa=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ba};function wa(e,t,r,n,i){if(n&&n.shared)return ka(e,t,r,n,i);if(e.cm&&!e.cm.curOp)return Ii(e.cm,wa)(e,t,r,n,i);var o=new xa(e,i),a=dt(t,r);if(n&&j(n,o,!1),a>0||0==a&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=A("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(rr(e,t.line,t,r,o)||t.line!=r.line&&rr(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");It()}o.addToHistory&&Ao(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var l,s=t.line,c=e.cm;if(e.iter(s,r.line+1,function(n){c&&o.collapsed&&!c.options.lineWrapping&&nr(n)==c.display.maxLine&&(l=!0),o.collapsed&&s!=t.line&&ot(n,0),qt(n,new Ht(o,s==t.line?t.ch:null,s==r.line?r.ch:null),e.cm&&e.cm.curOp),++s}),o.collapsed&&e.iter(t.line,r.line+1,function(t){sr(e,t)&&ot(t,0)}),o.clearOnEnter&&be(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(Wt(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++ba,o.atomic=!0),c){if(l&&(c.curOp.updateMaxLine=!0),o.collapsed)jn(c,t.line,r.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var u=t.line;u<=r.line;u++)Bn(c,u,"text");o.atomic&&Qo(c.doc),zr(c,"markerAdded",c,o)}return o}xa.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Ti(e),Se(this,"clear")){var r=this.find();r&&zr(this,"clear",r.from,r.to)}for(var n=null,i=null,o=0;o<this.lines.length;++o){var a=this.lines[o],l=Pt(a.markedSpans,this);e&&!this.collapsed?Bn(e,at(a),"text"):e&&(null!=l.to&&(i=at(a)),null!=l.from&&(n=at(a))),a.markedSpans=Rt(a.markedSpans,l),null==l.from&&this.collapsed&&!sr(this.doc,a)&&e&&ot(a,Fn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var s=0;s<this.lines.length;++s){var c=nr(this.lines[s]),u=dr(c);u>e.display.maxLineLength&&(e.display.maxLine=c,e.display.maxLineLength=u,e.display.maxLineChanged=!0)}null!=n&&e&&this.collapsed&&jn(e,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Qo(e.doc)),e&&zr(e,"markerCleared",e,this,n,i),t&&Ni(e),this.parent&&this.parent.clear()}},xa.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],a=Pt(o.markedSpans,this);if(null!=a.from&&(r=ut(t?o:at(o),a.from),-1==e))return r;if(null!=a.to&&(n=ut(t?o:at(o),a.to),1==e))return n}return r&&{from:r,to:n}},xa.prototype.changed=function(){var e=this,t=this.find(-1,!0),r=this,n=this.doc.cm;t&&n&&Wi(n,function(){var i=t.line,o=at(t.line),a=an(n,o);if(a&&(mn(a),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!sr(r.doc,i)&&null!=r.height){var l=r.height;r.height=null;var s=$r(r)-l;s&&ot(i,i.height+s)}zr(n,"markerChanged",n,e)})},xa.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=U(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},xa.prototype.detachLine=function(e){if(this.lines.splice(U(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},Le(xa);var _a=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};function ka(e,t,r,n,i){(n=j(n)).shared=!1;var o=[wa(e,t,r,n,i)],a=o[0],l=n.widgetNode;return ko(e,function(e){l&&(n.widgetNode=l.cloneNode(!0)),o.push(wa(e,vt(e,t),vt(e,r),n,i));for(var s=0;s<e.linked.length;++s)if(e.linked[s].isParent)return;a=ee(o)}),new _a(o,a)}function Ca(e){return e.findMarks(ut(e.first,0),e.clipPos(ut(e.lastLine())),function(e){return e.parent})}function Sa(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.find(),o=e.clipPos(i.from),a=e.clipPos(i.to);if(dt(o,a)){var l=wa(e,o,a,n.primary,n.primary.type);n.markers.push(l),l.parent=n}}}function La(e){for(var t=function(t){var r=e[t],n=[r.primary.doc];ko(r.primary.doc,function(e){return n.push(e)});for(var i=0;i<r.markers.length;i++){var o=r.markers[i];-1==U(n,o.doc)&&(o.parent=null,r.markers.splice(i--,1))}},r=0;r<e.length;r++)t(r)}_a.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();zr(this,"clear")}},_a.prototype.find=function(e,t){return this.primary.find(e,t)},Le(_a);var Ma=0,Ta=function(e,t,r,n,i){if(!(this instanceof Ta))return new Ta(e,t,r,n,i);null==r&&(r=0),ma.call(this,[new pa([new hr("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=r;var o=ut(r,0);this.sel=ho(o),this.history=new Mo(null),this.id=++Ma,this.modeOption=t,this.lineSep=n,this.direction="rtl"==i?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),_o(this,{from:o,to:o,text:e}),$o(this,ho(o),K)};Ta.prototype=ie(ma.prototype,{constructor:Ta,
// Iterate over the document. Supports two forms -- with only one
// argument, it calls that for each line in the document. With
// three, it iterates over the range given by the first two (with
// the second being non-inclusive).
iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},
// Non-public interface for adding and removing lines.
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)},
// From here, the methods are part of the public interface. Most
// are also available from CodeMirror (editor) instances.
getValue:function(e){var t=it(this,this.first,this.first+this.size);return!1===e?t:t.join(e||this.lineSeparator())},setValue:Pi(function(e){var t=ut(this.first,0),r=this.first+this.size-1;na(this,{from:t,to:ut(r,rt(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&hi(this.cm,0,0),$o(this,ho(t),K)}),replaceRange:function(e,t,r,n){ca(this,e,t=vt(this,t),r=r?vt(this,r):t,n)},getRange:function(e,t,r){var n=nt(this,vt(this,e),vt(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(st(this,e))return rt(this,e)},getLineNumber:function(e){return at(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=rt(this,e)),nr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return vt(this,e)},getCursor:function(e){var t=this.sel.primary();return null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||"to"==e||!1===e?t.to():t.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Pi(function(e,t,r){Vo(this,vt(this,"number"==typeof e?ut(e,t||0):e),null,r)}),setSelection:Pi(function(e,t,r){Vo(this,vt(this,e),vt(this,t||e),r)}),extendSelection:Pi(function(e,t,r){qo(this,vt(this,e),t&&vt(this,t),r)}),extendSelections:Pi(function(e,t){jo(this,bt(this,e),t)}),extendSelectionsBy:Pi(function(e,t){jo(this,bt(this,te(this.sel.ranges,e)),t)}),setSelections:Pi(function(e,t,r){if(e.length){for(var n=[],i=0;i<e.length;i++)n[i]=new uo(vt(this,e[i].anchor),vt(this,e[i].head||e[i].anchor));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),$o(this,fo(this.cm,n,t),r)}}),addSelection:Pi(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new uo(vt(this,e),vt(this,t||e))),$o(this,fo(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=nt(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=nt(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:Pi(function(e,t,r){for(var n=[],i=this.sel,o=0;o<i.ranges.length;o++){var a=i.ranges[o];n[o]={from:a.from(),to:a.to(),text:this.splitLines(e[o]),origin:r}}for(var l=t&&"end"!=t&&yo(this,n,t),s=n.length-1;s>=0;s--)na(this,n[s]);l?Go(this,l):this.cm&&fi(this.cm)}),undo:Pi(function(){oa(this,"undo")}),redo:Pi(function(){oa(this,"redo")}),undoSelection:Pi(function(){oa(this,"undo",!0)}),redoSelection:Pi(function(){oa(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 Mo(this.history),ko(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:Po(this.history.done),undone:Po(this.history.undone)}},setHistory:function(e){var t=this.history=new Mo(this.history);t.done=Po(e.done.slice(0),null,!0),t.undone=Po(e.undone.slice(0),null,!0)},setGutterMarker:Pi(function(e,t,r){return ha(this,e,"gutter",function(e){var n=e.gutterMarkers||(e.gutterMarkers={});return n[t]=r,!r&&se(n)&&(e.gutterMarkers=null),!0})}),clearGutter:Pi(function(e){var t=this;this.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&ha(t,r,"gutter",function(){return r.gutterMarkers[e]=null,se(r.gutterMarkers)&&(r.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if("number"==typeof e){if(!st(this,e))return null;if(t=e,!(e=rt(this,e)))return null}else if(null==(t=at(e)))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:Pi(function(e,t,r){return ha(this,e,"gutter"==t?"gutter":"class",function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(e[n]){if(S(r).test(e[n]))return!1;e[n]+=" "+r}else e[n]=r;return!0})}),removeLineClass:Pi(function(e,t,r){return ha(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(S(r));if(!o)return!1;var a=o.index+o[0].length;e[n]=i.slice(0,o.index)+(o.index&&a!=i.length?" ":"")+i.slice(a)||null}return!0})}),addLineWidget:Pi(function(e,t,r){return ya(this,e,t,r)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return wa(this,vt(this,e),vt(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 wa(this,e=vt(this,e),e,r,"bookmark")},findMarksAt:function(e){var t=[],r=rt(this,(e=vt(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=vt(this,e),t=vt(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var a=o.markedSpans;if(a)for(var l=0;l<a.length;l++){var s=a[l];null!=s.to&&i==e.line&&e.ch>=s.to||null==s.from&&i!=e.line||null!=s.from&&i==t.line&&s.from>=t.ch||r&&!r(s.marker)||n.push(s.marker.parent||s.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}),vt(this,ut(r,t))},indexFromPos:function(e){var t=(e=vt(this,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 Ta(it(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 Ta(it(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}],Sa(n,Ca(this)),n},unlinkDoc:function(e){if(e instanceof jl&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t)if(this.linked[t].doc==e){this.linked.splice(t,1),e.unlinkDoc(this),La(Ca(this));break}if(e.history==this.history){var r=[e.id];ko(e,function(e){return r.push(e.id)},!0),e.history=new Mo(null),e.history.done=Po(this.history.done,r),e.history.undone=Po(this.history.undone,r)}},iterLinkedDocs:function(e){ko(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Pe(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:Pi(function(e){"rtl"!=e&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter(function(e){return e.order=null}),this.cm&&Lo(this.cm))})}),Ta.prototype.eachLine=Ta.prototype.iter;var Na=0;function Oa(e){var t=this;if(za(t),!ke(t,e)&&!Kr(t.display,e)){Me(e),a&&(Na=+new Date);var r=Rn(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),l=0,s=function(){++l==i&&Ii(t,function(){var e={from:r=vt(t.doc,r),to:r,text:t.doc.splitLines(o.filter(function(e){return null!=e}).join(t.doc.lineSeparator())),origin:"paste"};na(t.doc,e),Go(t.doc,ho(vt(t.doc,r),vt(t.doc,po(e))))})()},c=function(e,r){if(t.options.allowDropFileTypes&&-1==U(t.options.allowDropFileTypes,e.type))s();else{var n=new FileReader;n.onerror=function(){return s()},n.onload=function(){var e=n.result;/[\x00-\x08\x0e-\x1f]{2}/.test(e)||(o[r]=e),s()},n.readAsText(e)}},u=0;u<n.length;u++)c(n[u],u);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 d=e.dataTransfer.getData("Text");if(d){var f;if(t.state.draggingText&&!t.state.draggingText.copy&&(f=t.listSelections()),Ko(t.doc,ho(r,r)),f)for(var h=0;h<f.length;++h)ca(t.doc,"",f[h].anchor,f[h].head,"drag");t.replaceSelection(d,"around","paste"),t.display.input.focus()}}catch(p){}}}}function Aa(e,t){if(a&&(!e.state.draggingText||+new Date-Na<100))Oe(t);else if(!ke(e,t)&&!Kr(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!h)){var r=O("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 Da(e,t){var r=Rn(e,t);if(r){var n=document.createDocumentFragment();Qn(e,r,n),e.display.dragCursor||(e.display.dragCursor=O("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),N(e.display.dragCursor,n)}}function za(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function Fa(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 Ea=!1;function Wa(){Ea||(Ia(),Ea=!0)}function Ia(){var e;be(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,Fa(Ha)},100))}),be(window,"blur",function(){return Fa(ni)})}function Ha(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Pa={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"},Ra=0;Ra<10;Ra++)Pa[Ra+48]=Pa[Ra+96]=String(Ra);for(var qa=65;qa<=90;qa++)Pa[qa]=String.fromCharCode(qa);for(var ja=1;ja<=12;ja++)Pa[ja+111]=Pa[ja+63235]="F"+ja;var Ba={};function Va(e){var t,r,n,i,o=e.split(/-(?!$)/);e=o[o.length-1];for(var a=0;a<o.length-1;a++){var l=o[a];if(/^(cmd|meta|m)$/i.test(l))i=!0;else if(/^a(lt)?$/i.test(l))t=!0;else if(/^(c|ctrl|control)$/i.test(l))r=!0;else{if(!/^s(hift)?$/i.test(l))throw new Error("Unrecognized modifier name: "+l);n=!0}}return t&&(e="Alt-"+e),r&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function Ua(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=te(r.split(" "),Va),o=0;o<i.length;o++){var a=void 0,l=void 0;o==i.length-1?(l=i.join(" "),a=n):(l=i.slice(0,o+1).join(" "),a="...");var s=t[l];if(s){if(s!=a)throw new Error("Inconsistent bindings for "+l)}else t[l]=a}delete e[r]}for(var c in t)e[c]=t[c];return e}function Ga(e,t,r,n){var i=(t=Qa(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 Ga(e,t.fallthrough,r,n);for(var o=0;o<t.fallthrough.length;o++){var a=Ga(e,t.fallthrough[o],r,n);if(a)return a}}}function $a(e){var t="string"==typeof e?e:Pa[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function Ka(e,t,r){var n=e;return t.altKey&&"Alt"!=n&&(e="Alt-"+e),(k?t.metaKey:t.ctrlKey)&&"Ctrl"!=n&&(e="Ctrl-"+e),(k?t.ctrlKey:t.metaKey)&&"Mod"!=n&&(e="Cmd-"+e),!r&&t.shiftKey&&"Shift"!=n&&(e="Shift-"+e),e}function Xa(e,t){if(f&&34==e.keyCode&&e.char)return!1;var r=Pa[e.keyCode];return null!=r&&!e.altGraphKey&&(3==e.keyCode&&e.code&&(r=e.code),Ka(r,e,t))}function Qa(e){return"string"==typeof e?Ba[e]:e}function Ya(e,t){for(var r=e.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var o=t(r[i]);n.length&&dt(o.from,ee(n).to)<=0;){var a=n.pop();if(dt(a.from,o.from)<0){o.from=a.from;break}}n.push(o)}Wi(e,function(){for(var t=n.length-1;t>=0;t--)ca(e.doc,"",n[t].from,n[t].to,"+delete");fi(e)})}function Za(e,t,r){var n=de(e.text,t+r,r);return n<0||n>e.text.length?null:n}function Ja(e,t,r){var n=Za(e,t.ch,r);return null==n?null:new ut(t.line,n,r<0?"after":"before")}function el(e,t,r,n,i){if(e){"rtl"==t.doc.direction&&(i=-i);var o=ve(r,t.doc.direction);if(o){var a,l=i<0?ee(o):o[0],s=i<0==(1==l.level)?"after":"before";if(l.level>0||"rtl"==t.doc.direction){var c=ln(t,r);a=i<0?r.text.length-1:0;var u=sn(t,c,a).top;a=fe(function(e){return sn(t,c,e).top==u},i<0==(1==l.level)?l.from:l.to-1,a),"before"==s&&(a=Za(r,a,1))}else a=i<0?l.to:l.from;return new ut(n,a,s)}}return new ut(n,i<0?r.text.length:0,i<0?"before":"after")}function tl(e,t,r,n){var i=ve(t,e.doc.direction);if(!i)return Ja(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=me(i,r.ch,r.sticky),a=i[o];if("ltr"==e.doc.direction&&a.level%2==0&&(n>0?a.to>r.ch:a.from<r.ch))return Ja(t,r,n);var l,s=function(e,r){return Za(t,e instanceof ut?e.ch:e,r)},c=function(r){return e.options.lineWrapping?(l=l||ln(e,t),Nn(e,t,l,r)):{begin:0,end:t.text.length}},u=c("before"==r.sticky?s(r,-1):r.ch);if("rtl"==e.doc.direction||1==a.level){var d=1==a.level==n<0,f=s(r,d?1:-1);if(null!=f&&(d?f<=a.to&&f<=u.end:f>=a.from&&f>=u.begin)){var h=d?"before":"after";return new ut(r.line,f,h)}}var p=function(e,t,n){for(var o=function(e,t){return t?new ut(r.line,s(e,1),"before"):new ut(r.line,e,"after")};e>=0&&e<i.length;e+=t){var a=i[e],l=t>0==(1!=a.level),c=l?n.begin:s(n.end,-1);if(a.from<=c&&c<a.to)return o(c,l);if(c=l?a.from:s(a.to,-1),n.begin<=c&&c<n.end)return o(c,l)}},m=p(o+n,n,u);if(m)return m;var g=n>0?u.end:s(u.begin,-1);return null==g||n>0&&g==t.text.length||!(m=p(n>0?0:i.length-1,n,c(g)))?null:m}Ba.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"},Ba.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"},Ba.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"},Ba.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"]},Ba.default=b?Ba.macDefault:Ba.pcDefault;var rl={selectAll:ta,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),K)},killLine:function(e){return Ya(e,function(t){if(t.empty()){var r=rt(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:ut(t.head.line+1,0)}:{from:t.head,to:ut(t.head.line,r)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Ya(e,function(t){return{from:ut(t.from().line,0),to:vt(e.doc,ut(t.to().line+1,0))}})},delLineLeft:function(e){return Ya(e,function(e){return{from:ut(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(e){return Ya(e,function(t){var r=e.charCoords(t.head,"div").top+5;return{from:e.coordsChar({left:0,top:r},"div"),to:t.from()}})},delWrappedLineRight:function(e){return Ya(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(ut(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(ut(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return nl(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return ol(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return il(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")},Q)},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")},Q)},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/)?ol(e,t.head):n},Q)},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(),a=B(e.getLine(o.line),o.ch,n);t.push(J(n-a%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},
// Swap the two chars left and right of each selection's head.
// Move cursor behind the two swapped characters afterwards.
// Doesn't consider line feeds a character.
// Doesn't scan more than one line above to find a character.
// Doesn't do anything on an empty line.
// Doesn't do anything with non-empty selections.
transposeChars:function(e){return Wi(e,function(){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++)if(t[n].empty()){var i=t[n].head,o=rt(e.doc,i.line).text;if(o)if(i.ch==o.length&&(i=new ut(i.line,i.ch-1)),i.ch>0)i=new ut(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),ut(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=rt(e.doc,i.line-1).text;a&&(i=new ut(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),ut(i.line-1,a.length-1),i,"+transpose"))}r.push(new uo(i,i))}e.setSelections(r)})},newlineAndIndent:function(e){return Wi(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);fi(e)})},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function nl(e,t){var r=rt(e.doc,t),n=nr(r);return n!=r&&(t=at(n)),el(!0,e,n,t,1)}function il(e,t){var r=rt(e.doc,t),n=ir(r);return n!=r&&(t=at(n)),el(!0,e,r,t,-1)}function ol(e,t){var r=nl(e,t.line),n=rt(e.doc,r.line),i=ve(n,e.doc.direction);if(!i||0==i[0].level){var o=Math.max(r.ch,n.text.search(/\S/)),a=t.line==r.line&&t.ch<=o&&t.ch;return ut(r.line,a?0:o,r.sticky)}return r}function al(e,t,r){if("string"==typeof t&&!(t=rl[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)!=$}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}function ll(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var i=Ga(t,e.state.keyMaps[n],r,e);if(i)return i}return e.options.extraKeys&&Ga(t,e.options.extraKeys,r,e)||Ga(t,e.options.keyMap,r,e)}var sl=new V;function cl(e,t,r,n){var i=e.state.keySeq;if(i){if($a(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:sl.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),ul(e,i+" "+t,r,n))return!0}return ul(e,t,r,n)}function ul(e,t,r,n){var i=ll(e,t,n);return"multi"==i&&(e.state.keySeq=t),"handled"==i&&zr(e,"keyHandled",e,t,r),"handled"!=i&&"multi"!=i||(Me(r),Jn(e)),!!i}function dl(e,t){var r=Xa(t,!0);return!!r&&(t.shiftKey&&!e.state.keySeq?cl(e,"Shift-"+r,t,function(t){return al(e,t,!0)})||cl(e,r,t,function(t){if("string"==typeof t?/^go[A-Z]/.test(t):t.motion)return al(e,t)}):cl(e,r,t,function(t){return al(e,t)}))}function fl(e,t,r){return cl(e,"'"+r+"'",t,function(t){return al(e,t,!0)})}var hl=null;function pl(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField()||(t.curOp.focus=z(H(t)),ke(t,e)))){a&&l<11&&27==e.keyCode&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=16==n||e.shiftKey;var i=dl(t,e);f&&(hl=i?n:null,i||88!=n||qe||!(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)||ml(t)}}function ml(e){var t=e.display.lineDiv;function r(e){18!=e.keyCode&&e.altKey||(M(t,"CodeMirror-crosshair"),we(document,"keyup",r),we(document,"mouseover",r))}F(t,"CodeMirror-crosshair"),be(document,"keyup",r),be(document,"mouseover",r)}function gl(e){16==e.keyCode&&(this.doc.sel.shift=!1),ke(this,e)}function vl(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField()||Kr(t.display,e)||ke(t,e)||e.ctrlKey&&!e.altKey||b&&e.metaKey)){var r=e.keyCode,n=e.charCode;if(f&&r==hl)return hl=null,void Me(e);if(!f||e.which&&!(e.which<10)||!dl(t,e)){var i=String.fromCharCode(null==n?r:n);"\b"!=i&&(fl(t,e,i)||t.display.input.onKeyPress(e))}}}var yl,bl,xl=400,wl=function(e,t,r){this.time=e,this.pos=t,this.button=r};function _l(e,t){var r=+new Date;return bl&&bl.compare(r,e,t)?(yl=bl=null,"triple"):yl&&yl.compare(r,e,t)?(bl=new wl(r,e,t),yl=null,"double"):(yl=new wl(r,e,t),bl=null,"single")}function kl(e){var t=this,r=t.display;if(!(ke(t,e)||r.activeTouch&&r.input.supportsTouch()))if(r.input.ensurePolled(),r.shift=e.shiftKey,Kr(r,e))s||(r.scroller.draggable=!1,setTimeout(function(){return r.scroller.draggable=!0},100));else if(!Dl(t,e)){var n=Rn(t,e),i=De(e),o=n?_l(n,i):"single";R(t).focus(),1==i&&t.state.selectingText&&t.state.selectingText(e),n&&Cl(t,i,n,o,e)||(1==i?n?Ll(t,n,o,e):Ae(e)==r.scroller&&Me(e):2==i?(n&&qo(t.doc,n),setTimeout(function(){return r.input.focus()},20)):3==i&&(C?t.display.input.onContextMenu(e):ti(t)))}}function Cl(e,t,r,n,i){var o="Click";return"double"==n?o="Double"+o:"triple"==n&&(o="Triple"+o),cl(e,Ka(o=(1==t?"Left":2==t?"Middle":"Right")+o,i),i,function(t){if("string"==typeof t&&(t=rl[t]),!t)return!1;var n=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n=t(e,r)!=$}finally{e.state.suppressEdits=!1}return n})}function Sl(e,t,r){var n=e.getOption("configureMouse"),i=n?n(e,t,r):{};if(null==i.unit){var o=x?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 Ll(e,t,r,n){a?setTimeout(q(ei,e),0):e.curOp.focus=z(H(e));var i,o=Sl(e,r,n),l=e.doc.sel;e.options.dragDrop&&Ee&&!e.isReadOnly()&&"single"==r&&(i=l.contains(t))>-1&&(dt((i=l.ranges[i]).from(),t)<0||t.xRel>0)&&(dt(i.to(),t)>0||t.xRel<0)?Ml(e,n,t,o):Nl(e,n,t,o)}function Ml(e,t,r,n){var i=e.display,o=!1,c=Ii(e,function(t){s&&(i.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:ti(e)),we(i.wrapper.ownerDocument,"mouseup",c),we(i.wrapper.ownerDocument,"mousemove",u),we(i.scroller,"dragstart",d),we(i.scroller,"drop",c),o||(Me(t),n.addNew||qo(e.doc,r,null,null,n.extend),s&&!h||a&&9==l?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),u=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},d=function(){return o=!0};s&&(i.scroller.draggable=!0),e.state.draggingText=c,c.copy=!n.moveOnDrag,be(i.wrapper.ownerDocument,"mouseup",c),be(i.wrapper.ownerDocument,"mousemove",u),be(i.scroller,"dragstart",d),be(i.scroller,"drop",c),e.state.delayingBlurEvent=!0,setTimeout(function(){return i.input.focus()},20),i.scroller.dragDrop&&i.scroller.dragDrop()}function Tl(e,t,r){if("char"==r)return new uo(t,t);if("word"==r)return e.findWordAt(t);if("line"==r)return new uo(ut(t.line,0),vt(e.doc,ut(t.line+1,0)));var n=r(e,t);return new uo(n.from,n.to)}function Nl(e,t,r,n){a&&ti(e);var i=e.display,o=e.doc;Me(t);var l,s,c=o.sel,u=c.ranges;if(n.addNew&&!n.extend?(s=o.sel.contains(r),l=s>-1?u[s]:new uo(r,r)):(l=o.sel.primary(),s=o.sel.primIndex),"rectangle"==n.unit)n.addNew||(l=new uo(r,r)),r=Rn(e,t,!0,!0),s=-1;else{var d=Tl(e,r,n.unit);l=n.extend?Ro(l,d.anchor,d.head,n.extend):d}n.addNew?-1==s?(s=u.length,$o(o,fo(e,u.concat([l]),s),{scroll:!1,origin:"*mouse"})):u.length>1&&u[s].empty()&&"char"==n.unit&&!n.extend?($o(o,fo(e,u.slice(0,s).concat(u.slice(s+1)),0),{scroll:!1,origin:"*mouse"}),c=o.sel):Bo(o,s,l,X):(s=0,$o(o,new co([l],0),X),c=o.sel);var f=r;function h(t){if(0!=dt(f,t))if(f=t,"rectangle"==n.unit){for(var i=[],a=e.options.tabSize,u=B(rt(o,r.line).text,r.ch,a),d=B(rt(o,t.line).text,t.ch,a),h=Math.min(u,d),p=Math.max(u,d),m=Math.min(r.line,t.line),g=Math.min(e.lastLine(),Math.max(r.line,t.line));m<=g;m++){var v=rt(o,m).text,y=Y(v,h,a);h==p?i.push(new uo(ut(m,y),ut(m,y))):v.length>y&&i.push(new uo(ut(m,y),ut(m,Y(v,p,a))))}i.length||i.push(new uo(r,r)),$o(o,fo(e,c.ranges.slice(0,s).concat(i),s),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b,x=l,w=Tl(e,t,n.unit),_=x.anchor;dt(w.anchor,_)>0?(b=w.head,_=mt(x.from(),w.anchor)):(b=w.anchor,_=pt(x.to(),w.head));var k=c.ranges.slice(0);k[s]=Ol(e,new uo(vt(o,_),b)),$o(o,fo(e,k,s),X)}}var p=i.wrapper.getBoundingClientRect(),m=0;function g(t){var r=++m,a=Rn(e,t,!0,"rectangle"==n.unit);if(a)if(0!=dt(a,f)){e.curOp.focus=z(H(e)),h(a);var l=ai(i,o);(a.line>=l.to||a.line<l.from)&&setTimeout(Ii(e,function(){m==r&&g(t)}),150)}else{var s=t.clientY<p.top?-20:t.clientY>p.bottom?20:0;s&&setTimeout(Ii(e,function(){m==r&&(i.scroller.scrollTop+=s,g(t))}),50)}}function v(t){e.state.selectingText=!1,m=Infinity,t&&(Me(t),i.input.focus()),we(i.wrapper.ownerDocument,"mousemove",y),we(i.wrapper.ownerDocument,"mouseup",b),o.history.lastSelOrigin=null}var y=Ii(e,function(e){0!==e.buttons&&De(e)?g(e):v(e)}),b=Ii(e,v);e.state.selectingText=b,be(i.wrapper.ownerDocument,"mousemove",y),be(i.wrapper.ownerDocument,"mouseup",b)}function Ol(e,t){var r=t.anchor,n=t.head,i=rt(e.doc,r.line);if(0==dt(r,n)&&r.sticky==n.sticky)return t;var o=ve(i);if(!o)return t;var a=me(o,r.ch,r.sticky),l=o[a];if(l.from!=r.ch&&l.to!=r.ch)return t;var s,c=a+(l.from==r.ch==(1!=l.level)?0:1);if(0==c||c==o.length)return t;if(n.line!=r.line)s=(n.line-r.line)*("ltr"==e.doc.direction?1:-1)>0;else{var u=me(o,n.ch,n.sticky),d=u-a||(n.ch-r.ch)*(1==l.level?-1:1);s=u==c-1||u==c?d<0:d>0}var f=o[c+(s?-1:0)],h=s==(1==f.level),p=h?f.from:f.to,m=h?"after":"before";return r.ch==p&&r.sticky==m?t:new uo(new ut(r.line,p,m),n)}function Al(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(u){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&Me(t);var a=e.display,l=a.lineDiv.getBoundingClientRect();if(o>l.bottom||!Se(e,r))return Ne(t);o-=l.top-a.viewOffset;for(var s=0;s<e.display.gutterSpecs.length;++s){var c=a.gutters.childNodes[s];if(c&&c.getBoundingClientRect().right>=i)return _e(e,r,e,lt(e.doc,o),e.display.gutterSpecs[s].className,t),Ne(t)}}function Dl(e,t){return Al(e,t,"gutterClick",!0)}function zl(e,t){Kr(e.display,t)||Fl(e,t)||ke(e,t,"contextmenu")||C||e.display.input.onContextMenu(t)}function Fl(e,t){return!!Se(e,"gutterContextMenu")&&Al(e,t,"gutterContextMenu",!1)}function El(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),vn(e)}wl.prototype.compare=function(e,t,r){return this.time+xl>e&&0==dt(t,this.pos)&&r==this.button};var Wl={toString:function(){return"CodeMirror.Init"}},Il={},Hl={};function Pl(e){var t=e.optionHandlers;function r(r,n,i,o){e.defaults[r]=n,i&&(t[r]=o?function(e,t,r){r!=Wl&&i(e,t,r)}:i)}e.defineOption=r,e.Init=Wl,r("value","",function(e,t){return e.setValue(t)},!0),r("mode",null,function(e,t){e.doc.modeOption=t,bo(e)},!0),r("indentUnit",2,bo,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,function(e){xo(e),vn(e),jn(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(ut(n,o))}n++});for(var i=r.length-1;i>=0;i--)ca(e.doc,t,r[i],ut(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!=Wl&&e.refresh()}),r("specialCharPlaceholder",xr,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",!w),r("wholeLineUpdateBefore",!0),r("theme","default",function(e){El(e),ro(e)},!0),r("keyMap","default",function(e,t,r){var n=Qa(t),i=r!=Wl&&Qa(r);i&&i.detach&&i.detach(e,n),n.attach&&n.attach(e,i||null)}),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,ql,!0),r("gutters",[],function(e,t){e.display.gutterSpecs=eo(t,e.options.lineNumbers),ro(e)},!0),r("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?In(e.display)+"px":"0",e.refresh()},!0),r("coverGutterNextToScrollbar",!1,function(e){return ki(e)},!0),r("scrollbarStyle","native",function(e){Li(e),ki(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=eo(e.options.gutters,t),ro(e)},!0),r("firstLineNumber",1,ro,!0),r("lineNumberFormatter",function(e){return e},ro,!0),r("showCursorWhenSelecting",!1,Kn,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,function(e,t){"nocursor"==t&&(ni(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,Rl),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,Kn,!0),r("singleCursorHeightPerLine",!0,Kn,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,xo,!0),r("addModeClass",!1,xo,!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,xo,!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 Rl(e,t,r){if(!t!=!(r&&r!=Wl)){var n=e.display.dragFunctions,i=t?be:we;i(e.display.scroller,"dragstart",n.start),i(e.display.scroller,"dragenter",n.enter),i(e.display.scroller,"dragover",n.over),i(e.display.scroller,"dragleave",n.leave),i(e.display.scroller,"drop",n.drop)}}function ql(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"),fr(e)),Pn(e),jn(e),vn(e),setTimeout(function(){return ki(e)},100)}function jl(e,t){var r=this;if(!(this instanceof jl))return new jl(e,t);this.options=t=t?j(t):{},j(Il,t,!1);var n=t.value;"string"==typeof n?n=new Ta(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var i=new jl.inputStyles[t.inputStyle](this),o=this.display=new no(e,n,i,t);for(var c in o.wrapper.CodeMirror=this,El(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Li(this),this.state={keyMaps:[],
// stores maps added by addKeyMap
overlays:[],
// highlighting overlays, as added by addOverlay
modeGen:0,
// bumped when mode/overlay changes, used to invalidate highlighting info
overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,
// used to disable editing during key handlers when in readOnly mode
pasteIncoming:-1,cutIncoming:-1,
// help recognize paste/cut edits in input.poll
selectingText:!1,draggingText:!1,highlight:new V,
// stores highlight worker timeout
keySeq:null,
// Unfinished key sequence
specialChars:null},t.autofocus&&!y&&o.input.focus(),a&&l<11&&setTimeout(function(){return r.display.input.reset(!0)},20),Bl(this),Wa(),Ti(this),this.curOp.forceUpdate=!0,Co(this,n),t.autofocus&&!y||this.hasFocus()?setTimeout(function(){r.hasFocus()&&!r.state.focused&&ri(r)},20):ni(this),Hl)Hl.hasOwnProperty(c)&&Hl[c](this,t[c],Wl);Ji(this),t.finishInit&&t.finishInit(this);for(var u=0;u<Vl.length;++u)Vl[u](this);Ni(this),s&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}function Bl(e){var t=e.display;be(t.scroller,"mousedown",Ii(e,kl)),be(t.scroller,"dblclick",a&&l<11?Ii(e,function(t){if(!ke(e,t)){var r=Rn(e,t);if(r&&!Dl(e,t)&&!Kr(e.display,t)){Me(t);var n=e.findWordAt(r);qo(e.doc,n.anchor,n.head)}}}):function(t){return ke(e,t)||Me(t)}),be(t.scroller,"contextmenu",function(t){return zl(e,t)}),be(t.input.getField(),"contextmenu",function(r){t.scroller.contains(r.target)||zl(e,r)});var r,n={end:0};function i(){t.activeTouch&&(r=setTimeout(function(){return t.activeTouch=null},1e3),(n=t.activeTouch).end=+new Date)}function o(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}function s(e,t){if(null==t.left)return!0;var r=t.left-e.left,n=t.top-e.top;return r*r+n*n>400}be(t.scroller,"touchstart",function(i){if(!ke(e,i)&&!o(i)&&!Dl(e,i)){t.input.ensurePolled(),clearTimeout(r);var a=+new Date;t.activeTouch={start:a,moved:!1,prev:a-n.end<=300?n:null},1==i.touches.length&&(t.activeTouch.left=i.touches[0].pageX,t.activeTouch.top=i.touches[0].pageY)}}),be(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),be(t.scroller,"touchend",function(r){var n=t.activeTouch;if(n&&!Kr(t,r)&&null!=n.left&&!n.moved&&new Date-n.start<300){var o,a=e.coordsChar(t.activeTouch,"page");o=!n.prev||s(n,n.prev)?new uo(a,a):!n.prev.prev||s(n,n.prev.prev)?e.findWordAt(a):new uo(ut(a.line,0),vt(e.doc,ut(a.line+1,0))),e.setSelection(o.anchor,o.head),e.focus(),Me(r)}i()}),be(t.scroller,"touchcancel",i),be(t.scroller,"scroll",function(){t.scroller.clientHeight&&(vi(e,t.scroller.scrollTop),bi(e,t.scroller.scrollLeft,!0),_e(e,"scroll",e))}),be(t.scroller,"mousewheel",function(t){return so(e,t)}),be(t.scroller,"DOMMouseScroll",function(t){return so(e,t)}),be(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(t){ke(e,t)||Oe(t)},over:function(t){ke(e,t)||(Da(e,t),Oe(t))},start:function(t){return Aa(e,t)},drop:Ii(e,Oa),leave:function(t){ke(e,t)||za(e)}};var c=t.input.getField();be(c,"keyup",function(t){return gl.call(e,t)}),be(c,"keydown",Ii(e,pl)),be(c,"keypress",Ii(e,vl)),be(c,"focus",function(t){return ri(e,t)}),be(c,"blur",function(t){return ni(e,t)})}jl.defaults=Il,jl.optionHandlers=Hl;var Vl=[];function Ul(e,t,r,n){var i,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=Ct(e,t).state:r="prev");var a=e.options.tabSize,l=rt(o,t),s=B(l.text,null,a);l.stateAfter&&(l.stateAfter=null);var c,u=l.text.match(/^\s*/)[0];if(n||/\S/.test(l.text)){if("smart"==r&&((c=o.mode.indent(i,l.text.slice(u.length),l.text))==$||c>150)){if(!n)return;r="prev"}}else c=0,r="not";"prev"==r?c=t>o.first?B(rt(o,t-1).text,null,a):0:"add"==r?c=s+e.options.indentUnit:"subtract"==r?c=s-e.options.indentUnit:"number"==typeof r&&(c=s+r),c=Math.max(0,c);var d="",f=0;if(e.options.indentWithTabs)for(var h=Math.floor(c/a);h;--h)f+=a,d+="\t";if(f<c&&(d+=J(c-f)),d!=u)return ca(o,d,ut(t,0),ut(t,u.length),"+input"),l.stateAfter=null,!0;for(var p=0;p<o.sel.ranges.length;p++){var m=o.sel.ranges[p];if(m.head.line==t&&m.head.ch<u.length){var g=ut(t,u.length);Bo(o,p,new uo(g,g));break}}}jl.defineInitHook=function(e){return Vl.push(e)};var Gl=null;function $l(e){Gl=e}function Kl(e,t,r,n,i){var o=e.doc;e.display.shift=!1,n||(n=o.sel);var a=+new Date-200,l="paste"==i||e.state.pasteIncoming>a,s=Pe(t),c=null;if(l&&n.ranges.length>1)if(Gl&&Gl.text.join("\n")==t){if(n.ranges.length%Gl.text.length==0){c=[];for(var u=0;u<Gl.text.length;u++)c.push(o.splitLines(Gl.text[u]))}}else s.length==n.ranges.length&&e.options.pasteLinesPerSelection&&(c=te(s,function(e){return[e]}));for(var d=e.curOp.updateInput,f=n.ranges.length-1;f>=0;f--){var h=n.ranges[f],p=h.from(),m=h.to();h.empty()&&(r&&r>0?p=ut(p.line,p.ch-r):e.state.overwrite&&!l?m=ut(m.line,Math.min(rt(o,m.line).text.length,m.ch+ee(s).length)):l&&Gl&&Gl.lineWise&&Gl.text.join("\n")==s.join("\n")&&(p=m=ut(p.line,0)));var g={from:p,to:m,text:c?c[f%c.length]:s,origin:i||(l?"paste":e.state.cutIncoming>a?"cut":"+input")};na(e.doc,g),zr(e,"inputRead",e,g)}t&&!l&&Ql(e,t),fi(e),e.curOp.updateInput<2&&(e.curOp.updateInput=d),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Xl(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||!t.hasFocus()||Wi(t,function(){return Kl(t,r,0,null,"paste")}),!0}function Ql(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),a=!1;if(o.electricChars){for(var l=0;l<o.electricChars.length;l++)if(t.indexOf(o.electricChars.charAt(l))>-1){a=Ul(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(rt(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Ul(e,i.head.line,"smart"));a&&zr(e,"electricInput",e,i.head.line)}}}function Yl(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:ut(i,0),head:ut(i+1,0)};r.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:r}}function Zl(e,t,r,n){e.setAttribute("autocorrect",r?"on":"off"),e.setAttribute("autocapitalize",n?"on":"off"),e.setAttribute("spellcheck",!!t)}function Jl(){var e=O("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none"),t=O("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return s?e.style.width="1000px":e.setAttribute("wrap","off"),g&&(e.style.border="1px solid black"),t}function es(e){var t=e.optionHandlers,r=e.helpers={};e.prototype={constructor:e,focus:function(){R(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)&&Ii(this,t[e])(this,r,i),_e(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"](Qa(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:Hi(function(t,r){var n=t.token?t:e.getMode(this.options,t);if(n.startState)throw new Error("Overlays may not be stateful.");re(this.state.overlays,{mode:n,modeSpec:t,opaque:r&&r.opaque,priority:r&&r.priority||0},function(e){return e.priority}),this.state.modeGen++,jn(this)}),removeOverlay:Hi(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 jn(this)}}),indentLine:Hi(function(e,t,r){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),st(this.doc,e)&&Ul(this,e,t,r)}),indentSelection:Hi(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&&(Ul(this,i.head.line,e,!0),r=i.head.line,n==this.doc.sel.primIndex&&fi(this));else{var o=i.from(),a=i.to(),l=Math.max(r,o.line);r=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var s=l;s<r;++s)Ul(this,s,e);var c=this.doc.sel.ranges;0==o.ch&&t.length==c.length&&c[n].from().ch>0&&Bo(this.doc,n,new uo(o,c[n].to()),K)}}}),
// Fetch the parser token for a given character. Useful for hacks
// that want to inspect the mode state (say, for completion).
getTokenAt:function(e,t){return Nt(this,e,t)},getLineTokens:function(e,t){return Nt(this,ut(e),t,!0)},getTokenTypeAt:function(e){e=vt(this.doc,e);var t,r=kt(this,rt(this.doc,e.line)),n=0,i=(r.length-1)/2,o=e.ch;if(0==o)t=r[2];else for(;;){var a=n+i>>1;if((a?r[2*a-1]:0)>=o)i=a;else{if(!(r[2*a+1]<o)){t=r[2*a+2];break}n=a+1}}var l=t?t.indexOf("overlay "):-1;return l<0?t:0==l?null:t.slice(0,l-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 a=0;a<o[t].length;a++){var l=i[o[t][a]];l&&n.push(l)}else o.helperType&&i[o.helperType]?n.push(i[o.helperType]):i[o.name]&&n.push(i[o.name]);for(var s=0;s<i._global.length;s++){var c=i._global[s];c.pred(o,this)&&-1==U(n,c.val)&&n.push(c.val)}return n},getStateAfter:function(e,t){var r=this.doc;return Ct(this,(e=gt(r,null==e?r.first+r.size-1:e))+1,t).state},cursorCoords:function(e,t){var r=this.doc.sel.primary();return Cn(this,null==e?r.head:"object"==typeof e?vt(this.doc,e):e?r.from():r.to(),t||"page")},charCoords:function(e,t){return kn(this,vt(this.doc,e),t||"page")},coordsChar:function(e,t){return Mn(this,(e=_n(this,e,t||"page")).left,e.top)},lineAtHeight:function(e,t){return e=_n(this,{top:e,left:0},t||"page").top,lt(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=rt(this.doc,e)}else n=e;return wn(this,n,{top:0,left:0},t||"page",r||i).top+(i?this.doc.height-ur(n):0)},defaultTextHeight:function(){return Fn(this.display)},defaultCharWidth:function(){return En(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,i){var o=this.display,a=(e=Cn(this,vt(this.doc,e))).bottom,l=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==n)a=e.top;else if("above"==n||"near"==n){var s=Math.max(o.wrapper.clientHeight,this.doc.height),c=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>s)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=s&&(a=e.bottom),l+t.offsetWidth>c&&(l=c-t.offsetWidth)}t.style.top=a+"px",t.style.left=t.style.right="","right"==i?(l=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?l=0:"middle"==i&&(l=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=l+"px"),r&&ci(this,{left:l,top:a,right:l+t.offsetWidth,bottom:a+t.offsetHeight})},triggerOnKeyDown:Hi(pl),triggerOnKeyPress:Hi(vl),triggerOnKeyUp:gl,triggerOnMouseDown:Hi(kl),execCommand:function(e){if(rl.hasOwnProperty(e))return rl[e].call(null,this)},triggerElectric:Hi(function(e){Ql(this,e)}),findPosH:function(e,t,r,n){var i=1;t<0&&(i=-1,t=-t);for(var o=vt(this.doc,e),a=0;a<t&&!(o=ts(this.doc,o,i,r,n)).hitSide;++a);return o},moveH:Hi(function(e,t){var r=this;this.extendSelectionsBy(function(n){return r.display.shift||r.doc.extend||n.empty()?ts(r.doc,n.head,e,t,r.options.rtlMoveVisually):e<0?n.from():n.to()},Q)}),deleteH:Hi(function(e,t){var r=this.doc.sel,n=this.doc;r.somethingSelected()?n.replaceSelection("",null,"+delete"):Ya(this,function(r){var i=ts(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 a=vt(this.doc,e),l=0;l<t;++l){var s=Cn(this,a,"div");if(null==o?o=s.left:s.left=o,(a=rs(this,s,i,r)).hitSide)break}return a},moveV:Hi(function(e,t){var r=this,n=this.doc,i=[],o=!this.display.shift&&!n.extend&&n.sel.somethingSelected();if(n.extendSelectionsBy(function(a){if(o)return e<0?a.from():a.to();var l=Cn(r,a.head,"div");null!=a.goalColumn&&(l.left=a.goalColumn),i.push(l.left);var s=rs(r,l,e,t);return"page"==t&&a==n.sel.primary()&&di(r,kn(r,s,"div").top-l.top),s},Q),i.length)for(var a=0;a<n.sel.ranges.length;a++)n.sel.ranges[a].goalColumn=i[a]}),
// Find the word at the given position (as returned by coordsChar).
findWordAt:function(e){var t=rt(this.doc,e.line).text,r=e.ch,n=e.ch;if(t){var i=this.getHelper(e,"wordChars");"before"!=e.sticky&&n!=t.length||!r?++n:--r;for(var o=t.charAt(r),a=le(o,i)?function(e){return le(e,i)}:/\s/.test(o)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!le(e)};r>0&&a(t.charAt(r-1));)--r;for(;n<t.length&&a(t.charAt(n));)++n}return new uo(ut(e.line,r),ut(e.line,n))},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"),_e(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==z(H(this))},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:Hi(function(e,t){hi(this,e,t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-Zr(this)-this.display.barHeight,width:e.scrollWidth-Zr(this)-this.display.barWidth,clientHeight:en(this),clientWidth:Jr(this)}},scrollIntoView:Hi(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:ut(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?pi(this,e):gi(this,e.from,e.to,e.margin)}),setSize:Hi(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&&gn(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,_e(this,"refresh",this)}),operation:function(e){return Wi(this,e)},startOperation:function(){return Ti(this)},endOperation:function(){return Ni(this)},refresh:Hi(function(){var e=this.display.cachedTextHeight;jn(this),this.curOp.forceUpdate=!0,vn(this),hi(this,this.doc.scrollLeft,this.doc.scrollTop),Qi(this.display),(null==e||Math.abs(e-Fn(this.display))>.5||this.options.lineWrapping)&&Pn(this),_e(this,"refresh",this)}),swapDoc:Hi(function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),Co(this,e),vn(this),this.display.input.reset(),hi(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,zr(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 ts(e,t,r,n,i){var o=t,a=r,l=rt(e,t.line),s=i&&"rtl"==e.direction?-r:r;function c(){var r=t.line+s;return!(r<e.first||r>=e.first+e.size)&&(t=new ut(r,t.ch,t.sticky),l=rt(e,r))}function u(o){var a;if("codepoint"==n){var u=l.text.charCodeAt(t.ch+(r>0?0:-1));if(isNaN(u))a=null;else{var d=r>0?u>=55296&&u<56320:u>=56320&&u<57343;a=new ut(t.line,Math.max(0,Math.min(l.text.length,t.ch+r*(d?2:1))),-r)}}else a=i?tl(e.cm,l,t,r):Ja(l,t,r);if(null==a){if(o||!c())return!1;t=el(i,e.cm,l,t.line,s)}else t=a;return!0}if("char"==n||"codepoint"==n)u();else if("column"==n)u(!0);else if("word"==n||"group"==n)for(var d=null,f="group"==n,h=e.cm&&e.cm.getHelper(t,"wordChars"),p=!0;!(r<0)||u(!p);p=!1){var m=l.text.charAt(t.ch)||"\n",g=le(m,h)?"w":f&&"\n"==m?"n":!f||/\s/.test(m)?null:"p";if(!f||p||g||(g="s"),d&&d!=g){r<0&&(r=1,u(),t.sticky="after");break}if(g&&(d=g),r>0&&!u(!p))break}var v=Jo(e,t,o,a,!0);return ft(o,v)&&(v.hitSide=!0),v}function rs(e,t,r,n){var i,o,a=e.doc,l=t.left;if("page"==n){var s=Math.min(e.display.wrapper.clientHeight,R(e).innerHeight||a(e).documentElement.clientHeight),c=Math.max(s-.5*Fn(e.display),3);i=(r>0?t.bottom:t.top)+r*c}else"line"==n&&(i=r>0?t.bottom+3:t.top-3);for(;(o=Mn(e,l,i)).outside;){if(r<0?i<=0:i>=a.height){o.hitSide=!0;break}i+=5*r}return o}var ns=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new V,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function is(e,t){var r=an(e,t.line);if(!r||r.hidden)return null;var n=rt(e.doc,t.line),i=rn(r,n,t.line),o=ve(n,e.doc.direction),a="left";o&&(a=me(o,t.ch)%2?"right":"left");var l=dn(i.map,t.ch,a);return l.offset="right"==l.collapse?l.end:l.start,l}function os(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function as(e,t){return t&&(e.bad=!0),e}function ls(e,t,r,n,i){var o="",a=!1,l=e.doc.lineSeparator(),s=!1;function c(e){return function(t){return t.id==e}}function u(){a&&(o+=l,s&&(o+=l),a=s=!1)}function d(e){e&&(u(),o+=e)}function f(t){if(1==t.nodeType){var r=t.getAttribute("cm-text");if(r)return void d(r);var o,h=t.getAttribute("cm-marker");if(h){var p=e.findMarks(ut(n,0),ut(i+1,0),c(+h));return void(p.length&&(o=p[0].find(0))&&d(nt(e.doc,o.from,o.to).join(l)))}if("false"==t.getAttribute("contenteditable"))return;var m=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;m&&u();for(var g=0;g<t.childNodes.length;g++)f(t.childNodes[g]);/^(pre|p)$/i.test(t.nodeName)&&(s=!0),m&&(a=!0)}else 3==t.nodeType&&d(t.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;f(t),t!=r;)t=t.nextSibling,s=!1;return o}function ss(e,t,r){var n;if(t==e.display.lineDiv){if(!(n=e.display.lineDiv.childNodes[r]))return as(e.clipPos(ut(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 cs(o,t,r)}}function cs(e,t,r){var n=e.text.firstChild,i=!1;if(!t||!D(n,t))return as(ut(at(e.line),0),!0);if(t==n&&(i=!0,t=n.childNodes[r],r=0,!t)){var o=e.rest?ee(e.rest):e.line;return as(ut(at(o),o.text.length),i)}var a=3==t.nodeType?t:null,l=t;for(a||1!=t.childNodes.length||3!=t.firstChild.nodeType||(a=t.firstChild,r&&(r=a.nodeValue.length));l.parentNode!=n;)l=l.parentNode;var s=e.measure,c=s.maps;function u(t,r,n){for(var i=-1;i<(c?c.length:0);i++)for(var o=i<0?s.map:c[i],a=0;a<o.length;a+=3){var l=o[a+2];if(l==t||l==r){var u=at(i<0?e.line:e.rest[i]),d=o[a]+n;return(n<0||l!=t)&&(d=o[a+(n?1:0)]),ut(u,d)}}}var d=u(a,l,r);if(d)return as(d,i);for(var f=l.nextSibling,h=a?a.nodeValue.length-r:0;f;f=f.nextSibling){if(d=u(f,f.firstChild,0))return as(ut(d.line,d.ch-h),i);h+=f.textContent.length}for(var p=l.previousSibling,m=r;p;p=p.previousSibling){if(d=u(p,p.firstChild,-1))return as(ut(d.line,d.ch+m),i);m+=p.textContent.length}}ns.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 a(e){if(o(e)&&!ke(n,e)){if(n.somethingSelected())$l({lineWise:!1,text:n.getSelections()}),"cut"==e.type&&n.replaceSelection("",null,"cut");else{if(!n.options.lineWiseCopyCut)return;var t=Yl(n);$l({lineWise:!0,text:t.text}),"cut"==e.type&&n.operation(function(){n.setSelections(t.ranges,0,K),n.replaceSelection("",null,"cut")})}if(e.clipboardData){e.clipboardData.clearData();var a=Gl.text.join("\n");if(e.clipboardData.setData("Text",a),e.clipboardData.getData("Text")==a)return void e.preventDefault()}var l=Jl(),s=l.firstChild;Zl(s),n.display.lineSpace.insertBefore(l,n.display.lineSpace.firstChild),s.value=Gl.text.join("\n");var c=z(P(i));W(s),setTimeout(function(){n.display.lineSpace.removeChild(l),c.focus(),c==i&&r.showPrimarySelection()},50)}}i.contentEditable=!0,Zl(i,n.options.spellcheck,n.options.autocorrect,n.options.autocapitalize),be(i,"paste",function(e){!o(e)||ke(n,e)||Xl(e,n)||l<=11&&setTimeout(Ii(n,function(){return t.updateFromDOM()}),20)}),be(i,"compositionstart",function(e){t.composing={data:e.data,done:!1}}),be(i,"compositionupdate",function(e){t.composing||(t.composing={data:e.data,done:!1})}),be(i,"compositionend",function(e){t.composing&&(e.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),be(i,"touchstart",function(){return r.forceCompositionEnd()}),be(i,"input",function(){t.composing||t.readFromDOMSoon()}),be(i,"copy",a),be(i,"cut",a)},ns.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},ns.prototype.prepareSelection=function(){var e=Xn(this.cm,!1);return e.focus=z(P(this.div))==this.div,e},ns.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},ns.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},ns.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 a=ss(t,e.anchorNode,e.anchorOffset),l=ss(t,e.focusNode,e.focusOffset);if(!a||a.bad||!l||l.bad||0!=dt(mt(a,l),i)||0!=dt(pt(a,l),o)){var s=t.display.view,c=i.line>=t.display.viewFrom&&is(t,i)||{node:s[0].measure.map[2],offset:0},u=o.line<t.display.viewTo&&is(t,o);if(!u){var d=s[s.length-1].measure,f=d.maps?d.maps[d.maps.length-1]:d.map;u={node:f[f.length-1],offset:f[f.length-2]-f[f.length-3]}}if(c&&u){var h,p=e.rangeCount&&e.getRangeAt(0);try{h=L(c.node,c.offset,u.offset,u.node)}catch(He){}h&&(!r&&t.state.focused?(e.collapse(c.node,c.offset),h.collapsed||(e.removeAllRanges(),e.addRange(h))):(e.removeAllRanges(),e.addRange(h)),p&&null==e.anchorNode?e.addRange(p):r&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},ns.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)},ns.prototype.showMultipleSelections=function(e){N(this.cm.display.cursorDiv,e.cursors),N(this.cm.display.selectionDiv,e.selection)},ns.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},ns.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return D(this.div,t)},ns.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()&&z(P(this.div))==this.div||this.showSelection(this.prepareSelection(),!0),this.div.focus())},ns.prototype.blur=function(){this.div.blur()},ns.prototype.getField=function(){return this.div},ns.prototype.supportsTouch=function(){return!0},ns.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):Wi(this.cm,function(){return t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,r)},ns.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},ns.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e=this.getSelection(),t=this.cm;if(v&&u&&this.cm.display.gutterSpecs.length&&os(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=ss(t,e.anchorNode,e.anchorOffset),n=ss(t,e.focusNode,e.focusOffset);r&&n&&Wi(t,function(){$o(t.doc,ho(r,n),K),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)})}}},ns.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(),a=o.from(),l=o.to();if(0==a.ch&&a.line>n.firstLine()&&(a=ut(a.line-1,rt(n.doc,a.line-1).length)),l.ch==rt(n.doc,l.line).text.length&&l.line<n.lastLine()&&(l=ut(l.line+1,0)),a.line<i.viewFrom||l.line>i.viewTo-1)return!1;a.line==i.viewFrom||0==(e=qn(n,a.line))?(t=at(i.view[0].line),r=i.view[0].node):(t=at(i.view[e].line),r=i.view[e-1].node.nextSibling);var s,c,u=qn(n,l.line);if(u==i.view.length-1?(s=i.viewTo-1,c=i.lineDiv.lastChild):(s=at(i.view[u+1].line)-1,c=i.view[u+1].node.previousSibling),!r)return!1;for(var d=n.doc.splitLines(ls(n,r,c,t,s)),f=nt(n.doc,ut(t,0),ut(s,rt(n.doc,s).text.length));d.length>1&&f.length>1;)if(ee(d)==ee(f))d.pop(),f.pop(),s--;else{if(d[0]!=f[0])break;d.shift(),f.shift(),t++}for(var h=0,p=0,m=d[0],g=f[0],v=Math.min(m.length,g.length);h<v&&m.charCodeAt(h)==g.charCodeAt(h);)++h;for(var y=ee(d),b=ee(f),x=Math.min(y.length-(1==d.length?h:0),b.length-(1==f.length?h:0));p<x&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)++p;if(1==d.length&&1==f.length&&t==a.line)for(;h&&h>a.ch&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)h--,p++;d[d.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),d[0]=d[0].slice(h).replace(/\u200b+$/,"");var w=ut(t,h),_=ut(s,f.length?ee(f).length-p:0);return d.length>1||d[0]||dt(w,_)?(ca(n.doc,d,w,_,"+input"),!0):void 0},ns.prototype.ensurePolled=function(){this.forceCompositionEnd()},ns.prototype.reset=function(){this.forceCompositionEnd()},ns.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},ns.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))},ns.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Wi(this.cm,function(){return jn(e.cm)})},ns.prototype.setUneditable=function(e){e.contentEditable="false"},ns.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||Ii(this.cm,Kl)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},ns.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},ns.prototype.onContextMenu=function(){},ns.prototype.resetPosition=function(){},ns.prototype.needsContentAttribute=!0;var us=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new V,this.hasSelection=!1,this.composing=null,this.resetting=!1};function ds(e,t){if((t=t?j(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=z(P(e));t.autofocus=r==e||null!=e.getAttribute("autofocus")&&r==document.body}function n(){e.value=l.getValue()}var i;if(e.form&&(be(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var o=e.form;i=o.submit;try{var a=o.submit=function(){n(),o.submit=i,o.submit(),o.submit=a}}catch(He){}}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&&(we(e.form,"submit",n),t.leaveSubmitMethodAlone||"function"!=typeof e.form.submit||(e.form.submit=i))}},e.style.display="none";var l=jl(function(t){return e.parentNode.insertBefore(t,e.nextSibling)},t);return l}function fs(e){e.off=we,e.on=be,e.wheelEventPixels=lo,e.Doc=Ta,e.splitLines=Pe,e.countColumn=B,e.findColumn=Y,e.isWordChar=ae,e.Pass=$,e.signal=_e,e.Line=hr,e.changeEnd=po,e.scrollbarModel=Si,e.Pos=ut,e.cmpPos=dt,e.modes=Ve,e.mimeModes=Ue,e.resolveMode=Ke,e.getMode=Xe,e.modeExtensions=Qe,e.extendMode=Ye,e.copyState=Ze,e.startState=et,e.innerMode=Je,e.commands=rl,e.keyMap=Ba,e.keyName=Xa,e.isModifierKey=$a,e.lookupKey=Ga,e.normalizeKeyMap=Ua,e.StringStream=tt,e.SharedTextMarker=_a,e.TextMarker=xa,e.LineWidget=ga,e.e_preventDefault=Me,e.e_stopPropagation=Te,e.e_stop=Oe,e.addClass=F,e.contains=D,e.rmClass=M,e.keyNames=Pa}us.prototype.init=function(e){var t=this,r=this,n=this.cm;this.createField(e);var i=this.textarea;function o(e){if(!ke(n,e)){if(n.somethingSelected())$l({lineWise:!1,text:n.getSelections()});else{if(!n.options.lineWiseCopyCut)return;var t=Yl(n);$l({lineWise:!0,text:t.text}),"cut"==e.type?n.setSelections(t.ranges,null,K):(r.prevInput="",i.value=t.text.join("\n"),W(i))}"cut"==e.type&&(n.state.cutIncoming=+new Date)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),g&&(i.style.width="0px"),be(i,"input",function(){a&&l>=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),be(i,"paste",function(e){ke(n,e)||Xl(e,n)||(n.state.pasteIncoming=+new Date,r.fastPoll())}),be(i,"cut",o),be(i,"copy",o),be(e.scroller,"paste",function(t){if(!Kr(e,t)&&!ke(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)}}),be(e.lineSpace,"selectstart",function(t){Kr(e,t)||Me(t)}),be(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"})}}),be(i,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},us.prototype.createField=function(e){this.wrapper=Jl(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;Zl(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},us.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},us.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=Xn(e);if(e.options.moveInputWithCursor){var i=Cn(e,r.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return n},us.prototype.showSelection=function(e){var t=this.cm.display;N(t.cursorDiv,e.cursors),N(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},us.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&&W(this.textarea),a&&l>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",a&&l>=9&&(this.hasSelection=null));this.resetting=!1}},us.prototype.getField=function(){return this.textarea},us.prototype.supportsTouch=function(){return!1},us.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!y||z(P(this.textarea))!=this.textarea))try{this.textarea.focus()}catch(He){}},us.prototype.blur=function(){this.textarea.blur()},us.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},us.prototype.receivedFocus=function(){this.slowPoll()},us.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},us.prototype.fastPoll=function(){var e=!1,t=this;function r(){t.poll()||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,r))}t.pollingFast=!0,t.polling.set(20,r)},us.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||Re(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(a&&l>=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")}for(var s=0,c=Math.min(n.length,i.length);s<c&&n.charCodeAt(s)==i.charCodeAt(s);)++s;return Wi(t,function(){Kl(t,i.slice(s),n.length-s,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},us.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},us.prototype.onKeyPress=function(){a&&l>=9&&(this.hasSelection=null),this.fastPoll()},us.prototype.onContextMenu=function(e){var t=this,r=t.cm,n=r.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var o=Rn(r,e),c=n.scroller.scrollTop;if(o&&!f){r.options.resetSelectionOnContextMenu&&-1==r.doc.sel.contains(o)&&Ii(r,$o)(r.doc,ho(o),K);var u,d=i.style.cssText,h=t.wrapper.style.cssText,p=t.wrapper.offsetParent.getBoundingClientRect();if(t.wrapper.style.cssText="position: static",i.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-p.top-5)+"px; left: "+(e.clientX-p.left-5)+"px;\n z-index: 1000; background: "+(a?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",s&&(u=i.ownerDocument.defaultView.scrollY),n.input.focus(),s&&i.ownerDocument.defaultView.scrollTo(null,u),n.input.reset(),r.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=v,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll),a&&l>=9&&g(),C){Oe(e);var m=function(){we(window,"mouseup",m),setTimeout(v,20)};be(window,"mouseup",m)}else setTimeout(v,50)}function g(){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 v(){if(t.contextMenuPending==v&&(t.contextMenuPending=!1,t.wrapper.style.cssText=h,i.style.cssText=d,a&&l<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=c),null!=i.selectionStart)){(!a||a&&l<9)&&g();var e=0,o=function(){n.selForContextMenu==r.doc.sel&&0==i.selectionStart&&i.selectionEnd>0&&""==t.prevInput?Ii(r,ta)(r):e++<10?n.detectingSelectAll=setTimeout(o,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(o,200)}}},us.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e,this.textarea.readOnly=!!e},us.prototype.setUneditable=function(){},us.prototype.needsContentAttribute=!1,Pl(jl),es(jl);var hs="iter insert remove copy getEditor constructor".split(" ");for(var ps in Ta.prototype)Ta.prototype.hasOwnProperty(ps)&&U(hs,ps)<0&&(jl.prototype[ps]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ta.prototype[ps]));return Le(Ta),jl.inputStyles={textarea:us,contenteditable:ns},jl.defineMode=function(e){jl.defaults.mode||"null"==e||(jl.defaults.mode=e),Ge.apply(this,arguments)},jl.defineMIME=$e,jl.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),jl.defineMIME("text/plain","null"),jl.defineExtension=function(e,t){jl.prototype[e]=t},jl.defineDocExtension=function(e,t){Ta.prototype[e]=t},jl.fromTextArea=ds,fs(jl),jl.version="5.65.20",jl}()),k.exports}function S(){return w||(w=1,function(e){function t(t,n,o,a){if(o&&o.call){var l=o;o=null}else l=i(t,o,"rangeFinder");"number"==typeof n&&(n=e.Pos(n,0));var s=i(t,o,"minFoldSize");function c(e){var r=l(t,n);if(!r||r.to.line-r.from.line<s)return null;if("fold"===a)return r;for(var i=t.findMarksAt(r.from),o=0;o<i.length;++o)if(i[o].__isFold){if(!e)return null;r.cleared=!0,i[o].clear()}return r}var u=c(!0);if(i(t,o,"scanUp"))for(;!u&&n.line>t.firstLine();)n=e.Pos(n.line-1,0),u=c(!1);if(u&&!u.cleared&&"unfold"!==a){var d=r(t,o,u);e.on(d,"mousedown",function(t){f.clear(),e.e_preventDefault(t)});var f=t.markText(u.from,u.to,{replacedWith:d,clearOnEnter:i(t,o,"clearOnEnter"),__isFold:!0});f.on("clear",function(r,n){e.signal(t,"unfold",t,r,n)}),e.signal(t,"fold",t,u.from,u.to)}}function r(e,t,r){var n=i(e,t,"widget");if("function"==typeof n&&(n=n(r.from,r.to)),"string"==typeof n){var o=document.createTextNode(n);(n=document.createElement("span")).appendChild(o),n.className="CodeMirror-foldmarker"}else n&&(n=n.cloneNode(!0));return n}e.newFoldFunction=function(e,r){return function(n,i){t(n,i,{rangeFinder:e,widget:r})}},e.defineExtension("foldCode",function(e,r,n){t(this,e,r,n)}),e.defineExtension("isFolded",function(e){for(var t=this.findMarksAt(e),r=0;r<t.length;++r)if(t[r].__isFold)return!0}),e.commands.toggleFold=function(e){e.foldCode(e.getCursor())},e.commands.fold=function(e){e.foldCode(e.getCursor(),null,"fold")},e.commands.unfold=function(e){e.foldCode(e.getCursor(),{scanUp:!1},"unfold")},e.commands.foldAll=function(t){t.operation(function(){for(var r=t.firstLine(),n=t.lastLine();r<=n;r++)t.foldCode(e.Pos(r,0),{scanUp:!1},"fold")})},e.commands.unfoldAll=function(t){t.operation(function(){for(var r=t.firstLine(),n=t.lastLine();r<=n;r++)t.foldCode(e.Pos(r,0),{scanUp:!1},"unfold")})},e.registerHelper("fold","combine",function(){var e=Array.prototype.slice.call(arguments,0);return function(t,r){for(var n=0;n<e.length;++n){var i=e[n](t,r);if(i)return i}}}),e.registerHelper("fold","auto",function(e,t){for(var r=e.getHelpers(t,"fold"),n=0;n<r.length;n++){var i=r[n](e,t);if(i)return i}});var n={rangeFinder:e.fold.auto,widget:"↔",minFoldSize:0,scanUp:!1,clearOnEnter:!0};function i(e,t,r){if(t&&void 0!==t[r])return t[r];var i=e.options.foldOptions;return i&&void 0!==i[r]?i[r]:n[r]}e.defineOption("foldOptions",null),e.defineExtension("foldOption",function(e,t){return i(this,e,t)})}(C())),_}S();var L;L||(L=1,function(e){e.defineOption("foldGutter",!1,function(t,i,o){o&&o!=e.Init&&(t.clearGutter(t.state.foldGutter.options.gutter),t.state.foldGutter=null,t.off("gutterClick",c),t.off("changes",d),t.off("viewportChange",f),t.off("fold",h),t.off("unfold",h),t.off("swapDoc",d),t.off("optionChange",u)),i&&(t.state.foldGutter=new r(n(i)),s(t),t.on("gutterClick",c),t.on("changes",d),t.on("viewportChange",f),t.on("fold",h),t.on("unfold",h),t.on("swapDoc",d),t.on("optionChange",u))});var t=e.Pos;function r(e){this.options=e,this.from=this.to=0}function n(e){return!0===e&&(e={}),null==e.gutter&&(e.gutter="CodeMirror-foldgutter"),null==e.indicatorOpen&&(e.indicatorOpen="CodeMirror-foldgutter-open"),null==e.indicatorFolded&&(e.indicatorFolded="CodeMirror-foldgutter-folded"),e}function i(e,r){for(var n=e.findMarks(t(r,0),t(r+1,0)),i=0;i<n.length;++i)if(n[i].__isFold){var o=n[i].find(-1);if(o&&o.line===r)return n[i]}}function o(e){if("string"==typeof e){var t=document.createElement("div");return t.className=e+" CodeMirror-guttermarker-subtle",t}return e.cloneNode(!0)}function a(e,r,n){var a=e.state.foldGutter.options,s=r-1,c=e.foldOption(a,"minFoldSize"),u=e.foldOption(a,"rangeFinder"),d="string"==typeof a.indicatorFolded&&l(a.indicatorFolded),f="string"==typeof a.indicatorOpen&&l(a.indicatorOpen);e.eachLine(r,n,function(r){++s;var n=null,l=r.gutterMarkers;if(l&&(l=l[a.gutter]),i(e,s)){if(d&&l&&d.test(l.className))return;n=o(a.indicatorFolded)}else{var h=t(s,0),p=u&&u(e,h);if(p&&p.to.line-p.from.line>=c){if(f&&l&&f.test(l.className))return;n=o(a.indicatorOpen)}}(n||l)&&e.setGutterMarker(r,a.gutter,n)})}function l(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function s(e){var t=e.getViewport(),r=e.state.foldGutter;r&&(e.operation(function(){a(e,t.from,t.to)}),r.from=t.from,r.to=t.to)}function c(e,r,n){var o=e.state.foldGutter;if(o){var a=o.options;if(n==a.gutter){var l=i(e,r);l?l.clear():e.foldCode(t(r,0),a)}}}function u(e,t){"mode"==t&&d(e)}function d(e){var t=e.state.foldGutter;if(t){var r=t.options;t.from=t.to=0,clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){s(e)},r.foldOnChangeTimeSpan||600)}}function f(e){var t=e.state.foldGutter;if(t){var r=t.options;clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){var r=e.getViewport();t.from==t.to||r.from-t.to>20||t.from-r.to>20?s(e):e.operation(function(){r.from<t.from&&(a(e,r.from,t.from),t.from=r.from),r.to>t.to&&(a(e,t.to,r.to),t.to=r.to)})},r.updateViewportTimeSpan||400)}}function h(e,t){var r=e.state.foldGutter;if(r){var n=t.line;n>=r.from&&n<r.to&&a(e,n,n+1)}}}(C(),S()));var M;M||(M=1,function(e){function t(t){return function(r,n){var i=n.line,o=r.getLine(i);function a(t){for(var a,l=n.ch,s=0;;){var c=l<=0?-1:o.lastIndexOf(t[0],l-1);if(-1!=c){if(1==s&&c<n.ch)break;if(a=r.getTokenTypeAt(e.Pos(i,c+1)),!/^(comment|string)/.test(a))return{ch:c+1,tokenType:a,pair:t};l=c-1}else{if(1==s)break;s=1,l=o.length}}}function l(t){var n,o,a=1,l=r.lastLine(),s=t.ch;e:for(var c=i;c<=l;++c)for(var u=r.getLine(c),d=c==i?s:0;;){var f=u.indexOf(t.pair[0],d),h=u.indexOf(t.pair[1],d);if(f<0&&(f=u.length),h<0&&(h=u.length),(d=Math.min(f,h))==u.length)break;if(r.getTokenTypeAt(e.Pos(c,d+1))==t.tokenType)if(d==f)++a;else if(! --a){n=c,o=d;break e}++d}return null==n||i==n?null:{from:e.Pos(i,s),to:e.Pos(n,o)}}for(var s=[],c=0;c<t.length;c++){var u=a(t[c]);u&&s.push(u)}for(s.sort(function(e,t){return e.ch-t.ch}),c=0;c<s.length;c++){var d=l(s[c]);if(d)return d}return null}}e.registerHelper("fold","brace",t([["{","}"],["[","]"]])),e.registerHelper("fold","brace-paren",t([["{","}"],["[","]"],["(",")"]])),e.registerHelper("fold","import",function(t,r){function n(r){if(r<t.firstLine()||r>t.lastLine())return null;var n=t.getTokenAt(e.Pos(r,1));if(/\S/.test(n.string)||(n=t.getTokenAt(e.Pos(r,n.end+1))),"keyword"!=n.type||"import"!=n.string)return null;for(var i=r,o=Math.min(t.lastLine(),r+10);i<=o;++i){var a=t.getLine(i).indexOf(";");if(-1!=a)return{startCh:n.end,end:e.Pos(i,a)}}}var i,o=r.line,a=n(o);if(!a||n(o-1)||(i=n(o-2))&&i.end.line==o-1)return null;for(var l=a.end;;){var s=n(l.line+1);if(null==s)break;l=s.end}return{from:t.clipPos(e.Pos(o,a.startCh+1)),to:l}}),e.registerHelper("fold","include",function(t,r){function n(r){if(r<t.firstLine()||r>t.lastLine())return null;var n=t.getTokenAt(e.Pos(r,1));return/\S/.test(n.string)||(n=t.getTokenAt(e.Pos(r,n.end+1))),"meta"==n.type&&"#include"==n.string.slice(0,8)?n.start+8:void 0}var i=r.line,o=n(i);if(null==o||null!=n(i-1))return null;for(var a=i;null!=n(a+1);)++a;return{from:e.Pos(i,o+1),to:t.clipPos(e.Pos(a))}})}(C()));var T;T||(T=1,function(e){var t="CodeMirror-activeline",r="CodeMirror-activeline-background",n="CodeMirror-activeline-gutter";function i(e){for(var i=0;i<e.state.activeLines.length;i++)e.removeLineClass(e.state.activeLines[i],"wrap",t),e.removeLineClass(e.state.activeLines[i],"background",r),e.removeLineClass(e.state.activeLines[i],"gutter",n)}function o(e,t){if(e.length!=t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!=t[r])return!1;return!0}function a(e,a){for(var l=[],s=0;s<a.length;s++){var c=a[s],u=e.getOption("styleActiveLine");if("object"==typeof u&&u.nonEmpty?c.anchor.line==c.head.line:c.empty()){var d=e.getLineHandleVisualStart(c.head.line);l[l.length-1]!=d&&l.push(d)}}o(e.state.activeLines,l)||e.operation(function(){i(e);for(var o=0;o<l.length;o++)e.addLineClass(l[o],"wrap",t),e.addLineClass(l[o],"background",r),e.addLineClass(l[o],"gutter",n);e.state.activeLines=l})}function l(e,t){a(e,t.ranges)}e.defineOption("styleActiveLine",!1,function(t,r,n){var o=n!=e.Init&&n;r!=o&&(o&&(t.off("beforeSelectionChange",l),i(t),delete t.state.activeLines),r&&(t.state.activeLines=[],a(t,t.listSelections()),t.on("beforeSelectionChange",l)))})}(C()));const N=e(C());var O;O||(O=1,function(e){var t=e.Pos,r="http://www.w3.org/2000/svg";function n(e,t){this.mv=e,this.type=t,this.classes="left"==t?{chunk:"CodeMirror-merge-l-chunk",start:"CodeMirror-merge-l-chunk-start",end:"CodeMirror-merge-l-chunk-end",insert:"CodeMirror-merge-l-inserted",del:"CodeMirror-merge-l-deleted",connect:"CodeMirror-merge-l-connect"}:{chunk:"CodeMirror-merge-r-chunk",start:"CodeMirror-merge-r-chunk-start",end:"CodeMirror-merge-r-chunk-end",insert:"CodeMirror-merge-r-inserted",del:"CodeMirror-merge-r-deleted",connect:"CodeMirror-merge-r-connect"}}function i(t){t.diffOutOfDate&&(t.diff=O(t.orig.getValue(),t.edit.getValue(),t.mv.options.ignoreWhitespace),t.chunks=A(t.diff),t.diffOutOfDate=!1,e.signal(t.edit,"updateDiff",t.diff))}n.prototype={constructor:n,init:function(t,r,n){this.edit=this.mv.edit,(this.edit.state.diffViews||(this.edit.state.diffViews=[])).push(this),this.orig=e(t,j({value:r,readOnly:!this.mv.options.allowEditingOriginals},j(n))),"align"==this.mv.options.connect&&(this.edit.state.trackAlignable||(this.edit.state.trackAlignable=new $(this.edit)),this.orig.state.trackAlignable=new $(this.orig)),this.lockButton.title=this.edit.phrase("Toggle locked scrolling"),this.lockButton.setAttribute("aria-label",this.lockButton.title),this.orig.state.diffViews=[this];var i=n.chunkClassLocation||"background";"[object Array]"!=Object.prototype.toString.call(i)&&(i=[i]),this.classes.classLocation=i,this.diff=O(N(r),N(n.value),this.mv.options.ignoreWhitespace),this.chunks=A(this.diff),this.diffOutOfDate=this.dealigned=!1,this.needsScrollSync=null,this.showDifferences=!1!==n.showDifferences},registerEvents:function(e){this.forceUpdate=a(this),u(this,!0,!1),l(this,e)},setShowDifferences:function(e){(e=!1!==e)!=this.showDifferences&&(this.showDifferences=e,this.forceUpdate("full"))}};var o=!1;function a(t){var r,n={from:0,to:0,marked:[]},a={from:0,to:0,marked:[]},l=!1;function c(e){o=!0,l=!1,"full"==e&&(t.svg&&R(t.svg),t.copyButtons&&R(t.copyButtons),f(t.edit,n.marked,t.classes),f(t.orig,a.marked,t.classes),n.from=n.to=a.from=a.to=0),i(t),t.showDifferences&&(h(t.edit,t.diff,n,DIFF_INSERT,t.classes),h(t.orig,t.diff,a,DIFF_DELETE,t.classes)),"align"==t.mv.options.connect&&w(t),g(t),null!=t.needsScrollSync&&s(t,t.needsScrollSync),o=!1}function u(e){o||(t.dealigned=!0,d(e))}function d(e){o||l||(clearTimeout(r),!0===e&&(l=!0),r=setTimeout(c,!0===e?20:250))}function p(e,r){t.diffOutOfDate||(t.diffOutOfDate=!0,n.from=n.to=a.from=a.to=0),u(r.text.length-1!=r.to.line-r.from.line)}function m(){t.diffOutOfDate=!0,t.dealigned=!0,c("full")}return t.edit.on("change",p),t.orig.on("change",p),t.edit.on("swapDoc",m),t.orig.on("swapDoc",m),"align"==t.mv.options.connect&&(e.on(t.edit.state.trackAlignable,"realign",u),e.on(t.orig.state.trackAlignable,"realign",u)),t.edit.on("viewportChange",function(){d(!1)}),t.orig.on("viewportChange",function(){d(!1)}),c(),c}function l(e,t){e.edit.on("scroll",function(){s(e,!0)&&g(e)}),e.orig.on("scroll",function(){s(e,!1)&&g(e),t&&s(t,!0)&&g(t)})}function s(e,t){if(e.diffOutOfDate)return e.lockScroll&&null==e.needsScrollSync&&(e.needsScrollSync=t),!1;if(e.needsScrollSync=null,!e.lockScroll)return!0;var r,n,i=+new Date;if(t?(r=e.edit,n=e.orig):(r=e.orig,n=e.edit),r.state.scrollSetBy==e&&(r.state.scrollSetAt||0)+250>i)return!1;var o=r.getScrollInfo();if("align"==e.mv.options.connect)g=o.top;else{var a,l,s=.5*o.clientHeight,u=o.top+s,d=r.lineAtHeight(u,"local"),f=F(e.chunks,d,t),h=c(r,t?f.edit:f.orig),p=c(n,t?f.orig:f.edit),m=(u-h.top)/(h.bot-h.top),g=p.top-s+m*(p.bot-p.top);if(g>o.top&&(l=o.top/s)<1)g=g*l+o.top*(1-l);else if((a=o.height-o.clientHeight-o.top)<s){var v=n.getScrollInfo();v.height-v.clientHeight-g>a&&(l=a/s)<1&&(g=g*l+(v.height-v.clientHeight-a)*(1-l))}}return n.scrollTo(o.left,g),n.state.scrollSetAt=i,n.state.scrollSetBy=e,!0}function c(e,t){var r=t.after;return null==r&&(r=e.lastLine()+1),{top:e.heightAtLine(t.before||0,"local"),bot:e.heightAtLine(r,"local")}}function u(t,r,n){t.lockScroll=r,r&&0!=n&&s(t,DIFF_INSERT)&&g(t),(r?e.addClass:e.rmClass)(t.lockButton,"CodeMirror-merge-scrolllock-enabled")}function d(e,t,r){for(var n=r.classLocation,i=0;i<n.length;i++)e.removeLineClass(t,n[i],r.chunk),e.removeLineClass(t,n[i],r.start),e.removeLineClass(t,n[i],r.end)}function f(t,r,n){for(var i=0;i<r.length;++i){var o=r[i];o instanceof e.TextMarker?o.clear():o.parent&&d(t,o,n)}r.length=0}function h(e,t,r,n,i){var o=e.getViewport();e.operation(function(){r.from==r.to||o.from-r.to>20||r.from-o.to>20?(f(e,r.marked,i),m(e,t,n,r.marked,o.from,o.to,i),r.from=o.from,r.to=o.to):(o.from<r.from&&(m(e,t,n,r.marked,o.from,r.from,i),r.from=o.from),o.to>r.to&&(m(e,t,n,r.marked,r.to,o.to,i),r.to=o.to))})}function p(e,t,r,n,i,o){for(var a=r.classLocation,l=e.getLineHandle(t),s=0;s<a.length;s++)n&&e.addLineClass(l,a[s],r.chunk),i&&e.addLineClass(l,a[s],r.start),o&&e.addLineClass(l,a[s],r.end);return l}function m(e,r,n,i,o,a,l){var s=t(0,0),c=t(o,0),u=e.clipPos(t(a-1)),d=n==DIFF_DELETE?l.del:l.insert;function f(t,r){for(var n=Math.max(o,t),s=Math.min(a,r),c=n;c<s;++c)i.push(p(e,c,l,!0,c==t,c==r-1));t==r&&n==r&&s==r&&(n?i.push(p(e,n-1,l,!1,!1,!0)):i.push(p(e,n,l,!1,!0,!1)))}for(var h=0,m=!1,g=0;g<r.length;++g){var v=r[g],y=v[0],b=v[1];if(y==DIFF_EQUAL){var x=s.line+(z(r,g)?0:1);B(s,b);var w=s.line+(D(r,g)?1:0);w>x&&(m&&(f(h,x),m=!1),h=w)}else if(m=!0,y==n){var _=B(s,b,!0),k=X(c,s),C=K(u,_);Q(k,C)||i.push(e.markText(k,C,{className:d})),s=_}}m&&f(h,s.line+1)}function g(e){if(e.showDifferences){if(e.svg){R(e.svg);var t=e.gap.offsetWidth;q(e.svg,"width",t,"height",e.gap.offsetHeight)}e.copyButtons&&R(e.copyButtons);for(var r=e.edit.getViewport(),n=e.orig.getViewport(),i=e.mv.wrap.getBoundingClientRect().top,o=i-e.edit.getScrollerElement().getBoundingClientRect().top+e.edit.getScrollInfo().top,a=i-e.orig.getScrollerElement().getBoundingClientRect().top+e.orig.getScrollInfo().top,l=0;l<e.chunks.length;l++){var s=e.chunks[l];s.editFrom<=r.to&&s.editTo>=r.from&&s.origFrom<=n.to&&s.origTo>=n.from&&C(e,s,a,o,t)}}}function v(e,t){for(var r=0,n=0,i=0;i<t.length;i++){var o=t[i];if(o.editTo>e&&o.editFrom<=e)return null;if(o.editFrom>e)break;r=o.editTo,n=o.origTo}return n+(e-r)}function y(e,t,r){for(var n=e.state.trackAlignable,i=e.firstLine(),o=0,a=[],l=0;;l++){for(var s=t[l],c=s?r?s.origFrom:s.editFrom:1e9;o<n.alignable.length;o+=2){var u=n.alignable[o]+1;if(!(u<=i)){if(!(u<=c))break;a.push(u)}}if(!s)break;a.push(i=r?s.origTo:s.editTo)}return a}function b(e,t,r,n){var i=0,o=0,a=0,l=0;e:for(;;i++){var s=e[i],c=t[o];if(!s&&null==c)break;for(var u=s?s[0]:1e9,d=null==c?1e9:c;a<r.length;){var f=r[a];if(f.origFrom<=d&&f.origTo>d){o++,i--;continue e}if(f.editTo>u){if(f.editFrom<=u)continue e;break}l+=f.origTo-f.origFrom-(f.editTo-f.editFrom),a++}if(u==d-l)s[n]=d,o++;else if(u<d-l)s[n]=u+l;else{var h=[d-l,null,null];h[n]=d,e.splice(i,0,h),o++}}}function x(e,t){var r=y(e.edit,e.chunks,!1),n=[];if(t)for(var i=0,o=0;i<t.chunks.length;i++){for(var a=t.chunks[i].editTo;o<r.length&&r[o]<a;)o++;o!=r.length&&r[o]==a||r.splice(o++,0,a)}for(i=0;i<r.length;i++)n.push([r[i],null,null]);return b(n,y(e.orig,e.chunks,!0),e.chunks,1),t&&b(n,y(t.orig,t.chunks,!0),t.chunks,2),n}function w(e,t){if(e.dealigned||t){if(!e.orig.curOp)return e.orig.operation(function(){w(e,t)});e.dealigned=!1;var r=e.mv.left==e?e.mv.right:e.mv.left;r&&(i(r),r.dealigned=!1);for(var n=x(e,r),o=e.mv.aligners,a=0;a<o.length;a++)o[a].clear();o.length=0;var l=[e.edit,e.orig],s=[],c=[];for(r&&l.push(r.orig),a=0;a<l.length;a++)s.push(l[a].getScrollInfo().top),c.push(-l[a].getScrollerElement().getBoundingClientRect().top);(c[0]!=c[1]||3==l.length&&c[1]!=c[2])&&_(l,c,[0,0,0],o);for(var u=0;u<n.length;u++)_(l,c,n[u],o);for(a=0;a<l.length;a++)l[a].scrollTo(null,s[a])}}function _(e,t,r,n){for(var i=-1e8,o=[],a=0;a<e.length;a++)if(null!=r[a]){var l=e[a].heightAtLine(r[a],"local")-t[a];o[a]=l,i=Math.max(i,l)}for(a=0;a<e.length;a++)if(null!=r[a]){var s=i-o[a];s>1&&n.push(k(e[a],r[a],s))}}function k(e,t,r){var n=!0;t>e.lastLine()&&(t--,n=!1);var i=document.createElement("div");return i.className="CodeMirror-merge-spacer",i.style.height=r+"px",i.style.minWidth="1px",e.addLineWidget(t,i,{height:r,above:n,mergeSpacer:!0,handleMouseEvents:!0})}function C(e,t,n,i,o){var a="left"==e.type,l=e.orig.heightAtLine(t.origFrom,"local",!0)-n;if(e.svg){var s=l,c=e.edit.heightAtLine(t.editFrom,"local",!0)-i;if(a){var u=s;s=c,c=u}var d=e.orig.heightAtLine(t.origTo,"local",!0)-n,f=e.edit.heightAtLine(t.editTo,"local",!0)-i;a&&(u=d,d=f,f=u);var h=" C "+o/2+" "+c+" "+o/2+" "+s+" "+(o+2)+" "+s,p=" C "+o/2+" "+d+" "+o/2+" "+f+" -1 "+f;q(e.svg.appendChild(document.createElementNS(r,"path")),"d","M -1 "+c+h+" L "+(o+2)+" "+d+p+" z","class",e.classes.connect)}if(e.copyButtons){var m=e.copyButtons.appendChild(P("div","left"==e.type?"⇝":"⇜","CodeMirror-merge-copy")),g=e.mv.options.allowEditingOriginals;if(m.title=e.edit.phrase(g?"Push to left":"Revert chunk"),m.chunk=t,m.style.top=(t.origTo>t.origFrom?l:e.edit.heightAtLine(t.editFrom,"local")-i)+"px",m.setAttribute("role","button"),m.setAttribute("tabindex","0"),m.setAttribute("aria-label",m.title),g){var v=e.edit.heightAtLine(t.editFrom,"local")-i,y=e.copyButtons.appendChild(P("div","right"==e.type?"⇝":"⇜","CodeMirror-merge-copy-reverse"));y.title="Push to right",y.chunk={editFrom:t.origFrom,editTo:t.origTo,origFrom:t.editFrom,origTo:t.editTo},y.style.top=v+"px","right"==e.type?y.style.left="2px":y.style.right="2px",y.setAttribute("role","button"),y.setAttribute("tabindex","0"),y.setAttribute("aria-label",y.title)}}}function S(e,r,n,i){if(!e.diffOutOfDate){var o=i.origTo>n.lastLine()?t(i.origFrom-1):t(i.origFrom,0),a=t(i.origTo,0),l=i.editTo>r.lastLine()?t(i.editFrom-1):t(i.editFrom,0),s=t(i.editTo,0),c=e.mv.options.revertChunk;c?c(e.mv,n,o,a,r,l,s):r.replaceRange(n.getRange(o,a),l,s)}}var L,M=e.MergeView=function(t,r){if(!(this instanceof M))return new M(t,r);this.options=r;var i=r.origLeft,o=null==r.origRight?r.orig:r.origRight,a=null!=i,l=null!=o,s=1+(a?1:0)+(l?1:0),c=[],u=this.left=null,d=this.right=null,f=this;if(a){u=this.left=new n(this,"left");var h=P("div",null,"CodeMirror-merge-pane CodeMirror-merge-left");c.push(h),c.push(T(u))}var p=P("div",null,"CodeMirror-merge-pane CodeMirror-merge-editor");if(c.push(p),l){d=this.right=new n(this,"right"),c.push(T(d));var m=P("div",null,"CodeMirror-merge-pane CodeMirror-merge-right");c.push(m)}(l?m:p).className+=" CodeMirror-merge-pane-rightmost",c.push(P("div",null,null,"height: 0; clear: both;"));var v=this.wrap=t.appendChild(P("div",c,"CodeMirror-merge CodeMirror-merge-"+s+"pane"));this.edit=e(p,j(r)),u&&u.init(h,i,r),d&&d.init(m,o,r),r.collapseIdentical&&this.editor().operation(function(){H(f,r.collapseIdentical)}),"align"==r.connect&&(this.aligners=[],w(this.left||this.right,!0)),u&&u.registerEvents(d),d&&d.registerEvents(u);var y=function(){u&&g(u),d&&g(d)};e.on(window,"resize",y);var b=setInterval(function(){for(var t=v.parentNode;t&&t!=document.body;t=t.parentNode);t||(clearInterval(b),e.off(window,"resize",y))},5e3)};function T(t){var n=t.lockButton=P("div",null,"CodeMirror-merge-scrolllock");n.setAttribute("role","button"),n.setAttribute("tabindex","0");var i=P("div",[n],"CodeMirror-merge-scrolllock-wrap");e.on(n,"click",function(){u(t,!t.lockScroll)}),e.on(n,"keyup",function(e){("Enter"===e.key||"Space"===e.code)&&u(t,!t.lockScroll)});var o=[i];if(!1!==t.mv.options.revertButtons){t.copyButtons=P("div",null,"CodeMirror-merge-copybuttons-"+t.type);var a=function(e){var r=e.target||e.srcElement;r.chunk&&("CodeMirror-merge-copy-reverse"!=r.className?S(t,t.edit,t.orig,r.chunk):S(t,t.orig,t.edit,r.chunk))};e.on(t.copyButtons,"click",a),e.on(t.copyButtons,"keyup",function(e){("Enter"===e.key||"Space"===e.code)&&a(e)}),o.unshift(t.copyButtons)}if("align"!=t.mv.options.connect){var l=document.createElementNS&&document.createElementNS(r,"svg");l&&!l.createSVGRect&&(l=null),t.svg=l,l&&o.push(l)}return t.gap=P("div",o,"CodeMirror-merge-gap")}function N(e){return"string"==typeof e?e:e.getValue()}function O(e,t,r){L||(L=new diff_match_patch);for(var n=L.diff_main(e,t),i=0;i<n.length;++i){var o=n[i];(r?/[^ \t]/.test(o[1]):o[1])?i&&n[i-1][0]==o[0]&&(n.splice(i--,1),n[i][1]+=o[1]):n.splice(i--,1)}return n}function A(e){var r=[];if(!e.length)return r;for(var n=0,i=0,o=t(0,0),a=t(0,0),l=0;l<e.length;++l){var s=e[l],c=s[0];if(c==DIFF_EQUAL){var u=!z(e,l)||o.line<n||a.line<i?1:0,d=o.line+u,f=a.line+u;B(o,s[1],null,a);var h=D(e,l)?1:0,p=o.line+h,m=a.line+h;p>d&&(l&&r.push({origFrom:i,origTo:f,editFrom:n,editTo:d}),n=p,i=m)}else B(c==DIFF_INSERT?o:a,s[1])}return(n<=o.line||i<=a.line)&&r.push({origFrom:i,origTo:a.line+1,editFrom:n,editTo:o.line+1}),r}function D(e,t){if(t==e.length-1)return!0;var r=e[t+1][1];return!(1==r.length&&t<e.length-2||10!=r.charCodeAt(0))&&(t==e.length-2||((r=e[t+2][1]).length>1||t==e.length-3)&&10==r.charCodeAt(0))}function z(e,t){if(0==t)return!0;var r=e[t-1][1];return 10==r.charCodeAt(r.length-1)&&(1==t||10==(r=e[t-2][1]).charCodeAt(r.length-1))}function F(e,t,r){for(var n,i,o,a,l=0;l<e.length;l++){var s=e[l],c=r?s.editFrom:s.origFrom,u=r?s.editTo:s.origTo;null==i&&(c>t?(i=s.editFrom,a=s.origFrom):u>t&&(i=s.editTo,a=s.origTo)),u<=t?(n=s.editTo,o=s.origTo):c<=t&&(n=s.editFrom,o=s.origFrom)}return{edit:{before:n,after:i},orig:{before:o,after:a}}}function E(r,n,i){r.addLineClass(n,"wrap","CodeMirror-merge-collapsed-line");var o=document.createElement("span");o.className="CodeMirror-merge-collapsed-widget",o.title=r.phrase("Identical text collapsed. Click to expand.");var a=r.markText(t(n,0),t(i-1),{inclusiveLeft:!0,inclusiveRight:!0,replacedWith:o,clearOnEnter:!0});function l(){a.clear(),r.removeLineClass(n,"wrap","CodeMirror-merge-collapsed-line")}return a.explicitlyCleared&&l(),e.on(o,"click",l),a.on("clear",l),e.on(o,"click",l),{mark:a,clear:l}}function W(e,t){var r=[];function n(){for(var e=0;e<r.length;e++)r[e].clear()}for(var i=0;i<t.length;i++){var o=t[i],a=E(o.cm,o.line,o.line+e);r.push(a),a.mark.on("clear",n)}return r[0].mark}function I(e,t,r,n){for(var i=0;i<e.chunks.length;i++)for(var o=e.chunks[i],a=o.editFrom-t;a<o.editTo+t;a++){var l=a+r;l>=0&&l<n.length&&(n[l]=!1)}}function H(e,t){"number"!=typeof t&&(t=2);for(var r=[],n=e.editor(),i=n.firstLine(),o=i,a=n.lastLine();o<=a;o++)r.push(!0);e.left&&I(e.left,t,i,r),e.right&&I(e.right,t,i,r);for(var l=0;l<r.length;l++)if(r[l]){for(var s=l+i,c=1;l<r.length-1&&r[l+1];l++,c++);if(c>t){var u=[{line:s,cm:n}];e.left&&u.push({line:v(s,e.left.chunks),cm:e.left.orig}),e.right&&u.push({line:v(s,e.right.chunks),cm:e.right.orig});var d=W(c,u);e.options.onCollapse&&e.options.onCollapse(e,s,c,d)}}}function P(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 R(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild)}function q(e){for(var t=1;t<arguments.length;t+=2)e.setAttribute(arguments[t],arguments[t+1])}function j(e,t){for(var r in t||(t={}),e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}function B(e,r,n,i){for(var o=n?t(e.line,e.ch):e,a=0;;){var l=r.indexOf("\n",a);if(-1==l)break;++o.line,i&&++i.line,a=l+1}return o.ch=(a?0:o.ch)+(r.length-a),i&&(i.ch=(a?0:i.ch)+(r.length-a)),o}M.prototype={constructor:M,editor:function(){return this.edit},rightOriginal:function(){return this.right&&this.right.orig},leftOriginal:function(){return this.left&&this.left.orig},setShowDifferences:function(e){this.right&&this.right.setShowDifferences(e),this.left&&this.left.setShowDifferences(e)},rightChunks:function(){if(this.right)return i(this.right),this.right.chunks},leftChunks:function(){if(this.left)return i(this.left),this.left.chunks}};var V=1,U=2,G=4;function $(e){this.cm=e,this.alignable=[],this.height=e.doc.height;var t=this;e.on("markerAdded",function(e,r){if(r.collapsed){var n=r.find(1);null!=n&&t.set(n.line,G)}}),e.on("markerCleared",function(e,r,n,i){null!=i&&r.collapsed&&t.check(i,G,t.hasMarker)}),e.on("markerChanged",this.signal.bind(this)),e.on("lineWidgetAdded",function(e,r,n){r.mergeSpacer||(r.above?t.set(n-1,U):t.set(n,V))}),e.on("lineWidgetCleared",function(e,r,n){r.mergeSpacer||(r.above?t.check(n-1,U,t.hasWidgetBelow):t.check(n,V,t.hasWidget))}),e.on("lineWidgetChanged",this.signal.bind(this)),e.on("change",function(e,r){var n=r.from.line,i=r.to.line-r.from.line,o=r.text.length-1,a=n+o;(i||o)&&t.map(n,i,o),t.check(a,G,t.hasMarker),(i||o)&&t.check(r.from.line,G,t.hasMarker)}),e.on("viewportChange",function(){t.cm.doc.height!=t.height&&t.signal()})}function K(e,t){return(e.line-t.line||e.ch-t.ch)<0?e:t}function X(e,t){return(e.line-t.line||e.ch-t.ch)>0?e:t}function Q(e,t){return e.line==t.line&&e.ch==t.ch}function Y(e,t,r){for(var n=e.length-1;n>=0;n--){var i=e[n],o=(r?i.origTo:i.editTo)-1;if(o<t)return o}}function Z(e,t,r){for(var n=0;n<e.length;n++){var i=e[n],o=r?i.origFrom:i.editFrom;if(o>t)return o}}function J(t,r){var n=null,o=t.state.diffViews,a=t.getCursor().line;if(o)for(var l=0;l<o.length;l++){var s=o[l],c=t==s.orig;i(s);var u=r<0?Y(s.chunks,a,c):Z(s.chunks,a,c);null==u||null!=n&&!(r<0?u>n:u<n)||(n=u)}if(null==n)return e.Pass;t.setCursor(n,0)}$.prototype={signal:function(){e.signal(this,"realign"),this.height=this.cm.doc.height},set:function(e,t){for(var r=-1;r<this.alignable.length;r+=2){var n=this.alignable[r]-e;if(0==n){if((this.alignable[r+1]&t)==t)return;return this.alignable[r+1]|=t,void this.signal()}if(n>0)break}this.signal(),this.alignable.splice(r,0,e,t)},find:function(e){for(var t=0;t<this.alignable.length;t+=2)if(this.alignable[t]==e)return t;return-1},check:function(e,t,r){var n=this.find(e);if(-1!=n&&this.alignable[n+1]&t&&!r.call(this,e)){this.signal();var i=this.alignable[n+1]&~t;i?this.alignable[n+1]=i:this.alignable.splice(n,2)}},hasMarker:function(e){var t=this.cm.getLineHandle(e);if(t.markedSpans)for(var r=0;r<t.markedSpans.length;r++)if(t.markedSpans[r].marker.collapsed&&null!=t.markedSpans[r].to)return!0;return!1},hasWidget:function(e){var t=this.cm.getLineHandle(e);if(t.widgets)for(var r=0;r<t.widgets.length;r++)if(!t.widgets[r].above&&!t.widgets[r].mergeSpacer)return!0;return!1},hasWidgetBelow:function(e){if(e==this.cm.lastLine())return!1;var t=this.cm.getLineHandle(e+1);if(t.widgets)for(var r=0;r<t.widgets.length;r++)if(t.widgets[r].above&&!t.widgets[r].mergeSpacer)return!0;return!1},map:function(e,t,r){for(var n=r-t,i=e+t,o=-1,a=-1,l=0;l<this.alignable.length;l+=2){var s=this.alignable[l];s==e&&this.alignable[l+1]&U&&(o=l),s==i&&this.alignable[l+1]&U&&(a=l),s<=e||(s<i?this.alignable.splice(l--,2):this.alignable[l]+=n)}if(o>-1){var c=this.alignable[o+1];c==U?this.alignable.splice(o,2):this.alignable[o+1]=c&~U}a>-1&&r&&this.set(e+r,U)}},e.commands.goNextDiff=function(e){return J(e,1)},e.commands.goPrevDiff=function(e){return J(e,-1)}}(C()));var A;A||(A=1,function(e){function t(e,t){if(!e.hasOwnProperty(t))throw new Error("Undefined state "+t+" in simple mode")}function r(e,t){if(!e)return/(?:)/;var r="";return e instanceof RegExp?(e.ignoreCase&&(r="i"),e.unicode&&(r+="u"),e=e.source):e=String(e),new RegExp((!1===t?"":"^")+"(?:"+e+")",r)}function n(e){if(!e)return null;if(e.apply)return e;if("string"==typeof e)return e.replace(/\./g," ");for(var t=[],r=0;r<e.length;r++)t.push(e[r]&&e[r].replace(/\./g," "));return t}function i(e,i){(e.next||e.push)&&t(i,e.next||e.push),this.regex=r(e.regex),this.token=n(e.token),this.data=e}function o(e,t){return function(r,n){if(n.pending){var i=n.pending.shift();return 0==n.pending.length&&(n.pending=null),r.pos+=i.text.length,i.token}if(n.local){if(n.local.end&&r.match(n.local.end)){var o=n.local.endToken||null;return n.local=n.localState=null,o}var a;return o=n.local.mode.token(r,n.localState),n.local.endScan&&(a=n.local.endScan.exec(r.current()))&&(r.pos=r.start+a.index),o}for(var s=e[n.state],c=0;c<s.length;c++){var u=s[c],d=(!u.data.sol||r.sol())&&r.match(u.regex);if(d){u.data.next?n.state=u.data.next:u.data.push?((n.stack||(n.stack=[])).push(n.state),n.state=u.data.push):u.data.pop&&n.stack&&n.stack.length&&(n.state=n.stack.pop()),u.data.mode&&l(t,n,u.data.mode,u.token),u.data.indent&&n.indent.push(r.indentation()+t.indentUnit),u.data.dedent&&n.indent.pop();var f=u.token;if(f&&f.apply&&(f=f(d)),d.length>2&&u.token&&"string"!=typeof u.token){for(var h=2;h<d.length;h++)d[h]&&(n.pending||(n.pending=[])).push({text:d[h],token:u.token[h-1]});return r.backUp(d[0].length-(d[1]?d[1].length:0)),f[0]}return f&&f.join?f[0]:f}}return r.next(),null}}function a(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;var r=0;for(var n in e)if(e.hasOwnProperty(n)){if(!t.hasOwnProperty(n)||!a(e[n],t[n]))return!1;r++}for(var n in t)t.hasOwnProperty(n)&&r--;return 0==r}function l(t,n,i,o){var l;if(i.persistent)for(var s=n.persistentStates;s&&!l;s=s.next)(i.spec?a(i.spec,s.spec):i.mode==s.mode)&&(l=s);var c=l?l.mode:i.mode||e.getMode(t,i.spec),u=l?l.state:e.startState(c);i.persistent&&!l&&(n.persistentStates={mode:c,spec:i.spec,state:u,next:n.persistentStates}),n.localState=u,n.local={mode:c,end:i.end&&r(i.end),endScan:i.end&&!1!==i.forceEnd&&r(i.end,!1),endToken:o&&o.join?o[o.length-1]:o}}function s(e,t){for(var r=0;r<t.length;r++)if(t[r]===e)return!0}function c(t,r){return function(n,i,o){if(n.local&&n.local.mode.indent)return n.local.mode.indent(n.localState,i,o);if(null==n.indent||n.local||r.dontIndentStates&&s(n.state,r.dontIndentStates)>-1)return e.Pass;var a=n.indent.length-1,l=t[n.state];e:for(;;){for(var c=0;c<l.length;c++){var u=l[c];if(u.data.dedent&&!1!==u.data.dedentIfLineStart){var d=u.regex.exec(i);if(d&&d[0]){a--,(u.next||u.push)&&(l=t[u.next||u.push]),i=i.slice(d[0].length);continue e}}}break}return a<0?0:n.indent[a]}}e.defineSimpleMode=function(t,r){e.defineMode(t,function(t){return e.simpleMode(t,r)})},e.simpleMode=function(r,n){t(n,"start");var a={},l=n.meta||{},s=!1;for(var u in n)if(u!=l&&n.hasOwnProperty(u))for(var d=a[u]=[],f=n[u],h=0;h<f.length;h++){var p=f[h];d.push(new i(p,n)),(p.indent||p.dedent)&&(s=!0)}var m={startState:function(){return{state:"start",pending:null,local:null,localState:null,indent:s?[]:null}},copyState:function(t){var r={state:t.state,pending:t.pending,local:t.local,localState:null,indent:t.indent&&t.indent.slice(0)};t.localState&&(r.localState=e.copyState(t.local.mode,t.localState)),t.stack&&(r.stack=t.stack.slice(0));for(var n=t.persistentStates;n;n=n.next)r.persistentStates={mode:n.mode,spec:n.spec,state:n.state==t.localState?r.localState:e.copyState(n.mode,n.state),next:r.persistentStates};return r},token:o(a,r),innerMode:function(e){return e.local&&{mode:e.local.mode,state:e.localState}},indent:c(a,l)};if(l)for(var g in l)l.hasOwnProperty(g)&&(m[g]=l[g]);return m}}(C())),!window.CodeMirror&&(window.CodeMirror=N);const D=window.CodeMirror||N,z=r({name:"DefaultMode",props:{name:{type:String,default:"cm-textarea-"+ +new Date},value:{type:String,default:""},content:{type:String,default:""},options:{type:Object,default:()=>({})},cminstance:{type:Object,default:()=>null},placeholder:{type:String,default:""}},emits:{ready:e=>e,"update:cminstance":e=>e},setup(e,{emit:t}){const r=n(),o=n(null),a=()=>{o.value=b(D.fromTextArea(r.value,e.options)),t("update:cminstance",o.value);const n=i(()=>e.cminstance,r=>{var i;r&&(null==(i=e.cminstance)||i.setValue(e.value||e.content)),t("ready",u(o)),null==n||n()},{deep:!0})};return y(()=>{a()}),{textarea:r,initialize:a}}}),F=(e,t)=>{const r=e.__vccOpts||e;for(const[n,i]of t)r[n]=i;return r},E=["name","placeholder"];const W=F(z,[["render",function(e,t,r,n,i,o){return a(),l("textarea",{ref:"textarea",name:e.$props.name,placeholder:e.$props.placeholder},null,8,E)}]]);window.diff_match_patch=t,window.DIFF_DELETE=-1,window.DIFF_INSERT=1,window.DIFF_EQUAL=0;const I=r({name:"MergeMode",props:{options:{type:Object,default:()=>({})},cminstance:{type:Object,default:()=>({})}},emits:["update:cminstance","ready"],setup(e,{emit:t}){const r=n(),i=n(),o=()=>{r.value=b(D.MergeView(i.value,e.options)),t("update:cminstance",r.value),t("ready",r)};return y(()=>{o()}),{mergeView:i,initialize:o}}}),H={ref:"mergeView"};const P=F(I,[["render",function(e,t,r,n,i,o){return a(),l("div",H,null,512)}]]);const R=[{regex:/(\[.*?\])([ \t]*)(<error>[ \t])(.+)/,token:["tag","","error.strong","error.strong"],sol:!0},{regex:/(\[.*?\])([ \t]*)(<info>)(.+)(.?)/,token:["tag","","bracket","bracket","hr"],sol:!0},{regex:/(\[.*?\])([ \t]*)(<warning>)(.+)(.?)/,token:["tag","","comment","comment","hr"],sol:!0}];D.defineSimpleMode("fclog",{start:[...R,{regex:/.*/,token:"hr"}],error:[...R,{regex:/.*/,token:"error.strong"}],info:[...R,{regex:/.*/,token:"bracket"}],warning:[...R,{regex:/.*\[/,token:"comment"}]}),D.defineSimpleMode("log",{start:[{regex:/^[=]+[^=]*[=]+/,token:"strong"},{regex:/([^\w])([A-Z][\w]*)/,token:["","string"]},{regex:/(^[A-Z][\w]*)/,token:"string"}]});const q=r({name:"CodemirrorFclog",props:{value:{type:String,default:""},name:{type:String,default:"cm-textarea-"+ +new Date},options:{type:Object,default:()=>({})},cminstance:{type:Object,default:()=>({})},placeholder:{type:String,default:""}},emits:["update:cminstance","ready"],setup(e,{emit:t}){const r=n(),o=n(null),a=(t=e.cminstance)=>{t.getAllMarks().forEach(e=>e.clear());const r=t.getValue(),n=[].concat(function(e){const t=/#link#(.+)#link#/g,r=[];let n;for(n=t.exec(e);n;){const i=document.createElement("a"),o=JSON.parse(n[1]),a=Object.entries(o);for(const[e,t]of a)i.setAttribute(e,t);i.className="editor_custom_link",i.innerHTML="logDownload",r.push({start:n.index,end:n.index+n[0].length,node:i}),n=t.exec(e)}return r}(r)).concat(function(e){const t=[];return function(){const r=/#log<(\w*)>log#((.|\r\n|\n)*?)#log<(\w*)>log#/g;let n;for(n=r.exec(e);n;){const i=n[0].replace(/\r\n/g,"\n").split("\n"),o=n[2].replace(/\r\n/g,"\n").split("\n"),a=document.createElement("span"),l=n[1];a.className=`c-editor--log__${l}`;let s=0;for(let e=0;e<i.length;e++){const r=i[e],l=o[e],c=a.cloneNode(!1);c.innerText=l,t.push({start:n.index+s,end:n.index+s+r.length,node:c}),s=s+r.length+1}n=r.exec(e)}}(),t}(r));for(let e=0;e<n.length;e++){const r=n[e];t.markText(t.posFromIndex(r.start),t.posFromIndex(r.end),{replacedWith:r.node})}},l=()=>{var n;o.value=b(D.fromTextArea(r.value,e.options)),t("update:cminstance",u(o)),null==(n=o.value)||n.on("change",a)};return i(()=>e.cminstance,r=>{var n;r&&(a(e.cminstance),null==(n=e.cminstance)||n.setValue(e.value),t("ready",o))},{deep:!0,immediate:!0}),y(()=>{l()}),{initialize:l,textarea:r}}}),j=["name","placeholder"];const B=F(q,[["render",function(e,t,r,n,i,o){return a(),l("textarea",{ref:"textarea",name:e.$props.name,placeholder:e.$props.placeholder},null,8,j)}]]),V={"update:value":()=>!0,change:(e,t)=>({value:e,cm:t}),input:()=>!0,ready:e=>e},U=["changes","scroll","beforeChange","cursorActivity","keyHandled","inputRead","electricInput","beforeSelectionChange","viewportChange","swapDoc","gutterClick","gutterContextMenu","focus","blur","refresh","optionChange","scrollCursorIntoView","update"],G={...V,...(()=>{const e={};return U.forEach(t=>{e[t]=(...e)=>e}),e})()},$={mode:"text",
// Language mode
theme:"default",
// Theme
lineNumbers:!0,
// Display line number
smartIndent:!0,
// Intelligent indentation
indentUnit:2,
// Indentation unit
styleActiveLine:!0};const K=({props:e,cminstance:t,emit:r,internalInstance:n,content:i})=>{const o=v(()=>{var r;return e.merge?null==(r=u(t))?void 0:r.editor():u(t)});return{listenerEvents:()=>{o.value.on("change",t=>{const n=t.getValue();n===i.value&&""!==n||(i.value=n,r("update:value",i.value||""),r("input",i.value||" "),Promise.resolve().then(()=>{r("change",i.value,t)}),e.keepCursorInEnd&&function(e){Promise.resolve().then(()=>{const t=e.getScrollInfo();e.scrollTo(t.left,t.height)})}(t))});const t={};(()=>{const e=[];return Object.keys(null==n?void 0:n.vnode.props).forEach(t=>{if(t.startsWith("on")){const r=t.replace(t[2],t[2].toLowerCase()).slice(2);!V[r]&&e.push(r)}}),e})().filter(e=>!t[e]&&(t[e]=!0)).forEach(e=>{o.value.on(e,(...t)=>{r(e,...t)})})}}};const X=r({__name:"index",props:{value:{type:String,default:""},options:{type:Object,default:()=>$},globalOptions:{type:Object,default:()=>$},placeholder:{type:String,default:""},border:{type:Boolean,default:!1},width:{type:[String,Number],default:null},height:{type:[String,Number],default:null},originalStyle:{type:Boolean,default:!1},keepCursorInEnd:{type:Boolean,default:!1},merge:{type:Boolean,default:!1},name:{type:String,default:""},marker:{type:Function,default:()=>null},unseenLines:{type:Array,default:()=>[]}},emits:G,setup(e,{expose:t,emit:r}){var y,b,x;"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");const t=Object(e);for(let r=1;r<arguments.length;r++){const e=arguments[r];if(null!=e)for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},writable:!0,configurable:!0});const w=e,_=r,k=n(null),C=n(""),S=p(W),L=n({foldGutter:!0,...$,...w.globalOptions,...w.options,gutters:[...new Set(["CodeMirror-linenumbers","CodeMirror-foldgutter",...(null==(y=w.options)?void 0:y.gutters)||[]])]}),M=m(),T=w.name||(null==(x=null==(b=null==M?void 0:M.parent)?void 0:b.type)?void 0:x.name)||void 0,N=n(null),O=v(()=>{var e;return w.merge?null==(e=u(k))?void 0:e.editor():u(k)}),{refresh:A,resize:D,destroy:z,containerHeight:F,containerWidth:E,reviseStyle:I}=function({props:e,cminstance:t,presetRef:r}){const i=n("100%"),o=n("100%"),a=v(()=>{var r;return e.merge?null==(r=u(t))?void 0:r.editor():u(t)}),l=()=>{g(()=>{var e;null==(e=a.value)||e.refresh()})},s=e=>!(!e||e&&isNaN(+e)),c=()=>{var e;const t=null==(e=a.value)?void 0:e.getWrapperElement();null==t||t.remove()},d=()=>{const e=document.querySelector(".CodeMirror-gutters");return"0"!==(null==e?void 0:e.style.left.replace("px",""))};return{reload:()=>{var e,t,n;const i=null==(e=a.value)?void 0:e.getDoc().getHistory();null==(t=r.value)||t.initialize(),c(),null==(n=a.value)||n.getDoc().setHistory(i)},refresh:l,resize:(t=e.width,r=e.height)=>{var n;let l="100%",c="100%";s(t)?l=`${String(t)}px`:t&&(l=t),s(r)?c=`${String(r)}px`:r&&(c=r),i.value=l,o.value=c,null==(n=a.value)||n.setSize("100%","100%")},destroy:c,containerWidth:i,containerHeight:o,reviseStyle:()=>{if(l(),!d())return;const e=setInterval(()=>{d()?l():clearInterval(e)},60),t=setTimeout(()=>{clearInterval(e),clearTimeout(t)},400)}}}({props:w,cminstance:k,presetRef:N}),{listenerEvents:H}=K({props:w,cminstance:k,emit:_,internalInstance:M,content:C}),R=()=>{void 0!==w.unseenLines&&void 0!==w.marker&&w.unseenLines.forEach(e=>{var t,r;const n=null==(t=k.value)?void 0:t.lineInfo(e);null==(r=k.value)||r.setGutterMarker(e,"breakpoints",null!=n&&n.gutterMarkers?null:w.marker())})},q=()=>{H(),R(),D(w.width,w.height),_("ready",k.value),i([()=>w.width,()=>w.height],([e,t])=>{D(e,t)},{deep:!0})};return i(()=>w.options,e=>{var t;for(const r in w.options)null==(t=O.value)||t.setOption(r,u(e[r]))},{deep:!0}),i(()=>w.value,e=>{(e=>{var t,r;e!==(null==(t=k.value)?void 0:t.getValue())&&(null==(r=k.value)||r.setValue(e),C.value=e,I()),R()})(e)}),i(()=>w.merge,()=>{"fclog"!==w.options.mode&&"log"!==w.options.mode?w.merge?S.value=P:S.value=W:S.value=B},{immediate:!0}),o(()=>{z()}),t({cminstance:k,resize:D,refresh:A,destroy:z}),(e,t)=>(a(),l("div",{class:h(["codemirror-container",{merge:e.$props.merge,bordered:e.$props.border||e.$props.merge&&!w.originalStyle,"original-style":w.originalStyle}]),style:f({height:u(F),width:u(E)})},[(a(),s(d(S.value),c({ref_key:"presetRef",ref:N,cminstance:k.value,"onUpdate:cminstance":t[0]||(t[0]=e=>k.value=e),style:{height:"100%"}},{...e.$props,...e.$attrs,options:L.value,name:u(T),content:C.value},{onReady:q}),null,16,["cminstance"]))],6))}}),Q=(e,t)=>(t&&t.options&&(X.props.globalOptions.default=()=>t.options),e.component((null==t?void 0:t.componentName)||"Codemirror",X),e);!function(e,t){void 0===t&&(t={});var r=t.insertAt;if("undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===r&&n.firstChild?n.insertBefore(i,n.firstChild):n.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}(".codemirror-container {\n position: relative;\n display: inline-block;\n height: 100%;\n width: fit-content;\n font-size: 13px;\n overflow: hidden;\n}\n.codemirror-container.bordered {\n border: 1px solid #aaaaaa;\n}\n\n.codemirror-container .editor_custom_link {\n cursor: pointer;\n color: #1474f1;\n text-decoration: underline;\n}\n.codemirror-container .editor_custom_link:hover {\n color: #04b4fa;\n}\n.codemirror-container:not(.original-style) .CodeMirror-lines .CodeMirror-placeholder.CodeMirror-line-like {\n color: #666;\n}\n.codemirror-container:not(.original-style) .CodeMirror,\n.codemirror-container:not(.original-style) .CodeMirror-merge-pane {\n height: 100%;\n font-family: consolas !important;\n}\n.codemirror-container:not(.original-style) .CodeMirror-merge,\n.codemirror-container:not(.original-style) .CodeMirror-merge-right .CodeMirror {\n height: 100%;\n border: none !important;\n}\n.codemirror-container:not(.original-style) .c-editor--log__error {\n color: #bb0606;\n font-weight: bold;\n}\n.codemirror-container:not(.original-style) .c-editor--log__info {\n color: #333333;\n font-weight: bold;\n}\n.codemirror-container:not(.original-style) .c-editor--log__warning {\n color: #ee9900;\n}\n.codemirror-container:not(.original-style) .c-editor--log__success {\n color: #669600;\n}\n.codemirror-container:not(.original-style) .cm-header,\n.codemirror-container:not(.original-style) .cm-strong {\n font-weight: bold;\n}\n");var Y,Z;Y||(Y=1,(Z=C()).defineMode("javascript",function(e,t){var r,n,i=e.indentUnit,o=t.statementIndent,a=t.jsonld,l=t.json||a,s=!1!==t.trackScope,c=t.typescript,u=t.wordCharacters||/[\w$\xa1-\uffff]/,d=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),r=e("keyword b"),n=e("keyword c"),i=e("keyword d"),o=e("operator"),a={type:"atom",style:"atom"};return{if:e("if"),while:t,with:t,else:r,do:r,try:r,finally:r,return:i,break:i,continue:i,new:e("new"),delete:n,void:n,throw:n,debugger:e("debugger"),var:e("var"),const:e("var"),let:e("var"),function:e("function"),catch:e("catch"),for:e("for"),switch:e("switch"),case:e("case"),default:e("default"),in:o,typeof:o,instanceof:o,true:a,false:a,null:a,undefined:a,NaN:a,Infinity:a,this:e("this"),class:e("class"),super:e("atom"),yield:n,export:e("export"),import:e("import"),extends:n,await:n}}(),f=/[+\-*&%=<>!?|~^@]/,h=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function p(e){for(var t,r=!1,n=!1;null!=(t=e.next());){if(!r){if("/"==t&&!n)return;"["==t?n=!0:n&&"]"==t&&(n=!1)}r=!r&&"\\"==t}}function m(e,t,i){return r=e,n=i,t}function g(e,t){var r=e.next();if('"'==r||"'"==r)return t.tokenize=v(r),t.tokenize(e,t);if("."==r&&e.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return m("number","number");if("."==r&&e.match(".."))return m("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(r))return m(r);if("="==r&&e.eat(">"))return m("=>","operator");if("0"==r&&e.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return m("number","number");if(/\d/.test(r))return e.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),m("number","number");if("/"==r)return e.eat("*")?(t.tokenize=y,y(e,t)):e.eat("/")?(e.skipToEnd(),m("comment","comment")):it(e,t,1)?(p(e),e.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),m("regexp","string-2")):(e.eat("="),m("operator","operator",e.current()));if("`"==r)return t.tokenize=b,b(e,t);if("#"==r&&"!"==e.peek())return e.skipToEnd(),m("meta","meta");if("#"==r&&e.eatWhile(u))return m("variable","property");if("<"==r&&e.match("!--")||"-"==r&&e.match("->")&&!/\S/.test(e.string.slice(0,e.start)))return e.skipToEnd(),m("comment","comment");if(f.test(r))return">"==r&&t.lexical&&">"==t.lexical.type||(e.eat("=")?"!"!=r&&"="!=r||e.eat("="):/[<>*+\-|&?]/.test(r)&&(e.eat(r),">"==r&&e.eat(r))),"?"==r&&e.eat(".")?m("."):m("operator","operator",e.current());if(u.test(r)){e.eatWhile(u);var n=e.current();if("."!=t.lastType){if(d.propertyIsEnumerable(n)){var i=d[n];return m(i.type,i.style,n)}if("async"==n&&e.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return m("async","keyword",n)}return m("variable","variable",n)}}function v(e){return function(t,r){var n,i=!1;if(a&&"@"==t.peek()&&t.match(h))return r.tokenize=g,m("jsonld-keyword","meta");for(;null!=(n=t.next())&&(n!=e||i);)i=!i&&"\\"==n;return i||(r.tokenize=g),m("string","string")}}function y(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=g;break}n="*"==r}return m("comment","comment")}function b(e,t){for(var r,n=!1;null!=(r=e.next());){if(!n&&("`"==r||"$"==r&&e.eat("{"))){t.tokenize=g;break}n=!n&&"\\"==r}return m("quasi","string-2",e.current())}var x="([{}])";function w(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var r=e.string.indexOf("=>",e.start);if(!(r<0)){if(c){var n=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(e.string.slice(e.start,r));n&&(r=n.index)}for(var i=0,o=!1,a=r-1;a>=0;--a){var l=e.string.charAt(a),s=x.indexOf(l);if(s>=0&&s<3){if(!i){++a;break}if(0==--i){"("==l&&(o=!0);break}}else if(s>=3&&s<6)++i;else if(u.test(l))o=!0;else if(/["'\/`]/.test(l))for(;;--a){if(0==a)return;if(e.string.charAt(a-1)==l&&"\\"!=e.string.charAt(a-2)){a--;break}}else if(o&&!i){++a;break}}o&&!i&&(t.fatArrowAt=a)}}var _={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function k(e,t,r,n,i,o){this.indented=e,this.column=t,this.type=r,this.prev=i,this.info=o,null!=n&&(this.align=n)}function C(e,t){if(!s)return!1;for(var r=e.localVars;r;r=r.next)if(r.name==t)return!0;for(var n=e.context;n;n=n.prev)for(r=n.vars;r;r=r.next)if(r.name==t)return!0}function S(e,t,r,n,i){var o=e.cc;for(L.state=e,L.stream=i,L.marked=null,L.cc=o,L.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;)if((o.length?o.pop():l?V:j)(r,n)){for(;o.length&&o[o.length-1].lex;)o.pop()();return L.marked?L.marked:"variable"==r&&C(e,n)?"variable-2":t}}var L={state:null,marked:null,cc:null};function M(){for(var e=arguments.length-1;e>=0;e--)L.cc.push(arguments[e])}function T(){return M.apply(null,arguments),!0}function N(e,t){for(var r=t;r;r=r.next)if(r.name==e)return!0;return!1}function O(e){var r=L.state;if(L.marked="def",s){if(r.context)if("var"==r.lexical.info&&r.context&&r.context.block){var n=A(e,r.context);if(null!=n)return void(r.context=n)}else if(!N(e,r.localVars))return void(r.localVars=new F(e,r.localVars));t.globalVars&&!N(e,r.globalVars)&&(r.globalVars=new F(e,r.globalVars))}}function A(e,t){if(t){if(t.block){var r=A(e,t.prev);return r?r==t.prev?t:new z(r,t.vars,!0):null}return N(e,t.vars)?t:new z(t.prev,new F(e,t.vars),!1)}return null}function D(e){return"public"==e||"private"==e||"protected"==e||"abstract"==e||"readonly"==e}function z(e,t,r){this.prev=e,this.vars=t,this.block=r}function F(e,t){this.name=e,this.next=t}var E=new F("this",new F("arguments",null));function W(){L.state.context=new z(L.state.context,L.state.localVars,!1),L.state.localVars=E}function I(){L.state.context=new z(L.state.context,L.state.localVars,!0),L.state.localVars=null}function H(){L.state.localVars=L.state.context.vars,L.state.context=L.state.context.prev}function P(e,t){var r=function(){var r=L.state,n=r.indented;if("stat"==r.lexical.type)n=r.lexical.indented;else for(var i=r.lexical;i&&")"==i.type&&i.align;i=i.prev)n=i.indented;r.lexical=new k(n,L.stream.column(),e,null,r.lexical,t)};return r.lex=!0,r}function R(){var e=L.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function q(e){function t(r){return r==e?T():";"==e||"}"==r||")"==r||"]"==r?M():T(t)}return t}function j(e,t){return"var"==e?T(P("vardef",t),Te,q(";"),R):"keyword a"==e?T(P("form"),G,j,R):"keyword b"==e?T(P("form"),j,R):"keyword d"==e?L.stream.match(/^\s*$/,!1)?T():T(P("stat"),K,q(";"),R):"debugger"==e?T(q(";")):"{"==e?T(P("}"),I,fe,R,H):";"==e?T():"if"==e?("else"==L.state.lexical.info&&L.state.cc[L.state.cc.length-1]==R&&L.state.cc.pop()(),T(P("form"),G,j,R,Fe)):"function"==e?T(He):"for"==e?T(P("form"),I,Ee,j,H,R):"class"==e||c&&"interface"==t?(L.marked="keyword",T(P("form","class"==e?e:t),Be,R)):"variable"==e?c&&"declare"==t?(L.marked="keyword",T(j)):c&&("module"==t||"enum"==t||"type"==t)&&L.stream.match(/^\s*\w/,!1)?(L.marked="keyword","enum"==t?T(tt):"type"==t?T(Re,q("operator"),ve,q(";")):T(P("form"),Ne,q("{"),P("}"),fe,R,R)):c&&"namespace"==t?(L.marked="keyword",T(P("form"),V,j,R)):c&&"abstract"==t?(L.marked="keyword",T(j)):T(P("stat"),oe):"switch"==e?T(P("form"),G,q("{"),P("}","switch"),I,fe,R,R,H):"case"==e?T(V,q(":")):"default"==e?T(q(":")):"catch"==e?T(P("form"),W,B,j,R,H):"export"==e?T(P("stat"),$e,R):"import"==e?T(P("stat"),Xe,R):"async"==e?T(j):"@"==t?T(V,j):M(P("stat"),V,q(";"),R)}function B(e){if("("==e)return T(qe,q(")"))}function V(e,t){return $(e,t,!1)}function U(e,t){return $(e,t,!0)}function G(e){return"("!=e?M():T(P(")"),K,q(")"),R)}function $(e,t,r){if(L.state.fatArrowAt==L.stream.start){var n=r?te:ee;if("("==e)return T(W,P(")"),ue(qe,")"),R,q("=>"),n,H);if("variable"==e)return M(W,Ne,q("=>"),n,H)}var i=r?Q:X;return _.hasOwnProperty(e)?T(i):"function"==e?T(He,i):"class"==e||c&&"interface"==t?(L.marked="keyword",T(P("form"),je,R)):"keyword c"==e||"async"==e?T(r?U:V):"("==e?T(P(")"),K,q(")"),R,i):"operator"==e||"spread"==e?T(r?U:V):"["==e?T(P("]"),et,R,i):"{"==e?de(le,"}",null,i):"quasi"==e?M(Y,i):"new"==e?T(re(r)):T()}function K(e){return e.match(/[;\}\)\],]/)?M():M(V)}function X(e,t){return","==e?T(K):Q(e,t,!1)}function Q(e,t,r){var n=0==r?X:Q,i=0==r?V:U;return"=>"==e?T(W,r?te:ee,H):"operator"==e?/\+\+|--/.test(t)||c&&"!"==t?T(n):c&&"<"==t&&L.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?T(P(">"),ue(ve,">"),R,n):"?"==t?T(V,q(":"),i):T(i):"quasi"==e?M(Y,n):";"!=e?"("==e?de(U,")","call",n):"."==e?T(ae,n):"["==e?T(P("]"),K,q("]"),R,n):c&&"as"==t?(L.marked="keyword",T(ve,n)):"regexp"==e?(L.state.lastType=L.marked="operator",L.stream.backUp(L.stream.pos-L.stream.start-1),T(i)):void 0:void 0}function Y(e,t){return"quasi"!=e?M():"${"!=t.slice(t.length-2)?T(Y):T(K,J)}function J(e){if("}"==e)return L.marked="string-2",L.state.tokenize=b,T(Y)}function ee(e){return w(L.stream,L.state),M("{"==e?j:V)}function te(e){return w(L.stream,L.state),M("{"==e?j:U)}function re(e){return function(t){return"."==t?T(e?ie:ne):"variable"==t&&c?T(Se,e?Q:X):M(e?U:V)}}function ne(e,t){if("target"==t)return L.marked="keyword",T(X)}function ie(e,t){if("target"==t)return L.marked="keyword",T(Q)}function oe(e){return":"==e?T(R,j):M(X,q(";"),R)}function ae(e){if("variable"==e)return L.marked="property",T()}function le(e,t){return"async"==e?(L.marked="property",T(le)):"variable"==e||"keyword"==L.style?(L.marked="property","get"==t||"set"==t?T(se):(c&&L.state.fatArrowAt==L.stream.start&&(r=L.stream.match(/^\s*:\s*/,!1))&&(L.state.fatArrowAt=L.stream.pos+r[0].length),T(ce))):"number"==e||"string"==e?(L.marked=a?"property":L.style+" property",T(ce)):"jsonld-keyword"==e?T(ce):c&&D(t)?(L.marked="keyword",T(le)):"["==e?T(V,he,q("]"),ce):"spread"==e?T(U,ce):"*"==t?(L.marked="keyword",T(le)):":"==e?M(ce):void 0;var r}function se(e){return"variable"!=e?M(ce):(L.marked="property",T(He))}function ce(e){return":"==e?T(U):"("==e?M(He):void 0}function ue(e,t,r){function n(i,o){if(r?r.indexOf(i)>-1:","==i){var a=L.state.lexical;return"call"==a.info&&(a.pos=(a.pos||0)+1),T(function(r,n){return r==t||n==t?M():M(e)},n)}return i==t||o==t?T():r&&r.indexOf(";")>-1?M(e):T(q(t))}return function(r,i){return r==t||i==t?T():M(e,n)}}function de(e,t,r){for(var n=3;n<arguments.length;n++)L.cc.push(arguments[n]);return T(P(t,r),ue(e,t),R)}function fe(e){return"}"==e?T():M(j,fe)}function he(e,t){if(c){if(":"==e)return T(ve);if("?"==t)return T(he)}}function pe(e,t){if(c&&(":"==e||"in"==t))return T(ve)}function me(e){if(c&&":"==e)return L.stream.match(/^\s*\w+\s+is\b/,!1)?T(V,ge,ve):T(ve)}function ge(e,t){if("is"==t)return L.marked="keyword",T()}function ve(e,t){return"keyof"==t||"typeof"==t||"infer"==t||"readonly"==t?(L.marked="keyword",T("typeof"==t?U:ve)):"variable"==e||"void"==t?(L.marked="type",T(Ce)):"|"==t||"&"==t?T(ve):"string"==e||"number"==e||"atom"==e?T(Ce):"["==e?T(P("]"),ue(ve,"]",","),R,Ce):"{"==e?T(P("}"),be,R,Ce):"("==e?T(ue(ke,")"),ye,Ce):"<"==e?T(ue(ve,">"),ve):"quasi"==e?M(we,Ce):void 0}function ye(e){if("=>"==e)return T(ve)}function be(e){return e.match(/[\}\)\]]/)?T():","==e||";"==e?T(be):M(xe,be)}function xe(e,t){return"variable"==e||"keyword"==L.style?(L.marked="property",T(xe)):"?"==t||"number"==e||"string"==e?T(xe):":"==e?T(ve):"["==e?T(q("variable"),pe,q("]"),xe):"("==e?M(Pe,xe):e.match(/[;\}\)\],]/)?void 0:T()}function we(e,t){return"quasi"!=e?M():"${"!=t.slice(t.length-2)?T(we):T(ve,_e)}function _e(e){if("}"==e)return L.marked="string-2",L.state.tokenize=b,T(we)}function ke(e,t){return"variable"==e&&L.stream.match(/^\s*[?:]/,!1)||"?"==t?T(ke):":"==e?T(ve):"spread"==e?T(ke):M(ve)}function Ce(e,t){return"<"==t?T(P(">"),ue(ve,">"),R,Ce):"|"==t||"."==e||"&"==t?T(ve):"["==e?T(ve,q("]"),Ce):"extends"==t||"implements"==t?(L.marked="keyword",T(ve)):"?"==t?T(ve,q(":"),ve):void 0}function Se(e,t){if("<"==t)return T(P(">"),ue(ve,">"),R,Ce)}function Le(){return M(ve,Me)}function Me(e,t){if("="==t)return T(ve)}function Te(e,t){return"enum"==t?(L.marked="keyword",T(tt)):M(Ne,he,De,ze)}function Ne(e,t){return c&&D(t)?(L.marked="keyword",T(Ne)):"variable"==e?(O(t),T()):"spread"==e?T(Ne):"["==e?de(Ae,"]"):"{"==e?de(Oe,"}"):void 0}function Oe(e,t){return"variable"!=e||L.stream.match(/^\s*:/,!1)?("variable"==e&&(L.marked="property"),"spread"==e?T(Ne):"}"==e?M():"["==e?T(V,q("]"),q(":"),Oe):T(q(":"),Ne,De)):(O(t),T(De))}function Ae(){return M(Ne,De)}function De(e,t){if("="==t)return T(U)}function ze(e){if(","==e)return T(Te)}function Fe(e,t){if("keyword b"==e&&"else"==t)return T(P("form","else"),j,R)}function Ee(e,t){return"await"==t?T(Ee):"("==e?T(P(")"),We,R):void 0}function We(e){return"var"==e?T(Te,Ie):"variable"==e?T(Ie):M(Ie)}function Ie(e,t){return")"==e?T():";"==e?T(Ie):"in"==t||"of"==t?(L.marked="keyword",T(V,Ie)):M(V,Ie)}function He(e,t){return"*"==t?(L.marked="keyword",T(He)):"variable"==e?(O(t),T(He)):"("==e?T(W,P(")"),ue(qe,")"),R,me,j,H):c&&"<"==t?T(P(">"),ue(Le,">"),R,He):void 0}function Pe(e,t){return"*"==t?(L.marked="keyword",T(Pe)):"variable"==e?(O(t),T(Pe)):"("==e?T(W,P(")"),ue(qe,")"),R,me,H):c&&"<"==t?T(P(">"),ue(Le,">"),R,Pe):void 0}function Re(e,t){return"keyword"==e||"variable"==e?(L.marked="type",T(Re)):"<"==t?T(P(">"),ue(Le,">"),R):void 0}function qe(e,t){return"@"==t&&T(V,qe),"spread"==e?T(qe):c&&D(t)?(L.marked="keyword",T(qe)):c&&"this"==e?T(he,De):M(Ne,he,De)}function je(e,t){return"variable"==e?Be(e,t):Ve(e,t)}function Be(e,t){if("variable"==e)return O(t),T(Ve)}function Ve(e,t){return"<"==t?T(P(">"),ue(Le,">"),R,Ve):"extends"==t||"implements"==t||c&&","==e?("implements"==t&&(L.marked="keyword"),T(c?ve:V,Ve)):"{"==e?T(P("}"),Ue,R):void 0}function Ue(e,t){return"async"==e||"variable"==e&&("static"==t||"get"==t||"set"==t||c&&D(t))&&L.stream.match(/^\s+#?[\w$\xa1-\uffff]/,!1)?(L.marked="keyword",T(Ue)):"variable"==e||"keyword"==L.style?(L.marked="property",T(Ge,Ue)):"number"==e||"string"==e?T(Ge,Ue):"["==e?T(V,he,q("]"),Ge,Ue):"*"==t?(L.marked="keyword",T(Ue)):c&&"("==e?M(Pe,Ue):";"==e||","==e?T(Ue):"}"==e?T():"@"==t?T(V,Ue):void 0}function Ge(e,t){if("!"==t)return T(Ge);if("?"==t)return T(Ge);if(":"==e)return T(ve,De);if("="==t)return T(U);var r=L.state.lexical.prev;return M(r&&"interface"==r.info?Pe:He)}function $e(e,t){return"*"==t?(L.marked="keyword",T(Je,q(";"))):"default"==t?(L.marked="keyword",T(V,q(";"))):"{"==e?T(ue(Ke,"}"),Je,q(";")):M(j)}function Ke(e,t){return"as"==t?(L.marked="keyword",T(q("variable"))):"variable"==e?M(U,Ke):void 0}function Xe(e){return"string"==e?T():"("==e?M(V):"."==e?M(X):M(Qe,Ye,Je)}function Qe(e,t){return"{"==e?de(Qe,"}"):("variable"==e&&O(t),"*"==t&&(L.marked="keyword"),T(Ze))}function Ye(e){if(","==e)return T(Qe,Ye)}function Ze(e,t){if("as"==t)return L.marked="keyword",T(Qe)}function Je(e,t){if("from"==t)return L.marked="keyword",T(V)}function et(e){return"]"==e?T():M(ue(U,"]"))}function tt(){return M(P("form"),Ne,q("{"),P("}"),ue(rt,"}"),R,R)}function rt(){return M(Ne,De)}function nt(e,t){return"operator"==e.lastType||","==e.lastType||f.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}function it(e,t,r){return t.tokenize==g&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(t.lastType)||"quasi"==t.lastType&&/\{\s*$/.test(e.string.slice(0,e.pos-(r||0)))}return W.lex=I.lex=!0,H.lex=!0,R.lex=!0,{startState:function(e){var r={tokenize:g,lastType:"sof",cc:[],lexical:new k((e||0)-i,0,"block",!1),localVars:t.localVars,context:t.localVars&&new z(null,null,!1),indented:e||0};return t.globalVars&&"object"==typeof t.globalVars&&(r.globalVars=t.globalVars),r},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),w(e,t)),t.tokenize!=y&&e.eatSpace())return null;var i=t.tokenize(e,t);return"comment"==r?i:(t.lastType="operator"!=r||"++"!=n&&"--"!=n?r:"incdec",S(t,i,r,n,e))},indent:function(e,r){if(e.tokenize==y||e.tokenize==b)return Z.Pass;if(e.tokenize!=g)return 0;var n,a=r&&r.charAt(0),l=e.lexical;if(!/^\s*else\b/.test(r))for(var s=e.cc.length-1;s>=0;--s){var c=e.cc[s];if(c==R)l=l.prev;else if(c!=Fe&&c!=H)break}for(;("stat"==l.type||"form"==l.type)&&("}"==a||(n=e.cc[e.cc.length-1])&&(n==X||n==Q)&&!/^[,\.=+\-*:?[\(]/.test(r));)l=l.prev;o&&")"==l.type&&"stat"==l.prev.type&&(l=l.prev);var u=l.type,d=a==u;return"vardef"==u?l.indented+("operator"==e.lastType||","==e.lastType?l.info.length+1:0):"form"==u&&"{"==a?l.indented:"form"==u?l.indented+i:"stat"==u?l.indented+(nt(e,r)?o||i:0):"switch"!=l.info||d||0==t.doubleIndentSwitch?l.align?l.column+(d?0:1):l.indented+(d?0:i):l.indented+(/^(?:case|default)\b/.test(r)?i:2*i)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:l?null:"/*",blockCommentEnd:l?null:"*/",blockCommentContinue:l?null:" * ",lineComment:l?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:l?"json":"javascript",jsonldMode:a,jsonMode:l,expressionAllowed:it,skipExpression:function(e){S(e,"atom","atom","true",new Z.StringStream("",2,null))}}}),Z.registerHelper("wordChars","javascript",/[\w$]/),Z.defineMIME("text/javascript","javascript"),Z.defineMIME("text/ecmascript","javascript"),Z.defineMIME("application/javascript","javascript"),Z.defineMIME("application/x-javascript","javascript"),Z.defineMIME("application/ecmascript","javascript"),Z.defineMIME("application/json",{name:"javascript",json:!0}),Z.defineMIME("application/x-json",{name:"javascript",json:!0}),Z.defineMIME("application/manifest+json",{name:"javascript",json:!0}),Z.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),Z.defineMIME("text/typescript",{name:"javascript",typescript:!0}),Z.defineMIME("application/typescript",{name:"javascript",typescript:!0}));var J;J||(J=1,function(e){function t(e){for(var t;null!=(t=e.next());)if("`"==t&&!e.eat("`"))return"variable-2";return e.backUp(e.current().length-1),e.eatWhile(/\w/)?"variable-2":null}function r(e){for(var t;null!=(t=e.next());)if('"'==t&&!e.eat('"'))return"variable-2";return e.backUp(e.current().length-1),e.eatWhile(/\w/)?"variable-2":null}function n(e){return e.eat("@")&&(e.match("session."),e.match("local."),e.match("global.")),e.eat("'")?(e.match(/^.*'/),"variable-2"):e.eat('"')?(e.match(/^.*"/),"variable-2"):e.eat("`")?(e.match(/^.*`/),"variable-2"):e.match(/^[0-9a-zA-Z$\.\_]+/)?"variable-2":null}function i(e){return e.eat("N")?"atom":e.match(/^[a-zA-Z.#!?]/)?"variable-2":null}e.defineMode("sql",function(t,r){var n=r.client||{},i=r.atoms||{false:!0,true:!0,null:!0},s=r.builtin||a(l),c=r.keywords||a(o),u=r.operatorChars||/^[*+\-%<>!=&|~^\/]/,d=r.support||{},f=r.hooks||{},h=r.dateSQL||{date:!0,time:!0,timestamp:!0},p=!1!==r.backslashStringEscapes,m=r.brackets||/^[\{}\(\)\[\]]/,g=r.punctuation||/^[;.,:]/;function v(e,t){var r=e.next();if(f[r]){var o=f[r](e,t);if(!1!==o)return o}if(d.hexNumber&&("0"==r&&e.match(/^[xX][0-9a-fA-F]+/)||("x"==r||"X"==r)&&e.match(/^'[0-9a-fA-F]*'/)))return"number";if(d.binaryNumber&&(("b"==r||"B"==r)&&e.match(/^'[01]*'/)||"0"==r&&e.match(/^b[01]+/)))return"number";if(r.charCodeAt(0)>47&&r.charCodeAt(0)<58)return e.match(/^[0-9]*(\.[0-9]+)?([eE][-+]?[0-9]+)?/),d.decimallessFloat&&e.match(/^\.(?!\.)/),"number";if("?"==r&&(e.eatSpace()||e.eol()||e.eat(";")))return"variable-3";if("'"==r||'"'==r&&d.doubleQuote)return t.tokenize=y(r),t.tokenize(e,t);if((d.nCharCast&&("n"==r||"N"==r)||d.charsetCast&&"_"==r&&e.match(/[a-z][a-z0-9]*/i))&&("'"==e.peek()||'"'==e.peek()))return"keyword";if(d.escapeConstant&&("e"==r||"E"==r)&&("'"==e.peek()||'"'==e.peek()&&d.doubleQuote))return t.tokenize=function(e,t){return(t.tokenize=y(e.next(),!0))(e,t)},"keyword";if(d.commentSlashSlash&&"/"==r&&e.eat("/"))return e.skipToEnd(),"comment";if(d.commentHash&&"#"==r||"-"==r&&e.eat("-")&&(!d.commentSpaceRequired||e.eat(" ")))return e.skipToEnd(),"comment";if("/"==r&&e.eat("*"))return t.tokenize=b(1),t.tokenize(e,t);if("."!=r){if(u.test(r))return e.eatWhile(u),"operator";if(m.test(r))return"bracket";if(g.test(r))return e.eatWhile(g),"punctuation";if("{"==r&&(e.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/)||e.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/)))return"number";e.eatWhile(/^[_\w\d]/);var a=e.current().toLowerCase();return h.hasOwnProperty(a)&&(e.match(/^( )+'[^']*'/)||e.match(/^( )+"[^"]*"/))?"number":i.hasOwnProperty(a)?"atom":s.hasOwnProperty(a)?"type":c.hasOwnProperty(a)?"keyword":n.hasOwnProperty(a)?"builtin":null}return d.zerolessFloat&&e.match(/^(?:\d+(?:e[+-]?\d+)?)/i)?"number":e.match(/^\.+/)?null:e.match(/^[\w\d_$#]+/)?"variable-2":void 0}function y(e,t){return function(r,n){for(var i,o=!1;null!=(i=r.next());){if(i==e&&!o){n.tokenize=v;break}o=(p||t)&&!o&&"\\"==i}return"string"}}function b(e){return function(t,r){var n=t.match(/^.*?(\/\*|\*\/)/);return n?"/*"==n[1]?r.tokenize=b(e+1):r.tokenize=e>1?b(e-1):v:t.skipToEnd(),"comment"}}function x(e,t,r){t.context={prev:t.context,indent:e.indentation(),col:e.column(),type:r}}function w(e){e.indent=e.context.indent,e.context=e.context.prev}return{startState:function(){return{tokenize:v,context:null}},token:function(e,t){if(e.sol()&&t.context&&null==t.context.align&&(t.context.align=!1),t.tokenize==v&&e.eatSpace())return null;var r=t.tokenize(e,t);if("comment"==r)return r;t.context&&null==t.context.align&&(t.context.align=!0);var n=e.current();return"("==n?x(e,t,")"):"["==n?x(e,t,"]"):t.context&&t.context.type==n&&w(t),r},indent:function(r,n){var i=r.context;if(!i)return e.Pass;var o=n.charAt(0)==i.type;return i.align?i.col+(o?0:1):i.indent+(o?0:t.indentUnit)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:d.commentSlashSlash?"//":d.commentHash?"#":"--",closeBrackets:"()[]{}''\"\"``",config:r}});var o="alter and as asc between by count create delete desc distinct drop from group having in insert into is join like not on or order select set table union update values where limit ";function a(e){for(var t={},r=e.split(" "),n=0;n<r.length;++n)t[r[n]]=!0;return t}var l="bool boolean bit blob enum long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision real date datetime year unsigned signed decimal numeric";e.defineMIME("text/x-sql",{name:"sql",keywords:a(o+"begin"),builtin:a(l),atoms:a("false true null unknown"),dateSQL:a("date time timestamp"),support:a("doubleQuote binaryNumber hexNumber")}),e.defineMIME("text/x-mssql",{name:"sql",client:a("$partition binary_checksum checksum connectionproperty context_info current_request_id error_line error_message error_number error_procedure error_severity error_state formatmessage get_filestream_transaction_context getansinull host_id host_name isnull isnumeric min_active_rowversion newid newsequentialid rowcount_big xact_state object_id"),keywords:a(o+"begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered declare exec go if use index holdlock nolock nowait paglock readcommitted readcommittedlock readpast readuncommitted repeatableread rowlock serializable snapshot tablock tablockx updlock with"),builtin:a("bigint numeric bit smallint decimal smallmoney int tinyint money float real char varchar text nchar nvarchar ntext binary varbinary image cursor timestamp hierarchyid uniqueidentifier sql_variant xml table "),atoms:a("is not null like and or in left right between inner outer join all any some cross unpivot pivot exists"),operatorChars:/^[*+\-%<>!=^\&|\/]/,brackets:/^[\{}\(\)]/,punctuation:/^[;.,:/]/,backslashStringEscapes:!1,dateSQL:a("date datetimeoffset datetime2 smalldatetime datetime time"),hooks:{"@":n}}),e.defineMIME("text/x-mysql",{name:"sql",client:a("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:a(o+"accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general get global grant grants group group_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:a("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:a("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:a("date time timestamp"),support:a("decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":n,"`":t,"\\":i}}),e.defineMIME("text/x-mariadb",{name:"sql",client:a("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:a(o+"accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated get global grant grants group group_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show shutdown signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:a("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:a("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:a("date time timestamp"),support:a("decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":n,"`":t,"\\":i}}),e.defineMIME("text/x-sqlite",{name:"sql",
// commands of the official SQLite client, ref: https://www.sqlite.org/cli.html#dotcmd
client:a("auth backup bail binary changes check clone databases dbinfo dump echo eqp exit explain fullschema headers help import imposter indexes iotrace limit lint load log mode nullvalue once open output print prompt quit read restore save scanstats schema separator session shell show stats system tables testcase timeout timer trace vfsinfo vfslist vfsname width"),
// ref: http://sqlite.org/lang_keywords.html
keywords:a(o+"abort action add after all analyze attach autoincrement before begin cascade case cast check collate column commit conflict constraint cross current_date current_time current_timestamp database default deferrable deferred detach each else end escape except exclusive exists explain fail for foreign full glob if ignore immediate index indexed initially inner instead intersect isnull key left limit match natural no notnull null of offset outer plan pragma primary query raise recursive references regexp reindex release rename replace restrict right rollback row savepoint temp temporary then to transaction trigger unique using vacuum view virtual when with without"),
// SQLite is weakly typed, ref: http://sqlite.org/datatype3.html. This is just a list of some common types.
builtin:a("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text clob bigint int int2 int8 integer float double char varchar date datetime year unsigned signed numeric real"),
// ref: http://sqlite.org/syntax/literal-value.html
atoms:a("null current_date current_time current_timestamp"),
// ref: http://sqlite.org/lang_expr.html#binaryops
operatorChars:/^[*+\-%<>!=&|/~]/,
// SQLite is weakly typed, ref: http://sqlite.org/datatype3.html. This is just a list of some common types.
dateSQL:a("date time timestamp datetime"),support:a("decimallessFloat zerolessFloat"),identifierQuote:'"',
//ref: http://sqlite.org/lang_keywords.html
hooks:{
// bind-parameters ref:http://sqlite.org/lang_expr.html#varparam
"@":n,":":n,"?":n,$:n,
// The preferred way to escape Identifiers is using double quotes, ref: http://sqlite.org/lang_keywords.html
'"':r,
// there is also support for backticks, ref: http://sqlite.org/lang_keywords.html
"`":t}}),e.defineMIME("text/x-cassandra",{name:"sql",client:{},keywords:a("add all allow alter and any apply as asc authorize batch begin by clustering columnfamily compact consistency count create custom delete desc distinct drop each_quorum exists filtering from grant if in index insert into key keyspace keyspaces level limit local_one local_quorum modify nan norecursive nosuperuser not of on one order password permission permissions primary quorum rename revoke schema select set storage superuser table three to token truncate ttl two type unlogged update use user users using values where with writetime"),builtin:a("ascii bigint blob boolean counter decimal double float frozen inet int list map static text timestamp timeuuid tuple uuid varchar varint"),atoms:a("false true infinity NaN"),operatorChars:/^[<>=]/,dateSQL:{},support:a("commentSlashSlash decimallessFloat"),hooks:{}}),e.defineMIME("text/x-plsql",{name:"sql",client:a("appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap"),keywords:a("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elseif elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning returns reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"),builtin:a("abs acos add_months ascii asin atan atan2 average bfile bfilename bigserial bit blob ceil character chartorowid chr clob concat convert cos cosh count dec decode deref dual dump dup_val_on_index empty error exp false float floor found glb greatest hextoraw initcap instr instrb int integer isopen last_day least length lengthb ln lower lpad ltrim lub make_ref max min mlslabel mod months_between natural naturaln nchar nclob new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null number numeric nvarchar2 nvl others power rawtohex real reftohex round rowcount rowidtochar rowtype rpad rtrim serial sign signtype sin sinh smallint soundex sqlcode sqlerrm sqrt stddev string substr substrb sum sysdate tan tanh to_char text to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid unlogged upper user userenv varchar varchar2 variance varying vsize xml"),operatorChars:/^[*\/+\-%<>!=~]/,dateSQL:a("date time timestamp"),support:a("doubleQuote nCharCast zerolessFloat binaryNumber hexNumber")}),e.defineMIME("text/x-hive",{name:"sql",keywords:a("select alter $elem$ $key$ $value$ add after all analyze and archive as asc before between binary both bucket buckets by cascade case cast change cluster clustered clusterstatus collection column columns comment compute concatenate continue create cross cursor data database databases dbproperties deferred delete delimited desc describe directory disable distinct distribute drop else enable end escaped exclusive exists explain export extended external fetch fields fileformat first format formatted from full function functions grant group having hold_ddltime idxproperties if import in index indexes inpath inputdriver inputformat insert intersect into is items join keys lateral left like limit lines load local location lock locks mapjoin materialized minus msck no_drop nocompress not of offline on option or order out outer outputdriver outputformat overwrite partition partitioned partitions percent plus preserve procedure purge range rcfile read readonly reads rebuild recordreader recordwriter recover reduce regexp rename repair replace restrict revoke right rlike row schema schemas semi sequencefile serde serdeproperties set shared show show_database sort sorted ssl statistics stored streamtable table tables tablesample tblproperties temporary terminated textfile then tmp to touch transform trigger unarchive undo union uniquejoin unlock update use using utc utc_tmestamp view when where while with admin authorization char compact compactions conf cube current current_date current_timestamp day decimal defined dependency directories elem_type exchange file following for grouping hour ignore inner interval jar less logical macro minute month more none noscan over owner partialscan preceding pretty principals protection reload rewrite role roles rollup rows second server sets skewed transactions truncate unbounded unset uri user values window year"),builtin:a("bool boolean long timestamp tinyint smallint bigint int float double date datetime unsigned string array struct map uniontype key_type utctimestamp value_type varchar"),atoms:a("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:a("date timestamp"),support:a("doubleQuote binaryNumber hexNumber")}),e.defineMIME("text/x-pgsql",{name:"sql",client:a("source"),
// For PostgreSQL - https://www.postgresql.org/docs/11/sql-keywords-appendix.html
// For pl/pgsql lang - https://github.com/postgres/postgres/blob/REL_11_2/src/pl/plpgsql/src/pl_scanner.c
keywords:a(o+"a abort abs absent absolute access according action ada add admin after aggregate alias all allocate also alter always analyse analyze and any are array array_agg array_max_cardinality as asc asensitive assert assertion assignment asymmetric at atomic attach attribute attributes authorization avg backward base64 before begin begin_frame begin_partition bernoulli between bigint binary bit bit_length blob blocked bom boolean both breadth by c cache call called cardinality cascade cascaded case cast catalog catalog_name ceil ceiling chain char char_length character character_length character_set_catalog character_set_name character_set_schema characteristics characters check checkpoint class class_origin clob close cluster coalesce cobol collate collation collation_catalog collation_name collation_schema collect column column_name columns command_function command_function_code comment comments commit committed concurrently condition condition_number configuration conflict connect connection connection_name constant constraint constraint_catalog constraint_name constraint_schema constraints constructor contains content continue control conversion convert copy corr corresponding cost count covar_pop covar_samp create cross csv cube cume_dist current current_catalog current_date current_default_transform_group current_path current_role current_row current_schema current_time current_timestamp current_transform_group_for_type current_user cursor cursor_name cycle data database datalink datatype date datetime_interval_code datetime_interval_precision day db deallocate debug dec decimal declare default defaults deferrable deferred defined definer degree delete delimiter delimiters dense_rank depends depth deref derived desc describe descriptor detach detail deterministic diagnostics dictionary disable discard disconnect dispatch distinct dlnewcopy dlpreviouscopy dlurlcomplete dlurlcompleteonly dlurlcompletewrite dlurlpath dlurlpathonly dlurlpathwrite dlurlscheme dlurlserver dlvalue do document domain double drop dump dynamic dynamic_function dynamic_function_code each element else elseif elsif empty enable encoding encrypted end end_frame end_partition endexec enforced enum equals errcode error escape event every except exception exclude excluding exclusive exec execute exists exit exp explain expression extension external extract false family fetch file filter final first first_value flag float floor following for force foreach foreign fortran forward found frame_row free freeze from fs full function functions fusion g general generated get global go goto grant granted greatest group grouping groups handler having header hex hierarchy hint hold hour id identity if ignore ilike immediate immediately immutable implementation implicit import in include including increment indent index indexes indicator info inherit inherits initially inline inner inout input insensitive insert instance instantiable instead int integer integrity intersect intersection interval into invoker is isnull isolation join k key key_member key_type label lag language large last last_value lateral lead leading leakproof least left length level library like like_regex limit link listen ln load local localtime localtimestamp location locator lock locked log logged loop lower m map mapping match matched materialized max max_cardinality maxvalue member merge message message_length message_octet_length message_text method min minute minvalue mod mode modifies module month more move multiset mumps name names namespace national natural nchar nclob nesting new next nfc nfd nfkc nfkd nil no none normalize normalized not nothing notice notify notnull nowait nth_value ntile null nullable nullif nulls number numeric object occurrences_regex octet_length octets of off offset oids old on only open operator option options or order ordering ordinality others out outer output over overlaps overlay overriding owned owner p pad parallel parameter parameter_mode parameter_name parameter_ordinal_position parameter_specific_catalog parameter_specific_name parameter_specific_schema parser partial partition pascal passing passthrough password path percent percent_rank percentile_cont percentile_disc perform period permission pg_context pg_datatype_name pg_exception_context pg_exception_detail pg_exception_hint placing plans pli policy portion position position_regex power precedes preceding precision prepare prepared preserve primary print_strict_params prior privileges procedural procedure procedures program public publication query quote raise range rank read reads real reassign recheck recovery recursive ref references referencing refresh regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy reindex relative release rename repeatable replace replica requiring reset respect restart restore restrict result result_oid return returned_cardinality returned_length returned_octet_length returned_sqlstate returning returns reverse revoke right role rollback rollup routine routine_catalog routine_name routine_schema routines row row_count row_number rows rowtype rule savepoint scale schema schema_name schemas scope scope_catalog scope_name scope_schema scroll search second section security select selective self sensitive sequence sequences serializable server server_name session session_user set setof sets share show similar simple size skip slice smallint snapshot some source space specific specific_name specifictype sql sqlcode sqlerror sqlexception sqlstate sqlwarning sqrt stable stacked standalone start state statement static statistics stddev_pop stddev_samp stdin stdout storage strict strip structure style subclass_origin submultiset subscription substring substring_regex succeeds sum symmetric sysid system system_time system_user t table table_name tables tablesample tablespace temp template temporary text then ties time timestamp timezone_hour timezone_minute to token top_level_count trailing transaction transaction_active transactions_committed transactions_rolled_back transform transforms translate translate_regex translation treat trigger trigger_catalog trigger_name trigger_schema trim trim_array true truncate trusted type types uescape unbounded uncommitted under unencrypted union unique unknown unlink unlisten unlogged unnamed unnest until untyped update upper uri usage use_column use_variable user user_defined_type_catalog user_defined_type_code user_defined_type_name user_defined_type_schema using vacuum valid validate validator value value_of values var_pop var_samp varbinary varchar variable_conflict variadic varying verbose version versioning view views volatile warning when whenever where while whitespace width_bucket window with within without work wrapper write xml xmlagg xmlattributes xmlbinary xmlcast xmlcomment xmlconcat xmldeclaration xmldocument xmlelement xmlexists xmlforest xmliterate xmlnamespaces xmlparse xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltext xmlvalidate year yes zone"),
// https://www.postgresql.org/docs/11/datatype.html
builtin:a("bigint int8 bigserial serial8 bit varying varbit boolean bool box bytea character char varchar cidr circle date double precision float8 inet integer int int4 interval json jsonb line lseg macaddr macaddr8 money numeric decimal path pg_lsn point polygon real float4 smallint int2 smallserial serial2 serial serial4 text time zone timetz timestamp timestamptz tsquery tsvector txid_snapshot uuid xml"),atoms:a("false true null unknown"),operatorChars:/^[*\/+\-%<>!=&|^\/#@?~]/,backslashStringEscapes:!1,identifierQuote:'"',
// https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
hooks:{'"':r},dateSQL:a("date time timestamp"),support:a("decimallessFloat zerolessFloat binaryNumber hexNumber nCharCast charsetCast escapeConstant")}),e.defineMIME("text/x-gql",{name:"sql",keywords:a("ancestor and asc by contains desc descendant distinct from group has in is limit offset on order select superset where"),atoms:a("false true"),builtin:a("blob datetime first key __key__ string integer double boolean null"),operatorChars:/^[*+\-%<>!=]/}),e.defineMIME("text/x-gpsql",{name:"sql",client:a("source"),
//https://github.com/greenplum-db/gpdb/blob/master/src/include/parser/kwlist.h
keywords:a("abort absolute access action active add admin after aggregate all also alter always analyse analyze and any array as asc assertion assignment asymmetric at authorization backward before begin between bigint binary bit boolean both by cache called cascade cascaded case cast chain char character characteristics check checkpoint class close cluster coalesce codegen collate column comment commit committed concurrency concurrently configuration connection constraint constraints contains content continue conversion copy cost cpu_rate_limit create createdb createexttable createrole createuser cross csv cube current current_catalog current_date current_role current_schema current_time current_timestamp current_user cursor cycle data database day deallocate dec decimal declare decode default defaults deferrable deferred definer delete delimiter delimiters deny desc dictionary disable discard distinct distributed do document domain double drop dxl each else enable encoding encrypted end enum errors escape every except exchange exclude excluding exclusive execute exists explain extension external extract false family fetch fields filespace fill filter first float following for force foreign format forward freeze from full function global grant granted greatest group group_id grouping handler hash having header hold host hour identity if ignore ilike immediate immutable implicit in including inclusive increment index indexes inherit inherits initially inline inner inout input insensitive insert instead int integer intersect interval into invoker is isnull isolation join key language large last leading least left level like limit list listen load local localtime localtimestamp location lock log login mapping master match maxvalue median merge minute minvalue missing mode modifies modify month move name names national natural nchar new newline next no nocreatedb nocreateexttable nocreaterole nocreateuser noinherit nologin none noovercommit nosuperuser not nothing notify notnull nowait null nullif nulls numeric object of off offset oids old on only operator option options or order ordered others out outer over overcommit overlaps overlay owned owner parser partial partition partitions passing password percent percentile_cont percentile_disc placing plans position preceding precision prepare prepared preserve primary prior privileges procedural procedure protocol queue quote randomly range read readable reads real reassign recheck recursive ref references reindex reject relative release rename repeatable replace replica reset resource restart restrict returning returns revoke right role rollback rollup rootpartition row rows rule savepoint scatter schema scroll search second security segment select sequence serializable session session_user set setof sets share show similar simple smallint some split sql stable standalone start statement statistics stdin stdout storage strict strip subpartition subpartitions substring superuser symmetric sysid system table tablespace temp template temporary text then threshold ties time timestamp to trailing transaction treat trigger trim true truncate trusted type unbounded uncommitted unencrypted union unique unknown unlisten until update user using vacuum valid validation validator value values varchar variadic varying verbose version view volatile web when where whitespace window with within without work writable write xml xmlattributes xmlconcat xmlelement xmlexists xmlforest xmlparse xmlpi xmlroot xmlserialize year yes zone"),builtin:a("bigint int8 bigserial serial8 bit varying varbit boolean bool box bytea character char varchar cidr circle date double precision float float8 inet integer int int4 interval json jsonb line lseg macaddr macaddr8 money numeric decimal path pg_lsn point polygon real float4 smallint int2 smallserial serial2 serial serial4 text time without zone with timetz timestamp timestamptz tsquery tsvector txid_snapshot uuid xml"),atoms:a("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^\/#@?~]/,dateSQL:a("date time timestamp"),support:a("decimallessFloat zerolessFloat binaryNumber hexNumber nCharCast charsetCast")}),e.defineMIME("text/x-sparksql",{name:"sql",keywords:a("add after all alter analyze and anti archive array as asc at between bucket buckets by cache cascade case cast change clear cluster clustered codegen collection column columns comment commit compact compactions compute concatenate cost create cross cube current current_date current_timestamp database databases data dbproperties defined delete delimited deny desc describe dfs directories distinct distribute drop else end escaped except exchange exists explain export extended external false fields fileformat first following for format formatted from full function functions global grant group grouping having if ignore import in index indexes inner inpath inputformat insert intersect interval into is items join keys last lateral lazy left like limit lines list load local location lock locks logical macro map minus msck natural no not null nulls of on optimize option options or order out outer outputformat over overwrite partition partitioned partitions percent preceding principals purge range recordreader recordwriter recover reduce refresh regexp rename repair replace reset restrict revoke right rlike role roles rollback rollup row rows schema schemas select semi separated serde serdeproperties set sets show skewed sort sorted start statistics stored stratify struct table tables tablesample tblproperties temp temporary terminated then to touch transaction transactions transform true truncate unarchive unbounded uncache union unlock unset use using values view when where window with"),builtin:a("abs acos acosh add_months aggregate and any approx_count_distinct approx_percentile array array_contains array_distinct array_except array_intersect array_join array_max array_min array_position array_remove array_repeat array_sort array_union arrays_overlap arrays_zip ascii asin asinh assert_true atan atan2 atanh avg base64 between bigint bin binary bit_and bit_count bit_get bit_length bit_or bit_xor bool_and bool_or boolean bround btrim cardinality case cast cbrt ceil ceiling char char_length character_length chr coalesce collect_list collect_set concat concat_ws conv corr cos cosh cot count count_if count_min_sketch covar_pop covar_samp crc32 cume_dist current_catalog current_database current_date current_timestamp current_timezone current_user date date_add date_format date_from_unix_date date_part date_sub date_trunc datediff day dayofmonth dayofweek dayofyear decimal decode degrees delimited dense_rank div double e element_at elt encode every exists exp explode explode_outer expm1 extract factorial filter find_in_set first first_value flatten float floor forall format_number format_string from_csv from_json from_unixtime from_utc_timestamp get_json_object getbit greatest grouping grouping_id hash hex hour hypot if ifnull in initcap inline inline_outer input_file_block_length input_file_block_start input_file_name inputformat instr int isnan isnotnull isnull java_method json_array_length json_object_keys json_tuple kurtosis lag last last_day last_value lcase lead least left length levenshtein like ln locate log log10 log1p log2 lower lpad ltrim make_date make_dt_interval make_interval make_timestamp make_ym_interval map map_concat map_entries map_filter map_from_arrays map_from_entries map_keys map_values map_zip_with max max_by md5 mean min min_by minute mod monotonically_increasing_id month months_between named_struct nanvl negative next_day not now nth_value ntile nullif nvl nvl2 octet_length or outputformat overlay parse_url percent_rank percentile percentile_approx pi pmod posexplode posexplode_outer position positive pow power printf quarter radians raise_error rand randn random rank rcfile reflect regexp regexp_extract regexp_extract_all regexp_like regexp_replace repeat replace reverse right rint rlike round row_number rpad rtrim schema_of_csv schema_of_json second sentences sequence sequencefile serde session_window sha sha1 sha2 shiftleft shiftright shiftrightunsigned shuffle sign signum sin sinh size skewness slice smallint some sort_array soundex space spark_partition_id split sqrt stack std stddev stddev_pop stddev_samp str_to_map string struct substr substring substring_index sum tan tanh textfile timestamp timestamp_micros timestamp_millis timestamp_seconds tinyint to_csv to_date to_json to_timestamp to_unix_timestamp to_utc_timestamp transform transform_keys transform_values translate trim trunc try_add try_divide typeof ucase unbase64 unhex uniontype unix_date unix_micros unix_millis unix_seconds unix_timestamp upper uuid var_pop var_samp variance version weekday weekofyear when width_bucket window xpath xpath_boolean xpath_double xpath_float xpath_int xpath_long xpath_number xpath_short xpath_string xxhash64 year zip_with"),atoms:a("false true null"),operatorChars:/^[*\/+\-%<>!=~&|^]/,dateSQL:a("date time timestamp"),support:a("doubleQuote zerolessFloat")}),e.defineMIME("text/x-esper",{name:"sql",client:a("source"),
// http://www.espertech.com/esper/release-5.5.0/esper-reference/html/appendix_keywords.html
keywords:a("alter and as asc between by count create delete desc distinct drop from group having in insert into is join like not on or order select set table union update values where limit after all and as at asc avedev avg between by case cast coalesce count create current_timestamp day days delete define desc distinct else end escape events every exists false first from full group having hour hours in inner insert instanceof into irstream is istream join last lastweekday left limit like max match_recognize matches median measures metadatasql min minute minutes msec millisecond milliseconds not null offset on or order outer output partition pattern prev prior regexp retain-union retain-intersection right rstream sec second seconds select set some snapshot sql stddev sum then true unidirectional until update variable weekday when where window"),builtin:{},atoms:a("false true null"),operatorChars:/^[*+\-%<>!=&|^\/#@?~]/,dateSQL:a("time"),support:a("decimallessFloat zerolessFloat binaryNumber hexNumber")}),e.defineMIME("text/x-trino",{name:"sql",
// https://github.com/trinodb/trino/blob/bc7a4eeedde28684c7ae6f74cefcaf7c6e782174/core/trino-parser/src/main/antlr4/io/trino/sql/parser/SqlBase.g4#L859-L1129
// https://github.com/trinodb/trino/blob/bc7a4eeedde28684c7ae6f74cefcaf7c6e782174/docs/src/main/sphinx/functions/list.rst
keywords:a("abs absent acos add admin after all all_match alter analyze and any any_match approx_distinct approx_most_frequent approx_percentile approx_set arbitrary array_agg array_distinct array_except array_intersect array_join array_max array_min array_position array_remove array_sort array_union arrays_overlap as asc asin at at_timezone atan atan2 authorization avg bar bernoulli beta_cdf between bing_tile bing_tile_at bing_tile_coordinates bing_tile_polygon bing_tile_quadkey bing_tile_zoom_level bing_tiles_around bit_count bitwise_and bitwise_and_agg bitwise_left_shift bitwise_not bitwise_or bitwise_or_agg bitwise_right_shift bitwise_right_shift_arithmetic bitwise_xor bool_and bool_or both by call cardinality cascade case cast catalogs cbrt ceil ceiling char2hexint checksum chr classify coalesce codepoint column columns combinations comment commit committed concat concat_ws conditional constraint contains contains_sequence convex_hull_agg copartition corr cos cosh cosine_similarity count count_if covar_pop covar_samp crc32 create cross cube cume_dist current current_catalog current_date current_groups current_path current_role current_schema current_time current_timestamp current_timezone current_user data date_add date_diff date_format date_parse date_trunc day day_of_month day_of_week day_of_year deallocate default define definer degrees delete dense_rank deny desc describe descriptor distinct distributed dow doy drop e element_at else empty empty_approx_set encoding end error escape evaluate_classifier_predictions every except excluding execute exists exp explain extract false features fetch filter final first first_value flatten floor following for format format_datetime format_number from from_base from_base32 from_base64 from_base64url from_big_endian_32 from_big_endian_64 from_encoded_polyline from_geojson_geometry from_hex from_ieee754_32 from_ieee754_64 from_iso8601_date from_iso8601_timestamp from_iso8601_timestamp_nanos from_unixtime from_unixtime_nanos from_utf8 full functions geometric_mean geometry_from_hadoop_shape geometry_invalid_reason geometry_nearest_points geometry_to_bing_tiles geometry_union geometry_union_agg grant granted grants graphviz great_circle_distance greatest group grouping groups hamming_distance hash_counts having histogram hmac_md5 hmac_sha1 hmac_sha256 hmac_sha512 hour human_readable_seconds if ignore in including index infinity initial inner input insert intersect intersection_cardinality into inverse_beta_cdf inverse_normal_cdf invoker io is is_finite is_infinite is_json_scalar is_nan isolation jaccard_index join json_array json_array_contains json_array_get json_array_length json_exists json_extract json_extract_scalar json_format json_object json_parse json_query json_size json_value keep key keys kurtosis lag last last_day_of_month last_value lateral lead leading learn_classifier learn_libsvm_classifier learn_libsvm_regressor learn_regressor least left length level levenshtein_distance like limit line_interpolate_point line_interpolate_points line_locate_point listagg ln local localtime localtimestamp log log10 log2 logical lower lpad ltrim luhn_check make_set_digest map_agg map_concat map_entries map_filter map_from_entries map_keys map_union map_values map_zip_with match match_recognize matched matches materialized max max_by md5 measures merge merge_set_digest millisecond min min_by minute mod month multimap_agg multimap_from_entries murmur3 nan natural next nfc nfd nfkc nfkd ngrams no none none_match normal_cdf normalize not now nth_value ntile null nullif nulls numeric_histogram object objectid_timestamp of offset omit on one only option or order ordinality outer output over overflow parse_data_size parse_datetime parse_duration partition partitions passing past path pattern per percent_rank permute pi position pow power preceding prepare privileges properties prune qdigest_agg quarter quotes radians rand random range rank read recursive reduce reduce_agg refresh regexp_count regexp_extract regexp_extract_all regexp_like regexp_position regexp_replace regexp_split regr_intercept regr_slope regress rename render repeat repeatable replace reset respect restrict returning reverse revoke rgb right role roles rollback rollup round row_number rows rpad rtrim running scalar schema schemas second security seek select sequence serializable session set sets sha1 sha256 sha512 show shuffle sign simplify_geometry sin skewness skip slice some soundex spatial_partitioning spatial_partitions split split_part split_to_map split_to_multimap spooky_hash_v2_32 spooky_hash_v2_64 sqrt st_area st_asbinary st_astext st_boundary st_buffer st_centroid st_contains st_convexhull st_coorddim st_crosses st_difference st_dimension st_disjoint st_distance st_endpoint st_envelope st_envelopeaspts st_equals st_exteriorring st_geometries st_geometryfromtext st_geometryn st_geometrytype st_geomfrombinary st_interiorringn st_interiorrings st_intersection st_intersects st_isclosed st_isempty st_isring st_issimple st_isvalid st_length st_linefromtext st_linestring st_multipoint st_numgeometries st_numinteriorring st_numpoints st_overlaps st_point st_pointn st_points st_polygon st_relate st_startpoint st_symdifference st_touches st_union st_within st_x st_xmax st_xmin st_y st_ymax st_ymin start starts_with stats stddev stddev_pop stddev_samp string strpos subset substr substring sum system table tables tablesample tan tanh tdigest_agg text then ties timestamp_objectid timezone_hour timezone_minute to to_base to_base32 to_base64 to_base64url to_big_endian_32 to_big_endian_64 to_char to_date to_encoded_polyline to_geojson_geometry to_geometry to_hex to_ieee754_32 to_ieee754_64 to_iso8601 to_milliseconds to_spherical_geography to_timestamp to_unixtime to_utf8 trailing transaction transform transform_keys transform_values translate trim trim_array true truncate try try_cast type typeof uescape unbounded uncommitted unconditional union unique unknown unmatched unnest update upper url_decode url_encode url_extract_fragment url_extract_host url_extract_parameter url_extract_path url_extract_port url_extract_protocol url_extract_query use user using utf16 utf32 utf8 validate value value_at_quantile values values_at_quantiles var_pop var_samp variance verbose version view week week_of_year when where width_bucket wilson_interval_lower wilson_interval_upper window with with_timezone within without word_stem work wrapper write xxhash64 year year_of_week yow zip zip_with"),
// https://github.com/trinodb/trino/blob/bc7a4eeedde28684c7ae6f74cefcaf7c6e782174/core/trino-main/src/main/java/io/trino/metadata/TypeRegistry.java#L131-L168
// https://github.com/trinodb/trino/blob/bc7a4eeedde28684c7ae6f74cefcaf7c6e782174/plugin/trino-ml/src/main/java/io/trino/plugin/ml/MLPlugin.java#L35
// https://github.com/trinodb/trino/blob/bc7a4eeedde28684c7ae6f74cefcaf7c6e782174/plugin/trino-mongodb/src/main/java/io/trino/plugin/mongodb/MongoPlugin.java#L32
// https://github.com/trinodb/trino/blob/bc7a4eeedde28684c7ae6f74cefcaf7c6e782174/plugin/trino-geospatial/src/main/java/io/trino/plugin/geospatial/GeoPlugin.java#L37
builtin:a("array bigint bingtile boolean char codepoints color date decimal double function geometry hyperloglog int integer interval ipaddress joniregexp json json2016 jsonpath kdbtree likepattern map model objectid p4hyperloglog precision qdigest re2jregexp real regressor row setdigest smallint sphericalgeography tdigest time timestamp tinyint uuid varbinary varchar zone"),atoms:a("false true null unknown"),
// https://trino.io/docs/current/functions/list.html#id1
operatorChars:/^[[\]|<>=!\-+*/%]/,dateSQL:a("date time timestamp zone"),
// hexNumber is necessary for VARBINARY literals, e.g. X'65683F'
// but it also enables 0xFF hex numbers, which Trino doesn't support.
support:a("decimallessFloat zerolessFloat hexNumber")})}(C()));export{X as R,Q as W};