@langsword/trace 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,36 @@
1
+ (function(et,en){typeof exports=="object"&&typeof module<"u"?en(exports,require("pinia"),require("axios")):typeof define=="function"&&define.amd?define(["exports","pinia","axios"],en):(et=typeof globalThis<"u"?globalThis:et||self,en(et.LangswordTrace={},et.Pinia,et.axios))})(this,function(et,en,Io){"use strict";var xa=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},bi={exports:{}},Ca;function Yt(){return Ca||(Ca=1,function(y,f){(function(h,P){y.exports=P()})(xa,function(){var h=navigator.userAgent,P=navigator.platform,T=/gecko\/\d/i.test(h),E=/MSIE \d/.test(h),O=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(h),C=/Edge\/(\d+)/.exec(h),_=E||O||C,b=_&&(E?document.documentMode||6:+(C||O)[1]),D=!C&&/WebKit\//.test(h),Q=D&&/Qt\/\d+\.\d+/.test(h),N=!C&&/Chrome\/(\d+)/.exec(h),Y=N&&+N[1],B=/Opera\//.test(h),J=/Apple Computer/.test(navigator.vendor),I=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(h),x=/PhantomJS/.test(h),k=J&&(/Mobile\/\w+/.test(h)||navigator.maxTouchPoints>2),W=/Android/.test(h),X=k||W||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(h),Z=k||/Mac/.test(P),ie=/\bCrOS\b/.test(h),se=/win/i.test(P),fe=B&&h.match(/Version\/(\d*\.\d*)/);fe&&(fe=Number(fe[1])),fe&&fe>=15&&(B=!1,D=!0);var Ie=Z&&(Q||B&&(fe==null||fe<12.11)),Ne=T||_&&b>=9;function ye(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var je=function(e,t){var n=e.className,r=ye(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function R(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function $(e,t){return R(e).appendChild(t)}function g(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var a=0;a<t.length;++a)i.appendChild(t[a]);return i}function Je(e,t,n,r){var i=g(e,t,n,r);return i.setAttribute("role","presentation"),i}var Ke;document.createRange?Ke=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:Ke=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch{return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function Re(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function _e(e){var t=e.ownerDocument||e,n;try{n=e.activeElement}catch{n=t.body||null}for(;n&&n.shadowRoot&&n.shadowRoot.activeElement;)n=n.shadowRoot.activeElement;return n}function xe(e,t){var n=e.className;ye(t).test(n)||(e.className+=(n?" ":"")+t)}function Ee(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!ye(n[r]).test(t)&&(t+=" "+n[r]);return t}var hr=function(e){e.select()};k?hr=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:_&&(hr=function(e){try{e.select()}catch{}});function ct(e){return e.display.wrapper.ownerDocument}function mt(e){return Pe(e.display.wrapper)}function Pe(e){return e.getRootNode?e.getRootNode():e.ownerDocument}function ae(e){return ct(e).defaultView}function re(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function ue(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function ve(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var a=r||0,s=i||0;;){var o=e.indexOf(" ",a);if(o<0||o>=t)return s+(t-a);s+=o-a,s+=n-s%n,a=o+1}}var Dt=function(){this.id=null,this.f=null,this.time=0,this.handler=re(this.onTimeout,this)};Dt.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Dt.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function oe(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var Qe=50,jt={toString:function(){return"CodeMirror.Pass"}},ht={scroll:!1},Ot={origin:"*mouse"},dt={origin:"+move"};function Mt(e,t,n){for(var r=0,i=0;;){var a=e.indexOf(" ",r);a==-1&&(a=e.length);var s=a-r;if(a==e.length||i+s>=t)return r+Math.min(s,t-i);if(i+=a-r,i+=n-i%n,r=a+1,i>=t)return r}}var Wt=[""];function rn(e){for(;Wt.length<=e;)Wt.push(he(Wt)+" ");return Wt[e]}function he(e){return e[e.length-1]}function dr(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Si(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function Wn(){}function Hn(e,t){var n;return Object.create?n=Object.create(e):(Wn.prototype=e,n=new Wn),t&&ue(t,n),n}var ki=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function nn(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||ki.test(e))}function Ht(e,t){return t?t.source.indexOf("\\w")>-1&&nn(e)?!0:t.test(e):nn(e)}function Fn(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Ft=/[\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 De(e){return e.charCodeAt(0)>=768&&Ft.test(e)}function Jt(e,t,n){for(;(n<0?t>0:t<e.length)&&De(e.charAt(t));)t+=n;return t}function Nt(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,a=r<0?Math.ceil(i):Math.floor(i);if(a==t)return e(a)?t:n;e(a)?n=a:t=a+r}}function Qt(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,a=0;a<e.length;++a){var s=e[a];(s.from<n&&s.to>t||t==n&&s.to==t)&&(r(Math.max(s.from,t),Math.min(s.to,n),s.level==1?"rtl":"ltr",a),i=!0)}i||r(t,n,"ltr")}var pr=null;function Zt(e,t,n){var r;pr=null;for(var i=0;i<e.length;++i){var a=e[i];if(a.from<t&&a.to>t)return i;a.to==t&&(a.from!=a.to&&n=="before"?r=i:pr=i),a.from==t&&(a.from!=a.to&&n!="before"?r=i:pr=i)}return r??pr}var Ti=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(u){return u<=247?e.charAt(u):1424<=u&&u<=1524?"R":1536<=u&&u<=1785?t.charAt(u-1536):1774<=u&&u<=2220?"r":8192<=u&&u<=8203?"w":u==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,a=/[LRr]/,s=/[Lb1n]/,o=/[1n]/;function l(u,d,v){this.level=u,this.from=d,this.to=v}return function(u,d){var v=d=="ltr"?"L":"R";if(u.length==0||d=="ltr"&&!r.test(u))return!1;for(var w=u.length,m=[],L=0;L<w;++L)m.push(n(u.charCodeAt(L)));for(var A=0,F=v;A<w;++A){var z=m[A];z=="m"?m[A]=F:F=z}for(var K=0,U=v;K<w;++K){var q=m[K];q=="1"&&U=="r"?m[K]="n":a.test(q)&&(U=q,q=="r"&&(m[K]="R"))}for(var te=1,V=m[0];te<w-1;++te){var le=m[te];le=="+"&&V=="1"&&m[te+1]=="1"?m[te]="1":le==","&&V==m[te+1]&&(V=="1"||V=="n")&&(m[te]=V),V=le}for(var me=0;me<w;++me){var ze=m[me];if(ze==",")m[me]="N";else if(ze=="%"){var we=void 0;for(we=me+1;we<w&&m[we]=="%";++we);for(var ft=me&&m[me-1]=="!"||we<w&&m[we]=="1"?"1":"N",at=me;at<we;++at)m[at]=ft;me=we-1}}for(var Oe=0,st=v;Oe<w;++Oe){var Ge=m[Oe];st=="L"&&Ge=="1"?m[Oe]="L":a.test(Ge)&&(st=Ge)}for(var Ae=0;Ae<w;++Ae)if(i.test(m[Ae])){var Me=void 0;for(Me=Ae+1;Me<w&&i.test(m[Me]);++Me);for(var Te=(Ae?m[Ae-1]:v)=="L",ot=(Me<w?m[Me]:v)=="L",Zr=Te==ot?Te?"L":"R":v,cr=Ae;cr<Me;++cr)m[cr]=Zr;Ae=Me-1}for(var Ye=[],Pt,Ue=0;Ue<w;)if(s.test(m[Ue])){var ba=Ue;for(++Ue;Ue<w&&s.test(m[Ue]);++Ue);Ye.push(new l(0,ba,Ue))}else{var Xt=Ue,kr=Ye.length,Tr=d=="rtl"?1:0;for(++Ue;Ue<w&&m[Ue]!="L";++Ue);for(var Ve=Xt;Ve<Ue;)if(o.test(m[Ve])){Xt<Ve&&(Ye.splice(kr,0,new l(1,Xt,Ve)),kr+=Tr);var Vr=Ve;for(++Ve;Ve<Ue&&o.test(m[Ve]);++Ve);Ye.splice(kr,0,new l(2,Vr,Ve)),kr+=Tr,Xt=Ve}else++Ve;Xt<Ue&&Ye.splice(kr,0,new l(1,Xt,Ue))}return d=="ltr"&&(Ye[0].level==1&&(Pt=u.match(/^\s+/))&&(Ye[0].from=Pt[0].length,Ye.unshift(new l(0,0,Pt[0].length))),he(Ye).level==1&&(Pt=u.match(/\s+$/))&&(he(Ye).to-=Pt[0].length,Ye.push(new l(0,w-Pt[0].length,w)))),d=="rtl"?Ye.reverse():Ye}}();function ce(e,t){var n=e.order;return n==null&&(n=e.order=Ti(e.text,t)),n}var Bn=[],ee=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||Bn).concat(n)}};function Bt(e,t){return e._handlers&&e._handlers[t]||Bn}function $e(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var a=oe(i,n);a>-1&&(r[t]=i.slice(0,a).concat(i.slice(a+1)))}}}function Ce(e,t){var n=Bt(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function Se(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Ce(e,n||t.type,e,t),tt(t)||t.codemirrorIgnore}function gt(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)oe(n,t[r])==-1&&n.push(t[r])}function lt(e,t){return Bt(e,t).length>0}function bt(e){e.prototype.on=function(t,n){ee(this,t,n)},e.prototype.off=function(t,n){$e(this,t,n)}}function qe(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function _r(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function tt(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function Vt(e){qe(e),_r(e)}function an(e){return e.target||e.srcElement}function wt(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),Z&&e.ctrlKey&&t==1&&(t=3),t}var Li=function(){if(_&&b<9)return!1;var e=g("div");return"draggable"in e||"dragDrop"in e}(),Dr;function zn(e){if(Dr==null){var t=g("span","​");$(e,g("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Dr=t.offsetWidth<=1&&t.offsetHeight>2&&!(_&&b<8))}var n=Dr?g("span","​"):g("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var sn;function er(e){if(sn!=null)return sn;var t=$(e,document.createTextNode("AخA")),n=Ke(t,0,1).getBoundingClientRect(),r=Ke(t,1,2).getBoundingClientRect();return R(e),!n||n.left==n.right?!1:sn=r.right-n.right<3}var yt=`
2
+
3
+ b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(`
4
+ `,t);i==-1&&(i=e.length);var a=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),s=a.indexOf("\r");s!=-1?(n.push(a.slice(0,s)),t+=s+1):(n.push(a),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},tr=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch{return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch{}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Un=function(){var e=g("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),xt=null;function _i(e){if(xt!=null)return xt;var t=$(e,g("span","x")),n=t.getBoundingClientRect(),r=Ke(t,0,1).getBoundingClientRect();return xt=Math.abs(n.left-r.left)>1}var Or={},Ct={};function St(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Or[e]=t}function vr(e,t){Ct[e]=t}function Mr(e){if(typeof e=="string"&&Ct.hasOwnProperty(e))e=Ct[e];else if(e&&typeof e.name=="string"&&Ct.hasOwnProperty(e.name)){var t=Ct[e.name];typeof t=="string"&&(t={name:t}),e=Hn(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Mr("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Mr("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Nr(e,t){t=Mr(t);var n=Or[t.name];if(!n)return Nr(e,"text/plain");var r=n(e,t);if(rr.hasOwnProperty(t.name)){var i=rr[t.name];for(var a in i)i.hasOwnProperty(a)&&(r.hasOwnProperty(a)&&(r["_"+a]=r[a]),r[a]=i[a])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var s in t.modeProps)r[s]=t.modeProps[s];return r}var rr={};function Ar(e,t){var n=rr.hasOwnProperty(e)?rr[e]:rr[e]={};ue(t,n)}function At(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function on(e,t){for(var n;e.innerMode&&(n=e.innerMode(t),!(!n||n.mode==e));)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Ir(e,t,n){return e.startState?e.startState(t,n):!0}var ke=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};ke.prototype.eol=function(){return this.pos>=this.string.length},ke.prototype.sol=function(){return this.pos==this.lineStart},ke.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},ke.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},ke.prototype.eat=function(e){var t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e.test?e.test(t):e(t)),n)return++this.pos,t},ke.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},ke.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},ke.prototype.skipToEnd=function(){this.pos=this.string.length},ke.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},ke.prototype.backUp=function(e){this.pos-=e},ke.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=ve(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?ve(this.string,this.lineStart,this.tabSize):0)},ke.prototype.indentation=function(){return ve(this.string,null,this.tabSize)-(this.lineStart?ve(this.string,this.lineStart,this.tabSize):0)},ke.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(s){return n?s.toLowerCase():s},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var a=this.string.slice(this.pos).match(e);return a&&a.index>0?null:(a&&t!==!1&&(this.pos+=a[0].length),a)}},ke.prototype.current=function(){return this.string.slice(this.start,this.pos)},ke.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},ke.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},ke.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function j(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],a=i.chunkSize();if(t<a){n=i;break}t-=a}return n.lines[t]}function zt(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(a){var s=a.text;i==n.line&&(s=s.slice(0,n.ch)),i==t.line&&(s=s.slice(t.ch)),r.push(s),++i}),r}function ln(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function pt(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function c(e){if(e.parent==null)return null;for(var t=e.parent,n=oe(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;r.children[i]!=t;++i)n+=r.children[i].chunkSize();return n+t.first}function p(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],a=i.height;if(t<a){e=i;continue e}t-=a,n+=i.chunkSize()}return n}while(!e.lines);for(var s=0;s<e.lines.length;++s){var o=e.lines[s],l=o.height;if(t<l)break;t-=l}return n+s}function M(e,t){return t>=e.first&&t<e.first+e.size}function H(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function S(e,t,n){if(n===void 0&&(n=null),!(this instanceof S))return new S(e,t,n);this.line=e,this.ch=t,this.sticky=n}function G(e,t){return e.line-t.line||e.ch-t.ch}function de(e,t){return e.sticky==t.sticky&&G(e,t)==0}function We(e){return S(e.line,e.ch)}function rt(e,t){return G(e,t)<0?t:e}function Rr(e,t){return G(e,t)<0?e:t}function Ia(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ne(e,t){if(t.line<e.first)return S(e.first,0);var n=e.first+e.size-1;return t.line>n?S(n,j(e,n).text.length):$o(t,j(e,t.line).text.length)}function $o(e,t){var n=e.ch;return n==null||n>t?S(e.line,t):n<0?S(e.line,0):e}function Ra(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=ne(e,t[r]);return n}var Gn=function(e,t){this.state=e,this.lookAhead=t},It=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};It.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},It.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}},It.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},It.fromSaved=function(e,t,n){return t instanceof Gn?new It(e,At(e.mode,t.state),n,t.lookAhead):new It(e,At(e.mode,t),n)},It.prototype.save=function(e){var t=e!==!1?At(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Gn(t,this.maxLookAhead):t};function Ea(e,t,n,r){var i=[e.state.modeGen],a={};za(e,t.text,e.doc.mode,n,function(u,d){return i.push(u,d)},a,r);for(var s=n.state,o=function(u){n.baseTokens=i;var d=e.state.overlays[u],v=1,w=0;n.state=!0,za(e,t.text,d.mode,n,function(m,L){for(var A=v;w<m;){var F=i[v];F>m&&i.splice(v,1,m,i[v+1],F),v+=2,w=Math.min(m,F)}if(L)if(d.opaque)i.splice(A,v-A,m,"overlay "+L),v=A+2;else for(;A<v;A+=2){var z=i[A+1];i[A+1]=(z?z+" ":"")+"overlay "+L}},a),n.state=s,n.baseTokens=null,n.baseTokenPos=1},l=0;l<e.state.overlays.length;++l)o(l);return{styles:i,classes:a.bgClass||a.textClass?a:null}}function Pa(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=un(e,c(t)),i=t.text.length>e.options.maxHighlightLength&&At(e.doc.mode,r.state),a=Ea(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=a.styles,a.classes?t.styleClasses=a.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function un(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new It(r,!0,t);var a=qo(e,t,n),s=a>r.first&&j(r,a-1).stateAfter,o=s?It.fromSaved(r,s,a):new It(r,Ir(r.mode),a);return r.iter(a,t,function(l){Di(e,l.text,o);var u=o.line;l.stateAfter=u==t-1||u%5==0||u>=i.viewFrom&&u<i.viewTo?o.save():null,o.nextLine()}),n&&(r.modeFrontier=o.line),o}function Di(e,t,n,r){var i=e.doc.mode,a=new ke(t,e.options.tabSize,n);for(a.start=a.pos=r||0,t==""&&Wa(i,n.state);!a.eol();)Oi(i,a,n.state),a.start=a.pos}function Wa(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var n=on(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}}function Oi(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=on(e,n).mode);var a=e.token(t,n);if(t.pos>t.start)return a}throw new Error("Mode "+e.name+" failed to advance stream.")}var Ha=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Fa(e,t,n,r){var i=e.doc,a=i.mode,s;t=ne(i,t);var o=j(i,t.line),l=un(e,t.line,n),u=new ke(o.text,e.options.tabSize,l),d;for(r&&(d=[]);(r||u.pos<t.ch)&&!u.eol();)u.start=u.pos,s=Oi(a,u,l.state),r&&d.push(new Ha(u,s,At(i.mode,l.state)));return r?d:new Ha(u,s,l.state)}function Ba(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function za(e,t,n,r,i,a,s){var o=n.flattenSpans;o==null&&(o=e.options.flattenSpans);var l=0,u=null,d=new ke(t,e.options.tabSize,r),v,w=e.options.addModeClass&&[null];for(t==""&&Ba(Wa(n,r.state),a);!d.eol();){if(d.pos>e.options.maxHighlightLength?(o=!1,s&&Di(e,t,r,d.pos),d.pos=t.length,v=null):v=Ba(Oi(n,d,r.state,w),a),w){var m=w[0].name;m&&(v="m-"+(v?m+" "+v:m))}if(!o||u!=v){for(;l<d.start;)l=Math.min(d.start,l+5e3),i(l,u);u=v}d.start=d.pos}for(;l<d.pos;){var L=Math.min(d.pos,l+5e3);i(L,u),l=L}}function qo(e,t,n){for(var r,i,a=e.doc,s=n?-1:t-(e.doc.mode.innerMode?1e3:100),o=t;o>s;--o){if(o<=a.first)return a.first;var l=j(a,o-1),u=l.stateAfter;if(u&&(!n||o+(u instanceof Gn?u.lookAhead:0)<=a.modeFrontier))return o;var d=ve(l.text,null,e.options.tabSize);(i==null||r>d)&&(i=o-1,r=d)}return i}function Xo(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var n=e.first,r=t-1;r>n;r--){var i=j(e,r).stateAfter;if(i&&(!(i instanceof Gn)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}}var Ua=!1,Ut=!1;function Yo(){Ua=!0}function jo(){Ut=!0}function Kn(e,t,n){this.marker=e,this.from=t,this.to=n}function fn(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Jo(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Qo(e,t,n){var r=n&&window.WeakSet&&(n.markedSpans||(n.markedSpans=new WeakSet));r&&e.markedSpans&&r.has(e.markedSpans)?e.markedSpans.push(t):(e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],r&&r.add(e.markedSpans)),t.marker.attachLine(e)}function Zo(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var a=e[i],s=a.marker,o=a.from==null||(s.inclusiveLeft?a.from<=t:a.from<t);if(o||a.from==t&&s.type=="bookmark"&&(!n||!a.marker.insertLeft)){var l=a.to==null||(s.inclusiveRight?a.to>=t:a.to>t);(r||(r=[])).push(new Kn(s,a.from,l?null:a.to))}}return r}function Vo(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var a=e[i],s=a.marker,o=a.to==null||(s.inclusiveRight?a.to>=t:a.to>t);if(o||a.from==t&&s.type=="bookmark"&&(!n||a.marker.insertLeft)){var l=a.from==null||(s.inclusiveLeft?a.from<=t:a.from<t);(r||(r=[])).push(new Kn(s,l?null:a.from-t,a.to==null?null:a.to-t))}}return r}function Mi(e,t){if(t.full)return null;var n=M(e,t.from.line)&&j(e,t.from.line).markedSpans,r=M(e,t.to.line)&&j(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,a=t.to.ch,s=G(t.from,t.to)==0,o=Zo(n,i,s),l=Vo(r,a,s),u=t.text.length==1,d=he(t.text).length+(u?i:0);if(o)for(var v=0;v<o.length;++v){var w=o[v];if(w.to==null){var m=fn(l,w.marker);m?u&&(w.to=m.to==null?null:m.to+d):w.to=i}}if(l)for(var L=0;L<l.length;++L){var A=l[L];if(A.to!=null&&(A.to+=d),A.from==null){var F=fn(o,A.marker);F||(A.from=d,u&&(o||(o=[])).push(A))}else A.from+=d,u&&(o||(o=[])).push(A)}o&&(o=Ga(o)),l&&l!=o&&(l=Ga(l));var z=[o];if(!u){var K=t.text.length-2,U;if(K>0&&o)for(var q=0;q<o.length;++q)o[q].to==null&&(U||(U=[])).push(new Kn(o[q].marker,null,null));for(var te=0;te<K;++te)z.push(U);z.push(l)}return z}function Ga(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function el(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(m){if(m.markedSpans)for(var L=0;L<m.markedSpans.length;++L){var A=m.markedSpans[L].marker;A.readOnly&&(!r||oe(r,A)==-1)&&(r||(r=[])).push(A)}}),!r)return null;for(var i=[{from:t,to:n}],a=0;a<r.length;++a)for(var s=r[a],o=s.find(0),l=0;l<i.length;++l){var u=i[l];if(!(G(u.to,o.from)<0||G(u.from,o.to)>0)){var d=[l,1],v=G(u.from,o.from),w=G(u.to,o.to);(v<0||!s.inclusiveLeft&&!v)&&d.push({from:u.from,to:o.from}),(w>0||!s.inclusiveRight&&!w)&&d.push({from:o.to,to:u.to}),i.splice.apply(i,d),l+=d.length-3}}return i}function Ka(e){var t=e.markedSpans;if(t){for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}}function $a(e,t){if(t){for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}}function $n(e){return e.inclusiveLeft?-1:0}function qn(e){return e.inclusiveRight?1:0}function Ni(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),a=G(r.from,i.from)||$n(e)-$n(t);if(a)return-a;var s=G(r.to,i.to)||qn(e)-qn(t);return s||t.id-e.id}function qa(e,t){var n=Ut&&e.markedSpans,r;if(n)for(var i=void 0,a=0;a<n.length;++a)i=n[a],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||Ni(r,i.marker)<0)&&(r=i.marker);return r}function Xa(e){return qa(e,!0)}function Xn(e){return qa(e,!1)}function tl(e,t){var n=Ut&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var a=n[i];a.marker.collapsed&&(a.from==null||a.from<t)&&(a.to==null||a.to>t)&&(!r||Ni(r,a.marker)<0)&&(r=a.marker)}return r}function Ya(e,t,n,r,i){var a=j(e,t),s=Ut&&a.markedSpans;if(s)for(var o=0;o<s.length;++o){var l=s[o];if(l.marker.collapsed){var u=l.marker.find(0),d=G(u.from,n)||$n(l.marker)-$n(i),v=G(u.to,r)||qn(l.marker)-qn(i);if(!(d>=0&&v<=0||d<=0&&v>=0)&&(d<=0&&(l.marker.inclusiveRight&&i.inclusiveLeft?G(u.to,n)>=0:G(u.to,n)>0)||d>=0&&(l.marker.inclusiveRight&&i.inclusiveLeft?G(u.from,r)<=0:G(u.from,r)<0)))return!0}}}function kt(e){for(var t;t=Xa(e);)e=t.find(-1,!0).line;return e}function rl(e){for(var t;t=Xn(e);)e=t.find(1,!0).line;return e}function nl(e){for(var t,n;t=Xn(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Ai(e,t){var n=j(e,t),r=kt(n);return n==r?t:c(r)}function ja(e,t){if(t>e.lastLine())return t;var n=j(e,t),r;if(!nr(e,n))return t;for(;r=Xn(n);)n=r.find(1,!0).line;return c(n)+1}function nr(e,t){var n=Ut&&t.markedSpans;if(n){for(var r=void 0,i=0;i<n.length;++i)if(r=n[i],!!r.marker.collapsed){if(r.from==null)return!0;if(!r.marker.widgetNode&&r.from==0&&r.marker.inclusiveLeft&&Ii(e,t,r))return!0}}}function Ii(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return Ii(e,r.line,fn(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,a=0;a<t.markedSpans.length;++a)if(i=t.markedSpans[a],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&Ii(e,t,i))return!0}function Gt(e){e=kt(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var a=n.parent;a;n=a,a=n.parent)for(var s=0;s<a.children.length;++s){var o=a.children[s];if(o==n)break;t+=o.height}return t}function Yn(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Xa(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=Xn(r);){var a=n.find(0,!0);t-=r.text.length-a.from.ch,r=a.to.line,t+=r.text.length-a.to.ch}return t}function Ri(e){var t=e.display,n=e.doc;t.maxLine=j(n,n.first),t.maxLineLength=Yn(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=Yn(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var Er=function(e,t,n){this.text=e,$a(this,t),this.height=n?n(this):1};Er.prototype.lineNo=function(){return c(this)},bt(Er);function il(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Ka(e),$a(e,n);var i=r?r(e):1;i!=e.height&&pt(e,i)}function al(e){e.parent=null,Ka(e)}var sl={},ol={};function Ja(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?ol:sl;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Qa(e,t){var n=Je("span",null,null,D?"padding-right: .1px":null),r={pre:Je("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var a=i?t.rest[i-1]:t.line,s=void 0;r.pos=0,r.addToken=ul,er(e.display.measure)&&(s=ce(a,e.doc.direction))&&(r.addToken=cl(r.addToken,s)),r.map=[];var o=t!=e.display.externalMeasured&&c(a);hl(a,r,Pa(e,a,o)),a.styleClasses&&(a.styleClasses.bgClass&&(r.bgClass=Ee(a.styleClasses.bgClass,r.bgClass||"")),a.styleClasses.textClass&&(r.textClass=Ee(a.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(zn(e.display.measure))),i==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(D){var l=r.content.lastChild;(/\bcm-tab\b/.test(l.className)||l.querySelector&&l.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Ce(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=Ee(r.pre.className,r.textClass||"")),r}function ll(e){var t=g("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function ul(e,t,n,r,i,a,s){if(t){var o=e.splitSpaces?fl(t,e.trailingSpace):t,l=e.cm.state.specialChars,u=!1,d;if(!l.test(t))e.col+=t.length,d=document.createTextNode(o),e.map.push(e.pos,e.pos+t.length,d),_&&b<9&&(u=!0),e.pos+=t.length;else{d=document.createDocumentFragment();for(var v=0;;){l.lastIndex=v;var w=l.exec(t),m=w?w.index-v:t.length-v;if(m){var L=document.createTextNode(o.slice(v,v+m));_&&b<9?d.appendChild(g("span",[L])):d.appendChild(L),e.map.push(e.pos,e.pos+m,L),e.col+=m,e.pos+=m}if(!w)break;v+=m+1;var A=void 0;if(w[0]==" "){var F=e.cm.options.tabSize,z=F-e.col%F;A=d.appendChild(g("span",rn(z),"cm-tab")),A.setAttribute("role","presentation"),A.setAttribute("cm-text"," "),e.col+=z}else w[0]=="\r"||w[0]==`
5
+ `?(A=d.appendChild(g("span",w[0]=="\r"?"␍":"␤","cm-invalidchar")),A.setAttribute("cm-text",w[0]),e.col+=1):(A=e.cm.options.specialCharPlaceholder(w[0]),A.setAttribute("cm-text",w[0]),_&&b<9?d.appendChild(g("span",[A])):d.appendChild(A),e.col+=1);e.map.push(e.pos,e.pos+1,A),e.pos++}}if(e.trailingSpace=o.charCodeAt(t.length-1)==32,n||r||i||u||a||s){var K=n||"";r&&(K+=r),i&&(K+=i);var U=g("span",[d],K,a);if(s)for(var q in s)s.hasOwnProperty(q)&&q!="style"&&q!="class"&&U.setAttribute(q,s[q]);return e.content.appendChild(U)}e.content.appendChild(d)}}function fl(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var a=e.charAt(i);a==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(a=" "),r+=a,n=a==" "}return r}function cl(e,t){return function(n,r,i,a,s,o,l){i=i?i+" cm-force-border":"cm-force-border";for(var u=n.pos,d=u+r.length;;){for(var v=void 0,w=0;w<t.length&&(v=t[w],!(v.to>u&&v.from<=u));w++);if(v.to>=d)return e(n,r,i,a,s,o,l);e(n,r.slice(0,v.to-u),i,a,null,o,l),a=null,r=r.slice(v.to-u),u=v.to}}}function Za(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function hl(e,t,n){var r=e.markedSpans,i=e.text,a=0;if(!r){for(var s=1;s<n.length;s+=2)t.addToken(t,i.slice(a,a=n[s]),Ja(n[s+1],t.cm.options));return}for(var o=i.length,l=0,u=1,d="",v,w,m=0,L,A,F,z,K;;){if(m==l){L=A=F=w="",K=null,z=null,m=1/0;for(var U=[],q=void 0,te=0;te<r.length;++te){var V=r[te],le=V.marker;if(le.type=="bookmark"&&V.from==l&&le.widgetNode)U.push(le);else if(V.from<=l&&(V.to==null||V.to>l||le.collapsed&&V.to==l&&V.from==l)){if(V.to!=null&&V.to!=l&&m>V.to&&(m=V.to,A=""),le.className&&(L+=" "+le.className),le.css&&(w=(w?w+";":"")+le.css),le.startStyle&&V.from==l&&(F+=" "+le.startStyle),le.endStyle&&V.to==m&&(q||(q=[])).push(le.endStyle,V.to),le.title&&((K||(K={})).title=le.title),le.attributes)for(var me in le.attributes)(K||(K={}))[me]=le.attributes[me];le.collapsed&&(!z||Ni(z.marker,le)<0)&&(z=V)}else V.from>l&&m>V.from&&(m=V.from)}if(q)for(var ze=0;ze<q.length;ze+=2)q[ze+1]==m&&(A+=" "+q[ze]);if(!z||z.from==l)for(var we=0;we<U.length;++we)Za(t,0,U[we]);if(z&&(z.from||0)==l){if(Za(t,(z.to==null?o+1:z.to)-l,z.marker,z.from==null),z.to==null)return;z.to==l&&(z=!1)}}if(l>=o)break;for(var ft=Math.min(o,m);;){if(d){var at=l+d.length;if(!z){var Oe=at>ft?d.slice(0,ft-l):d;t.addToken(t,Oe,v?v+L:L,F,l+Oe.length==m?A:"",w,K)}if(at>=ft){d=d.slice(ft-l),l=ft;break}l=at,F=""}d=i.slice(a,a=n[u++]),v=Ja(n[u++],t.cm.options)}}}function Va(e,t,n){this.line=t,this.rest=nl(t),this.size=this.rest?c(he(this.rest))-n+1:1,this.node=this.text=null,this.hidden=nr(e,t)}function jn(e,t,n){for(var r=[],i,a=t;a<n;a=i){var s=new Va(e.doc,j(e.doc,a),a);i=a+s.size,r.push(s)}return r}var Pr=null;function dl(e){Pr?Pr.ops.push(e):e.ownsGroup=Pr={ops:[e],delayedCallbacks:[]}}function pl(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}function vl(e,t){var n=e.ownsGroup;if(n)try{pl(n)}finally{Pr=null,t(n)}}var cn=null;function He(e,t){var n=Bt(e,t);if(n.length){var r=Array.prototype.slice.call(arguments,2),i;Pr?i=Pr.delayedCallbacks:cn?i=cn:(i=cn=[],setTimeout(gl,0));for(var a=function(o){i.push(function(){return n[o].apply(null,r)})},s=0;s<n.length;++s)a(s)}}function gl(){var e=cn;cn=null;for(var t=0;t<e.length;++t)e[t]()}function es(e,t,n,r){for(var i=0;i<t.changes.length;i++){var a=t.changes[i];a=="text"?ml(e,t):a=="gutter"?rs(e,t,n,r):a=="class"?Ei(e,t):a=="widget"&&bl(e,t,r)}t.changes=null}function hn(e){return e.node==e.text&&(e.node=g("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),_&&b<8&&(e.node.style.zIndex=2)),e.node}function yl(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=hn(t);t.background=r.insertBefore(g("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function ts(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Qa(e,t)}function ml(e,t){var n=t.text.className,r=ts(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,Ei(e,t)):n&&(t.text.className=n)}function Ei(e,t){yl(e,t),t.line.wrapClass?hn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function rs(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=hn(t);t.gutterBackground=g("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var a=t.line.gutterMarkers;if(e.options.lineNumbers||a){var s=hn(t),o=t.gutter=g("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(o.setAttribute("aria-hidden","true"),e.display.input.setUneditable(o),s.insertBefore(o,t.text),t.line.gutterClass&&(o.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!a||!a["CodeMirror-linenumbers"])&&(t.lineNumber=o.appendChild(g("div",H(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),a)for(var l=0;l<e.display.gutterSpecs.length;++l){var u=e.display.gutterSpecs[l].className,d=a.hasOwnProperty(u)&&a[u];d&&o.appendChild(g("div",[d],"CodeMirror-gutter-elt","left: "+r.gutterLeft[u]+"px; width: "+r.gutterWidth[u]+"px"))}}}function bl(e,t,n){t.alignable&&(t.alignable=null);for(var r=ye("CodeMirror-linewidget"),i=t.node.firstChild,a=void 0;i;i=a)a=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);ns(e,t,n)}function wl(e,t,n,r){var i=ts(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),Ei(e,t),rs(e,t,n,r),ns(e,t,r),t.node}function ns(e,t,n){if(is(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)is(e,t.rest[r],t,n,!1)}function is(e,t,n,r,i){if(t.widgets)for(var a=hn(n),s=0,o=t.widgets;s<o.length;++s){var l=o[s],u=g("div",[l.node],"CodeMirror-linewidget"+(l.className?" "+l.className:""));l.handleMouseEvents||u.setAttribute("cm-ignore-events","true"),xl(l,u,n,r),e.display.input.setUneditable(u),i&&l.above?a.insertBefore(u,n.gutter||n.text):a.appendChild(u),He(l,"redraw")}}function xl(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function dn(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!Re(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),$(t.display.measure,g("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function Kt(e,t){for(var n=an(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function Jn(e){return e.lineSpace.offsetTop}function Pi(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function as(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=$(e.measure,g("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function Rt(e){return Qe-e.display.nativeBarWidth}function gr(e){return e.display.scroller.clientWidth-Rt(e)-e.display.barWidth}function Wi(e){return e.display.scroller.clientHeight-Rt(e)-e.display.barHeight}function Cl(e,t,n){var r=e.options.lineWrapping,i=r&&gr(e);if(!t.measure.heights||r&&t.measure.width!=i){var a=t.measure.heights=[];if(r){t.measure.width=i;for(var s=t.text.firstChild.getClientRects(),o=0;o<s.length-1;o++){var l=s[o],u=s[o+1];Math.abs(l.bottom-u.bottom)>2&&a.push((l.bottom+u.top)/2-n.top)}}a.push(n.bottom-n.top)}}function ss(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(c(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}}function Sl(e,t){t=kt(t);var n=c(t),r=e.display.externalMeasured=new Va(e.doc,t,n);r.lineN=n;var i=r.built=Qa(e,r);return r.text=i.pre,$(e.display.lineMeasure,i.pre),r}function os(e,t,n,r){return Et(e,Wr(e,t),n,r)}function Hi(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[br(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Wr(e,t){var n=c(t),r=Hi(e,n);r&&!r.text?r=null:r&&r.changes&&(es(e,r,n,Gi(e)),e.curOp.forceUpdate=!0),r||(r=Sl(e,t));var i=ss(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Et(e,t,n,r,i){t.before&&(n=-1);var a=n+(r||""),s;return t.cache.hasOwnProperty(a)?s=t.cache[a]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Cl(e,t.view,t.rect),t.hasHeights=!0),s=Tl(e,t,n,r),s.bogus||(t.cache[a]=s)),{left:s.left,right:s.right,top:i?s.rtop:s.top,bottom:i?s.rbottom:s.bottom}}var ls={left:0,right:0,top:0,bottom:0};function us(e,t,n){for(var r,i,a,s,o,l,u=0;u<e.length;u+=3)if(o=e[u],l=e[u+1],t<o?(i=0,a=1,s="left"):t<l?(i=t-o,a=i+1):(u==e.length-3||t==l&&e[u+3]>t)&&(a=l-o,i=a-1,t>=l&&(s="right")),i!=null){if(r=e[u+2],o==l&&n==(r.insertLeft?"left":"right")&&(s=n),n=="left"&&i==0)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)r=e[(u-=3)+2],s="left";if(n=="right"&&i==l-o)for(;u<e.length-3&&e[u+3]==e[u+4]&&!e[u+5].insertLeft;)r=e[(u+=3)+2],s="right";break}return{node:r,start:i,end:a,collapse:s,coverStart:o,coverEnd:l}}function kl(e,t){var n=ls;if(t=="left")for(var r=0;r<e.length&&(n=e[r]).left==n.right;r++);else for(var i=e.length-1;i>=0&&(n=e[i]).left==n.right;i--);return n}function Tl(e,t,n,r){var i=us(t.map,n,r),a=i.node,s=i.start,o=i.end,l=i.collapse,u;if(a.nodeType==3){for(var d=0;d<4;d++){for(;s&&De(t.line.text.charAt(i.coverStart+s));)--s;for(;i.coverStart+o<i.coverEnd&&De(t.line.text.charAt(i.coverStart+o));)++o;if(_&&b<9&&s==0&&o==i.coverEnd-i.coverStart?u=a.parentNode.getBoundingClientRect():u=kl(Ke(a,s,o).getClientRects(),r),u.left||u.right||s==0)break;o=s,s=s-1,l="right"}_&&b<11&&(u=Ll(e.display.measure,u))}else{s>0&&(l=r="right");var v;e.options.lineWrapping&&(v=a.getClientRects()).length>1?u=v[r=="right"?v.length-1:0]:u=a.getBoundingClientRect()}if(_&&b<9&&!s&&(!u||!u.left&&!u.right)){var w=a.parentNode.getClientRects()[0];w?u={left:w.left,right:w.left+Fr(e.display),top:w.top,bottom:w.bottom}:u=ls}for(var m=u.top-t.rect.top,L=u.bottom-t.rect.top,A=(m+L)/2,F=t.view.measure.heights,z=0;z<F.length-1&&!(A<F[z]);z++);var K=z?F[z-1]:0,U=F[z],q={left:(l=="right"?u.right:u.left)-t.rect.left,right:(l=="left"?u.left:u.right)-t.rect.left,top:K,bottom:U};return!u.left&&!u.right&&(q.bogus=!0),e.options.singleCursorHeightPerLine||(q.rtop=m,q.rbottom=L),q}function Ll(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!_i(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function fs(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 cs(e){e.display.externalMeasure=null,R(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)fs(e.display.view[t])}function pn(e){cs(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function hs(e){return N&&W?-(e.body.getBoundingClientRect().left-parseInt(getComputedStyle(e.body).marginLeft)):e.defaultView.pageXOffset||(e.documentElement||e.body).scrollLeft}function ds(e){return N&&W?-(e.body.getBoundingClientRect().top-parseInt(getComputedStyle(e.body).marginTop)):e.defaultView.pageYOffset||(e.documentElement||e.body).scrollTop}function Fi(e){var t=kt(e),n=t.widgets,r=0;if(n)for(var i=0;i<n.length;++i)n[i].above&&(r+=dn(n[i]));return r}function Qn(e,t,n,r,i){if(!i){var a=Fi(t);n.top+=a,n.bottom+=a}if(r=="line")return n;r||(r="local");var s=Gt(t);if(r=="local"?s+=Jn(e.display):s-=e.display.viewOffset,r=="page"||r=="window"){var o=e.display.lineSpace.getBoundingClientRect();s+=o.top+(r=="window"?0:ds(ct(e)));var l=o.left+(r=="window"?0:hs(ct(e)));n.left+=l,n.right+=l}return n.top+=s,n.bottom+=s,n}function ps(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=hs(ct(e)),i-=ds(ct(e));else if(n=="local"||!n){var a=e.display.sizer.getBoundingClientRect();r+=a.left,i+=a.top}var s=e.display.lineSpace.getBoundingClientRect();return{left:r-s.left,top:i-s.top}}function Zn(e,t,n,r,i){return r||(r=j(e.doc,t.line)),Qn(e,r,os(e,r,t.ch,i),n)}function Tt(e,t,n,r,i,a){r=r||j(e.doc,t.line),i||(i=Wr(e,r));function s(L,A){var F=Et(e,i,L,A?"right":"left",a);return A?F.left=F.right:F.right=F.left,Qn(e,r,F,n)}var o=ce(r,e.doc.direction),l=t.ch,u=t.sticky;if(l>=r.text.length?(l=r.text.length,u="before"):l<=0&&(l=0,u="after"),!o)return s(u=="before"?l-1:l,u=="before");function d(L,A,F){var z=o[A],K=z.level==1;return s(F?L-1:L,K!=F)}var v=Zt(o,l,u),w=pr,m=d(l,v,u=="before");return w!=null&&(m.other=d(l,w,u!="before")),m}function vs(e,t){var n=0;t=ne(e.doc,t),e.options.lineWrapping||(n=Fr(e.display)*t.ch);var r=j(e.doc,t.line),i=Gt(r)+Jn(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function Bi(e,t,n,r,i){var a=S(e,t,n);return a.xRel=i,r&&(a.outside=r),a}function zi(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return Bi(r.first,0,null,-1,-1);var i=p(r,n),a=r.first+r.size-1;if(i>a)return Bi(r.first+r.size-1,j(r,a).text.length,null,1,1);t<0&&(t=0);for(var s=j(r,i);;){var o=_l(e,s,i,t,n),l=tl(s,o.ch+(o.xRel>0||o.outside>0?1:0));if(!l)return o;var u=l.find(1);if(u.line==i)return u;s=j(r,i=u.line)}}function gs(e,t,n,r){r-=Fi(t);var i=t.text.length,a=Nt(function(s){return Et(e,n,s-1).bottom<=r},i,0);return i=Nt(function(s){return Et(e,n,s).top>r},a,i),{begin:a,end:i}}function ys(e,t,n,r){n||(n=Wr(e,t));var i=Qn(e,t,Et(e,n,r),"line").top;return gs(e,t,n,i)}function Ui(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function _l(e,t,n,r,i){i-=Gt(t);var a=Wr(e,t),s=Fi(t),o=0,l=t.text.length,u=!0,d=ce(t,e.doc.direction);if(d){var v=(e.options.lineWrapping?Ol:Dl)(e,t,n,a,d,r,i);u=v.level!=1,o=u?v.from:v.to-1,l=u?v.to:v.from-1}var w=null,m=null,L=Nt(function(te){var V=Et(e,a,te);return V.top+=s,V.bottom+=s,Ui(V,r,i,!1)?(V.top<=i&&V.left<=r&&(w=te,m=V),!0):!1},o,l),A,F,z=!1;if(m){var K=r-m.left<m.right-r,U=K==u;L=w+(U?0:1),F=U?"after":"before",A=K?m.left:m.right}else{!u&&(L==l||L==o)&&L++,F=L==0?"after":L==t.text.length?"before":Et(e,a,L-(u?1:0)).bottom+s<=i==u?"after":"before";var q=Tt(e,S(n,L,F),"line",t,a);A=q.left,z=i<q.top?-1:i>=q.bottom?1:0}return L=Jt(t.text,L,1),Bi(n,L,F,z,r-A)}function Dl(e,t,n,r,i,a,s){var o=Nt(function(v){var w=i[v],m=w.level!=1;return Ui(Tt(e,S(n,m?w.to:w.from,m?"before":"after"),"line",t,r),a,s,!0)},0,i.length-1),l=i[o];if(o>0){var u=l.level!=1,d=Tt(e,S(n,u?l.from:l.to,u?"after":"before"),"line",t,r);Ui(d,a,s,!0)&&d.top>s&&(l=i[o-1])}return l}function Ol(e,t,n,r,i,a,s){var o=gs(e,t,r,s),l=o.begin,u=o.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var d=null,v=null,w=0;w<i.length;w++){var m=i[w];if(!(m.from>=u||m.to<=l)){var L=m.level!=1,A=Et(e,r,L?Math.min(u,m.to)-1:Math.max(l,m.from)).right,F=A<a?a-A+1e9:A-a;(!d||v>F)&&(d=m,v=F)}}return d||(d=i[i.length-1]),d.from<l&&(d={from:l,to:d.to,level:d.level}),d.to>u&&(d={from:d.from,to:u,level:d.level}),d}var yr;function Hr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(yr==null){yr=g("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)yr.appendChild(document.createTextNode("x")),yr.appendChild(g("br"));yr.appendChild(document.createTextNode("x"))}$(e.measure,yr);var n=yr.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),R(e.measure),n||1}function Fr(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=g("span","xxxxxxxxxx"),n=g("pre",[t],"CodeMirror-line-like");$(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Gi(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,a=t.gutters.firstChild,s=0;a;a=a.nextSibling,++s){var o=e.display.gutterSpecs[s].className;n[o]=a.offsetLeft+a.clientLeft+i,r[o]=a.clientWidth}return{fixedPos:Ki(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ki(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function ms(e){var t=Hr(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Fr(e.display)-3);return function(i){if(nr(e.doc,i))return 0;var a=0;if(i.widgets)for(var s=0;s<i.widgets.length;s++)i.widgets[s].height&&(a+=i.widgets[s].height);return n?a+(Math.ceil(i.text.length/r)||1)*t:a+t}}function $i(e){var t=e.doc,n=ms(e);t.iter(function(r){var i=n(r);i!=r.height&&pt(r,i)})}function mr(e,t,n,r){var i=e.display;if(!n&&an(t).getAttribute("cm-not-content")=="true")return null;var a,s,o=i.lineSpace.getBoundingClientRect();try{a=t.clientX-o.left,s=t.clientY-o.top}catch{return null}var l=zi(e,a,s),u;if(r&&l.xRel>0&&(u=j(e.doc,l.line).text).length==l.ch){var d=ve(u,u.length,e.options.tabSize)-u.length;l=S(l.line,Math.max(0,Math.round((a-as(e.display).left)/Fr(e.display))-d))}return l}function br(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function nt(e,t,n,r){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&n<i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Ut&&Ai(e.doc,t)<i.viewTo&&ar(e);else if(n<=i.viewFrom)Ut&&ja(e.doc,n+r)>i.viewFrom?ar(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)ar(e);else if(t<=i.viewFrom){var a=Vn(e,n,n+r,1);a?(i.view=i.view.slice(a.index),i.viewFrom=a.lineN,i.viewTo+=r):ar(e)}else if(n>=i.viewTo){var s=Vn(e,t,t,-1);s?(i.view=i.view.slice(0,s.index),i.viewTo=s.lineN):ar(e)}else{var o=Vn(e,t,t,-1),l=Vn(e,n,n+r,1);o&&l?(i.view=i.view.slice(0,o.index).concat(jn(e,o.lineN,l.lineN)).concat(i.view.slice(l.index)),i.viewTo+=r):ar(e)}var u=i.externalMeasured;u&&(n<u.lineN?u.lineN+=r:t<u.lineN+u.size&&(i.externalMeasured=null))}function ir(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),!(t<r.viewFrom||t>=r.viewTo)){var a=r.view[br(e,t)];if(a.node!=null){var s=a.changes||(a.changes=[]);oe(s,n)==-1&&s.push(n)}}}function ar(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Vn(e,t,n,r){var i=br(e,t),a,s=e.display.view;if(!Ut||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var o=e.display.viewFrom,l=0;l<i;l++)o+=s[l].size;if(o!=t){if(r>0){if(i==s.length-1)return null;a=o+s[i].size-t,i++}else a=o-t;t+=a,n+=a}for(;Ai(e.doc,n)!=n;){if(i==(r<0?0:s.length-1))return null;n+=r*s[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Ml(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=jn(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=jn(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(br(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(jn(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,br(e,n)))),r.viewTo=n}function bs(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];!i.hidden&&(!i.node||i.changes)&&++n}return n}function vn(e){e.display.input.showSelection(e.display.input.prepareSelection())}function ws(e,t){t===void 0&&(t=!0);var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),a=r.selection=document.createDocumentFragment(),s=e.options.$customCursor;s&&(t=!0);for(var o=0;o<n.sel.ranges.length;o++)if(!(!t&&o==n.sel.primIndex)){var l=n.sel.ranges[o];if(!(l.from().line>=e.display.viewTo||l.to().line<e.display.viewFrom)){var u=l.empty();if(s){var d=s(e,l);d&&qi(e,d,i)}else(u||e.options.showCursorWhenSelecting)&&qi(e,l.head,i);u||Nl(e,l,a)}}return r}function qi(e,t,n){var r=Tt(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(g("div"," ","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",/\bcm-fat-cursor\b/.test(e.getWrapperElement().className)){var a=Zn(e,t,"div",null,null),s=a.right-a.left;i.style.width=(s>0?s:e.defaultCharWidth())+"px"}if(r.other){var o=n.appendChild(g("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=r.other.left+"px",o.style.top=r.other.top+"px",o.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function ei(e,t){return e.top-t.top||e.left-t.left}function Nl(e,t,n){var r=e.display,i=e.doc,a=document.createDocumentFragment(),s=as(e.display),o=s.left,l=Math.max(r.sizerWidth,gr(e)-r.sizer.offsetLeft)-s.right,u=i.direction=="ltr";function d(U,q,te,V){q<0&&(q=0),q=Math.round(q),V=Math.round(V),a.appendChild(g("div",null,"CodeMirror-selected","position: absolute; left: "+U+`px;
6
+ top: `+q+"px; width: "+(te??l-U)+`px;
7
+ height: `+(V-q)+"px"))}function v(U,q,te){var V=j(i,U),le=V.text.length,me,ze;function we(Oe,st){return Zn(e,S(U,Oe),"div",V,st)}function ft(Oe,st,Ge){var Ae=ys(e,V,null,Oe),Me=st=="ltr"==(Ge=="after")?"left":"right",Te=Ge=="after"?Ae.begin:Ae.end-(/\s/.test(V.text.charAt(Ae.end-1))?2:1);return we(Te,Me)[Me]}var at=ce(V,i.direction);return Qt(at,q||0,te??le,function(Oe,st,Ge,Ae){var Me=Ge=="ltr",Te=we(Oe,Me?"left":"right"),ot=we(st-1,Me?"right":"left"),Zr=q==null&&Oe==0,cr=te==null&&st==le,Ye=Ae==0,Pt=!at||Ae==at.length-1;if(ot.top-Te.top<=3){var Ue=(u?Zr:cr)&&Ye,ba=(u?cr:Zr)&&Pt,Xt=Ue?o:(Me?Te:ot).left,kr=ba?l:(Me?ot:Te).right;d(Xt,Te.top,kr-Xt,Te.bottom)}else{var Tr,Ve,Vr,wa;Me?(Tr=u&&Zr&&Ye?o:Te.left,Ve=u?l:ft(Oe,Ge,"before"),Vr=u?o:ft(st,Ge,"after"),wa=u&&cr&&Pt?l:ot.right):(Tr=u?ft(Oe,Ge,"before"):o,Ve=!u&&Zr&&Ye?l:Te.right,Vr=!u&&cr&&Pt?o:ot.left,wa=u?ft(st,Ge,"after"):l),d(Tr,Te.top,Ve-Tr,Te.bottom),Te.bottom<ot.top&&d(o,Te.bottom,null,ot.top),d(Vr,ot.top,wa-Vr,ot.bottom)}(!me||ei(Te,me)<0)&&(me=Te),ei(ot,me)<0&&(me=ot),(!ze||ei(Te,ze)<0)&&(ze=Te),ei(ot,ze)<0&&(ze=ot)}),{start:me,end:ze}}var w=t.from(),m=t.to();if(w.line==m.line)v(w.line,w.ch,m.ch);else{var L=j(i,w.line),A=j(i,m.line),F=kt(L)==kt(A),z=v(w.line,w.ch,F?L.text.length+1:null).end,K=v(m.line,F?0:null,m.ch).start;F&&(z.top<K.top-2?(d(z.right,z.top,null,z.bottom),d(o,K.top,K.left,K.bottom)):d(z.right,z.top,K.left-z.right,z.bottom)),z.bottom<K.top&&d(o,z.bottom,null,K.top)}n.appendChild(a)}function Xi(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Br(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function xs(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||ji(e))}function Yi(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&Br(e))},100)}function ji(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(Ce(e,"focus",e,t),e.state.focused=!0,xe(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),D&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Xi(e))}function Br(e,t){e.state.delayingBlurEvent||(e.state.focused&&(Ce(e,"blur",e,t),e.state.focused=!1,je(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function ti(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),i=t.lineDiv.getBoundingClientRect().top,a=0,s=0;s<t.view.length;s++){var o=t.view[s],l=e.options.lineWrapping,u=void 0,d=0;if(!o.hidden){if(i+=o.line.height,_&&b<8){var v=o.node.offsetTop+o.node.offsetHeight;u=v-n,n=v}else{var w=o.node.getBoundingClientRect();u=w.bottom-w.top,!l&&o.text.firstChild&&(d=o.text.firstChild.getBoundingClientRect().right-w.left-1)}var m=o.line.height-u;if((m>.005||m<-.005)&&(i<r&&(a-=m),pt(o.line,u),Cs(o.line),o.rest))for(var L=0;L<o.rest.length;L++)Cs(o.rest[L]);if(d>e.display.sizerWidth){var A=Math.ceil(d/Fr(e.display));A>e.display.maxLineLength&&(e.display.maxLineLength=A,e.display.maxLine=o.line,e.display.maxLineChanged=!0)}}}Math.abs(a)>2&&(t.scroller.scrollTop+=a)}function Cs(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function ri(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Jn(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,a=p(t,r),s=p(t,i);if(n&&n.ensure){var o=n.ensure.from.line,l=n.ensure.to.line;o<a?(a=o,s=p(t,Gt(j(t,o))+e.wrapper.clientHeight)):Math.min(l,t.lastLine())>=s&&(a=p(t,Gt(j(t,l))-e.wrapper.clientHeight),s=l)}return{from:a,to:Math.max(s,a+1)}}function Al(e,t){if(!Se(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),i=null,a=n.wrapper.ownerDocument;if(t.top+r.top<0?i=!0:t.bottom+r.top>(a.defaultView.innerHeight||a.documentElement.clientHeight)&&(i=!1),i!=null&&!x){var s=g("div","​",null,`position: absolute;
8
+ top: `+(t.top-n.viewOffset-Jn(e.display))+`px;
9
+ height: `+(t.bottom-t.top+Rt(e)+n.barHeight)+`px;
10
+ left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(s),s.scrollIntoView(i),e.display.lineSpace.removeChild(s)}}}function Il(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(n=t.sticky=="before"?S(t.line,t.ch+1,"before"):t,t=t.ch?S(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var a=0;a<5;a++){var s=!1,o=Tt(e,t),l=!n||n==t?o:Tt(e,n);i={left:Math.min(o.left,l.left),top:Math.min(o.top,l.top)-r,right:Math.max(o.left,l.left),bottom:Math.max(o.bottom,l.bottom)+r};var u=Ji(e,i),d=e.doc.scrollTop,v=e.doc.scrollLeft;if(u.scrollTop!=null&&(yn(e,u.scrollTop),Math.abs(e.doc.scrollTop-d)>1&&(s=!0)),u.scrollLeft!=null&&(wr(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-v)>1&&(s=!0)),!s)break}return i}function Rl(e,t){var n=Ji(e,t);n.scrollTop!=null&&yn(e,n.scrollTop),n.scrollLeft!=null&&wr(e,n.scrollLeft)}function Ji(e,t){var n=e.display,r=Hr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,a=Wi(e),s={};t.bottom-t.top>a&&(t.bottom=t.top+a);var o=e.doc.height+Pi(n),l=t.top<r,u=t.bottom>o-r;if(t.top<i)s.scrollTop=l?0:t.top;else if(t.bottom>i+a){var d=Math.min(t.top,(u?o:t.bottom)-a);d!=i&&(s.scrollTop=d)}var v=e.options.fixedGutter?0:n.gutters.offsetWidth,w=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-v,m=gr(e)-n.gutters.offsetWidth,L=t.right-t.left>m;return L&&(t.right=t.left+m),t.left<10?s.scrollLeft=0:t.left<w?s.scrollLeft=Math.max(0,t.left+v-(L?0:10)):t.right>m+w-3&&(s.scrollLeft=t.right+(L?0:10)-m),s}function Qi(e,t){t!=null&&(ni(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function zr(e){ni(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function gn(e,t,n){(t!=null||n!=null)&&ni(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function El(e,t){ni(e),e.curOp.scrollToPos=t}function ni(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=vs(e,t.from),r=vs(e,t.to);Ss(e,n,r,t.margin)}}function Ss(e,t,n,r){var i=Ji(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});gn(e,i.scrollLeft,i.scrollTop)}function yn(e,t){Math.abs(e.doc.scrollTop-t)<2||(T||Vi(e,{top:t}),ks(e,t,!0),T&&Vi(e),wn(e,100))}function ks(e,t,n){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),!(e.display.scroller.scrollTop==t&&!n)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function wr(e,t,n,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),!((n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)&&(e.doc.scrollLeft=t,Os(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function mn(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+Pi(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Rt(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var xr=function(e,t,n){this.cm=n;var r=this.vert=g("div",[g("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=g("div",[g("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),ee(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),ee(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,_&&b<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};xr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var a=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+a)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},xr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},xr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},xr.prototype.zeroWidthHack=function(){var e=Z&&!I?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new Dt,this.disableVert=new Dt},xr.prototype.enableZeroWidthBar=function(e,t,n){e.style.visibility="";function r(){var i=e.getBoundingClientRect(),a=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);a!=e?e.style.visibility="hidden":t.set(1e3,r)}t.set(1e3,r)},xr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var bn=function(){};bn.prototype.update=function(){return{bottom:0,right:0}},bn.prototype.setScrollLeft=function(){},bn.prototype.setScrollTop=function(){},bn.prototype.clear=function(){};function Ur(e,t){t||(t=mn(e));var n=e.display.barWidth,r=e.display.barHeight;Ts(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&ti(e),Ts(e,mn(e)),n=e.display.barWidth,r=e.display.barHeight}function Ts(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var Ls={native:xr,null:bn};function _s(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&je(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Ls[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ee(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?wr(e,t):yn(e,t)},e),e.display.scrollbars.addClass&&xe(e.display.wrapper,e.display.scrollbars.addClass)}var Pl=0;function Cr(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Pl,markArrays:null},dl(e.curOp)}function Sr(e){var t=e.curOp;t&&vl(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;Wl(n)})}function Wl(e){for(var t=e.ops,n=0;n<t.length;n++)Hl(t[n]);for(var r=0;r<t.length;r++)Fl(t[r]);for(var i=0;i<t.length;i++)Bl(t[i]);for(var a=0;a<t.length;a++)zl(t[a]);for(var s=0;s<t.length;s++)Ul(t[s])}function Hl(e){var t=e.cm,n=t.display;Kl(t),e.updateMaxLine&&Ri(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new ii(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Fl(e){e.updatedDisplay=e.mustUpdate&&Zi(e.cm,e.update)}function Bl(e){var t=e.cm,n=t.display;e.updatedDisplay&&ti(t),e.barMeasure=mn(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=os(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Rt(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-gr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function zl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&wr(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==_e(mt(t));e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Ur(t,e.barMeasure),e.updatedDisplay&&ta(t,e.barMeasure),e.selectionChanged&&Xi(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&xs(e.cm)}function Ul(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Ds(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&ks(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&wr(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=Il(t,ne(r,e.scrollToPos.from),ne(r,e.scrollToPos.to),e.scrollToPos.margin);Al(t,i)}var a=e.maybeHiddenMarkers,s=e.maybeUnhiddenMarkers;if(a)for(var o=0;o<a.length;++o)a[o].lines.length||Ce(a[o],"hide");if(s)for(var l=0;l<s.length;++l)s[l].lines.length&&Ce(s[l],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Ce(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function ut(e,t){if(e.curOp)return t();Cr(e);try{return t()}finally{Sr(e)}}function Fe(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Cr(e);try{return t.apply(e,arguments)}finally{Sr(e)}}}function Ze(e){return function(){if(this.curOp)return e.apply(this,arguments);Cr(this);try{return e.apply(this,arguments)}finally{Sr(this)}}}function Be(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Cr(t);try{return e.apply(this,arguments)}finally{Sr(t)}}}function wn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,re(Gl,e))}function Gl(e){var t=e.doc;if(!(t.highlightFrontier>=e.display.viewTo)){var n=+new Date+e.options.workTime,r=un(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(a){if(r.line>=e.display.viewFrom){var s=a.styles,o=a.text.length>e.options.maxHighlightLength?At(t.mode,r.state):null,l=Ea(e,a,r,!0);o&&(r.state=o),a.styles=l.styles;var u=a.styleClasses,d=l.classes;d?a.styleClasses=d:u&&(a.styleClasses=null);for(var v=!s||s.length!=a.styles.length||u!=d&&(!u||!d||u.bgClass!=d.bgClass||u.textClass!=d.textClass),w=0;!v&&w<s.length;++w)v=s[w]!=a.styles[w];v&&i.push(r.line),a.stateAfter=r.save(),r.nextLine()}else a.text.length<=e.options.maxHighlightLength&&Di(e,a.text,r),a.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return wn(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&ut(e,function(){for(var a=0;a<i.length;a++)ir(e,i[a],"text")})}}var ii=function(e,t,n){var r=e.display;this.viewport=t,this.visible=ri(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=gr(e),this.force=n,this.dims=Gi(e),this.events=[]};ii.prototype.signal=function(e,t){lt(e,t)&&this.events.push(arguments)},ii.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Ce.apply(null,this.events[e])};function Kl(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Rt(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Rt(e)+"px",t.scrollbarsClipped=!0)}function $l(e){if(e.hasFocus())return null;var t=_e(mt(e));if(!t||!Re(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=ae(e).getSelection();r.anchorNode&&r.extend&&Re(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function ql(e){if(!(!e||!e.activeElt||e.activeElt==_e(Pe(e.activeElt)))&&(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&Re(document.body,e.anchorNode)&&Re(document.body,e.focusNode))){var t=e.activeElt.ownerDocument,n=t.defaultView.getSelection(),r=t.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),n.removeAllRanges(),n.addRange(r),n.extend(e.focusNode,e.focusOffset)}}function Zi(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return ar(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&bs(e)==0)return!1;Ms(e)&&(ar(e),t.dims=Gi(e));var i=r.first+r.size,a=Math.max(t.visible.from-e.options.viewportMargin,r.first),s=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<a&&a-n.viewFrom<20&&(a=Math.max(r.first,n.viewFrom)),n.viewTo>s&&n.viewTo-s<20&&(s=Math.min(i,n.viewTo)),Ut&&(a=Ai(e.doc,a),s=ja(e.doc,s));var o=a!=n.viewFrom||s!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Ml(e,a,s),n.viewOffset=Gt(j(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var l=bs(e);if(!o&&l==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var u=$l(e);return l>4&&(n.lineDiv.style.display="none"),Xl(e,n.updateLineNumbers,t.dims),l>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ql(u),R(n.cursorDiv),R(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,o&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,wn(e,400)),n.updateLineNumbers=null,!0}function Ds(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==gr(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+Pi(e.display)-Wi(e),n.top)}),t.visible=ri(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=ri(e.display,e.doc,n));if(!Zi(e,t))break;ti(e);var i=mn(e);vn(e),Ur(e,i),ta(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 Vi(e,t){var n=new ii(e,t);if(Zi(e,n)){ti(e),Ds(e,n);var r=mn(e);vn(e),Ur(e,r),ta(e,r),n.finish()}}function Xl(e,t,n){var r=e.display,i=e.options.lineNumbers,a=r.lineDiv,s=a.firstChild;function o(L){var A=L.nextSibling;return D&&Z&&e.display.currentWheelTarget==L?L.style.display="none":L.parentNode.removeChild(L),A}for(var l=r.view,u=r.viewFrom,d=0;d<l.length;d++){var v=l[d];if(!v.hidden)if(!v.node||v.node.parentNode!=a){var w=wl(e,v,u,n);a.insertBefore(w,s)}else{for(;s!=v.node;)s=o(s);var m=i&&t!=null&&t<=u&&v.lineNumber;v.changes&&(oe(v.changes,"gutter")>-1&&(m=!1),es(e,v,u,n)),m&&(R(v.lineNumber),v.lineNumber.appendChild(document.createTextNode(H(e.options,u)))),s=v.node.nextSibling}u+=v.size}for(;s;)s=o(s)}function ea(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",He(e,"gutterChanged",e)}function ta(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+Rt(e)+"px"}function Os(e){var t=e.display,n=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var r=Ki(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,a=r+"px",s=0;s<n.length;s++)if(!n[s].hidden){e.options.fixedGutter&&(n[s].gutter&&(n[s].gutter.style.left=a),n[s].gutterBackground&&(n[s].gutterBackground.style.left=a));var o=n[s].alignable;if(o)for(var l=0;l<o.length;l++)o[l].style.left=a}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}}function Ms(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=H(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(g("div",[g("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),a=i.firstChild.offsetWidth,s=i.offsetWidth-a;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(a,r.lineGutter.offsetWidth-s)+1,r.lineNumWidth=r.lineNumInnerWidth+s,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",ea(e.display),!0}return!1}function ra(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var a=e[i],s=null;if(typeof a!="string"&&(s=a.style,a=a.className),a=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:a,style:s})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Ns(e){var t=e.gutters,n=e.gutterSpecs;R(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],a=i.className,s=i.style,o=t.appendChild(g("div",null,"CodeMirror-gutter "+a));s&&(o.style.cssText=s),a=="CodeMirror-linenumbers"&&(e.lineGutter=o,o.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",ea(e)}function xn(e){Ns(e.display),nt(e),Os(e)}function Yl(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=g("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=g("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=Je("div",null,"CodeMirror-code"),i.selectionDiv=g("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=g("div",null,"CodeMirror-cursors"),i.measure=g("div",null,"CodeMirror-measure"),i.lineMeasure=g("div",null,"CodeMirror-measure"),i.lineSpace=Je("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var a=Je("div",[i.lineSpace],"CodeMirror-lines");i.mover=g("div",[a],null,"position: relative"),i.sizer=g("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=g("div",null,null,"position: absolute; height: "+Qe+"px; width: 1px;"),i.gutters=g("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=g("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=g("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),N&&Y===105&&(i.wrapper.style.clipPath="inset(0px)"),i.wrapper.setAttribute("translate","no"),_&&b<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!D&&!(T&&X)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=ra(r.gutters,r.lineNumbers),Ns(i),n.init(i)}var ai=0,$t=null;_?$t=-.53:T?$t=15:N?$t=-.7:J&&($t=-1/3);function As(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function jl(e){var t=As(e);return t.x*=$t,t.y*=$t,t}function Is(e,t){N&&Y==102&&(e.display.chromeScrollHack==null?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=As(t),r=n.x,i=n.y,a=$t;t.deltaMode===0&&(r=t.deltaX,i=t.deltaY,a=1);var s=e.display,o=s.scroller,l=o.scrollWidth>o.clientWidth,u=o.scrollHeight>o.clientHeight;if(r&&l||i&&u){if(i&&Z&&D){e:for(var d=t.target,v=s.view;d!=o;d=d.parentNode)for(var w=0;w<v.length;w++)if(v[w].node==d){e.display.currentWheelTarget=d;break e}}if(r&&!T&&!B&&a!=null){i&&u&&yn(e,Math.max(0,o.scrollTop+i*a)),wr(e,Math.max(0,o.scrollLeft+r*a)),(!i||i&&u)&&qe(t),s.wheelStartX=null;return}if(i&&a!=null){var m=i*a,L=e.doc.scrollTop,A=L+s.wrapper.clientHeight;m<0?L=Math.max(0,L+m-50):A=Math.min(e.doc.height,A+m+50),Vi(e,{top:L,bottom:A})}ai<20&&t.deltaMode!==0&&(s.wheelStartX==null?(s.wheelStartX=o.scrollLeft,s.wheelStartY=o.scrollTop,s.wheelDX=r,s.wheelDY=i,setTimeout(function(){if(s.wheelStartX!=null){var F=o.scrollLeft-s.wheelStartX,z=o.scrollTop-s.wheelStartY,K=z&&s.wheelDY&&z/s.wheelDY||F&&s.wheelDX&&F/s.wheelDX;s.wheelStartX=s.wheelStartY=null,K&&($t=($t*ai+K)/(ai+1),++ai)}},200)):(s.wheelDX+=r,s.wheelDY+=i))}}var vt=function(e,t){this.ranges=e,this.primIndex=t};vt.prototype.primary=function(){return this.ranges[this.primIndex]},vt.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(!de(n.anchor,r.anchor)||!de(n.head,r.head))return!1}return!0},vt.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new pe(We(this.ranges[t].anchor),We(this.ranges[t].head));return new vt(e,this.primIndex)},vt.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},vt.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(G(t,r.from())>=0&&G(e,r.to())<=0)return n}return-1};var pe=function(e,t){this.anchor=e,this.head=t};pe.prototype.from=function(){return Rr(this.anchor,this.head)},pe.prototype.to=function(){return rt(this.anchor,this.head)},pe.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Lt(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(w,m){return G(w.from(),m.from())}),n=oe(t,i);for(var a=1;a<t.length;a++){var s=t[a],o=t[a-1],l=G(o.to(),s.from());if(r&&!s.empty()?l>0:l>=0){var u=Rr(o.from(),s.from()),d=rt(o.to(),s.to()),v=o.empty()?s.from()==s.head:o.from()==o.head;a<=n&&--n,t.splice(--a,2,new pe(v?d:u,v?u:d))}}return new vt(t,n)}function sr(e,t){return new vt([new pe(e,t||e)],0)}function or(e){return e.text?S(e.from.line+e.text.length-1,he(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Rs(e,t){if(G(e,t.from)<0)return e;if(G(e,t.to)<=0)return or(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=or(t).ch-t.to.ch),S(n,r)}function na(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new pe(Rs(i.anchor,t),Rs(i.head,t)))}return Lt(e.cm,n,e.sel.primIndex)}function Es(e,t,n){return e.line==t.line?S(n.line,e.ch-t.ch+n.ch):S(n.line+(e.line-t.line),e.ch)}function Jl(e,t,n){for(var r=[],i=S(e.first,0),a=i,s=0;s<t.length;s++){var o=t[s],l=Es(o.from,i,a),u=Es(or(o),i,a);if(i=o.to,a=u,n=="around"){var d=e.sel.ranges[s],v=G(d.head,d.anchor)<0;r[s]=new pe(v?u:l,v?l:u)}else r[s]=new pe(l,l)}return new vt(r,e.sel.primIndex)}function ia(e){e.doc.mode=Nr(e.options,e.doc.modeOption),Cn(e)}function Cn(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,wn(e,100),e.state.modeGen++,e.curOp&&nt(e)}function Ps(e,t){return t.from.ch==0&&t.to.ch==0&&he(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function aa(e,t,n,r){function i(K){return n?n[K]:null}function a(K,U,q){il(K,U,q,r),He(K,"change",K,t)}function s(K,U){for(var q=[],te=K;te<U;++te)q.push(new Er(u[te],i(te),r));return q}var o=t.from,l=t.to,u=t.text,d=j(e,o.line),v=j(e,l.line),w=he(u),m=i(u.length-1),L=l.line-o.line;if(t.full)e.insert(0,s(0,u.length)),e.remove(u.length,e.size-u.length);else if(Ps(e,t)){var A=s(0,u.length-1);a(v,v.text,m),L&&e.remove(o.line,L),A.length&&e.insert(o.line,A)}else if(d==v)if(u.length==1)a(d,d.text.slice(0,o.ch)+w+d.text.slice(l.ch),m);else{var F=s(1,u.length-1);F.push(new Er(w+d.text.slice(l.ch),m,r)),a(d,d.text.slice(0,o.ch)+u[0],i(0)),e.insert(o.line+1,F)}else if(u.length==1)a(d,d.text.slice(0,o.ch)+u[0]+v.text.slice(l.ch),i(0)),e.remove(o.line+1,L);else{a(d,d.text.slice(0,o.ch)+u[0],i(0)),a(v,w+v.text.slice(l.ch),m);var z=s(1,u.length-1);L>1&&e.remove(o.line+1,L-1),e.insert(o.line+1,z)}He(e,"change",e,t)}function lr(e,t,n){function r(i,a,s){if(i.linked)for(var o=0;o<i.linked.length;++o){var l=i.linked[o];if(l.doc!=a){var u=s&&l.sharedHist;n&&!u||(t(l.doc,u),r(l.doc,i,u))}}}r(e,null,!0)}function Ws(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,$i(e),ia(e),Hs(e),e.options.direction=t.direction,e.options.lineWrapping||Ri(e),e.options.mode=t.modeOption,nt(e)}function Hs(e){(e.doc.direction=="rtl"?xe:je)(e.display.lineDiv,"CodeMirror-rtl")}function Ql(e){ut(e,function(){Hs(e),nt(e)})}function si(e){this.done=[],this.undone=[],this.undoDepth=e?e.undoDepth:1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e?e.maxGeneration:1}function sa(e,t){var n={from:We(t.from),to:or(t),text:zt(e,t.from,t.to)};return zs(e,n,t.from.line,t.to.line+1),lr(e,function(r){return zs(r,n,t.from.line,t.to.line+1)},!0),n}function Fs(e){for(;e.length;){var t=he(e);if(t.ranges)e.pop();else break}}function Zl(e,t){if(t)return Fs(e.done),he(e.done);if(e.done.length&&!he(e.done).ranges)return he(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),he(e.done)}function Bs(e,t,n,r){var i=e.history;i.undone.length=0;var a=+new Date,s,o;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>a-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(s=Zl(i,i.lastOp==r)))o=he(s.changes),G(t.from,t.to)==0&&G(t.from,o.to)==0?o.to=or(t):s.changes.push(sa(e,t));else{var l=he(i.done);for((!l||!l.ranges)&&oi(e.sel,i.done),s={changes:[sa(e,t)],generation:i.generation},i.done.push(s);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=a,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,o||Ce(e,"historyAdded")}function Vl(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function eu(e,t,n,r){var i=e.history,a=r&&r.origin;n==i.lastSelOp||a&&i.lastSelOrigin==a&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==a||Vl(e,a,he(i.done),t))?i.done[i.done.length-1]=t:oi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=a,i.lastSelOp=n,r&&r.clearRedo!==!1&&Fs(i.undone)}function oi(e,t){var n=he(t);n&&n.ranges&&n.equals(e)||t.push(e)}function zs(e,t,n,r){var i=t["spans_"+e.id],a=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(s){s.markedSpans&&((i||(i=t["spans_"+e.id]={}))[a]=s.markedSpans),++a})}function tu(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function ru(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(tu(n[i]));return r}function Us(e,t){var n=ru(e,t),r=Mi(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var a=n[i],s=r[i];if(a&&s)e:for(var o=0;o<s.length;++o){for(var l=s[o],u=0;u<a.length;++u)if(a[u].marker==l.marker)continue e;a.push(l)}else s&&(n[i]=s)}return n}function Gr(e,t,n){for(var r=[],i=0;i<e.length;++i){var a=e[i];if(a.ranges){r.push(n?vt.prototype.deepCopy.call(a):a);continue}var s=a.changes,o=[];r.push({changes:o});for(var l=0;l<s.length;++l){var u=s[l],d=void 0;if(o.push({from:u.from,to:u.to,text:u.text}),t)for(var v in u)(d=v.match(/^spans_(\d+)$/))&&oe(t,Number(d[1]))>-1&&(he(o)[v]=u[v],delete u[v])}}return r}function oa(e,t,n,r){if(r){var i=e.anchor;if(n){var a=G(t,i)<0;a!=G(n,i)<0?(i=t,t=n):a!=G(t,n)<0&&(t=n)}return new pe(i,t)}else return new pe(n||t,t)}function li(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Xe(e,new vt([oa(e.sel.primary(),t,n,i)],0),r)}function Gs(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),a=0;a<e.sel.ranges.length;a++)r[a]=oa(e.sel.ranges[a],t[a],null,i);var s=Lt(e.cm,r,e.sel.primIndex);Xe(e,s,n)}function la(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Xe(e,Lt(e.cm,i,e.sel.primIndex),r)}function Ks(e,t,n,r){Xe(e,sr(t,n),r)}function nu(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var a=0;a<i.length;a++)this.ranges[a]=new pe(ne(e,i[a].anchor),ne(e,i[a].head))},origin:n&&n.origin};return Ce(e,"beforeSelectionChange",e,r),e.cm&&Ce(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Lt(e.cm,r.ranges,r.ranges.length-1):t}function $s(e,t,n){var r=e.history.done,i=he(r);i&&i.ranges?(r[r.length-1]=t,ui(e,t,n)):Xe(e,t,n)}function Xe(e,t,n){ui(e,t,n),eu(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function ui(e,t,n){(lt(e,"beforeSelectionChange")||e.cm&&lt(e.cm,"beforeSelectionChange"))&&(t=nu(e,t,n));var r=n&&n.bias||(G(t.primary().head,e.sel.primary().head)<0?-1:1);qs(e,Ys(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&e.cm.getOption("readOnly")!="nocursor"&&zr(e.cm)}function qs(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,gt(e.cm)),He(e,"cursorActivity",e))}function Xs(e){qs(e,Ys(e,e.sel,null,!1))}function Ys(e,t,n,r){for(var i,a=0;a<t.ranges.length;a++){var s=t.ranges[a],o=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[a],l=fi(e,s.anchor,o&&o.anchor,n,r),u=s.head==s.anchor?l:fi(e,s.head,o&&o.head,n,r);(i||l!=s.anchor||u!=s.head)&&(i||(i=t.ranges.slice(0,a)),i[a]=new pe(l,u))}return i?Lt(e.cm,i,t.primIndex):t}function Kr(e,t,n,r,i){var a=j(e,t.line);if(a.markedSpans)for(var s=0;s<a.markedSpans.length;++s){var o=a.markedSpans[s],l=o.marker,u="selectLeft"in l?!l.selectLeft:l.inclusiveLeft,d="selectRight"in l?!l.selectRight:l.inclusiveRight;if((o.from==null||(u?o.from<=t.ch:o.from<t.ch))&&(o.to==null||(d?o.to>=t.ch:o.to>t.ch))){if(i&&(Ce(l,"beforeCursorEnter"),l.explicitlyCleared))if(a.markedSpans){--s;continue}else break;if(!l.atomic)continue;if(n){var v=l.find(r<0?1:-1),w=void 0;if((r<0?d:u)&&(v=js(e,v,-r,v&&v.line==t.line?a:null)),v&&v.line==t.line&&(w=G(v,n))&&(r<0?w<0:w>0))return Kr(e,v,t,r,i)}var m=l.find(r<0?-1:1);return(r<0?u:d)&&(m=js(e,m,r,m.line==t.line?a:null)),m?Kr(e,m,t,r,i):null}}return t}function fi(e,t,n,r,i){var a=r||1,s=Kr(e,t,n,a,i)||!i&&Kr(e,t,n,a,!0)||Kr(e,t,n,-a,i)||!i&&Kr(e,t,n,-a,!0);return s||(e.cantEdit=!0,S(e.first,0))}function js(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?ne(e,S(t.line-1)):null:n>0&&t.ch==(r||j(e,t.line)).text.length?t.line<e.first+e.size-1?S(t.line+1,0):null:new S(t.line,t.ch+n)}function Js(e){e.setSelection(S(e.firstLine(),0),S(e.lastLine()),ht)}function Qs(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(i,a,s,o){i&&(r.from=ne(e,i)),a&&(r.to=ne(e,a)),s&&(r.text=s),o!==void 0&&(r.origin=o)}),Ce(e,"beforeChange",e,r),e.cm&&Ce(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function $r(e,t,n){if(e.cm){if(!e.cm.curOp)return Fe(e.cm,$r)(e,t,n);if(e.cm.state.suppressEdits)return}if(!((lt(e,"beforeChange")||e.cm&&lt(e.cm,"beforeChange"))&&(t=Qs(e,t,!0),!t))){var r=Ua&&!n&&el(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)Zs(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Zs(e,t)}}function Zs(e,t){if(!(t.text.length==1&&t.text[0]==""&&G(t.from,t.to)==0)){var n=na(e,t);Bs(e,t,n,e.cm?e.cm.curOp.id:NaN),Sn(e,t,n,Mi(e,t));var r=[];lr(e,function(i,a){!a&&oe(r,i.history)==-1&&(ro(i.history,t),r.push(i.history)),Sn(i,t,null,Mi(i,t))})}}function ci(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(!(r&&!n)){for(var i=e.history,a,s=e.sel,o=t=="undo"?i.done:i.undone,l=t=="undo"?i.undone:i.done,u=0;u<o.length&&(a=o[u],!(n?a.ranges&&!a.equals(e.sel):!a.ranges));u++);if(u!=o.length){for(i.lastOrigin=i.lastSelOrigin=null;;)if(a=o.pop(),a.ranges){if(oi(a,l),n&&!a.equals(e.sel)){Xe(e,a,{clearRedo:!1});return}s=a}else if(r){o.push(a);return}else break;var d=[];oi(s,l),l.push({changes:d,generation:i.generation}),i.generation=a.generation||++i.maxGeneration;for(var v=lt(e,"beforeChange")||e.cm&&lt(e.cm,"beforeChange"),w=function(A){var F=a.changes[A];if(F.origin=t,v&&!Qs(e,F,!1))return o.length=0,{};d.push(sa(e,F));var z=A?na(e,F):he(o);Sn(e,F,z,Us(e,F)),!A&&e.cm&&e.cm.scrollIntoView({from:F.from,to:or(F)});var K=[];lr(e,function(U,q){!q&&oe(K,U.history)==-1&&(ro(U.history,F),K.push(U.history)),Sn(U,F,null,Us(U,F))})},m=a.changes.length-1;m>=0;--m){var L=w(m);if(L)return L.v}}}}function Vs(e,t){if(t!=0&&(e.first+=t,e.sel=new vt(dr(e.sel.ranges,function(i){return new pe(S(i.anchor.line+t,i.anchor.ch),S(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm)){nt(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)ir(e.cm,r,"gutter")}}function Sn(e,t,n,r){if(e.cm&&!e.cm.curOp)return Fe(e.cm,Sn)(e,t,n,r);if(t.to.line<e.first){Vs(e,t.text.length-1-(t.to.line-t.from.line));return}if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);Vs(e,i),t={from:S(e.first,0),to:S(t.to.line+i,t.to.ch),text:[he(t.text)],origin:t.origin}}var a=e.lastLine();t.to.line>a&&(t={from:t.from,to:S(a,j(e,a).text.length),text:[t.text[0]],origin:t.origin}),t.removed=zt(e,t.from,t.to),n||(n=na(e,t)),e.cm?iu(e.cm,t,r):aa(e,t,r),ui(e,n,ht),e.cantEdit&&fi(e,S(e.firstLine(),0))&&(e.cantEdit=!1)}}function iu(e,t,n){var r=e.doc,i=e.display,a=t.from,s=t.to,o=!1,l=a.line;e.options.lineWrapping||(l=c(kt(j(r,a.line))),r.iter(l,s.line+1,function(m){if(m==i.maxLine)return o=!0,!0})),r.sel.contains(t.from,t.to)>-1&&gt(e),aa(r,t,n,ms(e)),e.options.lineWrapping||(r.iter(l,a.line+t.text.length,function(m){var L=Yn(m);L>i.maxLineLength&&(i.maxLine=m,i.maxLineLength=L,i.maxLineChanged=!0,o=!1)}),o&&(e.curOp.updateMaxLine=!0)),Xo(r,a.line),wn(e,400);var u=t.text.length-(s.line-a.line)-1;t.full?nt(e):a.line==s.line&&t.text.length==1&&!Ps(e.doc,t)?ir(e,a.line,"text"):nt(e,a.line,s.line+1,u);var d=lt(e,"changes"),v=lt(e,"change");if(v||d){var w={from:a,to:s,text:t.text,removed:t.removed,origin:t.origin};v&&He(e,"change",e,w),d&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(w)}e.display.selForContextMenu=null}function qr(e,t,n,r,i){var a;r||(r=n),G(r,n)<0&&(a=[r,n],n=a[0],r=a[1]),typeof t=="string"&&(t=e.splitLines(t)),$r(e,{from:n,to:r,text:t,origin:i})}function eo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function to(e,t,n,r){for(var i=0;i<e.length;++i){var a=e[i],s=!0;if(a.ranges){a.copied||(a=e[i]=a.deepCopy(),a.copied=!0);for(var o=0;o<a.ranges.length;o++)eo(a.ranges[o].anchor,t,n,r),eo(a.ranges[o].head,t,n,r);continue}for(var l=0;l<a.changes.length;++l){var u=a.changes[l];if(n<u.from.line)u.from=S(u.from.line+r,u.from.ch),u.to=S(u.to.line+r,u.to.ch);else if(t<=u.to.line){s=!1;break}}s||(e.splice(0,i+1),i=0)}}function ro(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;to(e.done,n,r,i),to(e.undone,n,r,i)}function kn(e,t,n,r){var i=t,a=t;return typeof t=="number"?a=j(e,Ia(e,t)):i=c(t),i==null?null:(r(a,i)&&e.cm&&ir(e.cm,i,n),a)}function Tn(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}Tn.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,al(i),He(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}};function Ln(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}Ln.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var a=Math.min(t,i-e),s=r.height;if(r.removeInner(e,a),this.height-=s-r.height,i==a&&(this.children.splice(n--,1),r.parent=null),(t-=a)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Tn))){var o=[];this.collapse(o),this.children=[new Tn(o)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],a=i.chunkSize();if(e<=a){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var s=i.lines.length%25+25,o=s;o<i.lines.length;){var l=new Tn(i.lines.slice(o,o+=25));i.height-=l.height,this.children.splice(++r,0,l),l.parent=this}i.lines=i.lines.slice(0,s),this.maybeSpill()}break}e-=a}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new Ln(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=oe(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new Ln(e.children);r.parent=e,e.children=[r,n],e=r}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],a=i.chunkSize();if(e<a){var s=Math.min(t,a-e);if(i.iterN(e,s,n))return!0;if((t-=s)==0)break;e=0}else e-=a}}};var _n=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};_n.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=c(n);if(!(r==null||!t)){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var a=dn(this);pt(n,Math.max(0,n.height-a)),e&&(ut(e,function(){no(e,n,-a),ir(e,r,"widget")}),He(e,"lineWidgetCleared",e,this,r))}},_n.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=dn(this)-t;i&&(nr(this.doc,r)||pt(r,r.height+i),n&&ut(n,function(){n.curOp.forceUpdate=!0,no(n,r,i),He(n,"lineWidgetChanged",n,e,c(r))}))},bt(_n);function no(e,t,n){Gt(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Qi(e,n)}function au(e,t,n,r){var i=new _n(e,n,r),a=e.cm;return a&&i.noHScroll&&(a.display.alignWidgets=!0),kn(e,t,"widget",function(s){var o=s.widgets||(s.widgets=[]);if(i.insertAt==null?o.push(i):o.splice(Math.min(o.length,Math.max(0,i.insertAt)),0,i),i.line=s,a&&!nr(e,s)){var l=Gt(s)<e.scrollTop;pt(s,s.height+dn(i)),l&&Qi(a,i.height),a.curOp.forceUpdate=!0}return!0}),a&&He(a,"lineWidgetAdded",a,i,typeof t=="number"?t:c(t)),i}var io=0,ur=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++io};ur.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Cr(e),lt(this,"clear")){var n=this.find();n&&He(this,"clear",n.from,n.to)}for(var r=null,i=null,a=0;a<this.lines.length;++a){var s=this.lines[a],o=fn(s.markedSpans,this);e&&!this.collapsed?ir(e,c(s),"text"):e&&(o.to!=null&&(i=c(s)),o.from!=null&&(r=c(s))),s.markedSpans=Jo(s.markedSpans,o),o.from==null&&this.collapsed&&!nr(this.doc,s)&&e&&pt(s,Hr(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var l=0;l<this.lines.length;++l){var u=kt(this.lines[l]),d=Yn(u);d>e.display.maxLineLength&&(e.display.maxLine=u,e.display.maxLineLength=d,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&nt(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Xs(e.doc)),e&&He(e,"markerCleared",e,this,r,i),t&&Sr(e),this.parent&&this.parent.clear()}},ur.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var a=this.lines[i],s=fn(a.markedSpans,this);if(s.from!=null&&(n=S(t?a:c(a),s.from),e==-1))return n;if(s.to!=null&&(r=S(t?a:c(a),s.to),e==1))return r}return n&&{from:n,to:r}},ur.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;!t||!r||ut(r,function(){var i=t.line,a=c(t.line),s=Hi(r,a);if(s&&(fs(s),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!nr(n.doc,i)&&n.height!=null){var o=n.height;n.height=null;var l=dn(n)-o;l&&pt(i,i.height+l)}He(r,"markerChanged",r,e)})},ur.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||oe(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},ur.prototype.detachLine=function(e){if(this.lines.splice(oe(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},bt(ur);function Xr(e,t,n,r,i){if(r&&r.shared)return su(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Fe(e.cm,Xr)(e,t,n,r,i);var a=new ur(e,i),s=G(t,n);if(r&&ue(r,a,!1),s>0||s==0&&a.clearWhenEmpty!==!1)return a;if(a.replacedWith&&(a.collapsed=!0,a.widgetNode=Je("span",[a.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||a.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(a.widgetNode.insertLeft=!0)),a.collapsed){if(Ya(e,t.line,t,n,a)||t.line!=n.line&&Ya(e,n.line,t,n,a))throw new Error("Inserting collapsed marker partially overlapping an existing one");jo()}a.addToHistory&&Bs(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var o=t.line,l=e.cm,u;if(e.iter(o,n.line+1,function(v){l&&a.collapsed&&!l.options.lineWrapping&&kt(v)==l.display.maxLine&&(u=!0),a.collapsed&&o!=t.line&&pt(v,0),Qo(v,new Kn(a,o==t.line?t.ch:null,o==n.line?n.ch:null),e.cm&&e.cm.curOp),++o}),a.collapsed&&e.iter(t.line,n.line+1,function(v){nr(e,v)&&pt(v,0)}),a.clearOnEnter&&ee(a,"beforeCursorEnter",function(){return a.clear()}),a.readOnly&&(Yo(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),a.collapsed&&(a.id=++io,a.atomic=!0),l){if(u&&(l.curOp.updateMaxLine=!0),a.collapsed)nt(l,t.line,n.line+1);else if(a.className||a.startStyle||a.endStyle||a.css||a.attributes||a.title)for(var d=t.line;d<=n.line;d++)ir(l,d,"text");a.atomic&&Xs(l.doc),He(l,"markerAdded",l,a)}return a}var Dn=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};Dn.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();He(this,"clear")}},Dn.prototype.find=function(e,t){return this.primary.find(e,t)},bt(Dn);function su(e,t,n,r,i){r=ue(r),r.shared=!1;var a=[Xr(e,t,n,r,i)],s=a[0],o=r.widgetNode;return lr(e,function(l){o&&(r.widgetNode=o.cloneNode(!0)),a.push(Xr(l,ne(l,t),ne(l,n),r,i));for(var u=0;u<l.linked.length;++u)if(l.linked[u].isParent)return;s=he(a)}),new Dn(a,s)}function ao(e){return e.findMarks(S(e.first,0),e.clipPos(S(e.lastLine())),function(t){return t.parent})}function ou(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),a=e.clipPos(i.from),s=e.clipPos(i.to);if(G(a,s)){var o=Xr(e,a,s,r.primary,r.primary.type);r.markers.push(o),o.parent=r}}}function lu(e){for(var t=function(r){var i=e[r],a=[i.primary.doc];lr(i.primary.doc,function(l){return a.push(l)});for(var s=0;s<i.markers.length;s++){var o=i.markers[s];oe(a,o.doc)==-1&&(o.parent=null,i.markers.splice(s--,1))}},n=0;n<e.length;n++)t(n)}var uu=0,it=function(e,t,n,r,i){if(!(this instanceof it))return new it(e,t,n,r,i);n==null&&(n=0),Ln.call(this,[new Tn([new Er("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var a=S(n,0);this.sel=sr(a),this.history=new si(null),this.id=++uu,this.modeOption=t,this.lineSep=r,this.direction=i=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),aa(this,{from:a,to:a,text:e}),Xe(this,sr(a),ht)};it.prototype=Hn(Ln.prototype,{constructor:it,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=ln(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Be(function(e){var t=S(this.first,0),n=this.first+this.size-1;$r(this,{from:t,to:S(n,j(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&gn(this.cm,0,0),Xe(this,sr(t),ht)}),replaceRange:function(e,t,n,r){t=ne(this,t),n=n?ne(this,n):t,qr(this,e,t,n,r)},getRange:function(e,t,n){var r=zt(this,ne(this,e),ne(this,t));return n===!1?r:n===""?r.join(""):r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(M(this,e))return j(this,e)},getLineNumber:function(e){return c(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=j(this,e)),kt(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ne(this,e)},getCursor:function(e){var t=this.sel.primary(),n;return e==null||e=="head"?n=t.head:e=="anchor"?n=t.anchor:e=="end"||e=="to"||e===!1?n=t.to():n=t.from(),n},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Be(function(e,t,n){Ks(this,ne(this,typeof e=="number"?S(e,t||0):e),null,n)}),setSelection:Be(function(e,t,n){Ks(this,ne(this,e),ne(this,t||e),n)}),extendSelection:Be(function(e,t,n){li(this,ne(this,e),t&&ne(this,t),n)}),extendSelections:Be(function(e,t){Gs(this,Ra(this,e),t)}),extendSelectionsBy:Be(function(e,t){var n=dr(this.sel.ranges,e);Gs(this,Ra(this,n),t)}),setSelections:Be(function(e,t,n){if(e.length){for(var r=[],i=0;i<e.length;i++)r[i]=new pe(ne(this,e[i].anchor),ne(this,e[i].head||e[i].anchor));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Xe(this,Lt(this.cm,r,t),n)}}),addSelection:Be(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new pe(ne(this,e),ne(this,t||e))),Xe(this,Lt(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,r=0;r<t.length;r++){var i=zt(this,t[r].from(),t[r].to());n=n?n.concat(i):i}return e===!1?n:n.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=zt(this,n[r].from(),n[r].to());e!==!1&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:Be(function(e,t,n){for(var r=[],i=this.sel,a=0;a<i.ranges.length;a++){var s=i.ranges[a];r[a]={from:s.from(),to:s.to(),text:this.splitLines(e[a]),origin:n}}for(var o=t&&t!="end"&&Jl(this,r,t),l=r.length-1;l>=0;l--)$r(this,r[l]);o?$s(this,o):this.cm&&zr(this.cm)}),undo:Be(function(){ci(this,"undo")}),redo:Be(function(){ci(this,"redo")}),undoSelection:Be(function(){ci(this,"undo",!0)}),redoSelection:Be(function(){ci(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new si(this.history),lr(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:Gr(this.history.done),undone:Gr(this.history.undone)}},setHistory:function(e){var t=this.history=new si(this.history);t.done=Gr(e.done.slice(0),null,!0),t.undone=Gr(e.undone.slice(0),null,!0)},setGutterMarker:Be(function(e,t,n){return kn(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&Fn(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Be(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&kn(t,n,"gutter",function(){return n.gutterMarkers[e]=null,Fn(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!M(this,e)||(t=e,e=j(this,e),!e))return null}else if(t=c(e),t==null)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:Be(function(e,t,n){return kn(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[i])r[i]=n;else{if(ye(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:Be(function(e,t,n){return kn(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",a=r[i];if(a)if(n==null)r[i]=null;else{var s=a.match(ye(n));if(!s)return!1;var o=s.index+s[0].length;r[i]=a.slice(0,s.index)+(!s.index||o==a.length?"":" ")+a.slice(o)||null}else return!1;return!0})}),addLineWidget:Be(function(e,t,n){return au(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return Xr(this,ne(this,e),ne(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=ne(this,e),Xr(this,e,e,n,"bookmark")},findMarksAt:function(e){e=ne(this,e);var t=[],n=j(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(i.from==null||i.from<=e.ch)&&(i.to==null||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=ne(this,e),t=ne(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(a){var s=a.markedSpans;if(s)for(var o=0;o<s.length;o++){var l=s[o];!(l.to!=null&&i==e.line&&e.ch>=l.to||l.from==null&&i!=e.line||l.from!=null&&i==t.line&&l.from>=t.ch)&&(!n||n(l.marker))&&r.push(l.marker.parent||l.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(i){var a=i.text.length+r;if(a>e)return t=e,!0;e-=a,++n}),ne(this,S(n,t))},indexFromPos:function(e){e=ne(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+n}),t},copy:function(e){var t=new it(ln(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var r=new it(ln(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],ou(r,ao(this)),r},unlinkDoc:function(e){if(e instanceof be&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc==e){this.linked.splice(t,1),e.unlinkDoc(this),lu(ao(this));break}}if(e.history==this.history){var r=[e.id];lr(e,function(i){return r.push(i.id)},!0),e.history=new si(null),e.history.done=Gr(this.history.done,r),e.history.undone=Gr(this.history.undone,r)}},iterLinkedDocs:function(e){lr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):yt(e)},lineSeparator:function(){return this.lineSep||`
11
+ `},setDirection:Be(function(e){e!="rtl"&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&Ql(this.cm))})}),it.prototype.eachLine=it.prototype.iter;var so=0;function fu(e){var t=this;if(oo(t),!(Se(t,e)||Kt(t.display,e))){qe(e),_&&(so=+new Date);var n=mr(t,e,!0),r=e.dataTransfer.files;if(!(!n||t.isReadOnly()))if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,a=Array(i),s=0,o=function(){++s==i&&Fe(t,function(){n=ne(t.doc,n);var m={from:n,to:n,text:t.doc.splitLines(a.filter(function(L){return L!=null}).join(t.doc.lineSeparator())),origin:"paste"};$r(t.doc,m),$s(t.doc,sr(ne(t.doc,n),ne(t.doc,or(m))))})()},l=function(m,L){if(t.options.allowDropFileTypes&&oe(t.options.allowDropFileTypes,m.type)==-1){o();return}var A=new FileReader;A.onerror=function(){return o()},A.onload=function(){var F=A.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(F)){o();return}a[L]=F,o()},A.readAsText(m)},u=0;u<r.length;u++)l(r[u],u);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var d=e.dataTransfer.getData("Text");if(d){var v;if(t.state.draggingText&&!t.state.draggingText.copy&&(v=t.listSelections()),ui(t.doc,sr(n,n)),v)for(var w=0;w<v.length;++w)qr(t.doc,"",v[w].anchor,v[w].head,"drag");t.replaceSelection(d,"around","paste"),t.display.input.focus()}}catch{}}}}function cu(e,t){if(_&&(!e.state.draggingText||+new Date-so<100)){Vt(t);return}if(!(Se(e,t)||Kt(e.display,t))&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!J)){var n=g("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",B&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),B&&n.parentNode.removeChild(n)}}function hu(e,t){var n=mr(e,t);if(n){var r=document.createDocumentFragment();qi(e,n,r),e.display.dragCursor||(e.display.dragCursor=g("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),$(e.display.dragCursor,r)}}function oo(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function lo(e){if(document.getElementsByClassName){for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var a=0;a<n.length;a++)e(n[a])})}}var uo=!1;function du(){uo||(pu(),uo=!0)}function pu(){var e;ee(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,lo(vu)},100))}),ee(window,"blur",function(){return lo(Br)})}function vu(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var fr={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"},On=0;On<10;On++)fr[On+48]=fr[On+96]=String(On);for(var hi=65;hi<=90;hi++)fr[hi]=String.fromCharCode(hi);for(var Mn=1;Mn<=12;Mn++)fr[Mn+111]=fr[Mn+63235]="F"+Mn;var qt={};qt.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"},qt.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"},qt.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"},qt.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"]},qt.default=Z?qt.macDefault:qt.pcDefault;function gu(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,a,s=0;s<t.length-1;s++){var o=t[s];if(/^(cmd|meta|m)$/i.test(o))a=!0;else if(/^a(lt)?$/i.test(o))n=!0;else if(/^(c|ctrl|control)$/i.test(o))r=!0;else if(/^s(hift)?$/i.test(o))i=!0;else throw new Error("Unrecognized modifier name: "+o)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),a&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function yu(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(r=="..."){delete e[n];continue}for(var i=dr(n.split(" "),gu),a=0;a<i.length;a++){var s=void 0,o=void 0;a==i.length-1?(o=i.join(" "),s=r):(o=i.slice(0,a+1).join(" "),s="...");var l=t[o];if(!l)t[o]=s;else if(l!=s)throw new Error("Inconsistent bindings for "+o)}delete e[n]}for(var u in t)e[u]=t[u];return e}function Yr(e,t,n,r){t=di(t);var i=t.call?t.call(e,r):t[e];if(i===!1)return"nothing";if(i==="...")return"multi";if(i!=null&&n(i))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return Yr(e,t.fallthrough,n,r);for(var a=0;a<t.fallthrough.length;a++){var s=Yr(e,t.fallthrough[a],n,r);if(s)return s}}}function fo(e){var t=typeof e=="string"?e:fr[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function co(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(Ie?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(Ie?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function ho(e,t){if(B&&e.keyCode==34&&e.char)return!1;var n=fr[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),co(n,e,t))}function di(e){return typeof e=="string"?qt[e]:e}function jr(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var a=t(n[i]);r.length&&G(a.from,he(r).to)<=0;){var s=r.pop();if(G(s.from,a.from)<0){a.from=s.from;break}}r.push(a)}ut(e,function(){for(var o=r.length-1;o>=0;o--)qr(e.doc,"",r[o].from,r[o].to,"+delete");zr(e)})}function ua(e,t,n){var r=Jt(e.text,t+n,n);return r<0||r>e.text.length?null:r}function fa(e,t,n){var r=ua(e,t.ch,n);return r==null?null:new S(t.line,r,n<0?"after":"before")}function ca(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var a=ce(n,t.doc.direction);if(a){var s=i<0?he(a):a[0],o=i<0==(s.level==1),l=o?"after":"before",u;if(s.level>0||t.doc.direction=="rtl"){var d=Wr(t,n);u=i<0?n.text.length-1:0;var v=Et(t,d,u).top;u=Nt(function(w){return Et(t,d,w).top==v},i<0==(s.level==1)?s.from:s.to-1,u),l=="before"&&(u=ua(n,u,1))}else u=i<0?s.to:s.from;return new S(r,u,l)}}return new S(r,i<0?n.text.length:0,i<0?"before":"after")}function mu(e,t,n,r){var i=ce(t,e.doc.direction);if(!i)return fa(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var a=Zt(i,n.ch,n.sticky),s=i[a];if(e.doc.direction=="ltr"&&s.level%2==0&&(r>0?s.to>n.ch:s.from<n.ch))return fa(t,n,r);var o=function(z,K){return ua(t,z instanceof S?z.ch:z,K)},l,u=function(z){return e.options.lineWrapping?(l=l||Wr(e,t),ys(e,t,l,z)):{begin:0,end:t.text.length}},d=u(n.sticky=="before"?o(n,-1):n.ch);if(e.doc.direction=="rtl"||s.level==1){var v=s.level==1==r<0,w=o(n,v?1:-1);if(w!=null&&(v?w<=s.to&&w<=d.end:w>=s.from&&w>=d.begin)){var m=v?"before":"after";return new S(n.line,w,m)}}var L=function(z,K,U){for(var q=function(me,ze){return ze?new S(n.line,o(me,1),"before"):new S(n.line,me,"after")};z>=0&&z<i.length;z+=K){var te=i[z],V=K>0==(te.level!=1),le=V?U.begin:o(U.end,-1);if(te.from<=le&&le<te.to||(le=V?te.from:o(te.to,-1),U.begin<=le&&le<U.end))return q(le,V)}},A=L(a+r,r,d);if(A)return A;var F=r>0?d.end:o(d.begin,-1);return F!=null&&!(r>0&&F==t.text.length)&&(A=L(r>0?0:i.length-1,r,u(F)),A)?A:null}var Nn={selectAll:Js,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ht)},killLine:function(e){return jr(e,function(t){if(t.empty()){var n=j(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:S(t.head.line+1,0)}:{from:t.head,to:S(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return jr(e,function(t){return{from:S(t.from().line,0),to:ne(e.doc,S(t.to().line+1,0))}})},delLineLeft:function(e){return jr(e,function(t){return{from:S(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return jr(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return jr(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(S(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(S(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return po(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return vo(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return bu(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},dt)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},dt)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?vo(e,t.head):r},dt)},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(" ")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var a=n[i].from(),s=ve(e.getLine(a.line),a.ch,r);t.push(rn(r-s%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return ut(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++)if(t[r].empty()){var i=t[r].head,a=j(e.doc,i.line).text;if(a){if(i.ch==a.length&&(i=new S(i.line,i.ch-1)),i.ch>0)i=new S(i.line,i.ch+1),e.replaceRange(a.charAt(i.ch-1)+a.charAt(i.ch-2),S(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var s=j(e.doc,i.line-1).text;s&&(i=new S(i.line,1),e.replaceRange(a.charAt(0)+e.doc.lineSeparator()+s.charAt(s.length-1),S(i.line-1,s.length-1),i,"+transpose"))}}n.push(new pe(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return ut(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);zr(e)})},openLine:function(e){return e.replaceSelection(`
12
+ `,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function po(e,t){var n=j(e.doc,t),r=kt(n);return r!=n&&(t=c(r)),ca(!0,e,r,t,1)}function bu(e,t){var n=j(e.doc,t),r=rl(n);return r!=n&&(t=c(r)),ca(!0,e,n,t,-1)}function vo(e,t){var n=po(e,t.line),r=j(e.doc,n.line),i=ce(r,e.doc.direction);if(!i||i[0].level==0){var a=Math.max(n.ch,r.text.search(/\S/)),s=t.line==n.line&&t.ch<=a&&t.ch;return S(n.line,s?0:a,n.sticky)}return n}function pi(e,t,n){if(typeof t=="string"&&(t=Nn[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=jt}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function wu(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Yr(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Yr(t,e.options.extraKeys,n,e)||Yr(t,e.options.keyMap,n,e)}var xu=new Dt;function An(e,t,n,r){var i=e.state.keySeq;if(i){if(fo(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:xu.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),go(e,i+" "+t,n,r))return!0}return go(e,t,n,r)}function go(e,t,n,r){var i=wu(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&He(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(qe(n),Xi(e)),!!i}function yo(e,t){var n=ho(t,!0);return n?t.shiftKey&&!e.state.keySeq?An(e,"Shift-"+n,t,function(r){return pi(e,r,!0)})||An(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return pi(e,r)}):An(e,n,t,function(r){return pi(e,r)}):!1}function Cu(e,t,n){return An(e,"'"+n+"'",t,function(r){return pi(e,r,!0)})}var ha=null;function mo(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField())&&(t.curOp.focus=_e(mt(t)),!Se(t,e))){_&&b<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=yo(t,e);B&&(ha=r?n:null,!r&&n==88&&!Un&&(Z?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),T&&!Z&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Su(t)}}function Su(e){var t=e.display.lineDiv;xe(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(je(t,"CodeMirror-crosshair"),$e(document,"keyup",n),$e(document,"mouseover",n))}ee(document,"keyup",n),ee(document,"mouseover",n)}function bo(e){e.keyCode==16&&(this.doc.sel.shift=!1),Se(this,e)}function wo(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField())&&!(Kt(t.display,e)||Se(t,e)||e.ctrlKey&&!e.altKey||Z&&e.metaKey)){var n=e.keyCode,r=e.charCode;if(B&&n==ha){ha=null,qe(e);return}if(!(B&&(!e.which||e.which<10)&&yo(t,e))){var i=String.fromCharCode(r??n);i!="\b"&&(Cu(t,e,i)||t.display.input.onKeyPress(e))}}}var ku=400,da=function(e,t,n){this.time=e,this.pos=t,this.button=n};da.prototype.compare=function(e,t,n){return this.time+ku>e&&G(t,this.pos)==0&&n==this.button};var In,Rn;function Tu(e,t){var n=+new Date;return Rn&&Rn.compare(n,e,t)?(In=Rn=null,"triple"):In&&In.compare(n,e,t)?(Rn=new da(n,e,t),In=null,"double"):(In=new da(n,e,t),Rn=null,"single")}function xo(e){var t=this,n=t.display;if(!(Se(t,e)||n.activeTouch&&n.input.supportsTouch())){if(n.input.ensurePolled(),n.shift=e.shiftKey,Kt(n,e)){D||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(!pa(t,e)){var r=mr(t,e),i=wt(e),a=r?Tu(r,i):"single";ae(t).focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&Lu(t,i,r,a,e))&&(i==1?r?Du(t,r,a,e):an(e)==n.scroller&&qe(e):i==2?(r&&li(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(Ne?t.display.input.onContextMenu(e):Yi(t)))}}}function Lu(e,t,n,r,i){var a="Click";return r=="double"?a="Double"+a:r=="triple"&&(a="Triple"+a),a=(t==1?"Left":t==2?"Middle":"Right")+a,An(e,co(a,i),i,function(s){if(typeof s=="string"&&(s=Nn[s]),!s)return!1;var o=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),o=s(e,n)!=jt}finally{e.state.suppressEdits=!1}return o})}function _u(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var a=ie?n.shiftKey&&n.metaKey:n.altKey;i.unit=a?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=Z?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(Z?n.altKey:n.ctrlKey)),i}function Du(e,t,n,r){_?setTimeout(re(xs,e),0):e.curOp.focus=_e(mt(e));var i=_u(e,n,r),a=e.doc.sel,s;e.options.dragDrop&&Li&&!e.isReadOnly()&&n=="single"&&(s=a.contains(t))>-1&&(G((s=a.ranges[s]).from(),t)<0||t.xRel>0)&&(G(s.to(),t)>0||t.xRel<0)?Ou(e,r,t,i):Mu(e,r,t,i)}function Ou(e,t,n,r){var i=e.display,a=!1,s=Fe(e,function(u){D&&(i.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:Yi(e)),$e(i.wrapper.ownerDocument,"mouseup",s),$e(i.wrapper.ownerDocument,"mousemove",o),$e(i.scroller,"dragstart",l),$e(i.scroller,"drop",s),a||(qe(u),r.addNew||li(e.doc,n,null,null,r.extend),D&&!J||_&&b==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),o=function(u){a=a||Math.abs(t.clientX-u.clientX)+Math.abs(t.clientY-u.clientY)>=10},l=function(){return a=!0};D&&(i.scroller.draggable=!0),e.state.draggingText=s,s.copy=!r.moveOnDrag,ee(i.wrapper.ownerDocument,"mouseup",s),ee(i.wrapper.ownerDocument,"mousemove",o),ee(i.scroller,"dragstart",l),ee(i.scroller,"drop",s),e.state.delayingBlurEvent=!0,setTimeout(function(){return i.input.focus()},20),i.scroller.dragDrop&&i.scroller.dragDrop()}function Co(e,t,n){if(n=="char")return new pe(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new pe(S(t.line,0),ne(e.doc,S(t.line+1,0)));var r=n(e,t);return new pe(r.from,r.to)}function Mu(e,t,n,r){_&&Yi(e);var i=e.display,a=e.doc;qe(t);var s,o,l=a.sel,u=l.ranges;if(r.addNew&&!r.extend?(o=a.sel.contains(n),o>-1?s=u[o]:s=new pe(n,n)):(s=a.sel.primary(),o=a.sel.primIndex),r.unit=="rectangle")r.addNew||(s=new pe(n,n)),n=mr(e,t,!0,!0),o=-1;else{var d=Co(e,n,r.unit);r.extend?s=oa(s,d.anchor,d.head,r.extend):s=d}r.addNew?o==-1?(o=u.length,Xe(a,Lt(e,u.concat([s]),o),{scroll:!1,origin:"*mouse"})):u.length>1&&u[o].empty()&&r.unit=="char"&&!r.extend?(Xe(a,Lt(e,u.slice(0,o).concat(u.slice(o+1)),0),{scroll:!1,origin:"*mouse"}),l=a.sel):la(a,o,s,Ot):(o=0,Xe(a,new vt([s],0),Ot),l=a.sel);var v=n;function w(U){if(G(v,U)!=0)if(v=U,r.unit=="rectangle"){for(var q=[],te=e.options.tabSize,V=ve(j(a,n.line).text,n.ch,te),le=ve(j(a,U.line).text,U.ch,te),me=Math.min(V,le),ze=Math.max(V,le),we=Math.min(n.line,U.line),ft=Math.min(e.lastLine(),Math.max(n.line,U.line));we<=ft;we++){var at=j(a,we).text,Oe=Mt(at,me,te);me==ze?q.push(new pe(S(we,Oe),S(we,Oe))):at.length>Oe&&q.push(new pe(S(we,Oe),S(we,Mt(at,ze,te))))}q.length||q.push(new pe(n,n)),Xe(a,Lt(e,l.ranges.slice(0,o).concat(q),o),{origin:"*mouse",scroll:!1}),e.scrollIntoView(U)}else{var st=s,Ge=Co(e,U,r.unit),Ae=st.anchor,Me;G(Ge.anchor,Ae)>0?(Me=Ge.head,Ae=Rr(st.from(),Ge.anchor)):(Me=Ge.anchor,Ae=rt(st.to(),Ge.head));var Te=l.ranges.slice(0);Te[o]=Nu(e,new pe(ne(a,Ae),Me)),Xe(a,Lt(e,Te,o),Ot)}}var m=i.wrapper.getBoundingClientRect(),L=0;function A(U){var q=++L,te=mr(e,U,!0,r.unit=="rectangle");if(te)if(G(te,v)!=0){e.curOp.focus=_e(mt(e)),w(te);var V=ri(i,a);(te.line>=V.to||te.line<V.from)&&setTimeout(Fe(e,function(){L==q&&A(U)}),150)}else{var le=U.clientY<m.top?-20:U.clientY>m.bottom?20:0;le&&setTimeout(Fe(e,function(){L==q&&(i.scroller.scrollTop+=le,A(U))}),50)}}function F(U){e.state.selectingText=!1,L=1/0,U&&(qe(U),i.input.focus()),$e(i.wrapper.ownerDocument,"mousemove",z),$e(i.wrapper.ownerDocument,"mouseup",K),a.history.lastSelOrigin=null}var z=Fe(e,function(U){U.buttons===0||!wt(U)?F(U):A(U)}),K=Fe(e,F);e.state.selectingText=K,ee(i.wrapper.ownerDocument,"mousemove",z),ee(i.wrapper.ownerDocument,"mouseup",K)}function Nu(e,t){var n=t.anchor,r=t.head,i=j(e.doc,n.line);if(G(n,r)==0&&n.sticky==r.sticky)return t;var a=ce(i);if(!a)return t;var s=Zt(a,n.ch,n.sticky),o=a[s];if(o.from!=n.ch&&o.to!=n.ch)return t;var l=s+(o.from==n.ch==(o.level!=1)?0:1);if(l==0||l==a.length)return t;var u;if(r.line!=n.line)u=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var d=Zt(a,r.ch,r.sticky),v=d-s||(r.ch-n.ch)*(o.level==1?-1:1);d==l-1||d==l?u=v<0:u=v>0}var w=a[l+(u?-1:0)],m=u==(w.level==1),L=m?w.from:w.to,A=m?"after":"before";return n.ch==L&&n.sticky==A?t:new pe(new S(n.line,L,A),r)}function So(e,t,n,r){var i,a;if(t.touches)i=t.touches[0].clientX,a=t.touches[0].clientY;else try{i=t.clientX,a=t.clientY}catch{return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&qe(t);var s=e.display,o=s.lineDiv.getBoundingClientRect();if(a>o.bottom||!lt(e,n))return tt(t);a-=o.top-s.viewOffset;for(var l=0;l<e.display.gutterSpecs.length;++l){var u=s.gutters.childNodes[l];if(u&&u.getBoundingClientRect().right>=i){var d=p(e.doc,a),v=e.display.gutterSpecs[l];return Ce(e,n,e,d,v.className,t),tt(t)}}}function pa(e,t){return So(e,t,"gutterClick",!0)}function ko(e,t){Kt(e.display,t)||Au(e,t)||Se(e,t,"contextmenu")||Ne||e.display.input.onContextMenu(t)}function Au(e,t){return lt(e,"gutterContextMenu")?So(e,t,"gutterContextMenu",!1):!1}function To(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),pn(e)}var Jr={toString:function(){return"CodeMirror.Init"}},Lo={},vi={};function Iu(e){var t=e.optionHandlers;function n(r,i,a,s){e.defaults[r]=i,a&&(t[r]=s?function(o,l,u){u!=Jr&&a(o,l,u)}:a)}e.defineOption=n,e.Init=Jr,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,ia(r)},!0),n("indentUnit",2,ia,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){Cn(r),pn(r),nt(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!!i){var a=[],s=r.doc.first;r.doc.iter(function(l){for(var u=0;;){var d=l.text.indexOf(i,u);if(d==-1)break;u=d+i.length,a.push(S(s,d))}s++});for(var o=a.length-1;o>=0;o--)qr(r.doc,i,a[o],S(a[o].line,a[o].ch+i.length))}}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(r,i,a){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),a!=Jr&&r.refresh()}),n("specialCharPlaceholder",ll,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",X?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!se),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){To(r),xn(r)},!0),n("keyMap","default",function(r,i,a){var s=di(i),o=a!=Jr&&di(a);o&&o.detach&&o.detach(r,s),s.attach&&s.attach(r,o||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Eu,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=ra(i,r.options.lineNumbers),xn(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?Ki(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return Ur(r)},!0),n("scrollbarStyle","native",function(r){_s(r),Ur(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=ra(r.options.gutters,i),xn(r)},!0),n("firstLineNumber",1,xn,!0),n("lineNumberFormatter",function(r){return r},xn,!0),n("showCursorWhenSelecting",!1,vn,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Br(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Ru),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,vn,!0),n("singleCursorHeightPerLine",!0,vn,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Cn,!0),n("addModeClass",!1,Cn,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,Cn,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Ru(e,t,n){var r=n&&n!=Jr;if(!t!=!r){var i=e.display.dragFunctions,a=t?ee:$e;a(e.display.scroller,"dragstart",i.start),a(e.display.scroller,"dragenter",i.enter),a(e.display.scroller,"dragover",i.over),a(e.display.scroller,"dragleave",i.leave),a(e.display.scroller,"drop",i.drop)}}function Eu(e){e.options.lineWrapping?(xe(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(je(e.display.wrapper,"CodeMirror-wrap"),Ri(e)),$i(e),nt(e),pn(e),setTimeout(function(){return Ur(e)},100)}function be(e,t){var n=this;if(!(this instanceof be))return new be(e,t);this.options=t=t?ue(t):{},ue(Lo,t,!1);var r=t.value;typeof r=="string"?r=new it(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new be.inputStyles[t.inputStyle](this),a=this.display=new Yl(e,r,i,t);a.wrapper.CodeMirror=this,To(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),_s(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new Dt,keySeq:null,specialChars:null},t.autofocus&&!X&&a.input.focus(),_&&b<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Pu(this),du(),Cr(this),this.curOp.forceUpdate=!0,Ws(this,r),t.autofocus&&!X||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&ji(n)},20):Br(this);for(var s in vi)vi.hasOwnProperty(s)&&vi[s](this,t[s],Jr);Ms(this),t.finishInit&&t.finishInit(this);for(var o=0;o<va.length;++o)va[o](this);Sr(this),D&&t.lineWrapping&&getComputedStyle(a.lineDiv).textRendering=="optimizelegibility"&&(a.lineDiv.style.textRendering="auto")}be.defaults=Lo,be.optionHandlers=vi;function Pu(e){var t=e.display;ee(t.scroller,"mousedown",Fe(e,xo)),_&&b<11?ee(t.scroller,"dblclick",Fe(e,function(l){if(!Se(e,l)){var u=mr(e,l);if(!(!u||pa(e,l)||Kt(e.display,l))){qe(l);var d=e.findWordAt(u);li(e.doc,d.anchor,d.head)}}})):ee(t.scroller,"dblclick",function(l){return Se(e,l)||qe(l)}),ee(t.scroller,"contextmenu",function(l){return ko(e,l)}),ee(t.input.getField(),"contextmenu",function(l){t.scroller.contains(l.target)||ko(e,l)});var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function a(l){if(l.touches.length!=1)return!1;var u=l.touches[0];return u.radiusX<=1&&u.radiusY<=1}function s(l,u){if(u.left==null)return!0;var d=u.left-l.left,v=u.top-l.top;return d*d+v*v>20*20}ee(t.scroller,"touchstart",function(l){if(!Se(e,l)&&!a(l)&&!pa(e,l)){t.input.ensurePolled(),clearTimeout(n);var u=+new Date;t.activeTouch={start:u,moved:!1,prev:u-r.end<=300?r:null},l.touches.length==1&&(t.activeTouch.left=l.touches[0].pageX,t.activeTouch.top=l.touches[0].pageY)}}),ee(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),ee(t.scroller,"touchend",function(l){var u=t.activeTouch;if(u&&!Kt(t,l)&&u.left!=null&&!u.moved&&new Date-u.start<300){var d=e.coordsChar(t.activeTouch,"page"),v;!u.prev||s(u,u.prev)?v=new pe(d,d):!u.prev.prev||s(u,u.prev.prev)?v=e.findWordAt(d):v=new pe(S(d.line,0),ne(e.doc,S(d.line+1,0))),e.setSelection(v.anchor,v.head),e.focus(),qe(l)}i()}),ee(t.scroller,"touchcancel",i),ee(t.scroller,"scroll",function(){t.scroller.clientHeight&&(yn(e,t.scroller.scrollTop),wr(e,t.scroller.scrollLeft,!0),Ce(e,"scroll",e))}),ee(t.scroller,"mousewheel",function(l){return Is(e,l)}),ee(t.scroller,"DOMMouseScroll",function(l){return Is(e,l)}),ee(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(l){Se(e,l)||Vt(l)},over:function(l){Se(e,l)||(hu(e,l),Vt(l))},start:function(l){return cu(e,l)},drop:Fe(e,fu),leave:function(l){Se(e,l)||oo(e)}};var o=t.input.getField();ee(o,"keyup",function(l){return bo.call(e,l)}),ee(o,"keydown",Fe(e,mo)),ee(o,"keypress",Fe(e,wo)),ee(o,"focus",function(l){return ji(e,l)}),ee(o,"blur",function(l){return Br(e,l)})}var va=[];be.defineInitHook=function(e){return va.push(e)};function En(e,t,n,r){var i=e.doc,a;n==null&&(n="add"),n=="smart"&&(i.mode.indent?a=un(e,t).state:n="prev");var s=e.options.tabSize,o=j(i,t),l=ve(o.text,null,s);o.stateAfter&&(o.stateAfter=null);var u=o.text.match(/^\s*/)[0],d;if(!r&&!/\S/.test(o.text))d=0,n="not";else if(n=="smart"&&(d=i.mode.indent(a,o.text.slice(u.length),o.text),d==jt||d>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?d=ve(j(i,t-1).text,null,s):d=0:n=="add"?d=l+e.options.indentUnit:n=="subtract"?d=l-e.options.indentUnit:typeof n=="number"&&(d=l+n),d=Math.max(0,d);var v="",w=0;if(e.options.indentWithTabs)for(var m=Math.floor(d/s);m;--m)w+=s,v+=" ";if(w<d&&(v+=rn(d-w)),v!=u)return qr(i,v,S(t,0),S(t,u.length),"+input"),o.stateAfter=null,!0;for(var L=0;L<i.sel.ranges.length;L++){var A=i.sel.ranges[L];if(A.head.line==t&&A.head.ch<u.length){var F=S(t,u.length);la(i,L,new pe(F,F));break}}}var _t=null;function gi(e){_t=e}function ga(e,t,n,r,i){var a=e.doc;e.display.shift=!1,r||(r=a.sel);var s=+new Date-200,o=i=="paste"||e.state.pasteIncoming>s,l=yt(t),u=null;if(o&&r.ranges.length>1)if(_t&&_t.text.join(`
13
+ `)==t){if(r.ranges.length%_t.text.length==0){u=[];for(var d=0;d<_t.text.length;d++)u.push(a.splitLines(_t.text[d]))}}else l.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(u=dr(l,function(z){return[z]}));for(var v=e.curOp.updateInput,w=r.ranges.length-1;w>=0;w--){var m=r.ranges[w],L=m.from(),A=m.to();m.empty()&&(n&&n>0?L=S(L.line,L.ch-n):e.state.overwrite&&!o?A=S(A.line,Math.min(j(a,A.line).text.length,A.ch+he(l).length)):o&&_t&&_t.lineWise&&_t.text.join(`
14
+ `)==l.join(`
15
+ `)&&(L=A=S(L.line,0)));var F={from:L,to:A,text:u?u[w%u.length]:l,origin:i||(o?"paste":e.state.cutIncoming>s?"cut":"+input")};$r(e.doc,F),He(e,"inputRead",e,F)}t&&!o&&Do(e,t),zr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=v),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function _o(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&ut(t,function(){return ga(t,n,0,null,"paste")}),!0}function Do(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var a=e.getModeAt(i.head),s=!1;if(a.electricChars){for(var o=0;o<a.electricChars.length;o++)if(t.indexOf(a.electricChars.charAt(o))>-1){s=En(e,i.head.line,"smart");break}}else a.electricInput&&a.electricInput.test(j(e.doc,i.head.line).text.slice(0,i.head.ch))&&(s=En(e,i.head.line,"smart"));s&&He(e,"electricInput",e,i.head.line)}}}function Oo(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,a={anchor:S(i,0),head:S(i+1,0)};n.push(a),t.push(e.getRange(a.anchor,a.head))}return{text:t,ranges:n}}function ya(e,t,n,r){e.setAttribute("autocorrect",n?"on":"off"),e.setAttribute("autocapitalize",r?"on":"off"),e.setAttribute("spellcheck",!!t)}function Mo(){var e=g("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none"),t=g("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return D?e.style.width="1000px":e.setAttribute("wrap","off"),k&&(e.style.border="1px solid black"),t}function Wu(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){ae(this).focus(),this.display.input.focus()},setOption:function(r,i){var a=this.options,s=a[r];a[r]==i&&r!="mode"||(a[r]=i,t.hasOwnProperty(r)&&Fe(this,t[r])(this,i,s),Ce(this,"optionChange",this,r))},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,i){this.state.keyMaps[i?"push":"unshift"](di(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,a=0;a<i.length;++a)if(i[a]==r||i[a].name==r)return i.splice(a,1),!0},addOverlay:Ze(function(r,i){var a=r.token?r:e.getMode(this.options,r);if(a.startState)throw new Error("Overlays may not be stateful.");Si(this.state.overlays,{mode:a,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(s){return s.priority}),this.state.modeGen++,nt(this)}),removeOverlay:Ze(function(r){for(var i=this.state.overlays,a=0;a<i.length;++a){var s=i[a].modeSpec;if(s==r||typeof r=="string"&&s.name==r){i.splice(a,1),this.state.modeGen++,nt(this);return}}}),indentLine:Ze(function(r,i,a){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),M(this.doc,r)&&En(this,r,i,a)}),indentSelection:Ze(function(r){for(var i=this.doc.sel.ranges,a=-1,s=0;s<i.length;s++){var o=i[s];if(o.empty())o.head.line>a&&(En(this,o.head.line,r,!0),a=o.head.line,s==this.doc.sel.primIndex&&zr(this));else{var l=o.from(),u=o.to(),d=Math.max(a,l.line);a=Math.min(this.lastLine(),u.line-(u.ch?0:1))+1;for(var v=d;v<a;++v)En(this,v,r);var w=this.doc.sel.ranges;l.ch==0&&i.length==w.length&&w[s].from().ch>0&&la(this.doc,s,new pe(l,w[s].to()),ht)}}}),getTokenAt:function(r,i){return Fa(this,r,i)},getLineTokens:function(r,i){return Fa(this,S(r),i,!0)},getTokenTypeAt:function(r){r=ne(this.doc,r);var i=Pa(this,j(this.doc,r.line)),a=0,s=(i.length-1)/2,o=r.ch,l;if(o==0)l=i[2];else for(;;){var u=a+s>>1;if((u?i[u*2-1]:0)>=o)s=u;else if(i[u*2+1]<o)a=u+1;else{l=i[u*2+2];break}}var d=l?l.indexOf("overlay "):-1;return d<0?l:d==0?null:l.slice(0,d-1)},getModeAt:function(r){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(r).state).mode:i},getHelper:function(r,i){return this.getHelpers(r,i)[0]},getHelpers:function(r,i){var a=[];if(!n.hasOwnProperty(i))return a;var s=n[i],o=this.getModeAt(r);if(typeof o[i]=="string")s[o[i]]&&a.push(s[o[i]]);else if(o[i])for(var l=0;l<o[i].length;l++){var u=s[o[i][l]];u&&a.push(u)}else o.helperType&&s[o.helperType]?a.push(s[o.helperType]):s[o.name]&&a.push(s[o.name]);for(var d=0;d<s._global.length;d++){var v=s._global[d];v.pred(o,this)&&oe(a,v.val)==-1&&a.push(v.val)}return a},getStateAfter:function(r,i){var a=this.doc;return r=Ia(a,r??a.first+a.size-1),un(this,r+1,i).state},cursorCoords:function(r,i){var a,s=this.doc.sel.primary();return r==null?a=s.head:typeof r=="object"?a=ne(this.doc,r):a=r?s.from():s.to(),Tt(this,a,i||"page")},charCoords:function(r,i){return Zn(this,ne(this.doc,r),i||"page")},coordsChar:function(r,i){return r=ps(this,r,i||"page"),zi(this,r.left,r.top)},lineAtHeight:function(r,i){return r=ps(this,{top:r,left:0},i||"page").top,p(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,a){var s=!1,o;if(typeof r=="number"){var l=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>l&&(r=l,s=!0),o=j(this.doc,r)}else o=r;return Qn(this,o,{top:0,left:0},i||"page",a||s).top+(s?this.doc.height-Gt(o):0)},defaultTextHeight:function(){return Hr(this.display)},defaultCharWidth:function(){return Fr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,a,s,o){var l=this.display;r=Tt(this,ne(this.doc,r));var u=r.bottom,d=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),l.sizer.appendChild(i),s=="over")u=r.top;else if(s=="above"||s=="near"){var v=Math.max(l.wrapper.clientHeight,this.doc.height),w=Math.max(l.sizer.clientWidth,l.lineSpace.clientWidth);(s=="above"||r.bottom+i.offsetHeight>v)&&r.top>i.offsetHeight?u=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=v&&(u=r.bottom),d+i.offsetWidth>w&&(d=w-i.offsetWidth)}i.style.top=u+"px",i.style.left=i.style.right="",o=="right"?(d=l.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(o=="left"?d=0:o=="middle"&&(d=(l.sizer.clientWidth-i.offsetWidth)/2),i.style.left=d+"px"),a&&Rl(this,{left:d,top:u,right:d+i.offsetWidth,bottom:u+i.offsetHeight})},triggerOnKeyDown:Ze(mo),triggerOnKeyPress:Ze(wo),triggerOnKeyUp:bo,triggerOnMouseDown:Ze(xo),execCommand:function(r){if(Nn.hasOwnProperty(r))return Nn[r].call(null,this)},triggerElectric:Ze(function(r){Do(this,r)}),findPosH:function(r,i,a,s){var o=1;i<0&&(o=-1,i=-i);for(var l=ne(this.doc,r),u=0;u<i&&(l=ma(this.doc,l,o,a,s),!l.hitSide);++u);return l},moveH:Ze(function(r,i){var a=this;this.extendSelectionsBy(function(s){return a.display.shift||a.doc.extend||s.empty()?ma(a.doc,s.head,r,i,a.options.rtlMoveVisually):r<0?s.from():s.to()},dt)}),deleteH:Ze(function(r,i){var a=this.doc.sel,s=this.doc;a.somethingSelected()?s.replaceSelection("",null,"+delete"):jr(this,function(o){var l=ma(s,o.head,r,i,!1);return r<0?{from:l,to:o.head}:{from:o.head,to:l}})}),findPosV:function(r,i,a,s){var o=1,l=s;i<0&&(o=-1,i=-i);for(var u=ne(this.doc,r),d=0;d<i;++d){var v=Tt(this,u,"div");if(l==null?l=v.left:v.left=l,u=No(this,v,o,a),u.hitSide)break}return u},moveV:Ze(function(r,i){var a=this,s=this.doc,o=[],l=!this.display.shift&&!s.extend&&s.sel.somethingSelected();if(s.extendSelectionsBy(function(d){if(l)return r<0?d.from():d.to();var v=Tt(a,d.head,"div");d.goalColumn!=null&&(v.left=d.goalColumn),o.push(v.left);var w=No(a,v,r,i);return i=="page"&&d==s.sel.primary()&&Qi(a,Zn(a,w,"div").top-v.top),w},dt),o.length)for(var u=0;u<s.sel.ranges.length;u++)s.sel.ranges[u].goalColumn=o[u]}),findWordAt:function(r){var i=this.doc,a=j(i,r.line).text,s=r.ch,o=r.ch;if(a){var l=this.getHelper(r,"wordChars");(r.sticky=="before"||o==a.length)&&s?--s:++o;for(var u=a.charAt(s),d=Ht(u,l)?function(v){return Ht(v,l)}:/\s/.test(u)?function(v){return/\s/.test(v)}:function(v){return!/\s/.test(v)&&!Ht(v)};s>0&&d(a.charAt(s-1));)--s;for(;o<a.length&&d(a.charAt(o));)++o}return new pe(S(r.line,s),S(r.line,o))},toggleOverwrite:function(r){r!=null&&r==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?xe(this.display.cursorDiv,"CodeMirror-overwrite"):je(this.display.cursorDiv,"CodeMirror-overwrite"),Ce(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==_e(mt(this))},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Ze(function(r,i){gn(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Rt(this)-this.display.barHeight,width:r.scrollWidth-Rt(this)-this.display.barWidth,clientHeight:Wi(this),clientWidth:gr(this)}},scrollIntoView:Ze(function(r,i){r==null?(r={from:this.doc.sel.primary().head,to:null},i==null&&(i=this.options.cursorScrollMargin)):typeof r=="number"?r={from:S(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=i||0,r.from.line!=null?El(this,r):Ss(this,r.from,r.to,r.margin)}),setSize:Ze(function(r,i){var a=this,s=function(l){return typeof l=="number"||/^\d+$/.test(String(l))?l+"px":l};r!=null&&(this.display.wrapper.style.width=s(r)),i!=null&&(this.display.wrapper.style.height=s(i)),this.options.lineWrapping&&cs(this);var o=this.display.viewFrom;this.doc.iter(o,this.display.viewTo,function(l){if(l.widgets){for(var u=0;u<l.widgets.length;u++)if(l.widgets[u].noHScroll){ir(a,o,"widget");break}}++o}),this.curOp.forceUpdate=!0,Ce(this,"refresh",this)}),operation:function(r){return ut(this,r)},startOperation:function(){return Cr(this)},endOperation:function(){return Sr(this)},refresh:Ze(function(){var r=this.display.cachedTextHeight;nt(this),this.curOp.forceUpdate=!0,pn(this),gn(this,this.doc.scrollLeft,this.doc.scrollTop),ea(this.display),(r==null||Math.abs(r-Hr(this.display))>.5||this.options.lineWrapping)&&$i(this),Ce(this,"refresh",this)}),swapDoc:Ze(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),Ws(this,r),pn(this),this.display.input.reset(),gn(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,He(this,"swapDoc",this,i),i}),phrase:function(r){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,r)?i[r]:r},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}},bt(e),e.registerHelper=function(r,i,a){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=a},e.registerGlobalHelper=function(r,i,a,s){e.registerHelper(r,i,s),n[r]._global.push({pred:a,val:s})}}function ma(e,t,n,r,i){var a=t,s=n,o=j(e,t.line),l=i&&e.direction=="rtl"?-n:n;function u(){var K=t.line+l;return K<e.first||K>=e.first+e.size?!1:(t=new S(K,t.ch,t.sticky),o=j(e,K))}function d(K){var U;if(r=="codepoint"){var q=o.text.charCodeAt(t.ch+(n>0?0:-1));if(isNaN(q))U=null;else{var te=n>0?q>=55296&&q<56320:q>=56320&&q<57343;U=new S(t.line,Math.max(0,Math.min(o.text.length,t.ch+n*(te?2:1))),-n)}}else i?U=mu(e.cm,o,t,n):U=fa(o,t,n);if(U==null)if(!K&&u())t=ca(i,e.cm,o,t.line,l);else return!1;else t=U;return!0}if(r=="char"||r=="codepoint")d();else if(r=="column")d(!0);else if(r=="word"||r=="group")for(var v=null,w=r=="group",m=e.cm&&e.cm.getHelper(t,"wordChars"),L=!0;!(n<0&&!d(!L));L=!1){var A=o.text.charAt(t.ch)||`
16
+ `,F=Ht(A,m)?"w":w&&A==`
17
+ `?"n":!w||/\s/.test(A)?null:"p";if(w&&!L&&!F&&(F="s"),v&&v!=F){n<0&&(n=1,d(),t.sticky="after");break}if(F&&(v=F),n>0&&!d(!L))break}var z=fi(e,t,a,s,!0);return de(a,z)&&(z.hitSide=!0),z}function No(e,t,n,r){var i=e.doc,a=t.left,s;if(r=="page"){var o=Math.min(e.display.wrapper.clientHeight,ae(e).innerHeight||i(e).documentElement.clientHeight),l=Math.max(o-.5*Hr(e.display),3);s=(n>0?t.bottom:t.top)+n*l}else r=="line"&&(s=n>0?t.bottom+3:t.top-3);for(var u;u=zi(e,a,s),!!u.outside;){if(n<0?s<=0:s>=i.height){u.hitSide=!0;break}s+=n*5}return u}var ge=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Dt,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};ge.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;i.contentEditable=!0,ya(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function a(o){for(var l=o.target;l;l=l.parentNode){if(l==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(l.className))break}return!1}ee(i,"paste",function(o){!a(o)||Se(r,o)||_o(o,r)||b<=11&&setTimeout(Fe(r,function(){return t.updateFromDOM()}),20)}),ee(i,"compositionstart",function(o){t.composing={data:o.data,done:!1}}),ee(i,"compositionupdate",function(o){t.composing||(t.composing={data:o.data,done:!1})}),ee(i,"compositionend",function(o){t.composing&&(o.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ee(i,"touchstart",function(){return n.forceCompositionEnd()}),ee(i,"input",function(){t.composing||t.readFromDOMSoon()});function s(o){if(!(!a(o)||Se(r,o))){if(r.somethingSelected())gi({lineWise:!1,text:r.getSelections()}),o.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var l=Oo(r);gi({lineWise:!0,text:l.text}),o.type=="cut"&&r.operation(function(){r.setSelections(l.ranges,0,ht),r.replaceSelection("",null,"cut")})}else return;if(o.clipboardData){o.clipboardData.clearData();var u=_t.text.join(`
18
+ `);if(o.clipboardData.setData("Text",u),o.clipboardData.getData("Text")==u){o.preventDefault();return}}var d=Mo(),v=d.firstChild;ya(v),r.display.lineSpace.insertBefore(d,r.display.lineSpace.firstChild),v.value=_t.text.join(`
19
+ `);var w=_e(Pe(i));hr(v),setTimeout(function(){r.display.lineSpace.removeChild(d),w.focus(),w==i&&n.showPrimarySelection()},50)}}ee(i,"copy",s),ee(i,"cut",s)},ge.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},ge.prototype.prepareSelection=function(){var e=ws(this.cm,!1);return e.focus=_e(Pe(this.div))==this.div,e},ge.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},ge.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},ge.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line<t.display.viewFrom){e.removeAllRanges();return}var a=yi(t,e.anchorNode,e.anchorOffset),s=yi(t,e.focusNode,e.focusOffset);if(!(a&&!a.bad&&s&&!s.bad&&G(Rr(a,s),r)==0&&G(rt(a,s),i)==0)){var o=t.display.view,l=r.line>=t.display.viewFrom&&Ao(t,r)||{node:o[0].measure.map[2],offset:0},u=i.line<t.display.viewTo&&Ao(t,i);if(!u){var d=o[o.length-1].measure,v=d.maps?d.maps[d.maps.length-1]:d.map;u={node:v[v.length-1],offset:v[v.length-2]-v[v.length-3]}}if(!l||!u){e.removeAllRanges();return}var w=e.rangeCount&&e.getRangeAt(0),m;try{m=Ke(l.node,l.offset,u.offset,u.node)}catch{}m&&(!T&&t.state.focused?(e.collapse(l.node,l.offset),m.collapsed||(e.removeAllRanges(),e.addRange(m))):(e.removeAllRanges(),e.addRange(m)),w&&e.anchorNode==null?e.addRange(w):T&&this.startGracePeriod()),this.rememberSelection()}},ge.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)},ge.prototype.showMultipleSelections=function(e){$(this.cm.display.cursorDiv,e.cursors),$(this.cm.display.selectionDiv,e.selection)},ge.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},ge.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return Re(this.div,t)},ge.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||_e(Pe(this.div))!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},ge.prototype.blur=function(){this.div.blur()},ge.prototype.getField=function(){return this.div},ge.prototype.supportsTouch=function(){return!0},ge.prototype.receivedFocus=function(){var e=this,t=this;this.selectionInEditor()?setTimeout(function(){return e.pollSelection()},20):ut(this.cm,function(){return t.cm.curOp.selectionChanged=!0});function n(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,n))}this.polling.set(this.cm.options.pollInterval,n)},ge.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},ge.prototype.pollSelection=function(){if(!(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())){var e=this.getSelection(),t=this.cm;if(W&&N&&this.cm.display.gutterSpecs.length&&Hu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(!this.composing){this.rememberSelection();var n=yi(t,e.anchorNode,e.anchorOffset),r=yi(t,e.focusNode,e.focusOffset);n&&r&&ut(t,function(){Xe(t.doc,sr(n,r),ht),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})}}},ge.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.ch==0&&r.line>e.firstLine()&&(r=S(r.line-1,j(e.doc,r.line-1).length)),i.ch==j(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=S(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var a,s,o;r.line==t.viewFrom||(a=br(e,r.line))==0?(s=c(t.view[0].line),o=t.view[0].node):(s=c(t.view[a].line),o=t.view[a-1].node.nextSibling);var l=br(e,i.line),u,d;if(l==t.view.length-1?(u=t.viewTo-1,d=t.lineDiv.lastChild):(u=c(t.view[l+1].line)-1,d=t.view[l+1].node.previousSibling),!o)return!1;for(var v=e.doc.splitLines(Fu(e,o,d,s,u)),w=zt(e.doc,S(s,0),S(u,j(e.doc,u).text.length));v.length>1&&w.length>1;)if(he(v)==he(w))v.pop(),w.pop(),u--;else if(v[0]==w[0])v.shift(),w.shift(),s++;else break;for(var m=0,L=0,A=v[0],F=w[0],z=Math.min(A.length,F.length);m<z&&A.charCodeAt(m)==F.charCodeAt(m);)++m;for(var K=he(v),U=he(w),q=Math.min(K.length-(v.length==1?m:0),U.length-(w.length==1?m:0));L<q&&K.charCodeAt(K.length-L-1)==U.charCodeAt(U.length-L-1);)++L;if(v.length==1&&w.length==1&&s==r.line)for(;m&&m>r.ch&&K.charCodeAt(K.length-L-1)==U.charCodeAt(U.length-L-1);)m--,L++;v[v.length-1]=K.slice(0,K.length-L).replace(/^\u200b+/,""),v[0]=v[0].slice(m).replace(/\u200b+$/,"");var te=S(s,m),V=S(u,w.length?he(w).length-L:0);if(v.length>1||v[0]||G(te,V))return qr(e.doc,v,te,V,"+input"),!0},ge.prototype.ensurePolled=function(){this.forceCompositionEnd()},ge.prototype.reset=function(){this.forceCompositionEnd()},ge.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},ge.prototype.readFromDOMSoon=function(){var e=this;this.readDOMTimeout==null&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80))},ge.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&ut(this.cm,function(){return nt(e.cm)})},ge.prototype.setUneditable=function(e){e.contentEditable="false"},ge.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||Fe(this.cm,ga)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},ge.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},ge.prototype.onContextMenu=function(){},ge.prototype.resetPosition=function(){},ge.prototype.needsContentAttribute=!0;function Ao(e,t){var n=Hi(e,t.line);if(!n||n.hidden)return null;var r=j(e.doc,t.line),i=ss(n,r,t.line),a=ce(r,e.doc.direction),s="left";if(a){var o=Zt(a,t.ch);s=o%2?"right":"left"}var l=us(i.map,t.ch,s);return l.offset=l.collapse=="right"?l.end:l.start,l}function Hu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Qr(e,t){return t&&(e.bad=!0),e}function Fu(e,t,n,r,i){var a="",s=!1,o=e.doc.lineSeparator(),l=!1;function u(m){return function(L){return L.id==m}}function d(){s&&(a+=o,l&&(a+=o),s=l=!1)}function v(m){m&&(d(),a+=m)}function w(m){if(m.nodeType==1){var L=m.getAttribute("cm-text");if(L){v(L);return}var A=m.getAttribute("cm-marker"),F;if(A){var z=e.findMarks(S(r,0),S(i+1,0),u(+A));z.length&&(F=z[0].find(0))&&v(zt(e.doc,F.from,F.to).join(o));return}if(m.getAttribute("contenteditable")=="false")return;var K=/^(pre|div|p|li|table|br)$/i.test(m.nodeName);if(!/^br$/i.test(m.nodeName)&&m.textContent.length==0)return;K&&d();for(var U=0;U<m.childNodes.length;U++)w(m.childNodes[U]);/^(pre|p)$/i.test(m.nodeName)&&(l=!0),K&&(s=!0)}else m.nodeType==3&&v(m.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;w(t),t!=n;)t=t.nextSibling,l=!1;return a}function yi(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return Qr(e.clipPos(S(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var a=e.display.view[i];if(a.node==r)return Bu(a,t,n)}}function Bu(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!Re(r,t))return Qr(S(c(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var a=e.rest?he(e.rest):e.line;return Qr(S(c(a),a.text.length),i)}var s=t.nodeType==3?t:null,o=t;for(!s&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(s=t.firstChild,n&&(n=s.nodeValue.length));o.parentNode!=r;)o=o.parentNode;var l=e.measure,u=l.maps;function d(F,z,K){for(var U=-1;U<(u?u.length:0);U++)for(var q=U<0?l.map:u[U],te=0;te<q.length;te+=3){var V=q[te+2];if(V==F||V==z){var le=c(U<0?e.line:e.rest[U]),me=q[te]+K;return(K<0||V!=F)&&(me=q[te+(K?1:0)]),S(le,me)}}}var v=d(s,o,n);if(v)return Qr(v,i);for(var w=o.nextSibling,m=s?s.nodeValue.length-n:0;w;w=w.nextSibling){if(v=d(w,w.firstChild,0),v)return Qr(S(v.line,v.ch-m),i);m+=w.textContent.length}for(var L=o.previousSibling,A=n;L;L=L.previousSibling){if(v=d(L,L.firstChild,-1),v)return Qr(S(v.line,v.ch+A),i);A+=L.textContent.length}}var Le=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Dt,this.hasSelection=!1,this.composing=null,this.resetting=!1};Le.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),k&&(i.style.width="0px"),ee(i,"input",function(){_&&b>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),ee(i,"paste",function(s){Se(r,s)||_o(s,r)||(r.state.pasteIncoming=+new Date,n.fastPoll())});function a(s){if(!Se(r,s)){if(r.somethingSelected())gi({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var o=Oo(r);gi({lineWise:!0,text:o.text}),s.type=="cut"?r.setSelections(o.ranges,null,ht):(n.prevInput="",i.value=o.text.join(`
20
+ `),hr(i))}else return;s.type=="cut"&&(r.state.cutIncoming=+new Date)}}ee(i,"cut",a),ee(i,"copy",a),ee(e.scroller,"paste",function(s){if(!(Kt(e,s)||Se(r,s))){if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var o=new Event("paste");o.clipboardData=s.clipboardData,i.dispatchEvent(o)}}),ee(e.lineSpace,"selectstart",function(s){Kt(e,s)||qe(s)}),ee(i,"compositionstart",function(){var s=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:s,range:r.markText(s,r.getCursor("to"),{className:"CodeMirror-composing"})}}),ee(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Le.prototype.createField=function(e){this.wrapper=Mo(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;ya(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},Le.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Le.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=ws(e);if(e.options.moveInputWithCursor){var i=Tt(e,n.sel.primary().head,"div"),a=t.wrapper.getBoundingClientRect(),s=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+s.top-a.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+s.left-a.left))}return r},Le.prototype.showSelection=function(e){var t=this.cm,n=t.display;$(n.cursorDiv,e.cursors),$(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Le.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&hr(this.textarea),_&&b>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",_&&b>=9&&(this.hasSelection=null));this.resetting=!1}},Le.prototype.getField=function(){return this.textarea},Le.prototype.supportsTouch=function(){return!1},Le.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!X||_e(Pe(this.textarea))!=this.textarea))try{this.textarea.focus()}catch{}},Le.prototype.blur=function(){this.textarea.blur()},Le.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Le.prototype.receivedFocus=function(){this.slowPoll()},Le.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Le.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},Le.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||tr(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(_&&b>=9&&this.hasSelection===i||Z&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var a=i.charCodeAt(0);if(a==8203&&!r&&(r="​"),a==8666)return this.reset(),this.cm.execCommand("undo")}for(var s=0,o=Math.min(r.length,i.length);s<o&&r.charCodeAt(s)==i.charCodeAt(s);)++s;return ut(t,function(){ga(t,i.slice(s),r.length-s,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
21
+ `)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Le.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Le.prototype.onKeyPress=function(){_&&b>=9&&(this.hasSelection=null),this.fastPoll()},Le.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var a=mr(n,e),s=r.scroller.scrollTop;if(!a||B)return;var o=n.options.resetSelectionOnContextMenu;o&&n.doc.sel.contains(a)==-1&&Fe(n,Xe)(n.doc,sr(a),ht);var l=i.style.cssText,u=t.wrapper.style.cssText,d=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
22
+ top: `+(e.clientY-d.top-5)+"px; left: "+(e.clientX-d.left-5)+`px;
23
+ z-index: 1000; background: `+(_?"rgba(255, 255, 255, .05)":"transparent")+`;
24
+ outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var v;D&&(v=i.ownerDocument.defaultView.scrollY),r.input.focus(),D&&i.ownerDocument.defaultView.scrollTo(null,v),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=m,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function w(){if(i.selectionStart!=null){var A=n.somethingSelected(),F="​"+(A?i.value:"");i.value="⇚",i.value=F,t.prevInput=A?"":"​",i.selectionStart=1,i.selectionEnd=F.length,r.selForContextMenu=n.doc.sel}}function m(){if(t.contextMenuPending==m&&(t.contextMenuPending=!1,t.wrapper.style.cssText=u,i.style.cssText=l,_&&b<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=s),i.selectionStart!=null)){(!_||_&&b<9)&&w();var A=0,F=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="​"?Fe(n,Js)(n):A++<10?r.detectingSelectAll=setTimeout(F,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(F,200)}}if(_&&b>=9&&w(),Ne){Vt(e);var L=function(){$e(window,"mouseup",L),setTimeout(m,20)};ee(window,"mouseup",L)}else setTimeout(m,50)},Le.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Le.prototype.setUneditable=function(){},Le.prototype.needsContentAttribute=!1;function zu(e,t){if(t=t?ue(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=_e(Pe(e));t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=o.getValue()}var i;if(e.form&&(ee(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var a=e.form;i=a.submit;try{var s=a.submit=function(){r(),a.submit=i,a.submit(),a.submit=s}}catch{}}t.finishInit=function(l){l.save=r,l.getTextArea=function(){return e},l.toTextArea=function(){l.toTextArea=isNaN,r(),e.parentNode.removeChild(l.getWrapperElement()),e.style.display="",e.form&&($e(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var o=be(function(l){return e.parentNode.insertBefore(l,e.nextSibling)},t);return o}function Uu(e){e.off=$e,e.on=ee,e.wheelEventPixels=jl,e.Doc=it,e.splitLines=yt,e.countColumn=ve,e.findColumn=Mt,e.isWordChar=nn,e.Pass=jt,e.signal=Ce,e.Line=Er,e.changeEnd=or,e.scrollbarModel=Ls,e.Pos=S,e.cmpPos=G,e.modes=Or,e.mimeModes=Ct,e.resolveMode=Mr,e.getMode=Nr,e.modeExtensions=rr,e.extendMode=Ar,e.copyState=At,e.startState=Ir,e.innerMode=on,e.commands=Nn,e.keyMap=qt,e.keyName=ho,e.isModifierKey=fo,e.lookupKey=Yr,e.normalizeKeyMap=yu,e.StringStream=ke,e.SharedTextMarker=Dn,e.TextMarker=ur,e.LineWidget=_n,e.e_preventDefault=qe,e.e_stopPropagation=_r,e.e_stop=Vt,e.addClass=xe,e.contains=Re,e.rmClass=je,e.keyNames=fr}Iu(be),Wu(be);var Gu="iter insert remove copy getEditor constructor".split(" ");for(var mi in it.prototype)it.prototype.hasOwnProperty(mi)&&oe(Gu,mi)<0&&(be.prototype[mi]=function(e){return function(){return e.apply(this.doc,arguments)}}(it.prototype[mi]));return bt(it),be.inputStyles={textarea:Le,contenteditable:ge},be.defineMode=function(e){!be.defaults.mode&&e!="null"&&(be.defaults.mode=e),St.apply(this,arguments)},be.defineMIME=vr,be.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),be.defineMIME("text/plain","null"),be.defineExtension=function(e,t){be.prototype[e]=t},be.defineDocExtension=function(e,t){it.prototype[e]=t},be.fromTextArea=zu,Uu(be),be.version="5.65.20",be})}(bi)),bi.exports}(function(y,f){(function(h){h(Yt())})(function(h){h.defineMode("javascript",function(P,T){var E=P.indentUnit,O=T.statementIndent,C=T.jsonld,_=T.json||C,b=T.trackScope!==!1,D=T.typescript,Q=T.wordCharacters||/[\w$\xa1-\uffff]/,N=function(){function c(We){return{type:We,style:"keyword"}}var p=c("keyword a"),M=c("keyword b"),H=c("keyword c"),S=c("keyword d"),G=c("operator"),de={type:"atom",style:"atom"};return{if:c("if"),while:p,with:p,else:M,do:M,try:M,finally:M,return:S,break:S,continue:S,new:c("new"),delete:H,void:H,throw:H,debugger:c("debugger"),var:c("var"),const:c("var"),let:c("var"),function:c("function"),catch:c("catch"),for:c("for"),switch:c("switch"),case:c("case"),default:c("default"),in:G,typeof:G,instanceof:G,true:de,false:de,null:de,undefined:de,NaN:de,Infinity:de,this:c("this"),class:c("class"),super:c("atom"),yield:H,export:c("export"),import:c("import"),extends:H,await:H}}(),Y=/[+\-*&%=<>!?|~^@]/,B=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function J(c){for(var p=!1,M,H=!1;(M=c.next())!=null;){if(!p){if(M=="/"&&!H)return;M=="["?H=!0:H&&M=="]"&&(H=!1)}p=!p&&M=="\\"}}var I,x;function k(c,p,M){return I=c,x=M,p}function W(c,p){var M=c.next();if(M=='"'||M=="'")return p.tokenize=X(M),p.tokenize(c,p);if(M=="."&&c.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return k("number","number");if(M=="."&&c.match(".."))return k("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(M))return k(M);if(M=="="&&c.eat(">"))return k("=>","operator");if(M=="0"&&c.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return k("number","number");if(/\d/.test(M))return c.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),k("number","number");if(M=="/")return c.eat("*")?(p.tokenize=Z,Z(c,p)):c.eat("/")?(c.skipToEnd(),k("comment","comment")):pt(c,p,1)?(J(c),c.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),k("regexp","string-2")):(c.eat("="),k("operator","operator",c.current()));if(M=="`")return p.tokenize=ie,ie(c,p);if(M=="#"&&c.peek()=="!")return c.skipToEnd(),k("meta","meta");if(M=="#"&&c.eatWhile(Q))return k("variable","property");if(M=="<"&&c.match("!--")||M=="-"&&c.match("->")&&!/\S/.test(c.string.slice(0,c.start)))return c.skipToEnd(),k("comment","comment");if(Y.test(M))return(M!=">"||!p.lexical||p.lexical.type!=">")&&(c.eat("=")?(M=="!"||M=="=")&&c.eat("="):/[<>*+\-|&?]/.test(M)&&(c.eat(M),M==">"&&c.eat(M))),M=="?"&&c.eat(".")?k("."):k("operator","operator",c.current());if(Q.test(M)){c.eatWhile(Q);var H=c.current();if(p.lastType!="."){if(N.propertyIsEnumerable(H)){var S=N[H];return k(S.type,S.style,H)}if(H=="async"&&c.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return k("async","keyword",H)}return k("variable","variable",H)}}function X(c){return function(p,M){var H=!1,S;if(C&&p.peek()=="@"&&p.match(B))return M.tokenize=W,k("jsonld-keyword","meta");for(;(S=p.next())!=null&&!(S==c&&!H);)H=!H&&S=="\\";return H||(M.tokenize=W),k("string","string")}}function Z(c,p){for(var M=!1,H;H=c.next();){if(H=="/"&&M){p.tokenize=W;break}M=H=="*"}return k("comment","comment")}function ie(c,p){for(var M=!1,H;(H=c.next())!=null;){if(!M&&(H=="`"||H=="$"&&c.eat("{"))){p.tokenize=W;break}M=!M&&H=="\\"}return k("quasi","string-2",c.current())}var se="([{}])";function fe(c,p){p.fatArrowAt&&(p.fatArrowAt=null);var M=c.string.indexOf("=>",c.start);if(!(M<0)){if(D){var H=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(c.string.slice(c.start,M));H&&(M=H.index)}for(var S=0,G=!1,de=M-1;de>=0;--de){var We=c.string.charAt(de),rt=se.indexOf(We);if(rt>=0&&rt<3){if(!S){++de;break}if(--S==0){We=="("&&(G=!0);break}}else if(rt>=3&&rt<6)++S;else if(Q.test(We))G=!0;else if(/["'\/`]/.test(We))for(;;--de){if(de==0)return;var Rr=c.string.charAt(de-1);if(Rr==We&&c.string.charAt(de-2)!="\\"){de--;break}}else if(G&&!S){++de;break}}G&&!S&&(p.fatArrowAt=de)}}var Ie={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function Ne(c,p,M,H,S,G){this.indented=c,this.column=p,this.type=M,this.prev=S,this.info=G,H!=null&&(this.align=H)}function ye(c,p){if(!b)return!1;for(var M=c.localVars;M;M=M.next)if(M.name==p)return!0;for(var H=c.context;H;H=H.prev)for(var M=H.vars;M;M=M.next)if(M.name==p)return!0}function je(c,p,M,H,S){var G=c.cc;for(R.state=c,R.stream=S,R.marked=null,R.cc=G,R.style=p,c.lexical.hasOwnProperty("align")||(c.lexical.align=!0);;){var de=G.length?G.pop():_?oe:ve;if(de(M,H)){for(;G.length&&G[G.length-1].lex;)G.pop()();return R.marked?R.marked:M=="variable"&&ye(c,H)?"variable-2":p}}}var R={state:null,marked:null,cc:null};function $(){for(var c=arguments.length-1;c>=0;c--)R.cc.push(arguments[c])}function g(){return $.apply(null,arguments),!0}function Je(c,p){for(var M=p;M;M=M.next)if(M.name==c)return!0;return!1}function Ke(c){var p=R.state;if(R.marked="def",!!b){if(p.context){if(p.lexical.info=="var"&&p.context&&p.context.block){var M=Re(c,p.context);if(M!=null){p.context=M;return}}else if(!Je(c,p.localVars)){p.localVars=new Ee(c,p.localVars);return}}T.globalVars&&!Je(c,p.globalVars)&&(p.globalVars=new Ee(c,p.globalVars))}}function Re(c,p){if(p)if(p.block){var M=Re(c,p.prev);return M?M==p.prev?p:new xe(M,p.vars,!0):null}else return Je(c,p.vars)?p:new xe(p.prev,new Ee(c,p.vars),!1);else return null}function _e(c){return c=="public"||c=="private"||c=="protected"||c=="abstract"||c=="readonly"}function xe(c,p,M){this.prev=c,this.vars=p,this.block=M}function Ee(c,p){this.name=c,this.next=p}var hr=new Ee("this",new Ee("arguments",null));function ct(){R.state.context=new xe(R.state.context,R.state.localVars,!1),R.state.localVars=hr}function mt(){R.state.context=new xe(R.state.context,R.state.localVars,!0),R.state.localVars=null}ct.lex=mt.lex=!0;function Pe(){R.state.localVars=R.state.context.vars,R.state.context=R.state.context.prev}Pe.lex=!0;function ae(c,p){var M=function(){var H=R.state,S=H.indented;if(H.lexical.type=="stat")S=H.lexical.indented;else for(var G=H.lexical;G&&G.type==")"&&G.align;G=G.prev)S=G.indented;H.lexical=new Ne(S,R.stream.column(),c,null,H.lexical,p)};return M.lex=!0,M}function re(){var c=R.state;c.lexical.prev&&(c.lexical.type==")"&&(c.indented=c.lexical.indented),c.lexical=c.lexical.prev)}re.lex=!0;function ue(c){function p(M){return M==c?g():c==";"||M=="}"||M==")"||M=="]"?$():g(p)}return p}function ve(c,p){return c=="var"?g(ae("vardef",p),_r,ue(";"),re):c=="keyword a"?g(ae("form"),jt,ve,re):c=="keyword b"?g(ae("form"),ve,re):c=="keyword d"?R.stream.match(/^\s*$/,!1)?g():g(ae("stat"),Ot,ue(";"),re):c=="debugger"?g(ue(";")):c=="{"?g(ae("}"),mt,Nt,re,Pe):c==";"?g():c=="if"?(R.state.lexical.info=="else"&&R.state.cc[R.state.cc.length-1]==re&&R.state.cc.pop()(),g(ae("form"),jt,ve,re,Dr)):c=="function"?g(yt):c=="for"?g(ae("form"),mt,zn,ve,Pe,re):c=="class"||D&&p=="interface"?(R.marked="keyword",g(ae("form",c=="class"?c:p),Or,re)):c=="variable"?D&&p=="declare"?(R.marked="keyword",g(ve)):D&&(p=="module"||p=="enum"||p=="type")&&R.stream.match(/^\s*\w/,!1)?(R.marked="keyword",p=="enum"?g(j):p=="type"?g(Un,ue("operator"),ce,ue(";")):g(ae("form"),tt,ue("{"),ae("}"),Nt,re,re)):D&&p=="namespace"?(R.marked="keyword",g(ae("form"),oe,ve,re)):D&&p=="abstract"?(R.marked="keyword",g(ve)):g(ae("stat"),ki):c=="switch"?g(ae("form"),jt,ue("{"),ae("}","switch"),mt,Nt,re,re,Pe):c=="case"?g(oe,ue(":")):c=="default"?g(ue(":")):c=="catch"?g(ae("form"),ct,Dt,ve,re,Pe):c=="export"?g(ae("stat"),Mr,re):c=="import"?g(ae("stat"),rr,re):c=="async"?g(ve):p=="@"?g(oe,ve):$(ae("stat"),oe,ue(";"),re)}function Dt(c){if(c=="(")return g(xt,ue(")"))}function oe(c,p){return ht(c,p,!1)}function Qe(c,p){return ht(c,p,!0)}function jt(c){return c!="("?$():g(ae(")"),Ot,ue(")"),re)}function ht(c,p,M){if(R.state.fatArrowAt==R.stream.start){var H=M?dr:he;if(c=="(")return g(ct,ae(")"),De(xt,")"),re,ue("=>"),H,Pe);if(c=="variable")return $(ct,tt,ue("=>"),H,Pe)}var S=M?Mt:dt;return Ie.hasOwnProperty(c)?g(S):c=="function"?g(yt,S):c=="class"||D&&p=="interface"?(R.marked="keyword",g(ae("form"),_i,re)):c=="keyword c"||c=="async"?g(M?Qe:oe):c=="("?g(ae(")"),Ot,ue(")"),re,S):c=="operator"||c=="spread"?g(M?Qe:oe):c=="["?g(ae("]"),ke,re,S):c=="{"?Jt(Ht,"}",null,S):c=="quasi"?$(Wt,S):c=="new"?g(Si(M)):g()}function Ot(c){return c.match(/[;\}\)\],]/)?$():$(oe)}function dt(c,p){return c==","?g(Ot):Mt(c,p,!1)}function Mt(c,p,M){var H=M==!1?dt:Mt,S=M==!1?oe:Qe;if(c=="=>")return g(ct,M?dr:he,Pe);if(c=="operator")return/\+\+|--/.test(p)||D&&p=="!"?g(H):D&&p=="<"&&R.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?g(ae(">"),De(ce,">"),re,H):p=="?"?g(oe,ue(":"),S):g(S);if(c=="quasi")return $(Wt,H);if(c!=";"){if(c=="(")return Jt(Qe,")","call",H);if(c==".")return g(nn,H);if(c=="[")return g(ae("]"),Ot,ue("]"),re,H);if(D&&p=="as")return R.marked="keyword",g(ce,H);if(c=="regexp")return R.state.lastType=R.marked="operator",R.stream.backUp(R.stream.pos-R.stream.start-1),g(S)}}function Wt(c,p){return c!="quasi"?$():p.slice(p.length-2)!="${"?g(Wt):g(Ot,rn)}function rn(c){if(c=="}")return R.marked="string-2",R.state.tokenize=ie,g(Wt)}function he(c){return fe(R.stream,R.state),$(c=="{"?ve:oe)}function dr(c){return fe(R.stream,R.state),$(c=="{"?ve:Qe)}function Si(c){return function(p){return p=="."?g(c?Hn:Wn):p=="variable"&&D?g(lt,c?Mt:dt):$(c?Qe:oe)}}function Wn(c,p){if(p=="target")return R.marked="keyword",g(dt)}function Hn(c,p){if(p=="target")return R.marked="keyword",g(Mt)}function ki(c){return c==":"?g(re,ve):$(dt,ue(";"),re)}function nn(c){if(c=="variable")return R.marked="property",g()}function Ht(c,p){if(c=="async")return R.marked="property",g(Ht);if(c=="variable"||R.style=="keyword"){if(R.marked="property",p=="get"||p=="set")return g(Fn);var M;return D&&R.state.fatArrowAt==R.stream.start&&(M=R.stream.match(/^\s*:\s*/,!1))&&(R.state.fatArrowAt=R.stream.pos+M[0].length),g(Ft)}else{if(c=="number"||c=="string")return R.marked=C?"property":R.style+" property",g(Ft);if(c=="jsonld-keyword")return g(Ft);if(D&&_e(p))return R.marked="keyword",g(Ht);if(c=="[")return g(oe,Qt,ue("]"),Ft);if(c=="spread")return g(Qe,Ft);if(p=="*")return R.marked="keyword",g(Ht);if(c==":")return $(Ft)}}function Fn(c){return c!="variable"?$(Ft):(R.marked="property",g(yt))}function Ft(c){if(c==":")return g(Qe);if(c=="(")return $(yt)}function De(c,p,M){function H(S,G){if(M?M.indexOf(S)>-1:S==","){var de=R.state.lexical;return de.info=="call"&&(de.pos=(de.pos||0)+1),g(function(We,rt){return We==p||rt==p?$():$(c)},H)}return S==p||G==p?g():M&&M.indexOf(";")>-1?$(c):g(ue(p))}return function(S,G){return S==p||G==p?g():$(c,H)}}function Jt(c,p,M){for(var H=3;H<arguments.length;H++)R.cc.push(arguments[H]);return g(ae(p,M),De(c,p),re)}function Nt(c){return c=="}"?g():$(ve,Nt)}function Qt(c,p){if(D){if(c==":")return g(ce);if(p=="?")return g(Qt)}}function pr(c,p){if(D&&(c==":"||p=="in"))return g(ce)}function Zt(c){if(D&&c==":")return R.stream.match(/^\s*\w+\s+is\b/,!1)?g(oe,Ti,ce):g(ce)}function Ti(c,p){if(p=="is")return R.marked="keyword",g()}function ce(c,p){if(p=="keyof"||p=="typeof"||p=="infer"||p=="readonly")return R.marked="keyword",g(p=="typeof"?Qe:ce);if(c=="variable"||p=="void")return R.marked="type",g(gt);if(p=="|"||p=="&")return g(ce);if(c=="string"||c=="number"||c=="atom")return g(gt);if(c=="[")return g(ae("]"),De(ce,"]",","),re,gt);if(c=="{")return g(ae("}"),ee,re,gt);if(c=="(")return g(De(Se,")"),Bn,gt);if(c=="<")return g(De(ce,">"),ce);if(c=="quasi")return $($e,gt)}function Bn(c){if(c=="=>")return g(ce)}function ee(c){return c.match(/[\}\)\]]/)?g():c==","||c==";"?g(ee):$(Bt,ee)}function Bt(c,p){if(c=="variable"||R.style=="keyword")return R.marked="property",g(Bt);if(p=="?"||c=="number"||c=="string")return g(Bt);if(c==":")return g(ce);if(c=="[")return g(ue("variable"),pr,ue("]"),Bt);if(c=="(")return $(tr,Bt);if(!c.match(/[;\}\)\],]/))return g()}function $e(c,p){return c!="quasi"?$():p.slice(p.length-2)!="${"?g($e):g(ce,Ce)}function Ce(c){if(c=="}")return R.marked="string-2",R.state.tokenize=ie,g($e)}function Se(c,p){return c=="variable"&&R.stream.match(/^\s*[?:]/,!1)||p=="?"?g(Se):c==":"?g(ce):c=="spread"?g(Se):$(ce)}function gt(c,p){if(p=="<")return g(ae(">"),De(ce,">"),re,gt);if(p=="|"||c=="."||p=="&")return g(ce);if(c=="[")return g(ce,ue("]"),gt);if(p=="extends"||p=="implements")return R.marked="keyword",g(ce);if(p=="?")return g(ce,ue(":"),ce)}function lt(c,p){if(p=="<")return g(ae(">"),De(ce,">"),re,gt)}function bt(){return $(ce,qe)}function qe(c,p){if(p=="=")return g(ce)}function _r(c,p){return p=="enum"?(R.marked="keyword",g(j)):$(tt,Qt,wt,Li)}function tt(c,p){if(D&&_e(p))return R.marked="keyword",g(tt);if(c=="variable")return Ke(p),g();if(c=="spread")return g(tt);if(c=="[")return Jt(an,"]");if(c=="{")return Jt(Vt,"}")}function Vt(c,p){return c=="variable"&&!R.stream.match(/^\s*:/,!1)?(Ke(p),g(wt)):(c=="variable"&&(R.marked="property"),c=="spread"?g(tt):c=="}"?$():c=="["?g(oe,ue("]"),ue(":"),Vt):g(ue(":"),tt,wt))}function an(){return $(tt,wt)}function wt(c,p){if(p=="=")return g(Qe)}function Li(c){if(c==",")return g(_r)}function Dr(c,p){if(c=="keyword b"&&p=="else")return g(ae("form","else"),ve,re)}function zn(c,p){if(p=="await")return g(zn);if(c=="(")return g(ae(")"),sn,re)}function sn(c){return c=="var"?g(_r,er):c=="variable"?g(er):$(er)}function er(c,p){return c==")"?g():c==";"?g(er):p=="in"||p=="of"?(R.marked="keyword",g(oe,er)):$(oe,er)}function yt(c,p){if(p=="*")return R.marked="keyword",g(yt);if(c=="variable")return Ke(p),g(yt);if(c=="(")return g(ct,ae(")"),De(xt,")"),re,Zt,ve,Pe);if(D&&p=="<")return g(ae(">"),De(bt,">"),re,yt)}function tr(c,p){if(p=="*")return R.marked="keyword",g(tr);if(c=="variable")return Ke(p),g(tr);if(c=="(")return g(ct,ae(")"),De(xt,")"),re,Zt,Pe);if(D&&p=="<")return g(ae(">"),De(bt,">"),re,tr)}function Un(c,p){if(c=="keyword"||c=="variable")return R.marked="type",g(Un);if(p=="<")return g(ae(">"),De(bt,">"),re)}function xt(c,p){return p=="@"&&g(oe,xt),c=="spread"?g(xt):D&&_e(p)?(R.marked="keyword",g(xt)):D&&c=="this"?g(Qt,wt):$(tt,Qt,wt)}function _i(c,p){return c=="variable"?Or(c,p):Ct(c,p)}function Or(c,p){if(c=="variable")return Ke(p),g(Ct)}function Ct(c,p){if(p=="<")return g(ae(">"),De(bt,">"),re,Ct);if(p=="extends"||p=="implements"||D&&c==",")return p=="implements"&&(R.marked="keyword"),g(D?ce:oe,Ct);if(c=="{")return g(ae("}"),St,re)}function St(c,p){if(c=="async"||c=="variable"&&(p=="static"||p=="get"||p=="set"||D&&_e(p))&&R.stream.match(/^\s+#?[\w$\xa1-\uffff]/,!1))return R.marked="keyword",g(St);if(c=="variable"||R.style=="keyword")return R.marked="property",g(vr,St);if(c=="number"||c=="string")return g(vr,St);if(c=="[")return g(oe,Qt,ue("]"),vr,St);if(p=="*")return R.marked="keyword",g(St);if(D&&c=="(")return $(tr,St);if(c==";"||c==",")return g(St);if(c=="}")return g();if(p=="@")return g(oe,St)}function vr(c,p){if(p=="!"||p=="?")return g(vr);if(c==":")return g(ce,wt);if(p=="=")return g(Qe);var M=R.state.lexical.prev,H=M&&M.info=="interface";return $(H?tr:yt)}function Mr(c,p){return p=="*"?(R.marked="keyword",g(Ir,ue(";"))):p=="default"?(R.marked="keyword",g(oe,ue(";"))):c=="{"?g(De(Nr,"}"),Ir,ue(";")):$(ve)}function Nr(c,p){if(p=="as")return R.marked="keyword",g(ue("variable"));if(c=="variable")return $(Qe,Nr)}function rr(c){return c=="string"?g():c=="("?$(oe):c=="."?$(dt):$(Ar,At,Ir)}function Ar(c,p){return c=="{"?Jt(Ar,"}"):(c=="variable"&&Ke(p),p=="*"&&(R.marked="keyword"),g(on))}function At(c){if(c==",")return g(Ar,At)}function on(c,p){if(p=="as")return R.marked="keyword",g(Ar)}function Ir(c,p){if(p=="from")return R.marked="keyword",g(oe)}function ke(c){return c=="]"?g():$(De(Qe,"]"))}function j(){return $(ae("form"),tt,ue("{"),ae("}"),De(zt,"}"),re,re)}function zt(){return $(tt,wt)}function ln(c,p){return c.lastType=="operator"||c.lastType==","||Y.test(p.charAt(0))||/[,.]/.test(p.charAt(0))}function pt(c,p,M){return p.tokenize==W&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(p.lastType)||p.lastType=="quasi"&&/\{\s*$/.test(c.string.slice(0,c.pos-(M||0)))}return{startState:function(c){var p={tokenize:W,lastType:"sof",cc:[],lexical:new Ne((c||0)-E,0,"block",!1),localVars:T.localVars,context:T.localVars&&new xe(null,null,!1),indented:c||0};return T.globalVars&&typeof T.globalVars=="object"&&(p.globalVars=T.globalVars),p},token:function(c,p){if(c.sol()&&(p.lexical.hasOwnProperty("align")||(p.lexical.align=!1),p.indented=c.indentation(),fe(c,p)),p.tokenize!=Z&&c.eatSpace())return null;var M=p.tokenize(c,p);return I=="comment"?M:(p.lastType=I=="operator"&&(x=="++"||x=="--")?"incdec":I,je(p,M,I,x,c))},indent:function(c,p){if(c.tokenize==Z||c.tokenize==ie)return h.Pass;if(c.tokenize!=W)return 0;var M=p&&p.charAt(0),H=c.lexical,S;if(!/^\s*else\b/.test(p))for(var G=c.cc.length-1;G>=0;--G){var de=c.cc[G];if(de==re)H=H.prev;else if(de!=Dr&&de!=Pe)break}for(;(H.type=="stat"||H.type=="form")&&(M=="}"||(S=c.cc[c.cc.length-1])&&(S==dt||S==Mt)&&!/^[,\.=+\-*:?[\(]/.test(p));)H=H.prev;O&&H.type==")"&&H.prev.type=="stat"&&(H=H.prev);var We=H.type,rt=M==We;return We=="vardef"?H.indented+(c.lastType=="operator"||c.lastType==","?H.info.length+1:0):We=="form"&&M=="{"?H.indented:We=="form"?H.indented+E:We=="stat"?H.indented+(ln(c,p)?O||E:0):H.info=="switch"&&!rt&&T.doubleIndentSwitch!=!1?H.indented+(/^(?:case|default)\b/.test(p)?E:2*E):H.align?H.column+(rt?0:1):H.indented+(rt?0:E)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:_?null:"/*",blockCommentEnd:_?null:"*/",blockCommentContinue:_?null:" * ",lineComment:_?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:_?"json":"javascript",jsonldMode:C,jsonMode:_,expressionAllowed:pt,skipExpression:function(c){je(c,"atom","atom","true",new h.StringStream("",2,null))}}}),h.registerHelper("wordChars","javascript",/[\w$]/),h.defineMIME("text/javascript","javascript"),h.defineMIME("text/ecmascript","javascript"),h.defineMIME("application/javascript","javascript"),h.defineMIME("application/x-javascript","javascript"),h.defineMIME("application/ecmascript","javascript"),h.defineMIME("application/json",{name:"javascript",json:!0}),h.defineMIME("application/x-json",{name:"javascript",json:!0}),h.defineMIME("application/manifest+json",{name:"javascript",json:!0}),h.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),h.defineMIME("text/typescript",{name:"javascript",typescript:!0}),h.defineMIME("application/typescript",{name:"javascript",typescript:!0})})})(),function(y,f){(function(h){h(Yt())})(function(h){var P={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},T=h.Pos;h.defineOption("autoCloseBrackets",!1,function(x,k,W){W&&W!=h.Init&&(x.removeKeyMap(O),x.state.closeBrackets=null),k&&(C(E(k,"pairs")),x.state.closeBrackets=k,x.addKeyMap(O))});function E(x,k){return k=="pairs"&&typeof x=="string"?x:typeof x=="object"&&x[k]!=null?x[k]:P[k]}var O={Backspace:D,Enter:Q};function C(x){for(var k=0;k<x.length;k++){var W=x.charAt(k),X="'"+W+"'";O[X]||(O[X]=_(W))}}C(P.pairs+"`");function _(x){return function(k){return B(k,x)}}function b(x){var k=x.state.closeBrackets;if(!k||k.override)return k;var W=x.getModeAt(x.getCursor());return W.closeBrackets||k}function D(x){var k=b(x);if(!k||x.getOption("disableInput"))return h.Pass;for(var W=E(k,"pairs"),X=x.listSelections(),Z=0;Z<X.length;Z++){if(!X[Z].empty())return h.Pass;var ie=J(x,X[Z].head);if(!ie||W.indexOf(ie)%2!=0)return h.Pass}for(var Z=X.length-1;Z>=0;Z--){var se=X[Z].head;x.replaceRange("",T(se.line,se.ch-1),T(se.line,se.ch+1),"+delete")}}function Q(x){var k=b(x),W=k&&E(k,"explode");if(!W||x.getOption("disableInput"))return h.Pass;for(var X=x.listSelections(),Z=0;Z<X.length;Z++){if(!X[Z].empty())return h.Pass;var ie=J(x,X[Z].head);if(!ie||W.indexOf(ie)%2!=0)return h.Pass}x.operation(function(){var se=x.lineSeparator()||`
25
+ `;x.replaceSelection(se+se,null),N(x,-1),X=x.listSelections();for(var fe=0;fe<X.length;fe++){var Ie=X[fe].head.line;x.indentLine(Ie,null,!0),x.indentLine(Ie+1,null,!0)}})}function N(x,k){for(var W=[],X=x.listSelections(),Z=0,ie=0;ie<X.length;ie++){var se=X[ie];se.head==x.getCursor()&&(Z=ie);var fe=se.head.ch||k>0?{line:se.head.line,ch:se.head.ch+k}:{line:se.head.line-1};W.push({anchor:fe,head:fe})}x.setSelections(W,Z)}function Y(x){var k=h.cmpPos(x.anchor,x.head)>0;return{anchor:new T(x.anchor.line,x.anchor.ch+(k?-1:1)),head:new T(x.head.line,x.head.ch+(k?1:-1))}}function B(x,k){var W=b(x);if(!W||x.getOption("disableInput"))return h.Pass;var X=E(W,"pairs"),Z=X.indexOf(k);if(Z==-1)return h.Pass;for(var ie=E(W,"closeBefore"),se=E(W,"triples"),fe=X.charAt(Z+1)==k,Ie=x.listSelections(),Ne=Z%2==0,ye,je=0;je<Ie.length;je++){var R=Ie[je],$=R.head,g,Je=x.getRange($,T($.line,$.ch+1));if(Ne&&!R.empty())g="surround";else if((fe||!Ne)&&Je==k)fe&&I(x,$)?g="both":se.indexOf(k)>=0&&x.getRange($,T($.line,$.ch+3))==k+k+k?g="skipThree":g="skip";else if(fe&&$.ch>1&&se.indexOf(k)>=0&&x.getRange(T($.line,$.ch-2),$)==k+k){if($.ch>2&&/\bstring/.test(x.getTokenTypeAt(T($.line,$.ch-2))))return h.Pass;g="addFour"}else if(fe){var Ke=$.ch==0?" ":x.getRange(T($.line,$.ch-1),$);if(!h.isWordChar(Je)&&Ke!=k&&!h.isWordChar(Ke))g="both";else return h.Pass}else if(Ne&&(Je.length===0||/\s/.test(Je)||ie.indexOf(Je)>-1))g="both";else return h.Pass;if(!ye)ye=g;else if(ye!=g)return h.Pass}var Re=Z%2?X.charAt(Z-1):k,_e=Z%2?k:X.charAt(Z+1);x.operation(function(){if(ye=="skip")N(x,1);else if(ye=="skipThree")N(x,3);else if(ye=="surround"){for(var xe=x.getSelections(),Ee=0;Ee<xe.length;Ee++)xe[Ee]=Re+xe[Ee]+_e;x.replaceSelections(xe,"around"),xe=x.listSelections().slice();for(var Ee=0;Ee<xe.length;Ee++)xe[Ee]=Y(xe[Ee]);x.setSelections(xe)}else ye=="both"?(x.replaceSelection(Re+_e,null),x.triggerElectric(Re+_e),N(x,-1)):ye=="addFour"&&(x.replaceSelection(Re+Re+Re+Re,"before"),N(x,1))})}function J(x,k){var W=x.getRange(T(k.line,k.ch-1),T(k.line,k.ch+1));return W.length==2?W:null}function I(x,k){var W=x.getTokenAt(T(k.line,k.ch+1));return/\bstring/.test(W.type)&&W.start==k.ch&&(k.ch==0||!/\bstring/.test(x.getTokenTypeAt(k)))}})}(),function(y,f){(function(h){h(Yt())})(function(h){var P=/MSIE \d/.test(navigator.userAgent)&&(document.documentMode==null||document.documentMode<8),T=h.Pos,E={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function O(N){return N&&N.bracketRegex||/[(){}[\]]/}function C(N,Y,B){var J=N.getLineHandle(Y.line),I=Y.ch-1,x=B&&B.afterCursor;x==null&&(x=/(^| )cm-fat-cursor($| )/.test(N.getWrapperElement().className));var k=O(B),W=!x&&I>=0&&k.test(J.text.charAt(I))&&E[J.text.charAt(I)]||k.test(J.text.charAt(I+1))&&E[J.text.charAt(++I)];if(!W)return null;var X=W.charAt(1)==">"?1:-1;if(B&&B.strict&&X>0!=(I==Y.ch))return null;var Z=N.getTokenTypeAt(T(Y.line,I+1)),ie=_(N,T(Y.line,I+(X>0?1:0)),X,Z,B);return ie==null?null:{from:T(Y.line,I),to:ie&&ie.pos,match:ie&&ie.ch==W.charAt(0),forward:X>0}}function _(N,Y,B,J,I){for(var x=I&&I.maxScanLineLength||1e4,k=I&&I.maxScanLines||1e3,W=[],X=O(I),Z=B>0?Math.min(Y.line+k,N.lastLine()+1):Math.max(N.firstLine()-1,Y.line-k),ie=Y.line;ie!=Z;ie+=B){var se=N.getLine(ie);if(se){var fe=B>0?0:se.length-1,Ie=B>0?se.length:-1;if(!(se.length>x))for(ie==Y.line&&(fe=Y.ch-(B<0?1:0));fe!=Ie;fe+=B){var Ne=se.charAt(fe);if(X.test(Ne)&&(J===void 0||(N.getTokenTypeAt(T(ie,fe+1))||"")==(J||""))){var ye=E[Ne];if(ye&&ye.charAt(1)==">"==B>0)W.push(Ne);else if(W.length)W.pop();else return{pos:T(ie,fe),ch:Ne}}}}}return ie-B==(B>0?N.lastLine():N.firstLine())?!1:null}function b(N,Y,B){for(var J=N.state.matchBrackets.maxHighlightLineLength||1e3,I=B&&B.highlightNonMatching,x=[],k=N.listSelections(),W=0;W<k.length;W++){var X=k[W].empty()&&C(N,k[W].head,B);if(X&&(X.match||I!==!1)&&N.getLine(X.from.line).length<=J){var Z=X.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";x.push(N.markText(X.from,T(X.from.line,X.from.ch+1),{className:Z})),X.to&&N.getLine(X.to.line).length<=J&&x.push(N.markText(X.to,T(X.to.line,X.to.ch+1),{className:Z}))}}if(x.length){P&&N.state.focused&&N.focus();var ie=function(){N.operation(function(){for(var se=0;se<x.length;se++)x[se].clear()})};if(Y)setTimeout(ie,800);else return ie}}function D(N){N.operation(function(){N.state.matchBrackets.currentlyHighlighted&&(N.state.matchBrackets.currentlyHighlighted(),N.state.matchBrackets.currentlyHighlighted=null),N.state.matchBrackets.currentlyHighlighted=b(N,!1,N.state.matchBrackets)})}function Q(N){N.state.matchBrackets&&N.state.matchBrackets.currentlyHighlighted&&(N.state.matchBrackets.currentlyHighlighted(),N.state.matchBrackets.currentlyHighlighted=null)}h.defineOption("matchBrackets",!1,function(N,Y,B){B&&B!=h.Init&&(N.off("cursorActivity",D),N.off("focus",D),N.off("blur",Q),Q(N)),Y&&(N.state.matchBrackets=typeof Y=="object"?Y:{},N.on("cursorActivity",D),N.on("focus",D),N.on("blur",Q))}),h.defineExtension("matchBrackets",function(){b(this,!0)}),h.defineExtension("findMatchingBracket",function(N,Y,B){return(B||typeof Y=="boolean")&&(B?(B.strict=Y,Y=B):Y=Y?{strict:!0}:null),C(this,N,Y)}),h.defineExtension("scanForBracket",function(N,Y,B,J){return _(this,N,Y,B,J)})})}();var Sa={exports:{}},ka;function Ta(){return ka||(ka=1,function(y,f){(function(h){h(Yt())})(function(h){function P(C,_,b,D){if(b&&b.call){var Q=b;b=null}else var Q=O(C,b,"rangeFinder");typeof _=="number"&&(_=h.Pos(_,0));var N=O(C,b,"minFoldSize");function Y(x){var k=Q(C,_);if(!k||k.to.line-k.from.line<N)return null;if(D==="fold")return k;for(var W=C.findMarksAt(k.from),X=0;X<W.length;++X)if(W[X].__isFold){if(!x)return null;k.cleared=!0,W[X].clear()}return k}var B=Y(!0);if(O(C,b,"scanUp"))for(;!B&&_.line>C.firstLine();)_=h.Pos(_.line-1,0),B=Y(!1);if(!(!B||B.cleared||D==="unfold")){var J=T(C,b,B);h.on(J,"mousedown",function(x){I.clear(),h.e_preventDefault(x)});var I=C.markText(B.from,B.to,{replacedWith:J,clearOnEnter:O(C,b,"clearOnEnter"),__isFold:!0});I.on("clear",function(x,k){h.signal(C,"unfold",C,x,k)}),h.signal(C,"fold",C,B.from,B.to)}}function T(C,_,b){var D=O(C,_,"widget");if(typeof D=="function"&&(D=D(b.from,b.to)),typeof D=="string"){var Q=document.createTextNode(D);D=document.createElement("span"),D.appendChild(Q),D.className="CodeMirror-foldmarker"}else D&&(D=D.cloneNode(!0));return D}h.newFoldFunction=function(C,_){return function(b,D){P(b,D,{rangeFinder:C,widget:_})}},h.defineExtension("foldCode",function(C,_,b){P(this,C,_,b)}),h.defineExtension("isFolded",function(C){for(var _=this.findMarksAt(C),b=0;b<_.length;++b)if(_[b].__isFold)return!0}),h.commands.toggleFold=function(C){C.foldCode(C.getCursor())},h.commands.fold=function(C){C.foldCode(C.getCursor(),null,"fold")},h.commands.unfold=function(C){C.foldCode(C.getCursor(),{scanUp:!1},"unfold")},h.commands.foldAll=function(C){C.operation(function(){for(var _=C.firstLine(),b=C.lastLine();_<=b;_++)C.foldCode(h.Pos(_,0),{scanUp:!1},"fold")})},h.commands.unfoldAll=function(C){C.operation(function(){for(var _=C.firstLine(),b=C.lastLine();_<=b;_++)C.foldCode(h.Pos(_,0),{scanUp:!1},"unfold")})},h.registerHelper("fold","combine",function(){var C=Array.prototype.slice.call(arguments,0);return function(_,b){for(var D=0;D<C.length;++D){var Q=C[D](_,b);if(Q)return Q}}}),h.registerHelper("fold","auto",function(C,_){for(var b=C.getHelpers(_,"fold"),D=0;D<b.length;D++){var Q=b[D](C,_);if(Q)return Q}});var E={rangeFinder:h.fold.auto,widget:"↔",minFoldSize:0,scanUp:!1,clearOnEnter:!0};h.defineOption("foldOptions",null);function O(C,_,b){if(_&&_[b]!==void 0)return _[b];var D=C.options.foldOptions;return D&&D[b]!==void 0?D[b]:E[b]}h.defineExtension("foldOption",function(C,_){return O(this,C,_)})})}()),Sa.exports}Ta(),function(y,f){(function(h){h(Yt(),Ta())})(function(h){h.defineOption("foldGutter",!1,function(I,x,k){k&&k!=h.Init&&(I.clearGutter(I.state.foldGutter.options.gutter),I.state.foldGutter=null,I.off("gutterClick",Q),I.off("changes",Y),I.off("viewportChange",B),I.off("fold",J),I.off("unfold",J),I.off("swapDoc",Y),I.off("optionChange",N)),x&&(I.state.foldGutter=new T(E(x)),D(I),I.on("gutterClick",Q),I.on("changes",Y),I.on("viewportChange",B),I.on("fold",J),I.on("unfold",J),I.on("swapDoc",Y),I.on("optionChange",N))});var P=h.Pos;function T(I){this.options=I,this.from=this.to=0}function E(I){return I===!0&&(I={}),I.gutter==null&&(I.gutter="CodeMirror-foldgutter"),I.indicatorOpen==null&&(I.indicatorOpen="CodeMirror-foldgutter-open"),I.indicatorFolded==null&&(I.indicatorFolded="CodeMirror-foldgutter-folded"),I}function O(I,x){for(var k=I.findMarks(P(x,0),P(x+1,0)),W=0;W<k.length;++W)if(k[W].__isFold){var X=k[W].find(-1);if(X&&X.line===x)return k[W]}}function C(I){if(typeof I=="string"){var x=document.createElement("div");return x.className=I+" CodeMirror-guttermarker-subtle",x}else return I.cloneNode(!0)}function _(I,x,k){var W=I.state.foldGutter.options,X=x-1,Z=I.foldOption(W,"minFoldSize"),ie=I.foldOption(W,"rangeFinder"),se=typeof W.indicatorFolded=="string"&&b(W.indicatorFolded),fe=typeof W.indicatorOpen=="string"&&b(W.indicatorOpen);I.eachLine(x,k,function(Ie){++X;var Ne=null,ye=Ie.gutterMarkers;if(ye&&(ye=ye[W.gutter]),O(I,X)){if(se&&ye&&se.test(ye.className))return;Ne=C(W.indicatorFolded)}else{var je=P(X,0),R=ie&&ie(I,je);if(R&&R.to.line-R.from.line>=Z){if(fe&&ye&&fe.test(ye.className))return;Ne=C(W.indicatorOpen)}}!Ne&&!ye||I.setGutterMarker(Ie,W.gutter,Ne)})}function b(I){return new RegExp("(^|\\s)"+I+"(?:$|\\s)\\s*")}function D(I){var x=I.getViewport(),k=I.state.foldGutter;k&&(I.operation(function(){_(I,x.from,x.to)}),k.from=x.from,k.to=x.to)}function Q(I,x,k){var W=I.state.foldGutter;if(W){var X=W.options;if(k==X.gutter){var Z=O(I,x);Z?Z.clear():I.foldCode(P(x,0),X)}}}function N(I,x){x=="mode"&&Y(I)}function Y(I){var x=I.state.foldGutter;if(x){var k=x.options;x.from=x.to=0,clearTimeout(x.changeUpdate),x.changeUpdate=setTimeout(function(){D(I)},k.foldOnChangeTimeSpan||600)}}function B(I){var x=I.state.foldGutter;if(x){var k=x.options;clearTimeout(x.changeUpdate),x.changeUpdate=setTimeout(function(){var W=I.getViewport();x.from==x.to||W.from-x.to>20||x.from-W.to>20?D(I):I.operation(function(){W.from<x.from&&(_(I,W.from,x.from),x.from=W.from),W.to>x.to&&(_(I,x.to,W.to),x.to=W.to)})},k.updateViewportTimeSpan||400)}}function J(I,x){var k=I.state.foldGutter;if(k){var W=x.line;W>=k.from&&W<k.to&&_(I,W,W+1)}}})}(),function(y,f){(function(h){h(Yt())})(function(h){function P(T){return function(E,O){var C=O.line,_=E.getLine(C);function b(J){for(var I,x=O.ch,k=0;;){var W=x<=0?-1:_.lastIndexOf(J[0],x-1);if(W==-1){if(k==1)break;k=1,x=_.length;continue}if(k==1&&W<O.ch)break;if(I=E.getTokenTypeAt(h.Pos(C,W+1)),!/^(comment|string)/.test(I))return{ch:W+1,tokenType:I,pair:J};x=W-1}}function D(J){var I=1,x=E.lastLine(),k,W=J.ch,X;e:for(var Z=C;Z<=x;++Z)for(var ie=E.getLine(Z),se=Z==C?W:0;;){var fe=ie.indexOf(J.pair[0],se),Ie=ie.indexOf(J.pair[1],se);if(fe<0&&(fe=ie.length),Ie<0&&(Ie=ie.length),se=Math.min(fe,Ie),se==ie.length)break;if(E.getTokenTypeAt(h.Pos(Z,se+1))==J.tokenType){if(se==fe)++I;else if(!--I){k=Z,X=se;break e}}++se}return k==null||C==k?null:{from:h.Pos(C,W),to:h.Pos(k,X)}}for(var Q=[],N=0;N<T.length;N++){var Y=b(T[N]);Y&&Q.push(Y)}Q.sort(function(J,I){return J.ch-I.ch});for(var N=0;N<Q.length;N++){var B=D(Q[N]);if(B)return B}return null}}h.registerHelper("fold","brace",P([["{","}"],["[","]"]])),h.registerHelper("fold","brace-paren",P([["{","}"],["[","]"],["(",")"]])),h.registerHelper("fold","import",function(T,E){function O(N){if(N<T.firstLine()||N>T.lastLine())return null;var Y=T.getTokenAt(h.Pos(N,1));if(/\S/.test(Y.string)||(Y=T.getTokenAt(h.Pos(N,Y.end+1))),Y.type!="keyword"||Y.string!="import")return null;for(var B=N,J=Math.min(T.lastLine(),N+10);B<=J;++B){var I=T.getLine(B),x=I.indexOf(";");if(x!=-1)return{startCh:Y.end,end:h.Pos(B,x)}}}var C=E.line,_=O(C),b;if(!_||O(C-1)||(b=O(C-2))&&b.end.line==C-1)return null;for(var D=_.end;;){var Q=O(D.line+1);if(Q==null)break;D=Q.end}return{from:T.clipPos(h.Pos(C,_.startCh+1)),to:D}}),h.registerHelper("fold","include",function(T,E){function O(Q){if(Q<T.firstLine()||Q>T.lastLine())return null;var N=T.getTokenAt(h.Pos(Q,1));if(/\S/.test(N.string)||(N=T.getTokenAt(h.Pos(Q,N.end+1))),N.type=="meta"&&N.string.slice(0,8)=="#include")return N.start+8}var C=E.line,_=O(C);if(_==null||O(C-1)!=null)return null;for(var b=C;;){var D=O(b+1);if(D==null)break;++b}return{from:h.Pos(C,_+1),to:T.clipPos(h.Pos(b))}})})}(),function(y,f){(function(h){h(Yt())})(function(h){function P(T,E){var O=T.getLine(E),C=O.search(/\S/);return C==-1||/\bcomment\b/.test(T.getTokenTypeAt(h.Pos(E,C+1)))?-1:h.countColumn(O,null,T.getOption("tabSize"))}h.registerHelper("fold","indent",function(T,E){var O=P(T,E.line);if(!(O<0)){for(var C=null,_=E.line+1,b=T.lastLine();_<=b;++_){var D=P(T,_);if(D!=-1)if(D>O)C=_;else break}if(C)return{from:h.Pos(E.line,T.getLine(E.line).length),to:h.Pos(C,T.getLine(C).length)}}})})}();const La=en.defineStore("trace",{state:()=>({traces:[],currentTrace:null}),getters:{getTraces:y=>y.traces,getCurrentTrace:y=>y.currentTrace},actions:{setTraces(y){this.traces=y},setCurrentTrace(y){this.currentTrace=y}}});var _a={exports:{}};(function(y,f){(function(h,P){y.exports=P(Yt())})(xa,function(h){return function(P){function T(O){if(E[O])return E[O].exports;var C=E[O]={i:O,l:!1,exports:{}};return P[O].call(C.exports,C,C.exports,T),C.l=!0,C.exports}var E={};return T.m=P,T.c=E,T.i=function(O){return O},T.d=function(O,C,_){T.o(O,C)||Object.defineProperty(O,C,{configurable:!1,enumerable:!0,get:_})},T.n=function(O){var C=O&&O.__esModule?function(){return O.default}:function(){return O};return T.d(C,"a",C),C},T.o=function(O,C){return Object.prototype.hasOwnProperty.call(O,C)},T.p="/",T(T.s=3)}([function(P,T){P.exports=h},function(P,T,E){Object.defineProperty(T,"__esModule",{value:!0});var O=E(0),C=function(b){return b&&b.__esModule?b:{default:b}}(O),_=window.CodeMirror||C.default;typeof Object.assign!="function"&&Object.defineProperty(Object,"assign",{value:function(b,D){if(b==null)throw new TypeError("Cannot convert undefined or null to object");for(var Q=Object(b),N=1;N<arguments.length;N++){var Y=arguments[N];if(Y!=null)for(var B in Y)Object.prototype.hasOwnProperty.call(Y,B)&&(Q[B]=Y[B])}return Q},writable:!0,configurable:!0}),T.default={name:"codemirror",data:function(){return{content:"",codemirror:null,cminstance:null}},props:{code:String,value:String,marker:Function,unseenLines:Array,name:{type:String,default:"codemirror"},placeholder:{type:String,default:""},merge:{type:Boolean,default:!1},options:{type:Object,default:function(){return{}}},events:{type:Array,default:function(){return[]}},globalOptions:{type:Object,default:function(){return{}}},globalEvents:{type:Array,default:function(){return[]}}},watch:{options:{deep:!0,handler:function(b){for(var D in b)this.cminstance.setOption(D,b[D])}},merge:function(){this.$nextTick(this.switchMerge)},code:function(b){this.handerCodeChange(b)},value:function(b){this.handerCodeChange(b)}},methods:{initialize:function(){var b=this,D=Object.assign({},this.globalOptions,this.options);this.merge?(this.codemirror=_.MergeView(this.$refs.mergeview,D),this.cminstance=this.codemirror.edit):(this.codemirror=_.fromTextArea(this.$refs.textarea,D),this.cminstance=this.codemirror,this.cminstance.setValue(this.code||this.value||this.content)),this.cminstance.on("change",function(N){b.content=N.getValue(),b.$emit&&b.$emit("input",b.content)});var Q={};["scroll","changes","beforeChange","cursorActivity","keyHandled","inputRead","electricInput","beforeSelectionChange","viewportChange","swapDoc","gutterClick","gutterContextMenu","focus","blur","refresh","optionChange","scrollCursorIntoView","update"].concat(this.events).concat(this.globalEvents).filter(function(N){return!Q[N]&&(Q[N]=!0)}).forEach(function(N){b.cminstance.on(N,function(){for(var Y=arguments.length,B=Array(Y),J=0;J<Y;J++)B[J]=arguments[J];b.$emit.apply(b,[N].concat(B));var I=N.replace(/([A-Z])/g,"-$1").toLowerCase();I!==N&&b.$emit.apply(b,[I].concat(B))})}),this.$emit("ready",this.codemirror),this.unseenLineMarkers(),this.refresh()},refresh:function(){var b=this;this.$nextTick(function(){b.cminstance.refresh()})},destroy:function(){var b=this.cminstance.doc.cm.getWrapperElement();b&&b.remove&&b.remove()},handerCodeChange:function(b){if(b!==this.cminstance.getValue()){var D=this.cminstance.getScrollInfo();this.cminstance.setValue(b),this.content=b,this.cminstance.scrollTo(D.left,D.top)}this.unseenLineMarkers()},unseenLineMarkers:function(){var b=this;this.unseenLines!==void 0&&this.marker!==void 0&&this.unseenLines.forEach(function(D){var Q=b.cminstance.lineInfo(D);b.cminstance.setGutterMarker(D,"breakpoints",Q.gutterMarkers?null:b.marker())})},switchMerge:function(){var b=this.cminstance.doc.history,D=this.cminstance.doc.cleanGeneration;this.options.value=this.cminstance.getValue(),this.destroy(),this.initialize(),this.cminstance.doc.history=b,this.cminstance.doc.cleanGeneration=D}},mounted:function(){this.initialize()},beforeDestroy:function(){this.destroy()}}},function(P,T,E){Object.defineProperty(T,"__esModule",{value:!0});var O=E(1),C=E.n(O);for(var _ in O)["default","default"].indexOf(_)<0&&function(N){E.d(T,N,function(){return O[N]})}(_);var b=E(5),D=E(4),Q=D(C.a,b.a,!1,null,null,null);T.default=Q.exports},function(P,T,E){function O(B){return B&&B.__esModule?B:{default:B}}Object.defineProperty(T,"__esModule",{value:!0}),T.install=T.codemirror=T.CodeMirror=void 0;var C=E(0),_=O(C),b=E(2),D=O(b),Q=window.CodeMirror||_.default,N=function(B,J){J&&(J.options&&(D.default.props.globalOptions.default=function(){return J.options}),J.events&&(D.default.props.globalEvents.default=function(){return J.events})),B.component(D.default.name,D.default)},Y={CodeMirror:Q,codemirror:D.default,install:N};T.default=Y,T.CodeMirror=Q,T.codemirror=D.default,T.install=N},function(P,T){P.exports=function(E,O,C,_,b,D){var Q,N=E=E||{},Y=typeof E.default;Y!=="object"&&Y!=="function"||(Q=E,N=E.default);var B=typeof N=="function"?N.options:N;O&&(B.render=O.render,B.staticRenderFns=O.staticRenderFns,B._compiled=!0),C&&(B.functional=!0),b&&(B._scopeId=b);var J;if(D?(J=function(k){k=k||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,k||typeof __VUE_SSR_CONTEXT__>"u"||(k=__VUE_SSR_CONTEXT__),_&&_.call(this,k),k&&k._registeredComponents&&k._registeredComponents.add(D)},B._ssrRegister=J):_&&(J=_),J){var I=B.functional,x=I?B.render:B.beforeCreate;I?(B._injectStyles=J,B.render=function(k,W){return J.call(W),x(k,W)}):B.beforeCreate=x?[].concat(x,J):[J]}return{esModule:Q,exports:N,options:B}}},function(P,T,E){var O=function(){var b=this,D=b.$createElement,Q=b._self._c||D;return Q("div",{staticClass:"vue-codemirror",class:{merge:b.merge}},[b.merge?Q("div",{ref:"mergeview"}):Q("textarea",{ref:"textarea",attrs:{name:b.name,placeholder:b.placeholder}})])},C=[],_={render:O,staticRenderFns:C};T.a=_}])})})(_a);var Ro=_a.exports;const Eo=()=>typeof __TRACE_API_BASE_URL__<"u"?__TRACE_API_BASE_URL__:typeof window<"u"&&window.__TRACE_API_BASE_URL__?window.__TRACE_API_BASE_URL__:typeof process<"u"&&process.env&&process.env.TRACE_API_BASE_URL?process.env.TRACE_API_BASE_URL:"/tracing",Pn=Io.create({baseURL:Eo(),timeout:3e4}),Lr={getTraceList(y,f,h,P,T){const E={};return y&&(E.query=y),f&&(E.startTime=f),h&&(E.endTime=h),P&&(E.pageNo=P),T&&(E.pageSize=T),Pn.get("/v1/trace",{params:E}).then(O=>O.data)},getTraceDetail(y){return Pn.get(`/v1/trace/${y}`).then(f=>f.data)},getTraceSpans(y){return Pn.get(`/v1/trace/${y}/spans`).then(f=>f.data)},deleteTraces(y,f,h){const P={};return y&&(P.query=y),f&&(P.startTime=f),h&&(P.endTime=h),Pn.delete("/v1/trace",{params:P}).then(T=>T.data)}};function Da(y,f,h,P,T,E,O,C){var _=typeof y=="function"?y.options:y;return f&&(_.render=f,_.staticRenderFns=h,_._compiled=!0),E&&(_._scopeId="data-v-"+E),{exports:y,options:_}}const Po={name:"TraceSpanTree",props:{spans:{type:Array,default:()=>[]},selectedSpanId:{type:String,default:null},traceStartTime:{type:Number,default:0},traceEndTime:{type:Number,default:0}},data(){return{expandedNodes:new Set,treeData:[]}},watch:{spans:{immediate:!0,handler(){this.buildTree()}}},methods:{buildTree(){if(!this.spans||this.spans.length===0){this.treeData=[];return}const y=new Map,f=[];this.spans.forEach(h=>{y.set(h.span_id,{...h,children:[]})}),this.spans.forEach(h=>{const P=y.get(h.span_id);if(h.parent_span_id){const T=y.get(h.parent_span_id);T?T.children.push(P):f.push(P)}else f.push(P)}),f.forEach(h=>{this.sortChildren(h)}),this.treeData=f,this.treeData.length>0&&this.expandedNodes.add(this.treeData[0].span_id)},sortChildren(y){y.children&&y.children.length>0&&(y.children.sort((f,h)=>f.start_time_unix_nano-h.start_time_unix_nano),y.children.forEach(f=>this.sortChildren(f)))},handleNodeClick(y){this.$emit("span-select",y)},hasChildren(y){return y.children&&y.children.length>0},isExpanded(y){return this.expandedNodes.has(y.span_id)},toggleExpand(y){this.expandedNodes.has(y.span_id)?this.expandedNodes.delete(y.span_id):this.expandedNodes.add(y.span_id),this.$forceUpdate()},getNodeDepth(y){let f=0,h=y;for(;h.parent_span_id;){f++;const P=this.findNodeById(h.parent_span_id);if(!P)break;h=P}return f},findNodeById(y){const f=h=>{for(const P of h){if(P.span_id===y)return P;if(P.children&&P.children.length>0){const T=f(P.children);if(T)return T}}return null};return f(this.treeData)},getTimelineBarStyle(y){if(!this.traceStartTime||!this.traceEndTime||this.traceStartTime===this.traceEndTime)return{width:"100%"};const f=this.traceEndTime-this.traceStartTime,h=y.start_time_unix_nano-this.traceStartTime,P=y.duration_ns,T=h/f*100,E=P/f*100;return{left:`${T}%`,width:`${E}%`}},getTypeColor(y){return{SERVER:"primary",CHAT_MODEL:"success",LLM:"success",CHAIN:"warning",AGENT:"danger",TOOL:"info",JOB:"warning",FUNCTION:"info"}[y]||"info"},formatNanoDuration(y){if(!y)return"-";const f=y/1e6;return f<1e3?`${f.toFixed(2)}ms`:f<6e4?`${(f/1e3).toFixed(2)}s`:`${(f/6e4).toFixed(2)}min`},formatTime(y){if(!y)return"-";const f=y/1e6,h=new Date(f),P=h.getFullYear(),T=String(h.getMonth()+1).padStart(2,"0"),E=String(h.getDate()).padStart(2,"0"),O=String(h.getHours()).padStart(2,"0"),C=String(h.getMinutes()).padStart(2,"0"),_=String(h.getSeconds()).padStart(2,"0");return`${P}-${T}-${E} ${O}:${C}:${_}`}}};var Wo=function(){var f=this,h=f._self._c;return h("div",{staticClass:"span-tree-container"},[f.treeData.length===0?h("div",{staticClass:"empty-state"},[h("el-empty",{attrs:{description:"暂无 Span 数据"}})],1):h("div",{staticClass:"timeline-wrapper"},[h("div",{staticClass:"timeline-header"},[h("div",{staticClass:"time-scale"},[h("span",{staticClass:"time-start"},[f._v(f._s(f.formatTime(f.traceStartTime)))]),h("span",{staticClass:"time-end"},[f._v(f._s(f.formatTime(f.traceEndTime)))])])]),h("div",{ref:"timelineContent",staticClass:"timeline-content"},f._l(f.treeData,function(P,T){return h("div",{key:P.span_id,staticClass:"timeline-node",class:{selected:f.selectedSpanId===P.span_id},on:{click:function(E){return f.handleNodeClick(P)}}},[h("div",{staticClass:"node-row"},[h("div",{staticClass:"node-info",style:{paddingLeft:`${f.getNodeDepth(P)*20}px`}},[f.hasChildren(P)?h("i",{staticClass:"expand-icon",class:f.isExpanded(P)?"el-icon-arrow-down":"el-icon-arrow-right",on:{click:function(E){return E.stopPropagation(),f.toggleExpand(P)}}}):h("i",{staticClass:"expand-icon-placeholder"}),h("el-tag",{staticClass:"type-tag",attrs:{type:f.getTypeColor(P.type),size:"mini"}},[f._v(" "+f._s(P.type)+" ")]),h("span",{staticClass:"node-name",attrs:{title:P.name}},[f._v(f._s(P.name))])],1),h("div",{staticClass:"node-duration"},[f._v(" "+f._s(f.formatNanoDuration(P.duration_ns))+" ")])]),h("div",{staticClass:"timeline-bar-wrapper"},[h("div",{staticClass:"timeline-bar",class:{selected:f.selectedSpanId===P.span_id},style:f.getTimelineBarStyle(P)})]),f.isExpanded(P)&&f.hasChildren(P)?h("div",{staticClass:"children-nodes"},f._l(P.children,function(E){return h("div",{key:E.span_id,staticClass:"timeline-node child-node",class:{selected:f.selectedSpanId===E.span_id},on:{click:function(O){return O.stopPropagation(),f.handleNodeClick(E)}}},[h("div",{staticClass:"node-row"},[h("div",{staticClass:"node-info",style:{paddingLeft:`${f.getNodeDepth(E)*20}px`}},[f.hasChildren(E)?h("i",{staticClass:"expand-icon",class:f.isExpanded(E)?"el-icon-arrow-down":"el-icon-arrow-right",on:{click:function(O){return O.stopPropagation(),f.toggleExpand(E)}}}):h("i",{staticClass:"expand-icon-placeholder"}),h("el-tag",{staticClass:"type-tag",attrs:{type:f.getTypeColor(E.type),size:"mini"}},[f._v(" "+f._s(E.type)+" ")]),h("span",{staticClass:"node-name",attrs:{title:E.name}},[f._v(f._s(E.name))])],1),h("div",{staticClass:"node-duration"},[f._v(" "+f._s(f.formatNanoDuration(E.duration_ns))+" ")])]),h("div",{staticClass:"timeline-bar-wrapper"},[h("div",{staticClass:"timeline-bar",class:{selected:f.selectedSpanId===E.span_id},style:f.getTimelineBarStyle(E)})]),f.isExpanded(E)&&f.hasChildren(E)?h("div",{staticClass:"children-nodes"},f._l(E.children,function(O){return h("div",{key:O.span_id,staticClass:"timeline-node child-node",class:{selected:f.selectedSpanId===O.span_id},on:{click:function(C){return C.stopPropagation(),f.handleNodeClick(O)}}},[h("div",{staticClass:"node-row"},[h("div",{staticClass:"node-info",style:{paddingLeft:`${f.getNodeDepth(O)*20}px`}},[h("i",{staticClass:"expand-icon-placeholder"}),h("el-tag",{staticClass:"type-tag",attrs:{type:f.getTypeColor(O.type),size:"mini"}},[f._v(" "+f._s(O.type)+" ")]),h("span",{staticClass:"node-name",attrs:{title:O.name}},[f._v(f._s(O.name))])],1),h("div",{staticClass:"node-duration"},[f._v(" "+f._s(f.formatNanoDuration(O.duration_ns))+" ")])]),h("div",{staticClass:"timeline-bar-wrapper"},[h("div",{staticClass:"timeline-bar",class:{selected:f.selectedSpanId===O.span_id},style:f.getTimelineBarStyle(O)})])])}),0):f._e()])}),0):f._e()])}),0)])])},Ho=[],Fo=Da(Po,Wo,Ho,!1,null,"4f00ade1");const wi=Fo.exports,Bo={name:"Trace",components:{TraceSpanTree:wi,codemirror:Ro.codemirror},data(){return{traceList:[],filteredTraceList:[],searchQuery:"",dateRange:null,loading:!1,showColumnDialog:!1,selectedColumns:["trace_id","timestamp_ms","status","execution_time_ms","trace_type","trace_name"],visibleColumns:{trace_id:!0,timestamp_ms:!0,status:!0,execution_time_ms:!0,trace_type:!0,trace_name:!0},drawerVisible:!1,currentTraceId:null,traceInfo:{},spans:[],filteredSpans:[],spanSearchQuery:"",selectedSpanId:null,selectedSpan:null,activeTab:"io",activeCollapse:["inputs","outputs"],messageCollapse:[],rawIoCollapse:["rawInputs","rawOutputs"],rawInputsKey:0,rawOutputsKey:0,pageNo:1,pageSize:10,total:0,pickerOptions:{shortcuts:[{text:"近7天",onClick(y){const f=new Date,h=new Date;h.setTime(h.getTime()-3600*1e3*24*7),y.$emit("pick",[h,f])}},{text:"近30天",onClick(y){const f=new Date,h=new Date;h.setTime(h.getTime()-3600*1e3*24*30),y.$emit("pick",[h,f])}},{text:"7天前",onClick(y){const f=new Date;f.setTime(f.getTime()-3600*1e3*24*7),f.setHours(23,59,59,999);const h=f.getTime();y.$emit("pick",[null,h])}},{text:"30天前",onClick(y){const f=new Date;f.setTime(f.getTime()-3600*1e3*24*30),f.setHours(23,59,59,999);const h=f.getTime();y.$emit("pick",[null,h])}}]},cmOptions:{tabSize:2,mode:{name:"javascript",json:!0},theme:"monokai",lineNumbers:!0,lineWrapping:!0,readOnly:!0,foldGutter:!0,gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],matchBrackets:!0,autoCloseBrackets:!0,indentUnit:2,styleActiveLine:!0}}},computed:{drawerTitle(){return this.traceInfo.trace_id?`${this.$t("trace.traceDetail")}: ${this.traceInfo.trace_id}`:this.$t("trace.traceDetail")},traceStartTime(){return this.spans.length===0?0:Math.min(...this.spans.map(y=>y.start_time_unix_nano))},traceEndTime(){return this.spans.length===0?0:Math.max(...this.spans.map(y=>y.end_time_unix_nano))},hasInputs(){var y,f;return((f=(y=this.selectedSpan)==null?void 0:y.parsedContent)==null?void 0:f.inputs)!==void 0},hasOutputs(){var y,f;return((f=(y=this.selectedSpan)==null?void 0:y.parsedContent)==null?void 0:f.outputs)!==void 0},attributesData(){var y,f;return(f=(y=this.selectedSpan)==null?void 0:y.parsedContent)!=null&&f.attributes?Object.entries(this.selectedSpan.parsedContent.attributes).filter(([h])=>!h.startsWith("langsword.span")).map(([h,P])=>({key:h,value:typeof P=="string"?P:JSON.stringify(P,null,2)})):[]},rawInputs(){var y,f,h;return(h=(f=(y=this.selectedSpan)==null?void 0:y.parsedContent)==null?void 0:f.attributes)==null?void 0:h["langsword.spanInputs"]},rawOutputs(){var y,f,h;return(h=(f=(y=this.selectedSpan)==null?void 0:y.parsedContent)==null?void 0:f.attributes)==null?void 0:h["langsword.spanOutputs"]}},watch:{activeTab(y){y==="raw"&&this.$nextTick(()=>{this.rawInputsKey++,this.rawOutputsKey++})},selectedSpan(){this.activeTab==="raw"&&this.$nextTick(()=>{this.rawInputsKey++,this.rawOutputsKey++})}},mounted(){this.loadTraceList()},methods:{async loadTraceList(){this.loading=!0;try{let y=null,f=null;this.dateRange&&Array.isArray(this.dateRange)&&(this.dateRange.length===2?(this.dateRange[0]!==null&&this.dateRange[0]!==void 0&&this.dateRange[0]!==""&&(y=typeof this.dateRange[0]=="number"?this.dateRange[0]:parseInt(this.dateRange[0],10)),this.dateRange[1]!==null&&this.dateRange[1]!==void 0&&this.dateRange[1]!==""&&(f=typeof this.dateRange[1]=="number"?this.dateRange[1]:parseInt(this.dateRange[1],10))):this.dateRange.length===1&&this.dateRange[0]!==null&&(f=typeof this.dateRange[0]=="number"?this.dateRange[0]:parseInt(this.dateRange[0],10)));const h=await Lr.getTraceList(this.searchQuery,y,f,this.pageNo,this.pageSize),P=Array.isArray(h==null?void 0:h.list)?h.list:[];this.traceList=P,this.filteredTraceList=P,this.total=parseInt((h==null?void 0:h.total)||0,10)}catch(y){console.error("Failed to load trace list:",y),this.$message.error("加载 trace 列表失败"),this.traceList=[],this.filteredTraceList=[],this.total=0}finally{this.loading=!1}},refresh(){this.loadTraceList()},handleRowClick(y){this.viewDetail(y.trace_id)},viewDetail(y){this.currentTraceId=y,this.loadTraceDetail(y),this.drawerVisible=!0},async loadTraceDetail(y){var f,h;try{const[P,T]=await Promise.all([Lr.getTraceDetail(y),Lr.getTraceSpans(y)]);this.traceInfo=P||{},this.spans=T.map(E=>{let O={};try{if(O=JSON.parse(E.content),O.attributes){const C=O.attributes["langsword.spanInputs"],_=O.attributes["langsword.spanOutputs"];if(C)try{O.inputs=JSON.parse(C)}catch{try{const D=C.replace(/\\"/g,'"').replace(/^"|"$/g,"");O.inputs=JSON.parse(D)}catch{O.inputs=C}}if(_)try{O.outputs=JSON.parse(_)}catch{try{const D=_.replace(/\\"/g,'"').replace(/^"|"$/g,"");O.outputs=JSON.parse(D)}catch{O.outputs=_}}}}catch(C){console.error("Parse content error:",C)}return{...E,parsedContent:O}}),this.filteredSpans=this.spans,this.spans.length>0&&(this.selectedSpanId=this.spans[0].span_id,this.selectedSpan=this.spans[0],(h=(f=this.selectedSpan.parsedContent)==null?void 0:f.inputs)!=null&&h.messages?this.messageCollapse=this.selectedSpan.parsedContent.inputs.messages.map((E,O)=>`message-${O}`):this.messageCollapse=[])}catch(P){console.error("Failed to load trace detail:",P),this.$message.error("加载 trace 详情失败"),this.traceInfo={},this.spans=[],this.filteredSpans=[]}},handleSpanSearch(){if(!this.spanSearchQuery){this.filteredSpans=this.spans;return}const y=this.spanSearchQuery.toLowerCase();this.filteredSpans=this.spans.filter(f=>f.name.toLowerCase().includes(y)||f.type.toLowerCase().includes(y)||f.span_id.toLowerCase().includes(y))},handleSpanSelect(y){var f,h;this.selectedSpanId=y.span_id,this.selectedSpan=y,this.activeTab="io",(h=(f=this.selectedSpan.parsedContent)==null?void 0:f.inputs)!=null&&h.messages?this.messageCollapse=this.selectedSpan.parsedContent.inputs.messages.map((P,T)=>`message-${T}`):this.messageCollapse=[]},handleDrawerClose(y){this.currentTraceId=null,this.traceInfo={},this.spans=[],this.filteredSpans=[],this.selectedSpanId=null,this.selectedSpan=null,this.spanSearchQuery="",y()},handleSearch(){this.pageNo=1,this.loadTraceList()},handleSearchClear(){this.searchQuery="",this.pageNo=1,this.loadTraceList()},handleDateRangeChange(y){this.pageNo=1,y&&Array.isArray(y)?y.length===2&&(y[0]===null||y[0]===void 0)?this.dateRange=[null,y[1]]:this.dateRange=y:this.dateRange=y,this.loadTraceList()},handleSizeChange(y){this.pageSize=y,this.pageNo=1,this.loadTraceList()},handleCurrentChange(y){this.pageNo=y,this.loadTraceList()},async handleBatchDelete(){var T,E;const y=this.searchQuery&&this.searchQuery.trim(),f=this.dateRange&&Array.isArray(this.dateRange)&&(this.dateRange.length===2&&this.dateRange[1]!==null||this.dateRange.length===1&&this.dateRange[0]!==null);let h="",P="warning";if(!y&&!f)h=this.$t("trace.deleteAllWarning"),P="error";else{if(h=this.$t("trace.deleteConfirmMessage")+`
26
+ `,y&&(h+=`${this.$t("trace.searchCondition")}: ${this.searchQuery}
27
+ `),f){const O=this.$i18n.locale==="zh-CN"?"zh-CN":"en-US";let C="";if(this.dateRange.length===2&&this.dateRange[1]!==null?C=new Date(this.dateRange[1]).toLocaleString(O):this.dateRange.length===1&&this.dateRange[0]!==null&&(C=new Date(this.dateRange[0]).toLocaleString(O)),this.dateRange.length===2&&this.dateRange[0]!==null&&this.dateRange[0]!==void 0&&this.dateRange[0]!==""){const _=new Date(this.dateRange[0]).toLocaleString(O);h+=`${this.$t("trace.timeRange")}: ${_} ${this.$t("trace.to")} ${C}
28
+ `}else this.$i18n.locale==="zh-CN"?h+=`${this.$t("trace.timeRange")}: ${this.$t("trace.before")} ${C} 之前
29
+ `:h+=`${this.$t("trace.timeRange")}: ${this.$t("trace.before")} ${C}
30
+ `}h+=this.$t("trace.deleteConfirmFooter")}try{await this.$confirm(h,this.$t("trace.confirmDelete"),{confirmButtonText:this.$t("trace.confirmDeleteButton"),cancelButtonText:this.$t("common.cancel"),type:P,dangerouslyUseHTMLString:!1}),this.loading=!0;let O=null,C=null;this.dateRange&&Array.isArray(this.dateRange)&&(this.dateRange.length===2?(this.dateRange[0]!==null&&this.dateRange[0]!==void 0&&this.dateRange[0]!==""&&(O=typeof this.dateRange[0]=="number"?this.dateRange[0]:parseInt(this.dateRange[0],10)),this.dateRange[1]!==null&&this.dateRange[1]!==void 0&&this.dateRange[1]!==""&&(C=typeof this.dateRange[1]=="number"?this.dateRange[1]:parseInt(this.dateRange[1],10))):this.dateRange.length===1&&this.dateRange[0]!==null&&(C=typeof this.dateRange[0]=="number"?this.dateRange[0]:parseInt(this.dateRange[0],10))),await Lr.deleteTraces(y?this.searchQuery:null,O,C),this.$message.success(this.$t("trace.deleteSuccess")),await this.loadTraceList()}catch(O){if(O!=="cancel"){console.error("Failed to delete traces:",O);const C=((E=(T=O.response)==null?void 0:T.data)==null?void 0:E.message)||O.message||this.$t("trace.unknownError");this.$message.error(`${this.$t("trace.deleteFailed")}: ${C}`)}}finally{this.loading=!1}},getStatusType(y){return{OK:"success",ERROR:"danger",IN_PROGRESS:"warning",UNSET:"info"}[y]||"info"},formatDateTime(y){if(!y)return"-";const f=typeof y=="string"?parseInt(y,10):y;if(isNaN(f))return"-";const h=new Date(f);if(isNaN(h.getTime()))return"-";const P=h.getFullYear(),T=String(h.getMonth()+1).padStart(2,"0"),E=String(h.getDate()).padStart(2,"0"),O=String(h.getHours()).padStart(2,"0"),C=String(h.getMinutes()).padStart(2,"0"),_=String(h.getSeconds()).padStart(2,"0");return`${P}-${T}-${E} ${O}:${C}:${_}`},formatTimeAgo(y){if(!y)return"-";const f=typeof y=="string"?parseInt(y,10):y;if(isNaN(f))return"-";const P=Date.now()-f,T=this.$i18n.locale==="zh-CN",E=Math.floor(P/(1e3*60*60*24));if(E>0)return T?`${E} 天前`:`${E} days ago`;const O=Math.floor(P/(1e3*60*60));if(O>0)return T?`${O} 小时前`:`${O} hours ago`;const C=Math.floor(P/(1e3*60));return C>0?T?`${C} 分钟前`:`${C} minutes ago`:T?"刚刚":"Just now"},formatTimestamp(y){if(!y)return"-";const f=typeof y=="string"?parseInt(y,10):y;if(isNaN(f))return"-";const h=new Date(f);return isNaN(h.getTime())?"-":h.toLocaleString("zh-CN")},formatDuration(y){return y?y<1e3?`${y}ms`:`${(y/1e3).toFixed(1)}s`:"-"},formatJson(y){return y?JSON.stringify(y,null,2):""},formatRawJson(y){if(!y)return"";if(typeof y=="string")try{const f=JSON.parse(y);return JSON.stringify(f,null,2)}catch{try{const h=y.replace(/\\"/g,'"').replace(/^"|"$/g,""),P=JSON.parse(h);return JSON.stringify(P,null,2)}catch{return y}}return JSON.stringify(y,null,2)},handleCodeMirrorReady(y){this.$nextTick(()=>{y&&y.refresh()})},formatMessageContent(y){return typeof y=="string"?y:JSON.stringify(y,null,2)},formatEventTime(y){if(y.time_unix_nano){const f=y.time_unix_nano/1e6;return new Date(f).toLocaleString("zh-CN")}return y.timestamp?new Date(y.timestamp).toLocaleString("zh-CN"):"-"},getMessageIcon(y){return{user:"el-icon-user",assistant:"el-icon-service",system:"el-icon-setting"}[y]||"el-icon-document"},tableRowClassName({row:y,rowIndex:f}){return"trace-row"},getIndex(y){return(this.pageNo-1)*this.pageSize+y+1},applyColumns(){const y={};this.selectedColumns.forEach(f=>{y[f]=!0}),Object.keys(this.visibleColumns).forEach(f=>{this.selectedColumns.includes(f)||(y[f]=!1)}),this.visibleColumns=y,this.showColumnDialog=!1}}};var zo=function(){var P,T,E,O,C,_;var f=this,h=f._self._c;return h("div",{staticClass:"trace-list-container"},[h("el-card",[h("div",{staticClass:"trace-content-wrapper"},[h("div",{staticClass:"trace-toolbar"},[h("el-input",{staticClass:"toolbar-input",attrs:{placeholder:f.$t("trace.searchPlaceholder"),"prefix-icon":"el-icon-search",clearable:"",size:"mini"},on:{clear:f.handleSearchClear,input:f.handleSearch},model:{value:f.searchQuery,callback:function(b){f.searchQuery=b},expression:"searchQuery"}}),h("el-date-picker",{staticClass:"toolbar-date-picker",attrs:{type:"datetimerange","range-separator":f.$t("trace.to"),"start-placeholder":f.$t("trace.startTime"),"end-placeholder":f.$t("trace.endTime"),"value-format":"timestamp",format:"yyyy-MM-dd HH:mm:ss",size:"mini","picker-options":f.pickerOptions,clearable:""},on:{change:f.handleDateRangeChange},model:{value:f.dateRange,callback:function(b){f.dateRange=b},expression:"dateRange"}}),h("el-button",{attrs:{type:"danger",icon:"el-icon-delete",size:"mini",disabled:f.loading},on:{click:f.handleBatchDelete}},[f._v(" "+f._s(f.$t("trace.batchDelete"))+" ")]),h("el-button",{attrs:{icon:"el-icon-refresh",size:"mini",circle:"",title:f.$t("common.refresh")},on:{click:f.refresh}}),h("el-button",{attrs:{icon:"el-icon-setting",size:"mini"},on:{click:function(b){f.showColumnDialog=!0}}},[f._v(" "+f._s(f.$t("common.columns"))+" ")])],1),h("div",{staticClass:"trace-table-wrapper"},[h("el-table",{directives:[{name:"loading",rawName:"v-loading",value:f.loading,expression:"loading"}],staticStyle:{width:"100%"},attrs:{data:f.filteredTraceList,size:"mini",stripe:"","row-class-name":f.tableRowClassName},on:{"row-click":f.handleRowClick}},[h("el-table-column",{attrs:{type:"index",label:"#",width:"60",index:f.getIndex}}),f.visibleColumns.trace_id?h("el-table-column",{attrs:{prop:"trace_id",label:f.$t("trace.requestId"),width:"280","show-overflow-tooltip":""},scopedSlots:f._u([{key:"default",fn:function(b){return[h("el-link",{attrs:{type:"primary"},on:{click:function(D){return D.stopPropagation(),f.viewDetail(b.row.trace_id)}}},[f._v(" "+f._s(b.row.trace_id)+" ")])]}}],null,!1,1400187371)}):f._e(),f.visibleColumns.trace_name?h("el-table-column",{attrs:{prop:"trace_name",label:f.$t("trace.traceName"),"min-width":"300","show-overflow-tooltip":""},scopedSlots:f._u([{key:"default",fn:function(b){return[h("span",[f._v(f._s(b.row.trace_name||"-"))])]}}],null,!1,3633653970)}):f._e(),f.visibleColumns.trace_type?h("el-table-column",{attrs:{prop:"trace_type",label:f.$t("trace.traceType"),width:"120"},scopedSlots:f._u([{key:"default",fn:function(b){return[h("el-tag",{attrs:{size:"mini",type:"info"}},[f._v(f._s(b.row.trace_type||"-"))])]}}],null,!1,1175446173)}):f._e(),f.visibleColumns.execution_time_ms?h("el-table-column",{attrs:{prop:"execution_time_ms",label:f.$t("trace.executionTime"),width:"120"},scopedSlots:f._u([{key:"default",fn:function(b){return[f._v(" "+f._s(f.formatDuration(b.row.execution_time_ms))+" ")]}}],null,!1,2586299640)}):f._e(),f.visibleColumns.status?h("el-table-column",{attrs:{prop:"status",label:f.$t("trace.status"),width:"100"},scopedSlots:f._u([{key:"default",fn:function(b){return[h("el-tag",{attrs:{type:f.getStatusType(b.row.status),size:"mini"}},[b.row.status==="OK"?h("i",{staticClass:"el-icon-success"}):f._e(),f._v(" "+f._s(b.row.status)+" ")])]}}],null,!1,3672547022)}):f._e(),f.visibleColumns.timestamp_ms?h("el-table-column",{attrs:{prop:"timestamp_ms",label:f.$t("trace.timeCreated"),width:"180"},scopedSlots:f._u([{key:"default",fn:function(b){return[f._v(" "+f._s(f.formatDateTime(b.row.timestamp_ms))+" ")]}}],null,!1,1082702673)}):f._e(),h("el-table-column",{attrs:{label:f.$t("common.operation"),width:"100",fixed:"right"},scopedSlots:f._u([{key:"default",fn:function(b){return[h("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(D){return D.stopPropagation(),f.viewDetail(b.row.trace_id)}}},[f._v(" "+f._s(f.$t("common.viewDetail"))+" ")])]}}])})],1)],1),h("div",{staticClass:"trace-pagination-wrapper"},[f.total>0?h("el-pagination",{staticClass:"trace-pagination",attrs:{"current-page":f.pageNo,"page-sizes":[10,20,50,100],"page-size":f.pageSize,size:"mini",layout:"total, prev, pager, next, sizes, jumper",total:f.total,background:""},on:{"size-change":f.handleSizeChange,"current-change":f.handleCurrentChange}}):f._e()],1)])]),h("el-dialog",{attrs:{title:f.$t("trace.selectColumns"),visible:f.showColumnDialog,width:"400px"},on:{"update:visible":function(b){f.showColumnDialog=b}}},[h("el-checkbox-group",{model:{value:f.selectedColumns,callback:function(b){f.selectedColumns=b},expression:"selectedColumns"}},[h("el-checkbox",{attrs:{label:"trace_id"}},[f._v(f._s(f.$t("trace.requestId")))]),h("el-checkbox",{attrs:{label:"timestamp_ms"}},[f._v(f._s(f.$t("trace.timeCreated")))]),h("el-checkbox",{attrs:{label:"status"}},[f._v(f._s(f.$t("trace.status")))]),h("el-checkbox",{attrs:{label:"execution_time_ms"}},[f._v(f._s(f.$t("trace.executionTime")))]),h("el-checkbox",{attrs:{label:"trace_type"}},[f._v(f._s(f.$t("trace.traceType")))]),h("el-checkbox",{attrs:{label:"trace_name"}},[f._v(f._s(f.$t("trace.traceName")))])],1),h("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[h("el-button",{attrs:{size:"mini"},on:{click:function(b){f.showColumnDialog=!1}}},[f._v(f._s(f.$t("common.cancel")))]),h("el-button",{attrs:{size:"mini",type:"primary"},on:{click:f.applyColumns}},[f._v(f._s(f.$t("common.confirm")))])],1)],1),h("el-drawer",{attrs:{visible:f.drawerVisible,"with-header":!0,title:f.drawerTitle,size:"90%",direction:"rtl","before-close":f.handleDrawerClose},on:{"update:visible":function(b){f.drawerVisible=b}}},[f.currentTraceId?h("div",{staticClass:"trace-detail-content"},[h("div",{staticClass:"trace-info-section"},[h("el-descriptions",{attrs:{column:3,border:""}},[h("el-descriptions-item",{attrs:{label:f.$t("trace.traceId")}},[f._v(f._s(f.traceInfo.trace_id))]),h("el-descriptions-item",{attrs:{label:f.$t("trace.status")}},[h("el-tag",{attrs:{type:f.getStatusType(f.traceInfo.status),size:"mini"}},[f._v(" "+f._s(f.traceInfo.status)+" ")])],1),h("el-descriptions-item",{attrs:{label:f.$t("trace.executionTime")}},[f._v(" "+f._s(f.formatDuration(f.traceInfo.execution_time_ms))+" ")]),h("el-descriptions-item",{attrs:{label:f.$t("trace.timeCreated")}},[f._v(" "+f._s(f.formatTimestamp(f.traceInfo.timestamp_ms))+" ")]),h("el-descriptions-item",{attrs:{label:f.$t("trace.experimentId")}},[f._v(f._s(f.traceInfo.experiment_id))]),h("el-descriptions-item",{attrs:{label:f.$t("trace.traceType")}},[h("el-tag",{attrs:{size:"mini",type:"info"}},[f._v(f._s(f.traceInfo.trace_type||"-"))])],1),h("el-descriptions-item",{attrs:{label:f.$t("trace.traceName"),span:2}},[f._v(" "+f._s(f.traceInfo.trace_name||"-")+" ")])],1)],1),h("el-divider"),h("el-row",{attrs:{gutter:20}},[h("el-col",{staticClass:"span-tree-col",attrs:{span:8}},[h("el-card",[h("div",{attrs:{slot:"header"},slot:"header"},[h("el-input",{attrs:{placeholder:f.$t("common.search"),"prefix-icon":"el-icon-search",size:"small",clearable:""},on:{input:f.handleSpanSearch},model:{value:f.spanSearchQuery,callback:function(b){f.spanSearchQuery=b},expression:"spanSearchQuery"}})],1),h("TraceSpanTree",{attrs:{spans:f.filteredSpans,"selected-span-id":f.selectedSpanId,"trace-start-time":f.traceStartTime,"trace-end-time":f.traceEndTime},on:{"span-select":f.handleSpanSelect}})],1)],1),h("el-col",{staticClass:"span-detail-col",attrs:{span:16}},[h("el-card",[h("div",{attrs:{slot:"header"},slot:"header"},[h("span",[f._v(f._s(f.$t("trace.spanDetail")))])]),f.selectedSpan?h("div",{staticClass:"span-detail-content"},[h("el-tabs",{model:{value:f.activeTab,callback:function(b){f.activeTab=b},expression:"activeTab"}},[h("el-tab-pane",{attrs:{label:`${f.$t("trace.inputs")} / ${f.$t("trace.outputs")}`,name:"io"}},[h("div",{staticClass:"io-content"},[f.hasInputs?h("div",{staticClass:"io-section"},[h("el-collapse",{model:{value:f.activeCollapse,callback:function(b){f.activeCollapse=b},expression:"activeCollapse"}},[h("el-collapse-item",{attrs:{title:f.$t("trace.inputs"),name:"inputs"}},[(T=(P=f.selectedSpan.parsedContent)==null?void 0:P.inputs)!=null&&T.messages?h("div",{staticClass:"messages-section"},f._l(f.selectedSpan.parsedContent.inputs.messages,function(b,D){return h("div",{key:D,staticClass:"message-item"},[h("el-collapse",{model:{value:f.messageCollapse,callback:function(Q){f.messageCollapse=Q},expression:"messageCollapse"}},[h("el-collapse-item",{attrs:{name:`message-${D}`}},[h("template",{slot:"title"},[h("i",{staticClass:"message-icon",class:f.getMessageIcon(b.role)}),h("span",{staticClass:"message-role"},[f._v(f._s(b.role))])]),h("div",{staticClass:"message-content"},[h("pre",[f._v(f._s(f.formatMessageContent(b.content)))])])],2)],1)],1)}),0):(E=f.selectedSpan.parsedContent)!=null&&E.inputs?h("div",{staticClass:"json-content"},[h("pre",[f._v(f._s(f.formatJson(f.selectedSpan.parsedContent.inputs)))])]):h("div",{staticClass:"empty-content"},[h("el-empty",{attrs:{description:f.$t("trace.noInputs"),"image-size":80}})],1)])],1)],1):f._e(),f.hasOutputs?h("div",{staticClass:"io-section"},[h("el-collapse",{model:{value:f.activeCollapse,callback:function(b){f.activeCollapse=b},expression:"activeCollapse"}},[h("el-collapse-item",{attrs:{title:f.$t("trace.outputs"),name:"outputs"}},[(C=(O=f.selectedSpan.parsedContent)==null?void 0:O.outputs)!=null&&C.choices?h("div",{staticClass:"outputs-section"},f._l(f.selectedSpan.parsedContent.outputs.choices,function(b,D){return h("div",{key:D,staticClass:"choice-item"},[h("div",{staticClass:"choice-header"},[h("span",[f._v("Choice "+f._s(D))])]),h("div",{staticClass:"choice-content"},[b.message?h("div",[h("div",{staticClass:"message-header"},[h("i",{staticClass:"el-icon-user message-icon"}),h("span",[f._v(f._s(b.message.role))])]),h("pre",[f._v(f._s(f.formatMessageContent(b.message.content)))])]):h("div",[h("pre",[f._v(f._s(f.formatJson(b)))])])])])}),0):(_=f.selectedSpan.parsedContent)!=null&&_.outputs?h("div",{staticClass:"json-content"},[h("pre",[f._v(f._s(f.formatJson(f.selectedSpan.parsedContent.outputs)))])]):h("div",{staticClass:"empty-content"},[h("el-empty",{attrs:{description:f.$t("trace.noOutputs"),"image-size":80}})],1)])],1)],1):f._e(),!f.hasInputs&&!f.hasOutputs?h("div",{staticClass:"empty-io"},[h("el-empty",{attrs:{description:f.$t("trace.noIoData")}})],1):f._e()])]),h("el-tab-pane",{attrs:{label:f.$t("trace.attributes"),name:"attributes"}},[h("el-table",{attrs:{data:f.attributesData,border:"",stripe:""}},[h("el-table-column",{attrs:{prop:"key",label:f.$t("trace.key"),width:"250"}}),h("el-table-column",{attrs:{prop:"value",label:f.$t("trace.value"),"show-overflow-tooltip":""}})],1)],1),h("el-tab-pane",{attrs:{label:f.$t("trace.rawInputsOutputs"),name:"raw"}},[f.activeTab==="raw"?h("div",{staticClass:"raw-io-content"},[f.rawInputs?h("div",{staticClass:"raw-io-section"},[h("el-collapse",{model:{value:f.rawIoCollapse,callback:function(b){f.rawIoCollapse=b},expression:"rawIoCollapse"}},[h("el-collapse-item",{attrs:{title:f.$t("trace.rawInputs"),name:"rawInputs"}},[h("codemirror",{key:`raw-inputs-${f.selectedSpanId}-${f.rawInputsKey}`,staticClass:"code-editor-wrapper",attrs:{value:f.formatRawJson(f.rawInputs),options:f.cmOptions}})],1)],1)],1):f._e(),f.rawOutputs?h("div",{staticClass:"raw-io-section"},[h("el-collapse",{model:{value:f.rawIoCollapse,callback:function(b){f.rawIoCollapse=b},expression:"rawIoCollapse"}},[h("el-collapse-item",{attrs:{title:f.$t("trace.rawOutputs"),name:"rawOutputs"}},[h("codemirror",{key:`raw-outputs-${f.selectedSpanId}-${f.rawOutputsKey}`,staticClass:"code-editor-wrapper",attrs:{value:f.formatRawJson(f.rawOutputs),options:f.cmOptions}})],1)],1)],1):f._e(),!f.rawInputs&&!f.rawOutputs?h("div",{staticClass:"empty-raw-io"},[h("el-empty",{attrs:{description:f.$t("trace.noIoData")}})],1):f._e()]):f._e()])],1)],1):h("el-empty",{attrs:{description:f.$t("trace.selectSpan")}})],1)],1)],1)],1):f._e()])],1)},Uo=[],Go=Da(Bo,zo,Uo,!1,null,"95f212cc");const xi=Go.exports,Oa={routes:[{path:"/trace",name:"trace",component:xi}],beforeEach:(y,f,h)=>{h()}},Ma={common:{home:"首页",todos:"待办事项",trace:"追踪",login:"登录",logout:"退出",user:"用户",search:"搜索",refresh:"刷新",columns:"列设置",confirm:"确定",cancel:"取消",operation:"操作",viewDetail:"查看详情",language:"语言"},trace:{title:"追踪列表",searchPlaceholder:"追踪ID/追踪名称/追踪类型",requestId:"追踪ID",timeCreated:"创建时间",status:"状态",executionTime:"执行时长",traceType:"追踪类型",traceName:"追踪名称",traceDetail:"追踪详情",traceId:"追踪ID",clientRequestId:"客户端请求ID",experimentId:"应用ID",spanDetail:"Span 详情",inputs:"输入",outputs:"输出",attributes:"属性",rawInputsOutputs:"原始输入输出",rawInputs:"原始输入",rawOutputs:"原始输出",events:"事件",selectSpan:"请选择一个 Span 查看详情",noInputs:"暂无输入数据",noOutputs:"暂无输出数据",noIoData:"暂无输入输出数据",noEvents:"暂无事件数据",key:"键",value:"值",selectColumns:"选择列",batchDelete:"批量删除",startTime:"开始时间",endTime:"结束时间",to:"至",confirmDelete:"确认删除",confirmDeleteButton:"确定删除",deleteAllWarning:`警告:您没有设置任何查询条件,这将删除所有 trace 数据!
31
+
32
+ 此操作不可恢复,请确认是否继续?`,deleteConfirmMessage:"确定要删除符合以下条件的 trace 吗?",searchCondition:"搜索条件",timeRange:"时间范围",before:"在",deleteConfirmFooter:`
33
+ 此操作不可恢复,请确认是否继续?`,deleteSuccess:"删除成功",deleteFailed:"删除失败",unknownError:"未知错误"}},Na={common:{home:"Home",todos:"Todos",trace:"Trace",login:"Login",logout:"Logout",user:"User",search:"Search",refresh:"Refresh",columns:"Columns",confirm:"Confirm",cancel:"Cancel",operation:"Operation",viewDetail:"View Detail",language:"Language"},trace:{title:"Traces",searchPlaceholder:"Trace ID/Trace Name/Trace Type",requestId:"Trace ID",timeCreated:"Time created",status:"Status",executionTime:"Execution time",traceType:"Trace Type",traceName:"Trace Name",traceDetail:"Trace Detail",traceId:"Trace ID",clientRequestId:"Client Request ID",experimentId:"Application ID",spanDetail:"Span Detail",inputs:"Inputs",outputs:"Outputs",attributes:"Attributes",rawInputsOutputs:"Raw Inputs/Outputs",rawInputs:"Raw Inputs",rawOutputs:"Raw Outputs",events:"Events",selectSpan:"Please select a Span to view details",noInputs:"No input data",noOutputs:"No output data",noIoData:"No input/output data",noEvents:"No event data",key:"Key",value:"Value",selectColumns:"Select Columns",batchDelete:"Batch Delete",startTime:"Start Time",endTime:"End Time",to:"to",confirmDelete:"Confirm Delete",confirmDeleteButton:"Confirm Delete",deleteAllWarning:`Warning: You have not set any query conditions. This will delete all trace data!
34
+
35
+ This operation cannot be undone. Are you sure you want to continue?`,deleteConfirmMessage:"Are you sure you want to delete traces matching the following conditions?",searchCondition:"Search Condition",timeRange:"Time Range",before:"before",deleteConfirmFooter:`
36
+ This operation cannot be undone. Are you sure you want to continue?`,deleteSuccess:"Delete successful",deleteFailed:"Delete failed",unknownError:"Unknown error"}},tn={"zh-CN":Ma,"en-US":Na};let Ci=!1;const Aa=y=>{!y||Ci||(y.mergeLocaleMessage?(Object.keys(tn).forEach(f=>{y.mergeLocaleMessage(f,tn[f])}),Ci=!0):y.messages&&(Object.keys(tn).forEach(f=>{y.messages[f]||(y.messages[f]={}),Object.assign(y.messages[f],tn[f])}),Ci=!0))},Ko={store:La,router:Oa,components:{Trace:xi,TraceSpanTree:wi},api:Lr,locales:tn,setI18n(y){Aa(y)},registerLocales:Aa};et.Trace=xi,et.TraceSpanTree=wi,et.default=Ko,et.enUS=Na,et.traceApi=Lr,et.traceRouter=Oa,et.traceStore=La,et.zhCN=Ma,Object.defineProperties(et,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});