@libp2p/websockets 10.1.13-29797a5bb → 10.1.13-5b8813abc
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/index.min.js +1 -1
- package/dist/index.min.js.map +4 -4
- package/package.json +6 -6
package/dist/index.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PWebsockets = factory()}(typeof self !== 'undefined' ? self : this, function () {
|
|
2
|
-
"use strict";var Libp2PWebsockets=(()=>{var Tt=Object.defineProperty;var Fo=Object.getOwnPropertyDescriptor;var Wo=Object.getOwnPropertyNames;var qo=Object.prototype.hasOwnProperty;var D=(r,e)=>{for(var t in e)Tt(r,t,{get:e[t],enumerable:!0})},jo=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Wo(e))!qo.call(r,o)&&o!==t&&Tt(r,o,{get:()=>e[o],enumerable:!(n=Fo(e,o))||n.enumerable});return r};var Ho=r=>jo(Tt({},"__esModule",{value:!0}),r);var cc={};D(cc,{webSockets:()=>ac});var Qe=class extends Error{static name="ConnectionFailedError";constructor(e="Connection failed"){super(e),this.name="ConnectionFailedError"}};var Ge=class extends Error{static name="StreamResetError";constructor(e="The stream has been reset"){super(e),this.name="StreamResetError"}};var J=class extends Error{static name="StreamStateError";constructor(e="The stream is in an invalid state"){super(e),this.name="StreamStateError"}},Se=class extends Error{static name="StreamBufferError";constructor(e="The stream buffer was full"){super(e),this.name="StreamBufferError"}};var Je=class extends Event{data;constructor(e,t){super("message",t),this.data=e}},oe=class extends Event{error;local;constructor(e,t,n){super("close",n),this.error=t,this.local=e}},Xe=class extends oe{constructor(e,t){super(!0,e,t)}},Ke=class extends oe{constructor(e,t){super(!1,e,t)}};var en=Symbol.for("@libp2p/transport");var Zr;(function(r){r[r.FATAL_ALL=0]="FATAL_ALL",r[r.NO_FATAL=1]="NO_FATAL"})(Zr||(Zr={}));function Qo(r){return typeof r?.handleEvent=="function"}function Go(r){return(r!==!0&&r!==!1&&r?.once)??!1}var Ye=class extends EventTarget{#e=new Map;constructor(){super()}listenerCount(e){let t=this.#e.get(e);return t==null?0:t.length}addEventListener(e,t,n){let o=Go(n);super.addEventListener(e,i=>{if(o){let a=this.#e.get(i.type);a!=null&&(a=a.filter(({callback:c})=>c!==t),this.#e.set(i.type,a))}Qo(t)?t.handleEvent(i):t(i)},n);let s=this.#e.get(e);s==null&&(s=[],this.#e.set(e,s)),s.push({callback:t,once:o})}removeEventListener(e,t,n){super.removeEventListener(e.toString(),t??null,n);let o=this.#e.get(e);o!=null&&(o=o.filter(({callback:s})=>s!==t),this.#e.set(e,o))}safeDispatchEvent(e,t={}){return this.dispatchEvent(new CustomEvent(e,t))}};var tn=Symbol.for("@libp2p/service-capabilities");function rn(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}var Jo=Math.pow(2,7),Xo=Math.pow(2,14),Ko=Math.pow(2,21),Lt=Math.pow(2,28),It=Math.pow(2,35),Pt=Math.pow(2,42),Bt=Math.pow(2,49),P=128,M=127;function se(r){if(r<Jo)return 1;if(r<Xo)return 2;if(r<Ko)return 3;if(r<Lt)return 4;if(r<It)return 5;if(r<Pt)return 6;if(r<Bt)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function Ut(r,e,t=0){switch(se(r)){case 8:e[t++]=r&255|P,r/=128;case 7:e[t++]=r&255|P,r/=128;case 6:e[t++]=r&255|P,r/=128;case 5:e[t++]=r&255|P,r/=128;case 4:e[t++]=r&255|P,r>>>=7;case 3:e[t++]=r&255|P,r>>>=7;case 2:e[t++]=r&255|P,r>>>=7;case 1:{e[t++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return e}function Yo(r,e){let t=r[e],n=0;if(n+=t&M,t<P||(t=r[e+1],n+=(t&M)<<7,t<P)||(t=r[e+2],n+=(t&M)<<14,t<P)||(t=r[e+3],n+=(t&M)<<21,t<P)||(t=r[e+4],n+=(t&M)*Lt,t<P)||(t=r[e+5],n+=(t&M)*It,t<P)||(t=r[e+6],n+=(t&M)*Pt,t<P)||(t=r[e+7],n+=(t&M)*Bt,t<P))return n;throw new RangeError("Could not decode varint")}function Zo(r,e){let t=r.get(e),n=0;if(n+=t&M,t<P||(t=r.get(e+1),n+=(t&M)<<7,t<P)||(t=r.get(e+2),n+=(t&M)<<14,t<P)||(t=r.get(e+3),n+=(t&M)<<21,t<P)||(t=r.get(e+4),n+=(t&M)*Lt,t<P)||(t=r.get(e+5),n+=(t&M)*It,t<P)||(t=r.get(e+6),n+=(t&M)*Pt,t<P)||(t=r.get(e+7),n+=(t&M)*Bt,t<P))return n;throw new RangeError("Could not decode varint")}function Ot(r,e=0){return r instanceof Uint8Array?Yo(r,e):Zo(r,e)}function Ze(r=0){return new Uint8Array(r)}function De(r,e){e==null&&(e=r.reduce((o,s)=>o+s.length,0));let t=Ze(e),n=0;for(let o of r)t.set(o,n),n+=o.length;return t}var zt={};D(zt,{base10:()=>as});var Jc=new Uint8Array(0);function nn(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}function q(r){if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")}function on(r){return new TextEncoder().encode(r)}function sn(r){return new TextDecoder().decode(r)}function ts(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var o=0;o<r.length;o++){var s=r.charAt(o),i=s.charCodeAt(0);if(t[i]!==255)throw new TypeError(s+" is ambiguous");t[i]=o}var a=r.length,c=r.charAt(0),l=Math.log(a)/Math.log(256),d=Math.log(256)/Math.log(a);function p(u){if(u instanceof Uint8Array||(ArrayBuffer.isView(u)?u=new Uint8Array(u.buffer,u.byteOffset,u.byteLength):Array.isArray(u)&&(u=Uint8Array.from(u))),!(u instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(u.length===0)return"";for(var m=0,h=0,x=0,C=u.length;x!==C&&u[x]===0;)x++,m++;for(var y=(C-x)*d+1>>>0,S=new Uint8Array(y);x!==C;){for(var L=u[x],N=0,I=y-1;(L!==0||N<h)&&I!==-1;I--,N++)L+=256*S[I]>>>0,S[I]=L%a>>>0,L=L/a>>>0;if(L!==0)throw new Error("Non-zero carry");h=N,x++}for(var O=y-h;O!==y&&S[O]===0;)O++;for(var W=c.repeat(m);O<y;++O)W+=r.charAt(S[O]);return W}function g(u){if(typeof u!="string")throw new TypeError("Expected String");if(u.length===0)return new Uint8Array;var m=0;if(u[m]!==" "){for(var h=0,x=0;u[m]===c;)h++,m++;for(var C=(u.length-m)*l+1>>>0,y=new Uint8Array(C);u[m];){var S=t[u.charCodeAt(m)];if(S===255)return;for(var L=0,N=C-1;(S!==0||L<x)&&N!==-1;N--,L++)S+=a*y[N]>>>0,y[N]=S%256>>>0,S=S/256>>>0;if(S!==0)throw new Error("Non-zero carry");x=L,m++}if(u[m]!==" "){for(var I=C-x;I!==C&&y[I]===0;)I++;for(var O=new Uint8Array(h+(C-I)),W=h;I!==C;)O[W++]=y[I++];return O}}}function v(u){var m=g(u);if(m)return m;throw new Error(`Non-${e} character`)}return{encode:p,decodeUnsafe:g,decode:v}}var rs=ts,ns=rs,cn=ns;var _t=class{name;prefix;baseEncode;constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Nt=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,n){this.name=e,this.prefix=t;let o=t.codePointAt(0);if(o===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=o,this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return un(this,e)}},Rt=class{decoders;constructor(e){this.decoders=e}or(e){return un(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function un(r,e){return new Rt({...r.decoders??{[r.prefix]:r},...e.decoders??{[e.prefix]:e}})}var Mt=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,n,o){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new _t(e,t,n),this.decoder=new Nt(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function ie({name:r,prefix:e,encode:t,decode:n}){return new Mt(r,e,t,n)}function X({name:r,prefix:e,alphabet:t}){let{encode:n,decode:o}=cn(t,r);return ie({prefix:e,name:r,encode:n,decode:s=>q(o(s))})}function os(r,e,t,n){let o=r.length;for(;r[o-1]==="=";)--o;let s=new Uint8Array(o*t/8|0),i=0,a=0,c=0;for(let l=0;l<o;++l){let d=e[r[l]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);a=a<<t|d,i+=t,i>=8&&(i-=8,s[c++]=255&a>>i)}if(i>=t||(255&a<<8-i)!==0)throw new SyntaxError("Unexpected end of data");return s}function ss(r,e,t){let n=e[e.length-1]==="=",o=(1<<t)-1,s="",i=0,a=0;for(let c=0;c<r.length;++c)for(a=a<<8|r[c],i+=8;i>t;)i-=t,s+=e[o&a>>i];if(i!==0&&(s+=e[o&a<<t-i]),n)for(;(s.length*t&7)!==0;)s+="=";return s}function is(r){let e={};for(let t=0;t<r.length;++t)e[r[t]]=t;return e}function B({name:r,prefix:e,bitsPerChar:t,alphabet:n}){let o=is(n);return ie({prefix:e,name:r,encode(s){return ss(s,n,t)},decode(s){return os(s,o,t,r)}})}var as=X({prefix:"9",name:"base10",alphabet:"0123456789"});var kt={};D(kt,{base16:()=>cs,base16upper:()=>us});var cs=B({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),us=B({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Vt={};D(Vt,{base2:()=>fs});var fs=B({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var $t={};D($t,{base256emoji:()=>ms});var fn=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),ds=fn.reduce((r,e,t)=>(r[t]=e,r),[]),ls=fn.reduce((r,e,t)=>{let n=e.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${e}`);return r[n]=t,r},[]);function hs(r){return r.reduce((e,t)=>(e+=ds[t],e),"")}function ps(r){let e=[];for(let t of r){let n=t.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${t}`);let o=ls[n];if(o==null)throw new Error(`Non-base256emoji character: ${t}`);e.push(o)}return new Uint8Array(e)}var ms=ie({prefix:"\u{1F680}",name:"base256emoji",encode:hs,decode:ps});var Ft={};D(Ft,{base32:()=>K,base32hex:()=>xs,base32hexpad:()=>Es,base32hexpadupper:()=>vs,base32hexupper:()=>ys,base32pad:()=>gs,base32padupper:()=>ws,base32upper:()=>bs,base32z:()=>Cs});var K=B({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),bs=B({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),gs=B({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ws=B({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),xs=B({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ys=B({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Es=B({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),vs=B({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Cs=B({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Wt={};D(Wt,{base36:()=>Ae,base36upper:()=>Ss});var Ae=X({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Ss=X({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var qt={};D(qt,{base58btc:()=>$,base58flickr:()=>Ds});var $=X({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Ds=X({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Ht={};D(Ht,{base64:()=>As,base64pad:()=>Ts,base64url:()=>jt,base64urlpad:()=>Ls});var As=B({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Ts=B({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),jt=B({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Ls=B({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Qt={};D(Qt,{base8:()=>Is});var Is=B({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Gt={};D(Gt,{identity:()=>Ps});var Ps=ie({prefix:"\0",name:"identity",encode:r=>sn(r),decode:r=>on(r)});var du=new TextEncoder,lu=new TextDecoder;var Xt={};D(Xt,{identity:()=>Zs});var Os=hn,dn=128,_s=127,Ns=~_s,Rs=Math.pow(2,31);function hn(r,e,t){e=e||[],t=t||0;for(var n=t;r>=Rs;)e[t++]=r&255|dn,r/=128;for(;r&Ns;)e[t++]=r&255|dn,r>>>=7;return e[t]=r|0,hn.bytes=t-n+1,e}var Ms=Jt,zs=128,ln=127;function Jt(r,n){var t=0,n=n||0,o=0,s=n,i,a=r.length;do{if(s>=a)throw Jt.bytes=0,new RangeError("Could not decode varint");i=r[s++],t+=o<28?(i&ln)<<o:(i&ln)*Math.pow(2,o),o+=7}while(i>=zs);return Jt.bytes=s-n,t}var ks=Math.pow(2,7),Vs=Math.pow(2,14),$s=Math.pow(2,21),Fs=Math.pow(2,28),Ws=Math.pow(2,35),qs=Math.pow(2,42),js=Math.pow(2,49),Hs=Math.pow(2,56),Qs=Math.pow(2,63),Gs=function(r){return r<ks?1:r<Vs?2:r<$s?3:r<Fs?4:r<Ws?5:r<qs?6:r<js?7:r<Hs?8:r<Qs?9:10},Js={encode:Os,decode:Ms,encodingLength:Gs},Xs=Js,Te=Xs;function Le(r,e=0){return[Te.decode(r,e),Te.decode.bytes]}function ae(r,e,t=0){return Te.encode(r,e,t),e}function ce(r){return Te.encodingLength(r)}function fe(r,e){let t=e.byteLength,n=ce(r),o=n+ce(t),s=new Uint8Array(o+t);return ae(r,s,0),ae(t,s,n),s.set(e,o),new ue(r,t,e,s)}function pn(r){let e=q(r),[t,n]=Le(e),[o,s]=Le(e.subarray(n)),i=e.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new ue(t,o,i,e)}function mn(r,e){if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&nn(r.bytes,t.bytes)}}var ue=class{code;size;digest;bytes;constructor(e,t,n,o){this.code=e,this.size=t,this.digest=n,this.bytes=o}};var bn=0,Ks="identity",gn=q;function Ys(r,e){if(e?.truncate!=null&&e.truncate!==r.byteLength){if(e.truncate<0||e.truncate>r.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${r.byteLength}`);r=r.subarray(0,e.truncate)}return fe(bn,gn(r))}var Zs={code:bn,name:Ks,encode:gn,digest:Ys};var Zt={};D(Zt,{sha256:()=>ti,sha512:()=>ri});var ei=20;function Yt({name:r,code:e,encode:t,minDigestLength:n,maxDigestLength:o}){return new Kt(r,e,t,n,o)}var Kt=class{name;code;encode;minDigestLength;maxDigestLength;constructor(e,t,n,o,s){this.name=e,this.code=t,this.encode=n,this.minDigestLength=o??ei,this.maxDigestLength=s}digest(e,t){if(t?.truncate!=null){if(t.truncate<this.minDigestLength)throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);if(this.maxDigestLength!=null&&t.truncate>this.maxDigestLength)throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`)}if(e instanceof Uint8Array){let n=this.encode(e);return n instanceof Uint8Array?wn(n,this.code,t?.truncate):n.then(o=>wn(o,this.code,t?.truncate))}else throw Error("Unknown type, must be binary type")}};function wn(r,e,t){if(t!=null&&t!==r.byteLength){if(t>r.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${r.byteLength}`);r=r.subarray(0,t)}return fe(e,r)}function yn(r){return async e=>new Uint8Array(await crypto.subtle.digest(r,e))}var ti=Yt({name:"sha2-256",code:18,encode:yn("SHA-256")}),ri=Yt({name:"sha2-512",code:19,encode:yn("SHA-512")});function En(r,e){let{bytes:t,version:n}=r;return n===0?oi(t,er(r),e??$.encoder):si(t,er(r),e??K.encoder)}var vn=new WeakMap;function er(r){let e=vn.get(r);if(e==null){let t=new Map;return vn.set(r,t),t}return e}var de=class r{code;version;multihash;bytes;"/";constructor(e,t,n,o){this.code=t,this.version=e,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:t}=this;if(e!==Pe)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==ii)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,n=fe(e,t);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return r.equals(this,e)}static equals(e,t){let n=t;return n!=null&&e.code===n.code&&e.version===n.version&&mn(e.multihash,n.multihash)}toString(e){return En(this,e)}toJSON(){return{"/":En(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof r)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:o,multihash:s,bytes:i}=t;return new r(n,o,s,i??Cn(n,o,s.bytes))}else if(t[ai]===!0){let{version:n,multihash:o,code:s}=t,i=pn(o);return r.create(n,s,i)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==Pe)throw new Error(`Version 0 CID must use dag-pb (code: ${Pe}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let o=Cn(e,t,n.bytes);return new r(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,Pe,e)}static createV1(e,t){return r.create(1,e,t)}static decode(e){let[t,n]=r.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=r.inspectBytes(e),n=t.size-t.multihashSize,o=q(e.subarray(n,n+t.multihashSize));if(o.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=o.subarray(t.multihashSize-t.digestSize),i=new ue(t.multihashCode,t.digestSize,s,o);return[t.version===0?r.createV0(i):r.createV1(t.codec,i),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[p,g]=Le(e.subarray(t));return t+=g,p},o=n(),s=Pe;if(o===18?(o=0,t=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=t,a=n(),c=n(),l=t+c,d=l-i;return{version:o,codec:s,multihashCode:a,digestSize:c,multihashSize:d,size:l}}static parse(e,t){let[n,o]=ni(e,t),s=r.decode(o);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return er(s).set(n,e),s}};function ni(r,e){switch(r[0]){case"Q":{let t=e??$;return[$.prefix,t.decode(`${$.prefix}${r}`)]}case $.prefix:{let t=e??$;return[$.prefix,t.decode(r)]}case K.prefix:{let t=e??K;return[K.prefix,t.decode(r)]}case Ae.prefix:{let t=e??Ae;return[Ae.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}}function oi(r,e,t){let{prefix:n}=t;if(n!==$.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let o=e.get(n);if(o==null){let s=t.encode(r).slice(1);return e.set(n,s),s}else return o}function si(r,e,t){let{prefix:n}=t,o=e.get(n);if(o==null){let s=t.encode(r);return e.set(n,s),s}else return o}var Pe=112,ii=18;function Cn(r,e,t){let n=ce(r),o=n+ce(e),s=new Uint8Array(o+t.byteLength);return ae(r,s,0),ae(e,s,n),s.set(t,o),s}var ai=Symbol.for("@ipld/js-cid/CID");var Be={...Gt,...Vt,...Qt,...zt,...kt,...Ft,...Wt,...qt,...Ht,...$t},_u={...Zt,...Xt};function Dn(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var Sn=Dn("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),tr=Dn("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=Ze(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),ci={utf8:Sn,"utf-8":Sn,hex:Be.base16,latin1:tr,ascii:tr,binary:tr,...Be},tt=ci;function Ue(r,e="utf8"){let t=tt[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.decoder.decode(`${t.prefix}${r}`)}function ee(r,e="utf8"){let t=tt[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.encoder.encode(r).substring(1)}var R=class extends Error{static name="InvalidMultiaddrError";name="InvalidMultiaddrError"},j=class extends Error{static name="ValidationError";name="ValidationError"},rt=class extends Error{static name="InvalidParametersError";name="InvalidParametersError"},nt=class extends Error{static name="UnknownProtocolError";name="UnknownProtocolError"};var ot=class{index=0;input="";new(e){return this.index=0,this.input=e,this}readAtomically(e){let t=this.index,n=e();return n===void 0&&(this.index=t),n}parseWith(e){let t=e();if(this.index===this.input.length)return t}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(e){return this.readAtomically(()=>{let t=this.readChar();if(t===e)return t})}readSeparator(e,t,n){return this.readAtomically(()=>{if(!(t>0&&this.readGivenChar(e)===void 0))return n()})}readNumber(e,t,n,o){return this.readAtomically(()=>{let s=0,i=0,a=this.peekChar();if(a===void 0)return;let c=a==="0",l=2**(8*o)-1;for(;;){let d=this.readAtomically(()=>{let p=this.readChar();if(p===void 0)return;let g=Number.parseInt(p,e);if(!Number.isNaN(g))return g});if(d===void 0)break;if(s*=e,s+=d,s>l||(i+=1,t!==void 0&&i>t))return}if(i!==0)return!n&&c&&i>1?void 0:s})}readIPv4Addr(){return this.readAtomically(()=>{let e=new Uint8Array(4);for(let t=0;t<e.length;t++){let n=this.readSeparator(".",t,()=>this.readNumber(10,3,!1,1));if(n===void 0)return;e[t]=n}return e})}readIPv6Addr(){let e=t=>{for(let n=0;n<t.length/2;n++){let o=n*2;if(n<t.length-3){let i=this.readSeparator(":",n,()=>this.readIPv4Addr());if(i!==void 0)return t[o]=i[0],t[o+1]=i[1],t[o+2]=i[2],t[o+3]=i[3],[o+4,!0]}let s=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(s===void 0)return[o,!1];t[o]=s>>8,t[o+1]=s&255}return[t.length,!1]};return this.readAtomically(()=>{let t=new Uint8Array(16),[n,o]=e(t);if(n===16)return t;if(o||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let s=new Uint8Array(14),i=16-(n+2),[a]=e(s.subarray(0,i));return t.set(s.subarray(0,a),16-a),t})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var ui=45,fi=15,st=new ot;function An(r){if(!(r.length>fi))return st.new(r).parseWith(()=>st.readIPv4Addr())}function Tn(r){if(r.includes("%")&&(r=r.split("%")[0]),!(r.length>ui))return st.new(r).parseWith(()=>st.readIPv6Addr())}function it(r){return!!An(r)}function Ln(r){return!!Tn(r)}function nr(r){return e=>ee(e,r)}function or(r){return e=>Ue(e,r)}function le(r){return new DataView(r.buffer).getUint16(r.byteOffset).toString()}function te(r){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,typeof r=="string"?parseInt(r):r),new Uint8Array(e)}function In(r){let e=r.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==16)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion address.`);let t=Ue(e[0],"base32"),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=te(n);return De([t,o],t.length+o.length)}function Pn(r){let e=r.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==56)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion3 address.`);let t=K.decode(`b${e[0]}`),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=te(n);return De([t,o],t.length+o.length)}function sr(r){let e=r.subarray(0,r.length-2),t=r.subarray(r.length-2),n=ee(e,"base32"),o=le(t);return`${n}:${o}`}var ir=function(r){r=r.toString().trim();let e=new Uint8Array(4);return r.split(/\./g).forEach((t,n)=>{let o=parseInt(t,10);if(isNaN(o)||o<0||o>255)throw new R("Invalid byte value in IP address");e[n]=o}),e},Bn=function(r){let e=0;r=r.toString().trim();let t=r.split(":",8),n;for(n=0;n<t.length;n++){let s=it(t[n]),i;s&&(i=ir(t[n]),t[n]=ee(i.subarray(0,2),"base16")),i!=null&&++n<8&&t.splice(n,0,ee(i.subarray(2,4),"base16"))}if(t[0]==="")for(;t.length<8;)t.unshift("0");else if(t[t.length-1]==="")for(;t.length<8;)t.push("0");else if(t.length<8){for(n=0;n<t.length&&t[n]!=="";n++);let s=[n,1];for(n=9-t.length;n>0;n--)s.push("0");t.splice.apply(t,s)}let o=new Uint8Array(e+16);for(n=0;n<t.length;n++){t[n]===""&&(t[n]="0");let s=parseInt(t[n],16);if(isNaN(s)||s<0||s>65535)throw new R("Invalid byte value in IP address");o[e++]=s>>8&255,o[e++]=s&255}return o},Un=function(r){if(r.byteLength!==4)throw new R("IPv4 address was incorrect length");let e=[];for(let t=0;t<r.byteLength;t++)e.push(r[t]);return e.join(".")},On=function(r){if(r.byteLength!==16)throw new R("IPv6 address was incorrect length");let e=[];for(let n=0;n<r.byteLength;n+=2){let o=r[n],s=r[n+1],i=`${o.toString(16).padStart(2,"0")}${s.toString(16).padStart(2,"0")}`;e.push(i)}let t=e.join(":");try{let n=new URL(`http://[${t}]`);return n.hostname.substring(1,n.hostname.length-1)}catch{throw new R(`Invalid IPv6 address "${t}"`)}};function _n(r){try{let e=new URL(`http://[${r}]`);return e.hostname.substring(1,e.hostname.length-1)}catch{throw new R(`Invalid IPv6 address "${r}"`)}}var rr=Object.values(Be).map(r=>r.decoder),di=(function(){let r=rr[0].or(rr[1]);return rr.slice(2).forEach(e=>r=r.or(e)),r})();function Nn(r){return di.decode(r)}function Rn(r){return e=>r.encoder.encode(e)}function li(r){if(parseInt(r).toString()!==r)throw new j("Value must be an integer")}function hi(r){if(r<0)throw new j("Value must be a positive integer, or zero")}function pi(r){return e=>{if(e>r)throw new j(`Value must be smaller than or equal to ${r}`)}}function mi(...r){return e=>{for(let t of r)t(e)}}var Oe=mi(li,hi,pi(65535));var _=-1,ar=class{protocolsByCode=new Map;protocolsByName=new Map;getProtocol(e){let t;if(typeof e=="string"?t=this.protocolsByName.get(e):t=this.protocolsByCode.get(e),t==null)throw new nt(`Protocol ${e} was unknown`);return t}addProtocol(e){this.protocolsByCode.set(e.code,e),this.protocolsByName.set(e.name,e),e.aliases?.forEach(t=>{this.protocolsByName.set(t,e)})}removeProtocol(e){let t=this.protocolsByCode.get(e);t!=null&&(this.protocolsByCode.delete(t.code),this.protocolsByName.delete(t.name),t.aliases?.forEach(n=>{this.protocolsByName.delete(n)}))}},H=new ar,Ii=[{code:4,name:"ip4",size:32,valueToBytes:ir,bytesToValue:Un,validate:r=>{if(!it(r))throw new j(`Invalid IPv4 address "${r}"`)}},{code:6,name:"tcp",size:16,valueToBytes:te,bytesToValue:le,validate:Oe},{code:273,name:"udp",size:16,valueToBytes:te,bytesToValue:le,validate:Oe},{code:33,name:"dccp",size:16,valueToBytes:te,bytesToValue:le,validate:Oe},{code:41,name:"ip6",size:128,valueToBytes:Bn,bytesToValue:On,stringToValue:_n,validate:r=>{if(!Ln(r))throw new j(`Invalid IPv6 address "${r}"`)}},{code:42,name:"ip6zone",size:_},{code:43,name:"ipcidr",size:8,bytesToValue:nr("base10"),valueToBytes:or("base10")},{code:53,name:"dns",size:_},{code:54,name:"dns4",size:_},{code:55,name:"dns6",size:_},{code:56,name:"dnsaddr",size:_},{code:132,name:"sctp",size:16,valueToBytes:te,bytesToValue:le,validate:Oe},{code:301,name:"udt"},{code:302,name:"utp"},{code:400,name:"unix",size:_,stringToValue:r=>decodeURIComponent(r),valueToString:r=>encodeURIComponent(r)},{code:421,name:"p2p",aliases:["ipfs"],size:_,bytesToValue:nr("base58btc"),valueToBytes:r=>r.startsWith("Q")||r.startsWith("1")?or("base58btc")(r):de.parse(r).multihash.bytes},{code:444,name:"onion",size:96,bytesToValue:sr,valueToBytes:In},{code:445,name:"onion3",size:296,bytesToValue:sr,valueToBytes:Pn},{code:446,name:"garlic64",size:_},{code:447,name:"garlic32",size:_},{code:448,name:"tls"},{code:449,name:"sni",size:_},{code:454,name:"noise"},{code:460,name:"quic"},{code:461,name:"quic-v1"},{code:465,name:"webtransport"},{code:466,name:"certhash",size:_,bytesToValue:Rn(jt),valueToBytes:Nn},{code:480,name:"http"},{code:481,name:"http-path",size:_,stringToValue:r=>`/${decodeURIComponent(r)}`,valueToString:r=>encodeURIComponent(r.substring(1))},{code:443,name:"https"},{code:477,name:"ws"},{code:478,name:"wss"},{code:479,name:"p2p-websocket-star"},{code:277,name:"p2p-stardust"},{code:275,name:"p2p-webrtc-star"},{code:276,name:"p2p-webrtc-direct"},{code:280,name:"webrtc-direct"},{code:281,name:"webrtc"},{code:290,name:"p2p-circuit"},{code:777,name:"memory",size:_}];Ii.forEach(r=>{H.addProtocol(r)});function Mn(r){let e=[],t=0;for(;t<r.length;){let n=Ot(r,t),o=H.getProtocol(n),s=se(n),i=Pi(o,r,t+s),a=0;i>0&&o.size===_&&(a=se(i));let c=s+a+i,l={code:n,name:o.name,bytes:r.subarray(t,t+c)};if(i>0){let d=t+s+a,p=r.subarray(d,d+i);l.value=o.bytesToValue?.(p)??ee(p)}e.push(l),t+=c}return e}function zn(r){let e=0,t=[];for(let n of r){if(n.bytes==null){let o=H.getProtocol(n.code),s=se(n.code),i,a=0,c=0;n.value!=null&&(i=o.valueToBytes?.(n.value)??Ue(n.value),a=i.byteLength,o.size===_&&(c=se(a)));let l=new Uint8Array(s+c+a),d=0;Ut(n.code,l,d),d+=s,i!=null&&(o.size===_&&(Ut(a,l,d),d+=c),l.set(i,d)),n.bytes=l}t.push(n.bytes),e+=n.bytes.byteLength}return De(t,e)}function kn(r){if(r.charAt(0)!=="/")throw new R('String multiaddr must start with "/"');let e=[],t="protocol",n="",o="";for(let s=1;s<r.length;s++){let i=r.charAt(s);i!=="/"&&(t==="protocol"?o+=r.charAt(s):n+=r.charAt(s));let a=s===r.length-1;if(i==="/"||a){let c=H.getProtocol(o);if(t==="protocol"){if(c.size==null||c.size===0){e.push({code:c.code,name:c.name}),n="",o="",t="protocol";continue}else if(a)throw new R(`Component ${o} was missing value`);t="value"}else if(t==="value"){let l={code:c.code,name:c.name};if(c.size!=null&&c.size!==0){if(n==="")throw new R(`Component ${o} was missing value`);l.value=c.stringToValue?.(n)??n}e.push(l),n="",o="",t="protocol"}}}if(o!==""&&n!=="")throw new R("Incomplete multiaddr");return e}function Vn(r){return`/${r.flatMap(e=>{if(e.value==null)return e.name;let t=H.getProtocol(e.code);if(t==null)throw new R(`Unknown protocol code ${e.code}`);return[e.name,t.valueToString?.(e.value)??e.value]}).join("/")}`}function Pi(r,e,t){return r.size==null||r.size===0?0:r.size>0?r.size/8:Ot(e,t)}var Bi=Symbol.for("nodejs.util.inspect.custom"),xr=Symbol.for("@multiformats/multiaddr");function Ui(r){if(r==null&&(r="/"),$n(r))return r.getComponents();if(r instanceof Uint8Array)return Mn(r);if(typeof r=="string")return r=r.replace(/\/(\/)+/,"/").replace(/(\/)+$/,""),r===""&&(r="/"),kn(r);if(Array.isArray(r))return r;throw new R("Must be a string, Uint8Array, Component[], or another Multiaddr")}var lt=class r{[xr]=!0;#e;#t;#r;constructor(e="/",t={}){this.#e=Ui(e),t.validate!==!1&&Oi(this)}get bytes(){return this.#r==null&&(this.#r=zn(this.#e)),this.#r}toString(){return this.#t==null&&(this.#t=Vn(this.#e)),this.#t}toJSON(){return this.toString()}getComponents(){return[...this.#e.map(e=>({...e}))]}encapsulate(e){let t=new r(e);return new r([...this.#e,...t.getComponents()],{validate:!1})}decapsulate(e){let t=e.toString(),n=this.toString(),o=n.lastIndexOf(t);if(o<0)throw new rt(`Address ${this.toString()} does not contain subaddress: ${t}`);return new r(n.slice(0,o),{validate:!1})}decapsulateCode(e){let t;for(let n=this.#e.length-1;n>-1;n--)if(this.#e[n].code===e){t=n;break}return new r(this.#e.slice(0,t),{validate:!1})}equals(e){return rn(this.bytes,e.bytes)}[Bi](){return`Multiaddr(${this.toString()})`}};function Oi(r){r.getComponents().forEach(e=>{let t=H.getProtocol(e.code);e.value!=null&&t.validate?.(e.value)})}function $n(r){return!!r?.[xr]}function Fn(r){return new lt(r)}var A=r=>({match:e=>{let t=e[0];return t==null||t.code!==r||t.value!=null?!1:e.slice(1)}}),f=(r,e)=>({match:t=>{let n=t[0];return n?.code!==r||n.value==null||e!=null&&n.value!==e?!1:t.slice(1)}}),Wn=r=>({match:e=>r.match(e)===!1?e:!1}),b=r=>({match:e=>{let t=r.match(e);return t===!1?e:t}}),z=(...r)=>({match:e=>{let t;for(let n of r){let o=n.match(e);o!==!1&&(t==null||o.length<t.length)&&(t=o)}return t??!1}}),w=(...r)=>({match:e=>{for(let t of r){let n=t.match(e);if(n===!1)return!1;e=n}return e}});function T(...r){function e(o){if(o==null)return!1;let s=o.getComponents();for(let i of r){let a=i.match(s);if(a===!1)return!1;s=a}return s}function t(o){return e(o)!==!1}function n(o){let s=e(o);return s===!1?!1:s.length===0}return{matchers:r,matches:t,exactMatch:n}}var _i=f(421),Nf=T(_i),pt=f(54),mt=f(55),bt=f(56),Er=f(53),Rf=T(pt,b(f(421))),Mf=T(mt,b(f(421))),zf=T(bt,b(f(421))),kf=T(z(Er,bt,pt,mt),b(f(421))),qn=w(f(4),b(f(43))),jn=w(b(f(42)),f(41),b(f(43))),vr=z(qn,jn),me=z(vr,Er,pt,mt,bt),Vf=T(z(vr,w(z(Er,bt,pt,mt),b(f(421))))),$f=T(qn),Ff=T(jn),Wf=T(vr),Cr=w(me,f(6)),ke=w(me,f(273)),qf=T(w(Cr,b(f(421)))),jf=T(ke),Sr=w(ke,A(460),b(f(421))),gt=w(ke,A(461),b(f(421))),Ni=z(Sr,gt),Hf=T(Sr),Qf=T(gt),yr=z(me,Cr,ke,Sr,gt),Hn=z(w(yr,A(477),b(f(421)))),Qn=T(Hn),Gn=z(w(yr,A(478),b(f(421))),w(yr,A(448),b(f(449)),A(477),b(f(421)))),Jn=T(Gn),Xn=w(ke,A(280),b(f(466)),b(f(466)),b(f(421))),Gf=T(Xn),Kn=w(gt,A(465),b(f(466)),b(f(466)),b(f(421))),Jf=T(Kn),ht=z(Hn,Gn,w(Cr,b(f(421))),w(Ni,b(f(421))),w(me,b(f(421))),Xn,Kn,f(421)),Xf=T(ht),Ri=w(b(ht),A(290),Wn(A(281)),b(f(421))),Kf=T(Ri),Mi=z(w(ht,A(290),A(281),b(f(421))),w(ht,A(281),b(f(421))),w(A(281),b(f(421)))),Yf=T(Mi),zi=w(me,z(w(f(6,"80")),w(f(6),A(480)),A(480)),b(f(481)),b(f(421))),Zf=T(zi),ki=w(me,z(w(f(6,"443")),w(f(6,"443"),A(480)),w(f(6),A(443)),w(f(6),A(448),A(480)),w(A(448),A(480)),A(448),A(443)),b(f(481)),b(f(421))),ed=T(ki),Vi=z(w(f(777),b(f(421)))),td=T(Vi),$i=z(w(f(400),b(f(421)))),rd=T($i);var Fi=[6,53,56,54,55];function Yn(r){return to("sni",r)?.value}function Zn(r){let e=to("tcp",r)?.value;return e==null?"":`:${e}`}function to(r,e){return e.find(t=>t.name===r)}function eo(r){return r.some(({code:e})=>e===448)}function V(r,e){let t=ro[r.name];if(t==null)throw new Error(`Can't interpret protocol ${r.name}`);let n=t(r,e);return r.code===41?`[${n}]`:n}var ro={ip4:(r,e)=>r.value,ip6:(r,e)=>e.length===0?r.value:`[${r.value}]`,tcp:(r,e)=>{let t=e.pop();if(t==null)throw new Error("Unexpected end of multiaddr");return`tcp://${V(t,e)}:${r.value}`},udp:(r,e)=>{let t=e.pop();if(t==null)throw new Error("Unexpected end of multiaddr");return`udp://${V(t,e)}:${r.value}`},dnsaddr:(r,e)=>r.value,dns4:(r,e)=>r.value,dns6:(r,e)=>r.value,dns:(r,e)=>r.value,ipfs:(r,e)=>{let t=e.pop();if(t==null)throw new Error("Unexpected end of multiaddr");return`${V(t,e)}`},p2p:(r,e)=>{let t=e.pop();if(t==null)throw new Error("Unexpected end of multiaddr");return`${V(t,e)}`},http:(r,e)=>{let t=eo(e),n=Yn(e),o=Zn(e);if(t&&n!=null)return`https://${n}${o}`;let s=t?"https://":"http://",i=e.pop();if(i==null)throw new Error("Unexpected end of multiaddr");let a=V(i,e);return a=a?.replace("tcp://",""),`${s}${a}`},"http-path":(r,e)=>{let t=e.pop();if(t==null)throw new Error("Unexpected end of multiaddr");let n=V(t,e),o=decodeURIComponent(r.value??"");return`${n}${o}`},tls:(r,e)=>{let t=e.pop();if(t==null)throw new Error("Unexpected end of multiaddr");return V(t,e)},sni:(r,e)=>{let t=e.pop();if(t==null)throw new Error("Unexpected end of multiaddr");return V(t,e)},https:(r,e)=>{let t=e.pop();if(t==null)throw new Error("Unexpected end of multiaddr");let n=V(t,e);return n=n?.replace("tcp://",""),`https://${n}`},ws:(r,e)=>{let t=eo(e),n=Yn(e),o=Zn(e);if(t&&n!=null)return`wss://${n}${o}`;let s=t?"wss://":"ws://",i=e.pop();if(i==null)throw new Error("Unexpected end of multiaddr");let a=V(i,e);return a=a?.replace("tcp://",""),`${s}${a}`},wss:(r,e)=>{let t=e.pop();if(t==null)throw new Error("Unexpected end of multiaddr");let n=V(t,e);return n=n?.replace("tcp://",""),`wss://${n}`}};function no(r,e){let n=Fn(r).getComponents(),o=n.pop();if(o==null)throw new Error("Unexpected end of multiaddr");let s=ro[o.name];if(s==null)throw new Error(`No interpreter found for ${o.name}`);let i=s(o,n)??"";return e?.assumeHttp!==!1&&Fi.includes(o.code)&&(i=i.replace(/^.*:\/\//,""),o.value==="443"?i=`https://${i}`:i=`http://${i}`),(i.startsWith("http://")||i.startsWith("https://")||i.startsWith("ws://")||i.startsWith("wss://"))&&(i=new URL(i).toString(),i.endsWith("/")&&(i=i.substring(0,i.length-1))),i}var Dr=class r extends Error{name="TimeoutError";constructor(e,t){super(e,t),Error.captureStackTrace?.(this,r)}},oo=r=>r.reason??new DOMException("This operation was aborted.","AbortError");function Ar(r,e){let{milliseconds:t,fallback:n,message:o,customTimers:s={setTimeout,clearTimeout},signal:i}=e,a,c,d=new Promise((p,g)=>{if(typeof t!="number"||Math.sign(t)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(i?.aborted){g(oo(i));return}if(i&&(c=()=>{g(oo(i))},i.addEventListener("abort",c,{once:!0})),r.then(p,g),t===Number.POSITIVE_INFINITY)return;let v=new Dr;a=s.setTimeout.call(void 0,()=>{if(n){try{p(n())}catch(u){g(u)}return}typeof r.cancel=="function"&&r.cancel(),o===!1?p():o instanceof Error?g(o):(v.message=o??`Promise timed out after ${t} milliseconds`,g(v))},t)}).finally(()=>{d.clear(),c&&i&&i.removeEventListener("abort",c)});return d.clear=()=>{s.clearTimeout.call(void 0,a),a=void 0},d}var Wi=r=>{let e=r.addEventListener||r.on||r.addListener,t=r.removeEventListener||r.off||r.removeListener;if(!e||!t)throw new TypeError("Emitter is not compatible");return{addListener:e.bind(r),removeListener:t.bind(r)}};function qi(r,e,t){let n,o=new Promise((s,i)=>{if(t={rejectionEvents:["error"],multiArgs:!1,rejectionMultiArgs:!1,resolveImmediately:!1,...t},!(t.count>=0&&(t.count===Number.POSITIVE_INFINITY||Number.isInteger(t.count))))throw new TypeError("The `count` option should be at least 0 or more");t.signal?.throwIfAborted();let a=[e].flat(),c=[],{addListener:l,removeListener:d}=Wi(r),p=async(...v)=>{let u=t.multiArgs?v:v[0];if(t.filter)try{if(!await t.filter(u))return}catch(m){n(),i(m);return}c.push(u),t.count===c.length&&(n(),s(c))},g=(...v)=>{n(),i(t.rejectionMultiArgs?v:v[0])};n=()=>{for(let v of a)d(v,p);for(let v of t.rejectionEvents)a.includes(v)||d(v,g)};for(let v of a)l(v,p);for(let v of t.rejectionEvents)a.includes(v)||l(v,g);t.signal&&t.signal.addEventListener("abort",()=>{g(t.signal.reason)},{once:!0}),t.resolveImmediately&&s(c)});if(o.cancel=n,typeof t.timeout=="number"){let s=Ar(o,{milliseconds:t.timeout});return s.cancel=()=>{n(),s.clear()},s}return o}function Ve(r,e,t){typeof t=="function"&&(t={filter:t}),t={...t,count:1,resolveImmediately:!1};let n=qi(r,e,t),o=n.then(s=>s[0]);return o.cancel=n.cancel,o}var wt=class extends Event{type;detail;constructor(e,t){super(e),this.type=e,this.detail=t}};function so(){throw new Error("WebSocket Servers can not be created in the browser!")}function ji(r){return r.buffer instanceof ArrayBuffer}function io(r){return ji(r)?r:r.slice()}function Q(r=0){return new Uint8Array(r)}function $e(r=0){return new Uint8Array(r)}function Tr(r,e){e==null&&(e=r.reduce((o,s)=>o+s.length,0));let t=$e(e),n=0;for(let o of r)t.set(o,n),n+=o.length;return t}function ao(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}var uo=Symbol.for("@achingbrain/uint8arraylist");function co(r,e){if(e==null||e<0)throw new RangeError("index is out of bounds");let t=0;for(let n of r){let o=t+n.byteLength;if(e<o)return{buf:n,index:e-t};t=o}throw new RangeError("index is out of bounds")}function xt(r){return!!r?.[uo]}var be=class r{bufs;length;[uo]=!0;constructor(...e){this.bufs=[],this.length=0,e.length>0&&this.appendAll(e)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...e){this.appendAll(e)}appendAll(e){let t=0;for(let n of e)if(n instanceof Uint8Array)t+=n.byteLength,this.bufs.push(n);else if(xt(n)){t+=n.byteLength;for(let o of n.bufs)this.bufs.push(o)}else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=t}prepend(...e){this.prependAll(e)}prependAll(e){let t=0;for(let n of e.reverse())if(n instanceof Uint8Array)t+=n.byteLength,this.bufs.unshift(n);else if(xt(n))t+=n.byteLength,this.bufs.unshift(...n.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=t}get(e){let t=co(this.bufs,e);return t.buf[t.index]}set(e,t){let n=co(this.bufs,e);n.buf[n.index]=t}write(e,t=0){if(e instanceof Uint8Array)for(let n=0;n<e.length;n++)this.set(t+n,e[n]);else if(xt(e))for(let n=0;n<e.length;n++)this.set(t+n,e.get(n));else throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList")}consume(e){if(e=Math.trunc(e),!(Number.isNaN(e)||e<=0)){if(e===this.byteLength){this.bufs=[],this.length=0;return}for(;this.bufs.length>0;)if(e>=this.bufs[0].byteLength)e-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(e),this.length-=e;break}}}slice(e,t){let{bufs:n,length:o}=this._subList(e,t);return Tr(n,o)}subarray(e,t){let{bufs:n,length:o}=this._subList(e,t);return n.length===1?n[0]:Tr(n,o)}sublist(e,t){let{bufs:n,length:o}=this._subList(e,t),s=new r;return s.length=o,s.bufs=n,s}_subList(e,t){if(e=e??0,t=t??this.length,e<0&&(e=this.length+e),t<0&&(t=this.length+t),e<0||t>this.length)throw new RangeError("index is out of bounds");if(e===t)return{bufs:[],length:0};if(e===0&&t===this.length)return{bufs:[...this.bufs],length:this.length};let n=[],o=0;for(let s=0;s<this.bufs.length;s++){let i=this.bufs[s],a=o,c=a+i.byteLength;if(o=c,e>=c)continue;let l=e>=a&&e<c,d=t>a&&t<=c;if(l&&d){if(e===a&&t===c){n.push(i);break}let p=e-a;n.push(i.subarray(p,p+(t-e)));break}if(l){if(e===0){n.push(i);continue}n.push(i.subarray(e-a));continue}if(d){if(t===c){n.push(i);break}n.push(i.subarray(0,t-a));break}n.push(i)}return{bufs:n,length:t-e}}indexOf(e,t=0){if(!xt(e)&&!(e instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');let n=e instanceof Uint8Array?e:e.subarray();if(t=Number(t??0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),e.length===0)return t>this.length?this.length:t;let o=n.byteLength;if(o===0)throw new TypeError("search must be at least 1 byte long");let s=256,i=new Int32Array(s);for(let p=0;p<s;p++)i[p]=-1;for(let p=0;p<o;p++)i[n[p]]=p;let a=i,c=this.byteLength-n.byteLength,l=n.byteLength-1,d;for(let p=t;p<=c;p+=d){d=0;for(let g=l;g>=0;g--){let v=this.get(p+g);if(n[g]!==v){d=Math.max(1,g-a[v]);break}}if(d===0)return p}return-1}getInt8(e){let t=this.subarray(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getInt8(0)}setInt8(e,t){let n=$e(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt8(0,t),this.write(n,e)}getInt16(e,t){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt16(0,t)}setInt16(e,t,n){let o=Q(2);new DataView(o.buffer,o.byteOffset,o.byteLength).setInt16(0,t,n),this.write(o,e)}getInt32(e,t){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt32(0,t)}setInt32(e,t,n){let o=Q(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setInt32(0,t,n),this.write(o,e)}getBigInt64(e,t){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigInt64(0,t)}setBigInt64(e,t,n){let o=Q(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setBigInt64(0,t,n),this.write(o,e)}getUint8(e){let t=this.subarray(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getUint8(0)}setUint8(e,t){let n=$e(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint8(0,t),this.write(n,e)}getUint16(e,t){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint16(0,t)}setUint16(e,t,n){let o=Q(2);new DataView(o.buffer,o.byteOffset,o.byteLength).setUint16(0,t,n),this.write(o,e)}getUint32(e,t){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint32(0,t)}setUint32(e,t,n){let o=Q(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setUint32(0,t,n),this.write(o,e)}getBigUint64(e,t){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigUint64(0,t)}setBigUint64(e,t,n){let o=Q(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setBigUint64(0,t,n),this.write(o,e)}getFloat32(e,t){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat32(0,t)}setFloat32(e,t,n){let o=Q(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setFloat32(0,t,n),this.write(o,e)}getFloat64(e,t){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat64(0,t)}setFloat64(e,t,n){let o=Q(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setFloat64(0,t,n),this.write(o,e)}equals(e){if(e==null||!(e instanceof r)||e.bufs.length!==this.bufs.length)return!1;for(let t=0;t<this.bufs.length;t++)if(!ao(this.bufs[t],e.bufs[t]))return!1;return!0}static fromUint8Arrays(e,t){let n=new r;return n.bufs=e,t==null&&(t=e.reduce((o,s)=>o+s.byteLength,0)),n.length=t,n}};var Ur={};D(Ur,{base10:()=>Zi});var Cd=new Uint8Array(0);function fo(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}function G(r){if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return ne(r);if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return ne(new Uint8Array(r.buffer,r.byteOffset,r.byteLength));throw new Error("Unknown type, must be binary type")}function lo(r){return new TextEncoder().encode(r)}function ho(r){return new TextDecoder().decode(r)}function Hi(r){return r?.buffer instanceof ArrayBuffer}function ne(r){return Hi(r)?r:r.slice()}function Qi(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var o=0;o<r.length;o++){var s=r.charAt(o),i=s.charCodeAt(0);if(t[i]!==255)throw new TypeError(s+" is ambiguous");t[i]=o}var a=r.length,c=r.charAt(0),l=Math.log(a)/Math.log(256),d=Math.log(256)/Math.log(a);function p(u){if(u instanceof Uint8Array||(ArrayBuffer.isView(u)?u=new Uint8Array(u.buffer,u.byteOffset,u.byteLength):Array.isArray(u)&&(u=Uint8Array.from(u))),!(u instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(u.length===0)return"";for(var m=0,h=0,x=0,C=u.length;x!==C&&u[x]===0;)x++,m++;for(var y=(C-x)*d+1>>>0,S=new Uint8Array(y);x!==C;){for(var L=u[x],N=0,I=y-1;(L!==0||N<h)&&I!==-1;I--,N++)L+=256*S[I]>>>0,S[I]=L%a>>>0,L=L/a>>>0;if(L!==0)throw new Error("Non-zero carry");h=N,x++}for(var O=y-h;O!==y&&S[O]===0;)O++;for(var W=c.repeat(m);O<y;++O)W+=r.charAt(S[O]);return W}function g(u){if(typeof u!="string")throw new TypeError("Expected String");if(u.length===0)return new Uint8Array;var m=0;if(u[m]!==" "){for(var h=0,x=0;u[m]===c;)h++,m++;for(var C=(u.length-m)*l+1>>>0,y=new Uint8Array(C);u[m];){var S=t[u.charCodeAt(m)];if(S===255)return;for(var L=0,N=C-1;(S!==0||L<x)&&N!==-1;N--,L++)S+=a*y[N]>>>0,y[N]=S%256>>>0,S=S/256>>>0;if(S!==0)throw new Error("Non-zero carry");x=L,m++}if(u[m]!==" "){for(var I=C-x;I!==C&&y[I]===0;)I++;for(var O=new Uint8Array(h+(C-I)),W=h;I!==C;)O[W++]=y[I++];return O}}}function v(u){var m=g(u);if(m)return m;throw new Error(`Non-${e} character`)}return{encode:p,decodeUnsafe:g,decode:v}}var Gi=Qi,Ji=Gi,mo=Ji;var Lr=class{name;prefix;baseEncode;constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Ir=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,n){this.name=e,this.prefix=t;let o=t.codePointAt(0);if(o===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=o,this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return bo(this,e)}},Pr=class{decoders;constructor(e){this.decoders=e}or(e){return bo(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function bo(r,e){return new Pr({...r.decoders??{[r.prefix]:r},...e.decoders??{[e.prefix]:e}})}var Br=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,n,o){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new Lr(e,t,n),this.decoder=new Ir(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function ge({name:r,prefix:e,encode:t,decode:n}){return new Br(r,e,t,n)}function Z({name:r,prefix:e,alphabet:t}){let{encode:n,decode:o}=mo(t,r);return ge({prefix:e,name:r,encode:n,decode:s=>G(o(s))})}function Xi(r,e,t,n){let o=r.length;for(;r[o-1]==="=";)--o;let s=new Uint8Array(o*t/8|0),i=0,a=0,c=0;for(let l=0;l<o;++l){let d=e[r[l]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);a=a<<t|d,i+=t,i>=8&&(i-=8,s[c++]=255&a>>i)}if(i>=t||(255&a<<8-i)!==0)throw new SyntaxError("Unexpected end of data");return s}function Ki(r,e,t){let n=e[e.length-1]==="=",o=(1<<t)-1,s="",i=0,a=0;for(let c=0;c<r.length;++c)for(a=a<<8|r[c],i+=8;i>t;)i-=t,s+=e[o&a>>i];if(i!==0&&(s+=e[o&a<<t-i]),n)for(;(s.length*t&7)!==0;)s+="=";return s}function Yi(r){let e={};for(let t=0;t<r.length;++t)e[r[t]]=t;return e}function U({name:r,prefix:e,bitsPerChar:t,alphabet:n}){let o=Yi(n);return ge({prefix:e,name:r,encode(s){return Ki(s,n,t)},decode(s){return Xi(s,o,t,r)}})}var Zi=Z({prefix:"9",name:"base10",alphabet:"0123456789"});var Or={};D(Or,{base16:()=>ea,base16upper:()=>ta});var ea=U({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ta=U({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var _r={};D(_r,{base2:()=>ra});var ra=U({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Nr={};D(Nr,{base256emoji:()=>aa});var go=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),na=go.reduce((r,e,t)=>(r[t]=e,r),[]),oa=go.reduce((r,e,t)=>{let n=e.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${e}`);return r[n]=t,r},[]);function sa(r){return r.reduce((e,t)=>(e+=na[t],e),"")}function ia(r){let e=[];for(let t of r){let n=t.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${t}`);let o=oa[n];if(o==null)throw new Error(`Non-base256emoji character: ${t}`);e.push(o)}return new Uint8Array(e)}var aa=ge({prefix:"\u{1F680}",name:"base256emoji",encode:sa,decode:ia});var Rr={};D(Rr,{base32:()=>we,base32hex:()=>da,base32hexpad:()=>ha,base32hexpadupper:()=>pa,base32hexupper:()=>la,base32pad:()=>ua,base32padupper:()=>fa,base32upper:()=>ca,base32z:()=>ma});var we=U({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ca=U({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ua=U({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),fa=U({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),da=U({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),la=U({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),ha=U({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),pa=U({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),ma=U({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Mr={};D(Mr,{base36:()=>Fe,base36upper:()=>ba});var Fe=Z({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),ba=Z({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var zr={};D(zr,{base58btc:()=>F,base58flickr:()=>ga});var F=Z({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),ga=Z({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var kr={};D(kr,{base64:()=>wa,base64pad:()=>xa,base64url:()=>ya,base64urlpad:()=>Ea});var wa=U({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),xa=U({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),ya=U({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Ea=U({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Vr={};D(Vr,{base8:()=>va});var va=U({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var $r={};D($r,{identity:()=>Ca});var Ca=ge({prefix:"\0",name:"identity",encode:r=>ho(r),decode:r=>lo(r)});var kd=new TextEncoder,Vd=new TextDecoder;var Wr={};D(Wr,{identity:()=>Ha});var Aa=yo,wo=128,Ta=127,La=~Ta,Ia=Math.pow(2,31);function yo(r,e,t){e=e||[],t=t||0;for(var n=t;r>=Ia;)e[t++]=r&255|wo,r/=128;for(;r&La;)e[t++]=r&255|wo,r>>>=7;return e[t]=r|0,yo.bytes=t-n+1,e}var Pa=Fr,Ba=128,xo=127;function Fr(r,n){var t=0,n=n||0,o=0,s=n,i,a=r.length;do{if(s>=a)throw Fr.bytes=0,new RangeError("Could not decode varint");i=r[s++],t+=o<28?(i&xo)<<o:(i&xo)*Math.pow(2,o),o+=7}while(i>=Ba);return Fr.bytes=s-n,t}var Ua=Math.pow(2,7),Oa=Math.pow(2,14),_a=Math.pow(2,21),Na=Math.pow(2,28),Ra=Math.pow(2,35),Ma=Math.pow(2,42),za=Math.pow(2,49),ka=Math.pow(2,56),Va=Math.pow(2,63),$a=function(r){return r<Ua?1:r<Oa?2:r<_a?3:r<Na?4:r<Ra?5:r<Ma?6:r<za?7:r<ka?8:r<Va?9:10},Fa={encode:Aa,decode:Pa,encodingLength:$a},Wa=Fa,We=Wa;function qe(r,e=0){return[We.decode(r,e),We.decode.bytes]}function xe(r,e,t=0){return We.encode(r,e,t),e}function ye(r){return We.encodingLength(r)}function ve(r,e){let t=e.byteLength,n=ye(r),o=n+ye(t),s=new Uint8Array(o+t);return xe(r,s,0),xe(t,s,n),s.set(e,o),new Ee(r,t,e,s)}function Eo(r){let e=G(r),[t,n]=qe(e),[o,s]=qe(e.subarray(n)),i=e.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new Ee(t,o,i,e)}function vo(r,e){if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&fo(r.bytes,t.bytes)}}var Ee=class{code;size;digest;bytes;constructor(e,t,n,o){this.code=e,this.size=t,this.digest=ne(n),this.bytes=ne(o)}};var Co=0,qa="identity",So=G;function ja(r,e){if(e?.truncate!=null&&e.truncate!==r.byteLength){if(e.truncate<0||e.truncate>r.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${r.byteLength}`);r=r.subarray(0,e.truncate)}return ve(Co,So(r))}var Ha={code:Co,name:qa,encode:So,digest:ja};var Hr={};D(Hr,{sha256:()=>Ga,sha512:()=>Ja});var Qa=20;function jr({name:r,code:e,encode:t,minDigestLength:n,maxDigestLength:o}){return new qr(r,e,t,n,o)}var qr=class{name;code;encode;minDigestLength;maxDigestLength;constructor(e,t,n,o,s){this.name=e,this.code=t,this.encode=n,this.minDigestLength=o??Qa,this.maxDigestLength=s}digest(e,t){if(t?.truncate!=null){if(t.truncate<this.minDigestLength)throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);if(this.maxDigestLength!=null&&t.truncate>this.maxDigestLength)throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`)}if(e instanceof Uint8Array){let n=this.encode(e);return n instanceof Uint8Array?Do(n,this.code,t?.truncate):n.then(o=>Do(o,this.code,t?.truncate))}else throw Error("Unknown type, must be binary type")}};function Do(r,e,t){if(t!=null&&t!==r.byteLength){if(t>r.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${r.byteLength}`);r=r.subarray(0,t)}return ve(e,r)}function To(r){return async e=>new Uint8Array(await crypto.subtle.digest(r,e))}var Ga=jr({name:"sha2-256",code:18,encode:To("SHA-256")}),Ja=jr({name:"sha2-512",code:19,encode:To("SHA-512")});function Lo(r,e){let{bytes:t,version:n}=r;return n===0?Ka(t,Qr(r),e??F.encoder):Ya(t,Qr(r),e??we.encoder)}var Io=new WeakMap;function Qr(r){let e=Io.get(r);if(e==null){let t=new Map;return Io.set(r,t),t}return e}var Et=class r{code;version;multihash;bytes;"/";constructor(e,t,n,o){this.code=t,this.version=e,this.multihash=n,this.bytes=ne(o),this["/"]=this.bytes}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:t}=this;if(e!==He)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==Za)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,n=ve(e,t);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return r.equals(this,e)}static equals(e,t){let n=t;return n!=null&&e.code===n.code&&e.version===n.version&&vo(e.multihash,n.multihash)}toString(e){return Lo(this,e)}toJSON(){return{"/":Lo(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof r)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:o,multihash:s,bytes:i}=t;return new r(n,o,s,i??Po(n,o,s.bytes))}else if(t[ec]===!0){let{version:n,multihash:o,code:s}=t,i=Eo(o);return r.create(n,s,i)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==He)throw new Error(`Version 0 CID must use dag-pb (code: ${He}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let o=Po(e,t,n.bytes);return new r(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,He,e)}static createV1(e,t){return r.create(1,e,t)}static decode(e){let[t,n]=r.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=r.inspectBytes(e),n=t.size-t.multihashSize,o=G(e.subarray(n,n+t.multihashSize));if(o.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=o.subarray(t.multihashSize-t.digestSize),i=new Ee(t.multihashCode,t.digestSize,s,o);return[t.version===0?r.createV0(i):r.createV1(t.codec,i),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[p,g]=qe(e.subarray(t));return t+=g,p},o=n(),s=He;if(o===18?(o=0,t=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=t,a=n(),c=n(),l=t+c,d=l-i;return{version:o,codec:s,multihashCode:a,digestSize:c,multihashSize:d,size:l}}static parse(e,t){let[n,o]=Xa(e,t),s=r.decode(o);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Qr(s).set(n,e),s}};function Xa(r,e){switch(r[0]){case"Q":{let t=e??F;return[F.prefix,t.decode(`${F.prefix}${r}`)]}case F.prefix:{let t=e??F;return[F.prefix,t.decode(r)]}case we.prefix:{let t=e??we;return[we.prefix,t.decode(r)]}case Fe.prefix:{let t=e??Fe;return[Fe.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}}function Ka(r,e,t){let{prefix:n}=t;if(n!==F.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let o=e.get(n);if(o==null){let s=t.encode(r).slice(1);return e.set(n,s),s}else return o}function Ya(r,e,t){let{prefix:n}=t,o=e.get(n);if(o==null){let s=t.encode(r);return e.set(n,s),s}else return o}var He=112,Za=18;function Po(r,e,t){let n=ye(r),o=n+ye(e),s=new Uint8Array(o+t.byteLength);return xe(r,s,0),xe(e,s,n),s.set(t,o),s}var ec=Symbol.for("@ipld/js-cid/CID");var Gr={...$r,..._r,...Vr,...Ur,...Or,...Rr,...Mr,...zr,...kr,...Nr},cl={...Hr,...Wr};function Bo(r=0){return new Uint8Array(r)}function Oo(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var Uo=Oo("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Jr=Oo("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=Bo(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),tc={utf8:Uo,"utf-8":Uo,hex:Gr.base16,latin1:Jr,ascii:Jr,binary:Jr,...Gr},_o=tc;function No(r,e="utf8"){let t=_o[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.decoder.decode(`${t.prefix}${r}`)}function vt(){let r={};return r.promise=new Promise((e,t)=>{r.resolve=e,r.reject=t}),r}var Ct=class{buffer;mask;top;btm;next;constructor(e){if(!(e>0)||(e-1&e)!==0)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){let e=this.buffer[this.btm];if(e!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return this.buffer[this.btm]===void 0}},Ce=class{size;hwm;head;tail;constructor(e={}){this.hwm=e.splitLimit??16,this.head=new Ct(this.hwm),this.tail=this.head,this.size=0}calculateSize(e){return e?.byteLength!=null?e.byteLength:1}push(e){if(e?.value!=null&&(this.size+=this.calculateSize(e.value)),!this.head.push(e)){let t=this.head;this.head=t.next=new Ct(2*this.head.buffer.length),this.head.push(e)}}shift(){let e=this.tail.shift();if(e===void 0&&this.tail.next!=null){let t=this.tail.next;this.tail.next=null,this.tail=t,e=this.tail.shift()}return e?.value!=null&&(this.size-=this.calculateSize(e.value)),e}isEmpty(){return this.head.isEmpty()}};var Xr=class extends Error{type;code;constructor(e,t){super(e??"The operation was aborted"),this.type="aborted",this.code=t??"ABORT_ERR"}};function Ro(r={}){return rc(t=>{let n=t.shift();if(n==null)return{done:!0};if(n.error!=null)throw n.error;return{done:n.done===!0,value:n.value}},r)}function rc(r,e){e=e??{};let t=e.onEnd,n=new Ce,o,s,i,a=vt(),c=async()=>{try{return n.isEmpty()?i?{done:!0}:await new Promise((h,x)=>{s=C=>{s=null,n.push(C);try{h(r(n))}catch(y){x(y)}return o}}):r(n)}finally{n.isEmpty()&&queueMicrotask(()=>{a.resolve(),a=vt()})}},l=h=>s!=null?s(h):(n.push(h),o),d=h=>(n=new Ce,s!=null?s({error:h}):(n.push({error:h}),o)),p=h=>{if(i)return o;if(e?.objectMode!==!0&&h?.byteLength==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return l({done:!1,value:h})},g=h=>i?o:(i=!0,h!=null?d(h):l({done:!0})),v=()=>(n=new Ce,g(),{done:!0}),u=h=>(g(h),{done:!0});if(o={[Symbol.asyncIterator](){return this},next:c,return:v,throw:u,push:p,end:g,get readableLength(){return n.size},onEmpty:async h=>{let x=h?.signal;if(x?.throwIfAborted(),n.isEmpty())return;let C,y;x!=null&&(C=new Promise((S,L)=>{y=()=>{L(new Xr)},x.addEventListener("abort",y)}));try{await Promise.race([a.promise,C])}finally{y!=null&&x!=null&&x?.removeEventListener("abort",y)}}},t==null)return o;let m=o;return o={[Symbol.asyncIterator](){return this},next(){return m.next()},throw(h){return m.throw(h),t!=null&&(t(h),t=void 0),{done:!0}},return(){return m.return(),t!=null&&(t(),t=void 0),{done:!0}},push:p,end(h){return m.end(h),t!=null&&(t(h),t=void 0),o},get readableLength(){return m.readableLength},onEmpty:h=>m.onEmpty(h)},o}function Mo(r,e){let t,n=function(){let o=function(){t=void 0,r()};clearTimeout(t),t=setTimeout(o,e)};return n.start=()=>{},n.stop=()=>{clearTimeout(t)},n}var St=class extends Error{static name="StreamClosedError";name="StreamClosedError"};function nc(r){return r.reason}async function zo(r,e,t){if(e==null)return r;let n=t?.translateError??nc;if(e.aborted)return r.catch(()=>{}),Promise.reject(n(e));let o;try{return await Promise.race([r,new Promise((s,i)=>{o=()=>{i(n(e))},e.addEventListener("abort",o)})])}finally{o!=null&&e.removeEventListener("abort",o)}}var oc=Math.pow(2,20)*4,Dt=class extends Ye{status;timeline;inactivityTimeout;maxReadBufferLength;maxWriteBufferLength;log;direction;maxMessageSize;readStatus;writeStatus;remoteReadStatus;remoteWriteStatus;writableNeedsDrain;readBuffer;writeBuffer;sendingData;onDrainPromise;constructor(e){super(),this.status="open",this.log=e.log,this.direction=e.direction??"outbound",this.inactivityTimeout=e.inactivityTimeout??12e4,this.maxReadBufferLength=e.maxReadBufferLength??oc,this.maxWriteBufferLength=e.maxWriteBufferLength,this.maxMessageSize=e.maxMessageSize,this.readBuffer=new be,this.writeBuffer=new be,this.readStatus="readable",this.remoteReadStatus="readable",this.writeStatus="writable",this.remoteWriteStatus="writable",this.sendingData=!1,this.writableNeedsDrain=!1,this.timeline={open:Date.now()},this.processSendQueue=this.processSendQueue.bind(this);let t=()=>{this.writableNeedsDrain&&(this.log.trace("drain event received, continue sending data"),this.writableNeedsDrain=!1,queueMicrotask(()=>{try{this.processSendQueue()}catch(o){this.log.error("processSendQueue threw - %e",o)}})),this.onDrainPromise?.resolve()};this.addEventListener("drain",t);let n=o=>{this.onDrainPromise?.reject(o.error??new St)};this.addEventListener("close",n)}get readBufferLength(){return this.readBuffer.byteLength}get writeBufferLength(){return this.writeBuffer.byteLength}async onDrain(e){return this.writableNeedsDrain!==!0?Promise.resolve():(this.onDrainPromise==null&&(this.onDrainPromise=Promise.withResolvers()),zo(this.onDrainPromise.promise,e?.signal))}async*[Symbol.asyncIterator](){if(this.readStatus!=="readable"&&this.readStatus!=="paused")return;let e=Ro(),t=s=>{e.push(s.data)};this.addEventListener("message",t);let n=s=>{e.end(s.error)};this.addEventListener("close",n);let o=()=>{e.end()};this.addEventListener("remoteCloseWrite",o);try{yield*e}finally{this.removeEventListener("message",t),this.removeEventListener("close",n),this.removeEventListener("remoteCloseWrite",o)}}isReadable(){return this.status==="open"}send(e){if(this.writeStatus==="closed"||this.writeStatus==="closing")throw new J(`Cannot write to a stream that is ${this.writeStatus}`);return this.log.trace("append %d bytes to write buffer",e.byteLength),this.writeBuffer.append(e),this.processSendQueue()}abort(e){if(!(this.status==="aborted"||this.status==="reset"||this.status==="closed")){this.log.error("abort with error - %e",e),this.status="aborted",this.readBuffer.byteLength>0&&this.readBuffer.consume(this.readBuffer.byteLength),this.writeBuffer.byteLength>0&&(this.writeBuffer.consume(this.writeBuffer.byteLength),this.safeDispatchEvent("idle")),this.writeStatus="closed",this.remoteWriteStatus="closed",this.readStatus="closed",this.remoteReadStatus="closed",this.timeline.close=Date.now();try{this.sendReset(e)}catch(t){this.log("failed to send reset to remote - %e",t)}this.dispatchEvent(new Xe(e))}}pause(){if(this.readStatus==="closed"||this.readStatus==="closing")throw new J("Cannot pause a stream that is closing/closed");this.readStatus!=="paused"&&(this.readStatus="paused",this.sendPause())}resume(){if(this.readStatus==="closed"||this.readStatus==="closing")throw new J("Cannot resume a stream that is closing/closed");this.readStatus!=="readable"&&(this.readStatus="readable",this.dispatchReadBuffer(),this.sendResume())}push(e){if(this.readStatus==="closed"||this.readStatus==="closing")throw new J(`Cannot push data onto a stream that is ${this.readStatus}`);if(e.byteLength!==0){if(this.readBuffer.append(e),this.readStatus==="paused"||this.listenerCount("message")===0){this.checkReadBufferLength();return}setTimeout(()=>{this.dispatchReadBuffer()},0)}}unshift(e){if(this.readStatus==="closed"||this.readStatus==="closing")throw new J(`Cannot push data onto a stream that is ${this.readStatus}`);if(e.byteLength!==0){if(this.readBuffer.prepend(e),this.readStatus==="paused"||this.listenerCount("message")===0){this.checkReadBufferLength();return}setTimeout(()=>{this.dispatchReadBuffer()},0)}}onData(e){if(e.byteLength!==0){if(this.readStatus==="closing"||this.readStatus==="closed"){this.log("ignoring data - read status %s",this.readStatus);return}this.readBuffer.append(e),this.dispatchReadBuffer()}}addEventListener(...e){super.addEventListener.apply(this,e),e[0]==="message"&&this.readBuffer.byteLength>0&&queueMicrotask(()=>{this.dispatchReadBuffer()})}onRemoteReset(){this.log("remote reset"),this.status="reset",this.writeStatus="closed",this.remoteWriteStatus="closed",this.remoteReadStatus="closed",this.timeline.close=Date.now(),this.readBuffer.byteLength===0&&(this.readStatus="closed");let e=new Ge;this.dispatchEvent(new Ke(e))}onTransportClosed(e){this.log("transport closed"),this.readStatus==="readable"&&this.readBuffer.byteLength===0&&(this.log("close readable end after transport closed and read buffer is empty"),this.readStatus="closed"),this.remoteReadStatus!=="closed"&&(this.remoteReadStatus="closed"),this.remoteWriteStatus!=="closed"&&(this.remoteWriteStatus="closed"),this.writeStatus!=="closed"&&(this.writeStatus="closed"),e!=null?this.abort(e):(this.status==="open"||this.status==="closing")&&(this.timeline.close=Date.now(),this.status="closed",this.writeStatus="closed",this.remoteWriteStatus="closed",this.remoteReadStatus="closed",this.dispatchEvent(new oe))}onRemoteCloseWrite(){this.remoteWriteStatus!=="closed"&&(this.log.trace("on remote close write"),this.remoteWriteStatus="closed",this.safeDispatchEvent("remoteCloseWrite"),this.writeStatus==="closed"&&this.onTransportClosed())}onRemoteCloseRead(){this.log.trace("on remote close read"),this.remoteReadStatus="closed",this.writeBuffer.byteLength>0&&(this.writeBuffer.consume(this.writeBuffer.byteLength),this.safeDispatchEvent("idle"))}processSendQueue(){if(this.writableNeedsDrain)return this.log.trace("not processing send queue as drain is required"),this.checkWriteBufferLength(),!1;if(this.writeBuffer.byteLength===0)return this.log.trace("not processing send queue as no bytes to send"),!0;if(this.sendingData)return this.log.trace("not processing send queue as already sending data"),!0;if(this.writeStatus!=="writable"&&this.writeStatus!=="closing")return this.log.trace("not processing send queue as stream is %s",this.writeStatus),!1;this.sendingData=!0,this.log.trace("processing send queue with %d queued bytes",this.writeBuffer.byteLength);try{let e=!0,t=this.writeBuffer.byteLength,n=0;for(;this.writeBuffer.byteLength>0;){let o=Math.min(this.maxMessageSize??this.writeBuffer.byteLength,this.writeBuffer.byteLength);if(o===0){e=!1;break}let s=this.writeBuffer.sublist(0,o),i=new be(s);this.writeBuffer.consume(s.byteLength);let a=this.sendData(s);if(e=a.canSendMore,n+=a.sentBytes,a.sentBytes!==i.byteLength&&(i.consume(a.sentBytes),this.writeBuffer.prepend(i)),!e)break}return e||(this.log.trace("sent %d/%d bytes, pausing sending because underlying stream is full, %d bytes left in the write buffer",n,t,this.writeBuffer.byteLength),this.writableNeedsDrain=!0,this.checkWriteBufferLength()),this.writeBuffer.byteLength===0&&this.safeDispatchEvent("idle"),e}finally{this.sendingData=!1}}dispatchReadBuffer(){try{if(this.listenerCount("message")===0){this.log.trace("not dispatching pause buffer as there are no listeners for the message event");return}if(this.readBuffer.byteLength===0){this.log.trace("not dispatching pause buffer as there is no data to dispatch");return}if(this.readStatus==="paused"){this.log.trace("not dispatching pause buffer we are paused");return}if(this.readStatus==="closing"||this.readStatus==="closed"){this.log("dropping %d bytes because the readable end is %s",this.readBuffer.byteLength,this.readStatus),this.readBuffer.consume(this.readBuffer.byteLength);return}let e=this.readBuffer.sublist();this.readBuffer.consume(e.byteLength),this.dispatchEvent(new Je(e))}finally{this.readBuffer.byteLength===0&&this.remoteWriteStatus==="closed"&&(this.log("close readable end after dispatching read buffer and remote writable end is closed"),this.readStatus="closed"),this.checkReadBufferLength()}}checkReadBufferLength(){this.readBuffer.byteLength>this.maxReadBufferLength&&this.abort(new Se(`Read buffer length of ${this.readBuffer.byteLength} exceeded limit of ${this.maxReadBufferLength}, read status is ${this.readStatus}`))}checkWriteBufferLength(){this.maxWriteBufferLength!=null&&this.writeBuffer.byteLength>this.maxWriteBufferLength&&this.abort(new Se(`Write buffer length of ${this.writeBuffer.byteLength} exceeded limit of ${this.maxWriteBufferLength}, write status is ${this.writeStatus}`))}onMuxerNeedsDrain(){this.writableNeedsDrain=!0}onMuxerDrain(){this.safeDispatchEvent("drain")}};var At=class extends Dt{remoteAddr;metricPrefix;metrics;constructor(e){super(e),this.metricPrefix=e.metricPrefix??"",this.metrics=e.metrics,this.remoteAddr=e.remoteAddr,this.addEventListener("close",t=>{this.metrics?.increment({[`${this.metricPrefix}end`]:!0}),t.error!=null?t.local?this.metrics?.increment({[`${this.metricPrefix}abort`]:!0}):this.metrics?.increment({[`${this.metricPrefix}reset`]:!0}):t.local?this.metrics?.increment({[`${this.metricPrefix}_local_close`]:!0}):this.metrics?.increment({[`${this.metricPrefix}_remote_close`]:!0})})}async close(e){this.status==="open"&&(this.status="closing",this.writeStatus="closing",this.remoteWriteStatus="closing",this.remoteReadStatus="closing",(this.sendingData||this.writeBuffer.byteLength>0)&&(this.log("waiting for write queue to become idle before closing writable end of stream, %d unsent bytes",this.writeBuffer.byteLength),await Ve(this,"idle",{...e,rejectionEvents:["close"]})),this.writableNeedsDrain&&(this.log("waiting for write queue to drain before closing writable end of stream, %d unsent bytes",this.writeBuffer.byteLength),await Ve(this,"drain",{...e,rejectionEvents:["close"]})),await this.sendClose(e),this.onTransportClosed())}};function ko(r){let e=new globalThis.AbortController;function t(){let s=r.filter(i=>i?.aborted===!0).map(i=>i?.reason).pop();e.abort(s);for(let i of r)i?.removeEventListener!=null&&i.removeEventListener("abort",t)}for(let s of r){if(s?.aborted===!0){t();break}s?.addEventListener!=null&&s.addEventListener("abort",t)}function n(){for(let s of r)s?.removeEventListener!=null&&s.removeEventListener("abort",t)}let o=e.signal;return o.clear=n,o}function Vo(r,e,t){let n,o,s=!1;function i(){let l={signal:o.signal},d;t?.timeout!=null&&(d=ko([o.signal,AbortSignal.timeout(t.timeout)]),l.signal=d),s=!0,Promise.resolve().then(async()=>{await r(l)}).catch(()=>{}).finally(()=>{d!=null&&(d.aborted?d.clear():d.addEventListener("abort",()=>{d.clear()},{once:!0})),s=!1,!o.signal.aborted&&(n=setTimeout(i,e))})}let a=Mo(i,t?.debounce??100),c=!1;return{setInterval:l=>{e!==l&&(e=l,n!=null&&(clearTimeout(n),n=setTimeout(i,e)))},setTimeout:l=>{t??={},t.timeout=l},run:()=>{s||(clearTimeout(n),a())},start:()=>{c||(c=!0,o=new AbortController,o.signal,t?.runImmediately===!0?queueMicrotask(()=>{i()}):n=setTimeout(i,e))},stop:()=>{clearTimeout(n),o?.abort(),c=!1}}}var sc=1024*1024*4,ic=10,Kr=class extends At{websocket;maxBufferedAmount;checkBufferedAmountTask;constructor(e){super(e),this.websocket=e.websocket,this.maxBufferedAmount=e.maxBufferedAmount??sc,this.checkBufferedAmountTask=Vo(this.checkBufferedAmount.bind(this),e.bufferedAmountPollInterval??ic),this.websocket.addEventListener("close",t=>{if(this.log('closed - code %d, reason "%s", wasClean %s',t.code,t.reason,t.wasClean),this.checkBufferedAmountTask.stop(),!t.wasClean){this.onRemoteReset();return}this.onTransportClosed()},{once:!0}),this.websocket.addEventListener("message",t=>{try{let n;if(typeof t.data=="string")n=No(t.data);else if(t.data instanceof ArrayBuffer)n=new Uint8Array(t.data,0,t.data.byteLength);else{this.abort(new Error("Incorrect binary type"));return}this.onData(n)}catch(n){this.log.error("error receiving data - %e",n)}})}sendData(e){for(let n of e)this.websocket.send(io(n));let t=this.websocket.bufferedAmount<this.maxBufferedAmount;return t||this.checkBufferedAmountTask.start(),{sentBytes:e.byteLength,canSendMore:t}}sendReset(){this.websocket.close(1006)}async sendClose(e){this.websocket.close(),e?.signal?.throwIfAborted()}sendPause(){}sendResume(){}checkBufferedAmount(){this.log("buffered amount now %d",this.websocket.bufferedAmount),this.websocket.bufferedAmount===0&&(this.checkBufferedAmountTask.stop(),this.safeDispatchEvent("drain"))}};function $o(r){return new Kr(r)}var Yr=class{log;init;logger;metrics;components;constructor(e,t={}){this.log=e.logger.forComponent("libp2p:websockets"),this.logger=e.logger,this.components=e,this.init=t,e.metrics!=null&&(this.metrics={dialerEvents:e.metrics.registerCounterGroup("libp2p_websockets_dialer_events_total",{label:"event",help:"Total count of WebSockets dialer events by type"})})}[en]=!0;[Symbol.toStringTag]="@libp2p/websockets";[tn]=["@libp2p/transport"];async dial(e,t){this.log("dialing %s",e),t=t??{};let n=$o({websocket:await this._connect(e,t),remoteAddr:e,metrics:this.metrics?.dialerEvents,direction:"outbound",log:this.components.logger.forComponent("libp2p:websockets:connection"),maxBufferedAmount:this.init.maxBufferedAmount,bufferedAmountPollInterval:this.init.bufferedAmountPollInterval});this.log("new outbound connection %s",n.remoteAddr);let o=await t.upgrader.upgradeOutbound(n,t);return this.log("outbound connection %s upgraded",n.remoteAddr),o}async _connect(e,t){t?.signal?.throwIfAborted();let n=no(e);this.log("create websocket connection to %s",n);let o=new WebSocket(n);o.binaryType="arraybuffer";try{t.onProgress?.(new wt("websockets:open-connection")),await Ve(o,"open",t)}catch(s){if(t.signal?.aborted)throw this.metrics?.dialerEvents.increment({abort:!0}),new Qe(`Could not connect to ${n}`);this.metrics?.dialerEvents.increment({error:!0});try{o.close()}catch{}throw s}return this.log("connected %s",e),this.metrics?.dialerEvents.increment({connect:!0}),o}createListener(e){return so({logger:this.logger,events:this.components.events,metrics:this.components.metrics},{...this.init,...e})}listenFilter(e){return e.filter(t=>Qn.exactMatch(t)||Jn.exactMatch(t))}dialFilter(e){return this.listenFilter(e)}};function ac(r={}){return e=>new Yr(e,r)}return Ho(cc);})();
|
|
2
|
+
"use strict";var Libp2PWebsockets=(()=>{var lt=Object.defineProperty;var _n=Object.getOwnPropertyDescriptor;var On=Object.getOwnPropertyNames;var Un=Object.prototype.hasOwnProperty;var O=(r,e)=>{for(var t in e)lt(r,t,{get:e[t],enumerable:!0})},Nn=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of On(e))!Un.call(r,o)&&o!==t&<(r,o,{get:()=>e[o],enumerable:!(n=_n(e,o))||n.enumerable});return r};var Rn=r=>Nn(lt({},"__esModule",{value:!0}),r);var qs={};O(qs,{webSockets:()=>js});var Ue=class extends Error{static name="ConnectionFailedError";constructor(e="Connection failed"){super(e),this.name="ConnectionFailedError"}};var Ne=class extends Error{static name="StreamResetError";constructor(e="The stream has been reset"){super(e),this.name="StreamResetError"}};var q=class extends Error{static name="StreamStateError";constructor(e="The stream is in an invalid state"){super(e),this.name="StreamStateError"}},be=class extends Error{static name="StreamBufferError";constructor(e="The stream buffer was full"){super(e),this.name="StreamBufferError"}};var Re=class extends Event{data;constructor(e,t){super("message",t),this.data=e}},te=class extends Event{error;local;constructor(e,t,n){super("close",n),this.error=t,this.local=e}},Me=class extends te{constructor(e,t){super(!0,e,t)}},ke=class extends te{constructor(e,t){super(!1,e,t)}};var wr=Symbol.for("@libp2p/transport");var gr;(function(r){r[r.FATAL_ALL=0]="FATAL_ALL",r[r.NO_FATAL=1]="NO_FATAL"})(gr||(gr={}));function Mn(r){return typeof r?.handleEvent=="function"}function kn(r){return(r!==!0&&r!==!1&&r?.once)??!1}var Ve=class extends EventTarget{#e=new Map;constructor(){super()}listenerCount(e){let t=this.#e.get(e);return t==null?0:t.length}addEventListener(e,t,n){let o=kn(n);super.addEventListener(e,i=>{if(o){let a=this.#e.get(i.type);a!=null&&(a=a.filter(({callback:c})=>c!==t),this.#e.set(i.type,a))}Mn(t)?t.handleEvent(i):t(i)},n);let s=this.#e.get(e);s==null&&(s=[],this.#e.set(e,s)),s.push({callback:t,once:o})}removeEventListener(e,t,n){super.removeEventListener(e.toString(),t??null,n);let o=this.#e.get(e);o!=null&&(o=o.filter(({callback:s})=>s!==t),this.#e.set(e,o))}safeDispatchEvent(e,t={}){return this.dispatchEvent(new CustomEvent(e,t))}};var xr=Symbol.for("@libp2p/service-capabilities");function ht(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}function K(r=0){return new Uint8Array(r)}var Vn=Math.pow(2,7),$n=Math.pow(2,14),Fn=Math.pow(2,21),dt=Math.pow(2,28),pt=Math.pow(2,35),mt=Math.pow(2,42),bt=Math.pow(2,49),C=128,I=127;function re(r){if(r<Vn)return 1;if(r<$n)return 2;if(r<Fn)return 3;if(r<dt)return 4;if(r<pt)return 5;if(r<mt)return 6;if(r<bt)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function gt(r,e,t=0){switch(re(r)){case 8:e[t++]=r&255|C,r/=128;case 7:e[t++]=r&255|C,r/=128;case 6:e[t++]=r&255|C,r/=128;case 5:e[t++]=r&255|C,r/=128;case 4:e[t++]=r&255|C,r>>>=7;case 3:e[t++]=r&255|C,r>>>=7;case 2:e[t++]=r&255|C,r>>>=7;case 1:{e[t++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return e}function zn(r,e){let t=r[e],n=0;if(n+=t&I,t<C||(t=r[e+1],n+=(t&I)<<7,t<C)||(t=r[e+2],n+=(t&I)<<14,t<C)||(t=r[e+3],n+=(t&I)<<21,t<C)||(t=r[e+4],n+=(t&I)*dt,t<C)||(t=r[e+5],n+=(t&I)*pt,t<C)||(t=r[e+6],n+=(t&I)*mt,t<C)||(t=r[e+7],n+=(t&I)*bt,t<C))return n;throw new RangeError("Could not decode varint")}function Wn(r,e){let t=r.get(e),n=0;if(n+=t&I,t<C||(t=r.get(e+1),n+=(t&I)<<7,t<C)||(t=r.get(e+2),n+=(t&I)<<14,t<C)||(t=r.get(e+3),n+=(t&I)<<21,t<C)||(t=r.get(e+4),n+=(t&I)*dt,t<C)||(t=r.get(e+5),n+=(t&I)*pt,t<C)||(t=r.get(e+6),n+=(t&I)*mt,t<C)||(t=r.get(e+7),n+=(t&I)*bt,t<C))return n;throw new RangeError("Could not decode varint")}function wt(r,e=0){return r instanceof Uint8Array?zn(r,e):Wn(r,e)}function qn(r){return r.buffer instanceof ArrayBuffer}function ge(r){return qn(r)?r:r.slice()}function Hn(r){return r?.buffer instanceof ArrayBuffer}function xt(r){if(Hn(r))return r;let e=r.slice();return new Uint8Array(e.buffer,0,e.byteLength)}function ne(r,e){e==null&&(e=r.reduce((o,s)=>o+s.length,0));let t=K(e),n=0;for(let o of r)t.set(o,n),n+=o.length;return xt(t)}var St={};O(St,{base10:()=>eo});var Ni=new Uint8Array(0);function yr(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}function $(r){if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return Y(r);if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return Y(new Uint8Array(r.buffer,r.byteOffset,r.byteLength));throw new Error("Unknown type, must be binary type")}function Er(r){return new TextEncoder().encode(r)}function vr(r){return new TextDecoder().decode(r)}function Qn(r){return r?.buffer instanceof ArrayBuffer}function Y(r){return Qn(r)?r:r.slice()}function Gn(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var o=0;o<r.length;o++){var s=r.charAt(o),i=s.charCodeAt(0);if(t[i]!==255)throw new TypeError(s+" is ambiguous");t[i]=o}var a=r.length,c=r.charAt(0),l=Math.log(a)/Math.log(256),f=Math.log(256)/Math.log(a);function h(m){if(m instanceof Uint8Array||(ArrayBuffer.isView(m)?m=new Uint8Array(m.buffer,m.byteOffset,m.byteLength):Array.isArray(m)&&(m=Uint8Array.from(m))),!(m instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(m.length===0)return"";for(var v=0,p=0,D=0,B=m.length;D!==B&&m[D]===0;)D++,v++;for(var L=(B-D)*f+1>>>0,_=new Uint8Array(L);D!==B;){for(var U=m[D],j=0,N=L-1;(U!==0||j<p)&&N!==-1;N--,j++)U+=256*_[N]>>>0,_[N]=U%a>>>0,U=U/a>>>0;if(U!==0)throw new Error("Non-zero carry");p=j,D++}for(var V=L-p;V!==L&&_[V]===0;)V++;for(var Oe=c.repeat(v);V<L;++V)Oe+=r.charAt(_[V]);return Oe}function g(m){if(typeof m!="string")throw new TypeError("Expected String");if(m.length===0)return new Uint8Array;var v=0;if(m[v]!==" "){for(var p=0,D=0;m[v]===c;)p++,v++;for(var B=(m.length-v)*l+1>>>0,L=new Uint8Array(B);m[v];){var _=t[m.charCodeAt(v)];if(_===255)return;for(var U=0,j=B-1;(_!==0||U<D)&&j!==-1;j--,U++)_+=a*L[j]>>>0,L[j]=_%256>>>0,_=_/256>>>0;if(_!==0)throw new Error("Non-zero carry");D=U,v++}if(m[v]!==" "){for(var N=B-D;N!==B&&L[N]===0;)N++;for(var V=new Uint8Array(p+(B-N)),Oe=p;N!==B;)V[Oe++]=L[N++];return V}}}function x(m){var v=g(m);if(v)return v;throw new Error(`Non-${e} character`)}return{encode:h,decodeUnsafe:g,decode:x}}var Xn=Gn,Jn=Xn,Sr=Jn;var yt=class{name;prefix;baseEncode;constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Et=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,n){this.name=e,this.prefix=t;let o=t.codePointAt(0);if(o===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=o,this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Dr(this,e)}},vt=class{decoders;constructor(e){this.decoders=e}or(e){return Dr(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function Dr(r,e){return new vt({...r.decoders??{[r.prefix]:r},...e.decoders??{[e.prefix]:e}})}var Ct=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,n,o){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new yt(e,t,n),this.decoder=new Et(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function oe({name:r,prefix:e,encode:t,decode:n}){return new Ct(r,e,t,n)}function H({name:r,prefix:e,alphabet:t}){let{encode:n,decode:o}=Sr(t,r);return oe({prefix:e,name:r,encode:n,decode:s=>$(o(s))})}function Kn(r,e,t,n){let o=r.length;for(;r[o-1]==="=";)--o;let s=new Uint8Array(o*t/8|0),i=0,a=0,c=0;for(let l=0;l<o;++l){let f=e[r[l]];if(f===void 0)throw new SyntaxError(`Non-${n} character`);a=a<<t|f,i+=t,i>=8&&(i-=8,s[c++]=255&a>>i)}if(i>=t||(255&a<<8-i)!==0)throw new SyntaxError("Unexpected end of data");return s}function Yn(r,e,t){let n=e[e.length-1]==="=",o=(1<<t)-1,s="",i=0,a=0;for(let c=0;c<r.length;++c)for(a=a<<8|r[c],i+=8;i>t;)i-=t,s+=e[o&a>>i];if(i!==0&&(s+=e[o&a<<t-i]),n)for(;(s.length*t&7)!==0;)s+="=";return s}function Zn(r){let e={};for(let t=0;t<r.length;++t)e[r[t]]=t;return e}function S({name:r,prefix:e,bitsPerChar:t,alphabet:n}){let o=Zn(n);return oe({prefix:e,name:r,encode(s){return Yn(s,n,t)},decode(s){return Kn(s,o,t,r)}})}var eo=H({prefix:"9",name:"base10",alphabet:"0123456789"});var Dt={};O(Dt,{base16:()=>to,base16upper:()=>ro});var to=S({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ro=S({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Tt={};O(Tt,{base2:()=>no});var no=S({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Lt={};O(Lt,{base256emoji:()=>co});var Tr=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),oo=Tr.reduce((r,e,t)=>(r[t]=e,r),[]),so=Tr.reduce((r,e,t)=>{let n=e.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${e}`);return r[n]=t,r},[]);function io(r){return r.reduce((e,t)=>(e+=oo[t],e),"")}function ao(r){let e=[];for(let t of r){let n=t.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${t}`);let o=so[n];if(o==null)throw new Error(`Non-base256emoji character: ${t}`);e.push(o)}return new Uint8Array(e)}var co=oe({prefix:"\u{1F680}",name:"base256emoji",encode:io,decode:ao});var At={};O(At,{base32:()=>Q,base32hex:()=>ho,base32hexpad:()=>mo,base32hexpadupper:()=>bo,base32hexupper:()=>po,base32pad:()=>fo,base32padupper:()=>lo,base32upper:()=>uo,base32z:()=>go});var Q=S({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),uo=S({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),fo=S({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),lo=S({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ho=S({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),po=S({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),mo=S({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),bo=S({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),go=S({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var It={};O(It,{base36:()=>we,base36upper:()=>wo});var we=H({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),wo=H({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Pt={};O(Pt,{base58btc:()=>k,base58flickr:()=>xo});var k=H({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),xo=H({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var _t={};O(_t,{base64:()=>yo,base64pad:()=>Eo,base64url:()=>Bt,base64urlpad:()=>vo});var yo=S({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Eo=S({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Bt=S({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),vo=S({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Ot={};O(Ot,{base8:()=>Co});var Co=S({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Ut={};O(Ut,{identity:()=>So});var So=oe({prefix:"\0",name:"identity",encode:r=>vr(r),decode:r=>Er(r)});var Ki=new TextEncoder,Yi=new TextDecoder;var Rt={};O(Rt,{identity:()=>Qo});var Lo=Ir,Lr=128,Ao=127,Io=~Ao,Po=Math.pow(2,31);function Ir(r,e,t){e=e||[],t=t||0;for(var n=t;r>=Po;)e[t++]=r&255|Lr,r/=128;for(;r&Io;)e[t++]=r&255|Lr,r>>>=7;return e[t]=r|0,Ir.bytes=t-n+1,e}var Bo=Nt,_o=128,Ar=127;function Nt(r,n){var t=0,n=n||0,o=0,s=n,i,a=r.length;do{if(s>=a)throw Nt.bytes=0,new RangeError("Could not decode varint");i=r[s++],t+=o<28?(i&Ar)<<o:(i&Ar)*Math.pow(2,o),o+=7}while(i>=_o);return Nt.bytes=s-n,t}var Oo=Math.pow(2,7),Uo=Math.pow(2,14),No=Math.pow(2,21),Ro=Math.pow(2,28),Mo=Math.pow(2,35),ko=Math.pow(2,42),Vo=Math.pow(2,49),$o=Math.pow(2,56),Fo=Math.pow(2,63),zo=function(r){return r<Oo?1:r<Uo?2:r<No?3:r<Ro?4:r<Mo?5:r<ko?6:r<Vo?7:r<$o?8:r<Fo?9:10},Wo={encode:Lo,decode:Bo,encodingLength:zo},jo=Wo,xe=jo;function ye(r,e=0){return[xe.decode(r,e),xe.decode.bytes]}function se(r,e,t=0){return xe.encode(r,e,t),e}function ie(r){return xe.encodingLength(r)}function ce(r,e){let t=e.byteLength,n=ie(r),o=n+ie(t),s=new Uint8Array(o+t);return se(r,s,0),se(t,s,n),s.set(e,o),new ae(r,t,e,s)}function Pr(r){let e=$(r),[t,n]=ye(e),[o,s]=ye(e.subarray(n)),i=e.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new ae(t,o,i,e)}function Br(r,e){if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&yr(r.bytes,t.bytes)}}var ae=class{code;size;digest;bytes;constructor(e,t,n,o){this.code=e,this.size=t,this.digest=Y(n),this.bytes=Y(o)}};var _r=0,qo="identity",Or=$;function Ho(r,e){if(e?.truncate!=null&&e.truncate!==r.byteLength){if(e.truncate<0||e.truncate>r.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${r.byteLength}`);r=r.subarray(0,e.truncate)}return ce(_r,Or(r))}var Qo={code:_r,name:qo,encode:Or,digest:Ho};var Vt={};O(Vt,{sha256:()=>Xo,sha512:()=>Jo});var Go=20;function kt({name:r,code:e,encode:t,minDigestLength:n,maxDigestLength:o}){return new Mt(r,e,t,n,o)}var Mt=class{name;code;encode;minDigestLength;maxDigestLength;constructor(e,t,n,o,s){this.name=e,this.code=t,this.encode=n,this.minDigestLength=o??Go,this.maxDigestLength=s}digest(e,t){if(t?.truncate!=null){if(t.truncate<this.minDigestLength)throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);if(this.maxDigestLength!=null&&t.truncate>this.maxDigestLength)throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`)}if(e instanceof Uint8Array){let n=this.encode(e);return n instanceof Uint8Array?Ur(n,this.code,t?.truncate):n.then(o=>Ur(o,this.code,t?.truncate))}else throw Error("Unknown type, must be binary type")}};function Ur(r,e,t){if(t!=null&&t!==r.byteLength){if(t>r.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${r.byteLength}`);r=r.subarray(0,t)}return ce(e,r)}function Rr(r){return async e=>new Uint8Array(await crypto.subtle.digest(r,e))}var Xo=kt({name:"sha2-256",code:18,encode:Rr("SHA-256")}),Jo=kt({name:"sha2-512",code:19,encode:Rr("SHA-512")});function Mr(r,e){let{bytes:t,version:n}=r;return n===0?Yo(t,$t(r),e??k.encoder):Zo(t,$t(r),e??Q.encoder)}var kr=new WeakMap;function $t(r){let e=kr.get(r);if(e==null){let t=new Map;return kr.set(r,t),t}return e}var ue=class r{code;version;multihash;bytes;"/";constructor(e,t,n,o){this.code=t,this.version=e,this.multihash=n,this.bytes=Y(o),this["/"]=this.bytes}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:t}=this;if(e!==ve)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==es)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,n=ce(e,t);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return r.equals(this,e)}static equals(e,t){let n=t;return n!=null&&e.code===n.code&&e.version===n.version&&Br(e.multihash,n.multihash)}toString(e){return Mr(this,e)}toJSON(){return{"/":Mr(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof r)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:o,multihash:s,bytes:i}=t;return new r(n,o,s,i??Vr(n,o,s.bytes))}else if(t[ts]===!0){let{version:n,multihash:o,code:s}=t,i=Pr(o);return r.create(n,s,i)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==ve)throw new Error(`Version 0 CID must use dag-pb (code: ${ve}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let o=Vr(e,t,n.bytes);return new r(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,ve,e)}static createV1(e,t){return r.create(1,e,t)}static decode(e){let[t,n]=r.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=r.inspectBytes(e),n=t.size-t.multihashSize,o=$(e.subarray(n,n+t.multihashSize));if(o.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=o.subarray(t.multihashSize-t.digestSize),i=new ae(t.multihashCode,t.digestSize,s,o);return[t.version===0?r.createV0(i):r.createV1(t.codec,i),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[h,g]=ye(e.subarray(t));return t+=g,h},o=n(),s=ve;if(o===18?(o=0,t=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=t,a=n(),c=n(),l=t+c,f=l-i;return{version:o,codec:s,multihashCode:a,digestSize:c,multihashSize:f,size:l}}static parse(e,t){let[n,o]=Ko(e,t),s=r.decode(o);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return $t(s).set(n,e),s}};function Ko(r,e){switch(r[0]){case"Q":{let t=e??k;return[k.prefix,t.decode(`${k.prefix}${r}`)]}case k.prefix:{let t=e??k;return[k.prefix,t.decode(r)]}case Q.prefix:{let t=e??Q;return[Q.prefix,t.decode(r)]}case we.prefix:{let t=e??we;return[we.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}}function Yo(r,e,t){let{prefix:n}=t;if(n!==k.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let o=e.get(n);if(o==null){let s=t.encode(r).slice(1);return e.set(n,s),s}else return o}function Zo(r,e,t){let{prefix:n}=t,o=e.get(n);if(o==null){let s=t.encode(r);return e.set(n,s),s}else return o}var ve=112,es=18;function Vr(r,e,t){let n=ie(r),o=n+ie(e),s=new Uint8Array(o+t.byteLength);return se(r,s,0),se(e,s,n),s.set(t,o),s}var ts=Symbol.for("@ipld/js-cid/CID");var Ce={...Ut,...Tt,...Ot,...St,...Dt,...At,...It,...Pt,..._t,...Lt},ya={...Vt,...Rt};function Fr(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var $r=Fr("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Ft=Fr("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=K(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),rs={utf8:$r,"utf-8":$r,hex:Ce.base16,latin1:Ft,ascii:Ft,binary:Ft,...Ce},Fe=rs;function G(r,e="utf8"){let t=Fe[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.decoder.decode(`${t.prefix}${r}`)}function X(r,e="utf8"){let t=Fe[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.encoder.encode(r).substring(1)}var A=class extends Error{static name="InvalidMultiaddrError";name="InvalidMultiaddrError"},F=class extends Error{static name="ValidationError";name="ValidationError"},ze=class extends Error{static name="InvalidParametersError";name="InvalidParametersError"},We=class extends Error{static name="UnknownProtocolError";name="UnknownProtocolError"};var je=class{index=0;input="";new(e){return this.index=0,this.input=e,this}readAtomically(e){let t=this.index,n=e();return n===void 0&&(this.index=t),n}parseWith(e){let t=e();if(this.index===this.input.length)return t}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(e){return this.readAtomically(()=>{let t=this.readChar();if(t===e)return t})}readSeparator(e,t,n){return this.readAtomically(()=>{if(!(t>0&&this.readGivenChar(e)===void 0))return n()})}readNumber(e,t,n,o){return this.readAtomically(()=>{let s=0,i=0,a=this.peekChar();if(a===void 0)return;let c=a==="0",l=2**(8*o)-1;for(;;){let f=this.readAtomically(()=>{let h=this.readChar();if(h===void 0)return;let g=Number.parseInt(h,e);if(!Number.isNaN(g))return g});if(f===void 0)break;if(s*=e,s+=f,s>l||(i+=1,t!==void 0&&i>t))return}if(i!==0)return!n&&c&&i>1?void 0:s})}readIPv4Addr(){return this.readAtomically(()=>{let e=new Uint8Array(4);for(let t=0;t<e.length;t++){let n=this.readSeparator(".",t,()=>this.readNumber(10,3,!1,1));if(n===void 0)return;e[t]=n}return e})}readIPv6Addr(){let e=t=>{for(let n=0;n<t.length/2;n++){let o=n*2;if(n<t.length-3){let i=this.readSeparator(":",n,()=>this.readIPv4Addr());if(i!==void 0)return t[o]=i[0],t[o+1]=i[1],t[o+2]=i[2],t[o+3]=i[3],[o+4,!0]}let s=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(s===void 0)return[o,!1];t[o]=s>>8,t[o+1]=s&255}return[t.length,!1]};return this.readAtomically(()=>{let t=new Uint8Array(16),[n,o]=e(t);if(n===16)return t;if(o||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let s=new Uint8Array(14),i=16-(n+2),[a]=e(s.subarray(0,i));return t.set(s.subarray(0,a),16-a),t})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var ns=45,os=15,qe=new je;function zr(r){if(!(r.length>os))return qe.new(r).parseWith(()=>qe.readIPv4Addr())}function Wr(r){if(r.includes("%")&&(r=r.split("%")[0]),!(r.length>ns))return qe.new(r).parseWith(()=>qe.readIPv6Addr())}function He(r){return!!zr(r)}function jr(r){return!!Wr(r)}function Wt(r){return e=>X(e,r)}function jt(r){return e=>G(e,r)}function fe(r){return new DataView(r.buffer).getUint16(r.byteOffset).toString()}function Z(r){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,typeof r=="string"?parseInt(r):r),new Uint8Array(e)}function qr(r){let e=r.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==16)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion address.`);let t=G(e[0],"base32"),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=Z(n);return ne([t,o],t.length+o.length)}function Hr(r){let e=r.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==56)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion3 address.`);let t=Q.decode(`b${e[0]}`),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=Z(n);return ne([t,o],t.length+o.length)}function qt(r){let e=r.subarray(0,r.length-2),t=r.subarray(r.length-2),n=X(e,"base32"),o=fe(t);return`${n}:${o}`}var Ht=function(r){r=r.toString().trim();let e=new Uint8Array(4);return r.split(/\./g).forEach((t,n)=>{let o=parseInt(t,10);if(isNaN(o)||o<0||o>255)throw new A("Invalid byte value in IP address");e[n]=o}),e},Qr=function(r){let e=0;r=r.toString().trim();let t=r.split(":",8),n;for(n=0;n<t.length;n++){let s=He(t[n]),i;s&&(i=Ht(t[n]),t[n]=X(i.subarray(0,2),"base16")),i!=null&&++n<8&&t.splice(n,0,X(i.subarray(2,4),"base16"))}if(t[0]==="")for(;t.length<8;)t.unshift("0");else if(t[t.length-1]==="")for(;t.length<8;)t.push("0");else if(t.length<8){for(n=0;n<t.length&&t[n]!=="";n++);let s=[n,1];for(n=9-t.length;n>0;n--)s.push("0");t.splice.apply(t,s)}let o=new Uint8Array(e+16);for(n=0;n<t.length;n++){t[n]===""&&(t[n]="0");let s=parseInt(t[n],16);if(isNaN(s)||s<0||s>65535)throw new A("Invalid byte value in IP address");o[e++]=s>>8&255,o[e++]=s&255}return o},Gr=function(r){if(r.byteLength!==4)throw new A("IPv4 address was incorrect length");let e=[];for(let t=0;t<r.byteLength;t++)e.push(r[t]);return e.join(".")},Xr=function(r){if(r.byteLength!==16)throw new A("IPv6 address was incorrect length");let e=[];for(let n=0;n<r.byteLength;n+=2){let o=r[n],s=r[n+1],i=`${o.toString(16).padStart(2,"0")}${s.toString(16).padStart(2,"0")}`;e.push(i)}let t=e.join(":");try{let n=new URL(`http://[${t}]`);return n.hostname.substring(1,n.hostname.length-1)}catch{throw new A(`Invalid IPv6 address "${t}"`)}};function Jr(r){try{let e=new URL(`http://[${r}]`);return e.hostname.substring(1,e.hostname.length-1)}catch{throw new A(`Invalid IPv6 address "${r}"`)}}var zt=Object.values(Ce).map(r=>r.decoder),ss=(function(){let r=zt[0].or(zt[1]);return zt.slice(2).forEach(e=>r=r.or(e)),r})();function Kr(r){return ss.decode(r)}function Yr(r){return e=>r.encoder.encode(e)}function is(r){if(parseInt(r).toString()!==r)throw new F("Value must be an integer")}function as(r){if(r<0)throw new F("Value must be a positive integer, or zero")}function cs(r){return e=>{if(e>r)throw new F(`Value must be smaller than or equal to ${r}`)}}function us(...r){return e=>{for(let t of r)t(e)}}var Se=us(is,as,cs(65535));var T=-1,Qt=class{protocolsByCode=new Map;protocolsByName=new Map;getProtocol(e){let t;if(typeof e=="string"?t=this.protocolsByName.get(e):t=this.protocolsByCode.get(e),t==null)throw new We(`Protocol ${e} was unknown`);return t}addProtocol(e){this.protocolsByCode.set(e.code,e),this.protocolsByName.set(e.name,e),e.aliases?.forEach(t=>{this.protocolsByName.set(t,e)})}removeProtocol(e){let t=this.protocolsByCode.get(e);t!=null&&(this.protocolsByCode.delete(t.code),this.protocolsByName.delete(t.name),t.aliases?.forEach(n=>{this.protocolsByName.delete(n)}))}},z=new Qt,Cs=[{code:4,name:"ip4",size:32,valueToBytes:Ht,bytesToValue:Gr,validate:r=>{if(!He(r))throw new F(`Invalid IPv4 address "${r}"`)}},{code:6,name:"tcp",size:16,valueToBytes:Z,bytesToValue:fe,validate:Se},{code:273,name:"udp",size:16,valueToBytes:Z,bytesToValue:fe,validate:Se},{code:33,name:"dccp",size:16,valueToBytes:Z,bytesToValue:fe,validate:Se},{code:41,name:"ip6",size:128,valueToBytes:Qr,bytesToValue:Xr,stringToValue:Jr,validate:r=>{if(!jr(r))throw new F(`Invalid IPv6 address "${r}"`)}},{code:42,name:"ip6zone",size:T},{code:43,name:"ipcidr",size:8,bytesToValue:Wt("base10"),valueToBytes:jt("base10")},{code:53,name:"dns",size:T},{code:54,name:"dns4",size:T},{code:55,name:"dns6",size:T},{code:56,name:"dnsaddr",size:T},{code:132,name:"sctp",size:16,valueToBytes:Z,bytesToValue:fe,validate:Se},{code:301,name:"udt"},{code:302,name:"utp"},{code:400,name:"unix",size:T,stringToValue:r=>decodeURIComponent(r),valueToString:r=>encodeURIComponent(r)},{code:421,name:"p2p",aliases:["ipfs"],size:T,bytesToValue:Wt("base58btc"),valueToBytes:r=>r.startsWith("Q")||r.startsWith("1")?jt("base58btc")(r):ue.parse(r).multihash.bytes},{code:444,name:"onion",size:96,bytesToValue:qt,valueToBytes:qr},{code:445,name:"onion3",size:296,bytesToValue:qt,valueToBytes:Hr},{code:446,name:"garlic64",size:T},{code:447,name:"garlic32",size:T},{code:448,name:"tls"},{code:449,name:"sni",size:T},{code:454,name:"noise"},{code:460,name:"quic"},{code:461,name:"quic-v1"},{code:465,name:"webtransport"},{code:466,name:"certhash",size:T,bytesToValue:Yr(Bt),valueToBytes:Kr},{code:480,name:"http"},{code:481,name:"http-path",size:T,stringToValue:r=>`/${decodeURIComponent(r)}`,valueToString:r=>encodeURIComponent(r.substring(1))},{code:443,name:"https"},{code:477,name:"ws"},{code:478,name:"wss"},{code:479,name:"p2p-websocket-star"},{code:277,name:"p2p-stardust"},{code:275,name:"p2p-webrtc-star"},{code:276,name:"p2p-webrtc-direct"},{code:280,name:"webrtc-direct"},{code:281,name:"webrtc"},{code:290,name:"p2p-circuit"},{code:777,name:"memory",size:T}];Cs.forEach(r=>{z.addProtocol(r)});function Zr(r){let e=[],t=0;for(;t<r.length;){let n=wt(r,t),o=z.getProtocol(n),s=re(n),i=Ss(o,r,t+s),a=0;i>0&&o.size===T&&(a=re(i));let c=s+a+i,l={code:n,name:o.name,bytes:ge(r.subarray(t,t+c))};if(i>0){let f=t+s+a,h=r.subarray(f,f+i);l.value=o.bytesToValue?.(h)??X(h)}e.push(l),t+=c}return e}function en(r){let e=0,t=[];for(let n of r){if(n.bytes==null){let o=z.getProtocol(n.code),s=re(n.code),i,a=0,c=0;n.value!=null&&(i=o.valueToBytes?.(n.value)??G(n.value),a=i.byteLength,o.size===T&&(c=re(a)));let l=new Uint8Array(s+c+a),f=0;gt(n.code,l,f),f+=s,i!=null&&(o.size===T&&(gt(a,l,f),f+=c),l.set(i,f)),n.bytes=l}t.push(n.bytes),e+=n.bytes.byteLength}return ne(t,e)}function tn(r){if(r.charAt(0)!=="/")throw new A('String multiaddr must start with "/"');let e=[],t="protocol",n="",o="";for(let s=1;s<r.length;s++){let i=r.charAt(s);i!=="/"&&(t==="protocol"?o+=r.charAt(s):n+=r.charAt(s));let a=s===r.length-1;if(i==="/"||a){let c=z.getProtocol(o);if(t==="protocol"){if(c.size==null||c.size===0){e.push({code:c.code,name:c.name}),n="",o="",t="protocol";continue}else if(a)throw new A(`Component ${o} was missing value`);t="value"}else if(t==="value"){let l={code:c.code,name:c.name};if(c.size!=null&&c.size!==0){if(n==="")throw new A(`Component ${o} was missing value`);l.value=c.stringToValue?.(n)??n}e.push(l),n="",o="",t="protocol"}}}if(o!==""&&n!=="")throw new A("Incomplete multiaddr");return e}function rn(r){return`/${r.flatMap(e=>{if(e.value==null)return e.name;let t=z.getProtocol(e.code);if(t==null)throw new A(`Unknown protocol code ${e.code}`);return[e.name,t.valueToString?.(e.value)??e.value]}).join("/")}`}function Ss(r,e,t){return r.size==null||r.size===0?0:r.size>0?r.size/8:wt(e,t)}var Ds=Symbol.for("nodejs.util.inspect.custom"),sr=Symbol.for("@multiformats/multiaddr");function Ts(r){if(r==null&&(r="/"),nn(r))return r.getComponents();if(r instanceof Uint8Array)return Zr(r);if(typeof r=="string")return r=r.replace(/\/(\/)+/,"/").replace(/(\/)+$/,""),r===""&&(r="/"),tn(r);if(Array.isArray(r))return r;throw new A("Must be a string, Uint8Array, Component[], or another Multiaddr")}var Ye=class r{[sr]=!0;#e;#t;#r;constructor(e="/",t={}){this.#e=Ts(e),t.validate!==!1&&Ls(this)}get bytes(){return this.#r==null&&(this.#r=en(this.#e)),this.#r}toString(){return this.#t==null&&(this.#t=rn(this.#e)),this.#t}toJSON(){return this.toString()}getComponents(){return[...this.#e.map(e=>({...e}))]}encapsulate(e){let t=new r(e);return new r([...this.#e,...t.getComponents()],{validate:!1})}decapsulate(e){let t=e.toString(),n=this.toString(),o=n.lastIndexOf(t);if(o<0)throw new ze(`Address ${this.toString()} does not contain subaddress: ${t}`);return new r(n.slice(0,o),{validate:!1})}decapsulateCode(e){let t;for(let n=this.#e.length-1;n>-1;n--)if(this.#e[n].code===e){t=n;break}return new r(this.#e.slice(0,t),{validate:!1})}equals(e){return ht(this.bytes,e.bytes)}[Ds](){return`Multiaddr(${this.toString()})`}};function Ls(r){r.getComponents().forEach(e=>{let t=z.getProtocol(e.code);e.value!=null&&t.validate?.(e.value)})}function nn(r){return!!r?.[sr]}function on(r){return new Ye(r)}var y=r=>({match:e=>{let t=e[0];return t==null||t.code!==r||t.value!=null?!1:e.slice(1)}}),u=(r,e)=>({match:t=>{let n=t[0];return n?.code!==r||n.value==null||e!=null&&n.value!==e?!1:t.slice(1)}}),sn=r=>({match:e=>r.match(e)===!1?e:!1}),d=r=>({match:e=>{let t=r.match(e);return t===!1?e:t}}),P=(...r)=>({match:e=>{let t;for(let n of r){let o=n.match(e);o!==!1&&(t==null||o.length<t.length)&&(t=o)}return t??!1}}),b=(...r)=>({match:e=>{for(let t of r){let n=t.match(e);if(n===!1)return!1;e=n}return e}});function E(...r){function e(o){if(o==null)return!1;let s=o.getComponents();for(let i of r){let a=i.match(s);if(a===!1)return!1;s=a}return s}function t(o){return e(o)!==!1}function n(o){let s=e(o);return s===!1?!1:s.length===0}return{matchers:r,matches:t,exactMatch:n}}var As=u(421),Nc=E(As),et=u(54),tt=u(55),rt=u(56),ar=u(53),Rc=E(et,d(u(421))),Mc=E(tt,d(u(421))),kc=E(rt,d(u(421))),Vc=E(P(ar,rt,et,tt),d(u(421))),an=b(u(4),d(u(43))),cn=b(d(u(42)),u(41),d(u(43))),cr=P(an,cn),de=P(cr,ar,et,tt,rt),$c=E(P(cr,b(P(ar,rt,et,tt),d(u(421))))),Fc=E(an),zc=E(cn),Wc=E(cr),ur=b(de,u(6)),Pe=b(de,u(273)),jc=E(b(ur,d(u(421)))),qc=E(Pe),fr=b(Pe,y(460),d(u(421))),nt=b(Pe,y(461),d(u(421))),Is=P(fr,nt),Hc=E(fr),Qc=E(nt),ir=P(de,ur,Pe,fr,nt),un=P(b(ir,y(477),d(u(421)))),fn=E(un),ln=P(b(ir,y(478),d(u(421))),b(ir,y(448),d(u(449)),y(477),d(u(421)))),hn=E(ln),dn=b(Pe,y(280),d(u(466)),d(u(466)),d(u(421))),Gc=E(dn),pn=b(nt,y(465),d(u(466)),d(u(466)),d(u(421))),Xc=E(pn),Ze=P(un,ln,b(ur,d(u(421))),b(Is,d(u(421))),b(de,d(u(421))),dn,pn,u(421)),Jc=E(Ze),Ps=b(d(Ze),y(290),sn(y(281)),d(u(421))),Kc=E(Ps),Bs=P(b(Ze,y(290),y(281),d(u(421))),b(Ze,y(281),d(u(421))),b(y(281),d(u(421)))),Yc=E(Bs),_s=b(de,P(b(u(6,"80")),b(u(6),y(480)),y(480)),d(u(481)),d(u(421))),Zc=E(_s),Os=b(de,P(b(u(6,"443")),b(u(6,"443"),y(480)),b(u(6),y(443)),b(u(6),y(448),y(480)),b(y(448),y(480)),y(448),y(443)),d(u(481)),d(u(421))),eu=E(Os),Us=P(b(u(777),d(u(421)))),tu=E(Us),Ns=P(b(u(400),d(u(421)))),ru=E(Ns);var Rs=[6,53,56,54,55];function mn(r){return wn("sni",r)?.value}function bn(r){let e=wn("tcp",r)?.value;return e==null?"":`:${e}`}function wn(r,e){return e.find(t=>t.name===r)}function gn(r){return r.some(({code:e})=>e===448)}function M(r,e){let t=xn[r.name];if(t==null)throw new Error(`Can't interpret protocol ${r.name}`);let n=t(r,e);return r.code===41?`[${n}]`:n}var xn={ip4:(r,e)=>r.value,ip6:(r,e)=>e.length===0?r.value:`[${r.value}]`,tcp:(r,e)=>{let t=e.pop();if(t==null)throw new Error("Unexpected end of multiaddr");return`tcp://${M(t,e)}:${r.value}`},udp:(r,e)=>{let t=e.pop();if(t==null)throw new Error("Unexpected end of multiaddr");return`udp://${M(t,e)}:${r.value}`},dnsaddr:(r,e)=>r.value,dns4:(r,e)=>r.value,dns6:(r,e)=>r.value,dns:(r,e)=>r.value,ipfs:(r,e)=>{let t=e.pop();if(t==null)throw new Error("Unexpected end of multiaddr");return`${M(t,e)}`},p2p:(r,e)=>{let t=e.pop();if(t==null)throw new Error("Unexpected end of multiaddr");return`${M(t,e)}`},http:(r,e)=>{let t=gn(e),n=mn(e),o=bn(e);if(t&&n!=null)return`https://${n}${o}`;let s=t?"https://":"http://",i=e.pop();if(i==null)throw new Error("Unexpected end of multiaddr");let a=M(i,e);return a=a?.replace("tcp://",""),`${s}${a}`},"http-path":(r,e)=>{let t=e.pop();if(t==null)throw new Error("Unexpected end of multiaddr");let n=M(t,e),o=decodeURIComponent(r.value??"");return`${n}${o}`},tls:(r,e)=>{let t=e.pop();if(t==null)throw new Error("Unexpected end of multiaddr");return M(t,e)},sni:(r,e)=>{let t=e.pop();if(t==null)throw new Error("Unexpected end of multiaddr");return M(t,e)},https:(r,e)=>{let t=e.pop();if(t==null)throw new Error("Unexpected end of multiaddr");let n=M(t,e);return n=n?.replace("tcp://",""),`https://${n}`},ws:(r,e)=>{let t=gn(e),n=mn(e),o=bn(e);if(t&&n!=null)return`wss://${n}${o}`;let s=t?"wss://":"ws://",i=e.pop();if(i==null)throw new Error("Unexpected end of multiaddr");let a=M(i,e);return a=a?.replace("tcp://",""),`${s}${a}`},wss:(r,e)=>{let t=e.pop();if(t==null)throw new Error("Unexpected end of multiaddr");let n=M(t,e);return n=n?.replace("tcp://",""),`wss://${n}`}};function yn(r,e){let n=on(r).getComponents(),o=n.pop();if(o==null)throw new Error("Unexpected end of multiaddr");let s=xn[o.name];if(s==null)throw new Error(`No interpreter found for ${o.name}`);let i=s(o,n)??"";return e?.assumeHttp!==!1&&Rs.includes(o.code)&&(i=i.replace(/^.*:\/\//,""),o.value==="443"?i=`https://${i}`:i=`http://${i}`),(i.startsWith("http://")||i.startsWith("https://")||i.startsWith("ws://")||i.startsWith("wss://"))&&(i=new URL(i).toString(),i.endsWith("/")&&(i=i.substring(0,i.length-1))),i}var lr=class r extends Error{name="TimeoutError";constructor(e,t){super(e,t),Error.captureStackTrace?.(this,r)}},En=r=>r.reason??new DOMException("This operation was aborted.","AbortError");function hr(r,e){let{milliseconds:t,fallback:n,message:o,customTimers:s={setTimeout,clearTimeout},signal:i}=e,a,c,f=new Promise((h,g)=>{if(typeof t!="number"||Math.sign(t)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(i?.aborted){g(En(i));return}if(i&&(c=()=>{g(En(i))},i.addEventListener("abort",c,{once:!0})),r.then(h,g),t===Number.POSITIVE_INFINITY)return;let x=new lr;a=s.setTimeout.call(void 0,()=>{if(n){try{h(n())}catch(m){g(m)}return}typeof r.cancel=="function"&&r.cancel(),o===!1?h():o instanceof Error?g(o):(x.message=o??`Promise timed out after ${t} milliseconds`,g(x))},t)}).finally(()=>{f.clear(),c&&i&&i.removeEventListener("abort",c)});return f.clear=()=>{s.clearTimeout.call(void 0,a),a=void 0},f}var Ms=r=>{let e=r.addEventListener||r.on||r.addListener,t=r.removeEventListener||r.off||r.removeListener;if(!e||!t)throw new TypeError("Emitter is not compatible");return{addListener:e.bind(r),removeListener:t.bind(r)}};function ks(r,e,t){let n,o=new Promise((s,i)=>{if(t={rejectionEvents:["error"],multiArgs:!1,rejectionMultiArgs:!1,resolveImmediately:!1,...t},!(t.count>=0&&(t.count===Number.POSITIVE_INFINITY||Number.isInteger(t.count))))throw new TypeError("The `count` option should be at least 0 or more");t.signal?.throwIfAborted();let a=[e].flat(),c=[],{addListener:l,removeListener:f}=Ms(r),h=async(...x)=>{let m=t.multiArgs?x:x[0];if(t.filter)try{if(!await t.filter(m))return}catch(v){n(),i(v);return}c.push(m),t.count===c.length&&(n(),s(c))},g=(...x)=>{n(),i(t.rejectionMultiArgs?x:x[0])};n=()=>{for(let x of a)f(x,h);for(let x of t.rejectionEvents)a.includes(x)||f(x,g)};for(let x of a)l(x,h);for(let x of t.rejectionEvents)a.includes(x)||l(x,g);t.signal&&t.signal.addEventListener("abort",()=>{g(t.signal.reason)},{once:!0}),t.resolveImmediately&&s(c)});if(o.cancel=n,typeof t.timeout=="number"){let s=hr(o,{milliseconds:t.timeout});return s.cancel=()=>{n(),s.clear()},s}return o}function Be(r,e,t){typeof t=="function"&&(t={filter:t}),t={...t,count:1,resolveImmediately:!1};let n=ks(r,e,t),o=n.then(s=>s[0]);return o.cancel=n.cancel,o}var ot=class extends Event{type;detail;constructor(e,t){super(e),this.type=e,this.detail=t}};function vn(){throw new Error("WebSocket Servers can not be created in the browser!")}function W(r=0){return new Uint8Array(r)}function _e(r=0){return new Uint8Array(r)}function dr(r,e){e==null&&(e=r.reduce((o,s)=>o+s.length,0));let t=_e(e),n=0;for(let o of r)t.set(o,n),n+=o.length;return t}function Cn(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}var Dn=Symbol.for("@achingbrain/uint8arraylist");function Sn(r,e){if(e==null||e<0)throw new RangeError("index is out of bounds");let t=0;for(let n of r){let o=t+n.byteLength;if(e<o)return{buf:n,index:e-t};t=o}throw new RangeError("index is out of bounds")}function st(r){return!!r?.[Dn]}var pe=class r{bufs;length;[Dn]=!0;constructor(...e){this.bufs=[],this.length=0,e.length>0&&this.appendAll(e)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...e){this.appendAll(e)}appendAll(e){let t=0;for(let n of e)if(n instanceof Uint8Array)t+=n.byteLength,this.bufs.push(n);else if(st(n)){t+=n.byteLength;for(let o of n.bufs)this.bufs.push(o)}else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=t}prepend(...e){this.prependAll(e)}prependAll(e){let t=0;for(let n of e.reverse())if(n instanceof Uint8Array)t+=n.byteLength,this.bufs.unshift(n);else if(st(n))t+=n.byteLength,this.bufs.unshift(...n.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=t}get(e){let t=Sn(this.bufs,e);return t.buf[t.index]}set(e,t){let n=Sn(this.bufs,e);n.buf[n.index]=t}write(e,t=0){if(e instanceof Uint8Array)for(let n=0;n<e.length;n++)this.set(t+n,e[n]);else if(st(e))for(let n=0;n<e.length;n++)this.set(t+n,e.get(n));else throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList")}consume(e){if(e=Math.trunc(e),!(Number.isNaN(e)||e<=0)){if(e===this.byteLength){this.bufs=[],this.length=0;return}for(;this.bufs.length>0;)if(e>=this.bufs[0].byteLength)e-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(e),this.length-=e;break}}}slice(e,t){let{bufs:n,length:o}=this._subList(e,t);return dr(n,o)}subarray(e,t){let{bufs:n,length:o}=this._subList(e,t);return n.length===1?n[0]:dr(n,o)}sublist(e,t){let{bufs:n,length:o}=this._subList(e,t),s=new r;return s.length=o,s.bufs=n,s}_subList(e,t){if(e=e??0,t=t??this.length,e<0&&(e=this.length+e),t<0&&(t=this.length+t),e<0||t>this.length)throw new RangeError("index is out of bounds");if(e===t)return{bufs:[],length:0};if(e===0&&t===this.length)return{bufs:[...this.bufs],length:this.length};let n=[],o=0;for(let s=0;s<this.bufs.length;s++){let i=this.bufs[s],a=o,c=a+i.byteLength;if(o=c,e>=c)continue;let l=e>=a&&e<c,f=t>a&&t<=c;if(l&&f){if(e===a&&t===c){n.push(i);break}let h=e-a;n.push(i.subarray(h,h+(t-e)));break}if(l){if(e===0){n.push(i);continue}n.push(i.subarray(e-a));continue}if(f){if(t===c){n.push(i);break}n.push(i.subarray(0,t-a));break}n.push(i)}return{bufs:n,length:t-e}}indexOf(e,t=0){if(!st(e)&&!(e instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');let n=e instanceof Uint8Array?e:e.subarray();if(t=Number(t??0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),e.length===0)return t>this.length?this.length:t;let o=n.byteLength;if(o===0)throw new TypeError("search must be at least 1 byte long");let s=256,i=new Int32Array(s);for(let h=0;h<s;h++)i[h]=-1;for(let h=0;h<o;h++)i[n[h]]=h;let a=i,c=this.byteLength-n.byteLength,l=n.byteLength-1,f;for(let h=t;h<=c;h+=f){f=0;for(let g=l;g>=0;g--){let x=this.get(h+g);if(n[g]!==x){f=Math.max(1,g-a[x]);break}}if(f===0)return h}return-1}getInt8(e){let t=this.subarray(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getInt8(0)}setInt8(e,t){let n=_e(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt8(0,t),this.write(n,e)}getInt16(e,t){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt16(0,t)}setInt16(e,t,n){let o=W(2);new DataView(o.buffer,o.byteOffset,o.byteLength).setInt16(0,t,n),this.write(o,e)}getInt32(e,t){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt32(0,t)}setInt32(e,t,n){let o=W(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setInt32(0,t,n),this.write(o,e)}getBigInt64(e,t){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigInt64(0,t)}setBigInt64(e,t,n){let o=W(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setBigInt64(0,t,n),this.write(o,e)}getUint8(e){let t=this.subarray(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getUint8(0)}setUint8(e,t){let n=_e(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint8(0,t),this.write(n,e)}getUint16(e,t){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint16(0,t)}setUint16(e,t,n){let o=W(2);new DataView(o.buffer,o.byteOffset,o.byteLength).setUint16(0,t,n),this.write(o,e)}getUint32(e,t){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint32(0,t)}setUint32(e,t,n){let o=W(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setUint32(0,t,n),this.write(o,e)}getBigUint64(e,t){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigUint64(0,t)}setBigUint64(e,t,n){let o=W(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setBigUint64(0,t,n),this.write(o,e)}getFloat32(e,t){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat32(0,t)}setFloat32(e,t,n){let o=W(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setFloat32(0,t,n),this.write(o,e)}getFloat64(e,t){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat64(0,t)}setFloat64(e,t,n){let o=W(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setFloat64(0,t,n),this.write(o,e)}equals(e){if(e==null||!(e instanceof r)||e.bufs.length!==this.bufs.length)return!1;for(let t=0;t<this.bufs.length;t++)if(!Cn(this.bufs[t],e.bufs[t]))return!1;return!0}static fromUint8Arrays(e,t){let n=new r;return n.bufs=e,t==null&&(t=e.reduce((o,s)=>o+s.byteLength,0)),n.length=t,n}};function it(){let r={};return r.promise=new Promise((e,t)=>{r.resolve=e,r.reject=t}),r}var at=class{buffer;mask;top;btm;next;constructor(e){if(!(e>0)||(e-1&e)!==0)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){let e=this.buffer[this.btm];if(e!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return this.buffer[this.btm]===void 0}},me=class{size;hwm;head;tail;constructor(e={}){this.hwm=e.splitLimit??16,this.head=new at(this.hwm),this.tail=this.head,this.size=0}calculateSize(e){return e?.byteLength!=null?e.byteLength:1}push(e){if(e?.value!=null&&(this.size+=this.calculateSize(e.value)),!this.head.push(e)){let t=this.head;this.head=t.next=new at(2*this.head.buffer.length),this.head.push(e)}}shift(){let e=this.tail.shift();if(e===void 0&&this.tail.next!=null){let t=this.tail.next;this.tail.next=null,this.tail=t,e=this.tail.shift()}return e?.value!=null&&(this.size-=this.calculateSize(e.value)),e}isEmpty(){return this.head.isEmpty()}};var pr=class extends Error{type;code;constructor(e,t){super(e??"The operation was aborted"),this.type="aborted",this.code=t??"ABORT_ERR"}};function Tn(r={}){return Vs(t=>{let n=t.shift();if(n==null)return{done:!0};if(n.error!=null)throw n.error;return{done:n.done===!0,value:n.value}},r)}function Vs(r,e){e=e??{};let t=e.onEnd,n=new me,o,s,i,a=it(),c=async()=>{try{return n.isEmpty()?i?{done:!0}:await new Promise((p,D)=>{s=B=>{s=null,n.push(B);try{p(r(n))}catch(L){D(L)}return o}}):r(n)}finally{n.isEmpty()&&queueMicrotask(()=>{a.resolve(),a=it()})}},l=p=>s!=null?s(p):(n.push(p),o),f=p=>(n=new me,s!=null?s({error:p}):(n.push({error:p}),o)),h=p=>{if(i)return o;if(e?.objectMode!==!0&&p?.byteLength==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return l({done:!1,value:p})},g=p=>i?o:(i=!0,p!=null?f(p):l({done:!0})),x=()=>(n=new me,g(),{done:!0}),m=p=>(g(p),{done:!0});if(o={[Symbol.asyncIterator](){return this},next:c,return:x,throw:m,push:h,end:g,get readableLength(){return n.size},onEmpty:async p=>{let D=p?.signal;if(D?.throwIfAborted(),n.isEmpty())return;let B,L;D!=null&&(B=new Promise((_,U)=>{L=()=>{U(new pr)},D.addEventListener("abort",L)}));try{await Promise.race([a.promise,B])}finally{L!=null&&D!=null&&D?.removeEventListener("abort",L)}}},t==null)return o;let v=o;return o={[Symbol.asyncIterator](){return this},next(){return v.next()},throw(p){return v.throw(p),t!=null&&(t(p),t=void 0),{done:!0}},return(){return v.return(),t!=null&&(t(),t=void 0),{done:!0}},push:h,end(p){return v.end(p),t!=null&&(t(p),t=void 0),o},get readableLength(){return v.readableLength},onEmpty:p=>v.onEmpty(p)},o}function Ln(r,e){let t,n=function(){let o=function(){t=void 0,r()};clearTimeout(t),t=setTimeout(o,e)};return n.start=()=>{},n.stop=()=>{clearTimeout(t)},n}var ct=class extends Error{static name="StreamClosedError";name="StreamClosedError"};function $s(r){return r.reason}async function An(r,e,t){if(e==null)return r;let n=t?.translateError??$s;if(e.aborted)return r.catch(()=>{}),Promise.reject(n(e));let o;try{return await Promise.race([r,new Promise((s,i)=>{o=()=>{i(n(e))},e.addEventListener("abort",o)})])}finally{o!=null&&e.removeEventListener("abort",o)}}var Fs=Math.pow(2,20)*4,ut=class extends Ve{status;timeline;inactivityTimeout;maxReadBufferLength;maxWriteBufferLength;log;direction;maxMessageSize;readStatus;writeStatus;remoteReadStatus;remoteWriteStatus;writableNeedsDrain;readBuffer;writeBuffer;sendingData;onDrainPromise;constructor(e){super(),this.status="open",this.log=e.log,this.direction=e.direction??"outbound",this.inactivityTimeout=e.inactivityTimeout??12e4,this.maxReadBufferLength=e.maxReadBufferLength??Fs,this.maxWriteBufferLength=e.maxWriteBufferLength,this.maxMessageSize=e.maxMessageSize,this.readBuffer=new pe,this.writeBuffer=new pe,this.readStatus="readable",this.remoteReadStatus="readable",this.writeStatus="writable",this.remoteWriteStatus="writable",this.sendingData=!1,this.writableNeedsDrain=!1,this.timeline={open:Date.now()},this.processSendQueue=this.processSendQueue.bind(this);let t=()=>{this.writableNeedsDrain&&(this.log.trace("drain event received, continue sending data"),this.writableNeedsDrain=!1,queueMicrotask(()=>{try{this.processSendQueue()}catch(o){this.log.error("processSendQueue threw - %e",o)}})),this.onDrainPromise?.resolve()};this.addEventListener("drain",t);let n=o=>{this.onDrainPromise?.reject(o.error??new ct)};this.addEventListener("close",n)}get readBufferLength(){return this.readBuffer.byteLength}get writeBufferLength(){return this.writeBuffer.byteLength}async onDrain(e){return this.writableNeedsDrain!==!0?Promise.resolve():(this.onDrainPromise==null&&(this.onDrainPromise=Promise.withResolvers()),An(this.onDrainPromise.promise,e?.signal))}async*[Symbol.asyncIterator](){if(this.readStatus!=="readable"&&this.readStatus!=="paused")return;let e=Tn(),t=s=>{e.push(s.data)};this.addEventListener("message",t);let n=s=>{e.end(s.error)};this.addEventListener("close",n);let o=()=>{e.end()};this.addEventListener("remoteCloseWrite",o);try{yield*e}finally{this.removeEventListener("message",t),this.removeEventListener("close",n),this.removeEventListener("remoteCloseWrite",o)}}isReadable(){return this.status==="open"}send(e){if(this.writeStatus==="closed"||this.writeStatus==="closing")throw new q(`Cannot write to a stream that is ${this.writeStatus}`);return this.log.trace("append %d bytes to write buffer",e.byteLength),this.writeBuffer.append(e),this.processSendQueue()}abort(e){if(!(this.status==="aborted"||this.status==="reset"||this.status==="closed")){this.log.error("abort with error - %e",e),this.status="aborted",this.readBuffer.byteLength>0&&this.readBuffer.consume(this.readBuffer.byteLength),this.writeBuffer.byteLength>0&&(this.writeBuffer.consume(this.writeBuffer.byteLength),this.safeDispatchEvent("idle")),this.writeStatus="closed",this.remoteWriteStatus="closed",this.readStatus="closed",this.remoteReadStatus="closed",this.timeline.close=Date.now();try{this.sendReset(e)}catch(t){this.log("failed to send reset to remote - %e",t)}this.dispatchEvent(new Me(e))}}pause(){if(this.readStatus==="closed"||this.readStatus==="closing")throw new q("Cannot pause a stream that is closing/closed");this.readStatus!=="paused"&&(this.readStatus="paused",this.sendPause())}resume(){if(this.readStatus==="closed"||this.readStatus==="closing")throw new q("Cannot resume a stream that is closing/closed");this.readStatus!=="readable"&&(this.readStatus="readable",this.dispatchReadBuffer(),this.sendResume())}push(e){if(this.readStatus==="closed"||this.readStatus==="closing")throw new q(`Cannot push data onto a stream that is ${this.readStatus}`);if(e.byteLength!==0){if(this.readBuffer.append(e),this.readStatus==="paused"||this.listenerCount("message")===0){this.checkReadBufferLength();return}setTimeout(()=>{this.dispatchReadBuffer()},0)}}unshift(e){if(this.readStatus==="closed"||this.readStatus==="closing")throw new q(`Cannot push data onto a stream that is ${this.readStatus}`);if(e.byteLength!==0){if(this.readBuffer.prepend(e),this.readStatus==="paused"||this.listenerCount("message")===0){this.checkReadBufferLength();return}setTimeout(()=>{this.dispatchReadBuffer()},0)}}onData(e){if(e.byteLength!==0){if(this.readStatus==="closing"||this.readStatus==="closed"){this.log("ignoring data - read status %s",this.readStatus);return}this.readBuffer.append(e),this.dispatchReadBuffer()}}addEventListener(...e){super.addEventListener.apply(this,e),e[0]==="message"&&this.readBuffer.byteLength>0&&queueMicrotask(()=>{this.dispatchReadBuffer()})}onRemoteReset(){this.log("remote reset"),this.status="reset",this.writeStatus="closed",this.remoteWriteStatus="closed",this.remoteReadStatus="closed",this.timeline.close=Date.now(),this.readBuffer.byteLength===0&&(this.readStatus="closed");let e=new Ne;this.dispatchEvent(new ke(e))}onTransportClosed(e){this.log("transport closed"),this.readStatus==="readable"&&this.readBuffer.byteLength===0&&(this.log("close readable end after transport closed and read buffer is empty"),this.readStatus="closed"),this.remoteReadStatus!=="closed"&&(this.remoteReadStatus="closed"),this.remoteWriteStatus!=="closed"&&(this.remoteWriteStatus="closed"),this.writeStatus!=="closed"&&(this.writeStatus="closed"),e!=null?this.abort(e):(this.status==="open"||this.status==="closing")&&(this.timeline.close=Date.now(),this.status="closed",this.writeStatus="closed",this.remoteWriteStatus="closed",this.remoteReadStatus="closed",this.dispatchEvent(new te))}onRemoteCloseWrite(){this.remoteWriteStatus!=="closed"&&(this.log.trace("on remote close write"),this.remoteWriteStatus="closed",this.safeDispatchEvent("remoteCloseWrite"),this.writeStatus==="closed"&&this.onTransportClosed())}onRemoteCloseRead(){this.log.trace("on remote close read"),this.remoteReadStatus="closed",this.writeBuffer.byteLength>0&&(this.writeBuffer.consume(this.writeBuffer.byteLength),this.safeDispatchEvent("idle"))}processSendQueue(){if(this.writableNeedsDrain)return this.log.trace("not processing send queue as drain is required"),this.checkWriteBufferLength(),!1;if(this.writeBuffer.byteLength===0)return this.log.trace("not processing send queue as no bytes to send"),!0;if(this.sendingData)return this.log.trace("not processing send queue as already sending data"),!0;if(this.writeStatus!=="writable"&&this.writeStatus!=="closing")return this.log.trace("not processing send queue as stream is %s",this.writeStatus),!1;this.sendingData=!0,this.log.trace("processing send queue with %d queued bytes",this.writeBuffer.byteLength);try{let e=!0,t=this.writeBuffer.byteLength,n=0;for(;this.writeBuffer.byteLength>0;){let o=Math.min(this.maxMessageSize??this.writeBuffer.byteLength,this.writeBuffer.byteLength);if(o===0){e=!1;break}let s=this.writeBuffer.sublist(0,o),i=new pe(s);this.writeBuffer.consume(s.byteLength);let a=this.sendData(s);if(e=a.canSendMore,n+=a.sentBytes,a.sentBytes!==i.byteLength&&(i.consume(a.sentBytes),this.writeBuffer.prepend(i)),!e)break}return e||(this.log.trace("sent %d/%d bytes, pausing sending because underlying stream is full, %d bytes left in the write buffer",n,t,this.writeBuffer.byteLength),this.writableNeedsDrain=!0,this.checkWriteBufferLength()),this.writeBuffer.byteLength===0&&this.safeDispatchEvent("idle"),e}finally{this.sendingData=!1}}dispatchReadBuffer(){try{if(this.listenerCount("message")===0){this.log.trace("not dispatching pause buffer as there are no listeners for the message event");return}if(this.readBuffer.byteLength===0){this.log.trace("not dispatching pause buffer as there is no data to dispatch");return}if(this.readStatus==="paused"){this.log.trace("not dispatching pause buffer we are paused");return}if(this.readStatus==="closing"||this.readStatus==="closed"){this.log("dropping %d bytes because the readable end is %s",this.readBuffer.byteLength,this.readStatus),this.readBuffer.consume(this.readBuffer.byteLength);return}let e=this.readBuffer.sublist();this.readBuffer.consume(e.byteLength),this.dispatchEvent(new Re(e))}finally{this.readBuffer.byteLength===0&&this.remoteWriteStatus==="closed"&&(this.log("close readable end after dispatching read buffer and remote writable end is closed"),this.readStatus="closed"),this.checkReadBufferLength()}}checkReadBufferLength(){this.readBuffer.byteLength>this.maxReadBufferLength&&this.abort(new be(`Read buffer length of ${this.readBuffer.byteLength} exceeded limit of ${this.maxReadBufferLength}, read status is ${this.readStatus}`))}checkWriteBufferLength(){this.maxWriteBufferLength!=null&&this.writeBuffer.byteLength>this.maxWriteBufferLength&&this.abort(new be(`Write buffer length of ${this.writeBuffer.byteLength} exceeded limit of ${this.maxWriteBufferLength}, write status is ${this.writeStatus}`))}onMuxerNeedsDrain(){this.writableNeedsDrain=!0}onMuxerDrain(){this.safeDispatchEvent("drain")}};var ft=class extends ut{remoteAddr;metricPrefix;metrics;constructor(e){super(e),this.metricPrefix=e.metricPrefix??"",this.metrics=e.metrics,this.remoteAddr=e.remoteAddr,this.addEventListener("close",t=>{this.metrics?.increment({[`${this.metricPrefix}end`]:!0}),t.error!=null?t.local?this.metrics?.increment({[`${this.metricPrefix}abort`]:!0}):this.metrics?.increment({[`${this.metricPrefix}reset`]:!0}):t.local?this.metrics?.increment({[`${this.metricPrefix}_local_close`]:!0}):this.metrics?.increment({[`${this.metricPrefix}_remote_close`]:!0})})}async close(e){this.status==="open"&&(this.status="closing",this.writeStatus="closing",this.remoteWriteStatus="closing",this.remoteReadStatus="closing",(this.sendingData||this.writeBuffer.byteLength>0)&&(this.log("waiting for write queue to become idle before closing writable end of stream, %d unsent bytes",this.writeBuffer.byteLength),await Be(this,"idle",{...e,rejectionEvents:["close"]})),this.writableNeedsDrain&&(this.log("waiting for write queue to drain before closing writable end of stream, %d unsent bytes",this.writeBuffer.byteLength),await Be(this,"drain",{...e,rejectionEvents:["close"]})),await this.sendClose(e),this.onTransportClosed())}};function In(r){let e=new globalThis.AbortController;function t(){let s=r.filter(i=>i?.aborted===!0).map(i=>i?.reason).pop();e.abort(s);for(let i of r)i?.removeEventListener!=null&&i.removeEventListener("abort",t)}for(let s of r){if(s?.aborted===!0){t();break}s?.addEventListener!=null&&s.addEventListener("abort",t)}function n(){for(let s of r)s?.removeEventListener!=null&&s.removeEventListener("abort",t)}let o=e.signal;return o.clear=n,o}function Pn(r,e,t){let n,o,s=!1;function i(){let l={signal:o.signal},f;t?.timeout!=null&&(f=In([o.signal,AbortSignal.timeout(t.timeout)]),l.signal=f),s=!0,Promise.resolve().then(async()=>{await r(l)}).catch(()=>{}).finally(()=>{f!=null&&(f.aborted?f.clear():f.addEventListener("abort",()=>{f.clear()},{once:!0})),s=!1,!o.signal.aborted&&(n=setTimeout(i,e))})}let a=Ln(i,t?.debounce??100),c=!1;return{setInterval:l=>{e!==l&&(e=l,n!=null&&(clearTimeout(n),n=setTimeout(i,e)))},setTimeout:l=>{t??={},t.timeout=l},run:()=>{s||(clearTimeout(n),a())},start:()=>{c||(c=!0,o=new AbortController,o.signal,t?.runImmediately===!0?queueMicrotask(()=>{i()}):n=setTimeout(i,e))},stop:()=>{clearTimeout(n),o?.abort(),c=!1}}}var zs=1024*1024*4,Ws=10,mr=class extends ft{websocket;maxBufferedAmount;checkBufferedAmountTask;constructor(e){super(e),this.websocket=e.websocket,this.maxBufferedAmount=e.maxBufferedAmount??zs,this.checkBufferedAmountTask=Pn(this.checkBufferedAmount.bind(this),e.bufferedAmountPollInterval??Ws),this.websocket.addEventListener("close",t=>{if(this.log('closed - code %d, reason "%s", wasClean %s',t.code,t.reason,t.wasClean),this.checkBufferedAmountTask.stop(),!t.wasClean){this.onRemoteReset();return}this.onTransportClosed()},{once:!0}),this.websocket.addEventListener("message",t=>{try{let n;if(typeof t.data=="string")n=G(t.data);else if(t.data instanceof ArrayBuffer)n=new Uint8Array(t.data,0,t.data.byteLength);else{this.abort(new Error("Incorrect binary type"));return}this.onData(n)}catch(n){this.log.error("error receiving data - %e",n)}})}sendData(e){for(let n of e)this.websocket.send(ge(n));let t=this.websocket.bufferedAmount<this.maxBufferedAmount;return t||this.checkBufferedAmountTask.start(),{sentBytes:e.byteLength,canSendMore:t}}sendReset(){this.websocket.close(1006)}async sendClose(e){this.websocket.close(),e?.signal?.throwIfAborted()}sendPause(){}sendResume(){}checkBufferedAmount(){this.log("buffered amount now %d",this.websocket.bufferedAmount),this.websocket.bufferedAmount===0&&(this.checkBufferedAmountTask.stop(),this.safeDispatchEvent("drain"))}};function Bn(r){return new mr(r)}var br=class{log;init;logger;metrics;components;constructor(e,t={}){this.log=e.logger.forComponent("libp2p:websockets"),this.logger=e.logger,this.components=e,this.init=t,e.metrics!=null&&(this.metrics={dialerEvents:e.metrics.registerCounterGroup("libp2p_websockets_dialer_events_total",{label:"event",help:"Total count of WebSockets dialer events by type"})})}[wr]=!0;[Symbol.toStringTag]="@libp2p/websockets";[xr]=["@libp2p/transport"];async dial(e,t){this.log("dialing %s",e),t=t??{};let n=Bn({websocket:await this._connect(e,t),remoteAddr:e,metrics:this.metrics?.dialerEvents,direction:"outbound",log:this.components.logger.forComponent("libp2p:websockets:connection"),maxBufferedAmount:this.init.maxBufferedAmount,bufferedAmountPollInterval:this.init.bufferedAmountPollInterval});this.log("new outbound connection %s",n.remoteAddr);let o=await t.upgrader.upgradeOutbound(n,t);return this.log("outbound connection %s upgraded",n.remoteAddr),o}async _connect(e,t){t?.signal?.throwIfAborted();let n=yn(e);this.log("create websocket connection to %s",n);let o=new WebSocket(n);o.binaryType="arraybuffer";try{t.onProgress?.(new ot("websockets:open-connection")),await Be(o,"open",t)}catch(s){if(t.signal?.aborted)throw this.metrics?.dialerEvents.increment({abort:!0}),new Ue(`Could not connect to ${n}`);this.metrics?.dialerEvents.increment({error:!0});try{o.close()}catch{}throw s}return this.log("connected %s",e),this.metrics?.dialerEvents.increment({connect:!0}),o}createListener(e){return vn({logger:this.logger,events:this.components.events,metrics:this.components.metrics},{...this.init,...e})}listenFilter(e){return e.filter(t=>fn.exactMatch(t)||hn.exactMatch(t))}dialFilter(e){return this.listenFilter(e)}};function js(r={}){return e=>new br(e,r)}return Rn(qs);})();
|
|
3
3
|
return Libp2PWebsockets}));
|
|
4
4
|
//# sourceMappingURL=index.min.js.map
|