@gadgetinc/ggt 1.6.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/{add-FGXJSCE2.js → add-ERWYPHIS.js} +2 -2
- package/dist/{chunk-5NCJDCIZ.js → chunk-24OT7GHO.js} +15 -15
- package/dist/{chunk-5NCJDCIZ.js.map → chunk-24OT7GHO.js.map} +3 -3
- package/dist/{chunk-F4S4AEEO.js → chunk-DYAWQS24.js} +2 -2
- package/dist/{chunk-PA2LOSVH.js → chunk-FILWLZUN.js} +2 -2
- package/dist/chunk-GCO2TOVZ.js +50 -0
- package/dist/{chunk-LPBWX353.js.map → chunk-GCO2TOVZ.js.map} +3 -3
- package/dist/{chunk-JHWQLV6Y.js → chunk-ILB6CSBN.js} +2 -2
- package/dist/{chunk-IYQBG4II.js → chunk-JBY5A44K.js} +2 -2
- package/dist/{chunk-YT2LSGNB.js → chunk-JSGXXXFU.js} +2 -2
- package/dist/chunk-KMNQ3LJT.js +12 -0
- package/dist/{chunk-VJVFVZNR.js.map → chunk-KMNQ3LJT.js.map} +1 -1
- package/dist/chunk-KS2O3TJA.js +116 -0
- package/dist/{chunk-I6BQ7MRE.js.map → chunk-KS2O3TJA.js.map} +3 -3
- package/dist/{chunk-2CKK6A2Y.js → chunk-OGQ5LIYM.js} +2 -2
- package/dist/{chunk-2CKK6A2Y.js.map → chunk-OGQ5LIYM.js.map} +1 -1
- package/dist/chunk-QXWICGG6.js +2 -0
- package/dist/{chunk-72YIA2TT.js.map → chunk-QXWICGG6.js.map} +1 -1
- package/dist/{chunk-L2MG47NS.js → chunk-UCJDY73U.js} +2 -2
- package/dist/{chunk-4WFO3NAS.js → chunk-WNAYBYSG.js} +2 -2
- package/dist/{chunk-SIAMHUOB.js → chunk-WZ3Q7TTB.js} +2 -2
- package/dist/{chunk-XK6JJEHJ.js → chunk-XGQQOMPO.js} +2 -2
- package/dist/{configure-L4U26WFP.js → configure-LD5XC2MR.js} +2 -2
- package/dist/{deploy-6JWXSMQJ.js → deploy-7Q7RRIXS.js} +2 -2
- package/dist/{dev-M2PFPQXX.js → dev-MQ76B6CR.js} +2 -2
- package/dist/{list-LNXNHS2W.js → list-YXCTVLRH.js} +2 -2
- package/dist/{list-LNXNHS2W.js.map → list-YXCTVLRH.js.map} +1 -1
- package/dist/login-XIEASAMY.js +2 -0
- package/dist/{logout-JA5JBU3G.js → logout-ACRXIJEF.js} +2 -2
- package/dist/main.js +3 -2
- package/dist/main.js.map +2 -2
- package/dist/{open-TWQBAPIT.js → open-5CYXKN42.js} +2 -2
- package/dist/{pull-VWGETR4M.js → pull-STASHXEL.js} +2 -2
- package/dist/push-6WUPKY5W.js +2 -0
- package/dist/{status-OYEFON4A.js → status-SB22V3DI.js} +2 -2
- package/dist/{version-4QPNJ5VH.js → version-NZHW3VLV.js} +2 -2
- package/dist/{whoami-TIGWXVEY.js → whoami-AA3ISE77.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-72YIA2TT.js +0 -2
- package/dist/chunk-I6BQ7MRE.js +0 -116
- package/dist/chunk-LPBWX353.js +0 -50
- package/dist/chunk-VJVFVZNR.js +0 -12
- package/dist/login-4F3H443A.js +0 -2
- package/dist/push-KWUMHQCJ.js +0 -2
- /package/dist/{add-FGXJSCE2.js.map → add-ERWYPHIS.js.map} +0 -0
- /package/dist/{chunk-F4S4AEEO.js.map → chunk-DYAWQS24.js.map} +0 -0
- /package/dist/{chunk-PA2LOSVH.js.map → chunk-FILWLZUN.js.map} +0 -0
- /package/dist/{chunk-JHWQLV6Y.js.map → chunk-ILB6CSBN.js.map} +0 -0
- /package/dist/{chunk-IYQBG4II.js.map → chunk-JBY5A44K.js.map} +0 -0
- /package/dist/{chunk-YT2LSGNB.js.map → chunk-JSGXXXFU.js.map} +0 -0
- /package/dist/{chunk-L2MG47NS.js.map → chunk-UCJDY73U.js.map} +0 -0
- /package/dist/{chunk-4WFO3NAS.js.map → chunk-WNAYBYSG.js.map} +0 -0
- /package/dist/{chunk-SIAMHUOB.js.map → chunk-WZ3Q7TTB.js.map} +0 -0
- /package/dist/{chunk-XK6JJEHJ.js.map → chunk-XGQQOMPO.js.map} +0 -0
- /package/dist/{configure-L4U26WFP.js.map → configure-LD5XC2MR.js.map} +0 -0
- /package/dist/{deploy-6JWXSMQJ.js.map → deploy-7Q7RRIXS.js.map} +0 -0
- /package/dist/{dev-M2PFPQXX.js.map → dev-MQ76B6CR.js.map} +0 -0
- /package/dist/{login-4F3H443A.js.map → login-XIEASAMY.js.map} +0 -0
- /package/dist/{logout-JA5JBU3G.js.map → logout-ACRXIJEF.js.map} +0 -0
- /package/dist/{open-TWQBAPIT.js.map → open-5CYXKN42.js.map} +0 -0
- /package/dist/{pull-VWGETR4M.js.map → pull-STASHXEL.js.map} +0 -0
- /package/dist/{push-KWUMHQCJ.js.map → push-6WUPKY5W.js.map} +0 -0
- /package/dist/{status-OYEFON4A.js.map → status-SB22V3DI.js.map} +0 -0
- /package/dist/{version-4QPNJ5VH.js.map → version-NZHW3VLV.js.map} +0 -0
- /package/dist/{whoami-TIGWXVEY.js.map → whoami-AA3ISE77.js.map} +0 -0
package/dist/chunk-LPBWX353.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import{a as nn,b as sn,c as on}from"./chunk-F4S4AEEO.js";import{a as Hr,b as rn}from"./chunk-XK6JJEHJ.js";import{J as je,K as Zr,N as ce,T as oe,U as Xr,V as F,W as en,Y as W,a as Wr,aa as Ht,b as zr,ba as Qt,c as Vr,d as ve,e as N,f as Qr,g as vt,ga as _e,h as qe,ha as Et,i as jt,ia as tn,j as Wt,k as zt,m as Vt,o as Yr,w as Kr,x as Jr}from"./chunk-5NCJDCIZ.js";import{a as xt}from"./chunk-GFQYFEEH.js";import{a as o,b as G,d as M,f as re,h}from"./chunk-7DYQUG5M.js";var Yt=M((Na,an)=>{"use strict";h();an.exports=(t,e=process.argv)=>{let r=t.startsWith("-")?"":t.length===1?"-":"--",n=e.indexOf(r+t),i=e.indexOf("--");return n!==-1&&(i===-1||n<i)}});var un=M((Pa,ln)=>{"use strict";h();var vs=G("os"),cn=G("tty"),ue=Yt(),{env:J}=process,$e;ue("no-color")||ue("no-colors")||ue("color=false")||ue("color=never")?$e=0:(ue("color")||ue("colors")||ue("color=true")||ue("color=always"))&&($e=1);"FORCE_COLOR"in J&&(J.FORCE_COLOR==="true"?$e=1:J.FORCE_COLOR==="false"?$e=0:$e=J.FORCE_COLOR.length===0?1:Math.min(parseInt(J.FORCE_COLOR,10),3));function Kt(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}o(Kt,"translateLevel");function Jt(t,e){if($e===0)return 0;if(ue("color=16m")||ue("color=full")||ue("color=truecolor"))return 3;if(ue("color=256"))return 2;if(t&&!e&&$e===void 0)return 0;let r=$e||0;if(J.TERM==="dumb")return r;if(process.platform==="win32"){let n=vs.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in J)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in J)||J.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in J)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(J.TEAMCITY_VERSION)?1:0;if(J.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in J){let n=parseInt((J.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(J.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(J.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(J.TERM)||"COLORTERM"in J?1:r}o(Jt,"supportsColor");function Es(t){let e=Jt(t,t&&t.isTTY);return Kt(e)}o(Es,"getSupportLevel");ln.exports={supportsColor:Es,stdout:Kt(Jt(!0,cn.isatty(1))),stderr:Kt(Jt(!0,cn.isatty(2)))}});var dn=M((Da,hn)=>{"use strict";h();var ws=un(),We=Yt();function fn(t){if(/^\d{3,4}$/.test(t)){let r=/(\d{1,2})(\d{2})/.exec(t)||[];return{major:0,minor:parseInt(r[1],10),patch:parseInt(r[2],10)}}let e=(t||"").split(".").map(r=>parseInt(r,10));return{major:e[0],minor:e[1],patch:e[2]}}o(fn,"parseVersion");function Zt(t){let{CI:e,FORCE_HYPERLINK:r,NETLIFY:n,TEAMCITY_VERSION:i,TERM_PROGRAM:s,TERM_PROGRAM_VERSION:a,VTE_VERSION:u,TERM:c}=process.env;if(r)return!(r.length>0&&parseInt(r,10)===0);if(We("no-hyperlink")||We("no-hyperlinks")||We("hyperlink=false")||We("hyperlink=never"))return!1;if(We("hyperlink=true")||We("hyperlink=always")||n)return!0;if(!ws.supportsColor(t)||t&&!t.isTTY)return!1;if("WT_SESSION"in process.env)return!0;if(process.platform==="win32"||e||i)return!1;if(s){let f=fn(a||"");switch(s){case"iTerm.app":return f.major===3?f.minor>=1:f.major>3;case"WezTerm":return f.major>=20200620;case"vscode":return f.major>1||f.major===1&&f.minor>=72;case"ghostty":return!0}}if(u){if(u==="0.50.0")return!1;let f=fn(u);return f.major>0||f.minor>=50}switch(c){case"alacritty":return!0}return!1}o(Zt,"supportsHyperlink");hn.exports={supportsHyperlink:Zt,stdout:Zt(process.stdout),stderr:Zt(process.stderr)}});var bn=M((tr,rr)=>{h();(function(t,e){typeof tr=="object"&&typeof rr<"u"?rr.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs=e()})(tr,function(){"use strict";var t=1e3,e=6e4,r=36e5,n="millisecond",i="second",s="minute",a="hour",u="day",c="week",f="month",p="quarter",d="year",_="date",l="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,E=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,T={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:o(function(O){var w=["th","st","nd","rd"],v=O%100;return"["+O+(w[(v-20)%10]||w[v]||w[0])+"]"},"ordinal")},R=o(function(O,w,v){var y=String(O);return!y||y.length>=w?O:""+Array(w+1-y.length).join(v)+O},"m"),B={s:R,z:o(function(O){var w=-O.utcOffset(),v=Math.abs(w),y=Math.floor(v/60),g=v%60;return(w<=0?"+":"-")+R(y,2,"0")+":"+R(g,2,"0")},"z"),m:o(function O(w,v){if(w.date()<v.date())return-O(v,w);var y=12*(v.year()-w.year())+(v.month()-w.month()),g=w.clone().add(y,f),b=v-g<0,x=w.clone().add(y+(b?-1:1),f);return+(-(y+(v-g)/(b?g-x:x-g))||0)},"t"),a:o(function(O){return O<0?Math.ceil(O)||0:Math.floor(O)},"a"),p:o(function(O){return{M:f,y:d,w:c,d:u,D:_,h:a,m:s,s:i,ms:n,Q:p}[O]||String(O||"").toLowerCase().replace(/s$/,"")},"p"),u:o(function(O){return O===void 0},"u")},Q="en",C={};C[Q]=T;var z="$isDayjsObject",Y=o(function(O){return O instanceof ee||!(!O||!O[z])},"S"),j=o(function O(w,v,y){var g;if(!w)return Q;if(typeof w=="string"){var b=w.toLowerCase();C[b]&&(g=b),v&&(C[b]=v,g=b);var x=w.split("-");if(!g&&x.length>1)return O(x[0])}else{var S=w.name;C[S]=w,g=S}return!y&&g&&(Q=g),g||!y&&Q},"t"),I=o(function(O,w){if(Y(O))return O.clone();var v=typeof w=="object"?w:{};return v.date=O,v.args=arguments,new ee(v)},"O"),$=B;$.l=j,$.i=Y,$.w=function(O,w){return I(O,{locale:w.$L,utc:w.$u,x:w.$x,$offset:w.$offset})};var ee=function(){function O(v){this.$L=j(v.locale,null,!0),this.parse(v),this.$x=this.$x||v.x||{},this[z]=!0}o(O,"M");var w=O.prototype;return w.parse=function(v){this.$d=function(y){var g=y.date,b=y.utc;if(g===null)return new Date(NaN);if($.u(g))return new Date;if(g instanceof Date)return new Date(g);if(typeof g=="string"&&!/Z$/i.test(g)){var x=g.match(m);if(x){var S=x[2]-1||0,A=(x[7]||"0").substring(0,3);return b?new Date(Date.UTC(x[1],S,x[3]||1,x[4]||0,x[5]||0,x[6]||0,A)):new Date(x[1],S,x[3]||1,x[4]||0,x[5]||0,x[6]||0,A)}}return new Date(g)}(v),this.init()},w.init=function(){var v=this.$d;this.$y=v.getFullYear(),this.$M=v.getMonth(),this.$D=v.getDate(),this.$W=v.getDay(),this.$H=v.getHours(),this.$m=v.getMinutes(),this.$s=v.getSeconds(),this.$ms=v.getMilliseconds()},w.$utils=function(){return $},w.isValid=function(){return this.$d.toString()!==l},w.isSame=function(v,y){var g=I(v);return this.startOf(y)<=g&&g<=this.endOf(y)},w.isAfter=function(v,y){return I(v)<this.startOf(y)},w.isBefore=function(v,y){return this.endOf(y)<I(v)},w.$g=function(v,y,g){return $.u(v)?this[y]:this.set(g,v)},w.unix=function(){return Math.floor(this.valueOf()/1e3)},w.valueOf=function(){return this.$d.getTime()},w.startOf=function(v,y){var g=this,b=!!$.u(y)||y,x=$.p(v),S=o(function(U,te){var ye=$.w(g.$u?Date.UTC(g.$y,te,U):new Date(g.$y,te,U),g);return b?ye:ye.endOf(u)},"l"),A=o(function(U,te){return $.w(g.toDate()[U].apply(g.toDate("s"),(b?[0,0,0,0]:[23,59,59,999]).slice(te)),g)},"$"),k=this.$W,D=this.$M,K=this.$D,de="set"+(this.$u?"UTC":"");switch(x){case d:return b?S(1,0):S(31,11);case f:return b?S(1,D):S(0,D+1);case c:var se=this.$locale().weekStart||0,V=(k<se?k+7:k)-se;return S(b?K-V:K+(6-V),D);case u:case _:return A(de+"Hours",0);case a:return A(de+"Minutes",1);case s:return A(de+"Seconds",2);case i:return A(de+"Milliseconds",3);default:return this.clone()}},w.endOf=function(v){return this.startOf(v,!1)},w.$set=function(v,y){var g,b=$.p(v),x="set"+(this.$u?"UTC":""),S=(g={},g[u]=x+"Date",g[_]=x+"Date",g[f]=x+"Month",g[d]=x+"FullYear",g[a]=x+"Hours",g[s]=x+"Minutes",g[i]=x+"Seconds",g[n]=x+"Milliseconds",g)[b],A=b===u?this.$D+(y-this.$W):y;if(b===f||b===d){var k=this.clone().set(_,1);k.$d[S](A),k.init(),this.$d=k.set(_,Math.min(this.$D,k.daysInMonth())).$d}else S&&this.$d[S](A);return this.init(),this},w.set=function(v,y){return this.clone().$set(v,y)},w.get=function(v){return this[$.p(v)]()},w.add=function(v,y){var g,b=this;v=Number(v);var x=$.p(y),S=o(function(D){var K=I(b);return $.w(K.date(K.date()+Math.round(D*v)),b)},"y");if(x===f)return this.set(f,this.$M+v);if(x===d)return this.set(d,this.$y+v);if(x===u)return S(1);if(x===c)return S(7);var A=(g={},g[s]=e,g[a]=r,g[i]=t,g)[x]||1,k=this.$d.getTime()+v*A;return $.w(k,this)},w.subtract=function(v,y){return this.add(-1*v,y)},w.format=function(v){var y=this,g=this.$locale();if(!this.isValid())return g.invalidDate||l;var b=v||"YYYY-MM-DDTHH:mm:ssZ",x=$.z(this),S=this.$H,A=this.$m,k=this.$M,D=g.weekdays,K=g.months,de=g.meridiem,se=o(function(te,ye,tt,bt){return te&&(te[ye]||te(y,b))||tt[ye].slice(0,bt)},"h"),V=o(function(te){return $.s(S%12||12,te,"0")},"d"),U=de||function(te,ye,tt){var bt=te<12?"AM":"PM";return tt?bt.toLowerCase():bt};return b.replace(E,function(te,ye){return ye||function(tt){switch(tt){case"YY":return String(y.$y).slice(-2);case"YYYY":return $.s(y.$y,4,"0");case"M":return k+1;case"MM":return $.s(k+1,2,"0");case"MMM":return se(g.monthsShort,k,K,3);case"MMMM":return se(K,k);case"D":return y.$D;case"DD":return $.s(y.$D,2,"0");case"d":return String(y.$W);case"dd":return se(g.weekdaysMin,y.$W,D,2);case"ddd":return se(g.weekdaysShort,y.$W,D,3);case"dddd":return D[y.$W];case"H":return String(S);case"HH":return $.s(S,2,"0");case"h":return V(1);case"hh":return V(2);case"a":return U(S,A,!0);case"A":return U(S,A,!1);case"m":return String(A);case"mm":return $.s(A,2,"0");case"s":return String(y.$s);case"ss":return $.s(y.$s,2,"0");case"SSS":return $.s(y.$ms,3,"0");case"Z":return x}return null}(te)||x.replace(":","")})},w.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},w.diff=function(v,y,g){var b,x=this,S=$.p(y),A=I(v),k=(A.utcOffset()-this.utcOffset())*e,D=this-A,K=o(function(){return $.m(x,A)},"D");switch(S){case d:b=K()/12;break;case f:b=K();break;case p:b=K()/3;break;case c:b=(D-k)/6048e5;break;case u:b=(D-k)/864e5;break;case a:b=D/r;break;case s:b=D/e;break;case i:b=D/t;break;default:b=D}return g?b:$.a(b)},w.daysInMonth=function(){return this.endOf(f).$D},w.$locale=function(){return C[this.$L]},w.locale=function(v,y){if(!v)return this.$L;var g=this.clone(),b=j(v,y,!0);return b&&(g.$L=b),g},w.clone=function(){return $.w(this.$d,this)},w.toDate=function(){return new Date(this.valueOf())},w.toJSON=function(){return this.isValid()?this.toISOString():null},w.toISOString=function(){return this.$d.toISOString()},w.toString=function(){return this.$d.toUTCString()},O}(),et=ee.prototype;return I.prototype=et,[["$ms",n],["$s",i],["$m",s],["$H",a],["$W",u],["$M",f],["$y",d],["$D",_]].forEach(function(O){et[O[1]]=function(w){return this.$g(w,O[0],O[1])}}),I.extend=function(O,w){return O.$i||(O(w,ee,I),O.$i=!0),I},I.locale=j,I.isDayjs=Y,I.unix=function(O){return I(1e3*O)},I.en=C[Q],I.Ls=C,I.p={},I})});var vn=M(ze=>{"use strict";h();ze.__esModule=!0;ze.distance=ze.closest=void 0;var Ee=new Uint32Array(65536),Os=o(function(t,e){for(var r=t.length,n=e.length,i=1<<r-1,s=-1,a=0,u=r,c=r;c--;)Ee[t.charCodeAt(c)]|=1<<c;for(c=0;c<n;c++){var f=Ee[e.charCodeAt(c)],p=f|a;f|=(f&s)+s^s,a|=~(f|s),s&=f,a&i&&u++,s&i&&u--,a=a<<1|1,s=s<<1|~(p|a),a&=p}for(c=r;c--;)Ee[t.charCodeAt(c)]=0;return u},"myers_32"),ks=o(function(t,e){for(var r=e.length,n=t.length,i=[],s=[],a=Math.ceil(r/32),u=Math.ceil(n/32),c=0;c<a;c++)s[c]=-1,i[c]=0;for(var f=0;f<u-1;f++){for(var p=0,d=-1,_=f*32,l=Math.min(32,n)+_,m=_;m<l;m++)Ee[t.charCodeAt(m)]|=1<<m;for(var c=0;c<r;c++){var E=Ee[e.charCodeAt(c)],T=s[c/32|0]>>>c&1,R=i[c/32|0]>>>c&1,B=E|p,Q=((E|R)&d)+d^d|E|R,C=p|~(Q|d),z=d&Q;C>>>31^T&&(s[c/32|0]^=1<<c),z>>>31^R&&(i[c/32|0]^=1<<c),C=C<<1|T,z=z<<1|R,d=z|~(B|C),p=C&B}for(var m=_;m<l;m++)Ee[t.charCodeAt(m)]=0}for(var Y=0,j=-1,I=f*32,$=Math.min(32,n-I)+I,m=I;m<$;m++)Ee[t.charCodeAt(m)]|=1<<m;for(var ee=n,c=0;c<r;c++){var E=Ee[e.charCodeAt(c)],T=s[c/32|0]>>>c&1,R=i[c/32|0]>>>c&1,B=E|Y,Q=((E|R)&j)+j^j|E|R,C=Y|~(Q|j),z=j&Q;ee+=C>>>n-1&1,ee-=z>>>n-1&1,C>>>31^T&&(s[c/32|0]^=1<<c),z>>>31^R&&(i[c/32|0]^=1<<c),C=C<<1|T,z=z<<1|R,j=z|~(B|C),Y=C&B}for(var m=I;m<$;m++)Ee[t.charCodeAt(m)]=0;return ee},"myers_x"),xn=o(function(t,e){if(t.length<e.length){var r=e;e=t,t=r}return e.length===0?t.length:t.length<=32?Os(t,e):ks(t,e)},"distance");ze.distance=xn;var Cs=o(function(t,e){for(var r=1/0,n=0,i=0;i<e.length;i++){var s=xn(t,e[i]);s<r&&(r=s,n=i)}return e[n]},"closest");ze.closest=Cs});var En=M((nr,rt)=>{h();(function(){"use strict";var t;try{t=typeof Intl<"u"&&typeof Intl.Collator<"u"?Intl.Collator("generic",{sensitivity:"base"}):null}catch{console.log("Collator could not be initialized and wouldn't be used")}var e=vn(),r=[],n=[],i={get:o(function(s,a,u){var c=u&&t&&u.useCollator;if(c){var f=s.length,p=a.length;if(f===0)return p;if(p===0)return f;var d,_,l,m,E;for(l=0;l<p;++l)r[l]=l,n[l]=a.charCodeAt(l);r[p]=p;var T;for(l=0;l<f;++l){for(_=l+1,m=0;m<p;++m)d=_,T=t.compare(s.charAt(l),String.fromCharCode(n[m]))===0,_=r[m]+(T?0:1),E=d+1,_>E&&(_=E),E=r[m+1]+1,_>E&&(_=E),r[m]=d;r[m]=_}return _}return e.distance(s,a)},"get")};typeof define<"u"&&define!==null&&define.amd?define(function(){return i}):typeof rt<"u"&&rt!==null&&typeof nr<"u"&&rt.exports===nr?rt.exports=i:typeof self<"u"&&typeof self.postMessage=="function"&&typeof self.importScripts=="function"?self.Levenshtein=i:typeof window<"u"&&window!==null&&(window.Levenshtein=i)})()});var Sn=M((sr,or)=>{h();(function(t,e){typeof G=="function"&&typeof sr=="object"&&typeof or=="object"?or.exports=e():typeof define=="function"&&define.amd?define(function(){return e()}):t.pluralize=e()})(sr,function(){var t=[],e=[],r={},n={},i={};function s(l){return typeof l=="string"?new RegExp("^"+l+"$","i"):l}o(s,"sanitizeRule");function a(l,m){return l===m?m:l===l.toLowerCase()?m.toLowerCase():l===l.toUpperCase()?m.toUpperCase():l[0]===l[0].toUpperCase()?m.charAt(0).toUpperCase()+m.substr(1).toLowerCase():m.toLowerCase()}o(a,"restoreCase");function u(l,m){return l.replace(/\$(\d{1,2})/g,function(E,T){return m[T]||""})}o(u,"interpolate");function c(l,m){return l.replace(m[0],function(E,T){var R=u(m[1],arguments);return a(E===""?l[T-1]:E,R)})}o(c,"replace");function f(l,m,E){if(!l.length||r.hasOwnProperty(l))return m;for(var T=E.length;T--;){var R=E[T];if(R[0].test(m))return c(m,R)}return m}o(f,"sanitizeWord");function p(l,m,E){return function(T){var R=T.toLowerCase();return m.hasOwnProperty(R)?a(T,R):l.hasOwnProperty(R)?a(T,l[R]):f(R,T,E)}}o(p,"replaceWord");function d(l,m,E,T){return function(R){var B=R.toLowerCase();return m.hasOwnProperty(B)?!0:l.hasOwnProperty(B)?!1:f(B,B,E)===B}}o(d,"checkWord");function _(l,m,E){var T=m===1?_.singular(l):_.plural(l);return(E?m+" ":"")+T}return o(_,"pluralize"),_.plural=p(i,n,t),_.isPlural=d(i,n,t),_.singular=p(n,i,e),_.isSingular=d(n,i,e),_.addPluralRule=function(l,m){t.push([s(l),m])},_.addSingularRule=function(l,m){e.push([s(l),m])},_.addUncountableRule=function(l){if(typeof l=="string"){r[l.toLowerCase()]=!0;return}_.addPluralRule(l,"$0"),_.addSingularRule(l,"$0")},_.addIrregularRule=function(l,m){m=m.toLowerCase(),l=l.toLowerCase(),i[l]=m,n[m]=l},[["I","we"],["me","us"],["he","they"],["she","they"],["them","them"],["myself","ourselves"],["yourself","yourselves"],["itself","themselves"],["herself","themselves"],["himself","themselves"],["themself","themselves"],["is","are"],["was","were"],["has","have"],["this","these"],["that","those"],["echo","echoes"],["dingo","dingoes"],["volcano","volcanoes"],["tornado","tornadoes"],["torpedo","torpedoes"],["genus","genera"],["viscus","viscera"],["stigma","stigmata"],["stoma","stomata"],["dogma","dogmata"],["lemma","lemmata"],["schema","schemata"],["anathema","anathemata"],["ox","oxen"],["axe","axes"],["die","dice"],["yes","yeses"],["foot","feet"],["eave","eaves"],["goose","geese"],["tooth","teeth"],["quiz","quizzes"],["human","humans"],["proof","proofs"],["carve","carves"],["valve","valves"],["looey","looies"],["thief","thieves"],["groove","grooves"],["pickaxe","pickaxes"],["passerby","passersby"]].forEach(function(l){return _.addIrregularRule(l[0],l[1])}),[[/s?$/i,"s"],[/[^\u0000-\u007F]$/i,"$0"],[/([^aeiou]ese)$/i,"$1"],[/(ax|test)is$/i,"$1es"],[/(alias|[^aou]us|t[lm]as|gas|ris)$/i,"$1es"],[/(e[mn]u)s?$/i,"$1s"],[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i,"$1"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1i"],[/(alumn|alg|vertebr)(?:a|ae)$/i,"$1ae"],[/(seraph|cherub)(?:im)?$/i,"$1im"],[/(her|at|gr)o$/i,"$1oes"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i,"$1a"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i,"$1a"],[/sis$/i,"ses"],[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i,"$1$2ves"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/([^ch][ieo][ln])ey$/i,"$1ies"],[/(x|ch|ss|sh|zz)$/i,"$1es"],[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i,"$1ices"],[/\b((?:tit)?m|l)(?:ice|ouse)$/i,"$1ice"],[/(pe)(?:rson|ople)$/i,"$1ople"],[/(child)(?:ren)?$/i,"$1ren"],[/eaux$/i,"$0"],[/m[ae]n$/i,"men"],["thou","you"]].forEach(function(l){return _.addPluralRule(l[0],l[1])}),[[/s$/i,""],[/(ss)$/i,"$1"],[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i,"$1fe"],[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i,"$1f"],[/ies$/i,"y"],[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i,"$1ie"],[/\b(mon|smil)ies$/i,"$1ey"],[/\b((?:tit)?m|l)ice$/i,"$1ouse"],[/(seraph|cherub)im$/i,"$1"],[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i,"$1"],[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i,"$1sis"],[/(movie|twelve|abuse|e[mn]u)s$/i,"$1"],[/(test)(?:is|es)$/i,"$1is"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1us"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i,"$1um"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i,"$1on"],[/(alumn|alg|vertebr)ae$/i,"$1a"],[/(cod|mur|sil|vert|ind)ices$/i,"$1ex"],[/(matr|append)ices$/i,"$1ix"],[/(pe)(rson|ople)$/i,"$1rson"],[/(child)ren$/i,"$1"],[/(eau)x?$/i,"$1"],[/men$/i,"man"]].forEach(function(l){return _.addSingularRule(l[0],l[1])}),["adulthood","advice","agenda","aid","aircraft","alcohol","ammo","analytics","anime","athletics","audio","bison","blood","bream","buffalo","butter","carp","cash","chassis","chess","clothing","cod","commerce","cooperation","corps","debris","diabetes","digestion","elk","energy","equipment","excretion","expertise","firmware","flounder","fun","gallows","garbage","graffiti","hardware","headquarters","health","herpes","highjinks","homework","housework","information","jeans","justice","kudos","labour","literature","machinery","mackerel","mail","media","mews","moose","music","mud","manga","news","only","personnel","pike","plankton","pliers","police","pollution","premises","rain","research","rice","salmon","scissors","series","sewage","shambles","shrimp","software","species","staff","swine","tennis","traffic","transportation","trout","tuna","wealth","welfare","whiting","wildebeest","wildlife","you",/pok[eé]mon$/i,/[^aeiou]ese$/i,/deer$/i,/fish$/i,/measles$/i,/o[iu]s$/i,/pox$/i,/sheep$/i].forEach(_.addUncountableRule),_})});var Nn=M((Zc,An)=>{"use strict";h();var Ln=12,Is=0,cr=[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,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,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,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,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,7,7,7,7,7,7,7,7,7,7,7,7,8,7,7,10,9,9,9,11,4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,24,36,48,60,72,84,96,0,12,12,12,0,0,0,0,0,0,0,0,0,0,0,24,0,0,0,0,0,0,0,0,0,24,24,24,0,0,0,0,0,0,0,0,0,24,24,0,0,0,0,0,0,0,0,0,0,48,48,48,0,0,0,0,0,0,0,0,0,0,48,48,0,0,0,0,0,0,0,0,0,48,0,0,0,0,0,0,0,0,0,0,127,63,63,63,0,31,15,15,15,7,7,7];function Ps(t){var e=t.indexOf("%");if(e===-1)return t;for(var r=t.length,n="",i=0,s=0,a=e,u=Ln;e>-1&&e<r;){var c=Rn(t[e+1],4),f=Rn(t[e+2],0),p=c|f,d=cr[p];if(u=cr[256+u+d],s=s<<6|p&cr[364+d],u===Ln)n+=t.slice(i,a),n+=s<=65535?String.fromCharCode(s):String.fromCharCode(55232+(s>>10),56320+(s&1023)),s=0,i=e+3,e=a=t.indexOf("%",i);else{if(u===Is)return null;if(e+=3,e<r&&t.charCodeAt(e)===37)continue;return null}}return n+t.slice(i)}o(Ps,"decodeURIComponent");var Bs={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};function Rn(t,e){var r=Bs[t];return r===void 0?255:r<<e}o(Rn,"hexCodeToInt");An.exports=Ps});var Dn=M((tl,Mn)=>{"use strict";h();var In=Nn(),Pn=/\+/g,Bn=o(function(){},"Empty");Bn.prototype=Object.create(null);function Ms(t){let e=new Bn;if(typeof t!="string")return e;let r=t.length,n="",i="",s=-1,a=-1,u=!1,c=!1,f=!1,p=!1,d=!1,_=0;for(let l=0;l<r+1;l++)if(_=l!==r?t.charCodeAt(l):38,_===38){if(d=a>s,d||(a=l),n=t.slice(s+1,a),d||n.length>0){f&&(n=n.replace(Pn," ")),u&&(n=In(n)||n),d&&(i=t.slice(a+1,l),p&&(i=i.replace(Pn," ")),c&&(i=In(i)||i));let m=e[n];m===void 0?e[n]=i:m.pop?m.push(i):e[n]=[m,i]}i="",s=l,a=l,u=!1,c=!1,f=!1,p=!1}else _===61?a<=s?a=l:c=!0:_===43?a>s?p=!0:f=!0:_===37&&(a>s?c=!0:u=!0);return e}o(Ms,"parse");Mn.exports=Ms});var Gn=M((il,Un)=>{h();var be=Array.from({length:256},(t,e)=>"%"+((e<16?"0":"")+e.toString(16)).toUpperCase()),Ds=new Int8Array([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,0,0,0,0,1,1,1,1,0,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,0,1,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,0]);function Us(t){let e=t.length;if(e===0)return"";let r="",n=0,i=0;e:for(;i<e;i++){let s=t.charCodeAt(i);for(;s<128;){if(Ds[s]!==1&&(n<i&&(r+=t.slice(n,i)),n=i+1,r+=be[s]),++i===e)break e;s=t.charCodeAt(i)}if(n<i&&(r+=t.slice(n,i)),s<2048){n=i+1,r+=be[192|s>>6]+be[128|s&63];continue}if(s<55296||s>=57344){n=i+1,r+=be[224|s>>12]+be[128|s>>6&63]+be[128|s&63];continue}if(++i,i>=e)throw new Error("URI malformed");let a=t.charCodeAt(i)&1023;n=i+1,s=65536+((s&1023)<<10|a),r+=be[240|s>>18]+be[128|s>>12&63]+be[128|s>>6&63]+be[128|s&63]}return n===0?t:n<e?r+t.slice(n):r}o(Us,"encodeString");Un.exports={encodeString:Us}});var jn=M((al,qn)=>{"use strict";h();var{encodeString:lr}=Gn();function Fn(t){let e=typeof t;return e==="string"?lr(t):e==="bigint"?t.toString():e==="boolean"?t?"true":"false":e==="number"&&Number.isFinite(t)?t<1e21?""+t:lr(""+t):""}o(Fn,"getAsPrimitive");function Gs(t){let e="";if(t===null||typeof t!="object")return e;let r="&",n=Object.keys(t),i=n.length,s=0;for(let a=0;a<i;a++){let u=n[a],c=t[u],f=lr(u)+"=";if(a&&(e+=r),Array.isArray(c)){s=c.length;for(let p=0;p<s;p++)p&&(e+=r),e+=f,e+=Fn(c[p])}else e+=f,e+=Fn(c)}return e}o(Gs,"stringify");qn.exports=Gs});var Hn=M((ul,it)=>{"use strict";h();var Wn=Dn(),zn=jn(),Vn={parse:Wn,stringify:zn};it.exports=Vn;it.exports.default=Vn;it.exports.parse=Wn;it.exports.stringify=zn});var li=M((Uu,yr)=>{"use strict";h();var io=Object.prototype.hasOwnProperty,ie="~";function st(){}o(st,"Events");Object.create&&(st.prototype=Object.create(null),new st().__proto__||(ie=!1));function so(t,e,r){this.fn=t,this.context=e,this.once=r||!1}o(so,"EE");function ci(t,e,r,n,i){if(typeof r!="function")throw new TypeError("The listener must be a function");var s=new so(r,n||t,i),a=ie?ie+e:e;return t._events[a]?t._events[a].fn?t._events[a]=[t._events[a],s]:t._events[a].push(s):(t._events[a]=s,t._eventsCount++),t}o(ci,"addListener");function Ct(t,e){--t._eventsCount===0?t._events=new st:delete t._events[e]}o(Ct,"clearEvent");function X(){this._events=new st,this._eventsCount=0}o(X,"EventEmitter");X.prototype.eventNames=o(function(){var e=[],r,n;if(this._eventsCount===0)return e;for(n in r=this._events)io.call(r,n)&&e.push(ie?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e},"eventNames");X.prototype.listeners=o(function(e){var r=ie?ie+e:e,n=this._events[r];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,s=n.length,a=new Array(s);i<s;i++)a[i]=n[i].fn;return a},"listeners");X.prototype.listenerCount=o(function(e){var r=ie?ie+e:e,n=this._events[r];return n?n.fn?1:n.length:0},"listenerCount");X.prototype.emit=o(function(e,r,n,i,s,a){var u=ie?ie+e:e;if(!this._events[u])return!1;var c=this._events[u],f=arguments.length,p,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),f){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,r),!0;case 3:return c.fn.call(c.context,r,n),!0;case 4:return c.fn.call(c.context,r,n,i),!0;case 5:return c.fn.call(c.context,r,n,i,s),!0;case 6:return c.fn.call(c.context,r,n,i,s,a),!0}for(d=1,p=new Array(f-1);d<f;d++)p[d-1]=arguments[d];c.fn.apply(c.context,p)}else{var _=c.length,l;for(d=0;d<_;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),f){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,r);break;case 3:c[d].fn.call(c[d].context,r,n);break;case 4:c[d].fn.call(c[d].context,r,n,i);break;default:if(!p)for(l=1,p=new Array(f-1);l<f;l++)p[l-1]=arguments[l];c[d].fn.apply(c[d].context,p)}}return!0},"emit");X.prototype.on=o(function(e,r,n){return ci(this,e,r,n,!1)},"on");X.prototype.once=o(function(e,r,n){return ci(this,e,r,n,!0)},"once");X.prototype.removeListener=o(function(e,r,n,i){var s=ie?ie+e:e;if(!this._events[s])return this;if(!r)return Ct(this,s),this;var a=this._events[s];if(a.fn)a.fn===r&&(!i||a.once)&&(!n||a.context===n)&&Ct(this,s);else{for(var u=0,c=[],f=a.length;u<f;u++)(a[u].fn!==r||i&&!a[u].once||n&&a[u].context!==n)&&c.push(a[u]);c.length?this._events[s]=c.length===1?c[0]:c:Ct(this,s)}return this},"removeListener");X.prototype.removeAllListeners=o(function(e){var r;return e?(r=ie?ie+e:e,this._events[r]&&Ct(this,r)):(this._events=new st,this._eventsCount=0),this},"removeAllListeners");X.prototype.off=X.prototype.removeListener;X.prototype.addListener=X.prototype.on;X.prefixed=ie;X.EventEmitter=X;typeof yr<"u"&&(yr.exports=X)});var mi=M((af,pi)=>{"use strict";h();var{Duplex:oo}=G("stream");function hi(t){t.emit("close")}o(hi,"emitClose");function ao(){!this.destroyed&&this._writableState.finished&&this.destroy()}o(ao,"duplexOnEnd");function di(t){this.removeListener("error",di),this.destroy(),this.listenerCount("error")===0&&this.emit("error",t)}o(di,"duplexOnError");function co(t,e){let r=!0,n=new oo({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return t.on("message",o(function(s,a){let u=!a&&n._readableState.objectMode?s.toString():s;n.push(u)||t.pause()},"message")),t.once("error",o(function(s){n.destroyed||(r=!1,n.destroy(s))},"error")),t.once("close",o(function(){n.destroyed||n.push(null)},"close")),n._destroy=function(i,s){if(t.readyState===t.CLOSED){s(i),process.nextTick(hi,n);return}let a=!1;t.once("error",o(function(c){a=!0,s(c)},"error")),t.once("close",o(function(){a||s(i),process.nextTick(hi,n)},"close")),r&&t.terminate()},n._final=function(i){if(t.readyState===t.CONNECTING){t.once("open",o(function(){n._final(i)},"open"));return}t._socket!==null&&(t._socket._writableState.finished?(i(),n._readableState.endEmitted&&n.destroy()):(t._socket.once("finish",o(function(){i()},"finish")),t.close()))},n._read=function(){t.isPaused&&t.resume()},n._write=function(i,s,a){if(t.readyState===t.CONNECTING){t.once("open",o(function(){n._write(i,s,a)},"open"));return}t.send(i,a)},n.on("end",ao),n.on("error",di),n}o(co,"createWebSocketStream");pi.exports=co});var Te=M((uf,_i)=>{"use strict";h();var gi=["nodebuffer","arraybuffer","fragments"],yi=typeof Blob<"u";yi&&gi.push("blob");_i.exports={BINARY_TYPES:gi,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:yi,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:o(()=>{},"NOOP")}});var lt=M((df,$t)=>{"use strict";h();var{EMPTY_BUFFER:lo}=Te(),Er=Buffer[Symbol.species];function uo(t,e){if(t.length===0)return lo;if(t.length===1)return t[0];let r=Buffer.allocUnsafe(e),n=0;for(let i=0;i<t.length;i++){let s=t[i];r.set(s,n),n+=s.length}return n<e?new Er(r.buffer,r.byteOffset,n):r}o(uo,"concat");function bi(t,e,r,n,i){for(let s=0;s<i;s++)r[n+s]=t[s]^e[s&3]}o(bi,"_mask");function xi(t,e){for(let r=0;r<t.length;r++)t[r]^=e[r&3]}o(xi,"_unmask");function fo(t){return t.length===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.length)}o(fo,"toArrayBuffer");function wr(t){if(wr.readOnly=!0,Buffer.isBuffer(t))return t;let e;return t instanceof ArrayBuffer?e=new Er(t):ArrayBuffer.isView(t)?e=new Er(t.buffer,t.byteOffset,t.byteLength):(e=Buffer.from(t),wr.readOnly=!1),e}o(wr,"toBuffer");$t.exports={concat:uo,mask:bi,toArrayBuffer:fo,toBuffer:wr,unmask:xi};if(!process.env.WS_NO_BUFFER_UTIL)try{let t=G("bufferutil");$t.exports.mask=function(e,r,n,i,s){s<48?bi(e,r,n,i,s):t.mask(e,r,n,i,s)},$t.exports.unmask=function(e,r){e.length<32?xi(e,r):t.unmask(e,r)}}catch{}});var wi=M((gf,Ei)=>{"use strict";h();var vi=Symbol("kDone"),Sr=Symbol("kRun"),Tr=class{static{o(this,"Limiter")}constructor(e){this[vi]=()=>{this.pending--,this[Sr]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[Sr]()}[Sr](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[vi])}}};Ei.exports=Tr});var ht=M((bf,ki)=>{"use strict";h();var ut=G("zlib"),Si=lt(),ho=wi(),{kStatusCode:Ti}=Te(),po=Buffer[Symbol.species],mo=Buffer.from([0,0,255,255]),At=Symbol("permessage-deflate"),Oe=Symbol("total-length"),ft=Symbol("callback"),Ne=Symbol("buffers"),Rt=Symbol("error"),Lt,Or=class{static{o(this,"PerMessageDeflate")}constructor(e,r,n){if(this._maxPayload=n|0,this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!r,this._deflate=null,this._inflate=null,this.params=null,!Lt){let i=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Lt=new ho(i)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[ft];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let r=this._options,n=e.find(i=>!(r.serverNoContextTakeover===!1&&i.server_no_context_takeover||i.server_max_window_bits&&(r.serverMaxWindowBits===!1||typeof r.serverMaxWindowBits=="number"&&r.serverMaxWindowBits>i.server_max_window_bits)||typeof r.clientMaxWindowBits=="number"&&!i.client_max_window_bits));if(!n)throw new Error("None of the extension offers can be accepted");return r.serverNoContextTakeover&&(n.server_no_context_takeover=!0),r.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof r.serverMaxWindowBits=="number"&&(n.server_max_window_bits=r.serverMaxWindowBits),typeof r.clientMaxWindowBits=="number"?n.client_max_window_bits=r.clientMaxWindowBits:(n.client_max_window_bits===!0||r.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(e){let r=e[0];if(this._options.clientNoContextTakeover===!1&&r.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!r.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(r.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&r.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return r}normalizeParams(e){return e.forEach(r=>{Object.keys(r).forEach(n=>{let i=r[n];if(i.length>1)throw new Error(`Parameter "${n}" must have only a single value`);if(i=i[0],n==="client_max_window_bits"){if(i!==!0){let s=+i;if(!Number.isInteger(s)||s<8||s>15)throw new TypeError(`Invalid value for parameter "${n}": ${i}`);i=s}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${n}": ${i}`)}else if(n==="server_max_window_bits"){let s=+i;if(!Number.isInteger(s)||s<8||s>15)throw new TypeError(`Invalid value for parameter "${n}": ${i}`);i=s}else if(n==="client_no_context_takeover"||n==="server_no_context_takeover"){if(i!==!0)throw new TypeError(`Invalid value for parameter "${n}": ${i}`)}else throw new Error(`Unknown parameter "${n}"`);r[n]=i})}),e}decompress(e,r,n){Lt.add(i=>{this._decompress(e,r,(s,a)=>{i(),n(s,a)})})}compress(e,r,n){Lt.add(i=>{this._compress(e,r,(s,a)=>{i(),n(s,a)})})}_decompress(e,r,n){let i=this._isServer?"client":"server";if(!this._inflate){let s=`${i}_max_window_bits`,a=typeof this.params[s]!="number"?ut.Z_DEFAULT_WINDOWBITS:this.params[s];this._inflate=ut.createInflateRaw({...this._options.zlibInflateOptions,windowBits:a}),this._inflate[At]=this,this._inflate[Oe]=0,this._inflate[Ne]=[],this._inflate.on("error",yo),this._inflate.on("data",Oi)}this._inflate[ft]=n,this._inflate.write(e),r&&this._inflate.write(mo),this._inflate.flush(()=>{let s=this._inflate[Rt];if(s){this._inflate.close(),this._inflate=null,n(s);return}let a=Si.concat(this._inflate[Ne],this._inflate[Oe]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Oe]=0,this._inflate[Ne]=[],r&&this.params[`${i}_no_context_takeover`]&&this._inflate.reset()),n(null,a)})}_compress(e,r,n){let i=this._isServer?"server":"client";if(!this._deflate){let s=`${i}_max_window_bits`,a=typeof this.params[s]!="number"?ut.Z_DEFAULT_WINDOWBITS:this.params[s];this._deflate=ut.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:a}),this._deflate[Oe]=0,this._deflate[Ne]=[],this._deflate.on("data",go)}this._deflate[ft]=n,this._deflate.write(e),this._deflate.flush(ut.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let s=Si.concat(this._deflate[Ne],this._deflate[Oe]);r&&(s=new po(s.buffer,s.byteOffset,s.length-4)),this._deflate[ft]=null,this._deflate[Oe]=0,this._deflate[Ne]=[],r&&this.params[`${i}_no_context_takeover`]&&this._deflate.reset(),n(null,s)})}};ki.exports=Or;function go(t){this[Ne].push(t),this[Oe]+=t.length}o(go,"deflateOnData");function Oi(t){if(this[Oe]+=t.length,this[At]._maxPayload<1||this[Oe]<=this[At]._maxPayload){this[Ne].push(t);return}this[Rt]=new RangeError("Max payload size exceeded"),this[Rt].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Rt][Ti]=1009,this.removeListener("data",Oi),this.reset()}o(Oi,"inflateOnData");function yo(t){this[At]._inflate=null,t[Ti]=1007,this[ft](t)}o(yo,"inflateOnError")});var Ye=M((Ef,Nt)=>{"use strict";h();var{isUtf8:Ci}=G("buffer"),{hasBlob:_o}=Te(),bo=[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 xo(t){return t>=1e3&&t<=1014&&t!==1004&&t!==1005&&t!==1006||t>=3e3&&t<=4999}o(xo,"isValidStatusCode");function kr(t){let e=t.length,r=0;for(;r<e;)if((t[r]&128)===0)r++;else if((t[r]&224)===192){if(r+1===e||(t[r+1]&192)!==128||(t[r]&254)===192)return!1;r+=2}else if((t[r]&240)===224){if(r+2>=e||(t[r+1]&192)!==128||(t[r+2]&192)!==128||t[r]===224&&(t[r+1]&224)===128||t[r]===237&&(t[r+1]&224)===160)return!1;r+=3}else if((t[r]&248)===240){if(r+3>=e||(t[r+1]&192)!==128||(t[r+2]&192)!==128||(t[r+3]&192)!==128||t[r]===240&&(t[r+1]&240)===128||t[r]===244&&t[r+1]>143||t[r]>244)return!1;r+=4}else return!1;return!0}o(kr,"_isValidUTF8");function vo(t){return _o&&typeof t=="object"&&typeof t.arrayBuffer=="function"&&typeof t.type=="string"&&typeof t.stream=="function"&&(t[Symbol.toStringTag]==="Blob"||t[Symbol.toStringTag]==="File")}o(vo,"isBlob");Nt.exports={isBlob:vo,isValidStatusCode:xo,isValidUTF8:kr,tokenChars:bo};if(Ci)Nt.exports.isValidUTF8=function(t){return t.length<24?kr(t):Ci(t)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let t=G("utf-8-validate");Nt.exports.isValidUTF8=function(e){return e.length<32?kr(e):t(e)}}catch{}});var Ar=M((Tf,Pi)=>{"use strict";h();var{Writable:Eo}=G("stream"),$i=ht(),{BINARY_TYPES:wo,EMPTY_BUFFER:Li,kStatusCode:So,kWebSocket:To}=Te(),{concat:Cr,toArrayBuffer:Oo,unmask:ko}=lt(),{isValidStatusCode:Co,isValidUTF8:Ri}=Ye(),It=Buffer[Symbol.species],fe=0,Ai=1,Ni=2,Ii=3,$r=4,Lr=5,Pt=6,Rr=class extends Eo{static{o(this,"Receiver")}constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||wo[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[To]=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._fragments=[],this._errored=!1,this._loop=!1,this._state=fe}_write(e,r,n){if(this._opcode===8&&this._state==fe)return n();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(n)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let n=this._buffers[0];return this._buffers[0]=new It(n.buffer,n.byteOffset+e,n.length-e),new It(n.buffer,n.byteOffset,e)}let r=Buffer.allocUnsafe(e);do{let n=this._buffers[0],i=r.length-e;e>=n.length?r.set(this._buffers.shift(),i):(r.set(new Uint8Array(n.buffer,n.byteOffset,e),i),this._buffers[0]=new It(n.buffer,n.byteOffset+e,n.length-e)),e-=n.length}while(e>0);return r}startLoop(e){this._loop=!0;do switch(this._state){case fe:this.getInfo(e);break;case Ai:this.getPayloadLength16(e);break;case Ni:this.getPayloadLength64(e);break;case Ii:this.getMask();break;case $r:this.getData(e);break;case Lr:case Pt:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let r=this.consume(2);if((r[0]&48)!==0){let i=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(i);return}let n=(r[0]&64)===64;if(n&&!this._extensions[$i.extensionName]){let i=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(i);return}if(this._fin=(r[0]&128)===128,this._opcode=r[0]&15,this._payloadLength=r[1]&127,this._opcode===0){if(n){let i=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(i);return}if(!this._fragmented){let i=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(i);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let i=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(i);return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let i=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(i);return}if(n){let i=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(i);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let i=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(i);return}}else{let i=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(i);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(r[1]&128)===128,this._isServer){if(!this._masked){let i=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(i);return}}else if(this._masked){let i=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(i);return}this._payloadLength===126?this._state=Ai:this._payloadLength===127?this._state=Ni:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let r=this.consume(8),n=r.readUInt32BE(0);if(n>Math.pow(2,21)-1){let i=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(i);return}this._payloadLength=n*Math.pow(2,32)+r.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let r=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(r);return}this._masked?this._state=Ii:this._state=$r}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=$r}getData(e){let r=Li;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}r=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&ko(r,this._mask)}if(this._opcode>7){this.controlMessage(r,e);return}if(this._compressed){this._state=Lr,this.decompress(r,e);return}r.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(r)),this.dataMessage(e)}decompress(e,r){this._extensions[$i.extensionName].decompress(e,this._fin,(i,s)=>{if(i)return r(i);if(s.length){if(this._messageLength+=s.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let a=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");r(a);return}this._fragments.push(s)}this.dataMessage(r),this._state===fe&&this.startLoop(r)})}dataMessage(e){if(!this._fin){this._state=fe;return}let r=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let i;this._binaryType==="nodebuffer"?i=Cr(n,r):this._binaryType==="arraybuffer"?i=Oo(Cr(n,r)):this._binaryType==="blob"?i=new Blob(n):i=n,this._allowSynchronousEvents?(this.emit("message",i,!0),this._state=fe):(this._state=Pt,setImmediate(()=>{this.emit("message",i,!0),this._state=fe,this.startLoop(e)}))}else{let i=Cr(n,r);if(!this._skipUTF8Validation&&!Ri(i)){let s=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(s);return}this._state===Lr||this._allowSynchronousEvents?(this.emit("message",i,!1),this._state=fe):(this._state=Pt,setImmediate(()=>{this.emit("message",i,!1),this._state=fe,this.startLoop(e)}))}}controlMessage(e,r){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,Li),this.end();else{let n=e.readUInt16BE(0);if(!Co(n)){let s=this.createError(RangeError,`invalid status code ${n}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");r(s);return}let i=new It(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!Ri(i)){let s=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");r(s);return}this._loop=!1,this.emit("conclude",n,i),this.end()}this._state=fe;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=fe):(this._state=Pt,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=fe,this.startLoop(r)}))}createError(e,r,n,i,s){this._loop=!1,this._errored=!0;let a=new e(n?`Invalid WebSocket frame: ${r}`:r);return Error.captureStackTrace(a,this.createError),a.code=s,a[So]=i,a}};Pi.exports=Rr});var Pr=M(($f,Di)=>{"use strict";h();var{Duplex:Cf}=G("stream"),{randomFillSync:$o}=G("crypto"),Bi=ht(),{EMPTY_BUFFER:Lo,kWebSocket:Ro,NOOP:Ao}=Te(),{isBlob:Ke,isValidStatusCode:No}=Ye(),{mask:Mi,toBuffer:Me}=lt(),he=Symbol("kByteLength"),Io=Buffer.alloc(4),Bt=8*1024,De,Je=Bt,ge=0,Po=1,Bo=2,Nr=class t{static{o(this,"Sender")}constructor(e,r,n){this._extensions=r||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=ge,this.onerror=Ao,this[Ro]=void 0}static frame(e,r){let n,i=!1,s=2,a=!1;r.mask&&(n=r.maskBuffer||Io,r.generateMask?r.generateMask(n):(Je===Bt&&(De===void 0&&(De=Buffer.alloc(Bt)),$o(De,0,Bt),Je=0),n[0]=De[Je++],n[1]=De[Je++],n[2]=De[Je++],n[3]=De[Je++]),a=(n[0]|n[1]|n[2]|n[3])===0,s=6);let u;typeof e=="string"?(!r.mask||a)&&r[he]!==void 0?u=r[he]:(e=Buffer.from(e),u=e.length):(u=e.length,i=r.mask&&r.readOnly&&!a);let c=u;u>=65536?(s+=8,c=127):u>125&&(s+=2,c=126);let f=Buffer.allocUnsafe(i?u+s:s);return f[0]=r.fin?r.opcode|128:r.opcode,r.rsv1&&(f[0]|=64),f[1]=c,c===126?f.writeUInt16BE(u,2):c===127&&(f[2]=f[3]=0,f.writeUIntBE(u,4,6)),r.mask?(f[1]|=128,f[s-4]=n[0],f[s-3]=n[1],f[s-2]=n[2],f[s-1]=n[3],a?[f,e]:i?(Mi(e,n,f,s,u),[f]):(Mi(e,n,e,0,u),[f,e])):[f,e]}close(e,r,n,i){let s;if(e===void 0)s=Lo;else{if(typeof e!="number"||!No(e))throw new TypeError("First argument must be a valid error code number");if(r===void 0||!r.length)s=Buffer.allocUnsafe(2),s.writeUInt16BE(e,0);else{let u=Buffer.byteLength(r);if(u>123)throw new RangeError("The message must not be greater than 123 bytes");s=Buffer.allocUnsafe(2+u),s.writeUInt16BE(e,0),typeof r=="string"?s.write(r,2):s.set(r,2)}}let a={[he]:s.length,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==ge?this.enqueue([this.dispatch,s,!1,a,i]):this.sendFrame(t.frame(s,a),i)}ping(e,r,n){let i,s;if(typeof e=="string"?(i=Buffer.byteLength(e),s=!1):Ke(e)?(i=e.size,s=!1):(e=Me(e),i=e.length,s=Me.readOnly),i>125)throw new RangeError("The data size must not be greater than 125 bytes");let a={[he]:i,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:9,readOnly:s,rsv1:!1};Ke(e)?this._state!==ge?this.enqueue([this.getBlobData,e,!1,a,n]):this.getBlobData(e,!1,a,n):this._state!==ge?this.enqueue([this.dispatch,e,!1,a,n]):this.sendFrame(t.frame(e,a),n)}pong(e,r,n){let i,s;if(typeof e=="string"?(i=Buffer.byteLength(e),s=!1):Ke(e)?(i=e.size,s=!1):(e=Me(e),i=e.length,s=Me.readOnly),i>125)throw new RangeError("The data size must not be greater than 125 bytes");let a={[he]:i,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:10,readOnly:s,rsv1:!1};Ke(e)?this._state!==ge?this.enqueue([this.getBlobData,e,!1,a,n]):this.getBlobData(e,!1,a,n):this._state!==ge?this.enqueue([this.dispatch,e,!1,a,n]):this.sendFrame(t.frame(e,a),n)}send(e,r,n){let i=this._extensions[Bi.extensionName],s=r.binary?2:1,a=r.compress,u,c;typeof e=="string"?(u=Buffer.byteLength(e),c=!1):Ke(e)?(u=e.size,c=!1):(e=Me(e),u=e.length,c=Me.readOnly),this._firstFragment?(this._firstFragment=!1,a&&i&&i.params[i._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(a=u>=i._threshold),this._compress=a):(a=!1,s=0),r.fin&&(this._firstFragment=!0);let f={[he]:u,fin:r.fin,generateMask:this._generateMask,mask:r.mask,maskBuffer:this._maskBuffer,opcode:s,readOnly:c,rsv1:a};Ke(e)?this._state!==ge?this.enqueue([this.getBlobData,e,this._compress,f,n]):this.getBlobData(e,this._compress,f,n):this._state!==ge?this.enqueue([this.dispatch,e,this._compress,f,n]):this.dispatch(e,this._compress,f,n)}getBlobData(e,r,n,i){this._bufferedBytes+=n[he],this._state=Bo,e.arrayBuffer().then(s=>{if(this._socket.destroyed){let u=new Error("The socket was closed while the blob was being read");process.nextTick(Ir,this,u,i);return}this._bufferedBytes-=n[he];let a=Me(s);r?this.dispatch(a,r,n,i):(this._state=ge,this.sendFrame(t.frame(a,n),i),this.dequeue())}).catch(s=>{process.nextTick(Mo,this,s,i)})}dispatch(e,r,n,i){if(!r){this.sendFrame(t.frame(e,n),i);return}let s=this._extensions[Bi.extensionName];this._bufferedBytes+=n[he],this._state=Po,s.compress(e,n.fin,(a,u)=>{if(this._socket.destroyed){let c=new Error("The socket was closed while data was being compressed");Ir(this,c,i);return}this._bufferedBytes-=n[he],this._state=ge,n.readOnly=!1,this.sendFrame(t.frame(u,n),i),this.dequeue()})}dequeue(){for(;this._state===ge&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][he],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][he],this._queue.push(e)}sendFrame(e,r){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],r),this._socket.uncork()):this._socket.write(e[0],r)}};Di.exports=Nr;function Ir(t,e,r){typeof r=="function"&&r(e);for(let n=0;n<t._queue.length;n++){let i=t._queue[n],s=i[i.length-1];typeof s=="function"&&s(e)}}o(Ir,"callCallbacks");function Mo(t,e,r){Ir(t,e,r),t.onerror(e)}o(Mo,"onError")});var Hi=M((Af,Vi)=>{"use strict";h();var{kForOnEventAttribute:dt,kListener:Br}=Te(),Ui=Symbol("kCode"),Gi=Symbol("kData"),Fi=Symbol("kError"),qi=Symbol("kMessage"),ji=Symbol("kReason"),Ze=Symbol("kTarget"),Wi=Symbol("kType"),zi=Symbol("kWasClean"),ke=class{static{o(this,"Event")}constructor(e){this[Ze]=null,this[Wi]=e}get target(){return this[Ze]}get type(){return this[Wi]}};Object.defineProperty(ke.prototype,"target",{enumerable:!0});Object.defineProperty(ke.prototype,"type",{enumerable:!0});var Ue=class extends ke{static{o(this,"CloseEvent")}constructor(e,r={}){super(e),this[Ui]=r.code===void 0?0:r.code,this[ji]=r.reason===void 0?"":r.reason,this[zi]=r.wasClean===void 0?!1:r.wasClean}get code(){return this[Ui]}get reason(){return this[ji]}get wasClean(){return this[zi]}};Object.defineProperty(Ue.prototype,"code",{enumerable:!0});Object.defineProperty(Ue.prototype,"reason",{enumerable:!0});Object.defineProperty(Ue.prototype,"wasClean",{enumerable:!0});var Xe=class extends ke{static{o(this,"ErrorEvent")}constructor(e,r={}){super(e),this[Fi]=r.error===void 0?null:r.error,this[qi]=r.message===void 0?"":r.message}get error(){return this[Fi]}get message(){return this[qi]}};Object.defineProperty(Xe.prototype,"error",{enumerable:!0});Object.defineProperty(Xe.prototype,"message",{enumerable:!0});var pt=class extends ke{static{o(this,"MessageEvent")}constructor(e,r={}){super(e),this[Gi]=r.data===void 0?null:r.data}get data(){return this[Gi]}};Object.defineProperty(pt.prototype,"data",{enumerable:!0});var Do={addEventListener(t,e,r={}){for(let i of this.listeners(t))if(!r[dt]&&i[Br]===e&&!i[dt])return;let n;if(t==="message")n=o(function(s,a){let u=new pt("message",{data:a?s:s.toString()});u[Ze]=this,Mt(e,this,u)},"onMessage");else if(t==="close")n=o(function(s,a){let u=new Ue("close",{code:s,reason:a.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});u[Ze]=this,Mt(e,this,u)},"onClose");else if(t==="error")n=o(function(s){let a=new Xe("error",{error:s,message:s.message});a[Ze]=this,Mt(e,this,a)},"onError");else if(t==="open")n=o(function(){let s=new ke("open");s[Ze]=this,Mt(e,this,s)},"onOpen");else return;n[dt]=!!r[dt],n[Br]=e,r.once?this.once(t,n):this.on(t,n)},removeEventListener(t,e){for(let r of this.listeners(t))if(r[Br]===e&&!r[dt]){this.removeListener(t,r);break}}};Vi.exports={CloseEvent:Ue,ErrorEvent:Xe,Event:ke,EventTarget:Do,MessageEvent:pt};function Mt(t,e,r){typeof t=="object"&&t.handleEvent?t.handleEvent.call(t,r):t.call(e,r)}o(Mt,"callListener")});var Mr=M((Pf,Qi)=>{"use strict";h();var{tokenChars:mt}=Ye();function xe(t,e,r){t[e]===void 0?t[e]=[r]:t[e].push(r)}o(xe,"push");function Uo(t){let e=Object.create(null),r=Object.create(null),n=!1,i=!1,s=!1,a,u,c=-1,f=-1,p=-1,d=0;for(;d<t.length;d++)if(f=t.charCodeAt(d),a===void 0)if(p===-1&&mt[f]===1)c===-1&&(c=d);else if(d!==0&&(f===32||f===9))p===-1&&c!==-1&&(p=d);else if(f===59||f===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${d}`);p===-1&&(p=d);let l=t.slice(c,p);f===44?(xe(e,l,r),r=Object.create(null)):a=l,c=p=-1}else throw new SyntaxError(`Unexpected character at index ${d}`);else if(u===void 0)if(p===-1&&mt[f]===1)c===-1&&(c=d);else if(f===32||f===9)p===-1&&c!==-1&&(p=d);else if(f===59||f===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${d}`);p===-1&&(p=d),xe(r,t.slice(c,p),!0),f===44&&(xe(e,a,r),r=Object.create(null),a=void 0),c=p=-1}else if(f===61&&c!==-1&&p===-1)u=t.slice(c,d),c=p=-1;else throw new SyntaxError(`Unexpected character at index ${d}`);else if(i){if(mt[f]!==1)throw new SyntaxError(`Unexpected character at index ${d}`);c===-1?c=d:n||(n=!0),i=!1}else if(s)if(mt[f]===1)c===-1&&(c=d);else if(f===34&&c!==-1)s=!1,p=d;else if(f===92)i=!0;else throw new SyntaxError(`Unexpected character at index ${d}`);else if(f===34&&t.charCodeAt(d-1)===61)s=!0;else if(p===-1&&mt[f]===1)c===-1&&(c=d);else if(c!==-1&&(f===32||f===9))p===-1&&(p=d);else if(f===59||f===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${d}`);p===-1&&(p=d);let l=t.slice(c,p);n&&(l=l.replace(/\\/g,""),n=!1),xe(r,u,l),f===44&&(xe(e,a,r),r=Object.create(null),a=void 0),u=void 0,c=p=-1}else throw new SyntaxError(`Unexpected character at index ${d}`);if(c===-1||s||f===32||f===9)throw new SyntaxError("Unexpected end of input");p===-1&&(p=d);let _=t.slice(c,p);return a===void 0?xe(e,_,r):(u===void 0?xe(r,_,!0):n?xe(r,u,_.replace(/\\/g,"")):xe(r,u,_),xe(e,a,r)),e}o(Uo,"parse");function Go(t){return Object.keys(t).map(e=>{let r=t[e];return Array.isArray(r)||(r=[r]),r.map(n=>[e].concat(Object.keys(n).map(i=>{let s=n[i];return Array.isArray(s)||(s=[s]),s.map(a=>a===!0?i:`${i}=${a}`).join("; ")})).join("; ")).join(", ")}).join(", ")}o(Go,"format");Qi.exports={format:Go,parse:Uo}});var qr=M((Gf,os)=>{"use strict";h();var Fo=G("events"),qo=G("https"),jo=G("http"),Ji=G("net"),Wo=G("tls"),{randomBytes:zo,createHash:Vo}=G("crypto"),{Duplex:Df,Readable:Uf}=G("stream"),{URL:Dr}=G("url"),Ie=ht(),Ho=Ar(),Qo=Pr(),{isBlob:Yo}=Ye(),{BINARY_TYPES:Yi,EMPTY_BUFFER:Dt,GUID:Ko,kForOnEventAttribute:Ur,kListener:Jo,kStatusCode:Zo,kWebSocket:Z,NOOP:Zi}=Te(),{EventTarget:{addEventListener:Xo,removeEventListener:ea}}=Hi(),{format:ta,parse:ra}=Mr(),{toBuffer:na}=lt(),ia=30*1e3,Xi=Symbol("kAborted"),Gr=[8,13],Ce=["CONNECTING","OPEN","CLOSING","CLOSED"],sa=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,q=class t extends Fo{static{o(this,"WebSocket")}constructor(e,r,n){super(),this._binaryType=Yi[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Dt,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=t.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,r===void 0?r=[]:Array.isArray(r)||(typeof r=="object"&&r!==null?(n=r,r=[]):r=[r]),es(this,e,r,n)):(this._autoPong=n.autoPong,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){Yi.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}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(e,r,n){let i=new Ho({allowSynchronousEvents:n.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation}),s=new Qo(e,this._extensions,n.generateMask);this._receiver=i,this._sender=s,this._socket=e,i[Z]=this,s[Z]=this,e[Z]=this,i.on("conclude",ca),i.on("drain",la),i.on("error",ua),i.on("message",fa),i.on("ping",ha),i.on("pong",da),s.onerror=pa,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),r.length>0&&e.unshift(r),e.on("close",ns),e.on("data",Gt),e.on("end",is),e.on("error",ss),this._readyState=t.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[Ie.extensionName]&&this._extensions[Ie.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,r){if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){le(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===t.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=t.CLOSING,this._sender.close(e,r,!this._isServer,n=>{n||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),rs(this)}}pause(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,r,n){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(n=e,e=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){Fr(this,e,n);return}r===void 0&&(r=!this._isServer),this._sender.ping(e||Dt,r,n)}pong(e,r,n){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(n=e,e=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){Fr(this,e,n);return}r===void 0&&(r=!this._isServer),this._sender.pong(e||Dt,r,n)}resume(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,r,n){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof r=="function"&&(n=r,r={}),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){Fr(this,e,n);return}let i={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...r};this._extensions[Ie.extensionName]||(i.compress=!1),this._sender.send(e||Dt,i,n)}terminate(){if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){le(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=t.CLOSING,this._socket.destroy())}}};Object.defineProperty(q,"CONNECTING",{enumerable:!0,value:Ce.indexOf("CONNECTING")});Object.defineProperty(q.prototype,"CONNECTING",{enumerable:!0,value:Ce.indexOf("CONNECTING")});Object.defineProperty(q,"OPEN",{enumerable:!0,value:Ce.indexOf("OPEN")});Object.defineProperty(q.prototype,"OPEN",{enumerable:!0,value:Ce.indexOf("OPEN")});Object.defineProperty(q,"CLOSING",{enumerable:!0,value:Ce.indexOf("CLOSING")});Object.defineProperty(q.prototype,"CLOSING",{enumerable:!0,value:Ce.indexOf("CLOSING")});Object.defineProperty(q,"CLOSED",{enumerable:!0,value:Ce.indexOf("CLOSED")});Object.defineProperty(q.prototype,"CLOSED",{enumerable:!0,value:Ce.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(t=>{Object.defineProperty(q.prototype,t,{enumerable:!0})});["open","error","close","message"].forEach(t=>{Object.defineProperty(q.prototype,`on${t}`,{enumerable:!0,get(){for(let e of this.listeners(t))if(e[Ur])return e[Jo];return null},set(e){for(let r of this.listeners(t))if(r[Ur]){this.removeListener(t,r);break}typeof e=="function"&&this.addEventListener(t,e,{[Ur]:!0})}})});q.prototype.addEventListener=Xo;q.prototype.removeEventListener=ea;os.exports=q;function es(t,e,r,n){let i={allowSynchronousEvents:!0,autoPong:!0,protocolVersion:Gr[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...n,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(t._autoPong=i.autoPong,!Gr.includes(i.protocolVersion))throw new RangeError(`Unsupported protocol version: ${i.protocolVersion} (supported versions: ${Gr.join(", ")})`);let s;if(e instanceof Dr)s=e;else try{s=new Dr(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}s.protocol==="http:"?s.protocol="ws:":s.protocol==="https:"&&(s.protocol="wss:"),t._url=s.href;let a=s.protocol==="wss:",u=s.protocol==="ws+unix:",c;if(s.protocol!=="ws:"&&!a&&!u?c=`The URL's protocol must be one of "ws:", "wss:", "http:", "https", or "ws+unix:"`:u&&!s.pathname?c="The URL's pathname is empty":s.hash&&(c="The URL contains a fragment identifier"),c){let E=new SyntaxError(c);if(t._redirects===0)throw E;Ut(t,E);return}let f=a?443:80,p=zo(16).toString("base64"),d=a?qo.request:jo.request,_=new Set,l;if(i.createConnection=i.createConnection||(a?aa:oa),i.defaultPort=i.defaultPort||f,i.port=s.port||f,i.host=s.hostname.startsWith("[")?s.hostname.slice(1,-1):s.hostname,i.headers={...i.headers,"Sec-WebSocket-Version":i.protocolVersion,"Sec-WebSocket-Key":p,Connection:"Upgrade",Upgrade:"websocket"},i.path=s.pathname+s.search,i.timeout=i.handshakeTimeout,i.perMessageDeflate&&(l=new Ie(i.perMessageDeflate!==!0?i.perMessageDeflate:{},!1,i.maxPayload),i.headers["Sec-WebSocket-Extensions"]=ta({[Ie.extensionName]:l.offer()})),r.length){for(let E of r){if(typeof E!="string"||!sa.test(E)||_.has(E))throw new SyntaxError("An invalid or duplicated subprotocol was specified");_.add(E)}i.headers["Sec-WebSocket-Protocol"]=r.join(",")}if(i.origin&&(i.protocolVersion<13?i.headers["Sec-WebSocket-Origin"]=i.origin:i.headers.Origin=i.origin),(s.username||s.password)&&(i.auth=`${s.username}:${s.password}`),u){let E=i.path.split(":");i.socketPath=E[0],i.path=E[1]}let m;if(i.followRedirects){if(t._redirects===0){t._originalIpc=u,t._originalSecure=a,t._originalHostOrSocketPath=u?i.socketPath:s.host;let E=n&&n.headers;if(n={...n,headers:{}},E)for(let[T,R]of Object.entries(E))n.headers[T.toLowerCase()]=R}else if(t.listenerCount("redirect")===0){let E=u?t._originalIpc?i.socketPath===t._originalHostOrSocketPath:!1:t._originalIpc?!1:s.host===t._originalHostOrSocketPath;(!E||t._originalSecure&&!a)&&(delete i.headers.authorization,delete i.headers.cookie,E||delete i.headers.host,i.auth=void 0)}i.auth&&!n.headers.authorization&&(n.headers.authorization="Basic "+Buffer.from(i.auth).toString("base64")),m=t._req=d(i),t._redirects&&t.emit("redirect",t.url,m)}else m=t._req=d(i);i.timeout&&m.on("timeout",()=>{le(t,m,"Opening handshake has timed out")}),m.on("error",E=>{m===null||m[Xi]||(m=t._req=null,Ut(t,E))}),m.on("response",E=>{let T=E.headers.location,R=E.statusCode;if(T&&i.followRedirects&&R>=300&&R<400){if(++t._redirects>i.maxRedirects){le(t,m,"Maximum redirects exceeded");return}m.abort();let B;try{B=new Dr(T,e)}catch{let C=new SyntaxError(`Invalid URL: ${T}`);Ut(t,C);return}es(t,B,r,n)}else t.emit("unexpected-response",m,E)||le(t,m,`Unexpected server response: ${E.statusCode}`)}),m.on("upgrade",(E,T,R)=>{if(t.emit("upgrade",E),t.readyState!==q.CONNECTING)return;m=t._req=null;let B=E.headers.upgrade;if(B===void 0||B.toLowerCase()!=="websocket"){le(t,T,"Invalid Upgrade header");return}let Q=Vo("sha1").update(p+Ko).digest("base64");if(E.headers["sec-websocket-accept"]!==Q){le(t,T,"Invalid Sec-WebSocket-Accept header");return}let C=E.headers["sec-websocket-protocol"],z;if(C!==void 0?_.size?_.has(C)||(z="Server sent an invalid subprotocol"):z="Server sent a subprotocol but none was requested":_.size&&(z="Server sent no subprotocol"),z){le(t,T,z);return}C&&(t._protocol=C);let Y=E.headers["sec-websocket-extensions"];if(Y!==void 0){if(!l){le(t,T,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let j;try{j=ra(Y)}catch{le(t,T,"Invalid Sec-WebSocket-Extensions header");return}let I=Object.keys(j);if(I.length!==1||I[0]!==Ie.extensionName){le(t,T,"Server indicated an extension that was not requested");return}try{l.accept(j[Ie.extensionName])}catch{le(t,T,"Invalid Sec-WebSocket-Extensions header");return}t._extensions[Ie.extensionName]=l}t.setSocket(T,R,{allowSynchronousEvents:i.allowSynchronousEvents,generateMask:i.generateMask,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation})}),i.finishRequest?i.finishRequest(m,t):m.end()}o(es,"initAsClient");function Ut(t,e){t._readyState=q.CLOSING,t._errorEmitted=!0,t.emit("error",e),t.emitClose()}o(Ut,"emitErrorAndClose");function oa(t){return t.path=t.socketPath,Ji.connect(t)}o(oa,"netConnect");function aa(t){return t.path=void 0,!t.servername&&t.servername!==""&&(t.servername=Ji.isIP(t.host)?"":t.host),Wo.connect(t)}o(aa,"tlsConnect");function le(t,e,r){t._readyState=q.CLOSING;let n=new Error(r);Error.captureStackTrace(n,le),e.setHeader?(e[Xi]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(Ut,t,n)):(e.destroy(n),e.once("error",t.emit.bind(t,"error")),e.once("close",t.emitClose.bind(t)))}o(le,"abortHandshake");function Fr(t,e,r){if(e){let n=Yo(e)?e.size:na(e).length;t._socket?t._sender._bufferedBytes+=n:t._bufferedAmount+=n}if(r){let n=new Error(`WebSocket is not open: readyState ${t.readyState} (${Ce[t.readyState]})`);process.nextTick(r,n)}}o(Fr,"sendAfterClose");function ca(t,e){let r=this[Z];r._closeFrameReceived=!0,r._closeMessage=e,r._closeCode=t,r._socket[Z]!==void 0&&(r._socket.removeListener("data",Gt),process.nextTick(ts,r._socket),t===1005?r.close():r.close(t,e))}o(ca,"receiverOnConclude");function la(){let t=this[Z];t.isPaused||t._socket.resume()}o(la,"receiverOnDrain");function ua(t){let e=this[Z];e._socket[Z]!==void 0&&(e._socket.removeListener("data",Gt),process.nextTick(ts,e._socket),e.close(t[Zo])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t))}o(ua,"receiverOnError");function Ki(){this[Z].emitClose()}o(Ki,"receiverOnFinish");function fa(t,e){this[Z].emit("message",t,e)}o(fa,"receiverOnMessage");function ha(t){let e=this[Z];e._autoPong&&e.pong(t,!this._isServer,Zi),e.emit("ping",t)}o(ha,"receiverOnPing");function da(t){this[Z].emit("pong",t)}o(da,"receiverOnPong");function ts(t){t.resume()}o(ts,"resume");function pa(t){let e=this[Z];e.readyState!==q.CLOSED&&(e.readyState===q.OPEN&&(e._readyState=q.CLOSING,rs(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t)))}o(pa,"senderOnError");function rs(t){t._closeTimer=setTimeout(t._socket.destroy.bind(t._socket),ia)}o(rs,"setCloseTimer");function ns(){let t=this[Z];this.removeListener("close",ns),this.removeListener("data",Gt),this.removeListener("end",is),t._readyState=q.CLOSING;let e;!this._readableState.endEmitted&&!t._closeFrameReceived&&!t._receiver._writableState.errorEmitted&&(e=t._socket.read())!==null&&t._receiver.write(e),t._receiver.end(),this[Z]=void 0,clearTimeout(t._closeTimer),t._receiver._writableState.finished||t._receiver._writableState.errorEmitted?t.emitClose():(t._receiver.on("error",Ki),t._receiver.on("finish",Ki))}o(ns,"socketOnClose");function Gt(t){this[Z]._receiver.write(t)||this.pause()}o(Gt,"socketOnData");function is(){let t=this[Z];t._readyState=q.CLOSING,t._receiver.end(),this.end()}o(is,"socketOnEnd");function ss(){let t=this[Z];this.removeListener("error",ss),this.on("error",Zi),t&&(t._readyState=q.CLOSING,this.destroy())}o(ss,"socketOnError")});var cs=M((jf,as)=>{"use strict";h();var{tokenChars:ma}=Ye();function ga(t){let e=new Set,r=-1,n=-1,i=0;for(i;i<t.length;i++){let a=t.charCodeAt(i);if(n===-1&&ma[a]===1)r===-1&&(r=i);else if(i!==0&&(a===32||a===9))n===-1&&r!==-1&&(n=i);else if(a===44){if(r===-1)throw new SyntaxError(`Unexpected character at index ${i}`);n===-1&&(n=i);let u=t.slice(r,n);if(e.has(u))throw new SyntaxError(`The "${u}" subprotocol is duplicated`);e.add(u),r=n=-1}else throw new SyntaxError(`Unexpected character at index ${i}`)}if(r===-1||n!==-1)throw new SyntaxError("Unexpected end of input");let s=t.slice(r,i);if(e.has(s))throw new SyntaxError(`The "${s}" subprotocol is duplicated`);return e.add(s),e}o(ga,"parse");as.exports={parse:ga}});var ms=M((Hf,ps)=>{"use strict";h();var ya=G("events"),Ft=G("http"),{Duplex:Vf}=G("stream"),{createHash:_a}=G("crypto"),ls=Mr(),Ge=ht(),ba=cs(),xa=qr(),{GUID:va,kWebSocket:Ea}=Te(),wa=/^[+/0-9A-Za-z]{22}==$/,us=0,fs=1,ds=2,jr=class extends ya{static{o(this,"WebSocketServer")}constructor(e,r){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:xa,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null?(this._server=Ft.createServer((n,i)=>{let s=Ft.STATUS_CODES[426];i.writeHead(426,{"Content-Length":s.length,"Content-Type":"text/plain"}),i.end(s)}),this._server.listen(e.port,e.host,e.backlog,r)):e.server&&(this._server=e.server),this._server){let n=this.emit.bind(this,"connection");this._removeListeners=Sa(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:o((i,s,a)=>{this.handleUpgrade(i,s,a,n)},"upgrade")})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=us}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===ds){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(gt,this);return}if(e&&this.once("close",e),this._state!==fs)if(this._state=fs,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(gt,this):process.nextTick(gt,this);else{let r=this._server;this._removeListeners(),this._removeListeners=this._server=null,r.close(()=>{gt(this)})}}shouldHandle(e){if(this.options.path){let r=e.url.indexOf("?");if((r!==-1?e.url.slice(0,r):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,r,n,i){r.on("error",hs);let s=e.headers["sec-websocket-key"],a=e.headers.upgrade,u=+e.headers["sec-websocket-version"];if(e.method!=="GET"){Fe(this,e,r,405,"Invalid HTTP method");return}if(a===void 0||a.toLowerCase()!=="websocket"){Fe(this,e,r,400,"Invalid Upgrade header");return}if(s===void 0||!wa.test(s)){Fe(this,e,r,400,"Missing or invalid Sec-WebSocket-Key header");return}if(u!==8&&u!==13){Fe(this,e,r,400,"Missing or invalid Sec-WebSocket-Version header");return}if(!this.shouldHandle(e)){yt(r,400);return}let c=e.headers["sec-websocket-protocol"],f=new Set;if(c!==void 0)try{f=ba.parse(c)}catch{Fe(this,e,r,400,"Invalid Sec-WebSocket-Protocol header");return}let p=e.headers["sec-websocket-extensions"],d={};if(this.options.perMessageDeflate&&p!==void 0){let _=new Ge(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let l=ls.parse(p);l[Ge.extensionName]&&(_.accept(l[Ge.extensionName]),d[Ge.extensionName]=_)}catch{Fe(this,e,r,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let _={origin:e.headers[`${u===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(_,(l,m,E,T)=>{if(!l)return yt(r,m||401,E,T);this.completeUpgrade(d,s,f,e,r,n,i)});return}if(!this.options.verifyClient(_))return yt(r,401)}this.completeUpgrade(d,s,f,e,r,n,i)}completeUpgrade(e,r,n,i,s,a,u){if(!s.readable||!s.writable)return s.destroy();if(s[Ea])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>us)return yt(s,503);let f=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${_a("sha1").update(r+va).digest("base64")}`],p=new this.options.WebSocket(null,void 0,this.options);if(n.size){let d=this.options.handleProtocols?this.options.handleProtocols(n,i):n.values().next().value;d&&(f.push(`Sec-WebSocket-Protocol: ${d}`),p._protocol=d)}if(e[Ge.extensionName]){let d=e[Ge.extensionName].params,_=ls.format({[Ge.extensionName]:[d]});f.push(`Sec-WebSocket-Extensions: ${_}`),p._extensions=e}this.emit("headers",f,i),s.write(f.concat(`\r
|
|
2
|
-
`).join(`\r
|
|
3
|
-
`)),s.removeListener("error",hs),p.setSocket(s,a,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(p),p.on("close",()=>{this.clients.delete(p),this._shouldEmitClose&&!this.clients.size&&process.nextTick(gt,this)})),u(p,i)}};ps.exports=jr;function Sa(t,e){for(let r of Object.keys(e))t.on(r,e[r]);return o(function(){for(let n of Object.keys(e))t.removeListener(n,e[n])},"removeListeners")}o(Sa,"addListeners");function gt(t){t._state=ds,t.emit("close")}o(gt,"emitClose");function hs(){this.destroy()}o(hs,"socketOnError");function yt(t,e,r,n){r=r||Ft.STATUS_CODES[e],n={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(r),...n},t.once("finish",t.destroy),t.end(`HTTP/1.1 ${e} ${Ft.STATUS_CODES[e]}\r
|
|
4
|
-
`+Object.keys(n).map(i=>`${i}: ${n[i]}`).join(`\r
|
|
5
|
-
`)+`\r
|
|
6
|
-
\r
|
|
7
|
-
`+r)}o(yt,"abortHandshake");function Fe(t,e,r,n,i){if(t.listenerCount("wsClientError")){let s=new Error(i);Error.captureStackTrace(s,Fe),t.emit("wsClientError",s,r,e)}else yt(r,n,i)}o(Fe,"abortHandshakeOrEmitwsClientError")});h();var wt=re(dn(),1);function pe(t,e,{target:r="stdout",...n}={}){return wt.default[r]?Hr.link(t,e):n.fallback===!1?t:typeof n.fallback=="function"?n.fallback(t,e):`${t} (\u200B${e}\u200B)`}o(pe,"terminalLink");pe.isSupported=wt.default.stdout;pe.stderr=(t,e,r={})=>pe(t,e,{target:"stderr",...r});pe.stderr.isSupported=wt.default.stderr;h();import{randomUUID as Ss}from"node:crypto";h();var pn=re(xt(),1);import Xt from"node:os";var me,mn=o(async(t,e)=>{e["--telemetry"]&&(me=await import("./esm-PLVGBDRY.js"),me.init({dsn:"https://0c26e0d8afd94e77a88ee1c3aa9e7065@o250689.ingest.sentry.io/6703266",enabled:ve.productionLike&&(e["--telemetry"]??!1),release:je.version,environment:je.version.includes("experimental")?"experimental":"production"}))},"initSentry"),gn=o(async t=>{me&&(me.captureException(t,{event_id:t.id,captureContext:{tags:{arch:W.arch,bug:t.isBug,environment:ve.value,platform:W.platform,shell:W.shell,version:je.version},contexts:{ctx:{argv:process.argv},cause:t.cause?ce(t.cause):void 0,app:{app_name:je.name,app_version:je.version},device:{name:Xt.hostname(),family:Xt.type(),arch:Xt.arch()},runtime:{name:process.release.name,version:process.version}}}}),await me.flush((0,pn.default)("2s")))},"sendErrorToSentry"),yn=o(t=>{me&&me.addBreadcrumb(t)},"addSentryBreadcrumb"),Ka=o(t=>{me&&me.setUser(t)},"setSentryUser"),Ja=o(t=>{me&&me.setTags(t)},"setSentryTags");var Ts=o(async(t,e)=>{if(Yr(e))return t.log.debug("aborting without reporting error",{error:e}),process.exit(1);t.log.error("reporting error and exiting",{error:e});try{let r=Be.from(e);if(r.print(),r.isBug===Pe.NO)return;await gn(r)}finally{process.exit(1)}},"reportErrorAndExit"),fc=o(async(t,e)=>{t.log.debug("installing error handlers"),await mn(t,e);let r=o(n=>void Ts(t,n),"handleError");process.once("uncaughtException",r),process.once("unhandledRejection",r)},"installErrorHandlers"),Pe=Object.freeze({YES:"yes",NO:"no",MAYBE:"maybe"}),Be=class t extends Error{static{o(this,"GGTError")}id=ve.testLike?"00000000-0000-0000-0000-000000000000":Ss();cause;stack;constructor(e){super(e),Error.captureStackTrace(this,this.constructor),this.stack=Vr(this.stack,{pretty:!0,basePath:Zr})}static from(e){return e instanceof t?e:new er(e)}sprint(){let e=this.render();if(this.isBug!==Pe.NO){e=Et(e);let r=this.isBug===Pe.YES?"This is a bug":"If you think this is a bug",n=`https://github.com/gadget-inc/ggt/issues/new?template=bug_report.yml&error-id=${this.id}`;pe.isSupported?e+=Et({ensureEmptyLineAbove:!0,content:_e`
|
|
8
|
-
${r}, ${pe("click here",n)} to create an issue on GitHub.
|
|
9
|
-
`}):e+=Et({ensureEmptyLineAbove:!0,content:_e`
|
|
10
|
-
${r}, use the link below to create an issue on GitHub.
|
|
11
|
-
|
|
12
|
-
${n}
|
|
13
|
-
`})}return e}print(e){tn({ensureEmptyLineAbove:!0,...e,content:this.sprint()})}},er=class extends Be{constructor(r){super("An unexpected error occurred");this.cause=r}static{o(this,"UnexpectedError")}isBug=Pe.YES;render(){let r=ce(this.cause),n=r.stack||r.message||this.stack;return this.message+`.
|
|
14
|
-
|
|
15
|
-
`+n}},_n=class extends Be{constructor(r,n){super(r);this.cause=n}static{o(this,"EdgeCaseError")}isBug=Pe.MAYBE;render(){return this.message}};h();var ir=re(En(),1);import $s from"node:assert";var wc=o(t=>t.filter(e=>!!e),"compact"),wn=o(t=>[...new Set(t)],"uniq"),Sc=o((t,e)=>($s(e.length>0,"options must not be empty"),[...e].sort((r,n)=>ir.default.get(r,t)-ir.default.get(n,t))),"sortBySimilar");h();var Tn=re(Sn(),1);import Ls from"node:assert";var Le=class extends Be{constructor(r,n){super("An error occurred while communicating with Gadget");this.request=r;zt(n)?this.cause={type:n.type,message:n.message,error:ce(n.error)}:Wt(n)?this.cause={type:n.type,code:n.code,reason:n.reason,wasClean:n.wasClean}:(Ls(vt(n)||jt(n)||Vt(n),"cause must be a string, Error, GraphQLError[], CloseEvent, or ErrorEvent"),this.cause=n)}static{o(this,"ClientError")}isBug=Pe.MAYBE;cause;render(){let r="";switch(!0){case Vt(this.cause):{let n=wn(this.cause.map(i=>i.message));r=_e`
|
|
16
|
-
Gadget responded with the following ${(0,Tn.default)("error",n.length,!1)}:
|
|
17
|
-
|
|
18
|
-
• ${n.join(`
|
|
19
|
-
\u2022 `)}
|
|
20
|
-
`;break}case Wt(this.cause):r="The connection to Gadget closed unexpectedly.";break;case(zt(this.cause)||jt(this.cause)):r=this.cause.message;break;default:r=this.cause;break}return this.message+`
|
|
21
|
-
|
|
22
|
-
`+r}};h();h();import Rs from"node:assert";var On=o(t=>t.url instanceof URL&&t.url.host===W.domains.services,"isGadgetServicesRequest"),As=o(t=>{let e=nn(t);return e&&`session=${encodeURIComponent(e)};`},"loadCookie"),ar=o(t=>{let e=nt(t);return Rs(e,"missing auth headers"),e},"loadAuthHeaders"),nt=o(t=>{let e=As(t);if(e)return t.log.trace("using cookie as auth header",{},{cookie:e}),{cookie:e};let r=on(t);if(r)return t.log.trace("using token as auth header",{},{token:r}),{"x-platform-access-token":r}},"maybeLoadAuthHeaders"),Ns=o(t=>t instanceof Kr&&t.response.statusCode===401,"isUnauthorizedError"),jc=o((t,e)=>{if(Ns(e)){t.log.warn("swallowing unauthorized error",{error:e});return}throw e},"swallowUnauthorized");h();var ri=re(xt(),1);import Zs from"node:assert";import{Agent as Xs}from"node:http";import{Agent as eo}from"node:https";h();h();h();import Ys from"node:assert";h();h();var kn=o((t,e,r,n)=>JSON.stringify({level:t,name:e,msg:Ht(r).trim(),fields:Cn(n)})+`
|
|
23
|
-
`,"formatJson"),Cn=o(t=>{let e={};for(let[r,n]of Object.entries(t))e[r]=$n(n);return e},"serializeFields"),$n=o(t=>(t instanceof Set&&(t=Array.from(t)),Array.isArray(t)?t.map($n):(t instanceof Map&&(t=Object.fromEntries(t.entries())),qe(t)?Cn(t):vt(t)?Ht(t).trim():t)),"serializeValue");h();var ur=re(bn(),1);import Fs from"node:assert";h();var Qn=re(Hn(),1);var Yn=o(t=>{let e=Qn.default.stringify(t);return e?`?${e}`:""},"serializeObjectToHTTPQuery");h();var L=new Wr({level:ve.testLike&&W.logLevel<F.PRINT?3:zr.level}),P={error:L.red,success:L.green,warn:L.yellow,link:L.cyan,highlighted:L.magentaBright,examplesQuestions:L.cyanBright,subdued:L.blackBright,body:L.whiteBright,black:L.black,blackBright:L.blackBright,red:L.red,redBright:L.redBright,green:L.green,greenBright:L.greenBright,yellow:L.yellow,yellowBright:L.yellowBright,blue:L.blue,blueBright:L.blueBright,magenta:L.magenta,magentaBright:L.magentaBright,cyan:L.cyan,cyanBright:L.cyanBright,white:L.white,whiteBright:L.whiteBright,bgBlack:L.bgBlack,bgBlackBright:L.bgBlackBright,bgRed:L.bgRed,bgRedBright:L.bgRedBright,bgGreen:L.bgGreen,bgGreenBright:L.bgGreenBright,bgYellow:L.bgYellow,bgYellowBright:L.bgYellowBright,bgBlue:L.bgBlue,bgBlueBright:L.bgBlueBright,bgMagenta:L.bgMagenta,bgMagentaBright:L.bgMagentaBright,bgCyan:L.bgCyan,bgCyanBright:L.bgCyanBright,bgWhite:L.bgWhite,bgWhiteBright:L.bgWhiteBright,reset:L.reset};var Zn=o((t,e,r,n,i,s)=>`${zs(i)} ${Vs(t)} ${Hs(e)}:${Qs(r)}${Xn(n,{indent:2,timestamp:i,environment:s})}${we}`,"formatPretty"),Ve="",Ae=" ",we=`
|
|
24
|
-
`,qs=":",Kn="'",Jn=o((t,e)=>{let r=t==="error"?P.error:P.subdued,n=[];n.push(we);for(let i=0;i<e;i++)n.push(Ae);return n.push(r(t)),n.push(r(qs)),n.join("")},"formatKey"),Re=o((t,e,r)=>{if(!t)return Ve;let n=t.split(we);if(n.length===0)return Ve;let i=[],s=n.shift();Fs(!Qr(s),"first line is nil"),i.push(e(s));for(let a of n)if(a){i.push(we);for(let u=0;u<r;u++)i.push(Ae);i.push(e(a))}return i.join(Ve)},"formatValue"),js=o((t,e)=>{let r="";return e&&(r=Yn(e)),`https://${t.application.slug}--${t.name}.${W.domains.app}/edit/logs${r}`},"getEnvironmentLogsUrl"),Ws=o(t=>t?`{environment_id="${t.id.toString()}"} | json | level=~"info|warn|error"`:'{environment_id=~".+"} | json | level=~"info|warn|error"',"defaultLogqlQuery"),Xn=o((t,e)=>{let{indent:r,environment:n,timestamp:i}=e;if(Object.keys(t).length===0)return Ve;let s=[];"trace_id"in t&&(s.push(Jn("trace_id",r)),s.push(Ae),n&&i&&pe.isSupported?s.push(pe(P.link(t.trace_id),js(n,{timeRange:`${i.toISOString()} to now`,logql:`${Ws(n)} | trace_id="${t.trace_id}"`}))):s.push(P.link(t.trace_id)));for(let[a,u]of Object.entries(t))if(a!=="trace_id"){if(s.push(Jn(a,r)),u instanceof Set&&(u=Array.from(u)),Array.isArray(u)){if(u.length===0){s.push(Re(" []",P.subdued,r));continue}u=Object.fromEntries(u.entries())}if(u instanceof Map&&(u=Object.fromEntries(u)),qe(u)){let c=Object.entries(u);if(c.length===0){s.push(Re(" {}",P.subdued,r));continue}c.length>10&&W.logLevel>F.TRACE&&!n&&(u=Object.fromEntries([...c.slice(0,10),[rn.ellipsis,`${c.length-10} more`]])),s.push(Xn(u,{indent:r+2,environment:n}));continue}if(s.push(Ae),n)s.push(Re(String(u),P.reset,r));else switch(typeof u){case"string":s.push(Re(Kn+u.replaceAll(we,we+Ae.repeat(r+a.length))+Kn,P.reset,r));break;case"number":s.push(Re(String(u),P.yellowBright,r));break;case"bigint":s.push(Re(String(u)+"n",P.yellowBright,r));break;case"boolean":s.push(Re(String(u),P.green,r));break;default:s.push(Re(String(u),P.reset,r));break}}return s.join(Ve)},"formatFields"),zs=o(t=>(t?(0,ur.default)(t):(0,ur.default)()).format("hh:mm:ss"),"formatTimestamp"),Vs=o(t=>{switch(t){case F.PRINT:return P.bgBlack(P.body.bold(" PRINT "));case F.TRACE:return P.bgBlue(P.body.bold(" TRACE "));case F.DEBUG:return P.bgMagenta(P.body.bold(" DEBUG "));case F.INFO:return P.bgBlue(P.body.bold(" INFO "));case F.WARN:return P.bgYellow(P.body.bold(" WARN "));case F.ERROR:return P.bgRed(P.body.bold(" ERROR "))}},"formatLevel"),Hs=o(t=>P.body(t),"formatName"),Qs=o(t=>{if(!t)return Ve;let e=t.split(we);return e.length===1?Ae+P.body(t):we+e.map(r=>Ae+Ae+r).join(we)},"formatMessage");var fr={pretty:Zn,json:kn};var Hl={"--log-level":{type:o(t=>en(t,F.INFO),"type"),alias:["-ll"],default:F.INFO},"--my-logs":{type:Boolean}},Ks={trace:F.TRACE,debug:F.DEBUG,info:F.INFO,warn:F.WARN,error:F.ERROR},Ql=o(t=>(e,r,n,i,s)=>{let a={...i};"error"in a&&(a.error=ce(a.error)),"reason"in a&&(a.reason=ce(a.reason));let u=fr[W.logFormat],c=Ks[e.toLowerCase()];Ys(c,`Unknown level: ${e}`),Qt.writeStdout(u(c,r,n,a,s,t))},"createEnvironmentStructuredLogger"),ei=o(({name:t,fields:e={},devFields:r={}})=>{let n=o(i=>(s,a,u)=>{let c=i>=W.logLevel,f=i>=F.INFO;if(!c&&!f)return;let p={...oe(e),...a};if(ve.developmentOrTestLike&&Object.assign(p,oe(r),u),"error"in p&&(p.error=ce(p.error)),"reason"in p&&(p.reason=ce(p.reason)),c){let d=fr[W.logFormat];Qt.writeStderr(d(i,t,s,p))}f&&yn({level:"log",message:s,data:p})},"createStructuredLog");return{trace:n(F.TRACE),debug:n(F.DEBUG),info:n(F.INFO),warn:n(F.WARN),error:n(F.ERROR)}},"createStructuredLogger");var hr=o(({name:t,fields:e,devFields:r})=>({...ei({name:t,fields:e,devFields:r}),child:o(({name:n,fields:i,devFields:s})=>hr({name:n||t,fields:o(()=>({...oe(e),...oe(i)}),"fields"),devFields:{...oe(r),...oe(s)}}),"child")}),"createLogger");h();var ti=re(xt(),1);import{setTimeout as Js}from"node:timers/promises";var iu=o((t,e)=>Js((0,ti.default)(t),void 0,e),"delay"),dr=class{static{o(this,"PromiseWrapper")}resolution;rejection;pendingPromise;constructor(e){this.pendingPromise=e,e.then(r=>(this.resolution=r,r)).catch(r=>{this.rejection=r}).finally(()=>{delete this.pendingPromise})}async unwrap(){if(this.pendingPromise)return await this.pendingPromise;if(this.rejection)throw this.rejection;return this.resolution}},St=class{static{o(this,"PromiseSignal")}[Symbol.toStringTag];resolve;reject;_promise;constructor(){this._promise=new dr(new Promise((e,r)=>{this.resolve=e,this.reject=r})),this[Symbol.toStringTag]=String(this._promise.pendingPromise)}then(e,r){return this._promise.unwrap().then(e,r)}catch(e){return this._promise.unwrap().catch(e)}finally(e){return this._promise.unwrap().finally(e)}};var Tt=class t extends AbortController{static{o(this,"Context")}done=new St;#e;#i=[];constructor({log:e}){super(),this.#e=e,this.abort=this.abort.bind(this),this.child=this.child.bind(this),this.onAbort=this.onAbort.bind(this),this.signal.addEventListener("abort",async()=>{let r;for(let n of this.#i.reverse())try{await n(this.signal.reason)}catch(i){r??=i,this.log.error("error during abort",{error:r})}r?this.done.reject(r):this.done.resolve()})}get log(){return this.#e}static init(e){return new t({log:hr(e)})}child(e){let r=new t({log:this.log.child(e)});return this.onAbort(()=>r.abort()),r}onAbort(e){this.#i.push(e)}};var pr=o(t=>(Zs(t.context?.ctx instanceof Tt,_e(`
|
|
25
|
-
ctx must be provided to http requests:
|
|
26
|
-
|
|
27
|
-
const response = await http({
|
|
28
|
-
context: { ctx },
|
|
29
|
-
...options,
|
|
30
|
-
});
|
|
31
|
-
`)),t.context.ctx),"getContext"),Ot=Jr.extend({agent:{http:new Xs({keepAlive:!0}),https:new eo({keepAlive:!0,minVersion:"TLSv1.1"})},retry:{limit:10,methods:["GET","PUT","HEAD","DELETE","OPTIONS","TRACE"],statusCodes:[408,413,429,500,502,503,504,521,522,524],errorCodes:["ETIMEDOUT","ECONNRESET","EADDRINUSE","ECONNREFUSED","EPIPE","ENOTFOUND","ENETUNREACH","EAI_AGAIN","EADDRNOTAVAIL","EHOSTUNREACH"],maxRetryAfter:void 0,calculateDelay:o(({computedValue:t})=>t,"calculateDelay"),backoffLimit:(0,ri.default)("5s"),noise:100},hooks:{beforeRequest:[t=>{let e=pr(t);t.signal=e.signal,t.headers["user-agent"]=W.versionFull,e.log.debug("http request",{http:{request:{method:t.method,url:t.url?.toString()}}})}],beforeRetry:[(t,e)=>{pr(t.request?.options??t.options.context).log.warn("http request failed, retrying...",{http:{retryCount:e,error:ce(t),request:t.request&&{method:t.request.options.method,url:t.request.options.url?.toString()},response:t.response&&{statusCode:t.response.statusCode,traceId:t.response.headers["x-trace-id"],durationMs:t.response.timings.phases.total}}})}],afterResponse:[t=>{let e=pr(t.request.options);return e.log.debug("http response",{http:{request:{method:t.request.options.method,url:t.request.options.url?.toString()},response:{statusCode:t.statusCode,traceId:t.headers["x-trace-id"],durationMs:t.timings.phases.total}}}),t.statusCode===401&&On(t.request.options)&&sn(e,void 0),t}]}});h();import $a from"node:assert";h();h();h();h();function ne(t){return t===null?"null":Array.isArray(t)?"array":typeof t}o(ne,"extendedTypeof");function Se(t){return ne(t)==="object"}o(Se,"isObject");function ni(t){return Array.isArray(t)&&t.length>0&&t.every(e=>"message"in e)}o(ni,"areGraphQLErrors");function mr(t,e){return t.length<124?t:e}o(mr,"limitCloseReason");var ii="graphql-transport-ws";var ae;(function(t){t[t.InternalServerError=4500]="InternalServerError",t[t.InternalClientError=4005]="InternalClientError",t[t.BadRequest=4400]="BadRequest",t[t.BadResponse=4004]="BadResponse",t[t.Unauthorized=4401]="Unauthorized",t[t.Forbidden=4403]="Forbidden",t[t.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",t[t.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",t[t.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",t[t.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",t[t.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(ae||(ae={}));var H;(function(t){t.ConnectionInit="connection_init",t.ConnectionAck="connection_ack",t.Ping="ping",t.Pong="pong",t.Subscribe="subscribe",t.Next="next",t.Error="error",t.Complete="complete"})(H||(H={}));function si(t){if(!Se(t))throw new Error(`Message is expected to be an object, but got ${ne(t)}`);if(!t.type)throw new Error("Message is missing the 'type' property");if(typeof t.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${ne(t.type)}`);switch(t.type){case H.ConnectionInit:case H.ConnectionAck:case H.Ping:case H.Pong:{if(t.payload!=null&&!Se(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${t.payload}"`);break}case H.Subscribe:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${ne(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!Se(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${ne(t.payload)}`);if(typeof t.payload.query!="string")throw new Error(`"${t.type}" message payload expects the 'query' property to be a string, but got ${ne(t.payload.query)}`);if(t.payload.variables!=null&&!Se(t.payload.variables))throw new Error(`"${t.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${ne(t.payload.variables)}`);if(t.payload.operationName!=null&&ne(t.payload.operationName)!=="string")throw new Error(`"${t.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${ne(t.payload.operationName)}`);if(t.payload.extensions!=null&&!Se(t.payload.extensions))throw new Error(`"${t.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${ne(t.payload.extensions)}`);break}case H.Next:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${ne(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!Se(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${ne(t.payload)}`);break}case H.Error:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${ne(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!ni(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(t.payload)}`);break}case H.Complete:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${ne(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${t.type}"`)}return t}o(si,"validateMessage");function oi(t,e){return si(typeof t=="string"?JSON.parse(t,e):t)}o(oi,"parseMessage");function He(t,e){return si(t),JSON.stringify(t,e)}o(He,"stringifyMessage");var Qe=function(t){return this instanceof Qe?(this.v=t,this):new Qe(t)},to=function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",a),i[Symbol.asyncIterator]=function(){return this},i;function a(l){return function(m){return Promise.resolve(m).then(l,d)}}function u(l,m){n[l]&&(i[l]=function(E){return new Promise(function(T,R){s.push([l,E,T,R])>1||c(l,E)})},m&&(i[l]=m(i[l])))}function c(l,m){try{f(n[l](m))}catch(E){_(s[0][3],E)}}function f(l){l.value instanceof Qe?Promise.resolve(l.value.v).then(p,d):_(s[0][2],l)}function p(l){c("next",l)}function d(l){c("throw",l)}function _(l,m){l(m),s.shift(),s.length&&c(s[0][0],s[0][1])}};function ai(t){let{url:e,connectionParams:r,lazy:n=!0,onNonLazyError:i=console.error,lazyCloseTimeout:s=0,keepAlive:a=0,disablePong:u,connectionAckWaitTimeout:c=0,retryAttempts:f=5,retryWait:p=o(async function(g){let b=1e3;for(let x=0;x<g;x++)b*=2;await new Promise(x=>setTimeout(x,b+Math.floor(Math.random()*2700+300)))},"randomisedExponentialBackoff"),shouldRetry:d=gr,isFatalConnectionProblem:_,on:l,webSocketImpl:m,generateID:E=o(function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,g=>{let b=Math.random()*16|0;return(g=="x"?b:b&3|8).toString(16)})},"generateUUID"),jsonMessageReplacer:T,jsonMessageReviver:R}=t,B;if(m){if(!no(m))throw new Error("Invalid WebSocket implementation provided");B=m}else typeof WebSocket<"u"?B=WebSocket:typeof global<"u"?B=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(B=window.WebSocket||window.MozWebSocket);if(!B)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let Q=B,C=(()=>{let y=(()=>{let b={};return{on(x,S){return b[x]=S,()=>{delete b[x]}},emit(x){var S;"id"in x&&((S=b[x.id])===null||S===void 0||S.call(b,x))}}})(),g={connecting:l?.connecting?[l.connecting]:[],opened:l?.opened?[l.opened]:[],connected:l?.connected?[l.connected]:[],ping:l?.ping?[l.ping]:[],pong:l?.pong?[l.pong]:[],message:l?.message?[y.emit,l.message]:[y.emit],closed:l?.closed?[l.closed]:[],error:l?.error?[l.error]:[]};return{onMessage:y.on,on(b,x){let S=g[b];return S.push(x),()=>{S.splice(S.indexOf(x),1)}},emit(b,...x){for(let S of[...g[b]])S(...x)}}})();function z(y){let g=[C.on("error",b=>{g.forEach(x=>x()),y(b)}),C.on("closed",b=>{g.forEach(x=>x()),y(b)})]}o(z,"errorOrClosed");let Y,j=0,I,$=!1,ee=0,et=!1;async function O(){clearTimeout(I);let[y,g]=await(Y??(Y=new Promise((S,A)=>(async()=>{if($){if(await p(ee),!j)return Y=void 0,A({code:1e3,reason:"All Subscriptions Gone"});ee++}C.emit("connecting",$);let k=new Q(typeof e=="function"?await e():e,ii),D,K;function de(){isFinite(a)&&a>0&&(clearTimeout(K),K=setTimeout(()=>{k.readyState===Q.OPEN&&(k.send(He({type:H.Ping})),C.emit("ping",!1,void 0))},a))}o(de,"enqueuePing"),z(V=>{Y=void 0,clearTimeout(D),clearTimeout(K),A(V),V instanceof kt&&(k.close(4499,"Terminated"),k.onerror=null,k.onclose=null)}),k.onerror=V=>C.emit("error",V),k.onclose=V=>C.emit("closed",V),k.onopen=async()=>{try{C.emit("opened",k);let V=typeof r=="function"?await r():r;if(k.readyState!==Q.OPEN)return;k.send(He(V?{type:H.ConnectionInit,payload:V}:{type:H.ConnectionInit},T)),isFinite(c)&&c>0&&(D=setTimeout(()=>{k.close(ae.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},c)),de()}catch(V){C.emit("error",V),k.close(ae.InternalClientError,mr(V instanceof Error?V.message:new Error(V).message,"Internal client error"))}};let se=!1;k.onmessage=({data:V})=>{try{let U=oi(V,R);if(C.emit("message",U),U.type==="ping"||U.type==="pong"){C.emit(U.type,!0,U.payload),U.type==="pong"?de():u||(k.send(He(U.payload?{type:H.Pong,payload:U.payload}:{type:H.Pong})),C.emit("pong",!1,U.payload));return}if(se)return;if(U.type!==H.ConnectionAck)throw new Error(`First message cannot be of type ${U.type}`);clearTimeout(D),se=!0,C.emit("connected",k,U.payload,$),$=!1,ee=0,S([k,new Promise((te,ye)=>z(ye))])}catch(U){k.onmessage=null,C.emit("error",U),k.close(ae.BadResponse,mr(U instanceof Error?U.message:new Error(U).message,"Bad response"))}}})())));y.readyState===Q.CLOSING&&await g;let b=o(()=>{},"release"),x=new Promise(S=>b=S);return[y,b,Promise.race([x.then(()=>{if(!j){let S=o(()=>y.close(1e3,"Normal Closure"),"complete");isFinite(s)&&s>0?I=setTimeout(()=>{y.readyState===Q.OPEN&&S()},s):S()}}),g])]}o(O,"connect");function w(y){if(gr(y)&&(ro(y.code)||[ae.InternalServerError,ae.InternalClientError,ae.BadRequest,ae.BadResponse,ae.Unauthorized,ae.SubprotocolNotAcceptable,ae.SubscriberAlreadyExists,ae.TooManyInitialisationRequests].includes(y.code)))throw y;if(et)return!1;if(gr(y)&&y.code===1e3)return j>0;if(!f||ee>=f||!d(y)||_?.(y))throw y;return $=!0}o(w,"shouldRetryConnectOrThrow"),n||(async()=>{for(j++;;)try{let[,,y]=await O();await y}catch(y){try{if(!w(y))return}catch(g){return i?.(g)}}})();function v(y,g){let b=E(y),x=!1,S=!1,A=o(()=>{j--,x=!0},"releaser");return(async()=>{for(j++;;)try{let[k,D,K]=await O();if(x)return D();let de=C.onMessage(b,se=>{switch(se.type){case H.Next:{g.next(se.payload);return}case H.Error:{S=!0,x=!0,g.error(se.payload),A();return}case H.Complete:{x=!0,A();return}}});k.send(He({id:b,type:H.Subscribe,payload:y},T)),A=o(()=>{!x&&k.readyState===Q.OPEN&&k.send(He({id:b,type:H.Complete},T)),j--,x=!0,D()},"releaser"),await K.finally(de);return}catch(k){if(!w(k))return}})().then(()=>{S||g.complete()}).catch(k=>{g.error(k)}),()=>{x||A()}}return o(v,"subscribe"),{on:C.on,subscribe:v,iterate(y){let g=[],b={done:!1,error:null,resolve:o(()=>{},"resolve")},x=v(y,{next(A){g.push(A),b.resolve()},error(A){b.done=!0,b.error=A,b.resolve()},complete(){b.done=!0,b.resolve()}}),S=o(function(){return to(this,arguments,o(function*(){for(;;){for(g.length||(yield Qe(new Promise(D=>b.resolve=D)));g.length;)yield yield Qe(g.shift());if(b.error)throw b.error;if(b.done)return yield Qe(void 0)}},"iterator_1"))},"iterator")();return S.throw=async A=>(b.done||(b.done=!0,b.error=A,b.resolve()),{done:!0,value:void 0}),S.return=async()=>(x(),{done:!0,value:void 0}),S},async dispose(){if(et=!0,Y){let[y]=await Y;y.close(1e3,"Normal Closure")}},terminate(){Y&&C.emit("closed",new kt)}}}o(ai,"createClient");var kt=class extends Error{static{o(this,"TerminatedCloseEvent")}constructor(){super(...arguments),this.name="TerminatedCloseEvent",this.message="4499: Terminated",this.code=4499,this.reason="Terminated",this.wasClean=!1}};function gr(t){return Se(t)&&"code"in t&&"reason"in t}o(gr,"isLikeCloseEvent");function ro(t){return[1e3,1001,1006,1005,1012,1013,1014].includes(t)?!1:t>=1e3&&t<=1999}o(ro,"isFatalInternalCloseCode");function no(t){return typeof t=="function"&&"constructor"in t&&"CLOSED"in t&&"CLOSING"in t&&"CONNECTING"in t&&"OPEN"in t}o(no,"isWebSocket");var _s=re(xt(),1);h();h();var _r=re(li(),1);h();var ot=class extends Error{static{o(this,"TimeoutError")}constructor(e){super(e),this.name="TimeoutError"}},br=class extends Error{static{o(this,"AbortError")}constructor(e){super(),this.name="AbortError",this.message=e}},ui=o(t=>globalThis.DOMException===void 0?new br(t):new DOMException(t),"getDOMException"),fi=o(t=>{let e=t.reason===void 0?ui("This operation was aborted."):t.reason;return e instanceof Error?e:ui(e)},"getAbortedReason");function xr(t,e){let{milliseconds:r,fallback:n,message:i,customTimers:s={setTimeout,clearTimeout}}=e,a,u,f=new Promise((p,d)=>{if(typeof r!="number"||Math.sign(r)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${r}\``);if(e.signal){let{signal:l}=e;l.aborted&&d(fi(l)),u=o(()=>{d(fi(l))},"abortHandler"),l.addEventListener("abort",u,{once:!0})}if(r===Number.POSITIVE_INFINITY){t.then(p,d);return}let _=new ot;a=s.setTimeout.call(void 0,()=>{if(n){try{p(n())}catch(l){d(l)}return}typeof t.cancel=="function"&&t.cancel(),i===!1?p():i instanceof Error?d(i):(_.message=i??`Promise timed out after ${r} milliseconds`,d(_))},r),(async()=>{try{p(await t)}catch(l){d(l)}})()}).finally(()=>{f.clear(),u&&e.signal&&e.signal.removeEventListener("abort",u)});return f.clear=()=>{s.clearTimeout.call(void 0,a),a=void 0},f}o(xr,"pTimeout");h();h();function vr(t,e,r){let n=0,i=t.length;for(;i>0;){let s=Math.trunc(i/2),a=n+s;r(t[a],e)<=0?(n=++a,i-=s+1):i=s}return n}o(vr,"lowerBound");var at=class{static{o(this,"PriorityQueue")}#e=[];enqueue(e,r){r={priority:0,...r};let n={priority:r.priority,id:r.id,run:e};if(this.size===0||this.#e[this.size-1].priority>=r.priority){this.#e.push(n);return}let i=vr(this.#e,n,(s,a)=>a.priority-s.priority);this.#e.splice(i,0,n)}setPriority(e,r){let n=this.#e.findIndex(s=>s.id===e);if(n===-1)throw new ReferenceError(`No promise function with the id "${e}" exists in the queue.`);let[i]=this.#e.splice(n,1);this.enqueue(i.run,{priority:r,id:e})}dequeue(){return this.#e.shift()?.run}filter(e){return this.#e.filter(r=>r.priority===e.priority).map(r=>r.run)}get size(){return this.#e.length}};var ct=class extends _r.default{static{o(this,"PQueue")}#e;#i;#o=0;#d;#a;#p=0;#r;#c;#t;#m;#n=0;#l;#s;#g;#b=1n;timeout;constructor(e){if(super(),e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:at,...e},!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#e=e.carryoverConcurrencyCount,this.#i=e.intervalCap===Number.POSITIVE_INFINITY||e.interval===0,this.#d=e.intervalCap,this.#a=e.interval,this.#t=new e.queueClass,this.#m=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#g=e.throwOnTimeout===!0,this.#s=e.autoStart===!1}get#x(){return this.#i||this.#o<this.#d}get#v(){return this.#n<this.#l}#E(){this.#n--,this.#u(),this.emit("next")}#w(){this.#_(),this.#y(),this.#c=void 0}get#S(){let e=Date.now();if(this.#r===void 0){let r=this.#p-e;if(r<0)this.#o=this.#e?this.#n:0;else return this.#c===void 0&&(this.#c=setTimeout(()=>{this.#w()},r)),!0}return!1}#u(){if(this.#t.size===0)return this.#r&&clearInterval(this.#r),this.#r=void 0,this.emit("empty"),this.#n===0&&this.emit("idle"),!1;if(!this.#s){let e=!this.#S;if(this.#x&&this.#v){let r=this.#t.dequeue();return r?(this.emit("active"),r(),e&&this.#y(),!0):!1}}return!1}#y(){this.#i||this.#r!==void 0||(this.#r=setInterval(()=>{this.#_()},this.#a),this.#p=Date.now()+this.#a)}#_(){this.#o===0&&this.#n===0&&this.#r&&(clearInterval(this.#r),this.#r=void 0),this.#o=this.#e?this.#n:0,this.#f()}#f(){for(;this.#u(););}get concurrency(){return this.#l}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#l=e,this.#f()}async#T(e){return new Promise((r,n)=>{e.addEventListener("abort",()=>{n(e.reason)},{once:!0})})}setPriority(e,r){this.#t.setPriority(e,r)}async add(e,r={}){return r.id??=(this.#b++).toString(),r={timeout:this.timeout,throwOnTimeout:this.#g,...r},new Promise((n,i)=>{this.#t.enqueue(async()=>{this.#n++,this.#o++;try{r.signal?.throwIfAborted();let s=e({signal:r.signal});r.timeout&&(s=xr(Promise.resolve(s),{milliseconds:r.timeout})),r.signal&&(s=Promise.race([s,this.#T(r.signal)]));let a=await s;n(a),this.emit("completed",a)}catch(s){if(s instanceof ot&&!r.throwOnTimeout){n();return}i(s),this.emit("error",s)}finally{this.#E()}},r),this.emit("add"),this.#u()})}async addAll(e,r){return Promise.all(e.map(async n=>this.add(n,r)))}start(){return this.#s?(this.#s=!1,this.#f(),this):this}pause(){this.#s=!0}clear(){this.#t=new this.#m}async onEmpty(){this.#t.size!==0&&await this.#h("empty")}async onSizeLessThan(e){this.#t.size<e||await this.#h("next",()=>this.#t.size<e)}async onIdle(){this.#n===0&&this.#t.size===0||await this.#h("idle")}async#h(e,r){return new Promise(n=>{let i=o(()=>{r&&!r()||(this.off(e,i),n())},"listener");this.on(e,i)})}get size(){return this.#t.size}sizeBy(e){return this.#t.filter(e).length}get pending(){return this.#n}get isPaused(){return this.#s}};h();var Ta=re(mi(),1),Oa=re(Ar(),1),ka=re(Pr(),1),gs=re(qr(),1),Ca=re(ms(),1);var ys=gs.default;var qt=class{constructor(e,r,n){this.environment=r;this.endpoint=n;this.ctx=e.child({name:"client"}),this._graphqlWsClient=ai({url:`wss://${r.application.slug}.${W.domains.app}/edit/api/graphql-ws`,keepAlive:(0,_s.default)("10s"),shouldRetry:o(()=>!0,"shouldRetry"),connectionParams:{environment:r.name},webSocketImpl:class extends ys{static{o(this,"webSocketImpl")}constructor(i,s,a){super(i,s,{signal:e.signal,...a,headers:{...a?.headers,"user-agent":W.versionFull,...ar(e)}})}},on:{opened:o(()=>{this.ctx.log.trace("opened")},"opened"),ping:o(i=>{this.ctx.log.trace("ping",{received:i})},"ping"),pong:o(i=>{this.ctx.log.trace("pong",{received:i})},"pong"),connecting:o(()=>{switch(this.status){case 1:this.status=2,this.ctx.log.info("reconnecting");break;case 2:this.ctx.log.info("retrying");break;default:this.ctx.log.debug("connecting");break}},"connecting"),connected:o(()=>{this.status===2?this.ctx.log.info("reconnected"):this.ctx.log.debug("connected"),setImmediate(()=>this.status=0)},"connected"),closed:o(()=>{this.status=1,this.ctx.log.debug("disconnected")},"closed"),error:o(i=>{this.status===2?this.ctx.log.error("failed to reconnect",{error:i}):this.ctx.log.error("connection error",{error:i})},"error")}})}static{o(this,"Client")}status=0;ctx;_graphqlWsClient;subscribe(e,{subscription:r,variables:n,onResponse:i,onError:s,onComplete:a=Xr}){let u={query:r,variables:oe(n)},c=this._graphqlWsClient.on("connected",()=>{this.status===2&&(u.variables=oe(n),e.log.info("re-subscribing to graphql subscription"))}),f=new ct({concurrency:1}),p=o(_=>s(new Le(r,_)),"onError"),d=this._graphqlWsClient.subscribe(u,{next:o(_=>void f.add(()=>i(_)).catch(p),"next"),error:o(_=>void f.add(()=>p(_)),"error"),complete:o(()=>void f.add(()=>a()).catch(p),"complete")});return()=>{e.log.trace("unsubscribing from graphql subscription"),c(),f.clear(),d()}}async execute(e,r){let n=this.environment.application.slug;this.environment.application.multiEnvironmentEnabled?this.environment.type!=="production"&&(n+=`--${this.environment.name}`):this.environment.application.hasSplitEnvironments&&(n+="--development");try{let i=await Ot({context:{ctx:e},method:"POST",url:`https://${n}.${W.domains.app}${this.endpoint}`,headers:{...ar(e),"x-gadget-environment":this.environment.name},json:{query:r.operation,variables:oe(r.variables)},responseType:"json",resolveBodyOnly:!0,throwHttpErrors:!1,...r.http});if(!qe(i)||!("data"in i)&&!("errors"in i))throw e.log.error("received invalid graphql response",{error:i}),i;return i}catch(i){throw new Le(r.operation,i)}}async dispose(){await this._graphqlWsClient.dispose()}};var _t=class{static{o(this,"Api")}ctx;#e;constructor(e,r){this.ctx=e.child({name:"api"}),this.#e=new qt(this.ctx,r,"/api/graphql")}async query({query:e,variables:r,...n}){let i=/query (\w+)/.exec(e)?.[1];$a(i,"query name not found");let s=this.ctx.child({name:"api",fields:{edit:{query:i}},devFields:{edit:{query:i,variables:oe(r)}}});s.log.info("executing graphql query");let a=await this.#e.execute(s,{operation:e,variables:r,...n,http:{retry:{methods:["POST"]},...n.http}});if(a.errors)throw new Le(e,a.errors);if(!a.data)throw new Le(e,"Query response did not contain data");return a.data}async dispose(){await this.#e.dispose()}};h();var bs=_e(`
|
|
32
|
-
query GadgetMetaModels {
|
|
33
|
-
gadgetMeta {
|
|
34
|
-
models {
|
|
35
|
-
apiIdentifier
|
|
36
|
-
namespace
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
`),xs=_e(`
|
|
41
|
-
query GadgetMetaGlobalActions {
|
|
42
|
-
gadgetMeta {
|
|
43
|
-
globalActions {
|
|
44
|
-
apiIdentifier
|
|
45
|
-
namespace
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
`);var La=Object.freeze({Development:"development",Production:"production",Test:"test"}),Ra=N.object({id:N.union([N.string(),N.number(),N.bigint()]).transform(t=>BigInt(t)),name:N.string().transform(t=>t.toLowerCase()),type:N.nativeEnum(La)}),Aa=N.object({id:N.union([N.string(),N.number(),N.bigint()]).transform(t=>BigInt(t)),slug:N.string(),primaryDomain:N.string(),hasSplitEnvironments:N.boolean(),multiEnvironmentEnabled:N.boolean(),environments:N.array(Ra),team:N.object({id:N.union([N.string(),N.number(),N.bigint()]).transform(t=>BigInt(t)),name:N.string()})}),kh=N.object({apiIdentifier:N.string(),namespace:N.nullable(N.array(N.string())).optional()}),Ch=N.object({apiIdentifier:N.string(),namespace:N.nullable(N.array(N.string())).optional()}),$h=o(async t=>{let e=nt(t);if(!e)return[];let r=await Ot({context:{ctx:t},url:`https://${W.domains.services}/auth/api/apps`,headers:{...e},responseType:"json",resolveBodyOnly:!0});return N.array(Aa).parse(r)},"getApplications"),Lh=o(t=>{let e=new Map;for(let r of t){let n=r.team.name,i=e.get(n)??[];i.push(r),e.set(n,i)}return e},"groupByTeam"),Rh=o(async(t,e)=>{if(!nt(t))return[];let n=new _t(t,e),{gadgetMeta:i}=await n.query({query:bs});return i.models},"getModels"),Ah=o(async(t,e)=>{if(!nt(t))return[];let n=new _t(t,e),{gadgetMeta:i}=await n.query({query:xs});return i.globalActions},"getGlobalActions");export{pe as a,Ka as b,Ja as c,Ts as d,fc as e,Pe as f,Be as g,er as h,_n as i,bn as j,Sn as k,wc as l,wn as m,Sc as n,Le as o,ct as p,nt as q,jc as r,qt as s,La as t,$h as u,Lh as v,Rh as w,Ah as x,P as y,Hl as z,Ql as A,iu as B,Tt as C,Ot as D};
|
|
50
|
-
//# sourceMappingURL=chunk-LPBWX353.js.map
|
package/dist/chunk-VJVFVZNR.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import{z}from"./chunk-5NCJDCIZ.js";import{a as n,d as $,f as _,h as c}from"./chunk-7DYQUG5M.js";var G=$((ht,H)=>{c();function v(e){return Array.isArray(e)?e:[e]}n(v,"makeArray");var m="",N=" ",d="\\",k=/^\s+$/,W=/(?:[^\\]|^)\\$/,j=/^\\!/,B=/^\\#/,V=/\r?\n/g,K=/^\.*\/|^\.+$/,E="/",C="node-ignore";typeof Symbol<"u"&&(C=Symbol.for("node-ignore"));var S=C,Y=n((e,t,s)=>Object.defineProperty(e,t,{value:s}),"define"),M=/([0-z])-([0-z])/g,I=n(()=>!1,"RETURN_FALSE"),q=n(e=>e.replace(M,(t,s,r)=>s.charCodeAt(0)<=r.charCodeAt(0)?t:m),"sanitizeRange"),J=n(e=>{let{length:t}=e;return e.slice(0,t-t%2)},"cleanRangeBackSlash"),Q=[[/^\uFEFF/,()=>m],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,s)=>t+(s.indexOf("\\")===0?N:m)],[/(\\+?)\s/g,(e,t)=>{let{length:s}=t;return t.slice(0,s-s%2)+N}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,n(function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"},"startingReplacer")],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,s)=>t+6<s.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,s)=>{let r=s.replace(/\\\*/g,"[^\\/]*");return t+r}],[/\\\\\\(?=[$.|*+(){^])/g,()=>d],[/\\\\/g,()=>d],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,s,r,i)=>t===d?`\\[${s}${J(r)}${i}`:i==="]"&&r.length%2===0?`[${q(s)}${r}]`:"[]"],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,t)=>`${t?`${t}[^/]+`:"[^/]*"}(?=$|\\/$)`]],b=Object.create(null),U=n((e,t)=>{let s=b[e];return s||(s=Q.reduce((r,[i,o])=>r.replace(i,o.bind(e)),e),b[e]=s),t?new RegExp(s,"i"):new RegExp(s)},"makeRegex"),p=n(e=>typeof e=="string","isString"),Z=n(e=>e&&p(e)&&!k.test(e)&&!W.test(e)&&e.indexOf("#")!==0,"checkPattern"),tt=n(e=>e.split(V),"splitPattern"),y=class{static{n(this,"IgnoreRule")}constructor(t,s,r,i){this.origin=t,this.pattern=s,this.negative=r,this.regex=i}},et=n((e,t)=>{let s=e,r=!1;e.indexOf("!")===0&&(r=!0,e=e.substr(1)),e=e.replace(j,"!").replace(B,"#");let i=U(e,t);return new y(s,e,r,i)},"createRule"),st=n((e,t)=>{throw new t(e)},"throwError"),a=n((e,t,s)=>p(e)?e?a.isNotRelative(e)?s(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):!0:s("path must not be empty",TypeError):s(`path must be a string, but got \`${t}\``,TypeError),"checkPath"),O=n(e=>K.test(e),"isNotRelative");a.isNotRelative=O;a.convert=e=>e;var R=class{static{n(this,"Ignore")}constructor({ignorecase:t=!0,ignoreCase:s=t,allowRelativePaths:r=!1}={}){Y(this,S,!0),this._rules=[],this._ignoreCase=s,this._allowRelativePaths=r,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(t){if(t&&t[S]){this._rules=this._rules.concat(t._rules),this._added=!0;return}if(Z(t)){let s=et(t,this._ignoreCase);this._added=!0,this._rules.push(s)}}add(t){return this._added=!1,v(p(t)?tt(t):t).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(t){return this.add(t)}_testOne(t,s){let r=!1,i=!1;return this._rules.forEach(o=>{let{negative:u}=o;if(i===u&&r!==i||u&&!r&&!i&&!s)return;o.regex.test(t)&&(r=!u,i=u)}),{ignored:r,unignored:i}}_test(t,s,r,i){let o=t&&a.convert(t);return a(o,t,this._allowRelativePaths?I:st),this._t(o,s,r,i)}_t(t,s,r,i){if(t in s)return s[t];if(i||(i=t.split(E)),i.pop(),!i.length)return s[t]=this._testOne(t,r);let o=this._t(i.join(E)+E,s,r,i);return s[t]=o.ignored?o:this._testOne(t,r)}ignores(t){return this._test(t,this._ignoreCache,!1).ignored}createFilter(){return t=>!this.ignores(t)}filter(t){return v(t).filter(this.createFilter())}test(t){return this._test(t,this._testCache,!0)}},g=n(e=>new R(e),"factory"),rt=n(e=>a(e&&a.convert(e),e,I),"isPathValid");g.isPathValid=rt;g.default=g;H.exports=g;if(typeof process<"u"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){let e=n(s=>/^\\\\\?\\/.test(s)||/["<>|\u0000-\u001F]+/u.test(s)?s:s.replace(/\\/g,"/"),"makePosix");a.convert=e;let t=/^[a-z]:\//i;a.isNotRelative=s=>t.test(s)||O(s)}});var L=$((Et,T)=>{c();T.exports=function(e,t){if(typeof e!="string")throw new TypeError("expected path to be a string");if(e==="\\"||e==="/")return"/";var s=e.length;if(s<=1)return e;var r="";if(s>4&&e[3]==="\\"){var i=e[2];(i==="?"||i===".")&&e.slice(0,2)==="\\\\"&&(e=e.slice(2),r="//")}var o=e.split(/[/\\]+/);return t!==!1&&o[o.length-1]===""&&o.pop(),r+o.join("/")}});c();var f=_(z(),1),D=_(G(),1),A=_(L(),1);import it from"node:assert";import{createHash as nt}from"node:crypto";import l from"node:path";import{Transform as ot}from"node:stream";import{pipeline as at}from"node:stream/promises";var ct=[".gadget/"],lt=[".DS_Store","node_modules",".git"],ut=[".gadget/sync.json",".gadget/backup","yarn-error.log"],F=class e{constructor(t){this.path=t}static{n(this,"Directory")}_ignorer;_isHashing=!1;static async init(t){let s=new e(t);return await s.loadIgnoreFile(),s}relative(t){return l.isAbsolute(t)?l.relative(this.path,t):t}absolute(...t){let s=l.resolve(this.path,...t);return it(s.startsWith(this.path),`expected ${s} to be within ${this.path}`),s}normalize(t,s){return l.isAbsolute(t)&&(t=this.relative(t)),t=(0,A.default)(t,!0),s&&(t+="/"),t}async loadIgnoreFile(){this._ignorer=D.default.default(),this._ignorer.add(lt);try{let t=await f.default.readFile(this.absolute(".ignore"),"utf8");this._ignorer.add(t)}catch(t){X(t)}}ignores(t){return t=this.relative(t),t===""?!1:t.startsWith("..")||(t=(0,A.default)(t,!1),this._isHashing&&ut.some(s=>t.startsWith(s)))?!0:ct.some(s=>t.startsWith(s))?!1:this._ignorer.ignores(t)}async*walk({dir:t=this.path}={}){t!==this.path&&(yield this.normalize(t,!0));for await(let s of await f.default.opendir(t)){let r=l.join(t,s.name);this.ignores(r)||(s.isDirectory()?yield*this.walk({dir:r}):s.isFile()&&(yield this.normalize(r,!1)))}}async hashes(){try{this._isHashing=!0;let t={};for await(let s of this.walk()){let r=this.absolute(s);t[s]=await gt(r)}return t}finally{this._isHashing=!1}}async hasFiles(){return!await this.isEmptyOrNonExistent()}async isEmptyOrNonExistent(){let t=!0;try{for await(let s of this.walk()){t=!1;break}}catch(s){X(s)}return t}},ft=process.platform==="linux"||process.platform==="darwin",gt=n(async e=>{let t=nt("sha1");t.update(l.basename(e));let s=await f.default.stat(e),r;if(ft&&(r=s.mode&511),s.isDirectory())return{sha1:t.digest("hex"),permissions:r};let i=new ot({transform(o,u,h){if(!o.includes(13)){h(void 0,o);return}let x=Buffer.alloc(o.length),P=0;for(let w of o)w!==13&&(x[P++]=w);h(void 0,x.subarray(0,P))}});return await at(f.default.createReadStream(e),i,t),{sha1:t.digest("hex"),permissions:r}},"hash"),X=n(e=>{if(!(e&&typeof e=="object"&&"code"in e&&e.code==="ENOENT"))throw e},"swallowEnoent");export{F as a,ft as b,X as c};
|
|
2
|
-
/*! Bundled license information:
|
|
3
|
-
|
|
4
|
-
normalize-path/index.js:
|
|
5
|
-
(*!
|
|
6
|
-
* normalize-path <https://github.com/jonschlinkert/normalize-path>
|
|
7
|
-
*
|
|
8
|
-
* Copyright (c) 2014-2018, Jon Schlinkert.
|
|
9
|
-
* Released under the MIT License.
|
|
10
|
-
*)
|
|
11
|
-
*/
|
|
12
|
-
//# sourceMappingURL=chunk-VJVFVZNR.js.map
|
package/dist/login-4F3H443A.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{c as a,d as b,e as c}from"./chunk-PA2LOSVH.js";import"./chunk-LPBWX353.js";import"./chunk-F4S4AEEO.js";import"./chunk-XK6JJEHJ.js";import"./chunk-VJVFVZNR.js";import"./chunk-5NCJDCIZ.js";import"./chunk-GFQYFEEH.js";import"./chunk-7DYQUG5M.js";export{c as login,b as run,a as usage};
|
|
2
|
-
//# sourceMappingURL=login-4F3H443A.js.map
|
package/dist/push-KWUMHQCJ.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a,b,c}from"./chunk-L2MG47NS.js";import"./chunk-2CKK6A2Y.js";import"./chunk-I6BQ7MRE.js";import"./chunk-YT2LSGNB.js";import"./chunk-4WFO3NAS.js";import"./chunk-SIAMHUOB.js";import"./chunk-IYQBG4II.js";import"./chunk-HN3YKQ3C.js";import"./chunk-PA2LOSVH.js";import"./chunk-LPBWX353.js";import"./chunk-F4S4AEEO.js";import"./chunk-XK6JJEHJ.js";import"./chunk-VJVFVZNR.js";import"./chunk-5NCJDCIZ.js";import"./chunk-GFQYFEEH.js";import"./chunk-7DYQUG5M.js";export{a as args,c as run,b as usage};
|
|
2
|
-
//# sourceMappingURL=push-KWUMHQCJ.js.map
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|