@libp2p/peer-collections 6.0.16-96f14e429 → 6.0.16-d72b51184

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.min.js CHANGED
@@ -1,5 +1,5 @@
1
1
  (function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PPeerCollections = factory()}(typeof self !== 'undefined' ? self : this, function () {
2
- "use strict";var Libp2PPeerCollections=(()=>{var yr=Object.defineProperty;var Ts=Object.getOwnPropertyDescriptor;var Rs=Object.getOwnPropertyNames;var Cs=Object.prototype.hasOwnProperty;var ct=(r,t)=>{for(var e in t)yr(r,e,{get:t[e],enumerable:!0})},Ls=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Rs(t))!Cs.call(r,o)&&o!==e&&yr(r,o,{get:()=>t[o],enumerable:!(n=Ts(t,o))||n.enumerable});return r};var Us=r=>Ls(yr({},"__esModule",{value:!0}),r);var ya={};ct(ya,{PeerFilter:()=>Oe,PeerList:()=>Zt,PeerMap:()=>Ft,PeerSet:()=>Vt,peerFilter:()=>xs,peerList:()=>ls,peerMap:()=>fs,peerSet:()=>hs,trackedPeerList:()=>ys,trackedPeerMap:()=>gs,trackedPeerSet:()=>bs});var wr=Symbol.for("@libp2p/peer-id");var ge=class extends Error{static name="InvalidParametersError";constructor(t="Invalid parameters"){super(t),this.name="InvalidParametersError"}},Pe=class extends Error{static name="InvalidPublicKeyError";constructor(t="Invalid public key"){super(t),this.name="InvalidPublicKeyError"}};var ze=class extends Error{static name="InvalidMultihashError";constructor(t="Invalid Multihash"){super(t),this.name="InvalidMultihashError"}};var be=class extends Error{static name="UnsupportedKeyTypeError";constructor(t="Unsupported key type"){super(t),this.name="UnsupportedKeyTypeError"}};var vr={};ct(vr,{base58btc:()=>X,base58flickr:()=>Ps});var Sa=new Uint8Array(0);function Hn(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}function _t(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 qn(r){return new TextEncoder().encode(r)}function Fn(r){return new TextDecoder().decode(r)}function Ns(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var o=0;o<r.length;o++){var s=r.charAt(o),i=s.charCodeAt(0);if(e[i]!==255)throw new TypeError(s+" is ambiguous");e[i]=o}var c=r.length,a=r.charAt(0),d=Math.log(c)/Math.log(256),u=Math.log(256)/Math.log(c);function x(w){if(w instanceof Uint8Array||(ArrayBuffer.isView(w)?w=new Uint8Array(w.buffer,w.byteOffset,w.byteLength):Array.isArray(w)&&(w=Uint8Array.from(w))),!(w instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(w.length===0)return"";for(var g=0,f=0,y=0,S=w.length;y!==S&&w[y]===0;)y++,g++;for(var l=(S-y)*u+1>>>0,v=new Uint8Array(l);y!==S;){for(var L=w[y],C=0,I=l-1;(L!==0||C<f)&&I!==-1;I--,C++)L+=256*v[I]>>>0,v[I]=L%c>>>0,L=L/c>>>0;if(L!==0)throw new Error("Non-zero carry");f=C,y++}for(var R=l-f;R!==l&&v[R]===0;)R++;for(var A=a.repeat(g);R<l;++R)A+=r.charAt(v[R]);return A}function p(w){if(typeof w!="string")throw new TypeError("Expected String");if(w.length===0)return new Uint8Array;var g=0;if(w[g]!==" "){for(var f=0,y=0;w[g]===a;)f++,g++;for(var S=(w.length-g)*d+1>>>0,l=new Uint8Array(S);w[g];){var v=e[w.charCodeAt(g)];if(v===255)return;for(var L=0,C=S-1;(v!==0||L<y)&&C!==-1;C--,L++)v+=c*l[C]>>>0,l[C]=v%256>>>0,v=v/256>>>0;if(v!==0)throw new Error("Non-zero carry");y=L,g++}if(w[g]!==" "){for(var I=S-y;I!==S&&l[I]===0;)I++;for(var R=new Uint8Array(f+(S-I)),A=f;I!==S;)R[A++]=l[I++];return R}}}function _(w){var g=p(w);if(g)return g;throw new Error(`Non-${t} character`)}return{encode:x,decodeUnsafe:p,decode:_}}var Ms=Ns,ks=Ms,Zn=ks;var Er=class{name;prefix;baseEncode;constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},_r=class{name;prefix;baseDecode;prefixCodePoint;constructor(t,e,n){this.name=t,this.prefix=e;let o=e.codePointAt(0);if(o===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=o,this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return Gn(this,t)}},Sr=class{decoders;constructor(t){this.decoders=t}or(t){return Gn(this,t)}decode(t){let e=t[0],n=this.decoders[e];if(n!=null)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function Gn(r,t){return new Sr({...r.decoders??{[r.prefix]:r},...t.decoders??{[t.prefix]:t}})}var Br=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(t,e,n,o){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=o,this.encoder=new Er(t,e,n),this.decoder=new _r(t,e,o)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};function se({name:r,prefix:t,encode:e,decode:n}){return new Br(r,t,e,n)}function Ut({name:r,prefix:t,alphabet:e}){let{encode:n,decode:o}=Zn(e,r);return se({prefix:t,name:r,encode:n,decode:s=>_t(o(s))})}function Ds(r,t,e,n){let o={};for(let u=0;u<t.length;++u)o[t[u]]=u;let s=r.length;for(;r[s-1]==="=";)--s;let i=new Uint8Array(s*e/8|0),c=0,a=0,d=0;for(let u=0;u<s;++u){let x=o[r[u]];if(x===void 0)throw new SyntaxError(`Non-${n} character`);a=a<<e|x,c+=e,c>=8&&(c-=8,i[d++]=255&a>>c)}if(c>=e||255&a<<8-c)throw new SyntaxError("Unexpected end of data");return i}function Os(r,t,e){let n=t[t.length-1]==="=",o=(1<<e)-1,s="",i=0,c=0;for(let a=0;a<r.length;++a)for(c=c<<8|r[a],i+=8;i>e;)i-=e,s+=t[o&c>>i];if(i!==0&&(s+=t[o&c<<e-i]),n)for(;s.length*e&7;)s+="=";return s}function j({name:r,prefix:t,bitsPerChar:e,alphabet:n}){return se({prefix:t,name:r,encode(o){return Os(o,n,e)},decode(o){return Ds(o,n,e,r)}})}var X=Ut({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Ps=Ut({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Ir={};ct(Ir,{base32:()=>ie,base32hex:()=>qs,base32hexpad:()=>Vs,base32hexpadupper:()=>Zs,base32hexupper:()=>Fs,base32pad:()=>Ks,base32padupper:()=>Hs,base32upper:()=>zs,base32z:()=>Gs});var ie=j({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),zs=j({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Ks=j({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Hs=j({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),qs=j({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Fs=j({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Vs=j({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Zs=j({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Gs=j({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Ar={};ct(Ar,{base36:()=>ye,base36upper:()=>js});var ye=Ut({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),js=Ut({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Ys=Xn,jn=128,Xs=127,Ws=~Xs,$s=Math.pow(2,31);function Xn(r,t,e){t=t||[],e=e||0;for(var n=e;r>=$s;)t[e++]=r&255|jn,r/=128;for(;r&Ws;)t[e++]=r&255|jn,r>>>=7;return t[e]=r|0,Xn.bytes=e-n+1,t}var Qs=Tr,Js=128,Yn=127;function Tr(r,n){var e=0,n=n||0,o=0,s=n,i,c=r.length;do{if(s>=c)throw Tr.bytes=0,new RangeError("Could not decode varint");i=r[s++],e+=o<28?(i&Yn)<<o:(i&Yn)*Math.pow(2,o),o+=7}while(i>=Js);return Tr.bytes=s-n,e}var ti=Math.pow(2,7),ei=Math.pow(2,14),ri=Math.pow(2,21),ni=Math.pow(2,28),oi=Math.pow(2,35),si=Math.pow(2,42),ii=Math.pow(2,49),ci=Math.pow(2,56),ai=Math.pow(2,63),ui=function(r){return r<ti?1:r<ei?2:r<ri?3:r<ni?4:r<oi?5:r<si?6:r<ii?7:r<ci?8:r<ai?9:10},fi={encode:Ys,decode:Qs,encodingLength:ui},hi=fi,we=hi;function Ee(r,t=0){return[we.decode(r,t),we.decode.bytes]}function ce(r,t,e=0){return we.encode(r,t,e),t}function ae(r){return we.encodingLength(r)}function Gt(r,t){let e=t.byteLength,n=ae(r),o=n+ae(e),s=new Uint8Array(o+e);return ce(r,s,0),ce(e,s,n),s.set(t,o),new ue(r,e,t,s)}function _e(r){let t=_t(r),[e,n]=Ee(t),[o,s]=Ee(t.subarray(n)),i=t.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new ue(e,o,i,t)}function Wn(r,t){if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&Hn(r.bytes,e.bytes)}}var ue=class{code;size;digest;bytes;constructor(t,e,n,o){this.code=t,this.size=e,this.digest=n,this.bytes=o}};function $n(r,t){let{bytes:e,version:n}=r;switch(n){case 0:return di(e,Rr(r),t??X.encoder);default:return pi(e,Rr(r),t??ie.encoder)}}var Qn=new WeakMap;function Rr(r){let t=Qn.get(r);if(t==null){let e=new Map;return Qn.set(r,e),e}return t}var lt=class r{code;version;multihash;bytes;"/";constructor(t,e,n,o){this.code=e,this.version=t,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:t,multihash:e}=this;if(t!==Se)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==mi)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(e)}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:t,digest:e}=this.multihash,n=Gt(t,e);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(t){return r.equals(this,t)}static equals(t,e){let n=e;return n!=null&&t.code===n.code&&t.version===n.version&&Wn(t.multihash,n.multihash)}toString(t){return $n(this,t)}toJSON(){return{"/":$n(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let e=t;if(e instanceof r)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:n,code:o,multihash:s,bytes:i}=e;return new r(n,o,s,i??Jn(n,o,s.bytes))}else if(e[xi]===!0){let{version:n,multihash:o,code:s}=e,i=_e(o);return r.create(n,s,i)}else return null}static create(t,e,n){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==Se)throw new Error(`Version 0 CID must use dag-pb (code: ${Se}) block encoding`);return new r(t,e,n,n.bytes)}case 1:{let o=Jn(t,e,n.bytes);return new r(t,e,n,o)}default:throw new Error("Invalid version")}}static createV0(t){return r.create(0,Se,t)}static createV1(t,e){return r.create(1,t,e)}static decode(t){let[e,n]=r.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=r.inspectBytes(t),n=e.size-e.multihashSize,o=_t(t.subarray(n,n+e.multihashSize));if(o.byteLength!==e.multihashSize)throw new Error("Incorrect length");let s=o.subarray(e.multihashSize-e.digestSize),i=new ue(e.multihashCode,e.digestSize,s,o);return[e.version===0?r.createV0(i):r.createV1(e.codec,i),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[x,p]=Ee(t.subarray(e));return e+=p,x},o=n(),s=Se;if(o===18?(o=0,e=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=e,c=n(),a=n(),d=e+a,u=d-i;return{version:o,codec:s,multihashCode:c,digestSize:a,multihashSize:u,size:d}}static parse(t,e){let[n,o]=li(t,e),s=r.decode(o);if(s.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Rr(s).set(n,t),s}};function li(r,t){switch(r[0]){case"Q":{let e=t??X;return[X.prefix,e.decode(`${X.prefix}${r}`)]}case X.prefix:{let e=t??X;return[X.prefix,e.decode(r)]}case ie.prefix:{let e=t??ie;return[ie.prefix,e.decode(r)]}case ye.prefix:{let e=t??ye;return[ye.prefix,e.decode(r)]}default:{if(t==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[r[0],t.decode(r)]}}}function di(r,t,e){let{prefix:n}=e;if(n!==X.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let o=t.get(n);if(o==null){let s=e.encode(r).slice(1);return t.set(n,s),s}else return o}function pi(r,t,e){let{prefix:n}=e,o=t.get(n);if(o==null){let s=e.encode(r);return t.set(n,s),s}else return o}var Se=112,mi=18;function Jn(r,t,e){let n=ae(r),o=n+ae(t),s=new Uint8Array(o+e.byteLength);return ce(r,s,0),ce(t,s,n),s.set(e,o),s}var xi=Symbol.for("@ipld/js-cid/CID");var Cr={};ct(Cr,{identity:()=>St});var to=0,gi="identity",eo=_t;function bi(r){return Gt(to,eo(r))}var St={code:to,name:gi,encode:eo,digest:bi};function Bt(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}function ro(r){if(!Number.isSafeInteger(r)||r<0)throw new Error("positive integer expected, got "+r)}function yi(r){return r instanceof Uint8Array||ArrayBuffer.isView(r)&&r.constructor.name==="Uint8Array"}function fe(r,...t){if(!yi(r))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(r.length))throw new Error("Uint8Array expected of length "+t+", got length="+r.length)}function no(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");ro(r.outputLen),ro(r.blockLen)}function he(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function oo(r,t){fe(r);let e=t.outputLen;if(r.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}var Yt=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function He(r){return new DataView(r.buffer,r.byteOffset,r.byteLength)}function dt(r,t){return r<<32-t|r>>>t}function so(r){if(typeof r!="string")throw new Error("utf8ToBytes expected string, got "+typeof r);return new Uint8Array(new TextEncoder().encode(r))}function Be(r){return typeof r=="string"&&(r=so(r)),fe(r),r}function Lr(...r){let t=0;for(let n=0;n<r.length;n++){let o=r[n];fe(o),t+=o.length}let e=new Uint8Array(t);for(let n=0,o=0;n<r.length;n++){let s=r[n];e.set(s,o),o+=s.length}return e}var le=class{clone(){return this._cloneInto()}};function qe(r){let t=n=>r().update(Be(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function Fe(r=32){if(Yt&&typeof Yt.getRandomValues=="function")return Yt.getRandomValues(new Uint8Array(r));if(Yt&&typeof Yt.randomBytes=="function")return Yt.randomBytes(r);throw new Error("crypto.getRandomValues must be defined")}function wi(r,t,e,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(t,e,n);let o=BigInt(32),s=BigInt(4294967295),i=Number(e>>o&s),c=Number(e&s),a=n?4:0,d=n?0:4;r.setUint32(t+a,i,n),r.setUint32(t+d,c,n)}function io(r,t,e){return r&t^~r&e}function co(r,t,e){return r&t^r&e^t&e}var de=class extends le{constructor(t,e,n,o){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=He(this.buffer)}update(t){he(this);let{view:e,buffer:n,blockLen:o}=this;t=Be(t);let s=t.length;for(let i=0;i<s;){let c=Math.min(o-this.pos,s-i);if(c===o){let a=He(t);for(;o<=s-i;i+=o)this.process(a,i);continue}n.set(t.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===o&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){he(this),oo(t,this),this.finished=!0;let{buffer:e,view:n,blockLen:o,isLE:s}=this,{pos:i}=this;e[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>o-i&&(this.process(n,0),i=0);for(let x=i;x<o;x++)e[x]=0;wi(n,o-8,BigInt(this.length*8),s),this.process(n,0);let c=He(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let d=a/4,u=this.get();if(d>u.length)throw new Error("_sha2: outputLen bigger than state");for(let x=0;x<d;x++)c.setUint32(4*x,u[x],s)}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:e,buffer:n,length:o,finished:s,destroyed:i,pos:c}=this;return t.length=o,t.pos=c,t.finished=s,t.destroyed=i,o%e&&t.buffer.set(n),t}};var Ve=BigInt(4294967295),Ur=BigInt(32);function ao(r,t=!1){return t?{h:Number(r&Ve),l:Number(r>>Ur&Ve)}:{h:Number(r>>Ur&Ve)|0,l:Number(r&Ve)|0}}function Ei(r,t=!1){let e=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let o=0;o<r.length;o++){let{h:s,l:i}=ao(r[o],t);[e[o],n[o]]=[s,i]}return[e,n]}var _i=(r,t)=>BigInt(r>>>0)<<Ur|BigInt(t>>>0),Si=(r,t,e)=>r>>>e,Bi=(r,t,e)=>r<<32-e|t>>>e,vi=(r,t,e)=>r>>>e|t<<32-e,Ii=(r,t,e)=>r<<32-e|t>>>e,Ai=(r,t,e)=>r<<64-e|t>>>e-32,Ti=(r,t,e)=>r>>>e-32|t<<64-e,Ri=(r,t)=>t,Ci=(r,t)=>r,Li=(r,t,e)=>r<<e|t>>>32-e,Ui=(r,t,e)=>t<<e|r>>>32-e,Ni=(r,t,e)=>t<<e-32|r>>>64-e,Mi=(r,t,e)=>r<<e-32|t>>>64-e;function ki(r,t,e,n){let o=(t>>>0)+(n>>>0);return{h:r+e+(o/2**32|0)|0,l:o|0}}var Di=(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),Oi=(r,t,e,n)=>t+e+n+(r/2**32|0)|0,Pi=(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),zi=(r,t,e,n,o)=>t+e+n+o+(r/2**32|0)|0,Ki=(r,t,e,n,o)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(o>>>0),Hi=(r,t,e,n,o,s)=>t+e+n+o+s+(r/2**32|0)|0;var qi={fromBig:ao,split:Ei,toBig:_i,shrSH:Si,shrSL:Bi,rotrSH:vi,rotrSL:Ii,rotrBH:Ai,rotrBL:Ti,rotr32H:Ri,rotr32L:Ci,rotlSH:Li,rotlSL:Ui,rotlBH:Ni,rotlBL:Mi,add:ki,add3L:Di,add3H:Oi,add4L:Pi,add4H:zi,add5H:Hi,add5L:Ki},k=qi;var[Fi,Vi]=k.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))),Nt=new Uint32Array(80),Mt=new Uint32Array(80),Nr=class extends de{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:t,Al:e,Bh:n,Bl:o,Ch:s,Cl:i,Dh:c,Dl:a,Eh:d,El:u,Fh:x,Fl:p,Gh:_,Gl:w,Hh:g,Hl:f}=this;return[t,e,n,o,s,i,c,a,d,u,x,p,_,w,g,f]}set(t,e,n,o,s,i,c,a,d,u,x,p,_,w,g,f){this.Ah=t|0,this.Al=e|0,this.Bh=n|0,this.Bl=o|0,this.Ch=s|0,this.Cl=i|0,this.Dh=c|0,this.Dl=a|0,this.Eh=d|0,this.El=u|0,this.Fh=x|0,this.Fl=p|0,this.Gh=_|0,this.Gl=w|0,this.Hh=g|0,this.Hl=f|0}process(t,e){for(let l=0;l<16;l++,e+=4)Nt[l]=t.getUint32(e),Mt[l]=t.getUint32(e+=4);for(let l=16;l<80;l++){let v=Nt[l-15]|0,L=Mt[l-15]|0,C=k.rotrSH(v,L,1)^k.rotrSH(v,L,8)^k.shrSH(v,L,7),I=k.rotrSL(v,L,1)^k.rotrSL(v,L,8)^k.shrSL(v,L,7),R=Nt[l-2]|0,A=Mt[l-2]|0,F=k.rotrSH(R,A,19)^k.rotrBH(R,A,61)^k.shrSH(R,A,6),z=k.rotrSL(R,A,19)^k.rotrBL(R,A,61)^k.shrSL(R,A,6),O=k.add4L(I,z,Mt[l-7],Mt[l-16]),Y=k.add4H(O,C,F,Nt[l-7],Nt[l-16]);Nt[l]=Y|0,Mt[l]=O|0}let{Ah:n,Al:o,Bh:s,Bl:i,Ch:c,Cl:a,Dh:d,Dl:u,Eh:x,El:p,Fh:_,Fl:w,Gh:g,Gl:f,Hh:y,Hl:S}=this;for(let l=0;l<80;l++){let v=k.rotrSH(x,p,14)^k.rotrSH(x,p,18)^k.rotrBH(x,p,41),L=k.rotrSL(x,p,14)^k.rotrSL(x,p,18)^k.rotrBL(x,p,41),C=x&_^~x&g,I=p&w^~p&f,R=k.add5L(S,L,I,Vi[l],Mt[l]),A=k.add5H(R,y,v,C,Fi[l],Nt[l]),F=R|0,z=k.rotrSH(n,o,28)^k.rotrBH(n,o,34)^k.rotrBH(n,o,39),O=k.rotrSL(n,o,28)^k.rotrBL(n,o,34)^k.rotrBL(n,o,39),Y=n&s^n&c^s&c,E=o&i^o&a^i&a;y=g|0,S=f|0,g=_|0,f=w|0,_=x|0,w=p|0,{h:x,l:p}=k.add(d|0,u|0,A|0,F|0),d=c|0,u=a|0,c=s|0,a=i|0,s=n|0,i=o|0;let T=k.add3L(F,O,E);n=k.add3H(T,A,z,Y),o=T|0}({h:n,l:o}=k.add(this.Ah|0,this.Al|0,n|0,o|0)),{h:s,l:i}=k.add(this.Bh|0,this.Bl|0,s|0,i|0),{h:c,l:a}=k.add(this.Ch|0,this.Cl|0,c|0,a|0),{h:d,l:u}=k.add(this.Dh|0,this.Dl|0,d|0,u|0),{h:x,l:p}=k.add(this.Eh|0,this.El|0,x|0,p|0),{h:_,l:w}=k.add(this.Fh|0,this.Fl|0,_|0,w|0),{h:g,l:f}=k.add(this.Gh|0,this.Gl|0,g|0,f|0),{h:y,l:S}=k.add(this.Hh|0,this.Hl|0,y|0,S|0),this.set(n,o,s,i,c,a,d,u,x,p,_,w,g,f,y,S)}roundClean(){Nt.fill(0),Mt.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var uo=qe(()=>new Nr);var je={};ct(je,{aInRange:()=>at,abool:()=>pt,abytes:()=>pe,bitGet:()=>Wi,bitLen:()=>Or,bitMask:()=>Ie,bitSet:()=>$i,bytesToHex:()=>It,bytesToNumberBE:()=>At,bytesToNumberLE:()=>Dt,concatBytes:()=>Tt,createHmacDrbg:()=>Pr,ensureBytes:()=>G,equalBytes:()=>Yi,hexToBytes:()=>Wt,hexToNumber:()=>Dr,inRange:()=>ve,isBytes:()=>kt,memoized:()=>Qt,notImplemented:()=>Ji,numberToBytesBE:()=>Ot,numberToBytesLE:()=>$t,numberToHexUnpadded:()=>Xt,numberToVarBytesBE:()=>ji,utf8ToBytes:()=>Xi,validateObject:()=>yt});var Ze=BigInt(0),Ge=BigInt(1),Zi=BigInt(2);function kt(r){return r instanceof Uint8Array||ArrayBuffer.isView(r)&&r.constructor.name==="Uint8Array"}function pe(r){if(!kt(r))throw new Error("Uint8Array expected")}function pt(r,t){if(typeof t!="boolean")throw new Error(r+" boolean expected, got "+t)}var Gi=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function It(r){pe(r);let t="";for(let e=0;e<r.length;e++)t+=Gi[r[e]];return t}function Xt(r){let t=r.toString(16);return t.length&1?"0"+t:t}function Dr(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);return r===""?Ze:BigInt("0x"+r)}var vt={_0:48,_9:57,A:65,F:70,a:97,f:102};function fo(r){if(r>=vt._0&&r<=vt._9)return r-vt._0;if(r>=vt.A&&r<=vt.F)return r-(vt.A-10);if(r>=vt.a&&r<=vt.f)return r-(vt.a-10)}function Wt(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let t=r.length,e=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(e);for(let o=0,s=0;o<e;o++,s+=2){let i=fo(r.charCodeAt(s)),c=fo(r.charCodeAt(s+1));if(i===void 0||c===void 0){let a=r[s]+r[s+1];throw new Error('hex string expected, got non-hex character "'+a+'" at index '+s)}n[o]=i*16+c}return n}function At(r){return Dr(It(r))}function Dt(r){return pe(r),Dr(It(Uint8Array.from(r).reverse()))}function Ot(r,t){return Wt(r.toString(16).padStart(t*2,"0"))}function $t(r,t){return Ot(r,t).reverse()}function ji(r){return Wt(Xt(r))}function G(r,t,e){let n;if(typeof t=="string")try{n=Wt(t)}catch(s){throw new Error(r+" must be hex string or Uint8Array, cause: "+s)}else if(kt(t))n=Uint8Array.from(t);else throw new Error(r+" must be hex string or Uint8Array");let o=n.length;if(typeof e=="number"&&o!==e)throw new Error(r+" of length "+e+" expected, got "+o);return n}function Tt(...r){let t=0;for(let n=0;n<r.length;n++){let o=r[n];pe(o),t+=o.length}let e=new Uint8Array(t);for(let n=0,o=0;n<r.length;n++){let s=r[n];e.set(s,o),o+=s.length}return e}function Yi(r,t){if(r.length!==t.length)return!1;let e=0;for(let n=0;n<r.length;n++)e|=r[n]^t[n];return e===0}function Xi(r){if(typeof r!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(r))}var Mr=r=>typeof r=="bigint"&&Ze<=r;function ve(r,t,e){return Mr(r)&&Mr(t)&&Mr(e)&&t<=r&&r<e}function at(r,t,e,n){if(!ve(t,e,n))throw new Error("expected valid "+r+": "+e+" <= n < "+n+", got "+t)}function Or(r){let t;for(t=0;r>Ze;r>>=Ge,t+=1);return t}function Wi(r,t){return r>>BigInt(t)&Ge}function $i(r,t,e){return r|(e?Ge:Ze)<<BigInt(t)}var Ie=r=>(Zi<<BigInt(r-1))-Ge,kr=r=>new Uint8Array(r),ho=r=>Uint8Array.from(r);function Pr(r,t,e){if(typeof r!="number"||r<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");let n=kr(r),o=kr(r),s=0,i=()=>{n.fill(1),o.fill(0),s=0},c=(...x)=>e(o,n,...x),a=(x=kr())=>{o=c(ho([0]),x),n=c(),x.length!==0&&(o=c(ho([1]),x),n=c())},d=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let x=0,p=[];for(;x<t;){n=c();let _=n.slice();p.push(_),x+=n.length}return Tt(...p)};return(x,p)=>{i(),a(x);let _;for(;!(_=p(d()));)a();return i(),_}}var Qi={bigint:r=>typeof r=="bigint",function:r=>typeof r=="function",boolean:r=>typeof r=="boolean",string:r=>typeof r=="string",stringOrUint8Array:r=>typeof r=="string"||kt(r),isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,t)=>t.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function yt(r,t,e={}){let n=(o,s,i)=>{let c=Qi[s];if(typeof c!="function")throw new Error("invalid validator function");let a=r[o];if(!(i&&a===void 0)&&!c(a,r))throw new Error("param "+String(o)+" is invalid. Expected "+s+", got "+a)};for(let[o,s]of Object.entries(t))n(o,s,!1);for(let[o,s]of Object.entries(e))n(o,s,!0);return r}var Ji=()=>{throw new Error("not implemented")};function Qt(r){let t=new WeakMap;return(e,...n)=>{let o=t.get(e);if(o!==void 0)return o;let s=r(e,...n);return t.set(e,s),s}}var W=BigInt(0),V=BigInt(1),Jt=BigInt(2),tc=BigInt(3),zr=BigInt(4),lo=BigInt(5),po=BigInt(8),ec=BigInt(9),rc=BigInt(16);function H(r,t){let e=r%t;return e>=W?e:t+e}function nc(r,t,e){if(t<W)throw new Error("invalid exponent, negatives unsupported");if(e<=W)throw new Error("invalid modulus");if(e===V)return W;let n=V;for(;t>W;)t&V&&(n=n*r%e),r=r*r%e,t>>=V;return n}function Z(r,t,e){let n=r;for(;t-- >W;)n*=n,n%=e;return n}function Ye(r,t){if(r===W)throw new Error("invert: expected non-zero number");if(t<=W)throw new Error("invert: expected positive modulus, got "+t);let e=H(r,t),n=t,o=W,s=V,i=V,c=W;for(;e!==W;){let d=n/e,u=n%e,x=o-i*d,p=s-c*d;n=e,e=u,o=i,s=c,i=x,c=p}if(n!==V)throw new Error("invert: does not exist");return H(o,t)}function oc(r){let t=(r-V)/Jt,e,n,o;for(e=r-V,n=0;e%Jt===W;e/=Jt,n++);for(o=Jt;o<r&&nc(o,t,r)!==r-V;o++)if(o>1e3)throw new Error("Cannot find square root: likely non-prime P");if(n===1){let i=(r+V)/zr;return function(a,d){let u=a.pow(d,i);if(!a.eql(a.sqr(u),d))throw new Error("Cannot find square root");return u}}let s=(e+V)/Jt;return function(c,a){if(c.pow(a,t)===c.neg(c.ONE))throw new Error("Cannot find square root");let d=n,u=c.pow(c.mul(c.ONE,o),e),x=c.pow(a,s),p=c.pow(a,e);for(;!c.eql(p,c.ONE);){if(c.eql(p,c.ZERO))return c.ZERO;let _=1;for(let g=c.sqr(p);_<d&&!c.eql(g,c.ONE);_++)g=c.sqr(g);let w=c.pow(u,V<<BigInt(d-_-1));u=c.sqr(w),x=c.mul(x,w),p=c.mul(p,u),d=_}return x}}function sc(r){if(r%zr===tc){let t=(r+V)/zr;return function(n,o){let s=n.pow(o,t);if(!n.eql(n.sqr(s),o))throw new Error("Cannot find square root");return s}}if(r%po===lo){let t=(r-lo)/po;return function(n,o){let s=n.mul(o,Jt),i=n.pow(s,t),c=n.mul(o,i),a=n.mul(n.mul(c,Jt),i),d=n.mul(c,n.sub(a,n.ONE));if(!n.eql(n.sqr(d),o))throw new Error("Cannot find square root");return d}}return r%rc,oc(r)}var mo=(r,t)=>(H(r,t)&V)===V,ic=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Kr(r){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},e=ic.reduce((n,o)=>(n[o]="function",n),t);return yt(r,e)}function cc(r,t,e){if(e<W)throw new Error("invalid exponent, negatives unsupported");if(e===W)return r.ONE;if(e===V)return t;let n=r.ONE,o=t;for(;e>W;)e&V&&(n=r.mul(n,o)),o=r.sqr(o),e>>=V;return n}function ac(r,t){let e=new Array(t.length),n=t.reduce((s,i,c)=>r.is0(i)?s:(e[c]=s,r.mul(s,i)),r.ONE),o=r.inv(n);return t.reduceRight((s,i,c)=>r.is0(i)?s:(e[c]=r.mul(s,e[c]),r.mul(s,i)),o),e}function Hr(r,t){let e=t!==void 0?t:r.toString(2).length,n=Math.ceil(e/8);return{nBitLength:e,nByteLength:n}}function Pt(r,t,e=!1,n={}){if(r<=W)throw new Error("invalid field: expected ORDER > 0, got "+r);let{nBitLength:o,nByteLength:s}=Hr(r,t);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let i,c=Object.freeze({ORDER:r,isLE:e,BITS:o,BYTES:s,MASK:Ie(o),ZERO:W,ONE:V,create:a=>H(a,r),isValid:a=>{if(typeof a!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof a);return W<=a&&a<r},is0:a=>a===W,isOdd:a=>(a&V)===V,neg:a=>H(-a,r),eql:(a,d)=>a===d,sqr:a=>H(a*a,r),add:(a,d)=>H(a+d,r),sub:(a,d)=>H(a-d,r),mul:(a,d)=>H(a*d,r),pow:(a,d)=>cc(c,a,d),div:(a,d)=>H(a*Ye(d,r),r),sqrN:a=>a*a,addN:(a,d)=>a+d,subN:(a,d)=>a-d,mulN:(a,d)=>a*d,inv:a=>Ye(a,r),sqrt:n.sqrt||(a=>(i||(i=sc(r)),i(c,a))),invertBatch:a=>ac(c,a),cmov:(a,d,u)=>u?d:a,toBytes:a=>e?$t(a,s):Ot(a,s),fromBytes:a=>{if(a.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+a.length);return e?Dt(a):At(a)}});return Object.freeze(c)}function xo(r){if(typeof r!="bigint")throw new Error("field order must be bigint");let t=r.toString(2).length;return Math.ceil(t/8)}function qr(r){let t=xo(r);return t+Math.ceil(t/2)}function go(r,t,e=!1){let n=r.length,o=xo(t),s=qr(t);if(n<16||n<s||n>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+n);let i=e?Dt(r):At(r),c=H(i,t-V)+V;return e?$t(c,o):Ot(c,o)}var bo=BigInt(0),Xe=BigInt(1);function Fr(r,t){let e=t.negate();return r?e:t}function yo(r,t){if(!Number.isSafeInteger(r)||r<=0||r>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+r)}function Vr(r,t){yo(r,t);let e=Math.ceil(t/r)+1,n=2**(r-1);return{windows:e,windowSize:n}}function uc(r,t){if(!Array.isArray(r))throw new Error("array expected");r.forEach((e,n)=>{if(!(e instanceof t))throw new Error("invalid point at index "+n)})}function fc(r,t){if(!Array.isArray(r))throw new Error("array of scalars expected");r.forEach((e,n)=>{if(!t.isValid(e))throw new Error("invalid scalar at index "+n)})}var Zr=new WeakMap,wo=new WeakMap;function Gr(r){return wo.get(r)||1}function We(r,t){return{constTimeNegate:Fr,hasPrecomputes(e){return Gr(e)!==1},unsafeLadder(e,n,o=r.ZERO){let s=e;for(;n>bo;)n&Xe&&(o=o.add(s)),s=s.double(),n>>=Xe;return o},precomputeWindow(e,n){let{windows:o,windowSize:s}=Vr(n,t),i=[],c=e,a=c;for(let d=0;d<o;d++){a=c,i.push(a);for(let u=1;u<s;u++)a=a.add(c),i.push(a);c=a.double()}return i},wNAF(e,n,o){let{windows:s,windowSize:i}=Vr(e,t),c=r.ZERO,a=r.BASE,d=BigInt(2**e-1),u=2**e,x=BigInt(e);for(let p=0;p<s;p++){let _=p*i,w=Number(o&d);o>>=x,w>i&&(w-=u,o+=Xe);let g=_,f=_+Math.abs(w)-1,y=p%2!==0,S=w<0;w===0?a=a.add(Fr(y,n[g])):c=c.add(Fr(S,n[f]))}return{p:c,f:a}},wNAFUnsafe(e,n,o,s=r.ZERO){let{windows:i,windowSize:c}=Vr(e,t),a=BigInt(2**e-1),d=2**e,u=BigInt(e);for(let x=0;x<i;x++){let p=x*c;if(o===bo)break;let _=Number(o&a);if(o>>=u,_>c&&(_-=d,o+=Xe),_===0)continue;let w=n[p+Math.abs(_)-1];_<0&&(w=w.negate()),s=s.add(w)}return s},getPrecomputes(e,n,o){let s=Zr.get(n);return s||(s=this.precomputeWindow(n,e),e!==1&&Zr.set(n,o(s))),s},wNAFCached(e,n,o){let s=Gr(e);return this.wNAF(s,this.getPrecomputes(s,e,o),n)},wNAFCachedUnsafe(e,n,o,s){let i=Gr(e);return i===1?this.unsafeLadder(e,n,s):this.wNAFUnsafe(i,this.getPrecomputes(i,e,o),n,s)},setWindowSize(e,n){yo(n,t),wo.set(e,n),Zr.delete(e)}}}function $e(r,t,e,n){if(uc(e,r),fc(n,t),e.length!==n.length)throw new Error("arrays of points and scalars must have equal length");let o=r.ZERO,s=Or(BigInt(e.length)),i=s>12?s-3:s>4?s-2:s?2:1,c=(1<<i)-1,a=new Array(c+1).fill(o),d=Math.floor((t.BITS-1)/i)*i,u=o;for(let x=d;x>=0;x-=i){a.fill(o);for(let _=0;_<n.length;_++){let w=n[_],g=Number(w>>BigInt(x)&BigInt(c));a[g]=a[g].add(e[_])}let p=o;for(let _=a.length-1,w=o;_>0;_--)w=w.add(a[_]),p=p.add(w);if(u=u.add(p),x!==0)for(let _=0;_<i;_++)u=u.double()}return u}function Ae(r){return Kr(r.Fp),yt(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Hr(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}var mt=BigInt(0),ut=BigInt(1),Qe=BigInt(2),hc=BigInt(8),lc={zip215:!0};function dc(r){let t=Ae(r);return yt(r,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}function Eo(r){let t=dc(r),{Fp:e,n,prehash:o,hash:s,randomBytes:i,nByteLength:c,h:a}=t,d=Qe<<BigInt(c*8)-ut,u=e.create,x=Pt(t.n,t.nBitLength),p=t.uvRatio||((m,h)=>{try{return{isValid:!0,value:e.sqrt(m*e.inv(h))}}catch{return{isValid:!1,value:mt}}}),_=t.adjustScalarBytes||(m=>m),w=t.domain||((m,h,b)=>{if(pt("phflag",b),h.length||b)throw new Error("Contexts/pre-hash are not supported");return m});function g(m,h){at("coordinate "+m,h,mt,d)}function f(m){if(!(m instanceof l))throw new Error("ExtendedPoint expected")}let y=Qt((m,h)=>{let{ex:b,ey:B,ez:U}=m,N=m.is0();h==null&&(h=N?hc:e.inv(U));let D=u(b*h),P=u(B*h),M=u(U*h);if(N)return{x:mt,y:ut};if(M!==ut)throw new Error("invZ was invalid");return{x:D,y:P}}),S=Qt(m=>{let{a:h,d:b}=t;if(m.is0())throw new Error("bad point: ZERO");let{ex:B,ey:U,ez:N,et:D}=m,P=u(B*B),M=u(U*U),K=u(N*N),q=u(K*K),$=u(P*h),Q=u(K*u($+M)),tt=u(q+u(b*u(P*M)));if(Q!==tt)throw new Error("bad point: equation left != right (1)");let et=u(B*U),it=u(N*D);if(et!==it)throw new Error("bad point: equation left != right (2)");return!0});class l{constructor(h,b,B,U){this.ex=h,this.ey=b,this.ez=B,this.et=U,g("x",h),g("y",b),g("z",B),g("t",U),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(h){if(h instanceof l)throw new Error("extended point not allowed");let{x:b,y:B}=h||{};return g("x",b),g("y",B),new l(b,B,ut,u(b*B))}static normalizeZ(h){let b=e.invertBatch(h.map(B=>B.ez));return h.map((B,U)=>B.toAffine(b[U])).map(l.fromAffine)}static msm(h,b){return $e(l,x,h,b)}_setWindowSize(h){C.setWindowSize(this,h)}assertValidity(){S(this)}equals(h){f(h);let{ex:b,ey:B,ez:U}=this,{ex:N,ey:D,ez:P}=h,M=u(b*P),K=u(N*U),q=u(B*P),$=u(D*U);return M===K&&q===$}is0(){return this.equals(l.ZERO)}negate(){return new l(u(-this.ex),this.ey,this.ez,u(-this.et))}double(){let{a:h}=t,{ex:b,ey:B,ez:U}=this,N=u(b*b),D=u(B*B),P=u(Qe*u(U*U)),M=u(h*N),K=b+B,q=u(u(K*K)-N-D),$=M+D,Q=$-P,tt=M-D,et=u(q*Q),it=u($*tt),nt=u(q*tt),bt=u(Q*$);return new l(et,it,bt,nt)}add(h){f(h);let{a:b,d:B}=t,{ex:U,ey:N,ez:D,et:P}=this,{ex:M,ey:K,ez:q,et:$}=h;if(b===BigInt(-1)){let Mn=u((N-U)*(K+M)),kn=u((N+U)*(K-M)),br=u(kn-Mn);if(br===mt)return this.double();let Dn=u(D*Qe*$),On=u(P*Qe*q),Pn=On+Dn,zn=kn+Mn,Kn=On-Dn,Bs=u(Pn*br),vs=u(zn*Kn),Is=u(Pn*Kn),As=u(br*zn);return new l(Bs,vs,As,Is)}let Q=u(U*M),tt=u(N*K),et=u(P*B*$),it=u(D*q),nt=u((U+N)*(M+K)-Q-tt),bt=it-et,Et=it+et,xe=u(tt-b*Q),ws=u(nt*bt),Es=u(Et*xe),_s=u(nt*xe),Ss=u(bt*Et);return new l(ws,Es,Ss,_s)}subtract(h){return this.add(h.negate())}wNAF(h){return C.wNAFCached(this,h,l.normalizeZ)}multiply(h){let b=h;at("scalar",b,ut,n);let{p:B,f:U}=this.wNAF(b);return l.normalizeZ([B,U])[0]}multiplyUnsafe(h,b=l.ZERO){let B=h;return at("scalar",B,mt,n),B===mt?L:this.is0()||B===ut?this:C.wNAFCachedUnsafe(this,B,l.normalizeZ,b)}isSmallOrder(){return this.multiplyUnsafe(a).is0()}isTorsionFree(){return C.unsafeLadder(this,n).is0()}toAffine(h){return y(this,h)}clearCofactor(){let{h}=t;return h===ut?this:this.multiplyUnsafe(h)}static fromHex(h,b=!1){let{d:B,a:U}=t,N=e.BYTES;h=G("pointHex",h,N),pt("zip215",b);let D=h.slice(),P=h[N-1];D[N-1]=P&-129;let M=Dt(D),K=b?d:e.ORDER;at("pointHex.y",M,mt,K);let q=u(M*M),$=u(q-ut),Q=u(B*q-U),{isValid:tt,value:et}=p($,Q);if(!tt)throw new Error("Point.fromHex: invalid y coordinate");let it=(et&ut)===ut,nt=(P&128)!==0;if(!b&&et===mt&&nt)throw new Error("Point.fromHex: x=0 and x_0=1");return nt!==it&&(et=u(-et)),l.fromAffine({x:et,y:M})}static fromPrivateKey(h){return A(h).point}toRawBytes(){let{x:h,y:b}=this.toAffine(),B=$t(b,e.BYTES);return B[B.length-1]|=h&ut?128:0,B}toHex(){return It(this.toRawBytes())}}l.BASE=new l(t.Gx,t.Gy,ut,u(t.Gx*t.Gy)),l.ZERO=new l(mt,ut,ut,mt);let{BASE:v,ZERO:L}=l,C=We(l,c*8);function I(m){return H(m,n)}function R(m){return I(Dt(m))}function A(m){let h=e.BYTES;m=G("private key",m,h);let b=G("hashed private key",s(m),2*h),B=_(b.slice(0,h)),U=b.slice(h,2*h),N=R(B),D=v.multiply(N),P=D.toRawBytes();return{head:B,prefix:U,scalar:N,point:D,pointBytes:P}}function F(m){return A(m).pointBytes}function z(m=new Uint8Array,...h){let b=Tt(...h);return R(s(w(b,G("context",m),!!o)))}function O(m,h,b={}){m=G("message",m),o&&(m=o(m));let{prefix:B,scalar:U,pointBytes:N}=A(h),D=z(b.context,B,m),P=v.multiply(D).toRawBytes(),M=z(b.context,P,N,m),K=I(D+M*U);at("signature.s",K,mt,n);let q=Tt(P,$t(K,e.BYTES));return G("result",q,e.BYTES*2)}let Y=lc;function E(m,h,b,B=Y){let{context:U,zip215:N}=B,D=e.BYTES;m=G("signature",m,2*D),h=G("message",h),b=G("publicKey",b,D),N!==void 0&&pt("zip215",N),o&&(h=o(h));let P=Dt(m.slice(D,2*D)),M,K,q;try{M=l.fromHex(b,N),K=l.fromHex(m.slice(0,D),N),q=v.multiplyUnsafe(P)}catch{return!1}if(!N&&M.isSmallOrder())return!1;let $=z(U,K.toRawBytes(),M.toRawBytes(),h);return K.add(M.multiplyUnsafe($)).subtract(q).clearCofactor().equals(l.ZERO)}return v._setWindowSize(8),{CURVE:t,getPublicKey:F,sign:O,verify:E,ExtendedPoint:l,utils:{getExtendedPublicKey:A,randomPrivateKey:()=>i(e.BYTES),precompute(m=8,h=l.BASE){return h._setWindowSize(m),h.multiply(BigInt(3)),h}}}}var jr=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),_o=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),mu=BigInt(0),pc=BigInt(1),So=BigInt(2),xu=BigInt(3),mc=BigInt(5),xc=BigInt(8);function gc(r){let t=BigInt(10),e=BigInt(20),n=BigInt(40),o=BigInt(80),s=jr,c=r*r%s*r%s,a=Z(c,So,s)*c%s,d=Z(a,pc,s)*r%s,u=Z(d,mc,s)*d%s,x=Z(u,t,s)*u%s,p=Z(x,e,s)*x%s,_=Z(p,n,s)*p%s,w=Z(_,o,s)*_%s,g=Z(w,o,s)*_%s,f=Z(g,t,s)*u%s;return{pow_p_5_8:Z(f,So,s)*r%s,b2:c}}function bc(r){return r[0]&=248,r[31]&=127,r[31]|=64,r}function yc(r,t){let e=jr,n=H(t*t*t,e),o=H(n*n*t,e),s=gc(r*o).pow_p_5_8,i=H(r*n*s,e),c=H(t*i*i,e),a=i,d=H(i*_o,e),u=c===r,x=c===H(-r,e),p=c===H(-r*_o,e);return u&&(i=a),(x||p)&&(i=d),mo(i,e)&&(i=H(-i,e)),{isValid:u||x,value:i}}var wc=Pt(jr,void 0,!0),Ec={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:wc,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:xc,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:uo,randomBytes:Fe,adjustScalarBytes:bc,uvRatio:yc},Bo=Eo(Ec);var Je=32;function vo(r,t,e){return Bo.verify(t,e instanceof Uint8Array?e:e.subarray(),r)}var tr=class{type="Ed25519";raw;constructor(t){this.raw=Yr(t,Je)}toMultihash(){return St.digest(er(this))}toCID(){return lt.createV1(114,this.toMultihash())}toString(){return X.encode(this.toMultihash().bytes).substring(1)}equals(t){return t==null||!(t.raw instanceof Uint8Array)?!1:Bt(this.raw,t.raw)}verify(t,e){return vo(this.raw,e,t)}};function Ao(r){return r=Yr(r,Je),new tr(r)}function Yr(r,t){if(r=Uint8Array.from(r??[]),r.length!==t)throw new ge(`Key must be a Uint8Array of length ${t}, got ${r.length}`);return r}function To(r=0){return new Uint8Array(r)}function Rt(r=0){return new Uint8Array(r)}var Sc=Math.pow(2,7),Bc=Math.pow(2,14),vc=Math.pow(2,21),Ro=Math.pow(2,28),Co=Math.pow(2,35),Lo=Math.pow(2,42),Uo=Math.pow(2,49),ot=128,zt=127;function Te(r){if(r<Sc)return 1;if(r<Bc)return 2;if(r<vc)return 3;if(r<Ro)return 4;if(r<Co)return 5;if(r<Lo)return 6;if(r<Uo)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function No(r,t,e=0){switch(Te(r)){case 8:t[e++]=r&255|ot,r/=128;case 7:t[e++]=r&255|ot,r/=128;case 6:t[e++]=r&255|ot,r/=128;case 5:t[e++]=r&255|ot,r/=128;case 4:t[e++]=r&255|ot,r>>>=7;case 3:t[e++]=r&255|ot,r>>>=7;case 2:t[e++]=r&255|ot,r>>>=7;case 1:{t[e++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return t}function Mo(r,t){let e=r[t],n=0;if(n+=e&zt,e<ot||(e=r[t+1],n+=(e&zt)<<7,e<ot)||(e=r[t+2],n+=(e&zt)<<14,e<ot)||(e=r[t+3],n+=(e&zt)<<21,e<ot)||(e=r[t+4],n+=(e&zt)*Ro,e<ot)||(e=r[t+5],n+=(e&zt)*Co,e<ot)||(e=r[t+6],n+=(e&zt)*Lo,e<ot)||(e=r[t+7],n+=(e&zt)*Uo,e<ot))return n;throw new RangeError("Could not decode varint")}var Xr=new Float32Array([-0]),Kt=new Uint8Array(Xr.buffer);function ko(r,t,e){Xr[0]=r,t[e]=Kt[0],t[e+1]=Kt[1],t[e+2]=Kt[2],t[e+3]=Kt[3]}function Do(r,t){return Kt[0]=r[t],Kt[1]=r[t+1],Kt[2]=r[t+2],Kt[3]=r[t+3],Xr[0]}var Wr=new Float64Array([-0]),rt=new Uint8Array(Wr.buffer);function Oo(r,t,e){Wr[0]=r,t[e]=rt[0],t[e+1]=rt[1],t[e+2]=rt[2],t[e+3]=rt[3],t[e+4]=rt[4],t[e+5]=rt[5],t[e+6]=rt[6],t[e+7]=rt[7]}function Po(r,t){return rt[0]=r[t],rt[1]=r[t+1],rt[2]=r[t+2],rt[3]=r[t+3],rt[4]=r[t+4],rt[5]=r[t+5],rt[6]=r[t+6],rt[7]=r[t+7],Wr[0]}var Ic=BigInt(Number.MAX_SAFE_INTEGER),Ac=BigInt(Number.MIN_SAFE_INTEGER),ft=class r{lo;hi;constructor(t,e){this.lo=t|0,this.hi=e|0}toNumber(t=!1){if(!t&&this.hi>>>31>0){let e=~this.lo+1>>>0,n=~this.hi>>>0;return e===0&&(n=n+1>>>0),-(e+n*4294967296)}return this.lo+this.hi*4294967296}toBigInt(t=!1){if(t)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let e=~this.lo+1>>>0,n=~this.hi>>>0;return e===0&&(n=n+1>>>0),-(BigInt(e)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(t=!1){return this.toBigInt(t).toString()}zzEncode(){let t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this}zzDecode(){let t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this}length(){let t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?e===0?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:n<128?9:10}static fromBigInt(t){if(t===0n)return te;if(t<Ic&&t>Ac)return this.fromNumber(Number(t));let e=t<0n;e&&(t=-t);let n=t>>32n,o=t-(n<<32n);return e&&(n=~n|0n,o=~o|0n,++o>zo&&(o=0n,++n>zo&&(n=0n))),new r(Number(o),Number(n))}static fromNumber(t){if(t===0)return te;let e=t<0;e&&(t=-t);let n=t>>>0,o=(t-n)/4294967296>>>0;return e&&(o=~o>>>0,n=~n>>>0,++n>4294967295&&(n=0,++o>4294967295&&(o=0))),new r(n,o)}static from(t){return typeof t=="number"?r.fromNumber(t):typeof t=="bigint"?r.fromBigInt(t):typeof t=="string"?r.fromBigInt(BigInt(t)):t.low!=null||t.high!=null?new r(t.low>>>0,t.high>>>0):te}},te=new ft(0,0);te.toBigInt=function(){return 0n};te.zzEncode=te.zzDecode=function(){return this};te.length=function(){return 1};var zo=4294967296n;function Ko(r){let t=0,e=0;for(let n=0;n<r.length;++n)e=r.charCodeAt(n),e<128?t+=1:e<2048?t+=2:(e&64512)===55296&&(r.charCodeAt(n+1)&64512)===56320?(++n,t+=4):t+=3;return t}function Ho(r,t,e){if(e-t<1)return"";let o,s=[],i=0,c;for(;t<e;)c=r[t++],c<128?s[i++]=c:c>191&&c<224?s[i++]=(c&31)<<6|r[t++]&63:c>239&&c<365?(c=((c&7)<<18|(r[t++]&63)<<12|(r[t++]&63)<<6|r[t++]&63)-65536,s[i++]=55296+(c>>10),s[i++]=56320+(c&1023)):s[i++]=(c&15)<<12|(r[t++]&63)<<6|r[t++]&63,i>8191&&((o??(o=[])).push(String.fromCharCode.apply(String,s)),i=0);return o!=null?(i>0&&o.push(String.fromCharCode.apply(String,s.slice(0,i))),o.join("")):String.fromCharCode.apply(String,s.slice(0,i))}function $r(r,t,e){let n=e,o,s;for(let i=0;i<r.length;++i)o=r.charCodeAt(i),o<128?t[e++]=o:o<2048?(t[e++]=o>>6|192,t[e++]=o&63|128):(o&64512)===55296&&((s=r.charCodeAt(i+1))&64512)===56320?(o=65536+((o&1023)<<10)+(s&1023),++i,t[e++]=o>>18|240,t[e++]=o>>12&63|128,t[e++]=o>>6&63|128,t[e++]=o&63|128):(t[e++]=o>>12|224,t[e++]=o>>6&63|128,t[e++]=o&63|128);return e-n}function xt(r,t){return RangeError(`index out of range: ${r.pos} + ${t??1} > ${r.len}`)}function rr(r,t){return(r[t-4]|r[t-3]<<8|r[t-2]<<16|r[t-1]<<24)>>>0}var Qr=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(t){this.buf=t,this.pos=0,this.len=t.length}uint32(){let t=4294967295;if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,xt(this,10);return t}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw xt(this,4);return rr(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw xt(this,4);return rr(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw xt(this,4);let t=Do(this.buf,this.pos);return this.pos+=4,t}double(){if(this.pos+8>this.len)throw xt(this,4);let t=Po(this.buf,this.pos);return this.pos+=8,t}bytes(){let t=this.uint32(),e=this.pos,n=this.pos+t;if(n>this.len)throw xt(this,t);return this.pos+=t,e===n?new Uint8Array(0):this.buf.subarray(e,n)}string(){let t=this.bytes();return Ho(t,0,t.length)}skip(t){if(typeof t=="number"){if(this.pos+t>this.len)throw xt(this,t);this.pos+=t}else do if(this.pos>=this.len)throw xt(this);while(this.buf[this.pos++]&128);return this}skipType(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${t} at offset ${this.pos}`)}return this}readLongVarint(){let t=new ft(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw xt(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw xt(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw xt(this,8);let t=rr(this.buf,this.pos+=4),e=rr(this.buf,this.pos+=4);return new ft(t,e)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){let t=Mo(this.buf,this.pos);return this.pos+=Te(t),t}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}};function Jr(r){return new Qr(r instanceof Uint8Array?r:r.subarray())}function nr(r,t,e){let n=Jr(r);return t.decode(n,void 0,e)}var tn={};ct(tn,{base10:()=>Tc});var Tc=Ut({prefix:"9",name:"base10",alphabet:"0123456789"});var en={};ct(en,{base16:()=>Rc,base16upper:()=>Cc});var Rc=j({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Cc=j({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var rn={};ct(rn,{base2:()=>Lc});var Lc=j({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var nn={};ct(nn,{base256emoji:()=>Dc});var Fo=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}"),Uc=Fo.reduce((r,t,e)=>(r[e]=t,r),[]),Nc=Fo.reduce((r,t,e)=>{let n=t.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${t}`);return r[n]=e,r},[]);function Mc(r){return r.reduce((t,e)=>(t+=Uc[e],t),"")}function kc(r){let t=[];for(let e of r){let n=e.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${e}`);let o=Nc[n];if(o==null)throw new Error(`Non-base256emoji character: ${e}`);t.push(o)}return new Uint8Array(t)}var Dc=se({prefix:"\u{1F680}",name:"base256emoji",encode:Mc,decode:kc});var on={};ct(on,{base64:()=>Oc,base64pad:()=>Pc,base64url:()=>zc,base64urlpad:()=>Kc});var Oc=j({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Pc=j({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),zc=j({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Kc=j({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var sn={};ct(sn,{base8:()=>Hc});var Hc=j({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var cn={};ct(cn,{identity:()=>qc});var qc=se({prefix:"\0",name:"identity",encode:r=>Fn(r),decode:r=>qn(r)});var Ju=new TextEncoder,tf=new TextDecoder;var fn={};ct(fn,{sha256:()=>Re,sha512:()=>Zc});function un({name:r,code:t,encode:e}){return new an(r,t,e)}var an=class{name;code;encode;constructor(t,e,n){this.name=t,this.code=e,this.encode=n}digest(t){if(t instanceof Uint8Array){let e=this.encode(t);return e instanceof Uint8Array?Gt(this.code,e):e.then(n=>Gt(this.code,n))}else throw Error("Unknown type, must be binary type")}};function Zo(r){return async t=>new Uint8Array(await crypto.subtle.digest(r,t))}var Re=un({name:"sha2-256",code:18,encode:Zo("SHA-256")}),Zc=un({name:"sha2-512",code:19,encode:Zo("SHA-512")});var hn={...cn,...rn,...sn,...tn,...en,...Ir,...Ar,...vr,...on,...nn},df={...fn,...Cr};function jo(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var Go=jo("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),ln=jo("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);let t=Rt(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),Gc={utf8:Go,"utf-8":Go,hex:hn.base16,latin1:ln,ascii:ln,binary:ln,...hn},or=Gc;function st(r,t="utf8"){let e=or[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return e.decoder.decode(`${e.prefix}${r}`)}function dn(r){let t=r??8192,e=t>>>1,n,o=t;return function(i){if(i<1||i>e)return Rt(i);o+i>t&&(n=Rt(t),o=0);let c=n.subarray(o,o+=i);return o&7&&(o=(o|7)+1),c}}var ee=class{fn;len;next;val;constructor(t,e,n){this.fn=t,this.len=e,this.next=void 0,this.val=n}};function pn(){}var xn=class{head;tail;len;next;constructor(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}},jc=dn();function Yc(r){return globalThis.Buffer!=null?Rt(r):jc(r)}var Le=class{len;head;tail;states;constructor(){this.len=0,this.head=new ee(pn,0,0),this.tail=this.head,this.states=null}_push(t,e,n){return this.tail=this.tail.next=new ee(t,e,n),this.len+=e,this}uint32(t){return this.len+=(this.tail=this.tail.next=new gn((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this}int32(t){return t<0?this._push(sr,10,ft.fromNumber(t)):this.uint32(t)}sint32(t){return this.uint32((t<<1^t>>31)>>>0)}uint64(t){let e=ft.fromBigInt(t);return this._push(sr,e.length(),e)}uint64Number(t){return this._push(No,Te(t),t)}uint64String(t){return this.uint64(BigInt(t))}int64(t){return this.uint64(t)}int64Number(t){return this.uint64Number(t)}int64String(t){return this.uint64String(t)}sint64(t){let e=ft.fromBigInt(t).zzEncode();return this._push(sr,e.length(),e)}sint64Number(t){let e=ft.fromNumber(t).zzEncode();return this._push(sr,e.length(),e)}sint64String(t){return this.sint64(BigInt(t))}bool(t){return this._push(mn,1,t?1:0)}fixed32(t){return this._push(Ce,4,t>>>0)}sfixed32(t){return this.fixed32(t)}fixed64(t){let e=ft.fromBigInt(t);return this._push(Ce,4,e.lo)._push(Ce,4,e.hi)}fixed64Number(t){let e=ft.fromNumber(t);return this._push(Ce,4,e.lo)._push(Ce,4,e.hi)}fixed64String(t){return this.fixed64(BigInt(t))}sfixed64(t){return this.fixed64(t)}sfixed64Number(t){return this.fixed64Number(t)}sfixed64String(t){return this.fixed64String(t)}float(t){return this._push(ko,4,t)}double(t){return this._push(Oo,8,t)}bytes(t){let e=t.length>>>0;return e===0?this._push(mn,1,0):this.uint32(e)._push(Wc,e,t)}string(t){let e=Ko(t);return e!==0?this.uint32(e)._push($r,e,t):this._push(mn,1,0)}fork(){return this.states=new xn(this),this.head=this.tail=new ee(pn,0,0),this.len=0,this}reset(){return this.states!=null?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new ee(pn,0,0),this.len=0),this}ldelim(){let t=this.head,e=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=t.next,this.tail=e,this.len+=n),this}finish(){let t=this.head.next,e=Yc(this.len),n=0;for(;t!=null;)t.fn(t.val,e,n),n+=t.len,t=t.next;return e}};function mn(r,t,e){t[e]=r&255}function Xc(r,t,e){for(;r>127;)t[e++]=r&127|128,r>>>=7;t[e]=r}var gn=class extends ee{next;constructor(t,e){super(Xc,t,e),this.next=void 0}};function sr(r,t,e){for(;r.hi!==0;)t[e++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)t[e++]=r.lo&127|128,r.lo=r.lo>>>7;t[e++]=r.lo}function Ce(r,t,e){t[e]=r&255,t[e+1]=r>>>8&255,t[e+2]=r>>>16&255,t[e+3]=r>>>24}function Wc(r,t,e){t.set(r,e)}globalThis.Buffer!=null&&(Le.prototype.bytes=function(r){let t=r.length>>>0;return this.uint32(t),t>0&&this._push($c,t,r),this},Le.prototype.string=function(r){let t=globalThis.Buffer.byteLength(r);return this.uint32(t),t>0&&this._push(Qc,t,r),this});function $c(r,t,e){t.set(r,e)}function Qc(r,t,e){r.length<40?$r(r,t,e):t.utf8Write!=null?t.utf8Write(r,e):t.set(st(r),e)}function bn(){return new Le}function ir(r,t){let e=bn();return t.encode(r,e,{lengthDelimited:!1}),e.finish()}var me;(function(r){r[r.VARINT=0]="VARINT",r[r.BIT64=1]="BIT64",r[r.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",r[r.START_GROUP=3]="START_GROUP",r[r.END_GROUP=4]="END_GROUP",r[r.BIT32=5]="BIT32"})(me||(me={}));function cr(r,t,e,n){return{name:r,type:t,encode:e,decode:n}}function yn(r){function t(o){if(r[o.toString()]==null)throw new Error("Invalid enum value");return r[o]}let e=function(s,i){let c=t(s);i.int32(c)},n=function(s){let i=s.int32();return t(i)};return cr("enum",me.VARINT,e,n)}function ar(r,t){return cr("message",me.LENGTH_DELIMITED,r,t)}var ht;(function(r){r.RSA="RSA",r.Ed25519="Ed25519",r.secp256k1="secp256k1"})(ht||(ht={}));var wn;(function(r){r[r.RSA=0]="RSA",r[r.Ed25519=1]="Ed25519",r[r.secp256k1=2]="secp256k1"})(wn||(wn={}));(function(r){r.codec=()=>yn(wn)})(ht||(ht={}));var Ue;(function(r){let t;r.codec=()=>(t==null&&(t=ar((e,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),e.Type!=null&&(n.uint32(8),ht.codec().encode(e.Type,n)),e.Data!=null&&(n.uint32(18),n.bytes(e.Data)),o.lengthDelimited!==!1&&n.ldelim()},(e,n,o={})=>{let s={},i=n==null?e.len:e.pos+n;for(;e.pos<i;){let c=e.uint32();switch(c>>>3){case 1:{s.Type=ht.codec().decode(e);break}case 2:{s.Data=e.bytes();break}default:{e.skipType(c&7);break}}}return s})),t),r.encode=e=>ir(e,r.codec()),r.decode=(e,n)=>nr(e,r.codec(),n)})(Ue||(Ue={}));var En;(function(r){let t;r.codec=()=>(t==null&&(t=ar((e,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),e.Type!=null&&(n.uint32(8),ht.codec().encode(e.Type,n)),e.Data!=null&&(n.uint32(18),n.bytes(e.Data)),o.lengthDelimited!==!1&&n.ldelim()},(e,n,o={})=>{let s={},i=n==null?e.len:e.pos+n;for(;e.pos<i;){let c=e.uint32();switch(c>>>3){case 1:{s.Type=ht.codec().decode(e);break}case 2:{s.Data=e.bytes();break}default:{e.skipType(c&7);break}}}return s})),t),r.encode=e=>ir(e,r.codec()),r.decode=(e,n)=>nr(e,r.codec(),n)})(En||(En={}));var ta=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Ht=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),qt=new Uint32Array(64),_n=class extends de{constructor(){super(64,32,8,!1),this.A=Ht[0]|0,this.B=Ht[1]|0,this.C=Ht[2]|0,this.D=Ht[3]|0,this.E=Ht[4]|0,this.F=Ht[5]|0,this.G=Ht[6]|0,this.H=Ht[7]|0}get(){let{A:t,B:e,C:n,D:o,E:s,F:i,G:c,H:a}=this;return[t,e,n,o,s,i,c,a]}set(t,e,n,o,s,i,c,a){this.A=t|0,this.B=e|0,this.C=n|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=c|0,this.H=a|0}process(t,e){for(let x=0;x<16;x++,e+=4)qt[x]=t.getUint32(e,!1);for(let x=16;x<64;x++){let p=qt[x-15],_=qt[x-2],w=dt(p,7)^dt(p,18)^p>>>3,g=dt(_,17)^dt(_,19)^_>>>10;qt[x]=g+qt[x-7]+w+qt[x-16]|0}let{A:n,B:o,C:s,D:i,E:c,F:a,G:d,H:u}=this;for(let x=0;x<64;x++){let p=dt(c,6)^dt(c,11)^dt(c,25),_=u+p+io(c,a,d)+ta[x]+qt[x]|0,g=(dt(n,2)^dt(n,13)^dt(n,22))+co(n,o,s)|0;u=d,d=a,a=c,c=i+_|0,i=s,s=o,o=n,n=_+g|0}n=n+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,c=c+this.E|0,a=a+this.F|0,d=d+this.G|0,u=u+this.H|0,this.set(n,o,s,i,c,a,d,u)}roundClean(){qt.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var Yo=qe(()=>new _n);function ur(r,t="utf8"){let e=or[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return e.encoder.encode(r).substring(1)}var Ne=class extends Error{constructor(t="An error occurred while verifying a message"){super(t),this.name="VerificationError"}};var fr=class extends le{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,no(t);let n=Be(e);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let o=this.blockLen,s=new Uint8Array(o);s.set(n.length>o?t.create().update(n).digest():n);for(let i=0;i<s.length;i++)s[i]^=54;this.iHash.update(s),this.oHash=t.create();for(let i=0;i<s.length;i++)s[i]^=106;this.oHash.update(s),s.fill(0)}update(t){return he(this),this.iHash.update(t),this}digestInto(t){he(this),fe(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));let{oHash:e,iHash:n,finished:o,destroyed:s,blockLen:i,outputLen:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=c,t.oHash=e._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},Sn=(r,t,e)=>new fr(r,t).update(e).digest();Sn.create=(r,t)=>new fr(r,t);function Xo(r){r.lowS!==void 0&&pt("lowS",r.lowS),r.prehash!==void 0&&pt("prehash",r.prehash)}function ea(r){let t=Ae(r);yt(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:e,Fp:n,a:o}=t;if(e){if(!n.eql(o,n.ZERO))throw new Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if(typeof e!="object"||typeof e.beta!="bigint"||typeof e.splitScalar!="function")throw new Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...t})}var{bytesToNumberBE:ra,hexToBytes:na}=je,Bn=class extends Error{constructor(t=""){super(t)}},Ct={Err:Bn,_tlv:{encode:(r,t)=>{let{Err:e}=Ct;if(r<0||r>256)throw new e("tlv.encode: wrong tag");if(t.length&1)throw new e("tlv.encode: unpadded data");let n=t.length/2,o=Xt(n);if(o.length/2&128)throw new e("tlv.encode: long form length too big");let s=n>127?Xt(o.length/2|128):"";return Xt(r)+s+o+t},decode(r,t){let{Err:e}=Ct,n=0;if(r<0||r>256)throw new e("tlv.encode: wrong tag");if(t.length<2||t[n++]!==r)throw new e("tlv.decode: wrong tlv");let o=t[n++],s=!!(o&128),i=0;if(!s)i=o;else{let a=o&127;if(!a)throw new e("tlv.decode(long): indefinite length not supported");if(a>4)throw new e("tlv.decode(long): byte length is too big");let d=t.subarray(n,n+a);if(d.length!==a)throw new e("tlv.decode: length bytes not complete");if(d[0]===0)throw new e("tlv.decode(long): zero leftmost byte");for(let u of d)i=i<<8|u;if(n+=a,i<128)throw new e("tlv.decode(long): not minimal encoding")}let c=t.subarray(n,n+i);if(c.length!==i)throw new e("tlv.decode: wrong value length");return{v:c,l:t.subarray(n+i)}}},_int:{encode(r){let{Err:t}=Ct;if(r<Lt)throw new t("integer: negative integers are not allowed");let e=Xt(r);if(Number.parseInt(e[0],16)&8&&(e="00"+e),e.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return e},decode(r){let{Err:t}=Ct;if(r[0]&128)throw new t("invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return ra(r)}},toSig(r){let{Err:t,_int:e,_tlv:n}=Ct,o=typeof r=="string"?na(r):r;pe(o);let{v:s,l:i}=n.decode(48,o);if(i.length)throw new t("invalid signature: left bytes after parsing");let{v:c,l:a}=n.decode(2,s),{v:d,l:u}=n.decode(2,a);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:e.decode(c),s:e.decode(d)}},hexFromSig(r){let{_tlv:t,_int:e}=Ct,n=t.encode(2,e.encode(r.r)),o=t.encode(2,e.encode(r.s)),s=n+o;return t.encode(48,s)}},Lt=BigInt(0),J=BigInt(1),rh=BigInt(2),Wo=BigInt(3),nh=BigInt(4);function oa(r){let t=ea(r),{Fp:e}=t,n=Pt(t.n,t.nBitLength),o=t.toBytes||((g,f,y)=>{let S=f.toAffine();return Tt(Uint8Array.from([4]),e.toBytes(S.x),e.toBytes(S.y))}),s=t.fromBytes||(g=>{let f=g.subarray(1),y=e.fromBytes(f.subarray(0,e.BYTES)),S=e.fromBytes(f.subarray(e.BYTES,2*e.BYTES));return{x:y,y:S}});function i(g){let{a:f,b:y}=t,S=e.sqr(g),l=e.mul(S,g);return e.add(e.add(l,e.mul(g,f)),y)}if(!e.eql(e.sqr(t.Gy),i(t.Gx)))throw new Error("bad generator point: equation left != right");function c(g){return ve(g,J,t.n)}function a(g){let{allowedPrivateKeyLengths:f,nByteLength:y,wrapPrivateKey:S,n:l}=t;if(f&&typeof g!="bigint"){if(kt(g)&&(g=It(g)),typeof g!="string"||!f.includes(g.length))throw new Error("invalid private key");g=g.padStart(y*2,"0")}let v;try{v=typeof g=="bigint"?g:At(G("private key",g,y))}catch{throw new Error("invalid private key, expected hex or "+y+" bytes, got "+typeof g)}return S&&(v=H(v,l)),at("private key",v,J,l),v}function d(g){if(!(g instanceof p))throw new Error("ProjectivePoint expected")}let u=Qt((g,f)=>{let{px:y,py:S,pz:l}=g;if(e.eql(l,e.ONE))return{x:y,y:S};let v=g.is0();f==null&&(f=v?e.ONE:e.inv(l));let L=e.mul(y,f),C=e.mul(S,f),I=e.mul(l,f);if(v)return{x:e.ZERO,y:e.ZERO};if(!e.eql(I,e.ONE))throw new Error("invZ was invalid");return{x:L,y:C}}),x=Qt(g=>{if(g.is0()){if(t.allowInfinityPoint&&!e.is0(g.py))return;throw new Error("bad point: ZERO")}let{x:f,y}=g.toAffine();if(!e.isValid(f)||!e.isValid(y))throw new Error("bad point: x or y not FE");let S=e.sqr(y),l=i(f);if(!e.eql(S,l))throw new Error("bad point: equation left != right");if(!g.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class p{constructor(f,y,S){if(this.px=f,this.py=y,this.pz=S,f==null||!e.isValid(f))throw new Error("x required");if(y==null||!e.isValid(y))throw new Error("y required");if(S==null||!e.isValid(S))throw new Error("z required");Object.freeze(this)}static fromAffine(f){let{x:y,y:S}=f||{};if(!f||!e.isValid(y)||!e.isValid(S))throw new Error("invalid affine point");if(f instanceof p)throw new Error("projective point not allowed");let l=v=>e.eql(v,e.ZERO);return l(y)&&l(S)?p.ZERO:new p(y,S,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(f){let y=e.invertBatch(f.map(S=>S.pz));return f.map((S,l)=>S.toAffine(y[l])).map(p.fromAffine)}static fromHex(f){let y=p.fromAffine(s(G("pointHex",f)));return y.assertValidity(),y}static fromPrivateKey(f){return p.BASE.multiply(a(f))}static msm(f,y){return $e(p,n,f,y)}_setWindowSize(f){w.setWindowSize(this,f)}assertValidity(){x(this)}hasEvenY(){let{y:f}=this.toAffine();if(e.isOdd)return!e.isOdd(f);throw new Error("Field doesn't support isOdd")}equals(f){d(f);let{px:y,py:S,pz:l}=this,{px:v,py:L,pz:C}=f,I=e.eql(e.mul(y,C),e.mul(v,l)),R=e.eql(e.mul(S,C),e.mul(L,l));return I&&R}negate(){return new p(this.px,e.neg(this.py),this.pz)}double(){let{a:f,b:y}=t,S=e.mul(y,Wo),{px:l,py:v,pz:L}=this,C=e.ZERO,I=e.ZERO,R=e.ZERO,A=e.mul(l,l),F=e.mul(v,v),z=e.mul(L,L),O=e.mul(l,v);return O=e.add(O,O),R=e.mul(l,L),R=e.add(R,R),C=e.mul(f,R),I=e.mul(S,z),I=e.add(C,I),C=e.sub(F,I),I=e.add(F,I),I=e.mul(C,I),C=e.mul(O,C),R=e.mul(S,R),z=e.mul(f,z),O=e.sub(A,z),O=e.mul(f,O),O=e.add(O,R),R=e.add(A,A),A=e.add(R,A),A=e.add(A,z),A=e.mul(A,O),I=e.add(I,A),z=e.mul(v,L),z=e.add(z,z),A=e.mul(z,O),C=e.sub(C,A),R=e.mul(z,F),R=e.add(R,R),R=e.add(R,R),new p(C,I,R)}add(f){d(f);let{px:y,py:S,pz:l}=this,{px:v,py:L,pz:C}=f,I=e.ZERO,R=e.ZERO,A=e.ZERO,F=t.a,z=e.mul(t.b,Wo),O=e.mul(y,v),Y=e.mul(S,L),E=e.mul(l,C),T=e.add(y,S),m=e.add(v,L);T=e.mul(T,m),m=e.add(O,Y),T=e.sub(T,m),m=e.add(y,l);let h=e.add(v,C);return m=e.mul(m,h),h=e.add(O,E),m=e.sub(m,h),h=e.add(S,l),I=e.add(L,C),h=e.mul(h,I),I=e.add(Y,E),h=e.sub(h,I),A=e.mul(F,m),I=e.mul(z,E),A=e.add(I,A),I=e.sub(Y,A),A=e.add(Y,A),R=e.mul(I,A),Y=e.add(O,O),Y=e.add(Y,O),E=e.mul(F,E),m=e.mul(z,m),Y=e.add(Y,E),E=e.sub(O,E),E=e.mul(F,E),m=e.add(m,E),O=e.mul(Y,m),R=e.add(R,O),O=e.mul(h,m),I=e.mul(T,I),I=e.sub(I,O),O=e.mul(T,Y),A=e.mul(h,A),A=e.add(A,O),new p(I,R,A)}subtract(f){return this.add(f.negate())}is0(){return this.equals(p.ZERO)}wNAF(f){return w.wNAFCached(this,f,p.normalizeZ)}multiplyUnsafe(f){let{endo:y,n:S}=t;at("scalar",f,Lt,S);let l=p.ZERO;if(f===Lt)return l;if(this.is0()||f===J)return this;if(!y||w.hasPrecomputes(this))return w.wNAFCachedUnsafe(this,f,p.normalizeZ);let{k1neg:v,k1:L,k2neg:C,k2:I}=y.splitScalar(f),R=l,A=l,F=this;for(;L>Lt||I>Lt;)L&J&&(R=R.add(F)),I&J&&(A=A.add(F)),F=F.double(),L>>=J,I>>=J;return v&&(R=R.negate()),C&&(A=A.negate()),A=new p(e.mul(A.px,y.beta),A.py,A.pz),R.add(A)}multiply(f){let{endo:y,n:S}=t;at("scalar",f,J,S);let l,v;if(y){let{k1neg:L,k1:C,k2neg:I,k2:R}=y.splitScalar(f),{p:A,f:F}=this.wNAF(C),{p:z,f:O}=this.wNAF(R);A=w.constTimeNegate(L,A),z=w.constTimeNegate(I,z),z=new p(e.mul(z.px,y.beta),z.py,z.pz),l=A.add(z),v=F.add(O)}else{let{p:L,f:C}=this.wNAF(f);l=L,v=C}return p.normalizeZ([l,v])[0]}multiplyAndAddUnsafe(f,y,S){let l=p.BASE,v=(C,I)=>I===Lt||I===J||!C.equals(l)?C.multiplyUnsafe(I):C.multiply(I),L=v(this,y).add(v(f,S));return L.is0()?void 0:L}toAffine(f){return u(this,f)}isTorsionFree(){let{h:f,isTorsionFree:y}=t;if(f===J)return!0;if(y)return y(p,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:f,clearCofactor:y}=t;return f===J?this:y?y(p,this):this.multiplyUnsafe(t.h)}toRawBytes(f=!0){return pt("isCompressed",f),this.assertValidity(),o(p,this,f)}toHex(f=!0){return pt("isCompressed",f),It(this.toRawBytes(f))}}p.BASE=new p(t.Gx,t.Gy,e.ONE),p.ZERO=new p(e.ZERO,e.ONE,e.ZERO);let _=t.nBitLength,w=We(p,t.endo?Math.ceil(_/2):_);return{CURVE:t,ProjectivePoint:p,normPrivateKeyToScalar:a,weierstrassEquation:i,isWithinCurveOrder:c}}function sa(r){let t=Ae(r);return yt(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function $o(r){let t=sa(r),{Fp:e,n}=t,o=e.BYTES+1,s=2*e.BYTES+1;function i(E){return H(E,n)}function c(E){return Ye(E,n)}let{ProjectivePoint:a,normPrivateKeyToScalar:d,weierstrassEquation:u,isWithinCurveOrder:x}=oa({...t,toBytes(E,T,m){let h=T.toAffine(),b=e.toBytes(h.x),B=Tt;return pt("isCompressed",m),m?B(Uint8Array.from([T.hasEvenY()?2:3]),b):B(Uint8Array.from([4]),b,e.toBytes(h.y))},fromBytes(E){let T=E.length,m=E[0],h=E.subarray(1);if(T===o&&(m===2||m===3)){let b=At(h);if(!ve(b,J,e.ORDER))throw new Error("Point is not on curve");let B=u(b),U;try{U=e.sqrt(B)}catch(P){let M=P instanceof Error?": "+P.message:"";throw new Error("Point is not on curve"+M)}let N=(U&J)===J;return(m&1)===1!==N&&(U=e.neg(U)),{x:b,y:U}}else if(T===s&&m===4){let b=e.fromBytes(h.subarray(0,e.BYTES)),B=e.fromBytes(h.subarray(e.BYTES,2*e.BYTES));return{x:b,y:B}}else{let b=o,B=s;throw new Error("invalid Point, expected length of "+b+", or uncompressed "+B+", got "+T)}}}),p=E=>It(Ot(E,t.nByteLength));function _(E){let T=n>>J;return E>T}function w(E){return _(E)?i(-E):E}let g=(E,T,m)=>At(E.slice(T,m));class f{constructor(T,m,h){this.r=T,this.s=m,this.recovery=h,this.assertValidity()}static fromCompact(T){let m=t.nByteLength;return T=G("compactSignature",T,m*2),new f(g(T,0,m),g(T,m,2*m))}static fromDER(T){let{r:m,s:h}=Ct.toSig(G("DER",T));return new f(m,h)}assertValidity(){at("r",this.r,J,n),at("s",this.s,J,n)}addRecoveryBit(T){return new f(this.r,this.s,T)}recoverPublicKey(T){let{r:m,s:h,recovery:b}=this,B=C(G("msgHash",T));if(b==null||![0,1,2,3].includes(b))throw new Error("recovery id invalid");let U=b===2||b===3?m+t.n:m;if(U>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");let N=b&1?"03":"02",D=a.fromHex(N+p(U)),P=c(U),M=i(-B*P),K=i(h*P),q=a.BASE.multiplyAndAddUnsafe(D,M,K);if(!q)throw new Error("point at infinify");return q.assertValidity(),q}hasHighS(){return _(this.s)}normalizeS(){return this.hasHighS()?new f(this.r,i(-this.s),this.recovery):this}toDERRawBytes(){return Wt(this.toDERHex())}toDERHex(){return Ct.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Wt(this.toCompactHex())}toCompactHex(){return p(this.r)+p(this.s)}}let y={isValidPrivateKey(E){try{return d(E),!0}catch{return!1}},normPrivateKeyToScalar:d,randomPrivateKey:()=>{let E=qr(t.n);return go(t.randomBytes(E),t.n)},precompute(E=8,T=a.BASE){return T._setWindowSize(E),T.multiply(BigInt(3)),T}};function S(E,T=!0){return a.fromPrivateKey(E).toRawBytes(T)}function l(E){let T=kt(E),m=typeof E=="string",h=(T||m)&&E.length;return T?h===o||h===s:m?h===2*o||h===2*s:E instanceof a}function v(E,T,m=!0){if(l(E))throw new Error("first arg must be private key");if(!l(T))throw new Error("second arg must be public key");return a.fromHex(T).multiply(d(E)).toRawBytes(m)}let L=t.bits2int||function(E){if(E.length>8192)throw new Error("input is too large");let T=At(E),m=E.length*8-t.nBitLength;return m>0?T>>BigInt(m):T},C=t.bits2int_modN||function(E){return i(L(E))},I=Ie(t.nBitLength);function R(E){return at("num < 2^"+t.nBitLength,E,Lt,I),Ot(E,t.nByteLength)}function A(E,T,m=F){if(["recovered","canonical"].some(Q=>Q in m))throw new Error("sign() legacy options not supported");let{hash:h,randomBytes:b}=t,{lowS:B,prehash:U,extraEntropy:N}=m;B==null&&(B=!0),E=G("msgHash",E),Xo(m),U&&(E=G("prehashed msgHash",h(E)));let D=C(E),P=d(T),M=[R(P),R(D)];if(N!=null&&N!==!1){let Q=N===!0?b(e.BYTES):N;M.push(G("extraEntropy",Q))}let K=Tt(...M),q=D;function $(Q){let tt=L(Q);if(!x(tt))return;let et=c(tt),it=a.BASE.multiply(tt).toAffine(),nt=i(it.x);if(nt===Lt)return;let bt=i(et*i(q+nt*P));if(bt===Lt)return;let Et=(it.x===nt?0:2)|Number(it.y&J),xe=bt;return B&&_(bt)&&(xe=w(bt),Et^=1),new f(nt,xe,Et)}return{seed:K,k2sig:$}}let F={lowS:t.lowS,prehash:!1},z={lowS:t.lowS,prehash:!1};function O(E,T,m=F){let{seed:h,k2sig:b}=A(E,T,m),B=t;return Pr(B.hash.outputLen,B.nByteLength,B.hmac)(h,b)}a.BASE._setWindowSize(8);function Y(E,T,m,h=z){let b=E;T=G("msgHash",T),m=G("publicKey",m);let{lowS:B,prehash:U,format:N}=h;if(Xo(h),"strict"in h)throw new Error("options.strict was renamed to lowS");if(N!==void 0&&N!=="compact"&&N!=="der")throw new Error("format must be compact or der");let D=typeof b=="string"||kt(b),P=!D&&!N&&typeof b=="object"&&b!==null&&typeof b.r=="bigint"&&typeof b.s=="bigint";if(!D&&!P)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let M,K;try{if(P&&(M=new f(b.r,b.s)),D){try{N!=="compact"&&(M=f.fromDER(b))}catch(Et){if(!(Et instanceof Ct.Err))throw Et}!M&&N!=="der"&&(M=f.fromCompact(b))}K=a.fromHex(m)}catch{return!1}if(!M||B&&M.hasHighS())return!1;U&&(T=t.hash(T));let{r:q,s:$}=M,Q=C(T),tt=c($),et=i(Q*tt),it=i(q*tt),nt=a.BASE.multiplyAndAddUnsafe(K,et,it)?.toAffine();return nt?i(nt.x)===q:!1}return{CURVE:t,getPublicKey:S,getSharedSecret:v,sign:O,verify:Y,ProjectivePoint:a,Signature:f,utils:y}}function ia(r){return{hash:r,hmac:(t,...e)=>Sn(r,t,Lr(...e)),randomBytes:Fe}}function Qo(r,t){let e=n=>$o({...r,...ia(n)});return{...e(t),create:e}}var es=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Jo=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),ca=BigInt(1),vn=BigInt(2),ts=(r,t)=>(r+t/vn)/t;function aa(r){let t=es,e=BigInt(3),n=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),c=BigInt(44),a=BigInt(88),d=r*r*r%t,u=d*d*r%t,x=Z(u,e,t)*u%t,p=Z(x,e,t)*u%t,_=Z(p,vn,t)*d%t,w=Z(_,o,t)*_%t,g=Z(w,s,t)*w%t,f=Z(g,c,t)*g%t,y=Z(f,a,t)*f%t,S=Z(y,c,t)*g%t,l=Z(S,e,t)*u%t,v=Z(l,i,t)*w%t,L=Z(v,n,t)*d%t,C=Z(L,vn,t);if(!In.eql(In.sqr(C),r))throw new Error("Cannot find square root");return C}var In=Pt(es,void 0,void 0,{sqrt:aa}),re=Qo({a:BigInt(0),b:BigInt(7),Fp:In,n:Jo,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:r=>{let t=Jo,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-ca*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=e,i=BigInt("0x100000000000000000000000000000000"),c=ts(s*r,t),a=ts(-n*r,t),d=H(r-c*e-a*o,t),u=H(-c*n-a*s,t),x=d>i,p=u>i;if(x&&(d=t-d),p&&(u=t-u),d>i||u>i)throw new Error("splitScalar: Endomorphism failed, k="+r);return{k1neg:x,k1:d,k2neg:p,k2:u}}}},Yo),lh=BigInt(0);var dh=re.ProjectivePoint;function rs(r){return r==null?!1:typeof r.then=="function"&&typeof r.catch=="function"&&typeof r.finally=="function"}function ns(r,t,e){let n=Re.digest(e instanceof Uint8Array?e:e.subarray());if(rs(n))return n.then(({digest:o})=>re.verify(t,o,r)).catch(o=>{throw new Ne(String(o))});try{return re.verify(t,n.digest,r)}catch(o){throw new Ne(String(o))}}var hr=class{type="secp256k1";raw;_key;constructor(t){this._key=ss(t),this.raw=os(this._key)}toMultihash(){return St.digest(er(this))}toCID(){return lt.createV1(114,this.toMultihash())}toString(){return X.encode(this.toMultihash().bytes).substring(1)}equals(t){return t==null||!(t.raw instanceof Uint8Array)?!1:Bt(this.raw,t.raw)}verify(t,e){return ns(this._key,e,t)}};function is(r){return new hr(r)}function os(r){return re.ProjectivePoint.fromHex(r).toRawBytes(!0)}function ss(r){try{return re.ProjectivePoint.fromHex(r),r}catch(t){throw new Pe(String(t))}}function cs(r){let{Type:t,Data:e}=Ue.decode(r.digest),n=e??new Uint8Array;switch(t){case ht.Ed25519:return Ao(n);case ht.secp256k1:return is(n);default:throw new be}}function er(r){return Ue.encode({Type:ht[r.type],Data:r.raw})}var as=Symbol.for("nodejs.util.inspect.custom"),ua=114,Me=class{type;multihash;publicKey;string;constructor(t){this.type=t.type,this.multihash=t.multihash,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}[wr]=!0;toString(){return this.string==null&&(this.string=X.encode(this.multihash.bytes).slice(1)),this.string}toMultihash(){return this.multihash}toCID(){return lt.createV1(ua,this.multihash)}toJSON(){return this.toString()}equals(t){if(t==null)return!1;if(t instanceof Uint8Array)return Bt(this.multihash.bytes,t);if(typeof t=="string")return this.toString()===t;if(t?.toMultihash()?.bytes!=null)return Bt(this.multihash.bytes,t.toMultihash().bytes);throw new Error("not valid Id")}[as](){return`PeerId(${this.toString()})`}},lr=class extends Me{type="RSA";publicKey;constructor(t){super({...t,type:"RSA"}),this.publicKey=t.publicKey}},dr=class extends Me{type="Ed25519";publicKey;constructor(t){super({...t,type:"Ed25519"}),this.publicKey=t.publicKey}},pr=class extends Me{type="secp256k1";publicKey;constructor(t){super({...t,type:"secp256k1"}),this.publicKey=t.publicKey}},fa=2336,mr=class{type="url";multihash;publicKey;url;constructor(t){this.url=t.toString(),this.multihash=St.digest(st(this.url))}[as](){return`PeerId(${this.url})`}[wr]=!0;toString(){return this.toCID().toString()}toMultihash(){return this.multihash}toCID(){return lt.createV1(fa,this.toMultihash())}toJSON(){return this.toString()}equals(t){return t==null?!1:(t instanceof Uint8Array&&(t=ur(t)),t.toString()===this.toString())}};function us(r){if(la(r))return new lr({multihash:r});if(ha(r))try{let t=cs(r);if(t.type==="Ed25519")return new dr({multihash:r,publicKey:t});if(t.type==="secp256k1")return new pr({multihash:r,publicKey:t})}catch{let e=ur(r.digest);return new mr(new URL(e))}throw new ze("Supplied PeerID Multihash is invalid")}function ha(r){return r.code===St.code}function la(r){return r.code===Re.code}function wt(r,t){let e={[Symbol.iterator]:()=>e,next:()=>{let n=r.next(),o=n.value;return n.done===!0||o==null?{done:!0,value:void 0}:{done:!1,value:t(o)}}};return e}function xr(r){let t=_e(X.decode(`z${r}`));return us(t)}var Ft=class{map;constructor(t){if(this.map=new Map,t!=null)for(let[e,n]of t.entries())this.map.set(e.toString(),{key:e,value:n})}[Symbol.iterator](){return this.entries()}clear(){this.map.clear()}delete(t){return this.map.delete(t.toString())}entries(){return wt(this.map.entries(),t=>[t[1].key,t[1].value])}forEach(t){this.map.forEach((e,n)=>{t(e.value,e.key,this)})}get(t){return this.map.get(t.toString())?.value}has(t){return this.map.has(t.toString())}set(t,e){this.map.set(t.toString(),{key:t,value:e})}keys(){return wt(this.map.values(),t=>t.key)}values(){return wt(this.map.values(),t=>t.value)}get size(){return this.map.size}};function fs(){return new Ft}var Vt=class r{set;constructor(t){if(this.set=new Set,t!=null)for(let e of t)this.set.add(e.toString())}get size(){return this.set.size}[Symbol.iterator](){return this.values()}add(t){this.set.add(t.toString())}clear(){this.set.clear()}delete(t){this.set.delete(t.toString())}entries(){return wt(this.set.entries(),t=>{let e=xr(t[0]);return[e,e]})}forEach(t){this.set.forEach(e=>{let n=xr(e);t(n,n,this)})}has(t){return this.set.has(t.toString())}values(){return wt(this.set.values(),t=>xr(t))}intersection(t){let e=new r;for(let n of t)this.has(n)&&e.add(n);return e}difference(t){let e=new r;for(let n of this)t.has(n)||e.add(n);return e}union(t){let e=new r;for(let n of t)e.add(n);for(let n of this)e.add(n);return e}};function hs(){return new Vt}var Zt=class r{list;constructor(t){if(this.list=[],t!=null)for(let e of t)this.list.push(e)}[Symbol.iterator](){return wt(this.list.entries(),t=>t[1])}concat(t){let e=new r(this);for(let n of t)e.push(n);return e}entries(){return wt(this.list.entries(),t=>[t[0],t[1]])}every(t){return this.list.every((e,n)=>t(e,n,this))}filter(t){let e=new r;return this.list.forEach((n,o)=>{t(n,o,this)&&e.push(n)}),e}find(t){let e=this.list.find((n,o)=>t(n,o,this));if(e!=null)return e}findIndex(t){return this.list.findIndex((e,n)=>t(e,n,this))}forEach(t){this.list.forEach((e,n)=>{t(e,n,this)})}includes(t){return this.includes(t)}indexOf(t){return this.list.findIndex(e=>e.equals(t))}pop(){let t=this.list.pop();if(t!=null)return t}push(...t){for(let e of t)this.list.push(e)}shift(){let t=this.list.shift();if(t!=null)return t}unshift(...t){let e=this.list.length;for(let n=t.length-1;n>-1;n--)e=this.list.unshift(t[n]);return e}clear(){this.list=[]}get length(){return this.list.length}};function ls(){return new Zt}var An={32:16777619n,64:1099511628211n,128:309485009821345068724781371n,256:374144419156711147060143317175368453031918731002211n,512:35835915874844867368919076489095108449946327955754392558399825615420669938882575126094039892345713852759n,1024:5016456510113118655434598811035278955030765345404790744303017523831112055108147451509157692220295382716162651878526895249385292291816524375083746691371804094271873160484737966720260389217684476157468082573n},ds={32:2166136261n,64:14695981039346656037n,128:144066263297769815596495629667062367629n,256:100029257958052580907070968620625704837092796014241193945225284501741471925557n,512:9659303129496669498009435400716310466090418745672637896108374329434462657994582932197716438449813051892206539805784495328239340083876191928701583869517785n,1024:14197795064947621068722070641403218320880622795441933960878474914617582723252296732303717722150864096521202355549365628174669108571814760471015076148029755969804077320157692458563003215304957150157403644460363550505412711285966361610267868082893823963790439336411086884584107735010676915n},ps=new globalThis.TextEncoder;function da(r,t){let e=An[t],n=ds[t];for(let o=0;o<r.length;o++)n^=BigInt(r[o]),n=BigInt.asUintN(t,n*e);return n}function pa(r,t,e){if(e.length===0)throw new Error("The `utf8Buffer` option must have a length greater than zero");let n=An[t],o=ds[t],s=r;for(;s.length>0;){let i=ps.encodeInto(s,e);s=s.slice(i.read);for(let c=0;c<i.written;c++)o^=BigInt(e[c]),o=BigInt.asUintN(t,o*n)}return o}function Tn(r,{size:t=32,utf8Buffer:e}={}){if(!An[t])throw new Error("The `size` option must be one of 32, 64, 128, 256, 512, or 1024");if(typeof r=="string"){if(e)return pa(r,t,e);r=ps.encode(r)}return da(r,t)}var ke={hash:r=>Number(Tn(r,{size:32})),hashV:(r,t)=>ma(ke.hash(r,t))};function ma(r){let t=r.toString(16);return t.length%2===1&&(t=`0${t}`),st(t,"base16")}var Rn=64,gt=class{fp;h;seed;constructor(t,e,n,o=2){if(o>Rn)throw new TypeError("Invalid Fingerprint Size");let s=e.hashV(t,n),i=To(o);for(let c=0;c<i.length;c++)i[c]=s[c];i.length===0&&(i[0]=7),this.fp=i,this.h=e,this.seed=n}hash(){return this.h.hash(this.fp,this.seed)}equals(t){return t?.fp instanceof Uint8Array?Bt(this.fp,t.fp):!1}};function ne(r,t){return Math.floor(Math.random()*(t-r))+r}var oe=class{contents;constructor(t){this.contents=new Array(t).fill(null)}has(t){if(!(t instanceof gt))throw new TypeError("Invalid Fingerprint");return this.contents.some(e=>t.equals(e))}add(t){if(!(t instanceof gt))throw new TypeError("Invalid Fingerprint");for(let e=0;e<this.contents.length;e++)if(this.contents[e]==null)return this.contents[e]=t,!0;return!0}swap(t){if(!(t instanceof gt))throw new TypeError("Invalid Fingerprint");let e=ne(0,this.contents.length-1),n=this.contents[e];return this.contents[e]=t,n}remove(t){if(!(t instanceof gt))throw new TypeError("Invalid Fingerprint");let e=this.contents.findIndex(n=>t.equals(n));return e>-1?(this.contents[e]=null,!0):!1}};var xa=500,De=class{bucketSize;filterSize;fingerprintSize;buckets;count;hash;seed;constructor(t){this.filterSize=t.filterSize,this.bucketSize=t.bucketSize??4,this.fingerprintSize=t.fingerprintSize??2,this.count=0,this.buckets=[],this.hash=t.hash??ke,this.seed=t.seed??ne(0,Math.pow(2,10))}add(t){typeof t=="string"&&(t=st(t));let e=new gt(t,this.hash,this.seed,this.fingerprintSize),n=this.hash.hash(t,this.seed)%this.filterSize,o=(n^e.hash())%this.filterSize;if(this.buckets[n]==null&&(this.buckets[n]=new oe(this.bucketSize)),this.buckets[o]==null&&(this.buckets[o]=new oe(this.bucketSize)),this.buckets[n].add(e)||this.buckets[o].add(e))return this.count++,!0;let s=[n,o],i=s[ne(0,s.length-1)];this.buckets[i]==null&&(this.buckets[i]=new oe(this.bucketSize));for(let c=0;c<xa;c++){let a=this.buckets[i].swap(e);if(a!=null&&(i=(i^a.hash())%this.filterSize,this.buckets[i]==null&&(this.buckets[i]=new oe(this.bucketSize)),this.buckets[i].add(a)))return this.count++,!0}return!1}has(t){typeof t=="string"&&(t=st(t));let e=new gt(t,this.hash,this.seed,this.fingerprintSize),n=this.hash.hash(t,this.seed)%this.filterSize,o=this.buckets[n]?.has(e)??!1;if(o)return o;let s=(n^e.hash())%this.filterSize;return this.buckets[s]?.has(e)??!1}remove(t){typeof t=="string"&&(t=st(t));let e=new gt(t,this.hash,this.seed,this.fingerprintSize),n=this.hash.hash(t,this.seed)%this.filterSize,o=this.buckets[n]?.remove(e)??!1;if(o)return this.count--,o;let s=(n^e.hash())%this.filterSize,i=this.buckets[s]?.remove(e)??!1;return i&&this.count--,i}get reliable(){return Math.floor(100*(this.count/this.filterSize))<=90}},ga={1:.5,2:.84,4:.95,8:.98};function ba(r=.001){return r>.002?2:r>1e-5?4:8}function ms(r,t=.001){let e=ba(t),n=ga[e],o=Math.round(r/n),s=Math.min(Math.ceil(Math.log2(1/t)+Math.log2(2*e)),Rn);return{filterSize:o,bucketSize:e,fingerprintSize:s}}var gr=class{filterSize;bucketSize;fingerprintSize;scale;filterSeries;hash;seed;constructor(t){this.bucketSize=t.bucketSize??4,this.filterSize=t.filterSize??(1<<18)/this.bucketSize,this.fingerprintSize=t.fingerprintSize??2,this.scale=t.scale??2,this.hash=t.hash??ke,this.seed=t.seed??ne(0,Math.pow(2,10)),this.filterSeries=[new De({filterSize:this.filterSize,bucketSize:this.bucketSize,fingerprintSize:this.fingerprintSize,hash:this.hash,seed:this.seed})]}add(t){if(typeof t=="string"&&(t=st(t)),this.has(t))return!0;let e=this.filterSeries.find(n=>n.reliable);if(e==null){let n=this.filterSize*Math.pow(this.scale,this.filterSeries.length);e=new De({filterSize:n,bucketSize:this.bucketSize,fingerprintSize:this.fingerprintSize,hash:this.hash,seed:this.seed}),this.filterSeries.push(e)}return e.add(t)}has(t){typeof t=="string"&&(t=st(t));for(let e=0;e<this.filterSeries.length;e++)if(this.filterSeries[e].has(t))return!0;return!1}remove(t){typeof t=="string"&&(t=st(t));for(let e=0;e<this.filterSeries.length;e++)if(this.filterSeries[e].remove(t))return!0;return!1}get count(){return this.filterSeries.reduce((t,e)=>t+e.count,0)}};function Cn(r,t=.001,e){return new gr({...ms(r,t),...e??{}})}var Oe=class{filter;constructor(t,e){this.filter=Cn(t,e)}has(t){return this.filter.has(t.toMultihash().bytes)}add(t){this.filter.add(t.toMultihash().bytes)}remove(t){this.filter.remove?.(t.toMultihash().bytes)}};function xs(r,t=.001){return new Oe(r,t)}var Ln=class extends Ft{metric;constructor(t){super();let{name:e,metrics:n}=t;this.metric=n.registerMetric(e),this.updateComponentMetric()}set(t,e){return super.set(t,e),this.updateComponentMetric(),this}delete(t){let e=super.delete(t);return this.updateComponentMetric(),e}clear(){super.clear(),this.updateComponentMetric()}updateComponentMetric(){this.metric.update(this.size)}};function gs(r){let{name:t,metrics:e}=r,n;return e!=null?n=new Ln({name:t,metrics:e}):n=new Ft,n}var Un=class extends Vt{metric;constructor(t){super();let{name:e,metrics:n}=t;this.metric=n.registerMetric(e),this.updateComponentMetric()}add(t){super.add(t),this.updateComponentMetric()}delete(t){super.delete(t),this.updateComponentMetric()}clear(){super.clear(),this.updateComponentMetric()}updateComponentMetric(){this.metric.update(this.size)}};function bs(r){let{name:t,metrics:e}=r,n;return e!=null?n=new Un({name:t,metrics:e}):n=new Vt,n}var Nn=class extends Zt{metric;constructor(t){super();let{name:e,metrics:n}=t;this.metric=n.registerMetric(e),this.updateComponentMetric()}pop(){let t=super.pop();return this.updateComponentMetric(),t}push(...t){super.push(...t),this.updateComponentMetric()}shift(){let t=super.shift();return this.updateComponentMetric(),t}unshift(...t){let e=super.unshift(...t);return this.updateComponentMetric(),e}clear(){super.clear(),this.updateComponentMetric()}updateComponentMetric(){this.metric.update(this.length)}};function ys(r){let{name:t,metrics:e}=r,n;return e!=null?n=new Nn({name:t,metrics:e}):n=new Zt,n}return Us(ya);})();
2
+ "use strict";var Libp2PPeerCollections=(()=>{var Mi=Object.create;var ze=Object.defineProperty;var Di=Object.getOwnPropertyDescriptor;var Oi=Object.getOwnPropertyNames;var Pi=Object.getPrototypeOf,zi=Object.prototype.hasOwnProperty;var Fn=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),ct=(r,t)=>{for(var e in t)ze(r,e,{get:t[e],enumerable:!0})},Vn=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Oi(t))!zi.call(r,o)&&o!==e&&ze(r,o,{get:()=>t[o],enumerable:!(n=Di(t,o))||n.enumerable});return r};var Hi=(r,t,e)=>(e=r!=null?Mi(Pi(r)):{},Vn(t||!r||!r.__esModule?ze(e,"default",{value:r,enumerable:!0}):e,r)),Ki=r=>Vn(ze({},"__esModule",{value:!0}),r);var gi=Fn((Me,wr)=>{(function(r,t){"use strict";var e={version:"3.0.0",x86:{},x64:{},inputValidation:!0};function n(s){if(!Array.isArray(s)&&!ArrayBuffer.isView(s))return!1;for(var l=0;l<s.length;l++)if(!Number.isInteger(s[l])||s[l]<0||s[l]>255)return!1;return!0}function o(s,l){return(s&65535)*l+(((s>>>16)*l&65535)<<16)}function i(s,l){return s<<l|s>>>32-l}function c(s){return s^=s>>>16,s=o(s,2246822507),s^=s>>>13,s=o(s,3266489909),s^=s>>>16,s}function a(s,l){s=[s[0]>>>16,s[0]&65535,s[1]>>>16,s[1]&65535],l=[l[0]>>>16,l[0]&65535,l[1]>>>16,l[1]&65535];var d=[0,0,0,0];return d[3]+=s[3]+l[3],d[2]+=d[3]>>>16,d[3]&=65535,d[2]+=s[2]+l[2],d[1]+=d[2]>>>16,d[2]&=65535,d[1]+=s[1]+l[1],d[0]+=d[1]>>>16,d[1]&=65535,d[0]+=s[0]+l[0],d[0]&=65535,[d[0]<<16|d[1],d[2]<<16|d[3]]}function f(s,l){s=[s[0]>>>16,s[0]&65535,s[1]>>>16,s[1]&65535],l=[l[0]>>>16,l[0]&65535,l[1]>>>16,l[1]&65535];var d=[0,0,0,0];return d[3]+=s[3]*l[3],d[2]+=d[3]>>>16,d[3]&=65535,d[2]+=s[2]*l[3],d[1]+=d[2]>>>16,d[2]&=65535,d[2]+=s[3]*l[2],d[1]+=d[2]>>>16,d[2]&=65535,d[1]+=s[1]*l[3],d[0]+=d[1]>>>16,d[1]&=65535,d[1]+=s[2]*l[2],d[0]+=d[1]>>>16,d[1]&=65535,d[1]+=s[3]*l[1],d[0]+=d[1]>>>16,d[1]&=65535,d[0]+=s[0]*l[3]+s[1]*l[2]+s[2]*l[1]+s[3]*l[0],d[0]&=65535,[d[0]<<16|d[1],d[2]<<16|d[3]]}function y(s,l){return l%=64,l===32?[s[1],s[0]]:l<32?[s[0]<<l|s[1]>>>32-l,s[1]<<l|s[0]>>>32-l]:(l-=32,[s[1]<<l|s[0]>>>32-l,s[0]<<l|s[1]>>>32-l])}function h(s,l){return l%=64,l===0?s:l<32?[s[0]<<l|s[1]>>>32-l,s[1]<<l]:[s[1]<<l-32,0]}function g(s,l){return[s[0]^l[0],s[1]^l[1]]}function _(s){return s=g(s,[0,s[0]>>>1]),s=f(s,[4283543511,3981806797]),s=g(s,[0,s[0]>>>1]),s=f(s,[3301882366,444984403]),s=g(s,[0,s[0]>>>1]),s}e.x86.hash32=function(s,l){if(e.inputValidation&&!n(s))return t;l=l||0;for(var d=s.length%4,x=s.length-d,p=l,m=0,u=3432918353,E=461845907,B=0;B<x;B=B+4)m=s[B]|s[B+1]<<8|s[B+2]<<16|s[B+3]<<24,m=o(m,u),m=i(m,15),m=o(m,E),p^=m,p=i(p,13),p=o(p,5)+3864292196;switch(m=0,d){case 3:m^=s[B+2]<<16;case 2:m^=s[B+1]<<8;case 1:m^=s[B],m=o(m,u),m=i(m,15),m=o(m,E),p^=m}return p^=s.length,p=c(p),p>>>0},e.x86.hash128=function(s,l){if(e.inputValidation&&!n(s))return t;l=l||0;for(var d=s.length%16,x=s.length-d,p=l,m=l,u=l,E=l,B=0,A=0,b=0,I=0,R=597399067,K=2869860233,P=951274213,O=2716044179,U=0;U<x;U=U+16)B=s[U]|s[U+1]<<8|s[U+2]<<16|s[U+3]<<24,A=s[U+4]|s[U+5]<<8|s[U+6]<<16|s[U+7]<<24,b=s[U+8]|s[U+9]<<8|s[U+10]<<16|s[U+11]<<24,I=s[U+12]|s[U+13]<<8|s[U+14]<<16|s[U+15]<<24,B=o(B,R),B=i(B,15),B=o(B,K),p^=B,p=i(p,19),p+=m,p=o(p,5)+1444728091,A=o(A,K),A=i(A,16),A=o(A,P),m^=A,m=i(m,17),m+=u,m=o(m,5)+197830471,b=o(b,P),b=i(b,17),b=o(b,O),u^=b,u=i(u,15),u+=E,u=o(u,5)+2530024501,I=o(I,O),I=i(I,18),I=o(I,R),E^=I,E=i(E,13),E+=p,E=o(E,5)+850148119;switch(B=0,A=0,b=0,I=0,d){case 15:I^=s[U+14]<<16;case 14:I^=s[U+13]<<8;case 13:I^=s[U+12],I=o(I,O),I=i(I,18),I=o(I,R),E^=I;case 12:b^=s[U+11]<<24;case 11:b^=s[U+10]<<16;case 10:b^=s[U+9]<<8;case 9:b^=s[U+8],b=o(b,P),b=i(b,17),b=o(b,O),u^=b;case 8:A^=s[U+7]<<24;case 7:A^=s[U+6]<<16;case 6:A^=s[U+5]<<8;case 5:A^=s[U+4],A=o(A,K),A=i(A,16),A=o(A,P),m^=A;case 4:B^=s[U+3]<<24;case 3:B^=s[U+2]<<16;case 2:B^=s[U+1]<<8;case 1:B^=s[U],B=o(B,R),B=i(B,15),B=o(B,K),p^=B}return p^=s.length,m^=s.length,u^=s.length,E^=s.length,p+=m,p+=u,p+=E,m+=p,u+=p,E+=p,p=c(p),m=c(m),u=c(u),E=c(E),p+=m,p+=u,p+=E,m+=p,u+=p,E+=p,("00000000"+(p>>>0).toString(16)).slice(-8)+("00000000"+(m>>>0).toString(16)).slice(-8)+("00000000"+(u>>>0).toString(16)).slice(-8)+("00000000"+(E>>>0).toString(16)).slice(-8)},e.x64.hash128=function(s,l){if(e.inputValidation&&!n(s))return t;l=l||0;for(var d=s.length%16,x=s.length-d,p=[0,l],m=[0,l],u=[0,0],E=[0,0],B=[2277735313,289559509],A=[1291169091,658871167],b=0;b<x;b=b+16)u=[s[b+4]|s[b+5]<<8|s[b+6]<<16|s[b+7]<<24,s[b]|s[b+1]<<8|s[b+2]<<16|s[b+3]<<24],E=[s[b+12]|s[b+13]<<8|s[b+14]<<16|s[b+15]<<24,s[b+8]|s[b+9]<<8|s[b+10]<<16|s[b+11]<<24],u=f(u,B),u=y(u,31),u=f(u,A),p=g(p,u),p=y(p,27),p=a(p,m),p=a(f(p,[0,5]),[0,1390208809]),E=f(E,A),E=y(E,33),E=f(E,B),m=g(m,E),m=y(m,31),m=a(m,p),m=a(f(m,[0,5]),[0,944331445]);switch(u=[0,0],E=[0,0],d){case 15:E=g(E,h([0,s[b+14]],48));case 14:E=g(E,h([0,s[b+13]],40));case 13:E=g(E,h([0,s[b+12]],32));case 12:E=g(E,h([0,s[b+11]],24));case 11:E=g(E,h([0,s[b+10]],16));case 10:E=g(E,h([0,s[b+9]],8));case 9:E=g(E,[0,s[b+8]]),E=f(E,A),E=y(E,33),E=f(E,B),m=g(m,E);case 8:u=g(u,h([0,s[b+7]],56));case 7:u=g(u,h([0,s[b+6]],48));case 6:u=g(u,h([0,s[b+5]],40));case 5:u=g(u,h([0,s[b+4]],32));case 4:u=g(u,h([0,s[b+3]],24));case 3:u=g(u,h([0,s[b+2]],16));case 2:u=g(u,h([0,s[b+1]],8));case 1:u=g(u,[0,s[b]]),u=f(u,B),u=y(u,31),u=f(u,A),p=g(p,u)}return p=g(p,[0,s.length]),m=g(m,[0,s.length]),p=a(p,m),m=a(m,p),p=_(p),m=_(m),p=a(p,m),m=a(m,p),("00000000"+(p[0]>>>0).toString(16)).slice(-8)+("00000000"+(p[1]>>>0).toString(16)).slice(-8)+("00000000"+(m[0]>>>0).toString(16)).slice(-8)+("00000000"+(m[1]>>>0).toString(16)).slice(-8)},typeof Me<"u"?(typeof wr<"u"&&wr.exports&&(Me=wr.exports=e),Me.murmurHash3=e):typeof define=="function"&&define.amd?define([],function(){return e}):(e._murmurHash3=r.murmurHash3,e.noConflict=function(){return r.murmurHash3=e._murmurHash3,e._murmurHash3=t,e.noConflict=t,e},r.murmurHash3=e)})(Me)});var wi=Fn((z0,bi)=>{bi.exports=gi()});var Ra={};ct(Ra,{PeerFilter:()=>Pe,PeerList:()=>Zt,PeerMap:()=>Ft,PeerSet:()=>Vt,peerFilter:()=>Si,peerList:()=>xi,peerMap:()=>pi,peerSet:()=>mi,trackedPeerList:()=>Ai,trackedPeerMap:()=>Bi,trackedPeerSet:()=>vi});var _r=Symbol.for("@libp2p/peer-id");var ge=class extends Error{static name="InvalidParametersError";constructor(t="Invalid parameters"){super(t),this.name="InvalidParametersError"}},He=class extends Error{static name="InvalidPublicKeyError";constructor(t="Invalid public key"){super(t),this.name="InvalidPublicKeyError"}};var Ke=class extends Error{static name="InvalidMultihashError";constructor(t="Invalid Multihash"){super(t),this.name="InvalidMultihashError"}};var be=class extends Error{static name="UnsupportedKeyTypeError";constructor(t="Unsupported key type"){super(t),this.name="UnsupportedKeyTypeError"}};var Ir={};ct(Ir,{base58btc:()=>X,base58flickr:()=>ji});var Na=new Uint8Array(0);function Zn(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}function _t(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 Gn(r){return new TextEncoder().encode(r)}function jn(r){return new TextDecoder().decode(r)}function qi(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var o=0;o<r.length;o++){var i=r.charAt(o),c=i.charCodeAt(0);if(e[c]!==255)throw new TypeError(i+" is ambiguous");e[c]=o}var a=r.length,f=r.charAt(0),y=Math.log(a)/Math.log(256),h=Math.log(256)/Math.log(a);function g(l){if(l instanceof Uint8Array||(ArrayBuffer.isView(l)?l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength):Array.isArray(l)&&(l=Uint8Array.from(l))),!(l instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(l.length===0)return"";for(var d=0,x=0,p=0,m=l.length;p!==m&&l[p]===0;)p++,d++;for(var u=(m-p)*h+1>>>0,E=new Uint8Array(u);p!==m;){for(var B=l[p],A=0,b=u-1;(B!==0||A<x)&&b!==-1;b--,A++)B+=256*E[b]>>>0,E[b]=B%a>>>0,B=B/a>>>0;if(B!==0)throw new Error("Non-zero carry");x=A,p++}for(var I=u-x;I!==u&&E[I]===0;)I++;for(var R=f.repeat(d);I<u;++I)R+=r.charAt(E[I]);return R}function _(l){if(typeof l!="string")throw new TypeError("Expected String");if(l.length===0)return new Uint8Array;var d=0;if(l[d]!==" "){for(var x=0,p=0;l[d]===f;)x++,d++;for(var m=(l.length-d)*y+1>>>0,u=new Uint8Array(m);l[d];){var E=e[l.charCodeAt(d)];if(E===255)return;for(var B=0,A=m-1;(E!==0||B<p)&&A!==-1;A--,B++)E+=a*u[A]>>>0,u[A]=E%256>>>0,E=E/256>>>0;if(E!==0)throw new Error("Non-zero carry");p=B,d++}if(l[d]!==" "){for(var b=m-p;b!==m&&u[b]===0;)b++;for(var I=new Uint8Array(x+(m-b)),R=x;b!==m;)I[R++]=u[b++];return I}}}function s(l){var d=_(l);if(d)return d;throw new Error(`Non-${t} character`)}return{encode:g,decodeUnsafe:_,decode:s}}var Fi=qi,Vi=Fi,Xn=Vi;var Sr=class{name;prefix;baseEncode;constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},Br=class{name;prefix;baseDecode;prefixCodePoint;constructor(t,e,n){this.name=t,this.prefix=e;let o=e.codePointAt(0);if(o===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=o,this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return Wn(this,t)}},vr=class{decoders;constructor(t){this.decoders=t}or(t){return Wn(this,t)}decode(t){let e=t[0],n=this.decoders[e];if(n!=null)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function Wn(r,t){return new vr({...r.decoders??{[r.prefix]:r},...t.decoders??{[t.prefix]:t}})}var Ar=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(t,e,n,o){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=o,this.encoder=new Sr(t,e,n),this.decoder=new Br(t,e,o)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};function ie({name:r,prefix:t,encode:e,decode:n}){return new Ar(r,t,e,n)}function Ut({name:r,prefix:t,alphabet:e}){let{encode:n,decode:o}=Xn(e,r);return ie({prefix:t,name:r,encode:n,decode:i=>_t(o(i))})}function Zi(r,t,e,n){let o={};for(let h=0;h<t.length;++h)o[t[h]]=h;let i=r.length;for(;r[i-1]==="=";)--i;let c=new Uint8Array(i*e/8|0),a=0,f=0,y=0;for(let h=0;h<i;++h){let g=o[r[h]];if(g===void 0)throw new SyntaxError(`Non-${n} character`);f=f<<e|g,a+=e,a>=8&&(a-=8,c[y++]=255&f>>a)}if(a>=e||255&f<<8-a)throw new SyntaxError("Unexpected end of data");return c}function Gi(r,t,e){let n=t[t.length-1]==="=",o=(1<<e)-1,i="",c=0,a=0;for(let f=0;f<r.length;++f)for(a=a<<8|r[f],c+=8;c>e;)c-=e,i+=t[o&a>>c];if(c!==0&&(i+=t[o&a<<e-c]),n)for(;i.length*e&7;)i+="=";return i}function Y({name:r,prefix:t,bitsPerChar:e,alphabet:n}){return ie({prefix:t,name:r,encode(o){return Gi(o,n,e)},decode(o){return Zi(o,n,e,r)}})}var X=Ut({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),ji=Ut({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Tr={};ct(Tr,{base32:()=>se,base32hex:()=>$i,base32hexpad:()=>Ji,base32hexpadupper:()=>ts,base32hexupper:()=>Qi,base32pad:()=>Xi,base32padupper:()=>Wi,base32upper:()=>Yi,base32z:()=>es});var se=Y({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Yi=Y({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Xi=Y({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Wi=Y({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),$i=Y({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Qi=Y({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Ji=Y({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),ts=Y({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),es=Y({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Rr={};ct(Rr,{base36:()=>we,base36upper:()=>rs});var we=Ut({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),rs=Ut({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var ns=Jn,$n=128,os=127,is=~os,ss=Math.pow(2,31);function Jn(r,t,e){t=t||[],e=e||0;for(var n=e;r>=ss;)t[e++]=r&255|$n,r/=128;for(;r&is;)t[e++]=r&255|$n,r>>>=7;return t[e]=r|0,Jn.bytes=e-n+1,t}var cs=Cr,as=128,Qn=127;function Cr(r,n){var e=0,n=n||0,o=0,i=n,c,a=r.length;do{if(i>=a)throw Cr.bytes=0,new RangeError("Could not decode varint");c=r[i++],e+=o<28?(c&Qn)<<o:(c&Qn)*Math.pow(2,o),o+=7}while(c>=as);return Cr.bytes=i-n,e}var fs=Math.pow(2,7),us=Math.pow(2,14),hs=Math.pow(2,21),ls=Math.pow(2,28),ds=Math.pow(2,35),ps=Math.pow(2,42),ms=Math.pow(2,49),xs=Math.pow(2,56),gs=Math.pow(2,63),bs=function(r){return r<fs?1:r<us?2:r<hs?3:r<ls?4:r<ds?5:r<ps?6:r<ms?7:r<xs?8:r<gs?9:10},ws={encode:ns,decode:cs,encodingLength:bs},ys=ws,ye=ys;function Ee(r,t=0){return[ye.decode(r,t),ye.decode.bytes]}function ce(r,t,e=0){return ye.encode(r,t,e),t}function ae(r){return ye.encodingLength(r)}function Gt(r,t){let e=t.byteLength,n=ae(r),o=n+ae(e),i=new Uint8Array(o+e);return ce(r,i,0),ce(e,i,n),i.set(t,o),new fe(r,e,t,i)}function _e(r){let t=_t(r),[e,n]=Ee(t),[o,i]=Ee(t.subarray(n)),c=t.subarray(n+i);if(c.byteLength!==o)throw new Error("Incorrect length");return new fe(e,o,c,t)}function to(r,t){if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&Zn(r.bytes,e.bytes)}}var fe=class{code;size;digest;bytes;constructor(t,e,n,o){this.code=t,this.size=e,this.digest=n,this.bytes=o}};function eo(r,t){let{bytes:e,version:n}=r;switch(n){case 0:return _s(e,Lr(r),t??X.encoder);default:return Ss(e,Lr(r),t??se.encoder)}}var ro=new WeakMap;function Lr(r){let t=ro.get(r);if(t==null){let e=new Map;return ro.set(r,e),e}return t}var lt=class r{code;version;multihash;bytes;"/";constructor(t,e,n,o){this.code=e,this.version=t,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:t,multihash:e}=this;if(t!==Se)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==Bs)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(e)}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:t,digest:e}=this.multihash,n=Gt(t,e);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(t){return r.equals(this,t)}static equals(t,e){let n=e;return n!=null&&t.code===n.code&&t.version===n.version&&to(t.multihash,n.multihash)}toString(t){return eo(this,t)}toJSON(){return{"/":eo(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let e=t;if(e instanceof r)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:n,code:o,multihash:i,bytes:c}=e;return new r(n,o,i,c??no(n,o,i.bytes))}else if(e[vs]===!0){let{version:n,multihash:o,code:i}=e,c=_e(o);return r.create(n,i,c)}else return null}static create(t,e,n){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==Se)throw new Error(`Version 0 CID must use dag-pb (code: ${Se}) block encoding`);return new r(t,e,n,n.bytes)}case 1:{let o=no(t,e,n.bytes);return new r(t,e,n,o)}default:throw new Error("Invalid version")}}static createV0(t){return r.create(0,Se,t)}static createV1(t,e){return r.create(1,t,e)}static decode(t){let[e,n]=r.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=r.inspectBytes(t),n=e.size-e.multihashSize,o=_t(t.subarray(n,n+e.multihashSize));if(o.byteLength!==e.multihashSize)throw new Error("Incorrect length");let i=o.subarray(e.multihashSize-e.digestSize),c=new fe(e.multihashCode,e.digestSize,i,o);return[e.version===0?r.createV0(c):r.createV1(e.codec,c),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[g,_]=Ee(t.subarray(e));return e+=_,g},o=n(),i=Se;if(o===18?(o=0,e=0):i=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let c=e,a=n(),f=n(),y=e+f,h=y-c;return{version:o,codec:i,multihashCode:a,digestSize:f,multihashSize:h,size:y}}static parse(t,e){let[n,o]=Es(t,e),i=r.decode(o);if(i.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Lr(i).set(n,t),i}};function Es(r,t){switch(r[0]){case"Q":{let e=t??X;return[X.prefix,e.decode(`${X.prefix}${r}`)]}case X.prefix:{let e=t??X;return[X.prefix,e.decode(r)]}case se.prefix:{let e=t??se;return[se.prefix,e.decode(r)]}case we.prefix:{let e=t??we;return[we.prefix,e.decode(r)]}default:{if(t==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[r[0],t.decode(r)]}}}function _s(r,t,e){let{prefix:n}=e;if(n!==X.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let o=t.get(n);if(o==null){let i=e.encode(r).slice(1);return t.set(n,i),i}else return o}function Ss(r,t,e){let{prefix:n}=e,o=t.get(n);if(o==null){let i=e.encode(r);return t.set(n,i),i}else return o}var Se=112,Bs=18;function no(r,t,e){let n=ae(r),o=n+ae(t),i=new Uint8Array(o+e.byteLength);return ce(r,i,0),ce(t,i,n),i.set(e,o),i}var vs=Symbol.for("@ipld/js-cid/CID");var Ur={};ct(Ur,{identity:()=>St});var oo=0,As="identity",io=_t;function Is(r){return Gt(oo,io(r))}var St={code:oo,name:As,encode:io,digest:Is};function Bt(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}function so(r){if(!Number.isSafeInteger(r)||r<0)throw new Error("positive integer expected, got "+r)}function Ts(r){return r instanceof Uint8Array||ArrayBuffer.isView(r)&&r.constructor.name==="Uint8Array"}function ue(r,...t){if(!Ts(r))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(r.length))throw new Error("Uint8Array expected of length "+t+", got length="+r.length)}function co(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");so(r.outputLen),so(r.blockLen)}function he(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function ao(r,t){ue(r);let e=t.outputLen;if(r.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}var Yt=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Fe(r){return new DataView(r.buffer,r.byteOffset,r.byteLength)}function dt(r,t){return r<<32-t|r>>>t}function fo(r){if(typeof r!="string")throw new Error("utf8ToBytes expected string, got "+typeof r);return new Uint8Array(new TextEncoder().encode(r))}function Be(r){return typeof r=="string"&&(r=fo(r)),ue(r),r}function Nr(...r){let t=0;for(let n=0;n<r.length;n++){let o=r[n];ue(o),t+=o.length}let e=new Uint8Array(t);for(let n=0,o=0;n<r.length;n++){let i=r[n];e.set(i,o),o+=i.length}return e}var le=class{clone(){return this._cloneInto()}};function Ve(r){let t=n=>r().update(Be(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function Ze(r=32){if(Yt&&typeof Yt.getRandomValues=="function")return Yt.getRandomValues(new Uint8Array(r));if(Yt&&typeof Yt.randomBytes=="function")return Yt.randomBytes(r);throw new Error("crypto.getRandomValues must be defined")}function Rs(r,t,e,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(t,e,n);let o=BigInt(32),i=BigInt(4294967295),c=Number(e>>o&i),a=Number(e&i),f=n?4:0,y=n?0:4;r.setUint32(t+f,c,n),r.setUint32(t+y,a,n)}function uo(r,t,e){return r&t^~r&e}function ho(r,t,e){return r&t^r&e^t&e}var de=class extends le{constructor(t,e,n,o){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=Fe(this.buffer)}update(t){he(this);let{view:e,buffer:n,blockLen:o}=this;t=Be(t);let i=t.length;for(let c=0;c<i;){let a=Math.min(o-this.pos,i-c);if(a===o){let f=Fe(t);for(;o<=i-c;c+=o)this.process(f,c);continue}n.set(t.subarray(c,c+a),this.pos),this.pos+=a,c+=a,this.pos===o&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){he(this),ao(t,this),this.finished=!0;let{buffer:e,view:n,blockLen:o,isLE:i}=this,{pos:c}=this;e[c++]=128,this.buffer.subarray(c).fill(0),this.padOffset>o-c&&(this.process(n,0),c=0);for(let g=c;g<o;g++)e[g]=0;Rs(n,o-8,BigInt(this.length*8),i),this.process(n,0);let a=Fe(t),f=this.outputLen;if(f%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let y=f/4,h=this.get();if(y>h.length)throw new Error("_sha2: outputLen bigger than state");for(let g=0;g<y;g++)a.setUint32(4*g,h[g],i)}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:e,buffer:n,length:o,finished:i,destroyed:c,pos:a}=this;return t.length=o,t.pos=a,t.finished=i,t.destroyed=c,o%e&&t.buffer.set(n),t}};var Ge=BigInt(4294967295),kr=BigInt(32);function lo(r,t=!1){return t?{h:Number(r&Ge),l:Number(r>>kr&Ge)}:{h:Number(r>>kr&Ge)|0,l:Number(r&Ge)|0}}function Cs(r,t=!1){let e=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let o=0;o<r.length;o++){let{h:i,l:c}=lo(r[o],t);[e[o],n[o]]=[i,c]}return[e,n]}var Ls=(r,t)=>BigInt(r>>>0)<<kr|BigInt(t>>>0),Us=(r,t,e)=>r>>>e,Ns=(r,t,e)=>r<<32-e|t>>>e,ks=(r,t,e)=>r>>>e|t<<32-e,Ms=(r,t,e)=>r<<32-e|t>>>e,Ds=(r,t,e)=>r<<64-e|t>>>e-32,Os=(r,t,e)=>r>>>e-32|t<<64-e,Ps=(r,t)=>t,zs=(r,t)=>r,Hs=(r,t,e)=>r<<e|t>>>32-e,Ks=(r,t,e)=>t<<e|r>>>32-e,qs=(r,t,e)=>t<<e-32|r>>>64-e,Fs=(r,t,e)=>r<<e-32|t>>>64-e;function Vs(r,t,e,n){let o=(t>>>0)+(n>>>0);return{h:r+e+(o/2**32|0)|0,l:o|0}}var Zs=(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),Gs=(r,t,e,n)=>t+e+n+(r/2**32|0)|0,js=(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),Ys=(r,t,e,n,o)=>t+e+n+o+(r/2**32|0)|0,Xs=(r,t,e,n,o)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(o>>>0),Ws=(r,t,e,n,o,i)=>t+e+n+o+i+(r/2**32|0)|0;var $s={fromBig:lo,split:Cs,toBig:Ls,shrSH:Us,shrSL:Ns,rotrSH:ks,rotrSL:Ms,rotrBH:Ds,rotrBL:Os,rotr32H:Ps,rotr32L:zs,rotlSH:Hs,rotlSL:Ks,rotlBH:qs,rotlBL:Fs,add:Vs,add3L:Zs,add3H:Gs,add4L:js,add4H:Ys,add5H:Ws,add5L:Xs},D=$s;var[Qs,Js]=D.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))),Nt=new Uint32Array(80),kt=new Uint32Array(80),Mr=class extends de{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:t,Al:e,Bh:n,Bl:o,Ch:i,Cl:c,Dh:a,Dl:f,Eh:y,El:h,Fh:g,Fl:_,Gh:s,Gl:l,Hh:d,Hl:x}=this;return[t,e,n,o,i,c,a,f,y,h,g,_,s,l,d,x]}set(t,e,n,o,i,c,a,f,y,h,g,_,s,l,d,x){this.Ah=t|0,this.Al=e|0,this.Bh=n|0,this.Bl=o|0,this.Ch=i|0,this.Cl=c|0,this.Dh=a|0,this.Dl=f|0,this.Eh=y|0,this.El=h|0,this.Fh=g|0,this.Fl=_|0,this.Gh=s|0,this.Gl=l|0,this.Hh=d|0,this.Hl=x|0}process(t,e){for(let u=0;u<16;u++,e+=4)Nt[u]=t.getUint32(e),kt[u]=t.getUint32(e+=4);for(let u=16;u<80;u++){let E=Nt[u-15]|0,B=kt[u-15]|0,A=D.rotrSH(E,B,1)^D.rotrSH(E,B,8)^D.shrSH(E,B,7),b=D.rotrSL(E,B,1)^D.rotrSL(E,B,8)^D.shrSL(E,B,7),I=Nt[u-2]|0,R=kt[u-2]|0,K=D.rotrSH(I,R,19)^D.rotrBH(I,R,61)^D.shrSH(I,R,6),P=D.rotrSL(I,R,19)^D.rotrBL(I,R,61)^D.shrSL(I,R,6),O=D.add4L(b,P,kt[u-7],kt[u-16]),U=D.add4H(O,A,K,Nt[u-7],Nt[u-16]);Nt[u]=U|0,kt[u]=O|0}let{Ah:n,Al:o,Bh:i,Bl:c,Ch:a,Cl:f,Dh:y,Dl:h,Eh:g,El:_,Fh:s,Fl:l,Gh:d,Gl:x,Hh:p,Hl:m}=this;for(let u=0;u<80;u++){let E=D.rotrSH(g,_,14)^D.rotrSH(g,_,18)^D.rotrBH(g,_,41),B=D.rotrSL(g,_,14)^D.rotrSL(g,_,18)^D.rotrBL(g,_,41),A=g&s^~g&d,b=_&l^~_&x,I=D.add5L(m,B,b,Js[u],kt[u]),R=D.add5H(I,p,E,A,Qs[u],Nt[u]),K=I|0,P=D.rotrSH(n,o,28)^D.rotrBH(n,o,34)^D.rotrBH(n,o,39),O=D.rotrSL(n,o,28)^D.rotrBL(n,o,34)^D.rotrBL(n,o,39),U=n&i^n&a^i&a,T=o&c^o&f^c&f;p=d|0,m=x|0,d=s|0,x=l|0,s=g|0,l=_|0,{h:g,l:_}=D.add(y|0,h|0,R|0,K|0),y=a|0,h=f|0,a=i|0,f=c|0,i=n|0,c=o|0;let L=D.add3L(K,O,T);n=D.add3H(L,R,P,U),o=L|0}({h:n,l:o}=D.add(this.Ah|0,this.Al|0,n|0,o|0)),{h:i,l:c}=D.add(this.Bh|0,this.Bl|0,i|0,c|0),{h:a,l:f}=D.add(this.Ch|0,this.Cl|0,a|0,f|0),{h:y,l:h}=D.add(this.Dh|0,this.Dl|0,y|0,h|0),{h:g,l:_}=D.add(this.Eh|0,this.El|0,g|0,_|0),{h:s,l}=D.add(this.Fh|0,this.Fl|0,s|0,l|0),{h:d,l:x}=D.add(this.Gh|0,this.Gl|0,d|0,x|0),{h:p,l:m}=D.add(this.Hh|0,this.Hl|0,p|0,m|0),this.set(n,o,i,c,a,f,y,h,g,_,s,l,d,x,p,m)}roundClean(){Nt.fill(0),kt.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var po=Ve(()=>new Mr);var Xe={};ct(Xe,{aInRange:()=>at,abool:()=>pt,abytes:()=>pe,bitGet:()=>ic,bitLen:()=>zr,bitMask:()=>Ae,bitSet:()=>sc,bytesToHex:()=>At,bytesToNumberBE:()=>It,bytesToNumberLE:()=>Dt,concatBytes:()=>Tt,createHmacDrbg:()=>Hr,ensureBytes:()=>j,equalBytes:()=>nc,hexToBytes:()=>Wt,hexToNumber:()=>Pr,inRange:()=>ve,isBytes:()=>Mt,memoized:()=>Qt,notImplemented:()=>ac,numberToBytesBE:()=>Ot,numberToBytesLE:()=>$t,numberToHexUnpadded:()=>Xt,numberToVarBytesBE:()=>rc,utf8ToBytes:()=>oc,validateObject:()=>wt});var je=BigInt(0),Ye=BigInt(1),tc=BigInt(2);function Mt(r){return r instanceof Uint8Array||ArrayBuffer.isView(r)&&r.constructor.name==="Uint8Array"}function pe(r){if(!Mt(r))throw new Error("Uint8Array expected")}function pt(r,t){if(typeof t!="boolean")throw new Error(r+" boolean expected, got "+t)}var ec=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function At(r){pe(r);let t="";for(let e=0;e<r.length;e++)t+=ec[r[e]];return t}function Xt(r){let t=r.toString(16);return t.length&1?"0"+t:t}function Pr(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);return r===""?je:BigInt("0x"+r)}var vt={_0:48,_9:57,A:65,F:70,a:97,f:102};function mo(r){if(r>=vt._0&&r<=vt._9)return r-vt._0;if(r>=vt.A&&r<=vt.F)return r-(vt.A-10);if(r>=vt.a&&r<=vt.f)return r-(vt.a-10)}function Wt(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let t=r.length,e=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(e);for(let o=0,i=0;o<e;o++,i+=2){let c=mo(r.charCodeAt(i)),a=mo(r.charCodeAt(i+1));if(c===void 0||a===void 0){let f=r[i]+r[i+1];throw new Error('hex string expected, got non-hex character "'+f+'" at index '+i)}n[o]=c*16+a}return n}function It(r){return Pr(At(r))}function Dt(r){return pe(r),Pr(At(Uint8Array.from(r).reverse()))}function Ot(r,t){return Wt(r.toString(16).padStart(t*2,"0"))}function $t(r,t){return Ot(r,t).reverse()}function rc(r){return Wt(Xt(r))}function j(r,t,e){let n;if(typeof t=="string")try{n=Wt(t)}catch(i){throw new Error(r+" must be hex string or Uint8Array, cause: "+i)}else if(Mt(t))n=Uint8Array.from(t);else throw new Error(r+" must be hex string or Uint8Array");let o=n.length;if(typeof e=="number"&&o!==e)throw new Error(r+" of length "+e+" expected, got "+o);return n}function Tt(...r){let t=0;for(let n=0;n<r.length;n++){let o=r[n];pe(o),t+=o.length}let e=new Uint8Array(t);for(let n=0,o=0;n<r.length;n++){let i=r[n];e.set(i,o),o+=i.length}return e}function nc(r,t){if(r.length!==t.length)return!1;let e=0;for(let n=0;n<r.length;n++)e|=r[n]^t[n];return e===0}function oc(r){if(typeof r!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(r))}var Dr=r=>typeof r=="bigint"&&je<=r;function ve(r,t,e){return Dr(r)&&Dr(t)&&Dr(e)&&t<=r&&r<e}function at(r,t,e,n){if(!ve(t,e,n))throw new Error("expected valid "+r+": "+e+" <= n < "+n+", got "+t)}function zr(r){let t;for(t=0;r>je;r>>=Ye,t+=1);return t}function ic(r,t){return r>>BigInt(t)&Ye}function sc(r,t,e){return r|(e?Ye:je)<<BigInt(t)}var Ae=r=>(tc<<BigInt(r-1))-Ye,Or=r=>new Uint8Array(r),xo=r=>Uint8Array.from(r);function Hr(r,t,e){if(typeof r!="number"||r<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");let n=Or(r),o=Or(r),i=0,c=()=>{n.fill(1),o.fill(0),i=0},a=(...g)=>e(o,n,...g),f=(g=Or())=>{o=a(xo([0]),g),n=a(),g.length!==0&&(o=a(xo([1]),g),n=a())},y=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let g=0,_=[];for(;g<t;){n=a();let s=n.slice();_.push(s),g+=n.length}return Tt(..._)};return(g,_)=>{c(),f(g);let s;for(;!(s=_(y()));)f();return c(),s}}var cc={bigint:r=>typeof r=="bigint",function:r=>typeof r=="function",boolean:r=>typeof r=="boolean",string:r=>typeof r=="string",stringOrUint8Array:r=>typeof r=="string"||Mt(r),isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,t)=>t.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function wt(r,t,e={}){let n=(o,i,c)=>{let a=cc[i];if(typeof a!="function")throw new Error("invalid validator function");let f=r[o];if(!(c&&f===void 0)&&!a(f,r))throw new Error("param "+String(o)+" is invalid. Expected "+i+", got "+f)};for(let[o,i]of Object.entries(t))n(o,i,!1);for(let[o,i]of Object.entries(e))n(o,i,!0);return r}var ac=()=>{throw new Error("not implemented")};function Qt(r){let t=new WeakMap;return(e,...n)=>{let o=t.get(e);if(o!==void 0)return o;let i=r(e,...n);return t.set(e,i),i}}var W=BigInt(0),Z=BigInt(1),Jt=BigInt(2),fc=BigInt(3),Kr=BigInt(4),go=BigInt(5),bo=BigInt(8),uc=BigInt(9),hc=BigInt(16);function F(r,t){let e=r%t;return e>=W?e:t+e}function lc(r,t,e){if(t<W)throw new Error("invalid exponent, negatives unsupported");if(e<=W)throw new Error("invalid modulus");if(e===Z)return W;let n=Z;for(;t>W;)t&Z&&(n=n*r%e),r=r*r%e,t>>=Z;return n}function G(r,t,e){let n=r;for(;t-- >W;)n*=n,n%=e;return n}function We(r,t){if(r===W)throw new Error("invert: expected non-zero number");if(t<=W)throw new Error("invert: expected positive modulus, got "+t);let e=F(r,t),n=t,o=W,i=Z,c=Z,a=W;for(;e!==W;){let y=n/e,h=n%e,g=o-c*y,_=i-a*y;n=e,e=h,o=c,i=a,c=g,a=_}if(n!==Z)throw new Error("invert: does not exist");return F(o,t)}function dc(r){let t=(r-Z)/Jt,e,n,o;for(e=r-Z,n=0;e%Jt===W;e/=Jt,n++);for(o=Jt;o<r&&lc(o,t,r)!==r-Z;o++)if(o>1e3)throw new Error("Cannot find square root: likely non-prime P");if(n===1){let c=(r+Z)/Kr;return function(f,y){let h=f.pow(y,c);if(!f.eql(f.sqr(h),y))throw new Error("Cannot find square root");return h}}let i=(e+Z)/Jt;return function(a,f){if(a.pow(f,t)===a.neg(a.ONE))throw new Error("Cannot find square root");let y=n,h=a.pow(a.mul(a.ONE,o),e),g=a.pow(f,i),_=a.pow(f,e);for(;!a.eql(_,a.ONE);){if(a.eql(_,a.ZERO))return a.ZERO;let s=1;for(let d=a.sqr(_);s<y&&!a.eql(d,a.ONE);s++)d=a.sqr(d);let l=a.pow(h,Z<<BigInt(y-s-1));h=a.sqr(l),g=a.mul(g,l),_=a.mul(_,h),y=s}return g}}function pc(r){if(r%Kr===fc){let t=(r+Z)/Kr;return function(n,o){let i=n.pow(o,t);if(!n.eql(n.sqr(i),o))throw new Error("Cannot find square root");return i}}if(r%bo===go){let t=(r-go)/bo;return function(n,o){let i=n.mul(o,Jt),c=n.pow(i,t),a=n.mul(o,c),f=n.mul(n.mul(a,Jt),c),y=n.mul(a,n.sub(f,n.ONE));if(!n.eql(n.sqr(y),o))throw new Error("Cannot find square root");return y}}return r%hc,dc(r)}var wo=(r,t)=>(F(r,t)&Z)===Z,mc=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function qr(r){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},e=mc.reduce((n,o)=>(n[o]="function",n),t);return wt(r,e)}function xc(r,t,e){if(e<W)throw new Error("invalid exponent, negatives unsupported");if(e===W)return r.ONE;if(e===Z)return t;let n=r.ONE,o=t;for(;e>W;)e&Z&&(n=r.mul(n,o)),o=r.sqr(o),e>>=Z;return n}function gc(r,t){let e=new Array(t.length),n=t.reduce((i,c,a)=>r.is0(c)?i:(e[a]=i,r.mul(i,c)),r.ONE),o=r.inv(n);return t.reduceRight((i,c,a)=>r.is0(c)?i:(e[a]=r.mul(i,e[a]),r.mul(i,c)),o),e}function Fr(r,t){let e=t!==void 0?t:r.toString(2).length,n=Math.ceil(e/8);return{nBitLength:e,nByteLength:n}}function Pt(r,t,e=!1,n={}){if(r<=W)throw new Error("invalid field: expected ORDER > 0, got "+r);let{nBitLength:o,nByteLength:i}=Fr(r,t);if(i>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let c,a=Object.freeze({ORDER:r,isLE:e,BITS:o,BYTES:i,MASK:Ae(o),ZERO:W,ONE:Z,create:f=>F(f,r),isValid:f=>{if(typeof f!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof f);return W<=f&&f<r},is0:f=>f===W,isOdd:f=>(f&Z)===Z,neg:f=>F(-f,r),eql:(f,y)=>f===y,sqr:f=>F(f*f,r),add:(f,y)=>F(f+y,r),sub:(f,y)=>F(f-y,r),mul:(f,y)=>F(f*y,r),pow:(f,y)=>xc(a,f,y),div:(f,y)=>F(f*We(y,r),r),sqrN:f=>f*f,addN:(f,y)=>f+y,subN:(f,y)=>f-y,mulN:(f,y)=>f*y,inv:f=>We(f,r),sqrt:n.sqrt||(f=>(c||(c=pc(r)),c(a,f))),invertBatch:f=>gc(a,f),cmov:(f,y,h)=>h?y:f,toBytes:f=>e?$t(f,i):Ot(f,i),fromBytes:f=>{if(f.length!==i)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+f.length);return e?Dt(f):It(f)}});return Object.freeze(a)}function yo(r){if(typeof r!="bigint")throw new Error("field order must be bigint");let t=r.toString(2).length;return Math.ceil(t/8)}function Vr(r){let t=yo(r);return t+Math.ceil(t/2)}function Eo(r,t,e=!1){let n=r.length,o=yo(t),i=Vr(t);if(n<16||n<i||n>1024)throw new Error("expected "+i+"-1024 bytes of input, got "+n);let c=e?Dt(r):It(r),a=F(c,t-Z)+Z;return e?$t(a,o):Ot(a,o)}var _o=BigInt(0),$e=BigInt(1);function Zr(r,t){let e=t.negate();return r?e:t}function So(r,t){if(!Number.isSafeInteger(r)||r<=0||r>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+r)}function Gr(r,t){So(r,t);let e=Math.ceil(t/r)+1,n=2**(r-1);return{windows:e,windowSize:n}}function bc(r,t){if(!Array.isArray(r))throw new Error("array expected");r.forEach((e,n)=>{if(!(e instanceof t))throw new Error("invalid point at index "+n)})}function wc(r,t){if(!Array.isArray(r))throw new Error("array of scalars expected");r.forEach((e,n)=>{if(!t.isValid(e))throw new Error("invalid scalar at index "+n)})}var jr=new WeakMap,Bo=new WeakMap;function Yr(r){return Bo.get(r)||1}function Qe(r,t){return{constTimeNegate:Zr,hasPrecomputes(e){return Yr(e)!==1},unsafeLadder(e,n,o=r.ZERO){let i=e;for(;n>_o;)n&$e&&(o=o.add(i)),i=i.double(),n>>=$e;return o},precomputeWindow(e,n){let{windows:o,windowSize:i}=Gr(n,t),c=[],a=e,f=a;for(let y=0;y<o;y++){f=a,c.push(f);for(let h=1;h<i;h++)f=f.add(a),c.push(f);a=f.double()}return c},wNAF(e,n,o){let{windows:i,windowSize:c}=Gr(e,t),a=r.ZERO,f=r.BASE,y=BigInt(2**e-1),h=2**e,g=BigInt(e);for(let _=0;_<i;_++){let s=_*c,l=Number(o&y);o>>=g,l>c&&(l-=h,o+=$e);let d=s,x=s+Math.abs(l)-1,p=_%2!==0,m=l<0;l===0?f=f.add(Zr(p,n[d])):a=a.add(Zr(m,n[x]))}return{p:a,f}},wNAFUnsafe(e,n,o,i=r.ZERO){let{windows:c,windowSize:a}=Gr(e,t),f=BigInt(2**e-1),y=2**e,h=BigInt(e);for(let g=0;g<c;g++){let _=g*a;if(o===_o)break;let s=Number(o&f);if(o>>=h,s>a&&(s-=y,o+=$e),s===0)continue;let l=n[_+Math.abs(s)-1];s<0&&(l=l.negate()),i=i.add(l)}return i},getPrecomputes(e,n,o){let i=jr.get(n);return i||(i=this.precomputeWindow(n,e),e!==1&&jr.set(n,o(i))),i},wNAFCached(e,n,o){let i=Yr(e);return this.wNAF(i,this.getPrecomputes(i,e,o),n)},wNAFCachedUnsafe(e,n,o,i){let c=Yr(e);return c===1?this.unsafeLadder(e,n,i):this.wNAFUnsafe(c,this.getPrecomputes(c,e,o),n,i)},setWindowSize(e,n){So(n,t),Bo.set(e,n),jr.delete(e)}}}function Je(r,t,e,n){if(bc(e,r),wc(n,t),e.length!==n.length)throw new Error("arrays of points and scalars must have equal length");let o=r.ZERO,i=zr(BigInt(e.length)),c=i>12?i-3:i>4?i-2:i?2:1,a=(1<<c)-1,f=new Array(a+1).fill(o),y=Math.floor((t.BITS-1)/c)*c,h=o;for(let g=y;g>=0;g-=c){f.fill(o);for(let s=0;s<n.length;s++){let l=n[s],d=Number(l>>BigInt(g)&BigInt(a));f[d]=f[d].add(e[s])}let _=o;for(let s=f.length-1,l=o;s>0;s--)l=l.add(f[s]),_=_.add(l);if(h=h.add(_),g!==0)for(let s=0;s<c;s++)h=h.double()}return h}function Ie(r){return qr(r.Fp),wt(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Fr(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}var mt=BigInt(0),ft=BigInt(1),tr=BigInt(2),yc=BigInt(8),Ec={zip215:!0};function _c(r){let t=Ie(r);return wt(r,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}function vo(r){let t=_c(r),{Fp:e,n,prehash:o,hash:i,randomBytes:c,nByteLength:a,h:f}=t,y=tr<<BigInt(a*8)-ft,h=e.create,g=Pt(t.n,t.nBitLength),_=t.uvRatio||((S,w)=>{try{return{isValid:!0,value:e.sqrt(S*e.inv(w))}}catch{return{isValid:!1,value:mt}}}),s=t.adjustScalarBytes||(S=>S),l=t.domain||((S,w,v)=>{if(pt("phflag",v),w.length||v)throw new Error("Contexts/pre-hash are not supported");return S});function d(S,w){at("coordinate "+S,w,mt,y)}function x(S){if(!(S instanceof u))throw new Error("ExtendedPoint expected")}let p=Qt((S,w)=>{let{ex:v,ey:C,ez:N}=S,k=S.is0();w==null&&(w=k?yc:e.inv(N));let z=h(v*w),H=h(C*w),M=h(N*w);if(k)return{x:mt,y:ft};if(M!==ft)throw new Error("invZ was invalid");return{x:z,y:H}}),m=Qt(S=>{let{a:w,d:v}=t;if(S.is0())throw new Error("bad point: ZERO");let{ex:C,ey:N,ez:k,et:z}=S,H=h(C*C),M=h(N*N),q=h(k*k),V=h(q*q),$=h(H*w),Q=h(q*h($+M)),tt=h(V+h(v*h(H*M)));if(Q!==tt)throw new Error("bad point: equation left != right (1)");let et=h(C*N),st=h(k*z);if(et!==st)throw new Error("bad point: equation left != right (2)");return!0});class u{constructor(w,v,C,N){this.ex=w,this.ey=v,this.ez=C,this.et=N,d("x",w),d("y",v),d("z",C),d("t",N),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(w){if(w instanceof u)throw new Error("extended point not allowed");let{x:v,y:C}=w||{};return d("x",v),d("y",C),new u(v,C,ft,h(v*C))}static normalizeZ(w){let v=e.invertBatch(w.map(C=>C.ez));return w.map((C,N)=>C.toAffine(v[N])).map(u.fromAffine)}static msm(w,v){return Je(u,g,w,v)}_setWindowSize(w){A.setWindowSize(this,w)}assertValidity(){m(this)}equals(w){x(w);let{ex:v,ey:C,ez:N}=this,{ex:k,ey:z,ez:H}=w,M=h(v*H),q=h(k*N),V=h(C*H),$=h(z*N);return M===q&&V===$}is0(){return this.equals(u.ZERO)}negate(){return new u(h(-this.ex),this.ey,this.ez,h(-this.et))}double(){let{a:w}=t,{ex:v,ey:C,ez:N}=this,k=h(v*v),z=h(C*C),H=h(tr*h(N*N)),M=h(w*k),q=v+C,V=h(h(q*q)-k-z),$=M+z,Q=$-H,tt=M-z,et=h(V*Q),st=h($*tt),nt=h(V*tt),bt=h(Q*$);return new u(et,st,bt,nt)}add(w){x(w);let{a:v,d:C}=t,{ex:N,ey:k,ez:z,et:H}=this,{ex:M,ey:q,ez:V,et:$}=w;if(v===BigInt(-1)){let Dn=h((k-N)*(q+M)),On=h((k+N)*(q-M)),Er=h(On-Dn);if(Er===mt)return this.double();let Pn=h(z*tr*$),zn=h(H*tr*V),Hn=zn+Pn,Kn=On+Dn,qn=zn-Pn,Li=h(Hn*Er),Ui=h(Kn*qn),Ni=h(Hn*qn),ki=h(Er*Kn);return new u(Li,Ui,ki,Ni)}let Q=h(N*M),tt=h(k*q),et=h(H*C*$),st=h(z*V),nt=h((N+k)*(M+q)-Q-tt),bt=st-et,Et=st+et,xe=h(tt-v*Q),Ii=h(nt*bt),Ti=h(Et*xe),Ri=h(nt*xe),Ci=h(bt*Et);return new u(Ii,Ti,Ci,Ri)}subtract(w){return this.add(w.negate())}wNAF(w){return A.wNAFCached(this,w,u.normalizeZ)}multiply(w){let v=w;at("scalar",v,ft,n);let{p:C,f:N}=this.wNAF(v);return u.normalizeZ([C,N])[0]}multiplyUnsafe(w,v=u.ZERO){let C=w;return at("scalar",C,mt,n),C===mt?B:this.is0()||C===ft?this:A.wNAFCachedUnsafe(this,C,u.normalizeZ,v)}isSmallOrder(){return this.multiplyUnsafe(f).is0()}isTorsionFree(){return A.unsafeLadder(this,n).is0()}toAffine(w){return p(this,w)}clearCofactor(){let{h:w}=t;return w===ft?this:this.multiplyUnsafe(w)}static fromHex(w,v=!1){let{d:C,a:N}=t,k=e.BYTES;w=j("pointHex",w,k),pt("zip215",v);let z=w.slice(),H=w[k-1];z[k-1]=H&-129;let M=Dt(z),q=v?y:e.ORDER;at("pointHex.y",M,mt,q);let V=h(M*M),$=h(V-ft),Q=h(C*V-N),{isValid:tt,value:et}=_($,Q);if(!tt)throw new Error("Point.fromHex: invalid y coordinate");let st=(et&ft)===ft,nt=(H&128)!==0;if(!v&&et===mt&&nt)throw new Error("Point.fromHex: x=0 and x_0=1");return nt!==st&&(et=h(-et)),u.fromAffine({x:et,y:M})}static fromPrivateKey(w){return R(w).point}toRawBytes(){let{x:w,y:v}=this.toAffine(),C=$t(v,e.BYTES);return C[C.length-1]|=w&ft?128:0,C}toHex(){return At(this.toRawBytes())}}u.BASE=new u(t.Gx,t.Gy,ft,h(t.Gx*t.Gy)),u.ZERO=new u(mt,ft,ft,mt);let{BASE:E,ZERO:B}=u,A=Qe(u,a*8);function b(S){return F(S,n)}function I(S){return b(Dt(S))}function R(S){let w=e.BYTES;S=j("private key",S,w);let v=j("hashed private key",i(S),2*w),C=s(v.slice(0,w)),N=v.slice(w,2*w),k=I(C),z=E.multiply(k),H=z.toRawBytes();return{head:C,prefix:N,scalar:k,point:z,pointBytes:H}}function K(S){return R(S).pointBytes}function P(S=new Uint8Array,...w){let v=Tt(...w);return I(i(l(v,j("context",S),!!o)))}function O(S,w,v={}){S=j("message",S),o&&(S=o(S));let{prefix:C,scalar:N,pointBytes:k}=R(w),z=P(v.context,C,S),H=E.multiply(z).toRawBytes(),M=P(v.context,H,k,S),q=b(z+M*N);at("signature.s",q,mt,n);let V=Tt(H,$t(q,e.BYTES));return j("result",V,e.BYTES*2)}let U=Ec;function T(S,w,v,C=U){let{context:N,zip215:k}=C,z=e.BYTES;S=j("signature",S,2*z),w=j("message",w),v=j("publicKey",v,z),k!==void 0&&pt("zip215",k),o&&(w=o(w));let H=Dt(S.slice(z,2*z)),M,q,V;try{M=u.fromHex(v,k),q=u.fromHex(S.slice(0,z),k),V=E.multiplyUnsafe(H)}catch{return!1}if(!k&&M.isSmallOrder())return!1;let $=P(N,q.toRawBytes(),M.toRawBytes(),w);return q.add(M.multiplyUnsafe($)).subtract(V).clearCofactor().equals(u.ZERO)}return E._setWindowSize(8),{CURVE:t,getPublicKey:K,sign:O,verify:T,ExtendedPoint:u,utils:{getExtendedPublicKey:R,randomPrivateKey:()=>c(e.BYTES),precompute(S=8,w=u.BASE){return w._setWindowSize(S),w.multiply(BigInt(3)),w}}}}var Xr=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Ao=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),Af=BigInt(0),Sc=BigInt(1),Io=BigInt(2),If=BigInt(3),Bc=BigInt(5),vc=BigInt(8);function Ac(r){let t=BigInt(10),e=BigInt(20),n=BigInt(40),o=BigInt(80),i=Xr,a=r*r%i*r%i,f=G(a,Io,i)*a%i,y=G(f,Sc,i)*r%i,h=G(y,Bc,i)*y%i,g=G(h,t,i)*h%i,_=G(g,e,i)*g%i,s=G(_,n,i)*_%i,l=G(s,o,i)*s%i,d=G(l,o,i)*s%i,x=G(d,t,i)*h%i;return{pow_p_5_8:G(x,Io,i)*r%i,b2:a}}function Ic(r){return r[0]&=248,r[31]&=127,r[31]|=64,r}function Tc(r,t){let e=Xr,n=F(t*t*t,e),o=F(n*n*t,e),i=Ac(r*o).pow_p_5_8,c=F(r*n*i,e),a=F(t*c*c,e),f=c,y=F(c*Ao,e),h=a===r,g=a===F(-r,e),_=a===F(-r*Ao,e);return h&&(c=f),(g||_)&&(c=y),wo(c,e)&&(c=F(-c,e)),{isValid:h||g,value:c}}var Rc=Pt(Xr,void 0,!0),Cc={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Rc,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:vc,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:po,randomBytes:Ze,adjustScalarBytes:Ic,uvRatio:Tc},To=vo(Cc);var er=32;function Ro(r,t,e){return To.verify(t,e instanceof Uint8Array?e:e.subarray(),r)}var rr=class{type="Ed25519";raw;constructor(t){this.raw=Wr(t,er)}toMultihash(){return St.digest(nr(this))}toCID(){return lt.createV1(114,this.toMultihash())}toString(){return X.encode(this.toMultihash().bytes).substring(1)}equals(t){return t==null||!(t.raw instanceof Uint8Array)?!1:Bt(this.raw,t.raw)}verify(t,e){return Ro(this.raw,e,t)}};function Lo(r){return r=Wr(r,er),new rr(r)}function Wr(r,t){if(r=Uint8Array.from(r??[]),r.length!==t)throw new ge(`Key must be a Uint8Array of length ${t}, got ${r.length}`);return r}function Uo(r=0){return new Uint8Array(r)}function Rt(r=0){return new Uint8Array(r)}var Uc=Math.pow(2,7),Nc=Math.pow(2,14),kc=Math.pow(2,21),No=Math.pow(2,28),ko=Math.pow(2,35),Mo=Math.pow(2,42),Do=Math.pow(2,49),ot=128,zt=127;function Te(r){if(r<Uc)return 1;if(r<Nc)return 2;if(r<kc)return 3;if(r<No)return 4;if(r<ko)return 5;if(r<Mo)return 6;if(r<Do)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function Oo(r,t,e=0){switch(Te(r)){case 8:t[e++]=r&255|ot,r/=128;case 7:t[e++]=r&255|ot,r/=128;case 6:t[e++]=r&255|ot,r/=128;case 5:t[e++]=r&255|ot,r/=128;case 4:t[e++]=r&255|ot,r>>>=7;case 3:t[e++]=r&255|ot,r>>>=7;case 2:t[e++]=r&255|ot,r>>>=7;case 1:{t[e++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return t}function Po(r,t){let e=r[t],n=0;if(n+=e&zt,e<ot||(e=r[t+1],n+=(e&zt)<<7,e<ot)||(e=r[t+2],n+=(e&zt)<<14,e<ot)||(e=r[t+3],n+=(e&zt)<<21,e<ot)||(e=r[t+4],n+=(e&zt)*No,e<ot)||(e=r[t+5],n+=(e&zt)*ko,e<ot)||(e=r[t+6],n+=(e&zt)*Mo,e<ot)||(e=r[t+7],n+=(e&zt)*Do,e<ot))return n;throw new RangeError("Could not decode varint")}var $r=new Float32Array([-0]),Ht=new Uint8Array($r.buffer);function zo(r,t,e){$r[0]=r,t[e]=Ht[0],t[e+1]=Ht[1],t[e+2]=Ht[2],t[e+3]=Ht[3]}function Ho(r,t){return Ht[0]=r[t],Ht[1]=r[t+1],Ht[2]=r[t+2],Ht[3]=r[t+3],$r[0]}var Qr=new Float64Array([-0]),rt=new Uint8Array(Qr.buffer);function Ko(r,t,e){Qr[0]=r,t[e]=rt[0],t[e+1]=rt[1],t[e+2]=rt[2],t[e+3]=rt[3],t[e+4]=rt[4],t[e+5]=rt[5],t[e+6]=rt[6],t[e+7]=rt[7]}function qo(r,t){return rt[0]=r[t],rt[1]=r[t+1],rt[2]=r[t+2],rt[3]=r[t+3],rt[4]=r[t+4],rt[5]=r[t+5],rt[6]=r[t+6],rt[7]=r[t+7],Qr[0]}var Mc=BigInt(Number.MAX_SAFE_INTEGER),Dc=BigInt(Number.MIN_SAFE_INTEGER),ut=class r{lo;hi;constructor(t,e){this.lo=t|0,this.hi=e|0}toNumber(t=!1){if(!t&&this.hi>>>31>0){let e=~this.lo+1>>>0,n=~this.hi>>>0;return e===0&&(n=n+1>>>0),-(e+n*4294967296)}return this.lo+this.hi*4294967296}toBigInt(t=!1){if(t)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let e=~this.lo+1>>>0,n=~this.hi>>>0;return e===0&&(n=n+1>>>0),-(BigInt(e)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(t=!1){return this.toBigInt(t).toString()}zzEncode(){let t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this}zzDecode(){let t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this}length(){let t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?e===0?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:n<128?9:10}static fromBigInt(t){if(t===0n)return te;if(t<Mc&&t>Dc)return this.fromNumber(Number(t));let e=t<0n;e&&(t=-t);let n=t>>32n,o=t-(n<<32n);return e&&(n=~n|0n,o=~o|0n,++o>Fo&&(o=0n,++n>Fo&&(n=0n))),new r(Number(o),Number(n))}static fromNumber(t){if(t===0)return te;let e=t<0;e&&(t=-t);let n=t>>>0,o=(t-n)/4294967296>>>0;return e&&(o=~o>>>0,n=~n>>>0,++n>4294967295&&(n=0,++o>4294967295&&(o=0))),new r(n,o)}static from(t){return typeof t=="number"?r.fromNumber(t):typeof t=="bigint"?r.fromBigInt(t):typeof t=="string"?r.fromBigInt(BigInt(t)):t.low!=null||t.high!=null?new r(t.low>>>0,t.high>>>0):te}},te=new ut(0,0);te.toBigInt=function(){return 0n};te.zzEncode=te.zzDecode=function(){return this};te.length=function(){return 1};var Fo=4294967296n;function Vo(r){let t=0,e=0;for(let n=0;n<r.length;++n)e=r.charCodeAt(n),e<128?t+=1:e<2048?t+=2:(e&64512)===55296&&(r.charCodeAt(n+1)&64512)===56320?(++n,t+=4):t+=3;return t}function Zo(r,t,e){if(e-t<1)return"";let o,i=[],c=0,a;for(;t<e;)a=r[t++],a<128?i[c++]=a:a>191&&a<224?i[c++]=(a&31)<<6|r[t++]&63:a>239&&a<365?(a=((a&7)<<18|(r[t++]&63)<<12|(r[t++]&63)<<6|r[t++]&63)-65536,i[c++]=55296+(a>>10),i[c++]=56320+(a&1023)):i[c++]=(a&15)<<12|(r[t++]&63)<<6|r[t++]&63,c>8191&&((o??(o=[])).push(String.fromCharCode.apply(String,i)),c=0);return o!=null?(c>0&&o.push(String.fromCharCode.apply(String,i.slice(0,c))),o.join("")):String.fromCharCode.apply(String,i.slice(0,c))}function Jr(r,t,e){let n=e,o,i;for(let c=0;c<r.length;++c)o=r.charCodeAt(c),o<128?t[e++]=o:o<2048?(t[e++]=o>>6|192,t[e++]=o&63|128):(o&64512)===55296&&((i=r.charCodeAt(c+1))&64512)===56320?(o=65536+((o&1023)<<10)+(i&1023),++c,t[e++]=o>>18|240,t[e++]=o>>12&63|128,t[e++]=o>>6&63|128,t[e++]=o&63|128):(t[e++]=o>>12|224,t[e++]=o>>6&63|128,t[e++]=o&63|128);return e-n}function xt(r,t){return RangeError(`index out of range: ${r.pos} + ${t??1} > ${r.len}`)}function or(r,t){return(r[t-4]|r[t-3]<<8|r[t-2]<<16|r[t-1]<<24)>>>0}var tn=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(t){this.buf=t,this.pos=0,this.len=t.length}uint32(){let t=4294967295;if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,xt(this,10);return t}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw xt(this,4);return or(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw xt(this,4);return or(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw xt(this,4);let t=Ho(this.buf,this.pos);return this.pos+=4,t}double(){if(this.pos+8>this.len)throw xt(this,4);let t=qo(this.buf,this.pos);return this.pos+=8,t}bytes(){let t=this.uint32(),e=this.pos,n=this.pos+t;if(n>this.len)throw xt(this,t);return this.pos+=t,e===n?new Uint8Array(0):this.buf.subarray(e,n)}string(){let t=this.bytes();return Zo(t,0,t.length)}skip(t){if(typeof t=="number"){if(this.pos+t>this.len)throw xt(this,t);this.pos+=t}else do if(this.pos>=this.len)throw xt(this);while(this.buf[this.pos++]&128);return this}skipType(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${t} at offset ${this.pos}`)}return this}readLongVarint(){let t=new ut(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw xt(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw xt(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw xt(this,8);let t=or(this.buf,this.pos+=4),e=or(this.buf,this.pos+=4);return new ut(t,e)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){let t=Po(this.buf,this.pos);return this.pos+=Te(t),t}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}};function en(r){return new tn(r instanceof Uint8Array?r:r.subarray())}function ir(r,t,e){let n=en(r);return t.decode(n,void 0,e)}var rn={};ct(rn,{base10:()=>Oc});var Oc=Ut({prefix:"9",name:"base10",alphabet:"0123456789"});var nn={};ct(nn,{base16:()=>Pc,base16upper:()=>zc});var Pc=Y({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),zc=Y({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var on={};ct(on,{base2:()=>Hc});var Hc=Y({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var sn={};ct(sn,{base256emoji:()=>Zc});var jo=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}"),Kc=jo.reduce((r,t,e)=>(r[e]=t,r),[]),qc=jo.reduce((r,t,e)=>{let n=t.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${t}`);return r[n]=e,r},[]);function Fc(r){return r.reduce((t,e)=>(t+=Kc[e],t),"")}function Vc(r){let t=[];for(let e of r){let n=e.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${e}`);let o=qc[n];if(o==null)throw new Error(`Non-base256emoji character: ${e}`);t.push(o)}return new Uint8Array(t)}var Zc=ie({prefix:"\u{1F680}",name:"base256emoji",encode:Fc,decode:Vc});var cn={};ct(cn,{base64:()=>Gc,base64pad:()=>jc,base64url:()=>Yc,base64urlpad:()=>Xc});var Gc=Y({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),jc=Y({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Yc=Y({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Xc=Y({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var an={};ct(an,{base8:()=>Wc});var Wc=Y({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var fn={};ct(fn,{identity:()=>$c});var $c=ie({prefix:"\0",name:"identity",encode:r=>jn(r),decode:r=>Gn(r)});var uu=new TextEncoder,hu=new TextDecoder;var ln={};ct(ln,{sha256:()=>Re,sha512:()=>ta});function hn({name:r,code:t,encode:e}){return new un(r,t,e)}var un=class{name;code;encode;constructor(t,e,n){this.name=t,this.code=e,this.encode=n}digest(t){if(t instanceof Uint8Array){let e=this.encode(t);return e instanceof Uint8Array?Gt(this.code,e):e.then(n=>Gt(this.code,n))}else throw Error("Unknown type, must be binary type")}};function Xo(r){return async t=>new Uint8Array(await crypto.subtle.digest(r,t))}var Re=hn({name:"sha2-256",code:18,encode:Xo("SHA-256")}),ta=hn({name:"sha2-512",code:19,encode:Xo("SHA-512")});var dn={...fn,...on,...an,...rn,...nn,...Tr,...Rr,...Ir,...cn,...sn},Su={...ln,...Ur};function $o(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var Wo=$o("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),pn=$o("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);let t=Rt(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),ea={utf8:Wo,"utf-8":Wo,hex:dn.base16,latin1:pn,ascii:pn,binary:pn,...dn},sr=ea;function it(r,t="utf8"){let e=sr[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return e.decoder.decode(`${e.prefix}${r}`)}function mn(r){let t=r??8192,e=t>>>1,n,o=t;return function(c){if(c<1||c>e)return Rt(c);o+c>t&&(n=Rt(t),o=0);let a=n.subarray(o,o+=c);return o&7&&(o=(o|7)+1),a}}var ee=class{fn;len;next;val;constructor(t,e,n){this.fn=t,this.len=e,this.next=void 0,this.val=n}};function xn(){}var bn=class{head;tail;len;next;constructor(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}},ra=mn();function na(r){return globalThis.Buffer!=null?Rt(r):ra(r)}var Le=class{len;head;tail;states;constructor(){this.len=0,this.head=new ee(xn,0,0),this.tail=this.head,this.states=null}_push(t,e,n){return this.tail=this.tail.next=new ee(t,e,n),this.len+=e,this}uint32(t){return this.len+=(this.tail=this.tail.next=new wn((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this}int32(t){return t<0?this._push(cr,10,ut.fromNumber(t)):this.uint32(t)}sint32(t){return this.uint32((t<<1^t>>31)>>>0)}uint64(t){let e=ut.fromBigInt(t);return this._push(cr,e.length(),e)}uint64Number(t){return this._push(Oo,Te(t),t)}uint64String(t){return this.uint64(BigInt(t))}int64(t){return this.uint64(t)}int64Number(t){return this.uint64Number(t)}int64String(t){return this.uint64String(t)}sint64(t){let e=ut.fromBigInt(t).zzEncode();return this._push(cr,e.length(),e)}sint64Number(t){let e=ut.fromNumber(t).zzEncode();return this._push(cr,e.length(),e)}sint64String(t){return this.sint64(BigInt(t))}bool(t){return this._push(gn,1,t?1:0)}fixed32(t){return this._push(Ce,4,t>>>0)}sfixed32(t){return this.fixed32(t)}fixed64(t){let e=ut.fromBigInt(t);return this._push(Ce,4,e.lo)._push(Ce,4,e.hi)}fixed64Number(t){let e=ut.fromNumber(t);return this._push(Ce,4,e.lo)._push(Ce,4,e.hi)}fixed64String(t){return this.fixed64(BigInt(t))}sfixed64(t){return this.fixed64(t)}sfixed64Number(t){return this.fixed64Number(t)}sfixed64String(t){return this.fixed64String(t)}float(t){return this._push(zo,4,t)}double(t){return this._push(Ko,8,t)}bytes(t){let e=t.length>>>0;return e===0?this._push(gn,1,0):this.uint32(e)._push(ia,e,t)}string(t){let e=Vo(t);return e!==0?this.uint32(e)._push(Jr,e,t):this._push(gn,1,0)}fork(){return this.states=new bn(this),this.head=this.tail=new ee(xn,0,0),this.len=0,this}reset(){return this.states!=null?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new ee(xn,0,0),this.len=0),this}ldelim(){let t=this.head,e=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=t.next,this.tail=e,this.len+=n),this}finish(){let t=this.head.next,e=na(this.len),n=0;for(;t!=null;)t.fn(t.val,e,n),n+=t.len,t=t.next;return e}};function gn(r,t,e){t[e]=r&255}function oa(r,t,e){for(;r>127;)t[e++]=r&127|128,r>>>=7;t[e]=r}var wn=class extends ee{next;constructor(t,e){super(oa,t,e),this.next=void 0}};function cr(r,t,e){for(;r.hi!==0;)t[e++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)t[e++]=r.lo&127|128,r.lo=r.lo>>>7;t[e++]=r.lo}function Ce(r,t,e){t[e]=r&255,t[e+1]=r>>>8&255,t[e+2]=r>>>16&255,t[e+3]=r>>>24}function ia(r,t,e){t.set(r,e)}globalThis.Buffer!=null&&(Le.prototype.bytes=function(r){let t=r.length>>>0;return this.uint32(t),t>0&&this._push(sa,t,r),this},Le.prototype.string=function(r){let t=globalThis.Buffer.byteLength(r);return this.uint32(t),t>0&&this._push(ca,t,r),this});function sa(r,t,e){t.set(r,e)}function ca(r,t,e){r.length<40?Jr(r,t,e):t.utf8Write!=null?t.utf8Write(r,e):t.set(it(r),e)}function yn(){return new Le}function ar(r,t){let e=yn();return t.encode(r,e,{lengthDelimited:!1}),e.finish()}var me;(function(r){r[r.VARINT=0]="VARINT",r[r.BIT64=1]="BIT64",r[r.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",r[r.START_GROUP=3]="START_GROUP",r[r.END_GROUP=4]="END_GROUP",r[r.BIT32=5]="BIT32"})(me||(me={}));function fr(r,t,e,n){return{name:r,type:t,encode:e,decode:n}}function En(r){function t(o){if(r[o.toString()]==null)throw new Error("Invalid enum value");return r[o]}let e=function(i,c){let a=t(i);c.int32(a)},n=function(i){let c=i.int32();return t(c)};return fr("enum",me.VARINT,e,n)}function ur(r,t){return fr("message",me.LENGTH_DELIMITED,r,t)}var ht;(function(r){r.RSA="RSA",r.Ed25519="Ed25519",r.secp256k1="secp256k1"})(ht||(ht={}));var _n;(function(r){r[r.RSA=0]="RSA",r[r.Ed25519=1]="Ed25519",r[r.secp256k1=2]="secp256k1"})(_n||(_n={}));(function(r){r.codec=()=>En(_n)})(ht||(ht={}));var Ue;(function(r){let t;r.codec=()=>(t==null&&(t=ur((e,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),e.Type!=null&&(n.uint32(8),ht.codec().encode(e.Type,n)),e.Data!=null&&(n.uint32(18),n.bytes(e.Data)),o.lengthDelimited!==!1&&n.ldelim()},(e,n,o={})=>{let i={},c=n==null?e.len:e.pos+n;for(;e.pos<c;){let a=e.uint32();switch(a>>>3){case 1:{i.Type=ht.codec().decode(e);break}case 2:{i.Data=e.bytes();break}default:{e.skipType(a&7);break}}}return i})),t),r.encode=e=>ar(e,r.codec()),r.decode=(e,n)=>ir(e,r.codec(),n)})(Ue||(Ue={}));var Sn;(function(r){let t;r.codec=()=>(t==null&&(t=ur((e,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),e.Type!=null&&(n.uint32(8),ht.codec().encode(e.Type,n)),e.Data!=null&&(n.uint32(18),n.bytes(e.Data)),o.lengthDelimited!==!1&&n.ldelim()},(e,n,o={})=>{let i={},c=n==null?e.len:e.pos+n;for(;e.pos<c;){let a=e.uint32();switch(a>>>3){case 1:{i.Type=ht.codec().decode(e);break}case 2:{i.Data=e.bytes();break}default:{e.skipType(a&7);break}}}return i})),t),r.encode=e=>ar(e,r.codec()),r.decode=(e,n)=>ir(e,r.codec(),n)})(Sn||(Sn={}));var fa=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Kt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),qt=new Uint32Array(64),Bn=class extends de{constructor(){super(64,32,8,!1),this.A=Kt[0]|0,this.B=Kt[1]|0,this.C=Kt[2]|0,this.D=Kt[3]|0,this.E=Kt[4]|0,this.F=Kt[5]|0,this.G=Kt[6]|0,this.H=Kt[7]|0}get(){let{A:t,B:e,C:n,D:o,E:i,F:c,G:a,H:f}=this;return[t,e,n,o,i,c,a,f]}set(t,e,n,o,i,c,a,f){this.A=t|0,this.B=e|0,this.C=n|0,this.D=o|0,this.E=i|0,this.F=c|0,this.G=a|0,this.H=f|0}process(t,e){for(let g=0;g<16;g++,e+=4)qt[g]=t.getUint32(e,!1);for(let g=16;g<64;g++){let _=qt[g-15],s=qt[g-2],l=dt(_,7)^dt(_,18)^_>>>3,d=dt(s,17)^dt(s,19)^s>>>10;qt[g]=d+qt[g-7]+l+qt[g-16]|0}let{A:n,B:o,C:i,D:c,E:a,F:f,G:y,H:h}=this;for(let g=0;g<64;g++){let _=dt(a,6)^dt(a,11)^dt(a,25),s=h+_+uo(a,f,y)+fa[g]+qt[g]|0,d=(dt(n,2)^dt(n,13)^dt(n,22))+ho(n,o,i)|0;h=y,y=f,f=a,a=c+s|0,c=i,i=o,o=n,n=s+d|0}n=n+this.A|0,o=o+this.B|0,i=i+this.C|0,c=c+this.D|0,a=a+this.E|0,f=f+this.F|0,y=y+this.G|0,h=h+this.H|0,this.set(n,o,i,c,a,f,y,h)}roundClean(){qt.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var Qo=Ve(()=>new Bn);function hr(r,t="utf8"){let e=sr[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return e.encoder.encode(r).substring(1)}var Ne=class extends Error{constructor(t="An error occurred while verifying a message"){super(t),this.name="VerificationError"}};var lr=class extends le{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,co(t);let n=Be(e);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let o=this.blockLen,i=new Uint8Array(o);i.set(n.length>o?t.create().update(n).digest():n);for(let c=0;c<i.length;c++)i[c]^=54;this.iHash.update(i),this.oHash=t.create();for(let c=0;c<i.length;c++)i[c]^=106;this.oHash.update(i),i.fill(0)}update(t){return he(this),this.iHash.update(t),this}digestInto(t){he(this),ue(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));let{oHash:e,iHash:n,finished:o,destroyed:i,blockLen:c,outputLen:a}=this;return t=t,t.finished=o,t.destroyed=i,t.blockLen=c,t.outputLen=a,t.oHash=e._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},vn=(r,t,e)=>new lr(r,t).update(e).digest();vn.create=(r,t)=>new lr(r,t);function Jo(r){r.lowS!==void 0&&pt("lowS",r.lowS),r.prehash!==void 0&&pt("prehash",r.prehash)}function ua(r){let t=Ie(r);wt(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:e,Fp:n,a:o}=t;if(e){if(!n.eql(o,n.ZERO))throw new Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if(typeof e!="object"||typeof e.beta!="bigint"||typeof e.splitScalar!="function")throw new Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...t})}var{bytesToNumberBE:ha,hexToBytes:la}=Xe,An=class extends Error{constructor(t=""){super(t)}},Ct={Err:An,_tlv:{encode:(r,t)=>{let{Err:e}=Ct;if(r<0||r>256)throw new e("tlv.encode: wrong tag");if(t.length&1)throw new e("tlv.encode: unpadded data");let n=t.length/2,o=Xt(n);if(o.length/2&128)throw new e("tlv.encode: long form length too big");let i=n>127?Xt(o.length/2|128):"";return Xt(r)+i+o+t},decode(r,t){let{Err:e}=Ct,n=0;if(r<0||r>256)throw new e("tlv.encode: wrong tag");if(t.length<2||t[n++]!==r)throw new e("tlv.decode: wrong tlv");let o=t[n++],i=!!(o&128),c=0;if(!i)c=o;else{let f=o&127;if(!f)throw new e("tlv.decode(long): indefinite length not supported");if(f>4)throw new e("tlv.decode(long): byte length is too big");let y=t.subarray(n,n+f);if(y.length!==f)throw new e("tlv.decode: length bytes not complete");if(y[0]===0)throw new e("tlv.decode(long): zero leftmost byte");for(let h of y)c=c<<8|h;if(n+=f,c<128)throw new e("tlv.decode(long): not minimal encoding")}let a=t.subarray(n,n+c);if(a.length!==c)throw new e("tlv.decode: wrong value length");return{v:a,l:t.subarray(n+c)}}},_int:{encode(r){let{Err:t}=Ct;if(r<Lt)throw new t("integer: negative integers are not allowed");let e=Xt(r);if(Number.parseInt(e[0],16)&8&&(e="00"+e),e.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return e},decode(r){let{Err:t}=Ct;if(r[0]&128)throw new t("invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return ha(r)}},toSig(r){let{Err:t,_int:e,_tlv:n}=Ct,o=typeof r=="string"?la(r):r;pe(o);let{v:i,l:c}=n.decode(48,o);if(c.length)throw new t("invalid signature: left bytes after parsing");let{v:a,l:f}=n.decode(2,i),{v:y,l:h}=n.decode(2,f);if(h.length)throw new t("invalid signature: left bytes after parsing");return{r:e.decode(a),s:e.decode(y)}},hexFromSig(r){let{_tlv:t,_int:e}=Ct,n=t.encode(2,e.encode(r.r)),o=t.encode(2,e.encode(r.s)),i=n+o;return t.encode(48,i)}},Lt=BigInt(0),J=BigInt(1),lh=BigInt(2),ti=BigInt(3),dh=BigInt(4);function da(r){let t=ua(r),{Fp:e}=t,n=Pt(t.n,t.nBitLength),o=t.toBytes||((d,x,p)=>{let m=x.toAffine();return Tt(Uint8Array.from([4]),e.toBytes(m.x),e.toBytes(m.y))}),i=t.fromBytes||(d=>{let x=d.subarray(1),p=e.fromBytes(x.subarray(0,e.BYTES)),m=e.fromBytes(x.subarray(e.BYTES,2*e.BYTES));return{x:p,y:m}});function c(d){let{a:x,b:p}=t,m=e.sqr(d),u=e.mul(m,d);return e.add(e.add(u,e.mul(d,x)),p)}if(!e.eql(e.sqr(t.Gy),c(t.Gx)))throw new Error("bad generator point: equation left != right");function a(d){return ve(d,J,t.n)}function f(d){let{allowedPrivateKeyLengths:x,nByteLength:p,wrapPrivateKey:m,n:u}=t;if(x&&typeof d!="bigint"){if(Mt(d)&&(d=At(d)),typeof d!="string"||!x.includes(d.length))throw new Error("invalid private key");d=d.padStart(p*2,"0")}let E;try{E=typeof d=="bigint"?d:It(j("private key",d,p))}catch{throw new Error("invalid private key, expected hex or "+p+" bytes, got "+typeof d)}return m&&(E=F(E,u)),at("private key",E,J,u),E}function y(d){if(!(d instanceof _))throw new Error("ProjectivePoint expected")}let h=Qt((d,x)=>{let{px:p,py:m,pz:u}=d;if(e.eql(u,e.ONE))return{x:p,y:m};let E=d.is0();x==null&&(x=E?e.ONE:e.inv(u));let B=e.mul(p,x),A=e.mul(m,x),b=e.mul(u,x);if(E)return{x:e.ZERO,y:e.ZERO};if(!e.eql(b,e.ONE))throw new Error("invZ was invalid");return{x:B,y:A}}),g=Qt(d=>{if(d.is0()){if(t.allowInfinityPoint&&!e.is0(d.py))return;throw new Error("bad point: ZERO")}let{x,y:p}=d.toAffine();if(!e.isValid(x)||!e.isValid(p))throw new Error("bad point: x or y not FE");let m=e.sqr(p),u=c(x);if(!e.eql(m,u))throw new Error("bad point: equation left != right");if(!d.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class _{constructor(x,p,m){if(this.px=x,this.py=p,this.pz=m,x==null||!e.isValid(x))throw new Error("x required");if(p==null||!e.isValid(p))throw new Error("y required");if(m==null||!e.isValid(m))throw new Error("z required");Object.freeze(this)}static fromAffine(x){let{x:p,y:m}=x||{};if(!x||!e.isValid(p)||!e.isValid(m))throw new Error("invalid affine point");if(x instanceof _)throw new Error("projective point not allowed");let u=E=>e.eql(E,e.ZERO);return u(p)&&u(m)?_.ZERO:new _(p,m,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(x){let p=e.invertBatch(x.map(m=>m.pz));return x.map((m,u)=>m.toAffine(p[u])).map(_.fromAffine)}static fromHex(x){let p=_.fromAffine(i(j("pointHex",x)));return p.assertValidity(),p}static fromPrivateKey(x){return _.BASE.multiply(f(x))}static msm(x,p){return Je(_,n,x,p)}_setWindowSize(x){l.setWindowSize(this,x)}assertValidity(){g(this)}hasEvenY(){let{y:x}=this.toAffine();if(e.isOdd)return!e.isOdd(x);throw new Error("Field doesn't support isOdd")}equals(x){y(x);let{px:p,py:m,pz:u}=this,{px:E,py:B,pz:A}=x,b=e.eql(e.mul(p,A),e.mul(E,u)),I=e.eql(e.mul(m,A),e.mul(B,u));return b&&I}negate(){return new _(this.px,e.neg(this.py),this.pz)}double(){let{a:x,b:p}=t,m=e.mul(p,ti),{px:u,py:E,pz:B}=this,A=e.ZERO,b=e.ZERO,I=e.ZERO,R=e.mul(u,u),K=e.mul(E,E),P=e.mul(B,B),O=e.mul(u,E);return O=e.add(O,O),I=e.mul(u,B),I=e.add(I,I),A=e.mul(x,I),b=e.mul(m,P),b=e.add(A,b),A=e.sub(K,b),b=e.add(K,b),b=e.mul(A,b),A=e.mul(O,A),I=e.mul(m,I),P=e.mul(x,P),O=e.sub(R,P),O=e.mul(x,O),O=e.add(O,I),I=e.add(R,R),R=e.add(I,R),R=e.add(R,P),R=e.mul(R,O),b=e.add(b,R),P=e.mul(E,B),P=e.add(P,P),R=e.mul(P,O),A=e.sub(A,R),I=e.mul(P,K),I=e.add(I,I),I=e.add(I,I),new _(A,b,I)}add(x){y(x);let{px:p,py:m,pz:u}=this,{px:E,py:B,pz:A}=x,b=e.ZERO,I=e.ZERO,R=e.ZERO,K=t.a,P=e.mul(t.b,ti),O=e.mul(p,E),U=e.mul(m,B),T=e.mul(u,A),L=e.add(p,m),S=e.add(E,B);L=e.mul(L,S),S=e.add(O,U),L=e.sub(L,S),S=e.add(p,u);let w=e.add(E,A);return S=e.mul(S,w),w=e.add(O,T),S=e.sub(S,w),w=e.add(m,u),b=e.add(B,A),w=e.mul(w,b),b=e.add(U,T),w=e.sub(w,b),R=e.mul(K,S),b=e.mul(P,T),R=e.add(b,R),b=e.sub(U,R),R=e.add(U,R),I=e.mul(b,R),U=e.add(O,O),U=e.add(U,O),T=e.mul(K,T),S=e.mul(P,S),U=e.add(U,T),T=e.sub(O,T),T=e.mul(K,T),S=e.add(S,T),O=e.mul(U,S),I=e.add(I,O),O=e.mul(w,S),b=e.mul(L,b),b=e.sub(b,O),O=e.mul(L,U),R=e.mul(w,R),R=e.add(R,O),new _(b,I,R)}subtract(x){return this.add(x.negate())}is0(){return this.equals(_.ZERO)}wNAF(x){return l.wNAFCached(this,x,_.normalizeZ)}multiplyUnsafe(x){let{endo:p,n:m}=t;at("scalar",x,Lt,m);let u=_.ZERO;if(x===Lt)return u;if(this.is0()||x===J)return this;if(!p||l.hasPrecomputes(this))return l.wNAFCachedUnsafe(this,x,_.normalizeZ);let{k1neg:E,k1:B,k2neg:A,k2:b}=p.splitScalar(x),I=u,R=u,K=this;for(;B>Lt||b>Lt;)B&J&&(I=I.add(K)),b&J&&(R=R.add(K)),K=K.double(),B>>=J,b>>=J;return E&&(I=I.negate()),A&&(R=R.negate()),R=new _(e.mul(R.px,p.beta),R.py,R.pz),I.add(R)}multiply(x){let{endo:p,n:m}=t;at("scalar",x,J,m);let u,E;if(p){let{k1neg:B,k1:A,k2neg:b,k2:I}=p.splitScalar(x),{p:R,f:K}=this.wNAF(A),{p:P,f:O}=this.wNAF(I);R=l.constTimeNegate(B,R),P=l.constTimeNegate(b,P),P=new _(e.mul(P.px,p.beta),P.py,P.pz),u=R.add(P),E=K.add(O)}else{let{p:B,f:A}=this.wNAF(x);u=B,E=A}return _.normalizeZ([u,E])[0]}multiplyAndAddUnsafe(x,p,m){let u=_.BASE,E=(A,b)=>b===Lt||b===J||!A.equals(u)?A.multiplyUnsafe(b):A.multiply(b),B=E(this,p).add(E(x,m));return B.is0()?void 0:B}toAffine(x){return h(this,x)}isTorsionFree(){let{h:x,isTorsionFree:p}=t;if(x===J)return!0;if(p)return p(_,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:x,clearCofactor:p}=t;return x===J?this:p?p(_,this):this.multiplyUnsafe(t.h)}toRawBytes(x=!0){return pt("isCompressed",x),this.assertValidity(),o(_,this,x)}toHex(x=!0){return pt("isCompressed",x),At(this.toRawBytes(x))}}_.BASE=new _(t.Gx,t.Gy,e.ONE),_.ZERO=new _(e.ZERO,e.ONE,e.ZERO);let s=t.nBitLength,l=Qe(_,t.endo?Math.ceil(s/2):s);return{CURVE:t,ProjectivePoint:_,normPrivateKeyToScalar:f,weierstrassEquation:c,isWithinCurveOrder:a}}function pa(r){let t=Ie(r);return wt(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function ei(r){let t=pa(r),{Fp:e,n}=t,o=e.BYTES+1,i=2*e.BYTES+1;function c(T){return F(T,n)}function a(T){return We(T,n)}let{ProjectivePoint:f,normPrivateKeyToScalar:y,weierstrassEquation:h,isWithinCurveOrder:g}=da({...t,toBytes(T,L,S){let w=L.toAffine(),v=e.toBytes(w.x),C=Tt;return pt("isCompressed",S),S?C(Uint8Array.from([L.hasEvenY()?2:3]),v):C(Uint8Array.from([4]),v,e.toBytes(w.y))},fromBytes(T){let L=T.length,S=T[0],w=T.subarray(1);if(L===o&&(S===2||S===3)){let v=It(w);if(!ve(v,J,e.ORDER))throw new Error("Point is not on curve");let C=h(v),N;try{N=e.sqrt(C)}catch(H){let M=H instanceof Error?": "+H.message:"";throw new Error("Point is not on curve"+M)}let k=(N&J)===J;return(S&1)===1!==k&&(N=e.neg(N)),{x:v,y:N}}else if(L===i&&S===4){let v=e.fromBytes(w.subarray(0,e.BYTES)),C=e.fromBytes(w.subarray(e.BYTES,2*e.BYTES));return{x:v,y:C}}else{let v=o,C=i;throw new Error("invalid Point, expected length of "+v+", or uncompressed "+C+", got "+L)}}}),_=T=>At(Ot(T,t.nByteLength));function s(T){let L=n>>J;return T>L}function l(T){return s(T)?c(-T):T}let d=(T,L,S)=>It(T.slice(L,S));class x{constructor(L,S,w){this.r=L,this.s=S,this.recovery=w,this.assertValidity()}static fromCompact(L){let S=t.nByteLength;return L=j("compactSignature",L,S*2),new x(d(L,0,S),d(L,S,2*S))}static fromDER(L){let{r:S,s:w}=Ct.toSig(j("DER",L));return new x(S,w)}assertValidity(){at("r",this.r,J,n),at("s",this.s,J,n)}addRecoveryBit(L){return new x(this.r,this.s,L)}recoverPublicKey(L){let{r:S,s:w,recovery:v}=this,C=A(j("msgHash",L));if(v==null||![0,1,2,3].includes(v))throw new Error("recovery id invalid");let N=v===2||v===3?S+t.n:S;if(N>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");let k=v&1?"03":"02",z=f.fromHex(k+_(N)),H=a(N),M=c(-C*H),q=c(w*H),V=f.BASE.multiplyAndAddUnsafe(z,M,q);if(!V)throw new Error("point at infinify");return V.assertValidity(),V}hasHighS(){return s(this.s)}normalizeS(){return this.hasHighS()?new x(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return Wt(this.toDERHex())}toDERHex(){return Ct.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Wt(this.toCompactHex())}toCompactHex(){return _(this.r)+_(this.s)}}let p={isValidPrivateKey(T){try{return y(T),!0}catch{return!1}},normPrivateKeyToScalar:y,randomPrivateKey:()=>{let T=Vr(t.n);return Eo(t.randomBytes(T),t.n)},precompute(T=8,L=f.BASE){return L._setWindowSize(T),L.multiply(BigInt(3)),L}};function m(T,L=!0){return f.fromPrivateKey(T).toRawBytes(L)}function u(T){let L=Mt(T),S=typeof T=="string",w=(L||S)&&T.length;return L?w===o||w===i:S?w===2*o||w===2*i:T instanceof f}function E(T,L,S=!0){if(u(T))throw new Error("first arg must be private key");if(!u(L))throw new Error("second arg must be public key");return f.fromHex(L).multiply(y(T)).toRawBytes(S)}let B=t.bits2int||function(T){if(T.length>8192)throw new Error("input is too large");let L=It(T),S=T.length*8-t.nBitLength;return S>0?L>>BigInt(S):L},A=t.bits2int_modN||function(T){return c(B(T))},b=Ae(t.nBitLength);function I(T){return at("num < 2^"+t.nBitLength,T,Lt,b),Ot(T,t.nByteLength)}function R(T,L,S=K){if(["recovered","canonical"].some(Q=>Q in S))throw new Error("sign() legacy options not supported");let{hash:w,randomBytes:v}=t,{lowS:C,prehash:N,extraEntropy:k}=S;C==null&&(C=!0),T=j("msgHash",T),Jo(S),N&&(T=j("prehashed msgHash",w(T)));let z=A(T),H=y(L),M=[I(H),I(z)];if(k!=null&&k!==!1){let Q=k===!0?v(e.BYTES):k;M.push(j("extraEntropy",Q))}let q=Tt(...M),V=z;function $(Q){let tt=B(Q);if(!g(tt))return;let et=a(tt),st=f.BASE.multiply(tt).toAffine(),nt=c(st.x);if(nt===Lt)return;let bt=c(et*c(V+nt*H));if(bt===Lt)return;let Et=(st.x===nt?0:2)|Number(st.y&J),xe=bt;return C&&s(bt)&&(xe=l(bt),Et^=1),new x(nt,xe,Et)}return{seed:q,k2sig:$}}let K={lowS:t.lowS,prehash:!1},P={lowS:t.lowS,prehash:!1};function O(T,L,S=K){let{seed:w,k2sig:v}=R(T,L,S),C=t;return Hr(C.hash.outputLen,C.nByteLength,C.hmac)(w,v)}f.BASE._setWindowSize(8);function U(T,L,S,w=P){let v=T;L=j("msgHash",L),S=j("publicKey",S);let{lowS:C,prehash:N,format:k}=w;if(Jo(w),"strict"in w)throw new Error("options.strict was renamed to lowS");if(k!==void 0&&k!=="compact"&&k!=="der")throw new Error("format must be compact or der");let z=typeof v=="string"||Mt(v),H=!z&&!k&&typeof v=="object"&&v!==null&&typeof v.r=="bigint"&&typeof v.s=="bigint";if(!z&&!H)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let M,q;try{if(H&&(M=new x(v.r,v.s)),z){try{k!=="compact"&&(M=x.fromDER(v))}catch(Et){if(!(Et instanceof Ct.Err))throw Et}!M&&k!=="der"&&(M=x.fromCompact(v))}q=f.fromHex(S)}catch{return!1}if(!M||C&&M.hasHighS())return!1;N&&(L=t.hash(L));let{r:V,s:$}=M,Q=A(L),tt=a($),et=c(Q*tt),st=c(V*tt),nt=f.BASE.multiplyAndAddUnsafe(q,et,st)?.toAffine();return nt?c(nt.x)===V:!1}return{CURVE:t,getPublicKey:m,getSharedSecret:E,sign:O,verify:U,ProjectivePoint:f,Signature:x,utils:p}}function ma(r){return{hash:r,hmac:(t,...e)=>vn(r,t,Nr(...e)),randomBytes:Ze}}function ri(r,t){let e=n=>ei({...r,...ma(n)});return{...e(t),create:e}}var ii=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),ni=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),xa=BigInt(1),In=BigInt(2),oi=(r,t)=>(r+t/In)/t;function ga(r){let t=ii,e=BigInt(3),n=BigInt(6),o=BigInt(11),i=BigInt(22),c=BigInt(23),a=BigInt(44),f=BigInt(88),y=r*r*r%t,h=y*y*r%t,g=G(h,e,t)*h%t,_=G(g,e,t)*h%t,s=G(_,In,t)*y%t,l=G(s,o,t)*s%t,d=G(l,i,t)*l%t,x=G(d,a,t)*d%t,p=G(x,f,t)*x%t,m=G(p,a,t)*d%t,u=G(m,e,t)*h%t,E=G(u,c,t)*l%t,B=G(E,n,t)*y%t,A=G(B,In,t);if(!Tn.eql(Tn.sqr(A),r))throw new Error("Cannot find square root");return A}var Tn=Pt(ii,void 0,void 0,{sqrt:ga}),re=ri({a:BigInt(0),b:BigInt(7),Fp:Tn,n:ni,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:r=>{let t=ni,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-xa*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=e,c=BigInt("0x100000000000000000000000000000000"),a=oi(i*r,t),f=oi(-n*r,t),y=F(r-a*e-f*o,t),h=F(-a*n-f*i,t),g=y>c,_=h>c;if(g&&(y=t-y),_&&(h=t-h),y>c||h>c)throw new Error("splitScalar: Endomorphism failed, k="+r);return{k1neg:g,k1:y,k2neg:_,k2:h}}}},Qo),_h=BigInt(0);var Sh=re.ProjectivePoint;function si(r){return r==null?!1:typeof r.then=="function"&&typeof r.catch=="function"&&typeof r.finally=="function"}function ci(r,t,e){let n=Re.digest(e instanceof Uint8Array?e:e.subarray());if(si(n))return n.then(({digest:o})=>re.verify(t,o,r)).catch(o=>{throw new Ne(String(o))});try{return re.verify(t,n.digest,r)}catch(o){throw new Ne(String(o))}}var dr=class{type="secp256k1";raw;_key;constructor(t){this._key=fi(t),this.raw=ai(this._key)}toMultihash(){return St.digest(nr(this))}toCID(){return lt.createV1(114,this.toMultihash())}toString(){return X.encode(this.toMultihash().bytes).substring(1)}equals(t){return t==null||!(t.raw instanceof Uint8Array)?!1:Bt(this.raw,t.raw)}verify(t,e){return ci(this._key,e,t)}};function ui(r){return new dr(r)}function ai(r){return re.ProjectivePoint.fromHex(r).toRawBytes(!0)}function fi(r){try{return re.ProjectivePoint.fromHex(r),r}catch(t){throw new He(String(t))}}function hi(r){let{Type:t,Data:e}=Ue.decode(r.digest),n=e??new Uint8Array;switch(t){case ht.Ed25519:return Lo(n);case ht.secp256k1:return ui(n);default:throw new be}}function nr(r){return Ue.encode({Type:ht[r.type],Data:r.raw})}var li=Symbol.for("nodejs.util.inspect.custom"),ba=114,ke=class{type;multihash;publicKey;string;constructor(t){this.type=t.type,this.multihash=t.multihash,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}[_r]=!0;toString(){return this.string==null&&(this.string=X.encode(this.multihash.bytes).slice(1)),this.string}toMultihash(){return this.multihash}toCID(){return lt.createV1(ba,this.multihash)}toJSON(){return this.toString()}equals(t){if(t==null)return!1;if(t instanceof Uint8Array)return Bt(this.multihash.bytes,t);if(typeof t=="string")return this.toString()===t;if(t?.toMultihash()?.bytes!=null)return Bt(this.multihash.bytes,t.toMultihash().bytes);throw new Error("not valid Id")}[li](){return`PeerId(${this.toString()})`}},pr=class extends ke{type="RSA";publicKey;constructor(t){super({...t,type:"RSA"}),this.publicKey=t.publicKey}},mr=class extends ke{type="Ed25519";publicKey;constructor(t){super({...t,type:"Ed25519"}),this.publicKey=t.publicKey}},xr=class extends ke{type="secp256k1";publicKey;constructor(t){super({...t,type:"secp256k1"}),this.publicKey=t.publicKey}},wa=2336,gr=class{type="url";multihash;publicKey;url;constructor(t){this.url=t.toString(),this.multihash=St.digest(it(this.url))}[li](){return`PeerId(${this.url})`}[_r]=!0;toString(){return this.toCID().toString()}toMultihash(){return this.multihash}toCID(){return lt.createV1(wa,this.toMultihash())}toJSON(){return this.toString()}equals(t){return t==null?!1:(t instanceof Uint8Array&&(t=hr(t)),t.toString()===this.toString())}};function di(r){if(Ea(r))return new pr({multihash:r});if(ya(r))try{let t=hi(r);if(t.type==="Ed25519")return new mr({multihash:r,publicKey:t});if(t.type==="secp256k1")return new xr({multihash:r,publicKey:t})}catch{let e=hr(r.digest);return new gr(new URL(e))}throw new Ke("Supplied PeerID Multihash is invalid")}function ya(r){return r.code===St.code}function Ea(r){return r.code===Re.code}function yt(r,t){let e={[Symbol.iterator]:()=>e,next:()=>{let n=r.next(),o=n.value;return n.done===!0||o==null?{done:!0,value:void 0}:{done:!1,value:t(o)}}};return e}function br(r){let t=_e(X.decode(`z${r}`));return di(t)}var Ft=class{map;constructor(t){if(this.map=new Map,t!=null)for(let[e,n]of t.entries())this.map.set(e.toString(),{key:e,value:n})}[Symbol.iterator](){return this.entries()}clear(){this.map.clear()}delete(t){return this.map.delete(t.toString())}entries(){return yt(this.map.entries(),t=>[t[1].key,t[1].value])}forEach(t){this.map.forEach((e,n)=>{t(e.value,e.key,this)})}get(t){return this.map.get(t.toString())?.value}has(t){return this.map.has(t.toString())}set(t,e){this.map.set(t.toString(),{key:t,value:e})}keys(){return yt(this.map.values(),t=>t.key)}values(){return yt(this.map.values(),t=>t.value)}get size(){return this.map.size}};function pi(){return new Ft}var Vt=class r{set;constructor(t){if(this.set=new Set,t!=null)for(let e of t)this.set.add(e.toString())}get size(){return this.set.size}[Symbol.iterator](){return this.values()}add(t){this.set.add(t.toString())}clear(){this.set.clear()}delete(t){this.set.delete(t.toString())}entries(){return yt(this.set.entries(),t=>{let e=br(t[0]);return[e,e]})}forEach(t){this.set.forEach(e=>{let n=br(e);t(n,n,this)})}has(t){return this.set.has(t.toString())}values(){return yt(this.set.values(),t=>br(t))}intersection(t){let e=new r;for(let n of t)this.has(n)&&e.add(n);return e}difference(t){let e=new r;for(let n of this)t.has(n)||e.add(n);return e}union(t){let e=new r;for(let n of t)e.add(n);for(let n of this)e.add(n);return e}};function mi(){return new Vt}var Zt=class r{list;constructor(t){if(this.list=[],t!=null)for(let e of t)this.list.push(e)}[Symbol.iterator](){return yt(this.list.entries(),t=>t[1])}concat(t){let e=new r(this);for(let n of t)e.push(n);return e}entries(){return yt(this.list.entries(),t=>[t[0],t[1]])}every(t){return this.list.every((e,n)=>t(e,n,this))}filter(t){let e=new r;return this.list.forEach((n,o)=>{t(n,o,this)&&e.push(n)}),e}find(t){let e=this.list.find((n,o)=>t(n,o,this));if(e!=null)return e}findIndex(t){return this.list.findIndex((e,n)=>t(e,n,this))}forEach(t){this.list.forEach((e,n)=>{t(e,n,this)})}includes(t){return this.includes(t)}indexOf(t){return this.list.findIndex(e=>e.equals(t))}pop(){let t=this.list.pop();if(t!=null)return t}push(...t){for(let e of t)this.list.push(e)}shift(){let t=this.list.shift();if(t!=null)return t}unshift(...t){let e=this.list.length;for(let n=t.length-1;n>-1;n--)e=this.list.unshift(t[n]);return e}clear(){this.list=[]}get length(){return this.list.length}};function xi(){return new Zt}var Rn=64,gt=class{fp;h;seed;constructor(t,e,n,o=2){if(o>Rn)throw new TypeError("Invalid Fingerprint Size");let i=e.hashV(t,n),c=Uo(o);for(let a=0;a<c.length;a++)c[a]=i[a];c.length===0&&(c[0]=7),this.fp=c,this.h=e,this.seed=n}hash(){return this.h.hash(this.fp,this.seed)}equals(t){return t?.fp instanceof Uint8Array?Bt(this.fp,t.fp):!1}};function ne(r,t){return Math.floor(Math.random()*(t-r))+r}var oe=class{contents;constructor(t){this.contents=new Array(t).fill(null)}has(t){if(!(t instanceof gt))throw new TypeError("Invalid Fingerprint");return this.contents.some(e=>t.equals(e))}add(t){if(!(t instanceof gt))throw new TypeError("Invalid Fingerprint");for(let e=0;e<this.contents.length;e++)if(this.contents[e]==null)return this.contents[e]=t,!0;return!0}swap(t){if(!(t instanceof gt))throw new TypeError("Invalid Fingerprint");let e=ne(0,this.contents.length-1),n=this.contents[e];return this.contents[e]=t,n}remove(t){if(!(t instanceof gt))throw new TypeError("Invalid Fingerprint");let e=this.contents.findIndex(n=>t.equals(n));return e>-1?(this.contents[e]=null,!0):!1}};var Cn={32:16777619n,64:1099511628211n,128:309485009821345068724781371n,256:374144419156711147060143317175368453031918731002211n,512:35835915874844867368919076489095108449946327955754392558399825615420669938882575126094039892345713852759n,1024:5016456510113118655434598811035278955030765345404790744303017523831112055108147451509157692220295382716162651878526895249385292291816524375083746691371804094271873160484737966720260389217684476157468082573n},yi={32:2166136261n,64:14695981039346656037n,128:144066263297769815596495629667062367629n,256:100029257958052580907070968620625704837092796014241193945225284501741471925557n,512:9659303129496669498009435400716310466090418745672637896108374329434462657994582932197716438449813051892206539805784495328239340083876191928701583869517785n,1024:14197795064947621068722070641403218320880622795441933960878474914617582723252296732303717722150864096521202355549365628174669108571814760471015076148029755969804077320157692458563003215304957150157403644460363550505412711285966361610267868082893823963790439336411086884584107735010676915n},Ei=new globalThis.TextEncoder;function _a(r,t){let e=Cn[t],n=yi[t];for(let o=0;o<r.length;o++)n^=BigInt(r[o]),n=BigInt.asUintN(t,n*e);return n}function Sa(r,t,e){if(e.length===0)throw new Error("The `utf8Buffer` option must have a length greater than zero");let n=Cn[t],o=yi[t],i=r;for(;i.length>0;){let c=Ei.encodeInto(i,e);i=i.slice(c.read);for(let a=0;a<c.written;a++)o^=BigInt(e[a]),o=BigInt.asUintN(t,o*n)}return o}function Ln(r,{size:t=32,utf8Buffer:e}={}){if(!Cn[t])throw new Error("The `size` option must be one of 32, 64, 128, 256, 512, or 1024");if(typeof r=="string"){if(e)return Sa(r,t,e);r=Ei.encode(r)}return _a(r,t)}var Ba=Hi(wi(),1);var De={hash:r=>Number(Ln(r,{size:32})),hashV:(r,t)=>va(De.hash(r,t))};function va(r){let t=r.toString(16);return t.length%2===1&&(t=`0${t}`),it(t,"base16")}var Aa=500,Oe=class{bucketSize;filterSize;fingerprintSize;buckets;count;hash;seed;constructor(t){this.filterSize=t.filterSize,this.bucketSize=t.bucketSize??4,this.fingerprintSize=t.fingerprintSize??2,this.count=0,this.buckets=[],this.hash=t.hash??De,this.seed=t.seed??ne(0,Math.pow(2,10))}add(t){typeof t=="string"&&(t=it(t));let e=new gt(t,this.hash,this.seed,this.fingerprintSize),n=this.hash.hash(t,this.seed)%this.filterSize,o=(n^e.hash())%this.filterSize;if(this.buckets[n]==null&&(this.buckets[n]=new oe(this.bucketSize)),this.buckets[o]==null&&(this.buckets[o]=new oe(this.bucketSize)),this.buckets[n].add(e)||this.buckets[o].add(e))return this.count++,!0;let i=[n,o],c=i[ne(0,i.length-1)];this.buckets[c]==null&&(this.buckets[c]=new oe(this.bucketSize));for(let a=0;a<Aa;a++){let f=this.buckets[c].swap(e);if(f!=null&&(c=(c^f.hash())%this.filterSize,this.buckets[c]==null&&(this.buckets[c]=new oe(this.bucketSize)),this.buckets[c].add(f)))return this.count++,!0}return!1}has(t){typeof t=="string"&&(t=it(t));let e=new gt(t,this.hash,this.seed,this.fingerprintSize),n=this.hash.hash(t,this.seed)%this.filterSize,o=this.buckets[n]?.has(e)??!1;if(o)return o;let i=(n^e.hash())%this.filterSize;return this.buckets[i]?.has(e)??!1}remove(t){typeof t=="string"&&(t=it(t));let e=new gt(t,this.hash,this.seed,this.fingerprintSize),n=this.hash.hash(t,this.seed)%this.filterSize,o=this.buckets[n]?.remove(e)??!1;if(o)return this.count--,o;let i=(n^e.hash())%this.filterSize,c=this.buckets[i]?.remove(e)??!1;return c&&this.count--,c}get reliable(){return Math.floor(100*(this.count/this.filterSize))<=90}},Ia={1:.5,2:.84,4:.95,8:.98};function Ta(r=.001){return r>.002?2:r>1e-5?4:8}function _i(r,t=.001){let e=Ta(t),n=Ia[e],o=Math.round(r/n),i=Math.min(Math.ceil(Math.log2(1/t)+Math.log2(2*e)),Rn);return{filterSize:o,bucketSize:e,fingerprintSize:i}}var yr=class{filterSize;bucketSize;fingerprintSize;scale;filterSeries;hash;seed;constructor(t){this.bucketSize=t.bucketSize??4,this.filterSize=t.filterSize??(1<<18)/this.bucketSize,this.fingerprintSize=t.fingerprintSize??2,this.scale=t.scale??2,this.hash=t.hash??De,this.seed=t.seed??ne(0,Math.pow(2,10)),this.filterSeries=[new Oe({filterSize:this.filterSize,bucketSize:this.bucketSize,fingerprintSize:this.fingerprintSize,hash:this.hash,seed:this.seed})]}add(t){if(typeof t=="string"&&(t=it(t)),this.has(t))return!0;let e=this.filterSeries.find(n=>n.reliable);if(e==null){let n=this.filterSize*Math.pow(this.scale,this.filterSeries.length);e=new Oe({filterSize:n,bucketSize:this.bucketSize,fingerprintSize:this.fingerprintSize,hash:this.hash,seed:this.seed}),this.filterSeries.push(e)}return e.add(t)}has(t){typeof t=="string"&&(t=it(t));for(let e=0;e<this.filterSeries.length;e++)if(this.filterSeries[e].has(t))return!0;return!1}remove(t){typeof t=="string"&&(t=it(t));for(let e=0;e<this.filterSeries.length;e++)if(this.filterSeries[e].remove(t))return!0;return!1}get count(){return this.filterSeries.reduce((t,e)=>t+e.count,0)}};function Un(r,t=.001,e){return new yr({..._i(r,t),...e??{}})}var Pe=class{filter;constructor(t,e){this.filter=Un(t,e)}has(t){return this.filter.has(t.toMultihash().bytes)}add(t){this.filter.add(t.toMultihash().bytes)}remove(t){this.filter.remove?.(t.toMultihash().bytes)}};function Si(r,t=.001){return new Pe(r,t)}var Nn=class extends Ft{metric;constructor(t){super();let{name:e,metrics:n}=t;this.metric=n.registerMetric(e),this.updateComponentMetric()}set(t,e){return super.set(t,e),this.updateComponentMetric(),this}delete(t){let e=super.delete(t);return this.updateComponentMetric(),e}clear(){super.clear(),this.updateComponentMetric()}updateComponentMetric(){this.metric.update(this.size)}};function Bi(r){let{name:t,metrics:e}=r,n;return e!=null?n=new Nn({name:t,metrics:e}):n=new Ft,n}var kn=class extends Vt{metric;constructor(t){super();let{name:e,metrics:n}=t;this.metric=n.registerMetric(e),this.updateComponentMetric()}add(t){super.add(t),this.updateComponentMetric()}delete(t){super.delete(t),this.updateComponentMetric()}clear(){super.clear(),this.updateComponentMetric()}updateComponentMetric(){this.metric.update(this.size)}};function vi(r){let{name:t,metrics:e}=r,n;return e!=null?n=new kn({name:t,metrics:e}):n=new Vt,n}var Mn=class extends Zt{metric;constructor(t){super();let{name:e,metrics:n}=t;this.metric=n.registerMetric(e),this.updateComponentMetric()}pop(){let t=super.pop();return this.updateComponentMetric(),t}push(...t){super.push(...t),this.updateComponentMetric()}shift(){let t=super.shift();return this.updateComponentMetric(),t}unshift(...t){let e=super.unshift(...t);return this.updateComponentMetric(),e}clear(){super.clear(),this.updateComponentMetric()}updateComponentMetric(){this.metric.update(this.length)}};function Ai(r){let{name:t,metrics:e}=r,n;return e!=null?n=new Mn({name:t,metrics:e}):n=new Zt,n}return Ki(Ra);})();
3
3
  /*! Bundled license information:
4
4
 
5
5
  @noble/hashes/esm/utils.js:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/peer-collections",
3
- "version": "6.0.16-96f14e429",
3
+ "version": "6.0.16-d72b51184",
4
4
  "description": "Stores values against a peer id",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/peer-collections#readme",
@@ -54,13 +54,13 @@
54
54
  "test:electron-main": "aegir test -t electron-main"
55
55
  },
56
56
  "dependencies": {
57
- "@libp2p/interface": "2.4.1-96f14e429",
58
- "@libp2p/peer-id": "5.0.11-96f14e429",
59
- "@libp2p/utils": "6.5.0-96f14e429",
57
+ "@libp2p/interface": "2.4.1-d72b51184",
58
+ "@libp2p/peer-id": "5.0.11-d72b51184",
59
+ "@libp2p/utils": "6.5.0-d72b51184",
60
60
  "multiformats": "^13.3.1"
61
61
  },
62
62
  "devDependencies": {
63
- "@libp2p/crypto": "5.0.10-96f14e429",
63
+ "@libp2p/crypto": "5.0.10-d72b51184",
64
64
  "@types/sinon": "^17.0.3",
65
65
  "aegir": "^45.0.5",
66
66
  "sinon": "^19.0.2",