@libp2p/circuit-relay-v2 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.min.js +1 -1
- package/package.json +11 -11
package/dist/index.min.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PCircuitRelayV2 = factory()}(typeof self !== 'undefined' ? self : this, function () {
|
2
|
-
"use strict";var Libp2PCircuitRelayV2=(()=>{var ef=Object.create;var In=Object.defineProperty;var tf=Object.getOwnPropertyDescriptor;var rf=Object.getOwnPropertyNames;var nf=Object.getPrototypeOf,sf=Object.prototype.hasOwnProperty;var di=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),ge=(r,e)=>{for(var t in e)In(r,t,{get:e[t],enumerable:!0})},Ra=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of rf(e))!sf.call(r,s)&&s!==t&&In(r,s,{get:()=>e[s],enumerable:!(n=tf(e,s))||n.enumerable});return r};var pi=(r,e,t)=>(t=r!=null?ef(nf(r)):{},Ra(e||!r||!r.__esModule?In(t,"default",{value:r,enumerable:!0}):t,r)),of=r=>Ra(In({},"__esModule",{value:!0}),r);var Kc=di(Ur=>{"use strict";var Vd="[object ArrayBuffer]",vt=class r{static isArrayBuffer(e){return Object.prototype.toString.call(e)===Vd}static toArrayBuffer(e){return this.isArrayBuffer(e)?e:e.byteLength===e.buffer.byteLength||e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:this.toUint8Array(e.buffer).slice(e.byteOffset,e.byteOffset+e.byteLength).buffer}static toUint8Array(e){return this.toView(e,Uint8Array)}static toView(e,t){if(e.constructor===t)return e;if(this.isArrayBuffer(e))return new t(e);if(this.isArrayBufferView(e))return new t(e.buffer,e.byteOffset,e.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(e){return this.isArrayBufferView(e)||this.isArrayBuffer(e)}static isArrayBufferView(e){return ArrayBuffer.isView(e)||e&&this.isArrayBuffer(e.buffer)}static isEqual(e,t){let n=r.toUint8Array(e),s=r.toUint8Array(t);if(n.length!==s.byteLength)return!1;for(let i=0;i<n.length;i++)if(n[i]!==s[i])return!1;return!0}static concat(...e){let t;Array.isArray(e[0])&&!(e[1]instanceof Function)||Array.isArray(e[0])&&e[1]instanceof Function?t=e[0]:e[e.length-1]instanceof Function?t=e.slice(0,e.length-1):t=e;let n=0;for(let o of t)n+=o.byteLength;let s=new Uint8Array(n),i=0;for(let o of t){let a=this.toUint8Array(o);s.set(a,i),i+=a.length}return e[e.length-1]instanceof Function?this.toView(s,e[e.length-1]):s.buffer}},Ao="string",Hd=/^[0-9a-f]+$/i,Fd=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,Kd=/^[a-zA-Z0-9-_]+$/,jn=class{static fromString(e){let t=unescape(encodeURIComponent(e)),n=new Uint8Array(t.length);for(let s=0;s<t.length;s++)n[s]=t.charCodeAt(s);return n.buffer}static toString(e){let t=vt.toUint8Array(e),n="";for(let i=0;i<t.length;i++)n+=String.fromCharCode(t[i]);return decodeURIComponent(escape(n))}},je=class{static toString(e,t=!1){let n=vt.toArrayBuffer(e),s=new DataView(n),i="";for(let o=0;o<n.byteLength;o+=2){let a=s.getUint16(o,t);i+=String.fromCharCode(a)}return i}static fromString(e,t=!1){let n=new ArrayBuffer(e.length*2),s=new DataView(n);for(let i=0;i<e.length;i++)s.setUint16(i*2,e.charCodeAt(i),t);return n}},Wn=class r{static isHex(e){return typeof e===Ao&&Hd.test(e)}static isBase64(e){return typeof e===Ao&&Fd.test(e)}static isBase64Url(e){return typeof e===Ao&&Kd.test(e)}static ToString(e,t="utf8"){let n=vt.toUint8Array(e);switch(t.toLowerCase()){case"utf8":return this.ToUtf8String(n);case"binary":return this.ToBinary(n);case"hex":return this.ToHex(n);case"base64":return this.ToBase64(n);case"base64url":return this.ToBase64Url(n);case"utf16le":return je.toString(n,!0);case"utf16":case"utf16be":return je.toString(n);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromString(e,t="utf8"){if(!e)return new ArrayBuffer(0);switch(t.toLowerCase()){case"utf8":return this.FromUtf8String(e);case"binary":return this.FromBinary(e);case"hex":return this.FromHex(e);case"base64":return this.FromBase64(e);case"base64url":return this.FromBase64Url(e);case"utf16le":return je.fromString(e,!0);case"utf16":case"utf16be":return je.fromString(e);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToBase64(e){let t=vt.toUint8Array(e);if(typeof btoa<"u"){let n=this.ToString(t,"binary");return btoa(n)}else return Buffer.from(t).toString("base64")}static FromBase64(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!r.isBase64(t))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return typeof atob<"u"?this.FromBinary(atob(t)):new Uint8Array(Buffer.from(t,"base64")).buffer}static FromBase64Url(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!r.isBase64Url(t))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(t.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(e){return this.ToBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(e,t=r.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.FromBinary(e);case"utf8":return jn.fromString(e);case"utf16":case"utf16be":return je.fromString(e);case"utf16le":case"usc2":return je.fromString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToUtf8String(e,t=r.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.ToBinary(e);case"utf8":return jn.toString(e);case"utf16":case"utf16be":return je.toString(e);case"utf16le":case"usc2":return je.toString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromBinary(e){let t=e.length,n=new Uint8Array(t);for(let s=0;s<t;s++)n[s]=e.charCodeAt(s);return n.buffer}static ToBinary(e){let t=vt.toUint8Array(e),n="";for(let s=0;s<t.length;s++)n+=String.fromCharCode(t[s]);return n}static ToHex(e){let t=vt.toUint8Array(e),n="",s=t.length;for(let i=0;i<s;i++){let o=t[i];o<16&&(n+="0"),n+=o.toString(16)}return n}static FromHex(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!r.isHex(t))throw new TypeError("Argument 'hexString' is not HEX encoded");t.length%2&&(t=`0${t}`);let n=new Uint8Array(t.length/2);for(let s=0;s<t.length;s=s+2){let i=t.slice(s,s+2);n[s/2]=parseInt(i,16)}return n.buffer}static ToUtf16String(e,t=!1){return je.toString(e,t)}static FromUtf16String(e,t=!1){return je.fromString(e,t)}static Base64Padding(e){let t=4-e.length%4;if(t<4)for(let n=0;n<t;n++)e+="=";return e}static formatString(e){return e?.replace(/[\n\r\t ]/g,"")||""}};Wn.DEFAULT_UTF8_ENCODING="utf8";function qd(r,...e){let t=arguments[0];for(let n=1;n<arguments.length;n++){let s=arguments[n];for(let i in s)t[i]=s[i]}return t}function zd(...r){let e=r.map(s=>s.byteLength).reduce((s,i)=>s+i),t=new Uint8Array(e),n=0;return r.map(s=>new Uint8Array(s)).forEach(s=>{for(let i of s)t[n++]=i}),t.buffer}function $d(r,e){if(!(r&&e)||r.byteLength!==e.byteLength)return!1;let t=new Uint8Array(r),n=new Uint8Array(e);for(let s=0;s<r.byteLength;s++)if(t[s]!==n[s])return!1;return!0}Ur.BufferSourceConverter=vt;Ur.Convert=Wn;Ur.assign=qd;Ur.combine=zd;Ur.isEqual=$d});var Iu=di((Sn,Ws)=>{(function(r,e){"use strict";var t={version:"3.0.0",x86:{},x64:{},inputValidation:!0};function n(u){if(!Array.isArray(u)&&!ArrayBuffer.isView(u))return!1;for(var d=0;d<u.length;d++)if(!Number.isInteger(u[d])||u[d]<0||u[d]>255)return!1;return!0}function s(u,d){return(u&65535)*d+(((u>>>16)*d&65535)<<16)}function i(u,d){return u<<d|u>>>32-d}function o(u){return u^=u>>>16,u=s(u,2246822507),u^=u>>>13,u=s(u,3266489909),u^=u>>>16,u}function a(u,d){u=[u[0]>>>16,u[0]&65535,u[1]>>>16,u[1]&65535],d=[d[0]>>>16,d[0]&65535,d[1]>>>16,d[1]&65535];var p=[0,0,0,0];return p[3]+=u[3]+d[3],p[2]+=p[3]>>>16,p[3]&=65535,p[2]+=u[2]+d[2],p[1]+=p[2]>>>16,p[2]&=65535,p[1]+=u[1]+d[1],p[0]+=p[1]>>>16,p[1]&=65535,p[0]+=u[0]+d[0],p[0]&=65535,[p[0]<<16|p[1],p[2]<<16|p[3]]}function c(u,d){u=[u[0]>>>16,u[0]&65535,u[1]>>>16,u[1]&65535],d=[d[0]>>>16,d[0]&65535,d[1]>>>16,d[1]&65535];var p=[0,0,0,0];return p[3]+=u[3]*d[3],p[2]+=p[3]>>>16,p[3]&=65535,p[2]+=u[2]*d[3],p[1]+=p[2]>>>16,p[2]&=65535,p[2]+=u[3]*d[2],p[1]+=p[2]>>>16,p[2]&=65535,p[1]+=u[1]*d[3],p[0]+=p[1]>>>16,p[1]&=65535,p[1]+=u[2]*d[2],p[0]+=p[1]>>>16,p[1]&=65535,p[1]+=u[3]*d[1],p[0]+=p[1]>>>16,p[1]&=65535,p[0]+=u[0]*d[3]+u[1]*d[2]+u[2]*d[1]+u[3]*d[0],p[0]&=65535,[p[0]<<16|p[1],p[2]<<16|p[3]]}function h(u,d){return d%=64,d===32?[u[1],u[0]]:d<32?[u[0]<<d|u[1]>>>32-d,u[1]<<d|u[0]>>>32-d]:(d-=32,[u[1]<<d|u[0]>>>32-d,u[0]<<d|u[1]>>>32-d])}function f(u,d){return d%=64,d===0?u:d<32?[u[0]<<d|u[1]>>>32-d,u[1]<<d]:[u[1]<<d-32,0]}function l(u,d){return[u[0]^d[0],u[1]^d[1]]}function m(u){return u=l(u,[0,u[0]>>>1]),u=c(u,[4283543511,3981806797]),u=l(u,[0,u[0]>>>1]),u=c(u,[3301882366,444984403]),u=l(u,[0,u[0]>>>1]),u}t.x86.hash32=function(u,d){if(t.inputValidation&&!n(u))return e;d=d||0;for(var p=u.length%4,b=u.length-p,g=d,w=0,y=3432918353,E=461845907,x=0;x<b;x=x+4)w=u[x]|u[x+1]<<8|u[x+2]<<16|u[x+3]<<24,w=s(w,y),w=i(w,15),w=s(w,E),g^=w,g=i(g,13),g=s(g,5)+3864292196;switch(w=0,p){case 3:w^=u[x+2]<<16;case 2:w^=u[x+1]<<8;case 1:w^=u[x],w=s(w,y),w=i(w,15),w=s(w,E),g^=w}return g^=u.length,g=o(g),g>>>0},t.x86.hash128=function(u,d){if(t.inputValidation&&!n(u))return e;d=d||0;for(var p=u.length%16,b=u.length-p,g=d,w=d,y=d,E=d,x=0,S=0,v=0,B=0,$=597399067,q=2869860233,P=951274213,te=2716044179,C=0;C<b;C=C+16)x=u[C]|u[C+1]<<8|u[C+2]<<16|u[C+3]<<24,S=u[C+4]|u[C+5]<<8|u[C+6]<<16|u[C+7]<<24,v=u[C+8]|u[C+9]<<8|u[C+10]<<16|u[C+11]<<24,B=u[C+12]|u[C+13]<<8|u[C+14]<<16|u[C+15]<<24,x=s(x,$),x=i(x,15),x=s(x,q),g^=x,g=i(g,19),g+=w,g=s(g,5)+1444728091,S=s(S,q),S=i(S,16),S=s(S,P),w^=S,w=i(w,17),w+=y,w=s(w,5)+197830471,v=s(v,P),v=i(v,17),v=s(v,te),y^=v,y=i(y,15),y+=E,y=s(y,5)+2530024501,B=s(B,te),B=i(B,18),B=s(B,$),E^=B,E=i(E,13),E+=g,E=s(E,5)+850148119;switch(x=0,S=0,v=0,B=0,p){case 15:B^=u[C+14]<<16;case 14:B^=u[C+13]<<8;case 13:B^=u[C+12],B=s(B,te),B=i(B,18),B=s(B,$),E^=B;case 12:v^=u[C+11]<<24;case 11:v^=u[C+10]<<16;case 10:v^=u[C+9]<<8;case 9:v^=u[C+8],v=s(v,P),v=i(v,17),v=s(v,te),y^=v;case 8:S^=u[C+7]<<24;case 7:S^=u[C+6]<<16;case 6:S^=u[C+5]<<8;case 5:S^=u[C+4],S=s(S,q),S=i(S,16),S=s(S,P),w^=S;case 4:x^=u[C+3]<<24;case 3:x^=u[C+2]<<16;case 2:x^=u[C+1]<<8;case 1:x^=u[C],x=s(x,$),x=i(x,15),x=s(x,q),g^=x}return g^=u.length,w^=u.length,y^=u.length,E^=u.length,g+=w,g+=y,g+=E,w+=g,y+=g,E+=g,g=o(g),w=o(w),y=o(y),E=o(E),g+=w,g+=y,g+=E,w+=g,y+=g,E+=g,("00000000"+(g>>>0).toString(16)).slice(-8)+("00000000"+(w>>>0).toString(16)).slice(-8)+("00000000"+(y>>>0).toString(16)).slice(-8)+("00000000"+(E>>>0).toString(16)).slice(-8)},t.x64.hash128=function(u,d){if(t.inputValidation&&!n(u))return e;d=d||0;for(var p=u.length%16,b=u.length-p,g=[0,d],w=[0,d],y=[0,0],E=[0,0],x=[2277735313,289559509],S=[1291169091,658871167],v=0;v<b;v=v+16)y=[u[v+4]|u[v+5]<<8|u[v+6]<<16|u[v+7]<<24,u[v]|u[v+1]<<8|u[v+2]<<16|u[v+3]<<24],E=[u[v+12]|u[v+13]<<8|u[v+14]<<16|u[v+15]<<24,u[v+8]|u[v+9]<<8|u[v+10]<<16|u[v+11]<<24],y=c(y,x),y=h(y,31),y=c(y,S),g=l(g,y),g=h(g,27),g=a(g,w),g=a(c(g,[0,5]),[0,1390208809]),E=c(E,S),E=h(E,33),E=c(E,x),w=l(w,E),w=h(w,31),w=a(w,g),w=a(c(w,[0,5]),[0,944331445]);switch(y=[0,0],E=[0,0],p){case 15:E=l(E,f([0,u[v+14]],48));case 14:E=l(E,f([0,u[v+13]],40));case 13:E=l(E,f([0,u[v+12]],32));case 12:E=l(E,f([0,u[v+11]],24));case 11:E=l(E,f([0,u[v+10]],16));case 10:E=l(E,f([0,u[v+9]],8));case 9:E=l(E,[0,u[v+8]]),E=c(E,S),E=h(E,33),E=c(E,x),w=l(w,E);case 8:y=l(y,f([0,u[v+7]],56));case 7:y=l(y,f([0,u[v+6]],48));case 6:y=l(y,f([0,u[v+5]],40));case 5:y=l(y,f([0,u[v+4]],32));case 4:y=l(y,f([0,u[v+3]],24));case 3:y=l(y,f([0,u[v+2]],16));case 2:y=l(y,f([0,u[v+1]],8));case 1:y=l(y,[0,u[v]]),y=c(y,x),y=h(y,31),y=c(y,S),g=l(g,y)}return g=l(g,[0,u.length]),w=l(w,[0,u.length]),g=a(g,w),w=a(w,g),g=m(g),w=m(w),g=a(g,w),w=a(w,g),("00000000"+(g[0]>>>0).toString(16)).slice(-8)+("00000000"+(g[1]>>>0).toString(16)).slice(-8)+("00000000"+(w[0]>>>0).toString(16)).slice(-8)+("00000000"+(w[1]>>>0).toString(16)).slice(-8)},typeof Sn<"u"?(typeof Ws<"u"&&Ws.exports&&(Sn=Ws.exports=t),Sn.murmurHash3=t):typeof define=="function"&&define.amd?define([],function(){return t}):(t._murmurHash3=r.murmurHash3,t.noConflict=function(){return r.murmurHash3=t._murmurHash3,t._murmurHash3=e,t.noConflict=e,t},r.murmurHash3=t)})(Sn)});var na=di((sx,ku)=>{ku.exports=Iu()});var v0={};ge(v0,{RELAY_V2_HOP_CODEC:()=>Ye,RELAY_V2_STOP_CODEC:()=>lr,circuitRelayServer:()=>Lu,circuitRelayTransport:()=>$u});var gi=Symbol.for("@libp2p/peer-id");var Ca=Symbol.for("@libp2p/transport");var Na;(function(r){r[r.FATAL_ALL=0]="FATAL_ALL",r[r.NO_FATAL=1]="NO_FATAL"})(Na||(Na={}));var Rt=class r extends Error{code;type;constructor(e="The operation was aborted"){super(e),this.name="AbortError",this.code=r.code,this.type=r.type}static code="ABORT_ERR";static type="aborted"},U=class extends Error{code;props;constructor(e,t,n){super(e),this.code=t,this.name=n?.name??"CodeError",this.props=n??{}}};var qe=(r,...e)=>{try{[...e]}catch{}};var ze=class extends EventTarget{#e=new Map;constructor(){super(),qe(1/0,this)}listenerCount(e){let t=this.#e.get(e);return t==null?0:t.length}addEventListener(e,t,n){super.addEventListener(e,t,n);let s=this.#e.get(e);s==null&&(s=[],this.#e.set(e,s)),s.push({callback:t,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(e,t,n){super.removeEventListener(e.toString(),t??null,n);let s=this.#e.get(e);s!=null&&(s=s.filter(({callback:i})=>i!==t),this.#e.set(e,s))}dispatchEvent(e){let t=super.dispatchEvent(e),n=this.#e.get(e.type);return n==null||(n=n.filter(({once:s})=>!s),this.#e.set(e.type,n)),t}safeDispatchEvent(e,t={}){return this.dispatchEvent(new af(e,t))}},mi=class extends Event{detail;constructor(e,t){super(e,t),this.detail=t?.detail}},af=globalThis.CustomEvent??mi;function La(r){return r!=null&&typeof r.start=="function"&&typeof r.stop=="function"}async function Ua(...r){let e=[];for(let t of r)La(t)&&e.push(t);await Promise.all(e.map(async t=>{t.beforeStart!=null&&await t.beforeStart()})),await Promise.all(e.map(async t=>{await t.start()})),await Promise.all(e.map(async t=>{t.afterStart!=null&&await t.afterStart()}))}async function Da(...r){let e=[];for(let t of r)La(t)&&e.push(t);await Promise.all(e.map(async t=>{t.beforeStop!=null&&await t.beforeStop()})),await Promise.all(e.map(async t=>{await t.stop()})),await Promise.all(e.map(async t=>{t.afterStop!=null&&await t.afterStop()}))}var Oa=Symbol.for("@libp2p/service-capabilities"),Pa=Symbol.for("@libp2p/service-dependencies");var vi={};ge(vi,{base58btc:()=>de,base58flickr:()=>df});var Q0=new Uint8Array(0);function Ma(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}function ht(r){if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")}function Va(r){return new TextEncoder().encode(r)}function Ha(r){return new TextDecoder().decode(r)}function cf(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var s=0;s<r.length;s++){var i=r.charAt(s),o=i.charCodeAt(0);if(t[o]!==255)throw new TypeError(i+" is ambiguous");t[o]=s}var a=r.length,c=r.charAt(0),h=Math.log(a)/Math.log(256),f=Math.log(256)/Math.log(a);function l(d){if(d instanceof Uint8Array||(ArrayBuffer.isView(d)?d=new Uint8Array(d.buffer,d.byteOffset,d.byteLength):Array.isArray(d)&&(d=Uint8Array.from(d))),!(d instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(d.length===0)return"";for(var p=0,b=0,g=0,w=d.length;g!==w&&d[g]===0;)g++,p++;for(var y=(w-g)*f+1>>>0,E=new Uint8Array(y);g!==w;){for(var x=d[g],S=0,v=y-1;(x!==0||S<b)&&v!==-1;v--,S++)x+=256*E[v]>>>0,E[v]=x%a>>>0,x=x/a>>>0;if(x!==0)throw new Error("Non-zero carry");b=S,g++}for(var B=y-b;B!==y&&E[B]===0;)B++;for(var $=c.repeat(p);B<y;++B)$+=r.charAt(E[B]);return $}function m(d){if(typeof d!="string")throw new TypeError("Expected String");if(d.length===0)return new Uint8Array;var p=0;if(d[p]!==" "){for(var b=0,g=0;d[p]===c;)b++,p++;for(var w=(d.length-p)*h+1>>>0,y=new Uint8Array(w);d[p];){var E=t[d.charCodeAt(p)];if(E===255)return;for(var x=0,S=w-1;(E!==0||x<g)&&S!==-1;S--,x++)E+=a*y[S]>>>0,y[S]=E%256>>>0,E=E/256>>>0;if(E!==0)throw new Error("Non-zero carry");g=x,p++}if(d[p]!==" "){for(var v=w-g;v!==w&&y[v]===0;)v++;for(var B=new Uint8Array(b+(w-v)),$=b;v!==w;)B[$++]=y[v++];return B}}}function u(d){var p=m(d);if(p)return p;throw new Error(`Non-${e} character`)}return{encode:l,decodeUnsafe:m,decode:u}}var lf=cf,uf=lf,Ka=uf;var yi=class{name;prefix;baseEncode;constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},bi=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return qa(this,e)}},wi=class{decoders;constructor(e){this.decoders=e}or(e){return qa(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function qa(r,e){return new wi({...r.decoders??{[r.prefix]:r},...e.decoders??{[e.prefix]:e}})}var xi=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,n,s){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=s,this.encoder=new yi(e,t,n),this.decoder=new bi(e,t,s)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function pr({name:r,prefix:e,encode:t,decode:n}){return new xi(r,e,t,n)}function Nt({name:r,prefix:e,alphabet:t}){let{encode:n,decode:s}=Ka(t,r);return pr({prefix:e,name:r,encode:n,decode:i=>ht(s(i))})}function ff(r,e,t,n){let s={};for(let f=0;f<e.length;++f)s[e[f]]=f;let i=r.length;for(;r[i-1]==="=";)--i;let o=new Uint8Array(i*t/8|0),a=0,c=0,h=0;for(let f=0;f<i;++f){let l=s[r[f]];if(l===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<t|l,a+=t,a>=8&&(a-=8,o[h++]=255&c>>a)}if(a>=t||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o}function hf(r,e,t){let n=e[e.length-1]==="=",s=(1<<t)-1,i="",o=0,a=0;for(let c=0;c<r.length;++c)for(a=a<<8|r[c],o+=8;o>t;)o-=t,i+=e[s&a>>o];if(o!==0&&(i+=e[s&a<<t-o]),n)for(;i.length*t&7;)i+="=";return i}function oe({name:r,prefix:e,bitsPerChar:t,alphabet:n}){return pr({prefix:e,name:r,encode(s){return hf(s,n,t)},decode(s){return ff(s,n,t,r)}})}var de=Nt({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),df=Nt({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Ei={};ge(Ei,{base10:()=>pf});var pf=Nt({prefix:"9",name:"base10",alphabet:"0123456789"});var Ai={};ge(Ai,{base16:()=>gf,base16upper:()=>mf});var gf=oe({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),mf=oe({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Si={};ge(Si,{base2:()=>yf});var yf=oe({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Bi={};ge(Bi,{base256emoji:()=>Ef});var za=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}"),bf=za.reduce((r,e,t)=>(r[t]=e,r),[]),wf=za.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function xf(r){return r.reduce((e,t)=>(e+=bf[t],e),"")}function vf(r){let e=[];for(let t of r){let n=wf[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}var Ef=pr({prefix:"\u{1F680}",name:"base256emoji",encode:xf,decode:vf});var _i={};ge(_i,{base32:()=>dt,base32hex:()=>_f,base32hexpad:()=>kf,base32hexpadupper:()=>Tf,base32hexupper:()=>If,base32pad:()=>Sf,base32padupper:()=>Bf,base32upper:()=>Af,base32z:()=>Rf});var dt=oe({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Af=oe({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Sf=oe({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Bf=oe({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),_f=oe({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),If=oe({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),kf=oe({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Tf=oe({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Rf=oe({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Ii={};ge(Ii,{base36:()=>Nf,base36upper:()=>Cf});var Nf=Nt({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Cf=Nt({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Ti={};ge(Ti,{base64:()=>ki,base64pad:()=>Lf,base64url:()=>Uf,base64urlpad:()=>Df});var ki=oe({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Lf=oe({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Uf=oe({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Df=oe({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Ri={};ge(Ri,{base8:()=>Of});var Of=oe({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Ni={};ge(Ni,{identity:()=>Pf});var Pf=pr({prefix:"\0",name:"identity",encode:r=>Ha(r),decode:r=>Va(r)});var gg=new TextEncoder,mg=new TextDecoder;var Li={};ge(Li,{identity:()=>pt});var Hf=ja,$a=128,Ff=127,Kf=~Ff,qf=Math.pow(2,31);function ja(r,e,t){e=e||[],t=t||0;for(var n=t;r>=qf;)e[t++]=r&255|$a,r/=128;for(;r&Kf;)e[t++]=r&255|$a,r>>>=7;return e[t]=r|0,ja.bytes=t-n+1,e}var zf=Ci,$f=128,Ga=127;function Ci(r,n){var t=0,n=n||0,s=0,i=n,o,a=r.length;do{if(i>=a)throw Ci.bytes=0,new RangeError("Could not decode varint");o=r[i++],t+=s<28?(o&Ga)<<s:(o&Ga)*Math.pow(2,s),s+=7}while(o>=$f);return Ci.bytes=i-n,t}var Gf=Math.pow(2,7),jf=Math.pow(2,14),Wf=Math.pow(2,21),Yf=Math.pow(2,28),Zf=Math.pow(2,35),Xf=Math.pow(2,42),Jf=Math.pow(2,49),Qf=Math.pow(2,56),eh=Math.pow(2,63),th=function(r){return r<Gf?1:r<jf?2:r<Wf?3:r<Yf?4:r<Zf?5:r<Xf?6:r<Jf?7:r<Qf?8:r<eh?9:10},rh={encode:Hf,decode:zf,encodingLength:th},nh=rh,Wr=nh;function Yr(r,e=0){return[Wr.decode(r,e),Wr.decode.bytes]}function gr(r,e,t=0){return Wr.encode(r,e,t),e}function mr(r){return Wr.encodingLength(r)}function nt(r,e){let t=e.byteLength,n=mr(r),s=n+mr(t),i=new Uint8Array(s+t);return gr(r,i,0),gr(t,i,n),i.set(e,s),new yr(r,t,e,i)}function Xt(r){let e=ht(r),[t,n]=Yr(e),[s,i]=Yr(e.subarray(n)),o=e.subarray(n+i);if(o.byteLength!==s)throw new Error("Incorrect length");return new yr(t,s,o,e)}function Wa(r,e){if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&Ma(r.bytes,t.bytes)}}var yr=class{code;size;digest;bytes;constructor(e,t,n,s){this.code=e,this.size=t,this.digest=n,this.bytes=s}};var Ya=0,sh="identity",Za=ht;function ih(r){return nt(Ya,Za(r))}var pt={code:Ya,name:sh,encode:Za,digest:ih};var Oi={};ge(Oi,{sha256:()=>me,sha512:()=>oh});function Di({name:r,code:e,encode:t}){return new Ui(r,e,t)}var Ui=class{name;code;encode;constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?nt(this.code,t):t.then(n=>nt(this.code,n))}else throw Error("Unknown type, must be binary type")}};function Ja(r){return async e=>new Uint8Array(await crypto.subtle.digest(r,e))}var me=Di({name:"sha2-256",code:18,encode:Ja("SHA-256")}),oh=Di({name:"sha2-512",code:19,encode:Ja("SHA-512")});function Qa(r,e){let{bytes:t,version:n}=r;switch(n){case 0:return ch(t,Pi(r),e??de.encoder);default:return lh(t,Pi(r),e??dt.encoder)}}var ec=new WeakMap;function Pi(r){let e=ec.get(r);if(e==null){let t=new Map;return ec.set(r,t),t}return e}var Le=class r{code;version;multihash;bytes;"/";constructor(e,t,n,s){this.code=t,this.version=e,this.multihash=n,this.bytes=s,this["/"]=s}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:t}=this;if(e!==Zr)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==uh)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,n=nt(e,t);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return r.equals(this,e)}static equals(e,t){let n=t;return n!=null&&e.code===n.code&&e.version===n.version&&Wa(e.multihash,n.multihash)}toString(e){return Qa(this,e)}toJSON(){return{"/":Qa(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof r)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:s,multihash:i,bytes:o}=t;return new r(n,s,i,o??tc(n,s,i.bytes))}else if(t[fh]===!0){let{version:n,multihash:s,code:i}=t,o=Xt(s);return r.create(n,i,o)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==Zr)throw new Error(`Version 0 CID must use dag-pb (code: ${Zr}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let s=tc(e,t,n.bytes);return new r(e,t,n,s)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,Zr,e)}static createV1(e,t){return r.create(1,e,t)}static decode(e){let[t,n]=r.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=r.inspectBytes(e),n=t.size-t.multihashSize,s=ht(e.subarray(n,n+t.multihashSize));if(s.byteLength!==t.multihashSize)throw new Error("Incorrect length");let i=s.subarray(t.multihashSize-t.digestSize),o=new yr(t.multihashCode,t.digestSize,i,s);return[t.version===0?r.createV0(o):r.createV1(t.codec,o),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[l,m]=Yr(e.subarray(t));return t+=m,l},s=n(),i=Zr;if(s===18?(s=0,t=0):i=n(),s!==0&&s!==1)throw new RangeError(`Invalid CID version ${s}`);let o=t,a=n(),c=n(),h=t+c,f=h-o;return{version:s,codec:i,multihashCode:a,digestSize:c,multihashSize:f,size:h}}static parse(e,t){let[n,s]=ah(e,t),i=r.decode(s);if(i.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Pi(i).set(n,e),i}};function ah(r,e){switch(r[0]){case"Q":{let t=e??de;return[de.prefix,t.decode(`${de.prefix}${r}`)]}case de.prefix:{let t=e??de;return[de.prefix,t.decode(r)]}case dt.prefix:{let t=e??dt;return[dt.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}}function ch(r,e,t){let{prefix:n}=t;if(n!==de.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let s=e.get(n);if(s==null){let i=t.encode(r).slice(1);return e.set(n,i),i}else return s}function lh(r,e,t){let{prefix:n}=t,s=e.get(n);if(s==null){let i=t.encode(r);return e.set(n,i),i}else return s}var Zr=112,uh=18;function tc(r,e,t){let n=mr(r),s=n+mr(e),i=new Uint8Array(s+t.byteLength);return gr(r,i,0),gr(e,i,n),i.set(t,s),i}var fh=Symbol.for("@ipld/js-cid/CID");var Ct={...Ni,...Si,...Ri,...Ei,...Ai,..._i,...Ii,...vi,...Ti,...Bi},Pg={...Oi,...Li};function ae(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}function xe(r=0){return new Uint8Array(r)}function Ne(r=0){return new Uint8Array(r)}function nc(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var rc=nc("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Mi=nc("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=Ne(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),hh={utf8:rc,"utf-8":rc,hex:Ct.base16,latin1:Mi,ascii:Mi,binary:Mi,...Ct},Tn=hh;function M(r,e="utf8"){let t=Tn[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.decoder.decode(`${t.prefix}${r}`)}function W(r,e="utf8"){let t=Tn[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.encoder.encode(r).substring(1)}var ic=Symbol.for("nodejs.util.inspect.custom"),sc=Object.values(Ct).map(r=>r.decoder).reduce((r,e)=>r.or(e),Ct.identity.decoder),oc=114,Fi=36,Ki=37,Xr=class{type;multihash;privateKey;publicKey;string;constructor(e){this.type=e.type,this.multihash=e.multihash,this.privateKey=e.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}[gi]=!0;toString(){return this.string==null&&(this.string=de.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return Le.createV1(oc,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e==null)return!1;if(e instanceof Uint8Array)return ae(this.multihash.bytes,e);if(typeof e=="string")return Lt(e).equals(this);if(e?.multihash?.bytes!=null)return ae(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[ic](){return`PeerId(${this.toString()})`}},br=class extends Xr{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},wr=class extends Xr{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.multihash.digest}},xr=class extends Xr{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.multihash.digest}},Vi=2336,Hi=class{type="url";multihash;privateKey;publicKey;url;constructor(e){this.url=e.toString(),this.multihash=pt.digest(M(this.url))}[ic](){return`PeerId(${this.url})`}[gi]=!0;toString(){return this.toCID().toString()}toCID(){return Le.createV1(Vi,this.multihash)}toBytes(){return this.toCID().bytes}equals(e){return e==null?!1:(e instanceof Uint8Array&&(e=W(e)),e.toString()===this.toString())}};function Lt(r,e){if(e=e??sc,r.charAt(0)==="1"||r.charAt(0)==="Q"){let t=Xt(de.decode(`z${r}`));return r.startsWith("12D")?new wr({multihash:t}):r.startsWith("16U")?new xr({multihash:t}):new br({multihash:t})}return Jr(sc.decode(r))}function Jr(r){try{let e=Xt(r);if(e.code===pt.code){if(e.digest.length===Fi)return new wr({multihash:e});if(e.digest.length===Ki)return new xr({multihash:e})}if(e.code===me.code)return new br({multihash:e})}catch{return dh(Le.decode(r))}throw new Error("Supplied PeerID CID is invalid")}function dh(r){if(r==null||r.multihash==null||r.version==null||r.version===1&&r.code!==oc&&r.code!==Vi)throw new Error("Supplied PeerID CID is invalid");if(r.code===Vi){let t=W(r.multihash.digest);return new Hi(new URL(t))}let e=r.multihash;if(e.code===me.code)return new br({multihash:r.multihash});if(e.code===pt.code){if(e.digest.length===Fi)return new wr({multihash:r.multihash});if(e.digest.length===Ki)return new xr({multihash:r.multihash})}throw new Error("Supplied PeerID CID is invalid")}async function ac(r,e){return r.length===Fi?new wr({multihash:nt(pt.code,r),privateKey:e}):r.length===Ki?new xr({multihash:nt(pt.code,r),privateKey:e}):new br({multihash:await me.digest(r),publicKey:r,privateKey:e})}var vo={};ge(vo,{Ed25519PrivateKey:()=>ir,Ed25519PublicKey:()=>on,generateKeyPair:()=>Od,generateKeyPairFromSeed:()=>Fc,unmarshalEd25519PrivateKey:()=>Ud,unmarshalEd25519PublicKey:()=>Dd});function ke(r,e){e==null&&(e=r.reduce((s,i)=>s+i.length,0));let t=Ne(e),n=0;for(let s of r)t.set(s,n),n+=s.length;return t}function $e(r){return r==null?!1:typeof r.then=="function"&&typeof r.catch=="function"&&typeof r.finally=="function"}function vr(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`positive integer expected, not ${r}`)}function ph(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function Er(r,...e){if(!ph(r))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(r.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${r.length}`)}function Rn(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");vr(r.outputLen),vr(r.blockLen)}function Ar(r,e=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(e&&r.finished)throw new Error("Hash#digest() has already been called")}function cc(r,e){Er(r);let t=e.outputLen;if(r.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}var Nn=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var Br=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),Ze=(r,e)=>r<<32-e|r>>>e;var mm=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;var gh=async()=>{};async function lc(r,e,t){let n=Date.now();for(let s=0;s<r;s++){t(s);let i=Date.now()-n;i>=0&&i<e||(await gh(),n+=i)}}function uc(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function Ut(r){return typeof r=="string"&&(r=uc(r)),Er(r),r}function qi(...r){let e=0;for(let n=0;n<r.length;n++){let s=r[n];Er(s),e+=s.length}let t=new Uint8Array(e);for(let n=0,s=0;n<r.length;n++){let i=r[n];t.set(i,s),s+=i.length}return t}var Sr=class{clone(){return this._cloneInto()}},mh={}.toString;function fc(r,e){if(e!==void 0&&mh.call(e)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(r,e)}function Cn(r){let e=n=>r().update(Ut(n)).digest(),t=r();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>r(),e}function _r(r=32){if(Nn&&typeof Nn.getRandomValues=="function")return Nn.getRandomValues(new Uint8Array(r));throw new Error("crypto.getRandomValues must be defined")}function yh(r,e,t,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(e,t,n);let s=BigInt(32),i=BigInt(4294967295),o=Number(t>>s&i),a=Number(t&i),c=n?4:0,h=n?0:4;r.setUint32(e+c,o,n),r.setUint32(e+h,a,n)}var hc=(r,e,t)=>r&e^~r&t,dc=(r,e,t)=>r&e^r&t^e&t,Ir=class extends Sr{constructor(e,t,n,s){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Br(this.buffer)}update(e){Ar(this);let{view:t,buffer:n,blockLen:s}=this;e=Ut(e);let i=e.length;for(let o=0;o<i;){let a=Math.min(s-this.pos,i-o);if(a===s){let c=Br(e);for(;s<=i-o;o+=s)this.process(c,o);continue}n.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===s&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Ar(this),cc(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:s,isLE:i}=this,{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>s-o&&(this.process(n,0),o=0);for(let l=o;l<s;l++)t[l]=0;yh(n,s-8,BigInt(this.length*8),i),this.process(n,0);let a=Br(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let h=c/4,f=this.get();if(h>f.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<h;l++)a.setUint32(4*l,f[l],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:n,length:s,finished:i,destroyed:o,pos:a}=this;return e.length=s,e.pos=a,e.finished=i,e.destroyed=o,s%t&&e.buffer.set(n),e}};var Ln=BigInt(4294967295),zi=BigInt(32);function pc(r,e=!1){return e?{h:Number(r&Ln),l:Number(r>>zi&Ln)}:{h:Number(r>>zi&Ln)|0,l:Number(r&Ln)|0}}function bh(r,e=!1){let t=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let s=0;s<r.length;s++){let{h:i,l:o}=pc(r[s],e);[t[s],n[s]]=[i,o]}return[t,n]}var wh=(r,e)=>BigInt(r>>>0)<<zi|BigInt(e>>>0),xh=(r,e,t)=>r>>>t,vh=(r,e,t)=>r<<32-t|e>>>t,Eh=(r,e,t)=>r>>>t|e<<32-t,Ah=(r,e,t)=>r<<32-t|e>>>t,Sh=(r,e,t)=>r<<64-t|e>>>t-32,Bh=(r,e,t)=>r>>>t-32|e<<64-t,_h=(r,e)=>e,Ih=(r,e)=>r,kh=(r,e,t)=>r<<t|e>>>32-t,Th=(r,e,t)=>e<<t|r>>>32-t,Rh=(r,e,t)=>e<<t-32|r>>>64-t,Nh=(r,e,t)=>r<<t-32|e>>>64-t;function Ch(r,e,t,n){let s=(e>>>0)+(n>>>0);return{h:r+t+(s/2**32|0)|0,l:s|0}}var Lh=(r,e,t)=>(r>>>0)+(e>>>0)+(t>>>0),Uh=(r,e,t,n)=>e+t+n+(r/2**32|0)|0,Dh=(r,e,t,n)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0),Oh=(r,e,t,n,s)=>e+t+n+s+(r/2**32|0)|0,Ph=(r,e,t,n,s)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0)+(s>>>0),Mh=(r,e,t,n,s,i)=>e+t+n+s+i+(r/2**32|0)|0;var Vh={fromBig:pc,split:bh,toBig:wh,shrSH:xh,shrSL:vh,rotrSH:Eh,rotrSL:Ah,rotrBH:Sh,rotrBL:Bh,rotr32H:_h,rotr32L:Ih,rotlSH:kh,rotlSL:Th,rotlBH:Rh,rotlBL:Nh,add:Ch,add3L:Lh,add3H:Uh,add4L:Dh,add4H:Oh,add5H:Mh,add5L:Ph},V=Vh;var[Hh,Fh]=V.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))),Dt=new Uint32Array(80),Ot=new Uint32Array(80),$i=class extends Ir{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:e,Al:t,Bh:n,Bl:s,Ch:i,Cl:o,Dh:a,Dl:c,Eh:h,El:f,Fh:l,Fl:m,Gh:u,Gl:d,Hh:p,Hl:b}=this;return[e,t,n,s,i,o,a,c,h,f,l,m,u,d,p,b]}set(e,t,n,s,i,o,a,c,h,f,l,m,u,d,p,b){this.Ah=e|0,this.Al=t|0,this.Bh=n|0,this.Bl=s|0,this.Ch=i|0,this.Cl=o|0,this.Dh=a|0,this.Dl=c|0,this.Eh=h|0,this.El=f|0,this.Fh=l|0,this.Fl=m|0,this.Gh=u|0,this.Gl=d|0,this.Hh=p|0,this.Hl=b|0}process(e,t){for(let y=0;y<16;y++,t+=4)Dt[y]=e.getUint32(t),Ot[y]=e.getUint32(t+=4);for(let y=16;y<80;y++){let E=Dt[y-15]|0,x=Ot[y-15]|0,S=V.rotrSH(E,x,1)^V.rotrSH(E,x,8)^V.shrSH(E,x,7),v=V.rotrSL(E,x,1)^V.rotrSL(E,x,8)^V.shrSL(E,x,7),B=Dt[y-2]|0,$=Ot[y-2]|0,q=V.rotrSH(B,$,19)^V.rotrBH(B,$,61)^V.shrSH(B,$,6),P=V.rotrSL(B,$,19)^V.rotrBL(B,$,61)^V.shrSL(B,$,6),te=V.add4L(v,P,Ot[y-7],Ot[y-16]),C=V.add4H(te,S,q,Dt[y-7],Dt[y-16]);Dt[y]=C|0,Ot[y]=te|0}let{Ah:n,Al:s,Bh:i,Bl:o,Ch:a,Cl:c,Dh:h,Dl:f,Eh:l,El:m,Fh:u,Fl:d,Gh:p,Gl:b,Hh:g,Hl:w}=this;for(let y=0;y<80;y++){let E=V.rotrSH(l,m,14)^V.rotrSH(l,m,18)^V.rotrBH(l,m,41),x=V.rotrSL(l,m,14)^V.rotrSL(l,m,18)^V.rotrBL(l,m,41),S=l&u^~l&p,v=m&d^~m&b,B=V.add5L(w,x,v,Fh[y],Ot[y]),$=V.add5H(B,g,E,S,Hh[y],Dt[y]),q=B|0,P=V.rotrSH(n,s,28)^V.rotrBH(n,s,34)^V.rotrBH(n,s,39),te=V.rotrSL(n,s,28)^V.rotrBL(n,s,34)^V.rotrBL(n,s,39),C=n&i^n&a^i&a,Ke=s&o^s&c^o&c;g=p|0,w=b|0,p=u|0,b=d|0,u=l|0,d=m|0,{h:l,l:m}=V.add(h|0,f|0,$|0,q|0),h=a|0,f=c|0,a=i|0,c=o|0,i=n|0,o=s|0;let _=V.add3L(q,te,Ke);n=V.add3H(_,$,P,C),s=_|0}({h:n,l:s}=V.add(this.Ah|0,this.Al|0,n|0,s|0)),{h:i,l:o}=V.add(this.Bh|0,this.Bl|0,i|0,o|0),{h:a,l:c}=V.add(this.Ch|0,this.Cl|0,a|0,c|0),{h,l:f}=V.add(this.Dh|0,this.Dl|0,h|0,f|0),{h:l,l:m}=V.add(this.Eh|0,this.El|0,l|0,m|0),{h:u,l:d}=V.add(this.Fh|0,this.Fl|0,u|0,d|0),{h:p,l:b}=V.add(this.Gh|0,this.Gl|0,p|0,b|0),{h:g,l:w}=V.add(this.Hh|0,this.Hl|0,g|0,w|0),this.set(n,s,i,o,a,c,h,f,l,m,u,d,p,b,g,w)}roundClean(){Dt.fill(0),Ot.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 Qr=Cn(()=>new $i);var Dn={};ge(Dn,{abytes:()=>kr,bitGet:()=>Wh,bitLen:()=>jh,bitMask:()=>en,bitSet:()=>Yh,bytesToHex:()=>mt,bytesToNumberBE:()=>yt,bytesToNumberLE:()=>Mt,concatBytes:()=>bt,createHmacDrbg:()=>Wi,ensureBytes:()=>ce,equalBytes:()=>$h,hexToBytes:()=>Qt,hexToNumber:()=>ji,isBytes:()=>Pt,numberToBytesBE:()=>Vt,numberToBytesLE:()=>er,numberToHexUnpadded:()=>bc,numberToVarBytesBE:()=>zh,utf8ToBytes:()=>Gh,validateObject:()=>st});var yc=BigInt(0),Un=BigInt(1),Kh=BigInt(2);function Pt(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function kr(r){if(!Pt(r))throw new Error("Uint8Array expected")}var qh=Array.from({length:256},(r,e)=>e.toString(16).padStart(2,"0"));function mt(r){kr(r);let e="";for(let t=0;t<r.length;t++)e+=qh[r[t]];return e}function bc(r){let e=r.toString(16);return e.length&1?`0${e}`:e}function ji(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);return BigInt(r===""?"0":`0x${r}`)}var gt={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function gc(r){if(r>=gt._0&&r<=gt._9)return r-gt._0;if(r>=gt._A&&r<=gt._F)return r-(gt._A-10);if(r>=gt._a&&r<=gt._f)return r-(gt._a-10)}function Qt(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let e=r.length,t=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);let n=new Uint8Array(t);for(let s=0,i=0;s<t;s++,i+=2){let o=gc(r.charCodeAt(i)),a=gc(r.charCodeAt(i+1));if(o===void 0||a===void 0){let c=r[i]+r[i+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+i)}n[s]=o*16+a}return n}function yt(r){return ji(mt(r))}function Mt(r){return kr(r),ji(mt(Uint8Array.from(r).reverse()))}function Vt(r,e){return Qt(r.toString(16).padStart(e*2,"0"))}function er(r,e){return Vt(r,e).reverse()}function zh(r){return Qt(bc(r))}function ce(r,e,t){let n;if(typeof e=="string")try{n=Qt(e)}catch(i){throw new Error(`${r} must be valid hex string, got "${e}". Cause: ${i}`)}else if(Pt(e))n=Uint8Array.from(e);else throw new Error(`${r} must be hex string or Uint8Array`);let s=n.length;if(typeof t=="number"&&s!==t)throw new Error(`${r} expected ${t} bytes, got ${s}`);return n}function bt(...r){let e=0;for(let n=0;n<r.length;n++){let s=r[n];kr(s),e+=s.length}let t=new Uint8Array(e);for(let n=0,s=0;n<r.length;n++){let i=r[n];t.set(i,s),s+=i.length}return t}function $h(r,e){if(r.length!==e.length)return!1;let t=0;for(let n=0;n<r.length;n++)t|=r[n]^e[n];return t===0}function Gh(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function jh(r){let e;for(e=0;r>yc;r>>=Un,e+=1);return e}function Wh(r,e){return r>>BigInt(e)&Un}function Yh(r,e,t){return r|(t?Un:yc)<<BigInt(e)}var en=r=>(Kh<<BigInt(r-1))-Un,Gi=r=>new Uint8Array(r),mc=r=>Uint8Array.from(r);function Wi(r,e,t){if(typeof r!="number"||r<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof t!="function")throw new Error("hmacFn must be a function");let n=Gi(r),s=Gi(r),i=0,o=()=>{n.fill(1),s.fill(0),i=0},a=(...l)=>t(s,n,...l),c=(l=Gi())=>{s=a(mc([0]),l),n=a(),l.length!==0&&(s=a(mc([1]),l),n=a())},h=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let l=0,m=[];for(;l<e;){n=a();let u=n.slice();m.push(u),l+=n.length}return bt(...m)};return(l,m)=>{o(),c(l);let u;for(;!(u=m(h()));)c();return o(),u}}var Zh={bigint:r=>typeof r=="bigint",function:r=>typeof r=="function",boolean:r=>typeof r=="boolean",string:r=>typeof r=="string",stringOrUint8Array:r=>typeof r=="string"||Pt(r),isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,e)=>e.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function st(r,e,t={}){let n=(s,i,o)=>{let a=Zh[i];if(typeof a!="function")throw new Error(`Invalid validator "${i}", expected function`);let c=r[s];if(!(o&&c===void 0)&&!a(c,r))throw new Error(`Invalid param ${String(s)}=${c} (${typeof c}), expected ${i}`)};for(let[s,i]of Object.entries(e))n(s,i,!1);for(let[s,i]of Object.entries(t))n(s,i,!0);return r}var pe=BigInt(0),re=BigInt(1),tr=BigInt(2),Xh=BigInt(3),Yi=BigInt(4),wc=BigInt(5),xc=BigInt(8),Jh=BigInt(9),Qh=BigInt(16);function Q(r,e){let t=r%e;return t>=pe?t:e+t}function ed(r,e,t){if(t<=pe||e<pe)throw new Error("Expected power/modulo > 0");if(t===re)return pe;let n=re;for(;e>pe;)e&re&&(n=n*r%t),r=r*r%t,e>>=re;return n}function ne(r,e,t){let n=r;for(;e-- >pe;)n*=n,n%=t;return n}function On(r,e){if(r===pe||e<=pe)throw new Error(`invert: expected positive integers, got n=${r} mod=${e}`);let t=Q(r,e),n=e,s=pe,i=re,o=re,a=pe;for(;t!==pe;){let h=n/t,f=n%t,l=s-o*h,m=i-a*h;n=t,t=f,s=o,i=a,o=l,a=m}if(n!==re)throw new Error("invert: does not exist");return Q(s,e)}function td(r){let e=(r-re)/tr,t,n,s;for(t=r-re,n=0;t%tr===pe;t/=tr,n++);for(s=tr;s<r&&ed(s,e,r)!==r-re;s++);if(n===1){let o=(r+re)/Yi;return function(c,h){let f=c.pow(h,o);if(!c.eql(c.sqr(f),h))throw new Error("Cannot find square root");return f}}let i=(t+re)/tr;return function(a,c){if(a.pow(c,e)===a.neg(a.ONE))throw new Error("Cannot find square root");let h=n,f=a.pow(a.mul(a.ONE,s),t),l=a.pow(c,i),m=a.pow(c,t);for(;!a.eql(m,a.ONE);){if(a.eql(m,a.ZERO))return a.ZERO;let u=1;for(let p=a.sqr(m);u<h&&!a.eql(p,a.ONE);u++)p=a.sqr(p);let d=a.pow(f,re<<BigInt(h-u-1));f=a.sqr(d),l=a.mul(l,d),m=a.mul(m,f),h=u}return l}}function rd(r){if(r%Yi===Xh){let e=(r+re)/Yi;return function(n,s){let i=n.pow(s,e);if(!n.eql(n.sqr(i),s))throw new Error("Cannot find square root");return i}}if(r%xc===wc){let e=(r-wc)/xc;return function(n,s){let i=n.mul(s,tr),o=n.pow(i,e),a=n.mul(s,o),c=n.mul(n.mul(a,tr),o),h=n.mul(a,n.sub(c,n.ONE));if(!n.eql(n.sqr(h),s))throw new Error("Cannot find square root");return h}}return r%Qh,td(r)}var vc=(r,e)=>(Q(r,e)&re)===re,nd=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Zi(r){let e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},t=nd.reduce((n,s)=>(n[s]="function",n),e);return st(r,t)}function sd(r,e,t){if(t<pe)throw new Error("Expected power > 0");if(t===pe)return r.ONE;if(t===re)return e;let n=r.ONE,s=e;for(;t>pe;)t&re&&(n=r.mul(n,s)),s=r.sqr(s),t>>=re;return n}function id(r,e){let t=new Array(e.length),n=e.reduce((i,o,a)=>r.is0(o)?i:(t[a]=i,r.mul(i,o)),r.ONE),s=r.inv(n);return e.reduceRight((i,o,a)=>r.is0(o)?i:(t[a]=r.mul(i,t[a]),r.mul(i,o)),s),t}function Xi(r,e){let t=e!==void 0?e:r.toString(2).length,n=Math.ceil(t/8);return{nBitLength:t,nByteLength:n}}function Pn(r,e,t=!1,n={}){if(r<=pe)throw new Error(`Expected Field ORDER > 0, got ${r}`);let{nBitLength:s,nByteLength:i}=Xi(r,e);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");let o=rd(r),a=Object.freeze({ORDER:r,BITS:s,BYTES:i,MASK:en(s),ZERO:pe,ONE:re,create:c=>Q(c,r),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return pe<=c&&c<r},is0:c=>c===pe,isOdd:c=>(c&re)===re,neg:c=>Q(-c,r),eql:(c,h)=>c===h,sqr:c=>Q(c*c,r),add:(c,h)=>Q(c+h,r),sub:(c,h)=>Q(c-h,r),mul:(c,h)=>Q(c*h,r),pow:(c,h)=>sd(a,c,h),div:(c,h)=>Q(c*On(h,r),r),sqrN:c=>c*c,addN:(c,h)=>c+h,subN:(c,h)=>c-h,mulN:(c,h)=>c*h,inv:c=>On(c,r),sqrt:n.sqrt||(c=>o(a,c)),invertBatch:c=>id(a,c),cmov:(c,h,f)=>f?h:c,toBytes:c=>t?er(c,i):Vt(c,i),fromBytes:c=>{if(c.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${c.length}`);return t?Mt(c):yt(c)}});return Object.freeze(a)}function Ec(r){if(typeof r!="bigint")throw new Error("field order must be bigint");let e=r.toString(2).length;return Math.ceil(e/8)}function Ji(r){let e=Ec(r);return e+Math.ceil(e/2)}function Ac(r,e,t=!1){let n=r.length,s=Ec(e),i=Ji(e);if(n<16||n<i||n>1024)throw new Error(`expected ${i}-1024 bytes of input, got ${n}`);let o=t?yt(r):Mt(r),a=Q(o,e-re)+re;return t?er(a,s):Vt(a,s)}var ad=BigInt(0),Qi=BigInt(1);function Mn(r,e){let t=(s,i)=>{let o=i.negate();return s?o:i},n=s=>{let i=Math.ceil(e/s)+1,o=2**(s-1);return{windows:i,windowSize:o}};return{constTimeNegate:t,unsafeLadder(s,i){let o=r.ZERO,a=s;for(;i>ad;)i&Qi&&(o=o.add(a)),a=a.double(),i>>=Qi;return o},precomputeWindow(s,i){let{windows:o,windowSize:a}=n(i),c=[],h=s,f=h;for(let l=0;l<o;l++){f=h,c.push(f);for(let m=1;m<a;m++)f=f.add(h),c.push(f);h=f.double()}return c},wNAF(s,i,o){let{windows:a,windowSize:c}=n(s),h=r.ZERO,f=r.BASE,l=BigInt(2**s-1),m=2**s,u=BigInt(s);for(let d=0;d<a;d++){let p=d*c,b=Number(o&l);o>>=u,b>c&&(b-=m,o+=Qi);let g=p,w=p+Math.abs(b)-1,y=d%2!==0,E=b<0;b===0?f=f.add(t(y,i[g])):h=h.add(t(E,i[w]))}return{p:h,f}},wNAFCached(s,i,o,a){let c=s._WINDOW_SIZE||1,h=i.get(s);return h||(h=this.precomputeWindow(s,c),c!==1&&i.set(s,a(h))),this.wNAF(c,h,o)}}}function tn(r){return Zi(r.Fp),st(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Xi(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}var Xe=BigInt(0),Ue=BigInt(1),Vn=BigInt(2),cd=BigInt(8),ld={zip215:!0};function ud(r){let e=tn(r);return st(r,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function Sc(r){let e=ud(r),{Fp:t,n,prehash:s,hash:i,randomBytes:o,nByteLength:a,h:c}=e,h=Vn<<BigInt(a*8)-Ue,f=t.create,l=e.uvRatio||((I,A)=>{try{return{isValid:!0,value:t.sqrt(I*t.inv(A))}}catch{return{isValid:!1,value:Xe}}}),m=e.adjustScalarBytes||(I=>I),u=e.domain||((I,A,R)=>{if(A.length||R)throw new Error("Contexts/pre-hash are not supported");return I}),d=I=>typeof I=="bigint"&&Xe<I,p=(I,A)=>d(I)&&d(A)&&I<A,b=I=>I===Xe||p(I,h);function g(I,A){if(p(I,A))return I;throw new Error(`Expected valid scalar < ${A}, got ${typeof I} ${I}`)}function w(I){return I===Xe?I:g(I,n)}let y=new Map;function E(I){if(!(I instanceof x))throw new Error("ExtendedPoint expected")}class x{constructor(A,R,L,O){if(this.ex=A,this.ey=R,this.ez=L,this.et=O,!b(A))throw new Error("x required");if(!b(R))throw new Error("y required");if(!b(L))throw new Error("z required");if(!b(O))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(A){if(A instanceof x)throw new Error("extended point not allowed");let{x:R,y:L}=A||{};if(!b(R)||!b(L))throw new Error("invalid affine point");return new x(R,L,Ue,f(R*L))}static normalizeZ(A){let R=t.invertBatch(A.map(L=>L.ez));return A.map((L,O)=>L.toAffine(R[O])).map(x.fromAffine)}_setWindowSize(A){this._WINDOW_SIZE=A,y.delete(this)}assertValidity(){let{a:A,d:R}=e;if(this.is0())throw new Error("bad point: ZERO");let{ex:L,ey:O,ez:F,et:K}=this,Z=f(L*L),j=f(O*O),Y=f(F*F),ue=f(Y*Y),ie=f(Z*A),be=f(Y*f(ie+j)),we=f(ue+f(R*f(Z*j)));if(be!==we)throw new Error("bad point: equation left != right (1)");let he=f(L*O),Ae=f(F*K);if(he!==Ae)throw new Error("bad point: equation left != right (2)")}equals(A){E(A);let{ex:R,ey:L,ez:O}=this,{ex:F,ey:K,ez:Z}=A,j=f(R*Z),Y=f(F*O),ue=f(L*Z),ie=f(K*O);return j===Y&&ue===ie}is0(){return this.equals(x.ZERO)}negate(){return new x(f(-this.ex),this.ey,this.ez,f(-this.et))}double(){let{a:A}=e,{ex:R,ey:L,ez:O}=this,F=f(R*R),K=f(L*L),Z=f(Vn*f(O*O)),j=f(A*F),Y=R+L,ue=f(f(Y*Y)-F-K),ie=j+K,be=ie-Z,we=j-K,he=f(ue*be),Ae=f(ie*we),ft=f(ue*we),Zt=f(be*ie);return new x(he,Ae,Zt,ft)}add(A){E(A);let{a:R,d:L}=e,{ex:O,ey:F,ez:K,et:Z}=this,{ex:j,ey:Y,ez:ue,et:ie}=A;if(R===BigInt(-1)){let Aa=f((F-O)*(Y+j)),Sa=f((F+O)*(Y-j)),hi=f(Sa-Aa);if(hi===Xe)return this.double();let Ba=f(K*Vn*ie),_a=f(Z*Vn*ue),Ia=_a+Ba,ka=Sa+Aa,Ta=_a-Ba,Zu=f(Ia*hi),Xu=f(ka*Ta),Ju=f(Ia*Ta),Qu=f(hi*ka);return new x(Zu,Xu,Qu,Ju)}let be=f(O*j),we=f(F*Y),he=f(Z*L*ie),Ae=f(K*ue),ft=f((O+F)*(j+Y)-be-we),Zt=Ae-he,jr=Ae+he,Ea=f(we-R*be),Gu=f(ft*Zt),ju=f(jr*Ea),Wu=f(ft*Ea),Yu=f(Zt*jr);return new x(Gu,ju,Yu,Wu)}subtract(A){return this.add(A.negate())}wNAF(A){return B.wNAFCached(this,y,A,x.normalizeZ)}multiply(A){let{p:R,f:L}=this.wNAF(g(A,n));return x.normalizeZ([R,L])[0]}multiplyUnsafe(A){let R=w(A);return R===Xe?v:this.equals(v)||R===Ue?this:this.equals(S)?this.wNAF(R).p:B.unsafeLadder(this,R)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return B.unsafeLadder(this,n).is0()}toAffine(A){let{ex:R,ey:L,ez:O}=this,F=this.is0();A==null&&(A=F?cd:t.inv(O));let K=f(R*A),Z=f(L*A),j=f(O*A);if(F)return{x:Xe,y:Ue};if(j!==Ue)throw new Error("invZ was invalid");return{x:K,y:Z}}clearCofactor(){let{h:A}=e;return A===Ue?this:this.multiplyUnsafe(A)}static fromHex(A,R=!1){let{d:L,a:O}=e,F=t.BYTES;A=ce("pointHex",A,F);let K=A.slice(),Z=A[F-1];K[F-1]=Z&-129;let j=Mt(K);j===Xe||(R?g(j,h):g(j,t.ORDER));let Y=f(j*j),ue=f(Y-Ue),ie=f(L*Y-O),{isValid:be,value:we}=l(ue,ie);if(!be)throw new Error("Point.fromHex: invalid y coordinate");let he=(we&Ue)===Ue,Ae=(Z&128)!==0;if(!R&&we===Xe&&Ae)throw new Error("Point.fromHex: x=0 and x_0=1");return Ae!==he&&(we=f(-we)),x.fromAffine({x:we,y:j})}static fromPrivateKey(A){return P(A).point}toRawBytes(){let{x:A,y:R}=this.toAffine(),L=er(R,t.BYTES);return L[L.length-1]|=A&Ue?128:0,L}toHex(){return mt(this.toRawBytes())}}x.BASE=new x(e.Gx,e.Gy,Ue,f(e.Gx*e.Gy)),x.ZERO=new x(Xe,Ue,Ue,Xe);let{BASE:S,ZERO:v}=x,B=Mn(x,a*8);function $(I){return Q(I,n)}function q(I){return $(Mt(I))}function P(I){let A=a;I=ce("private key",I,A);let R=ce("hashed private key",i(I),2*A),L=m(R.slice(0,A)),O=R.slice(A,2*A),F=q(L),K=S.multiply(F),Z=K.toRawBytes();return{head:L,prefix:O,scalar:F,point:K,pointBytes:Z}}function te(I){return P(I).pointBytes}function C(I=new Uint8Array,...A){let R=bt(...A);return q(i(u(R,ce("context",I),!!s)))}function Ke(I,A,R={}){I=ce("message",I),s&&(I=s(I));let{prefix:L,scalar:O,pointBytes:F}=P(A),K=C(R.context,L,I),Z=S.multiply(K).toRawBytes(),j=C(R.context,Z,F,I),Y=$(K+j*O);w(Y);let ue=bt(Z,er(Y,t.BYTES));return ce("result",ue,a*2)}let _=ld;function N(I,A,R,L=_){let{context:O,zip215:F}=L,K=t.BYTES;I=ce("signature",I,2*K),A=ce("message",A),s&&(A=s(A));let Z=Mt(I.slice(K,2*K)),j,Y,ue;try{j=x.fromHex(R,F),Y=x.fromHex(I.slice(0,K),F),ue=S.multiplyUnsafe(Z)}catch{return!1}if(!F&&j.isSmallOrder())return!1;let ie=C(O,Y.toRawBytes(),j.toRawBytes(),A);return Y.add(j.multiplyUnsafe(ie)).subtract(ue).clearCofactor().equals(x.ZERO)}return S._setWindowSize(8),{CURVE:e,getPublicKey:te,sign:Ke,verify:N,ExtendedPoint:x,utils:{getExtendedPublicKey:P,randomPrivateKey:()=>o(t.BYTES),precompute(I=8,A=x.BASE){return A._setWindowSize(I),A.multiply(BigInt(3)),A}}}}var eo=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Bc=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),Vm=BigInt(0),fd=BigInt(1),_c=BigInt(2),Hm=BigInt(3),hd=BigInt(5),dd=BigInt(8);function pd(r){let e=BigInt(10),t=BigInt(20),n=BigInt(40),s=BigInt(80),i=eo,a=r*r%i*r%i,c=ne(a,_c,i)*a%i,h=ne(c,fd,i)*r%i,f=ne(h,hd,i)*h%i,l=ne(f,e,i)*f%i,m=ne(l,t,i)*l%i,u=ne(m,n,i)*m%i,d=ne(u,s,i)*u%i,p=ne(d,s,i)*u%i,b=ne(p,e,i)*f%i;return{pow_p_5_8:ne(b,_c,i)*r%i,b2:a}}function gd(r){return r[0]&=248,r[31]&=127,r[31]|=64,r}function md(r,e){let t=eo,n=Q(e*e*e,t),s=Q(n*n*e,t),i=pd(r*s).pow_p_5_8,o=Q(r*n*i,t),a=Q(e*o*o,t),c=o,h=Q(o*Bc,t),f=a===r,l=a===Q(-r,t),m=a===Q(-r*Bc,t);return f&&(o=c),(l||m)&&(o=h),vc(o,t)&&(o=Q(-o,t)),{isValid:f||l,value:o}}var yd=Pn(eo,void 0,!0),bd={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:yd,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:dd,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Qr,randomBytes:_r,adjustScalarBytes:gd,uvRatio:md},Tr=Sc(bd);var Rr=32,wt=64,Hn=32;function Ic(){let r=Tr.utils.randomPrivateKey(),e=Tr.getPublicKey(r);return{privateKey:Nc(r,e),publicKey:e}}function kc(r){if(r.length!==Hn)throw new TypeError('"seed" must be 32 bytes in length.');if(!(r instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, or Uint8Array.');let e=r,t=Tr.getPublicKey(e);return{privateKey:Nc(e,t),publicKey:t}}function Tc(r,e){let t=r.subarray(0,Hn);return Tr.sign(e instanceof Uint8Array?e:e.subarray(),t)}function Rc(r,e,t){return Tr.verify(e,t instanceof Uint8Array?t:t.subarray(),r)}function Nc(r,e){let t=new Uint8Array(wt);for(let n=0;n<Hn;n++)t[n]=r[n],t[Hn+n]=e[n];return t}var Te={get(r=globalThis){let e=r.crypto;if(e==null||e.subtle==null)throw Object.assign(new Error("Missing Web Crypto API. The most likely cause of this error is that this page is being accessed from an insecure context (i.e. not HTTPS). For more information and possible resolutions see https://github.com/libp2p/js-libp2p/blob/main/packages/crypto/README.md#web-crypto-api"),{code:"ERR_MISSING_WEB_CRYPTO"});return e}};var to={alg:"A128GCM",ext:!0,k:"scm9jmO_4BJAgdwWGVulLg",key_ops:["encrypt","decrypt"],kty:"oct"};function Cc(r){let e=r?.algorithm??"AES-GCM",t=r?.keyLength??16,n=r?.nonceLength??12,s=r?.digest??"SHA-256",i=r?.saltLength??16,o=r?.iterations??32767,a=Te.get();t*=8;async function c(l,m){let u=a.getRandomValues(new Uint8Array(i)),d=a.getRandomValues(new Uint8Array(n)),p={name:e,iv:d};typeof m=="string"&&(m=M(m));let b;if(m.length===0){b=await a.subtle.importKey("jwk",to,{name:"AES-GCM"},!0,["encrypt"]);try{let w={name:"PBKDF2",salt:u,iterations:o,hash:{name:s}},y=await a.subtle.importKey("raw",m,{name:"PBKDF2"},!1,["deriveKey"]);b=await a.subtle.deriveKey(w,y,{name:e,length:t},!0,["encrypt"])}catch{b=await a.subtle.importKey("jwk",to,{name:"AES-GCM"},!0,["encrypt"])}}else{let w={name:"PBKDF2",salt:u,iterations:o,hash:{name:s}},y=await a.subtle.importKey("raw",m,{name:"PBKDF2"},!1,["deriveKey"]);b=await a.subtle.deriveKey(w,y,{name:e,length:t},!0,["encrypt"])}let g=await a.subtle.encrypt(p,b,l);return ke([u,p.iv,new Uint8Array(g)])}async function h(l,m){let u=l.subarray(0,i),d=l.subarray(i,i+n),p=l.subarray(i+n),b={name:e,iv:d};typeof m=="string"&&(m=M(m));let g;if(m.length===0)try{let y={name:"PBKDF2",salt:u,iterations:o,hash:{name:s}},E=await a.subtle.importKey("raw",m,{name:"PBKDF2"},!1,["deriveKey"]);g=await a.subtle.deriveKey(y,E,{name:e,length:t},!0,["decrypt"])}catch{g=await a.subtle.importKey("jwk",to,{name:"AES-GCM"},!0,["decrypt"])}else{let y={name:"PBKDF2",salt:u,iterations:o,hash:{name:s}},E=await a.subtle.importKey("raw",m,{name:"PBKDF2"},!1,["deriveKey"]);g=await a.subtle.deriveKey(y,E,{name:e,length:t},!0,["decrypt"])}let w=await a.subtle.decrypt(b,g,p);return new Uint8Array(w)}return{encrypt:c,decrypt:h}}async function Nr(r,e){let n=await Cc().encrypt(r,e);return ki.encode(n)}var vd=Math.pow(2,7),Ed=Math.pow(2,14),Ad=Math.pow(2,21),ro=Math.pow(2,28),no=Math.pow(2,35),so=Math.pow(2,42),io=Math.pow(2,49),X=128,Se=127;function Be(r){if(r<vd)return 1;if(r<Ed)return 2;if(r<Ad)return 3;if(r<ro)return 4;if(r<no)return 5;if(r<so)return 6;if(r<io)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function oo(r,e,t=0){switch(Be(r)){case 8:e[t++]=r&255|X,r/=128;case 7:e[t++]=r&255|X,r/=128;case 6:e[t++]=r&255|X,r/=128;case 5:e[t++]=r&255|X,r/=128;case 4:e[t++]=r&255|X,r>>>=7;case 3:e[t++]=r&255|X,r>>>=7;case 2:e[t++]=r&255|X,r>>>=7;case 1:{e[t++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return e}function Sd(r,e,t=0){switch(Be(r)){case 8:e.set(t++,r&255|X),r/=128;case 7:e.set(t++,r&255|X),r/=128;case 6:e.set(t++,r&255|X),r/=128;case 5:e.set(t++,r&255|X),r/=128;case 4:e.set(t++,r&255|X),r>>>=7;case 3:e.set(t++,r&255|X),r>>>=7;case 2:e.set(t++,r&255|X),r>>>=7;case 1:{e.set(t++,r&255),r>>>=7;break}default:throw new Error("unreachable")}return e}function ao(r,e){let t=r[e],n=0;if(n+=t&Se,t<X||(t=r[e+1],n+=(t&Se)<<7,t<X)||(t=r[e+2],n+=(t&Se)<<14,t<X)||(t=r[e+3],n+=(t&Se)<<21,t<X)||(t=r[e+4],n+=(t&Se)*ro,t<X)||(t=r[e+5],n+=(t&Se)*no,t<X)||(t=r[e+6],n+=(t&Se)*so,t<X)||(t=r[e+7],n+=(t&Se)*io,t<X))return n;throw new RangeError("Could not decode varint")}function Bd(r,e){let t=r.get(e),n=0;if(n+=t&Se,t<X||(t=r.get(e+1),n+=(t&Se)<<7,t<X)||(t=r.get(e+2),n+=(t&Se)<<14,t<X)||(t=r.get(e+3),n+=(t&Se)<<21,t<X)||(t=r.get(e+4),n+=(t&Se)*ro,t<X)||(t=r.get(e+5),n+=(t&Se)*no,t<X)||(t=r.get(e+6),n+=(t&Se)*so,t<X)||(t=r.get(e+7),n+=(t&Se)*io,t<X))return n;throw new RangeError("Could not decode varint")}function Ge(r,e,t=0){return e==null&&(e=Ne(Be(r))),e instanceof Uint8Array?oo(r,e,t):Sd(r,e,t)}function xt(r,e=0){return r instanceof Uint8Array?ao(r,e):Bd(r,e)}var co=new Float32Array([-0]),Ht=new Uint8Array(co.buffer);function Lc(r,e,t){co[0]=r,e[t]=Ht[0],e[t+1]=Ht[1],e[t+2]=Ht[2],e[t+3]=Ht[3]}function Uc(r,e){return Ht[0]=r[e],Ht[1]=r[e+1],Ht[2]=r[e+2],Ht[3]=r[e+3],co[0]}var lo=new Float64Array([-0]),_e=new Uint8Array(lo.buffer);function Dc(r,e,t){lo[0]=r,e[t]=_e[0],e[t+1]=_e[1],e[t+2]=_e[2],e[t+3]=_e[3],e[t+4]=_e[4],e[t+5]=_e[5],e[t+6]=_e[6],e[t+7]=_e[7]}function Oc(r,e){return _e[0]=r[e],_e[1]=r[e+1],_e[2]=r[e+2],_e[3]=r[e+3],_e[4]=r[e+4],_e[5]=r[e+5],_e[6]=r[e+6],_e[7]=r[e+7],lo[0]}var _d=BigInt(Number.MAX_SAFE_INTEGER),Id=BigInt(Number.MIN_SAFE_INTEGER),De=class r{lo;hi;constructor(e,t){this.lo=e|0,this.hi=t|0}toNumber(e=!1){if(!e&&this.hi>>>31>0){let t=~this.lo+1>>>0,n=~this.hi>>>0;return t===0&&(n=n+1>>>0),-(t+n*4294967296)}return this.lo+this.hi*4294967296}toBigInt(e=!1){if(e)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let t=~this.lo+1>>>0,n=~this.hi>>>0;return t===0&&(n=n+1>>>0),-(BigInt(t)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(e=!1){return this.toBigInt(e).toString()}zzEncode(){let e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this}zzDecode(){let e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this}length(){let e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?t===0?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}static fromBigInt(e){if(e===0n)return rr;if(e<_d&&e>Id)return this.fromNumber(Number(e));let t=e<0n;t&&(e=-e);let n=e>>32n,s=e-(n<<32n);return t&&(n=~n|0n,s=~s|0n,++s>Pc&&(s=0n,++n>Pc&&(n=0n))),new r(Number(s),Number(n))}static fromNumber(e){if(e===0)return rr;let t=e<0;t&&(e=-e);let n=e>>>0,s=(e-n)/4294967296>>>0;return t&&(s=~s>>>0,n=~n>>>0,++n>4294967295&&(n=0,++s>4294967295&&(s=0))),new r(n,s)}static from(e){return typeof e=="number"?r.fromNumber(e):typeof e=="bigint"?r.fromBigInt(e):typeof e=="string"?r.fromBigInt(BigInt(e)):e.low!=null||e.high!=null?new r(e.low>>>0,e.high>>>0):rr}},rr=new De(0,0);rr.toBigInt=function(){return 0n};rr.zzEncode=rr.zzDecode=function(){return this};rr.length=function(){return 1};var Pc=4294967296n;function Mc(r){let e=0,t=0;for(let n=0;n<r.length;++n)t=r.charCodeAt(n),t<128?e+=1:t<2048?e+=2:(t&64512)===55296&&(r.charCodeAt(n+1)&64512)===56320?(++n,e+=4):e+=3;return e}function Vc(r,e,t){if(t-e<1)return"";let s,i=[],o=0,a;for(;e<t;)a=r[e++],a<128?i[o++]=a:a>191&&a<224?i[o++]=(a&31)<<6|r[e++]&63:a>239&&a<365?(a=((a&7)<<18|(r[e++]&63)<<12|(r[e++]&63)<<6|r[e++]&63)-65536,i[o++]=55296+(a>>10),i[o++]=56320+(a&1023)):i[o++]=(a&15)<<12|(r[e++]&63)<<6|r[e++]&63,o>8191&&((s??(s=[])).push(String.fromCharCode.apply(String,i)),o=0);return s!=null?(o>0&&s.push(String.fromCharCode.apply(String,i.slice(0,o))),s.join("")):String.fromCharCode.apply(String,i.slice(0,o))}function uo(r,e,t){let n=t,s,i;for(let o=0;o<r.length;++o)s=r.charCodeAt(o),s<128?e[t++]=s:s<2048?(e[t++]=s>>6|192,e[t++]=s&63|128):(s&64512)===55296&&((i=r.charCodeAt(o+1))&64512)===56320?(s=65536+((s&1023)<<10)+(i&1023),++o,e[t++]=s>>18|240,e[t++]=s>>12&63|128,e[t++]=s>>6&63|128,e[t++]=s&63|128):(e[t++]=s>>12|224,e[t++]=s>>6&63|128,e[t++]=s&63|128);return t-n}function Je(r,e){return RangeError(`index out of range: ${r.pos} + ${e??1} > ${r.len}`)}function Kn(r,e){return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0}var fo=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(e){this.buf=e,this.pos=0,this.len=e.length}uint32(){let e=4294967295;if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,Je(this,10);return e}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw Je(this,4);return Kn(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw Je(this,4);return Kn(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw Je(this,4);let e=Uc(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw Je(this,4);let e=Oc(this.buf,this.pos);return this.pos+=8,e}bytes(){let e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw Je(this,e);return this.pos+=e,t===n?new Uint8Array(0):this.buf.subarray(t,n)}string(){let e=this.bytes();return Vc(e,0,e.length)}skip(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Je(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Je(this);while(this.buf[this.pos++]&128);return this}skipType(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${e} at offset ${this.pos}`)}return this}readLongVarint(){let e=new De(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(this.buf[this.pos]&127)<<28)>>>0,e.hi=(e.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return e;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw Je(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,e}if(this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw Je(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw Je(this,8);let e=Kn(this.buf,this.pos+=4),t=Kn(this.buf,this.pos+=4);return new De(e,t)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){let e=ao(this.buf,this.pos);return this.pos+=Be(e),e}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 ho(r){return new fo(r instanceof Uint8Array?r:r.subarray())}function Oe(r,e,t){let n=ho(r);return e.decode(n,void 0,t)}function po(r){let e=r??8192,t=e>>>1,n,s=e;return function(o){if(o<1||o>t)return Ne(o);s+o>e&&(n=Ne(e),s=0);let a=n.subarray(s,s+=o);return s&7&&(s=(s|7)+1),a}}var nr=class{fn;len;next;val;constructor(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}};function go(){}var yo=class{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}},kd=po();function Td(r){return globalThis.Buffer!=null?Ne(r):kd(r)}var nn=class{len;head;tail;states;constructor(){this.len=0,this.head=new nr(go,0,0),this.tail=this.head,this.states=null}_push(e,t,n){return this.tail=this.tail.next=new nr(e,t,n),this.len+=t,this}uint32(e){return this.len+=(this.tail=this.tail.next=new bo((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this}int32(e){return e<0?this._push(qn,10,De.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){let t=De.fromBigInt(e);return this._push(qn,t.length(),t)}uint64Number(e){return this._push(oo,Be(e),e)}uint64String(e){return this.uint64(BigInt(e))}int64(e){return this.uint64(e)}int64Number(e){return this.uint64Number(e)}int64String(e){return this.uint64String(e)}sint64(e){let t=De.fromBigInt(e).zzEncode();return this._push(qn,t.length(),t)}sint64Number(e){let t=De.fromNumber(e).zzEncode();return this._push(qn,t.length(),t)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(mo,1,e?1:0)}fixed32(e){return this._push(rn,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let t=De.fromBigInt(e);return this._push(rn,4,t.lo)._push(rn,4,t.hi)}fixed64Number(e){let t=De.fromNumber(e);return this._push(rn,4,t.lo)._push(rn,4,t.hi)}fixed64String(e){return this.fixed64(BigInt(e))}sfixed64(e){return this.fixed64(e)}sfixed64Number(e){return this.fixed64Number(e)}sfixed64String(e){return this.fixed64String(e)}float(e){return this._push(Lc,4,e)}double(e){return this._push(Dc,8,e)}bytes(e){let t=e.length>>>0;return t===0?this._push(mo,1,0):this.uint32(t)._push(Nd,t,e)}string(e){let t=Mc(e);return t!==0?this.uint32(t)._push(uo,t,e):this._push(mo,1,0)}fork(){return this.states=new yo(this),this.head=this.tail=new nr(go,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 nr(go,0,0),this.len=0),this}ldelim(){let e=this.head,t=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=e.next,this.tail=t,this.len+=n),this}finish(){let e=this.head.next,t=Td(this.len),n=0;for(;e!=null;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t}};function mo(r,e,t){e[t]=r&255}function Rd(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}var bo=class extends nr{next;constructor(e,t){super(Rd,e,t),this.next=void 0}};function qn(r,e,t){for(;r.hi!==0;)e[t++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)e[t++]=r.lo&127|128,r.lo=r.lo>>>7;e[t++]=r.lo}function rn(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}function Nd(r,e,t){e.set(r,t)}globalThis.Buffer!=null&&(nn.prototype.bytes=function(r){let e=r.length>>>0;return this.uint32(e),e>0&&this._push(Cd,e,r),this},nn.prototype.string=function(r){let e=globalThis.Buffer.byteLength(r);return this.uint32(e),e>0&&this._push(Ld,e,r),this});function Cd(r,e,t){e.set(r,t)}function Ld(r,e,t){r.length<40?uo(r,e,t):e.utf8Write!=null?e.utf8Write(r,t):e.set(M(r),t)}function wo(){return new nn}function Pe(r,e){let t=wo();return e.encode(r,t,{lengthDelimited:!1}),t.finish()}var Cr;(function(r){r[r.VARINT=0]="VARINT",r[r.BIT64=1]="BIT64",r[r.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",r[r.START_GROUP=3]="START_GROUP",r[r.END_GROUP=4]="END_GROUP",r[r.BIT32=5]="BIT32"})(Cr||(Cr={}));function zn(r,e,t,n){return{name:r,type:e,encode:t,decode:n}}function sr(r){function e(s){if(r[s.toString()]==null)throw new Error("Invalid enum value");return r[s]}let t=function(i,o){let a=e(i);o.int32(a)},n=function(i){let o=i.int32();return e(o)};return zn("enum",Cr.VARINT,t,n)}function Me(r,e){return zn("message",Cr.LENGTH_DELIMITED,r,e)}var sn=class extends Error{code;constructor(e,t,n){super(e,n),this.code=t}};var se;(function(r){r.RSA="RSA",r.Ed25519="Ed25519",r.Secp256k1="Secp256k1"})(se||(se={}));var xo;(function(r){r[r.RSA=0]="RSA",r[r.Ed25519=1]="Ed25519",r[r.Secp256k1=2]="Secp256k1"})(xo||(xo={}));(function(r){r.codec=()=>sr(xo)})(se||(se={}));var it;(function(r){let e;r.codec=()=>(e==null&&(e=Me((t,n,s={})=>{s.lengthDelimited!==!1&&n.fork(),t.Type!=null&&(n.uint32(8),se.codec().encode(t.Type,n)),t.Data!=null&&(n.uint32(18),n.bytes(t.Data)),s.lengthDelimited!==!1&&n.ldelim()},(t,n)=>{let s={},i=n==null?t.len:t.pos+n;for(;t.pos<i;){let o=t.uint32();switch(o>>>3){case 1:s.Type=se.codec().decode(t);break;case 2:s.Data=t.bytes();break;default:t.skipType(o&7);break}}return s})),e),r.encode=t=>Pe(t,r.codec()),r.decode=t=>Oe(t,r.codec())})(it||(it={}));var ot;(function(r){let e;r.codec=()=>(e==null&&(e=Me((t,n,s={})=>{s.lengthDelimited!==!1&&n.fork(),t.Type!=null&&(n.uint32(8),se.codec().encode(t.Type,n)),t.Data!=null&&(n.uint32(18),n.bytes(t.Data)),s.lengthDelimited!==!1&&n.ldelim()},(t,n)=>{let s={},i=n==null?t.len:t.pos+n;for(;t.pos<i;){let o=t.uint32();switch(o>>>3){case 1:s.Type=se.codec().decode(t);break;case 2:s.Data=t.bytes();break;default:t.skipType(o&7);break}}return s})),e),r.encode=t=>Pe(t,r.codec()),r.decode=t=>Oe(t,r.codec())})(ot||(ot={}));var on=class{_key;constructor(e){this._key=Lr(e,Rr)}verify(e,t){return Rc(this._key,t,e)}marshal(){return this._key}get bytes(){return it.encode({Type:se.Ed25519,Data:this.marshal()}).subarray()}equals(e){return ae(this.bytes,e.bytes)}hash(){let e=me.digest(this.bytes);return $e(e)?e.then(({bytes:t})=>t):e.bytes}},ir=class{_key;_publicKey;constructor(e,t){this._key=Lr(e,wt),this._publicKey=Lr(t,Rr)}sign(e){return Tc(this._key,e)}get public(){return new on(this._publicKey)}marshal(){return this._key}get bytes(){return ot.encode({Type:se.Ed25519,Data:this.marshal()}).subarray()}equals(e){return ae(this.bytes,e.bytes)}async hash(){let e=me.digest(this.bytes),t;return $e(e)?{bytes:t}=await e:t=e.bytes,t}async id(){let e=pt.digest(this.public.bytes);return de.encode(e.bytes).substring(1)}async export(e,t="libp2p-key"){if(t==="libp2p-key")return Nr(this.bytes,e);throw new U(`export format '${t}' is not supported`,"ERR_INVALID_EXPORT_FORMAT")}};function Ud(r){if(r.length>wt){r=Lr(r,wt+Rr);let n=r.subarray(0,wt),s=r.subarray(wt,r.length);return new ir(n,s)}r=Lr(r,wt);let e=r.subarray(0,wt),t=r.subarray(Rr);return new ir(e,t)}function Dd(r){return r=Lr(r,Rr),new on(r)}async function Od(){let{privateKey:r,publicKey:e}=Ic();return new ir(r,e)}async function Fc(r){let{privateKey:e,publicKey:t}=kc(r);return new ir(e,t)}function Lr(r,e){if(r=Uint8Array.from(r??[]),r.length!==e)throw new U(`Key must be a Uint8Array of length ${e}, got ${r.length}`,"ERR_INVALID_KEY_TYPE");return r}var No={};ge(No,{MAX_RSA_KEY_SIZE:()=>bn,RsaPrivateKey:()=>Mr,RsaPublicKey:()=>yn,fromJwk:()=>lp,generateKeyPair:()=>up,unmarshalRsaPrivateKey:()=>To,unmarshalRsaPublicKey:()=>cp});function at(r){if(isNaN(r)||r<=0)throw new U("random bytes length must be a Number bigger than 0","ERR_INVALID_LENGTH");return _r(r)}var zt={};ge(zt,{exportToPem:()=>np,importFromPem:()=>sp,jwkToPkcs1:()=>Qd,jwkToPkix:()=>tp,pkcs1ToJwk:()=>Jd,pkixToJwk:()=>ep});var Gn=class extends Sr{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,Rn(e);let n=Ut(t);if(this.iHash=e.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 s=this.blockLen,i=new Uint8Array(s);i.set(n.length>s?e.create().update(n).digest():n);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=e.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),i.fill(0)}update(e){return Ar(this),this.iHash.update(e),this}digestInto(e){Ar(this),Er(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:t,iHash:n,finished:s,destroyed:i,blockLen:o,outputLen:a}=this;return e=e,e.finished=s,e.destroyed=i,e.blockLen=o,e.outputLen=a,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},an=(r,e,t)=>new Gn(r,e).update(t).digest();an.create=(r,e)=>new Gn(r,e);function Pd(r,e,t,n){Rn(r);let s=fc({dkLen:32,asyncTick:10},n),{c:i,dkLen:o,asyncTick:a}=s;if(vr(i),vr(o),vr(a),i<1)throw new Error("PBKDF2: iterations (c) should be >= 1");let c=Ut(e),h=Ut(t),f=new Uint8Array(o),l=an.create(r,c),m=l._cloneInto().update(h);return{c:i,dkLen:o,asyncTick:a,DK:f,PRF:l,PRFSalt:m}}function Md(r,e,t,n,s){return r.destroy(),e.destroy(),n&&n.destroy(),s.fill(0),t}async function Eo(r,e,t,n){let{c:s,dkLen:i,asyncTick:o,DK:a,PRF:c,PRFSalt:h}=Pd(r,e,t,n),f,l=new Uint8Array(4),m=Br(l),u=new Uint8Array(c.outputLen);for(let d=1,p=0;p<i;d++,p+=c.outputLen){let b=a.subarray(p,p+c.outputLen);m.setInt32(0,d,!1),(f=h._cloneInto(f)).update(l).digestInto(u),b.set(u.subarray(0,b.length)),await lc(s-1,o,()=>{c._cloneInto(f).update(u).digestInto(u);for(let g=0;g<b.length;g++)b[g]^=u[g]})}return Md(c,h,a,f,u)}var G=pi(Kc());function or(r,e){let t=0;if(r.length===1)return r[0];for(let n=r.length-1;n>=0;n--)t+=r[r.length-1-n]*Math.pow(2,e*n);return t}function Ft(r,e,t=-1){let n=t,s=r,i=0,o=Math.pow(2,e);for(let a=1;a<8;a++){if(r<o){let c;if(n<0)c=new ArrayBuffer(a),i=a;else{if(n<a)return new ArrayBuffer(0);c=new ArrayBuffer(n),i=n}let h=new Uint8Array(c);for(let f=a-1;f>=0;f--){let l=Math.pow(2,f*e);h[i-f-1]=Math.floor(s/l),s-=h[i-f-1]*l}return c}o*=Math.pow(2,e)}return new ArrayBuffer(0)}function Yn(...r){let e=0,t=0;for(let i of r)e+=i.length;let n=new ArrayBuffer(e),s=new Uint8Array(n);for(let i of r)s.set(i,t),t+=i.length;return s}function So(){let r=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){let a=r[0]===255&&r[1]&128,c=r[0]===0&&(r[1]&128)===0;(a||c)&&this.warnings.push("Needlessly long format")}let e=new ArrayBuffer(this.valueHex.byteLength),t=new Uint8Array(e);for(let a=0;a<this.valueHex.byteLength;a++)t[a]=0;t[0]=r[0]&128;let n=or(t,8),s=new ArrayBuffer(this.valueHex.byteLength),i=new Uint8Array(s);for(let a=0;a<this.valueHex.byteLength;a++)i[a]=r[a];return i[0]&=127,or(i,8)-n}function qc(r){let e=r<0?r*-1:r,t=128;for(let n=1;n<8;n++){if(e<=t){if(r<0){let o=t-e,a=Ft(o,8,n),c=new Uint8Array(a);return c[0]|=128,a}let s=Ft(e,8,n),i=new Uint8Array(s);if(i[0]&128){let o=s.slice(0),a=new Uint8Array(o);s=new ArrayBuffer(s.byteLength+1),i=new Uint8Array(s);for(let c=0;c<o.byteLength;c++)i[c+1]=a[c];i[0]=0}return s}t*=Math.pow(2,8)}return new ArrayBuffer(0)}function zc(r,e){if(r.byteLength!==e.byteLength)return!1;let t=new Uint8Array(r),n=new Uint8Array(e);for(let s=0;s<t.length;s++)if(t[s]!==n[s])return!1;return!0}function Ce(r,e){let t=r.toString(10);if(e<t.length)return"";let n=e-t.length,s=new Array(n);for(let o=0;o<n;o++)s[o]="0";return s.join("").concat(t)}var Gy=Math.log(2);function Zn(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function Bo(r){let e=0,t=0;for(let s=0;s<r.length;s++){let i=r[s];e+=i.byteLength}let n=new Uint8Array(e);for(let s=0;s<r.length;s++){let i=r[s];n.set(new Uint8Array(i),t),t+=i.byteLength}return n.buffer}function Bt(r,e,t,n){return e instanceof Uint8Array?e.byteLength?t<0?(r.error="Wrong parameter: inputOffset less than zero",!1):n<0?(r.error="Wrong parameter: inputLength less than zero",!1):e.byteLength-t-n<0?(r.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):!0:(r.error="Wrong parameter: inputBuffer has zero length",!1):(r.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}var ln=class{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return Bo(this.items)}},cn=[new Uint8Array([1])],$c="0123456789";var Or="",et=new ArrayBuffer(0),_o=new Uint8Array(0),un="EndOfContent",jc="OCTET STRING",Wc="BIT STRING";function _t(r){var e;return e=class extends r{constructor(...n){var s;super(...n);let i=n[0]||{};this.isHexOnly=(s=i.isHexOnly)!==null&&s!==void 0?s:!1,this.valueHexView=i.valueHex?G.BufferSourceConverter.toUint8Array(i.valueHex):_o}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(n){this.valueHexView=new Uint8Array(n)}fromBER(n,s,i){let o=n instanceof ArrayBuffer?new Uint8Array(n):n;if(!Bt(this,o,s,i))return-1;let a=s+i;return this.valueHexView=o.subarray(s,a),this.valueHexView.length?(this.blockLength=i,a):(this.warnings.push("Zero buffer length"),s)}toBER(n=!1){return this.isHexOnly?n?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer:(this.error="Flag 'isHexOnly' is not set, abort",et)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:G.Convert.ToHex(this.valueHexView)}}},e.NAME="hexBlock",e}var Et=class{constructor({blockLength:e=0,error:t=Or,warnings:n=[],valueBeforeDecode:s=_o}={}){this.blockLength=e,this.error=t,this.warnings=n,this.valueBeforeDecodeView=G.BufferSourceConverter.toUint8Array(s)}static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(e){this.valueBeforeDecodeView=new Uint8Array(e)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:G.Convert.ToHex(this.valueBeforeDecodeView)}}};Et.NAME="baseBlock";var Ie=class extends Et{fromBER(e,t,n){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(e,t){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}};Ie.NAME="valueBlock";var Xn=class extends _t(Et){constructor({idBlock:e={}}={}){var t,n,s,i;super(),e?(this.isHexOnly=(t=e.isHexOnly)!==null&&t!==void 0?t:!1,this.valueHexView=e.valueHex?G.BufferSourceConverter.toUint8Array(e.valueHex):_o,this.tagClass=(n=e.tagClass)!==null&&n!==void 0?n:-1,this.tagNumber=(s=e.tagNumber)!==null&&s!==void 0?s:-1,this.isConstructed=(i=e.isConstructed)!==null&&i!==void 0?i:!1):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(e=!1){let t=0;switch(this.tagClass){case 1:t|=0;break;case 2:t|=64;break;case 3:t|=128;break;case 4:t|=192;break;default:return this.error="Unknown tag class",et}if(this.isConstructed&&(t|=32),this.tagNumber<31&&!this.isHexOnly){let s=new Uint8Array(1);if(!e){let i=this.tagNumber;i&=31,t|=i,s[0]=t}return s.buffer}if(!this.isHexOnly){let s=Ft(this.tagNumber,7),i=new Uint8Array(s),o=s.byteLength,a=new Uint8Array(o+1);if(a[0]=t|31,!e){for(let c=0;c<o-1;c++)a[c+1]=i[c]|128;a[o]=i[o-1]}return a.buffer}let n=new Uint8Array(this.valueHexView.byteLength+1);if(n[0]=t|31,!e){let s=this.valueHexView;for(let i=0;i<s.length-1;i++)n[i+1]=s[i]|128;n[this.valueHexView.byteLength]=s[s.length-1]}return n.buffer}fromBER(e,t,n){let s=G.BufferSourceConverter.toUint8Array(e);if(!Bt(this,s,t,n))return-1;let i=s.subarray(t,t+n);if(i.length===0)return this.error="Zero buffer length",-1;switch(i[0]&192){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:return this.error="Unknown tag class",-1}this.isConstructed=(i[0]&32)===32,this.isHexOnly=!1;let a=i[0]&31;if(a!==31)this.tagNumber=a,this.blockLength=1;else{let c=1,h=this.valueHexView=new Uint8Array(255),f=255;for(;i[c]&128;){if(h[c-1]=i[c]&127,c++,c>=i.length)return this.error="End of input reached before message was fully decoded",-1;if(c===f){f+=255;let m=new Uint8Array(f);for(let u=0;u<h.length;u++)m[u]=h[u];h=this.valueHexView=new Uint8Array(f)}}this.blockLength=c+1,h[c-1]=i[c]&127;let l=new Uint8Array(c);for(let m=0;m<c;m++)l[m]=h[m];h=this.valueHexView=new Uint8Array(c),h.set(l),this.blockLength<=9?this.tagNumber=or(h,7):(this.isHexOnly=!0,this.warnings.push("Tag too long, represented as hex-coded"))}if(this.tagClass===1&&this.isConstructed)switch(this.tagNumber){case 1:case 2:case 5:case 6:case 9:case 13:case 14:case 23:case 24:case 31:case 32:case 33:case 34:return this.error="Constructed encoding used for primitive type",-1}return t+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}};Xn.NAME="identificationBlock";var Jn=class extends Et{constructor({lenBlock:e={}}={}){var t,n,s;super(),this.isIndefiniteForm=(t=e.isIndefiniteForm)!==null&&t!==void 0?t:!1,this.longFormUsed=(n=e.longFormUsed)!==null&&n!==void 0?n:!1,this.length=(s=e.length)!==null&&s!==void 0?s:0}fromBER(e,t,n){let s=G.BufferSourceConverter.toUint8Array(e);if(!Bt(this,s,t,n))return-1;let i=s.subarray(t,t+n);if(i.length===0)return this.error="Zero buffer length",-1;if(i[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=i[0]===128,this.isIndefiniteForm)return this.blockLength=1,t+this.blockLength;if(this.longFormUsed=!!(i[0]&128),this.longFormUsed===!1)return this.length=i[0],this.blockLength=1,t+this.blockLength;let o=i[0]&127;if(o>8)return this.error="Too big integer",-1;if(o+1>i.length)return this.error="End of input reached before message was fully decoded",-1;let a=t+1,c=s.subarray(a,a+o);return c[o-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=or(c,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=o+1,t+this.blockLength}toBER(e=!1){let t,n;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(t),n[0]=128),t;if(this.longFormUsed){let s=Ft(this.length,8);if(s.byteLength>127)return this.error="Too big length",et;if(t=new ArrayBuffer(s.byteLength+1),e)return t;let i=new Uint8Array(s);n=new Uint8Array(t),n[0]=s.byteLength|128;for(let o=0;o<s.byteLength;o++)n[o+1]=i[o];return t}return t=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(t),n[0]=this.length),t}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}};Jn.NAME="lengthBlock";var T={},ve=class extends Et{constructor({name:e=Or,optional:t=!1,primitiveSchema:n,...s}={},i){super(s),this.name=e,this.optional=t,n&&(this.primitiveSchema=n),this.idBlock=new Xn(s),this.lenBlock=new Jn(s),this.valueBlock=i?new i(s):new Ie(s)}fromBER(e,t,n){let s=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return s===-1?(this.error=this.valueBlock.error,s):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),s)}toBER(e,t){let n=t||new ln;t||Yc(this);let s=this.idBlock.toBER(e);if(n.write(s),this.lenBlock.isIndefiniteForm)n.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,n),n.write(new ArrayBuffer(2));else{let i=this.valueBlock.toBER(e);this.lenBlock.length=i.byteLength;let o=this.lenBlock.toBER(e);n.write(o),n.write(i)}return t?et:n.final()}toJSON(){let e={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(e.primitiveSchema=this.primitiveSchema.toJSON()),e}toString(e="ascii"){return e==="ascii"?this.onAsciiEncoding():G.Convert.ToHex(this.toBER())}onAsciiEncoding(){return`${this.constructor.NAME} : ${G.Convert.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;let t=this.toBER(),n=e.toBER();return zc(t,n)}};ve.NAME="BaseBlock";function Yc(r){if(r instanceof T.Constructed)for(let e of r.valueBlock.value)Yc(e)&&(r.lenBlock.isIndefiniteForm=!0);return!!r.lenBlock.isIndefiniteForm}var Qn=class extends ve{constructor({value:e=Or,...t}={},n){super(t,n),e&&this.fromString(e)}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}fromBER(e,t,n){let s=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return s===-1?(this.error=this.valueBlock.error,s):(this.fromBuffer(this.valueBlock.valueHexView),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),s)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}};Qn.NAME="BaseStringBlock";var es=class extends _t(Ie){constructor({isHexOnly:e=!0,...t}={}){super(t),this.isHexOnly=e}};es.NAME="PrimitiveValueBlock";var Zc,ts=class extends ve{constructor(e={}){super(e,es),this.idBlock.isConstructed=!1}};Zc=ts;T.Primitive=Zc;ts.NAME="PRIMITIVE";function jd(r,e){if(r instanceof e)return r;let t=new e;return t.idBlock=r.idBlock,t.lenBlock=r.lenBlock,t.warnings=r.warnings,t.valueBeforeDecodeView=r.valueBeforeDecodeView,t}function Us(r,e=0,t=r.length){let n=e,s=new ve({},Ie),i=new Et;if(!Bt(i,r,e,t))return s.error=i.error,{offset:-1,result:s};if(!r.subarray(e,e+t).length)return s.error="Zero buffer length",{offset:-1,result:s};let a=s.idBlock.fromBER(r,e,t);if(s.idBlock.warnings.length&&s.warnings.concat(s.idBlock.warnings),a===-1)return s.error=s.idBlock.error,{offset:-1,result:s};if(e=a,t-=s.idBlock.blockLength,a=s.lenBlock.fromBER(r,e,t),s.lenBlock.warnings.length&&s.warnings.concat(s.lenBlock.warnings),a===-1)return s.error=s.lenBlock.error,{offset:-1,result:s};if(e=a,t-=s.lenBlock.blockLength,!s.idBlock.isConstructed&&s.lenBlock.isIndefiniteForm)return s.error="Indefinite length form used for primitive encoding form",{offset:-1,result:s};let c=ve;switch(s.idBlock.tagClass){case 1:if(s.idBlock.tagNumber>=37&&s.idBlock.isHexOnly===!1)return s.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:s};switch(s.idBlock.tagNumber){case 0:if(s.idBlock.isConstructed&&s.lenBlock.length>0)return s.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:s};c=T.EndOfContent;break;case 1:c=T.Boolean;break;case 2:c=T.Integer;break;case 3:c=T.BitString;break;case 4:c=T.OctetString;break;case 5:c=T.Null;break;case 6:c=T.ObjectIdentifier;break;case 10:c=T.Enumerated;break;case 12:c=T.Utf8String;break;case 13:c=T.RelativeObjectIdentifier;break;case 14:c=T.TIME;break;case 15:return s.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:s};case 16:c=T.Sequence;break;case 17:c=T.Set;break;case 18:c=T.NumericString;break;case 19:c=T.PrintableString;break;case 20:c=T.TeletexString;break;case 21:c=T.VideotexString;break;case 22:c=T.IA5String;break;case 23:c=T.UTCTime;break;case 24:c=T.GeneralizedTime;break;case 25:c=T.GraphicString;break;case 26:c=T.VisibleString;break;case 27:c=T.GeneralString;break;case 28:c=T.UniversalString;break;case 29:c=T.CharacterString;break;case 30:c=T.BmpString;break;case 31:c=T.DATE;break;case 32:c=T.TimeOfDay;break;case 33:c=T.DateTime;break;case 34:c=T.Duration;break;default:{let h=s.idBlock.isConstructed?new T.Constructed:new T.Primitive;h.idBlock=s.idBlock,h.lenBlock=s.lenBlock,h.warnings=s.warnings,s=h}}break;case 2:case 3:case 4:default:c=s.idBlock.isConstructed?T.Constructed:T.Primitive}return s=jd(s,c),a=s.fromBER(r,e,s.lenBlock.isIndefiniteForm?t:s.lenBlock.length),s.valueBeforeDecodeView=r.subarray(n,n+s.blockLength),{offset:a,result:s}}function Pr(r){if(!r.byteLength){let e=new ve({},Ie);return e.error="Input buffer has zero length",{offset:-1,result:e}}return Us(G.BufferSourceConverter.toUint8Array(r).slice(),0,r.byteLength)}function Wd(r,e){return r?1:e}var ct=class extends Ie{constructor({value:e=[],isIndefiniteForm:t=!1,...n}={}){super(n),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,n){let s=G.BufferSourceConverter.toUint8Array(e);if(!Bt(this,s,t,n))return-1;if(this.valueBeforeDecodeView=s.subarray(t,t+n),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),t;let i=t;for(;Wd(this.isIndefiniteForm,n)>0;){let o=Us(s,i,n);if(o.offset===-1)return this.error=o.result.error,this.warnings.concat(o.result.warnings),-1;if(i=o.offset,this.blockLength+=o.result.blockLength,n-=o.result.blockLength,this.value.push(o.result),this.isIndefiniteForm&&o.result.constructor.NAME===un)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===un?this.value.pop():this.warnings.push("No EndOfContent block encoded")),i}toBER(e,t){let n=t||new ln;for(let s=0;s<this.value.length;s++)this.value[s].toBER(e,n);return t?et:n.final()}toJSON(){let e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(let t of this.value)e.value.push(t.toJSON());return e}};ct.NAME="ConstructedValueBlock";var Xc,Kt=class extends ve{constructor(e={}){super(e,ct),this.idBlock.isConstructed=!0}fromBER(e,t,n){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;let s=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return s===-1?(this.error=this.valueBlock.error,s):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),s)}onAsciiEncoding(){let e=[];for(let n of this.valueBlock.value)e.push(n.toString("ascii").split(`
|
2
|
+
"use strict";var Libp2PCircuitRelayV2=(()=>{var ef=Object.create;var In=Object.defineProperty;var tf=Object.getOwnPropertyDescriptor;var rf=Object.getOwnPropertyNames;var nf=Object.getPrototypeOf,sf=Object.prototype.hasOwnProperty;var di=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),ge=(r,e)=>{for(var t in e)In(r,t,{get:e[t],enumerable:!0})},Ra=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of rf(e))!sf.call(r,s)&&s!==t&&In(r,s,{get:()=>e[s],enumerable:!(n=tf(e,s))||n.enumerable});return r};var pi=(r,e,t)=>(t=r!=null?ef(nf(r)):{},Ra(e||!r||!r.__esModule?In(t,"default",{value:r,enumerable:!0}):t,r)),of=r=>Ra(In({},"__esModule",{value:!0}),r);var Kc=di(Ur=>{"use strict";var Vd="[object ArrayBuffer]",vt=class r{static isArrayBuffer(e){return Object.prototype.toString.call(e)===Vd}static toArrayBuffer(e){return this.isArrayBuffer(e)?e:e.byteLength===e.buffer.byteLength||e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:this.toUint8Array(e.buffer).slice(e.byteOffset,e.byteOffset+e.byteLength).buffer}static toUint8Array(e){return this.toView(e,Uint8Array)}static toView(e,t){if(e.constructor===t)return e;if(this.isArrayBuffer(e))return new t(e);if(this.isArrayBufferView(e))return new t(e.buffer,e.byteOffset,e.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(e){return this.isArrayBufferView(e)||this.isArrayBuffer(e)}static isArrayBufferView(e){return ArrayBuffer.isView(e)||e&&this.isArrayBuffer(e.buffer)}static isEqual(e,t){let n=r.toUint8Array(e),s=r.toUint8Array(t);if(n.length!==s.byteLength)return!1;for(let i=0;i<n.length;i++)if(n[i]!==s[i])return!1;return!0}static concat(...e){let t;Array.isArray(e[0])&&!(e[1]instanceof Function)||Array.isArray(e[0])&&e[1]instanceof Function?t=e[0]:e[e.length-1]instanceof Function?t=e.slice(0,e.length-1):t=e;let n=0;for(let o of t)n+=o.byteLength;let s=new Uint8Array(n),i=0;for(let o of t){let a=this.toUint8Array(o);s.set(a,i),i+=a.length}return e[e.length-1]instanceof Function?this.toView(s,e[e.length-1]):s.buffer}},Ao="string",Hd=/^[0-9a-f]+$/i,Fd=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,Kd=/^[a-zA-Z0-9-_]+$/,jn=class{static fromString(e){let t=unescape(encodeURIComponent(e)),n=new Uint8Array(t.length);for(let s=0;s<t.length;s++)n[s]=t.charCodeAt(s);return n.buffer}static toString(e){let t=vt.toUint8Array(e),n="";for(let i=0;i<t.length;i++)n+=String.fromCharCode(t[i]);return decodeURIComponent(escape(n))}},je=class{static toString(e,t=!1){let n=vt.toArrayBuffer(e),s=new DataView(n),i="";for(let o=0;o<n.byteLength;o+=2){let a=s.getUint16(o,t);i+=String.fromCharCode(a)}return i}static fromString(e,t=!1){let n=new ArrayBuffer(e.length*2),s=new DataView(n);for(let i=0;i<e.length;i++)s.setUint16(i*2,e.charCodeAt(i),t);return n}},Wn=class r{static isHex(e){return typeof e===Ao&&Hd.test(e)}static isBase64(e){return typeof e===Ao&&Fd.test(e)}static isBase64Url(e){return typeof e===Ao&&Kd.test(e)}static ToString(e,t="utf8"){let n=vt.toUint8Array(e);switch(t.toLowerCase()){case"utf8":return this.ToUtf8String(n);case"binary":return this.ToBinary(n);case"hex":return this.ToHex(n);case"base64":return this.ToBase64(n);case"base64url":return this.ToBase64Url(n);case"utf16le":return je.toString(n,!0);case"utf16":case"utf16be":return je.toString(n);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromString(e,t="utf8"){if(!e)return new ArrayBuffer(0);switch(t.toLowerCase()){case"utf8":return this.FromUtf8String(e);case"binary":return this.FromBinary(e);case"hex":return this.FromHex(e);case"base64":return this.FromBase64(e);case"base64url":return this.FromBase64Url(e);case"utf16le":return je.fromString(e,!0);case"utf16":case"utf16be":return je.fromString(e);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToBase64(e){let t=vt.toUint8Array(e);if(typeof btoa<"u"){let n=this.ToString(t,"binary");return btoa(n)}else return Buffer.from(t).toString("base64")}static FromBase64(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!r.isBase64(t))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return typeof atob<"u"?this.FromBinary(atob(t)):new Uint8Array(Buffer.from(t,"base64")).buffer}static FromBase64Url(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!r.isBase64Url(t))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(t.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(e){return this.ToBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(e,t=r.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.FromBinary(e);case"utf8":return jn.fromString(e);case"utf16":case"utf16be":return je.fromString(e);case"utf16le":case"usc2":return je.fromString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToUtf8String(e,t=r.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.ToBinary(e);case"utf8":return jn.toString(e);case"utf16":case"utf16be":return je.toString(e);case"utf16le":case"usc2":return je.toString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromBinary(e){let t=e.length,n=new Uint8Array(t);for(let s=0;s<t;s++)n[s]=e.charCodeAt(s);return n.buffer}static ToBinary(e){let t=vt.toUint8Array(e),n="";for(let s=0;s<t.length;s++)n+=String.fromCharCode(t[s]);return n}static ToHex(e){let t=vt.toUint8Array(e),n="",s=t.length;for(let i=0;i<s;i++){let o=t[i];o<16&&(n+="0"),n+=o.toString(16)}return n}static FromHex(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!r.isHex(t))throw new TypeError("Argument 'hexString' is not HEX encoded");t.length%2&&(t=`0${t}`);let n=new Uint8Array(t.length/2);for(let s=0;s<t.length;s=s+2){let i=t.slice(s,s+2);n[s/2]=parseInt(i,16)}return n.buffer}static ToUtf16String(e,t=!1){return je.toString(e,t)}static FromUtf16String(e,t=!1){return je.fromString(e,t)}static Base64Padding(e){let t=4-e.length%4;if(t<4)for(let n=0;n<t;n++)e+="=";return e}static formatString(e){return e?.replace(/[\n\r\t ]/g,"")||""}};Wn.DEFAULT_UTF8_ENCODING="utf8";function qd(r,...e){let t=arguments[0];for(let n=1;n<arguments.length;n++){let s=arguments[n];for(let i in s)t[i]=s[i]}return t}function zd(...r){let e=r.map(s=>s.byteLength).reduce((s,i)=>s+i),t=new Uint8Array(e),n=0;return r.map(s=>new Uint8Array(s)).forEach(s=>{for(let i of s)t[n++]=i}),t.buffer}function $d(r,e){if(!(r&&e)||r.byteLength!==e.byteLength)return!1;let t=new Uint8Array(r),n=new Uint8Array(e);for(let s=0;s<r.byteLength;s++)if(t[s]!==n[s])return!1;return!0}Ur.BufferSourceConverter=vt;Ur.Convert=Wn;Ur.assign=qd;Ur.combine=zd;Ur.isEqual=$d});var Iu=di((Sn,Ws)=>{(function(r,e){"use strict";var t={version:"3.0.0",x86:{},x64:{},inputValidation:!0};function n(u){if(!Array.isArray(u)&&!ArrayBuffer.isView(u))return!1;for(var d=0;d<u.length;d++)if(!Number.isInteger(u[d])||u[d]<0||u[d]>255)return!1;return!0}function s(u,d){return(u&65535)*d+(((u>>>16)*d&65535)<<16)}function i(u,d){return u<<d|u>>>32-d}function o(u){return u^=u>>>16,u=s(u,2246822507),u^=u>>>13,u=s(u,3266489909),u^=u>>>16,u}function a(u,d){u=[u[0]>>>16,u[0]&65535,u[1]>>>16,u[1]&65535],d=[d[0]>>>16,d[0]&65535,d[1]>>>16,d[1]&65535];var p=[0,0,0,0];return p[3]+=u[3]+d[3],p[2]+=p[3]>>>16,p[3]&=65535,p[2]+=u[2]+d[2],p[1]+=p[2]>>>16,p[2]&=65535,p[1]+=u[1]+d[1],p[0]+=p[1]>>>16,p[1]&=65535,p[0]+=u[0]+d[0],p[0]&=65535,[p[0]<<16|p[1],p[2]<<16|p[3]]}function c(u,d){u=[u[0]>>>16,u[0]&65535,u[1]>>>16,u[1]&65535],d=[d[0]>>>16,d[0]&65535,d[1]>>>16,d[1]&65535];var p=[0,0,0,0];return p[3]+=u[3]*d[3],p[2]+=p[3]>>>16,p[3]&=65535,p[2]+=u[2]*d[3],p[1]+=p[2]>>>16,p[2]&=65535,p[2]+=u[3]*d[2],p[1]+=p[2]>>>16,p[2]&=65535,p[1]+=u[1]*d[3],p[0]+=p[1]>>>16,p[1]&=65535,p[1]+=u[2]*d[2],p[0]+=p[1]>>>16,p[1]&=65535,p[1]+=u[3]*d[1],p[0]+=p[1]>>>16,p[1]&=65535,p[0]+=u[0]*d[3]+u[1]*d[2]+u[2]*d[1]+u[3]*d[0],p[0]&=65535,[p[0]<<16|p[1],p[2]<<16|p[3]]}function h(u,d){return d%=64,d===32?[u[1],u[0]]:d<32?[u[0]<<d|u[1]>>>32-d,u[1]<<d|u[0]>>>32-d]:(d-=32,[u[1]<<d|u[0]>>>32-d,u[0]<<d|u[1]>>>32-d])}function f(u,d){return d%=64,d===0?u:d<32?[u[0]<<d|u[1]>>>32-d,u[1]<<d]:[u[1]<<d-32,0]}function l(u,d){return[u[0]^d[0],u[1]^d[1]]}function m(u){return u=l(u,[0,u[0]>>>1]),u=c(u,[4283543511,3981806797]),u=l(u,[0,u[0]>>>1]),u=c(u,[3301882366,444984403]),u=l(u,[0,u[0]>>>1]),u}t.x86.hash32=function(u,d){if(t.inputValidation&&!n(u))return e;d=d||0;for(var p=u.length%4,b=u.length-p,g=d,w=0,y=3432918353,E=461845907,x=0;x<b;x=x+4)w=u[x]|u[x+1]<<8|u[x+2]<<16|u[x+3]<<24,w=s(w,y),w=i(w,15),w=s(w,E),g^=w,g=i(g,13),g=s(g,5)+3864292196;switch(w=0,p){case 3:w^=u[x+2]<<16;case 2:w^=u[x+1]<<8;case 1:w^=u[x],w=s(w,y),w=i(w,15),w=s(w,E),g^=w}return g^=u.length,g=o(g),g>>>0},t.x86.hash128=function(u,d){if(t.inputValidation&&!n(u))return e;d=d||0;for(var p=u.length%16,b=u.length-p,g=d,w=d,y=d,E=d,x=0,S=0,v=0,B=0,$=597399067,q=2869860233,P=951274213,te=2716044179,C=0;C<b;C=C+16)x=u[C]|u[C+1]<<8|u[C+2]<<16|u[C+3]<<24,S=u[C+4]|u[C+5]<<8|u[C+6]<<16|u[C+7]<<24,v=u[C+8]|u[C+9]<<8|u[C+10]<<16|u[C+11]<<24,B=u[C+12]|u[C+13]<<8|u[C+14]<<16|u[C+15]<<24,x=s(x,$),x=i(x,15),x=s(x,q),g^=x,g=i(g,19),g+=w,g=s(g,5)+1444728091,S=s(S,q),S=i(S,16),S=s(S,P),w^=S,w=i(w,17),w+=y,w=s(w,5)+197830471,v=s(v,P),v=i(v,17),v=s(v,te),y^=v,y=i(y,15),y+=E,y=s(y,5)+2530024501,B=s(B,te),B=i(B,18),B=s(B,$),E^=B,E=i(E,13),E+=g,E=s(E,5)+850148119;switch(x=0,S=0,v=0,B=0,p){case 15:B^=u[C+14]<<16;case 14:B^=u[C+13]<<8;case 13:B^=u[C+12],B=s(B,te),B=i(B,18),B=s(B,$),E^=B;case 12:v^=u[C+11]<<24;case 11:v^=u[C+10]<<16;case 10:v^=u[C+9]<<8;case 9:v^=u[C+8],v=s(v,P),v=i(v,17),v=s(v,te),y^=v;case 8:S^=u[C+7]<<24;case 7:S^=u[C+6]<<16;case 6:S^=u[C+5]<<8;case 5:S^=u[C+4],S=s(S,q),S=i(S,16),S=s(S,P),w^=S;case 4:x^=u[C+3]<<24;case 3:x^=u[C+2]<<16;case 2:x^=u[C+1]<<8;case 1:x^=u[C],x=s(x,$),x=i(x,15),x=s(x,q),g^=x}return g^=u.length,w^=u.length,y^=u.length,E^=u.length,g+=w,g+=y,g+=E,w+=g,y+=g,E+=g,g=o(g),w=o(w),y=o(y),E=o(E),g+=w,g+=y,g+=E,w+=g,y+=g,E+=g,("00000000"+(g>>>0).toString(16)).slice(-8)+("00000000"+(w>>>0).toString(16)).slice(-8)+("00000000"+(y>>>0).toString(16)).slice(-8)+("00000000"+(E>>>0).toString(16)).slice(-8)},t.x64.hash128=function(u,d){if(t.inputValidation&&!n(u))return e;d=d||0;for(var p=u.length%16,b=u.length-p,g=[0,d],w=[0,d],y=[0,0],E=[0,0],x=[2277735313,289559509],S=[1291169091,658871167],v=0;v<b;v=v+16)y=[u[v+4]|u[v+5]<<8|u[v+6]<<16|u[v+7]<<24,u[v]|u[v+1]<<8|u[v+2]<<16|u[v+3]<<24],E=[u[v+12]|u[v+13]<<8|u[v+14]<<16|u[v+15]<<24,u[v+8]|u[v+9]<<8|u[v+10]<<16|u[v+11]<<24],y=c(y,x),y=h(y,31),y=c(y,S),g=l(g,y),g=h(g,27),g=a(g,w),g=a(c(g,[0,5]),[0,1390208809]),E=c(E,S),E=h(E,33),E=c(E,x),w=l(w,E),w=h(w,31),w=a(w,g),w=a(c(w,[0,5]),[0,944331445]);switch(y=[0,0],E=[0,0],p){case 15:E=l(E,f([0,u[v+14]],48));case 14:E=l(E,f([0,u[v+13]],40));case 13:E=l(E,f([0,u[v+12]],32));case 12:E=l(E,f([0,u[v+11]],24));case 11:E=l(E,f([0,u[v+10]],16));case 10:E=l(E,f([0,u[v+9]],8));case 9:E=l(E,[0,u[v+8]]),E=c(E,S),E=h(E,33),E=c(E,x),w=l(w,E);case 8:y=l(y,f([0,u[v+7]],56));case 7:y=l(y,f([0,u[v+6]],48));case 6:y=l(y,f([0,u[v+5]],40));case 5:y=l(y,f([0,u[v+4]],32));case 4:y=l(y,f([0,u[v+3]],24));case 3:y=l(y,f([0,u[v+2]],16));case 2:y=l(y,f([0,u[v+1]],8));case 1:y=l(y,[0,u[v]]),y=c(y,x),y=h(y,31),y=c(y,S),g=l(g,y)}return g=l(g,[0,u.length]),w=l(w,[0,u.length]),g=a(g,w),w=a(w,g),g=m(g),w=m(w),g=a(g,w),w=a(w,g),("00000000"+(g[0]>>>0).toString(16)).slice(-8)+("00000000"+(g[1]>>>0).toString(16)).slice(-8)+("00000000"+(w[0]>>>0).toString(16)).slice(-8)+("00000000"+(w[1]>>>0).toString(16)).slice(-8)},typeof Sn<"u"?(typeof Ws<"u"&&Ws.exports&&(Sn=Ws.exports=t),Sn.murmurHash3=t):typeof define=="function"&&define.amd?define([],function(){return t}):(t._murmurHash3=r.murmurHash3,t.noConflict=function(){return r.murmurHash3=t._murmurHash3,t._murmurHash3=e,t.noConflict=e,t},r.murmurHash3=t)})(Sn)});var na=di((sx,ku)=>{ku.exports=Iu()});var v0={};ge(v0,{RELAY_V2_HOP_CODEC:()=>Ye,RELAY_V2_STOP_CODEC:()=>lr,circuitRelayServer:()=>Lu,circuitRelayTransport:()=>$u});var gi=Symbol.for("@libp2p/peer-id");var Ca=Symbol.for("@libp2p/transport");var Na;(function(r){r[r.FATAL_ALL=0]="FATAL_ALL",r[r.NO_FATAL=1]="NO_FATAL"})(Na||(Na={}));var Rt=class r extends Error{code;type;constructor(e="The operation was aborted"){super(e),this.name="AbortError",this.code=r.code,this.type=r.type}static code="ABORT_ERR";static type="aborted"},U=class extends Error{code;props;constructor(e,t,n){super(e),this.code=t,this.name=n?.name??"CodeError",this.props=n??{}}};var qe=(r,...e)=>{try{[...e]}catch{}};var ze=class extends EventTarget{#e=new Map;constructor(){super(),qe(1/0,this)}listenerCount(e){let t=this.#e.get(e);return t==null?0:t.length}addEventListener(e,t,n){super.addEventListener(e,t,n);let s=this.#e.get(e);s==null&&(s=[],this.#e.set(e,s)),s.push({callback:t,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(e,t,n){super.removeEventListener(e.toString(),t??null,n);let s=this.#e.get(e);s!=null&&(s=s.filter(({callback:i})=>i!==t),this.#e.set(e,s))}dispatchEvent(e){let t=super.dispatchEvent(e),n=this.#e.get(e.type);return n==null||(n=n.filter(({once:s})=>!s),this.#e.set(e.type,n)),t}safeDispatchEvent(e,t={}){return this.dispatchEvent(new af(e,t))}},mi=class extends Event{detail;constructor(e,t){super(e,t),this.detail=t?.detail}},af=globalThis.CustomEvent??mi;function La(r){return r!=null&&typeof r.start=="function"&&typeof r.stop=="function"}async function Ua(...r){let e=[];for(let t of r)La(t)&&e.push(t);await Promise.all(e.map(async t=>{t.beforeStart!=null&&await t.beforeStart()})),await Promise.all(e.map(async t=>{await t.start()})),await Promise.all(e.map(async t=>{t.afterStart!=null&&await t.afterStart()}))}async function Da(...r){let e=[];for(let t of r)La(t)&&e.push(t);await Promise.all(e.map(async t=>{t.beforeStop!=null&&await t.beforeStop()})),await Promise.all(e.map(async t=>{await t.stop()})),await Promise.all(e.map(async t=>{t.afterStop!=null&&await t.afterStop()}))}var Oa=Symbol.for("@libp2p/service-capabilities"),Pa=Symbol.for("@libp2p/service-dependencies");var vi={};ge(vi,{base58btc:()=>de,base58flickr:()=>df});var Q0=new Uint8Array(0);function Ma(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}function ht(r){if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")}function Va(r){return new TextEncoder().encode(r)}function Ha(r){return new TextDecoder().decode(r)}function cf(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var s=0;s<r.length;s++){var i=r.charAt(s),o=i.charCodeAt(0);if(t[o]!==255)throw new TypeError(i+" is ambiguous");t[o]=s}var a=r.length,c=r.charAt(0),h=Math.log(a)/Math.log(256),f=Math.log(256)/Math.log(a);function l(d){if(d instanceof Uint8Array||(ArrayBuffer.isView(d)?d=new Uint8Array(d.buffer,d.byteOffset,d.byteLength):Array.isArray(d)&&(d=Uint8Array.from(d))),!(d instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(d.length===0)return"";for(var p=0,b=0,g=0,w=d.length;g!==w&&d[g]===0;)g++,p++;for(var y=(w-g)*f+1>>>0,E=new Uint8Array(y);g!==w;){for(var x=d[g],S=0,v=y-1;(x!==0||S<b)&&v!==-1;v--,S++)x+=256*E[v]>>>0,E[v]=x%a>>>0,x=x/a>>>0;if(x!==0)throw new Error("Non-zero carry");b=S,g++}for(var B=y-b;B!==y&&E[B]===0;)B++;for(var $=c.repeat(p);B<y;++B)$+=r.charAt(E[B]);return $}function m(d){if(typeof d!="string")throw new TypeError("Expected String");if(d.length===0)return new Uint8Array;var p=0;if(d[p]!==" "){for(var b=0,g=0;d[p]===c;)b++,p++;for(var w=(d.length-p)*h+1>>>0,y=new Uint8Array(w);d[p];){var E=t[d.charCodeAt(p)];if(E===255)return;for(var x=0,S=w-1;(E!==0||x<g)&&S!==-1;S--,x++)E+=a*y[S]>>>0,y[S]=E%256>>>0,E=E/256>>>0;if(E!==0)throw new Error("Non-zero carry");g=x,p++}if(d[p]!==" "){for(var v=w-g;v!==w&&y[v]===0;)v++;for(var B=new Uint8Array(b+(w-v)),$=b;v!==w;)B[$++]=y[v++];return B}}}function u(d){var p=m(d);if(p)return p;throw new Error(`Non-${e} character`)}return{encode:l,decodeUnsafe:m,decode:u}}var lf=cf,uf=lf,Ka=uf;var yi=class{name;prefix;baseEncode;constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},bi=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return qa(this,e)}},wi=class{decoders;constructor(e){this.decoders=e}or(e){return qa(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function qa(r,e){return new wi({...r.decoders??{[r.prefix]:r},...e.decoders??{[e.prefix]:e}})}var xi=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,n,s){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=s,this.encoder=new yi(e,t,n),this.decoder=new bi(e,t,s)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function pr({name:r,prefix:e,encode:t,decode:n}){return new xi(r,e,t,n)}function Nt({name:r,prefix:e,alphabet:t}){let{encode:n,decode:s}=Ka(t,r);return pr({prefix:e,name:r,encode:n,decode:i=>ht(s(i))})}function ff(r,e,t,n){let s={};for(let f=0;f<e.length;++f)s[e[f]]=f;let i=r.length;for(;r[i-1]==="=";)--i;let o=new Uint8Array(i*t/8|0),a=0,c=0,h=0;for(let f=0;f<i;++f){let l=s[r[f]];if(l===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<t|l,a+=t,a>=8&&(a-=8,o[h++]=255&c>>a)}if(a>=t||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o}function hf(r,e,t){let n=e[e.length-1]==="=",s=(1<<t)-1,i="",o=0,a=0;for(let c=0;c<r.length;++c)for(a=a<<8|r[c],o+=8;o>t;)o-=t,i+=e[s&a>>o];if(o!==0&&(i+=e[s&a<<t-o]),n)for(;i.length*t&7;)i+="=";return i}function oe({name:r,prefix:e,bitsPerChar:t,alphabet:n}){return pr({prefix:e,name:r,encode(s){return hf(s,n,t)},decode(s){return ff(s,n,t,r)}})}var de=Nt({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),df=Nt({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Ei={};ge(Ei,{base10:()=>pf});var pf=Nt({prefix:"9",name:"base10",alphabet:"0123456789"});var Ai={};ge(Ai,{base16:()=>gf,base16upper:()=>mf});var gf=oe({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),mf=oe({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Si={};ge(Si,{base2:()=>yf});var yf=oe({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Bi={};ge(Bi,{base256emoji:()=>Ef});var za=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}"),bf=za.reduce((r,e,t)=>(r[t]=e,r),[]),wf=za.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function xf(r){return r.reduce((e,t)=>(e+=bf[t],e),"")}function vf(r){let e=[];for(let t of r){let n=wf[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}var Ef=pr({prefix:"\u{1F680}",name:"base256emoji",encode:xf,decode:vf});var _i={};ge(_i,{base32:()=>dt,base32hex:()=>_f,base32hexpad:()=>kf,base32hexpadupper:()=>Tf,base32hexupper:()=>If,base32pad:()=>Sf,base32padupper:()=>Bf,base32upper:()=>Af,base32z:()=>Rf});var dt=oe({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Af=oe({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Sf=oe({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Bf=oe({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),_f=oe({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),If=oe({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),kf=oe({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Tf=oe({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Rf=oe({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Ii={};ge(Ii,{base36:()=>Nf,base36upper:()=>Cf});var Nf=Nt({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Cf=Nt({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Ti={};ge(Ti,{base64:()=>ki,base64pad:()=>Lf,base64url:()=>Uf,base64urlpad:()=>Df});var ki=oe({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Lf=oe({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Uf=oe({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Df=oe({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Ri={};ge(Ri,{base8:()=>Of});var Of=oe({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Ni={};ge(Ni,{identity:()=>Pf});var Pf=pr({prefix:"\0",name:"identity",encode:r=>Ha(r),decode:r=>Va(r)});var gg=new TextEncoder,mg=new TextDecoder;var Li={};ge(Li,{identity:()=>pt});var Hf=ja,$a=128,Ff=127,Kf=~Ff,qf=Math.pow(2,31);function ja(r,e,t){e=e||[],t=t||0;for(var n=t;r>=qf;)e[t++]=r&255|$a,r/=128;for(;r&Kf;)e[t++]=r&255|$a,r>>>=7;return e[t]=r|0,ja.bytes=t-n+1,e}var zf=Ci,$f=128,Ga=127;function Ci(r,n){var t=0,n=n||0,s=0,i=n,o,a=r.length;do{if(i>=a)throw Ci.bytes=0,new RangeError("Could not decode varint");o=r[i++],t+=s<28?(o&Ga)<<s:(o&Ga)*Math.pow(2,s),s+=7}while(o>=$f);return Ci.bytes=i-n,t}var Gf=Math.pow(2,7),jf=Math.pow(2,14),Wf=Math.pow(2,21),Yf=Math.pow(2,28),Zf=Math.pow(2,35),Xf=Math.pow(2,42),Jf=Math.pow(2,49),Qf=Math.pow(2,56),eh=Math.pow(2,63),th=function(r){return r<Gf?1:r<jf?2:r<Wf?3:r<Yf?4:r<Zf?5:r<Xf?6:r<Jf?7:r<Qf?8:r<eh?9:10},rh={encode:Hf,decode:zf,encodingLength:th},nh=rh,Wr=nh;function Yr(r,e=0){return[Wr.decode(r,e),Wr.decode.bytes]}function gr(r,e,t=0){return Wr.encode(r,e,t),e}function mr(r){return Wr.encodingLength(r)}function nt(r,e){let t=e.byteLength,n=mr(r),s=n+mr(t),i=new Uint8Array(s+t);return gr(r,i,0),gr(t,i,n),i.set(e,s),new yr(r,t,e,i)}function Xt(r){let e=ht(r),[t,n]=Yr(e),[s,i]=Yr(e.subarray(n)),o=e.subarray(n+i);if(o.byteLength!==s)throw new Error("Incorrect length");return new yr(t,s,o,e)}function Wa(r,e){if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&Ma(r.bytes,t.bytes)}}var yr=class{code;size;digest;bytes;constructor(e,t,n,s){this.code=e,this.size=t,this.digest=n,this.bytes=s}};var Ya=0,sh="identity",Za=ht;function ih(r){return nt(Ya,Za(r))}var pt={code:Ya,name:sh,encode:Za,digest:ih};var Oi={};ge(Oi,{sha256:()=>me,sha512:()=>oh});function Di({name:r,code:e,encode:t}){return new Ui(r,e,t)}var Ui=class{name;code;encode;constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?nt(this.code,t):t.then(n=>nt(this.code,n))}else throw Error("Unknown type, must be binary type")}};function Ja(r){return async e=>new Uint8Array(await crypto.subtle.digest(r,e))}var me=Di({name:"sha2-256",code:18,encode:Ja("SHA-256")}),oh=Di({name:"sha2-512",code:19,encode:Ja("SHA-512")});function Qa(r,e){let{bytes:t,version:n}=r;switch(n){case 0:return ch(t,Pi(r),e??de.encoder);default:return lh(t,Pi(r),e??dt.encoder)}}var ec=new WeakMap;function Pi(r){let e=ec.get(r);if(e==null){let t=new Map;return ec.set(r,t),t}return e}var Le=class r{code;version;multihash;bytes;"/";constructor(e,t,n,s){this.code=t,this.version=e,this.multihash=n,this.bytes=s,this["/"]=s}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:t}=this;if(e!==Zr)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==uh)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,n=nt(e,t);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return r.equals(this,e)}static equals(e,t){let n=t;return n!=null&&e.code===n.code&&e.version===n.version&&Wa(e.multihash,n.multihash)}toString(e){return Qa(this,e)}toJSON(){return{"/":Qa(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof r)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:s,multihash:i,bytes:o}=t;return new r(n,s,i,o??tc(n,s,i.bytes))}else if(t[fh]===!0){let{version:n,multihash:s,code:i}=t,o=Xt(s);return r.create(n,i,o)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==Zr)throw new Error(`Version 0 CID must use dag-pb (code: ${Zr}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let s=tc(e,t,n.bytes);return new r(e,t,n,s)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,Zr,e)}static createV1(e,t){return r.create(1,e,t)}static decode(e){let[t,n]=r.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=r.inspectBytes(e),n=t.size-t.multihashSize,s=ht(e.subarray(n,n+t.multihashSize));if(s.byteLength!==t.multihashSize)throw new Error("Incorrect length");let i=s.subarray(t.multihashSize-t.digestSize),o=new yr(t.multihashCode,t.digestSize,i,s);return[t.version===0?r.createV0(o):r.createV1(t.codec,o),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[l,m]=Yr(e.subarray(t));return t+=m,l},s=n(),i=Zr;if(s===18?(s=0,t=0):i=n(),s!==0&&s!==1)throw new RangeError(`Invalid CID version ${s}`);let o=t,a=n(),c=n(),h=t+c,f=h-o;return{version:s,codec:i,multihashCode:a,digestSize:c,multihashSize:f,size:h}}static parse(e,t){let[n,s]=ah(e,t),i=r.decode(s);if(i.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Pi(i).set(n,e),i}};function ah(r,e){switch(r[0]){case"Q":{let t=e??de;return[de.prefix,t.decode(`${de.prefix}${r}`)]}case de.prefix:{let t=e??de;return[de.prefix,t.decode(r)]}case dt.prefix:{let t=e??dt;return[dt.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}}function ch(r,e,t){let{prefix:n}=t;if(n!==de.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let s=e.get(n);if(s==null){let i=t.encode(r).slice(1);return e.set(n,i),i}else return s}function lh(r,e,t){let{prefix:n}=t,s=e.get(n);if(s==null){let i=t.encode(r);return e.set(n,i),i}else return s}var Zr=112,uh=18;function tc(r,e,t){let n=mr(r),s=n+mr(e),i=new Uint8Array(s+t.byteLength);return gr(r,i,0),gr(e,i,n),i.set(t,s),i}var fh=Symbol.for("@ipld/js-cid/CID");var Ct={...Ni,...Si,...Ri,...Ei,...Ai,..._i,...Ii,...vi,...Ti,...Bi},Pg={...Oi,...Li};function ae(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}function xe(r=0){return new Uint8Array(r)}function Ne(r=0){return new Uint8Array(r)}function nc(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var rc=nc("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Mi=nc("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=Ne(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),hh={utf8:rc,"utf-8":rc,hex:Ct.base16,latin1:Mi,ascii:Mi,binary:Mi,...Ct},Tn=hh;function M(r,e="utf8"){let t=Tn[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.decoder.decode(`${t.prefix}${r}`)}function W(r,e="utf8"){let t=Tn[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.encoder.encode(r).substring(1)}var ic=Symbol.for("nodejs.util.inspect.custom"),sc=Object.values(Ct).map(r=>r.decoder).reduce((r,e)=>r.or(e),Ct.identity.decoder),oc=114,Fi=36,Ki=37,Xr=class{type;multihash;privateKey;publicKey;string;constructor(e){this.type=e.type,this.multihash=e.multihash,this.privateKey=e.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}[gi]=!0;toString(){return this.string==null&&(this.string=de.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return Le.createV1(oc,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e==null)return!1;if(e instanceof Uint8Array)return ae(this.multihash.bytes,e);if(typeof e=="string")return Lt(e).equals(this);if(e?.multihash?.bytes!=null)return ae(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[ic](){return`PeerId(${this.toString()})`}},br=class extends Xr{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},wr=class extends Xr{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.multihash.digest}},xr=class extends Xr{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.multihash.digest}},Vi=2336,Hi=class{type="url";multihash;privateKey;publicKey;url;constructor(e){this.url=e.toString(),this.multihash=pt.digest(M(this.url))}[ic](){return`PeerId(${this.url})`}[gi]=!0;toString(){return this.toCID().toString()}toCID(){return Le.createV1(Vi,this.multihash)}toBytes(){return this.toCID().bytes}equals(e){return e==null?!1:(e instanceof Uint8Array&&(e=W(e)),e.toString()===this.toString())}};function Lt(r,e){if(e=e??sc,r.charAt(0)==="1"||r.charAt(0)==="Q"){let t=Xt(de.decode(`z${r}`));return r.startsWith("12D")?new wr({multihash:t}):r.startsWith("16U")?new xr({multihash:t}):new br({multihash:t})}return Jr(sc.decode(r))}function Jr(r){try{let e=Xt(r);if(e.code===pt.code){if(e.digest.length===Fi)return new wr({multihash:e});if(e.digest.length===Ki)return new xr({multihash:e})}if(e.code===me.code)return new br({multihash:e})}catch{return dh(Le.decode(r))}throw new Error("Supplied PeerID CID is invalid")}function dh(r){if(r?.multihash==null||r.version==null||r.version===1&&r.code!==oc&&r.code!==Vi)throw new Error("Supplied PeerID CID is invalid");if(r.code===Vi){let t=W(r.multihash.digest);return new Hi(new URL(t))}let e=r.multihash;if(e.code===me.code)return new br({multihash:r.multihash});if(e.code===pt.code){if(e.digest.length===Fi)return new wr({multihash:r.multihash});if(e.digest.length===Ki)return new xr({multihash:r.multihash})}throw new Error("Supplied PeerID CID is invalid")}async function ac(r,e){return r.length===Fi?new wr({multihash:nt(pt.code,r),privateKey:e}):r.length===Ki?new xr({multihash:nt(pt.code,r),privateKey:e}):new br({multihash:await me.digest(r),publicKey:r,privateKey:e})}var vo={};ge(vo,{Ed25519PrivateKey:()=>ir,Ed25519PublicKey:()=>on,generateKeyPair:()=>Od,generateKeyPairFromSeed:()=>Fc,unmarshalEd25519PrivateKey:()=>Ud,unmarshalEd25519PublicKey:()=>Dd});function ke(r,e){e==null&&(e=r.reduce((s,i)=>s+i.length,0));let t=Ne(e),n=0;for(let s of r)t.set(s,n),n+=s.length;return t}function $e(r){return r==null?!1:typeof r.then=="function"&&typeof r.catch=="function"&&typeof r.finally=="function"}function vr(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`positive integer expected, not ${r}`)}function ph(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function Er(r,...e){if(!ph(r))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(r.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${r.length}`)}function Rn(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");vr(r.outputLen),vr(r.blockLen)}function Ar(r,e=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(e&&r.finished)throw new Error("Hash#digest() has already been called")}function cc(r,e){Er(r);let t=e.outputLen;if(r.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}var Nn=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var Br=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),Ze=(r,e)=>r<<32-e|r>>>e;var mm=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;var gh=async()=>{};async function lc(r,e,t){let n=Date.now();for(let s=0;s<r;s++){t(s);let i=Date.now()-n;i>=0&&i<e||(await gh(),n+=i)}}function uc(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function Ut(r){return typeof r=="string"&&(r=uc(r)),Er(r),r}function qi(...r){let e=0;for(let n=0;n<r.length;n++){let s=r[n];Er(s),e+=s.length}let t=new Uint8Array(e);for(let n=0,s=0;n<r.length;n++){let i=r[n];t.set(i,s),s+=i.length}return t}var Sr=class{clone(){return this._cloneInto()}},mh={}.toString;function fc(r,e){if(e!==void 0&&mh.call(e)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(r,e)}function Cn(r){let e=n=>r().update(Ut(n)).digest(),t=r();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>r(),e}function _r(r=32){if(Nn&&typeof Nn.getRandomValues=="function")return Nn.getRandomValues(new Uint8Array(r));throw new Error("crypto.getRandomValues must be defined")}function yh(r,e,t,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(e,t,n);let s=BigInt(32),i=BigInt(4294967295),o=Number(t>>s&i),a=Number(t&i),c=n?4:0,h=n?0:4;r.setUint32(e+c,o,n),r.setUint32(e+h,a,n)}var hc=(r,e,t)=>r&e^~r&t,dc=(r,e,t)=>r&e^r&t^e&t,Ir=class extends Sr{constructor(e,t,n,s){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Br(this.buffer)}update(e){Ar(this);let{view:t,buffer:n,blockLen:s}=this;e=Ut(e);let i=e.length;for(let o=0;o<i;){let a=Math.min(s-this.pos,i-o);if(a===s){let c=Br(e);for(;s<=i-o;o+=s)this.process(c,o);continue}n.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===s&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Ar(this),cc(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:s,isLE:i}=this,{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>s-o&&(this.process(n,0),o=0);for(let l=o;l<s;l++)t[l]=0;yh(n,s-8,BigInt(this.length*8),i),this.process(n,0);let a=Br(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let h=c/4,f=this.get();if(h>f.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<h;l++)a.setUint32(4*l,f[l],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:n,length:s,finished:i,destroyed:o,pos:a}=this;return e.length=s,e.pos=a,e.finished=i,e.destroyed=o,s%t&&e.buffer.set(n),e}};var Ln=BigInt(4294967295),zi=BigInt(32);function pc(r,e=!1){return e?{h:Number(r&Ln),l:Number(r>>zi&Ln)}:{h:Number(r>>zi&Ln)|0,l:Number(r&Ln)|0}}function bh(r,e=!1){let t=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let s=0;s<r.length;s++){let{h:i,l:o}=pc(r[s],e);[t[s],n[s]]=[i,o]}return[t,n]}var wh=(r,e)=>BigInt(r>>>0)<<zi|BigInt(e>>>0),xh=(r,e,t)=>r>>>t,vh=(r,e,t)=>r<<32-t|e>>>t,Eh=(r,e,t)=>r>>>t|e<<32-t,Ah=(r,e,t)=>r<<32-t|e>>>t,Sh=(r,e,t)=>r<<64-t|e>>>t-32,Bh=(r,e,t)=>r>>>t-32|e<<64-t,_h=(r,e)=>e,Ih=(r,e)=>r,kh=(r,e,t)=>r<<t|e>>>32-t,Th=(r,e,t)=>e<<t|r>>>32-t,Rh=(r,e,t)=>e<<t-32|r>>>64-t,Nh=(r,e,t)=>r<<t-32|e>>>64-t;function Ch(r,e,t,n){let s=(e>>>0)+(n>>>0);return{h:r+t+(s/2**32|0)|0,l:s|0}}var Lh=(r,e,t)=>(r>>>0)+(e>>>0)+(t>>>0),Uh=(r,e,t,n)=>e+t+n+(r/2**32|0)|0,Dh=(r,e,t,n)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0),Oh=(r,e,t,n,s)=>e+t+n+s+(r/2**32|0)|0,Ph=(r,e,t,n,s)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0)+(s>>>0),Mh=(r,e,t,n,s,i)=>e+t+n+s+i+(r/2**32|0)|0;var Vh={fromBig:pc,split:bh,toBig:wh,shrSH:xh,shrSL:vh,rotrSH:Eh,rotrSL:Ah,rotrBH:Sh,rotrBL:Bh,rotr32H:_h,rotr32L:Ih,rotlSH:kh,rotlSL:Th,rotlBH:Rh,rotlBL:Nh,add:Ch,add3L:Lh,add3H:Uh,add4L:Dh,add4H:Oh,add5H:Mh,add5L:Ph},V=Vh;var[Hh,Fh]=V.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))),Dt=new Uint32Array(80),Ot=new Uint32Array(80),$i=class extends Ir{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:e,Al:t,Bh:n,Bl:s,Ch:i,Cl:o,Dh:a,Dl:c,Eh:h,El:f,Fh:l,Fl:m,Gh:u,Gl:d,Hh:p,Hl:b}=this;return[e,t,n,s,i,o,a,c,h,f,l,m,u,d,p,b]}set(e,t,n,s,i,o,a,c,h,f,l,m,u,d,p,b){this.Ah=e|0,this.Al=t|0,this.Bh=n|0,this.Bl=s|0,this.Ch=i|0,this.Cl=o|0,this.Dh=a|0,this.Dl=c|0,this.Eh=h|0,this.El=f|0,this.Fh=l|0,this.Fl=m|0,this.Gh=u|0,this.Gl=d|0,this.Hh=p|0,this.Hl=b|0}process(e,t){for(let y=0;y<16;y++,t+=4)Dt[y]=e.getUint32(t),Ot[y]=e.getUint32(t+=4);for(let y=16;y<80;y++){let E=Dt[y-15]|0,x=Ot[y-15]|0,S=V.rotrSH(E,x,1)^V.rotrSH(E,x,8)^V.shrSH(E,x,7),v=V.rotrSL(E,x,1)^V.rotrSL(E,x,8)^V.shrSL(E,x,7),B=Dt[y-2]|0,$=Ot[y-2]|0,q=V.rotrSH(B,$,19)^V.rotrBH(B,$,61)^V.shrSH(B,$,6),P=V.rotrSL(B,$,19)^V.rotrBL(B,$,61)^V.shrSL(B,$,6),te=V.add4L(v,P,Ot[y-7],Ot[y-16]),C=V.add4H(te,S,q,Dt[y-7],Dt[y-16]);Dt[y]=C|0,Ot[y]=te|0}let{Ah:n,Al:s,Bh:i,Bl:o,Ch:a,Cl:c,Dh:h,Dl:f,Eh:l,El:m,Fh:u,Fl:d,Gh:p,Gl:b,Hh:g,Hl:w}=this;for(let y=0;y<80;y++){let E=V.rotrSH(l,m,14)^V.rotrSH(l,m,18)^V.rotrBH(l,m,41),x=V.rotrSL(l,m,14)^V.rotrSL(l,m,18)^V.rotrBL(l,m,41),S=l&u^~l&p,v=m&d^~m&b,B=V.add5L(w,x,v,Fh[y],Ot[y]),$=V.add5H(B,g,E,S,Hh[y],Dt[y]),q=B|0,P=V.rotrSH(n,s,28)^V.rotrBH(n,s,34)^V.rotrBH(n,s,39),te=V.rotrSL(n,s,28)^V.rotrBL(n,s,34)^V.rotrBL(n,s,39),C=n&i^n&a^i&a,Ke=s&o^s&c^o&c;g=p|0,w=b|0,p=u|0,b=d|0,u=l|0,d=m|0,{h:l,l:m}=V.add(h|0,f|0,$|0,q|0),h=a|0,f=c|0,a=i|0,c=o|0,i=n|0,o=s|0;let _=V.add3L(q,te,Ke);n=V.add3H(_,$,P,C),s=_|0}({h:n,l:s}=V.add(this.Ah|0,this.Al|0,n|0,s|0)),{h:i,l:o}=V.add(this.Bh|0,this.Bl|0,i|0,o|0),{h:a,l:c}=V.add(this.Ch|0,this.Cl|0,a|0,c|0),{h,l:f}=V.add(this.Dh|0,this.Dl|0,h|0,f|0),{h:l,l:m}=V.add(this.Eh|0,this.El|0,l|0,m|0),{h:u,l:d}=V.add(this.Fh|0,this.Fl|0,u|0,d|0),{h:p,l:b}=V.add(this.Gh|0,this.Gl|0,p|0,b|0),{h:g,l:w}=V.add(this.Hh|0,this.Hl|0,g|0,w|0),this.set(n,s,i,o,a,c,h,f,l,m,u,d,p,b,g,w)}roundClean(){Dt.fill(0),Ot.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 Qr=Cn(()=>new $i);var Dn={};ge(Dn,{abytes:()=>kr,bitGet:()=>Wh,bitLen:()=>jh,bitMask:()=>en,bitSet:()=>Yh,bytesToHex:()=>mt,bytesToNumberBE:()=>yt,bytesToNumberLE:()=>Mt,concatBytes:()=>bt,createHmacDrbg:()=>Wi,ensureBytes:()=>ce,equalBytes:()=>$h,hexToBytes:()=>Qt,hexToNumber:()=>ji,isBytes:()=>Pt,numberToBytesBE:()=>Vt,numberToBytesLE:()=>er,numberToHexUnpadded:()=>bc,numberToVarBytesBE:()=>zh,utf8ToBytes:()=>Gh,validateObject:()=>st});var yc=BigInt(0),Un=BigInt(1),Kh=BigInt(2);function Pt(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function kr(r){if(!Pt(r))throw new Error("Uint8Array expected")}var qh=Array.from({length:256},(r,e)=>e.toString(16).padStart(2,"0"));function mt(r){kr(r);let e="";for(let t=0;t<r.length;t++)e+=qh[r[t]];return e}function bc(r){let e=r.toString(16);return e.length&1?`0${e}`:e}function ji(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);return BigInt(r===""?"0":`0x${r}`)}var gt={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function gc(r){if(r>=gt._0&&r<=gt._9)return r-gt._0;if(r>=gt._A&&r<=gt._F)return r-(gt._A-10);if(r>=gt._a&&r<=gt._f)return r-(gt._a-10)}function Qt(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let e=r.length,t=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);let n=new Uint8Array(t);for(let s=0,i=0;s<t;s++,i+=2){let o=gc(r.charCodeAt(i)),a=gc(r.charCodeAt(i+1));if(o===void 0||a===void 0){let c=r[i]+r[i+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+i)}n[s]=o*16+a}return n}function yt(r){return ji(mt(r))}function Mt(r){return kr(r),ji(mt(Uint8Array.from(r).reverse()))}function Vt(r,e){return Qt(r.toString(16).padStart(e*2,"0"))}function er(r,e){return Vt(r,e).reverse()}function zh(r){return Qt(bc(r))}function ce(r,e,t){let n;if(typeof e=="string")try{n=Qt(e)}catch(i){throw new Error(`${r} must be valid hex string, got "${e}". Cause: ${i}`)}else if(Pt(e))n=Uint8Array.from(e);else throw new Error(`${r} must be hex string or Uint8Array`);let s=n.length;if(typeof t=="number"&&s!==t)throw new Error(`${r} expected ${t} bytes, got ${s}`);return n}function bt(...r){let e=0;for(let n=0;n<r.length;n++){let s=r[n];kr(s),e+=s.length}let t=new Uint8Array(e);for(let n=0,s=0;n<r.length;n++){let i=r[n];t.set(i,s),s+=i.length}return t}function $h(r,e){if(r.length!==e.length)return!1;let t=0;for(let n=0;n<r.length;n++)t|=r[n]^e[n];return t===0}function Gh(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function jh(r){let e;for(e=0;r>yc;r>>=Un,e+=1);return e}function Wh(r,e){return r>>BigInt(e)&Un}function Yh(r,e,t){return r|(t?Un:yc)<<BigInt(e)}var en=r=>(Kh<<BigInt(r-1))-Un,Gi=r=>new Uint8Array(r),mc=r=>Uint8Array.from(r);function Wi(r,e,t){if(typeof r!="number"||r<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof t!="function")throw new Error("hmacFn must be a function");let n=Gi(r),s=Gi(r),i=0,o=()=>{n.fill(1),s.fill(0),i=0},a=(...l)=>t(s,n,...l),c=(l=Gi())=>{s=a(mc([0]),l),n=a(),l.length!==0&&(s=a(mc([1]),l),n=a())},h=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let l=0,m=[];for(;l<e;){n=a();let u=n.slice();m.push(u),l+=n.length}return bt(...m)};return(l,m)=>{o(),c(l);let u;for(;!(u=m(h()));)c();return o(),u}}var Zh={bigint:r=>typeof r=="bigint",function:r=>typeof r=="function",boolean:r=>typeof r=="boolean",string:r=>typeof r=="string",stringOrUint8Array:r=>typeof r=="string"||Pt(r),isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,e)=>e.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function st(r,e,t={}){let n=(s,i,o)=>{let a=Zh[i];if(typeof a!="function")throw new Error(`Invalid validator "${i}", expected function`);let c=r[s];if(!(o&&c===void 0)&&!a(c,r))throw new Error(`Invalid param ${String(s)}=${c} (${typeof c}), expected ${i}`)};for(let[s,i]of Object.entries(e))n(s,i,!1);for(let[s,i]of Object.entries(t))n(s,i,!0);return r}var pe=BigInt(0),re=BigInt(1),tr=BigInt(2),Xh=BigInt(3),Yi=BigInt(4),wc=BigInt(5),xc=BigInt(8),Jh=BigInt(9),Qh=BigInt(16);function Q(r,e){let t=r%e;return t>=pe?t:e+t}function ed(r,e,t){if(t<=pe||e<pe)throw new Error("Expected power/modulo > 0");if(t===re)return pe;let n=re;for(;e>pe;)e&re&&(n=n*r%t),r=r*r%t,e>>=re;return n}function ne(r,e,t){let n=r;for(;e-- >pe;)n*=n,n%=t;return n}function On(r,e){if(r===pe||e<=pe)throw new Error(`invert: expected positive integers, got n=${r} mod=${e}`);let t=Q(r,e),n=e,s=pe,i=re,o=re,a=pe;for(;t!==pe;){let h=n/t,f=n%t,l=s-o*h,m=i-a*h;n=t,t=f,s=o,i=a,o=l,a=m}if(n!==re)throw new Error("invert: does not exist");return Q(s,e)}function td(r){let e=(r-re)/tr,t,n,s;for(t=r-re,n=0;t%tr===pe;t/=tr,n++);for(s=tr;s<r&&ed(s,e,r)!==r-re;s++);if(n===1){let o=(r+re)/Yi;return function(c,h){let f=c.pow(h,o);if(!c.eql(c.sqr(f),h))throw new Error("Cannot find square root");return f}}let i=(t+re)/tr;return function(a,c){if(a.pow(c,e)===a.neg(a.ONE))throw new Error("Cannot find square root");let h=n,f=a.pow(a.mul(a.ONE,s),t),l=a.pow(c,i),m=a.pow(c,t);for(;!a.eql(m,a.ONE);){if(a.eql(m,a.ZERO))return a.ZERO;let u=1;for(let p=a.sqr(m);u<h&&!a.eql(p,a.ONE);u++)p=a.sqr(p);let d=a.pow(f,re<<BigInt(h-u-1));f=a.sqr(d),l=a.mul(l,d),m=a.mul(m,f),h=u}return l}}function rd(r){if(r%Yi===Xh){let e=(r+re)/Yi;return function(n,s){let i=n.pow(s,e);if(!n.eql(n.sqr(i),s))throw new Error("Cannot find square root");return i}}if(r%xc===wc){let e=(r-wc)/xc;return function(n,s){let i=n.mul(s,tr),o=n.pow(i,e),a=n.mul(s,o),c=n.mul(n.mul(a,tr),o),h=n.mul(a,n.sub(c,n.ONE));if(!n.eql(n.sqr(h),s))throw new Error("Cannot find square root");return h}}return r%Qh,td(r)}var vc=(r,e)=>(Q(r,e)&re)===re,nd=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Zi(r){let e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},t=nd.reduce((n,s)=>(n[s]="function",n),e);return st(r,t)}function sd(r,e,t){if(t<pe)throw new Error("Expected power > 0");if(t===pe)return r.ONE;if(t===re)return e;let n=r.ONE,s=e;for(;t>pe;)t&re&&(n=r.mul(n,s)),s=r.sqr(s),t>>=re;return n}function id(r,e){let t=new Array(e.length),n=e.reduce((i,o,a)=>r.is0(o)?i:(t[a]=i,r.mul(i,o)),r.ONE),s=r.inv(n);return e.reduceRight((i,o,a)=>r.is0(o)?i:(t[a]=r.mul(i,t[a]),r.mul(i,o)),s),t}function Xi(r,e){let t=e!==void 0?e:r.toString(2).length,n=Math.ceil(t/8);return{nBitLength:t,nByteLength:n}}function Pn(r,e,t=!1,n={}){if(r<=pe)throw new Error(`Expected Field ORDER > 0, got ${r}`);let{nBitLength:s,nByteLength:i}=Xi(r,e);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");let o=rd(r),a=Object.freeze({ORDER:r,BITS:s,BYTES:i,MASK:en(s),ZERO:pe,ONE:re,create:c=>Q(c,r),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return pe<=c&&c<r},is0:c=>c===pe,isOdd:c=>(c&re)===re,neg:c=>Q(-c,r),eql:(c,h)=>c===h,sqr:c=>Q(c*c,r),add:(c,h)=>Q(c+h,r),sub:(c,h)=>Q(c-h,r),mul:(c,h)=>Q(c*h,r),pow:(c,h)=>sd(a,c,h),div:(c,h)=>Q(c*On(h,r),r),sqrN:c=>c*c,addN:(c,h)=>c+h,subN:(c,h)=>c-h,mulN:(c,h)=>c*h,inv:c=>On(c,r),sqrt:n.sqrt||(c=>o(a,c)),invertBatch:c=>id(a,c),cmov:(c,h,f)=>f?h:c,toBytes:c=>t?er(c,i):Vt(c,i),fromBytes:c=>{if(c.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${c.length}`);return t?Mt(c):yt(c)}});return Object.freeze(a)}function Ec(r){if(typeof r!="bigint")throw new Error("field order must be bigint");let e=r.toString(2).length;return Math.ceil(e/8)}function Ji(r){let e=Ec(r);return e+Math.ceil(e/2)}function Ac(r,e,t=!1){let n=r.length,s=Ec(e),i=Ji(e);if(n<16||n<i||n>1024)throw new Error(`expected ${i}-1024 bytes of input, got ${n}`);let o=t?yt(r):Mt(r),a=Q(o,e-re)+re;return t?er(a,s):Vt(a,s)}var ad=BigInt(0),Qi=BigInt(1);function Mn(r,e){let t=(s,i)=>{let o=i.negate();return s?o:i},n=s=>{let i=Math.ceil(e/s)+1,o=2**(s-1);return{windows:i,windowSize:o}};return{constTimeNegate:t,unsafeLadder(s,i){let o=r.ZERO,a=s;for(;i>ad;)i&Qi&&(o=o.add(a)),a=a.double(),i>>=Qi;return o},precomputeWindow(s,i){let{windows:o,windowSize:a}=n(i),c=[],h=s,f=h;for(let l=0;l<o;l++){f=h,c.push(f);for(let m=1;m<a;m++)f=f.add(h),c.push(f);h=f.double()}return c},wNAF(s,i,o){let{windows:a,windowSize:c}=n(s),h=r.ZERO,f=r.BASE,l=BigInt(2**s-1),m=2**s,u=BigInt(s);for(let d=0;d<a;d++){let p=d*c,b=Number(o&l);o>>=u,b>c&&(b-=m,o+=Qi);let g=p,w=p+Math.abs(b)-1,y=d%2!==0,E=b<0;b===0?f=f.add(t(y,i[g])):h=h.add(t(E,i[w]))}return{p:h,f}},wNAFCached(s,i,o,a){let c=s._WINDOW_SIZE||1,h=i.get(s);return h||(h=this.precomputeWindow(s,c),c!==1&&i.set(s,a(h))),this.wNAF(c,h,o)}}}function tn(r){return Zi(r.Fp),st(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Xi(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}var Xe=BigInt(0),Ue=BigInt(1),Vn=BigInt(2),cd=BigInt(8),ld={zip215:!0};function ud(r){let e=tn(r);return st(r,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function Sc(r){let e=ud(r),{Fp:t,n,prehash:s,hash:i,randomBytes:o,nByteLength:a,h:c}=e,h=Vn<<BigInt(a*8)-Ue,f=t.create,l=e.uvRatio||((I,A)=>{try{return{isValid:!0,value:t.sqrt(I*t.inv(A))}}catch{return{isValid:!1,value:Xe}}}),m=e.adjustScalarBytes||(I=>I),u=e.domain||((I,A,R)=>{if(A.length||R)throw new Error("Contexts/pre-hash are not supported");return I}),d=I=>typeof I=="bigint"&&Xe<I,p=(I,A)=>d(I)&&d(A)&&I<A,b=I=>I===Xe||p(I,h);function g(I,A){if(p(I,A))return I;throw new Error(`Expected valid scalar < ${A}, got ${typeof I} ${I}`)}function w(I){return I===Xe?I:g(I,n)}let y=new Map;function E(I){if(!(I instanceof x))throw new Error("ExtendedPoint expected")}class x{constructor(A,R,L,O){if(this.ex=A,this.ey=R,this.ez=L,this.et=O,!b(A))throw new Error("x required");if(!b(R))throw new Error("y required");if(!b(L))throw new Error("z required");if(!b(O))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(A){if(A instanceof x)throw new Error("extended point not allowed");let{x:R,y:L}=A||{};if(!b(R)||!b(L))throw new Error("invalid affine point");return new x(R,L,Ue,f(R*L))}static normalizeZ(A){let R=t.invertBatch(A.map(L=>L.ez));return A.map((L,O)=>L.toAffine(R[O])).map(x.fromAffine)}_setWindowSize(A){this._WINDOW_SIZE=A,y.delete(this)}assertValidity(){let{a:A,d:R}=e;if(this.is0())throw new Error("bad point: ZERO");let{ex:L,ey:O,ez:F,et:K}=this,Z=f(L*L),j=f(O*O),Y=f(F*F),ue=f(Y*Y),ie=f(Z*A),be=f(Y*f(ie+j)),we=f(ue+f(R*f(Z*j)));if(be!==we)throw new Error("bad point: equation left != right (1)");let he=f(L*O),Ae=f(F*K);if(he!==Ae)throw new Error("bad point: equation left != right (2)")}equals(A){E(A);let{ex:R,ey:L,ez:O}=this,{ex:F,ey:K,ez:Z}=A,j=f(R*Z),Y=f(F*O),ue=f(L*Z),ie=f(K*O);return j===Y&&ue===ie}is0(){return this.equals(x.ZERO)}negate(){return new x(f(-this.ex),this.ey,this.ez,f(-this.et))}double(){let{a:A}=e,{ex:R,ey:L,ez:O}=this,F=f(R*R),K=f(L*L),Z=f(Vn*f(O*O)),j=f(A*F),Y=R+L,ue=f(f(Y*Y)-F-K),ie=j+K,be=ie-Z,we=j-K,he=f(ue*be),Ae=f(ie*we),ft=f(ue*we),Zt=f(be*ie);return new x(he,Ae,Zt,ft)}add(A){E(A);let{a:R,d:L}=e,{ex:O,ey:F,ez:K,et:Z}=this,{ex:j,ey:Y,ez:ue,et:ie}=A;if(R===BigInt(-1)){let Aa=f((F-O)*(Y+j)),Sa=f((F+O)*(Y-j)),hi=f(Sa-Aa);if(hi===Xe)return this.double();let Ba=f(K*Vn*ie),_a=f(Z*Vn*ue),Ia=_a+Ba,ka=Sa+Aa,Ta=_a-Ba,Zu=f(Ia*hi),Xu=f(ka*Ta),Ju=f(Ia*Ta),Qu=f(hi*ka);return new x(Zu,Xu,Qu,Ju)}let be=f(O*j),we=f(F*Y),he=f(Z*L*ie),Ae=f(K*ue),ft=f((O+F)*(j+Y)-be-we),Zt=Ae-he,jr=Ae+he,Ea=f(we-R*be),Gu=f(ft*Zt),ju=f(jr*Ea),Wu=f(ft*Ea),Yu=f(Zt*jr);return new x(Gu,ju,Yu,Wu)}subtract(A){return this.add(A.negate())}wNAF(A){return B.wNAFCached(this,y,A,x.normalizeZ)}multiply(A){let{p:R,f:L}=this.wNAF(g(A,n));return x.normalizeZ([R,L])[0]}multiplyUnsafe(A){let R=w(A);return R===Xe?v:this.equals(v)||R===Ue?this:this.equals(S)?this.wNAF(R).p:B.unsafeLadder(this,R)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return B.unsafeLadder(this,n).is0()}toAffine(A){let{ex:R,ey:L,ez:O}=this,F=this.is0();A==null&&(A=F?cd:t.inv(O));let K=f(R*A),Z=f(L*A),j=f(O*A);if(F)return{x:Xe,y:Ue};if(j!==Ue)throw new Error("invZ was invalid");return{x:K,y:Z}}clearCofactor(){let{h:A}=e;return A===Ue?this:this.multiplyUnsafe(A)}static fromHex(A,R=!1){let{d:L,a:O}=e,F=t.BYTES;A=ce("pointHex",A,F);let K=A.slice(),Z=A[F-1];K[F-1]=Z&-129;let j=Mt(K);j===Xe||(R?g(j,h):g(j,t.ORDER));let Y=f(j*j),ue=f(Y-Ue),ie=f(L*Y-O),{isValid:be,value:we}=l(ue,ie);if(!be)throw new Error("Point.fromHex: invalid y coordinate");let he=(we&Ue)===Ue,Ae=(Z&128)!==0;if(!R&&we===Xe&&Ae)throw new Error("Point.fromHex: x=0 and x_0=1");return Ae!==he&&(we=f(-we)),x.fromAffine({x:we,y:j})}static fromPrivateKey(A){return P(A).point}toRawBytes(){let{x:A,y:R}=this.toAffine(),L=er(R,t.BYTES);return L[L.length-1]|=A&Ue?128:0,L}toHex(){return mt(this.toRawBytes())}}x.BASE=new x(e.Gx,e.Gy,Ue,f(e.Gx*e.Gy)),x.ZERO=new x(Xe,Ue,Ue,Xe);let{BASE:S,ZERO:v}=x,B=Mn(x,a*8);function $(I){return Q(I,n)}function q(I){return $(Mt(I))}function P(I){let A=a;I=ce("private key",I,A);let R=ce("hashed private key",i(I),2*A),L=m(R.slice(0,A)),O=R.slice(A,2*A),F=q(L),K=S.multiply(F),Z=K.toRawBytes();return{head:L,prefix:O,scalar:F,point:K,pointBytes:Z}}function te(I){return P(I).pointBytes}function C(I=new Uint8Array,...A){let R=bt(...A);return q(i(u(R,ce("context",I),!!s)))}function Ke(I,A,R={}){I=ce("message",I),s&&(I=s(I));let{prefix:L,scalar:O,pointBytes:F}=P(A),K=C(R.context,L,I),Z=S.multiply(K).toRawBytes(),j=C(R.context,Z,F,I),Y=$(K+j*O);w(Y);let ue=bt(Z,er(Y,t.BYTES));return ce("result",ue,a*2)}let _=ld;function N(I,A,R,L=_){let{context:O,zip215:F}=L,K=t.BYTES;I=ce("signature",I,2*K),A=ce("message",A),s&&(A=s(A));let Z=Mt(I.slice(K,2*K)),j,Y,ue;try{j=x.fromHex(R,F),Y=x.fromHex(I.slice(0,K),F),ue=S.multiplyUnsafe(Z)}catch{return!1}if(!F&&j.isSmallOrder())return!1;let ie=C(O,Y.toRawBytes(),j.toRawBytes(),A);return Y.add(j.multiplyUnsafe(ie)).subtract(ue).clearCofactor().equals(x.ZERO)}return S._setWindowSize(8),{CURVE:e,getPublicKey:te,sign:Ke,verify:N,ExtendedPoint:x,utils:{getExtendedPublicKey:P,randomPrivateKey:()=>o(t.BYTES),precompute(I=8,A=x.BASE){return A._setWindowSize(I),A.multiply(BigInt(3)),A}}}}var eo=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Bc=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),Vm=BigInt(0),fd=BigInt(1),_c=BigInt(2),Hm=BigInt(3),hd=BigInt(5),dd=BigInt(8);function pd(r){let e=BigInt(10),t=BigInt(20),n=BigInt(40),s=BigInt(80),i=eo,a=r*r%i*r%i,c=ne(a,_c,i)*a%i,h=ne(c,fd,i)*r%i,f=ne(h,hd,i)*h%i,l=ne(f,e,i)*f%i,m=ne(l,t,i)*l%i,u=ne(m,n,i)*m%i,d=ne(u,s,i)*u%i,p=ne(d,s,i)*u%i,b=ne(p,e,i)*f%i;return{pow_p_5_8:ne(b,_c,i)*r%i,b2:a}}function gd(r){return r[0]&=248,r[31]&=127,r[31]|=64,r}function md(r,e){let t=eo,n=Q(e*e*e,t),s=Q(n*n*e,t),i=pd(r*s).pow_p_5_8,o=Q(r*n*i,t),a=Q(e*o*o,t),c=o,h=Q(o*Bc,t),f=a===r,l=a===Q(-r,t),m=a===Q(-r*Bc,t);return f&&(o=c),(l||m)&&(o=h),vc(o,t)&&(o=Q(-o,t)),{isValid:f||l,value:o}}var yd=Pn(eo,void 0,!0),bd={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:yd,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:dd,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Qr,randomBytes:_r,adjustScalarBytes:gd,uvRatio:md},Tr=Sc(bd);var Rr=32,wt=64,Hn=32;function Ic(){let r=Tr.utils.randomPrivateKey(),e=Tr.getPublicKey(r);return{privateKey:Nc(r,e),publicKey:e}}function kc(r){if(r.length!==Hn)throw new TypeError('"seed" must be 32 bytes in length.');if(!(r instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, or Uint8Array.');let e=r,t=Tr.getPublicKey(e);return{privateKey:Nc(e,t),publicKey:t}}function Tc(r,e){let t=r.subarray(0,Hn);return Tr.sign(e instanceof Uint8Array?e:e.subarray(),t)}function Rc(r,e,t){return Tr.verify(e,t instanceof Uint8Array?t:t.subarray(),r)}function Nc(r,e){let t=new Uint8Array(wt);for(let n=0;n<Hn;n++)t[n]=r[n],t[Hn+n]=e[n];return t}var Te={get(r=globalThis){let e=r.crypto;if(e?.subtle==null)throw Object.assign(new Error("Missing Web Crypto API. The most likely cause of this error is that this page is being accessed from an insecure context (i.e. not HTTPS). For more information and possible resolutions see https://github.com/libp2p/js-libp2p/blob/main/packages/crypto/README.md#web-crypto-api"),{code:"ERR_MISSING_WEB_CRYPTO"});return e}};var to={alg:"A128GCM",ext:!0,k:"scm9jmO_4BJAgdwWGVulLg",key_ops:["encrypt","decrypt"],kty:"oct"};function Cc(r){let e=r?.algorithm??"AES-GCM",t=r?.keyLength??16,n=r?.nonceLength??12,s=r?.digest??"SHA-256",i=r?.saltLength??16,o=r?.iterations??32767,a=Te.get();t*=8;async function c(l,m){let u=a.getRandomValues(new Uint8Array(i)),d=a.getRandomValues(new Uint8Array(n)),p={name:e,iv:d};typeof m=="string"&&(m=M(m));let b;if(m.length===0){b=await a.subtle.importKey("jwk",to,{name:"AES-GCM"},!0,["encrypt"]);try{let w={name:"PBKDF2",salt:u,iterations:o,hash:{name:s}},y=await a.subtle.importKey("raw",m,{name:"PBKDF2"},!1,["deriveKey"]);b=await a.subtle.deriveKey(w,y,{name:e,length:t},!0,["encrypt"])}catch{b=await a.subtle.importKey("jwk",to,{name:"AES-GCM"},!0,["encrypt"])}}else{let w={name:"PBKDF2",salt:u,iterations:o,hash:{name:s}},y=await a.subtle.importKey("raw",m,{name:"PBKDF2"},!1,["deriveKey"]);b=await a.subtle.deriveKey(w,y,{name:e,length:t},!0,["encrypt"])}let g=await a.subtle.encrypt(p,b,l);return ke([u,p.iv,new Uint8Array(g)])}async function h(l,m){let u=l.subarray(0,i),d=l.subarray(i,i+n),p=l.subarray(i+n),b={name:e,iv:d};typeof m=="string"&&(m=M(m));let g;if(m.length===0)try{let y={name:"PBKDF2",salt:u,iterations:o,hash:{name:s}},E=await a.subtle.importKey("raw",m,{name:"PBKDF2"},!1,["deriveKey"]);g=await a.subtle.deriveKey(y,E,{name:e,length:t},!0,["decrypt"])}catch{g=await a.subtle.importKey("jwk",to,{name:"AES-GCM"},!0,["decrypt"])}else{let y={name:"PBKDF2",salt:u,iterations:o,hash:{name:s}},E=await a.subtle.importKey("raw",m,{name:"PBKDF2"},!1,["deriveKey"]);g=await a.subtle.deriveKey(y,E,{name:e,length:t},!0,["decrypt"])}let w=await a.subtle.decrypt(b,g,p);return new Uint8Array(w)}return{encrypt:c,decrypt:h}}async function Nr(r,e){let n=await Cc().encrypt(r,e);return ki.encode(n)}var vd=Math.pow(2,7),Ed=Math.pow(2,14),Ad=Math.pow(2,21),ro=Math.pow(2,28),no=Math.pow(2,35),so=Math.pow(2,42),io=Math.pow(2,49),X=128,Se=127;function Be(r){if(r<vd)return 1;if(r<Ed)return 2;if(r<Ad)return 3;if(r<ro)return 4;if(r<no)return 5;if(r<so)return 6;if(r<io)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function oo(r,e,t=0){switch(Be(r)){case 8:e[t++]=r&255|X,r/=128;case 7:e[t++]=r&255|X,r/=128;case 6:e[t++]=r&255|X,r/=128;case 5:e[t++]=r&255|X,r/=128;case 4:e[t++]=r&255|X,r>>>=7;case 3:e[t++]=r&255|X,r>>>=7;case 2:e[t++]=r&255|X,r>>>=7;case 1:{e[t++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return e}function Sd(r,e,t=0){switch(Be(r)){case 8:e.set(t++,r&255|X),r/=128;case 7:e.set(t++,r&255|X),r/=128;case 6:e.set(t++,r&255|X),r/=128;case 5:e.set(t++,r&255|X),r/=128;case 4:e.set(t++,r&255|X),r>>>=7;case 3:e.set(t++,r&255|X),r>>>=7;case 2:e.set(t++,r&255|X),r>>>=7;case 1:{e.set(t++,r&255),r>>>=7;break}default:throw new Error("unreachable")}return e}function ao(r,e){let t=r[e],n=0;if(n+=t&Se,t<X||(t=r[e+1],n+=(t&Se)<<7,t<X)||(t=r[e+2],n+=(t&Se)<<14,t<X)||(t=r[e+3],n+=(t&Se)<<21,t<X)||(t=r[e+4],n+=(t&Se)*ro,t<X)||(t=r[e+5],n+=(t&Se)*no,t<X)||(t=r[e+6],n+=(t&Se)*so,t<X)||(t=r[e+7],n+=(t&Se)*io,t<X))return n;throw new RangeError("Could not decode varint")}function Bd(r,e){let t=r.get(e),n=0;if(n+=t&Se,t<X||(t=r.get(e+1),n+=(t&Se)<<7,t<X)||(t=r.get(e+2),n+=(t&Se)<<14,t<X)||(t=r.get(e+3),n+=(t&Se)<<21,t<X)||(t=r.get(e+4),n+=(t&Se)*ro,t<X)||(t=r.get(e+5),n+=(t&Se)*no,t<X)||(t=r.get(e+6),n+=(t&Se)*so,t<X)||(t=r.get(e+7),n+=(t&Se)*io,t<X))return n;throw new RangeError("Could not decode varint")}function Ge(r,e,t=0){return e==null&&(e=Ne(Be(r))),e instanceof Uint8Array?oo(r,e,t):Sd(r,e,t)}function xt(r,e=0){return r instanceof Uint8Array?ao(r,e):Bd(r,e)}var co=new Float32Array([-0]),Ht=new Uint8Array(co.buffer);function Lc(r,e,t){co[0]=r,e[t]=Ht[0],e[t+1]=Ht[1],e[t+2]=Ht[2],e[t+3]=Ht[3]}function Uc(r,e){return Ht[0]=r[e],Ht[1]=r[e+1],Ht[2]=r[e+2],Ht[3]=r[e+3],co[0]}var lo=new Float64Array([-0]),_e=new Uint8Array(lo.buffer);function Dc(r,e,t){lo[0]=r,e[t]=_e[0],e[t+1]=_e[1],e[t+2]=_e[2],e[t+3]=_e[3],e[t+4]=_e[4],e[t+5]=_e[5],e[t+6]=_e[6],e[t+7]=_e[7]}function Oc(r,e){return _e[0]=r[e],_e[1]=r[e+1],_e[2]=r[e+2],_e[3]=r[e+3],_e[4]=r[e+4],_e[5]=r[e+5],_e[6]=r[e+6],_e[7]=r[e+7],lo[0]}var _d=BigInt(Number.MAX_SAFE_INTEGER),Id=BigInt(Number.MIN_SAFE_INTEGER),De=class r{lo;hi;constructor(e,t){this.lo=e|0,this.hi=t|0}toNumber(e=!1){if(!e&&this.hi>>>31>0){let t=~this.lo+1>>>0,n=~this.hi>>>0;return t===0&&(n=n+1>>>0),-(t+n*4294967296)}return this.lo+this.hi*4294967296}toBigInt(e=!1){if(e)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let t=~this.lo+1>>>0,n=~this.hi>>>0;return t===0&&(n=n+1>>>0),-(BigInt(t)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(e=!1){return this.toBigInt(e).toString()}zzEncode(){let e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this}zzDecode(){let e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this}length(){let e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?t===0?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}static fromBigInt(e){if(e===0n)return rr;if(e<_d&&e>Id)return this.fromNumber(Number(e));let t=e<0n;t&&(e=-e);let n=e>>32n,s=e-(n<<32n);return t&&(n=~n|0n,s=~s|0n,++s>Pc&&(s=0n,++n>Pc&&(n=0n))),new r(Number(s),Number(n))}static fromNumber(e){if(e===0)return rr;let t=e<0;t&&(e=-e);let n=e>>>0,s=(e-n)/4294967296>>>0;return t&&(s=~s>>>0,n=~n>>>0,++n>4294967295&&(n=0,++s>4294967295&&(s=0))),new r(n,s)}static from(e){return typeof e=="number"?r.fromNumber(e):typeof e=="bigint"?r.fromBigInt(e):typeof e=="string"?r.fromBigInt(BigInt(e)):e.low!=null||e.high!=null?new r(e.low>>>0,e.high>>>0):rr}},rr=new De(0,0);rr.toBigInt=function(){return 0n};rr.zzEncode=rr.zzDecode=function(){return this};rr.length=function(){return 1};var Pc=4294967296n;function Mc(r){let e=0,t=0;for(let n=0;n<r.length;++n)t=r.charCodeAt(n),t<128?e+=1:t<2048?e+=2:(t&64512)===55296&&(r.charCodeAt(n+1)&64512)===56320?(++n,e+=4):e+=3;return e}function Vc(r,e,t){if(t-e<1)return"";let s,i=[],o=0,a;for(;e<t;)a=r[e++],a<128?i[o++]=a:a>191&&a<224?i[o++]=(a&31)<<6|r[e++]&63:a>239&&a<365?(a=((a&7)<<18|(r[e++]&63)<<12|(r[e++]&63)<<6|r[e++]&63)-65536,i[o++]=55296+(a>>10),i[o++]=56320+(a&1023)):i[o++]=(a&15)<<12|(r[e++]&63)<<6|r[e++]&63,o>8191&&((s??(s=[])).push(String.fromCharCode.apply(String,i)),o=0);return s!=null?(o>0&&s.push(String.fromCharCode.apply(String,i.slice(0,o))),s.join("")):String.fromCharCode.apply(String,i.slice(0,o))}function uo(r,e,t){let n=t,s,i;for(let o=0;o<r.length;++o)s=r.charCodeAt(o),s<128?e[t++]=s:s<2048?(e[t++]=s>>6|192,e[t++]=s&63|128):(s&64512)===55296&&((i=r.charCodeAt(o+1))&64512)===56320?(s=65536+((s&1023)<<10)+(i&1023),++o,e[t++]=s>>18|240,e[t++]=s>>12&63|128,e[t++]=s>>6&63|128,e[t++]=s&63|128):(e[t++]=s>>12|224,e[t++]=s>>6&63|128,e[t++]=s&63|128);return t-n}function Je(r,e){return RangeError(`index out of range: ${r.pos} + ${e??1} > ${r.len}`)}function Kn(r,e){return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0}var fo=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(e){this.buf=e,this.pos=0,this.len=e.length}uint32(){let e=4294967295;if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,Je(this,10);return e}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw Je(this,4);return Kn(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw Je(this,4);return Kn(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw Je(this,4);let e=Uc(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw Je(this,4);let e=Oc(this.buf,this.pos);return this.pos+=8,e}bytes(){let e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw Je(this,e);return this.pos+=e,t===n?new Uint8Array(0):this.buf.subarray(t,n)}string(){let e=this.bytes();return Vc(e,0,e.length)}skip(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Je(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Je(this);while(this.buf[this.pos++]&128);return this}skipType(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${e} at offset ${this.pos}`)}return this}readLongVarint(){let e=new De(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(this.buf[this.pos]&127)<<28)>>>0,e.hi=(e.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return e;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw Je(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,e}if(this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw Je(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw Je(this,8);let e=Kn(this.buf,this.pos+=4),t=Kn(this.buf,this.pos+=4);return new De(e,t)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){let e=ao(this.buf,this.pos);return this.pos+=Be(e),e}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 ho(r){return new fo(r instanceof Uint8Array?r:r.subarray())}function Oe(r,e,t){let n=ho(r);return e.decode(n,void 0,t)}function po(r){let e=r??8192,t=e>>>1,n,s=e;return function(o){if(o<1||o>t)return Ne(o);s+o>e&&(n=Ne(e),s=0);let a=n.subarray(s,s+=o);return s&7&&(s=(s|7)+1),a}}var nr=class{fn;len;next;val;constructor(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}};function go(){}var yo=class{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}},kd=po();function Td(r){return globalThis.Buffer!=null?Ne(r):kd(r)}var nn=class{len;head;tail;states;constructor(){this.len=0,this.head=new nr(go,0,0),this.tail=this.head,this.states=null}_push(e,t,n){return this.tail=this.tail.next=new nr(e,t,n),this.len+=t,this}uint32(e){return this.len+=(this.tail=this.tail.next=new bo((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this}int32(e){return e<0?this._push(qn,10,De.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){let t=De.fromBigInt(e);return this._push(qn,t.length(),t)}uint64Number(e){return this._push(oo,Be(e),e)}uint64String(e){return this.uint64(BigInt(e))}int64(e){return this.uint64(e)}int64Number(e){return this.uint64Number(e)}int64String(e){return this.uint64String(e)}sint64(e){let t=De.fromBigInt(e).zzEncode();return this._push(qn,t.length(),t)}sint64Number(e){let t=De.fromNumber(e).zzEncode();return this._push(qn,t.length(),t)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(mo,1,e?1:0)}fixed32(e){return this._push(rn,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let t=De.fromBigInt(e);return this._push(rn,4,t.lo)._push(rn,4,t.hi)}fixed64Number(e){let t=De.fromNumber(e);return this._push(rn,4,t.lo)._push(rn,4,t.hi)}fixed64String(e){return this.fixed64(BigInt(e))}sfixed64(e){return this.fixed64(e)}sfixed64Number(e){return this.fixed64Number(e)}sfixed64String(e){return this.fixed64String(e)}float(e){return this._push(Lc,4,e)}double(e){return this._push(Dc,8,e)}bytes(e){let t=e.length>>>0;return t===0?this._push(mo,1,0):this.uint32(t)._push(Nd,t,e)}string(e){let t=Mc(e);return t!==0?this.uint32(t)._push(uo,t,e):this._push(mo,1,0)}fork(){return this.states=new yo(this),this.head=this.tail=new nr(go,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 nr(go,0,0),this.len=0),this}ldelim(){let e=this.head,t=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=e.next,this.tail=t,this.len+=n),this}finish(){let e=this.head.next,t=Td(this.len),n=0;for(;e!=null;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t}};function mo(r,e,t){e[t]=r&255}function Rd(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}var bo=class extends nr{next;constructor(e,t){super(Rd,e,t),this.next=void 0}};function qn(r,e,t){for(;r.hi!==0;)e[t++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)e[t++]=r.lo&127|128,r.lo=r.lo>>>7;e[t++]=r.lo}function rn(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}function Nd(r,e,t){e.set(r,t)}globalThis.Buffer!=null&&(nn.prototype.bytes=function(r){let e=r.length>>>0;return this.uint32(e),e>0&&this._push(Cd,e,r),this},nn.prototype.string=function(r){let e=globalThis.Buffer.byteLength(r);return this.uint32(e),e>0&&this._push(Ld,e,r),this});function Cd(r,e,t){e.set(r,t)}function Ld(r,e,t){r.length<40?uo(r,e,t):e.utf8Write!=null?e.utf8Write(r,t):e.set(M(r),t)}function wo(){return new nn}function Pe(r,e){let t=wo();return e.encode(r,t,{lengthDelimited:!1}),t.finish()}var Cr;(function(r){r[r.VARINT=0]="VARINT",r[r.BIT64=1]="BIT64",r[r.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",r[r.START_GROUP=3]="START_GROUP",r[r.END_GROUP=4]="END_GROUP",r[r.BIT32=5]="BIT32"})(Cr||(Cr={}));function zn(r,e,t,n){return{name:r,type:e,encode:t,decode:n}}function sr(r){function e(s){if(r[s.toString()]==null)throw new Error("Invalid enum value");return r[s]}let t=function(i,o){let a=e(i);o.int32(a)},n=function(i){let o=i.int32();return e(o)};return zn("enum",Cr.VARINT,t,n)}function Me(r,e){return zn("message",Cr.LENGTH_DELIMITED,r,e)}var sn=class extends Error{code;constructor(e,t,n){super(e,n),this.code=t}};var se;(function(r){r.RSA="RSA",r.Ed25519="Ed25519",r.Secp256k1="Secp256k1"})(se||(se={}));var xo;(function(r){r[r.RSA=0]="RSA",r[r.Ed25519=1]="Ed25519",r[r.Secp256k1=2]="Secp256k1"})(xo||(xo={}));(function(r){r.codec=()=>sr(xo)})(se||(se={}));var it;(function(r){let e;r.codec=()=>(e==null&&(e=Me((t,n,s={})=>{s.lengthDelimited!==!1&&n.fork(),t.Type!=null&&(n.uint32(8),se.codec().encode(t.Type,n)),t.Data!=null&&(n.uint32(18),n.bytes(t.Data)),s.lengthDelimited!==!1&&n.ldelim()},(t,n)=>{let s={},i=n==null?t.len:t.pos+n;for(;t.pos<i;){let o=t.uint32();switch(o>>>3){case 1:s.Type=se.codec().decode(t);break;case 2:s.Data=t.bytes();break;default:t.skipType(o&7);break}}return s})),e),r.encode=t=>Pe(t,r.codec()),r.decode=t=>Oe(t,r.codec())})(it||(it={}));var ot;(function(r){let e;r.codec=()=>(e==null&&(e=Me((t,n,s={})=>{s.lengthDelimited!==!1&&n.fork(),t.Type!=null&&(n.uint32(8),se.codec().encode(t.Type,n)),t.Data!=null&&(n.uint32(18),n.bytes(t.Data)),s.lengthDelimited!==!1&&n.ldelim()},(t,n)=>{let s={},i=n==null?t.len:t.pos+n;for(;t.pos<i;){let o=t.uint32();switch(o>>>3){case 1:s.Type=se.codec().decode(t);break;case 2:s.Data=t.bytes();break;default:t.skipType(o&7);break}}return s})),e),r.encode=t=>Pe(t,r.codec()),r.decode=t=>Oe(t,r.codec())})(ot||(ot={}));var on=class{_key;constructor(e){this._key=Lr(e,Rr)}verify(e,t){return Rc(this._key,t,e)}marshal(){return this._key}get bytes(){return it.encode({Type:se.Ed25519,Data:this.marshal()}).subarray()}equals(e){return ae(this.bytes,e.bytes)}hash(){let e=me.digest(this.bytes);return $e(e)?e.then(({bytes:t})=>t):e.bytes}},ir=class{_key;_publicKey;constructor(e,t){this._key=Lr(e,wt),this._publicKey=Lr(t,Rr)}sign(e){return Tc(this._key,e)}get public(){return new on(this._publicKey)}marshal(){return this._key}get bytes(){return ot.encode({Type:se.Ed25519,Data:this.marshal()}).subarray()}equals(e){return ae(this.bytes,e.bytes)}async hash(){let e=me.digest(this.bytes),t;return $e(e)?{bytes:t}=await e:t=e.bytes,t}async id(){let e=pt.digest(this.public.bytes);return de.encode(e.bytes).substring(1)}async export(e,t="libp2p-key"){if(t==="libp2p-key")return Nr(this.bytes,e);throw new U(`export format '${t}' is not supported`,"ERR_INVALID_EXPORT_FORMAT")}};function Ud(r){if(r.length>wt){r=Lr(r,wt+Rr);let n=r.subarray(0,wt),s=r.subarray(wt,r.length);return new ir(n,s)}r=Lr(r,wt);let e=r.subarray(0,wt),t=r.subarray(Rr);return new ir(e,t)}function Dd(r){return r=Lr(r,Rr),new on(r)}async function Od(){let{privateKey:r,publicKey:e}=Ic();return new ir(r,e)}async function Fc(r){let{privateKey:e,publicKey:t}=kc(r);return new ir(e,t)}function Lr(r,e){if(r=Uint8Array.from(r??[]),r.length!==e)throw new U(`Key must be a Uint8Array of length ${e}, got ${r.length}`,"ERR_INVALID_KEY_TYPE");return r}var No={};ge(No,{MAX_RSA_KEY_SIZE:()=>bn,RsaPrivateKey:()=>Mr,RsaPublicKey:()=>yn,fromJwk:()=>lp,generateKeyPair:()=>up,unmarshalRsaPrivateKey:()=>To,unmarshalRsaPublicKey:()=>cp});function at(r){if(isNaN(r)||r<=0)throw new U("random bytes length must be a Number bigger than 0","ERR_INVALID_LENGTH");return _r(r)}var zt={};ge(zt,{exportToPem:()=>np,importFromPem:()=>sp,jwkToPkcs1:()=>Qd,jwkToPkix:()=>tp,pkcs1ToJwk:()=>Jd,pkixToJwk:()=>ep});var Gn=class extends Sr{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,Rn(e);let n=Ut(t);if(this.iHash=e.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 s=this.blockLen,i=new Uint8Array(s);i.set(n.length>s?e.create().update(n).digest():n);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=e.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),i.fill(0)}update(e){return Ar(this),this.iHash.update(e),this}digestInto(e){Ar(this),Er(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:t,iHash:n,finished:s,destroyed:i,blockLen:o,outputLen:a}=this;return e=e,e.finished=s,e.destroyed=i,e.blockLen=o,e.outputLen=a,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},an=(r,e,t)=>new Gn(r,e).update(t).digest();an.create=(r,e)=>new Gn(r,e);function Pd(r,e,t,n){Rn(r);let s=fc({dkLen:32,asyncTick:10},n),{c:i,dkLen:o,asyncTick:a}=s;if(vr(i),vr(o),vr(a),i<1)throw new Error("PBKDF2: iterations (c) should be >= 1");let c=Ut(e),h=Ut(t),f=new Uint8Array(o),l=an.create(r,c),m=l._cloneInto().update(h);return{c:i,dkLen:o,asyncTick:a,DK:f,PRF:l,PRFSalt:m}}function Md(r,e,t,n,s){return r.destroy(),e.destroy(),n&&n.destroy(),s.fill(0),t}async function Eo(r,e,t,n){let{c:s,dkLen:i,asyncTick:o,DK:a,PRF:c,PRFSalt:h}=Pd(r,e,t,n),f,l=new Uint8Array(4),m=Br(l),u=new Uint8Array(c.outputLen);for(let d=1,p=0;p<i;d++,p+=c.outputLen){let b=a.subarray(p,p+c.outputLen);m.setInt32(0,d,!1),(f=h._cloneInto(f)).update(l).digestInto(u),b.set(u.subarray(0,b.length)),await lc(s-1,o,()=>{c._cloneInto(f).update(u).digestInto(u);for(let g=0;g<b.length;g++)b[g]^=u[g]})}return Md(c,h,a,f,u)}var G=pi(Kc());function or(r,e){let t=0;if(r.length===1)return r[0];for(let n=r.length-1;n>=0;n--)t+=r[r.length-1-n]*Math.pow(2,e*n);return t}function Ft(r,e,t=-1){let n=t,s=r,i=0,o=Math.pow(2,e);for(let a=1;a<8;a++){if(r<o){let c;if(n<0)c=new ArrayBuffer(a),i=a;else{if(n<a)return new ArrayBuffer(0);c=new ArrayBuffer(n),i=n}let h=new Uint8Array(c);for(let f=a-1;f>=0;f--){let l=Math.pow(2,f*e);h[i-f-1]=Math.floor(s/l),s-=h[i-f-1]*l}return c}o*=Math.pow(2,e)}return new ArrayBuffer(0)}function Yn(...r){let e=0,t=0;for(let i of r)e+=i.length;let n=new ArrayBuffer(e),s=new Uint8Array(n);for(let i of r)s.set(i,t),t+=i.length;return s}function So(){let r=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){let a=r[0]===255&&r[1]&128,c=r[0]===0&&(r[1]&128)===0;(a||c)&&this.warnings.push("Needlessly long format")}let e=new ArrayBuffer(this.valueHex.byteLength),t=new Uint8Array(e);for(let a=0;a<this.valueHex.byteLength;a++)t[a]=0;t[0]=r[0]&128;let n=or(t,8),s=new ArrayBuffer(this.valueHex.byteLength),i=new Uint8Array(s);for(let a=0;a<this.valueHex.byteLength;a++)i[a]=r[a];return i[0]&=127,or(i,8)-n}function qc(r){let e=r<0?r*-1:r,t=128;for(let n=1;n<8;n++){if(e<=t){if(r<0){let o=t-e,a=Ft(o,8,n),c=new Uint8Array(a);return c[0]|=128,a}let s=Ft(e,8,n),i=new Uint8Array(s);if(i[0]&128){let o=s.slice(0),a=new Uint8Array(o);s=new ArrayBuffer(s.byteLength+1),i=new Uint8Array(s);for(let c=0;c<o.byteLength;c++)i[c+1]=a[c];i[0]=0}return s}t*=Math.pow(2,8)}return new ArrayBuffer(0)}function zc(r,e){if(r.byteLength!==e.byteLength)return!1;let t=new Uint8Array(r),n=new Uint8Array(e);for(let s=0;s<t.length;s++)if(t[s]!==n[s])return!1;return!0}function Ce(r,e){let t=r.toString(10);if(e<t.length)return"";let n=e-t.length,s=new Array(n);for(let o=0;o<n;o++)s[o]="0";return s.join("").concat(t)}var Gy=Math.log(2);function Zn(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function Bo(r){let e=0,t=0;for(let s=0;s<r.length;s++){let i=r[s];e+=i.byteLength}let n=new Uint8Array(e);for(let s=0;s<r.length;s++){let i=r[s];n.set(new Uint8Array(i),t),t+=i.byteLength}return n.buffer}function Bt(r,e,t,n){return e instanceof Uint8Array?e.byteLength?t<0?(r.error="Wrong parameter: inputOffset less than zero",!1):n<0?(r.error="Wrong parameter: inputLength less than zero",!1):e.byteLength-t-n<0?(r.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):!0:(r.error="Wrong parameter: inputBuffer has zero length",!1):(r.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}var ln=class{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return Bo(this.items)}},cn=[new Uint8Array([1])],$c="0123456789";var Or="",et=new ArrayBuffer(0),_o=new Uint8Array(0),un="EndOfContent",jc="OCTET STRING",Wc="BIT STRING";function _t(r){var e;return e=class extends r{constructor(...n){var s;super(...n);let i=n[0]||{};this.isHexOnly=(s=i.isHexOnly)!==null&&s!==void 0?s:!1,this.valueHexView=i.valueHex?G.BufferSourceConverter.toUint8Array(i.valueHex):_o}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(n){this.valueHexView=new Uint8Array(n)}fromBER(n,s,i){let o=n instanceof ArrayBuffer?new Uint8Array(n):n;if(!Bt(this,o,s,i))return-1;let a=s+i;return this.valueHexView=o.subarray(s,a),this.valueHexView.length?(this.blockLength=i,a):(this.warnings.push("Zero buffer length"),s)}toBER(n=!1){return this.isHexOnly?n?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer:(this.error="Flag 'isHexOnly' is not set, abort",et)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:G.Convert.ToHex(this.valueHexView)}}},e.NAME="hexBlock",e}var Et=class{constructor({blockLength:e=0,error:t=Or,warnings:n=[],valueBeforeDecode:s=_o}={}){this.blockLength=e,this.error=t,this.warnings=n,this.valueBeforeDecodeView=G.BufferSourceConverter.toUint8Array(s)}static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(e){this.valueBeforeDecodeView=new Uint8Array(e)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:G.Convert.ToHex(this.valueBeforeDecodeView)}}};Et.NAME="baseBlock";var Ie=class extends Et{fromBER(e,t,n){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(e,t){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}};Ie.NAME="valueBlock";var Xn=class extends _t(Et){constructor({idBlock:e={}}={}){var t,n,s,i;super(),e?(this.isHexOnly=(t=e.isHexOnly)!==null&&t!==void 0?t:!1,this.valueHexView=e.valueHex?G.BufferSourceConverter.toUint8Array(e.valueHex):_o,this.tagClass=(n=e.tagClass)!==null&&n!==void 0?n:-1,this.tagNumber=(s=e.tagNumber)!==null&&s!==void 0?s:-1,this.isConstructed=(i=e.isConstructed)!==null&&i!==void 0?i:!1):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(e=!1){let t=0;switch(this.tagClass){case 1:t|=0;break;case 2:t|=64;break;case 3:t|=128;break;case 4:t|=192;break;default:return this.error="Unknown tag class",et}if(this.isConstructed&&(t|=32),this.tagNumber<31&&!this.isHexOnly){let s=new Uint8Array(1);if(!e){let i=this.tagNumber;i&=31,t|=i,s[0]=t}return s.buffer}if(!this.isHexOnly){let s=Ft(this.tagNumber,7),i=new Uint8Array(s),o=s.byteLength,a=new Uint8Array(o+1);if(a[0]=t|31,!e){for(let c=0;c<o-1;c++)a[c+1]=i[c]|128;a[o]=i[o-1]}return a.buffer}let n=new Uint8Array(this.valueHexView.byteLength+1);if(n[0]=t|31,!e){let s=this.valueHexView;for(let i=0;i<s.length-1;i++)n[i+1]=s[i]|128;n[this.valueHexView.byteLength]=s[s.length-1]}return n.buffer}fromBER(e,t,n){let s=G.BufferSourceConverter.toUint8Array(e);if(!Bt(this,s,t,n))return-1;let i=s.subarray(t,t+n);if(i.length===0)return this.error="Zero buffer length",-1;switch(i[0]&192){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:return this.error="Unknown tag class",-1}this.isConstructed=(i[0]&32)===32,this.isHexOnly=!1;let a=i[0]&31;if(a!==31)this.tagNumber=a,this.blockLength=1;else{let c=1,h=this.valueHexView=new Uint8Array(255),f=255;for(;i[c]&128;){if(h[c-1]=i[c]&127,c++,c>=i.length)return this.error="End of input reached before message was fully decoded",-1;if(c===f){f+=255;let m=new Uint8Array(f);for(let u=0;u<h.length;u++)m[u]=h[u];h=this.valueHexView=new Uint8Array(f)}}this.blockLength=c+1,h[c-1]=i[c]&127;let l=new Uint8Array(c);for(let m=0;m<c;m++)l[m]=h[m];h=this.valueHexView=new Uint8Array(c),h.set(l),this.blockLength<=9?this.tagNumber=or(h,7):(this.isHexOnly=!0,this.warnings.push("Tag too long, represented as hex-coded"))}if(this.tagClass===1&&this.isConstructed)switch(this.tagNumber){case 1:case 2:case 5:case 6:case 9:case 13:case 14:case 23:case 24:case 31:case 32:case 33:case 34:return this.error="Constructed encoding used for primitive type",-1}return t+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}};Xn.NAME="identificationBlock";var Jn=class extends Et{constructor({lenBlock:e={}}={}){var t,n,s;super(),this.isIndefiniteForm=(t=e.isIndefiniteForm)!==null&&t!==void 0?t:!1,this.longFormUsed=(n=e.longFormUsed)!==null&&n!==void 0?n:!1,this.length=(s=e.length)!==null&&s!==void 0?s:0}fromBER(e,t,n){let s=G.BufferSourceConverter.toUint8Array(e);if(!Bt(this,s,t,n))return-1;let i=s.subarray(t,t+n);if(i.length===0)return this.error="Zero buffer length",-1;if(i[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=i[0]===128,this.isIndefiniteForm)return this.blockLength=1,t+this.blockLength;if(this.longFormUsed=!!(i[0]&128),this.longFormUsed===!1)return this.length=i[0],this.blockLength=1,t+this.blockLength;let o=i[0]&127;if(o>8)return this.error="Too big integer",-1;if(o+1>i.length)return this.error="End of input reached before message was fully decoded",-1;let a=t+1,c=s.subarray(a,a+o);return c[o-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=or(c,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=o+1,t+this.blockLength}toBER(e=!1){let t,n;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(t),n[0]=128),t;if(this.longFormUsed){let s=Ft(this.length,8);if(s.byteLength>127)return this.error="Too big length",et;if(t=new ArrayBuffer(s.byteLength+1),e)return t;let i=new Uint8Array(s);n=new Uint8Array(t),n[0]=s.byteLength|128;for(let o=0;o<s.byteLength;o++)n[o+1]=i[o];return t}return t=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(t),n[0]=this.length),t}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}};Jn.NAME="lengthBlock";var T={},ve=class extends Et{constructor({name:e=Or,optional:t=!1,primitiveSchema:n,...s}={},i){super(s),this.name=e,this.optional=t,n&&(this.primitiveSchema=n),this.idBlock=new Xn(s),this.lenBlock=new Jn(s),this.valueBlock=i?new i(s):new Ie(s)}fromBER(e,t,n){let s=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return s===-1?(this.error=this.valueBlock.error,s):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),s)}toBER(e,t){let n=t||new ln;t||Yc(this);let s=this.idBlock.toBER(e);if(n.write(s),this.lenBlock.isIndefiniteForm)n.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,n),n.write(new ArrayBuffer(2));else{let i=this.valueBlock.toBER(e);this.lenBlock.length=i.byteLength;let o=this.lenBlock.toBER(e);n.write(o),n.write(i)}return t?et:n.final()}toJSON(){let e={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(e.primitiveSchema=this.primitiveSchema.toJSON()),e}toString(e="ascii"){return e==="ascii"?this.onAsciiEncoding():G.Convert.ToHex(this.toBER())}onAsciiEncoding(){return`${this.constructor.NAME} : ${G.Convert.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;let t=this.toBER(),n=e.toBER();return zc(t,n)}};ve.NAME="BaseBlock";function Yc(r){if(r instanceof T.Constructed)for(let e of r.valueBlock.value)Yc(e)&&(r.lenBlock.isIndefiniteForm=!0);return!!r.lenBlock.isIndefiniteForm}var Qn=class extends ve{constructor({value:e=Or,...t}={},n){super(t,n),e&&this.fromString(e)}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}fromBER(e,t,n){let s=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return s===-1?(this.error=this.valueBlock.error,s):(this.fromBuffer(this.valueBlock.valueHexView),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),s)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}};Qn.NAME="BaseStringBlock";var es=class extends _t(Ie){constructor({isHexOnly:e=!0,...t}={}){super(t),this.isHexOnly=e}};es.NAME="PrimitiveValueBlock";var Zc,ts=class extends ve{constructor(e={}){super(e,es),this.idBlock.isConstructed=!1}};Zc=ts;T.Primitive=Zc;ts.NAME="PRIMITIVE";function jd(r,e){if(r instanceof e)return r;let t=new e;return t.idBlock=r.idBlock,t.lenBlock=r.lenBlock,t.warnings=r.warnings,t.valueBeforeDecodeView=r.valueBeforeDecodeView,t}function Us(r,e=0,t=r.length){let n=e,s=new ve({},Ie),i=new Et;if(!Bt(i,r,e,t))return s.error=i.error,{offset:-1,result:s};if(!r.subarray(e,e+t).length)return s.error="Zero buffer length",{offset:-1,result:s};let a=s.idBlock.fromBER(r,e,t);if(s.idBlock.warnings.length&&s.warnings.concat(s.idBlock.warnings),a===-1)return s.error=s.idBlock.error,{offset:-1,result:s};if(e=a,t-=s.idBlock.blockLength,a=s.lenBlock.fromBER(r,e,t),s.lenBlock.warnings.length&&s.warnings.concat(s.lenBlock.warnings),a===-1)return s.error=s.lenBlock.error,{offset:-1,result:s};if(e=a,t-=s.lenBlock.blockLength,!s.idBlock.isConstructed&&s.lenBlock.isIndefiniteForm)return s.error="Indefinite length form used for primitive encoding form",{offset:-1,result:s};let c=ve;switch(s.idBlock.tagClass){case 1:if(s.idBlock.tagNumber>=37&&s.idBlock.isHexOnly===!1)return s.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:s};switch(s.idBlock.tagNumber){case 0:if(s.idBlock.isConstructed&&s.lenBlock.length>0)return s.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:s};c=T.EndOfContent;break;case 1:c=T.Boolean;break;case 2:c=T.Integer;break;case 3:c=T.BitString;break;case 4:c=T.OctetString;break;case 5:c=T.Null;break;case 6:c=T.ObjectIdentifier;break;case 10:c=T.Enumerated;break;case 12:c=T.Utf8String;break;case 13:c=T.RelativeObjectIdentifier;break;case 14:c=T.TIME;break;case 15:return s.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:s};case 16:c=T.Sequence;break;case 17:c=T.Set;break;case 18:c=T.NumericString;break;case 19:c=T.PrintableString;break;case 20:c=T.TeletexString;break;case 21:c=T.VideotexString;break;case 22:c=T.IA5String;break;case 23:c=T.UTCTime;break;case 24:c=T.GeneralizedTime;break;case 25:c=T.GraphicString;break;case 26:c=T.VisibleString;break;case 27:c=T.GeneralString;break;case 28:c=T.UniversalString;break;case 29:c=T.CharacterString;break;case 30:c=T.BmpString;break;case 31:c=T.DATE;break;case 32:c=T.TimeOfDay;break;case 33:c=T.DateTime;break;case 34:c=T.Duration;break;default:{let h=s.idBlock.isConstructed?new T.Constructed:new T.Primitive;h.idBlock=s.idBlock,h.lenBlock=s.lenBlock,h.warnings=s.warnings,s=h}}break;case 2:case 3:case 4:default:c=s.idBlock.isConstructed?T.Constructed:T.Primitive}return s=jd(s,c),a=s.fromBER(r,e,s.lenBlock.isIndefiniteForm?t:s.lenBlock.length),s.valueBeforeDecodeView=r.subarray(n,n+s.blockLength),{offset:a,result:s}}function Pr(r){if(!r.byteLength){let e=new ve({},Ie);return e.error="Input buffer has zero length",{offset:-1,result:e}}return Us(G.BufferSourceConverter.toUint8Array(r).slice(),0,r.byteLength)}function Wd(r,e){return r?1:e}var ct=class extends Ie{constructor({value:e=[],isIndefiniteForm:t=!1,...n}={}){super(n),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,n){let s=G.BufferSourceConverter.toUint8Array(e);if(!Bt(this,s,t,n))return-1;if(this.valueBeforeDecodeView=s.subarray(t,t+n),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),t;let i=t;for(;Wd(this.isIndefiniteForm,n)>0;){let o=Us(s,i,n);if(o.offset===-1)return this.error=o.result.error,this.warnings.concat(o.result.warnings),-1;if(i=o.offset,this.blockLength+=o.result.blockLength,n-=o.result.blockLength,this.value.push(o.result),this.isIndefiniteForm&&o.result.constructor.NAME===un)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===un?this.value.pop():this.warnings.push("No EndOfContent block encoded")),i}toBER(e,t){let n=t||new ln;for(let s=0;s<this.value.length;s++)this.value[s].toBER(e,n);return t?et:n.final()}toJSON(){let e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(let t of this.value)e.value.push(t.toJSON());return e}};ct.NAME="ConstructedValueBlock";var Xc,Kt=class extends ve{constructor(e={}){super(e,ct),this.idBlock.isConstructed=!0}fromBER(e,t,n){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;let s=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return s===-1?(this.error=this.valueBlock.error,s):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),s)}onAsciiEncoding(){let e=[];for(let n of this.valueBlock.value)e.push(n.toString("ascii").split(`
|
3
3
|
`).map(s=>` ${s}`).join(`
|
4
4
|
`));let t=this.idBlock.tagClass===3?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return e.length?`${t} :
|
5
5
|
${e.join(`
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@libp2p/circuit-relay-v2",
|
3
|
-
"version": "1.1.
|
3
|
+
"version": "1.1.4",
|
4
4
|
"description": "Implementation of Circuit Relay v2",
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/transport-circuit-relay-v2#readme",
|
@@ -52,12 +52,12 @@
|
|
52
52
|
"doc-check": "aegir doc-check"
|
53
53
|
},
|
54
54
|
"dependencies": {
|
55
|
-
"@libp2p/interface": "^1.6.
|
56
|
-
"@libp2p/interface-internal": "^1.3.
|
57
|
-
"@libp2p/peer-collections": "^5.2.
|
58
|
-
"@libp2p/peer-id": "^4.2.
|
59
|
-
"@libp2p/peer-record": "^7.0.
|
60
|
-
"@libp2p/utils": "^5.4.
|
55
|
+
"@libp2p/interface": "^1.6.3",
|
56
|
+
"@libp2p/interface-internal": "^1.3.3",
|
57
|
+
"@libp2p/peer-collections": "^5.2.8",
|
58
|
+
"@libp2p/peer-id": "^4.2.3",
|
59
|
+
"@libp2p/peer-record": "^7.0.24",
|
60
|
+
"@libp2p/utils": "^5.4.8",
|
61
61
|
"@multiformats/mafmt": "^12.1.6",
|
62
62
|
"@multiformats/multiaddr": "^12.2.3",
|
63
63
|
"any-signal": "^4.1.1",
|
@@ -72,10 +72,10 @@
|
|
72
72
|
"uint8arrays": "^5.1.0"
|
73
73
|
},
|
74
74
|
"devDependencies": {
|
75
|
-
"@libp2p/interface-compliance-tests": "^5.4.
|
76
|
-
"@libp2p/logger": "^4.0.
|
77
|
-
"@libp2p/peer-id-factory": "^4.2.
|
78
|
-
"aegir": "^
|
75
|
+
"@libp2p/interface-compliance-tests": "^5.4.11",
|
76
|
+
"@libp2p/logger": "^4.0.19",
|
77
|
+
"@libp2p/peer-id-factory": "^4.2.3",
|
78
|
+
"aegir": "^44.0.1",
|
79
79
|
"delay": "^6.0.0",
|
80
80
|
"it-drain": "^3.0.7",
|
81
81
|
"it-pair": "^2.0.6",
|