@dao42/d42paas-front 0.9.97 → 0.9.98
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/DaoPaaS.cjs +3 -3
- package/dist/sdk/docs/enums/Messages.html +1 -1
- package/dist/sdk/docs/enums/ThemeType.html +2 -2
- package/dist/sdk/docs/interfaces/Component.html +2 -2
- package/dist/sdk/docs/interfaces/IDaoPaaS.html +27 -27
- package/dist/sdk/docs/interfaces/IExtralAction.html +1 -1
- package/dist/sdk/docs/interfaces/PaaSOptions.html +15 -15
- package/dist/sdk/docs/interfaces/XtermStyleType.html +1 -1
- package/dist/sdk/docs/modules.html +5 -5
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/DaoPaaS.cjs
CHANGED
|
@@ -46,7 +46,7 @@ Error generating stack: `+o.message+`
|
|
|
46
46
|
* This source code is licensed under the MIT license found in the
|
|
47
47
|
* LICENSE file in the root directory of this source tree.
|
|
48
48
|
*/var Gw=M.exports,lye=YH.exports;function cye(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var uye=typeof Object.is=="function"?Object.is:cye,fye=lye.useSyncExternalStore,dye=Gw.useRef,hye=Gw.useEffect,pye=Gw.useMemo,Oye=Gw.useDebugValue;BH.useSyncExternalStoreWithSelector=function(t,e,n,r,i){var o=dye(null);if(o.current===null){var s={hasValue:!1,value:null};o.current=s}else s=o.current;o=pye(function(){function l(d){if(!c){if(c=!0,u=d,d=r(d),i!==void 0&&s.hasValue){var O=s.value;if(i(O,d))return f=O}return f=d}if(O=f,uye(u,d))return O;var b=r(d);return i!==void 0&&i(O,b)?O:(u=d,f=b)}var c=!1,u,f,h=n===void 0?null:n;return[function(){return l(e())},h===null?void 0:function(){return l(h())}]},[e,n,r,i]);var a=fye(t,o[0],o[1]);return hye(function(){s.hasValue=!0,s.value=a},[a]),Oye(a),a};qH.exports=BH;var mye=qH.exports;const{useSyncExternalStoreWithSelector:gye}=mye;function vye(t,e=t.getState,n){const r=gye(t.subscribe,t.getState,t.getServerState||t.getState,e,n);return M.exports.useDebugValue(r),r}const DM=t=>{const e=typeof t=="function"?UH(t):t,n=(r,i)=>vye(e,r,i);return Object.assign(n,e),n},yye=t=>t?DM(t):DM;var bye=yye;const xye=(t,e={})=>(n,r,i)=>{const{enabled:o,anonymousActionType:s,...a}=e;let l;try{l=(o!=null?o:({BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0}&&"production")!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!l)return({BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0}&&"production")!=="production"&&o&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),t(n,r,i);const c=l.connect(a);let u=!0;i.setState=(d,O,b)=>{const v=n(d,O);return u&&c.send(b===void 0?{type:s||"anonymous"}:typeof b=="string"?{type:b}:b,r()),v};const f=(...d)=>{const O=u;u=!1,n(...d),u=O},h=t(i.setState,r,i);if(c.init(h),i.dispatchFromDevtools&&typeof i.dispatch=="function"){let d=!1;const O=i.dispatch;i.dispatch=(...b)=>{({BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0}&&"production")!=="production"&&b[0].type==="__setState"&&!d&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),d=!0),O(...b)}}return c.subscribe(d=>{var O;switch(d.type){case"ACTION":if(typeof d.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return Dk(d.payload,b=>{if(b.type==="__setState"){f(b.state);return}!i.dispatchFromDevtools||typeof i.dispatch=="function"&&i.dispatch(b)});case"DISPATCH":switch(d.payload.type){case"RESET":return f(h),c.init(i.getState());case"COMMIT":return c.init(i.getState());case"ROLLBACK":return Dk(d.state,b=>{f(b),c.init(i.getState())});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return Dk(d.state,b=>{f(b)});case"IMPORT_STATE":{const{nextLiftedState:b}=d.payload,v=(O=b.computedStates.slice(-1)[0])==null?void 0:O.state;if(!v)return;f(v),c.send(null,b);return}case"PAUSE_RECORDING":return u=!u}return}}),h},Sye=xye,Dk=(t,e)=>{let n;try{n=JSON.parse(t)}catch(r){console.error("[zustand devtools middleware] Could not parse the received json",r)}n!==void 0&&e(n)},US=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(r){return US(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return US(r)(n)}}}},wye=(t,e)=>(n,r,i)=>{let o={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:v=>v,version:0,merge:(v,p)=>({...p,...v}),...e},s=!1;const a=new Set,l=new Set;let c;try{c=o.getStorage()}catch{}if(!c)return t((...v)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),n(...v)},r,i);const u=US(o.serialize),f=()=>{const v=o.partialize({...r()});let p;const g=u({state:v,version:o.version}).then(y=>c.setItem(o.name,y)).catch(y=>{p=y});if(p)throw p;return g},h=i.setState;i.setState=(v,p)=>{h(v,p),f()};const d=t((...v)=>{n(...v),f()},r,i);let O;const b=()=>{var v;if(!c)return;s=!1,a.forEach(g=>g(r()));const p=((v=o.onRehydrateStorage)==null?void 0:v.call(o,r()))||void 0;return US(c.getItem.bind(c))(o.name).then(g=>{if(g)return o.deserialize(g)}).then(g=>{if(g)if(typeof g.version=="number"&&g.version!==o.version){if(o.migrate)return o.migrate(g.state,g.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return g.state}).then(g=>{var y;return O=o.merge(g,(y=r())!=null?y:d),n(O,!0),f()}).then(()=>{p==null||p(O,void 0),s=!0,l.forEach(g=>g(O))}).catch(g=>{p==null||p(void 0,g)})};return i.persist={setOptions:v=>{o={...o,...v},v.getStorage&&(c=v.getStorage())},clearStorage:()=>{c==null||c.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>b(),hasHydrated:()=>s,onHydrate:v=>(a.add(v),()=>{a.delete(v)}),onFinishHydration:v=>(l.add(v),()=>{l.delete(v)})},b(),O||d},_ye=wye,Tye=(t,e)=>{const n={};return Object.keys(t.getState()).forEach(r=>{n[r]=i=>{if(t.getState()[r]===i)return;const s=r.replace(/^\S/,a=>a.toUpperCase());t.setState(a=>{a[r]=i},`@@${e}/set${s}`)}}),n},kye=(t,e)=>{const n=t(e.set,e.get,e);return{...e,set:{...e.set,...n}}},Pye=(t,e)=>{const n={...e.use},r={...e.useTracked},i={...e.get};return Object.keys(t(e.store.getState(),e.get,e)).forEach(o=>{n[o]=(...s)=>e.useStore(a=>{const c=t(a,e.get,e)[o];return c(...s)}),r[o]=(...s)=>{const a=e.useTrackedStore(),c=t(a,e.get,e)[o];return c(...s)},i[o]=(...s)=>{const l=t(e.store.getState(),e.get,e)[o];return l(...s)}}),{...e,get:i,use:n,useTracked:r}},_Q=t=>({...t,extendSelectors:e=>_Q(Pye(e,t)),extendActions:e=>_Q(kye(e,t))}),Qye=t=>{const e={};return Object.keys(t.getState()).forEach(n=>{e[n]=()=>t.getState()[n]}),e},$ye=t=>{const e={};return Object.keys(t.getState()).forEach(n=>{e[n]=r=>t(i=>i[n],r)}),e},Eye=(t,e)=>{const n={};return Object.keys(t.getState()).forEach(r=>{n[r]=()=>e()[r]}),n},Cye=t=>(e,n,r)=>{const i=(o,s)=>e(Fve(o),!0,s);return r.setState=i,t(i,n,r)};function Rye(t,...e){return e.reduce((n,r)=>r(n),t)}const Hw=t=>(e,n={})=>{var r;const{middlewares:i=[],devtools:o,persist:s,immer:a}=n;jve((r=a==null?void 0:a.enabledAutoFreeze)!==null&&r!==void 0?r:!1),a!=null&&a.enableMapSet&&Xve();const l=[Cye,...i];s!=null&&s.enabled&&l.push(S=>_ye(S,{...s,name:t})),o!=null&&o.enabled&&l.push(S=>Sye(S,{...o,name:t})),l.push(UH);const u=(S=>Rye(S,...l))(()=>e),f=bye(u),h=Tye(f,t),d=(S,w)=>{u.setState(T=>{Object.assign(T,S)},w||`@@${t}/mergeState`)},O=(S,w)=>{u.setState(S,w||`@@${t}/setState`)},b=$ye(f),v=Qye(f),p=Kve(f),g=Eye(f,p),y={get:{state:u.getState,...v},name:t,set:{state:O,mergeState:d,...h},store:u,use:b,useTracked:g,useStore:f,useTrackedStore:p,extendSelectors:()=>y,extendActions:()=>y};return _Q(y)};var z5=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function jH(t,e){return e={exports:{}},t(e,e.exports),e.exports}var Aye=typeof z5=="object"&&z5&&z5.Object===Object&&z5,ZH=Aye,Iye=typeof self=="object"&&self&&self.Object===Object&&self,zye=ZH||Iye||Function("return this")(),Yf=zye,Lye=Yf.Symbol,fh=Lye,VH=Object.prototype,Nye=VH.hasOwnProperty,Mye=VH.toString,Rm=fh?fh.toStringTag:void 0;function Dye(t){var e=Nye.call(t,Rm),n=t[Rm];try{t[Rm]=void 0;var r=!0}catch{}var i=Mye.call(t);return r&&(e?t[Rm]=n:delete t[Rm]),i}var Xye=Dye,Wye=Object.prototype,Uye=Wye.toString;function qye(t){return Uye.call(t)}var Bye=qye,Yye="[object Null]",Fye="[object Undefined]",XM=fh?fh.toStringTag:void 0;function jye(t){return t==null?t===void 0?Fye:Yye:XM&&XM in Object(t)?Xye(t):Bye(t)}var z0=jye;function Zye(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var _C=Zye,Vye="[object AsyncFunction]",Gye="[object Function]",Hye="[object GeneratorFunction]",Kye="[object Proxy]";function Jye(t){if(!_C(t))return!1;var e=z0(t);return e==Gye||e==Hye||e==Vye||e==Kye}var GH=Jye,ebe=Yf["__core-js_shared__"],Xk=ebe,WM=function(){var t=/[^.]+$/.exec(Xk&&Xk.keys&&Xk.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function tbe(t){return!!WM&&WM in t}var nbe=tbe,rbe=Function.prototype,ibe=rbe.toString;function obe(t){if(t!=null){try{return ibe.call(t)}catch{}try{return t+""}catch{}}return""}var Gp=obe,sbe=/[\\^$.*+?()[\]{}|]/g,abe=/^\[object .+?Constructor\]$/,lbe=Function.prototype,cbe=Object.prototype,ube=lbe.toString,fbe=cbe.hasOwnProperty,dbe=RegExp("^"+ube.call(fbe).replace(sbe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function hbe(t){if(!_C(t)||nbe(t))return!1;var e=GH(t)?dbe:abe;return e.test(Gp(t))}var pbe=hbe;function Obe(t,e){return t==null?void 0:t[e]}var mbe=Obe;function gbe(t,e){var n=mbe(t,e);return pbe(n)?n:void 0}var Hp=gbe,vbe=function(){try{var t=Hp(Object,"defineProperty");return t({},"",{}),t}catch{}}(),UM=vbe;function ybe(t,e,n){e=="__proto__"&&UM?UM(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}var bbe=ybe;function xbe(t){return function(e,n,r){for(var i=-1,o=Object(e),s=r(e),a=s.length;a--;){var l=s[t?a:++i];if(n(o[l],l,o)===!1)break}return e}}var Sbe=xbe,wbe=Sbe(),_be=wbe;function Tbe(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}var kbe=Tbe;function Pbe(t){return t!=null&&typeof t=="object"}var e0=Pbe,Qbe="[object Arguments]";function $be(t){return e0(t)&&z0(t)==Qbe}var qM=$be,HH=Object.prototype,Ebe=HH.hasOwnProperty,Cbe=HH.propertyIsEnumerable,Rbe=qM(function(){return arguments}())?qM:function(t){return e0(t)&&Ebe.call(t,"callee")&&!Cbe.call(t,"callee")},KH=Rbe,Abe=Array.isArray,Df=Abe;function Ibe(){return!1}var zbe=Ibe,TQ=jH(function(t,e){var n=e&&!e.nodeType&&e,r=n&&!0&&t&&!t.nodeType&&t,i=r&&r.exports===n,o=i?Yf.Buffer:void 0,s=o?o.isBuffer:void 0,a=s||zbe;t.exports=a}),Lbe=9007199254740991,Nbe=/^(?:0|[1-9]\d*)$/;function Mbe(t,e){var n=typeof t;return e=e==null?Lbe:e,!!e&&(n=="number"||n!="symbol"&&Nbe.test(t))&&t>-1&&t%1==0&&t<e}var JH=Mbe,Dbe=9007199254740991;function Xbe(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Dbe}var TC=Xbe,Wbe="[object Arguments]",Ube="[object Array]",qbe="[object Boolean]",Bbe="[object Date]",Ybe="[object Error]",Fbe="[object Function]",jbe="[object Map]",Zbe="[object Number]",Vbe="[object Object]",Gbe="[object RegExp]",Hbe="[object Set]",Kbe="[object String]",Jbe="[object WeakMap]",e5e="[object ArrayBuffer]",t5e="[object DataView]",n5e="[object Float32Array]",r5e="[object Float64Array]",i5e="[object Int8Array]",o5e="[object Int16Array]",s5e="[object Int32Array]",a5e="[object Uint8Array]",l5e="[object Uint8ClampedArray]",c5e="[object Uint16Array]",u5e="[object Uint32Array]",Pi={};Pi[n5e]=Pi[r5e]=Pi[i5e]=Pi[o5e]=Pi[s5e]=Pi[a5e]=Pi[l5e]=Pi[c5e]=Pi[u5e]=!0;Pi[Wbe]=Pi[Ube]=Pi[e5e]=Pi[qbe]=Pi[t5e]=Pi[Bbe]=Pi[Ybe]=Pi[Fbe]=Pi[jbe]=Pi[Zbe]=Pi[Vbe]=Pi[Gbe]=Pi[Hbe]=Pi[Kbe]=Pi[Jbe]=!1;function f5e(t){return e0(t)&&TC(t.length)&&!!Pi[z0(t)]}var d5e=f5e;function h5e(t){return function(e){return t(e)}}var p5e=h5e,BM=jH(function(t,e){var n=e&&!e.nodeType&&e,r=n&&!0&&t&&!t.nodeType&&t,i=r&&r.exports===n,o=i&&ZH.process,s=function(){try{var a=r&&r.require&&r.require("util").types;return a||o&&o.binding&&o.binding("util")}catch{}}();t.exports=s}),YM=BM&&BM.isTypedArray,O5e=YM?p5e(YM):d5e,eK=O5e,m5e=Object.prototype,g5e=m5e.hasOwnProperty;function v5e(t,e){var n=Df(t),r=!n&&KH(t),i=!n&&!r&&TQ(t),o=!n&&!r&&!i&&eK(t),s=n||r||i||o,a=s?kbe(t.length,String):[],l=a.length;for(var c in t)(e||g5e.call(t,c))&&!(s&&(c=="length"||i&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||JH(c,l)))&&a.push(c);return a}var y5e=v5e,b5e=Object.prototype;function x5e(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||b5e;return t===n}var S5e=x5e;function w5e(t,e){return function(n){return t(e(n))}}var _5e=w5e,T5e=_5e(Object.keys,Object),k5e=T5e,P5e=Object.prototype,Q5e=P5e.hasOwnProperty;function $5e(t){if(!S5e(t))return k5e(t);var e=[];for(var n in Object(t))Q5e.call(t,n)&&n!="constructor"&&e.push(n);return e}var E5e=$5e;function C5e(t){return t!=null&&TC(t.length)&&!GH(t)}var R5e=C5e;function A5e(t){return R5e(t)?y5e(t):E5e(t)}var kC=A5e;function I5e(t,e){return t&&_be(t,e,kC)}var z5e=I5e;function L5e(){this.__data__=[],this.size=0}var N5e=L5e;function M5e(t,e){return t===e||t!==t&&e!==e}var tK=M5e;function D5e(t,e){for(var n=t.length;n--;)if(tK(t[n][0],e))return n;return-1}var Kw=D5e,X5e=Array.prototype,W5e=X5e.splice;function U5e(t){var e=this.__data__,n=Kw(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():W5e.call(e,n,1),--this.size,!0}var q5e=U5e;function B5e(t){var e=this.__data__,n=Kw(e,t);return n<0?void 0:e[n][1]}var Y5e=B5e;function F5e(t){return Kw(this.__data__,t)>-1}var j5e=F5e;function Z5e(t,e){var n=this.__data__,r=Kw(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}var V5e=Z5e;function L0(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}L0.prototype.clear=N5e;L0.prototype.delete=q5e;L0.prototype.get=Y5e;L0.prototype.has=j5e;L0.prototype.set=V5e;var Jw=L0;function G5e(){this.__data__=new Jw,this.size=0}var H5e=G5e;function K5e(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}var J5e=K5e;function e2e(t){return this.__data__.get(t)}var t2e=e2e;function n2e(t){return this.__data__.has(t)}var r2e=n2e,i2e=Hp(Yf,"Map"),Lv=i2e,o2e=Hp(Object,"create"),Nv=o2e;function s2e(){this.__data__=Nv?Nv(null):{},this.size=0}var a2e=s2e;function l2e(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var c2e=l2e,u2e="__lodash_hash_undefined__",f2e=Object.prototype,d2e=f2e.hasOwnProperty;function h2e(t){var e=this.__data__;if(Nv){var n=e[t];return n===u2e?void 0:n}return d2e.call(e,t)?e[t]:void 0}var p2e=h2e,O2e=Object.prototype,m2e=O2e.hasOwnProperty;function g2e(t){var e=this.__data__;return Nv?e[t]!==void 0:m2e.call(e,t)}var v2e=g2e,y2e="__lodash_hash_undefined__";function b2e(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Nv&&e===void 0?y2e:e,this}var x2e=b2e;function N0(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}N0.prototype.clear=a2e;N0.prototype.delete=c2e;N0.prototype.get=p2e;N0.prototype.has=v2e;N0.prototype.set=x2e;var FM=N0;function S2e(){this.size=0,this.__data__={hash:new FM,map:new(Lv||Jw),string:new FM}}var w2e=S2e;function _2e(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var T2e=_2e;function k2e(t,e){var n=t.__data__;return T2e(e)?n[typeof e=="string"?"string":"hash"]:n.map}var e_=k2e;function P2e(t){var e=e_(this,t).delete(t);return this.size-=e?1:0,e}var Q2e=P2e;function $2e(t){return e_(this,t).get(t)}var E2e=$2e;function C2e(t){return e_(this,t).has(t)}var R2e=C2e;function A2e(t,e){var n=e_(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}var I2e=A2e;function M0(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}M0.prototype.clear=w2e;M0.prototype.delete=Q2e;M0.prototype.get=E2e;M0.prototype.has=R2e;M0.prototype.set=I2e;var t_=M0,z2e=200;function L2e(t,e){var n=this.__data__;if(n instanceof Jw){var r=n.__data__;if(!Lv||r.length<z2e-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new t_(r)}return n.set(t,e),this.size=n.size,this}var N2e=L2e;function D0(t){var e=this.__data__=new Jw(t);this.size=e.size}D0.prototype.clear=H5e;D0.prototype.delete=J5e;D0.prototype.get=t2e;D0.prototype.has=r2e;D0.prototype.set=N2e;var Ex=D0,M2e="__lodash_hash_undefined__";function D2e(t){return this.__data__.set(t,M2e),this}var X2e=D2e;function W2e(t){return this.__data__.has(t)}var U2e=W2e;function qS(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new t_;++e<n;)this.add(t[e])}qS.prototype.add=qS.prototype.push=X2e;qS.prototype.has=U2e;var q2e=qS;function B2e(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}var Y2e=B2e;function F2e(t,e){return t.has(e)}var j2e=F2e,Z2e=1,V2e=2;function G2e(t,e,n,r,i,o){var s=n&Z2e,a=t.length,l=e.length;if(a!=l&&!(s&&l>a))return!1;var c=o.get(t),u=o.get(e);if(c&&u)return c==e&&u==t;var f=-1,h=!0,d=n&V2e?new q2e:void 0;for(o.set(t,e),o.set(e,t);++f<a;){var O=t[f],b=e[f];if(r)var v=s?r(b,O,f,e,t,o):r(O,b,f,t,e,o);if(v!==void 0){if(v)continue;h=!1;break}if(d){if(!Y2e(e,function(p,g){if(!j2e(d,g)&&(O===p||i(O,p,n,r,o)))return d.push(g)})){h=!1;break}}else if(!(O===b||i(O,b,n,r,o))){h=!1;break}}return o.delete(t),o.delete(e),h}var nK=G2e,H2e=Yf.Uint8Array,jM=H2e;function K2e(t){var e=-1,n=Array(t.size);return t.forEach(function(r,i){n[++e]=[i,r]}),n}var J2e=K2e;function exe(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}var txe=exe,nxe=1,rxe=2,ixe="[object Boolean]",oxe="[object Date]",sxe="[object Error]",axe="[object Map]",lxe="[object Number]",cxe="[object RegExp]",uxe="[object Set]",fxe="[object String]",dxe="[object Symbol]",hxe="[object ArrayBuffer]",pxe="[object DataView]",ZM=fh?fh.prototype:void 0,Wk=ZM?ZM.valueOf:void 0;function Oxe(t,e,n,r,i,o,s){switch(n){case pxe:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case hxe:return!(t.byteLength!=e.byteLength||!o(new jM(t),new jM(e)));case ixe:case oxe:case lxe:return tK(+t,+e);case sxe:return t.name==e.name&&t.message==e.message;case cxe:case fxe:return t==e+"";case axe:var a=J2e;case uxe:var l=r&nxe;if(a||(a=txe),t.size!=e.size&&!l)return!1;var c=s.get(t);if(c)return c==e;r|=rxe,s.set(t,e);var u=nK(a(t),a(e),r,i,o,s);return s.delete(t),u;case dxe:if(Wk)return Wk.call(t)==Wk.call(e)}return!1}var mxe=Oxe;function gxe(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}var vxe=gxe;function yxe(t,e,n){var r=e(t);return Df(t)?r:vxe(r,n(t))}var bxe=yxe;function xxe(t,e){for(var n=-1,r=t==null?0:t.length,i=0,o=[];++n<r;){var s=t[n];e(s,n,t)&&(o[i++]=s)}return o}var Sxe=xxe;function wxe(){return[]}var _xe=wxe,Txe=Object.prototype,kxe=Txe.propertyIsEnumerable,VM=Object.getOwnPropertySymbols,Pxe=VM?function(t){return t==null?[]:(t=Object(t),Sxe(VM(t),function(e){return kxe.call(t,e)}))}:_xe,Qxe=Pxe;function $xe(t){return bxe(t,kC,Qxe)}var GM=$xe,Exe=1,Cxe=Object.prototype,Rxe=Cxe.hasOwnProperty;function Axe(t,e,n,r,i,o){var s=n&Exe,a=GM(t),l=a.length,c=GM(e),u=c.length;if(l!=u&&!s)return!1;for(var f=l;f--;){var h=a[f];if(!(s?h in e:Rxe.call(e,h)))return!1}var d=o.get(t),O=o.get(e);if(d&&O)return d==e&&O==t;var b=!0;o.set(t,e),o.set(e,t);for(var v=s;++f<l;){h=a[f];var p=t[h],g=e[h];if(r)var y=s?r(g,p,h,e,t,o):r(p,g,h,t,e,o);if(!(y===void 0?p===g||i(p,g,n,r,o):y)){b=!1;break}v||(v=h=="constructor")}if(b&&!v){var S=t.constructor,w=e.constructor;S!=w&&"constructor"in t&&"constructor"in e&&!(typeof S=="function"&&S instanceof S&&typeof w=="function"&&w instanceof w)&&(b=!1)}return o.delete(t),o.delete(e),b}var Ixe=Axe,zxe=Hp(Yf,"DataView"),kQ=zxe,Lxe=Hp(Yf,"Promise"),PQ=Lxe,Nxe=Hp(Yf,"Set"),QQ=Nxe,Mxe=Hp(Yf,"WeakMap"),$Q=Mxe,HM="[object Map]",Dxe="[object Object]",KM="[object Promise]",JM="[object Set]",eD="[object WeakMap]",tD="[object DataView]",Xxe=Gp(kQ),Wxe=Gp(Lv),Uxe=Gp(PQ),qxe=Gp(QQ),Bxe=Gp($Q),op=z0;(kQ&&op(new kQ(new ArrayBuffer(1)))!=tD||Lv&&op(new Lv)!=HM||PQ&&op(PQ.resolve())!=KM||QQ&&op(new QQ)!=JM||$Q&&op(new $Q)!=eD)&&(op=function(t){var e=z0(t),n=e==Dxe?t.constructor:void 0,r=n?Gp(n):"";if(r)switch(r){case Xxe:return tD;case Wxe:return HM;case Uxe:return KM;case qxe:return JM;case Bxe:return eD}return e});var nD=op,Yxe=1,rD="[object Arguments]",iD="[object Array]",L5="[object Object]",Fxe=Object.prototype,oD=Fxe.hasOwnProperty;function jxe(t,e,n,r,i,o){var s=Df(t),a=Df(e),l=s?iD:nD(t),c=a?iD:nD(e);l=l==rD?L5:l,c=c==rD?L5:c;var u=l==L5,f=c==L5,h=l==c;if(h&&TQ(t)){if(!TQ(e))return!1;s=!0,u=!1}if(h&&!u)return o||(o=new Ex),s||eK(t)?nK(t,e,n,r,i,o):mxe(t,e,l,n,r,i,o);if(!(n&Yxe)){var d=u&&oD.call(t,"__wrapped__"),O=f&&oD.call(e,"__wrapped__");if(d||O){var b=d?t.value():t,v=O?e.value():e;return o||(o=new Ex),i(b,v,n,r,o)}}return h?(o||(o=new Ex),Ixe(t,e,n,r,i,o)):!1}var Zxe=jxe;function rK(t,e,n,r,i){return t===e?!0:t==null||e==null||!e0(t)&&!e0(e)?t!==t&&e!==e:Zxe(t,e,n,r,rK,i)}var iK=rK,Vxe=1,Gxe=2;function Hxe(t,e,n,r){var i=n.length,o=i,s=!r;if(t==null)return!o;for(t=Object(t);i--;){var a=n[i];if(s&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++i<o;){a=n[i];var l=a[0],c=t[l],u=a[1];if(s&&a[2]){if(c===void 0&&!(l in t))return!1}else{var f=new Ex;if(r)var h=r(c,u,l,t,e,f);if(!(h===void 0?iK(u,c,Vxe|Gxe,r,f):h))return!1}}return!0}var Kxe=Hxe;function Jxe(t){return t===t&&!_C(t)}var oK=Jxe;function eSe(t){for(var e=kC(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,oK(i)]}return e}var tSe=eSe;function nSe(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}var sK=nSe;function rSe(t){var e=tSe(t);return e.length==1&&e[0][2]?sK(e[0][0],e[0][1]):function(n){return n===t||Kxe(n,t,e)}}var iSe=rSe,oSe="[object Symbol]";function sSe(t){return typeof t=="symbol"||e0(t)&&z0(t)==oSe}var PC=sSe,aSe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,lSe=/^\w*$/;function cSe(t,e){if(Df(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||PC(t)?!0:lSe.test(t)||!aSe.test(t)||e!=null&&t in Object(e)}var QC=cSe,uSe="Expected a function";function $C(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(uSe);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=t.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new($C.Cache||t_),n}$C.Cache=t_;var fSe=$C,dSe=500;function hSe(t){var e=fSe(t,function(r){return n.size===dSe&&n.clear(),r}),n=e.cache;return e}var pSe=hSe,OSe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,mSe=/\\(\\)?/g,gSe=pSe(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(OSe,function(n,r,i,o){e.push(i?o.replace(mSe,"$1"):r||n)}),e}),vSe=gSe;function ySe(t,e){for(var n=-1,r=t==null?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}var bSe=ySe,xSe=1/0,sD=fh?fh.prototype:void 0,aD=sD?sD.toString:void 0;function aK(t){if(typeof t=="string")return t;if(Df(t))return bSe(t,aK)+"";if(PC(t))return aD?aD.call(t):"";var e=t+"";return e=="0"&&1/t==-xSe?"-0":e}var SSe=aK;function wSe(t){return t==null?"":SSe(t)}var _Se=wSe;function TSe(t,e){return Df(t)?t:QC(t,e)?[t]:vSe(_Se(t))}var lK=TSe,kSe=1/0;function PSe(t){if(typeof t=="string"||PC(t))return t;var e=t+"";return e=="0"&&1/t==-kSe?"-0":e}var n_=PSe;function QSe(t,e){e=lK(e,t);for(var n=0,r=e.length;t!=null&&n<r;)t=t[n_(e[n++])];return n&&n==r?t:void 0}var cK=QSe;function $Se(t,e,n){var r=t==null?void 0:cK(t,e);return r===void 0?n:r}var ESe=$Se;function CSe(t,e){return t!=null&&e in Object(t)}var RSe=CSe;function ASe(t,e,n){e=lK(e,t);for(var r=-1,i=e.length,o=!1;++r<i;){var s=n_(e[r]);if(!(o=t!=null&&n(t,s)))break;t=t[s]}return o||++r!=i?o:(i=t==null?0:t.length,!!i&&TC(i)&&JH(s,i)&&(Df(t)||KH(t)))}var ISe=ASe;function zSe(t,e){return t!=null&&ISe(t,e,RSe)}var LSe=zSe,NSe=1,MSe=2;function DSe(t,e){return QC(t)&&oK(e)?sK(n_(t),e):function(n){var r=ESe(n,t);return r===void 0&&r===e?LSe(n,t):iK(e,r,NSe|MSe)}}var XSe=DSe;function WSe(t){return t}var USe=WSe;function qSe(t){return function(e){return e==null?void 0:e[t]}}var BSe=qSe;function YSe(t){return function(e){return cK(e,t)}}var FSe=YSe;function jSe(t){return QC(t)?BSe(n_(t)):FSe(t)}var ZSe=jSe;function VSe(t){return typeof t=="function"?t:t==null?USe:typeof t=="object"?Df(t)?XSe(t[0],t[1]):iSe(t):ZSe(t)}var GSe=VSe;function HSe(t,e){var n={};return e=GSe(e),z5e(t,function(r,i,o){bbe(n,i,e(r,i,o))}),n}var KSe=HSe;const r_=(t,e)=>KSe(e,n=>n[t]),Qu=Object.create(null);Qu.open="0";Qu.close="1";Qu.ping="2";Qu.pong="3";Qu.message="4";Qu.upgrade="5";Qu.noop="6";const Cx=Object.create(null);Object.keys(Qu).forEach(t=>{Cx[Qu[t]]=t});const JSe={type:"error",data:"parser error"},e4e=typeof Blob=="function"||typeof Blob!="undefined"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",t4e=typeof ArrayBuffer=="function",n4e=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,uK=({type:t,data:e},n,r)=>e4e&&e instanceof Blob?n?r(e):lD(e,r):t4e&&(e instanceof ArrayBuffer||n4e(e))?n?r(e):lD(new Blob([e]),r):r(Qu[t]+(e||"")),lD=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+r)},n.readAsDataURL(t)},cD="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Og=typeof Uint8Array=="undefined"?[]:new Uint8Array(256);for(let t=0;t<cD.length;t++)Og[cD.charCodeAt(t)]=t;const r4e=t=>{let e=t.length*.75,n=t.length,r,i=0,o,s,a,l;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const c=new ArrayBuffer(e),u=new Uint8Array(c);for(r=0;r<n;r+=4)o=Og[t.charCodeAt(r)],s=Og[t.charCodeAt(r+1)],a=Og[t.charCodeAt(r+2)],l=Og[t.charCodeAt(r+3)],u[i++]=o<<2|s>>4,u[i++]=(s&15)<<4|a>>2,u[i++]=(a&3)<<6|l&63;return c},i4e=typeof ArrayBuffer=="function",fK=(t,e)=>{if(typeof t!="string")return{type:"message",data:dK(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:o4e(t.substring(1),e)}:Cx[n]?t.length>1?{type:Cx[n],data:t.substring(1)}:{type:Cx[n]}:JSe},o4e=(t,e)=>{if(i4e){const n=r4e(t);return dK(n,e)}else return{base64:!0,data:t}},dK=(t,e)=>{switch(e){case"blob":return t instanceof ArrayBuffer?new Blob([t]):t;case"arraybuffer":default:return t}},hK=String.fromCharCode(30),s4e=(t,e)=>{const n=t.length,r=new Array(n);let i=0;t.forEach((o,s)=>{uK(o,!1,a=>{r[s]=a,++i===n&&e(r.join(hK))})})},a4e=(t,e)=>{const n=t.split(hK),r=[];for(let i=0;i<n.length;i++){const o=fK(n[i],e);if(r.push(o),o.type==="error")break}return r},pK=4;function Po(t){if(t)return l4e(t)}function l4e(t){for(var e in Po.prototype)t[e]=Po.prototype[e];return t}Po.prototype.on=Po.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};Po.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this};Po.prototype.off=Po.prototype.removeListener=Po.prototype.removeAllListeners=Po.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var r,i=0;i<n.length;i++)if(r=n[i],r===e||r.fn===e){n.splice(i,1);break}return n.length===0&&delete this._callbacks["$"+t],this};Po.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),n=this._callbacks["$"+t],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,i=n.length;r<i;++r)n[r].apply(this,e)}return this};Po.prototype.emitReserved=Po.prototype.emit;Po.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};Po.prototype.hasListeners=function(t){return!!this.listeners(t).length};const Nd=(()=>typeof self!="undefined"?self:typeof window!="undefined"?window:Function("return this")())();function OK(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const c4e=setTimeout,u4e=clearTimeout;function i_(t,e){e.useNativeTimers?(t.setTimeoutFn=c4e.bind(Nd),t.clearTimeoutFn=u4e.bind(Nd)):(t.setTimeoutFn=setTimeout.bind(Nd),t.clearTimeoutFn=clearTimeout.bind(Nd))}const f4e=1.33;function d4e(t){return typeof t=="string"?h4e(t):Math.ceil((t.byteLength||t.size)*f4e)}function h4e(t){let e=0,n=0;for(let r=0,i=t.length;r<i;r++)e=t.charCodeAt(r),e<128?n+=1:e<2048?n+=2:e<55296||e>=57344?n+=3:(r++,n+=4);return n}class p4e extends Error{constructor(e,n,r){super(e),this.description=n,this.context=r,this.type="TransportError"}}class mK extends Po{constructor(e){super(),this.writable=!1,i_(this,e),this.opts=e,this.query=e.query,this.readyState="",this.socket=e.socket}onError(e,n,r){return super.emitReserved("error",new p4e(e,n,r)),this}open(){return(this.readyState==="closed"||this.readyState==="")&&(this.readyState="opening",this.doOpen()),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const n=fK(e,this.socket.binaryType);this.onPacket(n)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}}const gK="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),EQ=64,O4e={};let uD=0,N5=0,fD;function dD(t){let e="";do e=gK[t%EQ]+e,t=Math.floor(t/EQ);while(t>0);return e}function vK(){const t=dD(+new Date);return t!==fD?(uD=0,fD=t):t+"."+dD(uD++)}for(;N5<EQ;N5++)O4e[gK[N5]]=N5;function yK(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function m4e(t){let e={},n=t.split("&");for(let r=0,i=n.length;r<i;r++){let o=n[r].split("=");e[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return e}let bK=!1;try{bK=typeof XMLHttpRequest!="undefined"&&"withCredentials"in new XMLHttpRequest}catch{}const g4e=bK;function xK(t){const e=t.xdomain;try{if(typeof XMLHttpRequest!="undefined"&&(!e||g4e))return new XMLHttpRequest}catch{}if(!e)try{return new Nd[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function v4e(){}const y4e=function(){return new xK({xdomain:!1}).responseType!=null}();class b4e extends mK{constructor(e){if(super(e),this.polling=!1,typeof location!="undefined"){const r=location.protocol==="https:";let i=location.port;i||(i=r?"443":"80"),this.xd=typeof location!="undefined"&&e.hostname!==location.hostname||i!==e.port,this.xs=e.secure!==r}const n=e&&e.forceBase64;this.supportsBinary=y4e&&!n}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const n=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};a4e(e,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,s4e(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.query||{};const n=this.opts.secure?"https":"http";let r="";this.opts.timestampRequests!==!1&&(e[this.opts.timestampParam]=vK()),!this.supportsBinary&&!e.sid&&(e.b64=1),this.opts.port&&(n==="https"&&Number(this.opts.port)!==443||n==="http"&&Number(this.opts.port)!==80)&&(r=":"+this.opts.port);const i=yK(e),o=this.opts.hostname.indexOf(":")!==-1;return n+"://"+(o?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(i.length?"?"+i:"")}request(e={}){return Object.assign(e,{xd:this.xd,xs:this.xs},this.opts),new Su(this.uri(),e)}doWrite(e,n){const r=this.request({method:"POST",data:e});r.on("success",n),r.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=e}}class Su extends Po{constructor(e,n){super(),i_(this,n),this.opts=n,this.method=n.method||"GET",this.uri=e,this.async=n.async!==!1,this.data=n.data!==void 0?n.data:null,this.create()}create(){const e=OK(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd,e.xscheme=!!this.opts.xs;const n=this.xhr=new xK(e);try{n.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let r in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(r)&&n.setRequestHeader(r,this.opts.extraHeaders[r])}}catch{}if(this.method==="POST")try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{n.setRequestHeader("Accept","*/*")}catch{}"withCredentials"in n&&(n.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(n.timeout=this.opts.requestTimeout),n.onreadystatechange=()=>{n.readyState===4&&(n.status===200||n.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof n.status=="number"?n.status:0)},0))},n.send(this.data)}catch(r){this.setTimeoutFn(()=>{this.onError(r)},0);return}typeof document!="undefined"&&(this.index=Su.requestsCount++,Su.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr=="undefined"||this.xhr===null)){if(this.xhr.onreadystatechange=v4e,e)try{this.xhr.abort()}catch{}typeof document!="undefined"&&delete Su.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}Su.requestsCount=0;Su.requests={};if(typeof document!="undefined"){if(typeof attachEvent=="function")attachEvent("onunload",hD);else if(typeof addEventListener=="function"){const t="onpagehide"in Nd?"pagehide":"unload";addEventListener(t,hD,!1)}}function hD(){for(let t in Su.requests)Su.requests.hasOwnProperty(t)&&Su.requests[t].abort()}const x4e=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,n)=>n(e,0))(),M5=Nd.WebSocket||Nd.MozWebSocket,pD=!0,S4e="arraybuffer",OD=typeof navigator!="undefined"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class w4e extends mK{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),n=this.opts.protocols,r=OD?{}:OK(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=pD&&!OD?n?new M5(e,n):new M5(e):new M5(e,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType||S4e,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],i=n===e.length-1;uK(r,this.supportsBinary,o=>{const s={};try{pD&&this.ws.send(o)}catch{}i&&x4e(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws!="undefined"&&(this.ws.close(),this.ws=null)}uri(){let e=this.query||{};const n=this.opts.secure?"wss":"ws";let r="";this.opts.port&&(n==="wss"&&Number(this.opts.port)!==443||n==="ws"&&Number(this.opts.port)!==80)&&(r=":"+this.opts.port),this.opts.timestampRequests&&(e[this.opts.timestampParam]=vK()),this.supportsBinary||(e.b64=1);const i=yK(e),o=this.opts.hostname.indexOf(":")!==-1;return n+"://"+(o?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(i.length?"?"+i:"")}check(){return!!M5}}const _4e={websocket:w4e,polling:b4e},T4e=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,k4e=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function CQ(t){const e=t,n=t.indexOf("["),r=t.indexOf("]");n!=-1&&r!=-1&&(t=t.substring(0,n)+t.substring(n,r).replace(/:/g,";")+t.substring(r,t.length));let i=T4e.exec(t||""),o={},s=14;for(;s--;)o[k4e[s]]=i[s]||"";return n!=-1&&r!=-1&&(o.source=e,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=P4e(o,o.path),o.queryKey=Q4e(o,o.query),o}function P4e(t,e){const n=/\/{2,9}/g,r=e.replace(n,"/").split("/");return(e.substr(0,1)=="/"||e.length===0)&&r.splice(0,1),e.substr(e.length-1,1)=="/"&&r.splice(r.length-1,1),r}function Q4e(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}class $d extends Po{constructor(e,n={}){super(),e&&typeof e=="object"&&(n=e,e=null),e?(e=CQ(e),n.hostname=e.host,n.secure=e.protocol==="https"||e.protocol==="wss",n.port=e.port,e.query&&(n.query=e.query)):n.host&&(n.hostname=CQ(n.host).host),i_(this,n),this.secure=n.secure!=null?n.secure:typeof location!="undefined"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location!="undefined"?location.hostname:"localhost"),this.port=n.port||(typeof location!="undefined"&&location.port?location.port:this.secure?"443":"80"),this.transports=n.transports||["polling","websocket"],this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},n),this.opts.path=this.opts.path.replace(/\/$/,"")+"/",typeof this.opts.query=="string"&&(this.opts.query=m4e(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&addEventListener("beforeunload",()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},!1),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=pK,n.transport=e,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts.transportOptions[e],this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new _4e[e](r)}open(){let e;if(this.opts.rememberUpgrade&&$d.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch{this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",n=>this.onClose("transport close",n))}probe(e){let n=this.createTransport(e),r=!1;$d.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",f=>{if(!r)if(f.type==="pong"&&f.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;$d.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(u(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const h=new Error("probe error");h.transport=n.name,this.emitReserved("upgradeError",h)}}))};function o(){r||(r=!0,u(),n.close(),n=null)}const s=f=>{const h=new Error("probe error: "+f);h.transport=n.name,o(),this.emitReserved("upgradeError",h)};function a(){s("transport closed")}function l(){s("socket closed")}function c(f){n&&f.name!==n.name&&o()}const u=()=>{n.removeListener("open",i),n.removeListener("error",s),n.removeListener("close",a),this.off("close",l),this.off("upgrading",c)};n.once("open",i),n.once("error",s),n.once("close",a),this.once("close",l),this.once("upgrading",c),n.open()}onOpen(){if(this.readyState="open",$d.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade&&this.transport.pause){let e=0;const n=this.upgrades.length;for(;e<n;e++)this.probe(this.upgrades[e])}}onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.resetPingTimeout(),this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const n=new Error("server error");n.code=e.data,this.onError(n);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const i=this.writeBuffer[r].data;if(i&&(n+=d4e(i)),r>0&&n>this.maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}write(e,n,r){return this.sendPacket("message",e,n,r),this}send(e,n,r){return this.sendPacket("message",e,n,r),this}sendPacket(e,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const o={type:e,data:n,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),e()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}onError(e){$d.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,n){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&removeEventListener("offline",this.offlineEventListener,!1),this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const n=[];let r=0;const i=e.length;for(;r<i;r++)~this.transports.indexOf(e[r])&&n.push(e[r]);return n}}$d.protocol=pK;function $4e(t,e="",n){let r=t;n=n||typeof location!="undefined"&&location,t==null&&(t=n.protocol+"//"+n.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=n.protocol+t:t=n.host+t),/^(https?|wss?):\/\//.test(t)||(typeof n!="undefined"?t=n.protocol+"//"+t:t="https://"+t),r=CQ(t)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const o=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+o+":"+r.port+e,r.href=r.protocol+"://"+o+(n&&n.port===r.port?"":":"+r.port),r}const E4e=typeof ArrayBuffer=="function",C4e=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,SK=Object.prototype.toString,R4e=typeof Blob=="function"||typeof Blob!="undefined"&&SK.call(Blob)==="[object BlobConstructor]",A4e=typeof File=="function"||typeof File!="undefined"&&SK.call(File)==="[object FileConstructor]";function EC(t){return E4e&&(t instanceof ArrayBuffer||C4e(t))||R4e&&t instanceof Blob||A4e&&t instanceof File}function Rx(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n<r;n++)if(Rx(t[n]))return!0;return!1}if(EC(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return Rx(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&Rx(t[n]))return!0;return!1}function I4e(t){const e=[],n=t.data,r=t;return r.data=RQ(n,e),r.attachments=e.length,{packet:r,buffers:e}}function RQ(t,e){if(!t)return t;if(EC(t)){const n={_placeholder:!0,num:e.length};return e.push(t),n}else if(Array.isArray(t)){const n=new Array(t.length);for(let r=0;r<t.length;r++)n[r]=RQ(t[r],e);return n}else if(typeof t=="object"&&!(t instanceof Date)){const n={};for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=RQ(t[r],e));return n}return t}function z4e(t,e){return t.data=AQ(t.data,e),t.attachments=void 0,t}function AQ(t,e){if(!t)return t;if(t&&t._placeholder)return e[t.num];if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]=AQ(t[n],e);else if(typeof t=="object")for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=AQ(t[n],e));return t}const L4e=5;var br;(function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"})(br||(br={}));class N4e{constructor(e){this.replacer=e}encode(e){return(e.type===br.EVENT||e.type===br.ACK)&&Rx(e)?(e.type=e.type===br.EVENT?br.BINARY_EVENT:br.BINARY_ACK,this.encodeAsBinary(e)):[this.encodeAsString(e)]}encodeAsString(e){let n=""+e.type;return(e.type===br.BINARY_EVENT||e.type===br.BINARY_ACK)&&(n+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(n+=e.nsp+","),e.id!=null&&(n+=e.id),e.data!=null&&(n+=JSON.stringify(e.data,this.replacer)),n}encodeAsBinary(e){const n=I4e(e),r=this.encodeAsString(n.packet),i=n.buffers;return i.unshift(r),i}}class CC extends Po{constructor(e){super(),this.reviver=e}add(e){let n;if(typeof e=="string")n=this.decodeString(e),n.type===br.BINARY_EVENT||n.type===br.BINARY_ACK?(this.reconstructor=new M4e(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n);else if(EC(e)||e.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(e),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let n=0;const r={type:Number(e.charAt(0))};if(br[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===br.BINARY_EVENT||r.type===br.BINARY_ACK){const o=n+1;for(;e.charAt(++n)!=="-"&&n!=e.length;);const s=e.substring(o,n);if(s!=Number(s)||e.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(s)}if(e.charAt(n+1)==="/"){const o=n+1;for(;++n&&!(e.charAt(n)===","||n===e.length););r.nsp=e.substring(o,n)}else r.nsp="/";const i=e.charAt(n+1);if(i!==""&&Number(i)==i){const o=n+1;for(;++n;){const s=e.charAt(n);if(s==null||Number(s)!=s){--n;break}if(n===e.length)break}r.id=Number(e.substring(o,n+1))}if(e.charAt(++n)){const o=this.tryParse(e.substr(n));if(CC.isPayloadValid(r.type,o))r.data=o;else throw new Error("invalid payload")}return r}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,n){switch(e){case br.CONNECT:return typeof n=="object";case br.DISCONNECT:return n===void 0;case br.CONNECT_ERROR:return typeof n=="string"||typeof n=="object";case br.EVENT:case br.BINARY_EVENT:return Array.isArray(n)&&n.length>0;case br.ACK:case br.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&this.reconstructor.finishedReconstruction()}}class M4e{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const n=z4e(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var D4e=Object.freeze(Object.defineProperty({__proto__:null,protocol:L4e,get PacketType(){return br},Encoder:N4e,Decoder:CC},Symbol.toStringTag,{value:"Module"}));function Pc(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const X4e=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class wK extends Po{constructor(e,n,r){super(),this.connected=!1,this.receiveBuffer=[],this.sendBuffer=[],this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Pc(e,"open",this.onopen.bind(this)),Pc(e,"packet",this.onpacket.bind(this)),Pc(e,"error",this.onerror.bind(this)),Pc(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...n){if(X4e.hasOwnProperty(e))throw new Error('"'+e+'" is a reserved event name');n.unshift(e);const r={type:br.EVENT,data:n};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const s=this.ids++,a=n.pop();this._registerAckCallback(s,a),r.id=s}const i=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!i||!this.connected)||(this.connected?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r)),this.flags={},this}_registerAckCallback(e,n){const r=this.flags.timeout;if(r===void 0){this.acks[e]=n;return}const i=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===e&&this.sendBuffer.splice(o,1);n.call(this,new Error("operation has timed out"))},r);this.acks[e]=(...o)=>{this.io.clearTimeoutFn(i),n.apply(this,[null,...o])}}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this.packet({type:br.CONNECT,data:e})}):this.packet({type:br.CONNECT,data:this.auth})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,n)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case br.CONNECT:if(e.data&&e.data.sid){const i=e.data.sid;this.onconnect(i)}else this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case br.EVENT:case br.BINARY_EVENT:this.onevent(e);break;case br.ACK:case br.BINARY_ACK:this.onack(e);break;case br.DISCONNECT:this.ondisconnect();break;case br.CONNECT_ERROR:this.destroy();const r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){const n=e.data||[];e.id!=null&&n.push(this.ack(e.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,e)}super.emit.apply(this,e)}ack(e){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:br.ACK,id:e,data:i}))}}onack(e){const n=this.acks[e.id];typeof n=="function"&&(n.apply(this,e.data),delete this.acks[e.id])}onconnect(e){this.id=e,this.connected=!0,this.emitBuffered(),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:br.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(e===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(e===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,e.data)}}}function X0(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}X0.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=(Math.floor(e*10)&1)==0?t-n:t+n}return Math.min(t,this.max)|0};X0.prototype.reset=function(){this.attempts=0};X0.prototype.setMin=function(t){this.ms=t};X0.prototype.setMax=function(t){this.max=t};X0.prototype.setJitter=function(t){this.jitter=t};class IQ extends Po{constructor(e,n){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(n=e,e=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,i_(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new X0({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=e;const i=n.parser||D4e;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var n;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(n=this.backoff)===null||n===void 0||n.setMin(e),this)}randomizationFactor(e){var n;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(n=this.backoff)===null||n===void 0||n.setJitter(e),this)}reconnectionDelayMax(e){var n;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(n=this.backoff)===null||n===void 0||n.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new $d(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=Pc(n,"open",function(){r.onopen(),e&&e()}),o=Pc(n,"error",s=>{r.cleanup(),r._readyState="closed",this.emitReserved("error",s),e?e(s):r.maybeReconnectOnOpen()});if(this._timeout!==!1){const s=this._timeout;s===0&&i();const a=this.setTimeoutFn(()=>{i(),n.close(),n.emit("error",new Error("timeout"))},s);this.opts.autoUnref&&a.unref(),this.subs.push(function(){clearTimeout(a)})}return this.subs.push(i),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Pc(e,"ping",this.onping.bind(this)),Pc(e,"data",this.ondata.bind(this)),Pc(e,"error",this.onerror.bind(this)),Pc(e,"close",this.onclose.bind(this)),Pc(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){this.decoder.add(e)}ondecoded(e){this.emitReserved("packet",e)}onerror(e){this.emitReserved("error",e)}socket(e,n){let r=this.nsps[e];return r||(r=new wK(this,e,n),this.nsps[e]=r),r}_destroy(e){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(e){const n=this.encoder.encode(e);for(let r=0;r<n.length;r++)this.engine.write(n[r],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,n){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(function(){clearTimeout(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Am={};function Ax(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=$4e(t,e.path||"/socket.io"),r=n.source,i=n.id,o=n.path,s=Am[i]&&o in Am[i].nsps,a=e.forceNew||e["force new connection"]||e.multiplex===!1||s;let l;return a?l=new IQ(r,e):(Am[i]||(Am[i]=new IQ(r,e)),l=Am[i]),n.query&&!e.query&&(e.query=n.queryKey),l.socket(n.path,e)}Object.assign(Ax,{Manager:IQ,Socket:wK,io:Ax,connect:Ax});var _n=(t=>(t.Loading="loading",t.Ready="ready",t.Offline="offline",t.Online="online",t.StatusChanged="statusChanged",t.LspStatusChanged="lspStatusChanged",t.PlaygroundChanged="playgroundChanged",t.Following="following",t.UnFollowing="unFollowing",t.RunStatusChanged="runStatusChanged",t.FileStructureChanged="fileStructureChanged",t.FileContentChanged="fileContentChanged",t.AppendToConsole="appendToConsole",t.AppendToTerminal="appendToTerminal",t.ApplicationAvailable="ApplicationAvailable",t.PlaybackInfo="playbackInfo",t.ReplayStart="ReplayStart",t.ReplayEnd="ReplayEnd",t.Customize="customize",t.UserEnter="userEnter",t.UserLeave="userLeave",t.UsersUpdated="usersUpdated",t.EditorScroll="editorScroll",t.ConnectionBroken="connectionBroken",t.ConnectionFailed="connectionFailed",t.AuthorizationFailed="authorizationFailed",t.FileStructureDamaged="fileStructureDamaged",t.ErrorFromServer="errorFromServer",t.AppendCustomizeFrameData="appendCustomizeFrameData",t.LineAction="lineAction",t.FileInfo="fileInfo",t.InsertTextById="insertTextById",t.ReplaceCodeById="replaceCodeById",t.Debug="debug",t.JumpToAreaById="jumpToAreaById",t.Xterm="xterm",t))(_n||{}),Oo=(t=>(t.RetainingAllFiles="retainingAllFiles",t.Authorize="auth",t.Active="active",t.Run="run",t.Stop="stop",t.Heartbeat="heartbeat",t.SetFileLockStatus="",t.SetFileVisiable="",t.AddFileToUnitTest="",t.RemoveFileFromUnitTest="",t.KeyEvent="keyEvent",t.File="file",t.CloseFile="closeFile",t.EditFile="editFile",t.FileTree="fileTree",t.Terminal="terminal",t.XtermStatus="XtermStatus",t.Cursor="cursor",t.GetPlaybackInfo="getPlaybackInfo",t.LoadPlaybackData="loadPlaybackData",t.FollowingAgentUser="followingAgentUser",t.UnFollowingAgentUser="unFollowingAgentUser",t.FollowingFocusComponent="followingFocusComponent",t.EditorScroll="editorScroll",t.CustomizeFrameData="appendCustomizeFrameData",t.AddCDNSource="addCDNSource",t.RestartServer="restartServer",t.RestartLSPServer="restartLSPServer",t.SwitchLanguage="switchLanguage",t.StatisticsPlaybackData="statisticsPlaybackData",t))(Oo||{}),Ct=(t=>(t.Connect="connect",t.Disconnect="disconnect",t.AuthAck="authAck",t.Active="active",t.SyncPlaygroundInfo="syncPlaygroundInfo",t.ChangePlaygroundInfo="changePlaygroundInfo",t.RunStatus="runStatus",t.LspStatus="lspStatus",t.Following="following",t.UnFollowing="unFollowing",t.UserEnter="userEnter",t.UserLeave="userLeave",t.UsersUpdated="usersUpdated",t.Simulator="simulator",t.PlaybackInfo="playbackInfo",t.PlaybackData="playbackData",t.File="file",t.FileTree="fileTree",t.Run="run",t.Console="console",t.Terminal="terminal",t.XtermStatus="XtermStatus",t.Editor="editor",t.Debug="debug",t.KeyEvent="keyEvent",t.CloseFile="closeFile",t.FocusComponent="FocusComponent",t.InvisibleComponentActive="InvisibleComponentActive",t.AppendCustomizeFrameData="appendCustomizeFrameData",t.TerminalStatus="terminalStatus",t.LspServerClientStateChange="lspServerClientStateChange",t.I18nLanguage="i18nLanguage",t.PushFormatCode="pushFormatCode",t.SetBreakPoint="setBreakPoint",t.DebugRun="debugRun",t.StoppedData="stoppedData",t.DebugNext="next",t.DebugContinue="continue",t.DebugStatus="debugStatus",t.DebugStepIn="stepIn",t.DebugStepOut="stepOut",t.Variables="variables",t.UpdateArea="updateArea",t.UpdateDebugSupport="updateDebugSupport",t.SyncDebugData="syncDebugData",t))(Ct||{}),RC=(t=>(t.NotSupport="notSupport",t.Loading="loading",t.Running="running",t.Shutdown="shutdown",t.LspReady="lspReady",t))(RC||{});class W4e{constructor(e,n=2e3){St(this,"name");St(this,"channel");St(this,"_timeout");St(this,"_messageId");St(this,"_messages");St(this,"_filter");this.name=e,this._messageId=0,this.channel=new BroadcastChannel(e),this.channel.onmessage=r=>this.receive(r),this._messages=[],this._timeout=n}setFilter(e){this._filter=e}send(e,n){const r=new U4e(n||this._timeout),i=new Promise((o,s)=>{r._reject=s,r._resolve=o});return this._messages.push(r),this.channel.postMessage({id:this._messageId++,type:"request",payload:e}),i}answer(e,n){this.channel.postMessage({id:e,type:"response",payload:n})}receive(e){const n=e.data;n.type==="request"?(!this._filter||this._filter(n.payload))&&this.answer(n.id,{active:!0}):n.type==="response"&&this._messages[n.id].reject(n.payload)}}class U4e{constructor(e){St(this,"_resolve");St(this,"_reject");St(this,"_interval");this._interval=setTimeout(()=>this.resolve({active:!1,reason:"timeout, no one uses it"}),e)}resolve(e){clearTimeout(this._interval),this._resolve(e)}reject(e){this._reject(e)}}let _K,D5;async function q4e(t){D5||(D5=new W4e("dao-paas",500));let e="";D5.setFilter(i=>i.id===e);const n=JSON.parse(localStorage.getItem(`agentUsers_${t}`)||"[]")||[],r=[];for(const i of n){const o=D5.send(i).then(()=>{if(e==="")return i.time=new Date().getTime(),e=i.id,localStorage.setItem(`agentUsers_${t}`,JSON.stringify(n)),Promise.resolve(e)});r.push(o)}return Promise.any(r)}function B4e(t,e){const n=JSON.parse(localStorage.getItem(`agentUsers_${e}`)||"[]")||[],r=n.find(i=>i.id==t);r?r.time=new Date().getTime():n.push({id:t,time:new Date().getTime()}),localStorage.setItem(`agentUsers_${e}`,JSON.stringify(n)),_K=t}function Y4e(t){return t===_K}const TK="daoLogger",F4e=typeof module=="object"&&typeof module.exports=="object",Uk=F4e?global:window,kK=Uk&&Uk.localStorage?Uk.localStorage:{store:{},getItem(t){return this.store[t]},setItem(t,e){this.store[t]=e}},Mt=new Proxy(console,{get(t,e){return kK.getItem(TK)?t[e]:()=>{}}}),j4e=()=>{kK.setItem(TK,"*")};function Ra(t){return Ra=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ra(t)}function la(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function mD(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function ca(t,e,n){return e&&mD(t.prototype,e),n&&mD(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Mc(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function BS(t,e){return BS=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},BS(t,e)}function kh(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&BS(t,e)}function W0(t,e){if(e&&(Ra(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Mc(t)}function nc(t){return nc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},nc(t)}function Ln(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function PK(t){if(Array.isArray(t))return t}function QK(t){if(typeof Symbol!="undefined"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function zQ(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function AC(t,e){if(!!t){if(typeof t=="string")return zQ(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return zQ(t,e)}}function $K(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
49
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Z4e(t){return PK(t)||QK(t)||AC(t)||$K()}function gD(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function vD(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?gD(Object(n),!0).forEach(function(r){Ln(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):gD(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}var V4e={type:"logger",log:function(e){this.output("log",e)},warn:function(e){this.output("warn",e)},error:function(e){this.output("error",e)},output:function(e,n){console&&console[e]&&console[e].apply(console,n)}},G4e=function(){function t(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};la(this,t),this.init(e,n)}return ca(t,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=r.prefix||"i18next:",this.logger=n||V4e,this.options=r,this.debug=r.debug}},{key:"setDebug",value:function(n){this.debug=n}},{key:"log",value:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return this.forward(r,"log","",!0)}},{key:"warn",value:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return this.forward(r,"warn","",!0)}},{key:"error",value:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return this.forward(r,"error","")}},{key:"deprecate",value:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return this.forward(r,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(n,r,i,o){return o&&!this.debug?null:(typeof n[0]=="string"&&(n[0]="".concat(i).concat(this.prefix," ").concat(n[0])),this.logger[r](n))}},{key:"create",value:function(n){return new t(this.logger,vD(vD({},{prefix:"".concat(this.prefix,":").concat(n,":")}),this.options))}}]),t}(),hu=new G4e,dh=function(){function t(){la(this,t),this.observers={}}return ca(t,[{key:"on",value:function(n,r){var i=this;return n.split(" ").forEach(function(o){i.observers[o]=i.observers[o]||[],i.observers[o].push(r)}),this}},{key:"off",value:function(n,r){if(!!this.observers[n]){if(!r){delete this.observers[n];return}this.observers[n]=this.observers[n].filter(function(i){return i!==r})}}},{key:"emit",value:function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];if(this.observers[n]){var s=[].concat(this.observers[n]);s.forEach(function(l){l.apply(void 0,i)})}if(this.observers["*"]){var a=[].concat(this.observers["*"]);a.forEach(function(l){l.apply(l,[n].concat(i))})}}}]),t}();function Im(){var t,e,n=new Promise(function(r,i){t=r,e=i});return n.resolve=t,n.reject=e,n}function yD(t){return t==null?"":""+t}function H4e(t,e,n){t.forEach(function(r){e[r]&&(n[r]=e[r])})}function IC(t,e,n){function r(a){return a&&a.indexOf("###")>-1?a.replace(/###/g,"."):a}function i(){return!t||typeof t=="string"}for(var o=typeof e!="string"?[].concat(e):e.split(".");o.length>1;){if(i())return{};var s=r(o.shift());!t[s]&&n&&(t[s]=new n),Object.prototype.hasOwnProperty.call(t,s)?t=t[s]:t={}}return i()?{}:{obj:t,k:r(o.shift())}}function bD(t,e,n){var r=IC(t,e,Object),i=r.obj,o=r.k;i[o]=n}function K4e(t,e,n,r){var i=IC(t,e,Object),o=i.obj,s=i.k;o[s]=o[s]||[],r&&(o[s]=o[s].concat(n)),r||o[s].push(n)}function YS(t,e){var n=IC(t,e),r=n.obj,i=n.k;if(!!r)return r[i]}function xD(t,e,n){var r=YS(t,n);return r!==void 0?r:YS(e,n)}function EK(t,e,n){for(var r in e)r!=="__proto__"&&r!=="constructor"&&(r in t?typeof t[r]=="string"||t[r]instanceof String||typeof e[r]=="string"||e[r]instanceof String?n&&(t[r]=e[r]):EK(t[r],e[r],n):t[r]=e[r]);return t}function wO(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var J4e={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function ewe(t){return typeof t=="string"?t.replace(/[&<>"'\/]/g,function(e){return J4e[e]}):t}var o_=typeof window!="undefined"&&window.navigator&&typeof window.navigator.userAgentData=="undefined"&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,twe=[" ",",","?","!",";"];function nwe(t,e,n){e=e||"",n=n||"";var r=twe.filter(function(a){return e.indexOf(a)<0&&n.indexOf(a)<0});if(r.length===0)return!0;var i=new RegExp("(".concat(r.map(function(a){return a==="?"?"\\?":a}).join("|"),")")),o=!i.test(t);if(!o){var s=t.indexOf(n);s>0&&!i.test(t.substring(0,s))&&(o=!0)}return o}function SD(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function X5(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?SD(Object(n),!0).forEach(function(r){Ln(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):SD(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function rwe(t){var e=iwe();return function(){var r=nc(t),i;if(e){var o=nc(this).constructor;i=Reflect.construct(r,arguments,o)}else i=r.apply(this,arguments);return W0(this,i)}}function iwe(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function CK(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!!t){if(t[e])return t[e];for(var r=e.split(n),i=t,o=0;o<r.length;++o){if(!i||typeof i[r[o]]=="string"&&o+1<r.length)return;if(i[r[o]]===void 0){for(var s=2,a=r.slice(o,o+s).join(n),l=i[a];l===void 0&&r.length>o+s;)s++,a=r.slice(o,o+s).join(n),l=i[a];if(l===void 0)return;if(l===null)return null;if(e.endsWith(a)){if(typeof l=="string")return l;if(a&&typeof l[a]=="string")return l[a]}var c=r.slice(o+s).join(n);return c?CK(l,c,n):void 0}i=i[r[o]]}return i}}var owe=function(t){kh(n,t);var e=rwe(n);function n(r){var i,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};return la(this,n),i=e.call(this),o_&&dh.call(Mc(i)),i.data=r||{},i.options=o,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.options.ignoreJSONStructure===void 0&&(i.options.ignoreJSONStructure=!0),i}return ca(n,[{key:"addNamespaces",value:function(i){this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}},{key:"removeNamespaces",value:function(i){var o=this.options.ns.indexOf(i);o>-1&&this.options.ns.splice(o,1)}},{key:"getResource",value:function(i,o,s){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},l=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,c=a.ignoreJSONStructure!==void 0?a.ignoreJSONStructure:this.options.ignoreJSONStructure,u=[i,o];s&&typeof s!="string"&&(u=u.concat(s)),s&&typeof s=="string"&&(u=u.concat(l?s.split(l):s)),i.indexOf(".")>-1&&(u=i.split("."));var f=YS(this.data,u);return f||!c||typeof s!="string"?f:CK(this.data&&this.data[i]&&this.data[i][o],s,l)}},{key:"addResource",value:function(i,o,s,a){var l=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1},c=this.options.keySeparator;c===void 0&&(c=".");var u=[i,o];s&&(u=u.concat(c?s.split(c):s)),i.indexOf(".")>-1&&(u=i.split("."),a=o,o=u[1]),this.addNamespaces(o),bD(this.data,u,a),l.silent||this.emit("added",i,o,s,a)}},{key:"addResources",value:function(i,o,s){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(var l in s)(typeof s[l]=="string"||Object.prototype.toString.apply(s[l])==="[object Array]")&&this.addResource(i,o,l,s[l],{silent:!0});a.silent||this.emit("added",i,o,s)}},{key:"addResourceBundle",value:function(i,o,s,a,l){var c=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},u=[i,o];i.indexOf(".")>-1&&(u=i.split("."),a=s,s=o,o=u[1]),this.addNamespaces(o);var f=YS(this.data,u)||{};a?EK(f,s,l):f=X5(X5({},f),s),bD(this.data,u,f),c.silent||this.emit("added",i,o,s)}},{key:"removeResourceBundle",value:function(i,o){this.hasResourceBundle(i,o)&&delete this.data[i][o],this.removeNamespaces(o),this.emit("removed",i,o)}},{key:"hasResourceBundle",value:function(i,o){return this.getResource(i,o)!==void 0}},{key:"getResourceBundle",value:function(i,o){return o||(o=this.options.defaultNS),this.options.compatibilityAPI==="v1"?X5(X5({},{}),this.getResource(i,o)):this.getResource(i,o)}},{key:"getDataByLanguage",value:function(i){return this.data[i]}},{key:"hasLanguageSomeTranslations",value:function(i){var o=this.getDataByLanguage(i),s=o&&Object.keys(o)||[];return!!s.find(function(a){return o[a]&&Object.keys(o[a]).length>0})}},{key:"toJSON",value:function(){return this.data}}]),n}(dh),RK={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,n,r,i,o){var s=this;return e.forEach(function(a){s.processors[a]&&(n=s.processors[a].process(n,r,i,o))}),n}};function wD(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Hs(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?wD(Object(n),!0).forEach(function(r){Ln(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):wD(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function swe(t){var e=awe();return function(){var r=nc(t),i;if(e){var o=nc(this).constructor;i=Reflect.construct(r,arguments,o)}else i=r.apply(this,arguments);return W0(this,i)}}function awe(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var _D={},TD=function(t){kh(n,t);var e=swe(n);function n(r){var i,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return la(this,n),i=e.call(this),o_&&dh.call(Mc(i)),H4e(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],r,Mc(i)),i.options=o,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.logger=hu.create("translator"),i}return ca(n,[{key:"changeLanguage",value:function(i){i&&(this.language=i)}},{key:"exists",value:function(i){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(i==null)return!1;var s=this.resolve(i,o);return s&&s.res!==void 0}},{key:"extractFromKey",value:function(i,o){var s=o.nsSeparator!==void 0?o.nsSeparator:this.options.nsSeparator;s===void 0&&(s=":");var a=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,l=o.ns||this.options.defaultNS||[],c=s&&i.indexOf(s)>-1,u=!this.options.userDefinedKeySeparator&&!o.keySeparator&&!this.options.userDefinedNsSeparator&&!o.nsSeparator&&!nwe(i,s,a);if(c&&!u){var f=i.match(this.interpolator.nestingRegexp);if(f&&f.length>0)return{key:i,namespaces:l};var h=i.split(s);(s!==a||s===a&&this.options.ns.indexOf(h[0])>-1)&&(l=h.shift()),i=h.join(a)}return typeof l=="string"&&(l=[l]),{key:i,namespaces:l}}},{key:"translate",value:function(i,o,s){var a=this;if(Ra(o)!=="object"&&this.options.overloadTranslationOptionHandler&&(o=this.options.overloadTranslationOptionHandler(arguments)),o||(o={}),i==null)return"";Array.isArray(i)||(i=[String(i)]);var l=o.returnDetails!==void 0?o.returnDetails:this.options.returnDetails,c=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,u=this.extractFromKey(i[i.length-1],o),f=u.key,h=u.namespaces,d=h[h.length-1],O=o.lng||this.language,b=o.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(O&&O.toLowerCase()==="cimode"){if(b){var v=o.nsSeparator||this.options.nsSeparator;return l?(p.res="".concat(d).concat(v).concat(f),p):"".concat(d).concat(v).concat(f)}return l?(p.res=f,p):f}var p=this.resolve(i,o),g=p&&p.res,y=p&&p.usedKey||f,S=p&&p.exactUsedKey||f,w=Object.prototype.toString.apply(g),T=["[object Number]","[object Function]","[object RegExp]"],k=o.joinArrays!==void 0?o.joinArrays:this.options.joinArrays,A=!this.i18nFormat||this.i18nFormat.handleAsObject,L=typeof g!="string"&&typeof g!="boolean"&&typeof g!="number";if(A&&g&&L&&T.indexOf(w)<0&&!(typeof k=="string"&&w==="[object Array]")){if(!o.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var $=this.options.returnedObjectHandler?this.options.returnedObjectHandler(y,g,Hs(Hs({},o),{},{ns:h})):"key '".concat(f," (").concat(this.language,")' returned an object instead of string.");return l?(p.res=$,p):$}if(c){var E=w==="[object Array]",C=E?[]:{},I=E?S:y;for(var H in g)if(Object.prototype.hasOwnProperty.call(g,H)){var Y="".concat(I).concat(c).concat(H);C[H]=this.translate(Y,Hs(Hs({},o),{joinArrays:!1,ns:h})),C[H]===Y&&(C[H]=g[H])}g=C}}else if(A&&typeof k=="string"&&w==="[object Array]")g=g.join(k),g&&(g=this.extendTranslation(g,i,o,s));else{var z=!1,U=!1,j=o.count!==void 0&&typeof o.count!="string",K=n.hasDefaultValue(o),se=j?this.pluralResolver.getSuffix(O,o.count,o):"",G=o["defaultValue".concat(se)]||o.defaultValue;!this.isValidLookup(g)&&K&&(z=!0,g=G),this.isValidLookup(g)||(U=!0,g=f);var re=o.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,Te=re&&U?void 0:g,Re=K&&G!==g&&this.options.updateMissing;if(U||z||Re){if(this.logger.log(Re?"updateKey":"missingKey",O,d,f,Re?G:g),c){var V=this.resolve(f,Hs(Hs({},o),{},{keySeparator:!1}));V&&V.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var pe=[],J=this.languageUtils.getFallbackCodes(this.options.fallbackLng,o.lng||this.language);if(this.options.saveMissingTo==="fallback"&&J&&J[0])for(var ae=0;ae<J.length;ae++)pe.push(J[ae]);else this.options.saveMissingTo==="all"?pe=this.languageUtils.toResolveHierarchy(o.lng||this.language):pe.push(o.lng||this.language);var ie=function(Xe,je,at){var it=K&&at!==g?at:Te;a.options.missingKeyHandler?a.options.missingKeyHandler(Xe,d,je,it,Re,o):a.backendConnector&&a.backendConnector.saveMissing&&a.backendConnector.saveMissing(Xe,d,je,it,Re,o),a.emit("missingKey",Xe,d,je,g)};this.options.saveMissing&&(this.options.saveMissingPlurals&&j?pe.forEach(function(Ee){a.pluralResolver.getSuffixes(Ee,o).forEach(function(Xe){ie([Ee],f+Xe,o["defaultValue".concat(Xe)]||G)})}):ie(pe,f,G))}g=this.extendTranslation(g,i,o,p,s),U&&g===f&&this.options.appendNamespaceToMissingKey&&(g="".concat(d,":").concat(f)),(U||z)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?g=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?"".concat(d,":").concat(f):f,z?g:void 0):g=this.options.parseMissingKeyHandler(g))}return l?(p.res=g,p):g}},{key:"extendTranslation",value:function(i,o,s,a,l){var c=this;if(this.i18nFormat&&this.i18nFormat.parse)i=this.i18nFormat.parse(i,Hs(Hs({},this.options.interpolation.defaultVariables),s),a.usedLng,a.usedNS,a.usedKey,{resolved:a});else if(!s.skipInterpolation){s.interpolation&&this.interpolator.init(Hs(Hs({},s),{interpolation:Hs(Hs({},this.options.interpolation),s.interpolation)}));var u=typeof i=="string"&&(s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables),f;if(u){var h=i.match(this.interpolator.nestingRegexp);f=h&&h.length}var d=s.replace&&typeof s.replace!="string"?s.replace:s;if(this.options.interpolation.defaultVariables&&(d=Hs(Hs({},this.options.interpolation.defaultVariables),d)),i=this.interpolator.interpolate(i,d,s.lng||this.language,s),u){var O=i.match(this.interpolator.nestingRegexp),b=O&&O.length;f<b&&(s.nest=!1)}s.nest!==!1&&(i=this.interpolator.nest(i,function(){for(var g=arguments.length,y=new Array(g),S=0;S<g;S++)y[S]=arguments[S];return l&&l[0]===y[0]&&!s.context?(c.logger.warn("It seems you are nesting recursively key: ".concat(y[0]," in key: ").concat(o[0])),null):c.translate.apply(c,y.concat([o]))},s)),s.interpolation&&this.interpolator.reset()}var v=s.postProcess||this.options.postProcess,p=typeof v=="string"?[v]:v;return i!=null&&p&&p.length&&s.applyPostProcessor!==!1&&(i=RK.handle(p,i,o,this.options&&this.options.postProcessPassResolved?Hs({i18nResolved:a},s):s,this)),i}},{key:"resolve",value:function(i){var o=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a,l,c,u,f;return typeof i=="string"&&(i=[i]),i.forEach(function(h){if(!o.isValidLookup(a)){var d=o.extractFromKey(h,s),O=d.key;l=O;var b=d.namespaces;o.options.fallbackNS&&(b=b.concat(o.options.fallbackNS));var v=s.count!==void 0&&typeof s.count!="string",p=v&&!s.ordinal&&s.count===0&&o.pluralResolver.shouldUseIntlApi(),g=s.context!==void 0&&(typeof s.context=="string"||typeof s.context=="number")&&s.context!=="",y=s.lngs?s.lngs:o.languageUtils.toResolveHierarchy(s.lng||o.language,s.fallbackLng);b.forEach(function(S){o.isValidLookup(a)||(f=S,!_D["".concat(y[0],"-").concat(S)]&&o.utils&&o.utils.hasLoadedNamespace&&!o.utils.hasLoadedNamespace(f)&&(_D["".concat(y[0],"-").concat(S)]=!0,o.logger.warn('key "'.concat(l,'" for languages "').concat(y.join(", "),`" won't get resolved as namespace "`).concat(f,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),y.forEach(function(w){if(!o.isValidLookup(a)){u=w;var T=[O];if(o.i18nFormat&&o.i18nFormat.addLookupKeys)o.i18nFormat.addLookupKeys(T,O,w,S,s);else{var k;v&&(k=o.pluralResolver.getSuffix(w,s.count,s));var A="".concat(o.options.pluralSeparator,"zero");if(v&&(T.push(O+k),p&&T.push(O+A)),g){var L="".concat(O).concat(o.options.contextSeparator).concat(s.context);T.push(L),v&&(T.push(L+k),p&&T.push(L+A))}}for(var $;$=T.pop();)o.isValidLookup(a)||(c=$,a=o.getResource(w,S,$,s))}}))})}}),{res:a,usedKey:l,exactUsedKey:c,usedLng:u,usedNS:f}}},{key:"isValidLookup",value:function(i){return i!==void 0&&!(!this.options.returnNull&&i===null)&&!(!this.options.returnEmptyString&&i==="")}},{key:"getResource",value:function(i,o,s){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(i,o,s,a):this.resourceStore.getResource(i,o,s,a)}}],[{key:"hasDefaultValue",value:function(i){var o="defaultValue";for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)&&o===s.substring(0,o.length)&&i[s]!==void 0)return!0;return!1}}]),n}(dh);function qk(t){return t.charAt(0).toUpperCase()+t.slice(1)}var lwe=function(){function t(e){la(this,t),this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=hu.create("languageUtils")}return ca(t,[{key:"getScriptPartFromCode",value:function(n){if(!n||n.indexOf("-")<0)return null;var r=n.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}},{key:"getLanguagePartFromCode",value:function(n){if(!n||n.indexOf("-")<0)return n;var r=n.split("-");return this.formatLanguageCode(r[0])}},{key:"formatLanguageCode",value:function(n){if(typeof n=="string"&&n.indexOf("-")>-1){var r=["hans","hant","latn","cyrl","cans","mong","arab"],i=n.split("-");return this.options.lowerCaseLng?i=i.map(function(o){return o.toLowerCase()}):i.length===2?(i[0]=i[0].toLowerCase(),i[1]=i[1].toUpperCase(),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=qk(i[1].toLowerCase()))):i.length===3&&(i[0]=i[0].toLowerCase(),i[1].length===2&&(i[1]=i[1].toUpperCase()),i[0]!=="sgn"&&i[2].length===2&&(i[2]=i[2].toUpperCase()),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=qk(i[1].toLowerCase())),r.indexOf(i[2].toLowerCase())>-1&&(i[2]=qk(i[2].toLowerCase()))),i.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?n.toLowerCase():n}},{key:"isSupportedCode",value:function(n){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(n=this.getLanguagePartFromCode(n)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(n)>-1}},{key:"getBestMatchFromCodes",value:function(n){var r=this;if(!n)return null;var i;return n.forEach(function(o){if(!i){var s=r.formatLanguageCode(o);(!r.options.supportedLngs||r.isSupportedCode(s))&&(i=s)}}),!i&&this.options.supportedLngs&&n.forEach(function(o){if(!i){var s=r.getLanguagePartFromCode(o);if(r.isSupportedCode(s))return i=s;i=r.options.supportedLngs.find(function(a){if(a.indexOf(s)===0)return a})}}),i||(i=this.getFallbackCodes(this.options.fallbackLng)[0]),i}},{key:"getFallbackCodes",value:function(n,r){if(!n)return[];if(typeof n=="function"&&(n=n(r)),typeof n=="string"&&(n=[n]),Object.prototype.toString.apply(n)==="[object Array]")return n;if(!r)return n.default||[];var i=n[r];return i||(i=n[this.getScriptPartFromCode(r)]),i||(i=n[this.formatLanguageCode(r)]),i||(i=n[this.getLanguagePartFromCode(r)]),i||(i=n.default),i||[]}},{key:"toResolveHierarchy",value:function(n,r){var i=this,o=this.getFallbackCodes(r||this.options.fallbackLng||[],n),s=[],a=function(c){!c||(i.isSupportedCode(c)?s.push(c):i.logger.warn("rejecting language code not found in supportedLngs: ".concat(c)))};return typeof n=="string"&&n.indexOf("-")>-1?(this.options.load!=="languageOnly"&&a(this.formatLanguageCode(n)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&a(this.getScriptPartFromCode(n)),this.options.load!=="currentOnly"&&a(this.getLanguagePartFromCode(n))):typeof n=="string"&&a(this.formatLanguageCode(n)),o.forEach(function(l){s.indexOf(l)<0&&a(i.formatLanguageCode(l))}),s}}]),t}(),cwe=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],uwe={1:function(e){return Number(e>1)},2:function(e){return Number(e!=1)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(e==1?0:e>=2&&e<=4?1:2)},7:function(e){return Number(e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(e==1?0:e==2?1:e!=8&&e!=11?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(e==1?0:e==2?1:e<7?2:e<11?3:4)},11:function(e){return Number(e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(e!==0)},14:function(e){return Number(e==1?0:e==2?1:e==3?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:e!==0?1:2)},17:function(e){return Number(e==1||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(e==0?0:e==1?1:2)},19:function(e){return Number(e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(e==1?0:e==0||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3)}},fwe=["v1","v2","v3"],kD={zero:0,one:1,two:2,few:3,many:4,other:5};function dwe(){var t={};return cwe.forEach(function(e){e.lngs.forEach(function(n){t[n]={numbers:e.nr,plurals:uwe[e.fc]}})}),t}var hwe=function(){function t(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};la(this,t),this.languageUtils=e,this.options=n,this.logger=hu.create("pluralResolver"),(!this.options.compatibilityJSON||this.options.compatibilityJSON==="v4")&&(typeof Intl=="undefined"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=dwe()}return ca(t,[{key:"addRule",value:function(n,r){this.rules[n]=r}},{key:"getRule",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(n,{type:r.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[n]||this.rules[this.languageUtils.getLanguagePartFromCode(n)]}},{key:"needsPlural",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=this.getRule(n,r);return this.shouldUseIntlApi()?i&&i.resolvedOptions().pluralCategories.length>1:i&&i.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(n,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(n,i).map(function(o){return"".concat(r).concat(o)})}},{key:"getSuffixes",value:function(n){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=this.getRule(n,i);return o?this.shouldUseIntlApi()?o.resolvedOptions().pluralCategories.sort(function(s,a){return kD[s]-kD[a]}).map(function(s){return"".concat(r.options.prepend).concat(s)}):o.numbers.map(function(s){return r.getSuffix(n,s,i)}):[]}},{key:"getSuffix",value:function(n,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=this.getRule(n,i);return o?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(o.select(r)):this.getSuffixRetroCompatible(o,r):(this.logger.warn("no plural rule found for: ".concat(n)),"")}},{key:"getSuffixRetroCompatible",value:function(n,r){var i=this,o=n.noAbs?n.plurals(r):n.plurals(Math.abs(r)),s=n.numbers[o];this.options.simplifyPluralSuffix&&n.numbers.length===2&&n.numbers[0]===1&&(s===2?s="plural":s===1&&(s=""));var a=function(){return i.options.prepend&&s.toString()?i.options.prepend+s.toString():s.toString()};return this.options.compatibilityJSON==="v1"?s===1?"":typeof s=="number"?"_plural_".concat(s.toString()):a():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&n.numbers.length===2&&n.numbers[0]===1?a():this.options.prepend&&o.toString()?this.options.prepend+o.toString():o.toString()}},{key:"shouldUseIntlApi",value:function(){return!fwe.includes(this.options.compatibilityJSON)}}]),t}();function PD(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Oc(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?PD(Object(n),!0).forEach(function(r){Ln(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):PD(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}var pwe=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};la(this,t),this.logger=hu.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||function(n){return n},this.init(e)}return ca(t,[{key:"init",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};n.interpolation||(n.interpolation={escapeValue:!0});var r=n.interpolation;this.escape=r.escape!==void 0?r.escape:ewe,this.escapeValue=r.escapeValue!==void 0?r.escapeValue:!0,this.useRawValueToEscape=r.useRawValueToEscape!==void 0?r.useRawValueToEscape:!1,this.prefix=r.prefix?wO(r.prefix):r.prefixEscaped||"{{",this.suffix=r.suffix?wO(r.suffix):r.suffixEscaped||"}}",this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||",",this.unescapePrefix=r.unescapeSuffix?"":r.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":r.unescapeSuffix||"",this.nestingPrefix=r.nestingPrefix?wO(r.nestingPrefix):r.nestingPrefixEscaped||wO("$t("),this.nestingSuffix=r.nestingSuffix?wO(r.nestingSuffix):r.nestingSuffixEscaped||wO(")"),this.nestingOptionsSeparator=r.nestingOptionsSeparator?r.nestingOptionsSeparator:r.nestingOptionsSeparator||",",this.maxReplaces=r.maxReplaces?r.maxReplaces:1e3,this.alwaysFormat=r.alwaysFormat!==void 0?r.alwaysFormat:!1,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var n="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(n,"g");var r="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(r,"g");var i="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(i,"g")}},{key:"interpolate",value:function(n,r,i,o){var s=this,a,l,c,u=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function f(v){return v.replace(/\$/g,"$$$$")}var h=function(p){if(p.indexOf(s.formatSeparator)<0){var g=xD(r,u,p);return s.alwaysFormat?s.format(g,void 0,i,Oc(Oc(Oc({},o),r),{},{interpolationkey:p})):g}var y=p.split(s.formatSeparator),S=y.shift().trim(),w=y.join(s.formatSeparator).trim();return s.format(xD(r,u,S),w,i,Oc(Oc(Oc({},o),r),{},{interpolationkey:S}))};this.resetRegExp();var d=o&&o.missingInterpolationHandler||this.options.missingInterpolationHandler,O=o&&o.interpolation&&o.interpolation.skipOnVariables!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables,b=[{regex:this.regexpUnescape,safeValue:function(p){return f(p)}},{regex:this.regexp,safeValue:function(p){return s.escapeValue?f(s.escape(p)):f(p)}}];return b.forEach(function(v){for(c=0;a=v.regex.exec(n);){var p=a[1].trim();if(l=h(p),l===void 0)if(typeof d=="function"){var g=d(n,a,o);l=typeof g=="string"?g:""}else if(o&&o.hasOwnProperty(p))l="";else if(O){l=a[0];continue}else s.logger.warn("missed to pass in variable ".concat(p," for interpolating ").concat(n)),l="";else typeof l!="string"&&!s.useRawValueToEscape&&(l=yD(l));var y=v.safeValue(l);if(n=n.replace(a[0],y),O?(v.regex.lastIndex+=l.length,v.regex.lastIndex-=a[0].length):v.regex.lastIndex=0,c++,c>=s.maxReplaces)break}}),n}},{key:"nest",value:function(n,r){var i=this,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s,a,l=Oc({},o);l.applyPostProcessor=!1,delete l.defaultValue;function c(d,O){var b=this.nestingOptionsSeparator;if(d.indexOf(b)<0)return d;var v=d.split(new RegExp("".concat(b,"[ ]*{"))),p="{".concat(v[1]);d=v[0],p=this.interpolate(p,l),p=p.replace(/'/g,'"');try{l=JSON.parse(p),O&&(l=Oc(Oc({},O),l))}catch(g){return this.logger.warn("failed parsing options string in nesting for key ".concat(d),g),"".concat(d).concat(b).concat(p)}return delete l.defaultValue,d}for(;s=this.nestingRegexp.exec(n);){var u=[],f=!1;if(s[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(s[1])){var h=s[1].split(this.formatSeparator).map(function(d){return d.trim()});s[1]=h.shift(),u=h,f=!0}if(a=r(c.call(this,s[1].trim(),l),l),a&&s[0]===n&&typeof a!="string")return a;typeof a!="string"&&(a=yD(a)),a||(this.logger.warn("missed to resolve ".concat(s[1]," for nesting ").concat(n)),a=""),f&&(a=u.reduce(function(d,O){return i.format(d,O,o.lng,Oc(Oc({},o),{},{interpolationkey:s[1].trim()}))},a.trim())),n=n.replace(s[0],a),this.regexp.lastIndex=0}return n}}]),t}();function QD(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ld(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?QD(Object(n),!0).forEach(function(r){Ln(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):QD(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Owe(t){var e=t.toLowerCase().trim(),n={};if(t.indexOf("(")>-1){var r=t.split("(");e=r[0].toLowerCase().trim();var i=r[1].substring(0,r[1].length-1);if(e==="currency"&&i.indexOf(":")<0)n.currency||(n.currency=i.trim());else if(e==="relativetime"&&i.indexOf(":")<0)n.range||(n.range=i.trim());else{var o=i.split(";");o.forEach(function(s){if(!!s){var a=s.split(":"),l=Z4e(a),c=l[0],u=l.slice(1),f=u.join(":").trim().replace(/^'+|'+$/g,"");n[c.trim()]||(n[c.trim()]=f),f==="false"&&(n[c.trim()]=!1),f==="true"&&(n[c.trim()]=!0),isNaN(f)||(n[c.trim()]=parseInt(f,10))}})}}return{formatName:e,formatOptions:n}}var mwe=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};la(this,t),this.logger=hu.create("formatter"),this.options=e,this.formats={number:function(r,i,o){return new Intl.NumberFormat(i,o).format(r)},currency:function(r,i,o){return new Intl.NumberFormat(i,ld(ld({},o),{},{style:"currency"})).format(r)},datetime:function(r,i,o){return new Intl.DateTimeFormat(i,ld({},o)).format(r)},relativetime:function(r,i,o){return new Intl.RelativeTimeFormat(i,ld({},o)).format(r,o.range||"day")},list:function(r,i,o){return new Intl.ListFormat(i,ld({},o)).format(r)}},this.init(e)}return ca(t,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}},i=r.interpolation;this.formatSeparator=i.formatSeparator?i.formatSeparator:i.formatSeparator||","}},{key:"add",value:function(n,r){this.formats[n.toLowerCase().trim()]=r}},{key:"format",value:function(n,r,i,o){var s=this,a=r.split(this.formatSeparator),l=a.reduce(function(c,u){var f=Owe(u),h=f.formatName,d=f.formatOptions;if(s.formats[h]){var O=c;try{var b=o&&o.formatParams&&o.formatParams[o.interpolationkey]||{},v=b.locale||b.lng||o.locale||o.lng||i;O=s.formats[h](c,v,ld(ld(ld({},d),o),b))}catch(p){s.logger.warn(p)}return O}else s.logger.warn("there was no format function for ".concat(h));return c},n);return l}}]),t}();function $D(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ED(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?$D(Object(n),!0).forEach(function(r){Ln(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):$D(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function gwe(t){var e=vwe();return function(){var r=nc(t),i;if(e){var o=nc(this).constructor;i=Reflect.construct(r,arguments,o)}else i=r.apply(this,arguments);return W0(this,i)}}function vwe(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ywe(t,e){t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)}var bwe=function(t){kh(n,t);var e=gwe(n);function n(r,i,o){var s,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return la(this,n),s=e.call(this),o_&&dh.call(Mc(s)),s.backend=r,s.store=i,s.services=o,s.languageUtils=o.languageUtils,s.options=a,s.logger=hu.create("backendConnector"),s.waitingReads=[],s.maxParallelReads=a.maxParallelReads||10,s.readingCalls=0,s.maxRetries=a.maxRetries>=0?a.maxRetries:5,s.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,s.state={},s.queue=[],s.backend&&s.backend.init&&s.backend.init(o,a.backend,a),s}return ca(n,[{key:"queueLoad",value:function(i,o,s,a){var l=this,c={},u={},f={},h={};return i.forEach(function(d){var O=!0;o.forEach(function(b){var v="".concat(d,"|").concat(b);!s.reload&&l.store.hasResourceBundle(d,b)?l.state[v]=2:l.state[v]<0||(l.state[v]===1?u[v]===void 0&&(u[v]=!0):(l.state[v]=1,O=!1,u[v]===void 0&&(u[v]=!0),c[v]===void 0&&(c[v]=!0),h[b]===void 0&&(h[b]=!0)))}),O||(f[d]=!0)}),(Object.keys(c).length||Object.keys(u).length)&&this.queue.push({pending:u,pendingCount:Object.keys(u).length,loaded:{},errors:[],callback:a}),{toLoad:Object.keys(c),pending:Object.keys(u),toLoadLanguages:Object.keys(f),toLoadNamespaces:Object.keys(h)}}},{key:"loaded",value:function(i,o,s){var a=i.split("|"),l=a[0],c=a[1];o&&this.emit("failedLoading",l,c,o),s&&this.store.addResourceBundle(l,c,s),this.state[i]=o?-1:2;var u={};this.queue.forEach(function(f){K4e(f.loaded,[l],c),ywe(f,i),o&&f.errors.push(o),f.pendingCount===0&&!f.done&&(Object.keys(f.loaded).forEach(function(h){u[h]||(u[h]={});var d=f.loaded[h];d.length&&d.forEach(function(O){u[h][O]===void 0&&(u[h][O]=!0)})}),f.done=!0,f.errors.length?f.callback(f.errors):f.callback())}),this.emit("loaded",u),this.queue=this.queue.filter(function(f){return!f.done})}},{key:"read",value:function(i,o,s){var a=this,l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,c=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,u=arguments.length>5?arguments[5]:void 0;if(!i.length)return u(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:i,ns:o,fcName:s,tried:l,wait:c,callback:u});return}return this.readingCalls++,this.backend[s](i,o,function(f,h){if(a.readingCalls--,a.waitingReads.length>0){var d=a.waitingReads.shift();a.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(f&&h&&l<a.maxRetries){setTimeout(function(){a.read.call(a,i,o,s,l+1,c*2,u)},c);return}u(f,h)})}},{key:"prepareLoading",value:function(i,o){var s=this,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},l=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),l&&l();typeof i=="string"&&(i=this.languageUtils.toResolveHierarchy(i)),typeof o=="string"&&(o=[o]);var c=this.queueLoad(i,o,a,l);if(!c.toLoad.length)return c.pending.length||l(),null;c.toLoad.forEach(function(u){s.loadOne(u)})}},{key:"load",value:function(i,o,s){this.prepareLoading(i,o,{},s)}},{key:"reload",value:function(i,o,s){this.prepareLoading(i,o,{reload:!0},s)}},{key:"loadOne",value:function(i){var o=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",a=i.split("|"),l=a[0],c=a[1];this.read(l,c,"read",void 0,void 0,function(u,f){u&&o.logger.warn("".concat(s,"loading namespace ").concat(c," for language ").concat(l," failed"),u),!u&&f&&o.logger.log("".concat(s,"loaded namespace ").concat(c," for language ").concat(l),f),o.loaded(i,u,f)})}},{key:"saveMissing",value:function(i,o,s,a,l){var c=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(o)){this.logger.warn('did not save key "'.concat(s,'" as the namespace "').concat(o,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}s==null||s===""||(this.backend&&this.backend.create&&this.backend.create(i,o,s,a,null,ED(ED({},c),{},{isUpdate:l})),!(!i||!i[0])&&this.store.addResource(i[0],o,s,a))}}]),n}(dh);function xwe(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var n={};if(Ra(e[1])==="object"&&(n=e[1]),typeof e[1]=="string"&&(n.defaultValue=e[1]),typeof e[2]=="string"&&(n.tDescription=e[2]),Ra(e[2])==="object"||Ra(e[3])==="object"){var r=e[3]||e[2];Object.keys(r).forEach(function(i){n[i]=r[i]})}return n},interpolation:{escapeValue:!0,format:function(e,n,r,i){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function CD(t){return typeof t.ns=="string"&&(t.ns=[t.ns]),typeof t.fallbackLng=="string"&&(t.fallbackLng=[t.fallbackLng]),typeof t.fallbackNS=="string"&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs&&t.supportedLngs.indexOf("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),t}function RD(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Hc(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?RD(Object(n),!0).forEach(function(r){Ln(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):RD(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Swe(t){var e=wwe();return function(){var r=nc(t),i;if(e){var o=nc(this).constructor;i=Reflect.construct(r,arguments,o)}else i=r.apply(this,arguments);return W0(this,i)}}function wwe(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function W5(){}function _we(t){var e=Object.getOwnPropertyNames(Object.getPrototypeOf(t));e.forEach(function(n){typeof t[n]=="function"&&(t[n]=t[n].bind(t))})}var FS=function(t){kh(n,t);var e=Swe(n);function n(){var r,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;if(la(this,n),r=e.call(this),o_&&dh.call(Mc(r)),r.options=CD(i),r.services={},r.logger=hu,r.modules={external:[]},_we(Mc(r)),o&&!r.isInitialized&&!i.isClone){if(!r.options.initImmediate)return r.init(i,o),W0(r,Mc(r));setTimeout(function(){r.init(i,o)},0)}return r}return ca(n,[{key:"init",value:function(){var i=this,o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;typeof o=="function"&&(s=o,o={}),!o.defaultNS&&o.ns&&(typeof o.ns=="string"?o.defaultNS=o.ns:o.ns.indexOf("translation")<0&&(o.defaultNS=o.ns[0]));var a=xwe();this.options=Hc(Hc(Hc({},a),this.options),CD(o)),this.options.compatibilityAPI!=="v1"&&(this.options.interpolation=Hc(Hc({},a.interpolation),this.options.interpolation)),o.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=o.keySeparator),o.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=o.nsSeparator);function l(p){return p?typeof p=="function"?new p:p:null}if(!this.options.isClone){this.modules.logger?hu.init(l(this.modules.logger),this.options):hu.init(null,this.options);var c;this.modules.formatter?c=this.modules.formatter:typeof Intl!="undefined"&&(c=mwe);var u=new lwe(this.options);this.store=new owe(this.options.resources,this.options);var f=this.services;f.logger=hu,f.resourceStore=this.store,f.languageUtils=u,f.pluralResolver=new hwe(u,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),c&&(!this.options.interpolation.format||this.options.interpolation.format===a.interpolation.format)&&(f.formatter=l(c),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new pwe(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new bwe(l(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(p){for(var g=arguments.length,y=new Array(g>1?g-1:0),S=1;S<g;S++)y[S-1]=arguments[S];i.emit.apply(i,[p].concat(y))}),this.modules.languageDetector&&(f.languageDetector=l(this.modules.languageDetector),f.languageDetector.init(f,this.options.detection,this.options)),this.modules.i18nFormat&&(f.i18nFormat=l(this.modules.i18nFormat),f.i18nFormat.init&&f.i18nFormat.init(this)),this.translator=new TD(this.services,this.options),this.translator.on("*",function(p){for(var g=arguments.length,y=new Array(g>1?g-1:0),S=1;S<g;S++)y[S-1]=arguments[S];i.emit.apply(i,[p].concat(y))}),this.modules.external.forEach(function(p){p.init&&p.init(i)})}if(this.format=this.options.interpolation.format,s||(s=W5),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){var h=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);h.length>0&&h[0]!=="dev"&&(this.options.lng=h[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined");var d=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];d.forEach(function(p){i[p]=function(){var g;return(g=i.store)[p].apply(g,arguments)}});var O=["addResource","addResources","addResourceBundle","removeResourceBundle"];O.forEach(function(p){i[p]=function(){var g;return(g=i.store)[p].apply(g,arguments),i}});var b=Im(),v=function(){var g=function(S,w){i.isInitialized&&!i.initializedStoreOnce&&i.logger.warn("init: i18next is already initialized. You should call init just once!"),i.isInitialized=!0,i.options.isClone||i.logger.log("initialized",i.options),i.emit("initialized",i.options),b.resolve(w),s(S,w)};if(i.languages&&i.options.compatibilityAPI!=="v1"&&!i.isInitialized)return g(null,i.t.bind(i));i.changeLanguage(i.options.lng,g)};return this.options.resources||!this.options.initImmediate?v():setTimeout(v,0),b}},{key:"loadResources",value:function(i){var o=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:W5,a=s,l=typeof i=="string"?i:this.language;if(typeof i=="function"&&(a=i),!this.options.resources||this.options.partialBundledLanguages){if(l&&l.toLowerCase()==="cimode")return a();var c=[],u=function(d){if(!!d){var O=o.services.languageUtils.toResolveHierarchy(d);O.forEach(function(b){c.indexOf(b)<0&&c.push(b)})}};if(l)u(l);else{var f=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);f.forEach(function(h){return u(h)})}this.options.preload&&this.options.preload.forEach(function(h){return u(h)}),this.services.backendConnector.load(c,this.options.ns,function(h){!h&&!o.resolvedLanguage&&o.language&&o.setResolvedLanguage(o.language),a(h)})}else a(null)}},{key:"reloadResources",value:function(i,o,s){var a=Im();return i||(i=this.languages),o||(o=this.options.ns),s||(s=W5),this.services.backendConnector.reload(i,o,function(l){a.resolve(),s(l)}),a}},{key:"use",value:function(i){if(!i)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!i.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return i.type==="backend"&&(this.modules.backend=i),(i.type==="logger"||i.log&&i.warn&&i.error)&&(this.modules.logger=i),i.type==="languageDetector"&&(this.modules.languageDetector=i),i.type==="i18nFormat"&&(this.modules.i18nFormat=i),i.type==="postProcessor"&&RK.addPostProcessor(i),i.type==="formatter"&&(this.modules.formatter=i),i.type==="3rdParty"&&this.modules.external.push(i),this}},{key:"setResolvedLanguage",value:function(i){if(!(!i||!this.languages)&&!(["cimode","dev"].indexOf(i)>-1))for(var o=0;o<this.languages.length;o++){var s=this.languages[o];if(!(["cimode","dev"].indexOf(s)>-1)&&this.store.hasLanguageSomeTranslations(s)){this.resolvedLanguage=s;break}}}},{key:"changeLanguage",value:function(i,o){var s=this;this.isLanguageChangingTo=i;var a=Im();this.emit("languageChanging",i);var l=function(h){s.language=h,s.languages=s.services.languageUtils.toResolveHierarchy(h),s.resolvedLanguage=void 0,s.setResolvedLanguage(h)},c=function(h,d){d?(l(d),s.translator.changeLanguage(d),s.isLanguageChangingTo=void 0,s.emit("languageChanged",d),s.logger.log("languageChanged",d)):s.isLanguageChangingTo=void 0,a.resolve(function(){return s.t.apply(s,arguments)}),o&&o(h,function(){return s.t.apply(s,arguments)})},u=function(h){!i&&!h&&s.services.languageDetector&&(h=[]);var d=typeof h=="string"?h:s.services.languageUtils.getBestMatchFromCodes(h);d&&(s.language||l(d),s.translator.language||s.translator.changeLanguage(d),s.services.languageDetector&&s.services.languageDetector.cacheUserLanguage(d)),s.loadResources(d,function(O){c(O,d)})};return!i&&this.services.languageDetector&&!this.services.languageDetector.async?u(this.services.languageDetector.detect()):!i&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect(u):u(i),a}},{key:"getFixedT",value:function(i,o,s){var a=this,l=function c(u,f){var h;if(Ra(f)!=="object"){for(var d=arguments.length,O=new Array(d>2?d-2:0),b=2;b<d;b++)O[b-2]=arguments[b];h=a.options.overloadTranslationOptionHandler([u,f].concat(O))}else h=Hc({},f);h.lng=h.lng||c.lng,h.lngs=h.lngs||c.lngs,h.ns=h.ns||c.ns,h.keyPrefix=h.keyPrefix||s||c.keyPrefix;var v=a.options.keySeparator||".",p=h.keyPrefix?"".concat(h.keyPrefix).concat(v).concat(u):u;return a.t(p,h)};return typeof i=="string"?l.lng=i:l.lngs=i,l.ns=o,l.keyPrefix=s,l}},{key:"t",value:function(){var i;return this.translator&&(i=this.translator).translate.apply(i,arguments)}},{key:"exists",value:function(){var i;return this.translator&&(i=this.translator).exists.apply(i,arguments)}},{key:"setDefaultNamespace",value:function(i){this.options.defaultNS=i}},{key:"hasLoadedNamespace",value:function(i){var o=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var a=this.resolvedLanguage||this.languages[0],l=this.options?this.options.fallbackLng:!1,c=this.languages[this.languages.length-1];if(a.toLowerCase()==="cimode")return!0;var u=function(d,O){var b=o.services.backendConnector.state["".concat(d,"|").concat(O)];return b===-1||b===2};if(s.precheck){var f=s.precheck(this,u);if(f!==void 0)return f}return!!(this.hasResourceBundle(a,i)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||u(a,i)&&(!l||u(c,i)))}},{key:"loadNamespaces",value:function(i,o){var s=this,a=Im();return this.options.ns?(typeof i=="string"&&(i=[i]),i.forEach(function(l){s.options.ns.indexOf(l)<0&&s.options.ns.push(l)}),this.loadResources(function(l){a.resolve(),o&&o(l)}),a):(o&&o(),Promise.resolve())}},{key:"loadLanguages",value:function(i,o){var s=Im();typeof i=="string"&&(i=[i]);var a=this.options.preload||[],l=i.filter(function(c){return a.indexOf(c)<0});return l.length?(this.options.preload=a.concat(l),this.loadResources(function(c){s.resolve(),o&&o(c)}),s):(o&&o(),Promise.resolve())}},{key:"dir",value:function(i){if(i||(i=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!i)return"rtl";var o=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"];return o.indexOf(this.services.languageUtils.getLanguagePartFromCode(i))>-1||i.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var i=this,o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:W5,a=Hc(Hc(Hc({},this.options),o),{isClone:!0}),l=new n(a),c=["store","services","language"];return c.forEach(function(u){l[u]=i[u]}),l.services=Hc({},this.services),l.services.utils={hasLoadedNamespace:l.hasLoadedNamespace.bind(l)},l.translator=new TD(l.services,l.options),l.translator.on("*",function(u){for(var f=arguments.length,h=new Array(f>1?f-1:0),d=1;d<f;d++)h[d-1]=arguments[d];l.emit.apply(l,[u].concat(h))}),l.init(a,s),l.translator.options=l.options,l.translator.backendConnector.services.utils={hasLoadedNamespace:l.hasLoadedNamespace.bind(l)},l}},{key:"toJSON",value:function(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}]),n}(dh);Ln(FS,"createInstance",function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;return new FS(t,e)});var Qo=FS.createInstance();Qo.createInstance=FS.createInstance;Qo.createInstance;Qo.init;Qo.loadResources;Qo.reloadResources;Qo.use;Qo.changeLanguage;Qo.getFixedT;var Twe=Qo.t;Qo.exists;Qo.setDefaultNamespace;Qo.hasLoadedNamespace;Qo.loadNamespaces;Qo.loadLanguages;function Mv(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}function Bo(t,e){if(t==null)return{};var n=Mv(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&(!Object.prototype.propertyIsEnumerable.call(t,r)||(n[r]=t[r]))}return n}var kwe=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230);/g,Pwe={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"\xA9","©":"\xA9","®":"\xAE","®":"\xAE","…":"\u2026","…":"\u2026"},Qwe=function(e){return Pwe[e]},$we=function(e){return e.replace(kwe,Qwe)};function AD(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ID(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?AD(Object(n),!0).forEach(function(r){Ln(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):AD(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}var LQ={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:$we},AK,Ewe=M.exports.createContext();function Cwe(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};LQ=ID(ID({},LQ),t)}function Rwe(){return LQ}var Awe=function(){function t(){la(this,t),this.usedNamespaces={}}return ca(t,[{key:"addUsedNamespaces",value:function(n){var r=this;n.forEach(function(i){r.usedNamespaces[i]||(r.usedNamespaces[i]=!0)})}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}]),t}();function Iwe(t){AK=t}function zwe(){return AK}var Lwe={type:"3rdParty",init:function(e){Cwe(e.options.react),Iwe(e)}};function Nwe(){if(console&&console.warn){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];typeof n[0]=="string"&&(n[0]="react-i18next:: ".concat(n[0])),(t=console).warn.apply(t,n)}}var zD={};function NQ(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];typeof e[0]=="string"&&zD[e[0]]||(typeof e[0]=="string"&&(zD[e[0]]=new Date),Nwe.apply(void 0,e))}function LD(t,e,n){t.loadNamespaces(e,function(){if(t.isInitialized)n();else{var r=function i(){setTimeout(function(){t.off("initialized",i)},0),n()};t.on("initialized",r)}})}function Mwe(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=e.languages[0],i=e.options?e.options.fallbackLng:!1,o=e.languages[e.languages.length-1];if(r.toLowerCase()==="cimode")return!0;var s=function(l,c){var u=e.services.backendConnector.state["".concat(l,"|").concat(c)];return u===-1||u===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&e.services.backendConnector.backend&&e.isLanguageChangingTo&&!s(e.isLanguageChangingTo,t)?!1:!!(e.hasResourceBundle(r,t)||!e.services.backendConnector.backend||e.options.resources&&!e.options.partialBundledLanguages||s(r,t)&&(!i||s(o,t)))}function Dwe(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e.languages||!e.languages.length)return NQ("i18n.languages were undefined or empty",e.languages),!0;var r=e.options.ignoreJSONStructure!==void 0;return r?e.hasLoadedNamespace(t,{precheck:function(o,s){if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&o.services.backendConnector.backend&&o.isLanguageChangingTo&&!s(o.isLanguageChangingTo,t))return!1}}):Mwe(t,e,n)}function Xwe(t,e){var n=t==null?null:typeof Symbol!="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r=[],i=!0,o=!1,s,a;try{for(n=n.call(t);!(i=(s=n.next()).done)&&(r.push(s.value),!(e&&r.length===e));i=!0);}catch(l){o=!0,a=l}finally{try{!i&&n.return!=null&&n.return()}finally{if(o)throw a}}return r}}function Rn(t,e){return PK(t)||Xwe(t,e)||AC(t,e)||$K()}function ND(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Bk(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ND(Object(n),!0).forEach(function(r){Ln(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ND(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}var Wwe=function(e,n){var r=M.exports.useRef();return M.exports.useEffect(function(){r.current=n?r.current:e},[e,n]),r.current};function pl(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=e.i18n,r=M.exports.useContext(Ewe)||{},i=r.i18n,o=r.defaultNS,s=n||i||zwe();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new Awe),!s){NQ("You will need to pass in an i18next instance by using initReactI18next");var a=function(L){return Array.isArray(L)?L[L.length-1]:L},l=[a,{},!1];return l.t=a,l.i18n={},l.ready=!1,l}s.options.react&&s.options.react.wait!==void 0&&NQ("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var c=Bk(Bk(Bk({},Rwe()),s.options.react),e),u=c.useSuspense,f=c.keyPrefix,h=t||o||s.options&&s.options.defaultNS;h=typeof h=="string"?[h]:h||["translation"],s.reportNamespaces.addUsedNamespaces&&s.reportNamespaces.addUsedNamespaces(h);var d=(s.isInitialized||s.initializedStoreOnce)&&h.every(function(A){return Dwe(A,s,c)});function O(){return s.getFixedT(null,c.nsMode==="fallback"?h:h[0],f)}var b=M.exports.useState(O),v=Rn(b,2),p=v[0],g=v[1],y=h.join(),S=Wwe(y),w=M.exports.useRef(!0);M.exports.useEffect(function(){var A=c.bindI18n,L=c.bindI18nStore;w.current=!0,!d&&!u&&LD(s,h,function(){w.current&&g(O)}),d&&S&&S!==y&&w.current&&g(O);function $(){w.current&&g(O)}return A&&s&&s.on(A,$),L&&s&&s.store.on(L,$),function(){w.current=!1,A&&s&&A.split(" ").forEach(function(E){return s.off(E,$)}),L&&s&&L.split(" ").forEach(function(E){return s.store.off(E,$)})}},[s,y]);var T=M.exports.useRef(!0);M.exports.useEffect(function(){w.current&&!T.current&&g(O),T.current=!1},[s]);var k=[p,s,d];if(k.t=p,k.i18n=s,k.ready=d,d||!d&&!u)return k;throw new Promise(function(A){LD(s,h,function(){A()})})}var Uwe={common_success:"Success",common_confirm:"Confirm",common_cancel:"Cancel",common_delete:"Delete",common_hidden:"Hidden",common_locked:"Locked",common_offline:"Offline",common_directory:"Directory",common_file:"File",editor_no_open_file:"None file opened",editor_large_file_tip:"The file size is over 16 MB, preview is not supported",editor_unsupported_format_file_cannot_display:"The file cannot be displayed for unsupported format",editor_picture_not_support_preview:"Picture's preview is not yet supported",editor_search_files_by_name:"Search files by name",editor_pending_update:"{{pendingUpdate}} updates to be written",editor_ot_success:"Success",editor_file_is_not_editable:"The file is not editable",file_tree_click_to_show:"Click to show",file_tree_click_to_hidden:"Click to hide",file_tree_click_to_cancel:"Click to cancel",file_tree_click_to_locked:"Click to lock",file_tree_joined_the_test:"Joined the test",file_tree_click_to_remove:"Click to remove",file_tree_add_test:"Add test",file_tree_num_of_files_cannot_exceed_500:"The number of files cannot exceed 500",file_tree_x_existed:"{{x}} existed",file_tree_x_filtered:"{{x}} filtered",file_tree_x_upload_not_allowed:"Upload of {{x}} not allowed",file_tree_renamed:"Renamed",file_tree_upload_files:"Upload files",file_tree_upload_folder:"Upload folder",show_hidden_files:"Show Hidden files",do_no_show_hidden_files:"Do not show hidden files",file_tree_rename:"Rename",file_tree_create_new_file:"New file",file_tree_create_new_folder:"New folder",file_tree_make_sure_delete_x_unrecoverable:"Are you sure to delete this {{x}}? The file cannot be recovered after deletion",file_tree_kind_tips:"Notice",file_tree_understood:"Know",file_tree_space_char_exist_in_file_or_folder:"There is a space character",output_browser_click_run_start_application:"Click \u3010Run\u3011 to start the application",debug_variables:"Variables",debug_call_stack:"Call stack",helpers_invalid_parameter_rate_x:"Invalid parameter: rate={{x}}",lib_the_area_already_set_answer_area_cannot_repeatedly:"The area has already set the answering area and cannot be set repeatedly",lib_x_file_cannot_set_the_answer_area:"The {{x}} file cannot set the answer area",lib_locked:"locked",lib_hidden:"hidden",store_user_not_found:"User not found",store_appStatus_transition_error_x:"AppStatus transition error: {{x}}",dao_channel_agentUserId_x_inconsistent:"The agentUserId {{x}} is inconsistent",dao_channel_event_x_is_not_supported:"Event {{x}} is not supported",dao_channel_connection_not_established:"The connection has not been established yet",dao_channel_playground_not_exist:"Playground does not exist",dao_channel_playground_unbound_container:"Playground unbound container",dao_channel_container_startup_failed:"Container startup failed",dao_channel_insufficient_server_resources:"Insufficient server resources",dao_channel_server_is_busy:"Server is busy",dao_channel_activation_timeout:"Docker activation timeout",dao_channel_docker_failed_to_activate:"Docker failed to start",dao_channel_socket_is_not_ready:"Socket is not ready",dao_channel_socket_is_not_ready_for_x:"Socket is not ready for {{x}}",dao_channel_socket_connect_broken:"Socket connection broken",dao_paas_cannot_follow_each_other:"Cannot follow each other",\u4E0D\u80FD\u76F4\u63A5\u590D\u5236\u7B54\u9898\u533A\u57DF\u5185\u5BB9:"Cannt copy the content",\u8BE5\u533A\u57DF\u4E0D\u53EF\u7F16\u8F91:"Cannt edit the content",dao_paas_not_find_mount_dom_object_for_x:"Could not find mounted DOM object for {{x}}",dao_paas_x_component_is_not_supported:"{{x}} component is not supported",dao_paas_no_ready:"No ready",\u8BF7\u5728\u6587\u4EF6\u6811\u4E2D\u6253\u5F00\u6587\u4EF6\u8FDB\u884C\u7F16\u8F91:"Pleas go to file tree to select one file and open it",dao_paas_file_does_not_exist:"File does not exist",dao_pass_set_answer_wrong:"Get wrong when insert answer for question","Unable to create file or directory with system reserved name":"Unable to create file or directory with system reserved name","The file or folder {{path}} already exists in this location, please choose another name":"The file or folder {{path}} already exists in this location, please choose another name","No results":"No results","Collapse the file tree":"Collapse the file tree","Create or rename to hidden files, will not be visible":"Create or rename to hidden files, will not be visible"},qwe={common_success:"\u6210\u529F",common_confirm:"\u786E\u5B9A",common_cancel:"\u53D6\u6D88",common_delete:"\u5220\u9664",common_hidden:"\u5DF2\u9690\u85CF",common_locked:"\u5DF2\u52A0\u9501",common_offline:"\u79BB\u7EBF",common_directory:"\u76EE\u5F55",common_file:"\u6587\u4EF6",editor_no_open_file:"\u672A\u6253\u5F00\u6587\u4EF6",editor_large_file_tip:"\u6587\u4EF6\u8D85\u8FC716\u5146\u5927\u5C0F\uFF0C\u6682\u4E0D\u652F\u6301\u9884\u89C8",editor_unsupported_format_file_cannot_display:"\u6B64\u6587\u4EF6\u662F\u4E8C\u8FDB\u5236\u6587\u4EF6\u6216\u4F7F\u7528\u4E86\u4E0D\u652F\u6301\u7684\u6587\u4EF6\u7F16\u7801\uFF0C\u65E0\u6CD5\u5728\u7F16\u8F91\u5668\u4E2D\u663E\u793A",editor_picture_not_support_preview:"\u56FE\u7247\u6682\u65F6\u4E0D\u652F\u6301\u9884\u89C8",editor_search_files_by_name:"\u6309\u540D\u79F0\u641C\u7D22\u6587\u4EF6",editor_pending_update:"{{pendingUpdate}}\u4E2A\u66F4\u65B0\u5F85\u5199\u5165",editor_ot_success:"\u6210\u529F",editor_file_is_not_editable:"\u8BE5\u6587\u4EF6\u4E0D\u53EF\u7F16\u8F91",file_tree_click_to_show:"\u70B9\u51FB\u663E\u793A",file_tree_click_to_hidden:"\u70B9\u51FB\u9690\u85CF",file_tree_click_to_cancel:"\u70B9\u51FB\u53D6\u6D88",file_tree_click_to_locked:"\u70B9\u51FB\u9501\u5B9A",file_tree_joined_the_test:"\u5DF2\u52A0\u5165\u6D4B\u8BD5",file_tree_click_to_remove:"\u70B9\u51FB\u79FB\u9664",file_tree_add_test:"\u6DFB\u52A0\u6D4B\u8BD5",file_tree_num_of_files_cannot_exceed_500:"\u6587\u4EF6\u6570\u91CF\u4E0D\u80FD\u8D85\u8FC7500",file_tree_x_existed:"{{x}}\u5DF2\u5B58\u5728",file_tree_x_filtered:"{{x}}\u88AB\u8FC7\u6EE4",file_tree_x_upload_not_allowed:"{{x}}\u4E0D\u5141\u8BB8\u4E0A\u4F20",file_tree_renamed:"\u91CD\u540D\u4E86",file_tree_upload_files:"\u4E0A\u4F20\u6587\u4EF6",file_tree_upload_folder:"\u4E0A\u4F20\u6587\u4EF6\u5939",show_hidden_files:"\u663E\u793A\u9690\u85CF\u6587\u4EF6",do_no_show_hidden_files:"\u4E0D\u663E\u793A\u9690\u85CF\u6587\u4EF6",file_tree_rename:"\u91CD\u547D\u540D",file_tree_create_new_file:"\u65B0\u5EFA\u6587\u4EF6",file_tree_create_new_folder:"\u65B0\u5EFA\u6587\u4EF6\u5939",file_tree_make_sure_delete_x_unrecoverable:"\u786E\u5B9A\u5220\u9664\u8FD9\u4E2A{{x}}\u5417\uFF1F\u5220\u9664\u540E\u4E0D\u53EF\u6062\u590D",file_tree_kind_tips:"\u6E29\u99A8\u63D0\u793A",file_tree_understood:"\u77E5\u9053\u4E86",file_tree_space_char_exist_in_file_or_folder:"\u5B58\u5728\u7A7A\u683C\u5B57\u7B26",output_browser_click_run_start_application:"\u70B9\u51FB\u3010\u8FD0\u884C\u3011\u542F\u52A8\u5E94\u7528",debug_variables:"\u53D8\u91CF",debug_call_stack:"\u8C03\u7528\u5806\u6808",helpers_invalid_parameter_rate_x:"\u65E0\u6548\u7684\u53C2\u6570: rate={{x}}",lib_the_area_already_set_answer_area_cannot_repeatedly:"\u8BE5\u533A\u57DF\u5DF2\u8BBE\u7F6E\u7B54\u9898\u533A\uFF0C\u4E0D\u53EF\u91CD\u590D\u8BBE\u7F6E",lib_x_file_cannot_set_the_answer_area:"{{x}}\u6587\u4EF6\u4E0D\u53EF\u4EE5\u8BBE\u7F6E\u7B54\u9898\u533A",lib_locked:"\u52A0\u9501",lib_hidden:"\u9690\u85CF",store_user_not_found:"\u627E\u4E0D\u5230\u7528\u6237",store_appStatus_transition_error_x:"appStatus \u8F6C\u6362\u9519\u8BEF: {{x}}",dao_channel_agentUserId_x_inconsistent:"agentUserId {{x}} \u4E0D\u4E00\u81F4",dao_channel_event_x_is_not_supported:"\u4E8B\u4EF6 {{x}} \u4E0D\u652F\u6301",dao_channel_connection_not_established:"\u8FDE\u63A5\u5C1A\u672A\u5EFA\u7ACB",dao_channel_playground_not_exist:"playground\u4E0D\u5B58\u5728",dao_channel_playground_unbound_container:"playground\u672A\u7ED1\u5B9A\u5BB9\u5668",dao_channel_container_startup_failed:"\u5BB9\u5668\u542F\u52A8\u5931\u8D25",dao_channel_insufficient_server_resources:"\u670D\u52A1\u5668\u8D44\u6E90\u4E0D\u8DB3",dao_channel_server_is_busy:"\u670D\u52A1\u5668\u7E41\u5FD9",dao_channel_activation_timeout:"docker\u6FC0\u6D3B\u8D85\u65F6",dao_channel_docker_failed_to_activate:"docker\u542F\u52A8\u5931\u8D25",dao_channel_socket_is_not_ready:"socket\u672A\u51C6\u5907\u597D",dao_channel_socket_is_not_ready_for_x:"socket \u8FD8\u6CA1\u6709\u4E3A{{x}}\u51C6\u5907\u597D",dao_channel_socket_connect_broken:"socket\u8FDE\u63A5\u4E2D\u65AD",dao_paas_cannot_follow_each_other:"\u4E0D\u80FD\u4E92\u76F8\u8DDF\u968F",\u4E0D\u80FD\u76F4\u63A5\u590D\u5236\u7B54\u9898\u533A\u57DF\u5185\u5BB9:"\u4E0D\u80FD\u76F4\u63A5\u590D\u5236\u7B54\u9898\u533A\u57DF\u5185\u5BB9",\u8BE5\u533A\u57DF\u4E0D\u53EF\u7F16\u8F91:"\u8BE5\u533A\u57DF\u4E0D\u53EF\u7F16\u8F91",dao_paas_not_find_mount_dom_object_for_x:"\u627E\u4E0D\u5230\u4E3A{{x}}\u7684\u6302\u8F7DDOM\u5BF9\u8C61",dao_paas_x_component_is_not_supported:"\u7EC4\u4EF6{{x}}\u4E0D\u652F\u6301",dao_paas_no_ready:"\u672A\u51C6\u5907",\u8BF7\u5728\u6587\u4EF6\u6811\u4E2D\u6253\u5F00\u6587\u4EF6\u8FDB\u884C\u7F16\u8F91:"\u8BF7\u5728\u6587\u4EF6\u6811\u4E2D\u6253\u5F00\u6587\u4EF6\u8FDB\u884C\u7F16\u8F91",dao_paas_file_does_not_exist:"\u6587\u4EF6\u4E0D\u5B58\u5728",dao_pass_set_answer_wrong:"\u8BBE\u7F6E\u9898\u76EE\u7B54\u6848\u9519\u8BEF","Unable to create file or directory with system reserved name":"\u65E0\u6CD5\u4F7F\u7528\u7CFB\u7EDF\u4FDD\u7559\u540D\u79F0\u521B\u5EFA\u6587\u4EF6\u6216\u76EE\u5F55","The file or folder {{path}} already exists in this location, please choose another name":"\u6B64\u4F4D\u7F6E\u5DF2\u5B58\u5728\u6587\u4EF6\u6216\u8005\u6587\u4EF6\u5939 {{path}}\uFF0C\u8BF7\u9009\u62E9\u5176\u5B83\u540D\u79F0","No results":"\u6CA1\u6709\u7ED3\u679C","Collapse the file tree":"\u6536\u8D77\u6587\u4EF6\u6811","Create or rename to hidden files, will not be visible":"\u521B\u5EFA\u6216\u8005\u91CD\u547D\u540D\u4E3A\u9690\u85CF\u6587\u4EF6\uFF0C\u5C06\u4E0D\u53EF\u89C1"},jS=(t=>(t.ZH="ZH",t.EN="EN",t))(jS||{});const Bwe={EN:{translation:Uwe},ZH:{translation:qwe}},Ywe="ZH";Qo.use(Lwe).init({resources:Bwe,lng:Ywe,keySeparator:!1,interpolation:{escapeValue:!1}});const or=Qo.t,Fwe=[1,2,3,5,8,16];class jwe{constructor(e,n,r,i,o,s,a,l){St(this,"start");St(this,"end");St(this,"totalTime");St(this,"rate");St(this,"preFrameTime",0);St(this,"resumeTime",0);St(this,"dataBuffer",[]);St(this,"playing",!1);St(this,"isReplay",!1);St(this,"index",0);St(this,"firstFrameTime",0);St(this,"isMovePosition",!1);St(this,"preTerminalIndex",{});St(this,"preDebugIndex",{});St(this,"preFireTreeIndex",{});St(this,"preTerminalDockerId","");St(this,"preConsoleDockerId","");St(this,"isStopMovePosition",!1);St(this,"triggerEventForMaxTimespanRecord","");St(this,"triggerEventForMaxTimespan",-1);St(this,"eventCustomize");St(this,"eventDispatcher");St(this,"getPlaybackSnapshot");St(this,"progressDispatcher");St(this,"currentDockerId");this.start=e,this.end=n,this.rate=1,this.totalTime=n-e,this.triggerEventForMaxTimespan=i,this.eventDispatcher=o,this.progressDispatcher=s,this.getPlaybackSnapshot=a,this.eventCustomize=l,this.step=this.step.bind(this),this.currentDockerId=""}logger(...e){Mt.info(`${new Date(Date.now()).toLocaleString()} [Playback]${e.join(",")}`)}convertToAbsoluteTime(e){return this.start+e}setRate(e){e&&!Fwe.includes(e)&&this.progressDispatcher&&this.progressDispatcher("error",`${or("helpers_invalid_parameter_rate_x",{x:e})}`),this.rate=e||this.rate}buffer(e){this.dataBuffer=this.dataBuffer.concat(e),this.firstFrameTime=this.dataBuffer[0].timestamp}pause(){if(this.logger("Click Pause!"),!this.playing){Mt.warn("Do not pause more than one time");return}this.playing=!1}resume(){this.resumeTime=this.resumeTime||0,this.resumeTime>0?this.isReplay=!0:this.preFrameTime=Date.now(),this.playing=!0,this.isStopMovePosition=!1,window.requestAnimationFrame(this.step)}restart(){this.preFrameTime=Date.now(),this.playing=!0,this.preFireTreeIndex={},this.preTerminalIndex={},this.preDebugIndex={},this.preTerminalDockerId="",this.preConsoleDockerId="",Ce.file.reset(),this.index=0,window.requestAnimationFrame(this.step)}movePosition(e){var n;if(!((n=this.dataBuffer)!=null&&n.length)){this.resumeTime=e;return}this.isStopMovePosition=!this.playing,this.resumeTime=e,this.isReplay=!0,this.index=this.findFrameByTimeStamp(),this.isMovePosition=!0,this.preTerminalIndex={},this.preDebugIndex={},Ce.dao.resetTerminal(),Ce.dao.resetConsole(),oe.dao.channel().xtermStatus({resetConsole:!0}),window.requestAnimationFrame(this.step)}findFrameByTimeStamp(){const e=this.resumeTime+this.firstFrameTime,n=this.dataBuffer,r=n.length,i=(a,l)=>{var c,u,f,h;if(a<=l){const d=Math.floor((l-a)/2+a),O=n[d].timestamp;return O===e?d:e===((c=n[d-1])==null?void 0:c.timestamp)?d-1:e===((u=n[d+1])==null?void 0:u.timestamp)||e>((f=n[d-1])==null?void 0:f.timestamp)&&e<((h=n[d+1])==null?void 0:h.timestamp)?d+1:(e<O?l=d-1:e>O&&(a=d+1),i(a,l))}else return Mt.warn("Do not find the next frame"),this.index=0,this.resumeTime=0,this.resume(),this.index},o=0,s=r-1;return i(o,s)}gotoNextFrame(){var e;!this.isStopMovePosition&&((e=this.progressDispatcher)==null||e.call(this,"progress",this.resumeTime)),this.isStopMovePosition?(this.playing=!1,this.isStopMovePosition=!1):(this.preFrameTime=Date.now(),window.requestAnimationFrame(this.step))}triggerCustomizeEvent(e){var n;(n=this.eventCustomize)==null||n.call(this,e)}step(){var n,r,i;if(!this.playing&&!this.isStopMovePosition)return;if(this.isReplay&&(this.isReplay=!1,this.preFrameTime=Date.now()),this.resumeTime=this.resumeTime+(Date.now()-this.preFrameTime)*this.rate,this.index>this.dataBuffer.length-1){this.playing=!1,this.resumeTime=0,!this.isStopMovePosition&&((n=this.progressDispatcher)==null||n.call(this,"progress",this.totalTime)),(r=this.progressDispatcher)==null||r.call(this,"complete",this.resumeTime);return}let e=this.dataBuffer[this.index];if(!e){this.gotoNextFrame();return}if(e.eventName==="customize"&&(this.firstFrameTime+this.resumeTime>(e==null?void 0:e.timestamp)&&(this.logger(this.index,e.index,e.eventName,e._id),this.index++,this.triggerCustomizeEvent(e)),!this.isStopMovePosition)){this.gotoNextFrame();return}if(this.firstFrameTime+this.resumeTime>(e==null?void 0:e.timestamp)){if(this.isTerminalOrConsole(e.eventName)){this.trigger(e.eventName,e),this.gotoNextFrame();return}let s=0;const a=this.firstFrameTime+this.resumeTime;for(let l=this.index+1;l<this.dataBuffer.length&&this.dataBuffer[l].timestamp<=a;l++)s++,this.index=l;s>0&&(e=this.dataBuffer[this.index],this.isMovePosition=!0),this.isMovePosition?(this.triggerPreFrames(),this.isMovePosition=!1):(e=((i=this.getPlaybackSnapshot)==null?void 0:i.call(this,e.eventName,e,this.getPreFrameByFrame(e,this.index)||e))||e,this.setPreFrameData(e,this.index)),this.trigger(e.eventName,e)}else this.isMovePosition&&(this.triggerPreFrames(),this.isMovePosition=!1);this.gotoNextFrame()}getPreFrameByFrame(e,n){const{eventName:r,dockerId:i}=e,o=this.isEditor(r),s=this.isFileTree(r);let a;if(o){const{data:{openedPath:l}}=e;for(let c=n-1;c>=0;c--){const u=this.dataBuffer[c];if(u.dockerId===i&&u.eventName===r&&u.data.openedPath===l){a=this.dataBuffer[c],!a.snapshot&&c>=0&&this.setSnapshotByIndex(c);break}}}return s&&(a=this.dataBuffer[this.preFireTreeIndex[i]]),a}setPreFrameData(e,n){const{eventName:r,dockerId:i}=e;this.isFileTree(r)&&(this.preFireTreeIndex[i]=n)}isEditor(e){return e===Ct.Editor}isFileTree(e){return e===Ct.FileTree}isTerminal(e){return e===Ct.Terminal}isConsole(e){return e===Ct.Console}isDebug(e){return e===Ct.Debug}isTerminalOrConsole(e){return[Ct.Terminal.toString(),Ct.Console.toString()].includes(e)}setSnapshotByIndex(e){var o;const n=this.dataBuffer[e],{eventName:r}=n,i=this.isEditor(r);for(let s=0;s<=e;s++){let a=this.dataBuffer[s];if(a.eventName===n.eventName&&a.dockerId===n.dockerId&&(i?a.data.openedPath===n.data.openedPath:!0)){if(a.snapshot){this.setPreFrameData(a,s);continue}a=((o=this.getPlaybackSnapshot)==null?void 0:o.call(this,a.eventName,a,this.getPreFrameByFrame(a,s)))||a,this.setPreFrameData(a,s)}}}triggerPreFrames(){const e=[Ct.FileTree.toString(),Ct.Editor.toString(),Ct.Terminal.toString(),Ct.Console.toString(),Ct.Debug.toString()],n=this.index,r=this.dataBuffer[n].dockerId;this.currentDockerId=r;for(let i=n;i>=0;i--){if(!e.length)return;if(e.includes(this.dataBuffer[i].eventName)&&this.dataBuffer[i].dockerId===this.currentDockerId){const o=this.dataBuffer[i],s=e.findIndex(a=>a===o.eventName);e.splice(s,1),o.snapshot||this.setSnapshotByIndex(i),this.trigger(o.eventName,o,!1)}}e.forEach(i=>{this.logger("trigger reset eventName:",i),this.trigger(i,null,!1)})}trigger(e,n,r=!0){if(e==="customize"){this.logger(this.index,e,n==null?void 0:n._id),this.triggerCustomizeEvent(n),r&&this.index++;return}const i=this.isTerminalOrConsole(e),o=this.isDebug(e);if(!i&&!o){this.logger(this.index,e,n==null?void 0:n._id),this.eventDispatcher(e,n),r&&this.index++;return}const s=n==null?void 0:n.dockerId;this.logger("[TR]",s);const a=this.preTerminalIndex[s]||0,l=this.preDebugIndex[s]||0,c=o?l:a;for(let u=c+1;u<=this.index;u++){const f=this.dataBuffer[u];f&&(this.isTerminalOrConsole(f.eventName)||o)&&f.dockerId===s&&(this.logger("[TR]",u,this.index,f.eventName,this.dataBuffer[u].dockerId,this.dataBuffer[u]._id),this.isTerminal(e)&&(this.preTerminalDockerId&&this.preTerminalDockerId!==s&&Ce.dao.resetTerminal(),this.preTerminalDockerId=s),this.isConsole(e)&&(this.preConsoleDockerId&&this.preConsoleDockerId!==s&&(Ce.dao.resetConsole(),oe.dao.channel().xtermStatus({resetConsole:!0})),this.preConsoleDockerId=s),this.eventDispatcher(f.eventName,f))}o?this.preDebugIndex[s]=this.index:this.preTerminalIndex[s]=this.index,r&&this.index++}}const Zwe="@dao42/d42paas-front",Vwe="0.9.97",Gwe="d42paas front",Hwe="dao42 paas team",Kwe="https://github.com/dao42/d42paas_frontend#readme",Jwe="UNLICENSED",e_e="./dist/DaoPaaS.cjs",t_e="./dist/DaoPaaS.cjs",n_e="./dist/DaoPaaS.d.ts",r_e={prebuild:"rimraf dist",build:"cross-env VITE_BUILD_EVENT=true pnpm tsc && pnpm vite && pnpm typedoc",copydist:"cp -r dist/sdk ../demo/public/",vite:"vite build --config ./config/vite.config.ts && shx cp ./src/types/DaoPaaS.d.ts ./dist",typedoc:"npx typedoc --tsconfig ./doc.tsconfig.json",workNameSpaceToFix:"node ./config/workNameSpaceToFix.js",tsc:"tsc -p ./tsconfig.json --isolatedModules false",test:"jest --coverage",prepublish:"pnpm build",publish:"npm publish --access public"},i_e={"@codemirror/autocomplete":"^6.0.2","@codemirror/collab":"^6.0.0","@codemirror/commands":"^6.0.0","@codemirror/lang-cpp":"^6.0.0","@codemirror/lang-css":"^6.0.0","@codemirror/lang-html":"^6.0.0","@codemirror/lang-java":"^6.0.0","@codemirror/lang-javascript":"^6.0.0","@codemirror/lang-json":"^6.0.0","@codemirror/lang-lezer":"^6.0.0","@codemirror/lang-markdown":"^6.0.0","@codemirror/lang-php":"^6.0.0","@codemirror/lang-python":"^6.0.0","@codemirror/lang-rust":"^6.0.0","@codemirror/lang-sql":"^6.0.0","@codemirror/lang-xml":"^6.0.0","@codemirror/language":"6.2.1","@codemirror/legacy-modes":"^6.0.0","@codemirror/lint":"^6.0.0","@codemirror/search":"^6.0.0","@codemirror/state":"^6.0.0","@codemirror/theme-one-dark":"^6.0.0","@codemirror/view":"^6.0.0","@emotion/babel-plugin":"^11.3.0","@emotion/babel-preset-css-prop":"^11.2.0","@emotion/core":"^11.0.0","@emotion/css":"^11.1.3","@emotion/eslint-plugin":"^11.2.0","@emotion/react":"^11.4.1","@emotion/styled":"^11.3.0","@headlessui/react":"^1.4.3","@loadable/component":"^5.15.2","@open-rpc/client-js":"^1.7.1","@testing-library/jest-dom":"^5.16.4","@testing-library/react":"^13.3.0","@types/fs-extra":"^9.0.13","@types/jest":"^27.0.2","@types/loadable__component":"^5.13.4","@types/lodash":"^4.14.175","@types/lodash.clonedeep":"^4.5.7","@types/lodash.isequal":"^4.5.6","@types/node":"^16.11.1","@types/ot":"^0.0.5","@types/prop-types":"^15.7.5","@types/react":"^18.0.14","@types/react-dom":"^18.0.5","@types/react-transition-group":"^4.4.5","@types/uuid":"^8.3.1","@typescript-eslint/eslint-plugin":"^4.28.2","@typescript-eslint/parser":"^4.28.2","@udecode/zustood":"^1.1.1","@vitejs/plugin-react":"^1.0.7",ahooks:"^3.3.10","babel-loader":"^8.2.2",bufferutil:"^4.0.6",classnames:"^2.3.1",codemirror:"^6.0.0",concurrently:"^6.3.0","cross-env":"^7.0.3",devicon:"^2.14.0",dexie:"^3.2.0","file-icons-js":"^1.1.0","file-loader":"^6.2.0","fs-extra":"^10.0.0","glob-all":"^3.2.1","highlight.js":"^11.6.0","hotkeys-js":"^3.9.4",immer:"^9.0.14",jest:"27.0.6",lodash:"^4.17.21",msw:"^0.39.2","ninja-keys":"^1.1.12",ot:"^0.0.15","prop-types":"^15.8.1",react:"^18.2.0","react-complex-tree":"^1.1.6","react-content-loader":"^6.2.0","react-dom":"18.2.0","react-icons":"^4.3.1","react-transition-group":"^4.4.2","rehype-document":"^6.1.0","rehype-highlight":"^5.0.2","rehype-katex":"^6.0.2","rehype-stringify":"^9.0.3","remark-gfm":"^3.0.1","remark-math":"^5.1.1","remark-parse":"^10.0.1","remark-rehype":"^10.1.0",rimraf:"^3.0.2","rollup-plugin-visualizer":"^5.6.0",sass:"^1.43.2","sass-loader":"^12.2.0",shx:"^0.3.3","socket.io-client":"^4.5.1","source-map-loader":"^3.0.0","style-loader":"^3.3.1",stylis:"^4.0.10","ts-jest":"^27.1.3","ts-loader":"^9.2.5","ts-node":"^10.0.0",typedoc:"^0.22.12",unified:"^10.1.2","use-immer":"^0.7.0","utf-8-validate":"^5.0.9",uuid:"^8.3.2",vite:"^2.7.2","vite-plugin-html":"^3.0.6","whatwg-fetch":"^3.6.2",xterm:"^4.13.0","xterm-addon-attach":"^0.6.0","xterm-addon-fit":"^0.5.0",zustand:"^4.0.0-rc.1"},o_e=["dist"],s_e={type:"git",url:"git+https://github.com/dao42/d42paas_frontend.git"},a_e={url:"https://github.com/dao42/d42paas_frontend/issues"},l_e={workerDirectory:"src"},c_e={"@sentry/browser":"^7.16.0","@sentry/tracing":"^7.16.0","@types/lodash.throttle":"^4.1.7","codemirror-lang-elixir":"^3.0.0",i18next:"^21.8.16","lodash.clonedeep":"^4.5.0","lodash.isequal":"^4.5.0","lodash.throttle":"^4.1.1",minimatch:"^5.1.0","range-analyzer":"0.1.1-alpha.2","rc-dropdown":"^4.0.1","rc-menu":"^9.6.3","react-i18next":"11.18.3","socket.io-msgpack-parser":"^3.0.1","xterm-addon-web-links":"^0.6.0"};var u_e={name:Zwe,version:Vwe,description:Gwe,author:Hwe,homepage:Kwe,license:Jwe,main:e_e,module:t_e,types:n_e,scripts:r_e,devDependencies:i_e,files:o_e,repository:s_e,bugs:a_e,msw:l_e,dependencies:c_e};const f_e=()=>u_e.version,d_e=async(t,e,n)=>{const r=window.localStorage.getItem("__paas__testServerCode__"),i=r?{serverCode:r}:{},s=await(await fetch(t+"/api/v1/jssdk/ticket",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ticket:e,packageVersion:n,...i})})).json();if(s.status==="failure")throw Mt.error(s),new Error(s.errors[0].erromsg);return s.data},Yi=(t,e=1)=>{t=t||"#ffffff";let n=t.replace("#","");n.length===3&&(n=`${n[0]}${n[0]}${n[1]}${n[1]}${n[2]}${n[2]}`);const r=parseInt(n.substring(0,2),16),i=parseInt(n.substring(2,4),16),o=parseInt(n.substring(4,6),16);return e>1&&e<=100&&(e=e/100),`rgba(${r},${i},${o},${e})`},h_e=()=>{const t=`
|
|
49
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Z4e(t){return PK(t)||QK(t)||AC(t)||$K()}function gD(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function vD(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?gD(Object(n),!0).forEach(function(r){Ln(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):gD(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}var V4e={type:"logger",log:function(e){this.output("log",e)},warn:function(e){this.output("warn",e)},error:function(e){this.output("error",e)},output:function(e,n){console&&console[e]&&console[e].apply(console,n)}},G4e=function(){function t(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};la(this,t),this.init(e,n)}return ca(t,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=r.prefix||"i18next:",this.logger=n||V4e,this.options=r,this.debug=r.debug}},{key:"setDebug",value:function(n){this.debug=n}},{key:"log",value:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return this.forward(r,"log","",!0)}},{key:"warn",value:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return this.forward(r,"warn","",!0)}},{key:"error",value:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return this.forward(r,"error","")}},{key:"deprecate",value:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return this.forward(r,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(n,r,i,o){return o&&!this.debug?null:(typeof n[0]=="string"&&(n[0]="".concat(i).concat(this.prefix," ").concat(n[0])),this.logger[r](n))}},{key:"create",value:function(n){return new t(this.logger,vD(vD({},{prefix:"".concat(this.prefix,":").concat(n,":")}),this.options))}}]),t}(),hu=new G4e,dh=function(){function t(){la(this,t),this.observers={}}return ca(t,[{key:"on",value:function(n,r){var i=this;return n.split(" ").forEach(function(o){i.observers[o]=i.observers[o]||[],i.observers[o].push(r)}),this}},{key:"off",value:function(n,r){if(!!this.observers[n]){if(!r){delete this.observers[n];return}this.observers[n]=this.observers[n].filter(function(i){return i!==r})}}},{key:"emit",value:function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];if(this.observers[n]){var s=[].concat(this.observers[n]);s.forEach(function(l){l.apply(void 0,i)})}if(this.observers["*"]){var a=[].concat(this.observers["*"]);a.forEach(function(l){l.apply(l,[n].concat(i))})}}}]),t}();function Im(){var t,e,n=new Promise(function(r,i){t=r,e=i});return n.resolve=t,n.reject=e,n}function yD(t){return t==null?"":""+t}function H4e(t,e,n){t.forEach(function(r){e[r]&&(n[r]=e[r])})}function IC(t,e,n){function r(a){return a&&a.indexOf("###")>-1?a.replace(/###/g,"."):a}function i(){return!t||typeof t=="string"}for(var o=typeof e!="string"?[].concat(e):e.split(".");o.length>1;){if(i())return{};var s=r(o.shift());!t[s]&&n&&(t[s]=new n),Object.prototype.hasOwnProperty.call(t,s)?t=t[s]:t={}}return i()?{}:{obj:t,k:r(o.shift())}}function bD(t,e,n){var r=IC(t,e,Object),i=r.obj,o=r.k;i[o]=n}function K4e(t,e,n,r){var i=IC(t,e,Object),o=i.obj,s=i.k;o[s]=o[s]||[],r&&(o[s]=o[s].concat(n)),r||o[s].push(n)}function YS(t,e){var n=IC(t,e),r=n.obj,i=n.k;if(!!r)return r[i]}function xD(t,e,n){var r=YS(t,n);return r!==void 0?r:YS(e,n)}function EK(t,e,n){for(var r in e)r!=="__proto__"&&r!=="constructor"&&(r in t?typeof t[r]=="string"||t[r]instanceof String||typeof e[r]=="string"||e[r]instanceof String?n&&(t[r]=e[r]):EK(t[r],e[r],n):t[r]=e[r]);return t}function wO(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var J4e={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function ewe(t){return typeof t=="string"?t.replace(/[&<>"'\/]/g,function(e){return J4e[e]}):t}var o_=typeof window!="undefined"&&window.navigator&&typeof window.navigator.userAgentData=="undefined"&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,twe=[" ",",","?","!",";"];function nwe(t,e,n){e=e||"",n=n||"";var r=twe.filter(function(a){return e.indexOf(a)<0&&n.indexOf(a)<0});if(r.length===0)return!0;var i=new RegExp("(".concat(r.map(function(a){return a==="?"?"\\?":a}).join("|"),")")),o=!i.test(t);if(!o){var s=t.indexOf(n);s>0&&!i.test(t.substring(0,s))&&(o=!0)}return o}function SD(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function X5(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?SD(Object(n),!0).forEach(function(r){Ln(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):SD(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function rwe(t){var e=iwe();return function(){var r=nc(t),i;if(e){var o=nc(this).constructor;i=Reflect.construct(r,arguments,o)}else i=r.apply(this,arguments);return W0(this,i)}}function iwe(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function CK(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!!t){if(t[e])return t[e];for(var r=e.split(n),i=t,o=0;o<r.length;++o){if(!i||typeof i[r[o]]=="string"&&o+1<r.length)return;if(i[r[o]]===void 0){for(var s=2,a=r.slice(o,o+s).join(n),l=i[a];l===void 0&&r.length>o+s;)s++,a=r.slice(o,o+s).join(n),l=i[a];if(l===void 0)return;if(l===null)return null;if(e.endsWith(a)){if(typeof l=="string")return l;if(a&&typeof l[a]=="string")return l[a]}var c=r.slice(o+s).join(n);return c?CK(l,c,n):void 0}i=i[r[o]]}return i}}var owe=function(t){kh(n,t);var e=rwe(n);function n(r){var i,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};return la(this,n),i=e.call(this),o_&&dh.call(Mc(i)),i.data=r||{},i.options=o,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.options.ignoreJSONStructure===void 0&&(i.options.ignoreJSONStructure=!0),i}return ca(n,[{key:"addNamespaces",value:function(i){this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}},{key:"removeNamespaces",value:function(i){var o=this.options.ns.indexOf(i);o>-1&&this.options.ns.splice(o,1)}},{key:"getResource",value:function(i,o,s){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},l=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,c=a.ignoreJSONStructure!==void 0?a.ignoreJSONStructure:this.options.ignoreJSONStructure,u=[i,o];s&&typeof s!="string"&&(u=u.concat(s)),s&&typeof s=="string"&&(u=u.concat(l?s.split(l):s)),i.indexOf(".")>-1&&(u=i.split("."));var f=YS(this.data,u);return f||!c||typeof s!="string"?f:CK(this.data&&this.data[i]&&this.data[i][o],s,l)}},{key:"addResource",value:function(i,o,s,a){var l=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1},c=this.options.keySeparator;c===void 0&&(c=".");var u=[i,o];s&&(u=u.concat(c?s.split(c):s)),i.indexOf(".")>-1&&(u=i.split("."),a=o,o=u[1]),this.addNamespaces(o),bD(this.data,u,a),l.silent||this.emit("added",i,o,s,a)}},{key:"addResources",value:function(i,o,s){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(var l in s)(typeof s[l]=="string"||Object.prototype.toString.apply(s[l])==="[object Array]")&&this.addResource(i,o,l,s[l],{silent:!0});a.silent||this.emit("added",i,o,s)}},{key:"addResourceBundle",value:function(i,o,s,a,l){var c=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},u=[i,o];i.indexOf(".")>-1&&(u=i.split("."),a=s,s=o,o=u[1]),this.addNamespaces(o);var f=YS(this.data,u)||{};a?EK(f,s,l):f=X5(X5({},f),s),bD(this.data,u,f),c.silent||this.emit("added",i,o,s)}},{key:"removeResourceBundle",value:function(i,o){this.hasResourceBundle(i,o)&&delete this.data[i][o],this.removeNamespaces(o),this.emit("removed",i,o)}},{key:"hasResourceBundle",value:function(i,o){return this.getResource(i,o)!==void 0}},{key:"getResourceBundle",value:function(i,o){return o||(o=this.options.defaultNS),this.options.compatibilityAPI==="v1"?X5(X5({},{}),this.getResource(i,o)):this.getResource(i,o)}},{key:"getDataByLanguage",value:function(i){return this.data[i]}},{key:"hasLanguageSomeTranslations",value:function(i){var o=this.getDataByLanguage(i),s=o&&Object.keys(o)||[];return!!s.find(function(a){return o[a]&&Object.keys(o[a]).length>0})}},{key:"toJSON",value:function(){return this.data}}]),n}(dh),RK={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,n,r,i,o){var s=this;return e.forEach(function(a){s.processors[a]&&(n=s.processors[a].process(n,r,i,o))}),n}};function wD(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Hs(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?wD(Object(n),!0).forEach(function(r){Ln(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):wD(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function swe(t){var e=awe();return function(){var r=nc(t),i;if(e){var o=nc(this).constructor;i=Reflect.construct(r,arguments,o)}else i=r.apply(this,arguments);return W0(this,i)}}function awe(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var _D={},TD=function(t){kh(n,t);var e=swe(n);function n(r){var i,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return la(this,n),i=e.call(this),o_&&dh.call(Mc(i)),H4e(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],r,Mc(i)),i.options=o,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.logger=hu.create("translator"),i}return ca(n,[{key:"changeLanguage",value:function(i){i&&(this.language=i)}},{key:"exists",value:function(i){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(i==null)return!1;var s=this.resolve(i,o);return s&&s.res!==void 0}},{key:"extractFromKey",value:function(i,o){var s=o.nsSeparator!==void 0?o.nsSeparator:this.options.nsSeparator;s===void 0&&(s=":");var a=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,l=o.ns||this.options.defaultNS||[],c=s&&i.indexOf(s)>-1,u=!this.options.userDefinedKeySeparator&&!o.keySeparator&&!this.options.userDefinedNsSeparator&&!o.nsSeparator&&!nwe(i,s,a);if(c&&!u){var f=i.match(this.interpolator.nestingRegexp);if(f&&f.length>0)return{key:i,namespaces:l};var h=i.split(s);(s!==a||s===a&&this.options.ns.indexOf(h[0])>-1)&&(l=h.shift()),i=h.join(a)}return typeof l=="string"&&(l=[l]),{key:i,namespaces:l}}},{key:"translate",value:function(i,o,s){var a=this;if(Ra(o)!=="object"&&this.options.overloadTranslationOptionHandler&&(o=this.options.overloadTranslationOptionHandler(arguments)),o||(o={}),i==null)return"";Array.isArray(i)||(i=[String(i)]);var l=o.returnDetails!==void 0?o.returnDetails:this.options.returnDetails,c=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,u=this.extractFromKey(i[i.length-1],o),f=u.key,h=u.namespaces,d=h[h.length-1],O=o.lng||this.language,b=o.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(O&&O.toLowerCase()==="cimode"){if(b){var v=o.nsSeparator||this.options.nsSeparator;return l?(p.res="".concat(d).concat(v).concat(f),p):"".concat(d).concat(v).concat(f)}return l?(p.res=f,p):f}var p=this.resolve(i,o),g=p&&p.res,y=p&&p.usedKey||f,S=p&&p.exactUsedKey||f,w=Object.prototype.toString.apply(g),T=["[object Number]","[object Function]","[object RegExp]"],k=o.joinArrays!==void 0?o.joinArrays:this.options.joinArrays,A=!this.i18nFormat||this.i18nFormat.handleAsObject,L=typeof g!="string"&&typeof g!="boolean"&&typeof g!="number";if(A&&g&&L&&T.indexOf(w)<0&&!(typeof k=="string"&&w==="[object Array]")){if(!o.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var $=this.options.returnedObjectHandler?this.options.returnedObjectHandler(y,g,Hs(Hs({},o),{},{ns:h})):"key '".concat(f," (").concat(this.language,")' returned an object instead of string.");return l?(p.res=$,p):$}if(c){var E=w==="[object Array]",C=E?[]:{},I=E?S:y;for(var H in g)if(Object.prototype.hasOwnProperty.call(g,H)){var Y="".concat(I).concat(c).concat(H);C[H]=this.translate(Y,Hs(Hs({},o),{joinArrays:!1,ns:h})),C[H]===Y&&(C[H]=g[H])}g=C}}else if(A&&typeof k=="string"&&w==="[object Array]")g=g.join(k),g&&(g=this.extendTranslation(g,i,o,s));else{var z=!1,U=!1,j=o.count!==void 0&&typeof o.count!="string",K=n.hasDefaultValue(o),se=j?this.pluralResolver.getSuffix(O,o.count,o):"",G=o["defaultValue".concat(se)]||o.defaultValue;!this.isValidLookup(g)&&K&&(z=!0,g=G),this.isValidLookup(g)||(U=!0,g=f);var re=o.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,Te=re&&U?void 0:g,Re=K&&G!==g&&this.options.updateMissing;if(U||z||Re){if(this.logger.log(Re?"updateKey":"missingKey",O,d,f,Re?G:g),c){var V=this.resolve(f,Hs(Hs({},o),{},{keySeparator:!1}));V&&V.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var pe=[],J=this.languageUtils.getFallbackCodes(this.options.fallbackLng,o.lng||this.language);if(this.options.saveMissingTo==="fallback"&&J&&J[0])for(var ae=0;ae<J.length;ae++)pe.push(J[ae]);else this.options.saveMissingTo==="all"?pe=this.languageUtils.toResolveHierarchy(o.lng||this.language):pe.push(o.lng||this.language);var ie=function(Xe,je,at){var it=K&&at!==g?at:Te;a.options.missingKeyHandler?a.options.missingKeyHandler(Xe,d,je,it,Re,o):a.backendConnector&&a.backendConnector.saveMissing&&a.backendConnector.saveMissing(Xe,d,je,it,Re,o),a.emit("missingKey",Xe,d,je,g)};this.options.saveMissing&&(this.options.saveMissingPlurals&&j?pe.forEach(function(Ee){a.pluralResolver.getSuffixes(Ee,o).forEach(function(Xe){ie([Ee],f+Xe,o["defaultValue".concat(Xe)]||G)})}):ie(pe,f,G))}g=this.extendTranslation(g,i,o,p,s),U&&g===f&&this.options.appendNamespaceToMissingKey&&(g="".concat(d,":").concat(f)),(U||z)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?g=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?"".concat(d,":").concat(f):f,z?g:void 0):g=this.options.parseMissingKeyHandler(g))}return l?(p.res=g,p):g}},{key:"extendTranslation",value:function(i,o,s,a,l){var c=this;if(this.i18nFormat&&this.i18nFormat.parse)i=this.i18nFormat.parse(i,Hs(Hs({},this.options.interpolation.defaultVariables),s),a.usedLng,a.usedNS,a.usedKey,{resolved:a});else if(!s.skipInterpolation){s.interpolation&&this.interpolator.init(Hs(Hs({},s),{interpolation:Hs(Hs({},this.options.interpolation),s.interpolation)}));var u=typeof i=="string"&&(s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables),f;if(u){var h=i.match(this.interpolator.nestingRegexp);f=h&&h.length}var d=s.replace&&typeof s.replace!="string"?s.replace:s;if(this.options.interpolation.defaultVariables&&(d=Hs(Hs({},this.options.interpolation.defaultVariables),d)),i=this.interpolator.interpolate(i,d,s.lng||this.language,s),u){var O=i.match(this.interpolator.nestingRegexp),b=O&&O.length;f<b&&(s.nest=!1)}s.nest!==!1&&(i=this.interpolator.nest(i,function(){for(var g=arguments.length,y=new Array(g),S=0;S<g;S++)y[S]=arguments[S];return l&&l[0]===y[0]&&!s.context?(c.logger.warn("It seems you are nesting recursively key: ".concat(y[0]," in key: ").concat(o[0])),null):c.translate.apply(c,y.concat([o]))},s)),s.interpolation&&this.interpolator.reset()}var v=s.postProcess||this.options.postProcess,p=typeof v=="string"?[v]:v;return i!=null&&p&&p.length&&s.applyPostProcessor!==!1&&(i=RK.handle(p,i,o,this.options&&this.options.postProcessPassResolved?Hs({i18nResolved:a},s):s,this)),i}},{key:"resolve",value:function(i){var o=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a,l,c,u,f;return typeof i=="string"&&(i=[i]),i.forEach(function(h){if(!o.isValidLookup(a)){var d=o.extractFromKey(h,s),O=d.key;l=O;var b=d.namespaces;o.options.fallbackNS&&(b=b.concat(o.options.fallbackNS));var v=s.count!==void 0&&typeof s.count!="string",p=v&&!s.ordinal&&s.count===0&&o.pluralResolver.shouldUseIntlApi(),g=s.context!==void 0&&(typeof s.context=="string"||typeof s.context=="number")&&s.context!=="",y=s.lngs?s.lngs:o.languageUtils.toResolveHierarchy(s.lng||o.language,s.fallbackLng);b.forEach(function(S){o.isValidLookup(a)||(f=S,!_D["".concat(y[0],"-").concat(S)]&&o.utils&&o.utils.hasLoadedNamespace&&!o.utils.hasLoadedNamespace(f)&&(_D["".concat(y[0],"-").concat(S)]=!0,o.logger.warn('key "'.concat(l,'" for languages "').concat(y.join(", "),`" won't get resolved as namespace "`).concat(f,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),y.forEach(function(w){if(!o.isValidLookup(a)){u=w;var T=[O];if(o.i18nFormat&&o.i18nFormat.addLookupKeys)o.i18nFormat.addLookupKeys(T,O,w,S,s);else{var k;v&&(k=o.pluralResolver.getSuffix(w,s.count,s));var A="".concat(o.options.pluralSeparator,"zero");if(v&&(T.push(O+k),p&&T.push(O+A)),g){var L="".concat(O).concat(o.options.contextSeparator).concat(s.context);T.push(L),v&&(T.push(L+k),p&&T.push(L+A))}}for(var $;$=T.pop();)o.isValidLookup(a)||(c=$,a=o.getResource(w,S,$,s))}}))})}}),{res:a,usedKey:l,exactUsedKey:c,usedLng:u,usedNS:f}}},{key:"isValidLookup",value:function(i){return i!==void 0&&!(!this.options.returnNull&&i===null)&&!(!this.options.returnEmptyString&&i==="")}},{key:"getResource",value:function(i,o,s){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(i,o,s,a):this.resourceStore.getResource(i,o,s,a)}}],[{key:"hasDefaultValue",value:function(i){var o="defaultValue";for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)&&o===s.substring(0,o.length)&&i[s]!==void 0)return!0;return!1}}]),n}(dh);function qk(t){return t.charAt(0).toUpperCase()+t.slice(1)}var lwe=function(){function t(e){la(this,t),this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=hu.create("languageUtils")}return ca(t,[{key:"getScriptPartFromCode",value:function(n){if(!n||n.indexOf("-")<0)return null;var r=n.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}},{key:"getLanguagePartFromCode",value:function(n){if(!n||n.indexOf("-")<0)return n;var r=n.split("-");return this.formatLanguageCode(r[0])}},{key:"formatLanguageCode",value:function(n){if(typeof n=="string"&&n.indexOf("-")>-1){var r=["hans","hant","latn","cyrl","cans","mong","arab"],i=n.split("-");return this.options.lowerCaseLng?i=i.map(function(o){return o.toLowerCase()}):i.length===2?(i[0]=i[0].toLowerCase(),i[1]=i[1].toUpperCase(),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=qk(i[1].toLowerCase()))):i.length===3&&(i[0]=i[0].toLowerCase(),i[1].length===2&&(i[1]=i[1].toUpperCase()),i[0]!=="sgn"&&i[2].length===2&&(i[2]=i[2].toUpperCase()),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=qk(i[1].toLowerCase())),r.indexOf(i[2].toLowerCase())>-1&&(i[2]=qk(i[2].toLowerCase()))),i.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?n.toLowerCase():n}},{key:"isSupportedCode",value:function(n){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(n=this.getLanguagePartFromCode(n)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(n)>-1}},{key:"getBestMatchFromCodes",value:function(n){var r=this;if(!n)return null;var i;return n.forEach(function(o){if(!i){var s=r.formatLanguageCode(o);(!r.options.supportedLngs||r.isSupportedCode(s))&&(i=s)}}),!i&&this.options.supportedLngs&&n.forEach(function(o){if(!i){var s=r.getLanguagePartFromCode(o);if(r.isSupportedCode(s))return i=s;i=r.options.supportedLngs.find(function(a){if(a.indexOf(s)===0)return a})}}),i||(i=this.getFallbackCodes(this.options.fallbackLng)[0]),i}},{key:"getFallbackCodes",value:function(n,r){if(!n)return[];if(typeof n=="function"&&(n=n(r)),typeof n=="string"&&(n=[n]),Object.prototype.toString.apply(n)==="[object Array]")return n;if(!r)return n.default||[];var i=n[r];return i||(i=n[this.getScriptPartFromCode(r)]),i||(i=n[this.formatLanguageCode(r)]),i||(i=n[this.getLanguagePartFromCode(r)]),i||(i=n.default),i||[]}},{key:"toResolveHierarchy",value:function(n,r){var i=this,o=this.getFallbackCodes(r||this.options.fallbackLng||[],n),s=[],a=function(c){!c||(i.isSupportedCode(c)?s.push(c):i.logger.warn("rejecting language code not found in supportedLngs: ".concat(c)))};return typeof n=="string"&&n.indexOf("-")>-1?(this.options.load!=="languageOnly"&&a(this.formatLanguageCode(n)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&a(this.getScriptPartFromCode(n)),this.options.load!=="currentOnly"&&a(this.getLanguagePartFromCode(n))):typeof n=="string"&&a(this.formatLanguageCode(n)),o.forEach(function(l){s.indexOf(l)<0&&a(i.formatLanguageCode(l))}),s}}]),t}(),cwe=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],uwe={1:function(e){return Number(e>1)},2:function(e){return Number(e!=1)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(e==1?0:e>=2&&e<=4?1:2)},7:function(e){return Number(e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(e==1?0:e==2?1:e!=8&&e!=11?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(e==1?0:e==2?1:e<7?2:e<11?3:4)},11:function(e){return Number(e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(e!==0)},14:function(e){return Number(e==1?0:e==2?1:e==3?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:e!==0?1:2)},17:function(e){return Number(e==1||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(e==0?0:e==1?1:2)},19:function(e){return Number(e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(e==1?0:e==0||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3)}},fwe=["v1","v2","v3"],kD={zero:0,one:1,two:2,few:3,many:4,other:5};function dwe(){var t={};return cwe.forEach(function(e){e.lngs.forEach(function(n){t[n]={numbers:e.nr,plurals:uwe[e.fc]}})}),t}var hwe=function(){function t(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};la(this,t),this.languageUtils=e,this.options=n,this.logger=hu.create("pluralResolver"),(!this.options.compatibilityJSON||this.options.compatibilityJSON==="v4")&&(typeof Intl=="undefined"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=dwe()}return ca(t,[{key:"addRule",value:function(n,r){this.rules[n]=r}},{key:"getRule",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(n,{type:r.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[n]||this.rules[this.languageUtils.getLanguagePartFromCode(n)]}},{key:"needsPlural",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=this.getRule(n,r);return this.shouldUseIntlApi()?i&&i.resolvedOptions().pluralCategories.length>1:i&&i.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(n,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(n,i).map(function(o){return"".concat(r).concat(o)})}},{key:"getSuffixes",value:function(n){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=this.getRule(n,i);return o?this.shouldUseIntlApi()?o.resolvedOptions().pluralCategories.sort(function(s,a){return kD[s]-kD[a]}).map(function(s){return"".concat(r.options.prepend).concat(s)}):o.numbers.map(function(s){return r.getSuffix(n,s,i)}):[]}},{key:"getSuffix",value:function(n,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=this.getRule(n,i);return o?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(o.select(r)):this.getSuffixRetroCompatible(o,r):(this.logger.warn("no plural rule found for: ".concat(n)),"")}},{key:"getSuffixRetroCompatible",value:function(n,r){var i=this,o=n.noAbs?n.plurals(r):n.plurals(Math.abs(r)),s=n.numbers[o];this.options.simplifyPluralSuffix&&n.numbers.length===2&&n.numbers[0]===1&&(s===2?s="plural":s===1&&(s=""));var a=function(){return i.options.prepend&&s.toString()?i.options.prepend+s.toString():s.toString()};return this.options.compatibilityJSON==="v1"?s===1?"":typeof s=="number"?"_plural_".concat(s.toString()):a():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&n.numbers.length===2&&n.numbers[0]===1?a():this.options.prepend&&o.toString()?this.options.prepend+o.toString():o.toString()}},{key:"shouldUseIntlApi",value:function(){return!fwe.includes(this.options.compatibilityJSON)}}]),t}();function PD(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Oc(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?PD(Object(n),!0).forEach(function(r){Ln(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):PD(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}var pwe=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};la(this,t),this.logger=hu.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||function(n){return n},this.init(e)}return ca(t,[{key:"init",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};n.interpolation||(n.interpolation={escapeValue:!0});var r=n.interpolation;this.escape=r.escape!==void 0?r.escape:ewe,this.escapeValue=r.escapeValue!==void 0?r.escapeValue:!0,this.useRawValueToEscape=r.useRawValueToEscape!==void 0?r.useRawValueToEscape:!1,this.prefix=r.prefix?wO(r.prefix):r.prefixEscaped||"{{",this.suffix=r.suffix?wO(r.suffix):r.suffixEscaped||"}}",this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||",",this.unescapePrefix=r.unescapeSuffix?"":r.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":r.unescapeSuffix||"",this.nestingPrefix=r.nestingPrefix?wO(r.nestingPrefix):r.nestingPrefixEscaped||wO("$t("),this.nestingSuffix=r.nestingSuffix?wO(r.nestingSuffix):r.nestingSuffixEscaped||wO(")"),this.nestingOptionsSeparator=r.nestingOptionsSeparator?r.nestingOptionsSeparator:r.nestingOptionsSeparator||",",this.maxReplaces=r.maxReplaces?r.maxReplaces:1e3,this.alwaysFormat=r.alwaysFormat!==void 0?r.alwaysFormat:!1,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var n="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(n,"g");var r="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(r,"g");var i="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(i,"g")}},{key:"interpolate",value:function(n,r,i,o){var s=this,a,l,c,u=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function f(v){return v.replace(/\$/g,"$$$$")}var h=function(p){if(p.indexOf(s.formatSeparator)<0){var g=xD(r,u,p);return s.alwaysFormat?s.format(g,void 0,i,Oc(Oc(Oc({},o),r),{},{interpolationkey:p})):g}var y=p.split(s.formatSeparator),S=y.shift().trim(),w=y.join(s.formatSeparator).trim();return s.format(xD(r,u,S),w,i,Oc(Oc(Oc({},o),r),{},{interpolationkey:S}))};this.resetRegExp();var d=o&&o.missingInterpolationHandler||this.options.missingInterpolationHandler,O=o&&o.interpolation&&o.interpolation.skipOnVariables!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables,b=[{regex:this.regexpUnescape,safeValue:function(p){return f(p)}},{regex:this.regexp,safeValue:function(p){return s.escapeValue?f(s.escape(p)):f(p)}}];return b.forEach(function(v){for(c=0;a=v.regex.exec(n);){var p=a[1].trim();if(l=h(p),l===void 0)if(typeof d=="function"){var g=d(n,a,o);l=typeof g=="string"?g:""}else if(o&&o.hasOwnProperty(p))l="";else if(O){l=a[0];continue}else s.logger.warn("missed to pass in variable ".concat(p," for interpolating ").concat(n)),l="";else typeof l!="string"&&!s.useRawValueToEscape&&(l=yD(l));var y=v.safeValue(l);if(n=n.replace(a[0],y),O?(v.regex.lastIndex+=l.length,v.regex.lastIndex-=a[0].length):v.regex.lastIndex=0,c++,c>=s.maxReplaces)break}}),n}},{key:"nest",value:function(n,r){var i=this,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s,a,l=Oc({},o);l.applyPostProcessor=!1,delete l.defaultValue;function c(d,O){var b=this.nestingOptionsSeparator;if(d.indexOf(b)<0)return d;var v=d.split(new RegExp("".concat(b,"[ ]*{"))),p="{".concat(v[1]);d=v[0],p=this.interpolate(p,l),p=p.replace(/'/g,'"');try{l=JSON.parse(p),O&&(l=Oc(Oc({},O),l))}catch(g){return this.logger.warn("failed parsing options string in nesting for key ".concat(d),g),"".concat(d).concat(b).concat(p)}return delete l.defaultValue,d}for(;s=this.nestingRegexp.exec(n);){var u=[],f=!1;if(s[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(s[1])){var h=s[1].split(this.formatSeparator).map(function(d){return d.trim()});s[1]=h.shift(),u=h,f=!0}if(a=r(c.call(this,s[1].trim(),l),l),a&&s[0]===n&&typeof a!="string")return a;typeof a!="string"&&(a=yD(a)),a||(this.logger.warn("missed to resolve ".concat(s[1]," for nesting ").concat(n)),a=""),f&&(a=u.reduce(function(d,O){return i.format(d,O,o.lng,Oc(Oc({},o),{},{interpolationkey:s[1].trim()}))},a.trim())),n=n.replace(s[0],a),this.regexp.lastIndex=0}return n}}]),t}();function QD(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ld(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?QD(Object(n),!0).forEach(function(r){Ln(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):QD(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Owe(t){var e=t.toLowerCase().trim(),n={};if(t.indexOf("(")>-1){var r=t.split("(");e=r[0].toLowerCase().trim();var i=r[1].substring(0,r[1].length-1);if(e==="currency"&&i.indexOf(":")<0)n.currency||(n.currency=i.trim());else if(e==="relativetime"&&i.indexOf(":")<0)n.range||(n.range=i.trim());else{var o=i.split(";");o.forEach(function(s){if(!!s){var a=s.split(":"),l=Z4e(a),c=l[0],u=l.slice(1),f=u.join(":").trim().replace(/^'+|'+$/g,"");n[c.trim()]||(n[c.trim()]=f),f==="false"&&(n[c.trim()]=!1),f==="true"&&(n[c.trim()]=!0),isNaN(f)||(n[c.trim()]=parseInt(f,10))}})}}return{formatName:e,formatOptions:n}}var mwe=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};la(this,t),this.logger=hu.create("formatter"),this.options=e,this.formats={number:function(r,i,o){return new Intl.NumberFormat(i,o).format(r)},currency:function(r,i,o){return new Intl.NumberFormat(i,ld(ld({},o),{},{style:"currency"})).format(r)},datetime:function(r,i,o){return new Intl.DateTimeFormat(i,ld({},o)).format(r)},relativetime:function(r,i,o){return new Intl.RelativeTimeFormat(i,ld({},o)).format(r,o.range||"day")},list:function(r,i,o){return new Intl.ListFormat(i,ld({},o)).format(r)}},this.init(e)}return ca(t,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}},i=r.interpolation;this.formatSeparator=i.formatSeparator?i.formatSeparator:i.formatSeparator||","}},{key:"add",value:function(n,r){this.formats[n.toLowerCase().trim()]=r}},{key:"format",value:function(n,r,i,o){var s=this,a=r.split(this.formatSeparator),l=a.reduce(function(c,u){var f=Owe(u),h=f.formatName,d=f.formatOptions;if(s.formats[h]){var O=c;try{var b=o&&o.formatParams&&o.formatParams[o.interpolationkey]||{},v=b.locale||b.lng||o.locale||o.lng||i;O=s.formats[h](c,v,ld(ld(ld({},d),o),b))}catch(p){s.logger.warn(p)}return O}else s.logger.warn("there was no format function for ".concat(h));return c},n);return l}}]),t}();function $D(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ED(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?$D(Object(n),!0).forEach(function(r){Ln(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):$D(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function gwe(t){var e=vwe();return function(){var r=nc(t),i;if(e){var o=nc(this).constructor;i=Reflect.construct(r,arguments,o)}else i=r.apply(this,arguments);return W0(this,i)}}function vwe(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ywe(t,e){t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)}var bwe=function(t){kh(n,t);var e=gwe(n);function n(r,i,o){var s,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return la(this,n),s=e.call(this),o_&&dh.call(Mc(s)),s.backend=r,s.store=i,s.services=o,s.languageUtils=o.languageUtils,s.options=a,s.logger=hu.create("backendConnector"),s.waitingReads=[],s.maxParallelReads=a.maxParallelReads||10,s.readingCalls=0,s.maxRetries=a.maxRetries>=0?a.maxRetries:5,s.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,s.state={},s.queue=[],s.backend&&s.backend.init&&s.backend.init(o,a.backend,a),s}return ca(n,[{key:"queueLoad",value:function(i,o,s,a){var l=this,c={},u={},f={},h={};return i.forEach(function(d){var O=!0;o.forEach(function(b){var v="".concat(d,"|").concat(b);!s.reload&&l.store.hasResourceBundle(d,b)?l.state[v]=2:l.state[v]<0||(l.state[v]===1?u[v]===void 0&&(u[v]=!0):(l.state[v]=1,O=!1,u[v]===void 0&&(u[v]=!0),c[v]===void 0&&(c[v]=!0),h[b]===void 0&&(h[b]=!0)))}),O||(f[d]=!0)}),(Object.keys(c).length||Object.keys(u).length)&&this.queue.push({pending:u,pendingCount:Object.keys(u).length,loaded:{},errors:[],callback:a}),{toLoad:Object.keys(c),pending:Object.keys(u),toLoadLanguages:Object.keys(f),toLoadNamespaces:Object.keys(h)}}},{key:"loaded",value:function(i,o,s){var a=i.split("|"),l=a[0],c=a[1];o&&this.emit("failedLoading",l,c,o),s&&this.store.addResourceBundle(l,c,s),this.state[i]=o?-1:2;var u={};this.queue.forEach(function(f){K4e(f.loaded,[l],c),ywe(f,i),o&&f.errors.push(o),f.pendingCount===0&&!f.done&&(Object.keys(f.loaded).forEach(function(h){u[h]||(u[h]={});var d=f.loaded[h];d.length&&d.forEach(function(O){u[h][O]===void 0&&(u[h][O]=!0)})}),f.done=!0,f.errors.length?f.callback(f.errors):f.callback())}),this.emit("loaded",u),this.queue=this.queue.filter(function(f){return!f.done})}},{key:"read",value:function(i,o,s){var a=this,l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,c=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,u=arguments.length>5?arguments[5]:void 0;if(!i.length)return u(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:i,ns:o,fcName:s,tried:l,wait:c,callback:u});return}return this.readingCalls++,this.backend[s](i,o,function(f,h){if(a.readingCalls--,a.waitingReads.length>0){var d=a.waitingReads.shift();a.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(f&&h&&l<a.maxRetries){setTimeout(function(){a.read.call(a,i,o,s,l+1,c*2,u)},c);return}u(f,h)})}},{key:"prepareLoading",value:function(i,o){var s=this,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},l=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),l&&l();typeof i=="string"&&(i=this.languageUtils.toResolveHierarchy(i)),typeof o=="string"&&(o=[o]);var c=this.queueLoad(i,o,a,l);if(!c.toLoad.length)return c.pending.length||l(),null;c.toLoad.forEach(function(u){s.loadOne(u)})}},{key:"load",value:function(i,o,s){this.prepareLoading(i,o,{},s)}},{key:"reload",value:function(i,o,s){this.prepareLoading(i,o,{reload:!0},s)}},{key:"loadOne",value:function(i){var o=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",a=i.split("|"),l=a[0],c=a[1];this.read(l,c,"read",void 0,void 0,function(u,f){u&&o.logger.warn("".concat(s,"loading namespace ").concat(c," for language ").concat(l," failed"),u),!u&&f&&o.logger.log("".concat(s,"loaded namespace ").concat(c," for language ").concat(l),f),o.loaded(i,u,f)})}},{key:"saveMissing",value:function(i,o,s,a,l){var c=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(o)){this.logger.warn('did not save key "'.concat(s,'" as the namespace "').concat(o,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}s==null||s===""||(this.backend&&this.backend.create&&this.backend.create(i,o,s,a,null,ED(ED({},c),{},{isUpdate:l})),!(!i||!i[0])&&this.store.addResource(i[0],o,s,a))}}]),n}(dh);function xwe(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var n={};if(Ra(e[1])==="object"&&(n=e[1]),typeof e[1]=="string"&&(n.defaultValue=e[1]),typeof e[2]=="string"&&(n.tDescription=e[2]),Ra(e[2])==="object"||Ra(e[3])==="object"){var r=e[3]||e[2];Object.keys(r).forEach(function(i){n[i]=r[i]})}return n},interpolation:{escapeValue:!0,format:function(e,n,r,i){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function CD(t){return typeof t.ns=="string"&&(t.ns=[t.ns]),typeof t.fallbackLng=="string"&&(t.fallbackLng=[t.fallbackLng]),typeof t.fallbackNS=="string"&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs&&t.supportedLngs.indexOf("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),t}function RD(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Hc(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?RD(Object(n),!0).forEach(function(r){Ln(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):RD(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Swe(t){var e=wwe();return function(){var r=nc(t),i;if(e){var o=nc(this).constructor;i=Reflect.construct(r,arguments,o)}else i=r.apply(this,arguments);return W0(this,i)}}function wwe(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function W5(){}function _we(t){var e=Object.getOwnPropertyNames(Object.getPrototypeOf(t));e.forEach(function(n){typeof t[n]=="function"&&(t[n]=t[n].bind(t))})}var FS=function(t){kh(n,t);var e=Swe(n);function n(){var r,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;if(la(this,n),r=e.call(this),o_&&dh.call(Mc(r)),r.options=CD(i),r.services={},r.logger=hu,r.modules={external:[]},_we(Mc(r)),o&&!r.isInitialized&&!i.isClone){if(!r.options.initImmediate)return r.init(i,o),W0(r,Mc(r));setTimeout(function(){r.init(i,o)},0)}return r}return ca(n,[{key:"init",value:function(){var i=this,o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;typeof o=="function"&&(s=o,o={}),!o.defaultNS&&o.ns&&(typeof o.ns=="string"?o.defaultNS=o.ns:o.ns.indexOf("translation")<0&&(o.defaultNS=o.ns[0]));var a=xwe();this.options=Hc(Hc(Hc({},a),this.options),CD(o)),this.options.compatibilityAPI!=="v1"&&(this.options.interpolation=Hc(Hc({},a.interpolation),this.options.interpolation)),o.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=o.keySeparator),o.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=o.nsSeparator);function l(p){return p?typeof p=="function"?new p:p:null}if(!this.options.isClone){this.modules.logger?hu.init(l(this.modules.logger),this.options):hu.init(null,this.options);var c;this.modules.formatter?c=this.modules.formatter:typeof Intl!="undefined"&&(c=mwe);var u=new lwe(this.options);this.store=new owe(this.options.resources,this.options);var f=this.services;f.logger=hu,f.resourceStore=this.store,f.languageUtils=u,f.pluralResolver=new hwe(u,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),c&&(!this.options.interpolation.format||this.options.interpolation.format===a.interpolation.format)&&(f.formatter=l(c),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new pwe(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new bwe(l(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(p){for(var g=arguments.length,y=new Array(g>1?g-1:0),S=1;S<g;S++)y[S-1]=arguments[S];i.emit.apply(i,[p].concat(y))}),this.modules.languageDetector&&(f.languageDetector=l(this.modules.languageDetector),f.languageDetector.init(f,this.options.detection,this.options)),this.modules.i18nFormat&&(f.i18nFormat=l(this.modules.i18nFormat),f.i18nFormat.init&&f.i18nFormat.init(this)),this.translator=new TD(this.services,this.options),this.translator.on("*",function(p){for(var g=arguments.length,y=new Array(g>1?g-1:0),S=1;S<g;S++)y[S-1]=arguments[S];i.emit.apply(i,[p].concat(y))}),this.modules.external.forEach(function(p){p.init&&p.init(i)})}if(this.format=this.options.interpolation.format,s||(s=W5),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){var h=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);h.length>0&&h[0]!=="dev"&&(this.options.lng=h[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined");var d=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];d.forEach(function(p){i[p]=function(){var g;return(g=i.store)[p].apply(g,arguments)}});var O=["addResource","addResources","addResourceBundle","removeResourceBundle"];O.forEach(function(p){i[p]=function(){var g;return(g=i.store)[p].apply(g,arguments),i}});var b=Im(),v=function(){var g=function(S,w){i.isInitialized&&!i.initializedStoreOnce&&i.logger.warn("init: i18next is already initialized. You should call init just once!"),i.isInitialized=!0,i.options.isClone||i.logger.log("initialized",i.options),i.emit("initialized",i.options),b.resolve(w),s(S,w)};if(i.languages&&i.options.compatibilityAPI!=="v1"&&!i.isInitialized)return g(null,i.t.bind(i));i.changeLanguage(i.options.lng,g)};return this.options.resources||!this.options.initImmediate?v():setTimeout(v,0),b}},{key:"loadResources",value:function(i){var o=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:W5,a=s,l=typeof i=="string"?i:this.language;if(typeof i=="function"&&(a=i),!this.options.resources||this.options.partialBundledLanguages){if(l&&l.toLowerCase()==="cimode")return a();var c=[],u=function(d){if(!!d){var O=o.services.languageUtils.toResolveHierarchy(d);O.forEach(function(b){c.indexOf(b)<0&&c.push(b)})}};if(l)u(l);else{var f=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);f.forEach(function(h){return u(h)})}this.options.preload&&this.options.preload.forEach(function(h){return u(h)}),this.services.backendConnector.load(c,this.options.ns,function(h){!h&&!o.resolvedLanguage&&o.language&&o.setResolvedLanguage(o.language),a(h)})}else a(null)}},{key:"reloadResources",value:function(i,o,s){var a=Im();return i||(i=this.languages),o||(o=this.options.ns),s||(s=W5),this.services.backendConnector.reload(i,o,function(l){a.resolve(),s(l)}),a}},{key:"use",value:function(i){if(!i)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!i.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return i.type==="backend"&&(this.modules.backend=i),(i.type==="logger"||i.log&&i.warn&&i.error)&&(this.modules.logger=i),i.type==="languageDetector"&&(this.modules.languageDetector=i),i.type==="i18nFormat"&&(this.modules.i18nFormat=i),i.type==="postProcessor"&&RK.addPostProcessor(i),i.type==="formatter"&&(this.modules.formatter=i),i.type==="3rdParty"&&this.modules.external.push(i),this}},{key:"setResolvedLanguage",value:function(i){if(!(!i||!this.languages)&&!(["cimode","dev"].indexOf(i)>-1))for(var o=0;o<this.languages.length;o++){var s=this.languages[o];if(!(["cimode","dev"].indexOf(s)>-1)&&this.store.hasLanguageSomeTranslations(s)){this.resolvedLanguage=s;break}}}},{key:"changeLanguage",value:function(i,o){var s=this;this.isLanguageChangingTo=i;var a=Im();this.emit("languageChanging",i);var l=function(h){s.language=h,s.languages=s.services.languageUtils.toResolveHierarchy(h),s.resolvedLanguage=void 0,s.setResolvedLanguage(h)},c=function(h,d){d?(l(d),s.translator.changeLanguage(d),s.isLanguageChangingTo=void 0,s.emit("languageChanged",d),s.logger.log("languageChanged",d)):s.isLanguageChangingTo=void 0,a.resolve(function(){return s.t.apply(s,arguments)}),o&&o(h,function(){return s.t.apply(s,arguments)})},u=function(h){!i&&!h&&s.services.languageDetector&&(h=[]);var d=typeof h=="string"?h:s.services.languageUtils.getBestMatchFromCodes(h);d&&(s.language||l(d),s.translator.language||s.translator.changeLanguage(d),s.services.languageDetector&&s.services.languageDetector.cacheUserLanguage(d)),s.loadResources(d,function(O){c(O,d)})};return!i&&this.services.languageDetector&&!this.services.languageDetector.async?u(this.services.languageDetector.detect()):!i&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect(u):u(i),a}},{key:"getFixedT",value:function(i,o,s){var a=this,l=function c(u,f){var h;if(Ra(f)!=="object"){for(var d=arguments.length,O=new Array(d>2?d-2:0),b=2;b<d;b++)O[b-2]=arguments[b];h=a.options.overloadTranslationOptionHandler([u,f].concat(O))}else h=Hc({},f);h.lng=h.lng||c.lng,h.lngs=h.lngs||c.lngs,h.ns=h.ns||c.ns,h.keyPrefix=h.keyPrefix||s||c.keyPrefix;var v=a.options.keySeparator||".",p=h.keyPrefix?"".concat(h.keyPrefix).concat(v).concat(u):u;return a.t(p,h)};return typeof i=="string"?l.lng=i:l.lngs=i,l.ns=o,l.keyPrefix=s,l}},{key:"t",value:function(){var i;return this.translator&&(i=this.translator).translate.apply(i,arguments)}},{key:"exists",value:function(){var i;return this.translator&&(i=this.translator).exists.apply(i,arguments)}},{key:"setDefaultNamespace",value:function(i){this.options.defaultNS=i}},{key:"hasLoadedNamespace",value:function(i){var o=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var a=this.resolvedLanguage||this.languages[0],l=this.options?this.options.fallbackLng:!1,c=this.languages[this.languages.length-1];if(a.toLowerCase()==="cimode")return!0;var u=function(d,O){var b=o.services.backendConnector.state["".concat(d,"|").concat(O)];return b===-1||b===2};if(s.precheck){var f=s.precheck(this,u);if(f!==void 0)return f}return!!(this.hasResourceBundle(a,i)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||u(a,i)&&(!l||u(c,i)))}},{key:"loadNamespaces",value:function(i,o){var s=this,a=Im();return this.options.ns?(typeof i=="string"&&(i=[i]),i.forEach(function(l){s.options.ns.indexOf(l)<0&&s.options.ns.push(l)}),this.loadResources(function(l){a.resolve(),o&&o(l)}),a):(o&&o(),Promise.resolve())}},{key:"loadLanguages",value:function(i,o){var s=Im();typeof i=="string"&&(i=[i]);var a=this.options.preload||[],l=i.filter(function(c){return a.indexOf(c)<0});return l.length?(this.options.preload=a.concat(l),this.loadResources(function(c){s.resolve(),o&&o(c)}),s):(o&&o(),Promise.resolve())}},{key:"dir",value:function(i){if(i||(i=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!i)return"rtl";var o=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"];return o.indexOf(this.services.languageUtils.getLanguagePartFromCode(i))>-1||i.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var i=this,o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:W5,a=Hc(Hc(Hc({},this.options),o),{isClone:!0}),l=new n(a),c=["store","services","language"];return c.forEach(function(u){l[u]=i[u]}),l.services=Hc({},this.services),l.services.utils={hasLoadedNamespace:l.hasLoadedNamespace.bind(l)},l.translator=new TD(l.services,l.options),l.translator.on("*",function(u){for(var f=arguments.length,h=new Array(f>1?f-1:0),d=1;d<f;d++)h[d-1]=arguments[d];l.emit.apply(l,[u].concat(h))}),l.init(a,s),l.translator.options=l.options,l.translator.backendConnector.services.utils={hasLoadedNamespace:l.hasLoadedNamespace.bind(l)},l}},{key:"toJSON",value:function(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}]),n}(dh);Ln(FS,"createInstance",function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;return new FS(t,e)});var Qo=FS.createInstance();Qo.createInstance=FS.createInstance;Qo.createInstance;Qo.init;Qo.loadResources;Qo.reloadResources;Qo.use;Qo.changeLanguage;Qo.getFixedT;var Twe=Qo.t;Qo.exists;Qo.setDefaultNamespace;Qo.hasLoadedNamespace;Qo.loadNamespaces;Qo.loadLanguages;function Mv(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}function Bo(t,e){if(t==null)return{};var n=Mv(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&(!Object.prototype.propertyIsEnumerable.call(t,r)||(n[r]=t[r]))}return n}var kwe=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230);/g,Pwe={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"\xA9","©":"\xA9","®":"\xAE","®":"\xAE","…":"\u2026","…":"\u2026"},Qwe=function(e){return Pwe[e]},$we=function(e){return e.replace(kwe,Qwe)};function AD(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ID(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?AD(Object(n),!0).forEach(function(r){Ln(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):AD(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}var LQ={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:$we},AK,Ewe=M.exports.createContext();function Cwe(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};LQ=ID(ID({},LQ),t)}function Rwe(){return LQ}var Awe=function(){function t(){la(this,t),this.usedNamespaces={}}return ca(t,[{key:"addUsedNamespaces",value:function(n){var r=this;n.forEach(function(i){r.usedNamespaces[i]||(r.usedNamespaces[i]=!0)})}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}]),t}();function Iwe(t){AK=t}function zwe(){return AK}var Lwe={type:"3rdParty",init:function(e){Cwe(e.options.react),Iwe(e)}};function Nwe(){if(console&&console.warn){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];typeof n[0]=="string"&&(n[0]="react-i18next:: ".concat(n[0])),(t=console).warn.apply(t,n)}}var zD={};function NQ(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];typeof e[0]=="string"&&zD[e[0]]||(typeof e[0]=="string"&&(zD[e[0]]=new Date),Nwe.apply(void 0,e))}function LD(t,e,n){t.loadNamespaces(e,function(){if(t.isInitialized)n();else{var r=function i(){setTimeout(function(){t.off("initialized",i)},0),n()};t.on("initialized",r)}})}function Mwe(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=e.languages[0],i=e.options?e.options.fallbackLng:!1,o=e.languages[e.languages.length-1];if(r.toLowerCase()==="cimode")return!0;var s=function(l,c){var u=e.services.backendConnector.state["".concat(l,"|").concat(c)];return u===-1||u===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&e.services.backendConnector.backend&&e.isLanguageChangingTo&&!s(e.isLanguageChangingTo,t)?!1:!!(e.hasResourceBundle(r,t)||!e.services.backendConnector.backend||e.options.resources&&!e.options.partialBundledLanguages||s(r,t)&&(!i||s(o,t)))}function Dwe(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e.languages||!e.languages.length)return NQ("i18n.languages were undefined or empty",e.languages),!0;var r=e.options.ignoreJSONStructure!==void 0;return r?e.hasLoadedNamespace(t,{precheck:function(o,s){if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&o.services.backendConnector.backend&&o.isLanguageChangingTo&&!s(o.isLanguageChangingTo,t))return!1}}):Mwe(t,e,n)}function Xwe(t,e){var n=t==null?null:typeof Symbol!="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r=[],i=!0,o=!1,s,a;try{for(n=n.call(t);!(i=(s=n.next()).done)&&(r.push(s.value),!(e&&r.length===e));i=!0);}catch(l){o=!0,a=l}finally{try{!i&&n.return!=null&&n.return()}finally{if(o)throw a}}return r}}function Rn(t,e){return PK(t)||Xwe(t,e)||AC(t,e)||$K()}function ND(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Bk(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ND(Object(n),!0).forEach(function(r){Ln(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ND(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}var Wwe=function(e,n){var r=M.exports.useRef();return M.exports.useEffect(function(){r.current=n?r.current:e},[e,n]),r.current};function pl(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=e.i18n,r=M.exports.useContext(Ewe)||{},i=r.i18n,o=r.defaultNS,s=n||i||zwe();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new Awe),!s){NQ("You will need to pass in an i18next instance by using initReactI18next");var a=function(L){return Array.isArray(L)?L[L.length-1]:L},l=[a,{},!1];return l.t=a,l.i18n={},l.ready=!1,l}s.options.react&&s.options.react.wait!==void 0&&NQ("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var c=Bk(Bk(Bk({},Rwe()),s.options.react),e),u=c.useSuspense,f=c.keyPrefix,h=t||o||s.options&&s.options.defaultNS;h=typeof h=="string"?[h]:h||["translation"],s.reportNamespaces.addUsedNamespaces&&s.reportNamespaces.addUsedNamespaces(h);var d=(s.isInitialized||s.initializedStoreOnce)&&h.every(function(A){return Dwe(A,s,c)});function O(){return s.getFixedT(null,c.nsMode==="fallback"?h:h[0],f)}var b=M.exports.useState(O),v=Rn(b,2),p=v[0],g=v[1],y=h.join(),S=Wwe(y),w=M.exports.useRef(!0);M.exports.useEffect(function(){var A=c.bindI18n,L=c.bindI18nStore;w.current=!0,!d&&!u&&LD(s,h,function(){w.current&&g(O)}),d&&S&&S!==y&&w.current&&g(O);function $(){w.current&&g(O)}return A&&s&&s.on(A,$),L&&s&&s.store.on(L,$),function(){w.current=!1,A&&s&&A.split(" ").forEach(function(E){return s.off(E,$)}),L&&s&&L.split(" ").forEach(function(E){return s.store.off(E,$)})}},[s,y]);var T=M.exports.useRef(!0);M.exports.useEffect(function(){w.current&&!T.current&&g(O),T.current=!1},[s]);var k=[p,s,d];if(k.t=p,k.i18n=s,k.ready=d,d||!d&&!u)return k;throw new Promise(function(A){LD(s,h,function(){A()})})}var Uwe={common_success:"Success",common_confirm:"Confirm",common_cancel:"Cancel",common_delete:"Delete",common_hidden:"Hidden",common_locked:"Locked",common_offline:"Offline",common_directory:"Directory",common_file:"File",editor_no_open_file:"None file opened",editor_large_file_tip:"The file size is over 16 MB, preview is not supported",editor_unsupported_format_file_cannot_display:"The file cannot be displayed for unsupported format",editor_picture_not_support_preview:"Picture's preview is not yet supported",editor_search_files_by_name:"Search files by name",editor_pending_update:"{{pendingUpdate}} updates to be written",editor_ot_success:"Success",editor_file_is_not_editable:"The file is not editable",file_tree_click_to_show:"Click to show",file_tree_click_to_hidden:"Click to hide",file_tree_click_to_cancel:"Click to cancel",file_tree_click_to_locked:"Click to lock",file_tree_joined_the_test:"Joined the test",file_tree_click_to_remove:"Click to remove",file_tree_add_test:"Add test",file_tree_num_of_files_cannot_exceed_500:"The number of files cannot exceed 500",file_tree_x_existed:"{{x}} existed",file_tree_x_filtered:"{{x}} filtered",file_tree_x_upload_not_allowed:"Upload of {{x}} not allowed",file_tree_renamed:"Renamed",file_tree_upload_files:"Upload files",file_tree_upload_folder:"Upload folder",show_hidden_files:"Show Hidden files",do_no_show_hidden_files:"Do not show hidden files",file_tree_rename:"Rename",file_tree_create_new_file:"New file",file_tree_create_new_folder:"New folder",file_tree_make_sure_delete_x_unrecoverable:"Are you sure to delete this {{x}}? The file cannot be recovered after deletion",file_tree_kind_tips:"Notice",file_tree_understood:"Know",file_tree_space_char_exist_in_file_or_folder:"There is a space character",output_browser_click_run_start_application:"Click \u3010Run\u3011 to start the application",debug_variables:"Variables",debug_call_stack:"Call stack",helpers_invalid_parameter_rate_x:"Invalid parameter: rate={{x}}",lib_the_area_already_set_answer_area_cannot_repeatedly:"The area has already set the answering area and cannot be set repeatedly",lib_x_file_cannot_set_the_answer_area:"The {{x}} file cannot set the answer area",lib_locked:"locked",lib_hidden:"hidden",store_user_not_found:"User not found",store_appStatus_transition_error_x:"AppStatus transition error: {{x}}",dao_channel_agentUserId_x_inconsistent:"The agentUserId {{x}} is inconsistent",dao_channel_event_x_is_not_supported:"Event {{x}} is not supported",dao_channel_connection_not_established:"The connection has not been established yet",dao_channel_playground_not_exist:"Playground does not exist",dao_channel_playground_unbound_container:"Playground unbound container",dao_channel_container_startup_failed:"Container startup failed",dao_channel_insufficient_server_resources:"Insufficient server resources",dao_channel_server_is_busy:"Server is busy",dao_channel_activation_timeout:"Docker activation timeout",dao_channel_docker_failed_to_activate:"Docker failed to start",dao_channel_socket_is_not_ready:"Socket is not ready",dao_channel_socket_is_not_ready_for_x:"Socket is not ready for {{x}}",dao_channel_socket_connect_broken:"Socket connection broken",dao_paas_cannot_follow_each_other:"Cannot follow each other",\u4E0D\u80FD\u76F4\u63A5\u590D\u5236\u7B54\u9898\u533A\u57DF\u5185\u5BB9:"Cannt copy the content",\u8BE5\u533A\u57DF\u4E0D\u53EF\u7F16\u8F91:"Cannt edit the content",dao_paas_not_find_mount_dom_object_for_x:"Could not find mounted DOM object for {{x}}",dao_paas_x_component_is_not_supported:"{{x}} component is not supported",dao_paas_no_ready:"No ready",\u8BF7\u5728\u6587\u4EF6\u6811\u4E2D\u6253\u5F00\u6587\u4EF6\u8FDB\u884C\u7F16\u8F91:"Pleas go to file tree to select one file and open it",dao_paas_file_does_not_exist:"File does not exist",dao_pass_set_answer_wrong:"Get wrong when insert answer for question","Unable to create file or directory with system reserved name":"Unable to create file or directory with system reserved name","The file or folder {{path}} already exists in this location, please choose another name":"The file or folder {{path}} already exists in this location, please choose another name","No results":"No results","Collapse the file tree":"Collapse the file tree","Create or rename to hidden files, will not be visible":"Create or rename to hidden files, will not be visible"},qwe={common_success:"\u6210\u529F",common_confirm:"\u786E\u5B9A",common_cancel:"\u53D6\u6D88",common_delete:"\u5220\u9664",common_hidden:"\u5DF2\u9690\u85CF",common_locked:"\u5DF2\u52A0\u9501",common_offline:"\u79BB\u7EBF",common_directory:"\u76EE\u5F55",common_file:"\u6587\u4EF6",editor_no_open_file:"\u672A\u6253\u5F00\u6587\u4EF6",editor_large_file_tip:"\u6587\u4EF6\u8D85\u8FC716\u5146\u5927\u5C0F\uFF0C\u6682\u4E0D\u652F\u6301\u9884\u89C8",editor_unsupported_format_file_cannot_display:"\u6B64\u6587\u4EF6\u662F\u4E8C\u8FDB\u5236\u6587\u4EF6\u6216\u4F7F\u7528\u4E86\u4E0D\u652F\u6301\u7684\u6587\u4EF6\u7F16\u7801\uFF0C\u65E0\u6CD5\u5728\u7F16\u8F91\u5668\u4E2D\u663E\u793A",editor_picture_not_support_preview:"\u56FE\u7247\u6682\u65F6\u4E0D\u652F\u6301\u9884\u89C8",editor_search_files_by_name:"\u6309\u540D\u79F0\u641C\u7D22\u6587\u4EF6",editor_pending_update:"{{pendingUpdate}}\u4E2A\u66F4\u65B0\u5F85\u5199\u5165",editor_ot_success:"\u6210\u529F",editor_file_is_not_editable:"\u8BE5\u6587\u4EF6\u4E0D\u53EF\u7F16\u8F91",file_tree_click_to_show:"\u70B9\u51FB\u663E\u793A",file_tree_click_to_hidden:"\u70B9\u51FB\u9690\u85CF",file_tree_click_to_cancel:"\u70B9\u51FB\u53D6\u6D88",file_tree_click_to_locked:"\u70B9\u51FB\u9501\u5B9A",file_tree_joined_the_test:"\u5DF2\u52A0\u5165\u6D4B\u8BD5",file_tree_click_to_remove:"\u70B9\u51FB\u79FB\u9664",file_tree_add_test:"\u6DFB\u52A0\u6D4B\u8BD5",file_tree_num_of_files_cannot_exceed_500:"\u6587\u4EF6\u6570\u91CF\u4E0D\u80FD\u8D85\u8FC7500",file_tree_x_existed:"{{x}}\u5DF2\u5B58\u5728",file_tree_x_filtered:"{{x}}\u88AB\u8FC7\u6EE4",file_tree_x_upload_not_allowed:"{{x}}\u4E0D\u5141\u8BB8\u4E0A\u4F20",file_tree_renamed:"\u91CD\u540D\u4E86",file_tree_upload_files:"\u4E0A\u4F20\u6587\u4EF6",file_tree_upload_folder:"\u4E0A\u4F20\u6587\u4EF6\u5939",show_hidden_files:"\u663E\u793A\u9690\u85CF\u6587\u4EF6",do_no_show_hidden_files:"\u4E0D\u663E\u793A\u9690\u85CF\u6587\u4EF6",file_tree_rename:"\u91CD\u547D\u540D",file_tree_create_new_file:"\u65B0\u5EFA\u6587\u4EF6",file_tree_create_new_folder:"\u65B0\u5EFA\u6587\u4EF6\u5939",file_tree_make_sure_delete_x_unrecoverable:"\u786E\u5B9A\u5220\u9664\u8FD9\u4E2A{{x}}\u5417\uFF1F\u5220\u9664\u540E\u4E0D\u53EF\u6062\u590D",file_tree_kind_tips:"\u6E29\u99A8\u63D0\u793A",file_tree_understood:"\u77E5\u9053\u4E86",file_tree_space_char_exist_in_file_or_folder:"\u5B58\u5728\u7A7A\u683C\u5B57\u7B26",output_browser_click_run_start_application:"\u70B9\u51FB\u3010\u8FD0\u884C\u3011\u542F\u52A8\u5E94\u7528",debug_variables:"\u53D8\u91CF",debug_call_stack:"\u8C03\u7528\u5806\u6808",helpers_invalid_parameter_rate_x:"\u65E0\u6548\u7684\u53C2\u6570: rate={{x}}",lib_the_area_already_set_answer_area_cannot_repeatedly:"\u8BE5\u533A\u57DF\u5DF2\u8BBE\u7F6E\u7B54\u9898\u533A\uFF0C\u4E0D\u53EF\u91CD\u590D\u8BBE\u7F6E",lib_x_file_cannot_set_the_answer_area:"{{x}}\u6587\u4EF6\u4E0D\u53EF\u4EE5\u8BBE\u7F6E\u7B54\u9898\u533A",lib_locked:"\u52A0\u9501",lib_hidden:"\u9690\u85CF",store_user_not_found:"\u627E\u4E0D\u5230\u7528\u6237",store_appStatus_transition_error_x:"appStatus \u8F6C\u6362\u9519\u8BEF: {{x}}",dao_channel_agentUserId_x_inconsistent:"agentUserId {{x}} \u4E0D\u4E00\u81F4",dao_channel_event_x_is_not_supported:"\u4E8B\u4EF6 {{x}} \u4E0D\u652F\u6301",dao_channel_connection_not_established:"\u8FDE\u63A5\u5C1A\u672A\u5EFA\u7ACB",dao_channel_playground_not_exist:"playground\u4E0D\u5B58\u5728",dao_channel_playground_unbound_container:"playground\u672A\u7ED1\u5B9A\u5BB9\u5668",dao_channel_container_startup_failed:"\u5BB9\u5668\u542F\u52A8\u5931\u8D25",dao_channel_insufficient_server_resources:"\u670D\u52A1\u5668\u8D44\u6E90\u4E0D\u8DB3",dao_channel_server_is_busy:"\u670D\u52A1\u5668\u7E41\u5FD9",dao_channel_activation_timeout:"docker\u6FC0\u6D3B\u8D85\u65F6",dao_channel_docker_failed_to_activate:"docker\u542F\u52A8\u5931\u8D25",dao_channel_socket_is_not_ready:"socket\u672A\u51C6\u5907\u597D",dao_channel_socket_is_not_ready_for_x:"socket \u8FD8\u6CA1\u6709\u4E3A{{x}}\u51C6\u5907\u597D",dao_channel_socket_connect_broken:"socket\u8FDE\u63A5\u4E2D\u65AD",dao_paas_cannot_follow_each_other:"\u4E0D\u80FD\u4E92\u76F8\u8DDF\u968F",\u4E0D\u80FD\u76F4\u63A5\u590D\u5236\u7B54\u9898\u533A\u57DF\u5185\u5BB9:"\u4E0D\u80FD\u76F4\u63A5\u590D\u5236\u7B54\u9898\u533A\u57DF\u5185\u5BB9",\u8BE5\u533A\u57DF\u4E0D\u53EF\u7F16\u8F91:"\u8BE5\u533A\u57DF\u4E0D\u53EF\u7F16\u8F91",dao_paas_not_find_mount_dom_object_for_x:"\u627E\u4E0D\u5230\u4E3A{{x}}\u7684\u6302\u8F7DDOM\u5BF9\u8C61",dao_paas_x_component_is_not_supported:"\u7EC4\u4EF6{{x}}\u4E0D\u652F\u6301",dao_paas_no_ready:"\u672A\u51C6\u5907",\u8BF7\u5728\u6587\u4EF6\u6811\u4E2D\u6253\u5F00\u6587\u4EF6\u8FDB\u884C\u7F16\u8F91:"\u8BF7\u5728\u6587\u4EF6\u6811\u4E2D\u6253\u5F00\u6587\u4EF6\u8FDB\u884C\u7F16\u8F91",dao_paas_file_does_not_exist:"\u6587\u4EF6\u4E0D\u5B58\u5728",dao_pass_set_answer_wrong:"\u8BBE\u7F6E\u9898\u76EE\u7B54\u6848\u9519\u8BEF","Unable to create file or directory with system reserved name":"\u65E0\u6CD5\u4F7F\u7528\u7CFB\u7EDF\u4FDD\u7559\u540D\u79F0\u521B\u5EFA\u6587\u4EF6\u6216\u76EE\u5F55","The file or folder {{path}} already exists in this location, please choose another name":"\u6B64\u4F4D\u7F6E\u5DF2\u5B58\u5728\u6587\u4EF6\u6216\u8005\u6587\u4EF6\u5939 {{path}}\uFF0C\u8BF7\u9009\u62E9\u5176\u5B83\u540D\u79F0","No results":"\u6CA1\u6709\u7ED3\u679C","Collapse the file tree":"\u6536\u8D77\u6587\u4EF6\u6811","Create or rename to hidden files, will not be visible":"\u521B\u5EFA\u6216\u8005\u91CD\u547D\u540D\u4E3A\u9690\u85CF\u6587\u4EF6\uFF0C\u5C06\u4E0D\u53EF\u89C1"},jS=(t=>(t.ZH="ZH",t.EN="EN",t))(jS||{});const Bwe={EN:{translation:Uwe},ZH:{translation:qwe}},Ywe="ZH";Qo.use(Lwe).init({resources:Bwe,lng:Ywe,keySeparator:!1,interpolation:{escapeValue:!1}});const or=Qo.t,Fwe=[1,2,3,5,8,16];class jwe{constructor(e,n,r,i,o,s,a,l){St(this,"start");St(this,"end");St(this,"totalTime");St(this,"rate");St(this,"preFrameTime",0);St(this,"resumeTime",0);St(this,"dataBuffer",[]);St(this,"playing",!1);St(this,"isReplay",!1);St(this,"index",0);St(this,"firstFrameTime",0);St(this,"isMovePosition",!1);St(this,"preTerminalIndex",{});St(this,"preDebugIndex",{});St(this,"preFireTreeIndex",{});St(this,"preTerminalDockerId","");St(this,"preConsoleDockerId","");St(this,"isStopMovePosition",!1);St(this,"triggerEventForMaxTimespanRecord","");St(this,"triggerEventForMaxTimespan",-1);St(this,"eventCustomize");St(this,"eventDispatcher");St(this,"getPlaybackSnapshot");St(this,"progressDispatcher");St(this,"currentDockerId");this.start=e,this.end=n,this.rate=1,this.totalTime=n-e,this.triggerEventForMaxTimespan=i,this.eventDispatcher=o,this.progressDispatcher=s,this.getPlaybackSnapshot=a,this.eventCustomize=l,this.step=this.step.bind(this),this.currentDockerId=""}logger(...e){Mt.info(`${new Date(Date.now()).toLocaleString()} [Playback]${e.join(",")}`)}convertToAbsoluteTime(e){return this.start+e}setRate(e){e&&!Fwe.includes(e)&&this.progressDispatcher&&this.progressDispatcher("error",`${or("helpers_invalid_parameter_rate_x",{x:e})}`),this.rate=e||this.rate}buffer(e){this.dataBuffer=this.dataBuffer.concat(e),this.firstFrameTime=this.dataBuffer[0].timestamp}pause(){if(this.logger("Click Pause!"),!this.playing){Mt.warn("Do not pause more than one time");return}this.playing=!1}resume(){this.resumeTime=this.resumeTime||0,this.resumeTime>0?this.isReplay=!0:this.preFrameTime=Date.now(),this.playing=!0,this.isStopMovePosition=!1,window.requestAnimationFrame(this.step)}restart(){this.preFrameTime=Date.now(),this.playing=!0,this.preFireTreeIndex={},this.preTerminalIndex={},this.preDebugIndex={},this.preTerminalDockerId="",this.preConsoleDockerId="",Ce.file.reset(),this.index=0,window.requestAnimationFrame(this.step)}movePosition(e){var n;if(!((n=this.dataBuffer)!=null&&n.length)){this.resumeTime=e;return}this.isStopMovePosition=!this.playing,this.resumeTime=e,this.isReplay=!0,this.index=this.findFrameByTimeStamp(),this.isMovePosition=!0,this.preTerminalIndex={},this.preDebugIndex={},Ce.dao.resetTerminal(),Ce.dao.resetConsole(),oe.dao.channel().xtermStatus({resetConsole:!0}),window.requestAnimationFrame(this.step)}findFrameByTimeStamp(){const e=this.resumeTime+this.firstFrameTime,n=this.dataBuffer,r=n.length,i=(a,l)=>{var c,u,f,h;if(a<=l){const d=Math.floor((l-a)/2+a),O=n[d].timestamp;return O===e?d:e===((c=n[d-1])==null?void 0:c.timestamp)?d-1:e===((u=n[d+1])==null?void 0:u.timestamp)?d+1:e>((f=n[d-1])==null?void 0:f.timestamp)&&e<((h=n[d+1])==null?void 0:h.timestamp)?d:(e<O?l=d-1:e>O&&(a=d+1),i(a,l))}else return Mt.warn("Do not find the next frame"),this.index=0,this.resumeTime=0,this.resume(),this.index},o=0,s=r-1;return i(o,s)}gotoNextFrame(){var e;!this.isStopMovePosition&&((e=this.progressDispatcher)==null||e.call(this,"progress",this.resumeTime)),this.isStopMovePosition?(this.playing=!1,this.isStopMovePosition=!1):(this.preFrameTime=Date.now(),window.requestAnimationFrame(this.step))}triggerCustomizeEvent(e){var n;(n=this.eventCustomize)==null||n.call(this,e)}step(){var n,r,i;if(!this.playing&&!this.isStopMovePosition)return;if(this.isReplay&&(this.isReplay=!1,this.preFrameTime=Date.now()),this.resumeTime=this.resumeTime+(Date.now()-this.preFrameTime)*this.rate,this.index>this.dataBuffer.length-1){this.playing=!1,this.resumeTime=0,!this.isStopMovePosition&&((n=this.progressDispatcher)==null||n.call(this,"progress",this.totalTime)),(r=this.progressDispatcher)==null||r.call(this,"complete",this.resumeTime);return}let e=this.dataBuffer[this.index];if(!e){this.gotoNextFrame();return}if(e.eventName==="customize"&&(this.firstFrameTime+this.resumeTime>(e==null?void 0:e.timestamp)&&(this.logger(this.index,e.index,e.eventName,e._id),this.index++,this.triggerCustomizeEvent(e)),!this.isStopMovePosition)){this.gotoNextFrame();return}if(this.firstFrameTime+this.resumeTime>(e==null?void 0:e.timestamp)){if(this.isTerminalOrConsole(e.eventName)){this.trigger(e.eventName,e),this.gotoNextFrame();return}let s=0;const a=this.firstFrameTime+this.resumeTime;for(let l=this.index+1;l<this.dataBuffer.length&&this.dataBuffer[l].timestamp<=a;l++)s++,this.index=l;s>0&&(e=this.dataBuffer[this.index],this.isMovePosition=!0),this.isMovePosition?(this.triggerPreFrames(),this.isMovePosition=!1):(e=((i=this.getPlaybackSnapshot)==null?void 0:i.call(this,e.eventName,e,this.getPreFrameByFrame(e,this.index)||e))||e,this.setPreFrameData(e,this.index)),this.trigger(e.eventName,e)}else this.isMovePosition&&(this.triggerPreFrames(),this.isMovePosition=!1);this.gotoNextFrame()}getPreFrameByFrame(e,n){const{eventName:r,dockerId:i}=e,o=this.isEditor(r),s=this.isFileTree(r);let a;if(o){const{data:{openedPath:l}}=e;for(let c=n-1;c>=0;c--){const u=this.dataBuffer[c];if(u.dockerId===i&&u.eventName===r&&u.data.openedPath===l){a=this.dataBuffer[c],!a.snapshot&&c>=0&&this.setSnapshotByIndex(c);break}}}return s&&(a=this.dataBuffer[this.preFireTreeIndex[i]]),a}setPreFrameData(e,n){const{eventName:r,dockerId:i}=e;this.isFileTree(r)&&(this.preFireTreeIndex[i]=n)}isEditor(e){return e===Ct.Editor}isFileTree(e){return e===Ct.FileTree}isTerminal(e){return e===Ct.Terminal}isConsole(e){return e===Ct.Console}isDebug(e){return e===Ct.Debug}isTerminalOrConsole(e){return[Ct.Terminal.toString(),Ct.Console.toString()].includes(e)}setSnapshotByIndex(e){var o;const n=this.dataBuffer[e],{eventName:r}=n,i=this.isEditor(r);for(let s=0;s<=e;s++){let a=this.dataBuffer[s];if(a.eventName===n.eventName&&a.dockerId===n.dockerId&&(i?a.data.openedPath===n.data.openedPath:!0)){if(a.snapshot){this.setPreFrameData(a,s);continue}a=((o=this.getPlaybackSnapshot)==null?void 0:o.call(this,a.eventName,a,this.getPreFrameByFrame(a,s)))||a,this.setPreFrameData(a,s)}}}triggerPreFrames(){const e=[Ct.FileTree.toString(),Ct.Editor.toString(),Ct.Terminal.toString(),Ct.Console.toString(),Ct.Debug.toString()],n=this.index,r=this.dataBuffer[n].dockerId;this.currentDockerId=r;for(let i=n;i>=0;i--){if(!e.length)return;if(e.includes(this.dataBuffer[i].eventName)&&this.dataBuffer[i].dockerId===this.currentDockerId){const o=this.dataBuffer[i],s=e.findIndex(a=>a===o.eventName);e.splice(s,1),o.snapshot||this.setSnapshotByIndex(i),this.trigger(o.eventName,o,!1)}}e.forEach(i=>{this.logger("trigger reset eventName:",i),this.trigger(i,null,!1)})}trigger(e,n,r=!0){if(e==="customize"){this.logger(this.index,e,n==null?void 0:n._id),this.triggerCustomizeEvent(n),r&&this.index++;return}const i=this.isTerminalOrConsole(e),o=this.isDebug(e);if(!i&&!o){this.logger(this.index,e,n==null?void 0:n._id),this.eventDispatcher(e,n),r&&this.index++;return}const s=n==null?void 0:n.dockerId;this.logger("[TR]",s);const a=this.preTerminalIndex[s]||0,l=this.preDebugIndex[s]||0,c=o?l:a;for(let u=c+1;u<=this.index;u++){const f=this.dataBuffer[u];f&&(this.isTerminalOrConsole(f.eventName)||o)&&f.dockerId===s&&(this.logger("[TR]",u,this.index,f.eventName,this.dataBuffer[u].dockerId,this.dataBuffer[u]._id),this.isTerminal(e)&&(this.preTerminalDockerId&&this.preTerminalDockerId!==s&&Ce.dao.resetTerminal(),this.preTerminalDockerId=s),this.isConsole(e)&&(this.preConsoleDockerId&&this.preConsoleDockerId!==s&&(Ce.dao.resetConsole(),oe.dao.channel().xtermStatus({resetConsole:!0})),this.preConsoleDockerId=s),this.eventDispatcher(f.eventName,f))}o?this.preDebugIndex[s]=this.index:this.preTerminalIndex[s]=this.index,r&&this.index++}}const Zwe="@dao42/d42paas-front",Vwe="0.9.98",Gwe="d42paas front",Hwe="dao42 paas team",Kwe="https://github.com/dao42/d42paas_frontend#readme",Jwe="UNLICENSED",e_e="./dist/DaoPaaS.cjs",t_e="./dist/DaoPaaS.cjs",n_e="./dist/DaoPaaS.d.ts",r_e={prebuild:"rimraf dist",build:"cross-env VITE_BUILD_EVENT=true pnpm tsc && pnpm vite && pnpm typedoc",copydist:"cp -r dist/sdk ../demo/public/",vite:"vite build --config ./config/vite.config.ts && shx cp ./src/types/DaoPaaS.d.ts ./dist",typedoc:"npx typedoc --tsconfig ./doc.tsconfig.json",workNameSpaceToFix:"node ./config/workNameSpaceToFix.js",tsc:"tsc -p ./tsconfig.json --isolatedModules false",test:"jest --coverage",prepublish:"pnpm build",publish:"npm publish --access public"},i_e={"@codemirror/autocomplete":"^6.0.2","@codemirror/collab":"^6.0.0","@codemirror/commands":"^6.0.0","@codemirror/lang-cpp":"^6.0.0","@codemirror/lang-css":"^6.0.0","@codemirror/lang-html":"^6.0.0","@codemirror/lang-java":"^6.0.0","@codemirror/lang-javascript":"^6.0.0","@codemirror/lang-json":"^6.0.0","@codemirror/lang-lezer":"^6.0.0","@codemirror/lang-markdown":"^6.0.0","@codemirror/lang-php":"^6.0.0","@codemirror/lang-python":"^6.0.0","@codemirror/lang-rust":"^6.0.0","@codemirror/lang-sql":"^6.0.0","@codemirror/lang-xml":"^6.0.0","@codemirror/language":"6.2.1","@codemirror/legacy-modes":"^6.0.0","@codemirror/lint":"^6.0.0","@codemirror/search":"^6.0.0","@codemirror/state":"^6.0.0","@codemirror/theme-one-dark":"^6.0.0","@codemirror/view":"^6.0.0","@emotion/babel-plugin":"^11.3.0","@emotion/babel-preset-css-prop":"^11.2.0","@emotion/core":"^11.0.0","@emotion/css":"^11.1.3","@emotion/eslint-plugin":"^11.2.0","@emotion/react":"^11.4.1","@emotion/styled":"^11.3.0","@headlessui/react":"^1.4.3","@loadable/component":"^5.15.2","@open-rpc/client-js":"^1.7.1","@testing-library/jest-dom":"^5.16.4","@testing-library/react":"^13.3.0","@types/fs-extra":"^9.0.13","@types/jest":"^27.0.2","@types/loadable__component":"^5.13.4","@types/lodash":"^4.14.175","@types/lodash.clonedeep":"^4.5.7","@types/lodash.isequal":"^4.5.6","@types/node":"^16.11.1","@types/ot":"^0.0.5","@types/prop-types":"^15.7.5","@types/react":"^18.0.14","@types/react-dom":"^18.0.5","@types/react-transition-group":"^4.4.5","@types/uuid":"^8.3.1","@typescript-eslint/eslint-plugin":"^4.28.2","@typescript-eslint/parser":"^4.28.2","@udecode/zustood":"^1.1.1","@vitejs/plugin-react":"^1.0.7",ahooks:"^3.3.10","babel-loader":"^8.2.2",bufferutil:"^4.0.6",classnames:"^2.3.1",codemirror:"^6.0.0",concurrently:"^6.3.0","cross-env":"^7.0.3",devicon:"^2.14.0",dexie:"^3.2.0","file-icons-js":"^1.1.0","file-loader":"^6.2.0","fs-extra":"^10.0.0","glob-all":"^3.2.1","highlight.js":"^11.6.0","hotkeys-js":"^3.9.4",immer:"^9.0.14",jest:"27.0.6",lodash:"^4.17.21",msw:"^0.39.2","ninja-keys":"^1.1.12",ot:"^0.0.15","prop-types":"^15.8.1",react:"^18.2.0","react-complex-tree":"^1.1.6","react-content-loader":"^6.2.0","react-dom":"18.2.0","react-icons":"^4.3.1","react-transition-group":"^4.4.2","rehype-document":"^6.1.0","rehype-highlight":"^5.0.2","rehype-katex":"^6.0.2","rehype-stringify":"^9.0.3","remark-gfm":"^3.0.1","remark-math":"^5.1.1","remark-parse":"^10.0.1","remark-rehype":"^10.1.0",rimraf:"^3.0.2","rollup-plugin-visualizer":"^5.6.0",sass:"^1.43.2","sass-loader":"^12.2.0",shx:"^0.3.3","socket.io-client":"^4.5.1","source-map-loader":"^3.0.0","style-loader":"^3.3.1",stylis:"^4.0.10","ts-jest":"^27.1.3","ts-loader":"^9.2.5","ts-node":"^10.0.0",typedoc:"^0.22.12",unified:"^10.1.2","use-immer":"^0.7.0","utf-8-validate":"^5.0.9",uuid:"^8.3.2",vite:"^2.7.2","vite-plugin-html":"^3.0.6","whatwg-fetch":"^3.6.2",xterm:"^4.13.0","xterm-addon-attach":"^0.6.0","xterm-addon-fit":"^0.5.0",zustand:"^4.0.0-rc.1"},o_e=["dist"],s_e={type:"git",url:"git+https://github.com/dao42/d42paas_frontend.git"},a_e={url:"https://github.com/dao42/d42paas_frontend/issues"},l_e={workerDirectory:"src"},c_e={"@sentry/browser":"^7.16.0","@sentry/tracing":"^7.16.0","@types/lodash.throttle":"^4.1.7","codemirror-lang-elixir":"^3.0.0",i18next:"^21.8.16","lodash.clonedeep":"^4.5.0","lodash.isequal":"^4.5.0","lodash.throttle":"^4.1.1",minimatch:"^5.1.0","range-analyzer":"0.1.1-alpha.2","rc-dropdown":"^4.0.1","rc-menu":"^9.6.3","react-i18next":"11.18.3","socket.io-msgpack-parser":"^3.0.1","xterm-addon-web-links":"^0.6.0"};var u_e={name:Zwe,version:Vwe,description:Gwe,author:Hwe,homepage:Kwe,license:Jwe,main:e_e,module:t_e,types:n_e,scripts:r_e,devDependencies:i_e,files:o_e,repository:s_e,bugs:a_e,msw:l_e,dependencies:c_e};const f_e=()=>u_e.version,d_e=async(t,e,n)=>{const r=window.localStorage.getItem("__paas__testServerCode__"),i=r?{serverCode:r}:{},s=await(await fetch(t+"/api/v1/jssdk/ticket",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ticket:e,packageVersion:n,...i})})).json();if(s.status==="failure")throw Mt.error(s),new Error(s.errors[0].erromsg);return s.data},Yi=(t,e=1)=>{t=t||"#ffffff";let n=t.replace("#","");n.length===3&&(n=`${n[0]}${n[0]}${n[1]}${n[1]}${n[2]}${n[2]}`);const r=parseInt(n.substring(0,2),16),i=parseInt(n.substring(2,4),16),o=parseInt(n.substring(4,6),16);return e>1&&e<=100&&(e=e/100),`rgba(${r},${i},${o},${e})`},h_e=()=>{const t=`
|
|
50
50
|
@keyframes fadeOut {
|
|
51
51
|
0% {opacity: 1;}
|
|
52
52
|
100% {opacity: 0;}
|
|
@@ -479,7 +479,7 @@ Event: ${mp(t)}`),!0):C$e(t,e.denyUrls)?((typeof __SENTRY_DEBUG__=="undefined"||
|
|
|
479
479
|
Event: ${mp(t)}.
|
|
480
480
|
Url: ${i4(t)}`),!0):R$e(t,e.allowUrls)?!1:((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.warn(`Event dropped due to not being matched by \`allowUrls\` option.
|
|
481
481
|
Event: ${mp(t)}.
|
|
482
|
-
Url: ${i4(t)}`),!0)}function E$e(t,e){return!e||!e.length?!1:A$e(t).some(n=>e.some(r=>Bv(n,r)))}function C$e(t,e){if(!e||!e.length)return!1;const n=i4(t);return n?e.some(r=>Bv(n,r)):!1}function R$e(t,e){if(!e||!e.length)return!0;const n=i4(t);return n?e.some(r=>Bv(n,r)):!0}function A$e(t){if(t.message)return[t.message];if(t.exception)try{const{type:e="",value:n=""}=t.exception.values&&t.exception.values[0]||{};return[`${n}`,`${e}: ${n}`]}catch{return(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.error(`Cannot extract message for event ${mp(t)}`),[]}return[]}function I$e(t){try{return t.exception.values[0].type==="SentryError"}catch{}return!1}function z$e(t=[]){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n&&n.filename!=="<anonymous>"&&n.filename!=="[native code]")return n.filename||null}return null}function i4(t){try{let e;try{e=t.exception.values[0].stacktrace.frames}catch{}return e?z$e(e):null}catch{return(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.error(`Cannot extract url for event ${mp(t)}`),null}}function fee(t,e){const n=cR(t,e),r={type:e&&e.name,value:D$e(e)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===""&&(r.value="Unrecoverable error caught"),r}function L$e(t,e,n,r){const o=co().getClient(),s=o&&o.getOptions().normalizeDepth,a={exception:{values:[{type:JC(e)?e.constructor.name:r?"UnhandledRejection":"Error",value:`Non-Error ${r?"promise rejection":"exception"} captured with keys: ${d8e(e)}`}]},extra:{__serialized__:nee(e,s)}};if(n){const l=cR(t,n);l.length&&(a.exception.values[0].stacktrace={frames:l})}return a}function sP(t,e){return{exception:{values:[fee(t,e)]}}}function cR(t,e){const n=e.stacktrace||e.stack||"",r=M$e(e);try{return t(n,r)}catch{}return[]}const N$e=/Minified React error #\d+;/i;function M$e(t){if(t){if(typeof t.framesToPop=="number")return t.framesToPop;if(N$e.test(t.message))return 1}return 0}function D$e(t){const e=t&&t.message;return e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function X$e(t,e,n,r){const i=n&&n.syntheticException||void 0,o=uR(t,e,i,r);return Yv(o),o.level="error",n&&n.event_id&&(o.event_id=n.event_id),Mp(o)}function W$e(t,e,n="info",r,i){const o=r&&r.syntheticException||void 0,s=r8(t,e,o,i);return s.level=n,r&&r.event_id&&(s.event_id=r.event_id),Mp(s)}function uR(t,e,n,r,i){let o;if(YJ(e)&&e.error)return sP(t,e.error);if(LX(e)||KQe(e)){const s=e;if("stack"in e)o=sP(t,e);else{const a=s.name||(LX(s)?"DOMError":"DOMException"),l=s.message?`${a}: ${s.message}`:a;o=r8(t,l,n,r),HQ(o,l)}return"code"in s&&(o.tags={...o.tags,"DOMException.code":`${s.code}`}),o}return BJ(e)?sP(t,e):n0(e)||JC(e)?(o=L$e(t,e,n,i),Yv(o,{synthetic:!0}),o):(o=r8(t,e,n,r),HQ(o,`${e}`,void 0),Yv(o,{synthetic:!0}),o)}function r8(t,e,n,r){const i={message:e};if(r&&n){const o=cR(t,n);o.length&&(i.exception={values:[{value:e,stacktrace:{frames:o}}]})}return i}const dee="Breadcrumbs";class Vv{static __initStatic(){this.id=dee}__init(){this.name=Vv.id}constructor(e){Vv.prototype.__init.call(this),this.options={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e}}setupOnce(){this.options.console&&Ja("console",q$e),this.options.dom&&Ja("dom",U$e(this.options.dom)),this.options.xhr&&Ja("xhr",B$e),this.options.fetch&&Ja("fetch",Y$e),this.options.history&&Ja("history",F$e)}}Vv.__initStatic();function U$e(t){function e(n){let r,i=typeof t=="object"?t.serializeAttribute:void 0;typeof i=="string"&&(i=[i]);try{r=n.event.target?qv(n.event.target,i):qv(n.event,i)}catch{r="<unknown>"}r.length!==0&&co().addBreadcrumb({category:`ui.${n.name}`,message:r},{event:n.event,name:n.name,global:n.global})}return e}function q$e(t){const e={category:"console",data:{arguments:t.args,logger:"console"},level:X8e(t.level),message:MX(t.args," ")};if(t.level==="assert")if(t.args[0]===!1)e.message=`Assertion failed: ${MX(t.args.slice(1)," ")||"console.assert"}`,e.data.arguments=t.args.slice(1);else return;co().addBreadcrumb(e,{input:t.args,level:t.level})}function B$e(t){if(t.endTimestamp){if(t.xhr.__sentry_own_request__)return;const{method:e,url:n,status_code:r,body:i}=t.xhr.__sentry_xhr__||{};co().addBreadcrumb({category:"xhr",data:{method:e,url:n,status_code:r},type:"http"},{xhr:t.xhr,input:i});return}}function Y$e(t){!t.endTimestamp||t.fetchData.url.match(/sentry_key/)&&t.fetchData.method==="POST"||(t.error?co().addBreadcrumb({category:"fetch",data:t.fetchData,level:"error",type:"http"},{data:t.error,input:t.args}):co().addBreadcrumb({category:"fetch",data:{...t.fetchData,status_code:t.response.status},type:"http"},{input:t.args,response:t.response}))}function F$e(t){let e=t.from,n=t.to;const r=iP(bt.location.href);let i=iP(e);const o=iP(n);i.path||(i=r),r.protocol===o.protocol&&r.host===o.host&&(n=o.relative),r.protocol===i.protocol&&r.host===i.host&&(e=i.relative),co().addBreadcrumb({category:"navigation",data:{from:e,to:n}})}class j$e extends d1{constructor(e){e._metadata=e._metadata||{},e._metadata.sdk=e._metadata.sdk||{name:"sentry.javascript.browser",packages:[{name:"npm:@sentry/browser",version:HX}],version:HX},super(e),e.sendClientReports&&bt.document&&bt.document.addEventListener("visibilitychange",()=>{bt.document.visibilityState==="hidden"&&this._flushOutcomes()})}eventFromException(e,n){return X$e(this._options.stackParser,e,n,this._options.attachStacktrace)}eventFromMessage(e,n="info",r){return W$e(this._options.stackParser,e,n,r,this._options.attachStacktrace)}sendEvent(e,n){const r=this.getIntegrationById(dee);r&&r.options&&r.options.sentry&&co().addBreadcrumb({category:`sentry.${e.type==="transaction"?"transaction":"event"}`,event_id:e.event_id,level:e.level,message:mp(e)},{event:e}),super.sendEvent(e,n)}_prepareEvent(e,n,r){return e.platform=e.platform||"javascript",super._prepareEvent(e,n,r)}_flushOutcomes(){const e=this._clearOutcomes();if(e.length===0){(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("No outcomes to send");return}if(!this._dsn){(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("No dsn provided, will not send outcomes");return}(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("Sending outcomes:",e);const n=lee(this._dsn,this._options),r=V8e(e,this._options.tunnel&&nR(this._dsn));try{Object.prototype.toString.call(bt&&bt.navigator)==="[object Navigator]"&&typeof bt.navigator.sendBeacon=="function"&&!this._options.transportOptions?bt.navigator.sendBeacon.bind(bt.navigator)(n,ree(r)):this._sendEnvelope(r)}catch(i){(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.error(i)}}}let j5;function Z$e(){if(j5)return j5;if(GQ(bt.fetch))return j5=bt.fetch.bind(bt);const t=bt.document;let e=bt.fetch;if(t&&typeof t.createElement=="function")try{const n=t.createElement("iframe");n.hidden=!0,t.head.appendChild(n);const r=n.contentWindow;r&&r.fetch&&(e=r.fetch),t.head.removeChild(n)}catch(n){(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",n)}return j5=e.bind(bt)}function V$e(t,e=Z$e()){function n(r){const i={body:r.body,method:"POST",referrerPolicy:"origin",headers:t.headers,keepalive:r.body.length<=65536,...t.fetchOptions};return e(t.url,i).then(o=>({statusCode:o.status,headers:{"x-sentry-rate-limits":o.headers.get("X-Sentry-Rate-Limits"),"retry-after":o.headers.get("Retry-After")}}))}return uee(t,n)}const G$e=4;function H$e(t){function e(n){return new ea((r,i)=>{const o=new XMLHttpRequest;o.onerror=i,o.onreadystatechange=()=>{o.readyState===G$e&&r({statusCode:o.status,headers:{"x-sentry-rate-limits":o.getResponseHeader("X-Sentry-Rate-Limits"),"retry-after":o.getResponseHeader("Retry-After")}})},o.open("POST",t.url);for(const s in t.headers)Object.prototype.hasOwnProperty.call(t.headers,s)&&o.setRequestHeader(s,t.headers[s]);o.send(n.body)})}return uee(t,e)}const k_="?",K$e=30,J$e=40,eEe=50;function fR(t,e,n,r){const i={filename:t,function:e,in_app:!0};return n!==void 0&&(i.lineno=n),r!==void 0&&(i.colno=r),i}const tEe=/^\s*at (?:(.*\).*?|.*?) ?\((?:address at )?)?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,nEe=/\((\S*)(?::(\d+))(?::(\d+))\)/,rEe=t=>{const e=tEe.exec(t);if(e){if(e[2]&&e[2].indexOf("eval")===0){const o=nEe.exec(e[2]);o&&(e[2]=o[1],e[3]=o[2],e[4]=o[3])}const[r,i]=hee(e[1]||k_,e[2]);return fR(i,r,e[3]?+e[3]:void 0,e[4]?+e[4]:void 0)}},iEe=[K$e,rEe],oEe=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension|safari-extension|safari-web-extension|capacitor)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,sEe=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,aEe=t=>{const e=oEe.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const o=sEe.exec(e[3]);o&&(e[1]=e[1]||"eval",e[3]=o[1],e[4]=o[2],e[5]="")}let r=e[3],i=e[1]||k_;return[i,r]=hee(i,r),fR(r,i,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},lEe=[eEe,aEe],cEe=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,uEe=t=>{const e=cEe.exec(t);return e?fR(e[2],e[1]||k_,+e[3],e[4]?+e[4]:void 0):void 0},fEe=[J$e,uEe],dEe=[iEe,lEe,fEe],hEe=KJ(...dEe),hee=(t,e)=>{const n=t.indexOf("safari-extension")!==-1,r=t.indexOf("safari-web-extension")!==-1;return n||r?[t.indexOf("@")!==-1?t.split("@")[0]:k_,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]};let i8=0;function pee(){return i8>0}function pEe(){i8+=1,setTimeout(()=>{i8-=1})}function i0(t,e={},n){if(typeof t!="function")return t;try{const i=t.__sentry_wrapped__;if(i)return i;if(iR(t))return t}catch{return t}const r=function(){const i=Array.prototype.slice.call(arguments);try{n&&typeof n=="function"&&n.apply(this,arguments);const o=i.map(s=>i0(s,e));return t.apply(this,o)}catch(o){throw pEe(),d$e(s=>{s.addEventProcessor(a=>(e.mechanism&&(HQ(a,void 0,void 0),Yv(a,e.mechanism)),a.extra={...a.extra,arguments:i},a)),f$e(o)}),o}};try{for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i])}catch{}GJ(r,t),rR(t,"__sentry_wrapped__",r);try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get(){return t.name}})}catch{}return r}class oh{static __initStatic(){this.id="GlobalHandlers"}__init(){this.name=oh.id}__init2(){this._installFunc={onerror:OEe,onunhandledrejection:mEe}}constructor(e){oh.prototype.__init.call(this),oh.prototype.__init2.call(this),this._options={onerror:!0,onunhandledrejection:!0,...e}}setupOnce(){Error.stackTraceLimit=50;const e=this._options;for(const n in e){const r=this._installFunc[n];r&&e[n]&&(yEe(n),r(),this._installFunc[n]=void 0)}}}oh.__initStatic();function OEe(){Ja("error",t=>{const[e,n,r]=gee();if(!e.getIntegration(oh))return;const{msg:i,url:o,line:s,column:a,error:l}=t;if(pee()||l&&l.__sentry_own_request__)return;const c=l===void 0&&Np(i)?vEe(i,o,s,a):Oee(uR(n,l||i,void 0,r,!1),o,s,a);c.level="error",mee(e,l,c,"onerror")})}function mEe(){Ja("unhandledrejection",t=>{const[e,n,r]=gee();if(!e.getIntegration(oh))return;let i=t;try{"reason"in t?i=t.reason:"detail"in t&&"reason"in t.detail&&(i=t.detail.reason)}catch{}if(pee()||i&&i.__sentry_own_request__)return!0;const o=FJ(i)?gEe(i):uR(n,i,void 0,r,!0);o.level="error",mee(e,i,o,"onunhandledrejection")})}function gEe(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function vEe(t,e,n,r){const i=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;let o=YJ(t)?t.message:t,s="Error";const a=o.match(i);return a&&(s=a[1],o=a[2]),Oee({exception:{values:[{type:s,value:o}]}},e,n,r)}function Oee(t,e,n,r){const i=t.exception=t.exception||{},o=i.values=i.values||[],s=o[0]=o[0]||{},a=s.stacktrace=s.stacktrace||{},l=a.frames=a.frames||[],c=isNaN(parseInt(r,10))?void 0:r,u=isNaN(parseInt(n,10))?void 0:n,f=Np(e)&&e.length>0?e:r8e();return l.length===0&&l.push({colno:c,filename:f,function:"?",in_app:!0,lineno:u}),t}function yEe(t){(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log(`Global Handler attached: ${t}`)}function mee(t,e,n,r){Yv(n,{handled:!1,type:r}),t.captureEvent(n,{originalException:e})}function gee(){const t=co(),e=t.getClient(),n=e&&e.getOptions()||{stackParser:()=>[],attachStacktrace:!1};return[t,n.stackParser,n.attachStacktrace]}const bEe=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"];class Gv{static __initStatic(){this.id="TryCatch"}__init(){this.name=Gv.id}constructor(e){Gv.prototype.__init.call(this),this._options={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...e}}setupOnce(){this._options.setTimeout&&Us(bt,"setTimeout",JX),this._options.setInterval&&Us(bt,"setInterval",JX),this._options.requestAnimationFrame&&Us(bt,"requestAnimationFrame",xEe),this._options.XMLHttpRequest&&"XMLHttpRequest"in bt&&Us(XMLHttpRequest.prototype,"send",SEe);const e=this._options.eventTarget;e&&(Array.isArray(e)?e:bEe).forEach(wEe)}}Gv.__initStatic();function JX(t){return function(...e){const n=e[0];return e[0]=i0(n,{mechanism:{data:{function:hh(t)},handled:!0,type:"instrument"}}),t.apply(this,e)}}function xEe(t){return function(e){return t.apply(this,[i0(e,{mechanism:{data:{function:"requestAnimationFrame",handler:hh(t)},handled:!0,type:"instrument"}})])}}function SEe(t){return function(...e){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(i=>{i in n&&typeof n[i]=="function"&&Us(n,i,function(o){const s={mechanism:{data:{function:i,handler:hh(o)},handled:!0,type:"instrument"}},a=iR(o);return a&&(s.mechanism.data.handler=hh(a)),i0(o,s)})}),t.apply(this,e)}}function wEe(t){const e=bt,n=e[t]&&e[t].prototype;!n||!n.hasOwnProperty||!n.hasOwnProperty("addEventListener")||(Us(n,"addEventListener",function(r){return function(i,o,s){try{typeof o.handleEvent=="function"&&(o.handleEvent=i0(o.handleEvent,{mechanism:{data:{function:"handleEvent",handler:hh(o),target:t},handled:!0,type:"instrument"}}))}catch{}return r.apply(this,[i,i0(o,{mechanism:{data:{function:"addEventListener",handler:hh(o),target:t},handled:!0,type:"instrument"}}),s])}}),Us(n,"removeEventListener",function(r){return function(i,o,s){const a=o;try{const l=a&&a.__sentry_wrapped__;l&&r.call(this,i,l,s)}catch{}return r.call(this,i,a,s)}}))}const _Ee="cause",TEe=5;class $1{static __initStatic(){this.id="LinkedErrors"}__init(){this.name=$1.id}constructor(e={}){$1.prototype.__init.call(this),this._key=e.key||_Ee,this._limit=e.limit||TEe}setupOnce(){const e=co().getClient();!e||sR((n,r)=>{const i=co().getIntegration($1);return i?kEe(e.getOptions().stackParser,i._key,i._limit,n,r):n})}}$1.__initStatic();function kEe(t,e,n,r,i){if(!r.exception||!r.exception.values||!i||!Eu(i.originalException,Error))return r;const o=vee(t,n,i.originalException,e);return r.exception.values=[...o,...r.exception.values],r}function vee(t,e,n,r,i=[]){if(!Eu(n[r],Error)||i.length+1>=e)return i;const o=fee(t,n[r]);return vee(t,e,n[r],r,[o,...i])}class E1{constructor(){E1.prototype.__init.call(this)}static __initStatic(){this.id="HttpContext"}__init(){this.name=E1.id}setupOnce(){sR(e=>{if(co().getIntegration(E1)){if(!bt.navigator&&!bt.location&&!bt.document)return e;const n=e.request&&e.request.url||bt.location&&bt.location.href,{referrer:r}=bt.document||{},{userAgent:i}=bt.navigator||{},o={...e.request&&e.request.headers,...r&&{Referer:r},...i&&{"User-Agent":i}},s={...n&&{url:n},headers:o};return{...e,request:s}}return e})}}E1.__initStatic();class C1{constructor(){C1.prototype.__init.call(this)}static __initStatic(){this.id="Dedupe"}__init(){this.name=C1.id}setupOnce(e,n){const r=i=>{const o=n().getIntegration(C1);if(o){try{if(PEe(i,o._previousEvent))return(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{return o._previousEvent=i}return o._previousEvent=i}return i};r.id=this.name,e(r)}}C1.__initStatic();function PEe(t,e){return e?!!(QEe(t,e)||$Ee(t,e)):!1}function QEe(t,e){const n=t.message,r=e.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!bee(t,e)||!yee(t,e))}function $Ee(t,e){const n=eW(e),r=eW(t);return!(!n||!r||n.type!==r.type||n.value!==r.value||!bee(t,e)||!yee(t,e))}function yee(t,e){let n=tW(t),r=tW(e);if(!n&&!r)return!0;if(n&&!r||!n&&r||(n=n,r=r,r.length!==n.length))return!1;for(let i=0;i<r.length;i++){const o=r[i],s=n[i];if(o.filename!==s.filename||o.lineno!==s.lineno||o.colno!==s.colno||o.function!==s.function)return!1}return!0}function bee(t,e){let n=t.fingerprint,r=e.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;n=n,r=r;try{return n.join("")===r.join("")}catch{return!1}}function eW(t){return t.exception&&t.exception.values&&t.exception.values[0]}function tW(t){const e=t.exception;if(e)try{return e.values[0].stacktrace.frames}catch{return}}const EEe=[new Q1,new Zv,new Gv,new Vv,new oh,new $1,new C1,new E1];function CEe(t={}){t.defaultIntegrations===void 0&&(t.defaultIntegrations=EEe),t.release===void 0&&bt.SENTRY_RELEASE&&bt.SENTRY_RELEASE.id&&(t.release=bt.SENTRY_RELEASE.id),t.autoSessionTracking===void 0&&(t.autoSessionTracking=!0),t.sendClientReports===void 0&&(t.sendClientReports=!0);const e={...t,stackParser:O8e(t.stackParser||hEe),integrations:S$e(t),transport:t.transport||(JJ()?V$e:H$e)};T$e(j$e,e),t.autoSessionTracking&&REe()}function nW(t){t.startSession({ignoreDuration:!0}),t.captureSession()}function REe(){if(typeof bt.document=="undefined"){(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.warn("Session tracking in non-browser environment with @sentry/browser is not supported.");return}const t=co();!t.captureSession||(nW(t),Ja("history",({from:e,to:n})=>{e===void 0||e===n||nW(co())}))}function dR(t){const e=co().getClient(),n=t||e&&e.getOptions();return!!n&&("tracesSampleRate"in n||"tracesSampler"in n)}function tb(t){const n=(t||co()).getScope();return n&&n.getTransaction()}function gs(t){return t/1e3}function AEe(){Ja("error",rW),Ja("unhandledrejection",rW)}function rW(){const t=tb();if(t){const e="internal_error";(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log(`[Tracing] Transaction: ${e} -> Global error occured`),t.setStatus(e)}}class P_{__init(){this.spans=[]}constructor(e=1e3){P_.prototype.__init.call(this),this._maxlen=e}add(e){this.spans.length>this._maxlen?e.spanRecorder=void 0:this.spans.push(e)}}class Sd{__init2(){this.traceId=rh()}__init3(){this.spanId=rh().substring(16)}__init4(){this.startTimestamp=Fv()}__init5(){this.tags={}}__init6(){this.data={}}constructor(e){if(Sd.prototype.__init2.call(this),Sd.prototype.__init3.call(this),Sd.prototype.__init4.call(this),Sd.prototype.__init5.call(this),Sd.prototype.__init6.call(this),!e)return this;e.traceId&&(this.traceId=e.traceId),e.spanId&&(this.spanId=e.spanId),e.parentSpanId&&(this.parentSpanId=e.parentSpanId),"sampled"in e&&(this.sampled=e.sampled),e.op&&(this.op=e.op),e.description&&(this.description=e.description),e.data&&(this.data=e.data),e.tags&&(this.tags=e.tags),e.status&&(this.status=e.status),e.startTimestamp&&(this.startTimestamp=e.startTimestamp),e.endTimestamp&&(this.endTimestamp=e.endTimestamp)}startChild(e){const n=new Sd({...e,parentSpanId:this.spanId,sampled:this.sampled,traceId:this.traceId});if(n.spanRecorder=this.spanRecorder,n.spanRecorder&&n.spanRecorder.add(n),n.transaction=this.transaction,(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&n.transaction){const r=e&&e.op||"< unknown op >",i=n.transaction.name||"< unknown name >",o=n.transaction.spanId,s=`[Tracing] Starting '${r}' span on transaction '${i}' (${o}).`;n.transaction.metadata.spanMetadata[n.spanId]={logMessage:s},wt.log(s)}return n}setTag(e,n){return this.tags={...this.tags,[e]:n},this}setData(e,n){return this.data={...this.data,[e]:n},this}setStatus(e){return this.status=e,this}setHttpStatus(e){this.setTag("http.status_code",String(e));const n=IEe(e);return n!=="unknown_error"&&this.setStatus(n),this}isSuccess(){return this.status==="ok"}finish(e){if((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&this.transaction&&this.transaction.spanId!==this.spanId){const{logMessage:n}=this.transaction.metadata.spanMetadata[this.spanId];n&&wt.log(n.replace("Starting","Finishing"))}this.endTimestamp=typeof e=="number"?e:Fv()}toTraceparent(){let e="";return this.sampled!==void 0&&(e=this.sampled?"-1":"-0"),`${this.traceId}-${this.spanId}${e}`}toContext(){return nh({data:this.data,description:this.description,endTimestamp:this.endTimestamp,op:this.op,parentSpanId:this.parentSpanId,sampled:this.sampled,spanId:this.spanId,startTimestamp:this.startTimestamp,status:this.status,tags:this.tags,traceId:this.traceId})}updateWithContext(e){return this.data=Rd(e.data,()=>({})),this.description=e.description,this.endTimestamp=e.endTimestamp,this.op=e.op,this.parentSpanId=e.parentSpanId,this.sampled=e.sampled,this.spanId=Rd(e.spanId,()=>this.spanId),this.startTimestamp=Rd(e.startTimestamp,()=>this.startTimestamp),this.status=e.status,this.tags=Rd(e.tags,()=>({})),this.traceId=Rd(e.traceId,()=>this.traceId),this}getTraceContext(){return nh({data:Object.keys(this.data).length>0?this.data:void 0,description:this.description,op:this.op,parent_span_id:this.parentSpanId,span_id:this.spanId,status:this.status,tags:Object.keys(this.tags).length>0?this.tags:void 0,trace_id:this.traceId})}toJSON(){return nh({data:Object.keys(this.data).length>0?this.data:void 0,description:this.description,op:this.op,parent_span_id:this.parentSpanId,span_id:this.spanId,start_timestamp:this.startTimestamp,status:this.status,tags:Object.keys(this.tags).length>0?this.tags:void 0,timestamp:this.endTimestamp,trace_id:this.traceId})}}function IEe(t){if(t<400&&t>=100)return"ok";if(t>=400&&t<500)switch(t){case 401:return"unauthenticated";case 403:return"permission_denied";case 404:return"not_found";case 409:return"already_exists";case 413:return"failed_precondition";case 429:return"resource_exhausted";default:return"invalid_argument"}if(t>=500&&t<600)switch(t){case 501:return"unimplemented";case 503:return"unavailable";case 504:return"deadline_exceeded";default:return"internal_error"}return"unknown_error"}class Hv extends Sd{__init(){this._measurements={}}__init2(){this._frozenDynamicSamplingContext=void 0}constructor(e,n){super(e),Hv.prototype.__init.call(this),Hv.prototype.__init2.call(this),this._hub=n||co(),this._name=e.name||"",this.metadata={source:"custom",...e.metadata,spanMetadata:{},changes:[],propagations:0},this._trimEnd=e.trimEnd,this.transaction=this;const r=this.metadata.dynamicSamplingContext;r&&(this._frozenDynamicSamplingContext={...r})}get name(){return this._name}set name(e){this.setName(e)}setName(e,n="custom"){(e!==this.name||n!==this.metadata.source)&&this.metadata.changes.push({source:this.metadata.source,timestamp:__(),propagations:this.metadata.propagations}),this._name=e,this.metadata.source=n}initSpanRecorder(e=1e3){this.spanRecorder||(this.spanRecorder=new P_(e)),this.spanRecorder.add(this)}setMeasurement(e,n,r=""){this._measurements[e]={value:n,unit:r}}setMetadata(e){this.metadata={...this.metadata,...e}}finish(e){if(this.endTimestamp!==void 0)return;if(this.name||((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this.name="<unlabeled transaction>"),super.finish(e),this.sampled!==!0){(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Tracing] Discarding transaction because its trace was not chosen to be sampled.");const s=this._hub.getClient();s&&s.recordDroppedEvent("sample_rate","transaction");return}const n=this.spanRecorder?this.spanRecorder.spans.filter(s=>s!==this&&s.endTimestamp):[];this._trimEnd&&n.length>0&&(this.endTimestamp=n.reduce((s,a)=>s.endTimestamp&&a.endTimestamp?s.endTimestamp>a.endTimestamp?s:a:s).endTimestamp);const r=this.metadata,i={contexts:{trace:this.getTraceContext()},spans:n,start_timestamp:this.startTimestamp,tags:this.tags,timestamp:this.endTimestamp,transaction:this.name,type:"transaction",sdkProcessingMetadata:{...r,dynamicSamplingContext:this.getDynamicSamplingContext()},...r.source&&{transaction_info:{source:r.source,changes:r.changes,propagations:r.propagations}}};return Object.keys(this._measurements).length>0&&((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Measurements] Adding measurements to transaction",JSON.stringify(this._measurements,void 0,2)),i.measurements=this._measurements),(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log(`[Tracing] Finishing ${this.op} transaction: ${this.name}.`),this._hub.captureEvent(i)}toContext(){const e=super.toContext();return nh({...e,name:this.name,trimEnd:this._trimEnd})}updateWithContext(e){return super.updateWithContext(e),this.name=Rd(e.name,()=>""),this._trimEnd=e.trimEnd,this}getDynamicSamplingContext(){if(this._frozenDynamicSamplingContext)return this._frozenDynamicSamplingContext;const e=this._hub||co(),n=e&&e.getClient();if(!n)return{};const{environment:r,release:i}=n.getOptions()||{},{publicKey:o}=n.getDsn()||{},s=this.metadata.sampleRate,a=s!==void 0?s.toString():void 0,l=e.getScope(),{segment:c}=l&&l.getUser()||{},u=this.metadata.source,f=u&&u!=="url"?this.name:void 0;return nh({environment:r,release:i,transaction:f,user_segment:c,public_key:o,trace_id:this.traceId,sample_rate:a})}}const xee=1e3,See=3e4,wee=5e3;class zEe extends P_{constructor(e,n,r,i){super(i),this._pushActivity=e,this._popActivity=n,this.transactionSpanId=r}add(e){e.spanId!==this.transactionSpanId&&(e.finish=n=>{e.endTimestamp=typeof n=="number"?n:Fv(),this._popActivity(e.spanId)},e.endTimestamp===void 0&&this._pushActivity(e.spanId)),super.add(e)}}class h1 extends Hv{__init(){this.activities={}}__init2(){this._heartbeatCounter=0}__init3(){this._finished=!1}__init4(){this._beforeFinishCallbacks=[]}constructor(e,n,r=xee,i=See,o=wee,s=!1){super(e,n),this._idleHub=n,this._idleTimeout=r,this._finalTimeout=i,this._heartbeatInterval=o,this._onScope=s,h1.prototype.__init.call(this),h1.prototype.__init2.call(this),h1.prototype.__init3.call(this),h1.prototype.__init4.call(this),s&&(iW(n),(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log(`Setting idle transaction on scope. Span ID: ${this.spanId}`),n.configureScope(a=>a.setSpan(this))),this._startIdleTimeout(),setTimeout(()=>{this._finished||(this.setStatus("deadline_exceeded"),this.finish())},this._finalTimeout)}finish(e=Fv()){if(this._finished=!0,this.activities={},this.spanRecorder){(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Tracing] finishing IdleTransaction",new Date(e*1e3).toISOString(),this.op);for(const n of this._beforeFinishCallbacks)n(this,e);this.spanRecorder.spans=this.spanRecorder.spans.filter(n=>{if(n.spanId===this.spanId)return!0;n.endTimestamp||(n.endTimestamp=e,n.setStatus("cancelled"),(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Tracing] cancelling span since transaction ended early",JSON.stringify(n,void 0,2)));const r=n.startTimestamp<e;return r||(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Tracing] discarding Span since it happened after Transaction was finished",JSON.stringify(n,void 0,2)),r}),(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Tracing] flushing IdleTransaction")}else(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Tracing] No active IdleTransaction");return this._onScope&&iW(this._idleHub),super.finish(e)}registerBeforeFinishCallback(e){this._beforeFinishCallbacks.push(e)}initSpanRecorder(e){if(!this.spanRecorder){const n=i=>{this._finished||this._pushActivity(i)},r=i=>{this._finished||this._popActivity(i)};this.spanRecorder=new zEe(n,r,this.spanId,e),(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("Starting heartbeat"),this._pingHeartbeat()}this.spanRecorder.add(this)}_cancelIdleTimeout(){this._idleTimeoutID&&(clearTimeout(this._idleTimeoutID),this._idleTimeoutID=void 0)}_startIdleTimeout(e){this._cancelIdleTimeout(),this._idleTimeoutID=setTimeout(()=>{!this._finished&&Object.keys(this.activities).length===0&&this.finish(e)},this._idleTimeout)}_pushActivity(e){this._cancelIdleTimeout(),(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log(`[Tracing] pushActivity: ${e}`),this.activities[e]=!0,(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Tracing] new activities count",Object.keys(this.activities).length)}_popActivity(e){if(this.activities[e]&&((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log(`[Tracing] popActivity ${e}`),delete this.activities[e],(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Tracing] new activities count",Object.keys(this.activities).length)),Object.keys(this.activities).length===0){const n=Fv()+this._idleTimeout/1e3;this._startIdleTimeout(n)}}_beat(){if(this._finished)return;const e=Object.keys(this.activities).join("");e===this._prevHeartbeatString?this._heartbeatCounter+=1:this._heartbeatCounter=1,this._prevHeartbeatString=e,this._heartbeatCounter>=3?((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Tracing] Transaction finished because of no change for 3 heart beats"),this.setStatus("deadline_exceeded"),this.finish()):this._pingHeartbeat()}_pingHeartbeat(){(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log(`pinging Heartbeat -> current counter: ${this._heartbeatCounter}`),setTimeout(()=>{this._beat()},this._heartbeatInterval)}}function iW(t){const e=t.getScope();e&&e.getTransaction()&&e.setSpan(void 0)}function LEe(){const t=this.getScope();if(t){const e=t.getSpan();if(e)return{"sentry-trace":e.toTraceparent()}}return{}}function _ee(t,e,n){if(!dR(e))return t.sampled=!1,t;if(t.sampled!==void 0)return t.setMetadata({sampleRate:Number(t.sampled)}),t;let r;return typeof e.tracesSampler=="function"?(r=e.tracesSampler(n),t.setMetadata({sampleRate:Number(r)})):n.parentSampled!==void 0?r=n.parentSampled:(r=e.tracesSampleRate,t.setMetadata({sampleRate:Number(r)})),NEe(r)?r?(t.sampled=Math.random()<r,t.sampled?((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log(`[Tracing] starting ${t.op} transaction - ${t.name}`),t):((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(r)})`),t)):((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log(`[Tracing] Discarding transaction because ${typeof e.tracesSampler=="function"?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0"}`),t.sampled=!1,t):((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.warn("[Tracing] Discarding transaction because of invalid sample rate."),t.sampled=!1,t)}function NEe(t){return jJ(t)||!(typeof t=="number"||typeof t=="boolean")?((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.warn(`[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(t)} of type ${JSON.stringify(typeof t)}.`),!1):t<0||t>1?((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.warn(`[Tracing] Given sample rate is invalid. Sample rate must be between 0 and 1. Got ${t}.`),!1):!0}function MEe(t,e){const n=this.getClient(),r=n&&n.getOptions()||{};let i=new Hv(t,this);return i=_ee(i,r,{parentSampled:t.parentSampled,transactionContext:t,...e}),i.sampled&&i.initSpanRecorder(r._experiments&&r._experiments.maxSpans),i}function DEe(t,e,n,r,i,o,s){const a=t.getClient(),l=a&&a.getOptions()||{};let c=new h1(e,t,n,r,s,i);return c=_ee(c,l,{parentSampled:e.parentSampled,transactionContext:e,...o}),c.sampled&&c.initSpanRecorder(l._experiments&&l._experiments.maxSpans),c}function XEe(){const t=j0();!t.__SENTRY__||(t.__SENTRY__.extensions=t.__SENTRY__.extensions||{},t.__SENTRY__.extensions.startTransaction||(t.__SENTRY__.extensions.startTransaction=MEe),t.__SENTRY__.extensions.traceHeaders||(t.__SENTRY__.extensions.traceHeaders=LEe))}function WEe(){const t=j0();if(!t.__SENTRY__)return;const e={mongodb(){const r=Md(module,"./integrations/node/mongo");return new r.Mongo},mongoose(){const r=Md(module,"./integrations/node/mongo");return new r.Mongo({mongoose:!0})},mysql(){const r=Md(module,"./integrations/node/mysql");return new r.Mysql},pg(){const r=Md(module,"./integrations/node/postgres");return new r.Postgres}},n=Object.keys(e).filter(r=>!!I8e(r)).map(r=>{try{return e[r]()}catch{return}}).filter(r=>r);n.length>0&&(t.__SENTRY__.integrations=[...t.__SENTRY__.integrations||[],...n])}function UEe(){XEe(),oR()&&WEe(),AEe()}function qEe(){bt&&bt.document?bt.document.addEventListener("visibilitychange",()=>{const t=tb();if(bt.document.hidden&&t){const e="cancelled";(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log(`[Tracing] Transaction: ${e} -> since tab moved to the background, op: ${t.op}`),t.status||t.setStatus(e),t.setTag("visibilitychange","document.hidden"),t.finish()}}):(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.warn("[Tracing] Could not set up background tab detection due to lack of global document")}const hR=(t,e,n)=>{let r;return i=>{e.value>=0&&(i||n)&&(e.delta=e.value-(r||0),(e.delta||r===void 0)&&(r=e.value,t(e)))}},BEe=()=>`v2-${Date.now()}-${Math.floor(Math.random()*(9e12-1))+1e12}`,pR=(t,e)=>({name:t,value:Rd(e,()=>-1),delta:0,entries:[],id:BEe()}),Q_=(t,e)=>{try{if(PerformanceObserver.supportedEntryTypes.includes(t)){if(t==="first-input"&&!("PerformanceEventTiming"in self))return;const n=new PerformanceObserver(r=>r.getEntries().map(e));return n.observe({type:t,buffered:!0}),n}}catch{}},$_=(t,e)=>{const n=r=>{(r.type==="pagehide"||bt.document.visibilityState==="hidden")&&(t(r),e&&(removeEventListener("visibilitychange",n,!0),removeEventListener("pagehide",n,!0)))};addEventListener("visibilitychange",n,!0),addEventListener("pagehide",n,!0)},YEe=(t,e)=>{const n=pR("CLS",0);let r,i=0,o=[];const s=l=>{if(l&&!l.hadRecentInput){const c=o[0],u=o[o.length-1];i&&o.length!==0&&l.startTime-u.startTime<1e3&&l.startTime-c.startTime<5e3?(i+=l.value,o.push(l)):(i=l.value,o=[l]),i>n.value&&(n.value=i,n.entries=o,r&&r())}},a=Q_("layout-shift",s);a&&(r=hR(t,n,e),$_(()=>{a.takeRecords().map(s),r(!0)}))};let Nx=-1;const FEe=()=>bt.document.visibilityState==="hidden"?0:1/0,jEe=()=>{$_(({timeStamp:t})=>{Nx=t},!0)},OR=()=>(Nx<0&&(Nx=FEe(),jEe()),{get firstHiddenTime(){return Nx}}),ZEe=(t,e)=>{const n=OR(),r=pR("FID");let i;const o=a=>{i&&a.startTime<n.firstHiddenTime&&(r.value=a.processingStart-a.startTime,r.entries.push(a),i(!0))},s=Q_("first-input",o);s&&(i=hR(t,r,e),$_(()=>{s.takeRecords().map(o),s.disconnect()},!0))},oW={},VEe=(t,e)=>{const n=OR(),r=pR("LCP");let i;const o=a=>{const l=a.startTime;l<n.firstHiddenTime&&(r.value=l,r.entries.push(a)),i&&i()},s=Q_("largest-contentful-paint",o);if(s){i=hR(t,r,e);const a=()=>{oW[r.id]||(s.takeRecords().map(o),s.disconnect(),oW[r.id]=!0,i(!0))};["keydown","click"].forEach(l=>{addEventListener(l,a,{once:!0,capture:!0})}),$_(a,!0)}};function aP(t){return typeof t=="number"&&isFinite(t)}function o0(t,{startTimestamp:e,...n}){return e&&t.startTimestamp>e&&(t.startTimestamp=e),t.startChild({startTimestamp:e,...n})}function Tee(){return bt&&bt.addEventListener&&bt.performance}let sW=0,io={},ou,Bg;function GEe(t=!1){const e=Tee();e&&jv&&(e.mark&&bt.performance.mark("sentry-tracing-init"),KEe(),JEe(t),e7e())}function HEe(){Q_("longtask",e=>{const n=tb();if(!n)return;const r=gs(jv+e.startTime),i=gs(e.duration);n.startChild({description:"Main UI thread blocked",op:"ui.long-task",startTimestamp:r,endTimestamp:r+i})})}function KEe(){YEe(t=>{const e=t.entries.pop();!e||((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Measurements] Adding CLS"),io.cls={value:t.value,unit:""},Bg=e)})}function JEe(t){VEe(e=>{const n=e.entries.pop();!n||((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Measurements] Adding LCP"),io.lcp={value:e.value,unit:"millisecond"},ou=n)},t)}function e7e(){ZEe(t=>{const e=t.entries.pop();if(!e)return;const n=gs(jv),r=gs(e.startTime);(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Measurements] Adding FID"),io.fid={value:t.value,unit:"millisecond"},io["mark.fid"]={value:n+r,unit:"second"}})}function t7e(t){const e=Tee();if(!e||!bt.performance.getEntries||!jv)return;(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Tracing] Adding & adjusting spans using Performance API");const n=gs(jv),r=e.getEntries();let i,o;if(r.slice(sW).forEach(s=>{const a=gs(s.startTime),l=gs(s.duration);if(!(t.op==="navigation"&&n+a<t.startTimestamp))switch(s.entryType){case"navigation":{r7e(t,s,n),i=n+gs(s.responseStart),o=n+gs(s.requestStart);break}case"mark":case"paint":case"measure":{n7e(t,s,a,l,n);const c=OR(),u=s.startTime<c.firstHiddenTime;s.name==="first-paint"&&u&&((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Measurements] Adding FP"),io.fp={value:s.startTime,unit:"millisecond"}),s.name==="first-contentful-paint"&&u&&((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Measurements] Adding FCP"),io.fcp={value:s.startTime,unit:"millisecond"});break}case"resource":{const c=s.name.replace(bt.location.origin,"");o7e(t,s,c,a,l,n);break}}}),sW=Math.max(r.length-1,0),s7e(t),t.op==="pageload"){typeof i=="number"&&((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Measurements] Adding TTFB"),io.ttfb={value:(i-t.startTimestamp)*1e3,unit:"millisecond"},typeof o=="number"&&o<=i&&(io["ttfb.requestTime"]={value:(i-o)*1e3,unit:"millisecond"})),["fcp","fp","lcp"].forEach(a=>{if(!io[a]||n>=t.startTimestamp)return;const l=io[a].value,c=n+gs(l),u=Math.abs((c-t.startTimestamp)*1e3),f=u-l;(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log(`[Measurements] Normalized ${a} from ${l} to ${u} (${f})`),io[a].value=u});const s=io["mark.fid"];s&&io.fid&&(o0(t,{description:"first input delay",endTimestamp:s.value+gs(io.fid.value),op:"ui.action",startTimestamp:s.value}),delete io["mark.fid"]),"fcp"in io||delete io.cls,Object.keys(io).forEach(a=>{t.setMeasurement(a,io[a].value,io[a].unit)}),a7e(t)}ou=void 0,Bg=void 0,io={}}function n7e(t,e,n,r,i){const o=i+n,s=o+r;return o0(t,{description:e.name,endTimestamp:s,op:e.entryType,startTimestamp:o}),o}function r7e(t,e,n){["unloadEvent","redirect","domContentLoadedEvent","loadEvent","connect"].forEach(r=>{Z5(t,e,r,n)}),Z5(t,e,"secureConnection",n,"TLS/SSL","connectEnd"),Z5(t,e,"fetch",n,"cache","domainLookupStart"),Z5(t,e,"domainLookup",n,"DNS"),i7e(t,e,n)}function Z5(t,e,n,r,i,o){const s=o?e[o]:e[`${n}End`],a=e[`${n}Start`];!a||!s||o0(t,{op:"browser",description:Rd(i,()=>n),startTimestamp:r+gs(a),endTimestamp:r+gs(s)})}function i7e(t,e,n){o0(t,{op:"browser",description:"request",startTimestamp:n+gs(e.requestStart),endTimestamp:n+gs(e.responseEnd)}),o0(t,{op:"browser",description:"response",startTimestamp:n+gs(e.responseStart),endTimestamp:n+gs(e.responseEnd)})}function o7e(t,e,n,r,i,o){if(e.initiatorType==="xmlhttprequest"||e.initiatorType==="fetch")return;const s={};"transferSize"in e&&(s["Transfer Size"]=e.transferSize),"encodedBodySize"in e&&(s["Encoded Body Size"]=e.encodedBodySize),"decodedBodySize"in e&&(s["Decoded Body Size"]=e.decodedBodySize);const a=o+r,l=a+i;o0(t,{description:n,endTimestamp:l,op:e.initiatorType?`resource.${e.initiatorType}`:"resource.other",startTimestamp:a,data:s})}function s7e(t){const e=bt.navigator;if(!e)return;const n=e.connection;n&&(n.effectiveType&&t.setTag("effectiveConnectionType",n.effectiveType),n.type&&t.setTag("connectionType",n.type),aP(n.rtt)&&(io["connection.rtt"]={value:n.rtt,unit:"millisecond"})),aP(e.deviceMemory)&&t.setTag("deviceMemory",`${e.deviceMemory} GB`),aP(e.hardwareConcurrency)&&t.setTag("hardwareConcurrency",String(e.hardwareConcurrency))}function a7e(t){ou&&((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Measurements] Adding LCP Data"),ou.element&&t.setTag("lcp.element",qv(ou.element)),ou.id&&t.setTag("lcp.id",ou.id),ou.url&&t.setTag("lcp.url",ou.url.trim().slice(0,200)),t.setTag("lcp.size",ou.size)),Bg&&Bg.sources&&((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Measurements] Adding CLS Data"),Bg.sources.forEach((e,n)=>t.setTag(`cls.source.${n+1}`,qv(e.node))))}const l7e=["localhost",/^\//],o4={traceFetch:!0,traceXHR:!0,tracingOrigins:l7e};function c7e(t){const{traceFetch:e,traceXHR:n,tracingOrigins:r,shouldCreateSpanForRequest:i}={...o4,...t},o={},s=c=>{if(o[c])return o[c];const u=r;return o[c]=u.some(f=>Bv(c,f))&&!Bv(c,"sentry_key"),o[c]};let a=s;typeof i=="function"&&(a=c=>s(c)&&i(c));const l={};e&&Ja("fetch",c=>{u7e(c,a,l)}),n&&Ja("xhr",c=>{d7e(c,a,l)})}function u7e(t,e,n){if(!dR()||!(t.fetchData&&e(t.fetchData.url)))return;if(t.endTimestamp){const i=t.fetchData.__span;if(!i)return;const o=n[i];o&&(t.response?o.setHttpStatus(t.response.status):t.error&&o.setStatus("internal_error"),o.finish(),delete n[i]);return}const r=tb();if(r){const i=r.startChild({data:{...t.fetchData,type:"fetch"},description:`${t.fetchData.method} ${t.fetchData.url}`,op:"http.client"});t.fetchData.__span=i.spanId,n[i.spanId]=i;const o=t.args[0];t.args[1]=t.args[1]||{};const s=t.args[1];s.headers=f7e(o,r.getDynamicSamplingContext(),i,s),r.metadata.propagations+=1}}function f7e(t,e,n,r){const i=oee(e),o=n.toTraceparent(),s=typeof Request!="undefined"&&Eu(t,Request)?t.headers:r.headers;if(s)if(typeof Headers!="undefined"&&Eu(s,Headers)){const a=new Headers(s);return a.append("sentry-trace",o),i&&a.append(n8,i),a}else if(Array.isArray(s)){const a=[...s,["sentry-trace",o]];return i&&a.push([n8,i]),a}else{const a="baggage"in s?s.baggage:void 0,l=[];return Array.isArray(a)?l.push(...a):a&&l.push(a),i&&l.push(i),{...s,"sentry-trace":o,baggage:l.length>0?l.join(","):void 0}}else return{"sentry-trace":o,baggage:i}}function d7e(t,e,n){if(!dR()||t.xhr&&t.xhr.__sentry_own_request__||!(t.xhr&&t.xhr.__sentry_xhr__&&e(t.xhr.__sentry_xhr__.url)))return;const r=t.xhr.__sentry_xhr__;if(t.endTimestamp){const o=t.xhr.__sentry_xhr_span_id__;if(!o)return;const s=n[o];s&&(s.setHttpStatus(r.status_code),s.finish(),delete n[o]);return}const i=tb();if(i){const o=i.startChild({data:{...r.data,type:"xhr",method:r.method,url:r.url},description:`${r.method} ${r.url}`,op:"http.client"});if(t.xhr.__sentry_xhr_span_id__=o.spanId,n[t.xhr.__sentry_xhr_span_id__]=o,t.xhr.setRequestHeader)try{t.xhr.setRequestHeader("sentry-trace",o.toTraceparent());const s=i.getDynamicSamplingContext(),a=oee(s);a&&t.xhr.setRequestHeader(n8,a),i.metadata.propagations+=1}catch{}}}function h7e(t,e=!0,n=!0){if(!bt||!bt.location){(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.warn("Could not initialize routing instrumentation due to invalid location");return}let r=bt.location.href,i;e&&(i=t({name:bt.location.pathname,op:"pageload",metadata:{source:"url"}})),n&&Ja("history",({to:o,from:s})=>{if(s===void 0&&r&&r.indexOf(o)!==-1){r=void 0;return}s!==o&&(r=void 0,i&&((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log(`[Tracing] Finishing current transaction with op: ${i.op}`),i.finish()),i=t({name:bt.location.pathname,op:"navigation",metadata:{source:"url"}}))})}const p7e="BrowserTracing",O7e={idleTimeout:xee,finalTimeout:See,heartbeatInterval:wee,markBackgroundTransactions:!0,routingInstrumentation:h7e,startTransactionOnLocationChange:!0,startTransactionOnPageLoad:!0,_experiments:{enableLongTask:!0},...o4};class mR{__init(){this.name=p7e}constructor(e){mR.prototype.__init.call(this);let n=o4.tracingOrigins;e&&(e.tracingOrigins&&Array.isArray(e.tracingOrigins)?n=e.tracingOrigins:(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&(this._emitOptionsWarning=!0)),this.options={...O7e,...e,tracingOrigins:n};const{_metricOptions:r}=this.options;GEe(r&&r._reportAllChanges),h8e([this,"access",i=>i.options,"access",i=>i._experiments,"optionalAccess",i=>i.enableLongTask])&&HEe()}setupOnce(e,n){this._getCurrentHub=n,this._emitOptionsWarning&&((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.warn("[Tracing] You need to define `tracingOrigins` in the options. Set an array of urls or patterns to trace."),(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.warn(`[Tracing] We added a reasonable default for you: ${o4.tracingOrigins}`));const{routingInstrumentation:r,startTransactionOnLocationChange:i,startTransactionOnPageLoad:o,markBackgroundTransactions:s,traceFetch:a,traceXHR:l,tracingOrigins:c,shouldCreateSpanForRequest:u}=this.options;r(f=>this._createRouteTransaction(f),o,i),s&&qEe(),c7e({traceFetch:a,traceXHR:l,tracingOrigins:c,shouldCreateSpanForRequest:u})}_createRouteTransaction(e){if(!this._getCurrentHub){(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.warn(`[Tracing] Did not create ${e.op} transaction because _getCurrentHub is invalid.`);return}const{beforeNavigate:n,idleTimeout:r,finalTimeout:i,heartbeatInterval:o}=this.options,s=e.op==="pageload",a=s?aW("sentry-trace"):null,l=s?aW("baggage"):null,c=a?B8e(a):void 0,u=l?r$e(l):void 0,f={...e,...c,metadata:{...e.metadata,dynamicSamplingContext:c&&!u?{}:u},trimEnd:!0},h=typeof n=="function"?n(f):f,d=h===void 0?{...f,sampled:!1}:h;d.metadata=d.name!==f.name?{...d.metadata,source:"custom"}:d.metadata,d.sampled===!1&&(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log(`[Tracing] Will not send ${d.op} transaction because of beforeNavigate.`),(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log(`[Tracing] Starting ${d.op} transaction on scope`);const O=this._getCurrentHub(),{location:b}=bt,v=DEe(O,d,r,i,!0,{location:b},o);return v.registerBeforeFinishCallback(p=>{t7e(p),p.setTag("sentry_reportAllChanges",Boolean(this.options._metricOptions&&this.options._metricOptions._reportAllChanges))}),v}}function aW(t){const e=i8e(`meta[name=${t}]`);return e?e.getAttribute("content"):null}(typeof __SENTRY_TRACING__=="undefined"||__SENTRY_TRACING__)&&UEe();const m7e=Ph(async()=>(await Promise.resolve().then(function(){return GCe})).FileTree),g7e=Ph(async()=>(await Promise.resolve().then(function(){return Hit})).Editor),v7e=Ph(async()=>(await Promise.resolve().then(function(){return est})).default),y7e=Ph(async()=>(await Promise.resolve().then(function(){return ost})).default),b7e=Ph(async()=>(await Promise.resolve().then(function(){return lst})).default),x7e=Ph(async()=>(await Promise.resolve().then(function(){return Ngt})).default),S7e=Ph(async()=>(await Promise.resolve().then(function(){return Ygt})).default);class w7e{constructor(e){St(this,"components",{Tree:null,Editor:null,Console:null,Browser:null,Shell:null,MarkdownPreview:null});St(this,"paasOptions");St(this,"paasDomainPath");St(this,"sdkVersion");St(this,"isRendered",!1);St(this,"markdownSchema",{});St(this,"socketParser","default");St(this,"i18nLanguage",jS.ZH);St(this,"themeType",YQ.dark);this.sdkVersion=f_e(),this.setPaasOptionsWithDefaultAvatar(e),this.setPaasDomainPathWithDefaultOrigin(e.paasDomain),this.themeType=e.themeType||YQ.dark,this.i18nLanguage=e.i18nLanguage||jS.ZH,this.init(),this.integratedSentry(e.enableSentry)}loadTheme(e){this.themeType=e,Ce.theme.setTheme(this.themeType,Fl.terminal),Ce.theme.setTheme(this.themeType,Fl.console),z_e(this.themeType)}integratedSentry(e=!1){!e||CEe({dsn:"https://7e40a817f13d4730b062e75687903544@o1334791.ingest.sentry.io/4504043835752448",integrations:[new mR],release:"d42paas-front@0.9.97",enabled:!0,environment:"production",tracesSampleRate:.02,beforeSend(n){var o;const r=((o=n==null?void 0:n.exception)==null?void 0:o.values)||[];let i=!0;return r.forEach(s=>{var l;const a=((l=s.stacktrace)==null?void 0:l.frames)||[];if(a.length){const c=a[a.length-1],u=(c==null?void 0:c.filename)||"";i=/daopaas/gi.test(u)}}),i?n:null}})}async init(){var s,a,l,c;this.reset(),this.loadTheme(this.themeType),(s=this.paasOptions.defaultOpenFiles)!=null&&s.length&&Ce.dao.defaultOpenFiles(this.paasOptions.defaultOpenFiles||""),Ce.dao.specialOpenFile(this.paasOptions.specialOpenFile||""),Ce.dao.setXtermStyle(this.paasOptions.xtermStyle),Ce.dao.isOpenDebugMode((a=this.paasOptions.isOpenDebugMode)!=null?a:!1),Ce.i18n.setLanguage(this.i18nLanguage),Qo.changeLanguage(this.i18nLanguage),Ce.dao.setIsLegacyMarkdownMath((c=(l=this.paasOptions)==null?void 0:l.isLegacyMarkdownMath)!=null?c:!1),Mt.debug(`sdk: init with ${this.paasDomainPath} passDomain`);const{url:e,userId:n,socketParser:r}=await d_e(this.paasDomainPath,this.paasOptions.ticket,this.sdkVersion);this.socketParser=r||"default",Ce.dao.openSocketBuffer(this.socketParser==="buffer");let i;try{i=await q4e(n)}catch{}const o=oe.dao.channel().visibilitychange;document.removeEventListener("visibilitychange",o),Ce.dao.reconnectMaxTimes(this.paasOptions.reconnectMaxTimes||10),oe.dao.channel().startChannel(e,{...this.paasOptions,agentUserId:i},{triggerEventForMaxTimespan:this.paasOptions.triggerEventForMaxTimespan,reconnectMaxTimes:this.paasOptions.reconnectMaxTimes,isInsertCrdt:this.paasOptions.isInsertCrdt,sockerParser:this.socketParser}),Mt.info(">>>registerVisiblityChangeEvent"),document.addEventListener("visibilitychange",o)}setPaasOptionsWithDefaultAvatar(e){this.paasOptions=e,this.paasOptions.userInfo.avatarUrl||(this.paasOptions.userInfo.avatarUrl=R9e(this.paasOptions.userInfo.username))}setPaasDomainPathWithDefaultOrigin(e){this.paasDomainPath={}.PAAS_MANAGER_API_ORIGIN||"https://www.1024paas.com",e&&(this.paasDomainPath=e)}reset(){oe.dao.channel().closeChannel(),rTe()}get playgroundStatus(){return oe.dao.playgroundInfo().status}get dockerStatus(){return oe.dao.playgroundInfo().runStatus}get currentAgentUser(){return oe.dao.currentAgentUser()}get agentUsers(){return oe.dao.playgroundInfo().agentUsers}get playgroundInfo(){return oe.dao.playgroundInfo()}get currentFollowingAgentUser(){return oe.dao.getFollowingAgentUser()}followUser(e){const n=oe.dao.playgroundInfo().agentUsers.find(r=>r.agentUserId===e);if(oe.dao.currentAgentUserId()===(n==null?void 0:n.followingAgentUserId)){const r=or("dao_paas_cannot_follow_each_other");ao.error(r);return}oe.dao.channel().followingAgentUser(e),n.fileOpened&&(Ce.file.docLoading(!0),oe.dao.channel().loadFile(n.fileOpened,"follow"))}unFollowUser(){oe.dao.channel().unFollowingAgentUser()}publishKeyEvent(e){oe.dao.channel().publishKeyEvent(e)}preparePlayback(){Ce.dao.setPlaygroundMode($u.playback),oe.dao.channel().getPlaybackInfo()}startPlayback(e){oe.dao.channel().startPlayback(e)}restartPlayback(e){oe.dao.channel().restartPlayback(e)}goToPlayback(e){oe.dao.channel().goToPlayback(e)}pausePlayback(){oe.dao.channel().pausePlayback()}stopPlayback(){Ce.dao.setPlaygroundMode($u.edit),oe.dao.channel().stopPlayback()}setRate(e){oe.dao.channel().setPlaybackRate(e)}activePlayground(){oe.dao.channel().active()}retainingAllFiles(){return oe.dao.channel().retainingAllFiles(),oe.dao.channel().off("retainingAllFiles"),new Promise(e=>{oe.dao.channel().on("retainingAllFiles",n=>{e(n)})})}runPlayground(){return new Promise((e,n)=>{const r=oe.file.pendingUpdateCount();if(r>0)return n(this.handleErrorRes(or("editor_pending_update",{pendingUpdate:r})));oe.dao.channel().run(),e(this.handleSuccessRes("running"))})}stopPlayground(){oe.dao.channel().stop()}appendCustomizeFrameData(e){oe.dao.channel().appendCustomizeFrameData(e)}statisticsPlaybackData(e,n){return new Promise((r,i)=>{if(!oe.dao.isReady())return i(this.handleErrorRes("no ready"));if(!e||!(n!=null&&n.length)){r({status:"fail",message:"please input right parmas",errorCode:"ERROR_PARMAS"});return}oe.dao.channel().statisticsPlaybackData(e,n),oe.dao.channel().off("statisticsPlaybackData"),oe.dao.channel().on("statisticsPlaybackData",o=>{r({status:"success",data:o})})})}onMessage(e){oe.dao.channel().addMessageListener(e)}onError(e){oe.dao.channel().addErrorListener(e)}subscribePlayControlEvent(e){oe.dao.channel().subscribeForPlayControl(e)}unsubscribePlayControlEvent(e){oe.dao.channel().unsubscribeForPlayControl(e)}subscribe(e,n){oe.dao.channel().subscribeForComponent(e,n)}unsubscribe(e,n){oe.dao.channel().unsubscribeForComponent(e,n)}initComponent(e,n,r){const i=document.querySelector(n);if(!i)throw new Error(or("dao_paas_not_find_mount_dom_object_for_x",{x:n}));const o=Vw(i),s=a=>{switch(e){case"Tree":return de(m7e,{...a});case"Editor":return de(g7e,{...a});case"Browser":return de(y7e,{...a});case"Console":return de(v7e,{...a});case"Shell":return de(b7e,{...a});case"MarkdownPreview":return de(x7e,{...a});case"Debug":return de(S7e,{...a});default:throw new Error(or("dao_paas_x_component_is_not_supported",{x:e}))}};this.components[e]={reactComponent:s,container:n,props:r,root:o},o.render(de(M.exports.Suspense,{fallback:de(C9e,{}),children:de(s,{...r})}))}mountMarkdownPreview(){const{MarkdownPreview:e}=this.components;if(Mt.debug("markdown\u9884\u89C8\u7EC4\u4EF6\u6302\u8F7D\u4E2D",this.markdownSchema),e)Mt.debug("\u6302\u8F7D\u5931\u8D25\uFF0C\u8BF7\u52FF\u91CD\u590D\u6302\u8F7D\u540C\u4E00\u4E2A\u7EC4\u4EF6",this.markdownSchema);else if(Object.keys(this.markdownSchema).length>0){const{item:n,container:r,props:i}=this.markdownSchema;this.initComponent(n,r,i),Mt.debug("markdown\u9884\u89C8\u7EC4\u4EF6\u6302\u8F7D\u5B8C\u6210",this.markdownSchema)}}unMountMarkdownPreview(){var n;const{MarkdownPreview:e}=this.components;Mt.debug("markdown\u9884\u89C8\u7EC4\u4EF6\u5378\u8F7D\u4E2D",e),e?((n=e.root)==null||n.unmount(),this.components.MarkdownPreview=null,Mt.debug("markdown\u9884\u89C8\u7EC4\u4EF6\u5378\u8F7D\u6210\u529F",e)):Mt.debug("\u5378\u8F7D\u5931\u8D25\uFF0Cmarkdown\u9884\u89C8\u7EC4\u4EF6\u4E0D\u5B58\u5728",e)}mapRender(e){e.forEach((n,r)=>{const{item:i,container:o,props:s}=n;i==="MarkdownPreview"&&(this.markdownSchema=n,!s.isRender)||this.initComponent(i,o,s)})}handleErrorRes(e){return{status:!1,message:e}}handleSuccessRes(e){return{status:!0,message:e}}insertTextById(e,n,r){oe.dao.channel().insertTextById(e,n,r)}removeAreaTextById(e,n,r){oe.dao.channel().removeAreaTextById(e,n,r)}jumpToAreaById(e,n){oe.dao.channel().jumpToAreaById(e,n)}switchLanguage(e,n,r,i){return new Promise((o,s)=>{if(!oe.dao.isReady())return s(this.handleErrorRes(or("dao_paas_no_ready")));oe.dao.channel().switchLanguage(e,n,r,i),oe.dao.channel().off("switchLanguage"),oe.dao.channel().on("switchLanguage",a=>{const l=oe.file.getOpenedPath(),{destination:c}=a;a.status&&r===l&&(Ce.file.setDocLoading(!0),oe.dao.channel().loadFile(c),o(this.handleSuccessRes(or("common_success")))),o(a)})})}restartServer(){return new Promise((e,n)=>{if(!oe.dao.isReady())return n(this.handleErrorRes(or("dao_paas_no_ready")));oe.dao.channel().restartServer(),oe.dao.channel().off("restartServer"),oe.dao.channel().on("restartServer",r=>{const i={status:r.success,message:r.success?r.message||r.messageId:r.error};e(i)})})}restartLSPServer(){if(!oe.dao.isReady())return this.handleErrorRes(or("dao_paas_no_ready"));oe.dao.channel().restartLSPServer()}addCDNSource(e,n,r){return new Promise((i,o)=>{if(!oe.dao.isReady())return o(this.handleErrorRes(or("dao_paas_no_ready")));oe.dao.channel().addCDNSource(e,n,r),oe.dao.channel().off("addCDNSource"),oe.dao.channel().on("addCDNSource",s=>{const a=oe.file.getOpenedPath();s.status&&r===a&&this.openFile(r),i(s)})})}openFile(e){return new Promise((n,r)=>{if(!oe.dao.isReady())return r(this.handleErrorRes(or("dao_paas_no_ready")));IK(e)?(Ce.file.setDocLoading(!0),oe.dao.channel().loadFile(e),zK(e),n(this.handleSuccessRes(or("common_success")))):r(this.handleErrorRes(or("dao_paas_file_does_not_exist")))})}updateGlobalConfig(e){const n={...oe.dao.globalConfig(),...e};window.localStorage.setItem("paasGlobalConfig",JSON.stringify(n)),Ce.dao.globalConfig(n)}updateConfig(e){const n={...oe.dao.config(),...e};Ce.dao.config(n)}toggleMarkDownPreview(e){e?this.mountMarkdownPreview():this.unMountMarkdownPreview()}reload(e=["Editor","Tree"]){const n={file:()=>{Ce.dao.setPlaygroundInfo(qK),Ce.file.reset()}},r=(e==null?void 0:e.includes("Editor"))||(e==null?void 0:e.includes("Tree"))?"file":"";e&&r&&n[r]()}switchI18nLanguage(e){Ce.i18n.setLanguage(e),oe.dao.channel().emitI18nLanguage(e),Qo.changeLanguage(e)}reloadI18nResources(e,n){try{(Array.isArray(e)?e:[{language:e,resource:n}]).forEach(i=>{Qo.addResources(i.language,"translation",i.resource)}),Qo.changeLanguage(oe.i18n.getLanguage())}catch(r){Mt.error("\u66F4\u65B0\u56FD\u9645\u5316\u6587\u672C\u5931\u8D25\uFF0C\u9519\u8BEF:",r)}}debugRun(){oe.dao.channel().debugRun()}setFileStyle(e){try{Ce.file.setFileStyle(e)}catch(n){Mt.error("\u8BBE\u7F6E\u6587\u4EF6\u6837\u5F0F\u5931\u8D25\uFF0C\u9519\u8BEF:",n)}}syncXtermKey(e){oe.dao.getFollowingAgentUser()||oe.dao.channel().xtermStatus({xtermKey:e})}dispose(){var e;Mt.debug("destroy components...",this.components),this.reset();for(const[n,r]of Object.entries(this.components)){if(!r)break;(e=r.root)==null||e.unmount(),Mt.debug(`destroy unmount: ${r.container}`)}}loggerEnable(){j4e()}}var Qf;(function(t){t.DoubleClickItemToExpand="double-click-item-to-expand",t.ClickItemToExpand="click-item-to-expand",t.ClickArrowToExpand="click-arrow-to-expand"})(Qf||(Qf={}));var s4=globalThis&&globalThis.__assign||function(){return s4=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},s4.apply(this,arguments)},_7e=function(t,e){return{mode:t.mode,createInteractiveElementProps:function(n,r,i,o){return s4(s4({},e.createInteractiveElementProps(n,r,i,o)),t.createInteractiveElementProps(n,r,i,o))}}},gR=function(t){return t.ctrlKey||navigator.platform.toUpperCase().indexOf("MAC")>=0&&t.metaKey},T7e=function(){function t(e){this.mode=Qf.DoubleClickItemToExpand,this.environment=e}return t.prototype.createInteractiveElementProps=function(e,n,r,i){var o=this;return{onClick:function(s){r.focusItem(),s.shiftKey?r.selectUpTo():gR(s)?i.isSelected?r.unselectItem():r.addToSelectedItems():r.selectItem()},onDoubleClick:function(){r.focusItem(),r.selectItem(),e.hasChildren&&r.toggleExpandedState(),(!e.hasChildren||o.environment.canInvokePrimaryActionOnItemContainer)&&r.primaryAction()},onFocus:function(){r.focusItem()},onDragStart:function(s){s.dataTransfer.dropEffect="move",r.startDragging()},onDragOver:function(s){s.preventDefault()},draggable:i.canDrag&&!i.isRenaming,tabIndex:i.isRenaming?void 0:i.isFocused?0:-1}},t}(),k7e=function(){function t(e){this.mode=Qf.ClickItemToExpand,this.environment=e}return t.prototype.createInteractiveElementProps=function(e,n,r,i){var o=this;return{onClick:function(s){r.focusItem(),s.shiftKey?r.selectUpTo():gR(s)?i.isSelected?r.unselectItem():r.addToSelectedItems():(e.hasChildren&&r.toggleExpandedState(),r.selectItem(),(!e.hasChildren||o.environment.canInvokePrimaryActionOnItemContainer)&&r.primaryAction())},onFocus:function(){r.focusItem()},onDragStart:function(s){s.dataTransfer.dropEffect="move",r.startDragging()},onDragOver:function(s){s.preventDefault()},draggable:i.canDrag&&!i.isRenaming,tabIndex:i.isRenaming?void 0:i.isFocused?0:-1}},t}(),P7e=function(){function t(e){this.mode=Qf.ClickItemToExpand,this.environment=e}return t.prototype.createInteractiveElementProps=function(e,n,r,i){var o=this;return{onClick:function(s){r.focusItem(),s.shiftKey?r.selectUpTo():gR(s)?i.isSelected?r.unselectItem():r.addToSelectedItems():(r.selectItem(),(!e.hasChildren||o.environment.canInvokePrimaryActionOnItemContainer)&&r.primaryAction())},onFocus:function(){r.focusItem()},onDragStart:function(s){s.dataTransfer.dropEffect="move",r.startDragging()},onDragOver:function(s){s.preventDefault()},draggable:i.canDrag&&!i.isRenaming,tabIndex:i.isRenaming?void 0:i.isFocused?0:-1}},t}(),lW=function(t,e){switch(t){case Qf.DoubleClickItemToExpand:return new T7e(e);case Qf.ClickItemToExpand:return new k7e(e);case Qf.ClickArrowToExpand:return new P7e(e);default:throw Error("Unknown interaction mode "+t)}},kee=M.exports.createContext(null),Q7e=function(){return M.exports.useContext(kee)},$7e=function(t){var e=xi(),n=e.defaultInteractionMode,r=M.exports.useMemo(function(){var i;return n&&typeof n!="string"?n.extends?_7e(n,lW(n.extends,e)):n:lW((i=n)!==null&&i!==void 0?i:Qf.ClickItemToExpand,e)},[]);return M.exports.createElement(kee.Provider,{value:r},t.children)},Pee=function(){var t=xi();return M.exports.useCallback(function(e,n){for(var r=t.linearItems[n],i=r[e].depth,o=e;!!r[o]&&r[o].depth!==i-1;o--);var s=r[o];return s||(s={item:t.trees[n].rootItem,depth:0},o=0),s},[t.linearItems,t.trees])},E7e=function(t,e){return t.clientX<e.left||t.clientX>e.right||t.clientY<e.top||t.clientY>e.bottom},C7e=function(t,e,n,r,i){var o=(t-e)/n,s=Math.floor(o),a=void 0,l=r||i?.2:.5;return o%1<l?a="top":o%1>1-l&&(a="bottom"),{linearIndex:s,offset:a}},R7e=function(t,e,n,r,i){var o=xi(),s=o.canDropOnItemWithChildren,a=o.canDropOnItemWithoutChildren,l=o.canDragAndDrop,c=o.linearItems,u=o.items,f=o.canReorderItems,h=o.viewState,d=Pee();return M.exports.useCallback(function(O,b,v){var p,g,y,S;if(!!l&&!!v.current&&!(O.clientX<0||O.clientY<0)){var w=v.current.getBoundingClientRect(),T=E7e(O,w),k=C7e(O.clientY,w.top,n,s,a),A=k.linearIndex,L=k.offset,$=T?"outside":""+b+A+(L!=null?L:"");if(t!==$){if(e($),T){r(void 0);return}if(A<0||A>=c[b].length){r(void 0);return}var E=c[b][A],C=E.depth,I=u[E.item];if(!L&&!a&&!I.hasChildren){r(void 0);return}if(!L&&!s&&I.hasChildren){r(void 0);return}if(L&&!f){r(void 0);return}var H=d(A,b);if(!(!((g=(p=h[b])===null||p===void 0?void 0:p.selectedItems)===null||g===void 0)&&g.includes(E.item))){var Y=u[H.item].children.indexOf(E.item)+(L==="top"?0:1);L==="top"&&C===((S=(y=c[b][A-1])===null||y===void 0?void 0:y.depth)!==null&&S!==void 0?S:-1)&&(L="bottom",A-=1);var z;L?z={targetType:"between-items",treeId:b,parentItem:H.item,depth:E.depth,linearIndex:A+(L==="top"?0:1),childIndex:Y,linePosition:L}:z={targetType:"item",treeId:b,parentItem:H.item,targetItem:E.item,depth:E.depth,linearIndex:A},i(z)}}}},[l,s,a,f,d,n,u,t,c,r,i,e,h])},Qee=function(){var t=xi();return M.exports.useCallback(function(e,n){if(e.targetType==="between-items"){if(!t.canReorderItems)return!1}else{var r=t.items[e.targetItem];if(!t.canDropOnItemWithChildren&&r.hasChildren||!t.canDropOnItemWithoutChildren&&!r.hasChildren)return!1}return!(t.canDropAt&&(!n||!t.canDropAt(n,e)))},[t])},cW=globalThis&&globalThis.__spreadArray||function(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t},A7e=function(){var t=xi(),e=Pee(),n=Qee();return M.exports.useCallback(function(r,i){var o=t.linearItems[r];return o.map(function(s,a){var l,c,u=s.item,f=s.depth,h=e(a,r),d=t.items[h.item].children.indexOf(u),O={targetType:"item",parentItem:h.item,targetItem:u,linearIndex:a,depth:f,treeId:r},b={targetType:"between-items",parentItem:h.item,linePosition:"top",childIndex:d,depth:f,treeId:r,linearIndex:a},v={targetType:"between-items",parentItem:h.item,linePosition:"bottom",linearIndex:a+1,childIndex:d+1,depth:f,treeId:r},p=f===((c=(l=o[a-1])===null||l===void 0?void 0:l.depth)!==null&&c!==void 0?c:-1);return p?[O,v]:[b,O,v]}).reduce(function(s,a){return cW(cW([],s),a)},[]).filter(function(s){return n(s,i)})},[n,t.items,t.linearItems,e])},V5=globalThis&&globalThis.__spreadArray||function(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t},a4=function(t,e,n){var r=M.exports.useRef();M.exports.useEffect(function(){if(!r.current)r.current=V5([],n),t();else{var i=r.current.some(function(o,s){return o!==n[s]});i&&(r.current=V5([],n),t())}},V5(V5([],e),n))},l4=globalThis&&globalThis.__assign||function(){return l4=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},l4.apply(this,arguments)},$ee=function(t,e){return t.map(function(n){return[n,e(n)]}).reduce(function(n,r){var i,o=r[0],s=r[1];return l4(l4({},n),(i={},i[o]=s,i))},{})};function Z0(){var t=M.exports.useRef(new Array);M.exports.useEffect(function(){var n=t.current;return function(){return n.forEach(function(r){return cancelAnimationFrame(r)})}},[t]);var e=M.exports.useCallback(function(n){var r=requestAnimationFrame(function(){t.current.splice(t.current.indexOf(r),1),n()});t.current.push(r)},[t]);return e}var Eee=M.exports.createContext(null),Lu=function(){return M.exports.useContext(Eee)},I7e=function(t){var e=xi(),n=M.exports.useState(!1),r=n[0],i=n[1],o=M.exports.useState(4),s=o[0],a=o[1],l=M.exports.useState({}),c=l[0],u=l[1],f=M.exports.useState(0),h=f[0],d=f[1],O=M.exports.useState(),b=O[0],v=O[1],p=M.exports.useState(),g=p[0],y=p[1],S=M.exports.useState("_nodrag"),w=S[0],T=S[1],k=A7e(),A=Z0();M.exports.useRef(!1);var L=M.exports.useCallback(function(re,Te){var Re;if(e.activeTreeId&&((Re=e.viewState[e.activeTreeId])===null||Re===void 0?void 0:Re.focusedItem)&&e.linearItems&&Te){var V=e.viewState[e.activeTreeId].focusedItem,pe=k(e.activeTreeId,Te),J=pe.findIndex(function(ae){if(ae.targetType==="item")return ae.targetItem===V;if(ae.targetType==="between-items")return e.items[ae.parentItem].children[ae.childIndex]===V});d(J?Math.min(J+1,pe.length-1):0)}else d(0)},[e.activeTreeId,e.items,e.linearItems,e.viewState,k]),$=M.exports.useCallback(function(){i(!1),a(4),u({}),d(0),v(void 0),y(void 0),T("_nodrag")},[]);a4(function(){e.activeTreeId&&e.linearItems[e.activeTreeId]&&c[e.activeTreeId]&&L(c[e.activeTreeId],b)},[b,e.activeTreeId,e.linearItems,L,c],[e.activeTreeId]),a4(function(){r&&e.activeTreeId&&y(c[e.activeTreeId][h])},[h,e.activeTreeId,r,c],[h,e.activeTreeId]);var E=Qee(),C=function(re){var Te;b&&!E(re,b)||(y(re),e.setActiveTree(re.treeId),b&&e.activeTreeId!==re.treeId&&((Te=e.onSelectItems)===null||Te===void 0||Te.call(e,b.map(function(Re){return Re.index}),re.treeId)))},I=R7e(w,T,s,y,C),H=M.exports.useCallback(function(){b&&g&&e.onDrop&&(e.onDrop(b,g),A(function(){var re;(re=e.onFocusItem)===null||re===void 0||re.call(e,b[0],g.treeId),$()}))},[b,g,e,$,A]),Y=M.exports.useCallback(function(re,Te){var Re,V,pe=$ee(e.treeIds,function(ae){return k(ae,re)}),J=(V=(Re=document.querySelector('[data-rct-tree="'+Te+'"] [data-rct-item-container="true"]'))===null||Re===void 0?void 0:Re.offsetHeight)!==null&&V!==void 0?V:5;a(J),v(re),u(pe),e.activeTreeId&&L(pe[e.activeTreeId],re)},[e.activeTreeId,e.treeIds,k,L]),z=M.exports.useCallback(function(){var re,Te,Re;if(!!e.canDragAndDrop&&e.activeTreeId){var V=(Te=(re=e.viewState[e.activeTreeId])===null||re===void 0?void 0:re.selectedItems)!==null&&Te!==void 0?Te:[(Re=e.viewState[e.activeTreeId])===null||Re===void 0?void 0:Re.focusedItem];if(V.length===0||V[0]===void 0)return;var pe=V.map(function(J){return e.items[J]});if(e.canDrag&&!e.canDrag(pe))return;Y(pe,e.activeTreeId),setTimeout(function(){i(!0)})}},[Y,e]),U=M.exports.useCallback(function(){$()},[$]),j=M.exports.useCallback(function(){H(),$()},[H,$]),K=M.exports.useCallback(function(){d(function(re){return Math.max(0,re-1)})},[]),se=M.exports.useCallback(function(){e.activeTreeId&&d(function(re){return Math.min(c[e.activeTreeId].length,re+1)})},[e.activeTreeId,c]),G={onStartDraggingItems:Y,startProgrammaticDrag:z,abortProgrammaticDrag:U,completeProgrammaticDrag:j,programmaticDragUp:K,programmaticDragDown:se,draggingItems:b,draggingPosition:g,itemHeight:s,isProgrammaticallyDragging:r,onDragOverTreeHandler:I,viableDragPositions:c};return M.exports.useEffect(function(){return window.addEventListener("dragend",$),window.addEventListener("drop",H),function(){window.removeEventListener("dragend",$),window.removeEventListener("drop",H)}},[H,$]),M.exports.createElement(Eee.Provider,{value:G},t.children)},Yg=globalThis&&globalThis.__assign||function(){return Yg=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},Yg.apply(this,arguments)},z7e=function(t,e){var n=xi(),r=Lu();M.exports.useImperativeHandle(t,function(){return Yg(Yg(Yg({},e),n),{treeEnvironmentContext:n,dragAndDropContext:r})})},uW=globalThis&&globalThis.__spreadArray||function(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t},Cee=M.exports.createContext(null),L7e=function(){return M.exports.useContext(Cee)},N7e=M.exports.forwardRef(function(t,e){var n=xi(),r=n.onCollapseItem,i=n.items;n.trees;var o=n.viewState,s=n.onExpandItem,a=n.onFocusItem,l=n.setActiveTree,c=n.onRenameItem,u=n.onSelectItems,f=n.onPrimaryAction,h=n.linearItems,d=Lu(),O=d.abortProgrammaticDrag,b=d.completeProgrammaticDrag,v=d.programmaticDragDown,p=d.programmaticDragUp,g=d.startProgrammaticDrag,y={abortProgrammaticDrag:M.exports.useCallback(function(){O()},[O]),collapseItem:M.exports.useCallback(function(S,w){r==null||r(i[S],w)},[i,r]),completeProgrammaticDrag:M.exports.useCallback(function(){b()},[b]),expandItem:M.exports.useCallback(function(S,w){s==null||s(i[S],w)},[i,s]),focusItem:M.exports.useCallback(function(S,w){a==null||a(i[S],w)},[i,a]),focusTree:M.exports.useCallback(function(S,w){w===void 0&&(w=!0),l(S,w)},[l]),moveFocusDown:M.exports.useCallback(function(S){var w=h[S],T=w.findIndex(function(L){var $,E=L.item;return E===(($=o[S])===null||$===void 0?void 0:$.focusedItem)}),k=T!==void 0?Math.min(w.length-1,T+1):0,A=i[w[k].item];a==null||a(A,S)},[i,h,a,o]),moveFocusUp:M.exports.useCallback(function(S){var w=h[S],T=w.findIndex(function(L){var $,E=L.item;return E===(($=o[S])===null||$===void 0?void 0:$.focusedItem)}),k=T!==void 0?Math.max(0,T-1):0,A=i[w[k].item];a==null||a(A,S)},[i,h,a,o]),moveProgrammaticDragPositionDown:M.exports.useCallback(function(){v()},[v]),moveProgrammaticDragPositionUp:M.exports.useCallback(function(){p()},[p]),renameItem:M.exports.useCallback(function(S,w,T){c==null||c(i[S],w,T)},[i,c]),selectItems:M.exports.useCallback(function(S,w){u==null||u(S,w)},[u]),startProgrammaticDrag:M.exports.useCallback(function(){g()},[g]),toggleItemExpandedState:M.exports.useCallback(function(S,w){var T,k;!((k=(T=o[w])===null||T===void 0?void 0:T.expandedItems)===null||k===void 0)&&k.includes(S)?r==null||r(i[S],w):s==null||s(i[S],w)},[i,r,s,o]),toggleItemSelectStatus:M.exports.useCallback(function(S,w){var T,k,A,L,$;!((k=(T=o[w])===null||T===void 0?void 0:T.selectedItems)===null||k===void 0)&&k.includes(S)?u==null||u((L=(A=o[w].selectedItems)===null||A===void 0?void 0:A.filter(function(E){return E!==S}))!==null&&L!==void 0?L:[],w):u==null||u(uW(uW([],($=o[w].selectedItems)!==null&&$!==void 0?$:[]),[S]),w)},[u,o]),invokePrimaryAction:M.exports.useCallback(function(S,w){f==null||f(i[S],w)},[i,f])};return z7e(e,y),M.exports.createElement(Cee.Provider,{value:y},t.children)}),M7e=function(t){if(!!t)if(t.scrollIntoViewIfNeeded)t.scrollIntoViewIfNeeded();else{var e=t.getBoundingClientRect(),n=e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth);n||t.scrollIntoView()}},Za=globalThis&&globalThis.__assign||function(){return Za=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},Za.apply(this,arguments)},cd=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.filter(function(n){return!!n}).join(" ")},D7e=function(t){return{renderItemTitle:function(e){var n=e.title,r=e.context,i=e.info;if(!i.isSearching||!r.isSearchMatching)return Xt.createElement(Xt.Fragment,null,n);var o=n.toLowerCase().indexOf(i.search.toLowerCase());return Xt.createElement(Xt.Fragment,null,o>0&&Xt.createElement("span",null,n.slice(0,o)),Xt.createElement("span",{className:"rct-tree-item-search-highlight"},n.slice(o,o+i.search.length)),o+i.search.length<n.length&&Xt.createElement("span",null,n.slice(o+i.search.length,n.length)))},renderItemArrow:function(e){var n=e.item,r=e.context;return Xt.createElement("div",Za({className:cd(n.hasChildren&&"rct-tree-item-arrow-hasChildren","rct-tree-item-arrow")},r.arrowProps),n.hasChildren&&(r.isExpanded?Xt.createElement("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 16 16",enableBackground:"new 0 0 16 16",xmlSpace:"preserve"},Xt.createElement("g",null,Xt.createElement("g",null,Xt.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:`M12,5c-0.28,0-0.53,0.11-0.71,0.29L8,8.59L4.71,5.29C4.53,5.11,4.28,5,4,5
|
|
482
|
+
Url: ${i4(t)}`),!0)}function E$e(t,e){return!e||!e.length?!1:A$e(t).some(n=>e.some(r=>Bv(n,r)))}function C$e(t,e){if(!e||!e.length)return!1;const n=i4(t);return n?e.some(r=>Bv(n,r)):!1}function R$e(t,e){if(!e||!e.length)return!0;const n=i4(t);return n?e.some(r=>Bv(n,r)):!0}function A$e(t){if(t.message)return[t.message];if(t.exception)try{const{type:e="",value:n=""}=t.exception.values&&t.exception.values[0]||{};return[`${n}`,`${e}: ${n}`]}catch{return(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.error(`Cannot extract message for event ${mp(t)}`),[]}return[]}function I$e(t){try{return t.exception.values[0].type==="SentryError"}catch{}return!1}function z$e(t=[]){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n&&n.filename!=="<anonymous>"&&n.filename!=="[native code]")return n.filename||null}return null}function i4(t){try{let e;try{e=t.exception.values[0].stacktrace.frames}catch{}return e?z$e(e):null}catch{return(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.error(`Cannot extract url for event ${mp(t)}`),null}}function fee(t,e){const n=cR(t,e),r={type:e&&e.name,value:D$e(e)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===""&&(r.value="Unrecoverable error caught"),r}function L$e(t,e,n,r){const o=co().getClient(),s=o&&o.getOptions().normalizeDepth,a={exception:{values:[{type:JC(e)?e.constructor.name:r?"UnhandledRejection":"Error",value:`Non-Error ${r?"promise rejection":"exception"} captured with keys: ${d8e(e)}`}]},extra:{__serialized__:nee(e,s)}};if(n){const l=cR(t,n);l.length&&(a.exception.values[0].stacktrace={frames:l})}return a}function sP(t,e){return{exception:{values:[fee(t,e)]}}}function cR(t,e){const n=e.stacktrace||e.stack||"",r=M$e(e);try{return t(n,r)}catch{}return[]}const N$e=/Minified React error #\d+;/i;function M$e(t){if(t){if(typeof t.framesToPop=="number")return t.framesToPop;if(N$e.test(t.message))return 1}return 0}function D$e(t){const e=t&&t.message;return e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function X$e(t,e,n,r){const i=n&&n.syntheticException||void 0,o=uR(t,e,i,r);return Yv(o),o.level="error",n&&n.event_id&&(o.event_id=n.event_id),Mp(o)}function W$e(t,e,n="info",r,i){const o=r&&r.syntheticException||void 0,s=r8(t,e,o,i);return s.level=n,r&&r.event_id&&(s.event_id=r.event_id),Mp(s)}function uR(t,e,n,r,i){let o;if(YJ(e)&&e.error)return sP(t,e.error);if(LX(e)||KQe(e)){const s=e;if("stack"in e)o=sP(t,e);else{const a=s.name||(LX(s)?"DOMError":"DOMException"),l=s.message?`${a}: ${s.message}`:a;o=r8(t,l,n,r),HQ(o,l)}return"code"in s&&(o.tags={...o.tags,"DOMException.code":`${s.code}`}),o}return BJ(e)?sP(t,e):n0(e)||JC(e)?(o=L$e(t,e,n,i),Yv(o,{synthetic:!0}),o):(o=r8(t,e,n,r),HQ(o,`${e}`,void 0),Yv(o,{synthetic:!0}),o)}function r8(t,e,n,r){const i={message:e};if(r&&n){const o=cR(t,n);o.length&&(i.exception={values:[{value:e,stacktrace:{frames:o}}]})}return i}const dee="Breadcrumbs";class Vv{static __initStatic(){this.id=dee}__init(){this.name=Vv.id}constructor(e){Vv.prototype.__init.call(this),this.options={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e}}setupOnce(){this.options.console&&Ja("console",q$e),this.options.dom&&Ja("dom",U$e(this.options.dom)),this.options.xhr&&Ja("xhr",B$e),this.options.fetch&&Ja("fetch",Y$e),this.options.history&&Ja("history",F$e)}}Vv.__initStatic();function U$e(t){function e(n){let r,i=typeof t=="object"?t.serializeAttribute:void 0;typeof i=="string"&&(i=[i]);try{r=n.event.target?qv(n.event.target,i):qv(n.event,i)}catch{r="<unknown>"}r.length!==0&&co().addBreadcrumb({category:`ui.${n.name}`,message:r},{event:n.event,name:n.name,global:n.global})}return e}function q$e(t){const e={category:"console",data:{arguments:t.args,logger:"console"},level:X8e(t.level),message:MX(t.args," ")};if(t.level==="assert")if(t.args[0]===!1)e.message=`Assertion failed: ${MX(t.args.slice(1)," ")||"console.assert"}`,e.data.arguments=t.args.slice(1);else return;co().addBreadcrumb(e,{input:t.args,level:t.level})}function B$e(t){if(t.endTimestamp){if(t.xhr.__sentry_own_request__)return;const{method:e,url:n,status_code:r,body:i}=t.xhr.__sentry_xhr__||{};co().addBreadcrumb({category:"xhr",data:{method:e,url:n,status_code:r},type:"http"},{xhr:t.xhr,input:i});return}}function Y$e(t){!t.endTimestamp||t.fetchData.url.match(/sentry_key/)&&t.fetchData.method==="POST"||(t.error?co().addBreadcrumb({category:"fetch",data:t.fetchData,level:"error",type:"http"},{data:t.error,input:t.args}):co().addBreadcrumb({category:"fetch",data:{...t.fetchData,status_code:t.response.status},type:"http"},{input:t.args,response:t.response}))}function F$e(t){let e=t.from,n=t.to;const r=iP(bt.location.href);let i=iP(e);const o=iP(n);i.path||(i=r),r.protocol===o.protocol&&r.host===o.host&&(n=o.relative),r.protocol===i.protocol&&r.host===i.host&&(e=i.relative),co().addBreadcrumb({category:"navigation",data:{from:e,to:n}})}class j$e extends d1{constructor(e){e._metadata=e._metadata||{},e._metadata.sdk=e._metadata.sdk||{name:"sentry.javascript.browser",packages:[{name:"npm:@sentry/browser",version:HX}],version:HX},super(e),e.sendClientReports&&bt.document&&bt.document.addEventListener("visibilitychange",()=>{bt.document.visibilityState==="hidden"&&this._flushOutcomes()})}eventFromException(e,n){return X$e(this._options.stackParser,e,n,this._options.attachStacktrace)}eventFromMessage(e,n="info",r){return W$e(this._options.stackParser,e,n,r,this._options.attachStacktrace)}sendEvent(e,n){const r=this.getIntegrationById(dee);r&&r.options&&r.options.sentry&&co().addBreadcrumb({category:`sentry.${e.type==="transaction"?"transaction":"event"}`,event_id:e.event_id,level:e.level,message:mp(e)},{event:e}),super.sendEvent(e,n)}_prepareEvent(e,n,r){return e.platform=e.platform||"javascript",super._prepareEvent(e,n,r)}_flushOutcomes(){const e=this._clearOutcomes();if(e.length===0){(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("No outcomes to send");return}if(!this._dsn){(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("No dsn provided, will not send outcomes");return}(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("Sending outcomes:",e);const n=lee(this._dsn,this._options),r=V8e(e,this._options.tunnel&&nR(this._dsn));try{Object.prototype.toString.call(bt&&bt.navigator)==="[object Navigator]"&&typeof bt.navigator.sendBeacon=="function"&&!this._options.transportOptions?bt.navigator.sendBeacon.bind(bt.navigator)(n,ree(r)):this._sendEnvelope(r)}catch(i){(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.error(i)}}}let j5;function Z$e(){if(j5)return j5;if(GQ(bt.fetch))return j5=bt.fetch.bind(bt);const t=bt.document;let e=bt.fetch;if(t&&typeof t.createElement=="function")try{const n=t.createElement("iframe");n.hidden=!0,t.head.appendChild(n);const r=n.contentWindow;r&&r.fetch&&(e=r.fetch),t.head.removeChild(n)}catch(n){(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",n)}return j5=e.bind(bt)}function V$e(t,e=Z$e()){function n(r){const i={body:r.body,method:"POST",referrerPolicy:"origin",headers:t.headers,keepalive:r.body.length<=65536,...t.fetchOptions};return e(t.url,i).then(o=>({statusCode:o.status,headers:{"x-sentry-rate-limits":o.headers.get("X-Sentry-Rate-Limits"),"retry-after":o.headers.get("Retry-After")}}))}return uee(t,n)}const G$e=4;function H$e(t){function e(n){return new ea((r,i)=>{const o=new XMLHttpRequest;o.onerror=i,o.onreadystatechange=()=>{o.readyState===G$e&&r({statusCode:o.status,headers:{"x-sentry-rate-limits":o.getResponseHeader("X-Sentry-Rate-Limits"),"retry-after":o.getResponseHeader("Retry-After")}})},o.open("POST",t.url);for(const s in t.headers)Object.prototype.hasOwnProperty.call(t.headers,s)&&o.setRequestHeader(s,t.headers[s]);o.send(n.body)})}return uee(t,e)}const k_="?",K$e=30,J$e=40,eEe=50;function fR(t,e,n,r){const i={filename:t,function:e,in_app:!0};return n!==void 0&&(i.lineno=n),r!==void 0&&(i.colno=r),i}const tEe=/^\s*at (?:(.*\).*?|.*?) ?\((?:address at )?)?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,nEe=/\((\S*)(?::(\d+))(?::(\d+))\)/,rEe=t=>{const e=tEe.exec(t);if(e){if(e[2]&&e[2].indexOf("eval")===0){const o=nEe.exec(e[2]);o&&(e[2]=o[1],e[3]=o[2],e[4]=o[3])}const[r,i]=hee(e[1]||k_,e[2]);return fR(i,r,e[3]?+e[3]:void 0,e[4]?+e[4]:void 0)}},iEe=[K$e,rEe],oEe=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension|safari-extension|safari-web-extension|capacitor)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,sEe=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,aEe=t=>{const e=oEe.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const o=sEe.exec(e[3]);o&&(e[1]=e[1]||"eval",e[3]=o[1],e[4]=o[2],e[5]="")}let r=e[3],i=e[1]||k_;return[i,r]=hee(i,r),fR(r,i,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},lEe=[eEe,aEe],cEe=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,uEe=t=>{const e=cEe.exec(t);return e?fR(e[2],e[1]||k_,+e[3],e[4]?+e[4]:void 0):void 0},fEe=[J$e,uEe],dEe=[iEe,lEe,fEe],hEe=KJ(...dEe),hee=(t,e)=>{const n=t.indexOf("safari-extension")!==-1,r=t.indexOf("safari-web-extension")!==-1;return n||r?[t.indexOf("@")!==-1?t.split("@")[0]:k_,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]};let i8=0;function pee(){return i8>0}function pEe(){i8+=1,setTimeout(()=>{i8-=1})}function i0(t,e={},n){if(typeof t!="function")return t;try{const i=t.__sentry_wrapped__;if(i)return i;if(iR(t))return t}catch{return t}const r=function(){const i=Array.prototype.slice.call(arguments);try{n&&typeof n=="function"&&n.apply(this,arguments);const o=i.map(s=>i0(s,e));return t.apply(this,o)}catch(o){throw pEe(),d$e(s=>{s.addEventProcessor(a=>(e.mechanism&&(HQ(a,void 0,void 0),Yv(a,e.mechanism)),a.extra={...a.extra,arguments:i},a)),f$e(o)}),o}};try{for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i])}catch{}GJ(r,t),rR(t,"__sentry_wrapped__",r);try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get(){return t.name}})}catch{}return r}class oh{static __initStatic(){this.id="GlobalHandlers"}__init(){this.name=oh.id}__init2(){this._installFunc={onerror:OEe,onunhandledrejection:mEe}}constructor(e){oh.prototype.__init.call(this),oh.prototype.__init2.call(this),this._options={onerror:!0,onunhandledrejection:!0,...e}}setupOnce(){Error.stackTraceLimit=50;const e=this._options;for(const n in e){const r=this._installFunc[n];r&&e[n]&&(yEe(n),r(),this._installFunc[n]=void 0)}}}oh.__initStatic();function OEe(){Ja("error",t=>{const[e,n,r]=gee();if(!e.getIntegration(oh))return;const{msg:i,url:o,line:s,column:a,error:l}=t;if(pee()||l&&l.__sentry_own_request__)return;const c=l===void 0&&Np(i)?vEe(i,o,s,a):Oee(uR(n,l||i,void 0,r,!1),o,s,a);c.level="error",mee(e,l,c,"onerror")})}function mEe(){Ja("unhandledrejection",t=>{const[e,n,r]=gee();if(!e.getIntegration(oh))return;let i=t;try{"reason"in t?i=t.reason:"detail"in t&&"reason"in t.detail&&(i=t.detail.reason)}catch{}if(pee()||i&&i.__sentry_own_request__)return!0;const o=FJ(i)?gEe(i):uR(n,i,void 0,r,!0);o.level="error",mee(e,i,o,"onunhandledrejection")})}function gEe(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function vEe(t,e,n,r){const i=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;let o=YJ(t)?t.message:t,s="Error";const a=o.match(i);return a&&(s=a[1],o=a[2]),Oee({exception:{values:[{type:s,value:o}]}},e,n,r)}function Oee(t,e,n,r){const i=t.exception=t.exception||{},o=i.values=i.values||[],s=o[0]=o[0]||{},a=s.stacktrace=s.stacktrace||{},l=a.frames=a.frames||[],c=isNaN(parseInt(r,10))?void 0:r,u=isNaN(parseInt(n,10))?void 0:n,f=Np(e)&&e.length>0?e:r8e();return l.length===0&&l.push({colno:c,filename:f,function:"?",in_app:!0,lineno:u}),t}function yEe(t){(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log(`Global Handler attached: ${t}`)}function mee(t,e,n,r){Yv(n,{handled:!1,type:r}),t.captureEvent(n,{originalException:e})}function gee(){const t=co(),e=t.getClient(),n=e&&e.getOptions()||{stackParser:()=>[],attachStacktrace:!1};return[t,n.stackParser,n.attachStacktrace]}const bEe=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"];class Gv{static __initStatic(){this.id="TryCatch"}__init(){this.name=Gv.id}constructor(e){Gv.prototype.__init.call(this),this._options={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...e}}setupOnce(){this._options.setTimeout&&Us(bt,"setTimeout",JX),this._options.setInterval&&Us(bt,"setInterval",JX),this._options.requestAnimationFrame&&Us(bt,"requestAnimationFrame",xEe),this._options.XMLHttpRequest&&"XMLHttpRequest"in bt&&Us(XMLHttpRequest.prototype,"send",SEe);const e=this._options.eventTarget;e&&(Array.isArray(e)?e:bEe).forEach(wEe)}}Gv.__initStatic();function JX(t){return function(...e){const n=e[0];return e[0]=i0(n,{mechanism:{data:{function:hh(t)},handled:!0,type:"instrument"}}),t.apply(this,e)}}function xEe(t){return function(e){return t.apply(this,[i0(e,{mechanism:{data:{function:"requestAnimationFrame",handler:hh(t)},handled:!0,type:"instrument"}})])}}function SEe(t){return function(...e){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(i=>{i in n&&typeof n[i]=="function"&&Us(n,i,function(o){const s={mechanism:{data:{function:i,handler:hh(o)},handled:!0,type:"instrument"}},a=iR(o);return a&&(s.mechanism.data.handler=hh(a)),i0(o,s)})}),t.apply(this,e)}}function wEe(t){const e=bt,n=e[t]&&e[t].prototype;!n||!n.hasOwnProperty||!n.hasOwnProperty("addEventListener")||(Us(n,"addEventListener",function(r){return function(i,o,s){try{typeof o.handleEvent=="function"&&(o.handleEvent=i0(o.handleEvent,{mechanism:{data:{function:"handleEvent",handler:hh(o),target:t},handled:!0,type:"instrument"}}))}catch{}return r.apply(this,[i,i0(o,{mechanism:{data:{function:"addEventListener",handler:hh(o),target:t},handled:!0,type:"instrument"}}),s])}}),Us(n,"removeEventListener",function(r){return function(i,o,s){const a=o;try{const l=a&&a.__sentry_wrapped__;l&&r.call(this,i,l,s)}catch{}return r.call(this,i,a,s)}}))}const _Ee="cause",TEe=5;class $1{static __initStatic(){this.id="LinkedErrors"}__init(){this.name=$1.id}constructor(e={}){$1.prototype.__init.call(this),this._key=e.key||_Ee,this._limit=e.limit||TEe}setupOnce(){const e=co().getClient();!e||sR((n,r)=>{const i=co().getIntegration($1);return i?kEe(e.getOptions().stackParser,i._key,i._limit,n,r):n})}}$1.__initStatic();function kEe(t,e,n,r,i){if(!r.exception||!r.exception.values||!i||!Eu(i.originalException,Error))return r;const o=vee(t,n,i.originalException,e);return r.exception.values=[...o,...r.exception.values],r}function vee(t,e,n,r,i=[]){if(!Eu(n[r],Error)||i.length+1>=e)return i;const o=fee(t,n[r]);return vee(t,e,n[r],r,[o,...i])}class E1{constructor(){E1.prototype.__init.call(this)}static __initStatic(){this.id="HttpContext"}__init(){this.name=E1.id}setupOnce(){sR(e=>{if(co().getIntegration(E1)){if(!bt.navigator&&!bt.location&&!bt.document)return e;const n=e.request&&e.request.url||bt.location&&bt.location.href,{referrer:r}=bt.document||{},{userAgent:i}=bt.navigator||{},o={...e.request&&e.request.headers,...r&&{Referer:r},...i&&{"User-Agent":i}},s={...n&&{url:n},headers:o};return{...e,request:s}}return e})}}E1.__initStatic();class C1{constructor(){C1.prototype.__init.call(this)}static __initStatic(){this.id="Dedupe"}__init(){this.name=C1.id}setupOnce(e,n){const r=i=>{const o=n().getIntegration(C1);if(o){try{if(PEe(i,o._previousEvent))return(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{return o._previousEvent=i}return o._previousEvent=i}return i};r.id=this.name,e(r)}}C1.__initStatic();function PEe(t,e){return e?!!(QEe(t,e)||$Ee(t,e)):!1}function QEe(t,e){const n=t.message,r=e.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!bee(t,e)||!yee(t,e))}function $Ee(t,e){const n=eW(e),r=eW(t);return!(!n||!r||n.type!==r.type||n.value!==r.value||!bee(t,e)||!yee(t,e))}function yee(t,e){let n=tW(t),r=tW(e);if(!n&&!r)return!0;if(n&&!r||!n&&r||(n=n,r=r,r.length!==n.length))return!1;for(let i=0;i<r.length;i++){const o=r[i],s=n[i];if(o.filename!==s.filename||o.lineno!==s.lineno||o.colno!==s.colno||o.function!==s.function)return!1}return!0}function bee(t,e){let n=t.fingerprint,r=e.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;n=n,r=r;try{return n.join("")===r.join("")}catch{return!1}}function eW(t){return t.exception&&t.exception.values&&t.exception.values[0]}function tW(t){const e=t.exception;if(e)try{return e.values[0].stacktrace.frames}catch{return}}const EEe=[new Q1,new Zv,new Gv,new Vv,new oh,new $1,new C1,new E1];function CEe(t={}){t.defaultIntegrations===void 0&&(t.defaultIntegrations=EEe),t.release===void 0&&bt.SENTRY_RELEASE&&bt.SENTRY_RELEASE.id&&(t.release=bt.SENTRY_RELEASE.id),t.autoSessionTracking===void 0&&(t.autoSessionTracking=!0),t.sendClientReports===void 0&&(t.sendClientReports=!0);const e={...t,stackParser:O8e(t.stackParser||hEe),integrations:S$e(t),transport:t.transport||(JJ()?V$e:H$e)};T$e(j$e,e),t.autoSessionTracking&&REe()}function nW(t){t.startSession({ignoreDuration:!0}),t.captureSession()}function REe(){if(typeof bt.document=="undefined"){(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.warn("Session tracking in non-browser environment with @sentry/browser is not supported.");return}const t=co();!t.captureSession||(nW(t),Ja("history",({from:e,to:n})=>{e===void 0||e===n||nW(co())}))}function dR(t){const e=co().getClient(),n=t||e&&e.getOptions();return!!n&&("tracesSampleRate"in n||"tracesSampler"in n)}function tb(t){const n=(t||co()).getScope();return n&&n.getTransaction()}function gs(t){return t/1e3}function AEe(){Ja("error",rW),Ja("unhandledrejection",rW)}function rW(){const t=tb();if(t){const e="internal_error";(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log(`[Tracing] Transaction: ${e} -> Global error occured`),t.setStatus(e)}}class P_{__init(){this.spans=[]}constructor(e=1e3){P_.prototype.__init.call(this),this._maxlen=e}add(e){this.spans.length>this._maxlen?e.spanRecorder=void 0:this.spans.push(e)}}class Sd{__init2(){this.traceId=rh()}__init3(){this.spanId=rh().substring(16)}__init4(){this.startTimestamp=Fv()}__init5(){this.tags={}}__init6(){this.data={}}constructor(e){if(Sd.prototype.__init2.call(this),Sd.prototype.__init3.call(this),Sd.prototype.__init4.call(this),Sd.prototype.__init5.call(this),Sd.prototype.__init6.call(this),!e)return this;e.traceId&&(this.traceId=e.traceId),e.spanId&&(this.spanId=e.spanId),e.parentSpanId&&(this.parentSpanId=e.parentSpanId),"sampled"in e&&(this.sampled=e.sampled),e.op&&(this.op=e.op),e.description&&(this.description=e.description),e.data&&(this.data=e.data),e.tags&&(this.tags=e.tags),e.status&&(this.status=e.status),e.startTimestamp&&(this.startTimestamp=e.startTimestamp),e.endTimestamp&&(this.endTimestamp=e.endTimestamp)}startChild(e){const n=new Sd({...e,parentSpanId:this.spanId,sampled:this.sampled,traceId:this.traceId});if(n.spanRecorder=this.spanRecorder,n.spanRecorder&&n.spanRecorder.add(n),n.transaction=this.transaction,(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&n.transaction){const r=e&&e.op||"< unknown op >",i=n.transaction.name||"< unknown name >",o=n.transaction.spanId,s=`[Tracing] Starting '${r}' span on transaction '${i}' (${o}).`;n.transaction.metadata.spanMetadata[n.spanId]={logMessage:s},wt.log(s)}return n}setTag(e,n){return this.tags={...this.tags,[e]:n},this}setData(e,n){return this.data={...this.data,[e]:n},this}setStatus(e){return this.status=e,this}setHttpStatus(e){this.setTag("http.status_code",String(e));const n=IEe(e);return n!=="unknown_error"&&this.setStatus(n),this}isSuccess(){return this.status==="ok"}finish(e){if((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&this.transaction&&this.transaction.spanId!==this.spanId){const{logMessage:n}=this.transaction.metadata.spanMetadata[this.spanId];n&&wt.log(n.replace("Starting","Finishing"))}this.endTimestamp=typeof e=="number"?e:Fv()}toTraceparent(){let e="";return this.sampled!==void 0&&(e=this.sampled?"-1":"-0"),`${this.traceId}-${this.spanId}${e}`}toContext(){return nh({data:this.data,description:this.description,endTimestamp:this.endTimestamp,op:this.op,parentSpanId:this.parentSpanId,sampled:this.sampled,spanId:this.spanId,startTimestamp:this.startTimestamp,status:this.status,tags:this.tags,traceId:this.traceId})}updateWithContext(e){return this.data=Rd(e.data,()=>({})),this.description=e.description,this.endTimestamp=e.endTimestamp,this.op=e.op,this.parentSpanId=e.parentSpanId,this.sampled=e.sampled,this.spanId=Rd(e.spanId,()=>this.spanId),this.startTimestamp=Rd(e.startTimestamp,()=>this.startTimestamp),this.status=e.status,this.tags=Rd(e.tags,()=>({})),this.traceId=Rd(e.traceId,()=>this.traceId),this}getTraceContext(){return nh({data:Object.keys(this.data).length>0?this.data:void 0,description:this.description,op:this.op,parent_span_id:this.parentSpanId,span_id:this.spanId,status:this.status,tags:Object.keys(this.tags).length>0?this.tags:void 0,trace_id:this.traceId})}toJSON(){return nh({data:Object.keys(this.data).length>0?this.data:void 0,description:this.description,op:this.op,parent_span_id:this.parentSpanId,span_id:this.spanId,start_timestamp:this.startTimestamp,status:this.status,tags:Object.keys(this.tags).length>0?this.tags:void 0,timestamp:this.endTimestamp,trace_id:this.traceId})}}function IEe(t){if(t<400&&t>=100)return"ok";if(t>=400&&t<500)switch(t){case 401:return"unauthenticated";case 403:return"permission_denied";case 404:return"not_found";case 409:return"already_exists";case 413:return"failed_precondition";case 429:return"resource_exhausted";default:return"invalid_argument"}if(t>=500&&t<600)switch(t){case 501:return"unimplemented";case 503:return"unavailable";case 504:return"deadline_exceeded";default:return"internal_error"}return"unknown_error"}class Hv extends Sd{__init(){this._measurements={}}__init2(){this._frozenDynamicSamplingContext=void 0}constructor(e,n){super(e),Hv.prototype.__init.call(this),Hv.prototype.__init2.call(this),this._hub=n||co(),this._name=e.name||"",this.metadata={source:"custom",...e.metadata,spanMetadata:{},changes:[],propagations:0},this._trimEnd=e.trimEnd,this.transaction=this;const r=this.metadata.dynamicSamplingContext;r&&(this._frozenDynamicSamplingContext={...r})}get name(){return this._name}set name(e){this.setName(e)}setName(e,n="custom"){(e!==this.name||n!==this.metadata.source)&&this.metadata.changes.push({source:this.metadata.source,timestamp:__(),propagations:this.metadata.propagations}),this._name=e,this.metadata.source=n}initSpanRecorder(e=1e3){this.spanRecorder||(this.spanRecorder=new P_(e)),this.spanRecorder.add(this)}setMeasurement(e,n,r=""){this._measurements[e]={value:n,unit:r}}setMetadata(e){this.metadata={...this.metadata,...e}}finish(e){if(this.endTimestamp!==void 0)return;if(this.name||((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this.name="<unlabeled transaction>"),super.finish(e),this.sampled!==!0){(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Tracing] Discarding transaction because its trace was not chosen to be sampled.");const s=this._hub.getClient();s&&s.recordDroppedEvent("sample_rate","transaction");return}const n=this.spanRecorder?this.spanRecorder.spans.filter(s=>s!==this&&s.endTimestamp):[];this._trimEnd&&n.length>0&&(this.endTimestamp=n.reduce((s,a)=>s.endTimestamp&&a.endTimestamp?s.endTimestamp>a.endTimestamp?s:a:s).endTimestamp);const r=this.metadata,i={contexts:{trace:this.getTraceContext()},spans:n,start_timestamp:this.startTimestamp,tags:this.tags,timestamp:this.endTimestamp,transaction:this.name,type:"transaction",sdkProcessingMetadata:{...r,dynamicSamplingContext:this.getDynamicSamplingContext()},...r.source&&{transaction_info:{source:r.source,changes:r.changes,propagations:r.propagations}}};return Object.keys(this._measurements).length>0&&((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Measurements] Adding measurements to transaction",JSON.stringify(this._measurements,void 0,2)),i.measurements=this._measurements),(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log(`[Tracing] Finishing ${this.op} transaction: ${this.name}.`),this._hub.captureEvent(i)}toContext(){const e=super.toContext();return nh({...e,name:this.name,trimEnd:this._trimEnd})}updateWithContext(e){return super.updateWithContext(e),this.name=Rd(e.name,()=>""),this._trimEnd=e.trimEnd,this}getDynamicSamplingContext(){if(this._frozenDynamicSamplingContext)return this._frozenDynamicSamplingContext;const e=this._hub||co(),n=e&&e.getClient();if(!n)return{};const{environment:r,release:i}=n.getOptions()||{},{publicKey:o}=n.getDsn()||{},s=this.metadata.sampleRate,a=s!==void 0?s.toString():void 0,l=e.getScope(),{segment:c}=l&&l.getUser()||{},u=this.metadata.source,f=u&&u!=="url"?this.name:void 0;return nh({environment:r,release:i,transaction:f,user_segment:c,public_key:o,trace_id:this.traceId,sample_rate:a})}}const xee=1e3,See=3e4,wee=5e3;class zEe extends P_{constructor(e,n,r,i){super(i),this._pushActivity=e,this._popActivity=n,this.transactionSpanId=r}add(e){e.spanId!==this.transactionSpanId&&(e.finish=n=>{e.endTimestamp=typeof n=="number"?n:Fv(),this._popActivity(e.spanId)},e.endTimestamp===void 0&&this._pushActivity(e.spanId)),super.add(e)}}class h1 extends Hv{__init(){this.activities={}}__init2(){this._heartbeatCounter=0}__init3(){this._finished=!1}__init4(){this._beforeFinishCallbacks=[]}constructor(e,n,r=xee,i=See,o=wee,s=!1){super(e,n),this._idleHub=n,this._idleTimeout=r,this._finalTimeout=i,this._heartbeatInterval=o,this._onScope=s,h1.prototype.__init.call(this),h1.prototype.__init2.call(this),h1.prototype.__init3.call(this),h1.prototype.__init4.call(this),s&&(iW(n),(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log(`Setting idle transaction on scope. Span ID: ${this.spanId}`),n.configureScope(a=>a.setSpan(this))),this._startIdleTimeout(),setTimeout(()=>{this._finished||(this.setStatus("deadline_exceeded"),this.finish())},this._finalTimeout)}finish(e=Fv()){if(this._finished=!0,this.activities={},this.spanRecorder){(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Tracing] finishing IdleTransaction",new Date(e*1e3).toISOString(),this.op);for(const n of this._beforeFinishCallbacks)n(this,e);this.spanRecorder.spans=this.spanRecorder.spans.filter(n=>{if(n.spanId===this.spanId)return!0;n.endTimestamp||(n.endTimestamp=e,n.setStatus("cancelled"),(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Tracing] cancelling span since transaction ended early",JSON.stringify(n,void 0,2)));const r=n.startTimestamp<e;return r||(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Tracing] discarding Span since it happened after Transaction was finished",JSON.stringify(n,void 0,2)),r}),(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Tracing] flushing IdleTransaction")}else(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Tracing] No active IdleTransaction");return this._onScope&&iW(this._idleHub),super.finish(e)}registerBeforeFinishCallback(e){this._beforeFinishCallbacks.push(e)}initSpanRecorder(e){if(!this.spanRecorder){const n=i=>{this._finished||this._pushActivity(i)},r=i=>{this._finished||this._popActivity(i)};this.spanRecorder=new zEe(n,r,this.spanId,e),(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("Starting heartbeat"),this._pingHeartbeat()}this.spanRecorder.add(this)}_cancelIdleTimeout(){this._idleTimeoutID&&(clearTimeout(this._idleTimeoutID),this._idleTimeoutID=void 0)}_startIdleTimeout(e){this._cancelIdleTimeout(),this._idleTimeoutID=setTimeout(()=>{!this._finished&&Object.keys(this.activities).length===0&&this.finish(e)},this._idleTimeout)}_pushActivity(e){this._cancelIdleTimeout(),(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log(`[Tracing] pushActivity: ${e}`),this.activities[e]=!0,(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Tracing] new activities count",Object.keys(this.activities).length)}_popActivity(e){if(this.activities[e]&&((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log(`[Tracing] popActivity ${e}`),delete this.activities[e],(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Tracing] new activities count",Object.keys(this.activities).length)),Object.keys(this.activities).length===0){const n=Fv()+this._idleTimeout/1e3;this._startIdleTimeout(n)}}_beat(){if(this._finished)return;const e=Object.keys(this.activities).join("");e===this._prevHeartbeatString?this._heartbeatCounter+=1:this._heartbeatCounter=1,this._prevHeartbeatString=e,this._heartbeatCounter>=3?((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Tracing] Transaction finished because of no change for 3 heart beats"),this.setStatus("deadline_exceeded"),this.finish()):this._pingHeartbeat()}_pingHeartbeat(){(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log(`pinging Heartbeat -> current counter: ${this._heartbeatCounter}`),setTimeout(()=>{this._beat()},this._heartbeatInterval)}}function iW(t){const e=t.getScope();e&&e.getTransaction()&&e.setSpan(void 0)}function LEe(){const t=this.getScope();if(t){const e=t.getSpan();if(e)return{"sentry-trace":e.toTraceparent()}}return{}}function _ee(t,e,n){if(!dR(e))return t.sampled=!1,t;if(t.sampled!==void 0)return t.setMetadata({sampleRate:Number(t.sampled)}),t;let r;return typeof e.tracesSampler=="function"?(r=e.tracesSampler(n),t.setMetadata({sampleRate:Number(r)})):n.parentSampled!==void 0?r=n.parentSampled:(r=e.tracesSampleRate,t.setMetadata({sampleRate:Number(r)})),NEe(r)?r?(t.sampled=Math.random()<r,t.sampled?((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log(`[Tracing] starting ${t.op} transaction - ${t.name}`),t):((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(r)})`),t)):((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log(`[Tracing] Discarding transaction because ${typeof e.tracesSampler=="function"?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0"}`),t.sampled=!1,t):((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.warn("[Tracing] Discarding transaction because of invalid sample rate."),t.sampled=!1,t)}function NEe(t){return jJ(t)||!(typeof t=="number"||typeof t=="boolean")?((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.warn(`[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(t)} of type ${JSON.stringify(typeof t)}.`),!1):t<0||t>1?((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.warn(`[Tracing] Given sample rate is invalid. Sample rate must be between 0 and 1. Got ${t}.`),!1):!0}function MEe(t,e){const n=this.getClient(),r=n&&n.getOptions()||{};let i=new Hv(t,this);return i=_ee(i,r,{parentSampled:t.parentSampled,transactionContext:t,...e}),i.sampled&&i.initSpanRecorder(r._experiments&&r._experiments.maxSpans),i}function DEe(t,e,n,r,i,o,s){const a=t.getClient(),l=a&&a.getOptions()||{};let c=new h1(e,t,n,r,s,i);return c=_ee(c,l,{parentSampled:e.parentSampled,transactionContext:e,...o}),c.sampled&&c.initSpanRecorder(l._experiments&&l._experiments.maxSpans),c}function XEe(){const t=j0();!t.__SENTRY__||(t.__SENTRY__.extensions=t.__SENTRY__.extensions||{},t.__SENTRY__.extensions.startTransaction||(t.__SENTRY__.extensions.startTransaction=MEe),t.__SENTRY__.extensions.traceHeaders||(t.__SENTRY__.extensions.traceHeaders=LEe))}function WEe(){const t=j0();if(!t.__SENTRY__)return;const e={mongodb(){const r=Md(module,"./integrations/node/mongo");return new r.Mongo},mongoose(){const r=Md(module,"./integrations/node/mongo");return new r.Mongo({mongoose:!0})},mysql(){const r=Md(module,"./integrations/node/mysql");return new r.Mysql},pg(){const r=Md(module,"./integrations/node/postgres");return new r.Postgres}},n=Object.keys(e).filter(r=>!!I8e(r)).map(r=>{try{return e[r]()}catch{return}}).filter(r=>r);n.length>0&&(t.__SENTRY__.integrations=[...t.__SENTRY__.integrations||[],...n])}function UEe(){XEe(),oR()&&WEe(),AEe()}function qEe(){bt&&bt.document?bt.document.addEventListener("visibilitychange",()=>{const t=tb();if(bt.document.hidden&&t){const e="cancelled";(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log(`[Tracing] Transaction: ${e} -> since tab moved to the background, op: ${t.op}`),t.status||t.setStatus(e),t.setTag("visibilitychange","document.hidden"),t.finish()}}):(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.warn("[Tracing] Could not set up background tab detection due to lack of global document")}const hR=(t,e,n)=>{let r;return i=>{e.value>=0&&(i||n)&&(e.delta=e.value-(r||0),(e.delta||r===void 0)&&(r=e.value,t(e)))}},BEe=()=>`v2-${Date.now()}-${Math.floor(Math.random()*(9e12-1))+1e12}`,pR=(t,e)=>({name:t,value:Rd(e,()=>-1),delta:0,entries:[],id:BEe()}),Q_=(t,e)=>{try{if(PerformanceObserver.supportedEntryTypes.includes(t)){if(t==="first-input"&&!("PerformanceEventTiming"in self))return;const n=new PerformanceObserver(r=>r.getEntries().map(e));return n.observe({type:t,buffered:!0}),n}}catch{}},$_=(t,e)=>{const n=r=>{(r.type==="pagehide"||bt.document.visibilityState==="hidden")&&(t(r),e&&(removeEventListener("visibilitychange",n,!0),removeEventListener("pagehide",n,!0)))};addEventListener("visibilitychange",n,!0),addEventListener("pagehide",n,!0)},YEe=(t,e)=>{const n=pR("CLS",0);let r,i=0,o=[];const s=l=>{if(l&&!l.hadRecentInput){const c=o[0],u=o[o.length-1];i&&o.length!==0&&l.startTime-u.startTime<1e3&&l.startTime-c.startTime<5e3?(i+=l.value,o.push(l)):(i=l.value,o=[l]),i>n.value&&(n.value=i,n.entries=o,r&&r())}},a=Q_("layout-shift",s);a&&(r=hR(t,n,e),$_(()=>{a.takeRecords().map(s),r(!0)}))};let Nx=-1;const FEe=()=>bt.document.visibilityState==="hidden"?0:1/0,jEe=()=>{$_(({timeStamp:t})=>{Nx=t},!0)},OR=()=>(Nx<0&&(Nx=FEe(),jEe()),{get firstHiddenTime(){return Nx}}),ZEe=(t,e)=>{const n=OR(),r=pR("FID");let i;const o=a=>{i&&a.startTime<n.firstHiddenTime&&(r.value=a.processingStart-a.startTime,r.entries.push(a),i(!0))},s=Q_("first-input",o);s&&(i=hR(t,r,e),$_(()=>{s.takeRecords().map(o),s.disconnect()},!0))},oW={},VEe=(t,e)=>{const n=OR(),r=pR("LCP");let i;const o=a=>{const l=a.startTime;l<n.firstHiddenTime&&(r.value=l,r.entries.push(a)),i&&i()},s=Q_("largest-contentful-paint",o);if(s){i=hR(t,r,e);const a=()=>{oW[r.id]||(s.takeRecords().map(o),s.disconnect(),oW[r.id]=!0,i(!0))};["keydown","click"].forEach(l=>{addEventListener(l,a,{once:!0,capture:!0})}),$_(a,!0)}};function aP(t){return typeof t=="number"&&isFinite(t)}function o0(t,{startTimestamp:e,...n}){return e&&t.startTimestamp>e&&(t.startTimestamp=e),t.startChild({startTimestamp:e,...n})}function Tee(){return bt&&bt.addEventListener&&bt.performance}let sW=0,io={},ou,Bg;function GEe(t=!1){const e=Tee();e&&jv&&(e.mark&&bt.performance.mark("sentry-tracing-init"),KEe(),JEe(t),e7e())}function HEe(){Q_("longtask",e=>{const n=tb();if(!n)return;const r=gs(jv+e.startTime),i=gs(e.duration);n.startChild({description:"Main UI thread blocked",op:"ui.long-task",startTimestamp:r,endTimestamp:r+i})})}function KEe(){YEe(t=>{const e=t.entries.pop();!e||((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Measurements] Adding CLS"),io.cls={value:t.value,unit:""},Bg=e)})}function JEe(t){VEe(e=>{const n=e.entries.pop();!n||((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Measurements] Adding LCP"),io.lcp={value:e.value,unit:"millisecond"},ou=n)},t)}function e7e(){ZEe(t=>{const e=t.entries.pop();if(!e)return;const n=gs(jv),r=gs(e.startTime);(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Measurements] Adding FID"),io.fid={value:t.value,unit:"millisecond"},io["mark.fid"]={value:n+r,unit:"second"}})}function t7e(t){const e=Tee();if(!e||!bt.performance.getEntries||!jv)return;(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Tracing] Adding & adjusting spans using Performance API");const n=gs(jv),r=e.getEntries();let i,o;if(r.slice(sW).forEach(s=>{const a=gs(s.startTime),l=gs(s.duration);if(!(t.op==="navigation"&&n+a<t.startTimestamp))switch(s.entryType){case"navigation":{r7e(t,s,n),i=n+gs(s.responseStart),o=n+gs(s.requestStart);break}case"mark":case"paint":case"measure":{n7e(t,s,a,l,n);const c=OR(),u=s.startTime<c.firstHiddenTime;s.name==="first-paint"&&u&&((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Measurements] Adding FP"),io.fp={value:s.startTime,unit:"millisecond"}),s.name==="first-contentful-paint"&&u&&((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Measurements] Adding FCP"),io.fcp={value:s.startTime,unit:"millisecond"});break}case"resource":{const c=s.name.replace(bt.location.origin,"");o7e(t,s,c,a,l,n);break}}}),sW=Math.max(r.length-1,0),s7e(t),t.op==="pageload"){typeof i=="number"&&((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Measurements] Adding TTFB"),io.ttfb={value:(i-t.startTimestamp)*1e3,unit:"millisecond"},typeof o=="number"&&o<=i&&(io["ttfb.requestTime"]={value:(i-o)*1e3,unit:"millisecond"})),["fcp","fp","lcp"].forEach(a=>{if(!io[a]||n>=t.startTimestamp)return;const l=io[a].value,c=n+gs(l),u=Math.abs((c-t.startTimestamp)*1e3),f=u-l;(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log(`[Measurements] Normalized ${a} from ${l} to ${u} (${f})`),io[a].value=u});const s=io["mark.fid"];s&&io.fid&&(o0(t,{description:"first input delay",endTimestamp:s.value+gs(io.fid.value),op:"ui.action",startTimestamp:s.value}),delete io["mark.fid"]),"fcp"in io||delete io.cls,Object.keys(io).forEach(a=>{t.setMeasurement(a,io[a].value,io[a].unit)}),a7e(t)}ou=void 0,Bg=void 0,io={}}function n7e(t,e,n,r,i){const o=i+n,s=o+r;return o0(t,{description:e.name,endTimestamp:s,op:e.entryType,startTimestamp:o}),o}function r7e(t,e,n){["unloadEvent","redirect","domContentLoadedEvent","loadEvent","connect"].forEach(r=>{Z5(t,e,r,n)}),Z5(t,e,"secureConnection",n,"TLS/SSL","connectEnd"),Z5(t,e,"fetch",n,"cache","domainLookupStart"),Z5(t,e,"domainLookup",n,"DNS"),i7e(t,e,n)}function Z5(t,e,n,r,i,o){const s=o?e[o]:e[`${n}End`],a=e[`${n}Start`];!a||!s||o0(t,{op:"browser",description:Rd(i,()=>n),startTimestamp:r+gs(a),endTimestamp:r+gs(s)})}function i7e(t,e,n){o0(t,{op:"browser",description:"request",startTimestamp:n+gs(e.requestStart),endTimestamp:n+gs(e.responseEnd)}),o0(t,{op:"browser",description:"response",startTimestamp:n+gs(e.responseStart),endTimestamp:n+gs(e.responseEnd)})}function o7e(t,e,n,r,i,o){if(e.initiatorType==="xmlhttprequest"||e.initiatorType==="fetch")return;const s={};"transferSize"in e&&(s["Transfer Size"]=e.transferSize),"encodedBodySize"in e&&(s["Encoded Body Size"]=e.encodedBodySize),"decodedBodySize"in e&&(s["Decoded Body Size"]=e.decodedBodySize);const a=o+r,l=a+i;o0(t,{description:n,endTimestamp:l,op:e.initiatorType?`resource.${e.initiatorType}`:"resource.other",startTimestamp:a,data:s})}function s7e(t){const e=bt.navigator;if(!e)return;const n=e.connection;n&&(n.effectiveType&&t.setTag("effectiveConnectionType",n.effectiveType),n.type&&t.setTag("connectionType",n.type),aP(n.rtt)&&(io["connection.rtt"]={value:n.rtt,unit:"millisecond"})),aP(e.deviceMemory)&&t.setTag("deviceMemory",`${e.deviceMemory} GB`),aP(e.hardwareConcurrency)&&t.setTag("hardwareConcurrency",String(e.hardwareConcurrency))}function a7e(t){ou&&((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Measurements] Adding LCP Data"),ou.element&&t.setTag("lcp.element",qv(ou.element)),ou.id&&t.setTag("lcp.id",ou.id),ou.url&&t.setTag("lcp.url",ou.url.trim().slice(0,200)),t.setTag("lcp.size",ou.size)),Bg&&Bg.sources&&((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log("[Measurements] Adding CLS Data"),Bg.sources.forEach((e,n)=>t.setTag(`cls.source.${n+1}`,qv(e.node))))}const l7e=["localhost",/^\//],o4={traceFetch:!0,traceXHR:!0,tracingOrigins:l7e};function c7e(t){const{traceFetch:e,traceXHR:n,tracingOrigins:r,shouldCreateSpanForRequest:i}={...o4,...t},o={},s=c=>{if(o[c])return o[c];const u=r;return o[c]=u.some(f=>Bv(c,f))&&!Bv(c,"sentry_key"),o[c]};let a=s;typeof i=="function"&&(a=c=>s(c)&&i(c));const l={};e&&Ja("fetch",c=>{u7e(c,a,l)}),n&&Ja("xhr",c=>{d7e(c,a,l)})}function u7e(t,e,n){if(!dR()||!(t.fetchData&&e(t.fetchData.url)))return;if(t.endTimestamp){const i=t.fetchData.__span;if(!i)return;const o=n[i];o&&(t.response?o.setHttpStatus(t.response.status):t.error&&o.setStatus("internal_error"),o.finish(),delete n[i]);return}const r=tb();if(r){const i=r.startChild({data:{...t.fetchData,type:"fetch"},description:`${t.fetchData.method} ${t.fetchData.url}`,op:"http.client"});t.fetchData.__span=i.spanId,n[i.spanId]=i;const o=t.args[0];t.args[1]=t.args[1]||{};const s=t.args[1];s.headers=f7e(o,r.getDynamicSamplingContext(),i,s),r.metadata.propagations+=1}}function f7e(t,e,n,r){const i=oee(e),o=n.toTraceparent(),s=typeof Request!="undefined"&&Eu(t,Request)?t.headers:r.headers;if(s)if(typeof Headers!="undefined"&&Eu(s,Headers)){const a=new Headers(s);return a.append("sentry-trace",o),i&&a.append(n8,i),a}else if(Array.isArray(s)){const a=[...s,["sentry-trace",o]];return i&&a.push([n8,i]),a}else{const a="baggage"in s?s.baggage:void 0,l=[];return Array.isArray(a)?l.push(...a):a&&l.push(a),i&&l.push(i),{...s,"sentry-trace":o,baggage:l.length>0?l.join(","):void 0}}else return{"sentry-trace":o,baggage:i}}function d7e(t,e,n){if(!dR()||t.xhr&&t.xhr.__sentry_own_request__||!(t.xhr&&t.xhr.__sentry_xhr__&&e(t.xhr.__sentry_xhr__.url)))return;const r=t.xhr.__sentry_xhr__;if(t.endTimestamp){const o=t.xhr.__sentry_xhr_span_id__;if(!o)return;const s=n[o];s&&(s.setHttpStatus(r.status_code),s.finish(),delete n[o]);return}const i=tb();if(i){const o=i.startChild({data:{...r.data,type:"xhr",method:r.method,url:r.url},description:`${r.method} ${r.url}`,op:"http.client"});if(t.xhr.__sentry_xhr_span_id__=o.spanId,n[t.xhr.__sentry_xhr_span_id__]=o,t.xhr.setRequestHeader)try{t.xhr.setRequestHeader("sentry-trace",o.toTraceparent());const s=i.getDynamicSamplingContext(),a=oee(s);a&&t.xhr.setRequestHeader(n8,a),i.metadata.propagations+=1}catch{}}}function h7e(t,e=!0,n=!0){if(!bt||!bt.location){(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.warn("Could not initialize routing instrumentation due to invalid location");return}let r=bt.location.href,i;e&&(i=t({name:bt.location.pathname,op:"pageload",metadata:{source:"url"}})),n&&Ja("history",({to:o,from:s})=>{if(s===void 0&&r&&r.indexOf(o)!==-1){r=void 0;return}s!==o&&(r=void 0,i&&((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log(`[Tracing] Finishing current transaction with op: ${i.op}`),i.finish()),i=t({name:bt.location.pathname,op:"navigation",metadata:{source:"url"}}))})}const p7e="BrowserTracing",O7e={idleTimeout:xee,finalTimeout:See,heartbeatInterval:wee,markBackgroundTransactions:!0,routingInstrumentation:h7e,startTransactionOnLocationChange:!0,startTransactionOnPageLoad:!0,_experiments:{enableLongTask:!0},...o4};class mR{__init(){this.name=p7e}constructor(e){mR.prototype.__init.call(this);let n=o4.tracingOrigins;e&&(e.tracingOrigins&&Array.isArray(e.tracingOrigins)?n=e.tracingOrigins:(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&(this._emitOptionsWarning=!0)),this.options={...O7e,...e,tracingOrigins:n};const{_metricOptions:r}=this.options;GEe(r&&r._reportAllChanges),h8e([this,"access",i=>i.options,"access",i=>i._experiments,"optionalAccess",i=>i.enableLongTask])&&HEe()}setupOnce(e,n){this._getCurrentHub=n,this._emitOptionsWarning&&((typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.warn("[Tracing] You need to define `tracingOrigins` in the options. Set an array of urls or patterns to trace."),(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.warn(`[Tracing] We added a reasonable default for you: ${o4.tracingOrigins}`));const{routingInstrumentation:r,startTransactionOnLocationChange:i,startTransactionOnPageLoad:o,markBackgroundTransactions:s,traceFetch:a,traceXHR:l,tracingOrigins:c,shouldCreateSpanForRequest:u}=this.options;r(f=>this._createRouteTransaction(f),o,i),s&&qEe(),c7e({traceFetch:a,traceXHR:l,tracingOrigins:c,shouldCreateSpanForRequest:u})}_createRouteTransaction(e){if(!this._getCurrentHub){(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.warn(`[Tracing] Did not create ${e.op} transaction because _getCurrentHub is invalid.`);return}const{beforeNavigate:n,idleTimeout:r,finalTimeout:i,heartbeatInterval:o}=this.options,s=e.op==="pageload",a=s?aW("sentry-trace"):null,l=s?aW("baggage"):null,c=a?B8e(a):void 0,u=l?r$e(l):void 0,f={...e,...c,metadata:{...e.metadata,dynamicSamplingContext:c&&!u?{}:u},trimEnd:!0},h=typeof n=="function"?n(f):f,d=h===void 0?{...f,sampled:!1}:h;d.metadata=d.name!==f.name?{...d.metadata,source:"custom"}:d.metadata,d.sampled===!1&&(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log(`[Tracing] Will not send ${d.op} transaction because of beforeNavigate.`),(typeof __SENTRY_DEBUG__=="undefined"||__SENTRY_DEBUG__)&&wt.log(`[Tracing] Starting ${d.op} transaction on scope`);const O=this._getCurrentHub(),{location:b}=bt,v=DEe(O,d,r,i,!0,{location:b},o);return v.registerBeforeFinishCallback(p=>{t7e(p),p.setTag("sentry_reportAllChanges",Boolean(this.options._metricOptions&&this.options._metricOptions._reportAllChanges))}),v}}function aW(t){const e=i8e(`meta[name=${t}]`);return e?e.getAttribute("content"):null}(typeof __SENTRY_TRACING__=="undefined"||__SENTRY_TRACING__)&&UEe();const m7e=Ph(async()=>(await Promise.resolve().then(function(){return GCe})).FileTree),g7e=Ph(async()=>(await Promise.resolve().then(function(){return Hit})).Editor),v7e=Ph(async()=>(await Promise.resolve().then(function(){return est})).default),y7e=Ph(async()=>(await Promise.resolve().then(function(){return ost})).default),b7e=Ph(async()=>(await Promise.resolve().then(function(){return lst})).default),x7e=Ph(async()=>(await Promise.resolve().then(function(){return Ngt})).default),S7e=Ph(async()=>(await Promise.resolve().then(function(){return Ygt})).default);class w7e{constructor(e){St(this,"components",{Tree:null,Editor:null,Console:null,Browser:null,Shell:null,MarkdownPreview:null});St(this,"paasOptions");St(this,"paasDomainPath");St(this,"sdkVersion");St(this,"isRendered",!1);St(this,"markdownSchema",{});St(this,"socketParser","default");St(this,"i18nLanguage",jS.ZH);St(this,"themeType",YQ.dark);this.sdkVersion=f_e(),this.setPaasOptionsWithDefaultAvatar(e),this.setPaasDomainPathWithDefaultOrigin(e.paasDomain),this.themeType=e.themeType||YQ.dark,this.i18nLanguage=e.i18nLanguage||jS.ZH,this.init(),this.integratedSentry(e.enableSentry)}loadTheme(e){this.themeType=e,Ce.theme.setTheme(this.themeType,Fl.terminal),Ce.theme.setTheme(this.themeType,Fl.console),z_e(this.themeType)}integratedSentry(e=!1){!e||CEe({dsn:"https://7e40a817f13d4730b062e75687903544@o1334791.ingest.sentry.io/4504043835752448",integrations:[new mR],release:"d42paas-front@0.9.98",enabled:!0,environment:"production",tracesSampleRate:.02,beforeSend(n){var o;const r=((o=n==null?void 0:n.exception)==null?void 0:o.values)||[];let i=!0;return r.forEach(s=>{var l;const a=((l=s.stacktrace)==null?void 0:l.frames)||[];if(a.length){const c=a[a.length-1],u=(c==null?void 0:c.filename)||"";i=/daopaas/gi.test(u)}}),i?n:null}})}async init(){var s,a,l,c;this.reset(),this.loadTheme(this.themeType),(s=this.paasOptions.defaultOpenFiles)!=null&&s.length&&Ce.dao.defaultOpenFiles(this.paasOptions.defaultOpenFiles||""),Ce.dao.specialOpenFile(this.paasOptions.specialOpenFile||""),Ce.dao.setXtermStyle(this.paasOptions.xtermStyle),Ce.dao.isOpenDebugMode((a=this.paasOptions.isOpenDebugMode)!=null?a:!1),Ce.i18n.setLanguage(this.i18nLanguage),Qo.changeLanguage(this.i18nLanguage),Ce.dao.setIsLegacyMarkdownMath((c=(l=this.paasOptions)==null?void 0:l.isLegacyMarkdownMath)!=null?c:!1),Mt.debug(`sdk: init with ${this.paasDomainPath} passDomain`);const{url:e,userId:n,socketParser:r}=await d_e(this.paasDomainPath,this.paasOptions.ticket,this.sdkVersion);this.socketParser=r||"default",Ce.dao.openSocketBuffer(this.socketParser==="buffer");let i;try{i=await q4e(n)}catch{}const o=oe.dao.channel().visibilitychange;document.removeEventListener("visibilitychange",o),Ce.dao.reconnectMaxTimes(this.paasOptions.reconnectMaxTimes||10),oe.dao.channel().startChannel(e,{...this.paasOptions,agentUserId:i},{triggerEventForMaxTimespan:this.paasOptions.triggerEventForMaxTimespan,reconnectMaxTimes:this.paasOptions.reconnectMaxTimes,isInsertCrdt:this.paasOptions.isInsertCrdt,sockerParser:this.socketParser}),Mt.info(">>>registerVisiblityChangeEvent"),document.addEventListener("visibilitychange",o)}setPaasOptionsWithDefaultAvatar(e){this.paasOptions=e,this.paasOptions.userInfo.avatarUrl||(this.paasOptions.userInfo.avatarUrl=R9e(this.paasOptions.userInfo.username))}setPaasDomainPathWithDefaultOrigin(e){this.paasDomainPath={}.PAAS_MANAGER_API_ORIGIN||"https://www.1024paas.com",e&&(this.paasDomainPath=e)}reset(){oe.dao.channel().closeChannel(),rTe()}get playgroundStatus(){return oe.dao.playgroundInfo().status}get dockerStatus(){return oe.dao.playgroundInfo().runStatus}get currentAgentUser(){return oe.dao.currentAgentUser()}get agentUsers(){return oe.dao.playgroundInfo().agentUsers}get playgroundInfo(){return oe.dao.playgroundInfo()}get currentFollowingAgentUser(){return oe.dao.getFollowingAgentUser()}followUser(e){const n=oe.dao.playgroundInfo().agentUsers.find(r=>r.agentUserId===e);if(oe.dao.currentAgentUserId()===(n==null?void 0:n.followingAgentUserId)){const r=or("dao_paas_cannot_follow_each_other");ao.error(r);return}oe.dao.channel().followingAgentUser(e),n.fileOpened&&(Ce.file.docLoading(!0),oe.dao.channel().loadFile(n.fileOpened,"follow"))}unFollowUser(){oe.dao.channel().unFollowingAgentUser()}publishKeyEvent(e){oe.dao.channel().publishKeyEvent(e)}preparePlayback(){Ce.dao.setPlaygroundMode($u.playback),oe.dao.channel().getPlaybackInfo()}startPlayback(e){oe.dao.channel().startPlayback(e)}restartPlayback(e){oe.dao.channel().restartPlayback(e)}goToPlayback(e){oe.dao.channel().goToPlayback(e)}pausePlayback(){oe.dao.channel().pausePlayback()}stopPlayback(){Ce.dao.setPlaygroundMode($u.edit),oe.dao.channel().stopPlayback()}setRate(e){oe.dao.channel().setPlaybackRate(e)}activePlayground(){oe.dao.channel().active()}retainingAllFiles(){return oe.dao.channel().retainingAllFiles(),oe.dao.channel().off("retainingAllFiles"),new Promise(e=>{oe.dao.channel().on("retainingAllFiles",n=>{e(n)})})}runPlayground(){return new Promise((e,n)=>{const r=oe.file.pendingUpdateCount();if(r>0)return n(this.handleErrorRes(or("editor_pending_update",{pendingUpdate:r})));oe.dao.channel().run(),e(this.handleSuccessRes("running"))})}stopPlayground(){oe.dao.channel().stop()}appendCustomizeFrameData(e){oe.dao.channel().appendCustomizeFrameData(e)}statisticsPlaybackData(e,n){return new Promise((r,i)=>{if(!oe.dao.isReady())return i(this.handleErrorRes("no ready"));if(!e||!(n!=null&&n.length)){r({status:"fail",message:"please input right parmas",errorCode:"ERROR_PARMAS"});return}oe.dao.channel().statisticsPlaybackData(e,n),oe.dao.channel().off("statisticsPlaybackData"),oe.dao.channel().on("statisticsPlaybackData",o=>{r({status:"success",data:o})})})}onMessage(e){oe.dao.channel().addMessageListener(e)}onError(e){oe.dao.channel().addErrorListener(e)}subscribePlayControlEvent(e){oe.dao.channel().subscribeForPlayControl(e)}unsubscribePlayControlEvent(e){oe.dao.channel().unsubscribeForPlayControl(e)}subscribe(e,n){oe.dao.channel().subscribeForComponent(e,n)}unsubscribe(e,n){oe.dao.channel().unsubscribeForComponent(e,n)}initComponent(e,n,r){const i=document.querySelector(n);if(!i)throw new Error(or("dao_paas_not_find_mount_dom_object_for_x",{x:n}));const o=Vw(i),s=a=>{switch(e){case"Tree":return de(m7e,{...a});case"Editor":return de(g7e,{...a});case"Browser":return de(y7e,{...a});case"Console":return de(v7e,{...a});case"Shell":return de(b7e,{...a});case"MarkdownPreview":return de(x7e,{...a});case"Debug":return de(S7e,{...a});default:throw new Error(or("dao_paas_x_component_is_not_supported",{x:e}))}};this.components[e]={reactComponent:s,container:n,props:r,root:o},o.render(de(M.exports.Suspense,{fallback:de(C9e,{}),children:de(s,{...r})}))}mountMarkdownPreview(){const{MarkdownPreview:e}=this.components;if(Mt.debug("markdown\u9884\u89C8\u7EC4\u4EF6\u6302\u8F7D\u4E2D",this.markdownSchema),e)Mt.debug("\u6302\u8F7D\u5931\u8D25\uFF0C\u8BF7\u52FF\u91CD\u590D\u6302\u8F7D\u540C\u4E00\u4E2A\u7EC4\u4EF6",this.markdownSchema);else if(Object.keys(this.markdownSchema).length>0){const{item:n,container:r,props:i}=this.markdownSchema;this.initComponent(n,r,i),Mt.debug("markdown\u9884\u89C8\u7EC4\u4EF6\u6302\u8F7D\u5B8C\u6210",this.markdownSchema)}}unMountMarkdownPreview(){var n;const{MarkdownPreview:e}=this.components;Mt.debug("markdown\u9884\u89C8\u7EC4\u4EF6\u5378\u8F7D\u4E2D",e),e?((n=e.root)==null||n.unmount(),this.components.MarkdownPreview=null,Mt.debug("markdown\u9884\u89C8\u7EC4\u4EF6\u5378\u8F7D\u6210\u529F",e)):Mt.debug("\u5378\u8F7D\u5931\u8D25\uFF0Cmarkdown\u9884\u89C8\u7EC4\u4EF6\u4E0D\u5B58\u5728",e)}mapRender(e){e.forEach((n,r)=>{const{item:i,container:o,props:s}=n;i==="MarkdownPreview"&&(this.markdownSchema=n,!s.isRender)||this.initComponent(i,o,s)})}handleErrorRes(e){return{status:!1,message:e}}handleSuccessRes(e){return{status:!0,message:e}}insertTextById(e,n,r){oe.dao.channel().insertTextById(e,n,r)}removeAreaTextById(e,n,r){oe.dao.channel().removeAreaTextById(e,n,r)}jumpToAreaById(e,n){oe.dao.channel().jumpToAreaById(e,n)}switchLanguage(e,n,r,i){return new Promise((o,s)=>{if(!oe.dao.isReady())return s(this.handleErrorRes(or("dao_paas_no_ready")));oe.dao.channel().switchLanguage(e,n,r,i),oe.dao.channel().off("switchLanguage"),oe.dao.channel().on("switchLanguage",a=>{const l=oe.file.getOpenedPath(),{destination:c}=a;a.status&&r===l&&(Ce.file.setDocLoading(!0),oe.dao.channel().loadFile(c),o(this.handleSuccessRes(or("common_success")))),o(a)})})}restartServer(){return new Promise((e,n)=>{if(!oe.dao.isReady())return n(this.handleErrorRes(or("dao_paas_no_ready")));oe.dao.channel().restartServer(),oe.dao.channel().off("restartServer"),oe.dao.channel().on("restartServer",r=>{const i={status:r.success,message:r.success?r.message||r.messageId:r.error};e(i)})})}restartLSPServer(){if(!oe.dao.isReady())return this.handleErrorRes(or("dao_paas_no_ready"));oe.dao.channel().restartLSPServer()}addCDNSource(e,n,r){return new Promise((i,o)=>{if(!oe.dao.isReady())return o(this.handleErrorRes(or("dao_paas_no_ready")));oe.dao.channel().addCDNSource(e,n,r),oe.dao.channel().off("addCDNSource"),oe.dao.channel().on("addCDNSource",s=>{const a=oe.file.getOpenedPath();s.status&&r===a&&this.openFile(r),i(s)})})}openFile(e){return new Promise((n,r)=>{if(!oe.dao.isReady())return r(this.handleErrorRes(or("dao_paas_no_ready")));IK(e)?(Ce.file.setDocLoading(!0),oe.dao.channel().loadFile(e),zK(e),n(this.handleSuccessRes(or("common_success")))):r(this.handleErrorRes(or("dao_paas_file_does_not_exist")))})}updateGlobalConfig(e){const n={...oe.dao.globalConfig(),...e};window.localStorage.setItem("paasGlobalConfig",JSON.stringify(n)),Ce.dao.globalConfig(n)}updateConfig(e){const n={...oe.dao.config(),...e};Ce.dao.config(n)}toggleMarkDownPreview(e){e?this.mountMarkdownPreview():this.unMountMarkdownPreview()}reload(e=["Editor","Tree"]){const n={file:()=>{Ce.dao.setPlaygroundInfo(qK),Ce.file.reset()}},r=(e==null?void 0:e.includes("Editor"))||(e==null?void 0:e.includes("Tree"))?"file":"";e&&r&&n[r]()}switchI18nLanguage(e){Ce.i18n.setLanguage(e),oe.dao.channel().emitI18nLanguage(e),Qo.changeLanguage(e)}reloadI18nResources(e,n){try{(Array.isArray(e)?e:[{language:e,resource:n}]).forEach(i=>{Qo.addResources(i.language,"translation",i.resource)}),Qo.changeLanguage(oe.i18n.getLanguage())}catch(r){Mt.error("\u66F4\u65B0\u56FD\u9645\u5316\u6587\u672C\u5931\u8D25\uFF0C\u9519\u8BEF:",r)}}debugRun(){oe.dao.channel().debugRun()}setFileStyle(e){try{Ce.file.setFileStyle(e)}catch(n){Mt.error("\u8BBE\u7F6E\u6587\u4EF6\u6837\u5F0F\u5931\u8D25\uFF0C\u9519\u8BEF:",n)}}syncXtermKey(e){oe.dao.getFollowingAgentUser()||oe.dao.channel().xtermStatus({xtermKey:e})}dispose(){var e;Mt.debug("destroy components...",this.components),this.reset();for(const[n,r]of Object.entries(this.components)){if(!r)break;(e=r.root)==null||e.unmount(),Mt.debug(`destroy unmount: ${r.container}`)}}loggerEnable(){j4e()}}var Qf;(function(t){t.DoubleClickItemToExpand="double-click-item-to-expand",t.ClickItemToExpand="click-item-to-expand",t.ClickArrowToExpand="click-arrow-to-expand"})(Qf||(Qf={}));var s4=globalThis&&globalThis.__assign||function(){return s4=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},s4.apply(this,arguments)},_7e=function(t,e){return{mode:t.mode,createInteractiveElementProps:function(n,r,i,o){return s4(s4({},e.createInteractiveElementProps(n,r,i,o)),t.createInteractiveElementProps(n,r,i,o))}}},gR=function(t){return t.ctrlKey||navigator.platform.toUpperCase().indexOf("MAC")>=0&&t.metaKey},T7e=function(){function t(e){this.mode=Qf.DoubleClickItemToExpand,this.environment=e}return t.prototype.createInteractiveElementProps=function(e,n,r,i){var o=this;return{onClick:function(s){r.focusItem(),s.shiftKey?r.selectUpTo():gR(s)?i.isSelected?r.unselectItem():r.addToSelectedItems():r.selectItem()},onDoubleClick:function(){r.focusItem(),r.selectItem(),e.hasChildren&&r.toggleExpandedState(),(!e.hasChildren||o.environment.canInvokePrimaryActionOnItemContainer)&&r.primaryAction()},onFocus:function(){r.focusItem()},onDragStart:function(s){s.dataTransfer.dropEffect="move",r.startDragging()},onDragOver:function(s){s.preventDefault()},draggable:i.canDrag&&!i.isRenaming,tabIndex:i.isRenaming?void 0:i.isFocused?0:-1}},t}(),k7e=function(){function t(e){this.mode=Qf.ClickItemToExpand,this.environment=e}return t.prototype.createInteractiveElementProps=function(e,n,r,i){var o=this;return{onClick:function(s){r.focusItem(),s.shiftKey?r.selectUpTo():gR(s)?i.isSelected?r.unselectItem():r.addToSelectedItems():(e.hasChildren&&r.toggleExpandedState(),r.selectItem(),(!e.hasChildren||o.environment.canInvokePrimaryActionOnItemContainer)&&r.primaryAction())},onFocus:function(){r.focusItem()},onDragStart:function(s){s.dataTransfer.dropEffect="move",r.startDragging()},onDragOver:function(s){s.preventDefault()},draggable:i.canDrag&&!i.isRenaming,tabIndex:i.isRenaming?void 0:i.isFocused?0:-1}},t}(),P7e=function(){function t(e){this.mode=Qf.ClickItemToExpand,this.environment=e}return t.prototype.createInteractiveElementProps=function(e,n,r,i){var o=this;return{onClick:function(s){r.focusItem(),s.shiftKey?r.selectUpTo():gR(s)?i.isSelected?r.unselectItem():r.addToSelectedItems():(r.selectItem(),(!e.hasChildren||o.environment.canInvokePrimaryActionOnItemContainer)&&r.primaryAction())},onFocus:function(){r.focusItem()},onDragStart:function(s){s.dataTransfer.dropEffect="move",r.startDragging()},onDragOver:function(s){s.preventDefault()},draggable:i.canDrag&&!i.isRenaming,tabIndex:i.isRenaming?void 0:i.isFocused?0:-1}},t}(),lW=function(t,e){switch(t){case Qf.DoubleClickItemToExpand:return new T7e(e);case Qf.ClickItemToExpand:return new k7e(e);case Qf.ClickArrowToExpand:return new P7e(e);default:throw Error("Unknown interaction mode "+t)}},kee=M.exports.createContext(null),Q7e=function(){return M.exports.useContext(kee)},$7e=function(t){var e=xi(),n=e.defaultInteractionMode,r=M.exports.useMemo(function(){var i;return n&&typeof n!="string"?n.extends?_7e(n,lW(n.extends,e)):n:lW((i=n)!==null&&i!==void 0?i:Qf.ClickItemToExpand,e)},[]);return M.exports.createElement(kee.Provider,{value:r},t.children)},Pee=function(){var t=xi();return M.exports.useCallback(function(e,n){for(var r=t.linearItems[n],i=r[e].depth,o=e;!!r[o]&&r[o].depth!==i-1;o--);var s=r[o];return s||(s={item:t.trees[n].rootItem,depth:0},o=0),s},[t.linearItems,t.trees])},E7e=function(t,e){return t.clientX<e.left||t.clientX>e.right||t.clientY<e.top||t.clientY>e.bottom},C7e=function(t,e,n,r,i){var o=(t-e)/n,s=Math.floor(o),a=void 0,l=r||i?.2:.5;return o%1<l?a="top":o%1>1-l&&(a="bottom"),{linearIndex:s,offset:a}},R7e=function(t,e,n,r,i){var o=xi(),s=o.canDropOnItemWithChildren,a=o.canDropOnItemWithoutChildren,l=o.canDragAndDrop,c=o.linearItems,u=o.items,f=o.canReorderItems,h=o.viewState,d=Pee();return M.exports.useCallback(function(O,b,v){var p,g,y,S;if(!!l&&!!v.current&&!(O.clientX<0||O.clientY<0)){var w=v.current.getBoundingClientRect(),T=E7e(O,w),k=C7e(O.clientY,w.top,n,s,a),A=k.linearIndex,L=k.offset,$=T?"outside":""+b+A+(L!=null?L:"");if(t!==$){if(e($),T){r(void 0);return}if(A<0||A>=c[b].length){r(void 0);return}var E=c[b][A],C=E.depth,I=u[E.item];if(!L&&!a&&!I.hasChildren){r(void 0);return}if(!L&&!s&&I.hasChildren){r(void 0);return}if(L&&!f){r(void 0);return}var H=d(A,b);if(!(!((g=(p=h[b])===null||p===void 0?void 0:p.selectedItems)===null||g===void 0)&&g.includes(E.item))){var Y=u[H.item].children.indexOf(E.item)+(L==="top"?0:1);L==="top"&&C===((S=(y=c[b][A-1])===null||y===void 0?void 0:y.depth)!==null&&S!==void 0?S:-1)&&(L="bottom",A-=1);var z;L?z={targetType:"between-items",treeId:b,parentItem:H.item,depth:E.depth,linearIndex:A+(L==="top"?0:1),childIndex:Y,linePosition:L}:z={targetType:"item",treeId:b,parentItem:H.item,targetItem:E.item,depth:E.depth,linearIndex:A},i(z)}}}},[l,s,a,f,d,n,u,t,c,r,i,e,h])},Qee=function(){var t=xi();return M.exports.useCallback(function(e,n){if(e.targetType==="between-items"){if(!t.canReorderItems)return!1}else{var r=t.items[e.targetItem];if(!t.canDropOnItemWithChildren&&r.hasChildren||!t.canDropOnItemWithoutChildren&&!r.hasChildren)return!1}return!(t.canDropAt&&(!n||!t.canDropAt(n,e)))},[t])},cW=globalThis&&globalThis.__spreadArray||function(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t},A7e=function(){var t=xi(),e=Pee(),n=Qee();return M.exports.useCallback(function(r,i){var o=t.linearItems[r];return o.map(function(s,a){var l,c,u=s.item,f=s.depth,h=e(a,r),d=t.items[h.item].children.indexOf(u),O={targetType:"item",parentItem:h.item,targetItem:u,linearIndex:a,depth:f,treeId:r},b={targetType:"between-items",parentItem:h.item,linePosition:"top",childIndex:d,depth:f,treeId:r,linearIndex:a},v={targetType:"between-items",parentItem:h.item,linePosition:"bottom",linearIndex:a+1,childIndex:d+1,depth:f,treeId:r},p=f===((c=(l=o[a-1])===null||l===void 0?void 0:l.depth)!==null&&c!==void 0?c:-1);return p?[O,v]:[b,O,v]}).reduce(function(s,a){return cW(cW([],s),a)},[]).filter(function(s){return n(s,i)})},[n,t.items,t.linearItems,e])},V5=globalThis&&globalThis.__spreadArray||function(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t},a4=function(t,e,n){var r=M.exports.useRef();M.exports.useEffect(function(){if(!r.current)r.current=V5([],n),t();else{var i=r.current.some(function(o,s){return o!==n[s]});i&&(r.current=V5([],n),t())}},V5(V5([],e),n))},l4=globalThis&&globalThis.__assign||function(){return l4=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},l4.apply(this,arguments)},$ee=function(t,e){return t.map(function(n){return[n,e(n)]}).reduce(function(n,r){var i,o=r[0],s=r[1];return l4(l4({},n),(i={},i[o]=s,i))},{})};function Z0(){var t=M.exports.useRef(new Array);M.exports.useEffect(function(){var n=t.current;return function(){return n.forEach(function(r){return cancelAnimationFrame(r)})}},[t]);var e=M.exports.useCallback(function(n){var r=requestAnimationFrame(function(){t.current.splice(t.current.indexOf(r),1),n()});t.current.push(r)},[t]);return e}var Eee=M.exports.createContext(null),Lu=function(){return M.exports.useContext(Eee)},I7e=function(t){var e=xi(),n=M.exports.useState(!1),r=n[0],i=n[1],o=M.exports.useState(4),s=o[0],a=o[1],l=M.exports.useState({}),c=l[0],u=l[1],f=M.exports.useState(0),h=f[0],d=f[1],O=M.exports.useState(),b=O[0],v=O[1],p=M.exports.useState(),g=p[0],y=p[1],S=M.exports.useState("_nodrag"),w=S[0],T=S[1],k=A7e(),A=Z0();M.exports.useRef(!1);var L=M.exports.useCallback(function(re,Te){var Re;if(e.activeTreeId&&((Re=e.viewState[e.activeTreeId])===null||Re===void 0?void 0:Re.focusedItem)&&e.linearItems&&Te){var V=e.viewState[e.activeTreeId].focusedItem,pe=k(e.activeTreeId,Te),J=pe.findIndex(function(ae){if(ae.targetType==="item")return ae.targetItem===V;if(ae.targetType==="between-items")return e.items[ae.parentItem].children[ae.childIndex]===V});d(J?Math.min(J+1,pe.length-1):0)}else d(0)},[e.activeTreeId,e.items,e.linearItems,e.viewState,k]),$=M.exports.useCallback(function(){i(!1),a(4),u({}),d(0),v(void 0),y(void 0),T("_nodrag")},[]);a4(function(){e.activeTreeId&&e.linearItems[e.activeTreeId]&&c[e.activeTreeId]&&L(c[e.activeTreeId],b)},[b,e.activeTreeId,e.linearItems,L,c],[e.activeTreeId]),a4(function(){r&&e.activeTreeId&&y(c[e.activeTreeId][h])},[h,e.activeTreeId,r,c],[h,e.activeTreeId]);var E=Qee(),C=function(re){var Te;b&&!E(re,b)||(y(re),e.setActiveTree(re.treeId),b&&e.activeTreeId!==re.treeId&&((Te=e.onSelectItems)===null||Te===void 0||Te.call(e,b.map(function(Re){return Re.index}),re.treeId)))},I=R7e(w,T,s,y,C),H=M.exports.useCallback(function(){b&&g&&e.onDrop&&(e.onDrop(b,g),A(function(){var re;(re=e.onFocusItem)===null||re===void 0||re.call(e,b[0],g.treeId),$()}))},[b,g,e,$,A]),Y=M.exports.useCallback(function(re,Te){var Re,V,pe=$ee(e.treeIds,function(ae){return k(ae,re)}),J=(V=(Re=document.querySelector('[data-rct-tree="'+Te+'"] [data-rct-item-container="true"]'))===null||Re===void 0?void 0:Re.offsetHeight)!==null&&V!==void 0?V:5;a(J),v(re),u(pe),e.activeTreeId&&L(pe[e.activeTreeId],re)},[e.activeTreeId,e.treeIds,k,L]),z=M.exports.useCallback(function(){var re,Te,Re;if(!!e.canDragAndDrop&&e.activeTreeId){var V=(Te=(re=e.viewState[e.activeTreeId])===null||re===void 0?void 0:re.selectedItems)!==null&&Te!==void 0?Te:[(Re=e.viewState[e.activeTreeId])===null||Re===void 0?void 0:Re.focusedItem];if(V.length===0||V[0]===void 0)return;var pe=V.map(function(J){return e.items[J]});if(e.canDrag&&!e.canDrag(pe))return;Y(pe,e.activeTreeId),setTimeout(function(){i(!0)})}},[Y,e]),U=M.exports.useCallback(function(){$()},[$]),j=M.exports.useCallback(function(){H(),$()},[H,$]),K=M.exports.useCallback(function(){d(function(re){return Math.max(0,re-1)})},[]),se=M.exports.useCallback(function(){e.activeTreeId&&d(function(re){return Math.min(c[e.activeTreeId].length,re+1)})},[e.activeTreeId,c]),G={onStartDraggingItems:Y,startProgrammaticDrag:z,abortProgrammaticDrag:U,completeProgrammaticDrag:j,programmaticDragUp:K,programmaticDragDown:se,draggingItems:b,draggingPosition:g,itemHeight:s,isProgrammaticallyDragging:r,onDragOverTreeHandler:I,viableDragPositions:c};return M.exports.useEffect(function(){return window.addEventListener("dragend",$),window.addEventListener("drop",H),function(){window.removeEventListener("dragend",$),window.removeEventListener("drop",H)}},[H,$]),M.exports.createElement(Eee.Provider,{value:G},t.children)},Yg=globalThis&&globalThis.__assign||function(){return Yg=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},Yg.apply(this,arguments)},z7e=function(t,e){var n=xi(),r=Lu();M.exports.useImperativeHandle(t,function(){return Yg(Yg(Yg({},e),n),{treeEnvironmentContext:n,dragAndDropContext:r})})},uW=globalThis&&globalThis.__spreadArray||function(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t},Cee=M.exports.createContext(null),L7e=function(){return M.exports.useContext(Cee)},N7e=M.exports.forwardRef(function(t,e){var n=xi(),r=n.onCollapseItem,i=n.items;n.trees;var o=n.viewState,s=n.onExpandItem,a=n.onFocusItem,l=n.setActiveTree,c=n.onRenameItem,u=n.onSelectItems,f=n.onPrimaryAction,h=n.linearItems,d=Lu(),O=d.abortProgrammaticDrag,b=d.completeProgrammaticDrag,v=d.programmaticDragDown,p=d.programmaticDragUp,g=d.startProgrammaticDrag,y={abortProgrammaticDrag:M.exports.useCallback(function(){O()},[O]),collapseItem:M.exports.useCallback(function(S,w){r==null||r(i[S],w)},[i,r]),completeProgrammaticDrag:M.exports.useCallback(function(){b()},[b]),expandItem:M.exports.useCallback(function(S,w){s==null||s(i[S],w)},[i,s]),focusItem:M.exports.useCallback(function(S,w){a==null||a(i[S],w)},[i,a]),focusTree:M.exports.useCallback(function(S,w){w===void 0&&(w=!0),l(S,w)},[l]),moveFocusDown:M.exports.useCallback(function(S){var w=h[S],T=w.findIndex(function(L){var $,E=L.item;return E===(($=o[S])===null||$===void 0?void 0:$.focusedItem)}),k=T!==void 0?Math.min(w.length-1,T+1):0,A=i[w[k].item];a==null||a(A,S)},[i,h,a,o]),moveFocusUp:M.exports.useCallback(function(S){var w=h[S],T=w.findIndex(function(L){var $,E=L.item;return E===(($=o[S])===null||$===void 0?void 0:$.focusedItem)}),k=T!==void 0?Math.max(0,T-1):0,A=i[w[k].item];a==null||a(A,S)},[i,h,a,o]),moveProgrammaticDragPositionDown:M.exports.useCallback(function(){v()},[v]),moveProgrammaticDragPositionUp:M.exports.useCallback(function(){p()},[p]),renameItem:M.exports.useCallback(function(S,w,T){c==null||c(i[S],w,T)},[i,c]),selectItems:M.exports.useCallback(function(S,w){u==null||u(S,w)},[u]),startProgrammaticDrag:M.exports.useCallback(function(){g()},[g]),toggleItemExpandedState:M.exports.useCallback(function(S,w){var T,k;!((k=(T=o[w])===null||T===void 0?void 0:T.expandedItems)===null||k===void 0)&&k.includes(S)?r==null||r(i[S],w):s==null||s(i[S],w)},[i,r,s,o]),toggleItemSelectStatus:M.exports.useCallback(function(S,w){var T,k,A,L,$;!((k=(T=o[w])===null||T===void 0?void 0:T.selectedItems)===null||k===void 0)&&k.includes(S)?u==null||u((L=(A=o[w].selectedItems)===null||A===void 0?void 0:A.filter(function(E){return E!==S}))!==null&&L!==void 0?L:[],w):u==null||u(uW(uW([],($=o[w].selectedItems)!==null&&$!==void 0?$:[]),[S]),w)},[u,o]),invokePrimaryAction:M.exports.useCallback(function(S,w){f==null||f(i[S],w)},[i,f])};return z7e(e,y),M.exports.createElement(Cee.Provider,{value:y},t.children)}),M7e=function(t){if(!!t)if(t.scrollIntoViewIfNeeded)t.scrollIntoViewIfNeeded();else{var e=t.getBoundingClientRect(),n=e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth);n||t.scrollIntoView()}},Za=globalThis&&globalThis.__assign||function(){return Za=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},Za.apply(this,arguments)},cd=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.filter(function(n){return!!n}).join(" ")},D7e=function(t){return{renderItemTitle:function(e){var n=e.title,r=e.context,i=e.info;if(!i.isSearching||!r.isSearchMatching)return Xt.createElement(Xt.Fragment,null,n);var o=n.toLowerCase().indexOf(i.search.toLowerCase());return Xt.createElement(Xt.Fragment,null,o>0&&Xt.createElement("span",null,n.slice(0,o)),Xt.createElement("span",{className:"rct-tree-item-search-highlight"},n.slice(o,o+i.search.length)),o+i.search.length<n.length&&Xt.createElement("span",null,n.slice(o+i.search.length,n.length)))},renderItemArrow:function(e){var n=e.item,r=e.context;return Xt.createElement("div",Za({className:cd(n.hasChildren&&"rct-tree-item-arrow-hasChildren","rct-tree-item-arrow")},r.arrowProps),n.hasChildren&&(r.isExpanded?Xt.createElement("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 16 16",enableBackground:"new 0 0 16 16",xmlSpace:"preserve"},Xt.createElement("g",null,Xt.createElement("g",null,Xt.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:`M12,5c-0.28,0-0.53,0.11-0.71,0.29L8,8.59L4.71,5.29C4.53,5.11,4.28,5,4,5
|
|
483
483
|
C3.45,5,3,5.45,3,6c0,0.28,0.11,0.53,0.29,0.71l4,4C7.47,10.89,7.72,11,8,11s0.53-0.11,0.71-0.29l4-4C12.89,6.53,13,6.28,13,6
|
|
484
484
|
C13,5.45,12.55,5,12,5z`,className:"rct-tree-item-arrow-path"})))):Xt.createElement("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 16 16",enableBackground:"new 0 0 16 16",xmlSpace:"preserve"},Xt.createElement("g",null,Xt.createElement("g",null,Xt.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:`M10.71,7.29l-4-4C6.53,3.11,6.28,3,6,3C5.45,3,5,3.45,5,4
|
|
485
485
|
c0,0.28,0.11,0.53,0.29,0.71L8.59,8l-3.29,3.29C5.11,11.47,5,11.72,5,12c0,0.55,0.45,1,1,1c0.28,0,0.53-0.11,0.71-0.29l4-4
|
|
@@ -1142,7 +1142,7 @@ and limitations under the License.
|
|
|
1142
1142
|
`,i=t.state.doc.line(i.number+(n?1:-1)),o=t.bidiSpans(i),c=De.cursor(n?i.from:i.to)}if(l){if(!l(u))return a}else{if(!r)return c;l=r(u)}a=c}}function jRe(t,e,n){let r=t.state.charCategorizer(e),i=r(n);return o=>{let s=r(o);return i==qo.Space&&(i=s),i==s}}function ZRe(t,e,n,r){let i=e.head,o=n?1:-1;if(i==(n?t.state.doc.length:0))return De.cursor(i,e.assoc);let s=e.goalColumn,a,l=t.contentDOM.getBoundingClientRect(),c=t.coordsAtPos(i),u=t.documentTop;if(c)s==null&&(s=c.left-l.left),a=o<0?c.top:c.bottom;else{let d=t.viewState.lineBlockAt(i);s==null&&(s=Math.min(l.right-l.left,t.defaultCharacterWidth*(i-d.from))),a=(o<0?d.top:d.bottom)+u}let f=l.left+s,h=r!=null?r:t.defaultLineHeight>>1;for(let d=0;;d+=10){let O=a+(h+d)*o,b=Ite(t,{x:f,y:O},!1,o);if(O<l.top||O>l.bottom||(o<0?b<i:b>i))return De.cursor(b,e.assoc,void 0,s)}}function OP(t,e,n){let r=t.state.facet(kte).map(i=>i(t));for(;;){let i=!1;for(let o of r)o.between(n.from-1,n.from+1,(s,a,l)=>{n.from>s&&n.from<a&&(n=e.from>n.from?De.cursor(s,1):De.cursor(a,-1),i=!0)});if(!i)return n}}class VRe{constructor(e){this.lastKeyCode=0,this.lastKeyTime=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.rapidCompositionStart=!1,this.mouseSelection=null;for(let n in is){let r=is[n];e.contentDOM.addEventListener(n,i=>{!HW(e,i)||this.ignoreDuringComposition(i)||n=="keydown"&&this.keydown(e,i)||(this.mustFlushObserver(i)&&e.observer.forceFlush(),this.runCustomHandlers(n,e,i)?i.preventDefault():r(e,i))}),this.registeredEvents.push(n)}an.chrome&&an.chrome_version>=102&&e.scrollDOM.addEventListener("wheel",()=>{this.chromeScrollHack<0?e.contentDOM.style.pointerEvents="none":window.clearTimeout(this.chromeScrollHack),this.chromeScrollHack=setTimeout(()=>{this.chromeScrollHack=-1,e.contentDOM.style.pointerEvents=""},100)},{passive:!0}),this.notifiedFocused=e.hasFocus,an.safari&&e.contentDOM.addEventListener("input",()=>null)}setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}ensureHandlers(e,n){var r;let i;this.customHandlers=[];for(let o of n)if(i=(r=o.update(e).spec)===null||r===void 0?void 0:r.domEventHandlers){this.customHandlers.push({plugin:o.value,handlers:i});for(let s in i)this.registeredEvents.indexOf(s)<0&&s!="scroll"&&(this.registeredEvents.push(s),e.contentDOM.addEventListener(s,a=>{!HW(e,a)||this.runCustomHandlers(s,e,a)&&a.preventDefault()}))}}runCustomHandlers(e,n,r){for(let i of this.customHandlers){let o=i.handlers[e];if(o)try{if(o.call(i.plugin,r,n)||r.defaultPrevented)return!0}catch(s){Aa(n.state,s)}}return!1}runScrollHandlers(e,n){for(let r of this.customHandlers){let i=r.handlers.scroll;if(i)try{i.call(r.plugin,n,e)}catch(o){Aa(e.state,o)}}}keydown(e,n){if(this.lastKeyCode=n.keyCode,this.lastKeyTime=Date.now(),n.keyCode==9&&Date.now()<this.lastEscPress+2e3)return!0;if(an.android&&an.chrome&&!n.synthetic&&(n.keyCode==13||n.keyCode==8))return e.observer.delayAndroidKey(n.key,n.keyCode),!0;let r;return an.ios&&(r=zte.find(i=>i.keyCode==n.keyCode))&&!(n.ctrlKey||n.altKey||n.metaKey)&&!n.synthetic?(this.pendingIOSKey=r,setTimeout(()=>this.flushIOSKey(e),250),!0):!1}flushIOSKey(e){let n=this.pendingIOSKey;return n?(this.pendingIOSKey=void 0,Gg(e.contentDOM,n.key,n.keyCode)):!1}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:an.safari&&Date.now()-this.compositionEndedAt<100?(this.compositionEndedAt=0,!0):!1:!1}mustFlushObserver(e){return e.type=="keydown"&&e.keyCode!=229||e.type=="compositionend"&&!an.ios}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.mouseSelection&&this.mouseSelection.update(e),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}const zte=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Lte=[16,17,18,20,91,92,224,225];class GRe{constructor(e,n,r,i){this.view=e,this.style=r,this.mustSelect=i,this.lastEvent=n;let o=e.contentDOM.ownerDocument;o.addEventListener("mousemove",this.move=this.move.bind(this)),o.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(Fn.allowMultipleSelections)&&HRe(e,n),this.dragMove=KRe(e,n),this.dragging=JRe(e,n)&&$R(n)==1?null:!1,this.dragging===!1&&(n.preventDefault(),this.select(n))}move(e){if(e.buttons==0)return this.destroy();this.dragging===!1&&this.select(this.lastEvent=e)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=null}select(e){let n=this.style.get(e,this.extend,this.multiple);(this.mustSelect||!n.eq(this.view.state.selection)||n.main.assoc!=this.view.state.selection.main.assoc)&&this.view.dispatch({selection:n,userEvent:"select.pointer",scrollIntoView:!0}),this.mustSelect=!1}update(e){e.docChanged&&this.dragging&&(this.dragging=this.dragging.map(e.changes)),this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function HRe(t,e){let n=t.state.facet(vte);return n.length?n[0](e):an.mac?e.metaKey:e.ctrlKey}function KRe(t,e){let n=t.state.facet(yte);return n.length?n[0](e):an.mac?!e.altKey:!e.ctrlKey}function JRe(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=p4(t.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let o=0;o<i.length;o++){let s=i[o];if(s.left<=e.clientX&&s.right>=e.clientX&&s.top<=e.clientY&&s.bottom>=e.clientY)return!0}return!1}function HW(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,r;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=Di.get(n))&&r.ignoreEvent(e))return!1;return!0}const is=Object.create(null),Nte=an.ie&&an.ie_version<15||an.ios&&an.webkit_version<604;function eAe(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),Mte(t,n.value)},50)}function Mte(t,e){let{state:n}=t,r,i=1,o=n.toText(e),s=o.lines==n.selection.ranges.length;if(z8!=null&&n.selection.ranges.every(l=>l.empty)&&z8==o.toString()){let l=-1;r=n.changeByRange(c=>{let u=n.doc.lineAt(c.from);if(u.from==l)return{range:c};l=u.from;let f=n.toText((s?o.line(i++).text:e)+n.lineBreak);return{changes:{from:u.from,insert:f},range:De.cursor(c.from+f.length)}})}else s?r=n.changeByRange(l=>{let c=o.line(i++);return{changes:{from:l.from,to:l.to,insert:c.text},range:De.cursor(l.from+c.length)}}):r=n.replaceSelection(o);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}is.keydown=(t,e)=>{t.inputState.setSelectionOrigin("select"),e.keyCode==27?t.inputState.lastEscPress=Date.now():Lte.indexOf(e.keyCode)<0&&(t.inputState.lastEscPress=0)};let Dte=0;is.touchstart=(t,e)=>{Dte=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};is.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};is.mousedown=(t,e)=>{if(t.observer.flush(),Dte>Date.now()-2e3&&$R(e)==1)return;let n=null;for(let r of t.state.facet(bte))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=rAe(t,e)),n){let r=t.root.activeElement!=t.contentDOM;r&&t.observer.ignore(()=>ote(t.contentDOM)),t.inputState.startMouseSelection(new GRe(t,e,n,r))}};function KW(t,e,n,r){if(r==1)return De.cursor(e,n);if(r==2)return URe(t.state,e,n);{let i=na.find(t.docView,e),o=t.state.doc.lineAt(i?i.posAtEnd:e),s=i?i.posAtStart:o.from,a=i?i.posAtEnd:o.to;return a<t.state.doc.length&&a==o.to&&a++,De.range(s,a)}}let Xte=(t,e)=>t>=e.top&&t<=e.bottom,JW=(t,e,n)=>Xte(e,n)&&t>=n.left&&t<=n.right;function tAe(t,e,n,r){let i=na.find(t.docView,e);if(!i)return 1;let o=e-i.posAtStart;if(o==0)return 1;if(o==i.length)return-1;let s=i.coordsAt(o,-1);if(s&&JW(n,r,s))return-1;let a=i.coordsAt(o,1);return a&&JW(n,r,a)?1:s&&Xte(r,s)?-1:1}function eU(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:tAe(t,n,e.clientX,e.clientY)}}const nAe=an.ie&&an.ie_version<=11;let tU=null,nU=0,rU=0;function $R(t){if(!nAe)return t.detail;let e=tU,n=rU;return tU=t,rU=Date.now(),nU=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(nU+1)%3:1}function rAe(t,e){let n=eU(t,e),r=$R(e),i=t.state.selection,o=n,s=e;return{update(a){a.docChanged&&(n&&(n.pos=a.changes.mapPos(n.pos)),i=i.map(a.changes),s=null)},get(a,l,c){let u;if(s&&a.clientX==s.clientX&&a.clientY==s.clientY?u=o:(u=o=eU(t,a),s=a),!u||!n)return i;let f=KW(t,u.pos,u.bias,r);if(n.pos!=u.pos&&!l){let h=KW(t,n.pos,n.bias,r),d=Math.min(h.from,f.from),O=Math.max(h.to,f.to);f=d<f.from?De.range(d,O):De.range(O,d)}return l?i.replaceRange(i.main.extend(f.from,f.to)):c?i.addRange(f):De.create([f])}}}is.dragstart=(t,e)=>{let{selection:{main:n}}=t.state,{mouseSelection:r}=t.inputState;r&&(r.dragging=n),e.dataTransfer&&(e.dataTransfer.setData("Text",t.state.sliceDoc(n.from,n.to)),e.dataTransfer.effectAllowed="copyMove")};function iU(t,e,n,r){if(!n)return;let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);e.preventDefault();let{mouseSelection:o}=t.inputState,s=r&&o&&o.dragging&&o.dragMove?{from:o.dragging.from,to:o.dragging.to}:null,a={from:i,insert:n},l=t.state.changes(s?[s,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(i,-1),head:l.mapPos(i,1)},userEvent:s?"move.drop":"input.drop"})}is.drop=(t,e)=>{if(!e.dataTransfer)return;if(t.state.readOnly)return e.preventDefault();let n=e.dataTransfer.files;if(n&&n.length){e.preventDefault();let r=Array(n.length),i=0,o=()=>{++i==n.length&&iU(t,e,r.filter(s=>s!=null).join(t.state.lineBreak),!1)};for(let s=0;s<n.length;s++){let a=new FileReader;a.onerror=o,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(r[s]=a.result),o()},a.readAsText(n[s])}}else iU(t,e,e.dataTransfer.getData("Text"),!0)};is.paste=(t,e)=>{if(t.state.readOnly)return e.preventDefault();t.observer.flush();let n=Nte?null:e.clipboardData;n?(Mte(t,n.getData("text/plain")),e.preventDefault()):eAe(t)};function iAe(t,e){let n=t.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),t.focus()},50)}function oAe(t){let e=[],n=[],r=!1;for(let i of t.selection.ranges)i.empty||(e.push(t.sliceDoc(i.from,i.to)),n.push(i));if(!e.length){let i=-1;for(let{from:o}of t.selection.ranges){let s=t.doc.lineAt(o);s.number>i&&(e.push(s.text),n.push({from:s.from,to:Math.min(t.doc.length,s.to+1)})),i=s.number}r=!0}return{text:e.join(t.lineBreak),ranges:n,linewise:r}}let z8=null;is.copy=is.cut=(t,e)=>{let{text:n,ranges:r,linewise:i}=oAe(t.state);if(!n&&!i)return;z8=i?n:null;let o=Nte?null:e.clipboardData;o?(e.preventDefault(),o.clearData(),o.setData("text/plain",n)):iAe(t,n),e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"})};function Wte(t){setTimeout(()=>{t.hasFocus!=t.inputState.notifiedFocused&&t.update([])},10)}is.focus=Wte;is.blur=t=>{t.observer.clearSelectionRange(),Wte(t)};function Ute(t,e){if(t.docView.compositionDeco.size){t.inputState.rapidCompositionStart=e;try{t.update([])}finally{t.inputState.rapidCompositionStart=!1}}}is.compositionstart=is.compositionupdate=t=>{t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0,t.docView.compositionDeco.size&&(t.observer.flush(),Ute(t,!0)))};is.compositionend=t=>{t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionFirstChange=null,setTimeout(()=>{t.inputState.composing<0&&Ute(t,!1)},50)};is.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};is.beforeinput=(t,e)=>{var n;let r;if(an.chrome&&an.android&&(r=zte.find(i=>i.inputType==e.inputType))&&(t.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete")){let i=((n=window.visualViewport)===null||n===void 0?void 0:n.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>i+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}};const oU=["pre-wrap","normal","pre-line","break-spaces"];class sAe{constructor(){this.doc=Xr.empty,this.lineWrapping=!1,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.lineLength=30,this.heightChanged=!1}heightForGap(e,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.ceil((n-e-r*this.lineLength*.5)/this.lineLength)),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return oU.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];i<0?r++:this.heightSamples[Math.floor(i*10)]||(n=!0,this.heightSamples[Math.floor(i*10)]=!0)}return n}refresh(e,n,r,i,o){let s=oU.indexOf(e)>-1,a=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=s;if(this.lineWrapping=s,this.lineHeight=n,this.charWidth=r,this.lineLength=i,a){this.heightSamples={};for(let l=0;l<o.length;l++){let c=o[l];c<0?l++:this.heightSamples[Math.floor(c*10)]=!0}}return a}}class aAe{constructor(e,n){this.from=e,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class Wd{constructor(e,n,r,i,o){this.from=e,this.length=n,this.top=r,this.height=i,this.type=o}get to(){return this.from+this.length}get bottom(){return this.top+this.height}join(e){let n=(Array.isArray(this.type)?this.type:[this]).concat(Array.isArray(e.type)?e.type:[e]);return new Wd(this.from,this.length+e.length,this.top,this.height+e.height,n)}}var Ei=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(Ei||(Ei={}));const Xx=.001;class Ia{constructor(e,n,r=2){this.length=e,this.height=n,this.flags=r}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e,n){this.height!=n&&(Math.abs(this.height-n)>Xx&&(e.heightChanged=!0),this.height=n)}replace(e,n,r){return Ia.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,i){let o=this;for(let s=i.length-1;s>=0;s--){let{fromA:a,toA:l,fromB:c,toB:u}=i[s],f=o.lineAt(a,Ei.ByPosNoHeight,n,0,0),h=f.to>=l?f:o.lineAt(l,Ei.ByPosNoHeight,n,0,0);for(u+=h.to-l,l=h.to;s>0&&f.from<=i[s-1].toA;)a=i[s-1].fromA,c=i[s-1].fromB,s--,a<f.from&&(f=o.lineAt(a,Ei.ByPosNoHeight,n,0,0));c+=f.from-a,a=f.from;let d=ER.build(r,e,c,u);o=o.replace(a,l,d)}return o.updateHeight(r,0)}static empty(){return new Ga(0,0)}static of(e){if(e.length==1)return e[0];let n=0,r=e.length,i=0,o=0;for(;;)if(n==r)if(i>o*2){let a=e[n-1];a.break?e.splice(--n,1,a.left,null,a.right):e.splice(--n,1,a.left,a.right),r+=1+a.break,i-=a.size}else if(o>i*2){let a=e[r];a.break?e.splice(r,1,a.left,null,a.right):e.splice(r,1,a.left,a.right),r+=2+a.break,o-=a.size}else break;else if(i<o){let a=e[n++];a&&(i+=a.size)}else{let a=e[--r];a&&(o+=a.size)}let s=0;return e[n-1]==null?(s=1,n--):e[n]==null&&(s=1,r++),new lAe(Ia.of(e.slice(0,n)),s,Ia.of(e.slice(r)))}}Ia.prototype.size=1;class qte extends Ia{constructor(e,n,r){super(e,n),this.type=r}blockAt(e,n,r,i){return new Wd(i,this.length,r,this.height,this.type)}lineAt(e,n,r,i,o){return this.blockAt(0,r,i,o)}forEachLine(e,n,r,i,o,s){e<=o+this.length&&n>=o&&s(this.blockAt(0,r,i,o))}updateHeight(e,n=0,r=!1,i){return i&&i.from<=n&&i.more&&this.setHeight(e,i.heights[i.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Ga extends qte{constructor(e,n){super(e,n,yi.Text),this.collapsed=0,this.widgetHeight=0}replace(e,n,r){let i=r[0];return r.length==1&&(i instanceof Ga||i instanceof ms&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof ms?i=new Ga(i.length,this.height):i.height=this.height,this.outdated||(i.outdated=!1),i):Ia.of(r)}updateHeight(e,n=0,r=!1,i){return i&&i.from<=n&&i.more?this.setHeight(e,i.heights[i.index++]):(r||this.outdated)&&this.setHeight(e,Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class ms extends Ia{constructor(e){super(e,0)}lines(e,n){let r=e.lineAt(n).number,i=e.lineAt(n+this.length).number;return{firstLine:r,lastLine:i,lineHeight:this.height/(i-r+1)}}blockAt(e,n,r,i){let{firstLine:o,lastLine:s,lineHeight:a}=this.lines(n,i),l=Math.max(0,Math.min(s-o,Math.floor((e-r)/a))),{from:c,length:u}=n.line(o+l);return new Wd(c,u,r+a*l,a,yi.Text)}lineAt(e,n,r,i,o){if(n==Ei.ByHeight)return this.blockAt(e,r,i,o);if(n==Ei.ByPosNoHeight){let{from:f,to:h}=r.lineAt(e);return new Wd(f,h-f,0,0,yi.Text)}let{firstLine:s,lineHeight:a}=this.lines(r,o),{from:l,length:c,number:u}=r.lineAt(e);return new Wd(l,c,i+a*(u-s),a,yi.Text)}forEachLine(e,n,r,i,o,s){let{firstLine:a,lineHeight:l}=this.lines(r,o);for(let c=Math.max(e,o),u=Math.min(o+this.length,n);c<=u;){let f=r.lineAt(c);c==e&&(i+=l*(f.number-a)),s(new Wd(f.from,f.length,i,l,yi.Text)),i+=l,c=f.to+1}}replace(e,n,r){let i=this.length-n;if(i>0){let o=r[r.length-1];o instanceof ms?r[r.length-1]=new ms(o.length+i):r.push(null,new ms(i-1))}if(e>0){let o=r[0];o instanceof ms?r[0]=new ms(e+o.length):r.unshift(new ms(e-1),null)}return Ia.of(r)}decomposeLeft(e,n){n.push(new ms(e-1),null)}decomposeRight(e,n){n.push(null,new ms(this.length-e-1))}updateHeight(e,n=0,r=!1,i){let o=n+this.length;if(i&&i.from<=n+this.length&&i.more){let s=[],a=Math.max(n,i.from),l=-1,c=e.heightChanged;for(i.from>n&&s.push(new ms(i.from-n-1).updateHeight(e,n));a<=o&&i.more;){let f=e.doc.lineAt(a).length;s.length&&s.push(null);let h=i.heights[i.index++];l==-1?l=h:Math.abs(h-l)>=Xx&&(l=-2);let d=new Ga(f,h);d.outdated=!1,s.push(d),a+=f+1}a<=o&&s.push(null,new ms(o-a).updateHeight(e,a));let u=Ia.of(s);return e.heightChanged=c||l<0||Math.abs(u.height-this.height)>=Xx||Math.abs(l-this.lines(e.doc,n).lineHeight)>=Xx,u}else(r||this.outdated)&&(this.setHeight(e,e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class lAe extends Ia{constructor(e,n,r){super(e.length+n+r.length,e.height+r.height,n|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,n,r,i){let o=r+this.left.height;return e<o?this.left.blockAt(e,n,r,i):this.right.blockAt(e,n,o,i+this.left.length+this.break)}lineAt(e,n,r,i,o){let s=i+this.left.height,a=o+this.left.length+this.break,l=n==Ei.ByHeight?e<s:e<a,c=l?this.left.lineAt(e,n,r,i,o):this.right.lineAt(e,n,r,s,a);if(this.break||(l?c.to<a:c.from>a))return c;let u=n==Ei.ByPosNoHeight?Ei.ByPosNoHeight:Ei.ByPos;return l?c.join(this.right.lineAt(a,u,r,s,a)):this.left.lineAt(a,u,r,i,o).join(c)}forEachLine(e,n,r,i,o,s){let a=i+this.left.height,l=o+this.left.length+this.break;if(this.break)e<l&&this.left.forEachLine(e,n,r,i,o,s),n>=l&&this.right.forEachLine(e,n,r,a,l,s);else{let c=this.lineAt(l,Ei.ByPos,r,i,o);e<c.from&&this.left.forEachLine(e,c.from-1,r,i,o,s),c.to>=e&&c.from<=n&&s(c),n>c.to&&this.right.forEachLine(c.to+1,n,r,a,l,s)}}replace(e,n,r){let i=this.left.length+this.break;if(n<i)return this.balanced(this.left.replace(e,n,r),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,n-i,r));let o=[];e>0&&this.decomposeLeft(e,o);let s=o.length;for(let a of r)o.push(a);if(e>0&&sU(o,s-1),n<this.length){let a=o.length;this.decomposeRight(n,o),sU(o,a)}return Ia.of(o)}decomposeLeft(e,n){let r=this.left.length;if(e<=r)return this.left.decomposeLeft(e,n);n.push(this.left),this.break&&(r++,e>=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,i=r+this.break;if(e>=i)return this.right.decomposeRight(e-i,n);e<r&&this.left.decomposeRight(e,n),this.break&&e<i&&n.push(null),n.push(this.right)}balanced(e,n){return e.size>2*n.size||n.size>2*e.size?Ia.of(this.break?[e,null,n]:[e,n]):(this.left=e,this.right=n,this.height=e.height+n.height,this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,r=!1,i){let{left:o,right:s}=this,a=n+o.length+this.break,l=null;return i&&i.from<=n+o.length&&i.more?l=o=o.updateHeight(e,n,r,i):o.updateHeight(e,n,r),i&&i.from<=a+s.length&&i.more?l=s=s.updateHeight(e,a,r,i):s.updateHeight(e,a,r),l?this.balanced(o,s):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function sU(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof ms&&(r=t[e+1])instanceof ms&&t.splice(e-1,3,new ms(n.length+1+r.length))}const cAe=5;class ER{constructor(e,n){this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof Ga?i.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Ga(r-this.pos,-1)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,r){if(e<n||r.heightRelevant){let i=r.widget?r.widget.estimatedHeight:0;i<0&&(i=this.oracle.lineHeight);let o=n-e;r.block?this.addBlock(new qte(o,i,r.type)):(o||i>=cAe)&&this.addLineDeco(i,o)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Ga(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,n){let r=new ms(n-e);return this.oracle.doc.lineAt(e).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Ga)return e;let n=new Ga(0,-1);return this.nodes.push(n),n}addBlock(e){this.enterLine(),e.type==yi.WidgetAfter&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,e.type!=yi.WidgetBefore&&(this.covering=e)}addLineDeco(e,n){let r=this.ensureLine();r.length+=n,r.collapsed+=n,r.widgetHeight=Math.max(r.widgetHeight,e),this.writtenTo=this.pos=this.pos+n}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof Ga)&&!this.isCovered?this.nodes.push(new Ga(0,-1)):(this.writtenTo<this.pos||n==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=e;for(let i of this.nodes)i instanceof Ga&&i.updateHeight(this.oracle,r),r+=i?i.length:1;return this.nodes}static build(e,n,r,i){let o=new ER(r,e);return Wr.spans(n,r,i,o,0),o.finish(r)}}function uAe(t,e,n){let r=new fAe;return Wr.compare(t,e,n,r,0),r.changes}class fAe{constructor(){this.changes=[]}compareRange(){}comparePoint(e,n,r,i){(e<n||r&&r.heightRelevant||i&&i.heightRelevant)&&E8(e,n,this.changes,5)}}function dAe(t,e){let n=t.getBoundingClientRect(),r=Math.max(0,n.left),i=Math.min(innerWidth,n.right),o=Math.max(0,n.top),s=Math.min(innerHeight,n.bottom),a=t.ownerDocument.body;for(let l=t.parentNode;l&&l!=a;)if(l.nodeType==1){let c=l,u=window.getComputedStyle(c);if((c.scrollHeight>c.clientHeight||c.scrollWidth>c.clientWidth)&&u.overflow!="visible"){let f=c.getBoundingClientRect();r=Math.max(r,f.left),i=Math.min(i,f.right),o=Math.max(o,f.top),s=Math.min(s,f.bottom)}l=u.position=="absolute"||u.position=="fixed"?c.offsetParent:c.parentNode}else if(l.nodeType==11)l=l.host;else break;return{left:r-n.left,right:Math.max(r,i)-n.left,top:o-(n.top+e),bottom:Math.max(o,s)-(n.top+e)}}function hAe(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class mP{constructor(e,n,r){this.from=e,this.to=n,this.size=r}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++){let i=e[r],o=n[r];if(i.from!=o.from||i.to!=o.to||i.size!=o.size)return!1}return!0}draw(e){return Et.replace({widget:new pAe(this.size,e)}).range(this.from,this.to)}}class pAe extends oc{constructor(e,n){super(),this.size=e,this.vertical=n}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class aU{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.heightOracle=new sAe,this.scaler=uU,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Ai.RTL,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1,this.stateDeco=e.facet(ry).filter(n=>typeof n!="function"),this.heightMap=Ia.empty().applyChanges(this.stateDeco,Xr.empty,this.heightOracle.setDoc(e.doc),[new Ef(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Et.set(this.lineGaps.map(n=>n.draw(!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let i=r?n.head:n.anchor;if(!e.some(({from:o,to:s})=>i>=o&&i<=s)){let{from:o,to:s}=this.lineBlockAt(i);e.push(new r2(o,s))}}this.viewports=e.sort((r,i)=>r.from-i.from),this.scaler=this.heightMap.height<=7e6?uU:new gAe(this.heightOracle.doc,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.state.doc,0,0,e=>{this.viewportLines.push(this.scaler.scale==1?e:bg(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(ry).filter(c=>typeof c!="function");let i=e.changedRanges,o=Ef.extendWithRanges(i,uAe(r,this.stateDeco,e?e.changes:Zi.empty(this.state.doc.length))),s=this.heightMap.height;this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),o),this.heightMap.height!=s&&(e.flags|=2);let a=o.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.head<a.from||n.range.head>a.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,n));let l=!e.changes.empty||e.flags&2||a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,this.updateForViewport(),l&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,r=window.getComputedStyle(n),i=this.heightOracle,o=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Ai.RTL:Ai.LTR;let s=this.heightOracle.mustRefreshForWrapping(o),a=s||this.mustMeasureContent||this.contentDOMHeight!=n.clientHeight;this.contentDOMHeight=n.clientHeight,this.mustMeasureContent=!1;let l=0,c=0,u=parseInt(r.paddingTop)||0,f=parseInt(r.paddingBottom)||0;(this.paddingTop!=u||this.paddingBottom!=f)&&(this.paddingTop=u,this.paddingBottom=f,l|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,l|=8);let h=(this.printing?hAe:dAe)(n,this.paddingTop),d=h.top-this.pixelViewport.top,O=h.bottom-this.pixelViewport.bottom;this.pixelViewport=h;let b=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(b!=this.inView&&(this.inView=b,b&&(a=!0)),!this.inView)return 0;let v=n.clientWidth;if((this.contentDOMWidth!=v||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=v,this.editorHeight=e.scrollDOM.clientHeight,l|=8),a){let g=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(g)&&(s=!0),s||i.lineWrapping&&Math.abs(v-this.contentDOMWidth)>i.charWidth){let{lineHeight:y,charWidth:S}=e.docView.measureTextSize();s=i.refresh(o,y,S,v/S,g),s&&(e.docView.minWidth=0,l|=8)}d>0&&O>0?c=Math.max(d,O):d<0&&O<0&&(c=Math.min(d,O)),i.heightChanged=!1;for(let y of this.viewports){let S=y.from==this.viewport.from?g:e.docView.measureVisibleLineHeights(y);this.heightMap=this.heightMap.updateHeight(i,0,s,new aAe(y.from,S))}i.heightChanged&&(l|=2)}let p=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return p&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(l&2||p)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(s?[]:this.lineGaps)),l|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),l}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,o=this.state.doc,{visibleTop:s,visibleBottom:a}=this,l=new r2(i.lineAt(s-r*1e3,Ei.ByHeight,o,0,0).from,i.lineAt(a+(1-r)*1e3,Ei.ByHeight,o,0,0).to);if(n){let{head:c}=n.range;if(c<l.from||c>l.to){let u=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=i.lineAt(c,Ei.ByPos,o,0,0),h;n.y=="center"?h=(f.top+f.bottom)/2-u/2:n.y=="start"||n.y=="nearest"&&c<l.from?h=f.top:h=f.bottom-u,l=new r2(i.lineAt(h-1e3/2,Ei.ByHeight,o,0,0).from,i.lineAt(h+u+1e3/2,Ei.ByHeight,o,0,0).to)}}return l}mapViewport(e,n){let r=n.mapPos(e.from,-1),i=n.mapPos(e.to,1);return new r2(this.heightMap.lineAt(r,Ei.ByPos,this.state.doc,0,0).from,this.heightMap.lineAt(i,Ei.ByPos,this.state.doc,0,0).to)}viewportIsAppropriate({from:e,to:n},r=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,Ei.ByPos,this.state.doc,0,0),{bottom:o}=this.heightMap.lineAt(n,Ei.ByPos,this.state.doc,0,0),{visibleTop:s,visibleBottom:a}=this;return(e==0||i<=s-Math.max(10,Math.min(-r,250)))&&(n==this.state.doc.length||o>=a+Math.max(10,Math.min(r,250)))&&i>s-2*1e3&&o<a+2*1e3}mapLineGaps(e,n){if(!e.length||n.empty)return e;let r=[];for(let i of e)n.touchesRange(i.from,i.to)||r.push(new mP(n.mapPos(i.from),n.mapPos(i.to),i.size));return r}ensureLineGaps(e){let n=[];if(this.defaultTextDirection!=Ai.LTR)return n;for(let r of this.viewportLines){if(r.length<4e3)continue;let i=OAe(r.from,r.to,this.stateDeco);if(i.total<4e3)continue;let o,s;if(this.heightOracle.lineWrapping){let c=2e3/this.heightOracle.lineLength*this.heightOracle.lineHeight;o=i2(i,(this.visibleTop-r.top-c)/r.height),s=i2(i,(this.visibleBottom-r.top+c)/r.height)}else{let c=i.total*this.heightOracle.charWidth,u=2e3*this.heightOracle.charWidth;o=i2(i,(this.pixelViewport.left-u)/c),s=i2(i,(this.pixelViewport.right+u)/c)}let a=[];o>r.from&&a.push({from:r.from,to:o}),s<r.to&&a.push({from:s,to:r.to});let l=this.state.selection.main;l.from>=r.from&&l.from<=r.to&&cU(a,l.from-10,l.from+10),!l.empty&&l.to>=r.from&&l.to<=r.to&&cU(a,l.to-10,l.to+10);for(let{from:c,to:u}of a)u-c>1e3&&n.push(mAe(e,f=>f.from>=r.from&&f.to<=r.to&&Math.abs(f.from-c)<1e3&&Math.abs(f.to-u)<1e3)||new mP(c,u,this.gapSize(r,c,u,i)))}return n}gapSize(e,n,r,i){let o=lU(i,r)-lU(i,n);return this.heightOracle.lineWrapping?e.height*o:i.total*this.heightOracle.charWidth*o}updateLineGaps(e){mP.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Et.set(e.map(n=>n.draw(this.heightOracle.lineWrapping))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let n=[];Wr.spans(e,this.viewport.from,this.viewport.to,{span(i,o){n.push({from:i,to:o})},point(){}},20);let r=n.length!=this.visibleRanges.length||this.visibleRanges.some((i,o)=>i.from!=n[o].from||i.to!=n[o].to);return this.visibleRanges=n,r?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||bg(this.heightMap.lineAt(e,Ei.ByPos,this.state.doc,0,0),this.scaler)}lineBlockAtHeight(e){return bg(this.heightMap.lineAt(this.scaler.fromDOM(e),Ei.ByHeight,this.state.doc,0,0),this.scaler)}elementAtHeight(e){return bg(this.heightMap.blockAt(this.scaler.fromDOM(e),this.state.doc,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class r2{constructor(e,n){this.from=e,this.to=n}}function OAe(t,e,n){let r=[],i=t,o=0;return Wr.spans(n,t,e,{span(){},point(s,a){s>i&&(r.push({from:i,to:s}),o+=s-i),i=a}},20),i<e&&(r.push({from:i,to:e}),o+=e-i),{total:o,ranges:r}}function i2({total:t,ranges:e},n){if(n<=0)return e[0].from;if(n>=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let i=0;;i++){let{from:o,to:s}=e[i],a=s-o;if(r<=a)return o+r;r-=a}}function lU(t,e){let n=0;for(let{from:r,to:i}of t.ranges){if(e<=i){n+=e-r;break}n+=i-r}return n/t.total}function cU(t,e,n){for(let r=0;r<t.length;r++){let i=t[r];if(i.from<n&&i.to>e){let o=[];i.from<e&&o.push({from:i.from,to:e}),i.to>n&&o.push({from:n,to:i.to}),t.splice(r,1,...o),r+=o.length-1}}}function mAe(t,e){for(let n of t)if(e(n))return n}const uU={toDOM(t){return t},fromDOM(t){return t},scale:1};class gAe{constructor(e,n,r){let i=0,o=0,s=0;this.viewports=r.map(({from:a,to:l})=>{let c=n.lineAt(a,Ei.ByPos,e,0,0).top,u=n.lineAt(l,Ei.ByPos,e,0,0).bottom;return i+=u-c,{from:a,to:l,top:c,bottom:u,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(n.height-i);for(let a of this.viewports)a.domTop=s+(a.top-o)*this.scale,s=a.domBottom=a.domTop+(a.bottom-a.top),o=a.bottom}toDOM(e){for(let n=0,r=0,i=0;;n++){let o=n<this.viewports.length?this.viewports[n]:null;if(!o||e<o.top)return i+(e-r)*this.scale;if(e<=o.bottom)return o.domTop+(e-o.top);r=o.bottom,i=o.domBottom}}fromDOM(e){for(let n=0,r=0,i=0;;n++){let o=n<this.viewports.length?this.viewports[n]:null;if(!o||e<o.domTop)return r+(e-i)/this.scale;if(e<=o.domBottom)return o.top+(e-o.domTop);r=o.bottom,i=o.domBottom}}}function bg(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new Wd(t.from,t.length,n,r-n,Array.isArray(t.type)?t.type.map(i=>bg(i,e)):t.type)}const o2=Wt.define({combine:t=>t.join(" ")}),L8=Wt.define({combine:t=>t.indexOf(!0)>-1}),N8=Ru.newName(),Bte=Ru.newName(),Yte=Ru.newName(),Fte={"&light":"."+Bte,"&dark":"."+Yte};function M8(t,e,n){return new Ru(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,i=>{if(i=="&")return t;if(!n||!n[i])throw new RangeError(`Unsupported selector: ${i}`);return n[i]}):t+" "+r}})}const vAe=M8("."+N8,{"&.cm-editor":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,minHeight:"100%",display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 4px"},".cm-selectionLayer":{zIndex:-1,contain:"size style"},".cm-selectionBackground":{position:"absolute"},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{zIndex:100,contain:"size style",pointerEvents:"none"},"&.cm-focused .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{visibility:"hidden"},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{visibility:"hidden"},"100%":{}},".cm-cursor, .cm-dropCursor":{position:"absolute",borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},"&.cm-focused .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#f3f9ff"},"&dark .cm-activeLine":{backgroundColor:"#223039"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Fte),yAe={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},gP=an.ie&&an.ie_version<=11;class bAe{constructor(e,n,r){this.view=e,this.onChange=n,this.onScrollChanged=r,this.active=!1,this.selectionRange=new SRe,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.scrollTargets=[],this.intersection=null,this.resize=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(i=>{for(let o of i)this.queue.push(o);(an.ie&&an.ie_version<=11||an.ios&&e.composing)&&i.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),gP&&(this.onCharData=i=>{this.queue.push({target:i.target,type:"characterData",oldValue:i.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),window.addEventListener("resize",this.onResize=this.onResize.bind(this)),typeof ResizeObserver=="function"&&(this.resize=new ResizeObserver(()=>{this.view.docView.lastUpdate<Date.now()-75&&this.onResize()}),this.resize.observe(e.scrollDOM)),window.addEventListener("beforeprint",this.onPrint=this.onPrint.bind(this)),this.start(),window.addEventListener("scroll",this.onScroll=this.onScroll.bind(this)),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(i=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),i.length>0&&i[i.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(i=>{i.length>0&&i[i.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange(),this.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}onScroll(e){this.intersecting&&this.flush(!1),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(){this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500)}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,r=this.selectionRange;if(n.state.facet(L_)?n.root.activeElement!=this.dom:!x8(n.dom,r))return;let i=r.anchorNode&&n.docView.nearest(r.anchorNode);i&&i.ignoreEvent(e)||((an.ie&&an.ie_version<=11||an.android&&an.chrome)&&!n.state.selection.main.empty&&r.focusNode&&O4(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1))}readSelectionRange(){let{root:e}=this.view,n=an.safari&&e.nodeType==11&&yRe()==this.view.contentDOM&&xAe(this.view)||p4(e);return!n||this.selectionRange.eq(n)?!1:(this.selectionRange.setRange(n),this.selectionChanged=!0)}setSelectionRange(e,n){this.selectionRange.set(e.node,e.offset,n.node,n.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,n=null;for(let r=this.dom;r;)if(r.nodeType==1)!n&&e<this.scrollTargets.length&&this.scrollTargets[e]==r?e++:n||(n=this.scrollTargets.slice(0,e)),n&&n.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(e<this.scrollTargets.length&&!n&&(n=this.scrollTargets.slice(0,e)),n){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=n)r.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,yAe),gP&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){!this.active||(this.active=!1,this.observer.disconnect(),gP&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,n){this.delayedAndroidKey||requestAnimationFrame(()=>{let r=this.delayedAndroidKey;this.delayedAndroidKey=null,this.delayedFlush=-1,this.flush()||Gg(this.view.contentDOM,r.key,r.keyCode)}),(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n})}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=window.setTimeout(()=>{this.delayedFlush=-1,this.flush()},20))}forceFlush(){this.delayedFlush>=0&&(window.clearTimeout(this.delayedFlush),this.delayedFlush=-1,this.flush())}processRecords(){let e=this.queue;for(let o of this.observer.takeRecords())e.push(o);e.length&&(this.queue=[]);let n=-1,r=-1,i=!1;for(let o of e){let s=this.readMutation(o);!s||(s.typeOver&&(i=!0),n==-1?{from:n,to:r}=s:(n=Math.min(s.from,n),r=Math.max(s.to,r)))}return{from:n,to:r,typeOver:i}}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return;e&&this.readSelectionRange();let{from:n,to:r,typeOver:i}=this.processRecords(),o=this.selectionChanged&&x8(this.dom,this.selectionRange);if(n<0&&!o)return;this.selectionChanged=!1;let s=this.view.state,a=this.onChange(n,r,i);return this.view.state==s&&this.view.update([]),a}readMutation(e){let n=this.view.docView.nearest(e.target);if(!n||n.ignoreMutation(e))return null;if(n.markDirty(e.type=="attributes"),e.type=="attributes"&&(n.dirty|=4),e.type=="childList"){let r=fU(n,e.previousSibling||e.target.previousSibling,-1),i=fU(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:i?n.posBefore(i):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}destroy(){var e,n,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resize)===null||r===void 0||r.disconnect();for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);window.removeEventListener("scroll",this.onScroll),window.removeEventListener("resize",this.onResize),window.removeEventListener("beforeprint",this.onPrint),this.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout)}}function fU(t,e,n){for(;e;){let r=Di.get(e);if(r&&r.parent==t)return r;let i=e.parentNode;e=i!=t.dom?i:n>0?e.nextSibling:e.previousSibling}return null}function xAe(t){let e=null;function n(l){l.preventDefault(),l.stopImmediatePropagation(),e=l.getTargetRanges()[0]}if(t.contentDOM.addEventListener("beforeinput",n,!0),document.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",n,!0),!e)return null;let r=e.startContainer,i=e.startOffset,o=e.endContainer,s=e.endOffset,a=t.docView.domAtPos(t.state.selection.main.anchor);return O4(a.node,a.offset,o,s)&&([r,i,o,s]=[o,s,r,i]),{anchorNode:r,anchorOffset:i,focusNode:o,focusOffset:s}}function SAe(t,e,n,r){let i,o,s=t.state.selection.main;if(e>-1){let a=t.docView.domBoundsAround(e,n,0);if(!a||t.state.readOnly)return!1;let{from:l,to:c}=a,u=t.docView.impreciseHead||t.docView.impreciseAnchor?[]:_Ae(t),f=new Cte(u,t.state);f.readRange(a.startDOM,a.endDOM);let h=s.from,d=null;(t.inputState.lastKeyCode===8&&t.inputState.lastKeyTime>Date.now()-100||an.android&&f.text.length<c-l)&&(h=s.to,d="end");let O=wAe(t.state.doc.sliceString(l,c,Xd),f.text,h-l,d);O&&(an.chrome&&t.inputState.lastKeyCode==13&&O.toB==O.from+2&&f.text.slice(O.from,O.toB)==Xd+Xd&&O.toB--,i={from:l+O.from,to:l+O.toA,insert:Xr.of(f.text.slice(O.from,O.toB).split(Xd))}),o=TAe(u,l)}else if(t.hasFocus||!t.state.facet(L_)){let a=t.observer.selectionRange,{impreciseHead:l,impreciseAnchor:c}=t.docView,u=l&&l.node==a.focusNode&&l.offset==a.focusOffset||!c0(t.contentDOM,a.focusNode)?t.state.selection.main.head:t.docView.posFromDOM(a.focusNode,a.focusOffset),f=c&&c.node==a.anchorNode&&c.offset==a.anchorOffset||!c0(t.contentDOM,a.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(a.anchorNode,a.anchorOffset);(u!=s.head||f!=s.anchor)&&(o=De.single(f,u))}if(!i&&!o)return!1;if(!i&&r&&!s.empty&&o&&o.main.empty?i={from:s.from,to:s.to,insert:t.state.doc.slice(s.from,s.to)}:i&&i.from>=s.from&&i.to<=s.to&&(i.from!=s.from||i.to!=s.to)&&s.to-s.from-(i.to-i.from)<=4?i={from:s.from,to:s.to,insert:t.state.doc.slice(s.from,i.from).append(i.insert).append(t.state.doc.slice(i.to,s.to))}:(an.mac||an.android)&&i&&i.from==i.to&&i.from==s.head-1&&i.insert.toString()=="."&&(i={from:s.from,to:s.to,insert:Xr.of([" "])}),i){let a=t.state;if(an.ios&&t.inputState.flushIOSKey(t)||an.android&&(i.from==s.from&&i.to==s.to&&i.insert.length==1&&i.insert.lines==2&&Gg(t.contentDOM,"Enter",13)||i.from==s.from-1&&i.to==s.to&&i.insert.length==0&&Gg(t.contentDOM,"Backspace",8)||i.from==s.from&&i.to==s.to+1&&i.insert.length==0&&Gg(t.contentDOM,"Delete",46)))return!0;let l=i.insert.toString();if(t.state.facet(Ste).some(f=>f(t,i.from,i.to,l)))return!0;t.inputState.composing>=0&&t.inputState.composing++;let c;if(i.from>=s.from&&i.to<=s.to&&i.to-i.from>=(s.to-s.from)/3&&(!o||o.main.empty&&o.main.from==i.from+i.insert.length)&&t.inputState.composing<0){let f=s.from<i.from?a.sliceDoc(s.from,i.from):"",h=s.to>i.to?a.sliceDoc(i.to,s.to):"";c=a.replaceSelection(t.state.toText(f+i.insert.sliceString(0,void 0,t.state.lineBreak)+h))}else{let f=a.changes(i),h=o&&!a.selection.main.eq(o.main)&&o.main.to<=f.newLength?o.main:void 0;if(a.selection.ranges.length>1&&t.inputState.composing>=0&&i.to<=s.to&&i.to>=s.to-10){let d=t.state.sliceDoc(i.from,i.to),O=Rte(t)||t.state.doc.lineAt(s.head),b=s.to-i.to,v=s.to-s.from;c=a.changeByRange(p=>{if(p.from==s.from&&p.to==s.to)return{changes:f,range:h||p.map(f)};let g=p.to-b,y=g-d.length;if(p.to-p.from!=v||t.state.sliceDoc(y,g)!=d||O&&p.to>=O.from&&p.from<=O.to)return{range:p};let S=a.changes({from:y,to:g,insert:i.insert}),w=p.to-s.to;return{changes:S,range:h?De.range(Math.max(0,h.anchor+w),Math.max(0,h.head+w)):p.map(S)}})}else c={changes:f,selection:h&&a.selection.replaceRange(h)}}let u="input.type";return t.composing&&(u+=".compose",t.inputState.compositionFirstChange&&(u+=".start",t.inputState.compositionFirstChange=!1)),t.dispatch(c,{scrollIntoView:!0,userEvent:u}),!0}else if(o&&!o.main.eq(s)){let a=!1,l="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(a=!0),l=t.inputState.lastSelectionOrigin),t.dispatch({selection:o,scrollIntoView:a,userEvent:l}),!0}else return!1}function wAe(t,e,n,r){let i=Math.min(t.length,e.length),o=0;for(;o<i&&t.charCodeAt(o)==e.charCodeAt(o);)o++;if(o==i&&t.length==e.length)return null;let s=t.length,a=e.length;for(;s>0&&a>0&&t.charCodeAt(s-1)==e.charCodeAt(a-1);)s--,a--;if(r=="end"){let l=Math.max(0,o-Math.min(s,a));n-=s+l-o}return s<o&&t.length<e.length?(o-=n<=o&&n>=s?o-n:0,a=o+(a-s),s=o):a<o&&(o-=n<=o&&n>=a?o-n:0,s=o+(s-a),a=o),{from:o,toA:s,toB:a}}function _Ae(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}=t.observer.selectionRange;return n&&(e.push(new qW(n,r)),(i!=n||o!=r)&&e.push(new qW(i,o))),e}function TAe(t,e){if(t.length==0)return null;let n=t[0].pos,r=t.length==2?t[1].pos:n;return n>-1&&r>-1?De.single(n+e,r+e):null}class _t{constructor(e={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.style.cssText="position: absolute; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),this._dispatch=e.dispatch||(n=>this.update([n])),this.dispatch=this.dispatch.bind(this),this.root=e.root||wRe(e.parent)||document,this.viewState=new aU(e.state||Fn.create(e)),this.plugins=this.state.facet(vg).map(n=>new hP(n));for(let n of this.plugins)n.update(this);this.observer=new bAe(this,(n,r,i)=>SAe(this,n,r,i),n=>{this.inputState.runScrollHandlers(this,n),this.observer.intersecting&&this.measure()}),this.inputState=new VRe(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new BW(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),e.parent&&e.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}dispatch(...e){this._dispatch(e.length==1&&e[0]instanceof Gi?e[0]:this.state.update(...e))}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,i,o=this.state;for(let a of e){if(a.startState!=o)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=a.state}if(this.destroyed){this.viewState.state=o;return}if(this.observer.clear(),o.facet(Fn.phrases)!=this.state.facet(Fn.phrases))return this.setState(o);i=v4.create(this,o,e);let s=this.viewState.scrollTarget;try{this.updateState=2;for(let a of e){if(s&&(s=s.map(a.changes)),a.scrollIntoView){let{main:l}=a.state.selection;s=new g4(l.empty?l:De.cursor(l.head,l.head>l.anchor?-1:1))}for(let l of a.effects)l.is(WW)&&(s=l.value)}this.viewState.update(i,s),this.bidiCache=y4.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(yg)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(a=>a.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(o2)!=i.state.facet(o2)&&(this.viewState.mustMeasureContent=!0),(n||r||s||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!i.empty)for(let a of this.state.facet(C8))a(i)}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new aU(e),this.plugins=e.facet(vg).map(r=>new hP(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView=new BW(this),this.inputState.ensureHandlers(this,this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(vg),r=e.state.facet(vg);if(n!=r){let i=[];for(let o of r){let s=n.indexOf(o);if(s<0)i.push(new hP(o));else{let a=this.plugins[s];a.mustUpdate=e,i.push(a)}}for(let o of this.plugins)o.mustUpdate!=e&&o.destroy(this);this.plugins=i,this.pluginMap.clear(),this.inputState.ensureHandlers(this,this.plugins)}else for(let i of this.plugins)i.mustUpdate=e;for(let i=0;i<this.plugins.length;i++)this.plugins[i].update(this)}measure(e=!0){if(this.destroyed)return;this.measureScheduled>-1&&cancelAnimationFrame(this.measureScheduled),this.measureScheduled=0,e&&this.observer.flush();let n=null;try{for(let r=0;;r++){this.updateState=1;let i=this.viewport,o=this.viewState.measure(this);if(!o&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(r>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let s=[];o&4||([this.measureRequests,s]=[s,this.measureRequests]);let a=s.map(f=>{try{return f.read(this)}catch(h){return Aa(this.state,h),dU}}),l=v4.create(this,this.state,[]),c=!1,u=!1;l.flags|=o,n?n.flags|=o:n=l,this.updateState=2,l.empty||(this.updatePlugins(l),this.inputState.update(l),this.updateAttrs(),c=this.docView.update(l));for(let f=0;f<s.length;f++)if(a[f]!=dU)try{let h=s[f];h.write&&h.write(a[f],this)}catch(h){Aa(this.state,h)}if(this.viewState.scrollTarget&&(this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,u=!0),c&&this.docView.updateSelection(!0),this.viewport.from==i.from&&this.viewport.to==i.to&&!u&&this.measureRequests.length==0)break}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let r of this.state.facet(C8))r(n)}get themeClasses(){return N8+" "+(this.state.facet(L8)?Yte:Bte)+" "+this.state.facet(o2)}updateAttrs(){let e=hU(this,_te,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(L_)?"true":"false",class:"cm-content",style:`${an.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),hU(this,Tte,n);let r=this.observer.ignore(()=>{let i=$8(this.contentDOM,this.contentAttrs,n),o=$8(this.dom,this.editorAttrs,e);return i||o});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let i of r.effects)if(i.is(_t.announce)){n&&(this.announceDOM.textContent=""),n=!1;let o=this.announceDOM.appendChild(document.createElement("div"));o.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(yg),Ru.mount(this.root,this.styleModules.concat(vAe).reverse())}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=requestAnimationFrame(()=>this.measure())),e){if(e.key!=null){for(let n=0;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===e.key){this.measureRequests[n]=e;return}}this.measureRequests.push(e)}}plugin(e){let n=this.pluginMap.get(e);return(n===void 0||n&&n.spec!=e)&&this.pluginMap.set(e,n=this.plugins.find(r=>r.spec==e)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,n,r){return OP(this,e,GW(this,e,n,r))}moveByGroup(e,n){return OP(this,e,GW(this,e,n,r=>jRe(this,e.head,r)))}moveToLineBoundary(e,n,r=!0){return FRe(this,e,n,r)}moveVertically(e,n,r){return OP(this,e,ZRe(this,e,n,r))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){return this.readMeasured(),Ite(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.docView.coordsAt(e,n);if(!r||r.left==r.right)return r;let i=this.state.doc.lineAt(e),o=this.bidiSpans(i),s=o[I1.find(o,e-i.from,-1,n)];return A_(r,s.dir==Ai.LTR==n>0)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(wte)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>kAe)return $te(e.length);let n=this.textDirectionAt(e.from);for(let i of this.bidiCache)if(i.from==e.from&&i.dir==n)return i.order;let r=ARe(e.text,n);return this.bidiCache.push(new y4(e.from,e.to,n,r)),r}get hasFocus(){var e;return(document.hasFocus()||an.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{ote(this.contentDOM),this.docView.updateSelection()})}destroy(){for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,n={}){return WW.of(new g4(typeof e=="number"?De.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}static domEventHandlers(e){return Ur.define(()=>({}),{eventHandlers:e})}static theme(e,n){let r=Ru.newName(),i=[o2.of(r),yg.of(M8(`.${r}`,e))];return n&&n.dark&&i.push(L8.of(!0)),i}static baseTheme(e){return Zf.lowest(yg.of(M8("."+N8,e,Fte)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),i=r&&Di.get(r)||Di.get(e);return((n=i==null?void 0:i.rootView)===null||n===void 0?void 0:n.view)||null}}_t.styleModule=yg;_t.inputHandler=Ste;_t.perLineTextDirection=wte;_t.exceptionSink=xte;_t.updateListener=C8;_t.editable=L_;_t.mouseSelectionStyle=bte;_t.dragMovesSelection=yte;_t.clickAddsSelectionRange=vte;_t.decorations=ry;_t.atomicRanges=kte;_t.scrollMargins=Pte;_t.darkTheme=L8;_t.contentAttributes=Tte;_t.editorAttributes=_te;_t.lineWrapping=_t.contentAttributes.of({class:"cm-lineWrapping"});_t.announce=ln.define();const kAe=4096,dU={};class y4{constructor(e,n,r,i){this.from=e,this.to=n,this.dir=r,this.order=i}static update(e,n){if(n.empty)return e;let r=[],i=e.length?e[e.length-1].dir:Ai.LTR;for(let o=Math.max(0,e.length-10);o<e.length;o++){let s=e[o];s.dir==i&&!n.touchesRange(s.from,s.to)&&r.push(new y4(n.mapPos(s.from,1),n.mapPos(s.to,-1),s.dir,s.order))}return r}}function hU(t,e,n){for(let r=t.state.facet(e),i=r.length-1;i>=0;i--){let o=r[i],s=typeof o=="function"?o(t):o;s&&Q8(s,n)}return n}const PAe=an.mac?"mac":an.windows?"win":an.linux?"linux":"key";function QAe(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let i,o,s,a;for(let l=0;l<n.length-1;++l){const c=n[l];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))i=!0;else if(/^(c|ctrl|control)$/i.test(c))o=!0;else if(/^s(hift)?$/i.test(c))s=!0;else if(/^mod$/i.test(c))e=="mac"?a=!0:o=!0;else throw new Error("Unrecognized modifier name: "+c)}return i&&(r="Alt-"+r),o&&(r="Ctrl-"+r),a&&(r="Meta-"+r),s&&(r="Shift-"+r),r}function s2(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n!==!1&&e.shiftKey&&(t="Shift-"+t),t}const $Ae=_t.domEventHandlers({keydown(t,e){return Zte(jte(e.state),t,e,"editor")}}),Vf=Wt.define({enables:$Ae}),pU=new WeakMap;function jte(t){let e=t.facet(Vf),n=pU.get(e);return n||pU.set(e,n=RAe(e.reduce((r,i)=>r.concat(i),[]))),n}function EAe(t,e,n){return Zte(jte(t.state),e,t,n)}let Id=null;const CAe=4e3;function RAe(t,e=PAe){let n=Object.create(null),r=Object.create(null),i=(s,a)=>{let l=r[s];if(l==null)r[s]=a;else if(l!=a)throw new Error("Key binding "+s+" is used both as a regular binding and as a multi-stroke prefix")},o=(s,a,l,c)=>{let u=n[s]||(n[s]=Object.create(null)),f=a.split(/ (?!$)/).map(O=>QAe(O,e));for(let O=1;O<f.length;O++){let b=f.slice(0,O).join(" ");i(b,!0),u[b]||(u[b]={preventDefault:!0,commands:[v=>{let p=Id={view:v,prefix:b,scope:s};return setTimeout(()=>{Id==p&&(Id=null)},CAe),!0}]})}let h=f.join(" ");i(h,!1);let d=u[h]||(u[h]={preventDefault:!1,commands:[]});d.commands.push(l),c&&(d.preventDefault=!0)};for(let s of t){let a=s[e]||s.key;if(!!a)for(let l of s.scope?s.scope.split(" "):["editor"])o(l,a,s.run,s.preventDefault),s.shift&&o(l,"Shift-"+a,s.shift,s.preventDefault)}return n}function Zte(t,e,n,r){let i=vRe(e),o=vs(i,0),s=Ka(o)==i.length&&i!=" ",a="",l=!1;Id&&Id.view==n&&Id.scope==r&&(a=Id.prefix+" ",(l=Lte.indexOf(e.keyCode)<0)&&(Id=null));let c=h=>{if(h){for(let d of h.commands)if(d(n))return!0;h.preventDefault&&(l=!0)}return!1},u=t[r],f;if(u){if(c(u[a+s2(i,e,!s)]))return!0;if(s&&(e.shiftKey||e.altKey||e.metaKey||o>127)&&(f=ph[e.keyCode])&&f!=i){if(c(u[a+s2(f,e,!0)]))return!0;if(e.shiftKey&&l0[e.keyCode]!=f&&c(u[a+s2(l0[e.keyCode],e,!1)]))return!0}else if(s&&e.shiftKey&&c(u[a+s2(i,e,!0)]))return!0}return l}const Vte=!an.ios,xg=Wt.define({combine(t){return fa(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function CR(t={}){return[xg.of(t),AAe,IAe]}class Gte{constructor(e,n,r,i,o){this.left=e,this.top=n,this.width=r,this.height=i,this.className=o}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width>=0&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}}const AAe=Ur.fromClass(class{constructor(t){this.view=t,this.rangePieces=[],this.cursors=[],this.measureReq={read:this.readPos.bind(this),write:this.drawSel.bind(this)},this.selectionLayer=t.scrollDOM.appendChild(document.createElement("div")),this.selectionLayer.className="cm-selectionLayer",this.selectionLayer.setAttribute("aria-hidden","true"),this.cursorLayer=t.scrollDOM.appendChild(document.createElement("div")),this.cursorLayer.className="cm-cursorLayer",this.cursorLayer.setAttribute("aria-hidden","true"),t.requestMeasure(this.measureReq),this.setBlinkRate()}setBlinkRate(){this.cursorLayer.style.animationDuration=this.view.state.facet(xg).cursorBlinkRate+"ms"}update(t){let e=t.startState.facet(xg)!=t.state.facet(xg);(e||t.selectionSet||t.geometryChanged||t.viewportChanged)&&this.view.requestMeasure(this.measureReq),t.transactions.some(n=>n.scrollIntoView)&&(this.cursorLayer.style.animationName=this.cursorLayer.style.animationName=="cm-blink"?"cm-blink2":"cm-blink"),e&&this.setBlinkRate()}readPos(){let{state:t}=this.view,e=t.facet(xg),n=t.selection.ranges.map(i=>i.empty?[]:zAe(this.view,i)).reduce((i,o)=>i.concat(o)),r=[];for(let i of t.selection.ranges){let o=i==t.selection.main;if(i.empty?!o||Vte:e.drawRangeCursor){let s=LAe(this.view,i,o);s&&r.push(s)}}return{rangePieces:n,cursors:r}}drawSel({rangePieces:t,cursors:e}){if(t.length!=this.rangePieces.length||t.some((n,r)=>!n.eq(this.rangePieces[r]))){this.selectionLayer.textContent="";for(let n of t)this.selectionLayer.appendChild(n.draw());this.rangePieces=t}if(e.length!=this.cursors.length||e.some((n,r)=>!n.eq(this.cursors[r]))){let n=this.cursorLayer.children;if(n.length!==e.length){this.cursorLayer.textContent="";for(const r of e)this.cursorLayer.appendChild(r.draw())}else e.forEach((r,i)=>r.adjust(n[i]));this.cursors=e}}destroy(){this.selectionLayer.remove(),this.cursorLayer.remove()}}),Hte={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};Vte&&(Hte[".cm-line"].caretColor="transparent !important");const IAe=Zf.highest(_t.theme(Hte));function Kte(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Ai.LTR?e.left:e.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,top:e.top-t.scrollDOM.scrollTop}}function OU(t,e,n){let r=De.cursor(e);return{from:Math.max(n.from,t.moveToLineBoundary(r,!1,!0).from),to:Math.min(n.to,t.moveToLineBoundary(r,!0,!0).from),type:yi.Text}}function mU(t,e){let n=t.lineBlockAt(e);if(Array.isArray(n.type)){for(let r of n.type)if(r.to>e||r.to==e&&(r.to==n.to||r.type==yi.Text))return r}return n}function zAe(t,e){if(e.to<=t.viewport.from||e.from>=t.viewport.to)return[];let n=Math.max(e.from,t.viewport.from),r=Math.min(e.to,t.viewport.to),i=t.textDirection==Ai.LTR,o=t.contentDOM,s=o.getBoundingClientRect(),a=Kte(t),l=window.getComputedStyle(o.firstChild),c=s.left+parseInt(l.paddingLeft)+Math.min(0,parseInt(l.textIndent)),u=s.right-parseInt(l.paddingRight),f=mU(t,n),h=mU(t,r),d=f.type==yi.Text?f:null,O=h.type==yi.Text?h:null;if(t.lineWrapping&&(d&&(d=OU(t,n,d)),O&&(O=OU(t,r,O))),d&&O&&d.from==O.from)return v(p(e.from,e.to,d));{let y=d?p(e.from,null,d):g(f,!1),S=O?p(null,e.to,O):g(h,!0),w=[];return(d||f).to<(O||h).from-1?w.push(b(c,y.bottom,u,S.top)):y.bottom<S.top&&t.elementAtHeight((y.bottom+S.top)/2).type==yi.Text&&(y.bottom=S.top=(y.bottom+S.top)/2),v(y).concat(w).concat(v(S))}function b(y,S,w,T){return new Gte(y-a.left,S-a.top-.01,w-y,T-S+.01,"cm-selectionBackground")}function v({top:y,bottom:S,horizontal:w}){let T=[];for(let k=0;k<w.length;k+=2)T.push(b(w[k],y,w[k+1],S));return T}function p(y,S,w){let T=1e9,k=-1e9,A=[];function L(C,I,H,Y,z){let U=t.coordsAtPos(C,C==w.to?-2:2),j=t.coordsAtPos(H,H==w.from?2:-2);T=Math.min(U.top,j.top,T),k=Math.max(U.bottom,j.bottom,k),z==Ai.LTR?A.push(i&&I?c:U.left,i&&Y?u:j.right):A.push(!i&&Y?c:j.left,!i&&I?u:U.right)}let $=y!=null?y:w.from,E=S!=null?S:w.to;for(let C of t.visibleRanges)if(C.to>$&&C.from<E)for(let I=Math.max(C.from,$),H=Math.min(C.to,E);;){let Y=t.state.doc.lineAt(I);for(let z of t.bidiSpans(Y)){let U=z.from+Y.from,j=z.to+Y.from;if(U>=H)break;j>I&&L(Math.max(U,I),y==null&&U<=$,Math.min(j,H),S==null&&j>=E,z.dir)}if(I=Y.to+1,I>=H)break}return A.length==0&&L($,y==null,E,S==null,t.textDirection),{top:T,bottom:k,horizontal:A}}function g(y,S){let w=s.top+(S?y.top:y.bottom);return{top:w,bottom:w,horizontal:[]}}}function LAe(t,e,n){let r=t.coordsAtPos(e.head,e.assoc||1);if(!r)return null;let i=Kte(t);return new Gte(r.left-i.left,r.top-i.top,-1,r.bottom-r.top,n?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary")}const Jte=ln.define({map(t,e){return t==null?null:e.mapPos(t)}}),Sg=hi.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(Jte)?r.value:n,t)}}),NAe=Ur.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let n=t.state.field(Sg);n==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(Sg)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let t=this.view.state.field(Sg),e=t!=null&&this.view.coordsAtPos(t);if(!e)return null;let n=this.view.scrollDOM.getBoundingClientRect();return{left:e.left-n.left+this.view.scrollDOM.scrollLeft,top:e.top-n.top+this.view.scrollDOM.scrollTop,height:e.bottom-e.top}}drawCursor(t){this.cursor&&(t?(this.cursor.style.left=t.left+"px",this.cursor.style.top=t.top+"px",this.cursor.style.height=t.height+"px"):this.cursor.style.left="-100000px")}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(Sg)!=t&&this.view.dispatch({effects:Jte.of(t)})}},{eventHandlers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){(t.target==this.view.contentDOM||!this.view.contentDOM.contains(t.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function ene(){return[Sg,NAe]}function gU(t,e,n,r,i){e.lastIndex=0;for(let o=t.iterRange(n,r),s=n,a;!o.next().done;s+=o.value.length)if(!o.lineBreak)for(;a=e.exec(o.value);)i(s+a.index,s+a.index+a[0].length,a)}function MAe(t,e){let n=t.visibleRanges;if(n.length==1&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;let r=[];for(let{from:i,to:o}of n)i=Math.max(t.state.doc.lineAt(i).from,i-e),o=Math.min(t.state.doc.lineAt(o).to,o+e),r.length&&r[r.length-1].to>=i?r[r.length-1].to=o:r.push({from:i,to:o});return r}class tne{constructor(e){let{regexp:n,decoration:r,boundary:i,maxLength:o=1e3}=e;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");this.regexp=n,this.getDeco=typeof r=="function"?r:()=>r,this.boundary=i,this.maxLength=o}createDeco(e){let n=new Cu;for(let{from:r,to:i}of MAe(e,this.maxLength))gU(e.state.doc,this.regexp,r,i,(o,s,a)=>n.add(o,s,this.getDeco(a,e,o)));return n.finish()}updateDeco(e,n){let r=1e9,i=-1;return e.docChanged&&e.changes.iterChanges((o,s,a,l)=>{l>e.view.viewport.from&&a<e.view.viewport.to&&(r=Math.min(a,r),i=Math.max(l,i))}),e.viewportChanged||i-r>1e3?this.createDeco(e.view):i>-1?this.updateRange(e.view,n.map(e.changes),r,i):n}updateRange(e,n,r,i){for(let o of e.visibleRanges){let s=Math.max(o.from,r),a=Math.min(o.to,i);if(a>s){let l=e.state.doc.lineAt(s),c=l.to<a?e.state.doc.lineAt(a):l,u=Math.max(o.from,l.from),f=Math.min(o.to,c.to);if(this.boundary){for(;s>l.from;s--)if(this.boundary.test(l.text[s-1-l.from])){u=s;break}for(;a<c.to;a++)if(this.boundary.test(c.text[a-c.from])){f=a;break}}let h=[],d;if(l==c)for(this.regexp.lastIndex=u-l.from;(d=this.regexp.exec(l.text))&&d.index<f-l.from;){let O=d.index+l.from;h.push(this.getDeco(d,e,O).range(O,O+d[0].length))}else gU(e.state.doc,this.regexp,u,f,(O,b,v)=>h.push(this.getDeco(v,e,O).range(O,b)));n=n.update({filterFrom:u,filterTo:f,filter:(O,b)=>O<u||b>f,add:h})}}return n}}const D8=/x/.unicode!=null?"gu":"g",DAe=new RegExp(`[\0-\b
|
|
1143
1143
|
-\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\uFEFF\uFFF9-\uFFFC]`,D8),XAe={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let vP=null;function WAe(){var t;if(vP==null&&typeof document!="undefined"&&document.body){let e=document.body.style;vP=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return vP||!1}const Wx=Wt.define({combine(t){let e=fa(t,{render:null,specialChars:DAe,addSpecialChars:null});return(e.replaceTabs=!WAe())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,D8)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,D8)),e}});function RR(t={}){return[Wx.of(t),UAe()]}let vU=null;function UAe(){return vU||(vU=Ur.fromClass(class{constructor(t){this.view=t,this.decorations=Et.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(Wx)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new tne({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:i}=n.state,o=vs(e[0],0);if(o==9){let s=i.lineAt(r),a=n.state.tabSize,l=rb(s.text,a,r-s.from);return Et.replace({widget:new FAe((a-l%a)*this.view.defaultCharacterWidth)})}return this.decorationCache[o]||(this.decorationCache[o]=Et.replace({widget:new YAe(t,o)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(Wx);t.startState.facet(Wx)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}const qAe="\u2022";function BAe(t){return t>=32?qAe:t==10?"\u2424":String.fromCharCode(9216+t)}class YAe extends oc{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=BAe(this.code),r=e.state.phrase("Control character")+" "+(XAe[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,r,n);if(i)return i;let o=document.createElement("span");return o.textContent=n,o.title=r,o.setAttribute("aria-label",r),o.className="cm-specialChar",o}ignoreEvent(){return!1}}class FAe extends oc{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function nne(){return ZAe}const jAe=Et.line({class:"cm-activeLine"}),ZAe=Ur.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let r of t.state.selection.ranges){if(!r.empty)return Et.none;let i=t.lineBlockAt(r.head);i.from>e&&(n.push(jAe.range(i.from)),e=i.from)}return Et.set(n)}},{decorations:t=>t.decorations});class VAe extends oc{constructor(e){super(),this.content=e}toDOM(){let e=document.createElement("span");return e.className="cm-placeholder",e.style.pointerEvents="none",e.appendChild(typeof this.content=="string"?document.createTextNode(this.content):this.content),typeof this.content=="string"?e.setAttribute("aria-label","placeholder "+this.content):e.setAttribute("aria-hidden","true"),e}ignoreEvent(){return!1}}function GAe(t){return Ur.fromClass(class{constructor(e){this.view=e,this.placeholder=Et.set([Et.widget({widget:new VAe(t),side:1}).range(0)])}get decorations(){return this.view.state.doc.length?Et.none:this.placeholder}},{decorations:e=>e.decorations})}const X8=2e3;function HAe(t,e,n){let r=Math.min(e.line,n.line),i=Math.max(e.line,n.line),o=[];if(e.off>X8||n.off>X8||e.col<0||n.col<0){let s=Math.min(e.off,n.off),a=Math.max(e.off,n.off);for(let l=r;l<=i;l++){let c=t.doc.line(l);c.length<=a&&o.push(De.range(c.from+s,c.to+a))}}else{let s=Math.min(e.col,n.col),a=Math.max(e.col,n.col);for(let l=r;l<=i;l++){let c=t.doc.line(l),u=v8(c.text,s,t.tabSize,!0);if(u>-1){let f=v8(c.text,a,t.tabSize);o.push(De.range(c.from+u,c.from+f))}}}return o}function KAe(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function yU(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),r=t.state.doc.lineAt(n),i=n-r.from,o=i>X8?-1:i==r.length?KAe(t,e.clientX):rb(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:o,off:i}}function JAe(t,e){let n=yU(t,e),r=t.state.selection;return n?{update(i){if(i.docChanged){let o=i.changes.mapPos(i.startState.doc.line(n.line).from),s=i.state.doc.lineAt(o);n={line:s.number,col:n.col,off:Math.min(n.off,s.length)},r=r.map(i.changes)}},get(i,o,s){let a=yU(t,i);if(!a)return r;let l=HAe(t.state,n,a);return l.length?s?De.create(l.concat(r.ranges)):De.create(l):r}}:null}function rne(t){let e=(t==null?void 0:t.eventFilter)||(n=>n.altKey&&n.button==0);return _t.mouseSelectionStyle.of((n,r)=>e(r)?JAe(n,r):null)}const eIe={Alt:[18,t=>t.altKey],Control:[17,t=>t.ctrlKey],Shift:[16,t=>t.shiftKey],Meta:[91,t=>t.metaKey]},tIe={style:"cursor: crosshair"};function ine(t={}){let[e,n]=eIe[t.key||"Alt"],r=Ur.fromClass(class{constructor(i){this.view=i,this.isDown=!1}set(i){this.isDown!=i&&(this.isDown=i,this.view.update([]))}},{eventHandlers:{keydown(i){this.set(i.keyCode==e||n(i))},keyup(i){(i.keyCode==e||!n(i))&&this.set(!1)}}});return[r,_t.contentAttributes.of(i=>{var o;return!((o=i.plugin(r))===null||o===void 0)&&o.isDown?tIe:null})]}const yP="-10000px";class one{constructor(e,n,r){this.facet=n,this.createTooltipView=r,this.input=e.state.facet(n),this.tooltips=this.input.filter(i=>i),this.tooltipViews=this.tooltips.map(r)}update(e){let n=e.state.facet(this.facet),r=n.filter(o=>o);if(n===this.input){for(let o of this.tooltipViews)o.update&&o.update(e);return!1}let i=[];for(let o=0;o<r.length;o++){let s=r[o],a=-1;if(!!s){for(let l=0;l<this.tooltips.length;l++){let c=this.tooltips[l];c&&c.create==s.create&&(a=l)}if(a<0)i[o]=this.createTooltipView(s);else{let l=i[o]=this.tooltipViews[a];l.update&&l.update(e)}}}for(let o of this.tooltipViews)i.indexOf(o)<0&&o.dom.remove();return this.input=n,this.tooltips=r,this.tooltipViews=i,!0}}function nIe(){return{top:0,left:0,bottom:innerHeight,right:innerWidth}}const bP=Wt.define({combine:t=>{var e,n,r;return{position:an.ios?"absolute":((e=t.find(i=>i.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(i=>i.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=t.find(i=>i.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||nIe}}}),sne=Ur.fromClass(class{constructor(t){var e;this.view=t,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1;let n=t.state.facet(bP);this.position=n.position,this.parent=n.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new one(t,N_,r=>this.createTooltip(r)),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(r=>{Date.now()>this.lastTransaction-50&&r.length>0&&r[r.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),(e=t.dom.ownerDocument.defaultView)===null||e===void 0||e.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t);e&&this.observeIntersection();let n=e||t.geometryChanged,r=t.state.facet(bP);if(r.position!=this.position){this.position=r.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let i of this.manager.tooltipViews)this.container.appendChild(i.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t){let e=t.create(this.view);if(e.dom.classList.add("cm-tooltip"),t.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let n=document.createElement("div");n.className="cm-tooltip-arrow",e.dom.appendChild(n)}return e.dom.style.position=this.position,e.dom.style.top=yP,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var t,e;(t=this.view.dom.ownerDocument.defaultView)===null||t===void 0||t.removeEventListener("resize",this.measureSoon);for(let{dom:n}of this.manager.tooltipViews)n.remove();(e=this.intersectionObserver)===null||e===void 0||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect();return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map((e,n)=>{let r=this.manager.tooltipViews[n];return r.getCoords?r.getCoords(e.pos):this.view.coordsAtPos(e.pos)}),size:this.manager.tooltipViews.map(({dom:e})=>e.getBoundingClientRect()),space:this.view.state.facet(bP).tooltipSpace(this.view)}}writeMeasure(t){let{editor:e,space:n}=t,r=[];for(let i=0;i<this.manager.tooltips.length;i++){let o=this.manager.tooltips[i],s=this.manager.tooltipViews[i],{dom:a}=s,l=t.pos[i],c=t.size[i];if(!l||l.bottom<=Math.max(e.top,n.top)||l.top>=Math.min(e.bottom,n.bottom)||l.right<Math.max(e.left,n.left)-.1||l.left>Math.min(e.right,n.right)+.1){a.style.top=yP;continue}let u=o.arrow?s.dom.querySelector(".cm-tooltip-arrow"):null,f=u?7:0,h=c.right-c.left,d=c.bottom-c.top,O=s.offset||iIe,b=this.view.textDirection==Ai.LTR,v=c.width>n.right-n.left?b?n.left:n.right-c.width:b?Math.min(l.left-(u?14:0)+O.x,n.right-h):Math.max(n.left,l.left-h+(u?14:0)-O.x),p=!!o.above;!o.strictSide&&(p?l.top-(c.bottom-c.top)-O.y<n.top:l.bottom+(c.bottom-c.top)+O.y>n.bottom)&&p==n.bottom-l.bottom>l.top-n.top&&(p=!p);let g=p?l.top-d-f-O.y:l.bottom+f+O.y,y=v+h;if(s.overlap!==!0)for(let S of r)S.left<y&&S.right>v&&S.top<g+d&&S.bottom>g&&(g=p?S.top-d-2-f:S.bottom+f+2);this.position=="absolute"?(a.style.top=g-t.parent.top+"px",a.style.left=v-t.parent.left+"px"):(a.style.top=g+"px",a.style.left=v+"px"),u&&(u.style.left=`${l.left+(b?O.x:-O.x)-(v+14-7)}px`),s.overlap!==!0&&r.push({left:v,top:g,right:y,bottom:g+d}),a.classList.toggle("cm-tooltip-above",p),a.classList.toggle("cm-tooltip-below",!p),s.positioned&&s.positioned()}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=yP}},{eventHandlers:{scroll(){this.maybeMeasure()}}}),rIe=_t.baseTheme({".cm-tooltip":{zIndex:100},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:`${7}px`,width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:`${7}px solid transparent`,borderRight:`${7}px solid transparent`},".cm-tooltip-above &":{bottom:`-${7}px`,"&:before":{borderTop:`${7}px solid #bbb`},"&:after":{borderTop:`${7}px solid #f5f5f5`,bottom:"1px"}},".cm-tooltip-below &":{top:`-${7}px`,"&:before":{borderBottom:`${7}px solid #bbb`},"&:after":{borderBottom:`${7}px solid #f5f5f5`,top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),iIe={x:0,y:0},N_=Wt.define({enables:[sne,rIe]}),b4=Wt.define();class AR{constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new one(e,b4,n=>this.createHostedView(n))}static create(e){return new AR(e)}createHostedView(e){let n=e.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.appendChild(n.dom),this.mounted&&n.mount&&n.mount(this.view),n}mount(e){for(let n of this.manager.tooltipViews)n.mount&&n.mount(e);this.mounted=!0}positioned(){for(let e of this.manager.tooltipViews)e.positioned&&e.positioned()}update(e){this.manager.update(e)}}const oIe=N_.compute([b4],t=>{let e=t.facet(b4).filter(n=>n);return e.length===0?null:{pos:Math.min(...e.map(n=>n.pos)),end:Math.max(...e.filter(n=>n.end!=null).map(n=>n.end)),create:AR.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class sIe{constructor(e,n,r,i,o){this.view=e,this.source=n,this.field=r,this.setHover=i,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{lastMove:e}=this,n=this.view.contentDOM.contains(e.target)?this.view.posAtCoords(e):null;if(n==null)return;let r=this.view.coordsAtPos(n);if(r==null||e.y<r.top||e.y>r.bottom||e.x<r.left-this.view.defaultCharacterWidth||e.x>r.right+this.view.defaultCharacterWidth)return;let i=this.view.bidiSpans(this.view.state.doc.lineAt(n)).find(a=>a.from<=n&&a.to>=n),o=i&&i.dir==Ai.RTL?-1:1,s=this.source(this.view,n,e.x<r.left?-o:o);if(s!=null&&s.then){let a=this.pending={pos:n};s.then(l=>{this.pending==a&&(this.pending=null,l&&this.view.dispatch({effects:this.setHover.of(l)}))},l=>Aa(this.view.state,l,"hover tooltip"))}else s&&this.view.dispatch({effects:this.setHover.of(s)})}mousemove(e){var n;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let r=this.active;if(r&&!aIe(this.lastMove.target)||this.pending){let{pos:i}=r||this.pending,o=(n=r==null?void 0:r.end)!==null&&n!==void 0?n:i;(i==o?this.view.posAtCoords(this.lastMove)!=i:!lIe(this.view,i,o,e.clientX,e.clientY,6))&&(this.view.dispatch({effects:this.setHover.of(null)}),this.pending=null)}}mouseleave(){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1,this.active&&this.view.dispatch({effects:this.setHover.of(null)})}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}function aIe(t){for(let e=t;e;e=e.parentNode)if(e.nodeType==1&&e.classList.contains("cm-tooltip"))return!0;return!1}function lIe(t,e,n,r,i,o){let s=document.createRange(),a=t.domAtPos(e),l=t.domAtPos(n);s.setEnd(l.node,l.offset),s.setStart(a.node,a.offset);let c=s.getClientRects();s.detach();for(let u=0;u<c.length;u++){let f=c[u];if(Math.max(f.top-i,i-f.bottom,f.left-r,r-f.right)<=o)return!0}return!1}function ane(t,e={}){let n=ln.define(),r=hi.define({create(){return null},update(i,o){if(i&&(e.hideOnChange&&(o.docChanged||o.selection)||e.hideOn&&e.hideOn(o,i)))return null;if(i&&o.docChanged){let s=o.changes.mapPos(i.pos,-1,Xo.TrackDel);if(s==null)return null;let a=Object.assign(Object.create(null),i);a.pos=s,i.end!=null&&(a.end=o.changes.mapPos(i.end)),i=a}for(let s of o.effects)s.is(n)&&(i=s.value),s.is(uIe)&&(i=null);return i},provide:i=>b4.from(i)});return[r,Ur.define(i=>new sIe(i,t,r,n,e.hoverTime||300)),oIe]}function cIe(t,e){let n=t.plugin(sne);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const uIe=ln.define(),bU=Wt.define({combine(t){let e,n;for(let r of t)e=e||r.topContainer,n=n||r.bottomContainer;return{topContainer:e,bottomContainer:n}}});function iy(t,e){let n=t.plugin(lne),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const lne=Ur.fromClass(class{constructor(t){this.input=t.state.facet(mh),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(bU);this.top=new a2(t,!0,e.topContainer),this.bottom=new a2(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(t){let e=t.state.facet(bU);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new a2(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new a2(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(mh);if(n!=this.input){let r=n.filter(l=>l),i=[],o=[],s=[],a=[];for(let l of r){let c=this.specs.indexOf(l),u;c<0?(u=l(t.view),a.push(u)):(u=this.panels[c],u.update&&u.update(t)),i.push(u),(u.top?o:s).push(u)}this.specs=r,this.panels=i,this.top.sync(o),this.bottom.sync(s);for(let l of a)l.dom.classList.add("cm-panel"),l.mount&&l.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>_t.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class a2{constructor(e,n,r){this.view=e,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let n of this.panels)n.destroy&&e.indexOf(n)<0&&n.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let e=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;e!=n.dom;)e=xU(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=xU(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function xU(t){let e=t.nextSibling;return t.remove(),e}const mh=Wt.define({enables:lne});class Iu extends Dp{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Iu.prototype.elementClass="";Iu.prototype.toDOM=void 0;Iu.prototype.mapMode=Xo.TrackBefore;Iu.prototype.startSide=Iu.prototype.endSide=-1;Iu.prototype.point=!0;const Ux=Wt.define(),fIe={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Wr.empty,lineMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},Hg=Wt.define();function cne(t){return[une(),Hg.of(Object.assign(Object.assign({},fIe),t))]}const W8=Wt.define({combine:t=>t.some(e=>e)});function une(t){let e=[dIe];return t&&t.fixed===!1&&e.push(W8.of(!0)),e}const dIe=Ur.fromClass(class{constructor(t){this.view=t,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight+"px",this.gutters=t.state.facet(Hg).map(e=>new wU(t,e));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!t.state.facet(W8),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}update(t){if(this.updateGutters(t)){let e=this.prevViewport,n=t.view.viewport,r=Math.min(e.to,n.to)-Math.max(e.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}t.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(W8)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&this.dom.remove();let n=Wr.iter(this.view.state.facet(Ux),this.view.viewport.from),r=[],i=this.gutters.map(o=>new hIe(o,this.view.viewport,-this.view.documentPadding.top));for(let o of this.view.viewportLineBlocks){let s;if(Array.isArray(o.type)){for(let a of o.type)if(a.type==yi.Text){s=a;break}}else s=o.type==yi.Text?o:void 0;if(!!s){r.length&&(r=[]),fne(n,r,o.from);for(let a of i)a.line(this.view,s,r)}}for(let o of i)o.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(Hg),n=t.state.facet(Hg),r=t.docChanged||t.heightChanged||t.viewportChanged||!Wr.eq(t.startState.facet(Ux),t.state.facet(Ux),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let i of this.gutters)i.update(t)&&(r=!0);else{r=!0;let i=[];for(let o of n){let s=e.indexOf(o);s<0?i.push(new wU(this.view,o)):(this.gutters[s].update(t),i.push(this.gutters[s]))}for(let o of this.gutters)o.dom.remove(),i.indexOf(o)<0&&o.destroy();for(let o of i)this.dom.appendChild(o.dom);this.gutters=i}return r}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove()}},{provide:t=>_t.scrollMargins.of(e=>{let n=e.plugin(t);return!n||n.gutters.length==0||!n.fixed?null:e.textDirection==Ai.LTR?{left:n.dom.offsetWidth}:{right:n.dom.offsetWidth}})});function SU(t){return Array.isArray(t)?t:[t]}function fne(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class hIe{constructor(e,n,r){this.gutter=e,this.height=r,this.localMarkers=[],this.i=0,this.cursor=Wr.iter(e.markers,n.from)}line(e,n,r){this.localMarkers.length&&(this.localMarkers=[]),fne(this.cursor,this.localMarkers,n.from);let i=r.length?this.localMarkers.concat(r):this.localMarkers,o=this.gutter.config.lineMarker(e,n,i);o&&i.unshift(o);let s=this.gutter;if(i.length==0&&!s.config.renderEmptyElements)return;let a=n.top-this.height;if(this.i==s.elements.length){let l=new dne(e,n.height,a,i);s.elements.push(l),s.dom.appendChild(l.dom)}else s.elements[this.i].update(e,n.height,a,i);this.height=n.bottom,this.i++}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class wU{constructor(e,n){this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,i=>{let o=e.lineBlockAtHeight(i.clientY-e.documentTop);n.domEventHandlers[r](e,o,i)&&i.preventDefault()});this.markers=SU(n.markers(e)),n.initialSpacer&&(this.spacer=new dne(e,0,0,[n.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let n=this.markers;if(this.markers=SU(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let i=this.config.updateSpacer(this.spacer.markers[0],e);i!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[i])}let r=e.view.viewport;return!Wr.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class dne{constructor(e,n,r,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,r,i)}update(e,n,r,i){this.height!=n&&(this.dom.style.height=(this.height=n)+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),pIe(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,n){let r="cm-gutterElement",i=this.dom.firstChild;for(let o=0,s=0;;){let a=s,l=o<n.length?n[o++]:null,c=!1;if(l){let u=l.elementClass;u&&(r+=" "+u);for(let f=s;f<this.markers.length;f++)if(this.markers[f].compare(l)){a=f,c=!0;break}}else a=this.markers.length;for(;s<a;){let u=this.markers[s++];if(u.toDOM){u.destroy(i);let f=i.nextSibling;i.remove(),i=f}}if(!l)break;l.toDOM&&(c?i=i.nextSibling:this.dom.insertBefore(l.toDOM(e),i)),c&&s++}this.dom.className=r,this.markers=n}destroy(){this.setMarkers(null,[])}}function pIe(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].compare(e[n]))return!1;return!0}const OIe=Wt.define(),p1=Wt.define({combine(t){return fa(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,n){let r=Object.assign({},e);for(let i in n){let o=r[i],s=n[i];r[i]=o?(a,l,c)=>o(a,l,c)||s(a,l,c):s}return r}})}});class xP extends Iu{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function SP(t,e){return t.state.facet(p1).formatNumber(e,t.state)}const mIe=Hg.compute([p1],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(OIe)},lineMarker(e,n,r){return r.some(i=>i.toDOM)?null:new xP(SP(e,e.state.doc.lineAt(n.from).number))},lineMarkerChange:e=>e.startState.facet(p1)!=e.state.facet(p1),initialSpacer(e){return new xP(SP(e,_U(e.state.doc.lines)))},updateSpacer(e,n){let r=SP(n.view,_U(n.view.state.doc.lines));return r==e.number?e:new xP(r)},domEventHandlers:t.facet(p1).domEventHandlers}));function hne(t={}){return[p1.of(t),une(),mIe]}function _U(t){let e=9;for(;e<t;)e=e*10+9;return e}const gIe=new class extends Iu{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},vIe=Ux.compute(["selection"],t=>{let e=[],n=-1;for(let r of t.selection.ranges)if(r.empty){let i=t.doc.lineAt(r.head).from;i>n&&(n=i,e.push(gIe.range(i)))}return Wr.of(e)});function pne(){return vIe}const One=1024;let yIe=0;class jl{constructor(e,n){this.from=e,this.to=n}}class Qn{constructor(e={}){this.id=yIe++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Ji.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}Qn.closedBy=new Qn({deserialize:t=>t.split(" ")});Qn.openedBy=new Qn({deserialize:t=>t.split(" ")});Qn.group=new Qn({deserialize:t=>t.split(" ")});Qn.contextHash=new Qn({perNode:!0});Qn.lookAhead=new Qn({perNode:!0});Qn.mounted=new Qn({perNode:!0});class bIe{constructor(e,n,r){this.tree=e,this.overlay=n,this.parser=r}}const xIe=Object.create(null);class Ji{constructor(e,n,r,i=0){this.name=e,this.props=n,this.id=r,this.flags=i}static define(e){let n=e.props&&e.props.length?Object.create(null):xIe,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new Ji(e.name||"",n,e.id,r);if(e.props){for(let o of e.props)if(Array.isArray(o)||(o=o(i)),o){if(o[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[o[0].id]=o[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(Qn.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let i of r.split(" "))n[i]=e[r];return r=>{for(let i=r.prop(Qn.group),o=-1;o<(i?i.length:0);o++){let s=n[o<0?r.name:i[o]];if(s)return s}}}}Ji.none=new Ji("",Object.create(null),0,8);class V0{constructor(e){this.types=e;for(let n=0;n<e.length;n++)if(e[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let n=[];for(let r of this.types){let i=null;for(let o of e){let s=o(r);s&&(i||(i=Object.assign({},r.props)),i[s[0].id]=s[1])}n.push(i?new Ji(r.name,i,r.id,r.flags):r)}return new V0(n)}}const l2=new WeakMap,TU=new WeakMap;var Ci;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"})(Ci||(Ci={}));class Vn{constructor(e,n,r,i,o){if(this.type=e,this.children=n,this.positions=r,this.length=i,this.props=null,o&&o.length){this.props=Object.create(null);for(let[s,a]of o)this.props[typeof s=="number"?s:s.id]=a}}toString(){let e=this.prop(Qn.mounted);if(e&&!e.overlay)return e.tree.toString();let n="";for(let r of this.children){let i=r.toString();i&&(n&&(n+=","),n+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(e=0){return new oy(this.topNode,e)}cursorAt(e,n=0,r=0){let i=l2.get(this)||this.topNode,o=new oy(i);return o.moveTo(e,n),l2.set(this,o._tree),o}get topNode(){return new Kl(this,0,0,null)}resolve(e,n=0){let r=f0(l2.get(this)||this.topNode,e,n,!1);return l2.set(this,r),r}resolveInner(e,n=0){let r=f0(TU.get(this)||this.topNode,e,n,!0);return TU.set(this,r),r}iterate(e){let{enter:n,leave:r,from:i=0,to:o=this.length}=e;for(let s=this.cursor((e.mode||0)|Ci.IncludeAnonymous);;){let a=!1;if(s.from<=o&&s.to>=i&&(s.type.isAnonymous||n(s)!==!1)){if(s.firstChild())continue;a=!0}for(;a&&r&&!s.type.isAnonymous&&r(s),!s.nextSibling();){if(!s.parent())return;a=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:LR(Ji.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new Vn(this.type,n,r,i,this.propValues),e.makeTree||((n,r,i)=>new Vn(Ji.none,n,r,i)))}static build(e){return wIe(e)}}Vn.empty=new Vn(Ji.none,[],[],0);class IR{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new IR(this.buffer,this.index)}}class eO{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return Ji.none}toString(){let e=[];for(let n=0;n<this.buffer.length;)e.push(this.childString(n)),n=this.buffer[n+3];return e.join(",")}childString(e){let n=this.buffer[e],r=this.buffer[e+3],i=this.set.types[n],o=i.name;if(/\W/.test(o)&&!i.isError&&(o=JSON.stringify(o)),e+=4,r==e)return o;let s=[];for(;e<r;)s.push(this.childString(e)),e=this.buffer[e+3];return o+"("+s.join(",")+")"}findChild(e,n,r,i,o){let{buffer:s}=this,a=-1;for(let l=e;l!=n&&!(mne(o,i,s[l+1],s[l+2])&&(a=l,r>0));l=s[l+3]);return a}slice(e,n,r,i){let o=this.buffer,s=new Uint16Array(n-e);for(let a=e,l=0;a<n;)s[l++]=o[a++],s[l++]=o[a++]-r,s[l++]=o[a++]-r,s[l++]=o[a++]-e;return new eO(s,i-r,this.set)}}function mne(t,e,n,r){switch(t){case-2:return n<e;case-1:return r>=e&&n<e;case 0:return n<e&&r>e;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function gne(t,e){let n=t.childBefore(e);for(;n;){let r=n.lastChild;if(!r||r.to!=n.to)break;r.type.isError&&r.from==r.to?(t=n,n=r.prevSibling):n=r}return t}function f0(t,e,n,r){for(var i;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){let s=!r&&t instanceof Kl&&t.index<0?null:t.parent;if(!s)return t;t=s}let o=r?0:Ci.IgnoreOverlays;if(r)for(let s=t,a=s.parent;a;s=a,a=s.parent)s instanceof Kl&&s.index<0&&((i=a.enter(e,n,o))===null||i===void 0?void 0:i.from)!=s.from&&(t=a);for(;;){let s=t.enter(e,n,o);if(!s)return t;t=s}}class Kl{constructor(e,n,r,i){this._tree=e,this.from=n,this.index=r,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,n,r,i,o=0){for(let s=this;;){for(let{children:a,positions:l}=s._tree,c=n>0?a.length:-1;e!=c;e+=n){let u=a[e],f=l[e]+s.from;if(!!mne(i,r,f,f+u.length)){if(u instanceof eO){if(o&Ci.ExcludeBuffers)continue;let h=u.findChild(0,u.buffer.length,n,r-f,i);if(h>-1)return new pu(new SIe(s,u,e,f),null,h)}else if(o&Ci.IncludeAnonymous||!u.type.isAnonymous||zR(u)){let h;if(!(o&Ci.IgnoreMounts)&&u.props&&(h=u.prop(Qn.mounted))&&!h.overlay)return new Kl(h.tree,f,e,s);let d=new Kl(u,f,e,s);return o&Ci.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(n<0?u.children.length-1:0,n,r,i)}}}if(o&Ci.IncludeAnonymous||!s.type.isAnonymous||(s.index>=0?e=s.index+n:e=n<0?-1:s._parent._tree.children.length,s=s._parent,!s))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,n,r=0){let i;if(!(r&Ci.IgnoreOverlays)&&(i=this._tree.prop(Qn.mounted))&&i.overlay){let o=e-this.from;for(let{from:s,to:a}of i.overlay)if((n>0?s<=o:s<o)&&(n<0?a>=o:a>o))return new Kl(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}cursor(e=0){return new oy(this,e)}get tree(){return this._tree}toTree(){return this._tree}resolve(e,n=0){return f0(this,e,n,!1)}resolveInner(e,n=0){return f0(this,e,n,!0)}enterUnfinishedNodesBefore(e){return gne(this,e)}getChild(e,n=null,r=null){let i=x4(this,e,n,r);return i.length?i[0]:null}getChildren(e,n=null,r=null){return x4(this,e,n,r)}toString(){return this._tree.toString()}get node(){return this}matchContext(e){return S4(this,e)}}function x4(t,e,n,r){let i=t.cursor(),o=[];if(!i.firstChild())return o;if(n!=null){for(;!i.type.is(n);)if(!i.nextSibling())return o}for(;;){if(r!=null&&i.type.is(r))return o;if(i.type.is(e)&&o.push(i.node),!i.nextSibling())return r==null?o:[]}}function S4(t,e,n=e.length-1){for(let r=t.parent;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class SIe{constructor(e,n,r,i){this.parent=e,this.buffer=n,this.index=r,this.start=i}}class pu{constructor(e,n,r){this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}child(e,n,r){let{buffer:i}=this.context,o=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.context.start,r);return o<0?null:new pu(this.context,this,o)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,n,r=0){if(r&Ci.ExcludeBuffers)return null;let{buffer:i}=this.context,o=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return o<0?null:new pu(this.context,this,o)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new pu(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new pu(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}cursor(e=0){return new oy(this,e)}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,i=this.index+4,o=r.buffer[this.index+3];if(o>i){let s=r.buffer[this.index+1],a=r.buffer[this.index+2];e.push(r.slice(i,o,s,a)),n.push(0)}return new Vn(this.type,e,n,this.to-this.from)}resolve(e,n=0){return f0(this,e,n,!1)}resolveInner(e,n=0){return f0(this,e,n,!0)}enterUnfinishedNodesBefore(e){return gne(this,e)}toString(){return this.context.buffer.childString(this.index)}getChild(e,n=null,r=null){let i=x4(this,e,n,r);return i.length?i[0]:null}getChildren(e,n=null,r=null){return x4(this,e,n,r)}get node(){return this}matchContext(e){return S4(this,e)}}class oy{constructor(e,n=0){if(this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Kl)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}get name(){return this.type.name}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:i}=this.buffer;return this.type=n||i.set.types[i.buffer[e]],this.from=r+i.buffer[e+1],this.to=r+i.buffer[e+2],!0}yield(e){return e?e instanceof Kl?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:i}=this.buffer,o=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.buffer.start,r);return o<0?!1:(this.stack.push(this.index),this.yieldBuf(o))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&Ci.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Ci.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Ci.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let i=r<0?0:this.stack[r]+4;if(this.index!=i)return this.yieldBuf(n.findChild(i,this.index,-1,0,4))}else{let i=n.buffer[this.index+3];if(i<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(i)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let o=0;o<this.index;o++)if(i.buffer.buffer[o+3]<this.index)return!1;({index:n,parent:r}=i)}else({index:n,_parent:r}=this._tree);for(;r;{index:n,_parent:r}=r)if(n>-1)for(let o=n+e,s=e<0?-1:r._tree.children.length;o!=s;o+=e){let a=r._tree.children[o];if(this.mode&Ci.IncludeAnonymous||a instanceof eO||!a.type.isAnonymous||zR(a))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,n););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,n=null,r=0;if(e&&e.context==this.buffer){e:for(let i=this.index,o=this.stack.length;o>=0;){for(let s=e;s;s=s._parent)if(s.index==i){if(i==this.index)return s;n=s,r=o+1;break e}i=this.stack[--o]}}for(let i=r;i<this.stack.length;i++)n=new pu(this.buffer,n,this.stack[i]);return this.bufferNode=new pu(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,n){for(let r=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(i=!0)}for(;i&&n&&n(this),i=this.type.isAnonymous,!this.nextSibling();){if(!r)return;this.parent(),r--,i=!0}}}matchContext(e){if(!this.buffer)return S4(this.node,e);let{buffer:n}=this.buffer,{types:r}=n.set;for(let i=e.length-1,o=this.stack.length-1;i>=0;o--){if(o<0)return S4(this.node,e,i);let s=r[n.buffer[this.stack[o]]];if(!s.isAnonymous){if(e[i]&&e[i]!=s.name)return!1;i--}}return!0}}function zR(t){return t.children.some(e=>e instanceof eO||!e.type.isAnonymous||zR(e))}function wIe(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:i=One,reused:o=[],minRepeatType:s=r.types.length}=t,a=Array.isArray(n)?new IR(n,n.length):n,l=r.types,c=0,u=0;function f(S,w,T,k,A){let{id:L,start:$,end:E,size:C}=a,I=u;for(;C<0;)if(a.next(),C==-1){let j=o[L];T.push(j),k.push($-S);return}else if(C==-3){c=L;return}else if(C==-4){u=L;return}else throw new RangeError(`Unrecognized record size: ${C}`);let H=l[L],Y,z,U=$-S;if(E-$<=i&&(z=b(a.pos-w,A))){let j=new Uint16Array(z.size-z.skip),K=a.pos-z.size,se=j.length;for(;a.pos>K;)se=v(z.start,j,se);Y=new eO(j,E-z.start,r),U=z.start-S}else{let j=a.pos-C;a.next();let K=[],se=[],G=L>=s?L:-1,re=0,Te=E;for(;a.pos>j;)G>=0&&a.id==G&&a.size>=0?(a.end<=Te-i&&(d(K,se,$,re,a.end,Te,G,I),re=K.length,Te=a.end),a.next()):f($,j,K,se,G);if(G>=0&&re>0&&re<K.length&&d(K,se,$,re,$,Te,G,I),K.reverse(),se.reverse(),G>-1&&re>0){let Re=h(H);Y=LR(H,K,se,0,K.length,0,E-$,Re,Re)}else Y=O(H,K,se,E-$,I-E)}T.push(Y),k.push(U)}function h(S){return(w,T,k)=>{let A=0,L=w.length-1,$,E;if(L>=0&&($=w[L])instanceof Vn){if(!L&&$.type==S&&$.length==k)return $;(E=$.prop(Qn.lookAhead))&&(A=T[L]+$.length+E)}return O(S,w,T,k,A)}}function d(S,w,T,k,A,L,$,E){let C=[],I=[];for(;S.length>k;)C.push(S.pop()),I.push(w.pop()+T-A);S.push(O(r.types[$],C,I,L-A,E-L)),w.push(A-T)}function O(S,w,T,k,A=0,L){if(c){let $=[Qn.contextHash,c];L=L?[$].concat(L):[$]}if(A>25){let $=[Qn.lookAhead,A];L=L?[$].concat(L):[$]}return new Vn(S,w,T,k,L)}function b(S,w){let T=a.fork(),k=0,A=0,L=0,$=T.end-i,E={size:0,start:0,skip:0};e:for(let C=T.pos-S;T.pos>C;){let I=T.size;if(T.id==w&&I>=0){E.size=k,E.start=A,E.skip=L,L+=4,k+=4,T.next();continue}let H=T.pos-I;if(I<0||H<C||T.start<$)break;let Y=T.id>=s?4:0,z=T.start;for(T.next();T.pos>H;){if(T.size<0)if(T.size==-3)Y+=4;else break e;else T.id>=s&&(Y+=4);T.next()}A=z,k+=I,L+=Y}return(w<0||k==S)&&(E.size=k,E.start=A,E.skip=L),E.size>4?E:void 0}function v(S,w,T){let{id:k,start:A,end:L,size:$}=a;if(a.next(),$>=0&&k<s){let E=T;if($>4){let C=a.pos-($-4);for(;a.pos>C;)T=v(S,w,T)}w[--T]=E,w[--T]=L-S,w[--T]=A-S,w[--T]=k}else $==-3?c=k:$==-4&&(u=k);return T}let p=[],g=[];for(;a.pos>0;)f(t.start||0,t.bufferStart||0,p,g,-1);let y=(e=t.length)!==null&&e!==void 0?e:p.length?g[0]+p[0].length:0;return new Vn(l[t.topID],p.reverse(),g.reverse(),y)}const kU=new WeakMap;function qx(t,e){if(!t.isAnonymous||e instanceof eO||e.type!=t)return 1;let n=kU.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof Vn)){n=1;break}n+=qx(t,r)}kU.set(e,n)}return n}function LR(t,e,n,r,i,o,s,a,l){let c=0;for(let O=r;O<i;O++)c+=qx(t,e[O]);let u=Math.ceil(c*1.5/8),f=[],h=[];function d(O,b,v,p,g){for(let y=v;y<p;){let S=y,w=b[y],T=qx(t,O[y]);for(y++;y<p;y++){let k=qx(t,O[y]);if(T+k>=u)break;T+=k}if(y==S+1){if(T>u){let k=O[S];d(k.children,k.positions,0,k.children.length,b[S]+g);continue}f.push(O[S])}else{let k=b[y-1]+O[y-1].length-w;f.push(LR(t,O,b,S,y,w,k,null,l))}h.push(w+g-o)}}return d(e,n,r,i,0),(a||l)(f,h,s)}class _Ie{constructor(){this.map=new WeakMap}setBuffer(e,n,r){let i=this.map.get(e);i||this.map.set(e,i=new Map),i.set(n,r)}getBuffer(e,n){let r=this.map.get(e);return r&&r.get(n)}set(e,n){e instanceof pu?this.setBuffer(e.context.buffer,e.index,n):e instanceof Kl&&this.map.set(e.tree,n)}get(e){return e instanceof pu?this.getBuffer(e.context.buffer,e.index):e instanceof Kl?this.map.get(e.tree):void 0}cursorSet(e,n){e.buffer?this.setBuffer(e.buffer.buffer,e.index,n):this.map.set(e.tree,n)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class al{constructor(e,n,r,i,o=!1,s=!1){this.from=e,this.to=n,this.tree=r,this.offset=i,this.open=(o?1:0)|(s?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let i=[new al(0,e.length,e,0,!1,r)];for(let o of n)o.to>e.length&&i.push(o);return i}static applyChanges(e,n,r=128){if(!n.length)return e;let i=[],o=1,s=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let u=a<n.length?n[a]:null,f=u?u.fromA:1e9;if(f-l>=r)for(;s&&s.from<f;){let h=s;if(l>=h.from||f<=h.to||c){let d=Math.max(h.from,l)-c,O=Math.min(h.to,f)-c;h=d>=O?null:new al(d,O,h.tree,h.offset+c,a>0,!!u)}if(h&&i.push(h),s.to>f)break;s=o<e.length?e[o++]:null}if(!u)break;l=u.toA,c=u.toA-u.toB}return i}}class ob{startParse(e,n,r){return typeof e=="string"&&(e=new TIe(e)),r=r?r.length?r.map(i=>new jl(i.from,i.to)):[new jl(0,0)]:[new jl(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let i=this.startParse(e,n,r);for(;;){let o=i.advance();if(o)return o}}}class TIe{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}function NR(t){return(e,n,r,i)=>new PIe(e,t,n,r,i)}class PU{constructor(e,n,r,i,o){this.parser=e,this.parse=n,this.overlay=r,this.target=i,this.ranges=o}}class kIe{constructor(e,n,r,i,o,s,a){this.parser=e,this.predicate=n,this.mounts=r,this.index=i,this.start=o,this.target=s,this.prev=a,this.depth=0,this.ranges=[]}}const U8=new Qn({perNode:!0});class PIe{constructor(e,n,r,i,o){this.nest=n,this.input=r,this.fragments=i,this.ranges=o,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let r=this.baseParse.advance();if(!r)return null;if(this.baseParse=null,this.baseTree=r,this.startInner(),this.stoppedAt!=null)for(let i of this.inner)i.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let r=this.baseTree;return this.stoppedAt!=null&&(r=new Vn(r.type,r.children,r.positions,r.length,r.propValues.concat([[U8,this.stoppedAt]]))),r}let e=this.inner[this.innerDone],n=e.parse.advance();if(n){this.innerDone++;let r=Object.assign(Object.create(null),e.target.props);r[Qn.mounted.id]=new bIe(n,e.overlay,e.parser),e.target.props=r}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let n=this.innerDone;n<this.inner.length;n++)this.inner[n].ranges[0].from<e&&(e=Math.min(e,this.inner[n].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let n=this.innerDone;n<this.inner.length;n++)this.inner[n].parse.stopAt(e)}startInner(){let e=new EIe(this.fragments),n=null,r=null,i=new oy(new Kl(this.baseTree,this.ranges[0].from,0,null),Ci.IncludeAnonymous|Ci.IgnoreMounts);e:for(let o,s;this.stoppedAt==null||i.from<this.stoppedAt;){let a=!0,l;if(e.hasNode(i)){if(n){let c=n.mounts.find(u=>u.frag.from<=i.from&&u.frag.to>=i.to&&u.mount.overlay);if(c)for(let u of c.mount.overlay){let f=u.from+c.pos,h=u.to+c.pos;f>=i.from&&h<=i.to&&!n.ranges.some(d=>d.from<h&&d.to>f)&&n.ranges.push({from:f,to:h})}}a=!1}else if(r&&(s=QIe(r.ranges,i.from,i.to)))a=s!=2;else if(!i.type.isAnonymous&&i.from<i.to&&(o=this.nest(i,this.input))){i.tree||$Ie(i);let c=e.findMounts(i.from,o.parser);if(typeof o.overlay=="function")n=new kIe(o.parser,o.overlay,c,this.inner.length,i.from,i.tree,n);else{let u=EU(this.ranges,o.overlay||[new jl(i.from,i.to)]);u.length&&this.inner.push(new PU(o.parser,o.parser.startParse(this.input,CU(c,u),u),o.overlay?o.overlay.map(f=>new jl(f.from-i.from,f.to-i.from)):null,i.tree,u)),o.overlay?u.length&&(r={ranges:u,depth:0,prev:r}):a=!1}}else n&&(l=n.predicate(i))&&(l===!0&&(l=new jl(i.from,i.to)),l.from<l.to&&n.ranges.push(l));if(a&&i.firstChild())n&&n.depth++,r&&r.depth++;else for(;!i.nextSibling();){if(!i.parent())break e;if(n&&!--n.depth){let c=EU(this.ranges,n.ranges);c.length&&this.inner.splice(n.index,0,new PU(n.parser,n.parser.startParse(this.input,CU(n.mounts,c),c),n.ranges.map(u=>new jl(u.from-n.start,u.to-n.start)),n.target,c)),n=n.prev}r&&!--r.depth&&(r=r.prev)}}}}function QIe(t,e,n){for(let r of t){if(r.from>=n)break;if(r.to>e)return r.from<=e&&r.to>=n?2:1}return 0}function QU(t,e,n,r,i,o){if(e<n){let s=t.buffer[e+1],a=t.buffer[n-2];r.push(t.slice(e,n,s,a)),i.push(s-o)}}function $Ie(t){let{node:e}=t,n=0;do t.parent(),n++;while(!t.tree);let r=0,i=t.tree,o=0;for(;o=i.positions[r]+t.from,!(o<=e.from&&o+i.children[r].length>=e.to);r++);let s=i.children[r],a=s.buffer;function l(c,u,f,h,d){let O=c;for(;a[O+2]+o<=e.from;)O=a[O+3];let b=[],v=[];QU(s,c,O,b,v,h);let p=a[O+1],g=a[O+2],y=p+o==e.from&&g+o==e.to&&a[O]==e.type.id;return b.push(y?e.toTree():l(O+4,a[O+3],s.set.types[a[O]],p,g-p)),v.push(p-h),QU(s,a[O+3],u,b,v,h),new Vn(f,b,v,d)}i.children[r]=l(0,a.length,Ji.none,0,s.length);for(let c=0;c<=n;c++)t.childAfter(e.from)}class $U{constructor(e,n){this.offset=n,this.done=!1,this.cursor=e.cursor(Ci.IncludeAnonymous|Ci.IgnoreMounts)}moveTo(e){let{cursor:n}=this,r=e-this.offset;for(;!this.done&&n.from<r;)n.to>=e&&n.enter(r,1,Ci.IgnoreOverlays|Ci.ExcludeBuffers)||n.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let n=this.cursor.tree;;){if(n==e.tree)return!0;if(n.children.length&&n.positions[0]==0&&n.children[0]instanceof Vn)n=n.children[0];else break}return!1}}class EIe{constructor(e){var n;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let r=this.curFrag=e[0];this.curTo=(n=r.tree.prop(U8))!==null&&n!==void 0?n:r.to,this.inner=new $U(r.tree,-r.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let n=this.curFrag=this.fragments[this.fragI];this.curTo=(e=n.tree.prop(U8))!==null&&e!==void 0?e:n.to,this.inner=new $U(n.tree,-n.offset)}}findMounts(e,n){var r;let i=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let o=this.inner.cursor.node;o;o=o.parent){let s=(r=o.tree)===null||r===void 0?void 0:r.prop(Qn.mounted);if(s&&s.parser==n)for(let a=this.fragI;a<this.fragments.length;a++){let l=this.fragments[a];if(l.from>=o.to)break;l.tree==this.curFrag.tree&&i.push({frag:l,pos:o.from-l.offset,mount:s})}}}return i}}function EU(t,e){let n=null,r=e;for(let i=1,o=0;i<t.length;i++){let s=t[i-1].to,a=t[i].from;for(;o<r.length;o++){let l=r[o];if(l.from>=a)break;l.to<=s||(n||(r=n=e.slice()),l.from<s?(n[o]=new jl(l.from,s),l.to>a&&n.splice(o+1,0,new jl(a,l.to))):l.to>a?n[o--]=new jl(a,l.to):n.splice(o--,1))}}return r}function CIe(t,e,n,r){let i=0,o=0,s=!1,a=!1,l=-1e9,c=[];for(;;){let u=i==t.length?1e9:s?t[i].to:t[i].from,f=o==e.length?1e9:a?e[o].to:e[o].from;if(s!=a){let h=Math.max(l,n),d=Math.min(u,f,r);h<d&&c.push(new jl(h,d))}if(l=Math.min(u,f),l==1e9)break;u==l&&(s?(s=!1,i++):s=!0),f==l&&(a?(a=!1,o++):a=!0)}return c}function CU(t,e){let n=[];for(let{pos:r,mount:i,frag:o}of t){let s=r+(i.overlay?i.overlay[0].from:0),a=s+i.tree.length,l=Math.max(o.from,s),c=Math.min(o.to,a);if(i.overlay){let u=i.overlay.map(h=>new jl(h.from+r,h.to+r)),f=CIe(e,u,l,c);for(let h=0,d=l;;h++){let O=h==f.length,b=O?c:f[h].from;if(b>d&&n.push(new al(d,b,i.tree,-s,o.from>=d,o.to<=b)),O)break;d=f[h].to}}else n.push(new al(l,c,i.tree,-s,o.from>=s,o.to<=a))}return n}let RIe=0;class Cc{constructor(e,n,r){this.set=e,this.base=n,this.modified=r,this.id=RIe++}static define(e){if(e!=null&&e.base)throw new Error("Can not derive from a modified tag");let n=new Cc([],null,[]);if(n.set.push(n),e)for(let r of e.set)n.set.push(r);return n}static defineModifier(){let e=new w4;return n=>n.modified.indexOf(e)>-1?n:w4.get(n.base||n,n.modified.concat(e).sort((r,i)=>r.id-i.id))}}let AIe=0;class w4{constructor(){this.instances=[],this.id=AIe++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(a=>a.base==e&&IIe(n,a.modified));if(r)return r;let i=[],o=new Cc(i,e,n);for(let a of n)a.instances.push(o);let s=vne(n);for(let a of e.set)for(let l of s)i.push(w4.get(a,l));return o}}function IIe(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function vne(t){let e=[t];for(let n=0;n<t.length;n++)for(let r of vne(t.slice(0,n).concat(t.slice(n+1))))e.push(r);return e}function da(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let i of n.split(" "))if(i){let o=[],s=2,a=i;for(let f=0;;){if(a=="..."&&f>0&&f+3==i.length){s=1;break}let h=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!h)throw new RangeError("Invalid path: "+i);if(o.push(h[0]=="*"?"":h[0][0]=='"'?JSON.parse(h[0]):h[0]),f+=h[0].length,f==i.length)break;let d=i[f++];if(f==i.length&&d=="!"){s=0;break}if(d!="/")throw new RangeError("Invalid path: "+i);a=i.slice(f)}let l=o.length-1,c=o[l];if(!c)throw new RangeError("Invalid path: "+i);let u=new zIe(r,s,l>0?o.slice(0,l):null);e[c]=u.sort(e[c])}}return yne.add(e)}const yne=new Qn;class zIe{constructor(e,n,r,i){this.tags=e,this.mode=n,this.context=r,this.next=i}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}function MR(t,e){let n=Object.create(null);for(let o of t)if(!Array.isArray(o.tag))n[o.tag.id]=o.class;else for(let s of o.tag)n[s.id]=o.class;let{scope:r,all:i=null}=e||{};return{style:o=>{let s=i;for(let a of o)for(let l of a.set){let c=n[l.id];if(c){s=s?s+" "+c:c;break}}return s},scope:r}}function LIe(t,e){let n=null;for(let r of t){let i=r.style(e);i&&(n=n?n+" "+i:i)}return n}function NIe(t,e,n,r=0,i=t.length){let o=new MIe(r,Array.isArray(e)?e:[e],n);o.highlightRange(t.cursor(),r,i,"",o.highlighters),o.flush(i)}class MIe{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,i,o){let{type:s,from:a,to:l}=e;if(a>=r||l<=n)return;s.isTop&&(o=this.highlighters.filter(d=>!d.scope||d.scope(s)));let c=i,u=s.prop(yne),f=!1;for(;u;){if(!u.context||e.matchContext(u.context)){let d=LIe(o,u.tags);d&&(c&&(c+=" "),c+=d,u.mode==1?i+=(i?" ":"")+d:u.mode==0&&(f=!0));break}u=u.next}if(this.startSpan(e.from,c),f)return;let h=e.tree&&e.tree.prop(Qn.mounted);if(h&&h.overlay){let d=e.node.enter(h.overlay[0].from+a,1),O=this.highlighters.filter(v=>!v.scope||v.scope(h.tree.type)),b=e.firstChild();for(let v=0,p=a;;v++){let g=v<h.overlay.length?h.overlay[v]:null,y=g?g.from+a:l,S=Math.max(n,p),w=Math.min(r,y);if(S<w&&b)for(;e.from<w&&(this.highlightRange(e,S,w,i,o),this.startSpan(Math.min(r,e.to),c),!(e.to>=y||!e.nextSibling())););if(!g||y>r)break;p=g.to+a,p>n&&(this.highlightRange(d.cursor(),Math.max(n,g.from+a),Math.min(r,p),i,O),this.startSpan(p,c))}b&&e.parent()}else if(e.firstChild()){do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,i,o),this.startSpan(Math.min(r,e.to),c)}while(e.nextSibling());e.parent()}}}const At=Cc.define,c2=At(),_d=At(),RU=At(_d),AU=At(_d),Td=At(),u2=At(Td),wP=At(Td),ru=At(),Yh=At(ru),Jc=At(),eu=At(),q8=At(),Wm=At(q8),f2=At(),B={comment:c2,lineComment:At(c2),blockComment:At(c2),docComment:At(c2),name:_d,variableName:At(_d),typeName:RU,tagName:At(RU),propertyName:AU,attributeName:At(AU),className:At(_d),labelName:At(_d),namespace:At(_d),macroName:At(_d),literal:Td,string:u2,docString:At(u2),character:At(u2),attributeValue:At(u2),number:wP,integer:At(wP),float:At(wP),bool:At(Td),regexp:At(Td),escape:At(Td),color:At(Td),url:At(Td),keyword:Jc,self:At(Jc),null:At(Jc),atom:At(Jc),unit:At(Jc),modifier:At(Jc),operatorKeyword:At(Jc),controlKeyword:At(Jc),definitionKeyword:At(Jc),moduleKeyword:At(Jc),operator:eu,derefOperator:At(eu),arithmeticOperator:At(eu),logicOperator:At(eu),bitwiseOperator:At(eu),compareOperator:At(eu),updateOperator:At(eu),definitionOperator:At(eu),typeOperator:At(eu),controlOperator:At(eu),punctuation:q8,separator:At(q8),bracket:Wm,angleBracket:At(Wm),squareBracket:At(Wm),paren:At(Wm),brace:At(Wm),content:ru,heading:Yh,heading1:At(Yh),heading2:At(Yh),heading3:At(Yh),heading4:At(Yh),heading5:At(Yh),heading6:At(Yh),contentSeparator:At(ru),list:At(ru),quote:At(ru),emphasis:At(ru),strong:At(ru),link:At(ru),monospace:At(ru),strikethrough:At(ru),inserted:At(),deleted:At(),changed:At(),invalid:At(),meta:f2,documentMeta:At(f2),annotation:At(f2),processingInstruction:At(f2),definition:Cc.defineModifier(),constant:Cc.defineModifier(),function:Cc.defineModifier(),standard:Cc.defineModifier(),local:Cc.defineModifier(),special:Cc.defineModifier()};MR([{tag:B.link,class:"tok-link"},{tag:B.heading,class:"tok-heading"},{tag:B.emphasis,class:"tok-emphasis"},{tag:B.strong,class:"tok-strong"},{tag:B.keyword,class:"tok-keyword"},{tag:B.atom,class:"tok-atom"},{tag:B.bool,class:"tok-bool"},{tag:B.url,class:"tok-url"},{tag:B.labelName,class:"tok-labelName"},{tag:B.inserted,class:"tok-inserted"},{tag:B.deleted,class:"tok-deleted"},{tag:B.literal,class:"tok-literal"},{tag:B.string,class:"tok-string"},{tag:B.number,class:"tok-number"},{tag:[B.regexp,B.escape,B.special(B.string)],class:"tok-string2"},{tag:B.variableName,class:"tok-variableName"},{tag:B.local(B.variableName),class:"tok-variableName tok-local"},{tag:B.definition(B.variableName),class:"tok-variableName tok-definition"},{tag:B.special(B.variableName),class:"tok-variableName2"},{tag:B.definition(B.propertyName),class:"tok-propertyName tok-definition"},{tag:B.typeName,class:"tok-typeName"},{tag:B.namespace,class:"tok-namespace"},{tag:B.className,class:"tok-className"},{tag:B.macroName,class:"tok-macroName"},{tag:B.propertyName,class:"tok-propertyName"},{tag:B.operator,class:"tok-operator"},{tag:B.comment,class:"tok-comment"},{tag:B.meta,class:"tok-meta"},{tag:B.invalid,class:"tok-invalid"},{tag:B.punctuation,class:"tok-punctuation"}]);var _P;const Wp=new Qn;function DR(t){return Wt.define({combine:t?e=>e.concat(t):void 0})}class rl{constructor(e,n,r=[]){this.data=e,Fn.prototype.hasOwnProperty("tree")||Object.defineProperty(Fn.prototype,"tree",{get(){return di(this)}}),this.parser=n,this.extension=[gh.of(this),Fn.languageData.of((i,o,s)=>i.facet(IU(i,o,s)))].concat(r)}isActiveAt(e,n,r=-1){return IU(e,n,r)==this.data}findRegions(e){let n=e.facet(gh);if((n==null?void 0:n.data)==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],i=(o,s)=>{if(o.prop(Wp)==this.data){r.push({from:s,to:s+o.length});return}let a=o.prop(Qn.mounted);if(a){if(a.tree.prop(Wp)==this.data){if(a.overlay)for(let l of a.overlay)r.push({from:l.from+s,to:l.to+s});else r.push({from:s,to:s+o.length});return}else if(a.overlay){let l=r.length;if(i(a.tree,a.overlay[0].from+s),r.length>l)return}}for(let l=0;l<o.children.length;l++){let c=o.children[l];c instanceof Vn&&i(c,o.positions[l]+s)}};return i(di(e),0),r}get allowsNesting(){return!0}}rl.setState=ln.define();function IU(t,e,n){let r=t.facet(gh);if(!r)return null;let i=r.data;if(r.allowsNesting)for(let o=di(t).topNode;o;o=o.enter(e,n,Ci.ExcludeBuffers))i=o.type.prop(Wp)||i;return i}class La extends rl{constructor(e,n){super(e,n),this.parser=n}static define(e){let n=DR(e.languageData);return new La(n,e.parser.configure({props:[Wp.add(r=>r.isTop?n:void 0)]}))}configure(e){return new La(this.data,this.parser.configure(e))}get allowsNesting(){return this.parser.hasWrappers()}}function di(t){let e=t.field(rl.state,!1);return e?e.tree:Vn.empty}class DIe{constructor(e,n=e.length){this.doc=e,this.length=n,this.cursorPos=0,this.string="",this.cursor=e.iter()}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let r=this.cursorPos-this.string.length;return e<r||n>=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let Um=null;class Up{constructor(e,n,r=[],i,o,s,a,l){this.parser=e,this.state=n,this.fragments=r,this.tree=i,this.treeLen=o,this.viewport=s,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new Up(e,n,[],Vn.empty,0,r,[],null)}startParse(){return this.parser.startParse(new DIe(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Vn.empty&&this.isDone(n!=null?n:this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n<this.state.doc.length&&this.parse.stopAt(n);;){let i=this.parse.advance();if(i)if(this.fragments=this.withoutTempSkipped(al.addTree(i,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=i,this.parse=null,this.treeLen<(n!=null?n:this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,n;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(al.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=Um;Um=this;try{return e()}finally{Um=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=zU(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:i,treeLen:o,viewport:s,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((c,u,f,h)=>l.push({fromA:c,toA:u,fromB:f,toB:h})),r=al.applyChanges(r,l),i=Vn.empty,o=0,s={from:e.mapPos(s.from,-1),to:e.mapPos(s.to,1)},this.skipped.length){a=[];for(let c of this.skipped){let u=e.mapPos(c.from,1),f=e.mapPos(c.to,-1);u<f&&a.push({from:u,to:f})}}}return new Up(this.parser,n,r,i,o,s,a,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let n=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:i,to:o}=this.skipped[r];i<e.to&&o>e.from&&(this.fragments=zU(this.fragments,i,o),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends ob{createParse(n,r,i){let o=i[0].from,s=i[i.length-1].to;return{parsedPos:o,advance(){let l=Um;if(l){for(let c of i)l.tempSkipped.push(c);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=s,new Vn(Ji.none,[],[],s-o)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return Um}}function zU(t,e,n){return al.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class d0{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new d0(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=Up.create(e.facet(gh).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new d0(r)}}rl.state=hi.define({create:d0.init,update(t,e){for(let n of e.effects)if(n.is(rl.setState))return n.value;return e.startState.facet(gh)!=e.state.facet(gh)?d0.init(e.state):t.apply(e)}});let bne=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback!="undefined"&&(bne=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:500-100})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const TP=typeof navigator!="undefined"&&((_P=navigator.scheduling)===null||_P===void 0?void 0:_P.isInputPending)?()=>navigator.scheduling.isInputPending():null,XIe=Ur.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let n=this.view.state.field(rl.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),e.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(rl.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=bne(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=n+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:i}}=this.view,o=r.field(rl.state);if(o.tree==o.context.tree&&o.context.isDone(i+1e5))return;let s=Date.now()+Math.min(this.chunkBudget,100,e&&!TP?Math.max(25,e.timeRemaining()-5):1e9),a=o.context.treeLen<i&&r.doc.length>i+1e3,l=o.context.work(()=>TP&&TP()||Date.now()>s,i+(a?0:1e5));this.chunkBudget-=Date.now()-n,(l||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:rl.setState.of(new d0(o.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>Aa(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),gh=Wt.define({combine(t){return t.length?t[0]:null},enables:[rl.state,XIe]});class fl{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}class _4{constructor(e,n,r,i,o,s=void 0){this.name=e,this.alias=n,this.extensions=r,this.filename=i,this.loadFunc=o,this.support=s,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:n,support:r}=e;if(!n){if(!r)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");n=()=>Promise.resolve(r)}return new _4(e.name,(e.alias||[]).concat(e.name).map(i=>i.toLowerCase()),e.extensions||[],e.filename,n,r)}static matchFilename(e,n){for(let i of e)if(i.filename&&i.filename.test(n))return i;let r=/\.([^.]+)$/.exec(n);if(r){for(let i of e)if(i.extensions.indexOf(r[1])>-1)return i}return null}static matchLanguageName(e,n,r=!0){n=n.toLowerCase();for(let i of e)if(i.alias.some(o=>o==n))return i;if(r)for(let i of e)for(let o of i.alias){let s=n.indexOf(o);if(s>-1&&(o.length>2||!/\w/.test(n[s-1])&&!/\w/.test(n[s+o.length])))return i}return null}}const XR=Wt.define(),sb=Wt.define({combine:t=>{if(!t.length)return" ";if(!/^(?: +|\t+)$/.test(t[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return t[0]}});function qp(t){let e=t.facet(sb);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function sy(t,e){let n="",r=t.tabSize;if(t.facet(sb).charCodeAt(0)==9)for(;e>=r;)n+=" ",e-=r;for(let i=0;i<e;i++)n+=" ";return n}function WR(t,e){t instanceof Fn&&(t=new M_(t));for(let r of t.state.facet(XR)){let i=r(t,e);if(i!=null)return i}let n=di(t.state);return n?WIe(t,n,e):null}class M_{constructor(e,n={}){this.state=e,this.options=n,this.unit=qp(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:o}=this.options;return i!=null&&i>=r.from&&i<=r.to?o&&i==e?{text:"",from:e}:(n<0?i<e:i<=e)?{text:r.text.slice(i-r.from),from:i}:{text:r.text.slice(0,i-r.from),from:r.from}:r}textAfterPos(e,n=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:i}=this.lineAt(e,n);return r.slice(e-i,Math.min(r.length,e+100-i))}column(e,n=1){let{text:r,from:i}=this.lineAt(e,n),o=this.countColumn(r,e-i),s=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return s>-1&&(o+=s-this.countColumn(r,r.search(/\S|$/))),o}countColumn(e,n=e.length){return rb(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:i}=this.lineAt(e,n),o=this.options.overrideIndentation;if(o){let s=o(i);if(s>-1)return s}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const ml=new Qn;function WIe(t,e,n){return xne(e.resolveInner(n).enterUnfinishedNodesBefore(n),n,t)}function UIe(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function qIe(t){let e=t.type.prop(ml);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(Qn.closedBy))){let i=t.lastChild,o=i&&r.indexOf(i.name)>-1;return s=>Sne(s,!0,1,void 0,o&&!UIe(s)?i.from:void 0)}return t.parent==null?BIe:null}function xne(t,e,n){for(;t;t=t.parent){let r=qIe(t);if(r)return r(UR.create(n,e,t))}return null}function BIe(){return 0}class UR extends M_{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.node=r}static create(e,n,r){return new UR(e,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){let e=this.state.doc.lineAt(this.node.from);for(;;){let n=this.node.resolve(e.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(YIe(n,this.node))break;e=this.state.doc.lineAt(n.from)}return this.lineIndent(e.from)}continue(){let e=this.node.parent;return e?xne(e,this.pos,this.base):0}}function YIe(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function FIe(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let i=t.options.simulateBreak,o=t.state.doc.lineAt(n.from),s=i==null||i<=o.from?o.to:Math.min(o.to,i);for(let a=n.to;;){let l=e.childAfter(a);if(!l||l==r)return null;if(!l.type.isSkipped)return l.from<s?n:null;a=l.to}}function kp({closing:t,align:e=!0,units:n=1}){return r=>Sne(r,e,n,t)}function Sne(t,e,n,r,i){let o=t.textAfter,s=o.match(/^\s*/)[0].length,a=r&&o.slice(s,s+r.length)==r||i==t.pos+s,l=e?FIe(t):null;return l?a?t.column(l.from):t.column(l.to):t.baseIndent+(a?0:t.unit*n)}const qR=t=>t.baseIndent;function rs({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const jIe=200;function wne(){return Fn.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let n=t.newDoc,{head:r}=t.newSelection.main,i=n.lineAt(r);if(r>i.from+jIe)return t;let o=n.sliceString(i.from,r);if(!e.some(c=>c.test(o)))return t;let{state:s}=t,a=-1,l=[];for(let{head:c}of s.selection.ranges){let u=s.doc.lineAt(c);if(u.from==a)continue;a=u.from;let f=WR(s,u.from);if(f==null)continue;let h=/^\s*/.exec(u.text)[0],d=sy(s,f);h!=d&&l.push({from:u.from,to:u.from+h.length,insert:d})}return l.length?[t,{changes:l,sequential:!0}]:t})}const ZIe=Wt.define(),gl=new Qn;function Eh(t){let e=t.firstChild,n=t.lastChild;return e&&e.to<n.from?{from:e.to,to:n.type.isError?t.to:n.from}:null}function VIe(t,e,n){let r=di(t);if(r.length<n)return null;let i=r.resolveInner(n),o=null;for(let s=i;s;s=s.parent){if(s.to<=n||s.from>n)continue;if(o&&s.from<e)break;let a=s.type.prop(gl);if(a&&(s.to<r.length-50||r.length==t.doc.length||!GIe(s))){let l=a(s,t);l&&l.from<=n&&l.from>=e&&l.to>n&&(o=l)}}return o}function GIe(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function T4(t,e,n){for(let r of t.facet(ZIe)){let i=r(t,e,n);if(i)return i}return VIe(t,e,n)}function _ne(t,e){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);return n>=r?void 0:{from:n,to:r}}const D_=ln.define({map:_ne}),ab=ln.define({map:_ne});function Tne(t){let e=[];for(let{head:n}of t.state.selection.ranges)e.some(r=>r.from<=n&&r.to>=n)||e.push(t.lineBlockAt(n));return e}const Bp=hi.define({create(){return Et.none},update(t,e){t=t.map(e.changes);for(let n of e.effects)n.is(D_)&&!HIe(t,n.value.from,n.value.to)?t=t.update({add:[LU.range(n.value.from,n.value.to)]}):n.is(ab)&&(t=t.update({filter:(r,i)=>n.value.from!=r||n.value.to!=i,filterFrom:n.value.from,filterTo:n.value.to}));if(e.selection){let n=!1,{head:r}=e.selection.main;t.between(r,r,(i,o)=>{i<r&&o>r&&(n=!0)}),n&&(t=t.update({filterFrom:r,filterTo:r,filter:(i,o)=>o<=r||i>=r}))}return t},provide:t=>_t.decorations.from(t),toJSON(t,e){let n=[];return t.between(0,e.doc.length,(r,i)=>{n.push(r,i)}),n},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let n=0;n<t.length;){let r=t[n++],i=t[n++];if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid JSON for fold state");e.push(LU.range(r,i))}return Et.set(e,!0)}});function k4(t,e,n){var r;let i=null;return(r=t.field(Bp,!1))===null||r===void 0||r.between(e,n,(o,s)=>{(!i||i.from>o)&&(i={from:o,to:s})}),i}function HIe(t,e,n){let r=!1;return t.between(e,e,(i,o)=>{i==e&&o==n&&(r=!0)}),r}function kne(t,e){return t.field(Bp,!1)?e:e.concat(ln.appendConfig.of(Rne()))}const KIe=t=>{for(let e of Tne(t)){let n=T4(t.state,e.from,e.to);if(n)return t.dispatch({effects:kne(t.state,[D_.of(n),Pne(t,n)])}),!0}return!1},JIe=t=>{if(!t.state.field(Bp,!1))return!1;let e=[];for(let n of Tne(t)){let r=k4(t.state,n.from,n.to);r&&e.push(ab.of(r),Pne(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function Pne(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,i=t.state.doc.lineAt(e.to).number;return _t.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${i}.`)}const Qne=t=>{let{state:e}=t,n=[];for(let r=0;r<e.doc.length;){let i=t.lineBlockAt(r),o=T4(e,i.from,i.to);o&&n.push(D_.of(o)),r=(o?t.lineBlockAt(o.to):i).to+1}return n.length&&t.dispatch({effects:kne(t.state,n)}),!!n.length},$ne=t=>{let e=t.state.field(Bp,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,i)=>{n.push(ab.of({from:r,to:i}))}),t.dispatch({effects:n}),!0},Ene=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:KIe},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:JIe},{key:"Ctrl-Alt-[",run:Qne},{key:"Ctrl-Alt-]",run:$ne}],eze={placeholderDOM:null,placeholderText:"\u2026"},Cne=Wt.define({combine(t){return fa(t,eze)}});function Rne(t){let e=[Bp,nze];return t&&e.push(Cne.of(t)),e}const LU=Et.replace({widget:new class extends oc{toDOM(t){let{state:e}=t,n=e.facet(Cne),r=o=>{let s=t.lineBlockAt(t.posAtDOM(o.target)),a=k4(t.state,s.from,s.to);a&&t.dispatch({effects:ab.of(a)}),o.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(t,r);let i=document.createElement("span");return i.textContent=n.placeholderText,i.setAttribute("aria-label",e.phrase("folded code")),i.title=e.phrase("unfold"),i.className="cm-foldPlaceholder",i.onclick=r,i}}}),tze={openText:"\u2304",closedText:"\u203A",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class kP extends Iu{constructor(e,n){super(),this.config=e,this.open=n}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=e.state.phrase(this.open?"Fold line":"Unfold line"),n}}function Ane(t={}){let e=Object.assign(Object.assign({},tze),t),n=new kP(e,!0),r=new kP(e,!1),i=Ur.fromClass(class{constructor(s){this.from=s.viewport.from,this.markers=this.buildMarkers(s)}update(s){(s.docChanged||s.viewportChanged||s.startState.facet(gh)!=s.state.facet(gh)||s.startState.field(Bp,!1)!=s.state.field(Bp,!1)||di(s.startState)!=di(s.state)||e.foldingChanged(s))&&(this.markers=this.buildMarkers(s.view))}buildMarkers(s){let a=new Cu;for(let l of s.viewportLineBlocks){let c=k4(s.state,l.from,l.to)?r:T4(s.state,l.from,l.to)?n:null;c&&a.add(l.from,l.from,c)}return a.finish()}}),{domEventHandlers:o}=e;return[i,cne({class:"cm-foldGutter",markers(s){var a;return((a=s.plugin(i))===null||a===void 0?void 0:a.markers)||Wr.empty},initialSpacer(){return new kP(e,!1)},domEventHandlers:Object.assign(Object.assign({},o),{click:(s,a,l)=>{if(o.click&&o.click(s,a,l))return!0;let c=k4(s.state,a.from,a.to);if(c)return s.dispatch({effects:ab.of(c)}),!0;let u=T4(s.state,a.from,a.to);return u?(s.dispatch({effects:D_.of(u)}),!0):!1}})}),Rne()]}const nze=_t.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class lb{constructor(e,n){let r;function i(a){let l=Ru.newName();return(r||(r=Object.create(null)))["."+l]=a,l}const o=typeof n.all=="string"?n.all:n.all?i(n.all):void 0,s=n.scope;this.scope=s instanceof rl?a=>a.prop(Wp)==s.data:s?a=>a==s:void 0,this.style=MR(e.map(a=>({tag:a.tag,class:a.class||i(Object.assign({},a,{tag:null}))})),{all:o}).style,this.module=r?new Ru(r):null,this.themeType=n.themeType}static define(e,n){return new lb(e,n||{})}}const B8=Wt.define(),Ine=Wt.define({combine(t){return t.length?[t[0]]:null}});function PP(t){let e=t.facet(B8);return e.length?e:t.facet(Ine)}function X_(t,e){let n=[ize],r;return t instanceof lb&&(t.module&&n.push(_t.styleModule.of(t.module)),r=t.themeType),e!=null&&e.fallback?n.push(Ine.of(t)):r?n.push(B8.computeN([_t.darkTheme],i=>i.facet(_t.darkTheme)==(r=="dark")?[t]:[])):n.push(B8.of(t)),n}class rze{constructor(e){this.markCache=Object.create(null),this.tree=di(e.state),this.decorations=this.buildDeco(e,PP(e.state))}update(e){let n=di(e.state),r=PP(e.state),i=r!=PP(e.startState);n.length<e.view.viewport.to&&!i&&n.type==this.tree.type?this.decorations=this.decorations.map(e.changes):(n!=this.tree||e.viewportChanged||i)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r))}buildDeco(e,n){if(!n||!this.tree.length)return Et.none;let r=new Cu;for(let{from:i,to:o}of e.visibleRanges)NIe(this.tree,n,(s,a,l)=>{r.add(s,a,this.markCache[l]||(this.markCache[l]=Et.mark({class:l})))},i,o);return r.finish()}}const ize=Zf.high(Ur.fromClass(rze,{decorations:t=>t.decorations})),BR=lb.define([{tag:B.meta,color:"#7a757a"},{tag:B.link,textDecoration:"underline"},{tag:B.heading,textDecoration:"underline",fontWeight:"bold"},{tag:B.emphasis,fontStyle:"italic"},{tag:B.strong,fontWeight:"bold"},{tag:B.strikethrough,textDecoration:"line-through"},{tag:B.keyword,color:"#708"},{tag:[B.atom,B.bool,B.url,B.contentSeparator,B.labelName],color:"#219"},{tag:[B.literal,B.inserted],color:"#164"},{tag:[B.string,B.deleted],color:"#a11"},{tag:[B.regexp,B.escape,B.special(B.string)],color:"#e40"},{tag:B.definition(B.variableName),color:"#00f"},{tag:B.local(B.variableName),color:"#30a"},{tag:[B.typeName,B.namespace],color:"#085"},{tag:B.className,color:"#167"},{tag:[B.special(B.variableName),B.macroName],color:"#256"},{tag:B.definition(B.propertyName),color:"#00c"},{tag:B.comment,color:"#940"},{tag:B.invalid,color:"#f00"}]),oze=_t.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),zne=1e4,Lne="()[]{}",Nne=Wt.define({combine(t){return fa(t,{afterCursor:!0,brackets:Lne,maxScanDistance:zne,renderMatch:lze})}}),sze=Et.mark({class:"cm-matchingBracket"}),aze=Et.mark({class:"cm-nonmatchingBracket"});function lze(t){let e=[],n=t.matched?sze:aze;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}const cze=hi.define({create(){return Et.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],r=e.state.facet(Nne);for(let i of e.state.selection.ranges){if(!i.empty)continue;let o=Ou(e.state,i.head,-1,r)||i.head>0&&Ou(e.state,i.head-1,1,r)||r.afterCursor&&(Ou(e.state,i.head,1,r)||i.head<e.state.doc.length&&Ou(e.state,i.head+1,-1,r));o&&(n=n.concat(r.renderMatch(o,e.state)))}return Et.set(n,!0)},provide:t=>_t.decorations.from(t)}),uze=[cze,oze];function Mne(t={}){return[Nne.of(t),uze]}function Y8(t,e,n){let r=t.prop(e<0?Qn.openedBy:Qn.closedBy);if(r)return r;if(t.name.length==1){let i=n.indexOf(t.name);if(i>-1&&i%2==(e<0?1:0))return[n[i+e]]}return null}function Ou(t,e,n,r={}){let i=r.maxScanDistance||zne,o=r.brackets||Lne,s=di(t),a=s.resolveInner(e,n);for(let l=a;l;l=l.parent){let c=Y8(l.type,n,o);if(c&&l.from<l.to)return fze(t,e,n,l,c,o)}return dze(t,e,n,s,a.type,i,o)}function fze(t,e,n,r,i,o){let s=r.parent,a={from:r.from,to:r.to},l=0,c=s==null?void 0:s.cursor();if(c&&(n<0?c.childBefore(r.from):c.childAfter(r.to)))do if(n<0?c.to<=r.from:c.from>=r.to){if(l==0&&i.indexOf(c.type.name)>-1&&c.from<c.to)return{start:a,end:{from:c.from,to:c.to},matched:!0};if(Y8(c.type,n,o))l++;else if(Y8(c.type,-n,o)){if(l==0)return{start:a,end:c.from==c.to?void 0:{from:c.from,to:c.to},matched:!1};l--}}while(n<0?c.prevSibling():c.nextSibling());return{start:a,matched:!1}}function dze(t,e,n,r,i,o,s){let a=n<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=s.indexOf(a);if(l<0||l%2==0!=n>0)return null;let c={from:n<0?e-1:e,to:n>0?e+1:e},u=t.doc.iterRange(e,n>0?t.doc.length:0),f=0;for(let h=0;!u.next().done&&h<=o;){let d=u.value;n<0&&(h+=d.length);let O=e+h*n;for(let b=n>0?0:d.length-1,v=n>0?d.length:-1;b!=v;b+=n){let p=s.indexOf(d[b]);if(!(p<0||r.resolveInner(O+b,1).type!=i))if(p%2==0==n>0)f++;else{if(f==1)return{start:c,end:{from:O+b,to:O+b+1},matched:p>>1==l>>1};f--}}n>0&&(h+=d.length)}return u.done?{start:c,matched:!1}:null}function NU(t,e,n,r=0,i=0){e==null&&(e=t.search(/[^\s\u00a0]/),e==-1&&(e=t.length));let o=i;for(let s=r;s<e;s++)t.charCodeAt(s)==9?o+=n-o%n:o++;return o}class Dne{constructor(e,n,r){this.string=e,this.tabSize=n,this.indentUnit=r,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(e){let n=this.string.charAt(this.pos),r;if(typeof e=="string"?r=n==e:r=n&&(e instanceof RegExp?e.test(n):e(n)),r)return++this.pos,n}eatWhile(e){let n=this.pos;for(;this.eat(e););return this.pos>n}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let n=this.string.indexOf(e,this.pos);if(n>-1)return this.pos=n,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=NU(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){return NU(this.string,null,this.tabSize)}match(e,n,r){if(typeof e=="string"){let i=s=>r?s.toLowerCase():s,o=this.string.substr(this.pos,e.length);return i(o)==i(e)?(n!==!1&&(this.pos+=e.length),!0):null}else{let i=this.string.slice(this.pos).match(e);return i&&i.index>0?null:(i&&n!==!1&&(this.pos+=i[0].length),i)}}current(){return this.string.slice(this.start,this.pos)}}function hze(t){return{token:t.token,blankLine:t.blankLine||(()=>{}),startState:t.startState||(()=>!0),copyState:t.copyState||pze,indent:t.indent||(()=>null),languageData:t.languageData||{},tokenTable:t.tokenTable||FR}}function pze(t){if(typeof t!="object")return t;let e={};for(let n in t){let r=t[n];e[n]=r instanceof Array?r.slice():r}return e}class li extends rl{constructor(e){let n=DR(e.languageData),r=hze(e),i,o=new class extends ob{createParse(s,a,l){return new mze(i,s,a,l)}};super(n,o,[XR.of((s,a)=>this.getIndent(s,a))]),this.topNode=yze(n),i=this,this.streamParser=r,this.stateAfter=new Qn({perNode:!0}),this.tokenTable=e.tokenTable?new qne(r.tokenTable):vze}static define(e){return new li(e)}getIndent(e,n){let r=di(e.state),i=r.resolve(n);for(;i&&i.type!=this.topNode;)i=i.parent;if(!i)return null;let o=YR(this,r,0,i.from,n),s,a;if(o?(a=o.state,s=o.pos+1):(a=this.streamParser.startState(e.unit),s=0),n-s>1e4)return null;for(;s<n;){let c=e.state.doc.lineAt(s),u=Math.min(n,c.to);if(c.length){let f=new Dne(c.text,e.state.tabSize,e.unit);for(;f.pos<u-c.from;)Wne(this.streamParser.token,f,a)}else this.streamParser.blankLine(a,e.unit);if(u==n)break;s=c.to+1}let{text:l}=e.lineAt(n);return this.streamParser.indent(a,/^\s*(.*)/.exec(l)[1],e)}get allowsNesting(){return!1}}function YR(t,e,n,r,i){let o=n>=r&&n+e.length<=i&&e.prop(t.stateAfter);if(o)return{state:t.streamParser.copyState(o),pos:n+e.length};for(let s=e.children.length-1;s>=0;s--){let a=e.children[s],l=n+e.positions[s],c=a instanceof Vn&&l<i&&YR(t,a,l,r,i);if(c)return c}return null}function Xne(t,e,n,r,i){if(i&&n<=0&&r>=e.length)return e;!i&&e.type==t.topNode&&(i=!0);for(let o=e.children.length-1;o>=0;o--){let s=e.positions[o],a=e.children[o],l;if(s<r&&a instanceof Vn){if(!(l=Xne(t,a,n-s,r-s,i)))break;return i?new Vn(e.type,e.children.slice(0,o).concat(l),e.positions.slice(0,o+1),s+l.length):l}}return null}function Oze(t,e,n,r){for(let i of e){let o=i.from+(i.openStart?25:0),s=i.to-(i.openEnd?25:0),a=o<=n&&s>n&&YR(t,i.tree,0-i.offset,n,s),l;if(a&&(l=Xne(t,i.tree,n+i.offset,a.pos+i.offset,!1)))return{state:a.state,tree:l}}return{state:t.streamParser.startState(r?qp(r):4),tree:Vn.empty}}class mze{constructor(e,n,r,i){this.lang=e,this.input=n,this.fragments=r,this.ranges=i,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=i[i.length-1].to;let o=Up.get(),s=i[0].from,{state:a,tree:l}=Oze(e,r,s,o==null?void 0:o.state);this.state=a,this.parsedPos=this.chunkStart=s+l.length;for(let c=0;c<l.children.length;c++)this.chunks.push(l.children[c]),this.chunkPos.push(l.positions[c]);o&&this.parsedPos<o.viewport.from-1e5&&(this.state=this.lang.streamParser.startState(qp(o.state)),o.skipUntilInView(this.parsedPos,o.viewport.from),this.parsedPos=o.viewport.from),this.moveRangeIndex()}advance(){let e=Up.get(),n=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),r=Math.min(n,this.chunkStart+2048);for(e&&(r=Math.min(r,e.viewport.to));this.parsedPos<r;)this.parseLine(e);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=n?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,n),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let n=this.input.chunk(e);if(this.input.lineChunks)n==`
|
|
1144
1144
|
`&&(n="");else{let r=n.indexOf(`
|
|
1145
|
-
`);r>-1&&(n=n.slice(0,r))}return e+n.length<=this.to?n:n.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,n=this.lineAfter(e),r=e+n.length;for(let i=this.rangeIndex;;){let o=this.ranges[i].to;if(o>=r||(n=n.slice(0,o-(r-n.length)),i++,i==this.ranges.length))break;let s=this.ranges[i].from,a=this.lineAfter(s);n+=a,r=s+a.length}return{line:n,end:r}}skipGapsTo(e,n,r){for(;;){let i=this.ranges[this.rangeIndex].to,o=e+n;if(r>0?i>o:i>=o)break;n+=this.ranges[++this.rangeIndex].from-i}return n}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,n,r,i,o){if(this.ranges.length>1){o=this.skipGapsTo(n,o,1),n+=o;let s=this.chunk.length;o=this.skipGapsTo(r,o,-1),r+=o,i+=this.chunk.length-s}return this.chunk.push(e,n,r,i),o}parseLine(e){let{line:n,end:r}=this.nextLine(),i=0,{streamParser:o}=this.lang,s=new Dne(n,e?e.state.tabSize:4,e?qp(e.state):2);if(s.eol())o.blankLine(this.state,s.indentUnit);else for(;!s.eol();){let a=Wne(o.token,s,this.state);if(a&&(i=this.emitToken(this.lang.tokenTable.resolve(a),this.parsedPos+s.start,this.parsedPos+s.pos,4,i)),s.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=Vn.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:gze,topID:0,maxBufferLength:2048,reused:this.chunkReused});e=new Vn(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new Vn(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}function Wne(t,e,n){e.start=e.pos;for(let r=0;r<10;r++){let i=t(e,n);if(e.pos>e.start)return i}throw new Error("Stream parser failed to advance stream.")}const FR=Object.create(null),ay=[Ji.none],gze=new V0(ay),MU=[],Une=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])Une[t]=Bne(FR,e);class qne{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),Une)}resolve(e){return e?this.table[e]||(this.table[e]=Bne(this.extra,e)):0}}const vze=new qne(FR);function QP(t,e){MU.indexOf(t)>-1||(MU.push(t),console.warn(e))}function Bne(t,e){let n=null;for(let o of e.split(".")){let s=t[o]||B[o];s?typeof s=="function"?n?n=s(n):QP(o,`Modifier ${o} used at start of tag`):n?QP(o,`Tag ${o} used as modifier`):n=s:QP(o,`Unknown highlighting tag ${o}`)}if(!n)return 0;let r=e.replace(/ /g,"_"),i=Ji.define({id:ay.length,name:r,props:[da({[r]:n})]});return ay.push(i),i.id}function yze(t){let e=Ji.define({id:ay.length,name:"Document",props:[Wp.add(()=>t)]});return ay.push(e),e}class Yne{constructor(e,n,r){this.state=e,this.pos=n,this.explicit=r,this.abortListeners=[]}tokenBefore(e){let n=di(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),i=n.text.slice(r-n.from,this.pos-n.from),o=i.search(jne(e,!1));return o<0?null:{from:r+o,to:this.pos,text:i.slice(o)}}get aborted(){return this.abortListeners==null}addEventListener(e,n){e=="abort"&&this.abortListeners&&this.abortListeners.push(n)}}function DU(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function bze(t){let e=Object.create(null),n=Object.create(null);for(let{label:i}of t){e[i[0]]=!0;for(let o=1;o<i.length;o++)n[i[o]]=!0}let r=DU(e)+DU(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function jR(t){let e=t.map(i=>typeof i=="string"?{label:i}:i),[n,r]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:bze(e);return i=>{let o=i.matchBefore(r);return o||i.explicit?{from:o?o.from:i.pos,options:e,validFor:n}:null}}function Fne(t,e){return n=>{for(let r=di(n.state).resolveInner(n.pos,-1);r;r=r.parent)if(t.indexOf(r.name)>-1)return null;return e(n)}}class XU{constructor(e,n,r){this.completion=e,this.source=n,this.match=r}}function sh(t){return t.selection.main.head}function jne(t,e){var n;let{source:r}=t,i=e&&r[0]!="^",o=r[r.length-1]!="$";return!i&&!o?t:new RegExp(`${i?"^":""}(?:${r})${o?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}function ly(t,e,n,r){return Object.assign(Object.assign({},t.changeByRange(i=>{if(i==t.selection.main)return{changes:{from:n,to:r,insert:e},range:De.cursor(n+e.length)};let o=r-n;return!i.empty||o&&t.sliceDoc(i.from-o,i.from)!=t.sliceDoc(n,r)?{range:i}:{changes:{from:i.from-o,to:i.from,insert:e},range:De.cursor(i.from-o+e.length)}})),{userEvent:"input.complete"})}function Zne(t,e){const n=e.completion.apply||e.completion.label;let r=e.source;typeof n=="string"?t.dispatch(ly(t.state,n,r.from,r.to)):n(t,e.completion,r.from,r.to)}const WU=new WeakMap;function xze(t){if(!Array.isArray(t))return t;let e=WU.get(t);return e||WU.set(t,e=jR(t)),e}class Sze{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[];for(let n=0;n<e.length;){let r=vs(e,n),i=Ka(r);this.chars.push(r);let o=e.slice(n,n+i),s=o.toUpperCase();this.folded.push(vs(s==o?o.toLowerCase():s,0)),n+=i}this.astral=e.length!=this.chars.length}match(e){if(this.pattern.length==0)return[0];if(e.length<this.pattern.length)return null;let{chars:n,folded:r,any:i,precise:o,byWord:s}=this;if(n.length==1){let g=vs(e,0);return g==n[0]?[0,0,Ka(g)]:g==r[0]?[-200,0,Ka(g)]:null}let a=e.indexOf(this.pattern);if(a==0)return[0,0,this.pattern.length];let l=n.length,c=0;if(a<0){for(let g=0,y=Math.min(e.length,200);g<y&&c<l;){let S=vs(e,g);(S==n[c]||S==r[c])&&(i[c++]=g),g+=Ka(S)}if(c<l)return null}let u=0,f=0,h=!1,d=0,O=-1,b=-1,v=/[a-z]/.test(e),p=!0;for(let g=0,y=Math.min(e.length,200),S=0;g<y&&f<l;){let w=vs(e,g);a<0&&(u<l&&w==n[u]&&(o[u++]=g),d<l&&(w==n[d]||w==r[d]?(d==0&&(O=g),b=g+1,d++):d=0));let T,k=w<255?w>=48&&w<=57||w>=97&&w<=122?2:w>=65&&w<=90?1:0:(T=SR(w))!=T.toLowerCase()?1:T!=T.toUpperCase()?2:0;(!g||k==1&&v||S==0&&k!=0)&&(n[f]==w||r[f]==w&&(h=!0)?s[f++]=g:s.length&&(p=!1)),S=k,g+=Ka(w)}return f==l&&s[0]==0&&p?this.result(-100+(h?-200:0),s,e):d==l&&O==0?[-200-e.length,0,b]:a>-1?[-700-e.length,a,a+this.pattern.length]:d==l?[-200+-700-e.length,O,b]:f==l?this.result(-100+(h?-200:0)+-700+(p?0:-1100),s,e):n.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,n,r){let i=[e-r.length],o=1;for(let s of n){let a=s+(this.astral?Ka(vs(r,s)):1);o>1&&i[o-1]==s?i[o-1]=a:(i[o++]=s,i[o++]=a)}return i}}const vh=Wt.define({combine(t){return fa(t,{activateOnTyping:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[]},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,optionClass:(e,n)=>r=>wze(e(r),n(r)),addToOptions:(e,n)=>e.concat(n)})}});function wze(t,e){return t?e?t+" "+e:t:e}function _ze(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,i){let o=document.createElement("span");o.className="cm-completionLabel";let{label:s}=n,a=0;for(let l=1;l<i.length;){let c=i[l++],u=i[l++];c>a&&o.appendChild(document.createTextNode(s.slice(a,c)));let f=o.appendChild(document.createElement("span"));f.appendChild(document.createTextNode(s.slice(c,u))),f.className="cm-completionMatchedText",a=u}return a<s.length&&o.appendChild(document.createTextNode(s.slice(a))),o},position:50},{render(n){if(!n.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=n.detail,r},position:80}),e.sort((n,r)=>n.position-r.position).map(n=>n.render)}function UU(t,e,n){if(t<=n)return{from:0,to:t};if(e<=t>>1){let i=Math.floor(e/n);return{from:i*n,to:(i+1)*n}}let r=Math.floor((t-e)/n);return{from:t-(r+1)*n,to:t-r*n}}class Tze{constructor(e,n){this.view=e,this.stateField=n,this.info=null,this.placeInfo={read:()=>this.measureInfo(),write:a=>this.positionInfo(a),key:this};let r=e.state.field(n),{options:i,selected:o}=r.open,s=e.state.facet(vh);this.optionContent=_ze(s),this.optionClass=s.optionClass,this.range=UU(i.length,o,s.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.dom.addEventListener("mousedown",a=>{for(let l=a.target,c;l&&l!=this.dom;l=l.parentNode)if(l.nodeName=="LI"&&(c=/-(\d+)$/.exec(l.id))&&+c[1]<i.length){Zne(e,i[+c[1]]),a.preventDefault();return}}),this.list=this.dom.appendChild(this.createListBox(i,r.id,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfo)})}mount(){this.updateSel()}update(e){e.state.field(this.stateField)!=e.startState.field(this.stateField)&&this.updateSel()}positioned(){this.info&&this.view.requestMeasure(this.placeInfo)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;if((n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=UU(n.options.length,n.selected,this.view.state.facet(vh).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(n.options,e.id,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfo)})),this.updateSelectedOption(n.selected)){this.info&&(this.info.remove(),this.info=null);let{completion:r}=n.options[n.selected],{info:i}=r;if(!i)return;let o=typeof i=="string"?document.createTextNode(i):i(r);if(!o)return;"then"in o?o.then(s=>{s&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(s)}).catch(s=>Aa(this.view.state,s,"completion info")):this.addInfoPane(o)}}addInfoPane(e){let n=this.info=document.createElement("div");n.className="cm-tooltip cm-completionInfo",n.appendChild(e),this.dom.appendChild(n),this.view.requestMeasure(this.placeInfo)}updateSelectedOption(e){let n=null;for(let r=this.list.firstChild,i=this.range.from;r;r=r.nextSibling,i++)i==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&r.removeAttribute("aria-selected");return n&&Pze(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),i=e.getBoundingClientRect();if(i.top>Math.min(innerHeight,n.bottom)-10||i.bottom<Math.max(0,n.top)+10)return null;let o=Math.max(0,Math.min(i.top,innerHeight-r.height))-n.top,s=this.view.textDirection==Ai.RTL,a=n.left,l=innerWidth-n.right;return s&&a<Math.min(r.width,l)?s=!1:!s&&l<Math.min(r.width,a)&&(s=!0),{top:o,left:s}}positionInfo(e){this.info&&(this.info.style.top=(e?e.top:-1e6)+"px",e&&(this.info.classList.toggle("cm-completionInfo-left",e.left),this.info.classList.toggle("cm-completionInfo-right",!e.left)))}createListBox(e,n,r){const i=document.createElement("ul");i.id=n,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions"));for(let o=r.from;o<r.to;o++){let{completion:s,match:a}=e[o];const l=i.appendChild(document.createElement("li"));l.id=n+"-"+o,l.setAttribute("role","option");let c=this.optionClass(s);c&&(l.className=c);for(let u of this.optionContent){let f=u(s,this.view.state,a);f&&l.appendChild(f)}}return r.from&&i.classList.add("cm-completionListIncompleteTop"),r.to<e.length&&i.classList.add("cm-completionListIncompleteBottom"),i}}function kze(t){return e=>new Tze(e,t)}function Pze(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();r.top<n.top?t.scrollTop-=n.top-r.top:r.bottom>n.bottom&&(t.scrollTop+=r.bottom-n.bottom)}function qU(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function Qze(t,e){let n=[],r=0;for(let s of t)if(s.hasResult())if(s.result.filter===!1){let a=s.result.getMatch;for(let l of s.result.options){let c=[1e9-r++];if(a)for(let u of a(l))c.push(u);n.push(new XU(l,s,c))}}else{let a=new Sze(e.sliceDoc(s.from,s.to)),l;for(let c of s.result.options)(l=a.match(c.label))&&(c.boost!=null&&(l[0]+=c.boost),n.push(new XU(c,s,l)))}let i=[],o=null;for(let s of n.sort(Rze))!o||o.label!=s.completion.label||o.detail!=s.completion.detail||o.type!=null&&s.completion.type!=null&&o.type!=s.completion.type||o.apply!=s.completion.apply?i.push(s):qU(s.completion)>qU(o)&&(i[i.length-1]=s),o=s.completion;return i}class Kg{constructor(e,n,r,i,o){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=i,this.selected=o}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new Kg(this.options,BU(n,e),this.tooltip,this.timestamp,e)}static build(e,n,r,i,o){let s=Qze(e,n);if(!s.length)return null;let a=0;if(i&&i.selected){let l=i.options[i.selected].completion;for(let c=0;c<s.length;c++)if(s[c].completion==l){a=c;break}}return new Kg(s,BU(r,a),{pos:e.reduce((l,c)=>c.hasResult()?Math.min(l,c.from):l,1e8),create:kze(Dl),above:o.aboveCursor},i?i.timestamp:Date.now(),a)}map(e){return new Kg(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected)}}class P4{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new P4(Cze,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(vh),o=(r.override||n.languageDataAt("autocomplete",sh(n)).map(xze)).map(a=>(this.active.find(c=>c.source==a)||new ka(a,this.active.some(c=>c.state!=0)?1:0)).update(e,r));o.length==this.active.length&&o.every((a,l)=>a==this.active[l])&&(o=this.active);let s=e.selection||o.some(a=>a.hasResult()&&e.changes.touchesRange(a.from,a.to))||!$ze(o,this.active)?Kg.build(o,n,this.id,this.open,r):this.open&&e.docChanged?this.open.map(e.changes):this.open;!s&&o.every(a=>a.state!=1)&&o.some(a=>a.hasResult())&&(o=o.map(a=>a.hasResult()?new ka(a.source,0):a));for(let a of e.effects)a.is(Gne)&&(s=s&&s.setSelected(a.value,this.id));return o==this.active&&s==this.open?this:new P4(o,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:Eze}}function $ze(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n<t.length&&!t[n].hasResult;)n++;for(;r<e.length&&!e[r].hasResult;)r++;let i=n==t.length,o=r==e.length;if(i||o)return i==o;if(t[n++].result!=e[r++].result)return!1}}const Eze={"aria-autocomplete":"list"};function BU(t,e){return{"aria-autocomplete":"list","aria-haspopup":"listbox","aria-activedescendant":t+"-"+e,"aria-controls":t}}const Cze=[];function Rze(t,e){let n=e.match[0]-t.match[0];return n||t.completion.label.localeCompare(e.completion.label)}function F8(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}class ka{constructor(e,n,r=-1){this.source=e,this.state=n,this.explicitPos=r}hasResult(){return!1}update(e,n){let r=F8(e),i=this;r?i=i.handleUserEvent(e,r,n):e.docChanged?i=i.handleChange(e):e.selection&&i.state!=0&&(i=new ka(i.source,0));for(let o of e.effects)if(o.is(ZR))i=new ka(i.source,1,o.value?sh(e.state):-1);else if(o.is(Q4))i=new ka(i.source,0);else if(o.is(Vne))for(let s of o.value)s.source==i.source&&(i=s);return i}handleUserEvent(e,n,r){return n=="delete"||!r.activateOnTyping?this.map(e.changes):new ka(this.source,1)}handleChange(e){return e.changes.touchesRange(sh(e.startState))?new ka(this.source,0):this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new ka(this.source,this.state,e.mapPos(this.explicitPos))}}class Jg extends ka{constructor(e,n,r,i,o){super(e,2,n),this.result=r,this.from=i,this.to=o}hasResult(){return!0}handleUserEvent(e,n,r){var i;let o=e.changes.mapPos(this.from),s=e.changes.mapPos(this.to,1),a=sh(e.state);if((this.explicitPos<0?a<=o:a<this.from)||a>s||n=="delete"&&sh(e.startState)==this.from)return new ka(this.source,n=="input"&&r.activateOnTyping?1:0);let l=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos),c;return Aze(this.result.validFor,e.state,o,s)?new Jg(this.source,l,this.result,o,s):this.result.update&&(c=this.result.update(this.result,o,s,new Yne(e.state,a,l>=0)))?new Jg(this.source,l,c,c.from,(i=c.to)!==null&&i!==void 0?i:sh(e.state)):new ka(this.source,1,l)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new ka(this.source,0):this.map(e.changes)}map(e){return e.empty?this:new Jg(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1))}}function Aze(t,e,n,r){if(!t)return!1;let i=e.sliceDoc(n,r);return typeof t=="function"?t(i,n,r,e):jne(t,!0).test(i)}const ZR=ln.define(),Q4=ln.define(),Vne=ln.define({map(t,e){return t.map(n=>n.map(e))}}),Gne=ln.define(),Dl=hi.define({create(){return P4.start()},update(t,e){return t.update(e)},provide:t=>[N_.from(t,e=>e.tooltip),_t.contentAttributes.from(t,e=>e.attrs)]}),Hne=75;function d2(t,e="option"){return n=>{let r=n.state.field(Dl,!1);if(!r||!r.open||Date.now()-r.open.timestamp<Hne)return!1;let i=1,o;e=="page"&&(o=cIe(n,r.open.tooltip))&&(i=Math.max(2,Math.floor(o.dom.offsetHeight/o.dom.querySelector("li").offsetHeight)-1));let s=r.open.selected+i*(t?1:-1),{length:a}=r.open.options;return s<0?s=e=="page"?0:a-1:s>=a&&(s=e=="page"?a-1:0),n.dispatch({effects:Gne.of(s)}),!0}}const Kne=t=>{let e=t.state.field(Dl,!1);return t.state.readOnly||!e||!e.open||Date.now()-e.open.timestamp<Hne?!1:(Zne(t,e.open.options[e.open.selected]),!0)},Jne=t=>t.state.field(Dl,!1)?(t.dispatch({effects:ZR.of(!0)}),!0):!1,Ize=t=>{let e=t.state.field(Dl,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:Q4.of(null)}),!0)};class zze{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const YU=50,Lze=50,Nze=1e3,Mze=Ur.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.composing=0;for(let e of t.state.field(Dl).active)e.state==1&&this.startQuery(e)}update(t){let e=t.state.field(Dl);if(!t.selectionSet&&!t.docChanged&&t.startState.field(Dl)==e)return;let n=t.transactions.some(r=>(r.selection||r.docChanged)&&!F8(r));for(let r=0;r<this.running.length;r++){let i=this.running[r];if(n||i.updates.length+t.transactions.length>Lze&&Date.now()-i.time>Nze){for(let o of i.context.abortListeners)try{o()}catch(s){Aa(this.view.state,s)}i.context.abortListeners=null,this.running.splice(r--,1)}else i.updates.push(...t.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some(r=>r.state==1&&!this.running.some(i=>i.active.source==r.source))?setTimeout(()=>this.startUpdate(),YU):-1,this.composing!=0)for(let r of t.transactions)F8(r)=="input"?this.composing=2:this.composing==2&&r.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:t}=this.view,e=t.field(Dl);for(let n of e.active)n.state==1&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n)}startQuery(t){let{state:e}=this.view,n=sh(e),r=new Yne(e,n,t.explicitPos==n),i=new zze(t,r);this.running.push(i),Promise.resolve(t.source(r)).then(o=>{i.context.aborted||(i.done=o||null,this.scheduleAccept())},o=>{this.view.dispatch({effects:Q4.of(null)}),Aa(this.view.state,o)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),YU))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(vh);for(let r=0;r<this.running.length;r++){let i=this.running[r];if(i.done===void 0)continue;if(this.running.splice(r--,1),i.done){let s=new Jg(i.active.source,i.active.explicitPos,i.done,i.done.from,(t=i.done.to)!==null&&t!==void 0?t:sh(i.updates.length?i.updates[0].startState:this.view.state));for(let a of i.updates)s=s.update(a,n);if(s.hasResult()){e.push(s);continue}}let o=this.view.state.field(Dl).active.find(s=>s.source==i.active.source);if(o&&o.state==1)if(i.done==null){let s=new ka(i.active.source,0);for(let a of i.updates)s=s.update(a,n);s.state!=1&&e.push(s)}else this.startQuery(o)}e.length&&this.view.dispatch({effects:Vne.of(e)})}},{eventHandlers:{blur(){let t=this.view.state.field(Dl,!1);t&&t.tooltip&&this.view.state.facet(vh).closeOnBlur&&this.view.dispatch({effects:Q4.of(null)})},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:ZR.of(!1)}),20),this.composing=0}}}),ere=_t.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",listStyle:"none",margin:0,padding:0,"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer",padding:"1px 3px",lineHeight:1.2}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xB7\xB7\xB7"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"300px"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25CB'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25CC'"}},".cm-completionIcon-variable":{"&:after":{content:"'\u{1D465}'"}},".cm-completionIcon-constant":{"&:after":{content:"'\u{1D436}'"}},".cm-completionIcon-type":{"&:after":{content:"'\u{1D461}'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222A'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25A1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\u{1F511}\uFE0E'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25A2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class Dze{constructor(e,n,r,i){this.field=e,this.line=n,this.from=r,this.to=i}}class VR{constructor(e,n,r){this.field=e,this.from=n,this.to=r}map(e){let n=e.mapPos(this.from,-1,Xo.TrackDel),r=e.mapPos(this.to,1,Xo.TrackDel);return n==null||r==null?null:new VR(this.field,n,r)}}class GR{constructor(e,n){this.lines=e,this.fieldPositions=n}instantiate(e,n){let r=[],i=[n],o=e.doc.lineAt(n),s=/^\s*/.exec(o.text)[0];for(let l of this.lines){if(r.length){let c=s,u=/^\t*/.exec(l)[0].length;for(let f=0;f<u;f++)c+=e.facet(sb);i.push(n+c.length-u),l=c+l.slice(u)}r.push(l),n+=l.length+1}let a=this.fieldPositions.map(l=>new VR(l.field,i[l.line]+l.from,i[l.line]+l.to));return{text:r,ranges:a}}static parse(e){let n=[],r=[],i=[],o;for(let s of e.split(/\r\n?|\n/)){for(;o=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(s);){let a=o[1]?+o[1]:null,l=o[2]||o[3]||"",c=-1;for(let u=0;u<n.length;u++)(a!=null?n[u].seq==a:l?n[u].name==l:!1)&&(c=u);if(c<0){let u=0;for(;u<n.length&&(a==null||n[u].seq!=null&&n[u].seq<a);)u++;n.splice(u,0,{seq:a,name:l}),c=u;for(let f of i)f.field>=c&&f.field++}i.push(new Dze(c,r.length,o.index,o.index+l.length)),s=s.slice(0,o.index)+l+s.slice(o.index+o[0].length)}for(let a;a=/([$#])\\{/.exec(s);){s=s.slice(0,a.index)+a[1]+"{"+s.slice(a.index+a[0].length);for(let l of i)l.line==r.length&&l.from>a.index&&(l.from--,l.to--)}r.push(s)}return new GR(r,i)}}let Xze=Et.widget({widget:new class extends oc{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),Wze=Et.mark({class:"cm-snippetField"});class G0{constructor(e,n){this.ranges=e,this.active=n,this.deco=Et.set(e.map(r=>(r.from==r.to?Xze:Wze).range(r.from,r.to)))}map(e){let n=[];for(let r of this.ranges){let i=r.map(e);if(!i)return null;n.push(i)}return new G0(n,this.active)}selectionInsideField(e){return e.ranges.every(n=>this.ranges.some(r=>r.field==this.active&&r.from<=n.from&&r.to>=n.to))}}const cb=ln.define({map(t,e){return t&&t.map(e)}}),Uze=ln.define(),cy=hi.define({create(){return null},update(t,e){for(let n of e.effects){if(n.is(cb))return n.value;if(n.is(Uze)&&t)return new G0(t.ranges,n.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>_t.decorations.from(t,e=>e?e.deco:Et.none)});function HR(t,e){return De.create(t.filter(n=>n.field==e).map(n=>De.range(n.from,n.to)))}function qze(t){let e=GR.parse(t);return(n,r,i,o)=>{let{text:s,ranges:a}=e.instantiate(n.state,i),l={changes:{from:i,to:o,insert:Xr.of(s)},scrollIntoView:!0};if(a.length&&(l.selection=HR(a,0)),a.length>1){let c=new G0(a,0),u=l.effects=[cb.of(c)];n.state.field(cy,!1)===void 0&&u.push(ln.appendConfig.of([cy,Zze,Vze,ere]))}n.dispatch(n.state.update(l))}}function tre(t){return({state:e,dispatch:n})=>{let r=e.field(cy,!1);if(!r||t<0&&r.active==0)return!1;let i=r.active+t,o=t>0&&!r.ranges.some(s=>s.field==i+t);return n(e.update({selection:HR(r.ranges,i),effects:cb.of(o?null:new G0(r.ranges,i))})),!0}}const Bze=({state:t,dispatch:e})=>t.field(cy,!1)?(e(t.update({effects:cb.of(null)})),!0):!1,Yze=tre(1),Fze=tre(-1),jze=[{key:"Tab",run:Yze,shift:Fze},{key:"Escape",run:Bze}],FU=Wt.define({combine(t){return t.length?t[0]:jze}}),Zze=Zf.highest(Vf.compute([FU],t=>t.facet(FU)));function mc(t,e){return Object.assign(Object.assign({},e),{apply:qze(t)})}const Vze=_t.domEventHandlers({mousedown(t,e){let n=e.state.field(cy,!1),r;if(!n||(r=e.posAtCoords({x:t.clientX,y:t.clientY}))==null)return!1;let i=n.ranges.find(o=>o.from<=r&&o.to>=r);return!i||i.field==n.active?!1:(e.dispatch({selection:HR(n.ranges,i.field),effects:cb.of(n.ranges.some(o=>o.field>i.field)?new G0(n.ranges,i.field):null)}),!0)}}),$4={brackets:["(","[","{","'",'"'],before:")]}:;>"},yp=ln.define({map(t,e){let n=e.mapPos(t,-1,Xo.TrackAfter);return n==null?void 0:n}}),KR=ln.define({map(t,e){return e.mapPos(t)}}),JR=new class extends Dp{};JR.startSide=1;JR.endSide=-1;const nre=hi.define({create(){return Wr.empty},update(t,e){if(e.selection){let n=e.state.doc.lineAt(e.selection.main.head).from,r=e.startState.doc.lineAt(e.startState.selection.main.head).from;n!=e.changes.mapPos(r,-1)&&(t=Wr.empty)}t=t.map(e.changes);for(let n of e.effects)n.is(yp)?t=t.update({add:[JR.range(n.value,n.value+1)]}):n.is(KR)&&(t=t.update({filter:r=>r!=n.value}));return t}});function rre(){return[Hze,nre]}const $P="()[]{}<>";function ire(t){for(let e=0;e<$P.length;e+=2)if($P.charCodeAt(e)==t)return $P.charAt(e+1);return SR(t<128?t:t+1)}function ore(t,e){return t.languageDataAt("closeBrackets",e)[0]||$4}const Gze=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Hze=_t.inputHandler.of((t,e,n,r)=>{if((Gze?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let i=t.state.selection.main;if(r.length>2||r.length==2&&Ka(vs(r,0))==1||e!=i.from||n!=i.to)return!1;let o=Jze(t.state,r);return o?(t.dispatch(o),!0):!1}),Kze=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=ore(t,t.selection.main.head).brackets||$4.brackets,i=null,o=t.changeByRange(s=>{if(s.empty){let a=eLe(t.doc,s.head);for(let l of r)if(l==a&&W_(t.doc,s.head)==ire(vs(l,0)))return{changes:{from:s.head-l.length,to:s.head+l.length},range:De.cursor(s.head-l.length),userEvent:"delete.backward"}}return{range:i=s}});return i||e(t.update(o,{scrollIntoView:!0})),!i},sre=[{key:"Backspace",run:Kze}];function Jze(t,e){let n=ore(t,t.selection.main.head),r=n.brackets||$4.brackets;for(let i of r){let o=ire(vs(i,0));if(e==i)return o==i?rLe(t,i,r.indexOf(i+i+i)>-1):tLe(t,i,o,n.before||$4.before);if(e==o&&are(t,t.selection.main.from))return nLe(t,i,o)}return null}function are(t,e){let n=!1;return t.field(nre).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function W_(t,e){let n=t.sliceString(e,e+2);return n.slice(0,Ka(vs(n,0)))}function eLe(t,e){let n=t.sliceString(e-2,e);return Ka(vs(n,0))==n.length?n:n.slice(1)}function tLe(t,e,n,r){let i=null,o=t.changeByRange(s=>{if(!s.empty)return{changes:[{insert:e,from:s.from},{insert:n,from:s.to}],effects:yp.of(s.to+e.length),range:De.range(s.anchor+e.length,s.head+e.length)};let a=W_(t.doc,s.head);return!a||/\s/.test(a)||r.indexOf(a)>-1?{changes:{insert:e+n,from:s.head},effects:yp.of(s.head+e.length),range:De.cursor(s.head+e.length)}:{range:i=s}});return i?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function nLe(t,e,n){let r=null,i=t.selection.ranges.map(o=>o.empty&&W_(t.doc,o.head)==n?De.cursor(o.head+n.length):r=o);return r?null:t.update({selection:De.create(i,t.selection.mainIndex),scrollIntoView:!0,effects:t.selection.ranges.map(({from:o})=>KR.of(o))})}function rLe(t,e,n){let r=null,i=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:e,from:o.to}],effects:yp.of(o.to+e.length),range:De.range(o.anchor+e.length,o.head+e.length)};let s=o.head,a=W_(t.doc,s);if(a==e){if(jU(t,s))return{changes:{insert:e+e,from:s},effects:yp.of(s+e.length),range:De.cursor(s+e.length)};if(are(t,s)){let l=n&&t.sliceDoc(s,s+e.length*3)==e+e+e;return{range:De.cursor(s+e.length*(l?3:1)),effects:KR.of(s)}}}else{if(n&&t.sliceDoc(s-2*e.length,s)==e+e&&jU(t,s-2*e.length))return{changes:{insert:e+e+e+e,from:s},effects:yp.of(s+e.length),range:De.cursor(s+e.length)};if(t.charCategorizer(s)(a)!=qo.Word){let l=t.sliceDoc(s-1,s);if(l!=e&&t.charCategorizer(s)(l)!=qo.Word&&!iLe(t,s,e))return{changes:{insert:e+e,from:s},effects:yp.of(s+e.length),range:De.cursor(s+e.length)}}}return{range:r=o}});return r?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function jU(t,e){let n=di(t).resolveInner(e+1);return n.parent&&n.from==e}function iLe(t,e,n){let r=di(t).resolveInner(e,-1);for(let i=0;i<5;i++){if(t.sliceDoc(r.from,r.from+n.length)==n)return!0;let o=r.to==e&&r.parent;if(!o)break;r=o}return!1}function uy(t={}){return[Dl,vh.of(t),Mze,oLe,ere]}const eA=[{key:"Ctrl-Space",run:Jne},{key:"Escape",run:Ize},{key:"ArrowDown",run:d2(!0)},{key:"ArrowUp",run:d2(!1)},{key:"PageDown",run:d2(!0,"page")},{key:"PageUp",run:d2(!1,"page")},{key:"Enter",run:Kne}],oLe=Zf.highest(Vf.computeN([vh],t=>t.facet(vh).defaultKeymap?[eA]:[]));function Ni(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];typeof i=="string"?t.setAttribute(r,i):i!=null&&(t[r]=i)}e++}for(;e<arguments.length;e++)lre(t,arguments[e]);return t}function lre(t,e){if(typeof e=="string")t.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)t.appendChild(e);else if(Array.isArray(e))for(var n=0;n<e.length;n++)lre(t,e[n]);else throw new RangeError("Unsupported child node: "+e)}class sLe{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class dp{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let i=e,o=r.facet(O1).markerFilter;o&&(i=o(i));let s=Et.set(i.map(a=>a.from==a.to||a.from==a.to-1&&r.doc.lineAt(a.from).to==a.from?Et.widget({widget:new pLe(a),diagnostic:a}).range(a.from):Et.mark({attributes:{class:"cm-lintRange cm-lintRange-"+a.severity},diagnostic:a}).range(a.from,a.to)),!0);return new dp(s,n,h0(s))}}function h0(t,e=null,n=0){let r=null;return t.between(n,1e9,(i,o,{spec:s})=>{if(!(e&&s.diagnostic!=e))return r=new sLe(i,o,s.diagnostic),!1}),r}function aLe(t,e){return!!(t.effects.some(n=>n.is(tA))||t.changes.touchesRange(e.pos))}function cre(t,e){return t.field(il,!1)?e:e.concat(ln.appendConfig.of([il,_t.decorations.compute([il],n=>{let{selected:r,panel:i}=n.field(il);return!r||!i||r.from==r.to?Et.none:Et.set([lLe.range(r.from,r.to)])}),ane(cLe,{hideOn:aLe}),mLe]))}function ure(t,e){return{effects:cre(t,[tA.of(e)])}}const tA=ln.define(),nA=ln.define(),fre=ln.define(),il=hi.define({create(){return new dp(Et.none,null,null)},update(t,e){if(e.docChanged){let n=t.diagnostics.map(e.changes),r=null;if(t.selected){let i=e.changes.mapPos(t.selected.from,1);r=h0(n,t.selected.diagnostic,i)||h0(n,null,i)}t=new dp(n,t.panel,r)}for(let n of e.effects)n.is(tA)?t=dp.init(n.value,t.panel,e.state):n.is(nA)?t=new dp(t.diagnostics,n.value?U_.open:null,t.selected):n.is(fre)&&(t=new dp(t.diagnostics,t.panel,n.value));return t},provide:t=>[mh.from(t,e=>e.panel),_t.decorations.from(t,e=>e.diagnostics)]}),lLe=Et.mark({class:"cm-lintRange cm-lintRange-active"});function cLe(t,e,n){let{diagnostics:r}=t.state.field(il),i=[],o=2e8,s=0;r.between(e-(n<0?1:0),e+(n>0?1:0),(l,c,{spec:u})=>{e>=l&&e<=c&&(l==c||(e>l||n>0)&&(e<c||n<0))&&(i.push(u.diagnostic),o=Math.min(l,o),s=Math.max(c,s))});let a=t.state.facet(O1).tooltipFilter;return a&&(i=a(i)),i.length?{pos:o,end:s,above:t.state.doc.lineAt(o).to<s,create(){return{dom:uLe(t,i)}}}:null}function uLe(t,e){return Ni("ul",{class:"cm-tooltip-lint"},e.map(n=>pre(t,n,!1)))}const fLe=t=>{let e=t.state.field(il,!1);(!e||!e.panel)&&t.dispatch({effects:cre(t.state,[nA.of(!0)])});let n=iy(t,U_.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},ZU=t=>{let e=t.state.field(il,!1);return!e||!e.panel?!1:(t.dispatch({effects:nA.of(!1)}),!0)},dLe=t=>{let e=t.state.field(il,!1);if(!e)return!1;let n=t.state.selection.main,r=e.diagnostics.iter(n.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==n.from&&r.to==n.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},dre=[{key:"Mod-Shift-m",run:fLe},{key:"F8",run:dLe}],hLe=Ur.fromClass(class{constructor(t){this.view=t,this.timeout=-1,this.set=!0;let{delay:e}=t.state.facet(O1);this.lintTime=Date.now()+e,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,e)}run(){let t=Date.now();if(t<this.lintTime-10)setTimeout(this.run,this.lintTime-t);else{this.set=!1;let{state:e}=this.view,{sources:n}=e.facet(O1);Promise.all(n.map(r=>Promise.resolve(r(this.view)))).then(r=>{let i=r.reduce((o,s)=>o.concat(s));this.view.state.doc==e.doc&&this.view.dispatch(ure(this.view.state,i))},r=>{Aa(this.view.state,r)})}}update(t){let e=t.state.facet(O1);(t.docChanged||e!=t.startState.facet(O1))&&(this.lintTime=Date.now()+e.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,e.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}}),O1=Wt.define({combine(t){return Object.assign({sources:t.map(e=>e.source)},fa(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null}))},enables:hLe});function hre(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;r<n.length;r++){let i=n[r];if(/[a-zA-Z]/.test(i)&&!e.some(o=>o.toLowerCase()==i.toLowerCase())){e.push(i);continue e}}e.push("")}return e}function pre(t,e,n){var r;let i=n?hre(e.actions):[];return Ni("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Ni("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage():e.message),(r=e.actions)===null||r===void 0?void 0:r.map((o,s)=>{let a=f=>{f.preventDefault();let h=h0(t.state.field(il).diagnostics,e);h&&o.apply(t,h.from,h.to)},{name:l}=o,c=i[s]?l.indexOf(i[s]):-1,u=c<0?l:[l.slice(0,c),Ni("u",l.slice(c,c+1)),l.slice(c+1)];return Ni("button",{type:"button",class:"cm-diagnosticAction",onclick:a,onmousedown:a,"aria-label":` Action: ${l}${c<0?"":` (access key "${i[s]})"`}.`},u)}),e.source&&Ni("div",{class:"cm-diagnosticSource"},e.source))}class pLe extends oc{constructor(e){super(),this.diagnostic=e}eq(e){return e.diagnostic==this.diagnostic}toDOM(){return Ni("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}class VU{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=pre(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class U_{constructor(e){this.view=e,this.items=[];let n=i=>{if(i.keyCode==27)ZU(this.view),this.view.focus();else if(i.keyCode==38||i.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(i.keyCode==40||i.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(i.keyCode==36)this.moveSelection(0);else if(i.keyCode==35)this.moveSelection(this.items.length-1);else if(i.keyCode==13)this.view.focus();else if(i.keyCode>=65&&i.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:o}=this.items[this.selectedIndex],s=hre(o.actions);for(let a=0;a<s.length;a++)if(s[a].toUpperCase().charCodeAt(0)==i.keyCode){let l=h0(this.view.state.field(il).diagnostics,o);l&&o.actions[a].apply(e,l.from,l.to)}}else return;i.preventDefault()},r=i=>{for(let o=0;o<this.items.length;o++)this.items[o].dom.contains(i.target)&&this.moveSelection(o)};this.list=Ni("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:r}),this.dom=Ni("div",{class:"cm-panel-lint"},this.list,Ni("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>ZU(this.view)},"\xD7")),this.update()}get selectedIndex(){let e=this.view.state.field(il).selected;if(!e)return-1;for(let n=0;n<this.items.length;n++)if(this.items[n].diagnostic==e.diagnostic)return n;return-1}update(){let{diagnostics:e,selected:n}=this.view.state.field(il),r=0,i=!1,o=null;for(e.between(0,this.view.state.doc.length,(s,a,{spec:l})=>{let c=-1,u;for(let f=r;f<this.items.length;f++)if(this.items[f].diagnostic==l.diagnostic){c=f;break}c<0?(u=new VU(this.view,l.diagnostic),this.items.splice(r,0,u),i=!0):(u=this.items[c],c>r&&(this.items.splice(r,c-r),i=!0)),n&&u.diagnostic==n.diagnostic?u.dom.hasAttribute("aria-selected")||(u.dom.setAttribute("aria-selected","true"),o=u):u.dom.hasAttribute("aria-selected")&&u.dom.removeAttribute("aria-selected"),r++});r<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)i=!0,this.items.pop();this.items.length==0&&(this.items.push(new VU(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),i=!0),o?(this.list.setAttribute("aria-activedescendant",o.id),this.view.requestMeasure({key:this,read:()=>({sel:o.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:s,panel:a})=>{s.top<a.top?this.list.scrollTop-=a.top-s.top:s.bottom>a.bottom&&(this.list.scrollTop+=s.bottom-a.bottom)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(il),r=h0(n.diagnostics,this.items[e].diagnostic);!r||this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:fre.of(r)})}static open(e){return new U_(e)}}function OLe(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`}function EP(t){return OLe(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const mLe=_t.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:EP("#d11")},".cm-lintRange-warning":{backgroundImage:EP("orange")},".cm-lintRange-info":{backgroundImage:EP("#999")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});var Tf={},tO={},rA={},Nu={};Object.defineProperty(Nu,"__esModule",{value:!0});let j8;function Z8(){if(j8===void 0)throw new Error("No runtime abstraction layer installed");return j8}(function(t){function e(n){if(n===void 0)throw new Error("No runtime abstraction layer provided");j8=n}t.install=e})(Z8||(Z8={}));Nu.default=Z8;var iA={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Disposable=void 0,function(e){function n(r){return{dispose:r}}e.create=n}(t.Disposable||(t.Disposable={}))})(iA);var nO={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Emitter=t.Event=void 0;const e=Nu;(function(i){const o={dispose(){}};i.None=function(){return o}})(t.Event||(t.Event={}));class n{add(o,s=null,a){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(o),this._contexts.push(s),Array.isArray(a)&&a.push({dispose:()=>this.remove(o,s)})}remove(o,s=null){if(!this._callbacks)return;let a=!1;for(let l=0,c=this._callbacks.length;l<c;l++)if(this._callbacks[l]===o)if(this._contexts[l]===s){this._callbacks.splice(l,1),this._contexts.splice(l,1);return}else a=!0;if(a)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...o){if(!this._callbacks)return[];const s=[],a=this._callbacks.slice(0),l=this._contexts.slice(0);for(let c=0,u=a.length;c<u;c++)try{s.push(a[c].apply(l[c],o))}catch(f){(0,e.default)().console.error(f)}return s}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}}class r{constructor(o){this._options=o}get event(){return this._event||(this._event=(o,s,a)=>{this._callbacks||(this._callbacks=new n),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(o,s);const l={dispose:()=>{!this._callbacks||(this._callbacks.remove(o,s),l.dispose=r._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(a)&&a.push(l),l}),this._event}fire(o){this._callbacks&&this._callbacks.invoke.call(this._callbacks,o)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}}t.Emitter=r,r._noop=function(){}})(nO);var q_={};Object.defineProperty(q_,"__esModule",{value:!0});q_.AbstractMessageBuffer=void 0;const gLe=13,vLe=10,yLe=`\r
|
|
1145
|
+
`);r>-1&&(n=n.slice(0,r))}return e+n.length<=this.to?n:n.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,n=this.lineAfter(e),r=e+n.length;for(let i=this.rangeIndex;;){let o=this.ranges[i].to;if(o>=r||(n=n.slice(0,o-(r-n.length)),i++,i==this.ranges.length))break;let s=this.ranges[i].from,a=this.lineAfter(s);n+=a,r=s+a.length}return{line:n,end:r}}skipGapsTo(e,n,r){for(;;){let i=this.ranges[this.rangeIndex].to,o=e+n;if(r>0?i>o:i>=o)break;n+=this.ranges[++this.rangeIndex].from-i}return n}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,n,r,i,o){if(this.ranges.length>1){o=this.skipGapsTo(n,o,1),n+=o;let s=this.chunk.length;o=this.skipGapsTo(r,o,-1),r+=o,i+=this.chunk.length-s}return this.chunk.push(e,n,r,i),o}parseLine(e){let{line:n,end:r}=this.nextLine(),i=0,{streamParser:o}=this.lang,s=new Dne(n,e?e.state.tabSize:4,e?qp(e.state):2);if(s.eol())o.blankLine(this.state,s.indentUnit);else for(;!s.eol();){let a=Wne(o.token,s,this.state);if(a&&(i=this.emitToken(this.lang.tokenTable.resolve(a),this.parsedPos+s.start,this.parsedPos+s.pos,4,i)),s.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=Vn.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:gze,topID:0,maxBufferLength:2048,reused:this.chunkReused});e=new Vn(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new Vn(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}function Wne(t,e,n){e.start=e.pos;for(let r=0;r<10;r++){let i=t(e,n);if(e.pos>e.start)return i}throw new Error("Stream parser failed to advance stream.")}const FR=Object.create(null),ay=[Ji.none],gze=new V0(ay),MU=[],Une=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])Une[t]=Bne(FR,e);class qne{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),Une)}resolve(e){return e?this.table[e]||(this.table[e]=Bne(this.extra,e)):0}}const vze=new qne(FR);function QP(t,e){MU.indexOf(t)>-1||(MU.push(t),console.warn(e))}function Bne(t,e){let n=null;for(let o of e.split(".")){let s=t[o]||B[o];s?typeof s=="function"?n?n=s(n):QP(o,`Modifier ${o} used at start of tag`):n?QP(o,`Tag ${o} used as modifier`):n=s:QP(o,`Unknown highlighting tag ${o}`)}if(!n)return 0;let r=e.replace(/ /g,"_"),i=Ji.define({id:ay.length,name:r,props:[da({[r]:n})]});return ay.push(i),i.id}function yze(t){let e=Ji.define({id:ay.length,name:"Document",props:[Wp.add(()=>t)]});return ay.push(e),e}class Yne{constructor(e,n,r){this.state=e,this.pos=n,this.explicit=r,this.abortListeners=[]}tokenBefore(e){let n=di(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),i=n.text.slice(r-n.from,this.pos-n.from),o=i.search(jne(e,!1));return o<0?null:{from:r+o,to:this.pos,text:i.slice(o)}}get aborted(){return this.abortListeners==null}addEventListener(e,n){e=="abort"&&this.abortListeners&&this.abortListeners.push(n)}}function DU(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function bze(t){let e=Object.create(null),n=Object.create(null);for(let{label:i}of t){e[i[0]]=!0;for(let o=1;o<i.length;o++)n[i[o]]=!0}let r=DU(e)+DU(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function jR(t){let e=t.map(i=>typeof i=="string"?{label:i}:i),[n,r]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:bze(e);return i=>{let o=i.matchBefore(r);return o||i.explicit?{from:o?o.from:i.pos,options:e,validFor:n}:null}}function Fne(t,e){return n=>{for(let r=di(n.state).resolveInner(n.pos,-1);r;r=r.parent)if(t.indexOf(r.name)>-1)return null;return e(n)}}class XU{constructor(e,n,r){this.completion=e,this.source=n,this.match=r}}function sh(t){return t.selection.main.head}function jne(t,e){var n;let{source:r}=t,i=e&&r[0]!="^",o=r[r.length-1]!="$";return!i&&!o?t:new RegExp(`${i?"^":""}(?:${r})${o?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}function ly(t,e,n,r){return Object.assign(Object.assign({},t.changeByRange(i=>{if(i==t.selection.main)return{changes:{from:n,to:r,insert:e},range:De.cursor(n+e.length)};let o=r-n;return!i.empty||o&&t.sliceDoc(i.from-o,i.from)!=t.sliceDoc(n,r)?{range:i}:{changes:{from:i.from-o,to:i.from,insert:e},range:De.cursor(i.from-o+e.length)}})),{userEvent:"input.complete"})}function Zne(t,e){const n=e.completion.apply||e.completion.label;let r=e.source;typeof n=="string"?t.dispatch(ly(t.state,n,r.from,r.to)):n(t,e.completion,r.from,r.to)}const WU=new WeakMap;function xze(t){if(!Array.isArray(t))return t;let e=WU.get(t);return e||WU.set(t,e=jR(t)),e}class Sze{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[];for(let n=0;n<e.length;){let r=vs(e,n),i=Ka(r);this.chars.push(r);let o=e.slice(n,n+i),s=o.toUpperCase();this.folded.push(vs(s==o?o.toLowerCase():s,0)),n+=i}this.astral=e.length!=this.chars.length}match(e){if(this.pattern.length==0)return[0];if(e.length<this.pattern.length)return null;let{chars:n,folded:r,any:i,precise:o,byWord:s}=this;if(n.length==1){let g=vs(e,0);return g==n[0]?[0,0,Ka(g)]:g==r[0]?[-200,0,Ka(g)]:null}let a=e.indexOf(this.pattern);if(a==0)return[0,0,this.pattern.length];let l=n.length,c=0;if(a<0){for(let g=0,y=Math.min(e.length,200);g<y&&c<l;){let S=vs(e,g);(S==n[c]||S==r[c])&&(i[c++]=g),g+=Ka(S)}if(c<l)return null}let u=0,f=0,h=!1,d=0,O=-1,b=-1,v=/[a-z]/.test(e),p=!0;for(let g=0,y=Math.min(e.length,200),S=0;g<y&&f<l;){let w=vs(e,g);a<0&&(u<l&&w==n[u]&&(o[u++]=g),d<l&&(w==n[d]||w==r[d]?(d==0&&(O=g),b=g+1,d++):d=0));let T,k=w<255?w>=48&&w<=57||w>=97&&w<=122?2:w>=65&&w<=90?1:0:(T=SR(w))!=T.toLowerCase()?1:T!=T.toUpperCase()?2:0;(!g||k==1&&v||S==0&&k!=0)&&(n[f]==w||r[f]==w&&(h=!0)?s[f++]=g:s.length&&(p=!1)),S=k,g+=Ka(w)}return f==l&&s[0]==0&&p?this.result(-100+(h?-200:0),s,e):d==l&&O==0?[-200-e.length,0,b]:a>-1?[-700-e.length,a,a+this.pattern.length]:d==l?[-200+-700-e.length,O,b]:f==l?this.result(-100+(h?-200:0)+-700+(p?0:-1100),s,e):n.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,n,r){let i=[e-r.length],o=1;for(let s of n){let a=s+(this.astral?Ka(vs(r,s)):1);o>1&&i[o-1]==s?i[o-1]=a:(i[o++]=s,i[o++]=a)}return i}}const vh=Wt.define({combine(t){return fa(t,{activateOnTyping:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[]},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,optionClass:(e,n)=>r=>wze(e(r),n(r)),addToOptions:(e,n)=>e.concat(n)})}});function wze(t,e){return t?e?t+" "+e:t:e}function _ze(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,i){let o=document.createElement("span");o.className="cm-completionLabel";let{label:s}=n,a=0;for(let l=1;l<i.length;){let c=i[l++],u=i[l++];c>a&&o.appendChild(document.createTextNode(s.slice(a,c)));let f=o.appendChild(document.createElement("span"));f.appendChild(document.createTextNode(s.slice(c,u))),f.className="cm-completionMatchedText",a=u}return a<s.length&&o.appendChild(document.createTextNode(s.slice(a))),o},position:50},{render(n){if(!n.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=n.detail,r},position:80}),e.sort((n,r)=>n.position-r.position).map(n=>n.render)}function UU(t,e,n){if(t<=n)return{from:0,to:t};if(e<=t>>1){let i=Math.floor(e/n);return{from:i*n,to:(i+1)*n}}let r=Math.floor((t-e)/n);return{from:t-(r+1)*n,to:t-r*n}}class Tze{constructor(e,n){this.view=e,this.stateField=n,this.info=null,this.placeInfo={read:()=>this.measureInfo(),write:a=>this.positionInfo(a),key:this};let r=e.state.field(n),{options:i,selected:o}=r.open,s=e.state.facet(vh);this.optionContent=_ze(s),this.optionClass=s.optionClass,this.range=UU(i.length,o,s.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.dom.addEventListener("mousedown",a=>{console.log("optionsoptions",i);for(let l=a.target,c;l&&l!=this.dom;l=l.parentNode)if(l.nodeName=="LI"&&(c=/-(\d+)$/.exec(l.id))&&+c[1]<i.length){Zne(e,i[+c[1]]),a.preventDefault();return}}),this.list=this.dom.appendChild(this.createListBox(i,r.id,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfo)})}mount(){this.updateSel()}update(e){e.state.field(this.stateField)!=e.startState.field(this.stateField)&&this.updateSel()}positioned(){this.info&&this.view.requestMeasure(this.placeInfo)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;if((n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=UU(n.options.length,n.selected,this.view.state.facet(vh).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(n.options,e.id,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfo)})),this.updateSelectedOption(n.selected)){this.info&&(this.info.remove(),this.info=null);let{completion:r}=n.options[n.selected],{info:i}=r;if(!i)return;let o=typeof i=="string"?document.createTextNode(i):i(r);if(!o)return;"then"in o?o.then(s=>{s&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(s)}).catch(s=>Aa(this.view.state,s,"completion info")):this.addInfoPane(o)}}addInfoPane(e){let n=this.info=document.createElement("div");n.className="cm-tooltip cm-completionInfo",n.appendChild(e),this.dom.appendChild(n),this.view.requestMeasure(this.placeInfo)}updateSelectedOption(e){let n=null;for(let r=this.list.firstChild,i=this.range.from;r;r=r.nextSibling,i++)i==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&r.removeAttribute("aria-selected");return n&&Pze(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),i=e.getBoundingClientRect();if(i.top>Math.min(innerHeight,n.bottom)-10||i.bottom<Math.max(0,n.top)+10)return null;let o=Math.max(0,Math.min(i.top,innerHeight-r.height))-n.top,s=this.view.textDirection==Ai.RTL,a=n.left,l=innerWidth-n.right;return s&&a<Math.min(r.width,l)?s=!1:!s&&l<Math.min(r.width,a)&&(s=!0),{top:o,left:s}}positionInfo(e){this.info&&(this.info.style.top=(e?e.top:-1e6)+"px",e&&(this.info.classList.toggle("cm-completionInfo-left",e.left),this.info.classList.toggle("cm-completionInfo-right",!e.left)))}createListBox(e,n,r){const i=document.createElement("ul");i.id=n,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions"));for(let o=r.from;o<r.to;o++){let{completion:s,match:a}=e[o];const l=i.appendChild(document.createElement("li"));l.id=n+"-"+o,l.setAttribute("role","option");let c=this.optionClass(s);c&&(l.className=c);for(let u of this.optionContent){let f=u(s,this.view.state,a);f&&l.appendChild(f)}}return r.from&&i.classList.add("cm-completionListIncompleteTop"),r.to<e.length&&i.classList.add("cm-completionListIncompleteBottom"),i}}function kze(t){return e=>new Tze(e,t)}function Pze(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();r.top<n.top?t.scrollTop-=n.top-r.top:r.bottom>n.bottom&&(t.scrollTop+=r.bottom-n.bottom)}function qU(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function Qze(t,e){let n=[],r=0;for(let s of t)if(s.hasResult())if(s.result.filter===!1){let a=s.result.getMatch;for(let l of s.result.options){let c=[1e9-r++];if(a)for(let u of a(l))c.push(u);n.push(new XU(l,s,c))}}else{let a=new Sze(e.sliceDoc(s.from,s.to)),l;for(let c of s.result.options)(l=a.match(c.label))&&(c.boost!=null&&(l[0]+=c.boost),n.push(new XU(c,s,l)))}let i=[],o=null;for(let s of n.sort(Rze))!o||o.label!=s.completion.label||o.detail!=s.completion.detail||o.type!=null&&s.completion.type!=null&&o.type!=s.completion.type||o.apply!=s.completion.apply?i.push(s):qU(s.completion)>qU(o)&&(i[i.length-1]=s),o=s.completion;return i}class Kg{constructor(e,n,r,i,o){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=i,this.selected=o}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new Kg(this.options,BU(n,e),this.tooltip,this.timestamp,e)}static build(e,n,r,i,o){let s=Qze(e,n);if(!s.length)return null;let a=0;if(i&&i.selected){let l=i.options[i.selected].completion;for(let c=0;c<s.length;c++)if(s[c].completion==l){a=c;break}}return new Kg(s,BU(r,a),{pos:e.reduce((l,c)=>c.hasResult()?Math.min(l,c.from):l,1e8),create:kze(Dl),above:o.aboveCursor},i?i.timestamp:Date.now(),a)}map(e){return new Kg(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected)}}class P4{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new P4(Cze,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(vh),o=(r.override||n.languageDataAt("autocomplete",sh(n)).map(xze)).map(a=>(this.active.find(c=>c.source==a)||new ka(a,this.active.some(c=>c.state!=0)?1:0)).update(e,r));o.length==this.active.length&&o.every((a,l)=>a==this.active[l])&&(o=this.active);let s=e.selection||o.some(a=>a.hasResult()&&e.changes.touchesRange(a.from,a.to))||!$ze(o,this.active)?Kg.build(o,n,this.id,this.open,r):this.open&&e.docChanged?this.open.map(e.changes):this.open;!s&&o.every(a=>a.state!=1)&&o.some(a=>a.hasResult())&&(o=o.map(a=>a.hasResult()?new ka(a.source,0):a));for(let a of e.effects)a.is(Gne)&&(s=s&&s.setSelected(a.value,this.id));return o==this.active&&s==this.open?this:new P4(o,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:Eze}}function $ze(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n<t.length&&!t[n].hasResult;)n++;for(;r<e.length&&!e[r].hasResult;)r++;let i=n==t.length,o=r==e.length;if(i||o)return i==o;if(t[n++].result!=e[r++].result)return!1}}const Eze={"aria-autocomplete":"list"};function BU(t,e){return{"aria-autocomplete":"list","aria-haspopup":"listbox","aria-activedescendant":t+"-"+e,"aria-controls":t}}const Cze=[];function Rze(t,e){let n=e.match[0]-t.match[0];return n||t.completion.label.localeCompare(e.completion.label)}function F8(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}class ka{constructor(e,n,r=-1){this.source=e,this.state=n,this.explicitPos=r}hasResult(){return!1}update(e,n){let r=F8(e),i=this;r?i=i.handleUserEvent(e,r,n):e.docChanged?i=i.handleChange(e):e.selection&&i.state!=0&&(i=new ka(i.source,0));for(let o of e.effects)if(o.is(ZR))i=new ka(i.source,1,o.value?sh(e.state):-1);else if(o.is(Q4))i=new ka(i.source,0);else if(o.is(Vne))for(let s of o.value)s.source==i.source&&(i=s);return i}handleUserEvent(e,n,r){return n=="delete"||!r.activateOnTyping?this.map(e.changes):new ka(this.source,1)}handleChange(e){return e.changes.touchesRange(sh(e.startState))?new ka(this.source,0):this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new ka(this.source,this.state,e.mapPos(this.explicitPos))}}class Jg extends ka{constructor(e,n,r,i,o){super(e,2,n),this.result=r,this.from=i,this.to=o}hasResult(){return!0}handleUserEvent(e,n,r){var i;let o=e.changes.mapPos(this.from),s=e.changes.mapPos(this.to,1),a=sh(e.state);if((this.explicitPos<0?a<=o:a<this.from)||a>s||n=="delete"&&sh(e.startState)==this.from)return new ka(this.source,n=="input"&&r.activateOnTyping?1:0);let l=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos),c;return Aze(this.result.validFor,e.state,o,s)?new Jg(this.source,l,this.result,o,s):this.result.update&&(c=this.result.update(this.result,o,s,new Yne(e.state,a,l>=0)))?new Jg(this.source,l,c,c.from,(i=c.to)!==null&&i!==void 0?i:sh(e.state)):new ka(this.source,1,l)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new ka(this.source,0):this.map(e.changes)}map(e){return e.empty?this:new Jg(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1))}}function Aze(t,e,n,r){if(!t)return!1;let i=e.sliceDoc(n,r);return typeof t=="function"?t(i,n,r,e):jne(t,!0).test(i)}const ZR=ln.define(),Q4=ln.define(),Vne=ln.define({map(t,e){return t.map(n=>n.map(e))}}),Gne=ln.define(),Dl=hi.define({create(){return P4.start()},update(t,e){return t.update(e)},provide:t=>[N_.from(t,e=>e.tooltip),_t.contentAttributes.from(t,e=>e.attrs)]}),Hne=75;function d2(t,e="option"){return n=>{let r=n.state.field(Dl,!1);if(!r||!r.open||Date.now()-r.open.timestamp<Hne)return!1;let i=1,o;e=="page"&&(o=cIe(n,r.open.tooltip))&&(i=Math.max(2,Math.floor(o.dom.offsetHeight/o.dom.querySelector("li").offsetHeight)-1));let s=r.open.selected+i*(t?1:-1),{length:a}=r.open.options;return s<0?s=e=="page"?0:a-1:s>=a&&(s=e=="page"?a-1:0),n.dispatch({effects:Gne.of(s)}),!0}}const Kne=t=>{let e=t.state.field(Dl,!1);return t.state.readOnly||!e||!e.open||Date.now()-e.open.timestamp<Hne?!1:(Zne(t,e.open.options[e.open.selected]),!0)},Jne=t=>t.state.field(Dl,!1)?(t.dispatch({effects:ZR.of(!0)}),!0):!1,Ize=t=>{let e=t.state.field(Dl,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:Q4.of(null)}),!0)};class zze{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const YU=50,Lze=50,Nze=1e3,Mze=Ur.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.composing=0;for(let e of t.state.field(Dl).active)e.state==1&&this.startQuery(e)}update(t){let e=t.state.field(Dl);if(!t.selectionSet&&!t.docChanged&&t.startState.field(Dl)==e)return;let n=t.transactions.some(r=>(r.selection||r.docChanged)&&!F8(r));for(let r=0;r<this.running.length;r++){let i=this.running[r];if(n||i.updates.length+t.transactions.length>Lze&&Date.now()-i.time>Nze){for(let o of i.context.abortListeners)try{o()}catch(s){Aa(this.view.state,s)}i.context.abortListeners=null,this.running.splice(r--,1)}else i.updates.push(...t.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some(r=>r.state==1&&!this.running.some(i=>i.active.source==r.source))?setTimeout(()=>this.startUpdate(),YU):-1,this.composing!=0)for(let r of t.transactions)F8(r)=="input"?this.composing=2:this.composing==2&&r.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:t}=this.view,e=t.field(Dl);for(let n of e.active)n.state==1&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n)}startQuery(t){let{state:e}=this.view,n=sh(e),r=new Yne(e,n,t.explicitPos==n),i=new zze(t,r);this.running.push(i),Promise.resolve(t.source(r)).then(o=>{i.context.aborted||(i.done=o||null,this.scheduleAccept())},o=>{this.view.dispatch({effects:Q4.of(null)}),Aa(this.view.state,o)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),YU))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(vh);for(let r=0;r<this.running.length;r++){let i=this.running[r];if(i.done===void 0)continue;if(this.running.splice(r--,1),i.done){let s=new Jg(i.active.source,i.active.explicitPos,i.done,i.done.from,(t=i.done.to)!==null&&t!==void 0?t:sh(i.updates.length?i.updates[0].startState:this.view.state));for(let a of i.updates)s=s.update(a,n);if(s.hasResult()){e.push(s);continue}}let o=this.view.state.field(Dl).active.find(s=>s.source==i.active.source);if(o&&o.state==1)if(i.done==null){let s=new ka(i.active.source,0);for(let a of i.updates)s=s.update(a,n);s.state!=1&&e.push(s)}else this.startQuery(o)}e.length&&this.view.dispatch({effects:Vne.of(e)})}},{eventHandlers:{blur(){let t=this.view.state.field(Dl,!1);t&&t.tooltip&&this.view.state.facet(vh).closeOnBlur&&this.view.dispatch({effects:Q4.of(null)})},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:ZR.of(!1)}),20),this.composing=0}}}),ere=_t.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",listStyle:"none",margin:0,padding:0,"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer",padding:"1px 3px",lineHeight:1.2}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xB7\xB7\xB7"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"300px"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25CB'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25CC'"}},".cm-completionIcon-variable":{"&:after":{content:"'\u{1D465}'"}},".cm-completionIcon-constant":{"&:after":{content:"'\u{1D436}'"}},".cm-completionIcon-type":{"&:after":{content:"'\u{1D461}'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222A'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25A1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\u{1F511}\uFE0E'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25A2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class Dze{constructor(e,n,r,i){this.field=e,this.line=n,this.from=r,this.to=i}}class VR{constructor(e,n,r){this.field=e,this.from=n,this.to=r}map(e){let n=e.mapPos(this.from,-1,Xo.TrackDel),r=e.mapPos(this.to,1,Xo.TrackDel);return n==null||r==null?null:new VR(this.field,n,r)}}class GR{constructor(e,n){this.lines=e,this.fieldPositions=n}instantiate(e,n){let r=[],i=[n],o=e.doc.lineAt(n),s=/^\s*/.exec(o.text)[0];for(let l of this.lines){if(r.length){let c=s,u=/^\t*/.exec(l)[0].length;for(let f=0;f<u;f++)c+=e.facet(sb);i.push(n+c.length-u),l=c+l.slice(u)}r.push(l),n+=l.length+1}let a=this.fieldPositions.map(l=>new VR(l.field,i[l.line]+l.from,i[l.line]+l.to));return{text:r,ranges:a}}static parse(e){let n=[],r=[],i=[],o;for(let s of e.split(/\r\n?|\n/)){for(;o=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(s);){let a=o[1]?+o[1]:null,l=o[2]||o[3]||"",c=-1;for(let u=0;u<n.length;u++)(a!=null?n[u].seq==a:l?n[u].name==l:!1)&&(c=u);if(c<0){let u=0;for(;u<n.length&&(a==null||n[u].seq!=null&&n[u].seq<a);)u++;n.splice(u,0,{seq:a,name:l}),c=u;for(let f of i)f.field>=c&&f.field++}i.push(new Dze(c,r.length,o.index,o.index+l.length)),s=s.slice(0,o.index)+l+s.slice(o.index+o[0].length)}for(let a;a=/([$#])\\{/.exec(s);){s=s.slice(0,a.index)+a[1]+"{"+s.slice(a.index+a[0].length);for(let l of i)l.line==r.length&&l.from>a.index&&(l.from--,l.to--)}r.push(s)}return new GR(r,i)}}let Xze=Et.widget({widget:new class extends oc{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),Wze=Et.mark({class:"cm-snippetField"});class G0{constructor(e,n){this.ranges=e,this.active=n,this.deco=Et.set(e.map(r=>(r.from==r.to?Xze:Wze).range(r.from,r.to)))}map(e){let n=[];for(let r of this.ranges){let i=r.map(e);if(!i)return null;n.push(i)}return new G0(n,this.active)}selectionInsideField(e){return e.ranges.every(n=>this.ranges.some(r=>r.field==this.active&&r.from<=n.from&&r.to>=n.to))}}const cb=ln.define({map(t,e){return t&&t.map(e)}}),Uze=ln.define(),cy=hi.define({create(){return null},update(t,e){for(let n of e.effects){if(n.is(cb))return n.value;if(n.is(Uze)&&t)return new G0(t.ranges,n.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>_t.decorations.from(t,e=>e?e.deco:Et.none)});function HR(t,e){return De.create(t.filter(n=>n.field==e).map(n=>De.range(n.from,n.to)))}function qze(t){let e=GR.parse(t);return(n,r,i,o)=>{let{text:s,ranges:a}=e.instantiate(n.state,i),l={changes:{from:i,to:o,insert:Xr.of(s)},scrollIntoView:!0};if(a.length&&(l.selection=HR(a,0)),a.length>1){let c=new G0(a,0),u=l.effects=[cb.of(c)];n.state.field(cy,!1)===void 0&&u.push(ln.appendConfig.of([cy,Zze,Vze,ere]))}n.dispatch(n.state.update(l))}}function tre(t){return({state:e,dispatch:n})=>{let r=e.field(cy,!1);if(!r||t<0&&r.active==0)return!1;let i=r.active+t,o=t>0&&!r.ranges.some(s=>s.field==i+t);return n(e.update({selection:HR(r.ranges,i),effects:cb.of(o?null:new G0(r.ranges,i))})),!0}}const Bze=({state:t,dispatch:e})=>t.field(cy,!1)?(e(t.update({effects:cb.of(null)})),!0):!1,Yze=tre(1),Fze=tre(-1),jze=[{key:"Tab",run:Yze,shift:Fze},{key:"Escape",run:Bze}],FU=Wt.define({combine(t){return t.length?t[0]:jze}}),Zze=Zf.highest(Vf.compute([FU],t=>t.facet(FU)));function mc(t,e){return Object.assign(Object.assign({},e),{apply:qze(t)})}const Vze=_t.domEventHandlers({mousedown(t,e){let n=e.state.field(cy,!1),r;if(!n||(r=e.posAtCoords({x:t.clientX,y:t.clientY}))==null)return!1;let i=n.ranges.find(o=>o.from<=r&&o.to>=r);return!i||i.field==n.active?!1:(e.dispatch({selection:HR(n.ranges,i.field),effects:cb.of(n.ranges.some(o=>o.field>i.field)?new G0(n.ranges,i.field):null)}),!0)}}),$4={brackets:["(","[","{","'",'"'],before:")]}:;>"},yp=ln.define({map(t,e){let n=e.mapPos(t,-1,Xo.TrackAfter);return n==null?void 0:n}}),KR=ln.define({map(t,e){return e.mapPos(t)}}),JR=new class extends Dp{};JR.startSide=1;JR.endSide=-1;const nre=hi.define({create(){return Wr.empty},update(t,e){if(e.selection){let n=e.state.doc.lineAt(e.selection.main.head).from,r=e.startState.doc.lineAt(e.startState.selection.main.head).from;n!=e.changes.mapPos(r,-1)&&(t=Wr.empty)}t=t.map(e.changes);for(let n of e.effects)n.is(yp)?t=t.update({add:[JR.range(n.value,n.value+1)]}):n.is(KR)&&(t=t.update({filter:r=>r!=n.value}));return t}});function rre(){return[Hze,nre]}const $P="()[]{}<>";function ire(t){for(let e=0;e<$P.length;e+=2)if($P.charCodeAt(e)==t)return $P.charAt(e+1);return SR(t<128?t:t+1)}function ore(t,e){return t.languageDataAt("closeBrackets",e)[0]||$4}const Gze=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Hze=_t.inputHandler.of((t,e,n,r)=>{if((Gze?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let i=t.state.selection.main;if(r.length>2||r.length==2&&Ka(vs(r,0))==1||e!=i.from||n!=i.to)return!1;let o=Jze(t.state,r);return o?(t.dispatch(o),!0):!1}),Kze=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=ore(t,t.selection.main.head).brackets||$4.brackets,i=null,o=t.changeByRange(s=>{if(s.empty){let a=eLe(t.doc,s.head);for(let l of r)if(l==a&&W_(t.doc,s.head)==ire(vs(l,0)))return{changes:{from:s.head-l.length,to:s.head+l.length},range:De.cursor(s.head-l.length),userEvent:"delete.backward"}}return{range:i=s}});return i||e(t.update(o,{scrollIntoView:!0})),!i},sre=[{key:"Backspace",run:Kze}];function Jze(t,e){let n=ore(t,t.selection.main.head),r=n.brackets||$4.brackets;for(let i of r){let o=ire(vs(i,0));if(e==i)return o==i?rLe(t,i,r.indexOf(i+i+i)>-1):tLe(t,i,o,n.before||$4.before);if(e==o&&are(t,t.selection.main.from))return nLe(t,i,o)}return null}function are(t,e){let n=!1;return t.field(nre).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function W_(t,e){let n=t.sliceString(e,e+2);return n.slice(0,Ka(vs(n,0)))}function eLe(t,e){let n=t.sliceString(e-2,e);return Ka(vs(n,0))==n.length?n:n.slice(1)}function tLe(t,e,n,r){let i=null,o=t.changeByRange(s=>{if(!s.empty)return{changes:[{insert:e,from:s.from},{insert:n,from:s.to}],effects:yp.of(s.to+e.length),range:De.range(s.anchor+e.length,s.head+e.length)};let a=W_(t.doc,s.head);return!a||/\s/.test(a)||r.indexOf(a)>-1?{changes:{insert:e+n,from:s.head},effects:yp.of(s.head+e.length),range:De.cursor(s.head+e.length)}:{range:i=s}});return i?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function nLe(t,e,n){let r=null,i=t.selection.ranges.map(o=>o.empty&&W_(t.doc,o.head)==n?De.cursor(o.head+n.length):r=o);return r?null:t.update({selection:De.create(i,t.selection.mainIndex),scrollIntoView:!0,effects:t.selection.ranges.map(({from:o})=>KR.of(o))})}function rLe(t,e,n){let r=null,i=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:e,from:o.to}],effects:yp.of(o.to+e.length),range:De.range(o.anchor+e.length,o.head+e.length)};let s=o.head,a=W_(t.doc,s);if(a==e){if(jU(t,s))return{changes:{insert:e+e,from:s},effects:yp.of(s+e.length),range:De.cursor(s+e.length)};if(are(t,s)){let l=n&&t.sliceDoc(s,s+e.length*3)==e+e+e;return{range:De.cursor(s+e.length*(l?3:1)),effects:KR.of(s)}}}else{if(n&&t.sliceDoc(s-2*e.length,s)==e+e&&jU(t,s-2*e.length))return{changes:{insert:e+e+e+e,from:s},effects:yp.of(s+e.length),range:De.cursor(s+e.length)};if(t.charCategorizer(s)(a)!=qo.Word){let l=t.sliceDoc(s-1,s);if(l!=e&&t.charCategorizer(s)(l)!=qo.Word&&!iLe(t,s,e))return{changes:{insert:e+e,from:s},effects:yp.of(s+e.length),range:De.cursor(s+e.length)}}}return{range:r=o}});return r?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function jU(t,e){let n=di(t).resolveInner(e+1);return n.parent&&n.from==e}function iLe(t,e,n){let r=di(t).resolveInner(e,-1);for(let i=0;i<5;i++){if(t.sliceDoc(r.from,r.from+n.length)==n)return!0;let o=r.to==e&&r.parent;if(!o)break;r=o}return!1}function uy(t={}){return[Dl,vh.of(t),Mze,oLe,ere]}const eA=[{key:"Ctrl-Space",run:Jne},{key:"Escape",run:Ize},{key:"ArrowDown",run:d2(!0)},{key:"ArrowUp",run:d2(!1)},{key:"PageDown",run:d2(!0,"page")},{key:"PageUp",run:d2(!1,"page")},{key:"Enter",run:Kne}],oLe=Zf.highest(Vf.computeN([vh],t=>t.facet(vh).defaultKeymap?[eA]:[]));function Ni(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];typeof i=="string"?t.setAttribute(r,i):i!=null&&(t[r]=i)}e++}for(;e<arguments.length;e++)lre(t,arguments[e]);return t}function lre(t,e){if(typeof e=="string")t.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)t.appendChild(e);else if(Array.isArray(e))for(var n=0;n<e.length;n++)lre(t,e[n]);else throw new RangeError("Unsupported child node: "+e)}class sLe{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class dp{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let i=e,o=r.facet(O1).markerFilter;o&&(i=o(i));let s=Et.set(i.map(a=>a.from==a.to||a.from==a.to-1&&r.doc.lineAt(a.from).to==a.from?Et.widget({widget:new pLe(a),diagnostic:a}).range(a.from):Et.mark({attributes:{class:"cm-lintRange cm-lintRange-"+a.severity},diagnostic:a}).range(a.from,a.to)),!0);return new dp(s,n,h0(s))}}function h0(t,e=null,n=0){let r=null;return t.between(n,1e9,(i,o,{spec:s})=>{if(!(e&&s.diagnostic!=e))return r=new sLe(i,o,s.diagnostic),!1}),r}function aLe(t,e){return!!(t.effects.some(n=>n.is(tA))||t.changes.touchesRange(e.pos))}function cre(t,e){return t.field(il,!1)?e:e.concat(ln.appendConfig.of([il,_t.decorations.compute([il],n=>{let{selected:r,panel:i}=n.field(il);return!r||!i||r.from==r.to?Et.none:Et.set([lLe.range(r.from,r.to)])}),ane(cLe,{hideOn:aLe}),mLe]))}function ure(t,e){return{effects:cre(t,[tA.of(e)])}}const tA=ln.define(),nA=ln.define(),fre=ln.define(),il=hi.define({create(){return new dp(Et.none,null,null)},update(t,e){if(e.docChanged){let n=t.diagnostics.map(e.changes),r=null;if(t.selected){let i=e.changes.mapPos(t.selected.from,1);r=h0(n,t.selected.diagnostic,i)||h0(n,null,i)}t=new dp(n,t.panel,r)}for(let n of e.effects)n.is(tA)?t=dp.init(n.value,t.panel,e.state):n.is(nA)?t=new dp(t.diagnostics,n.value?U_.open:null,t.selected):n.is(fre)&&(t=new dp(t.diagnostics,t.panel,n.value));return t},provide:t=>[mh.from(t,e=>e.panel),_t.decorations.from(t,e=>e.diagnostics)]}),lLe=Et.mark({class:"cm-lintRange cm-lintRange-active"});function cLe(t,e,n){let{diagnostics:r}=t.state.field(il),i=[],o=2e8,s=0;r.between(e-(n<0?1:0),e+(n>0?1:0),(l,c,{spec:u})=>{e>=l&&e<=c&&(l==c||(e>l||n>0)&&(e<c||n<0))&&(i.push(u.diagnostic),o=Math.min(l,o),s=Math.max(c,s))});let a=t.state.facet(O1).tooltipFilter;return a&&(i=a(i)),i.length?{pos:o,end:s,above:t.state.doc.lineAt(o).to<s,create(){return{dom:uLe(t,i)}}}:null}function uLe(t,e){return Ni("ul",{class:"cm-tooltip-lint"},e.map(n=>pre(t,n,!1)))}const fLe=t=>{let e=t.state.field(il,!1);(!e||!e.panel)&&t.dispatch({effects:cre(t.state,[nA.of(!0)])});let n=iy(t,U_.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},ZU=t=>{let e=t.state.field(il,!1);return!e||!e.panel?!1:(t.dispatch({effects:nA.of(!1)}),!0)},dLe=t=>{let e=t.state.field(il,!1);if(!e)return!1;let n=t.state.selection.main,r=e.diagnostics.iter(n.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==n.from&&r.to==n.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},dre=[{key:"Mod-Shift-m",run:fLe},{key:"F8",run:dLe}],hLe=Ur.fromClass(class{constructor(t){this.view=t,this.timeout=-1,this.set=!0;let{delay:e}=t.state.facet(O1);this.lintTime=Date.now()+e,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,e)}run(){let t=Date.now();if(t<this.lintTime-10)setTimeout(this.run,this.lintTime-t);else{this.set=!1;let{state:e}=this.view,{sources:n}=e.facet(O1);Promise.all(n.map(r=>Promise.resolve(r(this.view)))).then(r=>{let i=r.reduce((o,s)=>o.concat(s));this.view.state.doc==e.doc&&this.view.dispatch(ure(this.view.state,i))},r=>{Aa(this.view.state,r)})}}update(t){let e=t.state.facet(O1);(t.docChanged||e!=t.startState.facet(O1))&&(this.lintTime=Date.now()+e.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,e.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}}),O1=Wt.define({combine(t){return Object.assign({sources:t.map(e=>e.source)},fa(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null}))},enables:hLe});function hre(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;r<n.length;r++){let i=n[r];if(/[a-zA-Z]/.test(i)&&!e.some(o=>o.toLowerCase()==i.toLowerCase())){e.push(i);continue e}}e.push("")}return e}function pre(t,e,n){var r;let i=n?hre(e.actions):[];return Ni("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Ni("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage():e.message),(r=e.actions)===null||r===void 0?void 0:r.map((o,s)=>{let a=f=>{f.preventDefault();let h=h0(t.state.field(il).diagnostics,e);h&&o.apply(t,h.from,h.to)},{name:l}=o,c=i[s]?l.indexOf(i[s]):-1,u=c<0?l:[l.slice(0,c),Ni("u",l.slice(c,c+1)),l.slice(c+1)];return Ni("button",{type:"button",class:"cm-diagnosticAction",onclick:a,onmousedown:a,"aria-label":` Action: ${l}${c<0?"":` (access key "${i[s]})"`}.`},u)}),e.source&&Ni("div",{class:"cm-diagnosticSource"},e.source))}class pLe extends oc{constructor(e){super(),this.diagnostic=e}eq(e){return e.diagnostic==this.diagnostic}toDOM(){return Ni("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}class VU{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=pre(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class U_{constructor(e){this.view=e,this.items=[];let n=i=>{if(i.keyCode==27)ZU(this.view),this.view.focus();else if(i.keyCode==38||i.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(i.keyCode==40||i.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(i.keyCode==36)this.moveSelection(0);else if(i.keyCode==35)this.moveSelection(this.items.length-1);else if(i.keyCode==13)this.view.focus();else if(i.keyCode>=65&&i.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:o}=this.items[this.selectedIndex],s=hre(o.actions);for(let a=0;a<s.length;a++)if(s[a].toUpperCase().charCodeAt(0)==i.keyCode){let l=h0(this.view.state.field(il).diagnostics,o);l&&o.actions[a].apply(e,l.from,l.to)}}else return;i.preventDefault()},r=i=>{for(let o=0;o<this.items.length;o++)this.items[o].dom.contains(i.target)&&this.moveSelection(o)};this.list=Ni("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:r}),this.dom=Ni("div",{class:"cm-panel-lint"},this.list,Ni("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>ZU(this.view)},"\xD7")),this.update()}get selectedIndex(){let e=this.view.state.field(il).selected;if(!e)return-1;for(let n=0;n<this.items.length;n++)if(this.items[n].diagnostic==e.diagnostic)return n;return-1}update(){let{diagnostics:e,selected:n}=this.view.state.field(il),r=0,i=!1,o=null;for(e.between(0,this.view.state.doc.length,(s,a,{spec:l})=>{let c=-1,u;for(let f=r;f<this.items.length;f++)if(this.items[f].diagnostic==l.diagnostic){c=f;break}c<0?(u=new VU(this.view,l.diagnostic),this.items.splice(r,0,u),i=!0):(u=this.items[c],c>r&&(this.items.splice(r,c-r),i=!0)),n&&u.diagnostic==n.diagnostic?u.dom.hasAttribute("aria-selected")||(u.dom.setAttribute("aria-selected","true"),o=u):u.dom.hasAttribute("aria-selected")&&u.dom.removeAttribute("aria-selected"),r++});r<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)i=!0,this.items.pop();this.items.length==0&&(this.items.push(new VU(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),i=!0),o?(this.list.setAttribute("aria-activedescendant",o.id),this.view.requestMeasure({key:this,read:()=>({sel:o.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:s,panel:a})=>{s.top<a.top?this.list.scrollTop-=a.top-s.top:s.bottom>a.bottom&&(this.list.scrollTop+=s.bottom-a.bottom)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(il),r=h0(n.diagnostics,this.items[e].diagnostic);!r||this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:fre.of(r)})}static open(e){return new U_(e)}}function OLe(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`}function EP(t){return OLe(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const mLe=_t.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:EP("#d11")},".cm-lintRange-warning":{backgroundImage:EP("orange")},".cm-lintRange-info":{backgroundImage:EP("#999")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});var Tf={},tO={},rA={},Nu={};Object.defineProperty(Nu,"__esModule",{value:!0});let j8;function Z8(){if(j8===void 0)throw new Error("No runtime abstraction layer installed");return j8}(function(t){function e(n){if(n===void 0)throw new Error("No runtime abstraction layer provided");j8=n}t.install=e})(Z8||(Z8={}));Nu.default=Z8;var iA={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Disposable=void 0,function(e){function n(r){return{dispose:r}}e.create=n}(t.Disposable||(t.Disposable={}))})(iA);var nO={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Emitter=t.Event=void 0;const e=Nu;(function(i){const o={dispose(){}};i.None=function(){return o}})(t.Event||(t.Event={}));class n{add(o,s=null,a){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(o),this._contexts.push(s),Array.isArray(a)&&a.push({dispose:()=>this.remove(o,s)})}remove(o,s=null){if(!this._callbacks)return;let a=!1;for(let l=0,c=this._callbacks.length;l<c;l++)if(this._callbacks[l]===o)if(this._contexts[l]===s){this._callbacks.splice(l,1),this._contexts.splice(l,1);return}else a=!0;if(a)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...o){if(!this._callbacks)return[];const s=[],a=this._callbacks.slice(0),l=this._contexts.slice(0);for(let c=0,u=a.length;c<u;c++)try{s.push(a[c].apply(l[c],o))}catch(f){(0,e.default)().console.error(f)}return s}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}}class r{constructor(o){this._options=o}get event(){return this._event||(this._event=(o,s,a)=>{this._callbacks||(this._callbacks=new n),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(o,s);const l={dispose:()=>{!this._callbacks||(this._callbacks.remove(o,s),l.dispose=r._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(a)&&a.push(l),l}),this._event}fire(o){this._callbacks&&this._callbacks.invoke.call(this._callbacks,o)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}}t.Emitter=r,r._noop=function(){}})(nO);var q_={};Object.defineProperty(q_,"__esModule",{value:!0});q_.AbstractMessageBuffer=void 0;const gLe=13,vLe=10,yLe=`\r
|
|
1146
1146
|
`;class bLe{constructor(e="utf-8"){this._encoding=e,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(e){const n=typeof e=="string"?this.fromString(e,this._encoding):e;this._chunks.push(n),this._totalLength+=n.byteLength}tryReadHeaders(){if(this._chunks.length===0)return;let e=0,n=0,r=0,i=0;e:for(;n<this._chunks.length;){const l=this._chunks[n];for(r=0;r<l.length;){switch(l[r]){case gLe:switch(e){case 0:e=1;break;case 2:e=3;break;default:e=0}break;case vLe:switch(e){case 1:e=2;break;case 3:e=4,r++;break e;default:e=0}break;default:e=0}r++}i+=l.byteLength,n++}if(e!==4)return;const o=this._read(i+r),s=new Map,a=this.toString(o,"ascii").split(yLe);if(a.length<2)return s;for(let l=0;l<a.length-2;l++){const c=a[l],u=c.indexOf(":");if(u===-1)throw new Error("Message header must separate key and value using :");const f=c.substr(0,u),h=c.substr(u+1).trim();s.set(f,h)}return s}tryReadBody(e){if(!(this._totalLength<e))return this._read(e)}get numberOfBytes(){return this._totalLength}_read(e){if(e===0)return this.emptyBuffer();if(e>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===e){const o=this._chunks[0];return this._chunks.shift(),this._totalLength-=e,this.asNative(o)}if(this._chunks[0].byteLength>e){const o=this._chunks[0],s=this.asNative(o,e);return this._chunks[0]=o.slice(e),this._totalLength-=e,s}const n=this.allocNative(e);let r=0,i=0;for(;e>0;){const o=this._chunks[i];if(o.byteLength>e){const s=o.slice(0,e);n.set(s,r),r+=e,this._chunks[i]=o.slice(e),this._totalLength-=e,e-=e}else n.set(o,r),r+=o.byteLength,this._chunks.shift(),this._totalLength-=o.byteLength,e-=o.byteLength}return n}}q_.AbstractMessageBuffer=bLe;Object.defineProperty(rA,"__esModule",{value:!0});const Ore=Nu,z1=iA,xLe=nO,SLe=q_;class B_ extends SLe.AbstractMessageBuffer{constructor(e="utf-8"){super(e),this.asciiDecoder=new TextDecoder("ascii")}emptyBuffer(){return B_.emptyBuffer}fromString(e,n){return new TextEncoder().encode(e)}toString(e,n){return n==="ascii"?this.asciiDecoder.decode(e):new TextDecoder(n).decode(e)}asNative(e,n){return n===void 0?e:e.slice(0,n)}allocNative(e){return new Uint8Array(e)}}B_.emptyBuffer=new Uint8Array(0);class wLe{constructor(e){this.socket=e,this._onData=new xLe.Emitter,this._messageListener=n=>{n.data.arrayBuffer().then(i=>{this._onData.fire(new Uint8Array(i))},()=>{(0,Ore.default)().console.error("Converting blob to array buffer failed.")})},this.socket.addEventListener("message",this._messageListener)}onClose(e){return this.socket.addEventListener("close",e),z1.Disposable.create(()=>this.socket.removeEventListener("close",e))}onError(e){return this.socket.addEventListener("error",e),z1.Disposable.create(()=>this.socket.removeEventListener("error",e))}onEnd(e){return this.socket.addEventListener("end",e),z1.Disposable.create(()=>this.socket.removeEventListener("end",e))}onData(e){return this._onData.event(e)}}class _Le{constructor(e){this.socket=e}onClose(e){return this.socket.addEventListener("close",e),z1.Disposable.create(()=>this.socket.removeEventListener("close",e))}onError(e){return this.socket.addEventListener("error",e),z1.Disposable.create(()=>this.socket.removeEventListener("error",e))}onEnd(e){return this.socket.addEventListener("end",e),z1.Disposable.create(()=>this.socket.removeEventListener("end",e))}write(e,n){if(typeof e=="string"){if(n!==void 0&&n!=="utf-8")throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${n}`);this.socket.send(e)}else this.socket.send(e);return Promise.resolve()}end(){this.socket.close()}}const TLe=new TextEncoder,mre=Object.freeze({messageBuffer:Object.freeze({create:t=>new B_(t)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(t,e)=>{if(e.charset!=="utf-8")throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${e.charset}`);return Promise.resolve(TLe.encode(JSON.stringify(t,void 0,0)))}}),decoder:Object.freeze({name:"application/json",decode:(t,e)=>{if(!(t instanceof Uint8Array))throw new Error("In a Browser environments only Uint8Arrays are supported.");return Promise.resolve(JSON.parse(new TextDecoder(e.charset).decode(t)))}})}),stream:Object.freeze({asReadableStream:t=>new wLe(t),asWritableStream:t=>new _Le(t)}),console,timer:Object.freeze({setTimeout(t,e,...n){const r=setTimeout(t,e,...n);return{dispose:()=>clearTimeout(r)}},setImmediate(t,...e){const n=setTimeout(t,0,...e);return{dispose:()=>clearTimeout(n)}},setInterval(t,e,...n){const r=setInterval(t,e,...n);return{dispose:()=>clearInterval(r)}}})});function V8(){return mre}(function(t){function e(){Ore.default.install(mre)}t.install=e})(V8||(V8={}));rA.default=V8;var G8={},oA={},_o={};Object.defineProperty(_o,"__esModule",{value:!0});_o.stringArray=_o.array=_o.func=_o.error=_o.number=_o.string=_o.boolean=void 0;function kLe(t){return t===!0||t===!1}_o.boolean=kLe;function gre(t){return typeof t=="string"||t instanceof String}_o.string=gre;function PLe(t){return typeof t=="number"||t instanceof Number}_o.number=PLe;function QLe(t){return t instanceof Error}_o.error=QLe;function $Le(t){return typeof t=="function"}_o.func=$Le;function vre(t){return Array.isArray(t)}_o.array=vre;function ELe(t){return vre(t)&&t.every(e=>gre(e))}_o.stringArray=ELe;(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Message=t.NotificationType9=t.NotificationType8=t.NotificationType7=t.NotificationType6=t.NotificationType5=t.NotificationType4=t.NotificationType3=t.NotificationType2=t.NotificationType1=t.NotificationType0=t.NotificationType=t.RequestType9=t.RequestType8=t.RequestType7=t.RequestType6=t.RequestType5=t.RequestType4=t.RequestType3=t.RequestType2=t.RequestType1=t.RequestType=t.RequestType0=t.AbstractMessageSignature=t.ParameterStructures=t.ResponseError=t.ErrorCodes=void 0;const e=_o;var n;(function(C){C.ParseError=-32700,C.InvalidRequest=-32600,C.MethodNotFound=-32601,C.InvalidParams=-32602,C.InternalError=-32603,C.jsonrpcReservedErrorRangeStart=-32099,C.serverErrorStart=-32099,C.MessageWriteError=-32099,C.MessageReadError=-32098,C.PendingResponseRejected=-32097,C.ConnectionInactive=-32096,C.ServerNotInitialized=-32002,C.UnknownErrorCode=-32001,C.jsonrpcReservedErrorRangeEnd=-32e3,C.serverErrorEnd=-32e3})(n=t.ErrorCodes||(t.ErrorCodes={}));class r extends Error{constructor(I,H,Y){super(H),this.code=e.number(I)?I:n.UnknownErrorCode,this.data=Y,Object.setPrototypeOf(this,r.prototype)}toJson(){const I={code:this.code,message:this.message};return this.data!==void 0&&(I.data=this.data),I}}t.ResponseError=r;class i{constructor(I){this.kind=I}static is(I){return I===i.auto||I===i.byName||I===i.byPosition}toString(){return this.kind}}t.ParameterStructures=i,i.auto=new i("auto"),i.byPosition=new i("byPosition"),i.byName=new i("byName");class o{constructor(I,H){this.method=I,this.numberOfParams=H}get parameterStructures(){return i.auto}}t.AbstractMessageSignature=o;class s extends o{constructor(I){super(I,0)}}t.RequestType0=s;class a extends o{constructor(I,H=i.auto){super(I,1),this._parameterStructures=H}get parameterStructures(){return this._parameterStructures}}t.RequestType=a;class l extends o{constructor(I,H=i.auto){super(I,1),this._parameterStructures=H}get parameterStructures(){return this._parameterStructures}}t.RequestType1=l;class c extends o{constructor(I){super(I,2)}}t.RequestType2=c;class u extends o{constructor(I){super(I,3)}}t.RequestType3=u;class f extends o{constructor(I){super(I,4)}}t.RequestType4=f;class h extends o{constructor(I){super(I,5)}}t.RequestType5=h;class d extends o{constructor(I){super(I,6)}}t.RequestType6=d;class O extends o{constructor(I){super(I,7)}}t.RequestType7=O;class b extends o{constructor(I){super(I,8)}}t.RequestType8=b;class v extends o{constructor(I){super(I,9)}}t.RequestType9=v;class p extends o{constructor(I,H=i.auto){super(I,1),this._parameterStructures=H}get parameterStructures(){return this._parameterStructures}}t.NotificationType=p;class g extends o{constructor(I){super(I,0)}}t.NotificationType0=g;class y extends o{constructor(I,H=i.auto){super(I,1),this._parameterStructures=H}get parameterStructures(){return this._parameterStructures}}t.NotificationType1=y;class S extends o{constructor(I){super(I,2)}}t.NotificationType2=S;class w extends o{constructor(I){super(I,3)}}t.NotificationType3=w;class T extends o{constructor(I){super(I,4)}}t.NotificationType4=T;class k extends o{constructor(I){super(I,5)}}t.NotificationType5=k;class A extends o{constructor(I){super(I,6)}}t.NotificationType6=A;class L extends o{constructor(I){super(I,7)}}t.NotificationType7=L;class $ extends o{constructor(I){super(I,8)}}t.NotificationType8=$;class E extends o{constructor(I){super(I,9)}}t.NotificationType9=E,function(C){function I(z){const U=z;return U&&e.string(U.method)&&(e.string(U.id)||e.number(U.id))}C.isRequest=I;function H(z){const U=z;return U&&e.string(U.method)&&z.id===void 0}C.isNotification=H;function Y(z){const U=z;return U&&(U.result!==void 0||!!U.error)&&(e.string(U.id)||e.number(U.id)||U.id===null)}C.isResponse=Y}(t.Message||(t.Message={}))})(oA);var sA={};(function(t){var e;Object.defineProperty(t,"__esModule",{value:!0}),t.LRUCache=t.LinkedMap=t.Touch=void 0;var n;(function(o){o.None=0,o.First=1,o.AsOld=o.First,o.Last=2,o.AsNew=o.Last})(n=t.Touch||(t.Touch={}));class r{constructor(){this[e]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){var s;return(s=this._head)==null?void 0:s.value}get last(){var s;return(s=this._tail)==null?void 0:s.value}has(s){return this._map.has(s)}get(s,a=n.None){const l=this._map.get(s);if(!!l)return a!==n.None&&this.touch(l,a),l.value}set(s,a,l=n.None){let c=this._map.get(s);if(c)c.value=a,l!==n.None&&this.touch(c,l);else{switch(c={key:s,value:a,next:void 0,previous:void 0},l){case n.None:this.addItemLast(c);break;case n.First:this.addItemFirst(c);break;case n.Last:this.addItemLast(c);break;default:this.addItemLast(c);break}this._map.set(s,c),this._size++}return this}delete(s){return!!this.remove(s)}remove(s){const a=this._map.get(s);if(!!a)return this._map.delete(s),this.removeItem(a),this._size--,a.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");const s=this._head;return this._map.delete(s.key),this.removeItem(s),this._size--,s.value}forEach(s,a){const l=this._state;let c=this._head;for(;c;){if(a?s.bind(a)(c.value,c.key,this):s(c.value,c.key,this),this._state!==l)throw new Error("LinkedMap got modified during iteration.");c=c.next}}keys(){const s=this._state;let a=this._head;const l={[Symbol.iterator]:()=>l,next:()=>{if(this._state!==s)throw new Error("LinkedMap got modified during iteration.");if(a){const c={value:a.key,done:!1};return a=a.next,c}else return{value:void 0,done:!0}}};return l}values(){const s=this._state;let a=this._head;const l={[Symbol.iterator]:()=>l,next:()=>{if(this._state!==s)throw new Error("LinkedMap got modified during iteration.");if(a){const c={value:a.value,done:!1};return a=a.next,c}else return{value:void 0,done:!0}}};return l}entries(){const s=this._state;let a=this._head;const l={[Symbol.iterator]:()=>l,next:()=>{if(this._state!==s)throw new Error("LinkedMap got modified during iteration.");if(a){const c={value:[a.key,a.value],done:!1};return a=a.next,c}else return{value:void 0,done:!0}}};return l}[(e=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(s){if(s>=this.size)return;if(s===0){this.clear();return}let a=this._head,l=this.size;for(;a&&l>s;)this._map.delete(a.key),a=a.next,l--;this._head=a,this._size=l,a&&(a.previous=void 0),this._state++}addItemFirst(s){if(!this._head&&!this._tail)this._tail=s;else if(this._head)s.next=this._head,this._head.previous=s;else throw new Error("Invalid list");this._head=s,this._state++}addItemLast(s){if(!this._head&&!this._tail)this._head=s;else if(this._tail)s.previous=this._tail,this._tail.next=s;else throw new Error("Invalid list");this._tail=s,this._state++}removeItem(s){if(s===this._head&&s===this._tail)this._head=void 0,this._tail=void 0;else if(s===this._head){if(!s.next)throw new Error("Invalid list");s.next.previous=void 0,this._head=s.next}else if(s===this._tail){if(!s.previous)throw new Error("Invalid list");s.previous.next=void 0,this._tail=s.previous}else{const a=s.next,l=s.previous;if(!a||!l)throw new Error("Invalid list");a.previous=l,l.next=a}s.next=void 0,s.previous=void 0,this._state++}touch(s,a){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(a!==n.First&&a!==n.Last)){if(a===n.First){if(s===this._head)return;const l=s.next,c=s.previous;s===this._tail?(c.next=void 0,this._tail=c):(l.previous=c,c.next=l),s.previous=void 0,s.next=this._head,this._head.previous=s,this._head=s,this._state++}else if(a===n.Last){if(s===this._tail)return;const l=s.next,c=s.previous;s===this._head?(l.previous=void 0,this._head=l):(l.previous=c,c.next=l),s.next=void 0,s.previous=this._tail,this._tail.next=s,this._tail=s,this._state++}}}toJSON(){const s=[];return this.forEach((a,l)=>{s.push([l,a])}),s}fromJSON(s){this.clear();for(const[a,l]of s)this.set(a,l)}}t.LinkedMap=r;class i extends r{constructor(s,a=1){super(),this._limit=s,this._ratio=Math.min(Math.max(0,a),1)}get limit(){return this._limit}set limit(s){this._limit=s,this.checkTrim()}get ratio(){return this._ratio}set ratio(s){this._ratio=Math.min(Math.max(0,s),1),this.checkTrim()}get(s,a=n.AsNew){return super.get(s,a)}peek(s){return super.get(s,n.None)}set(s,a){return super.set(s,a,n.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}}t.LRUCache=i})(sA);var aA={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.CancellationTokenSource=t.CancellationToken=void 0;const e=Nu,n=_o,r=nO;var i;(function(l){l.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:r.Event.None}),l.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:r.Event.None});function c(u){const f=u;return f&&(f===l.None||f===l.Cancelled||n.boolean(f.isCancellationRequested)&&!!f.onCancellationRequested)}l.is=c})(i=t.CancellationToken||(t.CancellationToken={}));const o=Object.freeze(function(l,c){const u=(0,e.default)().timer.setTimeout(l.bind(c),0);return{dispose(){u.dispose()}}});class s{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?o:(this._emitter||(this._emitter=new r.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}}class a{get token(){return this._token||(this._token=new s),this._token}cancel(){this._token?this._token.cancel():this._token=i.Cancelled}dispose(){this._token?this._token instanceof s&&this._token.dispose():this._token=i.None}}t.CancellationTokenSource=a})(aA);var yre={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ReadableStreamMessageReader=t.AbstractMessageReader=t.MessageReader=void 0;const e=Nu,n=_o,r=nO;(function(a){function l(c){let u=c;return u&&n.func(u.listen)&&n.func(u.dispose)&&n.func(u.onError)&&n.func(u.onClose)&&n.func(u.onPartialMessage)}a.is=l})(t.MessageReader||(t.MessageReader={}));class i{constructor(){this.errorEmitter=new r.Emitter,this.closeEmitter=new r.Emitter,this.partialMessageEmitter=new r.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(l){this.errorEmitter.fire(this.asError(l))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(l){this.partialMessageEmitter.fire(l)}asError(l){return l instanceof Error?l:new Error(`Reader received error. Reason: ${n.string(l.message)?l.message:"unknown"}`)}}t.AbstractMessageReader=i;var o;(function(a){function l(c){var b;let u,f;const h=new Map;let d;const O=new Map;if(c===void 0||typeof c=="string")u=c!=null?c:"utf-8";else{if(u=(b=c.charset)!=null?b:"utf-8",c.contentDecoder!==void 0&&(f=c.contentDecoder,h.set(f.name,f)),c.contentDecoders!==void 0)for(const v of c.contentDecoders)h.set(v.name,v);if(c.contentTypeDecoder!==void 0&&(d=c.contentTypeDecoder,O.set(d.name,d)),c.contentTypeDecoders!==void 0)for(const v of c.contentTypeDecoders)O.set(v.name,v)}return d===void 0&&(d=(0,e.default)().applicationJson.decoder,O.set(d.name,d)),{charset:u,contentDecoder:f,contentDecoders:h,contentTypeDecoder:d,contentTypeDecoders:O}}a.fromOptions=l})(o||(o={}));class s extends i{constructor(l,c){super(),this.readable=l,this.options=o.fromOptions(c),this.buffer=(0,e.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0}set partialMessageTimeout(l){this._partialMessageTimeout=l}get partialMessageTimeout(){return this._partialMessageTimeout}listen(l){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=l;const c=this.readable.onData(u=>{this.onData(u)});return this.readable.onError(u=>this.fireError(u)),this.readable.onClose(()=>this.fireClose()),c}onData(l){for(this.buffer.append(l);;){if(this.nextMessageLength===-1){const f=this.buffer.tryReadHeaders();if(!f)return;const h=f.get("Content-Length");if(!h)throw new Error("Header must provide a Content-Length property.");const d=parseInt(h);if(isNaN(d))throw new Error("Content-Length value must be a number.");this.nextMessageLength=d}const c=this.buffer.tryReadBody(this.nextMessageLength);if(c===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1;let u;this.options.contentDecoder!==void 0?u=this.options.contentDecoder.decode(c):u=Promise.resolve(c),u.then(f=>{this.options.contentTypeDecoder.decode(f,this.options).then(h=>{this.callback(h)},h=>{this.fireError(h)})},f=>{this.fireError(f)})}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,e.default)().timer.setTimeout((l,c)=>{this.partialMessageTimer=void 0,l===this.messageToken&&(this.firePartialMessage({messageToken:l,waitingTime:c}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}}t.ReadableStreamMessageReader=s})(yre);var bre={},Y_={};Object.defineProperty(Y_,"__esModule",{value:!0});Y_.Semaphore=void 0;const CLe=Nu;class RLe{constructor(e=1){if(e<=0)throw new Error("Capacity must be greater than 0");this._capacity=e,this._active=0,this._waiting=[]}lock(e){return new Promise((n,r)=>{this._waiting.push({thunk:e,resolve:n,reject:r}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,CLe.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;const e=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{const n=e.thunk();n instanceof Promise?n.then(r=>{this._active--,e.resolve(r),this.runNext()},r=>{this._active--,e.reject(r),this.runNext()}):(this._active--,e.resolve(n),this.runNext())}catch(n){this._active--,e.reject(n),this.runNext()}}}Y_.Semaphore=RLe;(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.WriteableStreamMessageWriter=t.AbstractMessageWriter=t.MessageWriter=void 0;const e=Nu,n=_o,r=Y_,i=nO,o="Content-Length: ",s=`\r
|
|
1147
1147
|
`;(function(u){function f(h){let d=h;return d&&n.func(d.dispose)&&n.func(d.onClose)&&n.func(d.onError)&&n.func(d.write)}u.is=f})(t.MessageWriter||(t.MessageWriter={}));class a{constructor(){this.errorEmitter=new i.Emitter,this.closeEmitter=new i.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(f,h,d){this.errorEmitter.fire([this.asError(f),h,d])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(f){return f instanceof Error?f:new Error(`Writer received error. Reason: ${n.string(f.message)?f.message:"unknown"}`)}}t.AbstractMessageWriter=a;var l;(function(u){function f(h){var d,O;return h===void 0||typeof h=="string"?{charset:h!=null?h:"utf-8",contentTypeEncoder:(0,e.default)().applicationJson.encoder}:{charset:(d=h.charset)!=null?d:"utf-8",contentEncoder:h.contentEncoder,contentTypeEncoder:(O=h.contentTypeEncoder)!=null?O:(0,e.default)().applicationJson.encoder}}u.fromOptions=f})(l||(l={}));class c extends a{constructor(f,h){super(),this.writable=f,this.options=l.fromOptions(h),this.errorCount=0,this.writeSemaphore=new r.Semaphore(1),this.writable.onError(d=>this.fireError(d)),this.writable.onClose(()=>this.fireClose())}async write(f){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(f,this.options).then(d=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(d):d).then(d=>{const O=[];return O.push(o,d.byteLength.toString(),s),O.push(s),this.doWrite(f,O,d)},d=>{throw this.fireError(d),d}))}async doWrite(f,h,d){try{return await this.writable.write(h.join(""),"ascii"),this.writable.write(d)}catch(O){return this.handleError(O,f),Promise.reject(O)}}handleError(f,h){this.errorCount++,this.fireError(f,h,this.errorCount)}end(){this.writable.end()}}t.WriteableStreamMessageWriter=c})(bre);var xre={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createMessageConnection=t.ConnectionOptions=t.CancellationStrategy=t.CancellationSenderStrategy=t.CancellationReceiverStrategy=t.ConnectionStrategy=t.ConnectionError=t.ConnectionErrors=t.LogTraceNotification=t.SetTraceNotification=t.TraceFormat=t.Trace=t.NullLogger=t.ProgressType=t.ProgressToken=void 0;const e=Nu,n=_o,r=oA,i=sA,o=nO,s=aA;var a;(function(A){A.type=new r.NotificationType("$/cancelRequest")})(a||(a={}));var l;(function(A){function L($){return typeof $=="string"||typeof $=="number"}A.is=L})(l=t.ProgressToken||(t.ProgressToken={}));var c;(function(A){A.type=new r.NotificationType("$/progress")})(c||(c={}));class u{constructor(){}}t.ProgressType=u;var f;(function(A){function L($){return n.func($)}A.is=L})(f||(f={})),t.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var h;(function(A){A[A.Off=0]="Off",A[A.Messages=1]="Messages",A[A.Compact=2]="Compact",A[A.Verbose=3]="Verbose"})(h=t.Trace||(t.Trace={})),function(A){function L(E){if(!n.string(E))return A.Off;switch(E=E.toLowerCase(),E){case"off":return A.Off;case"messages":return A.Messages;case"compact":return A.Compact;case"verbose":return A.Verbose;default:return A.Off}}A.fromString=L;function $(E){switch(E){case A.Off:return"off";case A.Messages:return"messages";case A.Compact:return"compact";case A.Verbose:return"verbose";default:return"off"}}A.toString=$}(h=t.Trace||(t.Trace={}));var d;(function(A){A.Text="text",A.JSON="json"})(d=t.TraceFormat||(t.TraceFormat={})),function(A){function L($){return n.string($)?($=$.toLowerCase(),$==="json"?A.JSON:A.Text):A.Text}A.fromString=L}(d=t.TraceFormat||(t.TraceFormat={}));var O;(function(A){A.type=new r.NotificationType("$/setTrace")})(O=t.SetTraceNotification||(t.SetTraceNotification={}));var b;(function(A){A.type=new r.NotificationType("$/logTrace")})(b=t.LogTraceNotification||(t.LogTraceNotification={}));var v;(function(A){A[A.Closed=1]="Closed",A[A.Disposed=2]="Disposed",A[A.AlreadyListening=3]="AlreadyListening"})(v=t.ConnectionErrors||(t.ConnectionErrors={}));class p extends Error{constructor(L,$){super($),this.code=L,Object.setPrototypeOf(this,p.prototype)}}t.ConnectionError=p;var g;(function(A){function L($){const E=$;return E&&n.func(E.cancelUndispatched)}A.is=L})(g=t.ConnectionStrategy||(t.ConnectionStrategy={}));var y;(function(A){A.Message=Object.freeze({createCancellationTokenSource($){return new s.CancellationTokenSource}});function L($){const E=$;return E&&n.func(E.createCancellationTokenSource)}A.is=L})(y=t.CancellationReceiverStrategy||(t.CancellationReceiverStrategy={}));var S;(function(A){A.Message=Object.freeze({sendCancellation($,E){return $.sendNotification(a.type,{id:E})},cleanup($){}});function L($){const E=$;return E&&n.func(E.sendCancellation)&&n.func(E.cleanup)}A.is=L})(S=t.CancellationSenderStrategy||(t.CancellationSenderStrategy={}));var w;(function(A){A.Message=Object.freeze({receiver:y.Message,sender:S.Message});function L($){const E=$;return E&&y.is(E.receiver)&&S.is(E.sender)}A.is=L})(w=t.CancellationStrategy||(t.CancellationStrategy={})),function(A){function L($){const E=$;return E&&(w.is(E.cancellationStrategy)||g.is(E.connectionStrategy))}A.is=L}(t.ConnectionOptions||(t.ConnectionOptions={}));var T;(function(A){A[A.New=1]="New",A[A.Listening=2]="Listening",A[A.Closed=3]="Closed",A[A.Disposed=4]="Disposed"})(T||(T={}));function k(A,L,$,E){const C=$!==void 0?$:t.NullLogger;let I=0,H=0,Y=0;const z="2.0";let U;const j=new Map;let K;const se=new Map,G=new Map;let re,Te=new i.LinkedMap,Re=new Map,V=new Set,pe=new Map,J=h.Off,ae=d.Text,ie,Ee=T.New;const Xe=new o.Emitter,je=new o.Emitter,at=new o.Emitter,it=new o.Emitter,pt=new o.Emitter,We=E&&E.cancellationStrategy?E.cancellationStrategy:w.Message;function Be(ge){if(ge===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+ge.toString()}function mt(ge){return ge===null?"res-unknown-"+(++Y).toString():"res-"+ge.toString()}function It(){return"not-"+(++H).toString()}function Pt(ge,Fe){r.Message.isRequest(Fe)?ge.set(Be(Fe.id),Fe):r.Message.isResponse(Fe)?ge.set(mt(Fe.id),Fe):ge.set(It(),Fe)}function Tn(ge){}function Nn(){return Ee===T.Listening}function fn(){return Ee===T.Closed}function cn(){return Ee===T.Disposed}function Ze(){(Ee===T.New||Ee===T.Listening)&&(Ee=T.Closed,je.fire(void 0))}function lt(ge){Xe.fire([ge,void 0,void 0])}function Lt(ge){Xe.fire(ge)}A.onClose(Ze),A.onError(lt),L.onClose(Ze),L.onError(Lt);function Pe(){re||Te.size===0||(re=(0,e.default)().timer.setImmediate(()=>{re=void 0,Ye()}))}function Ye(){if(Te.size===0)return;const ge=Te.shift();try{r.Message.isRequest(ge)?Ft(ge):r.Message.isNotification(ge)?In(ge):r.Message.isResponse(ge)?en(ge):jt(ge)}finally{Pe()}}const et=ge=>{try{if(r.Message.isNotification(ge)&&ge.method===a.type.method){const Fe=ge.params.id,ft=Be(Fe),Rt=Te.get(ft);if(r.Message.isRequest(Rt)){const Kn=E==null?void 0:E.connectionStrategy,jn=Kn&&Kn.cancelUndispatched?Kn.cancelUndispatched(Rt,Tn):void 0;if(jn&&(jn.error!==void 0||jn.result!==void 0)){Te.delete(ft),pe.delete(Fe),jn.id=Rt.id,On(jn,ge.method,Date.now()),L.write(jn).catch(()=>C.error("Sending response for canceled message failed."));return}}const gn=pe.get(Fe);if(gn!==void 0){gn.cancel(),ir(ge);return}else V.add(Fe)}Pt(Te,ge)}finally{Pe()}};function Ft(ge){var ar;if(cn())return;function Fe(An,Mn,qn){const hr={jsonrpc:z,id:ge.id};An instanceof r.ResponseError?hr.error=An.toJson():hr.result=An===void 0?null:An,On(hr,Mn,qn),L.write(hr).catch(()=>C.error("Sending response failed."))}function ft(An,Mn,qn){const hr={jsonrpc:z,id:ge.id,error:An.toJson()};On(hr,Mn,qn),L.write(hr).catch(()=>C.error("Sending response failed."))}function Rt(An,Mn,qn){An===void 0&&(An=null);const hr={jsonrpc:z,id:ge.id,result:An};On(hr,Mn,qn),L.write(hr).catch(()=>C.error("Sending response failed."))}Pr(ge);const gn=j.get(ge.method);let Kn,jn;gn&&(Kn=gn.type,jn=gn.handler);const Zn=Date.now();if(jn||U){const An=(ar=ge.id)!=null?ar:String(Date.now()),Mn=We.receiver.createCancellationTokenSource(An);ge.id!==null&&V.has(ge.id)&&Mn.cancel(),ge.id!==null&&pe.set(An,Mn);try{let qn;if(jn)if(ge.params===void 0){if(Kn!==void 0&&Kn.numberOfParams!==0){ft(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${ge.method} defines ${Kn.numberOfParams} params but received none.`),ge.method,Zn);return}qn=jn(Mn.token)}else if(Array.isArray(ge.params)){if(Kn!==void 0&&Kn.parameterStructures===r.ParameterStructures.byName){ft(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${ge.method} defines parameters by name but received parameters by position`),ge.method,Zn);return}qn=jn(...ge.params,Mn.token)}else{if(Kn!==void 0&&Kn.parameterStructures===r.ParameterStructures.byPosition){ft(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${ge.method} defines parameters by position but received parameters by name`),ge.method,Zn);return}qn=jn(ge.params,Mn.token)}else U&&(qn=U(ge.method,ge.params,Mn.token));const hr=qn;qn?hr.then?hr.then(nr=>{pe.delete(An),Fe(nr,ge.method,Zn)},nr=>{pe.delete(An),nr instanceof r.ResponseError?ft(nr,ge.method,Zn):nr&&n.string(nr.message)?ft(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${ge.method} failed with message: ${nr.message}`),ge.method,Zn):ft(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${ge.method} failed unexpectedly without providing any details.`),ge.method,Zn)}):(pe.delete(An),Fe(qn,ge.method,Zn)):(pe.delete(An),Rt(qn,ge.method,Zn))}catch(qn){pe.delete(An),qn instanceof r.ResponseError?Fe(qn,ge.method,Zn):qn&&n.string(qn.message)?ft(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${ge.method} failed with message: ${qn.message}`),ge.method,Zn):ft(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${ge.method} failed unexpectedly without providing any details.`),ge.method,Zn)}}else ft(new r.ResponseError(r.ErrorCodes.MethodNotFound,`Unhandled method ${ge.method}`),ge.method,Zn)}function en(ge){if(!cn())if(ge.id===null)ge.error?C.error(`Received response message without id: Error is:
|
|
1148
1148
|
${JSON.stringify(ge.error,void 0,4)}`):C.error("Received response message without id. No further error information provided.");else{const Fe=ge.id,ft=Re.get(Fe);if(ei(ge,ft),ft!==void 0){Re.delete(Fe);try{if(ge.error){const Rt=ge.error;ft.reject(new r.ResponseError(Rt.code,Rt.message,Rt.data))}else if(ge.result!==void 0)ft.resolve(ge.result);else throw new Error("Should never happen.")}catch(Rt){Rt.message?C.error(`Response handler '${ft.method}' failed with message: ${Rt.message}`):C.error(`Response handler '${ft.method}' failed unexpectedly.`)}}}}function In(ge){if(cn())return;let Fe,ft;if(ge.method===a.type.method){const Rt=ge.params.id;V.delete(Rt),ir(ge);return}else{const Rt=se.get(ge.method);Rt&&(ft=Rt.handler,Fe=Rt.type)}if(ft||K)try{if(ir(ge),ft)if(ge.params===void 0)Fe!==void 0&&Fe.numberOfParams!==0&&Fe.parameterStructures!==r.ParameterStructures.byName&&C.error(`Notification ${ge.method} defines ${Fe.numberOfParams} params but received none.`),ft();else if(Array.isArray(ge.params)){const Rt=ge.params;ge.method===c.type.method&&Rt.length===2&&l.is(Rt[0])?ft({token:Rt[0],value:Rt[1]}):(Fe!==void 0&&(Fe.parameterStructures===r.ParameterStructures.byName&&C.error(`Notification ${ge.method} defines parameters by name but received parameters by position`),Fe.numberOfParams!==ge.params.length&&C.error(`Notification ${ge.method} defines ${Fe.numberOfParams} params but received ${Rt.length} arguments`)),ft(...Rt))}else Fe!==void 0&&Fe.parameterStructures===r.ParameterStructures.byPosition&&C.error(`Notification ${ge.method} defines parameters by position but received parameters by name`),ft(ge.params);else K&&K(ge.method,ge.params)}catch(Rt){Rt.message?C.error(`Notification handler '${ge.method}' failed with message: ${Rt.message}`):C.error(`Notification handler '${ge.method}' failed unexpectedly.`)}else at.fire(ge)}function jt(ge){if(!ge){C.error("Received empty message.");return}C.error(`Received message which is neither a response nor a notification message:
|