blockmine 1.4.0 → 1.4.3
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/backend/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/server.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"start": "node
|
|
7
|
+
"start": "node ../backend/cli.js",
|
|
8
8
|
"dev": "nodemon",
|
|
9
9
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
10
10
|
},
|
|
@@ -14,25 +14,8 @@
|
|
|
14
14
|
"keywords": [],
|
|
15
15
|
"author": "",
|
|
16
16
|
"license": "ISC",
|
|
17
|
-
"dependencies": {
|
|
18
|
-
"@prisma/client": "^5.14.0",
|
|
19
|
-
"adm-zip": "^0.5.16",
|
|
20
|
-
"archiver": "^7.0.1",
|
|
21
|
-
"bcryptjs": "^3.0.2",
|
|
22
|
-
"cron-parser": "^5.3.0",
|
|
23
|
-
"express": "^4.19.2",
|
|
24
|
-
"fs-extra": "^11.3.0",
|
|
25
|
-
"mineflayer": "^4.20.1",
|
|
26
|
-
"multer": "^2.0.1",
|
|
27
|
-
"node-cron": "^4.1.0",
|
|
28
|
-
"pidusage": "^3.0.2",
|
|
29
|
-
"prisma": "^5.14.0",
|
|
30
|
-
"semver": "^7.6.2",
|
|
31
|
-
"socket.io": "^4.7.5",
|
|
32
|
-
"socks": "^2.8.5"
|
|
33
|
-
},
|
|
17
|
+
"dependencies": {},
|
|
34
18
|
"devDependencies": {
|
|
35
|
-
"nodemon": "^3.1.2"
|
|
36
|
-
"prisma": "^5.14.0"
|
|
19
|
+
"nodemon": "^3.1.2"
|
|
37
20
|
}
|
|
38
|
-
}
|
|
21
|
+
}
|
|
@@ -67,7 +67,7 @@ Please change the parent <Route path="${S}"> to <Route path="${S==="/"?"*":`${S}
|
|
|
67
67
|
* LICENSE.md file in the root directory of this source tree.
|
|
68
68
|
*
|
|
69
69
|
* @license MIT
|
|
70
|
-
*/function sne(e){return g.createElement(wte,{flushSync:h1.flushSync,...e})}const mV=e=>{let t;const n=new Set,o=(f,m)=>{const v=typeof f=="function"?f(t):f;if(!Object.is(v,t)){const x=t;t=m??(typeof v!="object"||v===null)?v:Object.assign({},t,v),n.forEach(b=>b(t,x))}},c=()=>t,p={setState:o,getState:c,getInitialState:()=>y,subscribe:f=>(n.add(f),()=>n.delete(f))},y=t=e(o,c,p);return p},lne=e=>e?mV(e):mV,dne=e=>e;function une(e,t=dne){const n=bt.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return bt.useDebugValue(n),n}const kV=e=>{const t=lne(e),n=o=>une(t,o);return Object.assign(n,t),n},hne=e=>e?kV(e):kV;var DF=Symbol.for("immer-nothing"),gV=Symbol.for("immer-draftable"),ua=Symbol.for("immer-state");function Ha(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Sd=Object.getPrototypeOf;function Cd(e){return!!e&&!!e[ua]}function o1(e){var t;return e?qF(e)||Array.isArray(e)||!!e[gV]||!!((t=e.constructor)!=null&&t[gV])||GI(e)||ZI(e):!1}var pne=Object.prototype.constructor.toString();function qF(e){if(!e||typeof e!="object")return!1;const t=Sd(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===pne}function wI(e,t){UI(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,o)=>t(o,n,e))}function UI(e){const t=e[ua];return t?t.type_:Array.isArray(e)?1:GI(e)?2:ZI(e)?3:0}function U$(e,t){return UI(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function PF(e,t,n){const o=UI(e);o===2?e.set(t,n):o===3?e.add(n):e[t]=n}function fne(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function GI(e){return e instanceof Map}function ZI(e){return e instanceof Set}function vc(e){return e.copy_||e.base_}function G$(e,t){if(GI(e))return new Map(e);if(ZI(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=qF(e);if(t===!0||t==="class_only"&&!n){const o=Object.getOwnPropertyDescriptors(e);delete o[ua];let c=Reflect.ownKeys(o);for(let s=0;s<c.length;s++){const d=c[s],p=o[d];p.writable===!1&&(p.writable=!0,p.configurable=!0),(p.get||p.set)&&(o[d]={configurable:!0,writable:!0,enumerable:p.enumerable,value:e[d]})}return Object.create(Sd(e),o)}else{const o=Sd(e);if(o!==null&&n)return{...e};const c=Object.create(o);return Object.assign(c,e)}}function Zz(e,t=!1){return XI(e)||Cd(e)||!o1(e)||(UI(e)>1&&(e.set=e.add=e.clear=e.delete=yne),Object.freeze(e),t&&Object.entries(e).forEach(([n,o])=>Zz(o,!0))),e}function yne(){Ha(2)}function XI(e){return Object.isFrozen(e)}var mne={};function r1(e){const t=mne[e];return t||Ha(0,e),t}var X2;function OF(){return X2}function kne(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function vV(e,t){t&&(r1("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Z$(e){X$(e),e.drafts_.forEach(gne),e.drafts_=null}function X$(e){e===X2&&(X2=e.parent_)}function xV(e){return X2=kne(X2,e)}function gne(e){const t=e[ua];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function MV(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[ua].modified_&&(Z$(t),Ha(4)),o1(e)&&(e=_I(t,e),t.parent_||SI(t,e)),t.patches_&&r1("Patches").generateReplacementPatches_(n[ua].base_,e,t.patches_,t.inversePatches_)):e=_I(t,n,[]),Z$(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==DF?e:void 0}function _I(e,t,n){if(XI(t))return t;const o=t[ua];if(!o)return wI(t,(c,s)=>bV(e,o,t,c,s,n)),t;if(o.scope_!==e)return t;if(!o.modified_)return SI(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const c=o.copy_;let s=c,d=!1;o.type_===3&&(s=new Set(c),c.clear(),d=!0),wI(s,(p,y)=>bV(e,o,c,p,y,n,d)),SI(e,c,!1),n&&e.patches_&&r1("Patches").generatePatches_(o,n,e.patches_,e.inversePatches_)}return o.copy_}function bV(e,t,n,o,c,s,d){if(Cd(c)){const p=s&&t&&t.type_!==3&&!U$(t.assigned_,o)?s.concat(o):void 0,y=_I(e,c,p);if(PF(n,o,y),Cd(y))e.canAutoFreeze_=!1;else return}else d&&n.add(c);if(o1(c)&&!XI(c)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;_I(e,c),(!t||!t.scope_.parent_)&&typeof o!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,o)&&SI(e,c)}}function SI(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Zz(t,n)}function vne(e,t){const n=Array.isArray(e),o={type_:n?1:0,scope_:t?t.scope_:OF(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let c=o,s=Xz;n&&(c=[o],s=Y2);const{revoke:d,proxy:p}=Proxy.revocable(c,s);return o.draft_=p,o.revoke_=d,p}var Xz={get(e,t){if(t===ua)return e;const n=vc(e);if(!U$(n,t))return xne(e,n,t);const o=n[t];return e.finalized_||!o1(o)?o:o===WR(e.base_,t)?(QR(e),e.copy_[t]=K$(o,e)):o},has(e,t){return t in vc(e)},ownKeys(e){return Reflect.ownKeys(vc(e))},set(e,t,n){const o=HF(vc(e),t);if(o!=null&&o.set)return o.set.call(e.draft_,n),!0;if(!e.modified_){const c=WR(vc(e),t),s=c==null?void 0:c[ua];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(fne(n,c)&&(n!==void 0||U$(e.base_,t)))return!0;QR(e),Y$(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return WR(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,QR(e),Y$(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=vc(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:o.enumerable,value:n[t]}},defineProperty(){Ha(11)},getPrototypeOf(e){return Sd(e.base_)},setPrototypeOf(){Ha(12)}},Y2={};wI(Xz,(e,t)=>{Y2[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Y2.deleteProperty=function(e,t){return Y2.set.call(this,e,t,void 0)};Y2.set=function(e,t,n){return Xz.set.call(this,e[0],t,n,e[0])};function WR(e,t){const n=e[ua];return(n?vc(n):e)[t]}function xne(e,t,n){var c;const o=HF(t,n);return o?"value"in o?o.value:(c=o.get)==null?void 0:c.call(e.draft_):void 0}function HF(e,t){if(!(t in e))return;let n=Sd(e);for(;n;){const o=Object.getOwnPropertyDescriptor(n,t);if(o)return o;n=Sd(n)}}function Y$(e){e.modified_||(e.modified_=!0,e.parent_&&Y$(e.parent_))}function QR(e){e.copy_||(e.copy_=G$(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Mne=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,o)=>{if(typeof t=="function"&&typeof n!="function"){const s=n;n=t;const d=this;return function(y=s,...f){return d.produce(y,m=>n.call(this,m,...f))}}typeof n!="function"&&Ha(6),o!==void 0&&typeof o!="function"&&Ha(7);let c;if(o1(t)){const s=xV(this),d=K$(t,void 0);let p=!0;try{c=n(d),p=!1}finally{p?Z$(s):X$(s)}return vV(s,o),MV(c,s)}else if(!t||typeof t!="object"){if(c=n(t),c===void 0&&(c=t),c===DF&&(c=void 0),this.autoFreeze_&&Zz(c,!0),o){const s=[],d=[];r1("Patches").generateReplacementPatches_(t,c,s,d),o(s,d)}return c}else Ha(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(d,...p)=>this.produceWithPatches(d,y=>t(y,...p));let o,c;return[this.produce(t,n,(d,p)=>{o=d,c=p}),o,c]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){o1(e)||Ha(8),Cd(e)&&(e=bne(e));const t=xV(this),n=K$(e,void 0);return n[ua].isManual_=!0,X$(t),n}finishDraft(e,t){const n=e&&e[ua];(!n||!n.isManual_)&&Ha(9);const{scope_:o}=n;return vV(o,t),MV(void 0,o)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const c=t[n];if(c.path.length===0&&c.op==="replace"){e=c.value;break}}n>-1&&(t=t.slice(n+1));const o=r1("Patches").applyPatches_;return Cd(e)?o(e,t):this.produce(e,c=>o(c,t))}};function K$(e,t){const n=GI(e)?r1("MapSet").proxyMap_(e,t):ZI(e)?r1("MapSet").proxySet_(e,t):vne(e,t);return(t?t.scope_:OF()).drafts_.push(n),n}function bne(e){return Cd(e)||Ha(10,e),VF(e)}function VF(e){if(!o1(e)||XI(e))return e;const t=e[ua];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=G$(e,t.scope_.immer_.useStrictShallowCopy_)}else n=G$(e,!0);return wI(n,(o,c)=>{PF(n,o,VF(c))}),t&&(t.finalized_=!1),n}var ha=new Mne,wne=ha.produce;ha.produceWithPatches.bind(ha);ha.setAutoFreeze.bind(ha);ha.setUseStrictShallowCopy.bind(ha);ha.applyPatches.bind(ha);ha.createDraft.bind(ha);ha.finishDraft.bind(ha);const _ne=e=>(t,n,o)=>(o.setState=(c,s,...d)=>{const p=typeof c=="function"?wne(c):c;return t(p,s,...d)},e(o.setState,n,o)),Sne=_ne,ko=Object.create(null);ko.open="0";ko.close="1";ko.ping="2";ko.pong="3";ko.message="4";ko.upgrade="5";ko.noop="6";const op=Object.create(null);Object.keys(ko).forEach(e=>{op[ko[e]]=e});const W$={type:"error",data:"parser error"},BF=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",FF=typeof ArrayBuffer=="function",UF=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Yz=({type:e,data:t},n,o)=>BF&&t instanceof Blob?n?o(t):wV(t,o):FF&&(t instanceof ArrayBuffer||UF(t))?n?o(t):wV(new Blob([t]),o):o(ko[e]+(t||"")),wV=(e,t)=>{const n=new FileReader;return n.onload=function(){const o=n.result.split(",")[1];t("b"+(o||""))},n.readAsDataURL(e)};function _V(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let JR;function Cne(e,t){if(BF&&e.data instanceof Blob)return e.data.arrayBuffer().then(_V).then(t);if(FF&&(e.data instanceof ArrayBuffer||UF(e.data)))return t(_V(e.data));Yz(e,!1,n=>{JR||(JR=new TextEncoder),t(JR.encode(n))})}const SV="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s2=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<SV.length;e++)s2[SV.charCodeAt(e)]=e;const Lne=e=>{let t=e.length*.75,n=e.length,o,c=0,s,d,p,y;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const f=new ArrayBuffer(t),m=new Uint8Array(f);for(o=0;o<n;o+=4)s=s2[e.charCodeAt(o)],d=s2[e.charCodeAt(o+1)],p=s2[e.charCodeAt(o+2)],y=s2[e.charCodeAt(o+3)],m[c++]=s<<2|d>>4,m[c++]=(d&15)<<4|p>>2,m[c++]=(p&3)<<6|y&63;return f},Nne=typeof ArrayBuffer=="function",Kz=(e,t)=>{if(typeof e!="string")return{type:"message",data:GF(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:jne(e.substring(1),t)}:op[n]?e.length>1?{type:op[n],data:e.substring(1)}:{type:op[n]}:W$},jne=(e,t)=>{if(Nne){const n=Lne(e);return GF(n,t)}else return{base64:!0,data:e}},GF=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},ZF="",Ane=(e,t)=>{const n=e.length,o=new Array(n);let c=0;e.forEach((s,d)=>{Yz(s,!1,p=>{o[d]=p,++c===n&&t(o.join(ZF))})})},Ine=(e,t)=>{const n=e.split(ZF),o=[];for(let c=0;c<n.length;c++){const s=Kz(n[c],t);if(o.push(s),s.type==="error")break}return o};function Ene(){return new TransformStream({transform(e,t){Cne(e,n=>{const o=n.length;let c;if(o<126)c=new Uint8Array(1),new DataView(c.buffer).setUint8(0,o);else if(o<65536){c=new Uint8Array(3);const s=new DataView(c.buffer);s.setUint8(0,126),s.setUint16(1,o)}else{c=new Uint8Array(9);const s=new DataView(c.buffer);s.setUint8(0,127),s.setBigUint64(1,BigInt(o))}e.data&&typeof e.data!="string"&&(c[0]|=128),t.enqueue(c),t.enqueue(n)})}})}let e$;function q0(e){return e.reduce((t,n)=>t+n.length,0)}function P0(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let o=0;for(let c=0;c<t;c++)n[c]=e[0][o++],o===e[0].length&&(e.shift(),o=0);return e.length&&o<e[0].length&&(e[0]=e[0].slice(o)),n}function Tne(e,t){e$||(e$=new TextDecoder);const n=[];let o=0,c=-1,s=!1;return new TransformStream({transform(d,p){for(n.push(d);;){if(o===0){if(q0(n)<1)break;const y=P0(n,1);s=(y[0]&128)===128,c=y[0]&127,c<126?o=3:c===126?o=1:o=2}else if(o===1){if(q0(n)<2)break;const y=P0(n,2);c=new DataView(y.buffer,y.byteOffset,y.length).getUint16(0),o=3}else if(o===2){if(q0(n)<8)break;const y=P0(n,8),f=new DataView(y.buffer,y.byteOffset,y.length),m=f.getUint32(0);if(m>Math.pow(2,21)-1){p.enqueue(W$);break}c=m*Math.pow(2,32)+f.getUint32(4),o=3}else{if(q0(n)<c)break;const y=P0(n,c);p.enqueue(Kz(s?y:e$.decode(y),t)),o=0}if(c===0||c>e){p.enqueue(W$);break}}}})}const XF=4;function Wt(e){if(e)return Rne(e)}function Rne(e){for(var t in Wt.prototype)e[t]=Wt.prototype[t];return e}Wt.prototype.on=Wt.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};Wt.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};Wt.prototype.off=Wt.prototype.removeListener=Wt.prototype.removeAllListeners=Wt.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var o,c=0;c<n.length;c++)if(o=n[c],o===t||o.fn===t){n.splice(c,1);break}return n.length===0&&delete this._callbacks["$"+e],this};Wt.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],o=1;o<arguments.length;o++)t[o-1]=arguments[o];if(n){n=n.slice(0);for(var o=0,c=n.length;o<c;++o)n[o].apply(this,t)}return this};Wt.prototype.emitReserved=Wt.prototype.emit;Wt.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};Wt.prototype.hasListeners=function(e){return!!this.listeners(e).length};const YI=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),Ca=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),$ne="arraybuffer";function YF(e,...t){return t.reduce((n,o)=>(e.hasOwnProperty(o)&&(n[o]=e[o]),n),{})}const zne=Ca.setTimeout,Dne=Ca.clearTimeout;function KI(e,t){t.useNativeTimers?(e.setTimeoutFn=zne.bind(Ca),e.clearTimeoutFn=Dne.bind(Ca)):(e.setTimeoutFn=Ca.setTimeout.bind(Ca),e.clearTimeoutFn=Ca.clearTimeout.bind(Ca))}const qne=1.33;function Pne(e){return typeof e=="string"?One(e):Math.ceil((e.byteLength||e.size)*qne)}function One(e){let t=0,n=0;for(let o=0,c=e.length;o<c;o++)t=e.charCodeAt(o),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(o++,n+=4);return n}function KF(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Hne(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function Vne(e){let t={},n=e.split("&");for(let o=0,c=n.length;o<c;o++){let s=n[o].split("=");t[decodeURIComponent(s[0])]=decodeURIComponent(s[1])}return t}class Bne extends Error{constructor(t,n,o){super(t),this.description=n,this.context=o,this.type="TransportError"}}class Wz extends Wt{constructor(t){super(),this.writable=!1,KI(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,o){return super.emitReserved("error",new Bne(t,n,o)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=Kz(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=Hne(t);return n.length?"?"+n:""}}class Fne extends Wz{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let o=0;this._polling&&(o++,this.once("pollComplete",function(){--o||n()})),this.writable||(o++,this.once("drain",function(){--o||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=o=>{if(this.readyState==="opening"&&o.type==="open"&&this.onOpen(),o.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(o)};Ine(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,Ane(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=KF()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let WF=!1;try{WF=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Une=WF;function Gne(){}class Zne extends Fne{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let o=location.port;o||(o=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||o!==t.port}}doWrite(t,n){const o=this.request({method:"POST",data:t});o.on("success",n),o.on("error",(c,s)=>{this.onError("xhr post error",c,s)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,o)=>{this.onError("xhr poll error",n,o)}),this.pollXhr=t}}let fd=class rp extends Wt{constructor(t,n,o){super(),this.createRequest=t,KI(this,o),this._opts=o,this._method=o.method||"GET",this._uri=n,this._data=o.data!==void 0?o.data:null,this._create()}_create(){var t;const n=YF(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const o=this._xhr=this.createRequest(n);try{o.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){o.setDisableHeaderCheck&&o.setDisableHeaderCheck(!0);for(let c in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(c)&&o.setRequestHeader(c,this._opts.extraHeaders[c])}}catch{}if(this._method==="POST")try{o.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{o.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(o),"withCredentials"in o&&(o.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(o.timeout=this._opts.requestTimeout),o.onreadystatechange=()=>{var c;o.readyState===3&&((c=this._opts.cookieJar)===null||c===void 0||c.parseCookies(o.getResponseHeader("set-cookie"))),o.readyState===4&&(o.status===200||o.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof o.status=="number"?o.status:0)},0))},o.send(this._data)}catch(c){this.setTimeoutFn(()=>{this._onError(c)},0);return}typeof document<"u"&&(this._index=rp.requestsCount++,rp.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=Gne,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete rp.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};fd.requestsCount=0;fd.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",CV);else if(typeof addEventListener=="function"){const e="onpagehide"in Ca?"pagehide":"unload";addEventListener(e,CV,!1)}}function CV(){for(let e in fd.requests)fd.requests.hasOwnProperty(e)&&fd.requests[e].abort()}const Xne=function(){const e=QF({xdomain:!1});return e&&e.responseType!==null}();class Yne extends Zne{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=Xne&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new fd(QF,this.uri(),t)}}function QF(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||Une))return new XMLHttpRequest}catch{}if(!t)try{return new Ca[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const JF=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Kne extends Wz{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,o=JF?{}:YF(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(o.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,o)}catch(c){return this.emitReserved("error",c)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const o=t[n],c=n===t.length-1;Yz(o,this.supportsBinary,s=>{try{this.doWrite(o,s)}catch{}c&&YI(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=KF()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const t$=Ca.WebSocket||Ca.MozWebSocket;class Wne extends Kne{createSocket(t,n,o){return JF?new t$(t,n,o):n?new t$(t,n):new t$(t)}doWrite(t,n){this.ws.send(n)}}class Qne extends Wz{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=Tne(Number.MAX_SAFE_INTEGER,this.socket.binaryType),o=t.readable.pipeThrough(n).getReader(),c=Ene();c.readable.pipeTo(t.writable),this._writer=c.writable.getWriter();const s=()=>{o.read().then(({done:p,value:y})=>{p||(this.onPacket(y),s())}).catch(p=>{})};s();const d={type:"open"};this.query.sid&&(d.data=`{"sid":"${this.query.sid}"}`),this._writer.write(d).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const o=t[n],c=n===t.length-1;this._writer.write(o).then(()=>{c&&YI(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const Jne={websocket:Wne,webtransport:Qne,polling:Yne},eae=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,tae=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Q$(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),o=e.indexOf("]");n!=-1&&o!=-1&&(e=e.substring(0,n)+e.substring(n,o).replace(/:/g,";")+e.substring(o,e.length));let c=eae.exec(e||""),s={},d=14;for(;d--;)s[tae[d]]=c[d]||"";return n!=-1&&o!=-1&&(s.source=t,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s.pathNames=nae(s,s.path),s.queryKey=aae(s,s.query),s}function nae(e,t){const n=/\/{2,9}/g,o=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&o.splice(0,1),t.slice(-1)=="/"&&o.splice(o.length-1,1),o}function aae(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(o,c,s){c&&(n[c]=s)}),n}const J$=typeof addEventListener=="function"&&typeof removeEventListener=="function",cp=[];J$&&addEventListener("offline",()=>{cp.forEach(e=>e())},!1);class jr extends Wt{constructor(t,n){if(super(),this.binaryType=$ne,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const o=Q$(t);n.hostname=o.host,n.secure=o.protocol==="https"||o.protocol==="wss",n.port=o.port,o.query&&(n.query=o.query)}else n.host&&(n.hostname=Q$(n.host).host);KI(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(o=>{const c=o.prototype.name;this.transports.push(c),this._transportsByName[c]=o}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Vne(this.opts.query)),J$&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},cp.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=XF,n.transport=t,this.id&&(n.sid=this.id);const o=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](o)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&jr.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.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))}onOpen(){this.readyState="open",jr.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),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 t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let o=0;o<this.writeBuffer.length;o++){const c=this.writeBuffer[o].data;if(c&&(n+=Pne(c)),o>0&&n>this._maxPayload)return this.writeBuffer.slice(0,o);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,YI(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,o){return this._sendPacket("message",t,n,o),this}send(t,n,o){return this._sendPacket("message",t,n,o),this}_sendPacket(t,n,o,c){if(typeof n=="function"&&(c=n,n=void 0),typeof o=="function"&&(c=o,o=null),this.readyState==="closing"||this.readyState==="closed")return;o=o||{},o.compress=o.compress!==!1;const s={type:t,data:n,options:o};this.emitReserved("packetCreate",s),this.writeBuffer.push(s),c&&this.once("flush",c),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},o=()=>{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?o():t()}):this.upgrading?o():t()),this}_onError(t){if(jr.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),J$&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const o=cp.indexOf(this._offlineEventListener);o!==-1&&cp.splice(o,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}jr.protocol=XF;class oae extends jr{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),o=!1;jr.priorWebsocketSuccess=!1;const c=()=>{o||(n.send([{type:"ping",data:"probe"}]),n.once("packet",v=>{if(!o)if(v.type==="pong"&&v.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;jr.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{o||this.readyState!=="closed"&&(m(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const x=new Error("probe error");x.transport=n.name,this.emitReserved("upgradeError",x)}}))};function s(){o||(o=!0,m(),n.close(),n=null)}const d=v=>{const x=new Error("probe error: "+v);x.transport=n.name,s(),this.emitReserved("upgradeError",x)};function p(){d("transport closed")}function y(){d("socket closed")}function f(v){n&&v.name!==n.name&&s()}const m=()=>{n.removeListener("open",c),n.removeListener("error",d),n.removeListener("close",p),this.off("close",y),this.off("upgrading",f)};n.once("open",c),n.once("error",d),n.once("close",p),this.once("close",y),this.once("upgrading",f),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{o||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let o=0;o<t.length;o++)~this.transports.indexOf(t[o])&&n.push(t[o]);return n}}let rae=class extends oae{constructor(t,n={}){const o=typeof t=="object"?t:n;(!o.transports||o.transports&&typeof o.transports[0]=="string")&&(o.transports=(o.transports||["polling","websocket","webtransport"]).map(c=>Jne[c]).filter(c=>!!c)),super(t,o)}};function cae(e,t="",n){let o=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),o=Q$(e)),o.port||(/^(http|ws)$/.test(o.protocol)?o.port="80":/^(http|ws)s$/.test(o.protocol)&&(o.port="443")),o.path=o.path||"/";const s=o.host.indexOf(":")!==-1?"["+o.host+"]":o.host;return o.id=o.protocol+"://"+s+":"+o.port+t,o.href=o.protocol+"://"+s+(n&&n.port===o.port?"":":"+o.port),o}const iae=typeof ArrayBuffer=="function",sae=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,eU=Object.prototype.toString,lae=typeof Blob=="function"||typeof Blob<"u"&&eU.call(Blob)==="[object BlobConstructor]",dae=typeof File=="function"||typeof File<"u"&&eU.call(File)==="[object FileConstructor]";function Qz(e){return iae&&(e instanceof ArrayBuffer||sae(e))||lae&&e instanceof Blob||dae&&e instanceof File}function ip(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,o=e.length;n<o;n++)if(ip(e[n]))return!0;return!1}if(Qz(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return ip(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&ip(e[n]))return!0;return!1}function uae(e){const t=[],n=e.data,o=e;return o.data=ez(n,t),o.attachments=t.length,{packet:o,buffers:t}}function ez(e,t){if(!e)return e;if(Qz(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){const n=new Array(e.length);for(let o=0;o<e.length;o++)n[o]=ez(e[o],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=ez(e[o],t));return n}return e}function hae(e,t){return e.data=tz(e.data,t),delete e.attachments,e}function tz(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=tz(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=tz(e[n],t));return e}const pae=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],fae=5;var dt;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(dt||(dt={}));class yae{constructor(t){this.replacer=t}encode(t){return(t.type===dt.EVENT||t.type===dt.ACK)&&ip(t)?this.encodeAsBinary({type:t.type===dt.EVENT?dt.BINARY_EVENT:dt.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===dt.BINARY_EVENT||t.type===dt.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=uae(t),o=this.encodeAsString(n.packet),c=n.buffers;return c.unshift(o),c}}function LV(e){return Object.prototype.toString.call(e)==="[object Object]"}class Jz extends Wt{constructor(t){super(),this.reviver=t}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const o=n.type===dt.BINARY_EVENT;o||n.type===dt.BINARY_ACK?(n.type=o?dt.EVENT:dt.ACK,this.reconstructor=new mae(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(Qz(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),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: "+t)}decodeString(t){let n=0;const o={type:Number(t.charAt(0))};if(dt[o.type]===void 0)throw new Error("unknown packet type "+o.type);if(o.type===dt.BINARY_EVENT||o.type===dt.BINARY_ACK){const s=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const d=t.substring(s,n);if(d!=Number(d)||t.charAt(n)!=="-")throw new Error("Illegal attachments");o.attachments=Number(d)}if(t.charAt(n+1)==="/"){const s=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););o.nsp=t.substring(s,n)}else o.nsp="/";const c=t.charAt(n+1);if(c!==""&&Number(c)==c){const s=n+1;for(;++n;){const d=t.charAt(n);if(d==null||Number(d)!=d){--n;break}if(n===t.length)break}o.id=Number(t.substring(s,n+1))}if(t.charAt(++n)){const s=this.tryParse(t.substr(n));if(Jz.isPayloadValid(o.type,s))o.data=s;else throw new Error("invalid payload")}return o}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case dt.CONNECT:return LV(n);case dt.DISCONNECT:return n===void 0;case dt.CONNECT_ERROR:return typeof n=="string"||LV(n);case dt.EVENT:case dt.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&pae.indexOf(n[0])===-1);case dt.ACK:case dt.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class mae{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=hae(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const kae=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Jz,Encoder:yae,get PacketType(){return dt},protocol:fae},Symbol.toStringTag,{value:"Module"}));function Oa(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const gae=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class tU extends Wt{constructor(t,n,o){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,o&&o.auth&&(this.auth=o.auth),this._opts=Object.assign({},o),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Oa(t,"open",this.onopen.bind(this)),Oa(t,"packet",this.onpacket.bind(this)),Oa(t,"error",this.onerror.bind(this)),Oa(t,"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(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var o,c,s;if(gae.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const d={type:dt.EVENT,data:n};if(d.options={},d.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const m=this.ids++,v=n.pop();this._registerAckCallback(m,v),d.id=m}const p=(c=(o=this.io.engine)===null||o===void 0?void 0:o.transport)===null||c===void 0?void 0:c.writable,y=this.connected&&!(!((s=this.io.engine)===null||s===void 0)&&s._hasPingExpired());return this.flags.volatile&&!p||(y?(this.notifyOutgoingListeners(d),this.packet(d)):this.sendBuffer.push(d)),this.flags={},this}_registerAckCallback(t,n){var o;const c=(o=this.flags.timeout)!==null&&o!==void 0?o:this._opts.ackTimeout;if(c===void 0){this.acks[t]=n;return}const s=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let p=0;p<this.sendBuffer.length;p++)this.sendBuffer[p].id===t&&this.sendBuffer.splice(p,1);n.call(this,new Error("operation has timed out"))},c),d=(...p)=>{this.io.clearTimeoutFn(s),n.apply(this,p)};d.withError=!0,this.acks[t]=d}emitWithAck(t,...n){return new Promise((o,c)=>{const s=(d,p)=>d?c(d):o(p);s.withError=!0,n.push(s),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const o={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((c,...s)=>o!==this._queue[0]?void 0:(c!==null?o.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(c)):(this._queue.shift(),n&&n(null,...s)),o.pending=!1,this._drainQueue())),this._queue.push(o),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:dt.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(o=>String(o.id)===t)){const o=this.acks[t];delete this.acks[t],o.withError&&o.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case dt.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):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 dt.EVENT:case dt.BINARY_EVENT:this.onevent(t);break;case dt.ACK:case dt.BINARY_ACK:this.onack(t);break;case dt.DISCONNECT:this.ondisconnect();break;case dt.CONNECT_ERROR:this.destroy();const o=new Error(t.data.message);o.data=t.data.data,this.emitReserved("connect_error",o);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const o of n)o.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let o=!1;return function(...c){o||(o=!0,n.packet({type:dt.ACK,id:t,data:c}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:dt.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let o=0;o<n.length;o++)if(t===n[o])return n.splice(o,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const n=this._anyOutgoingListeners;for(let o=0;o<n.length;o++)if(t===n[o])return n.splice(o,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const o of n)o.apply(this,t.data)}}}function Dd(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Dd.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=(Math.floor(t*10)&1)==0?e-n:e+n}return Math.min(e,this.max)|0};Dd.prototype.reset=function(){this.attempts=0};Dd.prototype.setMin=function(e){this.ms=e};Dd.prototype.setMax=function(e){this.max=e};Dd.prototype.setJitter=function(e){this.jitter=e};class nz extends Wt{constructor(t,n){var o;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,KI(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((o=n.randomizationFactor)!==null&&o!==void 0?o:.5),this.backoff=new Dd({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const c=n.parser||kae;this.encoder=new c.Encoder,this.decoder=new c.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new rae(this.uri,this.opts);const n=this.engine,o=this;this._readyState="opening",this.skipReconnect=!1;const c=Oa(n,"open",function(){o.onopen(),t&&t()}),s=p=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",p),t?t(p):this.maybeReconnectOnOpen()},d=Oa(n,"error",s);if(this._timeout!==!1){const p=this._timeout,y=this.setTimeoutFn(()=>{c(),s(new Error("timeout")),n.close()},p);this.opts.autoUnref&&y.unref(),this.subs.push(()=>{this.clearTimeoutFn(y)})}return this.subs.push(c),this.subs.push(d),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Oa(t,"ping",this.onping.bind(this)),Oa(t,"data",this.ondata.bind(this)),Oa(t,"error",this.onerror.bind(this)),Oa(t,"close",this.onclose.bind(this)),Oa(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){YI(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let o=this.nsps[t];return o?this._autoConnect&&!o.active&&o.connect():(o=new tU(this,t,n),this.nsps[t]=o),o}_destroy(t){const n=Object.keys(this.nsps);for(const o of n)if(this.nsps[o].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let o=0;o<n.length;o++)this.engine.write(n[o],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var o;this.cleanup(),(o=this.engine)===null||o===void 0||o.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=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 o=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(c=>{c?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",c)):t.onreconnect()}))},n);this.opts.autoUnref&&o.unref(),this.subs.push(()=>{this.clearTimeoutFn(o)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Ju={};function sp(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=cae(e,t.path||"/socket.io"),o=n.source,c=n.id,s=n.path,d=Ju[c]&&s in Ju[c].nsps,p=t.forceNew||t["force new connection"]||t.multiplex===!1||d;let y;return p?y=new nz(o,t):(Ju[c]||(Ju[c]=new nz(o,t)),y=Ju[c]),n.query&&!t.query&&(t.query=n.queryKey),y.socket(n.path,t)}Object.assign(sp,{Manager:nz,Socket:tU,io:sp,connect:sp});const vae=1,xae=1e6;let n$=0;function Mae(){return n$=(n$+1)%Number.MAX_SAFE_INTEGER,n$.toString()}const a$=new Map,NV=e=>{if(a$.has(e))return;const t=setTimeout(()=>{a$.delete(e),h2({type:"REMOVE_TOAST",toastId:e})},xae);a$.set(e,t)},bae=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,vae)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?NV(n):e.toasts.forEach(o=>{NV(o.id)}),{...e,toasts:e.toasts.map(o=>o.id===n||n===void 0?{...o,open:!1}:o)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},lp=[];let dp={toasts:[]};function h2(e){dp=bae(dp,e),lp.forEach(t=>{t(dp)})}function Ar({...e}){const t=Mae(),n=c=>h2({type:"UPDATE_TOAST",toast:{...c,id:t}}),o=()=>h2({type:"DISMISS_TOAST",toastId:t});return h2({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:c=>{c||o()}}}),{id:t,dismiss:o,update:n}}function Zt(){const[e,t]=g.useState(dp);return g.useEffect(()=>(lp.push(t),()=>{const n=lp.indexOf(t);n>-1&&lp.splice(n,1)}),[e]),{...e,toast:Ar,dismiss:n=>h2({type:"DISMISS_TOAST",toastId:n})}}const qe=async(e,t={},n)=>{const o=Ee.getState().token,c={"Content-Type":"application/json",...t.headers};o&&(c.Authorization=`Bearer ${o}`);try{const s=await fetch(e,{...t,headers:c});if(s.status===204||s.headers.get("content-length")==="0")return n&&Ar({title:"Успех!",description:n}),!0;const d=await s.json();if(!s.ok)throw s.status===401&&Ee.getState().logout(),new Error(d.error||"Произошла неизвестная ошибка на сервере");return n&&Ar({title:"Успех!",description:n}),d}catch(s){throw s.message!=="Невалидный токен"&&s.message!=="Нет токена, доступ запрещен"&&Ar({variant:"destructive",title:"Ошибка",description:s.message}),s}},wae=(e,t)=>({socket:null,bots:[],servers:[],botStatuses:{},botLogs:{},resourceUsage:{},appVersion:"",connectSocket:()=>{t().socket&&t().socket.disconnect();const n=t().token;if(!n){console.log("[Socket] Подключение отложено: нет токена.");return}const o=sp("http://localhost:3001",{auth:{token:n}});o.on("connect",()=>console.log("Socket.IO подключен:",o.id)),o.on("disconnect",()=>console.log("Socket.IO отключен")),o.on("bot:status",({botId:c,status:s,message:d})=>{e(p=>{p.botStatuses[c]=s}),d&&t().appendLog(c,`[SYSTEM] ${d}`)}),o.on("bot:log",({botId:c,log:s})=>t().appendLog(c,s)),o.on("bots:usage",c=>{const s=c.reduce((d,p)=>({...d,[p.botId]:p}),{});e({resourceUsage:s})}),e({socket:o})},fetchInitialData:async()=>{try{const[n,o,c,s]=await Promise.all([qe("/api/bots"),qe("/api/servers"),qe("/api/bots/state"),qe("/api/version")]);e(d=>{d.bots=n||[],d.servers=o||[],d.botStatuses=c.statuses||{},d.botLogs=c.logs||{},d.appVersion=s.version||""})}catch(n){console.error("Не удалось загрузить начальные данные:",n.message),e(o=>{o.bots=[],o.servers=[]})}},appendLog:(n,o)=>{e(c=>{const s=c.botLogs[n]||[];c.botLogs[n]=[...s,o].slice(-200)})}}),_ae=(e,t)=>({createBot:async n=>{const o=await qe("/api/bots",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},"Новый бот успешно создан.");return o&&await t().fetchInitialData(),o},startBot:async n=>{await qe(`/api/bots/${n}/start`,{method:"POST"})},stopBot:async n=>{await qe(`/api/bots/${n}/stop`,{method:"POST"})},deleteBot:async n=>{await qe(`/api/bots/${n}`,{method:"DELETE"},"Бот успешно удален."),await t().fetchInitialData()},startAllBots:async()=>{await qe("/api/bots/start-all",{method:"POST"},"Команда на запуск всех ботов отправлена.")},stopAllBots:async()=>{await qe("/api/bots/stop-all",{method:"POST"},"Команда на остановку всех ботов отправлена.")}}),Sae=(e,t)=>({installedPlugins:{},pluginUpdates:{},pluginCatalog:[],isCatalogLoading:!0,optimisticallyIncrementDownloadCount:n=>{e(o=>{const c=o.pluginCatalog.find(s=>s.name===n);c&&(c.downloads=(c.downloads||0)+1)})},fetchPluginCatalog:async()=>{if(t().pluginCatalog.length>0){e({isCatalogLoading:!1});return}e({isCatalogLoading:!0});try{const n=await qe("/api/plugins/catalog");let o=new Map;try{const s=await fetch("http://185.65.200.184:3000/api/stats");if(s.ok){const d=await s.json();o=new Map(((d==null?void 0:d.plugins)||[]).map(p=>[p.pluginName,p.downloadCount]))}}catch(s){console.warn("Не удалось загрузить статистику скачиваний плагинов:",s.message)}const c=(n||[]).map(s=>({...s,downloads:o.get(s.name)||0}));e({pluginCatalog:c,isCatalogLoading:!1})}catch(n){console.error("Не удалось загрузить каталог плагинов:",n.message),e({pluginCatalog:[],isCatalogLoading:!1})}},fetchInstalledPlugins:async n=>{try{const c=(await qe(`/api/bots/${n}/plugins`)).map(s=>{let d;try{d=s.manifest?JSON.parse(s.manifest):{}}catch{console.error(`Ошибка парсинга манифеста для плагина ${s.name}`),d={}}const p=t().pluginCatalog.find(y=>y.name===s.name);return{...s,manifest:d,author:(p==null?void 0:p.author)||d.author||"Неизвестный автор",description:s.description||d.description||"Нет описания"}});e(s=>{s.installedPlugins[n]=c})}catch(o){console.error("Не удалось загрузить плагины для бота",n,o),e(c=>{c.installedPlugins[n]=[]})}},togglePlugin:async(n,o,c)=>{await qe(`/api/bots/${n}/plugins/${o}`,{method:"PUT",body:JSON.stringify({isEnabled:c})},"Статус плагина обновлен."),await t().fetchInstalledPlugins(n)},deletePlugin:async(n,o,c)=>{await qe(`/api/bots/${n}/plugins/${o}`,{method:"DELETE"},`Плагин "${c}" удален.`),await t().fetchInstalledPlugins(n)},installPluginFromRepo:async(n,o,c)=>{c&&t().optimisticallyIncrementDownloadCount(c);try{const s=await qe(`/api/bots/${n}/plugins/install/github`,{method:"POST",body:JSON.stringify({repoUrl:o})});return Ar({title:"Успех!",description:`Плагин "${s.name}" успешно установлен.`}),await t().fetchInstalledPlugins(n),s}catch(s){throw await t().fetchPluginCatalog(),s}},installPluginFromPath:async(n,o)=>{try{const c=await qe(`/api/bots/${n}/plugins/register/local`,{method:"POST",body:JSON.stringify({path:o})});return Ar({title:"Успех!",description:`Плагин "${c.name}" успешно установлен.`}),c}catch(c){throw c}finally{await t().fetchInstalledPlugins(n),await t().fetchPluginCatalog()}},checkForUpdates:async n=>{try{const o=await qe(`/api/plugins/check-updates/${n}`,{method:"POST"}),c=o.reduce((s,d)=>({...s,[d.sourceUri]:d}),{});e(s=>{s.pluginUpdates[n]=c}),Ar({title:"Проверка завершена",description:`Найдено обновлений: ${o.length}`})}catch(o){console.error("Ошибка проверки обновлений:",o)}},updatePlugin:async(n,o)=>{await qe(`/api/plugins/update/${n}`,{method:"POST"},"Плагин обновлен. Перезапустите бота."),await t().fetchInstalledPlugins(o),await t().checkForUpdates(o)}}),Cae=(e,t)=>({tasks:[],fetchTasks:async()=>{try{const n=await qe("/api/tasks");e({tasks:n||[]})}catch(n){console.error("Не удалось загрузить задачи:",n.message),e({tasks:[]})}},createTask:async n=>{const o=await qe("/api/tasks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},"Задача успешно создана.");return o&&e(c=>{c.tasks.unshift(o)}),o},updateTask:async(n,o)=>{const c=await qe(`/api/tasks/${n}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)},"Задача успешно обновлена.");return c&&e(s=>{const d=s.tasks.findIndex(p=>p.id===n);d!==-1&&(s.tasks[d]={...s.tasks[d],...c})}),c},deleteTask:async n=>{await qe(`/api/tasks/${n}`,{method:"DELETE"},"Задача успешно удалена."),e(o=>{o.tasks=o.tasks.filter(c=>c.id!==n)})}}),Lae=(e,t)=>({token:localStorage.getItem("authToken")||null,user:null,isAuthenticated:!1,needsSetup:!1,authInitialized:!1,hasPermission:n=>{var c;if(!n)return!0;const o=((c=t().user)==null?void 0:c.permissions)||[];return o.includes("*")||o.includes(n)},initializeAuth:async()=>{try{if((await qe("/api/auth/status")).needsSetup){e({needsSetup:!0,isAuthenticated:!1,token:null,user:null});return}if(e({needsSetup:!1}),t().token){const c=await qe("/api/auth/me");e({user:c,isAuthenticated:!0})}else e({isAuthenticated:!1,user:null,token:null})}catch(n){console.error("Auth initialization failed:",n.message),(n.message.includes("Невалидный токен")||n.message.includes("Нет токена"))&&localStorage.removeItem("authToken"),e({isAuthenticated:!1,token:null,user:null})}finally{e({authInitialized:!0})}},login:async(n,o)=>{const c=await qe("/api/auth/login",{method:"POST",body:JSON.stringify({username:n,password:o})});localStorage.setItem("authToken",c.token),t().connectSocket(),e({token:c.token,user:c.user,isAuthenticated:!0})},setupAdmin:async(n,o)=>{const c=await qe("/api/auth/setup",{method:"POST",body:JSON.stringify({username:n,password:o})});localStorage.setItem("authToken",c.token),t().connectSocket(),e({token:c.token,user:c.user,isAuthenticated:!0,needsSetup:!1})},logout:()=>{const n=t().socket;n&&n.disconnect(),localStorage.removeItem("authToken"),e({token:null,user:null,isAuthenticated:!1,socket:null})}}),Ee=hne(Sne((...e)=>({...wae(...e),..._ae(...e),...Sae(...e),...Cae(...e),...Lae(...e)})));function ke(e,t,{checkForDefaultPrevented:n=!0}={}){return function(c){if(e==null||e(c),n===!1||!c.defaultPrevented)return t==null?void 0:t(c)}}function jV(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Fo(...e){return t=>{let n=!1;const o=e.map(c=>{const s=jV(c,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let c=0;c<o.length;c++){const s=o[c];typeof s=="function"?s():jV(e[c],null)}}}}function Ye(...e){return g.useCallback(Fo(...e),e)}function Nae(e,t){const n=g.createContext(t),o=s=>{const{children:d,...p}=s,y=g.useMemo(()=>p,Object.values(p));return l.jsx(n.Provider,{value:y,children:d})};o.displayName=e+"Provider";function c(s){const d=g.useContext(n);if(d)return d;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[o,c]}function xn(e,t=[]){let n=[];function o(s,d){const p=g.createContext(d),y=n.length;n=[...n,d];const f=v=>{var S;const{scope:x,children:b,...w}=v,_=((S=x==null?void 0:x[e])==null?void 0:S[y])||p,L=g.useMemo(()=>w,Object.values(w));return l.jsx(_.Provider,{value:L,children:b})};f.displayName=s+"Provider";function m(v,x){var _;const b=((_=x==null?void 0:x[e])==null?void 0:_[y])||p,w=g.useContext(b);if(w)return w;if(d!==void 0)return d;throw new Error(`\`${v}\` must be used within \`${s}\``)}return[f,m]}const c=()=>{const s=n.map(d=>g.createContext(d));return function(p){const y=(p==null?void 0:p[e])||s;return g.useMemo(()=>({[`__scope${e}`]:{...p,[e]:y}}),[p,y])}};return c.scopeName=e,[o,jae(c,...t)]}function jae(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(c=>({useScope:c(),scopeName:c.scopeName}));return function(s){const d=o.reduce((p,{useScope:y,scopeName:f})=>{const v=y(s)[`__scope${f}`];return{...p,...v}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:d}),[d])}};return n.scopeName=t.scopeName,n}function Pr(e){const t=Iae(e),n=g.forwardRef((o,c)=>{const{children:s,...d}=o,p=g.Children.toArray(s),y=p.find(Eae);if(y){const f=y.props.children,m=p.map(v=>v===y?g.Children.count(f)>1?g.Children.only(null):g.isValidElement(f)?f.props.children:null:v);return l.jsx(t,{...d,ref:c,children:g.isValidElement(f)?g.cloneElement(f,void 0,m):null})}return l.jsx(t,{...d,ref:c,children:s})});return n.displayName=`${e}.Slot`,n}var Aae=Pr("Slot");function Iae(e){const t=g.forwardRef((n,o)=>{const{children:c,...s}=n;if(g.isValidElement(c)){const d=Rae(c),p=Tae(s,c.props);return c.type!==g.Fragment&&(p.ref=o?Fo(o,d):d),g.cloneElement(c,p)}return g.Children.count(c)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var nU=Symbol("radix.slottable");function aU(e){const t=({children:n})=>l.jsx(l.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=nU,t}function Eae(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===nU}function Tae(e,t){const n={...t};for(const o in t){const c=e[o],s=t[o];/^on[A-Z]/.test(o)?c&&s?n[o]=(...p)=>{const y=s(...p);return c(...p),y}:c&&(n[o]=c):o==="style"?n[o]={...c,...s}:o==="className"&&(n[o]=[c,s].filter(Boolean).join(" "))}return{...e,...n}}function Rae(e){var o,c;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(c=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:c.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function sh(e){const t=e+"CollectionProvider",[n,o]=xn(t),[c,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),d=_=>{const{scope:L,children:S}=_,A=bt.useRef(null),I=bt.useRef(new Map).current;return l.jsx(c,{scope:L,itemMap:I,collectionRef:A,children:S})};d.displayName=t;const p=e+"CollectionSlot",y=Pr(p),f=bt.forwardRef((_,L)=>{const{scope:S,children:A}=_,I=s(p,S),R=Ye(L,I.collectionRef);return l.jsx(y,{ref:R,children:A})});f.displayName=p;const m=e+"CollectionItemSlot",v="data-radix-collection-item",x=Pr(m),b=bt.forwardRef((_,L)=>{const{scope:S,children:A,...I}=_,R=bt.useRef(null),$=Ye(L,R),N=s(m,S);return bt.useEffect(()=>(N.itemMap.set(R,{ref:R,...I}),()=>void N.itemMap.delete(R))),l.jsx(x,{[v]:"",ref:$,children:A})});b.displayName=m;function w(_){const L=s(e+"CollectionConsumer",_);return bt.useCallback(()=>{const A=L.collectionRef.current;if(!A)return[];const I=Array.from(A.querySelectorAll(`[${v}]`));return Array.from(L.itemMap.values()).sort((N,O)=>I.indexOf(N.ref.current)-I.indexOf(O.ref.current))},[L.collectionRef,L.itemMap])}return[{Provider:d,Slot:f,ItemSlot:b},w,o]}var $ae=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],we=$ae.reduce((e,t)=>{const n=Pr(`Primitive.${t}`),o=g.forwardRef((c,s)=>{const{asChild:d,...p}=c,y=d?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(y,{...p,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function eD(e,t){e&&h1.flushSync(()=>e.dispatchEvent(t))}function Ut(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>(...n)=>{var o;return(o=t.current)==null?void 0:o.call(t,...n)},[])}function zae(e,t=globalThis==null?void 0:globalThis.document){const n=Ut(e);g.useEffect(()=>{const o=c=>{c.key==="Escape"&&n(c)};return t.addEventListener("keydown",o,{capture:!0}),()=>t.removeEventListener("keydown",o,{capture:!0})},[n,t])}var Dae="DismissableLayer",az="dismissableLayer.update",qae="dismissableLayer.pointerDownOutside",Pae="dismissableLayer.focusOutside",AV,oU=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),p1=g.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:c,onFocusOutside:s,onInteractOutside:d,onDismiss:p,...y}=e,f=g.useContext(oU),[m,v]=g.useState(null),x=(m==null?void 0:m.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=g.useState({}),w=Ye(t,O=>v(O)),_=Array.from(f.layers),[L]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),S=_.indexOf(L),A=m?_.indexOf(m):-1,I=f.layersWithOutsidePointerEventsDisabled.size>0,R=A>=S,$=Hae(O=>{const H=O.target,K=[...f.branches].some(J=>J.contains(H));!R||K||(c==null||c(O),d==null||d(O),O.defaultPrevented||p==null||p())},x),N=Vae(O=>{const H=O.target;[...f.branches].some(J=>J.contains(H))||(s==null||s(O),d==null||d(O),O.defaultPrevented||p==null||p())},x);return zae(O=>{A===f.layers.size-1&&(o==null||o(O),!O.defaultPrevented&&p&&(O.preventDefault(),p()))},x),g.useEffect(()=>{if(m)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(AV=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(m)),f.layers.add(m),IV(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=AV)}},[m,x,n,f]),g.useEffect(()=>()=>{m&&(f.layers.delete(m),f.layersWithOutsidePointerEventsDisabled.delete(m),IV())},[m,f]),g.useEffect(()=>{const O=()=>b({});return document.addEventListener(az,O),()=>document.removeEventListener(az,O)},[]),l.jsx(we.div,{...y,ref:w,style:{pointerEvents:I?R?"auto":"none":void 0,...e.style},onFocusCapture:ke(e.onFocusCapture,N.onFocusCapture),onBlurCapture:ke(e.onBlurCapture,N.onBlurCapture),onPointerDownCapture:ke(e.onPointerDownCapture,$.onPointerDownCapture)})});p1.displayName=Dae;var Oae="DismissableLayerBranch",rU=g.forwardRef((e,t)=>{const n=g.useContext(oU),o=g.useRef(null),c=Ye(t,o);return g.useEffect(()=>{const s=o.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),l.jsx(we.div,{...e,ref:c})});rU.displayName=Oae;function Hae(e,t=globalThis==null?void 0:globalThis.document){const n=Ut(e),o=g.useRef(!1),c=g.useRef(()=>{});return g.useEffect(()=>{const s=p=>{if(p.target&&!o.current){let y=function(){cU(qae,n,f,{discrete:!0})};const f={originalEvent:p};p.pointerType==="touch"?(t.removeEventListener("click",c.current),c.current=y,t.addEventListener("click",c.current,{once:!0})):y()}else t.removeEventListener("click",c.current);o.current=!1},d=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(d),t.removeEventListener("pointerdown",s),t.removeEventListener("click",c.current)}},[t,n]),{onPointerDownCapture:()=>o.current=!0}}function Vae(e,t=globalThis==null?void 0:globalThis.document){const n=Ut(e),o=g.useRef(!1);return g.useEffect(()=>{const c=s=>{s.target&&!o.current&&cU(Pae,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",c),()=>t.removeEventListener("focusin",c)},[t,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function IV(){const e=new CustomEvent(az);document.dispatchEvent(e)}function cU(e,t,n,{discrete:o}){const c=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&c.addEventListener(e,t,{once:!0}),o?eD(c,s):c.dispatchEvent(s)}var Bae=p1,Fae=rU,an=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},Uae="Portal",f1=g.forwardRef((e,t)=>{var p;const{container:n,...o}=e,[c,s]=g.useState(!1);an(()=>s(!0),[]);const d=n||c&&((p=globalThis==null?void 0:globalThis.document)==null?void 0:p.body);return d?ine.createPortal(l.jsx(we.div,{...o,ref:t}),d):null});f1.displayName=Uae;function Gae(e,t){return g.useReducer((n,o)=>t[n][o]??n,e)}var Jt=e=>{const{present:t,children:n}=e,o=Zae(t),c=typeof n=="function"?n({present:o.isPresent}):g.Children.only(n),s=Ye(o.ref,Xae(c));return typeof n=="function"||o.isPresent?g.cloneElement(c,{ref:s}):null};Jt.displayName="Presence";function Zae(e){const[t,n]=g.useState(),o=g.useRef(null),c=g.useRef(e),s=g.useRef("none"),d=e?"mounted":"unmounted",[p,y]=Gae(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const f=O0(o.current);s.current=p==="mounted"?f:"none"},[p]),an(()=>{const f=o.current,m=c.current;if(m!==e){const x=s.current,b=O0(f);e?y("MOUNT"):b==="none"||(f==null?void 0:f.display)==="none"?y("UNMOUNT"):y(m&&x!==b?"ANIMATION_OUT":"UNMOUNT"),c.current=e}},[e,y]),an(()=>{if(t){let f;const m=t.ownerDocument.defaultView??window,v=b=>{const _=O0(o.current).includes(b.animationName);if(b.target===t&&_&&(y("ANIMATION_END"),!c.current)){const L=t.style.animationFillMode;t.style.animationFillMode="forwards",f=m.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=L)})}},x=b=>{b.target===t&&(s.current=O0(o.current))};return t.addEventListener("animationstart",x),t.addEventListener("animationcancel",v),t.addEventListener("animationend",v),()=>{m.clearTimeout(f),t.removeEventListener("animationstart",x),t.removeEventListener("animationcancel",v),t.removeEventListener("animationend",v)}}else y("ANIMATION_END")},[t,y]),{isPresent:["mounted","unmountSuspended"].includes(p),ref:g.useCallback(f=>{o.current=f?getComputedStyle(f):null,n(f)},[])}}function O0(e){return(e==null?void 0:e.animationName)||"none"}function Xae(e){var o,c;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(c=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:c.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Yae=dF[" useInsertionEffect ".trim().toString()]||an;function Zn({prop:e,defaultProp:t,onChange:n=()=>{},caller:o}){const[c,s,d]=Kae({defaultProp:t,onChange:n}),p=e!==void 0,y=p?e:c;{const m=g.useRef(e!==void 0);g.useEffect(()=>{const v=m.current;v!==p&&console.warn(`${o} is changing from ${v?"controlled":"uncontrolled"} to ${p?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),m.current=p},[p,o])}const f=g.useCallback(m=>{var v;if(p){const x=Wae(m)?m(e):m;x!==e&&((v=d.current)==null||v.call(d,x))}else s(m)},[p,e,s,d]);return[y,f]}function Kae({defaultProp:e,onChange:t}){const[n,o]=g.useState(e),c=g.useRef(n),s=g.useRef(t);return Yae(()=>{s.current=t},[t]),g.useEffect(()=>{var d;c.current!==n&&((d=s.current)==null||d.call(s,n),c.current=n)},[n,c]),[n,o,s]}function Wae(e){return typeof e=="function"}var iU=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Qae="VisuallyHidden",WI=g.forwardRef((e,t)=>l.jsx(we.span,{...e,ref:t,style:{...iU,...e.style}}));WI.displayName=Qae;var Jae=WI,tD="ToastProvider",[nD,eoe,toe]=sh("Toast"),[sU,E3t]=xn("Toast",[toe]),[noe,QI]=sU(tD),lU=e=>{const{__scopeToast:t,label:n="Notification",duration:o=5e3,swipeDirection:c="right",swipeThreshold:s=50,children:d}=e,[p,y]=g.useState(null),[f,m]=g.useState(0),v=g.useRef(!1),x=g.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${tD}\`. Expected non-empty \`string\`.`),l.jsx(nD.Provider,{scope:t,children:l.jsx(noe,{scope:t,label:n,duration:o,swipeDirection:c,swipeThreshold:s,toastCount:f,viewport:p,onViewportChange:y,onToastAdd:g.useCallback(()=>m(b=>b+1),[]),onToastRemove:g.useCallback(()=>m(b=>b-1),[]),isFocusedToastEscapeKeyDownRef:v,isClosePausedRef:x,children:d})})};lU.displayName=tD;var dU="ToastViewport",aoe=["F8"],oz="toast.viewportPause",rz="toast.viewportResume",uU=g.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:o=aoe,label:c="Notifications ({hotkey})",...s}=e,d=QI(dU,n),p=eoe(n),y=g.useRef(null),f=g.useRef(null),m=g.useRef(null),v=g.useRef(null),x=Ye(t,v,d.onViewportChange),b=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),w=d.toastCount>0;g.useEffect(()=>{const L=S=>{var I;o.length!==0&&o.every(R=>S[R]||S.code===R)&&((I=v.current)==null||I.focus())};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[o]),g.useEffect(()=>{const L=y.current,S=v.current;if(w&&L&&S){const A=()=>{if(!d.isClosePausedRef.current){const N=new CustomEvent(oz);S.dispatchEvent(N),d.isClosePausedRef.current=!0}},I=()=>{if(d.isClosePausedRef.current){const N=new CustomEvent(rz);S.dispatchEvent(N),d.isClosePausedRef.current=!1}},R=N=>{!L.contains(N.relatedTarget)&&I()},$=()=>{L.contains(document.activeElement)||I()};return L.addEventListener("focusin",A),L.addEventListener("focusout",R),L.addEventListener("pointermove",A),L.addEventListener("pointerleave",$),window.addEventListener("blur",A),window.addEventListener("focus",I),()=>{L.removeEventListener("focusin",A),L.removeEventListener("focusout",R),L.removeEventListener("pointermove",A),L.removeEventListener("pointerleave",$),window.removeEventListener("blur",A),window.removeEventListener("focus",I)}}},[w,d.isClosePausedRef]);const _=g.useCallback(({tabbingDirection:L})=>{const A=p().map(I=>{const R=I.ref.current,$=[R,...moe(R)];return L==="forwards"?$:$.reverse()});return(L==="forwards"?A.reverse():A).flat()},[p]);return g.useEffect(()=>{const L=v.current;if(L){const S=A=>{var $,N,O;const I=A.altKey||A.ctrlKey||A.metaKey;if(A.key==="Tab"&&!I){const H=document.activeElement,K=A.shiftKey;if(A.target===L&&K){($=f.current)==null||$.focus();return}const q=_({tabbingDirection:K?"backwards":"forwards"}),P=q.findIndex(D=>D===H);o$(q.slice(P+1))?A.preventDefault():K?(N=f.current)==null||N.focus():(O=m.current)==null||O.focus()}};return L.addEventListener("keydown",S),()=>L.removeEventListener("keydown",S)}},[p,_]),l.jsxs(Fae,{ref:y,role:"region","aria-label":c.replace("{hotkey}",b),tabIndex:-1,style:{pointerEvents:w?void 0:"none"},children:[w&&l.jsx(cz,{ref:f,onFocusFromOutsideViewport:()=>{const L=_({tabbingDirection:"forwards"});o$(L)}}),l.jsx(nD.Slot,{scope:n,children:l.jsx(we.ol,{tabIndex:-1,...s,ref:x})}),w&&l.jsx(cz,{ref:m,onFocusFromOutsideViewport:()=>{const L=_({tabbingDirection:"backwards"});o$(L)}})]})});uU.displayName=dU;var hU="ToastFocusProxy",cz=g.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:o,...c}=e,s=QI(hU,n);return l.jsx(WI,{"aria-hidden":!0,tabIndex:0,...c,ref:t,style:{position:"fixed"},onFocus:d=>{var f;const p=d.relatedTarget;!((f=s.viewport)!=null&&f.contains(p))&&o()}})});cz.displayName=hU;var lh="Toast",ooe="toast.swipeStart",roe="toast.swipeMove",coe="toast.swipeCancel",ioe="toast.swipeEnd",pU=g.forwardRef((e,t)=>{const{forceMount:n,open:o,defaultOpen:c,onOpenChange:s,...d}=e,[p,y]=Zn({prop:o,defaultProp:c??!0,onChange:s,caller:lh});return l.jsx(Jt,{present:n||p,children:l.jsx(doe,{open:p,...d,ref:t,onClose:()=>y(!1),onPause:Ut(e.onPause),onResume:Ut(e.onResume),onSwipeStart:ke(e.onSwipeStart,f=>{f.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:ke(e.onSwipeMove,f=>{const{x:m,y:v}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","move"),f.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${m}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${v}px`)}),onSwipeCancel:ke(e.onSwipeCancel,f=>{f.currentTarget.setAttribute("data-swipe","cancel"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:ke(e.onSwipeEnd,f=>{const{x:m,y:v}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","end"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${m}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${v}px`),y(!1)})})})});pU.displayName=lh;var[soe,loe]=sU(lh,{onClose(){}}),doe=g.forwardRef((e,t)=>{const{__scopeToast:n,type:o="foreground",duration:c,open:s,onClose:d,onEscapeKeyDown:p,onPause:y,onResume:f,onSwipeStart:m,onSwipeMove:v,onSwipeCancel:x,onSwipeEnd:b,...w}=e,_=QI(lh,n),[L,S]=g.useState(null),A=Ye(t,D=>S(D)),I=g.useRef(null),R=g.useRef(null),$=c||_.duration,N=g.useRef(0),O=g.useRef($),H=g.useRef(0),{onToastAdd:K,onToastRemove:J}=_,ce=Ut(()=>{var F;(L==null?void 0:L.contains(document.activeElement))&&((F=_.viewport)==null||F.focus()),d()}),q=g.useCallback(D=>{!D||D===1/0||(window.clearTimeout(H.current),N.current=new Date().getTime(),H.current=window.setTimeout(ce,D))},[ce]);g.useEffect(()=>{const D=_.viewport;if(D){const F=()=>{q(O.current),f==null||f()},z=()=>{const X=new Date().getTime()-N.current;O.current=O.current-X,window.clearTimeout(H.current),y==null||y()};return D.addEventListener(oz,z),D.addEventListener(rz,F),()=>{D.removeEventListener(oz,z),D.removeEventListener(rz,F)}}},[_.viewport,$,y,f,q]),g.useEffect(()=>{s&&!_.isClosePausedRef.current&&q($)},[s,$,_.isClosePausedRef,q]),g.useEffect(()=>(K(),()=>J()),[K,J]);const P=g.useMemo(()=>L?xU(L):null,[L]);return _.viewport?l.jsxs(l.Fragment,{children:[P&&l.jsx(uoe,{__scopeToast:n,role:"status","aria-live":o==="foreground"?"assertive":"polite","aria-atomic":!0,children:P}),l.jsx(soe,{scope:n,onClose:ce,children:h1.createPortal(l.jsx(nD.ItemSlot,{scope:n,children:l.jsx(Bae,{asChild:!0,onEscapeKeyDown:ke(p,()=>{_.isFocusedToastEscapeKeyDownRef.current||ce(),_.isFocusedToastEscapeKeyDownRef.current=!1}),children:l.jsx(we.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":s?"open":"closed","data-swipe-direction":_.swipeDirection,...w,ref:A,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:ke(e.onKeyDown,D=>{D.key==="Escape"&&(p==null||p(D.nativeEvent),D.nativeEvent.defaultPrevented||(_.isFocusedToastEscapeKeyDownRef.current=!0,ce()))}),onPointerDown:ke(e.onPointerDown,D=>{D.button===0&&(I.current={x:D.clientX,y:D.clientY})}),onPointerMove:ke(e.onPointerMove,D=>{if(!I.current)return;const F=D.clientX-I.current.x,z=D.clientY-I.current.y,X=!!R.current,G=["left","right"].includes(_.swipeDirection),ae=["left","up"].includes(_.swipeDirection)?Math.min:Math.max,C=G?ae(0,F):0,Y=G?0:ae(0,z),B=D.pointerType==="touch"?10:2,E={x:C,y:Y},ie={originalEvent:D,delta:E};X?(R.current=E,H0(roe,v,ie,{discrete:!1})):EV(E,_.swipeDirection,B)?(R.current=E,H0(ooe,m,ie,{discrete:!1}),D.target.setPointerCapture(D.pointerId)):(Math.abs(F)>B||Math.abs(z)>B)&&(I.current=null)}),onPointerUp:ke(e.onPointerUp,D=>{const F=R.current,z=D.target;if(z.hasPointerCapture(D.pointerId)&&z.releasePointerCapture(D.pointerId),R.current=null,I.current=null,F){const X=D.currentTarget,G={originalEvent:D,delta:F};EV(F,_.swipeDirection,_.swipeThreshold)?H0(ioe,b,G,{discrete:!0}):H0(coe,x,G,{discrete:!0}),X.addEventListener("click",ae=>ae.preventDefault(),{once:!0})}})})})}),_.viewport)})]}):null}),uoe=e=>{const{__scopeToast:t,children:n,...o}=e,c=QI(lh,t),[s,d]=g.useState(!1),[p,y]=g.useState(!1);return foe(()=>d(!0)),g.useEffect(()=>{const f=window.setTimeout(()=>y(!0),1e3);return()=>window.clearTimeout(f)},[]),p?null:l.jsx(f1,{asChild:!0,children:l.jsx(WI,{...o,children:s&&l.jsxs(l.Fragment,{children:[c.label," ",n]})})})},hoe="ToastTitle",fU=g.forwardRef((e,t)=>{const{__scopeToast:n,...o}=e;return l.jsx(we.div,{...o,ref:t})});fU.displayName=hoe;var poe="ToastDescription",yU=g.forwardRef((e,t)=>{const{__scopeToast:n,...o}=e;return l.jsx(we.div,{...o,ref:t})});yU.displayName=poe;var mU="ToastAction",kU=g.forwardRef((e,t)=>{const{altText:n,...o}=e;return n.trim()?l.jsx(vU,{altText:n,asChild:!0,children:l.jsx(aD,{...o,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${mU}\`. Expected non-empty \`string\`.`),null)});kU.displayName=mU;var gU="ToastClose",aD=g.forwardRef((e,t)=>{const{__scopeToast:n,...o}=e,c=loe(gU,n);return l.jsx(vU,{asChild:!0,children:l.jsx(we.button,{type:"button",...o,ref:t,onClick:ke(e.onClick,c.onClose)})})});aD.displayName=gU;var vU=g.forwardRef((e,t)=>{const{__scopeToast:n,altText:o,...c}=e;return l.jsx(we.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":o||void 0,...c,ref:t})});function xU(e){const t=[];return Array.from(e.childNodes).forEach(o=>{if(o.nodeType===o.TEXT_NODE&&o.textContent&&t.push(o.textContent),yoe(o)){const c=o.ariaHidden||o.hidden||o.style.display==="none",s=o.dataset.radixToastAnnounceExclude==="";if(!c)if(s){const d=o.dataset.radixToastAnnounceAlt;d&&t.push(d)}else t.push(...xU(o))}}),t}function H0(e,t,n,{discrete:o}){const c=n.originalEvent.currentTarget,s=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&c.addEventListener(e,t,{once:!0}),o?eD(c,s):c.dispatchEvent(s)}var EV=(e,t,n=0)=>{const o=Math.abs(e.x),c=Math.abs(e.y),s=o>c;return t==="left"||t==="right"?s&&o>n:!s&&c>n};function foe(e=()=>{}){const t=Ut(e);an(()=>{let n=0,o=0;return n=window.requestAnimationFrame(()=>o=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(o)}},[t])}function yoe(e){return e.nodeType===e.ELEMENT_NODE}function moe(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const c=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||c?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function o$(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var koe=lU,MU=uU,bU=pU,wU=fU,_U=yU,SU=kU,CU=aD;function LU(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var c=e.length;for(t=0;t<c;t++)e[t]&&(n=LU(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function NU(){for(var e,t,n=0,o="",c=arguments.length;n<c;n++)(e=arguments[n])&&(t=LU(e))&&(o&&(o+=" "),o+=t);return o}const TV=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,RV=NU,qd=(e,t)=>n=>{var o;if((t==null?void 0:t.variants)==null)return RV(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:c,defaultVariants:s}=t,d=Object.keys(c).map(f=>{const m=n==null?void 0:n[f],v=s==null?void 0:s[f];if(m===null)return null;const x=TV(m)||TV(v);return c[f][x]}),p=n&&Object.entries(n).reduce((f,m)=>{let[v,x]=m;return x===void 0||(f[v]=x),f},{}),y=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((f,m)=>{let{class:v,className:x,...b}=m;return Object.entries(b).every(w=>{let[_,L]=w;return Array.isArray(L)?L.includes({...s,...p}[_]):{...s,...p}[_]===L})?[...f,v,x]:f},[]);return RV(e,d,y,n==null?void 0:n.class,n==null?void 0:n.className)};/**
|
|
70
|
+
*/function sne(e){return g.createElement(wte,{flushSync:h1.flushSync,...e})}const mV=e=>{let t;const n=new Set,o=(f,m)=>{const v=typeof f=="function"?f(t):f;if(!Object.is(v,t)){const x=t;t=m??(typeof v!="object"||v===null)?v:Object.assign({},t,v),n.forEach(b=>b(t,x))}},c=()=>t,p={setState:o,getState:c,getInitialState:()=>y,subscribe:f=>(n.add(f),()=>n.delete(f))},y=t=e(o,c,p);return p},lne=e=>e?mV(e):mV,dne=e=>e;function une(e,t=dne){const n=bt.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return bt.useDebugValue(n),n}const kV=e=>{const t=lne(e),n=o=>une(t,o);return Object.assign(n,t),n},hne=e=>e?kV(e):kV;var DF=Symbol.for("immer-nothing"),gV=Symbol.for("immer-draftable"),ua=Symbol.for("immer-state");function Ha(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Sd=Object.getPrototypeOf;function Cd(e){return!!e&&!!e[ua]}function o1(e){var t;return e?qF(e)||Array.isArray(e)||!!e[gV]||!!((t=e.constructor)!=null&&t[gV])||GI(e)||ZI(e):!1}var pne=Object.prototype.constructor.toString();function qF(e){if(!e||typeof e!="object")return!1;const t=Sd(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===pne}function wI(e,t){UI(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,o)=>t(o,n,e))}function UI(e){const t=e[ua];return t?t.type_:Array.isArray(e)?1:GI(e)?2:ZI(e)?3:0}function U$(e,t){return UI(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function PF(e,t,n){const o=UI(e);o===2?e.set(t,n):o===3?e.add(n):e[t]=n}function fne(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function GI(e){return e instanceof Map}function ZI(e){return e instanceof Set}function vc(e){return e.copy_||e.base_}function G$(e,t){if(GI(e))return new Map(e);if(ZI(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=qF(e);if(t===!0||t==="class_only"&&!n){const o=Object.getOwnPropertyDescriptors(e);delete o[ua];let c=Reflect.ownKeys(o);for(let s=0;s<c.length;s++){const d=c[s],p=o[d];p.writable===!1&&(p.writable=!0,p.configurable=!0),(p.get||p.set)&&(o[d]={configurable:!0,writable:!0,enumerable:p.enumerable,value:e[d]})}return Object.create(Sd(e),o)}else{const o=Sd(e);if(o!==null&&n)return{...e};const c=Object.create(o);return Object.assign(c,e)}}function Zz(e,t=!1){return XI(e)||Cd(e)||!o1(e)||(UI(e)>1&&(e.set=e.add=e.clear=e.delete=yne),Object.freeze(e),t&&Object.entries(e).forEach(([n,o])=>Zz(o,!0))),e}function yne(){Ha(2)}function XI(e){return Object.isFrozen(e)}var mne={};function r1(e){const t=mne[e];return t||Ha(0,e),t}var X2;function OF(){return X2}function kne(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function vV(e,t){t&&(r1("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Z$(e){X$(e),e.drafts_.forEach(gne),e.drafts_=null}function X$(e){e===X2&&(X2=e.parent_)}function xV(e){return X2=kne(X2,e)}function gne(e){const t=e[ua];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function MV(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[ua].modified_&&(Z$(t),Ha(4)),o1(e)&&(e=_I(t,e),t.parent_||SI(t,e)),t.patches_&&r1("Patches").generateReplacementPatches_(n[ua].base_,e,t.patches_,t.inversePatches_)):e=_I(t,n,[]),Z$(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==DF?e:void 0}function _I(e,t,n){if(XI(t))return t;const o=t[ua];if(!o)return wI(t,(c,s)=>bV(e,o,t,c,s,n)),t;if(o.scope_!==e)return t;if(!o.modified_)return SI(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const c=o.copy_;let s=c,d=!1;o.type_===3&&(s=new Set(c),c.clear(),d=!0),wI(s,(p,y)=>bV(e,o,c,p,y,n,d)),SI(e,c,!1),n&&e.patches_&&r1("Patches").generatePatches_(o,n,e.patches_,e.inversePatches_)}return o.copy_}function bV(e,t,n,o,c,s,d){if(Cd(c)){const p=s&&t&&t.type_!==3&&!U$(t.assigned_,o)?s.concat(o):void 0,y=_I(e,c,p);if(PF(n,o,y),Cd(y))e.canAutoFreeze_=!1;else return}else d&&n.add(c);if(o1(c)&&!XI(c)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;_I(e,c),(!t||!t.scope_.parent_)&&typeof o!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,o)&&SI(e,c)}}function SI(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Zz(t,n)}function vne(e,t){const n=Array.isArray(e),o={type_:n?1:0,scope_:t?t.scope_:OF(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let c=o,s=Xz;n&&(c=[o],s=Y2);const{revoke:d,proxy:p}=Proxy.revocable(c,s);return o.draft_=p,o.revoke_=d,p}var Xz={get(e,t){if(t===ua)return e;const n=vc(e);if(!U$(n,t))return xne(e,n,t);const o=n[t];return e.finalized_||!o1(o)?o:o===WR(e.base_,t)?(QR(e),e.copy_[t]=K$(o,e)):o},has(e,t){return t in vc(e)},ownKeys(e){return Reflect.ownKeys(vc(e))},set(e,t,n){const o=HF(vc(e),t);if(o!=null&&o.set)return o.set.call(e.draft_,n),!0;if(!e.modified_){const c=WR(vc(e),t),s=c==null?void 0:c[ua];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(fne(n,c)&&(n!==void 0||U$(e.base_,t)))return!0;QR(e),Y$(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return WR(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,QR(e),Y$(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=vc(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:o.enumerable,value:n[t]}},defineProperty(){Ha(11)},getPrototypeOf(e){return Sd(e.base_)},setPrototypeOf(){Ha(12)}},Y2={};wI(Xz,(e,t)=>{Y2[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Y2.deleteProperty=function(e,t){return Y2.set.call(this,e,t,void 0)};Y2.set=function(e,t,n){return Xz.set.call(this,e[0],t,n,e[0])};function WR(e,t){const n=e[ua];return(n?vc(n):e)[t]}function xne(e,t,n){var c;const o=HF(t,n);return o?"value"in o?o.value:(c=o.get)==null?void 0:c.call(e.draft_):void 0}function HF(e,t){if(!(t in e))return;let n=Sd(e);for(;n;){const o=Object.getOwnPropertyDescriptor(n,t);if(o)return o;n=Sd(n)}}function Y$(e){e.modified_||(e.modified_=!0,e.parent_&&Y$(e.parent_))}function QR(e){e.copy_||(e.copy_=G$(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Mne=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,o)=>{if(typeof t=="function"&&typeof n!="function"){const s=n;n=t;const d=this;return function(y=s,...f){return d.produce(y,m=>n.call(this,m,...f))}}typeof n!="function"&&Ha(6),o!==void 0&&typeof o!="function"&&Ha(7);let c;if(o1(t)){const s=xV(this),d=K$(t,void 0);let p=!0;try{c=n(d),p=!1}finally{p?Z$(s):X$(s)}return vV(s,o),MV(c,s)}else if(!t||typeof t!="object"){if(c=n(t),c===void 0&&(c=t),c===DF&&(c=void 0),this.autoFreeze_&&Zz(c,!0),o){const s=[],d=[];r1("Patches").generateReplacementPatches_(t,c,s,d),o(s,d)}return c}else Ha(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(d,...p)=>this.produceWithPatches(d,y=>t(y,...p));let o,c;return[this.produce(t,n,(d,p)=>{o=d,c=p}),o,c]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){o1(e)||Ha(8),Cd(e)&&(e=bne(e));const t=xV(this),n=K$(e,void 0);return n[ua].isManual_=!0,X$(t),n}finishDraft(e,t){const n=e&&e[ua];(!n||!n.isManual_)&&Ha(9);const{scope_:o}=n;return vV(o,t),MV(void 0,o)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const c=t[n];if(c.path.length===0&&c.op==="replace"){e=c.value;break}}n>-1&&(t=t.slice(n+1));const o=r1("Patches").applyPatches_;return Cd(e)?o(e,t):this.produce(e,c=>o(c,t))}};function K$(e,t){const n=GI(e)?r1("MapSet").proxyMap_(e,t):ZI(e)?r1("MapSet").proxySet_(e,t):vne(e,t);return(t?t.scope_:OF()).drafts_.push(n),n}function bne(e){return Cd(e)||Ha(10,e),VF(e)}function VF(e){if(!o1(e)||XI(e))return e;const t=e[ua];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=G$(e,t.scope_.immer_.useStrictShallowCopy_)}else n=G$(e,!0);return wI(n,(o,c)=>{PF(n,o,VF(c))}),t&&(t.finalized_=!1),n}var ha=new Mne,wne=ha.produce;ha.produceWithPatches.bind(ha);ha.setAutoFreeze.bind(ha);ha.setUseStrictShallowCopy.bind(ha);ha.applyPatches.bind(ha);ha.createDraft.bind(ha);ha.finishDraft.bind(ha);const _ne=e=>(t,n,o)=>(o.setState=(c,s,...d)=>{const p=typeof c=="function"?wne(c):c;return t(p,s,...d)},e(o.setState,n,o)),Sne=_ne,ko=Object.create(null);ko.open="0";ko.close="1";ko.ping="2";ko.pong="3";ko.message="4";ko.upgrade="5";ko.noop="6";const op=Object.create(null);Object.keys(ko).forEach(e=>{op[ko[e]]=e});const W$={type:"error",data:"parser error"},BF=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",FF=typeof ArrayBuffer=="function",UF=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Yz=({type:e,data:t},n,o)=>BF&&t instanceof Blob?n?o(t):wV(t,o):FF&&(t instanceof ArrayBuffer||UF(t))?n?o(t):wV(new Blob([t]),o):o(ko[e]+(t||"")),wV=(e,t)=>{const n=new FileReader;return n.onload=function(){const o=n.result.split(",")[1];t("b"+(o||""))},n.readAsDataURL(e)};function _V(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let JR;function Cne(e,t){if(BF&&e.data instanceof Blob)return e.data.arrayBuffer().then(_V).then(t);if(FF&&(e.data instanceof ArrayBuffer||UF(e.data)))return t(_V(e.data));Yz(e,!1,n=>{JR||(JR=new TextEncoder),t(JR.encode(n))})}const SV="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s2=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<SV.length;e++)s2[SV.charCodeAt(e)]=e;const Lne=e=>{let t=e.length*.75,n=e.length,o,c=0,s,d,p,y;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const f=new ArrayBuffer(t),m=new Uint8Array(f);for(o=0;o<n;o+=4)s=s2[e.charCodeAt(o)],d=s2[e.charCodeAt(o+1)],p=s2[e.charCodeAt(o+2)],y=s2[e.charCodeAt(o+3)],m[c++]=s<<2|d>>4,m[c++]=(d&15)<<4|p>>2,m[c++]=(p&3)<<6|y&63;return f},Nne=typeof ArrayBuffer=="function",Kz=(e,t)=>{if(typeof e!="string")return{type:"message",data:GF(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:jne(e.substring(1),t)}:op[n]?e.length>1?{type:op[n],data:e.substring(1)}:{type:op[n]}:W$},jne=(e,t)=>{if(Nne){const n=Lne(e);return GF(n,t)}else return{base64:!0,data:e}},GF=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},ZF="",Ane=(e,t)=>{const n=e.length,o=new Array(n);let c=0;e.forEach((s,d)=>{Yz(s,!1,p=>{o[d]=p,++c===n&&t(o.join(ZF))})})},Ine=(e,t)=>{const n=e.split(ZF),o=[];for(let c=0;c<n.length;c++){const s=Kz(n[c],t);if(o.push(s),s.type==="error")break}return o};function Ene(){return new TransformStream({transform(e,t){Cne(e,n=>{const o=n.length;let c;if(o<126)c=new Uint8Array(1),new DataView(c.buffer).setUint8(0,o);else if(o<65536){c=new Uint8Array(3);const s=new DataView(c.buffer);s.setUint8(0,126),s.setUint16(1,o)}else{c=new Uint8Array(9);const s=new DataView(c.buffer);s.setUint8(0,127),s.setBigUint64(1,BigInt(o))}e.data&&typeof e.data!="string"&&(c[0]|=128),t.enqueue(c),t.enqueue(n)})}})}let e$;function q0(e){return e.reduce((t,n)=>t+n.length,0)}function P0(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let o=0;for(let c=0;c<t;c++)n[c]=e[0][o++],o===e[0].length&&(e.shift(),o=0);return e.length&&o<e[0].length&&(e[0]=e[0].slice(o)),n}function Tne(e,t){e$||(e$=new TextDecoder);const n=[];let o=0,c=-1,s=!1;return new TransformStream({transform(d,p){for(n.push(d);;){if(o===0){if(q0(n)<1)break;const y=P0(n,1);s=(y[0]&128)===128,c=y[0]&127,c<126?o=3:c===126?o=1:o=2}else if(o===1){if(q0(n)<2)break;const y=P0(n,2);c=new DataView(y.buffer,y.byteOffset,y.length).getUint16(0),o=3}else if(o===2){if(q0(n)<8)break;const y=P0(n,8),f=new DataView(y.buffer,y.byteOffset,y.length),m=f.getUint32(0);if(m>Math.pow(2,21)-1){p.enqueue(W$);break}c=m*Math.pow(2,32)+f.getUint32(4),o=3}else{if(q0(n)<c)break;const y=P0(n,c);p.enqueue(Kz(s?y:e$.decode(y),t)),o=0}if(c===0||c>e){p.enqueue(W$);break}}}})}const XF=4;function Wt(e){if(e)return Rne(e)}function Rne(e){for(var t in Wt.prototype)e[t]=Wt.prototype[t];return e}Wt.prototype.on=Wt.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};Wt.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};Wt.prototype.off=Wt.prototype.removeListener=Wt.prototype.removeAllListeners=Wt.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var o,c=0;c<n.length;c++)if(o=n[c],o===t||o.fn===t){n.splice(c,1);break}return n.length===0&&delete this._callbacks["$"+e],this};Wt.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],o=1;o<arguments.length;o++)t[o-1]=arguments[o];if(n){n=n.slice(0);for(var o=0,c=n.length;o<c;++o)n[o].apply(this,t)}return this};Wt.prototype.emitReserved=Wt.prototype.emit;Wt.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};Wt.prototype.hasListeners=function(e){return!!this.listeners(e).length};const YI=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),Ca=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),$ne="arraybuffer";function YF(e,...t){return t.reduce((n,o)=>(e.hasOwnProperty(o)&&(n[o]=e[o]),n),{})}const zne=Ca.setTimeout,Dne=Ca.clearTimeout;function KI(e,t){t.useNativeTimers?(e.setTimeoutFn=zne.bind(Ca),e.clearTimeoutFn=Dne.bind(Ca)):(e.setTimeoutFn=Ca.setTimeout.bind(Ca),e.clearTimeoutFn=Ca.clearTimeout.bind(Ca))}const qne=1.33;function Pne(e){return typeof e=="string"?One(e):Math.ceil((e.byteLength||e.size)*qne)}function One(e){let t=0,n=0;for(let o=0,c=e.length;o<c;o++)t=e.charCodeAt(o),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(o++,n+=4);return n}function KF(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Hne(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function Vne(e){let t={},n=e.split("&");for(let o=0,c=n.length;o<c;o++){let s=n[o].split("=");t[decodeURIComponent(s[0])]=decodeURIComponent(s[1])}return t}class Bne extends Error{constructor(t,n,o){super(t),this.description=n,this.context=o,this.type="TransportError"}}class Wz extends Wt{constructor(t){super(),this.writable=!1,KI(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,o){return super.emitReserved("error",new Bne(t,n,o)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=Kz(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=Hne(t);return n.length?"?"+n:""}}class Fne extends Wz{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let o=0;this._polling&&(o++,this.once("pollComplete",function(){--o||n()})),this.writable||(o++,this.once("drain",function(){--o||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=o=>{if(this.readyState==="opening"&&o.type==="open"&&this.onOpen(),o.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(o)};Ine(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,Ane(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=KF()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let WF=!1;try{WF=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Une=WF;function Gne(){}class Zne extends Fne{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let o=location.port;o||(o=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||o!==t.port}}doWrite(t,n){const o=this.request({method:"POST",data:t});o.on("success",n),o.on("error",(c,s)=>{this.onError("xhr post error",c,s)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,o)=>{this.onError("xhr poll error",n,o)}),this.pollXhr=t}}let fd=class rp extends Wt{constructor(t,n,o){super(),this.createRequest=t,KI(this,o),this._opts=o,this._method=o.method||"GET",this._uri=n,this._data=o.data!==void 0?o.data:null,this._create()}_create(){var t;const n=YF(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const o=this._xhr=this.createRequest(n);try{o.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){o.setDisableHeaderCheck&&o.setDisableHeaderCheck(!0);for(let c in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(c)&&o.setRequestHeader(c,this._opts.extraHeaders[c])}}catch{}if(this._method==="POST")try{o.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{o.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(o),"withCredentials"in o&&(o.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(o.timeout=this._opts.requestTimeout),o.onreadystatechange=()=>{var c;o.readyState===3&&((c=this._opts.cookieJar)===null||c===void 0||c.parseCookies(o.getResponseHeader("set-cookie"))),o.readyState===4&&(o.status===200||o.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof o.status=="number"?o.status:0)},0))},o.send(this._data)}catch(c){this.setTimeoutFn(()=>{this._onError(c)},0);return}typeof document<"u"&&(this._index=rp.requestsCount++,rp.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=Gne,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete rp.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};fd.requestsCount=0;fd.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",CV);else if(typeof addEventListener=="function"){const e="onpagehide"in Ca?"pagehide":"unload";addEventListener(e,CV,!1)}}function CV(){for(let e in fd.requests)fd.requests.hasOwnProperty(e)&&fd.requests[e].abort()}const Xne=function(){const e=QF({xdomain:!1});return e&&e.responseType!==null}();class Yne extends Zne{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=Xne&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new fd(QF,this.uri(),t)}}function QF(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||Une))return new XMLHttpRequest}catch{}if(!t)try{return new Ca[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const JF=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Kne extends Wz{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,o=JF?{}:YF(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(o.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,o)}catch(c){return this.emitReserved("error",c)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const o=t[n],c=n===t.length-1;Yz(o,this.supportsBinary,s=>{try{this.doWrite(o,s)}catch{}c&&YI(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=KF()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const t$=Ca.WebSocket||Ca.MozWebSocket;class Wne extends Kne{createSocket(t,n,o){return JF?new t$(t,n,o):n?new t$(t,n):new t$(t)}doWrite(t,n){this.ws.send(n)}}class Qne extends Wz{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=Tne(Number.MAX_SAFE_INTEGER,this.socket.binaryType),o=t.readable.pipeThrough(n).getReader(),c=Ene();c.readable.pipeTo(t.writable),this._writer=c.writable.getWriter();const s=()=>{o.read().then(({done:p,value:y})=>{p||(this.onPacket(y),s())}).catch(p=>{})};s();const d={type:"open"};this.query.sid&&(d.data=`{"sid":"${this.query.sid}"}`),this._writer.write(d).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const o=t[n],c=n===t.length-1;this._writer.write(o).then(()=>{c&&YI(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const Jne={websocket:Wne,webtransport:Qne,polling:Yne},eae=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,tae=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Q$(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),o=e.indexOf("]");n!=-1&&o!=-1&&(e=e.substring(0,n)+e.substring(n,o).replace(/:/g,";")+e.substring(o,e.length));let c=eae.exec(e||""),s={},d=14;for(;d--;)s[tae[d]]=c[d]||"";return n!=-1&&o!=-1&&(s.source=t,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s.pathNames=nae(s,s.path),s.queryKey=aae(s,s.query),s}function nae(e,t){const n=/\/{2,9}/g,o=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&o.splice(0,1),t.slice(-1)=="/"&&o.splice(o.length-1,1),o}function aae(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(o,c,s){c&&(n[c]=s)}),n}const J$=typeof addEventListener=="function"&&typeof removeEventListener=="function",cp=[];J$&&addEventListener("offline",()=>{cp.forEach(e=>e())},!1);class jr extends Wt{constructor(t,n){if(super(),this.binaryType=$ne,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const o=Q$(t);n.hostname=o.host,n.secure=o.protocol==="https"||o.protocol==="wss",n.port=o.port,o.query&&(n.query=o.query)}else n.host&&(n.hostname=Q$(n.host).host);KI(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(o=>{const c=o.prototype.name;this.transports.push(c),this._transportsByName[c]=o}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Vne(this.opts.query)),J$&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},cp.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=XF,n.transport=t,this.id&&(n.sid=this.id);const o=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](o)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&jr.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.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))}onOpen(){this.readyState="open",jr.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),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 t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let o=0;o<this.writeBuffer.length;o++){const c=this.writeBuffer[o].data;if(c&&(n+=Pne(c)),o>0&&n>this._maxPayload)return this.writeBuffer.slice(0,o);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,YI(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,o){return this._sendPacket("message",t,n,o),this}send(t,n,o){return this._sendPacket("message",t,n,o),this}_sendPacket(t,n,o,c){if(typeof n=="function"&&(c=n,n=void 0),typeof o=="function"&&(c=o,o=null),this.readyState==="closing"||this.readyState==="closed")return;o=o||{},o.compress=o.compress!==!1;const s={type:t,data:n,options:o};this.emitReserved("packetCreate",s),this.writeBuffer.push(s),c&&this.once("flush",c),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},o=()=>{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?o():t()}):this.upgrading?o():t()),this}_onError(t){if(jr.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),J$&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const o=cp.indexOf(this._offlineEventListener);o!==-1&&cp.splice(o,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}jr.protocol=XF;class oae extends jr{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),o=!1;jr.priorWebsocketSuccess=!1;const c=()=>{o||(n.send([{type:"ping",data:"probe"}]),n.once("packet",v=>{if(!o)if(v.type==="pong"&&v.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;jr.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{o||this.readyState!=="closed"&&(m(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const x=new Error("probe error");x.transport=n.name,this.emitReserved("upgradeError",x)}}))};function s(){o||(o=!0,m(),n.close(),n=null)}const d=v=>{const x=new Error("probe error: "+v);x.transport=n.name,s(),this.emitReserved("upgradeError",x)};function p(){d("transport closed")}function y(){d("socket closed")}function f(v){n&&v.name!==n.name&&s()}const m=()=>{n.removeListener("open",c),n.removeListener("error",d),n.removeListener("close",p),this.off("close",y),this.off("upgrading",f)};n.once("open",c),n.once("error",d),n.once("close",p),this.once("close",y),this.once("upgrading",f),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{o||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let o=0;o<t.length;o++)~this.transports.indexOf(t[o])&&n.push(t[o]);return n}}let rae=class extends oae{constructor(t,n={}){const o=typeof t=="object"?t:n;(!o.transports||o.transports&&typeof o.transports[0]=="string")&&(o.transports=(o.transports||["polling","websocket","webtransport"]).map(c=>Jne[c]).filter(c=>!!c)),super(t,o)}};function cae(e,t="",n){let o=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),o=Q$(e)),o.port||(/^(http|ws)$/.test(o.protocol)?o.port="80":/^(http|ws)s$/.test(o.protocol)&&(o.port="443")),o.path=o.path||"/";const s=o.host.indexOf(":")!==-1?"["+o.host+"]":o.host;return o.id=o.protocol+"://"+s+":"+o.port+t,o.href=o.protocol+"://"+s+(n&&n.port===o.port?"":":"+o.port),o}const iae=typeof ArrayBuffer=="function",sae=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,eU=Object.prototype.toString,lae=typeof Blob=="function"||typeof Blob<"u"&&eU.call(Blob)==="[object BlobConstructor]",dae=typeof File=="function"||typeof File<"u"&&eU.call(File)==="[object FileConstructor]";function Qz(e){return iae&&(e instanceof ArrayBuffer||sae(e))||lae&&e instanceof Blob||dae&&e instanceof File}function ip(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,o=e.length;n<o;n++)if(ip(e[n]))return!0;return!1}if(Qz(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return ip(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&ip(e[n]))return!0;return!1}function uae(e){const t=[],n=e.data,o=e;return o.data=ez(n,t),o.attachments=t.length,{packet:o,buffers:t}}function ez(e,t){if(!e)return e;if(Qz(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){const n=new Array(e.length);for(let o=0;o<e.length;o++)n[o]=ez(e[o],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=ez(e[o],t));return n}return e}function hae(e,t){return e.data=tz(e.data,t),delete e.attachments,e}function tz(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=tz(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=tz(e[n],t));return e}const pae=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],fae=5;var dt;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(dt||(dt={}));class yae{constructor(t){this.replacer=t}encode(t){return(t.type===dt.EVENT||t.type===dt.ACK)&&ip(t)?this.encodeAsBinary({type:t.type===dt.EVENT?dt.BINARY_EVENT:dt.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===dt.BINARY_EVENT||t.type===dt.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=uae(t),o=this.encodeAsString(n.packet),c=n.buffers;return c.unshift(o),c}}function LV(e){return Object.prototype.toString.call(e)==="[object Object]"}class Jz extends Wt{constructor(t){super(),this.reviver=t}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const o=n.type===dt.BINARY_EVENT;o||n.type===dt.BINARY_ACK?(n.type=o?dt.EVENT:dt.ACK,this.reconstructor=new mae(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(Qz(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),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: "+t)}decodeString(t){let n=0;const o={type:Number(t.charAt(0))};if(dt[o.type]===void 0)throw new Error("unknown packet type "+o.type);if(o.type===dt.BINARY_EVENT||o.type===dt.BINARY_ACK){const s=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const d=t.substring(s,n);if(d!=Number(d)||t.charAt(n)!=="-")throw new Error("Illegal attachments");o.attachments=Number(d)}if(t.charAt(n+1)==="/"){const s=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););o.nsp=t.substring(s,n)}else o.nsp="/";const c=t.charAt(n+1);if(c!==""&&Number(c)==c){const s=n+1;for(;++n;){const d=t.charAt(n);if(d==null||Number(d)!=d){--n;break}if(n===t.length)break}o.id=Number(t.substring(s,n+1))}if(t.charAt(++n)){const s=this.tryParse(t.substr(n));if(Jz.isPayloadValid(o.type,s))o.data=s;else throw new Error("invalid payload")}return o}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case dt.CONNECT:return LV(n);case dt.DISCONNECT:return n===void 0;case dt.CONNECT_ERROR:return typeof n=="string"||LV(n);case dt.EVENT:case dt.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&pae.indexOf(n[0])===-1);case dt.ACK:case dt.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class mae{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=hae(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const kae=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Jz,Encoder:yae,get PacketType(){return dt},protocol:fae},Symbol.toStringTag,{value:"Module"}));function Oa(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const gae=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class tU extends Wt{constructor(t,n,o){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,o&&o.auth&&(this.auth=o.auth),this._opts=Object.assign({},o),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Oa(t,"open",this.onopen.bind(this)),Oa(t,"packet",this.onpacket.bind(this)),Oa(t,"error",this.onerror.bind(this)),Oa(t,"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(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var o,c,s;if(gae.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const d={type:dt.EVENT,data:n};if(d.options={},d.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const m=this.ids++,v=n.pop();this._registerAckCallback(m,v),d.id=m}const p=(c=(o=this.io.engine)===null||o===void 0?void 0:o.transport)===null||c===void 0?void 0:c.writable,y=this.connected&&!(!((s=this.io.engine)===null||s===void 0)&&s._hasPingExpired());return this.flags.volatile&&!p||(y?(this.notifyOutgoingListeners(d),this.packet(d)):this.sendBuffer.push(d)),this.flags={},this}_registerAckCallback(t,n){var o;const c=(o=this.flags.timeout)!==null&&o!==void 0?o:this._opts.ackTimeout;if(c===void 0){this.acks[t]=n;return}const s=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let p=0;p<this.sendBuffer.length;p++)this.sendBuffer[p].id===t&&this.sendBuffer.splice(p,1);n.call(this,new Error("operation has timed out"))},c),d=(...p)=>{this.io.clearTimeoutFn(s),n.apply(this,p)};d.withError=!0,this.acks[t]=d}emitWithAck(t,...n){return new Promise((o,c)=>{const s=(d,p)=>d?c(d):o(p);s.withError=!0,n.push(s),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const o={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((c,...s)=>o!==this._queue[0]?void 0:(c!==null?o.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(c)):(this._queue.shift(),n&&n(null,...s)),o.pending=!1,this._drainQueue())),this._queue.push(o),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:dt.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(o=>String(o.id)===t)){const o=this.acks[t];delete this.acks[t],o.withError&&o.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case dt.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):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 dt.EVENT:case dt.BINARY_EVENT:this.onevent(t);break;case dt.ACK:case dt.BINARY_ACK:this.onack(t);break;case dt.DISCONNECT:this.ondisconnect();break;case dt.CONNECT_ERROR:this.destroy();const o=new Error(t.data.message);o.data=t.data.data,this.emitReserved("connect_error",o);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const o of n)o.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let o=!1;return function(...c){o||(o=!0,n.packet({type:dt.ACK,id:t,data:c}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:dt.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let o=0;o<n.length;o++)if(t===n[o])return n.splice(o,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const n=this._anyOutgoingListeners;for(let o=0;o<n.length;o++)if(t===n[o])return n.splice(o,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const o of n)o.apply(this,t.data)}}}function Dd(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Dd.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=(Math.floor(t*10)&1)==0?e-n:e+n}return Math.min(e,this.max)|0};Dd.prototype.reset=function(){this.attempts=0};Dd.prototype.setMin=function(e){this.ms=e};Dd.prototype.setMax=function(e){this.max=e};Dd.prototype.setJitter=function(e){this.jitter=e};class nz extends Wt{constructor(t,n){var o;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,KI(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((o=n.randomizationFactor)!==null&&o!==void 0?o:.5),this.backoff=new Dd({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const c=n.parser||kae;this.encoder=new c.Encoder,this.decoder=new c.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new rae(this.uri,this.opts);const n=this.engine,o=this;this._readyState="opening",this.skipReconnect=!1;const c=Oa(n,"open",function(){o.onopen(),t&&t()}),s=p=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",p),t?t(p):this.maybeReconnectOnOpen()},d=Oa(n,"error",s);if(this._timeout!==!1){const p=this._timeout,y=this.setTimeoutFn(()=>{c(),s(new Error("timeout")),n.close()},p);this.opts.autoUnref&&y.unref(),this.subs.push(()=>{this.clearTimeoutFn(y)})}return this.subs.push(c),this.subs.push(d),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Oa(t,"ping",this.onping.bind(this)),Oa(t,"data",this.ondata.bind(this)),Oa(t,"error",this.onerror.bind(this)),Oa(t,"close",this.onclose.bind(this)),Oa(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){YI(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let o=this.nsps[t];return o?this._autoConnect&&!o.active&&o.connect():(o=new tU(this,t,n),this.nsps[t]=o),o}_destroy(t){const n=Object.keys(this.nsps);for(const o of n)if(this.nsps[o].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let o=0;o<n.length;o++)this.engine.write(n[o],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var o;this.cleanup(),(o=this.engine)===null||o===void 0||o.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=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 o=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(c=>{c?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",c)):t.onreconnect()}))},n);this.opts.autoUnref&&o.unref(),this.subs.push(()=>{this.clearTimeoutFn(o)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Ju={};function sp(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=cae(e,t.path||"/socket.io"),o=n.source,c=n.id,s=n.path,d=Ju[c]&&s in Ju[c].nsps,p=t.forceNew||t["force new connection"]||t.multiplex===!1||d;let y;return p?y=new nz(o,t):(Ju[c]||(Ju[c]=new nz(o,t)),y=Ju[c]),n.query&&!t.query&&(t.query=n.queryKey),y.socket(n.path,t)}Object.assign(sp,{Manager:nz,Socket:tU,io:sp,connect:sp});const vae=1,xae=1e6;let n$=0;function Mae(){return n$=(n$+1)%Number.MAX_SAFE_INTEGER,n$.toString()}const a$=new Map,NV=e=>{if(a$.has(e))return;const t=setTimeout(()=>{a$.delete(e),h2({type:"REMOVE_TOAST",toastId:e})},xae);a$.set(e,t)},bae=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,vae)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?NV(n):e.toasts.forEach(o=>{NV(o.id)}),{...e,toasts:e.toasts.map(o=>o.id===n||n===void 0?{...o,open:!1}:o)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},lp=[];let dp={toasts:[]};function h2(e){dp=bae(dp,e),lp.forEach(t=>{t(dp)})}function Ar({...e}){const t=Mae(),n=c=>h2({type:"UPDATE_TOAST",toast:{...c,id:t}}),o=()=>h2({type:"DISMISS_TOAST",toastId:t});return h2({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:c=>{c||o()}}}),{id:t,dismiss:o,update:n}}function Zt(){const[e,t]=g.useState(dp);return g.useEffect(()=>(lp.push(t),()=>{const n=lp.indexOf(t);n>-1&&lp.splice(n,1)}),[e]),{...e,toast:Ar,dismiss:n=>h2({type:"DISMISS_TOAST",toastId:n})}}const qe=async(e,t={},n)=>{const o=Ee.getState().token,c={"Content-Type":"application/json",...t.headers};o&&(c.Authorization=`Bearer ${o}`);try{const s=await fetch(e,{...t,headers:c});if(s.status===204||s.headers.get("content-length")==="0")return n&&Ar({title:"Успех!",description:n}),!0;const d=await s.json();if(!s.ok)throw s.status===401&&Ee.getState().logout(),new Error(d.error||"Произошла неизвестная ошибка на сервере");return n&&Ar({title:"Успех!",description:n}),d}catch(s){throw s.message!=="Невалидный токен"&&s.message!=="Нет токена, доступ запрещен"&&Ar({variant:"destructive",title:"Ошибка",description:s.message}),s}},wae=(e,t)=>({socket:null,bots:[],servers:[],botStatuses:{},botLogs:{},resourceUsage:{},appVersion:"",connectSocket:()=>{t().socket&&t().socket.disconnect();const n=t().token;if(!n){console.log("[Socket] Подключение отложено: нет токена.");return}const o=window.location.origin;console.log(`[Socket] Попытка подключения к: ${o}`);const c=sp(o,{auth:{token:n},transports:["websocket"]});c.on("connect",()=>console.log("Socket.IO подключен:",c.id)),c.on("disconnect",s=>console.log("Socket.IO отключен:",s)),c.on("connect_error",s=>{console.error(`[Socket] Ошибка подключения: ${s.message}`)}),c.on("bot:status",({botId:s,status:d,message:p})=>{e(y=>{y.botStatuses[s]=d}),p&&t().appendLog(s,`[SYSTEM] ${p}`)}),c.on("bot:log",({botId:s,log:d})=>t().appendLog(s,d)),c.on("bots:usage",s=>{const d=s.reduce((p,y)=>({...p,[y.botId]:y}),{});e({resourceUsage:d})}),e({socket:c})},fetchInitialData:async()=>{try{const[n,o,c,s]=await Promise.all([qe("/api/bots"),qe("/api/servers"),qe("/api/bots/state"),qe("/api/version")]);e(d=>{d.bots=n||[],d.servers=o||[],d.botStatuses=c.statuses||{},d.botLogs=c.logs||{},d.appVersion=s.version||""})}catch(n){console.error("Не удалось загрузить начальные данные:",n.message),e(o=>{o.bots=[],o.servers=[]})}},appendLog:(n,o)=>{e(c=>{const s=c.botLogs[n]||[];c.botLogs[n]=[...s,o].slice(-200)})}}),_ae=(e,t)=>({createBot:async n=>{const o=await qe("/api/bots",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},"Новый бот успешно создан.");return o&&await t().fetchInitialData(),o},startBot:async n=>{await qe(`/api/bots/${n}/start`,{method:"POST"})},stopBot:async n=>{await qe(`/api/bots/${n}/stop`,{method:"POST"})},deleteBot:async n=>{await qe(`/api/bots/${n}`,{method:"DELETE"},"Бот успешно удален."),await t().fetchInitialData()},startAllBots:async()=>{await qe("/api/bots/start-all",{method:"POST"},"Команда на запуск всех ботов отправлена.")},stopAllBots:async()=>{await qe("/api/bots/stop-all",{method:"POST"},"Команда на остановку всех ботов отправлена.")}}),Sae=(e,t)=>({installedPlugins:{},pluginUpdates:{},pluginCatalog:[],isCatalogLoading:!0,optimisticallyIncrementDownloadCount:n=>{e(o=>{const c=o.pluginCatalog.find(s=>s.name===n);c&&(c.downloads=(c.downloads||0)+1)})},fetchPluginCatalog:async()=>{if(t().pluginCatalog.length>0){e({isCatalogLoading:!1});return}e({isCatalogLoading:!0});try{const n=await qe("/api/plugins/catalog");let o=new Map;try{const s=await fetch("http://185.65.200.184:3000/api/stats");if(s.ok){const d=await s.json();o=new Map(((d==null?void 0:d.plugins)||[]).map(p=>[p.pluginName,p.downloadCount]))}}catch(s){console.warn("Не удалось загрузить статистику скачиваний плагинов:",s.message)}const c=(n||[]).map(s=>({...s,downloads:o.get(s.name)||0}));e({pluginCatalog:c,isCatalogLoading:!1})}catch(n){console.error("Не удалось загрузить каталог плагинов:",n.message),e({pluginCatalog:[],isCatalogLoading:!1})}},fetchInstalledPlugins:async n=>{try{const c=(await qe(`/api/bots/${n}/plugins`)).map(s=>{let d;try{d=s.manifest?JSON.parse(s.manifest):{}}catch{console.error(`Ошибка парсинга манифеста для плагина ${s.name}`),d={}}const p=t().pluginCatalog.find(y=>y.name===s.name);return{...s,manifest:d,author:(p==null?void 0:p.author)||d.author||"Неизвестный автор",description:s.description||d.description||"Нет описания"}});e(s=>{s.installedPlugins[n]=c})}catch(o){console.error("Не удалось загрузить плагины для бота",n,o),e(c=>{c.installedPlugins[n]=[]})}},togglePlugin:async(n,o,c)=>{await qe(`/api/bots/${n}/plugins/${o}`,{method:"PUT",body:JSON.stringify({isEnabled:c})},"Статус плагина обновлен."),await t().fetchInstalledPlugins(n)},deletePlugin:async(n,o,c)=>{await qe(`/api/bots/${n}/plugins/${o}`,{method:"DELETE"},`Плагин "${c}" удален.`),await t().fetchInstalledPlugins(n)},installPluginFromRepo:async(n,o,c)=>{c&&t().optimisticallyIncrementDownloadCount(c);try{const s=await qe(`/api/bots/${n}/plugins/install/github`,{method:"POST",body:JSON.stringify({repoUrl:o})});return Ar({title:"Успех!",description:`Плагин "${s.name}" успешно установлен.`}),await t().fetchInstalledPlugins(n),s}catch(s){throw await t().fetchPluginCatalog(),s}},installPluginFromPath:async(n,o)=>{try{const c=await qe(`/api/bots/${n}/plugins/register/local`,{method:"POST",body:JSON.stringify({path:o})});return Ar({title:"Успех!",description:`Плагин "${c.name}" успешно установлен.`}),c}catch(c){throw c}finally{await t().fetchInstalledPlugins(n),await t().fetchPluginCatalog()}},checkForUpdates:async n=>{try{const o=await qe(`/api/plugins/check-updates/${n}`,{method:"POST"}),c=o.reduce((s,d)=>({...s,[d.sourceUri]:d}),{});e(s=>{s.pluginUpdates[n]=c}),Ar({title:"Проверка завершена",description:`Найдено обновлений: ${o.length}`})}catch(o){console.error("Ошибка проверки обновлений:",o)}},updatePlugin:async(n,o)=>{await qe(`/api/plugins/update/${n}`,{method:"POST"},"Плагин обновлен. Перезапустите бота."),await t().fetchInstalledPlugins(o),await t().checkForUpdates(o)}}),Cae=(e,t)=>({tasks:[],fetchTasks:async()=>{try{const n=await qe("/api/tasks");e({tasks:n||[]})}catch(n){console.error("Не удалось загрузить задачи:",n.message),e({tasks:[]})}},createTask:async n=>{const o=await qe("/api/tasks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},"Задача успешно создана.");return o&&e(c=>{c.tasks.unshift(o)}),o},updateTask:async(n,o)=>{const c=await qe(`/api/tasks/${n}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)},"Задача успешно обновлена.");return c&&e(s=>{const d=s.tasks.findIndex(p=>p.id===n);d!==-1&&(s.tasks[d]={...s.tasks[d],...c})}),c},deleteTask:async n=>{await qe(`/api/tasks/${n}`,{method:"DELETE"},"Задача успешно удалена."),e(o=>{o.tasks=o.tasks.filter(c=>c.id!==n)})}}),Lae=(e,t)=>({token:localStorage.getItem("authToken")||null,user:null,isAuthenticated:!1,needsSetup:!1,authInitialized:!1,hasPermission:n=>{var c;if(!n)return!0;const o=((c=t().user)==null?void 0:c.permissions)||[];return o.includes("*")||o.includes(n)},initializeAuth:async()=>{try{if((await qe("/api/auth/status")).needsSetup){e({needsSetup:!0,isAuthenticated:!1,token:null,user:null});return}if(e({needsSetup:!1}),t().token){const c=await qe("/api/auth/me");e({user:c,isAuthenticated:!0})}else e({isAuthenticated:!1,user:null,token:null})}catch(n){console.error("Auth initialization failed:",n.message),(n.message.includes("Невалидный токен")||n.message.includes("Нет токена"))&&localStorage.removeItem("authToken"),e({isAuthenticated:!1,token:null,user:null})}finally{e({authInitialized:!0})}},login:async(n,o)=>{const c=await qe("/api/auth/login",{method:"POST",body:JSON.stringify({username:n,password:o})});localStorage.setItem("authToken",c.token),t().connectSocket(),e({token:c.token,user:c.user,isAuthenticated:!0})},setupAdmin:async(n,o)=>{const c=await qe("/api/auth/setup",{method:"POST",body:JSON.stringify({username:n,password:o})});localStorage.setItem("authToken",c.token),t().connectSocket(),e({token:c.token,user:c.user,isAuthenticated:!0,needsSetup:!1})},logout:()=>{const n=t().socket;n&&n.disconnect(),localStorage.removeItem("authToken"),e({token:null,user:null,isAuthenticated:!1,socket:null})}}),Ee=hne(Sne((...e)=>({...wae(...e),..._ae(...e),...Sae(...e),...Cae(...e),...Lae(...e)})));function ke(e,t,{checkForDefaultPrevented:n=!0}={}){return function(c){if(e==null||e(c),n===!1||!c.defaultPrevented)return t==null?void 0:t(c)}}function jV(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Fo(...e){return t=>{let n=!1;const o=e.map(c=>{const s=jV(c,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let c=0;c<o.length;c++){const s=o[c];typeof s=="function"?s():jV(e[c],null)}}}}function Ye(...e){return g.useCallback(Fo(...e),e)}function Nae(e,t){const n=g.createContext(t),o=s=>{const{children:d,...p}=s,y=g.useMemo(()=>p,Object.values(p));return l.jsx(n.Provider,{value:y,children:d})};o.displayName=e+"Provider";function c(s){const d=g.useContext(n);if(d)return d;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[o,c]}function xn(e,t=[]){let n=[];function o(s,d){const p=g.createContext(d),y=n.length;n=[...n,d];const f=v=>{var S;const{scope:x,children:b,...w}=v,_=((S=x==null?void 0:x[e])==null?void 0:S[y])||p,L=g.useMemo(()=>w,Object.values(w));return l.jsx(_.Provider,{value:L,children:b})};f.displayName=s+"Provider";function m(v,x){var _;const b=((_=x==null?void 0:x[e])==null?void 0:_[y])||p,w=g.useContext(b);if(w)return w;if(d!==void 0)return d;throw new Error(`\`${v}\` must be used within \`${s}\``)}return[f,m]}const c=()=>{const s=n.map(d=>g.createContext(d));return function(p){const y=(p==null?void 0:p[e])||s;return g.useMemo(()=>({[`__scope${e}`]:{...p,[e]:y}}),[p,y])}};return c.scopeName=e,[o,jae(c,...t)]}function jae(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(c=>({useScope:c(),scopeName:c.scopeName}));return function(s){const d=o.reduce((p,{useScope:y,scopeName:f})=>{const v=y(s)[`__scope${f}`];return{...p,...v}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:d}),[d])}};return n.scopeName=t.scopeName,n}function Pr(e){const t=Iae(e),n=g.forwardRef((o,c)=>{const{children:s,...d}=o,p=g.Children.toArray(s),y=p.find(Eae);if(y){const f=y.props.children,m=p.map(v=>v===y?g.Children.count(f)>1?g.Children.only(null):g.isValidElement(f)?f.props.children:null:v);return l.jsx(t,{...d,ref:c,children:g.isValidElement(f)?g.cloneElement(f,void 0,m):null})}return l.jsx(t,{...d,ref:c,children:s})});return n.displayName=`${e}.Slot`,n}var Aae=Pr("Slot");function Iae(e){const t=g.forwardRef((n,o)=>{const{children:c,...s}=n;if(g.isValidElement(c)){const d=Rae(c),p=Tae(s,c.props);return c.type!==g.Fragment&&(p.ref=o?Fo(o,d):d),g.cloneElement(c,p)}return g.Children.count(c)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var nU=Symbol("radix.slottable");function aU(e){const t=({children:n})=>l.jsx(l.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=nU,t}function Eae(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===nU}function Tae(e,t){const n={...t};for(const o in t){const c=e[o],s=t[o];/^on[A-Z]/.test(o)?c&&s?n[o]=(...p)=>{const y=s(...p);return c(...p),y}:c&&(n[o]=c):o==="style"?n[o]={...c,...s}:o==="className"&&(n[o]=[c,s].filter(Boolean).join(" "))}return{...e,...n}}function Rae(e){var o,c;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(c=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:c.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function sh(e){const t=e+"CollectionProvider",[n,o]=xn(t),[c,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),d=_=>{const{scope:L,children:S}=_,A=bt.useRef(null),I=bt.useRef(new Map).current;return l.jsx(c,{scope:L,itemMap:I,collectionRef:A,children:S})};d.displayName=t;const p=e+"CollectionSlot",y=Pr(p),f=bt.forwardRef((_,L)=>{const{scope:S,children:A}=_,I=s(p,S),R=Ye(L,I.collectionRef);return l.jsx(y,{ref:R,children:A})});f.displayName=p;const m=e+"CollectionItemSlot",v="data-radix-collection-item",x=Pr(m),b=bt.forwardRef((_,L)=>{const{scope:S,children:A,...I}=_,R=bt.useRef(null),$=Ye(L,R),N=s(m,S);return bt.useEffect(()=>(N.itemMap.set(R,{ref:R,...I}),()=>void N.itemMap.delete(R))),l.jsx(x,{[v]:"",ref:$,children:A})});b.displayName=m;function w(_){const L=s(e+"CollectionConsumer",_);return bt.useCallback(()=>{const A=L.collectionRef.current;if(!A)return[];const I=Array.from(A.querySelectorAll(`[${v}]`));return Array.from(L.itemMap.values()).sort((N,O)=>I.indexOf(N.ref.current)-I.indexOf(O.ref.current))},[L.collectionRef,L.itemMap])}return[{Provider:d,Slot:f,ItemSlot:b},w,o]}var $ae=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],we=$ae.reduce((e,t)=>{const n=Pr(`Primitive.${t}`),o=g.forwardRef((c,s)=>{const{asChild:d,...p}=c,y=d?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(y,{...p,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function eD(e,t){e&&h1.flushSync(()=>e.dispatchEvent(t))}function Ut(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>(...n)=>{var o;return(o=t.current)==null?void 0:o.call(t,...n)},[])}function zae(e,t=globalThis==null?void 0:globalThis.document){const n=Ut(e);g.useEffect(()=>{const o=c=>{c.key==="Escape"&&n(c)};return t.addEventListener("keydown",o,{capture:!0}),()=>t.removeEventListener("keydown",o,{capture:!0})},[n,t])}var Dae="DismissableLayer",az="dismissableLayer.update",qae="dismissableLayer.pointerDownOutside",Pae="dismissableLayer.focusOutside",AV,oU=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),p1=g.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:c,onFocusOutside:s,onInteractOutside:d,onDismiss:p,...y}=e,f=g.useContext(oU),[m,v]=g.useState(null),x=(m==null?void 0:m.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=g.useState({}),w=Ye(t,O=>v(O)),_=Array.from(f.layers),[L]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),S=_.indexOf(L),A=m?_.indexOf(m):-1,I=f.layersWithOutsidePointerEventsDisabled.size>0,R=A>=S,$=Hae(O=>{const H=O.target,K=[...f.branches].some(J=>J.contains(H));!R||K||(c==null||c(O),d==null||d(O),O.defaultPrevented||p==null||p())},x),N=Vae(O=>{const H=O.target;[...f.branches].some(J=>J.contains(H))||(s==null||s(O),d==null||d(O),O.defaultPrevented||p==null||p())},x);return zae(O=>{A===f.layers.size-1&&(o==null||o(O),!O.defaultPrevented&&p&&(O.preventDefault(),p()))},x),g.useEffect(()=>{if(m)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(AV=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(m)),f.layers.add(m),IV(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=AV)}},[m,x,n,f]),g.useEffect(()=>()=>{m&&(f.layers.delete(m),f.layersWithOutsidePointerEventsDisabled.delete(m),IV())},[m,f]),g.useEffect(()=>{const O=()=>b({});return document.addEventListener(az,O),()=>document.removeEventListener(az,O)},[]),l.jsx(we.div,{...y,ref:w,style:{pointerEvents:I?R?"auto":"none":void 0,...e.style},onFocusCapture:ke(e.onFocusCapture,N.onFocusCapture),onBlurCapture:ke(e.onBlurCapture,N.onBlurCapture),onPointerDownCapture:ke(e.onPointerDownCapture,$.onPointerDownCapture)})});p1.displayName=Dae;var Oae="DismissableLayerBranch",rU=g.forwardRef((e,t)=>{const n=g.useContext(oU),o=g.useRef(null),c=Ye(t,o);return g.useEffect(()=>{const s=o.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),l.jsx(we.div,{...e,ref:c})});rU.displayName=Oae;function Hae(e,t=globalThis==null?void 0:globalThis.document){const n=Ut(e),o=g.useRef(!1),c=g.useRef(()=>{});return g.useEffect(()=>{const s=p=>{if(p.target&&!o.current){let y=function(){cU(qae,n,f,{discrete:!0})};const f={originalEvent:p};p.pointerType==="touch"?(t.removeEventListener("click",c.current),c.current=y,t.addEventListener("click",c.current,{once:!0})):y()}else t.removeEventListener("click",c.current);o.current=!1},d=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(d),t.removeEventListener("pointerdown",s),t.removeEventListener("click",c.current)}},[t,n]),{onPointerDownCapture:()=>o.current=!0}}function Vae(e,t=globalThis==null?void 0:globalThis.document){const n=Ut(e),o=g.useRef(!1);return g.useEffect(()=>{const c=s=>{s.target&&!o.current&&cU(Pae,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",c),()=>t.removeEventListener("focusin",c)},[t,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function IV(){const e=new CustomEvent(az);document.dispatchEvent(e)}function cU(e,t,n,{discrete:o}){const c=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&c.addEventListener(e,t,{once:!0}),o?eD(c,s):c.dispatchEvent(s)}var Bae=p1,Fae=rU,an=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},Uae="Portal",f1=g.forwardRef((e,t)=>{var p;const{container:n,...o}=e,[c,s]=g.useState(!1);an(()=>s(!0),[]);const d=n||c&&((p=globalThis==null?void 0:globalThis.document)==null?void 0:p.body);return d?ine.createPortal(l.jsx(we.div,{...o,ref:t}),d):null});f1.displayName=Uae;function Gae(e,t){return g.useReducer((n,o)=>t[n][o]??n,e)}var Jt=e=>{const{present:t,children:n}=e,o=Zae(t),c=typeof n=="function"?n({present:o.isPresent}):g.Children.only(n),s=Ye(o.ref,Xae(c));return typeof n=="function"||o.isPresent?g.cloneElement(c,{ref:s}):null};Jt.displayName="Presence";function Zae(e){const[t,n]=g.useState(),o=g.useRef(null),c=g.useRef(e),s=g.useRef("none"),d=e?"mounted":"unmounted",[p,y]=Gae(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const f=O0(o.current);s.current=p==="mounted"?f:"none"},[p]),an(()=>{const f=o.current,m=c.current;if(m!==e){const x=s.current,b=O0(f);e?y("MOUNT"):b==="none"||(f==null?void 0:f.display)==="none"?y("UNMOUNT"):y(m&&x!==b?"ANIMATION_OUT":"UNMOUNT"),c.current=e}},[e,y]),an(()=>{if(t){let f;const m=t.ownerDocument.defaultView??window,v=b=>{const _=O0(o.current).includes(b.animationName);if(b.target===t&&_&&(y("ANIMATION_END"),!c.current)){const L=t.style.animationFillMode;t.style.animationFillMode="forwards",f=m.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=L)})}},x=b=>{b.target===t&&(s.current=O0(o.current))};return t.addEventListener("animationstart",x),t.addEventListener("animationcancel",v),t.addEventListener("animationend",v),()=>{m.clearTimeout(f),t.removeEventListener("animationstart",x),t.removeEventListener("animationcancel",v),t.removeEventListener("animationend",v)}}else y("ANIMATION_END")},[t,y]),{isPresent:["mounted","unmountSuspended"].includes(p),ref:g.useCallback(f=>{o.current=f?getComputedStyle(f):null,n(f)},[])}}function O0(e){return(e==null?void 0:e.animationName)||"none"}function Xae(e){var o,c;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(c=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:c.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Yae=dF[" useInsertionEffect ".trim().toString()]||an;function Zn({prop:e,defaultProp:t,onChange:n=()=>{},caller:o}){const[c,s,d]=Kae({defaultProp:t,onChange:n}),p=e!==void 0,y=p?e:c;{const m=g.useRef(e!==void 0);g.useEffect(()=>{const v=m.current;v!==p&&console.warn(`${o} is changing from ${v?"controlled":"uncontrolled"} to ${p?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),m.current=p},[p,o])}const f=g.useCallback(m=>{var v;if(p){const x=Wae(m)?m(e):m;x!==e&&((v=d.current)==null||v.call(d,x))}else s(m)},[p,e,s,d]);return[y,f]}function Kae({defaultProp:e,onChange:t}){const[n,o]=g.useState(e),c=g.useRef(n),s=g.useRef(t);return Yae(()=>{s.current=t},[t]),g.useEffect(()=>{var d;c.current!==n&&((d=s.current)==null||d.call(s,n),c.current=n)},[n,c]),[n,o,s]}function Wae(e){return typeof e=="function"}var iU=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Qae="VisuallyHidden",WI=g.forwardRef((e,t)=>l.jsx(we.span,{...e,ref:t,style:{...iU,...e.style}}));WI.displayName=Qae;var Jae=WI,tD="ToastProvider",[nD,eoe,toe]=sh("Toast"),[sU,E3t]=xn("Toast",[toe]),[noe,QI]=sU(tD),lU=e=>{const{__scopeToast:t,label:n="Notification",duration:o=5e3,swipeDirection:c="right",swipeThreshold:s=50,children:d}=e,[p,y]=g.useState(null),[f,m]=g.useState(0),v=g.useRef(!1),x=g.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${tD}\`. Expected non-empty \`string\`.`),l.jsx(nD.Provider,{scope:t,children:l.jsx(noe,{scope:t,label:n,duration:o,swipeDirection:c,swipeThreshold:s,toastCount:f,viewport:p,onViewportChange:y,onToastAdd:g.useCallback(()=>m(b=>b+1),[]),onToastRemove:g.useCallback(()=>m(b=>b-1),[]),isFocusedToastEscapeKeyDownRef:v,isClosePausedRef:x,children:d})})};lU.displayName=tD;var dU="ToastViewport",aoe=["F8"],oz="toast.viewportPause",rz="toast.viewportResume",uU=g.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:o=aoe,label:c="Notifications ({hotkey})",...s}=e,d=QI(dU,n),p=eoe(n),y=g.useRef(null),f=g.useRef(null),m=g.useRef(null),v=g.useRef(null),x=Ye(t,v,d.onViewportChange),b=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),w=d.toastCount>0;g.useEffect(()=>{const L=S=>{var I;o.length!==0&&o.every(R=>S[R]||S.code===R)&&((I=v.current)==null||I.focus())};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[o]),g.useEffect(()=>{const L=y.current,S=v.current;if(w&&L&&S){const A=()=>{if(!d.isClosePausedRef.current){const N=new CustomEvent(oz);S.dispatchEvent(N),d.isClosePausedRef.current=!0}},I=()=>{if(d.isClosePausedRef.current){const N=new CustomEvent(rz);S.dispatchEvent(N),d.isClosePausedRef.current=!1}},R=N=>{!L.contains(N.relatedTarget)&&I()},$=()=>{L.contains(document.activeElement)||I()};return L.addEventListener("focusin",A),L.addEventListener("focusout",R),L.addEventListener("pointermove",A),L.addEventListener("pointerleave",$),window.addEventListener("blur",A),window.addEventListener("focus",I),()=>{L.removeEventListener("focusin",A),L.removeEventListener("focusout",R),L.removeEventListener("pointermove",A),L.removeEventListener("pointerleave",$),window.removeEventListener("blur",A),window.removeEventListener("focus",I)}}},[w,d.isClosePausedRef]);const _=g.useCallback(({tabbingDirection:L})=>{const A=p().map(I=>{const R=I.ref.current,$=[R,...moe(R)];return L==="forwards"?$:$.reverse()});return(L==="forwards"?A.reverse():A).flat()},[p]);return g.useEffect(()=>{const L=v.current;if(L){const S=A=>{var $,N,O;const I=A.altKey||A.ctrlKey||A.metaKey;if(A.key==="Tab"&&!I){const H=document.activeElement,K=A.shiftKey;if(A.target===L&&K){($=f.current)==null||$.focus();return}const q=_({tabbingDirection:K?"backwards":"forwards"}),P=q.findIndex(D=>D===H);o$(q.slice(P+1))?A.preventDefault():K?(N=f.current)==null||N.focus():(O=m.current)==null||O.focus()}};return L.addEventListener("keydown",S),()=>L.removeEventListener("keydown",S)}},[p,_]),l.jsxs(Fae,{ref:y,role:"region","aria-label":c.replace("{hotkey}",b),tabIndex:-1,style:{pointerEvents:w?void 0:"none"},children:[w&&l.jsx(cz,{ref:f,onFocusFromOutsideViewport:()=>{const L=_({tabbingDirection:"forwards"});o$(L)}}),l.jsx(nD.Slot,{scope:n,children:l.jsx(we.ol,{tabIndex:-1,...s,ref:x})}),w&&l.jsx(cz,{ref:m,onFocusFromOutsideViewport:()=>{const L=_({tabbingDirection:"backwards"});o$(L)}})]})});uU.displayName=dU;var hU="ToastFocusProxy",cz=g.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:o,...c}=e,s=QI(hU,n);return l.jsx(WI,{"aria-hidden":!0,tabIndex:0,...c,ref:t,style:{position:"fixed"},onFocus:d=>{var f;const p=d.relatedTarget;!((f=s.viewport)!=null&&f.contains(p))&&o()}})});cz.displayName=hU;var lh="Toast",ooe="toast.swipeStart",roe="toast.swipeMove",coe="toast.swipeCancel",ioe="toast.swipeEnd",pU=g.forwardRef((e,t)=>{const{forceMount:n,open:o,defaultOpen:c,onOpenChange:s,...d}=e,[p,y]=Zn({prop:o,defaultProp:c??!0,onChange:s,caller:lh});return l.jsx(Jt,{present:n||p,children:l.jsx(doe,{open:p,...d,ref:t,onClose:()=>y(!1),onPause:Ut(e.onPause),onResume:Ut(e.onResume),onSwipeStart:ke(e.onSwipeStart,f=>{f.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:ke(e.onSwipeMove,f=>{const{x:m,y:v}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","move"),f.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${m}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${v}px`)}),onSwipeCancel:ke(e.onSwipeCancel,f=>{f.currentTarget.setAttribute("data-swipe","cancel"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:ke(e.onSwipeEnd,f=>{const{x:m,y:v}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","end"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${m}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${v}px`),y(!1)})})})});pU.displayName=lh;var[soe,loe]=sU(lh,{onClose(){}}),doe=g.forwardRef((e,t)=>{const{__scopeToast:n,type:o="foreground",duration:c,open:s,onClose:d,onEscapeKeyDown:p,onPause:y,onResume:f,onSwipeStart:m,onSwipeMove:v,onSwipeCancel:x,onSwipeEnd:b,...w}=e,_=QI(lh,n),[L,S]=g.useState(null),A=Ye(t,D=>S(D)),I=g.useRef(null),R=g.useRef(null),$=c||_.duration,N=g.useRef(0),O=g.useRef($),H=g.useRef(0),{onToastAdd:K,onToastRemove:J}=_,ce=Ut(()=>{var F;(L==null?void 0:L.contains(document.activeElement))&&((F=_.viewport)==null||F.focus()),d()}),q=g.useCallback(D=>{!D||D===1/0||(window.clearTimeout(H.current),N.current=new Date().getTime(),H.current=window.setTimeout(ce,D))},[ce]);g.useEffect(()=>{const D=_.viewport;if(D){const F=()=>{q(O.current),f==null||f()},z=()=>{const X=new Date().getTime()-N.current;O.current=O.current-X,window.clearTimeout(H.current),y==null||y()};return D.addEventListener(oz,z),D.addEventListener(rz,F),()=>{D.removeEventListener(oz,z),D.removeEventListener(rz,F)}}},[_.viewport,$,y,f,q]),g.useEffect(()=>{s&&!_.isClosePausedRef.current&&q($)},[s,$,_.isClosePausedRef,q]),g.useEffect(()=>(K(),()=>J()),[K,J]);const P=g.useMemo(()=>L?xU(L):null,[L]);return _.viewport?l.jsxs(l.Fragment,{children:[P&&l.jsx(uoe,{__scopeToast:n,role:"status","aria-live":o==="foreground"?"assertive":"polite","aria-atomic":!0,children:P}),l.jsx(soe,{scope:n,onClose:ce,children:h1.createPortal(l.jsx(nD.ItemSlot,{scope:n,children:l.jsx(Bae,{asChild:!0,onEscapeKeyDown:ke(p,()=>{_.isFocusedToastEscapeKeyDownRef.current||ce(),_.isFocusedToastEscapeKeyDownRef.current=!1}),children:l.jsx(we.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":s?"open":"closed","data-swipe-direction":_.swipeDirection,...w,ref:A,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:ke(e.onKeyDown,D=>{D.key==="Escape"&&(p==null||p(D.nativeEvent),D.nativeEvent.defaultPrevented||(_.isFocusedToastEscapeKeyDownRef.current=!0,ce()))}),onPointerDown:ke(e.onPointerDown,D=>{D.button===0&&(I.current={x:D.clientX,y:D.clientY})}),onPointerMove:ke(e.onPointerMove,D=>{if(!I.current)return;const F=D.clientX-I.current.x,z=D.clientY-I.current.y,X=!!R.current,G=["left","right"].includes(_.swipeDirection),ae=["left","up"].includes(_.swipeDirection)?Math.min:Math.max,C=G?ae(0,F):0,Y=G?0:ae(0,z),B=D.pointerType==="touch"?10:2,E={x:C,y:Y},ie={originalEvent:D,delta:E};X?(R.current=E,H0(roe,v,ie,{discrete:!1})):EV(E,_.swipeDirection,B)?(R.current=E,H0(ooe,m,ie,{discrete:!1}),D.target.setPointerCapture(D.pointerId)):(Math.abs(F)>B||Math.abs(z)>B)&&(I.current=null)}),onPointerUp:ke(e.onPointerUp,D=>{const F=R.current,z=D.target;if(z.hasPointerCapture(D.pointerId)&&z.releasePointerCapture(D.pointerId),R.current=null,I.current=null,F){const X=D.currentTarget,G={originalEvent:D,delta:F};EV(F,_.swipeDirection,_.swipeThreshold)?H0(ioe,b,G,{discrete:!0}):H0(coe,x,G,{discrete:!0}),X.addEventListener("click",ae=>ae.preventDefault(),{once:!0})}})})})}),_.viewport)})]}):null}),uoe=e=>{const{__scopeToast:t,children:n,...o}=e,c=QI(lh,t),[s,d]=g.useState(!1),[p,y]=g.useState(!1);return foe(()=>d(!0)),g.useEffect(()=>{const f=window.setTimeout(()=>y(!0),1e3);return()=>window.clearTimeout(f)},[]),p?null:l.jsx(f1,{asChild:!0,children:l.jsx(WI,{...o,children:s&&l.jsxs(l.Fragment,{children:[c.label," ",n]})})})},hoe="ToastTitle",fU=g.forwardRef((e,t)=>{const{__scopeToast:n,...o}=e;return l.jsx(we.div,{...o,ref:t})});fU.displayName=hoe;var poe="ToastDescription",yU=g.forwardRef((e,t)=>{const{__scopeToast:n,...o}=e;return l.jsx(we.div,{...o,ref:t})});yU.displayName=poe;var mU="ToastAction",kU=g.forwardRef((e,t)=>{const{altText:n,...o}=e;return n.trim()?l.jsx(vU,{altText:n,asChild:!0,children:l.jsx(aD,{...o,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${mU}\`. Expected non-empty \`string\`.`),null)});kU.displayName=mU;var gU="ToastClose",aD=g.forwardRef((e,t)=>{const{__scopeToast:n,...o}=e,c=loe(gU,n);return l.jsx(vU,{asChild:!0,children:l.jsx(we.button,{type:"button",...o,ref:t,onClick:ke(e.onClick,c.onClose)})})});aD.displayName=gU;var vU=g.forwardRef((e,t)=>{const{__scopeToast:n,altText:o,...c}=e;return l.jsx(we.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":o||void 0,...c,ref:t})});function xU(e){const t=[];return Array.from(e.childNodes).forEach(o=>{if(o.nodeType===o.TEXT_NODE&&o.textContent&&t.push(o.textContent),yoe(o)){const c=o.ariaHidden||o.hidden||o.style.display==="none",s=o.dataset.radixToastAnnounceExclude==="";if(!c)if(s){const d=o.dataset.radixToastAnnounceAlt;d&&t.push(d)}else t.push(...xU(o))}}),t}function H0(e,t,n,{discrete:o}){const c=n.originalEvent.currentTarget,s=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&c.addEventListener(e,t,{once:!0}),o?eD(c,s):c.dispatchEvent(s)}var EV=(e,t,n=0)=>{const o=Math.abs(e.x),c=Math.abs(e.y),s=o>c;return t==="left"||t==="right"?s&&o>n:!s&&c>n};function foe(e=()=>{}){const t=Ut(e);an(()=>{let n=0,o=0;return n=window.requestAnimationFrame(()=>o=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(o)}},[t])}function yoe(e){return e.nodeType===e.ELEMENT_NODE}function moe(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const c=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||c?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function o$(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var koe=lU,MU=uU,bU=pU,wU=fU,_U=yU,SU=kU,CU=aD;function LU(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var c=e.length;for(t=0;t<c;t++)e[t]&&(n=LU(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function NU(){for(var e,t,n=0,o="",c=arguments.length;n<c;n++)(e=arguments[n])&&(t=LU(e))&&(o&&(o+=" "),o+=t);return o}const TV=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,RV=NU,qd=(e,t)=>n=>{var o;if((t==null?void 0:t.variants)==null)return RV(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:c,defaultVariants:s}=t,d=Object.keys(c).map(f=>{const m=n==null?void 0:n[f],v=s==null?void 0:s[f];if(m===null)return null;const x=TV(m)||TV(v);return c[f][x]}),p=n&&Object.entries(n).reduce((f,m)=>{let[v,x]=m;return x===void 0||(f[v]=x),f},{}),y=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((f,m)=>{let{class:v,className:x,...b}=m;return Object.entries(b).every(w=>{let[_,L]=w;return Array.isArray(L)?L.includes({...s,...p}[_]):{...s,...p}[_]===L})?[...f,v,x]:f},[]);return RV(e,d,y,n==null?void 0:n.class,n==null?void 0:n.className)};/**
|
|
71
71
|
* @license lucide-react v0.514.0 - ISC
|
|
72
72
|
*
|
|
73
73
|
* This source code is licensed under the ISC license.
|
package/frontend/dist/index.html
CHANGED
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
<meta name="msapplication-TileColor" content="#da532c">
|
|
43
43
|
<meta name="theme-color" content="#ffffff">
|
|
44
44
|
|
|
45
|
-
<script type="module" crossorigin src="/assets/index-
|
|
45
|
+
<script type="module" crossorigin src="/assets/index-eIaThNXb.js"></script>
|
|
46
46
|
<link rel="stylesheet" crossorigin href="/assets/index-BKT73TwN.css">
|
|
47
47
|
</head>
|
|
48
48
|
<body>
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
1
|
{
|
|
3
2
|
"name": "blockmine",
|
|
4
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.3",
|
|
5
4
|
"description": "Мощная панель управления ботами для Майнкрафта.",
|
|
6
5
|
"author": "merka",
|
|
7
6
|
"license": "MIT",
|
|
@@ -26,12 +25,27 @@
|
|
|
26
25
|
],
|
|
27
26
|
"scripts": {
|
|
28
27
|
"dev": "concurrently \"npm run dev --workspace=backend\" \"npm run dev --workspace=frontend\"",
|
|
29
|
-
"postinstall": "npm install --
|
|
28
|
+
"postinstall": "npm install --workspace=frontend --ignore-scripts && prisma generate --schema=./backend/prisma/schema.prisma",
|
|
30
29
|
"build": "npm run build --workspace=frontend",
|
|
31
|
-
"prepublishOnly": "npm run build
|
|
30
|
+
"prepublishOnly": "npm run build"
|
|
32
31
|
},
|
|
33
32
|
"dependencies": {
|
|
34
|
-
"prisma": "^5.14.0"
|
|
33
|
+
"@prisma/client": "^5.14.0",
|
|
34
|
+
"adm-zip": "^0.5.16",
|
|
35
|
+
"archiver": "^7.0.1",
|
|
36
|
+
"bcryptjs": "^2.4.3",
|
|
37
|
+
"cron-parser": "^5.3.0",
|
|
38
|
+
"express": "^4.19.2",
|
|
39
|
+
"fs-extra": "^11.3.0",
|
|
40
|
+
"jsonwebtoken": "^9.0.2",
|
|
41
|
+
"mineflayer": "^4.20.1",
|
|
42
|
+
"multer": "^2.0.1",
|
|
43
|
+
"node-cron": "^4.1.0",
|
|
44
|
+
"pidusage": "^3.0.2",
|
|
45
|
+
"prisma": "^5.14.0",
|
|
46
|
+
"semver": "^7.6.2",
|
|
47
|
+
"socket.io": "^4.7.5",
|
|
48
|
+
"socks": "^2.8.5"
|
|
35
49
|
},
|
|
36
50
|
"devDependencies": {
|
|
37
51
|
"concurrently": "^8.2.2"
|