@libp2p/peer-collections 6.0.1 → 6.0.2-7f7ec82ae
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.min.js +1 -1
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/tracked-list.d.ts +1 -11
- package/dist/src/tracked-list.d.ts.map +1 -1
- package/dist/src/tracked-list.js.map +1 -1
- package/dist/src/tracked-map.d.ts +1 -11
- package/dist/src/tracked-map.d.ts.map +1 -1
- package/dist/src/tracked-map.js.map +1 -1
- package/dist/src/tracked-set.d.ts +1 -11
- package/dist/src/tracked-set.d.ts.map +1 -1
- package/dist/src/tracked-set.js.map +1 -1
- package/package.json +5 -5
- package/src/index.ts +3 -0
- package/src/tracked-list.ts +3 -15
- package/src/tracked-map.ts +3 -15
- package/src/tracked-set.ts +3 -15
- package/dist/typedoc-urls.json +0 -13
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 Ts=Object.create;var Pe=Object.defineProperty;var Rs=Object.getOwnPropertyDescriptor;var Ls=Object.getOwnPropertyNames;var Cs=Object.getPrototypeOf,Ns=Object.prototype.hasOwnProperty;var Pn=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),ct=(r,t)=>{for(var e in t)Pe(r,e,{get:t[e],enumerable:!0})},zn=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ls(t))!Ns.call(r,o)&&o!==e&&Pe(r,o,{get:()=>t[o],enumerable:!(n=Rs(t,o))||n.enumerable});return r};var Us=(r,t,e)=>(e=r!=null?Ts(Cs(r)):{},zn(t||!r||!r.__esModule?Pe(e,"default",{value:r,enumerable:!0}):e,r)),ks=r=>zn(Pe({},"__esModule",{value:!0}),r);var us=Pn((ke,xr)=>{(function(r,t){"use strict";var e={version:"3.0.0",x86:{},x64:{},inputValidation:!0};function n(c){if(!Array.isArray(c)&&!ArrayBuffer.isView(c))return!1;for(var p=0;p<c.length;p++)if(!Number.isInteger(c[p])||c[p]<0||c[p]>255)return!1;return!0}function o(c,p){return(c&65535)*p+(((c>>>16)*p&65535)<<16)}function s(c,p){return c<<p|c>>>32-p}function i(c){return c^=c>>>16,c=o(c,2246822507),c^=c>>>13,c=o(c,3266489909),c^=c>>>16,c}function a(c,p){c=[c[0]>>>16,c[0]&65535,c[1]>>>16,c[1]&65535],p=[p[0]>>>16,p[0]&65535,p[1]>>>16,p[1]&65535];var l=[0,0,0,0];return l[3]+=c[3]+p[3],l[2]+=l[3]>>>16,l[3]&=65535,l[2]+=c[2]+p[2],l[1]+=l[2]>>>16,l[2]&=65535,l[1]+=c[1]+p[1],l[0]+=l[1]>>>16,l[1]&=65535,l[0]+=c[0]+p[0],l[0]&=65535,[l[0]<<16|l[1],l[2]<<16|l[3]]}function f(c,p){c=[c[0]>>>16,c[0]&65535,c[1]>>>16,c[1]&65535],p=[p[0]>>>16,p[0]&65535,p[1]>>>16,p[1]&65535];var l=[0,0,0,0];return l[3]+=c[3]*p[3],l[2]+=l[3]>>>16,l[3]&=65535,l[2]+=c[2]*p[3],l[1]+=l[2]>>>16,l[2]&=65535,l[2]+=c[3]*p[2],l[1]+=l[2]>>>16,l[2]&=65535,l[1]+=c[1]*p[3],l[0]+=l[1]>>>16,l[1]&=65535,l[1]+=c[2]*p[2],l[0]+=l[1]>>>16,l[1]&=65535,l[1]+=c[3]*p[1],l[0]+=l[1]>>>16,l[1]&=65535,l[0]+=c[0]*p[3]+c[1]*p[2]+c[2]*p[1]+c[3]*p[0],l[0]&=65535,[l[0]<<16|l[1],l[2]<<16|l[3]]}function b(c,p){return p%=64,p===32?[c[1],c[0]]:p<32?[c[0]<<p|c[1]>>>32-p,c[1]<<p|c[0]>>>32-p]:(p-=32,[c[1]<<p|c[0]>>>32-p,c[0]<<p|c[1]>>>32-p])}function u(c,p){return p%=64,p===0?c:p<32?[c[0]<<p|c[1]>>>32-p,c[1]<<p]:[c[1]<<p-32,0]}function m(c,p){return[c[0]^p[0],c[1]^p[1]]}function _(c){return c=m(c,[0,c[0]>>>1]),c=f(c,[4283543511,3981806797]),c=m(c,[0,c[0]>>>1]),c=f(c,[3301882366,444984403]),c=m(c,[0,c[0]>>>1]),c}e.x86.hash32=function(c,p){if(e.inputValidation&&!n(c))return t;p=p||0;for(var l=c.length%4,g=c.length-l,d=p,x=0,h=3432918353,w=461845907,B=0;B<g;B=B+4)x=c[B]|c[B+1]<<8|c[B+2]<<16|c[B+3]<<24,x=o(x,h),x=s(x,15),x=o(x,w),d^=x,d=s(d,13),d=o(d,5)+3864292196;switch(x=0,l){case 3:x^=c[B+2]<<16;case 2:x^=c[B+1]<<8;case 1:x^=c[B],x=o(x,h),x=s(x,15),x=o(x,w),d^=x}return d^=c.length,d=i(d),d>>>0},e.x86.hash128=function(c,p){if(e.inputValidation&&!n(c))return t;p=p||0;for(var l=c.length%16,g=c.length-l,d=p,x=p,h=p,w=p,B=0,I=0,y=0,v=0,R=597399067,V=2869860233,O=951274213,M=2716044179,N=0;N<g;N=N+16)B=c[N]|c[N+1]<<8|c[N+2]<<16|c[N+3]<<24,I=c[N+4]|c[N+5]<<8|c[N+6]<<16|c[N+7]<<24,y=c[N+8]|c[N+9]<<8|c[N+10]<<16|c[N+11]<<24,v=c[N+12]|c[N+13]<<8|c[N+14]<<16|c[N+15]<<24,B=o(B,R),B=s(B,15),B=o(B,V),d^=B,d=s(d,19),d+=x,d=o(d,5)+1444728091,I=o(I,V),I=s(I,16),I=o(I,O),x^=I,x=s(x,17),x+=h,x=o(x,5)+197830471,y=o(y,O),y=s(y,17),y=o(y,M),h^=y,h=s(h,15),h+=w,h=o(h,5)+2530024501,v=o(v,M),v=s(v,18),v=o(v,R),w^=v,w=s(w,13),w+=d,w=o(w,5)+850148119;switch(B=0,I=0,y=0,v=0,l){case 15:v^=c[N+14]<<16;case 14:v^=c[N+13]<<8;case 13:v^=c[N+12],v=o(v,M),v=s(v,18),v=o(v,R),w^=v;case 12:y^=c[N+11]<<24;case 11:y^=c[N+10]<<16;case 10:y^=c[N+9]<<8;case 9:y^=c[N+8],y=o(y,O),y=s(y,17),y=o(y,M),h^=y;case 8:I^=c[N+7]<<24;case 7:I^=c[N+6]<<16;case 6:I^=c[N+5]<<8;case 5:I^=c[N+4],I=o(I,V),I=s(I,16),I=o(I,O),x^=I;case 4:B^=c[N+3]<<24;case 3:B^=c[N+2]<<16;case 2:B^=c[N+1]<<8;case 1:B^=c[N],B=o(B,R),B=s(B,15),B=o(B,V),d^=B}return d^=c.length,x^=c.length,h^=c.length,w^=c.length,d+=x,d+=h,d+=w,x+=d,h+=d,w+=d,d=i(d),x=i(x),h=i(h),w=i(w),d+=x,d+=h,d+=w,x+=d,h+=d,w+=d,("00000000"+(d>>>0).toString(16)).slice(-8)+("00000000"+(x>>>0).toString(16)).slice(-8)+("00000000"+(h>>>0).toString(16)).slice(-8)+("00000000"+(w>>>0).toString(16)).slice(-8)},e.x64.hash128=function(c,p){if(e.inputValidation&&!n(c))return t;p=p||0;for(var l=c.length%16,g=c.length-l,d=[0,p],x=[0,p],h=[0,0],w=[0,0],B=[2277735313,289559509],I=[1291169091,658871167],y=0;y<g;y=y+16)h=[c[y+4]|c[y+5]<<8|c[y+6]<<16|c[y+7]<<24,c[y]|c[y+1]<<8|c[y+2]<<16|c[y+3]<<24],w=[c[y+12]|c[y+13]<<8|c[y+14]<<16|c[y+15]<<24,c[y+8]|c[y+9]<<8|c[y+10]<<16|c[y+11]<<24],h=f(h,B),h=b(h,31),h=f(h,I),d=m(d,h),d=b(d,27),d=a(d,x),d=a(f(d,[0,5]),[0,1390208809]),w=f(w,I),w=b(w,33),w=f(w,B),x=m(x,w),x=b(x,31),x=a(x,d),x=a(f(x,[0,5]),[0,944331445]);switch(h=[0,0],w=[0,0],l){case 15:w=m(w,u([0,c[y+14]],48));case 14:w=m(w,u([0,c[y+13]],40));case 13:w=m(w,u([0,c[y+12]],32));case 12:w=m(w,u([0,c[y+11]],24));case 11:w=m(w,u([0,c[y+10]],16));case 10:w=m(w,u([0,c[y+9]],8));case 9:w=m(w,[0,c[y+8]]),w=f(w,I),w=b(w,33),w=f(w,B),x=m(x,w);case 8:h=m(h,u([0,c[y+7]],56));case 7:h=m(h,u([0,c[y+6]],48));case 6:h=m(h,u([0,c[y+5]],40));case 5:h=m(h,u([0,c[y+4]],32));case 4:h=m(h,u([0,c[y+3]],24));case 3:h=m(h,u([0,c[y+2]],16));case 2:h=m(h,u([0,c[y+1]],8));case 1:h=m(h,[0,c[y]]),h=f(h,B),h=b(h,31),h=f(h,I),d=m(d,h)}return d=m(d,[0,c.length]),x=m(x,[0,c.length]),d=a(d,x),x=a(x,d),d=_(d),x=_(x),d=a(d,x),x=a(x,d),("00000000"+(d[0]>>>0).toString(16)).slice(-8)+("00000000"+(d[1]>>>0).toString(16)).slice(-8)+("00000000"+(x[0]>>>0).toString(16)).slice(-8)+("00000000"+(x[1]>>>0).toString(16)).slice(-8)},typeof ke<"u"?(typeof xr<"u"&&xr.exports&&(ke=xr.exports=e),ke.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)})(ke)});var ls=Pn((U0,hs)=>{hs.exports=us()});var Sa={};ct(Sa,{PeerFilter:()=>Oe,PeerList:()=>Vt,PeerMap:()=>qt,PeerSet:()=>Ft,peerFilter:()=>xs,peerList:()=>fs,peerMap:()=>cs,peerSet:()=>as,trackedPeerList:()=>ys,trackedPeerMap:()=>gs,trackedPeerSet:()=>bs});var yr=Symbol.for("@libp2p/peer-id");var ge=class extends Error{static name="InvalidParametersError";constructor(t="Invalid parameters"){super(t),this.name="InvalidParametersError"}},ze=class extends Error{static name="InvalidPublicKeyError";constructor(t="Invalid public key"){super(t),this.name="InvalidPublicKeyError"}};var He=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 Br={};ct(Br,{base58btc:()=>X,base58flickr:()=>Hs});var Aa=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 Et(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 Kn(r){return new TextEncoder().encode(r)}function qn(r){return new TextDecoder().decode(r)}function Ds(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 a=r.length,f=r.charAt(0),b=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function m(p){if(p instanceof Uint8Array||(ArrayBuffer.isView(p)?p=new Uint8Array(p.buffer,p.byteOffset,p.byteLength):Array.isArray(p)&&(p=Uint8Array.from(p))),!(p instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(p.length===0)return"";for(var l=0,g=0,d=0,x=p.length;d!==x&&p[d]===0;)d++,l++;for(var h=(x-d)*u+1>>>0,w=new Uint8Array(h);d!==x;){for(var B=p[d],I=0,y=h-1;(B!==0||I<g)&&y!==-1;y--,I++)B+=256*w[y]>>>0,w[y]=B%a>>>0,B=B/a>>>0;if(B!==0)throw new Error("Non-zero carry");g=I,d++}for(var v=h-g;v!==h&&w[v]===0;)v++;for(var R=f.repeat(l);v<h;++v)R+=r.charAt(w[v]);return R}function _(p){if(typeof p!="string")throw new TypeError("Expected String");if(p.length===0)return new Uint8Array;var l=0;if(p[l]!==" "){for(var g=0,d=0;p[l]===f;)g++,l++;for(var x=(p.length-l)*b+1>>>0,h=new Uint8Array(x);p[l];){var w=e[p.charCodeAt(l)];if(w===255)return;for(var B=0,I=x-1;(w!==0||B<d)&&I!==-1;I--,B++)w+=a*h[I]>>>0,h[I]=w%256>>>0,w=w/256>>>0;if(w!==0)throw new Error("Non-zero carry");d=B,l++}if(p[l]!==" "){for(var y=x-d;y!==x&&h[y]===0;)y++;for(var v=new Uint8Array(g+(x-y)),R=g;y!==x;)v[R++]=h[y++];return v}}}function c(p){var l=_(p);if(l)return l;throw new Error(`Non-${t} character`)}return{encode:m,decodeUnsafe:_,decode:c}}var Ms=Ds,Os=Ms,Vn=Os;var wr=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")}},Er=class{name;prefix;baseDecode;prefixCodePoint;constructor(t,e,n){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),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 $n(this,t)}},_r=class{decoders;constructor(t){this.decoders=t}or(t){return $n(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 $n(r,t){return new _r({...r.decoders??{[r.prefix]:r},...t.decoders??{[t.prefix]:t}})}var Sr=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 wr(t,e,n),this.decoder=new Er(t,e,o)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};function oe({name:r,prefix:t,encode:e,decode:n}){return new Sr(r,t,e,n)}function Ct({name:r,prefix:t,alphabet:e}){let{encode:n,decode:o}=Vn(e,r);return oe({prefix:t,name:r,encode:n,decode:s=>Et(o(s))})}function Ps(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),a=0,f=0,b=0;for(let u=0;u<s;++u){let m=o[r[u]];if(m===void 0)throw new SyntaxError(`Non-${n} character`);f=f<<e|m,a+=e,a>=8&&(a-=8,i[b++]=255&f>>a)}if(a>=e||255&f<<8-a)throw new SyntaxError("Unexpected end of data");return i}function zs(r,t,e){let n=t[t.length-1]==="=",o=(1<<e)-1,s="",i=0,a=0;for(let f=0;f<r.length;++f)for(a=a<<8|r[f],i+=8;i>e;)i-=e,s+=t[o&a>>i];if(i!==0&&(s+=t[o&a<<e-i]),n)for(;s.length*e&7;)s+="=";return s}function G({name:r,prefix:t,bitsPerChar:e,alphabet:n}){return oe({prefix:t,name:r,encode(o){return zs(o,n,e)},decode(o){return Ps(o,n,e,r)}})}var X=Ct({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Hs=Ct({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var vr={};ct(vr,{base32:()=>se,base32hex:()=>Vs,base32hexpad:()=>Zs,base32hexpadupper:()=>Gs,base32hexupper:()=>$s,base32pad:()=>qs,base32padupper:()=>Fs,base32upper:()=>Ks,base32z:()=>js});var se=G({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Ks=G({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),qs=G({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Fs=G({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Vs=G({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),$s=G({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Zs=G({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Gs=G({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),js=G({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Ys=jn,Zn=128,Xs=127,Ws=~Xs,Qs=Math.pow(2,31);function jn(r,t,e){t=t||[],e=e||0;for(var n=e;r>=Qs;)t[e++]=r&255|Zn,r/=128;for(;r&Ws;)t[e++]=r&255|Zn,r>>>=7;return t[e]=r|0,jn.bytes=e-n+1,t}var Js=Ir,ti=128,Gn=127;function Ir(r,n){var e=0,n=n||0,o=0,s=n,i,a=r.length;do{if(s>=a)throw Ir.bytes=0,new RangeError("Could not decode varint");i=r[s++],e+=o<28?(i&Gn)<<o:(i&Gn)*Math.pow(2,o),o+=7}while(i>=ti);return Ir.bytes=s-n,e}var ei=Math.pow(2,7),ri=Math.pow(2,14),ni=Math.pow(2,21),oi=Math.pow(2,28),si=Math.pow(2,35),ii=Math.pow(2,42),ci=Math.pow(2,49),ai=Math.pow(2,56),fi=Math.pow(2,63),ui=function(r){return r<ei?1:r<ri?2:r<ni?3:r<oi?4:r<si?5:r<ii?6:r<ci?7:r<ai?8:r<fi?9:10},hi={encode:Ys,decode:Js,encodingLength:ui},li=hi,ye=li;function we(r,t=0){return[ye.decode(r,t),ye.decode.bytes]}function ie(r,t,e=0){return ye.encode(r,t,e),t}function ce(r){return ye.encodingLength(r)}function $t(r,t){let e=t.byteLength,n=ce(r),o=n+ce(e),s=new Uint8Array(o+e);return ie(r,s,0),ie(e,s,n),s.set(t,o),new ae(r,e,t,s)}function Ee(r){let t=Et(r),[e,n]=we(t),[o,s]=we(t.subarray(n)),i=t.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new ae(e,o,i,t)}function Yn(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 ae=class{code;size;digest;bytes;constructor(t,e,n,o){this.code=t,this.size=e,this.digest=n,this.bytes=o}};function Xn(r,t){let{bytes:e,version:n}=r;switch(n){case 0:return pi(e,Ar(r),t??X.encoder);default:return mi(e,Ar(r),t??se.encoder)}}var Wn=new WeakMap;function Ar(r){let t=Wn.get(r);if(t==null){let e=new Map;return Wn.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!==_e)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==xi)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=$t(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&&Yn(t.multihash,n.multihash)}toString(t){return Xn(this,t)}toJSON(){return{"/":Xn(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??Qn(n,o,s.bytes))}else if(e[gi]===!0){let{version:n,multihash:o,code:s}=e,i=Ee(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!==_e)throw new Error(`Version 0 CID must use dag-pb (code: ${_e}) block encoding`);return new r(t,e,n,n.bytes)}case 1:{let o=Qn(t,e,n.bytes);return new r(t,e,n,o)}default:throw new Error("Invalid version")}}static createV0(t){return r.create(0,_e,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=Et(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 ae(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[m,_]=we(t.subarray(e));return e+=_,m},o=n(),s=_e;if(o===18?(o=0,e=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=e,a=n(),f=n(),b=e+f,u=b-i;return{version:o,codec:s,multihashCode:a,digestSize:f,multihashSize:u,size:b}}static parse(t,e){let[n,o]=di(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 Ar(s).set(n,t),s}};function di(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)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],t.decode(r)]}}}function pi(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 mi(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 _e=112,xi=18;function Qn(r,t,e){let n=ce(r),o=n+ce(t),s=new Uint8Array(o+e.byteLength);return ie(r,s,0),ie(t,s,n),s.set(e,o),s}var gi=Symbol.for("@ipld/js-cid/CID");var Tr={};ct(Tr,{identity:()=>_t});var Jn=0,bi="identity",to=Et;function yi(r){return $t(Jn,to(r))}var _t={code:Jn,name:bi,encode:to,digest:yi};function St(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 eo(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`positive integer expected, not ${r}`)}function wi(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function fe(r,...t){if(!wi(r))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(r.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${r.length}`)}function ro(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");eo(r.outputLen),eo(r.blockLen)}function ue(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 no(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 Gt=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var qe=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),dt=(r,t)=>r<<32-t|r>>>t;var ja=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function oo(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function Se(r){return typeof r=="string"&&(r=oo(r)),fe(r),r}function Rr(...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 he=class{clone(){return this._cloneInto()}},Ya={}.toString;function Fe(r){let t=n=>r().update(Se(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function Ve(r=32){if(Gt&&typeof Gt.getRandomValues=="function")return Gt.getRandomValues(new Uint8Array(r));if(Gt&&typeof Gt.randomBytes=="function")return Gt.randomBytes(r);throw new Error("crypto.getRandomValues must be defined")}function Ei(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),a=Number(e&s),f=n?4:0,b=n?0:4;r.setUint32(t+f,i,n),r.setUint32(t+b,a,n)}var so=(r,t,e)=>r&t^~r&e,io=(r,t,e)=>r&t^r&e^t&e,le=class extends he{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=qe(this.buffer)}update(t){ue(this);let{view:e,buffer:n,blockLen:o}=this;t=Se(t);let s=t.length;for(let i=0;i<s;){let a=Math.min(o-this.pos,s-i);if(a===o){let f=qe(t);for(;o<=s-i;i+=o)this.process(f,i);continue}n.set(t.subarray(i,i+a),this.pos),this.pos+=a,i+=a,this.pos===o&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){ue(this),no(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 m=i;m<o;m++)e[m]=0;Ei(n,o-8,BigInt(this.length*8),s),this.process(n,0);let a=qe(t),f=this.outputLen;if(f%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let b=f/4,u=this.get();if(b>u.length)throw new Error("_sha2: outputLen bigger than state");for(let m=0;m<b;m++)a.setUint32(4*m,u[m],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:a}=this;return t.length=o,t.pos=a,t.finished=s,t.destroyed=i,o%e&&t.buffer.set(n),t}};var $e=BigInt(4294967295),Lr=BigInt(32);function co(r,t=!1){return t?{h:Number(r&$e),l:Number(r>>Lr&$e)}:{h:Number(r>>Lr&$e)|0,l:Number(r&$e)|0}}function _i(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}=co(r[o],t);[e[o],n[o]]=[s,i]}return[e,n]}var Si=(r,t)=>BigInt(r>>>0)<<Lr|BigInt(t>>>0),Bi=(r,t,e)=>r>>>e,vi=(r,t,e)=>r<<32-e|t>>>e,Ii=(r,t,e)=>r>>>e|t<<32-e,Ai=(r,t,e)=>r<<32-e|t>>>e,Ti=(r,t,e)=>r<<64-e|t>>>e-32,Ri=(r,t,e)=>r>>>e-32|t<<64-e,Li=(r,t)=>t,Ci=(r,t)=>r,Ni=(r,t,e)=>r<<e|t>>>32-e,Ui=(r,t,e)=>t<<e|r>>>32-e,ki=(r,t,e)=>t<<e-32|r>>>64-e,Di=(r,t,e)=>r<<e-32|t>>>64-e;function Mi(r,t,e,n){let o=(t>>>0)+(n>>>0);return{h:r+e+(o/2**32|0)|0,l:o|0}}var Oi=(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),Pi=(r,t,e,n)=>t+e+n+(r/2**32|0)|0,zi=(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),Hi=(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),qi=(r,t,e,n,o,s)=>t+e+n+o+s+(r/2**32|0)|0;var Fi={fromBig:co,split:_i,toBig:Si,shrSH:Bi,shrSL:vi,rotrSH:Ii,rotrSL:Ai,rotrBH:Ti,rotrBL:Ri,rotr32H:Li,rotr32L:Ci,rotlSH:Ni,rotlSL:Ui,rotlBH:ki,rotlBL:Di,add:Mi,add3L:Oi,add3H:Pi,add4L:zi,add4H:Hi,add5H:qi,add5L:Ki},D=Fi;var[Vi,$i]=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),Ut=new Uint32Array(80),Cr=class extends le{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:a,Dl:f,Eh:b,El:u,Fh:m,Fl:_,Gh:c,Gl:p,Hh:l,Hl:g}=this;return[t,e,n,o,s,i,a,f,b,u,m,_,c,p,l,g]}set(t,e,n,o,s,i,a,f,b,u,m,_,c,p,l,g){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=a|0,this.Dl=f|0,this.Eh=b|0,this.El=u|0,this.Fh=m|0,this.Fl=_|0,this.Gh=c|0,this.Gl=p|0,this.Hh=l|0,this.Hl=g|0}process(t,e){for(let h=0;h<16;h++,e+=4)Nt[h]=t.getUint32(e),Ut[h]=t.getUint32(e+=4);for(let h=16;h<80;h++){let w=Nt[h-15]|0,B=Ut[h-15]|0,I=D.rotrSH(w,B,1)^D.rotrSH(w,B,8)^D.shrSH(w,B,7),y=D.rotrSL(w,B,1)^D.rotrSL(w,B,8)^D.shrSL(w,B,7),v=Nt[h-2]|0,R=Ut[h-2]|0,V=D.rotrSH(v,R,19)^D.rotrBH(v,R,61)^D.shrSH(v,R,6),O=D.rotrSL(v,R,19)^D.rotrBL(v,R,61)^D.shrSL(v,R,6),M=D.add4L(y,O,Ut[h-7],Ut[h-16]),N=D.add4H(M,I,V,Nt[h-7],Nt[h-16]);Nt[h]=N|0,Ut[h]=M|0}let{Ah:n,Al:o,Bh:s,Bl:i,Ch:a,Cl:f,Dh:b,Dl:u,Eh:m,El:_,Fh:c,Fl:p,Gh:l,Gl:g,Hh:d,Hl:x}=this;for(let h=0;h<80;h++){let w=D.rotrSH(m,_,14)^D.rotrSH(m,_,18)^D.rotrBH(m,_,41),B=D.rotrSL(m,_,14)^D.rotrSL(m,_,18)^D.rotrBL(m,_,41),I=m&c^~m&l,y=_&p^~_&g,v=D.add5L(x,B,y,$i[h],Ut[h]),R=D.add5H(v,d,w,I,Vi[h],Nt[h]),V=v|0,O=D.rotrSH(n,o,28)^D.rotrBH(n,o,34)^D.rotrBH(n,o,39),M=D.rotrSL(n,o,28)^D.rotrBL(n,o,34)^D.rotrBL(n,o,39),N=n&s^n&a^s&a,T=o&i^o&f^i&f;d=l|0,x=g|0,l=c|0,g=p|0,c=m|0,p=_|0,{h:m,l:_}=D.add(b|0,u|0,R|0,V|0),b=a|0,u=f|0,a=s|0,f=i|0,s=n|0,i=o|0;let L=D.add3L(V,M,T);n=D.add3H(L,R,O,N),o=L|0}({h:n,l:o}=D.add(this.Ah|0,this.Al|0,n|0,o|0)),{h:s,l:i}=D.add(this.Bh|0,this.Bl|0,s|0,i|0),{h:a,l:f}=D.add(this.Ch|0,this.Cl|0,a|0,f|0),{h:b,l:u}=D.add(this.Dh|0,this.Dl|0,b|0,u|0),{h:m,l:_}=D.add(this.Eh|0,this.El|0,m|0,_|0),{h:c,l:p}=D.add(this.Fh|0,this.Fl|0,c|0,p|0),{h:l,l:g}=D.add(this.Gh|0,this.Gl|0,l|0,g|0),{h:d,l:x}=D.add(this.Hh|0,this.Hl|0,d|0,x|0),this.set(n,o,s,i,a,f,b,u,m,_,c,p,l,g,d,x)}roundClean(){Nt.fill(0),Ut.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 ao=Fe(()=>new Cr);var Ge={};ct(Ge,{aInRange:()=>at,abool:()=>pt,abytes:()=>de,bitGet:()=>Wi,bitLen:()=>Mr,bitMask:()=>ve,bitSet:()=>Qi,bytesToHex:()=>vt,bytesToNumberBE:()=>It,bytesToNumberLE:()=>Dt,concatBytes:()=>At,createHmacDrbg:()=>Or,ensureBytes:()=>j,equalBytes:()=>Yi,hexToBytes:()=>Yt,hexToNumber:()=>Dr,inRange:()=>Be,isBytes:()=>kt,memoized:()=>Wt,notImplemented:()=>tc,numberToBytesBE:()=>Mt,numberToBytesLE:()=>Xt,numberToHexUnpadded:()=>jt,numberToVarBytesBE:()=>ji,utf8ToBytes:()=>Xi,validateObject:()=>bt});var kr=BigInt(0),Ze=BigInt(1),Zi=BigInt(2);function kt(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function de(r){if(!kt(r))throw new Error("Uint8Array expected")}function pt(r,t){if(typeof t!="boolean")throw new Error(`${r} must be valid boolean, got "${t}".`)}var Gi=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function vt(r){de(r);let t="";for(let e=0;e<r.length;e++)t+=Gi[r[e]];return t}function jt(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 BigInt(r===""?"0":`0x${r}`)}var Bt={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function fo(r){if(r>=Bt._0&&r<=Bt._9)return r-Bt._0;if(r>=Bt._A&&r<=Bt._F)return r-(Bt._A-10);if(r>=Bt._a&&r<=Bt._f)return r-(Bt._a-10)}function Yt(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("padded 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)),a=fo(r.charCodeAt(s+1));if(i===void 0||a===void 0){let f=r[s]+r[s+1];throw new Error('hex string expected, got non-hex character "'+f+'" at index '+s)}n[o]=i*16+a}return n}function It(r){return Dr(vt(r))}function Dt(r){return de(r),Dr(vt(Uint8Array.from(r).reverse()))}function Mt(r,t){return Yt(r.toString(16).padStart(t*2,"0"))}function Xt(r,t){return Mt(r,t).reverse()}function ji(r){return Yt(jt(r))}function j(r,t,e){let n;if(typeof t=="string")try{n=Yt(t)}catch(s){throw new Error(`${r} must be valid hex string, got "${t}". 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} expected ${e} bytes, got ${o}`);return n}function At(...r){let t=0;for(let n=0;n<r.length;n++){let o=r[n];de(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(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}var Nr=r=>typeof r=="bigint"&&kr<=r;function Be(r,t,e){return Nr(r)&&Nr(t)&&Nr(e)&&t<=r&&r<e}function at(r,t,e,n){if(!Be(t,e,n))throw new Error(`expected valid ${r}: ${e} <= n < ${n}, got ${typeof t} ${t}`)}function Mr(r){let t;for(t=0;r>kr;r>>=Ze,t+=1);return t}function Wi(r,t){return r>>BigInt(t)&Ze}function Qi(r,t,e){return r|(e?Ze:kr)<<BigInt(t)}var ve=r=>(Zi<<BigInt(r-1))-Ze,Ur=r=>new Uint8Array(r),uo=r=>Uint8Array.from(r);function Or(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=Ur(r),o=Ur(r),s=0,i=()=>{n.fill(1),o.fill(0),s=0},a=(...m)=>e(o,n,...m),f=(m=Ur())=>{o=a(uo([0]),m),n=a(),m.length!==0&&(o=a(uo([1]),m),n=a())},b=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let m=0,_=[];for(;m<t;){n=a();let c=n.slice();_.push(c),m+=n.length}return At(..._)};return(m,_)=>{i(),f(m);let c;for(;!(c=_(b()));)f();return i(),c}}var Ji={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 bt(r,t,e={}){let n=(o,s,i)=>{let a=Ji[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);let f=r[o];if(!(i&&f===void 0)&&!a(f,r))throw new Error(`Invalid param ${String(o)}=${f} (${typeof f}), expected ${s}`)};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 tc=()=>{throw new Error("not implemented")};function Wt(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),$=BigInt(1),Qt=BigInt(2),ec=BigInt(3),Pr=BigInt(4),ho=BigInt(5),lo=BigInt(8),rc=BigInt(9),nc=BigInt(16);function q(r,t){let e=r%t;return e>=W?e:t+e}function oc(r,t,e){if(e<=W||t<W)throw new Error("Expected power/modulo > 0");if(e===$)return W;let n=$;for(;t>W;)t&$&&(n=n*r%e),r=r*r%e,t>>=$;return n}function Z(r,t,e){let n=r;for(;t-- >W;)n*=n,n%=e;return n}function je(r,t){if(r===W||t<=W)throw new Error(`invert: expected positive integers, got n=${r} mod=${t}`);let e=q(r,t),n=t,o=W,s=$,i=$,a=W;for(;e!==W;){let b=n/e,u=n%e,m=o-i*b,_=s-a*b;n=e,e=u,o=i,s=a,i=m,a=_}if(n!==$)throw new Error("invert: does not exist");return q(o,t)}function sc(r){let t=(r-$)/Qt,e,n,o;for(e=r-$,n=0;e%Qt===W;e/=Qt,n++);for(o=Qt;o<r&&oc(o,t,r)!==r-$;o++);if(n===1){let i=(r+$)/Pr;return function(f,b){let u=f.pow(b,i);if(!f.eql(f.sqr(u),b))throw new Error("Cannot find square root");return u}}let s=(e+$)/Qt;return function(a,f){if(a.pow(f,t)===a.neg(a.ONE))throw new Error("Cannot find square root");let b=n,u=a.pow(a.mul(a.ONE,o),e),m=a.pow(f,s),_=a.pow(f,e);for(;!a.eql(_,a.ONE);){if(a.eql(_,a.ZERO))return a.ZERO;let c=1;for(let l=a.sqr(_);c<b&&!a.eql(l,a.ONE);c++)l=a.sqr(l);let p=a.pow(u,$<<BigInt(b-c-1));u=a.sqr(p),m=a.mul(m,p),_=a.mul(_,u),b=c}return m}}function ic(r){if(r%Pr===ec){let t=(r+$)/Pr;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%lo===ho){let t=(r-ho)/lo;return function(n,o){let s=n.mul(o,Qt),i=n.pow(s,t),a=n.mul(o,i),f=n.mul(n.mul(a,Qt),i),b=n.mul(a,n.sub(f,n.ONE));if(!n.eql(n.sqr(b),o))throw new Error("Cannot find square root");return b}}return r%nc,sc(r)}var po=(r,t)=>(q(r,t)&$)===$,cc=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function zr(r){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},e=cc.reduce((n,o)=>(n[o]="function",n),t);return bt(r,e)}function ac(r,t,e){if(e<W)throw new Error("Expected power > 0");if(e===W)return r.ONE;if(e===$)return t;let n=r.ONE,o=t;for(;e>W;)e&$&&(n=r.mul(n,o)),o=r.sqr(o),e>>=$;return n}function fc(r,t){let e=new Array(t.length),n=t.reduce((s,i,a)=>r.is0(i)?s:(e[a]=s,r.mul(s,i)),r.ONE),o=r.inv(n);return t.reduceRight((s,i,a)=>r.is0(i)?s:(e[a]=r.mul(s,e[a]),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 Ot(r,t,e=!1,n={}){if(r<=W)throw new Error(`Expected Field ORDER > 0, got ${r}`);let{nBitLength:o,nByteLength:s}=Hr(r,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");let i=ic(r),a=Object.freeze({ORDER:r,BITS:o,BYTES:s,MASK:ve(o),ZERO:W,ONE:$,create:f=>q(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&$)===$,neg:f=>q(-f,r),eql:(f,b)=>f===b,sqr:f=>q(f*f,r),add:(f,b)=>q(f+b,r),sub:(f,b)=>q(f-b,r),mul:(f,b)=>q(f*b,r),pow:(f,b)=>ac(a,f,b),div:(f,b)=>q(f*je(b,r),r),sqrN:f=>f*f,addN:(f,b)=>f+b,subN:(f,b)=>f-b,mulN:(f,b)=>f*b,inv:f=>je(f,r),sqrt:n.sqrt||(f=>i(a,f)),invertBatch:f=>fc(a,f),cmov:(f,b,u)=>u?b:f,toBytes:f=>e?Xt(f,s):Mt(f,s),fromBytes:f=>{if(f.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${f.length}`);return e?Dt(f):It(f)}});return Object.freeze(a)}function mo(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 Kr(r){let t=mo(r);return t+Math.ceil(t/2)}function xo(r,t,e=!1){let n=r.length,o=mo(t),s=Kr(t);if(n<16||n<s||n>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);let i=e?It(r):Dt(r),a=q(i,t-$)+$;return e?Xt(a,o):Mt(a,o)}var hc=BigInt(0),qr=BigInt(1),Fr=new WeakMap,go=new WeakMap;function Ye(r,t){let e=(s,i)=>{let a=i.negate();return s?a:i},n=s=>{if(!Number.isSafeInteger(s)||s<=0||s>t)throw new Error(`Wrong window size=${s}, should be [1..${t}]`)},o=s=>{n(s);let i=Math.ceil(t/s)+1,a=2**(s-1);return{windows:i,windowSize:a}};return{constTimeNegate:e,unsafeLadder(s,i){let a=r.ZERO,f=s;for(;i>hc;)i&qr&&(a=a.add(f)),f=f.double(),i>>=qr;return a},precomputeWindow(s,i){let{windows:a,windowSize:f}=o(i),b=[],u=s,m=u;for(let _=0;_<a;_++){m=u,b.push(m);for(let c=1;c<f;c++)m=m.add(u),b.push(m);u=m.double()}return b},wNAF(s,i,a){let{windows:f,windowSize:b}=o(s),u=r.ZERO,m=r.BASE,_=BigInt(2**s-1),c=2**s,p=BigInt(s);for(let l=0;l<f;l++){let g=l*b,d=Number(a&_);a>>=p,d>b&&(d-=c,a+=qr);let x=g,h=g+Math.abs(d)-1,w=l%2!==0,B=d<0;d===0?m=m.add(e(w,i[x])):u=u.add(e(B,i[h]))}return{p:u,f:m}},wNAFCached(s,i,a){let f=go.get(s)||1,b=Fr.get(s);return b||(b=this.precomputeWindow(s,f),f!==1&&Fr.set(s,a(b))),this.wNAF(f,b,i)},setWindowSize(s,i){n(i),go.set(s,i),Fr.delete(s)}}}function Xe(r,t,e,n){if(!Array.isArray(e)||!Array.isArray(n)||n.length!==e.length)throw new Error("arrays of points and scalars must have equal length");n.forEach((u,m)=>{if(!t.isValid(u))throw new Error(`wrong scalar at index ${m}`)}),e.forEach((u,m)=>{if(!(u instanceof r))throw new Error(`wrong point at index ${m}`)});let o=Mr(BigInt(e.length)),s=o>12?o-3:o>4?o-2:o?2:1,i=(1<<s)-1,a=new Array(i+1).fill(r.ZERO),f=Math.floor((t.BITS-1)/s)*s,b=r.ZERO;for(let u=f;u>=0;u-=s){a.fill(r.ZERO);for(let _=0;_<n.length;_++){let c=n[_],p=Number(c>>BigInt(u)&BigInt(i));a[p]=a[p].add(e[_])}let m=r.ZERO;for(let _=a.length-1,c=r.ZERO;_>0;_--)c=c.add(a[_]),m=m.add(c);if(b=b.add(m),u!==0)for(let _=0;_<s;_++)b=b.double()}return b}function Ie(r){return zr(r.Fp),bt(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),ft=BigInt(1),We=BigInt(2),lc=BigInt(8),dc={zip215:!0};function pc(r){let t=Ie(r);return bt(r,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}function bo(r){let t=pc(r),{Fp:e,n,prehash:o,hash:s,randomBytes:i,nByteLength:a,h:f}=t,b=We<<BigInt(a*8)-ft,u=e.create,m=Ot(t.n,t.nBitLength),_=t.uvRatio||((S,E)=>{try{return{isValid:!0,value:e.sqrt(S*e.inv(E))}}catch{return{isValid:!1,value:mt}}}),c=t.adjustScalarBytes||(S=>S),p=t.domain||((S,E,A)=>{if(pt("phflag",A),E.length||A)throw new Error("Contexts/pre-hash are not supported");return S});function l(S,E){at("coordinate "+S,E,mt,b)}function g(S){if(!(S instanceof h))throw new Error("ExtendedPoint expected")}let d=Wt((S,E)=>{let{ex:A,ey:C,ez:U}=S,k=S.is0();E==null&&(E=k?lc:e.inv(U));let P=u(A*E),H=u(C*E),z=u(U*E);if(k)return{x:mt,y:ft};if(z!==ft)throw new Error("invZ was invalid");return{x:P,y:H}}),x=Wt(S=>{let{a:E,d:A}=t;if(S.is0())throw new Error("bad point: ZERO");let{ex:C,ey:U,ez:k,et:P}=S,H=u(C*C),z=u(U*U),K=u(k*k),F=u(K*K),Q=u(H*E),J=u(K*u(Q+z)),et=u(F+u(A*u(H*z)));if(J!==et)throw new Error("bad point: equation left != right (1)");let nt=u(C*U),Y=u(k*P);if(nt!==Y)throw new Error("bad point: equation left != right (2)");return!0});class h{constructor(E,A,C,U){this.ex=E,this.ey=A,this.ez=C,this.et=U,l("x",E),l("y",A),l("z",C),l("t",U),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(E){if(E instanceof h)throw new Error("extended point not allowed");let{x:A,y:C}=E||{};return l("x",A),l("y",C),new h(A,C,ft,u(A*C))}static normalizeZ(E){let A=e.invertBatch(E.map(C=>C.ez));return E.map((C,U)=>C.toAffine(A[U])).map(h.fromAffine)}static msm(E,A){return Xe(h,m,E,A)}_setWindowSize(E){I.setWindowSize(this,E)}assertValidity(){x(this)}equals(E){g(E);let{ex:A,ey:C,ez:U}=this,{ex:k,ey:P,ez:H}=E,z=u(A*H),K=u(k*U),F=u(C*H),Q=u(P*U);return z===K&&F===Q}is0(){return this.equals(h.ZERO)}negate(){return new h(u(-this.ex),this.ey,this.ez,u(-this.et))}double(){let{a:E}=t,{ex:A,ey:C,ez:U}=this,k=u(A*A),P=u(C*C),H=u(We*u(U*U)),z=u(E*k),K=A+C,F=u(u(K*K)-k-P),Q=z+P,J=Q-H,et=z-P,nt=u(F*J),Y=u(Q*et),it=u(F*et),wt=u(J*Q);return new h(nt,Y,wt,it)}add(E){g(E);let{a:A,d:C}=t,{ex:U,ey:k,ez:P,et:H}=this,{ex:z,ey:K,ez:F,et:Q}=E;if(A===BigInt(-1)){let Cn=u((k-U)*(K+z)),Nn=u((k+U)*(K-z)),br=u(Nn-Cn);if(br===mt)return this.double();let Un=u(P*We*Q),kn=u(H*We*F),Dn=kn+Un,Mn=Nn+Cn,On=kn-Un,Bs=u(Dn*br),vs=u(Mn*On),Is=u(Dn*On),As=u(br*Mn);return new h(Bs,vs,As,Is)}let J=u(U*z),et=u(k*K),nt=u(H*C*Q),Y=u(P*F),it=u((U+k)*(z+K)-J-et),wt=Y-nt,me=Y+nt,xe=u(et-A*J),ws=u(it*wt),Es=u(me*xe),_s=u(it*xe),Ss=u(wt*me);return new h(ws,Es,Ss,_s)}subtract(E){return this.add(E.negate())}wNAF(E){return I.wNAFCached(this,E,h.normalizeZ)}multiply(E){let A=E;at("scalar",A,ft,n);let{p:C,f:U}=this.wNAF(A);return h.normalizeZ([C,U])[0]}multiplyUnsafe(E){let A=E;return at("scalar",A,mt,n),A===mt?B:this.equals(B)||A===ft?this:this.equals(w)?this.wNAF(A).p:I.unsafeLadder(this,A)}isSmallOrder(){return this.multiplyUnsafe(f).is0()}isTorsionFree(){return I.unsafeLadder(this,n).is0()}toAffine(E){return d(this,E)}clearCofactor(){let{h:E}=t;return E===ft?this:this.multiplyUnsafe(E)}static fromHex(E,A=!1){let{d:C,a:U}=t,k=e.BYTES;E=j("pointHex",E,k),pt("zip215",A);let P=E.slice(),H=E[k-1];P[k-1]=H&-129;let z=Dt(P),K=A?b:e.ORDER;at("pointHex.y",z,mt,K);let F=u(z*z),Q=u(F-ft),J=u(C*F-U),{isValid:et,value:nt}=_(Q,J);if(!et)throw new Error("Point.fromHex: invalid y coordinate");let Y=(nt&ft)===ft,it=(H&128)!==0;if(!A&&nt===mt&&it)throw new Error("Point.fromHex: x=0 and x_0=1");return it!==Y&&(nt=u(-nt)),h.fromAffine({x:nt,y:z})}static fromPrivateKey(E){return R(E).point}toRawBytes(){let{x:E,y:A}=this.toAffine(),C=Xt(A,e.BYTES);return C[C.length-1]|=E&ft?128:0,C}toHex(){return vt(this.toRawBytes())}}h.BASE=new h(t.Gx,t.Gy,ft,u(t.Gx*t.Gy)),h.ZERO=new h(mt,ft,ft,mt);let{BASE:w,ZERO:B}=h,I=Ye(h,a*8);function y(S){return q(S,n)}function v(S){return y(Dt(S))}function R(S){let E=a;S=j("private key",S,E);let A=j("hashed private key",s(S),2*E),C=c(A.slice(0,E)),U=A.slice(E,2*E),k=v(C),P=w.multiply(k),H=P.toRawBytes();return{head:C,prefix:U,scalar:k,point:P,pointBytes:H}}function V(S){return R(S).pointBytes}function O(S=new Uint8Array,...E){let A=At(...E);return v(s(p(A,j("context",S),!!o)))}function M(S,E,A={}){S=j("message",S),o&&(S=o(S));let{prefix:C,scalar:U,pointBytes:k}=R(E),P=O(A.context,C,S),H=w.multiply(P).toRawBytes(),z=O(A.context,H,k,S),K=y(P+z*U);at("signature.s",K,mt,n);let F=At(H,Xt(K,e.BYTES));return j("result",F,a*2)}let N=dc;function T(S,E,A,C=N){let{context:U,zip215:k}=C,P=e.BYTES;S=j("signature",S,2*P),E=j("message",E),k!==void 0&&pt("zip215",k),o&&(E=o(E));let H=Dt(S.slice(P,2*P)),z,K,F;try{z=h.fromHex(A,k),K=h.fromHex(S.slice(0,P),k),F=w.multiplyUnsafe(H)}catch{return!1}if(!k&&z.isSmallOrder())return!1;let Q=O(U,K.toRawBytes(),z.toRawBytes(),E);return K.add(z.multiplyUnsafe(Q)).subtract(F).clearCofactor().equals(h.ZERO)}return w._setWindowSize(8),{CURVE:t,getPublicKey:V,sign:M,verify:T,ExtendedPoint:h,utils:{getExtendedPublicKey:R,randomPrivateKey:()=>i(e.BYTES),precompute(S=8,E=h.BASE){return E._setWindowSize(S),E.multiply(BigInt(3)),E}}}}var Vr=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),yo=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),yf=BigInt(0),mc=BigInt(1),wo=BigInt(2),wf=BigInt(3),xc=BigInt(5),gc=BigInt(8);function bc(r){let t=BigInt(10),e=BigInt(20),n=BigInt(40),o=BigInt(80),s=Vr,a=r*r%s*r%s,f=Z(a,wo,s)*a%s,b=Z(f,mc,s)*r%s,u=Z(b,xc,s)*b%s,m=Z(u,t,s)*u%s,_=Z(m,e,s)*m%s,c=Z(_,n,s)*_%s,p=Z(c,o,s)*c%s,l=Z(p,o,s)*c%s,g=Z(l,t,s)*u%s;return{pow_p_5_8:Z(g,wo,s)*r%s,b2:a}}function yc(r){return r[0]&=248,r[31]&=127,r[31]|=64,r}function wc(r,t){let e=Vr,n=q(t*t*t,e),o=q(n*n*t,e),s=bc(r*o).pow_p_5_8,i=q(r*n*s,e),a=q(t*i*i,e),f=i,b=q(i*yo,e),u=a===r,m=a===q(-r,e),_=a===q(-r*yo,e);return u&&(i=f),(m||_)&&(i=b),po(i,e)&&(i=q(-i,e)),{isValid:u||m,value:i}}var Ec=Ot(Vr,void 0,!0),_c={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Ec,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:gc,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:ao,randomBytes:Ve,adjustScalarBytes:yc,uvRatio:wc},Eo=bo(_c);var Qe=32;function _o(r,t,e){return Eo.verify(t,e instanceof Uint8Array?e:e.subarray(),r)}var Je=class{type="Ed25519";raw;constructor(t){this.raw=$r(t,Qe)}toMultihash(){return _t.digest(tr(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:St(this.raw,t.raw)}verify(t,e){return _o(this.raw,e,t)}};function Bo(r){return r=$r(r,Qe),new Je(r)}function $r(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 vo(r=0){return new Uint8Array(r)}function Tt(r=0){return new Uint8Array(r)}var Bc=Math.pow(2,7),vc=Math.pow(2,14),Ic=Math.pow(2,21),Io=Math.pow(2,28),Ao=Math.pow(2,35),To=Math.pow(2,42),Ro=Math.pow(2,49),ot=128,Pt=127;function Ae(r){if(r<Bc)return 1;if(r<vc)return 2;if(r<Ic)return 3;if(r<Io)return 4;if(r<Ao)return 5;if(r<To)return 6;if(r<Ro)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function Lo(r,t,e=0){switch(Ae(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 Co(r,t){let e=r[t],n=0;if(n+=e&Pt,e<ot||(e=r[t+1],n+=(e&Pt)<<7,e<ot)||(e=r[t+2],n+=(e&Pt)<<14,e<ot)||(e=r[t+3],n+=(e&Pt)<<21,e<ot)||(e=r[t+4],n+=(e&Pt)*Io,e<ot)||(e=r[t+5],n+=(e&Pt)*Ao,e<ot)||(e=r[t+6],n+=(e&Pt)*To,e<ot)||(e=r[t+7],n+=(e&Pt)*Ro,e<ot))return n;throw new RangeError("Could not decode varint")}var Zr=new Float32Array([-0]),zt=new Uint8Array(Zr.buffer);function No(r,t,e){Zr[0]=r,t[e]=zt[0],t[e+1]=zt[1],t[e+2]=zt[2],t[e+3]=zt[3]}function Uo(r,t){return zt[0]=r[t],zt[1]=r[t+1],zt[2]=r[t+2],zt[3]=r[t+3],Zr[0]}var Gr=new Float64Array([-0]),rt=new Uint8Array(Gr.buffer);function ko(r,t,e){Gr[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 Do(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],Gr[0]}var Ac=BigInt(Number.MAX_SAFE_INTEGER),Tc=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 Jt;if(t<Ac&&t>Tc)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>Mo&&(o=0n,++n>Mo&&(n=0n))),new r(Number(o),Number(n))}static fromNumber(t){if(t===0)return Jt;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):Jt}},Jt=new ut(0,0);Jt.toBigInt=function(){return 0n};Jt.zzEncode=Jt.zzDecode=function(){return this};Jt.length=function(){return 1};var Mo=4294967296n;function Oo(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 Po(r,t,e){if(e-t<1)return"";let o,s=[],i=0,a;for(;t<e;)a=r[t++],a<128?s[i++]=a:a>191&&a<224?s[i++]=(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,s[i++]=55296+(a>>10),s[i++]=56320+(a&1023)):s[i++]=(a&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 jr(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 er(r,t){return(r[t-4]|r[t-3]<<8|r[t-2]<<16|r[t-1]<<24)>>>0}var Yr=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 er(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw xt(this,4);return er(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw xt(this,4);let t=Uo(this.buf,this.pos);return this.pos+=4,t}double(){if(this.pos+8>this.len)throw xt(this,4);let t=Do(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 Po(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=er(this.buf,this.pos+=4),e=er(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=Co(this.buf,this.pos);return this.pos+=Ae(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 Xr(r){return new Yr(r instanceof Uint8Array?r:r.subarray())}function rr(r,t,e){let n=Xr(r);return t.decode(n,void 0,e)}var Wr={};ct(Wr,{base10:()=>Rc});var Rc=Ct({prefix:"9",name:"base10",alphabet:"0123456789"});var Qr={};ct(Qr,{base16:()=>Lc,base16upper:()=>Cc});var Lc=G({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Cc=G({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Jr={};ct(Jr,{base2:()=>Nc});var Nc=G({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var tn={};ct(tn,{base256emoji:()=>Oc});var Ho=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=Ho.reduce((r,t,e)=>(r[e]=t,r),[]),kc=Ho.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function Dc(r){return r.reduce((t,e)=>(t+=Uc[e],t),"")}function Mc(r){let t=[];for(let e of r){let n=kc[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}var Oc=oe({prefix:"\u{1F680}",name:"base256emoji",encode:Dc,decode:Mc});var en={};ct(en,{base36:()=>Pc,base36upper:()=>zc});var Pc=Ct({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),zc=Ct({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var rn={};ct(rn,{base64:()=>Hc,base64pad:()=>Kc,base64url:()=>qc,base64urlpad:()=>Fc});var Hc=G({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Kc=G({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),qc=G({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Fc=G({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var nn={};ct(nn,{base8:()=>Vc});var Vc=G({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var on={};ct(on,{identity:()=>$c});var $c=oe({prefix:"\0",name:"identity",encode:r=>qn(r),decode:r=>Kn(r)});var ou=new TextEncoder,su=new TextDecoder;var an={};ct(an,{sha256:()=>Te,sha512:()=>jc});function cn({name:r,code:t,encode:e}){return new sn(r,t,e)}var sn=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?$t(this.code,e):e.then(n=>$t(this.code,n))}else throw Error("Unknown type, must be binary type")}};function qo(r){return async t=>new Uint8Array(await crypto.subtle.digest(r,t))}var Te=cn({name:"sha2-256",code:18,encode:qo("SHA-256")}),jc=cn({name:"sha2-512",code:19,encode:qo("SHA-512")});var fn={...on,...Jr,...nn,...Wr,...Qr,...vr,...en,...Br,...rn,...tn},gu={...an,...Tr};function Vo(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var Fo=Vo("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),un=Vo("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=Tt(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),Yc={utf8:Fo,"utf-8":Fo,hex:fn.base16,latin1:un,ascii:un,binary:un,...fn},nr=Yc;function st(r,t="utf8"){let e=nr[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return e.decoder.decode(`${e.prefix}${r}`)}function hn(r){let t=r??8192,e=t>>>1,n,o=t;return function(i){if(i<1||i>e)return Tt(i);o+i>t&&(n=Tt(t),o=0);let a=n.subarray(o,o+=i);return o&7&&(o=(o|7)+1),a}}var te=class{fn;len;next;val;constructor(t,e,n){this.fn=t,this.len=e,this.next=void 0,this.val=n}};function ln(){}var pn=class{head;tail;len;next;constructor(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}},Xc=hn();function Wc(r){return globalThis.Buffer!=null?Tt(r):Xc(r)}var Le=class{len;head;tail;states;constructor(){this.len=0,this.head=new te(ln,0,0),this.tail=this.head,this.states=null}_push(t,e,n){return this.tail=this.tail.next=new te(t,e,n),this.len+=e,this}uint32(t){return this.len+=(this.tail=this.tail.next=new mn((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(or,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(or,e.length(),e)}uint64Number(t){return this._push(Lo,Ae(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(or,e.length(),e)}sint64Number(t){let e=ut.fromNumber(t).zzEncode();return this._push(or,e.length(),e)}sint64String(t){return this.sint64(BigInt(t))}bool(t){return this._push(dn,1,t?1:0)}fixed32(t){return this._push(Re,4,t>>>0)}sfixed32(t){return this.fixed32(t)}fixed64(t){let e=ut.fromBigInt(t);return this._push(Re,4,e.lo)._push(Re,4,e.hi)}fixed64Number(t){let e=ut.fromNumber(t);return this._push(Re,4,e.lo)._push(Re,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(No,4,t)}double(t){return this._push(ko,8,t)}bytes(t){let e=t.length>>>0;return e===0?this._push(dn,1,0):this.uint32(e)._push(Jc,e,t)}string(t){let e=Oo(t);return e!==0?this.uint32(e)._push(jr,e,t):this._push(dn,1,0)}fork(){return this.states=new pn(this),this.head=this.tail=new te(ln,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 te(ln,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=Wc(this.len),n=0;for(;t!=null;)t.fn(t.val,e,n),n+=t.len,t=t.next;return e}};function dn(r,t,e){t[e]=r&255}function Qc(r,t,e){for(;r>127;)t[e++]=r&127|128,r>>>=7;t[e]=r}var mn=class extends te{next;constructor(t,e){super(Qc,t,e),this.next=void 0}};function or(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 Re(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 Jc(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(ta,t,r),this},Le.prototype.string=function(r){let t=globalThis.Buffer.byteLength(r);return this.uint32(t),t>0&&this._push(ea,t,r),this});function ta(r,t,e){t.set(r,e)}function ea(r,t,e){r.length<40?jr(r,t,e):t.utf8Write!=null?t.utf8Write(r,e):t.set(st(r),e)}function xn(){return new Le}function sr(r,t){let e=xn();return t.encode(r,e,{lengthDelimited:!1}),e.finish()}var pe;(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"})(pe||(pe={}));function ir(r,t,e,n){return{name:r,type:t,encode:e,decode:n}}function gn(r){function t(o){if(r[o.toString()]==null)throw new Error("Invalid enum value");return r[o]}let e=function(s,i){let a=t(s);i.int32(a)},n=function(s){let i=s.int32();return t(i)};return ir("enum",pe.VARINT,e,n)}function cr(r,t){return ir("message",pe.LENGTH_DELIMITED,r,t)}var ht;(function(r){r.RSA="RSA",r.Ed25519="Ed25519",r.secp256k1="secp256k1"})(ht||(ht={}));var bn;(function(r){r[r.RSA=0]="RSA",r[r.Ed25519=1]="Ed25519",r[r.secp256k1=2]="secp256k1"})(bn||(bn={}));(function(r){r.codec=()=>gn(bn)})(ht||(ht={}));var Ce;(function(r){let t;r.codec=()=>(t==null&&(t=cr((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 a=e.uint32();switch(a>>>3){case 1:{s.Type=ht.codec().decode(e);break}case 2:{s.Data=e.bytes();break}default:{e.skipType(a&7);break}}}return s})),t),r.encode=e=>sr(e,r.codec()),r.decode=(e,n)=>rr(e,r.codec(),n)})(Ce||(Ce={}));var yn;(function(r){let t;r.codec=()=>(t==null&&(t=cr((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 a=e.uint32();switch(a>>>3){case 1:{s.Type=ht.codec().decode(e);break}case 2:{s.Data=e.bytes();break}default:{e.skipType(a&7);break}}}return s})),t),r.encode=e=>sr(e,r.codec()),r.decode=(e,n)=>rr(e,r.codec(),n)})(yn||(yn={}));var na=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]),Kt=new Uint32Array(64),wn=class extends le{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:a,H:f}=this;return[t,e,n,o,s,i,a,f]}set(t,e,n,o,s,i,a,f){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=a|0,this.H=f|0}process(t,e){for(let m=0;m<16;m++,e+=4)Kt[m]=t.getUint32(e,!1);for(let m=16;m<64;m++){let _=Kt[m-15],c=Kt[m-2],p=dt(_,7)^dt(_,18)^_>>>3,l=dt(c,17)^dt(c,19)^c>>>10;Kt[m]=l+Kt[m-7]+p+Kt[m-16]|0}let{A:n,B:o,C:s,D:i,E:a,F:f,G:b,H:u}=this;for(let m=0;m<64;m++){let _=dt(a,6)^dt(a,11)^dt(a,25),c=u+_+so(a,f,b)+na[m]+Kt[m]|0,l=(dt(n,2)^dt(n,13)^dt(n,22))+io(n,o,s)|0;u=b,b=f,f=a,a=i+c|0,i=s,s=o,o=n,n=c+l|0}n=n+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,a=a+this.E|0,f=f+this.F|0,b=b+this.G|0,u=u+this.H|0,this.set(n,o,s,i,a,f,b,u)}roundClean(){Kt.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var $o=Fe(()=>new wn);function ar(r,t="utf8"){let e=nr[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 he{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,ro(t);let n=Se(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 ue(this),this.iHash.update(t),this}digestInto(t){ue(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:a}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,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()}},En=(r,t,e)=>new fr(r,t).update(e).digest();En.create=(r,t)=>new fr(r,t);function Zo(r){r.lowS!==void 0&&pt("lowS",r.lowS),r.prehash!==void 0&&pt("prehash",r.prehash)}function oa(r){let t=Ie(r);bt(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("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("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}var{bytesToNumberBE:sa,hexToBytes:ia}=Ge,Rt={Err:class extends Error{constructor(t=""){super(t)}},_tlv:{encode:(r,t)=>{let{Err:e}=Rt;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=jt(n);if(o.length/2&128)throw new e("tlv.encode: long form length too big");let s=n>127?jt(o.length/2|128):"";return`${jt(r)}${s}${o}${t}`},decode(r,t){let{Err:e}=Rt,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 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 b=t.subarray(n,n+f);if(b.length!==f)throw new e("tlv.decode: length bytes not complete");if(b[0]===0)throw new e("tlv.decode(long): zero leftmost byte");for(let u of b)i=i<<8|u;if(n+=f,i<128)throw new e("tlv.decode(long): not minimal encoding")}let a=t.subarray(n,n+i);if(a.length!==i)throw new e("tlv.decode: wrong value length");return{v:a,l:t.subarray(n+i)}}},_int:{encode(r){let{Err:t}=Rt;if(r<Lt)throw new t("integer: negative integers are not allowed");let e=jt(r);if(Number.parseInt(e[0],16)&8&&(e="00"+e),e.length&1)throw new t("unexpected assertion");return e},decode(r){let{Err:t}=Rt;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 sa(r)}},toSig(r){let{Err:t,_int:e,_tlv:n}=Rt,o=typeof r=="string"?ia(r):r;de(o);let{v:s,l:i}=n.decode(48,o);if(i.length)throw new t("Invalid signature: left bytes after parsing");let{v:a,l:f}=n.decode(2,s),{v:b,l:u}=n.decode(2,f);if(u.length)throw new t("Invalid signature: left bytes after parsing");return{r:e.decode(a),s:e.decode(b)}},hexFromSig(r){let{_tlv:t,_int:e}=Rt,n=`${t.encode(2,e.encode(r.r))}${t.encode(2,e.encode(r.s))}`;return t.encode(48,n)}},Lt=BigInt(0),tt=BigInt(1),ih=BigInt(2),Go=BigInt(3),ch=BigInt(4);function ca(r){let t=oa(r),{Fp:e}=t,n=Ot(t.n,t.nBitLength),o=t.toBytes||((l,g,d)=>{let x=g.toAffine();return At(Uint8Array.from([4]),e.toBytes(x.x),e.toBytes(x.y))}),s=t.fromBytes||(l=>{let g=l.subarray(1),d=e.fromBytes(g.subarray(0,e.BYTES)),x=e.fromBytes(g.subarray(e.BYTES,2*e.BYTES));return{x:d,y:x}});function i(l){let{a:g,b:d}=t,x=e.sqr(l),h=e.mul(x,l);return e.add(e.add(h,e.mul(l,g)),d)}if(!e.eql(e.sqr(t.Gy),i(t.Gx)))throw new Error("bad generator point: equation left != right");function a(l){return Be(l,tt,t.n)}function f(l){let{allowedPrivateKeyLengths:g,nByteLength:d,wrapPrivateKey:x,n:h}=t;if(g&&typeof l!="bigint"){if(kt(l)&&(l=vt(l)),typeof l!="string"||!g.includes(l.length))throw new Error("Invalid key");l=l.padStart(d*2,"0")}let w;try{w=typeof l=="bigint"?l:It(j("private key",l,d))}catch{throw new Error(`private key must be ${d} bytes, hex or bigint, not ${typeof l}`)}return x&&(w=q(w,h)),at("private key",w,tt,h),w}function b(l){if(!(l instanceof _))throw new Error("ProjectivePoint expected")}let u=Wt((l,g)=>{let{px:d,py:x,pz:h}=l;if(e.eql(h,e.ONE))return{x:d,y:x};let w=l.is0();g==null&&(g=w?e.ONE:e.inv(h));let B=e.mul(d,g),I=e.mul(x,g),y=e.mul(h,g);if(w)return{x:e.ZERO,y:e.ZERO};if(!e.eql(y,e.ONE))throw new Error("invZ was invalid");return{x:B,y:I}}),m=Wt(l=>{if(l.is0()){if(t.allowInfinityPoint&&!e.is0(l.py))return;throw new Error("bad point: ZERO")}let{x:g,y:d}=l.toAffine();if(!e.isValid(g)||!e.isValid(d))throw new Error("bad point: x or y not FE");let x=e.sqr(d),h=i(g);if(!e.eql(x,h))throw new Error("bad point: equation left != right");if(!l.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class _{constructor(g,d,x){if(this.px=g,this.py=d,this.pz=x,g==null||!e.isValid(g))throw new Error("x required");if(d==null||!e.isValid(d))throw new Error("y required");if(x==null||!e.isValid(x))throw new Error("z required");Object.freeze(this)}static fromAffine(g){let{x:d,y:x}=g||{};if(!g||!e.isValid(d)||!e.isValid(x))throw new Error("invalid affine point");if(g instanceof _)throw new Error("projective point not allowed");let h=w=>e.eql(w,e.ZERO);return h(d)&&h(x)?_.ZERO:new _(d,x,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(g){let d=e.invertBatch(g.map(x=>x.pz));return g.map((x,h)=>x.toAffine(d[h])).map(_.fromAffine)}static fromHex(g){let d=_.fromAffine(s(j("pointHex",g)));return d.assertValidity(),d}static fromPrivateKey(g){return _.BASE.multiply(f(g))}static msm(g,d){return Xe(_,n,g,d)}_setWindowSize(g){p.setWindowSize(this,g)}assertValidity(){m(this)}hasEvenY(){let{y:g}=this.toAffine();if(e.isOdd)return!e.isOdd(g);throw new Error("Field doesn't support isOdd")}equals(g){b(g);let{px:d,py:x,pz:h}=this,{px:w,py:B,pz:I}=g,y=e.eql(e.mul(d,I),e.mul(w,h)),v=e.eql(e.mul(x,I),e.mul(B,h));return y&&v}negate(){return new _(this.px,e.neg(this.py),this.pz)}double(){let{a:g,b:d}=t,x=e.mul(d,Go),{px:h,py:w,pz:B}=this,I=e.ZERO,y=e.ZERO,v=e.ZERO,R=e.mul(h,h),V=e.mul(w,w),O=e.mul(B,B),M=e.mul(h,w);return M=e.add(M,M),v=e.mul(h,B),v=e.add(v,v),I=e.mul(g,v),y=e.mul(x,O),y=e.add(I,y),I=e.sub(V,y),y=e.add(V,y),y=e.mul(I,y),I=e.mul(M,I),v=e.mul(x,v),O=e.mul(g,O),M=e.sub(R,O),M=e.mul(g,M),M=e.add(M,v),v=e.add(R,R),R=e.add(v,R),R=e.add(R,O),R=e.mul(R,M),y=e.add(y,R),O=e.mul(w,B),O=e.add(O,O),R=e.mul(O,M),I=e.sub(I,R),v=e.mul(O,V),v=e.add(v,v),v=e.add(v,v),new _(I,y,v)}add(g){b(g);let{px:d,py:x,pz:h}=this,{px:w,py:B,pz:I}=g,y=e.ZERO,v=e.ZERO,R=e.ZERO,V=t.a,O=e.mul(t.b,Go),M=e.mul(d,w),N=e.mul(x,B),T=e.mul(h,I),L=e.add(d,x),S=e.add(w,B);L=e.mul(L,S),S=e.add(M,N),L=e.sub(L,S),S=e.add(d,h);let E=e.add(w,I);return S=e.mul(S,E),E=e.add(M,T),S=e.sub(S,E),E=e.add(x,h),y=e.add(B,I),E=e.mul(E,y),y=e.add(N,T),E=e.sub(E,y),R=e.mul(V,S),y=e.mul(O,T),R=e.add(y,R),y=e.sub(N,R),R=e.add(N,R),v=e.mul(y,R),N=e.add(M,M),N=e.add(N,M),T=e.mul(V,T),S=e.mul(O,S),N=e.add(N,T),T=e.sub(M,T),T=e.mul(V,T),S=e.add(S,T),M=e.mul(N,S),v=e.add(v,M),M=e.mul(E,S),y=e.mul(L,y),y=e.sub(y,M),M=e.mul(L,N),R=e.mul(E,R),R=e.add(R,M),new _(y,v,R)}subtract(g){return this.add(g.negate())}is0(){return this.equals(_.ZERO)}wNAF(g){return p.wNAFCached(this,g,_.normalizeZ)}multiplyUnsafe(g){at("scalar",g,Lt,t.n);let d=_.ZERO;if(g===Lt)return d;if(g===tt)return this;let{endo:x}=t;if(!x)return p.unsafeLadder(this,g);let{k1neg:h,k1:w,k2neg:B,k2:I}=x.splitScalar(g),y=d,v=d,R=this;for(;w>Lt||I>Lt;)w&tt&&(y=y.add(R)),I&tt&&(v=v.add(R)),R=R.double(),w>>=tt,I>>=tt;return h&&(y=y.negate()),B&&(v=v.negate()),v=new _(e.mul(v.px,x.beta),v.py,v.pz),y.add(v)}multiply(g){let{endo:d,n:x}=t;at("scalar",g,tt,x);let h,w;if(d){let{k1neg:B,k1:I,k2neg:y,k2:v}=d.splitScalar(g),{p:R,f:V}=this.wNAF(I),{p:O,f:M}=this.wNAF(v);R=p.constTimeNegate(B,R),O=p.constTimeNegate(y,O),O=new _(e.mul(O.px,d.beta),O.py,O.pz),h=R.add(O),w=V.add(M)}else{let{p:B,f:I}=this.wNAF(g);h=B,w=I}return _.normalizeZ([h,w])[0]}multiplyAndAddUnsafe(g,d,x){let h=_.BASE,w=(I,y)=>y===Lt||y===tt||!I.equals(h)?I.multiplyUnsafe(y):I.multiply(y),B=w(this,d).add(w(g,x));return B.is0()?void 0:B}toAffine(g){return u(this,g)}isTorsionFree(){let{h:g,isTorsionFree:d}=t;if(g===tt)return!0;if(d)return d(_,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:g,clearCofactor:d}=t;return g===tt?this:d?d(_,this):this.multiplyUnsafe(t.h)}toRawBytes(g=!0){return pt("isCompressed",g),this.assertValidity(),o(_,this,g)}toHex(g=!0){return pt("isCompressed",g),vt(this.toRawBytes(g))}}_.BASE=new _(t.Gx,t.Gy,e.ONE),_.ZERO=new _(e.ZERO,e.ONE,e.ZERO);let c=t.nBitLength,p=Ye(_,t.endo?Math.ceil(c/2):c);return{CURVE:t,ProjectivePoint:_,normPrivateKeyToScalar:f,weierstrassEquation:i,isWithinCurveOrder:a}}function aa(r){let t=Ie(r);return bt(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function jo(r){let t=aa(r),{Fp:e,n}=t,o=e.BYTES+1,s=2*e.BYTES+1;function i(T){return q(T,n)}function a(T){return je(T,n)}let{ProjectivePoint:f,normPrivateKeyToScalar:b,weierstrassEquation:u,isWithinCurveOrder:m}=ca({...t,toBytes(T,L,S){let E=L.toAffine(),A=e.toBytes(E.x),C=At;return pt("isCompressed",S),S?C(Uint8Array.from([L.hasEvenY()?2:3]),A):C(Uint8Array.from([4]),A,e.toBytes(E.y))},fromBytes(T){let L=T.length,S=T[0],E=T.subarray(1);if(L===o&&(S===2||S===3)){let A=It(E);if(!Be(A,tt,e.ORDER))throw new Error("Point is not on curve");let C=u(A),U;try{U=e.sqrt(C)}catch(H){let z=H instanceof Error?": "+H.message:"";throw new Error("Point is not on curve"+z)}let k=(U&tt)===tt;return(S&1)===1!==k&&(U=e.neg(U)),{x:A,y:U}}else if(L===s&&S===4){let A=e.fromBytes(E.subarray(0,e.BYTES)),C=e.fromBytes(E.subarray(e.BYTES,2*e.BYTES));return{x:A,y:C}}else throw new Error(`Point of length ${L} was invalid. Expected ${o} compressed bytes or ${s} uncompressed bytes`)}}),_=T=>vt(Mt(T,t.nByteLength));function c(T){let L=n>>tt;return T>L}function p(T){return c(T)?i(-T):T}let l=(T,L,S)=>It(T.slice(L,S));class g{constructor(L,S,E){this.r=L,this.s=S,this.recovery=E,this.assertValidity()}static fromCompact(L){let S=t.nByteLength;return L=j("compactSignature",L,S*2),new g(l(L,0,S),l(L,S,2*S))}static fromDER(L){let{r:S,s:E}=Rt.toSig(j("DER",L));return new g(S,E)}assertValidity(){at("r",this.r,tt,n),at("s",this.s,tt,n)}addRecoveryBit(L){return new g(this.r,this.s,L)}recoverPublicKey(L){let{r:S,s:E,recovery:A}=this,C=I(j("msgHash",L));if(A==null||![0,1,2,3].includes(A))throw new Error("recovery id invalid");let U=A===2||A===3?S+t.n:S;if(U>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");let k=A&1?"03":"02",P=f.fromHex(k+_(U)),H=a(U),z=i(-C*H),K=i(E*H),F=f.BASE.multiplyAndAddUnsafe(P,z,K);if(!F)throw new Error("point at infinify");return F.assertValidity(),F}hasHighS(){return c(this.s)}normalizeS(){return this.hasHighS()?new g(this.r,i(-this.s),this.recovery):this}toDERRawBytes(){return Yt(this.toDERHex())}toDERHex(){return Rt.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Yt(this.toCompactHex())}toCompactHex(){return _(this.r)+_(this.s)}}let d={isValidPrivateKey(T){try{return b(T),!0}catch{return!1}},normPrivateKeyToScalar:b,randomPrivateKey:()=>{let T=Kr(t.n);return xo(t.randomBytes(T),t.n)},precompute(T=8,L=f.BASE){return L._setWindowSize(T),L.multiply(BigInt(3)),L}};function x(T,L=!0){return f.fromPrivateKey(T).toRawBytes(L)}function h(T){let L=kt(T),S=typeof T=="string",E=(L||S)&&T.length;return L?E===o||E===s:S?E===2*o||E===2*s:T instanceof f}function w(T,L,S=!0){if(h(T))throw new Error("first arg must be private key");if(!h(L))throw new Error("second arg must be public key");return f.fromHex(L).multiply(b(T)).toRawBytes(S)}let B=t.bits2int||function(T){let L=It(T),S=T.length*8-t.nBitLength;return S>0?L>>BigInt(S):L},I=t.bits2int_modN||function(T){return i(B(T))},y=ve(t.nBitLength);function v(T){return at(`num < 2^${t.nBitLength}`,T,Lt,y),Mt(T,t.nByteLength)}function R(T,L,S=V){if(["recovered","canonical"].some(J=>J in S))throw new Error("sign() legacy options not supported");let{hash:E,randomBytes:A}=t,{lowS:C,prehash:U,extraEntropy:k}=S;C==null&&(C=!0),T=j("msgHash",T),Zo(S),U&&(T=j("prehashed msgHash",E(T)));let P=I(T),H=b(L),z=[v(H),v(P)];if(k!=null&&k!==!1){let J=k===!0?A(e.BYTES):k;z.push(j("extraEntropy",J))}let K=At(...z),F=P;function Q(J){let et=B(J);if(!m(et))return;let nt=a(et),Y=f.BASE.multiply(et).toAffine(),it=i(Y.x);if(it===Lt)return;let wt=i(nt*i(F+it*H));if(wt===Lt)return;let me=(Y.x===it?0:2)|Number(Y.y&tt),xe=wt;return C&&c(wt)&&(xe=p(wt),me^=1),new g(it,xe,me)}return{seed:K,k2sig:Q}}let V={lowS:t.lowS,prehash:!1},O={lowS:t.lowS,prehash:!1};function M(T,L,S=V){let{seed:E,k2sig:A}=R(T,L,S),C=t;return Or(C.hash.outputLen,C.nByteLength,C.hmac)(E,A)}f.BASE._setWindowSize(8);function N(T,L,S,E=O){let A=T;if(L=j("msgHash",L),S=j("publicKey",S),"strict"in E)throw new Error("options.strict was renamed to lowS");Zo(E);let{lowS:C,prehash:U}=E,k,P;try{if(typeof A=="string"||kt(A))try{k=g.fromDER(A)}catch(Y){if(!(Y instanceof Rt.Err))throw Y;k=g.fromCompact(A)}else if(typeof A=="object"&&typeof A.r=="bigint"&&typeof A.s=="bigint"){let{r:Y,s:it}=A;k=new g(Y,it)}else throw new Error("PARSE");P=f.fromHex(S)}catch(Y){if(Y.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(C&&k.hasHighS())return!1;U&&(L=t.hash(L));let{r:H,s:z}=k,K=I(L),F=a(z),Q=i(K*F),J=i(H*F),et=f.BASE.multiplyAndAddUnsafe(P,Q,J)?.toAffine();return et?i(et.x)===H:!1}return{CURVE:t,getPublicKey:x,getSharedSecret:w,sign:M,verify:N,ProjectivePoint:f,Signature:g,utils:d}}function fa(r){return{hash:r,hmac:(t,...e)=>En(r,t,Rr(...e)),randomBytes:Ve}}function Yo(r,t){let e=n=>jo({...r,...fa(n)});return Object.freeze({...e(t),create:e})}var Qo=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Xo=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),ua=BigInt(1),_n=BigInt(2),Wo=(r,t)=>(r+t/_n)/t;function ha(r){let t=Qo,e=BigInt(3),n=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),a=BigInt(44),f=BigInt(88),b=r*r*r%t,u=b*b*r%t,m=Z(u,e,t)*u%t,_=Z(m,e,t)*u%t,c=Z(_,_n,t)*b%t,p=Z(c,o,t)*c%t,l=Z(p,s,t)*p%t,g=Z(l,a,t)*l%t,d=Z(g,f,t)*g%t,x=Z(d,a,t)*l%t,h=Z(x,e,t)*u%t,w=Z(h,i,t)*p%t,B=Z(w,n,t)*b%t,I=Z(B,_n,t);if(!Sn.eql(Sn.sqr(I),r))throw new Error("Cannot find square root");return I}var Sn=Ot(Qo,void 0,void 0,{sqrt:ha}),ee=Yo({a:BigInt(0),b:BigInt(7),Fp:Sn,n:Xo,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:r=>{let t=Xo,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-ua*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=e,i=BigInt("0x100000000000000000000000000000000"),a=Wo(s*r,t),f=Wo(-n*r,t),b=q(r-a*e-f*o,t),u=q(-a*n-f*s,t),m=b>i,_=u>i;if(m&&(b=t-b),_&&(u=t-u),b>i||u>i)throw new Error("splitScalar: Endomorphism failed, k="+r);return{k1neg:m,k1:b,k2neg:_,k2:u}}}},$o),xh=BigInt(0);var gh=ee.ProjectivePoint;function Jo(r){return r==null?!1:typeof r.then=="function"&&typeof r.catch=="function"&&typeof r.finally=="function"}function ts(r,t,e){let n=Te.digest(e instanceof Uint8Array?e:e.subarray());if(Jo(n))return n.then(({digest:o})=>ee.verify(t,o,r)).catch(o=>{throw new Ne(String(o))});try{return ee.verify(t,n.digest,r)}catch(o){throw new Ne(String(o))}}var ur=class{type="secp256k1";raw;_key;constructor(t){this._key=rs(t),this.raw=es(this._key)}toMultihash(){return _t.digest(tr(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:St(this.raw,t.raw)}verify(t,e){return ts(this._key,e,t)}};function ns(r){return new ur(r)}function es(r){return ee.ProjectivePoint.fromHex(r).toRawBytes(!0)}function rs(r){try{return ee.ProjectivePoint.fromHex(r),r}catch(t){throw new ze(String(t))}}function os(r){let{Type:t,Data:e}=Ce.decode(r.digest),n=e??new Uint8Array;switch(t){case ht.Ed25519:return Bo(n);case ht.secp256k1:return ns(n);default:throw new be}}function tr(r){return Ce.encode({Type:ht[r.type],Data:r.raw})}var ss=Symbol.for("nodejs.util.inspect.custom"),la=114,Ue=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()})`}[yr]=!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(la,this.multihash)}toJSON(){return this.toString()}equals(t){if(t==null)return!1;if(t instanceof Uint8Array)return St(this.multihash.bytes,t);if(typeof t=="string")return this.toString()===t;if(t?.toMultihash()?.bytes!=null)return St(this.multihash.bytes,t.toMultihash().bytes);throw new Error("not valid Id")}[ss](){return`PeerId(${this.toString()})`}},hr=class extends Ue{type="RSA";publicKey;constructor(t){super({...t,type:"RSA"}),this.publicKey=t.publicKey}},lr=class extends Ue{type="Ed25519";publicKey;constructor(t){super({...t,type:"Ed25519"}),this.publicKey=t.publicKey}},dr=class extends Ue{type="secp256k1";publicKey;constructor(t){super({...t,type:"secp256k1"}),this.publicKey=t.publicKey}},da=2336,pr=class{type="url";multihash;publicKey;url;constructor(t){this.url=t.toString(),this.multihash=_t.digest(st(this.url))}[ss](){return`PeerId(${this.url})`}[yr]=!0;toString(){return this.toCID().toString()}toMultihash(){return this.multihash}toCID(){return lt.createV1(da,this.toMultihash())}toJSON(){return this.toString()}equals(t){return t==null?!1:(t instanceof Uint8Array&&(t=ar(t)),t.toString()===this.toString())}};function is(r){if(ma(r))return new hr({multihash:r});if(pa(r))try{let t=os(r);if(t.type==="Ed25519")return new lr({multihash:r,publicKey:t});if(t.type==="secp256k1")return new dr({multihash:r,publicKey:t})}catch{let e=ar(r.digest);return new pr(new URL(e))}throw new He("Supplied PeerID Multihash is invalid")}function pa(r){return r.code===_t.code}function ma(r){return r.code===Te.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 mr(r){let t=Ee(X.decode(`z${r}`));return is(t)}var qt=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 cs(){return new qt}var Ft=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=mr(t[0]);return[e,e]})}forEach(t){this.set.forEach(e=>{let n=mr(e);t(n,n,this)})}has(t){return this.set.has(t.toString())}values(){return yt(this.set.values(),t=>mr(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 as(){return new Ft}var Vt=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 fs(){return new Vt}var Bn=64,gt=class{fp;h;seed;constructor(t,e,n,o=2){if(o>Bn)throw new TypeError("Invalid Fingerprint Size");let s=e.hashV(t,n),i=vo(o);for(let a=0;a<i.length;a++)i[a]=s[a];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?St(this.fp,t.fp):!1}};function re(r,t){return Math.floor(Math.random()*(t-r))+r}var ne=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=re(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 vn={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 xa(r,t){let e=vn[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 ga(r,t,e){if(e.length===0)throw new Error("The `utf8Buffer` option must have a length greater than zero");let n=vn[t],o=ds[t],s=r;for(;s.length>0;){let i=ps.encodeInto(s,e);s=s.slice(i.read);for(let a=0;a<i.written;a++)o^=BigInt(e[a]),o=BigInt.asUintN(t,o*n)}return o}function In(r,{size:t=32,utf8Buffer:e}={}){if(!vn[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 ga(r,t,e);r=ps.encode(r)}return xa(r,t)}var ba=Us(ls(),1);var De={hash:r=>Number(In(r,{size:32})),hashV:(r,t)=>ya(De.hash(r,t))};function ya(r){let t=r.toString(16);return t.length%2===1&&(t=`0${t}`),st(t,"base16")}var wa=500,Me=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??re(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 ne(this.bucketSize)),this.buckets[o]==null&&(this.buckets[o]=new ne(this.bucketSize)),this.buckets[n].add(e)||this.buckets[o].add(e))return this.count++,!0;let s=[n,o],i=s[re(0,s.length-1)];this.buckets[i]==null&&(this.buckets[i]=new ne(this.bucketSize));for(let a=0;a<wa;a++){let f=this.buckets[i].swap(e);if(f!=null&&(i=(i^f.hash())%this.filterSize,this.buckets[i]==null&&(this.buckets[i]=new ne(this.bucketSize)),this.buckets[i].add(f)))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}},Ea={1:.5,2:.84,4:.95,8:.98};function _a(r=.001){return r>.002?2:r>1e-5?4:8}function ms(r,t=.001){let e=_a(t),n=Ea[e],o=Math.round(r/n),s=Math.min(Math.ceil(Math.log2(1/t)+Math.log2(2*e)),Bn);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??De,this.seed=t.seed??re(0,Math.pow(2,10)),this.filterSeries=[new Me({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 Me({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 An(r,t=.001,e){return new gr({...ms(r,t),...e??{}})}var Oe=class{filter;constructor(t,e){this.filter=An(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 Tn=class extends qt{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 Tn({name:t,metrics:e}):n=new qt,n}var Rn=class extends Ft{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 Rn({name:t,metrics:e}):n=new Ft,n}var Ln=class extends Vt{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 Ln({name:t,metrics:e}):n=new Vt,n}return ks(Sa);})();
|
2
|
+
"use strict";var Libp2PPeerCollections=(()=>{var Rs=Object.create;var ze=Object.defineProperty;var Ls=Object.getOwnPropertyDescriptor;var Cs=Object.getOwnPropertyNames;var Ns=Object.getPrototypeOf,Us=Object.prototype.hasOwnProperty;var zn=(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})},Hn=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Cs(t))!Us.call(r,o)&&o!==e&&ze(r,o,{get:()=>t[o],enumerable:!(n=Ls(t,o))||n.enumerable});return r};var ks=(r,t,e)=>(e=r!=null?Rs(Ns(r)):{},Hn(t||!r||!r.__esModule?ze(e,"default",{value:r,enumerable:!0}):e,r)),Ds=r=>Hn(ze({},"__esModule",{value:!0}),r);var hs=zn((De,gr)=>{(function(r,t){"use strict";var e={version:"3.0.0",x86:{},x64:{},inputValidation:!0};function n(c){if(!Array.isArray(c)&&!ArrayBuffer.isView(c))return!1;for(var p=0;p<c.length;p++)if(!Number.isInteger(c[p])||c[p]<0||c[p]>255)return!1;return!0}function o(c,p){return(c&65535)*p+(((c>>>16)*p&65535)<<16)}function s(c,p){return c<<p|c>>>32-p}function i(c){return c^=c>>>16,c=o(c,2246822507),c^=c>>>13,c=o(c,3266489909),c^=c>>>16,c}function a(c,p){c=[c[0]>>>16,c[0]&65535,c[1]>>>16,c[1]&65535],p=[p[0]>>>16,p[0]&65535,p[1]>>>16,p[1]&65535];var l=[0,0,0,0];return l[3]+=c[3]+p[3],l[2]+=l[3]>>>16,l[3]&=65535,l[2]+=c[2]+p[2],l[1]+=l[2]>>>16,l[2]&=65535,l[1]+=c[1]+p[1],l[0]+=l[1]>>>16,l[1]&=65535,l[0]+=c[0]+p[0],l[0]&=65535,[l[0]<<16|l[1],l[2]<<16|l[3]]}function f(c,p){c=[c[0]>>>16,c[0]&65535,c[1]>>>16,c[1]&65535],p=[p[0]>>>16,p[0]&65535,p[1]>>>16,p[1]&65535];var l=[0,0,0,0];return l[3]+=c[3]*p[3],l[2]+=l[3]>>>16,l[3]&=65535,l[2]+=c[2]*p[3],l[1]+=l[2]>>>16,l[2]&=65535,l[2]+=c[3]*p[2],l[1]+=l[2]>>>16,l[2]&=65535,l[1]+=c[1]*p[3],l[0]+=l[1]>>>16,l[1]&=65535,l[1]+=c[2]*p[2],l[0]+=l[1]>>>16,l[1]&=65535,l[1]+=c[3]*p[1],l[0]+=l[1]>>>16,l[1]&=65535,l[0]+=c[0]*p[3]+c[1]*p[2]+c[2]*p[1]+c[3]*p[0],l[0]&=65535,[l[0]<<16|l[1],l[2]<<16|l[3]]}function b(c,p){return p%=64,p===32?[c[1],c[0]]:p<32?[c[0]<<p|c[1]>>>32-p,c[1]<<p|c[0]>>>32-p]:(p-=32,[c[1]<<p|c[0]>>>32-p,c[0]<<p|c[1]>>>32-p])}function u(c,p){return p%=64,p===0?c:p<32?[c[0]<<p|c[1]>>>32-p,c[1]<<p]:[c[1]<<p-32,0]}function m(c,p){return[c[0]^p[0],c[1]^p[1]]}function _(c){return c=m(c,[0,c[0]>>>1]),c=f(c,[4283543511,3981806797]),c=m(c,[0,c[0]>>>1]),c=f(c,[3301882366,444984403]),c=m(c,[0,c[0]>>>1]),c}e.x86.hash32=function(c,p){if(e.inputValidation&&!n(c))return t;p=p||0;for(var l=c.length%4,g=c.length-l,d=p,x=0,h=3432918353,y=461845907,B=0;B<g;B=B+4)x=c[B]|c[B+1]<<8|c[B+2]<<16|c[B+3]<<24,x=o(x,h),x=s(x,15),x=o(x,y),d^=x,d=s(d,13),d=o(d,5)+3864292196;switch(x=0,l){case 3:x^=c[B+2]<<16;case 2:x^=c[B+1]<<8;case 1:x^=c[B],x=o(x,h),x=s(x,15),x=o(x,y),d^=x}return d^=c.length,d=i(d),d>>>0},e.x86.hash128=function(c,p){if(e.inputValidation&&!n(c))return t;p=p||0;for(var l=c.length%16,g=c.length-l,d=p,x=p,h=p,y=p,B=0,I=0,w=0,v=0,R=597399067,V=2869860233,P=951274213,M=2716044179,N=0;N<g;N=N+16)B=c[N]|c[N+1]<<8|c[N+2]<<16|c[N+3]<<24,I=c[N+4]|c[N+5]<<8|c[N+6]<<16|c[N+7]<<24,w=c[N+8]|c[N+9]<<8|c[N+10]<<16|c[N+11]<<24,v=c[N+12]|c[N+13]<<8|c[N+14]<<16|c[N+15]<<24,B=o(B,R),B=s(B,15),B=o(B,V),d^=B,d=s(d,19),d+=x,d=o(d,5)+1444728091,I=o(I,V),I=s(I,16),I=o(I,P),x^=I,x=s(x,17),x+=h,x=o(x,5)+197830471,w=o(w,P),w=s(w,17),w=o(w,M),h^=w,h=s(h,15),h+=y,h=o(h,5)+2530024501,v=o(v,M),v=s(v,18),v=o(v,R),y^=v,y=s(y,13),y+=d,y=o(y,5)+850148119;switch(B=0,I=0,w=0,v=0,l){case 15:v^=c[N+14]<<16;case 14:v^=c[N+13]<<8;case 13:v^=c[N+12],v=o(v,M),v=s(v,18),v=o(v,R),y^=v;case 12:w^=c[N+11]<<24;case 11:w^=c[N+10]<<16;case 10:w^=c[N+9]<<8;case 9:w^=c[N+8],w=o(w,P),w=s(w,17),w=o(w,M),h^=w;case 8:I^=c[N+7]<<24;case 7:I^=c[N+6]<<16;case 6:I^=c[N+5]<<8;case 5:I^=c[N+4],I=o(I,V),I=s(I,16),I=o(I,P),x^=I;case 4:B^=c[N+3]<<24;case 3:B^=c[N+2]<<16;case 2:B^=c[N+1]<<8;case 1:B^=c[N],B=o(B,R),B=s(B,15),B=o(B,V),d^=B}return d^=c.length,x^=c.length,h^=c.length,y^=c.length,d+=x,d+=h,d+=y,x+=d,h+=d,y+=d,d=i(d),x=i(x),h=i(h),y=i(y),d+=x,d+=h,d+=y,x+=d,h+=d,y+=d,("00000000"+(d>>>0).toString(16)).slice(-8)+("00000000"+(x>>>0).toString(16)).slice(-8)+("00000000"+(h>>>0).toString(16)).slice(-8)+("00000000"+(y>>>0).toString(16)).slice(-8)},e.x64.hash128=function(c,p){if(e.inputValidation&&!n(c))return t;p=p||0;for(var l=c.length%16,g=c.length-l,d=[0,p],x=[0,p],h=[0,0],y=[0,0],B=[2277735313,289559509],I=[1291169091,658871167],w=0;w<g;w=w+16)h=[c[w+4]|c[w+5]<<8|c[w+6]<<16|c[w+7]<<24,c[w]|c[w+1]<<8|c[w+2]<<16|c[w+3]<<24],y=[c[w+12]|c[w+13]<<8|c[w+14]<<16|c[w+15]<<24,c[w+8]|c[w+9]<<8|c[w+10]<<16|c[w+11]<<24],h=f(h,B),h=b(h,31),h=f(h,I),d=m(d,h),d=b(d,27),d=a(d,x),d=a(f(d,[0,5]),[0,1390208809]),y=f(y,I),y=b(y,33),y=f(y,B),x=m(x,y),x=b(x,31),x=a(x,d),x=a(f(x,[0,5]),[0,944331445]);switch(h=[0,0],y=[0,0],l){case 15:y=m(y,u([0,c[w+14]],48));case 14:y=m(y,u([0,c[w+13]],40));case 13:y=m(y,u([0,c[w+12]],32));case 12:y=m(y,u([0,c[w+11]],24));case 11:y=m(y,u([0,c[w+10]],16));case 10:y=m(y,u([0,c[w+9]],8));case 9:y=m(y,[0,c[w+8]]),y=f(y,I),y=b(y,33),y=f(y,B),x=m(x,y);case 8:h=m(h,u([0,c[w+7]],56));case 7:h=m(h,u([0,c[w+6]],48));case 6:h=m(h,u([0,c[w+5]],40));case 5:h=m(h,u([0,c[w+4]],32));case 4:h=m(h,u([0,c[w+3]],24));case 3:h=m(h,u([0,c[w+2]],16));case 2:h=m(h,u([0,c[w+1]],8));case 1:h=m(h,[0,c[w]]),h=f(h,B),h=b(h,31),h=f(h,I),d=m(d,h)}return d=m(d,[0,c.length]),x=m(x,[0,c.length]),d=a(d,x),x=a(x,d),d=_(d),x=_(x),d=a(d,x),x=a(x,d),("00000000"+(d[0]>>>0).toString(16)).slice(-8)+("00000000"+(d[1]>>>0).toString(16)).slice(-8)+("00000000"+(x[0]>>>0).toString(16)).slice(-8)+("00000000"+(x[1]>>>0).toString(16)).slice(-8)},typeof De<"u"?(typeof gr<"u"&&gr.exports&&(De=gr.exports=e),De.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)})(De)});var ds=zn((k0,ls)=>{ls.exports=hs()});var Sa={};ct(Sa,{PeerFilter:()=>Oe,PeerList:()=>Vt,PeerMap:()=>qt,PeerSet:()=>Ft,peerFilter:()=>gs,peerList:()=>us,peerMap:()=>as,peerSet:()=>fs,trackedPeerList:()=>ys,trackedPeerMap:()=>bs,trackedPeerSet:()=>ws});var yr=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 vr={};ct(vr,{base58btc:()=>X,base58flickr:()=>Ks});var Aa=new Uint8Array(0);function Kn(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 Et(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 Ms(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 a=r.length,f=r.charAt(0),b=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function m(p){if(p instanceof Uint8Array||(ArrayBuffer.isView(p)?p=new Uint8Array(p.buffer,p.byteOffset,p.byteLength):Array.isArray(p)&&(p=Uint8Array.from(p))),!(p instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(p.length===0)return"";for(var l=0,g=0,d=0,x=p.length;d!==x&&p[d]===0;)d++,l++;for(var h=(x-d)*u+1>>>0,y=new Uint8Array(h);d!==x;){for(var B=p[d],I=0,w=h-1;(B!==0||I<g)&&w!==-1;w--,I++)B+=256*y[w]>>>0,y[w]=B%a>>>0,B=B/a>>>0;if(B!==0)throw new Error("Non-zero carry");g=I,d++}for(var v=h-g;v!==h&&y[v]===0;)v++;for(var R=f.repeat(l);v<h;++v)R+=r.charAt(y[v]);return R}function _(p){if(typeof p!="string")throw new TypeError("Expected String");if(p.length===0)return new Uint8Array;var l=0;if(p[l]!==" "){for(var g=0,d=0;p[l]===f;)g++,l++;for(var x=(p.length-l)*b+1>>>0,h=new Uint8Array(x);p[l];){var y=e[p.charCodeAt(l)];if(y===255)return;for(var B=0,I=x-1;(y!==0||B<d)&&I!==-1;I--,B++)y+=a*h[I]>>>0,h[I]=y%256>>>0,y=y/256>>>0;if(y!==0)throw new Error("Non-zero carry");d=B,l++}if(p[l]!==" "){for(var w=x-d;w!==x&&h[w]===0;)w++;for(var v=new Uint8Array(g+(x-w)),R=g;w!==x;)v[R++]=h[w++];return v}}}function c(p){var l=_(p);if(l)return l;throw new Error(`Non-${t} character`)}return{encode:m,decodeUnsafe:_,decode:c}}var Ps=Ms,Os=Ps,$n=Os;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 Zn(this,t)}},Sr=class{decoders;constructor(t){this.decoders=t}or(t){return Zn(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 Zn(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 oe({name:r,prefix:t,encode:e,decode:n}){return new Br(r,t,e,n)}function Ct({name:r,prefix:t,alphabet:e}){let{encode:n,decode:o}=$n(e,r);return oe({prefix:t,name:r,encode:n,decode:s=>Et(o(s))})}function zs(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),a=0,f=0,b=0;for(let u=0;u<s;++u){let m=o[r[u]];if(m===void 0)throw new SyntaxError(`Non-${n} character`);f=f<<e|m,a+=e,a>=8&&(a-=8,i[b++]=255&f>>a)}if(a>=e||255&f<<8-a)throw new SyntaxError("Unexpected end of data");return i}function Hs(r,t,e){let n=t[t.length-1]==="=",o=(1<<e)-1,s="",i=0,a=0;for(let f=0;f<r.length;++f)for(a=a<<8|r[f],i+=8;i>e;)i-=e,s+=t[o&a>>i];if(i!==0&&(s+=t[o&a<<e-i]),n)for(;s.length*e&7;)s+="=";return s}function G({name:r,prefix:t,bitsPerChar:e,alphabet:n}){return oe({prefix:t,name:r,encode(o){return Hs(o,n,e)},decode(o){return zs(o,n,e,r)}})}var X=Ct({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Ks=Ct({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Ir={};ct(Ir,{base32:()=>se,base32hex:()=>$s,base32hexpad:()=>Gs,base32hexpadupper:()=>js,base32hexupper:()=>Zs,base32pad:()=>Fs,base32padupper:()=>Vs,base32upper:()=>qs,base32z:()=>Ys});var se=G({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),qs=G({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Fs=G({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Vs=G({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),$s=G({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Zs=G({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Gs=G({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),js=G({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Ys=G({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Ar={};ct(Ar,{base36:()=>we,base36upper:()=>Xs});var we=Ct({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Xs=Ct({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Ws=Yn,Gn=128,Qs=127,Js=~Qs,ti=Math.pow(2,31);function Yn(r,t,e){t=t||[],e=e||0;for(var n=e;r>=ti;)t[e++]=r&255|Gn,r/=128;for(;r&Js;)t[e++]=r&255|Gn,r>>>=7;return t[e]=r|0,Yn.bytes=e-n+1,t}var ei=Tr,ri=128,jn=127;function Tr(r,n){var e=0,n=n||0,o=0,s=n,i,a=r.length;do{if(s>=a)throw Tr.bytes=0,new RangeError("Could not decode varint");i=r[s++],e+=o<28?(i&jn)<<o:(i&jn)*Math.pow(2,o),o+=7}while(i>=ri);return Tr.bytes=s-n,e}var ni=Math.pow(2,7),oi=Math.pow(2,14),si=Math.pow(2,21),ii=Math.pow(2,28),ci=Math.pow(2,35),ai=Math.pow(2,42),fi=Math.pow(2,49),ui=Math.pow(2,56),hi=Math.pow(2,63),li=function(r){return r<ni?1:r<oi?2:r<si?3:r<ii?4:r<ci?5:r<ai?6:r<fi?7:r<ui?8:r<hi?9:10},di={encode:Ws,decode:ei,encodingLength:li},pi=di,ye=pi;function Ee(r,t=0){return[ye.decode(r,t),ye.decode.bytes]}function ie(r,t,e=0){return ye.encode(r,t,e),t}function ce(r){return ye.encodingLength(r)}function $t(r,t){let e=t.byteLength,n=ce(r),o=n+ce(e),s=new Uint8Array(o+e);return ie(r,s,0),ie(e,s,n),s.set(t,o),new ae(r,e,t,s)}function _e(r){let t=Et(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 ae(e,o,i,t)}function Xn(r,t){if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&Kn(r.bytes,e.bytes)}}var ae=class{code;size;digest;bytes;constructor(t,e,n,o){this.code=t,this.size=e,this.digest=n,this.bytes=o}};function Wn(r,t){let{bytes:e,version:n}=r;switch(n){case 0:return xi(e,Rr(r),t??X.encoder);default:return gi(e,Rr(r),t??se.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!==bi)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=$t(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&&Xn(t.multihash,n.multihash)}toString(t){return Wn(this,t)}toJSON(){return{"/":Wn(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[wi]===!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=Et(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 ae(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[m,_]=Ee(t.subarray(e));return e+=_,m},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,a=n(),f=n(),b=e+f,u=b-i;return{version:o,codec:s,multihashCode:a,digestSize:f,multihashSize:u,size:b}}static parse(t,e){let[n,o]=mi(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 mi(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 xi(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 gi(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,bi=18;function Jn(r,t,e){let n=ce(r),o=n+ce(t),s=new Uint8Array(o+e.byteLength);return ie(r,s,0),ie(t,s,n),s.set(e,o),s}var wi=Symbol.for("@ipld/js-cid/CID");var Lr={};ct(Lr,{identity:()=>_t});var to=0,yi="identity",eo=Et;function Ei(r){return $t(to,eo(r))}var _t={code:to,name:yi,encode:eo,digest:Ei};function St(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, not ${r}`)}function _i(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function fe(r,...t){if(!_i(r))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(r.length))throw new Error(`Uint8Array expected of length ${t}, not of 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 ue(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 Gt=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var Fe=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),dt=(r,t)=>r<<32-t|r>>>t;var Xa=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;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 Cr(...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 he=class{clone(){return this._cloneInto()}},Wa={}.toString;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 $e(r=32){if(Gt&&typeof Gt.getRandomValues=="function")return Gt.getRandomValues(new Uint8Array(r));if(Gt&&typeof Gt.randomBytes=="function")return Gt.randomBytes(r);throw new Error("crypto.getRandomValues must be defined")}function Si(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),a=Number(e&s),f=n?4:0,b=n?0:4;r.setUint32(t+f,i,n),r.setUint32(t+b,a,n)}var io=(r,t,e)=>r&t^~r&e,co=(r,t,e)=>r&t^r&e^t&e,le=class extends he{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){ue(this);let{view:e,buffer:n,blockLen:o}=this;t=Be(t);let s=t.length;for(let i=0;i<s;){let a=Math.min(o-this.pos,s-i);if(a===o){let f=Fe(t);for(;o<=s-i;i+=o)this.process(f,i);continue}n.set(t.subarray(i,i+a),this.pos),this.pos+=a,i+=a,this.pos===o&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){ue(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 m=i;m<o;m++)e[m]=0;Si(n,o-8,BigInt(this.length*8),s),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 b=f/4,u=this.get();if(b>u.length)throw new Error("_sha2: outputLen bigger than state");for(let m=0;m<b;m++)a.setUint32(4*m,u[m],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:a}=this;return t.length=o,t.pos=a,t.finished=s,t.destroyed=i,o%e&&t.buffer.set(n),t}};var Ze=BigInt(4294967295),Nr=BigInt(32);function ao(r,t=!1){return t?{h:Number(r&Ze),l:Number(r>>Nr&Ze)}:{h:Number(r>>Nr&Ze)|0,l:Number(r&Ze)|0}}function Bi(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 vi=(r,t)=>BigInt(r>>>0)<<Nr|BigInt(t>>>0),Ii=(r,t,e)=>r>>>e,Ai=(r,t,e)=>r<<32-e|t>>>e,Ti=(r,t,e)=>r>>>e|t<<32-e,Ri=(r,t,e)=>r<<32-e|t>>>e,Li=(r,t,e)=>r<<64-e|t>>>e-32,Ci=(r,t,e)=>r>>>e-32|t<<64-e,Ni=(r,t)=>t,Ui=(r,t)=>r,ki=(r,t,e)=>r<<e|t>>>32-e,Di=(r,t,e)=>t<<e|r>>>32-e,Mi=(r,t,e)=>t<<e-32|r>>>64-e,Pi=(r,t,e)=>r<<e-32|t>>>64-e;function Oi(r,t,e,n){let o=(t>>>0)+(n>>>0);return{h:r+e+(o/2**32|0)|0,l:o|0}}var zi=(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),Hi=(r,t,e,n)=>t+e+n+(r/2**32|0)|0,Ki=(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),qi=(r,t,e,n,o)=>t+e+n+o+(r/2**32|0)|0,Fi=(r,t,e,n,o)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(o>>>0),Vi=(r,t,e,n,o,s)=>t+e+n+o+s+(r/2**32|0)|0;var $i={fromBig:ao,split:Bi,toBig:vi,shrSH:Ii,shrSL:Ai,rotrSH:Ti,rotrSL:Ri,rotrBH:Li,rotrBL:Ci,rotr32H:Ni,rotr32L:Ui,rotlSH:ki,rotlSL:Di,rotlBH:Mi,rotlBL:Pi,add:Oi,add3L:zi,add3H:Hi,add4L:Ki,add4H:qi,add5H:Vi,add5L:Fi},D=$i;var[Zi,Gi]=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),Ut=new Uint32Array(80),Ur=class extends le{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:a,Dl:f,Eh:b,El:u,Fh:m,Fl:_,Gh:c,Gl:p,Hh:l,Hl:g}=this;return[t,e,n,o,s,i,a,f,b,u,m,_,c,p,l,g]}set(t,e,n,o,s,i,a,f,b,u,m,_,c,p,l,g){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=a|0,this.Dl=f|0,this.Eh=b|0,this.El=u|0,this.Fh=m|0,this.Fl=_|0,this.Gh=c|0,this.Gl=p|0,this.Hh=l|0,this.Hl=g|0}process(t,e){for(let h=0;h<16;h++,e+=4)Nt[h]=t.getUint32(e),Ut[h]=t.getUint32(e+=4);for(let h=16;h<80;h++){let y=Nt[h-15]|0,B=Ut[h-15]|0,I=D.rotrSH(y,B,1)^D.rotrSH(y,B,8)^D.shrSH(y,B,7),w=D.rotrSL(y,B,1)^D.rotrSL(y,B,8)^D.shrSL(y,B,7),v=Nt[h-2]|0,R=Ut[h-2]|0,V=D.rotrSH(v,R,19)^D.rotrBH(v,R,61)^D.shrSH(v,R,6),P=D.rotrSL(v,R,19)^D.rotrBL(v,R,61)^D.shrSL(v,R,6),M=D.add4L(w,P,Ut[h-7],Ut[h-16]),N=D.add4H(M,I,V,Nt[h-7],Nt[h-16]);Nt[h]=N|0,Ut[h]=M|0}let{Ah:n,Al:o,Bh:s,Bl:i,Ch:a,Cl:f,Dh:b,Dl:u,Eh:m,El:_,Fh:c,Fl:p,Gh:l,Gl:g,Hh:d,Hl:x}=this;for(let h=0;h<80;h++){let y=D.rotrSH(m,_,14)^D.rotrSH(m,_,18)^D.rotrBH(m,_,41),B=D.rotrSL(m,_,14)^D.rotrSL(m,_,18)^D.rotrBL(m,_,41),I=m&c^~m&l,w=_&p^~_&g,v=D.add5L(x,B,w,Gi[h],Ut[h]),R=D.add5H(v,d,y,I,Zi[h],Nt[h]),V=v|0,P=D.rotrSH(n,o,28)^D.rotrBH(n,o,34)^D.rotrBH(n,o,39),M=D.rotrSL(n,o,28)^D.rotrBL(n,o,34)^D.rotrBL(n,o,39),N=n&s^n&a^s&a,T=o&i^o&f^i&f;d=l|0,x=g|0,l=c|0,g=p|0,c=m|0,p=_|0,{h:m,l:_}=D.add(b|0,u|0,R|0,V|0),b=a|0,u=f|0,a=s|0,f=i|0,s=n|0,i=o|0;let L=D.add3L(V,M,T);n=D.add3H(L,R,P,N),o=L|0}({h:n,l:o}=D.add(this.Ah|0,this.Al|0,n|0,o|0)),{h:s,l:i}=D.add(this.Bh|0,this.Bl|0,s|0,i|0),{h:a,l:f}=D.add(this.Ch|0,this.Cl|0,a|0,f|0),{h:b,l:u}=D.add(this.Dh|0,this.Dl|0,b|0,u|0),{h:m,l:_}=D.add(this.Eh|0,this.El|0,m|0,_|0),{h:c,l:p}=D.add(this.Fh|0,this.Fl|0,c|0,p|0),{h:l,l:g}=D.add(this.Gh|0,this.Gl|0,l|0,g|0),{h:d,l:x}=D.add(this.Hh|0,this.Hl|0,d|0,x|0),this.set(n,o,s,i,a,f,b,u,m,_,c,p,l,g,d,x)}roundClean(){Nt.fill(0),Ut.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 fo=Ve(()=>new Ur);var je={};ct(je,{aInRange:()=>at,abool:()=>pt,abytes:()=>de,bitGet:()=>Ji,bitLen:()=>Or,bitMask:()=>Ie,bitSet:()=>tc,bytesToHex:()=>vt,bytesToNumberBE:()=>It,bytesToNumberLE:()=>Dt,concatBytes:()=>At,createHmacDrbg:()=>zr,ensureBytes:()=>j,equalBytes:()=>Wi,hexToBytes:()=>Yt,hexToNumber:()=>Pr,inRange:()=>ve,isBytes:()=>kt,memoized:()=>Wt,notImplemented:()=>rc,numberToBytesBE:()=>Mt,numberToBytesLE:()=>Xt,numberToHexUnpadded:()=>jt,numberToVarBytesBE:()=>Xi,utf8ToBytes:()=>Qi,validateObject:()=>bt});var Mr=BigInt(0),Ge=BigInt(1),ji=BigInt(2);function kt(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function de(r){if(!kt(r))throw new Error("Uint8Array expected")}function pt(r,t){if(typeof t!="boolean")throw new Error(`${r} must be valid boolean, got "${t}".`)}var Yi=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function vt(r){de(r);let t="";for(let e=0;e<r.length;e++)t+=Yi[r[e]];return t}function jt(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 BigInt(r===""?"0":`0x${r}`)}var Bt={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function uo(r){if(r>=Bt._0&&r<=Bt._9)return r-Bt._0;if(r>=Bt._A&&r<=Bt._F)return r-(Bt._A-10);if(r>=Bt._a&&r<=Bt._f)return r-(Bt._a-10)}function Yt(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("padded 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=uo(r.charCodeAt(s)),a=uo(r.charCodeAt(s+1));if(i===void 0||a===void 0){let f=r[s]+r[s+1];throw new Error('hex string expected, got non-hex character "'+f+'" at index '+s)}n[o]=i*16+a}return n}function It(r){return Pr(vt(r))}function Dt(r){return de(r),Pr(vt(Uint8Array.from(r).reverse()))}function Mt(r,t){return Yt(r.toString(16).padStart(t*2,"0"))}function Xt(r,t){return Mt(r,t).reverse()}function Xi(r){return Yt(jt(r))}function j(r,t,e){let n;if(typeof t=="string")try{n=Yt(t)}catch(s){throw new Error(`${r} must be valid hex string, got "${t}". 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} expected ${e} bytes, got ${o}`);return n}function At(...r){let t=0;for(let n=0;n<r.length;n++){let o=r[n];de(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 Wi(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 Qi(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}var kr=r=>typeof r=="bigint"&&Mr<=r;function ve(r,t,e){return kr(r)&&kr(t)&&kr(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 ${typeof t} ${t}`)}function Or(r){let t;for(t=0;r>Mr;r>>=Ge,t+=1);return t}function Ji(r,t){return r>>BigInt(t)&Ge}function tc(r,t,e){return r|(e?Ge:Mr)<<BigInt(t)}var Ie=r=>(ji<<BigInt(r-1))-Ge,Dr=r=>new Uint8Array(r),ho=r=>Uint8Array.from(r);function zr(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=Dr(r),o=Dr(r),s=0,i=()=>{n.fill(1),o.fill(0),s=0},a=(...m)=>e(o,n,...m),f=(m=Dr())=>{o=a(ho([0]),m),n=a(),m.length!==0&&(o=a(ho([1]),m),n=a())},b=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let m=0,_=[];for(;m<t;){n=a();let c=n.slice();_.push(c),m+=n.length}return At(..._)};return(m,_)=>{i(),f(m);let c;for(;!(c=_(b()));)f();return i(),c}}var ec={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 bt(r,t,e={}){let n=(o,s,i)=>{let a=ec[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);let f=r[o];if(!(i&&f===void 0)&&!a(f,r))throw new Error(`Invalid param ${String(o)}=${f} (${typeof f}), expected ${s}`)};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 rc=()=>{throw new Error("not implemented")};function Wt(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),$=BigInt(1),Qt=BigInt(2),nc=BigInt(3),Hr=BigInt(4),lo=BigInt(5),po=BigInt(8),oc=BigInt(9),sc=BigInt(16);function q(r,t){let e=r%t;return e>=W?e:t+e}function ic(r,t,e){if(e<=W||t<W)throw new Error("Expected power/modulo > 0");if(e===$)return W;let n=$;for(;t>W;)t&$&&(n=n*r%e),r=r*r%e,t>>=$;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||t<=W)throw new Error(`invert: expected positive integers, got n=${r} mod=${t}`);let e=q(r,t),n=t,o=W,s=$,i=$,a=W;for(;e!==W;){let b=n/e,u=n%e,m=o-i*b,_=s-a*b;n=e,e=u,o=i,s=a,i=m,a=_}if(n!==$)throw new Error("invert: does not exist");return q(o,t)}function cc(r){let t=(r-$)/Qt,e,n,o;for(e=r-$,n=0;e%Qt===W;e/=Qt,n++);for(o=Qt;o<r&&ic(o,t,r)!==r-$;o++);if(n===1){let i=(r+$)/Hr;return function(f,b){let u=f.pow(b,i);if(!f.eql(f.sqr(u),b))throw new Error("Cannot find square root");return u}}let s=(e+$)/Qt;return function(a,f){if(a.pow(f,t)===a.neg(a.ONE))throw new Error("Cannot find square root");let b=n,u=a.pow(a.mul(a.ONE,o),e),m=a.pow(f,s),_=a.pow(f,e);for(;!a.eql(_,a.ONE);){if(a.eql(_,a.ZERO))return a.ZERO;let c=1;for(let l=a.sqr(_);c<b&&!a.eql(l,a.ONE);c++)l=a.sqr(l);let p=a.pow(u,$<<BigInt(b-c-1));u=a.sqr(p),m=a.mul(m,p),_=a.mul(_,u),b=c}return m}}function ac(r){if(r%Hr===nc){let t=(r+$)/Hr;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,Qt),i=n.pow(s,t),a=n.mul(o,i),f=n.mul(n.mul(a,Qt),i),b=n.mul(a,n.sub(f,n.ONE));if(!n.eql(n.sqr(b),o))throw new Error("Cannot find square root");return b}}return r%sc,cc(r)}var mo=(r,t)=>(q(r,t)&$)===$,fc=["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=fc.reduce((n,o)=>(n[o]="function",n),t);return bt(r,e)}function uc(r,t,e){if(e<W)throw new Error("Expected power > 0");if(e===W)return r.ONE;if(e===$)return t;let n=r.ONE,o=t;for(;e>W;)e&$&&(n=r.mul(n,o)),o=r.sqr(o),e>>=$;return n}function hc(r,t){let e=new Array(t.length),n=t.reduce((s,i,a)=>r.is0(i)?s:(e[a]=s,r.mul(s,i)),r.ONE),o=r.inv(n);return t.reduceRight((s,i,a)=>r.is0(i)?s:(e[a]=r.mul(s,e[a]),r.mul(s,i)),o),e}function qr(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(`Expected Field ORDER > 0, got ${r}`);let{nBitLength:o,nByteLength:s}=qr(r,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");let i=ac(r),a=Object.freeze({ORDER:r,BITS:o,BYTES:s,MASK:Ie(o),ZERO:W,ONE:$,create:f=>q(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&$)===$,neg:f=>q(-f,r),eql:(f,b)=>f===b,sqr:f=>q(f*f,r),add:(f,b)=>q(f+b,r),sub:(f,b)=>q(f-b,r),mul:(f,b)=>q(f*b,r),pow:(f,b)=>uc(a,f,b),div:(f,b)=>q(f*Ye(b,r),r),sqrN:f=>f*f,addN:(f,b)=>f+b,subN:(f,b)=>f-b,mulN:(f,b)=>f*b,inv:f=>Ye(f,r),sqrt:n.sqrt||(f=>i(a,f)),invertBatch:f=>hc(a,f),cmov:(f,b,u)=>u?b:f,toBytes:f=>e?Xt(f,s):Mt(f,s),fromBytes:f=>{if(f.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${f.length}`);return e?Dt(f):It(f)}});return Object.freeze(a)}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 Fr(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=Fr(t);if(n<16||n<s||n>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);let i=e?It(r):Dt(r),a=q(i,t-$)+$;return e?Xt(a,o):Mt(a,o)}var dc=BigInt(0),Vr=BigInt(1),$r=new WeakMap,bo=new WeakMap;function Xe(r,t){let e=(s,i)=>{let a=i.negate();return s?a:i},n=s=>{if(!Number.isSafeInteger(s)||s<=0||s>t)throw new Error(`Wrong window size=${s}, should be [1..${t}]`)},o=s=>{n(s);let i=Math.ceil(t/s)+1,a=2**(s-1);return{windows:i,windowSize:a}};return{constTimeNegate:e,unsafeLadder(s,i){let a=r.ZERO,f=s;for(;i>dc;)i&Vr&&(a=a.add(f)),f=f.double(),i>>=Vr;return a},precomputeWindow(s,i){let{windows:a,windowSize:f}=o(i),b=[],u=s,m=u;for(let _=0;_<a;_++){m=u,b.push(m);for(let c=1;c<f;c++)m=m.add(u),b.push(m);u=m.double()}return b},wNAF(s,i,a){let{windows:f,windowSize:b}=o(s),u=r.ZERO,m=r.BASE,_=BigInt(2**s-1),c=2**s,p=BigInt(s);for(let l=0;l<f;l++){let g=l*b,d=Number(a&_);a>>=p,d>b&&(d-=c,a+=Vr);let x=g,h=g+Math.abs(d)-1,y=l%2!==0,B=d<0;d===0?m=m.add(e(y,i[x])):u=u.add(e(B,i[h]))}return{p:u,f:m}},wNAFCached(s,i,a){let f=bo.get(s)||1,b=$r.get(s);return b||(b=this.precomputeWindow(s,f),f!==1&&$r.set(s,a(b))),this.wNAF(f,b,i)},setWindowSize(s,i){n(i),bo.set(s,i),$r.delete(s)}}}function We(r,t,e,n){if(!Array.isArray(e)||!Array.isArray(n)||n.length!==e.length)throw new Error("arrays of points and scalars must have equal length");n.forEach((u,m)=>{if(!t.isValid(u))throw new Error(`wrong scalar at index ${m}`)}),e.forEach((u,m)=>{if(!(u instanceof r))throw new Error(`wrong point at index ${m}`)});let o=Or(BigInt(e.length)),s=o>12?o-3:o>4?o-2:o?2:1,i=(1<<s)-1,a=new Array(i+1).fill(r.ZERO),f=Math.floor((t.BITS-1)/s)*s,b=r.ZERO;for(let u=f;u>=0;u-=s){a.fill(r.ZERO);for(let _=0;_<n.length;_++){let c=n[_],p=Number(c>>BigInt(u)&BigInt(i));a[p]=a[p].add(e[_])}let m=r.ZERO;for(let _=a.length-1,c=r.ZERO;_>0;_--)c=c.add(a[_]),m=m.add(c);if(b=b.add(m),u!==0)for(let _=0;_<s;_++)b=b.double()}return b}function Ae(r){return Kr(r.Fp),bt(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...qr(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}var mt=BigInt(0),ft=BigInt(1),Qe=BigInt(2),pc=BigInt(8),mc={zip215:!0};function xc(r){let t=Ae(r);return bt(r,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}function wo(r){let t=xc(r),{Fp:e,n,prehash:o,hash:s,randomBytes:i,nByteLength:a,h:f}=t,b=Qe<<BigInt(a*8)-ft,u=e.create,m=Pt(t.n,t.nBitLength),_=t.uvRatio||((S,E)=>{try{return{isValid:!0,value:e.sqrt(S*e.inv(E))}}catch{return{isValid:!1,value:mt}}}),c=t.adjustScalarBytes||(S=>S),p=t.domain||((S,E,A)=>{if(pt("phflag",A),E.length||A)throw new Error("Contexts/pre-hash are not supported");return S});function l(S,E){at("coordinate "+S,E,mt,b)}function g(S){if(!(S instanceof h))throw new Error("ExtendedPoint expected")}let d=Wt((S,E)=>{let{ex:A,ey:C,ez:U}=S,k=S.is0();E==null&&(E=k?pc:e.inv(U));let O=u(A*E),H=u(C*E),z=u(U*E);if(k)return{x:mt,y:ft};if(z!==ft)throw new Error("invZ was invalid");return{x:O,y:H}}),x=Wt(S=>{let{a:E,d:A}=t;if(S.is0())throw new Error("bad point: ZERO");let{ex:C,ey:U,ez:k,et:O}=S,H=u(C*C),z=u(U*U),K=u(k*k),F=u(K*K),Q=u(H*E),J=u(K*u(Q+z)),et=u(F+u(A*u(H*z)));if(J!==et)throw new Error("bad point: equation left != right (1)");let nt=u(C*U),Y=u(k*O);if(nt!==Y)throw new Error("bad point: equation left != right (2)");return!0});class h{constructor(E,A,C,U){this.ex=E,this.ey=A,this.ez=C,this.et=U,l("x",E),l("y",A),l("z",C),l("t",U),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(E){if(E instanceof h)throw new Error("extended point not allowed");let{x:A,y:C}=E||{};return l("x",A),l("y",C),new h(A,C,ft,u(A*C))}static normalizeZ(E){let A=e.invertBatch(E.map(C=>C.ez));return E.map((C,U)=>C.toAffine(A[U])).map(h.fromAffine)}static msm(E,A){return We(h,m,E,A)}_setWindowSize(E){I.setWindowSize(this,E)}assertValidity(){x(this)}equals(E){g(E);let{ex:A,ey:C,ez:U}=this,{ex:k,ey:O,ez:H}=E,z=u(A*H),K=u(k*U),F=u(C*H),Q=u(O*U);return z===K&&F===Q}is0(){return this.equals(h.ZERO)}negate(){return new h(u(-this.ex),this.ey,this.ez,u(-this.et))}double(){let{a:E}=t,{ex:A,ey:C,ez:U}=this,k=u(A*A),O=u(C*C),H=u(Qe*u(U*U)),z=u(E*k),K=A+C,F=u(u(K*K)-k-O),Q=z+O,J=Q-H,et=z-O,nt=u(F*J),Y=u(Q*et),it=u(F*et),yt=u(J*Q);return new h(nt,Y,yt,it)}add(E){g(E);let{a:A,d:C}=t,{ex:U,ey:k,ez:O,et:H}=this,{ex:z,ey:K,ez:F,et:Q}=E;if(A===BigInt(-1)){let Nn=u((k-U)*(K+z)),Un=u((k+U)*(K-z)),wr=u(Un-Nn);if(wr===mt)return this.double();let kn=u(O*Qe*Q),Dn=u(H*Qe*F),Mn=Dn+kn,Pn=Un+Nn,On=Dn-kn,vs=u(Mn*wr),Is=u(Pn*On),As=u(Mn*On),Ts=u(wr*Pn);return new h(vs,Is,Ts,As)}let J=u(U*z),et=u(k*K),nt=u(H*C*Q),Y=u(O*F),it=u((U+k)*(z+K)-J-et),yt=Y-nt,me=Y+nt,xe=u(et-A*J),Es=u(it*yt),_s=u(me*xe),Ss=u(it*xe),Bs=u(yt*me);return new h(Es,_s,Bs,Ss)}subtract(E){return this.add(E.negate())}wNAF(E){return I.wNAFCached(this,E,h.normalizeZ)}multiply(E){let A=E;at("scalar",A,ft,n);let{p:C,f:U}=this.wNAF(A);return h.normalizeZ([C,U])[0]}multiplyUnsafe(E){let A=E;return at("scalar",A,mt,n),A===mt?B:this.equals(B)||A===ft?this:this.equals(y)?this.wNAF(A).p:I.unsafeLadder(this,A)}isSmallOrder(){return this.multiplyUnsafe(f).is0()}isTorsionFree(){return I.unsafeLadder(this,n).is0()}toAffine(E){return d(this,E)}clearCofactor(){let{h:E}=t;return E===ft?this:this.multiplyUnsafe(E)}static fromHex(E,A=!1){let{d:C,a:U}=t,k=e.BYTES;E=j("pointHex",E,k),pt("zip215",A);let O=E.slice(),H=E[k-1];O[k-1]=H&-129;let z=Dt(O),K=A?b:e.ORDER;at("pointHex.y",z,mt,K);let F=u(z*z),Q=u(F-ft),J=u(C*F-U),{isValid:et,value:nt}=_(Q,J);if(!et)throw new Error("Point.fromHex: invalid y coordinate");let Y=(nt&ft)===ft,it=(H&128)!==0;if(!A&&nt===mt&&it)throw new Error("Point.fromHex: x=0 and x_0=1");return it!==Y&&(nt=u(-nt)),h.fromAffine({x:nt,y:z})}static fromPrivateKey(E){return R(E).point}toRawBytes(){let{x:E,y:A}=this.toAffine(),C=Xt(A,e.BYTES);return C[C.length-1]|=E&ft?128:0,C}toHex(){return vt(this.toRawBytes())}}h.BASE=new h(t.Gx,t.Gy,ft,u(t.Gx*t.Gy)),h.ZERO=new h(mt,ft,ft,mt);let{BASE:y,ZERO:B}=h,I=Xe(h,a*8);function w(S){return q(S,n)}function v(S){return w(Dt(S))}function R(S){let E=a;S=j("private key",S,E);let A=j("hashed private key",s(S),2*E),C=c(A.slice(0,E)),U=A.slice(E,2*E),k=v(C),O=y.multiply(k),H=O.toRawBytes();return{head:C,prefix:U,scalar:k,point:O,pointBytes:H}}function V(S){return R(S).pointBytes}function P(S=new Uint8Array,...E){let A=At(...E);return v(s(p(A,j("context",S),!!o)))}function M(S,E,A={}){S=j("message",S),o&&(S=o(S));let{prefix:C,scalar:U,pointBytes:k}=R(E),O=P(A.context,C,S),H=y.multiply(O).toRawBytes(),z=P(A.context,H,k,S),K=w(O+z*U);at("signature.s",K,mt,n);let F=At(H,Xt(K,e.BYTES));return j("result",F,a*2)}let N=mc;function T(S,E,A,C=N){let{context:U,zip215:k}=C,O=e.BYTES;S=j("signature",S,2*O),E=j("message",E),k!==void 0&&pt("zip215",k),o&&(E=o(E));let H=Dt(S.slice(O,2*O)),z,K,F;try{z=h.fromHex(A,k),K=h.fromHex(S.slice(0,O),k),F=y.multiplyUnsafe(H)}catch{return!1}if(!k&&z.isSmallOrder())return!1;let Q=P(U,K.toRawBytes(),z.toRawBytes(),E);return K.add(z.multiplyUnsafe(Q)).subtract(F).clearCofactor().equals(h.ZERO)}return y._setWindowSize(8),{CURVE:t,getPublicKey:V,sign:M,verify:T,ExtendedPoint:h,utils:{getExtendedPublicKey:R,randomPrivateKey:()=>i(e.BYTES),precompute(S=8,E=h.BASE){return E._setWindowSize(S),E.multiply(BigInt(3)),E}}}}var Zr=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),yo=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),Ef=BigInt(0),gc=BigInt(1),Eo=BigInt(2),_f=BigInt(3),bc=BigInt(5),wc=BigInt(8);function yc(r){let t=BigInt(10),e=BigInt(20),n=BigInt(40),o=BigInt(80),s=Zr,a=r*r%s*r%s,f=Z(a,Eo,s)*a%s,b=Z(f,gc,s)*r%s,u=Z(b,bc,s)*b%s,m=Z(u,t,s)*u%s,_=Z(m,e,s)*m%s,c=Z(_,n,s)*_%s,p=Z(c,o,s)*c%s,l=Z(p,o,s)*c%s,g=Z(l,t,s)*u%s;return{pow_p_5_8:Z(g,Eo,s)*r%s,b2:a}}function Ec(r){return r[0]&=248,r[31]&=127,r[31]|=64,r}function _c(r,t){let e=Zr,n=q(t*t*t,e),o=q(n*n*t,e),s=yc(r*o).pow_p_5_8,i=q(r*n*s,e),a=q(t*i*i,e),f=i,b=q(i*yo,e),u=a===r,m=a===q(-r,e),_=a===q(-r*yo,e);return u&&(i=f),(m||_)&&(i=b),mo(i,e)&&(i=q(-i,e)),{isValid:u||m,value:i}}var Sc=Pt(Zr,void 0,!0),Bc={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Sc,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:wc,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:fo,randomBytes:$e,adjustScalarBytes:Ec,uvRatio:_c},_o=wo(Bc);var Je=32;function So(r,t,e){return _o.verify(t,e instanceof Uint8Array?e:e.subarray(),r)}var tr=class{type="Ed25519";raw;constructor(t){this.raw=Gr(t,Je)}toMultihash(){return _t.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:St(this.raw,t.raw)}verify(t,e){return So(this.raw,e,t)}};function vo(r){return r=Gr(r,Je),new tr(r)}function Gr(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 Io(r=0){return new Uint8Array(r)}function Tt(r=0){return new Uint8Array(r)}var Ic=Math.pow(2,7),Ac=Math.pow(2,14),Tc=Math.pow(2,21),Ao=Math.pow(2,28),To=Math.pow(2,35),Ro=Math.pow(2,42),Lo=Math.pow(2,49),ot=128,Ot=127;function Te(r){if(r<Ic)return 1;if(r<Ac)return 2;if(r<Tc)return 3;if(r<Ao)return 4;if(r<To)return 5;if(r<Ro)return 6;if(r<Lo)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function Co(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 No(r,t){let e=r[t],n=0;if(n+=e&Ot,e<ot||(e=r[t+1],n+=(e&Ot)<<7,e<ot)||(e=r[t+2],n+=(e&Ot)<<14,e<ot)||(e=r[t+3],n+=(e&Ot)<<21,e<ot)||(e=r[t+4],n+=(e&Ot)*Ao,e<ot)||(e=r[t+5],n+=(e&Ot)*To,e<ot)||(e=r[t+6],n+=(e&Ot)*Ro,e<ot)||(e=r[t+7],n+=(e&Ot)*Lo,e<ot))return n;throw new RangeError("Could not decode varint")}var jr=new Float32Array([-0]),zt=new Uint8Array(jr.buffer);function Uo(r,t,e){jr[0]=r,t[e]=zt[0],t[e+1]=zt[1],t[e+2]=zt[2],t[e+3]=zt[3]}function ko(r,t){return zt[0]=r[t],zt[1]=r[t+1],zt[2]=r[t+2],zt[3]=r[t+3],jr[0]}var Yr=new Float64Array([-0]),rt=new Uint8Array(Yr.buffer);function Do(r,t,e){Yr[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 Mo(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],Yr[0]}var Rc=BigInt(Number.MAX_SAFE_INTEGER),Lc=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 Jt;if(t<Rc&&t>Lc)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>Po&&(o=0n,++n>Po&&(n=0n))),new r(Number(o),Number(n))}static fromNumber(t){if(t===0)return Jt;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):Jt}},Jt=new ut(0,0);Jt.toBigInt=function(){return 0n};Jt.zzEncode=Jt.zzDecode=function(){return this};Jt.length=function(){return 1};var Po=4294967296n;function Oo(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,s=[],i=0,a;for(;t<e;)a=r[t++],a<128?s[i++]=a:a>191&&a<224?s[i++]=(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,s[i++]=55296+(a>>10),s[i++]=56320+(a&1023)):s[i++]=(a&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 Xr(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 Wr=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=ko(this.buf,this.pos);return this.pos+=4,t}double(){if(this.pos+8>this.len)throw xt(this,4);let t=Mo(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=rr(this.buf,this.pos+=4),e=rr(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=No(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 Qr(r){return new Wr(r instanceof Uint8Array?r:r.subarray())}function nr(r,t,e){let n=Qr(r);return t.decode(n,void 0,e)}var Jr={};ct(Jr,{base10:()=>Cc});var Cc=Ct({prefix:"9",name:"base10",alphabet:"0123456789"});var tn={};ct(tn,{base16:()=>Nc,base16upper:()=>Uc});var Nc=G({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Uc=G({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var en={};ct(en,{base2:()=>kc});var kc=G({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var rn={};ct(rn,{base256emoji:()=>zc});var Ko=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}"),Dc=Ko.reduce((r,t,e)=>(r[e]=t,r),[]),Mc=Ko.reduce((r,t,e)=>{let n=t.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${t}`);return r[n]=e,r},[]);function Pc(r){return r.reduce((t,e)=>(t+=Dc[e],t),"")}function Oc(r){let t=[];for(let e of r){let n=e.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${e}`);let o=Mc[n];if(o==null)throw new Error(`Non-base256emoji character: ${e}`);t.push(o)}return new Uint8Array(t)}var zc=oe({prefix:"\u{1F680}",name:"base256emoji",encode:Pc,decode:Oc});var nn={};ct(nn,{base64:()=>Hc,base64pad:()=>Kc,base64url:()=>qc,base64urlpad:()=>Fc});var Hc=G({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Kc=G({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),qc=G({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Fc=G({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var on={};ct(on,{base8:()=>Vc});var Vc=G({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var sn={};ct(sn,{identity:()=>$c});var $c=oe({prefix:"\0",name:"identity",encode:r=>Fn(r),decode:r=>qn(r)});var su=new TextEncoder,iu=new TextDecoder;var fn={};ct(fn,{sha256:()=>Re,sha512:()=>jc});function an({name:r,code:t,encode:e}){return new cn(r,t,e)}var cn=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?$t(this.code,e):e.then(n=>$t(this.code,n))}else throw Error("Unknown type, must be binary type")}};function Fo(r){return async t=>new Uint8Array(await crypto.subtle.digest(r,t))}var Re=an({name:"sha2-256",code:18,encode:Fo("SHA-256")}),jc=an({name:"sha2-512",code:19,encode:Fo("SHA-512")});var un={...sn,...en,...on,...Jr,...tn,...Ir,...Ar,...vr,...nn,...rn},bu={...fn,...Lr};function $o(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var Vo=$o("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),hn=$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=Tt(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),Yc={utf8:Vo,"utf-8":Vo,hex:un.base16,latin1:hn,ascii:hn,binary:hn,...un},or=Yc;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 ln(r){let t=r??8192,e=t>>>1,n,o=t;return function(i){if(i<1||i>e)return Tt(i);o+i>t&&(n=Tt(t),o=0);let a=n.subarray(o,o+=i);return o&7&&(o=(o|7)+1),a}}var te=class{fn;len;next;val;constructor(t,e,n){this.fn=t,this.len=e,this.next=void 0,this.val=n}};function dn(){}var mn=class{head;tail;len;next;constructor(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}},Xc=ln();function Wc(r){return globalThis.Buffer!=null?Tt(r):Xc(r)}var Ce=class{len;head;tail;states;constructor(){this.len=0,this.head=new te(dn,0,0),this.tail=this.head,this.states=null}_push(t,e,n){return this.tail=this.tail.next=new te(t,e,n),this.len+=e,this}uint32(t){return this.len+=(this.tail=this.tail.next=new xn((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,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(sr,e.length(),e)}uint64Number(t){return this._push(Co,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(sr,e.length(),e)}sint64Number(t){let e=ut.fromNumber(t).zzEncode();return this._push(sr,e.length(),e)}sint64String(t){return this.sint64(BigInt(t))}bool(t){return this._push(pn,1,t?1:0)}fixed32(t){return this._push(Le,4,t>>>0)}sfixed32(t){return this.fixed32(t)}fixed64(t){let e=ut.fromBigInt(t);return this._push(Le,4,e.lo)._push(Le,4,e.hi)}fixed64Number(t){let e=ut.fromNumber(t);return this._push(Le,4,e.lo)._push(Le,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(Uo,4,t)}double(t){return this._push(Do,8,t)}bytes(t){let e=t.length>>>0;return e===0?this._push(pn,1,0):this.uint32(e)._push(Jc,e,t)}string(t){let e=Oo(t);return e!==0?this.uint32(e)._push(Xr,e,t):this._push(pn,1,0)}fork(){return this.states=new mn(this),this.head=this.tail=new te(dn,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 te(dn,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=Wc(this.len),n=0;for(;t!=null;)t.fn(t.val,e,n),n+=t.len,t=t.next;return e}};function pn(r,t,e){t[e]=r&255}function Qc(r,t,e){for(;r>127;)t[e++]=r&127|128,r>>>=7;t[e]=r}var xn=class extends te{next;constructor(t,e){super(Qc,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 Le(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 Jc(r,t,e){t.set(r,e)}globalThis.Buffer!=null&&(Ce.prototype.bytes=function(r){let t=r.length>>>0;return this.uint32(t),t>0&&this._push(ta,t,r),this},Ce.prototype.string=function(r){let t=globalThis.Buffer.byteLength(r);return this.uint32(t),t>0&&this._push(ea,t,r),this});function ta(r,t,e){t.set(r,e)}function ea(r,t,e){r.length<40?Xr(r,t,e):t.utf8Write!=null?t.utf8Write(r,e):t.set(st(r),e)}function gn(){return new Ce}function ir(r,t){let e=gn();return t.encode(r,e,{lengthDelimited:!1}),e.finish()}var pe;(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"})(pe||(pe={}));function cr(r,t,e,n){return{name:r,type:t,encode:e,decode:n}}function bn(r){function t(o){if(r[o.toString()]==null)throw new Error("Invalid enum value");return r[o]}let e=function(s,i){let a=t(s);i.int32(a)},n=function(s){let i=s.int32();return t(i)};return cr("enum",pe.VARINT,e,n)}function ar(r,t){return cr("message",pe.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=()=>bn(wn)})(ht||(ht={}));var Ne;(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 a=e.uint32();switch(a>>>3){case 1:{s.Type=ht.codec().decode(e);break}case 2:{s.Data=e.bytes();break}default:{e.skipType(a&7);break}}}return s})),t),r.encode=e=>ir(e,r.codec()),r.decode=(e,n)=>nr(e,r.codec(),n)})(Ne||(Ne={}));var yn;(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 a=e.uint32();switch(a>>>3){case 1:{s.Type=ht.codec().decode(e);break}case 2:{s.Data=e.bytes();break}default:{e.skipType(a&7);break}}}return s})),t),r.encode=e=>ir(e,r.codec()),r.decode=(e,n)=>nr(e,r.codec(),n)})(yn||(yn={}));var na=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]),Kt=new Uint32Array(64),En=class extends le{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:a,H:f}=this;return[t,e,n,o,s,i,a,f]}set(t,e,n,o,s,i,a,f){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=a|0,this.H=f|0}process(t,e){for(let m=0;m<16;m++,e+=4)Kt[m]=t.getUint32(e,!1);for(let m=16;m<64;m++){let _=Kt[m-15],c=Kt[m-2],p=dt(_,7)^dt(_,18)^_>>>3,l=dt(c,17)^dt(c,19)^c>>>10;Kt[m]=l+Kt[m-7]+p+Kt[m-16]|0}let{A:n,B:o,C:s,D:i,E:a,F:f,G:b,H:u}=this;for(let m=0;m<64;m++){let _=dt(a,6)^dt(a,11)^dt(a,25),c=u+_+io(a,f,b)+na[m]+Kt[m]|0,l=(dt(n,2)^dt(n,13)^dt(n,22))+co(n,o,s)|0;u=b,b=f,f=a,a=i+c|0,i=s,s=o,o=n,n=c+l|0}n=n+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,a=a+this.E|0,f=f+this.F|0,b=b+this.G|0,u=u+this.H|0,this.set(n,o,s,i,a,f,b,u)}roundClean(){Kt.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var Zo=Ve(()=>new En);function fr(r,t="utf8"){let e=or[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return e.encoder.encode(r).substring(1)}var Ue=class extends Error{constructor(t="An error occurred while verifying a message"){super(t),this.name="VerificationError"}};var ur=class extends he{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 ue(this),this.iHash.update(t),this}digestInto(t){ue(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:a}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,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()}},_n=(r,t,e)=>new ur(r,t).update(e).digest();_n.create=(r,t)=>new ur(r,t);function Go(r){r.lowS!==void 0&&pt("lowS",r.lowS),r.prehash!==void 0&&pt("prehash",r.prehash)}function oa(r){let t=Ae(r);bt(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("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("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}var{bytesToNumberBE:sa,hexToBytes:ia}=je,Rt={Err:class extends Error{constructor(t=""){super(t)}},_tlv:{encode:(r,t)=>{let{Err:e}=Rt;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=jt(n);if(o.length/2&128)throw new e("tlv.encode: long form length too big");let s=n>127?jt(o.length/2|128):"";return`${jt(r)}${s}${o}${t}`},decode(r,t){let{Err:e}=Rt,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 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 b=t.subarray(n,n+f);if(b.length!==f)throw new e("tlv.decode: length bytes not complete");if(b[0]===0)throw new e("tlv.decode(long): zero leftmost byte");for(let u of b)i=i<<8|u;if(n+=f,i<128)throw new e("tlv.decode(long): not minimal encoding")}let a=t.subarray(n,n+i);if(a.length!==i)throw new e("tlv.decode: wrong value length");return{v:a,l:t.subarray(n+i)}}},_int:{encode(r){let{Err:t}=Rt;if(r<Lt)throw new t("integer: negative integers are not allowed");let e=jt(r);if(Number.parseInt(e[0],16)&8&&(e="00"+e),e.length&1)throw new t("unexpected assertion");return e},decode(r){let{Err:t}=Rt;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 sa(r)}},toSig(r){let{Err:t,_int:e,_tlv:n}=Rt,o=typeof r=="string"?ia(r):r;de(o);let{v:s,l:i}=n.decode(48,o);if(i.length)throw new t("Invalid signature: left bytes after parsing");let{v:a,l:f}=n.decode(2,s),{v:b,l:u}=n.decode(2,f);if(u.length)throw new t("Invalid signature: left bytes after parsing");return{r:e.decode(a),s:e.decode(b)}},hexFromSig(r){let{_tlv:t,_int:e}=Rt,n=`${t.encode(2,e.encode(r.r))}${t.encode(2,e.encode(r.s))}`;return t.encode(48,n)}},Lt=BigInt(0),tt=BigInt(1),ch=BigInt(2),jo=BigInt(3),ah=BigInt(4);function ca(r){let t=oa(r),{Fp:e}=t,n=Pt(t.n,t.nBitLength),o=t.toBytes||((l,g,d)=>{let x=g.toAffine();return At(Uint8Array.from([4]),e.toBytes(x.x),e.toBytes(x.y))}),s=t.fromBytes||(l=>{let g=l.subarray(1),d=e.fromBytes(g.subarray(0,e.BYTES)),x=e.fromBytes(g.subarray(e.BYTES,2*e.BYTES));return{x:d,y:x}});function i(l){let{a:g,b:d}=t,x=e.sqr(l),h=e.mul(x,l);return e.add(e.add(h,e.mul(l,g)),d)}if(!e.eql(e.sqr(t.Gy),i(t.Gx)))throw new Error("bad generator point: equation left != right");function a(l){return ve(l,tt,t.n)}function f(l){let{allowedPrivateKeyLengths:g,nByteLength:d,wrapPrivateKey:x,n:h}=t;if(g&&typeof l!="bigint"){if(kt(l)&&(l=vt(l)),typeof l!="string"||!g.includes(l.length))throw new Error("Invalid key");l=l.padStart(d*2,"0")}let y;try{y=typeof l=="bigint"?l:It(j("private key",l,d))}catch{throw new Error(`private key must be ${d} bytes, hex or bigint, not ${typeof l}`)}return x&&(y=q(y,h)),at("private key",y,tt,h),y}function b(l){if(!(l instanceof _))throw new Error("ProjectivePoint expected")}let u=Wt((l,g)=>{let{px:d,py:x,pz:h}=l;if(e.eql(h,e.ONE))return{x:d,y:x};let y=l.is0();g==null&&(g=y?e.ONE:e.inv(h));let B=e.mul(d,g),I=e.mul(x,g),w=e.mul(h,g);if(y)return{x:e.ZERO,y:e.ZERO};if(!e.eql(w,e.ONE))throw new Error("invZ was invalid");return{x:B,y:I}}),m=Wt(l=>{if(l.is0()){if(t.allowInfinityPoint&&!e.is0(l.py))return;throw new Error("bad point: ZERO")}let{x:g,y:d}=l.toAffine();if(!e.isValid(g)||!e.isValid(d))throw new Error("bad point: x or y not FE");let x=e.sqr(d),h=i(g);if(!e.eql(x,h))throw new Error("bad point: equation left != right");if(!l.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class _{constructor(g,d,x){if(this.px=g,this.py=d,this.pz=x,g==null||!e.isValid(g))throw new Error("x required");if(d==null||!e.isValid(d))throw new Error("y required");if(x==null||!e.isValid(x))throw new Error("z required");Object.freeze(this)}static fromAffine(g){let{x:d,y:x}=g||{};if(!g||!e.isValid(d)||!e.isValid(x))throw new Error("invalid affine point");if(g instanceof _)throw new Error("projective point not allowed");let h=y=>e.eql(y,e.ZERO);return h(d)&&h(x)?_.ZERO:new _(d,x,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(g){let d=e.invertBatch(g.map(x=>x.pz));return g.map((x,h)=>x.toAffine(d[h])).map(_.fromAffine)}static fromHex(g){let d=_.fromAffine(s(j("pointHex",g)));return d.assertValidity(),d}static fromPrivateKey(g){return _.BASE.multiply(f(g))}static msm(g,d){return We(_,n,g,d)}_setWindowSize(g){p.setWindowSize(this,g)}assertValidity(){m(this)}hasEvenY(){let{y:g}=this.toAffine();if(e.isOdd)return!e.isOdd(g);throw new Error("Field doesn't support isOdd")}equals(g){b(g);let{px:d,py:x,pz:h}=this,{px:y,py:B,pz:I}=g,w=e.eql(e.mul(d,I),e.mul(y,h)),v=e.eql(e.mul(x,I),e.mul(B,h));return w&&v}negate(){return new _(this.px,e.neg(this.py),this.pz)}double(){let{a:g,b:d}=t,x=e.mul(d,jo),{px:h,py:y,pz:B}=this,I=e.ZERO,w=e.ZERO,v=e.ZERO,R=e.mul(h,h),V=e.mul(y,y),P=e.mul(B,B),M=e.mul(h,y);return M=e.add(M,M),v=e.mul(h,B),v=e.add(v,v),I=e.mul(g,v),w=e.mul(x,P),w=e.add(I,w),I=e.sub(V,w),w=e.add(V,w),w=e.mul(I,w),I=e.mul(M,I),v=e.mul(x,v),P=e.mul(g,P),M=e.sub(R,P),M=e.mul(g,M),M=e.add(M,v),v=e.add(R,R),R=e.add(v,R),R=e.add(R,P),R=e.mul(R,M),w=e.add(w,R),P=e.mul(y,B),P=e.add(P,P),R=e.mul(P,M),I=e.sub(I,R),v=e.mul(P,V),v=e.add(v,v),v=e.add(v,v),new _(I,w,v)}add(g){b(g);let{px:d,py:x,pz:h}=this,{px:y,py:B,pz:I}=g,w=e.ZERO,v=e.ZERO,R=e.ZERO,V=t.a,P=e.mul(t.b,jo),M=e.mul(d,y),N=e.mul(x,B),T=e.mul(h,I),L=e.add(d,x),S=e.add(y,B);L=e.mul(L,S),S=e.add(M,N),L=e.sub(L,S),S=e.add(d,h);let E=e.add(y,I);return S=e.mul(S,E),E=e.add(M,T),S=e.sub(S,E),E=e.add(x,h),w=e.add(B,I),E=e.mul(E,w),w=e.add(N,T),E=e.sub(E,w),R=e.mul(V,S),w=e.mul(P,T),R=e.add(w,R),w=e.sub(N,R),R=e.add(N,R),v=e.mul(w,R),N=e.add(M,M),N=e.add(N,M),T=e.mul(V,T),S=e.mul(P,S),N=e.add(N,T),T=e.sub(M,T),T=e.mul(V,T),S=e.add(S,T),M=e.mul(N,S),v=e.add(v,M),M=e.mul(E,S),w=e.mul(L,w),w=e.sub(w,M),M=e.mul(L,N),R=e.mul(E,R),R=e.add(R,M),new _(w,v,R)}subtract(g){return this.add(g.negate())}is0(){return this.equals(_.ZERO)}wNAF(g){return p.wNAFCached(this,g,_.normalizeZ)}multiplyUnsafe(g){at("scalar",g,Lt,t.n);let d=_.ZERO;if(g===Lt)return d;if(g===tt)return this;let{endo:x}=t;if(!x)return p.unsafeLadder(this,g);let{k1neg:h,k1:y,k2neg:B,k2:I}=x.splitScalar(g),w=d,v=d,R=this;for(;y>Lt||I>Lt;)y&tt&&(w=w.add(R)),I&tt&&(v=v.add(R)),R=R.double(),y>>=tt,I>>=tt;return h&&(w=w.negate()),B&&(v=v.negate()),v=new _(e.mul(v.px,x.beta),v.py,v.pz),w.add(v)}multiply(g){let{endo:d,n:x}=t;at("scalar",g,tt,x);let h,y;if(d){let{k1neg:B,k1:I,k2neg:w,k2:v}=d.splitScalar(g),{p:R,f:V}=this.wNAF(I),{p:P,f:M}=this.wNAF(v);R=p.constTimeNegate(B,R),P=p.constTimeNegate(w,P),P=new _(e.mul(P.px,d.beta),P.py,P.pz),h=R.add(P),y=V.add(M)}else{let{p:B,f:I}=this.wNAF(g);h=B,y=I}return _.normalizeZ([h,y])[0]}multiplyAndAddUnsafe(g,d,x){let h=_.BASE,y=(I,w)=>w===Lt||w===tt||!I.equals(h)?I.multiplyUnsafe(w):I.multiply(w),B=y(this,d).add(y(g,x));return B.is0()?void 0:B}toAffine(g){return u(this,g)}isTorsionFree(){let{h:g,isTorsionFree:d}=t;if(g===tt)return!0;if(d)return d(_,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:g,clearCofactor:d}=t;return g===tt?this:d?d(_,this):this.multiplyUnsafe(t.h)}toRawBytes(g=!0){return pt("isCompressed",g),this.assertValidity(),o(_,this,g)}toHex(g=!0){return pt("isCompressed",g),vt(this.toRawBytes(g))}}_.BASE=new _(t.Gx,t.Gy,e.ONE),_.ZERO=new _(e.ZERO,e.ONE,e.ZERO);let c=t.nBitLength,p=Xe(_,t.endo?Math.ceil(c/2):c);return{CURVE:t,ProjectivePoint:_,normPrivateKeyToScalar:f,weierstrassEquation:i,isWithinCurveOrder:a}}function aa(r){let t=Ae(r);return bt(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function Yo(r){let t=aa(r),{Fp:e,n}=t,o=e.BYTES+1,s=2*e.BYTES+1;function i(T){return q(T,n)}function a(T){return Ye(T,n)}let{ProjectivePoint:f,normPrivateKeyToScalar:b,weierstrassEquation:u,isWithinCurveOrder:m}=ca({...t,toBytes(T,L,S){let E=L.toAffine(),A=e.toBytes(E.x),C=At;return pt("isCompressed",S),S?C(Uint8Array.from([L.hasEvenY()?2:3]),A):C(Uint8Array.from([4]),A,e.toBytes(E.y))},fromBytes(T){let L=T.length,S=T[0],E=T.subarray(1);if(L===o&&(S===2||S===3)){let A=It(E);if(!ve(A,tt,e.ORDER))throw new Error("Point is not on curve");let C=u(A),U;try{U=e.sqrt(C)}catch(H){let z=H instanceof Error?": "+H.message:"";throw new Error("Point is not on curve"+z)}let k=(U&tt)===tt;return(S&1)===1!==k&&(U=e.neg(U)),{x:A,y:U}}else if(L===s&&S===4){let A=e.fromBytes(E.subarray(0,e.BYTES)),C=e.fromBytes(E.subarray(e.BYTES,2*e.BYTES));return{x:A,y:C}}else throw new Error(`Point of length ${L} was invalid. Expected ${o} compressed bytes or ${s} uncompressed bytes`)}}),_=T=>vt(Mt(T,t.nByteLength));function c(T){let L=n>>tt;return T>L}function p(T){return c(T)?i(-T):T}let l=(T,L,S)=>It(T.slice(L,S));class g{constructor(L,S,E){this.r=L,this.s=S,this.recovery=E,this.assertValidity()}static fromCompact(L){let S=t.nByteLength;return L=j("compactSignature",L,S*2),new g(l(L,0,S),l(L,S,2*S))}static fromDER(L){let{r:S,s:E}=Rt.toSig(j("DER",L));return new g(S,E)}assertValidity(){at("r",this.r,tt,n),at("s",this.s,tt,n)}addRecoveryBit(L){return new g(this.r,this.s,L)}recoverPublicKey(L){let{r:S,s:E,recovery:A}=this,C=I(j("msgHash",L));if(A==null||![0,1,2,3].includes(A))throw new Error("recovery id invalid");let U=A===2||A===3?S+t.n:S;if(U>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");let k=A&1?"03":"02",O=f.fromHex(k+_(U)),H=a(U),z=i(-C*H),K=i(E*H),F=f.BASE.multiplyAndAddUnsafe(O,z,K);if(!F)throw new Error("point at infinify");return F.assertValidity(),F}hasHighS(){return c(this.s)}normalizeS(){return this.hasHighS()?new g(this.r,i(-this.s),this.recovery):this}toDERRawBytes(){return Yt(this.toDERHex())}toDERHex(){return Rt.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Yt(this.toCompactHex())}toCompactHex(){return _(this.r)+_(this.s)}}let d={isValidPrivateKey(T){try{return b(T),!0}catch{return!1}},normPrivateKeyToScalar:b,randomPrivateKey:()=>{let T=Fr(t.n);return go(t.randomBytes(T),t.n)},precompute(T=8,L=f.BASE){return L._setWindowSize(T),L.multiply(BigInt(3)),L}};function x(T,L=!0){return f.fromPrivateKey(T).toRawBytes(L)}function h(T){let L=kt(T),S=typeof T=="string",E=(L||S)&&T.length;return L?E===o||E===s:S?E===2*o||E===2*s:T instanceof f}function y(T,L,S=!0){if(h(T))throw new Error("first arg must be private key");if(!h(L))throw new Error("second arg must be public key");return f.fromHex(L).multiply(b(T)).toRawBytes(S)}let B=t.bits2int||function(T){let L=It(T),S=T.length*8-t.nBitLength;return S>0?L>>BigInt(S):L},I=t.bits2int_modN||function(T){return i(B(T))},w=Ie(t.nBitLength);function v(T){return at(`num < 2^${t.nBitLength}`,T,Lt,w),Mt(T,t.nByteLength)}function R(T,L,S=V){if(["recovered","canonical"].some(J=>J in S))throw new Error("sign() legacy options not supported");let{hash:E,randomBytes:A}=t,{lowS:C,prehash:U,extraEntropy:k}=S;C==null&&(C=!0),T=j("msgHash",T),Go(S),U&&(T=j("prehashed msgHash",E(T)));let O=I(T),H=b(L),z=[v(H),v(O)];if(k!=null&&k!==!1){let J=k===!0?A(e.BYTES):k;z.push(j("extraEntropy",J))}let K=At(...z),F=O;function Q(J){let et=B(J);if(!m(et))return;let nt=a(et),Y=f.BASE.multiply(et).toAffine(),it=i(Y.x);if(it===Lt)return;let yt=i(nt*i(F+it*H));if(yt===Lt)return;let me=(Y.x===it?0:2)|Number(Y.y&tt),xe=yt;return C&&c(yt)&&(xe=p(yt),me^=1),new g(it,xe,me)}return{seed:K,k2sig:Q}}let V={lowS:t.lowS,prehash:!1},P={lowS:t.lowS,prehash:!1};function M(T,L,S=V){let{seed:E,k2sig:A}=R(T,L,S),C=t;return zr(C.hash.outputLen,C.nByteLength,C.hmac)(E,A)}f.BASE._setWindowSize(8);function N(T,L,S,E=P){let A=T;if(L=j("msgHash",L),S=j("publicKey",S),"strict"in E)throw new Error("options.strict was renamed to lowS");Go(E);let{lowS:C,prehash:U}=E,k,O;try{if(typeof A=="string"||kt(A))try{k=g.fromDER(A)}catch(Y){if(!(Y instanceof Rt.Err))throw Y;k=g.fromCompact(A)}else if(typeof A=="object"&&typeof A.r=="bigint"&&typeof A.s=="bigint"){let{r:Y,s:it}=A;k=new g(Y,it)}else throw new Error("PARSE");O=f.fromHex(S)}catch(Y){if(Y.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(C&&k.hasHighS())return!1;U&&(L=t.hash(L));let{r:H,s:z}=k,K=I(L),F=a(z),Q=i(K*F),J=i(H*F),et=f.BASE.multiplyAndAddUnsafe(O,Q,J)?.toAffine();return et?i(et.x)===H:!1}return{CURVE:t,getPublicKey:x,getSharedSecret:y,sign:M,verify:N,ProjectivePoint:f,Signature:g,utils:d}}function fa(r){return{hash:r,hmac:(t,...e)=>_n(r,t,Cr(...e)),randomBytes:$e}}function Xo(r,t){let e=n=>Yo({...r,...fa(n)});return Object.freeze({...e(t),create:e})}var Jo=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Wo=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),ua=BigInt(1),Sn=BigInt(2),Qo=(r,t)=>(r+t/Sn)/t;function ha(r){let t=Jo,e=BigInt(3),n=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),a=BigInt(44),f=BigInt(88),b=r*r*r%t,u=b*b*r%t,m=Z(u,e,t)*u%t,_=Z(m,e,t)*u%t,c=Z(_,Sn,t)*b%t,p=Z(c,o,t)*c%t,l=Z(p,s,t)*p%t,g=Z(l,a,t)*l%t,d=Z(g,f,t)*g%t,x=Z(d,a,t)*l%t,h=Z(x,e,t)*u%t,y=Z(h,i,t)*p%t,B=Z(y,n,t)*b%t,I=Z(B,Sn,t);if(!Bn.eql(Bn.sqr(I),r))throw new Error("Cannot find square root");return I}var Bn=Pt(Jo,void 0,void 0,{sqrt:ha}),ee=Xo({a:BigInt(0),b:BigInt(7),Fp:Bn,n:Wo,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:r=>{let t=Wo,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-ua*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=e,i=BigInt("0x100000000000000000000000000000000"),a=Qo(s*r,t),f=Qo(-n*r,t),b=q(r-a*e-f*o,t),u=q(-a*n-f*s,t),m=b>i,_=u>i;if(m&&(b=t-b),_&&(u=t-u),b>i||u>i)throw new Error("splitScalar: Endomorphism failed, k="+r);return{k1neg:m,k1:b,k2neg:_,k2:u}}}},Zo),gh=BigInt(0);var bh=ee.ProjectivePoint;function ts(r){return r==null?!1:typeof r.then=="function"&&typeof r.catch=="function"&&typeof r.finally=="function"}function es(r,t,e){let n=Re.digest(e instanceof Uint8Array?e:e.subarray());if(ts(n))return n.then(({digest:o})=>ee.verify(t,o,r)).catch(o=>{throw new Ue(String(o))});try{return ee.verify(t,n.digest,r)}catch(o){throw new Ue(String(o))}}var hr=class{type="secp256k1";raw;_key;constructor(t){this._key=ns(t),this.raw=rs(this._key)}toMultihash(){return _t.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:St(this.raw,t.raw)}verify(t,e){return es(this._key,e,t)}};function os(r){return new hr(r)}function rs(r){return ee.ProjectivePoint.fromHex(r).toRawBytes(!0)}function ns(r){try{return ee.ProjectivePoint.fromHex(r),r}catch(t){throw new He(String(t))}}function ss(r){let{Type:t,Data:e}=Ne.decode(r.digest),n=e??new Uint8Array;switch(t){case ht.Ed25519:return vo(n);case ht.secp256k1:return os(n);default:throw new be}}function er(r){return Ne.encode({Type:ht[r.type],Data:r.raw})}var is=Symbol.for("nodejs.util.inspect.custom"),la=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()})`}[yr]=!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(la,this.multihash)}toJSON(){return this.toString()}equals(t){if(t==null)return!1;if(t instanceof Uint8Array)return St(this.multihash.bytes,t);if(typeof t=="string")return this.toString()===t;if(t?.toMultihash()?.bytes!=null)return St(this.multihash.bytes,t.toMultihash().bytes);throw new Error("not valid Id")}[is](){return`PeerId(${this.toString()})`}},lr=class extends ke{type="RSA";publicKey;constructor(t){super({...t,type:"RSA"}),this.publicKey=t.publicKey}},dr=class extends ke{type="Ed25519";publicKey;constructor(t){super({...t,type:"Ed25519"}),this.publicKey=t.publicKey}},pr=class extends ke{type="secp256k1";publicKey;constructor(t){super({...t,type:"secp256k1"}),this.publicKey=t.publicKey}},da=2336,mr=class{type="url";multihash;publicKey;url;constructor(t){this.url=t.toString(),this.multihash=_t.digest(st(this.url))}[is](){return`PeerId(${this.url})`}[yr]=!0;toString(){return this.toCID().toString()}toMultihash(){return this.multihash}toCID(){return lt.createV1(da,this.toMultihash())}toJSON(){return this.toString()}equals(t){return t==null?!1:(t instanceof Uint8Array&&(t=fr(t)),t.toString()===this.toString())}};function cs(r){if(ma(r))return new lr({multihash:r});if(pa(r))try{let t=ss(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=fr(r.digest);return new mr(new URL(e))}throw new Ke("Supplied PeerID Multihash is invalid")}function pa(r){return r.code===_t.code}function ma(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 cs(t)}var qt=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 as(){return new qt}var Ft=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 fs(){return new Ft}var Vt=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 us(){return new Vt}var vn=64,gt=class{fp;h;seed;constructor(t,e,n,o=2){if(o>vn)throw new TypeError("Invalid Fingerprint Size");let s=e.hashV(t,n),i=Io(o);for(let a=0;a<i.length;a++)i[a]=s[a];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?St(this.fp,t.fp):!1}};function re(r,t){return Math.floor(Math.random()*(t-r))+r}var ne=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=re(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 In={32:16777619n,64:1099511628211n,128:309485009821345068724781371n,256:374144419156711147060143317175368453031918731002211n,512:35835915874844867368919076489095108449946327955754392558399825615420669938882575126094039892345713852759n,1024:5016456510113118655434598811035278955030765345404790744303017523831112055108147451509157692220295382716162651878526895249385292291816524375083746691371804094271873160484737966720260389217684476157468082573n},ps={32:2166136261n,64:14695981039346656037n,128:144066263297769815596495629667062367629n,256:100029257958052580907070968620625704837092796014241193945225284501741471925557n,512:9659303129496669498009435400716310466090418745672637896108374329434462657994582932197716438449813051892206539805784495328239340083876191928701583869517785n,1024:14197795064947621068722070641403218320880622795441933960878474914617582723252296732303717722150864096521202355549365628174669108571814760471015076148029755969804077320157692458563003215304957150157403644460363550505412711285966361610267868082893823963790439336411086884584107735010676915n},ms=new globalThis.TextEncoder;function xa(r,t){let e=In[t],n=ps[t];for(let o=0;o<r.length;o++)n^=BigInt(r[o]),n=BigInt.asUintN(t,n*e);return n}function ga(r,t,e){if(e.length===0)throw new Error("The `utf8Buffer` option must have a length greater than zero");let n=In[t],o=ps[t],s=r;for(;s.length>0;){let i=ms.encodeInto(s,e);s=s.slice(i.read);for(let a=0;a<i.written;a++)o^=BigInt(e[a]),o=BigInt.asUintN(t,o*n)}return o}function An(r,{size:t=32,utf8Buffer:e}={}){if(!In[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 ga(r,t,e);r=ms.encode(r)}return xa(r,t)}var ba=ks(ds(),1);var Me={hash:r=>Number(An(r,{size:32})),hashV:(r,t)=>wa(Me.hash(r,t))};function wa(r){let t=r.toString(16);return t.length%2===1&&(t=`0${t}`),st(t,"base16")}var ya=500,Pe=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??Me,this.seed=t.seed??re(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 ne(this.bucketSize)),this.buckets[o]==null&&(this.buckets[o]=new ne(this.bucketSize)),this.buckets[n].add(e)||this.buckets[o].add(e))return this.count++,!0;let s=[n,o],i=s[re(0,s.length-1)];this.buckets[i]==null&&(this.buckets[i]=new ne(this.bucketSize));for(let a=0;a<ya;a++){let f=this.buckets[i].swap(e);if(f!=null&&(i=(i^f.hash())%this.filterSize,this.buckets[i]==null&&(this.buckets[i]=new ne(this.bucketSize)),this.buckets[i].add(f)))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}},Ea={1:.5,2:.84,4:.95,8:.98};function _a(r=.001){return r>.002?2:r>1e-5?4:8}function xs(r,t=.001){let e=_a(t),n=Ea[e],o=Math.round(r/n),s=Math.min(Math.ceil(Math.log2(1/t)+Math.log2(2*e)),vn);return{filterSize:o,bucketSize:e,fingerprintSize:s}}var br=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??Me,this.seed=t.seed??re(0,Math.pow(2,10)),this.filterSeries=[new Pe({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 Pe({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 Tn(r,t=.001,e){return new br({...xs(r,t),...e??{}})}var Oe=class{filter;constructor(t,e){this.filter=Tn(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 gs(r,t=.001){return new Oe(r,t)}var Rn=class extends qt{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 bs(r){let{name:t,metrics:e}=r,n;return e!=null?n=new Rn({name:t,metrics:e}):n=new qt,n}var Ln=class extends Ft{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 ws(r){let{name:t,metrics:e}=r,n;return e!=null?n=new Ln({name:t,metrics:e}):n=new Ft,n}var Cn=class extends Vt{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 Cn({name:t,metrics:e}):n=new Vt,n}return Ds(Sa);})();
|
3
3
|
/*! Bundled license information:
|
4
4
|
|
5
5
|
@noble/hashes/esm/utils.js:
|
package/dist/src/index.d.ts
CHANGED
@@ -111,6 +111,9 @@ export { PeerSet, peerSet } from './set.js';
|
|
111
111
|
export { PeerList, peerList } from './list.js';
|
112
112
|
export { PeerFilter, peerFilter } from './filter.js';
|
113
113
|
export { trackedPeerMap } from './tracked-map.js';
|
114
|
+
export type { TrackedPeerMapInit } from './tracked-map.js';
|
114
115
|
export { trackedPeerSet } from './tracked-set.js';
|
116
|
+
export type { TrackedPeerSetInit } from './tracked-set.js';
|
115
117
|
export { trackedPeerList } from './tracked-list.js';
|
118
|
+
export type { TrackedPeerListInit } from './tracked-list.js';
|
116
119
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2GG;AAEH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2GG;AAEH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,YAAY,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA"}
|
package/dist/src/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2GG;AAEH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2GG;AAEH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA"}
|
@@ -2,16 +2,6 @@ import { PeerList } from './list.js';
|
|
2
2
|
import type { Metrics } from '@libp2p/interface';
|
3
3
|
export interface TrackedPeerListInit {
|
4
4
|
name: string;
|
5
|
-
metrics: Metrics;
|
6
|
-
}
|
7
|
-
export interface CreateTrackedPeerListInit {
|
8
|
-
/**
|
9
|
-
* The metric name to use
|
10
|
-
*/
|
11
|
-
name: string;
|
12
|
-
/**
|
13
|
-
* A metrics implementation
|
14
|
-
*/
|
15
5
|
metrics?: Metrics;
|
16
6
|
}
|
17
7
|
/**
|
@@ -29,5 +19,5 @@ export interface CreateTrackedPeerListInit {
|
|
29
19
|
* list.push(peerId)
|
30
20
|
* ```
|
31
21
|
*/
|
32
|
-
export declare function trackedPeerList(config:
|
22
|
+
export declare function trackedPeerList(config: TrackedPeerListInit): PeerList;
|
33
23
|
//# sourceMappingURL=tracked-list.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"tracked-list.d.ts","sourceRoot":"","sources":["../../src/tracked-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACpC,OAAO,KAAK,EAAU,OAAO,EAAU,MAAM,mBAAmB,CAAA;AAEhE,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,OAAO,CAAA;
|
1
|
+
{"version":3,"file":"tracked-list.d.ts","sourceRoot":"","sources":["../../src/tracked-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACpC,OAAO,KAAK,EAAU,OAAO,EAAU,MAAM,mBAAmB,CAAA;AAEhE,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AA+CD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAE,MAAM,EAAE,mBAAmB,GAAG,QAAQ,CAWtE"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"tracked-list.js","sourceRoot":"","sources":["../../src/tracked-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAQpC,MAAM,eAAgB,SAAQ,QAAQ;IACnB,MAAM,CAAQ;IAE/B,YAAa,
|
1
|
+
{"version":3,"file":"tracked-list.js","sourceRoot":"","sources":["../../src/tracked-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAQpC,MAAM,eAAgB,SAAQ,QAAQ;IACnB,MAAM,CAAQ;IAE/B,YAAa,IAAmC;QAC9C,KAAK,EAAE,CAAA;QAEP,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;QAE9B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAA;QAC1C,IAAI,CAAC,qBAAqB,EAAE,CAAA;IAC9B,CAAC;IAED,GAAG;QACD,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,EAAE,CAAA;QAC1B,IAAI,CAAC,qBAAqB,EAAE,CAAA;QAC5B,OAAO,MAAM,CAAA;IACf,CAAC;IAED,IAAI,CAAE,GAAG,OAAiB;QACxB,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAA;QACtB,IAAI,CAAC,qBAAqB,EAAE,CAAA;IAC9B,CAAC;IAED,KAAK;QACH,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,EAAE,CAAA;QAC5B,IAAI,CAAC,qBAAqB,EAAE,CAAA;QAC5B,OAAO,MAAM,CAAA;IACf,CAAC;IAED,OAAO,CAAE,GAAG,OAAiB;QAC3B,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,CAAA;QACxC,IAAI,CAAC,qBAAqB,EAAE,CAAA;QAC5B,OAAO,MAAM,CAAA;IACf,CAAC;IAED,KAAK;QACH,KAAK,CAAC,KAAK,EAAE,CAAA;QACb,IAAI,CAAC,qBAAqB,EAAE,CAAA;IAC9B,CAAC;IAEO,qBAAqB;QAC3B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACjC,CAAC;CACF;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,eAAe,CAAE,MAA2B;IAC1D,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAA;IAChC,IAAI,GAAa,CAAA;IAEjB,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;QACpB,GAAG,GAAG,IAAI,eAAe,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAA;IAC9C,CAAC;SAAM,CAAC;QACN,GAAG,GAAG,IAAI,QAAQ,EAAE,CAAA;IACtB,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
@@ -2,16 +2,6 @@ import { PeerMap } from './map.js';
|
|
2
2
|
import type { Metrics } from '@libp2p/interface';
|
3
3
|
export interface TrackedPeerMapInit {
|
4
4
|
name: string;
|
5
|
-
metrics: Metrics;
|
6
|
-
}
|
7
|
-
export interface CreateTrackedPeerMapInit {
|
8
|
-
/**
|
9
|
-
* The metric name to use
|
10
|
-
*/
|
11
|
-
name: string;
|
12
|
-
/**
|
13
|
-
* A metrics implementation
|
14
|
-
*/
|
15
5
|
metrics?: Metrics;
|
16
6
|
}
|
17
7
|
/**
|
@@ -29,5 +19,5 @@ export interface CreateTrackedPeerMapInit {
|
|
29
19
|
* map.set(peerId, 'value')
|
30
20
|
* ```
|
31
21
|
*/
|
32
|
-
export declare function trackedPeerMap<V>(config:
|
22
|
+
export declare function trackedPeerMap<V>(config: TrackedPeerMapInit): PeerMap<V>;
|
33
23
|
//# sourceMappingURL=tracked-map.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"tracked-map.d.ts","sourceRoot":"","sources":["../../src/tracked-map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAClC,OAAO,KAAK,EAAU,OAAO,EAAU,MAAM,mBAAmB,CAAA;AAEhE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,
|
1
|
+
{"version":3,"file":"tracked-map.d.ts","sourceRoot":"","sources":["../../src/tracked-map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAClC,OAAO,KAAK,EAAU,OAAO,EAAU,MAAM,mBAAmB,CAAA;AAEhE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAoCD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAE,CAAC,EAAG,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC,CAW1E"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"tracked-map.js","sourceRoot":"","sources":["../../src/tracked-map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAQlC,MAAM,cAAkB,SAAQ,OAAU;IACvB,MAAM,CAAQ;IAE/B,YAAa,
|
1
|
+
{"version":3,"file":"tracked-map.js","sourceRoot":"","sources":["../../src/tracked-map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAQlC,MAAM,cAAkB,SAAQ,OAAU;IACvB,MAAM,CAAQ;IAE/B,YAAa,IAAkC;QAC7C,KAAK,EAAE,CAAA;QAEP,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;QAE9B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAA;QAC1C,IAAI,CAAC,qBAAqB,EAAE,CAAA;IAC9B,CAAC;IAED,GAAG,CAAE,GAAW,EAAE,KAAQ;QACxB,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;QACrB,IAAI,CAAC,qBAAqB,EAAE,CAAA;QAC5B,OAAO,IAAI,CAAA;IACb,CAAC;IAED,MAAM,CAAE,GAAW;QACjB,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QACjC,IAAI,CAAC,qBAAqB,EAAE,CAAA;QAC5B,OAAO,OAAO,CAAA;IAChB,CAAC;IAED,KAAK;QACH,KAAK,CAAC,KAAK,EAAE,CAAA;QACb,IAAI,CAAC,qBAAqB,EAAE,CAAA;IAC9B,CAAC;IAEO,qBAAqB;QAC3B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC/B,CAAC;CACF;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,cAAc,CAAM,MAA0B;IAC5D,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAA;IAChC,IAAI,GAAe,CAAA;IAEnB,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;QACpB,GAAG,GAAG,IAAI,cAAc,CAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAA;IAChD,CAAC;SAAM,CAAC;QACN,GAAG,GAAG,IAAI,OAAO,EAAK,CAAA;IACxB,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
@@ -2,16 +2,6 @@ import { PeerSet } from './set.js';
|
|
2
2
|
import type { Metrics } from '@libp2p/interface';
|
3
3
|
export interface TrackedPeerSetInit {
|
4
4
|
name: string;
|
5
|
-
metrics: Metrics;
|
6
|
-
}
|
7
|
-
export interface CreateTrackedPeerSetInit {
|
8
|
-
/**
|
9
|
-
* The metric name to use
|
10
|
-
*/
|
11
|
-
name: string;
|
12
|
-
/**
|
13
|
-
* A metrics implementation
|
14
|
-
*/
|
15
5
|
metrics?: Metrics;
|
16
6
|
}
|
17
7
|
/**
|
@@ -29,5 +19,5 @@ export interface CreateTrackedPeerSetInit {
|
|
29
19
|
* map.add(peerId)
|
30
20
|
* ```
|
31
21
|
*/
|
32
|
-
export declare function trackedPeerSet(config:
|
22
|
+
export declare function trackedPeerSet(config: TrackedPeerSetInit): PeerSet;
|
33
23
|
//# sourceMappingURL=tracked-set.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"tracked-set.d.ts","sourceRoot":"","sources":["../../src/tracked-set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAClC,OAAO,KAAK,EAAU,OAAO,EAAU,MAAM,mBAAmB,CAAA;AAEhE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,
|
1
|
+
{"version":3,"file":"tracked-set.d.ts","sourceRoot":"","sources":["../../src/tracked-set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAClC,OAAO,KAAK,EAAU,OAAO,EAAU,MAAM,mBAAmB,CAAA;AAEhE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAkCD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAE,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAWnE"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"tracked-set.js","sourceRoot":"","sources":["../../src/tracked-set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAQlC,MAAM,cAAe,SAAQ,OAAO;IACjB,MAAM,CAAQ;IAE/B,YAAa,
|
1
|
+
{"version":3,"file":"tracked-set.js","sourceRoot":"","sources":["../../src/tracked-set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAQlC,MAAM,cAAe,SAAQ,OAAO;IACjB,MAAM,CAAQ;IAE/B,YAAa,IAAkC;QAC7C,KAAK,EAAE,CAAA;QAEP,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;QAE9B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAA;QAC1C,IAAI,CAAC,qBAAqB,EAAE,CAAA;IAC9B,CAAC;IAED,GAAG,CAAE,IAAY;QACf,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACf,IAAI,CAAC,qBAAqB,EAAE,CAAA;IAC9B,CAAC;IAED,MAAM,CAAE,IAAY;QAClB,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QAClB,IAAI,CAAC,qBAAqB,EAAE,CAAA;IAC9B,CAAC;IAED,KAAK;QACH,KAAK,CAAC,KAAK,EAAE,CAAA;QACb,IAAI,CAAC,qBAAqB,EAAE,CAAA;IAC9B,CAAC;IAEO,qBAAqB;QAC3B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC/B,CAAC;CACF;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,cAAc,CAAE,MAA0B;IACxD,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAA;IAChC,IAAI,GAAY,CAAA;IAEhB,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;QACpB,GAAG,GAAG,IAAI,cAAc,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAA;IAC7C,CAAC;SAAM,CAAC;QACN,GAAG,GAAG,IAAI,OAAO,EAAE,CAAA;IACrB,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@libp2p/peer-collections",
|
3
|
-
"version": "6.0.
|
3
|
+
"version": "6.0.2-7f7ec82ae",
|
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": "
|
58
|
-
"@libp2p/peer-id": "
|
59
|
-
"@libp2p/utils": "
|
57
|
+
"@libp2p/interface": "2.1.0-7f7ec82ae",
|
58
|
+
"@libp2p/peer-id": "5.0.2-7f7ec82ae",
|
59
|
+
"@libp2p/utils": "6.0.2-7f7ec82ae",
|
60
60
|
"multiformats": "^13.2.2"
|
61
61
|
},
|
62
62
|
"devDependencies": {
|
63
|
-
"@libp2p/crypto": "
|
63
|
+
"@libp2p/crypto": "5.0.2-7f7ec82ae",
|
64
64
|
"@types/sinon": "^17.0.3",
|
65
65
|
"aegir": "^44.0.1",
|
66
66
|
"sinon": "^18.0.0",
|
package/src/index.ts
CHANGED
@@ -113,5 +113,8 @@ export { PeerList, peerList } from './list.js'
|
|
113
113
|
export { PeerFilter, peerFilter } from './filter.js'
|
114
114
|
|
115
115
|
export { trackedPeerMap } from './tracked-map.js'
|
116
|
+
export type { TrackedPeerMapInit } from './tracked-map.js'
|
116
117
|
export { trackedPeerSet } from './tracked-set.js'
|
118
|
+
export type { TrackedPeerSetInit } from './tracked-set.js'
|
117
119
|
export { trackedPeerList } from './tracked-list.js'
|
120
|
+
export type { TrackedPeerListInit } from './tracked-list.js'
|
package/src/tracked-list.ts
CHANGED
@@ -3,13 +3,13 @@ import type { Metric, Metrics, PeerId } from '@libp2p/interface'
|
|
3
3
|
|
4
4
|
export interface TrackedPeerListInit {
|
5
5
|
name: string
|
6
|
-
metrics
|
6
|
+
metrics?: Metrics
|
7
7
|
}
|
8
8
|
|
9
9
|
class TrackedPeerList extends PeerList {
|
10
10
|
private readonly metric: Metric
|
11
11
|
|
12
|
-
constructor (init: TrackedPeerListInit) {
|
12
|
+
constructor (init: Required<TrackedPeerListInit>) {
|
13
13
|
super()
|
14
14
|
|
15
15
|
const { name, metrics } = init
|
@@ -51,18 +51,6 @@ class TrackedPeerList extends PeerList {
|
|
51
51
|
}
|
52
52
|
}
|
53
53
|
|
54
|
-
export interface CreateTrackedPeerListInit {
|
55
|
-
/**
|
56
|
-
* The metric name to use
|
57
|
-
*/
|
58
|
-
name: string
|
59
|
-
|
60
|
-
/**
|
61
|
-
* A metrics implementation
|
62
|
-
*/
|
63
|
-
metrics?: Metrics
|
64
|
-
}
|
65
|
-
|
66
54
|
/**
|
67
55
|
* Creates a PeerList that reports it's size to the libp2p Metrics service
|
68
56
|
*
|
@@ -78,7 +66,7 @@ export interface CreateTrackedPeerListInit {
|
|
78
66
|
* list.push(peerId)
|
79
67
|
* ```
|
80
68
|
*/
|
81
|
-
export function trackedPeerList (config:
|
69
|
+
export function trackedPeerList (config: TrackedPeerListInit): PeerList {
|
82
70
|
const { name, metrics } = config
|
83
71
|
let map: PeerList
|
84
72
|
|
package/src/tracked-map.ts
CHANGED
@@ -3,13 +3,13 @@ import type { Metric, Metrics, PeerId } from '@libp2p/interface'
|
|
3
3
|
|
4
4
|
export interface TrackedPeerMapInit {
|
5
5
|
name: string
|
6
|
-
metrics
|
6
|
+
metrics?: Metrics
|
7
7
|
}
|
8
8
|
|
9
9
|
class TrackedPeerMap<V> extends PeerMap<V> {
|
10
10
|
private readonly metric: Metric
|
11
11
|
|
12
|
-
constructor (init: TrackedPeerMapInit) {
|
12
|
+
constructor (init: Required<TrackedPeerMapInit>) {
|
13
13
|
super()
|
14
14
|
|
15
15
|
const { name, metrics } = init
|
@@ -40,18 +40,6 @@ class TrackedPeerMap<V> extends PeerMap<V> {
|
|
40
40
|
}
|
41
41
|
}
|
42
42
|
|
43
|
-
export interface CreateTrackedPeerMapInit {
|
44
|
-
/**
|
45
|
-
* The metric name to use
|
46
|
-
*/
|
47
|
-
name: string
|
48
|
-
|
49
|
-
/**
|
50
|
-
* A metrics implementation
|
51
|
-
*/
|
52
|
-
metrics?: Metrics
|
53
|
-
}
|
54
|
-
|
55
43
|
/**
|
56
44
|
* Creates a PeerMap that reports it's size to the libp2p Metrics service
|
57
45
|
*
|
@@ -67,7 +55,7 @@ export interface CreateTrackedPeerMapInit {
|
|
67
55
|
* map.set(peerId, 'value')
|
68
56
|
* ```
|
69
57
|
*/
|
70
|
-
export function trackedPeerMap <V> (config:
|
58
|
+
export function trackedPeerMap <V> (config: TrackedPeerMapInit): PeerMap<V> {
|
71
59
|
const { name, metrics } = config
|
72
60
|
let map: PeerMap<V>
|
73
61
|
|
package/src/tracked-set.ts
CHANGED
@@ -3,13 +3,13 @@ import type { Metric, Metrics, PeerId } from '@libp2p/interface'
|
|
3
3
|
|
4
4
|
export interface TrackedPeerSetInit {
|
5
5
|
name: string
|
6
|
-
metrics
|
6
|
+
metrics?: Metrics
|
7
7
|
}
|
8
8
|
|
9
9
|
class TrackedPeerSet extends PeerSet {
|
10
10
|
private readonly metric: Metric
|
11
11
|
|
12
|
-
constructor (init: TrackedPeerSetInit) {
|
12
|
+
constructor (init: Required<TrackedPeerSetInit>) {
|
13
13
|
super()
|
14
14
|
|
15
15
|
const { name, metrics } = init
|
@@ -38,18 +38,6 @@ class TrackedPeerSet extends PeerSet {
|
|
38
38
|
}
|
39
39
|
}
|
40
40
|
|
41
|
-
export interface CreateTrackedPeerSetInit {
|
42
|
-
/**
|
43
|
-
* The metric name to use
|
44
|
-
*/
|
45
|
-
name: string
|
46
|
-
|
47
|
-
/**
|
48
|
-
* A metrics implementation
|
49
|
-
*/
|
50
|
-
metrics?: Metrics
|
51
|
-
}
|
52
|
-
|
53
41
|
/**
|
54
42
|
* Creates a PeerSet that reports it's size to the libp2p Metrics service
|
55
43
|
*
|
@@ -65,7 +53,7 @@ export interface CreateTrackedPeerSetInit {
|
|
65
53
|
* map.add(peerId)
|
66
54
|
* ```
|
67
55
|
*/
|
68
|
-
export function trackedPeerSet (config:
|
56
|
+
export function trackedPeerSet (config: TrackedPeerSetInit): PeerSet {
|
69
57
|
const { name, metrics } = config
|
70
58
|
let map: PeerSet
|
71
59
|
|
package/dist/typedoc-urls.json
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"PeerFilter": "https://libp2p.github.io/js-libp2p/classes/_libp2p_peer_collections.PeerFilter.html",
|
3
|
-
"PeerList": "https://libp2p.github.io/js-libp2p/classes/_libp2p_peer_collections.PeerList.html",
|
4
|
-
"PeerMap": "https://libp2p.github.io/js-libp2p/classes/_libp2p_peer_collections.PeerMap.html",
|
5
|
-
"PeerSet": "https://libp2p.github.io/js-libp2p/classes/_libp2p_peer_collections.PeerSet.html",
|
6
|
-
"peerFilter": "https://libp2p.github.io/js-libp2p/functions/_libp2p_peer_collections.peerFilter-1.html",
|
7
|
-
"peerList": "https://libp2p.github.io/js-libp2p/functions/_libp2p_peer_collections.peerList-1.html",
|
8
|
-
"peerMap": "https://libp2p.github.io/js-libp2p/functions/_libp2p_peer_collections.peerMap-1.html",
|
9
|
-
"peerSet": "https://libp2p.github.io/js-libp2p/functions/_libp2p_peer_collections.peerSet-1.html",
|
10
|
-
"trackedPeerList": "https://libp2p.github.io/js-libp2p/functions/_libp2p_peer_collections.trackedPeerList.html",
|
11
|
-
"trackedPeerMap": "https://libp2p.github.io/js-libp2p/functions/_libp2p_peer_collections.trackedPeerMap.html",
|
12
|
-
"trackedPeerSet": "https://libp2p.github.io/js-libp2p/functions/_libp2p_peer_collections.trackedPeerSet.html"
|
13
|
-
}
|