@moonpay/cli 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-2WTRKQ5U.js +47 -0
- package/dist/chunk-7WGPMBRA.js +34 -0
- package/dist/chunk-AT2QGHZK.js +6 -0
- package/dist/chunk-GXU26BRG.js +795 -0
- package/dist/chunk-INE4OXJA.js +2 -0
- package/dist/chunk-JLT4XDAY.js +2 -0
- package/dist/chunk-KBP3ULPH.js +1 -0
- package/dist/chunk-LMDE72OE.js +2 -0
- package/dist/chunk-OYYN2ANR.js +4 -0
- package/dist/chunk-RGIDTLVF.js +28 -0
- package/dist/chunk-SEOEJZOL.js +2 -0
- package/dist/chunk-TOZGDNCY.js +2 -0
- package/dist/chunk-WZYJQ7YV.js +3 -0
- package/dist/chunk-X4FGWJTX.js +4 -0
- package/dist/cjs-45IF6THY.js +50 -0
- package/dist/cjs-TXBROUGT.js +2 -0
- package/dist/client-HKXT43GQ.js +2 -0
- package/dist/client-LENSTDQC.js +2 -0
- package/dist/esm-4G6WDGDX.js +116 -0
- package/dist/esm-4JOSPTGT.js +2 -0
- package/dist/esm-FE2LDJCN.js +2 -0
- package/dist/esm-GGU7JFHZ.js +32 -0
- package/dist/esm-GMRPTFSK.js +2 -0
- package/dist/esm-QATSH3KB.js +2 -0
- package/dist/index.js +2 -2
- package/dist/ledger-7LVGD3PM.js +11 -0
- package/dist/mcp-ILIKIYXA.js +2 -0
- package/dist/src-X7XKGWIB.js +2 -0
- package/dist/store-JISBK7RI.js +2 -0
- package/package.json +11 -5
- package/skills/moonpay-hardware-wallet/SKILL.md +121 -0
- package/dist/chunk-QKMQZGJZ.js +0 -33
- package/dist/chunk-RWULBSKJ.js +0 -3
- package/dist/mcp-ESIBPHE2.js +0 -2
- package/dist/store-GLKXZHAJ.js +0 -2
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
|
|
2
|
+
import{b as df,c as pf}from"./chunk-X4FGWJTX.js";import{$ as ac,$a as af,A as qu,Aa as $c,B as Cu,Ba as qc,C as Nu,Ca as Cc,D as Mu,Da as Nc,E as ju,Ea as Mc,F as Du,Fa as jc,G as Uu,Ga as Dc,H as Wu,Ha as Uc,I as Bu,Ia as Wc,J as Fu,Ja as Bc,K as Gu,Ka as Fc,L as Vu,La as Gc,M as zu,Ma as Vc,N as Xu,Na as zc,O as Hu,Oa as Xc,P as Yu,Pa as Hc,Q as Ju,Qa as Yc,R as Zu,Ra as Jc,S as Ku,Sa as Zc,T as Qu,Ta as Kc,U as ec,Ua as Qc,V as tc,Va as ef,W as rc,Wa as tf,X as nc,Xa as rf,Y as sc,Ya as nf,Z as ic,Za as sf,_ as oc,_a as of,a as cu,aa as uc,ab as uf,b as fu,ba as cc,bb as cf,c as lu,ca as fc,cb as ff,d as hu,da as lc,db as lf,e as du,ea as hc,eb as hf,f as pu,fa as dc,g as mu,ga as pc,h as _u,ha as mc,i as yu,ia as _c,j as gu,ja as yc,k as Yn,ka as gc,l as vu,la as vc,m as Eu,ma as Ec,n as bu,na as bc,o as Su,oa as Sc,p as wu,pa as wc,q as xu,qa as xc,r as Ou,ra as Oc,s as Tu,sa as Tc,t as Iu,ta as Ic,u as Ru,ua as Rc,v as Pu,va as Jn,w as Au,wa as Pc,x as Lu,xa as Ac,y as ku,ya as Lc,z as $u,za as kc}from"./chunk-OYYN2ANR.js";import{a as W,b as tt,c as O,d as uu}from"./chunk-LMDE72OE.js";var mf=O(()=>{"use strict";var Zn;(function(r){(function(e){var t=typeof globalThis=="object"?globalThis:typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:a(),n=s(r);typeof t.Reflect<"u"&&(n=s(t.Reflect,n)),e(n,t),typeof t.Reflect>"u"&&(t.Reflect=r);function s(c,f){return function(m,l){Object.defineProperty(c,m,{configurable:!0,writable:!0,value:l}),f&&f(m,l)}}function i(){try{return Function("return this;")()}catch{}}function o(){try{return(0,eval)("(function() { return this; })()")}catch{}}function a(){return i()||o()}})(function(e,t){var n=Object.prototype.hasOwnProperty,s=typeof Symbol=="function",i=s&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",o=s&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",a=typeof Object.create=="function",c={__proto__:[]}instanceof Array,f=!a&&!c,m={create:a?function(){return Or(Object.create(null))}:c?function(){return Or({__proto__:null})}:function(){return Or({})},has:f?function(h,d){return n.call(h,d)}:function(h,d){return d in h},get:f?function(h,d){return n.call(h,d)?h[d]:void 0}:function(h,d){return h[d]}},l=Object.getPrototypeOf(Function),p=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:nu(),_=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:su(),v=typeof WeakMap=="function"?WeakMap:iu(),w=s?Symbol.for("@reflect-metadata:registry"):void 0,L=eu(),Y=tu(L);function X(h,d,y,g){if(P(y)){if(!Wn(h))throw new TypeError;if(!Bn(d))throw new TypeError;return za(h,d)}else{if(!Wn(h))throw new TypeError;if(!M(d))throw new TypeError;if(!M(g)&&!P(g)&&!Ne(g))throw new TypeError;return Ne(g)&&(g=void 0),y=se(y),Xa(h,d,y,g)}}e("decorate",X);function Ce(h,d){function y(g,R){if(!M(g))throw new TypeError;if(!P(R)&&!Ka(R))throw new TypeError;Nn(h,d,g,R)}return y}e("metadata",Ce);function me(h,d,y,g){if(!M(y))throw new TypeError;return P(g)||(g=se(g)),Nn(h,d,y,g)}e("defineMetadata",me);function we(h,d,y){if(!M(d))throw new TypeError;return P(y)||(y=se(y)),$n(h,d,y)}e("hasMetadata",we);function kt(h,d,y){if(!M(d))throw new TypeError;return P(y)||(y=se(y)),Sr(h,d,y)}e("hasOwnMetadata",kt);function Ke(h,d,y){if(!M(d))throw new TypeError;return P(y)||(y=se(y)),qn(h,d,y)}e("getMetadata",Ke);function $t(h,d,y){if(!M(d))throw new TypeError;return P(y)||(y=se(y)),Cn(h,d,y)}e("getOwnMetadata",$t);function Qe(h,d){if(!M(h))throw new TypeError;return P(d)||(d=se(d)),Mn(h,d)}e("getMetadataKeys",Qe);function br(h,d){if(!M(h))throw new TypeError;return P(d)||(d=se(d)),jn(h,d)}e("getOwnMetadataKeys",br);function Va(h,d,y){if(!M(d))throw new TypeError;if(P(y)||(y=se(y)),!M(d))throw new TypeError;P(y)||(y=se(y));var g=et(d,y,!1);return P(g)?!1:g.OrdinaryDeleteMetadata(h,d,y)}e("deleteMetadata",Va);function za(h,d){for(var y=h.length-1;y>=0;--y){var g=h[y],R=g(d);if(!P(R)&&!Ne(R)){if(!Bn(R))throw new TypeError;d=R}}return d}function Xa(h,d,y,g){for(var R=h.length-1;R>=0;--R){var j=h[R],U=j(d,y,g);if(!P(U)&&!Ne(U)){if(!M(U))throw new TypeError;g=U}}return g}function $n(h,d,y){var g=Sr(h,d,y);if(g)return!0;var R=xr(d);return Ne(R)?!1:$n(h,R,y)}function Sr(h,d,y){var g=et(d,y,!1);return P(g)?!1:Un(g.OrdinaryHasOwnMetadata(h,d,y))}function qn(h,d,y){var g=Sr(h,d,y);if(g)return Cn(h,d,y);var R=xr(d);if(!Ne(R))return qn(h,R,y)}function Cn(h,d,y){var g=et(d,y,!1);if(!P(g))return g.OrdinaryGetOwnMetadata(h,d,y)}function Nn(h,d,y,g){var R=et(y,g,!0);R.OrdinaryDefineOwnMetadata(h,d,y,g)}function Mn(h,d){var y=jn(h,d),g=xr(h);if(g===null)return y;var R=Mn(g,d);if(R.length<=0)return y;if(y.length<=0)return R;for(var j=new _,U=[],k=0,E=y;k<E.length;k++){var x=E[k],T=j.has(x);T||(j.add(x),U.push(x))}for(var I=0,$=R;I<$.length;I++){var x=$[I],T=j.has(x);T||(j.add(x),U.push(x))}return U}function jn(h,d){var y=et(h,d,!1);return y?y.OrdinaryOwnMetadataKeys(h,d):[]}function Dn(h){if(h===null)return 1;switch(typeof h){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return h===null?1:6;default:return 6}}function P(h){return h===void 0}function Ne(h){return h===null}function Ha(h){return typeof h=="symbol"}function M(h){return typeof h=="object"?h!==null:typeof h=="function"}function Ya(h,d){switch(Dn(h)){case 0:return h;case 1:return h;case 2:return h;case 3:return h;case 4:return h;case 5:return h}var y=d===3?"string":d===5?"number":"default",g=Fn(h,i);if(g!==void 0){var R=g.call(h,y);if(M(R))throw new TypeError;return R}return Ja(h,y==="default"?"number":y)}function Ja(h,d){if(d==="string"){var y=h.toString;if(Me(y)){var g=y.call(h);if(!M(g))return g}var R=h.valueOf;if(Me(R)){var g=R.call(h);if(!M(g))return g}}else{var R=h.valueOf;if(Me(R)){var g=R.call(h);if(!M(g))return g}var j=h.toString;if(Me(j)){var g=j.call(h);if(!M(g))return g}}throw new TypeError}function Un(h){return!!h}function Za(h){return""+h}function se(h){var d=Ya(h,3);return Ha(d)?d:Za(d)}function Wn(h){return Array.isArray?Array.isArray(h):h instanceof Object?h instanceof Array:Object.prototype.toString.call(h)==="[object Array]"}function Me(h){return typeof h=="function"}function Bn(h){return typeof h=="function"}function Ka(h){switch(Dn(h)){case 3:return!0;case 4:return!0;default:return!1}}function wr(h,d){return h===d||h!==h&&d!==d}function Fn(h,d){var y=h[d];if(y!=null){if(!Me(y))throw new TypeError;return y}}function Gn(h){var d=Fn(h,o);if(!Me(d))throw new TypeError;var y=d.call(h);if(!M(y))throw new TypeError;return y}function Vn(h){return h.value}function zn(h){var d=h.next();return d.done?!1:d}function Xn(h){var d=h.return;d&&d.call(h)}function xr(h){var d=Object.getPrototypeOf(h);if(typeof h!="function"||h===l||d!==l)return d;var y=h.prototype,g=y&&Object.getPrototypeOf(y);if(g==null||g===Object.prototype)return d;var R=g.constructor;return typeof R!="function"||R===h?d:R}function Qa(){var h;!P(w)&&typeof t.Reflect<"u"&&!(w in t.Reflect)&&typeof t.Reflect.defineMetadata=="function"&&(h=ru(t.Reflect));var d,y,g,R=new v,j={registerProvider:U,getProvider:E,setProvider:T};return j;function U(I){if(!Object.isExtensible(j))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case h===I:break;case P(d):d=I;break;case d===I:break;case P(y):y=I;break;case y===I:break;default:g===void 0&&(g=new _),g.add(I);break}}function k(I,$){if(!P(d)){if(d.isProviderFor(I,$))return d;if(!P(y)){if(y.isProviderFor(I,$))return d;if(!P(g))for(var q=Gn(g);;){var D=zn(q);if(!D)return;var re=Vn(D);if(re.isProviderFor(I,$))return Xn(q),re}}}if(!P(h)&&h.isProviderFor(I,$))return h}function E(I,$){var q=R.get(I),D;return P(q)||(D=q.get($)),P(D)&&(D=k(I,$),P(D)||(P(q)&&(q=new p,R.set(I,q)),q.set($,D))),D}function x(I){if(P(I))throw new TypeError;return d===I||y===I||!P(g)&&g.has(I)}function T(I,$,q){if(!x(q))throw new Error("Metadata provider not registered.");var D=E(I,$);if(D!==q){if(!P(D))return!1;var re=R.get(I);P(re)&&(re=new p,R.set(I,re)),re.set($,q)}return!0}}function eu(){var h;return!P(w)&&M(t.Reflect)&&Object.isExtensible(t.Reflect)&&(h=t.Reflect[w]),P(h)&&(h=Qa()),!P(w)&&M(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,w,{enumerable:!1,configurable:!1,writable:!1,value:h}),h}function tu(h){var d=new v,y={isProviderFor:function(x,T){var I=d.get(x);return P(I)?!1:I.has(T)},OrdinaryDefineOwnMetadata:U,OrdinaryHasOwnMetadata:R,OrdinaryGetOwnMetadata:j,OrdinaryOwnMetadataKeys:k,OrdinaryDeleteMetadata:E};return L.registerProvider(y),y;function g(x,T,I){var $=d.get(x),q=!1;if(P($)){if(!I)return;$=new p,d.set(x,$),q=!0}var D=$.get(T);if(P(D)){if(!I)return;if(D=new p,$.set(T,D),!h.setProvider(x,T,y))throw $.delete(T),q&&d.delete(x),new Error("Wrong provider for target.")}return D}function R(x,T,I){var $=g(T,I,!1);return P($)?!1:Un($.has(x))}function j(x,T,I){var $=g(T,I,!1);if(!P($))return $.get(x)}function U(x,T,I,$){var q=g(I,$,!0);q.set(x,T)}function k(x,T){var I=[],$=g(x,T,!1);if(P($))return I;for(var q=$.keys(),D=Gn(q),re=0;;){var Hn=zn(D);if(!Hn)return I.length=re,I;var ou=Vn(Hn);try{I[re]=ou}catch(au){try{Xn(D)}finally{throw au}}re++}}function E(x,T,I){var $=g(T,I,!1);if(P($)||!$.delete(x))return!1;if($.size===0){var q=d.get(T);P(q)||(q.delete(I),q.size===0&&d.delete(q))}return!0}}function ru(h){var d=h.defineMetadata,y=h.hasOwnMetadata,g=h.getOwnMetadata,R=h.getOwnMetadataKeys,j=h.deleteMetadata,U=new v,k={isProviderFor:function(E,x){var T=U.get(E);return!P(T)&&T.has(x)?!0:R(E,x).length?(P(T)&&(T=new _,U.set(E,T)),T.add(x),!0):!1},OrdinaryDefineOwnMetadata:d,OrdinaryHasOwnMetadata:y,OrdinaryGetOwnMetadata:g,OrdinaryOwnMetadataKeys:R,OrdinaryDeleteMetadata:j};return k}function et(h,d,y){var g=L.getProvider(h,d);if(!P(g))return g;if(y){if(L.setProvider(h,d,Y))return Y;throw new Error("Illegal state.")}}function nu(){var h={},d=[],y=(function(){function k(E,x,T){this._index=0,this._keys=E,this._values=x,this._selector=T}return k.prototype["@@iterator"]=function(){return this},k.prototype[o]=function(){return this},k.prototype.next=function(){var E=this._index;if(E>=0&&E<this._keys.length){var x=this._selector(this._keys[E],this._values[E]);return E+1>=this._keys.length?(this._index=-1,this._keys=d,this._values=d):this._index++,{value:x,done:!1}}return{value:void 0,done:!0}},k.prototype.throw=function(E){throw this._index>=0&&(this._index=-1,this._keys=d,this._values=d),E},k.prototype.return=function(E){return this._index>=0&&(this._index=-1,this._keys=d,this._values=d),{value:E,done:!0}},k})(),g=(function(){function k(){this._keys=[],this._values=[],this._cacheKey=h,this._cacheIndex=-2}return Object.defineProperty(k.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),k.prototype.has=function(E){return this._find(E,!1)>=0},k.prototype.get=function(E){var x=this._find(E,!1);return x>=0?this._values[x]:void 0},k.prototype.set=function(E,x){var T=this._find(E,!0);return this._values[T]=x,this},k.prototype.delete=function(E){var x=this._find(E,!1);if(x>=0){for(var T=this._keys.length,I=x+1;I<T;I++)this._keys[I-1]=this._keys[I],this._values[I-1]=this._values[I];return this._keys.length--,this._values.length--,wr(E,this._cacheKey)&&(this._cacheKey=h,this._cacheIndex=-2),!0}return!1},k.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=h,this._cacheIndex=-2},k.prototype.keys=function(){return new y(this._keys,this._values,R)},k.prototype.values=function(){return new y(this._keys,this._values,j)},k.prototype.entries=function(){return new y(this._keys,this._values,U)},k.prototype["@@iterator"]=function(){return this.entries()},k.prototype[o]=function(){return this.entries()},k.prototype._find=function(E,x){if(!wr(this._cacheKey,E)){this._cacheIndex=-1;for(var T=0;T<this._keys.length;T++)if(wr(this._keys[T],E)){this._cacheIndex=T;break}}return this._cacheIndex<0&&x&&(this._cacheIndex=this._keys.length,this._keys.push(E),this._values.push(void 0)),this._cacheIndex},k})();return g;function R(k,E){return k}function j(k,E){return E}function U(k,E){return[k,E]}}function su(){var h=(function(){function d(){this._map=new p}return Object.defineProperty(d.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),d.prototype.has=function(y){return this._map.has(y)},d.prototype.add=function(y){return this._map.set(y,y),this},d.prototype.delete=function(y){return this._map.delete(y)},d.prototype.clear=function(){this._map.clear()},d.prototype.keys=function(){return this._map.keys()},d.prototype.values=function(){return this._map.keys()},d.prototype.entries=function(){return this._map.entries()},d.prototype["@@iterator"]=function(){return this.keys()},d.prototype[o]=function(){return this.keys()},d})();return h}function iu(){var h=16,d=m.create(),y=g();return(function(){function E(){this._key=g()}return E.prototype.has=function(x){var T=R(x,!1);return T!==void 0?m.has(T,this._key):!1},E.prototype.get=function(x){var T=R(x,!1);return T!==void 0?m.get(T,this._key):void 0},E.prototype.set=function(x,T){var I=R(x,!0);return I[this._key]=T,this},E.prototype.delete=function(x){var T=R(x,!1);return T!==void 0?delete T[this._key]:!1},E.prototype.clear=function(){this._key=g()},E})();function g(){var E;do E="@@WeakMap@@"+k();while(m.has(d,E));return d[E]=!0,E}function R(E,x){if(!n.call(E,y)){if(!x)return;Object.defineProperty(E,y,{value:m.create()})}return E[y]}function j(E,x){for(var T=0;T<x;++T)E[T]=Math.random()*255|0;return E}function U(E){if(typeof Uint8Array=="function"){var x=new Uint8Array(E);return typeof crypto<"u"?crypto.getRandomValues(x):typeof msCrypto<"u"?msCrypto.getRandomValues(x):j(x,E),x}return j(new Array(E),E)}function k(){var E=U(h);E[6]=E[6]&79|64,E[8]=E[8]&191|128;for(var x="",T=0;T<h;++T){var I=E[T];(T===4||T===6||T===8)&&(x+="-"),I<16&&(x+="0"),x+=I.toString(16).toLowerCase()}return x}}function Or(h){return h.__=void 0,delete h.__,h}})})(Zn||(Zn={}))});var rt=O((ig,Kn)=>{"use strict";var _f="2.0.0",yf=Number.MAX_SAFE_INTEGER||9007199254740991,gf=16,vf=250,Ef=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Kn.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:gf,MAX_SAFE_BUILD_LENGTH:vf,MAX_SAFE_INTEGER:yf,RELEASE_TYPES:Ef,SEMVER_SPEC_VERSION:_f,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var nt=O((og,Qn)=>{"use strict";var bf=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...r)=>console.error("SEMVER",...r):()=>{};Qn.exports=bf});var je=O((ie,es)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:Tr,MAX_SAFE_BUILD_LENGTH:Sf,MAX_LENGTH:wf}=rt(),xf=nt();ie=es.exports={};var Of=ie.re=[],Tf=ie.safeRe=[],b=ie.src=[],If=ie.safeSrc=[],S=ie.t={},Rf=0,Ir="[a-zA-Z0-9-]",Pf=[["\\s",1],["\\d",wf],[Ir,Sf]],Af=r=>{for(let[e,t]of Pf)r=r.split(`${e}*`).join(`${e}{0,${t}}`).split(`${e}+`).join(`${e}{1,${t}}`);return r},A=(r,e,t)=>{let n=Af(e),s=Rf++;xf(r,s,e),S[r]=s,b[s]=e,If[s]=n,Of[s]=new RegExp(e,t?"g":void 0),Tf[s]=new RegExp(n,t?"g":void 0)};A("NUMERICIDENTIFIER","0|[1-9]\\d*");A("NUMERICIDENTIFIERLOOSE","\\d+");A("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Ir}*`);A("MAINVERSION",`(${b[S.NUMERICIDENTIFIER]})\\.(${b[S.NUMERICIDENTIFIER]})\\.(${b[S.NUMERICIDENTIFIER]})`);A("MAINVERSIONLOOSE",`(${b[S.NUMERICIDENTIFIERLOOSE]})\\.(${b[S.NUMERICIDENTIFIERLOOSE]})\\.(${b[S.NUMERICIDENTIFIERLOOSE]})`);A("PRERELEASEIDENTIFIER",`(?:${b[S.NONNUMERICIDENTIFIER]}|${b[S.NUMERICIDENTIFIER]})`);A("PRERELEASEIDENTIFIERLOOSE",`(?:${b[S.NONNUMERICIDENTIFIER]}|${b[S.NUMERICIDENTIFIERLOOSE]})`);A("PRERELEASE",`(?:-(${b[S.PRERELEASEIDENTIFIER]}(?:\\.${b[S.PRERELEASEIDENTIFIER]})*))`);A("PRERELEASELOOSE",`(?:-?(${b[S.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${b[S.PRERELEASEIDENTIFIERLOOSE]})*))`);A("BUILDIDENTIFIER",`${Ir}+`);A("BUILD",`(?:\\+(${b[S.BUILDIDENTIFIER]}(?:\\.${b[S.BUILDIDENTIFIER]})*))`);A("FULLPLAIN",`v?${b[S.MAINVERSION]}${b[S.PRERELEASE]}?${b[S.BUILD]}?`);A("FULL",`^${b[S.FULLPLAIN]}$`);A("LOOSEPLAIN",`[v=\\s]*${b[S.MAINVERSIONLOOSE]}${b[S.PRERELEASELOOSE]}?${b[S.BUILD]}?`);A("LOOSE",`^${b[S.LOOSEPLAIN]}$`);A("GTLT","((?:<|>)?=?)");A("XRANGEIDENTIFIERLOOSE",`${b[S.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);A("XRANGEIDENTIFIER",`${b[S.NUMERICIDENTIFIER]}|x|X|\\*`);A("XRANGEPLAIN",`[v=\\s]*(${b[S.XRANGEIDENTIFIER]})(?:\\.(${b[S.XRANGEIDENTIFIER]})(?:\\.(${b[S.XRANGEIDENTIFIER]})(?:${b[S.PRERELEASE]})?${b[S.BUILD]}?)?)?`);A("XRANGEPLAINLOOSE",`[v=\\s]*(${b[S.XRANGEIDENTIFIERLOOSE]})(?:\\.(${b[S.XRANGEIDENTIFIERLOOSE]})(?:\\.(${b[S.XRANGEIDENTIFIERLOOSE]})(?:${b[S.PRERELEASELOOSE]})?${b[S.BUILD]}?)?)?`);A("XRANGE",`^${b[S.GTLT]}\\s*${b[S.XRANGEPLAIN]}$`);A("XRANGELOOSE",`^${b[S.GTLT]}\\s*${b[S.XRANGEPLAINLOOSE]}$`);A("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Tr}})(?:\\.(\\d{1,${Tr}}))?(?:\\.(\\d{1,${Tr}}))?`);A("COERCE",`${b[S.COERCEPLAIN]}(?:$|[^\\d])`);A("COERCEFULL",b[S.COERCEPLAIN]+`(?:${b[S.PRERELEASE]})?(?:${b[S.BUILD]})?(?:$|[^\\d])`);A("COERCERTL",b[S.COERCE],!0);A("COERCERTLFULL",b[S.COERCEFULL],!0);A("LONETILDE","(?:~>?)");A("TILDETRIM",`(\\s*)${b[S.LONETILDE]}\\s+`,!0);ie.tildeTrimReplace="$1~";A("TILDE",`^${b[S.LONETILDE]}${b[S.XRANGEPLAIN]}$`);A("TILDELOOSE",`^${b[S.LONETILDE]}${b[S.XRANGEPLAINLOOSE]}$`);A("LONECARET","(?:\\^)");A("CARETTRIM",`(\\s*)${b[S.LONECARET]}\\s+`,!0);ie.caretTrimReplace="$1^";A("CARET",`^${b[S.LONECARET]}${b[S.XRANGEPLAIN]}$`);A("CARETLOOSE",`^${b[S.LONECARET]}${b[S.XRANGEPLAINLOOSE]}$`);A("COMPARATORLOOSE",`^${b[S.GTLT]}\\s*(${b[S.LOOSEPLAIN]})$|^$`);A("COMPARATOR",`^${b[S.GTLT]}\\s*(${b[S.FULLPLAIN]})$|^$`);A("COMPARATORTRIM",`(\\s*)${b[S.GTLT]}\\s*(${b[S.LOOSEPLAIN]}|${b[S.XRANGEPLAIN]})`,!0);ie.comparatorTrimReplace="$1$2$3";A("HYPHENRANGE",`^\\s*(${b[S.XRANGEPLAIN]})\\s+-\\s+(${b[S.XRANGEPLAIN]})\\s*$`);A("HYPHENRANGELOOSE",`^\\s*(${b[S.XRANGEPLAINLOOSE]})\\s+-\\s+(${b[S.XRANGEPLAINLOOSE]})\\s*$`);A("STAR","(<|>)?=?\\s*\\*");A("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");A("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var qt=O((ag,ts)=>{"use strict";var Lf=Object.freeze({loose:!0}),kf=Object.freeze({}),$f=r=>r?typeof r!="object"?Lf:r:kf;ts.exports=$f});var Rr=O((ug,ss)=>{"use strict";var rs=/^[0-9]+$/,ns=(r,e)=>{let t=rs.test(r),n=rs.test(e);return t&&n&&(r=+r,e=+e),r===e?0:t&&!n?-1:n&&!t?1:r<e?-1:1},qf=(r,e)=>ns(e,r);ss.exports={compareIdentifiers:ns,rcompareIdentifiers:qf}});var F=O((cg,os)=>{"use strict";var Ct=nt(),{MAX_LENGTH:is,MAX_SAFE_INTEGER:Nt}=rt(),{safeRe:Mt,t:jt}=je(),Cf=qt(),{compareIdentifiers:De}=Rr(),Pr=class r{constructor(e,t){if(t=Cf(t),e instanceof r){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>is)throw new TypeError(`version is longer than ${is} characters`);Ct("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let n=e.trim().match(t.loose?Mt[jt.LOOSE]:Mt[jt.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Nt||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Nt||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Nt||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){let i=+s;if(i>=0&&i<Nt)return i}return s}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(Ct("SemVer.compare",this.version,this.options,e),!(e instanceof r)){if(typeof e=="string"&&e===this.version)return 0;e=new r(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof r||(e=new r(e,this.options)),De(this.major,e.major)||De(this.minor,e.minor)||De(this.patch,e.patch)}comparePre(e){if(e instanceof r||(e=new r(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let n=this.prerelease[t],s=e.prerelease[t];if(Ct("prerelease compare",t,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return De(n,s)}while(++t)}compareBuild(e){e instanceof r||(e=new r(e,this.options));let t=0;do{let n=this.build[t],s=e.build[t];if(Ct("build compare",t,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return De(n,s)}while(++t)}inc(e,t,n){if(e.startsWith("pre")){if(!t&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(t){let s=`-${t}`.match(this.options.loose?Mt[jt.PRERELEASELOOSE]:Mt[jt.PRERELEASE]);if(!s||s[1]!==t)throw new Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,n),this.inc("pre",t,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",t,n),this.inc("pre",t,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let s=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[s];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(t===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(t){let i=[t,s];n===!1&&(i=[t]),De(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};os.exports=Pr});var xe=O((fg,us)=>{"use strict";var as=F(),Nf=(r,e,t=!1)=>{if(r instanceof as)return r;try{return new as(r,e)}catch(n){if(!t)return null;throw n}};us.exports=Nf});var fs=O((lg,cs)=>{"use strict";var Mf=xe(),jf=(r,e)=>{let t=Mf(r,e);return t?t.version:null};cs.exports=jf});var hs=O((hg,ls)=>{"use strict";var Df=xe(),Uf=(r,e)=>{let t=Df(r.trim().replace(/^[=v]+/,""),e);return t?t.version:null};ls.exports=Uf});var ms=O((dg,ps)=>{"use strict";var ds=F(),Wf=(r,e,t,n,s)=>{typeof t=="string"&&(s=n,n=t,t=void 0);try{return new ds(r instanceof ds?r.version:r,t).inc(e,n,s).version}catch{return null}};ps.exports=Wf});var gs=O((pg,ys)=>{"use strict";var _s=xe(),Bf=(r,e)=>{let t=_s(r,null,!0),n=_s(e,null,!0),s=t.compare(n);if(s===0)return null;let i=s>0,o=i?t:n,a=i?n:t,c=!!o.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0)return a.minor&&!a.patch?"minor":"patch"}let m=c?"pre":"";return t.major!==n.major?m+"major":t.minor!==n.minor?m+"minor":t.patch!==n.patch?m+"patch":"prerelease"};ys.exports=Bf});var Es=O((mg,vs)=>{"use strict";var Ff=F(),Gf=(r,e)=>new Ff(r,e).major;vs.exports=Gf});var Ss=O((_g,bs)=>{"use strict";var Vf=F(),zf=(r,e)=>new Vf(r,e).minor;bs.exports=zf});var xs=O((yg,ws)=>{"use strict";var Xf=F(),Hf=(r,e)=>new Xf(r,e).patch;ws.exports=Hf});var Ts=O((gg,Os)=>{"use strict";var Yf=xe(),Jf=(r,e)=>{let t=Yf(r,e);return t&&t.prerelease.length?t.prerelease:null};Os.exports=Jf});var Z=O((vg,Rs)=>{"use strict";var Is=F(),Zf=(r,e,t)=>new Is(r,t).compare(new Is(e,t));Rs.exports=Zf});var As=O((Eg,Ps)=>{"use strict";var Kf=Z(),Qf=(r,e,t)=>Kf(e,r,t);Ps.exports=Qf});var ks=O((bg,Ls)=>{"use strict";var el=Z(),tl=(r,e)=>el(r,e,!0);Ls.exports=tl});var Dt=O((Sg,qs)=>{"use strict";var $s=F(),rl=(r,e,t)=>{let n=new $s(r,t),s=new $s(e,t);return n.compare(s)||n.compareBuild(s)};qs.exports=rl});var Ns=O((wg,Cs)=>{"use strict";var nl=Dt(),sl=(r,e)=>r.sort((t,n)=>nl(t,n,e));Cs.exports=sl});var js=O((xg,Ms)=>{"use strict";var il=Dt(),ol=(r,e)=>r.sort((t,n)=>il(n,t,e));Ms.exports=ol});var st=O((Og,Ds)=>{"use strict";var al=Z(),ul=(r,e,t)=>al(r,e,t)>0;Ds.exports=ul});var Ut=O((Tg,Us)=>{"use strict";var cl=Z(),fl=(r,e,t)=>cl(r,e,t)<0;Us.exports=fl});var Ar=O((Ig,Ws)=>{"use strict";var ll=Z(),hl=(r,e,t)=>ll(r,e,t)===0;Ws.exports=hl});var Lr=O((Rg,Bs)=>{"use strict";var dl=Z(),pl=(r,e,t)=>dl(r,e,t)!==0;Bs.exports=pl});var Wt=O((Pg,Fs)=>{"use strict";var ml=Z(),_l=(r,e,t)=>ml(r,e,t)>=0;Fs.exports=_l});var Bt=O((Ag,Gs)=>{"use strict";var yl=Z(),gl=(r,e,t)=>yl(r,e,t)<=0;Gs.exports=gl});var kr=O((Lg,Vs)=>{"use strict";var vl=Ar(),El=Lr(),bl=st(),Sl=Wt(),wl=Ut(),xl=Bt(),Ol=(r,e,t,n)=>{switch(e){case"===":return typeof r=="object"&&(r=r.version),typeof t=="object"&&(t=t.version),r===t;case"!==":return typeof r=="object"&&(r=r.version),typeof t=="object"&&(t=t.version),r!==t;case"":case"=":case"==":return vl(r,t,n);case"!=":return El(r,t,n);case">":return bl(r,t,n);case">=":return Sl(r,t,n);case"<":return wl(r,t,n);case"<=":return xl(r,t,n);default:throw new TypeError(`Invalid operator: ${e}`)}};Vs.exports=Ol});var Xs=O((kg,zs)=>{"use strict";var Tl=F(),Il=xe(),{safeRe:Ft,t:Gt}=je(),Rl=(r,e)=>{if(r instanceof Tl)return r;if(typeof r=="number"&&(r=String(r)),typeof r!="string")return null;e=e||{};let t=null;if(!e.rtl)t=r.match(e.includePrerelease?Ft[Gt.COERCEFULL]:Ft[Gt.COERCE]);else{let c=e.includePrerelease?Ft[Gt.COERCERTLFULL]:Ft[Gt.COERCERTL],f;for(;(f=c.exec(r))&&(!t||t.index+t[0].length!==r.length);)(!t||f.index+f[0].length!==t.index+t[0].length)&&(t=f),c.lastIndex=f.index+f[1].length+f[2].length;c.lastIndex=-1}if(t===null)return null;let n=t[2],s=t[3]||"0",i=t[4]||"0",o=e.includePrerelease&&t[5]?`-${t[5]}`:"",a=e.includePrerelease&&t[6]?`+${t[6]}`:"";return Il(`${n}.${s}.${i}${o}${a}`,e)};zs.exports=Rl});var Ys=O(($g,Hs)=>{"use strict";var $r=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let s=this.map.keys().next().value;this.delete(s)}this.map.set(e,t)}return this}};Hs.exports=$r});var K=O((qg,Qs)=>{"use strict";var Pl=/\s+/g,qr=class r{constructor(e,t){if(t=Ll(t),e instanceof r)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new r(e.raw,t);if(e instanceof Cr)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(Pl," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(s=>!Zs(s[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let s of this.set)if(s.length===1&&jl(s[0])){this.set=[s];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let t=this.set[e];for(let n=0;n<t.length;n++)n>0&&(this.formatted+=" "),this.formatted+=t[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let n=((this.options.includePrerelease&&Nl)|(this.options.loose&&Ml))+":"+e,s=Js.get(n);if(s)return s;let i=this.options.loose,o=i?H[G.HYPHENRANGELOOSE]:H[G.HYPHENRANGE];e=e.replace(o,Hl(this.options.includePrerelease)),C("hyphen replace",e),e=e.replace(H[G.COMPARATORTRIM],$l),C("comparator trim",e),e=e.replace(H[G.TILDETRIM],ql),C("tilde trim",e),e=e.replace(H[G.CARETTRIM],Cl),C("caret trim",e);let a=e.split(" ").map(l=>Dl(l,this.options)).join(" ").split(/\s+/).map(l=>Xl(l,this.options));i&&(a=a.filter(l=>(C("loose invalid filter",l,this.options),!!l.match(H[G.COMPARATORLOOSE])))),C("range list",a);let c=new Map,f=a.map(l=>new Cr(l,this.options));for(let l of f){if(Zs(l))return[l];c.set(l.value,l)}c.size>1&&c.has("")&&c.delete("");let m=[...c.values()];return Js.set(n,m),m}intersects(e,t){if(!(e instanceof r))throw new TypeError("a Range is required");return this.set.some(n=>Ks(n,t)&&e.set.some(s=>Ks(s,t)&&n.every(i=>s.every(o=>i.intersects(o,t)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new kl(e,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(Yl(this.set[t],e,this.options))return!0;return!1}};Qs.exports=qr;var Al=Ys(),Js=new Al,Ll=qt(),Cr=it(),C=nt(),kl=F(),{safeRe:H,t:G,comparatorTrimReplace:$l,tildeTrimReplace:ql,caretTrimReplace:Cl}=je(),{FLAG_INCLUDE_PRERELEASE:Nl,FLAG_LOOSE:Ml}=rt(),Zs=r=>r.value==="<0.0.0-0",jl=r=>r.value==="",Ks=(r,e)=>{let t=!0,n=r.slice(),s=n.pop();for(;t&&n.length;)t=n.every(i=>s.intersects(i,e)),s=n.pop();return t},Dl=(r,e)=>(C("comp",r,e),r=Bl(r,e),C("caret",r),r=Ul(r,e),C("tildes",r),r=Gl(r,e),C("xrange",r),r=zl(r,e),C("stars",r),r),V=r=>!r||r.toLowerCase()==="x"||r==="*",Ul=(r,e)=>r.trim().split(/\s+/).map(t=>Wl(t,e)).join(" "),Wl=(r,e)=>{let t=e.loose?H[G.TILDELOOSE]:H[G.TILDE];return r.replace(t,(n,s,i,o,a)=>{C("tilde",r,n,s,i,o,a);let c;return V(s)?c="":V(i)?c=`>=${s}.0.0 <${+s+1}.0.0-0`:V(o)?c=`>=${s}.${i}.0 <${s}.${+i+1}.0-0`:a?(C("replaceTilde pr",a),c=`>=${s}.${i}.${o}-${a} <${s}.${+i+1}.0-0`):c=`>=${s}.${i}.${o} <${s}.${+i+1}.0-0`,C("tilde return",c),c})},Bl=(r,e)=>r.trim().split(/\s+/).map(t=>Fl(t,e)).join(" "),Fl=(r,e)=>{C("caret",r,e);let t=e.loose?H[G.CARETLOOSE]:H[G.CARET],n=e.includePrerelease?"-0":"";return r.replace(t,(s,i,o,a,c)=>{C("caret",r,s,i,o,a,c);let f;return V(i)?f="":V(o)?f=`>=${i}.0.0${n} <${+i+1}.0.0-0`:V(a)?i==="0"?f=`>=${i}.${o}.0${n} <${i}.${+o+1}.0-0`:f=`>=${i}.${o}.0${n} <${+i+1}.0.0-0`:c?(C("replaceCaret pr",c),i==="0"?o==="0"?f=`>=${i}.${o}.${a}-${c} <${i}.${o}.${+a+1}-0`:f=`>=${i}.${o}.${a}-${c} <${i}.${+o+1}.0-0`:f=`>=${i}.${o}.${a}-${c} <${+i+1}.0.0-0`):(C("no pr"),i==="0"?o==="0"?f=`>=${i}.${o}.${a}${n} <${i}.${o}.${+a+1}-0`:f=`>=${i}.${o}.${a}${n} <${i}.${+o+1}.0-0`:f=`>=${i}.${o}.${a} <${+i+1}.0.0-0`),C("caret return",f),f})},Gl=(r,e)=>(C("replaceXRanges",r,e),r.split(/\s+/).map(t=>Vl(t,e)).join(" ")),Vl=(r,e)=>{r=r.trim();let t=e.loose?H[G.XRANGELOOSE]:H[G.XRANGE];return r.replace(t,(n,s,i,o,a,c)=>{C("xRange",r,n,s,i,o,a,c);let f=V(i),m=f||V(o),l=m||V(a),p=l;return s==="="&&p&&(s=""),c=e.includePrerelease?"-0":"",f?s===">"||s==="<"?n="<0.0.0-0":n="*":s&&p?(m&&(o=0),a=0,s===">"?(s=">=",m?(i=+i+1,o=0,a=0):(o=+o+1,a=0)):s==="<="&&(s="<",m?i=+i+1:o=+o+1),s==="<"&&(c="-0"),n=`${s+i}.${o}.${a}${c}`):m?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:l&&(n=`>=${i}.${o}.0${c} <${i}.${+o+1}.0-0`),C("xRange return",n),n})},zl=(r,e)=>(C("replaceStars",r,e),r.trim().replace(H[G.STAR],"")),Xl=(r,e)=>(C("replaceGTE0",r,e),r.trim().replace(H[e.includePrerelease?G.GTE0PRE:G.GTE0],"")),Hl=r=>(e,t,n,s,i,o,a,c,f,m,l,p)=>(V(n)?t="":V(s)?t=`>=${n}.0.0${r?"-0":""}`:V(i)?t=`>=${n}.${s}.0${r?"-0":""}`:o?t=`>=${t}`:t=`>=${t}${r?"-0":""}`,V(f)?c="":V(m)?c=`<${+f+1}.0.0-0`:V(l)?c=`<${f}.${+m+1}.0-0`:p?c=`<=${f}.${m}.${l}-${p}`:r?c=`<${f}.${m}.${+l+1}-0`:c=`<=${c}`,`${t} ${c}`.trim()),Yl=(r,e,t)=>{for(let n=0;n<r.length;n++)if(!r[n].test(e))return!1;if(e.prerelease.length&&!t.includePrerelease){for(let n=0;n<r.length;n++)if(C(r[n].semver),r[n].semver!==Cr.ANY&&r[n].semver.prerelease.length>0){let s=r[n].semver;if(s.major===e.major&&s.minor===e.minor&&s.patch===e.patch)return!0}return!1}return!0}});var it=O((Cg,ii)=>{"use strict";var ot=Symbol("SemVer ANY"),jr=class r{static get ANY(){return ot}constructor(e,t){if(t=ei(t),e instanceof r){if(e.loose===!!t.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),Mr("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===ot?this.value="":this.value=this.operator+this.semver.version,Mr("comp",this)}parse(e){let t=this.options.loose?ti[ri.COMPARATORLOOSE]:ti[ri.COMPARATOR],n=e.match(t);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new ni(n[2],this.options.loose):this.semver=ot}toString(){return this.value}test(e){if(Mr("Comparator.test",e,this.options.loose),this.semver===ot||e===ot)return!0;if(typeof e=="string")try{e=new ni(e,this.options)}catch{return!1}return Nr(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof r))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new si(e.value,t).test(this.value):e.operator===""?e.value===""?!0:new si(this.value,t).test(e.semver):(t=ei(t),t.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||Nr(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||Nr(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};ii.exports=jr;var ei=qt(),{safeRe:ti,t:ri}=je(),Nr=kr(),Mr=nt(),ni=F(),si=K()});var at=O((Ng,oi)=>{"use strict";var Jl=K(),Zl=(r,e,t)=>{try{e=new Jl(e,t)}catch{return!1}return e.test(r)};oi.exports=Zl});var ui=O((Mg,ai)=>{"use strict";var Kl=K(),Ql=(r,e)=>new Kl(r,e).set.map(t=>t.map(n=>n.value).join(" ").trim().split(" "));ai.exports=Ql});var fi=O((jg,ci)=>{"use strict";var eh=F(),th=K(),rh=(r,e,t)=>{let n=null,s=null,i=null;try{i=new th(e,t)}catch{return null}return r.forEach(o=>{i.test(o)&&(!n||s.compare(o)===-1)&&(n=o,s=new eh(n,t))}),n};ci.exports=rh});var hi=O((Dg,li)=>{"use strict";var nh=F(),sh=K(),ih=(r,e,t)=>{let n=null,s=null,i=null;try{i=new sh(e,t)}catch{return null}return r.forEach(o=>{i.test(o)&&(!n||s.compare(o)===1)&&(n=o,s=new nh(n,t))}),n};li.exports=ih});var mi=O((Ug,pi)=>{"use strict";var Dr=F(),oh=K(),di=st(),ah=(r,e)=>{r=new oh(r,e);let t=new Dr("0.0.0");if(r.test(t)||(t=new Dr("0.0.0-0"),r.test(t)))return t;t=null;for(let n=0;n<r.set.length;++n){let s=r.set[n],i=null;s.forEach(o=>{let a=new Dr(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!i||di(a,i))&&(i=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),i&&(!t||di(t,i))&&(t=i)}return t&&r.test(t)?t:null};pi.exports=ah});var yi=O((Wg,_i)=>{"use strict";var uh=K(),ch=(r,e)=>{try{return new uh(r,e).range||"*"}catch{return null}};_i.exports=ch});var Vt=O((Bg,bi)=>{"use strict";var fh=F(),Ei=it(),{ANY:lh}=Ei,hh=K(),dh=at(),gi=st(),vi=Ut(),ph=Bt(),mh=Wt(),_h=(r,e,t,n)=>{r=new fh(r,n),e=new hh(e,n);let s,i,o,a,c;switch(t){case">":s=gi,i=ph,o=vi,a=">",c=">=";break;case"<":s=vi,i=mh,o=gi,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(dh(r,e,n))return!1;for(let f=0;f<e.set.length;++f){let m=e.set[f],l=null,p=null;if(m.forEach(_=>{_.semver===lh&&(_=new Ei(">=0.0.0")),l=l||_,p=p||_,s(_.semver,l.semver,n)?l=_:o(_.semver,p.semver,n)&&(p=_)}),l.operator===a||l.operator===c||(!p.operator||p.operator===a)&&i(r,p.semver))return!1;if(p.operator===c&&o(r,p.semver))return!1}return!0};bi.exports=_h});var wi=O((Fg,Si)=>{"use strict";var yh=Vt(),gh=(r,e,t)=>yh(r,e,">",t);Si.exports=gh});var Oi=O((Gg,xi)=>{"use strict";var vh=Vt(),Eh=(r,e,t)=>vh(r,e,"<",t);xi.exports=Eh});var Ri=O((Vg,Ii)=>{"use strict";var Ti=K(),bh=(r,e,t)=>(r=new Ti(r,t),e=new Ti(e,t),r.intersects(e,t));Ii.exports=bh});var Ai=O((zg,Pi)=>{"use strict";var Sh=at(),wh=Z();Pi.exports=(r,e,t)=>{let n=[],s=null,i=null,o=r.sort((m,l)=>wh(m,l,t));for(let m of o)Sh(m,e,t)?(i=m,s||(s=m)):(i&&n.push([s,i]),i=null,s=null);s&&n.push([s,null]);let a=[];for(let[m,l]of n)m===l?a.push(m):!l&&m===o[0]?a.push("*"):l?m===o[0]?a.push(`<=${l}`):a.push(`${m} - ${l}`):a.push(`>=${m}`);let c=a.join(" || "),f=typeof e.raw=="string"?e.raw:String(e);return c.length<f.length?c:e}});var Ni=O((Xg,Ci)=>{"use strict";var Li=K(),Wr=it(),{ANY:Ur}=Wr,ut=at(),Br=Z(),xh=(r,e,t={})=>{if(r===e)return!0;r=new Li(r,t),e=new Li(e,t);let n=!1;e:for(let s of r.set){for(let i of e.set){let o=Th(s,i,t);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},Oh=[new Wr(">=0.0.0-0")],ki=[new Wr(">=0.0.0")],Th=(r,e,t)=>{if(r===e)return!0;if(r.length===1&&r[0].semver===Ur){if(e.length===1&&e[0].semver===Ur)return!0;t.includePrerelease?r=Oh:r=ki}if(e.length===1&&e[0].semver===Ur){if(t.includePrerelease)return!0;e=ki}let n=new Set,s,i;for(let _ of r)_.operator===">"||_.operator===">="?s=$i(s,_,t):_.operator==="<"||_.operator==="<="?i=qi(i,_,t):n.add(_.semver);if(n.size>1)return null;let o;if(s&&i){if(o=Br(s.semver,i.semver,t),o>0)return null;if(o===0&&(s.operator!==">="||i.operator!=="<="))return null}for(let _ of n){if(s&&!ut(_,String(s),t)||i&&!ut(_,String(i),t))return null;for(let v of e)if(!ut(_,String(v),t))return!1;return!0}let a,c,f,m,l=i&&!t.includePrerelease&&i.semver.prerelease.length?i.semver:!1,p=s&&!t.includePrerelease&&s.semver.prerelease.length?s.semver:!1;l&&l.prerelease.length===1&&i.operator==="<"&&l.prerelease[0]===0&&(l=!1);for(let _ of e){if(m=m||_.operator===">"||_.operator===">=",f=f||_.operator==="<"||_.operator==="<=",s){if(p&&_.semver.prerelease&&_.semver.prerelease.length&&_.semver.major===p.major&&_.semver.minor===p.minor&&_.semver.patch===p.patch&&(p=!1),_.operator===">"||_.operator===">="){if(a=$i(s,_,t),a===_&&a!==s)return!1}else if(s.operator===">="&&!ut(s.semver,String(_),t))return!1}if(i){if(l&&_.semver.prerelease&&_.semver.prerelease.length&&_.semver.major===l.major&&_.semver.minor===l.minor&&_.semver.patch===l.patch&&(l=!1),_.operator==="<"||_.operator==="<="){if(c=qi(i,_,t),c===_&&c!==i)return!1}else if(i.operator==="<="&&!ut(i.semver,String(_),t))return!1}if(!_.operator&&(i||s)&&o!==0)return!1}return!(s&&f&&!i&&o!==0||i&&m&&!s&&o!==0||p||l)},$i=(r,e,t)=>{if(!r)return e;let n=Br(r.semver,e.semver,t);return n>0?r:n<0||e.operator===">"&&r.operator===">="?e:r},qi=(r,e,t)=>{if(!r)return e;let n=Br(r.semver,e.semver,t);return n<0?r:n>0||e.operator==="<"&&r.operator==="<="?e:r};Ci.exports=xh});var ld=O((Hg,Di)=>{"use strict";var Fr=je(),Mi=rt(),Ih=F(),ji=Rr(),Rh=xe(),Ph=fs(),Ah=hs(),Lh=ms(),kh=gs(),$h=Es(),qh=Ss(),Ch=xs(),Nh=Ts(),Mh=Z(),jh=As(),Dh=ks(),Uh=Dt(),Wh=Ns(),Bh=js(),Fh=st(),Gh=Ut(),Vh=Ar(),zh=Lr(),Xh=Wt(),Hh=Bt(),Yh=kr(),Jh=Xs(),Zh=it(),Kh=K(),Qh=at(),ed=ui(),td=fi(),rd=hi(),nd=mi(),sd=yi(),id=Vt(),od=wi(),ad=Oi(),ud=Ri(),cd=Ai(),fd=Ni();Di.exports={parse:Rh,valid:Ph,clean:Ah,inc:Lh,diff:kh,major:$h,minor:qh,patch:Ch,prerelease:Nh,compare:Mh,rcompare:jh,compareLoose:Dh,compareBuild:Uh,sort:Wh,rsort:Bh,gt:Fh,lt:Gh,eq:Vh,neq:zh,gte:Xh,lte:Hh,cmp:Yh,coerce:Jh,Comparator:Zh,Range:Kh,satisfies:Qh,toComparators:ed,maxSatisfying:td,minSatisfying:rd,minVersion:nd,validRange:sd,outside:id,gtr:od,ltr:ad,intersects:ud,simplifyRange:cd,subset:fd,SemVer:Ih,re:Fr.re,src:Fr.src,tokens:Fr.t,SEMVER_SPEC_VERSION:Mi.SEMVER_SPEC_VERSION,RELEASE_TYPES:Mi.RELEASE_TYPES,compareIdentifiers:ji.compareIdentifiers,rcompareIdentifiers:ji.rcompareIdentifiers}});function hd(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global}function dd(){let r=hd();if(r.__xstate__)return r.__xstate__}var Ui,zt=tt(()=>{"use strict";Ui=r=>{if(typeof window>"u")return;let e=dd();e&&e.register(r)}});function yd(r,e){return{type:`xstate.after.${r}.${e}`}}function zr(r,e){return{type:`xstate.done.state.${r}`,output:e}}function gd(r,e){return{type:`xstate.done.actor.${r}`,output:e,actorId:r}}function Zr(r,e){return{type:`xstate.error.actor.${r}`,error:e,actorId:r}}function Kr(r){return{type:zi,input:r}}function ue(r){setTimeout(()=>{throw r})}function Yt(r,e){let t=Wi(r),n=Wi(e);return typeof n=="string"?typeof t=="string"?n===t:!1:typeof t=="string"?t in n:Object.keys(t).every(s=>s in n?Yt(t[s],n[s]):!1)}function Jt(r){if(Yi(r))return r;let e=[],t="";for(let n=0;n<r.length;n++){switch(r.charCodeAt(n)){case 92:t+=r[n+1],n++;continue;case 46:e.push(t),t="";continue}t+=r[n]}return e.push(t),e}function Wi(r){if(on(r))return r.value;if(typeof r!="string")return r;let e=Jt(r);return Qr(e)}function Qr(r){if(r.length===1)return r[0];let e={},t=e;for(let n=0;n<r.length-1;n++)if(n===r.length-2)t[r[n]]=r[n+1];else{let s=t;t={},s[r[n]]=t}return e}function en(r,e){let t={},n=Object.keys(r);for(let s=0;s<n.length;s++){let i=n[s];t[i]=e(r[i],i,r,s)}return t}function Hi(r){return Yi(r)?r:[r]}function oe(r){return r===void 0?[]:Hi(r)}function Xr(r,e,t,n){return typeof r=="function"?r({context:e,event:t,self:n}):r}function Yi(r){return Array.isArray(r)}function Ed(r){return r.type.startsWith("xstate.error.actor")}function Oe(r){return Hi(r).map(e=>typeof e>"u"||typeof e=="string"?{target:e}:e)}function Ji(r){if(!(r===void 0||r===pd))return oe(r)}function ct(r,e,t){let n=typeof r=="object",s=n?r:void 0;return{next:(n?r.next:r)?.bind(s),error:(n?r.error:e)?.bind(s),complete:(n?r.complete:t)?.bind(s)}}function tn(r,e){return`${e}.${r}`}function ht(r,e){let t=e.match(/^xstate\.invoke\.(\d+)\.(.*)/);if(!t)return r.implementations.actors[e];let[,n,s]=t,o=r.getStateNodeById(s).config.invoke;return(Array.isArray(o)?o[n]:o).src}function Zi(r){return[...new Set([...r._nodes.flatMap(e=>e.ownEvents)])]}function Bi(r,e){return`${r.sessionId}.${e}`}function Sd(r,e){let t=new Map,n=new Map,s=new WeakMap,i=new Set,o={},{clock:a,logger:c}=e,f={schedule:(p,_,v,w,L=Math.random().toString(36).slice(2))=>{let Y={source:p,target:_,event:v,delay:w,id:L,startedAt:Date.now()},X=Bi(p,L);l._snapshot._scheduledEvents[X]=Y;let Ce=a.setTimeout(()=>{delete o[X],delete l._snapshot._scheduledEvents[X],l._relay(p,_,v)},w);o[X]=Ce},cancel:(p,_)=>{let v=Bi(p,_),w=o[v];delete o[v],delete l._snapshot._scheduledEvents[v],w!==void 0&&a.clearTimeout(w)},cancelAll:p=>{for(let _ in l._snapshot._scheduledEvents){let v=l._snapshot._scheduledEvents[_];v.source===p&&f.cancel(p,v.id)}}},m=p=>{if(!i.size)return;let _={...p,rootId:r.sessionId};i.forEach(v=>v.next?.(_))},l={_snapshot:{_scheduledEvents:(e?.snapshot&&e.snapshot.scheduler)??{}},_bookId:()=>`x:${bd++}`,_register:(p,_)=>(t.set(p,_),p),_unregister:p=>{t.delete(p.sessionId);let _=s.get(p);_!==void 0&&(n.delete(_),s.delete(p))},get:p=>n.get(p),_set:(p,_)=>{let v=n.get(p);if(v&&v!==_)throw new Error(`Actor with system ID '${p}' already exists.`);n.set(p,_),s.set(_,p)},inspect:p=>{let _=ct(p);return i.add(_),{unsubscribe(){i.delete(_)}}},_sendInspectionEvent:m,_relay:(p,_,v)=>{l._sendInspectionEvent({type:"@xstate.event",sourceRef:p,actorRef:_,event:v}),_._send(v)},scheduler:f,getSnapshot:()=>({_scheduledEvents:{...l._snapshot._scheduledEvents}}),start:()=>{let p=l._snapshot._scheduledEvents;l._snapshot._scheduledEvents={};for(let _ in p){let{source:v,target:w,event:L,delay:Y,id:X}=p[_];f.schedule(v,w,L,Y,X)}},_clock:a,_logger:c};return l}function Q(r,...[e]){return new ft(r,e)}function xd(r,e,t,n,{sendId:s}){let i=typeof s=="function"?s(t,n):s;return[e,{sendId:i},void 0]}function Od(r,e){r.defer(()=>{r.system.scheduler.cancel(r.self,e.sendId)})}function dt(r){function e(t,n){}return e.type="xstate.cancel",e.sendId=r,e.resolve=xd,e.execute=Od,e}function Td(r,e,t,n,{id:s,systemId:i,src:o,input:a,syncSnapshot:c}){let f=typeof o=="string"?ht(e.machine,o):o,m=typeof s=="function"?s(t):s,l,p;return f&&(p=typeof a=="function"?a({context:e.context,event:t.event,self:r.self}):a,l=Q(f,{id:m,src:o,parent:r.self,syncSnapshot:c,systemId:i,input:p})),[ve(e,{children:{...e.children,[m]:l}}),{id:s,systemId:i,actorRef:l,src:o,input:p},void 0]}function Id(r,{actorRef:e}){e&&r.defer(()=>{e._processingStatus!==z.Stopped&&e.start()})}function pt(...[r,{id:e,systemId:t,input:n,syncSnapshot:s=!1}={}]){function i(o,a){}return i.type="xstate.spawnChild",i.id=e,i.systemId=t,i.src=r,i.input=n,i.syncSnapshot=s,i.resolve=Td,i.execute=Id,i}function Rd(r,e,t,n,{actorRef:s}){let i=typeof s=="function"?s(t,n):s,o=typeof i=="string"?e.children[i]:i,a=e.children;return o&&(a={...a},delete a[o.id]),[ve(e,{children:a}),o,void 0]}function Pd(r,e){if(e){if(r.system._unregister(e),e._processingStatus!==z.Running){r.stopChild(e);return}r.defer(()=>{r.stopChild(e)})}}function Re(r){function e(t,n){}return e.type="xstate.stopChild",e.actorRef=r,e.resolve=Rd,e.execute=Pd,e}function Ad(r,e,{stateValue:t}){if(typeof t=="string"&&Fe(t)){let n=r.machine.getStateNodeById(t);return r._nodes.some(s=>s===n)}return r.matches(t)}function eo(r){function e(){return!1}return e.check=Ad,e.stateValue=r,e}function Ld(r,{context:e,event:t},{guards:n}){return!ce(n[0],e,t,r)}function to(r){function e(t,n){return!1}return e.check=Ld,e.guards=[r],e}function kd(r,{context:e,event:t},{guards:n}){return n.every(s=>ce(s,e,t,r))}function ro(r){function e(t,n){return!1}return e.check=kd,e.guards=r,e}function $d(r,{context:e,event:t},{guards:n}){return n.some(s=>ce(s,e,t,r))}function no(r){function e(t,n){return!1}return e.check=$d,e.guards=r,e}function ce(r,e,t,n){let{machine:s}=n,i=typeof r=="function",o=i?r:s.implementations.guards[typeof r=="string"?r:r.type];if(!i&&!o)throw new Error(`Guard '${typeof r=="string"?r:r.type}' is not implemented.'.`);if(typeof o!="function")return ce(o,e,t,n);let a={context:e,event:t},c=i||typeof r=="string"?void 0:"params"in r?typeof r.params=="function"?r.params({context:e,event:t}):r.params:void 0;return"check"in o?o.check(n,a,o):o(a,c)}function We(r){return Object.values(r.states).filter(e=>e.type!=="history")}function mt(r,e){let t=[];if(e===r)return t;let n=r.parent;for(;n&&n!==e;)t.push(n),n=n.parent;return t}function _t(r){let e=new Set(r),t=io(e);for(let n of e)if(n.type==="compound"&&(!t.get(n)||!t.get(n).length))Fi(n).forEach(s=>e.add(s));else if(n.type==="parallel"){for(let s of We(n))if(s.type!=="history"&&!e.has(s)){let i=Fi(s);for(let o of i)e.add(o)}}for(let n of e){let s=n.parent;for(;s;)e.add(s),s=s.parent}return e}function so(r,e){let t=e.get(r);if(!t)return{};if(r.type==="compound"){let s=t[0];if(s){if(rn(s))return s.key}else return{}}let n={};for(let s of t)n[s.key]=so(s,e);return n}function io(r){let e=new Map;for(let t of r)e.has(t)||e.set(t,[]),t.parent&&(e.has(t.parent)||e.set(t.parent,[]),e.get(t.parent).push(t));return e}function oo(r,e){let t=_t(e);return so(r,io(t))}function Kt(r,e){return e.type==="compound"?We(e).some(t=>t.type==="final"&&r.has(t)):e.type==="parallel"?We(e).every(t=>Kt(r,t)):e.type==="final"}function ao(r,e){return r.transitions.get(e)||[...r.transitions.keys()].filter(n=>{if(n===_d)return!0;if(!n.endsWith(".*"))return!1;let s=n.split("."),i=e.split(".");for(let o=0;o<s.length;o++){let a=s[o],c=i[o];if(a==="*")return o===s.length-1;if(a!==c)return!1}return!0}).sort((n,s)=>s.length-n.length).flatMap(n=>r.transitions.get(n))}function uo(r){let e=r.config.after;if(!e)return[];let t=s=>{let i=yd(s,r.id),o=i.type;return r.entry.push(gt(i,{id:o,delay:s})),r.exit.push(dt(o)),o};return Object.keys(e).flatMap(s=>{let i=e[s],o=typeof i=="string"?{target:i}:i,a=Number.isNaN(+s)?s:+s,c=t(a);return oe(o).map(f=>({...f,event:c,delay:a}))}).map(s=>{let{delay:i}=s;return{..._e(r,s.event,s),delay:i}})}function _e(r,e,t){let n=Ji(t.target),s=t.reenter??!1,i=qd(r,n),o={...t,actions:oe(t.actions),guard:t.guard,target:i,source:r,reenter:s,eventType:e,toJSON:()=>({...o,source:`#${r.id}`,target:i?i.map(a=>`#${a.id}`):void 0})};return o}function co(r){let e=new Map;if(r.config.on)for(let t of Object.keys(r.config.on)){if(t===Jr)throw new Error('Null events ("") cannot be specified as a transition key. Use `always: { ... }` instead.');let n=r.config.on[t];e.set(t,Oe(n).map(s=>_e(r,t,s)))}if(r.config.onDone){let t=`xstate.done.state.${r.id}`;e.set(t,Oe(r.config.onDone).map(n=>_e(r,t,n)))}for(let t of r.invoke){if(t.onDone){let n=`xstate.done.actor.${t.id}`;e.set(n,Oe(t.onDone).map(s=>_e(r,n,s)))}if(t.onError){let n=`xstate.error.actor.${t.id}`;e.set(n,Oe(t.onError).map(s=>_e(r,n,s)))}if(t.onSnapshot){let n=`xstate.snapshot.${t.id}`;e.set(n,Oe(t.onSnapshot).map(s=>_e(r,n,s)))}}for(let t of r.after){let n=e.get(t.eventType);n||(n=[],e.set(t.eventType,n)),n.push(t)}return e}function fo(r,e){let t=typeof e=="string"?r.states[e]:e?r.states[e.target]:void 0;if(!t&&e)throw new Error(`Initial state node "${e}" not found on parent state node #${r.id}`);let n={source:r,actions:!e||typeof e=="string"?[]:oe(e.actions),eventType:null,reenter:!1,target:t?[t]:[],toJSON:()=>({...n,source:`#${r.id}`,target:t?[`#${t.id}`]:[]})};return n}function qd(r,e){if(e!==void 0)return e.map(t=>{if(typeof t!="string")return t;if(Fe(t))return r.machine.getStateNodeById(t);let n=t[0]===Yr;if(n&&!r.parent)return lt(r,t.slice(1));let s=n?r.key+t:t;if(r.parent)try{return lt(r.parent,s)}catch(i){throw new Error(`Invalid transition definition for state node '${r.id}':
|
|
3
|
+
${i.message}`)}else throw new Error(`Invalid target: "${t}" is not a valid target from the root node. Did you mean ".${t}"?`)})}function lo(r){let e=Ji(r.config.target);return e?{target:e.map(t=>typeof t=="string"?lt(r.parent,t):t)}:r.parent.initial}function Te(r){return r.type==="history"}function Fi(r){let e=nn(r);for(let t of e)for(let n of mt(t,r))e.add(n);return e}function nn(r){let e=new Set;function t(n){if(!e.has(n)){if(e.add(n),n.type==="compound")t(n.initial.target[0]);else if(n.type==="parallel")for(let s of We(n))t(s)}}return t(r),e}function Be(r,e){if(Fe(e))return r.machine.getStateNodeById(e);if(!r.states)throw new Error(`Unable to retrieve child state '${e}' from '${r.id}'; no child states exist.`);let t=r.states[e];if(!t)throw new Error(`Child state '${e}' does not exist on '${r.id}'`);return t}function lt(r,e){if(typeof e=="string"&&Fe(e))try{return r.machine.getStateNodeById(e)}catch{}let t=Jt(e).slice(),n=r;for(;t.length;){let s=t.shift();if(!s.length)break;n=Be(n,s)}return n}function Pe(r,e){if(typeof e=="string"){let s=r.states[e];if(!s)throw new Error(`State '${e}' does not exist on '${r.id}'`);return[r,s]}let t=Object.keys(e),n=t.map(s=>Be(r,s)).filter(Boolean);return[r.machine.root,r].concat(n,t.reduce((s,i)=>{let o=Be(r,i);if(!o)return s;let a=Pe(o,e[i]);return s.concat(a)},[]))}function Cd(r,e,t,n){let i=Be(r,e).next(t,n);return!i||!i.length?r.next(t,n):i}function Nd(r,e,t,n){let s=Object.keys(e),i=Be(r,s[0]),o=Qt(i,e[s[0]],t,n);return!o||!o.length?r.next(t,n):o}function Md(r,e,t,n){let s=[];for(let i of Object.keys(e)){let o=e[i];if(!o)continue;let a=Be(r,i),c=Qt(a,o,t,n);c&&s.push(...c)}return s.length?s:r.next(t,n)}function Qt(r,e,t,n){return typeof e=="string"?Cd(r,e,t,n):Object.keys(e).length===1?Nd(r,e,t,n):Md(r,e,t,n)}function jd(r){return Object.keys(r.states).map(e=>r.states[e]).filter(e=>e.type==="history")}function ge(r,e){let t=r;for(;t.parent&&t.parent!==e;)t=t.parent;return t.parent===e}function Dd(r,e){let t=new Set(r),n=new Set(e);for(let s of t)if(n.has(s))return!0;for(let s of n)if(t.has(s))return!0;return!1}function ho(r,e,t){let n=new Set;for(let s of r){let i=!1,o=new Set;for(let a of n)if(Dd(Hr([s],e,t),Hr([a],e,t)))if(ge(s.source,a.source))o.add(a);else{i=!0;break}if(!i){for(let a of o)n.delete(a);n.add(s)}}return Array.from(n)}function Ud(r){let[e,...t]=r;for(let n of mt(e,void 0))if(t.every(s=>ge(s,n)))return n}function sn(r,e){if(!r.target)return[];let t=new Set;for(let n of r.target)if(Te(n))if(e[n.id])for(let s of e[n.id])t.add(s);else for(let s of sn(lo(n),e))t.add(s);else t.add(n);return[...t]}function po(r,e){let t=sn(r,e);if(!t)return;if(!r.reenter&&t.every(s=>s===r.source||ge(s,r.source)))return r.source;let n=Ud(t.concat(r.source));if(n)return n;if(!r.reenter)return r.source.machine.root}function Hr(r,e,t){let n=new Set;for(let s of r)if(s.target?.length){let i=po(s,t);s.reenter&&s.source===i&&n.add(i);for(let o of e)ge(o,i)&&n.add(o)}return[...n]}function Wd(r,e){if(r.length!==e.size)return!1;for(let t of r)if(!e.has(t))return!1;return!0}function Ht(r,e,t,n,s,i){if(!r.length)return e;let o=new Set(e._nodes),a=e.historyValue,c=ho(r,o,a),f=e;s||([f,a]=Vd(f,n,t,c,o,a,i,t.actionExecutor)),f=Ie(f,n,t,c.flatMap(l=>l.actions),i,void 0),f=Fd(f,n,t,c,o,i,a,s);let m=[...o];f.status==="done"&&(f=Ie(f,n,t,m.sort((l,p)=>p.order-l.order).flatMap(l=>l.exit),i,void 0));try{return a===e.historyValue&&Wd(e._nodes,o)?f:ve(f,{_nodes:m,historyValue:a})}catch(l){throw l}}function Bd(r,e,t,n,s){if(n.output===void 0)return;let i=zr(s.id,s.output!==void 0&&s.parent?Xr(s.output,r.context,e,t.self):void 0);return Xr(n.output,r.context,i,t.self)}function Fd(r,e,t,n,s,i,o,a){let c=r,f=new Set,m=new Set;Gd(n,o,m,f),a&&m.add(r.machine.root);let l=new Set;for(let p of[...f].sort((_,v)=>_.order-v.order)){s.add(p);let _=[];_.push(...p.entry);for(let v of p.invoke)_.push(pt(v.src,{...v,syncSnapshot:!!v.onSnapshot}));if(m.has(p)){let v=p.initial.actions;_.push(...v)}if(c=Ie(c,e,t,_,i,p.invoke.map(v=>v.id)),p.type==="final"){let v=p.parent,w=v?.type==="parallel"?v:v?.parent,L=w||p;for(v?.type==="compound"&&i.push(zr(v.id,p.output!==void 0?Xr(p.output,c.context,e,t.self):void 0));w?.type==="parallel"&&!l.has(w)&&Kt(s,w);)l.add(w),i.push(zr(w.id)),L=w,w=w.parent;if(w)continue;c=ve(c,{status:"done",output:Bd(c,e,t,c.machine.root,L)})}}return c}function Gd(r,e,t,n){for(let s of r){let i=po(s,e);for(let a of s.target||[])!Te(a)&&(s.source!==a||s.source!==i||s.reenter)&&(n.add(a),t.add(a)),Ue(a,e,t,n);let o=sn(s,e);for(let a of o){let c=mt(a,i);i?.type==="parallel"&&c.push(i),mo(n,e,t,c,!s.source.parent&&s.reenter?void 0:i)}}}function Ue(r,e,t,n){if(Te(r))if(e[r.id]){let s=e[r.id];for(let i of s)n.add(i),Ue(i,e,t,n);for(let i of s)Vr(i,r.parent,n,e,t)}else{let s=lo(r);for(let i of s.target)n.add(i),s===r.parent?.initial&&t.add(r.parent),Ue(i,e,t,n);for(let i of s.target)Vr(i,r.parent,n,e,t)}else if(r.type==="compound"){let[s]=r.initial.target;Te(s)||(n.add(s),t.add(s)),Ue(s,e,t,n),Vr(s,r,n,e,t)}else if(r.type==="parallel")for(let s of We(r).filter(i=>!Te(i)))[...n].some(i=>ge(i,s))||(Te(s)||(n.add(s),t.add(s)),Ue(s,e,t,n))}function mo(r,e,t,n,s){for(let i of n)if((!s||ge(i,s))&&r.add(i),i.type==="parallel")for(let o of We(i).filter(a=>!Te(a)))[...r].some(a=>ge(a,o))||(r.add(o),Ue(o,e,t,r))}function Vr(r,e,t,n,s){mo(t,n,s,mt(r,e))}function Vd(r,e,t,n,s,i,o,a){let c=r,f=Hr(n,s,i);f.sort((l,p)=>p.order-l.order);let m;for(let l of f)for(let p of jd(l)){let _;p.history==="deep"?_=v=>rn(v)&&ge(v,l):_=v=>v.parent===l,m??={...i},m[p.id]=Array.from(s).filter(_)}for(let l of f)c=Ie(c,e,t,[...l.exit,...l.invoke.map(p=>Re(p.id))],o,void 0),s.delete(l);return[c,m||i]}function zd(r,e){return r.implementations.actions[e]}function _o(r,e,t,n,s,i){let{machine:o}=r,a=r;for(let c of n){let f=typeof c=="function",m=f?c:zd(o,typeof c=="string"?c:c.type),l={context:a.context,event:e,self:t.self,system:t.system},p=f||typeof c=="string"?void 0:"params"in c?typeof c.params=="function"?c.params({context:a.context,event:e}):c.params:void 0;if(!m||!("resolve"in m)){t.actionExecutor({type:typeof c=="string"?c:typeof c=="object"?c.type:c.name||"(anonymous)",info:l,params:p,exec:m});continue}let _=m,[v,w,L]=_.resolve(t,a,l,p,m,s);a=v,"retryResolve"in _&&i?.push([_,w]),"execute"in _&&t.actionExecutor({type:_.type,info:l,params:w,exec:_.execute.bind(null,t,w)}),L&&(a=_o(a,e,t,L,s,i))}return a}function Ie(r,e,t,n,s,i){let o=i?[]:void 0,a=_o(r,e,t,n,{internalQueue:s,deferredActorIds:i},o);return o?.forEach(([c,f])=>{c.retryResolve(t,a,f)}),a}function er(r,e,t,n){let s=r,i=[];function o(f,m,l){t.system._sendInspectionEvent({type:"@xstate.microstep",actorRef:t.self,event:m,snapshot:f,_transitions:l}),i.push(f)}if(e.type===ye)return s=ve(Gi(s,e,t),{status:"stopped"}),o(s,e,[]),{snapshot:s,microstates:i};let a=e;if(a.type!==zi){let f=a,m=Ed(f),l=Vi(f,s);if(m&&!l.length)return s=ve(r,{status:"error",error:f.error}),o(s,f,[]),{snapshot:s,microstates:i};s=Ht(l,r,t,a,!1,n),o(s,f,l)}let c=!0;for(;s.status==="active";){let f=c?Xd(s,a):[],m=f.length?s:void 0;if(!f.length){if(!n.length)break;a=n.shift(),f=Vi(a,s)}s=Ht(f,s,t,a,!1,n),c=s!==m,o(s,a,f)}return s.status!=="active"&&Gi(s,a,t),{snapshot:s,microstates:i}}function Gi(r,e,t){return Ie(r,e,t,Object.values(r.children).map(n=>Re(n)),[],void 0)}function Vi(r,e){return e.machine.getTransitionData(e,r)}function Xd(r,e){let t=new Set,n=r._nodes.filter(rn);for(let s of n)e:for(let i of[s].concat(mt(s,void 0)))if(i.always){for(let o of i.always)if(o.guard===void 0||ce(o.guard,r.context,e,r)){t.add(o);break e}}return ho(Array.from(t),new Set(r._nodes),r.historyValue)}function yo(r,e){let t=_t(Pe(r,e));return oo(r,[...t])}function on(r){return!!r&&typeof r=="object"&&"machine"in r&&"value"in r}function yt(r,e){return{status:r.status,output:r.output,error:r.error,machine:e,context:r.context,_nodes:r._nodes,value:oo(e.root,r._nodes),tags:new Set(r._nodes.flatMap(t=>t.tags)),children:r.children,historyValue:r.historyValue||{},matches:Hd,hasTag:Yd,can:Jd,getMeta:Kd,toJSON:Zd}}function ve(r,e={}){return yt({...r,...e},r.machine)}function go(r,e){let{_nodes:t,tags:n,machine:s,children:i,context:o,can:a,hasTag:c,matches:f,getMeta:m,toJSON:l,...p}=r,_={};for(let w in i){let L=i[w];_[w]={snapshot:L.getPersistedSnapshot(e),src:L.src,systemId:L._systemId,syncSnapshot:L._syncSnapshot}}return{...p,context:vo(o),children:_}}function vo(r){let e;for(let t in r){let n=r[t];if(n&&typeof n=="object")if("sessionId"in n&&"send"in n&&"ref"in n)e??=Array.isArray(r)?r.slice():{...r},e[t]={xstate$$type:Zt,id:n.id};else{let s=vo(n);s!==n&&(e??=Array.isArray(r)?r.slice():{...r},e[t]=s)}}return e??r}function Qd(r,e,t,n,{event:s,id:i,delay:o},{internalQueue:a}){let c=e.machine.implementations.delays;if(typeof s=="string")throw new Error(`Only event objects may be used with raise; use raise({ type: "${s}" }) instead`);let f=typeof s=="function"?s(t,n):s,m;if(typeof o=="string"){let l=c&&c[o];m=typeof l=="function"?l(t,n):l}else m=typeof o=="function"?o(t,n):o;return typeof m!="number"&&a.push(f),[e,{event:f,id:i,delay:m},void 0]}function ep(r,e){let{event:t,delay:n,id:s}=e;if(typeof n=="number"){r.defer(()=>{let i=r.self;r.system.scheduler.schedule(i,i,t,n,s)});return}}function gt(r,e){function t(n,s){}return t.type="xstate.raise",t.event=r,t.id=e?.id,t.delay=e?.delay,t.resolve=Qd,t.execute=ep,t}var Xt,Yr,pd,Jr,md,_d,zi,Xi,ye,vd,bd,Gr,Zt,z,wd,ft,Ki,Qi,rn,Fe,Hd,Yd,Jd,Zd,Kd,vt=tt(()=>{"use strict";zt();Xt=class{constructor(e){this._process=e,this._active=!1,this._current=null,this._last=null}start(){this._active=!0,this.flush()}clear(){this._current&&(this._current.next=null,this._last=this._current)}enqueue(e){let t={value:e,next:null};if(this._current){this._last.next=t,this._last=t;return}this._current=t,this._last=t,this._active&&this.flush()}flush(){for(;this._current;){let e=this._current;this._process(e.value),this._current=e.next}this._last=null}},Yr=".",pd="",Jr="",md="#",_d="*",zi="xstate.init",Xi="xstate.error",ye="xstate.stop";vd=typeof Symbol=="function"&&Symbol.observable||"@@observable";bd=0;Gr=!1,Zt=1,z=(function(r){return r[r.NotStarted=0]="NotStarted",r[r.Running=1]="Running",r[r.Stopped=2]="Stopped",r})({}),wd={clock:{setTimeout:(r,e)=>setTimeout(r,e),clearTimeout:r=>clearTimeout(r)},logger:console.log.bind(console),devTools:!1},ft=class{constructor(e,t){this.logic=e,this._snapshot=void 0,this.clock=void 0,this.options=void 0,this.id=void 0,this.mailbox=new Xt(this._process.bind(this)),this.observers=new Set,this.eventListeners=new Map,this.logger=void 0,this._processingStatus=z.NotStarted,this._parent=void 0,this._syncSnapshot=void 0,this.ref=void 0,this._actorScope=void 0,this._systemId=void 0,this.sessionId=void 0,this.system=void 0,this._doneEvent=void 0,this.src=void 0,this._deferred=[];let n={...wd,...t},{clock:s,logger:i,parent:o,syncSnapshot:a,id:c,systemId:f,inspect:m}=n;this.system=o?o.system:Sd(this,{clock:s,logger:i}),m&&!o&&this.system.inspect(ct(m)),this.sessionId=this.system._bookId(),this.id=c??this.sessionId,this.logger=t?.logger??this.system._logger,this.clock=t?.clock??this.system._clock,this._parent=o,this._syncSnapshot=a,this.options=n,this.src=n.src??e,this.ref=this,this._actorScope={self:this,id:this.id,sessionId:this.sessionId,logger:this.logger,defer:l=>{this._deferred.push(l)},system:this.system,stopChild:l=>{if(l._parent!==this)throw new Error(`Cannot stop child actor ${l.id} of ${this.id} because it is not a child`);l._stop()},emit:l=>{let p=this.eventListeners.get(l.type),_=this.eventListeners.get("*");if(!p&&!_)return;let v=[...p?p.values():[],..._?_.values():[]];for(let w of v)w(l)},actionExecutor:l=>{let p=()=>{if(this._actorScope.system._sendInspectionEvent({type:"@xstate.action",actorRef:this,action:{type:l.type,params:l.params}}),!l.exec)return;let _=Gr;try{Gr=!0,l.exec(l.info,l.params)}finally{Gr=_}};this._processingStatus===z.Running?p():this._deferred.push(p)}},this.send=this.send.bind(this),this.system._sendInspectionEvent({type:"@xstate.actor",actorRef:this}),f&&(this._systemId=f,this.system._set(f,this)),this._initState(t?.snapshot??t?.state),f&&this._snapshot.status!=="active"&&this.system._unregister(this)}_initState(e){try{this._snapshot=e?this.logic.restoreSnapshot?this.logic.restoreSnapshot(e,this._actorScope):e:this.logic.getInitialSnapshot(this._actorScope,this.options?.input)}catch(t){this._snapshot={status:"error",output:void 0,error:t}}}update(e,t){this._snapshot=e;let n;for(;n=this._deferred.shift();)try{n()}catch(s){this._deferred.length=0,this._snapshot={...e,status:"error",error:s}}switch(this._snapshot.status){case"active":for(let s of this.observers)try{s.next?.(e)}catch(i){ue(i)}break;case"done":for(let s of this.observers)try{s.next?.(e)}catch(i){ue(i)}this._stopProcedure(),this._complete(),this._doneEvent=gd(this.id,this._snapshot.output),this._parent&&this.system._relay(this,this._parent,this._doneEvent);break;case"error":this._error(this._snapshot.error);break}this.system._sendInspectionEvent({type:"@xstate.snapshot",actorRef:this,event:t,snapshot:e})}subscribe(e,t,n){let s=ct(e,t,n);if(this._processingStatus!==z.Stopped)this.observers.add(s);else switch(this._snapshot.status){case"done":try{s.complete?.()}catch(i){ue(i)}break;case"error":{let i=this._snapshot.error;if(!s.error)ue(i);else try{s.error(i)}catch(o){ue(o)}break}}return{unsubscribe:()=>{this.observers.delete(s)}}}on(e,t){let n=this.eventListeners.get(e);n||(n=new Set,this.eventListeners.set(e,n));let s=t.bind(void 0);return n.add(s),{unsubscribe:()=>{n.delete(s)}}}start(){if(this._processingStatus===z.Running)return this;this._syncSnapshot&&this.subscribe({next:n=>{n.status==="active"&&this.system._relay(this,this._parent,{type:`xstate.snapshot.${this.id}`,snapshot:n})},error:()=>{}}),this.system._register(this.sessionId,this),this._systemId&&this.system._set(this._systemId,this),this._processingStatus=z.Running;let e=Kr(this.options.input);switch(this.system._sendInspectionEvent({type:"@xstate.event",sourceRef:this._parent,actorRef:this,event:e}),this._snapshot.status){case"done":return this.update(this._snapshot,e),this;case"error":return this._error(this._snapshot.error),this}if(this._parent||this.system.start(),this.logic.start)try{this.logic.start(this._snapshot,this._actorScope)}catch(n){return this._snapshot={...this._snapshot,status:"error",error:n},this._error(n),this}return this.update(this._snapshot,e),this.options.devTools&&this.attachDevTools(),this.mailbox.start(),this}_process(e){let t,n;try{t=this.logic.transition(this._snapshot,e,this._actorScope)}catch(s){n={err:s}}if(n){let{err:s}=n;this._snapshot={...this._snapshot,status:"error",error:s},this._error(s);return}this.update(t,e),e.type===ye&&(this._stopProcedure(),this._complete())}_stop(){return this._processingStatus===z.Stopped?this:(this.mailbox.clear(),this._processingStatus===z.NotStarted?(this._processingStatus=z.Stopped,this):(this.mailbox.enqueue({type:ye}),this))}stop(){if(this._parent)throw new Error("A non-root actor cannot be stopped directly.");return this._stop()}_complete(){for(let e of this.observers)try{e.complete?.()}catch(t){ue(t)}this.observers.clear()}_reportError(e){if(!this.observers.size){this._parent||ue(e);return}let t=!1;for(let n of this.observers){let s=n.error;t||=!s;try{s?.(e)}catch(i){ue(i)}}this.observers.clear(),t&&ue(e)}_error(e){this._stopProcedure(),this._reportError(e),this._parent&&this.system._relay(this,this._parent,Zr(this.id,e))}_stopProcedure(){return this._processingStatus!==z.Running?this:(this.system.scheduler.cancelAll(this),this.mailbox.clear(),this.mailbox=new Xt(this._process.bind(this)),this._processingStatus=z.Stopped,this.system._unregister(this),this)}_send(e){this._processingStatus!==z.Stopped&&this.mailbox.enqueue(e)}send(e){this.system._relay(void 0,this,e)}attachDevTools(){let{devTools:e}=this.options;e&&(typeof e=="function"?e:Ui)(this)}toJSON(){return{xstate$$type:Zt,id:this.id}}getPersistedSnapshot(e){return this.logic.getPersistedSnapshot(this._snapshot,e)}[vd](){return this}getSnapshot(){return this._snapshot}};Ki=Q;Qi=Re;rn=r=>r.type==="atomic"||r.type==="final";Fe=r=>r[0]===md;Hd=function(e){return Yt(e,this.value)},Yd=function(e){return this.tags.has(e)},Jd=function(e){let t=this.machine.getTransitionData(this,e);return!!t?.length&&t.some(n=>n.target!==void 0||n.actions.length)},Zd=function(){let{_nodes:e,tags:t,machine:n,getMeta:s,toJSON:i,can:o,hasTag:a,matches:c,...f}=this;return{...f,tags:Array.from(t)}},Kd=function(){return this._nodes.reduce((e,t)=>(t.meta!==void 0&&(e[t.id]=t.meta),e),{})}});function an(r,e){return{config:r,transition:(t,n,s)=>({...t,context:r(t.context,n,s)}),getInitialSnapshot:(t,n)=>({status:"active",output:void 0,error:void 0,context:typeof e=="function"?e({input:n}):e}),getPersistedSnapshot:t=>t,restoreSnapshot:t=>t}}function xo(r){return{config:r,start:(t,n)=>{let{self:s,system:i,emit:o}=n,a={receivers:void 0,dispose:void 0};Eo.set(s,a),a.dispose=r({input:t.input,system:i,self:s,sendBack:c=>{s.getSnapshot().status!=="stopped"&&s._parent&&i._relay(s,s._parent,c)},receive:c=>{a.receivers??=new Set,a.receivers.add(c)},emit:o})},transition:(t,n,s)=>{let i=Eo.get(s.self);return n.type===ye?(t={...t,status:"stopped",error:void 0},i.dispose?.(),t):(i.receivers?.forEach(o=>o(n)),t)},getInitialSnapshot:(t,n)=>({status:"active",output:void 0,error:void 0,input:n}),getPersistedSnapshot:t=>t,restoreSnapshot:t=>t}}function Oo(r){return{config:r,transition:(t,n)=>{if(t.status!=="active")return t;switch(n.type){case bo:return{...t,context:n.data};case rr:return{...t,status:"error",error:n.data,input:void 0,_subscription:void 0};case nr:return{...t,status:"done",input:void 0,_subscription:void 0};case ye:return t._subscription.unsubscribe(),{...t,status:"stopped",input:void 0,_subscription:void 0};default:return t}},getInitialSnapshot:(t,n)=>({status:"active",output:void 0,error:void 0,context:void 0,input:n,_subscription:void 0}),start:(t,{self:n,system:s,emit:i})=>{t.status!=="done"&&(t._subscription=r({input:t.input,system:s,self:n,emit:i}).subscribe({next:o=>{s._relay(n,n,{type:bo,data:o})},error:o=>{s._relay(n,n,{type:rr,data:o})},complete:()=>{s._relay(n,n,{type:nr})}}))},getPersistedSnapshot:({_subscription:t,...n})=>n,restoreSnapshot:t=>({...t,_subscription:void 0})}}function To(r){return{config:r,transition:(t,n)=>{if(t.status!=="active")return t;switch(n.type){case rr:return{...t,status:"error",error:n.data,input:void 0,_subscription:void 0};case nr:return{...t,status:"done",input:void 0,_subscription:void 0};case ye:return t._subscription.unsubscribe(),{...t,status:"stopped",input:void 0,_subscription:void 0};default:return t}},getInitialSnapshot:(t,n)=>({status:"active",output:void 0,error:void 0,context:void 0,input:n,_subscription:void 0}),start:(t,{self:n,system:s,emit:i})=>{t.status!=="done"&&(t._subscription=r({input:t.input,system:s,self:n,emit:i}).subscribe({next:o=>{n._parent&&s._relay(n,n._parent,o)},error:o=>{s._relay(n,n,{type:rr,data:o})},complete:()=>{s._relay(n,n,{type:nr})}}))},getPersistedSnapshot:({_subscription:t,...n})=>n,restoreSnapshot:t=>({...t,_subscription:void 0})}}function Io(r){return{config:r,transition:(t,n,s)=>{if(t.status!=="active")return t;switch(n.type){case So:{let i=n.data;return{...t,status:"done",output:i,input:void 0}}case wo:return{...t,status:"error",error:n.data,input:void 0};case ye:return tr.get(s.self)?.abort(),{...t,status:"stopped",input:void 0};default:return t}},start:(t,{self:n,system:s,emit:i})=>{if(t.status!=="active")return;let o=new AbortController;tr.set(n,o),Promise.resolve(r({input:t.input,system:s,self:n,signal:o.signal,emit:i})).then(c=>{n.getSnapshot().status==="active"&&(tr.delete(n),s._relay(n,n,{type:So,data:c}))},c=>{n.getSnapshot().status==="active"&&(tr.delete(n),s._relay(n,n,{type:wo,data:c}))})},getInitialSnapshot:(t,n)=>({status:"active",output:void 0,error:void 0,input:n}),getPersistedSnapshot:t=>t,restoreSnapshot:t=>t}}function Ro(){return Q(tp)}var Eo,bo,rr,nr,So,wo,tr,tp,Po=tt(()=>{"use strict";vt();zt();Eo=new WeakMap;bo="xstate.observable.next",rr="xstate.observable.error",nr="xstate.observable.complete";So="xstate.promise.resolve",wo="xstate.promise.reject",tr=new WeakMap;tp=an(r=>{},void 0)});function rp(r,{machine:e,context:t},n,s){let i=(o,a)=>{if(typeof o=="string"){let c=ht(e,o);if(!c)throw new Error(`Actor logic '${o}' not implemented in machine '${e.id}'`);let f=Q(c,{id:a?.id,parent:r.self,syncSnapshot:a?.syncSnapshot,input:typeof a?.input=="function"?a.input({context:t,event:n,self:r.self}):a?.input,src:o,systemId:a?.systemId});return s[f.id]=f,f}else return Q(o,{id:a?.id,parent:r.self,syncSnapshot:a?.syncSnapshot,input:a?.input,src:o,systemId:a?.systemId})};return(o,a)=>{let c=i(o,a);return s[c.id]=c,r.defer(()=>{c._processingStatus!==z.Stopped&&c.start()}),c}}function np(r,e,t,n,{assignment:s}){if(!e.context)throw new Error("Cannot assign to undefined `context`. Ensure that `context` is defined in the machine config.");let i={},o={context:e.context,event:t.event,spawn:rp(r,e,t.event,i),self:r.self,system:r.system},a={};if(typeof s=="function")a=s(o,n);else for(let f of Object.keys(s)){let m=s[f];a[f]=typeof m=="function"?m(o,n):m}let c=Object.assign({},e.context,a);return[ve(e,{context:c,children:Object.keys(i).length?{...e.children,...i}:e.children}),void 0,void 0]}function bt(r){function e(t,n){}return e.type="xstate.assign",e.assignment=r,e.resolve=np,e}function sp(r,e,t,n,{event:s}){let i=typeof s=="function"?s(t,n):s;return[e,{event:i},void 0]}function ip(r,{event:e}){r.defer(()=>r.emit(e))}function un(r){function e(t,n){}return e.type="xstate.emit",e.event=r,e.resolve=sp,e.execute=ip,e}function op(r,e,t,n,{to:s,event:i,id:o,delay:a},c){let f=e.machine.implementations.delays;if(typeof i=="string")throw new Error(`Only event objects may be used with sendTo; use sendTo({ type: "${i}" }) instead`);let m=typeof i=="function"?i(t,n):i,l;if(typeof a=="string"){let v=f&&f[a];l=typeof v=="function"?v(t,n):v}else l=typeof a=="function"?a(t,n):a;let p=typeof s=="function"?s(t,n):s,_;if(typeof p=="string"){if(p===Et.Parent?_=r.self._parent:p===Et.Internal?_=r.self:p.startsWith("#_")?_=e.children[p.slice(2)]:_=c.deferredActorIds?.includes(p)?p:e.children[p],!_)throw new Error(`Unable to send event to actor '${p}' from machine '${e.machine.id}'.`)}else _=p||r.self;return[e,{to:_,targetId:typeof p=="string"?p:void 0,event:m,id:o,delay:l},void 0]}function ap(r,e,t){typeof t.to=="string"&&(t.to=e.children[t.to])}function up(r,e){r.defer(()=>{let{to:t,event:n,delay:s,id:i}=e;if(typeof s=="number"){r.system.scheduler.schedule(r.self,t,n,s,i);return}r.system._relay(r.self,t,n.type===Xi?Zr(r.self.id,n.data):n)})}function St(r,e,t){function n(s,i){}return n.type="xstate.sendTo",n.to=r,n.event=e,n.id=t?.id,n.delay=t?.delay,n.resolve=op,n.retryResolve=ap,n.execute=up,n}function cn(r,e){return St(Et.Parent,r,e)}function Ao(r,e){return St(r,({event:t})=>t,e)}function cp(r,e,t,n,{collect:s}){let i=[],o=function(c){i.push(c)};return o.assign=(...a)=>{i.push(bt(...a))},o.cancel=(...a)=>{i.push(dt(...a))},o.raise=(...a)=>{i.push(gt(...a))},o.sendTo=(...a)=>{i.push(St(...a))},o.sendParent=(...a)=>{i.push(cn(...a))},o.spawnChild=(...a)=>{i.push(pt(...a))},o.stopChild=(...a)=>{i.push(Re(...a))},o.emit=(...a)=>{i.push(un(...a))},s({context:t.context,event:t.event,enqueue:o,check:a=>ce(a,e.context,t.event,e),self:r.self,system:r.system},n),[e,void 0,i]}function Lo(r){function e(t,n){}return e.type="xstate.enqueueActions",e.collect=r,e.resolve=cp,e}function fp(r,e,t,n,{value:s,label:i}){return[e,{value:typeof s=="function"?s(t,n):s,label:i},void 0]}function lp({logger:r},{value:e,label:t}){t?r(t,e):r(e)}function ko(r=({context:t,event:n})=>({context:t,event:n}),e){function t(n,s){}return t.type="xstate.log",t.value=r,t.label=e,t.resolve=fp,t.execute=lp,t}var Et,fn=tt(()=>{"use strict";vt();Et=(function(r){return r.Parent="#_parent",r.Internal="#_internal",r})({})});var wp={};uu(wp,{Actor:()=>ft,SimulatedClock:()=>ln,SpecialTargets:()=>Et,StateMachine:()=>ir,StateNode:()=>sr,__unsafe_getAllOwnEventDescriptors:()=>Zi,and:()=>ro,assertEvent:()=>hp,assign:()=>bt,cancel:()=>dt,createActor:()=>Q,createEmptyActor:()=>Ro,createMachine:()=>qo,emit:()=>un,enqueueActions:()=>Lo,forwardTo:()=>Ao,fromCallback:()=>xo,fromEventObservable:()=>To,fromObservable:()=>Oo,fromPromise:()=>Io,fromTransition:()=>an,getInitialSnapshot:()=>mp,getNextSnapshot:()=>_p,getStateNodes:()=>Pe,initialTransition:()=>Ep,interpret:()=>Ki,isMachineSnapshot:()=>on,log:()=>ko,matchesState:()=>Yt,not:()=>to,or:()=>no,pathToStateValue:()=>Qr,raise:()=>gt,sendParent:()=>cn,sendTo:()=>St,setup:()=>yp,spawnChild:()=>pt,stateIn:()=>eo,stop:()=>Qi,stopChild:()=>Re,toObserver:()=>ct,toPromise:()=>gp,transition:()=>vp,waitFor:()=>Sp});function hp(r,e){let t=oe(e);if(!t.includes(r.type)){let n=t.length===1?`type "${t[0]}"`:`one of types "${t.join('", "')}"`;throw new Error(`Expected event ${JSON.stringify(r)} to have ${n}`)}}function Ge(r,e,t){let n=$o.get(r);return n?e in n||(n[e]=t()):(n={[e]:t()},$o.set(r,n)),n[e]}function qo(r,e){return new ir(r,e)}function or(r){let e=Q(r);return{self:e,defer:()=>{},id:"",logger:()=>{},sessionId:"",stopChild:()=>{},system:e.system,emit:()=>{},actionExecutor:()=>{}}}function mp(r,...[e]){let t=or(r);return r.getInitialSnapshot(t,e)}function _p(r,e,t){let n=or(r);return n.self._snapshot=e,r.transition(e,t,n)}function yp({schemas:r,actors:e,actions:t,guards:n,delays:s}){return{createMachine:i=>qo({...i,schemas:r},{actors:e,actions:t,guards:n,delays:s})}}function gp(r){return new Promise((e,t)=>{r.subscribe({complete:()=>{e(r.getSnapshot().output)},error:t})})}function vp(r,e,t){let n=[],s=or(r);return s.actionExecutor=o=>{n.push(o)},[r.transition(e,t,s),n]}function Ep(r,...[e]){let t=[],n=or(r);return n.actionExecutor=i=>{t.push(i)},[r.getInitialSnapshot(n,e),t]}function Sp(r,e,t){let n={...bp,...t};return new Promise((s,i)=>{let{signal:o}=n;if(o?.aborted){i(o.reason);return}let a=!1,c=n.timeout===1/0?void 0:setTimeout(()=>{f(),i(new Error(`Timeout of ${n.timeout} ms exceeded`))},n.timeout),f=()=>{clearTimeout(c),a=!0,p?.unsubscribe(),l&&o.removeEventListener("abort",l)};function m(_){e(_)&&(f(),s(_))}let l,p;m(r.getSnapshot()),!a&&(o&&(l=()=>{f(),i(o.reason)},o.addEventListener("abort",l)),p=r.subscribe({next:m,error:_=>{f(),i(_)},complete:()=>{f(),i(new Error("Actor terminated without satisfying predicate"))}}),a&&p.unsubscribe())})}var $o,dp,wt,sr,pp,ir,ln,bp,xp=tt(()=>{"use strict";Po();vt();vt();fn();fn();zt();$o=new WeakMap;dp={},wt=r=>typeof r=="string"?{type:r}:typeof r=="function"?"resolve"in r?{type:r.type}:{type:r.name}:r,sr=class r{constructor(e,t){if(this.config=e,this.key=void 0,this.id=void 0,this.type=void 0,this.path=void 0,this.states=void 0,this.history=void 0,this.entry=void 0,this.exit=void 0,this.parent=void 0,this.machine=void 0,this.meta=void 0,this.output=void 0,this.order=-1,this.description=void 0,this.tags=[],this.transitions=void 0,this.always=void 0,this.parent=t._parent,this.key=t._key,this.machine=t._machine,this.path=this.parent?this.parent.path.concat(this.key):[],this.id=this.config.id||[this.machine.id,...this.path].join(Yr),this.type=this.config.type||(this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.description=this.config.description,this.order=this.machine.idMap.size,this.machine.idMap.set(this.id,this),this.states=this.config.states?en(this.config.states,(n,s)=>new r(n,{_parent:this,_key:s,_machine:this.machine})):dp,this.type==="compound"&&!this.config.initial)throw new Error(`No initial state specified for compound state node "#${this.id}". Try adding { initial: "${Object.keys(this.states)[0]}" } to the state config.`);this.history=this.config.history===!0?"shallow":this.config.history||!1,this.entry=oe(this.config.entry).slice(),this.exit=oe(this.config.exit).slice(),this.meta=this.config.meta,this.output=this.type==="final"||!this.parent?this.config.output:void 0,this.tags=oe(e.tags).slice()}_initialize(){this.transitions=co(this),this.config.always&&(this.always=Oe(this.config.always).map(e=>_e(this,Jr,e))),Object.keys(this.states).forEach(e=>{this.states[e]._initialize()})}get definition(){return{id:this.id,key:this.key,version:this.machine.version,type:this.type,initial:this.initial?{target:this.initial.target,source:this,actions:this.initial.actions.map(wt),eventType:null,reenter:!1,toJSON:()=>({target:this.initial.target.map(e=>`#${e.id}`),source:`#${this.id}`,actions:this.initial.actions.map(wt),eventType:null})}:void 0,history:this.history,states:en(this.states,e=>e.definition),on:this.on,transitions:[...this.transitions.values()].flat().map(e=>({...e,actions:e.actions.map(wt)})),entry:this.entry.map(wt),exit:this.exit.map(wt),meta:this.meta,order:this.order||-1,output:this.output,invoke:this.invoke,description:this.description,tags:this.tags}}toJSON(){return this.definition}get invoke(){return Ge(this,"invoke",()=>oe(this.config.invoke).map((e,t)=>{let{src:n,systemId:s}=e,i=e.id??tn(this.id,t),o=typeof n=="string"?n:`xstate.invoke.${tn(this.id,t)}`;return{...e,src:o,id:i,systemId:s,toJSON(){let{onDone:a,onError:c,...f}=e;return{...f,type:"xstate.invoke",src:o,id:i}}}}))}get on(){return Ge(this,"on",()=>[...this.transitions].flatMap(([t,n])=>n.map(s=>[t,s])).reduce((t,[n,s])=>(t[n]=t[n]||[],t[n].push(s),t),{}))}get after(){return Ge(this,"delayedTransitions",()=>uo(this))}get initial(){return Ge(this,"initial",()=>fo(this,this.config.initial))}next(e,t){let n=t.type,s=[],i,o=Ge(this,`candidates-${n}`,()=>ao(this,n));for(let a of o){let{guard:c}=a,f=e.context,m=!1;try{m=!c||ce(c,f,t,e)}catch(l){let p=typeof c=="string"?c:typeof c=="object"?c.type:void 0;throw new Error(`Unable to evaluate guard ${p?`'${p}' `:""}in transition for event '${n}' in state node '${this.id}':
|
|
4
|
+
${l.message}`)}if(m){s.push(...a.actions),i=a;break}}return i?[i]:void 0}get events(){return Ge(this,"events",()=>{let{states:e}=this,t=new Set(this.ownEvents);if(e)for(let n of Object.keys(e)){let s=e[n];if(s.states)for(let i of s.events)t.add(`${i}`)}return Array.from(t)})}get ownEvents(){let e=new Set([...this.transitions.keys()].filter(t=>this.transitions.get(t).some(n=>!(!n.target&&!n.actions.length&&!n.reenter))));return Array.from(e)}},pp="#",ir=class r{constructor(e,t){this.config=e,this.version=void 0,this.schemas=void 0,this.implementations=void 0,this.__xstatenode=!0,this.idMap=new Map,this.root=void 0,this.id=void 0,this.states=void 0,this.events=void 0,this.id=e.id||"(machine)",this.implementations={actors:t?.actors??{},actions:t?.actions??{},delays:t?.delays??{},guards:t?.guards??{}},this.version=this.config.version,this.schemas=this.config.schemas,this.transition=this.transition.bind(this),this.getInitialSnapshot=this.getInitialSnapshot.bind(this),this.getPersistedSnapshot=this.getPersistedSnapshot.bind(this),this.restoreSnapshot=this.restoreSnapshot.bind(this),this.start=this.start.bind(this),this.root=new sr(e,{_key:this.id,_machine:this}),this.root._initialize(),this.states=this.root.states,this.events=this.root.events}provide(e){let{actions:t,guards:n,actors:s,delays:i}=this.implementations;return new r(this.config,{actions:{...t,...e.actions},guards:{...n,...e.guards},actors:{...s,...e.actors},delays:{...i,...e.delays}})}resolveState(e){let t=yo(this.root,e.value),n=_t(Pe(this.root,t));return yt({_nodes:[...n],context:e.context||{},children:{},status:Kt(n,this.root)?"done":e.status||"active",output:e.output,error:e.error,historyValue:e.historyValue},this)}transition(e,t,n){return er(e,t,n,[]).snapshot}microstep(e,t,n){return er(e,t,n,[]).microstates}getTransitionData(e,t){return Qt(this.root,e.value,e,t)||[]}getPreInitialState(e,t,n){let{context:s}=this.config,i=yt({context:typeof s!="function"&&s?s:{},_nodes:[this.root],children:{},status:"active"},this);return typeof s=="function"?Ie(i,t,e,[bt(({spawn:a,event:c,self:f})=>s({spawn:a,input:c.input,self:f}))],n,void 0):i}getInitialSnapshot(e,t){let n=Kr(t),s=[],i=this.getPreInitialState(e,n,s),o=Ht([{target:[...nn(this.root)],source:this.root,reenter:!0,actions:[],eventType:null,toJSON:null}],i,e,n,!0,s),{snapshot:a}=er(o,n,e,s);return a}start(e){Object.values(e.children).forEach(t=>{t.getSnapshot().status==="active"&&t.start()})}getStateNodeById(e){let t=Jt(e),n=t.slice(1),s=Fe(t[0])?t[0].slice(pp.length):t[0],i=this.idMap.get(s);if(!i)throw new Error(`Child state node '#${s}' does not exist on machine '${this.id}'`);return lt(i,n)}get definition(){return this.root.definition}toJSON(){return this.definition}getPersistedSnapshot(e,t){return go(e,t)}restoreSnapshot(e,t){let n={},s=e.children;Object.keys(s).forEach(c=>{let f=s[c],m=f.snapshot,l=f.src,p=typeof l=="string"?ht(this,l):l;if(!p)return;let _=Q(p,{id:c,parent:t.self,syncSnapshot:f.syncSnapshot,snapshot:m,src:l,systemId:f.systemId});n[c]=_});let i=yt({...e,children:n,_nodes:Array.from(_t(Pe(this.root,e.value)))},this),o=new Set;function a(c,f){if(!o.has(c)){o.add(c);for(let m in c){let l=c[m];if(l&&typeof l=="object"){if("xstate$$type"in l&&l.xstate$$type===Zt){c[m]=f[l.id];continue}a(l,f)}}}}return a(i.context,n),i}};ln=class{constructor(){this.timeouts=new Map,this._now=0,this._id=0,this._flushing=!1,this._flushingInvalidated=!1}now(){return this._now}getId(){return this._id++}setTimeout(e,t){this._flushingInvalidated=this._flushing;let n=this.getId();return this.timeouts.set(n,{start:this.now(),timeout:t,fn:e}),n}clearTimeout(e){this._flushingInvalidated=this._flushing,this.timeouts.delete(e)}set(e){if(this._now>e)throw new Error("Unable to travel back in time");this._now=e,this.flushTimeouts()}flushTimeouts(){if(this._flushing){this._flushingInvalidated=!0;return}this._flushing=!0;let e=[...this.timeouts].sort(([t,n],[s,i])=>{let o=n.start+n.timeout;return i.start+i.timeout>o?-1:1});for(let[t,n]of e){if(this._flushingInvalidated){this._flushingInvalidated=!1,this._flushing=!1,this.flushTimeouts();return}this.now()-n.start>=n.timeout&&(this.timeouts.delete(t),n.fn.call(null))}this._flushing=!1}increment(e){this._now+=e,this.flushTimeouts()}};bp={timeout:1/0}});var No=O(ar=>{"use strict";Object.defineProperty(ar,"__esModule",{value:!0});ar.partition=void 0;var Op=gu(),Co=Yn();function Tp(r,e){return function(t){return[Co.filter(r,e)(t),Co.filter(Op.not(r,e))(t)]}}ar.partition=Tp});var Mo=O(Ee=>{"use strict";var Ip=Ee&&Ee.__read||function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),s,i=[],o;try{for(;(e===void 0||e-- >0)&&!(s=n.next()).done;)i.push(s.value)}catch(a){o={error:a}}finally{try{s&&!s.done&&(t=n.return)&&t.call(n)}finally{if(o)throw o.error}}return i},Rp=Ee&&Ee.__spreadArray||function(r,e){for(var t=0,n=e.length,s=r.length;t<n;t++,s++)r[s]=e[t];return r};Object.defineProperty(Ee,"__esModule",{value:!0});Ee.race=void 0;var Pp=yu(),Ap=Jn();function Lp(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return Ap.raceWith.apply(void 0,Rp([],Ip(Pp.argsOrArgArray(r))))}Ee.race=Lp});var M_=O(u=>{"use strict";Object.defineProperty(u,"__esModule",{value:!0});u.mergeAll=u.merge=u.max=u.materialize=u.mapTo=u.map=u.last=u.isEmpty=u.ignoreElements=u.groupBy=u.first=u.findIndex=u.find=u.finalize=u.filter=u.expand=u.exhaustMap=u.exhaustAll=u.exhaust=u.every=u.endWith=u.elementAt=u.distinctUntilKeyChanged=u.distinctUntilChanged=u.distinct=u.dematerialize=u.delayWhen=u.delay=u.defaultIfEmpty=u.debounceTime=u.debounce=u.count=u.connect=u.concatWith=u.concatMapTo=u.concatMap=u.concatAll=u.concat=u.combineLatestWith=u.combineLatest=u.combineLatestAll=u.combineAll=u.catchError=u.bufferWhen=u.bufferToggle=u.bufferTime=u.bufferCount=u.buffer=u.auditTime=u.audit=void 0;u.timeInterval=u.throwIfEmpty=u.throttleTime=u.throttle=u.tap=u.takeWhile=u.takeUntil=u.takeLast=u.take=u.switchScan=u.switchMapTo=u.switchMap=u.switchAll=u.subscribeOn=u.startWith=u.skipWhile=u.skipUntil=u.skipLast=u.skip=u.single=u.shareReplay=u.share=u.sequenceEqual=u.scan=u.sampleTime=u.sample=u.refCount=u.retryWhen=u.retry=u.repeatWhen=u.repeat=u.reduce=u.raceWith=u.race=u.publishReplay=u.publishLast=u.publishBehavior=u.publish=u.pluck=u.partition=u.pairwise=u.onErrorResumeNext=u.observeOn=u.multicast=u.min=u.mergeWith=u.mergeScan=u.mergeMapTo=u.mergeMap=u.flatMap=void 0;u.zipWith=u.zipAll=u.zip=u.withLatestFrom=u.windowWhen=u.windowToggle=u.windowTime=u.windowCount=u.window=u.toArray=u.timestamp=u.timeoutWith=u.timeout=void 0;var kp=vu();Object.defineProperty(u,"audit",{enumerable:!0,get:function(){return kp.audit}});var $p=Eu();Object.defineProperty(u,"auditTime",{enumerable:!0,get:function(){return $p.auditTime}});var qp=bu();Object.defineProperty(u,"buffer",{enumerable:!0,get:function(){return qp.buffer}});var Cp=Su();Object.defineProperty(u,"bufferCount",{enumerable:!0,get:function(){return Cp.bufferCount}});var Np=wu();Object.defineProperty(u,"bufferTime",{enumerable:!0,get:function(){return Np.bufferTime}});var Mp=xu();Object.defineProperty(u,"bufferToggle",{enumerable:!0,get:function(){return Mp.bufferToggle}});var jp=Ou();Object.defineProperty(u,"bufferWhen",{enumerable:!0,get:function(){return jp.bufferWhen}});var Dp=Tu();Object.defineProperty(u,"catchError",{enumerable:!0,get:function(){return Dp.catchError}});var Up=Au();Object.defineProperty(u,"combineAll",{enumerable:!0,get:function(){return Up.combineAll}});var Wp=Pu();Object.defineProperty(u,"combineLatestAll",{enumerable:!0,get:function(){return Wp.combineLatestAll}});var Bp=Lu();Object.defineProperty(u,"combineLatest",{enumerable:!0,get:function(){return Bp.combineLatest}});var Fp=ku();Object.defineProperty(u,"combineLatestWith",{enumerable:!0,get:function(){return Fp.combineLatestWith}});var Gp=Cu();Object.defineProperty(u,"concat",{enumerable:!0,get:function(){return Gp.concat}});var Vp=_u();Object.defineProperty(u,"concatAll",{enumerable:!0,get:function(){return Vp.concatAll}});var zp=$u();Object.defineProperty(u,"concatMap",{enumerable:!0,get:function(){return zp.concatMap}});var Xp=qu();Object.defineProperty(u,"concatMapTo",{enumerable:!0,get:function(){return Xp.concatMapTo}});var Hp=Nu();Object.defineProperty(u,"concatWith",{enumerable:!0,get:function(){return Hp.concatWith}});var Yp=Mu();Object.defineProperty(u,"connect",{enumerable:!0,get:function(){return Yp.connect}});var Jp=ju();Object.defineProperty(u,"count",{enumerable:!0,get:function(){return Jp.count}});var Zp=Du();Object.defineProperty(u,"debounce",{enumerable:!0,get:function(){return Zp.debounce}});var Kp=Uu();Object.defineProperty(u,"debounceTime",{enumerable:!0,get:function(){return Kp.debounceTime}});var Qp=Wu();Object.defineProperty(u,"defaultIfEmpty",{enumerable:!0,get:function(){return Qp.defaultIfEmpty}});var em=zu();Object.defineProperty(u,"delay",{enumerable:!0,get:function(){return em.delay}});var tm=Vu();Object.defineProperty(u,"delayWhen",{enumerable:!0,get:function(){return tm.delayWhen}});var rm=Xu();Object.defineProperty(u,"dematerialize",{enumerable:!0,get:function(){return rm.dematerialize}});var nm=Hu();Object.defineProperty(u,"distinct",{enumerable:!0,get:function(){return nm.distinct}});var sm=Yu();Object.defineProperty(u,"distinctUntilChanged",{enumerable:!0,get:function(){return sm.distinctUntilChanged}});var im=Ju();Object.defineProperty(u,"distinctUntilKeyChanged",{enumerable:!0,get:function(){return im.distinctUntilKeyChanged}});var om=Ku();Object.defineProperty(u,"elementAt",{enumerable:!0,get:function(){return om.elementAt}});var am=Qu();Object.defineProperty(u,"endWith",{enumerable:!0,get:function(){return am.endWith}});var um=ec();Object.defineProperty(u,"every",{enumerable:!0,get:function(){return um.every}});var cm=nc();Object.defineProperty(u,"exhaust",{enumerable:!0,get:function(){return cm.exhaust}});var fm=rc();Object.defineProperty(u,"exhaustAll",{enumerable:!0,get:function(){return fm.exhaustAll}});var lm=tc();Object.defineProperty(u,"exhaustMap",{enumerable:!0,get:function(){return lm.exhaustMap}});var hm=sc();Object.defineProperty(u,"expand",{enumerable:!0,get:function(){return hm.expand}});var dm=Yn();Object.defineProperty(u,"filter",{enumerable:!0,get:function(){return dm.filter}});var pm=ic();Object.defineProperty(u,"finalize",{enumerable:!0,get:function(){return pm.finalize}});var mm=oc();Object.defineProperty(u,"find",{enumerable:!0,get:function(){return mm.find}});var _m=ac();Object.defineProperty(u,"findIndex",{enumerable:!0,get:function(){return _m.findIndex}});var ym=uc();Object.defineProperty(u,"first",{enumerable:!0,get:function(){return ym.first}});var gm=cc();Object.defineProperty(u,"groupBy",{enumerable:!0,get:function(){return gm.groupBy}});var vm=Fu();Object.defineProperty(u,"ignoreElements",{enumerable:!0,get:function(){return vm.ignoreElements}});var Em=fc();Object.defineProperty(u,"isEmpty",{enumerable:!0,get:function(){return Em.isEmpty}});var bm=hc();Object.defineProperty(u,"last",{enumerable:!0,get:function(){return bm.last}});var Sm=du();Object.defineProperty(u,"map",{enumerable:!0,get:function(){return Sm.map}});var wm=Gu();Object.defineProperty(u,"mapTo",{enumerable:!0,get:function(){return wm.mapTo}});var xm=dc();Object.defineProperty(u,"materialize",{enumerable:!0,get:function(){return xm.materialize}});var Om=pc();Object.defineProperty(u,"max",{enumerable:!0,get:function(){return Om.max}});var Tm=gc();Object.defineProperty(u,"merge",{enumerable:!0,get:function(){return Tm.merge}});var Im=mu();Object.defineProperty(u,"mergeAll",{enumerable:!0,get:function(){return Im.mergeAll}});var Rm=mc();Object.defineProperty(u,"flatMap",{enumerable:!0,get:function(){return Rm.flatMap}});var Pm=pu();Object.defineProperty(u,"mergeMap",{enumerable:!0,get:function(){return Pm.mergeMap}});var Am=_c();Object.defineProperty(u,"mergeMapTo",{enumerable:!0,get:function(){return Am.mergeMapTo}});var Lm=yc();Object.defineProperty(u,"mergeScan",{enumerable:!0,get:function(){return Lm.mergeScan}});var km=vc();Object.defineProperty(u,"mergeWith",{enumerable:!0,get:function(){return km.mergeWith}});var $m=Ec();Object.defineProperty(u,"min",{enumerable:!0,get:function(){return $m.min}});var qm=bc();Object.defineProperty(u,"multicast",{enumerable:!0,get:function(){return qm.multicast}});var Cm=fu();Object.defineProperty(u,"observeOn",{enumerable:!0,get:function(){return Cm.observeOn}});var Nm=Sc();Object.defineProperty(u,"onErrorResumeNext",{enumerable:!0,get:function(){return Nm.onErrorResumeNext}});var Mm=wc();Object.defineProperty(u,"pairwise",{enumerable:!0,get:function(){return Mm.pairwise}});var jm=No();Object.defineProperty(u,"partition",{enumerable:!0,get:function(){return jm.partition}});var Dm=xc();Object.defineProperty(u,"pluck",{enumerable:!0,get:function(){return Dm.pluck}});var Um=Oc();Object.defineProperty(u,"publish",{enumerable:!0,get:function(){return Um.publish}});var Wm=Tc();Object.defineProperty(u,"publishBehavior",{enumerable:!0,get:function(){return Wm.publishBehavior}});var Bm=Ic();Object.defineProperty(u,"publishLast",{enumerable:!0,get:function(){return Bm.publishLast}});var Fm=Rc();Object.defineProperty(u,"publishReplay",{enumerable:!0,get:function(){return Fm.publishReplay}});var Gm=Mo();Object.defineProperty(u,"race",{enumerable:!0,get:function(){return Gm.race}});var Vm=Jn();Object.defineProperty(u,"raceWith",{enumerable:!0,get:function(){return Vm.raceWith}});var zm=Iu();Object.defineProperty(u,"reduce",{enumerable:!0,get:function(){return zm.reduce}});var Xm=Pc();Object.defineProperty(u,"repeat",{enumerable:!0,get:function(){return Xm.repeat}});var Hm=Ac();Object.defineProperty(u,"repeatWhen",{enumerable:!0,get:function(){return Hm.repeatWhen}});var Ym=Lc();Object.defineProperty(u,"retry",{enumerable:!0,get:function(){return Ym.retry}});var Jm=kc();Object.defineProperty(u,"retryWhen",{enumerable:!0,get:function(){return Jm.retryWhen}});var Zm=cu();Object.defineProperty(u,"refCount",{enumerable:!0,get:function(){return Zm.refCount}});var Km=$c();Object.defineProperty(u,"sample",{enumerable:!0,get:function(){return Km.sample}});var Qm=qc();Object.defineProperty(u,"sampleTime",{enumerable:!0,get:function(){return Qm.sampleTime}});var e_=Cc();Object.defineProperty(u,"scan",{enumerable:!0,get:function(){return e_.scan}});var t_=Nc();Object.defineProperty(u,"sequenceEqual",{enumerable:!0,get:function(){return t_.sequenceEqual}});var r_=Mc();Object.defineProperty(u,"share",{enumerable:!0,get:function(){return r_.share}});var n_=jc();Object.defineProperty(u,"shareReplay",{enumerable:!0,get:function(){return n_.shareReplay}});var s_=Dc();Object.defineProperty(u,"single",{enumerable:!0,get:function(){return s_.single}});var i_=Uc();Object.defineProperty(u,"skip",{enumerable:!0,get:function(){return i_.skip}});var o_=Wc();Object.defineProperty(u,"skipLast",{enumerable:!0,get:function(){return o_.skipLast}});var a_=Bc();Object.defineProperty(u,"skipUntil",{enumerable:!0,get:function(){return a_.skipUntil}});var u_=Fc();Object.defineProperty(u,"skipWhile",{enumerable:!0,get:function(){return u_.skipWhile}});var c_=Gc();Object.defineProperty(u,"startWith",{enumerable:!0,get:function(){return c_.startWith}});var f_=lu();Object.defineProperty(u,"subscribeOn",{enumerable:!0,get:function(){return f_.subscribeOn}});var l_=zc();Object.defineProperty(u,"switchAll",{enumerable:!0,get:function(){return l_.switchAll}});var h_=Vc();Object.defineProperty(u,"switchMap",{enumerable:!0,get:function(){return h_.switchMap}});var d_=Xc();Object.defineProperty(u,"switchMapTo",{enumerable:!0,get:function(){return d_.switchMapTo}});var p_=Hc();Object.defineProperty(u,"switchScan",{enumerable:!0,get:function(){return p_.switchScan}});var m_=Bu();Object.defineProperty(u,"take",{enumerable:!0,get:function(){return m_.take}});var __=lc();Object.defineProperty(u,"takeLast",{enumerable:!0,get:function(){return __.takeLast}});var y_=Yc();Object.defineProperty(u,"takeUntil",{enumerable:!0,get:function(){return y_.takeUntil}});var g_=Jc();Object.defineProperty(u,"takeWhile",{enumerable:!0,get:function(){return g_.takeWhile}});var v_=Zc();Object.defineProperty(u,"tap",{enumerable:!0,get:function(){return v_.tap}});var E_=Kc();Object.defineProperty(u,"throttle",{enumerable:!0,get:function(){return E_.throttle}});var b_=Qc();Object.defineProperty(u,"throttleTime",{enumerable:!0,get:function(){return b_.throttleTime}});var S_=Zu();Object.defineProperty(u,"throwIfEmpty",{enumerable:!0,get:function(){return S_.throwIfEmpty}});var w_=ef();Object.defineProperty(u,"timeInterval",{enumerable:!0,get:function(){return w_.timeInterval}});var x_=hu();Object.defineProperty(u,"timeout",{enumerable:!0,get:function(){return x_.timeout}});var O_=tf();Object.defineProperty(u,"timeoutWith",{enumerable:!0,get:function(){return O_.timeoutWith}});var T_=rf();Object.defineProperty(u,"timestamp",{enumerable:!0,get:function(){return T_.timestamp}});var I_=Ru();Object.defineProperty(u,"toArray",{enumerable:!0,get:function(){return I_.toArray}});var R_=nf();Object.defineProperty(u,"window",{enumerable:!0,get:function(){return R_.window}});var P_=sf();Object.defineProperty(u,"windowCount",{enumerable:!0,get:function(){return P_.windowCount}});var A_=of();Object.defineProperty(u,"windowTime",{enumerable:!0,get:function(){return A_.windowTime}});var L_=af();Object.defineProperty(u,"windowToggle",{enumerable:!0,get:function(){return L_.windowToggle}});var k_=uf();Object.defineProperty(u,"windowWhen",{enumerable:!0,get:function(){return k_.windowWhen}});var $_=cf();Object.defineProperty(u,"withLatestFrom",{enumerable:!0,get:function(){return $_.withLatestFrom}});var q_=lf();Object.defineProperty(u,"zip",{enumerable:!0,get:function(){return q_.zip}});var C_=ff();Object.defineProperty(u,"zipAll",{enumerable:!0,get:function(){return C_.zipAll}});var N_=hf();Object.defineProperty(u,"zipWith",{enumerable:!0,get:function(){return N_.zipWith}})});var fe=O((hv,Uo)=>{"use strict";var jo=["nodebuffer","arraybuffer","fragments"],Do=typeof Blob<"u";Do&&jo.push("blob");Uo.exports={BINARY_TYPES:jo,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:Do,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var xt=O((dv,ur)=>{"use strict";var{EMPTY_BUFFER:j_}=fe(),hn=Buffer[Symbol.species];function D_(r,e){if(r.length===0)return j_;if(r.length===1)return r[0];let t=Buffer.allocUnsafe(e),n=0;for(let s=0;s<r.length;s++){let i=r[s];t.set(i,n),n+=i.length}return n<e?new hn(t.buffer,t.byteOffset,n):t}function Wo(r,e,t,n,s){for(let i=0;i<s;i++)t[n+i]=r[i]^e[i&3]}function Bo(r,e){for(let t=0;t<r.length;t++)r[t]^=e[t&3]}function U_(r){return r.length===r.buffer.byteLength?r.buffer:r.buffer.slice(r.byteOffset,r.byteOffset+r.length)}function dn(r){if(dn.readOnly=!0,Buffer.isBuffer(r))return r;let e;return r instanceof ArrayBuffer?e=new hn(r):ArrayBuffer.isView(r)?e=new hn(r.buffer,r.byteOffset,r.byteLength):(e=Buffer.from(r),dn.readOnly=!1),e}ur.exports={concat:D_,mask:Wo,toArrayBuffer:U_,toBuffer:dn,unmask:Bo};if(!process.env.WS_NO_BUFFER_UTIL)try{let r=df();ur.exports.mask=function(e,t,n,s,i){i<48?Wo(e,t,n,s,i):r.mask(e,t,n,s,i)},ur.exports.unmask=function(e,t){e.length<32?Bo(e,t):r.unmask(e,t)}}catch{}});var Vo=O((pv,Go)=>{"use strict";var Fo=Symbol("kDone"),pn=Symbol("kRun"),mn=class{constructor(e){this[Fo]=()=>{this.pending--,this[pn]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[pn]()}[pn](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[Fo])}}};Go.exports=mn});var Tt=O((mv,Yo)=>{"use strict";var Ot=W("zlib"),zo=xt(),W_=Vo(),{kStatusCode:Xo}=fe(),B_=Buffer[Symbol.species],F_=Buffer.from([0,0,255,255]),fr=Symbol("permessage-deflate"),le=Symbol("total-length"),Ve=Symbol("callback"),be=Symbol("buffers"),ze=Symbol("error"),cr,_n=class{constructor(e,t,n){if(this._maxPayload=n|0,this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!t,this._deflate=null,this._inflate=null,this.params=null,!cr){let s=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;cr=new W_(s)}}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[Ve];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let t=this._options,n=e.find(s=>!(t.serverNoContextTakeover===!1&&s.server_no_context_takeover||s.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits=="number"&&t.serverMaxWindowBits>s.server_max_window_bits)||typeof t.clientMaxWindowBits=="number"&&!s.client_max_window_bits));if(!n)throw new Error("None of the extension offers can be accepted");return t.serverNoContextTakeover&&(n.server_no_context_takeover=!0),t.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof t.serverMaxWindowBits=="number"&&(n.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits=="number"?n.client_max_window_bits=t.clientMaxWindowBits:(n.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return t}normalizeParams(e){return e.forEach(t=>{Object.keys(t).forEach(n=>{let s=t[n];if(s.length>1)throw new Error(`Parameter "${n}" must have only a single value`);if(s=s[0],n==="client_max_window_bits"){if(s!==!0){let i=+s;if(!Number.isInteger(i)||i<8||i>15)throw new TypeError(`Invalid value for parameter "${n}": ${s}`);s=i}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${n}": ${s}`)}else if(n==="server_max_window_bits"){let i=+s;if(!Number.isInteger(i)||i<8||i>15)throw new TypeError(`Invalid value for parameter "${n}": ${s}`);s=i}else if(n==="client_no_context_takeover"||n==="server_no_context_takeover"){if(s!==!0)throw new TypeError(`Invalid value for parameter "${n}": ${s}`)}else throw new Error(`Unknown parameter "${n}"`);t[n]=s})}),e}decompress(e,t,n){cr.add(s=>{this._decompress(e,t,(i,o)=>{s(),n(i,o)})})}compress(e,t,n){cr.add(s=>{this._compress(e,t,(i,o)=>{s(),n(i,o)})})}_decompress(e,t,n){let s=this._isServer?"client":"server";if(!this._inflate){let i=`${s}_max_window_bits`,o=typeof this.params[i]!="number"?Ot.Z_DEFAULT_WINDOWBITS:this.params[i];this._inflate=Ot.createInflateRaw({...this._options.zlibInflateOptions,windowBits:o}),this._inflate[fr]=this,this._inflate[le]=0,this._inflate[be]=[],this._inflate.on("error",V_),this._inflate.on("data",Ho)}this._inflate[Ve]=n,this._inflate.write(e),t&&this._inflate.write(F_),this._inflate.flush(()=>{let i=this._inflate[ze];if(i){this._inflate.close(),this._inflate=null,n(i);return}let o=zo.concat(this._inflate[be],this._inflate[le]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[le]=0,this._inflate[be]=[],t&&this.params[`${s}_no_context_takeover`]&&this._inflate.reset()),n(null,o)})}_compress(e,t,n){let s=this._isServer?"server":"client";if(!this._deflate){let i=`${s}_max_window_bits`,o=typeof this.params[i]!="number"?Ot.Z_DEFAULT_WINDOWBITS:this.params[i];this._deflate=Ot.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:o}),this._deflate[le]=0,this._deflate[be]=[],this._deflate.on("data",G_)}this._deflate[Ve]=n,this._deflate.write(e),this._deflate.flush(Ot.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let i=zo.concat(this._deflate[be],this._deflate[le]);t&&(i=new B_(i.buffer,i.byteOffset,i.length-4)),this._deflate[Ve]=null,this._deflate[le]=0,this._deflate[be]=[],t&&this.params[`${s}_no_context_takeover`]&&this._deflate.reset(),n(null,i)})}};Yo.exports=_n;function G_(r){this[be].push(r),this[le]+=r.length}function Ho(r){if(this[le]+=r.length,this[fr]._maxPayload<1||this[le]<=this[fr]._maxPayload){this[be].push(r);return}this[ze]=new RangeError("Max payload size exceeded"),this[ze].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[ze][Xo]=1009,this.removeListener("data",Ho),this.reset()}function V_(r){if(this[fr]._inflate=null,this[ze]){this[Ve](this[ze]);return}r[Xo]=1007,this[Ve](r)}});var Xe=O((_v,lr)=>{"use strict";var{isUtf8:Jo}=W("buffer"),{hasBlob:z_}=fe(),X_=[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 H_(r){return r>=1e3&&r<=1014&&r!==1004&&r!==1005&&r!==1006||r>=3e3&&r<=4999}function yn(r){let e=r.length,t=0;for(;t<e;)if((r[t]&128)===0)t++;else if((r[t]&224)===192){if(t+1===e||(r[t+1]&192)!==128||(r[t]&254)===192)return!1;t+=2}else if((r[t]&240)===224){if(t+2>=e||(r[t+1]&192)!==128||(r[t+2]&192)!==128||r[t]===224&&(r[t+1]&224)===128||r[t]===237&&(r[t+1]&224)===160)return!1;t+=3}else if((r[t]&248)===240){if(t+3>=e||(r[t+1]&192)!==128||(r[t+2]&192)!==128||(r[t+3]&192)!==128||r[t]===240&&(r[t+1]&240)===128||r[t]===244&&r[t+1]>143||r[t]>244)return!1;t+=4}else return!1;return!0}function Y_(r){return z_&&typeof r=="object"&&typeof r.arrayBuffer=="function"&&typeof r.type=="string"&&typeof r.stream=="function"&&(r[Symbol.toStringTag]==="Blob"||r[Symbol.toStringTag]==="File")}lr.exports={isBlob:Y_,isValidStatusCode:H_,isValidUTF8:yn,tokenChars:X_};if(Jo)lr.exports.isValidUTF8=function(r){return r.length<24?yn(r):Jo(r)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let r=pf();lr.exports.isValidUTF8=function(e){return e.length<32?yn(e):r(e)}}catch{}});var Sn=O((yv,na)=>{"use strict";var{Writable:J_}=W("stream"),Zo=Tt(),{BINARY_TYPES:Z_,EMPTY_BUFFER:Ko,kStatusCode:K_,kWebSocket:Q_}=fe(),{concat:gn,toArrayBuffer:ey,unmask:ty}=xt(),{isValidStatusCode:ry,isValidUTF8:Qo}=Xe(),hr=Buffer[Symbol.species],ee=0,ea=1,ta=2,ra=3,vn=4,En=5,dr=6,bn=class extends J_{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||Z_[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[Q_]=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=ee}_write(e,t,n){if(this._opcode===8&&this._state==ee)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 hr(n.buffer,n.byteOffset+e,n.length-e),new hr(n.buffer,n.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let n=this._buffers[0],s=t.length-e;e>=n.length?t.set(this._buffers.shift(),s):(t.set(new Uint8Array(n.buffer,n.byteOffset,e),s),this._buffers[0]=new hr(n.buffer,n.byteOffset+e,n.length-e)),e-=n.length}while(e>0);return t}startLoop(e){this._loop=!0;do switch(this._state){case ee:this.getInfo(e);break;case ea:this.getPayloadLength16(e);break;case ta:this.getPayloadLength64(e);break;case ra:this.getMask();break;case vn:this.getData(e);break;case En:case dr:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if((t[0]&48)!==0){let s=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(s);return}let n=(t[0]&64)===64;if(n&&!this._extensions[Zo.extensionName]){let s=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(s);return}if(this._fin=(t[0]&128)===128,this._opcode=t[0]&15,this._payloadLength=t[1]&127,this._opcode===0){if(n){let s=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(s);return}if(!this._fragmented){let s=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(s);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let s=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(s);return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let s=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(s);return}if(n){let s=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(s);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let s=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(s);return}}else{let s=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(s);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(t[1]&128)===128,this._isServer){if(!this._masked){let s=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(s);return}}else if(this._masked){let s=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(s);return}this._payloadLength===126?this._state=ea:this._payloadLength===127?this._state=ta: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 t=this.consume(8),n=t.readUInt32BE(0);if(n>Math.pow(2,21)-1){let s=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(s);return}this._payloadLength=n*Math.pow(2,32)+t.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 t=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(t);return}this._masked?this._state=ra:this._state=vn}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=vn}getData(e){let t=Ko;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&ty(t,this._mask)}if(this._opcode>7){this.controlMessage(t,e);return}if(this._compressed){this._state=En,this.decompress(t,e);return}t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage(e)}decompress(e,t){this._extensions[Zo.extensionName].decompress(e,this._fin,(s,i)=>{if(s)return t(s);if(i.length){if(this._messageLength+=i.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let o=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");t(o);return}this._fragments.push(i)}this.dataMessage(t),this._state===ee&&this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=ee;return}let t=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let s;this._binaryType==="nodebuffer"?s=gn(n,t):this._binaryType==="arraybuffer"?s=ey(gn(n,t)):this._binaryType==="blob"?s=new Blob(n):s=n,this._allowSynchronousEvents?(this.emit("message",s,!0),this._state=ee):(this._state=dr,setImmediate(()=>{this.emit("message",s,!0),this._state=ee,this.startLoop(e)}))}else{let s=gn(n,t);if(!this._skipUTF8Validation&&!Qo(s)){let i=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(i);return}this._state===En||this._allowSynchronousEvents?(this.emit("message",s,!1),this._state=ee):(this._state=dr,setImmediate(()=>{this.emit("message",s,!1),this._state=ee,this.startLoop(e)}))}}controlMessage(e,t){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,Ko),this.end();else{let n=e.readUInt16BE(0);if(!ry(n)){let i=this.createError(RangeError,`invalid status code ${n}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");t(i);return}let s=new hr(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!Qo(s)){let i=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(i);return}this._loop=!1,this.emit("conclude",n,s),this.end()}this._state=ee;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=ee):(this._state=dr,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=ee,this.startLoop(t)}))}createError(e,t,n,s,i){this._loop=!1,this._errored=!0;let o=new e(n?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(o,this.createError),o.code=i,o[K_]=s,o}};na.exports=bn});var On=O((vv,oa)=>{"use strict";var{Duplex:gv}=W("stream"),{randomFillSync:ny}=W("crypto"),sa=Tt(),{EMPTY_BUFFER:sy,kWebSocket:iy,NOOP:oy}=fe(),{isBlob:He,isValidStatusCode:ay}=Xe(),{mask:ia,toBuffer:Ae}=xt(),te=Symbol("kByteLength"),uy=Buffer.alloc(4),pr=8*1024,Le,Ye=pr,ne=0,cy=1,fy=2,wn=class r{constructor(e,t,n){this._extensions=t||{},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=ne,this.onerror=oy,this[iy]=void 0}static frame(e,t){let n,s=!1,i=2,o=!1;t.mask&&(n=t.maskBuffer||uy,t.generateMask?t.generateMask(n):(Ye===pr&&(Le===void 0&&(Le=Buffer.alloc(pr)),ny(Le,0,pr),Ye=0),n[0]=Le[Ye++],n[1]=Le[Ye++],n[2]=Le[Ye++],n[3]=Le[Ye++]),o=(n[0]|n[1]|n[2]|n[3])===0,i=6);let a;typeof e=="string"?(!t.mask||o)&&t[te]!==void 0?a=t[te]:(e=Buffer.from(e),a=e.length):(a=e.length,s=t.mask&&t.readOnly&&!o);let c=a;a>=65536?(i+=8,c=127):a>125&&(i+=2,c=126);let f=Buffer.allocUnsafe(s?a+i:i);return f[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(f[0]|=64),f[1]=c,c===126?f.writeUInt16BE(a,2):c===127&&(f[2]=f[3]=0,f.writeUIntBE(a,4,6)),t.mask?(f[1]|=128,f[i-4]=n[0],f[i-3]=n[1],f[i-2]=n[2],f[i-1]=n[3],o?[f,e]:s?(ia(e,n,f,i,a),[f]):(ia(e,n,e,0,a),[f,e])):[f,e]}close(e,t,n,s){let i;if(e===void 0)i=sy;else{if(typeof e!="number"||!ay(e))throw new TypeError("First argument must be a valid error code number");if(t===void 0||!t.length)i=Buffer.allocUnsafe(2),i.writeUInt16BE(e,0);else{let a=Buffer.byteLength(t);if(a>123)throw new RangeError("The message must not be greater than 123 bytes");i=Buffer.allocUnsafe(2+a),i.writeUInt16BE(e,0),typeof t=="string"?i.write(t,2):i.set(t,2)}}let o={[te]:i.length,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==ne?this.enqueue([this.dispatch,i,!1,o,s]):this.sendFrame(r.frame(i,o),s)}ping(e,t,n){let s,i;if(typeof e=="string"?(s=Buffer.byteLength(e),i=!1):He(e)?(s=e.size,i=!1):(e=Ae(e),s=e.length,i=Ae.readOnly),s>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[te]:s,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:9,readOnly:i,rsv1:!1};He(e)?this._state!==ne?this.enqueue([this.getBlobData,e,!1,o,n]):this.getBlobData(e,!1,o,n):this._state!==ne?this.enqueue([this.dispatch,e,!1,o,n]):this.sendFrame(r.frame(e,o),n)}pong(e,t,n){let s,i;if(typeof e=="string"?(s=Buffer.byteLength(e),i=!1):He(e)?(s=e.size,i=!1):(e=Ae(e),s=e.length,i=Ae.readOnly),s>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[te]:s,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:10,readOnly:i,rsv1:!1};He(e)?this._state!==ne?this.enqueue([this.getBlobData,e,!1,o,n]):this.getBlobData(e,!1,o,n):this._state!==ne?this.enqueue([this.dispatch,e,!1,o,n]):this.sendFrame(r.frame(e,o),n)}send(e,t,n){let s=this._extensions[sa.extensionName],i=t.binary?2:1,o=t.compress,a,c;typeof e=="string"?(a=Buffer.byteLength(e),c=!1):He(e)?(a=e.size,c=!1):(e=Ae(e),a=e.length,c=Ae.readOnly),this._firstFragment?(this._firstFragment=!1,o&&s&&s.params[s._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(o=a>=s._threshold),this._compress=o):(o=!1,i=0),t.fin&&(this._firstFragment=!0);let f={[te]:a,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:i,readOnly:c,rsv1:o};He(e)?this._state!==ne?this.enqueue([this.getBlobData,e,this._compress,f,n]):this.getBlobData(e,this._compress,f,n):this._state!==ne?this.enqueue([this.dispatch,e,this._compress,f,n]):this.dispatch(e,this._compress,f,n)}getBlobData(e,t,n,s){this._bufferedBytes+=n[te],this._state=fy,e.arrayBuffer().then(i=>{if(this._socket.destroyed){let a=new Error("The socket was closed while the blob was being read");process.nextTick(xn,this,a,s);return}this._bufferedBytes-=n[te];let o=Ae(i);t?this.dispatch(o,t,n,s):(this._state=ne,this.sendFrame(r.frame(o,n),s),this.dequeue())}).catch(i=>{process.nextTick(ly,this,i,s)})}dispatch(e,t,n,s){if(!t){this.sendFrame(r.frame(e,n),s);return}let i=this._extensions[sa.extensionName];this._bufferedBytes+=n[te],this._state=cy,i.compress(e,n.fin,(o,a)=>{if(this._socket.destroyed){let c=new Error("The socket was closed while data was being compressed");xn(this,c,s);return}this._bufferedBytes-=n[te],this._state=ne,n.readOnly=!1,this.sendFrame(r.frame(a,n),s),this.dequeue()})}dequeue(){for(;this._state===ne&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][te],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][te],this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};oa.exports=wn;function xn(r,e,t){typeof t=="function"&&t(e);for(let n=0;n<r._queue.length;n++){let s=r._queue[n],i=s[s.length-1];typeof i=="function"&&i(e)}}function ly(r,e,t){xn(r,e,t),r.onerror(e)}});var ma=O((Ev,pa)=>{"use strict";var{kForOnEventAttribute:It,kListener:Tn}=fe(),aa=Symbol("kCode"),ua=Symbol("kData"),ca=Symbol("kError"),fa=Symbol("kMessage"),la=Symbol("kReason"),Je=Symbol("kTarget"),ha=Symbol("kType"),da=Symbol("kWasClean"),he=class{constructor(e){this[Je]=null,this[ha]=e}get target(){return this[Je]}get type(){return this[ha]}};Object.defineProperty(he.prototype,"target",{enumerable:!0});Object.defineProperty(he.prototype,"type",{enumerable:!0});var ke=class extends he{constructor(e,t={}){super(e),this[aa]=t.code===void 0?0:t.code,this[la]=t.reason===void 0?"":t.reason,this[da]=t.wasClean===void 0?!1:t.wasClean}get code(){return this[aa]}get reason(){return this[la]}get wasClean(){return this[da]}};Object.defineProperty(ke.prototype,"code",{enumerable:!0});Object.defineProperty(ke.prototype,"reason",{enumerable:!0});Object.defineProperty(ke.prototype,"wasClean",{enumerable:!0});var Ze=class extends he{constructor(e,t={}){super(e),this[ca]=t.error===void 0?null:t.error,this[fa]=t.message===void 0?"":t.message}get error(){return this[ca]}get message(){return this[fa]}};Object.defineProperty(Ze.prototype,"error",{enumerable:!0});Object.defineProperty(Ze.prototype,"message",{enumerable:!0});var Rt=class extends he{constructor(e,t={}){super(e),this[ua]=t.data===void 0?null:t.data}get data(){return this[ua]}};Object.defineProperty(Rt.prototype,"data",{enumerable:!0});var hy={addEventListener(r,e,t={}){for(let s of this.listeners(r))if(!t[It]&&s[Tn]===e&&!s[It])return;let n;if(r==="message")n=function(i,o){let a=new Rt("message",{data:o?i:i.toString()});a[Je]=this,mr(e,this,a)};else if(r==="close")n=function(i,o){let a=new ke("close",{code:i,reason:o.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});a[Je]=this,mr(e,this,a)};else if(r==="error")n=function(i){let o=new Ze("error",{error:i,message:i.message});o[Je]=this,mr(e,this,o)};else if(r==="open")n=function(){let i=new he("open");i[Je]=this,mr(e,this,i)};else return;n[It]=!!t[It],n[Tn]=e,t.once?this.once(r,n):this.on(r,n)},removeEventListener(r,e){for(let t of this.listeners(r))if(t[Tn]===e&&!t[It]){this.removeListener(r,t);break}}};pa.exports={CloseEvent:ke,ErrorEvent:Ze,Event:he,EventTarget:hy,MessageEvent:Rt};function mr(r,e,t){typeof r=="object"&&r.handleEvent?r.handleEvent.call(r,t):r.call(e,t)}});var In=O((bv,_a)=>{"use strict";var{tokenChars:Pt}=Xe();function ae(r,e,t){r[e]===void 0?r[e]=[t]:r[e].push(t)}function dy(r){let e=Object.create(null),t=Object.create(null),n=!1,s=!1,i=!1,o,a,c=-1,f=-1,m=-1,l=0;for(;l<r.length;l++)if(f=r.charCodeAt(l),o===void 0)if(m===-1&&Pt[f]===1)c===-1&&(c=l);else if(l!==0&&(f===32||f===9))m===-1&&c!==-1&&(m=l);else if(f===59||f===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${l}`);m===-1&&(m=l);let _=r.slice(c,m);f===44?(ae(e,_,t),t=Object.create(null)):o=_,c=m=-1}else throw new SyntaxError(`Unexpected character at index ${l}`);else if(a===void 0)if(m===-1&&Pt[f]===1)c===-1&&(c=l);else if(f===32||f===9)m===-1&&c!==-1&&(m=l);else if(f===59||f===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${l}`);m===-1&&(m=l),ae(t,r.slice(c,m),!0),f===44&&(ae(e,o,t),t=Object.create(null),o=void 0),c=m=-1}else if(f===61&&c!==-1&&m===-1)a=r.slice(c,l),c=m=-1;else throw new SyntaxError(`Unexpected character at index ${l}`);else if(s){if(Pt[f]!==1)throw new SyntaxError(`Unexpected character at index ${l}`);c===-1?c=l:n||(n=!0),s=!1}else if(i)if(Pt[f]===1)c===-1&&(c=l);else if(f===34&&c!==-1)i=!1,m=l;else if(f===92)s=!0;else throw new SyntaxError(`Unexpected character at index ${l}`);else if(f===34&&r.charCodeAt(l-1)===61)i=!0;else if(m===-1&&Pt[f]===1)c===-1&&(c=l);else if(c!==-1&&(f===32||f===9))m===-1&&(m=l);else if(f===59||f===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${l}`);m===-1&&(m=l);let _=r.slice(c,m);n&&(_=_.replace(/\\/g,""),n=!1),ae(t,a,_),f===44&&(ae(e,o,t),t=Object.create(null),o=void 0),a=void 0,c=m=-1}else throw new SyntaxError(`Unexpected character at index ${l}`);if(c===-1||i||f===32||f===9)throw new SyntaxError("Unexpected end of input");m===-1&&(m=l);let p=r.slice(c,m);return o===void 0?ae(e,p,t):(a===void 0?ae(t,p,!0):n?ae(t,a,p.replace(/\\/g,"")):ae(t,a,p),ae(e,o,t)),e}function py(r){return Object.keys(r).map(e=>{let t=r[e];return Array.isArray(t)||(t=[t]),t.map(n=>[e].concat(Object.keys(n).map(s=>{let i=n[s];return Array.isArray(i)||(i=[i]),i.map(o=>o===!0?s:`${s}=${o}`).join("; ")})).join("; ")).join(", ")}).join(", ")}_a.exports={format:py,parse:dy}});var vr=O((xv,Ra)=>{"use strict";var my=W("events"),_y=W("https"),yy=W("http"),va=W("net"),gy=W("tls"),{randomBytes:vy,createHash:Ey}=W("crypto"),{Duplex:Sv,Readable:wv}=W("stream"),{URL:Rn}=W("url"),Se=Tt(),by=Sn(),Sy=On(),{isBlob:wy}=Xe(),{BINARY_TYPES:ya,EMPTY_BUFFER:_r,GUID:xy,kForOnEventAttribute:Pn,kListener:Oy,kStatusCode:Ty,kWebSocket:B,NOOP:Ea}=fe(),{EventTarget:{addEventListener:Iy,removeEventListener:Ry}}=ma(),{format:Py,parse:Ay}=In(),{toBuffer:Ly}=xt(),ky=30*1e3,ba=Symbol("kAborted"),An=[8,13],de=["CONNECTING","OPEN","CLOSING","CLOSED"],$y=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,N=class r extends my{constructor(e,t,n){super(),this._binaryType=ya[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=_r,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=r.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,t===void 0?t=[]:Array.isArray(t)||(typeof t=="object"&&t!==null?(n=t,t=[]):t=[t]),Sa(this,e,t,n)):(this._autoPong=n.autoPong,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){ya.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,t,n){let s=new by({allowSynchronousEvents:n.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation}),i=new Sy(e,this._extensions,n.generateMask);this._receiver=s,this._sender=i,this._socket=e,s[B]=this,i[B]=this,e[B]=this,s.on("conclude",Ny),s.on("drain",My),s.on("error",jy),s.on("message",Dy),s.on("ping",Uy),s.on("pong",Wy),i.onerror=By,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",Oa),e.on("data",gr),e.on("end",Ta),e.on("error",Ia),this._readyState=r.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=r.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[Se.extensionName]&&this._extensions[Se.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=r.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){J(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===r.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=r.CLOSING,this._sender.close(e,t,!this._isServer,n=>{n||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),xa(this)}}pause(){this.readyState===r.CONNECTING||this.readyState===r.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,t,n){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(n=e,e=t=void 0):typeof t=="function"&&(n=t,t=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Ln(this,e,n);return}t===void 0&&(t=!this._isServer),this._sender.ping(e||_r,t,n)}pong(e,t,n){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(n=e,e=t=void 0):typeof t=="function"&&(n=t,t=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Ln(this,e,n);return}t===void 0&&(t=!this._isServer),this._sender.pong(e||_r,t,n)}resume(){this.readyState===r.CONNECTING||this.readyState===r.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,t,n){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"&&(n=t,t={}),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Ln(this,e,n);return}let s={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...t};this._extensions[Se.extensionName]||(s.compress=!1),this._sender.send(e||_r,s,n)}terminate(){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){J(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=r.CLOSING,this._socket.destroy())}}};Object.defineProperty(N,"CONNECTING",{enumerable:!0,value:de.indexOf("CONNECTING")});Object.defineProperty(N.prototype,"CONNECTING",{enumerable:!0,value:de.indexOf("CONNECTING")});Object.defineProperty(N,"OPEN",{enumerable:!0,value:de.indexOf("OPEN")});Object.defineProperty(N.prototype,"OPEN",{enumerable:!0,value:de.indexOf("OPEN")});Object.defineProperty(N,"CLOSING",{enumerable:!0,value:de.indexOf("CLOSING")});Object.defineProperty(N.prototype,"CLOSING",{enumerable:!0,value:de.indexOf("CLOSING")});Object.defineProperty(N,"CLOSED",{enumerable:!0,value:de.indexOf("CLOSED")});Object.defineProperty(N.prototype,"CLOSED",{enumerable:!0,value:de.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(r=>{Object.defineProperty(N.prototype,r,{enumerable:!0})});["open","error","close","message"].forEach(r=>{Object.defineProperty(N.prototype,`on${r}`,{enumerable:!0,get(){for(let e of this.listeners(r))if(e[Pn])return e[Oy];return null},set(e){for(let t of this.listeners(r))if(t[Pn]){this.removeListener(r,t);break}typeof e=="function"&&this.addEventListener(r,e,{[Pn]:!0})}})});N.prototype.addEventListener=Iy;N.prototype.removeEventListener=Ry;Ra.exports=N;function Sa(r,e,t,n){let s={allowSynchronousEvents:!0,autoPong:!0,protocolVersion:An[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(r._autoPong=s.autoPong,!An.includes(s.protocolVersion))throw new RangeError(`Unsupported protocol version: ${s.protocolVersion} (supported versions: ${An.join(", ")})`);let i;if(e instanceof Rn)i=e;else try{i=new Rn(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}i.protocol==="http:"?i.protocol="ws:":i.protocol==="https:"&&(i.protocol="wss:"),r._url=i.href;let o=i.protocol==="wss:",a=i.protocol==="ws+unix:",c;if(i.protocol!=="ws:"&&!o&&!a?c=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:a&&!i.pathname?c="The URL's pathname is empty":i.hash&&(c="The URL contains a fragment identifier"),c){let w=new SyntaxError(c);if(r._redirects===0)throw w;yr(r,w);return}let f=o?443:80,m=vy(16).toString("base64"),l=o?_y.request:yy.request,p=new Set,_;if(s.createConnection=s.createConnection||(o?Cy:qy),s.defaultPort=s.defaultPort||f,s.port=i.port||f,s.host=i.hostname.startsWith("[")?i.hostname.slice(1,-1):i.hostname,s.headers={...s.headers,"Sec-WebSocket-Version":s.protocolVersion,"Sec-WebSocket-Key":m,Connection:"Upgrade",Upgrade:"websocket"},s.path=i.pathname+i.search,s.timeout=s.handshakeTimeout,s.perMessageDeflate&&(_=new Se(s.perMessageDeflate!==!0?s.perMessageDeflate:{},!1,s.maxPayload),s.headers["Sec-WebSocket-Extensions"]=Py({[Se.extensionName]:_.offer()})),t.length){for(let w of t){if(typeof w!="string"||!$y.test(w)||p.has(w))throw new SyntaxError("An invalid or duplicated subprotocol was specified");p.add(w)}s.headers["Sec-WebSocket-Protocol"]=t.join(",")}if(s.origin&&(s.protocolVersion<13?s.headers["Sec-WebSocket-Origin"]=s.origin:s.headers.Origin=s.origin),(i.username||i.password)&&(s.auth=`${i.username}:${i.password}`),a){let w=s.path.split(":");s.socketPath=w[0],s.path=w[1]}let v;if(s.followRedirects){if(r._redirects===0){r._originalIpc=a,r._originalSecure=o,r._originalHostOrSocketPath=a?s.socketPath:i.host;let w=n&&n.headers;if(n={...n,headers:{}},w)for(let[L,Y]of Object.entries(w))n.headers[L.toLowerCase()]=Y}else if(r.listenerCount("redirect")===0){let w=a?r._originalIpc?s.socketPath===r._originalHostOrSocketPath:!1:r._originalIpc?!1:i.host===r._originalHostOrSocketPath;(!w||r._originalSecure&&!o)&&(delete s.headers.authorization,delete s.headers.cookie,w||delete s.headers.host,s.auth=void 0)}s.auth&&!n.headers.authorization&&(n.headers.authorization="Basic "+Buffer.from(s.auth).toString("base64")),v=r._req=l(s),r._redirects&&r.emit("redirect",r.url,v)}else v=r._req=l(s);s.timeout&&v.on("timeout",()=>{J(r,v,"Opening handshake has timed out")}),v.on("error",w=>{v===null||v[ba]||(v=r._req=null,yr(r,w))}),v.on("response",w=>{let L=w.headers.location,Y=w.statusCode;if(L&&s.followRedirects&&Y>=300&&Y<400){if(++r._redirects>s.maxRedirects){J(r,v,"Maximum redirects exceeded");return}v.abort();let X;try{X=new Rn(L,e)}catch{let me=new SyntaxError(`Invalid URL: ${L}`);yr(r,me);return}Sa(r,X,t,n)}else r.emit("unexpected-response",v,w)||J(r,v,`Unexpected server response: ${w.statusCode}`)}),v.on("upgrade",(w,L,Y)=>{if(r.emit("upgrade",w),r.readyState!==N.CONNECTING)return;v=r._req=null;let X=w.headers.upgrade;if(X===void 0||X.toLowerCase()!=="websocket"){J(r,L,"Invalid Upgrade header");return}let Ce=Ey("sha1").update(m+xy).digest("base64");if(w.headers["sec-websocket-accept"]!==Ce){J(r,L,"Invalid Sec-WebSocket-Accept header");return}let me=w.headers["sec-websocket-protocol"],we;if(me!==void 0?p.size?p.has(me)||(we="Server sent an invalid subprotocol"):we="Server sent a subprotocol but none was requested":p.size&&(we="Server sent no subprotocol"),we){J(r,L,we);return}me&&(r._protocol=me);let kt=w.headers["sec-websocket-extensions"];if(kt!==void 0){if(!_){J(r,L,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let Ke;try{Ke=Ay(kt)}catch{J(r,L,"Invalid Sec-WebSocket-Extensions header");return}let $t=Object.keys(Ke);if($t.length!==1||$t[0]!==Se.extensionName){J(r,L,"Server indicated an extension that was not requested");return}try{_.accept(Ke[Se.extensionName])}catch{J(r,L,"Invalid Sec-WebSocket-Extensions header");return}r._extensions[Se.extensionName]=_}r.setSocket(L,Y,{allowSynchronousEvents:s.allowSynchronousEvents,generateMask:s.generateMask,maxPayload:s.maxPayload,skipUTF8Validation:s.skipUTF8Validation})}),s.finishRequest?s.finishRequest(v,r):v.end()}function yr(r,e){r._readyState=N.CLOSING,r._errorEmitted=!0,r.emit("error",e),r.emitClose()}function qy(r){return r.path=r.socketPath,va.connect(r)}function Cy(r){return r.path=void 0,!r.servername&&r.servername!==""&&(r.servername=va.isIP(r.host)?"":r.host),gy.connect(r)}function J(r,e,t){r._readyState=N.CLOSING;let n=new Error(t);Error.captureStackTrace(n,J),e.setHeader?(e[ba]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(yr,r,n)):(e.destroy(n),e.once("error",r.emit.bind(r,"error")),e.once("close",r.emitClose.bind(r)))}function Ln(r,e,t){if(e){let n=wy(e)?e.size:Ly(e).length;r._socket?r._sender._bufferedBytes+=n:r._bufferedAmount+=n}if(t){let n=new Error(`WebSocket is not open: readyState ${r.readyState} (${de[r.readyState]})`);process.nextTick(t,n)}}function Ny(r,e){let t=this[B];t._closeFrameReceived=!0,t._closeMessage=e,t._closeCode=r,t._socket[B]!==void 0&&(t._socket.removeListener("data",gr),process.nextTick(wa,t._socket),r===1005?t.close():t.close(r,e))}function My(){let r=this[B];r.isPaused||r._socket.resume()}function jy(r){let e=this[B];e._socket[B]!==void 0&&(e._socket.removeListener("data",gr),process.nextTick(wa,e._socket),e.close(r[Ty])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r))}function ga(){this[B].emitClose()}function Dy(r,e){this[B].emit("message",r,e)}function Uy(r){let e=this[B];e._autoPong&&e.pong(r,!this._isServer,Ea),e.emit("ping",r)}function Wy(r){this[B].emit("pong",r)}function wa(r){r.resume()}function By(r){let e=this[B];e.readyState!==N.CLOSED&&(e.readyState===N.OPEN&&(e._readyState=N.CLOSING,xa(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r)))}function xa(r){r._closeTimer=setTimeout(r._socket.destroy.bind(r._socket),ky)}function Oa(){let r=this[B];this.removeListener("close",Oa),this.removeListener("data",gr),this.removeListener("end",Ta),r._readyState=N.CLOSING;let e;!this._readableState.endEmitted&&!r._closeFrameReceived&&!r._receiver._writableState.errorEmitted&&(e=r._socket.read())!==null&&r._receiver.write(e),r._receiver.end(),this[B]=void 0,clearTimeout(r._closeTimer),r._receiver._writableState.finished||r._receiver._writableState.errorEmitted?r.emitClose():(r._receiver.on("error",ga),r._receiver.on("finish",ga))}function gr(r){this[B]._receiver.write(r)||this.pause()}function Ta(){let r=this[B];r._readyState=N.CLOSING,r._receiver.end(),this.end()}function Ia(){let r=this[B];this.removeListener("error",Ia),this.on("error",Ea),r&&(r._readyState=N.CLOSING,this.destroy())}});var ka=O((Tv,La)=>{"use strict";var Ov=vr(),{Duplex:Fy}=W("stream");function Pa(r){r.emit("close")}function Gy(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Aa(r){this.removeListener("error",Aa),this.destroy(),this.listenerCount("error")===0&&this.emit("error",r)}function Vy(r,e){let t=!0,n=new Fy({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return r.on("message",function(i,o){let a=!o&&n._readableState.objectMode?i.toString():i;n.push(a)||r.pause()}),r.once("error",function(i){n.destroyed||(t=!1,n.destroy(i))}),r.once("close",function(){n.destroyed||n.push(null)}),n._destroy=function(s,i){if(r.readyState===r.CLOSED){i(s),process.nextTick(Pa,n);return}let o=!1;r.once("error",function(c){o=!0,i(c)}),r.once("close",function(){o||i(s),process.nextTick(Pa,n)}),t&&r.terminate()},n._final=function(s){if(r.readyState===r.CONNECTING){r.once("open",function(){n._final(s)});return}r._socket!==null&&(r._socket._writableState.finished?(s(),n._readableState.endEmitted&&n.destroy()):(r._socket.once("finish",function(){s()}),r.close()))},n._read=function(){r.isPaused&&r.resume()},n._write=function(s,i,o){if(r.readyState===r.CONNECTING){r.once("open",function(){n._write(s,i,o)});return}r.send(s,o)},n.on("end",Gy),n.on("error",Aa),n}La.exports=Vy});var qa=O((Iv,$a)=>{"use strict";var{tokenChars:zy}=Xe();function Xy(r){let e=new Set,t=-1,n=-1,s=0;for(s;s<r.length;s++){let o=r.charCodeAt(s);if(n===-1&&zy[o]===1)t===-1&&(t=s);else if(s!==0&&(o===32||o===9))n===-1&&t!==-1&&(n=s);else if(o===44){if(t===-1)throw new SyntaxError(`Unexpected character at index ${s}`);n===-1&&(n=s);let a=r.slice(t,n);if(e.has(a))throw new SyntaxError(`The "${a}" subprotocol is duplicated`);e.add(a),t=n=-1}else throw new SyntaxError(`Unexpected character at index ${s}`)}if(t===-1||n!==-1)throw new SyntaxError("Unexpected end of input");let i=r.slice(t,s);if(e.has(i))throw new SyntaxError(`The "${i}" subprotocol is duplicated`);return e.add(i),e}$a.exports={parse:Xy}});var Wa=O((Pv,Ua)=>{"use strict";var Hy=W("events"),Er=W("http"),{Duplex:Rv}=W("stream"),{createHash:Yy}=W("crypto"),Ca=In(),$e=Tt(),Jy=qa(),Zy=vr(),{GUID:Ky,kWebSocket:Qy}=fe(),eg=/^[+/0-9A-Za-z]{22}==$/,Na=0,Ma=1,Da=2,kn=class extends Hy{constructor(e,t){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:Zy,...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=Er.createServer((n,s)=>{let i=Er.STATUS_CODES[426];s.writeHead(426,{"Content-Length":i.length,"Content-Type":"text/plain"}),s.end(i)}),this._server.listen(e.port,e.host,e.backlog,t)):e.server&&(this._server=e.server),this._server){let n=this.emit.bind(this,"connection");this._removeListeners=tg(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(s,i,o)=>{this.handleUpgrade(s,i,o,n)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=Na}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===Da){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(At,this);return}if(e&&this.once("close",e),this._state!==Ma)if(this._state=Ma,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(At,this):process.nextTick(At,this);else{let t=this._server;this._removeListeners(),this._removeListeners=this._server=null,t.close(()=>{At(this)})}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf("?");if((t!==-1?e.url.slice(0,t):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,t,n,s){t.on("error",ja);let i=e.headers["sec-websocket-key"],o=e.headers.upgrade,a=+e.headers["sec-websocket-version"];if(e.method!=="GET"){qe(this,e,t,405,"Invalid HTTP method");return}if(o===void 0||o.toLowerCase()!=="websocket"){qe(this,e,t,400,"Invalid Upgrade header");return}if(i===void 0||!eg.test(i)){qe(this,e,t,400,"Missing or invalid Sec-WebSocket-Key header");return}if(a!==13&&a!==8){qe(this,e,t,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){Lt(t,400);return}let c=e.headers["sec-websocket-protocol"],f=new Set;if(c!==void 0)try{f=Jy.parse(c)}catch{qe(this,e,t,400,"Invalid Sec-WebSocket-Protocol header");return}let m=e.headers["sec-websocket-extensions"],l={};if(this.options.perMessageDeflate&&m!==void 0){let p=new $e(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let _=Ca.parse(m);_[$e.extensionName]&&(p.accept(_[$e.extensionName]),l[$e.extensionName]=p)}catch{qe(this,e,t,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let p={origin:e.headers[`${a===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(p,(_,v,w,L)=>{if(!_)return Lt(t,v||401,w,L);this.completeUpgrade(l,i,f,e,t,n,s)});return}if(!this.options.verifyClient(p))return Lt(t,401)}this.completeUpgrade(l,i,f,e,t,n,s)}completeUpgrade(e,t,n,s,i,o,a){if(!i.readable||!i.writable)return i.destroy();if(i[Qy])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Na)return Lt(i,503);let f=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${Yy("sha1").update(t+Ky).digest("base64")}`],m=new this.options.WebSocket(null,void 0,this.options);if(n.size){let l=this.options.handleProtocols?this.options.handleProtocols(n,s):n.values().next().value;l&&(f.push(`Sec-WebSocket-Protocol: ${l}`),m._protocol=l)}if(e[$e.extensionName]){let l=e[$e.extensionName].params,p=Ca.format({[$e.extensionName]:[l]});f.push(`Sec-WebSocket-Extensions: ${p}`),m._extensions=e}this.emit("headers",f,s),i.write(f.concat(`\r
|
|
5
|
+
`).join(`\r
|
|
6
|
+
`)),i.removeListener("error",ja),m.setSocket(i,o,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(m),m.on("close",()=>{this.clients.delete(m),this._shouldEmitClose&&!this.clients.size&&process.nextTick(At,this)})),a(m,s)}};Ua.exports=kn;function tg(r,e){for(let t of Object.keys(e))r.on(t,e[t]);return function(){for(let n of Object.keys(e))r.removeListener(n,e[n])}}function At(r){r._state=Da,r.emit("close")}function ja(){this.destroy()}function Lt(r,e,t,n){t=t||Er.STATUS_CODES[e],n={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(t),...n},r.once("finish",r.destroy),r.end(`HTTP/1.1 ${e} ${Er.STATUS_CODES[e]}\r
|
|
7
|
+
`+Object.keys(n).map(s=>`${s}: ${n[s]}`).join(`\r
|
|
8
|
+
`)+`\r
|
|
9
|
+
\r
|
|
10
|
+
`+t)}function qe(r,e,t,n,s,i){if(r.listenerCount("wsClientError")){let o=new Error(s);Error.captureStackTrace(o,qe),r.emit("wsClientError",o,t,e)}else Lt(t,n,s,i)}});var Fa=O((Av,Ba)=>{"use strict";var pe=vr();pe.createWebSocketStream=ka();pe.Server=Wa();pe.Receiver=Sn();pe.Sender=On();pe.WebSocket=pe;pe.WebSocketServer=pe.Server;Ba.exports=pe});var rg=O((Lv,Ga)=>{"use strict";Ga.exports=Fa()});export{mf as a,ld as b,Q as c,ro as d,xo as e,Oo as f,Io as g,bt as h,un as i,yp as j,wp as k,xp as l,M_ as m,rg as n};
|
|
11
|
+
/*! Bundled license information:
|
|
12
|
+
|
|
13
|
+
reflect-metadata/Reflect.js:
|
|
14
|
+
(*! *****************************************************************************
|
|
15
|
+
Copyright (C) Microsoft. All rights reserved.
|
|
16
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
17
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
18
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
19
|
+
|
|
20
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
21
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
22
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
23
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
24
|
+
|
|
25
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
26
|
+
and limitations under the License.
|
|
27
|
+
***************************************************************************** *)
|
|
28
|
+
*/
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
|
|
2
|
+
import{a as h,b as l,c as m}from"./chunk-JLT4XDAY.js";var k=class f{constructor(e){this.registeredClientSchemes=new Map,this.policies=[],this.registeredExtensions=new Map,this.beforePaymentCreationHooks=[],this.afterPaymentCreationHooks=[],this.onPaymentCreationFailureHooks=[],this.paymentRequirementsSelector=e||((r,t)=>t[0])}static fromConfig(e){let r=new f(e.paymentRequirementsSelector);return e.schemes.forEach(t=>{t.x402Version===1?r.registerV1(t.network,t.client):r.register(t.network,t.client)}),e.policies?.forEach(t=>{r.registerPolicy(t)}),r}register(e,r){return this._registerScheme(h,e,r)}registerV1(e,r){return this._registerScheme(1,e,r)}registerPolicy(e){return this.policies.push(e),this}registerExtension(e){return this.registeredExtensions.set(e.key,e),this}onBeforePaymentCreation(e){return this.beforePaymentCreationHooks.push(e),this}onAfterPaymentCreation(e){return this.afterPaymentCreationHooks.push(e),this}onPaymentCreationFailure(e){return this.onPaymentCreationFailureHooks.push(e),this}async createPaymentPayload(e){let r=this.registeredClientSchemes.get(e.x402Version);if(!r)throw new Error(`No client registered for x402 version: ${e.x402Version}`);let t=this.selectPaymentRequirements(e.x402Version,e.accepts),i={paymentRequired:e,selectedRequirements:t};for(let s of this.beforePaymentCreationHooks){let o=await s(i);if(o&&"abort"in o&&o.abort)throw new Error(`Payment creation aborted: ${o.reason}`)}try{let s=m(r,t.scheme,t.network);if(!s)throw new Error(`No client registered for scheme: ${t.scheme} and network: ${t.network}`);let o=await s.createPaymentPayload(e.x402Version,t,{extensions:e.extensions}),n;if(o.x402Version==1)n=o;else{let c=this.mergeExtensions(e.extensions,o.extensions);n={x402Version:o.x402Version,payload:o.payload,extensions:c,resource:e.resource,accepted:t}}n=await this.enrichPaymentPayloadWithExtensions(n,e);let a={...i,paymentPayload:n};for(let c of this.afterPaymentCreationHooks)await c(a);return n}catch(s){let o={...i,error:s};for(let n of this.onPaymentCreationFailureHooks){let a=await n(o);if(a&&"recovered"in a&&a.recovered)return a.payload}throw s}}mergeExtensions(e,r){if(!r)return e;if(!e)return r;let t={...e};for(let[i,s]of Object.entries(r)){let o=t[i];o&&typeof o=="object"&&s&&typeof s=="object"?t[i]={...o,...s}:t[i]=s}return t}async enrichPaymentPayloadWithExtensions(e,r){if(!r.extensions||this.registeredExtensions.size===0)return e;let t=e;for(let[i,s]of this.registeredExtensions)i in r.extensions&&s.enrichPaymentPayload&&(t=await s.enrichPaymentPayload(t,r));return t}selectPaymentRequirements(e,r){let t=this.registeredClientSchemes.get(e);if(!t)throw new Error(`No client registered for x402 version: ${e}`);let i=r.filter(o=>{let n=l(t,o.network);return n?n.has(o.scheme):!1});if(i.length===0)throw new Error(`No network/scheme registered for x402 version: ${e} which comply with the payment requirements. ${JSON.stringify({x402Version:e,paymentRequirements:r,x402Versions:Array.from(this.registeredClientSchemes.keys()),networks:Array.from(t.keys()),schemes:Array.from(t.values()).map(o=>Array.from(o.keys())).flat()})}`);let s=i;for(let o of this.policies)if(s=o(e,s),s.length===0)throw new Error(`All payment requirements were filtered out by policies for x402 version: ${e}`);return this.paymentRequirementsSelector(e,s)}_registerScheme(e,r,t){this.registeredClientSchemes.has(e)||this.registeredClientSchemes.set(e,new Map);let i=this.registeredClientSchemes.get(e);i.has(r)||i.set(r,new Map);let s=i.get(r);return s.has(t.scheme)||s.set(t.scheme,t),this}};export{k as a};
|