@dao42/d42paas-front 0.9.39 → 0.9.40
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/README.md +401 -401
- package/dist/DaoPaaS.cjs +2 -2
- package/dist/DaoPaaS.d.ts +166 -166
- 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 +20 -20
- package/dist/sdk/docs/interfaces/PaaSOptions.html +5 -5
- package/dist/sdk/docs/modules.html +5 -5
- package/package.json +148 -148
package/dist/DaoPaaS.cjs
CHANGED
|
@@ -45,7 +45,7 @@ Error generating stack: `+o.message+`
|
|
|
45
45
|
*
|
|
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
|
-
*/var r1=F.exports,PF=B3.exports;function kF(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var TF=typeof Object.is=="function"?Object.is:kF,_F=PF.useSyncExternalStore,RF=r1.useRef,CF=r1.useEffect,XF=r1.useMemo,WF=r1.useDebugValue;N3.useSyncExternalStoreWithSelector=function(t,e,n,i,r){var o=RF(null);if(o.current===null){var s={hasValue:!1,value:null};o.current=s}else s=o.current;o=XF(function(){function l(d){if(!c){if(c=!0,u=d,d=i(d),r!==void 0&&s.hasValue){var y=s.value;if(r(y,d))return f=y}return f=d}if(y=f,TF(u,d))return y;var $=i(d);return r!==void 0&&r(y,$)?y:(u=d,f=$)}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,i,r]);var a=_F(t,o[0],o[1]);return CF(function(){s.hasValue=!0,s.value=a},[a]),WF(a),a};V3.exports=N3;function zF(t,e=t.getState,n){const i=V3.exports.useSyncExternalStoreWithSelector(t.subscribe,t.getState,t.getServerState||t.getState,e,n);return F.exports.useDebugValue(i),i}const ZR=t=>{const e=typeof t=="function"?M3(t):t,n=(i,r)=>zF(e,i,r);return Object.assign(n,e),n},EF=t=>t?ZR(t):ZR;var qF=EF,jR=Object.getOwnPropertySymbols,UF=Object.prototype.hasOwnProperty,AF=Object.prototype.propertyIsEnumerable,IF=(t,e)=>{var n={};for(var i in t)UF.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&jR)for(var i of jR(t))e.indexOf(i)<0&&AF.call(t,i)&&(n[i]=t[i]);return n};const LF=(t,e={})=>(n,i,r)=>{const o=e,{enabled:s,anonymousActionType:a}=o,l=IF(o,["enabled","anonymousActionType"]);let c;try{c=(s!=null?s:({BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0}&&"production")!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!c)return({BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0}&&"production")!=="production"&&s&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),t(n,i,r);const u=c.connect(l);let f=!0;r.setState=(y,$,b)=>{const m=n(y,$);return f&&u.send(b===void 0?{type:a||"anonymous"}:typeof b=="string"?{type:b}:b,i()),m};const h=(...y)=>{const $=f;f=!1,n(...y),f=$},d=t(r.setState,i,r);if(u.init(d),r.dispatchFromDevtools&&typeof r.dispatch=="function"){let y=!1;const $=r.dispatch;r.dispatch=(...b)=>{({BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0}&&"production")!=="production"&&b[0].type==="__setState"&&!y&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),y=!0),$(...b)}}return u.subscribe(y=>{var $;switch(y.type){case"ACTION":if(typeof y.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return nQ(y.payload,b=>{if(b.type==="__setState"){h(b.state);return}!r.dispatchFromDevtools||typeof r.dispatch=="function"&&r.dispatch(b)});case"DISPATCH":switch(y.payload.type){case"RESET":return h(d),u.init(r.getState());case"COMMIT":return u.init(r.getState());case"ROLLBACK":return nQ(y.state,b=>{h(b),u.init(r.getState())});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return nQ(y.state,b=>{h(b)});case"IMPORT_STATE":{const{nextLiftedState:b}=y.payload,m=($=b.computedStates.slice(-1)[0])==null?void 0:$.state;if(!m)return;h(m),u.send(null,b);return}case"PAUSE_RECORDING":return f=!f}return}}),d},YF=LF,nQ=(t,e)=>{let n;try{n=JSON.parse(t)}catch(i){console.error("[zustand devtools middleware] Could not parse the received json",i)}n!==void 0&&e(n)};var ZF=Object.defineProperty,DR=Object.getOwnPropertySymbols,jF=Object.prototype.hasOwnProperty,DF=Object.prototype.propertyIsEnumerable,MR=(t,e,n)=>e in t?ZF(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,sO=(t,e)=>{for(var n in e||(e={}))jF.call(e,n)&&MR(t,n,e[n]);if(DR)for(var n of DR(e))DF.call(e,n)&&MR(t,n,e[n]);return t};const Ry=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(i){return Ry(i)(n)},catch(i){return this}}}catch(n){return{then(i){return this},catch(i){return Ry(i)(n)}}}},MF=(t,e)=>(n,i,r)=>{let o=sO({getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:b=>b,version:0,merge:(b,m)=>sO(sO({},m),b)},e),s=!1;const a=new Set,l=new Set;let c;try{c=o.getStorage()}catch{}if(!c)return t((...b)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),n(...b)},i,r);const u=Ry(o.serialize),f=()=>{const b=o.partialize(sO({},i()));let m;const p=u({state:b,version:o.version}).then(v=>c.setItem(o.name,v)).catch(v=>{m=v});if(m)throw m;return p},h=r.setState;r.setState=(b,m)=>{h(b,m),f()};const d=t((...b)=>{n(...b),f()},i,r);let y;const $=()=>{var b;if(!c)return;s=!1,a.forEach(p=>p(i()));const m=((b=o.onRehydrateStorage)==null?void 0:b.call(o,i()))||void 0;return Ry(c.getItem.bind(c))(o.name).then(p=>{if(p)return o.deserialize(p)}).then(p=>{if(p)if(typeof p.version=="number"&&p.version!==o.version){if(o.migrate)return o.migrate(p.state,p.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return p.state}).then(p=>{var v;return y=o.merge(p,(v=i())!=null?v:d),n(y,!0),f()}).then(()=>{m==null||m(y,void 0),s=!0,l.forEach(p=>p(y))}).catch(p=>{m==null||m(void 0,p)})};return r.persist={setOptions:b=>{o=sO(sO({},o),b),b.getStorage&&(c=b.getStorage())},clearStorage:()=>{c==null||c.removeItem(o.name)},rehydrate:()=>$(),hasHydrated:()=>s,onHydrate:b=>(a.add(b),()=>{a.delete(b)}),onFinishHydration:b=>(l.add(b),()=>{l.delete(b)})},$(),y||d},VF=MF,NF=(t,e)=>{const n={};return Object.keys(t.getState()).forEach(i=>{n[i]=r=>{if(t.getState()[i]===r)return;const s=i.replace(/^\S/,a=>a.toUpperCase());t.setState(a=>{a[i]=r},`@@${e}/set${s}`)}}),n},BF=(t,e)=>{const n=t(e.set,e.get,e);return{...e,set:{...e.set,...n}}},GF=(t,e)=>{const n={...e.use},i={...e.useTracked},r={...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)}),i[o]=(...s)=>{const a=e.useTrackedStore(),c=t(a,e.get,e)[o];return c(...s)},r[o]=(...s)=>{const l=t(e.store.getState(),e.get,e)[o];return l(...s)}}),{...e,get:r,use:n,useTracked:i}},k$=t=>({...t,extendSelectors:e=>k$(GF(e,t)),extendActions:e=>k$(BF(e,t))}),FF=t=>{const e={};return Object.keys(t.getState()).forEach(n=>{e[n]=()=>t.getState()[n]}),e},HF=t=>{const e={};return Object.keys(t.getState()).forEach(n=>{e[n]=i=>t(r=>r[n],i)}),e},KF=(t,e)=>{const n={};return Object.keys(t.getState()).forEach(i=>{n[i]=()=>e()[i]}),n},JF=t=>(e,n,i)=>{const r=(o,s)=>e(uF(o),!0,s);return i.setState=r,t(r,n,i)};function eH(t,...e){return e.reduce((n,i)=>i(n),t)}const Sk=t=>(e,n={})=>{var i;const{middlewares:r=[],devtools:o,persist:s,immer:a}=n;OF((i=a==null?void 0:a.enabledAutoFreeze)!==null&&i!==void 0?i:!1),a!=null&&a.enableMapSet&&rF();const l=[JF,...r];s!=null&&s.enabled&&l.push(S=>VF(S,{...s,name:t})),o!=null&&o.enabled&&l.push(S=>YF(S,{...o,name:t})),l.push(M3);const u=(S=>eH(S,...l))(()=>e),f=qF(u),h=NF(f,t),d=(S,w)=>{u.setState(T=>{Object.assign(T,S)},w||`@@${t}/mergeState`)},y=(S,w)=>{u.setState(S,w||`@@${t}/setState`)},$=HF(f),b=FF(f),m=mF(f),p=KF(f,m),v={get:{state:u.getState,...b},name:t,set:{state:y,mergeState:d,...h},store:u,use:$,useTracked:p,useStore:f,useTrackedStore:m,extendSelectors:()=>v,extendActions:()=>v};return k$(v)};var Em=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function F3(t,e){return e={exports:{}},t(e,e.exports),e.exports}var tH=typeof Em=="object"&&Em&&Em.Object===Object&&Em,H3=tH,nH=typeof self=="object"&&self&&self.Object===Object&&self,iH=H3||nH||Function("return this")(),zl=iH,rH=zl.Symbol,wc=rH,K3=Object.prototype,oH=K3.hasOwnProperty,sH=K3.toString,pd=wc?wc.toStringTag:void 0;function aH(t){var e=oH.call(t,pd),n=t[pd];try{t[pd]=void 0;var i=!0}catch{}var r=sH.call(t);return i&&(e?t[pd]=n:delete t[pd]),r}var lH=aH,cH=Object.prototype,uH=cH.toString;function OH(t){return uH.call(t)}var fH=OH,dH="[object Null]",hH="[object Undefined]",VR=wc?wc.toStringTag:void 0;function pH(t){return t==null?t===void 0?hH:dH:VR&&VR in Object(t)?lH(t):fH(t)}var Rf=pH;function mH(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var $k=mH,gH="[object AsyncFunction]",yH="[object Function]",vH="[object GeneratorFunction]",bH="[object Proxy]";function QH(t){if(!$k(t))return!1;var e=Rf(t);return e==yH||e==vH||e==gH||e==bH}var J3=QH,SH=zl["__core-js_shared__"],iQ=SH,NR=function(){var t=/[^.]+$/.exec(iQ&&iQ.keys&&iQ.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function $H(t){return!!NR&&NR in t}var wH=$H,xH=Function.prototype,PH=xH.toString;function kH(t){if(t!=null){try{return PH.call(t)}catch{}try{return t+""}catch{}}return""}var Iu=kH,TH=/[\\^$.*+?()[\]{}|]/g,_H=/^\[object .+?Constructor\]$/,RH=Function.prototype,CH=Object.prototype,XH=RH.toString,WH=CH.hasOwnProperty,zH=RegExp("^"+XH.call(WH).replace(TH,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function EH(t){if(!$k(t)||wH(t))return!1;var e=J3(t)?zH:_H;return e.test(Iu(t))}var qH=EH;function UH(t,e){return t==null?void 0:t[e]}var AH=UH;function IH(t,e){var n=AH(t,e);return qH(n)?n:void 0}var Lu=IH,LH=function(){try{var t=Lu(Object,"defineProperty");return t({},"",{}),t}catch{}}(),BR=LH;function YH(t,e,n){e=="__proto__"&&BR?BR(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}var ZH=YH;function jH(t){return function(e,n,i){for(var r=-1,o=Object(e),s=i(e),a=s.length;a--;){var l=s[t?a:++r];if(n(o[l],l,o)===!1)break}return e}}var DH=jH,MH=DH(),VH=MH;function NH(t,e){for(var n=-1,i=Array(t);++n<t;)i[n]=e(n);return i}var BH=NH;function GH(t){return t!=null&&typeof t=="object"}var sf=GH,FH="[object Arguments]";function HH(t){return sf(t)&&Rf(t)==FH}var GR=HH,eq=Object.prototype,KH=eq.hasOwnProperty,JH=eq.propertyIsEnumerable,eK=GR(function(){return arguments}())?GR:function(t){return sf(t)&&KH.call(t,"callee")&&!JH.call(t,"callee")},tq=eK,tK=Array.isArray,_l=tK;function nK(){return!1}var iK=nK,T$=F3(function(t,e){var n=e&&!e.nodeType&&e,i=n&&!0&&t&&!t.nodeType&&t,r=i&&i.exports===n,o=r?zl.Buffer:void 0,s=o?o.isBuffer:void 0,a=s||iK;t.exports=a}),rK=9007199254740991,oK=/^(?:0|[1-9]\d*)$/;function sK(t,e){var n=typeof t;return e=e==null?rK:e,!!e&&(n=="number"||n!="symbol"&&oK.test(t))&&t>-1&&t%1==0&&t<e}var nq=sK,aK=9007199254740991;function lK(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=aK}var wk=lK,cK="[object Arguments]",uK="[object Array]",OK="[object Boolean]",fK="[object Date]",dK="[object Error]",hK="[object Function]",pK="[object Map]",mK="[object Number]",gK="[object Object]",yK="[object RegExp]",vK="[object Set]",bK="[object String]",QK="[object WeakMap]",SK="[object ArrayBuffer]",$K="[object DataView]",wK="[object Float32Array]",xK="[object Float64Array]",PK="[object Int8Array]",kK="[object Int16Array]",TK="[object Int32Array]",_K="[object Uint8Array]",RK="[object Uint8ClampedArray]",CK="[object Uint16Array]",XK="[object Uint32Array]",ti={};ti[wK]=ti[xK]=ti[PK]=ti[kK]=ti[TK]=ti[_K]=ti[RK]=ti[CK]=ti[XK]=!0;ti[cK]=ti[uK]=ti[SK]=ti[OK]=ti[$K]=ti[fK]=ti[dK]=ti[hK]=ti[pK]=ti[mK]=ti[gK]=ti[yK]=ti[vK]=ti[bK]=ti[QK]=!1;function WK(t){return sf(t)&&wk(t.length)&&!!ti[Rf(t)]}var zK=WK;function EK(t){return function(e){return t(e)}}var qK=EK,FR=F3(function(t,e){var n=e&&!e.nodeType&&e,i=n&&!0&&t&&!t.nodeType&&t,r=i&&i.exports===n,o=r&&H3.process,s=function(){try{var a=i&&i.require&&i.require("util").types;return a||o&&o.binding&&o.binding("util")}catch{}}();t.exports=s}),HR=FR&&FR.isTypedArray,UK=HR?qK(HR):zK,iq=UK,AK=Object.prototype,IK=AK.hasOwnProperty;function LK(t,e){var n=_l(t),i=!n&&tq(t),r=!n&&!i&&T$(t),o=!n&&!i&&!r&&iq(t),s=n||i||r||o,a=s?BH(t.length,String):[],l=a.length;for(var c in t)(e||IK.call(t,c))&&!(s&&(c=="length"||r&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||nq(c,l)))&&a.push(c);return a}var YK=LK,ZK=Object.prototype;function jK(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||ZK;return t===n}var DK=jK;function MK(t,e){return function(n){return t(e(n))}}var VK=MK,NK=VK(Object.keys,Object),BK=NK,GK=Object.prototype,FK=GK.hasOwnProperty;function HK(t){if(!DK(t))return BK(t);var e=[];for(var n in Object(t))FK.call(t,n)&&n!="constructor"&&e.push(n);return e}var KK=HK;function JK(t){return t!=null&&wk(t.length)&&!J3(t)}var eJ=JK;function tJ(t){return eJ(t)?YK(t):KK(t)}var xk=tJ;function nJ(t,e){return t&&VH(t,e,xk)}var iJ=nJ;function rJ(){this.__data__=[],this.size=0}var oJ=rJ;function sJ(t,e){return t===e||t!==t&&e!==e}var rq=sJ;function aJ(t,e){for(var n=t.length;n--;)if(rq(t[n][0],e))return n;return-1}var o1=aJ,lJ=Array.prototype,cJ=lJ.splice;function uJ(t){var e=this.__data__,n=o1(e,t);if(n<0)return!1;var i=e.length-1;return n==i?e.pop():cJ.call(e,n,1),--this.size,!0}var OJ=uJ;function fJ(t){var e=this.__data__,n=o1(e,t);return n<0?void 0:e[n][1]}var dJ=fJ;function hJ(t){return o1(this.__data__,t)>-1}var pJ=hJ;function mJ(t,e){var n=this.__data__,i=o1(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this}var gJ=mJ;function Cf(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}Cf.prototype.clear=oJ;Cf.prototype.delete=OJ;Cf.prototype.get=dJ;Cf.prototype.has=pJ;Cf.prototype.set=gJ;var s1=Cf;function yJ(){this.__data__=new s1,this.size=0}var vJ=yJ;function bJ(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}var QJ=bJ;function SJ(t){return this.__data__.get(t)}var $J=SJ;function wJ(t){return this.__data__.has(t)}var xJ=wJ,PJ=Lu(zl,"Map"),Uh=PJ,kJ=Lu(Object,"create"),Ah=kJ;function TJ(){this.__data__=Ah?Ah(null):{},this.size=0}var _J=TJ;function RJ(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var CJ=RJ,XJ="__lodash_hash_undefined__",WJ=Object.prototype,zJ=WJ.hasOwnProperty;function EJ(t){var e=this.__data__;if(Ah){var n=e[t];return n===XJ?void 0:n}return zJ.call(e,t)?e[t]:void 0}var qJ=EJ,UJ=Object.prototype,AJ=UJ.hasOwnProperty;function IJ(t){var e=this.__data__;return Ah?e[t]!==void 0:AJ.call(e,t)}var LJ=IJ,YJ="__lodash_hash_undefined__";function ZJ(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Ah&&e===void 0?YJ:e,this}var jJ=ZJ;function Xf(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}Xf.prototype.clear=_J;Xf.prototype.delete=CJ;Xf.prototype.get=qJ;Xf.prototype.has=LJ;Xf.prototype.set=jJ;var KR=Xf;function DJ(){this.size=0,this.__data__={hash:new KR,map:new(Uh||s1),string:new KR}}var MJ=DJ;function VJ(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var NJ=VJ;function BJ(t,e){var n=t.__data__;return NJ(e)?n[typeof e=="string"?"string":"hash"]:n.map}var a1=BJ;function GJ(t){var e=a1(this,t).delete(t);return this.size-=e?1:0,e}var FJ=GJ;function HJ(t){return a1(this,t).get(t)}var KJ=HJ;function JJ(t){return a1(this,t).has(t)}var eee=JJ;function tee(t,e){var n=a1(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this}var nee=tee;function Wf(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}Wf.prototype.clear=MJ;Wf.prototype.delete=FJ;Wf.prototype.get=KJ;Wf.prototype.has=eee;Wf.prototype.set=nee;var l1=Wf,iee=200;function ree(t,e){var n=this.__data__;if(n instanceof s1){var i=n.__data__;if(!Uh||i.length<iee-1)return i.push([t,e]),this.size=++n.size,this;n=this.__data__=new l1(i)}return n.set(t,e),this.size=n.size,this}var oee=ree;function zf(t){var e=this.__data__=new s1(t);this.size=e.size}zf.prototype.clear=vJ;zf.prototype.delete=QJ;zf.prototype.get=$J;zf.prototype.has=xJ;zf.prototype.set=oee;var Wg=zf,see="__lodash_hash_undefined__";function aee(t){return this.__data__.set(t,see),this}var lee=aee;function cee(t){return this.__data__.has(t)}var uee=cee;function Cy(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new l1;++e<n;)this.add(t[e])}Cy.prototype.add=Cy.prototype.push=lee;Cy.prototype.has=uee;var Oee=Cy;function fee(t,e){for(var n=-1,i=t==null?0:t.length;++n<i;)if(e(t[n],n,t))return!0;return!1}var dee=fee;function hee(t,e){return t.has(e)}var pee=hee,mee=1,gee=2;function yee(t,e,n,i,r,o){var s=n&mee,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&gee?new Oee:void 0;for(o.set(t,e),o.set(e,t);++f<a;){var y=t[f],$=e[f];if(i)var b=s?i($,y,f,e,t,o):i(y,$,f,t,e,o);if(b!==void 0){if(b)continue;h=!1;break}if(d){if(!dee(e,function(m,p){if(!pee(d,p)&&(y===m||r(y,m,n,i,o)))return d.push(p)})){h=!1;break}}else if(!(y===$||r(y,$,n,i,o))){h=!1;break}}return o.delete(t),o.delete(e),h}var oq=yee,vee=zl.Uint8Array,JR=vee;function bee(t){var e=-1,n=Array(t.size);return t.forEach(function(i,r){n[++e]=[r,i]}),n}var Qee=bee;function See(t){var e=-1,n=Array(t.size);return t.forEach(function(i){n[++e]=i}),n}var $ee=See,wee=1,xee=2,Pee="[object Boolean]",kee="[object Date]",Tee="[object Error]",_ee="[object Map]",Ree="[object Number]",Cee="[object RegExp]",Xee="[object Set]",Wee="[object String]",zee="[object Symbol]",Eee="[object ArrayBuffer]",qee="[object DataView]",eC=wc?wc.prototype:void 0,rQ=eC?eC.valueOf:void 0;function Uee(t,e,n,i,r,o,s){switch(n){case qee:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Eee:return!(t.byteLength!=e.byteLength||!o(new JR(t),new JR(e)));case Pee:case kee:case Ree:return rq(+t,+e);case Tee:return t.name==e.name&&t.message==e.message;case Cee:case Wee:return t==e+"";case _ee:var a=Qee;case Xee:var l=i&wee;if(a||(a=$ee),t.size!=e.size&&!l)return!1;var c=s.get(t);if(c)return c==e;i|=xee,s.set(t,e);var u=oq(a(t),a(e),i,r,o,s);return s.delete(t),u;case zee:if(rQ)return rQ.call(t)==rQ.call(e)}return!1}var Aee=Uee;function Iee(t,e){for(var n=-1,i=e.length,r=t.length;++n<i;)t[r+n]=e[n];return t}var Lee=Iee;function Yee(t,e,n){var i=e(t);return _l(t)?i:Lee(i,n(t))}var Zee=Yee;function jee(t,e){for(var n=-1,i=t==null?0:t.length,r=0,o=[];++n<i;){var s=t[n];e(s,n,t)&&(o[r++]=s)}return o}var Dee=jee;function Mee(){return[]}var Vee=Mee,Nee=Object.prototype,Bee=Nee.propertyIsEnumerable,tC=Object.getOwnPropertySymbols,Gee=tC?function(t){return t==null?[]:(t=Object(t),Dee(tC(t),function(e){return Bee.call(t,e)}))}:Vee,Fee=Gee;function Hee(t){return Zee(t,xk,Fee)}var nC=Hee,Kee=1,Jee=Object.prototype,ete=Jee.hasOwnProperty;function tte(t,e,n,i,r,o){var s=n&Kee,a=nC(t),l=a.length,c=nC(e),u=c.length;if(l!=u&&!s)return!1;for(var f=l;f--;){var h=a[f];if(!(s?h in e:ete.call(e,h)))return!1}var d=o.get(t),y=o.get(e);if(d&&y)return d==e&&y==t;var $=!0;o.set(t,e),o.set(e,t);for(var b=s;++f<l;){h=a[f];var m=t[h],p=e[h];if(i)var v=s?i(p,m,h,e,t,o):i(m,p,h,t,e,o);if(!(v===void 0?m===p||r(m,p,n,i,o):v)){$=!1;break}b||(b=h=="constructor")}if($&&!b){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)&&($=!1)}return o.delete(t),o.delete(e),$}var nte=tte,ite=Lu(zl,"DataView"),_$=ite,rte=Lu(zl,"Promise"),R$=rte,ote=Lu(zl,"Set"),C$=ote,ste=Lu(zl,"WeakMap"),X$=ste,iC="[object Map]",ate="[object Object]",rC="[object Promise]",oC="[object Set]",sC="[object WeakMap]",aC="[object DataView]",lte=Iu(_$),cte=Iu(Uh),ute=Iu(R$),Ote=Iu(C$),fte=Iu(X$),tu=Rf;(_$&&tu(new _$(new ArrayBuffer(1)))!=aC||Uh&&tu(new Uh)!=iC||R$&&tu(R$.resolve())!=rC||C$&&tu(new C$)!=oC||X$&&tu(new X$)!=sC)&&(tu=function(t){var e=Rf(t),n=e==ate?t.constructor:void 0,i=n?Iu(n):"";if(i)switch(i){case lte:return aC;case cte:return iC;case ute:return rC;case Ote:return oC;case fte:return sC}return e});var lC=tu,dte=1,cC="[object Arguments]",uC="[object Array]",qm="[object Object]",hte=Object.prototype,OC=hte.hasOwnProperty;function pte(t,e,n,i,r,o){var s=_l(t),a=_l(e),l=s?uC:lC(t),c=a?uC:lC(e);l=l==cC?qm:l,c=c==cC?qm:c;var u=l==qm,f=c==qm,h=l==c;if(h&&T$(t)){if(!T$(e))return!1;s=!0,u=!1}if(h&&!u)return o||(o=new Wg),s||iq(t)?oq(t,e,n,i,r,o):Aee(t,e,l,n,i,r,o);if(!(n&dte)){var d=u&&OC.call(t,"__wrapped__"),y=f&&OC.call(e,"__wrapped__");if(d||y){var $=d?t.value():t,b=y?e.value():e;return o||(o=new Wg),r($,b,n,i,o)}}return h?(o||(o=new Wg),nte(t,e,n,i,r,o)):!1}var mte=pte;function sq(t,e,n,i,r){return t===e?!0:t==null||e==null||!sf(t)&&!sf(e)?t!==t&&e!==e:mte(t,e,n,i,sq,r)}var aq=sq,gte=1,yte=2;function vte(t,e,n,i){var r=n.length,o=r,s=!i;if(t==null)return!o;for(t=Object(t);r--;){var a=n[r];if(s&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++r<o;){a=n[r];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 Wg;if(i)var h=i(c,u,l,t,e,f);if(!(h===void 0?aq(u,c,gte|yte,i,f):h))return!1}}return!0}var bte=vte;function Qte(t){return t===t&&!$k(t)}var lq=Qte;function Ste(t){for(var e=xk(t),n=e.length;n--;){var i=e[n],r=t[i];e[n]=[i,r,lq(r)]}return e}var $te=Ste;function wte(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}var cq=wte;function xte(t){var e=$te(t);return e.length==1&&e[0][2]?cq(e[0][0],e[0][1]):function(n){return n===t||bte(n,t,e)}}var Pte=xte,kte="[object Symbol]";function Tte(t){return typeof t=="symbol"||sf(t)&&Rf(t)==kte}var Pk=Tte,_te=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Rte=/^\w*$/;function Cte(t,e){if(_l(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||Pk(t)?!0:Rte.test(t)||!_te.test(t)||e!=null&&t in Object(e)}var kk=Cte,Xte="Expected a function";function Tk(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(Xte);var n=function(){var i=arguments,r=e?e.apply(this,i):i[0],o=n.cache;if(o.has(r))return o.get(r);var s=t.apply(this,i);return n.cache=o.set(r,s)||o,s};return n.cache=new(Tk.Cache||l1),n}Tk.Cache=l1;var Wte=Tk,zte=500;function Ete(t){var e=Wte(t,function(i){return n.size===zte&&n.clear(),i}),n=e.cache;return e}var qte=Ete,Ute=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ate=/\\(\\)?/g,Ite=qte(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Ute,function(n,i,r,o){e.push(r?o.replace(Ate,"$1"):i||n)}),e}),Lte=Ite;function Yte(t,e){for(var n=-1,i=t==null?0:t.length,r=Array(i);++n<i;)r[n]=e(t[n],n,t);return r}var Zte=Yte,jte=1/0,fC=wc?wc.prototype:void 0,dC=fC?fC.toString:void 0;function uq(t){if(typeof t=="string")return t;if(_l(t))return Zte(t,uq)+"";if(Pk(t))return dC?dC.call(t):"";var e=t+"";return e=="0"&&1/t==-jte?"-0":e}var Dte=uq;function Mte(t){return t==null?"":Dte(t)}var Vte=Mte;function Nte(t,e){return _l(t)?t:kk(t,e)?[t]:Lte(Vte(t))}var Oq=Nte,Bte=1/0;function Gte(t){if(typeof t=="string"||Pk(t))return t;var e=t+"";return e=="0"&&1/t==-Bte?"-0":e}var c1=Gte;function Fte(t,e){e=Oq(e,t);for(var n=0,i=e.length;t!=null&&n<i;)t=t[c1(e[n++])];return n&&n==i?t:void 0}var fq=Fte;function Hte(t,e,n){var i=t==null?void 0:fq(t,e);return i===void 0?n:i}var Kte=Hte;function Jte(t,e){return t!=null&&e in Object(t)}var ene=Jte;function tne(t,e,n){e=Oq(e,t);for(var i=-1,r=e.length,o=!1;++i<r;){var s=c1(e[i]);if(!(o=t!=null&&n(t,s)))break;t=t[s]}return o||++i!=r?o:(r=t==null?0:t.length,!!r&&wk(r)&&nq(s,r)&&(_l(t)||tq(t)))}var nne=tne;function ine(t,e){return t!=null&&nne(t,e,ene)}var rne=ine,one=1,sne=2;function ane(t,e){return kk(t)&&lq(e)?cq(c1(t),e):function(n){var i=Kte(n,t);return i===void 0&&i===e?rne(n,t):aq(e,i,one|sne)}}var lne=ane;function cne(t){return t}var une=cne;function One(t){return function(e){return e==null?void 0:e[t]}}var fne=One;function dne(t){return function(e){return fq(e,t)}}var hne=dne;function pne(t){return kk(t)?fne(c1(t)):hne(t)}var mne=pne;function gne(t){return typeof t=="function"?t:t==null?une:typeof t=="object"?_l(t)?lne(t[0],t[1]):Pte(t):mne(t)}var yne=gne;function vne(t,e){var n={};return e=yne(e),iJ(t,function(i,r,o){ZH(n,r,e(i,r,o))}),n}var bne=vne;const _k=(t,e)=>bne(e,n=>n[t]),La=Object.create(null);La.open="0";La.close="1";La.ping="2";La.pong="3";La.message="4";La.upgrade="5";La.noop="6";const zg=Object.create(null);Object.keys(La).forEach(t=>{zg[La[t]]=t});const Qne={type:"error",data:"parser error"},Sne=typeof Blob=="function"||typeof Blob!="undefined"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",$ne=typeof ArrayBuffer=="function",wne=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,dq=({type:t,data:e},n,i)=>Sne&&e instanceof Blob?n?i(e):hC(e,i):$ne&&(e instanceof ArrayBuffer||wne(e))?n?i(e):hC(new Blob([e]),i):i(La[t]+(e||"")),hC=(t,e)=>{const n=new FileReader;return n.onload=function(){const i=n.result.split(",")[1];e("b"+i)},n.readAsDataURL(t)},pC="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ld=typeof Uint8Array=="undefined"?[]:new Uint8Array(256);for(let t=0;t<pC.length;t++)Ld[pC.charCodeAt(t)]=t;const xne=t=>{let e=t.length*.75,n=t.length,i,r=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(i=0;i<n;i+=4)o=Ld[t.charCodeAt(i)],s=Ld[t.charCodeAt(i+1)],a=Ld[t.charCodeAt(i+2)],l=Ld[t.charCodeAt(i+3)],u[r++]=o<<2|s>>4,u[r++]=(s&15)<<4|a>>2,u[r++]=(a&3)<<6|l&63;return c},Pne=typeof ArrayBuffer=="function",hq=(t,e)=>{if(typeof t!="string")return{type:"message",data:pq(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:kne(t.substring(1),e)}:zg[n]?t.length>1?{type:zg[n],data:t.substring(1)}:{type:zg[n]}:Qne},kne=(t,e)=>{if(Pne){const n=xne(t);return pq(n,e)}else return{base64:!0,data:t}},pq=(t,e)=>{switch(e){case"blob":return t instanceof ArrayBuffer?new Blob([t]):t;case"arraybuffer":default:return t}},mq=String.fromCharCode(30),Tne=(t,e)=>{const n=t.length,i=new Array(n);let r=0;t.forEach((o,s)=>{dq(o,!1,a=>{i[s]=a,++r===n&&e(i.join(mq))})})},_ne=(t,e)=>{const n=t.split(mq),i=[];for(let r=0;r<n.length;r++){const o=hq(n[r],e);if(i.push(o),o.type==="error")break}return i},gq=4;function Gi(t){if(t)return Rne(t)}function Rne(t){for(var e in Gi.prototype)t[e]=Gi.prototype[e];return t}Gi.prototype.on=Gi.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};Gi.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this};Gi.prototype.off=Gi.prototype.removeListener=Gi.prototype.removeAllListeners=Gi.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 i,r=0;r<n.length;r++)if(i=n[r],i===e||i.fn===e){n.splice(r,1);break}return n.length===0&&delete this._callbacks["$"+t],this};Gi.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),n=this._callbacks["$"+t],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(n){n=n.slice(0);for(var i=0,r=n.length;i<r;++i)n[i].apply(this,e)}return this};Gi.prototype.emitReserved=Gi.prototype.emit;Gi.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};Gi.prototype.hasListeners=function(t){return!!this.listeners(t).length};const sc=(()=>typeof self!="undefined"?self:typeof window!="undefined"?window:Function("return this")())();function yq(t,...e){return e.reduce((n,i)=>(t.hasOwnProperty(i)&&(n[i]=t[i]),n),{})}const Cne=setTimeout,Xne=clearTimeout;function u1(t,e){e.useNativeTimers?(t.setTimeoutFn=Cne.bind(sc),t.clearTimeoutFn=Xne.bind(sc)):(t.setTimeoutFn=setTimeout.bind(sc),t.clearTimeoutFn=clearTimeout.bind(sc))}const Wne=1.33;function zne(t){return typeof t=="string"?Ene(t):Math.ceil((t.byteLength||t.size)*Wne)}function Ene(t){let e=0,n=0;for(let i=0,r=t.length;i<r;i++)e=t.charCodeAt(i),e<128?n+=1:e<2048?n+=2:e<55296||e>=57344?n+=3:(i++,n+=4);return n}class qne extends Error{constructor(e,n,i){super(e),this.description=n,this.context=i,this.type="TransportError"}}class vq extends Gi{constructor(e){super(),this.writable=!1,u1(this,e),this.opts=e,this.query=e.query,this.readyState="",this.socket=e.socket}onError(e,n,i){return super.emitReserved("error",new qne(e,n,i)),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=hq(e,this.socket.binaryType);this.onPacket(n)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}}const bq="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),W$=64,Une={};let mC=0,Um=0,gC;function yC(t){let e="";do e=bq[t%W$]+e,t=Math.floor(t/W$);while(t>0);return e}function Qq(){const t=yC(+new Date);return t!==gC?(mC=0,gC=t):t+"."+yC(mC++)}for(;Um<W$;Um++)Une[bq[Um]]=Um;function Sq(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function Ane(t){let e={},n=t.split("&");for(let i=0,r=n.length;i<r;i++){let o=n[i].split("=");e[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return e}let $q=!1;try{$q=typeof XMLHttpRequest!="undefined"&&"withCredentials"in new XMLHttpRequest}catch{}const Ine=$q;function wq(t){const e=t.xdomain;try{if(typeof XMLHttpRequest!="undefined"&&(!e||Ine))return new XMLHttpRequest}catch{}if(!e)try{return new sc[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function Lne(){}const Yne=function(){return new wq({xdomain:!1}).responseType!=null}();class Zne extends vq{constructor(e){if(super(e),this.polling=!1,typeof location!="undefined"){const i=location.protocol==="https:";let r=location.port;r||(r=i?"443":"80"),this.xd=typeof location!="undefined"&&e.hostname!==location.hostname||r!==e.port,this.xs=e.secure!==i}const n=e&&e.forceBase64;this.supportsBinary=Yne&&!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 i=0;this.polling&&(i++,this.once("pollComplete",function(){--i||n()})),this.writable||(i++,this.once("drain",function(){--i||n()}))}else n()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const n=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};_ne(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,Tne(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.query||{};const n=this.opts.secure?"https":"http";let i="";this.opts.timestampRequests!==!1&&(e[this.opts.timestampParam]=Qq()),!this.supportsBinary&&!e.sid&&(e.b64=1),this.opts.port&&(n==="https"&&Number(this.opts.port)!==443||n==="http"&&Number(this.opts.port)!==80)&&(i=":"+this.opts.port);const r=Sq(e),o=this.opts.hostname.indexOf(":")!==-1;return n+"://"+(o?"["+this.opts.hostname+"]":this.opts.hostname)+i+this.opts.path+(r.length?"?"+r:"")}request(e={}){return Object.assign(e,{xd:this.xd,xs:this.xs},this.opts),new Ea(this.uri(),e)}doWrite(e,n){const i=this.request({method:"POST",data:e});i.on("success",n),i.on("error",(r,o)=>{this.onError("xhr post error",r,o)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,i)=>{this.onError("xhr poll error",n,i)}),this.pollXhr=e}}class Ea extends Gi{constructor(e,n){super(),u1(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=yq(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 wq(e);try{n.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let i in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(i)&&n.setRequestHeader(i,this.opts.extraHeaders[i])}}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(i){this.setTimeoutFn(()=>{this.onError(i)},0);return}typeof document!="undefined"&&(this.index=Ea.requestsCount++,Ea.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=Lne,e)try{this.xhr.abort()}catch{}typeof document!="undefined"&&delete Ea.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()}}Ea.requestsCount=0;Ea.requests={};if(typeof document!="undefined"){if(typeof attachEvent=="function")attachEvent("onunload",vC);else if(typeof addEventListener=="function"){const t="onpagehide"in sc?"pagehide":"unload";addEventListener(t,vC,!1)}}function vC(){for(let t in Ea.requests)Ea.requests.hasOwnProperty(t)&&Ea.requests[t].abort()}const jne=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,n)=>n(e,0))(),Am=sc.WebSocket||sc.MozWebSocket,bC=!0,Dne="arraybuffer",QC=typeof navigator!="undefined"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Mne extends vq{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,i=QC?{}:yq(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=bC&&!QC?n?new Am(e,n):new Am(e):new Am(e,n,i)}catch(r){return this.emitReserved("error",r)}this.ws.binaryType=this.socket.binaryType||Dne,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 i=e[n],r=n===e.length-1;dq(i,this.supportsBinary,o=>{const s={};try{bC&&this.ws.send(o)}catch{}r&&jne(()=>{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 i="";this.opts.port&&(n==="wss"&&Number(this.opts.port)!==443||n==="ws"&&Number(this.opts.port)!==80)&&(i=":"+this.opts.port),this.opts.timestampRequests&&(e[this.opts.timestampParam]=Qq()),this.supportsBinary||(e.b64=1);const r=Sq(e),o=this.opts.hostname.indexOf(":")!==-1;return n+"://"+(o?"["+this.opts.hostname+"]":this.opts.hostname)+i+this.opts.path+(r.length?"?"+r:"")}check(){return!!Am}}const Vne={websocket:Mne,polling:Zne},Nne=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Bne=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function z$(t){const e=t,n=t.indexOf("["),i=t.indexOf("]");n!=-1&&i!=-1&&(t=t.substring(0,n)+t.substring(n,i).replace(/:/g,";")+t.substring(i,t.length));let r=Nne.exec(t||""),o={},s=14;for(;s--;)o[Bne[s]]=r[s]||"";return n!=-1&&i!=-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=Gne(o,o.path),o.queryKey=Fne(o,o.query),o}function Gne(t,e){const n=/\/{2,9}/g,i=e.replace(n,"/").split("/");return(e.substr(0,1)=="/"||e.length===0)&&i.splice(0,1),e.substr(e.length-1,1)=="/"&&i.splice(i.length-1,1),i}function Fne(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,r,o){r&&(n[r]=o)}),n}class nc extends Gi{constructor(e,n={}){super(),e&&typeof e=="object"&&(n=e,e=null),e?(e=z$(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=z$(n.host).host),u1(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=Ane(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=gq,n.transport=e,this.id&&(n.sid=this.id);const i=Object.assign({},this.opts.transportOptions[e],this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new Vne[e](i)}open(){let e;if(this.opts.rememberUpgrade&&nc.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),i=!1;nc.priorWebsocketSuccess=!1;const r=()=>{i||(n.send([{type:"ping",data:"probe"}]),n.once("packet",f=>{if(!i)if(f.type==="pong"&&f.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;nc.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{i||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(){i||(i=!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",r),n.removeListener("error",s),n.removeListener("close",a),this.off("close",l),this.off("upgrading",c)};n.once("open",r),n.once("error",s),n.once("close",a),this.once("close",l),this.once("upgrading",c),n.open()}onOpen(){if(this.readyState="open",nc.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 i=0;i<this.writeBuffer.length;i++){const r=this.writeBuffer[i].data;if(r&&(n+=zne(r)),i>0&&n>this.maxPayload)return this.writeBuffer.slice(0,i);n+=2}return this.writeBuffer}write(e,n,i){return this.sendPacket("message",e,n,i),this}send(e,n,i){return this.sendPacket("message",e,n,i),this}sendPacket(e,n,i,r){if(typeof n=="function"&&(r=n,n=void 0),typeof i=="function"&&(r=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;const o={type:e,data:n,options:i};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),e()},i=()=>{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?i():e()}):this.upgrading?i():e()),this}onError(e){nc.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 i=0;const r=e.length;for(;i<r;i++)~this.transports.indexOf(e[i])&&n.push(e[i]);return n}}nc.protocol=gq;function Hne(t,e="",n){let i=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),i=z$(t)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";const o=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+o+":"+i.port+e,i.href=i.protocol+"://"+o+(n&&n.port===i.port?"":":"+i.port),i}const Kne=typeof ArrayBuffer=="function",Jne=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,xq=Object.prototype.toString,eie=typeof Blob=="function"||typeof Blob!="undefined"&&xq.call(Blob)==="[object BlobConstructor]",tie=typeof File=="function"||typeof File!="undefined"&&xq.call(File)==="[object FileConstructor]";function Rk(t){return Kne&&(t instanceof ArrayBuffer||Jne(t))||eie&&t instanceof Blob||tie&&t instanceof File}function Eg(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,i=t.length;n<i;n++)if(Eg(t[n]))return!0;return!1}if(Rk(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return Eg(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&Eg(t[n]))return!0;return!1}function nie(t){const e=[],n=t.data,i=t;return i.data=E$(n,e),i.attachments=e.length,{packet:i,buffers:e}}function E$(t,e){if(!t)return t;if(Rk(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 i=0;i<t.length;i++)n[i]=E$(t[i],e);return n}else if(typeof t=="object"&&!(t instanceof Date)){const n={};for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=E$(t[i],e));return n}return t}function iie(t,e){return t.data=q$(t.data,e),t.attachments=void 0,t}function q$(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]=q$(t[n],e);else if(typeof t=="object")for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=q$(t[n],e));return t}const rie=5;var tn;(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"})(tn||(tn={}));class oie{constructor(e){this.replacer=e}encode(e){return(e.type===tn.EVENT||e.type===tn.ACK)&&Eg(e)?(e.type=e.type===tn.EVENT?tn.BINARY_EVENT:tn.BINARY_ACK,this.encodeAsBinary(e)):[this.encodeAsString(e)]}encodeAsString(e){let n=""+e.type;return(e.type===tn.BINARY_EVENT||e.type===tn.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=nie(e),i=this.encodeAsString(n.packet),r=n.buffers;return r.unshift(i),r}}class Ck extends Gi{constructor(e){super(),this.reviver=e}add(e){let n;if(typeof e=="string")n=this.decodeString(e),n.type===tn.BINARY_EVENT||n.type===tn.BINARY_ACK?(this.reconstructor=new sie(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n);else if(Rk(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 i={type:Number(e.charAt(0))};if(tn[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===tn.BINARY_EVENT||i.type===tn.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");i.attachments=Number(s)}if(e.charAt(n+1)==="/"){const o=n+1;for(;++n&&!(e.charAt(n)===","||n===e.length););i.nsp=e.substring(o,n)}else i.nsp="/";const r=e.charAt(n+1);if(r!==""&&Number(r)==r){const o=n+1;for(;++n;){const s=e.charAt(n);if(s==null||Number(s)!=s){--n;break}if(n===e.length)break}i.id=Number(e.substring(o,n+1))}if(e.charAt(++n)){const o=this.tryParse(e.substr(n));if(Ck.isPayloadValid(i.type,o))i.data=o;else throw new Error("invalid payload")}return i}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,n){switch(e){case tn.CONNECT:return typeof n=="object";case tn.DISCONNECT:return n===void 0;case tn.CONNECT_ERROR:return typeof n=="string"||typeof n=="object";case tn.EVENT:case tn.BINARY_EVENT:return Array.isArray(n)&&n.length>0;case tn.ACK:case tn.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&this.reconstructor.finishedReconstruction()}}class sie{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=iie(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var aie=Object.freeze(Object.defineProperty({__proto__:null,protocol:rie,get PacketType(){return tn},Encoder:oie,Decoder:Ck},Symbol.toStringTag,{value:"Module"}));function sa(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const lie=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Pq extends Gi{constructor(e,n,i){super(),this.connected=!1,this.receiveBuffer=[],this.sendBuffer=[],this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=n,i&&i.auth&&(this.auth=i.auth),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[sa(e,"open",this.onopen.bind(this)),sa(e,"packet",this.onpacket.bind(this)),sa(e,"error",this.onerror.bind(this)),sa(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(lie.hasOwnProperty(e))throw new Error('"'+e+'" is a reserved event name');n.unshift(e);const i={type:tn.EVENT,data:n};if(i.options={},i.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const s=this.ids++,a=n.pop();this._registerAckCallback(s,a),i.id=s}const r=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!r||!this.connected)||(this.connected?(this.notifyOutgoingListeners(i),this.packet(i)):this.sendBuffer.push(i)),this.flags={},this}_registerAckCallback(e,n){const i=this.flags.timeout;if(i===void 0){this.acks[e]=n;return}const r=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"))},i);this.acks[e]=(...o)=>{this.io.clearTimeoutFn(r),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:tn.CONNECT,data:e})}):this.packet({type:tn.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 tn.CONNECT:if(e.data&&e.data.sid){const r=e.data.sid;this.onconnect(r)}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 tn.EVENT:case tn.BINARY_EVENT:this.onevent(e);break;case tn.ACK:case tn.BINARY_ACK:this.onack(e);break;case tn.DISCONNECT:this.ondisconnect();break;case tn.CONNECT_ERROR:this.destroy();const i=new Error(e.data.message);i.data=e.data.data,this.emitReserved("connect_error",i);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 i of n)i.apply(this,e)}super.emit.apply(this,e)}ack(e){const n=this;let i=!1;return function(...r){i||(i=!0,n.packet({type:tn.ACK,id:e,data:r}))}}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:tn.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 i=0;i<n.length;i++)if(e===n[i])return n.splice(i,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 i=0;i<n.length;i++)if(e===n[i])return n.splice(i,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 i of n)i.apply(this,e.data)}}}function Ef(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}Ef.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};Ef.prototype.reset=function(){this.attempts=0};Ef.prototype.setMin=function(t){this.ms=t};Ef.prototype.setMax=function(t){this.max=t};Ef.prototype.setJitter=function(t){this.jitter=t};class U$ extends Gi{constructor(e,n){var i;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,u1(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((i=n.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new Ef({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=e;const r=n.parser||aie;this.encoder=new r.Encoder,this.decoder=new r.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 nc(this.uri,this.opts);const n=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;const r=sa(n,"open",function(){i.onopen(),e&&e()}),o=sa(n,"error",s=>{i.cleanup(),i._readyState="closed",this.emitReserved("error",s),e?e(s):i.maybeReconnectOnOpen()});if(this._timeout!==!1){const s=this._timeout;s===0&&r();const a=this.setTimeoutFn(()=>{r(),n.close(),n.emit("error",new Error("timeout"))},s);this.opts.autoUnref&&a.unref(),this.subs.push(function(){clearTimeout(a)})}return this.subs.push(r),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(sa(e,"ping",this.onping.bind(this)),sa(e,"data",this.ondata.bind(this)),sa(e,"error",this.onerror.bind(this)),sa(e,"close",this.onclose.bind(this)),sa(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 i=this.nsps[e];return i||(i=new Pq(this,e,n),this.nsps[e]=i),i}_destroy(e){const n=Object.keys(this.nsps);for(const i of n)if(this.nsps[i].active)return;this._close()}_packet(e){const n=this.encoder.encode(e);for(let i=0;i<n.length;i++)this.engine.write(n[i],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 i=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(r=>{r?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",r)):e.onreconnect()}))},n);this.opts.autoUnref&&i.unref(),this.subs.push(function(){clearTimeout(i)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const md={};function qg(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=Hne(t,e.path||"/socket.io"),i=n.source,r=n.id,o=n.path,s=md[r]&&o in md[r].nsps,a=e.forceNew||e["force new connection"]||e.multiplex===!1||s;let l;return a?l=new U$(i,e):(md[r]||(md[r]=new U$(i,e)),l=md[r]),n.query&&!e.query&&(e.query=n.queryKey),l.socket(n.path,e)}Object.assign(qg,{Manager:U$,Socket:Pq,io:qg,connect:qg});var gn=(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.UserEnter="userEnter",t.UserLeave="userLeave",t.UsersUpdated="usersUpdated",t.ConnectionBroken="connectionBroken",t.ConnectionFailed="connectionFailed",t.AuthorizationFailed="authorizationFailed",t.FileStructureDamaged="fileStructureDamaged",t.ErrorFromServer="errorFromServer",t))(gn||{}),Mo=(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.EditFile="editFile",t.FileTree="fileTree",t.Terminal="terminal",t.Cursor="cursor",t.GetPlaybackInfo="getPlaybackInfo",t.LoadPlaybackData="loadPlaybackData",t.FollowingAgentUser="followingAgentUser",t.UnFollowingAgentUser="unFollowingAgentUser",t.FollowingFocusComponent="followingFocusComponent",t.FollowingEditorScroll="followingEditorScroll",t))(Mo||{}),xt=(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.Editor="editor",t.KeyEvent="keyEvent",t.CloseFile="closeFile",t.FocusComponent="FocusComponent",t.InvisibleComponentActive="InvisibleComponentActive",t))(xt||{}),kq=(t=>(t.notSupport="\u4E0D\u652F\u6301",t.loading="\u542F\u52A8\u4E2D",t.running="\u8FD0\u884C\u4E2D",t.shutdown="\u5DF2\u505C\u6B62",t.lspReady="lspReady",t))(kq||{});class cie{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=i=>this.receive(i),this._messages=[],this._timeout=n}setFilter(e){this._filter=e}send(e,n){const i=new uie(n||this._timeout),r=new Promise((o,s)=>{i._reject=s,i._resolve=o});return this._messages.push(i),this.channel.postMessage({id:this._messageId++,type:"request",payload:e}),r}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 uie{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 Tq,Im;async function Oie(t){Im||(Im=new cie("dao-paas",500));let e="";Im.setFilter(r=>r.id===e);const n=JSON.parse(localStorage.getItem(`agentUsers_${t}`)||"[]")||[],i=[];for(const r of n){const o=Im.send(r).then(()=>{if(e==="")return r.time=new Date().getTime(),e=r.id,localStorage.setItem(`agentUsers_${t}`,JSON.stringify(n)),Promise.resolve(e)});i.push(o)}return Promise.any(i)}function fie(t,e){const n=JSON.parse(localStorage.getItem(`agentUsers_${e}`)||"[]")||[],i=n.find(r=>r.id==t);i?i.time=new Date().getTime():n.push({id:t,time:new Date().getTime()}),localStorage.setItem(`agentUsers_${e}`,JSON.stringify(n)),Tq=t}function die(t){return t===Tq}const _q="daoLogger",hie=typeof module=="object"&&typeof module.exports=="object",oQ=hie?global:window,Rq=oQ&&oQ.localStorage?oQ.localStorage:{store:{},getItem(t){return this.store[t]},setItem(t,e){this.store[t]=e}},yn=new Proxy(console,{get(t,e){return Rq.getItem(_q)?t[e]:()=>{}}}),pie=()=>{Rq.setItem(_q,"*")},mie=[1,2,3,5,8,16];class gie{constructor(e,n,i,r,o,s){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",0);St(this,"preFireTreeIndex",-1);St(this,"eventDispatcher");St(this,"getPlaybackSnapshot");St(this,"progressDispatcher");this.start=e,this.end=n,this.rate=1,this.totalTime=n-e,this.eventDispatcher=r,this.progressDispatcher=o,this.getPlaybackSnapshot=s,this.step=this.step.bind(this)}convertToAbsoluteTime(e){return this.start+e}setRate(e){e&&!mie.includes(e)&&this.progressDispatcher&&this.progressDispatcher("error",`Invalid parameter: rate=${e}`),this.rate=e||this.rate}buffer(e){this.dataBuffer=this.dataBuffer.concat(e),this.firstFrameTime=this.dataBuffer[0].timestamp}pause(){if(!this.playing){yn.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,window.requestAnimationFrame(this.step)}restart(){this.preFrameTime=Date.now(),this.resumeTime=0,this.playing=!0,this.preFireTreeIndex=-1,ut.file.reset(),this.index=0,window.requestAnimationFrame(this.step)}movePosition(e){var n;!((n=this.dataBuffer)!=null&&n.length)||(this.resumeTime=e,this.playing=!0,this.isReplay=!0,this.index=this.findFrameByTimeStamp(),this.isMovePosition=!0,this.preTerminalIndex=0,ut.dao.resetTerminal(),ut.dao.resetConsole(),window.requestAnimationFrame(this.step))}findFrameByTimeStamp(){const e=this.resumeTime+this.firstFrameTime,n=this.dataBuffer,i=n.length,r=(a,l)=>{var c,u,f,h;if(a<=l){const d=Math.floor((l-a)/2+a),y=n[d].timestamp;return y===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<y?l=d-1:e>y&&(a=d+1),r(a,l))}else return yn.warn("Do not find the next frame"),this.index=0,this.resumeTime=0,this.resume(),this.index},o=0,s=i-1;return r(o,s)}step(){var n,i;if(!this.playing)return;if(this.isReplay&&(this.isReplay=!1,this.preFrameTime=Date.now()),this.resumeTime=this.resumeTime+(Date.now()-this.preFrameTime)*this.rate,this.resumeTime>=this.totalTime&&this.index>this.dataBuffer.length-1){(n=this.progressDispatcher)==null||n.call(this,"complete",this.resumeTime);return}let e=this.dataBuffer[this.index];if(!!e){if(this.firstFrameTime+this.resumeTime>(e==null?void 0:e.timestamp)){if(this.isTerminal(e.eventName)){this.trigger(e.eventName,e),this.progressDispatcher&&this.progressDispatcher("progress",this.resumeTime),this.preFrameTime=Date.now(),window.requestAnimationFrame(this.step);return}let o=0;const s=this.firstFrameTime+this.resumeTime;for(let a=this.index+1;a<this.dataBuffer.length&&this.dataBuffer[a].timestamp<=s;a++)o++,this.index=a;o>0&&(e=this.dataBuffer[this.index],this.isMovePosition=!0),this.isMovePosition?(this.setSnapshotByIndex(this.index),this.isMovePosition=!1):(e=((i=this.getPlaybackSnapshot)==null?void 0:i.call(this,e.eventName,e,this.getPreFrameByFrame(e,this.index)))||e,this.setPreFrameData(e,this.index)),this.trigger(e.eventName,e)}else this.isMovePosition&&(this.triggerPreFrames(),this.isMovePosition=!1);this.progressDispatcher&&this.progressDispatcher("progress",this.resumeTime),this.preFrameTime=Date.now(),window.requestAnimationFrame(this.step)}}getPreFrameByFrame(e,n){const{eventName:i}=e,r=this.isEditor(i),o=this.isFileTree(i);let s;if(r){const{data:{openedPath:a}}=e;for(let l=n-1;l>=0;l--){const c=this.dataBuffer[l];if(c.eventName===i&&c.data.openedPath===a){s=this.dataBuffer[l],!s.snapshot&&l>=0&&this.setSnapshotByIndex(l);break}}}return o&&(s=this.dataBuffer[this.preFireTreeIndex]),s}setPreFrameData(e,n){const{eventName:i}=e;this.isFileTree(i)&&(this.preFireTreeIndex=n)}isEditor(e){return e===xt.Editor}isFileTree(e){return e===xt.FileTree}isTerminal(e){return[xt.Terminal.toString(),xt.Console.toString()].includes(e)}setSnapshotByIndex(e){var o;const n=this.dataBuffer[e],{eventName:i}=n,r=this.isEditor(i);for(let s=0;s<=e;s++){let a=this.dataBuffer[s];if(a.eventName===n.eventName&&(r?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=[xt.FileTree.toString(),xt.Editor.toString(),xt.Terminal.toString(),xt.Console.toString()];for(let n=this.index;n>=0;n--){if(!e.length)return;if(e.includes(this.dataBuffer[n].eventName)){const i=this.dataBuffer[n],r=e.findIndex(o=>o===i.eventName);e.splice(r,1),i.snapshot||this.setSnapshotByIndex(n),this.trigger(i.eventName,i)}}e.forEach(n=>{this.trigger(n,null)})}trigger(e,n){if(!this.isTerminal(e)){this.eventDispatcher(e,n),this.index++;return}for(let r=this.preTerminalIndex+1;r<=this.index;r++)this.isTerminal(this.dataBuffer[r].eventName)&&this.eventDispatcher(this.dataBuffer[r].eventName,this.dataBuffer[r]);this.preTerminalIndex=this.index,this.index++}}const yie="@dao42/d42paas-front",vie="0.9.39",bie="d42paas front",Qie="dao42 paas team",Sie="https://github.com/dao42/d42paas_frontend#readme",$ie="UNLICENSED",wie="./dist/DaoPaaS.cjs",xie="./dist/DaoPaaS.cjs",Pie="./dist/DaoPaaS.d.ts",kie={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"},Tie={"@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.0.0","@codemirror/legacy-modes":"^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","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",prettier:"^2.3.2","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-markdown":"^8.0.0","react-transition-group":"^4.4.2","reconnecting-websocket":"^4.4.0","rehype-katex":"^6.0.2","remark-math":"^5.1.1",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","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"},_ie=["dist"],Rie={type:"git",url:"git+https://github.com/dao42/d42paas_frontend.git"},Cie={url:"https://github.com/dao42/d42paas_frontend/issues"},Xie={workerDirectory:"src"},Wie={"lodash.clonedeep":"^4.5.0","lodash.isequal":"^4.5.0"};var zie={name:yie,version:vie,description:bie,author:Qie,homepage:Sie,license:$ie,main:wie,module:xie,types:Pie,scripts:kie,devDependencies:Tie,files:_ie,repository:Rie,bugs:Cie,msw:Xie,dependencies:Wie};const Eie=()=>zie.version,qie=async(t,e,n)=>{const r=await(await fetch(t+"/api/v1/jssdk/ticket",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ticket:e,packageVersion:n})})).json();if(r.status==="failure")throw yn.error(r),new Error(r.errors[0].erromsg);return r.data},vi=(t,e=1)=>{let n=t.replace("#","");n.length===3&&(n=`${n[0]}${n[0]}${n[1]}${n[1]}${n[2]}${n[2]}`);const i=parseInt(n.substring(0,2),16),r=parseInt(n.substring(2,4),16),o=parseInt(n.substring(4,6),16);return e>1&&e<=100&&(e=e/100),`rgba(${i},${r},${o},${e})`},Uie=()=>{const t=`
|
|
48
|
+
*/var r1=F.exports,PF=B3.exports;function kF(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var TF=typeof Object.is=="function"?Object.is:kF,_F=PF.useSyncExternalStore,RF=r1.useRef,CF=r1.useEffect,XF=r1.useMemo,WF=r1.useDebugValue;N3.useSyncExternalStoreWithSelector=function(t,e,n,i,r){var o=RF(null);if(o.current===null){var s={hasValue:!1,value:null};o.current=s}else s=o.current;o=XF(function(){function l(d){if(!c){if(c=!0,u=d,d=i(d),r!==void 0&&s.hasValue){var y=s.value;if(r(y,d))return f=y}return f=d}if(y=f,TF(u,d))return y;var $=i(d);return r!==void 0&&r(y,$)?y:(u=d,f=$)}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,i,r]);var a=_F(t,o[0],o[1]);return CF(function(){s.hasValue=!0,s.value=a},[a]),WF(a),a};V3.exports=N3;function zF(t,e=t.getState,n){const i=V3.exports.useSyncExternalStoreWithSelector(t.subscribe,t.getState,t.getServerState||t.getState,e,n);return F.exports.useDebugValue(i),i}const ZR=t=>{const e=typeof t=="function"?M3(t):t,n=(i,r)=>zF(e,i,r);return Object.assign(n,e),n},EF=t=>t?ZR(t):ZR;var qF=EF,jR=Object.getOwnPropertySymbols,UF=Object.prototype.hasOwnProperty,AF=Object.prototype.propertyIsEnumerable,IF=(t,e)=>{var n={};for(var i in t)UF.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&jR)for(var i of jR(t))e.indexOf(i)<0&&AF.call(t,i)&&(n[i]=t[i]);return n};const LF=(t,e={})=>(n,i,r)=>{const o=e,{enabled:s,anonymousActionType:a}=o,l=IF(o,["enabled","anonymousActionType"]);let c;try{c=(s!=null?s:({BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0}&&"production")!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!c)return({BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0}&&"production")!=="production"&&s&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),t(n,i,r);const u=c.connect(l);let f=!0;r.setState=(y,$,b)=>{const m=n(y,$);return f&&u.send(b===void 0?{type:a||"anonymous"}:typeof b=="string"?{type:b}:b,i()),m};const h=(...y)=>{const $=f;f=!1,n(...y),f=$},d=t(r.setState,i,r);if(u.init(d),r.dispatchFromDevtools&&typeof r.dispatch=="function"){let y=!1;const $=r.dispatch;r.dispatch=(...b)=>{({BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0}&&"production")!=="production"&&b[0].type==="__setState"&&!y&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),y=!0),$(...b)}}return u.subscribe(y=>{var $;switch(y.type){case"ACTION":if(typeof y.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return nQ(y.payload,b=>{if(b.type==="__setState"){h(b.state);return}!r.dispatchFromDevtools||typeof r.dispatch=="function"&&r.dispatch(b)});case"DISPATCH":switch(y.payload.type){case"RESET":return h(d),u.init(r.getState());case"COMMIT":return u.init(r.getState());case"ROLLBACK":return nQ(y.state,b=>{h(b),u.init(r.getState())});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return nQ(y.state,b=>{h(b)});case"IMPORT_STATE":{const{nextLiftedState:b}=y.payload,m=($=b.computedStates.slice(-1)[0])==null?void 0:$.state;if(!m)return;h(m),u.send(null,b);return}case"PAUSE_RECORDING":return f=!f}return}}),d},YF=LF,nQ=(t,e)=>{let n;try{n=JSON.parse(t)}catch(i){console.error("[zustand devtools middleware] Could not parse the received json",i)}n!==void 0&&e(n)};var ZF=Object.defineProperty,DR=Object.getOwnPropertySymbols,jF=Object.prototype.hasOwnProperty,DF=Object.prototype.propertyIsEnumerable,MR=(t,e,n)=>e in t?ZF(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,sO=(t,e)=>{for(var n in e||(e={}))jF.call(e,n)&&MR(t,n,e[n]);if(DR)for(var n of DR(e))DF.call(e,n)&&MR(t,n,e[n]);return t};const Ry=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(i){return Ry(i)(n)},catch(i){return this}}}catch(n){return{then(i){return this},catch(i){return Ry(i)(n)}}}},MF=(t,e)=>(n,i,r)=>{let o=sO({getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:b=>b,version:0,merge:(b,m)=>sO(sO({},m),b)},e),s=!1;const a=new Set,l=new Set;let c;try{c=o.getStorage()}catch{}if(!c)return t((...b)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),n(...b)},i,r);const u=Ry(o.serialize),f=()=>{const b=o.partialize(sO({},i()));let m;const p=u({state:b,version:o.version}).then(v=>c.setItem(o.name,v)).catch(v=>{m=v});if(m)throw m;return p},h=r.setState;r.setState=(b,m)=>{h(b,m),f()};const d=t((...b)=>{n(...b),f()},i,r);let y;const $=()=>{var b;if(!c)return;s=!1,a.forEach(p=>p(i()));const m=((b=o.onRehydrateStorage)==null?void 0:b.call(o,i()))||void 0;return Ry(c.getItem.bind(c))(o.name).then(p=>{if(p)return o.deserialize(p)}).then(p=>{if(p)if(typeof p.version=="number"&&p.version!==o.version){if(o.migrate)return o.migrate(p.state,p.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return p.state}).then(p=>{var v;return y=o.merge(p,(v=i())!=null?v:d),n(y,!0),f()}).then(()=>{m==null||m(y,void 0),s=!0,l.forEach(p=>p(y))}).catch(p=>{m==null||m(void 0,p)})};return r.persist={setOptions:b=>{o=sO(sO({},o),b),b.getStorage&&(c=b.getStorage())},clearStorage:()=>{c==null||c.removeItem(o.name)},rehydrate:()=>$(),hasHydrated:()=>s,onHydrate:b=>(a.add(b),()=>{a.delete(b)}),onFinishHydration:b=>(l.add(b),()=>{l.delete(b)})},$(),y||d},VF=MF,NF=(t,e)=>{const n={};return Object.keys(t.getState()).forEach(i=>{n[i]=r=>{if(t.getState()[i]===r)return;const s=i.replace(/^\S/,a=>a.toUpperCase());t.setState(a=>{a[i]=r},`@@${e}/set${s}`)}}),n},BF=(t,e)=>{const n=t(e.set,e.get,e);return{...e,set:{...e.set,...n}}},GF=(t,e)=>{const n={...e.use},i={...e.useTracked},r={...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)}),i[o]=(...s)=>{const a=e.useTrackedStore(),c=t(a,e.get,e)[o];return c(...s)},r[o]=(...s)=>{const l=t(e.store.getState(),e.get,e)[o];return l(...s)}}),{...e,get:r,use:n,useTracked:i}},k$=t=>({...t,extendSelectors:e=>k$(GF(e,t)),extendActions:e=>k$(BF(e,t))}),FF=t=>{const e={};return Object.keys(t.getState()).forEach(n=>{e[n]=()=>t.getState()[n]}),e},HF=t=>{const e={};return Object.keys(t.getState()).forEach(n=>{e[n]=i=>t(r=>r[n],i)}),e},KF=(t,e)=>{const n={};return Object.keys(t.getState()).forEach(i=>{n[i]=()=>e()[i]}),n},JF=t=>(e,n,i)=>{const r=(o,s)=>e(uF(o),!0,s);return i.setState=r,t(r,n,i)};function eH(t,...e){return e.reduce((n,i)=>i(n),t)}const Sk=t=>(e,n={})=>{var i;const{middlewares:r=[],devtools:o,persist:s,immer:a}=n;OF((i=a==null?void 0:a.enabledAutoFreeze)!==null&&i!==void 0?i:!1),a!=null&&a.enableMapSet&&rF();const l=[JF,...r];s!=null&&s.enabled&&l.push(S=>VF(S,{...s,name:t})),o!=null&&o.enabled&&l.push(S=>YF(S,{...o,name:t})),l.push(M3);const u=(S=>eH(S,...l))(()=>e),f=qF(u),h=NF(f,t),d=(S,w)=>{u.setState(T=>{Object.assign(T,S)},w||`@@${t}/mergeState`)},y=(S,w)=>{u.setState(S,w||`@@${t}/setState`)},$=HF(f),b=FF(f),m=mF(f),p=KF(f,m),v={get:{state:u.getState,...b},name:t,set:{state:y,mergeState:d,...h},store:u,use:$,useTracked:p,useStore:f,useTrackedStore:m,extendSelectors:()=>v,extendActions:()=>v};return k$(v)};var Em=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function F3(t,e){return e={exports:{}},t(e,e.exports),e.exports}var tH=typeof Em=="object"&&Em&&Em.Object===Object&&Em,H3=tH,nH=typeof self=="object"&&self&&self.Object===Object&&self,iH=H3||nH||Function("return this")(),zl=iH,rH=zl.Symbol,wc=rH,K3=Object.prototype,oH=K3.hasOwnProperty,sH=K3.toString,pd=wc?wc.toStringTag:void 0;function aH(t){var e=oH.call(t,pd),n=t[pd];try{t[pd]=void 0;var i=!0}catch{}var r=sH.call(t);return i&&(e?t[pd]=n:delete t[pd]),r}var lH=aH,cH=Object.prototype,uH=cH.toString;function OH(t){return uH.call(t)}var fH=OH,dH="[object Null]",hH="[object Undefined]",VR=wc?wc.toStringTag:void 0;function pH(t){return t==null?t===void 0?hH:dH:VR&&VR in Object(t)?lH(t):fH(t)}var Rf=pH;function mH(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var $k=mH,gH="[object AsyncFunction]",yH="[object Function]",vH="[object GeneratorFunction]",bH="[object Proxy]";function QH(t){if(!$k(t))return!1;var e=Rf(t);return e==yH||e==vH||e==gH||e==bH}var J3=QH,SH=zl["__core-js_shared__"],iQ=SH,NR=function(){var t=/[^.]+$/.exec(iQ&&iQ.keys&&iQ.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function $H(t){return!!NR&&NR in t}var wH=$H,xH=Function.prototype,PH=xH.toString;function kH(t){if(t!=null){try{return PH.call(t)}catch{}try{return t+""}catch{}}return""}var Iu=kH,TH=/[\\^$.*+?()[\]{}|]/g,_H=/^\[object .+?Constructor\]$/,RH=Function.prototype,CH=Object.prototype,XH=RH.toString,WH=CH.hasOwnProperty,zH=RegExp("^"+XH.call(WH).replace(TH,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function EH(t){if(!$k(t)||wH(t))return!1;var e=J3(t)?zH:_H;return e.test(Iu(t))}var qH=EH;function UH(t,e){return t==null?void 0:t[e]}var AH=UH;function IH(t,e){var n=AH(t,e);return qH(n)?n:void 0}var Lu=IH,LH=function(){try{var t=Lu(Object,"defineProperty");return t({},"",{}),t}catch{}}(),BR=LH;function YH(t,e,n){e=="__proto__"&&BR?BR(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}var ZH=YH;function jH(t){return function(e,n,i){for(var r=-1,o=Object(e),s=i(e),a=s.length;a--;){var l=s[t?a:++r];if(n(o[l],l,o)===!1)break}return e}}var DH=jH,MH=DH(),VH=MH;function NH(t,e){for(var n=-1,i=Array(t);++n<t;)i[n]=e(n);return i}var BH=NH;function GH(t){return t!=null&&typeof t=="object"}var sf=GH,FH="[object Arguments]";function HH(t){return sf(t)&&Rf(t)==FH}var GR=HH,eq=Object.prototype,KH=eq.hasOwnProperty,JH=eq.propertyIsEnumerable,eK=GR(function(){return arguments}())?GR:function(t){return sf(t)&&KH.call(t,"callee")&&!JH.call(t,"callee")},tq=eK,tK=Array.isArray,_l=tK;function nK(){return!1}var iK=nK,T$=F3(function(t,e){var n=e&&!e.nodeType&&e,i=n&&!0&&t&&!t.nodeType&&t,r=i&&i.exports===n,o=r?zl.Buffer:void 0,s=o?o.isBuffer:void 0,a=s||iK;t.exports=a}),rK=9007199254740991,oK=/^(?:0|[1-9]\d*)$/;function sK(t,e){var n=typeof t;return e=e==null?rK:e,!!e&&(n=="number"||n!="symbol"&&oK.test(t))&&t>-1&&t%1==0&&t<e}var nq=sK,aK=9007199254740991;function lK(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=aK}var wk=lK,cK="[object Arguments]",uK="[object Array]",OK="[object Boolean]",fK="[object Date]",dK="[object Error]",hK="[object Function]",pK="[object Map]",mK="[object Number]",gK="[object Object]",yK="[object RegExp]",vK="[object Set]",bK="[object String]",QK="[object WeakMap]",SK="[object ArrayBuffer]",$K="[object DataView]",wK="[object Float32Array]",xK="[object Float64Array]",PK="[object Int8Array]",kK="[object Int16Array]",TK="[object Int32Array]",_K="[object Uint8Array]",RK="[object Uint8ClampedArray]",CK="[object Uint16Array]",XK="[object Uint32Array]",ti={};ti[wK]=ti[xK]=ti[PK]=ti[kK]=ti[TK]=ti[_K]=ti[RK]=ti[CK]=ti[XK]=!0;ti[cK]=ti[uK]=ti[SK]=ti[OK]=ti[$K]=ti[fK]=ti[dK]=ti[hK]=ti[pK]=ti[mK]=ti[gK]=ti[yK]=ti[vK]=ti[bK]=ti[QK]=!1;function WK(t){return sf(t)&&wk(t.length)&&!!ti[Rf(t)]}var zK=WK;function EK(t){return function(e){return t(e)}}var qK=EK,FR=F3(function(t,e){var n=e&&!e.nodeType&&e,i=n&&!0&&t&&!t.nodeType&&t,r=i&&i.exports===n,o=r&&H3.process,s=function(){try{var a=i&&i.require&&i.require("util").types;return a||o&&o.binding&&o.binding("util")}catch{}}();t.exports=s}),HR=FR&&FR.isTypedArray,UK=HR?qK(HR):zK,iq=UK,AK=Object.prototype,IK=AK.hasOwnProperty;function LK(t,e){var n=_l(t),i=!n&&tq(t),r=!n&&!i&&T$(t),o=!n&&!i&&!r&&iq(t),s=n||i||r||o,a=s?BH(t.length,String):[],l=a.length;for(var c in t)(e||IK.call(t,c))&&!(s&&(c=="length"||r&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||nq(c,l)))&&a.push(c);return a}var YK=LK,ZK=Object.prototype;function jK(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||ZK;return t===n}var DK=jK;function MK(t,e){return function(n){return t(e(n))}}var VK=MK,NK=VK(Object.keys,Object),BK=NK,GK=Object.prototype,FK=GK.hasOwnProperty;function HK(t){if(!DK(t))return BK(t);var e=[];for(var n in Object(t))FK.call(t,n)&&n!="constructor"&&e.push(n);return e}var KK=HK;function JK(t){return t!=null&&wk(t.length)&&!J3(t)}var eJ=JK;function tJ(t){return eJ(t)?YK(t):KK(t)}var xk=tJ;function nJ(t,e){return t&&VH(t,e,xk)}var iJ=nJ;function rJ(){this.__data__=[],this.size=0}var oJ=rJ;function sJ(t,e){return t===e||t!==t&&e!==e}var rq=sJ;function aJ(t,e){for(var n=t.length;n--;)if(rq(t[n][0],e))return n;return-1}var o1=aJ,lJ=Array.prototype,cJ=lJ.splice;function uJ(t){var e=this.__data__,n=o1(e,t);if(n<0)return!1;var i=e.length-1;return n==i?e.pop():cJ.call(e,n,1),--this.size,!0}var OJ=uJ;function fJ(t){var e=this.__data__,n=o1(e,t);return n<0?void 0:e[n][1]}var dJ=fJ;function hJ(t){return o1(this.__data__,t)>-1}var pJ=hJ;function mJ(t,e){var n=this.__data__,i=o1(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this}var gJ=mJ;function Cf(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}Cf.prototype.clear=oJ;Cf.prototype.delete=OJ;Cf.prototype.get=dJ;Cf.prototype.has=pJ;Cf.prototype.set=gJ;var s1=Cf;function yJ(){this.__data__=new s1,this.size=0}var vJ=yJ;function bJ(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}var QJ=bJ;function SJ(t){return this.__data__.get(t)}var $J=SJ;function wJ(t){return this.__data__.has(t)}var xJ=wJ,PJ=Lu(zl,"Map"),Uh=PJ,kJ=Lu(Object,"create"),Ah=kJ;function TJ(){this.__data__=Ah?Ah(null):{},this.size=0}var _J=TJ;function RJ(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var CJ=RJ,XJ="__lodash_hash_undefined__",WJ=Object.prototype,zJ=WJ.hasOwnProperty;function EJ(t){var e=this.__data__;if(Ah){var n=e[t];return n===XJ?void 0:n}return zJ.call(e,t)?e[t]:void 0}var qJ=EJ,UJ=Object.prototype,AJ=UJ.hasOwnProperty;function IJ(t){var e=this.__data__;return Ah?e[t]!==void 0:AJ.call(e,t)}var LJ=IJ,YJ="__lodash_hash_undefined__";function ZJ(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Ah&&e===void 0?YJ:e,this}var jJ=ZJ;function Xf(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}Xf.prototype.clear=_J;Xf.prototype.delete=CJ;Xf.prototype.get=qJ;Xf.prototype.has=LJ;Xf.prototype.set=jJ;var KR=Xf;function DJ(){this.size=0,this.__data__={hash:new KR,map:new(Uh||s1),string:new KR}}var MJ=DJ;function VJ(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var NJ=VJ;function BJ(t,e){var n=t.__data__;return NJ(e)?n[typeof e=="string"?"string":"hash"]:n.map}var a1=BJ;function GJ(t){var e=a1(this,t).delete(t);return this.size-=e?1:0,e}var FJ=GJ;function HJ(t){return a1(this,t).get(t)}var KJ=HJ;function JJ(t){return a1(this,t).has(t)}var eee=JJ;function tee(t,e){var n=a1(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this}var nee=tee;function Wf(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}Wf.prototype.clear=MJ;Wf.prototype.delete=FJ;Wf.prototype.get=KJ;Wf.prototype.has=eee;Wf.prototype.set=nee;var l1=Wf,iee=200;function ree(t,e){var n=this.__data__;if(n instanceof s1){var i=n.__data__;if(!Uh||i.length<iee-1)return i.push([t,e]),this.size=++n.size,this;n=this.__data__=new l1(i)}return n.set(t,e),this.size=n.size,this}var oee=ree;function zf(t){var e=this.__data__=new s1(t);this.size=e.size}zf.prototype.clear=vJ;zf.prototype.delete=QJ;zf.prototype.get=$J;zf.prototype.has=xJ;zf.prototype.set=oee;var Wg=zf,see="__lodash_hash_undefined__";function aee(t){return this.__data__.set(t,see),this}var lee=aee;function cee(t){return this.__data__.has(t)}var uee=cee;function Cy(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new l1;++e<n;)this.add(t[e])}Cy.prototype.add=Cy.prototype.push=lee;Cy.prototype.has=uee;var Oee=Cy;function fee(t,e){for(var n=-1,i=t==null?0:t.length;++n<i;)if(e(t[n],n,t))return!0;return!1}var dee=fee;function hee(t,e){return t.has(e)}var pee=hee,mee=1,gee=2;function yee(t,e,n,i,r,o){var s=n&mee,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&gee?new Oee:void 0;for(o.set(t,e),o.set(e,t);++f<a;){var y=t[f],$=e[f];if(i)var b=s?i($,y,f,e,t,o):i(y,$,f,t,e,o);if(b!==void 0){if(b)continue;h=!1;break}if(d){if(!dee(e,function(m,p){if(!pee(d,p)&&(y===m||r(y,m,n,i,o)))return d.push(p)})){h=!1;break}}else if(!(y===$||r(y,$,n,i,o))){h=!1;break}}return o.delete(t),o.delete(e),h}var oq=yee,vee=zl.Uint8Array,JR=vee;function bee(t){var e=-1,n=Array(t.size);return t.forEach(function(i,r){n[++e]=[r,i]}),n}var Qee=bee;function See(t){var e=-1,n=Array(t.size);return t.forEach(function(i){n[++e]=i}),n}var $ee=See,wee=1,xee=2,Pee="[object Boolean]",kee="[object Date]",Tee="[object Error]",_ee="[object Map]",Ree="[object Number]",Cee="[object RegExp]",Xee="[object Set]",Wee="[object String]",zee="[object Symbol]",Eee="[object ArrayBuffer]",qee="[object DataView]",eC=wc?wc.prototype:void 0,rQ=eC?eC.valueOf:void 0;function Uee(t,e,n,i,r,o,s){switch(n){case qee:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Eee:return!(t.byteLength!=e.byteLength||!o(new JR(t),new JR(e)));case Pee:case kee:case Ree:return rq(+t,+e);case Tee:return t.name==e.name&&t.message==e.message;case Cee:case Wee:return t==e+"";case _ee:var a=Qee;case Xee:var l=i&wee;if(a||(a=$ee),t.size!=e.size&&!l)return!1;var c=s.get(t);if(c)return c==e;i|=xee,s.set(t,e);var u=oq(a(t),a(e),i,r,o,s);return s.delete(t),u;case zee:if(rQ)return rQ.call(t)==rQ.call(e)}return!1}var Aee=Uee;function Iee(t,e){for(var n=-1,i=e.length,r=t.length;++n<i;)t[r+n]=e[n];return t}var Lee=Iee;function Yee(t,e,n){var i=e(t);return _l(t)?i:Lee(i,n(t))}var Zee=Yee;function jee(t,e){for(var n=-1,i=t==null?0:t.length,r=0,o=[];++n<i;){var s=t[n];e(s,n,t)&&(o[r++]=s)}return o}var Dee=jee;function Mee(){return[]}var Vee=Mee,Nee=Object.prototype,Bee=Nee.propertyIsEnumerable,tC=Object.getOwnPropertySymbols,Gee=tC?function(t){return t==null?[]:(t=Object(t),Dee(tC(t),function(e){return Bee.call(t,e)}))}:Vee,Fee=Gee;function Hee(t){return Zee(t,xk,Fee)}var nC=Hee,Kee=1,Jee=Object.prototype,ete=Jee.hasOwnProperty;function tte(t,e,n,i,r,o){var s=n&Kee,a=nC(t),l=a.length,c=nC(e),u=c.length;if(l!=u&&!s)return!1;for(var f=l;f--;){var h=a[f];if(!(s?h in e:ete.call(e,h)))return!1}var d=o.get(t),y=o.get(e);if(d&&y)return d==e&&y==t;var $=!0;o.set(t,e),o.set(e,t);for(var b=s;++f<l;){h=a[f];var m=t[h],p=e[h];if(i)var v=s?i(p,m,h,e,t,o):i(m,p,h,t,e,o);if(!(v===void 0?m===p||r(m,p,n,i,o):v)){$=!1;break}b||(b=h=="constructor")}if($&&!b){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)&&($=!1)}return o.delete(t),o.delete(e),$}var nte=tte,ite=Lu(zl,"DataView"),_$=ite,rte=Lu(zl,"Promise"),R$=rte,ote=Lu(zl,"Set"),C$=ote,ste=Lu(zl,"WeakMap"),X$=ste,iC="[object Map]",ate="[object Object]",rC="[object Promise]",oC="[object Set]",sC="[object WeakMap]",aC="[object DataView]",lte=Iu(_$),cte=Iu(Uh),ute=Iu(R$),Ote=Iu(C$),fte=Iu(X$),tu=Rf;(_$&&tu(new _$(new ArrayBuffer(1)))!=aC||Uh&&tu(new Uh)!=iC||R$&&tu(R$.resolve())!=rC||C$&&tu(new C$)!=oC||X$&&tu(new X$)!=sC)&&(tu=function(t){var e=Rf(t),n=e==ate?t.constructor:void 0,i=n?Iu(n):"";if(i)switch(i){case lte:return aC;case cte:return iC;case ute:return rC;case Ote:return oC;case fte:return sC}return e});var lC=tu,dte=1,cC="[object Arguments]",uC="[object Array]",qm="[object Object]",hte=Object.prototype,OC=hte.hasOwnProperty;function pte(t,e,n,i,r,o){var s=_l(t),a=_l(e),l=s?uC:lC(t),c=a?uC:lC(e);l=l==cC?qm:l,c=c==cC?qm:c;var u=l==qm,f=c==qm,h=l==c;if(h&&T$(t)){if(!T$(e))return!1;s=!0,u=!1}if(h&&!u)return o||(o=new Wg),s||iq(t)?oq(t,e,n,i,r,o):Aee(t,e,l,n,i,r,o);if(!(n&dte)){var d=u&&OC.call(t,"__wrapped__"),y=f&&OC.call(e,"__wrapped__");if(d||y){var $=d?t.value():t,b=y?e.value():e;return o||(o=new Wg),r($,b,n,i,o)}}return h?(o||(o=new Wg),nte(t,e,n,i,r,o)):!1}var mte=pte;function sq(t,e,n,i,r){return t===e?!0:t==null||e==null||!sf(t)&&!sf(e)?t!==t&&e!==e:mte(t,e,n,i,sq,r)}var aq=sq,gte=1,yte=2;function vte(t,e,n,i){var r=n.length,o=r,s=!i;if(t==null)return!o;for(t=Object(t);r--;){var a=n[r];if(s&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++r<o;){a=n[r];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 Wg;if(i)var h=i(c,u,l,t,e,f);if(!(h===void 0?aq(u,c,gte|yte,i,f):h))return!1}}return!0}var bte=vte;function Qte(t){return t===t&&!$k(t)}var lq=Qte;function Ste(t){for(var e=xk(t),n=e.length;n--;){var i=e[n],r=t[i];e[n]=[i,r,lq(r)]}return e}var $te=Ste;function wte(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}var cq=wte;function xte(t){var e=$te(t);return e.length==1&&e[0][2]?cq(e[0][0],e[0][1]):function(n){return n===t||bte(n,t,e)}}var Pte=xte,kte="[object Symbol]";function Tte(t){return typeof t=="symbol"||sf(t)&&Rf(t)==kte}var Pk=Tte,_te=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Rte=/^\w*$/;function Cte(t,e){if(_l(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||Pk(t)?!0:Rte.test(t)||!_te.test(t)||e!=null&&t in Object(e)}var kk=Cte,Xte="Expected a function";function Tk(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(Xte);var n=function(){var i=arguments,r=e?e.apply(this,i):i[0],o=n.cache;if(o.has(r))return o.get(r);var s=t.apply(this,i);return n.cache=o.set(r,s)||o,s};return n.cache=new(Tk.Cache||l1),n}Tk.Cache=l1;var Wte=Tk,zte=500;function Ete(t){var e=Wte(t,function(i){return n.size===zte&&n.clear(),i}),n=e.cache;return e}var qte=Ete,Ute=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ate=/\\(\\)?/g,Ite=qte(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Ute,function(n,i,r,o){e.push(r?o.replace(Ate,"$1"):i||n)}),e}),Lte=Ite;function Yte(t,e){for(var n=-1,i=t==null?0:t.length,r=Array(i);++n<i;)r[n]=e(t[n],n,t);return r}var Zte=Yte,jte=1/0,fC=wc?wc.prototype:void 0,dC=fC?fC.toString:void 0;function uq(t){if(typeof t=="string")return t;if(_l(t))return Zte(t,uq)+"";if(Pk(t))return dC?dC.call(t):"";var e=t+"";return e=="0"&&1/t==-jte?"-0":e}var Dte=uq;function Mte(t){return t==null?"":Dte(t)}var Vte=Mte;function Nte(t,e){return _l(t)?t:kk(t,e)?[t]:Lte(Vte(t))}var Oq=Nte,Bte=1/0;function Gte(t){if(typeof t=="string"||Pk(t))return t;var e=t+"";return e=="0"&&1/t==-Bte?"-0":e}var c1=Gte;function Fte(t,e){e=Oq(e,t);for(var n=0,i=e.length;t!=null&&n<i;)t=t[c1(e[n++])];return n&&n==i?t:void 0}var fq=Fte;function Hte(t,e,n){var i=t==null?void 0:fq(t,e);return i===void 0?n:i}var Kte=Hte;function Jte(t,e){return t!=null&&e in Object(t)}var ene=Jte;function tne(t,e,n){e=Oq(e,t);for(var i=-1,r=e.length,o=!1;++i<r;){var s=c1(e[i]);if(!(o=t!=null&&n(t,s)))break;t=t[s]}return o||++i!=r?o:(r=t==null?0:t.length,!!r&&wk(r)&&nq(s,r)&&(_l(t)||tq(t)))}var nne=tne;function ine(t,e){return t!=null&&nne(t,e,ene)}var rne=ine,one=1,sne=2;function ane(t,e){return kk(t)&&lq(e)?cq(c1(t),e):function(n){var i=Kte(n,t);return i===void 0&&i===e?rne(n,t):aq(e,i,one|sne)}}var lne=ane;function cne(t){return t}var une=cne;function One(t){return function(e){return e==null?void 0:e[t]}}var fne=One;function dne(t){return function(e){return fq(e,t)}}var hne=dne;function pne(t){return kk(t)?fne(c1(t)):hne(t)}var mne=pne;function gne(t){return typeof t=="function"?t:t==null?une:typeof t=="object"?_l(t)?lne(t[0],t[1]):Pte(t):mne(t)}var yne=gne;function vne(t,e){var n={};return e=yne(e),iJ(t,function(i,r,o){ZH(n,r,e(i,r,o))}),n}var bne=vne;const _k=(t,e)=>bne(e,n=>n[t]),La=Object.create(null);La.open="0";La.close="1";La.ping="2";La.pong="3";La.message="4";La.upgrade="5";La.noop="6";const zg=Object.create(null);Object.keys(La).forEach(t=>{zg[La[t]]=t});const Qne={type:"error",data:"parser error"},Sne=typeof Blob=="function"||typeof Blob!="undefined"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",$ne=typeof ArrayBuffer=="function",wne=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,dq=({type:t,data:e},n,i)=>Sne&&e instanceof Blob?n?i(e):hC(e,i):$ne&&(e instanceof ArrayBuffer||wne(e))?n?i(e):hC(new Blob([e]),i):i(La[t]+(e||"")),hC=(t,e)=>{const n=new FileReader;return n.onload=function(){const i=n.result.split(",")[1];e("b"+i)},n.readAsDataURL(t)},pC="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ld=typeof Uint8Array=="undefined"?[]:new Uint8Array(256);for(let t=0;t<pC.length;t++)Ld[pC.charCodeAt(t)]=t;const xne=t=>{let e=t.length*.75,n=t.length,i,r=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(i=0;i<n;i+=4)o=Ld[t.charCodeAt(i)],s=Ld[t.charCodeAt(i+1)],a=Ld[t.charCodeAt(i+2)],l=Ld[t.charCodeAt(i+3)],u[r++]=o<<2|s>>4,u[r++]=(s&15)<<4|a>>2,u[r++]=(a&3)<<6|l&63;return c},Pne=typeof ArrayBuffer=="function",hq=(t,e)=>{if(typeof t!="string")return{type:"message",data:pq(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:kne(t.substring(1),e)}:zg[n]?t.length>1?{type:zg[n],data:t.substring(1)}:{type:zg[n]}:Qne},kne=(t,e)=>{if(Pne){const n=xne(t);return pq(n,e)}else return{base64:!0,data:t}},pq=(t,e)=>{switch(e){case"blob":return t instanceof ArrayBuffer?new Blob([t]):t;case"arraybuffer":default:return t}},mq=String.fromCharCode(30),Tne=(t,e)=>{const n=t.length,i=new Array(n);let r=0;t.forEach((o,s)=>{dq(o,!1,a=>{i[s]=a,++r===n&&e(i.join(mq))})})},_ne=(t,e)=>{const n=t.split(mq),i=[];for(let r=0;r<n.length;r++){const o=hq(n[r],e);if(i.push(o),o.type==="error")break}return i},gq=4;function Gi(t){if(t)return Rne(t)}function Rne(t){for(var e in Gi.prototype)t[e]=Gi.prototype[e];return t}Gi.prototype.on=Gi.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};Gi.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this};Gi.prototype.off=Gi.prototype.removeListener=Gi.prototype.removeAllListeners=Gi.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 i,r=0;r<n.length;r++)if(i=n[r],i===e||i.fn===e){n.splice(r,1);break}return n.length===0&&delete this._callbacks["$"+t],this};Gi.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),n=this._callbacks["$"+t],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(n){n=n.slice(0);for(var i=0,r=n.length;i<r;++i)n[i].apply(this,e)}return this};Gi.prototype.emitReserved=Gi.prototype.emit;Gi.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};Gi.prototype.hasListeners=function(t){return!!this.listeners(t).length};const sc=(()=>typeof self!="undefined"?self:typeof window!="undefined"?window:Function("return this")())();function yq(t,...e){return e.reduce((n,i)=>(t.hasOwnProperty(i)&&(n[i]=t[i]),n),{})}const Cne=setTimeout,Xne=clearTimeout;function u1(t,e){e.useNativeTimers?(t.setTimeoutFn=Cne.bind(sc),t.clearTimeoutFn=Xne.bind(sc)):(t.setTimeoutFn=setTimeout.bind(sc),t.clearTimeoutFn=clearTimeout.bind(sc))}const Wne=1.33;function zne(t){return typeof t=="string"?Ene(t):Math.ceil((t.byteLength||t.size)*Wne)}function Ene(t){let e=0,n=0;for(let i=0,r=t.length;i<r;i++)e=t.charCodeAt(i),e<128?n+=1:e<2048?n+=2:e<55296||e>=57344?n+=3:(i++,n+=4);return n}class qne extends Error{constructor(e,n,i){super(e),this.description=n,this.context=i,this.type="TransportError"}}class vq extends Gi{constructor(e){super(),this.writable=!1,u1(this,e),this.opts=e,this.query=e.query,this.readyState="",this.socket=e.socket}onError(e,n,i){return super.emitReserved("error",new qne(e,n,i)),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=hq(e,this.socket.binaryType);this.onPacket(n)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}}const bq="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),W$=64,Une={};let mC=0,Um=0,gC;function yC(t){let e="";do e=bq[t%W$]+e,t=Math.floor(t/W$);while(t>0);return e}function Qq(){const t=yC(+new Date);return t!==gC?(mC=0,gC=t):t+"."+yC(mC++)}for(;Um<W$;Um++)Une[bq[Um]]=Um;function Sq(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function Ane(t){let e={},n=t.split("&");for(let i=0,r=n.length;i<r;i++){let o=n[i].split("=");e[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return e}let $q=!1;try{$q=typeof XMLHttpRequest!="undefined"&&"withCredentials"in new XMLHttpRequest}catch{}const Ine=$q;function wq(t){const e=t.xdomain;try{if(typeof XMLHttpRequest!="undefined"&&(!e||Ine))return new XMLHttpRequest}catch{}if(!e)try{return new sc[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function Lne(){}const Yne=function(){return new wq({xdomain:!1}).responseType!=null}();class Zne extends vq{constructor(e){if(super(e),this.polling=!1,typeof location!="undefined"){const i=location.protocol==="https:";let r=location.port;r||(r=i?"443":"80"),this.xd=typeof location!="undefined"&&e.hostname!==location.hostname||r!==e.port,this.xs=e.secure!==i}const n=e&&e.forceBase64;this.supportsBinary=Yne&&!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 i=0;this.polling&&(i++,this.once("pollComplete",function(){--i||n()})),this.writable||(i++,this.once("drain",function(){--i||n()}))}else n()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const n=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};_ne(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,Tne(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.query||{};const n=this.opts.secure?"https":"http";let i="";this.opts.timestampRequests!==!1&&(e[this.opts.timestampParam]=Qq()),!this.supportsBinary&&!e.sid&&(e.b64=1),this.opts.port&&(n==="https"&&Number(this.opts.port)!==443||n==="http"&&Number(this.opts.port)!==80)&&(i=":"+this.opts.port);const r=Sq(e),o=this.opts.hostname.indexOf(":")!==-1;return n+"://"+(o?"["+this.opts.hostname+"]":this.opts.hostname)+i+this.opts.path+(r.length?"?"+r:"")}request(e={}){return Object.assign(e,{xd:this.xd,xs:this.xs},this.opts),new Ea(this.uri(),e)}doWrite(e,n){const i=this.request({method:"POST",data:e});i.on("success",n),i.on("error",(r,o)=>{this.onError("xhr post error",r,o)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,i)=>{this.onError("xhr poll error",n,i)}),this.pollXhr=e}}class Ea extends Gi{constructor(e,n){super(),u1(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=yq(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 wq(e);try{n.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let i in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(i)&&n.setRequestHeader(i,this.opts.extraHeaders[i])}}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(i){this.setTimeoutFn(()=>{this.onError(i)},0);return}typeof document!="undefined"&&(this.index=Ea.requestsCount++,Ea.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=Lne,e)try{this.xhr.abort()}catch{}typeof document!="undefined"&&delete Ea.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()}}Ea.requestsCount=0;Ea.requests={};if(typeof document!="undefined"){if(typeof attachEvent=="function")attachEvent("onunload",vC);else if(typeof addEventListener=="function"){const t="onpagehide"in sc?"pagehide":"unload";addEventListener(t,vC,!1)}}function vC(){for(let t in Ea.requests)Ea.requests.hasOwnProperty(t)&&Ea.requests[t].abort()}const jne=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,n)=>n(e,0))(),Am=sc.WebSocket||sc.MozWebSocket,bC=!0,Dne="arraybuffer",QC=typeof navigator!="undefined"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Mne extends vq{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,i=QC?{}:yq(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=bC&&!QC?n?new Am(e,n):new Am(e):new Am(e,n,i)}catch(r){return this.emitReserved("error",r)}this.ws.binaryType=this.socket.binaryType||Dne,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 i=e[n],r=n===e.length-1;dq(i,this.supportsBinary,o=>{const s={};try{bC&&this.ws.send(o)}catch{}r&&jne(()=>{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 i="";this.opts.port&&(n==="wss"&&Number(this.opts.port)!==443||n==="ws"&&Number(this.opts.port)!==80)&&(i=":"+this.opts.port),this.opts.timestampRequests&&(e[this.opts.timestampParam]=Qq()),this.supportsBinary||(e.b64=1);const r=Sq(e),o=this.opts.hostname.indexOf(":")!==-1;return n+"://"+(o?"["+this.opts.hostname+"]":this.opts.hostname)+i+this.opts.path+(r.length?"?"+r:"")}check(){return!!Am}}const Vne={websocket:Mne,polling:Zne},Nne=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Bne=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function z$(t){const e=t,n=t.indexOf("["),i=t.indexOf("]");n!=-1&&i!=-1&&(t=t.substring(0,n)+t.substring(n,i).replace(/:/g,";")+t.substring(i,t.length));let r=Nne.exec(t||""),o={},s=14;for(;s--;)o[Bne[s]]=r[s]||"";return n!=-1&&i!=-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=Gne(o,o.path),o.queryKey=Fne(o,o.query),o}function Gne(t,e){const n=/\/{2,9}/g,i=e.replace(n,"/").split("/");return(e.substr(0,1)=="/"||e.length===0)&&i.splice(0,1),e.substr(e.length-1,1)=="/"&&i.splice(i.length-1,1),i}function Fne(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,r,o){r&&(n[r]=o)}),n}class nc extends Gi{constructor(e,n={}){super(),e&&typeof e=="object"&&(n=e,e=null),e?(e=z$(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=z$(n.host).host),u1(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=Ane(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=gq,n.transport=e,this.id&&(n.sid=this.id);const i=Object.assign({},this.opts.transportOptions[e],this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new Vne[e](i)}open(){let e;if(this.opts.rememberUpgrade&&nc.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),i=!1;nc.priorWebsocketSuccess=!1;const r=()=>{i||(n.send([{type:"ping",data:"probe"}]),n.once("packet",f=>{if(!i)if(f.type==="pong"&&f.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;nc.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{i||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(){i||(i=!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",r),n.removeListener("error",s),n.removeListener("close",a),this.off("close",l),this.off("upgrading",c)};n.once("open",r),n.once("error",s),n.once("close",a),this.once("close",l),this.once("upgrading",c),n.open()}onOpen(){if(this.readyState="open",nc.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 i=0;i<this.writeBuffer.length;i++){const r=this.writeBuffer[i].data;if(r&&(n+=zne(r)),i>0&&n>this.maxPayload)return this.writeBuffer.slice(0,i);n+=2}return this.writeBuffer}write(e,n,i){return this.sendPacket("message",e,n,i),this}send(e,n,i){return this.sendPacket("message",e,n,i),this}sendPacket(e,n,i,r){if(typeof n=="function"&&(r=n,n=void 0),typeof i=="function"&&(r=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;const o={type:e,data:n,options:i};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),e()},i=()=>{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?i():e()}):this.upgrading?i():e()),this}onError(e){nc.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 i=0;const r=e.length;for(;i<r;i++)~this.transports.indexOf(e[i])&&n.push(e[i]);return n}}nc.protocol=gq;function Hne(t,e="",n){let i=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),i=z$(t)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";const o=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+o+":"+i.port+e,i.href=i.protocol+"://"+o+(n&&n.port===i.port?"":":"+i.port),i}const Kne=typeof ArrayBuffer=="function",Jne=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,xq=Object.prototype.toString,eie=typeof Blob=="function"||typeof Blob!="undefined"&&xq.call(Blob)==="[object BlobConstructor]",tie=typeof File=="function"||typeof File!="undefined"&&xq.call(File)==="[object FileConstructor]";function Rk(t){return Kne&&(t instanceof ArrayBuffer||Jne(t))||eie&&t instanceof Blob||tie&&t instanceof File}function Eg(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,i=t.length;n<i;n++)if(Eg(t[n]))return!0;return!1}if(Rk(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return Eg(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&Eg(t[n]))return!0;return!1}function nie(t){const e=[],n=t.data,i=t;return i.data=E$(n,e),i.attachments=e.length,{packet:i,buffers:e}}function E$(t,e){if(!t)return t;if(Rk(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 i=0;i<t.length;i++)n[i]=E$(t[i],e);return n}else if(typeof t=="object"&&!(t instanceof Date)){const n={};for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=E$(t[i],e));return n}return t}function iie(t,e){return t.data=q$(t.data,e),t.attachments=void 0,t}function q$(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]=q$(t[n],e);else if(typeof t=="object")for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=q$(t[n],e));return t}const rie=5;var tn;(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"})(tn||(tn={}));class oie{constructor(e){this.replacer=e}encode(e){return(e.type===tn.EVENT||e.type===tn.ACK)&&Eg(e)?(e.type=e.type===tn.EVENT?tn.BINARY_EVENT:tn.BINARY_ACK,this.encodeAsBinary(e)):[this.encodeAsString(e)]}encodeAsString(e){let n=""+e.type;return(e.type===tn.BINARY_EVENT||e.type===tn.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=nie(e),i=this.encodeAsString(n.packet),r=n.buffers;return r.unshift(i),r}}class Ck extends Gi{constructor(e){super(),this.reviver=e}add(e){let n;if(typeof e=="string")n=this.decodeString(e),n.type===tn.BINARY_EVENT||n.type===tn.BINARY_ACK?(this.reconstructor=new sie(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n);else if(Rk(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 i={type:Number(e.charAt(0))};if(tn[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===tn.BINARY_EVENT||i.type===tn.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");i.attachments=Number(s)}if(e.charAt(n+1)==="/"){const o=n+1;for(;++n&&!(e.charAt(n)===","||n===e.length););i.nsp=e.substring(o,n)}else i.nsp="/";const r=e.charAt(n+1);if(r!==""&&Number(r)==r){const o=n+1;for(;++n;){const s=e.charAt(n);if(s==null||Number(s)!=s){--n;break}if(n===e.length)break}i.id=Number(e.substring(o,n+1))}if(e.charAt(++n)){const o=this.tryParse(e.substr(n));if(Ck.isPayloadValid(i.type,o))i.data=o;else throw new Error("invalid payload")}return i}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,n){switch(e){case tn.CONNECT:return typeof n=="object";case tn.DISCONNECT:return n===void 0;case tn.CONNECT_ERROR:return typeof n=="string"||typeof n=="object";case tn.EVENT:case tn.BINARY_EVENT:return Array.isArray(n)&&n.length>0;case tn.ACK:case tn.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&this.reconstructor.finishedReconstruction()}}class sie{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=iie(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var aie=Object.freeze(Object.defineProperty({__proto__:null,protocol:rie,get PacketType(){return tn},Encoder:oie,Decoder:Ck},Symbol.toStringTag,{value:"Module"}));function sa(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const lie=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Pq extends Gi{constructor(e,n,i){super(),this.connected=!1,this.receiveBuffer=[],this.sendBuffer=[],this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=n,i&&i.auth&&(this.auth=i.auth),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[sa(e,"open",this.onopen.bind(this)),sa(e,"packet",this.onpacket.bind(this)),sa(e,"error",this.onerror.bind(this)),sa(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(lie.hasOwnProperty(e))throw new Error('"'+e+'" is a reserved event name');n.unshift(e);const i={type:tn.EVENT,data:n};if(i.options={},i.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const s=this.ids++,a=n.pop();this._registerAckCallback(s,a),i.id=s}const r=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!r||!this.connected)||(this.connected?(this.notifyOutgoingListeners(i),this.packet(i)):this.sendBuffer.push(i)),this.flags={},this}_registerAckCallback(e,n){const i=this.flags.timeout;if(i===void 0){this.acks[e]=n;return}const r=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"))},i);this.acks[e]=(...o)=>{this.io.clearTimeoutFn(r),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:tn.CONNECT,data:e})}):this.packet({type:tn.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 tn.CONNECT:if(e.data&&e.data.sid){const r=e.data.sid;this.onconnect(r)}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 tn.EVENT:case tn.BINARY_EVENT:this.onevent(e);break;case tn.ACK:case tn.BINARY_ACK:this.onack(e);break;case tn.DISCONNECT:this.ondisconnect();break;case tn.CONNECT_ERROR:this.destroy();const i=new Error(e.data.message);i.data=e.data.data,this.emitReserved("connect_error",i);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 i of n)i.apply(this,e)}super.emit.apply(this,e)}ack(e){const n=this;let i=!1;return function(...r){i||(i=!0,n.packet({type:tn.ACK,id:e,data:r}))}}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:tn.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 i=0;i<n.length;i++)if(e===n[i])return n.splice(i,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 i=0;i<n.length;i++)if(e===n[i])return n.splice(i,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 i of n)i.apply(this,e.data)}}}function Ef(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}Ef.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};Ef.prototype.reset=function(){this.attempts=0};Ef.prototype.setMin=function(t){this.ms=t};Ef.prototype.setMax=function(t){this.max=t};Ef.prototype.setJitter=function(t){this.jitter=t};class U$ extends Gi{constructor(e,n){var i;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,u1(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((i=n.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new Ef({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=e;const r=n.parser||aie;this.encoder=new r.Encoder,this.decoder=new r.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 nc(this.uri,this.opts);const n=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;const r=sa(n,"open",function(){i.onopen(),e&&e()}),o=sa(n,"error",s=>{i.cleanup(),i._readyState="closed",this.emitReserved("error",s),e?e(s):i.maybeReconnectOnOpen()});if(this._timeout!==!1){const s=this._timeout;s===0&&r();const a=this.setTimeoutFn(()=>{r(),n.close(),n.emit("error",new Error("timeout"))},s);this.opts.autoUnref&&a.unref(),this.subs.push(function(){clearTimeout(a)})}return this.subs.push(r),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(sa(e,"ping",this.onping.bind(this)),sa(e,"data",this.ondata.bind(this)),sa(e,"error",this.onerror.bind(this)),sa(e,"close",this.onclose.bind(this)),sa(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 i=this.nsps[e];return i||(i=new Pq(this,e,n),this.nsps[e]=i),i}_destroy(e){const n=Object.keys(this.nsps);for(const i of n)if(this.nsps[i].active)return;this._close()}_packet(e){const n=this.encoder.encode(e);for(let i=0;i<n.length;i++)this.engine.write(n[i],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 i=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(r=>{r?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",r)):e.onreconnect()}))},n);this.opts.autoUnref&&i.unref(),this.subs.push(function(){clearTimeout(i)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const md={};function qg(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=Hne(t,e.path||"/socket.io"),i=n.source,r=n.id,o=n.path,s=md[r]&&o in md[r].nsps,a=e.forceNew||e["force new connection"]||e.multiplex===!1||s;let l;return a?l=new U$(i,e):(md[r]||(md[r]=new U$(i,e)),l=md[r]),n.query&&!e.query&&(e.query=n.queryKey),l.socket(n.path,e)}Object.assign(qg,{Manager:U$,Socket:Pq,io:qg,connect:qg});var gn=(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.UserEnter="userEnter",t.UserLeave="userLeave",t.UsersUpdated="usersUpdated",t.ConnectionBroken="connectionBroken",t.ConnectionFailed="connectionFailed",t.AuthorizationFailed="authorizationFailed",t.FileStructureDamaged="fileStructureDamaged",t.ErrorFromServer="errorFromServer",t))(gn||{}),Mo=(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.EditFile="editFile",t.FileTree="fileTree",t.Terminal="terminal",t.Cursor="cursor",t.GetPlaybackInfo="getPlaybackInfo",t.LoadPlaybackData="loadPlaybackData",t.FollowingAgentUser="followingAgentUser",t.UnFollowingAgentUser="unFollowingAgentUser",t.FollowingFocusComponent="followingFocusComponent",t.FollowingEditorScroll="followingEditorScroll",t))(Mo||{}),xt=(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.Editor="editor",t.KeyEvent="keyEvent",t.CloseFile="closeFile",t.FocusComponent="FocusComponent",t.InvisibleComponentActive="InvisibleComponentActive",t))(xt||{}),kq=(t=>(t.notSupport="\u4E0D\u652F\u6301",t.loading="\u542F\u52A8\u4E2D",t.running="\u8FD0\u884C\u4E2D",t.shutdown="\u5DF2\u505C\u6B62",t.lspReady="lspReady",t))(kq||{});class cie{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=i=>this.receive(i),this._messages=[],this._timeout=n}setFilter(e){this._filter=e}send(e,n){const i=new uie(n||this._timeout),r=new Promise((o,s)=>{i._reject=s,i._resolve=o});return this._messages.push(i),this.channel.postMessage({id:this._messageId++,type:"request",payload:e}),r}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 uie{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 Tq,Im;async function Oie(t){Im||(Im=new cie("dao-paas",500));let e="";Im.setFilter(r=>r.id===e);const n=JSON.parse(localStorage.getItem(`agentUsers_${t}`)||"[]")||[],i=[];for(const r of n){const o=Im.send(r).then(()=>{if(e==="")return r.time=new Date().getTime(),e=r.id,localStorage.setItem(`agentUsers_${t}`,JSON.stringify(n)),Promise.resolve(e)});i.push(o)}return Promise.any(i)}function fie(t,e){const n=JSON.parse(localStorage.getItem(`agentUsers_${e}`)||"[]")||[],i=n.find(r=>r.id==t);i?i.time=new Date().getTime():n.push({id:t,time:new Date().getTime()}),localStorage.setItem(`agentUsers_${e}`,JSON.stringify(n)),Tq=t}function die(t){return t===Tq}const _q="daoLogger",hie=typeof module=="object"&&typeof module.exports=="object",oQ=hie?global:window,Rq=oQ&&oQ.localStorage?oQ.localStorage:{store:{},getItem(t){return this.store[t]},setItem(t,e){this.store[t]=e}},yn=new Proxy(console,{get(t,e){return Rq.getItem(_q)?t[e]:()=>{}}}),pie=()=>{Rq.setItem(_q,"*")},mie=[1,2,3,5,8,16];class gie{constructor(e,n,i,r,o,s){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",0);St(this,"preFireTreeIndex",-1);St(this,"eventDispatcher");St(this,"getPlaybackSnapshot");St(this,"progressDispatcher");this.start=e,this.end=n,this.rate=1,this.totalTime=n-e,this.eventDispatcher=r,this.progressDispatcher=o,this.getPlaybackSnapshot=s,this.step=this.step.bind(this)}convertToAbsoluteTime(e){return this.start+e}setRate(e){e&&!mie.includes(e)&&this.progressDispatcher&&this.progressDispatcher("error",`Invalid parameter: rate=${e}`),this.rate=e||this.rate}buffer(e){this.dataBuffer=this.dataBuffer.concat(e),this.firstFrameTime=this.dataBuffer[0].timestamp}pause(){if(!this.playing){yn.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,window.requestAnimationFrame(this.step)}restart(){this.preFrameTime=Date.now(),this.resumeTime=0,this.playing=!0,this.preFireTreeIndex=-1,ut.file.reset(),this.index=0,window.requestAnimationFrame(this.step)}movePosition(e){var n;!((n=this.dataBuffer)!=null&&n.length)||(this.resumeTime=e,this.playing=!0,this.isReplay=!0,this.index=this.findFrameByTimeStamp(),this.isMovePosition=!0,this.preTerminalIndex=0,ut.dao.resetTerminal(),ut.dao.resetConsole(),window.requestAnimationFrame(this.step))}findFrameByTimeStamp(){const e=this.resumeTime+this.firstFrameTime,n=this.dataBuffer,i=n.length,r=(a,l)=>{var c,u,f,h;if(a<=l){const d=Math.floor((l-a)/2+a),y=n[d].timestamp;return y===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<y?l=d-1:e>y&&(a=d+1),r(a,l))}else return yn.warn("Do not find the next frame"),this.index=0,this.resumeTime=0,this.resume(),this.index},o=0,s=i-1;return r(o,s)}step(){var n,i;if(!this.playing)return;if(this.isReplay&&(this.isReplay=!1,this.preFrameTime=Date.now()),this.resumeTime=this.resumeTime+(Date.now()-this.preFrameTime)*this.rate,this.resumeTime>=this.totalTime&&this.index>this.dataBuffer.length-1){(n=this.progressDispatcher)==null||n.call(this,"complete",this.resumeTime);return}let e=this.dataBuffer[this.index];if(!!e){if(this.firstFrameTime+this.resumeTime>(e==null?void 0:e.timestamp)){if(this.isTerminal(e.eventName)){this.trigger(e.eventName,e),this.progressDispatcher&&this.progressDispatcher("progress",this.resumeTime),this.preFrameTime=Date.now(),window.requestAnimationFrame(this.step);return}let o=0;const s=this.firstFrameTime+this.resumeTime;for(let a=this.index+1;a<this.dataBuffer.length&&this.dataBuffer[a].timestamp<=s;a++)o++,this.index=a;o>0&&(e=this.dataBuffer[this.index],this.isMovePosition=!0),this.isMovePosition?(this.setSnapshotByIndex(this.index),this.isMovePosition=!1):(e=((i=this.getPlaybackSnapshot)==null?void 0:i.call(this,e.eventName,e,this.getPreFrameByFrame(e,this.index)))||e,this.setPreFrameData(e,this.index)),this.trigger(e.eventName,e)}else this.isMovePosition&&(this.triggerPreFrames(),this.isMovePosition=!1);this.progressDispatcher&&this.progressDispatcher("progress",this.resumeTime),this.preFrameTime=Date.now(),window.requestAnimationFrame(this.step)}}getPreFrameByFrame(e,n){const{eventName:i}=e,r=this.isEditor(i),o=this.isFileTree(i);let s;if(r){const{data:{openedPath:a}}=e;for(let l=n-1;l>=0;l--){const c=this.dataBuffer[l];if(c.eventName===i&&c.data.openedPath===a){s=this.dataBuffer[l],!s.snapshot&&l>=0&&this.setSnapshotByIndex(l);break}}}return o&&(s=this.dataBuffer[this.preFireTreeIndex]),s}setPreFrameData(e,n){const{eventName:i}=e;this.isFileTree(i)&&(this.preFireTreeIndex=n)}isEditor(e){return e===xt.Editor}isFileTree(e){return e===xt.FileTree}isTerminal(e){return[xt.Terminal.toString(),xt.Console.toString()].includes(e)}setSnapshotByIndex(e){var o;const n=this.dataBuffer[e],{eventName:i}=n,r=this.isEditor(i);for(let s=0;s<=e;s++){let a=this.dataBuffer[s];if(a.eventName===n.eventName&&(r?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=[xt.FileTree.toString(),xt.Editor.toString(),xt.Terminal.toString(),xt.Console.toString()];for(let n=this.index;n>=0;n--){if(!e.length)return;if(e.includes(this.dataBuffer[n].eventName)){const i=this.dataBuffer[n],r=e.findIndex(o=>o===i.eventName);e.splice(r,1),i.snapshot||this.setSnapshotByIndex(n),this.trigger(i.eventName,i)}}e.forEach(n=>{this.trigger(n,null)})}trigger(e,n){if(!this.isTerminal(e)){this.eventDispatcher(e,n),this.index++;return}for(let r=this.preTerminalIndex+1;r<=this.index;r++)this.isTerminal(this.dataBuffer[r].eventName)&&this.eventDispatcher(this.dataBuffer[r].eventName,this.dataBuffer[r]);this.preTerminalIndex=this.index,this.index++}}const yie="@dao42/d42paas-front",vie="0.9.40",bie="d42paas front",Qie="dao42 paas team",Sie="https://github.com/dao42/d42paas_frontend#readme",$ie="UNLICENSED",wie="./dist/DaoPaaS.cjs",xie="./dist/DaoPaaS.cjs",Pie="./dist/DaoPaaS.d.ts",kie={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"},Tie={"@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.0.0","@codemirror/legacy-modes":"^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","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",prettier:"^2.3.2","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-markdown":"^8.0.0","react-transition-group":"^4.4.2","reconnecting-websocket":"^4.4.0","rehype-katex":"^6.0.2","remark-math":"^5.1.1",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","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"},_ie=["dist"],Rie={type:"git",url:"git+https://github.com/dao42/d42paas_frontend.git"},Cie={url:"https://github.com/dao42/d42paas_frontend/issues"},Xie={workerDirectory:"src"},Wie={"lodash.clonedeep":"^4.5.0","lodash.isequal":"^4.5.0"};var zie={name:yie,version:vie,description:bie,author:Qie,homepage:Sie,license:$ie,main:wie,module:xie,types:Pie,scripts:kie,devDependencies:Tie,files:_ie,repository:Rie,bugs:Cie,msw:Xie,dependencies:Wie};const Eie=()=>zie.version,qie=async(t,e,n)=>{const r=await(await fetch(t+"/api/v1/jssdk/ticket",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ticket:e,packageVersion:n})})).json();if(r.status==="failure")throw yn.error(r),new Error(r.errors[0].erromsg);return r.data},vi=(t,e=1)=>{let n=t.replace("#","");n.length===3&&(n=`${n[0]}${n[0]}${n[1]}${n[1]}${n[2]}${n[2]}`);const i=parseInt(n.substring(0,2),16),r=parseInt(n.substring(2,4),16),o=parseInt(n.substring(4,6),16);return e>1&&e<=100&&(e=e/100),`rgba(${i},${r},${o},${e})`},Uie=()=>{const t=`
|
|
49
49
|
@keyframes fadeOut {
|
|
50
50
|
0% {opacity: 1;}
|
|
51
51
|
100% {opacity: 0;}
|
|
@@ -1014,7 +1014,7 @@ and limitations under the License.
|
|
|
1014
1014
|
`,Ife=(t,e)=>{var h,d;const{children:n,meun:i,placement:r="bottom",container:o,onClose:s}=t,[a,l]=F.exports.useState(!1),c=F.exports.useRef(null),u=F.exports.useRef(null);F.exports.useEffect(()=>{window.addEventListener("click",()=>{l(!1)})},[]),F.exports.useImperativeHandle(e,()=>({close:()=>{l(!1)}}));const f=o||document.body;return fe(Afe,{children:Yt("div",{className:"d42-popover-container",children:[fe("div",{ref:c,onClick:y=>{y.preventDefault(),y.stopPropagation(),a&&s&&s(),l(!a)},children:n}),mu.createPortal(fe(ZO,{in:a,classNames:"d42-fade",timeout:200,unmountOnExit:!0,appear:!0,children:fe("div",{className:"d42-mask",onClick:y=>{y.preventDefault(),y.stopPropagation(),l(!1),s&&s()},children:fe("div",{ref:u,className:zr("d42-expaned-wrapper",r),style:{top:`${(((h=c.current)==null?void 0:h.getBoundingClientRect().top)||0)-f.getBoundingClientRect().top+(((d=c.current)==null?void 0:d.getBoundingClientRect().height)||0+10)}px`,right:5},children:i||null})})}),o||document.body)]})})};var RX=ct.forwardRef(Ife);const Lfe=()=>Yt("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",children:[fe("path",{d:"M4.818 4.111l3.181 3.182 3.183-3.182c0.195-0.195 0.512-0.195 0.707 0s0.195 0.512 0 0.707l-3.183 3.181 3.183 3.183c0.195 0.195 0.195 0.512 0 0.707s-0.512 0.195-0.707 0l-3.183-3.183-3.181 3.183c-0.195 0.195-0.512 0.195-0.707 0s-0.195-0.512 0-0.707l3.182-3.183-3.182-3.181c-0.195-0.195-0.195-0.512 0-0.707s0.512-0.195 0.707 0z"}),fe("path",{d:"M12.323 1.268c0.232 0.149 0.299 0.459 0.15 0.691s-0.459 0.299-0.691 0.15c-1.119-0.72-2.421-1.109-3.782-1.109-3.866 0-7 3.134-7 7s3.134 7 7 7c3.866 0 7-3.134 7-7 0-1.090-0.249-2.143-0.721-3.098-0.122-0.248-0.021-0.547 0.227-0.67s0.547-0.021 0.67 0.227c0.54 1.092 0.825 2.297 0.825 3.541 0 4.418-3.582 8-8 8s-8-3.582-8-8c0-4.418 3.582-8 8-8 1.554 0 3.044 0.445 4.323 1.268z"})]}),Yfe=Yu({as:Lfe,ariaLabel:"close outline",category:"action",displayName:"CloseOutline"});function ou({type:t="success",content:e,open:n=!1,time:i=3e3}){const r="d42-message";let o=document.querySelector(".d42-global-message");o||(o=document.createElement("div"),o.className="d42-global-message",document.body.appendChild(o)),setTimeout(()=>{const s=document.querySelector(".d42-global-message");s&&document.body.removeChild(s)},i),mu.render(fe(ZO,{in:n,classNames:"d42-message",timeout:200,unmountOnExit:!0,appear:!0,children:Yt("div",{className:zr(r,`${r}-${t}`),children:[t==="error"&&fe("div",{className:"d42-message-error-icon",children:fe(Yfe,{})}),fe("div",{className:zr(`${r}-text`),children:e})]})}),o)}ou.error=t=>{console.log("conwen",t),ou({open:!0,type:"error",content:t})};const Zfe=()=>fe(Efe,{speed:1,backgroundColor:"#333",foregroundColor:"#444"}),jfe=({onCustomSelect:t,treeItemHeight:e,hideFeature:n,hideEditFeature:i,lockFeature:r,lockEditFeature:o,unittestFeature:s,unittestEditFeature:a,disableFileAction:l={}})=>{const[c,u]=F.exports.useState(),{getOnlineAgentUsersByPath:f,agentUserOpenFile:h}=Lse(),[d,y]=F.exports.useState([]),[$,b]=F.exports.useState(""),[m,p]=F.exports.useState(""),v=F.exports.useRef(null),{fileTreeIgnore:S}=Xt().dao.playgroundInfo(),w=Xt().file.fileTree(),T=Xt().dao.playgroundMode(),R=Xt().dao.channel(),E=Xt().dao.channelAvailable(),[I,X]=F.exports.useState(""),q=F.exports.useRef(null),[W,A]=F.exports.useState("CREATE"),[J,N]=F.exports.useState(!1),[Y,Z]=F.exports.useState({isDir:!1,path:""}),V=F.exports.useRef(null);let K=null;const re=F.exports.useRef(null),[Oe,Te]=F.exports.useState({}),[we,Le]=F.exports.useState({}),[M,pe]=F.exports.useState(!1),[B,ie]=F.exports.useState(""),te=(S==null?void 0:S.split(";"))||[],ze=".",De=F.exports.useRef(null),nt=F.exports.useRef({root:"",path:""}),Zt=F.exports.useRef(0),vt=F.exports.useRef(!1),Tt=Xt().file.selectedFilePath(),Ie=ut.file.setSelectedFilePath,Dt=Xt().file.getOpenedPath(),[,ai]=F.exports.useTransition(),xi=Xt().file.change(),Bn=F.exports.useRef(""),Cn=Xt().file.fileTreeLoading();F.exports.useEffect(()=>{(w||xi)&&(()=>{ai(()=>{const Se=Mm(w);Le(Se),ut.file.setFileTreeChange(!1)})})()},[w,xi]),F.exports.useEffect(()=>{!E||Tt&&Tt!==Bn.current&&(Bn.current=Tt,ut.file.setDocLoading(!0),R.loadFile(Tt))},[R,E,Tt]),F.exports.useEffect(()=>{Tt||(Bn.current="")},[Tt]);const Hi=ce=>{const Se=Pe.dao.currentAgentUser();return(Se==null?void 0:Se.agentUserId)===ce||(Se==null?void 0:Se.followingAgentUserId)===ce},ln=(ce="\u6587\u4EF6\u6570\u91CF\u4E0D\u80FD\u8D85\u8FC7500")=>{Pe.dao.channel().transitionCustomError({name:"upload",error:ce})},Xn=F.exports.useCallback((ce,Se)=>{const{data:{action:Ae}}=ce;return Ae==="REFRESH"?(ce.snapshot=Gr(ce.data.payload),ce):(ce.snapshot||ba(ce,Se.snapshot,Ze=>{ce.snapshot=Gr(Ze)}),ce)},[]),Mt=F.exports.useCallback(ce=>{var to,Ar;const{agentUserId:Se,snapshot:Ae}=ce,{action:Ze,result:Ne,message:Me,destination:ft,files:rt,failPath:Nt=[]}=ce.data,Zn=Pe.dao.currentAgentUser(),Un=$t=>{const Hn=Mm($t);Le(Hn),ut.file.setFileTreeChange(!1)};switch(Ze){case"REFRESH":{ut.file.setFileTree(Ae),ba(ce,Ae,Un);break}case"MOVE":{const $t=rt[0];if(Ne===!1?ou.error(Me):ba(ce,w,Un),ft&&$t.name===Tt&&$t.type==="FILE")Ie(ft);else if($t.type==="DIRECTORY"){const Hn=Pe.file.doc().openedPath.indexOf($t.name);if(y(Pn=>Pn.map(It=>It.indexOf($t.name)===0?ft+It.substring($t.name.length):It)),Hn===0){const Pn=`${ft}${Pe.file.doc().openedPath.substring($t.name.length)}`;Ie(Pn)}}b("");break}case"CREATE":{if(Ne===!1)ou.error(Me);else{ba(ce,w,Un);const $t=(Zn==null?void 0:Zn.agentUserId)===Se||(Zn==null?void 0:Zn.followingAgentUserId)===Se;if(((to=rt==null?void 0:rt[0])==null?void 0:to.type)==="FILE"&&$t){const Hn=rt[0];ut.file.setSelectedFilePath(Hn.name)}}break}case"DELETE":{const $t=rt[0];if(Ne===!1)ou.error(Me);else{const Hn=Pe.file.doc().openedPath;(!Hn||Hn.indexOf($t.name)===0)&&ut.file.resetFile(),ba(ce,w,Un),ut.file.deletedPath($t.name)}break}case"UPLOAD":{if(Ne===!1&&Nt.length>0){if(!Object.keys(we).length)return;Nt.forEach(Ct=>{var It;delete we[Ct],we["."].children=(It=we["."].children)==null?void 0:It.filter($r=>$r!==Ct),Le(Gr(we))}),ln(Me);return}const $t=rt[0],Pn=$t.name.indexOf("/")>-1?$t.name.substring(0,$t.name.indexOf("/")):$t.name;(Ne||Ne===void 0)&&ba(ce,w,Un),Ne&&Oe[Pn]&&((Ar=ce.data)==null?void 0:Ar.uploadingCount)===0?(Zt.current=0,Te({})):!Ne&&we[Pn]&&(ou.error(Me),delete we[Pn],Le(Gr(we)));break}case"FEATURE":{Ne?ba(ce,w,Un):ou.error(Me);break}case"EXPAND":{ba(ce,w,Un),y($t=>$t.concat(rt[0].name));break}case"COLLAPSE":{ba(ce,w,Un),y($t=>{const Hn=$t.findIndex(Pn=>Pn===rt[0].name);return $t.splice(Hn,1),$t});break}case"FOCUS":{ba(ce,w,Un);const $t=rt[0];h($t.name,Se),Hi(Se)&&($t.type==="FILE"&&Ie($t.name),u($t.name));break}}},[h,w,Oe,Tt,Ie,we]);F.exports.useEffect(()=>{Pe.dao.channel().subscribeForComponent(xt.FileTree,{onStart:()=>{y([]),Le({}),ut.file.setFileTree(null)},onData:Mt,getPlaybackSnapshot:Xn})},[Mt]);const qo=ce=>{if(!Pe.dao.channelAvailable())return yn.error("offline");if(ce.length===1){if(Oe[ce[0]])return;if(we[ce[0]].type==="FILE"&&Ie(ce[0]),T===Rl.edit&&we[ce[0]].type==="FILE"){const Se=Woe(ce[0]);ut.file.setDocReadOnly(!!(Se!=null&&Se.lock)&&!o&&r==="on")}}},Ii=ce=>{Pe.dao.channel().operateFileTree({action:"EXPAND",files:[{type:"DIRECTORY",name:ce}]}),y([...d,ce])},Li=ce=>{Pe.dao.channel().operateFileTree({action:"COLLAPSE",files:[{type:"DIRECTORY",name:ce}]}),y(d.filter(Se=>!Se.includes(ce)))},Yi=ce=>{Le(Se=>({...Se,...ce}))},qt=async ce=>{var Ne;if(ce.length>500){ln();return}const Se=Mm(w),Ae=Array.from(ce).find(Me=>Se[Me.name]);if(Ae){pe(!0),ie(`${Ae.name}\u5DF2\u5B58\u5728`);return}const Ze={action:"UPLOAD",destination:"",files:[]};for(const Me of Array.from(ce)){const ft=Me.name;if(te.includes(Me.name))yn.log(`${Me.name}\u88AB\u8FC7\u6EE4`);else{const rt=Gr(Se);rt[ze]&&((Ne=rt[ze].children)==null||Ne.push(ft)),rt[ft]={data:Me.name,hasChildren:!1,index:ft,type:"FILE"},Yi(rt),Te(Nt=>({...Nt,[ft]:!0})),Ze.files.push({type:"FILE",name:ft,content:Me})}}Ze.files.length&&Pe.dao.channel().operateFileTree(Ze)},Ln=async ce=>{const Se=[];for(const Ae of Array.from(ce))te.includes(Ae.name)?yn.log(`${Ae.name}\u4E0D\u5141\u8BB8\u4E0A\u4F20`):Se.push({path:Ae.fullPath||Ae.webkitRelativePath,file:Ae});return Se},Ut=ce=>ce.indexOf("/")>-1?ce.substring(0,ce.indexOf("/")):ce,En=ce=>{const Se=Gr(we),Ae=[...new Set(ce.map(Ne=>Ut(Ne.path)))];ce.filter(Ne=>{if(Ae.length===0)return!1;const Me=Ae.findIndex(ft=>ft===Ut(Ne.path));return Me>-1?(Ae.splice(Me,1),Me>-1):!1}).forEach(Ne=>{var rt;const Me=Ne.path,ft=Ut(Ne.path);(rt=Se[ze].children)==null||rt.push(ft),Te(Nt=>({...Nt,[ft]:!0})),Se[ft]={data:ft,hasChildren:Ne.path.indexOf("/")>-1,index:Me,type:Ne.path.indexOf("/")>-1?"DIRECTORY":"FILE"},Yi(Se)})},li=async ce=>{const Se=Mm(w);if(!Object.keys(Se).length)return;const Ae=await Ln(ce);if(Ae.length>500){ln();return}if(Ae.length>0){const Ze=Ae.find(Me=>!!Se[Ut(Me.path)]);if(Ze){pe(!0),ie(`${Ze.path}\u5DF2\u5B58\u5728`);return}Zt.current=Ae.length;const Ne={action:"UPLOAD",destination:"",files:[]};En(Ae);for(let Me=0;Me<Ae.length;Me++){const ft=Ae[Me];Ne.files.push({type:"FILE",name:ft.path,content:ft.file})}Pe.dao.channel().operateFileTree(Ne)}},ci=async ce=>{var ft,rt,Nt;ce.preventDefault(),ce.stopPropagation(),ce.currentTarget.lastElementChild.classList.remove("root-drag-over");let Se=ce.target;for(;Se&&((ft=Se.tagName)==null?void 0:ft.toLowerCase())!=="button";)Se=Se.lastElementChild;const Ae=Array.from(ce.dataTransfer.items)||[];if(Ae.length===0)return;const Ze=[];for(const Zn of Ae)Ze.push(Zn.webkitGetAsEntry());const Ne=Ze.some(Zn=>Zn==null?void 0:Zn.isDirectory),Me=await dU(Ze,[]);Ne?li(Me):qt(Me),(rt=Se==null?void 0:Se.parentElement)==null||rt.classList.remove("rct-tree-item-title-container-selected"),(Nt=Se==null?void 0:Se.parentElement)==null||Nt.parentElement.classList.remove("rct-tree-item-li-selected")},en=ce=>{var Se;((Se=ce.dataTransfer)==null?void 0:Se.items.length)!==0&&(ce.preventDefault(),ce.stopPropagation())},Zi=ce=>{var Ze,Ne;if(((Ze=ce==null?void 0:ce.dataTransfer)==null?void 0:Ze.items.length)===0)return;ce.preventDefault(),ce.stopPropagation();const Se=ce.target;ce.currentTarget.lastElementChild.classList.remove("root-drag-over"),Se.classList.contains("rct-tree-root")&&Se.classList.add("root-drag-over"),((Ne=Se.tagName)==null?void 0:Ne.toLowerCase())==="button"&&(Se.parentElement.classList.add("rct-tree-item-title-container-selected"),Se.parentElement.parentElement.classList.add("rct-tree-item-li-selected"))},Ci=ce=>{if(ce.dataTransfer.items.length===0)return;ce.preventDefault(),ce.stopPropagation();const Se=ce.target;Se.tagName.toLowerCase()==="button"&&(Se.parentElement.classList.remove("rct-tree-item-title-container-selected"),Se.parentElement.parentElement.classList.remove("rct-tree-item-li-selected"))},br=ce=>(we[ce].hasChildren?ce=we[ce].index:ce[ce.length-1]!=="/"&&(ce=ce.substring(0,ce.lastIndexOf("/"))),ce),ji=()=>{Le(ce=>(Object.entries(ce).forEach(([Se,Ae])=>{Ae.data||delete ce[Se]}),ce))},Ki=(ce=ze)=>{var Ne;ji(),Ii(ce),A("CREATE"),ce=br(ce);const Se=Gr(we),Ze=`${ce===ze?"":`${ce}/`}${VC().substring(0,6)}`;(Ne=Se[ce].children)==null||Ne.push(Ze),nt.current={root:ce,path:Ze},Se[Ze]={index:Ze,hasChildren:!1,data:""},Yi(Se),b(Ze),p("")},Gn=(ce=ze)=>{var Ne;ji(),Ii(ce),A("CREATE"),ce=br(ce);const Se=Gr(we),Ze=`${ce===ze?"":`${ce}/`}${VC().substring(0,6)}`;(Ne=Se[ce].children)==null||Ne.push(Ze),nt.current={root:ce,path:Ze},Se[Ze]={index:Ze,hasChildren:!0,children:[],data:""},Yi(Se),b(Ze),p("")},Ji=()=>{nt.current={path:"",root:""}},eo=(ce,Se="")=>{if(!Pe.dao.channelAvailable())return yn.log("offline");const Ae={action:"CREATE",files:[]};if(!ce||!m)return;const Ze=Wt($),Ne=Ze===ze||!Ze?"":`${Ze}/`,Me=we[nt.current.path].hasChildren;if(we[`${Ne}${m}`]){yn.error("\u91CD\u540D\u4E86");return}const ft=ce.index.split("/");ft.length>0&&(ft[ft.length-1]=m),ft.splice(-1,1,Se),W==="CREATE"?(Ae.action=W,Me?Ae.files=[{type:"DIRECTORY",name:ft.join("/")}]:Ae.files=[{type:"FILE",name:ft.join("/")}]):(Ae.action="MOVE",Ae.destination=ft.join("/"),Ae.files=[{type:"FILE",name:ce.index}],Dt.indexOf(ce.index)===0&&ut.file.setDocLoading(!0)),Ae.files[0].type=Me?"DIRECTORY":"FILE",Pe.dao.channel().operateFileTree(Ae),Ji()},mo=ce=>{Pe.dao.channel().operateFileTree({action:"DELETE",files:[{type:Y.isDir?"DIRECTORY":"FILE",name:ce}]})},pi=()=>{var Ne,Me,ft;const{root:ce,path:Se}=nt.current,Ae=Gr(we),Ze=Se.substring(0,Se.lastIndexOf("/")+1);if(!(!Se||!ce)){if(!m&&Se||we[`${Ze}`+m])Ae[ce].children=(Me=(Ne=Ae[ce])==null?void 0:Ne.children)==null?void 0:Me.filter(rt=>rt!==Se),delete Ae[Se],Le(Ae);else if(m){const rt=(ft=Ae[Se])==null?void 0:ft.hasChildren,Nt={action:W,files:[{type:rt?"DIRECTORY":"FILE",name:W==="MOVE"?Se:Ze+m}]};W==="MOVE"&&(Nt.destination=Ze+m),Pe.dao.channel().operateFileTree(Nt),p("")}Ji()}},Di=()=>{pi(),X(""),b("")};F.exports.useEffect(()=>(window.addEventListener("click",Di,!1),()=>{window.removeEventListener("click",Di,!1)}),[we,m]);const Qr=(ce,Se)=>fe(Lg,{title:ce,children:Se}),Yn=()=>Yt("div",{className:"d42-operation-panel",children:[fe("div",{className:"d42-panel-item",onClick:()=>{var ce,Se;(ce=V.current)==null||ce.click(),(Se=re.current)==null||Se.close()},children:"\u4E0A\u4F20\u6587\u4EF6"}),fe("div",{className:"d42-panel-item",onClick:()=>{var ce;K==null||K.click(),(ce=re.current)==null||ce.close()},children:"\u4E0A\u4F20\u6587\u4EF6\u5939"})]}),qn=F.exports.useRef({}),Xi=(ce,Se,Ae)=>{Ae=Ae||"",ce.stopPropagation(),A("MOVE"),X(""),p(Ae),b(Se),nt.current.path=Se},se=(ce,Se,Ae)=>{ce.stopPropagation(),Z({isDir:Se,path:Ae}),X(""),N(!0)},xe=(ce,Se)=>{ce.stopPropagation(),X(""),Ki(Se)},Ue=(ce,Se)=>{ce.stopPropagation(),X(""),Gn(Se)},Be=(ce,Se,Ae)=>{if(Boolean(Se.hasChildren)&&Ae)return!1;const{isRetainedFile:Ne}=Se,{filesPath:Me=[],isDisable:ft=!1}=l;return ft&&(Ne||Me.includes(ce))},bt=(ce,Se,Ae)=>{const{data:Ze}=Ae,Ne=Be(Se,Ae,!1);return Yt("div",{className:"d42-operation-panel",children:[ce&&Yt(cQ,{children:[fe("div",{className:"d42-panel-item",onClick:rt=>{xe(rt,Se),qn.current[Se].close()},children:"\u65B0\u5EFA\u6587\u4EF6"}),fe("div",{className:"d42-panel-item",onClick:rt=>{Ue(rt,Se),qn.current[Se].close()},children:"\u65B0\u5EFA\u6587\u4EF6\u5939"})]}),!Ne&&fe("div",{className:"d42-panel-item",onClick:rt=>{Xi(rt,Se,Ze),qn.current[Se].close()},children:"\u91CD\u547D\u540D"}),!Ne&&fe("div",{className:"d42-panel-item delete",onClick:rt=>{A("DELETE"),se(rt,ce,Se),qn.current[Se].close()},children:"\u5220\u9664"})]})},Vt=ce=>{const Se=!ce.hasChildren,Ae=ce.index;if(Se)return Ae.substring(Ae.lastIndexOf("/")+1);{const Ze=Ae.split("/");return Ze[Ze.length-1]}},Wt=ce=>ce.substring(0,ce.lastIndexOf("/")),un=(ce,Se)=>{const Ae=Gr(ce[0]),Ze=Vt(Ae),Ne=Se.parentItem;if(Ne){const Me=`${Ne}/${Ze}`;Pe.dao.channel().operateFileTree({action:"MOVE",destination:Ae.index,files:[{type:"FILE",name:Me}]})}},Qn=(ce,Se)=>{const Ae=!ce[0].hasChildren,Ze=ce[0].index;return(Ae?Ze.substring(0,Ze.lastIndexOf("/")):Ze)!==Se.parentItem},_t=(ce,Se)=>{var Ae;switch(ce.key){case"Enter":{if(!vt.current||!vt.current&&!m){Di();return}Se===Dt&&ut.file.setDocLoading(!0),eo(we[$],m),(Ae=qn.current[Se])==null||Ae.close();break}case"ArrowLeft":{const Ze=ce.target;if(Ze){const Ne=Ze.selectionEnd-Ze.selectionStart;Ze.selectionEnd=Math.max(0,Ne>1?0:Ze.selectionEnd-1)}break}case"ArrowRight":{const Ze=ce.target;Ze&&(Ze.selectionEnd-Ze.selectionStart>1?Ze.selectionStart=Ze.selectionEnd:Ze.selectionStart=Math.min(Ze.value.length,Ze.selectionEnd+1));break}}},Rt=ce=>{vt.current=!0,Le(Se=>{var Ae;return Se[$]&&!te.includes(ce.target.value)&&(Se[$].data=(Ae=ce.target)==null?void 0:Ae.value),Se}),p(ce.target.value)},zt=ce=>{ce.stopPropagation(),q.current&&Ki()},nn=ce=>{ce.stopPropagation(),q.current&&Gn()};F.exports.useEffect(()=>{$||(vt.current=!1)},[$]);const At="rct-tree-item-title-container",Fn="rct-tree-item-li",Sr="rct-tree-item-button";return fe(bp,{name:"file",componentType:"Tree",children:Yt(Vse,{ref:v,className:"d42-tree-root-container",treeItemHeight:e,onClick:()=>{Pe.dao.channel().followingFocusComponent("Tree")},onDrop:ci,onDragEnter:Zi,onDragOver:en,onDragLeave:Ci,children:[fe("input",{id:"manual-upload-file",ref:V,type:"file",multiple:!0,hidden:!0,onChange:ce=>{qt(ce.target.files),ce.target.value=""}}),fe("input",{id:"manual-upload-folder",type:"file",multiple:!0,hidden:!0,ref:ce=>{ce&&(K=ce,ce.setAttribute("webkitdirectory","true"))},onChange:ce=>{li(ce.target.files),ce.target.value=""}}),Cn?fe("div",{className:"d42-filetree-skeleton",children:fe(Zfe,{})}):Yt(cQ,{children:[Yt("div",{className:"d42-root-toolbar",children:[fe("strong",{children:"Files"}),Yt("div",{className:"d42-root-toolbar-btns",children:[Qr("\u65B0\u5EFA\u6587\u4EF6",fe("button",{className:"d42-btn",onClick:zt,children:fe("i",{className:"d42 add-file"})})),Qr("\u65B0\u5EFA\u6587\u4EF6\u5939",fe("button",{className:"d42-btn d42-dir-btn",onClick:nn,children:fe("i",{className:"d42 add-folder"})})),fe(RX,{ref:re,container:v.current,meun:Yn(),children:fe("button",{className:"d42-btn d42-more-btn",children:fe("i",{className:"d42 more"})})})]})]}),fe(lse,{canSearch:!1,ref:q,items:we,onFocusItem:ce=>u(ce.index),onExpandItem:ce=>{Ii(ce.index)},onCollapseItem:ce=>{Li(ce.index)},onDrop:un,canDrag:()=>!0,canDropAt:Qn,getItemTitle:ce=>ce.data,viewState:{["tree-1"]:{focusedItem:c,expandedItems:d,selectedItems:[Dt]}},onSelectItems:ce=>{qo(ce),t==null||t(ce,we[ce[0]].type)},renderItem:ce=>{const{title:Se,arrow:Ae,depth:Ze,children:Ne}=ce,Me=ce.item,ft=f(Me.index),rt=ce.context,Nt=Me.index,Zn=Ze>0?Ze*16+8:8,Un=YU(Me.data),to=Me.hasChildren?fe("div",{...rt.arrowProps,className:"d42-folder-wrapper",children:fe("div",{className:"d42-folder-icon",children:fe(Qfe,{})})}):null,Ar=!Un&&!Me.hasChildren?fe("div",{...rt.arrowProps,className:"d42-file-icon default",children:fe(jU,{})}):null,$t=Wt(Nt),Hn=`${$t}${$t?"/":""}${m}`,Pn=we[Hn]&&vt.current,Ct=Me.hasChildren?Ut(Me.index):Me.index;return Me.hide&&n==="preview"&&!i?null:fe("div",{onClick:It=>{It.stopPropagation(),It.preventDefault(),Pe.dao.channel().followingFocusComponent("Tree")},children:F.exports.createElement("li",{...rt.itemContainerWithChildrenProps,...rt.itemContainerWithoutChildrenProps,key:Me.index,className:zr(Fn,{[`${Fn}-selected`]:rt.isSelected,[`${Fn}-expanded`]:rt.isExpanded,[`${Fn}-focused`]:rt.isFocused,[`${Fn}-hasChildren`]:Ne,"d42-light-selected":$===Nt})},fe("div",{className:zr(At,{[`${At}-selected`]:rt.isSelected,[`${At}-expanded`]:rt.isExpanded,[`${At}-focused`]:rt.isFocused,[`${At}-hasChildren`]:Ne,show:rt.isFocused||I===Me.index}),style:{paddingLeft:Zn},children:$===Nt?fe("input",{className:zr("d42-create-file-folder",{error:Pn}),type:"text",autoFocus:!0,value:m,onClick:It=>It.stopPropagation(),ref:It=>{It==null||It.focus()},style:{marginLeft:Me.hasChildren?8:0},onInput:Rt,onKeyDown:It=>{_t(It,Nt)}}):fe(cQ,{children:Yt("div",{...rt.itemContainerWithoutChildrenProps,...rt.interactiveElementProps,className:zr(Sr,{[`${Sr}-selected`]:rt.isSelected,[`${Sr}-expanded`]:rt.isExpanded,[`${Sr}-focused`]:rt.isFocused,[`${Sr}-hasChildren`]:Me.hasChildren,"no-child":!Me.hasChildren}),children:[Yt("div",{className:"d42-item-title-wrapper",children:[!Me.hasChildren&&Un&&fe("em",{className:zr("d42-file-icon",Un||"not-cls")}),fe("div",{onClick:It=>{It.stopPropagation(),It.preventDefault()},children:Ae}),to,Ar,fe("span",{className:"d42-item-title",title:Me.data,children:Se})]}),Yt("div",{className:"d42-filetree-extra",children:[ft&&$!==Nt&&fe("div",{className:"rct-tree-item-avatar-container",children:ft.map((It,$r)=>fe("div",{className:"rct-tree-item-avatar",style:{border:`1px solid ${It.color}`,marginLeft:`-${$r*4}px`},children:fe("img",{className:"rct-tree-item-avatar-img",src:It.userInfo.avatarUrl,alt:""})},$r))}),fe("div",{className:"d42-actions-container",children:fe(Cfe,{treeNode:Me,hideFeature:n,hideEditFeature:i,lockFeature:r,lockEditFeature:o,unittestFeature:s,unittestEditFeature:a})}),!Be(Nt,Me,!0)&&fe(RX,{ref:It=>{It&&(qn.current={...qn.current,[Nt]:It})},onClose:()=>X(""),container:v.current,meun:!Oe[Me.index]&&$!==Nt&&Zt.current===0&&I===Me.index&&bt(Boolean(Me.hasChildren),Nt,Me),children:fe("button",{className:"d42-expand-panel",onClick:()=>{X(I===Me.index?"":Me.index)},children:fe("i",{className:"d42 more"})})})]}),Oe[Ct]?fe("div",{className:"d42-upload-loading",children:fe(dfe,{spin:!0})}):null]})})}),Ae?d.includes(Me.index)&&Ne:Ne,Oe[Ct]&&fe("div",{className:"d42-filetree-item-loading"}))},Me.index)},children:fe(Rse,{treeId:"tree-1",ref:De,rootItem:ze,treeLabel:"File Tree"})})]}),fe(_X,{title:Yt("div",{children:["\u5220\u9664\xA0",Y.path.substring(Y.path.lastIndexOf("/")+1),"\uFF1F"]}),visible:J,onCancel:()=>N(!1),onOk:()=>{mo(Y.path),N(!1)},children:Yt("div",{children:["\u786E\u5B9A\u5220\u9664\u8FD9\u4E2A",Y.isDir?"\u76EE\u5F55":"\u6587\u4EF6","\u5417\uFF1F\u5220\u9664\u540E\u4E0D\u53EF\u6062\u590D"]})}),fe(_X,{visible:M,title:"\u6E29\u99A8\u63D0\u793A",showCancelBtn:!1,okText:"\u77E5\u9053\u4E86",onOk:()=>pe(!1),children:fe("div",{children:B})})]})})};var Dfe=Object.freeze(Object.defineProperty({__proto__:null,FileTree:jfe},Symbol.toStringTag,{value:"Module"}));class bn{constructor(){}lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,i){let r=[];return this.decompose(0,e,r,2),i.length&&i.decompose(0,i.length,r,3),this.decompose(n,this.length,r,1),_a.from(r,this.length-(n-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){let i=[];return this.decompose(e,n,i,0),_a.from(i,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),r=new ah(this),o=new ah(e);for(let s=n,a=n;;){if(r.next(s),o.next(s),s=0,r.lineBreak!=o.lineBreak||r.done!=o.done||r.value!=o.value)return!1;if(a+=r.value.length,r.done||a>=i)return!0}}iter(e=1){return new ah(this,e)}iterRange(e,n=this.length){return new VU(this,e,n)}iterLines(e,n){let i;if(e==null)i=this.iter();else{n==null&&(n=this.lines+1);let r=this.line(e).from;i=this.iterRange(r,Math.max(r,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new NU(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?bn.empty:e.length<=32?new qi(e):_a.from(qi.split(e,[]))}}class qi extends bn{constructor(e,n=Mfe(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,i,r){for(let o=0;;o++){let s=this.text[o],a=r+s.length;if((n?i:a)>=e)return new Vfe(r,a,i,s);r=a+1,i++}}decompose(e,n,i,r){let o=e<=0&&n>=this.length?this:new qi(CX(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(r&1){let s=i.pop(),a=Yg(o.text,s.text.slice(),0,o.length);if(a.length<=32)i.push(new qi(a,s.length+o.length));else{let l=a.length>>1;i.push(new qi(a.slice(0,l)),new qi(a.slice(l)))}}else i.push(o)}replace(e,n,i){if(!(i instanceof qi))return super.replace(e,n,i);let r=Yg(this.text,Yg(i.text,CX(this.text,0,e)),n),o=this.length+i.length-(n-e);return r.length<=32?new qi(r,o):_a.from(qi.split(r,[]),o)}sliceString(e,n=this.length,i=`
|
|
1015
1015
|
`){let r="";for(let o=0,s=0;o<=n&&s<this.text.length;s++){let a=this.text[s],l=o+a.length;o>e&&s&&(r+=i),e<l&&n>o&&(r+=a.slice(Math.max(0,e-o),n-o)),o=l+1}return r}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let i=[],r=-1;for(let o of e)i.push(o),r+=o.length+1,i.length==32&&(n.push(new qi(i,r)),i=[],r=-1);return r>-1&&n.push(new qi(i,r)),n}}class _a extends bn{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,n,i,r){for(let o=0;;o++){let s=this.children[o],a=r+s.length,l=i+s.lines-1;if((n?l:a)>=e)return s.lineInner(e,n,i,r);r=a+1,i=l+1}}decompose(e,n,i,r){for(let o=0,s=0;s<=n&&o<this.children.length;o++){let a=this.children[o],l=s+a.length;if(e<=l&&n>=s){let c=r&((s<=e?1:0)|(l>=n?2:0));s>=e&&l<=n&&!c?i.push(a):a.decompose(e-s,n-s,i,c)}s=l+1}}replace(e,n,i){if(i.lines<this.lines)for(let r=0,o=0;r<this.children.length;r++){let s=this.children[r],a=o+s.length;if(e>=o&&n<=a){let l=s.replace(e-o,n-o,i),c=this.lines-s.lines+l.lines;if(l.lines<c>>5-1&&l.lines>c>>5+1){let u=this.children.slice();return u[r]=l,new _a(u,this.length-(n-e)+i.length)}return super.replace(o,a,l)}o=a+1}return super.replace(e,n,i)}sliceString(e,n=this.length,i=`
|
|
1016
1016
|
`){let r="";for(let o=0,s=0;o<this.children.length&&s<=n;o++){let a=this.children[o],l=s+a.length;s>e&&o&&(r+=i),e<l&&n>s&&(r+=a.sliceString(e-s,n-s,i)),s=l+1}return r}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof _a))return 0;let i=0,[r,o,s,a]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=n,o+=n){if(r==s||o==a)return i;let l=this.children[r],c=e.children[o];if(l!=c)return i+l.scanIdentical(c,n);i+=l.length+1}}static from(e,n=e.reduce((i,r)=>i+r.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let y of e)y.flatten(d);return new qi(d,n)}let r=Math.max(32,i>>5),o=r<<1,s=r>>1,a=[],l=0,c=-1,u=[];function f(d){let y;if(d.lines>o&&d instanceof _a)for(let $ of d.children)f($);else d.lines>s&&(l>s||!l)?(h(),a.push(d)):d instanceof qi&&l&&(y=u[u.length-1])instanceof qi&&d.lines+y.lines<=32?(l+=d.lines,c+=d.length+1,u[u.length-1]=new qi(y.text.concat(d.text),y.length+1+d.length)):(l+d.lines>r&&h(),l+=d.lines,c+=d.length+1,u.push(d))}function h(){l!=0&&(a.push(u.length==1?u[0]:_a.from(u,c)),c=-1,l=u.length=0)}for(let d of e)f(d);return h(),a.length==1?a[0]:new _a(a,n)}}bn.empty=new qi([""],0);function Mfe(t){let e=-1;for(let n of t)e+=n.length+1;return e}function Yg(t,e,n=0,i=1e9){for(let r=0,o=0,s=!0;o<t.length&&r<=i;o++){let a=t[o],l=r+a.length;l>=n&&(l>i&&(a=a.slice(0,i-r)),r<n&&(a=a.slice(n-r)),s?(e[e.length-1]+=a,s=!1):e.push(a)),r=l+1}return e}function CX(t,e,n){return Yg(t,[""],e,n)}class ah{constructor(e,n=1){this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[n>0?1:(e instanceof qi?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,r=this.nodes[i],o=this.offsets[i],s=o>>1,a=r instanceof qi?r.text.length:r.children.length;if(s==(n>0?a:0)){if(i==0)return this.done=!0,this.value="",this;n>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((o&1)==(n>0?0:1)){if(this.offsets[i]+=n,e==0)return this.lineBreak=!0,this.value=`
|
|
1017
|
-
`,this;e--}else if(r instanceof qi){let l=r.text[s+(n<0?-1:0)];if(this.offsets[i]+=n,l.length>Math.max(0,e))return this.value=e==0?l:n>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=r.children[s+(n<0?-1:0)];e>l.length?(e-=l.length,this.offsets[i]+=n):(n<0&&this.offsets[i]--,this.nodes.push(l),this.offsets.push(n>0?1:(l instanceof qi?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class VU{constructor(e,n,i){this.value="",this.done=!1,this.cursor=new ah(e,n>i?-1:1),this.pos=n>i?e.length:0,this.from=Math.min(n,i),this.to=Math.max(n,i)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let i=n<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*n,this.value=r.length<=i?r:n<0?r.slice(r.length-i):r.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class NU{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:i,value:r}=this.inner.next(e);return n?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol!="undefined"&&(bn.prototype[Symbol.iterator]=function(){return this.iter()},ah.prototype[Symbol.iterator]=VU.prototype[Symbol.iterator]=NU.prototype[Symbol.iterator]=function(){return this});class Vfe{constructor(e,n,i,r){this.from=e,this.to=n,this.number=i,this.text=r}get length(){return this.to-this.from}}let jO="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(t=>t?parseInt(t,36):1);for(let t=1;t<jO.length;t++)jO[t]+=jO[t-1];function Nfe(t){for(let e=1;e<jO.length;e+=2)if(jO[e]>t)return jO[e-1]<=t;return!1}function XX(t){return t>=127462&&t<=127487}const WX=8205;function Ko(t,e,n=!0,i=!0){return(n?BU:Bfe)(t,e,i)}function BU(t,e,n){if(e==t.length)return e;e&&GU(t.charCodeAt(e))&&FU(t.charCodeAt(e-1))&&e--;let i=Cr(t,e);for(e+=Go(i);e<t.length;){let r=Cr(t,e);if(i==WX||r==WX||n&&Nfe(r))e+=Go(r),i=r;else if(XX(r)){let o=0,s=e-2;for(;s>=0&&XX(Cr(t,s));)o++,s-=2;if(o%2==0)break;e+=2}else break}return e}function Bfe(t,e,n){for(;e>0;){let i=BU(t,e-2,n);if(i<e)return i;e--}return 0}function GU(t){return t>=56320&&t<57344}function FU(t){return t>=55296&&t<56320}function Cr(t,e){let n=t.charCodeAt(e);if(!FU(n)||e+1==t.length)return n;let i=t.charCodeAt(e+1);return GU(i)?(n-55296<<10)+(i-56320)+65536:n}function Hk(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function Go(t){return t<65536?1:2}const B$=/\r\n?|\n/;var or=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(or||(or={}));class Aa{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;n<this.sections.length;n+=2)e+=this.sections[n];return e}get newLength(){let e=0;for(let n=0;n<this.sections.length;n+=2){let i=this.sections[n+1];e+=i<0?this.sections[n]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let n=0,i=0,r=0;n<this.sections.length;){let o=this.sections[n++],s=this.sections[n++];s<0?(e(i,r,o),r+=o):r+=s,i+=o}}iterChangedRanges(e,n=!1){G$(this,e,n)}get invertedDesc(){let e=[];for(let n=0;n<this.sections.length;){let i=this.sections[n++],r=this.sections[n++];r<0?e.push(i,r):e.push(r,i)}return new Aa(e)}composeDesc(e){return this.empty?e:e.empty?this:HU(this,e)}mapDesc(e,n=!1){return e.empty?this:F$(this,e,n)}mapPos(e,n=-1,i=or.Simple){let r=0,o=0;for(let s=0;s<this.sections.length;){let a=this.sections[s++],l=this.sections[s++],c=r+a;if(l<0){if(c>e)return o+(e-r);o+=a}else{if(i!=or.Simple&&c>=e&&(i==or.TrackDel&&r<e&&c>e||i==or.TrackBefore&&r<e||i==or.TrackAfter&&c>e))return null;if(c>e||c==e&&n<0&&!a)return e==r||n<0?o:o+l;o+=l}r=c}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return o}touchesRange(e,n=e){for(let i=0,r=0;i<this.sections.length&&r<=n;){let o=this.sections[i++],s=this.sections[i++],a=r+o;if(s>=0&&r<=n&&a>=e)return r<e&&a>n?"cover":!0;r=a}return!1}toString(){let e="";for(let n=0;n<this.sections.length;){let i=this.sections[n++],r=this.sections[n++];e+=(e?" ":"")+i+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Aa(e)}static create(e){return new Aa(e)}}class Qi extends Aa{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length",this.length,e.length,this);return G$(this,(n,i,r,o,s)=>e=e.replace(r,r+(i-n),s),!1),e}mapDesc(e,n=!1){return F$(this,e,n,!0)}invert(e){let n=this.sections.slice(),i=[];for(let r=0,o=0;r<n.length;r+=2){let s=n[r],a=n[r+1];if(a>=0){n[r]=a,n[r+1]=s;let l=r>>1;for(;i.length<l;)i.push(bn.empty);i.push(s?e.slice(o,o+s):bn.empty)}o+=s}return new Qi(n,i)}compose(e){return this.empty?e:e.empty?this:HU(this,e,!0)}map(e,n=!1){return e.empty?this:F$(this,e,n,!0)}iterChanges(e,n=!1){G$(this,e,n)}get desc(){return Aa.create(this.sections)}filter(e){let n=[],i=[],r=[],o=new Zh(this);e:for(let s=0,a=0;;){let l=s==e.length?1e9:e[s++];for(;a<l||a==l&&o.len==0;){if(o.done)break e;let u=Math.min(o.len,l-a);ao(r,u,-1);let f=o.ins==-1?-1:o.off==0?o.ins:0;ao(n,u,f),f>0&&Ou(i,n,o.text),o.forward(u),a+=u}let c=e[s++];for(;a<c;){if(o.done)break e;let u=Math.min(o.len,c-a);ao(n,u,-1),ao(r,u,o.ins==-1?-1:o.off==0?o.ins:0),o.forward(u),a+=u}}return{changes:new Qi(n,i),filtered:Aa.create(r)}}toJSON(){let e=[];for(let n=0;n<this.sections.length;n+=2){let i=this.sections[n],r=this.sections[n+1];r<0?e.push(i):r==0?e.push([i]):e.push([i].concat(this.inserted[n>>1].toJSON()))}return e}static of(e,n,i){let r=[],o=[],s=0,a=null;function l(u=!1){if(!u&&!r.length)return;s<n&&ao(r,n-s,-1);let f=new Qi(r,o);a=a?a.compose(f.map(a)):f,r=[],o=[],s=0}function c(u){if(Array.isArray(u))for(let f of u)c(f);else if(u instanceof Qi){if(u.length!=n)throw new RangeError(`Mismatched change set length (got ${u.length}, expected ${n})`);l(),a=a?a.compose(u.map(a)):u}else{let{from:f,to:h=f,insert:d}=u;if(f>h||f<0||h>n)throw new RangeError(`Invalid change range ${f} to ${h} (in doc of length ${n})`);let y=d?typeof d=="string"?bn.of(d.split(i||B$)):d:bn.empty,$=y.length;if(f==h&&$==0)return;f<s&&l(),f>s&&ao(r,f-s,-1),ao(r,h-f,$),Ou(o,r,y),s=h}}return c(e),l(!a),a}static empty(e){return new Qi(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],i=[];for(let r=0;r<e.length;r++){let o=e[r];if(typeof o=="number")n.push(o,-1);else{if(!Array.isArray(o)||typeof o[0]!="number"||o.some((s,a)=>a&&typeof s!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(o.length==1)n.push(o[0],0);else{for(;i.length<r;)i.push(bn.empty);i[r]=bn.of(o.slice(1)),n.push(o[0],i[r].length)}}}return new Qi(n,i)}static createSet(e,n){return new Qi(e,n)}}function ao(t,e,n,i=!1){if(e==0&&n<=0)return;let r=t.length-2;r>=0&&n<=0&&n==t[r+1]?t[r]+=e:e==0&&t[r]==0?t[r+1]+=n:i?(t[r]+=e,t[r+1]+=n):t.push(e,n)}function Ou(t,e,n){if(n.length==0)return;let i=e.length-2>>1;if(i<t.length)t[t.length-1]=t[t.length-1].append(n);else{for(;t.length<i;)t.push(bn.empty);t.push(n)}}function G$(t,e,n){let i=t.inserted;for(let r=0,o=0,s=0;s<t.sections.length;){let a=t.sections[s++],l=t.sections[s++];if(l<0)r+=a,o+=a;else{let c=r,u=o,f=bn.empty;for(;c+=a,u+=l,l&&i&&(f=f.append(i[s-2>>1])),!(n||s==t.sections.length||t.sections[s+1]<0);)a=t.sections[s++],l=t.sections[s++];e(r,c,o,u,f),r=c,o=u}}}function F$(t,e,n,i=!1){let r=[],o=i?[]:null,s=new Zh(t),a=new Zh(e);for(let l=0,c=0;;)if(s.ins==-1)l+=s.len,s.next();else if(a.ins==-1&&c<l){let u=Math.min(a.len,l-c);a.forward(u),ao(r,u,-1),c+=u}else if(a.ins>=0&&(s.done||c<l||c==l&&(a.len<s.len||a.len==s.len&&!n))){for(ao(r,a.ins,-1);l>c&&!s.done&&l+s.len<c+a.len;)l+=s.len,s.next();c+=a.len,a.next()}else if(s.ins>=0){let u=0,f=l+s.len;for(;;)if(a.ins>=0&&c>l&&c+a.len<f)u+=a.ins,c+=a.len,a.next();else if(a.ins==-1&&c<f){let h=Math.min(a.len,f-c);u+=h,a.forward(h),c+=h}else break;ao(r,u,s.ins),o&&Ou(o,r,s.text),l=f,s.next()}else{if(s.done&&a.done)return o?Qi.createSet(r,o):Aa.create(r);throw new Error("Mismatched change set lengths")}}function HU(t,e,n=!1){let i=[],r=n?[]:null,o=new Zh(t),s=new Zh(e);for(let a=!1;;){if(o.done&&s.done)return r?Qi.createSet(i,r):Aa.create(i);if(o.ins==0)ao(i,o.len,0,a),o.next();else if(s.len==0&&!s.done)ao(i,0,s.ins,a),r&&Ou(r,i,s.text),s.next();else{if(o.done||s.done)throw new Error("Mismatched change set lengths");{let l=Math.min(o.len2,s.len),c=i.length;if(o.ins==-1){let u=s.ins==-1?-1:s.off?0:s.ins;ao(i,l,u,a),r&&u&&Ou(r,i,s.text)}else s.ins==-1?(ao(i,o.off?0:o.len,l,a),r&&Ou(r,i,o.textBit(l))):(ao(i,o.off?0:o.len,s.off?0:s.ins,a),r&&!s.off&&Ou(r,i,s.text));a=(o.ins>l||s.ins>=0&&s.len>l)&&(a||i.length>c),o.forward2(l),s.forward(l)}}}}class Zh{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,n=this.i-2>>1;return n>=e.length?bn.empty:e[n]}textBit(e){let{inserted:n}=this.set,i=this.i-2>>1;return i>=n.length&&!e?bn.empty:n[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class fu{constructor(e,n,i){this.from=e,this.to=n,this.flags=i}get anchor(){return this.flags&16?this.to:this.from}get head(){return this.flags&16?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&4?-1:this.flags&8?1:0}get bidiLevel(){let e=this.flags&3;return e==3?null:e}get goalColumn(){let e=this.flags>>5;return e==33554431?void 0:e}map(e,n=-1){let i,r;return this.empty?i=r=e.mapPos(this.from,n):(i=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),i==this.from&&r==this.to?this:new fu(i,r,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return ye.range(e,n);let i=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return ye.range(this.anchor,i)}eq(e){return this.anchor==e.anchor&&this.head==e.head}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return ye.range(e.anchor,e.head)}static create(e,n,i){return new fu(e,n,i)}}class ye{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:ye.create(this.ranges.map(i=>i.map(e,n)),this.mainIndex)}eq(e){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n]))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new ye([this.main],0)}addRange(e,n=!0){return ye.create([e].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(e,n=this.mainIndex){let i=this.ranges.slice();return i[n]=e,ye.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new ye(e.ranges.map(n=>fu.fromJSON(n)),e.main)}static single(e,n=e){return new ye([ye.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,r=0;r<e.length;r++){let o=e[r];if(o.empty?o.from<=i:o.from<i)return ye.normalized(e.slice(),n);i=o.to}return new ye(e,n)}static cursor(e,n=0,i,r){return fu.create(e,e,(n==0?0:n<0?4:8)|(i==null?3:Math.min(2,i))|(r!=null?r:33554431)<<5)}static range(e,n,i){let r=(i!=null?i:33554431)<<5;return n<e?fu.create(n,e,16|r|8):fu.create(e,n,r|(n>e?4:0))}static normalized(e,n=0){let i=e[n];e.sort((r,o)=>r.from-o.from),n=e.indexOf(i);for(let r=1;r<e.length;r++){let o=e[r],s=e[r-1];if(o.empty?o.from<=s.to:o.from<s.to){let a=s.from,l=Math.max(o.to,s.to);r<=n&&n--,e.splice(--r,2,o.anchor>o.head?ye.range(l,a):ye.range(a,l))}}return new ye(e,n)}}function KU(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let Kk=0;class tt{constructor(e,n,i,r,o){this.combine=e,this.compareInput=n,this.compare=i,this.isStatic=r,this.extensions=o,this.id=Kk++,this.default=e([])}static define(e={}){return new tt(e.combine||(n=>n),e.compareInput||((n,i)=>n===i),e.compare||(e.combine?(n,i)=>n===i:Jk),!!e.static,e.enables)}of(e){return new Zg([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Zg(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Zg(e,this,2,n)}from(e,n){return n||(n=i=>i),this.compute([e],i=>n(i.field(e)))}}function Jk(t,e){return t==e||t.length==e.length&&t.every((n,i)=>n===e[i])}class Zg{constructor(e,n,i,r){this.dependencies=e,this.facet=n,this.type=i,this.value=r,this.id=Kk++}dynamicSlot(e){var n;let i=this.value,r=this.facet.compareInput,o=this.id,s=e[o]>>1,a=this.type==2,l=!1,c=!1,u=[];for(let f of this.dependencies)f=="doc"?l=!0:f=="selection"?c=!0:(((n=e[f.id])!==null&&n!==void 0?n:1)&1)==0&&u.push(e[f.id]);return{create(f){return f.values[s]=i(f),1},update(f,h){if(l&&h.docChanged||c&&(h.docChanged||h.selection)||H$(f,u)){let d=i(f);if(a?!zX(d,f.values[s],r):!r(d,f.values[s]))return f.values[s]=d,1}return 0},reconfigure:(f,h)=>{let d=i(f),y=h.config.address[o];if(y!=null){let $=Vy(h,y);if(this.dependencies.every(b=>b instanceof tt?h.facet(b)===f.facet(b):b instanceof wi?h.field(b,!1)==f.field(b,!1):!0)||(a?zX(d,$,r):r(d,$)))return f.values[s]=$,0}return f.values[s]=d,1}}}}function zX(t,e,n){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++)if(!n(t[i],e[i]))return!1;return!0}function H$(t,e){let n=!1;for(let i of e)lh(t,i)&1&&(n=!0);return n}function Gfe(t,e,n){let i=n.map(l=>t[l.id]),r=n.map(l=>l.type),o=i.filter(l=>!(l&1)),s=t[e.id]>>1;function a(l){let c=[];for(let u=0;u<i.length;u++){let f=Vy(l,i[u]);if(r[u]==2)for(let h of f)c.push(h);else c.push(f)}return e.combine(c)}return{create(l){for(let c of i)lh(l,c);return l.values[s]=a(l),1},update(l,c){if(!H$(l,o))return 0;let u=a(l);return e.compare(u,l.values[s])?0:(l.values[s]=u,1)},reconfigure(l,c){let u=H$(l,i),f=c.config.facets[e.id],h=c.facet(e);if(f&&!u&&Jk(n,f))return l.values[s]=h,0;let d=a(l);return e.compare(d,h)?(l.values[s]=h,0):(l.values[s]=d,1)}}}const EX=tt.define({static:!0});class wi{constructor(e,n,i,r,o){this.id=e,this.createF=n,this.updateF=i,this.compareF=r,this.spec=o,this.provides=void 0}static define(e){let n=new wi(Kk++,e.create,e.update,e.compare||((i,r)=>i===r),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(EX).find(i=>i.field==this);return((n==null?void 0:n.create)||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:i=>(i.values[n]=this.create(i),1),update:(i,r)=>{let o=i.values[n],s=this.updateF(o,r);return this.compareF(o,s)?0:(i.values[n]=s,1)},reconfigure:(i,r)=>r.config.address[this.id]!=null?(i.values[n]=r.field(this),0):(i.values[n]=this.create(i),1)}}init(e){return[this,EX.of({field:this,create:e})]}get extension(){return this}}const pO={lowest:4,low:3,default:2,high:1,highest:0};function Sd(t){return e=>new JU(e,t)}const ql={highest:Sd(pO.highest),high:Sd(pO.high),default:Sd(pO.default),low:Sd(pO.low),lowest:Sd(pO.lowest)};class JU{constructor(e,n){this.inner=e,this.prec=n}}class _1{of(e){return new K$(this,e)}reconfigure(e){return _1.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class K${constructor(e,n){this.compartment=e,this.inner=n}}class My{constructor(e,n,i,r,o,s){for(this.base=e,this.compartments=n,this.dynamicSlots=i,this.address=r,this.staticValues=o,this.facets=s,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let n=this.address[e.id];return n==null?e.default:this.staticValues[n>>1]}static resolve(e,n,i){let r=[],o=Object.create(null),s=new Map;for(let h of Ffe(e,n,s))h instanceof wi?r.push(h):(o[h.facet.id]||(o[h.facet.id]=[])).push(h);let a=Object.create(null),l=[],c=[];for(let h of r)a[h.id]=c.length<<1,c.push(d=>h.slot(d));let u=i==null?void 0:i.config.facets;for(let h in o){let d=o[h],y=d[0].facet,$=u&&u[h]||[];if(d.every(b=>b.type==0))if(a[y.id]=l.length<<1|1,Jk($,d))l.push(i.facet(y));else{let b=y.combine(d.map(m=>m.value));l.push(i&&y.compare(b,i.facet(y))?i.facet(y):b)}else{for(let b of d)b.type==0?(a[b.id]=l.length<<1|1,l.push(b.value)):(a[b.id]=c.length<<1,c.push(m=>b.dynamicSlot(m)));a[y.id]=c.length<<1,c.push(b=>Gfe(b,y,d))}}let f=c.map(h=>h(a));return new My(e,s,f,a,l,o)}}function Ffe(t,e,n){let i=[[],[],[],[],[]],r=new Map;function o(s,a){let l=r.get(s);if(l!=null){if(l<=a)return;let c=i[l].indexOf(s);c>-1&&i[l].splice(c,1),s instanceof K$&&n.delete(s.compartment)}if(r.set(s,a),Array.isArray(s))for(let c of s)o(c,a);else if(s instanceof K$){if(n.has(s.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(s.compartment)||s.inner;n.set(s.compartment,c),o(c,a)}else if(s instanceof JU)o(s.inner,s.prec);else if(s instanceof wi)i[a].push(s),s.provides&&o(s.provides,a);else if(s instanceof Zg)i[a].push(s),s.facet.extensions&&o(s.facet.extensions,a);else{let c=s.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${s}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(c,a)}}return o(t,pO.default),i.reduce((s,a)=>s.concat(a))}function lh(t,e){if(e&1)return 2;let n=e>>1,i=t.status[n];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;t.status[n]=4;let r=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|r}function Vy(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const eA=tt.define(),tA=tt.define({combine:t=>t.some(e=>e),static:!0}),nA=tt.define({combine:t=>t.length?t[0]:void 0,static:!0}),iA=tt.define(),rA=tt.define(),oA=tt.define(),sA=tt.define({combine:t=>t.length?t[0]:!1});class qc{constructor(e,n){this.type=e,this.value=n}static define(){return new Hfe}}class Hfe{of(e){return new qc(this,e)}}class Kfe{constructor(e){this.map=e}of(e){return new yt(this,e)}}class yt{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new yt(this.type,n)}is(e){return this.type==e}static define(e={}){return new Kfe(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let i=[];for(let r of e){let o=r.map(n);o&&i.push(o)}return i}}yt.reconfigure=yt.define();yt.appendConfig=yt.define();class Ai{constructor(e,n,i,r,o,s){this.startState=e,this.changes=n,this.selection=i,this.effects=r,this.annotations=o,this.scrollIntoView=s,this._doc=null,this._state=null,i&&KU(i,n.newLength),o.some(a=>a.type==Ai.time)||(this.annotations=o.concat(Ai.time.of(Date.now())))}static create(e,n,i,r,o,s){return new Ai(e,n,i,r,o,s)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(Ai.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}Ai.time=qc.define();Ai.userEvent=qc.define();Ai.addToHistory=qc.define();Ai.remote=qc.define();function Jfe(t,e){let n=[];for(let i=0,r=0;;){let o,s;if(i<t.length&&(r==e.length||e[r]>=t[i]))o=t[i++],s=t[i++];else if(r<e.length)o=e[r++],s=e[r++];else return n;!n.length||n[n.length-1]<o?n.push(o,s):n[n.length-1]<s&&(n[n.length-1]=s)}}function aA(t,e,n){var i;let r,o,s;return n?(r=e.changes,o=Qi.empty(e.changes.length),s=t.changes.compose(e.changes)):(r=e.changes.map(t.changes),o=t.changes.mapDesc(e.changes,!0),s=t.changes.compose(r)),{changes:s,selection:e.selection?e.selection.map(o):(i=t.selection)===null||i===void 0?void 0:i.map(r),effects:yt.mapEffects(t.effects,r).concat(yt.mapEffects(e.effects,o)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function J$(t,e,n){let i=e.selection,r=DO(e.annotations);return e.userEvent&&(r=r.concat(Ai.userEvent.of(e.userEvent))),{changes:e.changes instanceof Qi?e.changes:Qi.of(e.changes||[],n,t.facet(nA)),selection:i&&(i instanceof ye?i:ye.single(i.anchor,i.head)),effects:DO(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function lA(t,e,n){let i=J$(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(n=!1);for(let o=1;o<e.length;o++){e[o].filter===!1&&(n=!1);let s=!!e[o].sequential;i=aA(i,J$(t,e[o],s?i.changes.newLength:t.doc.length),s)}let r=Ai.create(t,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return tde(n?ede(r):r)}function ede(t){let e=t.startState,n=!0;for(let r of e.facet(iA)){let o=r(t);if(o===!1){n=!1;break}Array.isArray(o)&&(n=n===!0?o:Jfe(n,o))}if(n!==!0){let r,o;if(n===!1)o=t.changes.invertedDesc,r=Qi.empty(e.doc.length);else{let s=t.changes.filter(n);r=s.changes,o=s.filtered.mapDesc(s.changes).invertedDesc}t=Ai.create(e,r,t.selection&&t.selection.map(o),yt.mapEffects(t.effects,o),t.annotations,t.scrollIntoView)}let i=e.facet(rA);for(let r=i.length-1;r>=0;r--){let o=i[r](t);o instanceof Ai?t=o:Array.isArray(o)&&o.length==1&&o[0]instanceof Ai?t=o[0]:t=lA(e,DO(o),!1)}return t}function tde(t){let e=t.startState,n=e.facet(oA),i=t;for(let r=n.length-1;r>=0;r--){let o=n[r](t);o&&Object.keys(o).length&&(i=aA(t,J$(e,o,t.changes.newLength),!0))}return i==t?t:Ai.create(e,t.changes,t.selection,i.effects,i.annotations,i.scrollIntoView)}const nde=[];function DO(t){return t==null?nde:Array.isArray(t)?t:[t]}var lo=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(lo||(lo={}));const ide=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let ew;try{ew=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function rde(t){if(ew)return ew.test(t);for(let e=0;e<t.length;e++){let n=t[e];if(/\w/.test(n)||n>"\x80"&&(n.toUpperCase()!=n.toLowerCase()||ide.test(n)))return!0}return!1}function ode(t){return e=>{if(!/\S/.test(e))return lo.Space;if(rde(e))return lo.Word;for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return lo.Word;return lo.Other}}class on{constructor(e,n,i,r,o,s){this.config=e,this.doc=n,this.selection=i,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=o,s&&(s._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)lh(this,a<<1);this.computeSlot=null}field(e,n=!0){let i=this.config.address[e.id];if(i==null){if(n)throw new RangeError("Field is not present in this state");return}return lh(this,i),Vy(this,i)}update(...e){return lA(this,e,!0)}applyTransaction(e){let n=this.config,{base:i,compartments:r}=n;for(let s of e.effects)s.is(_1.reconfigure)?(n&&(r=new Map,n.compartments.forEach((a,l)=>r.set(l,a)),n=null),r.set(s.value.compartment,s.value.extension)):s.is(yt.reconfigure)?(n=null,i=s.value):s.is(yt.appendConfig)&&(n=null,i=DO(i).concat(s.value));let o;n?o=e.startState.values.slice():(n=My.resolve(i,r,this),o=new on(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(a,l)=>l.reconfigure(a,this),null).values),new on(n,e.newDoc,e.newSelection,o,(s,a)=>a.update(s,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:ye.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,i=e(n.ranges[0]),r=this.changes(i.changes),o=[i.range],s=DO(i.effects);for(let a=1;a<n.ranges.length;a++){let l=e(n.ranges[a]),c=this.changes(l.changes),u=c.map(r);for(let h=0;h<a;h++)o[h]=o[h].map(u);let f=r.mapDesc(c,!0);o.push(l.range.map(f)),r=r.compose(u),s=yt.mapEffects(s,u).concat(yt.mapEffects(DO(l.effects),f))}return{changes:r,selection:ye.create(o,n.mainIndex),effects:s}}changes(e=[]){return e instanceof Qi?e:Qi.of(e,this.doc.length,this.facet(on.lineSeparator))}toText(e){return bn.of(e.split(this.facet(on.lineSeparator)||B$))}sliceDoc(e=0,n=this.doc.length){return this.doc.sliceString(e,n,this.lineBreak)}facet(e){let n=this.config.address[e.id];return n==null?e.default:(lh(this,n),Vy(this,n))}toJSON(e){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let r=e[i];r instanceof wi&&(n[i]=r.spec.toJSON(this.field(e[i]),this))}return n}static fromJSON(e,n={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let r=[];if(i)for(let o in i){let s=i[o],a=e[o];r.push(s.init(l=>s.spec.fromJSON(a,l)))}return on.create({doc:e.doc,selection:ye.fromJSON(e.selection),extensions:n.extensions?r.concat([n.extensions]):r})}static create(e={}){let n=My.resolve(e.extensions||[],new Map),i=e.doc instanceof bn?e.doc:bn.of((e.doc||"").split(n.staticFacet(on.lineSeparator)||B$)),r=e.selection?e.selection instanceof ye?e.selection:ye.single(e.selection.anchor,e.selection.head):ye.single(0);return KU(r,i.length),n.staticFacet(tA)||(r=r.asSingle()),new on(n,i,r,n.dynamicSlots.map(()=>null),(o,s)=>s.create(o),null)}get tabSize(){return this.facet(on.tabSize)}get lineBreak(){return this.facet(on.lineSeparator)||`
|
|
1017
|
+
`,this;e--}else if(r instanceof qi){let l=r.text[s+(n<0?-1:0)];if(this.offsets[i]+=n,l.length>Math.max(0,e))return this.value=e==0?l:n>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=r.children[s+(n<0?-1:0)];e>l.length?(e-=l.length,this.offsets[i]+=n):(n<0&&this.offsets[i]--,this.nodes.push(l),this.offsets.push(n>0?1:(l instanceof qi?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class VU{constructor(e,n,i){this.value="",this.done=!1,this.cursor=new ah(e,n>i?-1:1),this.pos=n>i?e.length:0,this.from=Math.min(n,i),this.to=Math.max(n,i)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let i=n<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*n,this.value=r.length<=i?r:n<0?r.slice(r.length-i):r.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class NU{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:i,value:r}=this.inner.next(e);return n?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol!="undefined"&&(bn.prototype[Symbol.iterator]=function(){return this.iter()},ah.prototype[Symbol.iterator]=VU.prototype[Symbol.iterator]=NU.prototype[Symbol.iterator]=function(){return this});class Vfe{constructor(e,n,i,r){this.from=e,this.to=n,this.number=i,this.text=r}get length(){return this.to-this.from}}let jO="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(t=>t?parseInt(t,36):1);for(let t=1;t<jO.length;t++)jO[t]+=jO[t-1];function Nfe(t){for(let e=1;e<jO.length;e+=2)if(jO[e]>t)return jO[e-1]<=t;return!1}function XX(t){return t>=127462&&t<=127487}const WX=8205;function Ko(t,e,n=!0,i=!0){return(n?BU:Bfe)(t,e,i)}function BU(t,e,n){if(e==t.length)return e;e&&GU(t.charCodeAt(e))&&FU(t.charCodeAt(e-1))&&e--;let i=Cr(t,e);for(e+=Go(i);e<t.length;){let r=Cr(t,e);if(i==WX||r==WX||n&&Nfe(r))e+=Go(r),i=r;else if(XX(r)){let o=0,s=e-2;for(;s>=0&&XX(Cr(t,s));)o++,s-=2;if(o%2==0)break;e+=2}else break}return e}function Bfe(t,e,n){for(;e>0;){let i=BU(t,e-2,n);if(i<e)return i;e--}return 0}function GU(t){return t>=56320&&t<57344}function FU(t){return t>=55296&&t<56320}function Cr(t,e){let n=t.charCodeAt(e);if(!FU(n)||e+1==t.length)return n;let i=t.charCodeAt(e+1);return GU(i)?(n-55296<<10)+(i-56320)+65536:n}function Hk(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function Go(t){return t<65536?1:2}const B$=/\r\n?|\n/;var or=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(or||(or={}));class Aa{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;n<this.sections.length;n+=2)e+=this.sections[n];return e}get newLength(){let e=0;for(let n=0;n<this.sections.length;n+=2){let i=this.sections[n+1];e+=i<0?this.sections[n]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let n=0,i=0,r=0;n<this.sections.length;){let o=this.sections[n++],s=this.sections[n++];s<0?(e(i,r,o),r+=o):r+=s,i+=o}}iterChangedRanges(e,n=!1){G$(this,e,n)}get invertedDesc(){let e=[];for(let n=0;n<this.sections.length;){let i=this.sections[n++],r=this.sections[n++];r<0?e.push(i,r):e.push(r,i)}return new Aa(e)}composeDesc(e){return this.empty?e:e.empty?this:HU(this,e)}mapDesc(e,n=!1){return e.empty?this:F$(this,e,n)}mapPos(e,n=-1,i=or.Simple){let r=0,o=0;for(let s=0;s<this.sections.length;){let a=this.sections[s++],l=this.sections[s++],c=r+a;if(l<0){if(c>e)return o+(e-r);o+=a}else{if(i!=or.Simple&&c>=e&&(i==or.TrackDel&&r<e&&c>e||i==or.TrackBefore&&r<e||i==or.TrackAfter&&c>e))return null;if(c>e||c==e&&n<0&&!a)return e==r||n<0?o:o+l;o+=l}r=c}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return o}touchesRange(e,n=e){for(let i=0,r=0;i<this.sections.length&&r<=n;){let o=this.sections[i++],s=this.sections[i++],a=r+o;if(s>=0&&r<=n&&a>=e)return r<e&&a>n?"cover":!0;r=a}return!1}toString(){let e="";for(let n=0;n<this.sections.length;){let i=this.sections[n++],r=this.sections[n++];e+=(e?" ":"")+i+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Aa(e)}static create(e){return new Aa(e)}}class Qi extends Aa{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return G$(this,(n,i,r,o,s)=>e=e.replace(r,r+(i-n),s),!1),e}mapDesc(e,n=!1){return F$(this,e,n,!0)}invert(e){let n=this.sections.slice(),i=[];for(let r=0,o=0;r<n.length;r+=2){let s=n[r],a=n[r+1];if(a>=0){n[r]=a,n[r+1]=s;let l=r>>1;for(;i.length<l;)i.push(bn.empty);i.push(s?e.slice(o,o+s):bn.empty)}o+=s}return new Qi(n,i)}compose(e){return this.empty?e:e.empty?this:HU(this,e,!0)}map(e,n=!1){return e.empty?this:F$(this,e,n,!0)}iterChanges(e,n=!1){G$(this,e,n)}get desc(){return Aa.create(this.sections)}filter(e){let n=[],i=[],r=[],o=new Zh(this);e:for(let s=0,a=0;;){let l=s==e.length?1e9:e[s++];for(;a<l||a==l&&o.len==0;){if(o.done)break e;let u=Math.min(o.len,l-a);ao(r,u,-1);let f=o.ins==-1?-1:o.off==0?o.ins:0;ao(n,u,f),f>0&&Ou(i,n,o.text),o.forward(u),a+=u}let c=e[s++];for(;a<c;){if(o.done)break e;let u=Math.min(o.len,c-a);ao(n,u,-1),ao(r,u,o.ins==-1?-1:o.off==0?o.ins:0),o.forward(u),a+=u}}return{changes:new Qi(n,i),filtered:Aa.create(r)}}toJSON(){let e=[];for(let n=0;n<this.sections.length;n+=2){let i=this.sections[n],r=this.sections[n+1];r<0?e.push(i):r==0?e.push([i]):e.push([i].concat(this.inserted[n>>1].toJSON()))}return e}static of(e,n,i){let r=[],o=[],s=0,a=null;function l(u=!1){if(!u&&!r.length)return;s<n&&ao(r,n-s,-1);let f=new Qi(r,o);a=a?a.compose(f.map(a)):f,r=[],o=[],s=0}function c(u){if(Array.isArray(u))for(let f of u)c(f);else if(u instanceof Qi){if(u.length!=n)throw new RangeError(`Mismatched change set length (got ${u.length}, expected ${n})`);l(),a=a?a.compose(u.map(a)):u}else{let{from:f,to:h=f,insert:d}=u;if(f>h||f<0||h>n)throw new RangeError(`Invalid change range ${f} to ${h} (in doc of length ${n})`);let y=d?typeof d=="string"?bn.of(d.split(i||B$)):d:bn.empty,$=y.length;if(f==h&&$==0)return;f<s&&l(),f>s&&ao(r,f-s,-1),ao(r,h-f,$),Ou(o,r,y),s=h}}return c(e),l(!a),a}static empty(e){return new Qi(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],i=[];for(let r=0;r<e.length;r++){let o=e[r];if(typeof o=="number")n.push(o,-1);else{if(!Array.isArray(o)||typeof o[0]!="number"||o.some((s,a)=>a&&typeof s!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(o.length==1)n.push(o[0],0);else{for(;i.length<r;)i.push(bn.empty);i[r]=bn.of(o.slice(1)),n.push(o[0],i[r].length)}}}return new Qi(n,i)}static createSet(e,n){return new Qi(e,n)}}function ao(t,e,n,i=!1){if(e==0&&n<=0)return;let r=t.length-2;r>=0&&n<=0&&n==t[r+1]?t[r]+=e:e==0&&t[r]==0?t[r+1]+=n:i?(t[r]+=e,t[r+1]+=n):t.push(e,n)}function Ou(t,e,n){if(n.length==0)return;let i=e.length-2>>1;if(i<t.length)t[t.length-1]=t[t.length-1].append(n);else{for(;t.length<i;)t.push(bn.empty);t.push(n)}}function G$(t,e,n){let i=t.inserted;for(let r=0,o=0,s=0;s<t.sections.length;){let a=t.sections[s++],l=t.sections[s++];if(l<0)r+=a,o+=a;else{let c=r,u=o,f=bn.empty;for(;c+=a,u+=l,l&&i&&(f=f.append(i[s-2>>1])),!(n||s==t.sections.length||t.sections[s+1]<0);)a=t.sections[s++],l=t.sections[s++];e(r,c,o,u,f),r=c,o=u}}}function F$(t,e,n,i=!1){let r=[],o=i?[]:null,s=new Zh(t),a=new Zh(e);for(let l=0,c=0;;)if(s.ins==-1)l+=s.len,s.next();else if(a.ins==-1&&c<l){let u=Math.min(a.len,l-c);a.forward(u),ao(r,u,-1),c+=u}else if(a.ins>=0&&(s.done||c<l||c==l&&(a.len<s.len||a.len==s.len&&!n))){for(ao(r,a.ins,-1);l>c&&!s.done&&l+s.len<c+a.len;)l+=s.len,s.next();c+=a.len,a.next()}else if(s.ins>=0){let u=0,f=l+s.len;for(;;)if(a.ins>=0&&c>l&&c+a.len<f)u+=a.ins,c+=a.len,a.next();else if(a.ins==-1&&c<f){let h=Math.min(a.len,f-c);u+=h,a.forward(h),c+=h}else break;ao(r,u,s.ins),o&&Ou(o,r,s.text),l=f,s.next()}else{if(s.done&&a.done)return o?Qi.createSet(r,o):Aa.create(r);throw new Error("Mismatched change set lengths")}}function HU(t,e,n=!1){let i=[],r=n?[]:null,o=new Zh(t),s=new Zh(e);for(let a=!1;;){if(o.done&&s.done)return r?Qi.createSet(i,r):Aa.create(i);if(o.ins==0)ao(i,o.len,0,a),o.next();else if(s.len==0&&!s.done)ao(i,0,s.ins,a),r&&Ou(r,i,s.text),s.next();else{if(o.done||s.done)throw new Error("Mismatched change set lengths");{let l=Math.min(o.len2,s.len),c=i.length;if(o.ins==-1){let u=s.ins==-1?-1:s.off?0:s.ins;ao(i,l,u,a),r&&u&&Ou(r,i,s.text)}else s.ins==-1?(ao(i,o.off?0:o.len,l,a),r&&Ou(r,i,o.textBit(l))):(ao(i,o.off?0:o.len,s.off?0:s.ins,a),r&&!s.off&&Ou(r,i,s.text));a=(o.ins>l||s.ins>=0&&s.len>l)&&(a||i.length>c),o.forward2(l),s.forward(l)}}}}class Zh{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,n=this.i-2>>1;return n>=e.length?bn.empty:e[n]}textBit(e){let{inserted:n}=this.set,i=this.i-2>>1;return i>=n.length&&!e?bn.empty:n[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class fu{constructor(e,n,i){this.from=e,this.to=n,this.flags=i}get anchor(){return this.flags&16?this.to:this.from}get head(){return this.flags&16?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&4?-1:this.flags&8?1:0}get bidiLevel(){let e=this.flags&3;return e==3?null:e}get goalColumn(){let e=this.flags>>5;return e==33554431?void 0:e}map(e,n=-1){let i,r;return this.empty?i=r=e.mapPos(this.from,n):(i=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),i==this.from&&r==this.to?this:new fu(i,r,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return ye.range(e,n);let i=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return ye.range(this.anchor,i)}eq(e){return this.anchor==e.anchor&&this.head==e.head}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return ye.range(e.anchor,e.head)}static create(e,n,i){return new fu(e,n,i)}}class ye{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:ye.create(this.ranges.map(i=>i.map(e,n)),this.mainIndex)}eq(e){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n]))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new ye([this.main],0)}addRange(e,n=!0){return ye.create([e].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(e,n=this.mainIndex){let i=this.ranges.slice();return i[n]=e,ye.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new ye(e.ranges.map(n=>fu.fromJSON(n)),e.main)}static single(e,n=e){return new ye([ye.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,r=0;r<e.length;r++){let o=e[r];if(o.empty?o.from<=i:o.from<i)return ye.normalized(e.slice(),n);i=o.to}return new ye(e,n)}static cursor(e,n=0,i,r){return fu.create(e,e,(n==0?0:n<0?4:8)|(i==null?3:Math.min(2,i))|(r!=null?r:33554431)<<5)}static range(e,n,i){let r=(i!=null?i:33554431)<<5;return n<e?fu.create(n,e,16|r|8):fu.create(e,n,r|(n>e?4:0))}static normalized(e,n=0){let i=e[n];e.sort((r,o)=>r.from-o.from),n=e.indexOf(i);for(let r=1;r<e.length;r++){let o=e[r],s=e[r-1];if(o.empty?o.from<=s.to:o.from<s.to){let a=s.from,l=Math.max(o.to,s.to);r<=n&&n--,e.splice(--r,2,o.anchor>o.head?ye.range(l,a):ye.range(a,l))}}return new ye(e,n)}}function KU(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let Kk=0;class tt{constructor(e,n,i,r,o){this.combine=e,this.compareInput=n,this.compare=i,this.isStatic=r,this.extensions=o,this.id=Kk++,this.default=e([])}static define(e={}){return new tt(e.combine||(n=>n),e.compareInput||((n,i)=>n===i),e.compare||(e.combine?(n,i)=>n===i:Jk),!!e.static,e.enables)}of(e){return new Zg([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Zg(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Zg(e,this,2,n)}from(e,n){return n||(n=i=>i),this.compute([e],i=>n(i.field(e)))}}function Jk(t,e){return t==e||t.length==e.length&&t.every((n,i)=>n===e[i])}class Zg{constructor(e,n,i,r){this.dependencies=e,this.facet=n,this.type=i,this.value=r,this.id=Kk++}dynamicSlot(e){var n;let i=this.value,r=this.facet.compareInput,o=this.id,s=e[o]>>1,a=this.type==2,l=!1,c=!1,u=[];for(let f of this.dependencies)f=="doc"?l=!0:f=="selection"?c=!0:(((n=e[f.id])!==null&&n!==void 0?n:1)&1)==0&&u.push(e[f.id]);return{create(f){return f.values[s]=i(f),1},update(f,h){if(l&&h.docChanged||c&&(h.docChanged||h.selection)||H$(f,u)){let d=i(f);if(a?!zX(d,f.values[s],r):!r(d,f.values[s]))return f.values[s]=d,1}return 0},reconfigure:(f,h)=>{let d=i(f),y=h.config.address[o];if(y!=null){let $=Vy(h,y);if(this.dependencies.every(b=>b instanceof tt?h.facet(b)===f.facet(b):b instanceof wi?h.field(b,!1)==f.field(b,!1):!0)||(a?zX(d,$,r):r(d,$)))return f.values[s]=$,0}return f.values[s]=d,1}}}}function zX(t,e,n){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++)if(!n(t[i],e[i]))return!1;return!0}function H$(t,e){let n=!1;for(let i of e)lh(t,i)&1&&(n=!0);return n}function Gfe(t,e,n){let i=n.map(l=>t[l.id]),r=n.map(l=>l.type),o=i.filter(l=>!(l&1)),s=t[e.id]>>1;function a(l){let c=[];for(let u=0;u<i.length;u++){let f=Vy(l,i[u]);if(r[u]==2)for(let h of f)c.push(h);else c.push(f)}return e.combine(c)}return{create(l){for(let c of i)lh(l,c);return l.values[s]=a(l),1},update(l,c){if(!H$(l,o))return 0;let u=a(l);return e.compare(u,l.values[s])?0:(l.values[s]=u,1)},reconfigure(l,c){let u=H$(l,i),f=c.config.facets[e.id],h=c.facet(e);if(f&&!u&&Jk(n,f))return l.values[s]=h,0;let d=a(l);return e.compare(d,h)?(l.values[s]=h,0):(l.values[s]=d,1)}}}const EX=tt.define({static:!0});class wi{constructor(e,n,i,r,o){this.id=e,this.createF=n,this.updateF=i,this.compareF=r,this.spec=o,this.provides=void 0}static define(e){let n=new wi(Kk++,e.create,e.update,e.compare||((i,r)=>i===r),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(EX).find(i=>i.field==this);return((n==null?void 0:n.create)||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:i=>(i.values[n]=this.create(i),1),update:(i,r)=>{let o=i.values[n],s=this.updateF(o,r);return this.compareF(o,s)?0:(i.values[n]=s,1)},reconfigure:(i,r)=>r.config.address[this.id]!=null?(i.values[n]=r.field(this),0):(i.values[n]=this.create(i),1)}}init(e){return[this,EX.of({field:this,create:e})]}get extension(){return this}}const pO={lowest:4,low:3,default:2,high:1,highest:0};function Sd(t){return e=>new JU(e,t)}const ql={highest:Sd(pO.highest),high:Sd(pO.high),default:Sd(pO.default),low:Sd(pO.low),lowest:Sd(pO.lowest)};class JU{constructor(e,n){this.inner=e,this.prec=n}}class _1{of(e){return new K$(this,e)}reconfigure(e){return _1.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class K${constructor(e,n){this.compartment=e,this.inner=n}}class My{constructor(e,n,i,r,o,s){for(this.base=e,this.compartments=n,this.dynamicSlots=i,this.address=r,this.staticValues=o,this.facets=s,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let n=this.address[e.id];return n==null?e.default:this.staticValues[n>>1]}static resolve(e,n,i){let r=[],o=Object.create(null),s=new Map;for(let h of Ffe(e,n,s))h instanceof wi?r.push(h):(o[h.facet.id]||(o[h.facet.id]=[])).push(h);let a=Object.create(null),l=[],c=[];for(let h of r)a[h.id]=c.length<<1,c.push(d=>h.slot(d));let u=i==null?void 0:i.config.facets;for(let h in o){let d=o[h],y=d[0].facet,$=u&&u[h]||[];if(d.every(b=>b.type==0))if(a[y.id]=l.length<<1|1,Jk($,d))l.push(i.facet(y));else{let b=y.combine(d.map(m=>m.value));l.push(i&&y.compare(b,i.facet(y))?i.facet(y):b)}else{for(let b of d)b.type==0?(a[b.id]=l.length<<1|1,l.push(b.value)):(a[b.id]=c.length<<1,c.push(m=>b.dynamicSlot(m)));a[y.id]=c.length<<1,c.push(b=>Gfe(b,y,d))}}let f=c.map(h=>h(a));return new My(e,s,f,a,l,o)}}function Ffe(t,e,n){let i=[[],[],[],[],[]],r=new Map;function o(s,a){let l=r.get(s);if(l!=null){if(l<=a)return;let c=i[l].indexOf(s);c>-1&&i[l].splice(c,1),s instanceof K$&&n.delete(s.compartment)}if(r.set(s,a),Array.isArray(s))for(let c of s)o(c,a);else if(s instanceof K$){if(n.has(s.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(s.compartment)||s.inner;n.set(s.compartment,c),o(c,a)}else if(s instanceof JU)o(s.inner,s.prec);else if(s instanceof wi)i[a].push(s),s.provides&&o(s.provides,a);else if(s instanceof Zg)i[a].push(s),s.facet.extensions&&o(s.facet.extensions,a);else{let c=s.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${s}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(c,a)}}return o(t,pO.default),i.reduce((s,a)=>s.concat(a))}function lh(t,e){if(e&1)return 2;let n=e>>1,i=t.status[n];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;t.status[n]=4;let r=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|r}function Vy(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const eA=tt.define(),tA=tt.define({combine:t=>t.some(e=>e),static:!0}),nA=tt.define({combine:t=>t.length?t[0]:void 0,static:!0}),iA=tt.define(),rA=tt.define(),oA=tt.define(),sA=tt.define({combine:t=>t.length?t[0]:!1});class qc{constructor(e,n){this.type=e,this.value=n}static define(){return new Hfe}}class Hfe{of(e){return new qc(this,e)}}class Kfe{constructor(e){this.map=e}of(e){return new yt(this,e)}}class yt{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new yt(this.type,n)}is(e){return this.type==e}static define(e={}){return new Kfe(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let i=[];for(let r of e){let o=r.map(n);o&&i.push(o)}return i}}yt.reconfigure=yt.define();yt.appendConfig=yt.define();class Ai{constructor(e,n,i,r,o,s){this.startState=e,this.changes=n,this.selection=i,this.effects=r,this.annotations=o,this.scrollIntoView=s,this._doc=null,this._state=null,i&&KU(i,n.newLength),o.some(a=>a.type==Ai.time)||(this.annotations=o.concat(Ai.time.of(Date.now())))}static create(e,n,i,r,o,s){return new Ai(e,n,i,r,o,s)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(Ai.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}Ai.time=qc.define();Ai.userEvent=qc.define();Ai.addToHistory=qc.define();Ai.remote=qc.define();function Jfe(t,e){let n=[];for(let i=0,r=0;;){let o,s;if(i<t.length&&(r==e.length||e[r]>=t[i]))o=t[i++],s=t[i++];else if(r<e.length)o=e[r++],s=e[r++];else return n;!n.length||n[n.length-1]<o?n.push(o,s):n[n.length-1]<s&&(n[n.length-1]=s)}}function aA(t,e,n){var i;let r,o,s;return n?(r=e.changes,o=Qi.empty(e.changes.length),s=t.changes.compose(e.changes)):(r=e.changes.map(t.changes),o=t.changes.mapDesc(e.changes,!0),s=t.changes.compose(r)),{changes:s,selection:e.selection?e.selection.map(o):(i=t.selection)===null||i===void 0?void 0:i.map(r),effects:yt.mapEffects(t.effects,r).concat(yt.mapEffects(e.effects,o)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function J$(t,e,n){let i=e.selection,r=DO(e.annotations);return e.userEvent&&(r=r.concat(Ai.userEvent.of(e.userEvent))),{changes:e.changes instanceof Qi?e.changes:Qi.of(e.changes||[],n,t.facet(nA)),selection:i&&(i instanceof ye?i:ye.single(i.anchor,i.head)),effects:DO(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function lA(t,e,n){let i=J$(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(n=!1);for(let o=1;o<e.length;o++){e[o].filter===!1&&(n=!1);let s=!!e[o].sequential;i=aA(i,J$(t,e[o],s?i.changes.newLength:t.doc.length),s)}let r=Ai.create(t,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return tde(n?ede(r):r)}function ede(t){let e=t.startState,n=!0;for(let r of e.facet(iA)){let o=r(t);if(o===!1){n=!1;break}Array.isArray(o)&&(n=n===!0?o:Jfe(n,o))}if(n!==!0){let r,o;if(n===!1)o=t.changes.invertedDesc,r=Qi.empty(e.doc.length);else{let s=t.changes.filter(n);r=s.changes,o=s.filtered.mapDesc(s.changes).invertedDesc}t=Ai.create(e,r,t.selection&&t.selection.map(o),yt.mapEffects(t.effects,o),t.annotations,t.scrollIntoView)}let i=e.facet(rA);for(let r=i.length-1;r>=0;r--){let o=i[r](t);o instanceof Ai?t=o:Array.isArray(o)&&o.length==1&&o[0]instanceof Ai?t=o[0]:t=lA(e,DO(o),!1)}return t}function tde(t){let e=t.startState,n=e.facet(oA),i=t;for(let r=n.length-1;r>=0;r--){let o=n[r](t);o&&Object.keys(o).length&&(i=aA(t,J$(e,o,t.changes.newLength),!0))}return i==t?t:Ai.create(e,t.changes,t.selection,i.effects,i.annotations,i.scrollIntoView)}const nde=[];function DO(t){return t==null?nde:Array.isArray(t)?t:[t]}var lo=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(lo||(lo={}));const ide=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let ew;try{ew=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function rde(t){if(ew)return ew.test(t);for(let e=0;e<t.length;e++){let n=t[e];if(/\w/.test(n)||n>"\x80"&&(n.toUpperCase()!=n.toLowerCase()||ide.test(n)))return!0}return!1}function ode(t){return e=>{if(!/\S/.test(e))return lo.Space;if(rde(e))return lo.Word;for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return lo.Word;return lo.Other}}class on{constructor(e,n,i,r,o,s){this.config=e,this.doc=n,this.selection=i,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=o,s&&(s._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)lh(this,a<<1);this.computeSlot=null}field(e,n=!0){let i=this.config.address[e.id];if(i==null){if(n)throw new RangeError("Field is not present in this state");return}return lh(this,i),Vy(this,i)}update(...e){return lA(this,e,!0)}applyTransaction(e){let n=this.config,{base:i,compartments:r}=n;for(let s of e.effects)s.is(_1.reconfigure)?(n&&(r=new Map,n.compartments.forEach((a,l)=>r.set(l,a)),n=null),r.set(s.value.compartment,s.value.extension)):s.is(yt.reconfigure)?(n=null,i=s.value):s.is(yt.appendConfig)&&(n=null,i=DO(i).concat(s.value));let o;n?o=e.startState.values.slice():(n=My.resolve(i,r,this),o=new on(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(a,l)=>l.reconfigure(a,this),null).values),new on(n,e.newDoc,e.newSelection,o,(s,a)=>a.update(s,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:ye.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,i=e(n.ranges[0]),r=this.changes(i.changes),o=[i.range],s=DO(i.effects);for(let a=1;a<n.ranges.length;a++){let l=e(n.ranges[a]),c=this.changes(l.changes),u=c.map(r);for(let h=0;h<a;h++)o[h]=o[h].map(u);let f=r.mapDesc(c,!0);o.push(l.range.map(f)),r=r.compose(u),s=yt.mapEffects(s,u).concat(yt.mapEffects(DO(l.effects),f))}return{changes:r,selection:ye.create(o,n.mainIndex),effects:s}}changes(e=[]){return e instanceof Qi?e:Qi.of(e,this.doc.length,this.facet(on.lineSeparator))}toText(e){return bn.of(e.split(this.facet(on.lineSeparator)||B$))}sliceDoc(e=0,n=this.doc.length){return this.doc.sliceString(e,n,this.lineBreak)}facet(e){let n=this.config.address[e.id];return n==null?e.default:(lh(this,n),Vy(this,n))}toJSON(e){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let r=e[i];r instanceof wi&&(n[i]=r.spec.toJSON(this.field(e[i]),this))}return n}static fromJSON(e,n={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let r=[];if(i)for(let o in i){let s=i[o],a=e[o];r.push(s.init(l=>s.spec.fromJSON(a,l)))}return on.create({doc:e.doc,selection:ye.fromJSON(e.selection),extensions:n.extensions?r.concat([n.extensions]):r})}static create(e={}){let n=My.resolve(e.extensions||[],new Map),i=e.doc instanceof bn?e.doc:bn.of((e.doc||"").split(n.staticFacet(on.lineSeparator)||B$)),r=e.selection?e.selection instanceof ye?e.selection:ye.single(e.selection.anchor,e.selection.head):ye.single(0);return KU(r,i.length),n.staticFacet(tA)||(r=r.asSingle()),new on(n,i,r,n.dynamicSlots.map(()=>null),(o,s)=>s.create(o),null)}get tabSize(){return this.facet(on.tabSize)}get lineBreak(){return this.facet(on.lineSeparator)||`
|
|
1018
1018
|
`}get readOnly(){return this.facet(sA)}phrase(e,...n){for(let i of this.facet(on.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(i,r)=>{if(r=="$")return"$";let o=+(r||1);return!o||o>n.length?i:n[o-1]})),e}languageDataAt(e,n,i=-1){let r=[];for(let o of this.facet(eA))for(let s of o(this,n,i))Object.prototype.hasOwnProperty.call(s,e)&&r.push(s[e]);return r}charCategorizer(e){return ode(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:n,from:i,length:r}=this.doc.lineAt(e),o=this.charCategorizer(e),s=e-i,a=e-i;for(;s>0;){let l=Ko(n,s,!1);if(o(n.slice(l,s))!=lo.Word)break;s=l}for(;a<r;){let l=Ko(n,a);if(o(n.slice(a,l))!=lo.Word)break;a=l}return s==a?null:ye.range(s+i,a+i)}}on.allowMultipleSelections=tA;on.tabSize=tt.define({combine:t=>t.length?t[0]:4});on.lineSeparator=nA;on.readOnly=sA;on.phrases=tt.define({compare(t,e){let n=Object.keys(t),i=Object.keys(e);return n.length==i.length&&n.every(r=>t[r]==e[r])}});on.languageData=eA;on.changeFilter=iA;on.transactionFilter=rA;on.transactionExtender=oA;_1.reconfigure=yt.define();function cs(t,e,n={}){let i={};for(let r of t)for(let o of Object.keys(r)){let s=r[o],a=i[o];if(a===void 0)i[o]=s;else if(!(a===s||s===void 0))if(Object.hasOwnProperty.call(n,o))i[o]=n[o](a,s);else throw new Error("Config merge conflict for field "+o)}for(let r in e)i[r]===void 0&&(i[r]=e[r]);return i}class Tu{eq(e){return this==e}range(e,n=e){return jh.create(e,n,this)}}Tu.prototype.startSide=Tu.prototype.endSide=0;Tu.prototype.point=!1;Tu.prototype.mapMode=or.TrackDel;class jh{constructor(e,n,i){this.from=e,this.to=n,this.value=i}static create(e,n,i){return new jh(e,n,i)}}function tw(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class eT{constructor(e,n,i,r){this.from=e,this.to=n,this.value=i,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,n,i,r=0){let o=i?this.to:this.from;for(let s=r,a=o.length;;){if(s==a)return s;let l=s+a>>1,c=o[l]-e||(i?this.value[l].endSide:this.value[l].startSide)-n;if(l==s)return c>=0?s:a;c>=0?a=l:s=l+1}}between(e,n,i,r){for(let o=this.findIndex(n,-1e9,!0),s=this.findIndex(i,1e9,!1,o);o<s;o++)if(r(this.from[o]+e,this.to[o]+e,this.value[o])===!1)return!1}map(e,n){let i=[],r=[],o=[],s=-1,a=-1;for(let l=0;l<this.value.length;l++){let c=this.value[l],u=this.from[l]+e,f=this.to[l]+e,h,d;if(u==f){let y=n.mapPos(u,c.startSide,c.mapMode);if(y==null||(h=d=y,c.startSide!=c.endSide&&(d=n.mapPos(u,c.endSide),d<h)))continue}else if(h=n.mapPos(u,c.startSide),d=n.mapPos(f,c.endSide),h>d||h==d&&c.startSide>0&&c.endSide<=0)continue;(d-h||c.endSide-c.startSide)<0||(s<0&&(s=h),c.point&&(a=Math.max(a,d-h)),i.push(c),r.push(h-s),o.push(d-s))}return{mapped:i.length?new eT(r,o,i,a):null,pos:s}}}class Tn{constructor(e,n,i,r){this.chunkPos=e,this.chunk=n,this.nextLayer=i,this.maxPoint=r}static create(e,n,i,r){return new Tn(e,n,i,r)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:i=!1,filterFrom:r=0,filterTo:o=this.length}=e,s=e.filter;if(n.length==0&&!s)return this;if(i&&(n=n.slice().sort(tw)),this.isEmpty)return n.length?Tn.of(n):this;let a=new cA(this,null,-1).goto(0),l=0,c=[],u=new Cl;for(;a.value||l<n.length;)if(l<n.length&&(a.from-n[l].from||a.startSide-n[l].value.startSide)>=0){let f=n[l++];u.addInner(f.from,f.to,f.value)||c.push(f)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==n.length||this.chunkEnd(a.chunkIndex)<n[l].from)&&(!s||r>this.chunkEnd(a.chunkIndex)||o<this.chunkPos[a.chunkIndex])&&u.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!s||r>a.to||o<a.from||s(a.from,a.to,a.value))&&(u.addInner(a.from,a.to,a.value)||c.push(jh.create(a.from,a.to,a.value))),a.next());return u.finishInner(this.nextLayer.isEmpty&&!c.length?Tn.empty:this.nextLayer.update({add:c,filter:s,filterFrom:r,filterTo:o}))}map(e){if(e.empty||this.isEmpty)return this;let n=[],i=[],r=-1;for(let s=0;s<this.chunk.length;s++){let a=this.chunkPos[s],l=this.chunk[s],c=e.touchesRange(a,a+l.length);if(c===!1)r=Math.max(r,l.maxPoint),n.push(l),i.push(e.mapPos(a));else if(c===!0){let{mapped:u,pos:f}=l.map(a,e);u&&(r=Math.max(r,u.maxPoint),n.push(u),i.push(f))}}let o=this.nextLayer.map(e);return n.length==0?o:new Tn(i,n,o||Tn.empty,r)}between(e,n,i){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let o=this.chunkPos[r],s=this.chunk[r];if(n>=o&&e<=o+s.length&&s.between(o,e-o,n-o,i)===!1)return}this.nextLayer.between(e,n,i)}}iter(e=0){return Dh.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return Dh.from(e).goto(n)}static compare(e,n,i,r,o=-1){let s=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=o),a=n.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=o),l=qX(s,a,i),c=new $d(s,l,o),u=new $d(a,l,o);i.iterGaps((f,h,d)=>UX(c,f,u,h,d,r)),i.empty&&i.length==0&&UX(c,0,u,0,0,r)}static eq(e,n,i=0,r){r==null&&(r=1e9);let o=e.filter(u=>!u.isEmpty&&n.indexOf(u)<0),s=n.filter(u=>!u.isEmpty&&e.indexOf(u)<0);if(o.length!=s.length)return!1;if(!o.length)return!0;let a=qX(o,s),l=new $d(o,a,0).goto(i),c=new $d(s,a,0).goto(i);for(;;){if(l.to!=c.to||!nw(l.active,c.active)||l.point&&(!c.point||!l.point.eq(c.point)))return!1;if(l.to>r)return!0;l.next(),c.next()}}static spans(e,n,i,r,o=-1){let s=new $d(e,null,o).goto(n),a=n,l=s.openStart;for(;;){let c=Math.min(s.to,i);if(s.point?(r.point(a,c,s.point,s.activeForPoint(s.to),l,s.pointRank),l=s.openEnd(c)+(s.to>c?1:0)):c>a&&(r.span(a,c,s.active,l),l=s.openEnd(c)),s.to>i)break;a=s.to,s.next()}return l}static of(e,n=!1){let i=new Cl;for(let r of e instanceof jh?[e]:n?sde(e):e)i.add(r.from,r.to,r.value);return i.finish()}}Tn.empty=new Tn([],[],null,-1);function sde(t){if(t.length>1)for(let e=t[0],n=1;n<t.length;n++){let i=t[n];if(tw(e,i)>0)return t.slice().sort(tw);e=i}return t}Tn.empty.nextLayer=Tn.empty;class Cl{constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}finishChunk(e){this.chunks.push(new eT(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}add(e,n,i){this.addInner(e,n,i)||(this.nextLayer||(this.nextLayer=new Cl)).add(e,n,i)}addInner(e,n,i){let r=e-this.lastTo||i.startSide-this.last.endSide;if(r<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return r<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(n-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=n,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,n-e)),!0)}addChunk(e,n){if((e-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(e);let i=n.value.length-1;return this.last=n.value[i],this.lastFrom=n.from[i]+e,this.lastTo=n.to[i]+e,!0}finish(){return this.finishInner(Tn.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=Tn.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function qX(t,e,n){let i=new Map;for(let o of t)for(let s=0;s<o.chunk.length;s++)o.chunk[s].maxPoint<=0&&i.set(o.chunk[s],o.chunkPos[s]);let r=new Set;for(let o of e)for(let s=0;s<o.chunk.length;s++){let a=i.get(o.chunk[s]);a!=null&&(n?n.mapPos(a):a)==o.chunkPos[s]&&!(n!=null&&n.touchesRange(a,a+o.chunk[s].length))&&r.add(o.chunk[s])}return r}class cA{constructor(e,n,i,r=0){this.layer=e,this.skip=n,this.minPoint=i,this.rank=r}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,n=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,n,!1),this}gotoInner(e,n,i){for(;this.chunkIndex<this.layer.chunk.length;){let r=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(r)||this.layer.chunkEnd(this.chunkIndex)<e||r.maxPoint<this.minPoint))break;this.chunkIndex++,i=!1}if(this.chunkIndex<this.layer.chunk.length){let r=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],n,!0);(!i||this.rangeIndex<r)&&this.setRangeIndex(r)}this.next()}forward(e,n){(this.to-e||this.endSide-n)<0&&this.gotoInner(e,n,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],n=this.layer.chunk[this.chunkIndex],i=e+n.from[this.rangeIndex];if(this.from=i,this.to=e+n.to[this.rangeIndex],this.value=n.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Dh{constructor(e){this.heap=e}static from(e,n=null,i=-1){let r=[];for(let o=0;o<e.length;o++)for(let s=e[o];!s.isEmpty;s=s.nextLayer)s.maxPoint>=i&&r.push(new cA(s,n,i,o));return r.length==1?r[0]:new Dh(r)}get startSide(){return this.value?this.value.startSide:0}goto(e,n=-1e9){for(let i of this.heap)i.goto(e,n);for(let i=this.heap.length>>1;i>=0;i--)gQ(this.heap,i);return this.next(),this}forward(e,n){for(let i of this.heap)i.forward(e,n);for(let i=this.heap.length>>1;i>=0;i--)gQ(this.heap,i);(this.to-e||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),gQ(this.heap,0)}}}function gQ(t,e){for(let n=t[e];;){let i=(e<<1)+1;if(i>=t.length)break;let r=t[i];if(i+1<t.length&&r.compare(t[i+1])>=0&&(r=t[i+1],i++),n.compare(r)<0)break;t[i]=n,t[e]=r,e=i}}class $d{constructor(e,n,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Dh.from(e,n,i)}goto(e,n=-1e9){return this.cursor.goto(e,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=n,this.openStart=-1,this.next(),this}forward(e,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(e,n)}removeActive(e){Vm(this.active,e),Vm(this.activeTo,e),Vm(this.activeRank,e),this.minActive=AX(this.active,this.activeTo)}addActive(e){let n=0,{value:i,to:r,rank:o}=this.cursor;for(;n<this.activeRank.length&&this.activeRank[n]<=o;)n++;Nm(this.active,n,i),Nm(this.activeTo,n,r),Nm(this.activeRank,n,o),e&&Nm(e,n,this.cursor.from),this.minActive=AX(this.active,this.activeTo)}next(){let e=this.to,n=this.point;this.point=null;let i=this.openStart<0?[]:null,r=0;for(;;){let o=this.minActive;if(o>-1&&(this.activeTo[o]-this.cursor.from||this.active[o].endSide-this.cursor.startSide)<0){if(this.activeTo[o]>e){this.to=this.activeTo[o],this.endSide=this.active[o].endSide;break}this.removeActive(o),i&&Vm(i,o)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(i),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=s,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=s.endSide,this.cursor.from<e&&(r=1),this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(i){let o=0;for(;o<i.length&&i[o]<e;)o++;this.openStart=o+r}}activeForPoint(e){if(!this.active.length)return this.active;let n=[];for(let i=this.active.length-1;i>=0&&!(this.activeRank[i]<this.pointRank);i--)(this.activeTo[i]>e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&n.push(this.active[i]);return n.reverse()}openEnd(e){let n=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)n++;return n}}function UX(t,e,n,i,r,o){t.goto(e),n.goto(i);let s=i+r,a=i,l=i-e;for(;;){let c=t.to+l-n.to||t.endSide-n.endSide,u=c<0?t.to+l:n.to,f=Math.min(u,s);if(t.point||n.point?t.point&&n.point&&(t.point==n.point||t.point.eq(n.point))&&nw(t.activeForPoint(t.to+l),n.activeForPoint(n.to))||o.comparePoint(a,f,t.point,n.point):f>a&&!nw(t.active,n.active)&&o.compareRange(a,f,t.active,n.active),u>s)break;a=u,c<=0&&t.next(),c>=0&&n.next()}}function nw(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!=e[n]&&!t[n].eq(e[n]))return!1;return!0}function Vm(t,e){for(let n=e,i=t.length-1;n<i;n++)t[n]=t[n+1];t.pop()}function Nm(t,e,n){for(let i=t.length-1;i>=e;i--)t[i+1]=t[i];t[e]=n}function AX(t,e){let n=-1,i=1e9;for(let r=0;r<e.length;r++)(e[r]-i||t[r].endSide-t[n].endSide)<0&&(n=r,i=e[r]);return n}function Qp(t,e,n=t.length){let i=0;for(let r=0;r<n;)t.charCodeAt(r)==9?(i+=e-i%e,r++):(i++,r=Ko(t,r));return i}function iw(t,e,n,i){for(let r=0,o=0;;){if(o>=e)return r;if(r==t.length)break;o+=t.charCodeAt(r)==9?n-o%n:1,r=Ko(t,r)}return i===!0?-1:t.length}const rw="\u037C",IX=typeof Symbol=="undefined"?"__"+rw:Symbol.for(rw),ow=typeof Symbol=="undefined"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),LX=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:{};class xc{constructor(e,n){this.rules=[];let{finish:i}=n||{};function r(s){return/^@/.test(s)?[s]:s.split(/,\s*/)}function o(s,a,l,c){let u=[],f=/^@(\w+)\b/.exec(s[0]),h=f&&f[1]=="keyframes";if(f&&a==null)return l.push(s[0]+";");for(let d in a){let y=a[d];if(/&/.test(d))o(d.split(/,\s*/).map($=>s.map(b=>$.replace(/&/,b))).reduce(($,b)=>$.concat(b)),y,l);else if(y&&typeof y=="object"){if(!f)throw new RangeError("The value of a property ("+d+") should be a primitive value.");o(r(d),y,u,h)}else y!=null&&u.push(d.replace(/_.*/,"").replace(/[A-Z]/g,$=>"-"+$.toLowerCase())+": "+y+";")}(u.length||h)&&l.push((i&&!f&&!c?s.map(i):s).join(", ")+" {"+u.join(" ")+"}")}for(let s in e)o(r(s),e[s],this.rules)}getRules(){return this.rules.join(`
|
|
1019
1019
|
`)}static newName(){let e=LX[IX]||1;return LX[IX]=e+1,rw+e.toString(36)}static mount(e,n){(e[ow]||new ade(e)).mount(Array.isArray(n)?n:[n])}}let Bm=null;class ade{constructor(e){if(!e.head&&e.adoptedStyleSheets&&typeof CSSStyleSheet!="undefined"){if(Bm)return e.adoptedStyleSheets=[Bm.sheet].concat(e.adoptedStyleSheets),e[ow]=Bm;this.sheet=new CSSStyleSheet,e.adoptedStyleSheets=[this.sheet].concat(e.adoptedStyleSheets),Bm=this}else{this.styleTag=(e.ownerDocument||e).createElement("style");let n=e.head||e;n.insertBefore(this.styleTag,n.firstChild)}this.modules=[],e[ow]=this}mount(e){let n=this.sheet,i=0,r=0;for(let o=0;o<e.length;o++){let s=e[o],a=this.modules.indexOf(s);if(a<r&&a>-1&&(this.modules.splice(a,1),r--,a=-1),a==-1){if(this.modules.splice(r++,0,s),n)for(let l=0;l<s.rules.length;l++)n.insertRule(s.rules[l],i++)}else{for(;r<a;)i+=this.modules[r++].rules.length;i+=s.rules.length,r++}}if(!n){let o="";for(let s=0;s<this.modules.length;s++)o+=this.modules[s].getRules()+`
|
|
1020
1020
|
`;this.styleTag.textContent=o}}}var Pc={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",229:"q"},cf={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"',229:"Q"},YX=typeof navigator!="undefined"&&/Chrome\/(\d+)/.exec(navigator.userAgent),lde=typeof navigator!="undefined"&&/Apple Computer/.test(navigator.vendor),cde=typeof navigator!="undefined"&&/Gecko\/\d+/.test(navigator.userAgent),ZX=typeof navigator!="undefined"&&/Mac/.test(navigator.platform),ude=typeof navigator!="undefined"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Ode=YX&&(ZX||+YX[1]<57)||cde&&ZX;for(var Xr=0;Xr<10;Xr++)Pc[48+Xr]=Pc[96+Xr]=String(Xr);for(var Xr=1;Xr<=24;Xr++)Pc[Xr+111]="F"+Xr;for(var Xr=65;Xr<=90;Xr++)Pc[Xr]=String.fromCharCode(Xr+32),cf[Xr]=String.fromCharCode(Xr);for(var yQ in Pc)cf.hasOwnProperty(yQ)||(cf[yQ]=Pc[yQ]);function fde(t){var e=Ode&&(t.ctrlKey||t.altKey||t.metaKey)||(lde||ude)&&t.shiftKey&&t.key&&t.key.length==1,n=!e&&t.key||(t.shiftKey?cf:Pc)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}function Ny(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function uf(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function dde(){let t=document.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function sw(t,e){if(!e.anchorNode)return!1;try{return uf(t,e.anchorNode)}catch{return!1}}function Mh(t){return t.nodeType==3?Vh(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function By(t,e,n,i){return n?jX(t,e,n,i,-1)||jX(t,e,n,i,1):!1}function aw(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function jX(t,e,n,i,r){for(;;){if(t==n&&e==i)return!0;if(e==(r<0?0:Gy(t))){if(t.nodeName=="DIV")return!1;let o=t.parentNode;if(!o||o.nodeType!=1)return!1;e=aw(t)+(r<0?0:1),t=o}else if(t.nodeType==1){if(t=t.childNodes[e+(r<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=r<0?Gy(t):0}else return!1}}function Gy(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}const uA={left:0,right:0,top:0,bottom:0};function R1(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function hde(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function pde(t,e,n,i,r,o,s,a){let l=t.ownerDocument,c=l.defaultView;for(let u=t;u;)if(u.nodeType==1){let f,h=u==l.body;if(h)f=hde(c);else{if(u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.parentNode;continue}let $=u.getBoundingClientRect();f={left:$.left,right:$.left+u.clientWidth,top:$.top,bottom:$.top+u.clientHeight}}let d=0,y=0;if(r=="nearest")e.top<f.top?(y=-(f.top-e.top+s),n>0&&e.bottom>f.bottom+y&&(y=e.bottom-f.bottom+y+s)):e.bottom>f.bottom&&(y=e.bottom-f.bottom+s,n<0&&e.top-y<f.top&&(y=-(f.top+y-e.top+s)));else{let $=e.bottom-e.top,b=f.bottom-f.top;y=(r=="center"&&$<=b?e.top+$/2-b/2:r=="start"||r=="center"&&n<0?e.top-s:e.bottom-b+s)-f.top}if(i=="nearest"?e.left<f.left?(d=-(f.left-e.left+o),n>0&&e.right>f.right+d&&(d=e.right-f.right+d+o)):e.right>f.right&&(d=e.right-f.right+o,n<0&&e.left<f.left+d&&(d=-(f.left+d-e.left+o))):d=(i=="center"?e.left+(e.right-e.left)/2-(f.right-f.left)/2:i=="start"==a?e.left-o:e.right-(f.right-f.left)+o)-f.left,d||y)if(h)c.scrollBy(d,y);else{if(y){let $=u.scrollTop;u.scrollTop+=y,y=u.scrollTop-$}if(d){let $=u.scrollLeft;u.scrollLeft+=d,d=u.scrollLeft-$}e={left:e.left-d,top:e.top-y,right:e.right-d,bottom:e.bottom-y}}if(h)break;u=u.assignedSlot||u.parentNode,i=r="nearest"}else if(u.nodeType==11)u=u.host;else break}class mde{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){this.set(e.anchorNode,e.anchorOffset,e.focusNode,e.focusOffset)}set(e,n,i,r){this.anchorNode=e,this.anchorOffset=n,this.focusNode=i,this.focusOffset=r}}let cO=null;function OA(t){if(t.setActive)return t.setActive();if(cO)return t.focus(cO);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(cO==null?{get preventScroll(){return cO={preventScroll:!0},!0}}:void 0),!cO){cO=!1;for(let n=0;n<e.length;){let i=e[n++],r=e[n++],o=e[n++];i.scrollTop!=r&&(i.scrollTop=r),i.scrollLeft!=o&&(i.scrollLeft=o)}}}let DX;function Vh(t,e,n=e){let i=DX||(DX=document.createRange());return i.setEnd(t,n),i.setStart(t,e),i}function ch(t,e,n){let i={key:e,code:e,keyCode:n,which:n,cancelable:!0},r=new KeyboardEvent("keydown",i);r.synthetic=!0,t.dispatchEvent(r);let o=new KeyboardEvent("keyup",i);return o.synthetic=!0,t.dispatchEvent(o),r.defaultPrevented||o.defaultPrevented}function gde(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function fA(t){for(;t.attributes.length;)t.removeAttributeNode(t.attributes[0])}class Er{constructor(e,n,i=!0){this.node=e,this.offset=n,this.precise=i}static before(e,n){return new Er(e.parentNode,aw(e),n)}static after(e,n){return new Er(e.parentNode,aw(e)+1,n)}}const tT=[];class hi{constructor(){this.parent=null,this.dom=null,this.dirty=2}get editorView(){if(!this.parent)throw new Error("Accessing view in orphan content view");return this.parent.editorView}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let n=this.posAtStart;for(let i of this.children){if(i==e)return n;n+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}coordsAt(e,n){return null}sync(e){if(this.dirty&2){let n=this.dom,i=null,r;for(let o of this.children){if(o.dirty){if(!o.dom&&(r=i?i.nextSibling:n.firstChild)){let s=hi.get(r);(!s||!s.parent&&s.constructor==o.constructor)&&o.reuseDOM(r)}o.sync(e),o.dirty=0}if(r=i?i.nextSibling:n.firstChild,e&&!e.written&&e.node==n&&r!=o.dom&&(e.written=!0),o.dom.parentNode==n)for(;r&&r!=o.dom;)r=MX(r);else n.insertBefore(o.dom,r);i=o.dom}for(r=i?i.nextSibling:n.firstChild,r&&e&&e.node==n&&(e.written=!0);r;)r=MX(r)}else if(this.dirty&1)for(let n of this.children)n.dirty&&(n.sync(e),n.dirty=0)}reuseDOM(e){}localPosFromDOM(e,n){let i;if(e==this.dom)i=this.dom.childNodes[n];else{let r=Gy(e)==0?0:n==0?-1:1;for(;;){let o=e.parentNode;if(o==this.dom)break;r==0&&o.firstChild!=o.lastChild&&(e==o.firstChild?r=-1:r=1),e=o}r<0?i=e:i=e.nextSibling}if(i==this.dom.firstChild)return 0;for(;i&&!hi.get(i);)i=i.nextSibling;if(!i)return this.length;for(let r=0,o=0;;r++){let s=this.children[r];if(s.dom==i)return o;o+=s.length+s.breakAfter}}domBoundsAround(e,n,i=0){let r=-1,o=-1,s=-1,a=-1;for(let l=0,c=i,u=i;l<this.children.length;l++){let f=this.children[l],h=c+f.length;if(c<e&&h>n)return f.domBoundsAround(e,n,c);if(h>=e&&r==-1&&(r=l,o=c),c>n&&f.dom.parentNode==this.dom){s=l,a=u;break}u=h,c=h+f.breakAfter}return{from:o,to:a<0?i+this.length:a,startDOM:(r?this.children[r-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:s<this.children.length&&s>=0?this.children[s].dom:null}}markDirty(e=!1){this.dirty|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let n=this.parent;n;n=n.parent){if(e&&(n.dirty|=2),n.dirty&1)return;n.dirty|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.dirty&&this.markParentsDirty(!0))}setDOM(e){this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this}get rootView(){for(let e=this;;){let n=e.parent;if(!n)return e;e=n}}replaceChildren(e,n,i=tT){this.markDirty();for(let r=e;r<n;r++){let o=this.children[r];o.parent==this&&o.destroy()}this.children.splice(e,n-e,...i);for(let r=0;r<i.length;r++)i[r].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new dA(this.children,e,this.children.length)}childPos(e,n=1){return this.childCursor().findPos(e,n)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+(e=="Text"?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}merge(e,n,i,r,o,s){return!1}become(e){return!1}getSide(){return 0}destroy(){this.parent=null}}hi.prototype.breakAfter=0;function MX(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class dA{constructor(e,n,i){this.children=e,this.pos=n,this.i=i,this.off=0}findPos(e,n=1){for(;;){if(e>this.pos||e==this.pos&&(n>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function hA(t,e,n,i,r,o,s,a,l){let{children:c}=t,u=c.length?c[e]:null,f=o.length?o[o.length-1]:null,h=f?f.breakAfter:s;if(!(e==i&&u&&!s&&!h&&o.length<2&&u.merge(n,r,o.length?f:null,n==0,a,l))){if(i<c.length){let d=c[i];d&&r<d.length?(e==i&&(d=d.split(r),r=0),!h&&f&&d.merge(0,r,f,!0,0,l)?o[o.length-1]=d:(r&&d.merge(0,r,null,!1,0,l),o.push(d))):d!=null&&d.breakAfter&&(f?f.breakAfter=1:s=1),i++}for(u&&(u.breakAfter=s,n>0&&(!s&&o.length&&u.merge(n,u.length,o[0],!1,a,0)?u.breakAfter=o.shift().breakAfter:(n<u.length||u.children.length&&u.children[u.children.length-1].length==0)&&u.merge(n,u.length,null,!1,a,0),e++));e<i&&o.length;)if(c[i-1].become(o[o.length-1]))i--,o.pop(),l=o.length?0:a;else if(c[e].become(o[0]))e++,o.shift(),a=o.length?0:l;else break;!o.length&&e&&i<c.length&&!c[e-1].breakAfter&&c[i].merge(0,0,c[e-1],!1,a,l)&&e--,(e<i||o.length)&&t.replaceChildren(e,i,o)}}function pA(t,e,n,i,r,o){let s=t.childCursor(),{i:a,off:l}=s.findPos(n,1),{i:c,off:u}=s.findPos(e,-1),f=e-n;for(let h of i)f+=h.length;t.length+=f,hA(t,c,u,a,l,i,0,r,o)}let Fo=typeof navigator!="undefined"?navigator:{userAgent:"",vendor:"",platform:""},lw=typeof document!="undefined"?document:{documentElement:{style:{}}};const cw=/Edge\/(\d+)/.exec(Fo.userAgent),mA=/MSIE \d/.test(Fo.userAgent),uw=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Fo.userAgent),C1=!!(mA||uw||cw),VX=!C1&&/gecko\/(\d+)/i.test(Fo.userAgent),vQ=!C1&&/Chrome\/(\d+)/.exec(Fo.userAgent),NX="webkitFontSmoothing"in lw.documentElement.style,gA=!C1&&/Apple Computer/.test(Fo.vendor),BX=gA&&(/Mobile\/\w+/.test(Fo.userAgent)||Fo.maxTouchPoints>2);var lt={mac:BX||/Mac/.test(Fo.platform),windows:/Win/.test(Fo.platform),linux:/Linux|X11/.test(Fo.platform),ie:C1,ie_version:mA?lw.documentMode||6:uw?+uw[1]:cw?+cw[1]:0,gecko:VX,gecko_version:VX?+(/Firefox\/(\d+)/.exec(Fo.userAgent)||[0,0])[1]:0,chrome:!!vQ,chrome_version:vQ?+vQ[1]:0,ios:BX,android:/Android\b/.test(Fo.userAgent),webkit:NX,safari:gA,webkit_version:NX?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:lw.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const yde=256;class kc extends hi{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,n,i){return i&&(!(i instanceof kc)||this.length-(n-e)+i.length>yde)?!1:(this.text=this.text.slice(0,e)+(i?i.text:"")+this.text.slice(n),this.markDirty(),!0)}split(e){let n=new kc(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),n}localPosFromDOM(e,n){return e==this.dom?n:n?this.text.length:0}domAtPos(e){return new Er(this.dom,e)}domBoundsAround(e,n,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,n){return Ow(this.dom,e,n)}}class Ya extends hi{constructor(e,n=[],i=0){super(),this.mark=e,this.children=n,this.length=i;for(let r of n)r.setParent(this)}setAttrs(e){if(fA(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let n in this.mark.attrs)e.setAttribute(n,this.mark.attrs[n]);return e}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.dirty|=6)}sync(e){this.dom?this.dirty&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e)}merge(e,n,i,r,o,s){return i&&(!(i instanceof Ya&&i.mark.eq(this.mark))||e&&o<=0||n<this.length&&s<=0)?!1:(pA(this,e,n,i?i.children:[],o-1,s-1),this.markDirty(),!0)}split(e){let n=[],i=0,r=-1,o=0;for(let a of this.children){let l=i+a.length;l>e&&n.push(i<e?a.split(e-i):a),r<0&&i>=e&&(r=o),i=l,o++}let s=this.length-e;return this.length=e,r>-1&&(this.children.length=r,this.markDirty()),new Ya(this.mark,n,s)}domAtPos(e){return bA(this.dom,this.children,e)}coordsAt(e,n){return SA(this,e,n)}}function Ow(t,e,n){let i=t.nodeValue.length;e>i&&(e=i);let r=e,o=e,s=0;e==0&&n<0||e==i&&n>=0?lt.chrome||lt.gecko||(e?(r--,s=1):o<i&&(o++,s=-1)):n<0?r--:o<i&&o++;let a=Vh(t,r,o).getClientRects();if(!a.length)return uA;let l=a[(s?s<0:n>=0)?0:a.length-1];return lt.safari&&!s&&l.width==0&&(l=Array.prototype.find.call(a,c=>c.width)||l),s?R1(l,s<0):l||null}class ac extends hi{constructor(e,n,i){super(),this.widget=e,this.length=n,this.side=i,this.prevWidget=null}static create(e,n,i){return new(e.customView||ac)(e,n,i)}split(e){let n=ac.create(this.widget,this.length-e,this.side);return this.length-=e,n}sync(){(!this.dom||!this.widget.updateDOM(this.dom))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(this.editorView)),this.dom.contentEditable="false")}getSide(){return this.side}merge(e,n,i,r,o,s){return i&&(!(i instanceof ac)||!this.widget.compare(i.widget)||e>0&&o<=0||n<this.length&&s<=0)?!1:(this.length=e+(i?i.length:0)+(this.length-n),!0)}become(e){return e.length==this.length&&e instanceof ac&&e.side==this.side&&this.widget.constructor==e.widget.constructor?(this.widget.eq(e.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get overrideDOMText(){if(this.length==0)return bn.empty;let e=this;for(;e.parent;)e=e.parent;let n=e.editorView,i=n&&n.state.doc,r=this.posAtStart;return i?i.slice(r,r+this.length):bn.empty}domAtPos(e){return e==0?Er.before(this.dom):Er.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,n){let i=this.dom.getClientRects(),r=null;if(!i.length)return uA;for(let o=e>0?i.length-1:0;r=i[o],!(e>0?o==0:o==i.length-1||r.top<r.bottom);o+=e>0?-1:1);return e==0&&n>0||e==this.length&&n<=0?r:R1(r,e==0)}get isEditable(){return!1}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class yA extends ac{domAtPos(e){let{topView:n,text:i}=this.widget;return n?fw(e,0,n,i,(r,o)=>r.domAtPos(o),r=>new Er(i,Math.min(r,i.nodeValue.length))):new Er(i,Math.min(e,i.nodeValue.length))}sync(){this.setDOM(this.widget.toDOM())}localPosFromDOM(e,n){let{topView:i,text:r}=this.widget;return i?vA(e,n,i,r):Math.min(n,this.length)}ignoreMutation(){return!1}get overrideDOMText(){return null}coordsAt(e,n){let{topView:i,text:r}=this.widget;return i?fw(e,n,i,r,(o,s,a)=>o.coordsAt(s,a),(o,s)=>Ow(r,o,s)):Ow(r,e,n)}destroy(){var e;super.destroy(),(e=this.widget.topView)===null||e===void 0||e.destroy()}get isEditable(){return!0}}function fw(t,e,n,i,r,o){if(n instanceof Ya){for(let s of n.children){let a=uf(s.dom,i),l=a?i.nodeValue.length:s.length;if(t<l||t==l&&s.getSide()<=0)return a?fw(t,e,s,i,r,o):r(s,t,e);t-=l}return r(n,n.length,-1)}else return n.dom==i?o(t,e):r(n,t,e)}function vA(t,e,n,i){if(n instanceof Ya)for(let r of n.children){let o=0,s=uf(r.dom,i);if(uf(r.dom,t))return o+(s?vA(t,e,r,i):r.localPosFromDOM(t,e));o+=s?i.nodeValue.length:r.length}else if(n.dom==i)return Math.min(e,i.nodeValue.length);return n.localPosFromDOM(t,e)}class Of extends hi{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof Of&&e.side==this.side}split(){return new Of(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return Er.before(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){let n=this.dom.getBoundingClientRect(),i=vde(this,this.side>0?-1:1);return i&&i.top<n.bottom&&i.bottom>n.top?{left:n.left,right:n.right,top:i.top,bottom:i.bottom}:n}get overrideDOMText(){return bn.empty}}kc.prototype.children=ac.prototype.children=Of.prototype.children=tT;function vde(t,e){let n=t.parent,i=n?n.children.indexOf(t):-1;for(;n&&i>=0;)if(e<0?i>0:i<n.children.length){let r=n.children[i+e];if(r instanceof kc){let o=r.coordsAt(e<0?r.length:0,e);if(o)return o}i+=e}else if(n instanceof Ya&&n.parent)i=n.parent.children.indexOf(n)+(e<0?0:1),n=n.parent;else{let r=n.dom.lastChild;if(r&&r.nodeName=="BR")return r.getClientRects()[0];break}}function bA(t,e,n){let i=0;for(let r=0;i<e.length;i++){let o=e[i],s=r+o.length;if(!(s==r&&o.getSide()<=0)){if(n>r&&n<s&&o.dom.parentNode==t)return o.domAtPos(n-r);if(n<=r)break;r=s}}for(;i>0;i--){let r=e[i-1].dom;if(r.parentNode==t)return Er.after(r)}return new Er(t,0)}function QA(t,e,n){let i,{children:r}=t;n>0&&e instanceof Ya&&r.length&&(i=r[r.length-1])instanceof Ya&&i.mark.eq(e.mark)?QA(i,e.children[0],n-1):(r.push(e),e.setParent(t)),t.length+=e.length}function SA(t,e,n){for(let o=0,s=0;s<t.children.length;s++){let a=t.children[s],l=o+a.length,c;if((n<=0||l==t.length||a.getSide()>0?l>=e:l>e)&&(e<l||s+1==t.children.length||(c=t.children[s+1]).length||c.getSide()>0)){let u=0;if(l==o){if(a.getSide()<=0)continue;u=n=-a.getSide()}let f=a.coordsAt(Math.max(0,e-o),n);return u&&f?R1(f,n<0):f}o=l}let i=t.dom.lastChild;if(!i)return t.dom.getBoundingClientRect();let r=Mh(i);return r[r.length-1]||null}function dw(t,e){for(let n in t)n=="class"&&e.class?e.class+=" "+t.class:n=="style"&&e.style?e.style+=";"+t.style:e[n]=t[n];return e}function nT(t,e){if(t==e)return!0;if(!t||!e)return!1;let n=Object.keys(t),i=Object.keys(e);if(n.length!=i.length)return!1;for(let r of n)if(i.indexOf(r)==-1||t[r]!==e[r])return!1;return!0}function hw(t,e,n){let i=null;if(e)for(let r in e)n&&r in n||t.removeAttribute(i=r);if(n)for(let r in n)e&&e[r]==n[r]||t.setAttribute(i=r,n[r]);return!!i}class Da{eq(e){return!1}updateDOM(e){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}ignoreEvent(e){return!0}get customView(){return null}destroy(e){}}var Vn=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(Vn||(Vn={}));class it extends Tu{constructor(e,n,i,r){super(),this.startSide=e,this.endSide=n,this.widget=i,this.spec=r}get heightRelevant(){return!1}static mark(e){return new X1(e)}static widget(e){let n=e.side||0,i=!!e.block;return n+=i?n>0?3e8:-4e8:n>0?1e8:-1e8,new _u(e,n,n,i,e.widget||null,!1)}static replace(e){let n=!!e.block,i,r;if(e.isBlockGap)i=-5e8,r=4e8;else{let{start:o,end:s}=$A(e,n);i=(o?n?-3e8:-1:5e8)-1,r=(s?n?2e8:1:-6e8)+1}return new _u(e,i,r,n,e.widget||null,!0)}static line(e){return new Sp(e)}static set(e,n=!1){return Tn.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}it.none=Tn.empty;class X1 extends it{constructor(e){let{start:n,end:i}=$A(e);super(n?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){return this==e||e instanceof X1&&this.tagName==e.tagName&&this.class==e.class&&nT(this.attrs,e.attrs)}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}}X1.prototype.point=!1;class Sp extends it{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Sp&&nT(this.spec.attributes,e.spec.attributes)}range(e,n=e){if(n!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,n)}}Sp.prototype.mapMode=or.TrackBefore;Sp.prototype.point=!0;class _u extends it{constructor(e,n,i,r,o,s){super(n,i,o,e),this.block=r,this.isReplace=s,this.mapMode=r?n<=0?or.TrackBefore:or.TrackAfter:or.TrackDel}get type(){return this.startSide<this.endSide?Vn.WidgetRange:this.startSide<=0?Vn.WidgetBefore:Vn.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&this.widget.estimatedHeight>=5}eq(e){return e instanceof _u&&bde(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,n=e){if(this.isReplace&&(e>n||e==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,n)}}_u.prototype.point=!0;function $A(t,e=!1){let{inclusiveStart:n,inclusiveEnd:i}=t;return n==null&&(n=t.inclusive),i==null&&(i=t.inclusive),{start:n!=null?n:e,end:i!=null?i:e}}function bde(t,e){return t==e||!!(t&&e&&t.compare(e))}function pw(t,e,n,i=0){let r=n.length-1;r>=0&&n[r]+i>=t?n[r]=Math.max(n[r],e):n.push(t,e)}class co extends hi{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,n,i,r,o,s){if(i){if(!(i instanceof co))return!1;this.dom||i.transferDOM(this)}return r&&this.setDeco(i?i.attrs:null),pA(this,e,n,i?i.children:[],o,s),!0}split(e){let n=new co;if(n.breakAfter=this.breakAfter,this.length==0)return n;let{i,off:r}=this.childPos(e);r&&(n.append(this.children[i].split(r),0),this.children[i].merge(r,this.children[i].length,null,!1,0,0),i++);for(let o=i;o<this.children.length;o++)n.append(this.children[o],0);for(;i>0&&this.children[i-1].length==0;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=e,n}transferDOM(e){!this.dom||(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){nT(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,n){QA(this,e,n)}addLineDeco(e){let n=e.spec.attributes,i=e.spec.class;n&&(this.attrs=dw(n,this.attrs||{})),i&&(this.attrs=dw({class:i},this.attrs||{}))}domAtPos(e){return bA(this.dom,this.children,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.dirty|=6)}sync(e){var n;this.dom?this.dirty&4&&(fA(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(hw(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e);let i=this.dom.lastChild;for(;i&&hi.get(i)instanceof Ya;)i=i.lastChild;if(!i||!this.length||i.nodeName!="BR"&&((n=hi.get(i))===null||n===void 0?void 0:n.isEditable)==!1&&(!lt.ios||!this.children.some(r=>r instanceof kc))){let r=document.createElement("BR");r.cmIgnore=!0,this.dom.appendChild(r)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0;for(let n of this.children){if(!(n instanceof kc))return null;let i=Mh(n.dom);if(i.length!=1)return null;e+=i[0].width}return{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length}}coordsAt(e,n){return SA(this,e,n)}become(e){return!1}get type(){return Vn.Text}static find(e,n){for(let i=0,r=0;i<e.children.length;i++){let o=e.children[i],s=r+o.length;if(s>=n){if(o instanceof co)return o;if(s>n)break}r=s+o.breakAfter}return null}}class vu extends hi{constructor(e,n,i){super(),this.widget=e,this.length=n,this.type=i,this.breakAfter=0,this.prevWidget=null}merge(e,n,i,r,o,s){return i&&(!(i instanceof vu)||!this.widget.compare(i.widget)||e>0&&o<=0||n<this.length&&s<=0)?!1:(this.length=e+(i?i.length:0)+(this.length-n),!0)}domAtPos(e){return e==0?Er.before(this.dom):Er.after(this.dom,e==this.length)}split(e){let n=this.length-e;this.length=e;let i=new vu(this.widget,n,this.type);return i.breakAfter=this.breakAfter,i}get children(){return tT}sync(){(!this.dom||!this.widget.updateDOM(this.dom))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(this.editorView)),this.dom.contentEditable="false")}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):bn.empty}domBoundsAround(){return null}become(e){return e instanceof vu&&e.type==this.type&&e.widget.constructor==this.widget.constructor?(e.widget.eq(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.breakAfter=e.breakAfter,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class iT{constructor(e,n,i,r){this.doc=e,this.pos=n,this.end=i,this.disallowBlockEffectsFor=r,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=n}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!e.breakAfter&&!(e instanceof vu&&e.type==Vn.WidgetBefore)}getLine(){return this.curLine||(this.content.push(this.curLine=new co),this.atCursorPos=!0),this.curLine}flushBuffer(e){this.pendingBuffer&&(this.curLine.append(Gm(new Of(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer([]),this.curLine=null,this.content.push(e)}finish(e){e?this.pendingBuffer=0:this.flushBuffer([]),this.posCovered()||this.getLine()}buildText(e,n,i){for(;e>0;){if(this.textOff==this.text.length){let{value:o,lineBreak:s,done:a}=this.cursor.next(this.skip);if(this.skip=0,a)throw new Error("Ran out of text content when drawing inline views");if(s){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer([]),this.curLine=null,e--;continue}else this.text=o,this.textOff=0}let r=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(n.slice(0,i)),this.getLine().append(Gm(new kc(this.text.slice(this.textOff,this.textOff+r)),n),i),this.atCursorPos=!0,this.textOff+=r,e-=r,i=0}}span(e,n,i,r){this.buildText(n-e,i,r),this.pos=n,this.openStart<0&&(this.openStart=r)}point(e,n,i,r,o,s){if(this.disallowBlockEffectsFor[s]&&i instanceof _u){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(n>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let a=n-e;if(i instanceof _u)if(i.block){let{type:l}=i;l==Vn.WidgetAfter&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new vu(i.widget||new GX("div"),a,l))}else{let l=ac.create(i.widget||new GX("span"),a,i.startSide),c=this.atCursorPos&&!l.isEditable&&o<=r.length&&(e<n||i.startSide>0),u=!l.isEditable&&(e<n||i.startSide<=0),f=this.getLine();this.pendingBuffer==2&&!c&&(this.pendingBuffer=0),this.flushBuffer(r),c&&(f.append(Gm(new Of(1),r),o),o=r.length+Math.max(0,o-r.length)),f.append(Gm(l,r),o),this.atCursorPos=u,this.pendingBuffer=u?e<n?1:2:0}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);a&&(this.textOff+a<=this.text.length?this.textOff+=a:(this.skip+=a-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=n),this.openStart<0&&(this.openStart=o)}static build(e,n,i,r,o){let s=new iT(e,n,i,o);return s.openEnd=Tn.spans(r,n,i,s),s.openStart<0&&(s.openStart=s.openEnd),s.finish(s.openEnd),s}}function Gm(t,e){for(let n of e)t=new Ya(n,[t],t.length);return t}class GX extends Da{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}}const wA=tt.define(),xA=tt.define(),PA=tt.define(),kA=tt.define(),mw=tt.define(),TA=tt.define(),_A=tt.define({combine:t=>t.some(e=>e)});class Fy{constructor(e,n="nearest",i="nearest",r=5,o=5){this.range=e,this.y=n,this.x=i,this.yMargin=r,this.xMargin=o}map(e){return e.empty?this:new Fy(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin)}}const FX=yt.define({map:(t,e)=>t.map(e)});function ns(t,e,n){let i=t.facet(kA);i.length?i[0](e):window.onerror?window.onerror(String(e),n,void 0,void 0,e):n?console.error(n+":",e):console.error(e)}const W1=tt.define({combine:t=>t.length?t[0]:!0});let Qde=0;const Zd=tt.define();class oi{constructor(e,n,i,r){this.id=e,this.create=n,this.domEventHandlers=i,this.extension=r(this)}static define(e,n){const{eventHandlers:i,provide:r,decorations:o}=n||{};return new oi(Qde++,e,i,s=>{let a=[Zd.of(s)];return o&&a.push(Nh.of(l=>{let c=l.plugin(s);return c?o(c):it.none})),r&&a.push(r(s)),a})}static fromClass(e,n){return oi.define(i=>new e(i),n)}}class bQ{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(i){if(ns(n.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(n){ns(e.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(i){ns(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const RA=tt.define(),CA=tt.define(),Nh=tt.define(),XA=tt.define(),WA=tt.define(),jd=tt.define();class Sl{constructor(e,n,i,r){this.fromA=e,this.toA=n,this.fromB=i,this.toB=r}join(e){return new Sl(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let n=e.length,i=this;for(;n>0;n--){let r=e[n-1];if(!(r.fromA>i.toA)){if(r.toA<i.fromA)break;i=i.join(r),e.splice(n-1,1)}}return e.splice(n,0,i),e}static extendWithRanges(e,n){if(n.length==0)return e;let i=[];for(let r=0,o=0,s=0,a=0;;r++){let l=r==e.length?null:e[r],c=s-a,u=l?l.fromB:1e9;for(;o<n.length&&n[o]<u;){let f=n[o],h=n[o+1],d=Math.max(a,f),y=Math.min(u,h);if(d<=y&&new Sl(d+c,y+c,d,y).addToSet(i),h>u)break;o+=2}if(!l)return i;new Sl(l.fromA,l.toA,l.fromB,l.toB).addToSet(i),s=l.toA,a=l.toB}}}class Hy{constructor(e,n,i){this.view=e,this.state=n,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=Qi.empty(this.startState.doc.length);for(let s of i)this.changes=this.changes.compose(s.changes);let r=[];this.changes.iterChangedRanges((s,a,l,c)=>r.push(new Sl(s,a,l,c))),this.changedRanges=r;let o=e.hasFocus;o!=e.inputState.notifiedFocused&&(e.inputState.notifiedFocused=o,this.flags|=1)}static create(e,n,i){return new Hy(e,n,i)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}var ri=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(ri||(ri={}));const gw=ri.LTR,Sde=ri.RTL;function zA(t){let e=[];for(let n=0;n<t.length;n++)e.push(1<<+t[n]);return e}const $de=zA("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),wde=zA("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),yw=Object.create(null),Qa=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),n=t.charCodeAt(1);yw[e]=n,yw[n]=-e}function xde(t){return t<=247?$de[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?wde[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8203||t==8204?256:1}const Pde=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;class MO{constructor(e,n,i){this.from=e,this.to=n,this.level=i}get dir(){return this.level%2?Sde:gw}side(e,n){return this.dir==n==e?this.to:this.from}static find(e,n,i,r){let o=-1;for(let s=0;s<e.length;s++){let a=e[s];if(a.from<=n&&a.to>=n){if(a.level==i)return s;(o<0||(r!=0?r<0?a.from<n:a.to>n:e[o].level>a.level))&&(o=s)}}if(o<0)throw new RangeError("Index out of range");return o}}const yi=[];function kde(t,e){let n=t.length,i=e==gw?1:2,r=e==gw?2:1;if(!t||i==1&&!Pde.test(t))return EA(n);for(let s=0,a=i,l=i;s<n;s++){let c=xde(t.charCodeAt(s));c==512?c=a:c==8&&l==4&&(c=16),yi[s]=c==4?2:c,c&7&&(l=c),a=c}for(let s=0,a=i,l=i;s<n;s++){let c=yi[s];if(c==128)s<n-1&&a==yi[s+1]&&a&24?c=yi[s]=a:yi[s]=256;else if(c==64){let u=s+1;for(;u<n&&yi[u]==64;)u++;let f=s&&a==8||u<n&&yi[u]==8?l==1?1:8:256;for(let h=s;h<u;h++)yi[h]=f;s=u-1}else c==8&&l==1&&(yi[s]=1);a=c,c&7&&(l=c)}for(let s=0,a=0,l=0,c,u,f;s<n;s++)if(u=yw[c=t.charCodeAt(s)])if(u<0){for(let h=a-3;h>=0;h-=3)if(Qa[h+1]==-u){let d=Qa[h+2],y=d&2?i:d&4?d&1?r:i:0;y&&(yi[s]=yi[Qa[h]]=y),a=h;break}}else{if(Qa.length==189)break;Qa[a++]=s,Qa[a++]=c,Qa[a++]=l}else if((f=yi[s])==2||f==1){let h=f==i;l=h?0:1;for(let d=a-3;d>=0;d-=3){let y=Qa[d+2];if(y&2)break;if(h)Qa[d+2]|=2;else{if(y&4)break;Qa[d+2]|=4}}}for(let s=0;s<n;s++)if(yi[s]==256){let a=s+1;for(;a<n&&yi[a]==256;)a++;let l=(s?yi[s-1]:i)==1,c=(a<n?yi[a]:i)==1,u=l==c?l?1:2:i;for(let f=s;f<a;f++)yi[f]=u;s=a-1}let o=[];if(i==1)for(let s=0;s<n;){let a=s,l=yi[s++]!=1;for(;s<n&&l==(yi[s]!=1);)s++;if(l)for(let c=s;c>a;){let u=c,f=yi[--c]!=2;for(;c>a&&f==(yi[c-1]!=2);)c--;o.push(new MO(c,u,f?2:1))}else o.push(new MO(a,s,0))}else for(let s=0;s<n;){let a=s,l=yi[s++]==2;for(;s<n&&l==(yi[s]==2);)s++;o.push(new MO(a,s,l?1:2))}return o}function EA(t){return[new MO(0,t,0)]}let qA="";function Tde(t,e,n,i,r){var o;let s=i.head-t.from,a=-1;if(s==0){if(!r||!t.length)return null;e[0].level!=n&&(s=e[0].side(!1,n),a=0)}else if(s==t.length){if(r)return null;let h=e[e.length-1];h.level!=n&&(s=h.side(!0,n),a=e.length-1)}a<0&&(a=MO.find(e,s,(o=i.bidiLevel)!==null&&o!==void 0?o:-1,i.assoc));let l=e[a];s==l.side(r,n)&&(l=e[a+=r?1:-1],s=l.side(!r,n));let c=r==(l.dir==n),u=Ko(t.text,s,c);if(qA=t.text.slice(Math.min(s,u),Math.max(s,u)),u!=l.side(r,n))return ye.cursor(u+t.from,c?-1:1,l.level);let f=a==(r?e.length-1:0)?null:e[a+(r?1:-1)];return!f&&l.level!=n?ye.cursor(r?t.to:t.from,r?-1:1,n):f&&f.level<l.level?ye.cursor(f.side(!r,n)+t.from,r?1:-1,f.level):ye.cursor(u+t.from,r?-1:1,l.level)}const lc="\uFFFF";class UA{constructor(e,n){this.points=e,this.text="",this.lineSeparator=n.facet(on.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=lc}readRange(e,n){if(!e)return this;let i=e.parentNode;for(let r=e;;){this.findPointBefore(i,r),this.readNode(r);let o=r.nextSibling;if(o==n)break;let s=hi.get(r),a=hi.get(o);(s&&a?s.breakAfter:(s?s.breakAfter:HX(r))||HX(o)&&(r.nodeName!="BR"||r.cmIgnore))&&this.lineBreak(),r=o}return this.findPointBefore(i,n),this}readTextNode(e){let n=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,n.length));for(let i=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let o=-1,s=1,a;if(this.lineSeparator?(o=n.indexOf(this.lineSeparator,i),s=this.lineSeparator.length):(a=r.exec(n))&&(o=a.index,s=a[0].length),this.append(n.slice(i,o<0?n.length:o)),o<0)break;if(this.lineBreak(),s>1)for(let l of this.points)l.node==e&&l.pos>this.text.length&&(l.pos-=s-1);i=o+s}}readNode(e){if(e.cmIgnore)return;let n=hi.get(e),i=n&&n.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let r=i.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,n){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==n&&(i.pos=this.text.length)}findPointInside(e,n){for(let i of this.points)(e.nodeType==3?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+Math.min(n,i.offset))}}function HX(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}class KX{constructor(e,n){this.node=e,this.offset=n,this.pos=-1}}class JX extends hi{constructor(e){super(),this.view=e,this.compositionDeco=it.none,this.decorations=[],this.dynamicDecorationMap=[],this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new co],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Sl(0,0,0,e.state.doc.length)],0)}get root(){return this.view.root}get editorView(){return this.view}get length(){return this.view.state.doc.length}update(e){let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:s,toA:a})=>a<this.minWidthFrom||s>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.view.inputState.composing<0?this.compositionDeco=it.none:(e.transactions.length||this.dirty)&&(this.compositionDeco=Rde(this.view,e.changes)),(lt.ie||lt.chrome)&&!this.compositionDeco.size&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let i=this.decorations,r=this.updateDeco(),o=zde(i,r,e.changes);return n=Sl.extendWithRanges(n,o),this.dirty==0&&n.length==0?!1:(this.updateInner(n,e.startState.doc.length),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,n);let{observer:i}=this.view;i.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=lt.chrome||lt.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(o),this.dirty=0,o&&(o.written||i.selectionRange.focusNode!=o.node)&&(this.forceSelection=!0),this.dom.style.height=""});let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let o of this.children)o instanceof vu&&o.widget instanceof eW&&r.push(o.dom);i.updateGaps(r)}updateChildren(e,n){let i=this.childCursor(n);for(let r=e.length-1;;r--){let o=r>=0?e[r]:null;if(!o)break;let{fromA:s,toA:a,fromB:l,toB:c}=o,{content:u,breakAtStart:f,openStart:h,openEnd:d}=iT.build(this.view.state.doc,l,c,this.decorations,this.dynamicDecorationMap),{i:y,off:$}=i.findPos(a,1),{i:b,off:m}=i.findPos(s,-1);hA(this,b,m,y,$,u,f,h,d)}}updateSelection(e=!1,n=!1){if((e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange(),!(n||this.mayControlSelection())||lt.ios&&this.view.inputState.rapidCompositionStart)return;let i=this.forceSelection;this.forceSelection=!1;let r=this.view.state.selection.main,o=this.domAtPos(r.anchor),s=r.empty?o:this.domAtPos(r.head);if(lt.gecko&&r.empty&&_de(o)){let l=document.createTextNode("");this.view.observer.ignore(()=>o.node.insertBefore(l,o.node.childNodes[o.offset]||null)),o=s=new Er(l,0),i=!0}let a=this.view.observer.selectionRange;(i||!a.focusNode||!By(o.node,o.offset,a.anchorNode,a.anchorOffset)||!By(s.node,s.offset,a.focusNode,a.focusOffset))&&(this.view.observer.ignore(()=>{lt.android&<.chrome&&this.dom.contains(a.focusNode)&&Ede(a.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let l=Ny(this.root);if(l)if(r.empty){if(lt.gecko){let c=Xde(o.node,o.offset);if(c&&c!=3){let u=IA(o.node,o.offset,c==1?1:-1);u&&(o=new Er(u,c==1?0:u.nodeValue.length))}}l.collapse(o.node,o.offset),r.bidiLevel!=null&&a.cursorBidiLevel!=null&&(a.cursorBidiLevel=r.bidiLevel)}else if(l.extend)l.collapse(o.node,o.offset),l.extend(s.node,s.offset);else{let c=document.createRange();r.anchor>r.head&&([o,s]=[s,o]),c.setEnd(s.node,s.offset),c.setStart(o.node,o.offset),l.removeAllRanges(),l.addRange(c)}}),this.view.observer.setSelectionRange(o,s)),this.impreciseAnchor=o.precise?null:new Er(a.anchorNode,a.anchorOffset),this.impreciseHead=s.precise?null:new Er(a.focusNode,a.focusOffset)}enforceCursorAssoc(){if(this.compositionDeco.size)return;let e=this.view.state.selection.main,n=Ny(this.root);if(!n||!e.empty||!e.assoc||!n.modify)return;let i=co.find(this,e.head);if(!i)return;let r=i.posAtStart;if(e.head==r||e.head==r+i.length)return;let o=this.coordsAt(e.head,-1),s=this.coordsAt(e.head,1);if(!o||!s||o.bottom>s.top)return;let a=this.domAtPos(e.head+e.assoc);n.collapse(a.node,a.offset),n.modify("move",e.assoc<0?"forward":"backward","lineboundary")}mayControlSelection(){let e=this.root.activeElement;return e==this.dom||sw(this.dom,this.view.observer.selectionRange)&&!(e&&this.dom.contains(e))}nearest(e){for(let n=e;n;){let i=hi.get(n);if(i&&i.rootView==this)return i;n=n.parentNode}return null}posFromDOM(e,n){let i=this.nearest(e);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(e,n)+i.posAtStart}domAtPos(e){let{i:n,off:i}=this.childCursor().findPos(e,-1);for(;n<this.children.length-1;){let r=this.children[n];if(i<r.length||r instanceof co)break;n++,i=0}return this.children[n].domAtPos(i)}coordsAt(e,n){for(let i=this.length,r=this.children.length-1;;r--){let o=this.children[r],s=i-o.breakAfter-o.length;if(e>s||e==s&&o.type!=Vn.WidgetBefore&&o.type!=Vn.WidgetAfter&&(!r||n==2||this.children[r-1].breakAfter||this.children[r-1].type==Vn.WidgetBefore&&n>-2))return o.coordsAt(e-s,n);i=s}}measureVisibleLineHeights(e){let n=[],{from:i,to:r}=e,o=this.view.contentDOM.clientWidth,s=o>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==ri.LTR;for(let c=0,u=0;u<this.children.length;u++){let f=this.children[u],h=c+f.length;if(h>r)break;if(c>=i){let d=f.dom.getBoundingClientRect();if(n.push(d.height),s){let y=f.dom.lastChild,$=y?Mh(y):[];if($.length){let b=$[$.length-1],m=l?b.right-d.left:d.right-b.left;m>a&&(a=m,this.minWidth=o,this.minWidthFrom=c,this.minWidthTo=h)}}}c=h+f.breakAfter}return n}textDirectionAt(e){let{i:n}=this.childPos(e,1);return getComputedStyle(this.children[n].dom).direction=="rtl"?ri.RTL:ri.LTR}measureTextSize(){for(let r of this.children)if(r instanceof co){let o=r.measureTextSize();if(o)return o}let e=document.createElement("div"),n,i;return e.className="cm-line",e.style.width="99999px",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let r=Mh(e.firstChild)[0];n=e.getBoundingClientRect().height,i=r?r.width/27:7,e.remove()}),{lineHeight:n,charWidth:i}}childCursor(e=this.length){let n=this.children.length;return n&&(e-=this.children[--n].length),new dA(this.children,e,n)}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let i=0,r=0;;r++){let o=r==n.viewports.length?null:n.viewports[r],s=o?o.from-1:this.length;if(s>i){let a=n.lineBlockAt(s).bottom-n.lineBlockAt(i).top;e.push(it.replace({widget:new eW(a),block:!0,inclusive:!0,isBlockGap:!0}).range(i,s))}if(!o)break;i=o.to+1}return it.set(e)}updateDeco(){let e=this.view.state.facet(Nh).map((n,i)=>(this.dynamicDecorationMap[i]=typeof n=="function")?n(this.view):n);for(let n=e.length;n<e.length+3;n++)this.dynamicDecorationMap[n]=!1;return this.decorations=[...e,this.compositionDeco,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco]}scrollIntoView(e){let{range:n}=e,i=this.coordsAt(n.head,n.empty?n.assoc:n.head>n.anchor?-1:1),r;if(!i)return;!n.empty&&(r=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(i={left:Math.min(i.left,r.left),top:Math.min(i.top,r.top),right:Math.max(i.right,r.right),bottom:Math.max(i.bottom,r.bottom)});let o=0,s=0,a=0,l=0;for(let u of this.view.state.facet(WA).map(f=>f(this.view)))if(u){let{left:f,right:h,top:d,bottom:y}=u;f!=null&&(o=Math.max(o,f)),h!=null&&(s=Math.max(s,h)),d!=null&&(a=Math.max(a,d)),y!=null&&(l=Math.max(l,y))}let c={left:i.left-o,top:i.top-a,right:i.right+s,bottom:i.bottom+l};pde(this.view.scrollDOM,c,n.head<n.anchor?-1:1,e.x,e.y,e.xMargin,e.yMargin,this.view.textDirection==ri.LTR)}}function _de(t){return t.node.nodeType==1&&t.node.firstChild&&(t.offset==0||t.node.childNodes[t.offset-1].contentEditable=="false")&&(t.offset==t.node.childNodes.length||t.node.childNodes[t.offset].contentEditable=="false")}class eW extends Da{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}}function AA(t){let e=t.observer.selectionRange,n=e.focusNode&&IA(e.focusNode,e.focusOffset,0);if(!n)return null;let i=t.docView.nearest(n);if(!i)return null;if(i instanceof co){let r=n;for(;r.parentNode!=i.dom;)r=r.parentNode;let o=r.previousSibling;for(;o&&!hi.get(o);)o=o.previousSibling;let s=o?hi.get(o).posAtEnd:i.posAtStart;return{from:s,to:s,node:r,text:n}}else{for(;;){let{parent:o}=i;if(!o)return null;if(o instanceof co)break;i=o}let r=i.posAtStart;return{from:r,to:r+i.length,node:i.dom,text:n}}}function Rde(t,e){let n=AA(t);if(!n)return it.none;let{from:i,to:r,node:o,text:s}=n,a=e.mapPos(i,1),l=Math.max(a,e.mapPos(r,-1)),{state:c}=t,u=o.nodeType==3?o.nodeValue:new UA([],c).readRange(o.firstChild,null).text;if(l-a<u.length)if(c.doc.sliceString(a,Math.min(c.doc.length,a+u.length),lc)==u)l=a+u.length;else if(c.doc.sliceString(Math.max(0,l-u.length),l,lc)==u)a=l-u.length;else return it.none;else if(c.doc.sliceString(a,l,lc)!=u)return it.none;let f=hi.get(o);return f instanceof yA?f=f.widget.topView:f&&(f.parent=null),it.set(it.replace({widget:new Cde(o,s,f),inclusive:!0}).range(a,l))}class Cde extends Da{constructor(e,n,i){super(),this.top=e,this.text=n,this.topView=i}eq(e){return this.top==e.top&&this.text==e.text}toDOM(){return this.top}ignoreEvent(){return!1}get customView(){return yA}}function IA(t,e,n){for(;;){if(t.nodeType==3)return t;if(t.nodeType==1&&e>0&&n<=0)t=t.childNodes[e-1],e=Gy(t);else if(t.nodeType==1&&e<t.childNodes.length&&n>=0)t=t.childNodes[e],e=0;else return null}}function Xde(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e<t.childNodes.length&&t.childNodes[e].contentEditable=="false"?2:0)}class Wde{constructor(){this.changes=[]}compareRange(e,n){pw(e,n,this.changes)}comparePoint(e,n){pw(e,n,this.changes)}}function zde(t,e,n){let i=new Wde;return Tn.compare(t,e,n,i),i.changes}function Ede(t,e){for(let n=t;n&&n!=e;n=n.assignedSlot||n.parentNode)if(n.nodeType==1&&n.contentEditable=="false")return!0;return!1}function qde(t,e,n=1){let i=t.charCategorizer(e),r=t.doc.lineAt(e),o=e-r.from;if(r.length==0)return ye.cursor(e);o==0?n=1:o==r.length&&(n=-1);let s=o,a=o;n<0?s=Ko(r.text,o,!1):a=Ko(r.text,o);let l=i(r.text.slice(s,a));for(;s>0;){let c=Ko(r.text,s,!1);if(i(r.text.slice(c,s))!=l)break;s=c}for(;a<r.length;){let c=Ko(r.text,a);if(i(r.text.slice(a,c))!=l)break;a=c}return ye.range(s+r.from,a+r.from)}function Ude(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function Ade(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function QQ(t,e){return t.top<e.bottom-1&&t.bottom>e.top+1}function tW(t,e){return e<t.top?{top:e,left:t.left,right:t.right,bottom:t.bottom}:t}function nW(t,e){return e>t.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function vw(t,e,n){let i,r,o,s,a,l,c,u;for(let d=t.firstChild;d;d=d.nextSibling){let y=Mh(d);for(let $=0;$<y.length;$++){let b=y[$];r&&QQ(r,b)&&(b=tW(nW(b,r.bottom),r.top));let m=Ude(e,b),p=Ade(n,b);if(m==0&&p==0)return d.nodeType==3?iW(d,e,n):vw(d,e,n);(!i||s>p||s==p&&o>m)&&(i=d,r=b,o=m,s=p),m==0?n>b.bottom&&(!c||c.bottom<b.bottom)?(a=d,c=b):n<b.top&&(!u||u.top>b.top)&&(l=d,u=b):c&&QQ(c,b)?c=nW(c,b.bottom):u&&QQ(u,b)&&(u=tW(u,b.top))}}if(c&&c.bottom>=n?(i=a,r=c):u&&u.top<=n&&(i=l,r=u),!i)return{node:t,offset:0};let f=Math.max(r.left,Math.min(r.right,e));if(i.nodeType==3)return iW(i,f,n);if(!o&&i.contentEditable=="true")return vw(i,f,n);let h=Array.prototype.indexOf.call(t.childNodes,i)+(e>=(r.left+r.right)/2?1:0);return{node:t,offset:h}}function iW(t,e,n){let i=t.nodeValue.length,r=-1,o=1e9,s=0;for(let a=0;a<i;a++){let l=Vh(t,a,a+1).getClientRects();for(let c=0;c<l.length;c++){let u=l[c];if(u.top==u.bottom)continue;s||(s=e-u.left);let f=(u.top>n?u.top-n:n-u.bottom)-1;if(u.left-1<=e&&u.right+1>=e&&f<o){let h=e>=(u.left+u.right)/2,d=h;if((lt.chrome||lt.gecko)&&Vh(t,a).getBoundingClientRect().left==u.right&&(d=!h),f<=0)return{node:t,offset:a+(d?1:0)};r=a+(d?1:0),o=f}}}return{node:t,offset:r>-1?r:s>0?t.nodeValue.length:0}}function LA(t,{x:e,y:n},i,r=-1){var o;let s=t.contentDOM.getBoundingClientRect(),a=s.top+t.viewState.paddingTop,l,{docHeight:c}=t.viewState,u=n-a;if(u<0)return 0;if(u>c)return t.state.doc.length;for(let m=t.defaultLineHeight/2,p=!1;l=t.elementAtHeight(u),l.type!=Vn.Text;)for(;u=r>0?l.bottom+m:l.top-m,!(u>=0&&u<=c);){if(p)return i?null:0;p=!0,r=-r}n=a+u;let f=l.from;if(f<t.viewport.from)return t.viewport.from==0?0:i?null:rW(t,s,l,e,n);if(f>t.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:rW(t,s,l,e,n);let h=t.dom.ownerDocument,d=t.root.elementFromPoint?t.root:h,y=d.elementFromPoint(e,n);y&&!t.contentDOM.contains(y)&&(y=null),y||(e=Math.max(s.left+1,Math.min(s.right-1,e)),y=d.elementFromPoint(e,n),y&&!t.contentDOM.contains(y)&&(y=null));let $,b=-1;if(y&&((o=t.docView.nearest(y))===null||o===void 0?void 0:o.isEditable)!=!1){if(h.caretPositionFromPoint){let m=h.caretPositionFromPoint(e,n);m&&({offsetNode:$,offset:b}=m)}else if(h.caretRangeFromPoint){let m=h.caretRangeFromPoint(e,n);m&&({startContainer:$,startOffset:b}=m,lt.safari&&Ide($,b,e)&&($=void 0))}}if(!$||!t.docView.dom.contains($)){let m=co.find(t.docView,f);if(!m)return u>l.top+l.height/2?l.to:l.from;({node:$,offset:b}=vw(m.dom,e,n))}return t.docView.posFromDOM($,b)}function rW(t,e,n,i,r){let o=Math.round((i-e.left)*t.defaultCharacterWidth);t.lineWrapping&&n.height>t.defaultLineHeight*1.5&&(o+=Math.floor((r-n.top)/t.defaultLineHeight)*t.viewState.heightOracle.lineLength);let s=t.state.sliceDoc(n.from,n.to);return n.from+iw(s,o,t.state.tabSize)}function Ide(t,e,n){let i;if(t.nodeType!=3||e!=(i=t.nodeValue.length))return!1;for(let r=t.nextSibling;r;r=r.nextSibling)if(r.nodeType!=1||r.nodeName!="BR")return!1;return Vh(t,i-1,i).getBoundingClientRect().left>n}function Lde(t,e,n,i){let r=t.state.doc.lineAt(e.head),o=!i||!t.lineWrapping?null:t.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head);if(o){let l=t.dom.getBoundingClientRect(),c=t.textDirectionAt(r.from),u=t.posAtCoords({x:n==(c==ri.LTR)?l.right-1:l.left+1,y:(o.top+o.bottom)/2});if(u!=null)return ye.cursor(u,n?-1:1)}let s=co.find(t.docView,e.head),a=s?n?s.posAtEnd:s.posAtStart:n?r.to:r.from;return ye.cursor(a,n?-1:1)}function oW(t,e,n,i){let r=t.state.doc.lineAt(e.head),o=t.bidiSpans(r),s=t.textDirectionAt(r.from);for(let a=e,l=null;;){let c=Tde(r,o,s,a,n),u=qA;if(!c){if(r.number==(n?t.state.doc.lines:1))return a;u=`
|