@langsword/trace 0.1.2 → 0.1.4

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.
package/dist/trace.umd.js CHANGED
@@ -1,42 +1,42 @@
1
- (function(Ie,it){typeof exports=="object"&&typeof module<"u"?it(exports,require("pinia"),require("axios"),require("vue")):typeof define=="function"&&define.amd?define(["exports","pinia","axios","vue"],it):(Ie=typeof globalThis<"u"?globalThis:Ie||self,it(Ie.LangswordTrace={},Ie.Pinia,Ie.axios,Ie.Vue))})(this,function(Ie,it,Yt,Kf){"use strict";var Xm=Object.defineProperty;var Uf=Ie=>{throw TypeError(Ie)};var Ym=(Ie,it,Yt)=>it in Ie?Xm(Ie,it,{enumerable:!0,configurable:!0,writable:!0,value:Yt}):Ie[it]=Yt;var Je=(Ie,it,Yt)=>Ym(Ie,typeof it!="symbol"?it+"":it,Yt),Vm=(Ie,it,Yt)=>it.has(Ie)||Uf("Cannot "+Yt);var qf=(Ie,it,Yt)=>it.has(Ie)?Uf("Cannot add the same private member more than once"):it instanceof WeakSet?it.add(Ie):it.set(Ie,Yt);var Ra=(Ie,it,Yt)=>(Vm(Ie,it,"access private method"),Yt);var Qn,so,Gf;var oo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Fa={exports:{}},lo;function Wt(){return lo||(lo=1,function(u,n){(function(a,o){u.exports=o()})(oo,function(){var a=navigator.userAgent,o=navigator.platform,f=/gecko\/\d/i.test(a),d=/MSIE \d/.test(a),p=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(a),y=/Edge\/(\d+)/.exec(a),m=d||p||y,x=m&&(d?document.documentMode||6:+(y||p)[1]),S=!y&&/WebKit\//.test(a),A=S&&/Qt\/\d+\.\d+/.test(a),E=!y&&/Chrome\/(\d+)/.exec(a),W=E&&+E[1],B=/Opera\//.test(a),q=/Apple Computer/.test(navigator.vendor),F=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(a),N=/PhantomJS/.test(a),O=q&&(/Mobile\/\w+/.test(a)||navigator.maxTouchPoints>2),$=/Android/.test(a),X=O||$||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(a),ne=O||/Mac/.test(o),ue=/\bCrOS\b/.test(a),se=/win/i.test(o),he=B&&a.match(/Version\/(\d*\.\d*)/);he&&(he=Number(he[1])),he&&he>=15&&(B=!1,S=!0);var Oe=ne&&(A||B&&(he==null||he<12.11)),Re=f||m&&x>=9;function ie(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var ze=function(e,t){var i=e.className,r=ie(t).exec(i);if(r){var s=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(s?r[1]+s:"")}};function H(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function Q(e,t){return H(e).appendChild(t)}function k(e,t,i,r){var s=document.createElement(e);if(i&&(s.className=i),r&&(s.style.cssText=r),typeof t=="string")s.appendChild(document.createTextNode(t));else if(t)for(var l=0;l<t.length;++l)s.appendChild(t[l]);return s}function J(e,t,i,r){var s=k(e,t,i,r);return s.setAttribute("role","presentation"),s}var G;document.createRange?G=function(e,t,i,r){var s=document.createRange();return s.setEnd(r||e,i),s.setStart(e,t),s}:G=function(e,t,i){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch{return r}return r.collapse(!0),r.moveEnd("character",i),r.moveStart("character",t),r};function D(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 R(e){var t=e.ownerDocument||e,i;try{i=e.activeElement}catch{i=t.body||null}for(;i&&i.shadowRoot&&i.shadowRoot.activeElement;)i=i.shadowRoot.activeElement;return i}function K(e,t){var i=e.className;ie(t).test(i)||(e.className+=(i?" ":"")+t)}function de(e,t){for(var i=e.split(" "),r=0;r<i.length;r++)i[r]&&!ie(i[r]).test(t)&&(t+=" "+i[r]);return t}var L=function(e){e.select()};O?L=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:m&&(L=function(e){try{e.select()}catch{}});function w(e){return e.display.wrapper.ownerDocument}function oe(e){return Te(e.display.wrapper)}function Te(e){return e.getRootNode?e.getRootNode():e.ownerDocument}function Z(e){return w(e).defaultView}function ce(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function ke(e,t,i){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(i!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function _e(e,t,i,r,s){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var l=r||0,c=s||0;;){var h=e.indexOf(" ",l);if(h<0||h>=t)return c+(t-l);c+=h-l,c+=i-c%i,l=h+1}}var ft=function(){this.id=null,this.f=null,this.time=0,this.handler=ce(this.onTimeout,this)};ft.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ft.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=i)};function we(e,t){for(var i=0;i<e.length;++i)if(e[i]==t)return i;return-1}var Me=50,Ke={toString:function(){return"CodeMirror.Pass"}},ct={scroll:!1},Pt={origin:"*mouse"},ht={origin:"+move"};function dt(e,t,i){for(var r=0,s=0;;){var l=e.indexOf(" ",r);l==-1&&(l=e.length);var c=l-r;if(l==e.length||s+c>=t)return r+Math.min(c,t-s);if(s+=l-r,s+=i-s%i,r=l+1,s>=t)return r}}var gt=[""];function qt(e){for(;gt.length<=e;)gt.push(be(gt)+" ");return gt[e]}function be(e){return e[e.length-1]}function kt(e,t){for(var i=[],r=0;r<e.length;r++)i[r]=t(e[r],r);return i}function Gt(e,t,i){for(var r=0,s=i(t);r<e.length&&i(e[r])<=s;)r++;e.splice(r,0,t)}function In(){}function Zn(e,t){var i;return Object.create?i=Object.create(e):(In.prototype=e,i=new In),t&&ke(t,i),i}var wr=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ye(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||wr.test(e))}function xe(e,t){return t?t.source.indexOf("\\w")>-1&&ye(e)?!0:t.test(e):ye(e)}function pe(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Fe=/[\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&&Fe.test(e)}function zt(e,t,i){for(;(i<0?t>0:t<e.length)&&De(e.charAt(t));)t+=i;return t}function Qt(e,t,i){for(var r=t>i?-1:1;;){if(t==i)return t;var s=(t+i)/2,l=r<0?Math.ceil(s):Math.floor(s);if(l==t)return e(l)?t:i;e(l)?i=l:t=l+r}}function On(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var s=!1,l=0;l<e.length;++l){var c=e[l];(c.from<i&&c.to>t||t==i&&c.to==t)&&(r(Math.max(c.from,t),Math.min(c.to,i),c.level==1?"rtl":"ltr",l),s=!0)}s||r(t,i,"ltr")}var er=null;function Nn(e,t,i){var r;er=null;for(var s=0;s<e.length;++s){var l=e[s];if(l.from<t&&l.to>t)return s;l.to==t&&(l.from!=l.to&&i=="before"?r=s:er=s),l.from==t&&(l.from!=l.to&&i!="before"?r=s:er=s)}return r??er}var fs=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(v){return v<=247?e.charAt(v):1424<=v&&v<=1524?"R":1536<=v&&v<=1785?t.charAt(v-1536):1774<=v&&v<=2220?"r":8192<=v&&v<=8203?"w":v==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,s=/[stwN]/,l=/[LRr]/,c=/[Lb1n]/,h=/[1n]/;function g(v,C,_){this.level=v,this.from=C,this.to=_}return function(v,C){var _=C=="ltr"?"L":"R";if(v.length==0||C=="ltr"&&!r.test(v))return!1;for(var M=v.length,I=[],z=0;z<M;++z)I.push(i(v.charCodeAt(z)));for(var U=0,V=_;U<M;++U){var ee=I[U];ee=="m"?I[U]=V:V=ee}for(var ae=0,te=_;ae<M;++ae){var le=I[ae];le=="1"&&te=="r"?I[ae]="n":l.test(le)&&(te=le,le=="r"&&(I[ae]="R"))}for(var ve=1,ge=I[0];ve<M-1;++ve){var Ae=I[ve];Ae=="+"&&ge=="1"&&I[ve+1]=="1"?I[ve]="1":Ae==","&&ge==I[ve+1]&&(ge=="1"||ge=="n")&&(I[ve]=ge),ge=Ae}for(var Ue=0;Ue<M;++Ue){var xt=I[Ue];if(xt==",")I[Ue]="N";else if(xt=="%"){var Qe=void 0;for(Qe=Ue+1;Qe<M&&I[Qe]=="%";++Qe);for(var Ht=Ue&&I[Ue-1]=="!"||Qe<M&&I[Qe]=="1"?"1":"N",Mt=Ue;Mt<Qe;++Mt)I[Mt]=Ht;Ue=Qe-1}}for(var lt=0,Rt=_;lt<M;++lt){var St=I[lt];Rt=="L"&&St=="1"?I[lt]="L":l.test(St)&&(Rt=St)}for(var pt=0;pt<M;++pt)if(s.test(I[pt])){var ut=void 0;for(ut=pt+1;ut<M&&s.test(I[ut]);++ut);for(var rt=(pt?I[pt-1]:_)=="L",Ft=(ut<M?I[ut]:_)=="L",Kr=rt==Ft?rt?"L":"R":_,Gn=pt;Gn<ut;++Gn)I[Gn]=Kr;pt=ut-1}for(var Lt=[],bn,wt=0;wt<M;)if(c.test(I[wt])){var io=wt;for(++wt;wt<M&&c.test(I[wt]);++wt);Lt.push(new g(0,io,wt))}else{var Dn=wt,fr=Lt.length,cr=C=="rtl"?1:0;for(++wt;wt<M&&I[wt]!="L";++wt);for(var Dt=Dn;Dt<wt;)if(h.test(I[Dt])){Dn<Dt&&(Lt.splice(fr,0,new g(1,Dn,Dt)),fr+=cr);var Xr=Dt;for(++Dt;Dt<wt&&h.test(I[Dt]);++Dt);Lt.splice(fr,0,new g(2,Xr,Dt)),fr+=cr,Dn=Dt}else++Dt;Dn<wt&&Lt.splice(fr,0,new g(1,Dn,wt))}return C=="ltr"&&(Lt[0].level==1&&(bn=v.match(/^\s+/))&&(Lt[0].from=bn[0].length,Lt.unshift(new g(0,0,bn[0].length))),be(Lt).level==1&&(bn=v.match(/\s+$/))&&(be(Lt).to-=bn[0].length,Lt.push(new g(0,M-bn[0].length,M)))),C=="rtl"?Lt.reverse():Lt}}();function Pe(e,t){var i=e.order;return i==null&&(i=e.order=fs(e.text,t)),i}var na=[],me=function(e,t,i){if(e.addEventListener)e.addEventListener(t,i,!1);else if(e.attachEvent)e.attachEvent("on"+t,i);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||na).concat(i)}};function kn(e,t){return e._handlers&&e._handlers[t]||na}function Ct(e,t,i){if(e.removeEventListener)e.removeEventListener(t,i,!1);else if(e.detachEvent)e.detachEvent("on"+t,i);else{var r=e._handlers,s=r&&r[t];if(s){var l=we(s,i);l>-1&&(r[t]=s.slice(0,l).concat(s.slice(l+1)))}}}function et(e,t){var i=kn(e,t);if(i.length)for(var r=Array.prototype.slice.call(arguments,2),s=0;s<i.length;++s)i[s].apply(null,r)}function tt(e,t,i){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),et(e,i||t.type,e,t),At(t)||t.codemirrorIgnore}function Zt(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var i=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)we(i,t[r])==-1&&i.push(t[r])}function $t(e,t){return kn(e,t).length>0}function rn(e){e.prototype.on=function(t,i){me(this,t,i)},e.prototype.off=function(t,i){Ct(this,t,i)}}function Tt(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function kr(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function At(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function Mn(e){Tt(e),kr(e)}function li(e){return e.target||e.srcElement}function an(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),ne&&e.ctrlKey&&t==1&&(t=3),t}var cs=function(){if(m&&x<9)return!1;var e=k("div");return"draggable"in e||"dragDrop"in e}(),Sr;function ra(e){if(Sr==null){var t=k("span","​");Q(e,k("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Sr=t.offsetWidth<=1&&t.offsetHeight>2&&!(m&&x<8))}var i=Sr?k("span","​"):k("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var ui;function Rn(e){if(ui!=null)return ui;var t=Q(e,document.createTextNode("AخA")),i=G(t,0,1).getBoundingClientRect(),r=G(t,1,2).getBoundingClientRect();return H(e),!i||i.left==i.right?!1:ui=r.right-i.right<3}var en=`
1
+ (function(Ie,it){typeof exports=="object"&&typeof module<"u"?it(exports,require("pinia"),require("axios"),require("vue")):typeof define=="function"&&define.amd?define(["exports","pinia","axios","vue"],it):(Ie=typeof globalThis<"u"?globalThis:Ie||self,it(Ie.LangswordTrace={},Ie.Pinia,Ie.axios,Ie.Vue))})(this,function(Ie,it,Yt,Jf){"use strict";var Vm=Object.defineProperty;var Xf=Ie=>{throw TypeError(Ie)};var Jm=(Ie,it,Yt)=>it in Ie?Vm(Ie,it,{enumerable:!0,configurable:!0,writable:!0,value:Yt}):Ie[it]=Yt;var Je=(Ie,it,Yt)=>Jm(Ie,typeof it!="symbol"?it+"":it,Yt),Qm=(Ie,it,Yt)=>it.has(Ie)||Xf("Cannot "+Yt);var Yf=(Ie,it,Yt)=>it.has(Ie)?Xf("Cannot add the same private member more than once"):it instanceof WeakSet?it.add(Ie):it.set(Ie,Yt);var Ra=(Ie,it,Yt)=>(Qm(Ie,it,"access private method"),Yt);var Qn,so,Vf;var oo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Fa={exports:{}},lo;function Wt(){return lo||(lo=1,function(u,n){(function(a,o){u.exports=o()})(oo,function(){var a=navigator.userAgent,o=navigator.platform,f=/gecko\/\d/i.test(a),d=/MSIE \d/.test(a),p=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(a),y=/Edge\/(\d+)/.exec(a),m=d||p||y,x=m&&(d?document.documentMode||6:+(y||p)[1]),S=!y&&/WebKit\//.test(a),A=S&&/Qt\/\d+\.\d+/.test(a),E=!y&&/Chrome\/(\d+)/.exec(a),H=E&&+E[1],B=/Opera\//.test(a),U=/Apple Computer/.test(navigator.vendor),F=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(a),N=/PhantomJS/.test(a),O=U&&(/Mobile\/\w+/.test(a)||navigator.maxTouchPoints>2),$=/Android/.test(a),X=O||$||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(a),ne=O||/Mac/.test(o),ue=/\bCrOS\b/.test(a),se=/win/i.test(o),he=B&&a.match(/Version\/(\d*\.\d*)/);he&&(he=Number(he[1])),he&&he>=15&&(B=!1,S=!0);var Oe=ne&&(A||B&&(he==null||he<12.11)),Re=f||m&&x>=9;function ie(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var ze=function(e,t){var i=e.className,r=ie(t).exec(i);if(r){var s=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(s?r[1]+s:"")}};function W(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function Q(e,t){return W(e).appendChild(t)}function k(e,t,i,r){var s=document.createElement(e);if(i&&(s.className=i),r&&(s.style.cssText=r),typeof t=="string")s.appendChild(document.createTextNode(t));else if(t)for(var l=0;l<t.length;++l)s.appendChild(t[l]);return s}function J(e,t,i,r){var s=k(e,t,i,r);return s.setAttribute("role","presentation"),s}var G;document.createRange?G=function(e,t,i,r){var s=document.createRange();return s.setEnd(r||e,i),s.setStart(e,t),s}:G=function(e,t,i){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch{return r}return r.collapse(!0),r.moveEnd("character",i),r.moveStart("character",t),r};function D(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 R(e){var t=e.ownerDocument||e,i;try{i=e.activeElement}catch{i=t.body||null}for(;i&&i.shadowRoot&&i.shadowRoot.activeElement;)i=i.shadowRoot.activeElement;return i}function K(e,t){var i=e.className;ie(t).test(i)||(e.className+=(i?" ":"")+t)}function de(e,t){for(var i=e.split(" "),r=0;r<i.length;r++)i[r]&&!ie(i[r]).test(t)&&(t+=" "+i[r]);return t}var L=function(e){e.select()};O?L=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:m&&(L=function(e){try{e.select()}catch{}});function w(e){return e.display.wrapper.ownerDocument}function oe(e){return Te(e.display.wrapper)}function Te(e){return e.getRootNode?e.getRootNode():e.ownerDocument}function Z(e){return w(e).defaultView}function ce(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function ke(e,t,i){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(i!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function _e(e,t,i,r,s){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var l=r||0,c=s||0;;){var h=e.indexOf(" ",l);if(h<0||h>=t)return c+(t-l);c+=h-l,c+=i-c%i,l=h+1}}var ft=function(){this.id=null,this.f=null,this.time=0,this.handler=ce(this.onTimeout,this)};ft.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ft.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=i)};function we(e,t){for(var i=0;i<e.length;++i)if(e[i]==t)return i;return-1}var Me=50,Ke={toString:function(){return"CodeMirror.Pass"}},ct={scroll:!1},Pt={origin:"*mouse"},ht={origin:"+move"};function dt(e,t,i){for(var r=0,s=0;;){var l=e.indexOf(" ",r);l==-1&&(l=e.length);var c=l-r;if(l==e.length||s+c>=t)return r+Math.min(c,t-s);if(s+=l-r,s+=i-s%i,r=l+1,s>=t)return r}}var gt=[""];function Ut(e){for(;gt.length<=e;)gt.push(be(gt)+" ");return gt[e]}function be(e){return e[e.length-1]}function kt(e,t){for(var i=[],r=0;r<e.length;r++)i[r]=t(e[r],r);return i}function Gt(e,t,i){for(var r=0,s=i(t);r<e.length&&i(e[r])<=s;)r++;e.splice(r,0,t)}function In(){}function Zn(e,t){var i;return Object.create?i=Object.create(e):(In.prototype=e,i=new In),t&&ke(t,i),i}var wr=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ye(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||wr.test(e))}function xe(e,t){return t?t.source.indexOf("\\w")>-1&&ye(e)?!0:t.test(e):ye(e)}function pe(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Fe=/[\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&&Fe.test(e)}function zt(e,t,i){for(;(i<0?t>0:t<e.length)&&De(e.charAt(t));)t+=i;return t}function Qt(e,t,i){for(var r=t>i?-1:1;;){if(t==i)return t;var s=(t+i)/2,l=r<0?Math.ceil(s):Math.floor(s);if(l==t)return e(l)?t:i;e(l)?i=l:t=l+r}}function On(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var s=!1,l=0;l<e.length;++l){var c=e[l];(c.from<i&&c.to>t||t==i&&c.to==t)&&(r(Math.max(c.from,t),Math.min(c.to,i),c.level==1?"rtl":"ltr",l),s=!0)}s||r(t,i,"ltr")}var er=null;function Nn(e,t,i){var r;er=null;for(var s=0;s<e.length;++s){var l=e[s];if(l.from<t&&l.to>t)return s;l.to==t&&(l.from!=l.to&&i=="before"?r=s:er=s),l.from==t&&(l.from!=l.to&&i!="before"?r=s:er=s)}return r??er}var fs=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(v){return v<=247?e.charAt(v):1424<=v&&v<=1524?"R":1536<=v&&v<=1785?t.charAt(v-1536):1774<=v&&v<=2220?"r":8192<=v&&v<=8203?"w":v==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,s=/[stwN]/,l=/[LRr]/,c=/[Lb1n]/,h=/[1n]/;function g(v,C,_){this.level=v,this.from=C,this.to=_}return function(v,C){var _=C=="ltr"?"L":"R";if(v.length==0||C=="ltr"&&!r.test(v))return!1;for(var M=v.length,I=[],z=0;z<M;++z)I.push(i(v.charCodeAt(z)));for(var q=0,V=_;q<M;++q){var ee=I[q];ee=="m"?I[q]=V:V=ee}for(var ae=0,te=_;ae<M;++ae){var le=I[ae];le=="1"&&te=="r"?I[ae]="n":l.test(le)&&(te=le,le=="r"&&(I[ae]="R"))}for(var ve=1,ge=I[0];ve<M-1;++ve){var Ae=I[ve];Ae=="+"&&ge=="1"&&I[ve+1]=="1"?I[ve]="1":Ae==","&&ge==I[ve+1]&&(ge=="1"||ge=="n")&&(I[ve]=ge),ge=Ae}for(var qe=0;qe<M;++qe){var xt=I[qe];if(xt==",")I[qe]="N";else if(xt=="%"){var Qe=void 0;for(Qe=qe+1;Qe<M&&I[Qe]=="%";++Qe);for(var Ht=qe&&I[qe-1]=="!"||Qe<M&&I[Qe]=="1"?"1":"N",Mt=qe;Mt<Qe;++Mt)I[Mt]=Ht;qe=Qe-1}}for(var lt=0,Rt=_;lt<M;++lt){var St=I[lt];Rt=="L"&&St=="1"?I[lt]="L":l.test(St)&&(Rt=St)}for(var pt=0;pt<M;++pt)if(s.test(I[pt])){var ut=void 0;for(ut=pt+1;ut<M&&s.test(I[ut]);++ut);for(var rt=(pt?I[pt-1]:_)=="L",Ft=(ut<M?I[ut]:_)=="L",Kr=rt==Ft?rt?"L":"R":_,Gn=pt;Gn<ut;++Gn)I[Gn]=Kr;pt=ut-1}for(var Lt=[],xn,wt=0;wt<M;)if(c.test(I[wt])){var io=wt;for(++wt;wt<M&&c.test(I[wt]);++wt);Lt.push(new g(0,io,wt))}else{var Dn=wt,fr=Lt.length,cr=C=="rtl"?1:0;for(++wt;wt<M&&I[wt]!="L";++wt);for(var Dt=Dn;Dt<wt;)if(h.test(I[Dt])){Dn<Dt&&(Lt.splice(fr,0,new g(1,Dn,Dt)),fr+=cr);var Xr=Dt;for(++Dt;Dt<wt&&h.test(I[Dt]);++Dt);Lt.splice(fr,0,new g(2,Xr,Dt)),fr+=cr,Dn=Dt}else++Dt;Dn<wt&&Lt.splice(fr,0,new g(1,Dn,wt))}return C=="ltr"&&(Lt[0].level==1&&(xn=v.match(/^\s+/))&&(Lt[0].from=xn[0].length,Lt.unshift(new g(0,0,xn[0].length))),be(Lt).level==1&&(xn=v.match(/\s+$/))&&(be(Lt).to-=xn[0].length,Lt.push(new g(0,M-xn[0].length,M)))),C=="rtl"?Lt.reverse():Lt}}();function Pe(e,t){var i=e.order;return i==null&&(i=e.order=fs(e.text,t)),i}var na=[],me=function(e,t,i){if(e.addEventListener)e.addEventListener(t,i,!1);else if(e.attachEvent)e.attachEvent("on"+t,i);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||na).concat(i)}};function kn(e,t){return e._handlers&&e._handlers[t]||na}function Ct(e,t,i){if(e.removeEventListener)e.removeEventListener(t,i,!1);else if(e.detachEvent)e.detachEvent("on"+t,i);else{var r=e._handlers,s=r&&r[t];if(s){var l=we(s,i);l>-1&&(r[t]=s.slice(0,l).concat(s.slice(l+1)))}}}function et(e,t){var i=kn(e,t);if(i.length)for(var r=Array.prototype.slice.call(arguments,2),s=0;s<i.length;++s)i[s].apply(null,r)}function tt(e,t,i){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),et(e,i||t.type,e,t),At(t)||t.codemirrorIgnore}function Zt(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var i=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)we(i,t[r])==-1&&i.push(t[r])}function $t(e,t){return kn(e,t).length>0}function an(e){e.prototype.on=function(t,i){me(this,t,i)},e.prototype.off=function(t,i){Ct(this,t,i)}}function Tt(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function kr(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function At(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function Mn(e){Tt(e),kr(e)}function li(e){return e.target||e.srcElement}function sn(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),ne&&e.ctrlKey&&t==1&&(t=3),t}var cs=function(){if(m&&x<9)return!1;var e=k("div");return"draggable"in e||"dragDrop"in e}(),Sr;function ra(e){if(Sr==null){var t=k("span","​");Q(e,k("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Sr=t.offsetWidth<=1&&t.offsetHeight>2&&!(m&&x<8))}var i=Sr?k("span","​"):k("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var ui;function Rn(e){if(ui!=null)return ui;var t=Q(e,document.createTextNode("AخA")),i=G(t,0,1).getBoundingClientRect(),r=G(t,1,2).getBoundingClientRect();return W(e),!i||i.left==i.right?!1:ui=r.right-i.right<3}var en=`
2
2
 
3
3
  b`.split(/\n/).length!=3?function(e){for(var t=0,i=[],r=e.length;t<=r;){var s=e.indexOf(`
4
- `,t);s==-1&&(s=e.length);var l=e.slice(t,e.charAt(s-1)=="\r"?s-1:s),c=l.indexOf("\r");c!=-1?(i.push(l.slice(0,c)),t+=c+1):(i.push(l),t=s+1)}return i}:function(e){return e.split(/\r\n?|\n/)},Fn=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},ia=function(){var e=k("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),sn=null;function hs(e){if(sn!=null)return sn;var t=Q(e,k("span","x")),i=t.getBoundingClientRect(),r=G(t,0,1).getBoundingClientRect();return sn=Math.abs(i.left-r.left)>1}var Cr={},on={};function ln(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Cr[e]=t}function tr(e,t){on[e]=t}function Tr(e){if(typeof e=="string"&&on.hasOwnProperty(e))e=on[e];else if(e&&typeof e.name=="string"&&on.hasOwnProperty(e.name)){var t=on[e.name];typeof t=="string"&&(t={name:t}),e=Zn(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Tr("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Tr("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function _r(e,t){t=Tr(t);var i=Cr[t.name];if(!i)return _r(e,"text/plain");var r=i(e,t);if(Pn.hasOwnProperty(t.name)){var s=Pn[t.name];for(var l in s)s.hasOwnProperty(l)&&(r.hasOwnProperty(l)&&(r["_"+l]=r[l]),r[l]=s[l])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var c in t.modeProps)r[c]=t.modeProps[c];return r}var Pn={};function Lr(e,t){var i=Pn.hasOwnProperty(e)?Pn[e]:Pn[e]={};ke(t,i)}function gn(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var r in t){var s=t[r];s instanceof Array&&(s=s.concat([])),i[r]=s}return i}function fi(e,t){for(var i;e.innerMode&&(i=e.innerMode(t),!(!i||i.mode==e));)t=i.state,e=i.mode;return i||{mode:e,state:t}}function Er(e,t,i){return e.startState?e.startState(t,i):!0}var nt=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};nt.prototype.eol=function(){return this.pos>=this.string.length},nt.prototype.sol=function(){return this.pos==this.lineStart},nt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},nt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},nt.prototype.eat=function(e){var t=this.string.charAt(this.pos),i;if(typeof e=="string"?i=t==e:i=t&&(e.test?e.test(t):e(t)),i)return++this.pos,t},nt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},nt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},nt.prototype.skipToEnd=function(){this.pos=this.string.length},nt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},nt.prototype.backUp=function(e){this.pos-=e},nt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=_e(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?_e(this.string,this.lineStart,this.tabSize):0)},nt.prototype.indentation=function(){return _e(this.string,null,this.tabSize)-(this.lineStart?_e(this.string,this.lineStart,this.tabSize):0)},nt.prototype.match=function(e,t,i){if(typeof e=="string"){var r=function(c){return i?c.toLowerCase():c},s=this.string.substr(this.pos,e.length);if(r(s)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var l=this.string.slice(this.pos).match(e);return l&&l.index>0?null:(l&&t!==!1&&(this.pos+=l[0].length),l)}},nt.prototype.current=function(){return this.string.slice(this.start,this.pos)},nt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},nt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},nt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function fe(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 i=e;!i.lines;)for(var r=0;;++r){var s=i.children[r],l=s.chunkSize();if(t<l){i=s;break}t-=l}return i.lines[t]}function Sn(e,t,i){var r=[],s=t.line;return e.iter(t.line,i.line+1,function(l){var c=l.text;s==i.line&&(c=c.slice(0,i.ch)),s==t.line&&(c=c.slice(t.ch)),r.push(c),++s}),r}function ci(e,t,i){var r=[];return e.iter(t,i,function(s){r.push(s.text)}),r}function Kt(e,t){var i=t-e.height;if(i)for(var r=e;r;r=r.parent)r.height+=i}function b(e){if(e.parent==null)return null;for(var t=e.parent,i=we(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var s=0;r.children[s]!=t;++s)i+=r.children[s].chunkSize();return i+t.first}function T(e,t){var i=e.first;e:do{for(var r=0;r<e.children.length;++r){var s=e.children[r],l=s.height;if(t<l){e=s;continue e}t-=l,i+=s.chunkSize()}return i}while(!e.lines);for(var c=0;c<e.lines.length;++c){var h=e.lines[c],g=h.height;if(t<g)break;t-=g}return i+c}function j(e,t){return t>=e.first&&t<e.first+e.size}function Y(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function P(e,t,i){if(i===void 0&&(i=null),!(this instanceof P))return new P(e,t,i);this.line=e,this.ch=t,this.sticky=i}function re(e,t){return e.line-t.line||e.ch-t.ch}function $e(e,t){return e.sticky==t.sticky&&re(e,t)==0}function mt(e){return P(e.line,e.ch)}function It(e,t){return re(e,t)<0?t:e}function Dr(e,t){return re(e,t)<0?e:t}function Ul(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function Se(e,t){if(t.line<e.first)return P(e.first,0);var i=e.first+e.size-1;return t.line>i?P(i,fe(e,i).text.length):Yp(t,fe(e,t.line).text.length)}function Yp(e,t){var i=e.ch;return i==null||i>t?P(e.line,t):i<0?P(e.line,0):e}function ql(e,t){for(var i=[],r=0;r<t.length;r++)i[r]=Se(e,t[r]);return i}var aa=function(e,t){this.state=e,this.lookAhead=t},mn=function(e,t,i,r){this.state=t,this.doc=e,this.line=i,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};mn.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},mn.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}},mn.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},mn.fromSaved=function(e,t,i){return t instanceof aa?new mn(e,gn(e.mode,t.state),i,t.lookAhead):new mn(e,gn(e.mode,t),i)},mn.prototype.save=function(e){var t=e!==!1?gn(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new aa(t,this.maxLookAhead):t};function Gl(e,t,i,r){var s=[e.state.modeGen],l={};Ql(e,t.text,e.doc.mode,i,function(v,C){return s.push(v,C)},l,r);for(var c=i.state,h=function(v){i.baseTokens=s;var C=e.state.overlays[v],_=1,M=0;i.state=!0,Ql(e,t.text,C.mode,i,function(I,z){for(var U=_;M<I;){var V=s[_];V>I&&s.splice(_,1,I,s[_+1],V),_+=2,M=Math.min(I,V)}if(z)if(C.opaque)s.splice(U,_-U,I,"overlay "+z),_=U+2;else for(;U<_;U+=2){var ee=s[U+1];s[U+1]=(ee?ee+" ":"")+"overlay "+z}},l),i.state=c,i.baseTokens=null,i.baseTokenPos=1},g=0;g<e.state.overlays.length;++g)h(g);return{styles:s,classes:l.bgClass||l.textClass?l:null}}function Kl(e,t,i){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=hi(e,b(t)),s=t.text.length>e.options.maxHighlightLength&&gn(e.doc.mode,r.state),l=Gl(e,t,r);s&&(r.state=s),t.stateAfter=r.save(!s),t.styles=l.styles,l.classes?t.styleClasses=l.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function hi(e,t,i){var r=e.doc,s=e.display;if(!r.mode.startState)return new mn(r,!0,t);var l=Vp(e,t,i),c=l>r.first&&fe(r,l-1).stateAfter,h=c?mn.fromSaved(r,c,l):new mn(r,Er(r.mode),l);return r.iter(l,t,function(g){ds(e,g.text,h);var v=h.line;g.stateAfter=v==t-1||v%5==0||v>=s.viewFrom&&v<s.viewTo?h.save():null,h.nextLine()}),i&&(r.modeFrontier=h.line),h}function ds(e,t,i,r){var s=e.doc.mode,l=new nt(t,e.options.tabSize,i);for(l.start=l.pos=r||0,t==""&&Xl(s,i.state);!l.eol();)ps(s,l,i.state),l.start=l.pos}function Xl(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var i=fi(e,t);if(i.mode.blankLine)return i.mode.blankLine(i.state)}}function ps(e,t,i,r){for(var s=0;s<10;s++){r&&(r[0]=fi(e,i).mode);var l=e.token(t,i);if(t.pos>t.start)return l}throw new Error("Mode "+e.name+" failed to advance stream.")}var Yl=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function Vl(e,t,i,r){var s=e.doc,l=s.mode,c;t=Se(s,t);var h=fe(s,t.line),g=hi(e,t.line,i),v=new nt(h.text,e.options.tabSize,g),C;for(r&&(C=[]);(r||v.pos<t.ch)&&!v.eol();)v.start=v.pos,c=ps(l,v,g.state),r&&C.push(new Yl(v,c,gn(s.mode,g.state)));return r?C:new Yl(v,c,g.state)}function Jl(e,t){if(e)for(;;){var i=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!i)break;e=e.slice(0,i.index)+e.slice(i.index+i[0].length);var r=i[1]?"bgClass":"textClass";t[r]==null?t[r]=i[2]:new RegExp("(?:^|\\s)"+i[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+i[2])}return e}function Ql(e,t,i,r,s,l,c){var h=i.flattenSpans;h==null&&(h=e.options.flattenSpans);var g=0,v=null,C=new nt(t,e.options.tabSize,r),_,M=e.options.addModeClass&&[null];for(t==""&&Jl(Xl(i,r.state),l);!C.eol();){if(C.pos>e.options.maxHighlightLength?(h=!1,c&&ds(e,t,r,C.pos),C.pos=t.length,_=null):_=Jl(ps(i,C,r.state,M),l),M){var I=M[0].name;I&&(_="m-"+(_?I+" "+_:I))}if(!h||v!=_){for(;g<C.start;)g=Math.min(C.start,g+5e3),s(g,v);v=_}C.start=C.pos}for(;g<C.pos;){var z=Math.min(C.pos,g+5e3);s(z,v),g=z}}function Vp(e,t,i){for(var r,s,l=e.doc,c=i?-1:t-(e.doc.mode.innerMode?1e3:100),h=t;h>c;--h){if(h<=l.first)return l.first;var g=fe(l,h-1),v=g.stateAfter;if(v&&(!i||h+(v instanceof aa?v.lookAhead:0)<=l.modeFrontier))return h;var C=_e(g.text,null,e.options.tabSize);(s==null||r>C)&&(s=h-1,r=C)}return s}function Jp(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var i=e.first,r=t-1;r>i;r--){var s=fe(e,r).stateAfter;if(s&&(!(s instanceof aa)||r+s.lookAhead<t)){i=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,i)}}var Zl=!1,Cn=!1;function Qp(){Zl=!0}function Zp(){Cn=!0}function sa(e,t,i){this.marker=e,this.from=t,this.to=i}function di(e,t){if(e)for(var i=0;i<e.length;++i){var r=e[i];if(r.marker==t)return r}}function eg(e,t){for(var i,r=0;r<e.length;++r)e[r]!=t&&(i||(i=[])).push(e[r]);return i}function tg(e,t,i){var r=i&&window.WeakSet&&(i.markedSpans||(i.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 ng(e,t,i){var r;if(e)for(var s=0;s<e.length;++s){var l=e[s],c=l.marker,h=l.from==null||(c.inclusiveLeft?l.from<=t:l.from<t);if(h||l.from==t&&c.type=="bookmark"&&(!i||!l.marker.insertLeft)){var g=l.to==null||(c.inclusiveRight?l.to>=t:l.to>t);(r||(r=[])).push(new sa(c,l.from,g?null:l.to))}}return r}function rg(e,t,i){var r;if(e)for(var s=0;s<e.length;++s){var l=e[s],c=l.marker,h=l.to==null||(c.inclusiveRight?l.to>=t:l.to>t);if(h||l.from==t&&c.type=="bookmark"&&(!i||l.marker.insertLeft)){var g=l.from==null||(c.inclusiveLeft?l.from<=t:l.from<t);(r||(r=[])).push(new sa(c,g?null:l.from-t,l.to==null?null:l.to-t))}}return r}function gs(e,t){if(t.full)return null;var i=j(e,t.from.line)&&fe(e,t.from.line).markedSpans,r=j(e,t.to.line)&&fe(e,t.to.line).markedSpans;if(!i&&!r)return null;var s=t.from.ch,l=t.to.ch,c=re(t.from,t.to)==0,h=ng(i,s,c),g=rg(r,l,c),v=t.text.length==1,C=be(t.text).length+(v?s:0);if(h)for(var _=0;_<h.length;++_){var M=h[_];if(M.to==null){var I=di(g,M.marker);I?v&&(M.to=I.to==null?null:I.to+C):M.to=s}}if(g)for(var z=0;z<g.length;++z){var U=g[z];if(U.to!=null&&(U.to+=C),U.from==null){var V=di(h,U.marker);V||(U.from=C,v&&(h||(h=[])).push(U))}else U.from+=C,v&&(h||(h=[])).push(U)}h&&(h=eu(h)),g&&g!=h&&(g=eu(g));var ee=[h];if(!v){var ae=t.text.length-2,te;if(ae>0&&h)for(var le=0;le<h.length;++le)h[le].to==null&&(te||(te=[])).push(new sa(h[le].marker,null,null));for(var ve=0;ve<ae;++ve)ee.push(te);ee.push(g)}return ee}function eu(e){for(var t=0;t<e.length;++t){var i=e[t];i.from!=null&&i.from==i.to&&i.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function ig(e,t,i){var r=null;if(e.iter(t.line,i.line+1,function(I){if(I.markedSpans)for(var z=0;z<I.markedSpans.length;++z){var U=I.markedSpans[z].marker;U.readOnly&&(!r||we(r,U)==-1)&&(r||(r=[])).push(U)}}),!r)return null;for(var s=[{from:t,to:i}],l=0;l<r.length;++l)for(var c=r[l],h=c.find(0),g=0;g<s.length;++g){var v=s[g];if(!(re(v.to,h.from)<0||re(v.from,h.to)>0)){var C=[g,1],_=re(v.from,h.from),M=re(v.to,h.to);(_<0||!c.inclusiveLeft&&!_)&&C.push({from:v.from,to:h.from}),(M>0||!c.inclusiveRight&&!M)&&C.push({from:h.to,to:v.to}),s.splice.apply(s,C),g+=C.length-3}}return s}function tu(e){var t=e.markedSpans;if(t){for(var i=0;i<t.length;++i)t[i].marker.detachLine(e);e.markedSpans=null}}function nu(e,t){if(t){for(var i=0;i<t.length;++i)t[i].marker.attachLine(e);e.markedSpans=t}}function oa(e){return e.inclusiveLeft?-1:0}function la(e){return e.inclusiveRight?1:0}function ms(e,t){var i=e.lines.length-t.lines.length;if(i!=0)return i;var r=e.find(),s=t.find(),l=re(r.from,s.from)||oa(e)-oa(t);if(l)return-l;var c=re(r.to,s.to)||la(e)-la(t);return c||t.id-e.id}function ru(e,t){var i=Cn&&e.markedSpans,r;if(i)for(var s=void 0,l=0;l<i.length;++l)s=i[l],s.marker.collapsed&&(t?s.from:s.to)==null&&(!r||ms(r,s.marker)<0)&&(r=s.marker);return r}function iu(e){return ru(e,!0)}function ua(e){return ru(e,!1)}function ag(e,t){var i=Cn&&e.markedSpans,r;if(i)for(var s=0;s<i.length;++s){var l=i[s];l.marker.collapsed&&(l.from==null||l.from<t)&&(l.to==null||l.to>t)&&(!r||ms(r,l.marker)<0)&&(r=l.marker)}return r}function au(e,t,i,r,s){var l=fe(e,t),c=Cn&&l.markedSpans;if(c)for(var h=0;h<c.length;++h){var g=c[h];if(g.marker.collapsed){var v=g.marker.find(0),C=re(v.from,i)||oa(g.marker)-oa(s),_=re(v.to,r)||la(g.marker)-la(s);if(!(C>=0&&_<=0||C<=0&&_>=0)&&(C<=0&&(g.marker.inclusiveRight&&s.inclusiveLeft?re(v.to,i)>=0:re(v.to,i)>0)||C>=0&&(g.marker.inclusiveRight&&s.inclusiveLeft?re(v.from,r)<=0:re(v.from,r)<0)))return!0}}}function un(e){for(var t;t=iu(e);)e=t.find(-1,!0).line;return e}function sg(e){for(var t;t=ua(e);)e=t.find(1,!0).line;return e}function og(e){for(var t,i;t=ua(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function vs(e,t){var i=fe(e,t),r=un(i);return i==r?t:b(r)}function su(e,t){if(t>e.lastLine())return t;var i=fe(e,t),r;if(!zn(e,i))return t;for(;r=ua(i);)i=r.find(1,!0).line;return b(i)+1}function zn(e,t){var i=Cn&&t.markedSpans;if(i){for(var r=void 0,s=0;s<i.length;++s)if(r=i[s],!!r.marker.collapsed){if(r.from==null)return!0;if(!r.marker.widgetNode&&r.from==0&&r.marker.inclusiveLeft&&ys(e,t,r))return!0}}}function ys(e,t,i){if(i.to==null){var r=i.marker.find(1,!0);return ys(e,r.line,di(r.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(var s=void 0,l=0;l<t.markedSpans.length;++l)if(s=t.markedSpans[l],s.marker.collapsed&&!s.marker.widgetNode&&s.from==i.to&&(s.to==null||s.to!=i.from)&&(s.marker.inclusiveLeft||i.marker.inclusiveRight)&&ys(e,t,s))return!0}function Tn(e){e=un(e);for(var t=0,i=e.parent,r=0;r<i.lines.length;++r){var s=i.lines[r];if(s==e)break;t+=s.height}for(var l=i.parent;l;i=l,l=i.parent)for(var c=0;c<l.children.length;++c){var h=l.children[c];if(h==i)break;t+=h.height}return t}function fa(e){if(e.height==0)return 0;for(var t=e.text.length,i,r=e;i=iu(r);){var s=i.find(0,!0);r=s.from.line,t+=s.from.ch-s.to.ch}for(r=e;i=ua(r);){var l=i.find(0,!0);t-=r.text.length-l.from.ch,r=l.to.line,t+=r.text.length-l.to.ch}return t}function bs(e){var t=e.display,i=e.doc;t.maxLine=fe(i,i.first),t.maxLineLength=fa(t.maxLine),t.maxLineChanged=!0,i.iter(function(r){var s=fa(r);s>t.maxLineLength&&(t.maxLineLength=s,t.maxLine=r)})}var Ar=function(e,t,i){this.text=e,nu(this,t),this.height=i?i(this):1};Ar.prototype.lineNo=function(){return b(this)},rn(Ar);function lg(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),tu(e),nu(e,i);var s=r?r(e):1;s!=e.height&&Kt(e,s)}function ug(e){e.parent=null,tu(e)}var fg={},cg={};function ou(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?cg:fg;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function lu(e,t){var i=J("span",null,null,S?"padding-right: .1px":null),r={pre:J("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var s=0;s<=(t.rest?t.rest.length:0);s++){var l=s?t.rest[s-1]:t.line,c=void 0;r.pos=0,r.addToken=dg,Rn(e.display.measure)&&(c=Pe(l,e.doc.direction))&&(r.addToken=gg(r.addToken,c)),r.map=[];var h=t!=e.display.externalMeasured&&b(l);mg(l,r,Kl(e,l,h)),l.styleClasses&&(l.styleClasses.bgClass&&(r.bgClass=de(l.styleClasses.bgClass,r.bgClass||"")),l.styleClasses.textClass&&(r.textClass=de(l.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(ra(e.display.measure))),s==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(S){var g=r.content.lastChild;(/\bcm-tab\b/.test(g.className)||g.querySelector&&g.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return et(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=de(r.pre.className,r.textClass||"")),r}function hg(e){var t=k("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function dg(e,t,i,r,s,l,c){if(t){var h=e.splitSpaces?pg(t,e.trailingSpace):t,g=e.cm.state.specialChars,v=!1,C;if(!g.test(t))e.col+=t.length,C=document.createTextNode(h),e.map.push(e.pos,e.pos+t.length,C),m&&x<9&&(v=!0),e.pos+=t.length;else{C=document.createDocumentFragment();for(var _=0;;){g.lastIndex=_;var M=g.exec(t),I=M?M.index-_:t.length-_;if(I){var z=document.createTextNode(h.slice(_,_+I));m&&x<9?C.appendChild(k("span",[z])):C.appendChild(z),e.map.push(e.pos,e.pos+I,z),e.col+=I,e.pos+=I}if(!M)break;_+=I+1;var U=void 0;if(M[0]==" "){var V=e.cm.options.tabSize,ee=V-e.col%V;U=C.appendChild(k("span",qt(ee),"cm-tab")),U.setAttribute("role","presentation"),U.setAttribute("cm-text"," "),e.col+=ee}else M[0]=="\r"||M[0]==`
5
- `?(U=C.appendChild(k("span",M[0]=="\r"?"␍":"␤","cm-invalidchar")),U.setAttribute("cm-text",M[0]),e.col+=1):(U=e.cm.options.specialCharPlaceholder(M[0]),U.setAttribute("cm-text",M[0]),m&&x<9?C.appendChild(k("span",[U])):C.appendChild(U),e.col+=1);e.map.push(e.pos,e.pos+1,U),e.pos++}}if(e.trailingSpace=h.charCodeAt(t.length-1)==32,i||r||s||v||l||c){var ae=i||"";r&&(ae+=r),s&&(ae+=s);var te=k("span",[C],ae,l);if(c)for(var le in c)c.hasOwnProperty(le)&&le!="style"&&le!="class"&&te.setAttribute(le,c[le]);return e.content.appendChild(te)}e.content.appendChild(C)}}function pg(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",s=0;s<e.length;s++){var l=e.charAt(s);l==" "&&i&&(s==e.length-1||e.charCodeAt(s+1)==32)&&(l=" "),r+=l,i=l==" "}return r}function gg(e,t){return function(i,r,s,l,c,h,g){s=s?s+" cm-force-border":"cm-force-border";for(var v=i.pos,C=v+r.length;;){for(var _=void 0,M=0;M<t.length&&(_=t[M],!(_.to>v&&_.from<=v));M++);if(_.to>=C)return e(i,r,s,l,c,h,g);e(i,r.slice(0,_.to-v),s,l,null,h,g),l=null,r=r.slice(_.to-v),v=_.to}}}function uu(e,t,i,r){var s=!r&&i.widgetNode;s&&e.map.push(e.pos,e.pos+t,s),!r&&e.cm.display.input.needsContentAttribute&&(s||(s=e.content.appendChild(document.createElement("span"))),s.setAttribute("cm-marker",i.id)),s&&(e.cm.display.input.setUneditable(s),e.content.appendChild(s)),e.pos+=t,e.trailingSpace=!1}function mg(e,t,i){var r=e.markedSpans,s=e.text,l=0;if(!r){for(var c=1;c<i.length;c+=2)t.addToken(t,s.slice(l,l=i[c]),ou(i[c+1],t.cm.options));return}for(var h=s.length,g=0,v=1,C="",_,M,I=0,z,U,V,ee,ae;;){if(I==g){z=U=V=M="",ae=null,ee=null,I=1/0;for(var te=[],le=void 0,ve=0;ve<r.length;++ve){var ge=r[ve],Ae=ge.marker;if(Ae.type=="bookmark"&&ge.from==g&&Ae.widgetNode)te.push(Ae);else if(ge.from<=g&&(ge.to==null||ge.to>g||Ae.collapsed&&ge.to==g&&ge.from==g)){if(ge.to!=null&&ge.to!=g&&I>ge.to&&(I=ge.to,U=""),Ae.className&&(z+=" "+Ae.className),Ae.css&&(M=(M?M+";":"")+Ae.css),Ae.startStyle&&ge.from==g&&(V+=" "+Ae.startStyle),Ae.endStyle&&ge.to==I&&(le||(le=[])).push(Ae.endStyle,ge.to),Ae.title&&((ae||(ae={})).title=Ae.title),Ae.attributes)for(var Ue in Ae.attributes)(ae||(ae={}))[Ue]=Ae.attributes[Ue];Ae.collapsed&&(!ee||ms(ee.marker,Ae)<0)&&(ee=ge)}else ge.from>g&&I>ge.from&&(I=ge.from)}if(le)for(var xt=0;xt<le.length;xt+=2)le[xt+1]==I&&(U+=" "+le[xt]);if(!ee||ee.from==g)for(var Qe=0;Qe<te.length;++Qe)uu(t,0,te[Qe]);if(ee&&(ee.from||0)==g){if(uu(t,(ee.to==null?h+1:ee.to)-g,ee.marker,ee.from==null),ee.to==null)return;ee.to==g&&(ee=!1)}}if(g>=h)break;for(var Ht=Math.min(h,I);;){if(C){var Mt=g+C.length;if(!ee){var lt=Mt>Ht?C.slice(0,Ht-g):C;t.addToken(t,lt,_?_+z:z,V,g+lt.length==I?U:"",M,ae)}if(Mt>=Ht){C=C.slice(Ht-g),g=Ht;break}g=Mt,V=""}C=s.slice(l,l=i[v++]),_=ou(i[v++],t.cm.options)}}}function fu(e,t,i){this.line=t,this.rest=og(t),this.size=this.rest?b(be(this.rest))-i+1:1,this.node=this.text=null,this.hidden=zn(e,t)}function ca(e,t,i){for(var r=[],s,l=t;l<i;l=s){var c=new fu(e.doc,fe(e.doc,l),l);s=l+c.size,r.push(c)}return r}var Ir=null;function vg(e){Ir?Ir.ops.push(e):e.ownsGroup=Ir={ops:[e],delayedCallbacks:[]}}function yg(e){var t=e.delayedCallbacks,i=0;do{for(;i<t.length;i++)t[i].call(null);for(var r=0;r<e.ops.length;r++){var s=e.ops[r];if(s.cursorActivityHandlers)for(;s.cursorActivityCalled<s.cursorActivityHandlers.length;)s.cursorActivityHandlers[s.cursorActivityCalled++].call(null,s.cm)}}while(i<t.length)}function bg(e,t){var i=e.ownsGroup;if(i)try{yg(i)}finally{Ir=null,t(i)}}var pi=null;function vt(e,t){var i=kn(e,t);if(i.length){var r=Array.prototype.slice.call(arguments,2),s;Ir?s=Ir.delayedCallbacks:pi?s=pi:(s=pi=[],setTimeout(xg,0));for(var l=function(h){s.push(function(){return i[h].apply(null,r)})},c=0;c<i.length;++c)l(c)}}function xg(){var e=pi;pi=null;for(var t=0;t<e.length;++t)e[t]()}function cu(e,t,i,r){for(var s=0;s<t.changes.length;s++){var l=t.changes[s];l=="text"?kg(e,t):l=="gutter"?du(e,t,i,r):l=="class"?xs(e,t):l=="widget"&&Sg(e,t,r)}t.changes=null}function gi(e){return e.node==e.text&&(e.node=k("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),m&&x<8&&(e.node.style.zIndex=2)),e.node}function wg(e,t){var i=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(i&&(i+=" CodeMirror-linebackground"),t.background)i?t.background.className=i:(t.background.parentNode.removeChild(t.background),t.background=null);else if(i){var r=gi(t);t.background=r.insertBefore(k("div",null,i),r.firstChild),e.display.input.setUneditable(t.background)}}function hu(e,t){var i=e.display.externalMeasured;return i&&i.line==t.line?(e.display.externalMeasured=null,t.measure=i.measure,i.built):lu(e,t)}function kg(e,t){var i=t.text.className,r=hu(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,xs(e,t)):i&&(t.text.className=i)}function xs(e,t){wg(e,t),t.line.wrapClass?gi(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var i=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=i||""}function du(e,t,i,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 s=gi(t);t.gutterBackground=k("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),s.insertBefore(t.gutterBackground,t.text)}var l=t.line.gutterMarkers;if(e.options.lineNumbers||l){var c=gi(t),h=t.gutter=k("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(h.setAttribute("aria-hidden","true"),e.display.input.setUneditable(h),c.insertBefore(h,t.text),t.line.gutterClass&&(h.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!l||!l["CodeMirror-linenumbers"])&&(t.lineNumber=h.appendChild(k("div",Y(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),l)for(var g=0;g<e.display.gutterSpecs.length;++g){var v=e.display.gutterSpecs[g].className,C=l.hasOwnProperty(v)&&l[v];C&&h.appendChild(k("div",[C],"CodeMirror-gutter-elt","left: "+r.gutterLeft[v]+"px; width: "+r.gutterWidth[v]+"px"))}}}function Sg(e,t,i){t.alignable&&(t.alignable=null);for(var r=ie("CodeMirror-linewidget"),s=t.node.firstChild,l=void 0;s;s=l)l=s.nextSibling,r.test(s.className)&&t.node.removeChild(s);pu(e,t,i)}function Cg(e,t,i,r){var s=hu(e,t);return t.text=t.node=s.pre,s.bgClass&&(t.bgClass=s.bgClass),s.textClass&&(t.textClass=s.textClass),xs(e,t),du(e,t,i,r),pu(e,t,r),t.node}function pu(e,t,i){if(gu(e,t.line,t,i,!0),t.rest)for(var r=0;r<t.rest.length;r++)gu(e,t.rest[r],t,i,!1)}function gu(e,t,i,r,s){if(t.widgets)for(var l=gi(i),c=0,h=t.widgets;c<h.length;++c){var g=h[c],v=k("div",[g.node],"CodeMirror-linewidget"+(g.className?" "+g.className:""));g.handleMouseEvents||v.setAttribute("cm-ignore-events","true"),Tg(g,v,i,r),e.display.input.setUneditable(v),s&&g.above?l.insertBefore(v,i.gutter||i.text):l.appendChild(v),vt(g,"redraw")}}function Tg(e,t,i,r){if(e.noHScroll){(i.alignable||(i.alignable=[])).push(t);var s=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(s-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=s+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function mi(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!D(document.body,e.node)){var i="position: relative;";e.coverGutter&&(i+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(i+="width: "+t.display.wrapper.clientWidth+"px;"),Q(t.display.measure,k("div",[e.node],null,i))}return e.height=e.node.parentNode.offsetHeight}function _n(e,t){for(var i=li(t);i!=e.wrapper;i=i.parentNode)if(!i||i.nodeType==1&&i.getAttribute("cm-ignore-events")=="true"||i.parentNode==e.sizer&&i!=e.mover)return!0}function ha(e){return e.lineSpace.offsetTop}function ws(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function mu(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=Q(e.measure,k("pre","x","CodeMirror-line-like")),i=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(i.paddingLeft),right:parseInt(i.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function vn(e){return Me-e.display.nativeBarWidth}function nr(e){return e.display.scroller.clientWidth-vn(e)-e.display.barWidth}function ks(e){return e.display.scroller.clientHeight-vn(e)-e.display.barHeight}function _g(e,t,i){var r=e.options.lineWrapping,s=r&&nr(e);if(!t.measure.heights||r&&t.measure.width!=s){var l=t.measure.heights=[];if(r){t.measure.width=s;for(var c=t.text.firstChild.getClientRects(),h=0;h<c.length-1;h++){var g=c[h],v=c[h+1];Math.abs(g.bottom-v.bottom)>2&&l.push((g.bottom+v.top)/2-i.top)}}l.push(i.bottom-i.top)}}function vu(e,t,i){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 s=0;s<e.rest.length;s++)if(b(e.rest[s])>i)return{map:e.measure.maps[s],cache:e.measure.caches[s],before:!0}}}function Lg(e,t){t=un(t);var i=b(t),r=e.display.externalMeasured=new fu(e.doc,t,i);r.lineN=i;var s=r.built=lu(e,r);return r.text=s.pre,Q(e.display.lineMeasure,s.pre),r}function yu(e,t,i,r){return yn(e,Or(e,t),i,r)}function Ss(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[ar(e,t)];var i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size)return i}function Or(e,t){var i=b(t),r=Ss(e,i);r&&!r.text?r=null:r&&r.changes&&(cu(e,r,i,Es(e)),e.curOp.forceUpdate=!0),r||(r=Lg(e,t));var s=vu(r,t,i);return{line:t,view:r,rect:null,map:s.map,cache:s.cache,before:s.before,hasHeights:!1}}function yn(e,t,i,r,s){t.before&&(i=-1);var l=i+(r||""),c;return t.cache.hasOwnProperty(l)?c=t.cache[l]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(_g(e,t.view,t.rect),t.hasHeights=!0),c=Dg(e,t,i,r),c.bogus||(t.cache[l]=c)),{left:c.left,right:c.right,top:s?c.rtop:c.top,bottom:s?c.rbottom:c.bottom}}var bu={left:0,right:0,top:0,bottom:0};function xu(e,t,i){for(var r,s,l,c,h,g,v=0;v<e.length;v+=3)if(h=e[v],g=e[v+1],t<h?(s=0,l=1,c="left"):t<g?(s=t-h,l=s+1):(v==e.length-3||t==g&&e[v+3]>t)&&(l=g-h,s=l-1,t>=g&&(c="right")),s!=null){if(r=e[v+2],h==g&&i==(r.insertLeft?"left":"right")&&(c=i),i=="left"&&s==0)for(;v&&e[v-2]==e[v-3]&&e[v-1].insertLeft;)r=e[(v-=3)+2],c="left";if(i=="right"&&s==g-h)for(;v<e.length-3&&e[v+3]==e[v+4]&&!e[v+5].insertLeft;)r=e[(v+=3)+2],c="right";break}return{node:r,start:s,end:l,collapse:c,coverStart:h,coverEnd:g}}function Eg(e,t){var i=bu;if(t=="left")for(var r=0;r<e.length&&(i=e[r]).left==i.right;r++);else for(var s=e.length-1;s>=0&&(i=e[s]).left==i.right;s--);return i}function Dg(e,t,i,r){var s=xu(t.map,i,r),l=s.node,c=s.start,h=s.end,g=s.collapse,v;if(l.nodeType==3){for(var C=0;C<4;C++){for(;c&&De(t.line.text.charAt(s.coverStart+c));)--c;for(;s.coverStart+h<s.coverEnd&&De(t.line.text.charAt(s.coverStart+h));)++h;if(m&&x<9&&c==0&&h==s.coverEnd-s.coverStart?v=l.parentNode.getBoundingClientRect():v=Eg(G(l,c,h).getClientRects(),r),v.left||v.right||c==0)break;h=c,c=c-1,g="right"}m&&x<11&&(v=Ag(e.display.measure,v))}else{c>0&&(g=r="right");var _;e.options.lineWrapping&&(_=l.getClientRects()).length>1?v=_[r=="right"?_.length-1:0]:v=l.getBoundingClientRect()}if(m&&x<9&&!c&&(!v||!v.left&&!v.right)){var M=l.parentNode.getClientRects()[0];M?v={left:M.left,right:M.left+Mr(e.display),top:M.top,bottom:M.bottom}:v=bu}for(var I=v.top-t.rect.top,z=v.bottom-t.rect.top,U=(I+z)/2,V=t.view.measure.heights,ee=0;ee<V.length-1&&!(U<V[ee]);ee++);var ae=ee?V[ee-1]:0,te=V[ee],le={left:(g=="right"?v.right:v.left)-t.rect.left,right:(g=="left"?v.left:v.right)-t.rect.left,top:ae,bottom:te};return!v.left&&!v.right&&(le.bogus=!0),e.options.singleCursorHeightPerLine||(le.rtop=I,le.rbottom=z),le}function Ag(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!hs(e))return t;var i=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*i,right:t.right*i,top:t.top*r,bottom:t.bottom*r}}function wu(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 ku(e){e.display.externalMeasure=null,H(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)wu(e.display.view[t])}function vi(e){ku(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function Su(e){return E&&$?-(e.body.getBoundingClientRect().left-parseInt(getComputedStyle(e.body).marginLeft)):e.defaultView.pageXOffset||(e.documentElement||e.body).scrollLeft}function Cu(e){return E&&$?-(e.body.getBoundingClientRect().top-parseInt(getComputedStyle(e.body).marginTop)):e.defaultView.pageYOffset||(e.documentElement||e.body).scrollTop}function Cs(e){var t=un(e),i=t.widgets,r=0;if(i)for(var s=0;s<i.length;++s)i[s].above&&(r+=mi(i[s]));return r}function da(e,t,i,r,s){if(!s){var l=Cs(t);i.top+=l,i.bottom+=l}if(r=="line")return i;r||(r="local");var c=Tn(t);if(r=="local"?c+=ha(e.display):c-=e.display.viewOffset,r=="page"||r=="window"){var h=e.display.lineSpace.getBoundingClientRect();c+=h.top+(r=="window"?0:Cu(w(e)));var g=h.left+(r=="window"?0:Su(w(e)));i.left+=g,i.right+=g}return i.top+=c,i.bottom+=c,i}function Tu(e,t,i){if(i=="div")return t;var r=t.left,s=t.top;if(i=="page")r-=Su(w(e)),s-=Cu(w(e));else if(i=="local"||!i){var l=e.display.sizer.getBoundingClientRect();r+=l.left,s+=l.top}var c=e.display.lineSpace.getBoundingClientRect();return{left:r-c.left,top:s-c.top}}function pa(e,t,i,r,s){return r||(r=fe(e.doc,t.line)),da(e,r,yu(e,r,t.ch,s),i)}function fn(e,t,i,r,s,l){r=r||fe(e.doc,t.line),s||(s=Or(e,r));function c(z,U){var V=yn(e,s,z,U?"right":"left",l);return U?V.left=V.right:V.right=V.left,da(e,r,V,i)}var h=Pe(r,e.doc.direction),g=t.ch,v=t.sticky;if(g>=r.text.length?(g=r.text.length,v="before"):g<=0&&(g=0,v="after"),!h)return c(v=="before"?g-1:g,v=="before");function C(z,U,V){var ee=h[U],ae=ee.level==1;return c(V?z-1:z,ae!=V)}var _=Nn(h,g,v),M=er,I=C(g,_,v=="before");return M!=null&&(I.other=C(g,M,v!="before")),I}function _u(e,t){var i=0;t=Se(e.doc,t),e.options.lineWrapping||(i=Mr(e.display)*t.ch);var r=fe(e.doc,t.line),s=Tn(r)+ha(e.display);return{left:i,right:i,top:s,bottom:s+r.height}}function Ts(e,t,i,r,s){var l=P(e,t,i);return l.xRel=s,r&&(l.outside=r),l}function _s(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return Ts(r.first,0,null,-1,-1);var s=T(r,i),l=r.first+r.size-1;if(s>l)return Ts(r.first+r.size-1,fe(r,l).text.length,null,1,1);t<0&&(t=0);for(var c=fe(r,s);;){var h=Ig(e,c,s,t,i),g=ag(c,h.ch+(h.xRel>0||h.outside>0?1:0));if(!g)return h;var v=g.find(1);if(v.line==s)return v;c=fe(r,s=v.line)}}function Lu(e,t,i,r){r-=Cs(t);var s=t.text.length,l=Qt(function(c){return yn(e,i,c-1).bottom<=r},s,0);return s=Qt(function(c){return yn(e,i,c).top>r},l,s),{begin:l,end:s}}function Eu(e,t,i,r){i||(i=Or(e,t));var s=da(e,t,yn(e,i,r),"line").top;return Lu(e,t,i,s)}function Ls(e,t,i,r){return e.bottom<=i?!1:e.top>i?!0:(r?e.left:e.right)>t}function Ig(e,t,i,r,s){s-=Tn(t);var l=Or(e,t),c=Cs(t),h=0,g=t.text.length,v=!0,C=Pe(t,e.doc.direction);if(C){var _=(e.options.lineWrapping?Ng:Og)(e,t,i,l,C,r,s);v=_.level!=1,h=v?_.from:_.to-1,g=v?_.to:_.from-1}var M=null,I=null,z=Qt(function(ve){var ge=yn(e,l,ve);return ge.top+=c,ge.bottom+=c,Ls(ge,r,s,!1)?(ge.top<=s&&ge.left<=r&&(M=ve,I=ge),!0):!1},h,g),U,V,ee=!1;if(I){var ae=r-I.left<I.right-r,te=ae==v;z=M+(te?0:1),V=te?"after":"before",U=ae?I.left:I.right}else{!v&&(z==g||z==h)&&z++,V=z==0?"after":z==t.text.length?"before":yn(e,l,z-(v?1:0)).bottom+c<=s==v?"after":"before";var le=fn(e,P(i,z,V),"line",t,l);U=le.left,ee=s<le.top?-1:s>=le.bottom?1:0}return z=zt(t.text,z,1),Ts(i,z,V,ee,r-U)}function Og(e,t,i,r,s,l,c){var h=Qt(function(_){var M=s[_],I=M.level!=1;return Ls(fn(e,P(i,I?M.to:M.from,I?"before":"after"),"line",t,r),l,c,!0)},0,s.length-1),g=s[h];if(h>0){var v=g.level!=1,C=fn(e,P(i,v?g.from:g.to,v?"after":"before"),"line",t,r);Ls(C,l,c,!0)&&C.top>c&&(g=s[h-1])}return g}function Ng(e,t,i,r,s,l,c){var h=Lu(e,t,r,c),g=h.begin,v=h.end;/\s/.test(t.text.charAt(v-1))&&v--;for(var C=null,_=null,M=0;M<s.length;M++){var I=s[M];if(!(I.from>=v||I.to<=g)){var z=I.level!=1,U=yn(e,r,z?Math.min(v,I.to)-1:Math.max(g,I.from)).right,V=U<l?l-U+1e9:U-l;(!C||_>V)&&(C=I,_=V)}}return C||(C=s[s.length-1]),C.from<g&&(C={from:g,to:C.to,level:C.level}),C.to>v&&(C={from:C.from,to:v,level:C.level}),C}var rr;function Nr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(rr==null){rr=k("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)rr.appendChild(document.createTextNode("x")),rr.appendChild(k("br"));rr.appendChild(document.createTextNode("x"))}Q(e.measure,rr);var i=rr.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),H(e.measure),i||1}function Mr(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=k("span","xxxxxxxxxx"),i=k("pre",[t],"CodeMirror-line-like");Q(e.measure,i);var r=t.getBoundingClientRect(),s=(r.right-r.left)/10;return s>2&&(e.cachedCharWidth=s),s||10}function Es(e){for(var t=e.display,i={},r={},s=t.gutters.clientLeft,l=t.gutters.firstChild,c=0;l;l=l.nextSibling,++c){var h=e.display.gutterSpecs[c].className;i[h]=l.offsetLeft+l.clientLeft+s,r[h]=l.clientWidth}return{fixedPos:Ds(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ds(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Du(e){var t=Nr(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/Mr(e.display)-3);return function(s){if(zn(e.doc,s))return 0;var l=0;if(s.widgets)for(var c=0;c<s.widgets.length;c++)s.widgets[c].height&&(l+=s.widgets[c].height);return i?l+(Math.ceil(s.text.length/r)||1)*t:l+t}}function As(e){var t=e.doc,i=Du(e);t.iter(function(r){var s=i(r);s!=r.height&&Kt(r,s)})}function ir(e,t,i,r){var s=e.display;if(!i&&li(t).getAttribute("cm-not-content")=="true")return null;var l,c,h=s.lineSpace.getBoundingClientRect();try{l=t.clientX-h.left,c=t.clientY-h.top}catch{return null}var g=_s(e,l,c),v;if(r&&g.xRel>0&&(v=fe(e.doc,g.line).text).length==g.ch){var C=_e(v,v.length,e.options.tabSize)-v.length;g=P(g.line,Math.max(0,Math.round((l-mu(e.display).left)/Mr(e.display))-C))}return g}function ar(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var i=e.display.view,r=0;r<i.length;r++)if(t-=i[r].size,t<0)return r}function Ot(e,t,i,r){t==null&&(t=e.doc.first),i==null&&(i=e.doc.first+e.doc.size),r||(r=0);var s=e.display;if(r&&i<s.viewTo&&(s.updateLineNumbers==null||s.updateLineNumbers>t)&&(s.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=s.viewTo)Cn&&vs(e.doc,t)<s.viewTo&&Bn(e);else if(i<=s.viewFrom)Cn&&su(e.doc,i+r)>s.viewFrom?Bn(e):(s.viewFrom+=r,s.viewTo+=r);else if(t<=s.viewFrom&&i>=s.viewTo)Bn(e);else if(t<=s.viewFrom){var l=ga(e,i,i+r,1);l?(s.view=s.view.slice(l.index),s.viewFrom=l.lineN,s.viewTo+=r):Bn(e)}else if(i>=s.viewTo){var c=ga(e,t,t,-1);c?(s.view=s.view.slice(0,c.index),s.viewTo=c.lineN):Bn(e)}else{var h=ga(e,t,t,-1),g=ga(e,i,i+r,1);h&&g?(s.view=s.view.slice(0,h.index).concat(ca(e,h.lineN,g.lineN)).concat(s.view.slice(g.index)),s.viewTo+=r):Bn(e)}var v=s.externalMeasured;v&&(i<v.lineN?v.lineN+=r:t<v.lineN+v.size&&(s.externalMeasured=null))}function $n(e,t,i){e.curOp.viewChanged=!0;var r=e.display,s=e.display.externalMeasured;if(s&&t>=s.lineN&&t<s.lineN+s.size&&(r.externalMeasured=null),!(t<r.viewFrom||t>=r.viewTo)){var l=r.view[ar(e,t)];if(l.node!=null){var c=l.changes||(l.changes=[]);we(c,i)==-1&&c.push(i)}}}function Bn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function ga(e,t,i,r){var s=ar(e,t),l,c=e.display.view;if(!Cn||i==e.doc.first+e.doc.size)return{index:s,lineN:i};for(var h=e.display.viewFrom,g=0;g<s;g++)h+=c[g].size;if(h!=t){if(r>0){if(s==c.length-1)return null;l=h+c[s].size-t,s++}else l=h-t;t+=l,i+=l}for(;vs(e.doc,i)!=i;){if(s==(r<0?0:c.length-1))return null;i+=r*c[s-(r<0?1:0)].size,s+=r}return{index:s,lineN:i}}function Mg(e,t,i){var r=e.display,s=r.view;s.length==0||t>=r.viewTo||i<=r.viewFrom?(r.view=ca(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=ca(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(ar(e,t))),r.viewFrom=t,r.viewTo<i?r.view=r.view.concat(ca(e,r.viewTo,i)):r.viewTo>i&&(r.view=r.view.slice(0,ar(e,i)))),r.viewTo=i}function Au(e){for(var t=e.display.view,i=0,r=0;r<t.length;r++){var s=t[r];!s.hidden&&(!s.node||s.changes)&&++i}return i}function yi(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Iu(e,t){t===void 0&&(t=!0);var i=e.doc,r={},s=r.cursors=document.createDocumentFragment(),l=r.selection=document.createDocumentFragment(),c=e.options.$customCursor;c&&(t=!0);for(var h=0;h<i.sel.ranges.length;h++)if(!(!t&&h==i.sel.primIndex)){var g=i.sel.ranges[h];if(!(g.from().line>=e.display.viewTo||g.to().line<e.display.viewFrom)){var v=g.empty();if(c){var C=c(e,g);C&&Is(e,C,s)}else(v||e.options.showCursorWhenSelecting)&&Is(e,g.head,s);v||Rg(e,g,l)}}return r}function Is(e,t,i){var r=fn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),s=i.appendChild(k("div"," ","CodeMirror-cursor"));if(s.style.left=r.left+"px",s.style.top=r.top+"px",s.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",/\bcm-fat-cursor\b/.test(e.getWrapperElement().className)){var l=pa(e,t,"div",null,null),c=l.right-l.left;s.style.width=(c>0?c:e.defaultCharWidth())+"px"}if(r.other){var h=i.appendChild(k("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));h.style.display="",h.style.left=r.other.left+"px",h.style.top=r.other.top+"px",h.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function ma(e,t){return e.top-t.top||e.left-t.left}function Rg(e,t,i){var r=e.display,s=e.doc,l=document.createDocumentFragment(),c=mu(e.display),h=c.left,g=Math.max(r.sizerWidth,nr(e)-r.sizer.offsetLeft)-c.right,v=s.direction=="ltr";function C(te,le,ve,ge){le<0&&(le=0),le=Math.round(le),ge=Math.round(ge),l.appendChild(k("div",null,"CodeMirror-selected","position: absolute; left: "+te+`px;
4
+ `,t);s==-1&&(s=e.length);var l=e.slice(t,e.charAt(s-1)=="\r"?s-1:s),c=l.indexOf("\r");c!=-1?(i.push(l.slice(0,c)),t+=c+1):(i.push(l),t=s+1)}return i}:function(e){return e.split(/\r\n?|\n/)},Fn=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},ia=function(){var e=k("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),on=null;function hs(e){if(on!=null)return on;var t=Q(e,k("span","x")),i=t.getBoundingClientRect(),r=G(t,0,1).getBoundingClientRect();return on=Math.abs(i.left-r.left)>1}var Cr={},ln={};function un(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Cr[e]=t}function tr(e,t){ln[e]=t}function Tr(e){if(typeof e=="string"&&ln.hasOwnProperty(e))e=ln[e];else if(e&&typeof e.name=="string"&&ln.hasOwnProperty(e.name)){var t=ln[e.name];typeof t=="string"&&(t={name:t}),e=Zn(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Tr("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Tr("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function _r(e,t){t=Tr(t);var i=Cr[t.name];if(!i)return _r(e,"text/plain");var r=i(e,t);if(Pn.hasOwnProperty(t.name)){var s=Pn[t.name];for(var l in s)s.hasOwnProperty(l)&&(r.hasOwnProperty(l)&&(r["_"+l]=r[l]),r[l]=s[l])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var c in t.modeProps)r[c]=t.modeProps[c];return r}var Pn={};function Lr(e,t){var i=Pn.hasOwnProperty(e)?Pn[e]:Pn[e]={};ke(t,i)}function mn(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var r in t){var s=t[r];s instanceof Array&&(s=s.concat([])),i[r]=s}return i}function fi(e,t){for(var i;e.innerMode&&(i=e.innerMode(t),!(!i||i.mode==e));)t=i.state,e=i.mode;return i||{mode:e,state:t}}function Er(e,t,i){return e.startState?e.startState(t,i):!0}var nt=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};nt.prototype.eol=function(){return this.pos>=this.string.length},nt.prototype.sol=function(){return this.pos==this.lineStart},nt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},nt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},nt.prototype.eat=function(e){var t=this.string.charAt(this.pos),i;if(typeof e=="string"?i=t==e:i=t&&(e.test?e.test(t):e(t)),i)return++this.pos,t},nt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},nt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},nt.prototype.skipToEnd=function(){this.pos=this.string.length},nt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},nt.prototype.backUp=function(e){this.pos-=e},nt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=_e(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?_e(this.string,this.lineStart,this.tabSize):0)},nt.prototype.indentation=function(){return _e(this.string,null,this.tabSize)-(this.lineStart?_e(this.string,this.lineStart,this.tabSize):0)},nt.prototype.match=function(e,t,i){if(typeof e=="string"){var r=function(c){return i?c.toLowerCase():c},s=this.string.substr(this.pos,e.length);if(r(s)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var l=this.string.slice(this.pos).match(e);return l&&l.index>0?null:(l&&t!==!1&&(this.pos+=l[0].length),l)}},nt.prototype.current=function(){return this.string.slice(this.start,this.pos)},nt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},nt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},nt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function fe(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 i=e;!i.lines;)for(var r=0;;++r){var s=i.children[r],l=s.chunkSize();if(t<l){i=s;break}t-=l}return i.lines[t]}function Sn(e,t,i){var r=[],s=t.line;return e.iter(t.line,i.line+1,function(l){var c=l.text;s==i.line&&(c=c.slice(0,i.ch)),s==t.line&&(c=c.slice(t.ch)),r.push(c),++s}),r}function ci(e,t,i){var r=[];return e.iter(t,i,function(s){r.push(s.text)}),r}function Kt(e,t){var i=t-e.height;if(i)for(var r=e;r;r=r.parent)r.height+=i}function b(e){if(e.parent==null)return null;for(var t=e.parent,i=we(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var s=0;r.children[s]!=t;++s)i+=r.children[s].chunkSize();return i+t.first}function T(e,t){var i=e.first;e:do{for(var r=0;r<e.children.length;++r){var s=e.children[r],l=s.height;if(t<l){e=s;continue e}t-=l,i+=s.chunkSize()}return i}while(!e.lines);for(var c=0;c<e.lines.length;++c){var h=e.lines[c],g=h.height;if(t<g)break;t-=g}return i+c}function j(e,t){return t>=e.first&&t<e.first+e.size}function Y(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function P(e,t,i){if(i===void 0&&(i=null),!(this instanceof P))return new P(e,t,i);this.line=e,this.ch=t,this.sticky=i}function re(e,t){return e.line-t.line||e.ch-t.ch}function $e(e,t){return e.sticky==t.sticky&&re(e,t)==0}function mt(e){return P(e.line,e.ch)}function It(e,t){return re(e,t)<0?t:e}function Dr(e,t){return re(e,t)<0?e:t}function Xl(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function Se(e,t){if(t.line<e.first)return P(e.first,0);var i=e.first+e.size-1;return t.line>i?P(i,fe(e,i).text.length):Jp(t,fe(e,t.line).text.length)}function Jp(e,t){var i=e.ch;return i==null||i>t?P(e.line,t):i<0?P(e.line,0):e}function Yl(e,t){for(var i=[],r=0;r<t.length;r++)i[r]=Se(e,t[r]);return i}var aa=function(e,t){this.state=e,this.lookAhead=t},vn=function(e,t,i,r){this.state=t,this.doc=e,this.line=i,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};vn.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},vn.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}},vn.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},vn.fromSaved=function(e,t,i){return t instanceof aa?new vn(e,mn(e.mode,t.state),i,t.lookAhead):new vn(e,mn(e.mode,t),i)},vn.prototype.save=function(e){var t=e!==!1?mn(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new aa(t,this.maxLookAhead):t};function Vl(e,t,i,r){var s=[e.state.modeGen],l={};nu(e,t.text,e.doc.mode,i,function(v,C){return s.push(v,C)},l,r);for(var c=i.state,h=function(v){i.baseTokens=s;var C=e.state.overlays[v],_=1,M=0;i.state=!0,nu(e,t.text,C.mode,i,function(I,z){for(var q=_;M<I;){var V=s[_];V>I&&s.splice(_,1,I,s[_+1],V),_+=2,M=Math.min(I,V)}if(z)if(C.opaque)s.splice(q,_-q,I,"overlay "+z),_=q+2;else for(;q<_;q+=2){var ee=s[q+1];s[q+1]=(ee?ee+" ":"")+"overlay "+z}},l),i.state=c,i.baseTokens=null,i.baseTokenPos=1},g=0;g<e.state.overlays.length;++g)h(g);return{styles:s,classes:l.bgClass||l.textClass?l:null}}function Jl(e,t,i){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=hi(e,b(t)),s=t.text.length>e.options.maxHighlightLength&&mn(e.doc.mode,r.state),l=Vl(e,t,r);s&&(r.state=s),t.stateAfter=r.save(!s),t.styles=l.styles,l.classes?t.styleClasses=l.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function hi(e,t,i){var r=e.doc,s=e.display;if(!r.mode.startState)return new vn(r,!0,t);var l=Qp(e,t,i),c=l>r.first&&fe(r,l-1).stateAfter,h=c?vn.fromSaved(r,c,l):new vn(r,Er(r.mode),l);return r.iter(l,t,function(g){ds(e,g.text,h);var v=h.line;g.stateAfter=v==t-1||v%5==0||v>=s.viewFrom&&v<s.viewTo?h.save():null,h.nextLine()}),i&&(r.modeFrontier=h.line),h}function ds(e,t,i,r){var s=e.doc.mode,l=new nt(t,e.options.tabSize,i);for(l.start=l.pos=r||0,t==""&&Ql(s,i.state);!l.eol();)ps(s,l,i.state),l.start=l.pos}function Ql(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var i=fi(e,t);if(i.mode.blankLine)return i.mode.blankLine(i.state)}}function ps(e,t,i,r){for(var s=0;s<10;s++){r&&(r[0]=fi(e,i).mode);var l=e.token(t,i);if(t.pos>t.start)return l}throw new Error("Mode "+e.name+" failed to advance stream.")}var Zl=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function eu(e,t,i,r){var s=e.doc,l=s.mode,c;t=Se(s,t);var h=fe(s,t.line),g=hi(e,t.line,i),v=new nt(h.text,e.options.tabSize,g),C;for(r&&(C=[]);(r||v.pos<t.ch)&&!v.eol();)v.start=v.pos,c=ps(l,v,g.state),r&&C.push(new Zl(v,c,mn(s.mode,g.state)));return r?C:new Zl(v,c,g.state)}function tu(e,t){if(e)for(;;){var i=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!i)break;e=e.slice(0,i.index)+e.slice(i.index+i[0].length);var r=i[1]?"bgClass":"textClass";t[r]==null?t[r]=i[2]:new RegExp("(?:^|\\s)"+i[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+i[2])}return e}function nu(e,t,i,r,s,l,c){var h=i.flattenSpans;h==null&&(h=e.options.flattenSpans);var g=0,v=null,C=new nt(t,e.options.tabSize,r),_,M=e.options.addModeClass&&[null];for(t==""&&tu(Ql(i,r.state),l);!C.eol();){if(C.pos>e.options.maxHighlightLength?(h=!1,c&&ds(e,t,r,C.pos),C.pos=t.length,_=null):_=tu(ps(i,C,r.state,M),l),M){var I=M[0].name;I&&(_="m-"+(_?I+" "+_:I))}if(!h||v!=_){for(;g<C.start;)g=Math.min(C.start,g+5e3),s(g,v);v=_}C.start=C.pos}for(;g<C.pos;){var z=Math.min(C.pos,g+5e3);s(z,v),g=z}}function Qp(e,t,i){for(var r,s,l=e.doc,c=i?-1:t-(e.doc.mode.innerMode?1e3:100),h=t;h>c;--h){if(h<=l.first)return l.first;var g=fe(l,h-1),v=g.stateAfter;if(v&&(!i||h+(v instanceof aa?v.lookAhead:0)<=l.modeFrontier))return h;var C=_e(g.text,null,e.options.tabSize);(s==null||r>C)&&(s=h-1,r=C)}return s}function Zp(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var i=e.first,r=t-1;r>i;r--){var s=fe(e,r).stateAfter;if(s&&(!(s instanceof aa)||r+s.lookAhead<t)){i=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,i)}}var ru=!1,Cn=!1;function eg(){ru=!0}function tg(){Cn=!0}function sa(e,t,i){this.marker=e,this.from=t,this.to=i}function di(e,t){if(e)for(var i=0;i<e.length;++i){var r=e[i];if(r.marker==t)return r}}function ng(e,t){for(var i,r=0;r<e.length;++r)e[r]!=t&&(i||(i=[])).push(e[r]);return i}function rg(e,t,i){var r=i&&window.WeakSet&&(i.markedSpans||(i.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 ig(e,t,i){var r;if(e)for(var s=0;s<e.length;++s){var l=e[s],c=l.marker,h=l.from==null||(c.inclusiveLeft?l.from<=t:l.from<t);if(h||l.from==t&&c.type=="bookmark"&&(!i||!l.marker.insertLeft)){var g=l.to==null||(c.inclusiveRight?l.to>=t:l.to>t);(r||(r=[])).push(new sa(c,l.from,g?null:l.to))}}return r}function ag(e,t,i){var r;if(e)for(var s=0;s<e.length;++s){var l=e[s],c=l.marker,h=l.to==null||(c.inclusiveRight?l.to>=t:l.to>t);if(h||l.from==t&&c.type=="bookmark"&&(!i||l.marker.insertLeft)){var g=l.from==null||(c.inclusiveLeft?l.from<=t:l.from<t);(r||(r=[])).push(new sa(c,g?null:l.from-t,l.to==null?null:l.to-t))}}return r}function gs(e,t){if(t.full)return null;var i=j(e,t.from.line)&&fe(e,t.from.line).markedSpans,r=j(e,t.to.line)&&fe(e,t.to.line).markedSpans;if(!i&&!r)return null;var s=t.from.ch,l=t.to.ch,c=re(t.from,t.to)==0,h=ig(i,s,c),g=ag(r,l,c),v=t.text.length==1,C=be(t.text).length+(v?s:0);if(h)for(var _=0;_<h.length;++_){var M=h[_];if(M.to==null){var I=di(g,M.marker);I?v&&(M.to=I.to==null?null:I.to+C):M.to=s}}if(g)for(var z=0;z<g.length;++z){var q=g[z];if(q.to!=null&&(q.to+=C),q.from==null){var V=di(h,q.marker);V||(q.from=C,v&&(h||(h=[])).push(q))}else q.from+=C,v&&(h||(h=[])).push(q)}h&&(h=iu(h)),g&&g!=h&&(g=iu(g));var ee=[h];if(!v){var ae=t.text.length-2,te;if(ae>0&&h)for(var le=0;le<h.length;++le)h[le].to==null&&(te||(te=[])).push(new sa(h[le].marker,null,null));for(var ve=0;ve<ae;++ve)ee.push(te);ee.push(g)}return ee}function iu(e){for(var t=0;t<e.length;++t){var i=e[t];i.from!=null&&i.from==i.to&&i.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function sg(e,t,i){var r=null;if(e.iter(t.line,i.line+1,function(I){if(I.markedSpans)for(var z=0;z<I.markedSpans.length;++z){var q=I.markedSpans[z].marker;q.readOnly&&(!r||we(r,q)==-1)&&(r||(r=[])).push(q)}}),!r)return null;for(var s=[{from:t,to:i}],l=0;l<r.length;++l)for(var c=r[l],h=c.find(0),g=0;g<s.length;++g){var v=s[g];if(!(re(v.to,h.from)<0||re(v.from,h.to)>0)){var C=[g,1],_=re(v.from,h.from),M=re(v.to,h.to);(_<0||!c.inclusiveLeft&&!_)&&C.push({from:v.from,to:h.from}),(M>0||!c.inclusiveRight&&!M)&&C.push({from:h.to,to:v.to}),s.splice.apply(s,C),g+=C.length-3}}return s}function au(e){var t=e.markedSpans;if(t){for(var i=0;i<t.length;++i)t[i].marker.detachLine(e);e.markedSpans=null}}function su(e,t){if(t){for(var i=0;i<t.length;++i)t[i].marker.attachLine(e);e.markedSpans=t}}function oa(e){return e.inclusiveLeft?-1:0}function la(e){return e.inclusiveRight?1:0}function ms(e,t){var i=e.lines.length-t.lines.length;if(i!=0)return i;var r=e.find(),s=t.find(),l=re(r.from,s.from)||oa(e)-oa(t);if(l)return-l;var c=re(r.to,s.to)||la(e)-la(t);return c||t.id-e.id}function ou(e,t){var i=Cn&&e.markedSpans,r;if(i)for(var s=void 0,l=0;l<i.length;++l)s=i[l],s.marker.collapsed&&(t?s.from:s.to)==null&&(!r||ms(r,s.marker)<0)&&(r=s.marker);return r}function lu(e){return ou(e,!0)}function ua(e){return ou(e,!1)}function og(e,t){var i=Cn&&e.markedSpans,r;if(i)for(var s=0;s<i.length;++s){var l=i[s];l.marker.collapsed&&(l.from==null||l.from<t)&&(l.to==null||l.to>t)&&(!r||ms(r,l.marker)<0)&&(r=l.marker)}return r}function uu(e,t,i,r,s){var l=fe(e,t),c=Cn&&l.markedSpans;if(c)for(var h=0;h<c.length;++h){var g=c[h];if(g.marker.collapsed){var v=g.marker.find(0),C=re(v.from,i)||oa(g.marker)-oa(s),_=re(v.to,r)||la(g.marker)-la(s);if(!(C>=0&&_<=0||C<=0&&_>=0)&&(C<=0&&(g.marker.inclusiveRight&&s.inclusiveLeft?re(v.to,i)>=0:re(v.to,i)>0)||C>=0&&(g.marker.inclusiveRight&&s.inclusiveLeft?re(v.from,r)<=0:re(v.from,r)<0)))return!0}}}function fn(e){for(var t;t=lu(e);)e=t.find(-1,!0).line;return e}function lg(e){for(var t;t=ua(e);)e=t.find(1,!0).line;return e}function ug(e){for(var t,i;t=ua(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function vs(e,t){var i=fe(e,t),r=fn(i);return i==r?t:b(r)}function fu(e,t){if(t>e.lastLine())return t;var i=fe(e,t),r;if(!zn(e,i))return t;for(;r=ua(i);)i=r.find(1,!0).line;return b(i)+1}function zn(e,t){var i=Cn&&t.markedSpans;if(i){for(var r=void 0,s=0;s<i.length;++s)if(r=i[s],!!r.marker.collapsed){if(r.from==null)return!0;if(!r.marker.widgetNode&&r.from==0&&r.marker.inclusiveLeft&&ys(e,t,r))return!0}}}function ys(e,t,i){if(i.to==null){var r=i.marker.find(1,!0);return ys(e,r.line,di(r.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(var s=void 0,l=0;l<t.markedSpans.length;++l)if(s=t.markedSpans[l],s.marker.collapsed&&!s.marker.widgetNode&&s.from==i.to&&(s.to==null||s.to!=i.from)&&(s.marker.inclusiveLeft||i.marker.inclusiveRight)&&ys(e,t,s))return!0}function Tn(e){e=fn(e);for(var t=0,i=e.parent,r=0;r<i.lines.length;++r){var s=i.lines[r];if(s==e)break;t+=s.height}for(var l=i.parent;l;i=l,l=i.parent)for(var c=0;c<l.children.length;++c){var h=l.children[c];if(h==i)break;t+=h.height}return t}function fa(e){if(e.height==0)return 0;for(var t=e.text.length,i,r=e;i=lu(r);){var s=i.find(0,!0);r=s.from.line,t+=s.from.ch-s.to.ch}for(r=e;i=ua(r);){var l=i.find(0,!0);t-=r.text.length-l.from.ch,r=l.to.line,t+=r.text.length-l.to.ch}return t}function bs(e){var t=e.display,i=e.doc;t.maxLine=fe(i,i.first),t.maxLineLength=fa(t.maxLine),t.maxLineChanged=!0,i.iter(function(r){var s=fa(r);s>t.maxLineLength&&(t.maxLineLength=s,t.maxLine=r)})}var Ar=function(e,t,i){this.text=e,su(this,t),this.height=i?i(this):1};Ar.prototype.lineNo=function(){return b(this)},an(Ar);function fg(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),au(e),su(e,i);var s=r?r(e):1;s!=e.height&&Kt(e,s)}function cg(e){e.parent=null,au(e)}var hg={},dg={};function cu(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?dg:hg;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function hu(e,t){var i=J("span",null,null,S?"padding-right: .1px":null),r={pre:J("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var s=0;s<=(t.rest?t.rest.length:0);s++){var l=s?t.rest[s-1]:t.line,c=void 0;r.pos=0,r.addToken=gg,Rn(e.display.measure)&&(c=Pe(l,e.doc.direction))&&(r.addToken=vg(r.addToken,c)),r.map=[];var h=t!=e.display.externalMeasured&&b(l);yg(l,r,Jl(e,l,h)),l.styleClasses&&(l.styleClasses.bgClass&&(r.bgClass=de(l.styleClasses.bgClass,r.bgClass||"")),l.styleClasses.textClass&&(r.textClass=de(l.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(ra(e.display.measure))),s==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(S){var g=r.content.lastChild;(/\bcm-tab\b/.test(g.className)||g.querySelector&&g.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return et(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=de(r.pre.className,r.textClass||"")),r}function pg(e){var t=k("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function gg(e,t,i,r,s,l,c){if(t){var h=e.splitSpaces?mg(t,e.trailingSpace):t,g=e.cm.state.specialChars,v=!1,C;if(!g.test(t))e.col+=t.length,C=document.createTextNode(h),e.map.push(e.pos,e.pos+t.length,C),m&&x<9&&(v=!0),e.pos+=t.length;else{C=document.createDocumentFragment();for(var _=0;;){g.lastIndex=_;var M=g.exec(t),I=M?M.index-_:t.length-_;if(I){var z=document.createTextNode(h.slice(_,_+I));m&&x<9?C.appendChild(k("span",[z])):C.appendChild(z),e.map.push(e.pos,e.pos+I,z),e.col+=I,e.pos+=I}if(!M)break;_+=I+1;var q=void 0;if(M[0]==" "){var V=e.cm.options.tabSize,ee=V-e.col%V;q=C.appendChild(k("span",Ut(ee),"cm-tab")),q.setAttribute("role","presentation"),q.setAttribute("cm-text"," "),e.col+=ee}else M[0]=="\r"||M[0]==`
5
+ `?(q=C.appendChild(k("span",M[0]=="\r"?"␍":"␤","cm-invalidchar")),q.setAttribute("cm-text",M[0]),e.col+=1):(q=e.cm.options.specialCharPlaceholder(M[0]),q.setAttribute("cm-text",M[0]),m&&x<9?C.appendChild(k("span",[q])):C.appendChild(q),e.col+=1);e.map.push(e.pos,e.pos+1,q),e.pos++}}if(e.trailingSpace=h.charCodeAt(t.length-1)==32,i||r||s||v||l||c){var ae=i||"";r&&(ae+=r),s&&(ae+=s);var te=k("span",[C],ae,l);if(c)for(var le in c)c.hasOwnProperty(le)&&le!="style"&&le!="class"&&te.setAttribute(le,c[le]);return e.content.appendChild(te)}e.content.appendChild(C)}}function mg(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",s=0;s<e.length;s++){var l=e.charAt(s);l==" "&&i&&(s==e.length-1||e.charCodeAt(s+1)==32)&&(l=" "),r+=l,i=l==" "}return r}function vg(e,t){return function(i,r,s,l,c,h,g){s=s?s+" cm-force-border":"cm-force-border";for(var v=i.pos,C=v+r.length;;){for(var _=void 0,M=0;M<t.length&&(_=t[M],!(_.to>v&&_.from<=v));M++);if(_.to>=C)return e(i,r,s,l,c,h,g);e(i,r.slice(0,_.to-v),s,l,null,h,g),l=null,r=r.slice(_.to-v),v=_.to}}}function du(e,t,i,r){var s=!r&&i.widgetNode;s&&e.map.push(e.pos,e.pos+t,s),!r&&e.cm.display.input.needsContentAttribute&&(s||(s=e.content.appendChild(document.createElement("span"))),s.setAttribute("cm-marker",i.id)),s&&(e.cm.display.input.setUneditable(s),e.content.appendChild(s)),e.pos+=t,e.trailingSpace=!1}function yg(e,t,i){var r=e.markedSpans,s=e.text,l=0;if(!r){for(var c=1;c<i.length;c+=2)t.addToken(t,s.slice(l,l=i[c]),cu(i[c+1],t.cm.options));return}for(var h=s.length,g=0,v=1,C="",_,M,I=0,z,q,V,ee,ae;;){if(I==g){z=q=V=M="",ae=null,ee=null,I=1/0;for(var te=[],le=void 0,ve=0;ve<r.length;++ve){var ge=r[ve],Ae=ge.marker;if(Ae.type=="bookmark"&&ge.from==g&&Ae.widgetNode)te.push(Ae);else if(ge.from<=g&&(ge.to==null||ge.to>g||Ae.collapsed&&ge.to==g&&ge.from==g)){if(ge.to!=null&&ge.to!=g&&I>ge.to&&(I=ge.to,q=""),Ae.className&&(z+=" "+Ae.className),Ae.css&&(M=(M?M+";":"")+Ae.css),Ae.startStyle&&ge.from==g&&(V+=" "+Ae.startStyle),Ae.endStyle&&ge.to==I&&(le||(le=[])).push(Ae.endStyle,ge.to),Ae.title&&((ae||(ae={})).title=Ae.title),Ae.attributes)for(var qe in Ae.attributes)(ae||(ae={}))[qe]=Ae.attributes[qe];Ae.collapsed&&(!ee||ms(ee.marker,Ae)<0)&&(ee=ge)}else ge.from>g&&I>ge.from&&(I=ge.from)}if(le)for(var xt=0;xt<le.length;xt+=2)le[xt+1]==I&&(q+=" "+le[xt]);if(!ee||ee.from==g)for(var Qe=0;Qe<te.length;++Qe)du(t,0,te[Qe]);if(ee&&(ee.from||0)==g){if(du(t,(ee.to==null?h+1:ee.to)-g,ee.marker,ee.from==null),ee.to==null)return;ee.to==g&&(ee=!1)}}if(g>=h)break;for(var Ht=Math.min(h,I);;){if(C){var Mt=g+C.length;if(!ee){var lt=Mt>Ht?C.slice(0,Ht-g):C;t.addToken(t,lt,_?_+z:z,V,g+lt.length==I?q:"",M,ae)}if(Mt>=Ht){C=C.slice(Ht-g),g=Ht;break}g=Mt,V=""}C=s.slice(l,l=i[v++]),_=cu(i[v++],t.cm.options)}}}function pu(e,t,i){this.line=t,this.rest=ug(t),this.size=this.rest?b(be(this.rest))-i+1:1,this.node=this.text=null,this.hidden=zn(e,t)}function ca(e,t,i){for(var r=[],s,l=t;l<i;l=s){var c=new pu(e.doc,fe(e.doc,l),l);s=l+c.size,r.push(c)}return r}var Ir=null;function bg(e){Ir?Ir.ops.push(e):e.ownsGroup=Ir={ops:[e],delayedCallbacks:[]}}function xg(e){var t=e.delayedCallbacks,i=0;do{for(;i<t.length;i++)t[i].call(null);for(var r=0;r<e.ops.length;r++){var s=e.ops[r];if(s.cursorActivityHandlers)for(;s.cursorActivityCalled<s.cursorActivityHandlers.length;)s.cursorActivityHandlers[s.cursorActivityCalled++].call(null,s.cm)}}while(i<t.length)}function wg(e,t){var i=e.ownsGroup;if(i)try{xg(i)}finally{Ir=null,t(i)}}var pi=null;function vt(e,t){var i=kn(e,t);if(i.length){var r=Array.prototype.slice.call(arguments,2),s;Ir?s=Ir.delayedCallbacks:pi?s=pi:(s=pi=[],setTimeout(kg,0));for(var l=function(h){s.push(function(){return i[h].apply(null,r)})},c=0;c<i.length;++c)l(c)}}function kg(){var e=pi;pi=null;for(var t=0;t<e.length;++t)e[t]()}function gu(e,t,i,r){for(var s=0;s<t.changes.length;s++){var l=t.changes[s];l=="text"?Cg(e,t):l=="gutter"?vu(e,t,i,r):l=="class"?xs(e,t):l=="widget"&&Tg(e,t,r)}t.changes=null}function gi(e){return e.node==e.text&&(e.node=k("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),m&&x<8&&(e.node.style.zIndex=2)),e.node}function Sg(e,t){var i=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(i&&(i+=" CodeMirror-linebackground"),t.background)i?t.background.className=i:(t.background.parentNode.removeChild(t.background),t.background=null);else if(i){var r=gi(t);t.background=r.insertBefore(k("div",null,i),r.firstChild),e.display.input.setUneditable(t.background)}}function mu(e,t){var i=e.display.externalMeasured;return i&&i.line==t.line?(e.display.externalMeasured=null,t.measure=i.measure,i.built):hu(e,t)}function Cg(e,t){var i=t.text.className,r=mu(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,xs(e,t)):i&&(t.text.className=i)}function xs(e,t){Sg(e,t),t.line.wrapClass?gi(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var i=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=i||""}function vu(e,t,i,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 s=gi(t);t.gutterBackground=k("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),s.insertBefore(t.gutterBackground,t.text)}var l=t.line.gutterMarkers;if(e.options.lineNumbers||l){var c=gi(t),h=t.gutter=k("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(h.setAttribute("aria-hidden","true"),e.display.input.setUneditable(h),c.insertBefore(h,t.text),t.line.gutterClass&&(h.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!l||!l["CodeMirror-linenumbers"])&&(t.lineNumber=h.appendChild(k("div",Y(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),l)for(var g=0;g<e.display.gutterSpecs.length;++g){var v=e.display.gutterSpecs[g].className,C=l.hasOwnProperty(v)&&l[v];C&&h.appendChild(k("div",[C],"CodeMirror-gutter-elt","left: "+r.gutterLeft[v]+"px; width: "+r.gutterWidth[v]+"px"))}}}function Tg(e,t,i){t.alignable&&(t.alignable=null);for(var r=ie("CodeMirror-linewidget"),s=t.node.firstChild,l=void 0;s;s=l)l=s.nextSibling,r.test(s.className)&&t.node.removeChild(s);yu(e,t,i)}function _g(e,t,i,r){var s=mu(e,t);return t.text=t.node=s.pre,s.bgClass&&(t.bgClass=s.bgClass),s.textClass&&(t.textClass=s.textClass),xs(e,t),vu(e,t,i,r),yu(e,t,r),t.node}function yu(e,t,i){if(bu(e,t.line,t,i,!0),t.rest)for(var r=0;r<t.rest.length;r++)bu(e,t.rest[r],t,i,!1)}function bu(e,t,i,r,s){if(t.widgets)for(var l=gi(i),c=0,h=t.widgets;c<h.length;++c){var g=h[c],v=k("div",[g.node],"CodeMirror-linewidget"+(g.className?" "+g.className:""));g.handleMouseEvents||v.setAttribute("cm-ignore-events","true"),Lg(g,v,i,r),e.display.input.setUneditable(v),s&&g.above?l.insertBefore(v,i.gutter||i.text):l.appendChild(v),vt(g,"redraw")}}function Lg(e,t,i,r){if(e.noHScroll){(i.alignable||(i.alignable=[])).push(t);var s=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(s-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=s+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function mi(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!D(document.body,e.node)){var i="position: relative;";e.coverGutter&&(i+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(i+="width: "+t.display.wrapper.clientWidth+"px;"),Q(t.display.measure,k("div",[e.node],null,i))}return e.height=e.node.parentNode.offsetHeight}function _n(e,t){for(var i=li(t);i!=e.wrapper;i=i.parentNode)if(!i||i.nodeType==1&&i.getAttribute("cm-ignore-events")=="true"||i.parentNode==e.sizer&&i!=e.mover)return!0}function ha(e){return e.lineSpace.offsetTop}function ws(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function xu(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=Q(e.measure,k("pre","x","CodeMirror-line-like")),i=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(i.paddingLeft),right:parseInt(i.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function yn(e){return Me-e.display.nativeBarWidth}function nr(e){return e.display.scroller.clientWidth-yn(e)-e.display.barWidth}function ks(e){return e.display.scroller.clientHeight-yn(e)-e.display.barHeight}function Eg(e,t,i){var r=e.options.lineWrapping,s=r&&nr(e);if(!t.measure.heights||r&&t.measure.width!=s){var l=t.measure.heights=[];if(r){t.measure.width=s;for(var c=t.text.firstChild.getClientRects(),h=0;h<c.length-1;h++){var g=c[h],v=c[h+1];Math.abs(g.bottom-v.bottom)>2&&l.push((g.bottom+v.top)/2-i.top)}}l.push(i.bottom-i.top)}}function wu(e,t,i){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 s=0;s<e.rest.length;s++)if(b(e.rest[s])>i)return{map:e.measure.maps[s],cache:e.measure.caches[s],before:!0}}}function Dg(e,t){t=fn(t);var i=b(t),r=e.display.externalMeasured=new pu(e.doc,t,i);r.lineN=i;var s=r.built=hu(e,r);return r.text=s.pre,Q(e.display.lineMeasure,s.pre),r}function ku(e,t,i,r){return bn(e,Or(e,t),i,r)}function Ss(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[ar(e,t)];var i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size)return i}function Or(e,t){var i=b(t),r=Ss(e,i);r&&!r.text?r=null:r&&r.changes&&(gu(e,r,i,Es(e)),e.curOp.forceUpdate=!0),r||(r=Dg(e,t));var s=wu(r,t,i);return{line:t,view:r,rect:null,map:s.map,cache:s.cache,before:s.before,hasHeights:!1}}function bn(e,t,i,r,s){t.before&&(i=-1);var l=i+(r||""),c;return t.cache.hasOwnProperty(l)?c=t.cache[l]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Eg(e,t.view,t.rect),t.hasHeights=!0),c=Ig(e,t,i,r),c.bogus||(t.cache[l]=c)),{left:c.left,right:c.right,top:s?c.rtop:c.top,bottom:s?c.rbottom:c.bottom}}var Su={left:0,right:0,top:0,bottom:0};function Cu(e,t,i){for(var r,s,l,c,h,g,v=0;v<e.length;v+=3)if(h=e[v],g=e[v+1],t<h?(s=0,l=1,c="left"):t<g?(s=t-h,l=s+1):(v==e.length-3||t==g&&e[v+3]>t)&&(l=g-h,s=l-1,t>=g&&(c="right")),s!=null){if(r=e[v+2],h==g&&i==(r.insertLeft?"left":"right")&&(c=i),i=="left"&&s==0)for(;v&&e[v-2]==e[v-3]&&e[v-1].insertLeft;)r=e[(v-=3)+2],c="left";if(i=="right"&&s==g-h)for(;v<e.length-3&&e[v+3]==e[v+4]&&!e[v+5].insertLeft;)r=e[(v+=3)+2],c="right";break}return{node:r,start:s,end:l,collapse:c,coverStart:h,coverEnd:g}}function Ag(e,t){var i=Su;if(t=="left")for(var r=0;r<e.length&&(i=e[r]).left==i.right;r++);else for(var s=e.length-1;s>=0&&(i=e[s]).left==i.right;s--);return i}function Ig(e,t,i,r){var s=Cu(t.map,i,r),l=s.node,c=s.start,h=s.end,g=s.collapse,v;if(l.nodeType==3){for(var C=0;C<4;C++){for(;c&&De(t.line.text.charAt(s.coverStart+c));)--c;for(;s.coverStart+h<s.coverEnd&&De(t.line.text.charAt(s.coverStart+h));)++h;if(m&&x<9&&c==0&&h==s.coverEnd-s.coverStart?v=l.parentNode.getBoundingClientRect():v=Ag(G(l,c,h).getClientRects(),r),v.left||v.right||c==0)break;h=c,c=c-1,g="right"}m&&x<11&&(v=Og(e.display.measure,v))}else{c>0&&(g=r="right");var _;e.options.lineWrapping&&(_=l.getClientRects()).length>1?v=_[r=="right"?_.length-1:0]:v=l.getBoundingClientRect()}if(m&&x<9&&!c&&(!v||!v.left&&!v.right)){var M=l.parentNode.getClientRects()[0];M?v={left:M.left,right:M.left+Mr(e.display),top:M.top,bottom:M.bottom}:v=Su}for(var I=v.top-t.rect.top,z=v.bottom-t.rect.top,q=(I+z)/2,V=t.view.measure.heights,ee=0;ee<V.length-1&&!(q<V[ee]);ee++);var ae=ee?V[ee-1]:0,te=V[ee],le={left:(g=="right"?v.right:v.left)-t.rect.left,right:(g=="left"?v.left:v.right)-t.rect.left,top:ae,bottom:te};return!v.left&&!v.right&&(le.bogus=!0),e.options.singleCursorHeightPerLine||(le.rtop=I,le.rbottom=z),le}function Og(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!hs(e))return t;var i=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*i,right:t.right*i,top:t.top*r,bottom:t.bottom*r}}function Tu(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 _u(e){e.display.externalMeasure=null,W(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Tu(e.display.view[t])}function vi(e){_u(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function Lu(e){return E&&$?-(e.body.getBoundingClientRect().left-parseInt(getComputedStyle(e.body).marginLeft)):e.defaultView.pageXOffset||(e.documentElement||e.body).scrollLeft}function Eu(e){return E&&$?-(e.body.getBoundingClientRect().top-parseInt(getComputedStyle(e.body).marginTop)):e.defaultView.pageYOffset||(e.documentElement||e.body).scrollTop}function Cs(e){var t=fn(e),i=t.widgets,r=0;if(i)for(var s=0;s<i.length;++s)i[s].above&&(r+=mi(i[s]));return r}function da(e,t,i,r,s){if(!s){var l=Cs(t);i.top+=l,i.bottom+=l}if(r=="line")return i;r||(r="local");var c=Tn(t);if(r=="local"?c+=ha(e.display):c-=e.display.viewOffset,r=="page"||r=="window"){var h=e.display.lineSpace.getBoundingClientRect();c+=h.top+(r=="window"?0:Eu(w(e)));var g=h.left+(r=="window"?0:Lu(w(e)));i.left+=g,i.right+=g}return i.top+=c,i.bottom+=c,i}function Du(e,t,i){if(i=="div")return t;var r=t.left,s=t.top;if(i=="page")r-=Lu(w(e)),s-=Eu(w(e));else if(i=="local"||!i){var l=e.display.sizer.getBoundingClientRect();r+=l.left,s+=l.top}var c=e.display.lineSpace.getBoundingClientRect();return{left:r-c.left,top:s-c.top}}function pa(e,t,i,r,s){return r||(r=fe(e.doc,t.line)),da(e,r,ku(e,r,t.ch,s),i)}function cn(e,t,i,r,s,l){r=r||fe(e.doc,t.line),s||(s=Or(e,r));function c(z,q){var V=bn(e,s,z,q?"right":"left",l);return q?V.left=V.right:V.right=V.left,da(e,r,V,i)}var h=Pe(r,e.doc.direction),g=t.ch,v=t.sticky;if(g>=r.text.length?(g=r.text.length,v="before"):g<=0&&(g=0,v="after"),!h)return c(v=="before"?g-1:g,v=="before");function C(z,q,V){var ee=h[q],ae=ee.level==1;return c(V?z-1:z,ae!=V)}var _=Nn(h,g,v),M=er,I=C(g,_,v=="before");return M!=null&&(I.other=C(g,M,v!="before")),I}function Au(e,t){var i=0;t=Se(e.doc,t),e.options.lineWrapping||(i=Mr(e.display)*t.ch);var r=fe(e.doc,t.line),s=Tn(r)+ha(e.display);return{left:i,right:i,top:s,bottom:s+r.height}}function Ts(e,t,i,r,s){var l=P(e,t,i);return l.xRel=s,r&&(l.outside=r),l}function _s(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return Ts(r.first,0,null,-1,-1);var s=T(r,i),l=r.first+r.size-1;if(s>l)return Ts(r.first+r.size-1,fe(r,l).text.length,null,1,1);t<0&&(t=0);for(var c=fe(r,s);;){var h=Ng(e,c,s,t,i),g=og(c,h.ch+(h.xRel>0||h.outside>0?1:0));if(!g)return h;var v=g.find(1);if(v.line==s)return v;c=fe(r,s=v.line)}}function Iu(e,t,i,r){r-=Cs(t);var s=t.text.length,l=Qt(function(c){return bn(e,i,c-1).bottom<=r},s,0);return s=Qt(function(c){return bn(e,i,c).top>r},l,s),{begin:l,end:s}}function Ou(e,t,i,r){i||(i=Or(e,t));var s=da(e,t,bn(e,i,r),"line").top;return Iu(e,t,i,s)}function Ls(e,t,i,r){return e.bottom<=i?!1:e.top>i?!0:(r?e.left:e.right)>t}function Ng(e,t,i,r,s){s-=Tn(t);var l=Or(e,t),c=Cs(t),h=0,g=t.text.length,v=!0,C=Pe(t,e.doc.direction);if(C){var _=(e.options.lineWrapping?Rg:Mg)(e,t,i,l,C,r,s);v=_.level!=1,h=v?_.from:_.to-1,g=v?_.to:_.from-1}var M=null,I=null,z=Qt(function(ve){var ge=bn(e,l,ve);return ge.top+=c,ge.bottom+=c,Ls(ge,r,s,!1)?(ge.top<=s&&ge.left<=r&&(M=ve,I=ge),!0):!1},h,g),q,V,ee=!1;if(I){var ae=r-I.left<I.right-r,te=ae==v;z=M+(te?0:1),V=te?"after":"before",q=ae?I.left:I.right}else{!v&&(z==g||z==h)&&z++,V=z==0?"after":z==t.text.length?"before":bn(e,l,z-(v?1:0)).bottom+c<=s==v?"after":"before";var le=cn(e,P(i,z,V),"line",t,l);q=le.left,ee=s<le.top?-1:s>=le.bottom?1:0}return z=zt(t.text,z,1),Ts(i,z,V,ee,r-q)}function Mg(e,t,i,r,s,l,c){var h=Qt(function(_){var M=s[_],I=M.level!=1;return Ls(cn(e,P(i,I?M.to:M.from,I?"before":"after"),"line",t,r),l,c,!0)},0,s.length-1),g=s[h];if(h>0){var v=g.level!=1,C=cn(e,P(i,v?g.from:g.to,v?"after":"before"),"line",t,r);Ls(C,l,c,!0)&&C.top>c&&(g=s[h-1])}return g}function Rg(e,t,i,r,s,l,c){var h=Iu(e,t,r,c),g=h.begin,v=h.end;/\s/.test(t.text.charAt(v-1))&&v--;for(var C=null,_=null,M=0;M<s.length;M++){var I=s[M];if(!(I.from>=v||I.to<=g)){var z=I.level!=1,q=bn(e,r,z?Math.min(v,I.to)-1:Math.max(g,I.from)).right,V=q<l?l-q+1e9:q-l;(!C||_>V)&&(C=I,_=V)}}return C||(C=s[s.length-1]),C.from<g&&(C={from:g,to:C.to,level:C.level}),C.to>v&&(C={from:C.from,to:v,level:C.level}),C}var rr;function Nr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(rr==null){rr=k("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)rr.appendChild(document.createTextNode("x")),rr.appendChild(k("br"));rr.appendChild(document.createTextNode("x"))}Q(e.measure,rr);var i=rr.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),W(e.measure),i||1}function Mr(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=k("span","xxxxxxxxxx"),i=k("pre",[t],"CodeMirror-line-like");Q(e.measure,i);var r=t.getBoundingClientRect(),s=(r.right-r.left)/10;return s>2&&(e.cachedCharWidth=s),s||10}function Es(e){for(var t=e.display,i={},r={},s=t.gutters.clientLeft,l=t.gutters.firstChild,c=0;l;l=l.nextSibling,++c){var h=e.display.gutterSpecs[c].className;i[h]=l.offsetLeft+l.clientLeft+s,r[h]=l.clientWidth}return{fixedPos:Ds(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ds(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Nu(e){var t=Nr(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/Mr(e.display)-3);return function(s){if(zn(e.doc,s))return 0;var l=0;if(s.widgets)for(var c=0;c<s.widgets.length;c++)s.widgets[c].height&&(l+=s.widgets[c].height);return i?l+(Math.ceil(s.text.length/r)||1)*t:l+t}}function As(e){var t=e.doc,i=Nu(e);t.iter(function(r){var s=i(r);s!=r.height&&Kt(r,s)})}function ir(e,t,i,r){var s=e.display;if(!i&&li(t).getAttribute("cm-not-content")=="true")return null;var l,c,h=s.lineSpace.getBoundingClientRect();try{l=t.clientX-h.left,c=t.clientY-h.top}catch{return null}var g=_s(e,l,c),v;if(r&&g.xRel>0&&(v=fe(e.doc,g.line).text).length==g.ch){var C=_e(v,v.length,e.options.tabSize)-v.length;g=P(g.line,Math.max(0,Math.round((l-xu(e.display).left)/Mr(e.display))-C))}return g}function ar(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var i=e.display.view,r=0;r<i.length;r++)if(t-=i[r].size,t<0)return r}function Ot(e,t,i,r){t==null&&(t=e.doc.first),i==null&&(i=e.doc.first+e.doc.size),r||(r=0);var s=e.display;if(r&&i<s.viewTo&&(s.updateLineNumbers==null||s.updateLineNumbers>t)&&(s.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=s.viewTo)Cn&&vs(e.doc,t)<s.viewTo&&Bn(e);else if(i<=s.viewFrom)Cn&&fu(e.doc,i+r)>s.viewFrom?Bn(e):(s.viewFrom+=r,s.viewTo+=r);else if(t<=s.viewFrom&&i>=s.viewTo)Bn(e);else if(t<=s.viewFrom){var l=ga(e,i,i+r,1);l?(s.view=s.view.slice(l.index),s.viewFrom=l.lineN,s.viewTo+=r):Bn(e)}else if(i>=s.viewTo){var c=ga(e,t,t,-1);c?(s.view=s.view.slice(0,c.index),s.viewTo=c.lineN):Bn(e)}else{var h=ga(e,t,t,-1),g=ga(e,i,i+r,1);h&&g?(s.view=s.view.slice(0,h.index).concat(ca(e,h.lineN,g.lineN)).concat(s.view.slice(g.index)),s.viewTo+=r):Bn(e)}var v=s.externalMeasured;v&&(i<v.lineN?v.lineN+=r:t<v.lineN+v.size&&(s.externalMeasured=null))}function $n(e,t,i){e.curOp.viewChanged=!0;var r=e.display,s=e.display.externalMeasured;if(s&&t>=s.lineN&&t<s.lineN+s.size&&(r.externalMeasured=null),!(t<r.viewFrom||t>=r.viewTo)){var l=r.view[ar(e,t)];if(l.node!=null){var c=l.changes||(l.changes=[]);we(c,i)==-1&&c.push(i)}}}function Bn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function ga(e,t,i,r){var s=ar(e,t),l,c=e.display.view;if(!Cn||i==e.doc.first+e.doc.size)return{index:s,lineN:i};for(var h=e.display.viewFrom,g=0;g<s;g++)h+=c[g].size;if(h!=t){if(r>0){if(s==c.length-1)return null;l=h+c[s].size-t,s++}else l=h-t;t+=l,i+=l}for(;vs(e.doc,i)!=i;){if(s==(r<0?0:c.length-1))return null;i+=r*c[s-(r<0?1:0)].size,s+=r}return{index:s,lineN:i}}function Fg(e,t,i){var r=e.display,s=r.view;s.length==0||t>=r.viewTo||i<=r.viewFrom?(r.view=ca(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=ca(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(ar(e,t))),r.viewFrom=t,r.viewTo<i?r.view=r.view.concat(ca(e,r.viewTo,i)):r.viewTo>i&&(r.view=r.view.slice(0,ar(e,i)))),r.viewTo=i}function Mu(e){for(var t=e.display.view,i=0,r=0;r<t.length;r++){var s=t[r];!s.hidden&&(!s.node||s.changes)&&++i}return i}function yi(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Ru(e,t){t===void 0&&(t=!0);var i=e.doc,r={},s=r.cursors=document.createDocumentFragment(),l=r.selection=document.createDocumentFragment(),c=e.options.$customCursor;c&&(t=!0);for(var h=0;h<i.sel.ranges.length;h++)if(!(!t&&h==i.sel.primIndex)){var g=i.sel.ranges[h];if(!(g.from().line>=e.display.viewTo||g.to().line<e.display.viewFrom)){var v=g.empty();if(c){var C=c(e,g);C&&Is(e,C,s)}else(v||e.options.showCursorWhenSelecting)&&Is(e,g.head,s);v||Pg(e,g,l)}}return r}function Is(e,t,i){var r=cn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),s=i.appendChild(k("div"," ","CodeMirror-cursor"));if(s.style.left=r.left+"px",s.style.top=r.top+"px",s.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",/\bcm-fat-cursor\b/.test(e.getWrapperElement().className)){var l=pa(e,t,"div",null,null),c=l.right-l.left;s.style.width=(c>0?c:e.defaultCharWidth())+"px"}if(r.other){var h=i.appendChild(k("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));h.style.display="",h.style.left=r.other.left+"px",h.style.top=r.other.top+"px",h.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function ma(e,t){return e.top-t.top||e.left-t.left}function Pg(e,t,i){var r=e.display,s=e.doc,l=document.createDocumentFragment(),c=xu(e.display),h=c.left,g=Math.max(r.sizerWidth,nr(e)-r.sizer.offsetLeft)-c.right,v=s.direction=="ltr";function C(te,le,ve,ge){le<0&&(le=0),le=Math.round(le),ge=Math.round(ge),l.appendChild(k("div",null,"CodeMirror-selected","position: absolute; left: "+te+`px;
6
6
  top: `+le+"px; width: "+(ve??g-te)+`px;
7
- height: `+(ge-le)+"px"))}function _(te,le,ve){var ge=fe(s,te),Ae=ge.text.length,Ue,xt;function Qe(lt,Rt){return pa(e,P(te,lt),"div",ge,Rt)}function Ht(lt,Rt,St){var pt=Eu(e,ge,null,lt),ut=Rt=="ltr"==(St=="after")?"left":"right",rt=St=="after"?pt.begin:pt.end-(/\s/.test(ge.text.charAt(pt.end-1))?2:1);return Qe(rt,ut)[ut]}var Mt=Pe(ge,s.direction);return On(Mt,le||0,ve??Ae,function(lt,Rt,St,pt){var ut=St=="ltr",rt=Qe(lt,ut?"left":"right"),Ft=Qe(Rt-1,ut?"right":"left"),Kr=le==null&&lt==0,Gn=ve==null&&Rt==Ae,Lt=pt==0,bn=!Mt||pt==Mt.length-1;if(Ft.top-rt.top<=3){var wt=(v?Kr:Gn)&&Lt,io=(v?Gn:Kr)&&bn,Dn=wt?h:(ut?rt:Ft).left,fr=io?g:(ut?Ft:rt).right;C(Dn,rt.top,fr-Dn,rt.bottom)}else{var cr,Dt,Xr,ao;ut?(cr=v&&Kr&&Lt?h:rt.left,Dt=v?g:Ht(lt,St,"before"),Xr=v?h:Ht(Rt,St,"after"),ao=v&&Gn&&bn?g:Ft.right):(cr=v?Ht(lt,St,"before"):h,Dt=!v&&Kr&&Lt?g:rt.right,Xr=!v&&Gn&&bn?h:Ft.left,ao=v?Ht(Rt,St,"after"):g),C(cr,rt.top,Dt-cr,rt.bottom),rt.bottom<Ft.top&&C(h,rt.bottom,null,Ft.top),C(Xr,Ft.top,ao-Xr,Ft.bottom)}(!Ue||ma(rt,Ue)<0)&&(Ue=rt),ma(Ft,Ue)<0&&(Ue=Ft),(!xt||ma(rt,xt)<0)&&(xt=rt),ma(Ft,xt)<0&&(xt=Ft)}),{start:Ue,end:xt}}var M=t.from(),I=t.to();if(M.line==I.line)_(M.line,M.ch,I.ch);else{var z=fe(s,M.line),U=fe(s,I.line),V=un(z)==un(U),ee=_(M.line,M.ch,V?z.text.length+1:null).end,ae=_(I.line,V?0:null,I.ch).start;V&&(ee.top<ae.top-2?(C(ee.right,ee.top,null,ee.bottom),C(h,ae.top,ae.left,ae.bottom)):C(ee.right,ee.top,ae.left-ee.right,ee.bottom)),ee.bottom<ae.top&&C(h,ee.bottom,null,ae.top)}i.appendChild(l)}function Os(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var i=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Rr(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Ou(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Ms(e))}function Ns(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&Rr(e))},100)}function Ms(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(et(e,"focus",e,t),e.state.focused=!0,K(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),S&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Os(e))}function Rr(e,t){e.state.delayingBlurEvent||(e.state.focused&&(et(e,"blur",e,t),e.state.focused=!1,ze(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function va(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),s=t.lineDiv.getBoundingClientRect().top,l=0,c=0;c<t.view.length;c++){var h=t.view[c],g=e.options.lineWrapping,v=void 0,C=0;if(!h.hidden){if(s+=h.line.height,m&&x<8){var _=h.node.offsetTop+h.node.offsetHeight;v=_-i,i=_}else{var M=h.node.getBoundingClientRect();v=M.bottom-M.top,!g&&h.text.firstChild&&(C=h.text.firstChild.getBoundingClientRect().right-M.left-1)}var I=h.line.height-v;if((I>.005||I<-.005)&&(s<r&&(l-=I),Kt(h.line,v),Nu(h.line),h.rest))for(var z=0;z<h.rest.length;z++)Nu(h.rest[z]);if(C>e.display.sizerWidth){var U=Math.ceil(C/Mr(e.display));U>e.display.maxLineLength&&(e.display.maxLineLength=U,e.display.maxLine=h.line,e.display.maxLineChanged=!0)}}}Math.abs(l)>2&&(t.scroller.scrollTop+=l)}function Nu(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var i=e.widgets[t],r=i.node.parentNode;r&&(i.height=r.offsetHeight)}}function ya(e,t,i){var r=i&&i.top!=null?Math.max(0,i.top):e.scroller.scrollTop;r=Math.floor(r-ha(e));var s=i&&i.bottom!=null?i.bottom:r+e.wrapper.clientHeight,l=T(t,r),c=T(t,s);if(i&&i.ensure){var h=i.ensure.from.line,g=i.ensure.to.line;h<l?(l=h,c=T(t,Tn(fe(t,h))+e.wrapper.clientHeight)):Math.min(g,t.lastLine())>=c&&(l=T(t,Tn(fe(t,g))-e.wrapper.clientHeight),c=g)}return{from:l,to:Math.max(c,l+1)}}function Fg(e,t){if(!tt(e,"scrollCursorIntoView")){var i=e.display,r=i.sizer.getBoundingClientRect(),s=null,l=i.wrapper.ownerDocument;if(t.top+r.top<0?s=!0:t.bottom+r.top>(l.defaultView.innerHeight||l.documentElement.clientHeight)&&(s=!1),s!=null&&!N){var c=k("div","​",null,`position: absolute;
7
+ height: `+(ge-le)+"px"))}function _(te,le,ve){var ge=fe(s,te),Ae=ge.text.length,qe,xt;function Qe(lt,Rt){return pa(e,P(te,lt),"div",ge,Rt)}function Ht(lt,Rt,St){var pt=Ou(e,ge,null,lt),ut=Rt=="ltr"==(St=="after")?"left":"right",rt=St=="after"?pt.begin:pt.end-(/\s/.test(ge.text.charAt(pt.end-1))?2:1);return Qe(rt,ut)[ut]}var Mt=Pe(ge,s.direction);return On(Mt,le||0,ve??Ae,function(lt,Rt,St,pt){var ut=St=="ltr",rt=Qe(lt,ut?"left":"right"),Ft=Qe(Rt-1,ut?"right":"left"),Kr=le==null&&lt==0,Gn=ve==null&&Rt==Ae,Lt=pt==0,xn=!Mt||pt==Mt.length-1;if(Ft.top-rt.top<=3){var wt=(v?Kr:Gn)&&Lt,io=(v?Gn:Kr)&&xn,Dn=wt?h:(ut?rt:Ft).left,fr=io?g:(ut?Ft:rt).right;C(Dn,rt.top,fr-Dn,rt.bottom)}else{var cr,Dt,Xr,ao;ut?(cr=v&&Kr&&Lt?h:rt.left,Dt=v?g:Ht(lt,St,"before"),Xr=v?h:Ht(Rt,St,"after"),ao=v&&Gn&&xn?g:Ft.right):(cr=v?Ht(lt,St,"before"):h,Dt=!v&&Kr&&Lt?g:rt.right,Xr=!v&&Gn&&xn?h:Ft.left,ao=v?Ht(Rt,St,"after"):g),C(cr,rt.top,Dt-cr,rt.bottom),rt.bottom<Ft.top&&C(h,rt.bottom,null,Ft.top),C(Xr,Ft.top,ao-Xr,Ft.bottom)}(!qe||ma(rt,qe)<0)&&(qe=rt),ma(Ft,qe)<0&&(qe=Ft),(!xt||ma(rt,xt)<0)&&(xt=rt),ma(Ft,xt)<0&&(xt=Ft)}),{start:qe,end:xt}}var M=t.from(),I=t.to();if(M.line==I.line)_(M.line,M.ch,I.ch);else{var z=fe(s,M.line),q=fe(s,I.line),V=fn(z)==fn(q),ee=_(M.line,M.ch,V?z.text.length+1:null).end,ae=_(I.line,V?0:null,I.ch).start;V&&(ee.top<ae.top-2?(C(ee.right,ee.top,null,ee.bottom),C(h,ae.top,ae.left,ae.bottom)):C(ee.right,ee.top,ae.left-ee.right,ee.bottom)),ee.bottom<ae.top&&C(h,ee.bottom,null,ae.top)}i.appendChild(l)}function Os(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var i=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Rr(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Fu(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Ms(e))}function Ns(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&Rr(e))},100)}function Ms(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(et(e,"focus",e,t),e.state.focused=!0,K(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),S&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Os(e))}function Rr(e,t){e.state.delayingBlurEvent||(e.state.focused&&(et(e,"blur",e,t),e.state.focused=!1,ze(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function va(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),s=t.lineDiv.getBoundingClientRect().top,l=0,c=0;c<t.view.length;c++){var h=t.view[c],g=e.options.lineWrapping,v=void 0,C=0;if(!h.hidden){if(s+=h.line.height,m&&x<8){var _=h.node.offsetTop+h.node.offsetHeight;v=_-i,i=_}else{var M=h.node.getBoundingClientRect();v=M.bottom-M.top,!g&&h.text.firstChild&&(C=h.text.firstChild.getBoundingClientRect().right-M.left-1)}var I=h.line.height-v;if((I>.005||I<-.005)&&(s<r&&(l-=I),Kt(h.line,v),Pu(h.line),h.rest))for(var z=0;z<h.rest.length;z++)Pu(h.rest[z]);if(C>e.display.sizerWidth){var q=Math.ceil(C/Mr(e.display));q>e.display.maxLineLength&&(e.display.maxLineLength=q,e.display.maxLine=h.line,e.display.maxLineChanged=!0)}}}Math.abs(l)>2&&(t.scroller.scrollTop+=l)}function Pu(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var i=e.widgets[t],r=i.node.parentNode;r&&(i.height=r.offsetHeight)}}function ya(e,t,i){var r=i&&i.top!=null?Math.max(0,i.top):e.scroller.scrollTop;r=Math.floor(r-ha(e));var s=i&&i.bottom!=null?i.bottom:r+e.wrapper.clientHeight,l=T(t,r),c=T(t,s);if(i&&i.ensure){var h=i.ensure.from.line,g=i.ensure.to.line;h<l?(l=h,c=T(t,Tn(fe(t,h))+e.wrapper.clientHeight)):Math.min(g,t.lastLine())>=c&&(l=T(t,Tn(fe(t,g))-e.wrapper.clientHeight),c=g)}return{from:l,to:Math.max(c,l+1)}}function zg(e,t){if(!tt(e,"scrollCursorIntoView")){var i=e.display,r=i.sizer.getBoundingClientRect(),s=null,l=i.wrapper.ownerDocument;if(t.top+r.top<0?s=!0:t.bottom+r.top>(l.defaultView.innerHeight||l.documentElement.clientHeight)&&(s=!1),s!=null&&!N){var c=k("div","​",null,`position: absolute;
8
8
  top: `+(t.top-i.viewOffset-ha(e.display))+`px;
9
- height: `+(t.bottom-t.top+vn(e)+i.barHeight)+`px;
10
- left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(c),c.scrollIntoView(s),e.display.lineSpace.removeChild(c)}}}function Pg(e,t,i,r){r==null&&(r=0);var s;!e.options.lineWrapping&&t==i&&(i=t.sticky=="before"?P(t.line,t.ch+1,"before"):t,t=t.ch?P(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var l=0;l<5;l++){var c=!1,h=fn(e,t),g=!i||i==t?h:fn(e,i);s={left:Math.min(h.left,g.left),top:Math.min(h.top,g.top)-r,right:Math.max(h.left,g.left),bottom:Math.max(h.bottom,g.bottom)+r};var v=Rs(e,s),C=e.doc.scrollTop,_=e.doc.scrollLeft;if(v.scrollTop!=null&&(xi(e,v.scrollTop),Math.abs(e.doc.scrollTop-C)>1&&(c=!0)),v.scrollLeft!=null&&(sr(e,v.scrollLeft),Math.abs(e.doc.scrollLeft-_)>1&&(c=!0)),!c)break}return s}function zg(e,t){var i=Rs(e,t);i.scrollTop!=null&&xi(e,i.scrollTop),i.scrollLeft!=null&&sr(e,i.scrollLeft)}function Rs(e,t){var i=e.display,r=Nr(e.display);t.top<0&&(t.top=0);var s=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,l=ks(e),c={};t.bottom-t.top>l&&(t.bottom=t.top+l);var h=e.doc.height+ws(i),g=t.top<r,v=t.bottom>h-r;if(t.top<s)c.scrollTop=g?0:t.top;else if(t.bottom>s+l){var C=Math.min(t.top,(v?h:t.bottom)-l);C!=s&&(c.scrollTop=C)}var _=e.options.fixedGutter?0:i.gutters.offsetWidth,M=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-_,I=nr(e)-i.gutters.offsetWidth,z=t.right-t.left>I;return z&&(t.right=t.left+I),t.left<10?c.scrollLeft=0:t.left<M?c.scrollLeft=Math.max(0,t.left+_-(z?0:10)):t.right>I+M-3&&(c.scrollLeft=t.right+(z?0:10)-I),c}function Fs(e,t){t!=null&&(ba(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Fr(e){ba(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function bi(e,t,i){(t!=null||i!=null)&&ba(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function $g(e,t){ba(e),e.curOp.scrollToPos=t}function ba(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=_u(e,t.from),r=_u(e,t.to);Mu(e,i,r,t.margin)}}function Mu(e,t,i,r){var s=Rs(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-r,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+r});bi(e,s.scrollLeft,s.scrollTop)}function xi(e,t){Math.abs(e.doc.scrollTop-t)<2||(f||zs(e,{top:t}),Ru(e,t,!0),f&&zs(e),Si(e,100))}function Ru(e,t,i){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),!(e.display.scroller.scrollTop==t&&!i)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function sr(e,t,i,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),!((i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)&&(e.doc.scrollLeft=t,Bu(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function wi(e){var t=e.display,i=t.gutters.offsetWidth,r=Math.round(e.doc.height+ws(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?i:0,docHeight:r,scrollHeight:r+vn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var or=function(e,t,i){this.cm=i;var r=this.vert=k("div",[k("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),s=this.horiz=k("div",[k("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=s.tabIndex=-1,e(r),e(s),me(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),me(s,"scroll",function(){s.clientWidth&&t(s.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,m&&x<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};or.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var s=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+s)+"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=i?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var l=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+l)+"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:i?r:0,bottom:t?r:0}},or.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},or.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},or.prototype.zeroWidthHack=function(){var e=ne&&!F?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new ft,this.disableVert=new ft},or.prototype.enableZeroWidthBar=function(e,t,i){e.style.visibility="";function r(){var s=e.getBoundingClientRect(),l=i=="vert"?document.elementFromPoint(s.right-1,(s.top+s.bottom)/2):document.elementFromPoint((s.right+s.left)/2,s.bottom-1);l!=e?e.style.visibility="hidden":t.set(1e3,r)}t.set(1e3,r)},or.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ki=function(){};ki.prototype.update=function(){return{bottom:0,right:0}},ki.prototype.setScrollLeft=function(){},ki.prototype.setScrollTop=function(){},ki.prototype.clear=function(){};function Pr(e,t){t||(t=wi(e));var i=e.display.barWidth,r=e.display.barHeight;Fu(e,t);for(var s=0;s<4&&i!=e.display.barWidth||r!=e.display.barHeight;s++)i!=e.display.barWidth&&e.options.lineWrapping&&va(e),Fu(e,wi(e)),i=e.display.barWidth,r=e.display.barHeight}function Fu(e,t){var i=e.display,r=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=r.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=r.bottom)+"px",i.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=r.bottom+"px",i.scrollbarFiller.style.width=r.right+"px"):i.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=r.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}var Pu={native:or,null:ki};function zu(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&ze(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Pu[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),me(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?sr(e,t):xi(e,t)},e),e.display.scrollbars.addClass&&K(e.display.wrapper,e.display.scrollbars.addClass)}var Bg=0;function lr(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:++Bg,markArrays:null},vg(e.curOp)}function ur(e){var t=e.curOp;t&&bg(t,function(i){for(var r=0;r<i.ops.length;r++)i.ops[r].cm.curOp=null;Hg(i)})}function Hg(e){for(var t=e.ops,i=0;i<t.length;i++)Wg(t[i]);for(var r=0;r<t.length;r++)jg(t[r]);for(var s=0;s<t.length;s++)Ug(t[s]);for(var l=0;l<t.length;l++)qg(t[l]);for(var c=0;c<t.length;c++)Gg(t[c])}function Wg(e){var t=e.cm,i=t.display;Xg(t),e.updateMaxLine&&bs(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<i.viewFrom||e.scrollToPos.to.line>=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new xa(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function jg(e){e.updatedDisplay=e.mustUpdate&&Ps(e.cm,e.update)}function Ug(e){var t=e.cm,i=t.display;e.updatedDisplay&&va(t),e.barMeasure=wi(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=yu(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+vn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-nr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function qg(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&sr(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var i=e.focus&&e.focus==R(oe(t));e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,i),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Pr(t,e.barMeasure),e.updatedDisplay&&Bs(t,e.barMeasure),e.selectionChanged&&Os(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),i&&Ou(e.cm)}function Gg(e){var t=e.cm,i=t.display,r=t.doc;if(e.updatedDisplay&&$u(t,e.update),i.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(i.wheelStartX=i.wheelStartY=null),e.scrollTop!=null&&Ru(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&sr(t,e.scrollLeft,!0,!0),e.scrollToPos){var s=Pg(t,Se(r,e.scrollToPos.from),Se(r,e.scrollToPos.to),e.scrollToPos.margin);Fg(t,s)}var l=e.maybeHiddenMarkers,c=e.maybeUnhiddenMarkers;if(l)for(var h=0;h<l.length;++h)l[h].lines.length||et(l[h],"hide");if(c)for(var g=0;g<c.length;++g)c[g].lines.length&&et(c[g],"unhide");i.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&et(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Bt(e,t){if(e.curOp)return t();lr(e);try{return t()}finally{ur(e)}}function yt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);lr(e);try{return t.apply(e,arguments)}finally{ur(e)}}}function Et(e){return function(){if(this.curOp)return e.apply(this,arguments);lr(this);try{return e.apply(this,arguments)}finally{ur(this)}}}function bt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);lr(t);try{return e.apply(this,arguments)}finally{ur(t)}}}function Si(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,ce(Kg,e))}function Kg(e){var t=e.doc;if(!(t.highlightFrontier>=e.display.viewTo)){var i=+new Date+e.options.workTime,r=hi(e,t.highlightFrontier),s=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(l){if(r.line>=e.display.viewFrom){var c=l.styles,h=l.text.length>e.options.maxHighlightLength?gn(t.mode,r.state):null,g=Gl(e,l,r,!0);h&&(r.state=h),l.styles=g.styles;var v=l.styleClasses,C=g.classes;C?l.styleClasses=C:v&&(l.styleClasses=null);for(var _=!c||c.length!=l.styles.length||v!=C&&(!v||!C||v.bgClass!=C.bgClass||v.textClass!=C.textClass),M=0;!_&&M<c.length;++M)_=c[M]!=l.styles[M];_&&s.push(r.line),l.stateAfter=r.save(),r.nextLine()}else l.text.length<=e.options.maxHighlightLength&&ds(e,l.text,r),l.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>i)return Si(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),s.length&&Bt(e,function(){for(var l=0;l<s.length;l++)$n(e,s[l],"text")})}}var xa=function(e,t,i){var r=e.display;this.viewport=t,this.visible=ya(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=nr(e),this.force=i,this.dims=Es(e),this.events=[]};xa.prototype.signal=function(e,t){$t(e,t)&&this.events.push(arguments)},xa.prototype.finish=function(){for(var e=0;e<this.events.length;e++)et.apply(null,this.events[e])};function Xg(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=vn(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=vn(e)+"px",t.scrollbarsClipped=!0)}function Yg(e){if(e.hasFocus())return null;var t=R(oe(e));if(!t||!D(e.display.lineDiv,t))return null;var i={activeElt:t};if(window.getSelection){var r=Z(e).getSelection();r.anchorNode&&r.extend&&D(e.display.lineDiv,r.anchorNode)&&(i.anchorNode=r.anchorNode,i.anchorOffset=r.anchorOffset,i.focusNode=r.focusNode,i.focusOffset=r.focusOffset)}return i}function Vg(e){if(!(!e||!e.activeElt||e.activeElt==R(Te(e.activeElt)))&&(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&D(document.body,e.anchorNode)&&D(document.body,e.focusNode))){var t=e.activeElt.ownerDocument,i=t.defaultView.getSelection(),r=t.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),i.removeAllRanges(),i.addRange(r),i.extend(e.focusNode,e.focusOffset)}}function Ps(e,t){var i=e.display,r=e.doc;if(t.editorIsHidden)return Bn(e),!1;if(!t.force&&t.visible.from>=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&Au(e)==0)return!1;Hu(e)&&(Bn(e),t.dims=Es(e));var s=r.first+r.size,l=Math.max(t.visible.from-e.options.viewportMargin,r.first),c=Math.min(s,t.visible.to+e.options.viewportMargin);i.viewFrom<l&&l-i.viewFrom<20&&(l=Math.max(r.first,i.viewFrom)),i.viewTo>c&&i.viewTo-c<20&&(c=Math.min(s,i.viewTo)),Cn&&(l=vs(e.doc,l),c=su(e.doc,c));var h=l!=i.viewFrom||c!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Mg(e,l,c),i.viewOffset=Tn(fe(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var g=Au(e);if(!h&&g==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var v=Yg(e);return g>4&&(i.lineDiv.style.display="none"),Jg(e,i.updateLineNumbers,t.dims),g>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,Vg(v),H(i.cursorDiv),H(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,h&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,Si(e,400)),i.updateLineNumbers=null,!0}function $u(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==nr(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+ws(e.display)-ks(e),i.top)}),t.visible=ya(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=ya(e.display,e.doc,i));if(!Ps(e,t))break;va(e);var s=wi(e);yi(e),Pr(e,s),Bs(e,s),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 zs(e,t){var i=new xa(e,t);if(Ps(e,i)){va(e),$u(e,i);var r=wi(e);yi(e),Pr(e,r),Bs(e,r),i.finish()}}function Jg(e,t,i){var r=e.display,s=e.options.lineNumbers,l=r.lineDiv,c=l.firstChild;function h(z){var U=z.nextSibling;return S&&ne&&e.display.currentWheelTarget==z?z.style.display="none":z.parentNode.removeChild(z),U}for(var g=r.view,v=r.viewFrom,C=0;C<g.length;C++){var _=g[C];if(!_.hidden)if(!_.node||_.node.parentNode!=l){var M=Cg(e,_,v,i);l.insertBefore(M,c)}else{for(;c!=_.node;)c=h(c);var I=s&&t!=null&&t<=v&&_.lineNumber;_.changes&&(we(_.changes,"gutter")>-1&&(I=!1),cu(e,_,v,i)),I&&(H(_.lineNumber),_.lineNumber.appendChild(document.createTextNode(Y(e.options,v)))),c=_.node.nextSibling}v+=_.size}for(;c;)c=h(c)}function $s(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",vt(e,"gutterChanged",e)}function Bs(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+vn(e)+"px"}function Bu(e){var t=e.display,i=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var r=Ds(t)-t.scroller.scrollLeft+e.doc.scrollLeft,s=t.gutters.offsetWidth,l=r+"px",c=0;c<i.length;c++)if(!i[c].hidden){e.options.fixedGutter&&(i[c].gutter&&(i[c].gutter.style.left=l),i[c].gutterBackground&&(i[c].gutterBackground.style.left=l));var h=i[c].alignable;if(h)for(var g=0;g<h.length;g++)h[g].style.left=l}e.options.fixedGutter&&(t.gutters.style.left=r+s+"px")}}function Hu(e){if(!e.options.lineNumbers)return!1;var t=e.doc,i=Y(e.options,t.first+t.size-1),r=e.display;if(i.length!=r.lineNumChars){var s=r.measure.appendChild(k("div",[k("div",i)],"CodeMirror-linenumber CodeMirror-gutter-elt")),l=s.firstChild.offsetWidth,c=s.offsetWidth-l;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(l,r.lineGutter.offsetWidth-c)+1,r.lineNumWidth=r.lineNumInnerWidth+c,r.lineNumChars=r.lineNumInnerWidth?i.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",$s(e.display),!0}return!1}function Hs(e,t){for(var i=[],r=!1,s=0;s<e.length;s++){var l=e[s],c=null;if(typeof l!="string"&&(c=l.style,l=l.className),l=="CodeMirror-linenumbers")if(t)r=!0;else continue;i.push({className:l,style:c})}return t&&!r&&i.push({className:"CodeMirror-linenumbers",style:null}),i}function Wu(e){var t=e.gutters,i=e.gutterSpecs;H(t),e.lineGutter=null;for(var r=0;r<i.length;++r){var s=i[r],l=s.className,c=s.style,h=t.appendChild(k("div",null,"CodeMirror-gutter "+l));c&&(h.style.cssText=c),l=="CodeMirror-linenumbers"&&(e.lineGutter=h,h.style.width=(e.lineNumWidth||1)+"px")}t.style.display=i.length?"":"none",$s(e)}function Ci(e){Wu(e.display),Ot(e),Bu(e)}function Qg(e,t,i,r){var s=this;this.input=i,s.scrollbarFiller=k("div",null,"CodeMirror-scrollbar-filler"),s.scrollbarFiller.setAttribute("cm-not-content","true"),s.gutterFiller=k("div",null,"CodeMirror-gutter-filler"),s.gutterFiller.setAttribute("cm-not-content","true"),s.lineDiv=J("div",null,"CodeMirror-code"),s.selectionDiv=k("div",null,null,"position: relative; z-index: 1"),s.cursorDiv=k("div",null,"CodeMirror-cursors"),s.measure=k("div",null,"CodeMirror-measure"),s.lineMeasure=k("div",null,"CodeMirror-measure"),s.lineSpace=J("div",[s.measure,s.lineMeasure,s.selectionDiv,s.cursorDiv,s.lineDiv],null,"position: relative; outline: none");var l=J("div",[s.lineSpace],"CodeMirror-lines");s.mover=k("div",[l],null,"position: relative"),s.sizer=k("div",[s.mover],"CodeMirror-sizer"),s.sizerWidth=null,s.heightForcer=k("div",null,null,"position: absolute; height: "+Me+"px; width: 1px;"),s.gutters=k("div",null,"CodeMirror-gutters"),s.lineGutter=null,s.scroller=k("div",[s.sizer,s.heightForcer,s.gutters],"CodeMirror-scroll"),s.scroller.setAttribute("tabIndex","-1"),s.wrapper=k("div",[s.scrollbarFiller,s.gutterFiller,s.scroller],"CodeMirror"),E&&W===105&&(s.wrapper.style.clipPath="inset(0px)"),s.wrapper.setAttribute("translate","no"),m&&x<8&&(s.gutters.style.zIndex=-1,s.scroller.style.paddingRight=0),!S&&!(f&&X)&&(s.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(s.wrapper):e(s.wrapper)),s.viewFrom=s.viewTo=t.first,s.reportedViewFrom=s.reportedViewTo=t.first,s.view=[],s.renderedView=null,s.externalMeasured=null,s.viewOffset=0,s.lastWrapHeight=s.lastWrapWidth=0,s.updateLineNumbers=null,s.nativeBarWidth=s.barHeight=s.barWidth=0,s.scrollbarsClipped=!1,s.lineNumWidth=s.lineNumInnerWidth=s.lineNumChars=null,s.alignWidgets=!1,s.cachedCharWidth=s.cachedTextHeight=s.cachedPaddingH=null,s.maxLine=null,s.maxLineLength=0,s.maxLineChanged=!1,s.wheelDX=s.wheelDY=s.wheelStartX=s.wheelStartY=null,s.shift=!1,s.selForContextMenu=null,s.activeTouch=null,s.gutterSpecs=Hs(r.gutters,r.lineNumbers),Wu(s),i.init(s)}var wa=0,Ln=null;m?Ln=-.53:f?Ln=15:E?Ln=-.7:q&&(Ln=-1/3);function ju(e){var t=e.wheelDeltaX,i=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),i==null&&e.detail&&e.axis==e.VERTICAL_AXIS?i=e.detail:i==null&&(i=e.wheelDelta),{x:t,y:i}}function Zg(e){var t=ju(e);return t.x*=Ln,t.y*=Ln,t}function Uu(e,t){E&&W==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 i=ju(t),r=i.x,s=i.y,l=Ln;t.deltaMode===0&&(r=t.deltaX,s=t.deltaY,l=1);var c=e.display,h=c.scroller,g=h.scrollWidth>h.clientWidth,v=h.scrollHeight>h.clientHeight;if(r&&g||s&&v){if(s&&ne&&S){e:for(var C=t.target,_=c.view;C!=h;C=C.parentNode)for(var M=0;M<_.length;M++)if(_[M].node==C){e.display.currentWheelTarget=C;break e}}if(r&&!f&&!B&&l!=null){s&&v&&xi(e,Math.max(0,h.scrollTop+s*l)),sr(e,Math.max(0,h.scrollLeft+r*l)),(!s||s&&v)&&Tt(t),c.wheelStartX=null;return}if(s&&l!=null){var I=s*l,z=e.doc.scrollTop,U=z+c.wrapper.clientHeight;I<0?z=Math.max(0,z+I-50):U=Math.min(e.doc.height,U+I+50),zs(e,{top:z,bottom:U})}wa<20&&t.deltaMode!==0&&(c.wheelStartX==null?(c.wheelStartX=h.scrollLeft,c.wheelStartY=h.scrollTop,c.wheelDX=r,c.wheelDY=s,setTimeout(function(){if(c.wheelStartX!=null){var V=h.scrollLeft-c.wheelStartX,ee=h.scrollTop-c.wheelStartY,ae=ee&&c.wheelDY&&ee/c.wheelDY||V&&c.wheelDX&&V/c.wheelDX;c.wheelStartX=c.wheelStartY=null,ae&&(Ln=(Ln*wa+ae)/(wa+1),++wa)}},200)):(c.wheelDX+=r,c.wheelDY+=s))}}var Xt=function(e,t){this.ranges=e,this.primIndex=t};Xt.prototype.primary=function(){return this.ranges[this.primIndex]},Xt.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 i=this.ranges[t],r=e.ranges[t];if(!$e(i.anchor,r.anchor)||!$e(i.head,r.head))return!1}return!0},Xt.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Be(mt(this.ranges[t].anchor),mt(this.ranges[t].head));return new Xt(e,this.primIndex)},Xt.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Xt.prototype.contains=function(e,t){t||(t=e);for(var i=0;i<this.ranges.length;i++){var r=this.ranges[i];if(re(t,r.from())>=0&&re(e,r.to())<=0)return i}return-1};var Be=function(e,t){this.anchor=e,this.head=t};Be.prototype.from=function(){return Dr(this.anchor,this.head)},Be.prototype.to=function(){return It(this.anchor,this.head)},Be.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function cn(e,t,i){var r=e&&e.options.selectionsMayTouch,s=t[i];t.sort(function(M,I){return re(M.from(),I.from())}),i=we(t,s);for(var l=1;l<t.length;l++){var c=t[l],h=t[l-1],g=re(h.to(),c.from());if(r&&!c.empty()?g>0:g>=0){var v=Dr(h.from(),c.from()),C=It(h.to(),c.to()),_=h.empty()?c.from()==c.head:h.from()==h.head;l<=i&&--i,t.splice(--l,2,new Be(_?C:v,_?v:C))}}return new Xt(t,i)}function Hn(e,t){return new Xt([new Be(e,t||e)],0)}function Wn(e){return e.text?P(e.from.line+e.text.length-1,be(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function qu(e,t){if(re(e,t.from)<0)return e;if(re(e,t.to)<=0)return Wn(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Wn(t).ch-t.to.ch),P(i,r)}function Ws(e,t){for(var i=[],r=0;r<e.sel.ranges.length;r++){var s=e.sel.ranges[r];i.push(new Be(qu(s.anchor,t),qu(s.head,t)))}return cn(e.cm,i,e.sel.primIndex)}function Gu(e,t,i){return e.line==t.line?P(i.line,e.ch-t.ch+i.ch):P(i.line+(e.line-t.line),e.ch)}function em(e,t,i){for(var r=[],s=P(e.first,0),l=s,c=0;c<t.length;c++){var h=t[c],g=Gu(h.from,s,l),v=Gu(Wn(h),s,l);if(s=h.to,l=v,i=="around"){var C=e.sel.ranges[c],_=re(C.head,C.anchor)<0;r[c]=new Be(_?v:g,_?g:v)}else r[c]=new Be(g,g)}return new Xt(r,e.sel.primIndex)}function js(e){e.doc.mode=_r(e.options,e.doc.modeOption),Ti(e)}function Ti(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,Si(e,100),e.state.modeGen++,e.curOp&&Ot(e)}function Ku(e,t){return t.from.ch==0&&t.to.ch==0&&be(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Us(e,t,i,r){function s(ae){return i?i[ae]:null}function l(ae,te,le){lg(ae,te,le,r),vt(ae,"change",ae,t)}function c(ae,te){for(var le=[],ve=ae;ve<te;++ve)le.push(new Ar(v[ve],s(ve),r));return le}var h=t.from,g=t.to,v=t.text,C=fe(e,h.line),_=fe(e,g.line),M=be(v),I=s(v.length-1),z=g.line-h.line;if(t.full)e.insert(0,c(0,v.length)),e.remove(v.length,e.size-v.length);else if(Ku(e,t)){var U=c(0,v.length-1);l(_,_.text,I),z&&e.remove(h.line,z),U.length&&e.insert(h.line,U)}else if(C==_)if(v.length==1)l(C,C.text.slice(0,h.ch)+M+C.text.slice(g.ch),I);else{var V=c(1,v.length-1);V.push(new Ar(M+C.text.slice(g.ch),I,r)),l(C,C.text.slice(0,h.ch)+v[0],s(0)),e.insert(h.line+1,V)}else if(v.length==1)l(C,C.text.slice(0,h.ch)+v[0]+_.text.slice(g.ch),s(0)),e.remove(h.line+1,z);else{l(C,C.text.slice(0,h.ch)+v[0],s(0)),l(_,M+_.text.slice(g.ch),I);var ee=c(1,v.length-1);z>1&&e.remove(h.line+1,z-1),e.insert(h.line+1,ee)}vt(e,"change",e,t)}function jn(e,t,i){function r(s,l,c){if(s.linked)for(var h=0;h<s.linked.length;++h){var g=s.linked[h];if(g.doc!=l){var v=c&&g.sharedHist;i&&!v||(t(g.doc,v),r(g.doc,s,v))}}}r(e,null,!0)}function Xu(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,As(e),js(e),Yu(e),e.options.direction=t.direction,e.options.lineWrapping||bs(e),e.options.mode=t.modeOption,Ot(e)}function Yu(e){(e.doc.direction=="rtl"?K:ze)(e.display.lineDiv,"CodeMirror-rtl")}function tm(e){Bt(e,function(){Yu(e),Ot(e)})}function ka(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 qs(e,t){var i={from:mt(t.from),to:Wn(t),text:Sn(e,t.from,t.to)};return Qu(e,i,t.from.line,t.to.line+1),jn(e,function(r){return Qu(r,i,t.from.line,t.to.line+1)},!0),i}function Vu(e){for(;e.length;){var t=be(e);if(t.ranges)e.pop();else break}}function nm(e,t){if(t)return Vu(e.done),be(e.done);if(e.done.length&&!be(e.done).ranges)return be(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),be(e.done)}function Ju(e,t,i,r){var s=e.history;s.undone.length=0;var l=+new Date,c,h;if((s.lastOp==r||s.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&s.lastModTime>l-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(c=nm(s,s.lastOp==r)))h=be(c.changes),re(t.from,t.to)==0&&re(t.from,h.to)==0?h.to=Wn(t):c.changes.push(qs(e,t));else{var g=be(s.done);for((!g||!g.ranges)&&Sa(e.sel,s.done),c={changes:[qs(e,t)],generation:s.generation},s.done.push(c);s.done.length>s.undoDepth;)s.done.shift(),s.done[0].ranges||s.done.shift()}s.done.push(i),s.generation=++s.maxGeneration,s.lastModTime=s.lastSelTime=l,s.lastOp=s.lastSelOp=r,s.lastOrigin=s.lastSelOrigin=t.origin,h||et(e,"historyAdded")}function rm(e,t,i,r){var s=t.charAt(0);return s=="*"||s=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function im(e,t,i,r){var s=e.history,l=r&&r.origin;i==s.lastSelOp||l&&s.lastSelOrigin==l&&(s.lastModTime==s.lastSelTime&&s.lastOrigin==l||rm(e,l,be(s.done),t))?s.done[s.done.length-1]=t:Sa(t,s.done),s.lastSelTime=+new Date,s.lastSelOrigin=l,s.lastSelOp=i,r&&r.clearRedo!==!1&&Vu(s.undone)}function Sa(e,t){var i=be(t);i&&i.ranges&&i.equals(e)||t.push(e)}function Qu(e,t,i,r){var s=t["spans_"+e.id],l=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(c){c.markedSpans&&((s||(s=t["spans_"+e.id]={}))[l]=c.markedSpans),++l})}function am(e){if(!e)return null;for(var t,i=0;i<e.length;++i)e[i].marker.explicitlyCleared?t||(t=e.slice(0,i)):t&&t.push(e[i]);return t?t.length?t:null:e}function sm(e,t){var i=t["spans_"+e.id];if(!i)return null;for(var r=[],s=0;s<t.text.length;++s)r.push(am(i[s]));return r}function Zu(e,t){var i=sm(e,t),r=gs(e,t);if(!i)return r;if(!r)return i;for(var s=0;s<i.length;++s){var l=i[s],c=r[s];if(l&&c)e:for(var h=0;h<c.length;++h){for(var g=c[h],v=0;v<l.length;++v)if(l[v].marker==g.marker)continue e;l.push(g)}else c&&(i[s]=c)}return i}function zr(e,t,i){for(var r=[],s=0;s<e.length;++s){var l=e[s];if(l.ranges){r.push(i?Xt.prototype.deepCopy.call(l):l);continue}var c=l.changes,h=[];r.push({changes:h});for(var g=0;g<c.length;++g){var v=c[g],C=void 0;if(h.push({from:v.from,to:v.to,text:v.text}),t)for(var _ in v)(C=_.match(/^spans_(\d+)$/))&&we(t,Number(C[1]))>-1&&(be(h)[_]=v[_],delete v[_])}}return r}function Gs(e,t,i,r){if(r){var s=e.anchor;if(i){var l=re(t,s)<0;l!=re(i,s)<0?(s=t,t=i):l!=re(t,i)<0&&(t=i)}return new Be(s,t)}else return new Be(i||t,t)}function Ca(e,t,i,r,s){s==null&&(s=e.cm&&(e.cm.display.shift||e.extend)),_t(e,new Xt([Gs(e.sel.primary(),t,i,s)],0),r)}function ef(e,t,i){for(var r=[],s=e.cm&&(e.cm.display.shift||e.extend),l=0;l<e.sel.ranges.length;l++)r[l]=Gs(e.sel.ranges[l],t[l],null,s);var c=cn(e.cm,r,e.sel.primIndex);_t(e,c,i)}function Ks(e,t,i,r){var s=e.sel.ranges.slice(0);s[t]=i,_t(e,cn(e.cm,s,e.sel.primIndex),r)}function tf(e,t,i,r){_t(e,Hn(t,i),r)}function om(e,t,i){var r={ranges:t.ranges,update:function(s){this.ranges=[];for(var l=0;l<s.length;l++)this.ranges[l]=new Be(Se(e,s[l].anchor),Se(e,s[l].head))},origin:i&&i.origin};return et(e,"beforeSelectionChange",e,r),e.cm&&et(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?cn(e.cm,r.ranges,r.ranges.length-1):t}function nf(e,t,i){var r=e.history.done,s=be(r);s&&s.ranges?(r[r.length-1]=t,Ta(e,t,i)):_t(e,t,i)}function _t(e,t,i){Ta(e,t,i),im(e,e.sel,e.cm?e.cm.curOp.id:NaN,i)}function Ta(e,t,i){($t(e,"beforeSelectionChange")||e.cm&&$t(e.cm,"beforeSelectionChange"))&&(t=om(e,t,i));var r=i&&i.bias||(re(t.primary().head,e.sel.primary().head)<0?-1:1);rf(e,sf(e,t,r,!0)),!(i&&i.scroll===!1)&&e.cm&&e.cm.getOption("readOnly")!="nocursor"&&Fr(e.cm)}function rf(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Zt(e.cm)),vt(e,"cursorActivity",e))}function af(e){rf(e,sf(e,e.sel,null,!1))}function sf(e,t,i,r){for(var s,l=0;l<t.ranges.length;l++){var c=t.ranges[l],h=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[l],g=_a(e,c.anchor,h&&h.anchor,i,r),v=c.head==c.anchor?g:_a(e,c.head,h&&h.head,i,r);(s||g!=c.anchor||v!=c.head)&&(s||(s=t.ranges.slice(0,l)),s[l]=new Be(g,v))}return s?cn(e.cm,s,t.primIndex):t}function $r(e,t,i,r,s){var l=fe(e,t.line);if(l.markedSpans)for(var c=0;c<l.markedSpans.length;++c){var h=l.markedSpans[c],g=h.marker,v="selectLeft"in g?!g.selectLeft:g.inclusiveLeft,C="selectRight"in g?!g.selectRight:g.inclusiveRight;if((h.from==null||(v?h.from<=t.ch:h.from<t.ch))&&(h.to==null||(C?h.to>=t.ch:h.to>t.ch))){if(s&&(et(g,"beforeCursorEnter"),g.explicitlyCleared))if(l.markedSpans){--c;continue}else break;if(!g.atomic)continue;if(i){var _=g.find(r<0?1:-1),M=void 0;if((r<0?C:v)&&(_=of(e,_,-r,_&&_.line==t.line?l:null)),_&&_.line==t.line&&(M=re(_,i))&&(r<0?M<0:M>0))return $r(e,_,t,r,s)}var I=g.find(r<0?-1:1);return(r<0?v:C)&&(I=of(e,I,r,I.line==t.line?l:null)),I?$r(e,I,t,r,s):null}}return t}function _a(e,t,i,r,s){var l=r||1,c=$r(e,t,i,l,s)||!s&&$r(e,t,i,l,!0)||$r(e,t,i,-l,s)||!s&&$r(e,t,i,-l,!0);return c||(e.cantEdit=!0,P(e.first,0))}function of(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?Se(e,P(t.line-1)):null:i>0&&t.ch==(r||fe(e,t.line)).text.length?t.line<e.first+e.size-1?P(t.line+1,0):null:new P(t.line,t.ch+i)}function lf(e){e.setSelection(P(e.firstLine(),0),P(e.lastLine()),ct)}function uf(e,t,i){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return i&&(r.update=function(s,l,c,h){s&&(r.from=Se(e,s)),l&&(r.to=Se(e,l)),c&&(r.text=c),h!==void 0&&(r.origin=h)}),et(e,"beforeChange",e,r),e.cm&&et(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 Br(e,t,i){if(e.cm){if(!e.cm.curOp)return yt(e.cm,Br)(e,t,i);if(e.cm.state.suppressEdits)return}if(!(($t(e,"beforeChange")||e.cm&&$t(e.cm,"beforeChange"))&&(t=uf(e,t,!0),!t))){var r=Zl&&!i&&ig(e,t.from,t.to);if(r)for(var s=r.length-1;s>=0;--s)ff(e,{from:r[s].from,to:r[s].to,text:s?[""]:t.text,origin:t.origin});else ff(e,t)}}function ff(e,t){if(!(t.text.length==1&&t.text[0]==""&&re(t.from,t.to)==0)){var i=Ws(e,t);Ju(e,t,i,e.cm?e.cm.curOp.id:NaN),_i(e,t,i,gs(e,t));var r=[];jn(e,function(s,l){!l&&we(r,s.history)==-1&&(pf(s.history,t),r.push(s.history)),_i(s,t,null,gs(s,t))})}}function La(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(!(r&&!i)){for(var s=e.history,l,c=e.sel,h=t=="undo"?s.done:s.undone,g=t=="undo"?s.undone:s.done,v=0;v<h.length&&(l=h[v],!(i?l.ranges&&!l.equals(e.sel):!l.ranges));v++);if(v!=h.length){for(s.lastOrigin=s.lastSelOrigin=null;;)if(l=h.pop(),l.ranges){if(Sa(l,g),i&&!l.equals(e.sel)){_t(e,l,{clearRedo:!1});return}c=l}else if(r){h.push(l);return}else break;var C=[];Sa(c,g),g.push({changes:C,generation:s.generation}),s.generation=l.generation||++s.maxGeneration;for(var _=$t(e,"beforeChange")||e.cm&&$t(e.cm,"beforeChange"),M=function(U){var V=l.changes[U];if(V.origin=t,_&&!uf(e,V,!1))return h.length=0,{};C.push(qs(e,V));var ee=U?Ws(e,V):be(h);_i(e,V,ee,Zu(e,V)),!U&&e.cm&&e.cm.scrollIntoView({from:V.from,to:Wn(V)});var ae=[];jn(e,function(te,le){!le&&we(ae,te.history)==-1&&(pf(te.history,V),ae.push(te.history)),_i(te,V,null,Zu(te,V))})},I=l.changes.length-1;I>=0;--I){var z=M(I);if(z)return z.v}}}}function cf(e,t){if(t!=0&&(e.first+=t,e.sel=new Xt(kt(e.sel.ranges,function(s){return new Be(P(s.anchor.line+t,s.anchor.ch),P(s.head.line+t,s.head.ch))}),e.sel.primIndex),e.cm)){Ot(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;r<i.viewTo;r++)$n(e.cm,r,"gutter")}}function _i(e,t,i,r){if(e.cm&&!e.cm.curOp)return yt(e.cm,_i)(e,t,i,r);if(t.to.line<e.first){cf(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 s=t.text.length-1-(e.first-t.from.line);cf(e,s),t={from:P(e.first,0),to:P(t.to.line+s,t.to.ch),text:[be(t.text)],origin:t.origin}}var l=e.lastLine();t.to.line>l&&(t={from:t.from,to:P(l,fe(e,l).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Sn(e,t.from,t.to),i||(i=Ws(e,t)),e.cm?lm(e.cm,t,r):Us(e,t,r),Ta(e,i,ct),e.cantEdit&&_a(e,P(e.firstLine(),0))&&(e.cantEdit=!1)}}function lm(e,t,i){var r=e.doc,s=e.display,l=t.from,c=t.to,h=!1,g=l.line;e.options.lineWrapping||(g=b(un(fe(r,l.line))),r.iter(g,c.line+1,function(I){if(I==s.maxLine)return h=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Zt(e),Us(r,t,i,Du(e)),e.options.lineWrapping||(r.iter(g,l.line+t.text.length,function(I){var z=fa(I);z>s.maxLineLength&&(s.maxLine=I,s.maxLineLength=z,s.maxLineChanged=!0,h=!1)}),h&&(e.curOp.updateMaxLine=!0)),Jp(r,l.line),Si(e,400);var v=t.text.length-(c.line-l.line)-1;t.full?Ot(e):l.line==c.line&&t.text.length==1&&!Ku(e.doc,t)?$n(e,l.line,"text"):Ot(e,l.line,c.line+1,v);var C=$t(e,"changes"),_=$t(e,"change");if(_||C){var M={from:l,to:c,text:t.text,removed:t.removed,origin:t.origin};_&&vt(e,"change",e,M),C&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(M)}e.display.selForContextMenu=null}function Hr(e,t,i,r,s){var l;r||(r=i),re(r,i)<0&&(l=[r,i],i=l[0],r=l[1]),typeof t=="string"&&(t=e.splitLines(t)),Br(e,{from:i,to:r,text:t,origin:s})}function hf(e,t,i,r){i<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function df(e,t,i,r){for(var s=0;s<e.length;++s){var l=e[s],c=!0;if(l.ranges){l.copied||(l=e[s]=l.deepCopy(),l.copied=!0);for(var h=0;h<l.ranges.length;h++)hf(l.ranges[h].anchor,t,i,r),hf(l.ranges[h].head,t,i,r);continue}for(var g=0;g<l.changes.length;++g){var v=l.changes[g];if(i<v.from.line)v.from=P(v.from.line+r,v.from.ch),v.to=P(v.to.line+r,v.to.ch);else if(t<=v.to.line){c=!1;break}}c||(e.splice(0,s+1),s=0)}}function pf(e,t){var i=t.from.line,r=t.to.line,s=t.text.length-(r-i)-1;df(e.done,i,r,s),df(e.undone,i,r,s)}function Li(e,t,i,r){var s=t,l=t;return typeof t=="number"?l=fe(e,Ul(e,t)):s=b(t),s==null?null:(r(l,s)&&e.cm&&$n(e.cm,s,i),l)}function Ei(e){this.lines=e,this.parent=null;for(var t=0,i=0;i<e.length;++i)e[i].parent=this,t+=e[i].height;this.height=t}Ei.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var i=e,r=e+t;i<r;++i){var s=this.lines[i];this.height-=s.height,ug(s),vt(s,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,i){this.height+=i,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,i){for(var r=e+t;e<r;++e)if(i(this.lines[e]))return!0}};function Di(e){this.children=e;for(var t=0,i=0,r=0;r<e.length;++r){var s=e[r];t+=s.chunkSize(),i+=s.height,s.parent=this}this.size=t,this.height=i,this.parent=null}Di.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var i=0;i<this.children.length;++i){var r=this.children[i],s=r.chunkSize();if(e<s){var l=Math.min(t,s-e),c=r.height;if(r.removeInner(e,l),this.height-=c-r.height,s==l&&(this.children.splice(i--,1),r.parent=null),(t-=l)==0)break;e=0}else e-=s}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Ei))){var h=[];this.collapse(h),this.children=[new Ei(h)],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,i){this.size+=t.length,this.height+=i;for(var r=0;r<this.children.length;++r){var s=this.children[r],l=s.chunkSize();if(e<=l){if(s.insertInner(e,t,i),s.lines&&s.lines.length>50){for(var c=s.lines.length%25+25,h=c;h<s.lines.length;){var g=new Ei(s.lines.slice(h,h+=25));s.height-=g.height,this.children.splice(++r,0,g),g.parent=this}s.lines=s.lines.slice(0,c),this.maybeSpill()}break}e-=l}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),i=new Di(t);if(e.parent){e.size-=i.size,e.height-=i.height;var s=we(e.parent.children,e);e.parent.children.splice(s+1,0,i)}else{var r=new Di(e.children);r.parent=e,e.children=[r,i],e=r}i.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,i){for(var r=0;r<this.children.length;++r){var s=this.children[r],l=s.chunkSize();if(e<l){var c=Math.min(t,l-e);if(s.iterN(e,c,i))return!0;if((t-=c)==0)break;e=0}else e-=l}}};var Ai=function(e,t,i){if(i)for(var r in i)i.hasOwnProperty(r)&&(this[r]=i[r]);this.doc=e,this.node=t};Ai.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,i=this.line,r=b(i);if(!(r==null||!t)){for(var s=0;s<t.length;++s)t[s]==this&&t.splice(s--,1);t.length||(i.widgets=null);var l=mi(this);Kt(i,Math.max(0,i.height-l)),e&&(Bt(e,function(){gf(e,i,-l),$n(e,r,"widget")}),vt(e,"lineWidgetCleared",e,this,r))}},Ai.prototype.changed=function(){var e=this,t=this.height,i=this.doc.cm,r=this.line;this.height=null;var s=mi(this)-t;s&&(zn(this.doc,r)||Kt(r,r.height+s),i&&Bt(i,function(){i.curOp.forceUpdate=!0,gf(i,r,s),vt(i,"lineWidgetChanged",i,e,b(r))}))},rn(Ai);function gf(e,t,i){Tn(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Fs(e,i)}function um(e,t,i,r){var s=new Ai(e,i,r),l=e.cm;return l&&s.noHScroll&&(l.display.alignWidgets=!0),Li(e,t,"widget",function(c){var h=c.widgets||(c.widgets=[]);if(s.insertAt==null?h.push(s):h.splice(Math.min(h.length,Math.max(0,s.insertAt)),0,s),s.line=c,l&&!zn(e,c)){var g=Tn(c)<e.scrollTop;Kt(c,c.height+mi(s)),g&&Fs(l,s.height),l.curOp.forceUpdate=!0}return!0}),l&&vt(l,"lineWidgetAdded",l,s,typeof t=="number"?t:b(t)),s}var mf=0,Un=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++mf};Un.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&lr(e),$t(this,"clear")){var i=this.find();i&&vt(this,"clear",i.from,i.to)}for(var r=null,s=null,l=0;l<this.lines.length;++l){var c=this.lines[l],h=di(c.markedSpans,this);e&&!this.collapsed?$n(e,b(c),"text"):e&&(h.to!=null&&(s=b(c)),h.from!=null&&(r=b(c))),c.markedSpans=eg(c.markedSpans,h),h.from==null&&this.collapsed&&!zn(this.doc,c)&&e&&Kt(c,Nr(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var g=0;g<this.lines.length;++g){var v=un(this.lines[g]),C=fa(v);C>e.display.maxLineLength&&(e.display.maxLine=v,e.display.maxLineLength=C,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Ot(e,r,s+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&af(e.doc)),e&&vt(e,"markerCleared",e,this,r,s),t&&ur(e),this.parent&&this.parent.clear()}},Un.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,s=0;s<this.lines.length;++s){var l=this.lines[s],c=di(l.markedSpans,this);if(c.from!=null&&(i=P(t?l:b(l),c.from),e==-1))return i;if(c.to!=null&&(r=P(t?l:b(l),c.to),e==1))return r}return i&&{from:i,to:r}},Un.prototype.changed=function(){var e=this,t=this.find(-1,!0),i=this,r=this.doc.cm;!t||!r||Bt(r,function(){var s=t.line,l=b(t.line),c=Ss(r,l);if(c&&(wu(c),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!zn(i.doc,s)&&i.height!=null){var h=i.height;i.height=null;var g=mi(i)-h;g&&Kt(s,s.height+g)}vt(r,"markerChanged",r,e)})},Un.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||we(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Un.prototype.detachLine=function(e){if(this.lines.splice(we(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},rn(Un);function Wr(e,t,i,r,s){if(r&&r.shared)return fm(e,t,i,r,s);if(e.cm&&!e.cm.curOp)return yt(e.cm,Wr)(e,t,i,r,s);var l=new Un(e,s),c=re(t,i);if(r&&ke(r,l,!1),c>0||c==0&&l.clearWhenEmpty!==!1)return l;if(l.replacedWith&&(l.collapsed=!0,l.widgetNode=J("span",[l.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||l.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(l.widgetNode.insertLeft=!0)),l.collapsed){if(au(e,t.line,t,i,l)||t.line!=i.line&&au(e,i.line,t,i,l))throw new Error("Inserting collapsed marker partially overlapping an existing one");Zp()}l.addToHistory&&Ju(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var h=t.line,g=e.cm,v;if(e.iter(h,i.line+1,function(_){g&&l.collapsed&&!g.options.lineWrapping&&un(_)==g.display.maxLine&&(v=!0),l.collapsed&&h!=t.line&&Kt(_,0),tg(_,new sa(l,h==t.line?t.ch:null,h==i.line?i.ch:null),e.cm&&e.cm.curOp),++h}),l.collapsed&&e.iter(t.line,i.line+1,function(_){zn(e,_)&&Kt(_,0)}),l.clearOnEnter&&me(l,"beforeCursorEnter",function(){return l.clear()}),l.readOnly&&(Qp(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),l.collapsed&&(l.id=++mf,l.atomic=!0),g){if(v&&(g.curOp.updateMaxLine=!0),l.collapsed)Ot(g,t.line,i.line+1);else if(l.className||l.startStyle||l.endStyle||l.css||l.attributes||l.title)for(var C=t.line;C<=i.line;C++)$n(g,C,"text");l.atomic&&af(g.doc),vt(g,"markerAdded",g,l)}return l}var Ii=function(e,t){this.markers=e,this.primary=t;for(var i=0;i<e.length;++i)e[i].parent=this};Ii.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();vt(this,"clear")}},Ii.prototype.find=function(e,t){return this.primary.find(e,t)},rn(Ii);function fm(e,t,i,r,s){r=ke(r),r.shared=!1;var l=[Wr(e,t,i,r,s)],c=l[0],h=r.widgetNode;return jn(e,function(g){h&&(r.widgetNode=h.cloneNode(!0)),l.push(Wr(g,Se(g,t),Se(g,i),r,s));for(var v=0;v<g.linked.length;++v)if(g.linked[v].isParent)return;c=be(l)}),new Ii(l,c)}function vf(e){return e.findMarks(P(e.first,0),e.clipPos(P(e.lastLine())),function(t){return t.parent})}function cm(e,t){for(var i=0;i<t.length;i++){var r=t[i],s=r.find(),l=e.clipPos(s.from),c=e.clipPos(s.to);if(re(l,c)){var h=Wr(e,l,c,r.primary,r.primary.type);r.markers.push(h),h.parent=r}}}function hm(e){for(var t=function(r){var s=e[r],l=[s.primary.doc];jn(s.primary.doc,function(g){return l.push(g)});for(var c=0;c<s.markers.length;c++){var h=s.markers[c];we(l,h.doc)==-1&&(h.parent=null,s.markers.splice(c--,1))}},i=0;i<e.length;i++)t(i)}var dm=0,Nt=function(e,t,i,r,s){if(!(this instanceof Nt))return new Nt(e,t,i,r,s);i==null&&(i=0),Di.call(this,[new Ei([new Ar("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=i;var l=P(i,0);this.sel=Hn(l),this.history=new ka(null),this.id=++dm,this.modeOption=t,this.lineSep=r,this.direction=s=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Us(this,{from:l,to:l,text:e}),_t(this,Hn(l),ct)};Nt.prototype=Zn(Di.prototype,{constructor:Nt,iter:function(e,t,i){i?this.iterN(e-this.first,t-e,i):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var i=0,r=0;r<t.length;++r)i+=t[r].height;this.insertInner(e-this.first,t,i)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=ci(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:bt(function(e){var t=P(this.first,0),i=this.first+this.size-1;Br(this,{from:t,to:P(i,fe(this,i).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&bi(this.cm,0,0),_t(this,Hn(t),ct)}),replaceRange:function(e,t,i,r){t=Se(this,t),i=i?Se(this,i):t,Hr(this,e,t,i,r)},getRange:function(e,t,i){var r=Sn(this,Se(this,e),Se(this,t));return i===!1?r:i===""?r.join(""):r.join(i||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(j(this,e))return fe(this,e)},getLineNumber:function(e){return b(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=fe(this,e)),un(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return Se(this,e)},getCursor:function(e){var t=this.sel.primary(),i;return e==null||e=="head"?i=t.head:e=="anchor"?i=t.anchor:e=="end"||e=="to"||e===!1?i=t.to():i=t.from(),i},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:bt(function(e,t,i){tf(this,Se(this,typeof e=="number"?P(e,t||0):e),null,i)}),setSelection:bt(function(e,t,i){tf(this,Se(this,e),Se(this,t||e),i)}),extendSelection:bt(function(e,t,i){Ca(this,Se(this,e),t&&Se(this,t),i)}),extendSelections:bt(function(e,t){ef(this,ql(this,e),t)}),extendSelectionsBy:bt(function(e,t){var i=kt(this.sel.ranges,e);ef(this,ql(this,i),t)}),setSelections:bt(function(e,t,i){if(e.length){for(var r=[],s=0;s<e.length;s++)r[s]=new Be(Se(this,e[s].anchor),Se(this,e[s].head||e[s].anchor));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),_t(this,cn(this.cm,r,t),i)}}),addSelection:bt(function(e,t,i){var r=this.sel.ranges.slice(0);r.push(new Be(Se(this,e),Se(this,t||e))),_t(this,cn(this.cm,r,r.length-1),i)}),getSelection:function(e){for(var t=this.sel.ranges,i,r=0;r<t.length;r++){var s=Sn(this,t[r].from(),t[r].to());i=i?i.concat(s):s}return e===!1?i:i.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],i=this.sel.ranges,r=0;r<i.length;r++){var s=Sn(this,i[r].from(),i[r].to());e!==!1&&(s=s.join(e||this.lineSeparator())),t[r]=s}return t},replaceSelection:function(e,t,i){for(var r=[],s=0;s<this.sel.ranges.length;s++)r[s]=e;this.replaceSelections(r,t,i||"+input")},replaceSelections:bt(function(e,t,i){for(var r=[],s=this.sel,l=0;l<s.ranges.length;l++){var c=s.ranges[l];r[l]={from:c.from(),to:c.to(),text:this.splitLines(e[l]),origin:i}}for(var h=t&&t!="end"&&em(this,r,t),g=r.length-1;g>=0;g--)Br(this,r[g]);h?nf(this,h):this.cm&&Fr(this.cm)}),undo:bt(function(){La(this,"undo")}),redo:bt(function(){La(this,"redo")}),undoSelection:bt(function(){La(this,"undo",!0)}),redoSelection:bt(function(){La(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var s=0;s<e.undone.length;s++)e.undone[s].ranges||++i;return{undo:t,redo:i}},clearHistory:function(){var e=this;this.history=new ka(this.history),jn(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:zr(this.history.done),undone:zr(this.history.undone)}},setHistory:function(e){var t=this.history=new ka(this.history);t.done=zr(e.done.slice(0),null,!0),t.undone=zr(e.undone.slice(0),null,!0)},setGutterMarker:bt(function(e,t,i){return Li(this,e,"gutter",function(r){var s=r.gutterMarkers||(r.gutterMarkers={});return s[t]=i,!i&&pe(s)&&(r.gutterMarkers=null),!0})}),clearGutter:bt(function(e){var t=this;this.iter(function(i){i.gutterMarkers&&i.gutterMarkers[e]&&Li(t,i,"gutter",function(){return i.gutterMarkers[e]=null,pe(i.gutterMarkers)&&(i.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!j(this,e)||(t=e,e=fe(this,e),!e))return null}else if(t=b(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:bt(function(e,t,i){return Li(this,e,t=="gutter"?"gutter":"class",function(r){var s=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[s])r[s]=i;else{if(ie(i).test(r[s]))return!1;r[s]+=" "+i}return!0})}),removeLineClass:bt(function(e,t,i){return Li(this,e,t=="gutter"?"gutter":"class",function(r){var s=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",l=r[s];if(l)if(i==null)r[s]=null;else{var c=l.match(ie(i));if(!c)return!1;var h=c.index+c[0].length;r[s]=l.slice(0,c.index)+(!c.index||h==l.length?"":" ")+l.slice(h)||null}else return!1;return!0})}),addLineWidget:bt(function(e,t,i){return um(this,e,t,i)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,i){return Wr(this,Se(this,e),Se(this,t),i,i&&i.type||"range")},setBookmark:function(e,t){var i={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=Se(this,e),Wr(this,e,e,i,"bookmark")},findMarksAt:function(e){e=Se(this,e);var t=[],i=fe(this,e.line).markedSpans;if(i)for(var r=0;r<i.length;++r){var s=i[r];(s.from==null||s.from<=e.ch)&&(s.to==null||s.to>=e.ch)&&t.push(s.marker.parent||s.marker)}return t},findMarks:function(e,t,i){e=Se(this,e),t=Se(this,t);var r=[],s=e.line;return this.iter(e.line,t.line+1,function(l){var c=l.markedSpans;if(c)for(var h=0;h<c.length;h++){var g=c[h];!(g.to!=null&&s==e.line&&e.ch>=g.to||g.from==null&&s!=e.line||g.from!=null&&s==t.line&&g.from>=t.ch)&&(!i||i(g.marker))&&r.push(g.marker.parent||g.marker)}++s}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var r=0;r<i.length;++r)i[r].from!=null&&e.push(i[r].marker)}),e},posFromIndex:function(e){var t,i=this.first,r=this.lineSeparator().length;return this.iter(function(s){var l=s.text.length+r;if(l>e)return t=e,!0;e-=l,++i}),Se(this,P(i,t))},indexFromPos:function(e){e=Se(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var i=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+i}),t},copy:function(e){var t=new Nt(ci(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,i=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<i&&(i=e.to);var r=new Nt(ci(this,t,i),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}],cm(r,vf(this)),r},unlinkDoc:function(e){if(e instanceof Ve&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var i=this.linked[t];if(i.doc==e){this.linked.splice(t,1),e.unlinkDoc(this),hm(vf(this));break}}if(e.history==this.history){var r=[e.id];jn(e,function(s){return r.push(s.id)},!0),e.history=new ka(null),e.history.done=zr(this.history.done,r),e.history.undone=zr(this.history.undone,r)}},iterLinkedDocs:function(e){jn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):en(e)},lineSeparator:function(){return this.lineSep||`
11
- `},setDirection:bt(function(e){e!="rtl"&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&tm(this.cm))})}),Nt.prototype.eachLine=Nt.prototype.iter;var yf=0;function pm(e){var t=this;if(bf(t),!(tt(t,e)||_n(t.display,e))){Tt(e),m&&(yf=+new Date);var i=ir(t,e,!0),r=e.dataTransfer.files;if(!(!i||t.isReadOnly()))if(r&&r.length&&window.FileReader&&window.File)for(var s=r.length,l=Array(s),c=0,h=function(){++c==s&&yt(t,function(){i=Se(t.doc,i);var I={from:i,to:i,text:t.doc.splitLines(l.filter(function(z){return z!=null}).join(t.doc.lineSeparator())),origin:"paste"};Br(t.doc,I),nf(t.doc,Hn(Se(t.doc,i),Se(t.doc,Wn(I))))})()},g=function(I,z){if(t.options.allowDropFileTypes&&we(t.options.allowDropFileTypes,I.type)==-1){h();return}var U=new FileReader;U.onerror=function(){return h()},U.onload=function(){var V=U.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(V)){h();return}l[z]=V,h()},U.readAsText(I)},v=0;v<r.length;v++)g(r[v],v);else{if(t.state.draggingText&&t.doc.sel.contains(i)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var C=e.dataTransfer.getData("Text");if(C){var _;if(t.state.draggingText&&!t.state.draggingText.copy&&(_=t.listSelections()),Ta(t.doc,Hn(i,i)),_)for(var M=0;M<_.length;++M)Hr(t.doc,"",_[M].anchor,_[M].head,"drag");t.replaceSelection(C,"around","paste"),t.display.input.focus()}}catch{}}}}function gm(e,t){if(m&&(!e.state.draggingText||+new Date-yf<100)){Mn(t);return}if(!(tt(e,t)||_n(e.display,t))&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!q)){var i=k("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",B&&(i.width=i.height=1,e.display.wrapper.appendChild(i),i._top=i.offsetTop),t.dataTransfer.setDragImage(i,0,0),B&&i.parentNode.removeChild(i)}}function mm(e,t){var i=ir(e,t);if(i){var r=document.createDocumentFragment();Is(e,i,r),e.display.dragCursor||(e.display.dragCursor=k("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),Q(e.display.dragCursor,r)}}function bf(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function xf(e){if(document.getElementsByClassName){for(var t=document.getElementsByClassName("CodeMirror"),i=[],r=0;r<t.length;r++){var s=t[r].CodeMirror;s&&i.push(s)}i.length&&i[0].operation(function(){for(var l=0;l<i.length;l++)e(i[l])})}}var wf=!1;function vm(){wf||(ym(),wf=!0)}function ym(){var e;me(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,xf(bm)},100))}),me(window,"blur",function(){return xf(Rr)})}function bm(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var qn={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"},Oi=0;Oi<10;Oi++)qn[Oi+48]=qn[Oi+96]=String(Oi);for(var Ea=65;Ea<=90;Ea++)qn[Ea]=String.fromCharCode(Ea);for(var Ni=1;Ni<=12;Ni++)qn[Ni+111]=qn[Ni+63235]="F"+Ni;var En={};En.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"},En.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"},En.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"},En.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"]},En.default=ne?En.macDefault:En.pcDefault;function xm(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var i,r,s,l,c=0;c<t.length-1;c++){var h=t[c];if(/^(cmd|meta|m)$/i.test(h))l=!0;else if(/^a(lt)?$/i.test(h))i=!0;else if(/^(c|ctrl|control)$/i.test(h))r=!0;else if(/^s(hift)?$/i.test(h))s=!0;else throw new Error("Unrecognized modifier name: "+h)}return i&&(e="Alt-"+e),r&&(e="Ctrl-"+e),l&&(e="Cmd-"+e),s&&(e="Shift-"+e),e}function wm(e){var t={};for(var i in e)if(e.hasOwnProperty(i)){var r=e[i];if(/^(name|fallthrough|(de|at)tach)$/.test(i))continue;if(r=="..."){delete e[i];continue}for(var s=kt(i.split(" "),xm),l=0;l<s.length;l++){var c=void 0,h=void 0;l==s.length-1?(h=s.join(" "),c=r):(h=s.slice(0,l+1).join(" "),c="...");var g=t[h];if(!g)t[h]=c;else if(g!=c)throw new Error("Inconsistent bindings for "+h)}delete e[i]}for(var v in t)e[v]=t[v];return e}function jr(e,t,i,r){t=Da(t);var s=t.call?t.call(e,r):t[e];if(s===!1)return"nothing";if(s==="...")return"multi";if(s!=null&&i(s))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return jr(e,t.fallthrough,i,r);for(var l=0;l<t.fallthrough.length;l++){var c=jr(e,t.fallthrough[l],i,r);if(c)return c}}}function kf(e){var t=typeof e=="string"?e:qn[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function Sf(e,t,i){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(Oe?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(Oe?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!i&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function Cf(e,t){if(B&&e.keyCode==34&&e.char)return!1;var i=qn[e.keyCode];return i==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(i=e.code),Sf(i,e,t))}function Da(e){return typeof e=="string"?En[e]:e}function Ur(e,t){for(var i=e.doc.sel.ranges,r=[],s=0;s<i.length;s++){for(var l=t(i[s]);r.length&&re(l.from,be(r).to)<=0;){var c=r.pop();if(re(c.from,l.from)<0){l.from=c.from;break}}r.push(l)}Bt(e,function(){for(var h=r.length-1;h>=0;h--)Hr(e.doc,"",r[h].from,r[h].to,"+delete");Fr(e)})}function Xs(e,t,i){var r=zt(e.text,t+i,i);return r<0||r>e.text.length?null:r}function Ys(e,t,i){var r=Xs(e,t.ch,i);return r==null?null:new P(t.line,r,i<0?"after":"before")}function Vs(e,t,i,r,s){if(e){t.doc.direction=="rtl"&&(s=-s);var l=Pe(i,t.doc.direction);if(l){var c=s<0?be(l):l[0],h=s<0==(c.level==1),g=h?"after":"before",v;if(c.level>0||t.doc.direction=="rtl"){var C=Or(t,i);v=s<0?i.text.length-1:0;var _=yn(t,C,v).top;v=Qt(function(M){return yn(t,C,M).top==_},s<0==(c.level==1)?c.from:c.to-1,v),g=="before"&&(v=Xs(i,v,1))}else v=s<0?c.to:c.from;return new P(r,v,g)}}return new P(r,s<0?i.text.length:0,s<0?"before":"after")}function km(e,t,i,r){var s=Pe(t,e.doc.direction);if(!s)return Ys(t,i,r);i.ch>=t.text.length?(i.ch=t.text.length,i.sticky="before"):i.ch<=0&&(i.ch=0,i.sticky="after");var l=Nn(s,i.ch,i.sticky),c=s[l];if(e.doc.direction=="ltr"&&c.level%2==0&&(r>0?c.to>i.ch:c.from<i.ch))return Ys(t,i,r);var h=function(ee,ae){return Xs(t,ee instanceof P?ee.ch:ee,ae)},g,v=function(ee){return e.options.lineWrapping?(g=g||Or(e,t),Eu(e,t,g,ee)):{begin:0,end:t.text.length}},C=v(i.sticky=="before"?h(i,-1):i.ch);if(e.doc.direction=="rtl"||c.level==1){var _=c.level==1==r<0,M=h(i,_?1:-1);if(M!=null&&(_?M<=c.to&&M<=C.end:M>=c.from&&M>=C.begin)){var I=_?"before":"after";return new P(i.line,M,I)}}var z=function(ee,ae,te){for(var le=function(Ue,xt){return xt?new P(i.line,h(Ue,1),"before"):new P(i.line,Ue,"after")};ee>=0&&ee<s.length;ee+=ae){var ve=s[ee],ge=ae>0==(ve.level!=1),Ae=ge?te.begin:h(te.end,-1);if(ve.from<=Ae&&Ae<ve.to||(Ae=ge?ve.from:h(ve.to,-1),te.begin<=Ae&&Ae<te.end))return le(Ae,ge)}},U=z(l+r,r,C);if(U)return U;var V=r>0?C.end:h(C.begin,-1);return V!=null&&!(r>0&&V==t.text.length)&&(U=z(r>0?0:s.length-1,r,v(V)),U)?U:null}var Mi={selectAll:lf,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ct)},killLine:function(e){return Ur(e,function(t){if(t.empty()){var i=fe(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line<e.lastLine()?{from:t.head,to:P(t.head.line+1,0)}:{from:t.head,to:P(t.head.line,i)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Ur(e,function(t){return{from:P(t.from().line,0),to:Se(e.doc,P(t.to().line+1,0))}})},delLineLeft:function(e){return Ur(e,function(t){return{from:P(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Ur(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return Ur(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"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(P(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(P(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return Tf(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return _f(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Sm(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div")},ht)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:i},"div")},ht)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return r.ch<e.getLine(r.line).search(/\S/)?_f(e,t.head):r},ht)},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=[],i=e.listSelections(),r=e.options.tabSize,s=0;s<i.length;s++){var l=i[s].from(),c=_e(e.getLine(l.line),l.ch,r);t.push(qt(r-c%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Bt(e,function(){for(var t=e.listSelections(),i=[],r=0;r<t.length;r++)if(t[r].empty()){var s=t[r].head,l=fe(e.doc,s.line).text;if(l){if(s.ch==l.length&&(s=new P(s.line,s.ch-1)),s.ch>0)s=new P(s.line,s.ch+1),e.replaceRange(l.charAt(s.ch-1)+l.charAt(s.ch-2),P(s.line,s.ch-2),s,"+transpose");else if(s.line>e.doc.first){var c=fe(e.doc,s.line-1).text;c&&(s=new P(s.line,1),e.replaceRange(l.charAt(0)+e.doc.lineSeparator()+c.charAt(c.length-1),P(s.line-1,c.length-1),s,"+transpose"))}}i.push(new Be(s,s))}e.setSelections(i)})},newlineAndIndent:function(e){return Bt(e,function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);Fr(e)})},openLine:function(e){return e.replaceSelection(`
12
- `,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function Tf(e,t){var i=fe(e.doc,t),r=un(i);return r!=i&&(t=b(r)),Vs(!0,e,r,t,1)}function Sm(e,t){var i=fe(e.doc,t),r=sg(i);return r!=i&&(t=b(r)),Vs(!0,e,i,t,-1)}function _f(e,t){var i=Tf(e,t.line),r=fe(e.doc,i.line),s=Pe(r,e.doc.direction);if(!s||s[0].level==0){var l=Math.max(i.ch,r.text.search(/\S/)),c=t.line==i.line&&t.ch<=l&&t.ch;return P(i.line,c?0:l,i.sticky)}return i}function Aa(e,t,i){if(typeof t=="string"&&(t=Mi[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,s=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),i&&(e.display.shift=!1),s=t(e)!=Ke}finally{e.display.shift=r,e.state.suppressEdits=!1}return s}function Cm(e,t,i){for(var r=0;r<e.state.keyMaps.length;r++){var s=jr(t,e.state.keyMaps[r],i,e);if(s)return s}return e.options.extraKeys&&jr(t,e.options.extraKeys,i,e)||jr(t,e.options.keyMap,i,e)}var Tm=new ft;function Ri(e,t,i,r){var s=e.state.keySeq;if(s){if(kf(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Tm.set(50,function(){e.state.keySeq==s&&(e.state.keySeq=null,e.display.input.reset())}),Lf(e,s+" "+t,i,r))return!0}return Lf(e,t,i,r)}function Lf(e,t,i,r){var s=Cm(e,t,r);return s=="multi"&&(e.state.keySeq=t),s=="handled"&&vt(e,"keyHandled",e,t,i),(s=="handled"||s=="multi")&&(Tt(i),Os(e)),!!s}function Ef(e,t){var i=Cf(t,!0);return i?t.shiftKey&&!e.state.keySeq?Ri(e,"Shift-"+i,t,function(r){return Aa(e,r,!0)})||Ri(e,i,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return Aa(e,r)}):Ri(e,i,t,function(r){return Aa(e,r)}):!1}function _m(e,t,i){return Ri(e,"'"+i+"'",t,function(r){return Aa(e,r,!0)})}var Js=null;function Df(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField())&&(t.curOp.focus=R(oe(t)),!tt(t,e))){m&&x<11&&e.keyCode==27&&(e.returnValue=!1);var i=e.keyCode;t.display.shift=i==16||e.shiftKey;var r=Ef(t,e);B&&(Js=r?i:null,!r&&i==88&&!ia&&(ne?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),f&&!ne&&!r&&i==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),i==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Lm(t)}}function Lm(e){var t=e.display.lineDiv;K(t,"CodeMirror-crosshair");function i(r){(r.keyCode==18||!r.altKey)&&(ze(t,"CodeMirror-crosshair"),Ct(document,"keyup",i),Ct(document,"mouseover",i))}me(document,"keyup",i),me(document,"mouseover",i)}function Af(e){e.keyCode==16&&(this.doc.sel.shift=!1),tt(this,e)}function If(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField())&&!(_n(t.display,e)||tt(t,e)||e.ctrlKey&&!e.altKey||ne&&e.metaKey)){var i=e.keyCode,r=e.charCode;if(B&&i==Js){Js=null,Tt(e);return}if(!(B&&(!e.which||e.which<10)&&Ef(t,e))){var s=String.fromCharCode(r??i);s!="\b"&&(_m(t,e,s)||t.display.input.onKeyPress(e))}}}var Em=400,Qs=function(e,t,i){this.time=e,this.pos=t,this.button=i};Qs.prototype.compare=function(e,t,i){return this.time+Em>e&&re(t,this.pos)==0&&i==this.button};var Fi,Pi;function Dm(e,t){var i=+new Date;return Pi&&Pi.compare(i,e,t)?(Fi=Pi=null,"triple"):Fi&&Fi.compare(i,e,t)?(Pi=new Qs(i,e,t),Fi=null,"double"):(Fi=new Qs(i,e,t),Pi=null,"single")}function Of(e){var t=this,i=t.display;if(!(tt(t,e)||i.activeTouch&&i.input.supportsTouch())){if(i.input.ensurePolled(),i.shift=e.shiftKey,_n(i,e)){S||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(!Zs(t,e)){var r=ir(t,e),s=an(e),l=r?Dm(r,s):"single";Z(t).focus(),s==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&Am(t,s,r,l,e))&&(s==1?r?Om(t,r,l,e):li(e)==i.scroller&&Tt(e):s==2?(r&&Ca(t.doc,r),setTimeout(function(){return i.input.focus()},20)):s==3&&(Re?t.display.input.onContextMenu(e):Ns(t)))}}}function Am(e,t,i,r,s){var l="Click";return r=="double"?l="Double"+l:r=="triple"&&(l="Triple"+l),l=(t==1?"Left":t==2?"Middle":"Right")+l,Ri(e,Sf(l,s),s,function(c){if(typeof c=="string"&&(c=Mi[c]),!c)return!1;var h=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),h=c(e,i)!=Ke}finally{e.state.suppressEdits=!1}return h})}function Im(e,t,i){var r=e.getOption("configureMouse"),s=r?r(e,t,i):{};if(s.unit==null){var l=ue?i.shiftKey&&i.metaKey:i.altKey;s.unit=l?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(s.extend==null||e.doc.extend)&&(s.extend=e.doc.extend||i.shiftKey),s.addNew==null&&(s.addNew=ne?i.metaKey:i.ctrlKey),s.moveOnDrag==null&&(s.moveOnDrag=!(ne?i.altKey:i.ctrlKey)),s}function Om(e,t,i,r){m?setTimeout(ce(Ou,e),0):e.curOp.focus=R(oe(e));var s=Im(e,i,r),l=e.doc.sel,c;e.options.dragDrop&&cs&&!e.isReadOnly()&&i=="single"&&(c=l.contains(t))>-1&&(re((c=l.ranges[c]).from(),t)<0||t.xRel>0)&&(re(c.to(),t)>0||t.xRel<0)?Nm(e,r,t,s):Mm(e,r,t,s)}function Nm(e,t,i,r){var s=e.display,l=!1,c=yt(e,function(v){S&&(s.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:Ns(e)),Ct(s.wrapper.ownerDocument,"mouseup",c),Ct(s.wrapper.ownerDocument,"mousemove",h),Ct(s.scroller,"dragstart",g),Ct(s.scroller,"drop",c),l||(Tt(v),r.addNew||Ca(e.doc,i,null,null,r.extend),S&&!q||m&&x==9?setTimeout(function(){s.wrapper.ownerDocument.body.focus({preventScroll:!0}),s.input.focus()},20):s.input.focus())}),h=function(v){l=l||Math.abs(t.clientX-v.clientX)+Math.abs(t.clientY-v.clientY)>=10},g=function(){return l=!0};S&&(s.scroller.draggable=!0),e.state.draggingText=c,c.copy=!r.moveOnDrag,me(s.wrapper.ownerDocument,"mouseup",c),me(s.wrapper.ownerDocument,"mousemove",h),me(s.scroller,"dragstart",g),me(s.scroller,"drop",c),e.state.delayingBlurEvent=!0,setTimeout(function(){return s.input.focus()},20),s.scroller.dragDrop&&s.scroller.dragDrop()}function Nf(e,t,i){if(i=="char")return new Be(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new Be(P(t.line,0),Se(e.doc,P(t.line+1,0)));var r=i(e,t);return new Be(r.from,r.to)}function Mm(e,t,i,r){m&&Ns(e);var s=e.display,l=e.doc;Tt(t);var c,h,g=l.sel,v=g.ranges;if(r.addNew&&!r.extend?(h=l.sel.contains(i),h>-1?c=v[h]:c=new Be(i,i)):(c=l.sel.primary(),h=l.sel.primIndex),r.unit=="rectangle")r.addNew||(c=new Be(i,i)),i=ir(e,t,!0,!0),h=-1;else{var C=Nf(e,i,r.unit);r.extend?c=Gs(c,C.anchor,C.head,r.extend):c=C}r.addNew?h==-1?(h=v.length,_t(l,cn(e,v.concat([c]),h),{scroll:!1,origin:"*mouse"})):v.length>1&&v[h].empty()&&r.unit=="char"&&!r.extend?(_t(l,cn(e,v.slice(0,h).concat(v.slice(h+1)),0),{scroll:!1,origin:"*mouse"}),g=l.sel):Ks(l,h,c,Pt):(h=0,_t(l,new Xt([c],0),Pt),g=l.sel);var _=i;function M(te){if(re(_,te)!=0)if(_=te,r.unit=="rectangle"){for(var le=[],ve=e.options.tabSize,ge=_e(fe(l,i.line).text,i.ch,ve),Ae=_e(fe(l,te.line).text,te.ch,ve),Ue=Math.min(ge,Ae),xt=Math.max(ge,Ae),Qe=Math.min(i.line,te.line),Ht=Math.min(e.lastLine(),Math.max(i.line,te.line));Qe<=Ht;Qe++){var Mt=fe(l,Qe).text,lt=dt(Mt,Ue,ve);Ue==xt?le.push(new Be(P(Qe,lt),P(Qe,lt))):Mt.length>lt&&le.push(new Be(P(Qe,lt),P(Qe,dt(Mt,xt,ve))))}le.length||le.push(new Be(i,i)),_t(l,cn(e,g.ranges.slice(0,h).concat(le),h),{origin:"*mouse",scroll:!1}),e.scrollIntoView(te)}else{var Rt=c,St=Nf(e,te,r.unit),pt=Rt.anchor,ut;re(St.anchor,pt)>0?(ut=St.head,pt=Dr(Rt.from(),St.anchor)):(ut=St.anchor,pt=It(Rt.to(),St.head));var rt=g.ranges.slice(0);rt[h]=Rm(e,new Be(Se(l,pt),ut)),_t(l,cn(e,rt,h),Pt)}}var I=s.wrapper.getBoundingClientRect(),z=0;function U(te){var le=++z,ve=ir(e,te,!0,r.unit=="rectangle");if(ve)if(re(ve,_)!=0){e.curOp.focus=R(oe(e)),M(ve);var ge=ya(s,l);(ve.line>=ge.to||ve.line<ge.from)&&setTimeout(yt(e,function(){z==le&&U(te)}),150)}else{var Ae=te.clientY<I.top?-20:te.clientY>I.bottom?20:0;Ae&&setTimeout(yt(e,function(){z==le&&(s.scroller.scrollTop+=Ae,U(te))}),50)}}function V(te){e.state.selectingText=!1,z=1/0,te&&(Tt(te),s.input.focus()),Ct(s.wrapper.ownerDocument,"mousemove",ee),Ct(s.wrapper.ownerDocument,"mouseup",ae),l.history.lastSelOrigin=null}var ee=yt(e,function(te){te.buttons===0||!an(te)?V(te):U(te)}),ae=yt(e,V);e.state.selectingText=ae,me(s.wrapper.ownerDocument,"mousemove",ee),me(s.wrapper.ownerDocument,"mouseup",ae)}function Rm(e,t){var i=t.anchor,r=t.head,s=fe(e.doc,i.line);if(re(i,r)==0&&i.sticky==r.sticky)return t;var l=Pe(s);if(!l)return t;var c=Nn(l,i.ch,i.sticky),h=l[c];if(h.from!=i.ch&&h.to!=i.ch)return t;var g=c+(h.from==i.ch==(h.level!=1)?0:1);if(g==0||g==l.length)return t;var v;if(r.line!=i.line)v=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var C=Nn(l,r.ch,r.sticky),_=C-c||(r.ch-i.ch)*(h.level==1?-1:1);C==g-1||C==g?v=_<0:v=_>0}var M=l[g+(v?-1:0)],I=v==(M.level==1),z=I?M.from:M.to,U=I?"after":"before";return i.ch==z&&i.sticky==U?t:new Be(new P(i.line,z,U),r)}function Mf(e,t,i,r){var s,l;if(t.touches)s=t.touches[0].clientX,l=t.touches[0].clientY;else try{s=t.clientX,l=t.clientY}catch{return!1}if(s>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Tt(t);var c=e.display,h=c.lineDiv.getBoundingClientRect();if(l>h.bottom||!$t(e,i))return At(t);l-=h.top-c.viewOffset;for(var g=0;g<e.display.gutterSpecs.length;++g){var v=c.gutters.childNodes[g];if(v&&v.getBoundingClientRect().right>=s){var C=T(e.doc,l),_=e.display.gutterSpecs[g];return et(e,i,e,C,_.className,t),At(t)}}}function Zs(e,t){return Mf(e,t,"gutterClick",!0)}function Rf(e,t){_n(e.display,t)||Fm(e,t)||tt(e,t,"contextmenu")||Re||e.display.input.onContextMenu(t)}function Fm(e,t){return $t(e,"gutterContextMenu")?Mf(e,t,"gutterContextMenu",!1):!1}function Ff(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),vi(e)}var qr={toString:function(){return"CodeMirror.Init"}},Pf={},Ia={};function Pm(e){var t=e.optionHandlers;function i(r,s,l,c){e.defaults[r]=s,l&&(t[r]=c?function(h,g,v){v!=qr&&l(h,g,v)}:l)}e.defineOption=i,e.Init=qr,i("value","",function(r,s){return r.setValue(s)},!0),i("mode",null,function(r,s){r.doc.modeOption=s,js(r)},!0),i("indentUnit",2,js,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){Ti(r),vi(r),Ot(r)},!0),i("lineSeparator",null,function(r,s){if(r.doc.lineSep=s,!!s){var l=[],c=r.doc.first;r.doc.iter(function(g){for(var v=0;;){var C=g.text.indexOf(s,v);if(C==-1)break;v=C+s.length,l.push(P(c,C))}c++});for(var h=l.length-1;h>=0;h--)Hr(r.doc,s,l[h],P(l[h].line,l[h].ch+s.length))}}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(r,s,l){r.state.specialChars=new RegExp(s.source+(s.test(" ")?"":"| "),"g"),l!=qr&&r.refresh()}),i("specialCharPlaceholder",hg,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",X?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(r,s){return r.getInputField().spellcheck=s},!0),i("autocorrect",!1,function(r,s){return r.getInputField().autocorrect=s},!0),i("autocapitalize",!1,function(r,s){return r.getInputField().autocapitalize=s},!0),i("rtlMoveVisually",!se),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Ff(r),Ci(r)},!0),i("keyMap","default",function(r,s,l){var c=Da(s),h=l!=qr&&Da(l);h&&h.detach&&h.detach(r,c),c.attach&&c.attach(r,h||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,$m,!0),i("gutters",[],function(r,s){r.display.gutterSpecs=Hs(s,r.options.lineNumbers),Ci(r)},!0),i("fixedGutter",!0,function(r,s){r.display.gutters.style.left=s?Ds(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return Pr(r)},!0),i("scrollbarStyle","native",function(r){zu(r),Pr(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),i("lineNumbers",!1,function(r,s){r.display.gutterSpecs=Hs(r.options.gutters,s),Ci(r)},!0),i("firstLineNumber",1,Ci,!0),i("lineNumberFormatter",function(r){return r},Ci,!0),i("showCursorWhenSelecting",!1,yi,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,s){s=="nocursor"&&(Rr(r),r.display.input.blur()),r.display.input.readOnlyChanged(s)}),i("screenReaderLabel",null,function(r,s){s=s===""?null:s,r.display.input.screenReaderLabelChanged(s)}),i("disableInput",!1,function(r,s){s||r.display.input.reset()},!0),i("dragDrop",!0,zm),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,yi,!0),i("singleCursorHeightPerLine",!0,yi,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,Ti,!0),i("addModeClass",!1,Ti,!0),i("pollInterval",100),i("undoDepth",200,function(r,s){return r.doc.history.undoDepth=s}),i("historyEventDelay",1250),i("viewportMargin",10,function(r){return r.refresh()},!0),i("maxHighlightLength",1e4,Ti,!0),i("moveInputWithCursor",!0,function(r,s){s||r.display.input.resetPosition()}),i("tabindex",null,function(r,s){return r.display.input.getField().tabIndex=s||""}),i("autofocus",null),i("direction","ltr",function(r,s){return r.doc.setDirection(s)},!0),i("phrases",null)}function zm(e,t,i){var r=i&&i!=qr;if(!t!=!r){var s=e.display.dragFunctions,l=t?me:Ct;l(e.display.scroller,"dragstart",s.start),l(e.display.scroller,"dragenter",s.enter),l(e.display.scroller,"dragover",s.over),l(e.display.scroller,"dragleave",s.leave),l(e.display.scroller,"drop",s.drop)}}function $m(e){e.options.lineWrapping?(K(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(ze(e.display.wrapper,"CodeMirror-wrap"),bs(e)),As(e),Ot(e),vi(e),setTimeout(function(){return Pr(e)},100)}function Ve(e,t){var i=this;if(!(this instanceof Ve))return new Ve(e,t);this.options=t=t?ke(t):{},ke(Pf,t,!1);var r=t.value;typeof r=="string"?r=new Nt(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var s=new Ve.inputStyles[t.inputStyle](this),l=this.display=new Qg(e,r,s,t);l.wrapper.CodeMirror=this,Ff(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),zu(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 ft,keySeq:null,specialChars:null},t.autofocus&&!X&&l.input.focus(),m&&x<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Bm(this),vm(),lr(this),this.curOp.forceUpdate=!0,Xu(this,r),t.autofocus&&!X||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&Ms(i)},20):Rr(this);for(var c in Ia)Ia.hasOwnProperty(c)&&Ia[c](this,t[c],qr);Hu(this),t.finishInit&&t.finishInit(this);for(var h=0;h<eo.length;++h)eo[h](this);ur(this),S&&t.lineWrapping&&getComputedStyle(l.lineDiv).textRendering=="optimizelegibility"&&(l.lineDiv.style.textRendering="auto")}Ve.defaults=Pf,Ve.optionHandlers=Ia;function Bm(e){var t=e.display;me(t.scroller,"mousedown",yt(e,Of)),m&&x<11?me(t.scroller,"dblclick",yt(e,function(g){if(!tt(e,g)){var v=ir(e,g);if(!(!v||Zs(e,g)||_n(e.display,g))){Tt(g);var C=e.findWordAt(v);Ca(e.doc,C.anchor,C.head)}}})):me(t.scroller,"dblclick",function(g){return tt(e,g)||Tt(g)}),me(t.scroller,"contextmenu",function(g){return Rf(e,g)}),me(t.input.getField(),"contextmenu",function(g){t.scroller.contains(g.target)||Rf(e,g)});var i,r={end:0};function s(){t.activeTouch&&(i=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function l(g){if(g.touches.length!=1)return!1;var v=g.touches[0];return v.radiusX<=1&&v.radiusY<=1}function c(g,v){if(v.left==null)return!0;var C=v.left-g.left,_=v.top-g.top;return C*C+_*_>20*20}me(t.scroller,"touchstart",function(g){if(!tt(e,g)&&!l(g)&&!Zs(e,g)){t.input.ensurePolled(),clearTimeout(i);var v=+new Date;t.activeTouch={start:v,moved:!1,prev:v-r.end<=300?r:null},g.touches.length==1&&(t.activeTouch.left=g.touches[0].pageX,t.activeTouch.top=g.touches[0].pageY)}}),me(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),me(t.scroller,"touchend",function(g){var v=t.activeTouch;if(v&&!_n(t,g)&&v.left!=null&&!v.moved&&new Date-v.start<300){var C=e.coordsChar(t.activeTouch,"page"),_;!v.prev||c(v,v.prev)?_=new Be(C,C):!v.prev.prev||c(v,v.prev.prev)?_=e.findWordAt(C):_=new Be(P(C.line,0),Se(e.doc,P(C.line+1,0))),e.setSelection(_.anchor,_.head),e.focus(),Tt(g)}s()}),me(t.scroller,"touchcancel",s),me(t.scroller,"scroll",function(){t.scroller.clientHeight&&(xi(e,t.scroller.scrollTop),sr(e,t.scroller.scrollLeft,!0),et(e,"scroll",e))}),me(t.scroller,"mousewheel",function(g){return Uu(e,g)}),me(t.scroller,"DOMMouseScroll",function(g){return Uu(e,g)}),me(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(g){tt(e,g)||Mn(g)},over:function(g){tt(e,g)||(mm(e,g),Mn(g))},start:function(g){return gm(e,g)},drop:yt(e,pm),leave:function(g){tt(e,g)||bf(e)}};var h=t.input.getField();me(h,"keyup",function(g){return Af.call(e,g)}),me(h,"keydown",yt(e,Df)),me(h,"keypress",yt(e,If)),me(h,"focus",function(g){return Ms(e,g)}),me(h,"blur",function(g){return Rr(e,g)})}var eo=[];Ve.defineInitHook=function(e){return eo.push(e)};function zi(e,t,i,r){var s=e.doc,l;i==null&&(i="add"),i=="smart"&&(s.mode.indent?l=hi(e,t).state:i="prev");var c=e.options.tabSize,h=fe(s,t),g=_e(h.text,null,c);h.stateAfter&&(h.stateAfter=null);var v=h.text.match(/^\s*/)[0],C;if(!r&&!/\S/.test(h.text))C=0,i="not";else if(i=="smart"&&(C=s.mode.indent(l,h.text.slice(v.length),h.text),C==Ke||C>150)){if(!r)return;i="prev"}i=="prev"?t>s.first?C=_e(fe(s,t-1).text,null,c):C=0:i=="add"?C=g+e.options.indentUnit:i=="subtract"?C=g-e.options.indentUnit:typeof i=="number"&&(C=g+i),C=Math.max(0,C);var _="",M=0;if(e.options.indentWithTabs)for(var I=Math.floor(C/c);I;--I)M+=c,_+=" ";if(M<C&&(_+=qt(C-M)),_!=v)return Hr(s,_,P(t,0),P(t,v.length),"+input"),h.stateAfter=null,!0;for(var z=0;z<s.sel.ranges.length;z++){var U=s.sel.ranges[z];if(U.head.line==t&&U.head.ch<v.length){var V=P(t,v.length);Ks(s,z,new Be(V,V));break}}}var hn=null;function Oa(e){hn=e}function to(e,t,i,r,s){var l=e.doc;e.display.shift=!1,r||(r=l.sel);var c=+new Date-200,h=s=="paste"||e.state.pasteIncoming>c,g=en(t),v=null;if(h&&r.ranges.length>1)if(hn&&hn.text.join(`
13
- `)==t){if(r.ranges.length%hn.text.length==0){v=[];for(var C=0;C<hn.text.length;C++)v.push(l.splitLines(hn.text[C]))}}else g.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(v=kt(g,function(ee){return[ee]}));for(var _=e.curOp.updateInput,M=r.ranges.length-1;M>=0;M--){var I=r.ranges[M],z=I.from(),U=I.to();I.empty()&&(i&&i>0?z=P(z.line,z.ch-i):e.state.overwrite&&!h?U=P(U.line,Math.min(fe(l,U.line).text.length,U.ch+be(g).length)):h&&hn&&hn.lineWise&&hn.text.join(`
9
+ height: `+(t.bottom-t.top+yn(e)+i.barHeight)+`px;
10
+ left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(c),c.scrollIntoView(s),e.display.lineSpace.removeChild(c)}}}function $g(e,t,i,r){r==null&&(r=0);var s;!e.options.lineWrapping&&t==i&&(i=t.sticky=="before"?P(t.line,t.ch+1,"before"):t,t=t.ch?P(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var l=0;l<5;l++){var c=!1,h=cn(e,t),g=!i||i==t?h:cn(e,i);s={left:Math.min(h.left,g.left),top:Math.min(h.top,g.top)-r,right:Math.max(h.left,g.left),bottom:Math.max(h.bottom,g.bottom)+r};var v=Rs(e,s),C=e.doc.scrollTop,_=e.doc.scrollLeft;if(v.scrollTop!=null&&(xi(e,v.scrollTop),Math.abs(e.doc.scrollTop-C)>1&&(c=!0)),v.scrollLeft!=null&&(sr(e,v.scrollLeft),Math.abs(e.doc.scrollLeft-_)>1&&(c=!0)),!c)break}return s}function Bg(e,t){var i=Rs(e,t);i.scrollTop!=null&&xi(e,i.scrollTop),i.scrollLeft!=null&&sr(e,i.scrollLeft)}function Rs(e,t){var i=e.display,r=Nr(e.display);t.top<0&&(t.top=0);var s=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,l=ks(e),c={};t.bottom-t.top>l&&(t.bottom=t.top+l);var h=e.doc.height+ws(i),g=t.top<r,v=t.bottom>h-r;if(t.top<s)c.scrollTop=g?0:t.top;else if(t.bottom>s+l){var C=Math.min(t.top,(v?h:t.bottom)-l);C!=s&&(c.scrollTop=C)}var _=e.options.fixedGutter?0:i.gutters.offsetWidth,M=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-_,I=nr(e)-i.gutters.offsetWidth,z=t.right-t.left>I;return z&&(t.right=t.left+I),t.left<10?c.scrollLeft=0:t.left<M?c.scrollLeft=Math.max(0,t.left+_-(z?0:10)):t.right>I+M-3&&(c.scrollLeft=t.right+(z?0:10)-I),c}function Fs(e,t){t!=null&&(ba(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Fr(e){ba(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function bi(e,t,i){(t!=null||i!=null)&&ba(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Hg(e,t){ba(e),e.curOp.scrollToPos=t}function ba(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=Au(e,t.from),r=Au(e,t.to);zu(e,i,r,t.margin)}}function zu(e,t,i,r){var s=Rs(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-r,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+r});bi(e,s.scrollLeft,s.scrollTop)}function xi(e,t){Math.abs(e.doc.scrollTop-t)<2||(f||zs(e,{top:t}),$u(e,t,!0),f&&zs(e),Si(e,100))}function $u(e,t,i){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),!(e.display.scroller.scrollTop==t&&!i)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function sr(e,t,i,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),!((i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)&&(e.doc.scrollLeft=t,qu(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function wi(e){var t=e.display,i=t.gutters.offsetWidth,r=Math.round(e.doc.height+ws(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?i:0,docHeight:r,scrollHeight:r+yn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var or=function(e,t,i){this.cm=i;var r=this.vert=k("div",[k("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),s=this.horiz=k("div",[k("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=s.tabIndex=-1,e(r),e(s),me(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),me(s,"scroll",function(){s.clientWidth&&t(s.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,m&&x<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};or.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var s=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+s)+"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=i?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var l=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+l)+"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:i?r:0,bottom:t?r:0}},or.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},or.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},or.prototype.zeroWidthHack=function(){var e=ne&&!F?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new ft,this.disableVert=new ft},or.prototype.enableZeroWidthBar=function(e,t,i){e.style.visibility="";function r(){var s=e.getBoundingClientRect(),l=i=="vert"?document.elementFromPoint(s.right-1,(s.top+s.bottom)/2):document.elementFromPoint((s.right+s.left)/2,s.bottom-1);l!=e?e.style.visibility="hidden":t.set(1e3,r)}t.set(1e3,r)},or.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ki=function(){};ki.prototype.update=function(){return{bottom:0,right:0}},ki.prototype.setScrollLeft=function(){},ki.prototype.setScrollTop=function(){},ki.prototype.clear=function(){};function Pr(e,t){t||(t=wi(e));var i=e.display.barWidth,r=e.display.barHeight;Bu(e,t);for(var s=0;s<4&&i!=e.display.barWidth||r!=e.display.barHeight;s++)i!=e.display.barWidth&&e.options.lineWrapping&&va(e),Bu(e,wi(e)),i=e.display.barWidth,r=e.display.barHeight}function Bu(e,t){var i=e.display,r=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=r.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=r.bottom)+"px",i.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=r.bottom+"px",i.scrollbarFiller.style.width=r.right+"px"):i.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=r.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}var Hu={native:or,null:ki};function Wu(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&ze(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Hu[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),me(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?sr(e,t):xi(e,t)},e),e.display.scrollbars.addClass&&K(e.display.wrapper,e.display.scrollbars.addClass)}var Wg=0;function lr(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:++Wg,markArrays:null},bg(e.curOp)}function ur(e){var t=e.curOp;t&&wg(t,function(i){for(var r=0;r<i.ops.length;r++)i.ops[r].cm.curOp=null;jg(i)})}function jg(e){for(var t=e.ops,i=0;i<t.length;i++)qg(t[i]);for(var r=0;r<t.length;r++)Ug(t[r]);for(var s=0;s<t.length;s++)Gg(t[s]);for(var l=0;l<t.length;l++)Kg(t[l]);for(var c=0;c<t.length;c++)Xg(t[c])}function qg(e){var t=e.cm,i=t.display;Vg(t),e.updateMaxLine&&bs(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<i.viewFrom||e.scrollToPos.to.line>=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new xa(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Ug(e){e.updatedDisplay=e.mustUpdate&&Ps(e.cm,e.update)}function Gg(e){var t=e.cm,i=t.display;e.updatedDisplay&&va(t),e.barMeasure=wi(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=ku(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+yn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-nr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function Kg(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&sr(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var i=e.focus&&e.focus==R(oe(t));e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,i),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Pr(t,e.barMeasure),e.updatedDisplay&&Bs(t,e.barMeasure),e.selectionChanged&&Os(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),i&&Fu(e.cm)}function Xg(e){var t=e.cm,i=t.display,r=t.doc;if(e.updatedDisplay&&ju(t,e.update),i.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(i.wheelStartX=i.wheelStartY=null),e.scrollTop!=null&&$u(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&sr(t,e.scrollLeft,!0,!0),e.scrollToPos){var s=$g(t,Se(r,e.scrollToPos.from),Se(r,e.scrollToPos.to),e.scrollToPos.margin);zg(t,s)}var l=e.maybeHiddenMarkers,c=e.maybeUnhiddenMarkers;if(l)for(var h=0;h<l.length;++h)l[h].lines.length||et(l[h],"hide");if(c)for(var g=0;g<c.length;++g)c[g].lines.length&&et(c[g],"unhide");i.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&et(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Bt(e,t){if(e.curOp)return t();lr(e);try{return t()}finally{ur(e)}}function yt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);lr(e);try{return t.apply(e,arguments)}finally{ur(e)}}}function Et(e){return function(){if(this.curOp)return e.apply(this,arguments);lr(this);try{return e.apply(this,arguments)}finally{ur(this)}}}function bt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);lr(t);try{return e.apply(this,arguments)}finally{ur(t)}}}function Si(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,ce(Yg,e))}function Yg(e){var t=e.doc;if(!(t.highlightFrontier>=e.display.viewTo)){var i=+new Date+e.options.workTime,r=hi(e,t.highlightFrontier),s=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(l){if(r.line>=e.display.viewFrom){var c=l.styles,h=l.text.length>e.options.maxHighlightLength?mn(t.mode,r.state):null,g=Vl(e,l,r,!0);h&&(r.state=h),l.styles=g.styles;var v=l.styleClasses,C=g.classes;C?l.styleClasses=C:v&&(l.styleClasses=null);for(var _=!c||c.length!=l.styles.length||v!=C&&(!v||!C||v.bgClass!=C.bgClass||v.textClass!=C.textClass),M=0;!_&&M<c.length;++M)_=c[M]!=l.styles[M];_&&s.push(r.line),l.stateAfter=r.save(),r.nextLine()}else l.text.length<=e.options.maxHighlightLength&&ds(e,l.text,r),l.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>i)return Si(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),s.length&&Bt(e,function(){for(var l=0;l<s.length;l++)$n(e,s[l],"text")})}}var xa=function(e,t,i){var r=e.display;this.viewport=t,this.visible=ya(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=nr(e),this.force=i,this.dims=Es(e),this.events=[]};xa.prototype.signal=function(e,t){$t(e,t)&&this.events.push(arguments)},xa.prototype.finish=function(){for(var e=0;e<this.events.length;e++)et.apply(null,this.events[e])};function Vg(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=yn(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=yn(e)+"px",t.scrollbarsClipped=!0)}function Jg(e){if(e.hasFocus())return null;var t=R(oe(e));if(!t||!D(e.display.lineDiv,t))return null;var i={activeElt:t};if(window.getSelection){var r=Z(e).getSelection();r.anchorNode&&r.extend&&D(e.display.lineDiv,r.anchorNode)&&(i.anchorNode=r.anchorNode,i.anchorOffset=r.anchorOffset,i.focusNode=r.focusNode,i.focusOffset=r.focusOffset)}return i}function Qg(e){if(!(!e||!e.activeElt||e.activeElt==R(Te(e.activeElt)))&&(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&D(document.body,e.anchorNode)&&D(document.body,e.focusNode))){var t=e.activeElt.ownerDocument,i=t.defaultView.getSelection(),r=t.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),i.removeAllRanges(),i.addRange(r),i.extend(e.focusNode,e.focusOffset)}}function Ps(e,t){var i=e.display,r=e.doc;if(t.editorIsHidden)return Bn(e),!1;if(!t.force&&t.visible.from>=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&Mu(e)==0)return!1;Uu(e)&&(Bn(e),t.dims=Es(e));var s=r.first+r.size,l=Math.max(t.visible.from-e.options.viewportMargin,r.first),c=Math.min(s,t.visible.to+e.options.viewportMargin);i.viewFrom<l&&l-i.viewFrom<20&&(l=Math.max(r.first,i.viewFrom)),i.viewTo>c&&i.viewTo-c<20&&(c=Math.min(s,i.viewTo)),Cn&&(l=vs(e.doc,l),c=fu(e.doc,c));var h=l!=i.viewFrom||c!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Fg(e,l,c),i.viewOffset=Tn(fe(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var g=Mu(e);if(!h&&g==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var v=Jg(e);return g>4&&(i.lineDiv.style.display="none"),Zg(e,i.updateLineNumbers,t.dims),g>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,Qg(v),W(i.cursorDiv),W(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,h&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,Si(e,400)),i.updateLineNumbers=null,!0}function ju(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==nr(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+ws(e.display)-ks(e),i.top)}),t.visible=ya(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=ya(e.display,e.doc,i));if(!Ps(e,t))break;va(e);var s=wi(e);yi(e),Pr(e,s),Bs(e,s),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 zs(e,t){var i=new xa(e,t);if(Ps(e,i)){va(e),ju(e,i);var r=wi(e);yi(e),Pr(e,r),Bs(e,r),i.finish()}}function Zg(e,t,i){var r=e.display,s=e.options.lineNumbers,l=r.lineDiv,c=l.firstChild;function h(z){var q=z.nextSibling;return S&&ne&&e.display.currentWheelTarget==z?z.style.display="none":z.parentNode.removeChild(z),q}for(var g=r.view,v=r.viewFrom,C=0;C<g.length;C++){var _=g[C];if(!_.hidden)if(!_.node||_.node.parentNode!=l){var M=_g(e,_,v,i);l.insertBefore(M,c)}else{for(;c!=_.node;)c=h(c);var I=s&&t!=null&&t<=v&&_.lineNumber;_.changes&&(we(_.changes,"gutter")>-1&&(I=!1),gu(e,_,v,i)),I&&(W(_.lineNumber),_.lineNumber.appendChild(document.createTextNode(Y(e.options,v)))),c=_.node.nextSibling}v+=_.size}for(;c;)c=h(c)}function $s(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",vt(e,"gutterChanged",e)}function Bs(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+yn(e)+"px"}function qu(e){var t=e.display,i=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var r=Ds(t)-t.scroller.scrollLeft+e.doc.scrollLeft,s=t.gutters.offsetWidth,l=r+"px",c=0;c<i.length;c++)if(!i[c].hidden){e.options.fixedGutter&&(i[c].gutter&&(i[c].gutter.style.left=l),i[c].gutterBackground&&(i[c].gutterBackground.style.left=l));var h=i[c].alignable;if(h)for(var g=0;g<h.length;g++)h[g].style.left=l}e.options.fixedGutter&&(t.gutters.style.left=r+s+"px")}}function Uu(e){if(!e.options.lineNumbers)return!1;var t=e.doc,i=Y(e.options,t.first+t.size-1),r=e.display;if(i.length!=r.lineNumChars){var s=r.measure.appendChild(k("div",[k("div",i)],"CodeMirror-linenumber CodeMirror-gutter-elt")),l=s.firstChild.offsetWidth,c=s.offsetWidth-l;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(l,r.lineGutter.offsetWidth-c)+1,r.lineNumWidth=r.lineNumInnerWidth+c,r.lineNumChars=r.lineNumInnerWidth?i.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",$s(e.display),!0}return!1}function Hs(e,t){for(var i=[],r=!1,s=0;s<e.length;s++){var l=e[s],c=null;if(typeof l!="string"&&(c=l.style,l=l.className),l=="CodeMirror-linenumbers")if(t)r=!0;else continue;i.push({className:l,style:c})}return t&&!r&&i.push({className:"CodeMirror-linenumbers",style:null}),i}function Gu(e){var t=e.gutters,i=e.gutterSpecs;W(t),e.lineGutter=null;for(var r=0;r<i.length;++r){var s=i[r],l=s.className,c=s.style,h=t.appendChild(k("div",null,"CodeMirror-gutter "+l));c&&(h.style.cssText=c),l=="CodeMirror-linenumbers"&&(e.lineGutter=h,h.style.width=(e.lineNumWidth||1)+"px")}t.style.display=i.length?"":"none",$s(e)}function Ci(e){Gu(e.display),Ot(e),qu(e)}function em(e,t,i,r){var s=this;this.input=i,s.scrollbarFiller=k("div",null,"CodeMirror-scrollbar-filler"),s.scrollbarFiller.setAttribute("cm-not-content","true"),s.gutterFiller=k("div",null,"CodeMirror-gutter-filler"),s.gutterFiller.setAttribute("cm-not-content","true"),s.lineDiv=J("div",null,"CodeMirror-code"),s.selectionDiv=k("div",null,null,"position: relative; z-index: 1"),s.cursorDiv=k("div",null,"CodeMirror-cursors"),s.measure=k("div",null,"CodeMirror-measure"),s.lineMeasure=k("div",null,"CodeMirror-measure"),s.lineSpace=J("div",[s.measure,s.lineMeasure,s.selectionDiv,s.cursorDiv,s.lineDiv],null,"position: relative; outline: none");var l=J("div",[s.lineSpace],"CodeMirror-lines");s.mover=k("div",[l],null,"position: relative"),s.sizer=k("div",[s.mover],"CodeMirror-sizer"),s.sizerWidth=null,s.heightForcer=k("div",null,null,"position: absolute; height: "+Me+"px; width: 1px;"),s.gutters=k("div",null,"CodeMirror-gutters"),s.lineGutter=null,s.scroller=k("div",[s.sizer,s.heightForcer,s.gutters],"CodeMirror-scroll"),s.scroller.setAttribute("tabIndex","-1"),s.wrapper=k("div",[s.scrollbarFiller,s.gutterFiller,s.scroller],"CodeMirror"),E&&H===105&&(s.wrapper.style.clipPath="inset(0px)"),s.wrapper.setAttribute("translate","no"),m&&x<8&&(s.gutters.style.zIndex=-1,s.scroller.style.paddingRight=0),!S&&!(f&&X)&&(s.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(s.wrapper):e(s.wrapper)),s.viewFrom=s.viewTo=t.first,s.reportedViewFrom=s.reportedViewTo=t.first,s.view=[],s.renderedView=null,s.externalMeasured=null,s.viewOffset=0,s.lastWrapHeight=s.lastWrapWidth=0,s.updateLineNumbers=null,s.nativeBarWidth=s.barHeight=s.barWidth=0,s.scrollbarsClipped=!1,s.lineNumWidth=s.lineNumInnerWidth=s.lineNumChars=null,s.alignWidgets=!1,s.cachedCharWidth=s.cachedTextHeight=s.cachedPaddingH=null,s.maxLine=null,s.maxLineLength=0,s.maxLineChanged=!1,s.wheelDX=s.wheelDY=s.wheelStartX=s.wheelStartY=null,s.shift=!1,s.selForContextMenu=null,s.activeTouch=null,s.gutterSpecs=Hs(r.gutters,r.lineNumbers),Gu(s),i.init(s)}var wa=0,Ln=null;m?Ln=-.53:f?Ln=15:E?Ln=-.7:U&&(Ln=-1/3);function Ku(e){var t=e.wheelDeltaX,i=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),i==null&&e.detail&&e.axis==e.VERTICAL_AXIS?i=e.detail:i==null&&(i=e.wheelDelta),{x:t,y:i}}function tm(e){var t=Ku(e);return t.x*=Ln,t.y*=Ln,t}function Xu(e,t){E&&H==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 i=Ku(t),r=i.x,s=i.y,l=Ln;t.deltaMode===0&&(r=t.deltaX,s=t.deltaY,l=1);var c=e.display,h=c.scroller,g=h.scrollWidth>h.clientWidth,v=h.scrollHeight>h.clientHeight;if(r&&g||s&&v){if(s&&ne&&S){e:for(var C=t.target,_=c.view;C!=h;C=C.parentNode)for(var M=0;M<_.length;M++)if(_[M].node==C){e.display.currentWheelTarget=C;break e}}if(r&&!f&&!B&&l!=null){s&&v&&xi(e,Math.max(0,h.scrollTop+s*l)),sr(e,Math.max(0,h.scrollLeft+r*l)),(!s||s&&v)&&Tt(t),c.wheelStartX=null;return}if(s&&l!=null){var I=s*l,z=e.doc.scrollTop,q=z+c.wrapper.clientHeight;I<0?z=Math.max(0,z+I-50):q=Math.min(e.doc.height,q+I+50),zs(e,{top:z,bottom:q})}wa<20&&t.deltaMode!==0&&(c.wheelStartX==null?(c.wheelStartX=h.scrollLeft,c.wheelStartY=h.scrollTop,c.wheelDX=r,c.wheelDY=s,setTimeout(function(){if(c.wheelStartX!=null){var V=h.scrollLeft-c.wheelStartX,ee=h.scrollTop-c.wheelStartY,ae=ee&&c.wheelDY&&ee/c.wheelDY||V&&c.wheelDX&&V/c.wheelDX;c.wheelStartX=c.wheelStartY=null,ae&&(Ln=(Ln*wa+ae)/(wa+1),++wa)}},200)):(c.wheelDX+=r,c.wheelDY+=s))}}var Xt=function(e,t){this.ranges=e,this.primIndex=t};Xt.prototype.primary=function(){return this.ranges[this.primIndex]},Xt.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 i=this.ranges[t],r=e.ranges[t];if(!$e(i.anchor,r.anchor)||!$e(i.head,r.head))return!1}return!0},Xt.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Be(mt(this.ranges[t].anchor),mt(this.ranges[t].head));return new Xt(e,this.primIndex)},Xt.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Xt.prototype.contains=function(e,t){t||(t=e);for(var i=0;i<this.ranges.length;i++){var r=this.ranges[i];if(re(t,r.from())>=0&&re(e,r.to())<=0)return i}return-1};var Be=function(e,t){this.anchor=e,this.head=t};Be.prototype.from=function(){return Dr(this.anchor,this.head)},Be.prototype.to=function(){return It(this.anchor,this.head)},Be.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function hn(e,t,i){var r=e&&e.options.selectionsMayTouch,s=t[i];t.sort(function(M,I){return re(M.from(),I.from())}),i=we(t,s);for(var l=1;l<t.length;l++){var c=t[l],h=t[l-1],g=re(h.to(),c.from());if(r&&!c.empty()?g>0:g>=0){var v=Dr(h.from(),c.from()),C=It(h.to(),c.to()),_=h.empty()?c.from()==c.head:h.from()==h.head;l<=i&&--i,t.splice(--l,2,new Be(_?C:v,_?v:C))}}return new Xt(t,i)}function Hn(e,t){return new Xt([new Be(e,t||e)],0)}function Wn(e){return e.text?P(e.from.line+e.text.length-1,be(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Yu(e,t){if(re(e,t.from)<0)return e;if(re(e,t.to)<=0)return Wn(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Wn(t).ch-t.to.ch),P(i,r)}function Ws(e,t){for(var i=[],r=0;r<e.sel.ranges.length;r++){var s=e.sel.ranges[r];i.push(new Be(Yu(s.anchor,t),Yu(s.head,t)))}return hn(e.cm,i,e.sel.primIndex)}function Vu(e,t,i){return e.line==t.line?P(i.line,e.ch-t.ch+i.ch):P(i.line+(e.line-t.line),e.ch)}function nm(e,t,i){for(var r=[],s=P(e.first,0),l=s,c=0;c<t.length;c++){var h=t[c],g=Vu(h.from,s,l),v=Vu(Wn(h),s,l);if(s=h.to,l=v,i=="around"){var C=e.sel.ranges[c],_=re(C.head,C.anchor)<0;r[c]=new Be(_?v:g,_?g:v)}else r[c]=new Be(g,g)}return new Xt(r,e.sel.primIndex)}function js(e){e.doc.mode=_r(e.options,e.doc.modeOption),Ti(e)}function Ti(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,Si(e,100),e.state.modeGen++,e.curOp&&Ot(e)}function Ju(e,t){return t.from.ch==0&&t.to.ch==0&&be(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function qs(e,t,i,r){function s(ae){return i?i[ae]:null}function l(ae,te,le){fg(ae,te,le,r),vt(ae,"change",ae,t)}function c(ae,te){for(var le=[],ve=ae;ve<te;++ve)le.push(new Ar(v[ve],s(ve),r));return le}var h=t.from,g=t.to,v=t.text,C=fe(e,h.line),_=fe(e,g.line),M=be(v),I=s(v.length-1),z=g.line-h.line;if(t.full)e.insert(0,c(0,v.length)),e.remove(v.length,e.size-v.length);else if(Ju(e,t)){var q=c(0,v.length-1);l(_,_.text,I),z&&e.remove(h.line,z),q.length&&e.insert(h.line,q)}else if(C==_)if(v.length==1)l(C,C.text.slice(0,h.ch)+M+C.text.slice(g.ch),I);else{var V=c(1,v.length-1);V.push(new Ar(M+C.text.slice(g.ch),I,r)),l(C,C.text.slice(0,h.ch)+v[0],s(0)),e.insert(h.line+1,V)}else if(v.length==1)l(C,C.text.slice(0,h.ch)+v[0]+_.text.slice(g.ch),s(0)),e.remove(h.line+1,z);else{l(C,C.text.slice(0,h.ch)+v[0],s(0)),l(_,M+_.text.slice(g.ch),I);var ee=c(1,v.length-1);z>1&&e.remove(h.line+1,z-1),e.insert(h.line+1,ee)}vt(e,"change",e,t)}function jn(e,t,i){function r(s,l,c){if(s.linked)for(var h=0;h<s.linked.length;++h){var g=s.linked[h];if(g.doc!=l){var v=c&&g.sharedHist;i&&!v||(t(g.doc,v),r(g.doc,s,v))}}}r(e,null,!0)}function Qu(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,As(e),js(e),Zu(e),e.options.direction=t.direction,e.options.lineWrapping||bs(e),e.options.mode=t.modeOption,Ot(e)}function Zu(e){(e.doc.direction=="rtl"?K:ze)(e.display.lineDiv,"CodeMirror-rtl")}function rm(e){Bt(e,function(){Zu(e),Ot(e)})}function ka(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 Us(e,t){var i={from:mt(t.from),to:Wn(t),text:Sn(e,t.from,t.to)};return nf(e,i,t.from.line,t.to.line+1),jn(e,function(r){return nf(r,i,t.from.line,t.to.line+1)},!0),i}function ef(e){for(;e.length;){var t=be(e);if(t.ranges)e.pop();else break}}function im(e,t){if(t)return ef(e.done),be(e.done);if(e.done.length&&!be(e.done).ranges)return be(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),be(e.done)}function tf(e,t,i,r){var s=e.history;s.undone.length=0;var l=+new Date,c,h;if((s.lastOp==r||s.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&s.lastModTime>l-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(c=im(s,s.lastOp==r)))h=be(c.changes),re(t.from,t.to)==0&&re(t.from,h.to)==0?h.to=Wn(t):c.changes.push(Us(e,t));else{var g=be(s.done);for((!g||!g.ranges)&&Sa(e.sel,s.done),c={changes:[Us(e,t)],generation:s.generation},s.done.push(c);s.done.length>s.undoDepth;)s.done.shift(),s.done[0].ranges||s.done.shift()}s.done.push(i),s.generation=++s.maxGeneration,s.lastModTime=s.lastSelTime=l,s.lastOp=s.lastSelOp=r,s.lastOrigin=s.lastSelOrigin=t.origin,h||et(e,"historyAdded")}function am(e,t,i,r){var s=t.charAt(0);return s=="*"||s=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function sm(e,t,i,r){var s=e.history,l=r&&r.origin;i==s.lastSelOp||l&&s.lastSelOrigin==l&&(s.lastModTime==s.lastSelTime&&s.lastOrigin==l||am(e,l,be(s.done),t))?s.done[s.done.length-1]=t:Sa(t,s.done),s.lastSelTime=+new Date,s.lastSelOrigin=l,s.lastSelOp=i,r&&r.clearRedo!==!1&&ef(s.undone)}function Sa(e,t){var i=be(t);i&&i.ranges&&i.equals(e)||t.push(e)}function nf(e,t,i,r){var s=t["spans_"+e.id],l=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(c){c.markedSpans&&((s||(s=t["spans_"+e.id]={}))[l]=c.markedSpans),++l})}function om(e){if(!e)return null;for(var t,i=0;i<e.length;++i)e[i].marker.explicitlyCleared?t||(t=e.slice(0,i)):t&&t.push(e[i]);return t?t.length?t:null:e}function lm(e,t){var i=t["spans_"+e.id];if(!i)return null;for(var r=[],s=0;s<t.text.length;++s)r.push(om(i[s]));return r}function rf(e,t){var i=lm(e,t),r=gs(e,t);if(!i)return r;if(!r)return i;for(var s=0;s<i.length;++s){var l=i[s],c=r[s];if(l&&c)e:for(var h=0;h<c.length;++h){for(var g=c[h],v=0;v<l.length;++v)if(l[v].marker==g.marker)continue e;l.push(g)}else c&&(i[s]=c)}return i}function zr(e,t,i){for(var r=[],s=0;s<e.length;++s){var l=e[s];if(l.ranges){r.push(i?Xt.prototype.deepCopy.call(l):l);continue}var c=l.changes,h=[];r.push({changes:h});for(var g=0;g<c.length;++g){var v=c[g],C=void 0;if(h.push({from:v.from,to:v.to,text:v.text}),t)for(var _ in v)(C=_.match(/^spans_(\d+)$/))&&we(t,Number(C[1]))>-1&&(be(h)[_]=v[_],delete v[_])}}return r}function Gs(e,t,i,r){if(r){var s=e.anchor;if(i){var l=re(t,s)<0;l!=re(i,s)<0?(s=t,t=i):l!=re(t,i)<0&&(t=i)}return new Be(s,t)}else return new Be(i||t,t)}function Ca(e,t,i,r,s){s==null&&(s=e.cm&&(e.cm.display.shift||e.extend)),_t(e,new Xt([Gs(e.sel.primary(),t,i,s)],0),r)}function af(e,t,i){for(var r=[],s=e.cm&&(e.cm.display.shift||e.extend),l=0;l<e.sel.ranges.length;l++)r[l]=Gs(e.sel.ranges[l],t[l],null,s);var c=hn(e.cm,r,e.sel.primIndex);_t(e,c,i)}function Ks(e,t,i,r){var s=e.sel.ranges.slice(0);s[t]=i,_t(e,hn(e.cm,s,e.sel.primIndex),r)}function sf(e,t,i,r){_t(e,Hn(t,i),r)}function um(e,t,i){var r={ranges:t.ranges,update:function(s){this.ranges=[];for(var l=0;l<s.length;l++)this.ranges[l]=new Be(Se(e,s[l].anchor),Se(e,s[l].head))},origin:i&&i.origin};return et(e,"beforeSelectionChange",e,r),e.cm&&et(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?hn(e.cm,r.ranges,r.ranges.length-1):t}function of(e,t,i){var r=e.history.done,s=be(r);s&&s.ranges?(r[r.length-1]=t,Ta(e,t,i)):_t(e,t,i)}function _t(e,t,i){Ta(e,t,i),sm(e,e.sel,e.cm?e.cm.curOp.id:NaN,i)}function Ta(e,t,i){($t(e,"beforeSelectionChange")||e.cm&&$t(e.cm,"beforeSelectionChange"))&&(t=um(e,t,i));var r=i&&i.bias||(re(t.primary().head,e.sel.primary().head)<0?-1:1);lf(e,ff(e,t,r,!0)),!(i&&i.scroll===!1)&&e.cm&&e.cm.getOption("readOnly")!="nocursor"&&Fr(e.cm)}function lf(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Zt(e.cm)),vt(e,"cursorActivity",e))}function uf(e){lf(e,ff(e,e.sel,null,!1))}function ff(e,t,i,r){for(var s,l=0;l<t.ranges.length;l++){var c=t.ranges[l],h=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[l],g=_a(e,c.anchor,h&&h.anchor,i,r),v=c.head==c.anchor?g:_a(e,c.head,h&&h.head,i,r);(s||g!=c.anchor||v!=c.head)&&(s||(s=t.ranges.slice(0,l)),s[l]=new Be(g,v))}return s?hn(e.cm,s,t.primIndex):t}function $r(e,t,i,r,s){var l=fe(e,t.line);if(l.markedSpans)for(var c=0;c<l.markedSpans.length;++c){var h=l.markedSpans[c],g=h.marker,v="selectLeft"in g?!g.selectLeft:g.inclusiveLeft,C="selectRight"in g?!g.selectRight:g.inclusiveRight;if((h.from==null||(v?h.from<=t.ch:h.from<t.ch))&&(h.to==null||(C?h.to>=t.ch:h.to>t.ch))){if(s&&(et(g,"beforeCursorEnter"),g.explicitlyCleared))if(l.markedSpans){--c;continue}else break;if(!g.atomic)continue;if(i){var _=g.find(r<0?1:-1),M=void 0;if((r<0?C:v)&&(_=cf(e,_,-r,_&&_.line==t.line?l:null)),_&&_.line==t.line&&(M=re(_,i))&&(r<0?M<0:M>0))return $r(e,_,t,r,s)}var I=g.find(r<0?-1:1);return(r<0?v:C)&&(I=cf(e,I,r,I.line==t.line?l:null)),I?$r(e,I,t,r,s):null}}return t}function _a(e,t,i,r,s){var l=r||1,c=$r(e,t,i,l,s)||!s&&$r(e,t,i,l,!0)||$r(e,t,i,-l,s)||!s&&$r(e,t,i,-l,!0);return c||(e.cantEdit=!0,P(e.first,0))}function cf(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?Se(e,P(t.line-1)):null:i>0&&t.ch==(r||fe(e,t.line)).text.length?t.line<e.first+e.size-1?P(t.line+1,0):null:new P(t.line,t.ch+i)}function hf(e){e.setSelection(P(e.firstLine(),0),P(e.lastLine()),ct)}function df(e,t,i){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return i&&(r.update=function(s,l,c,h){s&&(r.from=Se(e,s)),l&&(r.to=Se(e,l)),c&&(r.text=c),h!==void 0&&(r.origin=h)}),et(e,"beforeChange",e,r),e.cm&&et(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 Br(e,t,i){if(e.cm){if(!e.cm.curOp)return yt(e.cm,Br)(e,t,i);if(e.cm.state.suppressEdits)return}if(!(($t(e,"beforeChange")||e.cm&&$t(e.cm,"beforeChange"))&&(t=df(e,t,!0),!t))){var r=ru&&!i&&sg(e,t.from,t.to);if(r)for(var s=r.length-1;s>=0;--s)pf(e,{from:r[s].from,to:r[s].to,text:s?[""]:t.text,origin:t.origin});else pf(e,t)}}function pf(e,t){if(!(t.text.length==1&&t.text[0]==""&&re(t.from,t.to)==0)){var i=Ws(e,t);tf(e,t,i,e.cm?e.cm.curOp.id:NaN),_i(e,t,i,gs(e,t));var r=[];jn(e,function(s,l){!l&&we(r,s.history)==-1&&(yf(s.history,t),r.push(s.history)),_i(s,t,null,gs(s,t))})}}function La(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(!(r&&!i)){for(var s=e.history,l,c=e.sel,h=t=="undo"?s.done:s.undone,g=t=="undo"?s.undone:s.done,v=0;v<h.length&&(l=h[v],!(i?l.ranges&&!l.equals(e.sel):!l.ranges));v++);if(v!=h.length){for(s.lastOrigin=s.lastSelOrigin=null;;)if(l=h.pop(),l.ranges){if(Sa(l,g),i&&!l.equals(e.sel)){_t(e,l,{clearRedo:!1});return}c=l}else if(r){h.push(l);return}else break;var C=[];Sa(c,g),g.push({changes:C,generation:s.generation}),s.generation=l.generation||++s.maxGeneration;for(var _=$t(e,"beforeChange")||e.cm&&$t(e.cm,"beforeChange"),M=function(q){var V=l.changes[q];if(V.origin=t,_&&!df(e,V,!1))return h.length=0,{};C.push(Us(e,V));var ee=q?Ws(e,V):be(h);_i(e,V,ee,rf(e,V)),!q&&e.cm&&e.cm.scrollIntoView({from:V.from,to:Wn(V)});var ae=[];jn(e,function(te,le){!le&&we(ae,te.history)==-1&&(yf(te.history,V),ae.push(te.history)),_i(te,V,null,rf(te,V))})},I=l.changes.length-1;I>=0;--I){var z=M(I);if(z)return z.v}}}}function gf(e,t){if(t!=0&&(e.first+=t,e.sel=new Xt(kt(e.sel.ranges,function(s){return new Be(P(s.anchor.line+t,s.anchor.ch),P(s.head.line+t,s.head.ch))}),e.sel.primIndex),e.cm)){Ot(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;r<i.viewTo;r++)$n(e.cm,r,"gutter")}}function _i(e,t,i,r){if(e.cm&&!e.cm.curOp)return yt(e.cm,_i)(e,t,i,r);if(t.to.line<e.first){gf(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 s=t.text.length-1-(e.first-t.from.line);gf(e,s),t={from:P(e.first,0),to:P(t.to.line+s,t.to.ch),text:[be(t.text)],origin:t.origin}}var l=e.lastLine();t.to.line>l&&(t={from:t.from,to:P(l,fe(e,l).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Sn(e,t.from,t.to),i||(i=Ws(e,t)),e.cm?fm(e.cm,t,r):qs(e,t,r),Ta(e,i,ct),e.cantEdit&&_a(e,P(e.firstLine(),0))&&(e.cantEdit=!1)}}function fm(e,t,i){var r=e.doc,s=e.display,l=t.from,c=t.to,h=!1,g=l.line;e.options.lineWrapping||(g=b(fn(fe(r,l.line))),r.iter(g,c.line+1,function(I){if(I==s.maxLine)return h=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Zt(e),qs(r,t,i,Nu(e)),e.options.lineWrapping||(r.iter(g,l.line+t.text.length,function(I){var z=fa(I);z>s.maxLineLength&&(s.maxLine=I,s.maxLineLength=z,s.maxLineChanged=!0,h=!1)}),h&&(e.curOp.updateMaxLine=!0)),Zp(r,l.line),Si(e,400);var v=t.text.length-(c.line-l.line)-1;t.full?Ot(e):l.line==c.line&&t.text.length==1&&!Ju(e.doc,t)?$n(e,l.line,"text"):Ot(e,l.line,c.line+1,v);var C=$t(e,"changes"),_=$t(e,"change");if(_||C){var M={from:l,to:c,text:t.text,removed:t.removed,origin:t.origin};_&&vt(e,"change",e,M),C&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(M)}e.display.selForContextMenu=null}function Hr(e,t,i,r,s){var l;r||(r=i),re(r,i)<0&&(l=[r,i],i=l[0],r=l[1]),typeof t=="string"&&(t=e.splitLines(t)),Br(e,{from:i,to:r,text:t,origin:s})}function mf(e,t,i,r){i<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function vf(e,t,i,r){for(var s=0;s<e.length;++s){var l=e[s],c=!0;if(l.ranges){l.copied||(l=e[s]=l.deepCopy(),l.copied=!0);for(var h=0;h<l.ranges.length;h++)mf(l.ranges[h].anchor,t,i,r),mf(l.ranges[h].head,t,i,r);continue}for(var g=0;g<l.changes.length;++g){var v=l.changes[g];if(i<v.from.line)v.from=P(v.from.line+r,v.from.ch),v.to=P(v.to.line+r,v.to.ch);else if(t<=v.to.line){c=!1;break}}c||(e.splice(0,s+1),s=0)}}function yf(e,t){var i=t.from.line,r=t.to.line,s=t.text.length-(r-i)-1;vf(e.done,i,r,s),vf(e.undone,i,r,s)}function Li(e,t,i,r){var s=t,l=t;return typeof t=="number"?l=fe(e,Xl(e,t)):s=b(t),s==null?null:(r(l,s)&&e.cm&&$n(e.cm,s,i),l)}function Ei(e){this.lines=e,this.parent=null;for(var t=0,i=0;i<e.length;++i)e[i].parent=this,t+=e[i].height;this.height=t}Ei.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var i=e,r=e+t;i<r;++i){var s=this.lines[i];this.height-=s.height,cg(s),vt(s,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,i){this.height+=i,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,i){for(var r=e+t;e<r;++e)if(i(this.lines[e]))return!0}};function Di(e){this.children=e;for(var t=0,i=0,r=0;r<e.length;++r){var s=e[r];t+=s.chunkSize(),i+=s.height,s.parent=this}this.size=t,this.height=i,this.parent=null}Di.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var i=0;i<this.children.length;++i){var r=this.children[i],s=r.chunkSize();if(e<s){var l=Math.min(t,s-e),c=r.height;if(r.removeInner(e,l),this.height-=c-r.height,s==l&&(this.children.splice(i--,1),r.parent=null),(t-=l)==0)break;e=0}else e-=s}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Ei))){var h=[];this.collapse(h),this.children=[new Ei(h)],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,i){this.size+=t.length,this.height+=i;for(var r=0;r<this.children.length;++r){var s=this.children[r],l=s.chunkSize();if(e<=l){if(s.insertInner(e,t,i),s.lines&&s.lines.length>50){for(var c=s.lines.length%25+25,h=c;h<s.lines.length;){var g=new Ei(s.lines.slice(h,h+=25));s.height-=g.height,this.children.splice(++r,0,g),g.parent=this}s.lines=s.lines.slice(0,c),this.maybeSpill()}break}e-=l}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),i=new Di(t);if(e.parent){e.size-=i.size,e.height-=i.height;var s=we(e.parent.children,e);e.parent.children.splice(s+1,0,i)}else{var r=new Di(e.children);r.parent=e,e.children=[r,i],e=r}i.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,i){for(var r=0;r<this.children.length;++r){var s=this.children[r],l=s.chunkSize();if(e<l){var c=Math.min(t,l-e);if(s.iterN(e,c,i))return!0;if((t-=c)==0)break;e=0}else e-=l}}};var Ai=function(e,t,i){if(i)for(var r in i)i.hasOwnProperty(r)&&(this[r]=i[r]);this.doc=e,this.node=t};Ai.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,i=this.line,r=b(i);if(!(r==null||!t)){for(var s=0;s<t.length;++s)t[s]==this&&t.splice(s--,1);t.length||(i.widgets=null);var l=mi(this);Kt(i,Math.max(0,i.height-l)),e&&(Bt(e,function(){bf(e,i,-l),$n(e,r,"widget")}),vt(e,"lineWidgetCleared",e,this,r))}},Ai.prototype.changed=function(){var e=this,t=this.height,i=this.doc.cm,r=this.line;this.height=null;var s=mi(this)-t;s&&(zn(this.doc,r)||Kt(r,r.height+s),i&&Bt(i,function(){i.curOp.forceUpdate=!0,bf(i,r,s),vt(i,"lineWidgetChanged",i,e,b(r))}))},an(Ai);function bf(e,t,i){Tn(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Fs(e,i)}function cm(e,t,i,r){var s=new Ai(e,i,r),l=e.cm;return l&&s.noHScroll&&(l.display.alignWidgets=!0),Li(e,t,"widget",function(c){var h=c.widgets||(c.widgets=[]);if(s.insertAt==null?h.push(s):h.splice(Math.min(h.length,Math.max(0,s.insertAt)),0,s),s.line=c,l&&!zn(e,c)){var g=Tn(c)<e.scrollTop;Kt(c,c.height+mi(s)),g&&Fs(l,s.height),l.curOp.forceUpdate=!0}return!0}),l&&vt(l,"lineWidgetAdded",l,s,typeof t=="number"?t:b(t)),s}var xf=0,qn=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++xf};qn.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&lr(e),$t(this,"clear")){var i=this.find();i&&vt(this,"clear",i.from,i.to)}for(var r=null,s=null,l=0;l<this.lines.length;++l){var c=this.lines[l],h=di(c.markedSpans,this);e&&!this.collapsed?$n(e,b(c),"text"):e&&(h.to!=null&&(s=b(c)),h.from!=null&&(r=b(c))),c.markedSpans=ng(c.markedSpans,h),h.from==null&&this.collapsed&&!zn(this.doc,c)&&e&&Kt(c,Nr(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var g=0;g<this.lines.length;++g){var v=fn(this.lines[g]),C=fa(v);C>e.display.maxLineLength&&(e.display.maxLine=v,e.display.maxLineLength=C,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Ot(e,r,s+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&uf(e.doc)),e&&vt(e,"markerCleared",e,this,r,s),t&&ur(e),this.parent&&this.parent.clear()}},qn.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,s=0;s<this.lines.length;++s){var l=this.lines[s],c=di(l.markedSpans,this);if(c.from!=null&&(i=P(t?l:b(l),c.from),e==-1))return i;if(c.to!=null&&(r=P(t?l:b(l),c.to),e==1))return r}return i&&{from:i,to:r}},qn.prototype.changed=function(){var e=this,t=this.find(-1,!0),i=this,r=this.doc.cm;!t||!r||Bt(r,function(){var s=t.line,l=b(t.line),c=Ss(r,l);if(c&&(Tu(c),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!zn(i.doc,s)&&i.height!=null){var h=i.height;i.height=null;var g=mi(i)-h;g&&Kt(s,s.height+g)}vt(r,"markerChanged",r,e)})},qn.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||we(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},qn.prototype.detachLine=function(e){if(this.lines.splice(we(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},an(qn);function Wr(e,t,i,r,s){if(r&&r.shared)return hm(e,t,i,r,s);if(e.cm&&!e.cm.curOp)return yt(e.cm,Wr)(e,t,i,r,s);var l=new qn(e,s),c=re(t,i);if(r&&ke(r,l,!1),c>0||c==0&&l.clearWhenEmpty!==!1)return l;if(l.replacedWith&&(l.collapsed=!0,l.widgetNode=J("span",[l.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||l.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(l.widgetNode.insertLeft=!0)),l.collapsed){if(uu(e,t.line,t,i,l)||t.line!=i.line&&uu(e,i.line,t,i,l))throw new Error("Inserting collapsed marker partially overlapping an existing one");tg()}l.addToHistory&&tf(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var h=t.line,g=e.cm,v;if(e.iter(h,i.line+1,function(_){g&&l.collapsed&&!g.options.lineWrapping&&fn(_)==g.display.maxLine&&(v=!0),l.collapsed&&h!=t.line&&Kt(_,0),rg(_,new sa(l,h==t.line?t.ch:null,h==i.line?i.ch:null),e.cm&&e.cm.curOp),++h}),l.collapsed&&e.iter(t.line,i.line+1,function(_){zn(e,_)&&Kt(_,0)}),l.clearOnEnter&&me(l,"beforeCursorEnter",function(){return l.clear()}),l.readOnly&&(eg(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),l.collapsed&&(l.id=++xf,l.atomic=!0),g){if(v&&(g.curOp.updateMaxLine=!0),l.collapsed)Ot(g,t.line,i.line+1);else if(l.className||l.startStyle||l.endStyle||l.css||l.attributes||l.title)for(var C=t.line;C<=i.line;C++)$n(g,C,"text");l.atomic&&uf(g.doc),vt(g,"markerAdded",g,l)}return l}var Ii=function(e,t){this.markers=e,this.primary=t;for(var i=0;i<e.length;++i)e[i].parent=this};Ii.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();vt(this,"clear")}},Ii.prototype.find=function(e,t){return this.primary.find(e,t)},an(Ii);function hm(e,t,i,r,s){r=ke(r),r.shared=!1;var l=[Wr(e,t,i,r,s)],c=l[0],h=r.widgetNode;return jn(e,function(g){h&&(r.widgetNode=h.cloneNode(!0)),l.push(Wr(g,Se(g,t),Se(g,i),r,s));for(var v=0;v<g.linked.length;++v)if(g.linked[v].isParent)return;c=be(l)}),new Ii(l,c)}function wf(e){return e.findMarks(P(e.first,0),e.clipPos(P(e.lastLine())),function(t){return t.parent})}function dm(e,t){for(var i=0;i<t.length;i++){var r=t[i],s=r.find(),l=e.clipPos(s.from),c=e.clipPos(s.to);if(re(l,c)){var h=Wr(e,l,c,r.primary,r.primary.type);r.markers.push(h),h.parent=r}}}function pm(e){for(var t=function(r){var s=e[r],l=[s.primary.doc];jn(s.primary.doc,function(g){return l.push(g)});for(var c=0;c<s.markers.length;c++){var h=s.markers[c];we(l,h.doc)==-1&&(h.parent=null,s.markers.splice(c--,1))}},i=0;i<e.length;i++)t(i)}var gm=0,Nt=function(e,t,i,r,s){if(!(this instanceof Nt))return new Nt(e,t,i,r,s);i==null&&(i=0),Di.call(this,[new Ei([new Ar("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=i;var l=P(i,0);this.sel=Hn(l),this.history=new ka(null),this.id=++gm,this.modeOption=t,this.lineSep=r,this.direction=s=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),qs(this,{from:l,to:l,text:e}),_t(this,Hn(l),ct)};Nt.prototype=Zn(Di.prototype,{constructor:Nt,iter:function(e,t,i){i?this.iterN(e-this.first,t-e,i):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var i=0,r=0;r<t.length;++r)i+=t[r].height;this.insertInner(e-this.first,t,i)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=ci(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:bt(function(e){var t=P(this.first,0),i=this.first+this.size-1;Br(this,{from:t,to:P(i,fe(this,i).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&bi(this.cm,0,0),_t(this,Hn(t),ct)}),replaceRange:function(e,t,i,r){t=Se(this,t),i=i?Se(this,i):t,Hr(this,e,t,i,r)},getRange:function(e,t,i){var r=Sn(this,Se(this,e),Se(this,t));return i===!1?r:i===""?r.join(""):r.join(i||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(j(this,e))return fe(this,e)},getLineNumber:function(e){return b(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=fe(this,e)),fn(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return Se(this,e)},getCursor:function(e){var t=this.sel.primary(),i;return e==null||e=="head"?i=t.head:e=="anchor"?i=t.anchor:e=="end"||e=="to"||e===!1?i=t.to():i=t.from(),i},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:bt(function(e,t,i){sf(this,Se(this,typeof e=="number"?P(e,t||0):e),null,i)}),setSelection:bt(function(e,t,i){sf(this,Se(this,e),Se(this,t||e),i)}),extendSelection:bt(function(e,t,i){Ca(this,Se(this,e),t&&Se(this,t),i)}),extendSelections:bt(function(e,t){af(this,Yl(this,e),t)}),extendSelectionsBy:bt(function(e,t){var i=kt(this.sel.ranges,e);af(this,Yl(this,i),t)}),setSelections:bt(function(e,t,i){if(e.length){for(var r=[],s=0;s<e.length;s++)r[s]=new Be(Se(this,e[s].anchor),Se(this,e[s].head||e[s].anchor));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),_t(this,hn(this.cm,r,t),i)}}),addSelection:bt(function(e,t,i){var r=this.sel.ranges.slice(0);r.push(new Be(Se(this,e),Se(this,t||e))),_t(this,hn(this.cm,r,r.length-1),i)}),getSelection:function(e){for(var t=this.sel.ranges,i,r=0;r<t.length;r++){var s=Sn(this,t[r].from(),t[r].to());i=i?i.concat(s):s}return e===!1?i:i.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],i=this.sel.ranges,r=0;r<i.length;r++){var s=Sn(this,i[r].from(),i[r].to());e!==!1&&(s=s.join(e||this.lineSeparator())),t[r]=s}return t},replaceSelection:function(e,t,i){for(var r=[],s=0;s<this.sel.ranges.length;s++)r[s]=e;this.replaceSelections(r,t,i||"+input")},replaceSelections:bt(function(e,t,i){for(var r=[],s=this.sel,l=0;l<s.ranges.length;l++){var c=s.ranges[l];r[l]={from:c.from(),to:c.to(),text:this.splitLines(e[l]),origin:i}}for(var h=t&&t!="end"&&nm(this,r,t),g=r.length-1;g>=0;g--)Br(this,r[g]);h?of(this,h):this.cm&&Fr(this.cm)}),undo:bt(function(){La(this,"undo")}),redo:bt(function(){La(this,"redo")}),undoSelection:bt(function(){La(this,"undo",!0)}),redoSelection:bt(function(){La(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var s=0;s<e.undone.length;s++)e.undone[s].ranges||++i;return{undo:t,redo:i}},clearHistory:function(){var e=this;this.history=new ka(this.history),jn(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:zr(this.history.done),undone:zr(this.history.undone)}},setHistory:function(e){var t=this.history=new ka(this.history);t.done=zr(e.done.slice(0),null,!0),t.undone=zr(e.undone.slice(0),null,!0)},setGutterMarker:bt(function(e,t,i){return Li(this,e,"gutter",function(r){var s=r.gutterMarkers||(r.gutterMarkers={});return s[t]=i,!i&&pe(s)&&(r.gutterMarkers=null),!0})}),clearGutter:bt(function(e){var t=this;this.iter(function(i){i.gutterMarkers&&i.gutterMarkers[e]&&Li(t,i,"gutter",function(){return i.gutterMarkers[e]=null,pe(i.gutterMarkers)&&(i.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!j(this,e)||(t=e,e=fe(this,e),!e))return null}else if(t=b(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:bt(function(e,t,i){return Li(this,e,t=="gutter"?"gutter":"class",function(r){var s=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[s])r[s]=i;else{if(ie(i).test(r[s]))return!1;r[s]+=" "+i}return!0})}),removeLineClass:bt(function(e,t,i){return Li(this,e,t=="gutter"?"gutter":"class",function(r){var s=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",l=r[s];if(l)if(i==null)r[s]=null;else{var c=l.match(ie(i));if(!c)return!1;var h=c.index+c[0].length;r[s]=l.slice(0,c.index)+(!c.index||h==l.length?"":" ")+l.slice(h)||null}else return!1;return!0})}),addLineWidget:bt(function(e,t,i){return cm(this,e,t,i)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,i){return Wr(this,Se(this,e),Se(this,t),i,i&&i.type||"range")},setBookmark:function(e,t){var i={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=Se(this,e),Wr(this,e,e,i,"bookmark")},findMarksAt:function(e){e=Se(this,e);var t=[],i=fe(this,e.line).markedSpans;if(i)for(var r=0;r<i.length;++r){var s=i[r];(s.from==null||s.from<=e.ch)&&(s.to==null||s.to>=e.ch)&&t.push(s.marker.parent||s.marker)}return t},findMarks:function(e,t,i){e=Se(this,e),t=Se(this,t);var r=[],s=e.line;return this.iter(e.line,t.line+1,function(l){var c=l.markedSpans;if(c)for(var h=0;h<c.length;h++){var g=c[h];!(g.to!=null&&s==e.line&&e.ch>=g.to||g.from==null&&s!=e.line||g.from!=null&&s==t.line&&g.from>=t.ch)&&(!i||i(g.marker))&&r.push(g.marker.parent||g.marker)}++s}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var r=0;r<i.length;++r)i[r].from!=null&&e.push(i[r].marker)}),e},posFromIndex:function(e){var t,i=this.first,r=this.lineSeparator().length;return this.iter(function(s){var l=s.text.length+r;if(l>e)return t=e,!0;e-=l,++i}),Se(this,P(i,t))},indexFromPos:function(e){e=Se(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var i=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+i}),t},copy:function(e){var t=new Nt(ci(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,i=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<i&&(i=e.to);var r=new Nt(ci(this,t,i),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}],dm(r,wf(this)),r},unlinkDoc:function(e){if(e instanceof Ve&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var i=this.linked[t];if(i.doc==e){this.linked.splice(t,1),e.unlinkDoc(this),pm(wf(this));break}}if(e.history==this.history){var r=[e.id];jn(e,function(s){return r.push(s.id)},!0),e.history=new ka(null),e.history.done=zr(this.history.done,r),e.history.undone=zr(this.history.undone,r)}},iterLinkedDocs:function(e){jn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):en(e)},lineSeparator:function(){return this.lineSep||`
11
+ `},setDirection:bt(function(e){e!="rtl"&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&rm(this.cm))})}),Nt.prototype.eachLine=Nt.prototype.iter;var kf=0;function mm(e){var t=this;if(Sf(t),!(tt(t,e)||_n(t.display,e))){Tt(e),m&&(kf=+new Date);var i=ir(t,e,!0),r=e.dataTransfer.files;if(!(!i||t.isReadOnly()))if(r&&r.length&&window.FileReader&&window.File)for(var s=r.length,l=Array(s),c=0,h=function(){++c==s&&yt(t,function(){i=Se(t.doc,i);var I={from:i,to:i,text:t.doc.splitLines(l.filter(function(z){return z!=null}).join(t.doc.lineSeparator())),origin:"paste"};Br(t.doc,I),of(t.doc,Hn(Se(t.doc,i),Se(t.doc,Wn(I))))})()},g=function(I,z){if(t.options.allowDropFileTypes&&we(t.options.allowDropFileTypes,I.type)==-1){h();return}var q=new FileReader;q.onerror=function(){return h()},q.onload=function(){var V=q.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(V)){h();return}l[z]=V,h()},q.readAsText(I)},v=0;v<r.length;v++)g(r[v],v);else{if(t.state.draggingText&&t.doc.sel.contains(i)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var C=e.dataTransfer.getData("Text");if(C){var _;if(t.state.draggingText&&!t.state.draggingText.copy&&(_=t.listSelections()),Ta(t.doc,Hn(i,i)),_)for(var M=0;M<_.length;++M)Hr(t.doc,"",_[M].anchor,_[M].head,"drag");t.replaceSelection(C,"around","paste"),t.display.input.focus()}}catch{}}}}function vm(e,t){if(m&&(!e.state.draggingText||+new Date-kf<100)){Mn(t);return}if(!(tt(e,t)||_n(e.display,t))&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!U)){var i=k("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",B&&(i.width=i.height=1,e.display.wrapper.appendChild(i),i._top=i.offsetTop),t.dataTransfer.setDragImage(i,0,0),B&&i.parentNode.removeChild(i)}}function ym(e,t){var i=ir(e,t);if(i){var r=document.createDocumentFragment();Is(e,i,r),e.display.dragCursor||(e.display.dragCursor=k("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),Q(e.display.dragCursor,r)}}function Sf(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function Cf(e){if(document.getElementsByClassName){for(var t=document.getElementsByClassName("CodeMirror"),i=[],r=0;r<t.length;r++){var s=t[r].CodeMirror;s&&i.push(s)}i.length&&i[0].operation(function(){for(var l=0;l<i.length;l++)e(i[l])})}}var Tf=!1;function bm(){Tf||(xm(),Tf=!0)}function xm(){var e;me(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,Cf(wm)},100))}),me(window,"blur",function(){return Cf(Rr)})}function wm(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Un={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"},Oi=0;Oi<10;Oi++)Un[Oi+48]=Un[Oi+96]=String(Oi);for(var Ea=65;Ea<=90;Ea++)Un[Ea]=String.fromCharCode(Ea);for(var Ni=1;Ni<=12;Ni++)Un[Ni+111]=Un[Ni+63235]="F"+Ni;var En={};En.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"},En.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"},En.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"},En.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"]},En.default=ne?En.macDefault:En.pcDefault;function km(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var i,r,s,l,c=0;c<t.length-1;c++){var h=t[c];if(/^(cmd|meta|m)$/i.test(h))l=!0;else if(/^a(lt)?$/i.test(h))i=!0;else if(/^(c|ctrl|control)$/i.test(h))r=!0;else if(/^s(hift)?$/i.test(h))s=!0;else throw new Error("Unrecognized modifier name: "+h)}return i&&(e="Alt-"+e),r&&(e="Ctrl-"+e),l&&(e="Cmd-"+e),s&&(e="Shift-"+e),e}function Sm(e){var t={};for(var i in e)if(e.hasOwnProperty(i)){var r=e[i];if(/^(name|fallthrough|(de|at)tach)$/.test(i))continue;if(r=="..."){delete e[i];continue}for(var s=kt(i.split(" "),km),l=0;l<s.length;l++){var c=void 0,h=void 0;l==s.length-1?(h=s.join(" "),c=r):(h=s.slice(0,l+1).join(" "),c="...");var g=t[h];if(!g)t[h]=c;else if(g!=c)throw new Error("Inconsistent bindings for "+h)}delete e[i]}for(var v in t)e[v]=t[v];return e}function jr(e,t,i,r){t=Da(t);var s=t.call?t.call(e,r):t[e];if(s===!1)return"nothing";if(s==="...")return"multi";if(s!=null&&i(s))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return jr(e,t.fallthrough,i,r);for(var l=0;l<t.fallthrough.length;l++){var c=jr(e,t.fallthrough[l],i,r);if(c)return c}}}function _f(e){var t=typeof e=="string"?e:Un[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function Lf(e,t,i){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(Oe?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(Oe?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!i&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function Ef(e,t){if(B&&e.keyCode==34&&e.char)return!1;var i=Un[e.keyCode];return i==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(i=e.code),Lf(i,e,t))}function Da(e){return typeof e=="string"?En[e]:e}function qr(e,t){for(var i=e.doc.sel.ranges,r=[],s=0;s<i.length;s++){for(var l=t(i[s]);r.length&&re(l.from,be(r).to)<=0;){var c=r.pop();if(re(c.from,l.from)<0){l.from=c.from;break}}r.push(l)}Bt(e,function(){for(var h=r.length-1;h>=0;h--)Hr(e.doc,"",r[h].from,r[h].to,"+delete");Fr(e)})}function Xs(e,t,i){var r=zt(e.text,t+i,i);return r<0||r>e.text.length?null:r}function Ys(e,t,i){var r=Xs(e,t.ch,i);return r==null?null:new P(t.line,r,i<0?"after":"before")}function Vs(e,t,i,r,s){if(e){t.doc.direction=="rtl"&&(s=-s);var l=Pe(i,t.doc.direction);if(l){var c=s<0?be(l):l[0],h=s<0==(c.level==1),g=h?"after":"before",v;if(c.level>0||t.doc.direction=="rtl"){var C=Or(t,i);v=s<0?i.text.length-1:0;var _=bn(t,C,v).top;v=Qt(function(M){return bn(t,C,M).top==_},s<0==(c.level==1)?c.from:c.to-1,v),g=="before"&&(v=Xs(i,v,1))}else v=s<0?c.to:c.from;return new P(r,v,g)}}return new P(r,s<0?i.text.length:0,s<0?"before":"after")}function Cm(e,t,i,r){var s=Pe(t,e.doc.direction);if(!s)return Ys(t,i,r);i.ch>=t.text.length?(i.ch=t.text.length,i.sticky="before"):i.ch<=0&&(i.ch=0,i.sticky="after");var l=Nn(s,i.ch,i.sticky),c=s[l];if(e.doc.direction=="ltr"&&c.level%2==0&&(r>0?c.to>i.ch:c.from<i.ch))return Ys(t,i,r);var h=function(ee,ae){return Xs(t,ee instanceof P?ee.ch:ee,ae)},g,v=function(ee){return e.options.lineWrapping?(g=g||Or(e,t),Ou(e,t,g,ee)):{begin:0,end:t.text.length}},C=v(i.sticky=="before"?h(i,-1):i.ch);if(e.doc.direction=="rtl"||c.level==1){var _=c.level==1==r<0,M=h(i,_?1:-1);if(M!=null&&(_?M<=c.to&&M<=C.end:M>=c.from&&M>=C.begin)){var I=_?"before":"after";return new P(i.line,M,I)}}var z=function(ee,ae,te){for(var le=function(qe,xt){return xt?new P(i.line,h(qe,1),"before"):new P(i.line,qe,"after")};ee>=0&&ee<s.length;ee+=ae){var ve=s[ee],ge=ae>0==(ve.level!=1),Ae=ge?te.begin:h(te.end,-1);if(ve.from<=Ae&&Ae<ve.to||(Ae=ge?ve.from:h(ve.to,-1),te.begin<=Ae&&Ae<te.end))return le(Ae,ge)}},q=z(l+r,r,C);if(q)return q;var V=r>0?C.end:h(C.begin,-1);return V!=null&&!(r>0&&V==t.text.length)&&(q=z(r>0?0:s.length-1,r,v(V)),q)?q:null}var Mi={selectAll:hf,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ct)},killLine:function(e){return qr(e,function(t){if(t.empty()){var i=fe(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line<e.lastLine()?{from:t.head,to:P(t.head.line+1,0)}:{from:t.head,to:P(t.head.line,i)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return qr(e,function(t){return{from:P(t.from().line,0),to:Se(e.doc,P(t.to().line+1,0))}})},delLineLeft:function(e){return qr(e,function(t){return{from:P(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return qr(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return qr(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"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(P(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(P(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return Df(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return Af(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Tm(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div")},ht)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:i},"div")},ht)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return r.ch<e.getLine(r.line).search(/\S/)?Af(e,t.head):r},ht)},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=[],i=e.listSelections(),r=e.options.tabSize,s=0;s<i.length;s++){var l=i[s].from(),c=_e(e.getLine(l.line),l.ch,r);t.push(Ut(r-c%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Bt(e,function(){for(var t=e.listSelections(),i=[],r=0;r<t.length;r++)if(t[r].empty()){var s=t[r].head,l=fe(e.doc,s.line).text;if(l){if(s.ch==l.length&&(s=new P(s.line,s.ch-1)),s.ch>0)s=new P(s.line,s.ch+1),e.replaceRange(l.charAt(s.ch-1)+l.charAt(s.ch-2),P(s.line,s.ch-2),s,"+transpose");else if(s.line>e.doc.first){var c=fe(e.doc,s.line-1).text;c&&(s=new P(s.line,1),e.replaceRange(l.charAt(0)+e.doc.lineSeparator()+c.charAt(c.length-1),P(s.line-1,c.length-1),s,"+transpose"))}}i.push(new Be(s,s))}e.setSelections(i)})},newlineAndIndent:function(e){return Bt(e,function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);Fr(e)})},openLine:function(e){return e.replaceSelection(`
12
+ `,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function Df(e,t){var i=fe(e.doc,t),r=fn(i);return r!=i&&(t=b(r)),Vs(!0,e,r,t,1)}function Tm(e,t){var i=fe(e.doc,t),r=lg(i);return r!=i&&(t=b(r)),Vs(!0,e,i,t,-1)}function Af(e,t){var i=Df(e,t.line),r=fe(e.doc,i.line),s=Pe(r,e.doc.direction);if(!s||s[0].level==0){var l=Math.max(i.ch,r.text.search(/\S/)),c=t.line==i.line&&t.ch<=l&&t.ch;return P(i.line,c?0:l,i.sticky)}return i}function Aa(e,t,i){if(typeof t=="string"&&(t=Mi[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,s=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),i&&(e.display.shift=!1),s=t(e)!=Ke}finally{e.display.shift=r,e.state.suppressEdits=!1}return s}function _m(e,t,i){for(var r=0;r<e.state.keyMaps.length;r++){var s=jr(t,e.state.keyMaps[r],i,e);if(s)return s}return e.options.extraKeys&&jr(t,e.options.extraKeys,i,e)||jr(t,e.options.keyMap,i,e)}var Lm=new ft;function Ri(e,t,i,r){var s=e.state.keySeq;if(s){if(_f(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Lm.set(50,function(){e.state.keySeq==s&&(e.state.keySeq=null,e.display.input.reset())}),If(e,s+" "+t,i,r))return!0}return If(e,t,i,r)}function If(e,t,i,r){var s=_m(e,t,r);return s=="multi"&&(e.state.keySeq=t),s=="handled"&&vt(e,"keyHandled",e,t,i),(s=="handled"||s=="multi")&&(Tt(i),Os(e)),!!s}function Of(e,t){var i=Ef(t,!0);return i?t.shiftKey&&!e.state.keySeq?Ri(e,"Shift-"+i,t,function(r){return Aa(e,r,!0)})||Ri(e,i,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return Aa(e,r)}):Ri(e,i,t,function(r){return Aa(e,r)}):!1}function Em(e,t,i){return Ri(e,"'"+i+"'",t,function(r){return Aa(e,r,!0)})}var Js=null;function Nf(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField())&&(t.curOp.focus=R(oe(t)),!tt(t,e))){m&&x<11&&e.keyCode==27&&(e.returnValue=!1);var i=e.keyCode;t.display.shift=i==16||e.shiftKey;var r=Of(t,e);B&&(Js=r?i:null,!r&&i==88&&!ia&&(ne?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),f&&!ne&&!r&&i==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),i==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Dm(t)}}function Dm(e){var t=e.display.lineDiv;K(t,"CodeMirror-crosshair");function i(r){(r.keyCode==18||!r.altKey)&&(ze(t,"CodeMirror-crosshair"),Ct(document,"keyup",i),Ct(document,"mouseover",i))}me(document,"keyup",i),me(document,"mouseover",i)}function Mf(e){e.keyCode==16&&(this.doc.sel.shift=!1),tt(this,e)}function Rf(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField())&&!(_n(t.display,e)||tt(t,e)||e.ctrlKey&&!e.altKey||ne&&e.metaKey)){var i=e.keyCode,r=e.charCode;if(B&&i==Js){Js=null,Tt(e);return}if(!(B&&(!e.which||e.which<10)&&Of(t,e))){var s=String.fromCharCode(r??i);s!="\b"&&(Em(t,e,s)||t.display.input.onKeyPress(e))}}}var Am=400,Qs=function(e,t,i){this.time=e,this.pos=t,this.button=i};Qs.prototype.compare=function(e,t,i){return this.time+Am>e&&re(t,this.pos)==0&&i==this.button};var Fi,Pi;function Im(e,t){var i=+new Date;return Pi&&Pi.compare(i,e,t)?(Fi=Pi=null,"triple"):Fi&&Fi.compare(i,e,t)?(Pi=new Qs(i,e,t),Fi=null,"double"):(Fi=new Qs(i,e,t),Pi=null,"single")}function Ff(e){var t=this,i=t.display;if(!(tt(t,e)||i.activeTouch&&i.input.supportsTouch())){if(i.input.ensurePolled(),i.shift=e.shiftKey,_n(i,e)){S||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(!Zs(t,e)){var r=ir(t,e),s=sn(e),l=r?Im(r,s):"single";Z(t).focus(),s==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&Om(t,s,r,l,e))&&(s==1?r?Mm(t,r,l,e):li(e)==i.scroller&&Tt(e):s==2?(r&&Ca(t.doc,r),setTimeout(function(){return i.input.focus()},20)):s==3&&(Re?t.display.input.onContextMenu(e):Ns(t)))}}}function Om(e,t,i,r,s){var l="Click";return r=="double"?l="Double"+l:r=="triple"&&(l="Triple"+l),l=(t==1?"Left":t==2?"Middle":"Right")+l,Ri(e,Lf(l,s),s,function(c){if(typeof c=="string"&&(c=Mi[c]),!c)return!1;var h=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),h=c(e,i)!=Ke}finally{e.state.suppressEdits=!1}return h})}function Nm(e,t,i){var r=e.getOption("configureMouse"),s=r?r(e,t,i):{};if(s.unit==null){var l=ue?i.shiftKey&&i.metaKey:i.altKey;s.unit=l?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(s.extend==null||e.doc.extend)&&(s.extend=e.doc.extend||i.shiftKey),s.addNew==null&&(s.addNew=ne?i.metaKey:i.ctrlKey),s.moveOnDrag==null&&(s.moveOnDrag=!(ne?i.altKey:i.ctrlKey)),s}function Mm(e,t,i,r){m?setTimeout(ce(Fu,e),0):e.curOp.focus=R(oe(e));var s=Nm(e,i,r),l=e.doc.sel,c;e.options.dragDrop&&cs&&!e.isReadOnly()&&i=="single"&&(c=l.contains(t))>-1&&(re((c=l.ranges[c]).from(),t)<0||t.xRel>0)&&(re(c.to(),t)>0||t.xRel<0)?Rm(e,r,t,s):Fm(e,r,t,s)}function Rm(e,t,i,r){var s=e.display,l=!1,c=yt(e,function(v){S&&(s.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:Ns(e)),Ct(s.wrapper.ownerDocument,"mouseup",c),Ct(s.wrapper.ownerDocument,"mousemove",h),Ct(s.scroller,"dragstart",g),Ct(s.scroller,"drop",c),l||(Tt(v),r.addNew||Ca(e.doc,i,null,null,r.extend),S&&!U||m&&x==9?setTimeout(function(){s.wrapper.ownerDocument.body.focus({preventScroll:!0}),s.input.focus()},20):s.input.focus())}),h=function(v){l=l||Math.abs(t.clientX-v.clientX)+Math.abs(t.clientY-v.clientY)>=10},g=function(){return l=!0};S&&(s.scroller.draggable=!0),e.state.draggingText=c,c.copy=!r.moveOnDrag,me(s.wrapper.ownerDocument,"mouseup",c),me(s.wrapper.ownerDocument,"mousemove",h),me(s.scroller,"dragstart",g),me(s.scroller,"drop",c),e.state.delayingBlurEvent=!0,setTimeout(function(){return s.input.focus()},20),s.scroller.dragDrop&&s.scroller.dragDrop()}function Pf(e,t,i){if(i=="char")return new Be(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new Be(P(t.line,0),Se(e.doc,P(t.line+1,0)));var r=i(e,t);return new Be(r.from,r.to)}function Fm(e,t,i,r){m&&Ns(e);var s=e.display,l=e.doc;Tt(t);var c,h,g=l.sel,v=g.ranges;if(r.addNew&&!r.extend?(h=l.sel.contains(i),h>-1?c=v[h]:c=new Be(i,i)):(c=l.sel.primary(),h=l.sel.primIndex),r.unit=="rectangle")r.addNew||(c=new Be(i,i)),i=ir(e,t,!0,!0),h=-1;else{var C=Pf(e,i,r.unit);r.extend?c=Gs(c,C.anchor,C.head,r.extend):c=C}r.addNew?h==-1?(h=v.length,_t(l,hn(e,v.concat([c]),h),{scroll:!1,origin:"*mouse"})):v.length>1&&v[h].empty()&&r.unit=="char"&&!r.extend?(_t(l,hn(e,v.slice(0,h).concat(v.slice(h+1)),0),{scroll:!1,origin:"*mouse"}),g=l.sel):Ks(l,h,c,Pt):(h=0,_t(l,new Xt([c],0),Pt),g=l.sel);var _=i;function M(te){if(re(_,te)!=0)if(_=te,r.unit=="rectangle"){for(var le=[],ve=e.options.tabSize,ge=_e(fe(l,i.line).text,i.ch,ve),Ae=_e(fe(l,te.line).text,te.ch,ve),qe=Math.min(ge,Ae),xt=Math.max(ge,Ae),Qe=Math.min(i.line,te.line),Ht=Math.min(e.lastLine(),Math.max(i.line,te.line));Qe<=Ht;Qe++){var Mt=fe(l,Qe).text,lt=dt(Mt,qe,ve);qe==xt?le.push(new Be(P(Qe,lt),P(Qe,lt))):Mt.length>lt&&le.push(new Be(P(Qe,lt),P(Qe,dt(Mt,xt,ve))))}le.length||le.push(new Be(i,i)),_t(l,hn(e,g.ranges.slice(0,h).concat(le),h),{origin:"*mouse",scroll:!1}),e.scrollIntoView(te)}else{var Rt=c,St=Pf(e,te,r.unit),pt=Rt.anchor,ut;re(St.anchor,pt)>0?(ut=St.head,pt=Dr(Rt.from(),St.anchor)):(ut=St.anchor,pt=It(Rt.to(),St.head));var rt=g.ranges.slice(0);rt[h]=Pm(e,new Be(Se(l,pt),ut)),_t(l,hn(e,rt,h),Pt)}}var I=s.wrapper.getBoundingClientRect(),z=0;function q(te){var le=++z,ve=ir(e,te,!0,r.unit=="rectangle");if(ve)if(re(ve,_)!=0){e.curOp.focus=R(oe(e)),M(ve);var ge=ya(s,l);(ve.line>=ge.to||ve.line<ge.from)&&setTimeout(yt(e,function(){z==le&&q(te)}),150)}else{var Ae=te.clientY<I.top?-20:te.clientY>I.bottom?20:0;Ae&&setTimeout(yt(e,function(){z==le&&(s.scroller.scrollTop+=Ae,q(te))}),50)}}function V(te){e.state.selectingText=!1,z=1/0,te&&(Tt(te),s.input.focus()),Ct(s.wrapper.ownerDocument,"mousemove",ee),Ct(s.wrapper.ownerDocument,"mouseup",ae),l.history.lastSelOrigin=null}var ee=yt(e,function(te){te.buttons===0||!sn(te)?V(te):q(te)}),ae=yt(e,V);e.state.selectingText=ae,me(s.wrapper.ownerDocument,"mousemove",ee),me(s.wrapper.ownerDocument,"mouseup",ae)}function Pm(e,t){var i=t.anchor,r=t.head,s=fe(e.doc,i.line);if(re(i,r)==0&&i.sticky==r.sticky)return t;var l=Pe(s);if(!l)return t;var c=Nn(l,i.ch,i.sticky),h=l[c];if(h.from!=i.ch&&h.to!=i.ch)return t;var g=c+(h.from==i.ch==(h.level!=1)?0:1);if(g==0||g==l.length)return t;var v;if(r.line!=i.line)v=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var C=Nn(l,r.ch,r.sticky),_=C-c||(r.ch-i.ch)*(h.level==1?-1:1);C==g-1||C==g?v=_<0:v=_>0}var M=l[g+(v?-1:0)],I=v==(M.level==1),z=I?M.from:M.to,q=I?"after":"before";return i.ch==z&&i.sticky==q?t:new Be(new P(i.line,z,q),r)}function zf(e,t,i,r){var s,l;if(t.touches)s=t.touches[0].clientX,l=t.touches[0].clientY;else try{s=t.clientX,l=t.clientY}catch{return!1}if(s>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Tt(t);var c=e.display,h=c.lineDiv.getBoundingClientRect();if(l>h.bottom||!$t(e,i))return At(t);l-=h.top-c.viewOffset;for(var g=0;g<e.display.gutterSpecs.length;++g){var v=c.gutters.childNodes[g];if(v&&v.getBoundingClientRect().right>=s){var C=T(e.doc,l),_=e.display.gutterSpecs[g];return et(e,i,e,C,_.className,t),At(t)}}}function Zs(e,t){return zf(e,t,"gutterClick",!0)}function $f(e,t){_n(e.display,t)||zm(e,t)||tt(e,t,"contextmenu")||Re||e.display.input.onContextMenu(t)}function zm(e,t){return $t(e,"gutterContextMenu")?zf(e,t,"gutterContextMenu",!1):!1}function Bf(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),vi(e)}var Ur={toString:function(){return"CodeMirror.Init"}},Hf={},Ia={};function $m(e){var t=e.optionHandlers;function i(r,s,l,c){e.defaults[r]=s,l&&(t[r]=c?function(h,g,v){v!=Ur&&l(h,g,v)}:l)}e.defineOption=i,e.Init=Ur,i("value","",function(r,s){return r.setValue(s)},!0),i("mode",null,function(r,s){r.doc.modeOption=s,js(r)},!0),i("indentUnit",2,js,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){Ti(r),vi(r),Ot(r)},!0),i("lineSeparator",null,function(r,s){if(r.doc.lineSep=s,!!s){var l=[],c=r.doc.first;r.doc.iter(function(g){for(var v=0;;){var C=g.text.indexOf(s,v);if(C==-1)break;v=C+s.length,l.push(P(c,C))}c++});for(var h=l.length-1;h>=0;h--)Hr(r.doc,s,l[h],P(l[h].line,l[h].ch+s.length))}}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(r,s,l){r.state.specialChars=new RegExp(s.source+(s.test(" ")?"":"| "),"g"),l!=Ur&&r.refresh()}),i("specialCharPlaceholder",pg,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",X?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(r,s){return r.getInputField().spellcheck=s},!0),i("autocorrect",!1,function(r,s){return r.getInputField().autocorrect=s},!0),i("autocapitalize",!1,function(r,s){return r.getInputField().autocapitalize=s},!0),i("rtlMoveVisually",!se),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Bf(r),Ci(r)},!0),i("keyMap","default",function(r,s,l){var c=Da(s),h=l!=Ur&&Da(l);h&&h.detach&&h.detach(r,c),c.attach&&c.attach(r,h||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Hm,!0),i("gutters",[],function(r,s){r.display.gutterSpecs=Hs(s,r.options.lineNumbers),Ci(r)},!0),i("fixedGutter",!0,function(r,s){r.display.gutters.style.left=s?Ds(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return Pr(r)},!0),i("scrollbarStyle","native",function(r){Wu(r),Pr(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),i("lineNumbers",!1,function(r,s){r.display.gutterSpecs=Hs(r.options.gutters,s),Ci(r)},!0),i("firstLineNumber",1,Ci,!0),i("lineNumberFormatter",function(r){return r},Ci,!0),i("showCursorWhenSelecting",!1,yi,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,s){s=="nocursor"&&(Rr(r),r.display.input.blur()),r.display.input.readOnlyChanged(s)}),i("screenReaderLabel",null,function(r,s){s=s===""?null:s,r.display.input.screenReaderLabelChanged(s)}),i("disableInput",!1,function(r,s){s||r.display.input.reset()},!0),i("dragDrop",!0,Bm),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,yi,!0),i("singleCursorHeightPerLine",!0,yi,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,Ti,!0),i("addModeClass",!1,Ti,!0),i("pollInterval",100),i("undoDepth",200,function(r,s){return r.doc.history.undoDepth=s}),i("historyEventDelay",1250),i("viewportMargin",10,function(r){return r.refresh()},!0),i("maxHighlightLength",1e4,Ti,!0),i("moveInputWithCursor",!0,function(r,s){s||r.display.input.resetPosition()}),i("tabindex",null,function(r,s){return r.display.input.getField().tabIndex=s||""}),i("autofocus",null),i("direction","ltr",function(r,s){return r.doc.setDirection(s)},!0),i("phrases",null)}function Bm(e,t,i){var r=i&&i!=Ur;if(!t!=!r){var s=e.display.dragFunctions,l=t?me:Ct;l(e.display.scroller,"dragstart",s.start),l(e.display.scroller,"dragenter",s.enter),l(e.display.scroller,"dragover",s.over),l(e.display.scroller,"dragleave",s.leave),l(e.display.scroller,"drop",s.drop)}}function Hm(e){e.options.lineWrapping?(K(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(ze(e.display.wrapper,"CodeMirror-wrap"),bs(e)),As(e),Ot(e),vi(e),setTimeout(function(){return Pr(e)},100)}function Ve(e,t){var i=this;if(!(this instanceof Ve))return new Ve(e,t);this.options=t=t?ke(t):{},ke(Hf,t,!1);var r=t.value;typeof r=="string"?r=new Nt(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var s=new Ve.inputStyles[t.inputStyle](this),l=this.display=new em(e,r,s,t);l.wrapper.CodeMirror=this,Bf(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Wu(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 ft,keySeq:null,specialChars:null},t.autofocus&&!X&&l.input.focus(),m&&x<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Wm(this),bm(),lr(this),this.curOp.forceUpdate=!0,Qu(this,r),t.autofocus&&!X||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&Ms(i)},20):Rr(this);for(var c in Ia)Ia.hasOwnProperty(c)&&Ia[c](this,t[c],Ur);Uu(this),t.finishInit&&t.finishInit(this);for(var h=0;h<eo.length;++h)eo[h](this);ur(this),S&&t.lineWrapping&&getComputedStyle(l.lineDiv).textRendering=="optimizelegibility"&&(l.lineDiv.style.textRendering="auto")}Ve.defaults=Hf,Ve.optionHandlers=Ia;function Wm(e){var t=e.display;me(t.scroller,"mousedown",yt(e,Ff)),m&&x<11?me(t.scroller,"dblclick",yt(e,function(g){if(!tt(e,g)){var v=ir(e,g);if(!(!v||Zs(e,g)||_n(e.display,g))){Tt(g);var C=e.findWordAt(v);Ca(e.doc,C.anchor,C.head)}}})):me(t.scroller,"dblclick",function(g){return tt(e,g)||Tt(g)}),me(t.scroller,"contextmenu",function(g){return $f(e,g)}),me(t.input.getField(),"contextmenu",function(g){t.scroller.contains(g.target)||$f(e,g)});var i,r={end:0};function s(){t.activeTouch&&(i=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function l(g){if(g.touches.length!=1)return!1;var v=g.touches[0];return v.radiusX<=1&&v.radiusY<=1}function c(g,v){if(v.left==null)return!0;var C=v.left-g.left,_=v.top-g.top;return C*C+_*_>20*20}me(t.scroller,"touchstart",function(g){if(!tt(e,g)&&!l(g)&&!Zs(e,g)){t.input.ensurePolled(),clearTimeout(i);var v=+new Date;t.activeTouch={start:v,moved:!1,prev:v-r.end<=300?r:null},g.touches.length==1&&(t.activeTouch.left=g.touches[0].pageX,t.activeTouch.top=g.touches[0].pageY)}}),me(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),me(t.scroller,"touchend",function(g){var v=t.activeTouch;if(v&&!_n(t,g)&&v.left!=null&&!v.moved&&new Date-v.start<300){var C=e.coordsChar(t.activeTouch,"page"),_;!v.prev||c(v,v.prev)?_=new Be(C,C):!v.prev.prev||c(v,v.prev.prev)?_=e.findWordAt(C):_=new Be(P(C.line,0),Se(e.doc,P(C.line+1,0))),e.setSelection(_.anchor,_.head),e.focus(),Tt(g)}s()}),me(t.scroller,"touchcancel",s),me(t.scroller,"scroll",function(){t.scroller.clientHeight&&(xi(e,t.scroller.scrollTop),sr(e,t.scroller.scrollLeft,!0),et(e,"scroll",e))}),me(t.scroller,"mousewheel",function(g){return Xu(e,g)}),me(t.scroller,"DOMMouseScroll",function(g){return Xu(e,g)}),me(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(g){tt(e,g)||Mn(g)},over:function(g){tt(e,g)||(ym(e,g),Mn(g))},start:function(g){return vm(e,g)},drop:yt(e,mm),leave:function(g){tt(e,g)||Sf(e)}};var h=t.input.getField();me(h,"keyup",function(g){return Mf.call(e,g)}),me(h,"keydown",yt(e,Nf)),me(h,"keypress",yt(e,Rf)),me(h,"focus",function(g){return Ms(e,g)}),me(h,"blur",function(g){return Rr(e,g)})}var eo=[];Ve.defineInitHook=function(e){return eo.push(e)};function zi(e,t,i,r){var s=e.doc,l;i==null&&(i="add"),i=="smart"&&(s.mode.indent?l=hi(e,t).state:i="prev");var c=e.options.tabSize,h=fe(s,t),g=_e(h.text,null,c);h.stateAfter&&(h.stateAfter=null);var v=h.text.match(/^\s*/)[0],C;if(!r&&!/\S/.test(h.text))C=0,i="not";else if(i=="smart"&&(C=s.mode.indent(l,h.text.slice(v.length),h.text),C==Ke||C>150)){if(!r)return;i="prev"}i=="prev"?t>s.first?C=_e(fe(s,t-1).text,null,c):C=0:i=="add"?C=g+e.options.indentUnit:i=="subtract"?C=g-e.options.indentUnit:typeof i=="number"&&(C=g+i),C=Math.max(0,C);var _="",M=0;if(e.options.indentWithTabs)for(var I=Math.floor(C/c);I;--I)M+=c,_+=" ";if(M<C&&(_+=Ut(C-M)),_!=v)return Hr(s,_,P(t,0),P(t,v.length),"+input"),h.stateAfter=null,!0;for(var z=0;z<s.sel.ranges.length;z++){var q=s.sel.ranges[z];if(q.head.line==t&&q.head.ch<v.length){var V=P(t,v.length);Ks(s,z,new Be(V,V));break}}}var dn=null;function Oa(e){dn=e}function to(e,t,i,r,s){var l=e.doc;e.display.shift=!1,r||(r=l.sel);var c=+new Date-200,h=s=="paste"||e.state.pasteIncoming>c,g=en(t),v=null;if(h&&r.ranges.length>1)if(dn&&dn.text.join(`
13
+ `)==t){if(r.ranges.length%dn.text.length==0){v=[];for(var C=0;C<dn.text.length;C++)v.push(l.splitLines(dn.text[C]))}}else g.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(v=kt(g,function(ee){return[ee]}));for(var _=e.curOp.updateInput,M=r.ranges.length-1;M>=0;M--){var I=r.ranges[M],z=I.from(),q=I.to();I.empty()&&(i&&i>0?z=P(z.line,z.ch-i):e.state.overwrite&&!h?q=P(q.line,Math.min(fe(l,q.line).text.length,q.ch+be(g).length)):h&&dn&&dn.lineWise&&dn.text.join(`
14
14
  `)==g.join(`
15
- `)&&(z=U=P(z.line,0)));var V={from:z,to:U,text:v?v[M%v.length]:g,origin:s||(h?"paste":e.state.cutIncoming>c?"cut":"+input")};Br(e.doc,V),vt(e,"inputRead",e,V)}t&&!h&&$f(e,t),Fr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=_),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function zf(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&Bt(t,function(){return to(t,i,0,null,"paste")}),!0}function $f(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var i=e.doc.sel,r=i.ranges.length-1;r>=0;r--){var s=i.ranges[r];if(!(s.head.ch>100||r&&i.ranges[r-1].head.line==s.head.line)){var l=e.getModeAt(s.head),c=!1;if(l.electricChars){for(var h=0;h<l.electricChars.length;h++)if(t.indexOf(l.electricChars.charAt(h))>-1){c=zi(e,s.head.line,"smart");break}}else l.electricInput&&l.electricInput.test(fe(e.doc,s.head.line).text.slice(0,s.head.ch))&&(c=zi(e,s.head.line,"smart"));c&&vt(e,"electricInput",e,s.head.line)}}}function Bf(e){for(var t=[],i=[],r=0;r<e.doc.sel.ranges.length;r++){var s=e.doc.sel.ranges[r].head.line,l={anchor:P(s,0),head:P(s+1,0)};i.push(l),t.push(e.getRange(l.anchor,l.head))}return{text:t,ranges:i}}function no(e,t,i,r){e.setAttribute("autocorrect",i?"on":"off"),e.setAttribute("autocapitalize",r?"on":"off"),e.setAttribute("spellcheck",!!t)}function Hf(){var e=k("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none"),t=k("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return S?e.style.width="1000px":e.setAttribute("wrap","off"),O&&(e.style.border="1px solid black"),t}function Hm(e){var t=e.optionHandlers,i=e.helpers={};e.prototype={constructor:e,focus:function(){Z(this).focus(),this.display.input.focus()},setOption:function(r,s){var l=this.options,c=l[r];l[r]==s&&r!="mode"||(l[r]=s,t.hasOwnProperty(r)&&yt(this,t[r])(this,s,c),et(this,"optionChange",this,r))},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,s){this.state.keyMaps[s?"push":"unshift"](Da(r))},removeKeyMap:function(r){for(var s=this.state.keyMaps,l=0;l<s.length;++l)if(s[l]==r||s[l].name==r)return s.splice(l,1),!0},addOverlay:Et(function(r,s){var l=r.token?r:e.getMode(this.options,r);if(l.startState)throw new Error("Overlays may not be stateful.");Gt(this.state.overlays,{mode:l,modeSpec:r,opaque:s&&s.opaque,priority:s&&s.priority||0},function(c){return c.priority}),this.state.modeGen++,Ot(this)}),removeOverlay:Et(function(r){for(var s=this.state.overlays,l=0;l<s.length;++l){var c=s[l].modeSpec;if(c==r||typeof r=="string"&&c.name==r){s.splice(l,1),this.state.modeGen++,Ot(this);return}}}),indentLine:Et(function(r,s,l){typeof s!="string"&&typeof s!="number"&&(s==null?s=this.options.smartIndent?"smart":"prev":s=s?"add":"subtract"),j(this.doc,r)&&zi(this,r,s,l)}),indentSelection:Et(function(r){for(var s=this.doc.sel.ranges,l=-1,c=0;c<s.length;c++){var h=s[c];if(h.empty())h.head.line>l&&(zi(this,h.head.line,r,!0),l=h.head.line,c==this.doc.sel.primIndex&&Fr(this));else{var g=h.from(),v=h.to(),C=Math.max(l,g.line);l=Math.min(this.lastLine(),v.line-(v.ch?0:1))+1;for(var _=C;_<l;++_)zi(this,_,r);var M=this.doc.sel.ranges;g.ch==0&&s.length==M.length&&M[c].from().ch>0&&Ks(this.doc,c,new Be(g,M[c].to()),ct)}}}),getTokenAt:function(r,s){return Vl(this,r,s)},getLineTokens:function(r,s){return Vl(this,P(r),s,!0)},getTokenTypeAt:function(r){r=Se(this.doc,r);var s=Kl(this,fe(this.doc,r.line)),l=0,c=(s.length-1)/2,h=r.ch,g;if(h==0)g=s[2];else for(;;){var v=l+c>>1;if((v?s[v*2-1]:0)>=h)c=v;else if(s[v*2+1]<h)l=v+1;else{g=s[v*2+2];break}}var C=g?g.indexOf("overlay "):-1;return C<0?g:C==0?null:g.slice(0,C-1)},getModeAt:function(r){var s=this.doc.mode;return s.innerMode?e.innerMode(s,this.getTokenAt(r).state).mode:s},getHelper:function(r,s){return this.getHelpers(r,s)[0]},getHelpers:function(r,s){var l=[];if(!i.hasOwnProperty(s))return l;var c=i[s],h=this.getModeAt(r);if(typeof h[s]=="string")c[h[s]]&&l.push(c[h[s]]);else if(h[s])for(var g=0;g<h[s].length;g++){var v=c[h[s][g]];v&&l.push(v)}else h.helperType&&c[h.helperType]?l.push(c[h.helperType]):c[h.name]&&l.push(c[h.name]);for(var C=0;C<c._global.length;C++){var _=c._global[C];_.pred(h,this)&&we(l,_.val)==-1&&l.push(_.val)}return l},getStateAfter:function(r,s){var l=this.doc;return r=Ul(l,r??l.first+l.size-1),hi(this,r+1,s).state},cursorCoords:function(r,s){var l,c=this.doc.sel.primary();return r==null?l=c.head:typeof r=="object"?l=Se(this.doc,r):l=r?c.from():c.to(),fn(this,l,s||"page")},charCoords:function(r,s){return pa(this,Se(this.doc,r),s||"page")},coordsChar:function(r,s){return r=Tu(this,r,s||"page"),_s(this,r.left,r.top)},lineAtHeight:function(r,s){return r=Tu(this,{top:r,left:0},s||"page").top,T(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,s,l){var c=!1,h;if(typeof r=="number"){var g=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>g&&(r=g,c=!0),h=fe(this.doc,r)}else h=r;return da(this,h,{top:0,left:0},s||"page",l||c).top+(c?this.doc.height-Tn(h):0)},defaultTextHeight:function(){return Nr(this.display)},defaultCharWidth:function(){return Mr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,s,l,c,h){var g=this.display;r=fn(this,Se(this.doc,r));var v=r.bottom,C=r.left;if(s.style.position="absolute",s.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(s),g.sizer.appendChild(s),c=="over")v=r.top;else if(c=="above"||c=="near"){var _=Math.max(g.wrapper.clientHeight,this.doc.height),M=Math.max(g.sizer.clientWidth,g.lineSpace.clientWidth);(c=="above"||r.bottom+s.offsetHeight>_)&&r.top>s.offsetHeight?v=r.top-s.offsetHeight:r.bottom+s.offsetHeight<=_&&(v=r.bottom),C+s.offsetWidth>M&&(C=M-s.offsetWidth)}s.style.top=v+"px",s.style.left=s.style.right="",h=="right"?(C=g.sizer.clientWidth-s.offsetWidth,s.style.right="0px"):(h=="left"?C=0:h=="middle"&&(C=(g.sizer.clientWidth-s.offsetWidth)/2),s.style.left=C+"px"),l&&zg(this,{left:C,top:v,right:C+s.offsetWidth,bottom:v+s.offsetHeight})},triggerOnKeyDown:Et(Df),triggerOnKeyPress:Et(If),triggerOnKeyUp:Af,triggerOnMouseDown:Et(Of),execCommand:function(r){if(Mi.hasOwnProperty(r))return Mi[r].call(null,this)},triggerElectric:Et(function(r){$f(this,r)}),findPosH:function(r,s,l,c){var h=1;s<0&&(h=-1,s=-s);for(var g=Se(this.doc,r),v=0;v<s&&(g=ro(this.doc,g,h,l,c),!g.hitSide);++v);return g},moveH:Et(function(r,s){var l=this;this.extendSelectionsBy(function(c){return l.display.shift||l.doc.extend||c.empty()?ro(l.doc,c.head,r,s,l.options.rtlMoveVisually):r<0?c.from():c.to()},ht)}),deleteH:Et(function(r,s){var l=this.doc.sel,c=this.doc;l.somethingSelected()?c.replaceSelection("",null,"+delete"):Ur(this,function(h){var g=ro(c,h.head,r,s,!1);return r<0?{from:g,to:h.head}:{from:h.head,to:g}})}),findPosV:function(r,s,l,c){var h=1,g=c;s<0&&(h=-1,s=-s);for(var v=Se(this.doc,r),C=0;C<s;++C){var _=fn(this,v,"div");if(g==null?g=_.left:_.left=g,v=Wf(this,_,h,l),v.hitSide)break}return v},moveV:Et(function(r,s){var l=this,c=this.doc,h=[],g=!this.display.shift&&!c.extend&&c.sel.somethingSelected();if(c.extendSelectionsBy(function(C){if(g)return r<0?C.from():C.to();var _=fn(l,C.head,"div");C.goalColumn!=null&&(_.left=C.goalColumn),h.push(_.left);var M=Wf(l,_,r,s);return s=="page"&&C==c.sel.primary()&&Fs(l,pa(l,M,"div").top-_.top),M},ht),h.length)for(var v=0;v<c.sel.ranges.length;v++)c.sel.ranges[v].goalColumn=h[v]}),findWordAt:function(r){var s=this.doc,l=fe(s,r.line).text,c=r.ch,h=r.ch;if(l){var g=this.getHelper(r,"wordChars");(r.sticky=="before"||h==l.length)&&c?--c:++h;for(var v=l.charAt(c),C=xe(v,g)?function(_){return xe(_,g)}:/\s/.test(v)?function(_){return/\s/.test(_)}:function(_){return!/\s/.test(_)&&!xe(_)};c>0&&C(l.charAt(c-1));)--c;for(;h<l.length&&C(l.charAt(h));)++h}return new Be(P(r.line,c),P(r.line,h))},toggleOverwrite:function(r){r!=null&&r==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?K(this.display.cursorDiv,"CodeMirror-overwrite"):ze(this.display.cursorDiv,"CodeMirror-overwrite"),et(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==R(oe(this))},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Et(function(r,s){bi(this,r,s)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-vn(this)-this.display.barHeight,width:r.scrollWidth-vn(this)-this.display.barWidth,clientHeight:ks(this),clientWidth:nr(this)}},scrollIntoView:Et(function(r,s){r==null?(r={from:this.doc.sel.primary().head,to:null},s==null&&(s=this.options.cursorScrollMargin)):typeof r=="number"?r={from:P(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=s||0,r.from.line!=null?$g(this,r):Mu(this,r.from,r.to,r.margin)}),setSize:Et(function(r,s){var l=this,c=function(g){return typeof g=="number"||/^\d+$/.test(String(g))?g+"px":g};r!=null&&(this.display.wrapper.style.width=c(r)),s!=null&&(this.display.wrapper.style.height=c(s)),this.options.lineWrapping&&ku(this);var h=this.display.viewFrom;this.doc.iter(h,this.display.viewTo,function(g){if(g.widgets){for(var v=0;v<g.widgets.length;v++)if(g.widgets[v].noHScroll){$n(l,h,"widget");break}}++h}),this.curOp.forceUpdate=!0,et(this,"refresh",this)}),operation:function(r){return Bt(this,r)},startOperation:function(){return lr(this)},endOperation:function(){return ur(this)},refresh:Et(function(){var r=this.display.cachedTextHeight;Ot(this),this.curOp.forceUpdate=!0,vi(this),bi(this,this.doc.scrollLeft,this.doc.scrollTop),$s(this.display),(r==null||Math.abs(r-Nr(this.display))>.5||this.options.lineWrapping)&&As(this),et(this,"refresh",this)}),swapDoc:Et(function(r){var s=this.doc;return s.cm=null,this.state.selectingText&&this.state.selectingText(),Xu(this,r),vi(this),this.display.input.reset(),bi(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,vt(this,"swapDoc",this,s),s}),phrase:function(r){var s=this.options.phrases;return s&&Object.prototype.hasOwnProperty.call(s,r)?s[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}},rn(e),e.registerHelper=function(r,s,l){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][s]=l},e.registerGlobalHelper=function(r,s,l,c){e.registerHelper(r,s,c),i[r]._global.push({pred:l,val:c})}}function ro(e,t,i,r,s){var l=t,c=i,h=fe(e,t.line),g=s&&e.direction=="rtl"?-i:i;function v(){var ae=t.line+g;return ae<e.first||ae>=e.first+e.size?!1:(t=new P(ae,t.ch,t.sticky),h=fe(e,ae))}function C(ae){var te;if(r=="codepoint"){var le=h.text.charCodeAt(t.ch+(i>0?0:-1));if(isNaN(le))te=null;else{var ve=i>0?le>=55296&&le<56320:le>=56320&&le<57343;te=new P(t.line,Math.max(0,Math.min(h.text.length,t.ch+i*(ve?2:1))),-i)}}else s?te=km(e.cm,h,t,i):te=Ys(h,t,i);if(te==null)if(!ae&&v())t=Vs(s,e.cm,h,t.line,g);else return!1;else t=te;return!0}if(r=="char"||r=="codepoint")C();else if(r=="column")C(!0);else if(r=="word"||r=="group")for(var _=null,M=r=="group",I=e.cm&&e.cm.getHelper(t,"wordChars"),z=!0;!(i<0&&!C(!z));z=!1){var U=h.text.charAt(t.ch)||`
16
- `,V=xe(U,I)?"w":M&&U==`
17
- `?"n":!M||/\s/.test(U)?null:"p";if(M&&!z&&!V&&(V="s"),_&&_!=V){i<0&&(i=1,C(),t.sticky="after");break}if(V&&(_=V),i>0&&!C(!z))break}var ee=_a(e,t,l,c,!0);return $e(l,ee)&&(ee.hitSide=!0),ee}function Wf(e,t,i,r){var s=e.doc,l=t.left,c;if(r=="page"){var h=Math.min(e.display.wrapper.clientHeight,Z(e).innerHeight||s(e).documentElement.clientHeight),g=Math.max(h-.5*Nr(e.display),3);c=(i>0?t.bottom:t.top)+i*g}else r=="line"&&(c=i>0?t.bottom+3:t.top-3);for(var v;v=_s(e,l,c),!!v.outside;){if(i<0?c<=0:c>=s.height){v.hitSide=!0;break}c+=i*5}return v}var We=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ft,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};We.prototype.init=function(e){var t=this,i=this,r=i.cm,s=i.div=e.lineDiv;s.contentEditable=!0,no(s,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function l(h){for(var g=h.target;g;g=g.parentNode){if(g==s)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(g.className))break}return!1}me(s,"paste",function(h){!l(h)||tt(r,h)||zf(h,r)||x<=11&&setTimeout(yt(r,function(){return t.updateFromDOM()}),20)}),me(s,"compositionstart",function(h){t.composing={data:h.data,done:!1}}),me(s,"compositionupdate",function(h){t.composing||(t.composing={data:h.data,done:!1})}),me(s,"compositionend",function(h){t.composing&&(h.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),me(s,"touchstart",function(){return i.forceCompositionEnd()}),me(s,"input",function(){t.composing||t.readFromDOMSoon()});function c(h){if(!(!l(h)||tt(r,h))){if(r.somethingSelected())Oa({lineWise:!1,text:r.getSelections()}),h.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var g=Bf(r);Oa({lineWise:!0,text:g.text}),h.type=="cut"&&r.operation(function(){r.setSelections(g.ranges,0,ct),r.replaceSelection("",null,"cut")})}else return;if(h.clipboardData){h.clipboardData.clearData();var v=hn.text.join(`
18
- `);if(h.clipboardData.setData("Text",v),h.clipboardData.getData("Text")==v){h.preventDefault();return}}var C=Hf(),_=C.firstChild;no(_),r.display.lineSpace.insertBefore(C,r.display.lineSpace.firstChild),_.value=hn.text.join(`
19
- `);var M=R(Te(s));L(_),setTimeout(function(){r.display.lineSpace.removeChild(C),M.focus(),M==s&&i.showPrimarySelection()},50)}}me(s,"copy",c),me(s,"cut",c)},We.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},We.prototype.prepareSelection=function(){var e=Iu(this.cm,!1);return e.focus=R(Te(this.div))==this.div,e},We.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},We.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},We.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),r=i.from(),s=i.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||s.line<t.display.viewFrom){e.removeAllRanges();return}var l=Na(t,e.anchorNode,e.anchorOffset),c=Na(t,e.focusNode,e.focusOffset);if(!(l&&!l.bad&&c&&!c.bad&&re(Dr(l,c),r)==0&&re(It(l,c),s)==0)){var h=t.display.view,g=r.line>=t.display.viewFrom&&jf(t,r)||{node:h[0].measure.map[2],offset:0},v=s.line<t.display.viewTo&&jf(t,s);if(!v){var C=h[h.length-1].measure,_=C.maps?C.maps[C.maps.length-1]:C.map;v={node:_[_.length-1],offset:_[_.length-2]-_[_.length-3]}}if(!g||!v){e.removeAllRanges();return}var M=e.rangeCount&&e.getRangeAt(0),I;try{I=G(g.node,g.offset,v.offset,v.node)}catch{}I&&(!f&&t.state.focused?(e.collapse(g.node,g.offset),I.collapsed||(e.removeAllRanges(),e.addRange(I))):(e.removeAllRanges(),e.addRange(I)),M&&e.anchorNode==null?e.addRange(M):f&&this.startGracePeriod()),this.rememberSelection()}},We.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)},We.prototype.showMultipleSelections=function(e){Q(this.cm.display.cursorDiv,e.cursors),Q(this.cm.display.selectionDiv,e.selection)},We.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},We.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return D(this.div,t)},We.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||R(Te(this.div))!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},We.prototype.blur=function(){this.div.blur()},We.prototype.getField=function(){return this.div},We.prototype.supportsTouch=function(){return!0},We.prototype.receivedFocus=function(){var e=this,t=this;this.selectionInEditor()?setTimeout(function(){return e.pollSelection()},20):Bt(this.cm,function(){return t.cm.curOp.selectionChanged=!0});function i(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,i))}this.polling.set(this.cm.options.pollInterval,i)},We.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},We.prototype.pollSelection=function(){if(!(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())){var e=this.getSelection(),t=this.cm;if($&&E&&this.cm.display.gutterSpecs.length&&Wm(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(!this.composing){this.rememberSelection();var i=Na(t,e.anchorNode,e.anchorOffset),r=Na(t,e.focusNode,e.focusOffset);i&&r&&Bt(t,function(){_t(t.doc,Hn(i,r),ct),(i.bad||r.bad)&&(t.curOp.selectionChanged=!0)})}}},We.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,i=e.doc.sel.primary(),r=i.from(),s=i.to();if(r.ch==0&&r.line>e.firstLine()&&(r=P(r.line-1,fe(e.doc,r.line-1).length)),s.ch==fe(e.doc,s.line).text.length&&s.line<e.lastLine()&&(s=P(s.line+1,0)),r.line<t.viewFrom||s.line>t.viewTo-1)return!1;var l,c,h;r.line==t.viewFrom||(l=ar(e,r.line))==0?(c=b(t.view[0].line),h=t.view[0].node):(c=b(t.view[l].line),h=t.view[l-1].node.nextSibling);var g=ar(e,s.line),v,C;if(g==t.view.length-1?(v=t.viewTo-1,C=t.lineDiv.lastChild):(v=b(t.view[g+1].line)-1,C=t.view[g+1].node.previousSibling),!h)return!1;for(var _=e.doc.splitLines(jm(e,h,C,c,v)),M=Sn(e.doc,P(c,0),P(v,fe(e.doc,v).text.length));_.length>1&&M.length>1;)if(be(_)==be(M))_.pop(),M.pop(),v--;else if(_[0]==M[0])_.shift(),M.shift(),c++;else break;for(var I=0,z=0,U=_[0],V=M[0],ee=Math.min(U.length,V.length);I<ee&&U.charCodeAt(I)==V.charCodeAt(I);)++I;for(var ae=be(_),te=be(M),le=Math.min(ae.length-(_.length==1?I:0),te.length-(M.length==1?I:0));z<le&&ae.charCodeAt(ae.length-z-1)==te.charCodeAt(te.length-z-1);)++z;if(_.length==1&&M.length==1&&c==r.line)for(;I&&I>r.ch&&ae.charCodeAt(ae.length-z-1)==te.charCodeAt(te.length-z-1);)I--,z++;_[_.length-1]=ae.slice(0,ae.length-z).replace(/^\u200b+/,""),_[0]=_[0].slice(I).replace(/\u200b+$/,"");var ve=P(c,I),ge=P(v,M.length?be(M).length-z:0);if(_.length>1||_[0]||re(ve,ge))return Hr(e.doc,_,ve,ge,"+input"),!0},We.prototype.ensurePolled=function(){this.forceCompositionEnd()},We.prototype.reset=function(){this.forceCompositionEnd()},We.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},We.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))},We.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Bt(this.cm,function(){return Ot(e.cm)})},We.prototype.setUneditable=function(e){e.contentEditable="false"},We.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||yt(this.cm,to)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},We.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},We.prototype.onContextMenu=function(){},We.prototype.resetPosition=function(){},We.prototype.needsContentAttribute=!0;function jf(e,t){var i=Ss(e,t.line);if(!i||i.hidden)return null;var r=fe(e.doc,t.line),s=vu(i,r,t.line),l=Pe(r,e.doc.direction),c="left";if(l){var h=Nn(l,t.ch);c=h%2?"right":"left"}var g=xu(s.map,t.ch,c);return g.offset=g.collapse=="right"?g.end:g.start,g}function Wm(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Gr(e,t){return t&&(e.bad=!0),e}function jm(e,t,i,r,s){var l="",c=!1,h=e.doc.lineSeparator(),g=!1;function v(I){return function(z){return z.id==I}}function C(){c&&(l+=h,g&&(l+=h),c=g=!1)}function _(I){I&&(C(),l+=I)}function M(I){if(I.nodeType==1){var z=I.getAttribute("cm-text");if(z){_(z);return}var U=I.getAttribute("cm-marker"),V;if(U){var ee=e.findMarks(P(r,0),P(s+1,0),v(+U));ee.length&&(V=ee[0].find(0))&&_(Sn(e.doc,V.from,V.to).join(h));return}if(I.getAttribute("contenteditable")=="false")return;var ae=/^(pre|div|p|li|table|br)$/i.test(I.nodeName);if(!/^br$/i.test(I.nodeName)&&I.textContent.length==0)return;ae&&C();for(var te=0;te<I.childNodes.length;te++)M(I.childNodes[te]);/^(pre|p)$/i.test(I.nodeName)&&(g=!0),ae&&(c=!0)}else I.nodeType==3&&_(I.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;M(t),t!=i;)t=t.nextSibling,g=!1;return l}function Na(e,t,i){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[i],!r)return Gr(e.clipPos(P(e.display.viewTo-1)),!0);t=null,i=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 s=0;s<e.display.view.length;s++){var l=e.display.view[s];if(l.node==r)return Um(l,t,i)}}function Um(e,t,i){var r=e.text.firstChild,s=!1;if(!t||!D(r,t))return Gr(P(b(e.line),0),!0);if(t==r&&(s=!0,t=r.childNodes[i],i=0,!t)){var l=e.rest?be(e.rest):e.line;return Gr(P(b(l),l.text.length),s)}var c=t.nodeType==3?t:null,h=t;for(!c&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(c=t.firstChild,i&&(i=c.nodeValue.length));h.parentNode!=r;)h=h.parentNode;var g=e.measure,v=g.maps;function C(V,ee,ae){for(var te=-1;te<(v?v.length:0);te++)for(var le=te<0?g.map:v[te],ve=0;ve<le.length;ve+=3){var ge=le[ve+2];if(ge==V||ge==ee){var Ae=b(te<0?e.line:e.rest[te]),Ue=le[ve]+ae;return(ae<0||ge!=V)&&(Ue=le[ve+(ae?1:0)]),P(Ae,Ue)}}}var _=C(c,h,i);if(_)return Gr(_,s);for(var M=h.nextSibling,I=c?c.nodeValue.length-i:0;M;M=M.nextSibling){if(_=C(M,M.firstChild,0),_)return Gr(P(_.line,_.ch-I),s);I+=M.textContent.length}for(var z=h.previousSibling,U=i;z;z=z.previousSibling){if(_=C(z,z.firstChild,-1),_)return Gr(P(_.line,_.ch+U),s);U+=z.textContent.length}}var st=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ft,this.hasSelection=!1,this.composing=null,this.resetting=!1};st.prototype.init=function(e){var t=this,i=this,r=this.cm;this.createField(e);var s=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),O&&(s.style.width="0px"),me(s,"input",function(){m&&x>=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),me(s,"paste",function(c){tt(r,c)||zf(c,r)||(r.state.pasteIncoming=+new Date,i.fastPoll())});function l(c){if(!tt(r,c)){if(r.somethingSelected())Oa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var h=Bf(r);Oa({lineWise:!0,text:h.text}),c.type=="cut"?r.setSelections(h.ranges,null,ct):(i.prevInput="",s.value=h.text.join(`
20
- `),L(s))}else return;c.type=="cut"&&(r.state.cutIncoming=+new Date)}}me(s,"cut",l),me(s,"copy",l),me(e.scroller,"paste",function(c){if(!(_n(e,c)||tt(r,c))){if(!s.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var h=new Event("paste");h.clipboardData=c.clipboardData,s.dispatchEvent(h)}}),me(e.lineSpace,"selectstart",function(c){_n(e,c)||Tt(c)}),me(s,"compositionstart",function(){var c=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:c,range:r.markText(c,r.getCursor("to"),{className:"CodeMirror-composing"})}}),me(s,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},st.prototype.createField=function(e){this.wrapper=Hf(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;no(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},st.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},st.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=Iu(e);if(e.options.moveInputWithCursor){var s=fn(e,i.sel.primary().head,"div"),l=t.wrapper.getBoundingClientRect(),c=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,s.top+c.top-l.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,s.left+c.left-l.left))}return r},st.prototype.showSelection=function(e){var t=this.cm,i=t.display;Q(i.cursorDiv,e.cursors),Q(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},st.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i,t.state.focused&&L(this.textarea),m&&x>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",m&&x>=9&&(this.hasSelection=null));this.resetting=!1}},st.prototype.getField=function(){return this.textarea},st.prototype.supportsTouch=function(){return!1},st.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!X||R(Te(this.textarea))!=this.textarea))try{this.textarea.focus()}catch{}},st.prototype.blur=function(){this.textarea.blur()},st.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},st.prototype.receivedFocus=function(){this.slowPoll()},st.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},st.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function i(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,i)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,i)},st.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||Fn(i)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var s=i.value;if(s==r&&!t.somethingSelected())return!1;if(m&&x>=9&&this.hasSelection===s||ne&&/[\uf700-\uf7ff]/.test(s))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var l=s.charCodeAt(0);if(l==8203&&!r&&(r="​"),l==8666)return this.reset(),this.cm.execCommand("undo")}for(var c=0,h=Math.min(r.length,s.length);c<h&&r.charCodeAt(c)==s.charCodeAt(c);)++c;return Bt(t,function(){to(t,s.slice(c),r.length-c,null,e.composing?"*compose":null),s.length>1e3||s.indexOf(`
15
+ `)&&(z=q=P(z.line,0)));var V={from:z,to:q,text:v?v[M%v.length]:g,origin:s||(h?"paste":e.state.cutIncoming>c?"cut":"+input")};Br(e.doc,V),vt(e,"inputRead",e,V)}t&&!h&&jf(e,t),Fr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=_),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Wf(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&Bt(t,function(){return to(t,i,0,null,"paste")}),!0}function jf(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var i=e.doc.sel,r=i.ranges.length-1;r>=0;r--){var s=i.ranges[r];if(!(s.head.ch>100||r&&i.ranges[r-1].head.line==s.head.line)){var l=e.getModeAt(s.head),c=!1;if(l.electricChars){for(var h=0;h<l.electricChars.length;h++)if(t.indexOf(l.electricChars.charAt(h))>-1){c=zi(e,s.head.line,"smart");break}}else l.electricInput&&l.electricInput.test(fe(e.doc,s.head.line).text.slice(0,s.head.ch))&&(c=zi(e,s.head.line,"smart"));c&&vt(e,"electricInput",e,s.head.line)}}}function qf(e){for(var t=[],i=[],r=0;r<e.doc.sel.ranges.length;r++){var s=e.doc.sel.ranges[r].head.line,l={anchor:P(s,0),head:P(s+1,0)};i.push(l),t.push(e.getRange(l.anchor,l.head))}return{text:t,ranges:i}}function no(e,t,i,r){e.setAttribute("autocorrect",i?"on":"off"),e.setAttribute("autocapitalize",r?"on":"off"),e.setAttribute("spellcheck",!!t)}function Uf(){var e=k("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none"),t=k("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return S?e.style.width="1000px":e.setAttribute("wrap","off"),O&&(e.style.border="1px solid black"),t}function jm(e){var t=e.optionHandlers,i=e.helpers={};e.prototype={constructor:e,focus:function(){Z(this).focus(),this.display.input.focus()},setOption:function(r,s){var l=this.options,c=l[r];l[r]==s&&r!="mode"||(l[r]=s,t.hasOwnProperty(r)&&yt(this,t[r])(this,s,c),et(this,"optionChange",this,r))},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,s){this.state.keyMaps[s?"push":"unshift"](Da(r))},removeKeyMap:function(r){for(var s=this.state.keyMaps,l=0;l<s.length;++l)if(s[l]==r||s[l].name==r)return s.splice(l,1),!0},addOverlay:Et(function(r,s){var l=r.token?r:e.getMode(this.options,r);if(l.startState)throw new Error("Overlays may not be stateful.");Gt(this.state.overlays,{mode:l,modeSpec:r,opaque:s&&s.opaque,priority:s&&s.priority||0},function(c){return c.priority}),this.state.modeGen++,Ot(this)}),removeOverlay:Et(function(r){for(var s=this.state.overlays,l=0;l<s.length;++l){var c=s[l].modeSpec;if(c==r||typeof r=="string"&&c.name==r){s.splice(l,1),this.state.modeGen++,Ot(this);return}}}),indentLine:Et(function(r,s,l){typeof s!="string"&&typeof s!="number"&&(s==null?s=this.options.smartIndent?"smart":"prev":s=s?"add":"subtract"),j(this.doc,r)&&zi(this,r,s,l)}),indentSelection:Et(function(r){for(var s=this.doc.sel.ranges,l=-1,c=0;c<s.length;c++){var h=s[c];if(h.empty())h.head.line>l&&(zi(this,h.head.line,r,!0),l=h.head.line,c==this.doc.sel.primIndex&&Fr(this));else{var g=h.from(),v=h.to(),C=Math.max(l,g.line);l=Math.min(this.lastLine(),v.line-(v.ch?0:1))+1;for(var _=C;_<l;++_)zi(this,_,r);var M=this.doc.sel.ranges;g.ch==0&&s.length==M.length&&M[c].from().ch>0&&Ks(this.doc,c,new Be(g,M[c].to()),ct)}}}),getTokenAt:function(r,s){return eu(this,r,s)},getLineTokens:function(r,s){return eu(this,P(r),s,!0)},getTokenTypeAt:function(r){r=Se(this.doc,r);var s=Jl(this,fe(this.doc,r.line)),l=0,c=(s.length-1)/2,h=r.ch,g;if(h==0)g=s[2];else for(;;){var v=l+c>>1;if((v?s[v*2-1]:0)>=h)c=v;else if(s[v*2+1]<h)l=v+1;else{g=s[v*2+2];break}}var C=g?g.indexOf("overlay "):-1;return C<0?g:C==0?null:g.slice(0,C-1)},getModeAt:function(r){var s=this.doc.mode;return s.innerMode?e.innerMode(s,this.getTokenAt(r).state).mode:s},getHelper:function(r,s){return this.getHelpers(r,s)[0]},getHelpers:function(r,s){var l=[];if(!i.hasOwnProperty(s))return l;var c=i[s],h=this.getModeAt(r);if(typeof h[s]=="string")c[h[s]]&&l.push(c[h[s]]);else if(h[s])for(var g=0;g<h[s].length;g++){var v=c[h[s][g]];v&&l.push(v)}else h.helperType&&c[h.helperType]?l.push(c[h.helperType]):c[h.name]&&l.push(c[h.name]);for(var C=0;C<c._global.length;C++){var _=c._global[C];_.pred(h,this)&&we(l,_.val)==-1&&l.push(_.val)}return l},getStateAfter:function(r,s){var l=this.doc;return r=Xl(l,r??l.first+l.size-1),hi(this,r+1,s).state},cursorCoords:function(r,s){var l,c=this.doc.sel.primary();return r==null?l=c.head:typeof r=="object"?l=Se(this.doc,r):l=r?c.from():c.to(),cn(this,l,s||"page")},charCoords:function(r,s){return pa(this,Se(this.doc,r),s||"page")},coordsChar:function(r,s){return r=Du(this,r,s||"page"),_s(this,r.left,r.top)},lineAtHeight:function(r,s){return r=Du(this,{top:r,left:0},s||"page").top,T(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,s,l){var c=!1,h;if(typeof r=="number"){var g=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>g&&(r=g,c=!0),h=fe(this.doc,r)}else h=r;return da(this,h,{top:0,left:0},s||"page",l||c).top+(c?this.doc.height-Tn(h):0)},defaultTextHeight:function(){return Nr(this.display)},defaultCharWidth:function(){return Mr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,s,l,c,h){var g=this.display;r=cn(this,Se(this.doc,r));var v=r.bottom,C=r.left;if(s.style.position="absolute",s.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(s),g.sizer.appendChild(s),c=="over")v=r.top;else if(c=="above"||c=="near"){var _=Math.max(g.wrapper.clientHeight,this.doc.height),M=Math.max(g.sizer.clientWidth,g.lineSpace.clientWidth);(c=="above"||r.bottom+s.offsetHeight>_)&&r.top>s.offsetHeight?v=r.top-s.offsetHeight:r.bottom+s.offsetHeight<=_&&(v=r.bottom),C+s.offsetWidth>M&&(C=M-s.offsetWidth)}s.style.top=v+"px",s.style.left=s.style.right="",h=="right"?(C=g.sizer.clientWidth-s.offsetWidth,s.style.right="0px"):(h=="left"?C=0:h=="middle"&&(C=(g.sizer.clientWidth-s.offsetWidth)/2),s.style.left=C+"px"),l&&Bg(this,{left:C,top:v,right:C+s.offsetWidth,bottom:v+s.offsetHeight})},triggerOnKeyDown:Et(Nf),triggerOnKeyPress:Et(Rf),triggerOnKeyUp:Mf,triggerOnMouseDown:Et(Ff),execCommand:function(r){if(Mi.hasOwnProperty(r))return Mi[r].call(null,this)},triggerElectric:Et(function(r){jf(this,r)}),findPosH:function(r,s,l,c){var h=1;s<0&&(h=-1,s=-s);for(var g=Se(this.doc,r),v=0;v<s&&(g=ro(this.doc,g,h,l,c),!g.hitSide);++v);return g},moveH:Et(function(r,s){var l=this;this.extendSelectionsBy(function(c){return l.display.shift||l.doc.extend||c.empty()?ro(l.doc,c.head,r,s,l.options.rtlMoveVisually):r<0?c.from():c.to()},ht)}),deleteH:Et(function(r,s){var l=this.doc.sel,c=this.doc;l.somethingSelected()?c.replaceSelection("",null,"+delete"):qr(this,function(h){var g=ro(c,h.head,r,s,!1);return r<0?{from:g,to:h.head}:{from:h.head,to:g}})}),findPosV:function(r,s,l,c){var h=1,g=c;s<0&&(h=-1,s=-s);for(var v=Se(this.doc,r),C=0;C<s;++C){var _=cn(this,v,"div");if(g==null?g=_.left:_.left=g,v=Gf(this,_,h,l),v.hitSide)break}return v},moveV:Et(function(r,s){var l=this,c=this.doc,h=[],g=!this.display.shift&&!c.extend&&c.sel.somethingSelected();if(c.extendSelectionsBy(function(C){if(g)return r<0?C.from():C.to();var _=cn(l,C.head,"div");C.goalColumn!=null&&(_.left=C.goalColumn),h.push(_.left);var M=Gf(l,_,r,s);return s=="page"&&C==c.sel.primary()&&Fs(l,pa(l,M,"div").top-_.top),M},ht),h.length)for(var v=0;v<c.sel.ranges.length;v++)c.sel.ranges[v].goalColumn=h[v]}),findWordAt:function(r){var s=this.doc,l=fe(s,r.line).text,c=r.ch,h=r.ch;if(l){var g=this.getHelper(r,"wordChars");(r.sticky=="before"||h==l.length)&&c?--c:++h;for(var v=l.charAt(c),C=xe(v,g)?function(_){return xe(_,g)}:/\s/.test(v)?function(_){return/\s/.test(_)}:function(_){return!/\s/.test(_)&&!xe(_)};c>0&&C(l.charAt(c-1));)--c;for(;h<l.length&&C(l.charAt(h));)++h}return new Be(P(r.line,c),P(r.line,h))},toggleOverwrite:function(r){r!=null&&r==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?K(this.display.cursorDiv,"CodeMirror-overwrite"):ze(this.display.cursorDiv,"CodeMirror-overwrite"),et(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==R(oe(this))},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Et(function(r,s){bi(this,r,s)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-yn(this)-this.display.barHeight,width:r.scrollWidth-yn(this)-this.display.barWidth,clientHeight:ks(this),clientWidth:nr(this)}},scrollIntoView:Et(function(r,s){r==null?(r={from:this.doc.sel.primary().head,to:null},s==null&&(s=this.options.cursorScrollMargin)):typeof r=="number"?r={from:P(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=s||0,r.from.line!=null?Hg(this,r):zu(this,r.from,r.to,r.margin)}),setSize:Et(function(r,s){var l=this,c=function(g){return typeof g=="number"||/^\d+$/.test(String(g))?g+"px":g};r!=null&&(this.display.wrapper.style.width=c(r)),s!=null&&(this.display.wrapper.style.height=c(s)),this.options.lineWrapping&&_u(this);var h=this.display.viewFrom;this.doc.iter(h,this.display.viewTo,function(g){if(g.widgets){for(var v=0;v<g.widgets.length;v++)if(g.widgets[v].noHScroll){$n(l,h,"widget");break}}++h}),this.curOp.forceUpdate=!0,et(this,"refresh",this)}),operation:function(r){return Bt(this,r)},startOperation:function(){return lr(this)},endOperation:function(){return ur(this)},refresh:Et(function(){var r=this.display.cachedTextHeight;Ot(this),this.curOp.forceUpdate=!0,vi(this),bi(this,this.doc.scrollLeft,this.doc.scrollTop),$s(this.display),(r==null||Math.abs(r-Nr(this.display))>.5||this.options.lineWrapping)&&As(this),et(this,"refresh",this)}),swapDoc:Et(function(r){var s=this.doc;return s.cm=null,this.state.selectingText&&this.state.selectingText(),Qu(this,r),vi(this),this.display.input.reset(),bi(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,vt(this,"swapDoc",this,s),s}),phrase:function(r){var s=this.options.phrases;return s&&Object.prototype.hasOwnProperty.call(s,r)?s[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}},an(e),e.registerHelper=function(r,s,l){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][s]=l},e.registerGlobalHelper=function(r,s,l,c){e.registerHelper(r,s,c),i[r]._global.push({pred:l,val:c})}}function ro(e,t,i,r,s){var l=t,c=i,h=fe(e,t.line),g=s&&e.direction=="rtl"?-i:i;function v(){var ae=t.line+g;return ae<e.first||ae>=e.first+e.size?!1:(t=new P(ae,t.ch,t.sticky),h=fe(e,ae))}function C(ae){var te;if(r=="codepoint"){var le=h.text.charCodeAt(t.ch+(i>0?0:-1));if(isNaN(le))te=null;else{var ve=i>0?le>=55296&&le<56320:le>=56320&&le<57343;te=new P(t.line,Math.max(0,Math.min(h.text.length,t.ch+i*(ve?2:1))),-i)}}else s?te=Cm(e.cm,h,t,i):te=Ys(h,t,i);if(te==null)if(!ae&&v())t=Vs(s,e.cm,h,t.line,g);else return!1;else t=te;return!0}if(r=="char"||r=="codepoint")C();else if(r=="column")C(!0);else if(r=="word"||r=="group")for(var _=null,M=r=="group",I=e.cm&&e.cm.getHelper(t,"wordChars"),z=!0;!(i<0&&!C(!z));z=!1){var q=h.text.charAt(t.ch)||`
16
+ `,V=xe(q,I)?"w":M&&q==`
17
+ `?"n":!M||/\s/.test(q)?null:"p";if(M&&!z&&!V&&(V="s"),_&&_!=V){i<0&&(i=1,C(),t.sticky="after");break}if(V&&(_=V),i>0&&!C(!z))break}var ee=_a(e,t,l,c,!0);return $e(l,ee)&&(ee.hitSide=!0),ee}function Gf(e,t,i,r){var s=e.doc,l=t.left,c;if(r=="page"){var h=Math.min(e.display.wrapper.clientHeight,Z(e).innerHeight||s(e).documentElement.clientHeight),g=Math.max(h-.5*Nr(e.display),3);c=(i>0?t.bottom:t.top)+i*g}else r=="line"&&(c=i>0?t.bottom+3:t.top-3);for(var v;v=_s(e,l,c),!!v.outside;){if(i<0?c<=0:c>=s.height){v.hitSide=!0;break}c+=i*5}return v}var We=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ft,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};We.prototype.init=function(e){var t=this,i=this,r=i.cm,s=i.div=e.lineDiv;s.contentEditable=!0,no(s,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function l(h){for(var g=h.target;g;g=g.parentNode){if(g==s)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(g.className))break}return!1}me(s,"paste",function(h){!l(h)||tt(r,h)||Wf(h,r)||x<=11&&setTimeout(yt(r,function(){return t.updateFromDOM()}),20)}),me(s,"compositionstart",function(h){t.composing={data:h.data,done:!1}}),me(s,"compositionupdate",function(h){t.composing||(t.composing={data:h.data,done:!1})}),me(s,"compositionend",function(h){t.composing&&(h.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),me(s,"touchstart",function(){return i.forceCompositionEnd()}),me(s,"input",function(){t.composing||t.readFromDOMSoon()});function c(h){if(!(!l(h)||tt(r,h))){if(r.somethingSelected())Oa({lineWise:!1,text:r.getSelections()}),h.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var g=qf(r);Oa({lineWise:!0,text:g.text}),h.type=="cut"&&r.operation(function(){r.setSelections(g.ranges,0,ct),r.replaceSelection("",null,"cut")})}else return;if(h.clipboardData){h.clipboardData.clearData();var v=dn.text.join(`
18
+ `);if(h.clipboardData.setData("Text",v),h.clipboardData.getData("Text")==v){h.preventDefault();return}}var C=Uf(),_=C.firstChild;no(_),r.display.lineSpace.insertBefore(C,r.display.lineSpace.firstChild),_.value=dn.text.join(`
19
+ `);var M=R(Te(s));L(_),setTimeout(function(){r.display.lineSpace.removeChild(C),M.focus(),M==s&&i.showPrimarySelection()},50)}}me(s,"copy",c),me(s,"cut",c)},We.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},We.prototype.prepareSelection=function(){var e=Ru(this.cm,!1);return e.focus=R(Te(this.div))==this.div,e},We.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},We.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},We.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),r=i.from(),s=i.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||s.line<t.display.viewFrom){e.removeAllRanges();return}var l=Na(t,e.anchorNode,e.anchorOffset),c=Na(t,e.focusNode,e.focusOffset);if(!(l&&!l.bad&&c&&!c.bad&&re(Dr(l,c),r)==0&&re(It(l,c),s)==0)){var h=t.display.view,g=r.line>=t.display.viewFrom&&Kf(t,r)||{node:h[0].measure.map[2],offset:0},v=s.line<t.display.viewTo&&Kf(t,s);if(!v){var C=h[h.length-1].measure,_=C.maps?C.maps[C.maps.length-1]:C.map;v={node:_[_.length-1],offset:_[_.length-2]-_[_.length-3]}}if(!g||!v){e.removeAllRanges();return}var M=e.rangeCount&&e.getRangeAt(0),I;try{I=G(g.node,g.offset,v.offset,v.node)}catch{}I&&(!f&&t.state.focused?(e.collapse(g.node,g.offset),I.collapsed||(e.removeAllRanges(),e.addRange(I))):(e.removeAllRanges(),e.addRange(I)),M&&e.anchorNode==null?e.addRange(M):f&&this.startGracePeriod()),this.rememberSelection()}},We.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)},We.prototype.showMultipleSelections=function(e){Q(this.cm.display.cursorDiv,e.cursors),Q(this.cm.display.selectionDiv,e.selection)},We.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},We.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return D(this.div,t)},We.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||R(Te(this.div))!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},We.prototype.blur=function(){this.div.blur()},We.prototype.getField=function(){return this.div},We.prototype.supportsTouch=function(){return!0},We.prototype.receivedFocus=function(){var e=this,t=this;this.selectionInEditor()?setTimeout(function(){return e.pollSelection()},20):Bt(this.cm,function(){return t.cm.curOp.selectionChanged=!0});function i(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,i))}this.polling.set(this.cm.options.pollInterval,i)},We.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},We.prototype.pollSelection=function(){if(!(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())){var e=this.getSelection(),t=this.cm;if($&&E&&this.cm.display.gutterSpecs.length&&qm(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(!this.composing){this.rememberSelection();var i=Na(t,e.anchorNode,e.anchorOffset),r=Na(t,e.focusNode,e.focusOffset);i&&r&&Bt(t,function(){_t(t.doc,Hn(i,r),ct),(i.bad||r.bad)&&(t.curOp.selectionChanged=!0)})}}},We.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,i=e.doc.sel.primary(),r=i.from(),s=i.to();if(r.ch==0&&r.line>e.firstLine()&&(r=P(r.line-1,fe(e.doc,r.line-1).length)),s.ch==fe(e.doc,s.line).text.length&&s.line<e.lastLine()&&(s=P(s.line+1,0)),r.line<t.viewFrom||s.line>t.viewTo-1)return!1;var l,c,h;r.line==t.viewFrom||(l=ar(e,r.line))==0?(c=b(t.view[0].line),h=t.view[0].node):(c=b(t.view[l].line),h=t.view[l-1].node.nextSibling);var g=ar(e,s.line),v,C;if(g==t.view.length-1?(v=t.viewTo-1,C=t.lineDiv.lastChild):(v=b(t.view[g+1].line)-1,C=t.view[g+1].node.previousSibling),!h)return!1;for(var _=e.doc.splitLines(Um(e,h,C,c,v)),M=Sn(e.doc,P(c,0),P(v,fe(e.doc,v).text.length));_.length>1&&M.length>1;)if(be(_)==be(M))_.pop(),M.pop(),v--;else if(_[0]==M[0])_.shift(),M.shift(),c++;else break;for(var I=0,z=0,q=_[0],V=M[0],ee=Math.min(q.length,V.length);I<ee&&q.charCodeAt(I)==V.charCodeAt(I);)++I;for(var ae=be(_),te=be(M),le=Math.min(ae.length-(_.length==1?I:0),te.length-(M.length==1?I:0));z<le&&ae.charCodeAt(ae.length-z-1)==te.charCodeAt(te.length-z-1);)++z;if(_.length==1&&M.length==1&&c==r.line)for(;I&&I>r.ch&&ae.charCodeAt(ae.length-z-1)==te.charCodeAt(te.length-z-1);)I--,z++;_[_.length-1]=ae.slice(0,ae.length-z).replace(/^\u200b+/,""),_[0]=_[0].slice(I).replace(/\u200b+$/,"");var ve=P(c,I),ge=P(v,M.length?be(M).length-z:0);if(_.length>1||_[0]||re(ve,ge))return Hr(e.doc,_,ve,ge,"+input"),!0},We.prototype.ensurePolled=function(){this.forceCompositionEnd()},We.prototype.reset=function(){this.forceCompositionEnd()},We.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},We.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))},We.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Bt(this.cm,function(){return Ot(e.cm)})},We.prototype.setUneditable=function(e){e.contentEditable="false"},We.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||yt(this.cm,to)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},We.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},We.prototype.onContextMenu=function(){},We.prototype.resetPosition=function(){},We.prototype.needsContentAttribute=!0;function Kf(e,t){var i=Ss(e,t.line);if(!i||i.hidden)return null;var r=fe(e.doc,t.line),s=wu(i,r,t.line),l=Pe(r,e.doc.direction),c="left";if(l){var h=Nn(l,t.ch);c=h%2?"right":"left"}var g=Cu(s.map,t.ch,c);return g.offset=g.collapse=="right"?g.end:g.start,g}function qm(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Gr(e,t){return t&&(e.bad=!0),e}function Um(e,t,i,r,s){var l="",c=!1,h=e.doc.lineSeparator(),g=!1;function v(I){return function(z){return z.id==I}}function C(){c&&(l+=h,g&&(l+=h),c=g=!1)}function _(I){I&&(C(),l+=I)}function M(I){if(I.nodeType==1){var z=I.getAttribute("cm-text");if(z){_(z);return}var q=I.getAttribute("cm-marker"),V;if(q){var ee=e.findMarks(P(r,0),P(s+1,0),v(+q));ee.length&&(V=ee[0].find(0))&&_(Sn(e.doc,V.from,V.to).join(h));return}if(I.getAttribute("contenteditable")=="false")return;var ae=/^(pre|div|p|li|table|br)$/i.test(I.nodeName);if(!/^br$/i.test(I.nodeName)&&I.textContent.length==0)return;ae&&C();for(var te=0;te<I.childNodes.length;te++)M(I.childNodes[te]);/^(pre|p)$/i.test(I.nodeName)&&(g=!0),ae&&(c=!0)}else I.nodeType==3&&_(I.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;M(t),t!=i;)t=t.nextSibling,g=!1;return l}function Na(e,t,i){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[i],!r)return Gr(e.clipPos(P(e.display.viewTo-1)),!0);t=null,i=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 s=0;s<e.display.view.length;s++){var l=e.display.view[s];if(l.node==r)return Gm(l,t,i)}}function Gm(e,t,i){var r=e.text.firstChild,s=!1;if(!t||!D(r,t))return Gr(P(b(e.line),0),!0);if(t==r&&(s=!0,t=r.childNodes[i],i=0,!t)){var l=e.rest?be(e.rest):e.line;return Gr(P(b(l),l.text.length),s)}var c=t.nodeType==3?t:null,h=t;for(!c&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(c=t.firstChild,i&&(i=c.nodeValue.length));h.parentNode!=r;)h=h.parentNode;var g=e.measure,v=g.maps;function C(V,ee,ae){for(var te=-1;te<(v?v.length:0);te++)for(var le=te<0?g.map:v[te],ve=0;ve<le.length;ve+=3){var ge=le[ve+2];if(ge==V||ge==ee){var Ae=b(te<0?e.line:e.rest[te]),qe=le[ve]+ae;return(ae<0||ge!=V)&&(qe=le[ve+(ae?1:0)]),P(Ae,qe)}}}var _=C(c,h,i);if(_)return Gr(_,s);for(var M=h.nextSibling,I=c?c.nodeValue.length-i:0;M;M=M.nextSibling){if(_=C(M,M.firstChild,0),_)return Gr(P(_.line,_.ch-I),s);I+=M.textContent.length}for(var z=h.previousSibling,q=i;z;z=z.previousSibling){if(_=C(z,z.firstChild,-1),_)return Gr(P(_.line,_.ch+q),s);q+=z.textContent.length}}var st=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ft,this.hasSelection=!1,this.composing=null,this.resetting=!1};st.prototype.init=function(e){var t=this,i=this,r=this.cm;this.createField(e);var s=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),O&&(s.style.width="0px"),me(s,"input",function(){m&&x>=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),me(s,"paste",function(c){tt(r,c)||Wf(c,r)||(r.state.pasteIncoming=+new Date,i.fastPoll())});function l(c){if(!tt(r,c)){if(r.somethingSelected())Oa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var h=qf(r);Oa({lineWise:!0,text:h.text}),c.type=="cut"?r.setSelections(h.ranges,null,ct):(i.prevInput="",s.value=h.text.join(`
20
+ `),L(s))}else return;c.type=="cut"&&(r.state.cutIncoming=+new Date)}}me(s,"cut",l),me(s,"copy",l),me(e.scroller,"paste",function(c){if(!(_n(e,c)||tt(r,c))){if(!s.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var h=new Event("paste");h.clipboardData=c.clipboardData,s.dispatchEvent(h)}}),me(e.lineSpace,"selectstart",function(c){_n(e,c)||Tt(c)}),me(s,"compositionstart",function(){var c=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:c,range:r.markText(c,r.getCursor("to"),{className:"CodeMirror-composing"})}}),me(s,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},st.prototype.createField=function(e){this.wrapper=Uf(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;no(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},st.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},st.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=Ru(e);if(e.options.moveInputWithCursor){var s=cn(e,i.sel.primary().head,"div"),l=t.wrapper.getBoundingClientRect(),c=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,s.top+c.top-l.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,s.left+c.left-l.left))}return r},st.prototype.showSelection=function(e){var t=this.cm,i=t.display;Q(i.cursorDiv,e.cursors),Q(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},st.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i,t.state.focused&&L(this.textarea),m&&x>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",m&&x>=9&&(this.hasSelection=null));this.resetting=!1}},st.prototype.getField=function(){return this.textarea},st.prototype.supportsTouch=function(){return!1},st.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!X||R(Te(this.textarea))!=this.textarea))try{this.textarea.focus()}catch{}},st.prototype.blur=function(){this.textarea.blur()},st.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},st.prototype.receivedFocus=function(){this.slowPoll()},st.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},st.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function i(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,i)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,i)},st.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||Fn(i)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var s=i.value;if(s==r&&!t.somethingSelected())return!1;if(m&&x>=9&&this.hasSelection===s||ne&&/[\uf700-\uf7ff]/.test(s))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var l=s.charCodeAt(0);if(l==8203&&!r&&(r="​"),l==8666)return this.reset(),this.cm.execCommand("undo")}for(var c=0,h=Math.min(r.length,s.length);c<h&&r.charCodeAt(c)==s.charCodeAt(c);)++c;return Bt(t,function(){to(t,s.slice(c),r.length-c,null,e.composing?"*compose":null),s.length>1e3||s.indexOf(`
21
21
  `)>-1?i.value=e.prevInput="":e.prevInput=s,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},st.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},st.prototype.onKeyPress=function(){m&&x>=9&&(this.hasSelection=null),this.fastPoll()},st.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,s=t.textarea;t.contextMenuPending&&t.contextMenuPending();var l=ir(i,e),c=r.scroller.scrollTop;if(!l||B)return;var h=i.options.resetSelectionOnContextMenu;h&&i.doc.sel.contains(l)==-1&&yt(i,_t)(i.doc,Hn(l),ct);var g=s.style.cssText,v=t.wrapper.style.cssText,C=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",s.style.cssText=`position: absolute; width: 30px; height: 30px;
22
22
  top: `+(e.clientY-C.top-5)+"px; left: "+(e.clientX-C.left-5)+`px;
23
23
  z-index: 1000; background: `+(m?"rgba(255, 255, 255, .05)":"transparent")+`;
24
- outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var _;S&&(_=s.ownerDocument.defaultView.scrollY),r.input.focus(),S&&s.ownerDocument.defaultView.scrollTo(null,_),r.input.reset(),i.somethingSelected()||(s.value=t.prevInput=" "),t.contextMenuPending=I,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function M(){if(s.selectionStart!=null){var U=i.somethingSelected(),V="​"+(U?s.value:"");s.value="⇚",s.value=V,t.prevInput=U?"":"​",s.selectionStart=1,s.selectionEnd=V.length,r.selForContextMenu=i.doc.sel}}function I(){if(t.contextMenuPending==I&&(t.contextMenuPending=!1,t.wrapper.style.cssText=v,s.style.cssText=g,m&&x<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=c),s.selectionStart!=null)){(!m||m&&x<9)&&M();var U=0,V=function(){r.selForContextMenu==i.doc.sel&&s.selectionStart==0&&s.selectionEnd>0&&t.prevInput=="​"?yt(i,lf)(i):U++<10?r.detectingSelectAll=setTimeout(V,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(V,200)}}if(m&&x>=9&&M(),Re){Mn(e);var z=function(){Ct(window,"mouseup",z),setTimeout(I,20)};me(window,"mouseup",z)}else setTimeout(I,50)},st.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},st.prototype.setUneditable=function(){},st.prototype.needsContentAttribute=!1;function qm(e,t){if(t=t?ke(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 i=R(Te(e));t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=h.getValue()}var s;if(e.form&&(me(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var l=e.form;s=l.submit;try{var c=l.submit=function(){r(),l.submit=s,l.submit(),l.submit=c}}catch{}}t.finishInit=function(g){g.save=r,g.getTextArea=function(){return e},g.toTextArea=function(){g.toTextArea=isNaN,r(),e.parentNode.removeChild(g.getWrapperElement()),e.style.display="",e.form&&(Ct(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=s))}},e.style.display="none";var h=Ve(function(g){return e.parentNode.insertBefore(g,e.nextSibling)},t);return h}function Gm(e){e.off=Ct,e.on=me,e.wheelEventPixels=Zg,e.Doc=Nt,e.splitLines=en,e.countColumn=_e,e.findColumn=dt,e.isWordChar=ye,e.Pass=Ke,e.signal=et,e.Line=Ar,e.changeEnd=Wn,e.scrollbarModel=Pu,e.Pos=P,e.cmpPos=re,e.modes=Cr,e.mimeModes=on,e.resolveMode=Tr,e.getMode=_r,e.modeExtensions=Pn,e.extendMode=Lr,e.copyState=gn,e.startState=Er,e.innerMode=fi,e.commands=Mi,e.keyMap=En,e.keyName=Cf,e.isModifierKey=kf,e.lookupKey=jr,e.normalizeKeyMap=wm,e.StringStream=nt,e.SharedTextMarker=Ii,e.TextMarker=Un,e.LineWidget=Ai,e.e_preventDefault=Tt,e.e_stopPropagation=kr,e.e_stop=Mn,e.addClass=K,e.contains=D,e.rmClass=ze,e.keyNames=qn}Pm(Ve),Hm(Ve);var Km="iter insert remove copy getEditor constructor".split(" ");for(var Ma in Nt.prototype)Nt.prototype.hasOwnProperty(Ma)&&we(Km,Ma)<0&&(Ve.prototype[Ma]=function(e){return function(){return e.apply(this.doc,arguments)}}(Nt.prototype[Ma]));return rn(Nt),Ve.inputStyles={textarea:st,contenteditable:We},Ve.defineMode=function(e){!Ve.defaults.mode&&e!="null"&&(Ve.defaults.mode=e),ln.apply(this,arguments)},Ve.defineMIME=tr,Ve.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Ve.defineMIME("text/plain","null"),Ve.defineExtension=function(e,t){Ve.prototype[e]=t},Ve.defineDocExtension=function(e,t){Nt.prototype[e]=t},Ve.fromTextArea=qm,Gm(Ve),Ve.version="5.65.20",Ve})}(Fa)),Fa.exports}(function(u,n){(function(a){a(Wt())})(function(a){a.defineMode("javascript",function(o,f){var d=o.indentUnit,p=f.statementIndent,y=f.jsonld,m=f.json||y,x=f.trackScope!==!1,S=f.typescript,A=f.wordCharacters||/[\w$\xa1-\uffff]/,E=function(){function b(mt){return{type:mt,style:"keyword"}}var T=b("keyword a"),j=b("keyword b"),Y=b("keyword c"),P=b("keyword d"),re=b("operator"),$e={type:"atom",style:"atom"};return{if:b("if"),while:T,with:T,else:j,do:j,try:j,finally:j,return:P,break:P,continue:P,new:b("new"),delete:Y,void:Y,throw:Y,debugger:b("debugger"),var:b("var"),const:b("var"),let:b("var"),function:b("function"),catch:b("catch"),for:b("for"),switch:b("switch"),case:b("case"),default:b("default"),in:re,typeof:re,instanceof:re,true:$e,false:$e,null:$e,undefined:$e,NaN:$e,Infinity:$e,this:b("this"),class:b("class"),super:b("atom"),yield:Y,export:b("export"),import:b("import"),extends:Y,await:Y}}(),W=/[+\-*&%=<>!?|~^@]/,B=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function q(b){for(var T=!1,j,Y=!1;(j=b.next())!=null;){if(!T){if(j=="/"&&!Y)return;j=="["?Y=!0:Y&&j=="]"&&(Y=!1)}T=!T&&j=="\\"}}var F,N;function O(b,T,j){return F=b,N=j,T}function $(b,T){var j=b.next();if(j=='"'||j=="'")return T.tokenize=X(j),T.tokenize(b,T);if(j=="."&&b.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return O("number","number");if(j=="."&&b.match(".."))return O("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(j))return O(j);if(j=="="&&b.eat(">"))return O("=>","operator");if(j=="0"&&b.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return O("number","number");if(/\d/.test(j))return b.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),O("number","number");if(j=="/")return b.eat("*")?(T.tokenize=ne,ne(b,T)):b.eat("/")?(b.skipToEnd(),O("comment","comment")):Kt(b,T,1)?(q(b),b.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),O("regexp","string-2")):(b.eat("="),O("operator","operator",b.current()));if(j=="`")return T.tokenize=ue,ue(b,T);if(j=="#"&&b.peek()=="!")return b.skipToEnd(),O("meta","meta");if(j=="#"&&b.eatWhile(A))return O("variable","property");if(j=="<"&&b.match("!--")||j=="-"&&b.match("->")&&!/\S/.test(b.string.slice(0,b.start)))return b.skipToEnd(),O("comment","comment");if(W.test(j))return(j!=">"||!T.lexical||T.lexical.type!=">")&&(b.eat("=")?(j=="!"||j=="=")&&b.eat("="):/[<>*+\-|&?]/.test(j)&&(b.eat(j),j==">"&&b.eat(j))),j=="?"&&b.eat(".")?O("."):O("operator","operator",b.current());if(A.test(j)){b.eatWhile(A);var Y=b.current();if(T.lastType!="."){if(E.propertyIsEnumerable(Y)){var P=E[Y];return O(P.type,P.style,Y)}if(Y=="async"&&b.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return O("async","keyword",Y)}return O("variable","variable",Y)}}function X(b){return function(T,j){var Y=!1,P;if(y&&T.peek()=="@"&&T.match(B))return j.tokenize=$,O("jsonld-keyword","meta");for(;(P=T.next())!=null&&!(P==b&&!Y);)Y=!Y&&P=="\\";return Y||(j.tokenize=$),O("string","string")}}function ne(b,T){for(var j=!1,Y;Y=b.next();){if(Y=="/"&&j){T.tokenize=$;break}j=Y=="*"}return O("comment","comment")}function ue(b,T){for(var j=!1,Y;(Y=b.next())!=null;){if(!j&&(Y=="`"||Y=="$"&&b.eat("{"))){T.tokenize=$;break}j=!j&&Y=="\\"}return O("quasi","string-2",b.current())}var se="([{}])";function he(b,T){T.fatArrowAt&&(T.fatArrowAt=null);var j=b.string.indexOf("=>",b.start);if(!(j<0)){if(S){var Y=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(b.string.slice(b.start,j));Y&&(j=Y.index)}for(var P=0,re=!1,$e=j-1;$e>=0;--$e){var mt=b.string.charAt($e),It=se.indexOf(mt);if(It>=0&&It<3){if(!P){++$e;break}if(--P==0){mt=="("&&(re=!0);break}}else if(It>=3&&It<6)++P;else if(A.test(mt))re=!0;else if(/["'\/`]/.test(mt))for(;;--$e){if($e==0)return;var Dr=b.string.charAt($e-1);if(Dr==mt&&b.string.charAt($e-2)!="\\"){$e--;break}}else if(re&&!P){++$e;break}}re&&!P&&(T.fatArrowAt=$e)}}var Oe={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function Re(b,T,j,Y,P,re){this.indented=b,this.column=T,this.type=j,this.prev=P,this.info=re,Y!=null&&(this.align=Y)}function ie(b,T){if(!x)return!1;for(var j=b.localVars;j;j=j.next)if(j.name==T)return!0;for(var Y=b.context;Y;Y=Y.prev)for(var j=Y.vars;j;j=j.next)if(j.name==T)return!0}function ze(b,T,j,Y,P){var re=b.cc;for(H.state=b,H.stream=P,H.marked=null,H.cc=re,H.style=T,b.lexical.hasOwnProperty("align")||(b.lexical.align=!0);;){var $e=re.length?re.pop():m?we:_e;if($e(j,Y)){for(;re.length&&re[re.length-1].lex;)re.pop()();return H.marked?H.marked:j=="variable"&&ie(b,Y)?"variable-2":T}}}var H={state:null,marked:null,cc:null};function Q(){for(var b=arguments.length-1;b>=0;b--)H.cc.push(arguments[b])}function k(){return Q.apply(null,arguments),!0}function J(b,T){for(var j=T;j;j=j.next)if(j.name==b)return!0;return!1}function G(b){var T=H.state;if(H.marked="def",!!x){if(T.context){if(T.lexical.info=="var"&&T.context&&T.context.block){var j=D(b,T.context);if(j!=null){T.context=j;return}}else if(!J(b,T.localVars)){T.localVars=new de(b,T.localVars);return}}f.globalVars&&!J(b,T.globalVars)&&(T.globalVars=new de(b,T.globalVars))}}function D(b,T){if(T)if(T.block){var j=D(b,T.prev);return j?j==T.prev?T:new K(j,T.vars,!0):null}else return J(b,T.vars)?T:new K(T.prev,new de(b,T.vars),!1);else return null}function R(b){return b=="public"||b=="private"||b=="protected"||b=="abstract"||b=="readonly"}function K(b,T,j){this.prev=b,this.vars=T,this.block=j}function de(b,T){this.name=b,this.next=T}var L=new de("this",new de("arguments",null));function w(){H.state.context=new K(H.state.context,H.state.localVars,!1),H.state.localVars=L}function oe(){H.state.context=new K(H.state.context,H.state.localVars,!0),H.state.localVars=null}w.lex=oe.lex=!0;function Te(){H.state.localVars=H.state.context.vars,H.state.context=H.state.context.prev}Te.lex=!0;function Z(b,T){var j=function(){var Y=H.state,P=Y.indented;if(Y.lexical.type=="stat")P=Y.lexical.indented;else for(var re=Y.lexical;re&&re.type==")"&&re.align;re=re.prev)P=re.indented;Y.lexical=new Re(P,H.stream.column(),b,null,Y.lexical,T)};return j.lex=!0,j}function ce(){var b=H.state;b.lexical.prev&&(b.lexical.type==")"&&(b.indented=b.lexical.indented),b.lexical=b.lexical.prev)}ce.lex=!0;function ke(b){function T(j){return j==b?k():b==";"||j=="}"||j==")"||j=="]"?Q():k(T)}return T}function _e(b,T){return b=="var"?k(Z("vardef",T),kr,ke(";"),ce):b=="keyword a"?k(Z("form"),Ke,_e,ce):b=="keyword b"?k(Z("form"),_e,ce):b=="keyword d"?H.stream.match(/^\s*$/,!1)?k():k(Z("stat"),Pt,ke(";"),ce):b=="debugger"?k(ke(";")):b=="{"?k(Z("}"),oe,Qt,ce,Te):b==";"?k():b=="if"?(H.state.lexical.info=="else"&&H.state.cc[H.state.cc.length-1]==ce&&H.state.cc.pop()(),k(Z("form"),Ke,_e,ce,Sr)):b=="function"?k(en):b=="for"?k(Z("form"),oe,ra,_e,Te,ce):b=="class"||S&&T=="interface"?(H.marked="keyword",k(Z("form",b=="class"?b:T),Cr,ce)):b=="variable"?S&&T=="declare"?(H.marked="keyword",k(_e)):S&&(T=="module"||T=="enum"||T=="type")&&H.stream.match(/^\s*\w/,!1)?(H.marked="keyword",T=="enum"?k(fe):T=="type"?k(ia,ke("operator"),Pe,ke(";")):k(Z("form"),At,ke("{"),Z("}"),Qt,ce,ce)):S&&T=="namespace"?(H.marked="keyword",k(Z("form"),we,_e,ce)):S&&T=="abstract"?(H.marked="keyword",k(_e)):k(Z("stat"),wr):b=="switch"?k(Z("form"),Ke,ke("{"),Z("}","switch"),oe,Qt,ce,ce,Te):b=="case"?k(we,ke(":")):b=="default"?k(ke(":")):b=="catch"?k(Z("form"),w,ft,_e,ce,Te):b=="export"?k(Z("stat"),Tr,ce):b=="import"?k(Z("stat"),Pn,ce):b=="async"?k(_e):T=="@"?k(we,_e):Q(Z("stat"),we,ke(";"),ce)}function ft(b){if(b=="(")return k(sn,ke(")"))}function we(b,T){return ct(b,T,!1)}function Me(b,T){return ct(b,T,!0)}function Ke(b){return b!="("?Q():k(Z(")"),Pt,ke(")"),ce)}function ct(b,T,j){if(H.state.fatArrowAt==H.stream.start){var Y=j?kt:be;if(b=="(")return k(w,Z(")"),De(sn,")"),ce,ke("=>"),Y,Te);if(b=="variable")return Q(w,At,ke("=>"),Y,Te)}var P=j?dt:ht;return Oe.hasOwnProperty(b)?k(P):b=="function"?k(en,P):b=="class"||S&&T=="interface"?(H.marked="keyword",k(Z("form"),hs,ce)):b=="keyword c"||b=="async"?k(j?Me:we):b=="("?k(Z(")"),Pt,ke(")"),ce,P):b=="operator"||b=="spread"?k(j?Me:we):b=="["?k(Z("]"),nt,ce,P):b=="{"?zt(xe,"}",null,P):b=="quasi"?Q(gt,P):b=="new"?k(Gt(j)):k()}function Pt(b){return b.match(/[;\}\)\],]/)?Q():Q(we)}function ht(b,T){return b==","?k(Pt):dt(b,T,!1)}function dt(b,T,j){var Y=j==!1?ht:dt,P=j==!1?we:Me;if(b=="=>")return k(w,j?kt:be,Te);if(b=="operator")return/\+\+|--/.test(T)||S&&T=="!"?k(Y):S&&T=="<"&&H.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?k(Z(">"),De(Pe,">"),ce,Y):T=="?"?k(we,ke(":"),P):k(P);if(b=="quasi")return Q(gt,Y);if(b!=";"){if(b=="(")return zt(Me,")","call",Y);if(b==".")return k(ye,Y);if(b=="[")return k(Z("]"),Pt,ke("]"),ce,Y);if(S&&T=="as")return H.marked="keyword",k(Pe,Y);if(b=="regexp")return H.state.lastType=H.marked="operator",H.stream.backUp(H.stream.pos-H.stream.start-1),k(P)}}function gt(b,T){return b!="quasi"?Q():T.slice(T.length-2)!="${"?k(gt):k(Pt,qt)}function qt(b){if(b=="}")return H.marked="string-2",H.state.tokenize=ue,k(gt)}function be(b){return he(H.stream,H.state),Q(b=="{"?_e:we)}function kt(b){return he(H.stream,H.state),Q(b=="{"?_e:Me)}function Gt(b){return function(T){return T=="."?k(b?Zn:In):T=="variable"&&S?k($t,b?dt:ht):Q(b?Me:we)}}function In(b,T){if(T=="target")return H.marked="keyword",k(ht)}function Zn(b,T){if(T=="target")return H.marked="keyword",k(dt)}function wr(b){return b==":"?k(ce,_e):Q(ht,ke(";"),ce)}function ye(b){if(b=="variable")return H.marked="property",k()}function xe(b,T){if(b=="async")return H.marked="property",k(xe);if(b=="variable"||H.style=="keyword"){if(H.marked="property",T=="get"||T=="set")return k(pe);var j;return S&&H.state.fatArrowAt==H.stream.start&&(j=H.stream.match(/^\s*:\s*/,!1))&&(H.state.fatArrowAt=H.stream.pos+j[0].length),k(Fe)}else{if(b=="number"||b=="string")return H.marked=y?"property":H.style+" property",k(Fe);if(b=="jsonld-keyword")return k(Fe);if(S&&R(T))return H.marked="keyword",k(xe);if(b=="[")return k(we,On,ke("]"),Fe);if(b=="spread")return k(Me,Fe);if(T=="*")return H.marked="keyword",k(xe);if(b==":")return Q(Fe)}}function pe(b){return b!="variable"?Q(Fe):(H.marked="property",k(en))}function Fe(b){if(b==":")return k(Me);if(b=="(")return Q(en)}function De(b,T,j){function Y(P,re){if(j?j.indexOf(P)>-1:P==","){var $e=H.state.lexical;return $e.info=="call"&&($e.pos=($e.pos||0)+1),k(function(mt,It){return mt==T||It==T?Q():Q(b)},Y)}return P==T||re==T?k():j&&j.indexOf(";")>-1?Q(b):k(ke(T))}return function(P,re){return P==T||re==T?k():Q(b,Y)}}function zt(b,T,j){for(var Y=3;Y<arguments.length;Y++)H.cc.push(arguments[Y]);return k(Z(T,j),De(b,T),ce)}function Qt(b){return b=="}"?k():Q(_e,Qt)}function On(b,T){if(S){if(b==":")return k(Pe);if(T=="?")return k(On)}}function er(b,T){if(S&&(b==":"||T=="in"))return k(Pe)}function Nn(b){if(S&&b==":")return H.stream.match(/^\s*\w+\s+is\b/,!1)?k(we,fs,Pe):k(Pe)}function fs(b,T){if(T=="is")return H.marked="keyword",k()}function Pe(b,T){if(T=="keyof"||T=="typeof"||T=="infer"||T=="readonly")return H.marked="keyword",k(T=="typeof"?Me:Pe);if(b=="variable"||T=="void")return H.marked="type",k(Zt);if(T=="|"||T=="&")return k(Pe);if(b=="string"||b=="number"||b=="atom")return k(Zt);if(b=="[")return k(Z("]"),De(Pe,"]",","),ce,Zt);if(b=="{")return k(Z("}"),me,ce,Zt);if(b=="(")return k(De(tt,")"),na,Zt);if(b=="<")return k(De(Pe,">"),Pe);if(b=="quasi")return Q(Ct,Zt)}function na(b){if(b=="=>")return k(Pe)}function me(b){return b.match(/[\}\)\]]/)?k():b==","||b==";"?k(me):Q(kn,me)}function kn(b,T){if(b=="variable"||H.style=="keyword")return H.marked="property",k(kn);if(T=="?"||b=="number"||b=="string")return k(kn);if(b==":")return k(Pe);if(b=="[")return k(ke("variable"),er,ke("]"),kn);if(b=="(")return Q(Fn,kn);if(!b.match(/[;\}\)\],]/))return k()}function Ct(b,T){return b!="quasi"?Q():T.slice(T.length-2)!="${"?k(Ct):k(Pe,et)}function et(b){if(b=="}")return H.marked="string-2",H.state.tokenize=ue,k(Ct)}function tt(b,T){return b=="variable"&&H.stream.match(/^\s*[?:]/,!1)||T=="?"?k(tt):b==":"?k(Pe):b=="spread"?k(tt):Q(Pe)}function Zt(b,T){if(T=="<")return k(Z(">"),De(Pe,">"),ce,Zt);if(T=="|"||b=="."||T=="&")return k(Pe);if(b=="[")return k(Pe,ke("]"),Zt);if(T=="extends"||T=="implements")return H.marked="keyword",k(Pe);if(T=="?")return k(Pe,ke(":"),Pe)}function $t(b,T){if(T=="<")return k(Z(">"),De(Pe,">"),ce,Zt)}function rn(){return Q(Pe,Tt)}function Tt(b,T){if(T=="=")return k(Pe)}function kr(b,T){return T=="enum"?(H.marked="keyword",k(fe)):Q(At,On,an,cs)}function At(b,T){if(S&&R(T))return H.marked="keyword",k(At);if(b=="variable")return G(T),k();if(b=="spread")return k(At);if(b=="[")return zt(li,"]");if(b=="{")return zt(Mn,"}")}function Mn(b,T){return b=="variable"&&!H.stream.match(/^\s*:/,!1)?(G(T),k(an)):(b=="variable"&&(H.marked="property"),b=="spread"?k(At):b=="}"?Q():b=="["?k(we,ke("]"),ke(":"),Mn):k(ke(":"),At,an))}function li(){return Q(At,an)}function an(b,T){if(T=="=")return k(Me)}function cs(b){if(b==",")return k(kr)}function Sr(b,T){if(b=="keyword b"&&T=="else")return k(Z("form","else"),_e,ce)}function ra(b,T){if(T=="await")return k(ra);if(b=="(")return k(Z(")"),ui,ce)}function ui(b){return b=="var"?k(kr,Rn):b=="variable"?k(Rn):Q(Rn)}function Rn(b,T){return b==")"?k():b==";"?k(Rn):T=="in"||T=="of"?(H.marked="keyword",k(we,Rn)):Q(we,Rn)}function en(b,T){if(T=="*")return H.marked="keyword",k(en);if(b=="variable")return G(T),k(en);if(b=="(")return k(w,Z(")"),De(sn,")"),ce,Nn,_e,Te);if(S&&T=="<")return k(Z(">"),De(rn,">"),ce,en)}function Fn(b,T){if(T=="*")return H.marked="keyword",k(Fn);if(b=="variable")return G(T),k(Fn);if(b=="(")return k(w,Z(")"),De(sn,")"),ce,Nn,Te);if(S&&T=="<")return k(Z(">"),De(rn,">"),ce,Fn)}function ia(b,T){if(b=="keyword"||b=="variable")return H.marked="type",k(ia);if(T=="<")return k(Z(">"),De(rn,">"),ce)}function sn(b,T){return T=="@"&&k(we,sn),b=="spread"?k(sn):S&&R(T)?(H.marked="keyword",k(sn)):S&&b=="this"?k(On,an):Q(At,On,an)}function hs(b,T){return b=="variable"?Cr(b,T):on(b,T)}function Cr(b,T){if(b=="variable")return G(T),k(on)}function on(b,T){if(T=="<")return k(Z(">"),De(rn,">"),ce,on);if(T=="extends"||T=="implements"||S&&b==",")return T=="implements"&&(H.marked="keyword"),k(S?Pe:we,on);if(b=="{")return k(Z("}"),ln,ce)}function ln(b,T){if(b=="async"||b=="variable"&&(T=="static"||T=="get"||T=="set"||S&&R(T))&&H.stream.match(/^\s+#?[\w$\xa1-\uffff]/,!1))return H.marked="keyword",k(ln);if(b=="variable"||H.style=="keyword")return H.marked="property",k(tr,ln);if(b=="number"||b=="string")return k(tr,ln);if(b=="[")return k(we,On,ke("]"),tr,ln);if(T=="*")return H.marked="keyword",k(ln);if(S&&b=="(")return Q(Fn,ln);if(b==";"||b==",")return k(ln);if(b=="}")return k();if(T=="@")return k(we,ln)}function tr(b,T){if(T=="!"||T=="?")return k(tr);if(b==":")return k(Pe,an);if(T=="=")return k(Me);var j=H.state.lexical.prev,Y=j&&j.info=="interface";return Q(Y?Fn:en)}function Tr(b,T){return T=="*"?(H.marked="keyword",k(Er,ke(";"))):T=="default"?(H.marked="keyword",k(we,ke(";"))):b=="{"?k(De(_r,"}"),Er,ke(";")):Q(_e)}function _r(b,T){if(T=="as")return H.marked="keyword",k(ke("variable"));if(b=="variable")return Q(Me,_r)}function Pn(b){return b=="string"?k():b=="("?Q(we):b=="."?Q(ht):Q(Lr,gn,Er)}function Lr(b,T){return b=="{"?zt(Lr,"}"):(b=="variable"&&G(T),T=="*"&&(H.marked="keyword"),k(fi))}function gn(b){if(b==",")return k(Lr,gn)}function fi(b,T){if(T=="as")return H.marked="keyword",k(Lr)}function Er(b,T){if(T=="from")return H.marked="keyword",k(we)}function nt(b){return b=="]"?k():Q(De(Me,"]"))}function fe(){return Q(Z("form"),At,ke("{"),Z("}"),De(Sn,"}"),ce,ce)}function Sn(){return Q(At,an)}function ci(b,T){return b.lastType=="operator"||b.lastType==","||W.test(T.charAt(0))||/[,.]/.test(T.charAt(0))}function Kt(b,T,j){return T.tokenize==$&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(T.lastType)||T.lastType=="quasi"&&/\{\s*$/.test(b.string.slice(0,b.pos-(j||0)))}return{startState:function(b){var T={tokenize:$,lastType:"sof",cc:[],lexical:new Re((b||0)-d,0,"block",!1),localVars:f.localVars,context:f.localVars&&new K(null,null,!1),indented:b||0};return f.globalVars&&typeof f.globalVars=="object"&&(T.globalVars=f.globalVars),T},token:function(b,T){if(b.sol()&&(T.lexical.hasOwnProperty("align")||(T.lexical.align=!1),T.indented=b.indentation(),he(b,T)),T.tokenize!=ne&&b.eatSpace())return null;var j=T.tokenize(b,T);return F=="comment"?j:(T.lastType=F=="operator"&&(N=="++"||N=="--")?"incdec":F,ze(T,j,F,N,b))},indent:function(b,T){if(b.tokenize==ne||b.tokenize==ue)return a.Pass;if(b.tokenize!=$)return 0;var j=T&&T.charAt(0),Y=b.lexical,P;if(!/^\s*else\b/.test(T))for(var re=b.cc.length-1;re>=0;--re){var $e=b.cc[re];if($e==ce)Y=Y.prev;else if($e!=Sr&&$e!=Te)break}for(;(Y.type=="stat"||Y.type=="form")&&(j=="}"||(P=b.cc[b.cc.length-1])&&(P==ht||P==dt)&&!/^[,\.=+\-*:?[\(]/.test(T));)Y=Y.prev;p&&Y.type==")"&&Y.prev.type=="stat"&&(Y=Y.prev);var mt=Y.type,It=j==mt;return mt=="vardef"?Y.indented+(b.lastType=="operator"||b.lastType==","?Y.info.length+1:0):mt=="form"&&j=="{"?Y.indented:mt=="form"?Y.indented+d:mt=="stat"?Y.indented+(ci(b,T)?p||d:0):Y.info=="switch"&&!It&&f.doubleIndentSwitch!=!1?Y.indented+(/^(?:case|default)\b/.test(T)?d:2*d):Y.align?Y.column+(It?0:1):Y.indented+(It?0:d)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:m?null:"/*",blockCommentEnd:m?null:"*/",blockCommentContinue:m?null:" * ",lineComment:m?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:m?"json":"javascript",jsonldMode:y,jsonMode:m,expressionAllowed:Kt,skipExpression:function(b){ze(b,"atom","atom","true",new a.StringStream("",2,null))}}}),a.registerHelper("wordChars","javascript",/[\w$]/),a.defineMIME("text/javascript","javascript"),a.defineMIME("text/ecmascript","javascript"),a.defineMIME("application/javascript","javascript"),a.defineMIME("application/x-javascript","javascript"),a.defineMIME("application/ecmascript","javascript"),a.defineMIME("application/json",{name:"javascript",json:!0}),a.defineMIME("application/x-json",{name:"javascript",json:!0}),a.defineMIME("application/manifest+json",{name:"javascript",json:!0}),a.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),a.defineMIME("text/typescript",{name:"javascript",typescript:!0}),a.defineMIME("application/typescript",{name:"javascript",typescript:!0})})})(),function(u,n){(function(a){a(Wt())})(function(a){var o={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},f=a.Pos;a.defineOption("autoCloseBrackets",!1,function(N,O,$){$&&$!=a.Init&&(N.removeKeyMap(p),N.state.closeBrackets=null),O&&(y(d(O,"pairs")),N.state.closeBrackets=O,N.addKeyMap(p))});function d(N,O){return O=="pairs"&&typeof N=="string"?N:typeof N=="object"&&N[O]!=null?N[O]:o[O]}var p={Backspace:S,Enter:A};function y(N){for(var O=0;O<N.length;O++){var $=N.charAt(O),X="'"+$+"'";p[X]||(p[X]=m($))}}y(o.pairs+"`");function m(N){return function(O){return B(O,N)}}function x(N){var O=N.state.closeBrackets;if(!O||O.override)return O;var $=N.getModeAt(N.getCursor());return $.closeBrackets||O}function S(N){var O=x(N);if(!O||N.getOption("disableInput"))return a.Pass;for(var $=d(O,"pairs"),X=N.listSelections(),ne=0;ne<X.length;ne++){if(!X[ne].empty())return a.Pass;var ue=q(N,X[ne].head);if(!ue||$.indexOf(ue)%2!=0)return a.Pass}for(var ne=X.length-1;ne>=0;ne--){var se=X[ne].head;N.replaceRange("",f(se.line,se.ch-1),f(se.line,se.ch+1),"+delete")}}function A(N){var O=x(N),$=O&&d(O,"explode");if(!$||N.getOption("disableInput"))return a.Pass;for(var X=N.listSelections(),ne=0;ne<X.length;ne++){if(!X[ne].empty())return a.Pass;var ue=q(N,X[ne].head);if(!ue||$.indexOf(ue)%2!=0)return a.Pass}N.operation(function(){var se=N.lineSeparator()||`
25
- `;N.replaceSelection(se+se,null),E(N,-1),X=N.listSelections();for(var he=0;he<X.length;he++){var Oe=X[he].head.line;N.indentLine(Oe,null,!0),N.indentLine(Oe+1,null,!0)}})}function E(N,O){for(var $=[],X=N.listSelections(),ne=0,ue=0;ue<X.length;ue++){var se=X[ue];se.head==N.getCursor()&&(ne=ue);var he=se.head.ch||O>0?{line:se.head.line,ch:se.head.ch+O}:{line:se.head.line-1};$.push({anchor:he,head:he})}N.setSelections($,ne)}function W(N){var O=a.cmpPos(N.anchor,N.head)>0;return{anchor:new f(N.anchor.line,N.anchor.ch+(O?-1:1)),head:new f(N.head.line,N.head.ch+(O?1:-1))}}function B(N,O){var $=x(N);if(!$||N.getOption("disableInput"))return a.Pass;var X=d($,"pairs"),ne=X.indexOf(O);if(ne==-1)return a.Pass;for(var ue=d($,"closeBefore"),se=d($,"triples"),he=X.charAt(ne+1)==O,Oe=N.listSelections(),Re=ne%2==0,ie,ze=0;ze<Oe.length;ze++){var H=Oe[ze],Q=H.head,k,J=N.getRange(Q,f(Q.line,Q.ch+1));if(Re&&!H.empty())k="surround";else if((he||!Re)&&J==O)he&&F(N,Q)?k="both":se.indexOf(O)>=0&&N.getRange(Q,f(Q.line,Q.ch+3))==O+O+O?k="skipThree":k="skip";else if(he&&Q.ch>1&&se.indexOf(O)>=0&&N.getRange(f(Q.line,Q.ch-2),Q)==O+O){if(Q.ch>2&&/\bstring/.test(N.getTokenTypeAt(f(Q.line,Q.ch-2))))return a.Pass;k="addFour"}else if(he){var G=Q.ch==0?" ":N.getRange(f(Q.line,Q.ch-1),Q);if(!a.isWordChar(J)&&G!=O&&!a.isWordChar(G))k="both";else return a.Pass}else if(Re&&(J.length===0||/\s/.test(J)||ue.indexOf(J)>-1))k="both";else return a.Pass;if(!ie)ie=k;else if(ie!=k)return a.Pass}var D=ne%2?X.charAt(ne-1):O,R=ne%2?O:X.charAt(ne+1);N.operation(function(){if(ie=="skip")E(N,1);else if(ie=="skipThree")E(N,3);else if(ie=="surround"){for(var K=N.getSelections(),de=0;de<K.length;de++)K[de]=D+K[de]+R;N.replaceSelections(K,"around"),K=N.listSelections().slice();for(var de=0;de<K.length;de++)K[de]=W(K[de]);N.setSelections(K)}else ie=="both"?(N.replaceSelection(D+R,null),N.triggerElectric(D+R),E(N,-1)):ie=="addFour"&&(N.replaceSelection(D+D+D+D,"before"),E(N,1))})}function q(N,O){var $=N.getRange(f(O.line,O.ch-1),f(O.line,O.ch+1));return $.length==2?$:null}function F(N,O){var $=N.getTokenAt(f(O.line,O.ch+1));return/\bstring/.test($.type)&&$.start==O.ch&&(O.ch==0||!/\bstring/.test(N.getTokenTypeAt(O)))}})}(),function(u,n){(function(a){a(Wt())})(function(a){var o=/MSIE \d/.test(navigator.userAgent)&&(document.documentMode==null||document.documentMode<8),f=a.Pos,d={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function p(E){return E&&E.bracketRegex||/[(){}[\]]/}function y(E,W,B){var q=E.getLineHandle(W.line),F=W.ch-1,N=B&&B.afterCursor;N==null&&(N=/(^| )cm-fat-cursor($| )/.test(E.getWrapperElement().className));var O=p(B),$=!N&&F>=0&&O.test(q.text.charAt(F))&&d[q.text.charAt(F)]||O.test(q.text.charAt(F+1))&&d[q.text.charAt(++F)];if(!$)return null;var X=$.charAt(1)==">"?1:-1;if(B&&B.strict&&X>0!=(F==W.ch))return null;var ne=E.getTokenTypeAt(f(W.line,F+1)),ue=m(E,f(W.line,F+(X>0?1:0)),X,ne,B);return ue==null?null:{from:f(W.line,F),to:ue&&ue.pos,match:ue&&ue.ch==$.charAt(0),forward:X>0}}function m(E,W,B,q,F){for(var N=F&&F.maxScanLineLength||1e4,O=F&&F.maxScanLines||1e3,$=[],X=p(F),ne=B>0?Math.min(W.line+O,E.lastLine()+1):Math.max(E.firstLine()-1,W.line-O),ue=W.line;ue!=ne;ue+=B){var se=E.getLine(ue);if(se){var he=B>0?0:se.length-1,Oe=B>0?se.length:-1;if(!(se.length>N))for(ue==W.line&&(he=W.ch-(B<0?1:0));he!=Oe;he+=B){var Re=se.charAt(he);if(X.test(Re)&&(q===void 0||(E.getTokenTypeAt(f(ue,he+1))||"")==(q||""))){var ie=d[Re];if(ie&&ie.charAt(1)==">"==B>0)$.push(Re);else if($.length)$.pop();else return{pos:f(ue,he),ch:Re}}}}}return ue-B==(B>0?E.lastLine():E.firstLine())?!1:null}function x(E,W,B){for(var q=E.state.matchBrackets.maxHighlightLineLength||1e3,F=B&&B.highlightNonMatching,N=[],O=E.listSelections(),$=0;$<O.length;$++){var X=O[$].empty()&&y(E,O[$].head,B);if(X&&(X.match||F!==!1)&&E.getLine(X.from.line).length<=q){var ne=X.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";N.push(E.markText(X.from,f(X.from.line,X.from.ch+1),{className:ne})),X.to&&E.getLine(X.to.line).length<=q&&N.push(E.markText(X.to,f(X.to.line,X.to.ch+1),{className:ne}))}}if(N.length){o&&E.state.focused&&E.focus();var ue=function(){E.operation(function(){for(var se=0;se<N.length;se++)N[se].clear()})};if(W)setTimeout(ue,800);else return ue}}function S(E){E.operation(function(){E.state.matchBrackets.currentlyHighlighted&&(E.state.matchBrackets.currentlyHighlighted(),E.state.matchBrackets.currentlyHighlighted=null),E.state.matchBrackets.currentlyHighlighted=x(E,!1,E.state.matchBrackets)})}function A(E){E.state.matchBrackets&&E.state.matchBrackets.currentlyHighlighted&&(E.state.matchBrackets.currentlyHighlighted(),E.state.matchBrackets.currentlyHighlighted=null)}a.defineOption("matchBrackets",!1,function(E,W,B){B&&B!=a.Init&&(E.off("cursorActivity",S),E.off("focus",S),E.off("blur",A),A(E)),W&&(E.state.matchBrackets=typeof W=="object"?W:{},E.on("cursorActivity",S),E.on("focus",S),E.on("blur",A))}),a.defineExtension("matchBrackets",function(){x(this,!0)}),a.defineExtension("findMatchingBracket",function(E,W,B){return(B||typeof W=="boolean")&&(B?(B.strict=W,W=B):W=W?{strict:!0}:null),y(this,E,W)}),a.defineExtension("scanForBracket",function(E,W,B,q){return m(this,E,W,B,q)})})}();var Xf={exports:{}};(function(u,n){(function(a){a(Wt())})(function(a){function o(y,m,x,S){if(x&&x.call){var A=x;x=null}else var A=p(y,x,"rangeFinder");typeof m=="number"&&(m=a.Pos(m,0));var E=p(y,x,"minFoldSize");function W(N){var O=A(y,m);if(!O||O.to.line-O.from.line<E)return null;if(S==="fold")return O;for(var $=y.findMarksAt(O.from),X=0;X<$.length;++X)if($[X].__isFold){if(!N)return null;O.cleared=!0,$[X].clear()}return O}var B=W(!0);if(p(y,x,"scanUp"))for(;!B&&m.line>y.firstLine();)m=a.Pos(m.line-1,0),B=W(!1);if(!(!B||B.cleared||S==="unfold")){var q=f(y,x,B);a.on(q,"mousedown",function(N){F.clear(),a.e_preventDefault(N)});var F=y.markText(B.from,B.to,{replacedWith:q,clearOnEnter:p(y,x,"clearOnEnter"),__isFold:!0});F.on("clear",function(N,O){a.signal(y,"unfold",y,N,O)}),a.signal(y,"fold",y,B.from,B.to)}}function f(y,m,x){var S=p(y,m,"widget");if(typeof S=="function"&&(S=S(x.from,x.to)),typeof S=="string"){var A=document.createTextNode(S);S=document.createElement("span"),S.appendChild(A),S.className="CodeMirror-foldmarker"}else S&&(S=S.cloneNode(!0));return S}a.newFoldFunction=function(y,m){return function(x,S){o(x,S,{rangeFinder:y,widget:m})}},a.defineExtension("foldCode",function(y,m,x){o(this,y,m,x)}),a.defineExtension("isFolded",function(y){for(var m=this.findMarksAt(y),x=0;x<m.length;++x)if(m[x].__isFold)return!0}),a.commands.toggleFold=function(y){y.foldCode(y.getCursor())},a.commands.fold=function(y){y.foldCode(y.getCursor(),null,"fold")},a.commands.unfold=function(y){y.foldCode(y.getCursor(),{scanUp:!1},"unfold")},a.commands.foldAll=function(y){y.operation(function(){for(var m=y.firstLine(),x=y.lastLine();m<=x;m++)y.foldCode(a.Pos(m,0),{scanUp:!1},"fold")})},a.commands.unfoldAll=function(y){y.operation(function(){for(var m=y.firstLine(),x=y.lastLine();m<=x;m++)y.foldCode(a.Pos(m,0),{scanUp:!1},"unfold")})},a.registerHelper("fold","combine",function(){var y=Array.prototype.slice.call(arguments,0);return function(m,x){for(var S=0;S<y.length;++S){var A=y[S](m,x);if(A)return A}}}),a.registerHelper("fold","auto",function(y,m){for(var x=y.getHelpers(m,"fold"),S=0;S<x.length;S++){var A=x[S](y,m);if(A)return A}});var d={rangeFinder:a.fold.auto,widget:"↔",minFoldSize:0,scanUp:!1,clearOnEnter:!0};a.defineOption("foldOptions",null);function p(y,m,x){if(m&&m[x]!==void 0)return m[x];var S=y.options.foldOptions;return S&&S[x]!==void 0?S[x]:d[x]}a.defineExtension("foldOption",function(y,m){return p(this,y,m)})})})();var Yf=Xf.exports;(function(u,n){(function(a){a(Wt(),Yf)})(function(a){a.defineOption("foldGutter",!1,function(F,N,O){O&&O!=a.Init&&(F.clearGutter(F.state.foldGutter.options.gutter),F.state.foldGutter=null,F.off("gutterClick",A),F.off("changes",W),F.off("viewportChange",B),F.off("fold",q),F.off("unfold",q),F.off("swapDoc",W),F.off("optionChange",E)),N&&(F.state.foldGutter=new f(d(N)),S(F),F.on("gutterClick",A),F.on("changes",W),F.on("viewportChange",B),F.on("fold",q),F.on("unfold",q),F.on("swapDoc",W),F.on("optionChange",E))});var o=a.Pos;function f(F){this.options=F,this.from=this.to=0}function d(F){return F===!0&&(F={}),F.gutter==null&&(F.gutter="CodeMirror-foldgutter"),F.indicatorOpen==null&&(F.indicatorOpen="CodeMirror-foldgutter-open"),F.indicatorFolded==null&&(F.indicatorFolded="CodeMirror-foldgutter-folded"),F}function p(F,N){for(var O=F.findMarks(o(N,0),o(N+1,0)),$=0;$<O.length;++$)if(O[$].__isFold){var X=O[$].find(-1);if(X&&X.line===N)return O[$]}}function y(F){if(typeof F=="string"){var N=document.createElement("div");return N.className=F+" CodeMirror-guttermarker-subtle",N}else return F.cloneNode(!0)}function m(F,N,O){var $=F.state.foldGutter.options,X=N-1,ne=F.foldOption($,"minFoldSize"),ue=F.foldOption($,"rangeFinder"),se=typeof $.indicatorFolded=="string"&&x($.indicatorFolded),he=typeof $.indicatorOpen=="string"&&x($.indicatorOpen);F.eachLine(N,O,function(Oe){++X;var Re=null,ie=Oe.gutterMarkers;if(ie&&(ie=ie[$.gutter]),p(F,X)){if(se&&ie&&se.test(ie.className))return;Re=y($.indicatorFolded)}else{var ze=o(X,0),H=ue&&ue(F,ze);if(H&&H.to.line-H.from.line>=ne){if(he&&ie&&he.test(ie.className))return;Re=y($.indicatorOpen)}}!Re&&!ie||F.setGutterMarker(Oe,$.gutter,Re)})}function x(F){return new RegExp("(^|\\s)"+F+"(?:$|\\s)\\s*")}function S(F){var N=F.getViewport(),O=F.state.foldGutter;O&&(F.operation(function(){m(F,N.from,N.to)}),O.from=N.from,O.to=N.to)}function A(F,N,O){var $=F.state.foldGutter;if($){var X=$.options;if(O==X.gutter){var ne=p(F,N);ne?ne.clear():F.foldCode(o(N,0),X)}}}function E(F,N){N=="mode"&&W(F)}function W(F){var N=F.state.foldGutter;if(N){var O=N.options;N.from=N.to=0,clearTimeout(N.changeUpdate),N.changeUpdate=setTimeout(function(){S(F)},O.foldOnChangeTimeSpan||600)}}function B(F){var N=F.state.foldGutter;if(N){var O=N.options;clearTimeout(N.changeUpdate),N.changeUpdate=setTimeout(function(){var $=F.getViewport();N.from==N.to||$.from-N.to>20||N.from-$.to>20?S(F):F.operation(function(){$.from<N.from&&(m(F,$.from,N.from),N.from=$.from),$.to>N.to&&(m(F,N.to,$.to),N.to=$.to)})},O.updateViewportTimeSpan||400)}}function q(F,N){var O=F.state.foldGutter;if(O){var $=N.line;$>=O.from&&$<O.to&&m(F,$,$+1)}}})})(),function(u,n){(function(a){a(Wt())})(function(a){function o(f){return function(d,p){var y=p.line,m=d.getLine(y);function x(q){for(var F,N=p.ch,O=0;;){var $=N<=0?-1:m.lastIndexOf(q[0],N-1);if($==-1){if(O==1)break;O=1,N=m.length;continue}if(O==1&&$<p.ch)break;if(F=d.getTokenTypeAt(a.Pos(y,$+1)),!/^(comment|string)/.test(F))return{ch:$+1,tokenType:F,pair:q};N=$-1}}function S(q){var F=1,N=d.lastLine(),O,$=q.ch,X;e:for(var ne=y;ne<=N;++ne)for(var ue=d.getLine(ne),se=ne==y?$:0;;){var he=ue.indexOf(q.pair[0],se),Oe=ue.indexOf(q.pair[1],se);if(he<0&&(he=ue.length),Oe<0&&(Oe=ue.length),se=Math.min(he,Oe),se==ue.length)break;if(d.getTokenTypeAt(a.Pos(ne,se+1))==q.tokenType){if(se==he)++F;else if(!--F){O=ne,X=se;break e}}++se}return O==null||y==O?null:{from:a.Pos(y,$),to:a.Pos(O,X)}}for(var A=[],E=0;E<f.length;E++){var W=x(f[E]);W&&A.push(W)}A.sort(function(q,F){return q.ch-F.ch});for(var E=0;E<A.length;E++){var B=S(A[E]);if(B)return B}return null}}a.registerHelper("fold","brace",o([["{","}"],["[","]"]])),a.registerHelper("fold","brace-paren",o([["{","}"],["[","]"],["(",")"]])),a.registerHelper("fold","import",function(f,d){function p(E){if(E<f.firstLine()||E>f.lastLine())return null;var W=f.getTokenAt(a.Pos(E,1));if(/\S/.test(W.string)||(W=f.getTokenAt(a.Pos(E,W.end+1))),W.type!="keyword"||W.string!="import")return null;for(var B=E,q=Math.min(f.lastLine(),E+10);B<=q;++B){var F=f.getLine(B),N=F.indexOf(";");if(N!=-1)return{startCh:W.end,end:a.Pos(B,N)}}}var y=d.line,m=p(y),x;if(!m||p(y-1)||(x=p(y-2))&&x.end.line==y-1)return null;for(var S=m.end;;){var A=p(S.line+1);if(A==null)break;S=A.end}return{from:f.clipPos(a.Pos(y,m.startCh+1)),to:S}}),a.registerHelper("fold","include",function(f,d){function p(A){if(A<f.firstLine()||A>f.lastLine())return null;var E=f.getTokenAt(a.Pos(A,1));if(/\S/.test(E.string)||(E=f.getTokenAt(a.Pos(A,E.end+1))),E.type=="meta"&&E.string.slice(0,8)=="#include")return E.start+8}var y=d.line,m=p(y);if(m==null||p(y-1)!=null)return null;for(var x=y;;){var S=p(x+1);if(S==null)break;++x}return{from:a.Pos(y,m+1),to:f.clipPos(a.Pos(x))}})})}(),function(u,n){(function(a){a(Wt())})(function(a){function o(f,d){var p=f.getLine(d),y=p.search(/\S/);return y==-1||/\bcomment\b/.test(f.getTokenTypeAt(a.Pos(d,y+1)))?-1:a.countColumn(p,null,f.getOption("tabSize"))}a.registerHelper("fold","indent",function(f,d){var p=o(f,d.line);if(!(p<0)){for(var y=null,m=d.line+1,x=f.lastLine();m<=x;++m){var S=o(f,m);if(S!=-1)if(S>p)y=m;else break}if(y)return{from:a.Pos(d.line,f.getLine(d.line).length),to:a.Pos(y,f.getLine(y).length)}}})})}(),function(u,n){(function(a){a(Wt())})(function(a){a.defineOption("autoRefresh",!1,function(d,p){d.state.autoRefresh&&(f(d,d.state.autoRefresh),d.state.autoRefresh=null),p&&d.display.wrapper.offsetHeight==0&&o(d,d.state.autoRefresh={delay:p.delay||250})});function o(d,p){function y(){d.display.wrapper.offsetHeight?(f(d,p),d.display.lastWrapHeight!=d.display.wrapper.clientHeight&&d.refresh()):p.timeout=setTimeout(y,p.delay)}p.timeout=setTimeout(y,p.delay),p.hurry=function(){clearTimeout(p.timeout),p.timeout=setTimeout(y,50)},a.on(window,"mouseup",p.hurry),a.on(window,"keyup",p.hurry)}function f(d,p){clearTimeout(p.timeout),a.off(window,"mouseup",p.hurry),a.off(window,"keyup",p.hurry)}})}();const uo=it.defineStore("trace",{state:()=>({traces:[],currentTrace:null}),getters:{getTraces:u=>u.traces,getCurrentTrace:u=>u.currentTrace},actions:{setTraces(u){this.traces=u},setCurrentTrace(u){this.currentTrace=u}}}),Vf=()=>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",Kn=Yt.create({baseURL:Vf(),timeout:36e5}),xn={getExperiments(){return Kn.post("/experiments/search").then(u=>u.data)},getTraceList(u,n,a,o,f,d){const p={};return u&&(p.query=u),n&&(p.startTime=n),a&&(p.endTime=a),o&&(p.pageNo=o),f&&(p.pageSize=f),d&&(p.experimentId=d),Kn.get("/v1/trace",{params:p}).then(y=>y.data)},getTraceDetail(u){return Kn.get(`/v1/trace/${u}`).then(n=>n.data)},getTraceSpans(u){return Kn.get(`/v1/trace/${u}/spans`).then(n=>n.data)},getSpanContent(u,n){return Kn.get(`/v1/trace/${u}/span/${n}/content`).then(a=>a.data)},deleteTraces(u,n,a,o){const f={};return u&&(f.query=u),n&&(f.startTime=n),a&&(f.endTime=a),o&&(f.experimentId=o),Kn.delete("/v1/trace",{params:f}).then(d=>d.data)},debugTrace(u,n={}){return Kn.post("/debug",u,{headers:n}).then(a=>a.data)}};var fo={exports:{}};(function(u,n){(function(a,o){u.exports=o(Wt())})(oo,function(a){return function(o){function f(p){if(d[p])return d[p].exports;var y=d[p]={i:p,l:!1,exports:{}};return o[p].call(y.exports,y,y.exports,f),y.l=!0,y.exports}var d={};return f.m=o,f.c=d,f.i=function(p){return p},f.d=function(p,y,m){f.o(p,y)||Object.defineProperty(p,y,{configurable:!1,enumerable:!0,get:m})},f.n=function(p){var y=p&&p.__esModule?function(){return p.default}:function(){return p};return f.d(y,"a",y),y},f.o=function(p,y){return Object.prototype.hasOwnProperty.call(p,y)},f.p="/",f(f.s=3)}([function(o,f){o.exports=a},function(o,f,d){Object.defineProperty(f,"__esModule",{value:!0});var p=d(0),y=function(x){return x&&x.__esModule?x:{default:x}}(p),m=window.CodeMirror||y.default;typeof Object.assign!="function"&&Object.defineProperty(Object,"assign",{value:function(x,S){if(x==null)throw new TypeError("Cannot convert undefined or null to object");for(var A=Object(x),E=1;E<arguments.length;E++){var W=arguments[E];if(W!=null)for(var B in W)Object.prototype.hasOwnProperty.call(W,B)&&(A[B]=W[B])}return A},writable:!0,configurable:!0}),f.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(x){for(var S in x)this.cminstance.setOption(S,x[S])}},merge:function(){this.$nextTick(this.switchMerge)},code:function(x){this.handerCodeChange(x)},value:function(x){this.handerCodeChange(x)}},methods:{initialize:function(){var x=this,S=Object.assign({},this.globalOptions,this.options);this.merge?(this.codemirror=m.MergeView(this.$refs.mergeview,S),this.cminstance=this.codemirror.edit):(this.codemirror=m.fromTextArea(this.$refs.textarea,S),this.cminstance=this.codemirror,this.cminstance.setValue(this.code||this.value||this.content)),this.cminstance.on("change",function(E){x.content=E.getValue(),x.$emit&&x.$emit("input",x.content)});var A={};["scroll","changes","beforeChange","cursorActivity","keyHandled","inputRead","electricInput","beforeSelectionChange","viewportChange","swapDoc","gutterClick","gutterContextMenu","focus","blur","refresh","optionChange","scrollCursorIntoView","update"].concat(this.events).concat(this.globalEvents).filter(function(E){return!A[E]&&(A[E]=!0)}).forEach(function(E){x.cminstance.on(E,function(){for(var W=arguments.length,B=Array(W),q=0;q<W;q++)B[q]=arguments[q];x.$emit.apply(x,[E].concat(B));var F=E.replace(/([A-Z])/g,"-$1").toLowerCase();F!==E&&x.$emit.apply(x,[F].concat(B))})}),this.$emit("ready",this.codemirror),this.unseenLineMarkers(),this.refresh()},refresh:function(){var x=this;this.$nextTick(function(){x.cminstance.refresh()})},destroy:function(){var x=this.cminstance.doc.cm.getWrapperElement();x&&x.remove&&x.remove()},handerCodeChange:function(x){if(x!==this.cminstance.getValue()){var S=this.cminstance.getScrollInfo();this.cminstance.setValue(x),this.content=x,this.cminstance.scrollTo(S.left,S.top)}this.unseenLineMarkers()},unseenLineMarkers:function(){var x=this;this.unseenLines!==void 0&&this.marker!==void 0&&this.unseenLines.forEach(function(S){var A=x.cminstance.lineInfo(S);x.cminstance.setGutterMarker(S,"breakpoints",A.gutterMarkers?null:x.marker())})},switchMerge:function(){var x=this.cminstance.doc.history,S=this.cminstance.doc.cleanGeneration;this.options.value=this.cminstance.getValue(),this.destroy(),this.initialize(),this.cminstance.doc.history=x,this.cminstance.doc.cleanGeneration=S}},mounted:function(){this.initialize()},beforeDestroy:function(){this.destroy()}}},function(o,f,d){Object.defineProperty(f,"__esModule",{value:!0});var p=d(1),y=d.n(p);for(var m in p)["default","default"].indexOf(m)<0&&function(E){d.d(f,E,function(){return p[E]})}(m);var x=d(5),S=d(4),A=S(y.a,x.a,!1,null,null,null);f.default=A.exports},function(o,f,d){function p(B){return B&&B.__esModule?B:{default:B}}Object.defineProperty(f,"__esModule",{value:!0}),f.install=f.codemirror=f.CodeMirror=void 0;var y=d(0),m=p(y),x=d(2),S=p(x),A=window.CodeMirror||m.default,E=function(B,q){q&&(q.options&&(S.default.props.globalOptions.default=function(){return q.options}),q.events&&(S.default.props.globalEvents.default=function(){return q.events})),B.component(S.default.name,S.default)},W={CodeMirror:A,codemirror:S.default,install:E};f.default=W,f.CodeMirror=A,f.codemirror=S.default,f.install=E},function(o,f){o.exports=function(d,p,y,m,x,S){var A,E=d=d||{},W=typeof d.default;W!=="object"&&W!=="function"||(A=d,E=d.default);var B=typeof E=="function"?E.options:E;p&&(B.render=p.render,B.staticRenderFns=p.staticRenderFns,B._compiled=!0),y&&(B.functional=!0),x&&(B._scopeId=x);var q;if(S?(q=function(O){O=O||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,O||typeof __VUE_SSR_CONTEXT__>"u"||(O=__VUE_SSR_CONTEXT__),m&&m.call(this,O),O&&O._registeredComponents&&O._registeredComponents.add(S)},B._ssrRegister=q):m&&(q=m),q){var F=B.functional,N=F?B.render:B.beforeCreate;F?(B._injectStyles=q,B.render=function(O,$){return q.call($),N(O,$)}):B.beforeCreate=N?[].concat(N,q):[q]}return{esModule:A,exports:E,options:B}}},function(o,f,d){var p=function(){var x=this,S=x.$createElement,A=x._self._c||S;return A("div",{staticClass:"vue-codemirror",class:{merge:x.merge}},[x.merge?A("div",{ref:"mergeview"}):A("textarea",{ref:"textarea",attrs:{name:x.name,placeholder:x.placeholder}})])},y=[],m={render:p,staticRenderFns:y};f.a=m}])})})(fo);var co=fo.exports;function Pa(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let Xn=Pa();function ho(u){Xn=u}const po=/[&<>"']/,Jf=new RegExp(po.source,"g"),go=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Qf=new RegExp(go.source,"g"),Zf={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},mo=u=>Zf[u];function jt(u,n){if(n){if(po.test(u))return u.replace(Jf,mo)}else if(go.test(u))return u.replace(Qf,mo);return u}const ec=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function tc(u){return u.replace(ec,(n,a)=>(a=a.toLowerCase(),a==="colon"?":":a.charAt(0)==="#"?a.charAt(1)==="x"?String.fromCharCode(parseInt(a.substring(2),16)):String.fromCharCode(+a.substring(1)):""))}const nc=/(^|[^\[])\^/g;function je(u,n){let a=typeof u=="string"?u:u.source;n=n||"";const o={replace:(f,d)=>{let p=typeof d=="string"?d:d.source;return p=p.replace(nc,"$1"),a=a.replace(f,p),o},getRegex:()=>new RegExp(a,n)};return o}function vo(u){try{u=encodeURI(u).replace(/%25/g,"%")}catch{return null}return u}const Yr={exec:()=>null};function yo(u,n){const a=u.replace(/\|/g,(d,p,y)=>{let m=!1,x=p;for(;--x>=0&&y[x]==="\\";)m=!m;return m?"|":" |"}),o=a.split(/ \|/);let f=0;if(o[0].trim()||o.shift(),o.length>0&&!o[o.length-1].trim()&&o.pop(),n)if(o.length>n)o.splice(n);else for(;o.length<n;)o.push("");for(;f<o.length;f++)o[f]=o[f].trim().replace(/\\\|/g,"|");return o}function $i(u,n,a){const o=u.length;if(o===0)return"";let f=0;for(;f<o&&u.charAt(o-f-1)===n;)f++;return u.slice(0,o-f)}function rc(u,n){if(u.indexOf(n[1])===-1)return-1;let a=0;for(let o=0;o<u.length;o++)if(u[o]==="\\")o++;else if(u[o]===n[0])a++;else if(u[o]===n[1]&&(a--,a<0))return o;return-1}function bo(u,n,a,o){const f=n.href,d=n.title?jt(n.title):null,p=u[1].replace(/\\([\[\]])/g,"$1");if(u[0].charAt(0)!=="!"){o.state.inLink=!0;const y={type:"link",raw:a,href:f,title:d,text:p,tokens:o.inlineTokens(p)};return o.state.inLink=!1,y}return{type:"image",raw:a,href:f,title:d,text:jt(p)}}function ic(u,n){const a=u.match(/^(\s+)(?:```)/);if(a===null)return n;const o=a[1];return n.split(`
24
+ outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var _;S&&(_=s.ownerDocument.defaultView.scrollY),r.input.focus(),S&&s.ownerDocument.defaultView.scrollTo(null,_),r.input.reset(),i.somethingSelected()||(s.value=t.prevInput=" "),t.contextMenuPending=I,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function M(){if(s.selectionStart!=null){var q=i.somethingSelected(),V="​"+(q?s.value:"");s.value="⇚",s.value=V,t.prevInput=q?"":"​",s.selectionStart=1,s.selectionEnd=V.length,r.selForContextMenu=i.doc.sel}}function I(){if(t.contextMenuPending==I&&(t.contextMenuPending=!1,t.wrapper.style.cssText=v,s.style.cssText=g,m&&x<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=c),s.selectionStart!=null)){(!m||m&&x<9)&&M();var q=0,V=function(){r.selForContextMenu==i.doc.sel&&s.selectionStart==0&&s.selectionEnd>0&&t.prevInput=="​"?yt(i,hf)(i):q++<10?r.detectingSelectAll=setTimeout(V,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(V,200)}}if(m&&x>=9&&M(),Re){Mn(e);var z=function(){Ct(window,"mouseup",z),setTimeout(I,20)};me(window,"mouseup",z)}else setTimeout(I,50)},st.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},st.prototype.setUneditable=function(){},st.prototype.needsContentAttribute=!1;function Km(e,t){if(t=t?ke(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 i=R(Te(e));t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=h.getValue()}var s;if(e.form&&(me(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var l=e.form;s=l.submit;try{var c=l.submit=function(){r(),l.submit=s,l.submit(),l.submit=c}}catch{}}t.finishInit=function(g){g.save=r,g.getTextArea=function(){return e},g.toTextArea=function(){g.toTextArea=isNaN,r(),e.parentNode.removeChild(g.getWrapperElement()),e.style.display="",e.form&&(Ct(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=s))}},e.style.display="none";var h=Ve(function(g){return e.parentNode.insertBefore(g,e.nextSibling)},t);return h}function Xm(e){e.off=Ct,e.on=me,e.wheelEventPixels=tm,e.Doc=Nt,e.splitLines=en,e.countColumn=_e,e.findColumn=dt,e.isWordChar=ye,e.Pass=Ke,e.signal=et,e.Line=Ar,e.changeEnd=Wn,e.scrollbarModel=Hu,e.Pos=P,e.cmpPos=re,e.modes=Cr,e.mimeModes=ln,e.resolveMode=Tr,e.getMode=_r,e.modeExtensions=Pn,e.extendMode=Lr,e.copyState=mn,e.startState=Er,e.innerMode=fi,e.commands=Mi,e.keyMap=En,e.keyName=Ef,e.isModifierKey=_f,e.lookupKey=jr,e.normalizeKeyMap=Sm,e.StringStream=nt,e.SharedTextMarker=Ii,e.TextMarker=qn,e.LineWidget=Ai,e.e_preventDefault=Tt,e.e_stopPropagation=kr,e.e_stop=Mn,e.addClass=K,e.contains=D,e.rmClass=ze,e.keyNames=Un}$m(Ve),jm(Ve);var Ym="iter insert remove copy getEditor constructor".split(" ");for(var Ma in Nt.prototype)Nt.prototype.hasOwnProperty(Ma)&&we(Ym,Ma)<0&&(Ve.prototype[Ma]=function(e){return function(){return e.apply(this.doc,arguments)}}(Nt.prototype[Ma]));return an(Nt),Ve.inputStyles={textarea:st,contenteditable:We},Ve.defineMode=function(e){!Ve.defaults.mode&&e!="null"&&(Ve.defaults.mode=e),un.apply(this,arguments)},Ve.defineMIME=tr,Ve.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Ve.defineMIME("text/plain","null"),Ve.defineExtension=function(e,t){Ve.prototype[e]=t},Ve.defineDocExtension=function(e,t){Nt.prototype[e]=t},Ve.fromTextArea=Km,Xm(Ve),Ve.version="5.65.20",Ve})}(Fa)),Fa.exports}(function(u,n){(function(a){a(Wt())})(function(a){a.defineMode("javascript",function(o,f){var d=o.indentUnit,p=f.statementIndent,y=f.jsonld,m=f.json||y,x=f.trackScope!==!1,S=f.typescript,A=f.wordCharacters||/[\w$\xa1-\uffff]/,E=function(){function b(mt){return{type:mt,style:"keyword"}}var T=b("keyword a"),j=b("keyword b"),Y=b("keyword c"),P=b("keyword d"),re=b("operator"),$e={type:"atom",style:"atom"};return{if:b("if"),while:T,with:T,else:j,do:j,try:j,finally:j,return:P,break:P,continue:P,new:b("new"),delete:Y,void:Y,throw:Y,debugger:b("debugger"),var:b("var"),const:b("var"),let:b("var"),function:b("function"),catch:b("catch"),for:b("for"),switch:b("switch"),case:b("case"),default:b("default"),in:re,typeof:re,instanceof:re,true:$e,false:$e,null:$e,undefined:$e,NaN:$e,Infinity:$e,this:b("this"),class:b("class"),super:b("atom"),yield:Y,export:b("export"),import:b("import"),extends:Y,await:Y}}(),H=/[+\-*&%=<>!?|~^@]/,B=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function U(b){for(var T=!1,j,Y=!1;(j=b.next())!=null;){if(!T){if(j=="/"&&!Y)return;j=="["?Y=!0:Y&&j=="]"&&(Y=!1)}T=!T&&j=="\\"}}var F,N;function O(b,T,j){return F=b,N=j,T}function $(b,T){var j=b.next();if(j=='"'||j=="'")return T.tokenize=X(j),T.tokenize(b,T);if(j=="."&&b.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return O("number","number");if(j=="."&&b.match(".."))return O("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(j))return O(j);if(j=="="&&b.eat(">"))return O("=>","operator");if(j=="0"&&b.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return O("number","number");if(/\d/.test(j))return b.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),O("number","number");if(j=="/")return b.eat("*")?(T.tokenize=ne,ne(b,T)):b.eat("/")?(b.skipToEnd(),O("comment","comment")):Kt(b,T,1)?(U(b),b.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),O("regexp","string-2")):(b.eat("="),O("operator","operator",b.current()));if(j=="`")return T.tokenize=ue,ue(b,T);if(j=="#"&&b.peek()=="!")return b.skipToEnd(),O("meta","meta");if(j=="#"&&b.eatWhile(A))return O("variable","property");if(j=="<"&&b.match("!--")||j=="-"&&b.match("->")&&!/\S/.test(b.string.slice(0,b.start)))return b.skipToEnd(),O("comment","comment");if(H.test(j))return(j!=">"||!T.lexical||T.lexical.type!=">")&&(b.eat("=")?(j=="!"||j=="=")&&b.eat("="):/[<>*+\-|&?]/.test(j)&&(b.eat(j),j==">"&&b.eat(j))),j=="?"&&b.eat(".")?O("."):O("operator","operator",b.current());if(A.test(j)){b.eatWhile(A);var Y=b.current();if(T.lastType!="."){if(E.propertyIsEnumerable(Y)){var P=E[Y];return O(P.type,P.style,Y)}if(Y=="async"&&b.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return O("async","keyword",Y)}return O("variable","variable",Y)}}function X(b){return function(T,j){var Y=!1,P;if(y&&T.peek()=="@"&&T.match(B))return j.tokenize=$,O("jsonld-keyword","meta");for(;(P=T.next())!=null&&!(P==b&&!Y);)Y=!Y&&P=="\\";return Y||(j.tokenize=$),O("string","string")}}function ne(b,T){for(var j=!1,Y;Y=b.next();){if(Y=="/"&&j){T.tokenize=$;break}j=Y=="*"}return O("comment","comment")}function ue(b,T){for(var j=!1,Y;(Y=b.next())!=null;){if(!j&&(Y=="`"||Y=="$"&&b.eat("{"))){T.tokenize=$;break}j=!j&&Y=="\\"}return O("quasi","string-2",b.current())}var se="([{}])";function he(b,T){T.fatArrowAt&&(T.fatArrowAt=null);var j=b.string.indexOf("=>",b.start);if(!(j<0)){if(S){var Y=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(b.string.slice(b.start,j));Y&&(j=Y.index)}for(var P=0,re=!1,$e=j-1;$e>=0;--$e){var mt=b.string.charAt($e),It=se.indexOf(mt);if(It>=0&&It<3){if(!P){++$e;break}if(--P==0){mt=="("&&(re=!0);break}}else if(It>=3&&It<6)++P;else if(A.test(mt))re=!0;else if(/["'\/`]/.test(mt))for(;;--$e){if($e==0)return;var Dr=b.string.charAt($e-1);if(Dr==mt&&b.string.charAt($e-2)!="\\"){$e--;break}}else if(re&&!P){++$e;break}}re&&!P&&(T.fatArrowAt=$e)}}var Oe={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function Re(b,T,j,Y,P,re){this.indented=b,this.column=T,this.type=j,this.prev=P,this.info=re,Y!=null&&(this.align=Y)}function ie(b,T){if(!x)return!1;for(var j=b.localVars;j;j=j.next)if(j.name==T)return!0;for(var Y=b.context;Y;Y=Y.prev)for(var j=Y.vars;j;j=j.next)if(j.name==T)return!0}function ze(b,T,j,Y,P){var re=b.cc;for(W.state=b,W.stream=P,W.marked=null,W.cc=re,W.style=T,b.lexical.hasOwnProperty("align")||(b.lexical.align=!0);;){var $e=re.length?re.pop():m?we:_e;if($e(j,Y)){for(;re.length&&re[re.length-1].lex;)re.pop()();return W.marked?W.marked:j=="variable"&&ie(b,Y)?"variable-2":T}}}var W={state:null,marked:null,cc:null};function Q(){for(var b=arguments.length-1;b>=0;b--)W.cc.push(arguments[b])}function k(){return Q.apply(null,arguments),!0}function J(b,T){for(var j=T;j;j=j.next)if(j.name==b)return!0;return!1}function G(b){var T=W.state;if(W.marked="def",!!x){if(T.context){if(T.lexical.info=="var"&&T.context&&T.context.block){var j=D(b,T.context);if(j!=null){T.context=j;return}}else if(!J(b,T.localVars)){T.localVars=new de(b,T.localVars);return}}f.globalVars&&!J(b,T.globalVars)&&(T.globalVars=new de(b,T.globalVars))}}function D(b,T){if(T)if(T.block){var j=D(b,T.prev);return j?j==T.prev?T:new K(j,T.vars,!0):null}else return J(b,T.vars)?T:new K(T.prev,new de(b,T.vars),!1);else return null}function R(b){return b=="public"||b=="private"||b=="protected"||b=="abstract"||b=="readonly"}function K(b,T,j){this.prev=b,this.vars=T,this.block=j}function de(b,T){this.name=b,this.next=T}var L=new de("this",new de("arguments",null));function w(){W.state.context=new K(W.state.context,W.state.localVars,!1),W.state.localVars=L}function oe(){W.state.context=new K(W.state.context,W.state.localVars,!0),W.state.localVars=null}w.lex=oe.lex=!0;function Te(){W.state.localVars=W.state.context.vars,W.state.context=W.state.context.prev}Te.lex=!0;function Z(b,T){var j=function(){var Y=W.state,P=Y.indented;if(Y.lexical.type=="stat")P=Y.lexical.indented;else for(var re=Y.lexical;re&&re.type==")"&&re.align;re=re.prev)P=re.indented;Y.lexical=new Re(P,W.stream.column(),b,null,Y.lexical,T)};return j.lex=!0,j}function ce(){var b=W.state;b.lexical.prev&&(b.lexical.type==")"&&(b.indented=b.lexical.indented),b.lexical=b.lexical.prev)}ce.lex=!0;function ke(b){function T(j){return j==b?k():b==";"||j=="}"||j==")"||j=="]"?Q():k(T)}return T}function _e(b,T){return b=="var"?k(Z("vardef",T),kr,ke(";"),ce):b=="keyword a"?k(Z("form"),Ke,_e,ce):b=="keyword b"?k(Z("form"),_e,ce):b=="keyword d"?W.stream.match(/^\s*$/,!1)?k():k(Z("stat"),Pt,ke(";"),ce):b=="debugger"?k(ke(";")):b=="{"?k(Z("}"),oe,Qt,ce,Te):b==";"?k():b=="if"?(W.state.lexical.info=="else"&&W.state.cc[W.state.cc.length-1]==ce&&W.state.cc.pop()(),k(Z("form"),Ke,_e,ce,Sr)):b=="function"?k(en):b=="for"?k(Z("form"),oe,ra,_e,Te,ce):b=="class"||S&&T=="interface"?(W.marked="keyword",k(Z("form",b=="class"?b:T),Cr,ce)):b=="variable"?S&&T=="declare"?(W.marked="keyword",k(_e)):S&&(T=="module"||T=="enum"||T=="type")&&W.stream.match(/^\s*\w/,!1)?(W.marked="keyword",T=="enum"?k(fe):T=="type"?k(ia,ke("operator"),Pe,ke(";")):k(Z("form"),At,ke("{"),Z("}"),Qt,ce,ce)):S&&T=="namespace"?(W.marked="keyword",k(Z("form"),we,_e,ce)):S&&T=="abstract"?(W.marked="keyword",k(_e)):k(Z("stat"),wr):b=="switch"?k(Z("form"),Ke,ke("{"),Z("}","switch"),oe,Qt,ce,ce,Te):b=="case"?k(we,ke(":")):b=="default"?k(ke(":")):b=="catch"?k(Z("form"),w,ft,_e,ce,Te):b=="export"?k(Z("stat"),Tr,ce):b=="import"?k(Z("stat"),Pn,ce):b=="async"?k(_e):T=="@"?k(we,_e):Q(Z("stat"),we,ke(";"),ce)}function ft(b){if(b=="(")return k(on,ke(")"))}function we(b,T){return ct(b,T,!1)}function Me(b,T){return ct(b,T,!0)}function Ke(b){return b!="("?Q():k(Z(")"),Pt,ke(")"),ce)}function ct(b,T,j){if(W.state.fatArrowAt==W.stream.start){var Y=j?kt:be;if(b=="(")return k(w,Z(")"),De(on,")"),ce,ke("=>"),Y,Te);if(b=="variable")return Q(w,At,ke("=>"),Y,Te)}var P=j?dt:ht;return Oe.hasOwnProperty(b)?k(P):b=="function"?k(en,P):b=="class"||S&&T=="interface"?(W.marked="keyword",k(Z("form"),hs,ce)):b=="keyword c"||b=="async"?k(j?Me:we):b=="("?k(Z(")"),Pt,ke(")"),ce,P):b=="operator"||b=="spread"?k(j?Me:we):b=="["?k(Z("]"),nt,ce,P):b=="{"?zt(xe,"}",null,P):b=="quasi"?Q(gt,P):b=="new"?k(Gt(j)):k()}function Pt(b){return b.match(/[;\}\)\],]/)?Q():Q(we)}function ht(b,T){return b==","?k(Pt):dt(b,T,!1)}function dt(b,T,j){var Y=j==!1?ht:dt,P=j==!1?we:Me;if(b=="=>")return k(w,j?kt:be,Te);if(b=="operator")return/\+\+|--/.test(T)||S&&T=="!"?k(Y):S&&T=="<"&&W.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?k(Z(">"),De(Pe,">"),ce,Y):T=="?"?k(we,ke(":"),P):k(P);if(b=="quasi")return Q(gt,Y);if(b!=";"){if(b=="(")return zt(Me,")","call",Y);if(b==".")return k(ye,Y);if(b=="[")return k(Z("]"),Pt,ke("]"),ce,Y);if(S&&T=="as")return W.marked="keyword",k(Pe,Y);if(b=="regexp")return W.state.lastType=W.marked="operator",W.stream.backUp(W.stream.pos-W.stream.start-1),k(P)}}function gt(b,T){return b!="quasi"?Q():T.slice(T.length-2)!="${"?k(gt):k(Pt,Ut)}function Ut(b){if(b=="}")return W.marked="string-2",W.state.tokenize=ue,k(gt)}function be(b){return he(W.stream,W.state),Q(b=="{"?_e:we)}function kt(b){return he(W.stream,W.state),Q(b=="{"?_e:Me)}function Gt(b){return function(T){return T=="."?k(b?Zn:In):T=="variable"&&S?k($t,b?dt:ht):Q(b?Me:we)}}function In(b,T){if(T=="target")return W.marked="keyword",k(ht)}function Zn(b,T){if(T=="target")return W.marked="keyword",k(dt)}function wr(b){return b==":"?k(ce,_e):Q(ht,ke(";"),ce)}function ye(b){if(b=="variable")return W.marked="property",k()}function xe(b,T){if(b=="async")return W.marked="property",k(xe);if(b=="variable"||W.style=="keyword"){if(W.marked="property",T=="get"||T=="set")return k(pe);var j;return S&&W.state.fatArrowAt==W.stream.start&&(j=W.stream.match(/^\s*:\s*/,!1))&&(W.state.fatArrowAt=W.stream.pos+j[0].length),k(Fe)}else{if(b=="number"||b=="string")return W.marked=y?"property":W.style+" property",k(Fe);if(b=="jsonld-keyword")return k(Fe);if(S&&R(T))return W.marked="keyword",k(xe);if(b=="[")return k(we,On,ke("]"),Fe);if(b=="spread")return k(Me,Fe);if(T=="*")return W.marked="keyword",k(xe);if(b==":")return Q(Fe)}}function pe(b){return b!="variable"?Q(Fe):(W.marked="property",k(en))}function Fe(b){if(b==":")return k(Me);if(b=="(")return Q(en)}function De(b,T,j){function Y(P,re){if(j?j.indexOf(P)>-1:P==","){var $e=W.state.lexical;return $e.info=="call"&&($e.pos=($e.pos||0)+1),k(function(mt,It){return mt==T||It==T?Q():Q(b)},Y)}return P==T||re==T?k():j&&j.indexOf(";")>-1?Q(b):k(ke(T))}return function(P,re){return P==T||re==T?k():Q(b,Y)}}function zt(b,T,j){for(var Y=3;Y<arguments.length;Y++)W.cc.push(arguments[Y]);return k(Z(T,j),De(b,T),ce)}function Qt(b){return b=="}"?k():Q(_e,Qt)}function On(b,T){if(S){if(b==":")return k(Pe);if(T=="?")return k(On)}}function er(b,T){if(S&&(b==":"||T=="in"))return k(Pe)}function Nn(b){if(S&&b==":")return W.stream.match(/^\s*\w+\s+is\b/,!1)?k(we,fs,Pe):k(Pe)}function fs(b,T){if(T=="is")return W.marked="keyword",k()}function Pe(b,T){if(T=="keyof"||T=="typeof"||T=="infer"||T=="readonly")return W.marked="keyword",k(T=="typeof"?Me:Pe);if(b=="variable"||T=="void")return W.marked="type",k(Zt);if(T=="|"||T=="&")return k(Pe);if(b=="string"||b=="number"||b=="atom")return k(Zt);if(b=="[")return k(Z("]"),De(Pe,"]",","),ce,Zt);if(b=="{")return k(Z("}"),me,ce,Zt);if(b=="(")return k(De(tt,")"),na,Zt);if(b=="<")return k(De(Pe,">"),Pe);if(b=="quasi")return Q(Ct,Zt)}function na(b){if(b=="=>")return k(Pe)}function me(b){return b.match(/[\}\)\]]/)?k():b==","||b==";"?k(me):Q(kn,me)}function kn(b,T){if(b=="variable"||W.style=="keyword")return W.marked="property",k(kn);if(T=="?"||b=="number"||b=="string")return k(kn);if(b==":")return k(Pe);if(b=="[")return k(ke("variable"),er,ke("]"),kn);if(b=="(")return Q(Fn,kn);if(!b.match(/[;\}\)\],]/))return k()}function Ct(b,T){return b!="quasi"?Q():T.slice(T.length-2)!="${"?k(Ct):k(Pe,et)}function et(b){if(b=="}")return W.marked="string-2",W.state.tokenize=ue,k(Ct)}function tt(b,T){return b=="variable"&&W.stream.match(/^\s*[?:]/,!1)||T=="?"?k(tt):b==":"?k(Pe):b=="spread"?k(tt):Q(Pe)}function Zt(b,T){if(T=="<")return k(Z(">"),De(Pe,">"),ce,Zt);if(T=="|"||b=="."||T=="&")return k(Pe);if(b=="[")return k(Pe,ke("]"),Zt);if(T=="extends"||T=="implements")return W.marked="keyword",k(Pe);if(T=="?")return k(Pe,ke(":"),Pe)}function $t(b,T){if(T=="<")return k(Z(">"),De(Pe,">"),ce,Zt)}function an(){return Q(Pe,Tt)}function Tt(b,T){if(T=="=")return k(Pe)}function kr(b,T){return T=="enum"?(W.marked="keyword",k(fe)):Q(At,On,sn,cs)}function At(b,T){if(S&&R(T))return W.marked="keyword",k(At);if(b=="variable")return G(T),k();if(b=="spread")return k(At);if(b=="[")return zt(li,"]");if(b=="{")return zt(Mn,"}")}function Mn(b,T){return b=="variable"&&!W.stream.match(/^\s*:/,!1)?(G(T),k(sn)):(b=="variable"&&(W.marked="property"),b=="spread"?k(At):b=="}"?Q():b=="["?k(we,ke("]"),ke(":"),Mn):k(ke(":"),At,sn))}function li(){return Q(At,sn)}function sn(b,T){if(T=="=")return k(Me)}function cs(b){if(b==",")return k(kr)}function Sr(b,T){if(b=="keyword b"&&T=="else")return k(Z("form","else"),_e,ce)}function ra(b,T){if(T=="await")return k(ra);if(b=="(")return k(Z(")"),ui,ce)}function ui(b){return b=="var"?k(kr,Rn):b=="variable"?k(Rn):Q(Rn)}function Rn(b,T){return b==")"?k():b==";"?k(Rn):T=="in"||T=="of"?(W.marked="keyword",k(we,Rn)):Q(we,Rn)}function en(b,T){if(T=="*")return W.marked="keyword",k(en);if(b=="variable")return G(T),k(en);if(b=="(")return k(w,Z(")"),De(on,")"),ce,Nn,_e,Te);if(S&&T=="<")return k(Z(">"),De(an,">"),ce,en)}function Fn(b,T){if(T=="*")return W.marked="keyword",k(Fn);if(b=="variable")return G(T),k(Fn);if(b=="(")return k(w,Z(")"),De(on,")"),ce,Nn,Te);if(S&&T=="<")return k(Z(">"),De(an,">"),ce,Fn)}function ia(b,T){if(b=="keyword"||b=="variable")return W.marked="type",k(ia);if(T=="<")return k(Z(">"),De(an,">"),ce)}function on(b,T){return T=="@"&&k(we,on),b=="spread"?k(on):S&&R(T)?(W.marked="keyword",k(on)):S&&b=="this"?k(On,sn):Q(At,On,sn)}function hs(b,T){return b=="variable"?Cr(b,T):ln(b,T)}function Cr(b,T){if(b=="variable")return G(T),k(ln)}function ln(b,T){if(T=="<")return k(Z(">"),De(an,">"),ce,ln);if(T=="extends"||T=="implements"||S&&b==",")return T=="implements"&&(W.marked="keyword"),k(S?Pe:we,ln);if(b=="{")return k(Z("}"),un,ce)}function un(b,T){if(b=="async"||b=="variable"&&(T=="static"||T=="get"||T=="set"||S&&R(T))&&W.stream.match(/^\s+#?[\w$\xa1-\uffff]/,!1))return W.marked="keyword",k(un);if(b=="variable"||W.style=="keyword")return W.marked="property",k(tr,un);if(b=="number"||b=="string")return k(tr,un);if(b=="[")return k(we,On,ke("]"),tr,un);if(T=="*")return W.marked="keyword",k(un);if(S&&b=="(")return Q(Fn,un);if(b==";"||b==",")return k(un);if(b=="}")return k();if(T=="@")return k(we,un)}function tr(b,T){if(T=="!"||T=="?")return k(tr);if(b==":")return k(Pe,sn);if(T=="=")return k(Me);var j=W.state.lexical.prev,Y=j&&j.info=="interface";return Q(Y?Fn:en)}function Tr(b,T){return T=="*"?(W.marked="keyword",k(Er,ke(";"))):T=="default"?(W.marked="keyword",k(we,ke(";"))):b=="{"?k(De(_r,"}"),Er,ke(";")):Q(_e)}function _r(b,T){if(T=="as")return W.marked="keyword",k(ke("variable"));if(b=="variable")return Q(Me,_r)}function Pn(b){return b=="string"?k():b=="("?Q(we):b=="."?Q(ht):Q(Lr,mn,Er)}function Lr(b,T){return b=="{"?zt(Lr,"}"):(b=="variable"&&G(T),T=="*"&&(W.marked="keyword"),k(fi))}function mn(b){if(b==",")return k(Lr,mn)}function fi(b,T){if(T=="as")return W.marked="keyword",k(Lr)}function Er(b,T){if(T=="from")return W.marked="keyword",k(we)}function nt(b){return b=="]"?k():Q(De(Me,"]"))}function fe(){return Q(Z("form"),At,ke("{"),Z("}"),De(Sn,"}"),ce,ce)}function Sn(){return Q(At,sn)}function ci(b,T){return b.lastType=="operator"||b.lastType==","||H.test(T.charAt(0))||/[,.]/.test(T.charAt(0))}function Kt(b,T,j){return T.tokenize==$&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(T.lastType)||T.lastType=="quasi"&&/\{\s*$/.test(b.string.slice(0,b.pos-(j||0)))}return{startState:function(b){var T={tokenize:$,lastType:"sof",cc:[],lexical:new Re((b||0)-d,0,"block",!1),localVars:f.localVars,context:f.localVars&&new K(null,null,!1),indented:b||0};return f.globalVars&&typeof f.globalVars=="object"&&(T.globalVars=f.globalVars),T},token:function(b,T){if(b.sol()&&(T.lexical.hasOwnProperty("align")||(T.lexical.align=!1),T.indented=b.indentation(),he(b,T)),T.tokenize!=ne&&b.eatSpace())return null;var j=T.tokenize(b,T);return F=="comment"?j:(T.lastType=F=="operator"&&(N=="++"||N=="--")?"incdec":F,ze(T,j,F,N,b))},indent:function(b,T){if(b.tokenize==ne||b.tokenize==ue)return a.Pass;if(b.tokenize!=$)return 0;var j=T&&T.charAt(0),Y=b.lexical,P;if(!/^\s*else\b/.test(T))for(var re=b.cc.length-1;re>=0;--re){var $e=b.cc[re];if($e==ce)Y=Y.prev;else if($e!=Sr&&$e!=Te)break}for(;(Y.type=="stat"||Y.type=="form")&&(j=="}"||(P=b.cc[b.cc.length-1])&&(P==ht||P==dt)&&!/^[,\.=+\-*:?[\(]/.test(T));)Y=Y.prev;p&&Y.type==")"&&Y.prev.type=="stat"&&(Y=Y.prev);var mt=Y.type,It=j==mt;return mt=="vardef"?Y.indented+(b.lastType=="operator"||b.lastType==","?Y.info.length+1:0):mt=="form"&&j=="{"?Y.indented:mt=="form"?Y.indented+d:mt=="stat"?Y.indented+(ci(b,T)?p||d:0):Y.info=="switch"&&!It&&f.doubleIndentSwitch!=!1?Y.indented+(/^(?:case|default)\b/.test(T)?d:2*d):Y.align?Y.column+(It?0:1):Y.indented+(It?0:d)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:m?null:"/*",blockCommentEnd:m?null:"*/",blockCommentContinue:m?null:" * ",lineComment:m?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:m?"json":"javascript",jsonldMode:y,jsonMode:m,expressionAllowed:Kt,skipExpression:function(b){ze(b,"atom","atom","true",new a.StringStream("",2,null))}}}),a.registerHelper("wordChars","javascript",/[\w$]/),a.defineMIME("text/javascript","javascript"),a.defineMIME("text/ecmascript","javascript"),a.defineMIME("application/javascript","javascript"),a.defineMIME("application/x-javascript","javascript"),a.defineMIME("application/ecmascript","javascript"),a.defineMIME("application/json",{name:"javascript",json:!0}),a.defineMIME("application/x-json",{name:"javascript",json:!0}),a.defineMIME("application/manifest+json",{name:"javascript",json:!0}),a.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),a.defineMIME("text/typescript",{name:"javascript",typescript:!0}),a.defineMIME("application/typescript",{name:"javascript",typescript:!0})})})(),function(u,n){(function(a){a(Wt())})(function(a){var o={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},f=a.Pos;a.defineOption("autoCloseBrackets",!1,function(N,O,$){$&&$!=a.Init&&(N.removeKeyMap(p),N.state.closeBrackets=null),O&&(y(d(O,"pairs")),N.state.closeBrackets=O,N.addKeyMap(p))});function d(N,O){return O=="pairs"&&typeof N=="string"?N:typeof N=="object"&&N[O]!=null?N[O]:o[O]}var p={Backspace:S,Enter:A};function y(N){for(var O=0;O<N.length;O++){var $=N.charAt(O),X="'"+$+"'";p[X]||(p[X]=m($))}}y(o.pairs+"`");function m(N){return function(O){return B(O,N)}}function x(N){var O=N.state.closeBrackets;if(!O||O.override)return O;var $=N.getModeAt(N.getCursor());return $.closeBrackets||O}function S(N){var O=x(N);if(!O||N.getOption("disableInput"))return a.Pass;for(var $=d(O,"pairs"),X=N.listSelections(),ne=0;ne<X.length;ne++){if(!X[ne].empty())return a.Pass;var ue=U(N,X[ne].head);if(!ue||$.indexOf(ue)%2!=0)return a.Pass}for(var ne=X.length-1;ne>=0;ne--){var se=X[ne].head;N.replaceRange("",f(se.line,se.ch-1),f(se.line,se.ch+1),"+delete")}}function A(N){var O=x(N),$=O&&d(O,"explode");if(!$||N.getOption("disableInput"))return a.Pass;for(var X=N.listSelections(),ne=0;ne<X.length;ne++){if(!X[ne].empty())return a.Pass;var ue=U(N,X[ne].head);if(!ue||$.indexOf(ue)%2!=0)return a.Pass}N.operation(function(){var se=N.lineSeparator()||`
25
+ `;N.replaceSelection(se+se,null),E(N,-1),X=N.listSelections();for(var he=0;he<X.length;he++){var Oe=X[he].head.line;N.indentLine(Oe,null,!0),N.indentLine(Oe+1,null,!0)}})}function E(N,O){for(var $=[],X=N.listSelections(),ne=0,ue=0;ue<X.length;ue++){var se=X[ue];se.head==N.getCursor()&&(ne=ue);var he=se.head.ch||O>0?{line:se.head.line,ch:se.head.ch+O}:{line:se.head.line-1};$.push({anchor:he,head:he})}N.setSelections($,ne)}function H(N){var O=a.cmpPos(N.anchor,N.head)>0;return{anchor:new f(N.anchor.line,N.anchor.ch+(O?-1:1)),head:new f(N.head.line,N.head.ch+(O?1:-1))}}function B(N,O){var $=x(N);if(!$||N.getOption("disableInput"))return a.Pass;var X=d($,"pairs"),ne=X.indexOf(O);if(ne==-1)return a.Pass;for(var ue=d($,"closeBefore"),se=d($,"triples"),he=X.charAt(ne+1)==O,Oe=N.listSelections(),Re=ne%2==0,ie,ze=0;ze<Oe.length;ze++){var W=Oe[ze],Q=W.head,k,J=N.getRange(Q,f(Q.line,Q.ch+1));if(Re&&!W.empty())k="surround";else if((he||!Re)&&J==O)he&&F(N,Q)?k="both":se.indexOf(O)>=0&&N.getRange(Q,f(Q.line,Q.ch+3))==O+O+O?k="skipThree":k="skip";else if(he&&Q.ch>1&&se.indexOf(O)>=0&&N.getRange(f(Q.line,Q.ch-2),Q)==O+O){if(Q.ch>2&&/\bstring/.test(N.getTokenTypeAt(f(Q.line,Q.ch-2))))return a.Pass;k="addFour"}else if(he){var G=Q.ch==0?" ":N.getRange(f(Q.line,Q.ch-1),Q);if(!a.isWordChar(J)&&G!=O&&!a.isWordChar(G))k="both";else return a.Pass}else if(Re&&(J.length===0||/\s/.test(J)||ue.indexOf(J)>-1))k="both";else return a.Pass;if(!ie)ie=k;else if(ie!=k)return a.Pass}var D=ne%2?X.charAt(ne-1):O,R=ne%2?O:X.charAt(ne+1);N.operation(function(){if(ie=="skip")E(N,1);else if(ie=="skipThree")E(N,3);else if(ie=="surround"){for(var K=N.getSelections(),de=0;de<K.length;de++)K[de]=D+K[de]+R;N.replaceSelections(K,"around"),K=N.listSelections().slice();for(var de=0;de<K.length;de++)K[de]=H(K[de]);N.setSelections(K)}else ie=="both"?(N.replaceSelection(D+R,null),N.triggerElectric(D+R),E(N,-1)):ie=="addFour"&&(N.replaceSelection(D+D+D+D,"before"),E(N,1))})}function U(N,O){var $=N.getRange(f(O.line,O.ch-1),f(O.line,O.ch+1));return $.length==2?$:null}function F(N,O){var $=N.getTokenAt(f(O.line,O.ch+1));return/\bstring/.test($.type)&&$.start==O.ch&&(O.ch==0||!/\bstring/.test(N.getTokenTypeAt(O)))}})}(),function(u,n){(function(a){a(Wt())})(function(a){var o=/MSIE \d/.test(navigator.userAgent)&&(document.documentMode==null||document.documentMode<8),f=a.Pos,d={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function p(E){return E&&E.bracketRegex||/[(){}[\]]/}function y(E,H,B){var U=E.getLineHandle(H.line),F=H.ch-1,N=B&&B.afterCursor;N==null&&(N=/(^| )cm-fat-cursor($| )/.test(E.getWrapperElement().className));var O=p(B),$=!N&&F>=0&&O.test(U.text.charAt(F))&&d[U.text.charAt(F)]||O.test(U.text.charAt(F+1))&&d[U.text.charAt(++F)];if(!$)return null;var X=$.charAt(1)==">"?1:-1;if(B&&B.strict&&X>0!=(F==H.ch))return null;var ne=E.getTokenTypeAt(f(H.line,F+1)),ue=m(E,f(H.line,F+(X>0?1:0)),X,ne,B);return ue==null?null:{from:f(H.line,F),to:ue&&ue.pos,match:ue&&ue.ch==$.charAt(0),forward:X>0}}function m(E,H,B,U,F){for(var N=F&&F.maxScanLineLength||1e4,O=F&&F.maxScanLines||1e3,$=[],X=p(F),ne=B>0?Math.min(H.line+O,E.lastLine()+1):Math.max(E.firstLine()-1,H.line-O),ue=H.line;ue!=ne;ue+=B){var se=E.getLine(ue);if(se){var he=B>0?0:se.length-1,Oe=B>0?se.length:-1;if(!(se.length>N))for(ue==H.line&&(he=H.ch-(B<0?1:0));he!=Oe;he+=B){var Re=se.charAt(he);if(X.test(Re)&&(U===void 0||(E.getTokenTypeAt(f(ue,he+1))||"")==(U||""))){var ie=d[Re];if(ie&&ie.charAt(1)==">"==B>0)$.push(Re);else if($.length)$.pop();else return{pos:f(ue,he),ch:Re}}}}}return ue-B==(B>0?E.lastLine():E.firstLine())?!1:null}function x(E,H,B){for(var U=E.state.matchBrackets.maxHighlightLineLength||1e3,F=B&&B.highlightNonMatching,N=[],O=E.listSelections(),$=0;$<O.length;$++){var X=O[$].empty()&&y(E,O[$].head,B);if(X&&(X.match||F!==!1)&&E.getLine(X.from.line).length<=U){var ne=X.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";N.push(E.markText(X.from,f(X.from.line,X.from.ch+1),{className:ne})),X.to&&E.getLine(X.to.line).length<=U&&N.push(E.markText(X.to,f(X.to.line,X.to.ch+1),{className:ne}))}}if(N.length){o&&E.state.focused&&E.focus();var ue=function(){E.operation(function(){for(var se=0;se<N.length;se++)N[se].clear()})};if(H)setTimeout(ue,800);else return ue}}function S(E){E.operation(function(){E.state.matchBrackets.currentlyHighlighted&&(E.state.matchBrackets.currentlyHighlighted(),E.state.matchBrackets.currentlyHighlighted=null),E.state.matchBrackets.currentlyHighlighted=x(E,!1,E.state.matchBrackets)})}function A(E){E.state.matchBrackets&&E.state.matchBrackets.currentlyHighlighted&&(E.state.matchBrackets.currentlyHighlighted(),E.state.matchBrackets.currentlyHighlighted=null)}a.defineOption("matchBrackets",!1,function(E,H,B){B&&B!=a.Init&&(E.off("cursorActivity",S),E.off("focus",S),E.off("blur",A),A(E)),H&&(E.state.matchBrackets=typeof H=="object"?H:{},E.on("cursorActivity",S),E.on("focus",S),E.on("blur",A))}),a.defineExtension("matchBrackets",function(){x(this,!0)}),a.defineExtension("findMatchingBracket",function(E,H,B){return(B||typeof H=="boolean")&&(B?(B.strict=H,H=B):H=H?{strict:!0}:null),y(this,E,H)}),a.defineExtension("scanForBracket",function(E,H,B,U){return m(this,E,H,B,U)})})}();var uo={exports:{}},fo;function co(){return fo||(fo=1,function(u,n){(function(a){a(Wt())})(function(a){function o(y,m,x,S){if(x&&x.call){var A=x;x=null}else var A=p(y,x,"rangeFinder");typeof m=="number"&&(m=a.Pos(m,0));var E=p(y,x,"minFoldSize");function H(N){var O=A(y,m);if(!O||O.to.line-O.from.line<E)return null;if(S==="fold")return O;for(var $=y.findMarksAt(O.from),X=0;X<$.length;++X)if($[X].__isFold){if(!N)return null;O.cleared=!0,$[X].clear()}return O}var B=H(!0);if(p(y,x,"scanUp"))for(;!B&&m.line>y.firstLine();)m=a.Pos(m.line-1,0),B=H(!1);if(!(!B||B.cleared||S==="unfold")){var U=f(y,x,B);a.on(U,"mousedown",function(N){F.clear(),a.e_preventDefault(N)});var F=y.markText(B.from,B.to,{replacedWith:U,clearOnEnter:p(y,x,"clearOnEnter"),__isFold:!0});F.on("clear",function(N,O){a.signal(y,"unfold",y,N,O)}),a.signal(y,"fold",y,B.from,B.to)}}function f(y,m,x){var S=p(y,m,"widget");if(typeof S=="function"&&(S=S(x.from,x.to)),typeof S=="string"){var A=document.createTextNode(S);S=document.createElement("span"),S.appendChild(A),S.className="CodeMirror-foldmarker"}else S&&(S=S.cloneNode(!0));return S}a.newFoldFunction=function(y,m){return function(x,S){o(x,S,{rangeFinder:y,widget:m})}},a.defineExtension("foldCode",function(y,m,x){o(this,y,m,x)}),a.defineExtension("isFolded",function(y){for(var m=this.findMarksAt(y),x=0;x<m.length;++x)if(m[x].__isFold)return!0}),a.commands.toggleFold=function(y){y.foldCode(y.getCursor())},a.commands.fold=function(y){y.foldCode(y.getCursor(),null,"fold")},a.commands.unfold=function(y){y.foldCode(y.getCursor(),{scanUp:!1},"unfold")},a.commands.foldAll=function(y){y.operation(function(){for(var m=y.firstLine(),x=y.lastLine();m<=x;m++)y.foldCode(a.Pos(m,0),{scanUp:!1},"fold")})},a.commands.unfoldAll=function(y){y.operation(function(){for(var m=y.firstLine(),x=y.lastLine();m<=x;m++)y.foldCode(a.Pos(m,0),{scanUp:!1},"unfold")})},a.registerHelper("fold","combine",function(){var y=Array.prototype.slice.call(arguments,0);return function(m,x){for(var S=0;S<y.length;++S){var A=y[S](m,x);if(A)return A}}}),a.registerHelper("fold","auto",function(y,m){for(var x=y.getHelpers(m,"fold"),S=0;S<x.length;S++){var A=x[S](y,m);if(A)return A}});var d={rangeFinder:a.fold.auto,widget:"↔",minFoldSize:0,scanUp:!1,clearOnEnter:!0};a.defineOption("foldOptions",null);function p(y,m,x){if(m&&m[x]!==void 0)return m[x];var S=y.options.foldOptions;return S&&S[x]!==void 0?S[x]:d[x]}a.defineExtension("foldOption",function(y,m){return p(this,y,m)})})}()),uo.exports}co(),function(u,n){(function(a){a(Wt(),co())})(function(a){a.defineOption("foldGutter",!1,function(F,N,O){O&&O!=a.Init&&(F.clearGutter(F.state.foldGutter.options.gutter),F.state.foldGutter=null,F.off("gutterClick",A),F.off("changes",H),F.off("viewportChange",B),F.off("fold",U),F.off("unfold",U),F.off("swapDoc",H),F.off("optionChange",E)),N&&(F.state.foldGutter=new f(d(N)),S(F),F.on("gutterClick",A),F.on("changes",H),F.on("viewportChange",B),F.on("fold",U),F.on("unfold",U),F.on("swapDoc",H),F.on("optionChange",E))});var o=a.Pos;function f(F){this.options=F,this.from=this.to=0}function d(F){return F===!0&&(F={}),F.gutter==null&&(F.gutter="CodeMirror-foldgutter"),F.indicatorOpen==null&&(F.indicatorOpen="CodeMirror-foldgutter-open"),F.indicatorFolded==null&&(F.indicatorFolded="CodeMirror-foldgutter-folded"),F}function p(F,N){for(var O=F.findMarks(o(N,0),o(N+1,0)),$=0;$<O.length;++$)if(O[$].__isFold){var X=O[$].find(-1);if(X&&X.line===N)return O[$]}}function y(F){if(typeof F=="string"){var N=document.createElement("div");return N.className=F+" CodeMirror-guttermarker-subtle",N}else return F.cloneNode(!0)}function m(F,N,O){var $=F.state.foldGutter.options,X=N-1,ne=F.foldOption($,"minFoldSize"),ue=F.foldOption($,"rangeFinder"),se=typeof $.indicatorFolded=="string"&&x($.indicatorFolded),he=typeof $.indicatorOpen=="string"&&x($.indicatorOpen);F.eachLine(N,O,function(Oe){++X;var Re=null,ie=Oe.gutterMarkers;if(ie&&(ie=ie[$.gutter]),p(F,X)){if(se&&ie&&se.test(ie.className))return;Re=y($.indicatorFolded)}else{var ze=o(X,0),W=ue&&ue(F,ze);if(W&&W.to.line-W.from.line>=ne){if(he&&ie&&he.test(ie.className))return;Re=y($.indicatorOpen)}}!Re&&!ie||F.setGutterMarker(Oe,$.gutter,Re)})}function x(F){return new RegExp("(^|\\s)"+F+"(?:$|\\s)\\s*")}function S(F){var N=F.getViewport(),O=F.state.foldGutter;O&&(F.operation(function(){m(F,N.from,N.to)}),O.from=N.from,O.to=N.to)}function A(F,N,O){var $=F.state.foldGutter;if($){var X=$.options;if(O==X.gutter){var ne=p(F,N);ne?ne.clear():F.foldCode(o(N,0),X)}}}function E(F,N){N=="mode"&&H(F)}function H(F){var N=F.state.foldGutter;if(N){var O=N.options;N.from=N.to=0,clearTimeout(N.changeUpdate),N.changeUpdate=setTimeout(function(){S(F)},O.foldOnChangeTimeSpan||600)}}function B(F){var N=F.state.foldGutter;if(N){var O=N.options;clearTimeout(N.changeUpdate),N.changeUpdate=setTimeout(function(){var $=F.getViewport();N.from==N.to||$.from-N.to>20||N.from-$.to>20?S(F):F.operation(function(){$.from<N.from&&(m(F,$.from,N.from),N.from=$.from),$.to>N.to&&(m(F,N.to,$.to),N.to=$.to)})},O.updateViewportTimeSpan||400)}}function U(F,N){var O=F.state.foldGutter;if(O){var $=N.line;$>=O.from&&$<O.to&&m(F,$,$+1)}}})}(),function(u,n){(function(a){a(Wt())})(function(a){function o(f){return function(d,p){var y=p.line,m=d.getLine(y);function x(U){for(var F,N=p.ch,O=0;;){var $=N<=0?-1:m.lastIndexOf(U[0],N-1);if($==-1){if(O==1)break;O=1,N=m.length;continue}if(O==1&&$<p.ch)break;if(F=d.getTokenTypeAt(a.Pos(y,$+1)),!/^(comment|string)/.test(F))return{ch:$+1,tokenType:F,pair:U};N=$-1}}function S(U){var F=1,N=d.lastLine(),O,$=U.ch,X;e:for(var ne=y;ne<=N;++ne)for(var ue=d.getLine(ne),se=ne==y?$:0;;){var he=ue.indexOf(U.pair[0],se),Oe=ue.indexOf(U.pair[1],se);if(he<0&&(he=ue.length),Oe<0&&(Oe=ue.length),se=Math.min(he,Oe),se==ue.length)break;if(d.getTokenTypeAt(a.Pos(ne,se+1))==U.tokenType){if(se==he)++F;else if(!--F){O=ne,X=se;break e}}++se}return O==null||y==O?null:{from:a.Pos(y,$),to:a.Pos(O,X)}}for(var A=[],E=0;E<f.length;E++){var H=x(f[E]);H&&A.push(H)}A.sort(function(U,F){return U.ch-F.ch});for(var E=0;E<A.length;E++){var B=S(A[E]);if(B)return B}return null}}a.registerHelper("fold","brace",o([["{","}"],["[","]"]])),a.registerHelper("fold","brace-paren",o([["{","}"],["[","]"],["(",")"]])),a.registerHelper("fold","import",function(f,d){function p(E){if(E<f.firstLine()||E>f.lastLine())return null;var H=f.getTokenAt(a.Pos(E,1));if(/\S/.test(H.string)||(H=f.getTokenAt(a.Pos(E,H.end+1))),H.type!="keyword"||H.string!="import")return null;for(var B=E,U=Math.min(f.lastLine(),E+10);B<=U;++B){var F=f.getLine(B),N=F.indexOf(";");if(N!=-1)return{startCh:H.end,end:a.Pos(B,N)}}}var y=d.line,m=p(y),x;if(!m||p(y-1)||(x=p(y-2))&&x.end.line==y-1)return null;for(var S=m.end;;){var A=p(S.line+1);if(A==null)break;S=A.end}return{from:f.clipPos(a.Pos(y,m.startCh+1)),to:S}}),a.registerHelper("fold","include",function(f,d){function p(A){if(A<f.firstLine()||A>f.lastLine())return null;var E=f.getTokenAt(a.Pos(A,1));if(/\S/.test(E.string)||(E=f.getTokenAt(a.Pos(A,E.end+1))),E.type=="meta"&&E.string.slice(0,8)=="#include")return E.start+8}var y=d.line,m=p(y);if(m==null||p(y-1)!=null)return null;for(var x=y;;){var S=p(x+1);if(S==null)break;++x}return{from:a.Pos(y,m+1),to:f.clipPos(a.Pos(x))}})})}(),function(u,n){(function(a){a(Wt())})(function(a){function o(f,d){var p=f.getLine(d),y=p.search(/\S/);return y==-1||/\bcomment\b/.test(f.getTokenTypeAt(a.Pos(d,y+1)))?-1:a.countColumn(p,null,f.getOption("tabSize"))}a.registerHelper("fold","indent",function(f,d){var p=o(f,d.line);if(!(p<0)){for(var y=null,m=d.line+1,x=f.lastLine();m<=x;++m){var S=o(f,m);if(S!=-1)if(S>p)y=m;else break}if(y)return{from:a.Pos(d.line,f.getLine(d.line).length),to:a.Pos(y,f.getLine(y).length)}}})})}(),function(u,n){(function(a){a(Wt())})(function(a){a.defineOption("autoRefresh",!1,function(d,p){d.state.autoRefresh&&(f(d,d.state.autoRefresh),d.state.autoRefresh=null),p&&d.display.wrapper.offsetHeight==0&&o(d,d.state.autoRefresh={delay:p.delay||250})});function o(d,p){function y(){d.display.wrapper.offsetHeight?(f(d,p),d.display.lastWrapHeight!=d.display.wrapper.clientHeight&&d.refresh()):p.timeout=setTimeout(y,p.delay)}p.timeout=setTimeout(y,p.delay),p.hurry=function(){clearTimeout(p.timeout),p.timeout=setTimeout(y,50)},a.on(window,"mouseup",p.hurry),a.on(window,"keyup",p.hurry)}function f(d,p){clearTimeout(p.timeout),a.off(window,"mouseup",p.hurry),a.off(window,"keyup",p.hurry)}})}();const ho=it.defineStore("trace",{state:()=>({traces:[],currentTrace:null}),getters:{getTraces:u=>u.traces,getCurrentTrace:u=>u.currentTrace},actions:{setTraces(u){this.traces=u},setCurrentTrace(u){this.currentTrace=u}}}),Qf=()=>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",Kn=Yt.create({baseURL:Qf(),timeout:36e5}),tn={getExperiments(){return Kn.post("/experiments/search").then(u=>u.data)},getTraceList(u,n,a,o,f,d){const p={};return u&&(p.query=u),n&&(p.startTime=n),a&&(p.endTime=a),o&&(p.pageNum=o),f&&(p.pageSize=f),d&&(p.experimentId=d),Kn.get("/v1/trace",{params:p}).then(y=>y.data)},getTraceDetail(u){return Kn.get(`/v1/trace/${u}`).then(n=>n.data)},getTraceSpans(u,n={}){const{query:a="",has_events:o,page_num:f=1,page_size:d=100}=n,p={query:a||"",page_num:f,page_size:d};return o===!0&&(p.has_events=!0),Kn.post(`/v1/trace/${u}/spans`,p).then(y=>y.data)},getSpanContent(u,n){return Kn.get(`/v1/trace/${u}/span/${n}/content`).then(a=>a.data)},deleteTraces(u,n,a,o){const f={};return u&&(f.query=u),n&&(f.startTime=n),a&&(f.endTime=a),o&&(f.experimentId=o),Kn.delete("/v1/trace",{params:f}).then(d=>d.data)},debugTrace(u,n={}){return Kn.post("/debug",u,{headers:n}).then(a=>a.data)}};var po={exports:{}};(function(u,n){(function(a,o){u.exports=o(Wt())})(oo,function(a){return function(o){function f(p){if(d[p])return d[p].exports;var y=d[p]={i:p,l:!1,exports:{}};return o[p].call(y.exports,y,y.exports,f),y.l=!0,y.exports}var d={};return f.m=o,f.c=d,f.i=function(p){return p},f.d=function(p,y,m){f.o(p,y)||Object.defineProperty(p,y,{configurable:!1,enumerable:!0,get:m})},f.n=function(p){var y=p&&p.__esModule?function(){return p.default}:function(){return p};return f.d(y,"a",y),y},f.o=function(p,y){return Object.prototype.hasOwnProperty.call(p,y)},f.p="/",f(f.s=3)}([function(o,f){o.exports=a},function(o,f,d){Object.defineProperty(f,"__esModule",{value:!0});var p=d(0),y=function(x){return x&&x.__esModule?x:{default:x}}(p),m=window.CodeMirror||y.default;typeof Object.assign!="function"&&Object.defineProperty(Object,"assign",{value:function(x,S){if(x==null)throw new TypeError("Cannot convert undefined or null to object");for(var A=Object(x),E=1;E<arguments.length;E++){var H=arguments[E];if(H!=null)for(var B in H)Object.prototype.hasOwnProperty.call(H,B)&&(A[B]=H[B])}return A},writable:!0,configurable:!0}),f.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(x){for(var S in x)this.cminstance.setOption(S,x[S])}},merge:function(){this.$nextTick(this.switchMerge)},code:function(x){this.handerCodeChange(x)},value:function(x){this.handerCodeChange(x)}},methods:{initialize:function(){var x=this,S=Object.assign({},this.globalOptions,this.options);this.merge?(this.codemirror=m.MergeView(this.$refs.mergeview,S),this.cminstance=this.codemirror.edit):(this.codemirror=m.fromTextArea(this.$refs.textarea,S),this.cminstance=this.codemirror,this.cminstance.setValue(this.code||this.value||this.content)),this.cminstance.on("change",function(E){x.content=E.getValue(),x.$emit&&x.$emit("input",x.content)});var A={};["scroll","changes","beforeChange","cursorActivity","keyHandled","inputRead","electricInput","beforeSelectionChange","viewportChange","swapDoc","gutterClick","gutterContextMenu","focus","blur","refresh","optionChange","scrollCursorIntoView","update"].concat(this.events).concat(this.globalEvents).filter(function(E){return!A[E]&&(A[E]=!0)}).forEach(function(E){x.cminstance.on(E,function(){for(var H=arguments.length,B=Array(H),U=0;U<H;U++)B[U]=arguments[U];x.$emit.apply(x,[E].concat(B));var F=E.replace(/([A-Z])/g,"-$1").toLowerCase();F!==E&&x.$emit.apply(x,[F].concat(B))})}),this.$emit("ready",this.codemirror),this.unseenLineMarkers(),this.refresh()},refresh:function(){var x=this;this.$nextTick(function(){x.cminstance.refresh()})},destroy:function(){var x=this.cminstance.doc.cm.getWrapperElement();x&&x.remove&&x.remove()},handerCodeChange:function(x){if(x!==this.cminstance.getValue()){var S=this.cminstance.getScrollInfo();this.cminstance.setValue(x),this.content=x,this.cminstance.scrollTo(S.left,S.top)}this.unseenLineMarkers()},unseenLineMarkers:function(){var x=this;this.unseenLines!==void 0&&this.marker!==void 0&&this.unseenLines.forEach(function(S){var A=x.cminstance.lineInfo(S);x.cminstance.setGutterMarker(S,"breakpoints",A.gutterMarkers?null:x.marker())})},switchMerge:function(){var x=this.cminstance.doc.history,S=this.cminstance.doc.cleanGeneration;this.options.value=this.cminstance.getValue(),this.destroy(),this.initialize(),this.cminstance.doc.history=x,this.cminstance.doc.cleanGeneration=S}},mounted:function(){this.initialize()},beforeDestroy:function(){this.destroy()}}},function(o,f,d){Object.defineProperty(f,"__esModule",{value:!0});var p=d(1),y=d.n(p);for(var m in p)["default","default"].indexOf(m)<0&&function(E){d.d(f,E,function(){return p[E]})}(m);var x=d(5),S=d(4),A=S(y.a,x.a,!1,null,null,null);f.default=A.exports},function(o,f,d){function p(B){return B&&B.__esModule?B:{default:B}}Object.defineProperty(f,"__esModule",{value:!0}),f.install=f.codemirror=f.CodeMirror=void 0;var y=d(0),m=p(y),x=d(2),S=p(x),A=window.CodeMirror||m.default,E=function(B,U){U&&(U.options&&(S.default.props.globalOptions.default=function(){return U.options}),U.events&&(S.default.props.globalEvents.default=function(){return U.events})),B.component(S.default.name,S.default)},H={CodeMirror:A,codemirror:S.default,install:E};f.default=H,f.CodeMirror=A,f.codemirror=S.default,f.install=E},function(o,f){o.exports=function(d,p,y,m,x,S){var A,E=d=d||{},H=typeof d.default;H!=="object"&&H!=="function"||(A=d,E=d.default);var B=typeof E=="function"?E.options:E;p&&(B.render=p.render,B.staticRenderFns=p.staticRenderFns,B._compiled=!0),y&&(B.functional=!0),x&&(B._scopeId=x);var U;if(S?(U=function(O){O=O||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,O||typeof __VUE_SSR_CONTEXT__>"u"||(O=__VUE_SSR_CONTEXT__),m&&m.call(this,O),O&&O._registeredComponents&&O._registeredComponents.add(S)},B._ssrRegister=U):m&&(U=m),U){var F=B.functional,N=F?B.render:B.beforeCreate;F?(B._injectStyles=U,B.render=function(O,$){return U.call($),N(O,$)}):B.beforeCreate=N?[].concat(N,U):[U]}return{esModule:A,exports:E,options:B}}},function(o,f,d){var p=function(){var x=this,S=x.$createElement,A=x._self._c||S;return A("div",{staticClass:"vue-codemirror",class:{merge:x.merge}},[x.merge?A("div",{ref:"mergeview"}):A("textarea",{ref:"textarea",attrs:{name:x.name,placeholder:x.placeholder}})])},y=[],m={render:p,staticRenderFns:y};f.a=m}])})})(po);var go=po.exports;function Pa(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let Xn=Pa();function mo(u){Xn=u}const vo=/[&<>"']/,Zf=new RegExp(vo.source,"g"),yo=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,ec=new RegExp(yo.source,"g"),tc={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},bo=u=>tc[u];function jt(u,n){if(n){if(vo.test(u))return u.replace(Zf,bo)}else if(yo.test(u))return u.replace(ec,bo);return u}const nc=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function rc(u){return u.replace(nc,(n,a)=>(a=a.toLowerCase(),a==="colon"?":":a.charAt(0)==="#"?a.charAt(1)==="x"?String.fromCharCode(parseInt(a.substring(2),16)):String.fromCharCode(+a.substring(1)):""))}const ic=/(^|[^\[])\^/g;function je(u,n){let a=typeof u=="string"?u:u.source;n=n||"";const o={replace:(f,d)=>{let p=typeof d=="string"?d:d.source;return p=p.replace(ic,"$1"),a=a.replace(f,p),o},getRegex:()=>new RegExp(a,n)};return o}function xo(u){try{u=encodeURI(u).replace(/%25/g,"%")}catch{return null}return u}const Yr={exec:()=>null};function wo(u,n){const a=u.replace(/\|/g,(d,p,y)=>{let m=!1,x=p;for(;--x>=0&&y[x]==="\\";)m=!m;return m?"|":" |"}),o=a.split(/ \|/);let f=0;if(o[0].trim()||o.shift(),o.length>0&&!o[o.length-1].trim()&&o.pop(),n)if(o.length>n)o.splice(n);else for(;o.length<n;)o.push("");for(;f<o.length;f++)o[f]=o[f].trim().replace(/\\\|/g,"|");return o}function $i(u,n,a){const o=u.length;if(o===0)return"";let f=0;for(;f<o&&u.charAt(o-f-1)===n;)f++;return u.slice(0,o-f)}function ac(u,n){if(u.indexOf(n[1])===-1)return-1;let a=0;for(let o=0;o<u.length;o++)if(u[o]==="\\")o++;else if(u[o]===n[0])a++;else if(u[o]===n[1]&&(a--,a<0))return o;return-1}function ko(u,n,a,o){const f=n.href,d=n.title?jt(n.title):null,p=u[1].replace(/\\([\[\]])/g,"$1");if(u[0].charAt(0)!=="!"){o.state.inLink=!0;const y={type:"link",raw:a,href:f,title:d,text:p,tokens:o.inlineTokens(p)};return o.state.inLink=!1,y}return{type:"image",raw:a,href:f,title:d,text:jt(p)}}function sc(u,n){const a=u.match(/^(\s+)(?:```)/);if(a===null)return n;const o=a[1];return n.split(`
26
26
  `).map(f=>{const d=f.match(/^\s+/);if(d===null)return f;const[p]=d;return p.length>=o.length?f.slice(o.length):f}).join(`
27
27
  `)}class Bi{constructor(n){Je(this,"options");Je(this,"rules");Je(this,"lexer");this.options=n||Xn}space(n){const a=this.rules.block.newline.exec(n);if(a&&a[0].length>0)return{type:"space",raw:a[0]}}code(n){const a=this.rules.block.code.exec(n);if(a){const o=a[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:a[0],codeBlockStyle:"indented",text:this.options.pedantic?o:$i(o,`
28
- `)}}}fences(n){const a=this.rules.block.fences.exec(n);if(a){const o=a[0],f=ic(o,a[3]||"");return{type:"code",raw:o,lang:a[2]?a[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):a[2],text:f}}}heading(n){const a=this.rules.block.heading.exec(n);if(a){let o=a[2].trim();if(/#$/.test(o)){const f=$i(o,"#");(this.options.pedantic||!f||/ $/.test(f))&&(o=f.trim())}return{type:"heading",raw:a[0],depth:a[1].length,text:o,tokens:this.lexer.inline(o)}}}hr(n){const a=this.rules.block.hr.exec(n);if(a)return{type:"hr",raw:a[0]}}blockquote(n){const a=this.rules.block.blockquote.exec(n);if(a){const o=$i(a[0].replace(/^ *>[ \t]?/gm,""),`
28
+ `)}}}fences(n){const a=this.rules.block.fences.exec(n);if(a){const o=a[0],f=sc(o,a[3]||"");return{type:"code",raw:o,lang:a[2]?a[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):a[2],text:f}}}heading(n){const a=this.rules.block.heading.exec(n);if(a){let o=a[2].trim();if(/#$/.test(o)){const f=$i(o,"#");(this.options.pedantic||!f||/ $/.test(f))&&(o=f.trim())}return{type:"heading",raw:a[0],depth:a[1].length,text:o,tokens:this.lexer.inline(o)}}}hr(n){const a=this.rules.block.hr.exec(n);if(a)return{type:"hr",raw:a[0]}}blockquote(n){const a=this.rules.block.blockquote.exec(n);if(a){const o=$i(a[0].replace(/^ *>[ \t]?/gm,""),`
29
29
  `),f=this.lexer.state.top;this.lexer.state.top=!0;const d=this.lexer.blockTokens(o);return this.lexer.state.top=f,{type:"blockquote",raw:a[0],tokens:d,text:o}}}list(n){let a=this.rules.block.list.exec(n);if(a){let o=a[1].trim();const f=o.length>1,d={type:"list",raw:"",ordered:f,start:f?+o.slice(0,-1):"",loose:!1,items:[]};o=f?`\\d{1,9}\\${o.slice(-1)}`:`\\${o}`,this.options.pedantic&&(o=f?o:"[*+-]");const p=new RegExp(`^( {0,3}${o})((?:[ ][^\\n]*)?(?:\\n|$))`);let y="",m="",x=!1;for(;n;){let S=!1;if(!(a=p.exec(n))||this.rules.block.hr.test(n))break;y=a[0],n=n.substring(y.length);let A=a[2].split(`
30
30
  `,1)[0].replace(/^\t+/,N=>" ".repeat(3*N.length)),E=n.split(`
31
- `,1)[0],W=0;this.options.pedantic?(W=2,m=A.trimStart()):(W=a[2].search(/[^ ]/),W=W>4?1:W,m=A.slice(W),W+=a[1].length);let B=!1;if(!A&&/^ *$/.test(E)&&(y+=E+`
32
- `,n=n.substring(E.length+1),S=!0),!S){const N=new RegExp(`^ {0,${Math.min(3,W-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),O=new RegExp(`^ {0,${Math.min(3,W-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),$=new RegExp(`^ {0,${Math.min(3,W-1)}}(?:\`\`\`|~~~)`),X=new RegExp(`^ {0,${Math.min(3,W-1)}}#`);for(;n;){const ne=n.split(`
33
- `,1)[0];if(E=ne,this.options.pedantic&&(E=E.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),$.test(E)||X.test(E)||N.test(E)||O.test(n))break;if(E.search(/[^ ]/)>=W||!E.trim())m+=`
34
- `+E.slice(W);else{if(B||A.search(/[^ ]/)>=4||$.test(A)||X.test(A)||O.test(A))break;m+=`
31
+ `,1)[0],H=0;this.options.pedantic?(H=2,m=A.trimStart()):(H=a[2].search(/[^ ]/),H=H>4?1:H,m=A.slice(H),H+=a[1].length);let B=!1;if(!A&&/^ *$/.test(E)&&(y+=E+`
32
+ `,n=n.substring(E.length+1),S=!0),!S){const N=new RegExp(`^ {0,${Math.min(3,H-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),O=new RegExp(`^ {0,${Math.min(3,H-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),$=new RegExp(`^ {0,${Math.min(3,H-1)}}(?:\`\`\`|~~~)`),X=new RegExp(`^ {0,${Math.min(3,H-1)}}#`);for(;n;){const ne=n.split(`
33
+ `,1)[0];if(E=ne,this.options.pedantic&&(E=E.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),$.test(E)||X.test(E)||N.test(E)||O.test(n))break;if(E.search(/[^ ]/)>=H||!E.trim())m+=`
34
+ `+E.slice(H);else{if(B||A.search(/[^ ]/)>=4||$.test(A)||X.test(A)||O.test(A))break;m+=`
35
35
  `+E}!B&&!E.trim()&&(B=!0),y+=ne+`
36
- `,n=n.substring(ne.length+1),A=E.slice(W)}}d.loose||(x?d.loose=!0:/\n *\n *$/.test(y)&&(x=!0));let q=null,F;this.options.gfm&&(q=/^\[[ xX]\] /.exec(m),q&&(F=q[0]!=="[ ] ",m=m.replace(/^\[[ xX]\] +/,""))),d.items.push({type:"list_item",raw:y,task:!!q,checked:F,loose:!1,text:m,tokens:[]}),d.raw+=y}d.items[d.items.length-1].raw=y.trimEnd(),d.items[d.items.length-1].text=m.trimEnd(),d.raw=d.raw.trimEnd();for(let S=0;S<d.items.length;S++)if(this.lexer.state.top=!1,d.items[S].tokens=this.lexer.blockTokens(d.items[S].text,[]),!d.loose){const A=d.items[S].tokens.filter(W=>W.type==="space"),E=A.length>0&&A.some(W=>/\n.*\n/.test(W.raw));d.loose=E}if(d.loose)for(let S=0;S<d.items.length;S++)d.items[S].loose=!0;return d}}html(n){const a=this.rules.block.html.exec(n);if(a)return{type:"html",block:!0,raw:a[0],pre:a[1]==="pre"||a[1]==="script"||a[1]==="style",text:a[0]}}def(n){const a=this.rules.block.def.exec(n);if(a){const o=a[1].toLowerCase().replace(/\s+/g," "),f=a[2]?a[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",d=a[3]?a[3].substring(1,a[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):a[3];return{type:"def",tag:o,raw:a[0],href:f,title:d}}}table(n){const a=this.rules.block.table.exec(n);if(!a||!/[:|]/.test(a[2]))return;const o=yo(a[1]),f=a[2].replace(/^\||\| *$/g,"").split("|"),d=a[3]&&a[3].trim()?a[3].replace(/\n[ \t]*$/,"").split(`
37
- `):[],p={type:"table",raw:a[0],header:[],align:[],rows:[]};if(o.length===f.length){for(const y of f)/^ *-+: *$/.test(y)?p.align.push("right"):/^ *:-+: *$/.test(y)?p.align.push("center"):/^ *:-+ *$/.test(y)?p.align.push("left"):p.align.push(null);for(const y of o)p.header.push({text:y,tokens:this.lexer.inline(y)});for(const y of d)p.rows.push(yo(y,p.header.length).map(m=>({text:m,tokens:this.lexer.inline(m)})));return p}}lheading(n){const a=this.rules.block.lheading.exec(n);if(a)return{type:"heading",raw:a[0],depth:a[2].charAt(0)==="="?1:2,text:a[1],tokens:this.lexer.inline(a[1])}}paragraph(n){const a=this.rules.block.paragraph.exec(n);if(a){const o=a[1].charAt(a[1].length-1)===`
38
- `?a[1].slice(0,-1):a[1];return{type:"paragraph",raw:a[0],text:o,tokens:this.lexer.inline(o)}}}text(n){const a=this.rules.block.text.exec(n);if(a)return{type:"text",raw:a[0],text:a[0],tokens:this.lexer.inline(a[0])}}escape(n){const a=this.rules.inline.escape.exec(n);if(a)return{type:"escape",raw:a[0],text:jt(a[1])}}tag(n){const a=this.rules.inline.tag.exec(n);if(a)return!this.lexer.state.inLink&&/^<a /i.test(a[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(a[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(a[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(a[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:a[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:a[0]}}link(n){const a=this.rules.inline.link.exec(n);if(a){const o=a[2].trim();if(!this.options.pedantic&&/^</.test(o)){if(!/>$/.test(o))return;const p=$i(o.slice(0,-1),"\\");if((o.length-p.length)%2===0)return}else{const p=rc(a[2],"()");if(p>-1){const m=(a[0].indexOf("!")===0?5:4)+a[1].length+p;a[2]=a[2].substring(0,p),a[0]=a[0].substring(0,m).trim(),a[3]=""}}let f=a[2],d="";if(this.options.pedantic){const p=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(f);p&&(f=p[1],d=p[3])}else d=a[3]?a[3].slice(1,-1):"";return f=f.trim(),/^</.test(f)&&(this.options.pedantic&&!/>$/.test(o)?f=f.slice(1):f=f.slice(1,-1)),bo(a,{href:f&&f.replace(this.rules.inline.anyPunctuation,"$1"),title:d&&d.replace(this.rules.inline.anyPunctuation,"$1")},a[0],this.lexer)}}reflink(n,a){let o;if((o=this.rules.inline.reflink.exec(n))||(o=this.rules.inline.nolink.exec(n))){const f=(o[2]||o[1]).replace(/\s+/g," "),d=a[f.toLowerCase()];if(!d){const p=o[0].charAt(0);return{type:"text",raw:p,text:p}}return bo(o,d,o[0],this.lexer)}}emStrong(n,a,o=""){let f=this.rules.inline.emStrongLDelim.exec(n);if(!f||f[3]&&o.match(/[\p{L}\p{N}]/u))return;if(!(f[1]||f[2]||"")||!o||this.rules.inline.punctuation.exec(o)){const p=[...f[0]].length-1;let y,m,x=p,S=0;const A=f[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(A.lastIndex=0,a=a.slice(-1*n.length+p);(f=A.exec(a))!=null;){if(y=f[1]||f[2]||f[3]||f[4]||f[5]||f[6],!y)continue;if(m=[...y].length,f[3]||f[4]){x+=m;continue}else if((f[5]||f[6])&&p%3&&!((p+m)%3)){S+=m;continue}if(x-=m,x>0)continue;m=Math.min(m,m+x+S);const E=[...f[0]][0].length,W=n.slice(0,p+f.index+E+m);if(Math.min(p,m)%2){const q=W.slice(1,-1);return{type:"em",raw:W,text:q,tokens:this.lexer.inlineTokens(q)}}const B=W.slice(2,-2);return{type:"strong",raw:W,text:B,tokens:this.lexer.inlineTokens(B)}}}}codespan(n){const a=this.rules.inline.code.exec(n);if(a){let o=a[2].replace(/\n/g," ");const f=/[^ ]/.test(o),d=/^ /.test(o)&&/ $/.test(o);return f&&d&&(o=o.substring(1,o.length-1)),o=jt(o,!0),{type:"codespan",raw:a[0],text:o}}}br(n){const a=this.rules.inline.br.exec(n);if(a)return{type:"br",raw:a[0]}}del(n){const a=this.rules.inline.del.exec(n);if(a)return{type:"del",raw:a[0],text:a[2],tokens:this.lexer.inlineTokens(a[2])}}autolink(n){const a=this.rules.inline.autolink.exec(n);if(a){let o,f;return a[2]==="@"?(o=jt(a[1]),f="mailto:"+o):(o=jt(a[1]),f=o),{type:"link",raw:a[0],text:o,href:f,tokens:[{type:"text",raw:o,text:o}]}}}url(n){var o;let a;if(a=this.rules.inline.url.exec(n)){let f,d;if(a[2]==="@")f=jt(a[0]),d="mailto:"+f;else{let p;do p=a[0],a[0]=((o=this.rules.inline._backpedal.exec(a[0]))==null?void 0:o[0])??"";while(p!==a[0]);f=jt(a[0]),a[1]==="www."?d="http://"+a[0]:d=a[0]}return{type:"link",raw:a[0],text:f,href:d,tokens:[{type:"text",raw:f,text:f}]}}}inlineText(n){const a=this.rules.inline.text.exec(n);if(a){let o;return this.lexer.state.inRawBlock?o=a[0]:o=jt(a[0]),{type:"text",raw:a[0],text:o}}}}const ac=/^(?: *(?:\n|$))+/,sc=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,oc=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Vr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,lc=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,xo=/(?:[*+-]|\d{1,9}[.)])/,wo=je(/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,xo).getRegex(),za=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,uc=/^[^\n]+/,$a=/(?!\s*\])(?:\\.|[^\[\]\\])+/,fc=je(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",$a).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),cc=je(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,xo).getRegex(),Hi="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ba=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,hc=je("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",Ba).replace("tag",Hi).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ko=je(za).replace("hr",Vr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Hi).getRegex(),Ha={blockquote:je(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ko).getRegex(),code:sc,def:fc,fences:oc,heading:lc,hr:Vr,html:hc,lheading:wo,list:cc,newline:ac,paragraph:ko,table:Yr,text:uc},So=je("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Vr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Hi).getRegex(),dc={...Ha,table:So,paragraph:je(za).replace("hr",Vr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",So).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Hi).getRegex()},pc={...Ha,html:je(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ba).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Yr,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:je(za).replace("hr",Vr).replace("heading",` *#{1,6} *[^
39
- ]`).replace("lheading",wo).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Co=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,gc=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,To=/^( {2,}|\\)\n(?!\s*$)/,mc=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Jr="\\p{P}$+<=>`^|~",vc=je(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,Jr).getRegex(),yc=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,bc=je(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,Jr).getRegex(),xc=je("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,Jr).getRegex(),wc=je("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,Jr).getRegex(),kc=je(/\\([punct])/,"gu").replace(/punct/g,Jr).getRegex(),Sc=je(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Cc=je(Ba).replace("(?:-->|$)","-->").getRegex(),Tc=je("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Cc).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Wi=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,_c=je(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Wi).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),_o=je(/^!?\[(label)\]\[(ref)\]/).replace("label",Wi).replace("ref",$a).getRegex(),Lo=je(/^!?\[(ref)\](?:\[\])?/).replace("ref",$a).getRegex(),Lc=je("reflink|nolink(?!\\()","g").replace("reflink",_o).replace("nolink",Lo).getRegex(),Wa={_backpedal:Yr,anyPunctuation:kc,autolink:Sc,blockSkip:yc,br:To,code:gc,del:Yr,emStrongLDelim:bc,emStrongRDelimAst:xc,emStrongRDelimUnd:wc,escape:Co,link:_c,nolink:Lo,punctuation:vc,reflink:_o,reflinkSearch:Lc,tag:Tc,text:mc,url:Yr},Ec={...Wa,link:je(/^!?\[(label)\]\((.*?)\)/).replace("label",Wi).getRegex(),reflink:je(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Wi).getRegex()},ja={...Wa,escape:je(Co).replace("])","~|])").getRegex(),url:je(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Dc={...ja,br:je(To).replace("{2,}","*").getRegex(),text:je(ja.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ji={normal:Ha,gfm:dc,pedantic:pc},Qr={normal:Wa,gfm:ja,breaks:Dc,pedantic:Ec};class dn{constructor(n){Je(this,"tokens");Je(this,"options");Je(this,"state");Je(this,"tokenizer");Je(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=n||Xn,this.options.tokenizer=this.options.tokenizer||new Bi,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const a={block:ji.normal,inline:Qr.normal};this.options.pedantic?(a.block=ji.pedantic,a.inline=Qr.pedantic):this.options.gfm&&(a.block=ji.gfm,this.options.breaks?a.inline=Qr.breaks:a.inline=Qr.gfm),this.tokenizer.rules=a}static get rules(){return{block:ji,inline:Qr}}static lex(n,a){return new dn(a).lex(n)}static lexInline(n,a){return new dn(a).inlineTokens(n)}lex(n){n=n.replace(/\r\n|\r/g,`
36
+ `,n=n.substring(ne.length+1),A=E.slice(H)}}d.loose||(x?d.loose=!0:/\n *\n *$/.test(y)&&(x=!0));let U=null,F;this.options.gfm&&(U=/^\[[ xX]\] /.exec(m),U&&(F=U[0]!=="[ ] ",m=m.replace(/^\[[ xX]\] +/,""))),d.items.push({type:"list_item",raw:y,task:!!U,checked:F,loose:!1,text:m,tokens:[]}),d.raw+=y}d.items[d.items.length-1].raw=y.trimEnd(),d.items[d.items.length-1].text=m.trimEnd(),d.raw=d.raw.trimEnd();for(let S=0;S<d.items.length;S++)if(this.lexer.state.top=!1,d.items[S].tokens=this.lexer.blockTokens(d.items[S].text,[]),!d.loose){const A=d.items[S].tokens.filter(H=>H.type==="space"),E=A.length>0&&A.some(H=>/\n.*\n/.test(H.raw));d.loose=E}if(d.loose)for(let S=0;S<d.items.length;S++)d.items[S].loose=!0;return d}}html(n){const a=this.rules.block.html.exec(n);if(a)return{type:"html",block:!0,raw:a[0],pre:a[1]==="pre"||a[1]==="script"||a[1]==="style",text:a[0]}}def(n){const a=this.rules.block.def.exec(n);if(a){const o=a[1].toLowerCase().replace(/\s+/g," "),f=a[2]?a[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",d=a[3]?a[3].substring(1,a[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):a[3];return{type:"def",tag:o,raw:a[0],href:f,title:d}}}table(n){const a=this.rules.block.table.exec(n);if(!a||!/[:|]/.test(a[2]))return;const o=wo(a[1]),f=a[2].replace(/^\||\| *$/g,"").split("|"),d=a[3]&&a[3].trim()?a[3].replace(/\n[ \t]*$/,"").split(`
37
+ `):[],p={type:"table",raw:a[0],header:[],align:[],rows:[]};if(o.length===f.length){for(const y of f)/^ *-+: *$/.test(y)?p.align.push("right"):/^ *:-+: *$/.test(y)?p.align.push("center"):/^ *:-+ *$/.test(y)?p.align.push("left"):p.align.push(null);for(const y of o)p.header.push({text:y,tokens:this.lexer.inline(y)});for(const y of d)p.rows.push(wo(y,p.header.length).map(m=>({text:m,tokens:this.lexer.inline(m)})));return p}}lheading(n){const a=this.rules.block.lheading.exec(n);if(a)return{type:"heading",raw:a[0],depth:a[2].charAt(0)==="="?1:2,text:a[1],tokens:this.lexer.inline(a[1])}}paragraph(n){const a=this.rules.block.paragraph.exec(n);if(a){const o=a[1].charAt(a[1].length-1)===`
38
+ `?a[1].slice(0,-1):a[1];return{type:"paragraph",raw:a[0],text:o,tokens:this.lexer.inline(o)}}}text(n){const a=this.rules.block.text.exec(n);if(a)return{type:"text",raw:a[0],text:a[0],tokens:this.lexer.inline(a[0])}}escape(n){const a=this.rules.inline.escape.exec(n);if(a)return{type:"escape",raw:a[0],text:jt(a[1])}}tag(n){const a=this.rules.inline.tag.exec(n);if(a)return!this.lexer.state.inLink&&/^<a /i.test(a[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(a[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(a[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(a[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:a[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:a[0]}}link(n){const a=this.rules.inline.link.exec(n);if(a){const o=a[2].trim();if(!this.options.pedantic&&/^</.test(o)){if(!/>$/.test(o))return;const p=$i(o.slice(0,-1),"\\");if((o.length-p.length)%2===0)return}else{const p=ac(a[2],"()");if(p>-1){const m=(a[0].indexOf("!")===0?5:4)+a[1].length+p;a[2]=a[2].substring(0,p),a[0]=a[0].substring(0,m).trim(),a[3]=""}}let f=a[2],d="";if(this.options.pedantic){const p=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(f);p&&(f=p[1],d=p[3])}else d=a[3]?a[3].slice(1,-1):"";return f=f.trim(),/^</.test(f)&&(this.options.pedantic&&!/>$/.test(o)?f=f.slice(1):f=f.slice(1,-1)),ko(a,{href:f&&f.replace(this.rules.inline.anyPunctuation,"$1"),title:d&&d.replace(this.rules.inline.anyPunctuation,"$1")},a[0],this.lexer)}}reflink(n,a){let o;if((o=this.rules.inline.reflink.exec(n))||(o=this.rules.inline.nolink.exec(n))){const f=(o[2]||o[1]).replace(/\s+/g," "),d=a[f.toLowerCase()];if(!d){const p=o[0].charAt(0);return{type:"text",raw:p,text:p}}return ko(o,d,o[0],this.lexer)}}emStrong(n,a,o=""){let f=this.rules.inline.emStrongLDelim.exec(n);if(!f||f[3]&&o.match(/[\p{L}\p{N}]/u))return;if(!(f[1]||f[2]||"")||!o||this.rules.inline.punctuation.exec(o)){const p=[...f[0]].length-1;let y,m,x=p,S=0;const A=f[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(A.lastIndex=0,a=a.slice(-1*n.length+p);(f=A.exec(a))!=null;){if(y=f[1]||f[2]||f[3]||f[4]||f[5]||f[6],!y)continue;if(m=[...y].length,f[3]||f[4]){x+=m;continue}else if((f[5]||f[6])&&p%3&&!((p+m)%3)){S+=m;continue}if(x-=m,x>0)continue;m=Math.min(m,m+x+S);const E=[...f[0]][0].length,H=n.slice(0,p+f.index+E+m);if(Math.min(p,m)%2){const U=H.slice(1,-1);return{type:"em",raw:H,text:U,tokens:this.lexer.inlineTokens(U)}}const B=H.slice(2,-2);return{type:"strong",raw:H,text:B,tokens:this.lexer.inlineTokens(B)}}}}codespan(n){const a=this.rules.inline.code.exec(n);if(a){let o=a[2].replace(/\n/g," ");const f=/[^ ]/.test(o),d=/^ /.test(o)&&/ $/.test(o);return f&&d&&(o=o.substring(1,o.length-1)),o=jt(o,!0),{type:"codespan",raw:a[0],text:o}}}br(n){const a=this.rules.inline.br.exec(n);if(a)return{type:"br",raw:a[0]}}del(n){const a=this.rules.inline.del.exec(n);if(a)return{type:"del",raw:a[0],text:a[2],tokens:this.lexer.inlineTokens(a[2])}}autolink(n){const a=this.rules.inline.autolink.exec(n);if(a){let o,f;return a[2]==="@"?(o=jt(a[1]),f="mailto:"+o):(o=jt(a[1]),f=o),{type:"link",raw:a[0],text:o,href:f,tokens:[{type:"text",raw:o,text:o}]}}}url(n){var o;let a;if(a=this.rules.inline.url.exec(n)){let f,d;if(a[2]==="@")f=jt(a[0]),d="mailto:"+f;else{let p;do p=a[0],a[0]=((o=this.rules.inline._backpedal.exec(a[0]))==null?void 0:o[0])??"";while(p!==a[0]);f=jt(a[0]),a[1]==="www."?d="http://"+a[0]:d=a[0]}return{type:"link",raw:a[0],text:f,href:d,tokens:[{type:"text",raw:f,text:f}]}}}inlineText(n){const a=this.rules.inline.text.exec(n);if(a){let o;return this.lexer.state.inRawBlock?o=a[0]:o=jt(a[0]),{type:"text",raw:a[0],text:o}}}}const oc=/^(?: *(?:\n|$))+/,lc=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,uc=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Vr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,fc=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,So=/(?:[*+-]|\d{1,9}[.)])/,Co=je(/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,So).getRegex(),za=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,cc=/^[^\n]+/,$a=/(?!\s*\])(?:\\.|[^\[\]\\])+/,hc=je(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",$a).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),dc=je(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,So).getRegex(),Hi="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ba=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,pc=je("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",Ba).replace("tag",Hi).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),To=je(za).replace("hr",Vr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Hi).getRegex(),Ha={blockquote:je(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",To).getRegex(),code:lc,def:hc,fences:uc,heading:fc,hr:Vr,html:pc,lheading:Co,list:dc,newline:oc,paragraph:To,table:Yr,text:cc},_o=je("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Vr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Hi).getRegex(),gc={...Ha,table:_o,paragraph:je(za).replace("hr",Vr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",_o).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Hi).getRegex()},mc={...Ha,html:je(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ba).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Yr,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:je(za).replace("hr",Vr).replace("heading",` *#{1,6} *[^
39
+ ]`).replace("lheading",Co).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Lo=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,vc=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Eo=/^( {2,}|\\)\n(?!\s*$)/,yc=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Jr="\\p{P}$+<=>`^|~",bc=je(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,Jr).getRegex(),xc=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,wc=je(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,Jr).getRegex(),kc=je("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,Jr).getRegex(),Sc=je("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,Jr).getRegex(),Cc=je(/\\([punct])/,"gu").replace(/punct/g,Jr).getRegex(),Tc=je(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),_c=je(Ba).replace("(?:-->|$)","-->").getRegex(),Lc=je("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",_c).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Wi=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Ec=je(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Wi).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Do=je(/^!?\[(label)\]\[(ref)\]/).replace("label",Wi).replace("ref",$a).getRegex(),Ao=je(/^!?\[(ref)\](?:\[\])?/).replace("ref",$a).getRegex(),Dc=je("reflink|nolink(?!\\()","g").replace("reflink",Do).replace("nolink",Ao).getRegex(),Wa={_backpedal:Yr,anyPunctuation:Cc,autolink:Tc,blockSkip:xc,br:Eo,code:vc,del:Yr,emStrongLDelim:wc,emStrongRDelimAst:kc,emStrongRDelimUnd:Sc,escape:Lo,link:Ec,nolink:Ao,punctuation:bc,reflink:Do,reflinkSearch:Dc,tag:Lc,text:yc,url:Yr},Ac={...Wa,link:je(/^!?\[(label)\]\((.*?)\)/).replace("label",Wi).getRegex(),reflink:je(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Wi).getRegex()},ja={...Wa,escape:je(Lo).replace("])","~|])").getRegex(),url:je(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Ic={...ja,br:je(Eo).replace("{2,}","*").getRegex(),text:je(ja.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ji={normal:Ha,gfm:gc,pedantic:mc},Qr={normal:Wa,gfm:ja,breaks:Ic,pedantic:Ac};class pn{constructor(n){Je(this,"tokens");Je(this,"options");Je(this,"state");Je(this,"tokenizer");Je(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=n||Xn,this.options.tokenizer=this.options.tokenizer||new Bi,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const a={block:ji.normal,inline:Qr.normal};this.options.pedantic?(a.block=ji.pedantic,a.inline=Qr.pedantic):this.options.gfm&&(a.block=ji.gfm,this.options.breaks?a.inline=Qr.breaks:a.inline=Qr.gfm),this.tokenizer.rules=a}static get rules(){return{block:ji,inline:Qr}}static lex(n,a){return new pn(a).lex(n)}static lexInline(n,a){return new pn(a).inlineTokens(n)}lex(n){n=n.replace(/\r\n|\r/g,`
40
40
  `),this.blockTokens(n,this.tokens);for(let a=0;a<this.inlineQueue.length;a++){const o=this.inlineQueue[a];this.inlineTokens(o.src,o.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(n,a=[]){this.options.pedantic?n=n.replace(/\t/g," ").replace(/^ +$/gm,""):n=n.replace(/^( *)(\t+)/gm,(y,m,x)=>m+" ".repeat(x.length));let o,f,d,p;for(;n;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(y=>(o=y.call({lexer:this},n,a))?(n=n.substring(o.raw.length),a.push(o),!0):!1))){if(o=this.tokenizer.space(n)){n=n.substring(o.raw.length),o.raw.length===1&&a.length>0?a[a.length-1].raw+=`
41
41
  `:a.push(o);continue}if(o=this.tokenizer.code(n)){n=n.substring(o.raw.length),f=a[a.length-1],f&&(f.type==="paragraph"||f.type==="text")?(f.raw+=`
42
42
  `+o.raw,f.text+=`
@@ -46,7 +46,7 @@ b`.split(/\n/).length!=3?function(e){for(var t=0,i=[],r=e.length;t<=r;){var s=e.
46
46
  `+o.raw,f.text+=`
47
47
  `+o.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=f.text):a.push(o),p=d.length!==n.length,n=n.substring(o.raw.length);continue}if(o=this.tokenizer.text(n)){n=n.substring(o.raw.length),f=a[a.length-1],f&&f.type==="text"?(f.raw+=`
48
48
  `+o.raw,f.text+=`
49
- `+o.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=f.text):a.push(o);continue}if(n){const y="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(y);break}else throw new Error(y)}}return this.state.top=!0,a}inline(n,a=[]){return this.inlineQueue.push({src:n,tokens:a}),a}inlineTokens(n,a=[]){let o,f,d,p=n,y,m,x;if(this.tokens.links){const S=Object.keys(this.tokens.links);if(S.length>0)for(;(y=this.tokenizer.rules.inline.reflinkSearch.exec(p))!=null;)S.includes(y[0].slice(y[0].lastIndexOf("[")+1,-1))&&(p=p.slice(0,y.index)+"["+"a".repeat(y[0].length-2)+"]"+p.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(y=this.tokenizer.rules.inline.blockSkip.exec(p))!=null;)p=p.slice(0,y.index)+"["+"a".repeat(y[0].length-2)+"]"+p.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(y=this.tokenizer.rules.inline.anyPunctuation.exec(p))!=null;)p=p.slice(0,y.index)+"++"+p.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;n;)if(m||(x=""),m=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(S=>(o=S.call({lexer:this},n,a))?(n=n.substring(o.raw.length),a.push(o),!0):!1))){if(o=this.tokenizer.escape(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.tag(n)){n=n.substring(o.raw.length),f=a[a.length-1],f&&o.type==="text"&&f.type==="text"?(f.raw+=o.raw,f.text+=o.text):a.push(o);continue}if(o=this.tokenizer.link(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.reflink(n,this.tokens.links)){n=n.substring(o.raw.length),f=a[a.length-1],f&&o.type==="text"&&f.type==="text"?(f.raw+=o.raw,f.text+=o.text):a.push(o);continue}if(o=this.tokenizer.emStrong(n,p,x)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.codespan(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.br(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.del(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.autolink(n)){n=n.substring(o.raw.length),a.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(n))){n=n.substring(o.raw.length),a.push(o);continue}if(d=n,this.options.extensions&&this.options.extensions.startInline){let S=1/0;const A=n.slice(1);let E;this.options.extensions.startInline.forEach(W=>{E=W.call({lexer:this},A),typeof E=="number"&&E>=0&&(S=Math.min(S,E))}),S<1/0&&S>=0&&(d=n.substring(0,S+1))}if(o=this.tokenizer.inlineText(d)){n=n.substring(o.raw.length),o.raw.slice(-1)!=="_"&&(x=o.raw.slice(-1)),m=!0,f=a[a.length-1],f&&f.type==="text"?(f.raw+=o.raw,f.text+=o.text):a.push(o);continue}if(n){const S="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(S);break}else throw new Error(S)}}return a}}class Ui{constructor(n){Je(this,"options");this.options=n||Xn}code(n,a,o){var d;const f=(d=(a||"").match(/^\S*/))==null?void 0:d[0];return n=n.replace(/\n$/,"")+`
49
+ `+o.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=f.text):a.push(o);continue}if(n){const y="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(y);break}else throw new Error(y)}}return this.state.top=!0,a}inline(n,a=[]){return this.inlineQueue.push({src:n,tokens:a}),a}inlineTokens(n,a=[]){let o,f,d,p=n,y,m,x;if(this.tokens.links){const S=Object.keys(this.tokens.links);if(S.length>0)for(;(y=this.tokenizer.rules.inline.reflinkSearch.exec(p))!=null;)S.includes(y[0].slice(y[0].lastIndexOf("[")+1,-1))&&(p=p.slice(0,y.index)+"["+"a".repeat(y[0].length-2)+"]"+p.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(y=this.tokenizer.rules.inline.blockSkip.exec(p))!=null;)p=p.slice(0,y.index)+"["+"a".repeat(y[0].length-2)+"]"+p.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(y=this.tokenizer.rules.inline.anyPunctuation.exec(p))!=null;)p=p.slice(0,y.index)+"++"+p.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;n;)if(m||(x=""),m=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(S=>(o=S.call({lexer:this},n,a))?(n=n.substring(o.raw.length),a.push(o),!0):!1))){if(o=this.tokenizer.escape(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.tag(n)){n=n.substring(o.raw.length),f=a[a.length-1],f&&o.type==="text"&&f.type==="text"?(f.raw+=o.raw,f.text+=o.text):a.push(o);continue}if(o=this.tokenizer.link(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.reflink(n,this.tokens.links)){n=n.substring(o.raw.length),f=a[a.length-1],f&&o.type==="text"&&f.type==="text"?(f.raw+=o.raw,f.text+=o.text):a.push(o);continue}if(o=this.tokenizer.emStrong(n,p,x)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.codespan(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.br(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.del(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.autolink(n)){n=n.substring(o.raw.length),a.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(n))){n=n.substring(o.raw.length),a.push(o);continue}if(d=n,this.options.extensions&&this.options.extensions.startInline){let S=1/0;const A=n.slice(1);let E;this.options.extensions.startInline.forEach(H=>{E=H.call({lexer:this},A),typeof E=="number"&&E>=0&&(S=Math.min(S,E))}),S<1/0&&S>=0&&(d=n.substring(0,S+1))}if(o=this.tokenizer.inlineText(d)){n=n.substring(o.raw.length),o.raw.slice(-1)!=="_"&&(x=o.raw.slice(-1)),m=!0,f=a[a.length-1],f&&f.type==="text"?(f.raw+=o.raw,f.text+=o.text):a.push(o);continue}if(n){const S="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(S);break}else throw new Error(S)}}return a}}class qi{constructor(n){Je(this,"options");this.options=n||Xn}code(n,a,o){var d;const f=(d=(a||"").match(/^\S*/))==null?void 0:d[0];return n=n.replace(/\n$/,"")+`
50
50
  `,f?'<pre><code class="language-'+jt(f)+'">'+(o?n:jt(n,!0))+`</code></pre>
51
51
  `:"<pre><code>"+(o?n:jt(n,!0))+`</code></pre>
52
52
  `}blockquote(n){return`<blockquote>
@@ -64,9 +64,9 @@ ${n}</blockquote>
64
64
  `}tablerow(n){return`<tr>
65
65
  ${n}</tr>
66
66
  `}tablecell(n,a){const o=a.header?"th":"td";return(a.align?`<${o} align="${a.align}">`:`<${o}>`)+n+`</${o}>
67
- `}strong(n){return`<strong>${n}</strong>`}em(n){return`<em>${n}</em>`}codespan(n){return`<code>${n}</code>`}br(){return"<br>"}del(n){return`<del>${n}</del>`}link(n,a,o){const f=vo(n);if(f===null)return o;n=f;let d='<a href="'+n+'"';return a&&(d+=' title="'+a+'"'),d+=">"+o+"</a>",d}image(n,a,o){const f=vo(n);if(f===null)return o;n=f;let d=`<img src="${n}" alt="${o}"`;return a&&(d+=` title="${a}"`),d+=">",d}text(n){return n}}class Ua{strong(n){return n}em(n){return n}codespan(n){return n}del(n){return n}html(n){return n}text(n){return n}link(n,a,o){return""+o}image(n,a,o){return""+o}br(){return""}}class pn{constructor(n){Je(this,"options");Je(this,"renderer");Je(this,"textRenderer");this.options=n||Xn,this.options.renderer=this.options.renderer||new Ui,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ua}static parse(n,a){return new pn(a).parse(n)}static parseInline(n,a){return new pn(a).parseInline(n)}parse(n,a=!0){let o="";for(let f=0;f<n.length;f++){const d=n[f];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[d.type]){const p=d,y=this.options.extensions.renderers[p.type].call({parser:this},p);if(y!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(p.type)){o+=y||"";continue}}switch(d.type){case"space":continue;case"hr":{o+=this.renderer.hr();continue}case"heading":{const p=d;o+=this.renderer.heading(this.parseInline(p.tokens),p.depth,tc(this.parseInline(p.tokens,this.textRenderer)));continue}case"code":{const p=d;o+=this.renderer.code(p.text,p.lang,!!p.escaped);continue}case"table":{const p=d;let y="",m="";for(let S=0;S<p.header.length;S++)m+=this.renderer.tablecell(this.parseInline(p.header[S].tokens),{header:!0,align:p.align[S]});y+=this.renderer.tablerow(m);let x="";for(let S=0;S<p.rows.length;S++){const A=p.rows[S];m="";for(let E=0;E<A.length;E++)m+=this.renderer.tablecell(this.parseInline(A[E].tokens),{header:!1,align:p.align[E]});x+=this.renderer.tablerow(m)}o+=this.renderer.table(y,x);continue}case"blockquote":{const p=d,y=this.parse(p.tokens);o+=this.renderer.blockquote(y);continue}case"list":{const p=d,y=p.ordered,m=p.start,x=p.loose;let S="";for(let A=0;A<p.items.length;A++){const E=p.items[A],W=E.checked,B=E.task;let q="";if(E.task){const F=this.renderer.checkbox(!!W);x?E.tokens.length>0&&E.tokens[0].type==="paragraph"?(E.tokens[0].text=F+" "+E.tokens[0].text,E.tokens[0].tokens&&E.tokens[0].tokens.length>0&&E.tokens[0].tokens[0].type==="text"&&(E.tokens[0].tokens[0].text=F+" "+E.tokens[0].tokens[0].text)):E.tokens.unshift({type:"text",text:F+" "}):q+=F+" "}q+=this.parse(E.tokens,x),S+=this.renderer.listitem(q,B,!!W)}o+=this.renderer.list(S,y,m);continue}case"html":{const p=d;o+=this.renderer.html(p.text,p.block);continue}case"paragraph":{const p=d;o+=this.renderer.paragraph(this.parseInline(p.tokens));continue}case"text":{let p=d,y=p.tokens?this.parseInline(p.tokens):p.text;for(;f+1<n.length&&n[f+1].type==="text";)p=n[++f],y+=`
68
- `+(p.tokens?this.parseInline(p.tokens):p.text);o+=a?this.renderer.paragraph(y):y;continue}default:{const p='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(p),"";throw new Error(p)}}}return o}parseInline(n,a){a=a||this.renderer;let o="";for(let f=0;f<n.length;f++){const d=n[f];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[d.type]){const p=this.options.extensions.renderers[d.type].call({parser:this},d);if(p!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(d.type)){o+=p||"";continue}}switch(d.type){case"escape":{const p=d;o+=a.text(p.text);break}case"html":{const p=d;o+=a.html(p.text);break}case"link":{const p=d;o+=a.link(p.href,p.title,this.parseInline(p.tokens,a));break}case"image":{const p=d;o+=a.image(p.href,p.title,p.text);break}case"strong":{const p=d;o+=a.strong(this.parseInline(p.tokens,a));break}case"em":{const p=d;o+=a.em(this.parseInline(p.tokens,a));break}case"codespan":{const p=d;o+=a.codespan(p.text);break}case"br":{o+=a.br();break}case"del":{const p=d;o+=a.del(this.parseInline(p.tokens,a));break}case"text":{const p=d;o+=a.text(p.text);break}default:{const p='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(p),"";throw new Error(p)}}}return o}}class Zr{constructor(n){Je(this,"options");this.options=n||Xn}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}}Je(Zr,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class Ac{constructor(...n){qf(this,Qn);Je(this,"defaults",Pa());Je(this,"options",this.setOptions);Je(this,"parse",Ra(this,Qn,so).call(this,dn.lex,pn.parse));Je(this,"parseInline",Ra(this,Qn,so).call(this,dn.lexInline,pn.parseInline));Je(this,"Parser",pn);Je(this,"Renderer",Ui);Je(this,"TextRenderer",Ua);Je(this,"Lexer",dn);Je(this,"Tokenizer",Bi);Je(this,"Hooks",Zr);this.use(...n)}walkTokens(n,a){var f,d;let o=[];for(const p of n)switch(o=o.concat(a.call(this,p)),p.type){case"table":{const y=p;for(const m of y.header)o=o.concat(this.walkTokens(m.tokens,a));for(const m of y.rows)for(const x of m)o=o.concat(this.walkTokens(x.tokens,a));break}case"list":{const y=p;o=o.concat(this.walkTokens(y.items,a));break}default:{const y=p;(d=(f=this.defaults.extensions)==null?void 0:f.childTokens)!=null&&d[y.type]?this.defaults.extensions.childTokens[y.type].forEach(m=>{const x=y[m].flat(1/0);o=o.concat(this.walkTokens(x,a))}):y.tokens&&(o=o.concat(this.walkTokens(y.tokens,a)))}}return o}use(...n){const a=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(o=>{const f={...o};if(f.async=this.defaults.async||f.async||!1,o.extensions&&(o.extensions.forEach(d=>{if(!d.name)throw new Error("extension name required");if("renderer"in d){const p=a.renderers[d.name];p?a.renderers[d.name]=function(...y){let m=d.renderer.apply(this,y);return m===!1&&(m=p.apply(this,y)),m}:a.renderers[d.name]=d.renderer}if("tokenizer"in d){if(!d.level||d.level!=="block"&&d.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const p=a[d.level];p?p.unshift(d.tokenizer):a[d.level]=[d.tokenizer],d.start&&(d.level==="block"?a.startBlock?a.startBlock.push(d.start):a.startBlock=[d.start]:d.level==="inline"&&(a.startInline?a.startInline.push(d.start):a.startInline=[d.start]))}"childTokens"in d&&d.childTokens&&(a.childTokens[d.name]=d.childTokens)}),f.extensions=a),o.renderer){const d=this.defaults.renderer||new Ui(this.defaults);for(const p in o.renderer){if(!(p in d))throw new Error(`renderer '${p}' does not exist`);if(p==="options")continue;const y=p,m=o.renderer[y],x=d[y];d[y]=(...S)=>{let A=m.apply(d,S);return A===!1&&(A=x.apply(d,S)),A||""}}f.renderer=d}if(o.tokenizer){const d=this.defaults.tokenizer||new Bi(this.defaults);for(const p in o.tokenizer){if(!(p in d))throw new Error(`tokenizer '${p}' does not exist`);if(["options","rules","lexer"].includes(p))continue;const y=p,m=o.tokenizer[y],x=d[y];d[y]=(...S)=>{let A=m.apply(d,S);return A===!1&&(A=x.apply(d,S)),A}}f.tokenizer=d}if(o.hooks){const d=this.defaults.hooks||new Zr;for(const p in o.hooks){if(!(p in d))throw new Error(`hook '${p}' does not exist`);if(p==="options")continue;const y=p,m=o.hooks[y],x=d[y];Zr.passThroughHooks.has(p)?d[y]=S=>{if(this.defaults.async)return Promise.resolve(m.call(d,S)).then(E=>x.call(d,E));const A=m.call(d,S);return x.call(d,A)}:d[y]=(...S)=>{let A=m.apply(d,S);return A===!1&&(A=x.apply(d,S)),A}}f.hooks=d}if(o.walkTokens){const d=this.defaults.walkTokens,p=o.walkTokens;f.walkTokens=function(y){let m=[];return m.push(p.call(this,y)),d&&(m=m.concat(d.call(this,y))),m}}this.defaults={...this.defaults,...f}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,a){return dn.lex(n,a??this.defaults)}parser(n,a){return pn.parse(n,a??this.defaults)}}Qn=new WeakSet,so=function(n,a){return(o,f)=>{const d={...f},p={...this.defaults,...d};this.defaults.async===!0&&d.async===!1&&(p.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),p.async=!0);const y=Ra(this,Qn,Gf).call(this,!!p.silent,!!p.async);if(typeof o>"u"||o===null)return y(new Error("marked(): input parameter is undefined or null"));if(typeof o!="string")return y(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(o)+", string expected"));if(p.hooks&&(p.hooks.options=p),p.async)return Promise.resolve(p.hooks?p.hooks.preprocess(o):o).then(m=>n(m,p)).then(m=>p.hooks?p.hooks.processAllTokens(m):m).then(m=>p.walkTokens?Promise.all(this.walkTokens(m,p.walkTokens)).then(()=>m):m).then(m=>a(m,p)).then(m=>p.hooks?p.hooks.postprocess(m):m).catch(y);try{p.hooks&&(o=p.hooks.preprocess(o));let m=n(o,p);p.hooks&&(m=p.hooks.processAllTokens(m)),p.walkTokens&&this.walkTokens(m,p.walkTokens);let x=a(m,p);return p.hooks&&(x=p.hooks.postprocess(x)),x}catch(m){return y(m)}}},Gf=function(n,a){return o=>{if(o.message+=`
69
- Please report this to https://github.com/markedjs/marked.`,n){const f="<p>An error occurred:</p><pre>"+jt(o.message+"",!0)+"</pre>";return a?Promise.resolve(f):f}if(a)return Promise.reject(o);throw o}};const Yn=new Ac;function Le(u,n){return Yn.parse(u,n)}Le.options=Le.setOptions=function(u){return Yn.setOptions(u),Le.defaults=Yn.defaults,ho(Le.defaults),Le},Le.getDefaults=Pa,Le.defaults=Xn,Le.use=function(...u){return Yn.use(...u),Le.defaults=Yn.defaults,ho(Le.defaults),Le},Le.walkTokens=function(u,n){return Yn.walkTokens(u,n)},Le.parseInline=Yn.parseInline,Le.Parser=pn,Le.parser=pn.parse,Le.Renderer=Ui,Le.TextRenderer=Ua,Le.Lexer=dn,Le.lexer=dn.lex,Le.Tokenizer=Bi,Le.Hooks=Zr,Le.parse=Le,Le.options,Le.setOptions,Le.use,Le.walkTokens,Le.parseInline,pn.parse,dn.lex;function An(u,n,a,o,f,d,p,y){var m=typeof u=="function"?u.options:u;return n&&(m.render=n,m.staticRenderFns=a,m._compiled=!0),d&&(m._scopeId="data-v-"+d),{exports:u,options:m}}const Ic={name:"TimelineHeader",props:{timeRange:{type:String,default:"-"},allExpanded:{type:Boolean,default:!1},viewMode:{type:String,default:"list"}},methods:{handleToggleExpand(){this.$emit("toggle-expand")},handleToggleView(){this.$emit("toggle-view")}}};var Oc=function(){var n=this,a=n._self._c;return a("div",{staticClass:"timeline-header"},[a("div",{staticClass:"time-scale"},[a("span",{staticClass:"time-range"},[n._v(n._s(n.timeRange))])]),a("div",{staticClass:"header-actions"},[n.viewMode==="tree"?a("el-tooltip",{attrs:{content:n.allExpanded?"合上所有节点":"展开所有节点",placement:"top"}},[a("i",{staticClass:"action-icon",class:n.allExpanded?"el-icon-arrow-down":"el-icon-arrow-right",on:{click:n.handleToggleExpand}})]):n._e(),a("el-tooltip",{attrs:{content:n.viewMode==="list"?"切换到树形视图":"切换到列表视图",placement:"top"}},[a("i",{staticClass:"action-icon",class:n.viewMode==="list"?"el-icon-menu":"el-icon-s-operation",on:{click:n.handleToggleView}})])],1)])},Nc=[],Mc=An(Ic,Oc,Nc,!1,null,"a6b357e5");const Rc=Mc.exports,Fc={name:"TimelineBar",props:{barStyle:{type:Object,required:!0},statusDescription:{type:String,default:""},selected:{type:Boolean,default:!1},error:{type:Boolean,default:!1},hasEvents:{type:Boolean,default:!1}}};var Pc=function(){var n=this,a=n._self._c;return a("el-tooltip",{attrs:{content:n.statusDescription,disabled:!n.statusDescription,placement:"top","popper-class":"span-status-tooltip"}},[a("div",{staticClass:"timeline-bar-wrapper"},[a("div",{staticClass:"timeline-bar",class:{selected:n.selected,error:n.error,"has-events":n.hasEvents},style:n.barStyle})])])},zc=[],$c=An(Fc,Pc,zc,!1,null,"52995efa");const Eo=$c.exports;function Do(u){if(!u)return"-";const n=u/1e6;return n<1e3?`${n.toFixed(2)}ms`:n<6e4?`${(n/1e3).toFixed(2)}s`:`${(n/6e4).toFixed(2)}min`}function Ao(u){if(!u)return"-";const n=u/1e6,a=new Date(n),o=a.getFullYear(),f=String(a.getMonth()+1).padStart(2,"0"),d=String(a.getDate()).padStart(2,"0"),p=String(a.getHours()).padStart(2,"0"),y=String(a.getMinutes()).padStart(2,"0"),m=String(a.getSeconds()).padStart(2,"0");return`${o}/${f}/${d} ${p}:${y}:${m}`}function Bc(u,n,a="-"){return!u||!n?"-":`${Ao(u)} ${a} ${Ao(n)}`}function Io(u){return{SERVER:"primary",CHAT_MODEL:"success",LLM:"success",CHAIN:"warning",AGENT:"danger",TOOL:"info",JOB:"warning",FUNCTION:"info"}[u]||"info"}function Oo(u){return u.status_description?u.status_description:""}function No(u,n,a){if(!n||!a||n===a)return{width:"100%"};const o=a-n,f=u.start_time_unix_nano-n,d=u.duration_ns,p=f/o*100,y=d/o*100;return{left:`${p}%`,width:`${y}%`}}const Hc={name:"SpanTreeNode",components:{TimelineBar:Eo},props:{node:{type:Object,required:!0},selected:{type:Boolean,default:!1},selectedSpanId:{type:String,default:null},expandedNodes:{type:Set,required:!0},depth:{type:Number,default:0},traceStartTime:{type:Number,default:0},traceEndTime:{type:Number,default:0}},computed:{hasChildren(){return this.node.children&&this.node.children.length>0},isRootNode(){return this.depth===0},isExpanded(){return this.isRootNode?!0:this.expandedNodes.has(this.node.span_id)},shouldShowChildren(){return this.isRootNode?!0:this.isExpanded},duration(){return Do(this.node.duration_ns)},typeColor(){return Io(this.node.type)},statusDescription(){return Oo(this.node)},barStyle(){return No(this.node,this.traceStartTime,this.traceEndTime)},error(){return this.node.status==="ERROR"},hasEvents(){return this.node.has_events===!0},isChild(){return this.depth>0}},methods:{handleClick(){this.$emit("node-click",this.node)},handleToggleExpand(){this.isRootNode||this.$emit("toggle-expand",this.node)}}};var Wc=function(){var n=this,a=n._self._c;return a("div",[a("div",{staticClass:"timeline-node",class:{selected:n.selected,error:n.error,"child-node":n.isChild},on:{click:n.handleClick}},[a("div",{staticClass:"node-row"},[a("div",{staticClass:"node-info"},[n.hasChildren&&!n.isRootNode?a("i",{staticClass:"expand-icon",class:n.isExpanded?"el-icon-arrow-down":"el-icon-arrow-right",on:{click:function(o){return o.stopPropagation(),n.handleToggleExpand.apply(null,arguments)}}}):n._e(),a("el-tag",{staticClass:"type-tag",attrs:{type:n.typeColor,size:"mini"}},[n._v(" "+n._s(n.node.type)+" ")]),a("el-tooltip",{attrs:{content:n.node.name,placement:"top","open-delay":300}},[a("span",{staticClass:"node-name"},[n._v(n._s(n.node.name))])])],1),a("div",{staticClass:"node-duration"},[n._v(" "+n._s(n.duration)+" ")])]),a("TimelineBar",{attrs:{"bar-style":n.barStyle,"status-description":n.statusDescription,selected:n.selected,error:n.error,"has-events":n.hasEvents}})],1),n.shouldShowChildren&&n.hasChildren?a("div",{staticClass:"children-nodes"},n._l(n.node.children,function(o){return a("SpanTreeNode",{key:o.span_id,attrs:{node:o,selected:o.span_id===n.selectedSpanId,"selected-span-id":n.selectedSpanId,"expanded-nodes":n.expandedNodes,depth:n.depth+1,"trace-start-time":n.traceStartTime,"trace-end-time":n.traceEndTime},on:{"node-click":function(f){return n.$emit("node-click",f)},"toggle-expand":function(f){return n.$emit("toggle-expand",f)}}})}),1):n._e()])},jc=[],Uc=An(Hc,Wc,jc,!1,null,"f181c64c");const qc=Uc.exports,Gc={name:"SpanListNode",components:{TimelineBar:Eo},props:{node:{type:Object,required:!0},selected:{type:Boolean,default:!1},traceStartTime:{type:Number,default:0},traceEndTime:{type:Number,default:0}},computed:{duration(){return Do(this.node.duration_ns)},typeColor(){return Io(this.node.type)},statusDescription(){return Oo(this.node)},barStyle(){return No(this.node,this.traceStartTime,this.traceEndTime)},error(){return this.node.status==="ERROR"},hasEvents(){return this.node.has_events===!0}},methods:{handleClick(){this.$emit("node-click",this.node)}}};var Kc=function(){var n=this,a=n._self._c;return a("div",{staticClass:"timeline-node",class:{selected:n.selected,error:n.error},on:{click:n.handleClick}},[a("div",{staticClass:"node-row"},[a("div",{staticClass:"node-info"},[a("el-tag",{staticClass:"type-tag",attrs:{type:n.typeColor,size:"mini"}},[n._v(" "+n._s(n.node.type)+" ")]),a("el-tooltip",{attrs:{content:n.node.name,placement:"top","open-delay":300}},[a("span",{staticClass:"node-name"},[n._v(n._s(n.node.name))])])],1),a("div",{staticClass:"node-duration"},[n._v(" "+n._s(n.duration)+" ")])]),a("TimelineBar",{attrs:{"bar-style":n.barStyle,"status-description":n.statusDescription,selected:n.selected,error:n.error,"has-events":n.hasEvents}})],1)},Xc=[],Yc=An(Gc,Kc,Xc,!1,null,"860ac868");const Vc=Yc.exports,Jc={name:"TraceSpanTree",components:{TimelineHeader:Rc,SpanTreeNode:qc,SpanListNode:Vc},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:[],allExpanded:!1,viewMode:"list"}},computed:{flatListData(){const u=[],n=a=>{a.forEach(o=>{u.push(o),o.children&&o.children.length>0&&n(o.children)})};return n(this.treeData),u},timeRange(){const u=this.$t?this.$t("trace.to"):"-";return Bc(this.traceStartTime,this.traceEndTime,u)}},watch:{spans:{immediate:!0,handler(){this.buildTree()}}},methods:{buildTree(){if(!this.spans||this.spans.length===0){this.treeData=[];return}const u=new Map,n=[];this.spans.forEach(a=>{u.set(a.span_id,{...a,children:[]})}),this.spans.forEach(a=>{const o=u.get(a.span_id);if(a.parent_span_id){const f=u.get(a.parent_span_id);f?f.children.push(o):n.push(o)}else n.push(o)}),n.forEach(a=>{this.sortChildren(a)}),this.treeData=n,this.expandAllNodes()},expandAllNodes(){const u=new Set,n=a=>{a.forEach(o=>{o.children&&o.children.length>0&&o.children.forEach(f=>{this.hasChildren(f)&&u.add(f.span_id),f.children&&f.children.length>0&&n([f])})})};n(this.treeData),this.expandedNodes=u,this.allExpanded=!0,this.$forceUpdate()},collapseAllNodes(){const u=new Set;this.expandedNodes=u,this.allExpanded=!1,this.$forceUpdate()},toggleAllExpand(){this.allExpanded?this.collapseAllNodes():this.expandAllNodes()},toggleViewMode(){this.viewMode=this.viewMode==="list"?"tree":"list"},sortChildren(u){u.children&&u.children.length>0&&(u.children.sort((n,a)=>n.start_time_unix_nano-a.start_time_unix_nano),u.children.forEach(n=>this.sortChildren(n)))},handleNodeClick(u){this.$emit("span-select",u)},hasChildren(u){return u.children&&u.children.length>0},toggleExpand(u){if(this.treeData.some(o=>o.span_id===u.span_id))return;const a=new Set(this.expandedNodes);a.has(u.span_id)?a.delete(u.span_id):a.add(u.span_id),this.expandedNodes=a,this.updateAllExpandedState(),this.$forceUpdate()},updateAllExpandedState(){const u=(a,o=!1)=>{for(const f of a)if(this.hasChildren(f)&&(!o&&!this.expandedNodes.has(f.span_id)||f.children&&f.children.length>0&&!u(f.children,!1)))return!1;return!0};if(!this.treeData.some(a=>a.children&&a.children.some(o=>this.hasChildren(o)))){this.allExpanded=!1;return}this.allExpanded=u(this.treeData,!0)}}};var Qc=function(){var n=this,a=n._self._c;return a("div",{staticClass:"span-tree-container"},[n.treeData.length===0?a("div",{staticClass:"empty-state"},[a("el-empty",{attrs:{description:"暂无 Span 数据"}})],1):a("div",{staticClass:"timeline-wrapper"},[a("TimelineHeader",{attrs:{"time-range":n.timeRange,"all-expanded":n.allExpanded,"view-mode":n.viewMode},on:{"toggle-expand":n.toggleAllExpand,"toggle-view":n.toggleViewMode}}),a("div",{ref:"timelineContent",staticClass:"timeline-content"},[n.viewMode==="tree"?n._l(n.treeData,function(o){return a("SpanTreeNode",{key:o.span_id,attrs:{node:o,selected:n.selectedSpanId===o.span_id,"selected-span-id":n.selectedSpanId,"expanded-nodes":n.expandedNodes,depth:0,"trace-start-time":n.traceStartTime,"trace-end-time":n.traceEndTime},on:{"node-click":n.handleNodeClick,"toggle-expand":n.toggleExpand}})}):n._l(n.flatListData,function(o){return a("SpanListNode",{key:o.span_id,attrs:{node:o,selected:n.selectedSpanId===o.span_id,"trace-start-time":n.traceStartTime,"trace-end-time":n.traceEndTime},on:{"node-click":n.handleNodeClick}})})],2)],1)])},Zc=[],eh=An(Jc,Qc,Zc,!1,null,"1eff9f3c");const qa=eh.exports;/*!
67
+ `}strong(n){return`<strong>${n}</strong>`}em(n){return`<em>${n}</em>`}codespan(n){return`<code>${n}</code>`}br(){return"<br>"}del(n){return`<del>${n}</del>`}link(n,a,o){const f=xo(n);if(f===null)return o;n=f;let d='<a href="'+n+'"';return a&&(d+=' title="'+a+'"'),d+=">"+o+"</a>",d}image(n,a,o){const f=xo(n);if(f===null)return o;n=f;let d=`<img src="${n}" alt="${o}"`;return a&&(d+=` title="${a}"`),d+=">",d}text(n){return n}}class qa{strong(n){return n}em(n){return n}codespan(n){return n}del(n){return n}html(n){return n}text(n){return n}link(n,a,o){return""+o}image(n,a,o){return""+o}br(){return""}}class gn{constructor(n){Je(this,"options");Je(this,"renderer");Je(this,"textRenderer");this.options=n||Xn,this.options.renderer=this.options.renderer||new qi,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new qa}static parse(n,a){return new gn(a).parse(n)}static parseInline(n,a){return new gn(a).parseInline(n)}parse(n,a=!0){let o="";for(let f=0;f<n.length;f++){const d=n[f];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[d.type]){const p=d,y=this.options.extensions.renderers[p.type].call({parser:this},p);if(y!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(p.type)){o+=y||"";continue}}switch(d.type){case"space":continue;case"hr":{o+=this.renderer.hr();continue}case"heading":{const p=d;o+=this.renderer.heading(this.parseInline(p.tokens),p.depth,rc(this.parseInline(p.tokens,this.textRenderer)));continue}case"code":{const p=d;o+=this.renderer.code(p.text,p.lang,!!p.escaped);continue}case"table":{const p=d;let y="",m="";for(let S=0;S<p.header.length;S++)m+=this.renderer.tablecell(this.parseInline(p.header[S].tokens),{header:!0,align:p.align[S]});y+=this.renderer.tablerow(m);let x="";for(let S=0;S<p.rows.length;S++){const A=p.rows[S];m="";for(let E=0;E<A.length;E++)m+=this.renderer.tablecell(this.parseInline(A[E].tokens),{header:!1,align:p.align[E]});x+=this.renderer.tablerow(m)}o+=this.renderer.table(y,x);continue}case"blockquote":{const p=d,y=this.parse(p.tokens);o+=this.renderer.blockquote(y);continue}case"list":{const p=d,y=p.ordered,m=p.start,x=p.loose;let S="";for(let A=0;A<p.items.length;A++){const E=p.items[A],H=E.checked,B=E.task;let U="";if(E.task){const F=this.renderer.checkbox(!!H);x?E.tokens.length>0&&E.tokens[0].type==="paragraph"?(E.tokens[0].text=F+" "+E.tokens[0].text,E.tokens[0].tokens&&E.tokens[0].tokens.length>0&&E.tokens[0].tokens[0].type==="text"&&(E.tokens[0].tokens[0].text=F+" "+E.tokens[0].tokens[0].text)):E.tokens.unshift({type:"text",text:F+" "}):U+=F+" "}U+=this.parse(E.tokens,x),S+=this.renderer.listitem(U,B,!!H)}o+=this.renderer.list(S,y,m);continue}case"html":{const p=d;o+=this.renderer.html(p.text,p.block);continue}case"paragraph":{const p=d;o+=this.renderer.paragraph(this.parseInline(p.tokens));continue}case"text":{let p=d,y=p.tokens?this.parseInline(p.tokens):p.text;for(;f+1<n.length&&n[f+1].type==="text";)p=n[++f],y+=`
68
+ `+(p.tokens?this.parseInline(p.tokens):p.text);o+=a?this.renderer.paragraph(y):y;continue}default:{const p='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(p),"";throw new Error(p)}}}return o}parseInline(n,a){a=a||this.renderer;let o="";for(let f=0;f<n.length;f++){const d=n[f];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[d.type]){const p=this.options.extensions.renderers[d.type].call({parser:this},d);if(p!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(d.type)){o+=p||"";continue}}switch(d.type){case"escape":{const p=d;o+=a.text(p.text);break}case"html":{const p=d;o+=a.html(p.text);break}case"link":{const p=d;o+=a.link(p.href,p.title,this.parseInline(p.tokens,a));break}case"image":{const p=d;o+=a.image(p.href,p.title,p.text);break}case"strong":{const p=d;o+=a.strong(this.parseInline(p.tokens,a));break}case"em":{const p=d;o+=a.em(this.parseInline(p.tokens,a));break}case"codespan":{const p=d;o+=a.codespan(p.text);break}case"br":{o+=a.br();break}case"del":{const p=d;o+=a.del(this.parseInline(p.tokens,a));break}case"text":{const p=d;o+=a.text(p.text);break}default:{const p='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(p),"";throw new Error(p)}}}return o}}class Zr{constructor(n){Je(this,"options");this.options=n||Xn}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}}Je(Zr,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class Oc{constructor(...n){Yf(this,Qn);Je(this,"defaults",Pa());Je(this,"options",this.setOptions);Je(this,"parse",Ra(this,Qn,so).call(this,pn.lex,gn.parse));Je(this,"parseInline",Ra(this,Qn,so).call(this,pn.lexInline,gn.parseInline));Je(this,"Parser",gn);Je(this,"Renderer",qi);Je(this,"TextRenderer",qa);Je(this,"Lexer",pn);Je(this,"Tokenizer",Bi);Je(this,"Hooks",Zr);this.use(...n)}walkTokens(n,a){var f,d;let o=[];for(const p of n)switch(o=o.concat(a.call(this,p)),p.type){case"table":{const y=p;for(const m of y.header)o=o.concat(this.walkTokens(m.tokens,a));for(const m of y.rows)for(const x of m)o=o.concat(this.walkTokens(x.tokens,a));break}case"list":{const y=p;o=o.concat(this.walkTokens(y.items,a));break}default:{const y=p;(d=(f=this.defaults.extensions)==null?void 0:f.childTokens)!=null&&d[y.type]?this.defaults.extensions.childTokens[y.type].forEach(m=>{const x=y[m].flat(1/0);o=o.concat(this.walkTokens(x,a))}):y.tokens&&(o=o.concat(this.walkTokens(y.tokens,a)))}}return o}use(...n){const a=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(o=>{const f={...o};if(f.async=this.defaults.async||f.async||!1,o.extensions&&(o.extensions.forEach(d=>{if(!d.name)throw new Error("extension name required");if("renderer"in d){const p=a.renderers[d.name];p?a.renderers[d.name]=function(...y){let m=d.renderer.apply(this,y);return m===!1&&(m=p.apply(this,y)),m}:a.renderers[d.name]=d.renderer}if("tokenizer"in d){if(!d.level||d.level!=="block"&&d.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const p=a[d.level];p?p.unshift(d.tokenizer):a[d.level]=[d.tokenizer],d.start&&(d.level==="block"?a.startBlock?a.startBlock.push(d.start):a.startBlock=[d.start]:d.level==="inline"&&(a.startInline?a.startInline.push(d.start):a.startInline=[d.start]))}"childTokens"in d&&d.childTokens&&(a.childTokens[d.name]=d.childTokens)}),f.extensions=a),o.renderer){const d=this.defaults.renderer||new qi(this.defaults);for(const p in o.renderer){if(!(p in d))throw new Error(`renderer '${p}' does not exist`);if(p==="options")continue;const y=p,m=o.renderer[y],x=d[y];d[y]=(...S)=>{let A=m.apply(d,S);return A===!1&&(A=x.apply(d,S)),A||""}}f.renderer=d}if(o.tokenizer){const d=this.defaults.tokenizer||new Bi(this.defaults);for(const p in o.tokenizer){if(!(p in d))throw new Error(`tokenizer '${p}' does not exist`);if(["options","rules","lexer"].includes(p))continue;const y=p,m=o.tokenizer[y],x=d[y];d[y]=(...S)=>{let A=m.apply(d,S);return A===!1&&(A=x.apply(d,S)),A}}f.tokenizer=d}if(o.hooks){const d=this.defaults.hooks||new Zr;for(const p in o.hooks){if(!(p in d))throw new Error(`hook '${p}' does not exist`);if(p==="options")continue;const y=p,m=o.hooks[y],x=d[y];Zr.passThroughHooks.has(p)?d[y]=S=>{if(this.defaults.async)return Promise.resolve(m.call(d,S)).then(E=>x.call(d,E));const A=m.call(d,S);return x.call(d,A)}:d[y]=(...S)=>{let A=m.apply(d,S);return A===!1&&(A=x.apply(d,S)),A}}f.hooks=d}if(o.walkTokens){const d=this.defaults.walkTokens,p=o.walkTokens;f.walkTokens=function(y){let m=[];return m.push(p.call(this,y)),d&&(m=m.concat(d.call(this,y))),m}}this.defaults={...this.defaults,...f}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,a){return pn.lex(n,a??this.defaults)}parser(n,a){return gn.parse(n,a??this.defaults)}}Qn=new WeakSet,so=function(n,a){return(o,f)=>{const d={...f},p={...this.defaults,...d};this.defaults.async===!0&&d.async===!1&&(p.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),p.async=!0);const y=Ra(this,Qn,Vf).call(this,!!p.silent,!!p.async);if(typeof o>"u"||o===null)return y(new Error("marked(): input parameter is undefined or null"));if(typeof o!="string")return y(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(o)+", string expected"));if(p.hooks&&(p.hooks.options=p),p.async)return Promise.resolve(p.hooks?p.hooks.preprocess(o):o).then(m=>n(m,p)).then(m=>p.hooks?p.hooks.processAllTokens(m):m).then(m=>p.walkTokens?Promise.all(this.walkTokens(m,p.walkTokens)).then(()=>m):m).then(m=>a(m,p)).then(m=>p.hooks?p.hooks.postprocess(m):m).catch(y);try{p.hooks&&(o=p.hooks.preprocess(o));let m=n(o,p);p.hooks&&(m=p.hooks.processAllTokens(m)),p.walkTokens&&this.walkTokens(m,p.walkTokens);let x=a(m,p);return p.hooks&&(x=p.hooks.postprocess(x)),x}catch(m){return y(m)}}},Vf=function(n,a){return o=>{if(o.message+=`
69
+ Please report this to https://github.com/markedjs/marked.`,n){const f="<p>An error occurred:</p><pre>"+jt(o.message+"",!0)+"</pre>";return a?Promise.resolve(f):f}if(a)return Promise.reject(o);throw o}};const Yn=new Oc;function Le(u,n){return Yn.parse(u,n)}Le.options=Le.setOptions=function(u){return Yn.setOptions(u),Le.defaults=Yn.defaults,mo(Le.defaults),Le},Le.getDefaults=Pa,Le.defaults=Xn,Le.use=function(...u){return Yn.use(...u),Le.defaults=Yn.defaults,mo(Le.defaults),Le},Le.walkTokens=function(u,n){return Yn.walkTokens(u,n)},Le.parseInline=Yn.parseInline,Le.Parser=gn,Le.parser=gn.parse,Le.Renderer=qi,Le.TextRenderer=qa,Le.Lexer=pn,Le.lexer=pn.lex,Le.Tokenizer=Bi,Le.Hooks=Zr,Le.parse=Le,Le.options,Le.setOptions,Le.use,Le.walkTokens,Le.parseInline,gn.parse,pn.lex;function An(u,n,a,o,f,d,p,y){var m=typeof u=="function"?u.options:u;return n&&(m.render=n,m.staticRenderFns=a,m._compiled=!0),d&&(m._scopeId="data-v-"+d),{exports:u,options:m}}const Nc={name:"TimelineHeader",props:{timeRange:{type:String,default:"-"},allExpanded:{type:Boolean,default:!1},viewMode:{type:String,default:"list"}},methods:{handleToggleExpand(){this.$emit("toggle-expand")},handleToggleView(){this.$emit("toggle-view")}}};var Mc=function(){var n=this,a=n._self._c;return a("div",{staticClass:"timeline-header"},[a("div",{staticClass:"time-scale"},[a("span",{staticClass:"time-range"},[n._v(n._s(n.timeRange))])]),a("div",{staticClass:"header-actions"},[n.viewMode==="tree"?a("el-tooltip",{attrs:{content:n.allExpanded?"合上所有节点":"展开所有节点",placement:"top"}},[a("i",{staticClass:"action-icon",class:n.allExpanded?"el-icon-arrow-down":"el-icon-arrow-right",on:{click:n.handleToggleExpand}})]):n._e(),a("el-tooltip",{attrs:{content:n.viewMode==="list"?"切换到树形视图":"切换到列表视图",placement:"top"}},[a("i",{staticClass:"action-icon",class:n.viewMode==="list"?"el-icon-menu":"el-icon-s-operation",on:{click:n.handleToggleView}})])],1)])},Rc=[],Fc=An(Nc,Mc,Rc,!1,null,"a6b357e5");const Pc=Fc.exports,zc={name:"TimelineBar",props:{barStyle:{type:Object,required:!0},statusDescription:{type:String,default:""},selected:{type:Boolean,default:!1},error:{type:Boolean,default:!1},hasEvents:{type:Boolean,default:!1}}};var $c=function(){var n=this,a=n._self._c;return a("el-tooltip",{attrs:{content:n.statusDescription,disabled:!n.statusDescription,placement:"top","popper-class":"span-status-tooltip"}},[a("div",{staticClass:"timeline-bar-wrapper"},[a("div",{staticClass:"timeline-bar",class:{selected:n.selected,error:n.error,"has-events":n.hasEvents},style:n.barStyle})])])},Bc=[],Hc=An(zc,$c,Bc,!1,null,"52995efa");const Io=Hc.exports;function Oo(u){if(!u)return"-";const n=u/1e6;return n<1e3?`${n.toFixed(2)}ms`:n<6e4?`${(n/1e3).toFixed(2)}s`:`${(n/6e4).toFixed(2)}min`}function No(u){if(!u)return"-";const n=u/1e6,a=new Date(n),o=a.getFullYear(),f=String(a.getMonth()+1).padStart(2,"0"),d=String(a.getDate()).padStart(2,"0"),p=String(a.getHours()).padStart(2,"0"),y=String(a.getMinutes()).padStart(2,"0"),m=String(a.getSeconds()).padStart(2,"0");return`${o}/${f}/${d} ${p}:${y}:${m}`}function Wc(u,n,a="-"){return!u||!n?"-":`${No(u)} ${a} ${No(n)}`}function Mo(u){const n={SERVER:"primary",CHAT_MODEL:"success",LLM:"success",CLIENT:"",INTERNAL:"info",EMBEDDING:"",CHAIN:"warning",AGENT:"danger",TOOL:"info",JOB:"warning",FUNCTION:"info"};return n[u]!==void 0?n[u]:"info"}function Ro(u){return{CLIENT:"rgb(141 252 245)",EMBEDDING:"rgb(248 246 130)"}[u]||void 0}function Fo(u){return u.status_description?u.status_description:""}function Po(u,n,a){if(!n||!a||n===a)return{width:"100%"};const o=a-n,f=u.start_time_unix_nano-n,d=u.duration_ns,p=f/o*100,y=d/o*100;return{left:`${p}%`,width:`${y}%`}}const jc={name:"SpanTreeNode",components:{TimelineBar:Io},props:{node:{type:Object,required:!0},selected:{type:Boolean,default:!1},selectedSpanId:{type:String,default:null},expandedNodes:{type:Set,required:!0},depth:{type:Number,default:0},traceStartTime:{type:Number,default:0},traceEndTime:{type:Number,default:0}},computed:{hasChildren(){return this.node.children&&this.node.children.length>0},isRootNode(){return this.depth===0},isExpanded(){return this.isRootNode?!0:this.expandedNodes.has(this.node.span_id)},shouldShowChildren(){return this.isRootNode?!0:this.isExpanded},duration(){return Oo(this.node.duration_ns)},typeColor(){return Mo(this.node.type)},typeCustomColor(){return Ro(this.node.type)},statusDescription(){return Fo(this.node)},barStyle(){return Po(this.node,this.traceStartTime,this.traceEndTime)},error(){return this.node.status==="ERROR"},hasEvents(){return this.node.has_events===!0},isChild(){return this.depth>0}},methods:{handleClick(){this.$emit("node-click",this.node)},handleToggleExpand(){this.isRootNode||this.$emit("toggle-expand",this.node)}}};var qc=function(){var n=this,a=n._self._c;return a("div",[a("div",{staticClass:"timeline-node",class:{selected:n.selected,error:n.error,"child-node":n.isChild},on:{click:n.handleClick}},[a("div",{staticClass:"node-row"},[a("div",{staticClass:"node-info"},[n.hasChildren&&!n.isRootNode?a("i",{staticClass:"expand-icon",class:n.isExpanded?"el-icon-arrow-down":"el-icon-arrow-right",on:{click:function(o){return o.stopPropagation(),n.handleToggleExpand.apply(null,arguments)}}}):n._e(),a("el-tag",{staticClass:"type-tag",attrs:{type:n.typeColor,color:n.typeCustomColor,size:"mini"}},[n._v(" "+n._s(n.node.type)+" ")]),a("el-tooltip",{attrs:{content:n.node.name,placement:"top","open-delay":300}},[a("span",{staticClass:"node-name"},[n._v(n._s(n.node.name))])])],1),a("div",{staticClass:"node-duration"},[n._v(" "+n._s(n.duration)+" ")])]),a("TimelineBar",{attrs:{"bar-style":n.barStyle,"status-description":n.statusDescription,selected:n.selected,error:n.error,"has-events":n.hasEvents}})],1),n.shouldShowChildren&&n.hasChildren?a("div",{staticClass:"children-nodes"},n._l(n.node.children,function(o){return a("SpanTreeNode",{key:o.span_id,attrs:{node:o,selected:o.span_id===n.selectedSpanId,"selected-span-id":n.selectedSpanId,"expanded-nodes":n.expandedNodes,depth:n.depth+1,"trace-start-time":n.traceStartTime,"trace-end-time":n.traceEndTime},on:{"node-click":function(f){return n.$emit("node-click",f)},"toggle-expand":function(f){return n.$emit("toggle-expand",f)}}})}),1):n._e()])},Uc=[],Gc=An(jc,qc,Uc,!1,null,"f1d06a11");const Kc=Gc.exports,Xc={name:"SpanListNode",components:{TimelineBar:Io},props:{node:{type:Object,required:!0},selected:{type:Boolean,default:!1},traceStartTime:{type:Number,default:0},traceEndTime:{type:Number,default:0}},computed:{duration(){return Oo(this.node.duration_ns)},typeColor(){return Mo(this.node.type)},typeCustomColor(){return Ro(this.node.type)},statusDescription(){return Fo(this.node)},barStyle(){return Po(this.node,this.traceStartTime,this.traceEndTime)},error(){return this.node.status==="ERROR"},hasEvents(){return this.node.has_events===!0}},methods:{handleClick(){this.$emit("node-click",this.node)}}};var Yc=function(){var n=this,a=n._self._c;return a("div",{staticClass:"timeline-node",class:{selected:n.selected,error:n.error},on:{click:n.handleClick}},[a("div",{staticClass:"node-row"},[a("div",{staticClass:"node-info"},[a("el-tag",{staticClass:"type-tag",attrs:{type:n.typeColor,color:n.typeCustomColor,size:"mini"}},[n._v(" "+n._s(n.node.type)+" ")]),a("el-tooltip",{attrs:{content:n.node.name,placement:"top","open-delay":300}},[a("span",{staticClass:"node-name"},[n._v(n._s(n.node.name))])])],1),a("div",{staticClass:"node-duration"},[n._v(" "+n._s(n.duration)+" ")])]),a("TimelineBar",{attrs:{"bar-style":n.barStyle,"status-description":n.statusDescription,selected:n.selected,error:n.error,"has-events":n.hasEvents}})],1)},Vc=[],Jc=An(Xc,Yc,Vc,!1,null,"87a70c40");const Qc=Jc.exports,Zc={name:"TraceSpanTree",components:{TimelineHeader:Pc,SpanTreeNode:Kc,SpanListNode:Qc},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:[],allExpanded:!1,viewMode:"list"}},computed:{flatListData(){const u=[],n=a=>{a.forEach(o=>{u.push(o),o.children&&o.children.length>0&&n(o.children)})};return n(this.treeData),u},timeRange(){const u=this.$t?this.$t("trace.to"):"-";return Wc(this.traceStartTime,this.traceEndTime,u)}},watch:{spans:{immediate:!0,handler(){this.buildTree()}}},methods:{buildTree(){if(!this.spans||this.spans.length===0){this.treeData=[];return}const u=new Map,n=[];this.spans.forEach(a=>{u.set(a.span_id,{...a,children:[]})}),this.spans.forEach(a=>{const o=u.get(a.span_id);if(a.parent_span_id){const f=u.get(a.parent_span_id);f?f.children.push(o):n.push(o)}else n.push(o)}),n.forEach(a=>{this.sortChildren(a)}),this.treeData=n,this.expandAllNodes()},expandAllNodes(){const u=new Set,n=a=>{a.forEach(o=>{o.children&&o.children.length>0&&o.children.forEach(f=>{this.hasChildren(f)&&u.add(f.span_id),f.children&&f.children.length>0&&n([f])})})};n(this.treeData),this.expandedNodes=u,this.allExpanded=!0,this.$forceUpdate()},collapseAllNodes(){const u=new Set;this.expandedNodes=u,this.allExpanded=!1,this.$forceUpdate()},toggleAllExpand(){this.allExpanded?this.collapseAllNodes():this.expandAllNodes()},toggleViewMode(){this.viewMode=this.viewMode==="list"?"tree":"list"},sortChildren(u){u.children&&u.children.length>0&&(u.children.sort((n,a)=>n.start_time_unix_nano-a.start_time_unix_nano),u.children.forEach(n=>this.sortChildren(n)))},handleNodeClick(u){this.$emit("span-select",u)},hasChildren(u){return u.children&&u.children.length>0},toggleExpand(u){if(this.treeData.some(o=>o.span_id===u.span_id))return;const a=new Set(this.expandedNodes);a.has(u.span_id)?a.delete(u.span_id):a.add(u.span_id),this.expandedNodes=a,this.updateAllExpandedState(),this.$forceUpdate()},updateAllExpandedState(){const u=(a,o=!1)=>{for(const f of a)if(this.hasChildren(f)&&(!o&&!this.expandedNodes.has(f.span_id)||f.children&&f.children.length>0&&!u(f.children,!1)))return!1;return!0};if(!this.treeData.some(a=>a.children&&a.children.some(o=>this.hasChildren(o)))){this.allExpanded=!1;return}this.allExpanded=u(this.treeData,!0)}}};var eh=function(){var n=this,a=n._self._c;return a("div",{staticClass:"span-tree-container"},[n.treeData.length===0?a("div",{staticClass:"empty-state"},[a("el-empty",{attrs:{description:"暂无 Span 数据"}})],1):a("div",{staticClass:"timeline-wrapper"},[a("TimelineHeader",{attrs:{"time-range":n.timeRange,"all-expanded":n.allExpanded,"view-mode":n.viewMode},on:{"toggle-expand":n.toggleAllExpand,"toggle-view":n.toggleViewMode}}),a("div",{ref:"timelineContent",staticClass:"timeline-content"},[n.viewMode==="tree"?n._l(n.treeData,function(o){return a("SpanTreeNode",{key:o.span_id,attrs:{node:o,selected:n.selectedSpanId===o.span_id,"selected-span-id":n.selectedSpanId,"expanded-nodes":n.expandedNodes,depth:0,"trace-start-time":n.traceStartTime,"trace-end-time":n.traceEndTime},on:{"node-click":n.handleNodeClick,"toggle-expand":n.toggleExpand}})}):n._l(n.flatListData,function(o){return a("SpanListNode",{key:o.span_id,attrs:{node:o,selected:n.selectedSpanId===o.span_id,"trace-start-time":n.traceStartTime,"trace-end-time":n.traceEndTime},on:{"node-click":n.handleNodeClick}})})],2)],1)])},th=[],nh=An(Zc,eh,th,!1,null,"1eff9f3c");const Ua=nh.exports;/*!
70
70
  * Viewer.js v1.11.7
71
71
  * https://fengyuanchen.github.io/viewerjs
72
72
  *
@@ -74,17 +74,17 @@ Please report this to https://github.com/markedjs/marked.`,n){const f="<p>An err
74
74
  * Released under the MIT license
75
75
  *
76
76
  * Date: 2024-11-24T04:32:19.116Z
77
- */function th(u,n){if(!(u instanceof n))throw new TypeError("Cannot call a class as a function")}function Mo(u,n){for(var a=0;a<n.length;a++){var o=n[a];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(u,Fo(o.key),o)}}function nh(u,n,a){return n&&Mo(u.prototype,n),a&&Mo(u,a),Object.defineProperty(u,"prototype",{writable:!1}),u}function rh(u,n,a){return(n=Fo(n))in u?Object.defineProperty(u,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):u[n]=a,u}function Ro(u,n){var a=Object.keys(u);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(u);n&&(o=o.filter(function(f){return Object.getOwnPropertyDescriptor(u,f).enumerable})),a.push.apply(a,o)}return a}function Ga(u){for(var n=1;n<arguments.length;n++){var a=arguments[n]!=null?arguments[n]:{};n%2?Ro(Object(a),!0).forEach(function(o){rh(u,o,a[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(a)):Ro(Object(a)).forEach(function(o){Object.defineProperty(u,o,Object.getOwnPropertyDescriptor(a,o))})}return u}function ih(u,n){if(typeof u!="object"||!u)return u;var a=u[Symbol.toPrimitive];if(a!==void 0){var o=a.call(u,n);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(u)}function Fo(u){var n=ih(u,"string");return typeof n=="symbol"?n:n+""}function Ka(u){"@babel/helpers - typeof";return Ka=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Ka(u)}var Po={backdrop:!0,button:!0,navbar:!0,title:!0,toolbar:!0,className:"",container:"body",filter:null,fullscreen:!0,inheritedAttributes:["crossOrigin","decoding","isMap","loading","referrerPolicy","sizes","srcset","useMap"],initialCoverage:.9,initialViewIndex:0,inline:!1,interval:5e3,keyboard:!0,focus:!0,loading:!0,loop:!0,minWidth:200,minHeight:100,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,slideOnTouch:!0,toggleOnDblclick:!0,tooltip:!0,transition:!0,zIndex:2015,zIndexInline:0,zoomRatio:.1,minZoomRatio:.01,maxZoomRatio:100,url:"src",ready:null,show:null,shown:null,hide:null,hidden:null,view:null,viewed:null,move:null,moved:null,rotate:null,rotated:null,scale:null,scaled:null,zoom:null,zoomed:null,play:null,stop:null},ah='<div class="viewer-container" tabindex="-1" touch-action="none"><div class="viewer-canvas"></div><div class="viewer-footer"><div class="viewer-title"></div><div class="viewer-toolbar"></div><div class="viewer-navbar"><ul class="viewer-list" role="navigation"></ul></div></div><div class="viewer-tooltip" role="alert" aria-hidden="true"></div><div class="viewer-button" data-viewer-action="mix" role="button"></div><div class="viewer-player"></div></div>',qi=typeof window<"u"&&typeof window.document<"u",wn=qi?window:{},hr=qi&&wn.document.documentElement?"ontouchstart"in wn.document.documentElement:!1,Xa=qi?"PointerEvent"in wn:!1,Ne="viewer",Gi="move",zo="switch",ei="zoom",Ki="".concat(Ne,"-active"),sh="".concat(Ne,"-close"),Xi="".concat(Ne,"-fade"),Ya="".concat(Ne,"-fixed"),oh="".concat(Ne,"-fullscreen"),$o="".concat(Ne,"-fullscreen-exit"),Vn="".concat(Ne,"-hide"),lh="".concat(Ne,"-hide-md-down"),uh="".concat(Ne,"-hide-sm-down"),fh="".concat(Ne,"-hide-xs-down"),Vt="".concat(Ne,"-in"),ti="".concat(Ne,"-invisible"),dr="".concat(Ne,"-loading"),ch="".concat(Ne,"-move"),Bo="".concat(Ne,"-open"),pr="".concat(Ne,"-show"),at="".concat(Ne,"-transition"),gr="click",Va="dblclick",Ho="dragstart",Wo="focusin",jo="keydown",Jt="load",Jn="error",hh=hr?"touchend touchcancel":"mouseup",dh=hr?"touchmove":"mousemove",ph=hr?"touchstart":"mousedown",Uo=Xa?"pointerdown":ph,qo=Xa?"pointermove":dh,Go=Xa?"pointerup pointercancel":hh,Ko="resize",tn="transitionend",Xo="wheel",Yo="ready",Vo="show",Jo="shown",Qo="hide",Zo="hidden",el="view",ni="viewed",tl="move",nl="moved",rl="rotate",il="rotated",al="scale",sl="scaled",ol="zoom",ll="zoomed",ul="play",fl="stop",Yi="".concat(Ne,"Action"),Ja=/\s\s*/,Vi=["zoom-in","zoom-out","one-to-one","reset","prev","play","next","rotate-left","rotate-right","flip-horizontal","flip-vertical"];function ri(u){return typeof u=="string"}var gh=Number.isNaN||wn.isNaN;function Ze(u){return typeof u=="number"&&!gh(u)}function mr(u){return typeof u>"u"}function vr(u){return Ka(u)==="object"&&u!==null}var mh=Object.prototype.hasOwnProperty;function yr(u){if(!vr(u))return!1;try{var n=u.constructor,a=n.prototype;return n&&a&&mh.call(a,"isPrototypeOf")}catch{return!1}}function qe(u){return typeof u=="function"}function Xe(u,n){if(u&&qe(n))if(Array.isArray(u)||Ze(u.length)){var a=u.length,o;for(o=0;o<a&&n.call(u,u[o],o,u)!==!1;o+=1);}else vr(u)&&Object.keys(u).forEach(function(f){n.call(u,u[f],f,u)});return u}var Ut=Object.assign||function(n){for(var a=arguments.length,o=new Array(a>1?a-1:0),f=1;f<a;f++)o[f-1]=arguments[f];return vr(n)&&o.length>0&&o.forEach(function(d){vr(d)&&Object.keys(d).forEach(function(p){n[p]=d[p]})}),n},vh=/^(?:width|height|left|top|marginLeft|marginTop)$/;function nn(u,n){var a=u.style;Xe(n,function(o,f){vh.test(f)&&Ze(o)&&(o+="px"),a[f]=o})}function yh(u){return ri(u)?u.replace(/&(?!amp;|quot;|#39;|lt;|gt;)/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;"):u}function br(u,n){return!u||!n?!1:u.classList?u.classList.contains(n):u.className.indexOf(n)>-1}function Ce(u,n){if(!(!u||!n)){if(Ze(u.length)){Xe(u,function(o){Ce(o,n)});return}if(u.classList){u.classList.add(n);return}var a=u.className.trim();a?a.indexOf(n)<0&&(u.className="".concat(a," ").concat(n)):u.className=n}}function He(u,n){if(!(!u||!n)){if(Ze(u.length)){Xe(u,function(a){He(a,n)});return}if(u.classList){u.classList.remove(n);return}u.className.indexOf(n)>=0&&(u.className=u.className.replace(n,""))}}function ii(u,n,a){if(n){if(Ze(u.length)){Xe(u,function(o){ii(o,n,a)});return}a?Ce(u,n):He(u,n)}}var bh=/([a-z\d])([A-Z])/g;function Qa(u){return u.replace(bh,"$1-$2").toLowerCase()}function xr(u,n){return vr(u[n])?u[n]:u.dataset?u.dataset[n]:u.getAttribute("data-".concat(Qa(n)))}function Za(u,n,a){vr(a)?u[n]=a:u.dataset?u.dataset[n]=a:u.setAttribute("data-".concat(Qa(n)),a)}var cl=function(){var u=!1;if(qi){var n=!1,a=function(){},o=Object.defineProperty({},"once",{get:function(){return u=!0,n},set:function(d){n=d}});wn.addEventListener("test",a,o),wn.removeEventListener("test",a,o)}return u}();function Ge(u,n,a){var o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},f=a;n.trim().split(Ja).forEach(function(d){if(!cl){var p=u.listeners;p&&p[d]&&p[d][a]&&(f=p[d][a],delete p[d][a],Object.keys(p[d]).length===0&&delete p[d],Object.keys(p).length===0&&delete u.listeners)}u.removeEventListener(d,f,o)})}function Ee(u,n,a){var o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},f=a;n.trim().split(Ja).forEach(function(d){if(o.once&&!cl){var p=u.listeners,y=p===void 0?{}:p;f=function(){delete y[d][a],u.removeEventListener(d,f,o);for(var x=arguments.length,S=new Array(x),A=0;A<x;A++)S[A]=arguments[A];a.apply(u,S)},y[d]||(y[d]={}),y[d][a]&&u.removeEventListener(d,y[d][a],o),y[d][a]=f,u.listeners=y}u.addEventListener(d,f,o)})}function ot(u,n,a,o){var f;return qe(Event)&&qe(CustomEvent)?f=new CustomEvent(n,Ga({bubbles:!0,cancelable:!0,detail:a},o)):(f=document.createEvent("CustomEvent"),f.initCustomEvent(n,!0,!0,a)),u.dispatchEvent(f)}function xh(u){var n=u.getBoundingClientRect();return{left:n.left+(window.pageXOffset-document.documentElement.clientLeft),top:n.top+(window.pageYOffset-document.documentElement.clientTop)}}function Ji(u){var n=u.rotate,a=u.scaleX,o=u.scaleY,f=u.translateX,d=u.translateY,p=[];Ze(f)&&f!==0&&p.push("translateX(".concat(f,"px)")),Ze(d)&&d!==0&&p.push("translateY(".concat(d,"px)")),Ze(n)&&n!==0&&p.push("rotate(".concat(n,"deg)")),Ze(a)&&a!==1&&p.push("scaleX(".concat(a,")")),Ze(o)&&o!==1&&p.push("scaleY(".concat(o,")"));var y=p.length?p.join(" "):"none";return{WebkitTransform:y,msTransform:y,transform:y}}function wh(u){return ri(u)?decodeURIComponent(u.replace(/^.*\//,"").replace(/[?&#].*$/,"")):""}var es=wn.navigator&&/Version\/\d+(\.\d+)+?\s+Safari/i.test(wn.navigator.userAgent);function hl(u,n,a){var o=document.createElement("img");if(u.naturalWidth&&!es)return a(u.naturalWidth,u.naturalHeight),o;var f=document.body||document.documentElement;return o.onload=function(){a(o.width,o.height),es||f.removeChild(o)},Xe(n.inheritedAttributes,function(d){var p=u.getAttribute(d);p!==null&&o.setAttribute(d,p)}),o.src=u.src,es||(o.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",f.appendChild(o)),o}function Qi(u){switch(u){case 2:return fh;case 3:return uh;case 4:return lh;default:return""}}function kh(u){var n=Ga({},u),a=[];return Xe(u,function(o,f){delete n[f],Xe(n,function(d){var p=Math.abs(o.startX-d.startX),y=Math.abs(o.startY-d.startY),m=Math.abs(o.endX-d.endX),x=Math.abs(o.endY-d.endY),S=Math.sqrt(p*p+y*y),A=Math.sqrt(m*m+x*x),E=(A-S)/S;a.push(E)})}),a.sort(function(o,f){return Math.abs(o)<Math.abs(f)}),a[0]}function Zi(u,n){var a=u.pageX,o=u.pageY,f={endX:a,endY:o};return n?f:Ga({timeStamp:Date.now(),startX:a,startY:o},f)}function Sh(u){var n=0,a=0,o=0;return Xe(u,function(f){var d=f.startX,p=f.startY;n+=d,a+=p,o+=1}),n/=o,a/=o,{pageX:n,pageY:a}}var Ch={render:function(){this.initContainer(),this.initViewer(),this.initList(),this.renderViewer()},initBody:function(){var n=this.element.ownerDocument,a=n.body||n.documentElement;this.body=a,this.scrollbarWidth=window.innerWidth-n.documentElement.clientWidth,this.initialBodyPaddingRight=a.style.paddingRight,this.initialBodyComputedPaddingRight=window.getComputedStyle(a).paddingRight},initContainer:function(){this.containerData={width:window.innerWidth,height:window.innerHeight}},initViewer:function(){var n=this.options,a=this.parent,o;n.inline&&(o={width:Math.max(a.offsetWidth,n.minWidth),height:Math.max(a.offsetHeight,n.minHeight)},this.parentData=o),(this.fulled||!o)&&(o=this.containerData),this.viewerData=Ut({},o)},renderViewer:function(){this.options.inline&&!this.fulled&&nn(this.viewer,this.viewerData)},initList:function(){var n=this,a=this.element,o=this.options,f=this.list,d=[];f.innerHTML="",Xe(this.images,function(p,y){var m=p.src,x=p.alt||wh(m),S=n.getImageURL(p);if(m||S){var A=document.createElement("li"),E=document.createElement("img");Xe(o.inheritedAttributes,function(W){var B=p.getAttribute(W);B!==null&&E.setAttribute(W,B)}),o.navbar&&(E.src=m||S),E.alt=x,E.setAttribute("data-original-url",S||m),A.setAttribute("data-index",y),A.setAttribute("data-viewer-action","view"),A.setAttribute("role","button"),o.keyboard&&A.setAttribute("tabindex",0),A.appendChild(E),f.appendChild(A),d.push(A)}}),this.items=d,Xe(d,function(p){var y=p.firstElementChild,m,x;Za(y,"filled",!0),o.loading&&Ce(p,dr),Ee(y,Jt,m=function(A){Ge(y,Jn,x),o.loading&&He(p,dr),n.loadImage(A)},{once:!0}),Ee(y,Jn,x=function(){Ge(y,Jt,m),o.loading&&He(p,dr)},{once:!0})}),o.transition&&Ee(a,ni,function(){Ce(f,at)},{once:!0})},renderList:function(){var n=this.index,a=this.items[n];if(a){var o=a.nextElementSibling,f=parseInt(window.getComputedStyle(o||a).marginLeft,10),d=a.offsetWidth,p=d+f;nn(this.list,Ut({width:p*this.length-f},Ji({translateX:(this.viewerData.width-d)/2-p*n})))}},resetList:function(){var n=this.list;n.innerHTML="",He(n,at),nn(n,Ji({translateX:0}))},initImage:function(n){var a=this,o=this.options,f=this.image,d=this.viewerData,p=this.footer.offsetHeight,y=d.width,m=Math.max(d.height-p,p),x=this.imageData||{},S;this.imageInitializing={abort:function(){S.onload=null}},S=hl(f,o,function(A,E){var W=A/E,B=Math.max(0,Math.min(1,o.initialCoverage)),q=y,F=m;a.imageInitializing=!1,m*W>y?F=y/W:q=m*W,B=Ze(B)?B:.9,q=Math.min(q*B,A),F=Math.min(F*B,E);var N=(y-q)/2,O=(m-F)/2,$={left:N,top:O,x:N,y:O,width:q,height:F,oldRatio:1,ratio:q/A,aspectRatio:W,naturalWidth:A,naturalHeight:E},X=Ut({},$);o.rotatable&&($.rotate=x.rotate||0,X.rotate=0),o.scalable&&($.scaleX=x.scaleX||1,$.scaleY=x.scaleY||1,X.scaleX=1,X.scaleY=1),a.imageData=$,a.initialImageData=X,n&&n()})},renderImage:function(n){var a=this,o=this.image,f=this.imageData;if(nn(o,Ut({width:f.width,height:f.height,marginLeft:f.x,marginTop:f.y},Ji(f))),n)if((this.viewing||this.moving||this.rotating||this.scaling||this.zooming)&&this.options.transition&&br(o,at)){var d=function(){a.imageRendering=!1,n()};this.imageRendering={abort:function(){Ge(o,tn,d)}},Ee(o,tn,d,{once:!0})}else n()},resetImage:function(){var n=this.image;n&&(this.viewing&&this.viewing.abort(),n.parentNode.removeChild(n),this.image=null,this.title.innerHTML="")}},Th={bind:function(){var n=this.options,a=this.viewer,o=this.canvas,f=this.element.ownerDocument;Ee(a,gr,this.onClick=this.click.bind(this)),Ee(a,Ho,this.onDragStart=this.dragstart.bind(this)),Ee(o,Uo,this.onPointerDown=this.pointerdown.bind(this)),Ee(f,qo,this.onPointerMove=this.pointermove.bind(this)),Ee(f,Go,this.onPointerUp=this.pointerup.bind(this)),Ee(f,jo,this.onKeyDown=this.keydown.bind(this)),Ee(window,Ko,this.onResize=this.resize.bind(this)),n.zoomable&&n.zoomOnWheel&&Ee(a,Xo,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),n.toggleOnDblclick&&Ee(o,Va,this.onDblclick=this.dblclick.bind(this))},unbind:function(){var n=this.options,a=this.viewer,o=this.canvas,f=this.element.ownerDocument;Ge(a,gr,this.onClick),Ge(a,Ho,this.onDragStart),Ge(o,Uo,this.onPointerDown),Ge(f,qo,this.onPointerMove),Ge(f,Go,this.onPointerUp),Ge(f,jo,this.onKeyDown),Ge(window,Ko,this.onResize),n.zoomable&&n.zoomOnWheel&&Ge(a,Xo,this.onWheel,{passive:!1,capture:!0}),n.toggleOnDblclick&&Ge(o,Va,this.onDblclick)}},_h={click:function(n){var a=this.options,o=this.imageData,f=n.target,d=xr(f,Yi);switch(!d&&f.localName==="img"&&f.parentElement.localName==="li"&&(f=f.parentElement,d=xr(f,Yi)),hr&&n.isTrusted&&f===this.canvas&&clearTimeout(this.clickCanvasTimeout),d){case"mix":this.played?this.stop():a.inline?this.fulled?this.exit():this.full():this.hide();break;case"hide":this.pointerMoved||this.hide();break;case"view":this.view(xr(f,"index"));break;case"zoom-in":this.zoom(.1,!0);break;case"zoom-out":this.zoom(-.1,!0);break;case"one-to-one":this.toggle();break;case"reset":this.reset();break;case"prev":this.prev(a.loop);break;case"play":this.play(a.fullscreen);break;case"next":this.next(a.loop);break;case"rotate-left":this.rotate(-90);break;case"rotate-right":this.rotate(90);break;case"flip-horizontal":this.scaleX(-o.scaleX||-1);break;case"flip-vertical":this.scaleY(-o.scaleY||-1);break;default:this.played&&this.stop()}},dblclick:function(n){n.preventDefault(),this.viewed&&n.target===this.image&&(hr&&n.isTrusted&&clearTimeout(this.doubleClickImageTimeout),this.toggle(n.isTrusted?n:n.detail&&n.detail.originalEvent))},load:function(){var n=this;this.timeout&&(clearTimeout(this.timeout),this.timeout=!1);var a=this.element,o=this.options,f=this.image,d=this.index,p=this.viewerData;He(f,ti),o.loading&&He(this.canvas,dr),f.style.cssText="height:0;"+"margin-left:".concat(p.width/2,"px;")+"margin-top:".concat(p.height/2,"px;")+"max-width:none!important;position:relative;width:0;",this.initImage(function(){ii(f,ch,o.movable),ii(f,at,o.transition),n.renderImage(function(){n.viewed=!0,n.viewing=!1,qe(o.viewed)&&Ee(a,ni,o.viewed,{once:!0}),ot(a,ni,{originalImage:n.images[d],index:d,image:f},{cancelable:!1})})})},loadImage:function(n){var a=n.target,o=a.parentNode,f=o.offsetWidth||30,d=o.offsetHeight||50,p=!!xr(a,"filled");hl(a,this.options,function(y,m){var x=y/m,S=f,A=d;d*x>f?p?S=d*x:A=f/x:p?A=f/x:S=d*x,nn(a,Ut({width:S,height:A},Ji({translateX:(f-S)/2,translateY:(d-A)/2})))})},keydown:function(n){var a=this.options;if(a.keyboard){var o=n.keyCode||n.which||n.charCode;switch(o){case 13:this.viewer.contains(n.target)&&this.click(n);break}if(this.fulled)switch(o){case 27:this.played?this.stop():a.inline?this.fulled&&this.exit():this.hide();break;case 32:this.played&&this.stop();break;case 37:this.played&&this.playing?this.playing.prev():this.prev(a.loop);break;case 38:n.preventDefault(),this.zoom(a.zoomRatio,!0);break;case 39:this.played&&this.playing?this.playing.next():this.next(a.loop);break;case 40:n.preventDefault(),this.zoom(-a.zoomRatio,!0);break;case 48:case 49:n.ctrlKey&&(n.preventDefault(),this.toggle());break}}},dragstart:function(n){n.target.localName==="img"&&n.preventDefault()},pointerdown:function(n){var a=this.options,o=this.pointers,f=n.buttons,d=n.button;if(this.pointerMoved=!1,!(!this.viewed||this.showing||this.viewing||this.hiding||(n.type==="mousedown"||n.type==="pointerdown"&&n.pointerType==="mouse")&&(Ze(f)&&f!==1||Ze(d)&&d!==0||n.ctrlKey))){n.preventDefault(),n.changedTouches?Xe(n.changedTouches,function(y){o[y.identifier]=Zi(y)}):o[n.pointerId||0]=Zi(n);var p=a.movable?Gi:!1;a.zoomOnTouch&&a.zoomable&&Object.keys(o).length>1?p=ei:a.slideOnTouch&&(n.pointerType==="touch"||n.type==="touchstart")&&this.isSwitchable()&&(p=zo),a.transition&&(p===Gi||p===ei)&&He(this.image,at),this.action=p}},pointermove:function(n){var a=this.pointers,o=this.action;!this.viewed||!o||(n.preventDefault(),n.changedTouches?Xe(n.changedTouches,function(f){Ut(a[f.identifier]||{},Zi(f,!0))}):Ut(a[n.pointerId||0]||{},Zi(n,!0)),this.change(n))},pointerup:function(n){var a=this,o=this.options,f=this.action,d=this.pointers,p;n.changedTouches?Xe(n.changedTouches,function(y){p=d[y.identifier],delete d[y.identifier]}):(p=d[n.pointerId||0],delete d[n.pointerId||0]),f&&(n.preventDefault(),o.transition&&(f===Gi||f===ei)&&Ce(this.image,at),this.action=!1,hr&&f!==ei&&p&&Date.now()-p.timeStamp<500&&(clearTimeout(this.clickCanvasTimeout),clearTimeout(this.doubleClickImageTimeout),o.toggleOnDblclick&&this.viewed&&n.target===this.image?this.imageClicked?(this.imageClicked=!1,this.doubleClickImageTimeout=setTimeout(function(){ot(a.image,Va,{originalEvent:n})},50)):(this.imageClicked=!0,this.doubleClickImageTimeout=setTimeout(function(){a.imageClicked=!1},500)):(this.imageClicked=!1,o.backdrop&&o.backdrop!=="static"&&n.target===this.canvas&&(this.clickCanvasTimeout=setTimeout(function(){ot(a.canvas,gr,{originalEvent:n})},50)))))},resize:function(){var n=this;if(!(!this.isShown||this.hiding)&&(this.fulled&&(this.close(),this.initBody(),this.open()),this.initContainer(),this.initViewer(),this.renderViewer(),this.renderList(),this.viewed&&this.initImage(function(){n.renderImage()}),this.played)){if(this.options.fullscreen&&this.fulled&&!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)){this.stop();return}Xe(this.player.getElementsByTagName("img"),function(a){Ee(a,Jt,n.loadImage.bind(n),{once:!0}),ot(a,Jt)})}},wheel:function(n){var a=this;if(this.viewed&&(n.preventDefault(),!this.wheeling)){this.wheeling=!0,setTimeout(function(){a.wheeling=!1},50);var o=Number(this.options.zoomRatio)||.1,f=1;n.deltaY?f=n.deltaY>0?1:-1:n.wheelDelta?f=-n.wheelDelta/120:n.detail&&(f=n.detail>0?1:-1),this.zoom(-f*o,!0,null,n)}}},Lh={show:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,a=this.element,o=this.options;if(o.inline||this.showing||this.isShown||this.showing)return this;if(!this.ready)return this.build(),this.ready&&this.show(n),this;if(qe(o.show)&&Ee(a,Vo,o.show,{once:!0}),ot(a,Vo)===!1||!this.ready)return this;this.hiding&&this.transitioning.abort(),this.showing=!0,this.open();var f=this.viewer;if(He(f,Vn),f.setAttribute("role","dialog"),f.setAttribute("aria-labelledby",this.title.id),f.setAttribute("aria-modal",!0),f.removeAttribute("aria-hidden"),o.transition&&!n){var d=this.shown.bind(this);this.transitioning={abort:function(){Ge(f,tn,d),He(f,Vt)}},Ce(f,at),f.initialOffsetWidth=f.offsetWidth,Ee(f,tn,d,{once:!0}),Ce(f,Vt)}else Ce(f,Vt),this.shown();return this},hide:function(){var n=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,o=this.element,f=this.options;if(f.inline||this.hiding||!(this.isShown||this.showing))return this;if(qe(f.hide)&&Ee(o,Qo,f.hide,{once:!0}),ot(o,Qo)===!1)return this;this.showing&&this.transitioning.abort(),this.hiding=!0,this.played?this.stop():this.viewing&&this.viewing.abort();var d=this.viewer,p=this.image,y=function(){He(d,Vt),n.hidden()};if(f.transition&&!a){var m=function(A){A&&A.target===d&&(Ge(d,tn,m),n.hidden())},x=function(){br(d,at)?(Ee(d,tn,m),He(d,Vt)):y()};this.transitioning={abort:function(){n.viewed&&br(p,at)?Ge(p,tn,x):br(d,at)&&Ge(d,tn,m)}},this.viewed&&br(p,at)?(Ee(p,tn,x,{once:!0}),this.zoomTo(0,!1,null,null,!0)):x()}else y();return this},view:function(){var n=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.initialViewIndex;if(a=Number(a)||0,this.hiding||this.played||a<0||a>=this.length||this.viewed&&a===this.index)return this;if(!this.isShown)return this.index=a,this.show();this.viewing&&this.viewing.abort();var o=this.element,f=this.options,d=this.title,p=this.canvas,y=this.items[a],m=y.querySelector("img"),x=xr(m,"originalUrl"),S=m.getAttribute("alt"),A=document.createElement("img");if(Xe(f.inheritedAttributes,function(F){var N=m.getAttribute(F);N!==null&&A.setAttribute(F,N)}),A.src=x,A.alt=S,qe(f.view)&&Ee(o,el,f.view,{once:!0}),ot(o,el,{originalImage:this.images[a],index:a,image:A})===!1||!this.isShown||this.hiding||this.played)return this;var E=this.items[this.index];E&&(He(E,Ki),E.removeAttribute("aria-selected")),Ce(y,Ki),y.setAttribute("aria-selected",!0),f.focus&&y.focus(),this.image=A,this.viewed=!1,this.index=a,this.imageData={},Ce(A,ti),f.loading&&Ce(p,dr),p.innerHTML="",p.appendChild(A),this.renderList(),d.innerHTML="";var W=function(){var N=n.imageData,O=Array.isArray(f.title)?f.title[1]:f.title;d.innerHTML=yh(qe(O)?O.call(n,A,N):"".concat(S," (").concat(N.naturalWidth," × ").concat(N.naturalHeight,")"))},B,q;return Ee(o,ni,W,{once:!0}),this.viewing={abort:function(){Ge(o,ni,W),A.complete?n.imageRendering?n.imageRendering.abort():n.imageInitializing&&n.imageInitializing.abort():(A.src="",Ge(A,Jt,B),n.timeout&&clearTimeout(n.timeout))}},A.complete?this.load():(Ee(A,Jt,B=function(){Ge(A,Jn,q),n.load()},{once:!0}),Ee(A,Jn,q=function(){Ge(A,Jt,B),n.timeout&&(clearTimeout(n.timeout),n.timeout=!1),He(A,ti),f.loading&&He(n.canvas,dr)},{once:!0}),this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(function(){He(A,ti),n.timeout=!1},1e3)),this},prev:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,a=this.index-1;return a<0&&(a=n?this.length-1:0),this.view(a),this},next:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,a=this.length-1,o=this.index+1;return o>a&&(o=n?0:a),this.view(o),this},move:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:n,o=this.imageData;return this.moveTo(mr(n)?n:o.x+Number(n),mr(a)?a:o.y+Number(a)),this},moveTo:function(n){var a=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:n,f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,d=this.element,p=this.options,y=this.imageData;if(n=Number(n),o=Number(o),this.viewed&&!this.played&&p.movable){var m=y.x,x=y.y,S=!1;if(Ze(n)?S=!0:n=m,Ze(o)?S=!0:o=x,S){if(qe(p.move)&&Ee(d,tl,p.move,{once:!0}),ot(d,tl,{x:n,y:o,oldX:m,oldY:x,originalEvent:f})===!1)return this;y.x=n,y.y=o,y.left=n,y.top=o,this.moving=!0,this.renderImage(function(){a.moving=!1,qe(p.moved)&&Ee(d,nl,p.moved,{once:!0}),ot(d,nl,{x:n,y:o,oldX:m,oldY:x,originalEvent:f},{cancelable:!1})})}}return this},rotate:function(n){return this.rotateTo((this.imageData.rotate||0)+Number(n)),this},rotateTo:function(n){var a=this,o=this.element,f=this.options,d=this.imageData;if(n=Number(n),Ze(n)&&this.viewed&&!this.played&&f.rotatable){var p=d.rotate;if(qe(f.rotate)&&Ee(o,rl,f.rotate,{once:!0}),ot(o,rl,{degree:n,oldDegree:p})===!1)return this;d.rotate=n,this.rotating=!0,this.renderImage(function(){a.rotating=!1,qe(f.rotated)&&Ee(o,il,f.rotated,{once:!0}),ot(o,il,{degree:n,oldDegree:p},{cancelable:!1})})}return this},scaleX:function(n){return this.scale(n,this.imageData.scaleY),this},scaleY:function(n){return this.scale(this.imageData.scaleX,n),this},scale:function(n){var a=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:n,f=this.element,d=this.options,p=this.imageData;if(n=Number(n),o=Number(o),this.viewed&&!this.played&&d.scalable){var y=p.scaleX,m=p.scaleY,x=!1;if(Ze(n)?x=!0:n=y,Ze(o)?x=!0:o=m,x){if(qe(d.scale)&&Ee(f,al,d.scale,{once:!0}),ot(f,al,{scaleX:n,scaleY:o,oldScaleX:y,oldScaleY:m})===!1)return this;p.scaleX=n,p.scaleY=o,this.scaling=!0,this.renderImage(function(){a.scaling=!1,qe(d.scaled)&&Ee(f,sl,d.scaled,{once:!0}),ot(f,sl,{scaleX:n,scaleY:o,oldScaleX:y,oldScaleY:m},{cancelable:!1})})}}return this},zoom:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,f=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,d=this.imageData;return n=Number(n),n<0?n=1/(1-n):n=1+n,this.zoomTo(d.width*n/d.naturalWidth,a,o,f),this},zoomTo:function(n){var a=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,p=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,y=this.element,m=this.options,x=this.pointers,S=this.imageData,A=S.x,E=S.y,W=S.width,B=S.height,q=S.naturalWidth,F=S.naturalHeight;if(n=Math.max(0,n),Ze(n)&&this.viewed&&!this.played&&(p||m.zoomable)){if(!p){var N=Math.max(.01,m.minZoomRatio),O=Math.min(100,m.maxZoomRatio);n=Math.min(Math.max(n,N),O)}if(d)switch(d.type){case"wheel":m.zoomRatio>=.055&&n>.95&&n<1.05&&(n=1);break;case"pointermove":case"touchmove":case"mousemove":n>.99&&n<1.01&&(n=1);break}var $=q*n,X=F*n,ne=$-W,ue=X-B,se=S.ratio;if(qe(m.zoom)&&Ee(y,ol,m.zoom,{once:!0}),ot(y,ol,{ratio:n,oldRatio:se,originalEvent:d})===!1)return this;if(this.zooming=!0,d){var he=xh(this.viewer),Oe=x&&Object.keys(x).length>0?Sh(x):{pageX:d.pageX,pageY:d.pageY};S.x-=ne*((Oe.pageX-he.left-A)/W),S.y-=ue*((Oe.pageY-he.top-E)/B)}else yr(f)&&Ze(f.x)&&Ze(f.y)?(S.x-=ne*((f.x-A)/W),S.y-=ue*((f.y-E)/B)):(S.x-=ne/2,S.y-=ue/2);S.left=S.x,S.top=S.y,S.width=$,S.height=X,S.oldRatio=se,S.ratio=n,this.renderImage(function(){a.zooming=!1,qe(m.zoomed)&&Ee(y,ll,m.zoomed,{once:!0}),ot(y,ll,{ratio:n,oldRatio:se,originalEvent:d},{cancelable:!1})}),o&&this.tooltip()}return this},play:function(){var n=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(!this.isShown||this.played)return this;var o=this.element,f=this.options;if(qe(f.play)&&Ee(o,ul,f.play,{once:!0}),ot(o,ul)===!1)return this;var d=this.player,p=this.loadImage.bind(this),y=[],m=0,x=0;if(this.played=!0,this.onLoadWhenPlay=p,a&&this.requestFullscreen(a),Ce(d,pr),Xe(this.items,function(E,W){var B=E.querySelector("img"),q=document.createElement("img");q.src=xr(B,"originalUrl"),q.alt=B.getAttribute("alt"),q.referrerPolicy=B.referrerPolicy,m+=1,Ce(q,Xi),ii(q,at,f.transition),br(E,Ki)&&(Ce(q,Vt),x=W),y.push(q),Ee(q,Jt,p,{once:!0}),d.appendChild(q)}),Ze(f.interval)&&f.interval>0){var S=function(){clearTimeout(n.playing.timeout),He(y[x],Vt),x-=1,x=x>=0?x:m-1,Ce(y[x],Vt),n.playing.timeout=setTimeout(S,f.interval)},A=function(){clearTimeout(n.playing.timeout),He(y[x],Vt),x+=1,x=x<m?x:0,Ce(y[x],Vt),n.playing.timeout=setTimeout(A,f.interval)};m>1&&(this.playing={prev:S,next:A,timeout:setTimeout(A,f.interval)})}return this},stop:function(){var n=this;if(!this.played)return this;var a=this.element,o=this.options;if(qe(o.stop)&&Ee(a,fl,o.stop,{once:!0}),ot(a,fl)===!1)return this;var f=this.player;return clearTimeout(this.playing.timeout),this.playing=!1,this.played=!1,Xe(f.getElementsByTagName("img"),function(d){Ge(d,Jt,n.onLoadWhenPlay)}),He(f,pr),f.innerHTML="",this.exitFullscreen(),this},full:function(){var n=this,a=this.options,o=this.viewer,f=this.image,d=this.list;return!this.isShown||this.played||this.fulled||!a.inline?this:(this.fulled=!0,this.open(),Ce(this.button,$o),a.transition&&(He(d,at),this.viewed&&He(f,at)),Ce(o,Ya),o.setAttribute("role","dialog"),o.setAttribute("aria-labelledby",this.title.id),o.setAttribute("aria-modal",!0),o.removeAttribute("style"),nn(o,{zIndex:a.zIndex}),a.focus&&this.enforceFocus(),this.initContainer(),this.viewerData=Ut({},this.containerData),this.renderList(),this.viewed&&this.initImage(function(){n.renderImage(function(){a.transition&&setTimeout(function(){Ce(f,at),Ce(d,at)},0)})}),this)},exit:function(){var n=this,a=this.options,o=this.viewer,f=this.image,d=this.list;return!this.isShown||this.played||!this.fulled||!a.inline?this:(this.fulled=!1,this.close(),He(this.button,$o),a.transition&&(He(d,at),this.viewed&&He(f,at)),a.focus&&this.clearEnforceFocus(),o.removeAttribute("role"),o.removeAttribute("aria-labelledby"),o.removeAttribute("aria-modal"),He(o,Ya),nn(o,{zIndex:a.zIndexInline}),this.viewerData=Ut({},this.parentData),this.renderViewer(),this.renderList(),this.viewed&&this.initImage(function(){n.renderImage(function(){a.transition&&setTimeout(function(){Ce(f,at),Ce(d,at)},0)})}),this)},tooltip:function(){var n=this,a=this.options,o=this.tooltipBox,f=this.imageData;return!this.viewed||this.played||!a.tooltip?this:(o.textContent="".concat(Math.round(f.ratio*100),"%"),this.tooltipping?clearTimeout(this.tooltipping):a.transition?(this.fading&&ot(o,tn),Ce(o,pr),Ce(o,Xi),Ce(o,at),o.removeAttribute("aria-hidden"),o.initialOffsetWidth=o.offsetWidth,Ce(o,Vt)):(Ce(o,pr),o.removeAttribute("aria-hidden")),this.tooltipping=setTimeout(function(){a.transition?(Ee(o,tn,function(){He(o,pr),He(o,Xi),He(o,at),o.setAttribute("aria-hidden",!0),n.fading=!1},{once:!0}),He(o,Vt),n.fading=!0):(He(o,pr),o.setAttribute("aria-hidden",!0)),n.tooltipping=!1},1e3),this)},toggle:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return this.imageData.ratio===1?this.zoomTo(this.imageData.oldRatio,!0,null,n):this.zoomTo(1,!0,null,n),this},reset:function(){return this.viewed&&!this.played&&(this.imageData=Ut({},this.initialImageData),this.renderImage()),this},update:function(){var n=this,a=this.element,o=this.options,f=this.isImg;if(f&&!a.parentNode)return this.destroy();var d=[];if(Xe(f?[a]:a.querySelectorAll("img"),function(x){qe(o.filter)?o.filter.call(n,x)&&d.push(x):n.getImageURL(x)&&d.push(x)}),!d.length)return this;if(this.images=d,this.length=d.length,this.ready){var p=[];if(Xe(this.items,function(x,S){var A=x.querySelector("img"),E=d[S];E&&A?(E.src!==A.src||E.alt!==A.alt)&&p.push(S):p.push(S)}),nn(this.list,{width:"auto"}),this.initList(),this.isShown)if(this.length){if(this.viewed){var y=p.indexOf(this.index);if(y>=0)this.viewed=!1,this.view(Math.max(Math.min(this.index-y,this.length-1),0));else{var m=this.items[this.index];Ce(m,Ki),m.setAttribute("aria-selected",!0)}}}else this.image=null,this.viewed=!1,this.index=0,this.imageData={},this.canvas.innerHTML="",this.title.innerHTML=""}else this.build();return this},destroy:function(){var n=this.element,a=this.options;return n[Ne]?(this.destroyed=!0,this.ready?(this.played&&this.stop(),a.inline?(this.fulled&&this.exit(),this.unbind()):this.isShown?(this.viewing&&(this.imageRendering?this.imageRendering.abort():this.imageInitializing&&this.imageInitializing.abort()),this.hiding&&this.transitioning.abort(),this.hidden()):this.showing&&(this.transitioning.abort(),this.hidden()),this.ready=!1,this.viewer.parentNode.removeChild(this.viewer)):a.inline&&(this.delaying?this.delaying.abort():this.initializing&&this.initializing.abort()),a.inline||Ge(n,gr,this.onStart),n[Ne]=void 0,this):this}},Eh={getImageURL:function(n){var a=this.options.url;return ri(a)?a=n.getAttribute(a):qe(a)?a=a.call(this,n):a="",a},enforceFocus:function(){var n=this;this.clearEnforceFocus(),Ee(document,Wo,this.onFocusin=function(a){var o=n.viewer,f=a.target;if(!(f===document||f===o||o.contains(f))){for(;f;){if(f.getAttribute("tabindex")!==null||f.getAttribute("aria-modal")==="true")return;f=f.parentElement}o.focus()}})},clearEnforceFocus:function(){this.onFocusin&&(Ge(document,Wo,this.onFocusin),this.onFocusin=null)},open:function(){var n=this.body;Ce(n,Bo),this.scrollbarWidth>0&&(n.style.paddingRight="".concat(this.scrollbarWidth+(parseFloat(this.initialBodyComputedPaddingRight)||0),"px"))},close:function(){var n=this.body;He(n,Bo),this.scrollbarWidth>0&&(n.style.paddingRight=this.initialBodyPaddingRight)},shown:function(){var n=this.element,a=this.options,o=this.viewer;this.fulled=!0,this.isShown=!0,this.render(),this.bind(),this.showing=!1,a.focus&&(o.focus(),this.enforceFocus()),qe(a.shown)&&Ee(n,Jo,a.shown,{once:!0}),ot(n,Jo)!==!1&&this.ready&&this.isShown&&!this.hiding&&this.view(this.index)},hidden:function(){var n=this.element,a=this.options,o=this.viewer;a.fucus&&this.clearEnforceFocus(),this.close(),this.unbind(),Ce(o,Vn),o.removeAttribute("role"),o.removeAttribute("aria-labelledby"),o.removeAttribute("aria-modal"),o.setAttribute("aria-hidden",!0),this.resetList(),this.resetImage(),this.fulled=!1,this.viewed=!1,this.isShown=!1,this.hiding=!1,this.destroyed||(qe(a.hidden)&&Ee(n,Zo,a.hidden,{once:!0}),ot(n,Zo,null,{cancelable:!1}))},requestFullscreen:function(n){var a=this.element.ownerDocument;if(this.fulled&&!(a.fullscreenElement||a.webkitFullscreenElement||a.mozFullScreenElement||a.msFullscreenElement)){var o=a.documentElement;o.requestFullscreen?yr(n)?o.requestFullscreen(n):o.requestFullscreen():o.webkitRequestFullscreen?o.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):o.mozRequestFullScreen?o.mozRequestFullScreen():o.msRequestFullscreen&&o.msRequestFullscreen()}},exitFullscreen:function(){var n=this.element.ownerDocument;this.fulled&&(n.fullscreenElement||n.webkitFullscreenElement||n.mozFullScreenElement||n.msFullscreenElement)&&(n.exitFullscreen?n.exitFullscreen():n.webkitExitFullscreen?n.webkitExitFullscreen():n.mozCancelFullScreen?n.mozCancelFullScreen():n.msExitFullscreen&&n.msExitFullscreen())},change:function(n){var a=this.options,o=this.pointers,f=o[Object.keys(o)[0]];if(f){var d=f.endX-f.startX,p=f.endY-f.startY;switch(this.action){case Gi:(d!==0||p!==0)&&(this.pointerMoved=!0,this.move(d,p,n));break;case ei:this.zoom(kh(o),!1,null,n);break;case zo:{this.action="switched";var y=Math.abs(d);y>1&&y>Math.abs(p)&&(this.pointers={},d>1?this.prev(a.loop):d<-1&&this.next(a.loop));break}}Xe(o,function(m){m.startX=m.endX,m.startY=m.endY})}},isSwitchable:function(){var n=this.imageData,a=this.viewerData;return this.length>1&&n.x>=0&&n.y>=0&&n.width<=a.width&&n.height<=a.height}},Dh=wn.Viewer,Ah=function(u){return function(){return u+=1,u}}(-1),dl=function(){function u(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(th(this,u),!n||n.nodeType!==1)throw new Error("The first argument is required and must be an element.");this.element=n,this.options=Ut({},Po,yr(a)&&a),this.action=!1,this.fading=!1,this.fulled=!1,this.hiding=!1,this.imageClicked=!1,this.imageData={},this.index=this.options.initialViewIndex,this.isImg=!1,this.isShown=!1,this.length=0,this.moving=!1,this.played=!1,this.playing=!1,this.pointers={},this.ready=!1,this.rotating=!1,this.scaling=!1,this.showing=!1,this.timeout=!1,this.tooltipping=!1,this.viewed=!1,this.viewing=!1,this.wheeling=!1,this.zooming=!1,this.pointerMoved=!1,this.id=Ah(),this.init()}return nh(u,[{key:"init",value:function(){var a=this,o=this.element,f=this.options;if(!o[Ne]){o[Ne]=this,f.focus&&!f.keyboard&&(f.focus=!1);var d=o.localName==="img",p=[];if(Xe(d?[o]:o.querySelectorAll("img"),function(x){qe(f.filter)?f.filter.call(a,x)&&p.push(x):a.getImageURL(x)&&p.push(x)}),this.isImg=d,this.length=p.length,this.images=p,this.initBody(),mr(document.createElement(Ne).style.transition)&&(f.transition=!1),f.inline){var y=0,m=function(){if(y+=1,y===a.length){var S;a.initializing=!1,a.delaying={abort:function(){clearTimeout(S)}},S=setTimeout(function(){a.delaying=!1,a.build()},0)}};this.initializing={abort:function(){Xe(p,function(S){S.complete||(Ge(S,Jt,m),Ge(S,Jn,m))})}},Xe(p,function(x){if(x.complete)m();else{var S,A;Ee(x,Jt,S=function(){Ge(x,Jn,A),m()},{once:!0}),Ee(x,Jn,A=function(){Ge(x,Jt,S),m()},{once:!0})}})}else Ee(o,gr,this.onStart=function(x){var S=x.target;S.localName==="img"&&(!qe(f.filter)||f.filter.call(a,S))&&a.view(a.images.indexOf(S))})}}},{key:"build",value:function(){if(!this.ready){var a=this.element,o=this.options,f=a.parentNode,d=document.createElement("div");d.innerHTML=ah;var p=d.querySelector(".".concat(Ne,"-container")),y=p.querySelector(".".concat(Ne,"-title")),m=p.querySelector(".".concat(Ne,"-toolbar")),x=p.querySelector(".".concat(Ne,"-navbar")),S=p.querySelector(".".concat(Ne,"-button")),A=p.querySelector(".".concat(Ne,"-canvas"));if(this.parent=f,this.viewer=p,this.title=y,this.toolbar=m,this.navbar=x,this.button=S,this.canvas=A,this.footer=p.querySelector(".".concat(Ne,"-footer")),this.tooltipBox=p.querySelector(".".concat(Ne,"-tooltip")),this.player=p.querySelector(".".concat(Ne,"-player")),this.list=p.querySelector(".".concat(Ne,"-list")),p.id="".concat(Ne).concat(this.id),y.id="".concat(Ne,"Title").concat(this.id),Ce(y,o.title?Qi(Array.isArray(o.title)?o.title[0]:o.title):Vn),Ce(x,o.navbar?Qi(o.navbar):Vn),ii(S,Vn,!o.button),o.keyboard&&S.setAttribute("tabindex",0),o.backdrop&&(Ce(p,"".concat(Ne,"-backdrop")),!o.inline&&o.backdrop!=="static"&&Za(A,Yi,"hide")),ri(o.className)&&o.className&&o.className.split(Ja).forEach(function($){Ce(p,$)}),o.toolbar){var E=document.createElement("ul"),W=yr(o.toolbar),B=Vi.slice(0,3),q=Vi.slice(7,9),F=Vi.slice(9);W||Ce(m,Qi(o.toolbar)),Xe(W?o.toolbar:Vi,function($,X){var ne=W&&yr($),ue=W?Qa(X):$,se=ne&&!mr($.show)?$.show:$;if(!(!se||!o.zoomable&&B.indexOf(ue)!==-1||!o.rotatable&&q.indexOf(ue)!==-1||!o.scalable&&F.indexOf(ue)!==-1)){var he=ne&&!mr($.size)?$.size:$,Oe=ne&&!mr($.click)?$.click:$,Re=document.createElement("li");o.keyboard&&Re.setAttribute("tabindex",0),Re.setAttribute("role","button"),Ce(Re,"".concat(Ne,"-").concat(ue)),qe(Oe)||Za(Re,Yi,ue),Ze(se)&&Ce(Re,Qi(se)),["small","large"].indexOf(he)!==-1?Ce(Re,"".concat(Ne,"-").concat(he)):ue==="play"&&Ce(Re,"".concat(Ne,"-large")),qe(Oe)&&Ee(Re,gr,Oe),E.appendChild(Re)}}),m.appendChild(E)}else Ce(m,Vn);if(!o.rotatable){var N=m.querySelectorAll('li[class*="rotate"]');Ce(N,ti),Xe(N,function($){m.appendChild($)})}if(o.inline)Ce(S,oh),nn(p,{zIndex:o.zIndexInline}),window.getComputedStyle(f).position==="static"&&nn(f,{position:"relative"}),f.insertBefore(p,a.nextSibling);else{Ce(S,sh),Ce(p,Ya),Ce(p,Xi),Ce(p,Vn),nn(p,{zIndex:o.zIndex});var O=o.container;ri(O)&&(O=a.ownerDocument.querySelector(O)),O||(O=this.body),O.appendChild(p)}if(o.inline&&(this.render(),this.bind(),this.isShown=!0),this.ready=!0,qe(o.ready)&&Ee(a,Yo,o.ready,{once:!0}),ot(a,Yo)===!1){this.ready=!1;return}this.ready&&o.inline&&this.view(this.index)}}}],[{key:"noConflict",value:function(){return window.Viewer=Dh,u}},{key:"setDefaults",value:function(a){Ut(Po,yr(a)&&a)}}])}();Ut(dl.prototype,Ch,Th,_h,Lh,Eh);var Ih=typeof global=="object"&&global&&global.Object===Object&&global,pl=Ih,Oh=typeof self=="object"&&self&&self.Object===Object&&self,Nh=pl||Oh||Function("return this")(),ts=Nh,Mh=ts.Symbol,ea=Mh,gl=Object.prototype,Rh=gl.hasOwnProperty,Fh=gl.toString,ai=ea?ea.toStringTag:void 0;function Ph(u){var n=Rh.call(u,ai),a=u[ai];try{u[ai]=void 0;var o=!0}catch{}var f=Fh.call(u);return o&&(n?u[ai]=a:delete u[ai]),f}var zh=Object.prototype,$h=zh.toString;function Bh(u){return $h.call(u)}var Hh="[object Null]",Wh="[object Undefined]",ml=ea?ea.toStringTag:void 0;function ns(u){return u==null?u===void 0?Wh:Hh:ml&&ml in Object(u)?Ph(u):Bh(u)}function rs(u){return u!=null&&typeof u=="object"}var jh=Array.isArray,Uh=jh;function is(u){var n=typeof u;return u!=null&&(n=="object"||n=="function")}function vl(u){return u}var qh="[object AsyncFunction]",Gh="[object Function]",Kh="[object GeneratorFunction]",Xh="[object Proxy]";function yl(u){if(!is(u))return!1;var n=ns(u);return n==Gh||n==Kh||n==qh||n==Xh}var Yh=ts["__core-js_shared__"],as=Yh,bl=function(){var u=/[^.]+$/.exec(as&&as.keys&&as.keys.IE_PROTO||"");return u?"Symbol(src)_1."+u:""}();function Vh(u){return!!bl&&bl in u}var Jh=Function.prototype,Qh=Jh.toString;function Zh(u){if(u!=null){try{return Qh.call(u)}catch{}try{return u+""}catch{}}return""}var ed=/[\\^$.*+?()[\]{}|]/g,td=/^\[object .+?Constructor\]$/,nd=Function.prototype,rd=Object.prototype,id=nd.toString,ad=rd.hasOwnProperty,sd=RegExp("^"+id.call(ad).replace(ed,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function od(u){if(!is(u)||Vh(u))return!1;var n=yl(u)?sd:td;return n.test(Zh(u))}function ld(u,n){return u==null?void 0:u[n]}function ud(u,n){var a=ld(u,n);return od(a)?a:void 0}function fd(u,n,a){switch(a.length){case 0:return u.call(n);case 1:return u.call(n,a[0]);case 2:return u.call(n,a[0],a[1]);case 3:return u.call(n,a[0],a[1],a[2])}return u.apply(n,a)}var cd=800,hd=16,dd=Date.now;function pd(u){var n=0,a=0;return function(){var o=dd(),f=hd-(o-a);if(a=o,f>0){if(++n>=cd)return arguments[0]}else n=0;return u.apply(void 0,arguments)}}function gd(u){return function(){return u}}var md=function(){try{var u=ud(Object,"defineProperty");return u({},"",{}),u}catch{}}(),ta=md,vd=ta?function(u,n){return ta(u,"toString",{configurable:!0,enumerable:!1,value:gd(n),writable:!0})}:vl,yd=vd,bd=pd(yd),xd=bd,wd=9007199254740991,kd=/^(?:0|[1-9]\d*)$/;function xl(u,n){var a=typeof u;return n=n??wd,!!n&&(a=="number"||a!="symbol"&&kd.test(u))&&u>-1&&u%1==0&&u<n}function wl(u,n,a){n=="__proto__"&&ta?ta(u,n,{configurable:!0,enumerable:!0,value:a,writable:!0}):u[n]=a}function kl(u,n){return u===n||u!==u&&n!==n}var Sd=Object.prototype,Cd=Sd.hasOwnProperty;function Sl(u,n,a){var o=u[n];(!(Cd.call(u,n)&&kl(o,a))||a===void 0&&!(n in u))&&wl(u,n,a)}function Td(u,n,a,o){var f=!a;a||(a={});for(var d=-1,p=n.length;++d<p;){var y=n[d],m=void 0;m===void 0&&(m=u[y]),f?wl(a,y,m):Sl(a,y,m)}return a}var Cl=Math.max;function _d(u,n,a){return n=Cl(n===void 0?u.length-1:n,0),function(){for(var o=arguments,f=-1,d=Cl(o.length-n,0),p=Array(d);++f<d;)p[f]=o[n+f];f=-1;for(var y=Array(n+1);++f<n;)y[f]=o[f];return y[n]=a(p),fd(u,this,y)}}function Ld(u,n){return xd(_d(u,n,vl),u+"")}var Ed=9007199254740991;function Tl(u){return typeof u=="number"&&u>-1&&u%1==0&&u<=Ed}function ss(u){return u!=null&&Tl(u.length)&&!yl(u)}function Dd(u,n,a){if(!is(a))return!1;var o=typeof n;return(o=="number"?ss(a)&&xl(n,a.length):o=="string"&&n in a)?kl(a[n],u):!1}function Ad(u){return Ld(function(n,a){var o=-1,f=a.length,d=f>1?a[f-1]:void 0,p=f>2?a[2]:void 0;for(d=u.length>3&&typeof d=="function"?(f--,d):void 0,p&&Dd(a[0],a[1],p)&&(d=f<3?void 0:d,f=1),n=Object(n);++o<f;){var y=a[o];y&&u(n,y,o,d)}return n})}var Id=Object.prototype;function _l(u){var n=u&&u.constructor,a=typeof n=="function"&&n.prototype||Id;return u===a}function Od(u,n){for(var a=-1,o=Array(u);++a<u;)o[a]=n(a);return o}var Nd="[object Arguments]";function Ll(u){return rs(u)&&ns(u)==Nd}var El=Object.prototype,Md=El.hasOwnProperty,Rd=El.propertyIsEnumerable,Fd=Ll(function(){return arguments}())?Ll:function(u){return rs(u)&&Md.call(u,"callee")&&!Rd.call(u,"callee")},Pd=Fd;function zd(){return!1}var Dl=typeof Ie=="object"&&Ie&&!Ie.nodeType&&Ie,Al=Dl&&typeof module=="object"&&module&&!module.nodeType&&module,$d=Al&&Al.exports===Dl,Il=$d?ts.Buffer:void 0,Bd=Il?Il.isBuffer:void 0,Hd=Bd||zd,Wd=Hd,jd="[object Arguments]",Ud="[object Array]",qd="[object Boolean]",Gd="[object Date]",Kd="[object Error]",Xd="[object Function]",Yd="[object Map]",Vd="[object Number]",Jd="[object Object]",Qd="[object RegExp]",Zd="[object Set]",ep="[object String]",tp="[object WeakMap]",np="[object ArrayBuffer]",rp="[object DataView]",ip="[object Float32Array]",ap="[object Float64Array]",sp="[object Int8Array]",op="[object Int16Array]",lp="[object Int32Array]",up="[object Uint8Array]",fp="[object Uint8ClampedArray]",cp="[object Uint16Array]",hp="[object Uint32Array]",Ye={};Ye[ip]=Ye[ap]=Ye[sp]=Ye[op]=Ye[lp]=Ye[up]=Ye[fp]=Ye[cp]=Ye[hp]=!0,Ye[jd]=Ye[Ud]=Ye[np]=Ye[qd]=Ye[rp]=Ye[Gd]=Ye[Kd]=Ye[Xd]=Ye[Yd]=Ye[Vd]=Ye[Jd]=Ye[Qd]=Ye[Zd]=Ye[ep]=Ye[tp]=!1;function dp(u){return rs(u)&&Tl(u.length)&&!!Ye[ns(u)]}function pp(u){return function(n){return u(n)}}var Ol=typeof Ie=="object"&&Ie&&!Ie.nodeType&&Ie,si=Ol&&typeof module=="object"&&module&&!module.nodeType&&module,gp=si&&si.exports===Ol,os=gp&&pl.process,mp=function(){try{var u=si&&si.require&&si.require("util").types;return u||os&&os.binding&&os.binding("util")}catch{}}(),Nl=mp,Ml=Nl&&Nl.isTypedArray,vp=Ml?pp(Ml):dp,yp=vp,bp=Object.prototype,xp=bp.hasOwnProperty;function wp(u,n){var a=Uh(u),o=!a&&Pd(u),f=!a&&!o&&Wd(u),d=!a&&!o&&!f&&yp(u),p=a||o||f||d,y=p?Od(u.length,String):[],m=y.length;for(var x in u)xp.call(u,x)&&!(p&&(x=="length"||f&&(x=="offset"||x=="parent")||d&&(x=="buffer"||x=="byteLength"||x=="byteOffset")||xl(x,m)))&&y.push(x);return y}function kp(u,n){return function(a){return u(n(a))}}var Sp=kp(Object.keys,Object),Cp=Sp,Tp=Object.prototype,_p=Tp.hasOwnProperty;function Lp(u){if(!_l(u))return Cp(u);var n=[];for(var a in Object(u))_p.call(u,a)&&a!="constructor"&&n.push(a);return n}function Ep(u){return ss(u)?wp(u):Lp(u)}var Dp=Object.prototype,Ap=Dp.hasOwnProperty,Ip=Ad(function(u,n){if(_l(n)||ss(n)){Td(n,Ep(n),u);return}for(var a in n)Ap.call(n,a)&&Sl(u,a,n[a])}),Op=Ip;const Rl=({images:u=[],options:n={}}={})=>{n=Op(n,{inline:!1});const a=Kf.extend({render(p){return p("div",{style:{display:"none"},class:["__viewer-token"]},u.map(y=>p("img",{attrs:typeof y=="string"?{src:y}:y})))}}),o=new a;o.$mount(),document.body.appendChild(o.$el);const f=new dl(o.$el,n),d=f.destroy.bind(f);return f.destroy=function(){return d(),o.$destroy(),document.body.removeChild(o.$el),f},f.show(),o.$el.addEventListener("hidden",function(){this.viewer===f&&f.destroy()}),f};var Fl={exports:{}},Pl;function Np(){return Pl||(Pl=1,function(u,n){(function(a){a(Wt())})(function(a){var o={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},f={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};a.defineMode("xml",function(d,p){var y=d.indentUnit,m={},x=p.htmlMode?o:f;for(var S in x)m[S]=x[S];for(var S in p)m[S]=p[S];var A,E;function W(k,J){function G(K){return J.tokenize=K,K(k,J)}var D=k.next();if(D=="<")return k.eat("!")?k.eat("[")?k.match("CDATA[")?G(F("atom","]]>")):null:k.match("--")?G(F("comment","-->")):k.match("DOCTYPE",!0,!0)?(k.eatWhile(/[\w\._\-]/),G(N(1))):null:k.eat("?")?(k.eatWhile(/[\w\._\-]/),J.tokenize=F("meta","?>"),"meta"):(A=k.eat("/")?"closeTag":"openTag",J.tokenize=B,"tag bracket");if(D=="&"){var R;return k.eat("#")?k.eat("x")?R=k.eatWhile(/[a-fA-F\d]/)&&k.eat(";"):R=k.eatWhile(/[\d]/)&&k.eat(";"):R=k.eatWhile(/[\w\.\-:]/)&&k.eat(";"),R?"atom":"error"}else return k.eatWhile(/[^&<]/),null}W.isInText=!0;function B(k,J){var G=k.next();if(G==">"||G=="/"&&k.eat(">"))return J.tokenize=W,A=G==">"?"endTag":"selfcloseTag","tag bracket";if(G=="=")return A="equals",null;if(G=="<"){J.tokenize=W,J.state=ue,J.tagName=J.tagStart=null;var D=J.tokenize(k,J);return D?D+" tag error":"tag error"}else return/[\'\"]/.test(G)?(J.tokenize=q(G),J.stringStartCol=k.column(),J.tokenize(k,J)):(k.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function q(k){var J=function(G,D){for(;!G.eol();)if(G.next()==k){D.tokenize=B;break}return"string"};return J.isInAttribute=!0,J}function F(k,J){return function(G,D){for(;!G.eol();){if(G.match(J)){D.tokenize=W;break}G.next()}return k}}function N(k){return function(J,G){for(var D;(D=J.next())!=null;){if(D=="<")return G.tokenize=N(k+1),G.tokenize(J,G);if(D==">")if(k==1){G.tokenize=W;break}else return G.tokenize=N(k-1),G.tokenize(J,G)}return"meta"}}function O(k){return k&&k.toLowerCase()}function $(k,J,G){this.prev=k.context,this.tagName=J||"",this.indent=k.indented,this.startOfLine=G,(m.doNotIndent.hasOwnProperty(J)||k.context&&k.context.noIndent)&&(this.noIndent=!0)}function X(k){k.context&&(k.context=k.context.prev)}function ne(k,J){for(var G;;){if(!k.context||(G=k.context.tagName,!m.contextGrabbers.hasOwnProperty(O(G))||!m.contextGrabbers[O(G)].hasOwnProperty(O(J))))return;X(k)}}function ue(k,J,G){return k=="openTag"?(G.tagStart=J.column(),se):k=="closeTag"?he:ue}function se(k,J,G){return k=="word"?(G.tagName=J.current(),E="tag",ie):m.allowMissingTagName&&k=="endTag"?(E="tag bracket",ie(k,J,G)):(E="error",se)}function he(k,J,G){if(k=="word"){var D=J.current();return G.context&&G.context.tagName!=D&&m.implicitlyClosed.hasOwnProperty(O(G.context.tagName))&&X(G),G.context&&G.context.tagName==D||m.matchClosing===!1?(E="tag",Oe):(E="tag error",Re)}else return m.allowMissingTagName&&k=="endTag"?(E="tag bracket",Oe(k,J,G)):(E="error",Re)}function Oe(k,J,G){return k!="endTag"?(E="error",Oe):(X(G),ue)}function Re(k,J,G){return E="error",Oe(k,J,G)}function ie(k,J,G){if(k=="word")return E="attribute",ze;if(k=="endTag"||k=="selfcloseTag"){var D=G.tagName,R=G.tagStart;return G.tagName=G.tagStart=null,k=="selfcloseTag"||m.autoSelfClosers.hasOwnProperty(O(D))?ne(G,D):(ne(G,D),G.context=new $(G,D,R==G.indented)),ue}return E="error",ie}function ze(k,J,G){return k=="equals"?H:(m.allowMissing||(E="error"),ie(k,J,G))}function H(k,J,G){return k=="string"?Q:k=="word"&&m.allowUnquoted?(E="string",ie):(E="error",ie(k,J,G))}function Q(k,J,G){return k=="string"?Q:ie(k,J,G)}return{startState:function(k){var J={tokenize:W,state:ue,indented:k||0,tagName:null,tagStart:null,context:null};return k!=null&&(J.baseIndent=k),J},token:function(k,J){if(!J.tagName&&k.sol()&&(J.indented=k.indentation()),k.eatSpace())return null;A=null;var G=J.tokenize(k,J);return(G||A)&&G!="comment"&&(E=null,J.state=J.state(A||G,k,J),E&&(G=E=="error"?G+" error":E)),G},indent:function(k,J,G){var D=k.context;if(k.tokenize.isInAttribute)return k.tagStart==k.indented?k.stringStartCol+1:k.indented+y;if(D&&D.noIndent)return a.Pass;if(k.tokenize!=B&&k.tokenize!=W)return G?G.match(/^(\s*)/)[0].length:0;if(k.tagName)return m.multilineTagIndentPastTag!==!1?k.tagStart+k.tagName.length+2:k.tagStart+y*(m.multilineTagIndentFactor||1);if(m.alignCDATA&&/<!\[CDATA\[/.test(J))return 0;var R=J&&/^<(\/)?([\w_:\.-]*)/.exec(J);if(R&&R[1])for(;D;)if(D.tagName==R[2]){D=D.prev;break}else if(m.implicitlyClosed.hasOwnProperty(O(D.tagName)))D=D.prev;else break;else if(R)for(;D;){var K=m.contextGrabbers[O(D.tagName)];if(K&&K.hasOwnProperty(O(R[2])))D=D.prev;else break}for(;D&&D.prev&&!D.startOfLine;)D=D.prev;return D?D.indent+y:k.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:m.htmlMode?"html":"xml",helperType:m.htmlMode?"html":"xml",skipAttribute:function(k){k.state==H&&(k.state=ie)},xmlCurrentTag:function(k){return k.tagName?{name:k.tagName,close:k.type=="closeTag"}:null},xmlCurrentContext:function(k){for(var J=[],G=k.context;G;G=G.prev)J.push(G.tagName);return J.reverse()}}}),a.defineMIME("text/xml","xml"),a.defineMIME("application/xml","xml"),a.mimeModes.hasOwnProperty("text/html")||a.defineMIME("text/html",{name:"xml",htmlMode:!0})})}()),Fl.exports}var zl={exports:{}},$l;function Mp(){return $l||($l=1,function(u,n){(function(a){a(Wt())})(function(a){a.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy","cbl"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded JavaScript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"],alias:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var o=0;o<a.modeInfo.length;o++){var f=a.modeInfo[o];f.mimes&&(f.mime=f.mimes[0])}a.findModeByMIME=function(d){d=d.toLowerCase();for(var p=0;p<a.modeInfo.length;p++){var y=a.modeInfo[p];if(y.mime==d)return y;if(y.mimes){for(var m=0;m<y.mimes.length;m++)if(y.mimes[m]==d)return y}}if(/\+xml$/.test(d))return a.findModeByMIME("application/xml");if(/\+json$/.test(d))return a.findModeByMIME("application/json")},a.findModeByExtension=function(d){d=d.toLowerCase();for(var p=0;p<a.modeInfo.length;p++){var y=a.modeInfo[p];if(y.ext){for(var m=0;m<y.ext.length;m++)if(y.ext[m]==d)return y}}},a.findModeByFileName=function(d){for(var p=0;p<a.modeInfo.length;p++){var y=a.modeInfo[p];if(y.file&&y.file.test(d))return y}var m=d.lastIndexOf("."),x=m>-1&&d.substring(m+1,d.length);if(x)return a.findModeByExtension(x)},a.findModeByName=function(d){d=d.toLowerCase();for(var p=0;p<a.modeInfo.length;p++){var y=a.modeInfo[p];if(y.name.toLowerCase()==d)return y;if(y.alias){for(var m=0;m<y.alias.length;m++)if(y.alias[m].toLowerCase()==d)return y}}}})}()),zl.exports}(function(u,n){(function(a){a(Wt(),Np(),Mp())})(function(a){a.defineMode("markdown",function(o,f){var d=a.getMode(o,"text/html"),p=d.name=="null";function y(L){if(a.findModeByName){var w=a.findModeByName(L);w&&(L=w.mime||w.mimes[0])}var oe=a.getMode(o,L);return oe.name=="null"?null:oe}f.highlightFormatting===void 0&&(f.highlightFormatting=!1),f.maxBlockquoteDepth===void 0&&(f.maxBlockquoteDepth=0),f.taskLists===void 0&&(f.taskLists=!1),f.strikethrough===void 0&&(f.strikethrough=!1),f.emoji===void 0&&(f.emoji=!1),f.fencedCodeBlockHighlighting===void 0&&(f.fencedCodeBlockHighlighting=!0),f.fencedCodeBlockDefaultMode===void 0&&(f.fencedCodeBlockDefaultMode="text/plain"),f.xml===void 0&&(f.xml=!0),f.tokenTypeOverrides===void 0&&(f.tokenTypeOverrides={});var m={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var x in m)m.hasOwnProperty(x)&&f.tokenTypeOverrides[x]&&(m[x]=f.tokenTypeOverrides[x]);var S=/^([*\-_])(?:\s*\1){2,}\s*$/,A=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,E=/^\[(x| )\](?=\s)/i,W=f.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,B=/^ {0,3}(?:\={1,}|-{2,})\s*$/,q=/^[^#!\[\]*_\\<>` "'(~:]+/,F=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,N=/^\s*\[[^\]]+?\]:.*$/,O=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,$=" ";function X(L,w,oe){return w.f=w.inline=oe,oe(L,w)}function ne(L,w,oe){return w.f=w.block=oe,oe(L,w)}function ue(L){return!L||!/\S/.test(L.string)}function se(L){if(L.linkTitle=!1,L.linkHref=!1,L.linkText=!1,L.em=!1,L.strong=!1,L.strikethrough=!1,L.quote=0,L.indentedCode=!1,L.f==Oe){var w=p;if(!w){var oe=a.innerMode(d,L.htmlState);w=oe.mode.name=="xml"&&oe.state.tagStart===null&&!oe.state.context&&oe.state.tokenize.isInText}w&&(L.f=H,L.block=he,L.htmlState=null)}return L.trailingSpace=0,L.trailingSpaceNewLine=!1,L.prevLine=L.thisLine,L.thisLine={stream:null},null}function he(L,w){var oe=L.column()===w.indentation,Te=ue(w.prevLine.stream),Z=w.indentedCode,ce=w.prevLine.hr,ke=w.list!==!1,_e=(w.listStack[w.listStack.length-1]||0)+3;w.indentedCode=!1;var ft=w.indentation;if(w.indentationDiff===null&&(w.indentationDiff=w.indentation,ke)){for(w.list=null;ft<w.listStack[w.listStack.length-1];)w.listStack.pop(),w.listStack.length?w.indentation=w.listStack[w.listStack.length-1]:w.list=!1;w.list!==!1&&(w.indentationDiff=ft-w.listStack[w.listStack.length-1])}var we=!Te&&!ce&&!w.prevLine.header&&(!ke||!Z)&&!w.prevLine.fencedCodeEnd,Me=(w.list===!1||ce||Te)&&w.indentation<=_e&&L.match(S),Ke=null;if(w.indentationDiff>=4&&(Z||w.prevLine.fencedCodeEnd||w.prevLine.header||Te))return L.skipToEnd(),w.indentedCode=!0,m.code;if(L.eatSpace())return null;if(oe&&w.indentation<=_e&&(Ke=L.match(W))&&Ke[1].length<=6)return w.quote=0,w.header=Ke[1].length,w.thisLine.header=!0,f.highlightFormatting&&(w.formatting="header"),w.f=w.inline,ie(w);if(w.indentation<=_e&&L.eat(">"))return w.quote=oe?1:w.quote+1,f.highlightFormatting&&(w.formatting="quote"),L.eatSpace(),ie(w);if(!Me&&!w.setext&&oe&&w.indentation<=_e&&(Ke=L.match(A))){var ct=Ke[1]?"ol":"ul";return w.indentation=ft+L.current().length,w.list=!0,w.quote=0,w.listStack.push(w.indentation),w.em=!1,w.strong=!1,w.code=!1,w.strikethrough=!1,f.taskLists&&L.match(E,!1)&&(w.taskList=!0),w.f=w.inline,f.highlightFormatting&&(w.formatting=["list","list-"+ct]),ie(w)}else{if(oe&&w.indentation<=_e&&(Ke=L.match(F,!0)))return w.quote=0,w.fencedEndRE=new RegExp(Ke[1]+"+ *$"),w.localMode=f.fencedCodeBlockHighlighting&&y(Ke[2]||f.fencedCodeBlockDefaultMode),w.localMode&&(w.localState=a.startState(w.localMode)),w.f=w.block=Re,f.highlightFormatting&&(w.formatting="code-block"),w.code=-1,ie(w);if(w.setext||(!we||!ke)&&!w.quote&&w.list===!1&&!w.code&&!Me&&!N.test(L.string)&&(Ke=L.lookAhead(1))&&(Ke=Ke.match(B)))return w.setext?(w.header=w.setext,w.setext=0,L.skipToEnd(),f.highlightFormatting&&(w.formatting="header")):(w.header=Ke[0].charAt(0)=="="?1:2,w.setext=w.header),w.thisLine.header=!0,w.f=w.inline,ie(w);if(Me)return L.skipToEnd(),w.hr=!0,w.thisLine.hr=!0,m.hr;if(L.peek()==="[")return X(L,w,D)}return X(L,w,w.inline)}function Oe(L,w){var oe=d.token(L,w.htmlState);if(!p){var Te=a.innerMode(d,w.htmlState);(Te.mode.name=="xml"&&Te.state.tagStart===null&&!Te.state.context&&Te.state.tokenize.isInText||w.md_inside&&L.current().indexOf(">")>-1)&&(w.f=H,w.block=he,w.htmlState=null)}return oe}function Re(L,w){var oe=w.listStack[w.listStack.length-1]||0,Te=w.indentation<oe,Z=oe+3;if(w.fencedEndRE&&w.indentation<=Z&&(Te||L.match(w.fencedEndRE))){f.highlightFormatting&&(w.formatting="code-block");var ce;return Te||(ce=ie(w)),w.localMode=w.localState=null,w.block=he,w.f=H,w.fencedEndRE=null,w.code=0,w.thisLine.fencedCodeEnd=!0,Te?ne(L,w,w.block):ce}else return w.localMode?w.localMode.token(L,w.localState):(L.skipToEnd(),m.code)}function ie(L){var w=[];if(L.formatting){w.push(m.formatting),typeof L.formatting=="string"&&(L.formatting=[L.formatting]);for(var oe=0;oe<L.formatting.length;oe++)w.push(m.formatting+"-"+L.formatting[oe]),L.formatting[oe]==="header"&&w.push(m.formatting+"-"+L.formatting[oe]+"-"+L.header),L.formatting[oe]==="quote"&&(!f.maxBlockquoteDepth||f.maxBlockquoteDepth>=L.quote?w.push(m.formatting+"-"+L.formatting[oe]+"-"+L.quote):w.push("error"))}if(L.taskOpen)return w.push("meta"),w.length?w.join(" "):null;if(L.taskClosed)return w.push("property"),w.length?w.join(" "):null;if(L.linkHref?w.push(m.linkHref,"url"):(L.strong&&w.push(m.strong),L.em&&w.push(m.em),L.strikethrough&&w.push(m.strikethrough),L.emoji&&w.push(m.emoji),L.linkText&&w.push(m.linkText),L.code&&w.push(m.code),L.image&&w.push(m.image),L.imageAltText&&w.push(m.imageAltText,"link"),L.imageMarker&&w.push(m.imageMarker)),L.header&&w.push(m.header,m.header+"-"+L.header),L.quote&&(w.push(m.quote),!f.maxBlockquoteDepth||f.maxBlockquoteDepth>=L.quote?w.push(m.quote+"-"+L.quote):w.push(m.quote+"-"+f.maxBlockquoteDepth)),L.list!==!1){var Te=(L.listStack.length-1)%3;Te?Te===1?w.push(m.list2):w.push(m.list3):w.push(m.list1)}return L.trailingSpaceNewLine?w.push("trailing-space-new-line"):L.trailingSpace&&w.push("trailing-space-"+(L.trailingSpace%2?"a":"b")),w.length?w.join(" "):null}function ze(L,w){if(L.match(q,!0))return ie(w)}function H(L,w){var oe=w.text(L,w);if(typeof oe<"u")return oe;if(w.list)return w.list=null,ie(w);if(w.taskList){var Te=L.match(E,!0)[1]===" ";return Te?w.taskOpen=!0:w.taskClosed=!0,f.highlightFormatting&&(w.formatting="task"),w.taskList=!1,ie(w)}if(w.taskOpen=!1,w.taskClosed=!1,w.header&&L.match(/^#+$/,!0))return f.highlightFormatting&&(w.formatting="header"),ie(w);var Z=L.next();if(w.linkTitle){w.linkTitle=!1;var ce=Z;Z==="("&&(ce=")"),ce=(ce+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var ke="^\\s*(?:[^"+ce+"\\\\]+|\\\\\\\\|\\\\.)"+ce;if(L.match(new RegExp(ke),!0))return m.linkHref}if(Z==="`"){var _e=w.formatting;f.highlightFormatting&&(w.formatting="code"),L.eatWhile("`");var ft=L.current().length;if(w.code==0&&(!w.quote||ft==1))return w.code=ft,ie(w);if(ft==w.code){var we=ie(w);return w.code=0,we}else return w.formatting=_e,ie(w)}else if(w.code)return ie(w);if(Z==="\\"&&(L.next(),f.highlightFormatting)){var Me=ie(w),Ke=m.formatting+"-escape";return Me?Me+" "+Ke:Ke}if(Z==="!"&&L.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return w.imageMarker=!0,w.image=!0,f.highlightFormatting&&(w.formatting="image"),ie(w);if(Z==="["&&w.imageMarker&&L.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return w.imageMarker=!1,w.imageAltText=!0,f.highlightFormatting&&(w.formatting="image"),ie(w);if(Z==="]"&&w.imageAltText){f.highlightFormatting&&(w.formatting="image");var Me=ie(w);return w.imageAltText=!1,w.image=!1,w.inline=w.f=k,Me}if(Z==="["&&!w.image)return w.linkText&&L.match(/^.*?\]/)||(w.linkText=!0,f.highlightFormatting&&(w.formatting="link")),ie(w);if(Z==="]"&&w.linkText){f.highlightFormatting&&(w.formatting="link");var Me=ie(w);return w.linkText=!1,w.inline=w.f=L.match(/\(.*?\)| ?\[.*?\]/,!1)?k:H,Me}if(Z==="<"&&L.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){w.f=w.inline=Q,f.highlightFormatting&&(w.formatting="link");var Me=ie(w);return Me?Me+=" ":Me="",Me+m.linkInline}if(Z==="<"&&L.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){w.f=w.inline=Q,f.highlightFormatting&&(w.formatting="link");var Me=ie(w);return Me?Me+=" ":Me="",Me+m.linkEmail}if(f.xml&&Z==="<"&&L.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var ct=L.string.indexOf(">",L.pos);if(ct!=-1){var Pt=L.string.substring(L.start,ct);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Pt)&&(w.md_inside=!0)}return L.backUp(1),w.htmlState=a.startState(d),ne(L,w,Oe)}if(f.xml&&Z==="<"&&L.match(/^\/\w*?>/))return w.md_inside=!1,"tag";if(Z==="*"||Z==="_"){for(var ht=1,dt=L.pos==1?" ":L.string.charAt(L.pos-2);ht<3&&L.eat(Z);)ht++;var gt=L.peek()||" ",qt=!/\s/.test(gt)&&(!O.test(gt)||/\s/.test(dt)||O.test(dt)),be=!/\s/.test(dt)&&(!O.test(dt)||/\s/.test(gt)||O.test(gt)),kt=null,Gt=null;if(ht%2&&(!w.em&&qt&&(Z==="*"||!be||O.test(dt))?kt=!0:w.em==Z&&be&&(Z==="*"||!qt||O.test(gt))&&(kt=!1)),ht>1&&(!w.strong&&qt&&(Z==="*"||!be||O.test(dt))?Gt=!0:w.strong==Z&&be&&(Z==="*"||!qt||O.test(gt))&&(Gt=!1)),Gt!=null||kt!=null){f.highlightFormatting&&(w.formatting=kt==null?"strong":Gt==null?"em":"strong em"),kt===!0&&(w.em=Z),Gt===!0&&(w.strong=Z);var we=ie(w);return kt===!1&&(w.em=!1),Gt===!1&&(w.strong=!1),we}}else if(Z===" "&&(L.eat("*")||L.eat("_"))){if(L.peek()===" ")return ie(w);L.backUp(1)}if(f.strikethrough){if(Z==="~"&&L.eatWhile(Z)){if(w.strikethrough){f.highlightFormatting&&(w.formatting="strikethrough");var we=ie(w);return w.strikethrough=!1,we}else if(L.match(/^[^\s]/,!1))return w.strikethrough=!0,f.highlightFormatting&&(w.formatting="strikethrough"),ie(w)}else if(Z===" "&&L.match("~~",!0)){if(L.peek()===" ")return ie(w);L.backUp(2)}}if(f.emoji&&Z===":"&&L.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){w.emoji=!0,f.highlightFormatting&&(w.formatting="emoji");var In=ie(w);return w.emoji=!1,In}return Z===" "&&(L.match(/^ +$/,!1)?w.trailingSpace++:w.trailingSpace&&(w.trailingSpaceNewLine=!0)),ie(w)}function Q(L,w){var oe=L.next();if(oe===">"){w.f=w.inline=H,f.highlightFormatting&&(w.formatting="link");var Te=ie(w);return Te?Te+=" ":Te="",Te+m.linkInline}return L.match(/^[^>]+/,!0),m.linkInline}function k(L,w){if(L.eatSpace())return null;var oe=L.next();return oe==="("||oe==="["?(w.f=w.inline=G(oe==="("?")":"]"),f.highlightFormatting&&(w.formatting="link-string"),w.linkHref=!0,ie(w)):"error"}var J={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function G(L){return function(w,oe){var Te=w.next();if(Te===L){oe.f=oe.inline=H,f.highlightFormatting&&(oe.formatting="link-string");var Z=ie(oe);return oe.linkHref=!1,Z}return w.match(J[L]),oe.linkHref=!0,ie(oe)}}function D(L,w){return L.match(/^([^\]\\]|\\.)*\]:/,!1)?(w.f=R,L.next(),f.highlightFormatting&&(w.formatting="link"),w.linkText=!0,ie(w)):X(L,w,H)}function R(L,w){if(L.match("]:",!0)){w.f=w.inline=K,f.highlightFormatting&&(w.formatting="link");var oe=ie(w);return w.linkText=!1,oe}return L.match(/^([^\]\\]|\\.)+/,!0),m.linkText}function K(L,w){return L.eatSpace()?null:(L.match(/^[^\s]+/,!0),L.peek()===void 0?w.linkTitle=!0:L.match(/^(?:\s+(?:"(?:[^"\\]|\\.)+"|'(?:[^'\\]|\\.)+'|\((?:[^)\\]|\\.)+\)))?/,!0),w.f=w.inline=H,m.linkHref+" url")}var de={startState:function(){return{f:he,prevLine:{stream:null},thisLine:{stream:null},block:he,htmlState:null,indentation:0,inline:H,text:ze,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(L){return{f:L.f,prevLine:L.prevLine,thisLine:L.thisLine,block:L.block,htmlState:L.htmlState&&a.copyState(d,L.htmlState),indentation:L.indentation,localMode:L.localMode,localState:L.localMode?a.copyState(L.localMode,L.localState):null,inline:L.inline,text:L.text,formatting:!1,linkText:L.linkText,linkTitle:L.linkTitle,linkHref:L.linkHref,code:L.code,em:L.em,strong:L.strong,strikethrough:L.strikethrough,emoji:L.emoji,header:L.header,setext:L.setext,hr:L.hr,taskList:L.taskList,list:L.list,listStack:L.listStack.slice(0),quote:L.quote,indentedCode:L.indentedCode,trailingSpace:L.trailingSpace,trailingSpaceNewLine:L.trailingSpaceNewLine,md_inside:L.md_inside,fencedEndRE:L.fencedEndRE}},token:function(L,w){if(w.formatting=!1,L!=w.thisLine.stream){if(w.header=0,w.hr=!1,L.match(/^\s*$/,!0))return se(w),null;if(w.prevLine=w.thisLine,w.thisLine={stream:L},w.taskList=!1,w.trailingSpace=0,w.trailingSpaceNewLine=!1,!w.localState&&(w.f=w.block,w.f!=Oe)){var oe=L.match(/^\s*/,!0)[0].replace(/\t/g,$).length;if(w.indentation=oe,w.indentationDiff=null,oe>0)return null}}return w.f(L,w)},innerMode:function(L){return L.block==Oe?{state:L.htmlState,mode:d}:L.localState?{state:L.localState,mode:L.localMode}:{state:L,mode:de}},indent:function(L,w,oe){return L.block==Oe&&d.indent?d.indent(L.htmlState,w,oe):L.localState&&L.localMode.indent?L.localMode.indent(L.localState,w,oe):a.Pass},blankLine:se,getType:ie,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return de},"xml"),a.defineMIME("text/markdown","markdown"),a.defineMIME("text/x-markdown","markdown")})})();const Rp={name:"DebugTab",components:{codemirror:co.codemirror},props:{selectedSpan:{type:Object,required:!0},selectedSpanId:{type:String,required:!0}},data(){return{debugForm:{params:[],systemContent:"",userContent:""},debugSubmitting:!1,debugResponse:null,showDebugRawResponse:!1,debugResponseKey:0,debugMarkdownKey:0,originalInputs:null,hasImageUrl:!1,submitImage:!0,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,autoRefresh:!0},cmOptionsMarkdown:{tabSize:2,mode:"markdown",theme:"monokai",lineNumbers:!0,lineWrapping:!0,readOnly:!1,foldGutter:!0,gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],matchBrackets:!0,autoCloseBrackets:!0,indentUnit:2,styleActiveLine:!0,autoRefresh:!0},viewerOptions:{inline:!1,button:!0,navbar:!0,title:!0,toolbar:!0,tooltip:!0,movable:!0,zoomable:!0,rotatable:!0,scalable:!0,transition:!0,fullscreen:!0,keyboard:!0,zIndex:9999}}},computed:{rawInputs(){var u,n,a;return(a=(n=(u=this.selectedSpan)==null?void 0:u.parsedContent)==null?void 0:n.attributes)==null?void 0:a["langsword.spanInputs"]},targetUrl(){var n,a;const u=(a=(n=this.selectedSpan)==null?void 0:n.parsedContent)==null?void 0:a.attributes;return u&&u["url.full"]?u["url.full"]:null}},watch:{selectedSpanId:{immediate:!0,handler(u,n){u&&u!==n&&this.$nextTick(()=>{this.initDebugForm()})}},"selectedSpan.parsedContent":{deep:!0,handler(){this.selectedSpan&&this.selectedSpanId&&this.$nextTick(()=>{this.initDebugForm()})}}},mounted(){this.selectedSpan&&this.selectedSpanId&&this.$nextTick(()=>{this.initDebugForm()})},methods:{initDebugForm(){var n,a;if(!this.selectedSpan)return;let u=(a=(n=this.selectedSpan)==null?void 0:n.parsedContent)==null?void 0:a.inputs;if(!u&&this.rawInputs)try{u=typeof this.rawInputs=="string"?JSON.parse(this.rawInputs):this.rawInputs}catch(o){console.error("Failed to parse rawInputs:",o);return}if(!u){console.warn("No inputs found for span:",this.selectedSpanId);return}if(this.originalInputs=JSON.parse(JSON.stringify(u)),this.selectedSpan.type==="CLIENT")this.debugForm.params=[],this.debugForm.systemContent="",this.debugForm.userContent="",Object.keys(u).forEach(o=>{if(o!=="file"){const f=u[o];let d="";typeof f=="string"?d=f:typeof f=="boolean"||typeof f=="number"?d=String(f):d=JSON.stringify(f),this.debugForm.params.push({key:o,value:d})}});else if(this.selectedSpan.type==="CHAT_MODEL")if(this.debugForm.params=[],this.hasImageUrl=!1,this.submitImage=!0,Object.keys(u).forEach(o=>{if(o!=="messages"){const f=u[o];let d="";typeof f=="string"?d=f:typeof f=="boolean"||typeof f=="number"?d=String(f):d=JSON.stringify(f),this.debugForm.params.push({key:o,value:d})}}),u.messages&&Array.isArray(u.messages)){const o=u.messages.find(d=>d.role==="system"),f=u.messages.find(d=>d.role==="user");if(o&&o.content?this.debugForm.systemContent=typeof o.content=="string"?o.content:"":this.debugForm.systemContent="",f&&f.content)if(Array.isArray(f.content)){const d=f.content.filter(y=>y.type==="text"&&y.text).map(y=>y.text);this.debugForm.userContent=d.join(`
78
- `);const p=f.content.some(y=>y.type==="image_url");this.hasImageUrl=p}else typeof f.content=="string"?this.debugForm.userContent=f.content:this.debugForm.userContent="";else this.debugForm.userContent=""}else this.debugForm.systemContent="",this.debugForm.userContent="";this.debugResponse=null,this.showDebugRawResponse=!1,this.$nextTick(()=>{this.$refs.systemContentEditor&&this.$refs.systemContentEditor.codemirror&&this.$refs.systemContentEditor.codemirror.setValue(this.debugForm.systemContent||""),this.$refs.userContentEditor&&this.$refs.userContentEditor.codemirror&&this.$refs.userContentEditor.codemirror.setValue(this.debugForm.userContent||"")})},addDebugParam(){this.debugForm.params.push({key:"",value:""})},removeDebugParam(u){this.debugForm.params.splice(u,1)},handleDebugParamChange(){},resetDebugForm(){this.initDebugForm()},parseParamValue(u){if(u==="true"||u==="false")return u==="true";if(u==="")return"";{const n=Number(u);if(!isNaN(n)&&isFinite(n)&&u!=="")return n;try{return JSON.parse(u)}catch{return u}}},buildRequestHeaders(u){const n={};let a=null;const o=Object.keys(u).find(f=>f.toLowerCase()==="x-target-url");return o?(a=u[o],delete u[o]):this.targetUrl&&(a=this.targetUrl),a&&(n["X-Target-Url"]=a),n},handleDebugResponse(u){this.debugResponse=u,this.showDebugRawResponse=!1,this.$nextTick(()=>{this.debugResponseKey++})},handleDebugError(u){console.error("Debug request failed:",u);let n="未知错误";if(u.response&&u.response.data){const a=u.response.data;typeof a=="object"&&a!==null&&a.message?n=a.message:u.message&&(n=u.message)}else u.message&&(n=u.message);this.$message.error("调试请求失败: "+n)},async submitDebugRequest(u){const n=this.buildRequestHeaders(u),a=await xn.debugTrace(u,n);this.handleDebugResponse(a)},async submitDebugClient(){if(!(!this.selectedSpan||!this.originalInputs)){this.debugSubmitting=!0;try{const u={};this.originalInputs.file&&(u.file=this.originalInputs.file),this.debugForm.params.forEach(n=>{if(n.key&&n.key.trim()){const a=n.value?n.value.trim():"";u[n.key]=this.parseParamValue(a)}}),await this.submitDebugRequest(u)}catch(u){this.handleDebugError(u)}finally{this.debugSubmitting=!1}}},async submitDebugChatModel(){if(!(!this.selectedSpan||!this.originalInputs)){this.debugSubmitting=!0;try{const u=JSON.parse(JSON.stringify(this.originalInputs));if(this.debugForm.params.forEach(n=>{if(n.key&&n.key.trim()){const a=n.value?n.value.trim():"";u[n.key]=this.parseParamValue(a)}}),u.messages&&Array.isArray(u.messages)){const n=u.messages.find(o=>o.role==="system");n&&(n.content=this.debugForm.systemContent||"");const a=u.messages.find(o=>o.role==="user");if(a){const o=this.originalInputs.messages.find(d=>d.role==="user");if(o&&Array.isArray(o.content)){const d=[];this.submitImage&&Array.isArray(a.content)&&a.content.forEach(p=>{p.type==="image_url"&&d.push(p)}),this.debugForm.userContent&&this.debugForm.userContent.trim()&&d.push({type:"text",text:this.debugForm.userContent}),a.content=d.length>0?d:this.debugForm.userContent||""}else a.content=this.debugForm.userContent||""}}await this.submitDebugRequest(u)}catch(u){this.handleDebugError(u)}finally{this.debugSubmitting=!1}}},toggleDebugResponseView(){this.showDebugRawResponse=!this.showDebugRawResponse,this.$nextTick(()=>{this.debugResponseKey++})},formatRawJson(u){if(!u)return"";if(typeof u=="string")try{const n=JSON.parse(u);return JSON.stringify(n,null,2)}catch{return u}return JSON.stringify(u,null,2)},extractImagesFromObject(u,n=[],a=""){if(!(!u||typeof u!="object")){for(const[o,f]of Object.entries(u)){const d=a?`${a}.${o}`:o;typeof f=="string"&&f.trim()!==""?(f.startsWith("data:image/")||f.startsWith("/9j/")||f.startsWith("iVBOR")||f.startsWith("R0lGOD"))&&(n.push({path:d,value:f,label:o==="content"&&a?`${a.split(".").pop()}: ${o}`:o}),u[o]="[IMAGE_DATA]"):f&&typeof f=="object"&&!Array.isArray(f)?this.extractImagesFromObject(f,n,d):Array.isArray(f)&&f.forEach((p,y)=>{p&&typeof p=="object"&&this.extractImagesFromObject(p,n,`${d}[${y}]`)})}return n}},renderStructuredContent(u){const n=[];if(!u)return n;try{if(Array.isArray(u))u.forEach((a,o)=>{var f;a&&typeof a=="object"?a.type==="text"&&a.text?n.push({type:"markdown",content:Le(a.text),key:`text-${o}`}):a.type==="image_url"&&((f=a.image_url)!=null&&f.url)?n.push({type:"image",url:a.image_url.url,key:`image-${o}`}):a.image_base64&&a.image_base64.trim()!==""?n.push({type:"image",url:this.formatBase64Image(a.image_base64),key:`base64-image-${o}`}):n.push({type:"markdown",content:Le("```json\n"+JSON.stringify(a,null,2)+"\n```"),key:`json-${o}`}):n.push({type:"markdown",content:Le(String(a)),key:`text-${o}`})});else if(typeof u=="string")n.push({type:"markdown",content:Le(u),key:"text-0"});else if(typeof u=="object")if(u.data&&Array.isArray(u.data.result)){const a=JSON.parse(JSON.stringify(u)),o=[];a.data&&a.data.result&&a.data.result.forEach((f,d)=>{f.image_base64&&f.image_base64.trim()!==""&&(o.push({type:"page",image_base64:f.image_base64,page_num:f.page_num,label:f.page_num!==void 0?`Page ${f.page_num}`:`Result ${d}`}),f.image_base64="[BASE64_IMAGE_DATA]"),f.seals&&Array.isArray(f.seals)&&f.seals.forEach((p,y)=>{p.image_base64&&p.image_base64.trim()!==""&&(o.push({type:"seal",image_base64:p.image_base64,page_num:f.page_num,seal_index:y,seal_value:p.value,label:`Seal: ${p.value||y}`}),p.image_base64="[BASE64_IMAGE_DATA]")})}),n.push({type:"markdown",content:Le("```json\n"+JSON.stringify(a,null,2)+"\n```"),key:"json-0"}),o.forEach((f,d)=>{n.push({type:"image",url:this.formatBase64Image(f.image_base64),key:`result-image-${d}`,label:f.label})})}else{const a=JSON.parse(JSON.stringify(u)),o=[];this.extractImagesFromObject(a,o),n.push({type:"markdown",content:Le("```json\n"+JSON.stringify(a,null,2)+"\n```"),key:"json-0"}),o.forEach((f,d)=>{n.push({type:"image",url:this.formatBase64Image(f.value),key:`extracted-image-${d}`,label:f.label})})}else n.push({type:"markdown",content:Le(String(u)),key:"text-0"})}catch(a){console.error("Error rendering content:",a),n.push({type:"markdown",content:Le("Error rendering content"),key:"error-0"})}return n},formatBase64Image(u){return u?u.startsWith("data:image")?u:u.startsWith("/9j/")?`data:image/jpeg;base64,${u}`:u.startsWith("iVBOR")?`data:image/png;base64,${u}`:u.startsWith("R0lGOD")?`data:image/gif;base64,${u}`:`data:image/jpeg;base64,${u}`:""},handleImageClick(u){Rl({options:this.viewerOptions,images:[u]})}}};var Fp=function(){var o;var n=this,a=n._self._c;return a("div",{staticClass:"debug-content"},[n.selectedSpan.type==="CLIENT"?a("div",{staticClass:"debug-client-form"},[a("el-form",{attrs:{model:n.debugForm,"label-width":"60px",size:"small"}},[n._l(n.debugForm.params,function(f,d){return a("div",{key:d,staticClass:"debug-form-row"},[a("el-form-item",{attrs:{label:`${n.$t("debug.paramLabel")} ${d+1}`}},[a("el-row",{attrs:{gutter:10,type:"flex",align:"middle"}},[a("el-col",{attrs:{span:8}},[a("el-input",{attrs:{placeholder:n.$t("debug.paramName")},on:{input:n.handleDebugParamChange},model:{value:f.key,callback:function(p){n.$set(f,"key",p)},expression:"item.key"}})],1),a("el-col",{attrs:{span:14}},[a("el-input",{attrs:{placeholder:n.$t("debug.paramValue")},on:{input:n.handleDebugParamChange},model:{value:f.value,callback:function(p){n.$set(f,"value",p)},expression:"item.value"}})],1),a("el-col",{attrs:{span:2}},[a("el-button",{staticClass:"delete-param-btn",attrs:{type:"danger",icon:"el-icon-delete",size:"small"},on:{click:function(p){return n.removeDebugParam(d)}}})],1)],1)],1)],1)}),a("el-form-item",[a("el-button",{attrs:{type:"primary",icon:"el-icon-plus",size:"small"},on:{click:n.addDebugParam}},[n._v(n._s(n.$t("debug.addParam")))]),a("el-button",{attrs:{type:"warning",icon:"el-icon-refresh",size:"small"},on:{click:n.resetDebugForm}},[n._v(n._s(n.$t("debug.reset")))]),a("el-button",{attrs:{type:"success",icon:"el-icon-check",size:"small",loading:n.debugSubmitting},on:{click:n.submitDebugClient}},[n._v(n._s(n.$t("debug.submit")))])],1)],2),n.debugResponse!==null?a("div",{staticClass:"debug-response"},[a("div",{staticClass:"debug-response-header"},[a("span",[n._v(n._s(n.$t("debug.responseResult")))]),a("el-button",{attrs:{type:"text",size:"small"},on:{click:n.toggleDebugResponseView}},[n._v(n._s(n.showDebugRawResponse?n.$t("debug.switchToMarkdown"):n.$t("debug.switchToRaw")))])],1),n.showDebugRawResponse?a("div",{staticClass:"debug-response-raw"},[a("codemirror",{key:`debug-response-${n.selectedSpanId}-${n.debugResponseKey}`,staticClass:"code-editor-wrapper",attrs:{value:n.formatRawJson(n.debugResponse),options:n.cmOptions}})],1):a("div",{staticClass:"debug-response-markdown"},n._l(n.renderStructuredContent(n.debugResponse),function(f){return a("div",{key:f.key,staticClass:"content-element"},[f.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(f.content)}}):f.type==="image"?a("div",{staticClass:"image-content"},[f.label?a("div",{staticClass:"image-label"},[n._v(n._s(f.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:f.url,alt:"content image"},on:{click:function(d){return n.handleImageClick(f.url)}}})]):n._e()])}),0)]):n._e()],1):n._e(),n.selectedSpan.type==="CHAT_MODEL"?a("div",{staticClass:"debug-chat-model-form"},[a("el-form",{attrs:{model:n.debugForm,"label-width":"60px",size:"small"}},[a("el-form-item",{attrs:{label:n.$t("debug.systemPrompt")}},[a("codemirror",{key:`debug-system-${n.selectedSpanId}-${n.debugMarkdownKey}`,ref:"systemContentEditor",staticClass:"code-editor-wrapper markdown-editor",attrs:{options:n.cmOptionsMarkdown},model:{value:n.debugForm.systemContent,callback:function(f){n.$set(n.debugForm,"systemContent",f)},expression:"debugForm.systemContent"}})],1),a("el-form-item",{attrs:{label:n.$t("debug.userPrompt")}},[a("codemirror",{key:`debug-user-${n.selectedSpanId}-${n.debugMarkdownKey}`,ref:"userContentEditor",staticClass:"code-editor-wrapper markdown-editor",attrs:{options:n.cmOptionsMarkdown},model:{value:n.debugForm.userContent,callback:function(f){n.$set(n.debugForm,"userContent",f)},expression:"debugForm.userContent"}})],1),n.selectedSpan.type==="CHAT_MODEL"&&n.hasImageUrl?a("el-form-item",{attrs:{label:n.$t("debug.submitImage")}},[a("el-switch",{attrs:{"active-text":n.$t("debug.yes"),"inactive-text":n.$t("debug.no")},model:{value:n.submitImage,callback:function(f){n.submitImage=f},expression:"submitImage"}})],1):n._e(),n._l(n.debugForm.params,function(f,d){return a("div",{key:d,staticClass:"debug-form-row"},[a("el-form-item",{attrs:{label:`${n.$t("debug.paramLabel")} ${d+1}`}},[a("el-row",{attrs:{gutter:10,type:"flex",align:"middle"}},[a("el-col",{attrs:{span:8}},[a("el-input",{attrs:{placeholder:n.$t("debug.paramName")},on:{input:n.handleDebugParamChange},model:{value:f.key,callback:function(p){n.$set(f,"key",p)},expression:"item.key"}})],1),a("el-col",{attrs:{span:14}},[a("el-input",{attrs:{placeholder:n.$t("debug.paramValue")},on:{input:n.handleDebugParamChange},model:{value:f.value,callback:function(p){n.$set(f,"value",p)},expression:"item.value"}})],1),a("el-col",{attrs:{span:2}},[a("el-button",{staticClass:"delete-param-btn",attrs:{type:"danger",icon:"el-icon-delete",size:"small"},on:{click:function(p){return n.removeDebugParam(d)}}})],1)],1)],1)],1)}),a("el-form-item",[a("el-button",{attrs:{type:"primary",icon:"el-icon-plus",size:"small"},on:{click:n.addDebugParam}},[n._v(n._s(n.$t("debug.addParam")))]),a("el-button",{attrs:{type:"warning",icon:"el-icon-refresh",size:"small"},on:{click:n.resetDebugForm}},[n._v(n._s(n.$t("debug.reset")))]),a("el-button",{attrs:{type:"success",icon:"el-icon-check",size:"small",loading:n.debugSubmitting},on:{click:n.submitDebugChatModel}},[n._v(n._s(n.$t("debug.submit")))])],1)],2),n.debugResponse!==null?a("div",{staticClass:"debug-response"},[a("div",{staticClass:"debug-response-header"},[a("span",[n._v(n._s(n.$t("debug.responseResult")))]),a("el-button",{attrs:{type:"text",size:"small"},on:{click:n.toggleDebugResponseView}},[n._v(n._s(n.showDebugRawResponse?n.$t("debug.switchToMarkdown"):n.$t("debug.switchToRaw")))])],1),n.showDebugRawResponse?a("div",{staticClass:"debug-response-raw"},[a("codemirror",{key:`debug-response-${n.selectedSpanId}-${n.debugResponseKey}`,staticClass:"code-editor-wrapper",attrs:{value:n.formatRawJson(n.debugResponse),options:n.cmOptions}})],1):a("div",{staticClass:"debug-response-markdown"},[n.selectedSpan.type==="CHAT_MODEL"&&((o=n.debugResponse)!=null&&o.choices)?a("div",{staticClass:"outputs-section"},n._l(n.debugResponse.choices,function(f,d){return a("div",{key:d,staticClass:"choice-item"},[a("div",{staticClass:"choice-header"},[a("span",[n._v("Choice "+n._s(d))])]),a("div",{staticClass:"choice-content"},[f.message?a("div",[a("div",{staticClass:"message-header"},[a("i",{staticClass:"el-icon-user message-icon"}),a("span",[n._v(n._s(f.message.role))])]),a("div",{staticClass:"structured-content"},n._l(n.renderStructuredContent(f.message.content),function(p){return a("div",{key:p.key,staticClass:"content-element"},[p.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(p.content)}}):p.type==="image"?a("div",{staticClass:"image-content"},[p.label?a("div",{staticClass:"image-label"},[n._v(n._s(p.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:p.url,alt:"content image"},on:{click:function(y){return n.handleImageClick(p.url)}}})]):n._e()])}),0)]):a("div",{staticClass:"structured-content"},n._l(n.renderStructuredContent(f),function(p){return a("div",{key:p.key,staticClass:"content-element"},[p.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(p.content)}}):p.type==="image"?a("div",{staticClass:"image-content"},[p.label?a("div",{staticClass:"image-label"},[n._v(n._s(p.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:p.url,alt:"content image"},on:{click:function(y){return n.handleImageClick(p.url)}}})]):n._e()])}),0)])])}),0):a("div",{staticClass:"structured-content"},n._l(n.renderStructuredContent(n.debugResponse),function(f){return a("div",{key:f.key,staticClass:"content-element"},[f.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(f.content)}}):f.type==="image"?a("div",{staticClass:"image-content"},[f.label?a("div",{staticClass:"image-label"},[n._v(n._s(f.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:f.url,alt:"content image"},on:{click:function(d){return n.handleImageClick(f.url)}}})]):n._e()])}),0)])]):n._e()],1):n._e()])},Pp=[],zp=An(Rp,Fp,Pp,!1,null,"5a07e1ef");const $p=zp.exports;(function(u,n){(function(a){a(Wt())})(function(a){function o(D,R,K,de,L,w){this.indented=D,this.column=R,this.type=K,this.info=de,this.align=L,this.prev=w}function f(D,R,K,de){var L=D.indented;return D.context&&D.context.type=="statement"&&K!="statement"&&(L=D.context.indented),D.context=new o(L,R,K,de,null,D.context)}function d(D){var R=D.context.type;return(R==")"||R=="]"||R=="}")&&(D.indented=D.context.indented),D.context=D.context.prev}function p(D,R,K){if(R.prevToken=="variable"||R.prevToken=="type"||/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(D.string.slice(0,K))||R.typeAtEndOfLine&&D.column()==D.indentation())return!0}function y(D){for(;;){if(!D||D.type=="top")return!0;if(D.type=="}"&&D.prev.info!="namespace")return!1;D=D.prev}}a.defineMode("clike",function(D,R){var K=D.indentUnit,de=R.statementIndentUnit||K,L=R.dontAlignCalls,w=R.keywords||{},oe=R.types||{},Te=R.builtin||{},Z=R.blockKeywords||{},ce=R.defKeywords||{},ke=R.atoms||{},_e=R.hooks||{},ft=R.multiLineStrings,we=R.indentStatements!==!1,Me=R.indentSwitch!==!1,Ke=R.namespaceSeparator,ct=R.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,Pt=R.numberStart||/[\d\.]/,ht=R.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,dt=R.isOperatorChar||/[+\-*&%=<>!?|\/]/,gt=R.isIdentifierChar||/[\w\$_\xa1-\uffff]/,qt=R.isReservedIdentifier||!1,be,kt;function Gt(ye,xe){var pe=ye.next();if(_e[pe]){var Fe=_e[pe](ye,xe);if(Fe!==!1)return Fe}if(pe=='"'||pe=="'")return xe.tokenize=In(pe),xe.tokenize(ye,xe);if(Pt.test(pe)){if(ye.backUp(1),ye.match(ht))return"number";ye.next()}if(ct.test(pe))return be=pe,null;if(pe=="/"){if(ye.eat("*"))return xe.tokenize=Zn,Zn(ye,xe);if(ye.eat("/"))return ye.skipToEnd(),"comment"}if(dt.test(pe)){for(;!ye.match(/^\/[\/*]/,!1)&&ye.eat(dt););return"operator"}if(ye.eatWhile(gt),Ke)for(;ye.match(Ke);)ye.eatWhile(gt);var De=ye.current();return x(w,De)?(x(Z,De)&&(be="newstatement"),x(ce,De)&&(kt=!0),"keyword"):x(oe,De)?"type":x(Te,De)||qt&&qt(De)?(x(Z,De)&&(be="newstatement"),"builtin"):x(ke,De)?"atom":"variable"}function In(ye){return function(xe,pe){for(var Fe=!1,De,zt=!1;(De=xe.next())!=null;){if(De==ye&&!Fe){zt=!0;break}Fe=!Fe&&De=="\\"}return(zt||!(Fe||ft))&&(pe.tokenize=null),"string"}}function Zn(ye,xe){for(var pe=!1,Fe;Fe=ye.next();){if(Fe=="/"&&pe){xe.tokenize=null;break}pe=Fe=="*"}return"comment"}function wr(ye,xe){R.typeFirstDefinitions&&ye.eol()&&y(xe.context)&&(xe.typeAtEndOfLine=p(ye,xe,ye.pos))}return{startState:function(ye){return{tokenize:null,context:new o((ye||0)-K,0,"top",null,!1),indented:0,startOfLine:!0,prevToken:null}},token:function(ye,xe){var pe=xe.context;if(ye.sol()&&(pe.align==null&&(pe.align=!1),xe.indented=ye.indentation(),xe.startOfLine=!0),ye.eatSpace())return wr(ye,xe),null;be=kt=null;var Fe=(xe.tokenize||Gt)(ye,xe);if(Fe=="comment"||Fe=="meta")return Fe;if(pe.align==null&&(pe.align=!0),be==";"||be==":"||be==","&&ye.match(/^\s*(?:\/\/.*)?$/,!1))for(;xe.context.type=="statement";)d(xe);else if(be=="{")f(xe,ye.column(),"}");else if(be=="[")f(xe,ye.column(),"]");else if(be=="(")f(xe,ye.column(),")");else if(be=="}"){for(;pe.type=="statement";)pe=d(xe);for(pe.type=="}"&&(pe=d(xe));pe.type=="statement";)pe=d(xe)}else be==pe.type?d(xe):we&&((pe.type=="}"||pe.type=="top")&&be!=";"||pe.type=="statement"&&be=="newstatement")&&f(xe,ye.column(),"statement",ye.current());if(Fe=="variable"&&(xe.prevToken=="def"||R.typeFirstDefinitions&&p(ye,xe,ye.start)&&y(xe.context)&&ye.match(/^\s*\(/,!1))&&(Fe="def"),_e.token){var De=_e.token(ye,xe,Fe);De!==void 0&&(Fe=De)}return Fe=="def"&&R.styleDefs===!1&&(Fe="variable"),xe.startOfLine=!1,xe.prevToken=kt?"def":Fe||be,wr(ye,xe),Fe},indent:function(ye,xe){if(ye.tokenize!=Gt&&ye.tokenize!=null||ye.typeAtEndOfLine&&y(ye.context))return a.Pass;var pe=ye.context,Fe=xe&&xe.charAt(0),De=Fe==pe.type;if(pe.type=="statement"&&Fe=="}"&&(pe=pe.prev),R.dontIndentStatements)for(;pe.type=="statement"&&R.dontIndentStatements.test(pe.info);)pe=pe.prev;if(_e.indent){var zt=_e.indent(ye,pe,xe,K);if(typeof zt=="number")return zt}var Qt=pe.prev&&pe.prev.info=="switch";if(R.allmanIndentation&&/[{(]/.test(Fe)){for(;pe.type!="top"&&pe.type!="}";)pe=pe.prev;return pe.indented}return pe.type=="statement"?pe.indented+(Fe=="{"?0:de):pe.align&&(!L||pe.type!=")")?pe.column+(De?0:1):pe.type==")"&&!De?pe.indented+de:pe.indented+(De?0:K)+(!De&&Qt&&!/^(?:case|default)\b/.test(xe)?K:0)},electricInput:Me?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:"//",fold:"brace"}});function m(D){for(var R={},K=D.split(" "),de=0;de<K.length;++de)R[K[de]]=!0;return R}function x(D,R){return typeof D=="function"?D(R):D.propertyIsEnumerable(R)}var S="auto if break case register continue return default do sizeof static else struct switch extern typedef union for goto while enum const volatile inline restrict asm fortran",A="alignas alignof and and_eq audit axiom bitand bitor catch class compl concept constexpr const_cast decltype delete dynamic_cast explicit export final friend import module mutable namespace new noexcept not not_eq operator or or_eq override private protected public reinterpret_cast requires static_assert static_cast template this thread_local throw try typeid typename using virtual xor xor_eq",E="bycopy byref in inout oneway out self super atomic nonatomic retain copy readwrite readonly strong weak assign typeof nullable nonnull null_resettable _cmd @interface @implementation @end @protocol @encode @property @synthesize @dynamic @class @public @package @private @protected @required @optional @try @catch @finally @import @selector @encode @defs @synchronized @autoreleasepool @compatibility_alias @available",W="FOUNDATION_EXPORT FOUNDATION_EXTERN NS_INLINE NS_FORMAT_FUNCTION NS_RETURNS_RETAINEDNS_ERROR_ENUM NS_RETURNS_NOT_RETAINED NS_RETURNS_INNER_POINTER NS_DESIGNATED_INITIALIZER NS_ENUM NS_OPTIONS NS_REQUIRES_NIL_TERMINATION NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_END NS_SWIFT_NAME NS_REFINED_FOR_SWIFT",B=m("int long char short double float unsigned signed void bool"),q=m("SEL instancetype id Class Protocol BOOL");function F(D){return x(B,D)||/.+_t$/.test(D)}function N(D){return F(D)||x(q,D)}var O="case do else for if switch while struct enum union",$="struct enum union";function X(D,R){if(!R.startOfLine)return!1;for(var K,de=null;K=D.peek();){if(K=="\\"&&D.match(/^.$/)){de=X;break}else if(K=="/"&&D.match(/^\/[\/\*]/,!1))break;D.next()}return R.tokenize=de,"meta"}function ne(D,R){return R.prevToken=="type"?"type":!1}function ue(D){return!D||D.length<2||D[0]!="_"?!1:D[1]=="_"||D[1]!==D[1].toLowerCase()}function se(D){return D.eatWhile(/[\w\.']/),"number"}function he(D,R){if(D.backUp(1),D.match(/^(?:R|u8R|uR|UR|LR)/)){var K=D.match(/^"([^\s\\()]{0,16})\(/);return K?(R.cpp11RawStringDelim=K[1],R.tokenize=ie,ie(D,R)):!1}return D.match(/^(?:u8|u|U|L)/)?D.match(/^["']/,!1)?"string":!1:(D.next(),!1)}function Oe(D){var R=/(\w+)::~?(\w+)$/.exec(D);return R&&R[1]==R[2]}function Re(D,R){for(var K;(K=D.next())!=null;)if(K=='"'&&!D.eat('"')){R.tokenize=null;break}return"string"}function ie(D,R){var K=R.cpp11RawStringDelim.replace(/[^\w\s]/g,"\\$&"),de=D.match(new RegExp(".*?\\)"+K+'"'));return de?R.tokenize=null:D.skipToEnd(),"string"}function ze(D,R){typeof D=="string"&&(D=[D]);var K=[];function de(w){if(w)for(var oe in w)w.hasOwnProperty(oe)&&K.push(oe)}de(R.keywords),de(R.types),de(R.builtin),de(R.atoms),K.length&&(R.helperType=D[0],a.registerHelper("hintWords",D[0],K));for(var L=0;L<D.length;++L)a.defineMIME(D[L],R)}ze(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:m(S),types:F,blockKeywords:m(O),defKeywords:m($),typeFirstDefinitions:!0,atoms:m("NULL true false"),isReservedIdentifier:ue,hooks:{"#":X,"*":ne},modeProps:{fold:["brace","include"]}}),ze(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:m(S+" "+A),types:F,blockKeywords:m(O+" class try catch"),defKeywords:m($+" class namespace"),typeFirstDefinitions:!0,atoms:m("true false NULL nullptr"),dontIndentStatements:/^template$/,isIdentifierChar:/[\w\$_~\xa1-\uffff]/,isReservedIdentifier:ue,hooks:{"#":X,"*":ne,u:he,U:he,L:he,R:he,0:se,1:se,2:se,3:se,4:se,5:se,6:se,7:se,8:se,9:se,token:function(D,R,K){if(K=="variable"&&D.peek()=="("&&(R.prevToken==";"||R.prevToken==null||R.prevToken=="}")&&Oe(D.current()))return"def"}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),ze("text/x-java",{name:"clike",keywords:m("abstract assert break case catch class const continue default do else enum extends final finally for goto if implements import instanceof interface native new package private protected public return static strictfp super switch synchronized this throw throws transient try volatile while @interface"),types:m("var byte short int long float double boolean char void Boolean Byte Character Double Float Integer Long Number Object Short String StringBuffer StringBuilder Void"),blockKeywords:m("catch class do else finally for if switch try while"),defKeywords:m("class interface enum @interface"),typeFirstDefinitions:!0,atoms:m("true false null"),number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,hooks:{"@":function(D){return D.match("interface",!1)?!1:(D.eatWhile(/[\w\$_]/),"meta")},'"':function(D,R){return D.match(/""$/)?(R.tokenize=H,R.tokenize(D,R)):!1}},modeProps:{fold:["brace","import"]}}),ze("text/x-csharp",{name:"clike",keywords:m("abstract as async await base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in init interface internal is lock namespace new operator out override params private protected public readonly record ref required return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),types:m("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),blockKeywords:m("catch class do else finally for foreach if struct switch try while"),defKeywords:m("class interface namespace record struct var"),typeFirstDefinitions:!0,atoms:m("true false null"),hooks:{"@":function(D,R){return D.eat('"')?(R.tokenize=Re,Re(D,R)):(D.eatWhile(/[\w\$_]/),"meta")}}});function H(D,R){for(var K=!1;!D.eol();){if(!K&&D.match('"""')){R.tokenize=null;break}K=D.next()=="\\"&&!K}return"string"}function Q(D){return function(R,K){for(var de;de=R.next();)if(de=="*"&&R.eat("/"))if(D==1){K.tokenize=null;break}else return K.tokenize=Q(D-1),K.tokenize(R,K);else if(de=="/"&&R.eat("*"))return K.tokenize=Q(D+1),K.tokenize(R,K);return"comment"}}ze("text/x-scala",{name:"clike",keywords:m("abstract case catch class def do else extends final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try type val var while with yield _ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble"),types:m("AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),multiLineStrings:!0,blockKeywords:m("catch class enum do else finally for forSome if match switch try while"),defKeywords:m("class enum def object package trait type val var"),atoms:m("true false null"),indentStatements:!1,indentSwitch:!1,isOperatorChar:/[+\-*&%=<>!?|\/#:@]/,hooks:{"@":function(D){return D.eatWhile(/[\w\$_]/),"meta"},'"':function(D,R){return D.match('""')?(R.tokenize=H,R.tokenize(D,R)):!1},"'":function(D){return D.match(/^(\\[^'\s]+|[^\\'])'/)?"string-2":(D.eatWhile(/[\w\$_\xa1-\uffff]/),"atom")},"=":function(D,R){var K=R.context;return K.type=="}"&&K.align&&D.eat(">")?(R.context=new o(K.indented,K.column,K.type,K.info,null,K.prev),"operator"):!1},"/":function(D,R){return D.eat("*")?(R.tokenize=Q(1),R.tokenize(D,R)):!1}},modeProps:{closeBrackets:{pairs:'()[]{}""',triples:'"'}}});function k(D){return function(R,K){for(var de=!1,L,w=!1;!R.eol();){if(!D&&!de&&R.match('"')){w=!0;break}if(D&&R.match('"""')){w=!0;break}L=R.next(),!de&&L=="$"&&R.match("{")&&R.skipTo("}"),de=!de&&L=="\\"&&!D}return(w||!D)&&(K.tokenize=null),"string"}}ze("text/x-kotlin",{name:"clike",keywords:m("package as typealias class interface this super val operator var fun for is in This throw return annotation break continue object if else while do try when !in !is as? file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constructor init sealed field property receiver param sparam lateinit data inline noinline tailrec external annotation crossinline const operator infix suspend actual expect setparam value"),types:m("Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void Annotation Any BooleanArray ByteArray Char CharArray DeprecationLevel DoubleArray Enum FloatArray Function Int IntArray Lazy LazyThreadSafetyMode LongArray Nothing ShortArray Unit"),intendSwitch:!1,indentStatements:!1,multiLineStrings:!0,number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+(\.\d+)?|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,blockKeywords:m("catch class do else finally for if where try while enum"),defKeywords:m("class val var object interface fun"),atoms:m("true false null this"),hooks:{"@":function(D){return D.eatWhile(/[\w\$_]/),"meta"},"*":function(D,R){return R.prevToken=="."?"variable":"operator"},'"':function(D,R){return R.tokenize=k(D.match('""')),R.tokenize(D,R)},"/":function(D,R){return D.eat("*")?(R.tokenize=Q(1),R.tokenize(D,R)):!1},indent:function(D,R,K,de){var L=K&&K.charAt(0);if((D.prevToken=="}"||D.prevToken==")")&&K=="")return D.indented;if(D.prevToken=="operator"&&K!="}"&&D.context.type!="}"||D.prevToken=="variable"&&L=="."||(D.prevToken=="}"||D.prevToken==")")&&L==".")return de*2+R.indented;if(R.align&&R.type=="}")return R.indented+(D.context.type==(K||"").charAt(0)?0:de)}},modeProps:{closeBrackets:{triples:'"'}}}),ze(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:m("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:m("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:m("for while do if else struct"),builtin:m("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:m("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TextureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),indentSwitch:!1,hooks:{"#":X},modeProps:{fold:["brace","include"]}}),ze("text/x-nesc",{name:"clike",keywords:m(S+" as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),types:F,blockKeywords:m(O),atoms:m("null true false"),hooks:{"#":X},modeProps:{fold:["brace","include"]}}),ze("text/x-objectivec",{name:"clike",keywords:m(S+" "+E),types:N,builtin:m(W),blockKeywords:m(O+" @synthesize @try @catch @finally @autoreleasepool @synchronized"),defKeywords:m($+" @interface @implementation @protocol @class"),dontIndentStatements:/^@.*$/,typeFirstDefinitions:!0,atoms:m("YES NO NULL Nil nil true false nullptr"),isReservedIdentifier:ue,hooks:{"#":X,"*":ne},modeProps:{fold:["brace","include"]}}),ze("text/x-objectivec++",{name:"clike",keywords:m(S+" "+E+" "+A),types:N,builtin:m(W),blockKeywords:m(O+" @synthesize @try @catch @finally @autoreleasepool @synchronized class try catch"),defKeywords:m($+" @interface @implementation @protocol @class class namespace"),dontIndentStatements:/^@.*$|^template$/,typeFirstDefinitions:!0,atoms:m("YES NO NULL Nil nil true false nullptr"),isReservedIdentifier:ue,hooks:{"#":X,"*":ne,u:he,U:he,L:he,R:he,0:se,1:se,2:se,3:se,4:se,5:se,6:se,7:se,8:se,9:se,token:function(D,R,K){if(K=="variable"&&D.peek()=="("&&(R.prevToken==";"||R.prevToken==null||R.prevToken=="}")&&Oe(D.current()))return"def"}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),ze("text/x-squirrel",{name:"clike",keywords:m("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:F,blockKeywords:m("case catch class else for foreach if switch try while"),defKeywords:m("function local class"),typeFirstDefinitions:!0,atoms:m("true false null"),hooks:{"#":X},modeProps:{fold:["brace","include"]}});var J=null;function G(D){return function(R,K){for(var de=!1,L,w=!1;!R.eol();){if(!de&&R.match('"')&&(D=="single"||R.match('""'))){w=!0;break}if(!de&&R.match("``")){J=G(D),w=!0;break}L=R.next(),de=D=="single"&&!de&&L=="\\"}return w&&(K.tokenize=null),"string"}}ze("text/x-ceylon",{name:"clike",keywords:m("abstracts alias assembly assert assign break case catch class continue dynamic else exists extends finally for function given if import in interface is let module new nonempty object of out outer package return satisfies super switch then this throw try value void while"),types:function(D){var R=D.charAt(0);return R===R.toUpperCase()&&R!==R.toLowerCase()},blockKeywords:m("case catch class dynamic else finally for function if interface module new object switch try while"),defKeywords:m("class dynamic function interface module object package value"),builtin:m("abstract actual aliased annotation by default deprecated doc final formal late license native optional sealed see serializable shared suppressWarnings tagged throws variable"),isPunctuationChar:/[\[\]{}\(\),;\:\.`]/,isOperatorChar:/[+\-*&%=<>!?|^~:\/]/,numberStart:/[\d#$]/,number:/^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,multiLineStrings:!0,typeFirstDefinitions:!0,atoms:m("true false null larger smaller equal empty finished"),indentSwitch:!1,styleDefs:!1,hooks:{"@":function(D){return D.eatWhile(/[\w\$_]/),"meta"},'"':function(D,R){return R.tokenize=G(D.match('""')?"triple":"single"),R.tokenize(D,R)},"`":function(D,R){return!J||!D.match("`")?!1:(R.tokenize=J,J=null,R.tokenize(D,R))},"'":function(D){return D.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},token:function(D,R,K){if((K=="variable"||K=="type")&&R.prevToken==".")return"variable-2"}},modeProps:{fold:["brace","import"],closeBrackets:{triples:'"'}}})})})();const Bp={name:"TraceDetailDrawer",components:{TraceSpanTree:qa,DebugTab:$p,codemirror:co.codemirror},props:{visible:{type:Boolean,default:!1},currentTraceId:{type:String,default:null},traceInfo:{type:Object,default:()=>({})},spans:{type:Array,default:()=>[]},filteredSpans:{type:Array,default:()=>[]},selectedSpanId:{type:String,default:null},selectedSpan:{type:Object,default:null},loading:{type:Boolean,default:!1}},data(){return{localVisible:this.visible,spanSearchQuery:"",activeTab:"io",activeCollapse:["inputs","outputs"],messageCollapse:[],rawIoCollapse:["rawInputs","rawOutputs"],rawInputsKey:0,rawOutputsKey:0,eventsCollapse:[],eventsKey:0,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},cmOptionsJava:{tabSize:4,mode:"text/x-java",theme:"monokai",lineNumbers:!0,lineWrapping:!0,readOnly:!0,foldGutter:!0,gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],matchBrackets:!0,autoCloseBrackets:!0,indentUnit:4,styleActiveLine:!0},viewerOptions:{inline:!1,button:!0,navbar:!0,title:!0,toolbar:!0,tooltip:!0,movable:!0,zoomable:!0,rotatable:!0,scalable:!0,transition:!0,fullscreen:!0,keyboard:!0,zIndex:9999}}},computed:{drawerTitle(){let u=this.traceInfo.trace_name;return u||(u=this.traceInfo.trace_id),u?this.$t("trace.traceDetail")+": "+u:this.$t("trace.traceDetail")},traceStartTime(){return this.spans.length===0?0:Math.min(...this.spans.map(u=>u.start_time_unix_nano))},traceEndTime(){return this.spans.length===0?0:Math.max(...this.spans.map(u=>u.end_time_unix_nano))},hasInputs(){var u,n;return((n=(u=this.selectedSpan)==null?void 0:u.parsedContent)==null?void 0:n.inputs)!==void 0},hasOutputs(){var u,n;return((n=(u=this.selectedSpan)==null?void 0:u.parsedContent)==null?void 0:n.outputs)!==void 0},attributesData(){var u,n;return(n=(u=this.selectedSpan)==null?void 0:u.parsedContent)!=null&&n.attributes?Object.entries(this.selectedSpan.parsedContent.attributes).filter(([a])=>!a.startsWith("langsword.span")).map(([a,o])=>({key:a,value:typeof o=="string"?o:JSON.stringify(o,null,2)})):[]},rawInputs(){var u,n,a;return(a=(n=(u=this.selectedSpan)==null?void 0:u.parsedContent)==null?void 0:n.attributes)==null?void 0:a["langsword.spanInputs"]},rawOutputs(){var u,n,a;return(a=(n=(u=this.selectedSpan)==null?void 0:u.parsedContent)==null?void 0:n.attributes)==null?void 0:a["langsword.spanOutputs"]},hasEvents(){var n,a,o;if(((n=this.selectedSpan)==null?void 0:n.has_events)!==void 0)return this.selectedSpan.has_events===!0;const u=(o=(a=this.selectedSpan)==null?void 0:a.parsedContent)==null?void 0:o.events;return u&&Array.isArray(u)&&u.length>0},spanEvents(){var n,a;const u=(a=(n=this.selectedSpan)==null?void 0:n.parsedContent)==null?void 0:a.events;return!u||!Array.isArray(u)?[]:u},showDebugTab(){var u,n;if(!this.selectedSpan)return!1;if(this.selectedSpan.type==="CLIENT"){const a=(n=(u=this.selectedSpan)==null?void 0:u.parsedContent)==null?void 0:n.inputs;if(!a){const o=this.rawInputs;if(o)try{const f=typeof o=="string"?JSON.parse(o):o;return f&&f.file&&(f.file.filename||f.file.content)}catch{return!1}return!1}return a&&a.file&&(a.file.filename||a.file.content)}return this.selectedSpan.type==="CHAT_MODEL"}},watch:{visible(u){this.localVisible=u,u||(this.spanSearchQuery="")},localVisible(u){this.$emit("update:visible",u)},activeTab(u){u==="raw"&&this.$nextTick(()=>{this.rawInputsKey++,this.rawOutputsKey++}),u==="events"&&this.$nextTick(()=>{this.eventsKey++})},selectedSpan(){var f;if(!this.selectedSpan)return;const u=this.selectedSpan.type==="CLIENT"||this.selectedSpan.type==="CHAT_MODEL",n=this.selectedSpan.has_events===!0||((f=this.selectedSpan.parsedContent)==null?void 0:f.events)&&Array.isArray(this.selectedSpan.parsedContent.events)&&this.selectedSpan.parsedContent.events.length>0,a=[];u&&a.push("io","raw"),this.showDebugTab&&a.push("debug"),a.push("attributes"),n&&a.push("events");let o="attributes";u&&(o="io"),a.includes(o)?this.activeTab=o:this.activeTab="attributes",this.$nextTick(()=>{this.updateCollapseStates(),this.activeTab==="raw"&&(this.rawInputsKey++,this.rawOutputsKey++),this.activeTab==="events"&&this.eventsKey++})}},methods:{handleClose(u){this.$emit("close"),u&&typeof u=="function"&&u()},handleSpanSearch(){this.$emit("span-search",this.spanSearchQuery)},handleSpanSelect(u){this.$emit("span-select",u),this.$nextTick(()=>{this.updateCollapseStates()})},updateCollapseStates(){var a,o,f,d,p;this.activeCollapse=["inputs","outputs"],(f=(o=(a=this.selectedSpan)==null?void 0:a.parsedContent)==null?void 0:o.inputs)!=null&&f.messages?this.messageCollapse=this.selectedSpan.parsedContent.inputs.messages.map((y,m)=>`message-${m}`):this.messageCollapse=[],this.rawIoCollapse=["rawInputs","rawOutputs"];const u=(p=(d=this.selectedSpan)==null?void 0:d.parsedContent)==null?void 0:p.events;u&&Array.isArray(u)&&u.length>0?this.eventsCollapse=u.map((y,m)=>`event-${m}`):this.eventsCollapse=[]},parseContentData(u){const n={attributes:u.attributes||{},events:u.events||[],status:u.status||{}};if(u.inputs&&(n.inputs=u.inputs),u.outputs&&(n.outputs=u.outputs),n.attributes){const a=n.attributes["langsword.spanInputs"],o=n.attributes["langsword.spanOutputs"];if(a)try{n.inputs=typeof a=="string"?JSON.parse(a):a}catch{try{const d=a.replace(/\\"/g,'"').replace(/^"|"$/g,"");n.inputs=JSON.parse(d)}catch{n.inputs=a}}if(o)try{n.outputs=typeof o=="string"?JSON.parse(o):o}catch{try{const d=o.replace(/\\"/g,'"').replace(/^"|"$/g,"");n.outputs=JSON.parse(d)}catch{n.outputs=o}}}return n},getStatusType(u){if(!u)return"info";const n=u.toUpperCase();return n==="OK"||n==="SUCCESS"?"success":n==="ERROR"||n==="FAILED"?"danger":n==="WARNING"||n==="WARN"?"warning":"info"},formatNanoDuration(u){if(!u)return"-";const n=u/1e6;return n<1e3?`${n.toFixed(2)}ms`:n<6e4?`${(n/1e3).toFixed(2)}s`:`${(n/6e4).toFixed(2)}min`},formatTimestamp(u){if(!u)return"-";const n=typeof u=="string"?parseInt(u,10):u,a=new Date(n);return isNaN(a.getTime())?"-":a.toLocaleString("zh-CN")},formatEventTimestamp(u){if(!u)return"-";const n=u/1e6,a=new Date(n);return isNaN(a.getTime())?"-":a.toLocaleString("zh-CN")},getEventAttributesData(u){return!u||!u.attributes?[]:Object.entries(u.attributes).map(([n,a])=>({key:n,value:typeof a=="string"?a:JSON.stringify(a,null,2)}))},getOtherEventAttributes(u){if(!u||!u.attributes)return[];const n=["exception.type","exception.message","exception.stacktrace"];return Object.entries(u.attributes).filter(([a])=>!n.includes(a)).map(([a,o])=>({key:a,value:typeof o=="string"?o:JSON.stringify(o,null,2)}))},formatRawJson(u){if(!u)return"";if(typeof u=="string")try{const n=JSON.parse(u);return JSON.stringify(n,null,2)}catch{return u}return JSON.stringify(u,null,2)},getMessageIcon(u){return{user:"el-icon-user",assistant:"el-icon-service",system:"el-icon-setting"}[u]||"el-icon-document"},extractImagesFromObject(u,n=[],a=""){if(!(!u||typeof u!="object")){for(const[o,f]of Object.entries(u)){const d=a?`${a}.${o}`:o;typeof f=="string"&&f.trim()!==""?(f.startsWith("data:image/")||f.startsWith("/9j/")||f.startsWith("iVBOR")||f.startsWith("R0lGOD"))&&(n.push({path:d,value:f,label:o==="content"&&a?`${a.split(".").pop()}: ${o}`:o}),u[o]="[IMAGE_DATA]"):f&&typeof f=="object"&&!Array.isArray(f)?this.extractImagesFromObject(f,n,d):Array.isArray(f)&&f.forEach((p,y)=>{p&&typeof p=="object"&&this.extractImagesFromObject(p,n,`${d}[${y}]`)})}return n}},renderStructuredContent(u){const n=[];if(!u)return n;try{if(Array.isArray(u))u.forEach((a,o)=>{var f;a&&typeof a=="object"?a.type==="text"&&a.text?n.push({type:"markdown",content:Le(a.text),key:`text-${o}`}):a.type==="image_url"&&((f=a.image_url)!=null&&f.url)?n.push({type:"image",url:a.image_url.url,key:`image-${o}`}):a.image_base64&&a.image_base64.trim()!==""?n.push({type:"image",url:this.formatBase64Image(a.image_base64),key:`base64-image-${o}`}):n.push({type:"markdown",content:Le("```json\n"+JSON.stringify(a,null,2)+"\n```"),key:`json-${o}`}):n.push({type:"markdown",content:Le(String(a)),key:`text-${o}`})});else if(typeof u=="string")n.push({type:"markdown",content:Le(u),key:"text-0"});else if(typeof u=="object")if(u.data&&Array.isArray(u.data.result)){const a=JSON.parse(JSON.stringify(u)),o=[];a.data&&a.data.result&&a.data.result.forEach((f,d)=>{f.image_base64&&f.image_base64.trim()!==""&&(o.push({type:"page",image_base64:f.image_base64,page_num:f.page_num,label:f.page_num!==void 0?`Page ${f.page_num}`:`Result ${d}`}),f.image_base64="[BASE64_IMAGE_DATA]"),f.seals&&Array.isArray(f.seals)&&f.seals.forEach((p,y)=>{p.image_base64&&p.image_base64.trim()!==""&&(o.push({type:"seal",image_base64:p.image_base64,page_num:f.page_num,seal_index:y,seal_value:p.value,label:`Seal: ${p.value||y}`}),p.image_base64="[BASE64_IMAGE_DATA]")})}),n.push({type:"markdown",content:Le("```json\n"+JSON.stringify(a,null,2)+"\n```"),key:"json-0"}),o.forEach((f,d)=>{n.push({type:"image",url:this.formatBase64Image(f.image_base64),key:`result-image-${d}`,label:f.label})})}else{const a=JSON.parse(JSON.stringify(u)),o=[];this.extractImagesFromObject(a,o),n.push({type:"markdown",content:Le("```json\n"+JSON.stringify(a,null,2)+"\n```"),key:"json-0"}),o.forEach((f,d)=>{n.push({type:"image",url:this.formatBase64Image(f.value),key:`extracted-image-${d}`,label:f.label})})}else n.push({type:"markdown",content:Le(String(u)),key:"text-0"})}catch(a){console.error("Error rendering content:",a),n.push({type:"markdown",content:Le("Error rendering content"),key:"error-0"})}return n},formatBase64Image(u){return u?u.startsWith("data:image")?u:u.startsWith("/9j/")?`data:image/jpeg;base64,${u}`:u.startsWith("iVBOR")?`data:image/png;base64,${u}`:u.startsWith("R0lGOD")?`data:image/gif;base64,${u}`:`data:image/jpeg;base64,${u}`:""},handleImageClick(u){Rl({options:this.viewerOptions,images:[u]})}}};var Hp=function(){var o,f,d,p,y,m;var n=this,a=n._self._c;return a("el-drawer",{attrs:{visible:n.localVisible,"with-header":!0,title:n.drawerTitle,size:"90%",direction:"rtl","before-close":n.handleClose},on:{"update:visible":function(x){n.localVisible=x}}},[n.currentTraceId?a("div",{directives:[{name:"loading",rawName:"v-loading",value:n.loading,expression:"loading"}],staticClass:"trace-detail-content",attrs:{"element-loading-text":"加载中..."}},[a("div",{staticClass:"trace-info-section"},[a("el-descriptions",{attrs:{column:3,border:""}},[a("el-descriptions-item",{attrs:{label:n.$t("trace.traceId")}},[n._v(n._s(n.traceInfo.trace_id))]),a("el-descriptions-item",{attrs:{label:n.$t("trace.status")}},[a("el-tag",{attrs:{type:n.getStatusType(n.traceInfo.status),size:"mini"}},[n._v(" "+n._s(n.traceInfo.status)+" ")])],1),a("el-descriptions-item",{attrs:{label:n.$t("trace.executionTime")}},[n._v(" "+n._s(n.formatNanoDuration(n.traceInfo.execution_time_ms))+" ")]),a("el-descriptions-item",{attrs:{label:n.$t("trace.timeCreated")}},[n._v(" "+n._s(n.formatTimestamp(n.traceInfo.timestamp_ms))+" ")]),a("el-descriptions-item",{attrs:{label:n.$t("trace.experimentId")}},[n._v(n._s(n.traceInfo.experiment_id))]),a("el-descriptions-item",{attrs:{label:n.$t("trace.traceType")}},[a("el-tag",{attrs:{size:"mini",type:"info"}},[n._v(n._s(n.traceInfo.trace_type||"-"))])],1),a("el-descriptions-item",{attrs:{label:n.$t("trace.traceName"),span:2}},[n._v(" "+n._s(n.traceInfo.trace_name||"-")+" ")])],1)],1),a("el-divider"),a("el-row",{attrs:{gutter:20}},[a("el-col",{staticClass:"span-tree-col",attrs:{span:8}},[a("el-card",[a("div",{attrs:{slot:"header"},slot:"header"},[a("el-input",{attrs:{placeholder:n.$t("span.searchTree"),"prefix-icon":"el-icon-search",size:"small",clearable:""},on:{input:n.handleSpanSearch},model:{value:n.spanSearchQuery,callback:function(x){n.spanSearchQuery=x},expression:"spanSearchQuery"}})],1),a("TraceSpanTree",{attrs:{spans:n.filteredSpans,"selected-span-id":n.selectedSpanId,"trace-start-time":n.traceStartTime,"trace-end-time":n.traceEndTime},on:{"span-select":n.handleSpanSelect}})],1)],1),a("el-col",{staticClass:"span-detail-col",attrs:{span:16}},[a("el-card",[n.selectedSpan?a("div",{staticClass:"span-detail-content"},[a("el-tabs",{key:`tabs-${n.selectedSpanId}`,model:{value:n.activeTab,callback:function(x){n.activeTab=x},expression:"activeTab"}},[n.selectedSpan.type==="CLIENT"||n.selectedSpan.type==="CHAT_MODEL"?a("el-tab-pane",{attrs:{label:`${n.$t("trace.inputs")} / ${n.$t("trace.outputs")}`,name:"io"}},[a("div",{staticClass:"io-content"},[n.hasInputs?a("div",{staticClass:"io-section"},[a("el-collapse",{model:{value:n.activeCollapse,callback:function(x){n.activeCollapse=x},expression:"activeCollapse"}},[a("el-collapse-item",{attrs:{title:n.$t("trace.inputs"),name:"inputs"}},[(f=(o=n.selectedSpan.parsedContent)==null?void 0:o.inputs)!=null&&f.messages?a("div",{staticClass:"messages-section"},n._l(n.selectedSpan.parsedContent.inputs.messages,function(x,S){return a("div",{key:S,staticClass:"message-item"},[a("el-collapse",{model:{value:n.messageCollapse,callback:function(A){n.messageCollapse=A},expression:"messageCollapse"}},[a("el-collapse-item",{attrs:{name:`message-${S}`}},[a("template",{slot:"title"},[a("i",{staticClass:"message-icon",class:n.getMessageIcon(x.role)}),a("span",{staticClass:"message-role"},[n._v(n._s(x.role))])]),a("div",{staticClass:"message-content"},[a("div",{staticClass:"structured-content"},n._l(n.renderStructuredContent(x.content),function(A){return a("div",{key:A.key,staticClass:"content-element"},[A.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(A.content)}}):A.type==="image"?a("div",{staticClass:"image-content"},[A.label?a("div",{staticClass:"image-label"},[n._v(n._s(A.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:A.url,alt:"content image"},on:{click:function(E){return n.handleImageClick(A.url)}}})]):n._e()])}),0)])],2)],1)],1)}),0):(d=n.selectedSpan.parsedContent)!=null&&d.inputs?a("div",{staticClass:"structured-content"},n._l(n.renderStructuredContent(n.selectedSpan.parsedContent.inputs),function(x){return a("div",{key:x.key,staticClass:"content-element"},[x.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(x.content)}}):x.type==="image"?a("div",{staticClass:"image-content"},[x.label?a("div",{staticClass:"image-label"},[n._v(n._s(x.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:x.url,alt:"content image"},on:{click:function(S){return n.handleImageClick(x.url)}}})]):n._e()])}),0):a("div",{staticClass:"empty-content"},[a("el-empty",{attrs:{description:n.$t("trace.noInputs"),"image-size":80}})],1)])],1)],1):n._e(),n.hasOutputs?a("div",{staticClass:"io-section"},[a("el-collapse",{model:{value:n.activeCollapse,callback:function(x){n.activeCollapse=x},expression:"activeCollapse"}},[a("el-collapse-item",{attrs:{title:n.$t("trace.outputs"),name:"outputs"}},[(y=(p=n.selectedSpan.parsedContent)==null?void 0:p.outputs)!=null&&y.choices?a("div",{staticClass:"outputs-section"},n._l(n.selectedSpan.parsedContent.outputs.choices,function(x,S){return a("div",{key:S,staticClass:"choice-item"},[a("div",{staticClass:"choice-header"},[a("span",[n._v("Choice "+n._s(S))])]),a("div",{staticClass:"choice-content"},[x.message?a("div",[a("div",{staticClass:"message-header"},[a("i",{staticClass:"el-icon-user message-icon"}),a("span",[n._v(n._s(x.message.role))])]),a("div",{staticClass:"structured-content"},n._l(n.renderStructuredContent(x.message.content),function(A){return a("div",{key:A.key,staticClass:"content-element"},[A.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(A.content)}}):A.type==="image"?a("div",{staticClass:"image-content"},[A.label?a("div",{staticClass:"image-label"},[n._v(n._s(A.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:A.url,alt:"content image"},on:{click:function(E){return n.handleImageClick(A.url)}}})]):n._e()])}),0)]):a("div",{staticClass:"structured-content"},n._l(n.renderStructuredContent(x),function(A){return a("div",{key:A.key,staticClass:"content-element"},[A.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(A.content)}}):A.type==="image"?a("div",{staticClass:"image-content"},[A.label?a("div",{staticClass:"image-label"},[n._v(n._s(A.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:A.url,alt:"content image"},on:{click:function(E){return n.handleImageClick(A.url)}}})]):n._e()])}),0)])])}),0):(m=n.selectedSpan.parsedContent)!=null&&m.outputs?a("div",{staticClass:"structured-content"},n._l(n.renderStructuredContent(n.selectedSpan.parsedContent.outputs),function(x){return a("div",{key:x.key,staticClass:"content-element"},[x.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(x.content)}}):x.type==="image"?a("div",{staticClass:"image-content"},[x.label?a("div",{staticClass:"image-label"},[n._v(n._s(x.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:x.url,alt:"content image"},on:{click:function(S){return n.handleImageClick(x.url)}}})]):n._e()])}),0):a("div",{staticClass:"empty-content"},[a("el-empty",{attrs:{description:n.$t("trace.noOutputs"),"image-size":80}})],1)])],1)],1):n._e(),!n.hasInputs&&!n.hasOutputs?a("div",{staticClass:"empty-io"},[a("el-empty",{attrs:{description:n.$t("trace.noIoData")}})],1):n._e()])]):n._e(),a("el-tab-pane",{attrs:{label:n.$t("trace.attributes"),name:"attributes"}},[a("el-table",{staticClass:"attributes-table",attrs:{data:n.attributesData,border:"",stripe:""}},[a("el-table-column",{attrs:{prop:"key",label:n.$t("trace.key"),width:"250"},scopedSlots:n._u([{key:"default",fn:function(x){return[a("el-tooltip",{attrs:{content:x.row.key,placement:"top","open-delay":500,"popper-class":"attribute-tooltip"}},[a("span",{staticClass:"attribute-key"},[n._v(n._s(x.row.key))])])]}}],null,!1,688878823)}),a("el-table-column",{attrs:{prop:"value",label:n.$t("trace.value")},scopedSlots:n._u([{key:"default",fn:function(x){return[a("el-tooltip",{attrs:{placement:"top","open-delay":500,"popper-class":"attribute-tooltip"}},[a("div",{staticClass:"attribute-tooltip-content",attrs:{slot:"content"},slot:"content"},[n._v(n._s(x.row.value))]),a("div",{staticClass:"attribute-value"},[n._v(n._s(x.row.value))])])]}}],null,!1,4281519148)})],1)],1),n.selectedSpan.type==="CLIENT"||n.selectedSpan.type==="CHAT_MODEL"?a("el-tab-pane",{attrs:{label:n.$t("trace.rawInputsOutputs"),name:"raw"}},[n.activeTab==="raw"?a("div",{staticClass:"raw-io-content"},[n.rawInputs?a("div",{staticClass:"raw-io-section"},[a("el-collapse",{model:{value:n.rawIoCollapse,callback:function(x){n.rawIoCollapse=x},expression:"rawIoCollapse"}},[a("el-collapse-item",{attrs:{title:n.$t("trace.rawInputs"),name:"rawInputs"}},[a("codemirror",{key:`raw-inputs-${n.selectedSpanId}-${n.rawInputsKey}`,staticClass:"code-editor-wrapper",attrs:{value:n.formatRawJson(n.rawInputs),options:n.cmOptions}})],1)],1)],1):n._e(),n.rawOutputs?a("div",{staticClass:"raw-io-section"},[a("el-collapse",{model:{value:n.rawIoCollapse,callback:function(x){n.rawIoCollapse=x},expression:"rawIoCollapse"}},[a("el-collapse-item",{attrs:{title:n.$t("trace.rawOutputs"),name:"rawOutputs"}},[a("codemirror",{key:`raw-outputs-${n.selectedSpanId}-${n.rawOutputsKey}`,staticClass:"code-editor-wrapper",attrs:{value:n.formatRawJson(n.rawOutputs),options:n.cmOptions}})],1)],1)],1):n._e(),!n.rawInputs&&!n.rawOutputs?a("div",{staticClass:"empty-raw-io"},[a("el-empty",{attrs:{description:n.$t("trace.noIoData")}})],1):n._e()]):n._e()]):n._e(),n.showDebugTab?a("el-tab-pane",{attrs:{label:"快速调试",name:"debug"}},[a("DebugTab",{directives:[{name:"show",rawName:"v-show",value:n.activeTab==="debug",expression:"activeTab === 'debug'"}],attrs:{"selected-span":n.selectedSpan,"selected-span-id":n.selectedSpanId}})],1):n._e(),n.hasEvents?a("el-tab-pane",{attrs:{label:n.$t("trace.events"),name:"events"}},[n.activeTab==="events"?a("div",{staticClass:"events-content"},[a("el-collapse",{model:{value:n.eventsCollapse,callback:function(x){n.eventsCollapse=x},expression:"eventsCollapse"}},n._l(n.spanEvents,function(x,S){return a("el-collapse-item",{key:`event-${S}`,attrs:{name:`event-${S}`}},[a("template",{slot:"title"},[a("div",{staticClass:"event-header"},[a("el-tag",{staticClass:"event-name-tag",attrs:{type:x.name==="exception"?"danger":"info",size:"mini"}},[n._v(" "+n._s(x.name)+" ")]),a("span",{staticClass:"event-time"},[n._v(n._s(n.formatEventTimestamp(x.timestamp)))])],1)]),a("div",{staticClass:"event-detail"},[x.name==="exception"?a("div",{staticClass:"exception-content"},[x.attributes["exception.type"]?a("div",{staticClass:"exception-field"},[a("div",{staticClass:"field-label"},[n._v(n._s(n.$t("trace.exceptionType")))]),a("div",{staticClass:"field-value exception-type"},[n._v(n._s(x.attributes["exception.type"]))])]):n._e(),x.attributes["exception.message"]?a("div",{staticClass:"exception-field"},[a("div",{staticClass:"field-label"},[n._v(n._s(n.$t("trace.exceptionMessage")))]),a("div",{staticClass:"field-value exception-message"},[n._v(n._s(x.attributes["exception.message"]))])]):n._e(),x.attributes["exception.stacktrace"]?a("div",{staticClass:"exception-field"},[a("div",{staticClass:"field-label"},[n._v(n._s(n.$t("trace.exceptionStacktrace")))]),a("codemirror",{key:`stacktrace-${n.selectedSpanId}-${S}-${n.eventsKey}`,staticClass:"code-editor-wrapper stacktrace-editor",attrs:{value:x.attributes["exception.stacktrace"],options:n.cmOptionsJava}})],1):n._e(),n.getOtherEventAttributes(x).length>0?a("div",{staticClass:"exception-field"},[a("div",{staticClass:"field-label"},[n._v(n._s(n.$t("trace.otherAttributes")))]),a("el-table",{attrs:{data:n.getOtherEventAttributes(x),border:"",stripe:"",size:"mini"}},[a("el-table-column",{attrs:{prop:"key",label:n.$t("trace.key"),width:"200"}}),a("el-table-column",{attrs:{prop:"value",label:n.$t("trace.value")}})],1)],1):n._e()]):a("div",{staticClass:"general-event-content"},[a("el-table",{attrs:{data:n.getEventAttributesData(x),border:"",stripe:"",size:"mini"}},[a("el-table-column",{attrs:{prop:"key",label:n.$t("trace.key"),width:"200"},scopedSlots:n._u([{key:"default",fn:function(A){return[a("el-tooltip",{attrs:{content:A.row.key,placement:"top","open-delay":500}},[a("span",{staticClass:"attribute-key"},[n._v(n._s(A.row.key))])])]}}],null,!0)}),a("el-table-column",{attrs:{prop:"value",label:n.$t("trace.value")},scopedSlots:n._u([{key:"default",fn:function(A){return[a("el-tooltip",{attrs:{placement:"top","open-delay":500,"popper-class":"attribute-tooltip"}},[a("div",{staticClass:"attribute-tooltip-content",attrs:{slot:"content"},slot:"content"},[n._v(n._s(A.row.value))]),a("div",{staticClass:"attribute-value"},[n._v(n._s(A.row.value))])])]}}],null,!0)})],1)],1)])],2)}),1),n.spanEvents.length===0?a("div",{staticClass:"empty-events"},[a("el-empty",{attrs:{description:n.$t("trace.noEvents")}})],1):n._e()],1):n._e()]):n._e()],1)],1):a("el-empty",{attrs:{description:n.$t("trace.selectSpan")}})],1)],1)],1)],1):n._e()])},Wp=[],jp=An(Bp,Hp,Wp,!1,null,"af1e0db8");const Up={name:"Trace",components:{TraceDetailDrawer:jp.exports},data(){return{traceList:[],filteredTraceList:[],searchQuery:"",dateRange:null,experimentList:[],selectedExperimentId:null,loading:!1,deleteLoading:!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",drawerLoading:!1,messageCollapse:[],eventsCollapse:[],pageNo:1,pageSize:10,total:0,pickerOptions:{shortcuts:[{text:"近7天",onClick(u){const n=new Date,a=new Date;a.setTime(a.getTime()-3600*1e3*24*7),u.$emit("pick",[a,n])}},{text:"近30天",onClick(u){const n=new Date,a=new Date;a.setTime(a.getTime()-3600*1e3*24*30),u.$emit("pick",[a,n])}},{text:"7天前",onClick(u){const n=new Date;n.setTime(n.getTime()-3600*1e3*24*7),n.setHours(23,59,59,999);const a=n.getTime();u.$emit("pick",[null,a])}},{text:"30天前",onClick(u){const n=new Date;n.setTime(n.getTime()-3600*1e3*24*30),n.setHours(23,59,59,999);const a=n.getTime();u.$emit("pick",[null,a])}}]}}},computed:{},watch:{},mounted(){this.loadExperiments(),this.loadTraceList()},methods:{async loadTraceList(){this.loading=!0;try{let u=null,n=null;this.dateRange&&Array.isArray(this.dateRange)&&(this.dateRange.length===2?(this.dateRange[0]!==null&&this.dateRange[0]!==void 0&&this.dateRange[0]!==""&&(u=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]!==""&&(n=typeof this.dateRange[1]=="number"?this.dateRange[1]:parseInt(this.dateRange[1],10))):this.dateRange.length===1&&this.dateRange[0]!==null&&(n=typeof this.dateRange[0]=="number"?this.dateRange[0]:parseInt(this.dateRange[0],10)));const a=await xn.getTraceList(this.searchQuery,u,n,this.pageNo,this.pageSize,this.selectedExperimentId),o=Array.isArray(a==null?void 0:a.list)?a.list:[];this.traceList=o,this.filteredTraceList=o,this.total=parseInt((a==null?void 0:a.total)||0,10)}catch(u){console.error("Failed to load trace list:",u),this.$message.error("加载 trace 列表失败"),this.traceList=[],this.filteredTraceList=[],this.total=0}finally{this.loading=!1}},refresh(){this.loadTraceList()},handleRowClick(u){this.viewDetail(u.trace_id)},viewDetail(u){this.currentTraceId=u,this.loadTraceDetail(u),this.drawerVisible=!0},async loadTraceDetail(u){var n,a,o;this.drawerLoading=!0;try{const[f,d]=await Promise.all([xn.getTraceDetail(u),xn.getTraceSpans(u)]);if(this.traceInfo=f||{},this.spans=d||[],this.filteredSpans=this.spans,this.spans.length>0){this.selectedSpanId=this.spans[0].span_id,this.selectedSpan=this.spans[0],await this.loadSpanContent(this.spans[0]);const p=this.spans[0].type==="CLIENT"||this.spans[0].type==="CHAT_MODEL",y=this.selectedSpan.has_events===!0,m=[];p&&m.push("io","raw"),m.push("attributes"),y&&m.push("events");let x="attributes";p&&(x="io"),m.includes(x)?this.activeTab=x:this.activeTab="attributes",(a=(n=this.selectedSpan.parsedContent)==null?void 0:n.inputs)!=null&&a.messages?this.messageCollapse=this.selectedSpan.parsedContent.inputs.messages.map((A,E)=>`message-${E}`):this.messageCollapse=[];const S=(o=this.selectedSpan.parsedContent)==null?void 0:o.events;S&&Array.isArray(S)&&S.length>0?this.eventsCollapse=S.map((A,E)=>`event-${E}`):this.eventsCollapse=[]}}catch(f){console.error("Failed to load trace detail:",f),this.$message.error("加载 trace 详情失败"),this.traceInfo={},this.spans=[],this.filteredSpans=[]}finally{this.drawerLoading=!1}},handleSpanSearch(u){if(this.spanSearchQuery=u,!u){this.filteredSpans=this.spans;return}const n=u.toLowerCase();this.filteredSpans=this.spans.filter(a=>a.name.toLowerCase().includes(n)||a.type.toLowerCase().includes(n))},async handleSpanSelect(u){var p,y,m;this.selectedSpanId=u.span_id,this.selectedSpan=u,await this.loadSpanContent(u);const n=u.type==="CLIENT"||u.type==="CHAT_MODEL",a=u.has_events===!0,o=[];n&&o.push("io","raw"),o.push("attributes"),a&&o.push("events");let f="attributes";n&&(f="io"),this.$nextTick(()=>{o.includes(f)?this.activeTab=f:this.activeTab="attributes"}),(y=(p=this.selectedSpan.parsedContent)==null?void 0:p.inputs)!=null&&y.messages?this.messageCollapse=this.selectedSpan.parsedContent.inputs.messages.map((x,S)=>`message-${S}`):this.messageCollapse=[];const d=(m=this.selectedSpan.parsedContent)==null?void 0:m.events;d&&Array.isArray(d)&&d.length>0?this.eventsCollapse=d.map((x,S)=>`event-${S}`):this.eventsCollapse=[]},async loadSpanContent(u){if(!(!this.currentTraceId||!u.span_id||u.parsedContent))try{const n=await xn.getSpanContent(this.currentTraceId,u.span_id);if(n){const a=this.parseContentData(n);this.$set(u,"parsedContent",a)}}catch(n){console.error("Failed to load span content:",n)}},parseContentData(u){const n={attributes:u.attributes||{},events:u.events||[],status:u.status||{}};if(u.inputs&&(n.inputs=u.inputs),u.outputs&&(n.outputs=u.outputs),n.attributes){const a=n.attributes["langsword.spanInputs"],o=n.attributes["langsword.spanOutputs"];if(a)try{n.inputs=typeof a=="string"?JSON.parse(a):a}catch{try{const d=a.replace(/\\"/g,'"').replace(/^"|"$/g,"");n.inputs=JSON.parse(d)}catch{n.inputs=a}}if(o)try{n.outputs=typeof o=="string"?JSON.parse(o):o}catch{try{const d=o.replace(/\\"/g,'"').replace(/^"|"$/g,"");n.outputs=JSON.parse(d)}catch{n.outputs=o}}}return n},handleDrawerClose(){this.currentTraceId=null,this.traceInfo={},this.spans=[],this.filteredSpans=[],this.selectedSpanId=null,this.selectedSpan=null,this.spanSearchQuery="",this.eventsCollapse=[],this.drawerLoading=!1},async loadExperiments(){try{const u=await xn.getExperiments();this.experimentList=Array.isArray(u)?u:[]}catch(u){console.error("Failed to load experiments:",u),this.experimentList=[]}},handleExperimentChange(){this.pageNo=1,this.loadTraceList()},handleSearch(){this.pageNo=1,this.loadTraceList()},handleSearchClear(){this.searchQuery="",this.pageNo=1,this.loadTraceList()},handleDateRangeChange(u){this.pageNo=1,u&&Array.isArray(u)?u.length===2&&(u[0]===null||u[0]===void 0)?this.dateRange=[null,u[1]]:this.dateRange=u:this.dateRange=u,this.loadTraceList()},handleSizeChange(u){this.pageSize=u,this.pageNo=1,this.loadTraceList()},handleCurrentChange(u){this.pageNo=u,this.loadTraceList()},async handleBatchDelete(){var d,p;const u=this.searchQuery&&this.searchQuery.trim(),n=this.dateRange&&Array.isArray(this.dateRange)&&(this.dateRange.length===2&&this.dateRange[1]!==null||this.dateRange.length===1&&this.dateRange[0]!==null),a=this.selectedExperimentId;let o="",f="warning";if(!u&&!n&&!a)o=this.$t("trace.deleteAllWarning"),f="error";else{if(o=this.$t("trace.deleteConfirmMessage")+`
77
+ */function rh(u,n){if(!(u instanceof n))throw new TypeError("Cannot call a class as a function")}function zo(u,n){for(var a=0;a<n.length;a++){var o=n[a];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(u,Bo(o.key),o)}}function ih(u,n,a){return n&&zo(u.prototype,n),a&&zo(u,a),Object.defineProperty(u,"prototype",{writable:!1}),u}function ah(u,n,a){return(n=Bo(n))in u?Object.defineProperty(u,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):u[n]=a,u}function $o(u,n){var a=Object.keys(u);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(u);n&&(o=o.filter(function(f){return Object.getOwnPropertyDescriptor(u,f).enumerable})),a.push.apply(a,o)}return a}function Ga(u){for(var n=1;n<arguments.length;n++){var a=arguments[n]!=null?arguments[n]:{};n%2?$o(Object(a),!0).forEach(function(o){ah(u,o,a[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(a)):$o(Object(a)).forEach(function(o){Object.defineProperty(u,o,Object.getOwnPropertyDescriptor(a,o))})}return u}function sh(u,n){if(typeof u!="object"||!u)return u;var a=u[Symbol.toPrimitive];if(a!==void 0){var o=a.call(u,n);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(u)}function Bo(u){var n=sh(u,"string");return typeof n=="symbol"?n:n+""}function Ka(u){"@babel/helpers - typeof";return Ka=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Ka(u)}var Ho={backdrop:!0,button:!0,navbar:!0,title:!0,toolbar:!0,className:"",container:"body",filter:null,fullscreen:!0,inheritedAttributes:["crossOrigin","decoding","isMap","loading","referrerPolicy","sizes","srcset","useMap"],initialCoverage:.9,initialViewIndex:0,inline:!1,interval:5e3,keyboard:!0,focus:!0,loading:!0,loop:!0,minWidth:200,minHeight:100,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,slideOnTouch:!0,toggleOnDblclick:!0,tooltip:!0,transition:!0,zIndex:2015,zIndexInline:0,zoomRatio:.1,minZoomRatio:.01,maxZoomRatio:100,url:"src",ready:null,show:null,shown:null,hide:null,hidden:null,view:null,viewed:null,move:null,moved:null,rotate:null,rotated:null,scale:null,scaled:null,zoom:null,zoomed:null,play:null,stop:null},oh='<div class="viewer-container" tabindex="-1" touch-action="none"><div class="viewer-canvas"></div><div class="viewer-footer"><div class="viewer-title"></div><div class="viewer-toolbar"></div><div class="viewer-navbar"><ul class="viewer-list" role="navigation"></ul></div></div><div class="viewer-tooltip" role="alert" aria-hidden="true"></div><div class="viewer-button" data-viewer-action="mix" role="button"></div><div class="viewer-player"></div></div>',Ui=typeof window<"u"&&typeof window.document<"u",wn=Ui?window:{},hr=Ui&&wn.document.documentElement?"ontouchstart"in wn.document.documentElement:!1,Xa=Ui?"PointerEvent"in wn:!1,Ne="viewer",Gi="move",Wo="switch",ei="zoom",Ki="".concat(Ne,"-active"),lh="".concat(Ne,"-close"),Xi="".concat(Ne,"-fade"),Ya="".concat(Ne,"-fixed"),uh="".concat(Ne,"-fullscreen"),jo="".concat(Ne,"-fullscreen-exit"),Vn="".concat(Ne,"-hide"),fh="".concat(Ne,"-hide-md-down"),ch="".concat(Ne,"-hide-sm-down"),hh="".concat(Ne,"-hide-xs-down"),Vt="".concat(Ne,"-in"),ti="".concat(Ne,"-invisible"),dr="".concat(Ne,"-loading"),dh="".concat(Ne,"-move"),qo="".concat(Ne,"-open"),pr="".concat(Ne,"-show"),at="".concat(Ne,"-transition"),gr="click",Va="dblclick",Uo="dragstart",Go="focusin",Ko="keydown",Jt="load",Jn="error",ph=hr?"touchend touchcancel":"mouseup",gh=hr?"touchmove":"mousemove",mh=hr?"touchstart":"mousedown",Xo=Xa?"pointerdown":mh,Yo=Xa?"pointermove":gh,Vo=Xa?"pointerup pointercancel":ph,Jo="resize",nn="transitionend",Qo="wheel",Zo="ready",el="show",tl="shown",nl="hide",rl="hidden",il="view",ni="viewed",al="move",sl="moved",ol="rotate",ll="rotated",ul="scale",fl="scaled",cl="zoom",hl="zoomed",dl="play",pl="stop",Yi="".concat(Ne,"Action"),Ja=/\s\s*/,Vi=["zoom-in","zoom-out","one-to-one","reset","prev","play","next","rotate-left","rotate-right","flip-horizontal","flip-vertical"];function ri(u){return typeof u=="string"}var vh=Number.isNaN||wn.isNaN;function Ze(u){return typeof u=="number"&&!vh(u)}function mr(u){return typeof u>"u"}function vr(u){return Ka(u)==="object"&&u!==null}var yh=Object.prototype.hasOwnProperty;function yr(u){if(!vr(u))return!1;try{var n=u.constructor,a=n.prototype;return n&&a&&yh.call(a,"isPrototypeOf")}catch{return!1}}function Ue(u){return typeof u=="function"}function Xe(u,n){if(u&&Ue(n))if(Array.isArray(u)||Ze(u.length)){var a=u.length,o;for(o=0;o<a&&n.call(u,u[o],o,u)!==!1;o+=1);}else vr(u)&&Object.keys(u).forEach(function(f){n.call(u,u[f],f,u)});return u}var qt=Object.assign||function(n){for(var a=arguments.length,o=new Array(a>1?a-1:0),f=1;f<a;f++)o[f-1]=arguments[f];return vr(n)&&o.length>0&&o.forEach(function(d){vr(d)&&Object.keys(d).forEach(function(p){n[p]=d[p]})}),n},bh=/^(?:width|height|left|top|marginLeft|marginTop)$/;function rn(u,n){var a=u.style;Xe(n,function(o,f){bh.test(f)&&Ze(o)&&(o+="px"),a[f]=o})}function xh(u){return ri(u)?u.replace(/&(?!amp;|quot;|#39;|lt;|gt;)/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;"):u}function br(u,n){return!u||!n?!1:u.classList?u.classList.contains(n):u.className.indexOf(n)>-1}function Ce(u,n){if(!(!u||!n)){if(Ze(u.length)){Xe(u,function(o){Ce(o,n)});return}if(u.classList){u.classList.add(n);return}var a=u.className.trim();a?a.indexOf(n)<0&&(u.className="".concat(a," ").concat(n)):u.className=n}}function He(u,n){if(!(!u||!n)){if(Ze(u.length)){Xe(u,function(a){He(a,n)});return}if(u.classList){u.classList.remove(n);return}u.className.indexOf(n)>=0&&(u.className=u.className.replace(n,""))}}function ii(u,n,a){if(n){if(Ze(u.length)){Xe(u,function(o){ii(o,n,a)});return}a?Ce(u,n):He(u,n)}}var wh=/([a-z\d])([A-Z])/g;function Qa(u){return u.replace(wh,"$1-$2").toLowerCase()}function xr(u,n){return vr(u[n])?u[n]:u.dataset?u.dataset[n]:u.getAttribute("data-".concat(Qa(n)))}function Za(u,n,a){vr(a)?u[n]=a:u.dataset?u.dataset[n]=a:u.setAttribute("data-".concat(Qa(n)),a)}var gl=function(){var u=!1;if(Ui){var n=!1,a=function(){},o=Object.defineProperty({},"once",{get:function(){return u=!0,n},set:function(d){n=d}});wn.addEventListener("test",a,o),wn.removeEventListener("test",a,o)}return u}();function Ge(u,n,a){var o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},f=a;n.trim().split(Ja).forEach(function(d){if(!gl){var p=u.listeners;p&&p[d]&&p[d][a]&&(f=p[d][a],delete p[d][a],Object.keys(p[d]).length===0&&delete p[d],Object.keys(p).length===0&&delete u.listeners)}u.removeEventListener(d,f,o)})}function Ee(u,n,a){var o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},f=a;n.trim().split(Ja).forEach(function(d){if(o.once&&!gl){var p=u.listeners,y=p===void 0?{}:p;f=function(){delete y[d][a],u.removeEventListener(d,f,o);for(var x=arguments.length,S=new Array(x),A=0;A<x;A++)S[A]=arguments[A];a.apply(u,S)},y[d]||(y[d]={}),y[d][a]&&u.removeEventListener(d,y[d][a],o),y[d][a]=f,u.listeners=y}u.addEventListener(d,f,o)})}function ot(u,n,a,o){var f;return Ue(Event)&&Ue(CustomEvent)?f=new CustomEvent(n,Ga({bubbles:!0,cancelable:!0,detail:a},o)):(f=document.createEvent("CustomEvent"),f.initCustomEvent(n,!0,!0,a)),u.dispatchEvent(f)}function kh(u){var n=u.getBoundingClientRect();return{left:n.left+(window.pageXOffset-document.documentElement.clientLeft),top:n.top+(window.pageYOffset-document.documentElement.clientTop)}}function Ji(u){var n=u.rotate,a=u.scaleX,o=u.scaleY,f=u.translateX,d=u.translateY,p=[];Ze(f)&&f!==0&&p.push("translateX(".concat(f,"px)")),Ze(d)&&d!==0&&p.push("translateY(".concat(d,"px)")),Ze(n)&&n!==0&&p.push("rotate(".concat(n,"deg)")),Ze(a)&&a!==1&&p.push("scaleX(".concat(a,")")),Ze(o)&&o!==1&&p.push("scaleY(".concat(o,")"));var y=p.length?p.join(" "):"none";return{WebkitTransform:y,msTransform:y,transform:y}}function Sh(u){return ri(u)?decodeURIComponent(u.replace(/^.*\//,"").replace(/[?&#].*$/,"")):""}var es=wn.navigator&&/Version\/\d+(\.\d+)+?\s+Safari/i.test(wn.navigator.userAgent);function ml(u,n,a){var o=document.createElement("img");if(u.naturalWidth&&!es)return a(u.naturalWidth,u.naturalHeight),o;var f=document.body||document.documentElement;return o.onload=function(){a(o.width,o.height),es||f.removeChild(o)},Xe(n.inheritedAttributes,function(d){var p=u.getAttribute(d);p!==null&&o.setAttribute(d,p)}),o.src=u.src,es||(o.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",f.appendChild(o)),o}function Qi(u){switch(u){case 2:return hh;case 3:return ch;case 4:return fh;default:return""}}function Ch(u){var n=Ga({},u),a=[];return Xe(u,function(o,f){delete n[f],Xe(n,function(d){var p=Math.abs(o.startX-d.startX),y=Math.abs(o.startY-d.startY),m=Math.abs(o.endX-d.endX),x=Math.abs(o.endY-d.endY),S=Math.sqrt(p*p+y*y),A=Math.sqrt(m*m+x*x),E=(A-S)/S;a.push(E)})}),a.sort(function(o,f){return Math.abs(o)<Math.abs(f)}),a[0]}function Zi(u,n){var a=u.pageX,o=u.pageY,f={endX:a,endY:o};return n?f:Ga({timeStamp:Date.now(),startX:a,startY:o},f)}function Th(u){var n=0,a=0,o=0;return Xe(u,function(f){var d=f.startX,p=f.startY;n+=d,a+=p,o+=1}),n/=o,a/=o,{pageX:n,pageY:a}}var _h={render:function(){this.initContainer(),this.initViewer(),this.initList(),this.renderViewer()},initBody:function(){var n=this.element.ownerDocument,a=n.body||n.documentElement;this.body=a,this.scrollbarWidth=window.innerWidth-n.documentElement.clientWidth,this.initialBodyPaddingRight=a.style.paddingRight,this.initialBodyComputedPaddingRight=window.getComputedStyle(a).paddingRight},initContainer:function(){this.containerData={width:window.innerWidth,height:window.innerHeight}},initViewer:function(){var n=this.options,a=this.parent,o;n.inline&&(o={width:Math.max(a.offsetWidth,n.minWidth),height:Math.max(a.offsetHeight,n.minHeight)},this.parentData=o),(this.fulled||!o)&&(o=this.containerData),this.viewerData=qt({},o)},renderViewer:function(){this.options.inline&&!this.fulled&&rn(this.viewer,this.viewerData)},initList:function(){var n=this,a=this.element,o=this.options,f=this.list,d=[];f.innerHTML="",Xe(this.images,function(p,y){var m=p.src,x=p.alt||Sh(m),S=n.getImageURL(p);if(m||S){var A=document.createElement("li"),E=document.createElement("img");Xe(o.inheritedAttributes,function(H){var B=p.getAttribute(H);B!==null&&E.setAttribute(H,B)}),o.navbar&&(E.src=m||S),E.alt=x,E.setAttribute("data-original-url",S||m),A.setAttribute("data-index",y),A.setAttribute("data-viewer-action","view"),A.setAttribute("role","button"),o.keyboard&&A.setAttribute("tabindex",0),A.appendChild(E),f.appendChild(A),d.push(A)}}),this.items=d,Xe(d,function(p){var y=p.firstElementChild,m,x;Za(y,"filled",!0),o.loading&&Ce(p,dr),Ee(y,Jt,m=function(A){Ge(y,Jn,x),o.loading&&He(p,dr),n.loadImage(A)},{once:!0}),Ee(y,Jn,x=function(){Ge(y,Jt,m),o.loading&&He(p,dr)},{once:!0})}),o.transition&&Ee(a,ni,function(){Ce(f,at)},{once:!0})},renderList:function(){var n=this.index,a=this.items[n];if(a){var o=a.nextElementSibling,f=parseInt(window.getComputedStyle(o||a).marginLeft,10),d=a.offsetWidth,p=d+f;rn(this.list,qt({width:p*this.length-f},Ji({translateX:(this.viewerData.width-d)/2-p*n})))}},resetList:function(){var n=this.list;n.innerHTML="",He(n,at),rn(n,Ji({translateX:0}))},initImage:function(n){var a=this,o=this.options,f=this.image,d=this.viewerData,p=this.footer.offsetHeight,y=d.width,m=Math.max(d.height-p,p),x=this.imageData||{},S;this.imageInitializing={abort:function(){S.onload=null}},S=ml(f,o,function(A,E){var H=A/E,B=Math.max(0,Math.min(1,o.initialCoverage)),U=y,F=m;a.imageInitializing=!1,m*H>y?F=y/H:U=m*H,B=Ze(B)?B:.9,U=Math.min(U*B,A),F=Math.min(F*B,E);var N=(y-U)/2,O=(m-F)/2,$={left:N,top:O,x:N,y:O,width:U,height:F,oldRatio:1,ratio:U/A,aspectRatio:H,naturalWidth:A,naturalHeight:E},X=qt({},$);o.rotatable&&($.rotate=x.rotate||0,X.rotate=0),o.scalable&&($.scaleX=x.scaleX||1,$.scaleY=x.scaleY||1,X.scaleX=1,X.scaleY=1),a.imageData=$,a.initialImageData=X,n&&n()})},renderImage:function(n){var a=this,o=this.image,f=this.imageData;if(rn(o,qt({width:f.width,height:f.height,marginLeft:f.x,marginTop:f.y},Ji(f))),n)if((this.viewing||this.moving||this.rotating||this.scaling||this.zooming)&&this.options.transition&&br(o,at)){var d=function(){a.imageRendering=!1,n()};this.imageRendering={abort:function(){Ge(o,nn,d)}},Ee(o,nn,d,{once:!0})}else n()},resetImage:function(){var n=this.image;n&&(this.viewing&&this.viewing.abort(),n.parentNode.removeChild(n),this.image=null,this.title.innerHTML="")}},Lh={bind:function(){var n=this.options,a=this.viewer,o=this.canvas,f=this.element.ownerDocument;Ee(a,gr,this.onClick=this.click.bind(this)),Ee(a,Uo,this.onDragStart=this.dragstart.bind(this)),Ee(o,Xo,this.onPointerDown=this.pointerdown.bind(this)),Ee(f,Yo,this.onPointerMove=this.pointermove.bind(this)),Ee(f,Vo,this.onPointerUp=this.pointerup.bind(this)),Ee(f,Ko,this.onKeyDown=this.keydown.bind(this)),Ee(window,Jo,this.onResize=this.resize.bind(this)),n.zoomable&&n.zoomOnWheel&&Ee(a,Qo,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),n.toggleOnDblclick&&Ee(o,Va,this.onDblclick=this.dblclick.bind(this))},unbind:function(){var n=this.options,a=this.viewer,o=this.canvas,f=this.element.ownerDocument;Ge(a,gr,this.onClick),Ge(a,Uo,this.onDragStart),Ge(o,Xo,this.onPointerDown),Ge(f,Yo,this.onPointerMove),Ge(f,Vo,this.onPointerUp),Ge(f,Ko,this.onKeyDown),Ge(window,Jo,this.onResize),n.zoomable&&n.zoomOnWheel&&Ge(a,Qo,this.onWheel,{passive:!1,capture:!0}),n.toggleOnDblclick&&Ge(o,Va,this.onDblclick)}},Eh={click:function(n){var a=this.options,o=this.imageData,f=n.target,d=xr(f,Yi);switch(!d&&f.localName==="img"&&f.parentElement.localName==="li"&&(f=f.parentElement,d=xr(f,Yi)),hr&&n.isTrusted&&f===this.canvas&&clearTimeout(this.clickCanvasTimeout),d){case"mix":this.played?this.stop():a.inline?this.fulled?this.exit():this.full():this.hide();break;case"hide":this.pointerMoved||this.hide();break;case"view":this.view(xr(f,"index"));break;case"zoom-in":this.zoom(.1,!0);break;case"zoom-out":this.zoom(-.1,!0);break;case"one-to-one":this.toggle();break;case"reset":this.reset();break;case"prev":this.prev(a.loop);break;case"play":this.play(a.fullscreen);break;case"next":this.next(a.loop);break;case"rotate-left":this.rotate(-90);break;case"rotate-right":this.rotate(90);break;case"flip-horizontal":this.scaleX(-o.scaleX||-1);break;case"flip-vertical":this.scaleY(-o.scaleY||-1);break;default:this.played&&this.stop()}},dblclick:function(n){n.preventDefault(),this.viewed&&n.target===this.image&&(hr&&n.isTrusted&&clearTimeout(this.doubleClickImageTimeout),this.toggle(n.isTrusted?n:n.detail&&n.detail.originalEvent))},load:function(){var n=this;this.timeout&&(clearTimeout(this.timeout),this.timeout=!1);var a=this.element,o=this.options,f=this.image,d=this.index,p=this.viewerData;He(f,ti),o.loading&&He(this.canvas,dr),f.style.cssText="height:0;"+"margin-left:".concat(p.width/2,"px;")+"margin-top:".concat(p.height/2,"px;")+"max-width:none!important;position:relative;width:0;",this.initImage(function(){ii(f,dh,o.movable),ii(f,at,o.transition),n.renderImage(function(){n.viewed=!0,n.viewing=!1,Ue(o.viewed)&&Ee(a,ni,o.viewed,{once:!0}),ot(a,ni,{originalImage:n.images[d],index:d,image:f},{cancelable:!1})})})},loadImage:function(n){var a=n.target,o=a.parentNode,f=o.offsetWidth||30,d=o.offsetHeight||50,p=!!xr(a,"filled");ml(a,this.options,function(y,m){var x=y/m,S=f,A=d;d*x>f?p?S=d*x:A=f/x:p?A=f/x:S=d*x,rn(a,qt({width:S,height:A},Ji({translateX:(f-S)/2,translateY:(d-A)/2})))})},keydown:function(n){var a=this.options;if(a.keyboard){var o=n.keyCode||n.which||n.charCode;switch(o){case 13:this.viewer.contains(n.target)&&this.click(n);break}if(this.fulled)switch(o){case 27:this.played?this.stop():a.inline?this.fulled&&this.exit():this.hide();break;case 32:this.played&&this.stop();break;case 37:this.played&&this.playing?this.playing.prev():this.prev(a.loop);break;case 38:n.preventDefault(),this.zoom(a.zoomRatio,!0);break;case 39:this.played&&this.playing?this.playing.next():this.next(a.loop);break;case 40:n.preventDefault(),this.zoom(-a.zoomRatio,!0);break;case 48:case 49:n.ctrlKey&&(n.preventDefault(),this.toggle());break}}},dragstart:function(n){n.target.localName==="img"&&n.preventDefault()},pointerdown:function(n){var a=this.options,o=this.pointers,f=n.buttons,d=n.button;if(this.pointerMoved=!1,!(!this.viewed||this.showing||this.viewing||this.hiding||(n.type==="mousedown"||n.type==="pointerdown"&&n.pointerType==="mouse")&&(Ze(f)&&f!==1||Ze(d)&&d!==0||n.ctrlKey))){n.preventDefault(),n.changedTouches?Xe(n.changedTouches,function(y){o[y.identifier]=Zi(y)}):o[n.pointerId||0]=Zi(n);var p=a.movable?Gi:!1;a.zoomOnTouch&&a.zoomable&&Object.keys(o).length>1?p=ei:a.slideOnTouch&&(n.pointerType==="touch"||n.type==="touchstart")&&this.isSwitchable()&&(p=Wo),a.transition&&(p===Gi||p===ei)&&He(this.image,at),this.action=p}},pointermove:function(n){var a=this.pointers,o=this.action;!this.viewed||!o||(n.preventDefault(),n.changedTouches?Xe(n.changedTouches,function(f){qt(a[f.identifier]||{},Zi(f,!0))}):qt(a[n.pointerId||0]||{},Zi(n,!0)),this.change(n))},pointerup:function(n){var a=this,o=this.options,f=this.action,d=this.pointers,p;n.changedTouches?Xe(n.changedTouches,function(y){p=d[y.identifier],delete d[y.identifier]}):(p=d[n.pointerId||0],delete d[n.pointerId||0]),f&&(n.preventDefault(),o.transition&&(f===Gi||f===ei)&&Ce(this.image,at),this.action=!1,hr&&f!==ei&&p&&Date.now()-p.timeStamp<500&&(clearTimeout(this.clickCanvasTimeout),clearTimeout(this.doubleClickImageTimeout),o.toggleOnDblclick&&this.viewed&&n.target===this.image?this.imageClicked?(this.imageClicked=!1,this.doubleClickImageTimeout=setTimeout(function(){ot(a.image,Va,{originalEvent:n})},50)):(this.imageClicked=!0,this.doubleClickImageTimeout=setTimeout(function(){a.imageClicked=!1},500)):(this.imageClicked=!1,o.backdrop&&o.backdrop!=="static"&&n.target===this.canvas&&(this.clickCanvasTimeout=setTimeout(function(){ot(a.canvas,gr,{originalEvent:n})},50)))))},resize:function(){var n=this;if(!(!this.isShown||this.hiding)&&(this.fulled&&(this.close(),this.initBody(),this.open()),this.initContainer(),this.initViewer(),this.renderViewer(),this.renderList(),this.viewed&&this.initImage(function(){n.renderImage()}),this.played)){if(this.options.fullscreen&&this.fulled&&!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)){this.stop();return}Xe(this.player.getElementsByTagName("img"),function(a){Ee(a,Jt,n.loadImage.bind(n),{once:!0}),ot(a,Jt)})}},wheel:function(n){var a=this;if(this.viewed&&(n.preventDefault(),!this.wheeling)){this.wheeling=!0,setTimeout(function(){a.wheeling=!1},50);var o=Number(this.options.zoomRatio)||.1,f=1;n.deltaY?f=n.deltaY>0?1:-1:n.wheelDelta?f=-n.wheelDelta/120:n.detail&&(f=n.detail>0?1:-1),this.zoom(-f*o,!0,null,n)}}},Dh={show:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,a=this.element,o=this.options;if(o.inline||this.showing||this.isShown||this.showing)return this;if(!this.ready)return this.build(),this.ready&&this.show(n),this;if(Ue(o.show)&&Ee(a,el,o.show,{once:!0}),ot(a,el)===!1||!this.ready)return this;this.hiding&&this.transitioning.abort(),this.showing=!0,this.open();var f=this.viewer;if(He(f,Vn),f.setAttribute("role","dialog"),f.setAttribute("aria-labelledby",this.title.id),f.setAttribute("aria-modal",!0),f.removeAttribute("aria-hidden"),o.transition&&!n){var d=this.shown.bind(this);this.transitioning={abort:function(){Ge(f,nn,d),He(f,Vt)}},Ce(f,at),f.initialOffsetWidth=f.offsetWidth,Ee(f,nn,d,{once:!0}),Ce(f,Vt)}else Ce(f,Vt),this.shown();return this},hide:function(){var n=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,o=this.element,f=this.options;if(f.inline||this.hiding||!(this.isShown||this.showing))return this;if(Ue(f.hide)&&Ee(o,nl,f.hide,{once:!0}),ot(o,nl)===!1)return this;this.showing&&this.transitioning.abort(),this.hiding=!0,this.played?this.stop():this.viewing&&this.viewing.abort();var d=this.viewer,p=this.image,y=function(){He(d,Vt),n.hidden()};if(f.transition&&!a){var m=function(A){A&&A.target===d&&(Ge(d,nn,m),n.hidden())},x=function(){br(d,at)?(Ee(d,nn,m),He(d,Vt)):y()};this.transitioning={abort:function(){n.viewed&&br(p,at)?Ge(p,nn,x):br(d,at)&&Ge(d,nn,m)}},this.viewed&&br(p,at)?(Ee(p,nn,x,{once:!0}),this.zoomTo(0,!1,null,null,!0)):x()}else y();return this},view:function(){var n=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.initialViewIndex;if(a=Number(a)||0,this.hiding||this.played||a<0||a>=this.length||this.viewed&&a===this.index)return this;if(!this.isShown)return this.index=a,this.show();this.viewing&&this.viewing.abort();var o=this.element,f=this.options,d=this.title,p=this.canvas,y=this.items[a],m=y.querySelector("img"),x=xr(m,"originalUrl"),S=m.getAttribute("alt"),A=document.createElement("img");if(Xe(f.inheritedAttributes,function(F){var N=m.getAttribute(F);N!==null&&A.setAttribute(F,N)}),A.src=x,A.alt=S,Ue(f.view)&&Ee(o,il,f.view,{once:!0}),ot(o,il,{originalImage:this.images[a],index:a,image:A})===!1||!this.isShown||this.hiding||this.played)return this;var E=this.items[this.index];E&&(He(E,Ki),E.removeAttribute("aria-selected")),Ce(y,Ki),y.setAttribute("aria-selected",!0),f.focus&&y.focus(),this.image=A,this.viewed=!1,this.index=a,this.imageData={},Ce(A,ti),f.loading&&Ce(p,dr),p.innerHTML="",p.appendChild(A),this.renderList(),d.innerHTML="";var H=function(){var N=n.imageData,O=Array.isArray(f.title)?f.title[1]:f.title;d.innerHTML=xh(Ue(O)?O.call(n,A,N):"".concat(S," (").concat(N.naturalWidth," × ").concat(N.naturalHeight,")"))},B,U;return Ee(o,ni,H,{once:!0}),this.viewing={abort:function(){Ge(o,ni,H),A.complete?n.imageRendering?n.imageRendering.abort():n.imageInitializing&&n.imageInitializing.abort():(A.src="",Ge(A,Jt,B),n.timeout&&clearTimeout(n.timeout))}},A.complete?this.load():(Ee(A,Jt,B=function(){Ge(A,Jn,U),n.load()},{once:!0}),Ee(A,Jn,U=function(){Ge(A,Jt,B),n.timeout&&(clearTimeout(n.timeout),n.timeout=!1),He(A,ti),f.loading&&He(n.canvas,dr)},{once:!0}),this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(function(){He(A,ti),n.timeout=!1},1e3)),this},prev:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,a=this.index-1;return a<0&&(a=n?this.length-1:0),this.view(a),this},next:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,a=this.length-1,o=this.index+1;return o>a&&(o=n?0:a),this.view(o),this},move:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:n,o=this.imageData;return this.moveTo(mr(n)?n:o.x+Number(n),mr(a)?a:o.y+Number(a)),this},moveTo:function(n){var a=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:n,f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,d=this.element,p=this.options,y=this.imageData;if(n=Number(n),o=Number(o),this.viewed&&!this.played&&p.movable){var m=y.x,x=y.y,S=!1;if(Ze(n)?S=!0:n=m,Ze(o)?S=!0:o=x,S){if(Ue(p.move)&&Ee(d,al,p.move,{once:!0}),ot(d,al,{x:n,y:o,oldX:m,oldY:x,originalEvent:f})===!1)return this;y.x=n,y.y=o,y.left=n,y.top=o,this.moving=!0,this.renderImage(function(){a.moving=!1,Ue(p.moved)&&Ee(d,sl,p.moved,{once:!0}),ot(d,sl,{x:n,y:o,oldX:m,oldY:x,originalEvent:f},{cancelable:!1})})}}return this},rotate:function(n){return this.rotateTo((this.imageData.rotate||0)+Number(n)),this},rotateTo:function(n){var a=this,o=this.element,f=this.options,d=this.imageData;if(n=Number(n),Ze(n)&&this.viewed&&!this.played&&f.rotatable){var p=d.rotate;if(Ue(f.rotate)&&Ee(o,ol,f.rotate,{once:!0}),ot(o,ol,{degree:n,oldDegree:p})===!1)return this;d.rotate=n,this.rotating=!0,this.renderImage(function(){a.rotating=!1,Ue(f.rotated)&&Ee(o,ll,f.rotated,{once:!0}),ot(o,ll,{degree:n,oldDegree:p},{cancelable:!1})})}return this},scaleX:function(n){return this.scale(n,this.imageData.scaleY),this},scaleY:function(n){return this.scale(this.imageData.scaleX,n),this},scale:function(n){var a=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:n,f=this.element,d=this.options,p=this.imageData;if(n=Number(n),o=Number(o),this.viewed&&!this.played&&d.scalable){var y=p.scaleX,m=p.scaleY,x=!1;if(Ze(n)?x=!0:n=y,Ze(o)?x=!0:o=m,x){if(Ue(d.scale)&&Ee(f,ul,d.scale,{once:!0}),ot(f,ul,{scaleX:n,scaleY:o,oldScaleX:y,oldScaleY:m})===!1)return this;p.scaleX=n,p.scaleY=o,this.scaling=!0,this.renderImage(function(){a.scaling=!1,Ue(d.scaled)&&Ee(f,fl,d.scaled,{once:!0}),ot(f,fl,{scaleX:n,scaleY:o,oldScaleX:y,oldScaleY:m},{cancelable:!1})})}}return this},zoom:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,f=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,d=this.imageData;return n=Number(n),n<0?n=1/(1-n):n=1+n,this.zoomTo(d.width*n/d.naturalWidth,a,o,f),this},zoomTo:function(n){var a=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,p=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,y=this.element,m=this.options,x=this.pointers,S=this.imageData,A=S.x,E=S.y,H=S.width,B=S.height,U=S.naturalWidth,F=S.naturalHeight;if(n=Math.max(0,n),Ze(n)&&this.viewed&&!this.played&&(p||m.zoomable)){if(!p){var N=Math.max(.01,m.minZoomRatio),O=Math.min(100,m.maxZoomRatio);n=Math.min(Math.max(n,N),O)}if(d)switch(d.type){case"wheel":m.zoomRatio>=.055&&n>.95&&n<1.05&&(n=1);break;case"pointermove":case"touchmove":case"mousemove":n>.99&&n<1.01&&(n=1);break}var $=U*n,X=F*n,ne=$-H,ue=X-B,se=S.ratio;if(Ue(m.zoom)&&Ee(y,cl,m.zoom,{once:!0}),ot(y,cl,{ratio:n,oldRatio:se,originalEvent:d})===!1)return this;if(this.zooming=!0,d){var he=kh(this.viewer),Oe=x&&Object.keys(x).length>0?Th(x):{pageX:d.pageX,pageY:d.pageY};S.x-=ne*((Oe.pageX-he.left-A)/H),S.y-=ue*((Oe.pageY-he.top-E)/B)}else yr(f)&&Ze(f.x)&&Ze(f.y)?(S.x-=ne*((f.x-A)/H),S.y-=ue*((f.y-E)/B)):(S.x-=ne/2,S.y-=ue/2);S.left=S.x,S.top=S.y,S.width=$,S.height=X,S.oldRatio=se,S.ratio=n,this.renderImage(function(){a.zooming=!1,Ue(m.zoomed)&&Ee(y,hl,m.zoomed,{once:!0}),ot(y,hl,{ratio:n,oldRatio:se,originalEvent:d},{cancelable:!1})}),o&&this.tooltip()}return this},play:function(){var n=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(!this.isShown||this.played)return this;var o=this.element,f=this.options;if(Ue(f.play)&&Ee(o,dl,f.play,{once:!0}),ot(o,dl)===!1)return this;var d=this.player,p=this.loadImage.bind(this),y=[],m=0,x=0;if(this.played=!0,this.onLoadWhenPlay=p,a&&this.requestFullscreen(a),Ce(d,pr),Xe(this.items,function(E,H){var B=E.querySelector("img"),U=document.createElement("img");U.src=xr(B,"originalUrl"),U.alt=B.getAttribute("alt"),U.referrerPolicy=B.referrerPolicy,m+=1,Ce(U,Xi),ii(U,at,f.transition),br(E,Ki)&&(Ce(U,Vt),x=H),y.push(U),Ee(U,Jt,p,{once:!0}),d.appendChild(U)}),Ze(f.interval)&&f.interval>0){var S=function(){clearTimeout(n.playing.timeout),He(y[x],Vt),x-=1,x=x>=0?x:m-1,Ce(y[x],Vt),n.playing.timeout=setTimeout(S,f.interval)},A=function(){clearTimeout(n.playing.timeout),He(y[x],Vt),x+=1,x=x<m?x:0,Ce(y[x],Vt),n.playing.timeout=setTimeout(A,f.interval)};m>1&&(this.playing={prev:S,next:A,timeout:setTimeout(A,f.interval)})}return this},stop:function(){var n=this;if(!this.played)return this;var a=this.element,o=this.options;if(Ue(o.stop)&&Ee(a,pl,o.stop,{once:!0}),ot(a,pl)===!1)return this;var f=this.player;return clearTimeout(this.playing.timeout),this.playing=!1,this.played=!1,Xe(f.getElementsByTagName("img"),function(d){Ge(d,Jt,n.onLoadWhenPlay)}),He(f,pr),f.innerHTML="",this.exitFullscreen(),this},full:function(){var n=this,a=this.options,o=this.viewer,f=this.image,d=this.list;return!this.isShown||this.played||this.fulled||!a.inline?this:(this.fulled=!0,this.open(),Ce(this.button,jo),a.transition&&(He(d,at),this.viewed&&He(f,at)),Ce(o,Ya),o.setAttribute("role","dialog"),o.setAttribute("aria-labelledby",this.title.id),o.setAttribute("aria-modal",!0),o.removeAttribute("style"),rn(o,{zIndex:a.zIndex}),a.focus&&this.enforceFocus(),this.initContainer(),this.viewerData=qt({},this.containerData),this.renderList(),this.viewed&&this.initImage(function(){n.renderImage(function(){a.transition&&setTimeout(function(){Ce(f,at),Ce(d,at)},0)})}),this)},exit:function(){var n=this,a=this.options,o=this.viewer,f=this.image,d=this.list;return!this.isShown||this.played||!this.fulled||!a.inline?this:(this.fulled=!1,this.close(),He(this.button,jo),a.transition&&(He(d,at),this.viewed&&He(f,at)),a.focus&&this.clearEnforceFocus(),o.removeAttribute("role"),o.removeAttribute("aria-labelledby"),o.removeAttribute("aria-modal"),He(o,Ya),rn(o,{zIndex:a.zIndexInline}),this.viewerData=qt({},this.parentData),this.renderViewer(),this.renderList(),this.viewed&&this.initImage(function(){n.renderImage(function(){a.transition&&setTimeout(function(){Ce(f,at),Ce(d,at)},0)})}),this)},tooltip:function(){var n=this,a=this.options,o=this.tooltipBox,f=this.imageData;return!this.viewed||this.played||!a.tooltip?this:(o.textContent="".concat(Math.round(f.ratio*100),"%"),this.tooltipping?clearTimeout(this.tooltipping):a.transition?(this.fading&&ot(o,nn),Ce(o,pr),Ce(o,Xi),Ce(o,at),o.removeAttribute("aria-hidden"),o.initialOffsetWidth=o.offsetWidth,Ce(o,Vt)):(Ce(o,pr),o.removeAttribute("aria-hidden")),this.tooltipping=setTimeout(function(){a.transition?(Ee(o,nn,function(){He(o,pr),He(o,Xi),He(o,at),o.setAttribute("aria-hidden",!0),n.fading=!1},{once:!0}),He(o,Vt),n.fading=!0):(He(o,pr),o.setAttribute("aria-hidden",!0)),n.tooltipping=!1},1e3),this)},toggle:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return this.imageData.ratio===1?this.zoomTo(this.imageData.oldRatio,!0,null,n):this.zoomTo(1,!0,null,n),this},reset:function(){return this.viewed&&!this.played&&(this.imageData=qt({},this.initialImageData),this.renderImage()),this},update:function(){var n=this,a=this.element,o=this.options,f=this.isImg;if(f&&!a.parentNode)return this.destroy();var d=[];if(Xe(f?[a]:a.querySelectorAll("img"),function(x){Ue(o.filter)?o.filter.call(n,x)&&d.push(x):n.getImageURL(x)&&d.push(x)}),!d.length)return this;if(this.images=d,this.length=d.length,this.ready){var p=[];if(Xe(this.items,function(x,S){var A=x.querySelector("img"),E=d[S];E&&A?(E.src!==A.src||E.alt!==A.alt)&&p.push(S):p.push(S)}),rn(this.list,{width:"auto"}),this.initList(),this.isShown)if(this.length){if(this.viewed){var y=p.indexOf(this.index);if(y>=0)this.viewed=!1,this.view(Math.max(Math.min(this.index-y,this.length-1),0));else{var m=this.items[this.index];Ce(m,Ki),m.setAttribute("aria-selected",!0)}}}else this.image=null,this.viewed=!1,this.index=0,this.imageData={},this.canvas.innerHTML="",this.title.innerHTML=""}else this.build();return this},destroy:function(){var n=this.element,a=this.options;return n[Ne]?(this.destroyed=!0,this.ready?(this.played&&this.stop(),a.inline?(this.fulled&&this.exit(),this.unbind()):this.isShown?(this.viewing&&(this.imageRendering?this.imageRendering.abort():this.imageInitializing&&this.imageInitializing.abort()),this.hiding&&this.transitioning.abort(),this.hidden()):this.showing&&(this.transitioning.abort(),this.hidden()),this.ready=!1,this.viewer.parentNode.removeChild(this.viewer)):a.inline&&(this.delaying?this.delaying.abort():this.initializing&&this.initializing.abort()),a.inline||Ge(n,gr,this.onStart),n[Ne]=void 0,this):this}},Ah={getImageURL:function(n){var a=this.options.url;return ri(a)?a=n.getAttribute(a):Ue(a)?a=a.call(this,n):a="",a},enforceFocus:function(){var n=this;this.clearEnforceFocus(),Ee(document,Go,this.onFocusin=function(a){var o=n.viewer,f=a.target;if(!(f===document||f===o||o.contains(f))){for(;f;){if(f.getAttribute("tabindex")!==null||f.getAttribute("aria-modal")==="true")return;f=f.parentElement}o.focus()}})},clearEnforceFocus:function(){this.onFocusin&&(Ge(document,Go,this.onFocusin),this.onFocusin=null)},open:function(){var n=this.body;Ce(n,qo),this.scrollbarWidth>0&&(n.style.paddingRight="".concat(this.scrollbarWidth+(parseFloat(this.initialBodyComputedPaddingRight)||0),"px"))},close:function(){var n=this.body;He(n,qo),this.scrollbarWidth>0&&(n.style.paddingRight=this.initialBodyPaddingRight)},shown:function(){var n=this.element,a=this.options,o=this.viewer;this.fulled=!0,this.isShown=!0,this.render(),this.bind(),this.showing=!1,a.focus&&(o.focus(),this.enforceFocus()),Ue(a.shown)&&Ee(n,tl,a.shown,{once:!0}),ot(n,tl)!==!1&&this.ready&&this.isShown&&!this.hiding&&this.view(this.index)},hidden:function(){var n=this.element,a=this.options,o=this.viewer;a.fucus&&this.clearEnforceFocus(),this.close(),this.unbind(),Ce(o,Vn),o.removeAttribute("role"),o.removeAttribute("aria-labelledby"),o.removeAttribute("aria-modal"),o.setAttribute("aria-hidden",!0),this.resetList(),this.resetImage(),this.fulled=!1,this.viewed=!1,this.isShown=!1,this.hiding=!1,this.destroyed||(Ue(a.hidden)&&Ee(n,rl,a.hidden,{once:!0}),ot(n,rl,null,{cancelable:!1}))},requestFullscreen:function(n){var a=this.element.ownerDocument;if(this.fulled&&!(a.fullscreenElement||a.webkitFullscreenElement||a.mozFullScreenElement||a.msFullscreenElement)){var o=a.documentElement;o.requestFullscreen?yr(n)?o.requestFullscreen(n):o.requestFullscreen():o.webkitRequestFullscreen?o.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):o.mozRequestFullScreen?o.mozRequestFullScreen():o.msRequestFullscreen&&o.msRequestFullscreen()}},exitFullscreen:function(){var n=this.element.ownerDocument;this.fulled&&(n.fullscreenElement||n.webkitFullscreenElement||n.mozFullScreenElement||n.msFullscreenElement)&&(n.exitFullscreen?n.exitFullscreen():n.webkitExitFullscreen?n.webkitExitFullscreen():n.mozCancelFullScreen?n.mozCancelFullScreen():n.msExitFullscreen&&n.msExitFullscreen())},change:function(n){var a=this.options,o=this.pointers,f=o[Object.keys(o)[0]];if(f){var d=f.endX-f.startX,p=f.endY-f.startY;switch(this.action){case Gi:(d!==0||p!==0)&&(this.pointerMoved=!0,this.move(d,p,n));break;case ei:this.zoom(Ch(o),!1,null,n);break;case Wo:{this.action="switched";var y=Math.abs(d);y>1&&y>Math.abs(p)&&(this.pointers={},d>1?this.prev(a.loop):d<-1&&this.next(a.loop));break}}Xe(o,function(m){m.startX=m.endX,m.startY=m.endY})}},isSwitchable:function(){var n=this.imageData,a=this.viewerData;return this.length>1&&n.x>=0&&n.y>=0&&n.width<=a.width&&n.height<=a.height}},Ih=wn.Viewer,Oh=function(u){return function(){return u+=1,u}}(-1),vl=function(){function u(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(rh(this,u),!n||n.nodeType!==1)throw new Error("The first argument is required and must be an element.");this.element=n,this.options=qt({},Ho,yr(a)&&a),this.action=!1,this.fading=!1,this.fulled=!1,this.hiding=!1,this.imageClicked=!1,this.imageData={},this.index=this.options.initialViewIndex,this.isImg=!1,this.isShown=!1,this.length=0,this.moving=!1,this.played=!1,this.playing=!1,this.pointers={},this.ready=!1,this.rotating=!1,this.scaling=!1,this.showing=!1,this.timeout=!1,this.tooltipping=!1,this.viewed=!1,this.viewing=!1,this.wheeling=!1,this.zooming=!1,this.pointerMoved=!1,this.id=Oh(),this.init()}return ih(u,[{key:"init",value:function(){var a=this,o=this.element,f=this.options;if(!o[Ne]){o[Ne]=this,f.focus&&!f.keyboard&&(f.focus=!1);var d=o.localName==="img",p=[];if(Xe(d?[o]:o.querySelectorAll("img"),function(x){Ue(f.filter)?f.filter.call(a,x)&&p.push(x):a.getImageURL(x)&&p.push(x)}),this.isImg=d,this.length=p.length,this.images=p,this.initBody(),mr(document.createElement(Ne).style.transition)&&(f.transition=!1),f.inline){var y=0,m=function(){if(y+=1,y===a.length){var S;a.initializing=!1,a.delaying={abort:function(){clearTimeout(S)}},S=setTimeout(function(){a.delaying=!1,a.build()},0)}};this.initializing={abort:function(){Xe(p,function(S){S.complete||(Ge(S,Jt,m),Ge(S,Jn,m))})}},Xe(p,function(x){if(x.complete)m();else{var S,A;Ee(x,Jt,S=function(){Ge(x,Jn,A),m()},{once:!0}),Ee(x,Jn,A=function(){Ge(x,Jt,S),m()},{once:!0})}})}else Ee(o,gr,this.onStart=function(x){var S=x.target;S.localName==="img"&&(!Ue(f.filter)||f.filter.call(a,S))&&a.view(a.images.indexOf(S))})}}},{key:"build",value:function(){if(!this.ready){var a=this.element,o=this.options,f=a.parentNode,d=document.createElement("div");d.innerHTML=oh;var p=d.querySelector(".".concat(Ne,"-container")),y=p.querySelector(".".concat(Ne,"-title")),m=p.querySelector(".".concat(Ne,"-toolbar")),x=p.querySelector(".".concat(Ne,"-navbar")),S=p.querySelector(".".concat(Ne,"-button")),A=p.querySelector(".".concat(Ne,"-canvas"));if(this.parent=f,this.viewer=p,this.title=y,this.toolbar=m,this.navbar=x,this.button=S,this.canvas=A,this.footer=p.querySelector(".".concat(Ne,"-footer")),this.tooltipBox=p.querySelector(".".concat(Ne,"-tooltip")),this.player=p.querySelector(".".concat(Ne,"-player")),this.list=p.querySelector(".".concat(Ne,"-list")),p.id="".concat(Ne).concat(this.id),y.id="".concat(Ne,"Title").concat(this.id),Ce(y,o.title?Qi(Array.isArray(o.title)?o.title[0]:o.title):Vn),Ce(x,o.navbar?Qi(o.navbar):Vn),ii(S,Vn,!o.button),o.keyboard&&S.setAttribute("tabindex",0),o.backdrop&&(Ce(p,"".concat(Ne,"-backdrop")),!o.inline&&o.backdrop!=="static"&&Za(A,Yi,"hide")),ri(o.className)&&o.className&&o.className.split(Ja).forEach(function($){Ce(p,$)}),o.toolbar){var E=document.createElement("ul"),H=yr(o.toolbar),B=Vi.slice(0,3),U=Vi.slice(7,9),F=Vi.slice(9);H||Ce(m,Qi(o.toolbar)),Xe(H?o.toolbar:Vi,function($,X){var ne=H&&yr($),ue=H?Qa(X):$,se=ne&&!mr($.show)?$.show:$;if(!(!se||!o.zoomable&&B.indexOf(ue)!==-1||!o.rotatable&&U.indexOf(ue)!==-1||!o.scalable&&F.indexOf(ue)!==-1)){var he=ne&&!mr($.size)?$.size:$,Oe=ne&&!mr($.click)?$.click:$,Re=document.createElement("li");o.keyboard&&Re.setAttribute("tabindex",0),Re.setAttribute("role","button"),Ce(Re,"".concat(Ne,"-").concat(ue)),Ue(Oe)||Za(Re,Yi,ue),Ze(se)&&Ce(Re,Qi(se)),["small","large"].indexOf(he)!==-1?Ce(Re,"".concat(Ne,"-").concat(he)):ue==="play"&&Ce(Re,"".concat(Ne,"-large")),Ue(Oe)&&Ee(Re,gr,Oe),E.appendChild(Re)}}),m.appendChild(E)}else Ce(m,Vn);if(!o.rotatable){var N=m.querySelectorAll('li[class*="rotate"]');Ce(N,ti),Xe(N,function($){m.appendChild($)})}if(o.inline)Ce(S,uh),rn(p,{zIndex:o.zIndexInline}),window.getComputedStyle(f).position==="static"&&rn(f,{position:"relative"}),f.insertBefore(p,a.nextSibling);else{Ce(S,lh),Ce(p,Ya),Ce(p,Xi),Ce(p,Vn),rn(p,{zIndex:o.zIndex});var O=o.container;ri(O)&&(O=a.ownerDocument.querySelector(O)),O||(O=this.body),O.appendChild(p)}if(o.inline&&(this.render(),this.bind(),this.isShown=!0),this.ready=!0,Ue(o.ready)&&Ee(a,Zo,o.ready,{once:!0}),ot(a,Zo)===!1){this.ready=!1;return}this.ready&&o.inline&&this.view(this.index)}}}],[{key:"noConflict",value:function(){return window.Viewer=Ih,u}},{key:"setDefaults",value:function(a){qt(Ho,yr(a)&&a)}}])}();qt(vl.prototype,_h,Lh,Eh,Dh,Ah);var Nh=typeof global=="object"&&global&&global.Object===Object&&global,yl=Nh,Mh=typeof self=="object"&&self&&self.Object===Object&&self,Rh=yl||Mh||Function("return this")(),ts=Rh,Fh=ts.Symbol,ea=Fh,bl=Object.prototype,Ph=bl.hasOwnProperty,zh=bl.toString,ai=ea?ea.toStringTag:void 0;function $h(u){var n=Ph.call(u,ai),a=u[ai];try{u[ai]=void 0;var o=!0}catch{}var f=zh.call(u);return o&&(n?u[ai]=a:delete u[ai]),f}var Bh=Object.prototype,Hh=Bh.toString;function Wh(u){return Hh.call(u)}var jh="[object Null]",qh="[object Undefined]",xl=ea?ea.toStringTag:void 0;function ns(u){return u==null?u===void 0?qh:jh:xl&&xl in Object(u)?$h(u):Wh(u)}function rs(u){return u!=null&&typeof u=="object"}var Uh=Array.isArray,Gh=Uh;function is(u){var n=typeof u;return u!=null&&(n=="object"||n=="function")}function wl(u){return u}var Kh="[object AsyncFunction]",Xh="[object Function]",Yh="[object GeneratorFunction]",Vh="[object Proxy]";function kl(u){if(!is(u))return!1;var n=ns(u);return n==Xh||n==Yh||n==Kh||n==Vh}var Jh=ts["__core-js_shared__"],as=Jh,Sl=function(){var u=/[^.]+$/.exec(as&&as.keys&&as.keys.IE_PROTO||"");return u?"Symbol(src)_1."+u:""}();function Qh(u){return!!Sl&&Sl in u}var Zh=Function.prototype,ed=Zh.toString;function td(u){if(u!=null){try{return ed.call(u)}catch{}try{return u+""}catch{}}return""}var nd=/[\\^$.*+?()[\]{}|]/g,rd=/^\[object .+?Constructor\]$/,id=Function.prototype,ad=Object.prototype,sd=id.toString,od=ad.hasOwnProperty,ld=RegExp("^"+sd.call(od).replace(nd,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ud(u){if(!is(u)||Qh(u))return!1;var n=kl(u)?ld:rd;return n.test(td(u))}function fd(u,n){return u==null?void 0:u[n]}function cd(u,n){var a=fd(u,n);return ud(a)?a:void 0}function hd(u,n,a){switch(a.length){case 0:return u.call(n);case 1:return u.call(n,a[0]);case 2:return u.call(n,a[0],a[1]);case 3:return u.call(n,a[0],a[1],a[2])}return u.apply(n,a)}var dd=800,pd=16,gd=Date.now;function md(u){var n=0,a=0;return function(){var o=gd(),f=pd-(o-a);if(a=o,f>0){if(++n>=dd)return arguments[0]}else n=0;return u.apply(void 0,arguments)}}function vd(u){return function(){return u}}var yd=function(){try{var u=cd(Object,"defineProperty");return u({},"",{}),u}catch{}}(),ta=yd,bd=ta?function(u,n){return ta(u,"toString",{configurable:!0,enumerable:!1,value:vd(n),writable:!0})}:wl,xd=bd,wd=md(xd),kd=wd,Sd=9007199254740991,Cd=/^(?:0|[1-9]\d*)$/;function Cl(u,n){var a=typeof u;return n=n??Sd,!!n&&(a=="number"||a!="symbol"&&Cd.test(u))&&u>-1&&u%1==0&&u<n}function Tl(u,n,a){n=="__proto__"&&ta?ta(u,n,{configurable:!0,enumerable:!0,value:a,writable:!0}):u[n]=a}function _l(u,n){return u===n||u!==u&&n!==n}var Td=Object.prototype,_d=Td.hasOwnProperty;function Ll(u,n,a){var o=u[n];(!(_d.call(u,n)&&_l(o,a))||a===void 0&&!(n in u))&&Tl(u,n,a)}function Ld(u,n,a,o){var f=!a;a||(a={});for(var d=-1,p=n.length;++d<p;){var y=n[d],m=void 0;m===void 0&&(m=u[y]),f?Tl(a,y,m):Ll(a,y,m)}return a}var El=Math.max;function Ed(u,n,a){return n=El(n===void 0?u.length-1:n,0),function(){for(var o=arguments,f=-1,d=El(o.length-n,0),p=Array(d);++f<d;)p[f]=o[n+f];f=-1;for(var y=Array(n+1);++f<n;)y[f]=o[f];return y[n]=a(p),hd(u,this,y)}}function Dd(u,n){return kd(Ed(u,n,wl),u+"")}var Ad=9007199254740991;function Dl(u){return typeof u=="number"&&u>-1&&u%1==0&&u<=Ad}function ss(u){return u!=null&&Dl(u.length)&&!kl(u)}function Id(u,n,a){if(!is(a))return!1;var o=typeof n;return(o=="number"?ss(a)&&Cl(n,a.length):o=="string"&&n in a)?_l(a[n],u):!1}function Od(u){return Dd(function(n,a){var o=-1,f=a.length,d=f>1?a[f-1]:void 0,p=f>2?a[2]:void 0;for(d=u.length>3&&typeof d=="function"?(f--,d):void 0,p&&Id(a[0],a[1],p)&&(d=f<3?void 0:d,f=1),n=Object(n);++o<f;){var y=a[o];y&&u(n,y,o,d)}return n})}var Nd=Object.prototype;function Al(u){var n=u&&u.constructor,a=typeof n=="function"&&n.prototype||Nd;return u===a}function Md(u,n){for(var a=-1,o=Array(u);++a<u;)o[a]=n(a);return o}var Rd="[object Arguments]";function Il(u){return rs(u)&&ns(u)==Rd}var Ol=Object.prototype,Fd=Ol.hasOwnProperty,Pd=Ol.propertyIsEnumerable,zd=Il(function(){return arguments}())?Il:function(u){return rs(u)&&Fd.call(u,"callee")&&!Pd.call(u,"callee")},$d=zd;function Bd(){return!1}var Nl=typeof Ie=="object"&&Ie&&!Ie.nodeType&&Ie,Ml=Nl&&typeof module=="object"&&module&&!module.nodeType&&module,Hd=Ml&&Ml.exports===Nl,Rl=Hd?ts.Buffer:void 0,Wd=Rl?Rl.isBuffer:void 0,jd=Wd||Bd,qd=jd,Ud="[object Arguments]",Gd="[object Array]",Kd="[object Boolean]",Xd="[object Date]",Yd="[object Error]",Vd="[object Function]",Jd="[object Map]",Qd="[object Number]",Zd="[object Object]",ep="[object RegExp]",tp="[object Set]",np="[object String]",rp="[object WeakMap]",ip="[object ArrayBuffer]",ap="[object DataView]",sp="[object Float32Array]",op="[object Float64Array]",lp="[object Int8Array]",up="[object Int16Array]",fp="[object Int32Array]",cp="[object Uint8Array]",hp="[object Uint8ClampedArray]",dp="[object Uint16Array]",pp="[object Uint32Array]",Ye={};Ye[sp]=Ye[op]=Ye[lp]=Ye[up]=Ye[fp]=Ye[cp]=Ye[hp]=Ye[dp]=Ye[pp]=!0,Ye[Ud]=Ye[Gd]=Ye[ip]=Ye[Kd]=Ye[ap]=Ye[Xd]=Ye[Yd]=Ye[Vd]=Ye[Jd]=Ye[Qd]=Ye[Zd]=Ye[ep]=Ye[tp]=Ye[np]=Ye[rp]=!1;function gp(u){return rs(u)&&Dl(u.length)&&!!Ye[ns(u)]}function mp(u){return function(n){return u(n)}}var Fl=typeof Ie=="object"&&Ie&&!Ie.nodeType&&Ie,si=Fl&&typeof module=="object"&&module&&!module.nodeType&&module,vp=si&&si.exports===Fl,os=vp&&yl.process,yp=function(){try{var u=si&&si.require&&si.require("util").types;return u||os&&os.binding&&os.binding("util")}catch{}}(),Pl=yp,zl=Pl&&Pl.isTypedArray,bp=zl?mp(zl):gp,xp=bp,wp=Object.prototype,kp=wp.hasOwnProperty;function Sp(u,n){var a=Gh(u),o=!a&&$d(u),f=!a&&!o&&qd(u),d=!a&&!o&&!f&&xp(u),p=a||o||f||d,y=p?Md(u.length,String):[],m=y.length;for(var x in u)kp.call(u,x)&&!(p&&(x=="length"||f&&(x=="offset"||x=="parent")||d&&(x=="buffer"||x=="byteLength"||x=="byteOffset")||Cl(x,m)))&&y.push(x);return y}function Cp(u,n){return function(a){return u(n(a))}}var Tp=Cp(Object.keys,Object),_p=Tp,Lp=Object.prototype,Ep=Lp.hasOwnProperty;function Dp(u){if(!Al(u))return _p(u);var n=[];for(var a in Object(u))Ep.call(u,a)&&a!="constructor"&&n.push(a);return n}function Ap(u){return ss(u)?Sp(u):Dp(u)}var Ip=Object.prototype,Op=Ip.hasOwnProperty,Np=Od(function(u,n){if(Al(n)||ss(n)){Ld(n,Ap(n),u);return}for(var a in n)Op.call(n,a)&&Ll(u,a,n[a])}),Mp=Np;const $l=({images:u=[],options:n={}}={})=>{n=Mp(n,{inline:!1});const a=Jf.extend({render(p){return p("div",{style:{display:"none"},class:["__viewer-token"]},u.map(y=>p("img",{attrs:typeof y=="string"?{src:y}:y})))}}),o=new a;o.$mount(),document.body.appendChild(o.$el);const f=new vl(o.$el,n),d=f.destroy.bind(f);return f.destroy=function(){return d(),o.$destroy(),document.body.removeChild(o.$el),f},f.show(),o.$el.addEventListener("hidden",function(){this.viewer===f&&f.destroy()}),f};var Bl={exports:{}},Hl;function Rp(){return Hl||(Hl=1,function(u,n){(function(a){a(Wt())})(function(a){var o={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},f={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};a.defineMode("xml",function(d,p){var y=d.indentUnit,m={},x=p.htmlMode?o:f;for(var S in x)m[S]=x[S];for(var S in p)m[S]=p[S];var A,E;function H(k,J){function G(K){return J.tokenize=K,K(k,J)}var D=k.next();if(D=="<")return k.eat("!")?k.eat("[")?k.match("CDATA[")?G(F("atom","]]>")):null:k.match("--")?G(F("comment","-->")):k.match("DOCTYPE",!0,!0)?(k.eatWhile(/[\w\._\-]/),G(N(1))):null:k.eat("?")?(k.eatWhile(/[\w\._\-]/),J.tokenize=F("meta","?>"),"meta"):(A=k.eat("/")?"closeTag":"openTag",J.tokenize=B,"tag bracket");if(D=="&"){var R;return k.eat("#")?k.eat("x")?R=k.eatWhile(/[a-fA-F\d]/)&&k.eat(";"):R=k.eatWhile(/[\d]/)&&k.eat(";"):R=k.eatWhile(/[\w\.\-:]/)&&k.eat(";"),R?"atom":"error"}else return k.eatWhile(/[^&<]/),null}H.isInText=!0;function B(k,J){var G=k.next();if(G==">"||G=="/"&&k.eat(">"))return J.tokenize=H,A=G==">"?"endTag":"selfcloseTag","tag bracket";if(G=="=")return A="equals",null;if(G=="<"){J.tokenize=H,J.state=ue,J.tagName=J.tagStart=null;var D=J.tokenize(k,J);return D?D+" tag error":"tag error"}else return/[\'\"]/.test(G)?(J.tokenize=U(G),J.stringStartCol=k.column(),J.tokenize(k,J)):(k.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function U(k){var J=function(G,D){for(;!G.eol();)if(G.next()==k){D.tokenize=B;break}return"string"};return J.isInAttribute=!0,J}function F(k,J){return function(G,D){for(;!G.eol();){if(G.match(J)){D.tokenize=H;break}G.next()}return k}}function N(k){return function(J,G){for(var D;(D=J.next())!=null;){if(D=="<")return G.tokenize=N(k+1),G.tokenize(J,G);if(D==">")if(k==1){G.tokenize=H;break}else return G.tokenize=N(k-1),G.tokenize(J,G)}return"meta"}}function O(k){return k&&k.toLowerCase()}function $(k,J,G){this.prev=k.context,this.tagName=J||"",this.indent=k.indented,this.startOfLine=G,(m.doNotIndent.hasOwnProperty(J)||k.context&&k.context.noIndent)&&(this.noIndent=!0)}function X(k){k.context&&(k.context=k.context.prev)}function ne(k,J){for(var G;;){if(!k.context||(G=k.context.tagName,!m.contextGrabbers.hasOwnProperty(O(G))||!m.contextGrabbers[O(G)].hasOwnProperty(O(J))))return;X(k)}}function ue(k,J,G){return k=="openTag"?(G.tagStart=J.column(),se):k=="closeTag"?he:ue}function se(k,J,G){return k=="word"?(G.tagName=J.current(),E="tag",ie):m.allowMissingTagName&&k=="endTag"?(E="tag bracket",ie(k,J,G)):(E="error",se)}function he(k,J,G){if(k=="word"){var D=J.current();return G.context&&G.context.tagName!=D&&m.implicitlyClosed.hasOwnProperty(O(G.context.tagName))&&X(G),G.context&&G.context.tagName==D||m.matchClosing===!1?(E="tag",Oe):(E="tag error",Re)}else return m.allowMissingTagName&&k=="endTag"?(E="tag bracket",Oe(k,J,G)):(E="error",Re)}function Oe(k,J,G){return k!="endTag"?(E="error",Oe):(X(G),ue)}function Re(k,J,G){return E="error",Oe(k,J,G)}function ie(k,J,G){if(k=="word")return E="attribute",ze;if(k=="endTag"||k=="selfcloseTag"){var D=G.tagName,R=G.tagStart;return G.tagName=G.tagStart=null,k=="selfcloseTag"||m.autoSelfClosers.hasOwnProperty(O(D))?ne(G,D):(ne(G,D),G.context=new $(G,D,R==G.indented)),ue}return E="error",ie}function ze(k,J,G){return k=="equals"?W:(m.allowMissing||(E="error"),ie(k,J,G))}function W(k,J,G){return k=="string"?Q:k=="word"&&m.allowUnquoted?(E="string",ie):(E="error",ie(k,J,G))}function Q(k,J,G){return k=="string"?Q:ie(k,J,G)}return{startState:function(k){var J={tokenize:H,state:ue,indented:k||0,tagName:null,tagStart:null,context:null};return k!=null&&(J.baseIndent=k),J},token:function(k,J){if(!J.tagName&&k.sol()&&(J.indented=k.indentation()),k.eatSpace())return null;A=null;var G=J.tokenize(k,J);return(G||A)&&G!="comment"&&(E=null,J.state=J.state(A||G,k,J),E&&(G=E=="error"?G+" error":E)),G},indent:function(k,J,G){var D=k.context;if(k.tokenize.isInAttribute)return k.tagStart==k.indented?k.stringStartCol+1:k.indented+y;if(D&&D.noIndent)return a.Pass;if(k.tokenize!=B&&k.tokenize!=H)return G?G.match(/^(\s*)/)[0].length:0;if(k.tagName)return m.multilineTagIndentPastTag!==!1?k.tagStart+k.tagName.length+2:k.tagStart+y*(m.multilineTagIndentFactor||1);if(m.alignCDATA&&/<!\[CDATA\[/.test(J))return 0;var R=J&&/^<(\/)?([\w_:\.-]*)/.exec(J);if(R&&R[1])for(;D;)if(D.tagName==R[2]){D=D.prev;break}else if(m.implicitlyClosed.hasOwnProperty(O(D.tagName)))D=D.prev;else break;else if(R)for(;D;){var K=m.contextGrabbers[O(D.tagName)];if(K&&K.hasOwnProperty(O(R[2])))D=D.prev;else break}for(;D&&D.prev&&!D.startOfLine;)D=D.prev;return D?D.indent+y:k.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:m.htmlMode?"html":"xml",helperType:m.htmlMode?"html":"xml",skipAttribute:function(k){k.state==W&&(k.state=ie)},xmlCurrentTag:function(k){return k.tagName?{name:k.tagName,close:k.type=="closeTag"}:null},xmlCurrentContext:function(k){for(var J=[],G=k.context;G;G=G.prev)J.push(G.tagName);return J.reverse()}}}),a.defineMIME("text/xml","xml"),a.defineMIME("application/xml","xml"),a.mimeModes.hasOwnProperty("text/html")||a.defineMIME("text/html",{name:"xml",htmlMode:!0})})}()),Bl.exports}var Wl={exports:{}},jl;function Fp(){return jl||(jl=1,function(u,n){(function(a){a(Wt())})(function(a){a.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy","cbl"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded JavaScript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"],alias:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var o=0;o<a.modeInfo.length;o++){var f=a.modeInfo[o];f.mimes&&(f.mime=f.mimes[0])}a.findModeByMIME=function(d){d=d.toLowerCase();for(var p=0;p<a.modeInfo.length;p++){var y=a.modeInfo[p];if(y.mime==d)return y;if(y.mimes){for(var m=0;m<y.mimes.length;m++)if(y.mimes[m]==d)return y}}if(/\+xml$/.test(d))return a.findModeByMIME("application/xml");if(/\+json$/.test(d))return a.findModeByMIME("application/json")},a.findModeByExtension=function(d){d=d.toLowerCase();for(var p=0;p<a.modeInfo.length;p++){var y=a.modeInfo[p];if(y.ext){for(var m=0;m<y.ext.length;m++)if(y.ext[m]==d)return y}}},a.findModeByFileName=function(d){for(var p=0;p<a.modeInfo.length;p++){var y=a.modeInfo[p];if(y.file&&y.file.test(d))return y}var m=d.lastIndexOf("."),x=m>-1&&d.substring(m+1,d.length);if(x)return a.findModeByExtension(x)},a.findModeByName=function(d){d=d.toLowerCase();for(var p=0;p<a.modeInfo.length;p++){var y=a.modeInfo[p];if(y.name.toLowerCase()==d)return y;if(y.alias){for(var m=0;m<y.alias.length;m++)if(y.alias[m].toLowerCase()==d)return y}}}})}()),Wl.exports}(function(u,n){(function(a){a(Wt(),Rp(),Fp())})(function(a){a.defineMode("markdown",function(o,f){var d=a.getMode(o,"text/html"),p=d.name=="null";function y(L){if(a.findModeByName){var w=a.findModeByName(L);w&&(L=w.mime||w.mimes[0])}var oe=a.getMode(o,L);return oe.name=="null"?null:oe}f.highlightFormatting===void 0&&(f.highlightFormatting=!1),f.maxBlockquoteDepth===void 0&&(f.maxBlockquoteDepth=0),f.taskLists===void 0&&(f.taskLists=!1),f.strikethrough===void 0&&(f.strikethrough=!1),f.emoji===void 0&&(f.emoji=!1),f.fencedCodeBlockHighlighting===void 0&&(f.fencedCodeBlockHighlighting=!0),f.fencedCodeBlockDefaultMode===void 0&&(f.fencedCodeBlockDefaultMode="text/plain"),f.xml===void 0&&(f.xml=!0),f.tokenTypeOverrides===void 0&&(f.tokenTypeOverrides={});var m={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var x in m)m.hasOwnProperty(x)&&f.tokenTypeOverrides[x]&&(m[x]=f.tokenTypeOverrides[x]);var S=/^([*\-_])(?:\s*\1){2,}\s*$/,A=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,E=/^\[(x| )\](?=\s)/i,H=f.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,B=/^ {0,3}(?:\={1,}|-{2,})\s*$/,U=/^[^#!\[\]*_\\<>` "'(~:]+/,F=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,N=/^\s*\[[^\]]+?\]:.*$/,O=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,$=" ";function X(L,w,oe){return w.f=w.inline=oe,oe(L,w)}function ne(L,w,oe){return w.f=w.block=oe,oe(L,w)}function ue(L){return!L||!/\S/.test(L.string)}function se(L){if(L.linkTitle=!1,L.linkHref=!1,L.linkText=!1,L.em=!1,L.strong=!1,L.strikethrough=!1,L.quote=0,L.indentedCode=!1,L.f==Oe){var w=p;if(!w){var oe=a.innerMode(d,L.htmlState);w=oe.mode.name=="xml"&&oe.state.tagStart===null&&!oe.state.context&&oe.state.tokenize.isInText}w&&(L.f=W,L.block=he,L.htmlState=null)}return L.trailingSpace=0,L.trailingSpaceNewLine=!1,L.prevLine=L.thisLine,L.thisLine={stream:null},null}function he(L,w){var oe=L.column()===w.indentation,Te=ue(w.prevLine.stream),Z=w.indentedCode,ce=w.prevLine.hr,ke=w.list!==!1,_e=(w.listStack[w.listStack.length-1]||0)+3;w.indentedCode=!1;var ft=w.indentation;if(w.indentationDiff===null&&(w.indentationDiff=w.indentation,ke)){for(w.list=null;ft<w.listStack[w.listStack.length-1];)w.listStack.pop(),w.listStack.length?w.indentation=w.listStack[w.listStack.length-1]:w.list=!1;w.list!==!1&&(w.indentationDiff=ft-w.listStack[w.listStack.length-1])}var we=!Te&&!ce&&!w.prevLine.header&&(!ke||!Z)&&!w.prevLine.fencedCodeEnd,Me=(w.list===!1||ce||Te)&&w.indentation<=_e&&L.match(S),Ke=null;if(w.indentationDiff>=4&&(Z||w.prevLine.fencedCodeEnd||w.prevLine.header||Te))return L.skipToEnd(),w.indentedCode=!0,m.code;if(L.eatSpace())return null;if(oe&&w.indentation<=_e&&(Ke=L.match(H))&&Ke[1].length<=6)return w.quote=0,w.header=Ke[1].length,w.thisLine.header=!0,f.highlightFormatting&&(w.formatting="header"),w.f=w.inline,ie(w);if(w.indentation<=_e&&L.eat(">"))return w.quote=oe?1:w.quote+1,f.highlightFormatting&&(w.formatting="quote"),L.eatSpace(),ie(w);if(!Me&&!w.setext&&oe&&w.indentation<=_e&&(Ke=L.match(A))){var ct=Ke[1]?"ol":"ul";return w.indentation=ft+L.current().length,w.list=!0,w.quote=0,w.listStack.push(w.indentation),w.em=!1,w.strong=!1,w.code=!1,w.strikethrough=!1,f.taskLists&&L.match(E,!1)&&(w.taskList=!0),w.f=w.inline,f.highlightFormatting&&(w.formatting=["list","list-"+ct]),ie(w)}else{if(oe&&w.indentation<=_e&&(Ke=L.match(F,!0)))return w.quote=0,w.fencedEndRE=new RegExp(Ke[1]+"+ *$"),w.localMode=f.fencedCodeBlockHighlighting&&y(Ke[2]||f.fencedCodeBlockDefaultMode),w.localMode&&(w.localState=a.startState(w.localMode)),w.f=w.block=Re,f.highlightFormatting&&(w.formatting="code-block"),w.code=-1,ie(w);if(w.setext||(!we||!ke)&&!w.quote&&w.list===!1&&!w.code&&!Me&&!N.test(L.string)&&(Ke=L.lookAhead(1))&&(Ke=Ke.match(B)))return w.setext?(w.header=w.setext,w.setext=0,L.skipToEnd(),f.highlightFormatting&&(w.formatting="header")):(w.header=Ke[0].charAt(0)=="="?1:2,w.setext=w.header),w.thisLine.header=!0,w.f=w.inline,ie(w);if(Me)return L.skipToEnd(),w.hr=!0,w.thisLine.hr=!0,m.hr;if(L.peek()==="[")return X(L,w,D)}return X(L,w,w.inline)}function Oe(L,w){var oe=d.token(L,w.htmlState);if(!p){var Te=a.innerMode(d,w.htmlState);(Te.mode.name=="xml"&&Te.state.tagStart===null&&!Te.state.context&&Te.state.tokenize.isInText||w.md_inside&&L.current().indexOf(">")>-1)&&(w.f=W,w.block=he,w.htmlState=null)}return oe}function Re(L,w){var oe=w.listStack[w.listStack.length-1]||0,Te=w.indentation<oe,Z=oe+3;if(w.fencedEndRE&&w.indentation<=Z&&(Te||L.match(w.fencedEndRE))){f.highlightFormatting&&(w.formatting="code-block");var ce;return Te||(ce=ie(w)),w.localMode=w.localState=null,w.block=he,w.f=W,w.fencedEndRE=null,w.code=0,w.thisLine.fencedCodeEnd=!0,Te?ne(L,w,w.block):ce}else return w.localMode?w.localMode.token(L,w.localState):(L.skipToEnd(),m.code)}function ie(L){var w=[];if(L.formatting){w.push(m.formatting),typeof L.formatting=="string"&&(L.formatting=[L.formatting]);for(var oe=0;oe<L.formatting.length;oe++)w.push(m.formatting+"-"+L.formatting[oe]),L.formatting[oe]==="header"&&w.push(m.formatting+"-"+L.formatting[oe]+"-"+L.header),L.formatting[oe]==="quote"&&(!f.maxBlockquoteDepth||f.maxBlockquoteDepth>=L.quote?w.push(m.formatting+"-"+L.formatting[oe]+"-"+L.quote):w.push("error"))}if(L.taskOpen)return w.push("meta"),w.length?w.join(" "):null;if(L.taskClosed)return w.push("property"),w.length?w.join(" "):null;if(L.linkHref?w.push(m.linkHref,"url"):(L.strong&&w.push(m.strong),L.em&&w.push(m.em),L.strikethrough&&w.push(m.strikethrough),L.emoji&&w.push(m.emoji),L.linkText&&w.push(m.linkText),L.code&&w.push(m.code),L.image&&w.push(m.image),L.imageAltText&&w.push(m.imageAltText,"link"),L.imageMarker&&w.push(m.imageMarker)),L.header&&w.push(m.header,m.header+"-"+L.header),L.quote&&(w.push(m.quote),!f.maxBlockquoteDepth||f.maxBlockquoteDepth>=L.quote?w.push(m.quote+"-"+L.quote):w.push(m.quote+"-"+f.maxBlockquoteDepth)),L.list!==!1){var Te=(L.listStack.length-1)%3;Te?Te===1?w.push(m.list2):w.push(m.list3):w.push(m.list1)}return L.trailingSpaceNewLine?w.push("trailing-space-new-line"):L.trailingSpace&&w.push("trailing-space-"+(L.trailingSpace%2?"a":"b")),w.length?w.join(" "):null}function ze(L,w){if(L.match(U,!0))return ie(w)}function W(L,w){var oe=w.text(L,w);if(typeof oe<"u")return oe;if(w.list)return w.list=null,ie(w);if(w.taskList){var Te=L.match(E,!0)[1]===" ";return Te?w.taskOpen=!0:w.taskClosed=!0,f.highlightFormatting&&(w.formatting="task"),w.taskList=!1,ie(w)}if(w.taskOpen=!1,w.taskClosed=!1,w.header&&L.match(/^#+$/,!0))return f.highlightFormatting&&(w.formatting="header"),ie(w);var Z=L.next();if(w.linkTitle){w.linkTitle=!1;var ce=Z;Z==="("&&(ce=")"),ce=(ce+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var ke="^\\s*(?:[^"+ce+"\\\\]+|\\\\\\\\|\\\\.)"+ce;if(L.match(new RegExp(ke),!0))return m.linkHref}if(Z==="`"){var _e=w.formatting;f.highlightFormatting&&(w.formatting="code"),L.eatWhile("`");var ft=L.current().length;if(w.code==0&&(!w.quote||ft==1))return w.code=ft,ie(w);if(ft==w.code){var we=ie(w);return w.code=0,we}else return w.formatting=_e,ie(w)}else if(w.code)return ie(w);if(Z==="\\"&&(L.next(),f.highlightFormatting)){var Me=ie(w),Ke=m.formatting+"-escape";return Me?Me+" "+Ke:Ke}if(Z==="!"&&L.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return w.imageMarker=!0,w.image=!0,f.highlightFormatting&&(w.formatting="image"),ie(w);if(Z==="["&&w.imageMarker&&L.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return w.imageMarker=!1,w.imageAltText=!0,f.highlightFormatting&&(w.formatting="image"),ie(w);if(Z==="]"&&w.imageAltText){f.highlightFormatting&&(w.formatting="image");var Me=ie(w);return w.imageAltText=!1,w.image=!1,w.inline=w.f=k,Me}if(Z==="["&&!w.image)return w.linkText&&L.match(/^.*?\]/)||(w.linkText=!0,f.highlightFormatting&&(w.formatting="link")),ie(w);if(Z==="]"&&w.linkText){f.highlightFormatting&&(w.formatting="link");var Me=ie(w);return w.linkText=!1,w.inline=w.f=L.match(/\(.*?\)| ?\[.*?\]/,!1)?k:W,Me}if(Z==="<"&&L.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){w.f=w.inline=Q,f.highlightFormatting&&(w.formatting="link");var Me=ie(w);return Me?Me+=" ":Me="",Me+m.linkInline}if(Z==="<"&&L.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){w.f=w.inline=Q,f.highlightFormatting&&(w.formatting="link");var Me=ie(w);return Me?Me+=" ":Me="",Me+m.linkEmail}if(f.xml&&Z==="<"&&L.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var ct=L.string.indexOf(">",L.pos);if(ct!=-1){var Pt=L.string.substring(L.start,ct);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Pt)&&(w.md_inside=!0)}return L.backUp(1),w.htmlState=a.startState(d),ne(L,w,Oe)}if(f.xml&&Z==="<"&&L.match(/^\/\w*?>/))return w.md_inside=!1,"tag";if(Z==="*"||Z==="_"){for(var ht=1,dt=L.pos==1?" ":L.string.charAt(L.pos-2);ht<3&&L.eat(Z);)ht++;var gt=L.peek()||" ",Ut=!/\s/.test(gt)&&(!O.test(gt)||/\s/.test(dt)||O.test(dt)),be=!/\s/.test(dt)&&(!O.test(dt)||/\s/.test(gt)||O.test(gt)),kt=null,Gt=null;if(ht%2&&(!w.em&&Ut&&(Z==="*"||!be||O.test(dt))?kt=!0:w.em==Z&&be&&(Z==="*"||!Ut||O.test(gt))&&(kt=!1)),ht>1&&(!w.strong&&Ut&&(Z==="*"||!be||O.test(dt))?Gt=!0:w.strong==Z&&be&&(Z==="*"||!Ut||O.test(gt))&&(Gt=!1)),Gt!=null||kt!=null){f.highlightFormatting&&(w.formatting=kt==null?"strong":Gt==null?"em":"strong em"),kt===!0&&(w.em=Z),Gt===!0&&(w.strong=Z);var we=ie(w);return kt===!1&&(w.em=!1),Gt===!1&&(w.strong=!1),we}}else if(Z===" "&&(L.eat("*")||L.eat("_"))){if(L.peek()===" ")return ie(w);L.backUp(1)}if(f.strikethrough){if(Z==="~"&&L.eatWhile(Z)){if(w.strikethrough){f.highlightFormatting&&(w.formatting="strikethrough");var we=ie(w);return w.strikethrough=!1,we}else if(L.match(/^[^\s]/,!1))return w.strikethrough=!0,f.highlightFormatting&&(w.formatting="strikethrough"),ie(w)}else if(Z===" "&&L.match("~~",!0)){if(L.peek()===" ")return ie(w);L.backUp(2)}}if(f.emoji&&Z===":"&&L.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){w.emoji=!0,f.highlightFormatting&&(w.formatting="emoji");var In=ie(w);return w.emoji=!1,In}return Z===" "&&(L.match(/^ +$/,!1)?w.trailingSpace++:w.trailingSpace&&(w.trailingSpaceNewLine=!0)),ie(w)}function Q(L,w){var oe=L.next();if(oe===">"){w.f=w.inline=W,f.highlightFormatting&&(w.formatting="link");var Te=ie(w);return Te?Te+=" ":Te="",Te+m.linkInline}return L.match(/^[^>]+/,!0),m.linkInline}function k(L,w){if(L.eatSpace())return null;var oe=L.next();return oe==="("||oe==="["?(w.f=w.inline=G(oe==="("?")":"]"),f.highlightFormatting&&(w.formatting="link-string"),w.linkHref=!0,ie(w)):"error"}var J={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function G(L){return function(w,oe){var Te=w.next();if(Te===L){oe.f=oe.inline=W,f.highlightFormatting&&(oe.formatting="link-string");var Z=ie(oe);return oe.linkHref=!1,Z}return w.match(J[L]),oe.linkHref=!0,ie(oe)}}function D(L,w){return L.match(/^([^\]\\]|\\.)*\]:/,!1)?(w.f=R,L.next(),f.highlightFormatting&&(w.formatting="link"),w.linkText=!0,ie(w)):X(L,w,W)}function R(L,w){if(L.match("]:",!0)){w.f=w.inline=K,f.highlightFormatting&&(w.formatting="link");var oe=ie(w);return w.linkText=!1,oe}return L.match(/^([^\]\\]|\\.)+/,!0),m.linkText}function K(L,w){return L.eatSpace()?null:(L.match(/^[^\s]+/,!0),L.peek()===void 0?w.linkTitle=!0:L.match(/^(?:\s+(?:"(?:[^"\\]|\\.)+"|'(?:[^'\\]|\\.)+'|\((?:[^)\\]|\\.)+\)))?/,!0),w.f=w.inline=W,m.linkHref+" url")}var de={startState:function(){return{f:he,prevLine:{stream:null},thisLine:{stream:null},block:he,htmlState:null,indentation:0,inline:W,text:ze,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(L){return{f:L.f,prevLine:L.prevLine,thisLine:L.thisLine,block:L.block,htmlState:L.htmlState&&a.copyState(d,L.htmlState),indentation:L.indentation,localMode:L.localMode,localState:L.localMode?a.copyState(L.localMode,L.localState):null,inline:L.inline,text:L.text,formatting:!1,linkText:L.linkText,linkTitle:L.linkTitle,linkHref:L.linkHref,code:L.code,em:L.em,strong:L.strong,strikethrough:L.strikethrough,emoji:L.emoji,header:L.header,setext:L.setext,hr:L.hr,taskList:L.taskList,list:L.list,listStack:L.listStack.slice(0),quote:L.quote,indentedCode:L.indentedCode,trailingSpace:L.trailingSpace,trailingSpaceNewLine:L.trailingSpaceNewLine,md_inside:L.md_inside,fencedEndRE:L.fencedEndRE}},token:function(L,w){if(w.formatting=!1,L!=w.thisLine.stream){if(w.header=0,w.hr=!1,L.match(/^\s*$/,!0))return se(w),null;if(w.prevLine=w.thisLine,w.thisLine={stream:L},w.taskList=!1,w.trailingSpace=0,w.trailingSpaceNewLine=!1,!w.localState&&(w.f=w.block,w.f!=Oe)){var oe=L.match(/^\s*/,!0)[0].replace(/\t/g,$).length;if(w.indentation=oe,w.indentationDiff=null,oe>0)return null}}return w.f(L,w)},innerMode:function(L){return L.block==Oe?{state:L.htmlState,mode:d}:L.localState?{state:L.localState,mode:L.localMode}:{state:L,mode:de}},indent:function(L,w,oe){return L.block==Oe&&d.indent?d.indent(L.htmlState,w,oe):L.localState&&L.localMode.indent?L.localMode.indent(L.localState,w,oe):a.Pass},blankLine:se,getType:ie,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return de},"xml"),a.defineMIME("text/markdown","markdown"),a.defineMIME("text/x-markdown","markdown")})})();const Pp={name:"DebugTab",components:{codemirror:go.codemirror},props:{selectedSpan:{type:Object,required:!0},selectedSpanId:{type:String,required:!0}},data(){return{debugForm:{params:[],systemContent:"",userContent:""},debugSubmitting:!1,debugResponse:null,showDebugRawResponse:!1,debugResponseKey:0,debugMarkdownKey:0,originalInputs:null,hasImageUrl:!1,submitImage:!0,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,autoRefresh:!0},cmOptionsMarkdown:{tabSize:2,mode:"markdown",theme:"monokai",lineNumbers:!0,lineWrapping:!0,readOnly:!1,foldGutter:!0,gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],matchBrackets:!0,autoCloseBrackets:!0,indentUnit:2,styleActiveLine:!0,autoRefresh:!0},viewerOptions:{inline:!1,button:!0,navbar:!0,title:!0,toolbar:!0,tooltip:!0,movable:!0,zoomable:!0,rotatable:!0,scalable:!0,transition:!0,fullscreen:!0,keyboard:!0,zIndex:9999}}},computed:{rawInputs(){var u,n,a;return(a=(n=(u=this.selectedSpan)==null?void 0:u.parsedContent)==null?void 0:n.attributes)==null?void 0:a["langsword.spanInputs"]},targetUrl(){var n,a;const u=(a=(n=this.selectedSpan)==null?void 0:n.parsedContent)==null?void 0:a.attributes;return u&&u["url.full"]?u["url.full"]:null}},watch:{selectedSpanId:{immediate:!0,handler(u,n){u&&u!==n&&this.$nextTick(()=>{this.initDebugForm()})}},"selectedSpan.parsedContent":{deep:!0,handler(){this.selectedSpan&&this.selectedSpanId&&this.$nextTick(()=>{this.initDebugForm()})}}},mounted(){this.selectedSpan&&this.selectedSpanId&&this.$nextTick(()=>{this.initDebugForm()})},methods:{initDebugForm(){var n,a;if(!this.selectedSpan)return;let u=(a=(n=this.selectedSpan)==null?void 0:n.parsedContent)==null?void 0:a.inputs;if(!u&&this.rawInputs)try{u=typeof this.rawInputs=="string"?JSON.parse(this.rawInputs):this.rawInputs}catch(o){console.error("Failed to parse rawInputs:",o);return}if(!u){console.warn("No inputs found for span:",this.selectedSpanId);return}if(this.originalInputs=JSON.parse(JSON.stringify(u)),this.selectedSpan.type==="CLIENT"||this.selectedSpan.type==="EMBEDDING")this.debugForm.params=[],this.debugForm.systemContent="",this.debugForm.userContent="",Object.keys(u).forEach(o=>{if(o!=="file"){const f=u[o];let d="";typeof f=="string"?d=f:typeof f=="boolean"||typeof f=="number"?d=String(f):d=JSON.stringify(f),this.debugForm.params.push({key:o,value:d})}});else if(this.selectedSpan.type==="CHAT_MODEL")if(this.debugForm.params=[],this.hasImageUrl=!1,this.submitImage=!0,Object.keys(u).forEach(o=>{if(o!=="messages"){const f=u[o];let d="";typeof f=="string"?d=f:typeof f=="boolean"||typeof f=="number"?d=String(f):d=JSON.stringify(f),this.debugForm.params.push({key:o,value:d})}}),u.messages&&Array.isArray(u.messages)){const o=u.messages.find(d=>d.role==="system"),f=u.messages.find(d=>d.role==="user");if(o&&o.content?this.debugForm.systemContent=typeof o.content=="string"?o.content:"":this.debugForm.systemContent="",f&&f.content)if(Array.isArray(f.content)){const d=f.content.filter(y=>y.type==="text"&&y.text).map(y=>y.text);this.debugForm.userContent=d.join(`
78
+ `);const p=f.content.some(y=>y.type==="image_url");this.hasImageUrl=p}else typeof f.content=="string"?this.debugForm.userContent=f.content:this.debugForm.userContent="";else this.debugForm.userContent=""}else this.debugForm.systemContent="",this.debugForm.userContent="";this.debugResponse=null,this.showDebugRawResponse=!1,this.$nextTick(()=>{this.$refs.systemContentEditor&&this.$refs.systemContentEditor.codemirror&&this.$refs.systemContentEditor.codemirror.setValue(this.debugForm.systemContent||""),this.$refs.userContentEditor&&this.$refs.userContentEditor.codemirror&&this.$refs.userContentEditor.codemirror.setValue(this.debugForm.userContent||"")})},addDebugParam(){this.debugForm.params.push({key:"",value:""})},removeDebugParam(u){this.debugForm.params.splice(u,1)},handleDebugParamChange(){},resetDebugForm(){this.initDebugForm()},parseParamValue(u){if(u==="true"||u==="false")return u==="true";if(u==="")return"";{const n=Number(u);if(!isNaN(n)&&isFinite(n)&&u!=="")return n;try{return JSON.parse(u)}catch{return u}}},buildRequestHeaders(u){const n={};let a=null;const o=Object.keys(u).find(f=>f.toLowerCase()==="x-target-url");return o?(a=u[o],delete u[o]):this.targetUrl&&(a=this.targetUrl),a&&(n["X-Target-Url"]=a),n},handleDebugResponse(u){this.debugResponse=u,this.showDebugRawResponse=!1,this.$nextTick(()=>{this.debugResponseKey++})},handleDebugError(u){console.error("Debug request failed:",u);let n="未知错误";if(u.response&&u.response.data){const a=u.response.data;typeof a=="object"&&a!==null&&a.message?n=a.message:u.message&&(n=u.message)}else u.message&&(n=u.message);this.$message.error("调试请求失败: "+n)},async submitDebugRequest(u){const n=this.buildRequestHeaders(u),a=await tn.debugTrace(u,n);this.handleDebugResponse(a)},async submitDebugClient(){if(!(!this.selectedSpan||!this.originalInputs)){this.debugSubmitting=!0;try{const u={};this.originalInputs.file&&(u.file=this.originalInputs.file),this.debugForm.params.forEach(n=>{if(n.key&&n.key.trim()){const a=n.value?n.value.trim():"";u[n.key]=this.parseParamValue(a)}}),await this.submitDebugRequest(u)}catch(u){this.handleDebugError(u)}finally{this.debugSubmitting=!1}}},async submitDebugChatModel(){if(!(!this.selectedSpan||!this.originalInputs)){this.debugSubmitting=!0;try{const u=JSON.parse(JSON.stringify(this.originalInputs));if(this.debugForm.params.forEach(n=>{if(n.key&&n.key.trim()){const a=n.value?n.value.trim():"";u[n.key]=this.parseParamValue(a)}}),u.messages&&Array.isArray(u.messages)){const n=u.messages.find(o=>o.role==="system");n&&(n.content=this.debugForm.systemContent||"");const a=u.messages.find(o=>o.role==="user");if(a){const o=this.originalInputs.messages.find(d=>d.role==="user");if(o&&Array.isArray(o.content)){const d=[];this.submitImage&&Array.isArray(a.content)&&a.content.forEach(p=>{p.type==="image_url"&&d.push(p)}),this.debugForm.userContent&&this.debugForm.userContent.trim()&&d.push({type:"text",text:this.debugForm.userContent}),a.content=d.length>0?d:this.debugForm.userContent||""}else a.content=this.debugForm.userContent||""}}await this.submitDebugRequest(u)}catch(u){this.handleDebugError(u)}finally{this.debugSubmitting=!1}}},toggleDebugResponseView(){this.showDebugRawResponse=!this.showDebugRawResponse,this.$nextTick(()=>{this.debugResponseKey++})},formatRawJson(u){if(!u)return"";if(typeof u=="string")try{const n=JSON.parse(u);return JSON.stringify(n,null,2)}catch{return u}return JSON.stringify(u,null,2)},extractImagesFromObject(u,n=[],a=""){if(!(!u||typeof u!="object")){for(const[o,f]of Object.entries(u)){const d=a?`${a}.${o}`:o;typeof f=="string"&&f.trim()!==""?(f.startsWith("data:image/")||f.startsWith("/9j/")||f.startsWith("iVBOR")||f.startsWith("R0lGOD"))&&(n.push({path:d,value:f,label:o==="content"&&a?`${a.split(".").pop()}: ${o}`:o}),u[o]="[IMAGE_DATA]"):f&&typeof f=="object"&&!Array.isArray(f)?this.extractImagesFromObject(f,n,d):Array.isArray(f)&&f.forEach((p,y)=>{p&&typeof p=="object"&&this.extractImagesFromObject(p,n,`${d}[${y}]`)})}return n}},renderStructuredContent(u){const n=[];if(!u)return n;try{if(Array.isArray(u))u.forEach((a,o)=>{var f;a&&typeof a=="object"?a.type==="text"&&a.text?n.push({type:"markdown",content:Le(a.text),key:`text-${o}`}):a.type==="image_url"&&((f=a.image_url)!=null&&f.url)?n.push({type:"image",url:a.image_url.url,key:`image-${o}`}):a.image_base64&&a.image_base64.trim()!==""?n.push({type:"image",url:this.formatBase64Image(a.image_base64),key:`base64-image-${o}`}):n.push({type:"markdown",content:Le("```json\n"+JSON.stringify(a,null,2)+"\n```"),key:`json-${o}`}):n.push({type:"markdown",content:Le(String(a)),key:`text-${o}`})});else if(typeof u=="string")n.push({type:"markdown",content:Le(u),key:"text-0"});else if(typeof u=="object")if(u.data&&Array.isArray(u.data.result)){const a=JSON.parse(JSON.stringify(u)),o=[];a.data&&a.data.result&&a.data.result.forEach((f,d)=>{f.image_base64&&f.image_base64.trim()!==""&&(o.push({type:"page",image_base64:f.image_base64,page_num:f.page_num,label:f.page_num!==void 0?`Page ${f.page_num}`:`Result ${d}`}),f.image_base64="[BASE64_IMAGE_DATA]"),f.seals&&Array.isArray(f.seals)&&f.seals.forEach((p,y)=>{p.image_base64&&p.image_base64.trim()!==""&&(o.push({type:"seal",image_base64:p.image_base64,page_num:f.page_num,seal_index:y,seal_value:p.value,label:`Seal: ${p.value||y}`}),p.image_base64="[BASE64_IMAGE_DATA]")})}),n.push({type:"markdown",content:Le("```json\n"+JSON.stringify(a,null,2)+"\n```"),key:"json-0"}),o.forEach((f,d)=>{n.push({type:"image",url:this.formatBase64Image(f.image_base64),key:`result-image-${d}`,label:f.label})})}else{const a=JSON.parse(JSON.stringify(u)),o=[];this.extractImagesFromObject(a,o),n.push({type:"markdown",content:Le("```json\n"+JSON.stringify(a,null,2)+"\n```"),key:"json-0"}),o.forEach((f,d)=>{n.push({type:"image",url:this.formatBase64Image(f.value),key:`extracted-image-${d}`,label:f.label})})}else n.push({type:"markdown",content:Le(String(u)),key:"text-0"})}catch(a){console.error("Error rendering content:",a),n.push({type:"markdown",content:Le("Error rendering content"),key:"error-0"})}return n},formatBase64Image(u){return u?u.startsWith("data:image")?u:u.startsWith("/9j/")?`data:image/jpeg;base64,${u}`:u.startsWith("iVBOR")?`data:image/png;base64,${u}`:u.startsWith("R0lGOD")?`data:image/gif;base64,${u}`:`data:image/jpeg;base64,${u}`:""},handleImageClick(u){$l({options:this.viewerOptions,images:[u]})}}};var zp=function(){var o;var n=this,a=n._self._c;return a("div",{staticClass:"debug-content"},[n.selectedSpan.type==="CLIENT"||n.selectedSpan.type==="EMBEDDING"?a("div",{staticClass:"debug-client-form"},[a("el-form",{attrs:{model:n.debugForm,"label-width":"60px",size:"small"}},[n._l(n.debugForm.params,function(f,d){return a("div",{key:d,staticClass:"debug-form-row"},[a("el-form-item",{attrs:{label:`${n.$t("debug.paramLabel")} ${d+1}`}},[a("el-row",{attrs:{gutter:10,type:"flex",align:"middle"}},[a("el-col",{attrs:{span:8}},[a("el-input",{attrs:{placeholder:n.$t("debug.paramName")},on:{input:n.handleDebugParamChange},model:{value:f.key,callback:function(p){n.$set(f,"key",p)},expression:"item.key"}})],1),a("el-col",{attrs:{span:14}},[a("el-input",{attrs:{placeholder:n.$t("debug.paramValue")},on:{input:n.handleDebugParamChange},model:{value:f.value,callback:function(p){n.$set(f,"value",p)},expression:"item.value"}})],1),a("el-col",{attrs:{span:2}},[a("el-button",{staticClass:"delete-param-btn",attrs:{type:"danger",icon:"el-icon-delete",size:"small"},on:{click:function(p){return n.removeDebugParam(d)}}})],1)],1)],1)],1)}),a("el-form-item",[a("el-button",{attrs:{type:"primary",icon:"el-icon-plus",size:"small"},on:{click:n.addDebugParam}},[n._v(n._s(n.$t("debug.addParam")))]),a("el-button",{attrs:{type:"warning",icon:"el-icon-refresh",size:"small"},on:{click:n.resetDebugForm}},[n._v(n._s(n.$t("debug.reset")))]),a("el-button",{attrs:{type:"success",icon:"el-icon-check",size:"small",loading:n.debugSubmitting},on:{click:n.submitDebugClient}},[n._v(n._s(n.$t("debug.submit")))])],1)],2),n.debugResponse!==null?a("div",{staticClass:"debug-response"},[a("div",{staticClass:"debug-response-header"},[a("span",[n._v(n._s(n.$t("debug.responseResult")))]),a("el-button",{attrs:{type:"text",size:"small"},on:{click:n.toggleDebugResponseView}},[n._v(n._s(n.showDebugRawResponse?n.$t("debug.switchToMarkdown"):n.$t("debug.switchToRaw")))])],1),n.showDebugRawResponse?a("div",{staticClass:"debug-response-raw"},[a("codemirror",{key:`debug-response-${n.selectedSpanId}-${n.debugResponseKey}`,staticClass:"code-editor-wrapper",attrs:{value:n.formatRawJson(n.debugResponse),options:n.cmOptions}})],1):a("div",{staticClass:"debug-response-markdown"},n._l(n.renderStructuredContent(n.debugResponse),function(f){return a("div",{key:f.key,staticClass:"content-element"},[f.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(f.content)}}):f.type==="image"?a("div",{staticClass:"image-content"},[f.label?a("div",{staticClass:"image-label"},[n._v(n._s(f.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:f.url,alt:"content image"},on:{click:function(d){return n.handleImageClick(f.url)}}})]):n._e()])}),0)]):n._e()],1):n._e(),n.selectedSpan.type==="CHAT_MODEL"?a("div",{staticClass:"debug-chat-model-form"},[a("el-form",{attrs:{model:n.debugForm,"label-width":"60px",size:"small"}},[a("el-form-item",{attrs:{label:n.$t("debug.systemPrompt")}},[a("codemirror",{key:`debug-system-${n.selectedSpanId}-${n.debugMarkdownKey}`,ref:"systemContentEditor",staticClass:"code-editor-wrapper markdown-editor",attrs:{options:n.cmOptionsMarkdown},model:{value:n.debugForm.systemContent,callback:function(f){n.$set(n.debugForm,"systemContent",f)},expression:"debugForm.systemContent"}})],1),a("el-form-item",{attrs:{label:n.$t("debug.userPrompt")}},[a("codemirror",{key:`debug-user-${n.selectedSpanId}-${n.debugMarkdownKey}`,ref:"userContentEditor",staticClass:"code-editor-wrapper markdown-editor",attrs:{options:n.cmOptionsMarkdown},model:{value:n.debugForm.userContent,callback:function(f){n.$set(n.debugForm,"userContent",f)},expression:"debugForm.userContent"}})],1),n.selectedSpan.type==="CHAT_MODEL"&&n.hasImageUrl?a("el-form-item",{attrs:{label:n.$t("debug.submitImage")}},[a("el-switch",{attrs:{"active-text":n.$t("debug.yes"),"inactive-text":n.$t("debug.no")},model:{value:n.submitImage,callback:function(f){n.submitImage=f},expression:"submitImage"}})],1):n._e(),n._l(n.debugForm.params,function(f,d){return a("div",{key:d,staticClass:"debug-form-row"},[a("el-form-item",{attrs:{label:`${n.$t("debug.paramLabel")} ${d+1}`}},[a("el-row",{attrs:{gutter:10,type:"flex",align:"middle"}},[a("el-col",{attrs:{span:8}},[a("el-input",{attrs:{placeholder:n.$t("debug.paramName")},on:{input:n.handleDebugParamChange},model:{value:f.key,callback:function(p){n.$set(f,"key",p)},expression:"item.key"}})],1),a("el-col",{attrs:{span:14}},[a("el-input",{attrs:{placeholder:n.$t("debug.paramValue")},on:{input:n.handleDebugParamChange},model:{value:f.value,callback:function(p){n.$set(f,"value",p)},expression:"item.value"}})],1),a("el-col",{attrs:{span:2}},[a("el-button",{staticClass:"delete-param-btn",attrs:{type:"danger",icon:"el-icon-delete",size:"small"},on:{click:function(p){return n.removeDebugParam(d)}}})],1)],1)],1)],1)}),a("el-form-item",[a("el-button",{attrs:{type:"primary",icon:"el-icon-plus",size:"small"},on:{click:n.addDebugParam}},[n._v(n._s(n.$t("debug.addParam")))]),a("el-button",{attrs:{type:"warning",icon:"el-icon-refresh",size:"small"},on:{click:n.resetDebugForm}},[n._v(n._s(n.$t("debug.reset")))]),a("el-button",{attrs:{type:"success",icon:"el-icon-check",size:"small",loading:n.debugSubmitting},on:{click:n.submitDebugChatModel}},[n._v(n._s(n.$t("debug.submit")))])],1)],2),n.debugResponse!==null?a("div",{staticClass:"debug-response"},[a("div",{staticClass:"debug-response-header"},[a("span",[n._v(n._s(n.$t("debug.responseResult")))]),a("el-button",{attrs:{type:"text",size:"small"},on:{click:n.toggleDebugResponseView}},[n._v(n._s(n.showDebugRawResponse?n.$t("debug.switchToMarkdown"):n.$t("debug.switchToRaw")))])],1),n.showDebugRawResponse?a("div",{staticClass:"debug-response-raw"},[a("codemirror",{key:`debug-response-${n.selectedSpanId}-${n.debugResponseKey}`,staticClass:"code-editor-wrapper",attrs:{value:n.formatRawJson(n.debugResponse),options:n.cmOptions}})],1):a("div",{staticClass:"debug-response-markdown"},[n.selectedSpan.type==="CHAT_MODEL"&&((o=n.debugResponse)!=null&&o.choices)?a("div",{staticClass:"outputs-section"},n._l(n.debugResponse.choices,function(f,d){return a("div",{key:d,staticClass:"choice-item"},[a("div",{staticClass:"choice-header"},[a("span",[n._v("Choice "+n._s(d))])]),a("div",{staticClass:"choice-content"},[f.message?a("div",[a("div",{staticClass:"message-header"},[a("i",{staticClass:"el-icon-user message-icon"}),a("span",[n._v(n._s(f.message.role))])]),a("div",{staticClass:"structured-content"},n._l(n.renderStructuredContent(f.message.content),function(p){return a("div",{key:p.key,staticClass:"content-element"},[p.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(p.content)}}):p.type==="image"?a("div",{staticClass:"image-content"},[p.label?a("div",{staticClass:"image-label"},[n._v(n._s(p.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:p.url,alt:"content image"},on:{click:function(y){return n.handleImageClick(p.url)}}})]):n._e()])}),0)]):a("div",{staticClass:"structured-content"},n._l(n.renderStructuredContent(f),function(p){return a("div",{key:p.key,staticClass:"content-element"},[p.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(p.content)}}):p.type==="image"?a("div",{staticClass:"image-content"},[p.label?a("div",{staticClass:"image-label"},[n._v(n._s(p.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:p.url,alt:"content image"},on:{click:function(y){return n.handleImageClick(p.url)}}})]):n._e()])}),0)])])}),0):a("div",{staticClass:"structured-content"},n._l(n.renderStructuredContent(n.debugResponse),function(f){return a("div",{key:f.key,staticClass:"content-element"},[f.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(f.content)}}):f.type==="image"?a("div",{staticClass:"image-content"},[f.label?a("div",{staticClass:"image-label"},[n._v(n._s(f.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:f.url,alt:"content image"},on:{click:function(d){return n.handleImageClick(f.url)}}})]):n._e()])}),0)])]):n._e()],1):n._e()])},$p=[],Bp=An(Pp,zp,$p,!1,null,"f192a685");const Hp=Bp.exports;(function(u,n){(function(a){a(Wt())})(function(a){function o(D,R,K,de,L,w){this.indented=D,this.column=R,this.type=K,this.info=de,this.align=L,this.prev=w}function f(D,R,K,de){var L=D.indented;return D.context&&D.context.type=="statement"&&K!="statement"&&(L=D.context.indented),D.context=new o(L,R,K,de,null,D.context)}function d(D){var R=D.context.type;return(R==")"||R=="]"||R=="}")&&(D.indented=D.context.indented),D.context=D.context.prev}function p(D,R,K){if(R.prevToken=="variable"||R.prevToken=="type"||/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(D.string.slice(0,K))||R.typeAtEndOfLine&&D.column()==D.indentation())return!0}function y(D){for(;;){if(!D||D.type=="top")return!0;if(D.type=="}"&&D.prev.info!="namespace")return!1;D=D.prev}}a.defineMode("clike",function(D,R){var K=D.indentUnit,de=R.statementIndentUnit||K,L=R.dontAlignCalls,w=R.keywords||{},oe=R.types||{},Te=R.builtin||{},Z=R.blockKeywords||{},ce=R.defKeywords||{},ke=R.atoms||{},_e=R.hooks||{},ft=R.multiLineStrings,we=R.indentStatements!==!1,Me=R.indentSwitch!==!1,Ke=R.namespaceSeparator,ct=R.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,Pt=R.numberStart||/[\d\.]/,ht=R.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,dt=R.isOperatorChar||/[+\-*&%=<>!?|\/]/,gt=R.isIdentifierChar||/[\w\$_\xa1-\uffff]/,Ut=R.isReservedIdentifier||!1,be,kt;function Gt(ye,xe){var pe=ye.next();if(_e[pe]){var Fe=_e[pe](ye,xe);if(Fe!==!1)return Fe}if(pe=='"'||pe=="'")return xe.tokenize=In(pe),xe.tokenize(ye,xe);if(Pt.test(pe)){if(ye.backUp(1),ye.match(ht))return"number";ye.next()}if(ct.test(pe))return be=pe,null;if(pe=="/"){if(ye.eat("*"))return xe.tokenize=Zn,Zn(ye,xe);if(ye.eat("/"))return ye.skipToEnd(),"comment"}if(dt.test(pe)){for(;!ye.match(/^\/[\/*]/,!1)&&ye.eat(dt););return"operator"}if(ye.eatWhile(gt),Ke)for(;ye.match(Ke);)ye.eatWhile(gt);var De=ye.current();return x(w,De)?(x(Z,De)&&(be="newstatement"),x(ce,De)&&(kt=!0),"keyword"):x(oe,De)?"type":x(Te,De)||Ut&&Ut(De)?(x(Z,De)&&(be="newstatement"),"builtin"):x(ke,De)?"atom":"variable"}function In(ye){return function(xe,pe){for(var Fe=!1,De,zt=!1;(De=xe.next())!=null;){if(De==ye&&!Fe){zt=!0;break}Fe=!Fe&&De=="\\"}return(zt||!(Fe||ft))&&(pe.tokenize=null),"string"}}function Zn(ye,xe){for(var pe=!1,Fe;Fe=ye.next();){if(Fe=="/"&&pe){xe.tokenize=null;break}pe=Fe=="*"}return"comment"}function wr(ye,xe){R.typeFirstDefinitions&&ye.eol()&&y(xe.context)&&(xe.typeAtEndOfLine=p(ye,xe,ye.pos))}return{startState:function(ye){return{tokenize:null,context:new o((ye||0)-K,0,"top",null,!1),indented:0,startOfLine:!0,prevToken:null}},token:function(ye,xe){var pe=xe.context;if(ye.sol()&&(pe.align==null&&(pe.align=!1),xe.indented=ye.indentation(),xe.startOfLine=!0),ye.eatSpace())return wr(ye,xe),null;be=kt=null;var Fe=(xe.tokenize||Gt)(ye,xe);if(Fe=="comment"||Fe=="meta")return Fe;if(pe.align==null&&(pe.align=!0),be==";"||be==":"||be==","&&ye.match(/^\s*(?:\/\/.*)?$/,!1))for(;xe.context.type=="statement";)d(xe);else if(be=="{")f(xe,ye.column(),"}");else if(be=="[")f(xe,ye.column(),"]");else if(be=="(")f(xe,ye.column(),")");else if(be=="}"){for(;pe.type=="statement";)pe=d(xe);for(pe.type=="}"&&(pe=d(xe));pe.type=="statement";)pe=d(xe)}else be==pe.type?d(xe):we&&((pe.type=="}"||pe.type=="top")&&be!=";"||pe.type=="statement"&&be=="newstatement")&&f(xe,ye.column(),"statement",ye.current());if(Fe=="variable"&&(xe.prevToken=="def"||R.typeFirstDefinitions&&p(ye,xe,ye.start)&&y(xe.context)&&ye.match(/^\s*\(/,!1))&&(Fe="def"),_e.token){var De=_e.token(ye,xe,Fe);De!==void 0&&(Fe=De)}return Fe=="def"&&R.styleDefs===!1&&(Fe="variable"),xe.startOfLine=!1,xe.prevToken=kt?"def":Fe||be,wr(ye,xe),Fe},indent:function(ye,xe){if(ye.tokenize!=Gt&&ye.tokenize!=null||ye.typeAtEndOfLine&&y(ye.context))return a.Pass;var pe=ye.context,Fe=xe&&xe.charAt(0),De=Fe==pe.type;if(pe.type=="statement"&&Fe=="}"&&(pe=pe.prev),R.dontIndentStatements)for(;pe.type=="statement"&&R.dontIndentStatements.test(pe.info);)pe=pe.prev;if(_e.indent){var zt=_e.indent(ye,pe,xe,K);if(typeof zt=="number")return zt}var Qt=pe.prev&&pe.prev.info=="switch";if(R.allmanIndentation&&/[{(]/.test(Fe)){for(;pe.type!="top"&&pe.type!="}";)pe=pe.prev;return pe.indented}return pe.type=="statement"?pe.indented+(Fe=="{"?0:de):pe.align&&(!L||pe.type!=")")?pe.column+(De?0:1):pe.type==")"&&!De?pe.indented+de:pe.indented+(De?0:K)+(!De&&Qt&&!/^(?:case|default)\b/.test(xe)?K:0)},electricInput:Me?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:"//",fold:"brace"}});function m(D){for(var R={},K=D.split(" "),de=0;de<K.length;++de)R[K[de]]=!0;return R}function x(D,R){return typeof D=="function"?D(R):D.propertyIsEnumerable(R)}var S="auto if break case register continue return default do sizeof static else struct switch extern typedef union for goto while enum const volatile inline restrict asm fortran",A="alignas alignof and and_eq audit axiom bitand bitor catch class compl concept constexpr const_cast decltype delete dynamic_cast explicit export final friend import module mutable namespace new noexcept not not_eq operator or or_eq override private protected public reinterpret_cast requires static_assert static_cast template this thread_local throw try typeid typename using virtual xor xor_eq",E="bycopy byref in inout oneway out self super atomic nonatomic retain copy readwrite readonly strong weak assign typeof nullable nonnull null_resettable _cmd @interface @implementation @end @protocol @encode @property @synthesize @dynamic @class @public @package @private @protected @required @optional @try @catch @finally @import @selector @encode @defs @synchronized @autoreleasepool @compatibility_alias @available",H="FOUNDATION_EXPORT FOUNDATION_EXTERN NS_INLINE NS_FORMAT_FUNCTION NS_RETURNS_RETAINEDNS_ERROR_ENUM NS_RETURNS_NOT_RETAINED NS_RETURNS_INNER_POINTER NS_DESIGNATED_INITIALIZER NS_ENUM NS_OPTIONS NS_REQUIRES_NIL_TERMINATION NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_END NS_SWIFT_NAME NS_REFINED_FOR_SWIFT",B=m("int long char short double float unsigned signed void bool"),U=m("SEL instancetype id Class Protocol BOOL");function F(D){return x(B,D)||/.+_t$/.test(D)}function N(D){return F(D)||x(U,D)}var O="case do else for if switch while struct enum union",$="struct enum union";function X(D,R){if(!R.startOfLine)return!1;for(var K,de=null;K=D.peek();){if(K=="\\"&&D.match(/^.$/)){de=X;break}else if(K=="/"&&D.match(/^\/[\/\*]/,!1))break;D.next()}return R.tokenize=de,"meta"}function ne(D,R){return R.prevToken=="type"?"type":!1}function ue(D){return!D||D.length<2||D[0]!="_"?!1:D[1]=="_"||D[1]!==D[1].toLowerCase()}function se(D){return D.eatWhile(/[\w\.']/),"number"}function he(D,R){if(D.backUp(1),D.match(/^(?:R|u8R|uR|UR|LR)/)){var K=D.match(/^"([^\s\\()]{0,16})\(/);return K?(R.cpp11RawStringDelim=K[1],R.tokenize=ie,ie(D,R)):!1}return D.match(/^(?:u8|u|U|L)/)?D.match(/^["']/,!1)?"string":!1:(D.next(),!1)}function Oe(D){var R=/(\w+)::~?(\w+)$/.exec(D);return R&&R[1]==R[2]}function Re(D,R){for(var K;(K=D.next())!=null;)if(K=='"'&&!D.eat('"')){R.tokenize=null;break}return"string"}function ie(D,R){var K=R.cpp11RawStringDelim.replace(/[^\w\s]/g,"\\$&"),de=D.match(new RegExp(".*?\\)"+K+'"'));return de?R.tokenize=null:D.skipToEnd(),"string"}function ze(D,R){typeof D=="string"&&(D=[D]);var K=[];function de(w){if(w)for(var oe in w)w.hasOwnProperty(oe)&&K.push(oe)}de(R.keywords),de(R.types),de(R.builtin),de(R.atoms),K.length&&(R.helperType=D[0],a.registerHelper("hintWords",D[0],K));for(var L=0;L<D.length;++L)a.defineMIME(D[L],R)}ze(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:m(S),types:F,blockKeywords:m(O),defKeywords:m($),typeFirstDefinitions:!0,atoms:m("NULL true false"),isReservedIdentifier:ue,hooks:{"#":X,"*":ne},modeProps:{fold:["brace","include"]}}),ze(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:m(S+" "+A),types:F,blockKeywords:m(O+" class try catch"),defKeywords:m($+" class namespace"),typeFirstDefinitions:!0,atoms:m("true false NULL nullptr"),dontIndentStatements:/^template$/,isIdentifierChar:/[\w\$_~\xa1-\uffff]/,isReservedIdentifier:ue,hooks:{"#":X,"*":ne,u:he,U:he,L:he,R:he,0:se,1:se,2:se,3:se,4:se,5:se,6:se,7:se,8:se,9:se,token:function(D,R,K){if(K=="variable"&&D.peek()=="("&&(R.prevToken==";"||R.prevToken==null||R.prevToken=="}")&&Oe(D.current()))return"def"}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),ze("text/x-java",{name:"clike",keywords:m("abstract assert break case catch class const continue default do else enum extends final finally for goto if implements import instanceof interface native new package private protected public return static strictfp super switch synchronized this throw throws transient try volatile while @interface"),types:m("var byte short int long float double boolean char void Boolean Byte Character Double Float Integer Long Number Object Short String StringBuffer StringBuilder Void"),blockKeywords:m("catch class do else finally for if switch try while"),defKeywords:m("class interface enum @interface"),typeFirstDefinitions:!0,atoms:m("true false null"),number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,hooks:{"@":function(D){return D.match("interface",!1)?!1:(D.eatWhile(/[\w\$_]/),"meta")},'"':function(D,R){return D.match(/""$/)?(R.tokenize=W,R.tokenize(D,R)):!1}},modeProps:{fold:["brace","import"]}}),ze("text/x-csharp",{name:"clike",keywords:m("abstract as async await base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in init interface internal is lock namespace new operator out override params private protected public readonly record ref required return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),types:m("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),blockKeywords:m("catch class do else finally for foreach if struct switch try while"),defKeywords:m("class interface namespace record struct var"),typeFirstDefinitions:!0,atoms:m("true false null"),hooks:{"@":function(D,R){return D.eat('"')?(R.tokenize=Re,Re(D,R)):(D.eatWhile(/[\w\$_]/),"meta")}}});function W(D,R){for(var K=!1;!D.eol();){if(!K&&D.match('"""')){R.tokenize=null;break}K=D.next()=="\\"&&!K}return"string"}function Q(D){return function(R,K){for(var de;de=R.next();)if(de=="*"&&R.eat("/"))if(D==1){K.tokenize=null;break}else return K.tokenize=Q(D-1),K.tokenize(R,K);else if(de=="/"&&R.eat("*"))return K.tokenize=Q(D+1),K.tokenize(R,K);return"comment"}}ze("text/x-scala",{name:"clike",keywords:m("abstract case catch class def do else extends final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try type val var while with yield _ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble"),types:m("AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),multiLineStrings:!0,blockKeywords:m("catch class enum do else finally for forSome if match switch try while"),defKeywords:m("class enum def object package trait type val var"),atoms:m("true false null"),indentStatements:!1,indentSwitch:!1,isOperatorChar:/[+\-*&%=<>!?|\/#:@]/,hooks:{"@":function(D){return D.eatWhile(/[\w\$_]/),"meta"},'"':function(D,R){return D.match('""')?(R.tokenize=W,R.tokenize(D,R)):!1},"'":function(D){return D.match(/^(\\[^'\s]+|[^\\'])'/)?"string-2":(D.eatWhile(/[\w\$_\xa1-\uffff]/),"atom")},"=":function(D,R){var K=R.context;return K.type=="}"&&K.align&&D.eat(">")?(R.context=new o(K.indented,K.column,K.type,K.info,null,K.prev),"operator"):!1},"/":function(D,R){return D.eat("*")?(R.tokenize=Q(1),R.tokenize(D,R)):!1}},modeProps:{closeBrackets:{pairs:'()[]{}""',triples:'"'}}});function k(D){return function(R,K){for(var de=!1,L,w=!1;!R.eol();){if(!D&&!de&&R.match('"')){w=!0;break}if(D&&R.match('"""')){w=!0;break}L=R.next(),!de&&L=="$"&&R.match("{")&&R.skipTo("}"),de=!de&&L=="\\"&&!D}return(w||!D)&&(K.tokenize=null),"string"}}ze("text/x-kotlin",{name:"clike",keywords:m("package as typealias class interface this super val operator var fun for is in This throw return annotation break continue object if else while do try when !in !is as? file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constructor init sealed field property receiver param sparam lateinit data inline noinline tailrec external annotation crossinline const operator infix suspend actual expect setparam value"),types:m("Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void Annotation Any BooleanArray ByteArray Char CharArray DeprecationLevel DoubleArray Enum FloatArray Function Int IntArray Lazy LazyThreadSafetyMode LongArray Nothing ShortArray Unit"),intendSwitch:!1,indentStatements:!1,multiLineStrings:!0,number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+(\.\d+)?|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,blockKeywords:m("catch class do else finally for if where try while enum"),defKeywords:m("class val var object interface fun"),atoms:m("true false null this"),hooks:{"@":function(D){return D.eatWhile(/[\w\$_]/),"meta"},"*":function(D,R){return R.prevToken=="."?"variable":"operator"},'"':function(D,R){return R.tokenize=k(D.match('""')),R.tokenize(D,R)},"/":function(D,R){return D.eat("*")?(R.tokenize=Q(1),R.tokenize(D,R)):!1},indent:function(D,R,K,de){var L=K&&K.charAt(0);if((D.prevToken=="}"||D.prevToken==")")&&K=="")return D.indented;if(D.prevToken=="operator"&&K!="}"&&D.context.type!="}"||D.prevToken=="variable"&&L=="."||(D.prevToken=="}"||D.prevToken==")")&&L==".")return de*2+R.indented;if(R.align&&R.type=="}")return R.indented+(D.context.type==(K||"").charAt(0)?0:de)}},modeProps:{closeBrackets:{triples:'"'}}}),ze(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:m("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:m("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:m("for while do if else struct"),builtin:m("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:m("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TextureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),indentSwitch:!1,hooks:{"#":X},modeProps:{fold:["brace","include"]}}),ze("text/x-nesc",{name:"clike",keywords:m(S+" as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),types:F,blockKeywords:m(O),atoms:m("null true false"),hooks:{"#":X},modeProps:{fold:["brace","include"]}}),ze("text/x-objectivec",{name:"clike",keywords:m(S+" "+E),types:N,builtin:m(H),blockKeywords:m(O+" @synthesize @try @catch @finally @autoreleasepool @synchronized"),defKeywords:m($+" @interface @implementation @protocol @class"),dontIndentStatements:/^@.*$/,typeFirstDefinitions:!0,atoms:m("YES NO NULL Nil nil true false nullptr"),isReservedIdentifier:ue,hooks:{"#":X,"*":ne},modeProps:{fold:["brace","include"]}}),ze("text/x-objectivec++",{name:"clike",keywords:m(S+" "+E+" "+A),types:N,builtin:m(H),blockKeywords:m(O+" @synthesize @try @catch @finally @autoreleasepool @synchronized class try catch"),defKeywords:m($+" @interface @implementation @protocol @class class namespace"),dontIndentStatements:/^@.*$|^template$/,typeFirstDefinitions:!0,atoms:m("YES NO NULL Nil nil true false nullptr"),isReservedIdentifier:ue,hooks:{"#":X,"*":ne,u:he,U:he,L:he,R:he,0:se,1:se,2:se,3:se,4:se,5:se,6:se,7:se,8:se,9:se,token:function(D,R,K){if(K=="variable"&&D.peek()=="("&&(R.prevToken==";"||R.prevToken==null||R.prevToken=="}")&&Oe(D.current()))return"def"}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),ze("text/x-squirrel",{name:"clike",keywords:m("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:F,blockKeywords:m("case catch class else for foreach if switch try while"),defKeywords:m("function local class"),typeFirstDefinitions:!0,atoms:m("true false null"),hooks:{"#":X},modeProps:{fold:["brace","include"]}});var J=null;function G(D){return function(R,K){for(var de=!1,L,w=!1;!R.eol();){if(!de&&R.match('"')&&(D=="single"||R.match('""'))){w=!0;break}if(!de&&R.match("``")){J=G(D),w=!0;break}L=R.next(),de=D=="single"&&!de&&L=="\\"}return w&&(K.tokenize=null),"string"}}ze("text/x-ceylon",{name:"clike",keywords:m("abstracts alias assembly assert assign break case catch class continue dynamic else exists extends finally for function given if import in interface is let module new nonempty object of out outer package return satisfies super switch then this throw try value void while"),types:function(D){var R=D.charAt(0);return R===R.toUpperCase()&&R!==R.toLowerCase()},blockKeywords:m("case catch class dynamic else finally for function if interface module new object switch try while"),defKeywords:m("class dynamic function interface module object package value"),builtin:m("abstract actual aliased annotation by default deprecated doc final formal late license native optional sealed see serializable shared suppressWarnings tagged throws variable"),isPunctuationChar:/[\[\]{}\(\),;\:\.`]/,isOperatorChar:/[+\-*&%=<>!?|^~:\/]/,numberStart:/[\d#$]/,number:/^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,multiLineStrings:!0,typeFirstDefinitions:!0,atoms:m("true false null larger smaller equal empty finished"),indentSwitch:!1,styleDefs:!1,hooks:{"@":function(D){return D.eatWhile(/[\w\$_]/),"meta"},'"':function(D,R){return R.tokenize=G(D.match('""')?"triple":"single"),R.tokenize(D,R)},"`":function(D,R){return!J||!D.match("`")?!1:(R.tokenize=J,J=null,R.tokenize(D,R))},"'":function(D){return D.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},token:function(D,R,K){if((K=="variable"||K=="type")&&R.prevToken==".")return"variable-2"}},modeProps:{fold:["brace","import"],closeBrackets:{triples:'"'}}})})})(),Le.setOptions({breaks:!0});const Wp={name:"TraceDetailDrawer",components:{TraceSpanTree:Ua,DebugTab:Hp,codemirror:go.codemirror},props:{visible:{type:Boolean,default:!1},currentTraceId:{type:String,default:null},traceInfo:{type:Object,default:()=>({})},spans:{type:Array,default:()=>[]},filteredSpans:{type:Array,default:()=>[]},selectedSpanId:{type:String,default:null},selectedSpan:{type:Object,default:null},loading:{type:Boolean,default:!1},spanHasNextPage:{type:Boolean,default:!1},spanLoadMoreLoading:{type:Boolean,default:!1},spanHasEvents:{type:Boolean,default:null}},data(){return{localVisible:this.visible,spanSearchQuery:"",activeTab:"io",activeCollapse:["inputs","outputs"],messageCollapse:[],rawIoCollapse:["rawInputs","rawOutputs"],rawInputsKey:0,rawOutputsKey:0,eventsCollapse:[],eventsKey:0,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},cmOptionsJava:{tabSize:4,mode:"text/x-java",theme:"monokai",lineNumbers:!0,lineWrapping:!0,readOnly:!0,foldGutter:!0,gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],matchBrackets:!0,autoCloseBrackets:!0,indentUnit:4,styleActiveLine:!0},viewerOptions:{inline:!1,button:!0,navbar:!0,title:!0,toolbar:!0,tooltip:!0,movable:!0,zoomable:!0,rotatable:!0,scalable:!0,transition:!0,fullscreen:!0,keyboard:!0,zIndex:9999}}},computed:{drawerTitle(){let u=this.traceInfo.trace_name;return u||(u=this.traceInfo.trace_id),u?this.$t("trace.traceDetail")+": "+u:this.$t("trace.traceDetail")},traceStartTime(){return this.spans.length===0?0:Math.min(...this.spans.map(u=>u.start_time_unix_nano))},traceEndTime(){return this.spans.length===0?0:Math.max(...this.spans.map(u=>u.end_time_unix_nano))},hasInputs(){var u,n;return((n=(u=this.selectedSpan)==null?void 0:u.parsedContent)==null?void 0:n.inputs)!==void 0},hasOutputs(){var u,n;return((n=(u=this.selectedSpan)==null?void 0:u.parsedContent)==null?void 0:n.outputs)!==void 0},showIOTab(){var o,f,d;if(!this.selectedSpan||!(this.selectedSpan.type==="CLIENT"||this.selectedSpan.type==="EMBEDDING"||this.selectedSpan.type==="CHAT_MODEL"))return!1;const n=(d=(f=(o=this.selectedSpan)==null?void 0:o.parsedContent)==null?void 0:f.attributes)==null?void 0:d["langsword.spanInputs"];return n!=null&&n!==""},attributesData(){var u,n;return(n=(u=this.selectedSpan)==null?void 0:u.parsedContent)!=null&&n.attributes?Object.entries(this.selectedSpan.parsedContent.attributes).filter(([a])=>!a.startsWith("langsword.span")).map(([a,o])=>{let f;return a==="http.response.body.size"||a==="http.request.body.size"?f=this.formatBytes(o):typeof o=="string"?f=o:f=JSON.stringify(o,null,2),{key:a,value:f}}):[]},rawInputs(){var u,n,a;return(a=(n=(u=this.selectedSpan)==null?void 0:u.parsedContent)==null?void 0:n.attributes)==null?void 0:a["langsword.spanInputs"]},rawOutputs(){var u,n,a;return(a=(n=(u=this.selectedSpan)==null?void 0:u.parsedContent)==null?void 0:n.attributes)==null?void 0:a["langsword.spanOutputs"]},hasEvents(){var n,a,o;if(((n=this.selectedSpan)==null?void 0:n.has_events)!==void 0)return this.selectedSpan.has_events===!0;const u=(o=(a=this.selectedSpan)==null?void 0:a.parsedContent)==null?void 0:o.events;return u&&Array.isArray(u)&&u.length>0},spanEvents(){var n,a;const u=(a=(n=this.selectedSpan)==null?void 0:n.parsedContent)==null?void 0:a.events;return!u||!Array.isArray(u)?[]:u},showDebugTab(){var o,f,d,p,y;if(!this.selectedSpan||!(this.selectedSpan.type==="CLIENT"||this.selectedSpan.type==="EMBEDDING"||this.selectedSpan.type==="CHAT_MODEL"))return!1;const n=(d=(f=(o=this.selectedSpan)==null?void 0:o.parsedContent)==null?void 0:f.attributes)==null?void 0:d["langsword.spanInputs"];if(!(n!=null&&n!==""))return!1;if(this.selectedSpan.type==="CLIENT"||this.selectedSpan.type==="EMBEDDING"){const m=(y=(p=this.selectedSpan)==null?void 0:p.parsedContent)==null?void 0:y.inputs;if(!m){const x=this.rawInputs;if(x)try{const S=typeof x=="string"?JSON.parse(x):x;return S&&S.file&&(S.file.filename||S.file.content)}catch{return!1}return!1}return m&&m.file&&(m.file.filename||m.file.content)}return this.selectedSpan.type==="CHAT_MODEL"}},watch:{visible(u){this.localVisible=u,u||(this.spanSearchQuery="")},localVisible(u){this.$emit("update:visible",u)},activeTab(u){u==="raw"&&this.$nextTick(()=>{this.rawInputsKey++,this.rawOutputsKey++}),u==="events"&&this.$nextTick(()=>{this.eventsKey++})},selectedSpan(){var o;if(!this.selectedSpan)return;const u=this.selectedSpan.has_events===!0||((o=this.selectedSpan.parsedContent)==null?void 0:o.events)&&Array.isArray(this.selectedSpan.parsedContent.events)&&this.selectedSpan.parsedContent.events.length>0,n=[];this.showIOTab&&n.push("io","raw"),this.showDebugTab&&n.push("debug"),n.push("attributes"),u&&n.push("events");let a="attributes";this.showIOTab&&(a="io"),n.includes(a)?this.activeTab=a:this.activeTab="attributes",this.$nextTick(()=>{this.updateCollapseStates(),this.activeTab==="raw"&&(this.rawInputsKey++,this.rawOutputsKey++),this.activeTab==="events"&&this.eventsKey++})}},methods:{formatBytes(u){const n=typeof u=="number"?u:Number(u);if(!Number.isFinite(n))return typeof u=="string"?u:JSON.stringify(u,null,2);const a=n<0?"-":"";let o=Math.abs(n);const f=["B","K","M","G","T","P","E"];if(o<1024)return`${a}${Math.round(o)}B`;let d=0;for(;o>=1024&&d<f.length-1;)o/=1024,d++;return`${a}${o.toFixed(2)}${f[d]}`},handleClose(u){this.$emit("close"),u&&typeof u=="function"&&u()},handleSpanSearch(){this.$emit("span-search",this.spanSearchQuery)},handleHasEventsChange(u){this.$emit("update:span-has-events",u?!0:null)},handleSpanSelect(u){this.$emit("span-select",u),this.$nextTick(()=>{this.updateCollapseStates()})},updateCollapseStates(){var a,o,f,d,p;this.activeCollapse=["inputs","outputs"],(f=(o=(a=this.selectedSpan)==null?void 0:a.parsedContent)==null?void 0:o.inputs)!=null&&f.messages?this.messageCollapse=this.selectedSpan.parsedContent.inputs.messages.map((y,m)=>`message-${m}`):this.messageCollapse=[],this.rawIoCollapse=["rawInputs","rawOutputs"];const u=(p=(d=this.selectedSpan)==null?void 0:d.parsedContent)==null?void 0:p.events;u&&Array.isArray(u)&&u.length>0?this.eventsCollapse=u.map((y,m)=>`event-${m}`):this.eventsCollapse=[]},parseContentData(u){const n={attributes:u.attributes||{},events:u.events||[],status:u.status||{}};if(u.inputs&&(n.inputs=u.inputs),u.outputs&&(n.outputs=u.outputs),n.attributes){const a=n.attributes["langsword.spanInputs"],o=n.attributes["langsword.spanOutputs"];if(a)try{n.inputs=typeof a=="string"?JSON.parse(a):a}catch{try{const d=a.replace(/\\"/g,'"').replace(/^"|"$/g,"");n.inputs=JSON.parse(d)}catch{n.inputs=a}}if(o)try{n.outputs=typeof o=="string"?JSON.parse(o):o}catch{try{const d=o.replace(/\\"/g,'"').replace(/^"|"$/g,"");n.outputs=JSON.parse(d)}catch{n.outputs=o}}}return n},getStatusType(u){if(!u)return"info";const n=u.toUpperCase();return n==="OK"||n==="SUCCESS"?"success":n==="ERROR"||n==="FAILED"?"danger":n==="WARNING"||n==="WARN"?"warning":"info"},formatNanoDuration(u){if(!u)return"-";const n=u/1e6;return n<1e3?`${n.toFixed(2)}ms`:n<6e4?`${(n/1e3).toFixed(2)}s`:`${(n/6e4).toFixed(2)}min`},formatTimestamp(u){if(!u)return"-";const n=typeof u=="string"?parseInt(u,10):u,a=new Date(n);return isNaN(a.getTime())?"-":a.toLocaleString("zh-CN")},formatEventTimestamp(u){if(!u)return"-";const n=u/1e6,a=new Date(n);return isNaN(a.getTime())?"-":a.toLocaleString("zh-CN")},getEventAttributesData(u){return!u||!u.attributes?[]:Object.entries(u.attributes).map(([n,a])=>({key:n,value:typeof a=="string"?a:JSON.stringify(a,null,2)}))},getOtherEventAttributes(u){if(!u||!u.attributes)return[];const n=["exception.type","exception.message","exception.stacktrace"];return Object.entries(u.attributes).filter(([a])=>!n.includes(a)).map(([a,o])=>({key:a,value:typeof o=="string"?o:JSON.stringify(o,null,2)}))},formatRawJson(u){if(!u)return"";if(typeof u=="string")try{const n=JSON.parse(u);return JSON.stringify(n,null,2)}catch{return u}return JSON.stringify(u,null,2)},getMessageIcon(u){return{user:"el-icon-user",assistant:"el-icon-service",system:"el-icon-setting"}[u]||"el-icon-document"},extractImagesFromObject(u,n=[],a=""){if(!(!u||typeof u!="object")){for(const[o,f]of Object.entries(u)){const d=a?`${a}.${o}`:o;typeof f=="string"&&f.trim()!==""?(f.startsWith("data:image/")||f.startsWith("/9j/")||f.startsWith("iVBOR")||f.startsWith("R0lGOD"))&&(n.push({path:d,value:f,label:o==="content"&&a?`${a.split(".").pop()}: ${o}`:o}),u[o]="[IMAGE_DATA]"):f&&typeof f=="object"&&!Array.isArray(f)?this.extractImagesFromObject(f,n,d):Array.isArray(f)&&f.forEach((p,y)=>{p&&typeof p=="object"&&this.extractImagesFromObject(p,n,`${d}[${y}]`)})}return n}},renderStructuredContent(u){const n=[];if(!u)return n;try{if(Array.isArray(u))u.forEach((a,o)=>{var f;a&&typeof a=="object"?a.type==="text"&&a.text?n.push({type:"markdown",content:Le(a.text),key:`text-${o}`}):a.type==="image_url"&&((f=a.image_url)!=null&&f.url)?n.push({type:"image",url:a.image_url.url,key:`image-${o}`}):a.image_base64&&a.image_base64.trim()!==""?n.push({type:"image",url:this.formatBase64Image(a.image_base64),key:`base64-image-${o}`}):n.push({type:"markdown",content:Le("```json\n"+JSON.stringify(a,null,2)+"\n```"),key:`json-${o}`}):n.push({type:"markdown",content:Le(String(a)),key:`text-${o}`})});else if(typeof u=="string")n.push({type:"markdown",content:Le(u),key:"text-0"});else if(typeof u=="object")if(u.data&&Array.isArray(u.data.result)){const a=JSON.parse(JSON.stringify(u)),o=[];a.data&&a.data.result&&a.data.result.forEach((f,d)=>{f.image_base64&&f.image_base64.trim()!==""&&(o.push({type:"page",image_base64:f.image_base64,page_num:f.page_num,label:f.page_num!==void 0?`Page ${f.page_num}`:`Result ${d}`}),f.image_base64="[BASE64_IMAGE_DATA]"),f.seals&&Array.isArray(f.seals)&&f.seals.forEach((p,y)=>{p.image_base64&&p.image_base64.trim()!==""&&(o.push({type:"seal",image_base64:p.image_base64,page_num:f.page_num,seal_index:y,seal_value:p.value,label:`Seal: ${p.value||y}`}),p.image_base64="[BASE64_IMAGE_DATA]")})}),n.push({type:"markdown",content:Le("```json\n"+JSON.stringify(a,null,2)+"\n```"),key:"json-0"}),o.forEach((f,d)=>{n.push({type:"image",url:this.formatBase64Image(f.image_base64),key:`result-image-${d}`,label:f.label})})}else{const a=JSON.parse(JSON.stringify(u)),o=[];this.extractImagesFromObject(a,o),n.push({type:"markdown",content:Le("```json\n"+JSON.stringify(a,null,2)+"\n```"),key:"json-0"}),o.forEach((f,d)=>{n.push({type:"image",url:this.formatBase64Image(f.value),key:`extracted-image-${d}`,label:f.label})})}else n.push({type:"markdown",content:Le(String(u)),key:"text-0"})}catch(a){console.error("Error rendering content:",a),n.push({type:"markdown",content:Le("Error rendering content"),key:"error-0"})}return n},formatBase64Image(u){return u?u.startsWith("data:image")?u:u.startsWith("/9j/")?`data:image/jpeg;base64,${u}`:u.startsWith("iVBOR")?`data:image/png;base64,${u}`:u.startsWith("R0lGOD")?`data:image/gif;base64,${u}`:`data:image/jpeg;base64,${u}`:""},handleImageClick(u){$l({options:this.viewerOptions,images:[u]})}}};var jp=function(){var o,f,d,p,y,m;var n=this,a=n._self._c;return a("el-drawer",{attrs:{visible:n.localVisible,"with-header":!0,title:n.drawerTitle,size:"90%",direction:"rtl","before-close":n.handleClose},on:{"update:visible":function(x){n.localVisible=x}}},[n.currentTraceId?a("div",{directives:[{name:"loading",rawName:"v-loading",value:n.loading,expression:"loading"}],staticClass:"trace-detail-content",attrs:{"element-loading-text":"加载中..."}},[a("div",{staticClass:"trace-info-section"},[a("el-descriptions",{attrs:{column:3,border:""}},[a("el-descriptions-item",{attrs:{label:n.$t("trace.traceId")}},[n._v(n._s(n.traceInfo.trace_id))]),a("el-descriptions-item",{attrs:{label:n.$t("trace.status")}},[a("el-tag",{attrs:{type:n.getStatusType(n.traceInfo.status),size:"mini"}},[n._v(" "+n._s(n.traceInfo.status)+" ")])],1),a("el-descriptions-item",{attrs:{label:n.$t("trace.executionTime")}},[n._v(" "+n._s(n.formatNanoDuration(n.traceInfo.execution_time_ms))+" ")]),a("el-descriptions-item",{attrs:{label:n.$t("trace.timeCreated")}},[n._v(" "+n._s(n.formatTimestamp(n.traceInfo.timestamp_ms))+" ")]),a("el-descriptions-item",{attrs:{label:n.$t("trace.experimentId")}},[n._v(n._s(n.traceInfo.experiment_id))]),a("el-descriptions-item",{attrs:{label:n.$t("trace.traceType")}},[a("el-tag",{attrs:{size:"mini",type:"info"}},[n._v(n._s(n.traceInfo.trace_type||"-"))])],1),a("el-descriptions-item",{attrs:{label:n.$t("trace.traceName"),span:2}},[n._v(" "+n._s(n.traceInfo.trace_name||"-")+" ")])],1)],1),a("el-divider"),a("el-row",{attrs:{gutter:20}},[a("el-col",{staticClass:"span-tree-col",attrs:{span:8}},[a("el-card",[a("div",{staticClass:"span-search-header",attrs:{slot:"header"},slot:"header"},[a("el-input",{staticClass:"span-search-input",attrs:{placeholder:n.$t("span.searchTree"),"prefix-icon":"el-icon-search",size:"small",clearable:""},on:{input:n.handleSpanSearch},model:{value:n.spanSearchQuery,callback:function(x){n.spanSearchQuery=x},expression:"spanSearchQuery"}}),a("el-checkbox",{attrs:{value:n.spanHasEvents===!0,size:"small"},on:{change:n.handleHasEventsChange}},[n._v(" "+n._s(n.$t("span.hasEvents"))+" ")])],1),a("TraceSpanTree",{attrs:{spans:n.filteredSpans,"selected-span-id":n.selectedSpanId,"trace-start-time":n.traceStartTime,"trace-end-time":n.traceEndTime},on:{"span-select":n.handleSpanSelect}}),n.spanHasNextPage?a("div",{staticClass:"span-load-more"},[a("el-button",{attrs:{type:"primary",size:"small",loading:n.spanLoadMoreLoading},on:{click:function(x){return n.$emit("span-load-more")}}},[n._v(" 加载更多 ")])],1):n._e()],1)],1),a("el-col",{staticClass:"span-detail-col",attrs:{span:16}},[a("el-card",[n.selectedSpan?a("div",{staticClass:"span-detail-content"},[a("el-tabs",{key:`tabs-${n.selectedSpanId}`,model:{value:n.activeTab,callback:function(x){n.activeTab=x},expression:"activeTab"}},[n.showIOTab?a("el-tab-pane",{attrs:{label:`${n.$t("trace.inputs")} / ${n.$t("trace.outputs")}`,name:"io"}},[a("div",{staticClass:"io-content"},[n.hasInputs?a("div",{staticClass:"io-section"},[a("el-collapse",{model:{value:n.activeCollapse,callback:function(x){n.activeCollapse=x},expression:"activeCollapse"}},[a("el-collapse-item",{attrs:{title:n.$t("trace.inputs"),name:"inputs"}},[(f=(o=n.selectedSpan.parsedContent)==null?void 0:o.inputs)!=null&&f.messages?a("div",{staticClass:"messages-section"},n._l(n.selectedSpan.parsedContent.inputs.messages,function(x,S){return a("div",{key:S,staticClass:"message-item"},[a("el-collapse",{model:{value:n.messageCollapse,callback:function(A){n.messageCollapse=A},expression:"messageCollapse"}},[a("el-collapse-item",{attrs:{name:`message-${S}`}},[a("template",{slot:"title"},[a("i",{staticClass:"message-icon",class:n.getMessageIcon(x.role)}),a("span",{staticClass:"message-role"},[n._v(n._s(x.role))])]),a("div",{staticClass:"message-content"},[a("div",{staticClass:"structured-content"},n._l(n.renderStructuredContent(x.content),function(A){return a("div",{key:A.key,staticClass:"content-element"},[A.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(A.content)}}):A.type==="image"?a("div",{staticClass:"image-content"},[A.label?a("div",{staticClass:"image-label"},[n._v(n._s(A.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:A.url,alt:"content image"},on:{click:function(E){return n.handleImageClick(A.url)}}})]):n._e()])}),0)])],2)],1)],1)}),0):(d=n.selectedSpan.parsedContent)!=null&&d.inputs?a("div",{staticClass:"structured-content"},n._l(n.renderStructuredContent(n.selectedSpan.parsedContent.inputs),function(x){return a("div",{key:x.key,staticClass:"content-element"},[x.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(x.content)}}):x.type==="image"?a("div",{staticClass:"image-content"},[x.label?a("div",{staticClass:"image-label"},[n._v(n._s(x.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:x.url,alt:"content image"},on:{click:function(S){return n.handleImageClick(x.url)}}})]):n._e()])}),0):a("div",{staticClass:"empty-content"},[a("el-empty",{attrs:{description:n.$t("trace.noInputs"),"image-size":80}})],1)])],1)],1):n._e(),n.hasOutputs?a("div",{staticClass:"io-section"},[a("el-collapse",{model:{value:n.activeCollapse,callback:function(x){n.activeCollapse=x},expression:"activeCollapse"}},[a("el-collapse-item",{attrs:{title:n.$t("trace.outputs"),name:"outputs"}},[(y=(p=n.selectedSpan.parsedContent)==null?void 0:p.outputs)!=null&&y.choices?a("div",{staticClass:"outputs-section"},n._l(n.selectedSpan.parsedContent.outputs.choices,function(x,S){return a("div",{key:S,staticClass:"choice-item"},[a("div",{staticClass:"choice-header"},[a("span",[n._v("Choice "+n._s(S))])]),a("div",{staticClass:"choice-content"},[x.message?a("div",[a("div",{staticClass:"message-header"},[a("i",{staticClass:"el-icon-user message-icon"}),a("span",[n._v(n._s(x.message.role))])]),a("div",{staticClass:"structured-content"},n._l(n.renderStructuredContent(x.message.content),function(A){return a("div",{key:A.key,staticClass:"content-element"},[A.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(A.content)}}):A.type==="image"?a("div",{staticClass:"image-content"},[A.label?a("div",{staticClass:"image-label"},[n._v(n._s(A.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:A.url,alt:"content image"},on:{click:function(E){return n.handleImageClick(A.url)}}})]):n._e()])}),0)]):a("div",{staticClass:"structured-content"},n._l(n.renderStructuredContent(x),function(A){return a("div",{key:A.key,staticClass:"content-element"},[A.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(A.content)}}):A.type==="image"?a("div",{staticClass:"image-content"},[A.label?a("div",{staticClass:"image-label"},[n._v(n._s(A.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:A.url,alt:"content image"},on:{click:function(E){return n.handleImageClick(A.url)}}})]):n._e()])}),0)])])}),0):(m=n.selectedSpan.parsedContent)!=null&&m.outputs?a("div",{staticClass:"structured-content"},n._l(n.renderStructuredContent(n.selectedSpan.parsedContent.outputs),function(x){return a("div",{key:x.key,staticClass:"content-element"},[x.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(x.content)}}):x.type==="image"?a("div",{staticClass:"image-content"},[x.label?a("div",{staticClass:"image-label"},[n._v(n._s(x.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:x.url,alt:"content image"},on:{click:function(S){return n.handleImageClick(x.url)}}})]):n._e()])}),0):a("div",{staticClass:"empty-content"},[a("el-empty",{attrs:{description:n.$t("trace.noOutputs"),"image-size":80}})],1)])],1)],1):n._e(),!n.hasInputs&&!n.hasOutputs?a("div",{staticClass:"empty-io"},[a("el-empty",{attrs:{description:n.$t("trace.noIoData")}})],1):n._e()])]):n._e(),a("el-tab-pane",{attrs:{label:n.$t("trace.attributes"),name:"attributes"}},[a("el-table",{staticClass:"attributes-table",attrs:{data:n.attributesData,border:"",stripe:""}},[a("el-table-column",{attrs:{prop:"key",label:n.$t("trace.key"),width:"250"},scopedSlots:n._u([{key:"default",fn:function(x){return[a("el-tooltip",{attrs:{content:x.row.key,placement:"top","open-delay":500,"popper-class":"attribute-tooltip"}},[a("span",{staticClass:"attribute-key"},[n._v(n._s(x.row.key))])])]}}],null,!1,688878823)}),a("el-table-column",{attrs:{prop:"value",label:n.$t("trace.value")},scopedSlots:n._u([{key:"default",fn:function(x){return[a("el-tooltip",{attrs:{placement:"top","open-delay":500,"popper-class":"attribute-tooltip"}},[a("div",{staticClass:"attribute-tooltip-content",attrs:{slot:"content"},slot:"content"},[n._v(n._s(x.row.value))]),a("div",{staticClass:"attribute-value"},[n._v(n._s(x.row.value))])])]}}],null,!1,4281519148)})],1)],1),n.showIOTab?a("el-tab-pane",{attrs:{label:n.$t("trace.rawInputsOutputs"),name:"raw"}},[n.activeTab==="raw"?a("div",{staticClass:"raw-io-content"},[n.rawInputs?a("div",{staticClass:"raw-io-section"},[a("el-collapse",{model:{value:n.rawIoCollapse,callback:function(x){n.rawIoCollapse=x},expression:"rawIoCollapse"}},[a("el-collapse-item",{attrs:{title:n.$t("trace.rawInputs"),name:"rawInputs"}},[a("codemirror",{key:`raw-inputs-${n.selectedSpanId}-${n.rawInputsKey}`,staticClass:"code-editor-wrapper",attrs:{value:n.formatRawJson(n.rawInputs),options:n.cmOptions}})],1)],1)],1):n._e(),n.rawOutputs?a("div",{staticClass:"raw-io-section"},[a("el-collapse",{model:{value:n.rawIoCollapse,callback:function(x){n.rawIoCollapse=x},expression:"rawIoCollapse"}},[a("el-collapse-item",{attrs:{title:n.$t("trace.rawOutputs"),name:"rawOutputs"}},[a("codemirror",{key:`raw-outputs-${n.selectedSpanId}-${n.rawOutputsKey}`,staticClass:"code-editor-wrapper",attrs:{value:n.formatRawJson(n.rawOutputs),options:n.cmOptions}})],1)],1)],1):n._e(),!n.rawInputs&&!n.rawOutputs?a("div",{staticClass:"empty-raw-io"},[a("el-empty",{attrs:{description:n.$t("trace.noIoData")}})],1):n._e()]):n._e()]):n._e(),n.showDebugTab?a("el-tab-pane",{attrs:{label:"快速调试",name:"debug"}},[a("DebugTab",{directives:[{name:"show",rawName:"v-show",value:n.activeTab==="debug",expression:"activeTab === 'debug'"}],attrs:{"selected-span":n.selectedSpan,"selected-span-id":n.selectedSpanId}})],1):n._e(),n.hasEvents?a("el-tab-pane",{attrs:{label:n.$t("trace.events"),name:"events"}},[n.activeTab==="events"?a("div",{staticClass:"events-content"},[a("el-collapse",{model:{value:n.eventsCollapse,callback:function(x){n.eventsCollapse=x},expression:"eventsCollapse"}},n._l(n.spanEvents,function(x,S){return a("el-collapse-item",{key:`event-${S}`,attrs:{name:`event-${S}`}},[a("template",{slot:"title"},[a("div",{staticClass:"event-header"},[a("el-tag",{staticClass:"event-name-tag",attrs:{type:x.name==="exception"?"danger":"info",size:"mini"}},[n._v(" "+n._s(x.name)+" ")]),a("span",{staticClass:"event-time"},[n._v(n._s(n.formatEventTimestamp(x.timestamp)))])],1)]),a("div",{staticClass:"event-detail"},[x.name==="exception"?a("div",{staticClass:"exception-content"},[x.attributes["exception.type"]?a("div",{staticClass:"exception-field"},[a("div",{staticClass:"field-label"},[n._v(n._s(n.$t("trace.exceptionType")))]),a("div",{staticClass:"field-value exception-type"},[n._v(n._s(x.attributes["exception.type"]))])]):n._e(),x.attributes["exception.message"]?a("div",{staticClass:"exception-field"},[a("div",{staticClass:"field-label"},[n._v(n._s(n.$t("trace.exceptionMessage")))]),a("div",{staticClass:"field-value exception-message"},[n._v(n._s(x.attributes["exception.message"]))])]):n._e(),x.attributes["exception.stacktrace"]?a("div",{staticClass:"exception-field"},[a("div",{staticClass:"field-label"},[n._v(n._s(n.$t("trace.exceptionStacktrace")))]),a("codemirror",{key:`stacktrace-${n.selectedSpanId}-${S}-${n.eventsKey}`,staticClass:"code-editor-wrapper stacktrace-editor",attrs:{value:x.attributes["exception.stacktrace"],options:n.cmOptionsJava}})],1):n._e(),n.getOtherEventAttributes(x).length>0?a("div",{staticClass:"exception-field"},[a("div",{staticClass:"field-label"},[n._v(n._s(n.$t("trace.otherAttributes")))]),a("el-table",{attrs:{data:n.getOtherEventAttributes(x),border:"",stripe:"",size:"mini"}},[a("el-table-column",{attrs:{prop:"key",label:n.$t("trace.key"),width:"200"}}),a("el-table-column",{attrs:{prop:"value",label:n.$t("trace.value")}})],1)],1):n._e()]):a("div",{staticClass:"general-event-content"},[a("el-table",{attrs:{data:n.getEventAttributesData(x),border:"",stripe:"",size:"mini"}},[a("el-table-column",{attrs:{prop:"key",label:n.$t("trace.key"),width:"200"},scopedSlots:n._u([{key:"default",fn:function(A){return[a("el-tooltip",{attrs:{content:A.row.key,placement:"top","open-delay":500}},[a("span",{staticClass:"attribute-key"},[n._v(n._s(A.row.key))])])]}}],null,!0)}),a("el-table-column",{attrs:{prop:"value",label:n.$t("trace.value")},scopedSlots:n._u([{key:"default",fn:function(A){return[a("el-tooltip",{attrs:{placement:"top","open-delay":500,"popper-class":"attribute-tooltip"}},[a("div",{staticClass:"attribute-tooltip-content",attrs:{slot:"content"},slot:"content"},[n._v(n._s(A.row.value))]),a("div",{staticClass:"attribute-value"},[n._v(n._s(A.row.value))])])]}}],null,!0)})],1)],1)])],2)}),1),n.spanEvents.length===0?a("div",{staticClass:"empty-events"},[a("el-empty",{attrs:{description:n.$t("trace.noEvents")}})],1):n._e()],1):n._e()]):n._e()],1)],1):a("el-empty",{attrs:{description:n.$t("trace.selectSpan")}})],1)],1)],1)],1):n._e()])},qp=[],Up=An(Wp,jp,qp,!1,null,"9a36c3d5");const Gp={name:"Trace",components:{TraceDetailDrawer:Up.exports},data(){return{traceList:[],filteredTraceList:[],searchQuery:"",dateRange:null,experimentList:[],selectedExperimentId:null,loading:!1,deleteLoading:!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:"",spanHasEvents:null,selectedSpanId:null,selectedSpan:null,activeTab:"io",drawerLoading:!1,spanPageNum:1,spanPageSize:100,spanHasNextPage:!1,spanLoadMoreLoading:!1,messageCollapse:[],eventsCollapse:[],pageNum:1,pageSize:10,total:0,autoRefreshEnabled:!1,autoRefreshInterval:10,autoRefreshTimer:null,pickerOptions:{shortcuts:[{text:"近7天",onClick(u){const n=new Date,a=new Date;a.setTime(a.getTime()-3600*1e3*24*7),u.$emit("pick",[a,n])}},{text:"近30天",onClick(u){const n=new Date,a=new Date;a.setTime(a.getTime()-3600*1e3*24*30),u.$emit("pick",[a,n])}},{text:"7天前",onClick(u){const n=new Date;n.setTime(n.getTime()-3600*1e3*24*7),n.setHours(23,59,59,999);const a=n.getTime();u.$emit("pick",[null,a])}},{text:"30天前",onClick(u){const n=new Date;n.setTime(n.getTime()-3600*1e3*24*30),n.setHours(23,59,59,999);const a=n.getTime();u.$emit("pick",[null,a])}}]}}},computed:{},watch:{autoRefreshEnabled(u){u?this.startAutoRefresh():this.stopAutoRefresh()},spanHasEvents(){this.currentTraceId&&this.handleSpanSearch(this.spanSearchQuery)}},mounted(){this.loadExperiments(),this.loadTraceList()},beforeDestroy(){this.stopAutoRefresh()},methods:{async loadTraceList(){this.loading=!0;try{let u=null,n=null;this.dateRange&&Array.isArray(this.dateRange)&&(this.dateRange.length===2?(this.dateRange[0]!==null&&this.dateRange[0]!==void 0&&this.dateRange[0]!==""&&(u=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]!==""&&(n=typeof this.dateRange[1]=="number"?this.dateRange[1]:parseInt(this.dateRange[1],10))):this.dateRange.length===1&&this.dateRange[0]!==null&&(n=typeof this.dateRange[0]=="number"?this.dateRange[0]:parseInt(this.dateRange[0],10)));const a=await tn.getTraceList(this.searchQuery,u,n,this.pageNum,this.pageSize,this.selectedExperimentId),o=Array.isArray(a==null?void 0:a.list)?a.list:[];this.traceList=o,this.filteredTraceList=o,this.total=parseInt((a==null?void 0:a.total)||0,10)}catch(u){console.error("Failed to load trace list:",u),this.$message.error("加载 trace 列表失败"),this.traceList=[],this.filteredTraceList=[],this.total=0}finally{this.loading=!1}},refresh(){this.loadTraceList()},startAutoRefresh(){this.stopAutoRefresh();const u=this.autoRefreshInterval*1e3;this.autoRefreshTimer=setInterval(()=>{this.loadTraceList()},u)},stopAutoRefresh(){this.autoRefreshTimer&&(clearInterval(this.autoRefreshTimer),this.autoRefreshTimer=null)},handleAutoRefreshIntervalChange(){this.autoRefreshEnabled&&this.startAutoRefresh()},handleRowClick(u){this.viewDetail(u.trace_id)},viewDetail(u){this.currentTraceId=u,this.loadTraceDetail(u),this.drawerVisible=!0},async loadTraceDetail(u){var n,a,o;this.drawerLoading=!0,this.spanPageNum=1;try{const[f,d]=await Promise.all([tn.getTraceDetail(u),tn.getTraceSpans(u,{query:this.spanSearchQuery||"",has_events:this.spanHasEvents===!0?!0:void 0,page_num:1,page_size:this.spanPageSize})]);this.traceInfo=f||{};const p=Array.isArray(d==null?void 0:d.list)?d.list:[];if(this.spans=p,this.filteredSpans=p,this.spanHasNextPage=(d==null?void 0:d.has_next_page)===!0,this.spans.length>0){this.selectedSpanId=this.spans[0].span_id,this.selectedSpan=this.spans[0],await this.loadSpanContent(this.spans[0]);const y=this.spans[0].type==="CLIENT"||this.spans[0].type==="EMBEDDING"||this.spans[0].type==="CHAT_MODEL",m=this.selectedSpan.has_events===!0,x=[];y&&x.push("io","raw"),x.push("attributes"),m&&x.push("events");let S="attributes";y&&(S="io"),x.includes(S)?this.activeTab=S:this.activeTab="attributes",(a=(n=this.selectedSpan.parsedContent)==null?void 0:n.inputs)!=null&&a.messages?this.messageCollapse=this.selectedSpan.parsedContent.inputs.messages.map((E,H)=>`message-${H}`):this.messageCollapse=[];const A=(o=this.selectedSpan.parsedContent)==null?void 0:o.events;A&&Array.isArray(A)&&A.length>0?this.eventsCollapse=A.map((E,H)=>`event-${H}`):this.eventsCollapse=[]}}catch(f){console.error("Failed to load trace detail:",f),this.$message.error("加载 trace 详情失败"),this.traceInfo={},this.spans=[],this.filteredSpans=[],this.spanHasNextPage=!1}finally{this.drawerLoading=!1}},async handleSpanSearch(u){if(this.spanSearchQuery=u,!!this.currentTraceId){this.spanPageNum=1;try{const n=await tn.getTraceSpans(this.currentTraceId,{query:u||"",has_events:this.spanHasEvents===!0?!0:void 0,page_num:1,page_size:this.spanPageSize}),a=Array.isArray(n==null?void 0:n.list)?n.list:[];this.spans=a,this.filteredSpans=a,this.spanHasNextPage=(n==null?void 0:n.has_next_page)===!0,this.spans.length>0&&!this.selectedSpanId&&(this.selectedSpanId=this.spans[0].span_id,this.selectedSpan=this.spans[0],await this.loadSpanContent(this.spans[0]))}catch(n){console.error("Failed to search spans:",n),this.spans=[],this.filteredSpans=[],this.spanHasNextPage=!1}}},async loadMoreSpans(){if(!(!this.currentTraceId||!this.spanHasNextPage||this.spanLoadMoreLoading)){this.spanLoadMoreLoading=!0;try{const u=this.spanPageNum+1,n=await tn.getTraceSpans(this.currentTraceId,{query:this.spanSearchQuery||"",has_events:this.spanHasEvents===!0?!0:void 0,page_num:u,page_size:this.spanPageSize}),a=Array.isArray(n==null?void 0:n.list)?n.list:[];this.spans=this.spans.concat(a),this.filteredSpans=this.spans,this.spanPageNum=u,this.spanHasNextPage=(n==null?void 0:n.has_next_page)===!0}catch(u){console.error("Failed to load more spans:",u)}finally{this.spanLoadMoreLoading=!1}}},async handleSpanSelect(u){var p,y,m;this.selectedSpanId=u.span_id,this.selectedSpan=u,await this.loadSpanContent(u);const n=u.type==="CLIENT"||u.type==="EMBEDDING"||u.type==="CHAT_MODEL",a=u.has_events===!0,o=[];n&&o.push("io","raw"),o.push("attributes"),a&&o.push("events");let f="attributes";n&&(f="io"),this.$nextTick(()=>{o.includes(f)?this.activeTab=f:this.activeTab="attributes"}),(y=(p=this.selectedSpan.parsedContent)==null?void 0:p.inputs)!=null&&y.messages?this.messageCollapse=this.selectedSpan.parsedContent.inputs.messages.map((x,S)=>`message-${S}`):this.messageCollapse=[];const d=(m=this.selectedSpan.parsedContent)==null?void 0:m.events;d&&Array.isArray(d)&&d.length>0?this.eventsCollapse=d.map((x,S)=>`event-${S}`):this.eventsCollapse=[]},async loadSpanContent(u){if(!(!this.currentTraceId||!u.span_id||u.parsedContent))try{const n=await tn.getSpanContent(this.currentTraceId,u.span_id);if(n){const a=this.parseContentData(n);this.$set(u,"parsedContent",a)}}catch(n){console.error("Failed to load span content:",n)}},parseContentData(u){const n={attributes:u.attributes||{},events:u.events||[],status:u.status||{}};if(u.inputs&&(n.inputs=u.inputs),u.outputs&&(n.outputs=u.outputs),n.attributes){const a=n.attributes["langsword.spanInputs"],o=n.attributes["langsword.spanOutputs"];if(a)try{n.inputs=typeof a=="string"?JSON.parse(a):a}catch{try{const d=a.replace(/\\"/g,'"').replace(/^"|"$/g,"");n.inputs=JSON.parse(d)}catch{n.inputs=a}}if(o)try{n.outputs=typeof o=="string"?JSON.parse(o):o}catch{try{const d=o.replace(/\\"/g,'"').replace(/^"|"$/g,"");n.outputs=JSON.parse(d)}catch{n.outputs=o}}}return n},handleDrawerClose(){this.currentTraceId=null,this.traceInfo={},this.spans=[],this.filteredSpans=[],this.selectedSpanId=null,this.selectedSpan=null,this.spanSearchQuery="",this.spanHasEvents=null,this.spanPageNum=1,this.spanHasNextPage=!1,this.spanLoadMoreLoading=!1,this.eventsCollapse=[],this.drawerLoading=!1},async loadExperiments(){try{const u=await tn.getExperiments();this.experimentList=Array.isArray(u)?u:[]}catch(u){console.error("Failed to load experiments:",u),this.experimentList=[]}},handleExperimentChange(){this.pageNum=1,this.loadTraceList()},handleSearch(){this.pageNum=1,this.loadTraceList()},handleSearchClear(){this.searchQuery="",this.pageNum=1,this.loadTraceList()},handleDateRangeChange(u){this.pageNum=1,u&&Array.isArray(u)?u.length===2&&(u[0]===null||u[0]===void 0)?this.dateRange=[null,u[1]]:this.dateRange=u:this.dateRange=u,this.loadTraceList()},handleSizeChange(u){this.pageSize=u,this.pageNum=1,this.loadTraceList()},handleCurrentChange(u){this.pageNum=u,this.loadTraceList()},async handleBatchDelete(){var d,p;const u=this.searchQuery&&this.searchQuery.trim(),n=this.dateRange&&Array.isArray(this.dateRange)&&(this.dateRange.length===2&&this.dateRange[1]!==null||this.dateRange.length===1&&this.dateRange[0]!==null),a=this.selectedExperimentId;let o="",f="warning";if(!u&&!n&&!a)o=this.$t("trace.deleteAllWarning"),f="error";else{if(o=this.$t("trace.deleteConfirmMessage")+`
79
79
  `,a){const y=this.experimentList.find(x=>x.experiment_id===this.selectedExperimentId),m=y?y.name:this.selectedExperimentId;o+=`${this.$t("trace.application")}: ${m}
80
80
  `}if(u&&(o+=`${this.$t("trace.searchCondition")}: ${this.searchQuery}
81
81
  `),n){const y=this.$i18n.locale==="zh-CN"?"zh-CN":"en-US";let m="";if(this.dateRange.length===2&&this.dateRange[1]!==null?m=new Date(this.dateRange[1]).toLocaleString(y):this.dateRange.length===1&&this.dateRange[0]!==null&&(m=new Date(this.dateRange[0]).toLocaleString(y)),this.dateRange.length===2&&this.dateRange[0]!==null&&this.dateRange[0]!==void 0&&this.dateRange[0]!==""){const x=new Date(this.dateRange[0]).toLocaleString(y);o+=`${this.$t("trace.timeRange")}: ${x} ${this.$t("trace.to")} ${m}
82
82
  `}else this.$i18n.locale==="zh-CN"?o+=`${this.$t("trace.timeRange")}: ${this.$t("trace.before")} ${m} 之前
83
83
  `:o+=`${this.$t("trace.timeRange")}: ${this.$t("trace.before")} ${m}
84
- `}o+=this.$t("trace.deleteConfirmFooter")}try{await this.$confirm(o,this.$t("trace.confirmDelete"),{confirmButtonText:this.$t("trace.confirmDeleteButton"),cancelButtonText:this.$t("common.cancel"),type:f,dangerouslyUseHTMLString:!1}),this.deleteLoading=!0;let y=null,m=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]!==""&&(m=typeof this.dateRange[1]=="number"?this.dateRange[1]:parseInt(this.dateRange[1],10))):this.dateRange.length===1&&this.dateRange[0]!==null&&(m=typeof this.dateRange[0]=="number"?this.dateRange[0]:parseInt(this.dateRange[0],10))),await xn.deleteTraces(u?this.searchQuery:null,y,m,this.selectedExperimentId),this.$message.success(this.$t("trace.deleteSuccess")),await this.loadTraceList()}catch(y){if(y!=="cancel"){console.error("Failed to delete traces:",y);const m=((p=(d=y.response)==null?void 0:d.data)==null?void 0:p.message)||y.message||this.$t("trace.unknownError");this.$message.error(`${this.$t("trace.deleteFailed")}: ${m}`)}}finally{this.deleteLoading=!1}},getStatusType(u){return{OK:"success",ERROR:"danger",IN_PROGRESS:"warning",UNSET:"info"}[u]||"info"},formatDateTime(u){if(!u)return"-";const n=typeof u=="string"?parseInt(u,10):u;if(isNaN(n))return"-";const a=new Date(n);if(isNaN(a.getTime()))return"-";const o=a.getFullYear(),f=String(a.getMonth()+1).padStart(2,"0"),d=String(a.getDate()).padStart(2,"0"),p=String(a.getHours()).padStart(2,"0"),y=String(a.getMinutes()).padStart(2,"0"),m=String(a.getSeconds()).padStart(2,"0");return`${o}-${f}-${d} ${p}:${y}:${m}`},formatTimeAgo(u){if(!u)return"-";const n=typeof u=="string"?parseInt(u,10):u;if(isNaN(n))return"-";const o=Date.now()-n,f=this.$i18n.locale==="zh-CN",d=Math.floor(o/(1e3*60*60*24));if(d>0)return f?`${d} 天前`:`${d} days ago`;const p=Math.floor(o/(1e3*60*60));if(p>0)return f?`${p} 小时前`:`${p} hours ago`;const y=Math.floor(o/(1e3*60));return y>0?f?`${y} 分钟前`:`${y} minutes ago`:f?"刚刚":"Just now"},formatNanoDuration(u){if(!u)return"-";const n=u/1e6;return n<1e3?`${n.toFixed(2)}ms`:n<6e4?`${(n/1e3).toFixed(2)}s`:`${(n/6e4).toFixed(2)}min`},formatJson(u){return u?JSON.stringify(u,null,2):""},formatRawJson(u){if(!u)return"";if(typeof u=="string")try{const n=JSON.parse(u);return JSON.stringify(n,null,2)}catch{try{const a=u.replace(/\\"/g,'"').replace(/^"|"$/g,""),o=JSON.parse(a);return JSON.stringify(o,null,2)}catch{return u}}return JSON.stringify(u,null,2)},handleCodeMirrorReady(u){this.$nextTick(()=>{u&&u.refresh()})},formatMessageContent(u){return typeof u=="string"?u:JSON.stringify(u,null,2)},formatEventTime(u){if(u.time_unix_nano){const n=u.time_unix_nano/1e6;return new Date(n).toLocaleString("zh-CN")}return u.timestamp?new Date(u.timestamp).toLocaleString("zh-CN"):"-"},tableRowClassName({row:u,rowIndex:n}){return"trace-row"},getIndex(u){return(this.pageNo-1)*this.pageSize+u+1},applyColumns(){const u={};this.selectedColumns.forEach(n=>{u[n]=!0}),Object.keys(this.visibleColumns).forEach(n=>{this.selectedColumns.includes(n)||(u[n]=!1)}),this.visibleColumns=u,this.showColumnDialog=!1}}};var qp=function(){var n=this,a=n._self._c;return a("div",{staticClass:"trace-list-container"},[a("el-card",[a("div",{staticClass:"trace-content-wrapper"},[a("div",{staticClass:"trace-toolbar"},[a("el-select",{staticClass:"toolbar-select",attrs:{placeholder:n.$t("trace.selectApplication"),clearable:"",size:"mini"},on:{change:n.handleExperimentChange},model:{value:n.selectedExperimentId,callback:function(o){n.selectedExperimentId=o},expression:"selectedExperimentId"}},n._l(n.experimentList,function(o){return a("el-option",{key:o.experiment_id,attrs:{label:o.name,value:o.experiment_id}})}),1),a("el-input",{staticClass:"toolbar-input",attrs:{placeholder:n.$t("trace.searchPlaceholder"),"prefix-icon":"el-icon-search",clearable:"",size:"mini"},on:{clear:n.handleSearchClear,input:n.handleSearch},model:{value:n.searchQuery,callback:function(o){n.searchQuery=o},expression:"searchQuery"}}),a("el-date-picker",{staticClass:"toolbar-date-picker",attrs:{type:"datetimerange","range-separator":n.$t("trace.to"),"start-placeholder":n.$t("trace.startTime"),"end-placeholder":n.$t("trace.endTime"),"value-format":"timestamp",format:"yyyy-MM-dd HH:mm:ss",size:"mini","picker-options":n.pickerOptions,clearable:""},on:{change:n.handleDateRangeChange},model:{value:n.dateRange,callback:function(o){n.dateRange=o},expression:"dateRange"}}),a("el-button",{attrs:{type:"danger",icon:"el-icon-delete",size:"mini",disabled:n.deleteLoading},on:{click:n.handleBatchDelete}},[n._v(" "+n._s(n.$t("trace.batchDelete"))+" ")]),a("el-tooltip",{attrs:{content:n.$t("common.refresh"),placement:"top"}},[a("el-button",{attrs:{icon:"el-icon-refresh",size:"mini",circle:""},on:{click:n.refresh}})],1),a("el-button",{attrs:{icon:"el-icon-setting",size:"mini"},on:{click:function(o){n.showColumnDialog=!0}}},[n._v(" "+n._s(n.$t("common.columns"))+" ")])],1),a("div",{staticClass:"trace-table-wrapper"},[a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:n.loading,expression:"loading"}],staticStyle:{width:"100%"},attrs:{data:n.filteredTraceList,size:"mini",stripe:"","row-class-name":n.tableRowClassName},on:{"row-click":n.handleRowClick}},[a("el-table-column",{attrs:{type:"index",label:"#",width:"60",index:n.getIndex}}),n.visibleColumns.trace_id?a("el-table-column",{attrs:{prop:"trace_id",label:n.$t("trace.requestId"),width:"280","show-overflow-tooltip":""},scopedSlots:n._u([{key:"default",fn:function(o){return[a("el-link",{attrs:{type:"primary"},on:{click:function(f){return f.stopPropagation(),n.viewDetail(o.row.trace_id)}}},[n._v(" "+n._s(o.row.trace_id)+" ")])]}}],null,!1,1400187371)}):n._e(),n.visibleColumns.trace_name?a("el-table-column",{attrs:{prop:"trace_name",label:n.$t("trace.traceName"),"min-width":"300","show-overflow-tooltip":""},scopedSlots:n._u([{key:"default",fn:function(o){return[a("span",[n._v(n._s(o.row.trace_name||"-"))])]}}],null,!1,3633653970)}):n._e(),n.visibleColumns.trace_type?a("el-table-column",{attrs:{prop:"trace_type",label:n.$t("trace.traceType"),width:"120"},scopedSlots:n._u([{key:"default",fn:function(o){return[a("el-tag",{attrs:{size:"mini",type:"info"}},[n._v(n._s(o.row.trace_type||"-"))])]}}],null,!1,1175446173)}):n._e(),n.visibleColumns.execution_time_ms?a("el-table-column",{attrs:{prop:"execution_time_ms",label:n.$t("trace.executionTime"),width:"120"},scopedSlots:n._u([{key:"default",fn:function(o){return[n._v(" "+n._s(n.formatNanoDuration(o.row.execution_time_ms))+" ")]}}],null,!1,1733254102)}):n._e(),n.visibleColumns.status?a("el-table-column",{attrs:{prop:"status",label:n.$t("trace.status"),width:"100"},scopedSlots:n._u([{key:"default",fn:function(o){return[a("el-tag",{attrs:{type:n.getStatusType(o.row.status),size:"mini"}},[o.row.status==="OK"?a("i",{staticClass:"el-icon-success"}):n._e(),n._v(" "+n._s(o.row.status)+" ")])]}}],null,!1,3672547022)}):n._e(),n.visibleColumns.timestamp_ms?a("el-table-column",{attrs:{prop:"timestamp_ms",label:n.$t("trace.timeCreated"),width:"180"},scopedSlots:n._u([{key:"default",fn:function(o){return[n._v(" "+n._s(n.formatDateTime(o.row.timestamp_ms))+" ")]}}],null,!1,1082702673)}):n._e(),a("el-table-column",{attrs:{label:n.$t("common.operation"),width:"100",fixed:"right"},scopedSlots:n._u([{key:"default",fn:function(o){return[a("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(f){return f.stopPropagation(),n.viewDetail(o.row.trace_id)}}},[n._v(" "+n._s(n.$t("common.viewDetail"))+" ")])]}}])})],1)],1),a("div",{staticClass:"trace-pagination-wrapper"},[n.total>0?a("el-pagination",{staticClass:"trace-pagination",attrs:{"current-page":n.pageNo,"page-sizes":[10,20,50,100],"page-size":n.pageSize,size:"mini",layout:"total, prev, pager, next, sizes, jumper",total:n.total,background:""},on:{"size-change":n.handleSizeChange,"current-change":n.handleCurrentChange}}):n._e()],1)])]),a("el-dialog",{attrs:{title:n.$t("trace.selectColumns"),visible:n.showColumnDialog,width:"400px"},on:{"update:visible":function(o){n.showColumnDialog=o}}},[a("el-checkbox-group",{model:{value:n.selectedColumns,callback:function(o){n.selectedColumns=o},expression:"selectedColumns"}},[a("el-checkbox",{attrs:{label:"trace_id"}},[n._v(n._s(n.$t("trace.requestId")))]),a("el-checkbox",{attrs:{label:"timestamp_ms"}},[n._v(n._s(n.$t("trace.timeCreated")))]),a("el-checkbox",{attrs:{label:"status"}},[n._v(n._s(n.$t("trace.status")))]),a("el-checkbox",{attrs:{label:"execution_time_ms"}},[n._v(n._s(n.$t("trace.executionTime")))]),a("el-checkbox",{attrs:{label:"trace_type"}},[n._v(n._s(n.$t("trace.traceType")))]),a("el-checkbox",{attrs:{label:"trace_name"}},[n._v(n._s(n.$t("trace.traceName")))])],1),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{attrs:{size:"mini"},on:{click:function(o){n.showColumnDialog=!1}}},[n._v(n._s(n.$t("common.cancel")))]),a("el-button",{attrs:{size:"mini",type:"primary"},on:{click:n.applyColumns}},[n._v(n._s(n.$t("common.confirm")))])],1)],1),a("TraceDetailDrawer",{attrs:{visible:n.drawerVisible,"current-trace-id":n.currentTraceId,"trace-info":n.traceInfo,spans:n.spans,"filtered-spans":n.filteredSpans,"selected-span-id":n.selectedSpanId,"selected-span":n.selectedSpan,loading:n.drawerLoading},on:{"update:visible":[function(o){n.drawerVisible=o},function(o){n.drawerVisible=o}],close:n.handleDrawerClose,"span-search":n.handleSpanSearch,"span-select":n.handleSpanSelect}})],1)},Gp=[],Kp=An(Up,qp,Gp,!1,null,"ca175755");const ls=Kp.exports,Bl={routes:[{path:"/trace",name:"trace",component:ls}],beforeEach:(u,n,a)=>{a()}},Hl={common:{home:"首页",todos:"待办事项",trace:"追踪",login:"登录",logout:"退出",user:"用户",search:"搜索",refresh:"刷新",columns:"列设置",confirm:"确定",cancel:"取消",operation:"操作",viewDetail:"查看详情",language:"语言"},span:{searchTree:"Span名称/Span类型"},trace:{title:"追踪列表",searchPlaceholder:"追踪ID/追踪名称/追踪类型",requestId:"追踪ID",timeCreated:"创建时间",status:"状态",executionTime:"执行时长",traceType:"追踪类型",traceName:"追踪名称",traceDetail:"追踪详情",traceId:"追踪ID",clientRequestId:"客户端请求ID",experimentId:"应用ID",application:"应用",selectApplication:"请选择应用",spanDetail:"Span 详情",inputs:"输入",outputs:"输出",attributes:"属性",rawInputsOutputs:"原始输入输出",rawInputs:"原始输入",rawOutputs:"原始输出",events:"事件",selectSpan:"请选择一个 Span 查看详情",noInputs:"暂无输入数据",noOutputs:"暂无输出数据",noIoData:"暂无输入输出数据",noEvents:"暂无事件数据",exceptionType:"异常类型",exceptionMessage:"异常消息",exceptionStacktrace:"异常堆栈",otherAttributes:"其他属性",key:"键",value:"值",selectColumns:"选择列",batchDelete:"批量删除",startTime:"开始时间",endTime:"结束时间",to:"至",confirmDelete:"确认删除",confirmDeleteButton:"确定删除",deleteAllWarning:`警告:您没有设置任何查询条件,这将删除所有 trace 数据!
84
+ `}o+=this.$t("trace.deleteConfirmFooter")}try{await this.$confirm(o,this.$t("trace.confirmDelete"),{confirmButtonText:this.$t("trace.confirmDeleteButton"),cancelButtonText:this.$t("common.cancel"),type:f,dangerouslyUseHTMLString:!1}),this.deleteLoading=!0;let y=null,m=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]!==""&&(m=typeof this.dateRange[1]=="number"?this.dateRange[1]:parseInt(this.dateRange[1],10))):this.dateRange.length===1&&this.dateRange[0]!==null&&(m=typeof this.dateRange[0]=="number"?this.dateRange[0]:parseInt(this.dateRange[0],10))),await tn.deleteTraces(u?this.searchQuery:null,y,m,this.selectedExperimentId),this.$message.success(this.$t("trace.deleteSuccess")),await this.loadTraceList()}catch(y){if(y!=="cancel"){console.error("Failed to delete traces:",y);const m=((p=(d=y.response)==null?void 0:d.data)==null?void 0:p.message)||y.message||this.$t("trace.unknownError");this.$message.error(`${this.$t("trace.deleteFailed")}: ${m}`)}}finally{this.deleteLoading=!1}},getStatusType(u){return{OK:"success",ERROR:"danger",IN_PROGRESS:"warning",UNSET:"info"}[u]||"info"},formatDateTime(u){if(!u)return"-";const n=typeof u=="string"?parseInt(u,10):u;if(isNaN(n))return"-";const a=new Date(n);if(isNaN(a.getTime()))return"-";const o=a.getFullYear(),f=String(a.getMonth()+1).padStart(2,"0"),d=String(a.getDate()).padStart(2,"0"),p=String(a.getHours()).padStart(2,"0"),y=String(a.getMinutes()).padStart(2,"0"),m=String(a.getSeconds()).padStart(2,"0");return`${o}-${f}-${d} ${p}:${y}:${m}`},formatTimeAgo(u){if(!u)return"-";const n=typeof u=="string"?parseInt(u,10):u;if(isNaN(n))return"-";const o=Date.now()-n,f=this.$i18n.locale==="zh-CN",d=Math.floor(o/(1e3*60*60*24));if(d>0)return f?`${d} 天前`:`${d} days ago`;const p=Math.floor(o/(1e3*60*60));if(p>0)return f?`${p} 小时前`:`${p} hours ago`;const y=Math.floor(o/(1e3*60));return y>0?f?`${y} 分钟前`:`${y} minutes ago`:f?"刚刚":"Just now"},formatNanoDuration(u){if(!u)return"-";const n=u/1e6;return n<1e3?`${n.toFixed(2)}ms`:n<6e4?`${(n/1e3).toFixed(2)}s`:`${(n/6e4).toFixed(2)}min`},formatJson(u){return u?JSON.stringify(u,null,2):""},formatRawJson(u){if(!u)return"";if(typeof u=="string")try{const n=JSON.parse(u);return JSON.stringify(n,null,2)}catch{try{const a=u.replace(/\\"/g,'"').replace(/^"|"$/g,""),o=JSON.parse(a);return JSON.stringify(o,null,2)}catch{return u}}return JSON.stringify(u,null,2)},handleCodeMirrorReady(u){this.$nextTick(()=>{u&&u.refresh()})},formatMessageContent(u){return typeof u=="string"?u:JSON.stringify(u,null,2)},formatEventTime(u){if(u.time_unix_nano){const n=u.time_unix_nano/1e6;return new Date(n).toLocaleString("zh-CN")}return u.timestamp?new Date(u.timestamp).toLocaleString("zh-CN"):"-"},tableRowClassName({row:u,rowIndex:n}){return"trace-row"},getIndex(u){return(this.pageNum-1)*this.pageSize+u+1},applyColumns(){const u={};this.selectedColumns.forEach(n=>{u[n]=!0}),Object.keys(this.visibleColumns).forEach(n=>{this.selectedColumns.includes(n)||(u[n]=!1)}),this.visibleColumns=u,this.showColumnDialog=!1}}};var Kp=function(){var n=this,a=n._self._c;return a("div",{staticClass:"trace-list-container"},[a("el-card",[a("div",{staticClass:"trace-content-wrapper"},[a("div",{staticClass:"trace-toolbar"},[a("el-select",{staticClass:"toolbar-select",attrs:{placeholder:n.$t("trace.selectApplication"),clearable:"",size:"mini"},on:{change:n.handleExperimentChange},model:{value:n.selectedExperimentId,callback:function(o){n.selectedExperimentId=o},expression:"selectedExperimentId"}},n._l(n.experimentList,function(o){return a("el-option",{key:o.experiment_id,attrs:{label:o.name,value:o.experiment_id}})}),1),a("el-input",{staticClass:"toolbar-input",attrs:{placeholder:n.$t("trace.searchPlaceholder"),"prefix-icon":"el-icon-search",clearable:"",size:"mini"},on:{clear:n.handleSearchClear,input:n.handleSearch},model:{value:n.searchQuery,callback:function(o){n.searchQuery=o},expression:"searchQuery"}}),a("el-date-picker",{staticClass:"toolbar-date-picker",attrs:{type:"datetimerange","range-separator":n.$t("trace.to"),"start-placeholder":n.$t("trace.startTime"),"end-placeholder":n.$t("trace.endTime"),"value-format":"timestamp",format:"yyyy-MM-dd HH:mm:ss",size:"mini","picker-options":n.pickerOptions,clearable:""},on:{change:n.handleDateRangeChange},model:{value:n.dateRange,callback:function(o){n.dateRange=o},expression:"dateRange"}}),a("el-button",{attrs:{type:"danger",icon:"el-icon-delete",size:"mini",disabled:n.deleteLoading},on:{click:n.handleBatchDelete}},[n._v(" "+n._s(n.$t("trace.batchDelete"))+" ")]),a("el-checkbox",{staticClass:"toolbar-auto-refresh",attrs:{size:"mini"},model:{value:n.autoRefreshEnabled,callback:function(o){n.autoRefreshEnabled=o},expression:"autoRefreshEnabled"}},[n._v(" "+n._s(n.$t("trace.autoRefresh"))+" ")]),n.autoRefreshEnabled?a("el-select",{staticClass:"toolbar-interval-select",attrs:{size:"mini"},on:{change:n.handleAutoRefreshIntervalChange},model:{value:n.autoRefreshInterval,callback:function(o){n.autoRefreshInterval=o},expression:"autoRefreshInterval"}},[a("el-option",{attrs:{label:n.$t("trace.refreshInterval5s"),value:5}}),a("el-option",{attrs:{label:n.$t("trace.refreshInterval10s"),value:10}}),a("el-option",{attrs:{label:n.$t("trace.refreshInterval20s"),value:20}})],1):n._e(),a("el-tooltip",{attrs:{content:n.$t("common.refresh"),placement:"top"}},[a("el-button",{attrs:{icon:"el-icon-refresh",size:"mini",circle:""},on:{click:n.refresh}})],1),a("el-button",{attrs:{icon:"el-icon-setting",size:"mini"},on:{click:function(o){n.showColumnDialog=!0}}},[n._v(" "+n._s(n.$t("common.columns"))+" ")])],1),a("div",{staticClass:"trace-table-wrapper"},[a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:n.loading,expression:"loading"}],staticStyle:{width:"100%"},attrs:{data:n.filteredTraceList,size:"mini",stripe:"","row-class-name":n.tableRowClassName},on:{"row-click":n.handleRowClick}},[a("el-table-column",{attrs:{type:"index",label:"#",width:"60",index:n.getIndex}}),n.visibleColumns.trace_id?a("el-table-column",{attrs:{prop:"trace_id",label:n.$t("trace.requestId"),width:"280","show-overflow-tooltip":""},scopedSlots:n._u([{key:"default",fn:function(o){return[a("el-link",{attrs:{type:"primary"},on:{click:function(f){return f.stopPropagation(),n.viewDetail(o.row.trace_id)}}},[n._v(" "+n._s(o.row.trace_id)+" ")])]}}],null,!1,1400187371)}):n._e(),n.visibleColumns.trace_name?a("el-table-column",{attrs:{prop:"trace_name",label:n.$t("trace.traceName"),"min-width":"300","show-overflow-tooltip":""},scopedSlots:n._u([{key:"default",fn:function(o){return[a("span",[n._v(n._s(o.row.trace_name||"-"))])]}}],null,!1,3633653970)}):n._e(),n.visibleColumns.trace_type?a("el-table-column",{attrs:{prop:"trace_type",label:n.$t("trace.traceType"),width:"120"},scopedSlots:n._u([{key:"default",fn:function(o){return[a("el-tag",{attrs:{size:"mini",type:"info"}},[n._v(n._s(o.row.trace_type||"-"))])]}}],null,!1,1175446173)}):n._e(),n.visibleColumns.execution_time_ms?a("el-table-column",{attrs:{prop:"execution_time_ms",label:n.$t("trace.executionTime"),width:"120"},scopedSlots:n._u([{key:"default",fn:function(o){return[n._v(" "+n._s(n.formatNanoDuration(o.row.execution_time_ms))+" ")]}}],null,!1,1733254102)}):n._e(),n.visibleColumns.status?a("el-table-column",{attrs:{prop:"status",label:n.$t("trace.status"),width:"100"},scopedSlots:n._u([{key:"default",fn:function(o){return[a("el-tag",{attrs:{type:n.getStatusType(o.row.status),size:"mini"}},[o.row.status==="OK"?a("i",{staticClass:"el-icon-success"}):n._e(),n._v(" "+n._s(o.row.status)+" ")])]}}],null,!1,3672547022)}):n._e(),n.visibleColumns.timestamp_ms?a("el-table-column",{attrs:{prop:"timestamp_ms",label:n.$t("trace.timeCreated"),width:"180"},scopedSlots:n._u([{key:"default",fn:function(o){return[n._v(" "+n._s(n.formatDateTime(o.row.timestamp_ms))+" ")]}}],null,!1,1082702673)}):n._e(),a("el-table-column",{attrs:{label:n.$t("common.operation"),width:"100",fixed:"right"},scopedSlots:n._u([{key:"default",fn:function(o){return[a("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(f){return f.stopPropagation(),n.viewDetail(o.row.trace_id)}}},[n._v(" "+n._s(n.$t("common.viewDetail"))+" ")])]}}])})],1)],1),a("div",{staticClass:"trace-pagination-wrapper"},[n.total>0?a("el-pagination",{staticClass:"trace-pagination",attrs:{"current-page":n.pageNum,"page-sizes":[10,20,50,100],"page-size":n.pageSize,size:"mini",layout:"total, prev, pager, next, sizes, jumper",total:n.total,background:""},on:{"size-change":n.handleSizeChange,"current-change":n.handleCurrentChange}}):n._e()],1)])]),a("el-dialog",{attrs:{title:n.$t("trace.selectColumns"),visible:n.showColumnDialog,width:"400px"},on:{"update:visible":function(o){n.showColumnDialog=o}}},[a("el-checkbox-group",{model:{value:n.selectedColumns,callback:function(o){n.selectedColumns=o},expression:"selectedColumns"}},[a("el-checkbox",{attrs:{label:"trace_id"}},[n._v(n._s(n.$t("trace.requestId")))]),a("el-checkbox",{attrs:{label:"timestamp_ms"}},[n._v(n._s(n.$t("trace.timeCreated")))]),a("el-checkbox",{attrs:{label:"status"}},[n._v(n._s(n.$t("trace.status")))]),a("el-checkbox",{attrs:{label:"execution_time_ms"}},[n._v(n._s(n.$t("trace.executionTime")))]),a("el-checkbox",{attrs:{label:"trace_type"}},[n._v(n._s(n.$t("trace.traceType")))]),a("el-checkbox",{attrs:{label:"trace_name"}},[n._v(n._s(n.$t("trace.traceName")))])],1),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{attrs:{size:"mini"},on:{click:function(o){n.showColumnDialog=!1}}},[n._v(n._s(n.$t("common.cancel")))]),a("el-button",{attrs:{size:"mini",type:"primary"},on:{click:n.applyColumns}},[n._v(n._s(n.$t("common.confirm")))])],1)],1),a("TraceDetailDrawer",{attrs:{visible:n.drawerVisible,"current-trace-id":n.currentTraceId,"trace-info":n.traceInfo,spans:n.spans,"filtered-spans":n.filteredSpans,"selected-span-id":n.selectedSpanId,"selected-span":n.selectedSpan,loading:n.drawerLoading,"span-has-next-page":n.spanHasNextPage,"span-load-more-loading":n.spanLoadMoreLoading,"span-has-events":n.spanHasEvents},on:{"update:visible":[function(o){n.drawerVisible=o},function(o){n.drawerVisible=o}],"update:spanHasEvents":function(o){n.spanHasEvents=o},"update:span-has-events":function(o){n.spanHasEvents=o},close:n.handleDrawerClose,"span-search":n.handleSpanSearch,"span-select":n.handleSpanSelect,"span-load-more":n.loadMoreSpans}})],1)},Xp=[],Yp=An(Gp,Kp,Xp,!1,null,"da4f034a");const ls=Yp.exports,ql={routes:[{path:"/trace",name:"trace",component:ls}],beforeEach:(u,n,a)=>{a()}},Ul={common:{home:"首页",todos:"待办事项",trace:"追踪",login:"登录",logout:"退出",user:"用户",search:"搜索",refresh:"刷新",columns:"列设置",confirm:"确定",cancel:"取消",operation:"操作",viewDetail:"查看详情",language:"语言"},span:{searchTree:"Span名称/Span类型",hasEvents:"是否有事件"},trace:{title:"追踪列表",searchPlaceholder:"追踪ID/追踪名称/追踪类型",requestId:"追踪ID",timeCreated:"创建时间",status:"状态",executionTime:"执行时长",traceType:"追踪类型",traceName:"追踪名称",traceDetail:"追踪详情",traceId:"追踪ID",clientRequestId:"客户端请求ID",experimentId:"应用ID",application:"应用",selectApplication:"请选择应用",spanDetail:"Span 详情",inputs:"输入",outputs:"输出",attributes:"属性",rawInputsOutputs:"原始输入输出",rawInputs:"原始输入",rawOutputs:"原始输出",events:"事件",selectSpan:"请选择一个 Span 查看详情",noInputs:"暂无输入数据",noOutputs:"暂无输出数据",noIoData:"暂无输入输出数据",noEvents:"暂无事件数据",exceptionType:"异常类型",exceptionMessage:"异常消息",exceptionStacktrace:"异常堆栈",otherAttributes:"其他属性",key:"键",value:"值",selectColumns:"选择列",batchDelete:"批量删除",startTime:"开始时间",endTime:"结束时间",to:"至",confirmDelete:"确认删除",confirmDeleteButton:"确定删除",deleteAllWarning:`警告:您没有设置任何查询条件,这将删除所有 trace 数据!
85
85
 
86
86
  此操作不可恢复,请确认是否继续?`,deleteConfirmMessage:"确定要删除符合以下条件的 trace 吗?",searchCondition:"搜索条件",timeRange:"时间范围",before:"在",deleteConfirmFooter:`
87
- 此操作不可恢复,请确认是否继续?`,deleteSuccess:"删除成功",deleteFailed:"删除失败",unknownError:"未知错误"},debug:{paramLabel:"参数",systemPrompt:"系统提示词",userPrompt:"用户提示词",submitImage:"是否提交图片",addParam:"新增参数",reset:"重置",submit:"提交",responseResult:"返回结果",switchToMarkdown:"切换为Markdown",switchToRaw:"切换为原始输出",paramName:"参数名",paramValue:"参数值",yes:"是",no:"否"}},Wl={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"},span:{searchTree:"Span Name/Span Type"},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",application:"Application",selectApplication:"Please select application",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",exceptionType:"Exception Type",exceptionMessage:"Exception Message",exceptionStacktrace:"Exception Stacktrace",otherAttributes:"Other Attributes",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!
87
+ 此操作不可恢复,请确认是否继续?`,deleteSuccess:"删除成功",deleteFailed:"删除失败",unknownError:"未知错误",autoRefresh:"自动刷新",refreshInterval5s:"5秒",refreshInterval10s:"10秒",refreshInterval20s:"20秒"},debug:{paramLabel:"参数",systemPrompt:"系统提示词",userPrompt:"用户提示词",submitImage:"是否提交图片",addParam:"新增参数",reset:"重置",submit:"提交",responseResult:"返回结果",switchToMarkdown:"切换为Markdown",switchToRaw:"切换为原始输出",paramName:"参数名",paramValue:"参数值",yes:"是",no:"否"}},Gl={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"},span:{searchTree:"Span Name/Span Type",hasEvents:"Has events"},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",application:"Application",selectApplication:"Please select application",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",exceptionType:"Exception Type",exceptionMessage:"Exception Message",exceptionStacktrace:"Exception Stacktrace",otherAttributes:"Other Attributes",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!
88
88
 
89
89
  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:`
90
- This operation cannot be undone. Are you sure you want to continue?`,deleteSuccess:"Delete successful",deleteFailed:"Delete failed",unknownError:"Unknown error"},debug:{paramLabel:"Parameter",systemPrompt:"System Prompt",userPrompt:"User Prompt",submitImage:"Submit Image",addParam:"Add Parameter",reset:"Reset",submit:"Submit",responseResult:"Response Result",switchToMarkdown:"Switch to Markdown",switchToRaw:"Switch to Raw Output",paramName:"Parameter Name",paramValue:"Parameter Value",yes:"Yes",no:"No"}},oi={"zh-CN":Hl,"en-US":Wl};let us=!1;const jl=u=>{!u||us||(u.mergeLocaleMessage?(Object.keys(oi).forEach(n=>{u.mergeLocaleMessage(n,oi[n])}),us=!0):u.messages&&(Object.keys(oi).forEach(n=>{u.messages[n]||(u.messages[n]={}),Object.assign(u.messages[n],oi[n])}),us=!0))},Xp={store:uo,router:Bl,components:{Trace:ls,TraceSpanTree:qa},api:xn,locales:oi,setI18n(u){jl(u)},registerLocales:jl};Ie.Trace=ls,Ie.TraceSpanTree=qa,Ie.default=Xp,Ie.enUS=Wl,Ie.traceApi=xn,Ie.traceRouter=Bl,Ie.traceStore=uo,Ie.zhCN=Hl,Object.defineProperties(Ie,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
90
+ This operation cannot be undone. Are you sure you want to continue?`,deleteSuccess:"Delete successful",deleteFailed:"Delete failed",unknownError:"Unknown error",autoRefresh:"Auto refresh",refreshInterval5s:"5s",refreshInterval10s:"10s",refreshInterval20s:"20s"},debug:{paramLabel:"Parameter",systemPrompt:"System Prompt",userPrompt:"User Prompt",submitImage:"Submit Image",addParam:"Add Parameter",reset:"Reset",submit:"Submit",responseResult:"Response Result",switchToMarkdown:"Switch to Markdown",switchToRaw:"Switch to Raw Output",paramName:"Parameter Name",paramValue:"Parameter Value",yes:"Yes",no:"No"}},oi={"zh-CN":Ul,"en-US":Gl};let us=!1;const Kl=u=>{!u||us||(u.mergeLocaleMessage?(Object.keys(oi).forEach(n=>{u.mergeLocaleMessage(n,oi[n])}),us=!0):u.messages&&(Object.keys(oi).forEach(n=>{u.messages[n]||(u.messages[n]={}),Object.assign(u.messages[n],oi[n])}),us=!0))},Vp={store:ho,router:ql,components:{Trace:ls,TraceSpanTree:Ua},api:tn,locales:oi,setI18n(u){Kl(u)},registerLocales:Kl};Ie.Trace=ls,Ie.TraceSpanTree=Ua,Ie.default=Vp,Ie.enUS=Gl,Ie.traceApi=tn,Ie.traceRouter=ql,Ie.traceStore=ho,Ie.zhCN=Ul,Object.defineProperties(Ie,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});