frappe-react-sdk 1.7.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3650,6 +3650,8 @@ const Va = {
|
|
|
3650
3650
|
"anchor"
|
|
3651
3651
|
];
|
|
3652
3652
|
function Vn(n) {
|
|
3653
|
+
if (n.length > 2e3)
|
|
3654
|
+
throw "URI too long";
|
|
3653
3655
|
const e = n, t = n.indexOf("["), r = n.indexOf("]");
|
|
3654
3656
|
t != -1 && r != -1 && (n = n.substring(0, t) + n.substring(t, r).replace(/:/g, ";") + n.substring(r, n.length));
|
|
3655
3657
|
let s = qa.exec(n || ""), i = {}, o = 14;
|
|
@@ -4522,17 +4524,17 @@ class rc {
|
|
|
4522
4524
|
Ye(this, "url");
|
|
4523
4525
|
Ye(this, "site_name");
|
|
4524
4526
|
Ye(this, "socket");
|
|
4525
|
-
var i, o, c;
|
|
4526
|
-
if (this.socket_port = r != null ? r : "9000", this.host = (i = window.location) == null ? void 0 : i.hostname, this.port = (o = window.location) != null && o.port ? `:${this.socket_port}` : "", this.protocol =
|
|
4527
|
-
let
|
|
4528
|
-
|
|
4527
|
+
var i, o, c, l;
|
|
4528
|
+
if (this.socket_port = r != null ? r : "9000", this.host = (i = window.location) == null ? void 0 : i.hostname, this.port = (o = window.location) != null && o.port ? `:${this.socket_port}` : "", this.protocol = ((c = window.location) == null ? void 0 : c.protocol) === "https:" ? "https" : "http", e) {
|
|
4529
|
+
let a = new URL(e);
|
|
4530
|
+
a.port = "", r ? (a.port = r, this.url = a.toString()) : this.url = a.toString();
|
|
4529
4531
|
} else
|
|
4530
4532
|
this.url = `${this.protocol}://${this.host}${this.port}/`;
|
|
4531
4533
|
t && (this.url = `${this.url}${t}`), this.site_name = t, this.socket = Kt(`${this.url}`, {
|
|
4532
4534
|
withCredentials: !0,
|
|
4533
4535
|
secure: this.protocol === "https",
|
|
4534
4536
|
extraHeaders: s && s.useToken === !0 ? {
|
|
4535
|
-
Authorization: `${s.type} ${(
|
|
4537
|
+
Authorization: `${s.type} ${(l = s.token) == null ? void 0 : l.call(s)}`
|
|
4536
4538
|
} : {}
|
|
4537
4539
|
});
|
|
4538
4540
|
}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
*
|
|
20
20
|
* This source code is licensed under the MIT license found in the
|
|
21
21
|
* LICENSE file in the root directory of this source tree.
|
|
22
|
-
*/var jr;function vo(){return jr||(jr=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var n=Je.default,e=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function t(k){{for(var D=arguments.length,L=new Array(D>1?D-1:0),N=1;N<D;N++)L[N-1]=arguments[N];r("error",k,L)}}function r(k,D,L){{var N=e.ReactDebugCurrentFrame,ce=N.getStackAddendum();ce!==""&&(D+="%s",L=L.concat([ce]));var E=L.map(function(H){return String(H)});E.unshift("Warning: "+D),Function.prototype.apply.call(console[k],console,E)}}function s(k,D){return k===D&&(k!==0||1/k===1/D)||k!==k&&D!==D}var i=typeof Object.is=="function"?Object.is:s,o=n.useState,c=n.useEffect,l=n.useLayoutEffect,a=n.useDebugValue,d=!1,f=!1;function _(k,D,L){d||n.startTransition!==void 0&&(d=!0,t("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var N=D();if(!f){var ce=D();i(N,ce)||(t("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}var E=o({inst:{value:N,getSnapshot:D}}),H=E[0].inst,F=E[1];return l(function(){H.value=N,H.getSnapshot=D,v(H)&&F({inst:H})},[k,N,D]),c(function(){v(H)&&F({inst:H});var Z=function(){v(H)&&F({inst:H})};return k(Z)},[k]),a(N),N}function v(k){var D=k.getSnapshot,L=k.value;try{var N=D();return!i(L,N)}catch{return!0}}function g(k,D,L){return D()}var y=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",x=!y,m=x?g:_,A=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:m;Sn.useSyncExternalStore=A,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Sn}(function(n){process.env.NODE_ENV==="production"?n.exports=go():n.exports=vo()})(zt);const qe=()=>{},oe=qe(),St=Object,R=n=>n===oe,ge=n=>typeof n=="function",Le=(n,e)=>({...n,...e}),bo=n=>ge(n.then),Jt=new WeakMap;let _o=0;const Tt=n=>{const e=typeof n,t=n&&n.constructor,r=t==Date;let s,i;if(St(n)===n&&!r&&t!=RegExp){if(s=Jt.get(n),s)return s;if(s=++_o+"~",Jt.set(n,s),t==Array){for(s="@",i=0;i<n.length;i++)s+=Tt(n[i])+",";Jt.set(n,s)}if(t==St){s="#";const o=St.keys(n).sort();for(;!R(i=o.pop());)R(n[i])||(s+=i+":"+Tt(n[i])+",");Jt.set(n,s)}}else s=r?n.toJSON():e=="symbol"?n.toString():e=="string"?JSON.stringify(n):""+n;return s},Oe=new WeakMap,Tn={},Kt={},On="undefined",qt=typeof window!=On,Cn=typeof document!=On,wo=()=>qt&&typeof window.requestAnimationFrame!=On,Ve=(n,e)=>{const t=Oe.get(n);return[()=>!R(e)&&n.get(e)||Tn,r=>{if(!R(e)){const s=n.get(e);e in Kt||(Kt[e]=s),t[5](e,Le(s,r),s||Tn)}},t[6],()=>!R(e)&&e in Kt?Kt[e]:!R(e)&&n.get(e)||Tn]};let xn=!0;const Eo=()=>xn,[An,Dn]=qt&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[qe,qe],Ro=()=>{const n=Cn&&document.visibilityState;return R(n)||n!=="hidden"},So=n=>(Cn&&document.addEventListener("visibilitychange",n),An("focus",n),()=>{Cn&&document.removeEventListener("visibilitychange",n),Dn("focus",n)}),To=n=>{const e=()=>{xn=!0,n()},t=()=>{xn=!1};return An("online",e),An("offline",t),()=>{Dn("online",e),Dn("offline",t)}},Oo={isOnline:Eo,isVisible:Ro},Co={initFocus:So,initReconnect:To},Yt=!Je.default.useId,nt=!qt||"Deno"in window,Mr=n=>wo()?window.requestAnimationFrame(n):setTimeout(n,1),Ye=nt?h.useEffect:h.useLayoutEffect,kn=typeof navigator<"u"&&navigator.connection,Wr=!nt&&kn&&(["slow-2g","2g"].includes(kn.effectiveType)||kn.saveData),rt=n=>{if(ge(n))try{n=n()}catch{n=""}const e=n;return n=typeof n=="string"?n:(Array.isArray(n)?n.length:n)?Tt(n):"",[n,e]};let xo=0;const Gt=()=>++xo,Hr=0,zr=1,Jr=2;var Ne={__proto__:null,ERROR_REVALIDATE_EVENT:3,FOCUS_EVENT:Hr,MUTATE_EVENT:Jr,RECONNECT_EVENT:zr};async function Ln(...n){const[e,t,r,s]=n,i=Le({populateCache:!0,throwOnError:!0},typeof s=="boolean"?{revalidate:s}:s||{});let o=i.populateCache;const c=i.rollbackOnError;let l=i.optimisticData;const a=_=>typeof c=="function"?c(_):c!==!1,d=i.throwOnError;if(ge(t)){const _=t,v=[],g=e.keys();for(const y of g)!/^\$(inf|sub)\$/.test(y)&&_(e.get(y)._k)&&v.push(y);return Promise.all(v.map(f))}return f(t);async function f(_){const[v]=rt(_);if(!v)return;const[g,y]=Ve(e,v),[x,m,A,k]=Oe.get(e),D=()=>{const q=x[v];return(ge(i.revalidate)?i.revalidate(g().data,_):i.revalidate!==!1)&&(delete A[v],delete k[v],q&&q[0])?q[0](Jr).then(()=>g().data):g().data};if(n.length<3)return D();let L=r,N;const ce=Gt();m[v]=[ce,0];const E=!R(l),H=g(),F=H.data,Z=H._c,de=R(Z)?F:Z;if(E&&(l=ge(l)?l(de,F):l,y({data:l,_c:de})),ge(L))try{L=L(de)}catch(q){N=q}if(L&&bo(L))if(L=await L.catch(q=>{N=q}),ce!==m[v][0]){if(N)throw N;return L}else N&&E&&a(N)&&(o=!0,y({data:de,_c:oe}));if(o&&!N)if(ge(o)){const q=o(L,de);y({data:q,error:oe,_c:oe})}else y({data:L,error:oe,_c:oe});if(m[v][1]=Gt(),Promise.resolve(D()).then(()=>{y({_c:oe})}),N){if(d)throw N;return}return L}}const Kr=(n,e)=>{for(const t in n)n[t][0]&&n[t][0](e)},qr=(n,e)=>{if(!Oe.has(n)){const t=Le(Co,e),r={},s=Ln.bind(oe,n);let i=qe;const o={},c=(d,f)=>{const _=o[d]||[];return o[d]=_,_.push(f),()=>_.splice(_.indexOf(f),1)},l=(d,f,_)=>{n.set(d,f);const v=o[d];if(v)for(const g of v)g(f,_)},a=()=>{if(!Oe.has(n)&&(Oe.set(n,[r,{},{},{},s,l,c]),!nt)){const d=t.initFocus(setTimeout.bind(oe,Kr.bind(oe,r,Hr))),f=t.initReconnect(setTimeout.bind(oe,Kr.bind(oe,r,zr)));i=()=>{d&&d(),f&&f(),Oe.delete(n)}}};return a(),[n,s,a,i]}return[n,Oe.get(n)[4]]},Ao=(n,e,t,r,s)=>{const i=t.errorRetryCount,o=s.retryCount,c=~~((Math.random()+.5)*(1<<(o<8?o:8)))*t.errorRetryInterval;!R(i)&&o>i||setTimeout(r,c,s)},Do=(n,e)=>Tt(n)==Tt(e),[Xt,ko]=qr(new Map),Nn=Le({onLoadingSlow:qe,onSuccess:qe,onError:qe,onErrorRetry:Ao,onDiscarded:qe,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Wr?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Wr?5e3:3e3,compare:Do,isPaused:()=>!1,cache:Xt,mutate:ko,fallback:{}},Oo),Yr=(n,e)=>{const t=Le(n,e);if(e){const{use:r,fallback:s}=n,{use:i,fallback:o}=e;r&&i&&(t.use=r.concat(i)),s&&o&&(t.fallback=Le(s,o))}return t},Fn=h.createContext({}),Gr=n=>{const{value:e}=n,t=h.useContext(Fn),r=ge(e),s=h.useMemo(()=>r?e(t):e,[r,t,e]),i=h.useMemo(()=>r?s:Yr(t,s),[r,t,s]),o=s&&s.provider,c=h.useRef(oe);o&&!c.current&&(c.current=qr(o(i.cache||Xt),s));const l=c.current;return l&&(i.cache=l[0],i.mutate=l[1]),Ye(()=>{if(l)return l[2]&&l[2](),l[3]},[]),h.createElement(Fn.Provider,Le(n,{value:i}))},Xr="$inf$",Qr=qt&&window.__SWR_DEVTOOLS_USE__,Lo=Qr?window.__SWR_DEVTOOLS_USE__:[],No=()=>{Qr&&(window.__SWR_DEVTOOLS_REACT__=Je.default)},Zr=n=>ge(n[1])?[n[0],n[1],n[2]||{}]:[n[0],null,(n[1]===null?n[2]:n[1])||{}],$r=()=>Le(Nn,h.useContext(Fn)),Fo=n=>(e,t,r)=>n(e,t&&((...i)=>{const[o]=rt(e),[,,,c]=Oe.get(Xt);if(o.startsWith(Xr))return t(...i);const l=c[o];return R(l)?t(...i):(delete c[o],l)}),r),Po=Lo.concat(Fo),es=n=>function(...t){const r=$r(),[s,i,o]=Zr(t),c=Yr(r,o);let l=n;const{use:a}=c,d=(a||[]).concat(Po);for(let f=d.length;f--;)l=d[f](l);return l(s,i||c.fetcher||null,c)},ts=(n,e,t)=>{const r=e[n]||(e[n]=[]);return r.push(t),()=>{const s=r.indexOf(t);s>=0&&(r[s]=r[r.length-1],r.pop())}},Bo=(n,e)=>(...t)=>{const[r,s,i]=Zr(t),o=(i.use||[]).concat(e);return n(r,s,{...i,use:o})};No();const ns=Je.default.use||(n=>{if(n.status==="pending")throw n;if(n.status==="fulfilled")return n.value;throw n.status==="rejected"?n.reason:(n.status="pending",n.then(e=>{n.status="fulfilled",n.value=e},e=>{n.status="rejected",n.reason=e}),n)}),Pn={dedupe:!0},Io=(n,e,t)=>{const{cache:r,compare:s,suspense:i,fallbackData:o,revalidateOnMount:c,revalidateIfStale:l,refreshInterval:a,refreshWhenHidden:d,refreshWhenOffline:f,keepPreviousData:_}=t,[v,g,y,x]=Oe.get(r),[m,A]=rt(n),k=h.useRef(!1),D=h.useRef(!1),L=h.useRef(m),N=h.useRef(e),ce=h.useRef(t),E=()=>ce.current,H=()=>E().isVisible()&&E().isOnline(),[F,Z,de,q]=Ve(r,m),K=h.useRef({}).current,ye=R(o)?t.fallback[m]:o,be=(S,T)=>{for(const j in K){const O=j;if(O==="data"){if(!s(S[O],T[O])&&(!R(S[O])||!s(Se,T[O])))return!1}else if(T[O]!==S[O])return!1}return!0},$=h.useMemo(()=>{const S=(()=>!m||!e?!1:R(c)?E().isPaused()||i?!1:R(l)?!0:l:c)(),T=B=>{const ne=Le(B);return delete ne._k,S?{isValidating:!0,isLoading:!0,...ne}:ne},j=F(),O=q(),Q=T(j),pe=j===O?Q:T(O);let P=Q;return[()=>{const B=T(F());return be(B,P)?(P.data=B.data,P.isLoading=B.isLoading,P.isValidating=B.isValidating,P.error=B.error,P):(P=B,B)},()=>pe]},[r,m]),ee=zt.exports.useSyncExternalStore(h.useCallback(S=>de(m,(T,j)=>{be(j,T)||S()}),[r,m]),$[0],$[1]),Re=!k.current,Xe=v[m]&&v[m].length>0,le=ee.data,X=R(le)?ye:le,ve=ee.error,Be=h.useRef(X),Se=_?R(le)?Be.current:le:X,xe=(()=>Xe&&!R(ve)?!1:Re&&!R(c)?c:E().isPaused()?!1:i?R(X)?!1:l:R(X)||l)(),je=!!(m&&e&&Re&&xe),Qe=R(ee.isValidating)?je:ee.isValidating,st=R(ee.isLoading)?je:ee.isLoading,he=h.useCallback(async S=>{const T=N.current;if(!m||!T||D.current||E().isPaused())return!1;let j,O,Q=!0;const pe=S||{},P=!y[m]||!pe.dedupe,B=()=>Yt?!D.current&&m===L.current&&k.current:m===L.current,ne={isValidating:!1,isLoading:!1},ot=()=>{Z(ne)},Me=()=>{const Y=y[m];Y&&Y[1]===O&&delete y[m]},at={isValidating:!0};R(F().data)&&(at.isLoading=!0);try{if(P&&(Z(at),t.loadingTimeout&&R(F().data)&&setTimeout(()=>{Q&&B()&&E().onLoadingSlow(m,t)},t.loadingTimeout),y[m]=[T(A),Gt()]),[j,O]=y[m],j=await j,P&&setTimeout(Me,t.dedupingInterval),!y[m]||y[m][1]!==O)return P&&B()&&E().onDiscarded(m),!1;ne.error=oe;const Y=g[m];if(!R(Y)&&(O<=Y[0]||O<=Y[1]||Y[1]===0))return ot(),P&&B()&&E().onDiscarded(m),!1;const te=F().data;ne.data=s(te,j)?te:j,P&&B()&&E().onSuccess(j,m,t)}catch(Y){Me();const te=E(),{shouldRetryOnError:Ie}=te;te.isPaused()||(ne.error=Y,P&&B()&&(te.onError(Y,m,te),(Ie===!0||ge(Ie)&&Ie(Y))&&(!E().revalidateOnFocus||!E().revalidateOnReconnect||H())&&te.onErrorRetry(Y,m,te,We=>{const He=v[m];He&&He[0]&&He[0](Ne.ERROR_REVALIDATE_EVENT,We)},{retryCount:(pe.retryCount||0)+1,dedupe:!0})))}return Q=!1,ot(),!0},[m,r]),it=h.useCallback((...S)=>Ln(r,L.current,...S),[]);if(Ye(()=>{N.current=e,ce.current=t,R(le)||(Be.current=le)}),Ye(()=>{if(!m)return;const S=he.bind(oe,Pn);let T=0;const O=ts(m,v,(Q,pe={})=>{if(Q==Ne.FOCUS_EVENT){const P=Date.now();E().revalidateOnFocus&&P>T&&H()&&(T=P+E().focusThrottleInterval,S())}else if(Q==Ne.RECONNECT_EVENT)E().revalidateOnReconnect&&H()&&S();else{if(Q==Ne.MUTATE_EVENT)return he();if(Q==Ne.ERROR_REVALIDATE_EVENT)return he(pe)}});return D.current=!1,L.current=m,k.current=!0,Z({_k:A}),xe&&(R(X)||nt?S():Mr(S)),()=>{D.current=!0,O()}},[m]),Ye(()=>{let S;function T(){const O=ge(a)?a(F().data):a;O&&S!==-1&&(S=setTimeout(j,O))}function j(){!F().error&&(d||E().isVisible())&&(f||E().isOnline())?he(Pn).then(T):T()}return T(),()=>{S&&(clearTimeout(S),S=-1)}},[a,d,f,m]),h.useDebugValue(Se),i&&R(X)&&m){if(!Yt&&nt)throw new Error("Fallback data is required when using suspense in SSR.");N.current=e,ce.current=t,D.current=!1;const S=x[m];if(!R(S)){const T=it(S);ns(T)}if(R(ve)){const T=he(Pn);R(Se)||(T.status="fulfilled",T.value=!0),ns(T)}else throw ve}return{mutate:it,get data(){return K.data=!0,Se},get error(){return K.error=!0,ve},get isValidating(){return K.isValidating=!0,Qe},get isLoading(){return K.isLoading=!0,st}}},Uo=St.defineProperty(Gr,"defaultValue",{value:Nn}),dt=es(Io),rs=Je.default.use||(n=>{if(n.status==="pending")throw n;if(n.status==="fulfilled")return n.value;throw n.status==="rejected"?n.reason:(n.status="pending",n.then(e=>{n.status="fulfilled",n.value=e},e=>{n.status="rejected",n.reason=e}),n)}),Bn={dedupe:!0},Vo=(n,e,t)=>{const{cache:r,compare:s,suspense:i,fallbackData:o,revalidateOnMount:c,revalidateIfStale:l,refreshInterval:a,refreshWhenHidden:d,refreshWhenOffline:f,keepPreviousData:_}=t,[v,g,y,x]=Oe.get(r),[m,A]=rt(n),k=h.useRef(!1),D=h.useRef(!1),L=h.useRef(m),N=h.useRef(e),ce=h.useRef(t),E=()=>ce.current,H=()=>E().isVisible()&&E().isOnline(),[F,Z,de,q]=Ve(r,m),K=h.useRef({}).current,ye=R(o)?t.fallback[m]:o,be=(S,T)=>{for(const j in K){const O=j;if(O==="data"){if(!s(S[O],T[O])&&(!R(S[O])||!s(Se,T[O])))return!1}else if(T[O]!==S[O])return!1}return!0},$=h.useMemo(()=>{const S=(()=>!m||!e?!1:R(c)?E().isPaused()||i?!1:R(l)?!0:l:c)(),T=B=>{const ne=Le(B);return delete ne._k,S?{isValidating:!0,isLoading:!0,...ne}:ne},j=F(),O=q(),Q=T(j),pe=j===O?Q:T(O);let P=Q;return[()=>{const B=T(F());return be(B,P)?(P.data=B.data,P.isLoading=B.isLoading,P.isValidating=B.isValidating,P.error=B.error,P):(P=B,B)},()=>pe]},[r,m]),ee=zt.exports.useSyncExternalStore(h.useCallback(S=>de(m,(T,j)=>{be(j,T)||S()}),[r,m]),$[0],$[1]),Re=!k.current,Xe=v[m]&&v[m].length>0,le=ee.data,X=R(le)?ye:le,ve=ee.error,Be=h.useRef(X),Se=_?R(le)?Be.current:le:X,xe=(()=>Xe&&!R(ve)?!1:Re&&!R(c)?c:E().isPaused()?!1:i?R(X)?!1:l:R(X)||l)(),je=!!(m&&e&&Re&&xe),Qe=R(ee.isValidating)?je:ee.isValidating,st=R(ee.isLoading)?je:ee.isLoading,he=h.useCallback(async S=>{const T=N.current;if(!m||!T||D.current||E().isPaused())return!1;let j,O,Q=!0;const pe=S||{},P=!y[m]||!pe.dedupe,B=()=>Yt?!D.current&&m===L.current&&k.current:m===L.current,ne={isValidating:!1,isLoading:!1},ot=()=>{Z(ne)},Me=()=>{const Y=y[m];Y&&Y[1]===O&&delete y[m]},at={isValidating:!0};R(F().data)&&(at.isLoading=!0);try{if(P&&(Z(at),t.loadingTimeout&&R(F().data)&&setTimeout(()=>{Q&&B()&&E().onLoadingSlow(m,t)},t.loadingTimeout),y[m]=[T(A),Gt()]),[j,O]=y[m],j=await j,P&&setTimeout(Me,t.dedupingInterval),!y[m]||y[m][1]!==O)return P&&B()&&E().onDiscarded(m),!1;ne.error=oe;const Y=g[m];if(!R(Y)&&(O<=Y[0]||O<=Y[1]||Y[1]===0))return ot(),P&&B()&&E().onDiscarded(m),!1;const te=F().data;ne.data=s(te,j)?te:j,P&&B()&&E().onSuccess(j,m,t)}catch(Y){Me();const te=E(),{shouldRetryOnError:Ie}=te;te.isPaused()||(ne.error=Y,P&&B()&&(te.onError(Y,m,te),(Ie===!0||ge(Ie)&&Ie(Y))&&(!E().revalidateOnFocus||!E().revalidateOnReconnect||H())&&te.onErrorRetry(Y,m,te,We=>{const He=v[m];He&&He[0]&&He[0](Ne.ERROR_REVALIDATE_EVENT,We)},{retryCount:(pe.retryCount||0)+1,dedupe:!0})))}return Q=!1,ot(),!0},[m,r]),it=h.useCallback((...S)=>Ln(r,L.current,...S),[]);if(Ye(()=>{N.current=e,ce.current=t,R(le)||(Be.current=le)}),Ye(()=>{if(!m)return;const S=he.bind(oe,Bn);let T=0;const O=ts(m,v,(Q,pe={})=>{if(Q==Ne.FOCUS_EVENT){const P=Date.now();E().revalidateOnFocus&&P>T&&H()&&(T=P+E().focusThrottleInterval,S())}else if(Q==Ne.RECONNECT_EVENT)E().revalidateOnReconnect&&H()&&S();else{if(Q==Ne.MUTATE_EVENT)return he();if(Q==Ne.ERROR_REVALIDATE_EVENT)return he(pe)}});return D.current=!1,L.current=m,k.current=!0,Z({_k:A}),xe&&(R(X)||nt?S():Mr(S)),()=>{D.current=!0,O()}},[m]),Ye(()=>{let S;function T(){const O=ge(a)?a(F().data):a;O&&S!==-1&&(S=setTimeout(j,O))}function j(){!F().error&&(d||E().isVisible())&&(f||E().isOnline())?he(Bn).then(T):T()}return T(),()=>{S&&(clearTimeout(S),S=-1)}},[a,d,f,m]),h.useDebugValue(Se),i&&R(X)&&m){if(!Yt&&nt)throw new Error("Fallback data is required when using suspense in SSR.");N.current=e,ce.current=t,D.current=!1;const S=x[m];if(!R(S)){const T=it(S);rs(T)}if(R(ve)){const T=he(Bn);R(Se)||(T.status="fulfilled",T.value=!0),rs(T)}else throw ve}return{mutate:it,get data(){return K.data=!0,Se},get error(){return K.error=!0,ve},get isValidating(){return K.isValidating=!0,Qe},get isLoading(){return K.isLoading=!0,st}}};St.defineProperty(Gr,"defaultValue",{value:Nn});const jo=es(Vo),Mo=n=>rt(n?n(0,null):null)[0],In=Promise.resolve(),Wo=Bo(jo,n=>(e,t,r)=>{const s=h.useRef(!1),{cache:i,initialSize:o=1,revalidateAll:c=!1,persistSize:l=!1,revalidateFirstPage:a=!0,revalidateOnMount:d=!1,parallel:f=!1}=r,[,,,_]=Oe.get(Xt);let v;try{v=Mo(e),v&&(v=Xr+v)}catch{}const[g,y,x]=Ve(i,v),m=h.useCallback(()=>R(g()._l)?o:g()._l,[i,v,o]);zt.exports.useSyncExternalStore(h.useCallback(E=>v?x(v,()=>{E()}):()=>{},[i,v]),m,m);const A=h.useCallback(()=>{const E=g()._l;return R(E)?o:E},[v,o]),k=h.useRef(A());Ye(()=>{if(!s.current){s.current=!0;return}v&&y({_l:l?k.current:A()})},[v,i]);const D=d&&!s.current,L=n(v,async E=>{const H=g()._i,F=g()._r;y({_r:oe});const Z=[],de=A(),[q]=Ve(i,E),K=q().data,ye=[];let be=null;for(let $=0;$<de;++$){const[ee,Re]=rt(e($,f?null:be));if(!ee)break;const[Xe,le]=Ve(i,ee);let X=Xe().data;const ve=c||H||R(X)||a&&!$&&!R(K)||D||K&&!R(K[$])&&!r.compare(K[$],X);if(t&&(typeof F=="function"?F(X,Re):ve)){const Be=async()=>{if(!(ee in _))X=await t(Re);else{const xe=_[ee];delete _[ee],X=await xe}le({data:X,_k:Re}),Z[$]=X};f?ye.push(Be):await Be()}else Z[$]=X;f||(be=X)}return f&&await Promise.all(ye.map($=>$())),y({_i:oe}),Z},r),N=h.useCallback(function(E,H){const F=typeof H=="boolean"?{revalidate:H}:H||{},Z=F.revalidate!==!1;return v?(Z&&(R(E)?y({_i:!0,_r:F.revalidate}):y({_i:!1,_r:F.revalidate})),arguments.length?L.mutate(E,{...F,revalidate:Z}):L.mutate()):In},[v,i]),ce=h.useCallback(E=>{if(!v)return In;const[,H]=Ve(i,v);let F;if(ge(E)?F=E(A()):typeof E=="number"&&(F=E),typeof F!="number")return In;H({_l:F}),k.current=F;const Z=[],[de]=Ve(i,v);let q=null;for(let K=0;K<F;++K){const[ye]=rt(e(K,q)),[be]=Ve(i,ye),$=ye?be().data:oe;if(R($))return N(de().data);Z.push($),q=$}return N(Z)},[v,i,N,A]);return{size:A(),setSize:ce,mutate:N,get data(){return L.data},get error(){return L.error},get isValidating(){return L.isValidating},get isLoading(){return L.isLoading}}}),Fe=Object.create(null);Fe.open="0",Fe.close="1",Fe.ping="2",Fe.pong="3",Fe.message="4",Fe.upgrade="5",Fe.noop="6";const Qt=Object.create(null);Object.keys(Fe).forEach(n=>{Qt[Fe[n]]=n});const Un={type:"error",data:"parser error"},ss=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",is=typeof ArrayBuffer=="function",os=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,Vn=({type:n,data:e},t,r)=>ss&&e instanceof Blob?t?r(e):as(e,r):is&&(e instanceof ArrayBuffer||os(e))?t?r(e):as(new Blob([e]),r):r(Fe[n]+(e||"")),as=(n,e)=>{const t=new FileReader;return t.onload=function(){const r=t.result.split(",")[1];e("b"+(r||""))},t.readAsDataURL(n)};function cs(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}let jn;function Ho(n,e){if(ss&&n.data instanceof Blob)return n.data.arrayBuffer().then(cs).then(e);if(is&&(n.data instanceof ArrayBuffer||os(n.data)))return e(cs(n.data));Vn(n,!1,t=>{jn||(jn=new TextEncoder),e(jn.encode(t))})}const us="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ot=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<us.length;n++)Ot[us.charCodeAt(n)]=n;const zo=n=>{let e=n.length*.75,t=n.length,r,s=0,i,o,c,l;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);const a=new ArrayBuffer(e),d=new Uint8Array(a);for(r=0;r<t;r+=4)i=Ot[n.charCodeAt(r)],o=Ot[n.charCodeAt(r+1)],c=Ot[n.charCodeAt(r+2)],l=Ot[n.charCodeAt(r+3)],d[s++]=i<<2|o>>4,d[s++]=(o&15)<<4|c>>2,d[s++]=(c&3)<<6|l&63;return a},Jo=typeof ArrayBuffer=="function",Mn=(n,e)=>{if(typeof n!="string")return{type:"message",data:ls(n,e)};const t=n.charAt(0);return t==="b"?{type:"message",data:Ko(n.substring(1),e)}:Qt[t]?n.length>1?{type:Qt[t],data:n.substring(1)}:{type:Qt[t]}:Un},Ko=(n,e)=>{if(Jo){const t=zo(n);return ls(t,e)}else return{base64:!0,data:n}},ls=(n,e)=>{switch(e){case"blob":return n instanceof Blob?n:new Blob([n]);case"arraybuffer":default:return n instanceof ArrayBuffer?n:n.buffer}},fs=String.fromCharCode(30),qo=(n,e)=>{const t=n.length,r=new Array(t);let s=0;n.forEach((i,o)=>{Vn(i,!1,c=>{r[o]=c,++s===t&&e(r.join(fs))})})},Yo=(n,e)=>{const t=n.split(fs),r=[];for(let s=0;s<t.length;s++){const i=Mn(t[s],e);if(r.push(i),i.type==="error")break}return r};function Go(){return new TransformStream({transform(n,e){Ho(n,t=>{const r=t.length;let s;if(r<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,r);else if(r<65536){s=new Uint8Array(3);const i=new DataView(s.buffer);i.setUint8(0,126),i.setUint16(1,r)}else{s=new Uint8Array(9);const i=new DataView(s.buffer);i.setUint8(0,127),i.setBigUint64(1,BigInt(r))}n.data&&typeof n.data!="string"&&(s[0]|=128),e.enqueue(s),e.enqueue(t)})}})}let Wn;function Zt(n){return n.reduce((e,t)=>e+t.length,0)}function $t(n,e){if(n[0].length===e)return n.shift();const t=new Uint8Array(e);let r=0;for(let s=0;s<e;s++)t[s]=n[0][r++],r===n[0].length&&(n.shift(),r=0);return n.length&&r<n[0].length&&(n[0]=n[0].slice(r)),t}function Xo(n,e){Wn||(Wn=new TextDecoder);const t=[];let r=0,s=-1,i=!1;return new TransformStream({transform(o,c){for(t.push(o);;){if(r===0){if(Zt(t)<1)break;const l=$t(t,1);i=(l[0]&128)===128,s=l[0]&127,s<126?r=3:s===126?r=1:r=2}else if(r===1){if(Zt(t)<2)break;const l=$t(t,2);s=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),r=3}else if(r===2){if(Zt(t)<8)break;const l=$t(t,8),a=new DataView(l.buffer,l.byteOffset,l.length),d=a.getUint32(0);if(d>Math.pow(2,53-32)-1){c.enqueue(Un);break}s=d*Math.pow(2,32)+a.getUint32(4),r=3}else{if(Zt(t)<s)break;const l=$t(t,s);c.enqueue(Mn(i?l:Wn.decode(l),e)),r=0}if(s===0||s>n){c.enqueue(Un);break}}}})}const ds=4;function ae(n){if(n)return Qo(n)}function Qo(n){for(var e in ae.prototype)n[e]=ae.prototype[e];return n}ae.prototype.on=ae.prototype.addEventListener=function(n,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(e),this},ae.prototype.once=function(n,e){function t(){this.off(n,t),e.apply(this,arguments)}return t.fn=e,this.on(n,t),this},ae.prototype.off=ae.prototype.removeListener=ae.prototype.removeAllListeners=ae.prototype.removeEventListener=function(n,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+n];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var r,s=0;s<t.length;s++)if(r=t[s],r===e||r.fn===e){t.splice(s,1);break}return t.length===0&&delete this._callbacks["$"+n],this},ae.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+n],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(t){t=t.slice(0);for(var r=0,s=t.length;r<s;++r)t[r].apply(this,e)}return this},ae.prototype.emitReserved=ae.prototype.emit,ae.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]},ae.prototype.hasListeners=function(n){return!!this.listeners(n).length};const Ee=(()=>typeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function hs(n,...e){return e.reduce((t,r)=>(n.hasOwnProperty(r)&&(t[r]=n[r]),t),{})}const Zo=Ee.setTimeout,$o=Ee.clearTimeout;function en(n,e){e.useNativeTimers?(n.setTimeoutFn=Zo.bind(Ee),n.clearTimeoutFn=$o.bind(Ee)):(n.setTimeoutFn=Ee.setTimeout.bind(Ee),n.clearTimeoutFn=Ee.clearTimeout.bind(Ee))}const ea=1.33;function ta(n){return typeof n=="string"?na(n):Math.ceil((n.byteLength||n.size)*ea)}function na(n){let e=0,t=0;for(let r=0,s=n.length;r<s;r++)e=n.charCodeAt(r),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(r++,t+=4);return t}function ra(n){let e="";for(let t in n)n.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(n[t]));return e}function sa(n){let e={},t=n.split("&");for(let r=0,s=t.length;r<s;r++){let i=t[r].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}class ia extends Error{constructor(e,t,r){super(e),this.description=t,this.context=r,this.type="TransportError"}}class Hn extends ae{constructor(e){super(),this.writable=!1,en(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,r){return super.emitReserved("error",new ia(e,t,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=Mn(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const t=ra(e);return t.length?"?"+t:""}}const ps="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),zn=64,oa={};let ys=0,tn=0,ms;function gs(n){let e="";do e=ps[n%zn]+e,n=Math.floor(n/zn);while(n>0);return e}function vs(){const n=gs(+new Date);return n!==ms?(ys=0,ms=n):n+"."+gs(ys++)}for(;tn<zn;tn++)oa[ps[tn]]=tn;let bs=!1;try{bs=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const aa=bs;function _s(n){const e=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||aa))return new XMLHttpRequest}catch{}if(!e)try{return new Ee[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function vc(){}function ca(){}const ua=function(){return new _s({xdomain:!1}).responseType!=null}();class la extends Hn{constructor(e){if(super(e),this.polling=!1,typeof location<"u"){const r=location.protocol==="https:";let s=location.port;s||(s=r?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||s!==e.port}const t=e&&e.forceBase64;this.supportsBinary=ua&&!t,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||t()})),this.writable||(r++,this.once("drain",function(){--r||t()}))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};Yo(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,qo(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=vs()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Pe(this.uri(),e)}doWrite(e,t){const r=this.request({method:"POST",data:e});r.on("success",t),r.on("error",(s,i)=>{this.onError("xhr post error",s,i)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,r)=>{this.onError("xhr poll error",t,r)}),this.pollXhr=e}}class Pe extends ae{constructor(e,t){super(),en(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.data=t.data!==void 0?t.data:null,this.create()}create(){var e;const t=hs(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd;const r=this.xhr=new _s(t);try{r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let s in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(s)&&r.setRequestHeader(s,this.opts.extraHeaders[s])}}catch{}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(e=this.opts.cookieJar)===null||e===void 0||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var s;r.readyState===3&&((s=this.opts.cookieJar)===null||s===void 0||s.parseCookies(r)),r.readyState===4&&(r.status===200||r.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof r.status=="number"?r.status:0)},0))},r.send(this.data)}catch(s){this.setTimeoutFn(()=>{this.onError(s)},0);return}typeof document<"u"&&(this.index=Pe.requestsCount++,Pe.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=ca,e)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Pe.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}if(Pe.requestsCount=0,Pe.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",ws);else if(typeof addEventListener=="function"){const n="onpagehide"in Ee?"pagehide":"unload";addEventListener(n,ws,!1)}}function ws(){for(let n in Pe.requests)Pe.requests.hasOwnProperty(n)&&Pe.requests[n].abort()}const Jn=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0))(),nn=Ee.WebSocket||Ee.MozWebSocket,Es=!0,fa="arraybuffer",Rs=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class da extends Hn{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,r=Rs?{}:hs(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=Es&&!Rs?t?new nn(e,t):new nn(e):new nn(e,t,r)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const r=e[t],s=t===e.length-1;Vn(r,this.supportsBinary,i=>{const o={};try{Es&&this.ws.send(i)}catch{}s&&Jn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=vs()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!nn}}class ha extends Hn{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(e=>{const t=Xo(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(t).getReader(),s=Go();s.readable.pipeTo(e.writable),this.writer=s.writable.getWriter();const i=()=>{r.read().then(({done:c,value:l})=>{c||(this.onPacket(l),i())}).catch(c=>{})};i();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this.writer.write(o).then(()=>this.onOpen())})}))}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const r=e[t],s=t===e.length-1;this.writer.write(r).then(()=>{s&&Jn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this.transport)===null||e===void 0||e.close()}}const pa={websocket:da,webtransport:ha,polling:la},ya=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,ma=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Kn(n){const e=n,t=n.indexOf("["),r=n.indexOf("]");t!=-1&&r!=-1&&(n=n.substring(0,t)+n.substring(t,r).replace(/:/g,";")+n.substring(r,n.length));let s=ya.exec(n||""),i={},o=14;for(;o--;)i[ma[o]]=s[o]||"";return t!=-1&&r!=-1&&(i.source=e,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=ga(i,i.path),i.queryKey=va(i,i.query),i}function ga(n,e){const t=/\/{2,9}/g,r=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function va(n,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,s,i){s&&(t[s]=i)}),t}class Ge extends ae{constructor(e,t={}){super(),this.binaryType=fa,this.writeBuffer=[],e&&typeof e=="object"&&(t=e,e=null),e?(e=Kn(e),t.hostname=e.host,t.secure=e.protocol==="https"||e.protocol==="wss",t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=Kn(t.host).host),en(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,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},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=sa(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(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"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=ds,t.transport=e,this.id&&(t.sid=this.id);const r=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new pa[e](r)}open(){let e;if(this.opts.rememberUpgrade&&Ge.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch{this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",t=>this.onClose("transport close",t))}probe(e){let t=this.createTransport(e),r=!1;Ge.priorWebsocketSuccess=!1;const s=()=>{r||(t.send([{type:"ping",data:"probe"}]),t.once("packet",f=>{if(!r)if(f.type==="pong"&&f.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;Ge.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(d(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const _=new Error("probe error");_.transport=t.name,this.emitReserved("upgradeError",_)}}))};function i(){r||(r=!0,d(),t.close(),t=null)}const o=f=>{const _=new Error("probe error: "+f);_.transport=t.name,i(),this.emitReserved("upgradeError",_)};function c(){o("transport closed")}function l(){o("socket closed")}function a(f){t&&f.name!==t.name&&i()}const d=()=>{t.removeListener("open",s),t.removeListener("error",o),t.removeListener("close",c),this.off("close",l),this.off("upgrading",a)};t.once("open",s),t.once("error",o),t.once("close",c),this.once("close",l),this.once("upgrading",a),this.upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||t.open()},200):t.open()}onOpen(){if(this.readyState="open",Ge.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let e=0;const t=this.upgrades.length;for(;e<t;e++)this.probe(this.upgrades[e])}}onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),this.resetPingTimeout(),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let r=0;r<this.writeBuffer.length;r++){const s=this.writeBuffer[r].data;if(s&&(t+=ta(s)),r>0&&t>this.maxPayload)return this.writeBuffer.slice(0,r);t+=2}return this.writeBuffer}write(e,t,r){return this.sendPacket("message",e,t,r),this}send(e,t,r){return this.sendPacket("message",e,t,r),this}sendPacket(e,t,r,s){if(typeof t=="function"&&(s=t,t=void 0),typeof r=="function"&&(s=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const i={type:e,data:t,options:r};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),s&&this.once("flush",s),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},r=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}onError(e){Ge.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const t=[];let r=0;const s=e.length;for(;r<s;r++)~this.transports.indexOf(e[r])&&t.push(e[r]);return t}}Ge.protocol=ds;function ba(n,e="",t){let r=n;t=t||typeof location<"u"&&location,n==null&&(n=t.protocol+"//"+t.host),typeof n=="string"&&(n.charAt(0)==="/"&&(n.charAt(1)==="/"?n=t.protocol+n:n=t.host+n),/^(https?|wss?):\/\//.test(n)||(typeof t<"u"?n=t.protocol+"//"+n:n="https://"+n),r=Kn(n)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const i=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+e,r.href=r.protocol+"://"+i+(t&&t.port===r.port?"":":"+r.port),r}const _a=typeof ArrayBuffer=="function",wa=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,Ss=Object.prototype.toString,Ea=typeof Blob=="function"||typeof Blob<"u"&&Ss.call(Blob)==="[object BlobConstructor]",Ra=typeof File=="function"||typeof File<"u"&&Ss.call(File)==="[object FileConstructor]";function qn(n){return _a&&(n instanceof ArrayBuffer||wa(n))||Ea&&n instanceof Blob||Ra&&n instanceof File}function rn(n,e){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let t=0,r=n.length;t<r;t++)if(rn(n[t]))return!0;return!1}if(qn(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return rn(n.toJSON(),!0);for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&rn(n[t]))return!0;return!1}function Sa(n){const e=[],t=n.data,r=n;return r.data=Yn(t,e),r.attachments=e.length,{packet:r,buffers:e}}function Yn(n,e){if(!n)return n;if(qn(n)){const t={_placeholder:!0,num:e.length};return e.push(n),t}else if(Array.isArray(n)){const t=new Array(n.length);for(let r=0;r<n.length;r++)t[r]=Yn(n[r],e);return t}else if(typeof n=="object"&&!(n instanceof Date)){const t={};for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=Yn(n[r],e));return t}return n}function Ta(n,e){return n.data=Gn(n.data,e),delete n.attachments,n}function Gn(n,e){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<e.length)return e[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let t=0;t<n.length;t++)n[t]=Gn(n[t],e);else if(typeof n=="object")for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&(n[t]=Gn(n[t],e));return n}const Oa=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Ca=5;var V;(function(n){n[n.CONNECT=0]="CONNECT",n[n.DISCONNECT=1]="DISCONNECT",n[n.EVENT=2]="EVENT",n[n.ACK=3]="ACK",n[n.CONNECT_ERROR=4]="CONNECT_ERROR",n[n.BINARY_EVENT=5]="BINARY_EVENT",n[n.BINARY_ACK=6]="BINARY_ACK"})(V||(V={}));class xa{constructor(e){this.replacer=e}encode(e){return(e.type===V.EVENT||e.type===V.ACK)&&rn(e)?this.encodeAsBinary({type:e.type===V.EVENT?V.BINARY_EVENT:V.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===V.BINARY_EVENT||e.type===V.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=Sa(e),r=this.encodeAsString(t.packet),s=t.buffers;return s.unshift(r),s}}function Ts(n){return Object.prototype.toString.call(n)==="[object Object]"}class Xn extends ae{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const r=t.type===V.BINARY_EVENT;r||t.type===V.BINARY_ACK?(t.type=r?V.EVENT:V.ACK,this.reconstructor=new Aa(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(qn(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0;const r={type:Number(e.charAt(0))};if(V[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===V.BINARY_EVENT||r.type===V.BINARY_ACK){const i=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);const o=e.substring(i,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");r.attachments=Number(o)}if(e.charAt(t+1)==="/"){const i=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););r.nsp=e.substring(i,t)}else r.nsp="/";const s=e.charAt(t+1);if(s!==""&&Number(s)==s){const i=t+1;for(;++t;){const o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}r.id=Number(e.substring(i,t+1))}if(e.charAt(++t)){const i=this.tryParse(e.substr(t));if(Xn.isPayloadValid(r.type,i))r.data=i;else throw new Error("invalid payload")}return r}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case V.CONNECT:return Ts(t);case V.DISCONNECT:return t===void 0;case V.CONNECT_ERROR:return typeof t=="string"||Ts(t);case V.EVENT:case V.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&Oa.indexOf(t[0])===-1);case V.ACK:case V.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Aa{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=Ta(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Da=Object.freeze(Object.defineProperty({__proto__:null,protocol:Ca,get PacketType(){return V},Encoder:xa,Decoder:Xn},Symbol.toStringTag,{value:"Module"}));function Ce(n,e,t){return n.on(e,t),function(){n.off(e,t)}}const ka=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Os extends ae{constructor(e,t,r){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=e,this.nsp=t,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Ce(e,"open",this.onopen.bind(this)),Ce(e,"packet",this.onpacket.bind(this)),Ce(e,"error",this.onerror.bind(this)),Ce(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){if(ka.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const r={type:V.EVENT,data:t};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const o=this.ids++,c=t.pop();this._registerAckCallback(o,c),r.id=o}const s=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!s||!this.connected)||(this.connected?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r)),this.flags={},this}_registerAckCallback(e,t){var r;const s=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(s===void 0){this.acks[e]=t;return}const i=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===e&&this.sendBuffer.splice(o,1);t.call(this,new Error("operation has timed out"))},s);this.acks[e]=(...o)=>{this.io.clearTimeoutFn(i),t.apply(this,[null,...o])}}emitWithAck(e,...t){const r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((s,i)=>{t.push((o,c)=>r?o?i(o):s(c):s(o)),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((s,...i)=>r!==this._queue[0]?void 0:(s!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(s)):(this._queue.shift(),t&&t(null,...i)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:V.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case V.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.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 V.EVENT:case V.BINARY_EVENT:this.onevent(e);break;case V.ACK:case V.BINARY_ACK:this.onack(e);break;case V.DISCONNECT:this.ondisconnect();break;case V.CONNECT_ERROR:this.destroy();const r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const r of t)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let r=!1;return function(...s){r||(r=!0,t.packet({type:V.ACK,id:e,data:s}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(t.apply(this,e.data),delete this.acks[e.id])}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:V.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const r of t)r.apply(this,e.data)}}}function ht(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}ht.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*n);n=(Math.floor(e*10)&1)==0?n-t:n+t}return Math.min(n,this.max)|0},ht.prototype.reset=function(){this.attempts=0},ht.prototype.setMin=function(n){this.ms=n},ht.prototype.setMax=function(n){this.max=n},ht.prototype.setJitter=function(n){this.jitter=n};class Qn extends ae{constructor(e,t){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,en(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((r=t.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new ht({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const s=t.parser||Da;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Ge(this.uri,this.opts);const t=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const s=Ce(t,"open",function(){r.onopen(),e&&e()}),i=c=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",c),e?e(c):this.maybeReconnectOnOpen()},o=Ce(t,"error",i);if(this._timeout!==!1){const c=this._timeout,l=this.setTimeoutFn(()=>{s(),i(new Error("timeout")),t.close()},c);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(s),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Ce(e,"ping",this.onping.bind(this)),Ce(e,"data",this.ondata.bind(this)),Ce(e,"error",this.onerror.bind(this)),Ce(e,"close",this.onclose.bind(this)),Ce(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){Jn(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new Os(this,e,t),this.nsps[e]=r),r}_destroy(e){const t=Object.keys(this.nsps);for(const r of t)if(this.nsps[r].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let r=0;r<t.length;r++)this.engine.write(t[r],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(s=>{s?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",s)):e.onreconnect()}))},t);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Ct={};function sn(n,e){typeof n=="object"&&(e=n,n=void 0),e=e||{};const t=ba(n,e.path||"/socket.io"),r=t.source,s=t.id,i=t.path,o=Ct[s]&&i in Ct[s].nsps,c=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let l;return c?l=new Qn(r,e):(Ct[s]||(Ct[s]=new Qn(r,e)),l=Ct[s]),t.query&&!e.query&&(e.query=t.queryKey),l.socket(t.path,e)}Object.assign(sn,{Manager:Qn,Socket:Os,io:sn,connect:sn});class La{constructor(e,t,r,s){Ze(this,"socket_port");Ze(this,"host");Ze(this,"port");Ze(this,"protocol");Ze(this,"url");Ze(this,"site_name");Ze(this,"socket");var i,o,c;if(this.socket_port=r!=null?r:"9000",this.host=(i=window.location)==null?void 0:i.hostname,this.port=(o=window.location)!=null&&o.port?`:${this.socket_port}`:"",this.protocol=this.port?"http":"https",e){let l=new URL(e);l.port="",r?(l.port=r,this.url=l.toString()):this.url=l.toString()}else this.url=`${this.protocol}://${this.host}${this.port}/`;t&&(this.url=`${this.url}${t}`),this.site_name=t,this.socket=sn(`${this.url}`,{withCredentials:!0,secure:this.protocol==="https",extraHeaders:s&&s.useToken===!0?{Authorization:`${s.type} ${(c=s.token)==null?void 0:c.call(s)}`}:{}})}}var Cs={exports:{}},xt={};/**
|
|
22
|
+
*/var jr;function vo(){return jr||(jr=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var n=Je.default,e=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function t(k){{for(var D=arguments.length,L=new Array(D>1?D-1:0),N=1;N<D;N++)L[N-1]=arguments[N];r("error",k,L)}}function r(k,D,L){{var N=e.ReactDebugCurrentFrame,ce=N.getStackAddendum();ce!==""&&(D+="%s",L=L.concat([ce]));var E=L.map(function(H){return String(H)});E.unshift("Warning: "+D),Function.prototype.apply.call(console[k],console,E)}}function s(k,D){return k===D&&(k!==0||1/k===1/D)||k!==k&&D!==D}var i=typeof Object.is=="function"?Object.is:s,o=n.useState,c=n.useEffect,l=n.useLayoutEffect,a=n.useDebugValue,d=!1,f=!1;function _(k,D,L){d||n.startTransition!==void 0&&(d=!0,t("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var N=D();if(!f){var ce=D();i(N,ce)||(t("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}var E=o({inst:{value:N,getSnapshot:D}}),H=E[0].inst,F=E[1];return l(function(){H.value=N,H.getSnapshot=D,v(H)&&F({inst:H})},[k,N,D]),c(function(){v(H)&&F({inst:H});var Z=function(){v(H)&&F({inst:H})};return k(Z)},[k]),a(N),N}function v(k){var D=k.getSnapshot,L=k.value;try{var N=D();return!i(L,N)}catch{return!0}}function g(k,D,L){return D()}var y=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",x=!y,m=x?g:_,A=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:m;Sn.useSyncExternalStore=A,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Sn}(function(n){process.env.NODE_ENV==="production"?n.exports=go():n.exports=vo()})(zt);const qe=()=>{},oe=qe(),St=Object,R=n=>n===oe,ge=n=>typeof n=="function",Le=(n,e)=>({...n,...e}),bo=n=>ge(n.then),Jt=new WeakMap;let _o=0;const Tt=n=>{const e=typeof n,t=n&&n.constructor,r=t==Date;let s,i;if(St(n)===n&&!r&&t!=RegExp){if(s=Jt.get(n),s)return s;if(s=++_o+"~",Jt.set(n,s),t==Array){for(s="@",i=0;i<n.length;i++)s+=Tt(n[i])+",";Jt.set(n,s)}if(t==St){s="#";const o=St.keys(n).sort();for(;!R(i=o.pop());)R(n[i])||(s+=i+":"+Tt(n[i])+",");Jt.set(n,s)}}else s=r?n.toJSON():e=="symbol"?n.toString():e=="string"?JSON.stringify(n):""+n;return s},Oe=new WeakMap,Tn={},Kt={},On="undefined",qt=typeof window!=On,Cn=typeof document!=On,wo=()=>qt&&typeof window.requestAnimationFrame!=On,Ve=(n,e)=>{const t=Oe.get(n);return[()=>!R(e)&&n.get(e)||Tn,r=>{if(!R(e)){const s=n.get(e);e in Kt||(Kt[e]=s),t[5](e,Le(s,r),s||Tn)}},t[6],()=>!R(e)&&e in Kt?Kt[e]:!R(e)&&n.get(e)||Tn]};let xn=!0;const Eo=()=>xn,[An,Dn]=qt&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[qe,qe],Ro=()=>{const n=Cn&&document.visibilityState;return R(n)||n!=="hidden"},So=n=>(Cn&&document.addEventListener("visibilitychange",n),An("focus",n),()=>{Cn&&document.removeEventListener("visibilitychange",n),Dn("focus",n)}),To=n=>{const e=()=>{xn=!0,n()},t=()=>{xn=!1};return An("online",e),An("offline",t),()=>{Dn("online",e),Dn("offline",t)}},Oo={isOnline:Eo,isVisible:Ro},Co={initFocus:So,initReconnect:To},Yt=!Je.default.useId,nt=!qt||"Deno"in window,Mr=n=>wo()?window.requestAnimationFrame(n):setTimeout(n,1),Ye=nt?h.useEffect:h.useLayoutEffect,kn=typeof navigator<"u"&&navigator.connection,Wr=!nt&&kn&&(["slow-2g","2g"].includes(kn.effectiveType)||kn.saveData),rt=n=>{if(ge(n))try{n=n()}catch{n=""}const e=n;return n=typeof n=="string"?n:(Array.isArray(n)?n.length:n)?Tt(n):"",[n,e]};let xo=0;const Gt=()=>++xo,Hr=0,zr=1,Jr=2;var Ne={__proto__:null,ERROR_REVALIDATE_EVENT:3,FOCUS_EVENT:Hr,MUTATE_EVENT:Jr,RECONNECT_EVENT:zr};async function Ln(...n){const[e,t,r,s]=n,i=Le({populateCache:!0,throwOnError:!0},typeof s=="boolean"?{revalidate:s}:s||{});let o=i.populateCache;const c=i.rollbackOnError;let l=i.optimisticData;const a=_=>typeof c=="function"?c(_):c!==!1,d=i.throwOnError;if(ge(t)){const _=t,v=[],g=e.keys();for(const y of g)!/^\$(inf|sub)\$/.test(y)&&_(e.get(y)._k)&&v.push(y);return Promise.all(v.map(f))}return f(t);async function f(_){const[v]=rt(_);if(!v)return;const[g,y]=Ve(e,v),[x,m,A,k]=Oe.get(e),D=()=>{const q=x[v];return(ge(i.revalidate)?i.revalidate(g().data,_):i.revalidate!==!1)&&(delete A[v],delete k[v],q&&q[0])?q[0](Jr).then(()=>g().data):g().data};if(n.length<3)return D();let L=r,N;const ce=Gt();m[v]=[ce,0];const E=!R(l),H=g(),F=H.data,Z=H._c,de=R(Z)?F:Z;if(E&&(l=ge(l)?l(de,F):l,y({data:l,_c:de})),ge(L))try{L=L(de)}catch(q){N=q}if(L&&bo(L))if(L=await L.catch(q=>{N=q}),ce!==m[v][0]){if(N)throw N;return L}else N&&E&&a(N)&&(o=!0,y({data:de,_c:oe}));if(o&&!N)if(ge(o)){const q=o(L,de);y({data:q,error:oe,_c:oe})}else y({data:L,error:oe,_c:oe});if(m[v][1]=Gt(),Promise.resolve(D()).then(()=>{y({_c:oe})}),N){if(d)throw N;return}return L}}const Kr=(n,e)=>{for(const t in n)n[t][0]&&n[t][0](e)},qr=(n,e)=>{if(!Oe.has(n)){const t=Le(Co,e),r={},s=Ln.bind(oe,n);let i=qe;const o={},c=(d,f)=>{const _=o[d]||[];return o[d]=_,_.push(f),()=>_.splice(_.indexOf(f),1)},l=(d,f,_)=>{n.set(d,f);const v=o[d];if(v)for(const g of v)g(f,_)},a=()=>{if(!Oe.has(n)&&(Oe.set(n,[r,{},{},{},s,l,c]),!nt)){const d=t.initFocus(setTimeout.bind(oe,Kr.bind(oe,r,Hr))),f=t.initReconnect(setTimeout.bind(oe,Kr.bind(oe,r,zr)));i=()=>{d&&d(),f&&f(),Oe.delete(n)}}};return a(),[n,s,a,i]}return[n,Oe.get(n)[4]]},Ao=(n,e,t,r,s)=>{const i=t.errorRetryCount,o=s.retryCount,c=~~((Math.random()+.5)*(1<<(o<8?o:8)))*t.errorRetryInterval;!R(i)&&o>i||setTimeout(r,c,s)},Do=(n,e)=>Tt(n)==Tt(e),[Xt,ko]=qr(new Map),Nn=Le({onLoadingSlow:qe,onSuccess:qe,onError:qe,onErrorRetry:Ao,onDiscarded:qe,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Wr?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Wr?5e3:3e3,compare:Do,isPaused:()=>!1,cache:Xt,mutate:ko,fallback:{}},Oo),Yr=(n,e)=>{const t=Le(n,e);if(e){const{use:r,fallback:s}=n,{use:i,fallback:o}=e;r&&i&&(t.use=r.concat(i)),s&&o&&(t.fallback=Le(s,o))}return t},Fn=h.createContext({}),Gr=n=>{const{value:e}=n,t=h.useContext(Fn),r=ge(e),s=h.useMemo(()=>r?e(t):e,[r,t,e]),i=h.useMemo(()=>r?s:Yr(t,s),[r,t,s]),o=s&&s.provider,c=h.useRef(oe);o&&!c.current&&(c.current=qr(o(i.cache||Xt),s));const l=c.current;return l&&(i.cache=l[0],i.mutate=l[1]),Ye(()=>{if(l)return l[2]&&l[2](),l[3]},[]),h.createElement(Fn.Provider,Le(n,{value:i}))},Xr="$inf$",Qr=qt&&window.__SWR_DEVTOOLS_USE__,Lo=Qr?window.__SWR_DEVTOOLS_USE__:[],No=()=>{Qr&&(window.__SWR_DEVTOOLS_REACT__=Je.default)},Zr=n=>ge(n[1])?[n[0],n[1],n[2]||{}]:[n[0],null,(n[1]===null?n[2]:n[1])||{}],$r=()=>Le(Nn,h.useContext(Fn)),Fo=n=>(e,t,r)=>n(e,t&&((...i)=>{const[o]=rt(e),[,,,c]=Oe.get(Xt);if(o.startsWith(Xr))return t(...i);const l=c[o];return R(l)?t(...i):(delete c[o],l)}),r),Po=Lo.concat(Fo),es=n=>function(...t){const r=$r(),[s,i,o]=Zr(t),c=Yr(r,o);let l=n;const{use:a}=c,d=(a||[]).concat(Po);for(let f=d.length;f--;)l=d[f](l);return l(s,i||c.fetcher||null,c)},ts=(n,e,t)=>{const r=e[n]||(e[n]=[]);return r.push(t),()=>{const s=r.indexOf(t);s>=0&&(r[s]=r[r.length-1],r.pop())}},Bo=(n,e)=>(...t)=>{const[r,s,i]=Zr(t),o=(i.use||[]).concat(e);return n(r,s,{...i,use:o})};No();const ns=Je.default.use||(n=>{if(n.status==="pending")throw n;if(n.status==="fulfilled")return n.value;throw n.status==="rejected"?n.reason:(n.status="pending",n.then(e=>{n.status="fulfilled",n.value=e},e=>{n.status="rejected",n.reason=e}),n)}),Pn={dedupe:!0},Io=(n,e,t)=>{const{cache:r,compare:s,suspense:i,fallbackData:o,revalidateOnMount:c,revalidateIfStale:l,refreshInterval:a,refreshWhenHidden:d,refreshWhenOffline:f,keepPreviousData:_}=t,[v,g,y,x]=Oe.get(r),[m,A]=rt(n),k=h.useRef(!1),D=h.useRef(!1),L=h.useRef(m),N=h.useRef(e),ce=h.useRef(t),E=()=>ce.current,H=()=>E().isVisible()&&E().isOnline(),[F,Z,de,q]=Ve(r,m),K=h.useRef({}).current,ye=R(o)?t.fallback[m]:o,be=(S,T)=>{for(const j in K){const O=j;if(O==="data"){if(!s(S[O],T[O])&&(!R(S[O])||!s(Se,T[O])))return!1}else if(T[O]!==S[O])return!1}return!0},$=h.useMemo(()=>{const S=(()=>!m||!e?!1:R(c)?E().isPaused()||i?!1:R(l)?!0:l:c)(),T=B=>{const ne=Le(B);return delete ne._k,S?{isValidating:!0,isLoading:!0,...ne}:ne},j=F(),O=q(),Q=T(j),pe=j===O?Q:T(O);let P=Q;return[()=>{const B=T(F());return be(B,P)?(P.data=B.data,P.isLoading=B.isLoading,P.isValidating=B.isValidating,P.error=B.error,P):(P=B,B)},()=>pe]},[r,m]),ee=zt.exports.useSyncExternalStore(h.useCallback(S=>de(m,(T,j)=>{be(j,T)||S()}),[r,m]),$[0],$[1]),Re=!k.current,Xe=v[m]&&v[m].length>0,le=ee.data,X=R(le)?ye:le,ve=ee.error,Be=h.useRef(X),Se=_?R(le)?Be.current:le:X,xe=(()=>Xe&&!R(ve)?!1:Re&&!R(c)?c:E().isPaused()?!1:i?R(X)?!1:l:R(X)||l)(),je=!!(m&&e&&Re&&xe),Qe=R(ee.isValidating)?je:ee.isValidating,st=R(ee.isLoading)?je:ee.isLoading,he=h.useCallback(async S=>{const T=N.current;if(!m||!T||D.current||E().isPaused())return!1;let j,O,Q=!0;const pe=S||{},P=!y[m]||!pe.dedupe,B=()=>Yt?!D.current&&m===L.current&&k.current:m===L.current,ne={isValidating:!1,isLoading:!1},ot=()=>{Z(ne)},Me=()=>{const Y=y[m];Y&&Y[1]===O&&delete y[m]},at={isValidating:!0};R(F().data)&&(at.isLoading=!0);try{if(P&&(Z(at),t.loadingTimeout&&R(F().data)&&setTimeout(()=>{Q&&B()&&E().onLoadingSlow(m,t)},t.loadingTimeout),y[m]=[T(A),Gt()]),[j,O]=y[m],j=await j,P&&setTimeout(Me,t.dedupingInterval),!y[m]||y[m][1]!==O)return P&&B()&&E().onDiscarded(m),!1;ne.error=oe;const Y=g[m];if(!R(Y)&&(O<=Y[0]||O<=Y[1]||Y[1]===0))return ot(),P&&B()&&E().onDiscarded(m),!1;const te=F().data;ne.data=s(te,j)?te:j,P&&B()&&E().onSuccess(j,m,t)}catch(Y){Me();const te=E(),{shouldRetryOnError:Ie}=te;te.isPaused()||(ne.error=Y,P&&B()&&(te.onError(Y,m,te),(Ie===!0||ge(Ie)&&Ie(Y))&&(!E().revalidateOnFocus||!E().revalidateOnReconnect||H())&&te.onErrorRetry(Y,m,te,We=>{const He=v[m];He&&He[0]&&He[0](Ne.ERROR_REVALIDATE_EVENT,We)},{retryCount:(pe.retryCount||0)+1,dedupe:!0})))}return Q=!1,ot(),!0},[m,r]),it=h.useCallback((...S)=>Ln(r,L.current,...S),[]);if(Ye(()=>{N.current=e,ce.current=t,R(le)||(Be.current=le)}),Ye(()=>{if(!m)return;const S=he.bind(oe,Pn);let T=0;const O=ts(m,v,(Q,pe={})=>{if(Q==Ne.FOCUS_EVENT){const P=Date.now();E().revalidateOnFocus&&P>T&&H()&&(T=P+E().focusThrottleInterval,S())}else if(Q==Ne.RECONNECT_EVENT)E().revalidateOnReconnect&&H()&&S();else{if(Q==Ne.MUTATE_EVENT)return he();if(Q==Ne.ERROR_REVALIDATE_EVENT)return he(pe)}});return D.current=!1,L.current=m,k.current=!0,Z({_k:A}),xe&&(R(X)||nt?S():Mr(S)),()=>{D.current=!0,O()}},[m]),Ye(()=>{let S;function T(){const O=ge(a)?a(F().data):a;O&&S!==-1&&(S=setTimeout(j,O))}function j(){!F().error&&(d||E().isVisible())&&(f||E().isOnline())?he(Pn).then(T):T()}return T(),()=>{S&&(clearTimeout(S),S=-1)}},[a,d,f,m]),h.useDebugValue(Se),i&&R(X)&&m){if(!Yt&&nt)throw new Error("Fallback data is required when using suspense in SSR.");N.current=e,ce.current=t,D.current=!1;const S=x[m];if(!R(S)){const T=it(S);ns(T)}if(R(ve)){const T=he(Pn);R(Se)||(T.status="fulfilled",T.value=!0),ns(T)}else throw ve}return{mutate:it,get data(){return K.data=!0,Se},get error(){return K.error=!0,ve},get isValidating(){return K.isValidating=!0,Qe},get isLoading(){return K.isLoading=!0,st}}},Uo=St.defineProperty(Gr,"defaultValue",{value:Nn}),dt=es(Io),rs=Je.default.use||(n=>{if(n.status==="pending")throw n;if(n.status==="fulfilled")return n.value;throw n.status==="rejected"?n.reason:(n.status="pending",n.then(e=>{n.status="fulfilled",n.value=e},e=>{n.status="rejected",n.reason=e}),n)}),Bn={dedupe:!0},Vo=(n,e,t)=>{const{cache:r,compare:s,suspense:i,fallbackData:o,revalidateOnMount:c,revalidateIfStale:l,refreshInterval:a,refreshWhenHidden:d,refreshWhenOffline:f,keepPreviousData:_}=t,[v,g,y,x]=Oe.get(r),[m,A]=rt(n),k=h.useRef(!1),D=h.useRef(!1),L=h.useRef(m),N=h.useRef(e),ce=h.useRef(t),E=()=>ce.current,H=()=>E().isVisible()&&E().isOnline(),[F,Z,de,q]=Ve(r,m),K=h.useRef({}).current,ye=R(o)?t.fallback[m]:o,be=(S,T)=>{for(const j in K){const O=j;if(O==="data"){if(!s(S[O],T[O])&&(!R(S[O])||!s(Se,T[O])))return!1}else if(T[O]!==S[O])return!1}return!0},$=h.useMemo(()=>{const S=(()=>!m||!e?!1:R(c)?E().isPaused()||i?!1:R(l)?!0:l:c)(),T=B=>{const ne=Le(B);return delete ne._k,S?{isValidating:!0,isLoading:!0,...ne}:ne},j=F(),O=q(),Q=T(j),pe=j===O?Q:T(O);let P=Q;return[()=>{const B=T(F());return be(B,P)?(P.data=B.data,P.isLoading=B.isLoading,P.isValidating=B.isValidating,P.error=B.error,P):(P=B,B)},()=>pe]},[r,m]),ee=zt.exports.useSyncExternalStore(h.useCallback(S=>de(m,(T,j)=>{be(j,T)||S()}),[r,m]),$[0],$[1]),Re=!k.current,Xe=v[m]&&v[m].length>0,le=ee.data,X=R(le)?ye:le,ve=ee.error,Be=h.useRef(X),Se=_?R(le)?Be.current:le:X,xe=(()=>Xe&&!R(ve)?!1:Re&&!R(c)?c:E().isPaused()?!1:i?R(X)?!1:l:R(X)||l)(),je=!!(m&&e&&Re&&xe),Qe=R(ee.isValidating)?je:ee.isValidating,st=R(ee.isLoading)?je:ee.isLoading,he=h.useCallback(async S=>{const T=N.current;if(!m||!T||D.current||E().isPaused())return!1;let j,O,Q=!0;const pe=S||{},P=!y[m]||!pe.dedupe,B=()=>Yt?!D.current&&m===L.current&&k.current:m===L.current,ne={isValidating:!1,isLoading:!1},ot=()=>{Z(ne)},Me=()=>{const Y=y[m];Y&&Y[1]===O&&delete y[m]},at={isValidating:!0};R(F().data)&&(at.isLoading=!0);try{if(P&&(Z(at),t.loadingTimeout&&R(F().data)&&setTimeout(()=>{Q&&B()&&E().onLoadingSlow(m,t)},t.loadingTimeout),y[m]=[T(A),Gt()]),[j,O]=y[m],j=await j,P&&setTimeout(Me,t.dedupingInterval),!y[m]||y[m][1]!==O)return P&&B()&&E().onDiscarded(m),!1;ne.error=oe;const Y=g[m];if(!R(Y)&&(O<=Y[0]||O<=Y[1]||Y[1]===0))return ot(),P&&B()&&E().onDiscarded(m),!1;const te=F().data;ne.data=s(te,j)?te:j,P&&B()&&E().onSuccess(j,m,t)}catch(Y){Me();const te=E(),{shouldRetryOnError:Ie}=te;te.isPaused()||(ne.error=Y,P&&B()&&(te.onError(Y,m,te),(Ie===!0||ge(Ie)&&Ie(Y))&&(!E().revalidateOnFocus||!E().revalidateOnReconnect||H())&&te.onErrorRetry(Y,m,te,We=>{const He=v[m];He&&He[0]&&He[0](Ne.ERROR_REVALIDATE_EVENT,We)},{retryCount:(pe.retryCount||0)+1,dedupe:!0})))}return Q=!1,ot(),!0},[m,r]),it=h.useCallback((...S)=>Ln(r,L.current,...S),[]);if(Ye(()=>{N.current=e,ce.current=t,R(le)||(Be.current=le)}),Ye(()=>{if(!m)return;const S=he.bind(oe,Bn);let T=0;const O=ts(m,v,(Q,pe={})=>{if(Q==Ne.FOCUS_EVENT){const P=Date.now();E().revalidateOnFocus&&P>T&&H()&&(T=P+E().focusThrottleInterval,S())}else if(Q==Ne.RECONNECT_EVENT)E().revalidateOnReconnect&&H()&&S();else{if(Q==Ne.MUTATE_EVENT)return he();if(Q==Ne.ERROR_REVALIDATE_EVENT)return he(pe)}});return D.current=!1,L.current=m,k.current=!0,Z({_k:A}),xe&&(R(X)||nt?S():Mr(S)),()=>{D.current=!0,O()}},[m]),Ye(()=>{let S;function T(){const O=ge(a)?a(F().data):a;O&&S!==-1&&(S=setTimeout(j,O))}function j(){!F().error&&(d||E().isVisible())&&(f||E().isOnline())?he(Bn).then(T):T()}return T(),()=>{S&&(clearTimeout(S),S=-1)}},[a,d,f,m]),h.useDebugValue(Se),i&&R(X)&&m){if(!Yt&&nt)throw new Error("Fallback data is required when using suspense in SSR.");N.current=e,ce.current=t,D.current=!1;const S=x[m];if(!R(S)){const T=it(S);rs(T)}if(R(ve)){const T=he(Bn);R(Se)||(T.status="fulfilled",T.value=!0),rs(T)}else throw ve}return{mutate:it,get data(){return K.data=!0,Se},get error(){return K.error=!0,ve},get isValidating(){return K.isValidating=!0,Qe},get isLoading(){return K.isLoading=!0,st}}};St.defineProperty(Gr,"defaultValue",{value:Nn});const jo=es(Vo),Mo=n=>rt(n?n(0,null):null)[0],In=Promise.resolve(),Wo=Bo(jo,n=>(e,t,r)=>{const s=h.useRef(!1),{cache:i,initialSize:o=1,revalidateAll:c=!1,persistSize:l=!1,revalidateFirstPage:a=!0,revalidateOnMount:d=!1,parallel:f=!1}=r,[,,,_]=Oe.get(Xt);let v;try{v=Mo(e),v&&(v=Xr+v)}catch{}const[g,y,x]=Ve(i,v),m=h.useCallback(()=>R(g()._l)?o:g()._l,[i,v,o]);zt.exports.useSyncExternalStore(h.useCallback(E=>v?x(v,()=>{E()}):()=>{},[i,v]),m,m);const A=h.useCallback(()=>{const E=g()._l;return R(E)?o:E},[v,o]),k=h.useRef(A());Ye(()=>{if(!s.current){s.current=!0;return}v&&y({_l:l?k.current:A()})},[v,i]);const D=d&&!s.current,L=n(v,async E=>{const H=g()._i,F=g()._r;y({_r:oe});const Z=[],de=A(),[q]=Ve(i,E),K=q().data,ye=[];let be=null;for(let $=0;$<de;++$){const[ee,Re]=rt(e($,f?null:be));if(!ee)break;const[Xe,le]=Ve(i,ee);let X=Xe().data;const ve=c||H||R(X)||a&&!$&&!R(K)||D||K&&!R(K[$])&&!r.compare(K[$],X);if(t&&(typeof F=="function"?F(X,Re):ve)){const Be=async()=>{if(!(ee in _))X=await t(Re);else{const xe=_[ee];delete _[ee],X=await xe}le({data:X,_k:Re}),Z[$]=X};f?ye.push(Be):await Be()}else Z[$]=X;f||(be=X)}return f&&await Promise.all(ye.map($=>$())),y({_i:oe}),Z},r),N=h.useCallback(function(E,H){const F=typeof H=="boolean"?{revalidate:H}:H||{},Z=F.revalidate!==!1;return v?(Z&&(R(E)?y({_i:!0,_r:F.revalidate}):y({_i:!1,_r:F.revalidate})),arguments.length?L.mutate(E,{...F,revalidate:Z}):L.mutate()):In},[v,i]),ce=h.useCallback(E=>{if(!v)return In;const[,H]=Ve(i,v);let F;if(ge(E)?F=E(A()):typeof E=="number"&&(F=E),typeof F!="number")return In;H({_l:F}),k.current=F;const Z=[],[de]=Ve(i,v);let q=null;for(let K=0;K<F;++K){const[ye]=rt(e(K,q)),[be]=Ve(i,ye),$=ye?be().data:oe;if(R($))return N(de().data);Z.push($),q=$}return N(Z)},[v,i,N,A]);return{size:A(),setSize:ce,mutate:N,get data(){return L.data},get error(){return L.error},get isValidating(){return L.isValidating},get isLoading(){return L.isLoading}}}),Fe=Object.create(null);Fe.open="0",Fe.close="1",Fe.ping="2",Fe.pong="3",Fe.message="4",Fe.upgrade="5",Fe.noop="6";const Qt=Object.create(null);Object.keys(Fe).forEach(n=>{Qt[Fe[n]]=n});const Un={type:"error",data:"parser error"},ss=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",is=typeof ArrayBuffer=="function",os=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,Vn=({type:n,data:e},t,r)=>ss&&e instanceof Blob?t?r(e):as(e,r):is&&(e instanceof ArrayBuffer||os(e))?t?r(e):as(new Blob([e]),r):r(Fe[n]+(e||"")),as=(n,e)=>{const t=new FileReader;return t.onload=function(){const r=t.result.split(",")[1];e("b"+(r||""))},t.readAsDataURL(n)};function cs(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}let jn;function Ho(n,e){if(ss&&n.data instanceof Blob)return n.data.arrayBuffer().then(cs).then(e);if(is&&(n.data instanceof ArrayBuffer||os(n.data)))return e(cs(n.data));Vn(n,!1,t=>{jn||(jn=new TextEncoder),e(jn.encode(t))})}const us="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ot=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<us.length;n++)Ot[us.charCodeAt(n)]=n;const zo=n=>{let e=n.length*.75,t=n.length,r,s=0,i,o,c,l;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);const a=new ArrayBuffer(e),d=new Uint8Array(a);for(r=0;r<t;r+=4)i=Ot[n.charCodeAt(r)],o=Ot[n.charCodeAt(r+1)],c=Ot[n.charCodeAt(r+2)],l=Ot[n.charCodeAt(r+3)],d[s++]=i<<2|o>>4,d[s++]=(o&15)<<4|c>>2,d[s++]=(c&3)<<6|l&63;return a},Jo=typeof ArrayBuffer=="function",Mn=(n,e)=>{if(typeof n!="string")return{type:"message",data:ls(n,e)};const t=n.charAt(0);return t==="b"?{type:"message",data:Ko(n.substring(1),e)}:Qt[t]?n.length>1?{type:Qt[t],data:n.substring(1)}:{type:Qt[t]}:Un},Ko=(n,e)=>{if(Jo){const t=zo(n);return ls(t,e)}else return{base64:!0,data:n}},ls=(n,e)=>{switch(e){case"blob":return n instanceof Blob?n:new Blob([n]);case"arraybuffer":default:return n instanceof ArrayBuffer?n:n.buffer}},fs=String.fromCharCode(30),qo=(n,e)=>{const t=n.length,r=new Array(t);let s=0;n.forEach((i,o)=>{Vn(i,!1,c=>{r[o]=c,++s===t&&e(r.join(fs))})})},Yo=(n,e)=>{const t=n.split(fs),r=[];for(let s=0;s<t.length;s++){const i=Mn(t[s],e);if(r.push(i),i.type==="error")break}return r};function Go(){return new TransformStream({transform(n,e){Ho(n,t=>{const r=t.length;let s;if(r<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,r);else if(r<65536){s=new Uint8Array(3);const i=new DataView(s.buffer);i.setUint8(0,126),i.setUint16(1,r)}else{s=new Uint8Array(9);const i=new DataView(s.buffer);i.setUint8(0,127),i.setBigUint64(1,BigInt(r))}n.data&&typeof n.data!="string"&&(s[0]|=128),e.enqueue(s),e.enqueue(t)})}})}let Wn;function Zt(n){return n.reduce((e,t)=>e+t.length,0)}function $t(n,e){if(n[0].length===e)return n.shift();const t=new Uint8Array(e);let r=0;for(let s=0;s<e;s++)t[s]=n[0][r++],r===n[0].length&&(n.shift(),r=0);return n.length&&r<n[0].length&&(n[0]=n[0].slice(r)),t}function Xo(n,e){Wn||(Wn=new TextDecoder);const t=[];let r=0,s=-1,i=!1;return new TransformStream({transform(o,c){for(t.push(o);;){if(r===0){if(Zt(t)<1)break;const l=$t(t,1);i=(l[0]&128)===128,s=l[0]&127,s<126?r=3:s===126?r=1:r=2}else if(r===1){if(Zt(t)<2)break;const l=$t(t,2);s=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),r=3}else if(r===2){if(Zt(t)<8)break;const l=$t(t,8),a=new DataView(l.buffer,l.byteOffset,l.length),d=a.getUint32(0);if(d>Math.pow(2,53-32)-1){c.enqueue(Un);break}s=d*Math.pow(2,32)+a.getUint32(4),r=3}else{if(Zt(t)<s)break;const l=$t(t,s);c.enqueue(Mn(i?l:Wn.decode(l),e)),r=0}if(s===0||s>n){c.enqueue(Un);break}}}})}const ds=4;function ae(n){if(n)return Qo(n)}function Qo(n){for(var e in ae.prototype)n[e]=ae.prototype[e];return n}ae.prototype.on=ae.prototype.addEventListener=function(n,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(e),this},ae.prototype.once=function(n,e){function t(){this.off(n,t),e.apply(this,arguments)}return t.fn=e,this.on(n,t),this},ae.prototype.off=ae.prototype.removeListener=ae.prototype.removeAllListeners=ae.prototype.removeEventListener=function(n,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+n];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var r,s=0;s<t.length;s++)if(r=t[s],r===e||r.fn===e){t.splice(s,1);break}return t.length===0&&delete this._callbacks["$"+n],this},ae.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+n],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(t){t=t.slice(0);for(var r=0,s=t.length;r<s;++r)t[r].apply(this,e)}return this},ae.prototype.emitReserved=ae.prototype.emit,ae.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]},ae.prototype.hasListeners=function(n){return!!this.listeners(n).length};const Ee=(()=>typeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function hs(n,...e){return e.reduce((t,r)=>(n.hasOwnProperty(r)&&(t[r]=n[r]),t),{})}const Zo=Ee.setTimeout,$o=Ee.clearTimeout;function en(n,e){e.useNativeTimers?(n.setTimeoutFn=Zo.bind(Ee),n.clearTimeoutFn=$o.bind(Ee)):(n.setTimeoutFn=Ee.setTimeout.bind(Ee),n.clearTimeoutFn=Ee.clearTimeout.bind(Ee))}const ea=1.33;function ta(n){return typeof n=="string"?na(n):Math.ceil((n.byteLength||n.size)*ea)}function na(n){let e=0,t=0;for(let r=0,s=n.length;r<s;r++)e=n.charCodeAt(r),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(r++,t+=4);return t}function ra(n){let e="";for(let t in n)n.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(n[t]));return e}function sa(n){let e={},t=n.split("&");for(let r=0,s=t.length;r<s;r++){let i=t[r].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}class ia extends Error{constructor(e,t,r){super(e),this.description=t,this.context=r,this.type="TransportError"}}class Hn extends ae{constructor(e){super(),this.writable=!1,en(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,r){return super.emitReserved("error",new ia(e,t,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=Mn(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const t=ra(e);return t.length?"?"+t:""}}const ps="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),zn=64,oa={};let ys=0,tn=0,ms;function gs(n){let e="";do e=ps[n%zn]+e,n=Math.floor(n/zn);while(n>0);return e}function vs(){const n=gs(+new Date);return n!==ms?(ys=0,ms=n):n+"."+gs(ys++)}for(;tn<zn;tn++)oa[ps[tn]]=tn;let bs=!1;try{bs=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const aa=bs;function _s(n){const e=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||aa))return new XMLHttpRequest}catch{}if(!e)try{return new Ee[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function vc(){}function ca(){}const ua=function(){return new _s({xdomain:!1}).responseType!=null}();class la extends Hn{constructor(e){if(super(e),this.polling=!1,typeof location<"u"){const r=location.protocol==="https:";let s=location.port;s||(s=r?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||s!==e.port}const t=e&&e.forceBase64;this.supportsBinary=ua&&!t,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||t()})),this.writable||(r++,this.once("drain",function(){--r||t()}))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};Yo(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,qo(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=vs()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Pe(this.uri(),e)}doWrite(e,t){const r=this.request({method:"POST",data:e});r.on("success",t),r.on("error",(s,i)=>{this.onError("xhr post error",s,i)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,r)=>{this.onError("xhr poll error",t,r)}),this.pollXhr=e}}class Pe extends ae{constructor(e,t){super(),en(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.data=t.data!==void 0?t.data:null,this.create()}create(){var e;const t=hs(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd;const r=this.xhr=new _s(t);try{r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let s in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(s)&&r.setRequestHeader(s,this.opts.extraHeaders[s])}}catch{}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(e=this.opts.cookieJar)===null||e===void 0||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var s;r.readyState===3&&((s=this.opts.cookieJar)===null||s===void 0||s.parseCookies(r)),r.readyState===4&&(r.status===200||r.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof r.status=="number"?r.status:0)},0))},r.send(this.data)}catch(s){this.setTimeoutFn(()=>{this.onError(s)},0);return}typeof document<"u"&&(this.index=Pe.requestsCount++,Pe.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=ca,e)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Pe.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}if(Pe.requestsCount=0,Pe.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",ws);else if(typeof addEventListener=="function"){const n="onpagehide"in Ee?"pagehide":"unload";addEventListener(n,ws,!1)}}function ws(){for(let n in Pe.requests)Pe.requests.hasOwnProperty(n)&&Pe.requests[n].abort()}const Jn=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0))(),nn=Ee.WebSocket||Ee.MozWebSocket,Es=!0,fa="arraybuffer",Rs=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class da extends Hn{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,r=Rs?{}:hs(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=Es&&!Rs?t?new nn(e,t):new nn(e):new nn(e,t,r)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const r=e[t],s=t===e.length-1;Vn(r,this.supportsBinary,i=>{const o={};try{Es&&this.ws.send(i)}catch{}s&&Jn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=vs()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!nn}}class ha extends Hn{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(e=>{const t=Xo(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(t).getReader(),s=Go();s.readable.pipeTo(e.writable),this.writer=s.writable.getWriter();const i=()=>{r.read().then(({done:c,value:l})=>{c||(this.onPacket(l),i())}).catch(c=>{})};i();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this.writer.write(o).then(()=>this.onOpen())})}))}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const r=e[t],s=t===e.length-1;this.writer.write(r).then(()=>{s&&Jn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this.transport)===null||e===void 0||e.close()}}const pa={websocket:da,webtransport:ha,polling:la},ya=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,ma=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Kn(n){if(n.length>2e3)throw"URI too long";const e=n,t=n.indexOf("["),r=n.indexOf("]");t!=-1&&r!=-1&&(n=n.substring(0,t)+n.substring(t,r).replace(/:/g,";")+n.substring(r,n.length));let s=ya.exec(n||""),i={},o=14;for(;o--;)i[ma[o]]=s[o]||"";return t!=-1&&r!=-1&&(i.source=e,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=ga(i,i.path),i.queryKey=va(i,i.query),i}function ga(n,e){const t=/\/{2,9}/g,r=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function va(n,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,s,i){s&&(t[s]=i)}),t}class Ge extends ae{constructor(e,t={}){super(),this.binaryType=fa,this.writeBuffer=[],e&&typeof e=="object"&&(t=e,e=null),e?(e=Kn(e),t.hostname=e.host,t.secure=e.protocol==="https"||e.protocol==="wss",t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=Kn(t.host).host),en(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,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},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=sa(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(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"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=ds,t.transport=e,this.id&&(t.sid=this.id);const r=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new pa[e](r)}open(){let e;if(this.opts.rememberUpgrade&&Ge.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch{this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",t=>this.onClose("transport close",t))}probe(e){let t=this.createTransport(e),r=!1;Ge.priorWebsocketSuccess=!1;const s=()=>{r||(t.send([{type:"ping",data:"probe"}]),t.once("packet",f=>{if(!r)if(f.type==="pong"&&f.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;Ge.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(d(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const _=new Error("probe error");_.transport=t.name,this.emitReserved("upgradeError",_)}}))};function i(){r||(r=!0,d(),t.close(),t=null)}const o=f=>{const _=new Error("probe error: "+f);_.transport=t.name,i(),this.emitReserved("upgradeError",_)};function c(){o("transport closed")}function l(){o("socket closed")}function a(f){t&&f.name!==t.name&&i()}const d=()=>{t.removeListener("open",s),t.removeListener("error",o),t.removeListener("close",c),this.off("close",l),this.off("upgrading",a)};t.once("open",s),t.once("error",o),t.once("close",c),this.once("close",l),this.once("upgrading",a),this.upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||t.open()},200):t.open()}onOpen(){if(this.readyState="open",Ge.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let e=0;const t=this.upgrades.length;for(;e<t;e++)this.probe(this.upgrades[e])}}onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),this.resetPingTimeout(),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let r=0;r<this.writeBuffer.length;r++){const s=this.writeBuffer[r].data;if(s&&(t+=ta(s)),r>0&&t>this.maxPayload)return this.writeBuffer.slice(0,r);t+=2}return this.writeBuffer}write(e,t,r){return this.sendPacket("message",e,t,r),this}send(e,t,r){return this.sendPacket("message",e,t,r),this}sendPacket(e,t,r,s){if(typeof t=="function"&&(s=t,t=void 0),typeof r=="function"&&(s=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const i={type:e,data:t,options:r};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),s&&this.once("flush",s),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},r=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}onError(e){Ge.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const t=[];let r=0;const s=e.length;for(;r<s;r++)~this.transports.indexOf(e[r])&&t.push(e[r]);return t}}Ge.protocol=ds;function ba(n,e="",t){let r=n;t=t||typeof location<"u"&&location,n==null&&(n=t.protocol+"//"+t.host),typeof n=="string"&&(n.charAt(0)==="/"&&(n.charAt(1)==="/"?n=t.protocol+n:n=t.host+n),/^(https?|wss?):\/\//.test(n)||(typeof t<"u"?n=t.protocol+"//"+n:n="https://"+n),r=Kn(n)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const i=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+e,r.href=r.protocol+"://"+i+(t&&t.port===r.port?"":":"+r.port),r}const _a=typeof ArrayBuffer=="function",wa=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,Ss=Object.prototype.toString,Ea=typeof Blob=="function"||typeof Blob<"u"&&Ss.call(Blob)==="[object BlobConstructor]",Ra=typeof File=="function"||typeof File<"u"&&Ss.call(File)==="[object FileConstructor]";function qn(n){return _a&&(n instanceof ArrayBuffer||wa(n))||Ea&&n instanceof Blob||Ra&&n instanceof File}function rn(n,e){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let t=0,r=n.length;t<r;t++)if(rn(n[t]))return!0;return!1}if(qn(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return rn(n.toJSON(),!0);for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&rn(n[t]))return!0;return!1}function Sa(n){const e=[],t=n.data,r=n;return r.data=Yn(t,e),r.attachments=e.length,{packet:r,buffers:e}}function Yn(n,e){if(!n)return n;if(qn(n)){const t={_placeholder:!0,num:e.length};return e.push(n),t}else if(Array.isArray(n)){const t=new Array(n.length);for(let r=0;r<n.length;r++)t[r]=Yn(n[r],e);return t}else if(typeof n=="object"&&!(n instanceof Date)){const t={};for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=Yn(n[r],e));return t}return n}function Ta(n,e){return n.data=Gn(n.data,e),delete n.attachments,n}function Gn(n,e){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<e.length)return e[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let t=0;t<n.length;t++)n[t]=Gn(n[t],e);else if(typeof n=="object")for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&(n[t]=Gn(n[t],e));return n}const Oa=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Ca=5;var V;(function(n){n[n.CONNECT=0]="CONNECT",n[n.DISCONNECT=1]="DISCONNECT",n[n.EVENT=2]="EVENT",n[n.ACK=3]="ACK",n[n.CONNECT_ERROR=4]="CONNECT_ERROR",n[n.BINARY_EVENT=5]="BINARY_EVENT",n[n.BINARY_ACK=6]="BINARY_ACK"})(V||(V={}));class xa{constructor(e){this.replacer=e}encode(e){return(e.type===V.EVENT||e.type===V.ACK)&&rn(e)?this.encodeAsBinary({type:e.type===V.EVENT?V.BINARY_EVENT:V.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===V.BINARY_EVENT||e.type===V.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=Sa(e),r=this.encodeAsString(t.packet),s=t.buffers;return s.unshift(r),s}}function Ts(n){return Object.prototype.toString.call(n)==="[object Object]"}class Xn extends ae{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const r=t.type===V.BINARY_EVENT;r||t.type===V.BINARY_ACK?(t.type=r?V.EVENT:V.ACK,this.reconstructor=new Aa(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(qn(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0;const r={type:Number(e.charAt(0))};if(V[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===V.BINARY_EVENT||r.type===V.BINARY_ACK){const i=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);const o=e.substring(i,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");r.attachments=Number(o)}if(e.charAt(t+1)==="/"){const i=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););r.nsp=e.substring(i,t)}else r.nsp="/";const s=e.charAt(t+1);if(s!==""&&Number(s)==s){const i=t+1;for(;++t;){const o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}r.id=Number(e.substring(i,t+1))}if(e.charAt(++t)){const i=this.tryParse(e.substr(t));if(Xn.isPayloadValid(r.type,i))r.data=i;else throw new Error("invalid payload")}return r}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case V.CONNECT:return Ts(t);case V.DISCONNECT:return t===void 0;case V.CONNECT_ERROR:return typeof t=="string"||Ts(t);case V.EVENT:case V.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&Oa.indexOf(t[0])===-1);case V.ACK:case V.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Aa{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=Ta(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Da=Object.freeze(Object.defineProperty({__proto__:null,protocol:Ca,get PacketType(){return V},Encoder:xa,Decoder:Xn},Symbol.toStringTag,{value:"Module"}));function Ce(n,e,t){return n.on(e,t),function(){n.off(e,t)}}const ka=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Os extends ae{constructor(e,t,r){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=e,this.nsp=t,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Ce(e,"open",this.onopen.bind(this)),Ce(e,"packet",this.onpacket.bind(this)),Ce(e,"error",this.onerror.bind(this)),Ce(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){if(ka.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const r={type:V.EVENT,data:t};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const o=this.ids++,c=t.pop();this._registerAckCallback(o,c),r.id=o}const s=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!s||!this.connected)||(this.connected?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r)),this.flags={},this}_registerAckCallback(e,t){var r;const s=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(s===void 0){this.acks[e]=t;return}const i=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===e&&this.sendBuffer.splice(o,1);t.call(this,new Error("operation has timed out"))},s);this.acks[e]=(...o)=>{this.io.clearTimeoutFn(i),t.apply(this,[null,...o])}}emitWithAck(e,...t){const r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((s,i)=>{t.push((o,c)=>r?o?i(o):s(c):s(o)),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((s,...i)=>r!==this._queue[0]?void 0:(s!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(s)):(this._queue.shift(),t&&t(null,...i)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:V.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case V.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.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 V.EVENT:case V.BINARY_EVENT:this.onevent(e);break;case V.ACK:case V.BINARY_ACK:this.onack(e);break;case V.DISCONNECT:this.ondisconnect();break;case V.CONNECT_ERROR:this.destroy();const r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const r of t)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let r=!1;return function(...s){r||(r=!0,t.packet({type:V.ACK,id:e,data:s}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(t.apply(this,e.data),delete this.acks[e.id])}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:V.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const r of t)r.apply(this,e.data)}}}function ht(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}ht.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*n);n=(Math.floor(e*10)&1)==0?n-t:n+t}return Math.min(n,this.max)|0},ht.prototype.reset=function(){this.attempts=0},ht.prototype.setMin=function(n){this.ms=n},ht.prototype.setMax=function(n){this.max=n},ht.prototype.setJitter=function(n){this.jitter=n};class Qn extends ae{constructor(e,t){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,en(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((r=t.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new ht({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const s=t.parser||Da;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Ge(this.uri,this.opts);const t=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const s=Ce(t,"open",function(){r.onopen(),e&&e()}),i=c=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",c),e?e(c):this.maybeReconnectOnOpen()},o=Ce(t,"error",i);if(this._timeout!==!1){const c=this._timeout,l=this.setTimeoutFn(()=>{s(),i(new Error("timeout")),t.close()},c);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(s),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Ce(e,"ping",this.onping.bind(this)),Ce(e,"data",this.ondata.bind(this)),Ce(e,"error",this.onerror.bind(this)),Ce(e,"close",this.onclose.bind(this)),Ce(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){Jn(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new Os(this,e,t),this.nsps[e]=r),r}_destroy(e){const t=Object.keys(this.nsps);for(const r of t)if(this.nsps[r].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let r=0;r<t.length;r++)this.engine.write(t[r],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(s=>{s?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",s)):e.onreconnect()}))},t);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Ct={};function sn(n,e){typeof n=="object"&&(e=n,n=void 0),e=e||{};const t=ba(n,e.path||"/socket.io"),r=t.source,s=t.id,i=t.path,o=Ct[s]&&i in Ct[s].nsps,c=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let l;return c?l=new Qn(r,e):(Ct[s]||(Ct[s]=new Qn(r,e)),l=Ct[s]),t.query&&!e.query&&(e.query=t.queryKey),l.socket(t.path,e)}Object.assign(sn,{Manager:Qn,Socket:Os,io:sn,connect:sn});class La{constructor(e,t,r,s){Ze(this,"socket_port");Ze(this,"host");Ze(this,"port");Ze(this,"protocol");Ze(this,"url");Ze(this,"site_name");Ze(this,"socket");var i,o,c,l;if(this.socket_port=r!=null?r:"9000",this.host=(i=window.location)==null?void 0:i.hostname,this.port=(o=window.location)!=null&&o.port?`:${this.socket_port}`:"",this.protocol=((c=window.location)==null?void 0:c.protocol)==="https:"?"https":"http",e){let a=new URL(e);a.port="",r?(a.port=r,this.url=a.toString()):this.url=a.toString()}else this.url=`${this.protocol}://${this.host}${this.port}/`;t&&(this.url=`${this.url}${t}`),this.site_name=t,this.socket=sn(`${this.url}`,{withCredentials:!0,secure:this.protocol==="https",extraHeaders:s&&s.useToken===!0?{Authorization:`${s.type} ${(l=s.token)==null?void 0:l.call(s)}`}:{}})}}var Cs={exports:{}},xt={};/**
|
|
23
23
|
* @license React
|
|
24
24
|
* react-jsx-runtime.production.min.js
|
|
25
25
|
*
|