@libp2p/peer-id 5.0.14 → 5.0.15-2fbcdb687

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.min.js CHANGED
@@ -1,5 +1,5 @@
1
1
  (function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PPeerId = factory()}(typeof self !== 'undefined' ? self : this, function () {
2
- "use strict";var Libp2PPeerId=(()=>{var ar=Object.defineProperty;var es=Object.getOwnPropertyDescriptor;var rs=Object.getOwnPropertyNames;var ns=Object.prototype.hasOwnProperty;var it=(e,t)=>{for(var r in t)ar(e,r,{get:t[r],enumerable:!0})},os=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of rs(t))!ns.call(e,o)&&o!==r&&ar(e,o,{get:()=>t[o],enumerable:!(n=es(t,o))||n.enumerable});return e};var ss=e=>os(ar({},"__esModule",{value:!0}),e);var Fc={};it(Fc,{peerIdFromCID:()=>kc,peerIdFromMultihash:()=>xn,peerIdFromPrivateKey:()=>qc,peerIdFromPublicKey:()=>Go,peerIdFromString:()=>Mc});var fr=Symbol.for("@libp2p/peer-id");var Xt=class extends Error{static name="InvalidParametersError";constructor(t="Invalid parameters"){super(t),this.name="InvalidParametersError"}},_e=class extends Error{static name="InvalidPublicKeyError";constructor(t="Invalid public key"){super(t),this.name="InvalidPublicKeyError"}};var De=class extends Error{static name="InvalidCIDError";constructor(t="Invalid CID"){super(t),this.name="InvalidCIDError"}},Oe=class extends Error{static name="InvalidMultihashError";constructor(t="Invalid Multihash"){super(t),this.name="InvalidMultihashError"}};var $t=class extends Error{static name="UnsupportedKeyTypeError";constructor(t="Unsupported key type"){super(t),this.name="UnsupportedKeyTypeError"}};var pr={};it(pr,{base58btc:()=>Q,base58flickr:()=>hs});var Yc=new Uint8Array(0);function vn(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}function bt(e){if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")}function An(e){return new TextEncoder().encode(e)}function In(e){return new TextDecoder().decode(e)}function is(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<e.length;o++){var s=e.charAt(o),i=s.charCodeAt(0);if(r[i]!==255)throw new TypeError(s+" is ambiguous");r[i]=o}var c=e.length,a=e.charAt(0),l=Math.log(c)/Math.log(256),f=Math.log(256)/Math.log(c);function x(w){if(w instanceof Uint8Array||(ArrayBuffer.isView(w)?w=new Uint8Array(w.buffer,w.byteOffset,w.byteLength):Array.isArray(w)&&(w=Uint8Array.from(w))),!(w instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(w.length===0)return"";for(var y=0,u=0,b=0,S=w.length;b!==S&&w[b]===0;)b++,y++;for(var d=(S-b)*f+1>>>0,A=new Uint8Array(d);b!==S;){for(var C=w[b],U=0,I=d-1;(C!==0||U<u)&&I!==-1;I--,U++)C+=256*A[I]>>>0,A[I]=C%c>>>0,C=C/c>>>0;if(C!==0)throw new Error("Non-zero carry");u=U,b++}for(var L=d-u;L!==d&&A[L]===0;)L++;for(var T=a.repeat(y);L<d;++L)T+=e.charAt(A[L]);return T}function p(w){if(typeof w!="string")throw new TypeError("Expected String");if(w.length===0)return new Uint8Array;var y=0;if(w[y]!==" "){for(var u=0,b=0;w[y]===a;)u++,y++;for(var S=(w.length-y)*l+1>>>0,d=new Uint8Array(S);w[y];){var A=r[w.charCodeAt(y)];if(A===255)return;for(var C=0,U=S-1;(A!==0||C<b)&&U!==-1;U--,C++)A+=c*d[U]>>>0,d[U]=A%256>>>0,A=A/256>>>0;if(A!==0)throw new Error("Non-zero carry");b=C,y++}if(w[y]!==" "){for(var I=S-b;I!==S&&d[I]===0;)I++;for(var L=new Uint8Array(u+(S-I)),T=u;I!==S;)L[T++]=d[I++];return L}}}function B(w){var y=p(w);if(y)return y;throw new Error(`Non-${t} character`)}return{encode:x,decodeUnsafe:p,decode:B}}var cs=is,as=cs,Rn=as;var ur=class{name;prefix;baseEncode;constructor(t,r,n){this.name=t,this.prefix=r,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},hr=class{name;prefix;baseDecode;prefixCodePoint;constructor(t,r,n){this.name=t,this.prefix=r;let o=r.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 Ln(this,t)}},dr=class{decoders;constructor(t){this.decoders=t}or(t){return Ln(this,t)}decode(t){let r=t[0],n=this.decoders[r];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 Ln(e,t){return new dr({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var lr=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(t,r,n,o){this.name=t,this.prefix=r,this.baseEncode=n,this.baseDecode=o,this.encoder=new ur(t,r,n),this.decoder=new hr(t,r,o)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};function Qt({name:e,prefix:t,encode:r,decode:n}){return new lr(e,t,r,n)}function Rt({name:e,prefix:t,alphabet:r}){let{encode:n,decode:o}=Rn(r,e);return Qt({prefix:t,name:e,encode:n,decode:s=>bt(o(s))})}function fs(e,t,r,n){let o={};for(let f=0;f<t.length;++f)o[t[f]]=f;let s=e.length;for(;e[s-1]==="=";)--s;let i=new Uint8Array(s*r/8|0),c=0,a=0,l=0;for(let f=0;f<s;++f){let x=o[e[f]];if(x===void 0)throw new SyntaxError(`Non-${n} character`);a=a<<r|x,c+=r,c>=8&&(c-=8,i[l++]=255&a>>c)}if(c>=r||(255&a<<8-c)!==0)throw new SyntaxError("Unexpected end of data");return i}function us(e,t,r){let n=t[t.length-1]==="=",o=(1<<r)-1,s="",i=0,c=0;for(let a=0;a<e.length;++a)for(c=c<<8|e[a],i+=8;i>r;)i-=r,s+=t[o&c>>i];if(i!==0&&(s+=t[o&c<<r-i]),n)for(;(s.length*r&7)!==0;)s+="=";return s}function j({name:e,prefix:t,bitsPerChar:r,alphabet:n}){return Qt({prefix:t,name:e,encode(o){return us(o,n,r)},decode(o){return fs(o,n,r,e)}})}var Q=Rt({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),hs=Rt({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var mr={};it(mr,{base32:()=>Jt,base32hex:()=>ms,base32hexpad:()=>ys,base32hexpadupper:()=>gs,base32hexupper:()=>xs,base32pad:()=>ls,base32padupper:()=>ps,base32upper:()=>ds,base32z:()=>bs});var Jt=j({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ds=j({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ls=j({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ps=j({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ms=j({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),xs=j({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),ys=j({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),gs=j({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),bs=j({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var xr={};it(xr,{base36:()=>he,base36upper:()=>ws});var he=Rt({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),ws=Rt({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Es=Nn,Un=128,Bs=127,Ss=~Bs,vs=Math.pow(2,31);function Nn(e,t,r){t=t||[],r=r||0;for(var n=r;e>=vs;)t[r++]=e&255|Un,e/=128;for(;e&Ss;)t[r++]=e&255|Un,e>>>=7;return t[r]=e|0,Nn.bytes=r-n+1,t}var As=yr,Is=128,Cn=127;function yr(e,n){var r=0,n=n||0,o=0,s=n,i,c=e.length;do{if(s>=c)throw yr.bytes=0,new RangeError("Could not decode varint");i=e[s++],r+=o<28?(i&Cn)<<o:(i&Cn)*Math.pow(2,o),o+=7}while(i>=Is);return yr.bytes=s-n,r}var Ts=Math.pow(2,7),Rs=Math.pow(2,14),Ls=Math.pow(2,21),Us=Math.pow(2,28),Cs=Math.pow(2,35),Ns=Math.pow(2,42),_s=Math.pow(2,49),Ds=Math.pow(2,56),Os=Math.pow(2,63),Ps=function(e){return e<Ts?1:e<Rs?2:e<Ls?3:e<Us?4:e<Cs?5:e<Ns?6:e<_s?7:e<Ds?8:e<Os?9:10},Ks={encode:Es,decode:As,encodingLength:Ps},Hs=Ks,de=Hs;function le(e,t=0){return[de.decode(e,t),de.decode.bytes]}function te(e,t,r=0){return de.encode(e,t,r),t}function ee(e){return de.encodingLength(e)}function Mt(e,t){let r=t.byteLength,n=ee(e),o=n+ee(r),s=new Uint8Array(o+r);return te(e,s,0),te(r,s,n),s.set(t,o),new re(e,r,t,s)}function pe(e){let t=bt(e),[r,n]=le(t),[o,s]=le(t.subarray(n)),i=t.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new re(r,o,i,t)}function _n(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&vn(e.bytes,r.bytes)}}var re=class{code;size;digest;bytes;constructor(t,r,n,o){this.code=t,this.size=r,this.digest=n,this.bytes=o}};function Dn(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return qs(r,gr(e),t??Q.encoder);default:return ks(r,gr(e),t??Jt.encoder)}}var On=new WeakMap;function gr(e){let t=On.get(e);if(t==null){let r=new Map;return On.set(e,r),r}return t}var ht=class e{code;version;multihash;bytes;"/";constructor(t,r,n,o){this.code=r,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:r}=this;if(t!==me)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Vs)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return e.createV0(r)}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:r}=this.multihash,n=Mt(t,r);return e.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 e.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&_n(t.multihash,n.multihash)}toString(t){return Dn(this,t)}toJSON(){return{"/":Dn(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 r=t;if(r instanceof e)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:o,multihash:s,bytes:i}=r;return new e(n,o,s,i??Pn(n,o,s.bytes))}else if(r[zs]===!0){let{version:n,multihash:o,code:s}=r,i=pe(o);return e.create(n,s,i)}else return null}static create(t,r,n){if(typeof r!="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(r!==me)throw new Error(`Version 0 CID must use dag-pb (code: ${me}) block encoding`);return new e(t,r,n,n.bytes)}case 1:{let o=Pn(t,r,n.bytes);return new e(t,r,n,o)}default:throw new Error("Invalid version")}}static createV0(t){return e.create(0,me,t)}static createV1(t,r){return e.create(1,t,r)}static decode(t){let[r,n]=e.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=e.inspectBytes(t),n=r.size-r.multihashSize,o=bt(t.subarray(n,n+r.multihashSize));if(o.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=o.subarray(r.multihashSize-r.digestSize),i=new re(r.multihashCode,r.digestSize,s,o);return[r.version===0?e.createV0(i):e.createV1(r.codec,i),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[x,p]=le(t.subarray(r));return r+=p,x},o=n(),s=me;if(o===18?(o=0,r=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=r,c=n(),a=n(),l=r+a,f=l-i;return{version:o,codec:s,multihashCode:c,digestSize:a,multihashSize:f,size:l}}static parse(t,r){let[n,o]=Ms(t,r),s=e.decode(o);if(s.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return gr(s).set(n,t),s}};function Ms(e,t){switch(e[0]){case"Q":{let r=t??Q;return[Q.prefix,r.decode(`${Q.prefix}${e}`)]}case Q.prefix:{let r=t??Q;return[Q.prefix,r.decode(e)]}case Jt.prefix:{let r=t??Jt;return[Jt.prefix,r.decode(e)]}case he.prefix:{let r=t??he;return[he.prefix,r.decode(e)]}default:{if(t==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}}function qs(e,t,r){let{prefix:n}=r;if(n!==Q.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let o=t.get(n);if(o==null){let s=r.encode(e).slice(1);return t.set(n,s),s}else return o}function ks(e,t,r){let{prefix:n}=r,o=t.get(n);if(o==null){let s=r.encode(e);return t.set(n,s),s}else return o}var me=112,Vs=18;function Pn(e,t,r){let n=ee(e),o=n+ee(t),s=new Uint8Array(o+r.byteLength);return te(e,s,0),te(t,s,n),s.set(r,o),s}var zs=Symbol.for("@ipld/js-cid/CID");var br={};it(br,{identity:()=>wt});var Kn=0,Fs="identity",Hn=bt;function Zs(e){return Mt(Kn,Hn(e))}var wt={code:Kn,name:Fs,encode:Hn,digest:Zs};function qt(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}function Mn(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Gs(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function oe(e,...t){if(!Gs(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function qn(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Mn(e.outputLen),Mn(e.blockLen)}function se(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function kn(e,t){oe(e);let r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}var kt=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Ke(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function dt(e,t){return e<<32-t|e>>>t}function Vn(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function xe(e){return typeof e=="string"&&(e=Vn(e)),oe(e),e}function wr(...e){let t=0;for(let n=0;n<e.length;n++){let o=e[n];oe(o),t+=o.length}let r=new Uint8Array(t);for(let n=0,o=0;n<e.length;n++){let s=e[n];r.set(s,o),o+=s.length}return r}var ie=class{clone(){return this._cloneInto()}};function He(e){let t=n=>e().update(xe(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function Me(e=32){if(kt&&typeof kt.getRandomValues=="function")return kt.getRandomValues(new Uint8Array(e));if(kt&&typeof kt.randomBytes=="function")return kt.randomBytes(e);throw new Error("crypto.getRandomValues must be defined")}function js(e,t,r,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,n);let o=BigInt(32),s=BigInt(4294967295),i=Number(r>>o&s),c=Number(r&s),a=n?4:0,l=n?0:4;e.setUint32(t+a,i,n),e.setUint32(t+l,c,n)}function zn(e,t,r){return e&t^~e&r}function Fn(e,t,r){return e&t^e&r^t&r}var ce=class extends ie{constructor(t,r,n,o){super(),this.blockLen=t,this.outputLen=r,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=Ke(this.buffer)}update(t){se(this);let{view:r,buffer:n,blockLen:o}=this;t=xe(t);let s=t.length;for(let i=0;i<s;){let c=Math.min(o-this.pos,s-i);if(c===o){let a=Ke(t);for(;o<=s-i;i+=o)this.process(a,i);continue}n.set(t.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===o&&(this.process(r,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){se(this),kn(t,this),this.finished=!0;let{buffer:r,view:n,blockLen:o,isLE:s}=this,{pos:i}=this;r[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>o-i&&(this.process(n,0),i=0);for(let x=i;x<o;x++)r[x]=0;js(n,o-8,BigInt(this.length*8),s),this.process(n,0);let c=Ke(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let l=a/4,f=this.get();if(l>f.length)throw new Error("_sha2: outputLen bigger than state");for(let x=0;x<l;x++)c.setUint32(4*x,f[x],s)}digest(){let{buffer:t,outputLen:r}=this;this.digestInto(t);let n=t.slice(0,r);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:r,buffer:n,length:o,finished:s,destroyed:i,pos:c}=this;return t.length=o,t.pos=c,t.finished=s,t.destroyed=i,o%r&&t.buffer.set(n),t}};var qe=BigInt(4294967295),Er=BigInt(32);function Zn(e,t=!1){return t?{h:Number(e&qe),l:Number(e>>Er&qe)}:{h:Number(e>>Er&qe)|0,l:Number(e&qe)|0}}function Ys(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let o=0;o<e.length;o++){let{h:s,l:i}=Zn(e[o],t);[r[o],n[o]]=[s,i]}return[r,n]}var Ws=(e,t)=>BigInt(e>>>0)<<Er|BigInt(t>>>0),Xs=(e,t,r)=>e>>>r,$s=(e,t,r)=>e<<32-r|t>>>r,Qs=(e,t,r)=>e>>>r|t<<32-r,Js=(e,t,r)=>e<<32-r|t>>>r,ti=(e,t,r)=>e<<64-r|t>>>r-32,ei=(e,t,r)=>e>>>r-32|t<<64-r,ri=(e,t)=>t,ni=(e,t)=>e,oi=(e,t,r)=>e<<r|t>>>32-r,si=(e,t,r)=>t<<r|e>>>32-r,ii=(e,t,r)=>t<<r-32|e>>>64-r,ci=(e,t,r)=>e<<r-32|t>>>64-r;function ai(e,t,r,n){let o=(t>>>0)+(n>>>0);return{h:e+r+(o/2**32|0)|0,l:o|0}}var fi=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),ui=(e,t,r,n)=>t+r+n+(e/2**32|0)|0,hi=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),di=(e,t,r,n,o)=>t+r+n+o+(e/2**32|0)|0,li=(e,t,r,n,o)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(o>>>0),pi=(e,t,r,n,o,s)=>t+r+n+o+s+(e/2**32|0)|0;var mi={fromBig:Zn,split:Ys,toBig:Ws,shrSH:Xs,shrSL:$s,rotrSH:Qs,rotrSL:Js,rotrBH:ti,rotrBL:ei,rotr32H:ri,rotr32L:ni,rotlSH:oi,rotlSL:si,rotlBH:ii,rotlBL:ci,add:ai,add3L:fi,add3H:ui,add4L:hi,add4H:di,add5H:pi,add5L:li},O=mi;var[xi,yi]=O.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(e=>BigInt(e))),Lt=new Uint32Array(80),Ut=new Uint32Array(80),Br=class extends ce{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:r,Bh:n,Bl:o,Ch:s,Cl:i,Dh:c,Dl:a,Eh:l,El:f,Fh:x,Fl:p,Gh:B,Gl:w,Hh:y,Hl:u}=this;return[t,r,n,o,s,i,c,a,l,f,x,p,B,w,y,u]}set(t,r,n,o,s,i,c,a,l,f,x,p,B,w,y,u){this.Ah=t|0,this.Al=r|0,this.Bh=n|0,this.Bl=o|0,this.Ch=s|0,this.Cl=i|0,this.Dh=c|0,this.Dl=a|0,this.Eh=l|0,this.El=f|0,this.Fh=x|0,this.Fl=p|0,this.Gh=B|0,this.Gl=w|0,this.Hh=y|0,this.Hl=u|0}process(t,r){for(let d=0;d<16;d++,r+=4)Lt[d]=t.getUint32(r),Ut[d]=t.getUint32(r+=4);for(let d=16;d<80;d++){let A=Lt[d-15]|0,C=Ut[d-15]|0,U=O.rotrSH(A,C,1)^O.rotrSH(A,C,8)^O.shrSH(A,C,7),I=O.rotrSL(A,C,1)^O.rotrSL(A,C,8)^O.shrSL(A,C,7),L=Lt[d-2]|0,T=Ut[d-2]|0,z=O.rotrSH(L,T,19)^O.rotrBH(L,T,61)^O.shrSH(L,T,6),M=O.rotrSL(L,T,19)^O.rotrBL(L,T,61)^O.shrSL(L,T,6),K=O.add4L(I,M,Ut[d-7],Ut[d-16]),Y=O.add4H(K,U,z,Lt[d-7],Lt[d-16]);Lt[d]=Y|0,Ut[d]=K|0}let{Ah:n,Al:o,Bh:s,Bl:i,Ch:c,Cl:a,Dh:l,Dl:f,Eh:x,El:p,Fh:B,Fl:w,Gh:y,Gl:u,Hh:b,Hl:S}=this;for(let d=0;d<80;d++){let A=O.rotrSH(x,p,14)^O.rotrSH(x,p,18)^O.rotrBH(x,p,41),C=O.rotrSL(x,p,14)^O.rotrSL(x,p,18)^O.rotrBL(x,p,41),U=x&B^~x&y,I=p&w^~p&u,L=O.add5L(S,C,I,yi[d],Ut[d]),T=O.add5H(L,b,A,U,xi[d],Lt[d]),z=L|0,M=O.rotrSH(n,o,28)^O.rotrBH(n,o,34)^O.rotrBH(n,o,39),K=O.rotrSL(n,o,28)^O.rotrBL(n,o,34)^O.rotrBL(n,o,39),Y=n&s^n&c^s&c,E=o&i^o&a^i&a;b=y|0,S=u|0,y=B|0,u=w|0,B=x|0,w=p|0,{h:x,l:p}=O.add(l|0,f|0,T|0,z|0),l=c|0,f=a|0,c=s|0,a=i|0,s=n|0,i=o|0;let R=O.add3L(z,K,E);n=O.add3H(R,T,M,Y),o=R|0}({h:n,l:o}=O.add(this.Ah|0,this.Al|0,n|0,o|0)),{h:s,l:i}=O.add(this.Bh|0,this.Bl|0,s|0,i|0),{h:c,l:a}=O.add(this.Ch|0,this.Cl|0,c|0,a|0),{h:l,l:f}=O.add(this.Dh|0,this.Dl|0,l|0,f|0),{h:x,l:p}=O.add(this.Eh|0,this.El|0,x|0,p|0),{h:B,l:w}=O.add(this.Fh|0,this.Fl|0,B|0,w|0),{h:y,l:u}=O.add(this.Gh|0,this.Gl|0,y|0,u|0),{h:b,l:S}=O.add(this.Hh|0,this.Hl|0,b|0,S|0),this.set(n,o,s,i,c,a,l,f,x,p,B,w,y,u,b,S)}roundClean(){Lt.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 Gn=He(()=>new Br);var ze={};it(ze,{aInRange:()=>ct,abool:()=>lt,abytes:()=>ae,bitGet:()=>Si,bitLen:()=>Ir,bitMask:()=>ge,bitSet:()=>vi,bytesToHex:()=>Bt,bytesToNumberBE:()=>St,bytesToNumberLE:()=>Nt,concatBytes:()=>vt,createHmacDrbg:()=>Tr,ensureBytes:()=>G,equalBytes:()=>Ei,hexToBytes:()=>zt,hexToNumber:()=>Ar,inRange:()=>ye,isBytes:()=>Ct,memoized:()=>Zt,notImplemented:()=>Ii,numberToBytesBE:()=>_t,numberToBytesLE:()=>Ft,numberToHexUnpadded:()=>Vt,numberToVarBytesBE:()=>wi,utf8ToBytes:()=>Bi,validateObject:()=>yt});var ke=BigInt(0),Ve=BigInt(1),gi=BigInt(2);function Ct(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function ae(e){if(!Ct(e))throw new Error("Uint8Array expected")}function lt(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}var bi=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Bt(e){ae(e);let t="";for(let r=0;r<e.length;r++)t+=bi[e[r]];return t}function Vt(e){let t=e.toString(16);return t.length&1?"0"+t:t}function Ar(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?ke:BigInt("0x"+e)}var Et={_0:48,_9:57,A:65,F:70,a:97,f:102};function jn(e){if(e>=Et._0&&e<=Et._9)return e-Et._0;if(e>=Et.A&&e<=Et.F)return e-(Et.A-10);if(e>=Et.a&&e<=Et.f)return e-(Et.a-10)}function zt(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);let t=e.length,r=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(r);for(let o=0,s=0;o<r;o++,s+=2){let i=jn(e.charCodeAt(s)),c=jn(e.charCodeAt(s+1));if(i===void 0||c===void 0){let a=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+a+'" at index '+s)}n[o]=i*16+c}return n}function St(e){return Ar(Bt(e))}function Nt(e){return ae(e),Ar(Bt(Uint8Array.from(e).reverse()))}function _t(e,t){return zt(e.toString(16).padStart(t*2,"0"))}function Ft(e,t){return _t(e,t).reverse()}function wi(e){return zt(Vt(e))}function G(e,t,r){let n;if(typeof t=="string")try{n=zt(t)}catch(s){throw new Error(e+" must be hex string or Uint8Array, cause: "+s)}else if(Ct(t))n=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");let o=n.length;if(typeof r=="number"&&o!==r)throw new Error(e+" of length "+r+" expected, got "+o);return n}function vt(...e){let t=0;for(let n=0;n<e.length;n++){let o=e[n];ae(o),t+=o.length}let r=new Uint8Array(t);for(let n=0,o=0;n<e.length;n++){let s=e[n];r.set(s,o),o+=s.length}return r}function Ei(e,t){if(e.length!==t.length)return!1;let r=0;for(let n=0;n<e.length;n++)r|=e[n]^t[n];return r===0}function Bi(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}var Sr=e=>typeof e=="bigint"&&ke<=e;function ye(e,t,r){return Sr(e)&&Sr(t)&&Sr(r)&&t<=e&&e<r}function ct(e,t,r,n){if(!ye(t,r,n))throw new Error("expected valid "+e+": "+r+" <= n < "+n+", got "+t)}function Ir(e){let t;for(t=0;e>ke;e>>=Ve,t+=1);return t}function Si(e,t){return e>>BigInt(t)&Ve}function vi(e,t,r){return e|(r?Ve:ke)<<BigInt(t)}var ge=e=>(gi<<BigInt(e-1))-Ve,vr=e=>new Uint8Array(e),Yn=e=>Uint8Array.from(e);function Tr(e,t,r){if(typeof e!="number"||e<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 r!="function")throw new Error("hmacFn must be a function");let n=vr(e),o=vr(e),s=0,i=()=>{n.fill(1),o.fill(0),s=0},c=(...x)=>r(o,n,...x),a=(x=vr())=>{o=c(Yn([0]),x),n=c(),x.length!==0&&(o=c(Yn([1]),x),n=c())},l=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let x=0,p=[];for(;x<t;){n=c();let B=n.slice();p.push(B),x+=n.length}return vt(...p)};return(x,p)=>{i(),a(x);let B;for(;!(B=p(l()));)a();return i(),B}}var Ai={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||Ct(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function yt(e,t,r={}){let n=(o,s,i)=>{let c=Ai[s];if(typeof c!="function")throw new Error("invalid validator function");let a=e[o];if(!(i&&a===void 0)&&!c(a,e))throw new Error("param "+String(o)+" is invalid. Expected "+s+", got "+a)};for(let[o,s]of Object.entries(t))n(o,s,!1);for(let[o,s]of Object.entries(r))n(o,s,!0);return e}var Ii=()=>{throw new Error("not implemented")};function Zt(e){let t=new WeakMap;return(r,...n)=>{let o=t.get(r);if(o!==void 0)return o;let s=e(r,...n);return t.set(r,s),s}}var W=BigInt(0),F=BigInt(1),Gt=BigInt(2),Ti=BigInt(3),Rr=BigInt(4),Wn=BigInt(5),Xn=BigInt(8),Ri=BigInt(9),Li=BigInt(16);function k(e,t){let r=e%t;return r>=W?r:t+r}function Ui(e,t,r){if(t<W)throw new Error("invalid exponent, negatives unsupported");if(r<=W)throw new Error("invalid modulus");if(r===F)return W;let n=F;for(;t>W;)t&F&&(n=n*e%r),e=e*e%r,t>>=F;return n}function Z(e,t,r){let n=e;for(;t-- >W;)n*=n,n%=r;return n}function Fe(e,t){if(e===W)throw new Error("invert: expected non-zero number");if(t<=W)throw new Error("invert: expected positive modulus, got "+t);let r=k(e,t),n=t,o=W,s=F,i=F,c=W;for(;r!==W;){let l=n/r,f=n%r,x=o-i*l,p=s-c*l;n=r,r=f,o=i,s=c,i=x,c=p}if(n!==F)throw new Error("invert: does not exist");return k(o,t)}function Ci(e){let t=(e-F)/Gt,r,n,o;for(r=e-F,n=0;r%Gt===W;r/=Gt,n++);for(o=Gt;o<e&&Ui(o,t,e)!==e-F;o++)if(o>1e3)throw new Error("Cannot find square root: likely non-prime P");if(n===1){let i=(e+F)/Rr;return function(a,l){let f=a.pow(l,i);if(!a.eql(a.sqr(f),l))throw new Error("Cannot find square root");return f}}let s=(r+F)/Gt;return function(c,a){if(c.pow(a,t)===c.neg(c.ONE))throw new Error("Cannot find square root");let l=n,f=c.pow(c.mul(c.ONE,o),r),x=c.pow(a,s),p=c.pow(a,r);for(;!c.eql(p,c.ONE);){if(c.eql(p,c.ZERO))return c.ZERO;let B=1;for(let y=c.sqr(p);B<l&&!c.eql(y,c.ONE);B++)y=c.sqr(y);let w=c.pow(f,F<<BigInt(l-B-1));f=c.sqr(w),x=c.mul(x,w),p=c.mul(p,f),l=B}return x}}function Ni(e){if(e%Rr===Ti){let t=(e+F)/Rr;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(e%Xn===Wn){let t=(e-Wn)/Xn;return function(n,o){let s=n.mul(o,Gt),i=n.pow(s,t),c=n.mul(o,i),a=n.mul(n.mul(c,Gt),i),l=n.mul(c,n.sub(a,n.ONE));if(!n.eql(n.sqr(l),o))throw new Error("Cannot find square root");return l}}return e%Li,Ci(e)}var $n=(e,t)=>(k(e,t)&F)===F,_i=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Lr(e){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=_i.reduce((n,o)=>(n[o]="function",n),t);return yt(e,r)}function Di(e,t,r){if(r<W)throw new Error("invalid exponent, negatives unsupported");if(r===W)return e.ONE;if(r===F)return t;let n=e.ONE,o=t;for(;r>W;)r&F&&(n=e.mul(n,o)),o=e.sqr(o),r>>=F;return n}function Oi(e,t){let r=new Array(t.length),n=t.reduce((s,i,c)=>e.is0(i)?s:(r[c]=s,e.mul(s,i)),e.ONE),o=e.inv(n);return t.reduceRight((s,i,c)=>e.is0(i)?s:(r[c]=e.mul(s,r[c]),e.mul(s,i)),o),r}function Ur(e,t){let r=t!==void 0?t:e.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function Dt(e,t,r=!1,n={}){if(e<=W)throw new Error("invalid field: expected ORDER > 0, got "+e);let{nBitLength:o,nByteLength:s}=Ur(e,t);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let i,c=Object.freeze({ORDER:e,isLE:r,BITS:o,BYTES:s,MASK:ge(o),ZERO:W,ONE:F,create:a=>k(a,e),isValid:a=>{if(typeof a!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof a);return W<=a&&a<e},is0:a=>a===W,isOdd:a=>(a&F)===F,neg:a=>k(-a,e),eql:(a,l)=>a===l,sqr:a=>k(a*a,e),add:(a,l)=>k(a+l,e),sub:(a,l)=>k(a-l,e),mul:(a,l)=>k(a*l,e),pow:(a,l)=>Di(c,a,l),div:(a,l)=>k(a*Fe(l,e),e),sqrN:a=>a*a,addN:(a,l)=>a+l,subN:(a,l)=>a-l,mulN:(a,l)=>a*l,inv:a=>Fe(a,e),sqrt:n.sqrt||(a=>(i||(i=Ni(e)),i(c,a))),invertBatch:a=>Oi(c,a),cmov:(a,l,f)=>f?l:a,toBytes:a=>r?Ft(a,s):_t(a,s),fromBytes:a=>{if(a.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+a.length);return r?Nt(a):St(a)}});return Object.freeze(c)}function Qn(e){if(typeof e!="bigint")throw new Error("field order must be bigint");let t=e.toString(2).length;return Math.ceil(t/8)}function Cr(e){let t=Qn(e);return t+Math.ceil(t/2)}function Jn(e,t,r=!1){let n=e.length,o=Qn(t),s=Cr(t);if(n<16||n<s||n>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+n);let i=r?Nt(e):St(e),c=k(i,t-F)+F;return r?Ft(c,o):_t(c,o)}var to=BigInt(0),Ze=BigInt(1);function Nr(e,t){let r=t.negate();return e?r:t}function eo(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function _r(e,t){eo(e,t);let r=Math.ceil(t/e)+1,n=2**(e-1);return{windows:r,windowSize:n}}function Pi(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((r,n)=>{if(!(r instanceof t))throw new Error("invalid point at index "+n)})}function Ki(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((r,n)=>{if(!t.isValid(r))throw new Error("invalid scalar at index "+n)})}var Dr=new WeakMap,ro=new WeakMap;function Or(e){return ro.get(e)||1}function Ge(e,t){return{constTimeNegate:Nr,hasPrecomputes(r){return Or(r)!==1},unsafeLadder(r,n,o=e.ZERO){let s=r;for(;n>to;)n&Ze&&(o=o.add(s)),s=s.double(),n>>=Ze;return o},precomputeWindow(r,n){let{windows:o,windowSize:s}=_r(n,t),i=[],c=r,a=c;for(let l=0;l<o;l++){a=c,i.push(a);for(let f=1;f<s;f++)a=a.add(c),i.push(a);c=a.double()}return i},wNAF(r,n,o){let{windows:s,windowSize:i}=_r(r,t),c=e.ZERO,a=e.BASE,l=BigInt(2**r-1),f=2**r,x=BigInt(r);for(let p=0;p<s;p++){let B=p*i,w=Number(o&l);o>>=x,w>i&&(w-=f,o+=Ze);let y=B,u=B+Math.abs(w)-1,b=p%2!==0,S=w<0;w===0?a=a.add(Nr(b,n[y])):c=c.add(Nr(S,n[u]))}return{p:c,f:a}},wNAFUnsafe(r,n,o,s=e.ZERO){let{windows:i,windowSize:c}=_r(r,t),a=BigInt(2**r-1),l=2**r,f=BigInt(r);for(let x=0;x<i;x++){let p=x*c;if(o===to)break;let B=Number(o&a);if(o>>=f,B>c&&(B-=l,o+=Ze),B===0)continue;let w=n[p+Math.abs(B)-1];B<0&&(w=w.negate()),s=s.add(w)}return s},getPrecomputes(r,n,o){let s=Dr.get(n);return s||(s=this.precomputeWindow(n,r),r!==1&&Dr.set(n,o(s))),s},wNAFCached(r,n,o){let s=Or(r);return this.wNAF(s,this.getPrecomputes(s,r,o),n)},wNAFCachedUnsafe(r,n,o,s){let i=Or(r);return i===1?this.unsafeLadder(r,n,s):this.wNAFUnsafe(i,this.getPrecomputes(i,r,o),n,s)},setWindowSize(r,n){eo(n,t),ro.set(r,n),Dr.delete(r)}}}function je(e,t,r,n){if(Pi(r,e),Ki(n,t),r.length!==n.length)throw new Error("arrays of points and scalars must have equal length");let o=e.ZERO,s=Ir(BigInt(r.length)),i=s>12?s-3:s>4?s-2:s?2:1,c=(1<<i)-1,a=new Array(c+1).fill(o),l=Math.floor((t.BITS-1)/i)*i,f=o;for(let x=l;x>=0;x-=i){a.fill(o);for(let B=0;B<n.length;B++){let w=n[B],y=Number(w>>BigInt(x)&BigInt(c));a[y]=a[y].add(r[B])}let p=o;for(let B=a.length-1,w=o;B>0;B--)w=w.add(a[B]),p=p.add(w);if(f=f.add(p),x!==0)for(let B=0;B<i;B++)f=f.double()}return f}function be(e){return Lr(e.Fp),yt(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Ur(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}var pt=BigInt(0),at=BigInt(1),Ye=BigInt(2),Hi=BigInt(8),Mi={zip215:!0};function qi(e){let t=be(e);return yt(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}function no(e){let t=qi(e),{Fp:r,n,prehash:o,hash:s,randomBytes:i,nByteLength:c,h:a}=t,l=Ye<<BigInt(c*8)-at,f=r.create,x=Dt(t.n,t.nBitLength),p=t.uvRatio||((m,h)=>{try{return{isValid:!0,value:r.sqrt(m*r.inv(h))}}catch{return{isValid:!1,value:pt}}}),B=t.adjustScalarBytes||(m=>m),w=t.domain||((m,h,g)=>{if(lt("phflag",g),h.length||g)throw new Error("Contexts/pre-hash are not supported");return m});function y(m,h){ct("coordinate "+m,h,pt,l)}function u(m){if(!(m instanceof d))throw new Error("ExtendedPoint expected")}let b=Zt((m,h)=>{let{ex:g,ey:v,ez:N}=m,_=m.is0();h==null&&(h=_?Hi:r.inv(N));let P=f(g*h),H=f(v*h),D=f(N*h);if(_)return{x:pt,y:at};if(D!==at)throw new Error("invZ was invalid");return{x:P,y:H}}),S=Zt(m=>{let{a:h,d:g}=t;if(m.is0())throw new Error("bad point: ZERO");let{ex:v,ey:N,ez:_,et:P}=m,H=f(v*v),D=f(N*N),q=f(_*_),V=f(q*q),X=f(H*h),$=f(q*f(X+D)),tt=f(V+f(g*f(H*D)));if($!==tt)throw new Error("bad point: equation left != right (1)");let et=f(v*N),st=f(_*P);if(et!==st)throw new Error("bad point: equation left != right (2)");return!0});class d{constructor(h,g,v,N){this.ex=h,this.ey=g,this.ez=v,this.et=N,y("x",h),y("y",g),y("z",v),y("t",N),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(h){if(h instanceof d)throw new Error("extended point not allowed");let{x:g,y:v}=h||{};return y("x",g),y("y",v),new d(g,v,at,f(g*v))}static normalizeZ(h){let g=r.invertBatch(h.map(v=>v.ez));return h.map((v,N)=>v.toAffine(g[N])).map(d.fromAffine)}static msm(h,g){return je(d,x,h,g)}_setWindowSize(h){U.setWindowSize(this,h)}assertValidity(){S(this)}equals(h){u(h);let{ex:g,ey:v,ez:N}=this,{ex:_,ey:P,ez:H}=h,D=f(g*H),q=f(_*N),V=f(v*H),X=f(P*N);return D===q&&V===X}is0(){return this.equals(d.ZERO)}negate(){return new d(f(-this.ex),this.ey,this.ez,f(-this.et))}double(){let{a:h}=t,{ex:g,ey:v,ez:N}=this,_=f(g*g),P=f(v*v),H=f(Ye*f(N*N)),D=f(h*_),q=g+v,V=f(f(q*q)-_-P),X=D+P,$=X-H,tt=D-P,et=f(V*$),st=f(X*tt),nt=f(V*tt),xt=f($*X);return new d(et,st,xt,nt)}add(h){u(h);let{a:g,d:v}=t,{ex:N,ey:_,ez:P,et:H}=this,{ex:D,ey:q,ez:V,et:X}=h;if(g===BigInt(-1)){let yn=f((_-N)*(q+D)),gn=f((_+N)*(q-D)),cr=f(gn-yn);if(cr===pt)return this.double();let bn=f(P*Ye*X),wn=f(H*Ye*V),En=wn+bn,Bn=gn+yn,Sn=wn-bn,$o=f(En*cr),Qo=f(Bn*Sn),Jo=f(En*Sn),ts=f(cr*Bn);return new d($o,Qo,ts,Jo)}let $=f(N*D),tt=f(_*q),et=f(H*v*X),st=f(P*V),nt=f((N+_)*(D+q)-$-tt),xt=st-et,gt=st+et,ue=f(tt-g*$),jo=f(nt*xt),Yo=f(gt*ue),Wo=f(nt*ue),Xo=f(xt*gt);return new d(jo,Yo,Xo,Wo)}subtract(h){return this.add(h.negate())}wNAF(h){return U.wNAFCached(this,h,d.normalizeZ)}multiply(h){let g=h;ct("scalar",g,at,n);let{p:v,f:N}=this.wNAF(g);return d.normalizeZ([v,N])[0]}multiplyUnsafe(h,g=d.ZERO){let v=h;return ct("scalar",v,pt,n),v===pt?C:this.is0()||v===at?this:U.wNAFCachedUnsafe(this,v,d.normalizeZ,g)}isSmallOrder(){return this.multiplyUnsafe(a).is0()}isTorsionFree(){return U.unsafeLadder(this,n).is0()}toAffine(h){return b(this,h)}clearCofactor(){let{h}=t;return h===at?this:this.multiplyUnsafe(h)}static fromHex(h,g=!1){let{d:v,a:N}=t,_=r.BYTES;h=G("pointHex",h,_),lt("zip215",g);let P=h.slice(),H=h[_-1];P[_-1]=H&-129;let D=Nt(P),q=g?l:r.ORDER;ct("pointHex.y",D,pt,q);let V=f(D*D),X=f(V-at),$=f(v*V-N),{isValid:tt,value:et}=p(X,$);if(!tt)throw new Error("Point.fromHex: invalid y coordinate");let st=(et&at)===at,nt=(H&128)!==0;if(!g&&et===pt&&nt)throw new Error("Point.fromHex: x=0 and x_0=1");return nt!==st&&(et=f(-et)),d.fromAffine({x:et,y:D})}static fromPrivateKey(h){return T(h).point}toRawBytes(){let{x:h,y:g}=this.toAffine(),v=Ft(g,r.BYTES);return v[v.length-1]|=h&at?128:0,v}toHex(){return Bt(this.toRawBytes())}}d.BASE=new d(t.Gx,t.Gy,at,f(t.Gx*t.Gy)),d.ZERO=new d(pt,at,at,pt);let{BASE:A,ZERO:C}=d,U=Ge(d,c*8);function I(m){return k(m,n)}function L(m){return I(Nt(m))}function T(m){let h=r.BYTES;m=G("private key",m,h);let g=G("hashed private key",s(m),2*h),v=B(g.slice(0,h)),N=g.slice(h,2*h),_=L(v),P=A.multiply(_),H=P.toRawBytes();return{head:v,prefix:N,scalar:_,point:P,pointBytes:H}}function z(m){return T(m).pointBytes}function M(m=new Uint8Array,...h){let g=vt(...h);return L(s(w(g,G("context",m),!!o)))}function K(m,h,g={}){m=G("message",m),o&&(m=o(m));let{prefix:v,scalar:N,pointBytes:_}=T(h),P=M(g.context,v,m),H=A.multiply(P).toRawBytes(),D=M(g.context,H,_,m),q=I(P+D*N);ct("signature.s",q,pt,n);let V=vt(H,Ft(q,r.BYTES));return G("result",V,r.BYTES*2)}let Y=Mi;function E(m,h,g,v=Y){let{context:N,zip215:_}=v,P=r.BYTES;m=G("signature",m,2*P),h=G("message",h),g=G("publicKey",g,P),_!==void 0&&lt("zip215",_),o&&(h=o(h));let H=Nt(m.slice(P,2*P)),D,q,V;try{D=d.fromHex(g,_),q=d.fromHex(m.slice(0,P),_),V=A.multiplyUnsafe(H)}catch{return!1}if(!_&&D.isSmallOrder())return!1;let X=M(N,q.toRawBytes(),D.toRawBytes(),h);return q.add(D.multiplyUnsafe(X)).subtract(V).clearCofactor().equals(d.ZERO)}return A._setWindowSize(8),{CURVE:t,getPublicKey:z,sign:K,verify:E,ExtendedPoint:d,utils:{getExtendedPublicKey:T,randomPrivateKey:()=>i(r.BYTES),precompute(m=8,h=d.BASE){return h._setWindowSize(m),h.multiply(BigInt(3)),h}}}}var Pr=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),oo=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),qa=BigInt(0),ki=BigInt(1),so=BigInt(2),ka=BigInt(3),Vi=BigInt(5),zi=BigInt(8);function Fi(e){let t=BigInt(10),r=BigInt(20),n=BigInt(40),o=BigInt(80),s=Pr,c=e*e%s*e%s,a=Z(c,so,s)*c%s,l=Z(a,ki,s)*e%s,f=Z(l,Vi,s)*l%s,x=Z(f,t,s)*f%s,p=Z(x,r,s)*x%s,B=Z(p,n,s)*p%s,w=Z(B,o,s)*B%s,y=Z(w,o,s)*B%s,u=Z(y,t,s)*f%s;return{pow_p_5_8:Z(u,so,s)*e%s,b2:c}}function Zi(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}function Gi(e,t){let r=Pr,n=k(t*t*t,r),o=k(n*n*t,r),s=Fi(e*o).pow_p_5_8,i=k(e*n*s,r),c=k(t*i*i,r),a=i,l=k(i*oo,r),f=c===e,x=c===k(-e,r),p=c===k(-e*oo,r);return f&&(i=a),(x||p)&&(i=l),$n(i,r)&&(i=k(-i,r)),{isValid:f||x,value:i}}var ji=Dt(Pr,void 0,!0),Yi={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:ji,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:zi,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Gn,randomBytes:Me,adjustScalarBytes:Zi,uvRatio:Gi},io=no(Yi);var We=32;function co(e,t,r){return io.verify(t,r instanceof Uint8Array?r:r.subarray(),e)}var Xe=class{type="Ed25519";raw;constructor(t){this.raw=Kr(t,We)}toMultihash(){return wt.digest($e(this))}toCID(){return ht.createV1(114,this.toMultihash())}toString(){return Q.encode(this.toMultihash().bytes).substring(1)}equals(t){return t==null||!(t.raw instanceof Uint8Array)?!1:qt(this.raw,t.raw)}verify(t,r){return co(this.raw,r,t)}};function fo(e){return e=Kr(e,We),new Xe(e)}function Kr(e,t){if(e=Uint8Array.from(e??[]),e.length!==t)throw new Xt(`Key must be a Uint8Array of length ${t}, got ${e.length}`);return e}function At(e=0){return new Uint8Array(e)}var Xi=Math.pow(2,7),$i=Math.pow(2,14),Qi=Math.pow(2,21),uo=Math.pow(2,28),ho=Math.pow(2,35),lo=Math.pow(2,42),po=Math.pow(2,49),ot=128,Ot=127;function we(e){if(e<Xi)return 1;if(e<$i)return 2;if(e<Qi)return 3;if(e<uo)return 4;if(e<ho)return 5;if(e<lo)return 6;if(e<po)return 7;if(Number.MAX_SAFE_INTEGER!=null&&e>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function mo(e,t,r=0){switch(we(e)){case 8:t[r++]=e&255|ot,e/=128;case 7:t[r++]=e&255|ot,e/=128;case 6:t[r++]=e&255|ot,e/=128;case 5:t[r++]=e&255|ot,e/=128;case 4:t[r++]=e&255|ot,e>>>=7;case 3:t[r++]=e&255|ot,e>>>=7;case 2:t[r++]=e&255|ot,e>>>=7;case 1:{t[r++]=e&255,e>>>=7;break}default:throw new Error("unreachable")}return t}function xo(e,t){let r=e[t],n=0;if(n+=r&Ot,r<ot||(r=e[t+1],n+=(r&Ot)<<7,r<ot)||(r=e[t+2],n+=(r&Ot)<<14,r<ot)||(r=e[t+3],n+=(r&Ot)<<21,r<ot)||(r=e[t+4],n+=(r&Ot)*uo,r<ot)||(r=e[t+5],n+=(r&Ot)*ho,r<ot)||(r=e[t+6],n+=(r&Ot)*lo,r<ot)||(r=e[t+7],n+=(r&Ot)*po,r<ot))return n;throw new RangeError("Could not decode varint")}var Hr=new Float32Array([-0]),Pt=new Uint8Array(Hr.buffer);function yo(e,t,r){Hr[0]=e,t[r]=Pt[0],t[r+1]=Pt[1],t[r+2]=Pt[2],t[r+3]=Pt[3]}function go(e,t){return Pt[0]=e[t],Pt[1]=e[t+1],Pt[2]=e[t+2],Pt[3]=e[t+3],Hr[0]}var Mr=new Float64Array([-0]),rt=new Uint8Array(Mr.buffer);function bo(e,t,r){Mr[0]=e,t[r]=rt[0],t[r+1]=rt[1],t[r+2]=rt[2],t[r+3]=rt[3],t[r+4]=rt[4],t[r+5]=rt[5],t[r+6]=rt[6],t[r+7]=rt[7]}function wo(e,t){return rt[0]=e[t],rt[1]=e[t+1],rt[2]=e[t+2],rt[3]=e[t+3],rt[4]=e[t+4],rt[5]=e[t+5],rt[6]=e[t+6],rt[7]=e[t+7],Mr[0]}var Ji=BigInt(Number.MAX_SAFE_INTEGER),tc=BigInt(Number.MIN_SAFE_INTEGER),ft=class e{lo;hi;constructor(t,r){this.lo=t|0,this.hi=r|0}toNumber(t=!1){if(!t&&this.hi>>>31>0){let r=~this.lo+1>>>0,n=~this.hi>>>0;return r===0&&(n=n+1>>>0),-(r+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 r=~this.lo+1>>>0,n=~this.hi>>>0;return r===0&&(n=n+1>>>0),-(BigInt(r)+(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,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?t<16384?t<128?1:2:t<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}static fromBigInt(t){if(t===0n)return jt;if(t<Ji&&t>tc)return this.fromNumber(Number(t));let r=t<0n;r&&(t=-t);let n=t>>32n,o=t-(n<<32n);return r&&(n=~n|0n,o=~o|0n,++o>Eo&&(o=0n,++n>Eo&&(n=0n))),new e(Number(o),Number(n))}static fromNumber(t){if(t===0)return jt;let r=t<0;r&&(t=-t);let n=t>>>0,o=(t-n)/4294967296>>>0;return r&&(o=~o>>>0,n=~n>>>0,++n>4294967295&&(n=0,++o>4294967295&&(o=0))),new e(n,o)}static from(t){return typeof t=="number"?e.fromNumber(t):typeof t=="bigint"?e.fromBigInt(t):typeof t=="string"?e.fromBigInt(BigInt(t)):t.low!=null||t.high!=null?new e(t.low>>>0,t.high>>>0):jt}},jt=new ft(0,0);jt.toBigInt=function(){return 0n};jt.zzEncode=jt.zzDecode=function(){return this};jt.length=function(){return 1};var Eo=4294967296n;function Bo(e){let t=0,r=0;for(let n=0;n<e.length;++n)r=e.charCodeAt(n),r<128?t+=1:r<2048?t+=2:(r&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320?(++n,t+=4):t+=3;return t}function So(e,t,r){if(r-t<1)return"";let o,s=[],i=0,c;for(;t<r;)c=e[t++],c<128?s[i++]=c:c>191&&c<224?s[i++]=(c&31)<<6|e[t++]&63:c>239&&c<365?(c=((c&7)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63)-65536,s[i++]=55296+(c>>10),s[i++]=56320+(c&1023)):s[i++]=(c&15)<<12|(e[t++]&63)<<6|e[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 qr(e,t,r){let n=r,o,s;for(let i=0;i<e.length;++i)o=e.charCodeAt(i),o<128?t[r++]=o:o<2048?(t[r++]=o>>6|192,t[r++]=o&63|128):(o&64512)===55296&&((s=e.charCodeAt(i+1))&64512)===56320?(o=65536+((o&1023)<<10)+(s&1023),++i,t[r++]=o>>18|240,t[r++]=o>>12&63|128,t[r++]=o>>6&63|128,t[r++]=o&63|128):(t[r++]=o>>12|224,t[r++]=o>>6&63|128,t[r++]=o&63|128);return r-n}function mt(e,t){return RangeError(`index out of range: ${e.pos} + ${t??1} > ${e.len}`)}function Qe(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}var kr=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,mt(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 mt(this,4);return Qe(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw mt(this,4);return Qe(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw mt(this,4);let t=go(this.buf,this.pos);return this.pos+=4,t}double(){if(this.pos+8>this.len)throw mt(this,4);let t=wo(this.buf,this.pos);return this.pos+=8,t}bytes(){let t=this.uint32(),r=this.pos,n=this.pos+t;if(n>this.len)throw mt(this,t);return this.pos+=t,r===n?new Uint8Array(0):this.buf.subarray(r,n)}string(){let t=this.bytes();return So(t,0,t.length)}skip(t){if(typeof t=="number"){if(this.pos+t>this.len)throw mt(this,t);this.pos+=t}else do if(this.pos>=this.len)throw mt(this);while((this.buf[this.pos++]&128)!==0);return this}skipType(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${t} at offset ${this.pos}`)}return this}readLongVarint(){let t=new ft(0,0),r=0;if(this.len-this.pos>4){for(;r<4;++r)if(t.lo=(t.lo|(this.buf[this.pos]&127)<<r*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;r=0}else{for(;r<3;++r){if(this.pos>=this.len)throw mt(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<<r*7)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<<r*7)>>>0,t}if(this.len-this.pos>4){for(;r<5;++r)if(t.hi=(t.hi|(this.buf[this.pos]&127)<<r*7+3)>>>0,this.buf[this.pos++]<128)return t}else for(;r<5;++r){if(this.pos>=this.len)throw mt(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<<r*7+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw mt(this,8);let t=Qe(this.buf,this.pos+=4),r=Qe(this.buf,this.pos+=4);return new ft(t,r)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){let t=xo(this.buf,this.pos);return this.pos+=we(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 Vr(e){return new kr(e instanceof Uint8Array?e:e.subarray())}function Je(e,t,r){let n=Vr(e);return t.decode(n,void 0,r)}var zr={};it(zr,{base10:()=>ec});var ec=Rt({prefix:"9",name:"base10",alphabet:"0123456789"});var Fr={};it(Fr,{base16:()=>rc,base16upper:()=>nc});var rc=j({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),nc=j({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Zr={};it(Zr,{base2:()=>oc});var oc=j({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Gr={};it(Gr,{base256emoji:()=>fc});var Ao=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}"),sc=Ao.reduce((e,t,r)=>(e[r]=t,e),[]),ic=Ao.reduce((e,t,r)=>{let n=t.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${t}`);return e[n]=r,e},[]);function cc(e){return e.reduce((t,r)=>(t+=sc[r],t),"")}function ac(e){let t=[];for(let r of e){let n=r.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${r}`);let o=ic[n];if(o==null)throw new Error(`Non-base256emoji character: ${r}`);t.push(o)}return new Uint8Array(t)}var fc=Qt({prefix:"\u{1F680}",name:"base256emoji",encode:cc,decode:ac});var jr={};it(jr,{base64:()=>uc,base64pad:()=>hc,base64url:()=>dc,base64urlpad:()=>lc});var uc=j({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),hc=j({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),dc=j({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),lc=j({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Yr={};it(Yr,{base8:()=>pc});var pc=j({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Wr={};it(Wr,{identity:()=>mc});var mc=Qt({prefix:"\0",name:"identity",encode:e=>In(e),decode:e=>An(e)});var Af=new TextEncoder,If=new TextDecoder;var Qr={};it(Qr,{sha256:()=>Ee,sha512:()=>gc});function $r({name:e,code:t,encode:r}){return new Xr(e,t,r)}var Xr=class{name;code;encode;constructor(t,r,n){this.name=t,this.code=r,this.encode=n}digest(t){if(t instanceof Uint8Array){let r=this.encode(t);return r instanceof Uint8Array?Mt(this.code,r):r.then(n=>Mt(this.code,n))}else throw Error("Unknown type, must be binary type")}};function To(e){return async t=>new Uint8Array(await crypto.subtle.digest(e,t))}var Ee=$r({name:"sha2-256",code:18,encode:To("SHA-256")}),gc=$r({name:"sha2-512",code:19,encode:To("SHA-512")});var Jr={...Wr,...Zr,...Yr,...zr,...Fr,...mr,...xr,...pr,...jr,...Gr},Hf={...Qr,...br};function Lo(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}var Ro=Lo("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),tn=Lo("ascii","a",e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},e=>{e=e.substring(1);let t=At(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),bc={utf8:Ro,"utf-8":Ro,hex:Jr.base16,latin1:tn,ascii:tn,binary:tn,...Jr},tr=bc;function Be(e,t="utf8"){let r=tr[t];if(r==null)throw new Error(`Unsupported encoding "${t}"`);return r.decoder.decode(`${r.prefix}${e}`)}function en(e){let t=e??8192,r=t>>>1,n,o=t;return function(i){if(i<1||i>r)return At(i);o+i>t&&(n=At(t),o=0);let c=n.subarray(o,o+=i);return(o&7)!==0&&(o=(o|7)+1),c}}var Yt=class{fn;len;next;val;constructor(t,r,n){this.fn=t,this.len=r,this.next=void 0,this.val=n}};function rn(){}var on=class{head;tail;len;next;constructor(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}},wc=en();function Ec(e){return globalThis.Buffer!=null?At(e):wc(e)}var ve=class{len;head;tail;states;constructor(){this.len=0,this.head=new Yt(rn,0,0),this.tail=this.head,this.states=null}_push(t,r,n){return this.tail=this.tail.next=new Yt(t,r,n),this.len+=r,this}uint32(t){return this.len+=(this.tail=this.tail.next=new sn((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(er,10,ft.fromNumber(t)):this.uint32(t)}sint32(t){return this.uint32((t<<1^t>>31)>>>0)}uint64(t){let r=ft.fromBigInt(t);return this._push(er,r.length(),r)}uint64Number(t){return this._push(mo,we(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 r=ft.fromBigInt(t).zzEncode();return this._push(er,r.length(),r)}sint64Number(t){let r=ft.fromNumber(t).zzEncode();return this._push(er,r.length(),r)}sint64String(t){return this.sint64(BigInt(t))}bool(t){return this._push(nn,1,t?1:0)}fixed32(t){return this._push(Se,4,t>>>0)}sfixed32(t){return this.fixed32(t)}fixed64(t){let r=ft.fromBigInt(t);return this._push(Se,4,r.lo)._push(Se,4,r.hi)}fixed64Number(t){let r=ft.fromNumber(t);return this._push(Se,4,r.lo)._push(Se,4,r.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(yo,4,t)}double(t){return this._push(bo,8,t)}bytes(t){let r=t.length>>>0;return r===0?this._push(nn,1,0):this.uint32(r)._push(Sc,r,t)}string(t){let r=Bo(t);return r!==0?this.uint32(r)._push(qr,r,t):this._push(nn,1,0)}fork(){return this.states=new on(this),this.head=this.tail=new Yt(rn,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 Yt(rn,0,0),this.len=0),this}ldelim(){let t=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=t.next,this.tail=r,this.len+=n),this}finish(){let t=this.head.next,r=Ec(this.len),n=0;for(;t!=null;)t.fn(t.val,r,n),n+=t.len,t=t.next;return r}};function nn(e,t,r){t[r]=e&255}function Bc(e,t,r){for(;e>127;)t[r++]=e&127|128,e>>>=7;t[r]=e}var sn=class extends Yt{next;constructor(t,r){super(Bc,t,r),this.next=void 0}};function er(e,t,r){for(;e.hi!==0;)t[r++]=e.lo&127|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=e.lo&127|128,e.lo=e.lo>>>7;t[r++]=e.lo}function Se(e,t,r){t[r]=e&255,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function Sc(e,t,r){t.set(e,r)}globalThis.Buffer!=null&&(ve.prototype.bytes=function(e){let t=e.length>>>0;return this.uint32(t),t>0&&this._push(vc,t,e),this},ve.prototype.string=function(e){let t=globalThis.Buffer.byteLength(e);return this.uint32(t),t>0&&this._push(Ac,t,e),this});function vc(e,t,r){t.set(e,r)}function Ac(e,t,r){e.length<40?qr(e,t,r):t.utf8Write!=null?t.utf8Write(e,r):t.set(Be(e),r)}function cn(){return new ve}function rr(e,t){let r=cn();return t.encode(e,r,{lengthDelimited:!1}),r.finish()}var fe;(function(e){e[e.VARINT=0]="VARINT",e[e.BIT64=1]="BIT64",e[e.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",e[e.START_GROUP=3]="START_GROUP",e[e.END_GROUP=4]="END_GROUP",e[e.BIT32=5]="BIT32"})(fe||(fe={}));function nr(e,t,r,n){return{name:e,type:t,encode:r,decode:n}}function an(e){function t(o){if(e[o.toString()]==null)throw new Error("Invalid enum value");return e[o]}let r=function(s,i){let c=t(s);i.int32(c)},n=function(s){let i=s.int32();return t(i)};return nr("enum",fe.VARINT,r,n)}function or(e,t){return nr("message",fe.LENGTH_DELIMITED,e,t)}var ut;(function(e){e.RSA="RSA",e.Ed25519="Ed25519",e.secp256k1="secp256k1"})(ut||(ut={}));var fn;(function(e){e[e.RSA=0]="RSA",e[e.Ed25519=1]="Ed25519",e[e.secp256k1=2]="secp256k1"})(fn||(fn={}));(function(e){e.codec=()=>an(fn)})(ut||(ut={}));var Ae;(function(e){let t;e.codec=()=>(t==null&&(t=or((r,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),r.Type!=null&&(n.uint32(8),ut.codec().encode(r.Type,n)),r.Data!=null&&(n.uint32(18),n.bytes(r.Data)),o.lengthDelimited!==!1&&n.ldelim()},(r,n,o={})=>{let s={},i=n==null?r.len:r.pos+n;for(;r.pos<i;){let c=r.uint32();switch(c>>>3){case 1:{s.Type=ut.codec().decode(r);break}case 2:{s.Data=r.bytes();break}default:{r.skipType(c&7);break}}}return s})),t),e.encode=r=>rr(r,e.codec()),e.decode=(r,n)=>Je(r,e.codec(),n)})(Ae||(Ae={}));var un;(function(e){let t;e.codec=()=>(t==null&&(t=or((r,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),r.Type!=null&&(n.uint32(8),ut.codec().encode(r.Type,n)),r.Data!=null&&(n.uint32(18),n.bytes(r.Data)),o.lengthDelimited!==!1&&n.ldelim()},(r,n,o={})=>{let s={},i=n==null?r.len:r.pos+n;for(;r.pos<i;){let c=r.uint32();switch(c>>>3){case 1:{s.Type=ut.codec().decode(r);break}case 2:{s.Data=r.bytes();break}default:{r.skipType(c&7);break}}}return s})),t),e.encode=r=>rr(r,e.codec()),e.decode=(r,n)=>Je(r,e.codec(),n)})(un||(un={}));var Tc=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Kt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ht=new Uint32Array(64),hn=class extends ce{constructor(){super(64,32,8,!1),this.A=Kt[0]|0,this.B=Kt[1]|0,this.C=Kt[2]|0,this.D=Kt[3]|0,this.E=Kt[4]|0,this.F=Kt[5]|0,this.G=Kt[6]|0,this.H=Kt[7]|0}get(){let{A:t,B:r,C:n,D:o,E:s,F:i,G:c,H:a}=this;return[t,r,n,o,s,i,c,a]}set(t,r,n,o,s,i,c,a){this.A=t|0,this.B=r|0,this.C=n|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=c|0,this.H=a|0}process(t,r){for(let x=0;x<16;x++,r+=4)Ht[x]=t.getUint32(r,!1);for(let x=16;x<64;x++){let p=Ht[x-15],B=Ht[x-2],w=dt(p,7)^dt(p,18)^p>>>3,y=dt(B,17)^dt(B,19)^B>>>10;Ht[x]=y+Ht[x-7]+w+Ht[x-16]|0}let{A:n,B:o,C:s,D:i,E:c,F:a,G:l,H:f}=this;for(let x=0;x<64;x++){let p=dt(c,6)^dt(c,11)^dt(c,25),B=f+p+zn(c,a,l)+Tc[x]+Ht[x]|0,y=(dt(n,2)^dt(n,13)^dt(n,22))+Fn(n,o,s)|0;f=l,l=a,a=c,c=i+B|0,i=s,s=o,o=n,n=B+y|0}n=n+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,c=c+this.E|0,a=a+this.F|0,l=l+this.G|0,f=f+this.H|0,this.set(n,o,s,i,c,a,l,f)}roundClean(){Ht.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var Uo=He(()=>new hn);function Ie(e,t="utf8"){let r=tr[t];if(r==null)throw new Error(`Unsupported encoding "${t}"`);return r.encoder.encode(e).substring(1)}var Te=class extends Error{constructor(t="An error occurred while verifying a message"){super(t),this.name="VerificationError"}};var sr=class extends ie{constructor(t,r){super(),this.finished=!1,this.destroyed=!1,qn(t);let n=xe(r);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 se(this),this.iHash.update(t),this}digestInto(t){se(this),oe(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:r,iHash:n,finished:o,destroyed:s,blockLen:i,outputLen:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=c,t.oHash=r._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},dn=(e,t,r)=>new sr(e,t).update(r).digest();dn.create=(e,t)=>new sr(e,t);function Co(e){e.lowS!==void 0&&lt("lowS",e.lowS),e.prehash!==void 0&&lt("prehash",e.prehash)}function Rc(e){let t=be(e);yt(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:r,Fp:n,a:o}=t;if(r){if(!n.eql(o,n.ZERO))throw new Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if(typeof r!="object"||typeof r.beta!="bigint"||typeof r.splitScalar!="function")throw new Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...t})}var{bytesToNumberBE:Lc,hexToBytes:Uc}=ze,ln=class extends Error{constructor(t=""){super(t)}},It={Err:ln,_tlv:{encode:(e,t)=>{let{Err:r}=It;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length&1)throw new r("tlv.encode: unpadded data");let n=t.length/2,o=Vt(n);if(o.length/2&128)throw new r("tlv.encode: long form length too big");let s=n>127?Vt(o.length/2|128):"";return Vt(e)+s+o+t},decode(e,t){let{Err:r}=It,n=0;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length<2||t[n++]!==e)throw new r("tlv.decode: wrong tlv");let o=t[n++],s=!!(o&128),i=0;if(!s)i=o;else{let a=o&127;if(!a)throw new r("tlv.decode(long): indefinite length not supported");if(a>4)throw new r("tlv.decode(long): byte length is too big");let l=t.subarray(n,n+a);if(l.length!==a)throw new r("tlv.decode: length bytes not complete");if(l[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(let f of l)i=i<<8|f;if(n+=a,i<128)throw new r("tlv.decode(long): not minimal encoding")}let c=t.subarray(n,n+i);if(c.length!==i)throw new r("tlv.decode: wrong value length");return{v:c,l:t.subarray(n+i)}}},_int:{encode(e){let{Err:t}=It;if(e<Tt)throw new t("integer: negative integers are not allowed");let r=Vt(e);if(Number.parseInt(r[0],16)&8&&(r="00"+r),r.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return r},decode(e){let{Err:t}=It;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return Lc(e)}},toSig(e){let{Err:t,_int:r,_tlv:n}=It,o=typeof e=="string"?Uc(e):e;ae(o);let{v:s,l:i}=n.decode(48,o);if(i.length)throw new t("invalid signature: left bytes after parsing");let{v:c,l:a}=n.decode(2,s),{v:l,l:f}=n.decode(2,a);if(f.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(c),s:r.decode(l)}},hexFromSig(e){let{_tlv:t,_int:r}=It,n=t.encode(2,r.encode(e.r)),o=t.encode(2,r.encode(e.s)),s=n+o;return t.encode(48,s)}},Tt=BigInt(0),J=BigInt(1),Tu=BigInt(2),No=BigInt(3),Ru=BigInt(4);function Cc(e){let t=Rc(e),{Fp:r}=t,n=Dt(t.n,t.nBitLength),o=t.toBytes||((y,u,b)=>{let S=u.toAffine();return vt(Uint8Array.from([4]),r.toBytes(S.x),r.toBytes(S.y))}),s=t.fromBytes||(y=>{let u=y.subarray(1),b=r.fromBytes(u.subarray(0,r.BYTES)),S=r.fromBytes(u.subarray(r.BYTES,2*r.BYTES));return{x:b,y:S}});function i(y){let{a:u,b}=t,S=r.sqr(y),d=r.mul(S,y);return r.add(r.add(d,r.mul(y,u)),b)}if(!r.eql(r.sqr(t.Gy),i(t.Gx)))throw new Error("bad generator point: equation left != right");function c(y){return ye(y,J,t.n)}function a(y){let{allowedPrivateKeyLengths:u,nByteLength:b,wrapPrivateKey:S,n:d}=t;if(u&&typeof y!="bigint"){if(Ct(y)&&(y=Bt(y)),typeof y!="string"||!u.includes(y.length))throw new Error("invalid private key");y=y.padStart(b*2,"0")}let A;try{A=typeof y=="bigint"?y:St(G("private key",y,b))}catch{throw new Error("invalid private key, expected hex or "+b+" bytes, got "+typeof y)}return S&&(A=k(A,d)),ct("private key",A,J,d),A}function l(y){if(!(y instanceof p))throw new Error("ProjectivePoint expected")}let f=Zt((y,u)=>{let{px:b,py:S,pz:d}=y;if(r.eql(d,r.ONE))return{x:b,y:S};let A=y.is0();u==null&&(u=A?r.ONE:r.inv(d));let C=r.mul(b,u),U=r.mul(S,u),I=r.mul(d,u);if(A)return{x:r.ZERO,y:r.ZERO};if(!r.eql(I,r.ONE))throw new Error("invZ was invalid");return{x:C,y:U}}),x=Zt(y=>{if(y.is0()){if(t.allowInfinityPoint&&!r.is0(y.py))return;throw new Error("bad point: ZERO")}let{x:u,y:b}=y.toAffine();if(!r.isValid(u)||!r.isValid(b))throw new Error("bad point: x or y not FE");let S=r.sqr(b),d=i(u);if(!r.eql(S,d))throw new Error("bad point: equation left != right");if(!y.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class p{constructor(u,b,S){if(this.px=u,this.py=b,this.pz=S,u==null||!r.isValid(u))throw new Error("x required");if(b==null||!r.isValid(b))throw new Error("y required");if(S==null||!r.isValid(S))throw new Error("z required");Object.freeze(this)}static fromAffine(u){let{x:b,y:S}=u||{};if(!u||!r.isValid(b)||!r.isValid(S))throw new Error("invalid affine point");if(u instanceof p)throw new Error("projective point not allowed");let d=A=>r.eql(A,r.ZERO);return d(b)&&d(S)?p.ZERO:new p(b,S,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(u){let b=r.invertBatch(u.map(S=>S.pz));return u.map((S,d)=>S.toAffine(b[d])).map(p.fromAffine)}static fromHex(u){let b=p.fromAffine(s(G("pointHex",u)));return b.assertValidity(),b}static fromPrivateKey(u){return p.BASE.multiply(a(u))}static msm(u,b){return je(p,n,u,b)}_setWindowSize(u){w.setWindowSize(this,u)}assertValidity(){x(this)}hasEvenY(){let{y:u}=this.toAffine();if(r.isOdd)return!r.isOdd(u);throw new Error("Field doesn't support isOdd")}equals(u){l(u);let{px:b,py:S,pz:d}=this,{px:A,py:C,pz:U}=u,I=r.eql(r.mul(b,U),r.mul(A,d)),L=r.eql(r.mul(S,U),r.mul(C,d));return I&&L}negate(){return new p(this.px,r.neg(this.py),this.pz)}double(){let{a:u,b}=t,S=r.mul(b,No),{px:d,py:A,pz:C}=this,U=r.ZERO,I=r.ZERO,L=r.ZERO,T=r.mul(d,d),z=r.mul(A,A),M=r.mul(C,C),K=r.mul(d,A);return K=r.add(K,K),L=r.mul(d,C),L=r.add(L,L),U=r.mul(u,L),I=r.mul(S,M),I=r.add(U,I),U=r.sub(z,I),I=r.add(z,I),I=r.mul(U,I),U=r.mul(K,U),L=r.mul(S,L),M=r.mul(u,M),K=r.sub(T,M),K=r.mul(u,K),K=r.add(K,L),L=r.add(T,T),T=r.add(L,T),T=r.add(T,M),T=r.mul(T,K),I=r.add(I,T),M=r.mul(A,C),M=r.add(M,M),T=r.mul(M,K),U=r.sub(U,T),L=r.mul(M,z),L=r.add(L,L),L=r.add(L,L),new p(U,I,L)}add(u){l(u);let{px:b,py:S,pz:d}=this,{px:A,py:C,pz:U}=u,I=r.ZERO,L=r.ZERO,T=r.ZERO,z=t.a,M=r.mul(t.b,No),K=r.mul(b,A),Y=r.mul(S,C),E=r.mul(d,U),R=r.add(b,S),m=r.add(A,C);R=r.mul(R,m),m=r.add(K,Y),R=r.sub(R,m),m=r.add(b,d);let h=r.add(A,U);return m=r.mul(m,h),h=r.add(K,E),m=r.sub(m,h),h=r.add(S,d),I=r.add(C,U),h=r.mul(h,I),I=r.add(Y,E),h=r.sub(h,I),T=r.mul(z,m),I=r.mul(M,E),T=r.add(I,T),I=r.sub(Y,T),T=r.add(Y,T),L=r.mul(I,T),Y=r.add(K,K),Y=r.add(Y,K),E=r.mul(z,E),m=r.mul(M,m),Y=r.add(Y,E),E=r.sub(K,E),E=r.mul(z,E),m=r.add(m,E),K=r.mul(Y,m),L=r.add(L,K),K=r.mul(h,m),I=r.mul(R,I),I=r.sub(I,K),K=r.mul(R,Y),T=r.mul(h,T),T=r.add(T,K),new p(I,L,T)}subtract(u){return this.add(u.negate())}is0(){return this.equals(p.ZERO)}wNAF(u){return w.wNAFCached(this,u,p.normalizeZ)}multiplyUnsafe(u){let{endo:b,n:S}=t;ct("scalar",u,Tt,S);let d=p.ZERO;if(u===Tt)return d;if(this.is0()||u===J)return this;if(!b||w.hasPrecomputes(this))return w.wNAFCachedUnsafe(this,u,p.normalizeZ);let{k1neg:A,k1:C,k2neg:U,k2:I}=b.splitScalar(u),L=d,T=d,z=this;for(;C>Tt||I>Tt;)C&J&&(L=L.add(z)),I&J&&(T=T.add(z)),z=z.double(),C>>=J,I>>=J;return A&&(L=L.negate()),U&&(T=T.negate()),T=new p(r.mul(T.px,b.beta),T.py,T.pz),L.add(T)}multiply(u){let{endo:b,n:S}=t;ct("scalar",u,J,S);let d,A;if(b){let{k1neg:C,k1:U,k2neg:I,k2:L}=b.splitScalar(u),{p:T,f:z}=this.wNAF(U),{p:M,f:K}=this.wNAF(L);T=w.constTimeNegate(C,T),M=w.constTimeNegate(I,M),M=new p(r.mul(M.px,b.beta),M.py,M.pz),d=T.add(M),A=z.add(K)}else{let{p:C,f:U}=this.wNAF(u);d=C,A=U}return p.normalizeZ([d,A])[0]}multiplyAndAddUnsafe(u,b,S){let d=p.BASE,A=(U,I)=>I===Tt||I===J||!U.equals(d)?U.multiplyUnsafe(I):U.multiply(I),C=A(this,b).add(A(u,S));return C.is0()?void 0:C}toAffine(u){return f(this,u)}isTorsionFree(){let{h:u,isTorsionFree:b}=t;if(u===J)return!0;if(b)return b(p,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:u,clearCofactor:b}=t;return u===J?this:b?b(p,this):this.multiplyUnsafe(t.h)}toRawBytes(u=!0){return lt("isCompressed",u),this.assertValidity(),o(p,this,u)}toHex(u=!0){return lt("isCompressed",u),Bt(this.toRawBytes(u))}}p.BASE=new p(t.Gx,t.Gy,r.ONE),p.ZERO=new p(r.ZERO,r.ONE,r.ZERO);let B=t.nBitLength,w=Ge(p,t.endo?Math.ceil(B/2):B);return{CURVE:t,ProjectivePoint:p,normPrivateKeyToScalar:a,weierstrassEquation:i,isWithinCurveOrder:c}}function Nc(e){let t=be(e);return yt(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function _o(e){let t=Nc(e),{Fp:r,n}=t,o=r.BYTES+1,s=2*r.BYTES+1;function i(E){return k(E,n)}function c(E){return Fe(E,n)}let{ProjectivePoint:a,normPrivateKeyToScalar:l,weierstrassEquation:f,isWithinCurveOrder:x}=Cc({...t,toBytes(E,R,m){let h=R.toAffine(),g=r.toBytes(h.x),v=vt;return lt("isCompressed",m),m?v(Uint8Array.from([R.hasEvenY()?2:3]),g):v(Uint8Array.from([4]),g,r.toBytes(h.y))},fromBytes(E){let R=E.length,m=E[0],h=E.subarray(1);if(R===o&&(m===2||m===3)){let g=St(h);if(!ye(g,J,r.ORDER))throw new Error("Point is not on curve");let v=f(g),N;try{N=r.sqrt(v)}catch(H){let D=H instanceof Error?": "+H.message:"";throw new Error("Point is not on curve"+D)}let _=(N&J)===J;return(m&1)===1!==_&&(N=r.neg(N)),{x:g,y:N}}else if(R===s&&m===4){let g=r.fromBytes(h.subarray(0,r.BYTES)),v=r.fromBytes(h.subarray(r.BYTES,2*r.BYTES));return{x:g,y:v}}else{let g=o,v=s;throw new Error("invalid Point, expected length of "+g+", or uncompressed "+v+", got "+R)}}}),p=E=>Bt(_t(E,t.nByteLength));function B(E){let R=n>>J;return E>R}function w(E){return B(E)?i(-E):E}let y=(E,R,m)=>St(E.slice(R,m));class u{constructor(R,m,h){this.r=R,this.s=m,this.recovery=h,this.assertValidity()}static fromCompact(R){let m=t.nByteLength;return R=G("compactSignature",R,m*2),new u(y(R,0,m),y(R,m,2*m))}static fromDER(R){let{r:m,s:h}=It.toSig(G("DER",R));return new u(m,h)}assertValidity(){ct("r",this.r,J,n),ct("s",this.s,J,n)}addRecoveryBit(R){return new u(this.r,this.s,R)}recoverPublicKey(R){let{r:m,s:h,recovery:g}=this,v=U(G("msgHash",R));if(g==null||![0,1,2,3].includes(g))throw new Error("recovery id invalid");let N=g===2||g===3?m+t.n:m;if(N>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");let _=(g&1)===0?"02":"03",P=a.fromHex(_+p(N)),H=c(N),D=i(-v*H),q=i(h*H),V=a.BASE.multiplyAndAddUnsafe(P,D,q);if(!V)throw new Error("point at infinify");return V.assertValidity(),V}hasHighS(){return B(this.s)}normalizeS(){return this.hasHighS()?new u(this.r,i(-this.s),this.recovery):this}toDERRawBytes(){return zt(this.toDERHex())}toDERHex(){return It.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return zt(this.toCompactHex())}toCompactHex(){return p(this.r)+p(this.s)}}let b={isValidPrivateKey(E){try{return l(E),!0}catch{return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{let E=Cr(t.n);return Jn(t.randomBytes(E),t.n)},precompute(E=8,R=a.BASE){return R._setWindowSize(E),R.multiply(BigInt(3)),R}};function S(E,R=!0){return a.fromPrivateKey(E).toRawBytes(R)}function d(E){let R=Ct(E),m=typeof E=="string",h=(R||m)&&E.length;return R?h===o||h===s:m?h===2*o||h===2*s:E instanceof a}function A(E,R,m=!0){if(d(E))throw new Error("first arg must be private key");if(!d(R))throw new Error("second arg must be public key");return a.fromHex(R).multiply(l(E)).toRawBytes(m)}let C=t.bits2int||function(E){if(E.length>8192)throw new Error("input is too large");let R=St(E),m=E.length*8-t.nBitLength;return m>0?R>>BigInt(m):R},U=t.bits2int_modN||function(E){return i(C(E))},I=ge(t.nBitLength);function L(E){return ct("num < 2^"+t.nBitLength,E,Tt,I),_t(E,t.nByteLength)}function T(E,R,m=z){if(["recovered","canonical"].some($=>$ in m))throw new Error("sign() legacy options not supported");let{hash:h,randomBytes:g}=t,{lowS:v,prehash:N,extraEntropy:_}=m;v==null&&(v=!0),E=G("msgHash",E),Co(m),N&&(E=G("prehashed msgHash",h(E)));let P=U(E),H=l(R),D=[L(H),L(P)];if(_!=null&&_!==!1){let $=_===!0?g(r.BYTES):_;D.push(G("extraEntropy",$))}let q=vt(...D),V=P;function X($){let tt=C($);if(!x(tt))return;let et=c(tt),st=a.BASE.multiply(tt).toAffine(),nt=i(st.x);if(nt===Tt)return;let xt=i(et*i(V+nt*H));if(xt===Tt)return;let gt=(st.x===nt?0:2)|Number(st.y&J),ue=xt;return v&&B(xt)&&(ue=w(xt),gt^=1),new u(nt,ue,gt)}return{seed:q,k2sig:X}}let z={lowS:t.lowS,prehash:!1},M={lowS:t.lowS,prehash:!1};function K(E,R,m=z){let{seed:h,k2sig:g}=T(E,R,m),v=t;return Tr(v.hash.outputLen,v.nByteLength,v.hmac)(h,g)}a.BASE._setWindowSize(8);function Y(E,R,m,h=M){let g=E;R=G("msgHash",R),m=G("publicKey",m);let{lowS:v,prehash:N,format:_}=h;if(Co(h),"strict"in h)throw new Error("options.strict was renamed to lowS");if(_!==void 0&&_!=="compact"&&_!=="der")throw new Error("format must be compact or der");let P=typeof g=="string"||Ct(g),H=!P&&!_&&typeof g=="object"&&g!==null&&typeof g.r=="bigint"&&typeof g.s=="bigint";if(!P&&!H)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let D,q;try{if(H&&(D=new u(g.r,g.s)),P){try{_!=="compact"&&(D=u.fromDER(g))}catch(gt){if(!(gt instanceof It.Err))throw gt}!D&&_!=="der"&&(D=u.fromCompact(g))}q=a.fromHex(m)}catch{return!1}if(!D||v&&D.hasHighS())return!1;N&&(R=t.hash(R));let{r:V,s:X}=D,$=U(R),tt=c(X),et=i($*tt),st=i(V*tt),nt=a.BASE.multiplyAndAddUnsafe(q,et,st)?.toAffine();return nt?i(nt.x)===V:!1}return{CURVE:t,getPublicKey:S,getSharedSecret:A,sign:K,verify:Y,ProjectivePoint:a,Signature:u,utils:b}}function _c(e){return{hash:e,hmac:(t,...r)=>dn(e,t,wr(...r)),randomBytes:Me}}function Do(e,t){let r=n=>_o({...e,..._c(n)});return{...r(t),create:r}}var Ko=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Oo=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Dc=BigInt(1),pn=BigInt(2),Po=(e,t)=>(e+t/pn)/t;function Oc(e){let t=Ko,r=BigInt(3),n=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),c=BigInt(44),a=BigInt(88),l=e*e*e%t,f=l*l*e%t,x=Z(f,r,t)*f%t,p=Z(x,r,t)*f%t,B=Z(p,pn,t)*l%t,w=Z(B,o,t)*B%t,y=Z(w,s,t)*w%t,u=Z(y,c,t)*y%t,b=Z(u,a,t)*u%t,S=Z(b,c,t)*y%t,d=Z(S,r,t)*f%t,A=Z(d,i,t)*w%t,C=Z(A,n,t)*l%t,U=Z(C,pn,t);if(!mn.eql(mn.sqr(U),e))throw new Error("Cannot find square root");return U}var mn=Dt(Ko,void 0,void 0,{sqrt:Oc}),Wt=Do({a:BigInt(0),b:BigInt(7),Fp:mn,n:Oo,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{let t=Oo,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-Dc*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,i=BigInt("0x100000000000000000000000000000000"),c=Po(s*e,t),a=Po(-n*e,t),l=k(e-c*r-a*o,t),f=k(-c*n-a*s,t),x=l>i,p=f>i;if(x&&(l=t-l),p&&(f=t-f),l>i||f>i)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:x,k1:l,k2neg:p,k2:f}}}},Uo),Ku=BigInt(0);var Hu=Wt.ProjectivePoint;function Ho(e){return e==null?!1:typeof e.then=="function"&&typeof e.catch=="function"&&typeof e.finally=="function"}function Mo(e,t,r){let n=Ee.digest(r instanceof Uint8Array?r:r.subarray());if(Ho(n))return n.then(({digest:o})=>Wt.verify(t,o,e)).catch(o=>{throw new Te(String(o))});try{return Wt.verify(t,n.digest,e)}catch(o){throw new Te(String(o))}}var ir=class{type="secp256k1";raw;_key;constructor(t){this._key=ko(t),this.raw=qo(this._key)}toMultihash(){return wt.digest($e(this))}toCID(){return ht.createV1(114,this.toMultihash())}toString(){return Q.encode(this.toMultihash().bytes).substring(1)}equals(t){return t==null||!(t.raw instanceof Uint8Array)?!1:qt(this.raw,t.raw)}verify(t,r){return Mo(this._key,r,t)}};function Vo(e){return new ir(e)}function qo(e){return Wt.ProjectivePoint.fromHex(e).toRawBytes(!0)}function ko(e){try{return Wt.ProjectivePoint.fromHex(e),e}catch(t){throw new _e(String(t))}}function zo(e){let{Type:t,Data:r}=Ae.decode(e.digest),n=r??new Uint8Array;switch(t){case ut.Ed25519:return fo(n);case ut.secp256k1:return Vo(n);default:throw new $t}}function $e(e){return Ae.encode({Type:ut[e.type],Data:e.raw})}var Fo=Symbol.for("nodejs.util.inspect.custom"),Pc=114,Re=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()})`}[fr]=!0;toString(){return this.string==null&&(this.string=Q.encode(this.multihash.bytes).slice(1)),this.string}toMultihash(){return this.multihash}toCID(){return ht.createV1(Pc,this.multihash)}toJSON(){return this.toString()}equals(t){if(t==null)return!1;if(t instanceof Uint8Array)return qt(this.multihash.bytes,t);if(typeof t=="string")return this.toString()===t;if(t?.toMultihash()?.bytes!=null)return qt(this.multihash.bytes,t.toMultihash().bytes);throw new Error("not valid Id")}[Fo](){return`PeerId(${this.toString()})`}},Le=class extends Re{type="RSA";publicKey;constructor(t){super({...t,type:"RSA"}),this.publicKey=t.publicKey}},Ue=class extends Re{type="Ed25519";publicKey;constructor(t){super({...t,type:"Ed25519"}),this.publicKey=t.publicKey}},Ce=class extends Re{type="secp256k1";publicKey;constructor(t){super({...t,type:"secp256k1"}),this.publicKey=t.publicKey}},Kc=2336,Ne=class{type="url";multihash;publicKey;url;constructor(t){this.url=t.toString(),this.multihash=wt.digest(Be(this.url))}[Fo](){return`PeerId(${this.url})`}[fr]=!0;toString(){return this.toCID().toString()}toMultihash(){return this.multihash}toCID(){return ht.createV1(Kc,this.toMultihash())}toJSON(){return this.toString()}equals(t){return t==null?!1:(t instanceof Uint8Array&&(t=Ie(t)),t.toString()===this.toString())}};var Hc=114,Zo=2336;function Mc(e,t){let r;if(e.charAt(0)==="1"||e.charAt(0)==="Q")r=pe(Q.decode(`z${e}`));else{if(t==null)throw new Xt('Please pass a multibase decoder for strings that do not start with "1" or "Q"');r=pe(t.decode(e))}return xn(r)}function Go(e){if(e.type==="Ed25519")return new Ue({multihash:e.toCID().multihash,publicKey:e});if(e.type==="secp256k1")return new Ce({multihash:e.toCID().multihash,publicKey:e});if(e.type==="RSA")return new Le({multihash:e.toCID().multihash,publicKey:e});throw new $t}function qc(e){return Go(e.publicKey)}function xn(e){if(zc(e))return new Le({multihash:e});if(Vc(e))try{let t=zo(e);if(t.type==="Ed25519")return new Ue({multihash:e,publicKey:t});if(t.type==="secp256k1")return new Ce({multihash:e,publicKey:t})}catch{let r=Ie(e.digest);return new Ne(new URL(r))}throw new Oe("Supplied PeerID Multihash is invalid")}function kc(e){if(e?.multihash==null||e.version==null||e.version===1&&e.code!==Hc&&e.code!==Zo)throw new De("Supplied PeerID CID is invalid");if(e.code===Zo){let t=Ie(e.multihash.digest);return new Ne(new URL(t))}return xn(e.multihash)}function Vc(e){return e.code===wt.code}function zc(e){return e.code===Ee.code}return ss(Fc);})();
2
+ "use strict";var Libp2PPeerId=(()=>{var ar=Object.defineProperty;var es=Object.getOwnPropertyDescriptor;var rs=Object.getOwnPropertyNames;var ns=Object.prototype.hasOwnProperty;var it=(e,t)=>{for(var r in t)ar(e,r,{get:t[r],enumerable:!0})},os=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of rs(t))!ns.call(e,o)&&o!==r&&ar(e,o,{get:()=>t[o],enumerable:!(n=es(t,o))||n.enumerable});return e};var ss=e=>os(ar({},"__esModule",{value:!0}),e);var Fc={};it(Fc,{peerIdFromCID:()=>kc,peerIdFromMultihash:()=>xn,peerIdFromPrivateKey:()=>qc,peerIdFromPublicKey:()=>Go,peerIdFromString:()=>Mc});var fr=Symbol.for("@libp2p/peer-id");var Xt=class extends Error{static name="InvalidParametersError";constructor(t="Invalid parameters"){super(t),this.name="InvalidParametersError"}},_e=class extends Error{static name="InvalidPublicKeyError";constructor(t="Invalid public key"){super(t),this.name="InvalidPublicKeyError"}};var De=class extends Error{static name="InvalidCIDError";constructor(t="Invalid CID"){super(t),this.name="InvalidCIDError"}},Oe=class extends Error{static name="InvalidMultihashError";constructor(t="Invalid Multihash"){super(t),this.name="InvalidMultihashError"}};var $t=class extends Error{static name="UnsupportedKeyTypeError";constructor(t="Unsupported key type"){super(t),this.name="UnsupportedKeyTypeError"}};var pr={};it(pr,{base58btc:()=>Q,base58flickr:()=>hs});var Yc=new Uint8Array(0);function vn(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}function bt(e){if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")}function An(e){return new TextEncoder().encode(e)}function In(e){return new TextDecoder().decode(e)}function is(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<e.length;o++){var s=e.charAt(o),i=s.charCodeAt(0);if(r[i]!==255)throw new TypeError(s+" is ambiguous");r[i]=o}var c=e.length,a=e.charAt(0),l=Math.log(c)/Math.log(256),f=Math.log(256)/Math.log(c);function x(w){if(w instanceof Uint8Array||(ArrayBuffer.isView(w)?w=new Uint8Array(w.buffer,w.byteOffset,w.byteLength):Array.isArray(w)&&(w=Uint8Array.from(w))),!(w instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(w.length===0)return"";for(var y=0,u=0,b=0,S=w.length;b!==S&&w[b]===0;)b++,y++;for(var d=(S-b)*f+1>>>0,A=new Uint8Array(d);b!==S;){for(var C=w[b],U=0,I=d-1;(C!==0||U<u)&&I!==-1;I--,U++)C+=256*A[I]>>>0,A[I]=C%c>>>0,C=C/c>>>0;if(C!==0)throw new Error("Non-zero carry");u=U,b++}for(var L=d-u;L!==d&&A[L]===0;)L++;for(var T=a.repeat(y);L<d;++L)T+=e.charAt(A[L]);return T}function p(w){if(typeof w!="string")throw new TypeError("Expected String");if(w.length===0)return new Uint8Array;var y=0;if(w[y]!==" "){for(var u=0,b=0;w[y]===a;)u++,y++;for(var S=(w.length-y)*l+1>>>0,d=new Uint8Array(S);w[y];){var A=r[w.charCodeAt(y)];if(A===255)return;for(var C=0,U=S-1;(A!==0||C<b)&&U!==-1;U--,C++)A+=c*d[U]>>>0,d[U]=A%256>>>0,A=A/256>>>0;if(A!==0)throw new Error("Non-zero carry");b=C,y++}if(w[y]!==" "){for(var I=S-b;I!==S&&d[I]===0;)I++;for(var L=new Uint8Array(u+(S-I)),T=u;I!==S;)L[T++]=d[I++];return L}}}function B(w){var y=p(w);if(y)return y;throw new Error(`Non-${t} character`)}return{encode:x,decodeUnsafe:p,decode:B}}var cs=is,as=cs,Rn=as;var ur=class{name;prefix;baseEncode;constructor(t,r,n){this.name=t,this.prefix=r,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},hr=class{name;prefix;baseDecode;prefixCodePoint;constructor(t,r,n){this.name=t,this.prefix=r;let o=r.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 Ln(this,t)}},dr=class{decoders;constructor(t){this.decoders=t}or(t){return Ln(this,t)}decode(t){let r=t[0],n=this.decoders[r];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 Ln(e,t){return new dr({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var lr=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(t,r,n,o){this.name=t,this.prefix=r,this.baseEncode=n,this.baseDecode=o,this.encoder=new ur(t,r,n),this.decoder=new hr(t,r,o)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};function Qt({name:e,prefix:t,encode:r,decode:n}){return new lr(e,t,r,n)}function Rt({name:e,prefix:t,alphabet:r}){let{encode:n,decode:o}=Rn(r,e);return Qt({prefix:t,name:e,encode:n,decode:s=>bt(o(s))})}function fs(e,t,r,n){let o={};for(let f=0;f<t.length;++f)o[t[f]]=f;let s=e.length;for(;e[s-1]==="=";)--s;let i=new Uint8Array(s*r/8|0),c=0,a=0,l=0;for(let f=0;f<s;++f){let x=o[e[f]];if(x===void 0)throw new SyntaxError(`Non-${n} character`);a=a<<r|x,c+=r,c>=8&&(c-=8,i[l++]=255&a>>c)}if(c>=r||(255&a<<8-c)!==0)throw new SyntaxError("Unexpected end of data");return i}function us(e,t,r){let n=t[t.length-1]==="=",o=(1<<r)-1,s="",i=0,c=0;for(let a=0;a<e.length;++a)for(c=c<<8|e[a],i+=8;i>r;)i-=r,s+=t[o&c>>i];if(i!==0&&(s+=t[o&c<<r-i]),n)for(;(s.length*r&7)!==0;)s+="=";return s}function j({name:e,prefix:t,bitsPerChar:r,alphabet:n}){return Qt({prefix:t,name:e,encode(o){return us(o,n,r)},decode(o){return fs(o,n,r,e)}})}var Q=Rt({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),hs=Rt({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var mr={};it(mr,{base32:()=>Jt,base32hex:()=>ms,base32hexpad:()=>ys,base32hexpadupper:()=>gs,base32hexupper:()=>xs,base32pad:()=>ls,base32padupper:()=>ps,base32upper:()=>ds,base32z:()=>bs});var Jt=j({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ds=j({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ls=j({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ps=j({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ms=j({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),xs=j({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),ys=j({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),gs=j({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),bs=j({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var xr={};it(xr,{base36:()=>he,base36upper:()=>ws});var he=Rt({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),ws=Rt({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Es=Nn,Un=128,Bs=127,Ss=~Bs,vs=Math.pow(2,31);function Nn(e,t,r){t=t||[],r=r||0;for(var n=r;e>=vs;)t[r++]=e&255|Un,e/=128;for(;e&Ss;)t[r++]=e&255|Un,e>>>=7;return t[r]=e|0,Nn.bytes=r-n+1,t}var As=yr,Is=128,Cn=127;function yr(e,n){var r=0,n=n||0,o=0,s=n,i,c=e.length;do{if(s>=c)throw yr.bytes=0,new RangeError("Could not decode varint");i=e[s++],r+=o<28?(i&Cn)<<o:(i&Cn)*Math.pow(2,o),o+=7}while(i>=Is);return yr.bytes=s-n,r}var Ts=Math.pow(2,7),Rs=Math.pow(2,14),Ls=Math.pow(2,21),Us=Math.pow(2,28),Cs=Math.pow(2,35),Ns=Math.pow(2,42),_s=Math.pow(2,49),Ds=Math.pow(2,56),Os=Math.pow(2,63),Ps=function(e){return e<Ts?1:e<Rs?2:e<Ls?3:e<Us?4:e<Cs?5:e<Ns?6:e<_s?7:e<Ds?8:e<Os?9:10},Ks={encode:Es,decode:As,encodingLength:Ps},Hs=Ks,de=Hs;function le(e,t=0){return[de.decode(e,t),de.decode.bytes]}function te(e,t,r=0){return de.encode(e,t,r),t}function ee(e){return de.encodingLength(e)}function Mt(e,t){let r=t.byteLength,n=ee(e),o=n+ee(r),s=new Uint8Array(o+r);return te(e,s,0),te(r,s,n),s.set(t,o),new re(e,r,t,s)}function pe(e){let t=bt(e),[r,n]=le(t),[o,s]=le(t.subarray(n)),i=t.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new re(r,o,i,t)}function _n(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&vn(e.bytes,r.bytes)}}var re=class{code;size;digest;bytes;constructor(t,r,n,o){this.code=t,this.size=r,this.digest=n,this.bytes=o}};function Dn(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return qs(r,gr(e),t??Q.encoder);default:return ks(r,gr(e),t??Jt.encoder)}}var On=new WeakMap;function gr(e){let t=On.get(e);if(t==null){let r=new Map;return On.set(e,r),r}return t}var ht=class e{code;version;multihash;bytes;"/";constructor(t,r,n,o){this.code=r,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:r}=this;if(t!==me)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Vs)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return e.createV0(r)}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:r}=this.multihash,n=Mt(t,r);return e.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 e.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&_n(t.multihash,n.multihash)}toString(t){return Dn(this,t)}toJSON(){return{"/":Dn(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 r=t;if(r instanceof e)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:o,multihash:s,bytes:i}=r;return new e(n,o,s,i??Pn(n,o,s.bytes))}else if(r[zs]===!0){let{version:n,multihash:o,code:s}=r,i=pe(o);return e.create(n,s,i)}else return null}static create(t,r,n){if(typeof r!="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(r!==me)throw new Error(`Version 0 CID must use dag-pb (code: ${me}) block encoding`);return new e(t,r,n,n.bytes)}case 1:{let o=Pn(t,r,n.bytes);return new e(t,r,n,o)}default:throw new Error("Invalid version")}}static createV0(t){return e.create(0,me,t)}static createV1(t,r){return e.create(1,t,r)}static decode(t){let[r,n]=e.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=e.inspectBytes(t),n=r.size-r.multihashSize,o=bt(t.subarray(n,n+r.multihashSize));if(o.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=o.subarray(r.multihashSize-r.digestSize),i=new re(r.multihashCode,r.digestSize,s,o);return[r.version===0?e.createV0(i):e.createV1(r.codec,i),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[x,p]=le(t.subarray(r));return r+=p,x},o=n(),s=me;if(o===18?(o=0,r=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=r,c=n(),a=n(),l=r+a,f=l-i;return{version:o,codec:s,multihashCode:c,digestSize:a,multihashSize:f,size:l}}static parse(t,r){let[n,o]=Ms(t,r),s=e.decode(o);if(s.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return gr(s).set(n,t),s}};function Ms(e,t){switch(e[0]){case"Q":{let r=t??Q;return[Q.prefix,r.decode(`${Q.prefix}${e}`)]}case Q.prefix:{let r=t??Q;return[Q.prefix,r.decode(e)]}case Jt.prefix:{let r=t??Jt;return[Jt.prefix,r.decode(e)]}case he.prefix:{let r=t??he;return[he.prefix,r.decode(e)]}default:{if(t==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}}function qs(e,t,r){let{prefix:n}=r;if(n!==Q.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let o=t.get(n);if(o==null){let s=r.encode(e).slice(1);return t.set(n,s),s}else return o}function ks(e,t,r){let{prefix:n}=r,o=t.get(n);if(o==null){let s=r.encode(e);return t.set(n,s),s}else return o}var me=112,Vs=18;function Pn(e,t,r){let n=ee(e),o=n+ee(t),s=new Uint8Array(o+r.byteLength);return te(e,s,0),te(t,s,n),s.set(r,o),s}var zs=Symbol.for("@ipld/js-cid/CID");var br={};it(br,{identity:()=>wt});var Kn=0,Fs="identity",Hn=bt;function Zs(e){return Mt(Kn,Hn(e))}var wt={code:Kn,name:Fs,encode:Hn,digest:Zs};function qt(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}function Mn(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Gs(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function oe(e,...t){if(!Gs(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function qn(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Mn(e.outputLen),Mn(e.blockLen)}function se(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function kn(e,t){oe(e);let r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}var kt=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Ke(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function dt(e,t){return e<<32-t|e>>>t}function Vn(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function xe(e){return typeof e=="string"&&(e=Vn(e)),oe(e),e}function wr(...e){let t=0;for(let n=0;n<e.length;n++){let o=e[n];oe(o),t+=o.length}let r=new Uint8Array(t);for(let n=0,o=0;n<e.length;n++){let s=e[n];r.set(s,o),o+=s.length}return r}var ie=class{clone(){return this._cloneInto()}};function He(e){let t=n=>e().update(xe(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function Me(e=32){if(kt&&typeof kt.getRandomValues=="function")return kt.getRandomValues(new Uint8Array(e));if(kt&&typeof kt.randomBytes=="function")return kt.randomBytes(e);throw new Error("crypto.getRandomValues must be defined")}function js(e,t,r,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,n);let o=BigInt(32),s=BigInt(4294967295),i=Number(r>>o&s),c=Number(r&s),a=n?4:0,l=n?0:4;e.setUint32(t+a,i,n),e.setUint32(t+l,c,n)}function zn(e,t,r){return e&t^~e&r}function Fn(e,t,r){return e&t^e&r^t&r}var ce=class extends ie{constructor(t,r,n,o){super(),this.blockLen=t,this.outputLen=r,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=Ke(this.buffer)}update(t){se(this);let{view:r,buffer:n,blockLen:o}=this;t=xe(t);let s=t.length;for(let i=0;i<s;){let c=Math.min(o-this.pos,s-i);if(c===o){let a=Ke(t);for(;o<=s-i;i+=o)this.process(a,i);continue}n.set(t.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===o&&(this.process(r,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){se(this),kn(t,this),this.finished=!0;let{buffer:r,view:n,blockLen:o,isLE:s}=this,{pos:i}=this;r[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>o-i&&(this.process(n,0),i=0);for(let x=i;x<o;x++)r[x]=0;js(n,o-8,BigInt(this.length*8),s),this.process(n,0);let c=Ke(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let l=a/4,f=this.get();if(l>f.length)throw new Error("_sha2: outputLen bigger than state");for(let x=0;x<l;x++)c.setUint32(4*x,f[x],s)}digest(){let{buffer:t,outputLen:r}=this;this.digestInto(t);let n=t.slice(0,r);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:r,buffer:n,length:o,finished:s,destroyed:i,pos:c}=this;return t.length=o,t.pos=c,t.finished=s,t.destroyed=i,o%r&&t.buffer.set(n),t}};var qe=BigInt(4294967295),Er=BigInt(32);function Zn(e,t=!1){return t?{h:Number(e&qe),l:Number(e>>Er&qe)}:{h:Number(e>>Er&qe)|0,l:Number(e&qe)|0}}function Ys(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let o=0;o<e.length;o++){let{h:s,l:i}=Zn(e[o],t);[r[o],n[o]]=[s,i]}return[r,n]}var Ws=(e,t)=>BigInt(e>>>0)<<Er|BigInt(t>>>0),Xs=(e,t,r)=>e>>>r,$s=(e,t,r)=>e<<32-r|t>>>r,Qs=(e,t,r)=>e>>>r|t<<32-r,Js=(e,t,r)=>e<<32-r|t>>>r,ti=(e,t,r)=>e<<64-r|t>>>r-32,ei=(e,t,r)=>e>>>r-32|t<<64-r,ri=(e,t)=>t,ni=(e,t)=>e,oi=(e,t,r)=>e<<r|t>>>32-r,si=(e,t,r)=>t<<r|e>>>32-r,ii=(e,t,r)=>t<<r-32|e>>>64-r,ci=(e,t,r)=>e<<r-32|t>>>64-r;function ai(e,t,r,n){let o=(t>>>0)+(n>>>0);return{h:e+r+(o/2**32|0)|0,l:o|0}}var fi=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),ui=(e,t,r,n)=>t+r+n+(e/2**32|0)|0,hi=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),di=(e,t,r,n,o)=>t+r+n+o+(e/2**32|0)|0,li=(e,t,r,n,o)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(o>>>0),pi=(e,t,r,n,o,s)=>t+r+n+o+s+(e/2**32|0)|0;var mi={fromBig:Zn,split:Ys,toBig:Ws,shrSH:Xs,shrSL:$s,rotrSH:Qs,rotrSL:Js,rotrBH:ti,rotrBL:ei,rotr32H:ri,rotr32L:ni,rotlSH:oi,rotlSL:si,rotlBH:ii,rotlBL:ci,add:ai,add3L:fi,add3H:ui,add4L:hi,add4H:di,add5H:pi,add5L:li},O=mi;var[xi,yi]=O.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(e=>BigInt(e))),Lt=new Uint32Array(80),Ut=new Uint32Array(80),Br=class extends ce{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:r,Bh:n,Bl:o,Ch:s,Cl:i,Dh:c,Dl:a,Eh:l,El:f,Fh:x,Fl:p,Gh:B,Gl:w,Hh:y,Hl:u}=this;return[t,r,n,o,s,i,c,a,l,f,x,p,B,w,y,u]}set(t,r,n,o,s,i,c,a,l,f,x,p,B,w,y,u){this.Ah=t|0,this.Al=r|0,this.Bh=n|0,this.Bl=o|0,this.Ch=s|0,this.Cl=i|0,this.Dh=c|0,this.Dl=a|0,this.Eh=l|0,this.El=f|0,this.Fh=x|0,this.Fl=p|0,this.Gh=B|0,this.Gl=w|0,this.Hh=y|0,this.Hl=u|0}process(t,r){for(let d=0;d<16;d++,r+=4)Lt[d]=t.getUint32(r),Ut[d]=t.getUint32(r+=4);for(let d=16;d<80;d++){let A=Lt[d-15]|0,C=Ut[d-15]|0,U=O.rotrSH(A,C,1)^O.rotrSH(A,C,8)^O.shrSH(A,C,7),I=O.rotrSL(A,C,1)^O.rotrSL(A,C,8)^O.shrSL(A,C,7),L=Lt[d-2]|0,T=Ut[d-2]|0,z=O.rotrSH(L,T,19)^O.rotrBH(L,T,61)^O.shrSH(L,T,6),M=O.rotrSL(L,T,19)^O.rotrBL(L,T,61)^O.shrSL(L,T,6),K=O.add4L(I,M,Ut[d-7],Ut[d-16]),Y=O.add4H(K,U,z,Lt[d-7],Lt[d-16]);Lt[d]=Y|0,Ut[d]=K|0}let{Ah:n,Al:o,Bh:s,Bl:i,Ch:c,Cl:a,Dh:l,Dl:f,Eh:x,El:p,Fh:B,Fl:w,Gh:y,Gl:u,Hh:b,Hl:S}=this;for(let d=0;d<80;d++){let A=O.rotrSH(x,p,14)^O.rotrSH(x,p,18)^O.rotrBH(x,p,41),C=O.rotrSL(x,p,14)^O.rotrSL(x,p,18)^O.rotrBL(x,p,41),U=x&B^~x&y,I=p&w^~p&u,L=O.add5L(S,C,I,yi[d],Ut[d]),T=O.add5H(L,b,A,U,xi[d],Lt[d]),z=L|0,M=O.rotrSH(n,o,28)^O.rotrBH(n,o,34)^O.rotrBH(n,o,39),K=O.rotrSL(n,o,28)^O.rotrBL(n,o,34)^O.rotrBL(n,o,39),Y=n&s^n&c^s&c,E=o&i^o&a^i&a;b=y|0,S=u|0,y=B|0,u=w|0,B=x|0,w=p|0,{h:x,l:p}=O.add(l|0,f|0,T|0,z|0),l=c|0,f=a|0,c=s|0,a=i|0,s=n|0,i=o|0;let R=O.add3L(z,K,E);n=O.add3H(R,T,M,Y),o=R|0}({h:n,l:o}=O.add(this.Ah|0,this.Al|0,n|0,o|0)),{h:s,l:i}=O.add(this.Bh|0,this.Bl|0,s|0,i|0),{h:c,l:a}=O.add(this.Ch|0,this.Cl|0,c|0,a|0),{h:l,l:f}=O.add(this.Dh|0,this.Dl|0,l|0,f|0),{h:x,l:p}=O.add(this.Eh|0,this.El|0,x|0,p|0),{h:B,l:w}=O.add(this.Fh|0,this.Fl|0,B|0,w|0),{h:y,l:u}=O.add(this.Gh|0,this.Gl|0,y|0,u|0),{h:b,l:S}=O.add(this.Hh|0,this.Hl|0,b|0,S|0),this.set(n,o,s,i,c,a,l,f,x,p,B,w,y,u,b,S)}roundClean(){Lt.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 Gn=He(()=>new Br);var ze={};it(ze,{aInRange:()=>ct,abool:()=>lt,abytes:()=>ae,bitGet:()=>Si,bitLen:()=>Ir,bitMask:()=>ge,bitSet:()=>vi,bytesToHex:()=>Bt,bytesToNumberBE:()=>St,bytesToNumberLE:()=>Nt,concatBytes:()=>vt,createHmacDrbg:()=>Tr,ensureBytes:()=>G,equalBytes:()=>Ei,hexToBytes:()=>zt,hexToNumber:()=>Ar,inRange:()=>ye,isBytes:()=>Ct,memoized:()=>Zt,notImplemented:()=>Ii,numberToBytesBE:()=>_t,numberToBytesLE:()=>Ft,numberToHexUnpadded:()=>Vt,numberToVarBytesBE:()=>wi,utf8ToBytes:()=>Bi,validateObject:()=>yt});var ke=BigInt(0),Ve=BigInt(1),gi=BigInt(2);function Ct(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function ae(e){if(!Ct(e))throw new Error("Uint8Array expected")}function lt(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}var bi=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Bt(e){ae(e);let t="";for(let r=0;r<e.length;r++)t+=bi[e[r]];return t}function Vt(e){let t=e.toString(16);return t.length&1?"0"+t:t}function Ar(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?ke:BigInt("0x"+e)}var Et={_0:48,_9:57,A:65,F:70,a:97,f:102};function jn(e){if(e>=Et._0&&e<=Et._9)return e-Et._0;if(e>=Et.A&&e<=Et.F)return e-(Et.A-10);if(e>=Et.a&&e<=Et.f)return e-(Et.a-10)}function zt(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);let t=e.length,r=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(r);for(let o=0,s=0;o<r;o++,s+=2){let i=jn(e.charCodeAt(s)),c=jn(e.charCodeAt(s+1));if(i===void 0||c===void 0){let a=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+a+'" at index '+s)}n[o]=i*16+c}return n}function St(e){return Ar(Bt(e))}function Nt(e){return ae(e),Ar(Bt(Uint8Array.from(e).reverse()))}function _t(e,t){return zt(e.toString(16).padStart(t*2,"0"))}function Ft(e,t){return _t(e,t).reverse()}function wi(e){return zt(Vt(e))}function G(e,t,r){let n;if(typeof t=="string")try{n=zt(t)}catch(s){throw new Error(e+" must be hex string or Uint8Array, cause: "+s)}else if(Ct(t))n=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");let o=n.length;if(typeof r=="number"&&o!==r)throw new Error(e+" of length "+r+" expected, got "+o);return n}function vt(...e){let t=0;for(let n=0;n<e.length;n++){let o=e[n];ae(o),t+=o.length}let r=new Uint8Array(t);for(let n=0,o=0;n<e.length;n++){let s=e[n];r.set(s,o),o+=s.length}return r}function Ei(e,t){if(e.length!==t.length)return!1;let r=0;for(let n=0;n<e.length;n++)r|=e[n]^t[n];return r===0}function Bi(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}var Sr=e=>typeof e=="bigint"&&ke<=e;function ye(e,t,r){return Sr(e)&&Sr(t)&&Sr(r)&&t<=e&&e<r}function ct(e,t,r,n){if(!ye(t,r,n))throw new Error("expected valid "+e+": "+r+" <= n < "+n+", got "+t)}function Ir(e){let t;for(t=0;e>ke;e>>=Ve,t+=1);return t}function Si(e,t){return e>>BigInt(t)&Ve}function vi(e,t,r){return e|(r?Ve:ke)<<BigInt(t)}var ge=e=>(gi<<BigInt(e-1))-Ve,vr=e=>new Uint8Array(e),Yn=e=>Uint8Array.from(e);function Tr(e,t,r){if(typeof e!="number"||e<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 r!="function")throw new Error("hmacFn must be a function");let n=vr(e),o=vr(e),s=0,i=()=>{n.fill(1),o.fill(0),s=0},c=(...x)=>r(o,n,...x),a=(x=vr())=>{o=c(Yn([0]),x),n=c(),x.length!==0&&(o=c(Yn([1]),x),n=c())},l=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let x=0,p=[];for(;x<t;){n=c();let B=n.slice();p.push(B),x+=n.length}return vt(...p)};return(x,p)=>{i(),a(x);let B;for(;!(B=p(l()));)a();return i(),B}}var Ai={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||Ct(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function yt(e,t,r={}){let n=(o,s,i)=>{let c=Ai[s];if(typeof c!="function")throw new Error("invalid validator function");let a=e[o];if(!(i&&a===void 0)&&!c(a,e))throw new Error("param "+String(o)+" is invalid. Expected "+s+", got "+a)};for(let[o,s]of Object.entries(t))n(o,s,!1);for(let[o,s]of Object.entries(r))n(o,s,!0);return e}var Ii=()=>{throw new Error("not implemented")};function Zt(e){let t=new WeakMap;return(r,...n)=>{let o=t.get(r);if(o!==void 0)return o;let s=e(r,...n);return t.set(r,s),s}}var W=BigInt(0),F=BigInt(1),Gt=BigInt(2),Ti=BigInt(3),Rr=BigInt(4),Wn=BigInt(5),Xn=BigInt(8),Ri=BigInt(9),Li=BigInt(16);function k(e,t){let r=e%t;return r>=W?r:t+r}function Ui(e,t,r){if(t<W)throw new Error("invalid exponent, negatives unsupported");if(r<=W)throw new Error("invalid modulus");if(r===F)return W;let n=F;for(;t>W;)t&F&&(n=n*e%r),e=e*e%r,t>>=F;return n}function Z(e,t,r){let n=e;for(;t-- >W;)n*=n,n%=r;return n}function Fe(e,t){if(e===W)throw new Error("invert: expected non-zero number");if(t<=W)throw new Error("invert: expected positive modulus, got "+t);let r=k(e,t),n=t,o=W,s=F,i=F,c=W;for(;r!==W;){let l=n/r,f=n%r,x=o-i*l,p=s-c*l;n=r,r=f,o=i,s=c,i=x,c=p}if(n!==F)throw new Error("invert: does not exist");return k(o,t)}function Ci(e){let t=(e-F)/Gt,r,n,o;for(r=e-F,n=0;r%Gt===W;r/=Gt,n++);for(o=Gt;o<e&&Ui(o,t,e)!==e-F;o++)if(o>1e3)throw new Error("Cannot find square root: likely non-prime P");if(n===1){let i=(e+F)/Rr;return function(a,l){let f=a.pow(l,i);if(!a.eql(a.sqr(f),l))throw new Error("Cannot find square root");return f}}let s=(r+F)/Gt;return function(c,a){if(c.pow(a,t)===c.neg(c.ONE))throw new Error("Cannot find square root");let l=n,f=c.pow(c.mul(c.ONE,o),r),x=c.pow(a,s),p=c.pow(a,r);for(;!c.eql(p,c.ONE);){if(c.eql(p,c.ZERO))return c.ZERO;let B=1;for(let y=c.sqr(p);B<l&&!c.eql(y,c.ONE);B++)y=c.sqr(y);let w=c.pow(f,F<<BigInt(l-B-1));f=c.sqr(w),x=c.mul(x,w),p=c.mul(p,f),l=B}return x}}function Ni(e){if(e%Rr===Ti){let t=(e+F)/Rr;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(e%Xn===Wn){let t=(e-Wn)/Xn;return function(n,o){let s=n.mul(o,Gt),i=n.pow(s,t),c=n.mul(o,i),a=n.mul(n.mul(c,Gt),i),l=n.mul(c,n.sub(a,n.ONE));if(!n.eql(n.sqr(l),o))throw new Error("Cannot find square root");return l}}return e%Li,Ci(e)}var $n=(e,t)=>(k(e,t)&F)===F,_i=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Lr(e){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=_i.reduce((n,o)=>(n[o]="function",n),t);return yt(e,r)}function Di(e,t,r){if(r<W)throw new Error("invalid exponent, negatives unsupported");if(r===W)return e.ONE;if(r===F)return t;let n=e.ONE,o=t;for(;r>W;)r&F&&(n=e.mul(n,o)),o=e.sqr(o),r>>=F;return n}function Oi(e,t){let r=new Array(t.length),n=t.reduce((s,i,c)=>e.is0(i)?s:(r[c]=s,e.mul(s,i)),e.ONE),o=e.inv(n);return t.reduceRight((s,i,c)=>e.is0(i)?s:(r[c]=e.mul(s,r[c]),e.mul(s,i)),o),r}function Ur(e,t){let r=t!==void 0?t:e.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function Dt(e,t,r=!1,n={}){if(e<=W)throw new Error("invalid field: expected ORDER > 0, got "+e);let{nBitLength:o,nByteLength:s}=Ur(e,t);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let i,c=Object.freeze({ORDER:e,isLE:r,BITS:o,BYTES:s,MASK:ge(o),ZERO:W,ONE:F,create:a=>k(a,e),isValid:a=>{if(typeof a!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof a);return W<=a&&a<e},is0:a=>a===W,isOdd:a=>(a&F)===F,neg:a=>k(-a,e),eql:(a,l)=>a===l,sqr:a=>k(a*a,e),add:(a,l)=>k(a+l,e),sub:(a,l)=>k(a-l,e),mul:(a,l)=>k(a*l,e),pow:(a,l)=>Di(c,a,l),div:(a,l)=>k(a*Fe(l,e),e),sqrN:a=>a*a,addN:(a,l)=>a+l,subN:(a,l)=>a-l,mulN:(a,l)=>a*l,inv:a=>Fe(a,e),sqrt:n.sqrt||(a=>(i||(i=Ni(e)),i(c,a))),invertBatch:a=>Oi(c,a),cmov:(a,l,f)=>f?l:a,toBytes:a=>r?Ft(a,s):_t(a,s),fromBytes:a=>{if(a.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+a.length);return r?Nt(a):St(a)}});return Object.freeze(c)}function Qn(e){if(typeof e!="bigint")throw new Error("field order must be bigint");let t=e.toString(2).length;return Math.ceil(t/8)}function Cr(e){let t=Qn(e);return t+Math.ceil(t/2)}function Jn(e,t,r=!1){let n=e.length,o=Qn(t),s=Cr(t);if(n<16||n<s||n>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+n);let i=r?Nt(e):St(e),c=k(i,t-F)+F;return r?Ft(c,o):_t(c,o)}var to=BigInt(0),Ze=BigInt(1);function Nr(e,t){let r=t.negate();return e?r:t}function eo(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function _r(e,t){eo(e,t);let r=Math.ceil(t/e)+1,n=2**(e-1);return{windows:r,windowSize:n}}function Pi(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((r,n)=>{if(!(r instanceof t))throw new Error("invalid point at index "+n)})}function Ki(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((r,n)=>{if(!t.isValid(r))throw new Error("invalid scalar at index "+n)})}var Dr=new WeakMap,ro=new WeakMap;function Or(e){return ro.get(e)||1}function Ge(e,t){return{constTimeNegate:Nr,hasPrecomputes(r){return Or(r)!==1},unsafeLadder(r,n,o=e.ZERO){let s=r;for(;n>to;)n&Ze&&(o=o.add(s)),s=s.double(),n>>=Ze;return o},precomputeWindow(r,n){let{windows:o,windowSize:s}=_r(n,t),i=[],c=r,a=c;for(let l=0;l<o;l++){a=c,i.push(a);for(let f=1;f<s;f++)a=a.add(c),i.push(a);c=a.double()}return i},wNAF(r,n,o){let{windows:s,windowSize:i}=_r(r,t),c=e.ZERO,a=e.BASE,l=BigInt(2**r-1),f=2**r,x=BigInt(r);for(let p=0;p<s;p++){let B=p*i,w=Number(o&l);o>>=x,w>i&&(w-=f,o+=Ze);let y=B,u=B+Math.abs(w)-1,b=p%2!==0,S=w<0;w===0?a=a.add(Nr(b,n[y])):c=c.add(Nr(S,n[u]))}return{p:c,f:a}},wNAFUnsafe(r,n,o,s=e.ZERO){let{windows:i,windowSize:c}=_r(r,t),a=BigInt(2**r-1),l=2**r,f=BigInt(r);for(let x=0;x<i;x++){let p=x*c;if(o===to)break;let B=Number(o&a);if(o>>=f,B>c&&(B-=l,o+=Ze),B===0)continue;let w=n[p+Math.abs(B)-1];B<0&&(w=w.negate()),s=s.add(w)}return s},getPrecomputes(r,n,o){let s=Dr.get(n);return s||(s=this.precomputeWindow(n,r),r!==1&&Dr.set(n,o(s))),s},wNAFCached(r,n,o){let s=Or(r);return this.wNAF(s,this.getPrecomputes(s,r,o),n)},wNAFCachedUnsafe(r,n,o,s){let i=Or(r);return i===1?this.unsafeLadder(r,n,s):this.wNAFUnsafe(i,this.getPrecomputes(i,r,o),n,s)},setWindowSize(r,n){eo(n,t),ro.set(r,n),Dr.delete(r)}}}function je(e,t,r,n){if(Pi(r,e),Ki(n,t),r.length!==n.length)throw new Error("arrays of points and scalars must have equal length");let o=e.ZERO,s=Ir(BigInt(r.length)),i=s>12?s-3:s>4?s-2:s?2:1,c=(1<<i)-1,a=new Array(c+1).fill(o),l=Math.floor((t.BITS-1)/i)*i,f=o;for(let x=l;x>=0;x-=i){a.fill(o);for(let B=0;B<n.length;B++){let w=n[B],y=Number(w>>BigInt(x)&BigInt(c));a[y]=a[y].add(r[B])}let p=o;for(let B=a.length-1,w=o;B>0;B--)w=w.add(a[B]),p=p.add(w);if(f=f.add(p),x!==0)for(let B=0;B<i;B++)f=f.double()}return f}function be(e){return Lr(e.Fp),yt(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Ur(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}var pt=BigInt(0),at=BigInt(1),Ye=BigInt(2),Hi=BigInt(8),Mi={zip215:!0};function qi(e){let t=be(e);return yt(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}function no(e){let t=qi(e),{Fp:r,n,prehash:o,hash:s,randomBytes:i,nByteLength:c,h:a}=t,l=Ye<<BigInt(c*8)-at,f=r.create,x=Dt(t.n,t.nBitLength),p=t.uvRatio||((m,h)=>{try{return{isValid:!0,value:r.sqrt(m*r.inv(h))}}catch{return{isValid:!1,value:pt}}}),B=t.adjustScalarBytes||(m=>m),w=t.domain||((m,h,g)=>{if(lt("phflag",g),h.length||g)throw new Error("Contexts/pre-hash are not supported");return m});function y(m,h){ct("coordinate "+m,h,pt,l)}function u(m){if(!(m instanceof d))throw new Error("ExtendedPoint expected")}let b=Zt((m,h)=>{let{ex:g,ey:v,ez:N}=m,_=m.is0();h==null&&(h=_?Hi:r.inv(N));let P=f(g*h),H=f(v*h),D=f(N*h);if(_)return{x:pt,y:at};if(D!==at)throw new Error("invZ was invalid");return{x:P,y:H}}),S=Zt(m=>{let{a:h,d:g}=t;if(m.is0())throw new Error("bad point: ZERO");let{ex:v,ey:N,ez:_,et:P}=m,H=f(v*v),D=f(N*N),q=f(_*_),V=f(q*q),X=f(H*h),$=f(q*f(X+D)),tt=f(V+f(g*f(H*D)));if($!==tt)throw new Error("bad point: equation left != right (1)");let et=f(v*N),st=f(_*P);if(et!==st)throw new Error("bad point: equation left != right (2)");return!0});class d{constructor(h,g,v,N){this.ex=h,this.ey=g,this.ez=v,this.et=N,y("x",h),y("y",g),y("z",v),y("t",N),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(h){if(h instanceof d)throw new Error("extended point not allowed");let{x:g,y:v}=h||{};return y("x",g),y("y",v),new d(g,v,at,f(g*v))}static normalizeZ(h){let g=r.invertBatch(h.map(v=>v.ez));return h.map((v,N)=>v.toAffine(g[N])).map(d.fromAffine)}static msm(h,g){return je(d,x,h,g)}_setWindowSize(h){U.setWindowSize(this,h)}assertValidity(){S(this)}equals(h){u(h);let{ex:g,ey:v,ez:N}=this,{ex:_,ey:P,ez:H}=h,D=f(g*H),q=f(_*N),V=f(v*H),X=f(P*N);return D===q&&V===X}is0(){return this.equals(d.ZERO)}negate(){return new d(f(-this.ex),this.ey,this.ez,f(-this.et))}double(){let{a:h}=t,{ex:g,ey:v,ez:N}=this,_=f(g*g),P=f(v*v),H=f(Ye*f(N*N)),D=f(h*_),q=g+v,V=f(f(q*q)-_-P),X=D+P,$=X-H,tt=D-P,et=f(V*$),st=f(X*tt),nt=f(V*tt),xt=f($*X);return new d(et,st,xt,nt)}add(h){u(h);let{a:g,d:v}=t,{ex:N,ey:_,ez:P,et:H}=this,{ex:D,ey:q,ez:V,et:X}=h;if(g===BigInt(-1)){let yn=f((_-N)*(q+D)),gn=f((_+N)*(q-D)),cr=f(gn-yn);if(cr===pt)return this.double();let bn=f(P*Ye*X),wn=f(H*Ye*V),En=wn+bn,Bn=gn+yn,Sn=wn-bn,$o=f(En*cr),Qo=f(Bn*Sn),Jo=f(En*Sn),ts=f(cr*Bn);return new d($o,Qo,ts,Jo)}let $=f(N*D),tt=f(_*q),et=f(H*v*X),st=f(P*V),nt=f((N+_)*(D+q)-$-tt),xt=st-et,gt=st+et,ue=f(tt-g*$),jo=f(nt*xt),Yo=f(gt*ue),Wo=f(nt*ue),Xo=f(xt*gt);return new d(jo,Yo,Xo,Wo)}subtract(h){return this.add(h.negate())}wNAF(h){return U.wNAFCached(this,h,d.normalizeZ)}multiply(h){let g=h;ct("scalar",g,at,n);let{p:v,f:N}=this.wNAF(g);return d.normalizeZ([v,N])[0]}multiplyUnsafe(h,g=d.ZERO){let v=h;return ct("scalar",v,pt,n),v===pt?C:this.is0()||v===at?this:U.wNAFCachedUnsafe(this,v,d.normalizeZ,g)}isSmallOrder(){return this.multiplyUnsafe(a).is0()}isTorsionFree(){return U.unsafeLadder(this,n).is0()}toAffine(h){return b(this,h)}clearCofactor(){let{h}=t;return h===at?this:this.multiplyUnsafe(h)}static fromHex(h,g=!1){let{d:v,a:N}=t,_=r.BYTES;h=G("pointHex",h,_),lt("zip215",g);let P=h.slice(),H=h[_-1];P[_-1]=H&-129;let D=Nt(P),q=g?l:r.ORDER;ct("pointHex.y",D,pt,q);let V=f(D*D),X=f(V-at),$=f(v*V-N),{isValid:tt,value:et}=p(X,$);if(!tt)throw new Error("Point.fromHex: invalid y coordinate");let st=(et&at)===at,nt=(H&128)!==0;if(!g&&et===pt&&nt)throw new Error("Point.fromHex: x=0 and x_0=1");return nt!==st&&(et=f(-et)),d.fromAffine({x:et,y:D})}static fromPrivateKey(h){return T(h).point}toRawBytes(){let{x:h,y:g}=this.toAffine(),v=Ft(g,r.BYTES);return v[v.length-1]|=h&at?128:0,v}toHex(){return Bt(this.toRawBytes())}}d.BASE=new d(t.Gx,t.Gy,at,f(t.Gx*t.Gy)),d.ZERO=new d(pt,at,at,pt);let{BASE:A,ZERO:C}=d,U=Ge(d,c*8);function I(m){return k(m,n)}function L(m){return I(Nt(m))}function T(m){let h=r.BYTES;m=G("private key",m,h);let g=G("hashed private key",s(m),2*h),v=B(g.slice(0,h)),N=g.slice(h,2*h),_=L(v),P=A.multiply(_),H=P.toRawBytes();return{head:v,prefix:N,scalar:_,point:P,pointBytes:H}}function z(m){return T(m).pointBytes}function M(m=new Uint8Array,...h){let g=vt(...h);return L(s(w(g,G("context",m),!!o)))}function K(m,h,g={}){m=G("message",m),o&&(m=o(m));let{prefix:v,scalar:N,pointBytes:_}=T(h),P=M(g.context,v,m),H=A.multiply(P).toRawBytes(),D=M(g.context,H,_,m),q=I(P+D*N);ct("signature.s",q,pt,n);let V=vt(H,Ft(q,r.BYTES));return G("result",V,r.BYTES*2)}let Y=Mi;function E(m,h,g,v=Y){let{context:N,zip215:_}=v,P=r.BYTES;m=G("signature",m,2*P),h=G("message",h),g=G("publicKey",g,P),_!==void 0&&lt("zip215",_),o&&(h=o(h));let H=Nt(m.slice(P,2*P)),D,q,V;try{D=d.fromHex(g,_),q=d.fromHex(m.slice(0,P),_),V=A.multiplyUnsafe(H)}catch{return!1}if(!_&&D.isSmallOrder())return!1;let X=M(N,q.toRawBytes(),D.toRawBytes(),h);return q.add(D.multiplyUnsafe(X)).subtract(V).clearCofactor().equals(d.ZERO)}return A._setWindowSize(8),{CURVE:t,getPublicKey:z,sign:K,verify:E,ExtendedPoint:d,utils:{getExtendedPublicKey:T,randomPrivateKey:()=>i(r.BYTES),precompute(m=8,h=d.BASE){return h._setWindowSize(m),h.multiply(BigInt(3)),h}}}}var Pr=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),oo=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),qa=BigInt(0),ki=BigInt(1),so=BigInt(2),ka=BigInt(3),Vi=BigInt(5),zi=BigInt(8);function Fi(e){let t=BigInt(10),r=BigInt(20),n=BigInt(40),o=BigInt(80),s=Pr,c=e*e%s*e%s,a=Z(c,so,s)*c%s,l=Z(a,ki,s)*e%s,f=Z(l,Vi,s)*l%s,x=Z(f,t,s)*f%s,p=Z(x,r,s)*x%s,B=Z(p,n,s)*p%s,w=Z(B,o,s)*B%s,y=Z(w,o,s)*B%s,u=Z(y,t,s)*f%s;return{pow_p_5_8:Z(u,so,s)*e%s,b2:c}}function Zi(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}function Gi(e,t){let r=Pr,n=k(t*t*t,r),o=k(n*n*t,r),s=Fi(e*o).pow_p_5_8,i=k(e*n*s,r),c=k(t*i*i,r),a=i,l=k(i*oo,r),f=c===e,x=c===k(-e,r),p=c===k(-e*oo,r);return f&&(i=a),(x||p)&&(i=l),$n(i,r)&&(i=k(-i,r)),{isValid:f||x,value:i}}var ji=Dt(Pr,void 0,!0),Yi={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:ji,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:zi,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Gn,randomBytes:Me,adjustScalarBytes:Zi,uvRatio:Gi},io=no(Yi);var We=32;function co(e,t,r){return io.verify(t,r instanceof Uint8Array?r:r.subarray(),e)}var Xe=class{type="Ed25519";raw;constructor(t){this.raw=Kr(t,We)}toMultihash(){return wt.digest($e(this))}toCID(){return ht.createV1(114,this.toMultihash())}toString(){return Q.encode(this.toMultihash().bytes).substring(1)}equals(t){return t==null||!(t.raw instanceof Uint8Array)?!1:qt(this.raw,t.raw)}verify(t,r){return co(this.raw,r,t)}};function fo(e){return e=Kr(e,We),new Xe(e)}function Kr(e,t){if(e=Uint8Array.from(e??[]),e.length!==t)throw new Xt(`Key must be a Uint8Array of length ${t}, got ${e.length}`);return e}function At(e=0){return new Uint8Array(e)}var Xi=Math.pow(2,7),$i=Math.pow(2,14),Qi=Math.pow(2,21),uo=Math.pow(2,28),ho=Math.pow(2,35),lo=Math.pow(2,42),po=Math.pow(2,49),ot=128,Ot=127;function we(e){if(e<Xi)return 1;if(e<$i)return 2;if(e<Qi)return 3;if(e<uo)return 4;if(e<ho)return 5;if(e<lo)return 6;if(e<po)return 7;if(Number.MAX_SAFE_INTEGER!=null&&e>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function mo(e,t,r=0){switch(we(e)){case 8:t[r++]=e&255|ot,e/=128;case 7:t[r++]=e&255|ot,e/=128;case 6:t[r++]=e&255|ot,e/=128;case 5:t[r++]=e&255|ot,e/=128;case 4:t[r++]=e&255|ot,e>>>=7;case 3:t[r++]=e&255|ot,e>>>=7;case 2:t[r++]=e&255|ot,e>>>=7;case 1:{t[r++]=e&255,e>>>=7;break}default:throw new Error("unreachable")}return t}function xo(e,t){let r=e[t],n=0;if(n+=r&Ot,r<ot||(r=e[t+1],n+=(r&Ot)<<7,r<ot)||(r=e[t+2],n+=(r&Ot)<<14,r<ot)||(r=e[t+3],n+=(r&Ot)<<21,r<ot)||(r=e[t+4],n+=(r&Ot)*uo,r<ot)||(r=e[t+5],n+=(r&Ot)*ho,r<ot)||(r=e[t+6],n+=(r&Ot)*lo,r<ot)||(r=e[t+7],n+=(r&Ot)*po,r<ot))return n;throw new RangeError("Could not decode varint")}var Hr=new Float32Array([-0]),Pt=new Uint8Array(Hr.buffer);function yo(e,t,r){Hr[0]=e,t[r]=Pt[0],t[r+1]=Pt[1],t[r+2]=Pt[2],t[r+3]=Pt[3]}function go(e,t){return Pt[0]=e[t],Pt[1]=e[t+1],Pt[2]=e[t+2],Pt[3]=e[t+3],Hr[0]}var Mr=new Float64Array([-0]),rt=new Uint8Array(Mr.buffer);function bo(e,t,r){Mr[0]=e,t[r]=rt[0],t[r+1]=rt[1],t[r+2]=rt[2],t[r+3]=rt[3],t[r+4]=rt[4],t[r+5]=rt[5],t[r+6]=rt[6],t[r+7]=rt[7]}function wo(e,t){return rt[0]=e[t],rt[1]=e[t+1],rt[2]=e[t+2],rt[3]=e[t+3],rt[4]=e[t+4],rt[5]=e[t+5],rt[6]=e[t+6],rt[7]=e[t+7],Mr[0]}var Ji=BigInt(Number.MAX_SAFE_INTEGER),tc=BigInt(Number.MIN_SAFE_INTEGER),ft=class e{lo;hi;constructor(t,r){this.lo=t|0,this.hi=r|0}toNumber(t=!1){if(!t&&this.hi>>>31>0){let r=~this.lo+1>>>0,n=~this.hi>>>0;return r===0&&(n=n+1>>>0),-(r+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 r=~this.lo+1>>>0,n=~this.hi>>>0;return r===0&&(n=n+1>>>0),-(BigInt(r)+(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,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?t<16384?t<128?1:2:t<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}static fromBigInt(t){if(t===0n)return jt;if(t<Ji&&t>tc)return this.fromNumber(Number(t));let r=t<0n;r&&(t=-t);let n=t>>32n,o=t-(n<<32n);return r&&(n=~n|0n,o=~o|0n,++o>Eo&&(o=0n,++n>Eo&&(n=0n))),new e(Number(o),Number(n))}static fromNumber(t){if(t===0)return jt;let r=t<0;r&&(t=-t);let n=t>>>0,o=(t-n)/4294967296>>>0;return r&&(o=~o>>>0,n=~n>>>0,++n>4294967295&&(n=0,++o>4294967295&&(o=0))),new e(n,o)}static from(t){return typeof t=="number"?e.fromNumber(t):typeof t=="bigint"?e.fromBigInt(t):typeof t=="string"?e.fromBigInt(BigInt(t)):t.low!=null||t.high!=null?new e(t.low>>>0,t.high>>>0):jt}},jt=new ft(0,0);jt.toBigInt=function(){return 0n};jt.zzEncode=jt.zzDecode=function(){return this};jt.length=function(){return 1};var Eo=4294967296n;function Bo(e){let t=0,r=0;for(let n=0;n<e.length;++n)r=e.charCodeAt(n),r<128?t+=1:r<2048?t+=2:(r&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320?(++n,t+=4):t+=3;return t}function So(e,t,r){if(r-t<1)return"";let o,s=[],i=0,c;for(;t<r;)c=e[t++],c<128?s[i++]=c:c>191&&c<224?s[i++]=(c&31)<<6|e[t++]&63:c>239&&c<365?(c=((c&7)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63)-65536,s[i++]=55296+(c>>10),s[i++]=56320+(c&1023)):s[i++]=(c&15)<<12|(e[t++]&63)<<6|e[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 qr(e,t,r){let n=r,o,s;for(let i=0;i<e.length;++i)o=e.charCodeAt(i),o<128?t[r++]=o:o<2048?(t[r++]=o>>6|192,t[r++]=o&63|128):(o&64512)===55296&&((s=e.charCodeAt(i+1))&64512)===56320?(o=65536+((o&1023)<<10)+(s&1023),++i,t[r++]=o>>18|240,t[r++]=o>>12&63|128,t[r++]=o>>6&63|128,t[r++]=o&63|128):(t[r++]=o>>12|224,t[r++]=o>>6&63|128,t[r++]=o&63|128);return r-n}function mt(e,t){return RangeError(`index out of range: ${e.pos} + ${t??1} > ${e.len}`)}function Qe(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}var kr=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,mt(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 mt(this,4);return Qe(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw mt(this,4);return Qe(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw mt(this,4);let t=go(this.buf,this.pos);return this.pos+=4,t}double(){if(this.pos+8>this.len)throw mt(this,4);let t=wo(this.buf,this.pos);return this.pos+=8,t}bytes(){let t=this.uint32(),r=this.pos,n=this.pos+t;if(n>this.len)throw mt(this,t);return this.pos+=t,r===n?new Uint8Array(0):this.buf.subarray(r,n)}string(){let t=this.bytes();return So(t,0,t.length)}skip(t){if(typeof t=="number"){if(this.pos+t>this.len)throw mt(this,t);this.pos+=t}else do if(this.pos>=this.len)throw mt(this);while((this.buf[this.pos++]&128)!==0);return this}skipType(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${t} at offset ${this.pos}`)}return this}readLongVarint(){let t=new ft(0,0),r=0;if(this.len-this.pos>4){for(;r<4;++r)if(t.lo=(t.lo|(this.buf[this.pos]&127)<<r*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;r=0}else{for(;r<3;++r){if(this.pos>=this.len)throw mt(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<<r*7)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<<r*7)>>>0,t}if(this.len-this.pos>4){for(;r<5;++r)if(t.hi=(t.hi|(this.buf[this.pos]&127)<<r*7+3)>>>0,this.buf[this.pos++]<128)return t}else for(;r<5;++r){if(this.pos>=this.len)throw mt(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<<r*7+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw mt(this,8);let t=Qe(this.buf,this.pos+=4),r=Qe(this.buf,this.pos+=4);return new ft(t,r)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){let t=xo(this.buf,this.pos);return this.pos+=we(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 Vr(e){return new kr(e instanceof Uint8Array?e:e.subarray())}function Je(e,t,r){let n=Vr(e);return t.decode(n,void 0,r)}var zr={};it(zr,{base10:()=>ec});var ec=Rt({prefix:"9",name:"base10",alphabet:"0123456789"});var Fr={};it(Fr,{base16:()=>rc,base16upper:()=>nc});var rc=j({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),nc=j({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Zr={};it(Zr,{base2:()=>oc});var oc=j({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Gr={};it(Gr,{base256emoji:()=>fc});var Ao=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}"),sc=Ao.reduce((e,t,r)=>(e[r]=t,e),[]),ic=Ao.reduce((e,t,r)=>{let n=t.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${t}`);return e[n]=r,e},[]);function cc(e){return e.reduce((t,r)=>(t+=sc[r],t),"")}function ac(e){let t=[];for(let r of e){let n=r.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${r}`);let o=ic[n];if(o==null)throw new Error(`Non-base256emoji character: ${r}`);t.push(o)}return new Uint8Array(t)}var fc=Qt({prefix:"\u{1F680}",name:"base256emoji",encode:cc,decode:ac});var jr={};it(jr,{base64:()=>uc,base64pad:()=>hc,base64url:()=>dc,base64urlpad:()=>lc});var uc=j({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),hc=j({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),dc=j({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),lc=j({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Yr={};it(Yr,{base8:()=>pc});var pc=j({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Wr={};it(Wr,{identity:()=>mc});var mc=Qt({prefix:"\0",name:"identity",encode:e=>In(e),decode:e=>An(e)});var Af=new TextEncoder,If=new TextDecoder;var Qr={};it(Qr,{sha256:()=>Ee,sha512:()=>gc});function $r({name:e,code:t,encode:r}){return new Xr(e,t,r)}var Xr=class{name;code;encode;constructor(t,r,n){this.name=t,this.code=r,this.encode=n}digest(t){if(t instanceof Uint8Array){let r=this.encode(t);return r instanceof Uint8Array?Mt(this.code,r):r.then(n=>Mt(this.code,n))}else throw Error("Unknown type, must be binary type")}};function To(e){return async t=>new Uint8Array(await crypto.subtle.digest(e,t))}var Ee=$r({name:"sha2-256",code:18,encode:To("SHA-256")}),gc=$r({name:"sha2-512",code:19,encode:To("SHA-512")});var Jr={...Wr,...Zr,...Yr,...zr,...Fr,...mr,...xr,...pr,...jr,...Gr},Hf={...Qr,...br};function Lo(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}var Ro=Lo("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),tn=Lo("ascii","a",e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},e=>{e=e.substring(1);let t=At(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),bc={utf8:Ro,"utf-8":Ro,hex:Jr.base16,latin1:tn,ascii:tn,binary:tn,...Jr},tr=bc;function Be(e,t="utf8"){let r=tr[t];if(r==null)throw new Error(`Unsupported encoding "${t}"`);return r.decoder.decode(`${r.prefix}${e}`)}function en(e){let t=e??8192,r=t>>>1,n,o=t;return function(i){if(i<1||i>r)return At(i);o+i>t&&(n=At(t),o=0);let c=n.subarray(o,o+=i);return(o&7)!==0&&(o=(o|7)+1),c}}var Yt=class{fn;len;next;val;constructor(t,r,n){this.fn=t,this.len=r,this.next=void 0,this.val=n}};function rn(){}var on=class{head;tail;len;next;constructor(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}},wc=en();function Ec(e){return globalThis.Buffer!=null?At(e):wc(e)}var ve=class{len;head;tail;states;constructor(){this.len=0,this.head=new Yt(rn,0,0),this.tail=this.head,this.states=null}_push(t,r,n){return this.tail=this.tail.next=new Yt(t,r,n),this.len+=r,this}uint32(t){return this.len+=(this.tail=this.tail.next=new sn((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(er,10,ft.fromNumber(t)):this.uint32(t)}sint32(t){return this.uint32((t<<1^t>>31)>>>0)}uint64(t){let r=ft.fromBigInt(t);return this._push(er,r.length(),r)}uint64Number(t){return this._push(mo,we(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 r=ft.fromBigInt(t).zzEncode();return this._push(er,r.length(),r)}sint64Number(t){let r=ft.fromNumber(t).zzEncode();return this._push(er,r.length(),r)}sint64String(t){return this.sint64(BigInt(t))}bool(t){return this._push(nn,1,t?1:0)}fixed32(t){return this._push(Se,4,t>>>0)}sfixed32(t){return this.fixed32(t)}fixed64(t){let r=ft.fromBigInt(t);return this._push(Se,4,r.lo)._push(Se,4,r.hi)}fixed64Number(t){let r=ft.fromNumber(t);return this._push(Se,4,r.lo)._push(Se,4,r.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(yo,4,t)}double(t){return this._push(bo,8,t)}bytes(t){let r=t.length>>>0;return r===0?this._push(nn,1,0):this.uint32(r)._push(Sc,r,t)}string(t){let r=Bo(t);return r!==0?this.uint32(r)._push(qr,r,t):this._push(nn,1,0)}fork(){return this.states=new on(this),this.head=this.tail=new Yt(rn,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 Yt(rn,0,0),this.len=0),this}ldelim(){let t=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=t.next,this.tail=r,this.len+=n),this}finish(){let t=this.head.next,r=Ec(this.len),n=0;for(;t!=null;)t.fn(t.val,r,n),n+=t.len,t=t.next;return r}};function nn(e,t,r){t[r]=e&255}function Bc(e,t,r){for(;e>127;)t[r++]=e&127|128,e>>>=7;t[r]=e}var sn=class extends Yt{next;constructor(t,r){super(Bc,t,r),this.next=void 0}};function er(e,t,r){for(;e.hi!==0;)t[r++]=e.lo&127|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=e.lo&127|128,e.lo=e.lo>>>7;t[r++]=e.lo}function Se(e,t,r){t[r]=e&255,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function Sc(e,t,r){t.set(e,r)}globalThis.Buffer!=null&&(ve.prototype.bytes=function(e){let t=e.length>>>0;return this.uint32(t),t>0&&this._push(vc,t,e),this},ve.prototype.string=function(e){let t=globalThis.Buffer.byteLength(e);return this.uint32(t),t>0&&this._push(Ac,t,e),this});function vc(e,t,r){t.set(e,r)}function Ac(e,t,r){e.length<40?qr(e,t,r):t.utf8Write!=null?t.utf8Write(e,r):t.set(Be(e),r)}function cn(){return new ve}function rr(e,t){let r=cn();return t.encode(e,r,{lengthDelimited:!1}),r.finish()}var fe;(function(e){e[e.VARINT=0]="VARINT",e[e.BIT64=1]="BIT64",e[e.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",e[e.START_GROUP=3]="START_GROUP",e[e.END_GROUP=4]="END_GROUP",e[e.BIT32=5]="BIT32"})(fe||(fe={}));function nr(e,t,r,n){return{name:e,type:t,encode:r,decode:n}}function an(e){function t(o){if(e[o.toString()]==null)throw new Error("Invalid enum value");return e[o]}let r=function(s,i){let c=t(s);i.int32(c)},n=function(s){let i=s.int32();return t(i)};return nr("enum",fe.VARINT,r,n)}function or(e,t){return nr("message",fe.LENGTH_DELIMITED,e,t)}var ut;(function(e){e.RSA="RSA",e.Ed25519="Ed25519",e.secp256k1="secp256k1"})(ut||(ut={}));var fn;(function(e){e[e.RSA=0]="RSA",e[e.Ed25519=1]="Ed25519",e[e.secp256k1=2]="secp256k1"})(fn||(fn={}));(function(e){e.codec=()=>an(fn)})(ut||(ut={}));var Ae;(function(e){let t;e.codec=()=>(t==null&&(t=or((r,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),r.Type!=null&&(n.uint32(8),ut.codec().encode(r.Type,n)),r.Data!=null&&(n.uint32(18),n.bytes(r.Data)),o.lengthDelimited!==!1&&n.ldelim()},(r,n,o={})=>{let s={},i=n==null?r.len:r.pos+n;for(;r.pos<i;){let c=r.uint32();switch(c>>>3){case 1:{s.Type=ut.codec().decode(r);break}case 2:{s.Data=r.bytes();break}default:{r.skipType(c&7);break}}}return s})),t),e.encode=r=>rr(r,e.codec()),e.decode=(r,n)=>Je(r,e.codec(),n)})(Ae||(Ae={}));var un;(function(e){let t;e.codec=()=>(t==null&&(t=or((r,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),r.Type!=null&&(n.uint32(8),ut.codec().encode(r.Type,n)),r.Data!=null&&(n.uint32(18),n.bytes(r.Data)),o.lengthDelimited!==!1&&n.ldelim()},(r,n,o={})=>{let s={},i=n==null?r.len:r.pos+n;for(;r.pos<i;){let c=r.uint32();switch(c>>>3){case 1:{s.Type=ut.codec().decode(r);break}case 2:{s.Data=r.bytes();break}default:{r.skipType(c&7);break}}}return s})),t),e.encode=r=>rr(r,e.codec()),e.decode=(r,n)=>Je(r,e.codec(),n)})(un||(un={}));var Tc=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Kt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ht=new Uint32Array(64),hn=class extends ce{constructor(){super(64,32,8,!1),this.A=Kt[0]|0,this.B=Kt[1]|0,this.C=Kt[2]|0,this.D=Kt[3]|0,this.E=Kt[4]|0,this.F=Kt[5]|0,this.G=Kt[6]|0,this.H=Kt[7]|0}get(){let{A:t,B:r,C:n,D:o,E:s,F:i,G:c,H:a}=this;return[t,r,n,o,s,i,c,a]}set(t,r,n,o,s,i,c,a){this.A=t|0,this.B=r|0,this.C=n|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=c|0,this.H=a|0}process(t,r){for(let x=0;x<16;x++,r+=4)Ht[x]=t.getUint32(r,!1);for(let x=16;x<64;x++){let p=Ht[x-15],B=Ht[x-2],w=dt(p,7)^dt(p,18)^p>>>3,y=dt(B,17)^dt(B,19)^B>>>10;Ht[x]=y+Ht[x-7]+w+Ht[x-16]|0}let{A:n,B:o,C:s,D:i,E:c,F:a,G:l,H:f}=this;for(let x=0;x<64;x++){let p=dt(c,6)^dt(c,11)^dt(c,25),B=f+p+zn(c,a,l)+Tc[x]+Ht[x]|0,y=(dt(n,2)^dt(n,13)^dt(n,22))+Fn(n,o,s)|0;f=l,l=a,a=c,c=i+B|0,i=s,s=o,o=n,n=B+y|0}n=n+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,c=c+this.E|0,a=a+this.F|0,l=l+this.G|0,f=f+this.H|0,this.set(n,o,s,i,c,a,l,f)}roundClean(){Ht.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var Uo=He(()=>new hn);function Ie(e,t="utf8"){let r=tr[t];if(r==null)throw new Error(`Unsupported encoding "${t}"`);return r.encoder.encode(e).substring(1)}var Te=class extends Error{constructor(t="An error occurred while verifying a message"){super(t),this.name="VerificationError"}};var sr=class extends ie{constructor(t,r){super(),this.finished=!1,this.destroyed=!1,qn(t);let n=xe(r);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 se(this),this.iHash.update(t),this}digestInto(t){se(this),oe(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:r,iHash:n,finished:o,destroyed:s,blockLen:i,outputLen:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=c,t.oHash=r._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},dn=(e,t,r)=>new sr(e,t).update(r).digest();dn.create=(e,t)=>new sr(e,t);function Co(e){e.lowS!==void 0&&lt("lowS",e.lowS),e.prehash!==void 0&&lt("prehash",e.prehash)}function Rc(e){let t=be(e);yt(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:r,Fp:n,a:o}=t;if(r){if(!n.eql(o,n.ZERO))throw new Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if(typeof r!="object"||typeof r.beta!="bigint"||typeof r.splitScalar!="function")throw new Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...t})}var{bytesToNumberBE:Lc,hexToBytes:Uc}=ze,ln=class extends Error{constructor(t=""){super(t)}},It={Err:ln,_tlv:{encode:(e,t)=>{let{Err:r}=It;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length&1)throw new r("tlv.encode: unpadded data");let n=t.length/2,o=Vt(n);if(o.length/2&128)throw new r("tlv.encode: long form length too big");let s=n>127?Vt(o.length/2|128):"";return Vt(e)+s+o+t},decode(e,t){let{Err:r}=It,n=0;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length<2||t[n++]!==e)throw new r("tlv.decode: wrong tlv");let o=t[n++],s=!!(o&128),i=0;if(!s)i=o;else{let a=o&127;if(!a)throw new r("tlv.decode(long): indefinite length not supported");if(a>4)throw new r("tlv.decode(long): byte length is too big");let l=t.subarray(n,n+a);if(l.length!==a)throw new r("tlv.decode: length bytes not complete");if(l[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(let f of l)i=i<<8|f;if(n+=a,i<128)throw new r("tlv.decode(long): not minimal encoding")}let c=t.subarray(n,n+i);if(c.length!==i)throw new r("tlv.decode: wrong value length");return{v:c,l:t.subarray(n+i)}}},_int:{encode(e){let{Err:t}=It;if(e<Tt)throw new t("integer: negative integers are not allowed");let r=Vt(e);if(Number.parseInt(r[0],16)&8&&(r="00"+r),r.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return r},decode(e){let{Err:t}=It;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return Lc(e)}},toSig(e){let{Err:t,_int:r,_tlv:n}=It,o=typeof e=="string"?Uc(e):e;ae(o);let{v:s,l:i}=n.decode(48,o);if(i.length)throw new t("invalid signature: left bytes after parsing");let{v:c,l:a}=n.decode(2,s),{v:l,l:f}=n.decode(2,a);if(f.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(c),s:r.decode(l)}},hexFromSig(e){let{_tlv:t,_int:r}=It,n=t.encode(2,r.encode(e.r)),o=t.encode(2,r.encode(e.s)),s=n+o;return t.encode(48,s)}},Tt=BigInt(0),J=BigInt(1),Nu=BigInt(2),No=BigInt(3),_u=BigInt(4);function Cc(e){let t=Rc(e),{Fp:r}=t,n=Dt(t.n,t.nBitLength),o=t.toBytes||((y,u,b)=>{let S=u.toAffine();return vt(Uint8Array.from([4]),r.toBytes(S.x),r.toBytes(S.y))}),s=t.fromBytes||(y=>{let u=y.subarray(1),b=r.fromBytes(u.subarray(0,r.BYTES)),S=r.fromBytes(u.subarray(r.BYTES,2*r.BYTES));return{x:b,y:S}});function i(y){let{a:u,b}=t,S=r.sqr(y),d=r.mul(S,y);return r.add(r.add(d,r.mul(y,u)),b)}if(!r.eql(r.sqr(t.Gy),i(t.Gx)))throw new Error("bad generator point: equation left != right");function c(y){return ye(y,J,t.n)}function a(y){let{allowedPrivateKeyLengths:u,nByteLength:b,wrapPrivateKey:S,n:d}=t;if(u&&typeof y!="bigint"){if(Ct(y)&&(y=Bt(y)),typeof y!="string"||!u.includes(y.length))throw new Error("invalid private key");y=y.padStart(b*2,"0")}let A;try{A=typeof y=="bigint"?y:St(G("private key",y,b))}catch{throw new Error("invalid private key, expected hex or "+b+" bytes, got "+typeof y)}return S&&(A=k(A,d)),ct("private key",A,J,d),A}function l(y){if(!(y instanceof p))throw new Error("ProjectivePoint expected")}let f=Zt((y,u)=>{let{px:b,py:S,pz:d}=y;if(r.eql(d,r.ONE))return{x:b,y:S};let A=y.is0();u==null&&(u=A?r.ONE:r.inv(d));let C=r.mul(b,u),U=r.mul(S,u),I=r.mul(d,u);if(A)return{x:r.ZERO,y:r.ZERO};if(!r.eql(I,r.ONE))throw new Error("invZ was invalid");return{x:C,y:U}}),x=Zt(y=>{if(y.is0()){if(t.allowInfinityPoint&&!r.is0(y.py))return;throw new Error("bad point: ZERO")}let{x:u,y:b}=y.toAffine();if(!r.isValid(u)||!r.isValid(b))throw new Error("bad point: x or y not FE");let S=r.sqr(b),d=i(u);if(!r.eql(S,d))throw new Error("bad point: equation left != right");if(!y.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class p{constructor(u,b,S){if(this.px=u,this.py=b,this.pz=S,u==null||!r.isValid(u))throw new Error("x required");if(b==null||!r.isValid(b))throw new Error("y required");if(S==null||!r.isValid(S))throw new Error("z required");Object.freeze(this)}static fromAffine(u){let{x:b,y:S}=u||{};if(!u||!r.isValid(b)||!r.isValid(S))throw new Error("invalid affine point");if(u instanceof p)throw new Error("projective point not allowed");let d=A=>r.eql(A,r.ZERO);return d(b)&&d(S)?p.ZERO:new p(b,S,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(u){let b=r.invertBatch(u.map(S=>S.pz));return u.map((S,d)=>S.toAffine(b[d])).map(p.fromAffine)}static fromHex(u){let b=p.fromAffine(s(G("pointHex",u)));return b.assertValidity(),b}static fromPrivateKey(u){return p.BASE.multiply(a(u))}static msm(u,b){return je(p,n,u,b)}_setWindowSize(u){w.setWindowSize(this,u)}assertValidity(){x(this)}hasEvenY(){let{y:u}=this.toAffine();if(r.isOdd)return!r.isOdd(u);throw new Error("Field doesn't support isOdd")}equals(u){l(u);let{px:b,py:S,pz:d}=this,{px:A,py:C,pz:U}=u,I=r.eql(r.mul(b,U),r.mul(A,d)),L=r.eql(r.mul(S,U),r.mul(C,d));return I&&L}negate(){return new p(this.px,r.neg(this.py),this.pz)}double(){let{a:u,b}=t,S=r.mul(b,No),{px:d,py:A,pz:C}=this,U=r.ZERO,I=r.ZERO,L=r.ZERO,T=r.mul(d,d),z=r.mul(A,A),M=r.mul(C,C),K=r.mul(d,A);return K=r.add(K,K),L=r.mul(d,C),L=r.add(L,L),U=r.mul(u,L),I=r.mul(S,M),I=r.add(U,I),U=r.sub(z,I),I=r.add(z,I),I=r.mul(U,I),U=r.mul(K,U),L=r.mul(S,L),M=r.mul(u,M),K=r.sub(T,M),K=r.mul(u,K),K=r.add(K,L),L=r.add(T,T),T=r.add(L,T),T=r.add(T,M),T=r.mul(T,K),I=r.add(I,T),M=r.mul(A,C),M=r.add(M,M),T=r.mul(M,K),U=r.sub(U,T),L=r.mul(M,z),L=r.add(L,L),L=r.add(L,L),new p(U,I,L)}add(u){l(u);let{px:b,py:S,pz:d}=this,{px:A,py:C,pz:U}=u,I=r.ZERO,L=r.ZERO,T=r.ZERO,z=t.a,M=r.mul(t.b,No),K=r.mul(b,A),Y=r.mul(S,C),E=r.mul(d,U),R=r.add(b,S),m=r.add(A,C);R=r.mul(R,m),m=r.add(K,Y),R=r.sub(R,m),m=r.add(b,d);let h=r.add(A,U);return m=r.mul(m,h),h=r.add(K,E),m=r.sub(m,h),h=r.add(S,d),I=r.add(C,U),h=r.mul(h,I),I=r.add(Y,E),h=r.sub(h,I),T=r.mul(z,m),I=r.mul(M,E),T=r.add(I,T),I=r.sub(Y,T),T=r.add(Y,T),L=r.mul(I,T),Y=r.add(K,K),Y=r.add(Y,K),E=r.mul(z,E),m=r.mul(M,m),Y=r.add(Y,E),E=r.sub(K,E),E=r.mul(z,E),m=r.add(m,E),K=r.mul(Y,m),L=r.add(L,K),K=r.mul(h,m),I=r.mul(R,I),I=r.sub(I,K),K=r.mul(R,Y),T=r.mul(h,T),T=r.add(T,K),new p(I,L,T)}subtract(u){return this.add(u.negate())}is0(){return this.equals(p.ZERO)}wNAF(u){return w.wNAFCached(this,u,p.normalizeZ)}multiplyUnsafe(u){let{endo:b,n:S}=t;ct("scalar",u,Tt,S);let d=p.ZERO;if(u===Tt)return d;if(this.is0()||u===J)return this;if(!b||w.hasPrecomputes(this))return w.wNAFCachedUnsafe(this,u,p.normalizeZ);let{k1neg:A,k1:C,k2neg:U,k2:I}=b.splitScalar(u),L=d,T=d,z=this;for(;C>Tt||I>Tt;)C&J&&(L=L.add(z)),I&J&&(T=T.add(z)),z=z.double(),C>>=J,I>>=J;return A&&(L=L.negate()),U&&(T=T.negate()),T=new p(r.mul(T.px,b.beta),T.py,T.pz),L.add(T)}multiply(u){let{endo:b,n:S}=t;ct("scalar",u,J,S);let d,A;if(b){let{k1neg:C,k1:U,k2neg:I,k2:L}=b.splitScalar(u),{p:T,f:z}=this.wNAF(U),{p:M,f:K}=this.wNAF(L);T=w.constTimeNegate(C,T),M=w.constTimeNegate(I,M),M=new p(r.mul(M.px,b.beta),M.py,M.pz),d=T.add(M),A=z.add(K)}else{let{p:C,f:U}=this.wNAF(u);d=C,A=U}return p.normalizeZ([d,A])[0]}multiplyAndAddUnsafe(u,b,S){let d=p.BASE,A=(U,I)=>I===Tt||I===J||!U.equals(d)?U.multiplyUnsafe(I):U.multiply(I),C=A(this,b).add(A(u,S));return C.is0()?void 0:C}toAffine(u){return f(this,u)}isTorsionFree(){let{h:u,isTorsionFree:b}=t;if(u===J)return!0;if(b)return b(p,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:u,clearCofactor:b}=t;return u===J?this:b?b(p,this):this.multiplyUnsafe(t.h)}toRawBytes(u=!0){return lt("isCompressed",u),this.assertValidity(),o(p,this,u)}toHex(u=!0){return lt("isCompressed",u),Bt(this.toRawBytes(u))}}p.BASE=new p(t.Gx,t.Gy,r.ONE),p.ZERO=new p(r.ZERO,r.ONE,r.ZERO);let B=t.nBitLength,w=Ge(p,t.endo?Math.ceil(B/2):B);return{CURVE:t,ProjectivePoint:p,normPrivateKeyToScalar:a,weierstrassEquation:i,isWithinCurveOrder:c}}function Nc(e){let t=be(e);return yt(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function _o(e){let t=Nc(e),{Fp:r,n}=t,o=r.BYTES+1,s=2*r.BYTES+1;function i(E){return k(E,n)}function c(E){return Fe(E,n)}let{ProjectivePoint:a,normPrivateKeyToScalar:l,weierstrassEquation:f,isWithinCurveOrder:x}=Cc({...t,toBytes(E,R,m){let h=R.toAffine(),g=r.toBytes(h.x),v=vt;return lt("isCompressed",m),m?v(Uint8Array.from([R.hasEvenY()?2:3]),g):v(Uint8Array.from([4]),g,r.toBytes(h.y))},fromBytes(E){let R=E.length,m=E[0],h=E.subarray(1);if(R===o&&(m===2||m===3)){let g=St(h);if(!ye(g,J,r.ORDER))throw new Error("Point is not on curve");let v=f(g),N;try{N=r.sqrt(v)}catch(H){let D=H instanceof Error?": "+H.message:"";throw new Error("Point is not on curve"+D)}let _=(N&J)===J;return(m&1)===1!==_&&(N=r.neg(N)),{x:g,y:N}}else if(R===s&&m===4){let g=r.fromBytes(h.subarray(0,r.BYTES)),v=r.fromBytes(h.subarray(r.BYTES,2*r.BYTES));return{x:g,y:v}}else{let g=o,v=s;throw new Error("invalid Point, expected length of "+g+", or uncompressed "+v+", got "+R)}}}),p=E=>Bt(_t(E,t.nByteLength));function B(E){let R=n>>J;return E>R}function w(E){return B(E)?i(-E):E}let y=(E,R,m)=>St(E.slice(R,m));class u{constructor(R,m,h){this.r=R,this.s=m,this.recovery=h,this.assertValidity()}static fromCompact(R){let m=t.nByteLength;return R=G("compactSignature",R,m*2),new u(y(R,0,m),y(R,m,2*m))}static fromDER(R){let{r:m,s:h}=It.toSig(G("DER",R));return new u(m,h)}assertValidity(){ct("r",this.r,J,n),ct("s",this.s,J,n)}addRecoveryBit(R){return new u(this.r,this.s,R)}recoverPublicKey(R){let{r:m,s:h,recovery:g}=this,v=U(G("msgHash",R));if(g==null||![0,1,2,3].includes(g))throw new Error("recovery id invalid");let N=g===2||g===3?m+t.n:m;if(N>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");let _=(g&1)===0?"02":"03",P=a.fromHex(_+p(N)),H=c(N),D=i(-v*H),q=i(h*H),V=a.BASE.multiplyAndAddUnsafe(P,D,q);if(!V)throw new Error("point at infinify");return V.assertValidity(),V}hasHighS(){return B(this.s)}normalizeS(){return this.hasHighS()?new u(this.r,i(-this.s),this.recovery):this}toDERRawBytes(){return zt(this.toDERHex())}toDERHex(){return It.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return zt(this.toCompactHex())}toCompactHex(){return p(this.r)+p(this.s)}}let b={isValidPrivateKey(E){try{return l(E),!0}catch{return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{let E=Cr(t.n);return Jn(t.randomBytes(E),t.n)},precompute(E=8,R=a.BASE){return R._setWindowSize(E),R.multiply(BigInt(3)),R}};function S(E,R=!0){return a.fromPrivateKey(E).toRawBytes(R)}function d(E){let R=Ct(E),m=typeof E=="string",h=(R||m)&&E.length;return R?h===o||h===s:m?h===2*o||h===2*s:E instanceof a}function A(E,R,m=!0){if(d(E))throw new Error("first arg must be private key");if(!d(R))throw new Error("second arg must be public key");return a.fromHex(R).multiply(l(E)).toRawBytes(m)}let C=t.bits2int||function(E){if(E.length>8192)throw new Error("input is too large");let R=St(E),m=E.length*8-t.nBitLength;return m>0?R>>BigInt(m):R},U=t.bits2int_modN||function(E){return i(C(E))},I=ge(t.nBitLength);function L(E){return ct("num < 2^"+t.nBitLength,E,Tt,I),_t(E,t.nByteLength)}function T(E,R,m=z){if(["recovered","canonical"].some($=>$ in m))throw new Error("sign() legacy options not supported");let{hash:h,randomBytes:g}=t,{lowS:v,prehash:N,extraEntropy:_}=m;v==null&&(v=!0),E=G("msgHash",E),Co(m),N&&(E=G("prehashed msgHash",h(E)));let P=U(E),H=l(R),D=[L(H),L(P)];if(_!=null&&_!==!1){let $=_===!0?g(r.BYTES):_;D.push(G("extraEntropy",$))}let q=vt(...D),V=P;function X($){let tt=C($);if(!x(tt))return;let et=c(tt),st=a.BASE.multiply(tt).toAffine(),nt=i(st.x);if(nt===Tt)return;let xt=i(et*i(V+nt*H));if(xt===Tt)return;let gt=(st.x===nt?0:2)|Number(st.y&J),ue=xt;return v&&B(xt)&&(ue=w(xt),gt^=1),new u(nt,ue,gt)}return{seed:q,k2sig:X}}let z={lowS:t.lowS,prehash:!1},M={lowS:t.lowS,prehash:!1};function K(E,R,m=z){let{seed:h,k2sig:g}=T(E,R,m),v=t;return Tr(v.hash.outputLen,v.nByteLength,v.hmac)(h,g)}a.BASE._setWindowSize(8);function Y(E,R,m,h=M){let g=E;R=G("msgHash",R),m=G("publicKey",m);let{lowS:v,prehash:N,format:_}=h;if(Co(h),"strict"in h)throw new Error("options.strict was renamed to lowS");if(_!==void 0&&_!=="compact"&&_!=="der")throw new Error("format must be compact or der");let P=typeof g=="string"||Ct(g),H=!P&&!_&&typeof g=="object"&&g!==null&&typeof g.r=="bigint"&&typeof g.s=="bigint";if(!P&&!H)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let D,q;try{if(H&&(D=new u(g.r,g.s)),P){try{_!=="compact"&&(D=u.fromDER(g))}catch(gt){if(!(gt instanceof It.Err))throw gt}!D&&_!=="der"&&(D=u.fromCompact(g))}q=a.fromHex(m)}catch{return!1}if(!D||v&&D.hasHighS())return!1;N&&(R=t.hash(R));let{r:V,s:X}=D,$=U(R),tt=c(X),et=i($*tt),st=i(V*tt),nt=a.BASE.multiplyAndAddUnsafe(q,et,st)?.toAffine();return nt?i(nt.x)===V:!1}return{CURVE:t,getPublicKey:S,getSharedSecret:A,sign:K,verify:Y,ProjectivePoint:a,Signature:u,utils:b}}function _c(e){return{hash:e,hmac:(t,...r)=>dn(e,t,wr(...r)),randomBytes:Me}}function Do(e,t){let r=n=>_o({...e,..._c(n)});return{...r(t),create:r}}var Ko=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Oo=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Dc=BigInt(1),pn=BigInt(2),Po=(e,t)=>(e+t/pn)/t;function Oc(e){let t=Ko,r=BigInt(3),n=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),c=BigInt(44),a=BigInt(88),l=e*e*e%t,f=l*l*e%t,x=Z(f,r,t)*f%t,p=Z(x,r,t)*f%t,B=Z(p,pn,t)*l%t,w=Z(B,o,t)*B%t,y=Z(w,s,t)*w%t,u=Z(y,c,t)*y%t,b=Z(u,a,t)*u%t,S=Z(b,c,t)*y%t,d=Z(S,r,t)*f%t,A=Z(d,i,t)*w%t,C=Z(A,n,t)*l%t,U=Z(C,pn,t);if(!mn.eql(mn.sqr(U),e))throw new Error("Cannot find square root");return U}var mn=Dt(Ko,void 0,void 0,{sqrt:Oc}),Wt=Do({a:BigInt(0),b:BigInt(7),Fp:mn,n:Oo,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{let t=Oo,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-Dc*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,i=BigInt("0x100000000000000000000000000000000"),c=Po(s*e,t),a=Po(-n*e,t),l=k(e-c*r-a*o,t),f=k(-c*n-a*s,t),x=l>i,p=f>i;if(x&&(l=t-l),p&&(f=t-f),l>i||f>i)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:x,k1:l,k2neg:p,k2:f}}}},Uo),Vu=BigInt(0);var zu=Wt.ProjectivePoint;function Ho(e){return e==null?!1:typeof e.then=="function"&&typeof e.catch=="function"&&typeof e.finally=="function"}function Mo(e,t,r){let n=Ee.digest(r instanceof Uint8Array?r:r.subarray());if(Ho(n))return n.then(({digest:o})=>Wt.verify(t,o,e)).catch(o=>{throw new Te(String(o))});try{return Wt.verify(t,n.digest,e)}catch(o){throw new Te(String(o))}}var ir=class{type="secp256k1";raw;_key;constructor(t){this._key=ko(t),this.raw=qo(this._key)}toMultihash(){return wt.digest($e(this))}toCID(){return ht.createV1(114,this.toMultihash())}toString(){return Q.encode(this.toMultihash().bytes).substring(1)}equals(t){return t==null||!(t.raw instanceof Uint8Array)?!1:qt(this.raw,t.raw)}verify(t,r){return Mo(this._key,r,t)}};function Vo(e){return new ir(e)}function qo(e){return Wt.ProjectivePoint.fromHex(e).toRawBytes(!0)}function ko(e){try{return Wt.ProjectivePoint.fromHex(e),e}catch(t){throw new _e(String(t))}}function zo(e){let{Type:t,Data:r}=Ae.decode(e.digest),n=r??new Uint8Array;switch(t){case ut.Ed25519:return fo(n);case ut.secp256k1:return Vo(n);default:throw new $t}}function $e(e){return Ae.encode({Type:ut[e.type],Data:e.raw})}var Fo=Symbol.for("nodejs.util.inspect.custom"),Pc=114,Re=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()})`}[fr]=!0;toString(){return this.string==null&&(this.string=Q.encode(this.multihash.bytes).slice(1)),this.string}toMultihash(){return this.multihash}toCID(){return ht.createV1(Pc,this.multihash)}toJSON(){return this.toString()}equals(t){if(t==null)return!1;if(t instanceof Uint8Array)return qt(this.multihash.bytes,t);if(typeof t=="string")return this.toString()===t;if(t?.toMultihash()?.bytes!=null)return qt(this.multihash.bytes,t.toMultihash().bytes);throw new Error("not valid Id")}[Fo](){return`PeerId(${this.toString()})`}},Le=class extends Re{type="RSA";publicKey;constructor(t){super({...t,type:"RSA"}),this.publicKey=t.publicKey}},Ue=class extends Re{type="Ed25519";publicKey;constructor(t){super({...t,type:"Ed25519"}),this.publicKey=t.publicKey}},Ce=class extends Re{type="secp256k1";publicKey;constructor(t){super({...t,type:"secp256k1"}),this.publicKey=t.publicKey}},Kc=2336,Ne=class{type="url";multihash;publicKey;url;constructor(t){this.url=t.toString(),this.multihash=wt.digest(Be(this.url))}[Fo](){return`PeerId(${this.url})`}[fr]=!0;toString(){return this.toCID().toString()}toMultihash(){return this.multihash}toCID(){return ht.createV1(Kc,this.toMultihash())}toJSON(){return this.toString()}equals(t){return t==null?!1:(t instanceof Uint8Array&&(t=Ie(t)),t.toString()===this.toString())}};var Hc=114,Zo=2336;function Mc(e,t){let r;if(e.charAt(0)==="1"||e.charAt(0)==="Q")r=pe(Q.decode(`z${e}`));else{if(t==null)throw new Xt('Please pass a multibase decoder for strings that do not start with "1" or "Q"');r=pe(t.decode(e))}return xn(r)}function Go(e){if(e.type==="Ed25519")return new Ue({multihash:e.toCID().multihash,publicKey:e});if(e.type==="secp256k1")return new Ce({multihash:e.toCID().multihash,publicKey:e});if(e.type==="RSA")return new Le({multihash:e.toCID().multihash,publicKey:e});throw new $t}function qc(e){return Go(e.publicKey)}function xn(e){if(zc(e))return new Le({multihash:e});if(Vc(e))try{let t=zo(e);if(t.type==="Ed25519")return new Ue({multihash:e,publicKey:t});if(t.type==="secp256k1")return new Ce({multihash:e,publicKey:t})}catch{let r=Ie(e.digest);return new Ne(new URL(r))}throw new Oe("Supplied PeerID Multihash is invalid")}function kc(e){if(e?.multihash==null||e.version==null||e.version===1&&e.code!==Hc&&e.code!==Zo)throw new De("Supplied PeerID CID is invalid");if(e.code===Zo){let t=Ie(e.multihash.digest);return new Ne(new URL(t))}return xn(e.multihash)}function Vc(e){return e.code===wt.code}function zc(e){return e.code===Ee.code}return ss(Fc);})();
3
3
  /*! Bundled license information:
4
4
 
5
5
  @noble/hashes/esm/utils.js:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/peer-id",
3
- "version": "5.0.14",
3
+ "version": "5.0.15-2fbcdb687",
4
4
  "description": "Implementation of @libp2p/interface-peer-id",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/peer-id#readme",
@@ -54,8 +54,8 @@
54
54
  "test:electron-main": "aegir test -t electron-main"
55
55
  },
56
56
  "dependencies": {
57
- "@libp2p/crypto": "^5.0.13",
58
- "@libp2p/interface": "^2.6.1",
57
+ "@libp2p/crypto": "5.0.14-2fbcdb687",
58
+ "@libp2p/interface": "2.6.1-2fbcdb687",
59
59
  "multiformats": "^13.3.1",
60
60
  "uint8arrays": "^5.1.0"
61
61
  },
@@ -1,12 +0,0 @@
1
- {
2
- "peerIdFromCID": "https://libp2p.github.io/js-libp2p/functions/_libp2p_peer_id.peerIdFromCID.html",
3
- ".:peerIdFromCID": "https://libp2p.github.io/js-libp2p/functions/_libp2p_peer_id.peerIdFromCID.html",
4
- "peerIdFromMultihash": "https://libp2p.github.io/js-libp2p/functions/_libp2p_peer_id.peerIdFromMultihash.html",
5
- ".:peerIdFromMultihash": "https://libp2p.github.io/js-libp2p/functions/_libp2p_peer_id.peerIdFromMultihash.html",
6
- "peerIdFromPrivateKey": "https://libp2p.github.io/js-libp2p/functions/_libp2p_peer_id.peerIdFromPrivateKey.html",
7
- ".:peerIdFromPrivateKey": "https://libp2p.github.io/js-libp2p/functions/_libp2p_peer_id.peerIdFromPrivateKey.html",
8
- "peerIdFromPublicKey": "https://libp2p.github.io/js-libp2p/functions/_libp2p_peer_id.peerIdFromPublicKey.html",
9
- ".:peerIdFromPublicKey": "https://libp2p.github.io/js-libp2p/functions/_libp2p_peer_id.peerIdFromPublicKey.html",
10
- "peerIdFromString": "https://libp2p.github.io/js-libp2p/functions/_libp2p_peer_id.peerIdFromString.html",
11
- ".:peerIdFromString": "https://libp2p.github.io/js-libp2p/functions/_libp2p_peer_id.peerIdFromString.html"
12
- }