openpond 0.2.2 → 0.2.4

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.
@@ -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-RAKJWIYO.js";import"./chunk-VYUMTRB3.js";import"./chunk-7D2LMRP7.js";import"./chunk-KV2IXO2T.js";import"./chunk-AF57BF75.js";import"./chunk-GPZYIVFV.js";import"./chunk-6MI4KKWF.js";import"./chunk-SDO4FC4Q.js";import"./chunk-IR3YJWPW.js";import"./chunk-6FA3GG5B.js";import"./chunk-KDXLNQNF.js";import"./chunk-XAYIETBO.js";import"./chunk-FYCJSUFV.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};
2
+ import{i as a,j as b,k as c}from"./chunk-SFCXYOXL.js";import"./chunk-VYUMTRB3.js";import"./chunk-V5CGBGTX.js";import"./chunk-KV2IXO2T.js";import"./chunk-AF57BF75.js";import"./chunk-GPZYIVFV.js";import"./chunk-6MI4KKWF.js";import"./chunk-SDO4FC4Q.js";import"./chunk-IR3YJWPW.js";import"./chunk-6FA3GG5B.js";import"./chunk-KDXLNQNF.js";import"./chunk-XAYIETBO.js";import"./chunk-FYCJSUFV.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{$ as cx,$a as me,$b as lh,A as T_,Aa as Nx,Ab as ch,Ac as Er,B as A_,Ba as lo,Bb as TT,Bc as gh,C as C_,Ca as Fx,Cb as AT,Cc as gA,D as O_,Da as Ux,Db as CT,Dc as hA,E as V_,Ea as sh,Eb as ET,Ec as Pu,F as J_,Fa as qx,Fb as MT,Fc as Ms,G as G_,Ga as Rc,Gb as jT,Gc as wA,H as K_,Ha as zx,Hb as HT,Hc as _u,I as Y_,Ia as Cs,Ib as OT,Ic as yA,J as X_,Ja as Wx,Jb as DT,Jc as vA,K as Q_,Ka as Vx,Kb as BT,Kc as kA,L as Z_,La as Jx,Lb as $T,Lc as bA,M as ex,Ma as Gx,Mb as LT,Mc as SA,N as du,Na as ne,Nb as NT,Nc as IA,O as tx,Oa as Kx,Ob as FT,Oc as RA,P as lu,Pa as Yx,Pb as UT,Pc as PA,Q as nx,Qa as wu,Qb as qT,Qc as _A,R as rx,Ra as Xx,Rb as Su,Rc as xA,S as ox,Sa as Qx,Sb as zT,Sc as TA,T as Rs,Ta as Zx,Tb as ra,Tc as AA,U as uu,Ua as eT,Ub as Iu,V as kc,Va as tT,Vb as WT,Vc as CA,W as th,Wa as yu,Wb as po,X as na,Xa as nT,Xb as Ru,Y as ax,Ya as uo,Yb as VT,Z as sx,Za as _e,Zb as JT,_ as ix,_a as rT,_b as dh,a as vS,aa as dx,ab as oT,ac as GT,b as kS,ba as lx,bb as aT,bc as KT,c as bS,ca as ux,cb as sT,cc as YT,d as SS,da as pu,db as iT,dc as XT,e as IS,ea as mu,eb as cT,ec as uh,f as _l,fa as Ps,fb as dT,fc as QT,g as ZS,ga as px,gb as lT,gc as ph,h as eI,ha as fu,hb as uT,hc as ZT,i as tI,ia as mx,ib as pT,ic as eA,j as nI,ja as Sc,jb as mT,jc as tA,k as rI,ka as xx,kb as fT,kc as nA,l as Ag,la as Tx,lb as Es,lc as rA,m as sI,ma as Ax,mb as Dn,mc as oA,n as iI,na as Cx,nb as Ee,nc as aA,o as cI,oa as Ex,ob as gT,oc as sA,p as dI,pa as Ic,pb as hT,pc as iA,q as lI,qa as Mx,qb as wT,qc as cA,r as uI,ra as jx,rb as yT,rc as mh,s as Yo,sa as Ts,sb as bT,sc as dA,t as pI,ta as As,tb as ST,tc as fh,u as mI,ua as Hx,ub as bu,uc as lA,v as Al,va as Ox,vb as IT,vc as uA,w as fI,wa as Dx,wb as RT,wc as pA,x as gI,xa as Bx,xb as PT,xc as mA,y as $2,ya as $x,yb as _T,yc as fA,z as x_,za as Lx,zb as xT,zc as mo}from"./chunk-KJYNLFWD.js";import{A as kx,C as gu,F as hu,G as lr,H as bx,I as nh,J as Sx,K as rh,N as Ix,O as oh,P as Rx,Q as Px,R as _x,S as ah,T as xs,b as dr,d as fx,e as gx,h as hx,m as _s,n as wx,p as yx,q as vx,s as bc}from"./chunk-J7WZSLHS.js";import{a as EA,b as MA,c as jA,d as H,e as HA,f as fo,g as W,h as xu,j as OA}from"./chunk-RAKJWIYO.js";import{a as ft,b as E_,c as M_,f as j_,q as H_,s as ih,t as vT,u as vu,v as ku,w as kT}from"./chunk-VYUMTRB3.js";import{a as P_,b as su,d as ie,e as st,f as Is,g as te,i as __}from"./chunk-7D2LMRP7.js";import{a as on,b as D_,c as B_,d as iu,e as cu,g as $_,h as L_,i as N_,j as F_,k as U_,l as q_,m as z_,n as W_}from"./chunk-KV2IXO2T.js";import"./chunk-XEOEKFG6.js";import{$a as VR,$b as _P,$c as eu,A as iR,Aa as ql,Ab as cP,Ad as i_,B as cR,Ba as AR,Bc as Yg,Bd as Cr,C as dR,Ca as Fg,Cb as dP,Cc as UP,Cd as c_,D as Bl,Db as lP,Dc as qP,Dd as d_,E as lR,Ea as CR,Eb as uP,Ed as l_,F as Dg,Fd as io,G as uR,Ga as ER,Gb as ws,Gc as Xl,Gd as bs,H as pR,Hb as pP,Hc as zP,Hd as tu,I as xt,Ia as zl,Ic as Xg,Id as u_,J as Dt,Ja as MR,Jb as gc,Jc as ir,Jd as p_,K as $l,Kb as Gl,Kc as WP,Kd as m_,L as mR,La as jR,Lb as mP,Lc as VP,Ld as yc,M as fR,Ma as HR,Mb as zg,Mc as Qg,Md as Ss,N as gR,Na as OR,Nb as fP,Nc as wc,Nd as nu,Oa as DR,Ob as gP,Oc as JP,Od as f_,P as hR,Pa as BR,Pb as Wg,Pc as Ql,Pd as ru,Q as wR,Qa as $R,Qb as hP,Qc as GP,Qd as co,R as On,Ra as LR,Rb as wP,Rc as KP,Rd as g_,Sa as NR,Sb as yP,Sc as ys,Sd as h_,Ta as FR,Tb as vP,Tc as YP,Td as w_,Ua as so,Ub as kP,Uc as vs,Ud as ou,V as yR,Vb as bP,Vc as XP,Vd as y_,Wa as UR,Wb as SP,Wc as QP,Wd as vc,X as Ll,Xa as qR,Xb as Vg,Xc as Zg,Xd as v_,Y as Bg,Ya as zR,Yb as IP,Yc as Zl,Yd as k_,Z as Nl,Za as WR,Zb as RP,Zc as ZP,_ as vR,_b as PP,_c as He,aa as $g,ab as Wl,ac as Jg,ad as e_,ba as kR,bb as JR,bc as xP,bd as t_,c as GI,ca as Bt,cb as GR,cc as TP,cd as n_,da as Xo,db as KR,dc as AP,dd as eh,ea as Qo,eb as YR,ec as CP,ed as r_,fa as Lg,fb as XR,fc as EP,fd as o_,fe as au,ga as bR,gb as QR,gc as MP,gd as a_,ge as b_,ha as SR,hb as ZR,hc as jP,he as S_,ia as IR,ib as eP,ic as HP,id as ks,ie as cr,ja as RR,jb as tP,jc as OP,jd as s_,je as I_,ka as PR,kb as nP,kc as DP,ke as ta,l as KI,la as _R,lb as rP,lc as Gg,le as R_,m as YI,ma as Fl,mb as oP,mc as Zo,n as XI,nb as aP,nc as BP,o as QI,oa as Ul,ob as Ug,oc as $P,p as ZI,pb as Vl,pc as LP,qb as sP,rb as sr,rc as Kl,s as eR,sb as Ar,sc as NP,t as tR,tb as qg,u as nR,ub as Jl,uc as FP,v as rR,va as xR,vb as iP,vc as hc,w as oR,wb as $t,wc as Kg,x as Og,xa as TR,xb as mc,y as aR,ya as Ng,z as sR,za as qe,zb as fc,zc as Yl,zd as ea}from"./chunk-AF57BF75.js";import{$ as US,$b as AI,$c as WI,Ac as DI,Bc as Mg,Ca as KS,Cc as BI,Dc as $I,E as TS,Ea as xg,Ec as LI,F as AS,Fa as Ce,Fc as NI,G as CS,Ga as Ko,Gc as ao,H as yn,Ha as Qe,Hc as FI,Ib as RI,Ic as ar,Jc as UI,K as ES,Kb as PI,L as Sl,La as YS,Lb as _I,M as MS,N as jS,Nc as qI,O as HS,Oa as uc,Oc as zI,P as OS,Pa as XS,Pc as gs,Qa as Pl,Sa as QS,T as DS,Ta as Tg,Tb as xI,U as BS,Ua as ms,V as $S,W as LS,Wb as TI,X as NS,Y as Il,Ya as xl,Z as _g,Zc as hs,_ as FS,_a as oI,_c as pc,aa as qS,ad as VI,bd as JI,dc as Eg,dd as jg,e as RS,ea as zS,eb as Tl,ec as CI,fb as aI,fd as Hg,ga as ps,gb as hI,hb as Cl,hc as EI,ic as Ml,ja as WS,jc as jl,kb as Cg,kc as MI,la as VS,lb as wI,mb as yI,mc as jI,nb as vI,ob as El,p as PS,pb as kI,q as _S,qb as bI,r as Jt,rb as SI,s as kl,sb as II,ta as Hn,ua as JS,uc as fs,v as Tr,va as Rl,vc as HI,w as lc,wa as rn,wc as OI,x as Pg,xc as Hl,y as bl,yc as Ol,z as xS,za as GS,zc as Dl}from"./chunk-GPZYIVFV.js";import"./chunk-6MI4KKWF.js";import"./chunk-SDO4FC4Q.js";import"./chunk-IR3YJWPW.js";import{a as dc}from"./chunk-6FA3GG5B.js";import{D as us,E as cc,F as vl,d as yl,m as wS,n as oo,o as Je,p as yS}from"./chunk-NVGMZ2IN.js";import"./chunk-KDXLNQNF.js";import{Ca as lS,Cb as fS,Fa as uS,Ga as pS,Lb as gS,Ma as wl,Nb as hS,S as gl,Ta as mS,a as nn,qa as iS,ra as hl,sa as cS,va as dS,vb as Ge,wb as Vt}from"./chunk-XAYIETBO.js";import{$a as Go,Ca as tS,Ea as Ig,F as Sg,Fa as Rg,Ga as nS,N as Vb,R as no,T as Jb,Ta as ml,Ua as rS,V as Gb,W as Kb,X as Yb,Ya as oS,Za as aS,ab as sS,bb as fl,f as sl,k as Vo,l as $b,m as ic,n as _r,o as ll,p as Lb,pa as ro,q as ul,r as Nb,ra as Jo,s as cs,u as Fb,v as Ub,w as qb,wa as Xb,x as zb,xa as Qb,y as Wb,ya as Zb,za as eS}from"./chunk-FYCJSUFV.js";import{a as ss,b as is,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 Db,o as Bb,p as dl,q as _t}from"./chunk-HZP5U2AA.js";import{a as Wo,b as P}from"./chunk-ES2ISFJC.js";import{a as jb,c as zo,f as Hb,h as al,i as Ob,p as ds,q as pl,r as xr,s as ls}from"./chunk-H7IWJN7L.js";import{a,b as Ie,c as Pe,e as or}from"./chunk-FTQLQJQV.js";var Ur=Pe((ome,X0)=>{"use strict";var K0=["nodebuffer","arraybuffer","fragments"],Y0=typeof Blob<"u";Y0&&K0.push("blob");X0.exports={BINARY_TYPES:K0,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:Y0,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:a(()=>{},"NOOP")}});var Kc=Pe((sme,kp)=>{"use strict";var{EMPTY_BUFFER:FG}=Ur(),qw=Buffer[Symbol.species];function UG(e,t){if(e.length===0)return FG;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(UG,"concat");function Q0(e,t,n,r,o){for(let s=0;s<o;s++)n[r+s]=e[s]^t[s&3]}a(Q0,"_mask");function Z0(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}a(Z0,"_unmask");function qG(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}a(qG,"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:UG,mask:Q0,toArrayBuffer:qG,toBuffer:zw,unmask:Z0};if(!process.env.WS_NO_BUFFER_UTIL)try{let e=Ie("bufferutil");kp.exports.mask=function(t,n,r,o,s){s<48?Q0(t,n,r,o,s):e.mask(t,n,r,o,s)},kp.exports.unmask=function(t,n){t.length<32?Z0(t,n):e.unmask(t,n)}}catch{}});var nj=Pe((cme,tj)=>{"use strict";var ej=Symbol("kDone"),Ww=Symbol("kRun"),Vw=class{static{a(this,"Limiter")}constructor(t){this[ej]=()=>{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[ej])}}};tj.exports=Vw});var di=Pe((lme,sj)=>{"use strict";var Yc=Ie("zlib"),rj=Kc(),zG=nj(),{kStatusCode:oj}=Ur(),WG=Buffer[Symbol.species],VG=Buffer.from([0,0,255,255]),Sp=Symbol("permessage-deflate"),qr=Symbol("total-length"),ii=Symbol("callback"),To=Symbol("buffers"),ci=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 zG(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[ii];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[qr]=0,this._inflate[To]=[],this._inflate.on("error",GG),this._inflate.on("data",aj)}this._inflate[ii]=r,this._inflate.write(t),n&&this._inflate.write(VG),this._inflate.flush(()=>{let s=this._inflate[ci];if(s){this._inflate.close(),this._inflate=null,r(s);return}let i=rj.concat(this._inflate[To],this._inflate[qr]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[qr]=0,this._inflate[To]=[],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[qr]=0,this._deflate[To]=[],this._deflate.on("data",JG)}this._deflate[ii]=r,this._deflate.write(t),this._deflate.flush(Yc.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let s=rj.concat(this._deflate[To],this._deflate[qr]);n&&(s=new WG(s.buffer,s.byteOffset,s.length-4)),this._deflate[ii]=null,this._deflate[qr]=0,this._deflate[To]=[],n&&this.params[`${o}_no_context_takeover`]&&this._deflate.reset(),r(null,s)})}};sj.exports=Jw;function JG(e){this[To].push(e),this[qr]+=e.length}a(JG,"deflateOnData");function aj(e){if(this[qr]+=e.length,this[Sp]._maxPayload<1||this[qr]<=this[Sp]._maxPayload){this[To].push(e);return}this[ci]=new RangeError("Max payload size exceeded"),this[ci].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[ci][oj]=1009,this.removeListener("data",aj),this.reset()}a(aj,"inflateOnData");function GG(e){if(this[Sp]._inflate=null,this[ci]){this[ii](this[ci]);return}e[oj]=1007,this[ii](e)}a(GG,"inflateOnError")});var li=Pe((pme,Ip)=>{"use strict";var{isUtf8:ij}=Ie("buffer"),{hasBlob:KG}=Ur(),YG=[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 XG(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}a(XG,"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 QG(e){return KG&&typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}a(QG,"isBlob");Ip.exports={isBlob:QG,isValidStatusCode:XG,isValidUTF8:Gw,tokenChars:YG};if(ij)Ip.exports.isValidUTF8=function(e){return e.length<24?Gw(e):ij(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=Ie("utf-8-validate");Ip.exports.isValidUTF8=function(t){return t.length<32?Gw(t):e(t)}}catch{}});var Zw=Pe((fme,fj)=>{"use strict";var{Writable:ZG}=Ie("stream"),cj=di(),{BINARY_TYPES:e6,EMPTY_BUFFER:dj,kStatusCode:t6,kWebSocket:n6}=Ur(),{concat:Kw,toArrayBuffer:r6,unmask:o6}=Kc(),{isValidStatusCode:a6,isValidUTF8:lj}=li(),Rp=Buffer[Symbol.species],_n=0,uj=1,pj=2,mj=3,Yw=4,Xw=5,Pp=6,Qw=class extends ZG{static{a(this,"Receiver")}constructor(t={}){super(),this._allowSynchronousEvents=t.allowSynchronousEvents!==void 0?t.allowSynchronousEvents:!0,this._binaryType=t.binaryType||e6[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[n6]=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=_n}_write(t,n,r){if(this._opcode===8&&this._state==_n)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 _n:this.getInfo(t);break;case uj:this.getPayloadLength16(t);break;case pj:this.getPayloadLength64(t);break;case mj: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[cj.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=uj:this._payloadLength===127?this._state=pj: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=mj:this._state=Yw}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Yw}getData(t){let n=dj;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&&o6(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[cj.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===_n&&this.startLoop(n)})}dataMessage(t){if(!this._fin){this._state=_n;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=r6(Kw(r,n)):this._binaryType==="blob"?o=new Blob(r):o=r,this._allowSynchronousEvents?(this.emit("message",o,!0),this._state=_n):(this._state=Pp,setImmediate(()=>{this.emit("message",o,!0),this._state=_n,this.startLoop(t)}))}else{let o=Kw(r,n);if(!this._skipUTF8Validation&&!lj(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=_n):(this._state=Pp,setImmediate(()=>{this.emit("message",o,!1),this._state=_n,this.startLoop(t)}))}}controlMessage(t,n){if(this._opcode===8){if(t.length===0)this._loop=!1,this.emit("conclude",1005,dj),this.end();else{let r=t.readUInt16BE(0);if(!a6(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&&!lj(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=_n;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",t),this._state=_n):(this._state=Pp,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",t),this._state=_n,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[t6]=o,i}};fj.exports=Qw});var ny=Pe((wme,wj)=>{"use strict";var{Duplex:hme}=Ie("stream"),{randomFillSync:s6}=Ie("crypto"),{types:{isUint8Array:i6}}=Ie("util"),gj=di(),{EMPTY_BUFFER:c6,kWebSocket:d6,NOOP:l6}=Ur(),{isBlob:ui,isValidStatusCode:u6}=li(),{mask:hj,toBuffer:fa}=Kc(),xn=Symbol("kByteLength"),p6=Buffer.alloc(4),_p=8*1024,ga,pi=_p,Nn=0,m6=1,f6=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=Nn,this.onerror=l6,this[d6]=void 0}static frame(t,n){let r,o=!1,s=2,i=!1;n.mask&&(r=n.maskBuffer||p6,n.generateMask?n.generateMask(r):(pi===_p&&(ga===void 0&&(ga=Buffer.alloc(_p)),s6(ga,0,_p),pi=0),r[0]=ga[pi++],r[1]=ga[pi++],r[2]=ga[pi++],r[3]=ga[pi++]),i=(r[0]|r[1]|r[2]|r[3])===0,s=6);let c;typeof t=="string"?(!n.mask||i)&&n[xn]!==void 0?c=n[xn]:(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?(hj(t,r,l,s,c),[l]):(hj(t,r,t,0,c),[l,t])):[l,t]}close(t,n,r,o){let s;if(t===void 0)s=c6;else{if(typeof t!="number"||!u6(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(i6(n))s.set(n,2);else throw new TypeError("Second argument must be a string or a Uint8Array")}}let i={[xn]:s.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==Nn?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):ui(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={[xn]:o,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:9,readOnly:s,rsv1:!1};ui(t)?this._state!==Nn?this.enqueue([this.getBlobData,t,!1,i,r]):this.getBlobData(t,!1,i,r):this._state!==Nn?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):ui(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={[xn]:o,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:10,readOnly:s,rsv1:!1};ui(t)?this._state!==Nn?this.enqueue([this.getBlobData,t,!1,i,r]):this.getBlobData(t,!1,i,r):this._state!==Nn?this.enqueue([this.dispatch,t,!1,i,r]):this.sendFrame(e.frame(t,i),r)}send(t,n,r){let o=this._extensions[gj.extensionName],s=n.binary?2:1,i=n.compress,c,d;typeof t=="string"?(c=Buffer.byteLength(t),d=!1):ui(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={[xn]:c,fin:n.fin,generateMask:this._generateMask,mask:n.mask,maskBuffer:this._maskBuffer,opcode:s,readOnly:d,rsv1:i};ui(t)?this._state!==Nn?this.enqueue([this.getBlobData,t,this._compress,l,r]):this.getBlobData(t,this._compress,l,r):this._state!==Nn?this.enqueue([this.dispatch,t,this._compress,l,r]):this.dispatch(t,this._compress,l,r)}getBlobData(t,n,r,o){this._bufferedBytes+=r[xn],this._state=f6,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[xn];let i=fa(s);n?this.dispatch(i,n,r,o):(this._state=Nn,this.sendFrame(e.frame(i,r),o),this.dequeue())}).catch(s=>{process.nextTick(g6,this,s,o)})}dispatch(t,n,r,o){if(!n){this.sendFrame(e.frame(t,r),o);return}let s=this._extensions[gj.extensionName];this._bufferedBytes+=r[xn],this._state=m6,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[xn],this._state=Nn,r.readOnly=!1,this.sendFrame(e.frame(c,r),o),this.dequeue()})}dequeue(){for(;this._state===Nn&&this._queue.length;){let t=this._queue.shift();this._bufferedBytes-=t[3][xn],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][xn],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)}};wj.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 g6(e,t,n){ty(e,t,n),e.onerror(t)}a(g6,"onError")});var _j=Pe((vme,Pj)=>{"use strict";var{kForOnEventAttribute:Xc,kListener:ry}=Ur(),yj=Symbol("kCode"),vj=Symbol("kData"),kj=Symbol("kError"),bj=Symbol("kMessage"),Sj=Symbol("kReason"),mi=Symbol("kTarget"),Ij=Symbol("kType"),Rj=Symbol("kWasClean"),zr=class{static{a(this,"Event")}constructor(t){this[mi]=null,this[Ij]=t}get target(){return this[mi]}get type(){return this[Ij]}};Object.defineProperty(zr.prototype,"target",{enumerable:!0});Object.defineProperty(zr.prototype,"type",{enumerable:!0});var ha=class extends zr{static{a(this,"CloseEvent")}constructor(t,n={}){super(t),this[yj]=n.code===void 0?0:n.code,this[Sj]=n.reason===void 0?"":n.reason,this[Rj]=n.wasClean===void 0?!1:n.wasClean}get code(){return this[yj]}get reason(){return this[Sj]}get wasClean(){return this[Rj]}};Object.defineProperty(ha.prototype,"code",{enumerable:!0});Object.defineProperty(ha.prototype,"reason",{enumerable:!0});Object.defineProperty(ha.prototype,"wasClean",{enumerable:!0});var fi=class extends zr{static{a(this,"ErrorEvent")}constructor(t,n={}){super(t),this[kj]=n.error===void 0?null:n.error,this[bj]=n.message===void 0?"":n.message}get error(){return this[kj]}get message(){return this[bj]}};Object.defineProperty(fi.prototype,"error",{enumerable:!0});Object.defineProperty(fi.prototype,"message",{enumerable:!0});var Qc=class extends zr{static{a(this,"MessageEvent")}constructor(t,n={}){super(t),this[vj]=n.data===void 0?null:n.data}get data(){return this[vj]}};Object.defineProperty(Qc.prototype,"data",{enumerable:!0});var h6={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[mi]=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[mi]=this,xp(t,this,c)},"onClose");else if(e==="error")r=a(function(s){let i=new fi("error",{error:s,message:s.message});i[mi]=this,xp(t,this,i)},"onError");else if(e==="open")r=a(function(){let s=new zr("open");s[mi]=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}}};Pj.exports={CloseEvent:ha,ErrorEvent:fi,Event:zr,EventTarget:h6,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=Pe((bme,xj)=>{"use strict";var{tokenChars:Zc}=li();function gr(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}a(gr,"push");function w6(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?(gr(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),gr(n,e.slice(d,u),!0),l===44&&(gr(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),gr(n,c,f),l===44&&(gr(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?gr(t,m,n):(c===void 0?gr(n,m,!0):r?gr(n,c,m.replace(/\\/g,"")):gr(n,c,m),gr(t,i,n)),t}a(w6,"parse");function y6(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(y6,"format");xj.exports={format:y6,parse:w6}});var Mp=Pe((Pme,Lj)=>{"use strict";var v6=Ie("events"),k6=Ie("https"),b6=Ie("http"),Cj=Ie("net"),S6=Ie("tls"),{randomBytes:I6,createHash:R6}=Ie("crypto"),{Duplex:Ime,Readable:Rme}=Ie("stream"),{URL:oy}=Ie("url"),Ao=di(),P6=Zw(),_6=ny(),{isBlob:x6}=li(),{BINARY_TYPES:Tj,CLOSE_TIMEOUT:T6,EMPTY_BUFFER:Ap,GUID:A6,kForOnEventAttribute:ay,kListener:C6,kStatusCode:E6,kWebSocket:lt,NOOP:Ej}=Ur(),{EventTarget:{addEventListener:M6,removeEventListener:j6}}=_j(),{format:H6,parse:O6}=Tp(),{toBuffer:D6}=Kc(),Mj=Symbol("kAborted"),sy=[8,13],Wr=["CONNECTING","OPEN","CLOSING","CLOSED"],B6=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,ze=class e extends v6{static{a(this,"WebSocket")}constructor(t,n,r){super(),this._binaryType=Tj[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]),jj(this,t,n,r)):(this._autoPong=r.autoPong,this._closeTimeout=r.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(t){Tj.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 P6({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 _6(t,this._extensions,r.generateMask);this._receiver=o,this._sender=s,this._socket=t,o[lt]=this,s[lt]=this,t[lt]=this,o.on("conclude",N6),o.on("drain",F6),o.on("error",U6),o.on("message",q6),o.on("ping",z6),o.on("pong",W6),s.onerror=V6,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),n.length>0&&t.unshift(n),t.on("close",Dj),t.on("data",Ep),t.on("end",Bj),t.on("error",$j),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[Ao.extensionName]&&this._extensions[Ao.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){cn(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())}),Oj(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[Ao.extensionName]||(o.compress=!1),this._sender.send(t||Ap,o,r)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){cn(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:Wr.indexOf("CONNECTING")});Object.defineProperty(ze.prototype,"CONNECTING",{enumerable:!0,value:Wr.indexOf("CONNECTING")});Object.defineProperty(ze,"OPEN",{enumerable:!0,value:Wr.indexOf("OPEN")});Object.defineProperty(ze.prototype,"OPEN",{enumerable:!0,value:Wr.indexOf("OPEN")});Object.defineProperty(ze,"CLOSING",{enumerable:!0,value:Wr.indexOf("CLOSING")});Object.defineProperty(ze.prototype,"CLOSING",{enumerable:!0,value:Wr.indexOf("CLOSING")});Object.defineProperty(ze,"CLOSED",{enumerable:!0,value:Wr.indexOf("CLOSED")});Object.defineProperty(ze.prototype,"CLOSED",{enumerable:!0,value:Wr.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[C6];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=M6;ze.prototype.removeEventListener=j6;Lj.exports=ze;function jj(e,t,n,r){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:T6,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=I6(16).toString("base64"),p=i?k6.request:b6.request,m=new Set,f;if(o.createConnection=o.createConnection||(i?L6:$6),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 Ao({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers["Sec-WebSocket-Extensions"]=H6({[Ao.extensionName]:f.offer()})),n.length){for(let h of n){if(typeof h!="string"||!B6.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",()=>{cn(e,y,"Opening handshake has timed out")}),y.on("error",h=>{y===null||y[Mj]||(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){cn(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}jj(e,b,n,r)}else e.emit("unexpected-response",y,h)||cn(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"){cn(e,v,"Invalid Upgrade header");return}let S=R6("sha1").update(u+A6).digest("base64");if(h.headers["sec-websocket-accept"]!==S){cn(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){cn(e,v,w);return}k&&(e._protocol=k);let x=h.headers["sec-websocket-extensions"];if(x!==void 0){if(!f){cn(e,v,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let C;try{C=O6(x)}catch{cn(e,v,"Invalid Sec-WebSocket-Extensions header");return}let I=Object.keys(C);if(I.length!==1||I[0]!==Ao.extensionName){cn(e,v,"Server indicated an extension that was not requested");return}try{f.accept(C[Ao.extensionName])}catch{cn(e,v,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[Ao.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(jj,"initAsClient");function Cp(e,t){e._readyState=ze.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}a(Cp,"emitErrorAndClose");function $6(e){return e.path=e.socketPath,Cj.connect(e)}a($6,"netConnect");function L6(e){return e.path=void 0,!e.servername&&e.servername!==""&&(e.servername=Cj.isIP(e.host)?"":e.host),S6.connect(e)}a(L6,"tlsConnect");function cn(e,t,n){e._readyState=ze.CLOSING;let r=new Error(n);Error.captureStackTrace(r,cn),t.setHeader?(t[Mj]=!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(cn,"abortHandshake");function iy(e,t,n){if(t){let r=x6(t)?t.size:D6(t).length;e._socket?e._sender._bufferedBytes+=r:e._bufferedAmount+=r}if(n){let r=new Error(`WebSocket is not open: readyState ${e.readyState} (${Wr[e.readyState]})`);process.nextTick(n,r)}}a(iy,"sendAfterClose");function N6(e,t){let n=this[lt];n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[lt]!==void 0&&(n._socket.removeListener("data",Ep),process.nextTick(Hj,n._socket),e===1005?n.close():n.close(e,t))}a(N6,"receiverOnConclude");function F6(){let e=this[lt];e.isPaused||e._socket.resume()}a(F6,"receiverOnDrain");function U6(e){let t=this[lt];t._socket[lt]!==void 0&&(t._socket.removeListener("data",Ep),process.nextTick(Hj,t._socket),t.close(e[E6])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}a(U6,"receiverOnError");function Aj(){this[lt].emitClose()}a(Aj,"receiverOnFinish");function q6(e,t){this[lt].emit("message",e,t)}a(q6,"receiverOnMessage");function z6(e){let t=this[lt];t._autoPong&&t.pong(e,!this._isServer,Ej),t.emit("ping",e)}a(z6,"receiverOnPing");function W6(e){this[lt].emit("pong",e)}a(W6,"receiverOnPong");function Hj(e){e.resume()}a(Hj,"resume");function V6(e){let t=this[lt];t.readyState!==ze.CLOSED&&(t.readyState===ze.OPEN&&(t._readyState=ze.CLOSING,Oj(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}a(V6,"senderOnError");function Oj(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}a(Oj,"setCloseTimer");function Dj(){let e=this[lt];if(this.removeListener("close",Dj),this.removeListener("data",Ep),this.removeListener("end",Bj),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[lt]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",Aj),e._receiver.on("finish",Aj))}a(Dj,"socketOnClose");function Ep(e){this[lt]._receiver.write(e)||this.pause()}a(Ep,"socketOnData");function Bj(){let e=this[lt];e._readyState=ze.CLOSING,e._receiver.end(),this.end()}a(Bj,"socketOnEnd");function $j(){let e=this[lt];this.removeListener("error",$j),this.on("error",Ej),e&&(e._readyState=ze.CLOSING,this.destroy())}a($j,"socketOnError")});var qj=Pe((Tme,Uj)=>{"use strict";var xme=Mp(),{Duplex:J6}=Ie("stream");function Nj(e){e.emit("close")}a(Nj,"emitClose");function G6(){!this.destroyed&&this._writableState.finished&&this.destroy()}a(G6,"duplexOnEnd");function Fj(e){this.removeListener("error",Fj),this.destroy(),this.listenerCount("error")===0&&this.emit("error",e)}a(Fj,"duplexOnError");function K6(e,t){let n=!0,r=new J6({...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(Nj,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(Nj,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",G6),r.on("error",Fj),r}a(K6,"createWebSocketStream");Uj.exports=K6});var cy=Pe((Cme,zj)=>{"use strict";var{tokenChars:Y6}=li();function X6(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&&Y6[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(X6,"parse");zj.exports={parse:X6}});var Xj=Pe((jme,Yj)=>{"use strict";var Q6=Ie("events"),jp=Ie("http"),{Duplex:Mme}=Ie("stream"),{createHash:Z6}=Ie("crypto"),Wj=Tp(),wa=di(),e5=cy(),t5=Mp(),{CLOSE_TIMEOUT:n5,GUID:r5,kWebSocket:o5}=Ur(),a5=/^[+/0-9A-Za-z]{22}==$/,Vj=0,Jj=1,Kj=2,dy=class extends Q6{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:n5,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:t5,...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=s5(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=Vj}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===Kj){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!==Jj)if(this._state=Jj,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",Gj);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||!a5.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=e5.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=Wj.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[o5])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Vj)return td(s,503);let l=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${Z6("sha1").update(n+r5).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=Wj.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{$ as cx,$a as me,$b as lh,A as T_,Aa as Nx,Ab as ch,Ac as Er,B as A_,Ba as lo,Bb as TT,Bc as gh,C as C_,Ca as Fx,Cb as AT,Cc as gA,D as O_,Da as Ux,Db as CT,Dc as hA,E as V_,Ea as sh,Eb as ET,Ec as Pu,F as J_,Fa as qx,Fb as MT,Fc as Ms,G as G_,Ga as Rc,Gb as jT,Gc as wA,H as K_,Ha as zx,Hb as HT,Hc as _u,I as Y_,Ia as Cs,Ib as OT,Ic as yA,J as X_,Ja as Wx,Jb as DT,Jc as vA,K as Q_,Ka as Vx,Kb as BT,Kc as kA,L as Z_,La as Jx,Lb as $T,Lc as bA,M as ex,Ma as Gx,Mb as LT,Mc as SA,N as du,Na as ne,Nb as NT,Nc as IA,O as tx,Oa as Kx,Ob as FT,Oc as RA,P as lu,Pa as Yx,Pb as UT,Pc as PA,Q as nx,Qa as wu,Qb as qT,Qc as _A,R as rx,Ra as Xx,Rb as Su,Rc as xA,S as ox,Sa as Qx,Sb as zT,Sc as TA,T as Rs,Ta as Zx,Tb as ra,Tc as AA,U as uu,Ua as eT,Ub as Iu,V as kc,Va as tT,Vb as WT,Vc as CA,W as th,Wa as yu,Wb as po,X as na,Xa as nT,Xb as Ru,Y as ax,Ya as uo,Yb as VT,Z as sx,Za as _e,Zb as JT,_ as ix,_a as rT,_b as dh,a as vS,aa as dx,ab as oT,ac as GT,b as kS,ba as lx,bb as aT,bc as KT,c as bS,ca as ux,cb as sT,cc as YT,d as SS,da as pu,db as iT,dc as XT,e as IS,ea as mu,eb as cT,ec as uh,f as _l,fa as Ps,fb as dT,fc as QT,g as ZS,ga as px,gb as lT,gc as ph,h as eI,ha as fu,hb as uT,hc as ZT,i as tI,ia as mx,ib as pT,ic as eA,j as nI,ja as Sc,jb as mT,jc as tA,k as rI,ka as xx,kb as fT,kc as nA,l as Ag,la as Tx,lb as Es,lc as rA,m as sI,ma as Ax,mb as Dn,mc as oA,n as iI,na as Cx,nb as Ee,nc as aA,o as cI,oa as Ex,ob as gT,oc as sA,p as dI,pa as Ic,pb as hT,pc as iA,q as lI,qa as Mx,qb as wT,qc as cA,r as uI,ra as jx,rb as yT,rc as mh,s as Yo,sa as Ts,sb as bT,sc as dA,t as pI,ta as As,tb as ST,tc as fh,u as mI,ua as Hx,ub as bu,uc as lA,v as Al,va as Ox,vb as IT,vc as uA,w as fI,wa as Dx,wb as RT,wc as pA,x as gI,xa as Bx,xb as PT,xc as mA,y as $2,ya as $x,yb as _T,yc as fA,z as x_,za as Lx,zb as xT,zc as mo}from"./chunk-WJVRQDHW.js";import{A as kx,C as gu,F as hu,G as lr,H as bx,I as nh,J as Sx,K as rh,N as Ix,O as oh,P as Rx,Q as Px,R as _x,S as ah,T as xs,b as dr,d as fx,e as gx,h as hx,m as _s,n as wx,p as yx,q as vx,s as bc}from"./chunk-SE4J5XAW.js";import{a as EA,b as MA,c as jA,d as H,e as HA,f as fo,g as W,h as xu,j as OA}from"./chunk-SFCXYOXL.js";import{a as ft,b as E_,c as M_,f as j_,q as H_,s as ih,t as vT,u as vu,v as ku,w as kT}from"./chunk-VYUMTRB3.js";import{a as P_,b as su,d as ie,e as st,f as Is,g as te,i as __}from"./chunk-V5CGBGTX.js";import{a as on,b as D_,c as B_,d as iu,e as cu,g as $_,h as L_,i as N_,j as F_,k as U_,l as q_,m as z_,n as W_}from"./chunk-KV2IXO2T.js";import"./chunk-XEOEKFG6.js";import{$a as VR,$b as _P,$c as eu,A as iR,Aa as ql,Ab as cP,Ad as i_,B as cR,Ba as AR,Bc as Yg,Bd as Cr,C as dR,Ca as Fg,Cb as dP,Cc as UP,Cd as c_,D as Bl,Db as lP,Dc as qP,Dd as d_,E as lR,Ea as CR,Eb as uP,Ed as l_,F as Dg,Fd as io,G as uR,Ga as ER,Gb as ws,Gc as Xl,Gd as bs,H as pR,Hb as pP,Hc as zP,Hd as tu,I as xt,Ia as zl,Ic as Xg,Id as u_,J as Dt,Ja as MR,Jb as gc,Jc as ir,Jd as p_,K as $l,Kb as Gl,Kc as WP,Kd as m_,L as mR,La as jR,Lb as mP,Lc as VP,Ld as yc,M as fR,Ma as HR,Mb as zg,Mc as Qg,Md as Ss,N as gR,Na as OR,Nb as fP,Nc as wc,Nd as nu,Oa as DR,Ob as gP,Oc as JP,Od as f_,P as hR,Pa as BR,Pb as Wg,Pc as Ql,Pd as ru,Q as wR,Qa as $R,Qb as hP,Qc as GP,Qd as co,R as On,Ra as LR,Rb as wP,Rc as KP,Rd as g_,Sa as NR,Sb as yP,Sc as ys,Sd as h_,Ta as FR,Tb as vP,Tc as YP,Td as w_,Ua as so,Ub as kP,Uc as vs,Ud as ou,V as yR,Vb as bP,Vc as XP,Vd as y_,Wa as UR,Wb as SP,Wc as QP,Wd as vc,X as Ll,Xa as qR,Xb as Vg,Xc as Zg,Xd as v_,Y as Bg,Ya as zR,Yb as IP,Yc as Zl,Yd as k_,Z as Nl,Za as WR,Zb as RP,Zc as ZP,_ as vR,_b as PP,_c as He,aa as $g,ab as Wl,ac as Jg,ad as e_,ba as kR,bb as JR,bc as xP,bd as t_,c as GI,ca as Bt,cb as GR,cc as TP,cd as n_,da as Xo,db as KR,dc as AP,dd as eh,ea as Qo,eb as YR,ec as CP,ed as r_,fa as Lg,fb as XR,fc as EP,fd as o_,fe as au,ga as bR,gb as QR,gc as MP,gd as a_,ge as b_,ha as SR,hb as ZR,hc as jP,he as S_,ia as IR,ib as eP,ic as HP,id as ks,ie as cr,ja as RR,jb as tP,jc as OP,jd as s_,je as I_,ka as PR,kb as nP,kc as DP,ke as ta,l as KI,la as _R,lb as rP,lc as Gg,le as R_,m as YI,ma as Fl,mb as oP,mc as Zo,n as XI,nb as aP,nc as BP,o as QI,oa as Ul,ob as Ug,oc as $P,p as ZI,pb as Vl,pc as LP,qb as sP,rb as sr,rc as Kl,s as eR,sb as Ar,sc as NP,t as tR,tb as qg,u as nR,ub as Jl,uc as FP,v as rR,va as xR,vb as iP,vc as hc,w as oR,wb as $t,wc as Kg,x as Og,xa as TR,xb as mc,y as aR,ya as Ng,z as sR,za as qe,zb as fc,zc as Yl,zd as ea}from"./chunk-AF57BF75.js";import{$ as US,$b as AI,$c as WI,Ac as DI,Bc as Mg,Ca as KS,Cc as BI,Dc as $I,E as TS,Ea as xg,Ec as LI,F as AS,Fa as Ce,Fc as NI,G as CS,Ga as Ko,Gc as ao,H as yn,Ha as Qe,Hc as FI,Ib as RI,Ic as ar,Jc as UI,K as ES,Kb as PI,L as Sl,La as YS,Lb as _I,M as MS,N as jS,Nc as qI,O as HS,Oa as uc,Oc as zI,P as OS,Pa as XS,Pc as gs,Qa as Pl,Sa as QS,T as DS,Ta as Tg,Tb as xI,U as BS,Ua as ms,V as $S,W as LS,Wb as TI,X as NS,Y as Il,Ya as xl,Z as _g,Zc as hs,_ as FS,_a as oI,_c as pc,aa as qS,ad as VI,bd as JI,dc as Eg,dd as jg,e as RS,ea as zS,eb as Tl,ec as CI,fb as aI,fd as Hg,ga as ps,gb as hI,hb as Cl,hc as EI,ic as Ml,ja as WS,jc as jl,kb as Cg,kc as MI,la as VS,lb as wI,mb as yI,mc as jI,nb as vI,ob as El,p as PS,pb as kI,q as _S,qb as bI,r as Jt,rb as SI,s as kl,sb as II,ta as Hn,ua as JS,uc as fs,v as Tr,va as Rl,vc as HI,w as lc,wa as rn,wc as OI,x as Pg,xc as Hl,y as bl,yc as Ol,z as xS,za as GS,zc as Dl}from"./chunk-GPZYIVFV.js";import"./chunk-6MI4KKWF.js";import"./chunk-SDO4FC4Q.js";import"./chunk-IR3YJWPW.js";import{a as dc}from"./chunk-6FA3GG5B.js";import{D as us,E as cc,F as vl,d as yl,m as wS,n as oo,o as Je,p as yS}from"./chunk-NVGMZ2IN.js";import"./chunk-KDXLNQNF.js";import{Ca as lS,Cb as fS,Fa as uS,Ga as pS,Lb as gS,Ma as wl,Nb as hS,S as gl,Ta as mS,a as nn,qa as iS,ra as hl,sa as cS,va as dS,vb as Ge,wb as Vt}from"./chunk-XAYIETBO.js";import{$a as Go,Ca as tS,Ea as Ig,F as Sg,Fa as Rg,Ga as nS,N as Vb,R as no,T as Jb,Ta as ml,Ua as rS,V as Gb,W as Kb,X as Yb,Ya as oS,Za as aS,ab as sS,bb as fl,f as sl,k as Vo,l as $b,m as ic,n as _r,o as ll,p as Lb,pa as ro,q as ul,r as Nb,ra as Jo,s as cs,u as Fb,v as Ub,w as qb,wa as Xb,x as zb,xa as Qb,y as Wb,ya as Zb,za as eS}from"./chunk-FYCJSUFV.js";import{a as ss,b as is,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 Db,o as Bb,p as dl,q as _t}from"./chunk-HZP5U2AA.js";import{a as Wo,b as P}from"./chunk-ES2ISFJC.js";import{a as jb,c as zo,f as Hb,h as al,i as Ob,p as ds,q as pl,r as xr,s as ls}from"./chunk-H7IWJN7L.js";import{a,b as Ie,c as Pe,e as or}from"./chunk-FTQLQJQV.js";var Ur=Pe((ome,X0)=>{"use strict";var K0=["nodebuffer","arraybuffer","fragments"],Y0=typeof Blob<"u";Y0&&K0.push("blob");X0.exports={BINARY_TYPES:K0,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:Y0,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:a(()=>{},"NOOP")}});var Kc=Pe((sme,kp)=>{"use strict";var{EMPTY_BUFFER:FG}=Ur(),qw=Buffer[Symbol.species];function UG(e,t){if(e.length===0)return FG;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(UG,"concat");function Q0(e,t,n,r,o){for(let s=0;s<o;s++)n[r+s]=e[s]^t[s&3]}a(Q0,"_mask");function Z0(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}a(Z0,"_unmask");function qG(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}a(qG,"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:UG,mask:Q0,toArrayBuffer:qG,toBuffer:zw,unmask:Z0};if(!process.env.WS_NO_BUFFER_UTIL)try{let e=Ie("bufferutil");kp.exports.mask=function(t,n,r,o,s){s<48?Q0(t,n,r,o,s):e.mask(t,n,r,o,s)},kp.exports.unmask=function(t,n){t.length<32?Z0(t,n):e.unmask(t,n)}}catch{}});var nj=Pe((cme,tj)=>{"use strict";var ej=Symbol("kDone"),Ww=Symbol("kRun"),Vw=class{static{a(this,"Limiter")}constructor(t){this[ej]=()=>{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[ej])}}};tj.exports=Vw});var di=Pe((lme,sj)=>{"use strict";var Yc=Ie("zlib"),rj=Kc(),zG=nj(),{kStatusCode:oj}=Ur(),WG=Buffer[Symbol.species],VG=Buffer.from([0,0,255,255]),Sp=Symbol("permessage-deflate"),qr=Symbol("total-length"),ii=Symbol("callback"),To=Symbol("buffers"),ci=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 zG(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[ii];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[qr]=0,this._inflate[To]=[],this._inflate.on("error",GG),this._inflate.on("data",aj)}this._inflate[ii]=r,this._inflate.write(t),n&&this._inflate.write(VG),this._inflate.flush(()=>{let s=this._inflate[ci];if(s){this._inflate.close(),this._inflate=null,r(s);return}let i=rj.concat(this._inflate[To],this._inflate[qr]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[qr]=0,this._inflate[To]=[],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[qr]=0,this._deflate[To]=[],this._deflate.on("data",JG)}this._deflate[ii]=r,this._deflate.write(t),this._deflate.flush(Yc.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let s=rj.concat(this._deflate[To],this._deflate[qr]);n&&(s=new WG(s.buffer,s.byteOffset,s.length-4)),this._deflate[ii]=null,this._deflate[qr]=0,this._deflate[To]=[],n&&this.params[`${o}_no_context_takeover`]&&this._deflate.reset(),r(null,s)})}};sj.exports=Jw;function JG(e){this[To].push(e),this[qr]+=e.length}a(JG,"deflateOnData");function aj(e){if(this[qr]+=e.length,this[Sp]._maxPayload<1||this[qr]<=this[Sp]._maxPayload){this[To].push(e);return}this[ci]=new RangeError("Max payload size exceeded"),this[ci].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[ci][oj]=1009,this.removeListener("data",aj),this.reset()}a(aj,"inflateOnData");function GG(e){if(this[Sp]._inflate=null,this[ci]){this[ii](this[ci]);return}e[oj]=1007,this[ii](e)}a(GG,"inflateOnError")});var li=Pe((pme,Ip)=>{"use strict";var{isUtf8:ij}=Ie("buffer"),{hasBlob:KG}=Ur(),YG=[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 XG(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}a(XG,"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 QG(e){return KG&&typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}a(QG,"isBlob");Ip.exports={isBlob:QG,isValidStatusCode:XG,isValidUTF8:Gw,tokenChars:YG};if(ij)Ip.exports.isValidUTF8=function(e){return e.length<24?Gw(e):ij(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=Ie("utf-8-validate");Ip.exports.isValidUTF8=function(t){return t.length<32?Gw(t):e(t)}}catch{}});var Zw=Pe((fme,fj)=>{"use strict";var{Writable:ZG}=Ie("stream"),cj=di(),{BINARY_TYPES:e6,EMPTY_BUFFER:dj,kStatusCode:t6,kWebSocket:n6}=Ur(),{concat:Kw,toArrayBuffer:r6,unmask:o6}=Kc(),{isValidStatusCode:a6,isValidUTF8:lj}=li(),Rp=Buffer[Symbol.species],_n=0,uj=1,pj=2,mj=3,Yw=4,Xw=5,Pp=6,Qw=class extends ZG{static{a(this,"Receiver")}constructor(t={}){super(),this._allowSynchronousEvents=t.allowSynchronousEvents!==void 0?t.allowSynchronousEvents:!0,this._binaryType=t.binaryType||e6[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[n6]=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=_n}_write(t,n,r){if(this._opcode===8&&this._state==_n)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 _n:this.getInfo(t);break;case uj:this.getPayloadLength16(t);break;case pj:this.getPayloadLength64(t);break;case mj: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[cj.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=uj:this._payloadLength===127?this._state=pj: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=mj:this._state=Yw}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Yw}getData(t){let n=dj;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&&o6(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[cj.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===_n&&this.startLoop(n)})}dataMessage(t){if(!this._fin){this._state=_n;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=r6(Kw(r,n)):this._binaryType==="blob"?o=new Blob(r):o=r,this._allowSynchronousEvents?(this.emit("message",o,!0),this._state=_n):(this._state=Pp,setImmediate(()=>{this.emit("message",o,!0),this._state=_n,this.startLoop(t)}))}else{let o=Kw(r,n);if(!this._skipUTF8Validation&&!lj(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=_n):(this._state=Pp,setImmediate(()=>{this.emit("message",o,!1),this._state=_n,this.startLoop(t)}))}}controlMessage(t,n){if(this._opcode===8){if(t.length===0)this._loop=!1,this.emit("conclude",1005,dj),this.end();else{let r=t.readUInt16BE(0);if(!a6(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&&!lj(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=_n;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",t),this._state=_n):(this._state=Pp,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",t),this._state=_n,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[t6]=o,i}};fj.exports=Qw});var ny=Pe((wme,wj)=>{"use strict";var{Duplex:hme}=Ie("stream"),{randomFillSync:s6}=Ie("crypto"),{types:{isUint8Array:i6}}=Ie("util"),gj=di(),{EMPTY_BUFFER:c6,kWebSocket:d6,NOOP:l6}=Ur(),{isBlob:ui,isValidStatusCode:u6}=li(),{mask:hj,toBuffer:fa}=Kc(),xn=Symbol("kByteLength"),p6=Buffer.alloc(4),_p=8*1024,ga,pi=_p,Nn=0,m6=1,f6=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=Nn,this.onerror=l6,this[d6]=void 0}static frame(t,n){let r,o=!1,s=2,i=!1;n.mask&&(r=n.maskBuffer||p6,n.generateMask?n.generateMask(r):(pi===_p&&(ga===void 0&&(ga=Buffer.alloc(_p)),s6(ga,0,_p),pi=0),r[0]=ga[pi++],r[1]=ga[pi++],r[2]=ga[pi++],r[3]=ga[pi++]),i=(r[0]|r[1]|r[2]|r[3])===0,s=6);let c;typeof t=="string"?(!n.mask||i)&&n[xn]!==void 0?c=n[xn]:(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?(hj(t,r,l,s,c),[l]):(hj(t,r,t,0,c),[l,t])):[l,t]}close(t,n,r,o){let s;if(t===void 0)s=c6;else{if(typeof t!="number"||!u6(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(i6(n))s.set(n,2);else throw new TypeError("Second argument must be a string or a Uint8Array")}}let i={[xn]:s.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==Nn?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):ui(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={[xn]:o,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:9,readOnly:s,rsv1:!1};ui(t)?this._state!==Nn?this.enqueue([this.getBlobData,t,!1,i,r]):this.getBlobData(t,!1,i,r):this._state!==Nn?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):ui(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={[xn]:o,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:10,readOnly:s,rsv1:!1};ui(t)?this._state!==Nn?this.enqueue([this.getBlobData,t,!1,i,r]):this.getBlobData(t,!1,i,r):this._state!==Nn?this.enqueue([this.dispatch,t,!1,i,r]):this.sendFrame(e.frame(t,i),r)}send(t,n,r){let o=this._extensions[gj.extensionName],s=n.binary?2:1,i=n.compress,c,d;typeof t=="string"?(c=Buffer.byteLength(t),d=!1):ui(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={[xn]:c,fin:n.fin,generateMask:this._generateMask,mask:n.mask,maskBuffer:this._maskBuffer,opcode:s,readOnly:d,rsv1:i};ui(t)?this._state!==Nn?this.enqueue([this.getBlobData,t,this._compress,l,r]):this.getBlobData(t,this._compress,l,r):this._state!==Nn?this.enqueue([this.dispatch,t,this._compress,l,r]):this.dispatch(t,this._compress,l,r)}getBlobData(t,n,r,o){this._bufferedBytes+=r[xn],this._state=f6,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[xn];let i=fa(s);n?this.dispatch(i,n,r,o):(this._state=Nn,this.sendFrame(e.frame(i,r),o),this.dequeue())}).catch(s=>{process.nextTick(g6,this,s,o)})}dispatch(t,n,r,o){if(!n){this.sendFrame(e.frame(t,r),o);return}let s=this._extensions[gj.extensionName];this._bufferedBytes+=r[xn],this._state=m6,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[xn],this._state=Nn,r.readOnly=!1,this.sendFrame(e.frame(c,r),o),this.dequeue()})}dequeue(){for(;this._state===Nn&&this._queue.length;){let t=this._queue.shift();this._bufferedBytes-=t[3][xn],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][xn],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)}};wj.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 g6(e,t,n){ty(e,t,n),e.onerror(t)}a(g6,"onError")});var _j=Pe((vme,Pj)=>{"use strict";var{kForOnEventAttribute:Xc,kListener:ry}=Ur(),yj=Symbol("kCode"),vj=Symbol("kData"),kj=Symbol("kError"),bj=Symbol("kMessage"),Sj=Symbol("kReason"),mi=Symbol("kTarget"),Ij=Symbol("kType"),Rj=Symbol("kWasClean"),zr=class{static{a(this,"Event")}constructor(t){this[mi]=null,this[Ij]=t}get target(){return this[mi]}get type(){return this[Ij]}};Object.defineProperty(zr.prototype,"target",{enumerable:!0});Object.defineProperty(zr.prototype,"type",{enumerable:!0});var ha=class extends zr{static{a(this,"CloseEvent")}constructor(t,n={}){super(t),this[yj]=n.code===void 0?0:n.code,this[Sj]=n.reason===void 0?"":n.reason,this[Rj]=n.wasClean===void 0?!1:n.wasClean}get code(){return this[yj]}get reason(){return this[Sj]}get wasClean(){return this[Rj]}};Object.defineProperty(ha.prototype,"code",{enumerable:!0});Object.defineProperty(ha.prototype,"reason",{enumerable:!0});Object.defineProperty(ha.prototype,"wasClean",{enumerable:!0});var fi=class extends zr{static{a(this,"ErrorEvent")}constructor(t,n={}){super(t),this[kj]=n.error===void 0?null:n.error,this[bj]=n.message===void 0?"":n.message}get error(){return this[kj]}get message(){return this[bj]}};Object.defineProperty(fi.prototype,"error",{enumerable:!0});Object.defineProperty(fi.prototype,"message",{enumerable:!0});var Qc=class extends zr{static{a(this,"MessageEvent")}constructor(t,n={}){super(t),this[vj]=n.data===void 0?null:n.data}get data(){return this[vj]}};Object.defineProperty(Qc.prototype,"data",{enumerable:!0});var h6={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[mi]=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[mi]=this,xp(t,this,c)},"onClose");else if(e==="error")r=a(function(s){let i=new fi("error",{error:s,message:s.message});i[mi]=this,xp(t,this,i)},"onError");else if(e==="open")r=a(function(){let s=new zr("open");s[mi]=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}}};Pj.exports={CloseEvent:ha,ErrorEvent:fi,Event:zr,EventTarget:h6,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=Pe((bme,xj)=>{"use strict";var{tokenChars:Zc}=li();function gr(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}a(gr,"push");function w6(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?(gr(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),gr(n,e.slice(d,u),!0),l===44&&(gr(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),gr(n,c,f),l===44&&(gr(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?gr(t,m,n):(c===void 0?gr(n,m,!0):r?gr(n,c,m.replace(/\\/g,"")):gr(n,c,m),gr(t,i,n)),t}a(w6,"parse");function y6(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(y6,"format");xj.exports={format:y6,parse:w6}});var Mp=Pe((Pme,Lj)=>{"use strict";var v6=Ie("events"),k6=Ie("https"),b6=Ie("http"),Cj=Ie("net"),S6=Ie("tls"),{randomBytes:I6,createHash:R6}=Ie("crypto"),{Duplex:Ime,Readable:Rme}=Ie("stream"),{URL:oy}=Ie("url"),Ao=di(),P6=Zw(),_6=ny(),{isBlob:x6}=li(),{BINARY_TYPES:Tj,CLOSE_TIMEOUT:T6,EMPTY_BUFFER:Ap,GUID:A6,kForOnEventAttribute:ay,kListener:C6,kStatusCode:E6,kWebSocket:lt,NOOP:Ej}=Ur(),{EventTarget:{addEventListener:M6,removeEventListener:j6}}=_j(),{format:H6,parse:O6}=Tp(),{toBuffer:D6}=Kc(),Mj=Symbol("kAborted"),sy=[8,13],Wr=["CONNECTING","OPEN","CLOSING","CLOSED"],B6=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,ze=class e extends v6{static{a(this,"WebSocket")}constructor(t,n,r){super(),this._binaryType=Tj[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]),jj(this,t,n,r)):(this._autoPong=r.autoPong,this._closeTimeout=r.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(t){Tj.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 P6({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 _6(t,this._extensions,r.generateMask);this._receiver=o,this._sender=s,this._socket=t,o[lt]=this,s[lt]=this,t[lt]=this,o.on("conclude",N6),o.on("drain",F6),o.on("error",U6),o.on("message",q6),o.on("ping",z6),o.on("pong",W6),s.onerror=V6,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),n.length>0&&t.unshift(n),t.on("close",Dj),t.on("data",Ep),t.on("end",Bj),t.on("error",$j),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[Ao.extensionName]&&this._extensions[Ao.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){cn(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())}),Oj(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[Ao.extensionName]||(o.compress=!1),this._sender.send(t||Ap,o,r)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){cn(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:Wr.indexOf("CONNECTING")});Object.defineProperty(ze.prototype,"CONNECTING",{enumerable:!0,value:Wr.indexOf("CONNECTING")});Object.defineProperty(ze,"OPEN",{enumerable:!0,value:Wr.indexOf("OPEN")});Object.defineProperty(ze.prototype,"OPEN",{enumerable:!0,value:Wr.indexOf("OPEN")});Object.defineProperty(ze,"CLOSING",{enumerable:!0,value:Wr.indexOf("CLOSING")});Object.defineProperty(ze.prototype,"CLOSING",{enumerable:!0,value:Wr.indexOf("CLOSING")});Object.defineProperty(ze,"CLOSED",{enumerable:!0,value:Wr.indexOf("CLOSED")});Object.defineProperty(ze.prototype,"CLOSED",{enumerable:!0,value:Wr.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[C6];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=M6;ze.prototype.removeEventListener=j6;Lj.exports=ze;function jj(e,t,n,r){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:T6,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=I6(16).toString("base64"),p=i?k6.request:b6.request,m=new Set,f;if(o.createConnection=o.createConnection||(i?L6:$6),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 Ao({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers["Sec-WebSocket-Extensions"]=H6({[Ao.extensionName]:f.offer()})),n.length){for(let h of n){if(typeof h!="string"||!B6.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",()=>{cn(e,y,"Opening handshake has timed out")}),y.on("error",h=>{y===null||y[Mj]||(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){cn(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}jj(e,b,n,r)}else e.emit("unexpected-response",y,h)||cn(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"){cn(e,v,"Invalid Upgrade header");return}let S=R6("sha1").update(u+A6).digest("base64");if(h.headers["sec-websocket-accept"]!==S){cn(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){cn(e,v,w);return}k&&(e._protocol=k);let x=h.headers["sec-websocket-extensions"];if(x!==void 0){if(!f){cn(e,v,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let C;try{C=O6(x)}catch{cn(e,v,"Invalid Sec-WebSocket-Extensions header");return}let I=Object.keys(C);if(I.length!==1||I[0]!==Ao.extensionName){cn(e,v,"Server indicated an extension that was not requested");return}try{f.accept(C[Ao.extensionName])}catch{cn(e,v,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[Ao.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(jj,"initAsClient");function Cp(e,t){e._readyState=ze.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}a(Cp,"emitErrorAndClose");function $6(e){return e.path=e.socketPath,Cj.connect(e)}a($6,"netConnect");function L6(e){return e.path=void 0,!e.servername&&e.servername!==""&&(e.servername=Cj.isIP(e.host)?"":e.host),S6.connect(e)}a(L6,"tlsConnect");function cn(e,t,n){e._readyState=ze.CLOSING;let r=new Error(n);Error.captureStackTrace(r,cn),t.setHeader?(t[Mj]=!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(cn,"abortHandshake");function iy(e,t,n){if(t){let r=x6(t)?t.size:D6(t).length;e._socket?e._sender._bufferedBytes+=r:e._bufferedAmount+=r}if(n){let r=new Error(`WebSocket is not open: readyState ${e.readyState} (${Wr[e.readyState]})`);process.nextTick(n,r)}}a(iy,"sendAfterClose");function N6(e,t){let n=this[lt];n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[lt]!==void 0&&(n._socket.removeListener("data",Ep),process.nextTick(Hj,n._socket),e===1005?n.close():n.close(e,t))}a(N6,"receiverOnConclude");function F6(){let e=this[lt];e.isPaused||e._socket.resume()}a(F6,"receiverOnDrain");function U6(e){let t=this[lt];t._socket[lt]!==void 0&&(t._socket.removeListener("data",Ep),process.nextTick(Hj,t._socket),t.close(e[E6])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}a(U6,"receiverOnError");function Aj(){this[lt].emitClose()}a(Aj,"receiverOnFinish");function q6(e,t){this[lt].emit("message",e,t)}a(q6,"receiverOnMessage");function z6(e){let t=this[lt];t._autoPong&&t.pong(e,!this._isServer,Ej),t.emit("ping",e)}a(z6,"receiverOnPing");function W6(e){this[lt].emit("pong",e)}a(W6,"receiverOnPong");function Hj(e){e.resume()}a(Hj,"resume");function V6(e){let t=this[lt];t.readyState!==ze.CLOSED&&(t.readyState===ze.OPEN&&(t._readyState=ze.CLOSING,Oj(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}a(V6,"senderOnError");function Oj(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}a(Oj,"setCloseTimer");function Dj(){let e=this[lt];if(this.removeListener("close",Dj),this.removeListener("data",Ep),this.removeListener("end",Bj),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[lt]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",Aj),e._receiver.on("finish",Aj))}a(Dj,"socketOnClose");function Ep(e){this[lt]._receiver.write(e)||this.pause()}a(Ep,"socketOnData");function Bj(){let e=this[lt];e._readyState=ze.CLOSING,e._receiver.end(),this.end()}a(Bj,"socketOnEnd");function $j(){let e=this[lt];this.removeListener("error",$j),this.on("error",Ej),e&&(e._readyState=ze.CLOSING,this.destroy())}a($j,"socketOnError")});var qj=Pe((Tme,Uj)=>{"use strict";var xme=Mp(),{Duplex:J6}=Ie("stream");function Nj(e){e.emit("close")}a(Nj,"emitClose");function G6(){!this.destroyed&&this._writableState.finished&&this.destroy()}a(G6,"duplexOnEnd");function Fj(e){this.removeListener("error",Fj),this.destroy(),this.listenerCount("error")===0&&this.emit("error",e)}a(Fj,"duplexOnError");function K6(e,t){let n=!0,r=new J6({...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(Nj,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(Nj,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",G6),r.on("error",Fj),r}a(K6,"createWebSocketStream");Uj.exports=K6});var cy=Pe((Cme,zj)=>{"use strict";var{tokenChars:Y6}=li();function X6(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&&Y6[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(X6,"parse");zj.exports={parse:X6}});var Xj=Pe((jme,Yj)=>{"use strict";var Q6=Ie("events"),jp=Ie("http"),{Duplex:Mme}=Ie("stream"),{createHash:Z6}=Ie("crypto"),Wj=Tp(),wa=di(),e5=cy(),t5=Mp(),{CLOSE_TIMEOUT:n5,GUID:r5,kWebSocket:o5}=Ur(),a5=/^[+/0-9A-Za-z]{22}==$/,Vj=0,Jj=1,Kj=2,dy=class extends Q6{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:n5,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:t5,...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=s5(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=Vj}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===Kj){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!==Jj)if(this._state=Jj,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",Gj);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||!a5.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=e5.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=Wj.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[o5])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Vj)return td(s,503);let l=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${Z6("sha1").update(n+r5).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=Wj.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",Gj),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)}};Yj.exports=dy;function s5(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(s5,"addListeners");function ed(e){e._state=Kj,e.emit("close")}a(ed,"emitClose");function Gj(){this.destroy()}a(Gj,"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-J7WZSLHS.js";import"./chunk-7D2LMRP7.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};
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-SE4J5XAW.js";import"./chunk-V5CGBGTX.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-I7G35U7K.js";import{a as c,j as d}from"./chunks/chunk-T5XCPX4P.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-NKLXFA37.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-N37UZEVE.js")).runCheckUpdate();return}if(n==="help"){(await import("./chunks/help-HC4N5ZQC.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-GNYLOBCX.js")).runOpenPondTerminalCommand(o,t);return}if(n==="ui"){await(await import("./chunks/app-layer-GNYLOBCX.js")).runOpenPondServerCommand("web",o,t);return}await d({command:r,options:o,rest:t})||((await import("./chunks/help-HC4N5ZQC.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-VAGY4LQS.js"),import("./chunks/cli-UYTSZB4Y.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-EYJF2LWV.js"),import("./chunks/cli-UYTSZB4Y.js")]),{createOpenPondAppServer:t}=await import("./chunks/app-server-runtime-VAGY4LQS.js");return await o({createOpenPondServer:r,createOpenPondAppServer:t}),!0}return e[0]==="__terminal"?(await(await import("./chunks/src-VGW2UEMV.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}
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-I7G35U7K.js";import{a as c,j as d}from"./chunks/chunk-T5XCPX4P.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-NKLXFA37.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-N37UZEVE.js")).runCheckUpdate();return}if(n==="help"){(await import("./chunks/help-HC4N5ZQC.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-GNYLOBCX.js")).runOpenPondTerminalCommand(o,t);return}if(n==="ui"){await(await import("./chunks/app-layer-GNYLOBCX.js")).runOpenPondServerCommand("web",o,t);return}await d({command:r,options:o,rest:t})||((await import("./chunks/help-HC4N5ZQC.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-HUJLAGR5.js"),import("./chunks/cli-OXPCJL6M.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-W6QOW5JR.js"),import("./chunks/cli-OXPCJL6M.js")]),{createOpenPondAppServer:t}=await import("./chunks/app-server-runtime-HUJLAGR5.js");return await o({createOpenPondServer:r,createOpenPondAppServer:t}),!0}return e[0]==="__terminal"?(await(await import("./chunks/src-VGW2UEMV.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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openpond",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "openpondReleaseVersioned": true,
5
5
  "license": "MIT",
6
6
  "description": "OpenPond CLI and local harness",