openpond 0.2.8 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-server.js +1 -1
- package/dist/chunks/{app-server-runtime-OYF6XBVI.js → app-server-runtime-RBWHBX7T.js} +1 -1
- package/dist/chunks/{chunk-EEBLJPIB.js → chunk-ADMQIREX.js} +1 -1
- package/dist/chunks/{chunk-T2GNPVRY.js → chunk-LFL4M4DL.js} +1 -1
- package/dist/chunks/{chunk-VJBEK64H.js → chunk-RQLWYR5B.js} +1 -1
- package/dist/chunks/{chunk-UW4XDFLU.js → chunk-WDE3KN3N.js} +3 -3
- package/dist/chunks/{cli-MS4KADND.js → cli-3LLBTPP5.js} +1 -1
- package/dist/chunks/{src-S7XTFQ4V.js → src-KNUCNVBC.js} +1 -1
- package/dist/chunks/{workspaces-MJVCPH22.js → workspaces-ZWG55DFE.js} +1 -1
- package/dist/cli.js +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{i as a,j as b,k as c}from"./chunk-
|
|
2
|
+
import{i as a,j as b,k as c}from"./chunk-LFL4M4DL.js";import"./chunk-KRNLKKN6.js";import"./chunk-ADMQIREX.js";import"./chunk-LLJI6QAY.js";import"./chunk-DY5RF2YE.js";import"./chunk-S64WASAO.js";import"./chunk-6MI4KKWF.js";import"./chunk-SDO4FC4Q.js";import"./chunk-IR3YJWPW.js";import"./chunk-J2S7BOZU.js";import"./chunk-UW6ES5DM.js";import"./chunk-6FA3GG5B.js";import"./chunk-NNLI4OWY.js";import"./chunk-HZP5U2AA.js";import"./chunk-ES2ISFJC.js";import"./chunk-H7IWJN7L.js";import"./chunk-FTQLQJQV.js";export{a as resolveWebLaunchMessages,c as runOpenPondAppServerCli,b as runOpenPondServerCli};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
3
|
-
import{a as jA,b as HA,c as OA,d as H,e as DA,f as go,g as z,h as xu,j as BA}from"./chunk-T2GNPVRY.js";import{$ as dx,$a as aT,$b as dh,A as A_,Aa as Fx,Ab as AT,Ac as fo,B as C_,Ba as Ux,Bb as ch,Bc as Mr,C as E_,Ca as uo,Cb as CT,Cc as gh,D as D_,Da as qx,Db as ET,Dc as wA,E as J_,Ea as zx,Eb as MT,Ec as yA,F as G_,Fa as sh,Fb as jT,Fc as Pu,G as K_,Ga as Wx,Gb as HT,Gc as js,H as Y_,Ha as Rc,Hb as OT,Hc as vA,I as X_,Ia as Vx,Ib as DT,Ic as _u,J as Q_,Ja as Es,Jb as BT,Jc as kA,K as Z_,Ka as Jx,Kb as $T,Kc as bA,L as ex,La as Gx,Lb as LT,Lc as SA,M as tx,Ma as Kx,Mb as NT,Mc as IA,N as du,Na as Yx,Nb as FT,Nc as RA,O as nx,Oa as re,Ob as UT,Oc as PA,P as lu,Pa as Xx,Pb as qT,Pc as _A,Q as rx,Qa as Qx,Qb as zT,Qc as xA,R as ox,Ra as wu,Rb as WT,Rc as TA,S as ax,Sa as Zx,Sb as Su,Sc as AA,T as Ps,Ta as eT,Tb as VT,Tc as CA,U as uu,Ua as tT,Ub as ra,Uc as EA,V as kc,Va as nT,Vb as Iu,W as th,Wa as rT,Wb as JT,Wc as MA,X as na,Xa as yu,Xb as mo,Y as sx,Ya as oT,Yb as Ru,Z as ix,Za as po,Zb as GT,_ as cx,_a as xe,_b as KT,a as kS,aa as lx,ab as me,ac as lh,b as bS,ba as ux,bb as sT,bc as YT,c as SS,ca as px,cb as iT,cc as XT,d as IS,da as pu,db as cT,dc as QT,e as RS,ea as mu,eb as dT,ec as ZT,f as _l,fa as _s,fb as lT,fc as uh,g as eI,ga as fu,gb as uT,gc as eA,h as tI,ha as mx,hb as pT,hc as ph,i as nI,ia as fx,ib as mT,ic as tA,j as rI,ja as gx,jb as fT,jc as nA,k as oI,ka as Sc,kb as gT,kc as rA,l as Ag,la as Ax,lb as hT,lc as oA,m as iI,ma as Cx,mb as Ms,mc as aA,n as cI,na as Ex,nb as Bn,nc as sA,o as dI,oa as Mx,ob as Me,oc as iA,p as lI,pa as jx,pb as wT,pc as cA,q as uI,qa as Ic,qb as yT,qc as dA,r as pI,ra as Hx,rb as vT,rc as lA,s as Yo,sa as Ox,sb as kT,sc as mh,t as mI,ta as As,tb as IT,tc as uA,u as fI,ua as Cs,ub as RT,uc as fh,v as Al,va as Dx,vb as bu,vc as pA,w as gI,wa as Bx,wb as PT,wc as mA,x as hI,xa as $x,xb as _T,xc as fA,y as F2,ya as Lx,yb as xT,yc as gA,z as T_,za as Nx,zb as TT,zc as hA}from"./chunk-UW4XDFLU.js";import{A as Sx,C as gu,F as hu,G as ur,H as Ix,I as nh,J as Rx,K as rh,N as Px,O as oh,P as _x,Q as xx,R as Tx,S as ah,T as Ts,b as lr,d as hx,e as wx,h as yx,m as xs,n as vx,p as kx,q as bx,s as bc}from"./chunk-VJBEK64H.js";import{a as ct,b as M_,c as j_,f as H_,s as O_,u as ih,v as bT,w as vu,x as ku,y as ST}from"./chunk-KRNLKKN6.js";import{a as __,b as su,d as ce,e as it,f as Rs,g as ne,i as x_}from"./chunk-EEBLJPIB.js";import{a as an,b as B_,c as $_,d as iu,e as cu,g as L_,h as N_,i as F_,j as U_,k as q_,l as z_,m as W_,n as V_}from"./chunk-LLJI6QAY.js";import{$ as Nl,$a as VR,$b as PP,$c as e_,A as cR,Aa as Ng,B as dR,Ba as qe,Bb as fc,Bc as Yl,Bd as ea,C as lR,Ca as ql,Cb as dP,Cd as c_,D as Bl,Da as CR,Dc as Yg,Dd as Er,E as uR,Ea as Fg,Eb as lP,Ec as qP,Ed as d_,F as Dg,Fb as uP,Fc as zP,Fd as l_,G as pR,Ga as ER,Gb as pP,Gd as u_,H as mR,Hd as co,I as st,Ia as MR,Ib as ys,Ic as Xl,Id as Ss,J as Tt,Jb as mP,Jc as WP,Jd as tu,K as $l,Ka as zl,Kc as Xg,Kd as p_,L as fR,La as jR,Lb as gc,Lc as cr,Ld as m_,M as gR,Mb as Gl,Mc as VP,Md as f_,Na as HR,Nb as fP,Nc as JP,Nd as yc,O as hR,Oa as OR,Ob as zg,Oc as Qg,Od as Is,Pa as DR,Pb as gP,Pc as wc,Pd as nu,Q as wR,Qa as BR,Qb as hP,Qc as GP,Qd as g_,R as yR,Ra as $R,Rb as Wg,Rc as Ql,Rd as ru,S as Dn,Sa as LR,Sb as wP,Sc as KP,Sd as lo,Ta as NR,Tb as yP,Tc as YP,Td as h_,Ua as FR,Ub as vP,Uc as vs,Ud as w_,Va as UR,Vb as kP,Vc as XP,Vd as y_,Wa as io,Wb as bP,Wc as ks,Wd as ou,X as vR,Xb as SP,Xc as QP,Xd as v_,Ya as qR,Yb as IP,Yc as ZP,Yd as vc,Z as Ll,Za as zR,Zb as Vg,Zc as Zg,Zd as k_,_ as Bg,_a as WR,_b as RP,_c as Zl,_d as b_,aa as kR,ac as _P,ad as Oe,bb as JR,bc as xP,bd as eu,c as KI,ca as $g,cb as Wl,cc as Jg,cd as t_,da as bR,db as GR,dc as TP,dd as n_,ea as Bt,eb as KR,ec as AP,ed as r_,fa as Xo,fb as YR,fc as CP,fd as eh,ga as Qo,gb as XR,gc as EP,gd as o_,ha as Lg,hb as QR,hc as MP,hd as a_,he as au,ia as SR,ib as ZR,ic as jP,id as s_,ie as S_,ja as IR,jb as eP,jc as HP,je as I_,ka as RR,kb as tP,kc as OP,kd as bs,ke as dr,l as YI,la as PR,lb as nP,lc as DP,ld as i_,le as R_,m as XI,ma as _R,mb as rP,mc as BP,me as ta,n as QI,na as xR,nb as oP,nc as Gg,ne as P_,o as ZI,oa as Fl,ob as aP,oc as Zo,p as eR,pb as sP,pc as $P,qa as Ul,qb as Ug,qc as LP,rb as Vl,rc as NP,s as tR,sb as iP,t as nR,tb as ir,tc as Kl,u as rR,ub as Cr,uc as FP,v as oR,vb as qg,w as aR,wb as Jl,wc as UP,x as Og,xa as TR,xb as cP,xc as hc,y as sR,yb as $t,yc as Kg,z as iR,za as AR,zb as mc}from"./chunk-DY5RF2YE.js";import"./chunk-XEOEKFG6.js";import{$ as qS,$b as CI,$c as VI,Ac as BI,Bc as Mg,Ca as YS,Cc as $I,Dc as LI,E as AS,Ea as xg,Ec as NI,F as CS,Fa as Ee,Fc as FI,G as ES,Ga as Ko,Gc as so,H as vn,Ha as Qe,Hc as UI,Ib as PI,Ic as sr,Jc as qI,K as MS,Kb as _I,L as Sl,La as XS,Lb as xI,M as jS,N as HS,Nc as zI,O as OS,Oa as uc,Oc as WI,P as DS,Pa as QS,Pc as hs,Qa as Pl,Sa as ZS,T as BS,Ta as Tg,Tb as TI,U as $S,Ua as fs,V as LS,W as NS,Wb as AI,X as FS,Y as Il,Ya as xl,Z as _g,Zc as ws,_ as US,_a as aI,_c as pc,aa as zS,ad as JI,bd as GI,dc as Eg,dd as jg,e as PS,ea as WS,eb as Tl,ec as EI,fb as sI,fd as Hg,ga as ms,gb as wI,hb as Cl,hc as MI,ic as Ml,ja as VS,jc as jl,kb as Cg,kc as jI,la as JS,lb as yI,mb as vI,mc as HI,nb as kI,ob as El,p as _S,pb as bI,q as xS,qb as SI,r as Vt,rb as II,s as kl,sb as RI,ta as On,ua as GS,uc as gs,v as Ar,va as Rl,vc as OI,w as lc,wa as on,wc as DI,x as Pg,xc as Hl,y as bl,yc as Ol,z as TS,za as KS,zc as Dl}from"./chunk-S64WASAO.js";import"./chunk-6MI4KKWF.js";import"./chunk-SDO4FC4Q.js";import"./chunk-IR3YJWPW.js";import{D as ps,E as cc,F as vl,d as yl,m as yS,n as ao,o as Je,p as vS}from"./chunk-O4IARD7H.js";import"./chunk-J2S7BOZU.js";import{Aa as lS,Bb as Ge,Cb as Wt,Ha as uS,Ib as gS,Ka as pS,La as mS,Rb as hS,S as gl,Sa as wl,Tb as wS,Za as fS,a as rn,qa as cS,ra as hl,sa as dS}from"./chunk-UW6ES5DM.js";import{a as dc}from"./chunk-6FA3GG5B.js";import{$a as Go,Ca as nS,Ea as Ig,F as Sg,Fa as Rg,Ga as rS,N as Jb,R as ro,T as Gb,Ta as ml,Ua as oS,V as Kb,W as Yb,X as Xb,Ya as aS,Za as sS,ab as iS,bb as fl,f as sl,k as Vo,l as Lb,m as ic,n as xr,o as ll,p as Nb,pa as oo,q as ul,r as Fb,ra as Jo,s as ds,u as Ub,v as qb,w as zb,wa as Qb,x as Wb,xa as Zb,y as Vb,ya as eS,za as tS}from"./chunk-NNLI4OWY.js";import{a as is,b as cs,c as kg,d as il,e as at,f as bg,g as cl,j as Ve,k as ye,l as O,m as Bb,o as $b,p as dl,q as xt}from"./chunk-HZP5U2AA.js";import{a as Wo,b as _}from"./chunk-ES2ISFJC.js";import{a as Hb,c as zo,f as Ob,h as al,i as Db,p as ls,q as pl,r as Tr,s as us}from"./chunk-H7IWJN7L.js";import{a,b as Re,c as _e,e as ar}from"./chunk-FTQLQJQV.js";var qr=_e((yme,Z0)=>{"use strict";var X0=["nodebuffer","arraybuffer","fragments"],Q0=typeof Blob<"u";Q0&&X0.push("blob");Z0.exports={BINARY_TYPES:X0,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:Q0,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:a(()=>{},"NOOP")}});var Kc=_e((kme,kp)=>{"use strict";var{EMPTY_BUFFER:KG}=qr(),qw=Buffer[Symbol.species];function YG(e,t){if(e.length===0)return KG;if(e.length===1)return e[0];let n=Buffer.allocUnsafe(t),r=0;for(let o=0;o<e.length;o++){let s=e[o];n.set(s,r),r+=s.length}return r<t?new qw(n.buffer,n.byteOffset,r):n}a(YG,"concat");function ej(e,t,n,r,o){for(let s=0;s<o;s++)n[r+s]=e[s]^t[s&3]}a(ej,"_mask");function tj(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}a(tj,"_unmask");function XG(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}a(XG,"toArrayBuffer");function zw(e){if(zw.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new qw(e):ArrayBuffer.isView(e)?t=new qw(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),zw.readOnly=!1),t}a(zw,"toBuffer");kp.exports={concat:YG,mask:ej,toArrayBuffer:XG,toBuffer:zw,unmask:tj};if(!process.env.WS_NO_BUFFER_UTIL)try{let e=Re("bufferutil");kp.exports.mask=function(t,n,r,o,s){s<48?ej(t,n,r,o,s):e.mask(t,n,r,o,s)},kp.exports.unmask=function(t,n){t.length<32?tj(t,n):e.unmask(t,n)}}catch{}});var oj=_e((Sme,rj)=>{"use strict";var nj=Symbol("kDone"),Ww=Symbol("kRun"),Vw=class{static{a(this,"Limiter")}constructor(t){this[nj]=()=>{this.pending--,this[Ww]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[Ww]()}[Ww](){if(this.pending!==this.concurrency&&this.jobs.length){let t=this.jobs.shift();this.pending++,t(this[nj])}}};rj.exports=Vw});var li=_e((Rme,cj)=>{"use strict";var Yc=Re("zlib"),aj=Kc(),QG=oj(),{kStatusCode:sj}=qr(),ZG=Buffer[Symbol.species],e6=Buffer.from([0,0,255,255]),Sp=Symbol("permessage-deflate"),zr=Symbol("total-length"),ci=Symbol("callback"),Ao=Symbol("buffers"),di=Symbol("error"),bp,Jw=class{static{a(this,"PerMessageDeflate")}constructor(t){if(this._options=t||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!bp){let n=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;bp=new QG(n)}}static get extensionName(){return"permessage-deflate"}offer(){let t={};return this._options.serverNoContextTakeover&&(t.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(t.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(t.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?t.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(t.client_max_window_bits=!0),t}accept(t){return t=this.normalizeParams(t),this.params=this._isServer?this.acceptAsServer(t):this.acceptAsClient(t),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let t=this._deflate[ci];this._deflate.close(),this._deflate=null,t&&t(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(t){let n=this._options,r=t.find(o=>!(n.serverNoContextTakeover===!1&&o.server_no_context_takeover||o.server_max_window_bits&&(n.serverMaxWindowBits===!1||typeof n.serverMaxWindowBits=="number"&&n.serverMaxWindowBits>o.server_max_window_bits)||typeof n.clientMaxWindowBits=="number"&&!o.client_max_window_bits));if(!r)throw new Error("None of the extension offers can be accepted");return n.serverNoContextTakeover&&(r.server_no_context_takeover=!0),n.clientNoContextTakeover&&(r.client_no_context_takeover=!0),typeof n.serverMaxWindowBits=="number"&&(r.server_max_window_bits=n.serverMaxWindowBits),typeof n.clientMaxWindowBits=="number"?r.client_max_window_bits=n.clientMaxWindowBits:(r.client_max_window_bits===!0||n.clientMaxWindowBits===!1)&&delete r.client_max_window_bits,r}acceptAsClient(t){let n=t[0];if(this._options.clientNoContextTakeover===!1&&n.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!n.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(n.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&n.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return n}normalizeParams(t){return t.forEach(n=>{Object.keys(n).forEach(r=>{let o=n[r];if(o.length>1)throw new Error(`Parameter "${r}" must have only a single value`);if(o=o[0],r==="client_max_window_bits"){if(o!==!0){let s=+o;if(!Number.isInteger(s)||s<8||s>15)throw new TypeError(`Invalid value for parameter "${r}": ${o}`);o=s}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${r}": ${o}`)}else if(r==="server_max_window_bits"){let s=+o;if(!Number.isInteger(s)||s<8||s>15)throw new TypeError(`Invalid value for parameter "${r}": ${o}`);o=s}else if(r==="client_no_context_takeover"||r==="server_no_context_takeover"){if(o!==!0)throw new TypeError(`Invalid value for parameter "${r}": ${o}`)}else throw new Error(`Unknown parameter "${r}"`);n[r]=o})}),t}decompress(t,n,r){bp.add(o=>{this._decompress(t,n,(s,i)=>{o(),r(s,i)})})}compress(t,n,r){bp.add(o=>{this._compress(t,n,(s,i)=>{o(),r(s,i)})})}_decompress(t,n,r){let o=this._isServer?"client":"server";if(!this._inflate){let s=`${o}_max_window_bits`,i=typeof this.params[s]!="number"?Yc.Z_DEFAULT_WINDOWBITS:this.params[s];this._inflate=Yc.createInflateRaw({...this._options.zlibInflateOptions,windowBits:i}),this._inflate[Sp]=this,this._inflate[zr]=0,this._inflate[Ao]=[],this._inflate.on("error",n6),this._inflate.on("data",ij)}this._inflate[ci]=r,this._inflate.write(t),n&&this._inflate.write(e6),this._inflate.flush(()=>{let s=this._inflate[di];if(s){this._inflate.close(),this._inflate=null,r(s);return}let i=aj.concat(this._inflate[Ao],this._inflate[zr]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[zr]=0,this._inflate[Ao]=[],n&&this.params[`${o}_no_context_takeover`]&&this._inflate.reset()),r(null,i)})}_compress(t,n,r){let o=this._isServer?"server":"client";if(!this._deflate){let s=`${o}_max_window_bits`,i=typeof this.params[s]!="number"?Yc.Z_DEFAULT_WINDOWBITS:this.params[s];this._deflate=Yc.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:i}),this._deflate[zr]=0,this._deflate[Ao]=[],this._deflate.on("data",t6)}this._deflate[ci]=r,this._deflate.write(t),this._deflate.flush(Yc.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let s=aj.concat(this._deflate[Ao],this._deflate[zr]);n&&(s=new ZG(s.buffer,s.byteOffset,s.length-4)),this._deflate[ci]=null,this._deflate[zr]=0,this._deflate[Ao]=[],n&&this.params[`${o}_no_context_takeover`]&&this._deflate.reset(),r(null,s)})}};cj.exports=Jw;function t6(e){this[Ao].push(e),this[zr]+=e.length}a(t6,"deflateOnData");function ij(e){if(this[zr]+=e.length,this[Sp]._maxPayload<1||this[zr]<=this[Sp]._maxPayload){this[Ao].push(e);return}this[di]=new RangeError("Max payload size exceeded"),this[di].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[di][sj]=1009,this.removeListener("data",ij),this.reset()}a(ij,"inflateOnData");function n6(e){if(this[Sp]._inflate=null,this[di]){this[ci](this[di]);return}e[sj]=1007,this[ci](e)}a(n6,"inflateOnError")});var ui=_e((_me,Ip)=>{"use strict";var{isUtf8:dj}=Re("buffer"),{hasBlob:r6}=qr(),o6=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function a6(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}a(a6,"isValidStatusCode");function Gw(e){let t=e.length,n=0;for(;n<t;)if((e[n]&128)===0)n++;else if((e[n]&224)===192){if(n+1===t||(e[n+1]&192)!==128||(e[n]&254)===192)return!1;n+=2}else if((e[n]&240)===224){if(n+2>=t||(e[n+1]&192)!==128||(e[n+2]&192)!==128||e[n]===224&&(e[n+1]&224)===128||e[n]===237&&(e[n+1]&224)===160)return!1;n+=3}else if((e[n]&248)===240){if(n+3>=t||(e[n+1]&192)!==128||(e[n+2]&192)!==128||(e[n+3]&192)!==128||e[n]===240&&(e[n+1]&240)===128||e[n]===244&&e[n+1]>143||e[n]>244)return!1;n+=4}else return!1;return!0}a(Gw,"_isValidUTF8");function s6(e){return r6&&typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}a(s6,"isBlob");Ip.exports={isBlob:s6,isValidStatusCode:a6,isValidUTF8:Gw,tokenChars:o6};if(dj)Ip.exports.isValidUTF8=function(e){return e.length<24?Gw(e):dj(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=Re("utf-8-validate");Ip.exports.isValidUTF8=function(t){return t.length<32?Gw(t):e(t)}}catch{}});var Zw=_e((Tme,hj)=>{"use strict";var{Writable:i6}=Re("stream"),lj=li(),{BINARY_TYPES:c6,EMPTY_BUFFER:uj,kStatusCode:d6,kWebSocket:l6}=qr(),{concat:Kw,toArrayBuffer:u6,unmask:p6}=Kc(),{isValidStatusCode:m6,isValidUTF8:pj}=ui(),Rp=Buffer[Symbol.species],xn=0,mj=1,fj=2,gj=3,Yw=4,Xw=5,Pp=6,Qw=class extends i6{static{a(this,"Receiver")}constructor(t={}){super(),this._allowSynchronousEvents=t.allowSynchronousEvents!==void 0?t.allowSynchronousEvents:!0,this._binaryType=t.binaryType||c6[0],this._extensions=t.extensions||{},this._isServer=!!t.isServer,this._maxBufferedChunks=t.maxBufferedChunks|0,this._maxFragments=t.maxFragments|0,this._maxPayload=t.maxPayload|0,this._skipUTF8Validation=!!t.skipUTF8Validation,this[l6]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._numFragments=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=xn}_write(t,n,r){if(this._opcode===8&&this._state==xn)return r();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){r(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));return}this._bufferedBytes+=t.length,this._buffers.push(t),this.startLoop(r)}consume(t){if(this._bufferedBytes-=t,t===this._buffers[0].length)return this._buffers.shift();if(t<this._buffers[0].length){let r=this._buffers[0];return this._buffers[0]=new Rp(r.buffer,r.byteOffset+t,r.length-t),new Rp(r.buffer,r.byteOffset,t)}let n=Buffer.allocUnsafe(t);do{let r=this._buffers[0],o=n.length-t;t>=r.length?n.set(this._buffers.shift(),o):(n.set(new Uint8Array(r.buffer,r.byteOffset,t),o),this._buffers[0]=new Rp(r.buffer,r.byteOffset+t,r.length-t)),t-=r.length}while(t>0);return n}startLoop(t){this._loop=!0;do switch(this._state){case xn:this.getInfo(t);break;case mj:this.getPayloadLength16(t);break;case fj:this.getPayloadLength64(t);break;case gj:this.getMask();break;case Yw:this.getData(t);break;case Xw:case Pp:this._loop=!1;return}while(this._loop);this._errored||t()}getInfo(t){if(this._bufferedBytes<2){this._loop=!1;return}let n=this.consume(2);if((n[0]&48)!==0){let o=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");t(o);return}let r=(n[0]&64)===64;if(r&&!this._extensions[lj.extensionName]){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(o);return}if(this._fin=(n[0]&128)===128,this._opcode=n[0]&15,this._payloadLength=n[1]&127,this._opcode===0){if(r){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(o);return}if(!this._fragmented){let o=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");t(o);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let o=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(o);return}this._compressed=r}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let o=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");t(o);return}if(r){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(o);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let o=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");t(o);return}}else{let o=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(o);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(n[1]&128)===128,this._isServer){if(!this._masked){let o=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");t(o);return}}else if(this._masked){let o=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");t(o);return}this._payloadLength===126?this._state=mj:this._payloadLength===127?this._state=fj:this.haveLength(t)}getPayloadLength16(t){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(t)}getPayloadLength64(t){if(this._bufferedBytes<8){this._loop=!1;return}let n=this.consume(8),r=n.readUInt32BE(0);if(r>Math.pow(2,21)-1){let o=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");t(o);return}this._payloadLength=r*Math.pow(2,32)+n.readUInt32BE(4),this.haveLength(t)}haveLength(t){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let n=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");t(n);return}this._masked?this._state=gj:this._state=Yw}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Yw}getData(t){let n=uj;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}n=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&p6(n,this._mask)}if(this._opcode>7){this.controlMessage(n,t);return}if(this._maxFragments>0&&++this._numFragments>this._maxFragments){let r=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");t(r);return}if(this._compressed){this._state=Xw,this.decompress(n,t);return}n.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(n)),this.dataMessage(t)}decompress(t,n){this._extensions[lj.extensionName].decompress(t,this._fin,(o,s)=>{if(o)return n(o);if(s.length){if(this._messageLength+=s.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let i=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");n(i);return}this._fragments.push(s)}this.dataMessage(n),this._state===xn&&this.startLoop(n)})}dataMessage(t){if(!this._fin){this._state=xn;return}let n=this._messageLength,r=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._numFragments=0,this._fragments=[],this._opcode===2){let o;this._binaryType==="nodebuffer"?o=Kw(r,n):this._binaryType==="arraybuffer"?o=u6(Kw(r,n)):this._binaryType==="blob"?o=new Blob(r):o=r,this._allowSynchronousEvents?(this.emit("message",o,!0),this._state=xn):(this._state=Pp,setImmediate(()=>{this.emit("message",o,!0),this._state=xn,this.startLoop(t)}))}else{let o=Kw(r,n);if(!this._skipUTF8Validation&&!pj(o)){let s=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(s);return}this._state===Xw||this._allowSynchronousEvents?(this.emit("message",o,!1),this._state=xn):(this._state=Pp,setImmediate(()=>{this.emit("message",o,!1),this._state=xn,this.startLoop(t)}))}}controlMessage(t,n){if(this._opcode===8){if(t.length===0)this._loop=!1,this.emit("conclude",1005,uj),this.end();else{let r=t.readUInt16BE(0);if(!m6(r)){let s=this.createError(RangeError,`invalid status code ${r}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");n(s);return}let o=new Rp(t.buffer,t.byteOffset+2,t.length-2);if(!this._skipUTF8Validation&&!pj(o)){let s=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");n(s);return}this._loop=!1,this.emit("conclude",r,o),this.end()}this._state=xn;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",t),this._state=xn):(this._state=Pp,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",t),this._state=xn,this.startLoop(n)}))}createError(t,n,r,o,s){this._loop=!1,this._errored=!0;let i=new t(r?`Invalid WebSocket frame: ${n}`:n);return Error.captureStackTrace(i,this.createError),i.code=s,i[d6]=o,i}};hj.exports=Qw});var ny=_e((Eme,vj)=>{"use strict";var{Duplex:Cme}=Re("stream"),{randomFillSync:f6}=Re("crypto"),{types:{isUint8Array:g6}}=Re("util"),wj=li(),{EMPTY_BUFFER:h6,kWebSocket:w6,NOOP:y6}=qr(),{isBlob:pi,isValidStatusCode:v6}=ui(),{mask:yj,toBuffer:fa}=Kc(),Tn=Symbol("kByteLength"),k6=Buffer.alloc(4),_p=8*1024,ga,mi=_p,Fn=0,b6=1,S6=2,ey=class e{static{a(this,"Sender")}constructor(t,n,r){this._extensions=n||{},r&&(this._generateMask=r,this._maskBuffer=Buffer.alloc(4)),this._socket=t,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=Fn,this.onerror=y6,this[w6]=void 0}static frame(t,n){let r,o=!1,s=2,i=!1;n.mask&&(r=n.maskBuffer||k6,n.generateMask?n.generateMask(r):(mi===_p&&(ga===void 0&&(ga=Buffer.alloc(_p)),f6(ga,0,_p),mi=0),r[0]=ga[mi++],r[1]=ga[mi++],r[2]=ga[mi++],r[3]=ga[mi++]),i=(r[0]|r[1]|r[2]|r[3])===0,s=6);let c;typeof t=="string"?(!n.mask||i)&&n[Tn]!==void 0?c=n[Tn]:(t=Buffer.from(t),c=t.length):(c=t.length,o=n.mask&&n.readOnly&&!i);let d=c;c>=65536?(s+=8,d=127):c>125&&(s+=2,d=126);let l=Buffer.allocUnsafe(o?c+s:s);return l[0]=n.fin?n.opcode|128:n.opcode,n.rsv1&&(l[0]|=64),l[1]=d,d===126?l.writeUInt16BE(c,2):d===127&&(l[2]=l[3]=0,l.writeUIntBE(c,4,6)),n.mask?(l[1]|=128,l[s-4]=r[0],l[s-3]=r[1],l[s-2]=r[2],l[s-1]=r[3],i?[l,t]:o?(yj(t,r,l,s,c),[l]):(yj(t,r,t,0,c),[l,t])):[l,t]}close(t,n,r,o){let s;if(t===void 0)s=h6;else{if(typeof t!="number"||!v6(t))throw new TypeError("First argument must be a valid error code number");if(n===void 0||!n.length)s=Buffer.allocUnsafe(2),s.writeUInt16BE(t,0);else{let c=Buffer.byteLength(n);if(c>123)throw new RangeError("The message must not be greater than 123 bytes");if(s=Buffer.allocUnsafe(2+c),s.writeUInt16BE(t,0),typeof n=="string")s.write(n,2);else if(g6(n))s.set(n,2);else throw new TypeError("Second argument must be a string or a Uint8Array")}}let i={[Tn]:s.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==Fn?this.enqueue([this.dispatch,s,!1,i,o]):this.sendFrame(e.frame(s,i),o)}ping(t,n,r){let o,s;if(typeof t=="string"?(o=Buffer.byteLength(t),s=!1):pi(t)?(o=t.size,s=!1):(t=fa(t),o=t.length,s=fa.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let i={[Tn]:o,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:9,readOnly:s,rsv1:!1};pi(t)?this._state!==Fn?this.enqueue([this.getBlobData,t,!1,i,r]):this.getBlobData(t,!1,i,r):this._state!==Fn?this.enqueue([this.dispatch,t,!1,i,r]):this.sendFrame(e.frame(t,i),r)}pong(t,n,r){let o,s;if(typeof t=="string"?(o=Buffer.byteLength(t),s=!1):pi(t)?(o=t.size,s=!1):(t=fa(t),o=t.length,s=fa.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let i={[Tn]:o,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:10,readOnly:s,rsv1:!1};pi(t)?this._state!==Fn?this.enqueue([this.getBlobData,t,!1,i,r]):this.getBlobData(t,!1,i,r):this._state!==Fn?this.enqueue([this.dispatch,t,!1,i,r]):this.sendFrame(e.frame(t,i),r)}send(t,n,r){let o=this._extensions[wj.extensionName],s=n.binary?2:1,i=n.compress,c,d;typeof t=="string"?(c=Buffer.byteLength(t),d=!1):pi(t)?(c=t.size,d=!1):(t=fa(t),c=t.length,d=fa.readOnly),this._firstFragment?(this._firstFragment=!1,i&&o&&o.params[o._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(i=c>=o._threshold),this._compress=i):(i=!1,s=0),n.fin&&(this._firstFragment=!0);let l={[Tn]:c,fin:n.fin,generateMask:this._generateMask,mask:n.mask,maskBuffer:this._maskBuffer,opcode:s,readOnly:d,rsv1:i};pi(t)?this._state!==Fn?this.enqueue([this.getBlobData,t,this._compress,l,r]):this.getBlobData(t,this._compress,l,r):this._state!==Fn?this.enqueue([this.dispatch,t,this._compress,l,r]):this.dispatch(t,this._compress,l,r)}getBlobData(t,n,r,o){this._bufferedBytes+=r[Tn],this._state=S6,t.arrayBuffer().then(s=>{if(this._socket.destroyed){let c=new Error("The socket was closed while the blob was being read");process.nextTick(ty,this,c,o);return}this._bufferedBytes-=r[Tn];let i=fa(s);n?this.dispatch(i,n,r,o):(this._state=Fn,this.sendFrame(e.frame(i,r),o),this.dequeue())}).catch(s=>{process.nextTick(I6,this,s,o)})}dispatch(t,n,r,o){if(!n){this.sendFrame(e.frame(t,r),o);return}let s=this._extensions[wj.extensionName];this._bufferedBytes+=r[Tn],this._state=b6,s.compress(t,r.fin,(i,c)=>{if(this._socket.destroyed){let d=new Error("The socket was closed while data was being compressed");ty(this,d,o);return}this._bufferedBytes-=r[Tn],this._state=Fn,r.readOnly=!1,this.sendFrame(e.frame(c,r),o),this.dequeue()})}dequeue(){for(;this._state===Fn&&this._queue.length;){let t=this._queue.shift();this._bufferedBytes-=t[3][Tn],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][Tn],this._queue.push(t)}sendFrame(t,n){t.length===2?(this._socket.cork(),this._socket.write(t[0]),this._socket.write(t[1],n),this._socket.uncork()):this._socket.write(t[0],n)}};vj.exports=ey;function ty(e,t,n){typeof n=="function"&&n(t);for(let r=0;r<e._queue.length;r++){let o=e._queue[r],s=o[o.length-1];typeof s=="function"&&s(t)}}a(ty,"callCallbacks");function I6(e,t,n){ty(e,t,n),e.onerror(t)}a(I6,"onError")});var Tj=_e((jme,xj)=>{"use strict";var{kForOnEventAttribute:Xc,kListener:ry}=qr(),kj=Symbol("kCode"),bj=Symbol("kData"),Sj=Symbol("kError"),Ij=Symbol("kMessage"),Rj=Symbol("kReason"),fi=Symbol("kTarget"),Pj=Symbol("kType"),_j=Symbol("kWasClean"),Wr=class{static{a(this,"Event")}constructor(t){this[fi]=null,this[Pj]=t}get target(){return this[fi]}get type(){return this[Pj]}};Object.defineProperty(Wr.prototype,"target",{enumerable:!0});Object.defineProperty(Wr.prototype,"type",{enumerable:!0});var ha=class extends Wr{static{a(this,"CloseEvent")}constructor(t,n={}){super(t),this[kj]=n.code===void 0?0:n.code,this[Rj]=n.reason===void 0?"":n.reason,this[_j]=n.wasClean===void 0?!1:n.wasClean}get code(){return this[kj]}get reason(){return this[Rj]}get wasClean(){return this[_j]}};Object.defineProperty(ha.prototype,"code",{enumerable:!0});Object.defineProperty(ha.prototype,"reason",{enumerable:!0});Object.defineProperty(ha.prototype,"wasClean",{enumerable:!0});var gi=class extends Wr{static{a(this,"ErrorEvent")}constructor(t,n={}){super(t),this[Sj]=n.error===void 0?null:n.error,this[Ij]=n.message===void 0?"":n.message}get error(){return this[Sj]}get message(){return this[Ij]}};Object.defineProperty(gi.prototype,"error",{enumerable:!0});Object.defineProperty(gi.prototype,"message",{enumerable:!0});var Qc=class extends Wr{static{a(this,"MessageEvent")}constructor(t,n={}){super(t),this[bj]=n.data===void 0?null:n.data}get data(){return this[bj]}};Object.defineProperty(Qc.prototype,"data",{enumerable:!0});var R6={addEventListener(e,t,n={}){for(let o of this.listeners(e))if(!n[Xc]&&o[ry]===t&&!o[Xc])return;let r;if(e==="message")r=a(function(s,i){let c=new Qc("message",{data:i?s:s.toString()});c[fi]=this,xp(t,this,c)},"onMessage");else if(e==="close")r=a(function(s,i){let c=new ha("close",{code:s,reason:i.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});c[fi]=this,xp(t,this,c)},"onClose");else if(e==="error")r=a(function(s){let i=new gi("error",{error:s,message:s.message});i[fi]=this,xp(t,this,i)},"onError");else if(e==="open")r=a(function(){let s=new Wr("open");s[fi]=this,xp(t,this,s)},"onOpen");else return;r[Xc]=!!n[Xc],r[ry]=t,n.once?this.once(e,r):this.on(e,r)},removeEventListener(e,t){for(let n of this.listeners(e))if(n[ry]===t&&!n[Xc]){this.removeListener(e,n);break}}};xj.exports={CloseEvent:ha,ErrorEvent:gi,Event:Wr,EventTarget:R6,MessageEvent:Qc};function xp(e,t,n){typeof e=="object"&&e.handleEvent?e.handleEvent.call(e,n):e.call(t,n)}a(xp,"callListener")});var Tp=_e((Ome,Aj)=>{"use strict";var{tokenChars:Zc}=ui();function hr(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}a(hr,"push");function P6(e){let t=Object.create(null),n=Object.create(null),r=!1,o=!1,s=!1,i,c,d=-1,l=-1,u=-1,p=0;for(;p<e.length;p++)if(l=e.charCodeAt(p),i===void 0)if(u===-1&&Zc[l]===1)d===-1&&(d=p);else if(p!==0&&(l===32||l===9))u===-1&&d!==-1&&(u=p);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${p}`);u===-1&&(u=p);let f=e.slice(d,u);l===44?(hr(t,f,n),n=Object.create(null)):i=f,d=u=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);else if(c===void 0)if(u===-1&&Zc[l]===1)d===-1&&(d=p);else if(l===32||l===9)u===-1&&d!==-1&&(u=p);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${p}`);u===-1&&(u=p),hr(n,e.slice(d,u),!0),l===44&&(hr(t,i,n),n=Object.create(null),i=void 0),d=u=-1}else if(l===61&&d!==-1&&u===-1)c=e.slice(d,p),d=u=-1;else throw new SyntaxError(`Unexpected character at index ${p}`);else if(o){if(Zc[l]!==1)throw new SyntaxError(`Unexpected character at index ${p}`);d===-1?d=p:r||(r=!0),o=!1}else if(s)if(Zc[l]===1)d===-1&&(d=p);else if(l===34&&d!==-1)s=!1,u=p;else if(l===92)o=!0;else throw new SyntaxError(`Unexpected character at index ${p}`);else if(l===34&&e.charCodeAt(p-1)===61)s=!0;else if(u===-1&&Zc[l]===1)d===-1&&(d=p);else if(d!==-1&&(l===32||l===9))u===-1&&(u=p);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${p}`);u===-1&&(u=p);let f=e.slice(d,u);r&&(f=f.replace(/\\/g,""),r=!1),hr(n,c,f),l===44&&(hr(t,i,n),n=Object.create(null),i=void 0),c=void 0,d=u=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);if(d===-1||s||l===32||l===9)throw new SyntaxError("Unexpected end of input");u===-1&&(u=p);let m=e.slice(d,u);return i===void 0?hr(t,m,n):(c===void 0?hr(n,m,!0):r?hr(n,c,m.replace(/\\/g,"")):hr(n,c,m),hr(t,i,n)),t}a(P6,"parse");function _6(e){return Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(r=>[t].concat(Object.keys(r).map(o=>{let s=r[o];return Array.isArray(s)||(s=[s]),s.map(i=>i===!0?o:`${o}=${i}`).join("; ")})).join("; ")).join(", ")}).join(", ")}a(_6,"format");Aj.exports={format:_6,parse:P6}});var Mp=_e((Lme,Fj)=>{"use strict";var x6=Re("events"),T6=Re("https"),A6=Re("http"),Mj=Re("net"),C6=Re("tls"),{randomBytes:E6,createHash:M6}=Re("crypto"),{Duplex:Bme,Readable:$me}=Re("stream"),{URL:oy}=Re("url"),Co=li(),j6=Zw(),H6=ny(),{isBlob:O6}=ui(),{BINARY_TYPES:Cj,CLOSE_TIMEOUT:D6,EMPTY_BUFFER:Ap,GUID:B6,kForOnEventAttribute:ay,kListener:$6,kStatusCode:L6,kWebSocket:pt,NOOP:jj}=qr(),{EventTarget:{addEventListener:N6,removeEventListener:F6}}=Tj(),{format:U6,parse:q6}=Tp(),{toBuffer:z6}=Kc(),Hj=Symbol("kAborted"),sy=[8,13],Vr=["CONNECTING","OPEN","CLOSING","CLOSED"],W6=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,ze=class e extends x6{static{a(this,"WebSocket")}constructor(t,n,r){super(),this._binaryType=Cj[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Ap,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,n===void 0?n=[]:Array.isArray(n)||(typeof n=="object"&&n!==null?(r=n,n=[]):n=[n]),Oj(this,t,n,r)):(this._autoPong=r.autoPong,this._closeTimeout=r.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(t){Cj.includes(t)&&(this._binaryType=t,this._receiver&&(this._receiver._binaryType=t))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,n,r){let o=new j6({allowSynchronousEvents:r.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:r.maxBufferedChunks,maxFragments:r.maxFragments,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation}),s=new H6(t,this._extensions,r.generateMask);this._receiver=o,this._sender=s,this._socket=t,o[pt]=this,s[pt]=this,t[pt]=this,o.on("conclude",G6),o.on("drain",K6),o.on("error",Y6),o.on("message",X6),o.on("ping",Q6),o.on("pong",Z6),s.onerror=e5,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),n.length>0&&t.unshift(n),t.on("close",$j),t.on("data",Ep),t.on("end",Lj),t.on("error",Nj),this._readyState=e.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[Co.extensionName]&&this._extensions[Co.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(t,n){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){dn(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=e.CLOSING,this._sender.close(t,n,!this._isServer,r=>{r||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Bj(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,n,r){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(r=t,t=n=void 0):typeof n=="function"&&(r=n,n=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){iy(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.ping(t||Ap,n,r)}pong(t,n,r){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(r=t,t=n=void 0):typeof n=="function"&&(r=n,n=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){iy(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.pong(t||Ap,n,r)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,n,r){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof n=="function"&&(r=n,n={}),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){iy(this,t,r);return}let o={binary:typeof t!="string",mask:!this._isServer,compress:!0,fin:!0,...n};this._extensions[Co.extensionName]||(o.compress=!1),this._sender.send(t||Ap,o,r)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){dn(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(ze,"CONNECTING",{enumerable:!0,value:Vr.indexOf("CONNECTING")});Object.defineProperty(ze.prototype,"CONNECTING",{enumerable:!0,value:Vr.indexOf("CONNECTING")});Object.defineProperty(ze,"OPEN",{enumerable:!0,value:Vr.indexOf("OPEN")});Object.defineProperty(ze.prototype,"OPEN",{enumerable:!0,value:Vr.indexOf("OPEN")});Object.defineProperty(ze,"CLOSING",{enumerable:!0,value:Vr.indexOf("CLOSING")});Object.defineProperty(ze.prototype,"CLOSING",{enumerable:!0,value:Vr.indexOf("CLOSING")});Object.defineProperty(ze,"CLOSED",{enumerable:!0,value:Vr.indexOf("CLOSED")});Object.defineProperty(ze.prototype,"CLOSED",{enumerable:!0,value:Vr.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(ze.prototype,e,{enumerable:!0})});["open","error","close","message"].forEach(e=>{Object.defineProperty(ze.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[ay])return t[$6];return null},set(t){for(let n of this.listeners(e))if(n[ay]){this.removeListener(e,n);break}typeof t=="function"&&this.addEventListener(e,t,{[ay]:!0})}})});ze.prototype.addEventListener=N6;ze.prototype.removeEventListener=F6;Fj.exports=ze;function Oj(e,t,n,r){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:D6,protocolVersion:sy[1],maxBufferedChunks:262144,maxFragments:16384,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...r,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(e._autoPong=o.autoPong,e._closeTimeout=o.closeTimeout,!sy.includes(o.protocolVersion))throw new RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${sy.join(", ")})`);let s;if(t instanceof oy)s=t;else try{s=new oy(t)}catch{throw new SyntaxError(`Invalid URL: ${t}`)}s.protocol==="http:"?s.protocol="ws:":s.protocol==="https:"&&(s.protocol="wss:"),e._url=s.href;let i=s.protocol==="wss:",c=s.protocol==="ws+unix:",d;if(s.protocol!=="ws:"&&!i&&!c?d=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:c&&!s.pathname?d="The URL's pathname is empty":s.hash&&(d="The URL contains a fragment identifier"),d){let h=new SyntaxError(d);if(e._redirects===0)throw h;Cp(e,h);return}let l=i?443:80,u=E6(16).toString("base64"),p=i?T6.request:A6.request,m=new Set,f;if(o.createConnection=o.createConnection||(i?J6:V6),o.defaultPort=o.defaultPort||l,o.port=s.port||l,o.host=s.hostname.startsWith("[")?s.hostname.slice(1,-1):s.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":u,Connection:"Upgrade",Upgrade:"websocket"},o.path=s.pathname+s.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(f=new Co({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers["Sec-WebSocket-Extensions"]=U6({[Co.extensionName]:f.offer()})),n.length){for(let h of n){if(typeof h!="string"||!W6.test(h)||m.has(h))throw new SyntaxError("An invalid or duplicated subprotocol was specified");m.add(h)}o.headers["Sec-WebSocket-Protocol"]=n.join(",")}if(o.origin&&(o.protocolVersion<13?o.headers["Sec-WebSocket-Origin"]=o.origin:o.headers.Origin=o.origin),(s.username||s.password)&&(o.auth=`${s.username}:${s.password}`),c){let h=o.path.split(":");o.socketPath=h[0],o.path=h[1]}let y;if(o.followRedirects){if(e._redirects===0){e._originalIpc=c,e._originalSecure=i,e._originalHostOrSocketPath=c?o.socketPath:s.host;let h=r&&r.headers;if(r={...r,headers:{}},h)for(let[v,g]of Object.entries(h))r.headers[v.toLowerCase()]=g}else if(e.listenerCount("redirect")===0){let h=c?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:s.host===e._originalHostOrSocketPath;(!h||e._originalSecure&&!i)&&(delete o.headers.authorization,delete o.headers.cookie,h||delete o.headers.host,o.auth=void 0)}o.auth&&!r.headers.authorization&&(r.headers.authorization="Basic "+Buffer.from(o.auth).toString("base64")),y=e._req=p(o),e._redirects&&e.emit("redirect",e.url,y)}else y=e._req=p(o);o.timeout&&y.on("timeout",()=>{dn(e,y,"Opening handshake has timed out")}),y.on("error",h=>{y===null||y[Hj]||(y=e._req=null,Cp(e,h))}),y.on("response",h=>{let v=h.headers.location,g=h.statusCode;if(v&&o.followRedirects&&g>=300&&g<400){if(++e._redirects>o.maxRedirects){dn(e,y,"Maximum redirects exceeded");return}y.abort();let b;try{b=new oy(v,t)}catch{let k=new SyntaxError(`Invalid URL: ${v}`);Cp(e,k);return}Oj(e,b,n,r)}else e.emit("unexpected-response",y,h)||dn(e,y,`Unexpected server response: ${h.statusCode}`)}),y.on("upgrade",(h,v,g)=>{if(e.emit("upgrade",h),e.readyState!==ze.CONNECTING)return;y=e._req=null;let b=h.headers.upgrade;if(b===void 0||b.toLowerCase()!=="websocket"){dn(e,v,"Invalid Upgrade header");return}let S=M6("sha1").update(u+B6).digest("base64");if(h.headers["sec-websocket-accept"]!==S){dn(e,v,"Invalid Sec-WebSocket-Accept header");return}let k=h.headers["sec-websocket-protocol"],w;if(k!==void 0?m.size?m.has(k)||(w="Server sent an invalid subprotocol"):w="Server sent a subprotocol but none was requested":m.size&&(w="Server sent no subprotocol"),w){dn(e,v,w);return}k&&(e._protocol=k);let x=h.headers["sec-websocket-extensions"];if(x!==void 0){if(!f){dn(e,v,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let C;try{C=q6(x)}catch{dn(e,v,"Invalid Sec-WebSocket-Extensions header");return}let I=Object.keys(C);if(I.length!==1||I[0]!==Co.extensionName){dn(e,v,"Server indicated an extension that was not requested");return}try{f.accept(C[Co.extensionName])}catch{dn(e,v,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[Co.extensionName]=f}e.setSocket(v,g,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxBufferedChunks:o.maxBufferedChunks,maxFragments:o.maxFragments,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(y,e):y.end()}a(Oj,"initAsClient");function Cp(e,t){e._readyState=ze.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}a(Cp,"emitErrorAndClose");function V6(e){return e.path=e.socketPath,Mj.connect(e)}a(V6,"netConnect");function J6(e){return e.path=void 0,!e.servername&&e.servername!==""&&(e.servername=Mj.isIP(e.host)?"":e.host),C6.connect(e)}a(J6,"tlsConnect");function dn(e,t,n){e._readyState=ze.CLOSING;let r=new Error(n);Error.captureStackTrace(r,dn),t.setHeader?(t[Hj]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(Cp,e,r)):(t.destroy(r),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}a(dn,"abortHandshake");function iy(e,t,n){if(t){let r=O6(t)?t.size:z6(t).length;e._socket?e._sender._bufferedBytes+=r:e._bufferedAmount+=r}if(n){let r=new Error(`WebSocket is not open: readyState ${e.readyState} (${Vr[e.readyState]})`);process.nextTick(n,r)}}a(iy,"sendAfterClose");function G6(e,t){let n=this[pt];n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[pt]!==void 0&&(n._socket.removeListener("data",Ep),process.nextTick(Dj,n._socket),e===1005?n.close():n.close(e,t))}a(G6,"receiverOnConclude");function K6(){let e=this[pt];e.isPaused||e._socket.resume()}a(K6,"receiverOnDrain");function Y6(e){let t=this[pt];t._socket[pt]!==void 0&&(t._socket.removeListener("data",Ep),process.nextTick(Dj,t._socket),t.close(e[L6])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}a(Y6,"receiverOnError");function Ej(){this[pt].emitClose()}a(Ej,"receiverOnFinish");function X6(e,t){this[pt].emit("message",e,t)}a(X6,"receiverOnMessage");function Q6(e){let t=this[pt];t._autoPong&&t.pong(e,!this._isServer,jj),t.emit("ping",e)}a(Q6,"receiverOnPing");function Z6(e){this[pt].emit("pong",e)}a(Z6,"receiverOnPong");function Dj(e){e.resume()}a(Dj,"resume");function e5(e){let t=this[pt];t.readyState!==ze.CLOSED&&(t.readyState===ze.OPEN&&(t._readyState=ze.CLOSING,Bj(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}a(e5,"senderOnError");function Bj(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}a(Bj,"setCloseTimer");function $j(){let e=this[pt];if(this.removeListener("close",$j),this.removeListener("data",Ep),this.removeListener("end",Lj),e._readyState=ze.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[pt]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",Ej),e._receiver.on("finish",Ej))}a($j,"socketOnClose");function Ep(e){this[pt]._receiver.write(e)||this.pause()}a(Ep,"socketOnData");function Lj(){let e=this[pt];e._readyState=ze.CLOSING,e._receiver.end(),this.end()}a(Lj,"socketOnEnd");function Nj(){let e=this[pt];this.removeListener("error",Nj),this.on("error",jj),e&&(e._readyState=ze.CLOSING,this.destroy())}a(Nj,"socketOnError")});var Wj=_e((Ume,zj)=>{"use strict";var Fme=Mp(),{Duplex:t5}=Re("stream");function Uj(e){e.emit("close")}a(Uj,"emitClose");function n5(){!this.destroyed&&this._writableState.finished&&this.destroy()}a(n5,"duplexOnEnd");function qj(e){this.removeListener("error",qj),this.destroy(),this.listenerCount("error")===0&&this.emit("error",e)}a(qj,"duplexOnError");function r5(e,t){let n=!0,r=new t5({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",a(function(s,i){let c=!i&&r._readableState.objectMode?s.toString():s;r.push(c)||e.pause()},"message")),e.once("error",a(function(s){r.destroyed||(n=!1,r.destroy(s))},"error")),e.once("close",a(function(){r.destroyed||r.push(null)},"close")),r._destroy=function(o,s){if(e.readyState===e.CLOSED){s(o),process.nextTick(Uj,r);return}let i=!1;e.once("error",a(function(d){i=!0,s(d)},"error")),e.once("close",a(function(){i||s(o),process.nextTick(Uj,r)},"close")),n&&e.terminate()},r._final=function(o){if(e.readyState===e.CONNECTING){e.once("open",a(function(){r._final(o)},"open"));return}e._socket!==null&&(e._socket._writableState.finished?(o(),r._readableState.endEmitted&&r.destroy()):(e._socket.once("finish",a(function(){o()},"finish")),e.close()))},r._read=function(){e.isPaused&&e.resume()},r._write=function(o,s,i){if(e.readyState===e.CONNECTING){e.once("open",a(function(){r._write(o,s,i)},"open"));return}e.send(o,i)},r.on("end",n5),r.on("error",qj),r}a(r5,"createWebSocketStream");zj.exports=r5});var cy=_e((zme,Vj)=>{"use strict";var{tokenChars:o5}=ui();function a5(e){let t=new Set,n=-1,r=-1,o=0;for(o;o<e.length;o++){let i=e.charCodeAt(o);if(r===-1&&o5[i]===1)n===-1&&(n=o);else if(o!==0&&(i===32||i===9))r===-1&&n!==-1&&(r=o);else if(i===44){if(n===-1)throw new SyntaxError(`Unexpected character at index ${o}`);r===-1&&(r=o);let c=e.slice(n,r);if(t.has(c))throw new SyntaxError(`The "${c}" subprotocol is duplicated`);t.add(c),n=r=-1}else throw new SyntaxError(`Unexpected character at index ${o}`)}if(n===-1||r!==-1)throw new SyntaxError("Unexpected end of input");let s=e.slice(n,o);if(t.has(s))throw new SyntaxError(`The "${s}" subprotocol is duplicated`);return t.add(s),t}a(a5,"parse");Vj.exports={parse:a5}});var Zj=_e((Jme,Qj)=>{"use strict";var s5=Re("events"),jp=Re("http"),{Duplex:Vme}=Re("stream"),{createHash:i5}=Re("crypto"),Jj=Tp(),wa=li(),c5=cy(),d5=Mp(),{CLOSE_TIMEOUT:l5,GUID:u5,kWebSocket:p5}=qr(),m5=/^[+/0-9A-Za-z]{22}==$/,Gj=0,Kj=1,Xj=2,dy=class extends s5{static{a(this,"WebSocketServer")}constructor(t,n){if(super(),t={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:256*1024,maxFragments:16*1024,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:l5,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:d5,...t},t.port==null&&!t.server&&!t.noServer||t.port!=null&&(t.server||t.noServer)||t.server&&t.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(t.port!=null?(this._server=jp.createServer((r,o)=>{let s=jp.STATUS_CODES[426];o.writeHead(426,{"Content-Length":s.length,"Content-Type":"text/plain"}),o.end(s)}),this._server.listen(t.port,t.host,t.backlog,n)):t.server&&(this._server=t.server),this._server){let r=this.emit.bind(this,"connection");this._removeListeners=f5(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:a((o,s,i)=>{this.handleUpgrade(o,s,i,r)},"upgrade")})}t.perMessageDeflate===!0&&(t.perMessageDeflate={}),t.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=t,this._state=Gj}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(t){if(this._state===Xj){t&&this.once("close",()=>{t(new Error("The server is not running"))}),process.nextTick(ed,this);return}if(t&&this.once("close",t),this._state!==Kj)if(this._state=Kj,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(ed,this):process.nextTick(ed,this);else{let n=this._server;this._removeListeners(),this._removeListeners=this._server=null,n.close(()=>{ed(this)})}}shouldHandle(t){if(this.options.path){let n=t.url.indexOf("?");if((n!==-1?t.url.slice(0,n):t.url)!==this.options.path)return!1}return!0}handleUpgrade(t,n,r,o){n.on("error",Yj);let s=t.headers["sec-websocket-key"],i=t.headers.upgrade,c=+t.headers["sec-websocket-version"];if(t.method!=="GET"){ya(this,t,n,405,"Invalid HTTP method");return}if(i===void 0||i.toLowerCase()!=="websocket"){ya(this,t,n,400,"Invalid Upgrade header");return}if(s===void 0||!m5.test(s)){ya(this,t,n,400,"Missing or invalid Sec-WebSocket-Key header");return}if(c!==13&&c!==8){ya(this,t,n,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(t)){td(n,400);return}let d=t.headers["sec-websocket-protocol"],l=new Set;if(d!==void 0)try{l=c5.parse(d)}catch{ya(this,t,n,400,"Invalid Sec-WebSocket-Protocol header");return}let u=t.headers["sec-websocket-extensions"],p={};if(this.options.perMessageDeflate&&u!==void 0){let m=new wa({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let f=Jj.parse(u);f[wa.extensionName]&&(m.accept(f[wa.extensionName]),p[wa.extensionName]=m)}catch{ya(this,t,n,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let m={origin:t.headers[`${c===8?"sec-websocket-origin":"origin"}`],secure:!!(t.socket.authorized||t.socket.encrypted),req:t};if(this.options.verifyClient.length===2){this.options.verifyClient(m,(f,y,h,v)=>{if(!f)return td(n,y||401,h,v);this.completeUpgrade(p,s,l,t,n,r,o)});return}if(!this.options.verifyClient(m))return td(n,401)}this.completeUpgrade(p,s,l,t,n,r,o)}completeUpgrade(t,n,r,o,s,i,c){if(!s.readable||!s.writable)return s.destroy();if(s[p5])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Gj)return td(s,503);let l=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${i5("sha1").update(n+u5).digest("base64")}`],u=new this.options.WebSocket(null,void 0,this.options);if(r.size){let p=this.options.handleProtocols?this.options.handleProtocols(r,o):r.values().next().value;p&&(l.push(`Sec-WebSocket-Protocol: ${p}`),u._protocol=p)}if(t[wa.extensionName]){let p=t[wa.extensionName].params,m=Jj.format({[wa.extensionName]:[p]});l.push(`Sec-WebSocket-Extensions: ${m}`),u._extensions=t}this.emit("headers",l,o),s.write(l.concat(`\r
|
|
3
|
+
import{a as jA,b as HA,c as OA,d as H,e as DA,f as go,g as z,h as xu,j as BA}from"./chunk-LFL4M4DL.js";import{$ as dx,$a as aT,$b as dh,A as A_,Aa as Fx,Ab as AT,Ac as fo,B as C_,Ba as Ux,Bb as ch,Bc as Mr,C as E_,Ca as uo,Cb as CT,Cc as gh,D as D_,Da as qx,Db as ET,Dc as wA,E as J_,Ea as zx,Eb as MT,Ec as yA,F as G_,Fa as sh,Fb as jT,Fc as Pu,G as K_,Ga as Wx,Gb as HT,Gc as js,H as Y_,Ha as Rc,Hb as OT,Hc as vA,I as X_,Ia as Vx,Ib as DT,Ic as _u,J as Q_,Ja as Es,Jb as BT,Jc as kA,K as Z_,Ka as Jx,Kb as $T,Kc as bA,L as ex,La as Gx,Lb as LT,Lc as SA,M as tx,Ma as Kx,Mb as NT,Mc as IA,N as du,Na as Yx,Nb as FT,Nc as RA,O as nx,Oa as re,Ob as UT,Oc as PA,P as lu,Pa as Xx,Pb as qT,Pc as _A,Q as rx,Qa as Qx,Qb as zT,Qc as xA,R as ox,Ra as wu,Rb as WT,Rc as TA,S as ax,Sa as Zx,Sb as Su,Sc as AA,T as Ps,Ta as eT,Tb as VT,Tc as CA,U as uu,Ua as tT,Ub as ra,Uc as EA,V as kc,Va as nT,Vb as Iu,W as th,Wa as rT,Wb as JT,Wc as MA,X as na,Xa as yu,Xb as mo,Y as sx,Ya as oT,Yb as Ru,Z as ix,Za as po,Zb as GT,_ as cx,_a as xe,_b as KT,a as kS,aa as lx,ab as me,ac as lh,b as bS,ba as ux,bb as sT,bc as YT,c as SS,ca as px,cb as iT,cc as XT,d as IS,da as pu,db as cT,dc as QT,e as RS,ea as mu,eb as dT,ec as ZT,f as _l,fa as _s,fb as lT,fc as uh,g as eI,ga as fu,gb as uT,gc as eA,h as tI,ha as mx,hb as pT,hc as ph,i as nI,ia as fx,ib as mT,ic as tA,j as rI,ja as gx,jb as fT,jc as nA,k as oI,ka as Sc,kb as gT,kc as rA,l as Ag,la as Ax,lb as hT,lc as oA,m as iI,ma as Cx,mb as Ms,mc as aA,n as cI,na as Ex,nb as Bn,nc as sA,o as dI,oa as Mx,ob as Me,oc as iA,p as lI,pa as jx,pb as wT,pc as cA,q as uI,qa as Ic,qb as yT,qc as dA,r as pI,ra as Hx,rb as vT,rc as lA,s as Yo,sa as Ox,sb as kT,sc as mh,t as mI,ta as As,tb as IT,tc as uA,u as fI,ua as Cs,ub as RT,uc as fh,v as Al,va as Dx,vb as bu,vc as pA,w as gI,wa as Bx,wb as PT,wc as mA,x as hI,xa as $x,xb as _T,xc as fA,y as F2,ya as Lx,yb as xT,yc as gA,z as T_,za as Nx,zb as TT,zc as hA}from"./chunk-WDE3KN3N.js";import{A as Sx,C as gu,F as hu,G as ur,H as Ix,I as nh,J as Rx,K as rh,N as Px,O as oh,P as _x,Q as xx,R as Tx,S as ah,T as Ts,b as lr,d as hx,e as wx,h as yx,m as xs,n as vx,p as kx,q as bx,s as bc}from"./chunk-RQLWYR5B.js";import{a as ct,b as M_,c as j_,f as H_,s as O_,u as ih,v as bT,w as vu,x as ku,y as ST}from"./chunk-KRNLKKN6.js";import{a as __,b as su,d as ce,e as it,f as Rs,g as ne,i as x_}from"./chunk-ADMQIREX.js";import{a as an,b as B_,c as $_,d as iu,e as cu,g as L_,h as N_,i as F_,j as U_,k as q_,l as z_,m as W_,n as V_}from"./chunk-LLJI6QAY.js";import{$ as Nl,$a as VR,$b as PP,$c as e_,A as cR,Aa as Ng,B as dR,Ba as qe,Bb as fc,Bc as Yl,Bd as ea,C as lR,Ca as ql,Cb as dP,Cd as c_,D as Bl,Da as CR,Dc as Yg,Dd as Er,E as uR,Ea as Fg,Eb as lP,Ec as qP,Ed as d_,F as Dg,Fb as uP,Fc as zP,Fd as l_,G as pR,Ga as ER,Gb as pP,Gd as u_,H as mR,Hd as co,I as st,Ia as MR,Ib as ys,Ic as Xl,Id as Ss,J as Tt,Jb as mP,Jc as WP,Jd as tu,K as $l,Ka as zl,Kc as Xg,Kd as p_,L as fR,La as jR,Lb as gc,Lc as cr,Ld as m_,M as gR,Mb as Gl,Mc as VP,Md as f_,Na as HR,Nb as fP,Nc as JP,Nd as yc,O as hR,Oa as OR,Ob as zg,Oc as Qg,Od as Is,Pa as DR,Pb as gP,Pc as wc,Pd as nu,Q as wR,Qa as BR,Qb as hP,Qc as GP,Qd as g_,R as yR,Ra as $R,Rb as Wg,Rc as Ql,Rd as ru,S as Dn,Sa as LR,Sb as wP,Sc as KP,Sd as lo,Ta as NR,Tb as yP,Tc as YP,Td as h_,Ua as FR,Ub as vP,Uc as vs,Ud as w_,Va as UR,Vb as kP,Vc as XP,Vd as y_,Wa as io,Wb as bP,Wc as ks,Wd as ou,X as vR,Xb as SP,Xc as QP,Xd as v_,Ya as qR,Yb as IP,Yc as ZP,Yd as vc,Z as Ll,Za as zR,Zb as Vg,Zc as Zg,Zd as k_,_ as Bg,_a as WR,_b as RP,_c as Zl,_d as b_,aa as kR,ac as _P,ad as Oe,bb as JR,bc as xP,bd as eu,c as KI,ca as $g,cb as Wl,cc as Jg,cd as t_,da as bR,db as GR,dc as TP,dd as n_,ea as Bt,eb as KR,ec as AP,ed as r_,fa as Xo,fb as YR,fc as CP,fd as eh,ga as Qo,gb as XR,gc as EP,gd as o_,ha as Lg,hb as QR,hc as MP,hd as a_,he as au,ia as SR,ib as ZR,ic as jP,id as s_,ie as S_,ja as IR,jb as eP,jc as HP,je as I_,ka as RR,kb as tP,kc as OP,kd as bs,ke as dr,l as YI,la as PR,lb as nP,lc as DP,ld as i_,le as R_,m as XI,ma as _R,mb as rP,mc as BP,me as ta,n as QI,na as xR,nb as oP,nc as Gg,ne as P_,o as ZI,oa as Fl,ob as aP,oc as Zo,p as eR,pb as sP,pc as $P,qa as Ul,qb as Ug,qc as LP,rb as Vl,rc as NP,s as tR,sb as iP,t as nR,tb as ir,tc as Kl,u as rR,ub as Cr,uc as FP,v as oR,vb as qg,w as aR,wb as Jl,wc as UP,x as Og,xa as TR,xb as cP,xc as hc,y as sR,yb as $t,yc as Kg,z as iR,za as AR,zb as mc}from"./chunk-DY5RF2YE.js";import"./chunk-XEOEKFG6.js";import{$ as qS,$b as CI,$c as VI,Ac as BI,Bc as Mg,Ca as YS,Cc as $I,Dc as LI,E as AS,Ea as xg,Ec as NI,F as CS,Fa as Ee,Fc as FI,G as ES,Ga as Ko,Gc as so,H as vn,Ha as Qe,Hc as UI,Ib as PI,Ic as sr,Jc as qI,K as MS,Kb as _I,L as Sl,La as XS,Lb as xI,M as jS,N as HS,Nc as zI,O as OS,Oa as uc,Oc as WI,P as DS,Pa as QS,Pc as hs,Qa as Pl,Sa as ZS,T as BS,Ta as Tg,Tb as TI,U as $S,Ua as fs,V as LS,W as NS,Wb as AI,X as FS,Y as Il,Ya as xl,Z as _g,Zc as ws,_ as US,_a as aI,_c as pc,aa as zS,ad as JI,bd as GI,dc as Eg,dd as jg,e as PS,ea as WS,eb as Tl,ec as EI,fb as sI,fd as Hg,ga as ms,gb as wI,hb as Cl,hc as MI,ic as Ml,ja as VS,jc as jl,kb as Cg,kc as jI,la as JS,lb as yI,mb as vI,mc as HI,nb as kI,ob as El,p as _S,pb as bI,q as xS,qb as SI,r as Vt,rb as II,s as kl,sb as RI,ta as On,ua as GS,uc as gs,v as Ar,va as Rl,vc as OI,w as lc,wa as on,wc as DI,x as Pg,xc as Hl,y as bl,yc as Ol,z as TS,za as KS,zc as Dl}from"./chunk-S64WASAO.js";import"./chunk-6MI4KKWF.js";import"./chunk-SDO4FC4Q.js";import"./chunk-IR3YJWPW.js";import{D as ps,E as cc,F as vl,d as yl,m as yS,n as ao,o as Je,p as vS}from"./chunk-O4IARD7H.js";import"./chunk-J2S7BOZU.js";import{Aa as lS,Bb as Ge,Cb as Wt,Ha as uS,Ib as gS,Ka as pS,La as mS,Rb as hS,S as gl,Sa as wl,Tb as wS,Za as fS,a as rn,qa as cS,ra as hl,sa as dS}from"./chunk-UW6ES5DM.js";import{a as dc}from"./chunk-6FA3GG5B.js";import{$a as Go,Ca as nS,Ea as Ig,F as Sg,Fa as Rg,Ga as rS,N as Jb,R as ro,T as Gb,Ta as ml,Ua as oS,V as Kb,W as Yb,X as Xb,Ya as aS,Za as sS,ab as iS,bb as fl,f as sl,k as Vo,l as Lb,m as ic,n as xr,o as ll,p as Nb,pa as oo,q as ul,r as Fb,ra as Jo,s as ds,u as Ub,v as qb,w as zb,wa as Qb,x as Wb,xa as Zb,y as Vb,ya as eS,za as tS}from"./chunk-NNLI4OWY.js";import{a as is,b as cs,c as kg,d as il,e as at,f as bg,g as cl,j as Ve,k as ye,l as O,m as Bb,o as $b,p as dl,q as xt}from"./chunk-HZP5U2AA.js";import{a as Wo,b as _}from"./chunk-ES2ISFJC.js";import{a as Hb,c as zo,f as Ob,h as al,i as Db,p as ls,q as pl,r as Tr,s as us}from"./chunk-H7IWJN7L.js";import{a,b as Re,c as _e,e as ar}from"./chunk-FTQLQJQV.js";var qr=_e((yme,Z0)=>{"use strict";var X0=["nodebuffer","arraybuffer","fragments"],Q0=typeof Blob<"u";Q0&&X0.push("blob");Z0.exports={BINARY_TYPES:X0,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:Q0,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:a(()=>{},"NOOP")}});var Kc=_e((kme,kp)=>{"use strict";var{EMPTY_BUFFER:KG}=qr(),qw=Buffer[Symbol.species];function YG(e,t){if(e.length===0)return KG;if(e.length===1)return e[0];let n=Buffer.allocUnsafe(t),r=0;for(let o=0;o<e.length;o++){let s=e[o];n.set(s,r),r+=s.length}return r<t?new qw(n.buffer,n.byteOffset,r):n}a(YG,"concat");function ej(e,t,n,r,o){for(let s=0;s<o;s++)n[r+s]=e[s]^t[s&3]}a(ej,"_mask");function tj(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}a(tj,"_unmask");function XG(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}a(XG,"toArrayBuffer");function zw(e){if(zw.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new qw(e):ArrayBuffer.isView(e)?t=new qw(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),zw.readOnly=!1),t}a(zw,"toBuffer");kp.exports={concat:YG,mask:ej,toArrayBuffer:XG,toBuffer:zw,unmask:tj};if(!process.env.WS_NO_BUFFER_UTIL)try{let e=Re("bufferutil");kp.exports.mask=function(t,n,r,o,s){s<48?ej(t,n,r,o,s):e.mask(t,n,r,o,s)},kp.exports.unmask=function(t,n){t.length<32?tj(t,n):e.unmask(t,n)}}catch{}});var oj=_e((Sme,rj)=>{"use strict";var nj=Symbol("kDone"),Ww=Symbol("kRun"),Vw=class{static{a(this,"Limiter")}constructor(t){this[nj]=()=>{this.pending--,this[Ww]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[Ww]()}[Ww](){if(this.pending!==this.concurrency&&this.jobs.length){let t=this.jobs.shift();this.pending++,t(this[nj])}}};rj.exports=Vw});var li=_e((Rme,cj)=>{"use strict";var Yc=Re("zlib"),aj=Kc(),QG=oj(),{kStatusCode:sj}=qr(),ZG=Buffer[Symbol.species],e6=Buffer.from([0,0,255,255]),Sp=Symbol("permessage-deflate"),zr=Symbol("total-length"),ci=Symbol("callback"),Ao=Symbol("buffers"),di=Symbol("error"),bp,Jw=class{static{a(this,"PerMessageDeflate")}constructor(t){if(this._options=t||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!bp){let n=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;bp=new QG(n)}}static get extensionName(){return"permessage-deflate"}offer(){let t={};return this._options.serverNoContextTakeover&&(t.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(t.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(t.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?t.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(t.client_max_window_bits=!0),t}accept(t){return t=this.normalizeParams(t),this.params=this._isServer?this.acceptAsServer(t):this.acceptAsClient(t),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let t=this._deflate[ci];this._deflate.close(),this._deflate=null,t&&t(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(t){let n=this._options,r=t.find(o=>!(n.serverNoContextTakeover===!1&&o.server_no_context_takeover||o.server_max_window_bits&&(n.serverMaxWindowBits===!1||typeof n.serverMaxWindowBits=="number"&&n.serverMaxWindowBits>o.server_max_window_bits)||typeof n.clientMaxWindowBits=="number"&&!o.client_max_window_bits));if(!r)throw new Error("None of the extension offers can be accepted");return n.serverNoContextTakeover&&(r.server_no_context_takeover=!0),n.clientNoContextTakeover&&(r.client_no_context_takeover=!0),typeof n.serverMaxWindowBits=="number"&&(r.server_max_window_bits=n.serverMaxWindowBits),typeof n.clientMaxWindowBits=="number"?r.client_max_window_bits=n.clientMaxWindowBits:(r.client_max_window_bits===!0||n.clientMaxWindowBits===!1)&&delete r.client_max_window_bits,r}acceptAsClient(t){let n=t[0];if(this._options.clientNoContextTakeover===!1&&n.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!n.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(n.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&n.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return n}normalizeParams(t){return t.forEach(n=>{Object.keys(n).forEach(r=>{let o=n[r];if(o.length>1)throw new Error(`Parameter "${r}" must have only a single value`);if(o=o[0],r==="client_max_window_bits"){if(o!==!0){let s=+o;if(!Number.isInteger(s)||s<8||s>15)throw new TypeError(`Invalid value for parameter "${r}": ${o}`);o=s}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${r}": ${o}`)}else if(r==="server_max_window_bits"){let s=+o;if(!Number.isInteger(s)||s<8||s>15)throw new TypeError(`Invalid value for parameter "${r}": ${o}`);o=s}else if(r==="client_no_context_takeover"||r==="server_no_context_takeover"){if(o!==!0)throw new TypeError(`Invalid value for parameter "${r}": ${o}`)}else throw new Error(`Unknown parameter "${r}"`);n[r]=o})}),t}decompress(t,n,r){bp.add(o=>{this._decompress(t,n,(s,i)=>{o(),r(s,i)})})}compress(t,n,r){bp.add(o=>{this._compress(t,n,(s,i)=>{o(),r(s,i)})})}_decompress(t,n,r){let o=this._isServer?"client":"server";if(!this._inflate){let s=`${o}_max_window_bits`,i=typeof this.params[s]!="number"?Yc.Z_DEFAULT_WINDOWBITS:this.params[s];this._inflate=Yc.createInflateRaw({...this._options.zlibInflateOptions,windowBits:i}),this._inflate[Sp]=this,this._inflate[zr]=0,this._inflate[Ao]=[],this._inflate.on("error",n6),this._inflate.on("data",ij)}this._inflate[ci]=r,this._inflate.write(t),n&&this._inflate.write(e6),this._inflate.flush(()=>{let s=this._inflate[di];if(s){this._inflate.close(),this._inflate=null,r(s);return}let i=aj.concat(this._inflate[Ao],this._inflate[zr]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[zr]=0,this._inflate[Ao]=[],n&&this.params[`${o}_no_context_takeover`]&&this._inflate.reset()),r(null,i)})}_compress(t,n,r){let o=this._isServer?"server":"client";if(!this._deflate){let s=`${o}_max_window_bits`,i=typeof this.params[s]!="number"?Yc.Z_DEFAULT_WINDOWBITS:this.params[s];this._deflate=Yc.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:i}),this._deflate[zr]=0,this._deflate[Ao]=[],this._deflate.on("data",t6)}this._deflate[ci]=r,this._deflate.write(t),this._deflate.flush(Yc.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let s=aj.concat(this._deflate[Ao],this._deflate[zr]);n&&(s=new ZG(s.buffer,s.byteOffset,s.length-4)),this._deflate[ci]=null,this._deflate[zr]=0,this._deflate[Ao]=[],n&&this.params[`${o}_no_context_takeover`]&&this._deflate.reset(),r(null,s)})}};cj.exports=Jw;function t6(e){this[Ao].push(e),this[zr]+=e.length}a(t6,"deflateOnData");function ij(e){if(this[zr]+=e.length,this[Sp]._maxPayload<1||this[zr]<=this[Sp]._maxPayload){this[Ao].push(e);return}this[di]=new RangeError("Max payload size exceeded"),this[di].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[di][sj]=1009,this.removeListener("data",ij),this.reset()}a(ij,"inflateOnData");function n6(e){if(this[Sp]._inflate=null,this[di]){this[ci](this[di]);return}e[sj]=1007,this[ci](e)}a(n6,"inflateOnError")});var ui=_e((_me,Ip)=>{"use strict";var{isUtf8:dj}=Re("buffer"),{hasBlob:r6}=qr(),o6=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function a6(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}a(a6,"isValidStatusCode");function Gw(e){let t=e.length,n=0;for(;n<t;)if((e[n]&128)===0)n++;else if((e[n]&224)===192){if(n+1===t||(e[n+1]&192)!==128||(e[n]&254)===192)return!1;n+=2}else if((e[n]&240)===224){if(n+2>=t||(e[n+1]&192)!==128||(e[n+2]&192)!==128||e[n]===224&&(e[n+1]&224)===128||e[n]===237&&(e[n+1]&224)===160)return!1;n+=3}else if((e[n]&248)===240){if(n+3>=t||(e[n+1]&192)!==128||(e[n+2]&192)!==128||(e[n+3]&192)!==128||e[n]===240&&(e[n+1]&240)===128||e[n]===244&&e[n+1]>143||e[n]>244)return!1;n+=4}else return!1;return!0}a(Gw,"_isValidUTF8");function s6(e){return r6&&typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}a(s6,"isBlob");Ip.exports={isBlob:s6,isValidStatusCode:a6,isValidUTF8:Gw,tokenChars:o6};if(dj)Ip.exports.isValidUTF8=function(e){return e.length<24?Gw(e):dj(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=Re("utf-8-validate");Ip.exports.isValidUTF8=function(t){return t.length<32?Gw(t):e(t)}}catch{}});var Zw=_e((Tme,hj)=>{"use strict";var{Writable:i6}=Re("stream"),lj=li(),{BINARY_TYPES:c6,EMPTY_BUFFER:uj,kStatusCode:d6,kWebSocket:l6}=qr(),{concat:Kw,toArrayBuffer:u6,unmask:p6}=Kc(),{isValidStatusCode:m6,isValidUTF8:pj}=ui(),Rp=Buffer[Symbol.species],xn=0,mj=1,fj=2,gj=3,Yw=4,Xw=5,Pp=6,Qw=class extends i6{static{a(this,"Receiver")}constructor(t={}){super(),this._allowSynchronousEvents=t.allowSynchronousEvents!==void 0?t.allowSynchronousEvents:!0,this._binaryType=t.binaryType||c6[0],this._extensions=t.extensions||{},this._isServer=!!t.isServer,this._maxBufferedChunks=t.maxBufferedChunks|0,this._maxFragments=t.maxFragments|0,this._maxPayload=t.maxPayload|0,this._skipUTF8Validation=!!t.skipUTF8Validation,this[l6]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._numFragments=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=xn}_write(t,n,r){if(this._opcode===8&&this._state==xn)return r();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){r(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));return}this._bufferedBytes+=t.length,this._buffers.push(t),this.startLoop(r)}consume(t){if(this._bufferedBytes-=t,t===this._buffers[0].length)return this._buffers.shift();if(t<this._buffers[0].length){let r=this._buffers[0];return this._buffers[0]=new Rp(r.buffer,r.byteOffset+t,r.length-t),new Rp(r.buffer,r.byteOffset,t)}let n=Buffer.allocUnsafe(t);do{let r=this._buffers[0],o=n.length-t;t>=r.length?n.set(this._buffers.shift(),o):(n.set(new Uint8Array(r.buffer,r.byteOffset,t),o),this._buffers[0]=new Rp(r.buffer,r.byteOffset+t,r.length-t)),t-=r.length}while(t>0);return n}startLoop(t){this._loop=!0;do switch(this._state){case xn:this.getInfo(t);break;case mj:this.getPayloadLength16(t);break;case fj:this.getPayloadLength64(t);break;case gj:this.getMask();break;case Yw:this.getData(t);break;case Xw:case Pp:this._loop=!1;return}while(this._loop);this._errored||t()}getInfo(t){if(this._bufferedBytes<2){this._loop=!1;return}let n=this.consume(2);if((n[0]&48)!==0){let o=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");t(o);return}let r=(n[0]&64)===64;if(r&&!this._extensions[lj.extensionName]){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(o);return}if(this._fin=(n[0]&128)===128,this._opcode=n[0]&15,this._payloadLength=n[1]&127,this._opcode===0){if(r){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(o);return}if(!this._fragmented){let o=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");t(o);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let o=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(o);return}this._compressed=r}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let o=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");t(o);return}if(r){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(o);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let o=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");t(o);return}}else{let o=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(o);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(n[1]&128)===128,this._isServer){if(!this._masked){let o=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");t(o);return}}else if(this._masked){let o=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");t(o);return}this._payloadLength===126?this._state=mj:this._payloadLength===127?this._state=fj:this.haveLength(t)}getPayloadLength16(t){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(t)}getPayloadLength64(t){if(this._bufferedBytes<8){this._loop=!1;return}let n=this.consume(8),r=n.readUInt32BE(0);if(r>Math.pow(2,21)-1){let o=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");t(o);return}this._payloadLength=r*Math.pow(2,32)+n.readUInt32BE(4),this.haveLength(t)}haveLength(t){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let n=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");t(n);return}this._masked?this._state=gj:this._state=Yw}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Yw}getData(t){let n=uj;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}n=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&p6(n,this._mask)}if(this._opcode>7){this.controlMessage(n,t);return}if(this._maxFragments>0&&++this._numFragments>this._maxFragments){let r=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");t(r);return}if(this._compressed){this._state=Xw,this.decompress(n,t);return}n.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(n)),this.dataMessage(t)}decompress(t,n){this._extensions[lj.extensionName].decompress(t,this._fin,(o,s)=>{if(o)return n(o);if(s.length){if(this._messageLength+=s.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let i=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");n(i);return}this._fragments.push(s)}this.dataMessage(n),this._state===xn&&this.startLoop(n)})}dataMessage(t){if(!this._fin){this._state=xn;return}let n=this._messageLength,r=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._numFragments=0,this._fragments=[],this._opcode===2){let o;this._binaryType==="nodebuffer"?o=Kw(r,n):this._binaryType==="arraybuffer"?o=u6(Kw(r,n)):this._binaryType==="blob"?o=new Blob(r):o=r,this._allowSynchronousEvents?(this.emit("message",o,!0),this._state=xn):(this._state=Pp,setImmediate(()=>{this.emit("message",o,!0),this._state=xn,this.startLoop(t)}))}else{let o=Kw(r,n);if(!this._skipUTF8Validation&&!pj(o)){let s=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(s);return}this._state===Xw||this._allowSynchronousEvents?(this.emit("message",o,!1),this._state=xn):(this._state=Pp,setImmediate(()=>{this.emit("message",o,!1),this._state=xn,this.startLoop(t)}))}}controlMessage(t,n){if(this._opcode===8){if(t.length===0)this._loop=!1,this.emit("conclude",1005,uj),this.end();else{let r=t.readUInt16BE(0);if(!m6(r)){let s=this.createError(RangeError,`invalid status code ${r}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");n(s);return}let o=new Rp(t.buffer,t.byteOffset+2,t.length-2);if(!this._skipUTF8Validation&&!pj(o)){let s=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");n(s);return}this._loop=!1,this.emit("conclude",r,o),this.end()}this._state=xn;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",t),this._state=xn):(this._state=Pp,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",t),this._state=xn,this.startLoop(n)}))}createError(t,n,r,o,s){this._loop=!1,this._errored=!0;let i=new t(r?`Invalid WebSocket frame: ${n}`:n);return Error.captureStackTrace(i,this.createError),i.code=s,i[d6]=o,i}};hj.exports=Qw});var ny=_e((Eme,vj)=>{"use strict";var{Duplex:Cme}=Re("stream"),{randomFillSync:f6}=Re("crypto"),{types:{isUint8Array:g6}}=Re("util"),wj=li(),{EMPTY_BUFFER:h6,kWebSocket:w6,NOOP:y6}=qr(),{isBlob:pi,isValidStatusCode:v6}=ui(),{mask:yj,toBuffer:fa}=Kc(),Tn=Symbol("kByteLength"),k6=Buffer.alloc(4),_p=8*1024,ga,mi=_p,Fn=0,b6=1,S6=2,ey=class e{static{a(this,"Sender")}constructor(t,n,r){this._extensions=n||{},r&&(this._generateMask=r,this._maskBuffer=Buffer.alloc(4)),this._socket=t,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=Fn,this.onerror=y6,this[w6]=void 0}static frame(t,n){let r,o=!1,s=2,i=!1;n.mask&&(r=n.maskBuffer||k6,n.generateMask?n.generateMask(r):(mi===_p&&(ga===void 0&&(ga=Buffer.alloc(_p)),f6(ga,0,_p),mi=0),r[0]=ga[mi++],r[1]=ga[mi++],r[2]=ga[mi++],r[3]=ga[mi++]),i=(r[0]|r[1]|r[2]|r[3])===0,s=6);let c;typeof t=="string"?(!n.mask||i)&&n[Tn]!==void 0?c=n[Tn]:(t=Buffer.from(t),c=t.length):(c=t.length,o=n.mask&&n.readOnly&&!i);let d=c;c>=65536?(s+=8,d=127):c>125&&(s+=2,d=126);let l=Buffer.allocUnsafe(o?c+s:s);return l[0]=n.fin?n.opcode|128:n.opcode,n.rsv1&&(l[0]|=64),l[1]=d,d===126?l.writeUInt16BE(c,2):d===127&&(l[2]=l[3]=0,l.writeUIntBE(c,4,6)),n.mask?(l[1]|=128,l[s-4]=r[0],l[s-3]=r[1],l[s-2]=r[2],l[s-1]=r[3],i?[l,t]:o?(yj(t,r,l,s,c),[l]):(yj(t,r,t,0,c),[l,t])):[l,t]}close(t,n,r,o){let s;if(t===void 0)s=h6;else{if(typeof t!="number"||!v6(t))throw new TypeError("First argument must be a valid error code number");if(n===void 0||!n.length)s=Buffer.allocUnsafe(2),s.writeUInt16BE(t,0);else{let c=Buffer.byteLength(n);if(c>123)throw new RangeError("The message must not be greater than 123 bytes");if(s=Buffer.allocUnsafe(2+c),s.writeUInt16BE(t,0),typeof n=="string")s.write(n,2);else if(g6(n))s.set(n,2);else throw new TypeError("Second argument must be a string or a Uint8Array")}}let i={[Tn]:s.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==Fn?this.enqueue([this.dispatch,s,!1,i,o]):this.sendFrame(e.frame(s,i),o)}ping(t,n,r){let o,s;if(typeof t=="string"?(o=Buffer.byteLength(t),s=!1):pi(t)?(o=t.size,s=!1):(t=fa(t),o=t.length,s=fa.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let i={[Tn]:o,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:9,readOnly:s,rsv1:!1};pi(t)?this._state!==Fn?this.enqueue([this.getBlobData,t,!1,i,r]):this.getBlobData(t,!1,i,r):this._state!==Fn?this.enqueue([this.dispatch,t,!1,i,r]):this.sendFrame(e.frame(t,i),r)}pong(t,n,r){let o,s;if(typeof t=="string"?(o=Buffer.byteLength(t),s=!1):pi(t)?(o=t.size,s=!1):(t=fa(t),o=t.length,s=fa.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let i={[Tn]:o,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:10,readOnly:s,rsv1:!1};pi(t)?this._state!==Fn?this.enqueue([this.getBlobData,t,!1,i,r]):this.getBlobData(t,!1,i,r):this._state!==Fn?this.enqueue([this.dispatch,t,!1,i,r]):this.sendFrame(e.frame(t,i),r)}send(t,n,r){let o=this._extensions[wj.extensionName],s=n.binary?2:1,i=n.compress,c,d;typeof t=="string"?(c=Buffer.byteLength(t),d=!1):pi(t)?(c=t.size,d=!1):(t=fa(t),c=t.length,d=fa.readOnly),this._firstFragment?(this._firstFragment=!1,i&&o&&o.params[o._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(i=c>=o._threshold),this._compress=i):(i=!1,s=0),n.fin&&(this._firstFragment=!0);let l={[Tn]:c,fin:n.fin,generateMask:this._generateMask,mask:n.mask,maskBuffer:this._maskBuffer,opcode:s,readOnly:d,rsv1:i};pi(t)?this._state!==Fn?this.enqueue([this.getBlobData,t,this._compress,l,r]):this.getBlobData(t,this._compress,l,r):this._state!==Fn?this.enqueue([this.dispatch,t,this._compress,l,r]):this.dispatch(t,this._compress,l,r)}getBlobData(t,n,r,o){this._bufferedBytes+=r[Tn],this._state=S6,t.arrayBuffer().then(s=>{if(this._socket.destroyed){let c=new Error("The socket was closed while the blob was being read");process.nextTick(ty,this,c,o);return}this._bufferedBytes-=r[Tn];let i=fa(s);n?this.dispatch(i,n,r,o):(this._state=Fn,this.sendFrame(e.frame(i,r),o),this.dequeue())}).catch(s=>{process.nextTick(I6,this,s,o)})}dispatch(t,n,r,o){if(!n){this.sendFrame(e.frame(t,r),o);return}let s=this._extensions[wj.extensionName];this._bufferedBytes+=r[Tn],this._state=b6,s.compress(t,r.fin,(i,c)=>{if(this._socket.destroyed){let d=new Error("The socket was closed while data was being compressed");ty(this,d,o);return}this._bufferedBytes-=r[Tn],this._state=Fn,r.readOnly=!1,this.sendFrame(e.frame(c,r),o),this.dequeue()})}dequeue(){for(;this._state===Fn&&this._queue.length;){let t=this._queue.shift();this._bufferedBytes-=t[3][Tn],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][Tn],this._queue.push(t)}sendFrame(t,n){t.length===2?(this._socket.cork(),this._socket.write(t[0]),this._socket.write(t[1],n),this._socket.uncork()):this._socket.write(t[0],n)}};vj.exports=ey;function ty(e,t,n){typeof n=="function"&&n(t);for(let r=0;r<e._queue.length;r++){let o=e._queue[r],s=o[o.length-1];typeof s=="function"&&s(t)}}a(ty,"callCallbacks");function I6(e,t,n){ty(e,t,n),e.onerror(t)}a(I6,"onError")});var Tj=_e((jme,xj)=>{"use strict";var{kForOnEventAttribute:Xc,kListener:ry}=qr(),kj=Symbol("kCode"),bj=Symbol("kData"),Sj=Symbol("kError"),Ij=Symbol("kMessage"),Rj=Symbol("kReason"),fi=Symbol("kTarget"),Pj=Symbol("kType"),_j=Symbol("kWasClean"),Wr=class{static{a(this,"Event")}constructor(t){this[fi]=null,this[Pj]=t}get target(){return this[fi]}get type(){return this[Pj]}};Object.defineProperty(Wr.prototype,"target",{enumerable:!0});Object.defineProperty(Wr.prototype,"type",{enumerable:!0});var ha=class extends Wr{static{a(this,"CloseEvent")}constructor(t,n={}){super(t),this[kj]=n.code===void 0?0:n.code,this[Rj]=n.reason===void 0?"":n.reason,this[_j]=n.wasClean===void 0?!1:n.wasClean}get code(){return this[kj]}get reason(){return this[Rj]}get wasClean(){return this[_j]}};Object.defineProperty(ha.prototype,"code",{enumerable:!0});Object.defineProperty(ha.prototype,"reason",{enumerable:!0});Object.defineProperty(ha.prototype,"wasClean",{enumerable:!0});var gi=class extends Wr{static{a(this,"ErrorEvent")}constructor(t,n={}){super(t),this[Sj]=n.error===void 0?null:n.error,this[Ij]=n.message===void 0?"":n.message}get error(){return this[Sj]}get message(){return this[Ij]}};Object.defineProperty(gi.prototype,"error",{enumerable:!0});Object.defineProperty(gi.prototype,"message",{enumerable:!0});var Qc=class extends Wr{static{a(this,"MessageEvent")}constructor(t,n={}){super(t),this[bj]=n.data===void 0?null:n.data}get data(){return this[bj]}};Object.defineProperty(Qc.prototype,"data",{enumerable:!0});var R6={addEventListener(e,t,n={}){for(let o of this.listeners(e))if(!n[Xc]&&o[ry]===t&&!o[Xc])return;let r;if(e==="message")r=a(function(s,i){let c=new Qc("message",{data:i?s:s.toString()});c[fi]=this,xp(t,this,c)},"onMessage");else if(e==="close")r=a(function(s,i){let c=new ha("close",{code:s,reason:i.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});c[fi]=this,xp(t,this,c)},"onClose");else if(e==="error")r=a(function(s){let i=new gi("error",{error:s,message:s.message});i[fi]=this,xp(t,this,i)},"onError");else if(e==="open")r=a(function(){let s=new Wr("open");s[fi]=this,xp(t,this,s)},"onOpen");else return;r[Xc]=!!n[Xc],r[ry]=t,n.once?this.once(e,r):this.on(e,r)},removeEventListener(e,t){for(let n of this.listeners(e))if(n[ry]===t&&!n[Xc]){this.removeListener(e,n);break}}};xj.exports={CloseEvent:ha,ErrorEvent:gi,Event:Wr,EventTarget:R6,MessageEvent:Qc};function xp(e,t,n){typeof e=="object"&&e.handleEvent?e.handleEvent.call(e,n):e.call(t,n)}a(xp,"callListener")});var Tp=_e((Ome,Aj)=>{"use strict";var{tokenChars:Zc}=ui();function hr(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}a(hr,"push");function P6(e){let t=Object.create(null),n=Object.create(null),r=!1,o=!1,s=!1,i,c,d=-1,l=-1,u=-1,p=0;for(;p<e.length;p++)if(l=e.charCodeAt(p),i===void 0)if(u===-1&&Zc[l]===1)d===-1&&(d=p);else if(p!==0&&(l===32||l===9))u===-1&&d!==-1&&(u=p);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${p}`);u===-1&&(u=p);let f=e.slice(d,u);l===44?(hr(t,f,n),n=Object.create(null)):i=f,d=u=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);else if(c===void 0)if(u===-1&&Zc[l]===1)d===-1&&(d=p);else if(l===32||l===9)u===-1&&d!==-1&&(u=p);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${p}`);u===-1&&(u=p),hr(n,e.slice(d,u),!0),l===44&&(hr(t,i,n),n=Object.create(null),i=void 0),d=u=-1}else if(l===61&&d!==-1&&u===-1)c=e.slice(d,p),d=u=-1;else throw new SyntaxError(`Unexpected character at index ${p}`);else if(o){if(Zc[l]!==1)throw new SyntaxError(`Unexpected character at index ${p}`);d===-1?d=p:r||(r=!0),o=!1}else if(s)if(Zc[l]===1)d===-1&&(d=p);else if(l===34&&d!==-1)s=!1,u=p;else if(l===92)o=!0;else throw new SyntaxError(`Unexpected character at index ${p}`);else if(l===34&&e.charCodeAt(p-1)===61)s=!0;else if(u===-1&&Zc[l]===1)d===-1&&(d=p);else if(d!==-1&&(l===32||l===9))u===-1&&(u=p);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${p}`);u===-1&&(u=p);let f=e.slice(d,u);r&&(f=f.replace(/\\/g,""),r=!1),hr(n,c,f),l===44&&(hr(t,i,n),n=Object.create(null),i=void 0),c=void 0,d=u=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);if(d===-1||s||l===32||l===9)throw new SyntaxError("Unexpected end of input");u===-1&&(u=p);let m=e.slice(d,u);return i===void 0?hr(t,m,n):(c===void 0?hr(n,m,!0):r?hr(n,c,m.replace(/\\/g,"")):hr(n,c,m),hr(t,i,n)),t}a(P6,"parse");function _6(e){return Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(r=>[t].concat(Object.keys(r).map(o=>{let s=r[o];return Array.isArray(s)||(s=[s]),s.map(i=>i===!0?o:`${o}=${i}`).join("; ")})).join("; ")).join(", ")}).join(", ")}a(_6,"format");Aj.exports={format:_6,parse:P6}});var Mp=_e((Lme,Fj)=>{"use strict";var x6=Re("events"),T6=Re("https"),A6=Re("http"),Mj=Re("net"),C6=Re("tls"),{randomBytes:E6,createHash:M6}=Re("crypto"),{Duplex:Bme,Readable:$me}=Re("stream"),{URL:oy}=Re("url"),Co=li(),j6=Zw(),H6=ny(),{isBlob:O6}=ui(),{BINARY_TYPES:Cj,CLOSE_TIMEOUT:D6,EMPTY_BUFFER:Ap,GUID:B6,kForOnEventAttribute:ay,kListener:$6,kStatusCode:L6,kWebSocket:pt,NOOP:jj}=qr(),{EventTarget:{addEventListener:N6,removeEventListener:F6}}=Tj(),{format:U6,parse:q6}=Tp(),{toBuffer:z6}=Kc(),Hj=Symbol("kAborted"),sy=[8,13],Vr=["CONNECTING","OPEN","CLOSING","CLOSED"],W6=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,ze=class e extends x6{static{a(this,"WebSocket")}constructor(t,n,r){super(),this._binaryType=Cj[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Ap,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,n===void 0?n=[]:Array.isArray(n)||(typeof n=="object"&&n!==null?(r=n,n=[]):n=[n]),Oj(this,t,n,r)):(this._autoPong=r.autoPong,this._closeTimeout=r.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(t){Cj.includes(t)&&(this._binaryType=t,this._receiver&&(this._receiver._binaryType=t))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,n,r){let o=new j6({allowSynchronousEvents:r.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:r.maxBufferedChunks,maxFragments:r.maxFragments,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation}),s=new H6(t,this._extensions,r.generateMask);this._receiver=o,this._sender=s,this._socket=t,o[pt]=this,s[pt]=this,t[pt]=this,o.on("conclude",G6),o.on("drain",K6),o.on("error",Y6),o.on("message",X6),o.on("ping",Q6),o.on("pong",Z6),s.onerror=e5,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),n.length>0&&t.unshift(n),t.on("close",$j),t.on("data",Ep),t.on("end",Lj),t.on("error",Nj),this._readyState=e.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[Co.extensionName]&&this._extensions[Co.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(t,n){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){dn(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=e.CLOSING,this._sender.close(t,n,!this._isServer,r=>{r||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Bj(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,n,r){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(r=t,t=n=void 0):typeof n=="function"&&(r=n,n=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){iy(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.ping(t||Ap,n,r)}pong(t,n,r){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(r=t,t=n=void 0):typeof n=="function"&&(r=n,n=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){iy(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.pong(t||Ap,n,r)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,n,r){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof n=="function"&&(r=n,n={}),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){iy(this,t,r);return}let o={binary:typeof t!="string",mask:!this._isServer,compress:!0,fin:!0,...n};this._extensions[Co.extensionName]||(o.compress=!1),this._sender.send(t||Ap,o,r)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){dn(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(ze,"CONNECTING",{enumerable:!0,value:Vr.indexOf("CONNECTING")});Object.defineProperty(ze.prototype,"CONNECTING",{enumerable:!0,value:Vr.indexOf("CONNECTING")});Object.defineProperty(ze,"OPEN",{enumerable:!0,value:Vr.indexOf("OPEN")});Object.defineProperty(ze.prototype,"OPEN",{enumerable:!0,value:Vr.indexOf("OPEN")});Object.defineProperty(ze,"CLOSING",{enumerable:!0,value:Vr.indexOf("CLOSING")});Object.defineProperty(ze.prototype,"CLOSING",{enumerable:!0,value:Vr.indexOf("CLOSING")});Object.defineProperty(ze,"CLOSED",{enumerable:!0,value:Vr.indexOf("CLOSED")});Object.defineProperty(ze.prototype,"CLOSED",{enumerable:!0,value:Vr.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(ze.prototype,e,{enumerable:!0})});["open","error","close","message"].forEach(e=>{Object.defineProperty(ze.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[ay])return t[$6];return null},set(t){for(let n of this.listeners(e))if(n[ay]){this.removeListener(e,n);break}typeof t=="function"&&this.addEventListener(e,t,{[ay]:!0})}})});ze.prototype.addEventListener=N6;ze.prototype.removeEventListener=F6;Fj.exports=ze;function Oj(e,t,n,r){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:D6,protocolVersion:sy[1],maxBufferedChunks:262144,maxFragments:16384,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...r,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(e._autoPong=o.autoPong,e._closeTimeout=o.closeTimeout,!sy.includes(o.protocolVersion))throw new RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${sy.join(", ")})`);let s;if(t instanceof oy)s=t;else try{s=new oy(t)}catch{throw new SyntaxError(`Invalid URL: ${t}`)}s.protocol==="http:"?s.protocol="ws:":s.protocol==="https:"&&(s.protocol="wss:"),e._url=s.href;let i=s.protocol==="wss:",c=s.protocol==="ws+unix:",d;if(s.protocol!=="ws:"&&!i&&!c?d=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:c&&!s.pathname?d="The URL's pathname is empty":s.hash&&(d="The URL contains a fragment identifier"),d){let h=new SyntaxError(d);if(e._redirects===0)throw h;Cp(e,h);return}let l=i?443:80,u=E6(16).toString("base64"),p=i?T6.request:A6.request,m=new Set,f;if(o.createConnection=o.createConnection||(i?J6:V6),o.defaultPort=o.defaultPort||l,o.port=s.port||l,o.host=s.hostname.startsWith("[")?s.hostname.slice(1,-1):s.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":u,Connection:"Upgrade",Upgrade:"websocket"},o.path=s.pathname+s.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(f=new Co({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers["Sec-WebSocket-Extensions"]=U6({[Co.extensionName]:f.offer()})),n.length){for(let h of n){if(typeof h!="string"||!W6.test(h)||m.has(h))throw new SyntaxError("An invalid or duplicated subprotocol was specified");m.add(h)}o.headers["Sec-WebSocket-Protocol"]=n.join(",")}if(o.origin&&(o.protocolVersion<13?o.headers["Sec-WebSocket-Origin"]=o.origin:o.headers.Origin=o.origin),(s.username||s.password)&&(o.auth=`${s.username}:${s.password}`),c){let h=o.path.split(":");o.socketPath=h[0],o.path=h[1]}let y;if(o.followRedirects){if(e._redirects===0){e._originalIpc=c,e._originalSecure=i,e._originalHostOrSocketPath=c?o.socketPath:s.host;let h=r&&r.headers;if(r={...r,headers:{}},h)for(let[v,g]of Object.entries(h))r.headers[v.toLowerCase()]=g}else if(e.listenerCount("redirect")===0){let h=c?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:s.host===e._originalHostOrSocketPath;(!h||e._originalSecure&&!i)&&(delete o.headers.authorization,delete o.headers.cookie,h||delete o.headers.host,o.auth=void 0)}o.auth&&!r.headers.authorization&&(r.headers.authorization="Basic "+Buffer.from(o.auth).toString("base64")),y=e._req=p(o),e._redirects&&e.emit("redirect",e.url,y)}else y=e._req=p(o);o.timeout&&y.on("timeout",()=>{dn(e,y,"Opening handshake has timed out")}),y.on("error",h=>{y===null||y[Hj]||(y=e._req=null,Cp(e,h))}),y.on("response",h=>{let v=h.headers.location,g=h.statusCode;if(v&&o.followRedirects&&g>=300&&g<400){if(++e._redirects>o.maxRedirects){dn(e,y,"Maximum redirects exceeded");return}y.abort();let b;try{b=new oy(v,t)}catch{let k=new SyntaxError(`Invalid URL: ${v}`);Cp(e,k);return}Oj(e,b,n,r)}else e.emit("unexpected-response",y,h)||dn(e,y,`Unexpected server response: ${h.statusCode}`)}),y.on("upgrade",(h,v,g)=>{if(e.emit("upgrade",h),e.readyState!==ze.CONNECTING)return;y=e._req=null;let b=h.headers.upgrade;if(b===void 0||b.toLowerCase()!=="websocket"){dn(e,v,"Invalid Upgrade header");return}let S=M6("sha1").update(u+B6).digest("base64");if(h.headers["sec-websocket-accept"]!==S){dn(e,v,"Invalid Sec-WebSocket-Accept header");return}let k=h.headers["sec-websocket-protocol"],w;if(k!==void 0?m.size?m.has(k)||(w="Server sent an invalid subprotocol"):w="Server sent a subprotocol but none was requested":m.size&&(w="Server sent no subprotocol"),w){dn(e,v,w);return}k&&(e._protocol=k);let x=h.headers["sec-websocket-extensions"];if(x!==void 0){if(!f){dn(e,v,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let C;try{C=q6(x)}catch{dn(e,v,"Invalid Sec-WebSocket-Extensions header");return}let I=Object.keys(C);if(I.length!==1||I[0]!==Co.extensionName){dn(e,v,"Server indicated an extension that was not requested");return}try{f.accept(C[Co.extensionName])}catch{dn(e,v,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[Co.extensionName]=f}e.setSocket(v,g,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxBufferedChunks:o.maxBufferedChunks,maxFragments:o.maxFragments,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(y,e):y.end()}a(Oj,"initAsClient");function Cp(e,t){e._readyState=ze.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}a(Cp,"emitErrorAndClose");function V6(e){return e.path=e.socketPath,Mj.connect(e)}a(V6,"netConnect");function J6(e){return e.path=void 0,!e.servername&&e.servername!==""&&(e.servername=Mj.isIP(e.host)?"":e.host),C6.connect(e)}a(J6,"tlsConnect");function dn(e,t,n){e._readyState=ze.CLOSING;let r=new Error(n);Error.captureStackTrace(r,dn),t.setHeader?(t[Hj]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(Cp,e,r)):(t.destroy(r),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}a(dn,"abortHandshake");function iy(e,t,n){if(t){let r=O6(t)?t.size:z6(t).length;e._socket?e._sender._bufferedBytes+=r:e._bufferedAmount+=r}if(n){let r=new Error(`WebSocket is not open: readyState ${e.readyState} (${Vr[e.readyState]})`);process.nextTick(n,r)}}a(iy,"sendAfterClose");function G6(e,t){let n=this[pt];n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[pt]!==void 0&&(n._socket.removeListener("data",Ep),process.nextTick(Dj,n._socket),e===1005?n.close():n.close(e,t))}a(G6,"receiverOnConclude");function K6(){let e=this[pt];e.isPaused||e._socket.resume()}a(K6,"receiverOnDrain");function Y6(e){let t=this[pt];t._socket[pt]!==void 0&&(t._socket.removeListener("data",Ep),process.nextTick(Dj,t._socket),t.close(e[L6])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}a(Y6,"receiverOnError");function Ej(){this[pt].emitClose()}a(Ej,"receiverOnFinish");function X6(e,t){this[pt].emit("message",e,t)}a(X6,"receiverOnMessage");function Q6(e){let t=this[pt];t._autoPong&&t.pong(e,!this._isServer,jj),t.emit("ping",e)}a(Q6,"receiverOnPing");function Z6(e){this[pt].emit("pong",e)}a(Z6,"receiverOnPong");function Dj(e){e.resume()}a(Dj,"resume");function e5(e){let t=this[pt];t.readyState!==ze.CLOSED&&(t.readyState===ze.OPEN&&(t._readyState=ze.CLOSING,Bj(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}a(e5,"senderOnError");function Bj(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}a(Bj,"setCloseTimer");function $j(){let e=this[pt];if(this.removeListener("close",$j),this.removeListener("data",Ep),this.removeListener("end",Lj),e._readyState=ze.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[pt]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",Ej),e._receiver.on("finish",Ej))}a($j,"socketOnClose");function Ep(e){this[pt]._receiver.write(e)||this.pause()}a(Ep,"socketOnData");function Lj(){let e=this[pt];e._readyState=ze.CLOSING,e._receiver.end(),this.end()}a(Lj,"socketOnEnd");function Nj(){let e=this[pt];this.removeListener("error",Nj),this.on("error",jj),e&&(e._readyState=ze.CLOSING,this.destroy())}a(Nj,"socketOnError")});var Wj=_e((Ume,zj)=>{"use strict";var Fme=Mp(),{Duplex:t5}=Re("stream");function Uj(e){e.emit("close")}a(Uj,"emitClose");function n5(){!this.destroyed&&this._writableState.finished&&this.destroy()}a(n5,"duplexOnEnd");function qj(e){this.removeListener("error",qj),this.destroy(),this.listenerCount("error")===0&&this.emit("error",e)}a(qj,"duplexOnError");function r5(e,t){let n=!0,r=new t5({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",a(function(s,i){let c=!i&&r._readableState.objectMode?s.toString():s;r.push(c)||e.pause()},"message")),e.once("error",a(function(s){r.destroyed||(n=!1,r.destroy(s))},"error")),e.once("close",a(function(){r.destroyed||r.push(null)},"close")),r._destroy=function(o,s){if(e.readyState===e.CLOSED){s(o),process.nextTick(Uj,r);return}let i=!1;e.once("error",a(function(d){i=!0,s(d)},"error")),e.once("close",a(function(){i||s(o),process.nextTick(Uj,r)},"close")),n&&e.terminate()},r._final=function(o){if(e.readyState===e.CONNECTING){e.once("open",a(function(){r._final(o)},"open"));return}e._socket!==null&&(e._socket._writableState.finished?(o(),r._readableState.endEmitted&&r.destroy()):(e._socket.once("finish",a(function(){o()},"finish")),e.close()))},r._read=function(){e.isPaused&&e.resume()},r._write=function(o,s,i){if(e.readyState===e.CONNECTING){e.once("open",a(function(){r._write(o,s,i)},"open"));return}e.send(o,i)},r.on("end",n5),r.on("error",qj),r}a(r5,"createWebSocketStream");zj.exports=r5});var cy=_e((zme,Vj)=>{"use strict";var{tokenChars:o5}=ui();function a5(e){let t=new Set,n=-1,r=-1,o=0;for(o;o<e.length;o++){let i=e.charCodeAt(o);if(r===-1&&o5[i]===1)n===-1&&(n=o);else if(o!==0&&(i===32||i===9))r===-1&&n!==-1&&(r=o);else if(i===44){if(n===-1)throw new SyntaxError(`Unexpected character at index ${o}`);r===-1&&(r=o);let c=e.slice(n,r);if(t.has(c))throw new SyntaxError(`The "${c}" subprotocol is duplicated`);t.add(c),n=r=-1}else throw new SyntaxError(`Unexpected character at index ${o}`)}if(n===-1||r!==-1)throw new SyntaxError("Unexpected end of input");let s=e.slice(n,o);if(t.has(s))throw new SyntaxError(`The "${s}" subprotocol is duplicated`);return t.add(s),t}a(a5,"parse");Vj.exports={parse:a5}});var Zj=_e((Jme,Qj)=>{"use strict";var s5=Re("events"),jp=Re("http"),{Duplex:Vme}=Re("stream"),{createHash:i5}=Re("crypto"),Jj=Tp(),wa=li(),c5=cy(),d5=Mp(),{CLOSE_TIMEOUT:l5,GUID:u5,kWebSocket:p5}=qr(),m5=/^[+/0-9A-Za-z]{22}==$/,Gj=0,Kj=1,Xj=2,dy=class extends s5{static{a(this,"WebSocketServer")}constructor(t,n){if(super(),t={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:256*1024,maxFragments:16*1024,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:l5,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:d5,...t},t.port==null&&!t.server&&!t.noServer||t.port!=null&&(t.server||t.noServer)||t.server&&t.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(t.port!=null?(this._server=jp.createServer((r,o)=>{let s=jp.STATUS_CODES[426];o.writeHead(426,{"Content-Length":s.length,"Content-Type":"text/plain"}),o.end(s)}),this._server.listen(t.port,t.host,t.backlog,n)):t.server&&(this._server=t.server),this._server){let r=this.emit.bind(this,"connection");this._removeListeners=f5(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:a((o,s,i)=>{this.handleUpgrade(o,s,i,r)},"upgrade")})}t.perMessageDeflate===!0&&(t.perMessageDeflate={}),t.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=t,this._state=Gj}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(t){if(this._state===Xj){t&&this.once("close",()=>{t(new Error("The server is not running"))}),process.nextTick(ed,this);return}if(t&&this.once("close",t),this._state!==Kj)if(this._state=Kj,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(ed,this):process.nextTick(ed,this);else{let n=this._server;this._removeListeners(),this._removeListeners=this._server=null,n.close(()=>{ed(this)})}}shouldHandle(t){if(this.options.path){let n=t.url.indexOf("?");if((n!==-1?t.url.slice(0,n):t.url)!==this.options.path)return!1}return!0}handleUpgrade(t,n,r,o){n.on("error",Yj);let s=t.headers["sec-websocket-key"],i=t.headers.upgrade,c=+t.headers["sec-websocket-version"];if(t.method!=="GET"){ya(this,t,n,405,"Invalid HTTP method");return}if(i===void 0||i.toLowerCase()!=="websocket"){ya(this,t,n,400,"Invalid Upgrade header");return}if(s===void 0||!m5.test(s)){ya(this,t,n,400,"Missing or invalid Sec-WebSocket-Key header");return}if(c!==13&&c!==8){ya(this,t,n,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(t)){td(n,400);return}let d=t.headers["sec-websocket-protocol"],l=new Set;if(d!==void 0)try{l=c5.parse(d)}catch{ya(this,t,n,400,"Invalid Sec-WebSocket-Protocol header");return}let u=t.headers["sec-websocket-extensions"],p={};if(this.options.perMessageDeflate&&u!==void 0){let m=new wa({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let f=Jj.parse(u);f[wa.extensionName]&&(m.accept(f[wa.extensionName]),p[wa.extensionName]=m)}catch{ya(this,t,n,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let m={origin:t.headers[`${c===8?"sec-websocket-origin":"origin"}`],secure:!!(t.socket.authorized||t.socket.encrypted),req:t};if(this.options.verifyClient.length===2){this.options.verifyClient(m,(f,y,h,v)=>{if(!f)return td(n,y||401,h,v);this.completeUpgrade(p,s,l,t,n,r,o)});return}if(!this.options.verifyClient(m))return td(n,401)}this.completeUpgrade(p,s,l,t,n,r,o)}completeUpgrade(t,n,r,o,s,i,c){if(!s.readable||!s.writable)return s.destroy();if(s[p5])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Gj)return td(s,503);let l=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${i5("sha1").update(n+u5).digest("base64")}`],u=new this.options.WebSocket(null,void 0,this.options);if(r.size){let p=this.options.handleProtocols?this.options.handleProtocols(r,o):r.values().next().value;p&&(l.push(`Sec-WebSocket-Protocol: ${p}`),u._protocol=p)}if(t[wa.extensionName]){let p=t[wa.extensionName].params,m=Jj.format({[wa.extensionName]:[p]});l.push(`Sec-WebSocket-Extensions: ${m}`),u._extensions=t}this.emit("headers",l,o),s.write(l.concat(`\r
|
|
4
4
|
`).join(`\r
|
|
5
5
|
`)),s.removeListener("error",Yj),u.setSocket(s,i,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxBufferedChunks:this.options.maxBufferedChunks,maxFragments:this.options.maxFragments,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(u),u.on("close",()=>{this.clients.delete(u),this._shouldEmitClose&&!this.clients.size&&process.nextTick(ed,this)})),c(u,o)}};Qj.exports=dy;function f5(e,t){for(let n of Object.keys(t))e.on(n,t[n]);return a(function(){for(let r of Object.keys(t))e.removeListener(r,t[r])},"removeListeners")}a(f5,"addListeners");function ed(e){e._state=Xj,e.emit("close")}a(ed,"emitClose");function Yj(){this.destroy()}a(Yj,"socketOnError");function td(e,t,n,r){n=n||jp.STATUS_CODES[t],r={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(n),...r},e.once("finish",e.destroy),e.end(`HTTP/1.1 ${t} ${jp.STATUS_CODES[t]}\r
|
|
6
6
|
`+Object.keys(r).map(o=>`${o}: ${r[o]}`).join(`\r
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-
|
|
2
|
+
import{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-RQLWYR5B.js";import"./chunk-ADMQIREX.js";import"./chunk-FTQLQJQV.js";export{a as MACOS_GIT_MISSING_DEVELOPER_TOOLS_ERROR,C as appWorkspacePaths,B as assertSafeBranchName,d as checkWorkspaceGitAvailability,J as checkoutBranch,K as checkoutBranchAtPath,M as clearWorkspaceDiffCacheForTests,D as cloneWorkspace,H as createAndCheckoutBranch,I as createAndCheckoutBranchAtPath,A as expectedRemoteUrl,t as isGeneratedWorkspacePath,i as isGitRepo,c as isMacOSGitDeveloperToolsMissing,u as isVisibleGitWorkspaceFile,r as isWorkspaceDirectory,E as lastFetchAt,z as listPlainWorkspaceFiles,P as loadGitCommitDiffAtPath,N as loadWorkspaceDiff,O as loadWorkspaceDiffAtPath,Q as loadWorkspaceFile,T as loadWorkspaceFileAtPath,R as loadWorkspaceImageFile,S as loadWorkspaceImageFileAtPath,F as loadWorkspaceState,G as loadWorkspaceStateAtPath,n as localVideoContentType,L as mapWorkspaceDiffEntriesWithConcurrency,s as normalizeWorkspaceFilePath,w as parseBranchStatusLine,x as parseNumstat,v as parseStatusLine,h as pathExists,p as readLocalImageFile,q as readLocalVideoFile,l as readWorkspaceDocumentPreview,k as readWorkspaceFile,o as readWorkspaceImageFile,g as redactRemoteUrl,b as runWorkspaceCommand,f as sourceFromRemote,e as startMacOSCommandLineToolsInstall,j as truncatePatch,y as uniqueSortedPaths,m as workspaceImageContentType};
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
3
|
-
import{a as m,b as l}from"./chunks/chunk-ZVOO7FKM.js";import"./chunks/chunk-GLUWATL5.js";import{b as u}from"./chunks/chunk-QOR55VHT.js";import{a as c,j as d}from"./chunks/chunk-5N6YRABR.js";import{f as s}from"./chunks/chunk-3M53YXEI.js";import{a as i}from"./chunks/chunk-FTQLQJQV.js";function f(e){return!e.command&&s(e.options.version)?"version":s(e.options.checkUpdate)?"check-update":!e.command&&s(e.options.help)?"help":!e.command&&s(e.options.tui)?"tui":e.command?"command":"ui"}i(f,"resolveCliTopLevelAction");async function v(e=process.argv.slice(2)){if(await C(e))return;let{command:r,options:o,rest:t}=u(e);typeof o.home=="string"&&(process.env.OPENPOND_HOME=(await import("./chunks/dist-UA2RQUA4.js")).resolveOpenPondHome({home:o.home}));let n=f({command:r,options:o});if(n==="version"){console.log(c());return}if(n==="check-update"){await(await import("./chunks/core-commands-2S4UQPXW.js")).runCheckUpdate();return}if(n==="help"){(await import("./chunks/help-N25BKIHM.js")).printHelp();return}let a=m(o),p=l(o);if(a&&(process.env.OPENPOND_ACCOUNT=a),p&&(process.env.OPENPOND_BASE_URL=p),n==="tui"){await(await import("./chunks/app-layer-SFV6ZPKZ.js")).runOpenPondTerminalCommand(o,t);return}if(n==="ui"){await(await import("./chunks/app-layer-SFV6ZPKZ.js")).runOpenPondServerCommand("web",o,t);return}await d({command:r,options:o,rest:t})||((await import("./chunks/help-N25BKIHM.js")).printHelp(),process.exit(1))}i(v,"runOpenPondCli");async function C(e){if(e[0]==="__app-server"){process.argv=[process.execPath,"openpond-app-server",...e.slice(1)];let[{createOpenPondAppServer:r},{runOpenPondAppServerCli:o}]=await Promise.all([import("./chunks/app-server-runtime-
|
|
3
|
+
import{a as m,b as l}from"./chunks/chunk-ZVOO7FKM.js";import"./chunks/chunk-GLUWATL5.js";import{b as u}from"./chunks/chunk-QOR55VHT.js";import{a as c,j as d}from"./chunks/chunk-5N6YRABR.js";import{f as s}from"./chunks/chunk-3M53YXEI.js";import{a as i}from"./chunks/chunk-FTQLQJQV.js";function f(e){return!e.command&&s(e.options.version)?"version":s(e.options.checkUpdate)?"check-update":!e.command&&s(e.options.help)?"help":!e.command&&s(e.options.tui)?"tui":e.command?"command":"ui"}i(f,"resolveCliTopLevelAction");async function v(e=process.argv.slice(2)){if(await C(e))return;let{command:r,options:o,rest:t}=u(e);typeof o.home=="string"&&(process.env.OPENPOND_HOME=(await import("./chunks/dist-UA2RQUA4.js")).resolveOpenPondHome({home:o.home}));let n=f({command:r,options:o});if(n==="version"){console.log(c());return}if(n==="check-update"){await(await import("./chunks/core-commands-2S4UQPXW.js")).runCheckUpdate();return}if(n==="help"){(await import("./chunks/help-N25BKIHM.js")).printHelp();return}let a=m(o),p=l(o);if(a&&(process.env.OPENPOND_ACCOUNT=a),p&&(process.env.OPENPOND_BASE_URL=p),n==="tui"){await(await import("./chunks/app-layer-SFV6ZPKZ.js")).runOpenPondTerminalCommand(o,t);return}if(n==="ui"){await(await import("./chunks/app-layer-SFV6ZPKZ.js")).runOpenPondServerCommand("web",o,t);return}await d({command:r,options:o,rest:t})||((await import("./chunks/help-N25BKIHM.js")).printHelp(),process.exit(1))}i(v,"runOpenPondCli");async function C(e){if(e[0]==="__app-server"){process.argv=[process.execPath,"openpond-app-server",...e.slice(1)];let[{createOpenPondAppServer:r},{runOpenPondAppServerCli:o}]=await Promise.all([import("./chunks/app-server-runtime-RBWHBX7T.js"),import("./chunks/cli-3LLBTPP5.js")]);return await o(r),!0}if(e[0]==="__server"){process.argv=[process.execPath,"openpond-server",...e.slice(1)];let[{createOpenPondServer:r},{runOpenPondServerCli:o}]=await Promise.all([import("./chunks/src-KNUCNVBC.js"),import("./chunks/cli-3LLBTPP5.js")]),{createOpenPondAppServer:t}=await import("./chunks/app-server-runtime-RBWHBX7T.js");return await o({createOpenPondServer:r,createOpenPondAppServer:t}),!0}return e[0]==="__terminal"?(await(await import("./chunks/src-BC7WOVGF.js")).runOpenPondTerminalCli(e.slice(1)),!0):!1}i(C,"runEmbeddedCompanion");v().catch(e=>{let r=e instanceof Error?e.message:String(e),o=e.issue;if(process.argv.includes("--json")&&!(e instanceof Error&&e.name==="OpenPondChildProcessExitError"))console.log(JSON.stringify({error:o??{code:"CLI_ERROR",message:r}}));else if(o&&typeof o=="object"){let n=o;console.error(`${n.code}: ${n.message}
|
|
4
4
|
${n.path}
|
|
5
5
|
${n.action}`)}else console.error(r);let t=typeof e.exitCode=="number"?e.exitCode:1;process.exit(t)});export{v as runOpenPondCli};
|