libp2p 2.0.0 → 2.0.1-18dd3cb26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.min.js +2 -2
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.d.ts.map +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/package.json +18 -18
- package/src/version.ts +1 -1
- package/dist/typedoc-urls.json +0 -14
package/dist/index.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2P = factory()}(typeof self !== 'undefined' ? self : this, function () {
|
|
2
|
-
"use strict";var Libp2P=(()=>{var qp=Object.create;var Lo=Object.defineProperty;var zp=Object.getOwnPropertyDescriptor;var Gp=Object.getOwnPropertyNames;var Wp=Object.getPrototypeOf,jp=Object.prototype.hasOwnProperty;var Qt=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),Rt=(r,t)=>{for(var e in t)Lo(r,e,{get:t[e],enumerable:!0})},Pu=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Gp(t))!jp.call(r,o)&&o!==e&&Lo(r,o,{get:()=>t[o],enumerable:!(n=zp(t,o))||n.enumerable});return r};var sr=(r,t,e)=>(e=r!=null?qp(Wp(r)):{},Pu(t||!r||!r.__esModule?Lo(e,"default",{value:r,enumerable:!0}):e,r)),Zp=r=>Pu(Lo({},"__esModule",{value:!0}),r);var Uf=Qt(Xr=>{"use strict";var w0="[object ArrayBuffer]",Ce=class r{static isArrayBuffer(t){return Object.prototype.toString.call(t)===w0}static toArrayBuffer(t){return this.isArrayBuffer(t)?t:t.byteLength===t.buffer.byteLength||t.byteOffset===0&&t.byteLength===t.buffer.byteLength?t.buffer:this.toUint8Array(t.buffer).slice(t.byteOffset,t.byteOffset+t.byteLength).buffer}static toUint8Array(t){return this.toView(t,Uint8Array)}static toView(t,e){if(t.constructor===e)return t;if(this.isArrayBuffer(t))return new e(t);if(this.isArrayBufferView(t))return new e(t.buffer,t.byteOffset,t.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(t){return this.isArrayBufferView(t)||this.isArrayBuffer(t)}static isArrayBufferView(t){return ArrayBuffer.isView(t)||t&&this.isArrayBuffer(t.buffer)}static isEqual(t,e){let n=r.toUint8Array(t),o=r.toUint8Array(e);if(n.length!==o.byteLength)return!1;for(let s=0;s<n.length;s++)if(n[s]!==o[s])return!1;return!0}static concat(...t){let e;Array.isArray(t[0])&&!(t[1]instanceof Function)||Array.isArray(t[0])&&t[1]instanceof Function?e=t[0]:t[t.length-1]instanceof Function?e=t.slice(0,t.length-1):e=t;let n=0;for(let i of e)n+=i.byteLength;let o=new Uint8Array(n),s=0;for(let i of e){let a=this.toUint8Array(i);o.set(a,s),s+=a.length}return t[t.length-1]instanceof Function?this.toView(o,t[t.length-1]):o.buffer}},qc="string",b0=/^[0-9a-f]+$/i,x0=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,v0=/^[a-zA-Z0-9-_]+$/,cs=class{static fromString(t){let e=unescape(encodeURIComponent(t)),n=new Uint8Array(e.length);for(let o=0;o<e.length;o++)n[o]=e.charCodeAt(o);return n.buffer}static toString(t){let e=Ce.toUint8Array(t),n="";for(let s=0;s<e.length;s++)n+=String.fromCharCode(e[s]);return decodeURIComponent(escape(n))}},Zt=class{static toString(t,e=!1){let n=Ce.toArrayBuffer(t),o=new DataView(n),s="";for(let i=0;i<n.byteLength;i+=2){let a=o.getUint16(i,e);s+=String.fromCharCode(a)}return s}static fromString(t,e=!1){let n=new ArrayBuffer(t.length*2),o=new DataView(n);for(let s=0;s<t.length;s++)o.setUint16(s*2,t.charCodeAt(s),e);return n}},ls=class r{static isHex(t){return typeof t===qc&&b0.test(t)}static isBase64(t){return typeof t===qc&&x0.test(t)}static isBase64Url(t){return typeof t===qc&&v0.test(t)}static ToString(t,e="utf8"){let n=Ce.toUint8Array(t);switch(e.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 Zt.toString(n,!0);case"utf16":case"utf16be":return Zt.toString(n);default:throw new Error(`Unknown type of encoding '${e}'`)}}static FromString(t,e="utf8"){if(!t)return new ArrayBuffer(0);switch(e.toLowerCase()){case"utf8":return this.FromUtf8String(t);case"binary":return this.FromBinary(t);case"hex":return this.FromHex(t);case"base64":return this.FromBase64(t);case"base64url":return this.FromBase64Url(t);case"utf16le":return Zt.fromString(t,!0);case"utf16":case"utf16be":return Zt.fromString(t);default:throw new Error(`Unknown type of encoding '${e}'`)}}static ToBase64(t){let e=Ce.toUint8Array(t);if(typeof btoa<"u"){let n=this.ToString(e,"binary");return btoa(n)}else return Buffer.from(e).toString("base64")}static FromBase64(t){let e=this.formatString(t);if(!e)return new ArrayBuffer(0);if(!r.isBase64(e))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return typeof atob<"u"?this.FromBinary(atob(e)):new Uint8Array(Buffer.from(e,"base64")).buffer}static FromBase64Url(t){let e=this.formatString(t);if(!e)return new ArrayBuffer(0);if(!r.isBase64Url(e))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(e.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(t){return this.ToBase64(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(t,e=r.DEFAULT_UTF8_ENCODING){switch(e){case"ascii":return this.FromBinary(t);case"utf8":return cs.fromString(t);case"utf16":case"utf16be":return Zt.fromString(t);case"utf16le":case"usc2":return Zt.fromString(t,!0);default:throw new Error(`Unknown type of encoding '${e}'`)}}static ToUtf8String(t,e=r.DEFAULT_UTF8_ENCODING){switch(e){case"ascii":return this.ToBinary(t);case"utf8":return cs.toString(t);case"utf16":case"utf16be":return Zt.toString(t);case"utf16le":case"usc2":return Zt.toString(t,!0);default:throw new Error(`Unknown type of encoding '${e}'`)}}static FromBinary(t){let e=t.length,n=new Uint8Array(e);for(let o=0;o<e;o++)n[o]=t.charCodeAt(o);return n.buffer}static ToBinary(t){let e=Ce.toUint8Array(t),n="";for(let o=0;o<e.length;o++)n+=String.fromCharCode(e[o]);return n}static ToHex(t){let e=Ce.toUint8Array(t),n="",o=e.length;for(let s=0;s<o;s++){let i=e[s];i<16&&(n+="0"),n+=i.toString(16)}return n}static FromHex(t){let e=this.formatString(t);if(!e)return new ArrayBuffer(0);if(!r.isHex(e))throw new TypeError("Argument 'hexString' is not HEX encoded");e.length%2&&(e=`0${e}`);let n=new Uint8Array(e.length/2);for(let o=0;o<e.length;o=o+2){let s=e.slice(o,o+2);n[o/2]=parseInt(s,16)}return n.buffer}static ToUtf16String(t,e=!1){return Zt.toString(t,e)}static FromUtf16String(t,e=!1){return Zt.fromString(t,e)}static Base64Padding(t){let e=4-t.length%4;if(e<4)for(let n=0;n<e;n++)t+="=";return t}static formatString(t){return t?.replace(/[\n\r\t ]/g,"")||""}};ls.DEFAULT_UTF8_ENCODING="utf8";function E0(r,...t){let e=arguments[0];for(let n=1;n<arguments.length;n++){let o=arguments[n];for(let s in o)e[s]=o[s]}return e}function A0(...r){let t=r.map(o=>o.byteLength).reduce((o,s)=>o+s),e=new Uint8Array(t),n=0;return r.map(o=>new Uint8Array(o)).forEach(o=>{for(let s of o)e[n++]=s}),e.buffer}function S0(r,t){if(!(r&&t)||r.byteLength!==t.byteLength)return!1;let e=new Uint8Array(r),n=new Uint8Array(t);for(let o=0;o<r.byteLength;o++)if(e[o]!==n[o])return!1;return!0}Xr.BufferSourceConverter=Ce;Xr.Convert=ls;Xr.assign=E0;Xr.combine=A0;Xr.isEqual=S0});var yd=Qt(co=>{(function(){var r,t,e,n,o,s,i,a;a=function(c){var u,f,l,d;return u=(c&255<<24)>>>24,f=(c&255<<16)>>>16,l=(c&65280)>>>8,d=c&255,[u,f,l,d].join(".")},i=function(c){var u,f,l,d,h,p;for(u=[],l=d=0;d<=3&&c.length!==0;l=++d){if(l>0){if(c[0]!==".")throw new Error("Invalid IP");c=c.substring(1)}p=t(c),h=p[0],f=p[1],c=c.substring(f),u.push(h)}if(c.length!==0)throw new Error("Invalid IP");switch(u.length){case 1:if(u[0]>4294967295)throw new Error("Invalid IP");return u[0]>>>0;case 2:if(u[0]>255||u[1]>16777215)throw new Error("Invalid IP");return(u[0]<<24|u[1])>>>0;case 3:if(u[0]>255||u[1]>255||u[2]>65535)throw new Error("Invalid IP");return(u[0]<<24|u[1]<<16|u[2])>>>0;case 4:if(u[0]>255||u[1]>255||u[2]>255||u[3]>255)throw new Error("Invalid IP");return(u[0]<<24|u[1]<<16|u[2]<<8|u[3])>>>0;default:throw new Error("Invalid IP")}},e=function(c){return c.charCodeAt(0)},n=e("0"),s=e("a"),o=e("A"),t=function(c){var u,f,l,d,h;for(d=0,u=10,f="9",l=0,c.length>1&&c[l]==="0"&&(c[l+1]==="x"||c[l+1]==="X"?(l+=2,u=16):"0"<=c[l+1]&&c[l+1]<="9"&&(l++,u=8,f="7")),h=l;l<c.length;){if("0"<=c[l]&&c[l]<=f)d=d*u+(e(c[l])-n)>>>0;else if(u===16)if("a"<=c[l]&&c[l]<="f")d=d*u+(10+e(c[l])-s)>>>0;else if("A"<=c[l]&&c[l]<="F")d=d*u+(10+e(c[l])-o)>>>0;else break;else break;if(d>4294967295)throw new Error("too large");l++}if(l===h)throw new Error("empty octet");return[d,l]},r=function(){function c(u,f){var l,d,h,p;if(typeof u!="string")throw new Error("Missing `net' parameter");if(f||(p=u.split("/",2),u=p[0],f=p[1]),f||(f=32),typeof f=="string"&&f.indexOf(".")>-1){try{this.maskLong=i(f)}catch(m){throw l=m,new Error("Invalid mask: "+f)}for(d=h=32;h>=0;d=--h)if(this.maskLong===4294967295<<32-d>>>0){this.bitmask=d;break}}else if(f||f===0)this.bitmask=parseInt(f,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0);else throw new Error("Invalid mask: empty");try{this.netLong=(i(u)&this.maskLong)>>>0}catch(m){throw l=m,new Error("Invalid net address: "+u)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+f);this.size=Math.pow(2,32-this.bitmask),this.base=a(this.netLong),this.mask=a(this.maskLong),this.hostmask=a(~this.maskLong),this.first=this.bitmask<=30?a(this.netLong+1):this.base,this.last=this.bitmask<=30?a(this.netLong+this.size-2):a(this.netLong+this.size-1),this.broadcast=this.bitmask<=30?a(this.netLong+this.size-1):void 0}return c.prototype.contains=function(u){return typeof u=="string"&&(u.indexOf("/")>0||u.split(".").length!==4)&&(u=new c(u)),u instanceof c?this.contains(u.base)&&this.contains(u.broadcast||u.last):(i(u)&this.maskLong)>>>0===(this.netLong&this.maskLong)>>>0},c.prototype.next=function(u){return u==null&&(u=1),new c(a(this.netLong+this.size*u),this.mask)},c.prototype.forEach=function(u){var f,l,d;for(d=i(this.first),l=i(this.last),f=0;d<=l;)u(a(d),d,f),f++,d++},c.prototype.toString=function(){return this.base+"/"+this.bitmask},c}(),co.ip2long=i,co.long2ip=a,co.Netmask=r}).call(co)});var xd=Qt((aS,Cl)=>{"use strict";var Cy=Object.prototype.hasOwnProperty,Vt="~";function lo(){}Object.create&&(lo.prototype=Object.create(null),new lo().__proto__||(Vt=!1));function Ty(r,t,e){this.fn=r,this.context=t,this.once=e||!1}function bd(r,t,e,n,o){if(typeof e!="function")throw new TypeError("The listener must be a function");var s=new Ty(e,n||r,o),i=Vt?Vt+t:t;return r._events[i]?r._events[i].fn?r._events[i]=[r._events[i],s]:r._events[i].push(s):(r._events[i]=s,r._eventsCount++),r}function hi(r,t){--r._eventsCount===0?r._events=new lo:delete r._events[t]}function Nt(){this._events=new lo,this._eventsCount=0}Nt.prototype.eventNames=function(){var t=[],e,n;if(this._eventsCount===0)return t;for(n in e=this._events)Cy.call(e,n)&&t.push(Vt?n.slice(1):n);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Nt.prototype.listeners=function(t){var e=Vt?Vt+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,s=n.length,i=new Array(s);o<s;o++)i[o]=n[o].fn;return i};Nt.prototype.listenerCount=function(t){var e=Vt?Vt+t:t,n=this._events[e];return n?n.fn?1:n.length:0};Nt.prototype.emit=function(t,e,n,o,s,i){var a=Vt?Vt+t:t;if(!this._events[a])return!1;var c=this._events[a],u=arguments.length,f,l;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),u){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,n),!0;case 4:return c.fn.call(c.context,e,n,o),!0;case 5:return c.fn.call(c.context,e,n,o,s),!0;case 6:return c.fn.call(c.context,e,n,o,s,i),!0}for(l=1,f=new Array(u-1);l<u;l++)f[l-1]=arguments[l];c.fn.apply(c.context,f)}else{var d=c.length,h;for(l=0;l<d;l++)switch(c[l].once&&this.removeListener(t,c[l].fn,void 0,!0),u){case 1:c[l].fn.call(c[l].context);break;case 2:c[l].fn.call(c[l].context,e);break;case 3:c[l].fn.call(c[l].context,e,n);break;case 4:c[l].fn.call(c[l].context,e,n,o);break;default:if(!f)for(h=1,f=new Array(u-1);h<u;h++)f[h-1]=arguments[h];c[l].fn.apply(c[l].context,f)}}return!0};Nt.prototype.on=function(t,e,n){return bd(this,t,e,n,!1)};Nt.prototype.once=function(t,e,n){return bd(this,t,e,n,!0)};Nt.prototype.removeListener=function(t,e,n,o){var s=Vt?Vt+t:t;if(!this._events[s])return this;if(!e)return hi(this,s),this;var i=this._events[s];if(i.fn)i.fn===e&&(!o||i.once)&&(!n||i.context===n)&&hi(this,s);else{for(var a=0,c=[],u=i.length;a<u;a++)(i[a].fn!==e||o&&!i[a].once||n&&i[a].context!==n)&&c.push(i[a]);c.length?this._events[s]=c.length===1?c[0]:c:hi(this,s)}return this};Nt.prototype.removeAllListeners=function(t){var e;return t?(e=Vt?Vt+t:t,this._events[e]&&hi(this,e)):(this._events=new lo,this._eventsCount=0),this};Nt.prototype.off=Nt.prototype.removeListener;Nt.prototype.addListener=Nt.prototype.on;Nt.prefixed=Vt;Nt.EventEmitter=Nt;typeof Cl<"u"&&(Cl.exports=Nt)});var _d=Qt((TS,Sd)=>{Sd.exports=function(r){if(!r)throw Error("hashlru must have a max value, of type number, greater than 0");var t=0,e=Object.create(null),n=Object.create(null);function o(s,i){e[s]=i,t++,t>=r&&(t=0,n=e,e=Object.create(null))}return{has:function(s){return e[s]!==void 0||n[s]!==void 0},remove:function(s){e[s]!==void 0&&(e[s]=void 0),n[s]!==void 0&&(n[s]=void 0)},get:function(s){var i=e[s];if(i!==void 0)return i;if((i=n[s])!==void 0)return o(s,i),i},set:function(s,i){e[s]!==void 0?e[s]=i:o(s,i)},clear:function(){e=Object.create(null),n=Object.create(null)}}}});var Td=Qt((WS,Cd)=>{"use strict";Cd.exports=r=>{if(Object.prototype.toString.call(r)!=="[object Object]")return!1;let t=Object.getPrototypeOf(r);return t===null||t===Object.prototype}});var Md=Qt((Rd,Dd)=>{"use strict";var gi=Td(),{hasOwnProperty:Nd}=Object.prototype,{propertyIsEnumerable:Dy}=Object,hn=(r,t,e)=>Object.defineProperty(r,t,{value:e,writable:!0,enumerable:!0,configurable:!0}),My=Rd,Ld={concatArrays:!1,ignoreUndefined:!1},yi=r=>{let t=[];for(let e in r)Nd.call(r,e)&&t.push(e);if(Object.getOwnPropertySymbols){let e=Object.getOwnPropertySymbols(r);for(let n of e)Dy.call(r,n)&&t.push(n)}return t};function dn(r){return Array.isArray(r)?Uy(r):gi(r)?Oy(r):r}function Uy(r){let t=r.slice(0,0);return yi(r).forEach(e=>{hn(t,e,dn(r[e]))}),t}function Oy(r){let t=Object.getPrototypeOf(r)===null?Object.create(null):{};return yi(r).forEach(e=>{hn(t,e,dn(r[e]))}),t}var Pd=(r,t,e,n)=>(e.forEach(o=>{typeof t[o]>"u"&&n.ignoreUndefined||(o in r&&r[o]!==Object.getPrototypeOf(r)?hn(r,o,Ul(r[o],t[o],n)):hn(r,o,dn(t[o])))}),r),Fy=(r,t,e)=>{let n=r.slice(0,0),o=0;return[r,t].forEach(s=>{let i=[];for(let a=0;a<s.length;a++)Nd.call(s,a)&&(i.push(String(a)),s===r?hn(n,o++,s[a]):hn(n,o++,dn(s[a])));n=Pd(n,s,yi(s).filter(a=>!i.includes(a)),e)}),n};function Ul(r,t,e){return e.concatArrays&&Array.isArray(r)&&Array.isArray(t)?Fy(r,t,e):!gi(t)||!gi(r)?dn(t):Pd(r,t,yi(t),e)}Dd.exports=function(...r){let t=Ul(dn(Ld),this!==My&&this||{},Ld),e={_:{}};for(let n of r)if(n!==void 0){if(!gi(n))throw new TypeError("`"+n+"` is not an Option Object");e=Ul(e,{_:n},t)}return e._}});var Vd=Qt((po,Si)=>{(function(r,t){"use strict";var e={version:"3.0.0",x86:{},x64:{},inputValidation:!0};function n(h){if(!Array.isArray(h)&&!ArrayBuffer.isView(h))return!1;for(var p=0;p<h.length;p++)if(!Number.isInteger(h[p])||h[p]<0||h[p]>255)return!1;return!0}function o(h,p){return(h&65535)*p+(((h>>>16)*p&65535)<<16)}function s(h,p){return h<<p|h>>>32-p}function i(h){return h^=h>>>16,h=o(h,2246822507),h^=h>>>13,h=o(h,3266489909),h^=h>>>16,h}function a(h,p){h=[h[0]>>>16,h[0]&65535,h[1]>>>16,h[1]&65535],p=[p[0]>>>16,p[0]&65535,p[1]>>>16,p[1]&65535];var m=[0,0,0,0];return m[3]+=h[3]+p[3],m[2]+=m[3]>>>16,m[3]&=65535,m[2]+=h[2]+p[2],m[1]+=m[2]>>>16,m[2]&=65535,m[1]+=h[1]+p[1],m[0]+=m[1]>>>16,m[1]&=65535,m[0]+=h[0]+p[0],m[0]&=65535,[m[0]<<16|m[1],m[2]<<16|m[3]]}function c(h,p){h=[h[0]>>>16,h[0]&65535,h[1]>>>16,h[1]&65535],p=[p[0]>>>16,p[0]&65535,p[1]>>>16,p[1]&65535];var m=[0,0,0,0];return m[3]+=h[3]*p[3],m[2]+=m[3]>>>16,m[3]&=65535,m[2]+=h[2]*p[3],m[1]+=m[2]>>>16,m[2]&=65535,m[2]+=h[3]*p[2],m[1]+=m[2]>>>16,m[2]&=65535,m[1]+=h[1]*p[3],m[0]+=m[1]>>>16,m[1]&=65535,m[1]+=h[2]*p[2],m[0]+=m[1]>>>16,m[1]&=65535,m[1]+=h[3]*p[1],m[0]+=m[1]>>>16,m[1]&=65535,m[0]+=h[0]*p[3]+h[1]*p[2]+h[2]*p[1]+h[3]*p[0],m[0]&=65535,[m[0]<<16|m[1],m[2]<<16|m[3]]}function u(h,p){return p%=64,p===32?[h[1],h[0]]:p<32?[h[0]<<p|h[1]>>>32-p,h[1]<<p|h[0]>>>32-p]:(p-=32,[h[1]<<p|h[0]>>>32-p,h[0]<<p|h[1]>>>32-p])}function f(h,p){return p%=64,p===0?h:p<32?[h[0]<<p|h[1]>>>32-p,h[1]<<p]:[h[1]<<p-32,0]}function l(h,p){return[h[0]^p[0],h[1]^p[1]]}function d(h){return h=l(h,[0,h[0]>>>1]),h=c(h,[4283543511,3981806797]),h=l(h,[0,h[0]>>>1]),h=c(h,[3301882366,444984403]),h=l(h,[0,h[0]>>>1]),h}e.x86.hash32=function(h,p){if(e.inputValidation&&!n(h))return t;p=p||0;for(var m=h.length%4,g=h.length-m,y=p,b=0,w=3432918353,x=461845907,A=0;A<g;A=A+4)b=h[A]|h[A+1]<<8|h[A+2]<<16|h[A+3]<<24,b=o(b,w),b=s(b,15),b=o(b,x),y^=b,y=s(y,13),y=o(y,5)+3864292196;switch(b=0,m){case 3:b^=h[A+2]<<16;case 2:b^=h[A+1]<<8;case 1:b^=h[A],b=o(b,w),b=s(b,15),b=o(b,x),y^=b}return y^=h.length,y=i(y),y>>>0},e.x86.hash128=function(h,p){if(e.inputValidation&&!n(h))return t;p=p||0;for(var m=h.length%16,g=h.length-m,y=p,b=p,w=p,x=p,A=0,_=0,v=0,B=0,T=597399067,et=2869860233,V=951274213,F=2716044179,R=0;R<g;R=R+16)A=h[R]|h[R+1]<<8|h[R+2]<<16|h[R+3]<<24,_=h[R+4]|h[R+5]<<8|h[R+6]<<16|h[R+7]<<24,v=h[R+8]|h[R+9]<<8|h[R+10]<<16|h[R+11]<<24,B=h[R+12]|h[R+13]<<8|h[R+14]<<16|h[R+15]<<24,A=o(A,T),A=s(A,15),A=o(A,et),y^=A,y=s(y,19),y+=b,y=o(y,5)+1444728091,_=o(_,et),_=s(_,16),_=o(_,V),b^=_,b=s(b,17),b+=w,b=o(b,5)+197830471,v=o(v,V),v=s(v,17),v=o(v,F),w^=v,w=s(w,15),w+=x,w=o(w,5)+2530024501,B=o(B,F),B=s(B,18),B=o(B,T),x^=B,x=s(x,13),x+=y,x=o(x,5)+850148119;switch(A=0,_=0,v=0,B=0,m){case 15:B^=h[R+14]<<16;case 14:B^=h[R+13]<<8;case 13:B^=h[R+12],B=o(B,F),B=s(B,18),B=o(B,T),x^=B;case 12:v^=h[R+11]<<24;case 11:v^=h[R+10]<<16;case 10:v^=h[R+9]<<8;case 9:v^=h[R+8],v=o(v,V),v=s(v,17),v=o(v,F),w^=v;case 8:_^=h[R+7]<<24;case 7:_^=h[R+6]<<16;case 6:_^=h[R+5]<<8;case 5:_^=h[R+4],_=o(_,et),_=s(_,16),_=o(_,V),b^=_;case 4:A^=h[R+3]<<24;case 3:A^=h[R+2]<<16;case 2:A^=h[R+1]<<8;case 1:A^=h[R],A=o(A,T),A=s(A,15),A=o(A,et),y^=A}return y^=h.length,b^=h.length,w^=h.length,x^=h.length,y+=b,y+=w,y+=x,b+=y,w+=y,x+=y,y=i(y),b=i(b),w=i(w),x=i(x),y+=b,y+=w,y+=x,b+=y,w+=y,x+=y,("00000000"+(y>>>0).toString(16)).slice(-8)+("00000000"+(b>>>0).toString(16)).slice(-8)+("00000000"+(w>>>0).toString(16)).slice(-8)+("00000000"+(x>>>0).toString(16)).slice(-8)},e.x64.hash128=function(h,p){if(e.inputValidation&&!n(h))return t;p=p||0;for(var m=h.length%16,g=h.length-m,y=[0,p],b=[0,p],w=[0,0],x=[0,0],A=[2277735313,289559509],_=[1291169091,658871167],v=0;v<g;v=v+16)w=[h[v+4]|h[v+5]<<8|h[v+6]<<16|h[v+7]<<24,h[v]|h[v+1]<<8|h[v+2]<<16|h[v+3]<<24],x=[h[v+12]|h[v+13]<<8|h[v+14]<<16|h[v+15]<<24,h[v+8]|h[v+9]<<8|h[v+10]<<16|h[v+11]<<24],w=c(w,A),w=u(w,31),w=c(w,_),y=l(y,w),y=u(y,27),y=a(y,b),y=a(c(y,[0,5]),[0,1390208809]),x=c(x,_),x=u(x,33),x=c(x,A),b=l(b,x),b=u(b,31),b=a(b,y),b=a(c(b,[0,5]),[0,944331445]);switch(w=[0,0],x=[0,0],m){case 15:x=l(x,f([0,h[v+14]],48));case 14:x=l(x,f([0,h[v+13]],40));case 13:x=l(x,f([0,h[v+12]],32));case 12:x=l(x,f([0,h[v+11]],24));case 11:x=l(x,f([0,h[v+10]],16));case 10:x=l(x,f([0,h[v+9]],8));case 9:x=l(x,[0,h[v+8]]),x=c(x,_),x=u(x,33),x=c(x,A),b=l(b,x);case 8:w=l(w,f([0,h[v+7]],56));case 7:w=l(w,f([0,h[v+6]],48));case 6:w=l(w,f([0,h[v+5]],40));case 5:w=l(w,f([0,h[v+4]],32));case 4:w=l(w,f([0,h[v+3]],24));case 3:w=l(w,f([0,h[v+2]],16));case 2:w=l(w,f([0,h[v+1]],8));case 1:w=l(w,[0,h[v]]),w=c(w,A),w=u(w,31),w=c(w,_),y=l(y,w)}return y=l(y,[0,h.length]),b=l(b,[0,h.length]),y=a(y,b),b=a(b,y),y=d(y),b=d(b),y=a(y,b),b=a(b,y),("00000000"+(y[0]>>>0).toString(16)).slice(-8)+("00000000"+(y[1]>>>0).toString(16)).slice(-8)+("00000000"+(b[0]>>>0).toString(16)).slice(-8)+("00000000"+(b[1]>>>0).toString(16)).slice(-8)},typeof po<"u"?(typeof Si<"u"&&Si.exports&&(po=Si.exports=e),po.murmurHash3=e):typeof define=="function"&&define.amd?define([],function(){return e}):(e._murmurHash3=r.murmurHash3,e.noConflict=function(){return r.murmurHash3=e._murmurHash3,e._murmurHash3=t,e.noConflict=t,e},r.murmurHash3=e)})(po)});var $d=Qt((E8,Hd)=>{Hd.exports=Vd()});var vp=Qt((i3,xp)=>{function Jt(r,t){typeof t=="boolean"&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(r)),this._timeouts=r,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}xp.exports=Jt;Jt.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};Jt.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};Jt.prototype.retry=function(r){if(this._timeout&&clearTimeout(this._timeout),!r)return!1;var t=new Date().getTime();if(r&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(r),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(r);var e=this._timeouts.shift();if(e===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),e=this._cachedTimeouts.slice(-1);else return!1;var n=this;return this._timer=setTimeout(function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout(function(){n._operationTimeoutCb(n._attempts)},n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)},e),this._options.unref&&this._timer.unref(),!0};Jt.prototype.attempt=function(r,t){this._fn=r,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var e=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){e._operationTimeoutCb()},e._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};Jt.prototype.try=function(r){console.log("Using RetryOperation.try() is deprecated"),this.attempt(r)};Jt.prototype.start=function(r){console.log("Using RetryOperation.start() is deprecated"),this.attempt(r)};Jt.prototype.start=Jt.prototype.try;Jt.prototype.errors=function(){return this._errors};Jt.prototype.attempts=function(){return this._attempts};Jt.prototype.mainError=function(){if(this._errors.length===0)return null;for(var r={},t=null,e=0,n=0;n<this._errors.length;n++){var o=this._errors[n],s=o.message,i=(r[s]||0)+1;r[s]=i,i>=e&&(t=o,e=i)}return t}});var Ep=Qt(Cr=>{var Vw=vp();Cr.operation=function(r){var t=Cr.timeouts(r);return new Vw(t,{forever:r&&(r.forever||r.retries===1/0),unref:r&&r.unref,maxRetryTime:r&&r.maxRetryTime})};Cr.timeouts=function(r){if(r instanceof Array)return[].concat(r);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var e in r)t[e]=r[e];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var n=[],o=0;o<t.retries;o++)n.push(this.createTimeout(o,t));return r&&r.forever&&!n.length&&n.push(this.createTimeout(o,t)),n.sort(function(s,i){return s-i}),n};Cr.createTimeout=function(r,t){var e=t.randomize?Math.random()+1:1,n=Math.round(e*Math.max(t.minTimeout,1)*Math.pow(t.factor,r));return n=Math.min(n,t.maxTimeout),n};Cr.wrap=function(r,t,e){if(t instanceof Array&&(e=t,t=null),!e){e=[];for(var n in r)typeof r[n]=="function"&&e.push(n)}for(var o=0;o<e.length;o++){var s=e[o],i=r[s];r[s]=function(c){var u=Cr.operation(t),f=Array.prototype.slice.call(arguments,1),l=f.pop();f.push(function(d){u.retry(d)||(d&&(arguments[0]=u.mainError()),l.apply(this,arguments))}),u.attempt(function(){c.apply(r,f)})}.bind(r,i),r[s].options=t}}});var Sp=Qt((c3,Ap)=>{Ap.exports=Ep()});var pb={};Rt(pb,{createLibp2p:()=>db});var Ru=Symbol.for("@libp2p/connection");var La=Symbol.for("@libp2p/content-routing");var Na=Symbol.for("@libp2p/peer-discovery");var No=Symbol.for("@libp2p/peer-id");function Po(r){return!!r?.[No]}var Pa=Symbol.for("@libp2p/peer-routing");var Ra="keep-alive";var Eb=Symbol.for("@libp2p/transport");var Oe;(function(r){r[r.FATAL_ALL=0]="FATAL_ALL",r[r.NO_FATAL=1]="NO_FATAL"})(Oe||(Oe={}));var be=class extends Error{static name="AbortError";constructor(t="The operation was aborted"){super(t),this.name="AbortError"}};var D=class extends Error{static name="InvalidParametersError";constructor(t="Invalid parameters"){super(t),this.name="InvalidParametersError"}},Nr=class extends Error{static name="InvalidPublicKeyError";constructor(t="Invalid public key"){super(t),this.name="InvalidPublicKeyError"}},_n=class extends Error{static name="InvalidPrivateKeyError";constructor(t="Invalid private key"){super(t),this.name="InvalidPrivateKeyError"}};var Ro=class extends Error{static name="ConnectionClosingError";constructor(t="The connection is closing"){super(t),this.name="ConnectionClosingError"}},Do=class extends Error{static name="ConnectionClosedError";constructor(t="The connection is closed"){super(t),this.name="ConnectionClosedError"}};var Mo=class extends Error{static name="NotFoundError";constructor(t="Not found"){super(t),this.name="NotFoundError"}},Uo=class extends Error{static name="InvalidPeerIdError";constructor(t="Invalid PeerID"){super(t),this.name="InvalidPeerIdError"}},Pr=class extends Error{static name="InvalidMultiaddrError";constructor(t="Invalid multiaddr"){super(t),this.name="InvalidMultiaddrError"}},Oo=class extends Error{static name="InvalidCIDError";constructor(t="Invalid CID"){super(t),this.name="InvalidCIDError"}},Fo=class extends Error{static name="InvalidMultihashError";constructor(t="Invalid Multihash"){super(t),this.name="InvalidMultihashError"}},Bn=class extends Error{static name="UnsupportedProtocolError";constructor(t="Unsupported protocol error"){super(t),this.name="UnsupportedProtocolError"}},Vo=class extends Error{static name="InvalidMessageError";constructor(t="Invalid message"){super(t),this.name="InvalidMessageError"}};var Rr=class extends Error{static name="TimeoutError";constructor(t="Timed out"){super(t),this.name="TimeoutError"}},xe=class extends Error{static name="NotStartedError";constructor(t="Not started"){super(t),this.name="NotStartedError"}};var Dr=class extends Error{static name="DialError";constructor(t="Dial error"){super(t),this.name="DialError"}};var Mr=class extends Error{static name="LimitedConnectionError";constructor(t="Limited connection"){super(t),this.name="LimitedConnectionError"}},Ho=class extends Error{static name="TooManyInboundProtocolStreamsError";constructor(t="Too many inbound protocol streams"){super(t),this.name="TooManyInboundProtocolStreamsError"}},$o=class extends Error{static name="TooManyOutboundProtocolStreamsError";constructor(t="Too many outbound protocol streams"){super(t),this.name="TooManyOutboundProtocolStreamsError"}},Fe=class extends Error{static name="UnsupportedKeyTypeError";constructor(t="Unsupported key type"){super(t),this.name="UnsupportedKeyTypeError"}};var tt=(r,...t)=>{try{[...t]}catch{}};var ve=class extends EventTarget{#t=new Map;constructor(){super(),tt(1/0,this)}listenerCount(t){let e=this.#t.get(t);return e==null?0:e.length}addEventListener(t,e,n){super.addEventListener(t,e,n);let o=this.#t.get(t);o==null&&(o=[],this.#t.set(t,o)),o.push({callback:e,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(t,e,n){super.removeEventListener(t.toString(),e??null,n);let o=this.#t.get(t);o!=null&&(o=o.filter(({callback:s})=>s!==e),this.#t.set(t,o))}dispatchEvent(t){let e=super.dispatchEvent(t),n=this.#t.get(t.type);return n==null||(n=n.filter(({once:o})=>!o),this.#t.set(t.type,n)),e}safeDispatchEvent(t,e={}){return this.dispatchEvent(new CustomEvent(t,e))}};function Ko(r){return r!=null&&typeof r.start=="function"&&typeof r.stop=="function"}async function Du(...r){let t=[];for(let e of r)Ko(e)&&t.push(e);await Promise.all(t.map(async e=>{e.beforeStart!=null&&await e.beforeStart()})),await Promise.all(t.map(async e=>{await e.start()})),await Promise.all(t.map(async e=>{e.afterStart!=null&&await e.afterStart()}))}async function Mu(...r){let t=[];for(let e of r)Ko(e)&&t.push(e);await Promise.all(t.map(async e=>{e.beforeStop!=null&&await e.beforeStop()})),await Promise.all(t.map(async e=>{await e.stop()})),await Promise.all(t.map(async e=>{e.afterStop!=null&&await e.afterStop()}))}var In=Symbol.for("@libp2p/service-capabilities"),Da=Symbol.for("@libp2p/service-dependencies");var Va={};Rt(Va,{base58btc:()=>W,base58flickr:()=>em});var Jb=new Uint8Array(0);function Uu(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}function Ee(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 Ou(r){return new TextEncoder().encode(r)}function Fu(r){return new TextDecoder().decode(r)}function Xp(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var o=0;o<r.length;o++){var s=r.charAt(o),i=s.charCodeAt(0);if(e[i]!==255)throw new TypeError(s+" is ambiguous");e[i]=o}var a=r.length,c=r.charAt(0),u=Math.log(a)/Math.log(256),f=Math.log(256)/Math.log(a);function l(p){if(p instanceof Uint8Array||(ArrayBuffer.isView(p)?p=new Uint8Array(p.buffer,p.byteOffset,p.byteLength):Array.isArray(p)&&(p=Uint8Array.from(p))),!(p instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(p.length===0)return"";for(var m=0,g=0,y=0,b=p.length;y!==b&&p[y]===0;)y++,m++;for(var w=(b-y)*f+1>>>0,x=new Uint8Array(w);y!==b;){for(var A=p[y],_=0,v=w-1;(A!==0||_<g)&&v!==-1;v--,_++)A+=256*x[v]>>>0,x[v]=A%a>>>0,A=A/a>>>0;if(A!==0)throw new Error("Non-zero carry");g=_,y++}for(var B=w-g;B!==w&&x[B]===0;)B++;for(var T=c.repeat(m);B<w;++B)T+=r.charAt(x[B]);return T}function d(p){if(typeof p!="string")throw new TypeError("Expected String");if(p.length===0)return new Uint8Array;var m=0;if(p[m]!==" "){for(var g=0,y=0;p[m]===c;)g++,m++;for(var b=(p.length-m)*u+1>>>0,w=new Uint8Array(b);p[m];){var x=e[p.charCodeAt(m)];if(x===255)return;for(var A=0,_=b-1;(x!==0||A<y)&&_!==-1;_--,A++)x+=a*w[_]>>>0,w[_]=x%256>>>0,x=x/256>>>0;if(x!==0)throw new Error("Non-zero carry");y=A,m++}if(p[m]!==" "){for(var v=b-y;v!==b&&w[v]===0;)v++;for(var B=new Uint8Array(g+(b-v)),T=g;v!==b;)B[T++]=w[v++];return B}}}function h(p){var m=d(p);if(m)return m;throw new Error(`Non-${t} character`)}return{encode:l,decodeUnsafe:d,decode:h}}var Yp=Xp,Jp=Yp,Hu=Jp;var Ma=class{name;prefix;baseEncode;constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},Ua=class{name;prefix;baseDecode;prefixCodePoint;constructor(t,e,n){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return $u(this,t)}},Oa=class{decoders;constructor(t){this.decoders=t}or(t){return $u(this,t)}decode(t){let e=t[0],n=this.decoders[e];if(n!=null)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function $u(r,t){return new Oa({...r.decoders??{[r.prefix]:r},...t.decoders??{[t.prefix]:t}})}var Fa=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(t,e,n,o){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=o,this.encoder=new Ma(t,e,n),this.decoder=new Ua(t,e,o)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};function Ur({name:r,prefix:t,encode:e,decode:n}){return new Fa(r,t,e,n)}function Ve({name:r,prefix:t,alphabet:e}){let{encode:n,decode:o}=Hu(e,r);return Ur({prefix:t,name:r,encode:n,decode:s=>Ee(o(s))})}function Qp(r,t,e,n){let o={};for(let f=0;f<t.length;++f)o[t[f]]=f;let s=r.length;for(;r[s-1]==="=";)--s;let i=new Uint8Array(s*e/8|0),a=0,c=0,u=0;for(let f=0;f<s;++f){let l=o[r[f]];if(l===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<e|l,a+=e,a>=8&&(a-=8,i[u++]=255&c>>a)}if(a>=e||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return i}function tm(r,t,e){let n=t[t.length-1]==="=",o=(1<<e)-1,s="",i=0,a=0;for(let c=0;c<r.length;++c)for(a=a<<8|r[c],i+=8;i>e;)i-=e,s+=t[o&a>>i];if(i!==0&&(s+=t[o&a<<e-i]),n)for(;s.length*e&7;)s+="=";return s}function st({name:r,prefix:t,bitsPerChar:e,alphabet:n}){return Ur({prefix:t,name:r,encode(o){return tm(o,n,e)},decode(o){return Qp(o,n,e,r)}})}var W=Ve({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),em=Ve({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Ha={};Rt(Ha,{base32:()=>zt,base32hex:()=>sm,base32hexpad:()=>am,base32hexpadupper:()=>cm,base32hexupper:()=>im,base32pad:()=>nm,base32padupper:()=>om,base32upper:()=>rm,base32z:()=>lm});var zt=st({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),rm=st({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),nm=st({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),om=st({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),sm=st({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),im=st({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),am=st({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),cm=st({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),lm=st({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var um=zu,Ku=128,fm=127,hm=~fm,dm=Math.pow(2,31);function zu(r,t,e){t=t||[],e=e||0;for(var n=e;r>=dm;)t[e++]=r&255|Ku,r/=128;for(;r&hm;)t[e++]=r&255|Ku,r>>>=7;return t[e]=r|0,zu.bytes=e-n+1,t}var pm=$a,mm=128,qu=127;function $a(r,n){var e=0,n=n||0,o=0,s=n,i,a=r.length;do{if(s>=a)throw $a.bytes=0,new RangeError("Could not decode varint");i=r[s++],e+=o<28?(i&qu)<<o:(i&qu)*Math.pow(2,o),o+=7}while(i>=mm);return $a.bytes=s-n,e}var gm=Math.pow(2,7),ym=Math.pow(2,14),wm=Math.pow(2,21),bm=Math.pow(2,28),xm=Math.pow(2,35),vm=Math.pow(2,42),Em=Math.pow(2,49),Am=Math.pow(2,56),Sm=Math.pow(2,63),_m=function(r){return r<gm?1:r<ym?2:r<wm?3:r<bm?4:r<xm?5:r<vm?6:r<Em?7:r<Am?8:r<Sm?9:10},Bm={encode:um,decode:pm,encodingLength:_m},Im=Bm,kn=Im;function Cn(r,t=0){return[kn.decode(r,t),kn.decode.bytes]}function Or(r,t,e=0){return kn.encode(r,t,e),t}function Fr(r){return kn.encodingLength(r)}function te(r,t){let e=t.byteLength,n=Fr(r),o=n+Fr(e),s=new Uint8Array(o+e);return Or(r,s,0),Or(e,s,n),s.set(t,o),new Vr(r,e,t,s)}function ee(r){let t=Ee(r),[e,n]=Cn(t),[o,s]=Cn(t.subarray(n)),i=t.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new Vr(e,o,i,t)}function Gu(r,t){if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&Uu(r.bytes,e.bytes)}}var Vr=class{code;size;digest;bytes;constructor(t,e,n,o){this.code=t,this.size=e,this.digest=n,this.bytes=o}};function Wu(r,t){let{bytes:e,version:n}=r;switch(n){case 0:return Cm(e,Ka(r),t??W.encoder);default:return Tm(e,Ka(r),t??zt.encoder)}}var ju=new WeakMap;function Ka(r){let t=ju.get(r);if(t==null){let e=new Map;return ju.set(r,e),e}return t}var pt=class r{code;version;multihash;bytes;"/";constructor(t,e,n,o){this.code=e,this.version=t,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:e}=this;if(t!==Tn)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==Lm)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(e)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:e}=this.multihash,n=te(t,e);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return r.equals(this,t)}static equals(t,e){let n=e;return n!=null&&t.code===n.code&&t.version===n.version&&Gu(t.multihash,n.multihash)}toString(t){return Wu(this,t)}toJSON(){return{"/":Wu(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let e=t;if(e instanceof r)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:n,code:o,multihash:s,bytes:i}=e;return new r(n,o,s,i??Zu(n,o,s.bytes))}else if(e[Nm]===!0){let{version:n,multihash:o,code:s}=e,i=ee(o);return r.create(n,s,i)}else return null}static create(t,e,n){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==Tn)throw new Error(`Version 0 CID must use dag-pb (code: ${Tn}) block encoding`);return new r(t,e,n,n.bytes)}case 1:{let o=Zu(t,e,n.bytes);return new r(t,e,n,o)}default:throw new Error("Invalid version")}}static createV0(t){return r.create(0,Tn,t)}static createV1(t,e){return r.create(1,t,e)}static decode(t){let[e,n]=r.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=r.inspectBytes(t),n=e.size-e.multihashSize,o=Ee(t.subarray(n,n+e.multihashSize));if(o.byteLength!==e.multihashSize)throw new Error("Incorrect length");let s=o.subarray(e.multihashSize-e.digestSize),i=new Vr(e.multihashCode,e.digestSize,s,o);return[e.version===0?r.createV0(i):r.createV1(e.codec,i),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[l,d]=Cn(t.subarray(e));return e+=d,l},o=n(),s=Tn;if(o===18?(o=0,e=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=e,a=n(),c=n(),u=e+c,f=u-i;return{version:o,codec:s,multihashCode:a,digestSize:c,multihashSize:f,size:u}}static parse(t,e){let[n,o]=km(t,e),s=r.decode(o);if(s.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Ka(s).set(n,t),s}};function km(r,t){switch(r[0]){case"Q":{let e=t??W;return[W.prefix,e.decode(`${W.prefix}${r}`)]}case W.prefix:{let e=t??W;return[W.prefix,e.decode(r)]}case zt.prefix:{let e=t??zt;return[zt.prefix,e.decode(r)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],t.decode(r)]}}}function Cm(r,t,e){let{prefix:n}=e;if(n!==W.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let o=t.get(n);if(o==null){let s=e.encode(r).slice(1);return t.set(n,s),s}else return o}function Tm(r,t,e){let{prefix:n}=e,o=t.get(n);if(o==null){let s=e.encode(r);return t.set(n,s),s}else return o}var Tn=112,Lm=18;function Zu(r,t,e){let n=Fr(r),o=n+Fr(t),s=new Uint8Array(o+e.byteLength);return Or(r,s,0),Or(t,s,n),s.set(e,o),s}var Nm=Symbol.for("@ipld/js-cid/CID");var qa={};Rt(qa,{identity:()=>Se});var Xu=0,Pm="identity",Yu=Ee;function Rm(r){return te(Xu,Yu(r))}var Se={code:Xu,name:Pm,encode:Yu,digest:Rm};function it(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}function Ju(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`positive integer expected, not ${r}`)}function Dm(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function Hr(r,...t){if(!Dm(r))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(r.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${r.length}`)}function Qu(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Ju(r.outputLen),Ju(r.blockLen)}function $r(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function tf(r,t){Hr(r);let e=t.outputLen;if(r.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}var ir=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var zo=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),re=(r,t)=>r<<32-t|r>>>t;var bx=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function ef(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function Ln(r){return typeof r=="string"&&(r=ef(r)),Hr(r),r}function za(...r){let t=0;for(let n=0;n<r.length;n++){let o=r[n];Hr(o),t+=o.length}let e=new Uint8Array(t);for(let n=0,o=0;n<r.length;n++){let s=r[n];e.set(s,o),o+=s.length}return e}var Kr=class{clone(){return this._cloneInto()}},xx={}.toString;function Go(r){let t=n=>r().update(Ln(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function qr(r=32){if(ir&&typeof ir.getRandomValues=="function")return ir.getRandomValues(new Uint8Array(r));if(ir&&typeof ir.randomBytes=="function")return ir.randomBytes(r);throw new Error("crypto.getRandomValues must be defined")}function Mm(r,t,e,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(t,e,n);let o=BigInt(32),s=BigInt(4294967295),i=Number(e>>o&s),a=Number(e&s),c=n?4:0,u=n?0:4;r.setUint32(t+c,i,n),r.setUint32(t+u,a,n)}var rf=(r,t,e)=>r&t^~r&e,nf=(r,t,e)=>r&t^r&e^t&e,zr=class extends Kr{constructor(t,e,n,o){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=zo(this.buffer)}update(t){$r(this);let{view:e,buffer:n,blockLen:o}=this;t=Ln(t);let s=t.length;for(let i=0;i<s;){let a=Math.min(o-this.pos,s-i);if(a===o){let c=zo(t);for(;o<=s-i;i+=o)this.process(c,i);continue}n.set(t.subarray(i,i+a),this.pos),this.pos+=a,i+=a,this.pos===o&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){$r(this),tf(t,this),this.finished=!0;let{buffer:e,view:n,blockLen:o,isLE:s}=this,{pos:i}=this;e[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>o-i&&(this.process(n,0),i=0);for(let l=i;l<o;l++)e[l]=0;Mm(n,o-8,BigInt(this.length*8),s),this.process(n,0);let a=zo(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let u=c/4,f=this.get();if(u>f.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<u;l++)a.setUint32(4*l,f[l],s)}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:e,buffer:n,length:o,finished:s,destroyed:i,pos:a}=this;return t.length=o,t.pos=a,t.finished=s,t.destroyed=i,o%e&&t.buffer.set(n),t}};var Wo=BigInt(4294967295),Ga=BigInt(32);function of(r,t=!1){return t?{h:Number(r&Wo),l:Number(r>>Ga&Wo)}:{h:Number(r>>Ga&Wo)|0,l:Number(r&Wo)|0}}function Um(r,t=!1){let e=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let o=0;o<r.length;o++){let{h:s,l:i}=of(r[o],t);[e[o],n[o]]=[s,i]}return[e,n]}var Om=(r,t)=>BigInt(r>>>0)<<Ga|BigInt(t>>>0),Fm=(r,t,e)=>r>>>e,Vm=(r,t,e)=>r<<32-e|t>>>e,Hm=(r,t,e)=>r>>>e|t<<32-e,$m=(r,t,e)=>r<<32-e|t>>>e,Km=(r,t,e)=>r<<64-e|t>>>e-32,qm=(r,t,e)=>r>>>e-32|t<<64-e,zm=(r,t)=>t,Gm=(r,t)=>r,Wm=(r,t,e)=>r<<e|t>>>32-e,jm=(r,t,e)=>t<<e|r>>>32-e,Zm=(r,t,e)=>t<<e-32|r>>>64-e,Xm=(r,t,e)=>r<<e-32|t>>>64-e;function Ym(r,t,e,n){let o=(t>>>0)+(n>>>0);return{h:r+e+(o/2**32|0)|0,l:o|0}}var Jm=(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),Qm=(r,t,e,n)=>t+e+n+(r/2**32|0)|0,tg=(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),eg=(r,t,e,n,o)=>t+e+n+o+(r/2**32|0)|0,rg=(r,t,e,n,o)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(o>>>0),ng=(r,t,e,n,o,s)=>t+e+n+o+s+(r/2**32|0)|0;var og={fromBig:of,split:Um,toBig:Om,shrSH:Fm,shrSL:Vm,rotrSH:Hm,rotrSL:$m,rotrBH:Km,rotrBL:qm,rotr32H:zm,rotr32L:Gm,rotlSH:Wm,rotlSL:jm,rotlBH:Zm,rotlBL:Xm,add:Ym,add3L:Jm,add3H:Qm,add4L:tg,add4H:eg,add5H:ng,add5L:rg},O=og;var[sg,ig]=O.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))),He=new Uint32Array(80),$e=new Uint32Array(80),Wa=class extends zr{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:t,Al:e,Bh:n,Bl:o,Ch:s,Cl:i,Dh:a,Dl:c,Eh:u,El:f,Fh:l,Fl:d,Gh:h,Gl:p,Hh:m,Hl:g}=this;return[t,e,n,o,s,i,a,c,u,f,l,d,h,p,m,g]}set(t,e,n,o,s,i,a,c,u,f,l,d,h,p,m,g){this.Ah=t|0,this.Al=e|0,this.Bh=n|0,this.Bl=o|0,this.Ch=s|0,this.Cl=i|0,this.Dh=a|0,this.Dl=c|0,this.Eh=u|0,this.El=f|0,this.Fh=l|0,this.Fl=d|0,this.Gh=h|0,this.Gl=p|0,this.Hh=m|0,this.Hl=g|0}process(t,e){for(let w=0;w<16;w++,e+=4)He[w]=t.getUint32(e),$e[w]=t.getUint32(e+=4);for(let w=16;w<80;w++){let x=He[w-15]|0,A=$e[w-15]|0,_=O.rotrSH(x,A,1)^O.rotrSH(x,A,8)^O.shrSH(x,A,7),v=O.rotrSL(x,A,1)^O.rotrSL(x,A,8)^O.shrSL(x,A,7),B=He[w-2]|0,T=$e[w-2]|0,et=O.rotrSH(B,T,19)^O.rotrBH(B,T,61)^O.shrSH(B,T,6),V=O.rotrSL(B,T,19)^O.rotrBL(B,T,61)^O.shrSL(B,T,6),F=O.add4L(v,V,$e[w-7],$e[w-16]),R=O.add4H(F,_,et,He[w-7],He[w-16]);He[w]=R|0,$e[w]=F|0}let{Ah:n,Al:o,Bh:s,Bl:i,Ch:a,Cl:c,Dh:u,Dl:f,Eh:l,El:d,Fh:h,Fl:p,Gh:m,Gl:g,Hh:y,Hl:b}=this;for(let w=0;w<80;w++){let x=O.rotrSH(l,d,14)^O.rotrSH(l,d,18)^O.rotrBH(l,d,41),A=O.rotrSL(l,d,14)^O.rotrSL(l,d,18)^O.rotrBL(l,d,41),_=l&h^~l&m,v=d&p^~d&g,B=O.add5L(b,A,v,ig[w],$e[w]),T=O.add5H(B,y,x,_,sg[w],He[w]),et=B|0,V=O.rotrSH(n,o,28)^O.rotrBH(n,o,34)^O.rotrBH(n,o,39),F=O.rotrSL(n,o,28)^O.rotrBL(n,o,34)^O.rotrBL(n,o,39),R=n&s^n&a^s&a,k=o&i^o&c^i&c;y=m|0,b=g|0,m=h|0,g=p|0,h=l|0,p=d|0,{h:l,l:d}=O.add(u|0,f|0,T|0,et|0),u=a|0,f=c|0,a=s|0,c=i|0,s=n|0,i=o|0;let L=O.add3L(et,F,k);n=O.add3H(L,T,V,R),o=L|0}({h:n,l:o}=O.add(this.Ah|0,this.Al|0,n|0,o|0)),{h:s,l:i}=O.add(this.Bh|0,this.Bl|0,s|0,i|0),{h:a,l:c}=O.add(this.Ch|0,this.Cl|0,a|0,c|0),{h:u,l:f}=O.add(this.Dh|0,this.Dl|0,u|0,f|0),{h:l,l:d}=O.add(this.Eh|0,this.El|0,l|0,d|0),{h,l:p}=O.add(this.Fh|0,this.Fl|0,h|0,p|0),{h:m,l:g}=O.add(this.Gh|0,this.Gl|0,m|0,g|0),{h:y,l:b}=O.add(this.Hh|0,this.Hl|0,y|0,b|0),this.set(n,o,s,i,a,c,u,f,l,d,h,p,m,g,y,b)}roundClean(){He.fill(0),$e.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 sf=Go(()=>new Wa);var Zo={};Rt(Zo,{aInRange:()=>$t,abool:()=>ne,abytes:()=>Gr,bitGet:()=>hg,bitLen:()=>Ja,bitMask:()=>Pn,bitSet:()=>dg,bytesToHex:()=>Be,bytesToNumberBE:()=>Ie,bytesToNumberLE:()=>qe,concatBytes:()=>ke,createHmacDrbg:()=>Qa,ensureBytes:()=>at,equalBytes:()=>ug,hexToBytes:()=>cr,hexToNumber:()=>Ya,inRange:()=>Nn,isBytes:()=>Ke,memoized:()=>ur,notImplemented:()=>mg,numberToBytesBE:()=>ze,numberToBytesLE:()=>lr,numberToHexUnpadded:()=>ar,numberToVarBytesBE:()=>lg,utf8ToBytes:()=>fg,validateObject:()=>ue});var Xa=BigInt(0),jo=BigInt(1),ag=BigInt(2);function Ke(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function Gr(r){if(!Ke(r))throw new Error("Uint8Array expected")}function ne(r,t){if(typeof t!="boolean")throw new Error(`${r} must be valid boolean, got "${t}".`)}var cg=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function Be(r){Gr(r);let t="";for(let e=0;e<r.length;e++)t+=cg[r[e]];return t}function ar(r){let t=r.toString(16);return t.length&1?`0${t}`:t}function Ya(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);return BigInt(r===""?"0":`0x${r}`)}var _e={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function af(r){if(r>=_e._0&&r<=_e._9)return r-_e._0;if(r>=_e._A&&r<=_e._F)return r-(_e._A-10);if(r>=_e._a&&r<=_e._f)return r-(_e._a-10)}function cr(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let t=r.length,e=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(e);for(let o=0,s=0;o<e;o++,s+=2){let i=af(r.charCodeAt(s)),a=af(r.charCodeAt(s+1));if(i===void 0||a===void 0){let c=r[s]+r[s+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+s)}n[o]=i*16+a}return n}function Ie(r){return Ya(Be(r))}function qe(r){return Gr(r),Ya(Be(Uint8Array.from(r).reverse()))}function ze(r,t){return cr(r.toString(16).padStart(t*2,"0"))}function lr(r,t){return ze(r,t).reverse()}function lg(r){return cr(ar(r))}function at(r,t,e){let n;if(typeof t=="string")try{n=cr(t)}catch(s){throw new Error(`${r} must be valid hex string, got "${t}". Cause: ${s}`)}else if(Ke(t))n=Uint8Array.from(t);else throw new Error(`${r} must be hex string or Uint8Array`);let o=n.length;if(typeof e=="number"&&o!==e)throw new Error(`${r} expected ${e} bytes, got ${o}`);return n}function ke(...r){let t=0;for(let n=0;n<r.length;n++){let o=r[n];Gr(o),t+=o.length}let e=new Uint8Array(t);for(let n=0,o=0;n<r.length;n++){let s=r[n];e.set(s,o),o+=s.length}return e}function ug(r,t){if(r.length!==t.length)return!1;let e=0;for(let n=0;n<r.length;n++)e|=r[n]^t[n];return e===0}function fg(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}var ja=r=>typeof r=="bigint"&&Xa<=r;function Nn(r,t,e){return ja(r)&&ja(t)&&ja(e)&&t<=r&&r<e}function $t(r,t,e,n){if(!Nn(t,e,n))throw new Error(`expected valid ${r}: ${e} <= n < ${n}, got ${typeof t} ${t}`)}function Ja(r){let t;for(t=0;r>Xa;r>>=jo,t+=1);return t}function hg(r,t){return r>>BigInt(t)&jo}function dg(r,t,e){return r|(e?jo:Xa)<<BigInt(t)}var Pn=r=>(ag<<BigInt(r-1))-jo,Za=r=>new Uint8Array(r),cf=r=>Uint8Array.from(r);function Qa(r,t,e){if(typeof r!="number"||r<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");let n=Za(r),o=Za(r),s=0,i=()=>{n.fill(1),o.fill(0),s=0},a=(...l)=>e(o,n,...l),c=(l=Za())=>{o=a(cf([0]),l),n=a(),l.length!==0&&(o=a(cf([1]),l),n=a())},u=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let l=0,d=[];for(;l<t;){n=a();let h=n.slice();d.push(h),l+=n.length}return ke(...d)};return(l,d)=>{i(),c(l);let h;for(;!(h=d(u()));)c();return i(),h}}var pg={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"||Ke(r),isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,t)=>t.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function ue(r,t,e={}){let n=(o,s,i)=>{let a=pg[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);let c=r[o];if(!(i&&c===void 0)&&!a(c,r))throw new Error(`Invalid param ${String(o)}=${c} (${typeof c}), expected ${s}`)};for(let[o,s]of Object.entries(t))n(o,s,!1);for(let[o,s]of Object.entries(e))n(o,s,!0);return r}var mg=()=>{throw new Error("not implemented")};function ur(r){let t=new WeakMap;return(e,...n)=>{let o=t.get(e);if(o!==void 0)return o;let s=r(e,...n);return t.set(e,s),s}}var mt=BigInt(0),rt=BigInt(1),fr=BigInt(2),gg=BigInt(3),tc=BigInt(4),lf=BigInt(5),uf=BigInt(8),yg=BigInt(9),wg=BigInt(16);function Y(r,t){let e=r%t;return e>=mt?e:t+e}function bg(r,t,e){if(e<=mt||t<mt)throw new Error("Expected power/modulo > 0");if(e===rt)return mt;let n=rt;for(;t>mt;)t&rt&&(n=n*r%e),r=r*r%e,t>>=rt;return n}function nt(r,t,e){let n=r;for(;t-- >mt;)n*=n,n%=e;return n}function Xo(r,t){if(r===mt||t<=mt)throw new Error(`invert: expected positive integers, got n=${r} mod=${t}`);let e=Y(r,t),n=t,o=mt,s=rt,i=rt,a=mt;for(;e!==mt;){let u=n/e,f=n%e,l=o-i*u,d=s-a*u;n=e,e=f,o=i,s=a,i=l,a=d}if(n!==rt)throw new Error("invert: does not exist");return Y(o,t)}function xg(r){let t=(r-rt)/fr,e,n,o;for(e=r-rt,n=0;e%fr===mt;e/=fr,n++);for(o=fr;o<r&&bg(o,t,r)!==r-rt;o++);if(n===1){let i=(r+rt)/tc;return function(c,u){let f=c.pow(u,i);if(!c.eql(c.sqr(f),u))throw new Error("Cannot find square root");return f}}let s=(e+rt)/fr;return function(a,c){if(a.pow(c,t)===a.neg(a.ONE))throw new Error("Cannot find square root");let u=n,f=a.pow(a.mul(a.ONE,o),e),l=a.pow(c,s),d=a.pow(c,e);for(;!a.eql(d,a.ONE);){if(a.eql(d,a.ZERO))return a.ZERO;let h=1;for(let m=a.sqr(d);h<u&&!a.eql(m,a.ONE);h++)m=a.sqr(m);let p=a.pow(f,rt<<BigInt(u-h-1));f=a.sqr(p),l=a.mul(l,p),d=a.mul(d,f),u=h}return l}}function vg(r){if(r%tc===gg){let t=(r+rt)/tc;return function(n,o){let s=n.pow(o,t);if(!n.eql(n.sqr(s),o))throw new Error("Cannot find square root");return s}}if(r%uf===lf){let t=(r-lf)/uf;return function(n,o){let s=n.mul(o,fr),i=n.pow(s,t),a=n.mul(o,i),c=n.mul(n.mul(a,fr),i),u=n.mul(a,n.sub(c,n.ONE));if(!n.eql(n.sqr(u),o))throw new Error("Cannot find square root");return u}}return r%wg,xg(r)}var ff=(r,t)=>(Y(r,t)&rt)===rt,Eg=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function ec(r){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},e=Eg.reduce((n,o)=>(n[o]="function",n),t);return ue(r,e)}function Ag(r,t,e){if(e<mt)throw new Error("Expected power > 0");if(e===mt)return r.ONE;if(e===rt)return t;let n=r.ONE,o=t;for(;e>mt;)e&rt&&(n=r.mul(n,o)),o=r.sqr(o),e>>=rt;return n}function Sg(r,t){let e=new Array(t.length),n=t.reduce((s,i,a)=>r.is0(i)?s:(e[a]=s,r.mul(s,i)),r.ONE),o=r.inv(n);return t.reduceRight((s,i,a)=>r.is0(i)?s:(e[a]=r.mul(s,e[a]),r.mul(s,i)),o),e}function rc(r,t){let e=t!==void 0?t:r.toString(2).length,n=Math.ceil(e/8);return{nBitLength:e,nByteLength:n}}function Ge(r,t,e=!1,n={}){if(r<=mt)throw new Error(`Expected Field ORDER > 0, got ${r}`);let{nBitLength:o,nByteLength:s}=rc(r,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");let i=vg(r),a=Object.freeze({ORDER:r,BITS:o,BYTES:s,MASK:Pn(o),ZERO:mt,ONE:rt,create:c=>Y(c,r),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return mt<=c&&c<r},is0:c=>c===mt,isOdd:c=>(c&rt)===rt,neg:c=>Y(-c,r),eql:(c,u)=>c===u,sqr:c=>Y(c*c,r),add:(c,u)=>Y(c+u,r),sub:(c,u)=>Y(c-u,r),mul:(c,u)=>Y(c*u,r),pow:(c,u)=>Ag(a,c,u),div:(c,u)=>Y(c*Xo(u,r),r),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>Xo(c,r),sqrt:n.sqrt||(c=>i(a,c)),invertBatch:c=>Sg(a,c),cmov:(c,u,f)=>f?u:c,toBytes:c=>e?lr(c,s):ze(c,s),fromBytes:c=>{if(c.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${c.length}`);return e?qe(c):Ie(c)}});return Object.freeze(a)}function hf(r){if(typeof r!="bigint")throw new Error("field order must be bigint");let t=r.toString(2).length;return Math.ceil(t/8)}function nc(r){let t=hf(r);return t+Math.ceil(t/2)}function df(r,t,e=!1){let n=r.length,o=hf(t),s=nc(t);if(n<16||n<s||n>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);let i=e?Ie(r):qe(r),a=Y(i,t-rt)+rt;return e?lr(a,o):ze(a,o)}var Bg=BigInt(0),oc=BigInt(1),sc=new WeakMap,pf=new WeakMap;function Yo(r,t){let e=(s,i)=>{let a=i.negate();return s?a:i},n=s=>{if(!Number.isSafeInteger(s)||s<=0||s>t)throw new Error(`Wrong window size=${s}, should be [1..${t}]`)},o=s=>{n(s);let i=Math.ceil(t/s)+1,a=2**(s-1);return{windows:i,windowSize:a}};return{constTimeNegate:e,unsafeLadder(s,i){let a=r.ZERO,c=s;for(;i>Bg;)i&oc&&(a=a.add(c)),c=c.double(),i>>=oc;return a},precomputeWindow(s,i){let{windows:a,windowSize:c}=o(i),u=[],f=s,l=f;for(let d=0;d<a;d++){l=f,u.push(l);for(let h=1;h<c;h++)l=l.add(f),u.push(l);f=l.double()}return u},wNAF(s,i,a){let{windows:c,windowSize:u}=o(s),f=r.ZERO,l=r.BASE,d=BigInt(2**s-1),h=2**s,p=BigInt(s);for(let m=0;m<c;m++){let g=m*u,y=Number(a&d);a>>=p,y>u&&(y-=h,a+=oc);let b=g,w=g+Math.abs(y)-1,x=m%2!==0,A=y<0;y===0?l=l.add(e(x,i[b])):f=f.add(e(A,i[w]))}return{p:f,f:l}},wNAFCached(s,i,a){let c=pf.get(s)||1,u=sc.get(s);return u||(u=this.precomputeWindow(s,c),c!==1&&sc.set(s,a(u))),this.wNAF(c,u,i)},setWindowSize(s,i){n(i),pf.set(s,i),sc.delete(s)}}}function Jo(r,t,e,n){if(!Array.isArray(e)||!Array.isArray(n)||n.length!==e.length)throw new Error("arrays of points and scalars must have equal length");n.forEach((f,l)=>{if(!t.isValid(f))throw new Error(`wrong scalar at index ${l}`)}),e.forEach((f,l)=>{if(!(f instanceof r))throw new Error(`wrong point at index ${l}`)});let o=Ja(BigInt(e.length)),s=o>12?o-3:o>4?o-2:o?2:1,i=(1<<s)-1,a=new Array(i+1).fill(r.ZERO),c=Math.floor((t.BITS-1)/s)*s,u=r.ZERO;for(let f=c;f>=0;f-=s){a.fill(r.ZERO);for(let d=0;d<n.length;d++){let h=n[d],p=Number(h>>BigInt(f)&BigInt(i));a[p]=a[p].add(e[d])}let l=r.ZERO;for(let d=a.length-1,h=r.ZERO;d>0;d--)h=h.add(a[d]),l=l.add(h);if(u=u.add(l),f!==0)for(let d=0;d<s;d++)u=u.double()}return u}function Rn(r){return ec(r.Fp),ue(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...rc(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}var oe=BigInt(0),Kt=BigInt(1),Qo=BigInt(2),Ig=BigInt(8),kg={zip215:!0};function Cg(r){let t=Rn(r);return ue(r,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}function mf(r){let t=Cg(r),{Fp:e,n,prehash:o,hash:s,randomBytes:i,nByteLength:a,h:c}=t,u=Qo<<BigInt(a*8)-Kt,f=e.create,l=Ge(t.n,t.nBitLength),d=t.uvRatio||((S,E)=>{try{return{isValid:!0,value:e.sqrt(S*e.inv(E))}}catch{return{isValid:!1,value:oe}}}),h=t.adjustScalarBytes||(S=>S),p=t.domain||((S,E,I)=>{if(ne("phflag",I),E.length||I)throw new Error("Contexts/pre-hash are not supported");return S});function m(S,E){$t("coordinate "+S,E,oe,u)}function g(S){if(!(S instanceof w))throw new Error("ExtendedPoint expected")}let y=ur((S,E)=>{let{ex:I,ey:N,ez:M}=S,U=S.is0();E==null&&(E=U?Ig:e.inv(M));let $=f(I*E),z=f(N*E),K=f(M*E);if(U)return{x:oe,y:Kt};if(K!==Kt)throw new Error("invZ was invalid");return{x:$,y:z}}),b=ur(S=>{let{a:E,d:I}=t;if(S.is0())throw new Error("bad point: ZERO");let{ex:N,ey:M,ez:U,et:$}=S,z=f(N*N),K=f(M*M),X=f(U*U),Q=f(X*X),bt=f(z*E),xt=f(X*f(bt+K)),Et=f(Q+f(I*f(z*K)));if(xt!==Et)throw new Error("bad point: equation left != right (1)");let Pt=f(N*M),dt=f(U*$);if(Pt!==dt)throw new Error("bad point: equation left != right (2)");return!0});class w{constructor(E,I,N,M){this.ex=E,this.ey=I,this.ez=N,this.et=M,m("x",E),m("y",I),m("z",N),m("t",M),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(E){if(E instanceof w)throw new Error("extended point not allowed");let{x:I,y:N}=E||{};return m("x",I),m("y",N),new w(I,N,Kt,f(I*N))}static normalizeZ(E){let I=e.invertBatch(E.map(N=>N.ez));return E.map((N,M)=>N.toAffine(I[M])).map(w.fromAffine)}static msm(E,I){return Jo(w,l,E,I)}_setWindowSize(E){_.setWindowSize(this,E)}assertValidity(){b(this)}equals(E){g(E);let{ex:I,ey:N,ez:M}=this,{ex:U,ey:$,ez:z}=E,K=f(I*z),X=f(U*M),Q=f(N*z),bt=f($*M);return K===X&&Q===bt}is0(){return this.equals(w.ZERO)}negate(){return new w(f(-this.ex),this.ey,this.ez,f(-this.et))}double(){let{a:E}=t,{ex:I,ey:N,ez:M}=this,U=f(I*I),$=f(N*N),z=f(Qo*f(M*M)),K=f(E*U),X=I+N,Q=f(f(X*X)-U-$),bt=K+$,xt=bt-z,Et=K-$,Pt=f(Q*xt),dt=f(bt*Et),Ht=f(Q*Et),we=f(xt*bt);return new w(Pt,dt,we,Ht)}add(E){g(E);let{a:I,d:N}=t,{ex:M,ey:U,ez:$,et:z}=this,{ex:K,ey:X,ez:Q,et:bt}=E;if(I===BigInt(-1)){let Bu=f((U-M)*(X+K)),Iu=f((U+M)*(X-K)),Ta=f(Iu-Bu);if(Ta===oe)return this.double();let ku=f($*Qo*bt),Cu=f(z*Qo*Q),Tu=Cu+ku,Lu=Iu+Bu,Nu=Cu-ku,Vp=f(Tu*Ta),Hp=f(Lu*Nu),$p=f(Tu*Nu),Kp=f(Ta*Lu);return new w(Vp,Hp,Kp,$p)}let xt=f(M*K),Et=f(U*X),Pt=f(z*N*bt),dt=f($*Q),Ht=f((M+U)*(K+X)-xt-Et),we=dt-Pt,An=dt+Pt,Sn=f(Et-I*xt),Mp=f(Ht*we),Up=f(An*Sn),Op=f(Ht*Sn),Fp=f(we*An);return new w(Mp,Up,Fp,Op)}subtract(E){return this.add(E.negate())}wNAF(E){return _.wNAFCached(this,E,w.normalizeZ)}multiply(E){let I=E;$t("scalar",I,Kt,n);let{p:N,f:M}=this.wNAF(I);return w.normalizeZ([N,M])[0]}multiplyUnsafe(E){let I=E;return $t("scalar",I,oe,n),I===oe?A:this.equals(A)||I===Kt?this:this.equals(x)?this.wNAF(I).p:_.unsafeLadder(this,I)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return _.unsafeLadder(this,n).is0()}toAffine(E){return y(this,E)}clearCofactor(){let{h:E}=t;return E===Kt?this:this.multiplyUnsafe(E)}static fromHex(E,I=!1){let{d:N,a:M}=t,U=e.BYTES;E=at("pointHex",E,U),ne("zip215",I);let $=E.slice(),z=E[U-1];$[U-1]=z&-129;let K=qe($),X=I?u:e.ORDER;$t("pointHex.y",K,oe,X);let Q=f(K*K),bt=f(Q-Kt),xt=f(N*Q-M),{isValid:Et,value:Pt}=d(bt,xt);if(!Et)throw new Error("Point.fromHex: invalid y coordinate");let dt=(Pt&Kt)===Kt,Ht=(z&128)!==0;if(!I&&Pt===oe&&Ht)throw new Error("Point.fromHex: x=0 and x_0=1");return Ht!==dt&&(Pt=f(-Pt)),w.fromAffine({x:Pt,y:K})}static fromPrivateKey(E){return T(E).point}toRawBytes(){let{x:E,y:I}=this.toAffine(),N=lr(I,e.BYTES);return N[N.length-1]|=E&Kt?128:0,N}toHex(){return Be(this.toRawBytes())}}w.BASE=new w(t.Gx,t.Gy,Kt,f(t.Gx*t.Gy)),w.ZERO=new w(oe,Kt,Kt,oe);let{BASE:x,ZERO:A}=w,_=Yo(w,a*8);function v(S){return Y(S,n)}function B(S){return v(qe(S))}function T(S){let E=a;S=at("private key",S,E);let I=at("hashed private key",s(S),2*E),N=h(I.slice(0,E)),M=I.slice(E,2*E),U=B(N),$=x.multiply(U),z=$.toRawBytes();return{head:N,prefix:M,scalar:U,point:$,pointBytes:z}}function et(S){return T(S).pointBytes}function V(S=new Uint8Array,...E){let I=ke(...E);return B(s(p(I,at("context",S),!!o)))}function F(S,E,I={}){S=at("message",S),o&&(S=o(S));let{prefix:N,scalar:M,pointBytes:U}=T(E),$=V(I.context,N,S),z=x.multiply($).toRawBytes(),K=V(I.context,z,U,S),X=v($+K*M);$t("signature.s",X,oe,n);let Q=ke(z,lr(X,e.BYTES));return at("result",Q,a*2)}let R=kg;function k(S,E,I,N=R){let{context:M,zip215:U}=N,$=e.BYTES;S=at("signature",S,2*$),E=at("message",E),U!==void 0&&ne("zip215",U),o&&(E=o(E));let z=qe(S.slice($,2*$)),K,X,Q;try{K=w.fromHex(I,U),X=w.fromHex(S.slice(0,$),U),Q=x.multiplyUnsafe(z)}catch{return!1}if(!U&&K.isSmallOrder())return!1;let bt=V(M,X.toRawBytes(),K.toRawBytes(),E);return X.add(K.multiplyUnsafe(bt)).subtract(Q).clearCofactor().equals(w.ZERO)}return x._setWindowSize(8),{CURVE:t,getPublicKey:et,sign:F,verify:k,ExtendedPoint:w,utils:{getExtendedPublicKey:T,randomPrivateKey:()=>i(e.BYTES),precompute(S=8,E=w.BASE){return E._setWindowSize(S),E.multiply(BigInt(3)),E}}}}var ic=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),gf=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),Kx=BigInt(0),Tg=BigInt(1),yf=BigInt(2),qx=BigInt(3),Lg=BigInt(5),Ng=BigInt(8);function Pg(r){let t=BigInt(10),e=BigInt(20),n=BigInt(40),o=BigInt(80),s=ic,a=r*r%s*r%s,c=nt(a,yf,s)*a%s,u=nt(c,Tg,s)*r%s,f=nt(u,Lg,s)*u%s,l=nt(f,t,s)*f%s,d=nt(l,e,s)*l%s,h=nt(d,n,s)*d%s,p=nt(h,o,s)*h%s,m=nt(p,o,s)*h%s,g=nt(m,t,s)*f%s;return{pow_p_5_8:nt(g,yf,s)*r%s,b2:a}}function Rg(r){return r[0]&=248,r[31]&=127,r[31]|=64,r}function Dg(r,t){let e=ic,n=Y(t*t*t,e),o=Y(n*n*t,e),s=Pg(r*o).pow_p_5_8,i=Y(r*n*s,e),a=Y(t*i*i,e),c=i,u=Y(i*gf,e),f=a===r,l=a===Y(-r,e),d=a===Y(-r*gf,e);return f&&(i=c),(l||d)&&(i=u),ff(i,e)&&(i=Y(-i,e)),{isValid:f||l,value:i}}var Mg=Ge(ic,void 0,!0),Ug={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Mg,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:Ng,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:sf,randomBytes:qr,adjustScalarBytes:Rg,uvRatio:Dg},Dn=mf(Ug);var ts=32,es=64,ac=32;function wf(){let r=Dn.utils.randomPrivateKey(),t=Dn.getPublicKey(r);return{privateKey:Og(r,t),publicKey:t}}function bf(r,t){let e=r.subarray(0,ac);return Dn.sign(t instanceof Uint8Array?t:t.subarray(),e)}function xf(r,t,e){return Dn.verify(t,e instanceof Uint8Array?e:e.subarray(),r)}function Og(r,t){let e=new Uint8Array(es);for(let n=0;n<ac;n++)e[n]=r[n],e[ac+n]=t[n];return e}var Mn=class{type="Ed25519";raw;constructor(t){this.raw=ns(t,ts)}toMultihash(){return Se.digest(fe(this))}toCID(){return pt.createV1(114,this.toMultihash())}toString(){return W.encode(this.toMultihash().bytes).substring(1)}equals(t){return t==null||!(t.raw instanceof Uint8Array)?!1:it(this.raw,t.raw)}verify(t,e){return xf(this.raw,e,t)}},rs=class{type="Ed25519";raw;publicKey;constructor(t,e){this.raw=ns(t,es),this.publicKey=new Mn(e)}equals(t){return t==null||!(t.raw instanceof Uint8Array)?!1:it(this.raw,t.raw)}sign(t){return bf(this.raw,t)}};function cc(r){return r=ns(r,ts),new Mn(r)}async function Ef(){let{privateKey:r,publicKey:t}=wf();return new rs(r,t)}function ns(r,t){if(r=Uint8Array.from(r??[]),r.length!==t)throw new D(`Key must be a Uint8Array of length ${t}, got ${r.length}`);return r}function ct(r=0){return new Uint8Array(r)}function It(r=0){return new Uint8Array(r)}var Fg=Math.pow(2,7),Vg=Math.pow(2,14),Hg=Math.pow(2,21),lc=Math.pow(2,28),uc=Math.pow(2,35),fc=Math.pow(2,42),hc=Math.pow(2,49),j=128,kt=127;function ht(r){if(r<Fg)return 1;if(r<Vg)return 2;if(r<Hg)return 3;if(r<lc)return 4;if(r<uc)return 5;if(r<fc)return 6;if(r<hc)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function dc(r,t,e=0){switch(ht(r)){case 8:t[e++]=r&255|j,r/=128;case 7:t[e++]=r&255|j,r/=128;case 6:t[e++]=r&255|j,r/=128;case 5:t[e++]=r&255|j,r/=128;case 4:t[e++]=r&255|j,r>>>=7;case 3:t[e++]=r&255|j,r>>>=7;case 2:t[e++]=r&255|j,r>>>=7;case 1:{t[e++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return t}function $g(r,t,e=0){switch(ht(r)){case 8:t.set(e++,r&255|j),r/=128;case 7:t.set(e++,r&255|j),r/=128;case 6:t.set(e++,r&255|j),r/=128;case 5:t.set(e++,r&255|j),r/=128;case 4:t.set(e++,r&255|j),r>>>=7;case 3:t.set(e++,r&255|j),r>>>=7;case 2:t.set(e++,r&255|j),r>>>=7;case 1:{t.set(e++,r&255),r>>>=7;break}default:throw new Error("unreachable")}return t}function pc(r,t){let e=r[t],n=0;if(n+=e&kt,e<j||(e=r[t+1],n+=(e&kt)<<7,e<j)||(e=r[t+2],n+=(e&kt)<<14,e<j)||(e=r[t+3],n+=(e&kt)<<21,e<j)||(e=r[t+4],n+=(e&kt)*lc,e<j)||(e=r[t+5],n+=(e&kt)*uc,e<j)||(e=r[t+6],n+=(e&kt)*fc,e<j)||(e=r[t+7],n+=(e&kt)*hc,e<j))return n;throw new RangeError("Could not decode varint")}function Kg(r,t){let e=r.get(t),n=0;if(n+=e&kt,e<j||(e=r.get(t+1),n+=(e&kt)<<7,e<j)||(e=r.get(t+2),n+=(e&kt)<<14,e<j)||(e=r.get(t+3),n+=(e&kt)<<21,e<j)||(e=r.get(t+4),n+=(e&kt)*lc,e<j)||(e=r.get(t+5),n+=(e&kt)*uc,e<j)||(e=r.get(t+6),n+=(e&kt)*fc,e<j)||(e=r.get(t+7),n+=(e&kt)*hc,e<j))return n;throw new RangeError("Could not decode varint")}function Ct(r,t,e=0){return t==null&&(t=It(ht(r))),t instanceof Uint8Array?dc(r,t,e):$g(r,t,e)}function se(r,t=0){return r instanceof Uint8Array?pc(r,t):Kg(r,t)}var mc=new Float32Array([-0]),We=new Uint8Array(mc.buffer);function Af(r,t,e){mc[0]=r,t[e]=We[0],t[e+1]=We[1],t[e+2]=We[2],t[e+3]=We[3]}function Sf(r,t){return We[0]=r[t],We[1]=r[t+1],We[2]=r[t+2],We[3]=r[t+3],mc[0]}var gc=new Float64Array([-0]),Tt=new Uint8Array(gc.buffer);function _f(r,t,e){gc[0]=r,t[e]=Tt[0],t[e+1]=Tt[1],t[e+2]=Tt[2],t[e+3]=Tt[3],t[e+4]=Tt[4],t[e+5]=Tt[5],t[e+6]=Tt[6],t[e+7]=Tt[7]}function Bf(r,t){return Tt[0]=r[t],Tt[1]=r[t+1],Tt[2]=r[t+2],Tt[3]=r[t+3],Tt[4]=r[t+4],Tt[5]=r[t+5],Tt[6]=r[t+6],Tt[7]=r[t+7],gc[0]}var qg=BigInt(Number.MAX_SAFE_INTEGER),zg=BigInt(Number.MIN_SAFE_INTEGER),Gt=class r{lo;hi;constructor(t,e){this.lo=t|0,this.hi=e|0}toNumber(t=!1){if(!t&&this.hi>>>31>0){let e=~this.lo+1>>>0,n=~this.hi>>>0;return e===0&&(n=n+1>>>0),-(e+n*4294967296)}return this.lo+this.hi*4294967296}toBigInt(t=!1){if(t)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let e=~this.lo+1>>>0,n=~this.hi>>>0;return e===0&&(n=n+1>>>0),-(BigInt(e)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(t=!1){return this.toBigInt(t).toString()}zzEncode(){let t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this}zzDecode(){let t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this}length(){let t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?e===0?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:n<128?9:10}static fromBigInt(t){if(t===0n)return dr;if(t<qg&&t>zg)return this.fromNumber(Number(t));let e=t<0n;e&&(t=-t);let n=t>>32n,o=t-(n<<32n);return e&&(n=~n|0n,o=~o|0n,++o>If&&(o=0n,++n>If&&(n=0n))),new r(Number(o),Number(n))}static fromNumber(t){if(t===0)return dr;let e=t<0;e&&(t=-t);let n=t>>>0,o=(t-n)/4294967296>>>0;return e&&(o=~o>>>0,n=~n>>>0,++n>4294967295&&(n=0,++o>4294967295&&(o=0))),new r(n,o)}static from(t){return typeof t=="number"?r.fromNumber(t):typeof t=="bigint"?r.fromBigInt(t):typeof t=="string"?r.fromBigInt(BigInt(t)):t.low!=null||t.high!=null?new r(t.low>>>0,t.high>>>0):dr}},dr=new Gt(0,0);dr.toBigInt=function(){return 0n};dr.zzEncode=dr.zzDecode=function(){return this};dr.length=function(){return 1};var If=4294967296n;function kf(r){let t=0,e=0;for(let n=0;n<r.length;++n)e=r.charCodeAt(n),e<128?t+=1:e<2048?t+=2:(e&64512)===55296&&(r.charCodeAt(n+1)&64512)===56320?(++n,t+=4):t+=3;return t}function Cf(r,t,e){if(e-t<1)return"";let o,s=[],i=0,a;for(;t<e;)a=r[t++],a<128?s[i++]=a:a>191&&a<224?s[i++]=(a&31)<<6|r[t++]&63:a>239&&a<365?(a=((a&7)<<18|(r[t++]&63)<<12|(r[t++]&63)<<6|r[t++]&63)-65536,s[i++]=55296+(a>>10),s[i++]=56320+(a&1023)):s[i++]=(a&15)<<12|(r[t++]&63)<<6|r[t++]&63,i>8191&&((o??(o=[])).push(String.fromCharCode.apply(String,s)),i=0);return o!=null?(i>0&&o.push(String.fromCharCode.apply(String,s.slice(0,i))),o.join("")):String.fromCharCode.apply(String,s.slice(0,i))}function yc(r,t,e){let n=e,o,s;for(let i=0;i<r.length;++i)o=r.charCodeAt(i),o<128?t[e++]=o:o<2048?(t[e++]=o>>6|192,t[e++]=o&63|128):(o&64512)===55296&&((s=r.charCodeAt(i+1))&64512)===56320?(o=65536+((o&1023)<<10)+(s&1023),++i,t[e++]=o>>18|240,t[e++]=o>>12&63|128,t[e++]=o>>6&63|128,t[e++]=o&63|128):(t[e++]=o>>12|224,t[e++]=o>>6&63|128,t[e++]=o&63|128);return e-n}function ie(r,t){return RangeError(`index out of range: ${r.pos} + ${t??1} > ${r.len}`)}function os(r,t){return(r[t-4]|r[t-3]<<8|r[t-2]<<16|r[t-1]<<24)>>>0}var wc=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(t){this.buf=t,this.pos=0,this.len=t.length}uint32(){let t=4294967295;if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,ie(this,10);return t}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw ie(this,4);return os(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw ie(this,4);return os(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw ie(this,4);let t=Sf(this.buf,this.pos);return this.pos+=4,t}double(){if(this.pos+8>this.len)throw ie(this,4);let t=Bf(this.buf,this.pos);return this.pos+=8,t}bytes(){let t=this.uint32(),e=this.pos,n=this.pos+t;if(n>this.len)throw ie(this,t);return this.pos+=t,e===n?new Uint8Array(0):this.buf.subarray(e,n)}string(){let t=this.bytes();return Cf(t,0,t.length)}skip(t){if(typeof t=="number"){if(this.pos+t>this.len)throw ie(this,t);this.pos+=t}else do if(this.pos>=this.len)throw ie(this);while(this.buf[this.pos++]&128);return this}skipType(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${t} at offset ${this.pos}`)}return this}readLongVarint(){let t=new Gt(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw ie(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw ie(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw ie(this,8);let t=os(this.buf,this.pos+=4),e=os(this.buf,this.pos+=4);return new Gt(t,e)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){let t=pc(this.buf,this.pos);return this.pos+=ht(t),t}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}};function bc(r){return new wc(r instanceof Uint8Array?r:r.subarray())}function Dt(r,t,e){let n=bc(r);return t.decode(n,void 0,e)}var xc={};Rt(xc,{base10:()=>Gg});var Gg=Ve({prefix:"9",name:"base10",alphabet:"0123456789"});var vc={};Rt(vc,{base16:()=>Wg,base16upper:()=>jg});var Wg=st({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),jg=st({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Ec={};Rt(Ec,{base2:()=>Zg});var Zg=st({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Ac={};Rt(Ac,{base256emoji:()=>t0});var Lf=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}"),Xg=Lf.reduce((r,t,e)=>(r[e]=t,r),[]),Yg=Lf.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function Jg(r){return r.reduce((t,e)=>(t+=Xg[e],t),"")}function Qg(r){let t=[];for(let e of r){let n=Yg[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}var t0=Ur({prefix:"\u{1F680}",name:"base256emoji",encode:Jg,decode:Qg});var Sc={};Rt(Sc,{base36:()=>e0,base36upper:()=>r0});var e0=Ve({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),r0=Ve({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Ic={};Rt(Ic,{base64:()=>_c,base64pad:()=>n0,base64url:()=>Bc,base64urlpad:()=>o0});var _c=st({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),n0=st({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Bc=st({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),o0=st({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var kc={};Rt(kc,{base8:()=>s0});var s0=st({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Cc={};Rt(Cc,{identity:()=>i0});var i0=Ur({prefix:"\0",name:"identity",encode:r=>Fu(r),decode:r=>Ou(r)});var S1=new TextEncoder,_1=new TextDecoder;var Nc={};Rt(Nc,{sha256:()=>Wr,sha512:()=>l0});function Lc({name:r,code:t,encode:e}){return new Tc(r,t,e)}var Tc=class{name;code;encode;constructor(t,e,n){this.name=t,this.code=e,this.encode=n}digest(t){if(t instanceof Uint8Array){let e=this.encode(t);return e instanceof Uint8Array?te(this.code,e):e.then(n=>te(this.code,n))}else throw Error("Unknown type, must be binary type")}};function Pf(r){return async t=>new Uint8Array(await crypto.subtle.digest(r,t))}var Wr=Lc({name:"sha2-256",code:18,encode:Pf("SHA-256")}),l0=Lc({name:"sha2-512",code:19,encode:Pf("SHA-512")});var Un={...Cc,...Ec,...kc,...xc,...vc,...Ha,...Sc,...Va,...Ic,...Ac},U1={...Nc,...qa};function Df(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var Rf=Df("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Pc=Df("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);let t=It(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),u0={utf8:Rf,"utf-8":Rf,hex:Un.base16,latin1:Pc,ascii:Pc,binary:Pc,...Un},ss=u0;function P(r,t="utf8"){let e=ss[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return e.decoder.decode(`${e.prefix}${r}`)}function Rc(r){let t=r??8192,e=t>>>1,n,o=t;return function(i){if(i<1||i>e)return It(i);o+i>t&&(n=It(t),o=0);let a=n.subarray(o,o+=i);return o&7&&(o=(o|7)+1),a}}var pr=class{fn;len;next;val;constructor(t,e,n){this.fn=t,this.len=e,this.next=void 0,this.val=n}};function Dc(){}var Uc=class{head;tail;len;next;constructor(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}},f0=Rc();function h0(r){return globalThis.Buffer!=null?It(r):f0(r)}var Fn=class{len;head;tail;states;constructor(){this.len=0,this.head=new pr(Dc,0,0),this.tail=this.head,this.states=null}_push(t,e,n){return this.tail=this.tail.next=new pr(t,e,n),this.len+=e,this}uint32(t){return this.len+=(this.tail=this.tail.next=new Oc((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this}int32(t){return t<0?this._push(is,10,Gt.fromNumber(t)):this.uint32(t)}sint32(t){return this.uint32((t<<1^t>>31)>>>0)}uint64(t){let e=Gt.fromBigInt(t);return this._push(is,e.length(),e)}uint64Number(t){return this._push(dc,ht(t),t)}uint64String(t){return this.uint64(BigInt(t))}int64(t){return this.uint64(t)}int64Number(t){return this.uint64Number(t)}int64String(t){return this.uint64String(t)}sint64(t){let e=Gt.fromBigInt(t).zzEncode();return this._push(is,e.length(),e)}sint64Number(t){let e=Gt.fromNumber(t).zzEncode();return this._push(is,e.length(),e)}sint64String(t){return this.sint64(BigInt(t))}bool(t){return this._push(Mc,1,t?1:0)}fixed32(t){return this._push(On,4,t>>>0)}sfixed32(t){return this.fixed32(t)}fixed64(t){let e=Gt.fromBigInt(t);return this._push(On,4,e.lo)._push(On,4,e.hi)}fixed64Number(t){let e=Gt.fromNumber(t);return this._push(On,4,e.lo)._push(On,4,e.hi)}fixed64String(t){return this.fixed64(BigInt(t))}sfixed64(t){return this.fixed64(t)}sfixed64Number(t){return this.fixed64Number(t)}sfixed64String(t){return this.fixed64String(t)}float(t){return this._push(Af,4,t)}double(t){return this._push(_f,8,t)}bytes(t){let e=t.length>>>0;return e===0?this._push(Mc,1,0):this.uint32(e)._push(p0,e,t)}string(t){let e=kf(t);return e!==0?this.uint32(e)._push(yc,e,t):this._push(Mc,1,0)}fork(){return this.states=new Uc(this),this.head=this.tail=new pr(Dc,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 pr(Dc,0,0),this.len=0),this}ldelim(){let t=this.head,e=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=t.next,this.tail=e,this.len+=n),this}finish(){let t=this.head.next,e=h0(this.len),n=0;for(;t!=null;)t.fn(t.val,e,n),n+=t.len,t=t.next;return e}};function Mc(r,t,e){t[e]=r&255}function d0(r,t,e){for(;r>127;)t[e++]=r&127|128,r>>>=7;t[e]=r}var Oc=class extends pr{next;constructor(t,e){super(d0,t,e),this.next=void 0}};function is(r,t,e){for(;r.hi!==0;)t[e++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)t[e++]=r.lo&127|128,r.lo=r.lo>>>7;t[e++]=r.lo}function On(r,t,e){t[e]=r&255,t[e+1]=r>>>8&255,t[e+2]=r>>>16&255,t[e+3]=r>>>24}function p0(r,t,e){t.set(r,e)}globalThis.Buffer!=null&&(Fn.prototype.bytes=function(r){let t=r.length>>>0;return this.uint32(t),t>0&&this._push(m0,t,r),this},Fn.prototype.string=function(r){let t=globalThis.Buffer.byteLength(r);return this.uint32(t),t>0&&this._push(g0,t,r),this});function m0(r,t,e){t.set(r,e)}function g0(r,t,e){r.length<40?yc(r,t,e):t.utf8Write!=null?t.utf8Write(r,e):t.set(P(r),e)}function Fc(){return new Fn}function Mt(r,t){let e=Fc();return t.encode(r,e,{lengthDelimited:!1}),e.finish()}var jr;(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"})(jr||(jr={}));function as(r,t,e,n){return{name:r,type:t,encode:e,decode:n}}function Vc(r){function t(o){if(r[o.toString()]==null)throw new Error("Invalid enum value");return r[o]}let e=function(s,i){let a=t(s);i.int32(a)},n=function(s){let i=s.int32();return t(i)};return as("enum",jr.VARINT,e,n)}function Ut(r,t){return as("message",jr.LENGTH_DELIMITED,r,t)}var mr=class extends Error{code="ERR_MAX_LENGTH";name="MaxLengthError"},Vn=class extends Error{code="ERR_MAX_SIZE";name="MaxSizeError"};var gt;(function(r){r.RSA="RSA",r.Ed25519="Ed25519",r.secp256k1="secp256k1"})(gt||(gt={}));var Hc;(function(r){r[r.RSA=0]="RSA",r[r.Ed25519=1]="Ed25519",r[r.secp256k1=2]="secp256k1"})(Hc||(Hc={}));(function(r){r.codec=()=>Vc(Hc)})(gt||(gt={}));var he;(function(r){let t;r.codec=()=>(t==null&&(t=Ut((e,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),e.Type!=null&&(n.uint32(8),gt.codec().encode(e.Type,n)),e.Data!=null&&(n.uint32(18),n.bytes(e.Data)),o.lengthDelimited!==!1&&n.ldelim()},(e,n,o={})=>{let s={},i=n==null?e.len:e.pos+n;for(;e.pos<i;){let a=e.uint32();switch(a>>>3){case 1:{s.Type=gt.codec().decode(e);break}case 2:{s.Data=e.bytes();break}default:{e.skipType(a&7);break}}}return s})),t),r.encode=e=>Mt(e,r.codec()),r.decode=(e,n)=>Dt(e,r.codec(),n)})(he||(he={}));var $c;(function(r){let t;r.codec=()=>(t==null&&(t=Ut((e,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),e.Type!=null&&(n.uint32(8),gt.codec().encode(e.Type,n)),e.Data!=null&&(n.uint32(18),n.bytes(e.Data)),o.lengthDelimited!==!1&&n.ldelim()},(e,n,o={})=>{let s={},i=n==null?e.len:e.pos+n;for(;e.pos<i;){let a=e.uint32();switch(a>>>3){case 1:{s.Type=gt.codec().decode(e);break}case 2:{s.Data=e.bytes();break}default:{e.skipType(a&7);break}}}return s})),t),r.encode=e=>Mt(e,r.codec()),r.decode=(e,n)=>Dt(e,r.codec(),n)})($c||($c={}));var Yn={};Rt(Yn,{MAX_RSA_KEY_SIZE:()=>Js,generateRSAKeyPair:()=>Qc,jwkToJWKKeyPair:()=>Nh,jwkToPkcs1:()=>N0,jwkToPkix:()=>Yc,jwkToRSAPrivateKey:()=>Lh,pkcs1ToJwk:()=>kh,pkcs1ToRSAPrivateKey:()=>Th,pkixToJwk:()=>Ch,pkixToRSAPublicKey:()=>Jc});var y0=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),je=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ze=new Uint32Array(64),Kc=class extends zr{constructor(){super(64,32,8,!1),this.A=je[0]|0,this.B=je[1]|0,this.C=je[2]|0,this.D=je[3]|0,this.E=je[4]|0,this.F=je[5]|0,this.G=je[6]|0,this.H=je[7]|0}get(){let{A:t,B:e,C:n,D:o,E:s,F:i,G:a,H:c}=this;return[t,e,n,o,s,i,a,c]}set(t,e,n,o,s,i,a,c){this.A=t|0,this.B=e|0,this.C=n|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=a|0,this.H=c|0}process(t,e){for(let l=0;l<16;l++,e+=4)Ze[l]=t.getUint32(e,!1);for(let l=16;l<64;l++){let d=Ze[l-15],h=Ze[l-2],p=re(d,7)^re(d,18)^d>>>3,m=re(h,17)^re(h,19)^h>>>10;Ze[l]=m+Ze[l-7]+p+Ze[l-16]|0}let{A:n,B:o,C:s,D:i,E:a,F:c,G:u,H:f}=this;for(let l=0;l<64;l++){let d=re(a,6)^re(a,11)^re(a,25),h=f+d+rf(a,c,u)+y0[l]+Ze[l]|0,m=(re(n,2)^re(n,13)^re(n,22))+nf(n,o,s)|0;f=u,u=c,c=a,a=i+h|0,i=s,s=o,o=n,n=h+m|0}n=n+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,f=f+this.H|0,this.set(n,o,s,i,a,c,u,f)}roundClean(){Ze.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var Zr=Go(()=>new Kc);var q=sr(Uf());function gr(r,t){let e=0;if(r.length===1)return r[0];for(let n=r.length-1;n>=0;n--)e+=r[r.length-1-n]*Math.pow(2,t*n);return e}function Xe(r,t,e=-1){let n=e,o=r,s=0,i=Math.pow(2,t);for(let a=1;a<8;a++){if(r<i){let c;if(n<0)c=new ArrayBuffer(a),s=a;else{if(n<a)return new ArrayBuffer(0);c=new ArrayBuffer(n),s=n}let u=new Uint8Array(c);for(let f=a-1;f>=0;f--){let l=Math.pow(2,f*t);u[s-f-1]=Math.floor(o/l),o-=u[s-f-1]*l}return c}i*=Math.pow(2,t)}return new ArrayBuffer(0)}function us(...r){let t=0,e=0;for(let s of r)t+=s.length;let n=new ArrayBuffer(t),o=new Uint8Array(n);for(let s of r)o.set(s,e),e+=s.length;return o}function zc(){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 t=new ArrayBuffer(this.valueHex.byteLength),e=new Uint8Array(t);for(let a=0;a<this.valueHex.byteLength;a++)e[a]=0;e[0]=r[0]&128;let n=gr(e,8),o=new ArrayBuffer(this.valueHex.byteLength),s=new Uint8Array(o);for(let a=0;a<this.valueHex.byteLength;a++)s[a]=r[a];return s[0]&=127,gr(s,8)-n}function Of(r){let t=r<0?r*-1:r,e=128;for(let n=1;n<8;n++){if(t<=e){if(r<0){let i=e-t,a=Xe(i,8,n),c=new Uint8Array(a);return c[0]|=128,a}let o=Xe(t,8,n),s=new Uint8Array(o);if(s[0]&128){let i=o.slice(0),a=new Uint8Array(i);o=new ArrayBuffer(o.byteLength+1),s=new Uint8Array(o);for(let c=0;c<i.byteLength;c++)s[c+1]=a[c];s[0]=0}return o}e*=Math.pow(2,8)}return new ArrayBuffer(0)}function Ff(r,t){if(r.byteLength!==t.byteLength)return!1;let e=new Uint8Array(r),n=new Uint8Array(t);for(let o=0;o<e.length;o++)if(e[o]!==n[o])return!1;return!0}function qt(r,t){let e=r.toString(10);if(t<e.length)return"";let n=t-e.length,o=new Array(n);for(let i=0;i<n;i++)o[i]="0";return o.join("").concat(e)}var wv=Math.log(2);function fs(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function Gc(r){let t=0,e=0;for(let o=0;o<r.length;o++){let s=r[o];t+=s.byteLength}let n=new Uint8Array(t);for(let o=0;o<r.length;o++){let s=r[o];n.set(new Uint8Array(s),e),e+=s.byteLength}return n.buffer}function Pe(r,t,e,n){return t instanceof Uint8Array?t.byteLength?e<0?(r.error="Wrong parameter: inputOffset less than zero",!1):n<0?(r.error="Wrong parameter: inputLength less than zero",!1):t.byteLength-e-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 $n=class{constructor(){this.items=[]}write(t){this.items.push(t)}final(){return Gc(this.items)}},Hn=[new Uint8Array([1])],Vf="0123456789";var tn="",ae=new ArrayBuffer(0),Wc=new Uint8Array(0),Kn="EndOfContent",$f="OCTET STRING",Kf="BIT STRING";function Re(r){var t;return t=class extends r{constructor(...n){var o;super(...n);let s=n[0]||{};this.isHexOnly=(o=s.isHexOnly)!==null&&o!==void 0?o:!1,this.valueHexView=s.valueHex?q.BufferSourceConverter.toUint8Array(s.valueHex):Wc}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(n){this.valueHexView=new Uint8Array(n)}fromBER(n,o,s){let i=n instanceof ArrayBuffer?new Uint8Array(n):n;if(!Pe(this,i,o,s))return-1;let a=o+s;return this.valueHexView=i.subarray(o,a),this.valueHexView.length?(this.blockLength=s,a):(this.warnings.push("Zero buffer length"),o)}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",ae)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:q.Convert.ToHex(this.valueHexView)}}},t.NAME="hexBlock",t}var Te=class{constructor({blockLength:t=0,error:e=tn,warnings:n=[],valueBeforeDecode:o=Wc}={}){this.blockLength=t,this.error=e,this.warnings=n,this.valueBeforeDecodeView=q.BufferSourceConverter.toUint8Array(o)}static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(t){this.valueBeforeDecodeView=new Uint8Array(t)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:q.Convert.ToHex(this.valueBeforeDecodeView)}}};Te.NAME="baseBlock";var Lt=class extends Te{fromBER(t,e,n){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(t,e){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}};Lt.NAME="valueBlock";var hs=class extends Re(Te){constructor({idBlock:t={}}={}){var e,n,o,s;super(),t?(this.isHexOnly=(e=t.isHexOnly)!==null&&e!==void 0?e:!1,this.valueHexView=t.valueHex?q.BufferSourceConverter.toUint8Array(t.valueHex):Wc,this.tagClass=(n=t.tagClass)!==null&&n!==void 0?n:-1,this.tagNumber=(o=t.tagNumber)!==null&&o!==void 0?o:-1,this.isConstructed=(s=t.isConstructed)!==null&&s!==void 0?s:!1):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(t=!1){let e=0;switch(this.tagClass){case 1:e|=0;break;case 2:e|=64;break;case 3:e|=128;break;case 4:e|=192;break;default:return this.error="Unknown tag class",ae}if(this.isConstructed&&(e|=32),this.tagNumber<31&&!this.isHexOnly){let o=new Uint8Array(1);if(!t){let s=this.tagNumber;s&=31,e|=s,o[0]=e}return o.buffer}if(!this.isHexOnly){let o=Xe(this.tagNumber,7),s=new Uint8Array(o),i=o.byteLength,a=new Uint8Array(i+1);if(a[0]=e|31,!t){for(let c=0;c<i-1;c++)a[c+1]=s[c]|128;a[i]=s[i-1]}return a.buffer}let n=new Uint8Array(this.valueHexView.byteLength+1);if(n[0]=e|31,!t){let o=this.valueHexView;for(let s=0;s<o.length-1;s++)n[s+1]=o[s]|128;n[this.valueHexView.byteLength]=o[o.length-1]}return n.buffer}fromBER(t,e,n){let o=q.BufferSourceConverter.toUint8Array(t);if(!Pe(this,o,e,n))return-1;let s=o.subarray(e,e+n);if(s.length===0)return this.error="Zero buffer length",-1;switch(s[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=(s[0]&32)===32,this.isHexOnly=!1;let a=s[0]&31;if(a!==31)this.tagNumber=a,this.blockLength=1;else{let c=1,u=this.valueHexView=new Uint8Array(255),f=255;for(;s[c]&128;){if(u[c-1]=s[c]&127,c++,c>=s.length)return this.error="End of input reached before message was fully decoded",-1;if(c===f){f+=255;let d=new Uint8Array(f);for(let h=0;h<u.length;h++)d[h]=u[h];u=this.valueHexView=new Uint8Array(f)}}this.blockLength=c+1,u[c-1]=s[c]&127;let l=new Uint8Array(c);for(let d=0;d<c;d++)l[d]=u[d];u=this.valueHexView=new Uint8Array(c),u.set(l),this.blockLength<=9?this.tagNumber=gr(u,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 e+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}};hs.NAME="identificationBlock";var ds=class extends Te{constructor({lenBlock:t={}}={}){var e,n,o;super(),this.isIndefiniteForm=(e=t.isIndefiniteForm)!==null&&e!==void 0?e:!1,this.longFormUsed=(n=t.longFormUsed)!==null&&n!==void 0?n:!1,this.length=(o=t.length)!==null&&o!==void 0?o:0}fromBER(t,e,n){let o=q.BufferSourceConverter.toUint8Array(t);if(!Pe(this,o,e,n))return-1;let s=o.subarray(e,e+n);if(s.length===0)return this.error="Zero buffer length",-1;if(s[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=s[0]===128,this.isIndefiniteForm)return this.blockLength=1,e+this.blockLength;if(this.longFormUsed=!!(s[0]&128),this.longFormUsed===!1)return this.length=s[0],this.blockLength=1,e+this.blockLength;let i=s[0]&127;if(i>8)return this.error="Too big integer",-1;if(i+1>s.length)return this.error="End of input reached before message was fully decoded",-1;let a=e+1,c=o.subarray(a,a+i);return c[i-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=gr(c,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=i+1,e+this.blockLength}toBER(t=!1){let e,n;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return e=new ArrayBuffer(1),t===!1&&(n=new Uint8Array(e),n[0]=128),e;if(this.longFormUsed){let o=Xe(this.length,8);if(o.byteLength>127)return this.error="Too big length",ae;if(e=new ArrayBuffer(o.byteLength+1),t)return e;let s=new Uint8Array(o);n=new Uint8Array(e),n[0]=o.byteLength|128;for(let i=0;i<o.byteLength;i++)n[i+1]=s[i];return e}return e=new ArrayBuffer(1),t===!1&&(n=new Uint8Array(e),n[0]=this.length),e}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}};ds.NAME="lengthBlock";var C={},At=class extends Te{constructor({name:t=tn,optional:e=!1,primitiveSchema:n,...o}={},s){super(o),this.name=t,this.optional=e,n&&(this.primitiveSchema=n),this.idBlock=new hs(o),this.lenBlock=new ds(o),this.valueBlock=s?new s(o):new Lt(o)}fromBER(t,e,n){let o=this.valueBlock.fromBER(t,e,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return o===-1?(this.error=this.valueBlock.error,o):(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),o)}toBER(t,e){let n=e||new $n;e||qf(this);let o=this.idBlock.toBER(t);if(n.write(o),this.lenBlock.isIndefiniteForm)n.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(t,n),n.write(new ArrayBuffer(2));else{let s=this.valueBlock.toBER(t);this.lenBlock.length=s.byteLength;let i=this.lenBlock.toBER(t);n.write(i),n.write(s)}return e?ae:n.final()}toJSON(){let t={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(t.primitiveSchema=this.primitiveSchema.toJSON()),t}toString(t="ascii"){return t==="ascii"?this.onAsciiEncoding():q.Convert.ToHex(this.toBER())}onAsciiEncoding(){return`${this.constructor.NAME} : ${q.Convert.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(t){if(this===t)return!0;if(!(t instanceof this.constructor))return!1;let e=this.toBER(),n=t.toBER();return Ff(e,n)}};At.NAME="BaseBlock";function qf(r){if(r instanceof C.Constructed)for(let t of r.valueBlock.value)qf(t)&&(r.lenBlock.isIndefiniteForm=!0);return!!r.lenBlock.isIndefiniteForm}var ps=class extends At{constructor({value:t=tn,...e}={},n){super(e,n),t&&this.fromString(t)}getValue(){return this.valueBlock.value}setValue(t){this.valueBlock.value=t}fromBER(t,e,n){let o=this.valueBlock.fromBER(t,e,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return o===-1?(this.error=this.valueBlock.error,o):(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),o)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}};ps.NAME="BaseStringBlock";var ms=class extends Re(Lt){constructor({isHexOnly:t=!0,...e}={}){super(e),this.isHexOnly=t}};ms.NAME="PrimitiveValueBlock";var zf,gs=class extends At{constructor(t={}){super(t,ms),this.idBlock.isConstructed=!1}};zf=gs;C.Primitive=zf;gs.NAME="PRIMITIVE";function B0(r,t){if(r instanceof t)return r;let e=new t;return e.idBlock=r.idBlock,e.lenBlock=r.lenBlock,e.warnings=r.warnings,e.valueBeforeDecodeView=r.valueBeforeDecodeView,e}function Xs(r,t=0,e=r.length){let n=t,o=new At({},Lt),s=new Te;if(!Pe(s,r,t,e))return o.error=s.error,{offset:-1,result:o};if(!r.subarray(t,t+e).length)return o.error="Zero buffer length",{offset:-1,result:o};let a=o.idBlock.fromBER(r,t,e);if(o.idBlock.warnings.length&&o.warnings.concat(o.idBlock.warnings),a===-1)return o.error=o.idBlock.error,{offset:-1,result:o};if(t=a,e-=o.idBlock.blockLength,a=o.lenBlock.fromBER(r,t,e),o.lenBlock.warnings.length&&o.warnings.concat(o.lenBlock.warnings),a===-1)return o.error=o.lenBlock.error,{offset:-1,result:o};if(t=a,e-=o.lenBlock.blockLength,!o.idBlock.isConstructed&&o.lenBlock.isIndefiniteForm)return o.error="Indefinite length form used for primitive encoding form",{offset:-1,result:o};let c=At;switch(o.idBlock.tagClass){case 1:if(o.idBlock.tagNumber>=37&&o.idBlock.isHexOnly===!1)return o.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:o};switch(o.idBlock.tagNumber){case 0:if(o.idBlock.isConstructed&&o.lenBlock.length>0)return o.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:o};c=C.EndOfContent;break;case 1:c=C.Boolean;break;case 2:c=C.Integer;break;case 3:c=C.BitString;break;case 4:c=C.OctetString;break;case 5:c=C.Null;break;case 6:c=C.ObjectIdentifier;break;case 10:c=C.Enumerated;break;case 12:c=C.Utf8String;break;case 13:c=C.RelativeObjectIdentifier;break;case 14:c=C.TIME;break;case 15:return o.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:o};case 16:c=C.Sequence;break;case 17:c=C.Set;break;case 18:c=C.NumericString;break;case 19:c=C.PrintableString;break;case 20:c=C.TeletexString;break;case 21:c=C.VideotexString;break;case 22:c=C.IA5String;break;case 23:c=C.UTCTime;break;case 24:c=C.GeneralizedTime;break;case 25:c=C.GraphicString;break;case 26:c=C.VisibleString;break;case 27:c=C.GeneralString;break;case 28:c=C.UniversalString;break;case 29:c=C.CharacterString;break;case 30:c=C.BmpString;break;case 31:c=C.DATE;break;case 32:c=C.TimeOfDay;break;case 33:c=C.DateTime;break;case 34:c=C.Duration;break;default:{let u=o.idBlock.isConstructed?new C.Constructed:new C.Primitive;u.idBlock=o.idBlock,u.lenBlock=o.lenBlock,u.warnings=o.warnings,o=u}}break;case 2:case 3:case 4:default:c=o.idBlock.isConstructed?C.Constructed:C.Primitive}return o=B0(o,c),a=o.fromBER(r,t,o.lenBlock.isIndefiniteForm?e:o.lenBlock.length),o.valueBeforeDecodeView=r.subarray(n,n+o.blockLength),{offset:a,result:o}}function jc(r){if(!r.byteLength){let t=new At({},Lt);return t.error="Input buffer has zero length",{offset:-1,result:t}}return Xs(q.BufferSourceConverter.toUint8Array(r).slice(),0,r.byteLength)}function I0(r,t){return r?1:t}var de=class extends Lt{constructor({value:t=[],isIndefiniteForm:e=!1,...n}={}){super(n),this.value=t,this.isIndefiniteForm=e}fromBER(t,e,n){let o=q.BufferSourceConverter.toUint8Array(t);if(!Pe(this,o,e,n))return-1;if(this.valueBeforeDecodeView=o.subarray(e,e+n),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),e;let s=e;for(;I0(this.isIndefiniteForm,n)>0;){let i=Xs(o,s,n);if(i.offset===-1)return this.error=i.result.error,this.warnings.concat(i.result.warnings),-1;if(s=i.offset,this.blockLength+=i.result.blockLength,n-=i.result.blockLength,this.value.push(i.result),this.isIndefiniteForm&&i.result.constructor.NAME===Kn)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===Kn?this.value.pop():this.warnings.push("No EndOfContent block encoded")),s}toBER(t,e){let n=e||new $n;for(let o=0;o<this.value.length;o++)this.value[o].toBER(t,n);return e?ae:n.final()}toJSON(){let t={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(let e of this.value)t.value.push(e.toJSON());return t}};de.NAME="ConstructedValueBlock";var Gf,Ye=class extends At{constructor(t={}){super(t,de),this.idBlock.isConstructed=!0}fromBER(t,e,n){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;let o=this.valueBlock.fromBER(t,e,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return o===-1?(this.error=this.valueBlock.error,o):(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),o)}onAsciiEncoding(){let t=[];for(let n of this.valueBlock.value)t.push(n.toString("ascii").split(`
|
|
2
|
+
"use strict";var Libp2P=(()=>{var qp=Object.create;var Lo=Object.defineProperty;var zp=Object.getOwnPropertyDescriptor;var Gp=Object.getOwnPropertyNames;var Wp=Object.getPrototypeOf,jp=Object.prototype.hasOwnProperty;var Qt=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),Rt=(r,t)=>{for(var e in t)Lo(r,e,{get:t[e],enumerable:!0})},Pu=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Gp(t))!jp.call(r,o)&&o!==e&&Lo(r,o,{get:()=>t[o],enumerable:!(n=zp(t,o))||n.enumerable});return r};var sr=(r,t,e)=>(e=r!=null?qp(Wp(r)):{},Pu(t||!r||!r.__esModule?Lo(e,"default",{value:r,enumerable:!0}):e,r)),Zp=r=>Pu(Lo({},"__esModule",{value:!0}),r);var Uf=Qt(Xr=>{"use strict";var w0="[object ArrayBuffer]",Ce=class r{static isArrayBuffer(t){return Object.prototype.toString.call(t)===w0}static toArrayBuffer(t){return this.isArrayBuffer(t)?t:t.byteLength===t.buffer.byteLength||t.byteOffset===0&&t.byteLength===t.buffer.byteLength?t.buffer:this.toUint8Array(t.buffer).slice(t.byteOffset,t.byteOffset+t.byteLength).buffer}static toUint8Array(t){return this.toView(t,Uint8Array)}static toView(t,e){if(t.constructor===e)return t;if(this.isArrayBuffer(t))return new e(t);if(this.isArrayBufferView(t))return new e(t.buffer,t.byteOffset,t.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(t){return this.isArrayBufferView(t)||this.isArrayBuffer(t)}static isArrayBufferView(t){return ArrayBuffer.isView(t)||t&&this.isArrayBuffer(t.buffer)}static isEqual(t,e){let n=r.toUint8Array(t),o=r.toUint8Array(e);if(n.length!==o.byteLength)return!1;for(let s=0;s<n.length;s++)if(n[s]!==o[s])return!1;return!0}static concat(...t){let e;Array.isArray(t[0])&&!(t[1]instanceof Function)||Array.isArray(t[0])&&t[1]instanceof Function?e=t[0]:t[t.length-1]instanceof Function?e=t.slice(0,t.length-1):e=t;let n=0;for(let i of e)n+=i.byteLength;let o=new Uint8Array(n),s=0;for(let i of e){let a=this.toUint8Array(i);o.set(a,s),s+=a.length}return t[t.length-1]instanceof Function?this.toView(o,t[t.length-1]):o.buffer}},qc="string",b0=/^[0-9a-f]+$/i,x0=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,v0=/^[a-zA-Z0-9-_]+$/,cs=class{static fromString(t){let e=unescape(encodeURIComponent(t)),n=new Uint8Array(e.length);for(let o=0;o<e.length;o++)n[o]=e.charCodeAt(o);return n.buffer}static toString(t){let e=Ce.toUint8Array(t),n="";for(let s=0;s<e.length;s++)n+=String.fromCharCode(e[s]);return decodeURIComponent(escape(n))}},Zt=class{static toString(t,e=!1){let n=Ce.toArrayBuffer(t),o=new DataView(n),s="";for(let i=0;i<n.byteLength;i+=2){let a=o.getUint16(i,e);s+=String.fromCharCode(a)}return s}static fromString(t,e=!1){let n=new ArrayBuffer(t.length*2),o=new DataView(n);for(let s=0;s<t.length;s++)o.setUint16(s*2,t.charCodeAt(s),e);return n}},ls=class r{static isHex(t){return typeof t===qc&&b0.test(t)}static isBase64(t){return typeof t===qc&&x0.test(t)}static isBase64Url(t){return typeof t===qc&&v0.test(t)}static ToString(t,e="utf8"){let n=Ce.toUint8Array(t);switch(e.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 Zt.toString(n,!0);case"utf16":case"utf16be":return Zt.toString(n);default:throw new Error(`Unknown type of encoding '${e}'`)}}static FromString(t,e="utf8"){if(!t)return new ArrayBuffer(0);switch(e.toLowerCase()){case"utf8":return this.FromUtf8String(t);case"binary":return this.FromBinary(t);case"hex":return this.FromHex(t);case"base64":return this.FromBase64(t);case"base64url":return this.FromBase64Url(t);case"utf16le":return Zt.fromString(t,!0);case"utf16":case"utf16be":return Zt.fromString(t);default:throw new Error(`Unknown type of encoding '${e}'`)}}static ToBase64(t){let e=Ce.toUint8Array(t);if(typeof btoa<"u"){let n=this.ToString(e,"binary");return btoa(n)}else return Buffer.from(e).toString("base64")}static FromBase64(t){let e=this.formatString(t);if(!e)return new ArrayBuffer(0);if(!r.isBase64(e))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return typeof atob<"u"?this.FromBinary(atob(e)):new Uint8Array(Buffer.from(e,"base64")).buffer}static FromBase64Url(t){let e=this.formatString(t);if(!e)return new ArrayBuffer(0);if(!r.isBase64Url(e))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(e.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(t){return this.ToBase64(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(t,e=r.DEFAULT_UTF8_ENCODING){switch(e){case"ascii":return this.FromBinary(t);case"utf8":return cs.fromString(t);case"utf16":case"utf16be":return Zt.fromString(t);case"utf16le":case"usc2":return Zt.fromString(t,!0);default:throw new Error(`Unknown type of encoding '${e}'`)}}static ToUtf8String(t,e=r.DEFAULT_UTF8_ENCODING){switch(e){case"ascii":return this.ToBinary(t);case"utf8":return cs.toString(t);case"utf16":case"utf16be":return Zt.toString(t);case"utf16le":case"usc2":return Zt.toString(t,!0);default:throw new Error(`Unknown type of encoding '${e}'`)}}static FromBinary(t){let e=t.length,n=new Uint8Array(e);for(let o=0;o<e;o++)n[o]=t.charCodeAt(o);return n.buffer}static ToBinary(t){let e=Ce.toUint8Array(t),n="";for(let o=0;o<e.length;o++)n+=String.fromCharCode(e[o]);return n}static ToHex(t){let e=Ce.toUint8Array(t),n="",o=e.length;for(let s=0;s<o;s++){let i=e[s];i<16&&(n+="0"),n+=i.toString(16)}return n}static FromHex(t){let e=this.formatString(t);if(!e)return new ArrayBuffer(0);if(!r.isHex(e))throw new TypeError("Argument 'hexString' is not HEX encoded");e.length%2&&(e=`0${e}`);let n=new Uint8Array(e.length/2);for(let o=0;o<e.length;o=o+2){let s=e.slice(o,o+2);n[o/2]=parseInt(s,16)}return n.buffer}static ToUtf16String(t,e=!1){return Zt.toString(t,e)}static FromUtf16String(t,e=!1){return Zt.fromString(t,e)}static Base64Padding(t){let e=4-t.length%4;if(e<4)for(let n=0;n<e;n++)t+="=";return t}static formatString(t){return t?.replace(/[\n\r\t ]/g,"")||""}};ls.DEFAULT_UTF8_ENCODING="utf8";function E0(r,...t){let e=arguments[0];for(let n=1;n<arguments.length;n++){let o=arguments[n];for(let s in o)e[s]=o[s]}return e}function A0(...r){let t=r.map(o=>o.byteLength).reduce((o,s)=>o+s),e=new Uint8Array(t),n=0;return r.map(o=>new Uint8Array(o)).forEach(o=>{for(let s of o)e[n++]=s}),e.buffer}function S0(r,t){if(!(r&&t)||r.byteLength!==t.byteLength)return!1;let e=new Uint8Array(r),n=new Uint8Array(t);for(let o=0;o<r.byteLength;o++)if(e[o]!==n[o])return!1;return!0}Xr.BufferSourceConverter=Ce;Xr.Convert=ls;Xr.assign=E0;Xr.combine=A0;Xr.isEqual=S0});var yd=Qt(co=>{(function(){var r,t,e,n,o,s,i,a;a=function(c){var u,f,l,d;return u=(c&255<<24)>>>24,f=(c&255<<16)>>>16,l=(c&65280)>>>8,d=c&255,[u,f,l,d].join(".")},i=function(c){var u,f,l,d,h,p;for(u=[],l=d=0;d<=3&&c.length!==0;l=++d){if(l>0){if(c[0]!==".")throw new Error("Invalid IP");c=c.substring(1)}p=t(c),h=p[0],f=p[1],c=c.substring(f),u.push(h)}if(c.length!==0)throw new Error("Invalid IP");switch(u.length){case 1:if(u[0]>4294967295)throw new Error("Invalid IP");return u[0]>>>0;case 2:if(u[0]>255||u[1]>16777215)throw new Error("Invalid IP");return(u[0]<<24|u[1])>>>0;case 3:if(u[0]>255||u[1]>255||u[2]>65535)throw new Error("Invalid IP");return(u[0]<<24|u[1]<<16|u[2])>>>0;case 4:if(u[0]>255||u[1]>255||u[2]>255||u[3]>255)throw new Error("Invalid IP");return(u[0]<<24|u[1]<<16|u[2]<<8|u[3])>>>0;default:throw new Error("Invalid IP")}},e=function(c){return c.charCodeAt(0)},n=e("0"),s=e("a"),o=e("A"),t=function(c){var u,f,l,d,h;for(d=0,u=10,f="9",l=0,c.length>1&&c[l]==="0"&&(c[l+1]==="x"||c[l+1]==="X"?(l+=2,u=16):"0"<=c[l+1]&&c[l+1]<="9"&&(l++,u=8,f="7")),h=l;l<c.length;){if("0"<=c[l]&&c[l]<=f)d=d*u+(e(c[l])-n)>>>0;else if(u===16)if("a"<=c[l]&&c[l]<="f")d=d*u+(10+e(c[l])-s)>>>0;else if("A"<=c[l]&&c[l]<="F")d=d*u+(10+e(c[l])-o)>>>0;else break;else break;if(d>4294967295)throw new Error("too large");l++}if(l===h)throw new Error("empty octet");return[d,l]},r=function(){function c(u,f){var l,d,h,p;if(typeof u!="string")throw new Error("Missing `net' parameter");if(f||(p=u.split("/",2),u=p[0],f=p[1]),f||(f=32),typeof f=="string"&&f.indexOf(".")>-1){try{this.maskLong=i(f)}catch(m){throw l=m,new Error("Invalid mask: "+f)}for(d=h=32;h>=0;d=--h)if(this.maskLong===4294967295<<32-d>>>0){this.bitmask=d;break}}else if(f||f===0)this.bitmask=parseInt(f,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0);else throw new Error("Invalid mask: empty");try{this.netLong=(i(u)&this.maskLong)>>>0}catch(m){throw l=m,new Error("Invalid net address: "+u)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+f);this.size=Math.pow(2,32-this.bitmask),this.base=a(this.netLong),this.mask=a(this.maskLong),this.hostmask=a(~this.maskLong),this.first=this.bitmask<=30?a(this.netLong+1):this.base,this.last=this.bitmask<=30?a(this.netLong+this.size-2):a(this.netLong+this.size-1),this.broadcast=this.bitmask<=30?a(this.netLong+this.size-1):void 0}return c.prototype.contains=function(u){return typeof u=="string"&&(u.indexOf("/")>0||u.split(".").length!==4)&&(u=new c(u)),u instanceof c?this.contains(u.base)&&this.contains(u.broadcast||u.last):(i(u)&this.maskLong)>>>0===(this.netLong&this.maskLong)>>>0},c.prototype.next=function(u){return u==null&&(u=1),new c(a(this.netLong+this.size*u),this.mask)},c.prototype.forEach=function(u){var f,l,d;for(d=i(this.first),l=i(this.last),f=0;d<=l;)u(a(d),d,f),f++,d++},c.prototype.toString=function(){return this.base+"/"+this.bitmask},c}(),co.ip2long=i,co.long2ip=a,co.Netmask=r}).call(co)});var xd=Qt((aS,Cl)=>{"use strict";var Cy=Object.prototype.hasOwnProperty,Vt="~";function lo(){}Object.create&&(lo.prototype=Object.create(null),new lo().__proto__||(Vt=!1));function Ty(r,t,e){this.fn=r,this.context=t,this.once=e||!1}function bd(r,t,e,n,o){if(typeof e!="function")throw new TypeError("The listener must be a function");var s=new Ty(e,n||r,o),i=Vt?Vt+t:t;return r._events[i]?r._events[i].fn?r._events[i]=[r._events[i],s]:r._events[i].push(s):(r._events[i]=s,r._eventsCount++),r}function hi(r,t){--r._eventsCount===0?r._events=new lo:delete r._events[t]}function Nt(){this._events=new lo,this._eventsCount=0}Nt.prototype.eventNames=function(){var t=[],e,n;if(this._eventsCount===0)return t;for(n in e=this._events)Cy.call(e,n)&&t.push(Vt?n.slice(1):n);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Nt.prototype.listeners=function(t){var e=Vt?Vt+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,s=n.length,i=new Array(s);o<s;o++)i[o]=n[o].fn;return i};Nt.prototype.listenerCount=function(t){var e=Vt?Vt+t:t,n=this._events[e];return n?n.fn?1:n.length:0};Nt.prototype.emit=function(t,e,n,o,s,i){var a=Vt?Vt+t:t;if(!this._events[a])return!1;var c=this._events[a],u=arguments.length,f,l;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),u){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,n),!0;case 4:return c.fn.call(c.context,e,n,o),!0;case 5:return c.fn.call(c.context,e,n,o,s),!0;case 6:return c.fn.call(c.context,e,n,o,s,i),!0}for(l=1,f=new Array(u-1);l<u;l++)f[l-1]=arguments[l];c.fn.apply(c.context,f)}else{var d=c.length,h;for(l=0;l<d;l++)switch(c[l].once&&this.removeListener(t,c[l].fn,void 0,!0),u){case 1:c[l].fn.call(c[l].context);break;case 2:c[l].fn.call(c[l].context,e);break;case 3:c[l].fn.call(c[l].context,e,n);break;case 4:c[l].fn.call(c[l].context,e,n,o);break;default:if(!f)for(h=1,f=new Array(u-1);h<u;h++)f[h-1]=arguments[h];c[l].fn.apply(c[l].context,f)}}return!0};Nt.prototype.on=function(t,e,n){return bd(this,t,e,n,!1)};Nt.prototype.once=function(t,e,n){return bd(this,t,e,n,!0)};Nt.prototype.removeListener=function(t,e,n,o){var s=Vt?Vt+t:t;if(!this._events[s])return this;if(!e)return hi(this,s),this;var i=this._events[s];if(i.fn)i.fn===e&&(!o||i.once)&&(!n||i.context===n)&&hi(this,s);else{for(var a=0,c=[],u=i.length;a<u;a++)(i[a].fn!==e||o&&!i[a].once||n&&i[a].context!==n)&&c.push(i[a]);c.length?this._events[s]=c.length===1?c[0]:c:hi(this,s)}return this};Nt.prototype.removeAllListeners=function(t){var e;return t?(e=Vt?Vt+t:t,this._events[e]&&hi(this,e)):(this._events=new lo,this._eventsCount=0),this};Nt.prototype.off=Nt.prototype.removeListener;Nt.prototype.addListener=Nt.prototype.on;Nt.prefixed=Vt;Nt.EventEmitter=Nt;typeof Cl<"u"&&(Cl.exports=Nt)});var _d=Qt((TS,Sd)=>{Sd.exports=function(r){if(!r)throw Error("hashlru must have a max value, of type number, greater than 0");var t=0,e=Object.create(null),n=Object.create(null);function o(s,i){e[s]=i,t++,t>=r&&(t=0,n=e,e=Object.create(null))}return{has:function(s){return e[s]!==void 0||n[s]!==void 0},remove:function(s){e[s]!==void 0&&(e[s]=void 0),n[s]!==void 0&&(n[s]=void 0)},get:function(s){var i=e[s];if(i!==void 0)return i;if((i=n[s])!==void 0)return o(s,i),i},set:function(s,i){e[s]!==void 0?e[s]=i:o(s,i)},clear:function(){e=Object.create(null),n=Object.create(null)}}}});var Td=Qt((WS,Cd)=>{"use strict";Cd.exports=r=>{if(Object.prototype.toString.call(r)!=="[object Object]")return!1;let t=Object.getPrototypeOf(r);return t===null||t===Object.prototype}});var Md=Qt((Rd,Dd)=>{"use strict";var gi=Td(),{hasOwnProperty:Nd}=Object.prototype,{propertyIsEnumerable:Dy}=Object,hn=(r,t,e)=>Object.defineProperty(r,t,{value:e,writable:!0,enumerable:!0,configurable:!0}),My=Rd,Ld={concatArrays:!1,ignoreUndefined:!1},yi=r=>{let t=[];for(let e in r)Nd.call(r,e)&&t.push(e);if(Object.getOwnPropertySymbols){let e=Object.getOwnPropertySymbols(r);for(let n of e)Dy.call(r,n)&&t.push(n)}return t};function dn(r){return Array.isArray(r)?Uy(r):gi(r)?Oy(r):r}function Uy(r){let t=r.slice(0,0);return yi(r).forEach(e=>{hn(t,e,dn(r[e]))}),t}function Oy(r){let t=Object.getPrototypeOf(r)===null?Object.create(null):{};return yi(r).forEach(e=>{hn(t,e,dn(r[e]))}),t}var Pd=(r,t,e,n)=>(e.forEach(o=>{typeof t[o]>"u"&&n.ignoreUndefined||(o in r&&r[o]!==Object.getPrototypeOf(r)?hn(r,o,Ul(r[o],t[o],n)):hn(r,o,dn(t[o])))}),r),Fy=(r,t,e)=>{let n=r.slice(0,0),o=0;return[r,t].forEach(s=>{let i=[];for(let a=0;a<s.length;a++)Nd.call(s,a)&&(i.push(String(a)),s===r?hn(n,o++,s[a]):hn(n,o++,dn(s[a])));n=Pd(n,s,yi(s).filter(a=>!i.includes(a)),e)}),n};function Ul(r,t,e){return e.concatArrays&&Array.isArray(r)&&Array.isArray(t)?Fy(r,t,e):!gi(t)||!gi(r)?dn(t):Pd(r,t,yi(t),e)}Dd.exports=function(...r){let t=Ul(dn(Ld),this!==My&&this||{},Ld),e={_:{}};for(let n of r)if(n!==void 0){if(!gi(n))throw new TypeError("`"+n+"` is not an Option Object");e=Ul(e,{_:n},t)}return e._}});var Vd=Qt((po,Si)=>{(function(r,t){"use strict";var e={version:"3.0.0",x86:{},x64:{},inputValidation:!0};function n(h){if(!Array.isArray(h)&&!ArrayBuffer.isView(h))return!1;for(var p=0;p<h.length;p++)if(!Number.isInteger(h[p])||h[p]<0||h[p]>255)return!1;return!0}function o(h,p){return(h&65535)*p+(((h>>>16)*p&65535)<<16)}function s(h,p){return h<<p|h>>>32-p}function i(h){return h^=h>>>16,h=o(h,2246822507),h^=h>>>13,h=o(h,3266489909),h^=h>>>16,h}function a(h,p){h=[h[0]>>>16,h[0]&65535,h[1]>>>16,h[1]&65535],p=[p[0]>>>16,p[0]&65535,p[1]>>>16,p[1]&65535];var m=[0,0,0,0];return m[3]+=h[3]+p[3],m[2]+=m[3]>>>16,m[3]&=65535,m[2]+=h[2]+p[2],m[1]+=m[2]>>>16,m[2]&=65535,m[1]+=h[1]+p[1],m[0]+=m[1]>>>16,m[1]&=65535,m[0]+=h[0]+p[0],m[0]&=65535,[m[0]<<16|m[1],m[2]<<16|m[3]]}function c(h,p){h=[h[0]>>>16,h[0]&65535,h[1]>>>16,h[1]&65535],p=[p[0]>>>16,p[0]&65535,p[1]>>>16,p[1]&65535];var m=[0,0,0,0];return m[3]+=h[3]*p[3],m[2]+=m[3]>>>16,m[3]&=65535,m[2]+=h[2]*p[3],m[1]+=m[2]>>>16,m[2]&=65535,m[2]+=h[3]*p[2],m[1]+=m[2]>>>16,m[2]&=65535,m[1]+=h[1]*p[3],m[0]+=m[1]>>>16,m[1]&=65535,m[1]+=h[2]*p[2],m[0]+=m[1]>>>16,m[1]&=65535,m[1]+=h[3]*p[1],m[0]+=m[1]>>>16,m[1]&=65535,m[0]+=h[0]*p[3]+h[1]*p[2]+h[2]*p[1]+h[3]*p[0],m[0]&=65535,[m[0]<<16|m[1],m[2]<<16|m[3]]}function u(h,p){return p%=64,p===32?[h[1],h[0]]:p<32?[h[0]<<p|h[1]>>>32-p,h[1]<<p|h[0]>>>32-p]:(p-=32,[h[1]<<p|h[0]>>>32-p,h[0]<<p|h[1]>>>32-p])}function f(h,p){return p%=64,p===0?h:p<32?[h[0]<<p|h[1]>>>32-p,h[1]<<p]:[h[1]<<p-32,0]}function l(h,p){return[h[0]^p[0],h[1]^p[1]]}function d(h){return h=l(h,[0,h[0]>>>1]),h=c(h,[4283543511,3981806797]),h=l(h,[0,h[0]>>>1]),h=c(h,[3301882366,444984403]),h=l(h,[0,h[0]>>>1]),h}e.x86.hash32=function(h,p){if(e.inputValidation&&!n(h))return t;p=p||0;for(var m=h.length%4,g=h.length-m,y=p,b=0,w=3432918353,x=461845907,A=0;A<g;A=A+4)b=h[A]|h[A+1]<<8|h[A+2]<<16|h[A+3]<<24,b=o(b,w),b=s(b,15),b=o(b,x),y^=b,y=s(y,13),y=o(y,5)+3864292196;switch(b=0,m){case 3:b^=h[A+2]<<16;case 2:b^=h[A+1]<<8;case 1:b^=h[A],b=o(b,w),b=s(b,15),b=o(b,x),y^=b}return y^=h.length,y=i(y),y>>>0},e.x86.hash128=function(h,p){if(e.inputValidation&&!n(h))return t;p=p||0;for(var m=h.length%16,g=h.length-m,y=p,b=p,w=p,x=p,A=0,_=0,v=0,B=0,T=597399067,et=2869860233,V=951274213,F=2716044179,R=0;R<g;R=R+16)A=h[R]|h[R+1]<<8|h[R+2]<<16|h[R+3]<<24,_=h[R+4]|h[R+5]<<8|h[R+6]<<16|h[R+7]<<24,v=h[R+8]|h[R+9]<<8|h[R+10]<<16|h[R+11]<<24,B=h[R+12]|h[R+13]<<8|h[R+14]<<16|h[R+15]<<24,A=o(A,T),A=s(A,15),A=o(A,et),y^=A,y=s(y,19),y+=b,y=o(y,5)+1444728091,_=o(_,et),_=s(_,16),_=o(_,V),b^=_,b=s(b,17),b+=w,b=o(b,5)+197830471,v=o(v,V),v=s(v,17),v=o(v,F),w^=v,w=s(w,15),w+=x,w=o(w,5)+2530024501,B=o(B,F),B=s(B,18),B=o(B,T),x^=B,x=s(x,13),x+=y,x=o(x,5)+850148119;switch(A=0,_=0,v=0,B=0,m){case 15:B^=h[R+14]<<16;case 14:B^=h[R+13]<<8;case 13:B^=h[R+12],B=o(B,F),B=s(B,18),B=o(B,T),x^=B;case 12:v^=h[R+11]<<24;case 11:v^=h[R+10]<<16;case 10:v^=h[R+9]<<8;case 9:v^=h[R+8],v=o(v,V),v=s(v,17),v=o(v,F),w^=v;case 8:_^=h[R+7]<<24;case 7:_^=h[R+6]<<16;case 6:_^=h[R+5]<<8;case 5:_^=h[R+4],_=o(_,et),_=s(_,16),_=o(_,V),b^=_;case 4:A^=h[R+3]<<24;case 3:A^=h[R+2]<<16;case 2:A^=h[R+1]<<8;case 1:A^=h[R],A=o(A,T),A=s(A,15),A=o(A,et),y^=A}return y^=h.length,b^=h.length,w^=h.length,x^=h.length,y+=b,y+=w,y+=x,b+=y,w+=y,x+=y,y=i(y),b=i(b),w=i(w),x=i(x),y+=b,y+=w,y+=x,b+=y,w+=y,x+=y,("00000000"+(y>>>0).toString(16)).slice(-8)+("00000000"+(b>>>0).toString(16)).slice(-8)+("00000000"+(w>>>0).toString(16)).slice(-8)+("00000000"+(x>>>0).toString(16)).slice(-8)},e.x64.hash128=function(h,p){if(e.inputValidation&&!n(h))return t;p=p||0;for(var m=h.length%16,g=h.length-m,y=[0,p],b=[0,p],w=[0,0],x=[0,0],A=[2277735313,289559509],_=[1291169091,658871167],v=0;v<g;v=v+16)w=[h[v+4]|h[v+5]<<8|h[v+6]<<16|h[v+7]<<24,h[v]|h[v+1]<<8|h[v+2]<<16|h[v+3]<<24],x=[h[v+12]|h[v+13]<<8|h[v+14]<<16|h[v+15]<<24,h[v+8]|h[v+9]<<8|h[v+10]<<16|h[v+11]<<24],w=c(w,A),w=u(w,31),w=c(w,_),y=l(y,w),y=u(y,27),y=a(y,b),y=a(c(y,[0,5]),[0,1390208809]),x=c(x,_),x=u(x,33),x=c(x,A),b=l(b,x),b=u(b,31),b=a(b,y),b=a(c(b,[0,5]),[0,944331445]);switch(w=[0,0],x=[0,0],m){case 15:x=l(x,f([0,h[v+14]],48));case 14:x=l(x,f([0,h[v+13]],40));case 13:x=l(x,f([0,h[v+12]],32));case 12:x=l(x,f([0,h[v+11]],24));case 11:x=l(x,f([0,h[v+10]],16));case 10:x=l(x,f([0,h[v+9]],8));case 9:x=l(x,[0,h[v+8]]),x=c(x,_),x=u(x,33),x=c(x,A),b=l(b,x);case 8:w=l(w,f([0,h[v+7]],56));case 7:w=l(w,f([0,h[v+6]],48));case 6:w=l(w,f([0,h[v+5]],40));case 5:w=l(w,f([0,h[v+4]],32));case 4:w=l(w,f([0,h[v+3]],24));case 3:w=l(w,f([0,h[v+2]],16));case 2:w=l(w,f([0,h[v+1]],8));case 1:w=l(w,[0,h[v]]),w=c(w,A),w=u(w,31),w=c(w,_),y=l(y,w)}return y=l(y,[0,h.length]),b=l(b,[0,h.length]),y=a(y,b),b=a(b,y),y=d(y),b=d(b),y=a(y,b),b=a(b,y),("00000000"+(y[0]>>>0).toString(16)).slice(-8)+("00000000"+(y[1]>>>0).toString(16)).slice(-8)+("00000000"+(b[0]>>>0).toString(16)).slice(-8)+("00000000"+(b[1]>>>0).toString(16)).slice(-8)},typeof po<"u"?(typeof Si<"u"&&Si.exports&&(po=Si.exports=e),po.murmurHash3=e):typeof define=="function"&&define.amd?define([],function(){return e}):(e._murmurHash3=r.murmurHash3,e.noConflict=function(){return r.murmurHash3=e._murmurHash3,e._murmurHash3=t,e.noConflict=t,e},r.murmurHash3=e)})(po)});var $d=Qt((E8,Hd)=>{Hd.exports=Vd()});var vp=Qt((iB,xp)=>{function Jt(r,t){typeof t=="boolean"&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(r)),this._timeouts=r,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}xp.exports=Jt;Jt.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};Jt.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};Jt.prototype.retry=function(r){if(this._timeout&&clearTimeout(this._timeout),!r)return!1;var t=new Date().getTime();if(r&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(r),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(r);var e=this._timeouts.shift();if(e===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),e=this._cachedTimeouts.slice(-1);else return!1;var n=this;return this._timer=setTimeout(function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout(function(){n._operationTimeoutCb(n._attempts)},n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)},e),this._options.unref&&this._timer.unref(),!0};Jt.prototype.attempt=function(r,t){this._fn=r,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var e=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){e._operationTimeoutCb()},e._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};Jt.prototype.try=function(r){console.log("Using RetryOperation.try() is deprecated"),this.attempt(r)};Jt.prototype.start=function(r){console.log("Using RetryOperation.start() is deprecated"),this.attempt(r)};Jt.prototype.start=Jt.prototype.try;Jt.prototype.errors=function(){return this._errors};Jt.prototype.attempts=function(){return this._attempts};Jt.prototype.mainError=function(){if(this._errors.length===0)return null;for(var r={},t=null,e=0,n=0;n<this._errors.length;n++){var o=this._errors[n],s=o.message,i=(r[s]||0)+1;r[s]=i,i>=e&&(t=o,e=i)}return t}});var Ep=Qt(Cr=>{var Vw=vp();Cr.operation=function(r){var t=Cr.timeouts(r);return new Vw(t,{forever:r&&(r.forever||r.retries===1/0),unref:r&&r.unref,maxRetryTime:r&&r.maxRetryTime})};Cr.timeouts=function(r){if(r instanceof Array)return[].concat(r);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var e in r)t[e]=r[e];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var n=[],o=0;o<t.retries;o++)n.push(this.createTimeout(o,t));return r&&r.forever&&!n.length&&n.push(this.createTimeout(o,t)),n.sort(function(s,i){return s-i}),n};Cr.createTimeout=function(r,t){var e=t.randomize?Math.random()+1:1,n=Math.round(e*Math.max(t.minTimeout,1)*Math.pow(t.factor,r));return n=Math.min(n,t.maxTimeout),n};Cr.wrap=function(r,t,e){if(t instanceof Array&&(e=t,t=null),!e){e=[];for(var n in r)typeof r[n]=="function"&&e.push(n)}for(var o=0;o<e.length;o++){var s=e[o],i=r[s];r[s]=function(c){var u=Cr.operation(t),f=Array.prototype.slice.call(arguments,1),l=f.pop();f.push(function(d){u.retry(d)||(d&&(arguments[0]=u.mainError()),l.apply(this,arguments))}),u.attempt(function(){c.apply(r,f)})}.bind(r,i),r[s].options=t}}});var Sp=Qt((cB,Ap)=>{Ap.exports=Ep()});var pb={};Rt(pb,{createLibp2p:()=>db});var Ru=Symbol.for("@libp2p/connection");var La=Symbol.for("@libp2p/content-routing");var Na=Symbol.for("@libp2p/peer-discovery");var No=Symbol.for("@libp2p/peer-id");function Po(r){return!!r?.[No]}var Pa=Symbol.for("@libp2p/peer-routing");var Ra="keep-alive";var Eb=Symbol.for("@libp2p/transport");var Oe;(function(r){r[r.FATAL_ALL=0]="FATAL_ALL",r[r.NO_FATAL=1]="NO_FATAL"})(Oe||(Oe={}));var be=class extends Error{static name="AbortError";constructor(t="The operation was aborted"){super(t),this.name="AbortError"}};var D=class extends Error{static name="InvalidParametersError";constructor(t="Invalid parameters"){super(t),this.name="InvalidParametersError"}},Nr=class extends Error{static name="InvalidPublicKeyError";constructor(t="Invalid public key"){super(t),this.name="InvalidPublicKeyError"}},_n=class extends Error{static name="InvalidPrivateKeyError";constructor(t="Invalid private key"){super(t),this.name="InvalidPrivateKeyError"}};var Ro=class extends Error{static name="ConnectionClosingError";constructor(t="The connection is closing"){super(t),this.name="ConnectionClosingError"}},Do=class extends Error{static name="ConnectionClosedError";constructor(t="The connection is closed"){super(t),this.name="ConnectionClosedError"}};var Mo=class extends Error{static name="NotFoundError";constructor(t="Not found"){super(t),this.name="NotFoundError"}},Uo=class extends Error{static name="InvalidPeerIdError";constructor(t="Invalid PeerID"){super(t),this.name="InvalidPeerIdError"}},Pr=class extends Error{static name="InvalidMultiaddrError";constructor(t="Invalid multiaddr"){super(t),this.name="InvalidMultiaddrError"}},Oo=class extends Error{static name="InvalidCIDError";constructor(t="Invalid CID"){super(t),this.name="InvalidCIDError"}},Fo=class extends Error{static name="InvalidMultihashError";constructor(t="Invalid Multihash"){super(t),this.name="InvalidMultihashError"}},Bn=class extends Error{static name="UnsupportedProtocolError";constructor(t="Unsupported protocol error"){super(t),this.name="UnsupportedProtocolError"}},Vo=class extends Error{static name="InvalidMessageError";constructor(t="Invalid message"){super(t),this.name="InvalidMessageError"}};var Rr=class extends Error{static name="TimeoutError";constructor(t="Timed out"){super(t),this.name="TimeoutError"}},xe=class extends Error{static name="NotStartedError";constructor(t="Not started"){super(t),this.name="NotStartedError"}};var Dr=class extends Error{static name="DialError";constructor(t="Dial error"){super(t),this.name="DialError"}};var Mr=class extends Error{static name="LimitedConnectionError";constructor(t="Limited connection"){super(t),this.name="LimitedConnectionError"}},Ho=class extends Error{static name="TooManyInboundProtocolStreamsError";constructor(t="Too many inbound protocol streams"){super(t),this.name="TooManyInboundProtocolStreamsError"}},$o=class extends Error{static name="TooManyOutboundProtocolStreamsError";constructor(t="Too many outbound protocol streams"){super(t),this.name="TooManyOutboundProtocolStreamsError"}},Fe=class extends Error{static name="UnsupportedKeyTypeError";constructor(t="Unsupported key type"){super(t),this.name="UnsupportedKeyTypeError"}};var tt=(r,...t)=>{try{[...t]}catch{}};var ve=class extends EventTarget{#t=new Map;constructor(){super(),tt(1/0,this)}listenerCount(t){let e=this.#t.get(t);return e==null?0:e.length}addEventListener(t,e,n){super.addEventListener(t,e,n);let o=this.#t.get(t);o==null&&(o=[],this.#t.set(t,o)),o.push({callback:e,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(t,e,n){super.removeEventListener(t.toString(),e??null,n);let o=this.#t.get(t);o!=null&&(o=o.filter(({callback:s})=>s!==e),this.#t.set(t,o))}dispatchEvent(t){let e=super.dispatchEvent(t),n=this.#t.get(t.type);return n==null||(n=n.filter(({once:o})=>!o),this.#t.set(t.type,n)),e}safeDispatchEvent(t,e={}){return this.dispatchEvent(new CustomEvent(t,e))}};function Ko(r){return r!=null&&typeof r.start=="function"&&typeof r.stop=="function"}async function Du(...r){let t=[];for(let e of r)Ko(e)&&t.push(e);await Promise.all(t.map(async e=>{e.beforeStart!=null&&await e.beforeStart()})),await Promise.all(t.map(async e=>{await e.start()})),await Promise.all(t.map(async e=>{e.afterStart!=null&&await e.afterStart()}))}async function Mu(...r){let t=[];for(let e of r)Ko(e)&&t.push(e);await Promise.all(t.map(async e=>{e.beforeStop!=null&&await e.beforeStop()})),await Promise.all(t.map(async e=>{await e.stop()})),await Promise.all(t.map(async e=>{e.afterStop!=null&&await e.afterStop()}))}var In=Symbol.for("@libp2p/service-capabilities"),Da=Symbol.for("@libp2p/service-dependencies");var Va={};Rt(Va,{base58btc:()=>W,base58flickr:()=>em});var Jb=new Uint8Array(0);function Uu(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}function Ee(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 Ou(r){return new TextEncoder().encode(r)}function Fu(r){return new TextDecoder().decode(r)}function Xp(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var o=0;o<r.length;o++){var s=r.charAt(o),i=s.charCodeAt(0);if(e[i]!==255)throw new TypeError(s+" is ambiguous");e[i]=o}var a=r.length,c=r.charAt(0),u=Math.log(a)/Math.log(256),f=Math.log(256)/Math.log(a);function l(p){if(p instanceof Uint8Array||(ArrayBuffer.isView(p)?p=new Uint8Array(p.buffer,p.byteOffset,p.byteLength):Array.isArray(p)&&(p=Uint8Array.from(p))),!(p instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(p.length===0)return"";for(var m=0,g=0,y=0,b=p.length;y!==b&&p[y]===0;)y++,m++;for(var w=(b-y)*f+1>>>0,x=new Uint8Array(w);y!==b;){for(var A=p[y],_=0,v=w-1;(A!==0||_<g)&&v!==-1;v--,_++)A+=256*x[v]>>>0,x[v]=A%a>>>0,A=A/a>>>0;if(A!==0)throw new Error("Non-zero carry");g=_,y++}for(var B=w-g;B!==w&&x[B]===0;)B++;for(var T=c.repeat(m);B<w;++B)T+=r.charAt(x[B]);return T}function d(p){if(typeof p!="string")throw new TypeError("Expected String");if(p.length===0)return new Uint8Array;var m=0;if(p[m]!==" "){for(var g=0,y=0;p[m]===c;)g++,m++;for(var b=(p.length-m)*u+1>>>0,w=new Uint8Array(b);p[m];){var x=e[p.charCodeAt(m)];if(x===255)return;for(var A=0,_=b-1;(x!==0||A<y)&&_!==-1;_--,A++)x+=a*w[_]>>>0,w[_]=x%256>>>0,x=x/256>>>0;if(x!==0)throw new Error("Non-zero carry");y=A,m++}if(p[m]!==" "){for(var v=b-y;v!==b&&w[v]===0;)v++;for(var B=new Uint8Array(g+(b-v)),T=g;v!==b;)B[T++]=w[v++];return B}}}function h(p){var m=d(p);if(m)return m;throw new Error(`Non-${t} character`)}return{encode:l,decodeUnsafe:d,decode:h}}var Yp=Xp,Jp=Yp,Hu=Jp;var Ma=class{name;prefix;baseEncode;constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},Ua=class{name;prefix;baseDecode;prefixCodePoint;constructor(t,e,n){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return $u(this,t)}},Oa=class{decoders;constructor(t){this.decoders=t}or(t){return $u(this,t)}decode(t){let e=t[0],n=this.decoders[e];if(n!=null)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function $u(r,t){return new Oa({...r.decoders??{[r.prefix]:r},...t.decoders??{[t.prefix]:t}})}var Fa=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(t,e,n,o){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=o,this.encoder=new Ma(t,e,n),this.decoder=new Ua(t,e,o)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};function Ur({name:r,prefix:t,encode:e,decode:n}){return new Fa(r,t,e,n)}function Ve({name:r,prefix:t,alphabet:e}){let{encode:n,decode:o}=Hu(e,r);return Ur({prefix:t,name:r,encode:n,decode:s=>Ee(o(s))})}function Qp(r,t,e,n){let o={};for(let f=0;f<t.length;++f)o[t[f]]=f;let s=r.length;for(;r[s-1]==="=";)--s;let i=new Uint8Array(s*e/8|0),a=0,c=0,u=0;for(let f=0;f<s;++f){let l=o[r[f]];if(l===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<e|l,a+=e,a>=8&&(a-=8,i[u++]=255&c>>a)}if(a>=e||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return i}function tm(r,t,e){let n=t[t.length-1]==="=",o=(1<<e)-1,s="",i=0,a=0;for(let c=0;c<r.length;++c)for(a=a<<8|r[c],i+=8;i>e;)i-=e,s+=t[o&a>>i];if(i!==0&&(s+=t[o&a<<e-i]),n)for(;s.length*e&7;)s+="=";return s}function st({name:r,prefix:t,bitsPerChar:e,alphabet:n}){return Ur({prefix:t,name:r,encode(o){return tm(o,n,e)},decode(o){return Qp(o,n,e,r)}})}var W=Ve({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),em=Ve({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Ha={};Rt(Ha,{base32:()=>zt,base32hex:()=>sm,base32hexpad:()=>am,base32hexpadupper:()=>cm,base32hexupper:()=>im,base32pad:()=>nm,base32padupper:()=>om,base32upper:()=>rm,base32z:()=>lm});var zt=st({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),rm=st({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),nm=st({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),om=st({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),sm=st({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),im=st({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),am=st({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),cm=st({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),lm=st({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var um=zu,Ku=128,fm=127,hm=~fm,dm=Math.pow(2,31);function zu(r,t,e){t=t||[],e=e||0;for(var n=e;r>=dm;)t[e++]=r&255|Ku,r/=128;for(;r&hm;)t[e++]=r&255|Ku,r>>>=7;return t[e]=r|0,zu.bytes=e-n+1,t}var pm=$a,mm=128,qu=127;function $a(r,n){var e=0,n=n||0,o=0,s=n,i,a=r.length;do{if(s>=a)throw $a.bytes=0,new RangeError("Could not decode varint");i=r[s++],e+=o<28?(i&qu)<<o:(i&qu)*Math.pow(2,o),o+=7}while(i>=mm);return $a.bytes=s-n,e}var gm=Math.pow(2,7),ym=Math.pow(2,14),wm=Math.pow(2,21),bm=Math.pow(2,28),xm=Math.pow(2,35),vm=Math.pow(2,42),Em=Math.pow(2,49),Am=Math.pow(2,56),Sm=Math.pow(2,63),_m=function(r){return r<gm?1:r<ym?2:r<wm?3:r<bm?4:r<xm?5:r<vm?6:r<Em?7:r<Am?8:r<Sm?9:10},Bm={encode:um,decode:pm,encodingLength:_m},Im=Bm,kn=Im;function Cn(r,t=0){return[kn.decode(r,t),kn.decode.bytes]}function Or(r,t,e=0){return kn.encode(r,t,e),t}function Fr(r){return kn.encodingLength(r)}function te(r,t){let e=t.byteLength,n=Fr(r),o=n+Fr(e),s=new Uint8Array(o+e);return Or(r,s,0),Or(e,s,n),s.set(t,o),new Vr(r,e,t,s)}function ee(r){let t=Ee(r),[e,n]=Cn(t),[o,s]=Cn(t.subarray(n)),i=t.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new Vr(e,o,i,t)}function Gu(r,t){if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&Uu(r.bytes,e.bytes)}}var Vr=class{code;size;digest;bytes;constructor(t,e,n,o){this.code=t,this.size=e,this.digest=n,this.bytes=o}};function Wu(r,t){let{bytes:e,version:n}=r;switch(n){case 0:return Cm(e,Ka(r),t??W.encoder);default:return Tm(e,Ka(r),t??zt.encoder)}}var ju=new WeakMap;function Ka(r){let t=ju.get(r);if(t==null){let e=new Map;return ju.set(r,e),e}return t}var pt=class r{code;version;multihash;bytes;"/";constructor(t,e,n,o){this.code=e,this.version=t,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:e}=this;if(t!==Tn)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==Lm)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(e)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:e}=this.multihash,n=te(t,e);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return r.equals(this,t)}static equals(t,e){let n=e;return n!=null&&t.code===n.code&&t.version===n.version&&Gu(t.multihash,n.multihash)}toString(t){return Wu(this,t)}toJSON(){return{"/":Wu(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let e=t;if(e instanceof r)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:n,code:o,multihash:s,bytes:i}=e;return new r(n,o,s,i??Zu(n,o,s.bytes))}else if(e[Nm]===!0){let{version:n,multihash:o,code:s}=e,i=ee(o);return r.create(n,s,i)}else return null}static create(t,e,n){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==Tn)throw new Error(`Version 0 CID must use dag-pb (code: ${Tn}) block encoding`);return new r(t,e,n,n.bytes)}case 1:{let o=Zu(t,e,n.bytes);return new r(t,e,n,o)}default:throw new Error("Invalid version")}}static createV0(t){return r.create(0,Tn,t)}static createV1(t,e){return r.create(1,t,e)}static decode(t){let[e,n]=r.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=r.inspectBytes(t),n=e.size-e.multihashSize,o=Ee(t.subarray(n,n+e.multihashSize));if(o.byteLength!==e.multihashSize)throw new Error("Incorrect length");let s=o.subarray(e.multihashSize-e.digestSize),i=new Vr(e.multihashCode,e.digestSize,s,o);return[e.version===0?r.createV0(i):r.createV1(e.codec,i),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[l,d]=Cn(t.subarray(e));return e+=d,l},o=n(),s=Tn;if(o===18?(o=0,e=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=e,a=n(),c=n(),u=e+c,f=u-i;return{version:o,codec:s,multihashCode:a,digestSize:c,multihashSize:f,size:u}}static parse(t,e){let[n,o]=km(t,e),s=r.decode(o);if(s.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Ka(s).set(n,t),s}};function km(r,t){switch(r[0]){case"Q":{let e=t??W;return[W.prefix,e.decode(`${W.prefix}${r}`)]}case W.prefix:{let e=t??W;return[W.prefix,e.decode(r)]}case zt.prefix:{let e=t??zt;return[zt.prefix,e.decode(r)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],t.decode(r)]}}}function Cm(r,t,e){let{prefix:n}=e;if(n!==W.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let o=t.get(n);if(o==null){let s=e.encode(r).slice(1);return t.set(n,s),s}else return o}function Tm(r,t,e){let{prefix:n}=e,o=t.get(n);if(o==null){let s=e.encode(r);return t.set(n,s),s}else return o}var Tn=112,Lm=18;function Zu(r,t,e){let n=Fr(r),o=n+Fr(t),s=new Uint8Array(o+e.byteLength);return Or(r,s,0),Or(t,s,n),s.set(e,o),s}var Nm=Symbol.for("@ipld/js-cid/CID");var qa={};Rt(qa,{identity:()=>Se});var Xu=0,Pm="identity",Yu=Ee;function Rm(r){return te(Xu,Yu(r))}var Se={code:Xu,name:Pm,encode:Yu,digest:Rm};function it(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}function Ju(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`positive integer expected, not ${r}`)}function Dm(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function Hr(r,...t){if(!Dm(r))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(r.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${r.length}`)}function Qu(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Ju(r.outputLen),Ju(r.blockLen)}function $r(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function tf(r,t){Hr(r);let e=t.outputLen;if(r.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}var ir=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var zo=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),re=(r,t)=>r<<32-t|r>>>t;var bx=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function ef(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function Ln(r){return typeof r=="string"&&(r=ef(r)),Hr(r),r}function za(...r){let t=0;for(let n=0;n<r.length;n++){let o=r[n];Hr(o),t+=o.length}let e=new Uint8Array(t);for(let n=0,o=0;n<r.length;n++){let s=r[n];e.set(s,o),o+=s.length}return e}var Kr=class{clone(){return this._cloneInto()}},xx={}.toString;function Go(r){let t=n=>r().update(Ln(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function qr(r=32){if(ir&&typeof ir.getRandomValues=="function")return ir.getRandomValues(new Uint8Array(r));if(ir&&typeof ir.randomBytes=="function")return ir.randomBytes(r);throw new Error("crypto.getRandomValues must be defined")}function Mm(r,t,e,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(t,e,n);let o=BigInt(32),s=BigInt(4294967295),i=Number(e>>o&s),a=Number(e&s),c=n?4:0,u=n?0:4;r.setUint32(t+c,i,n),r.setUint32(t+u,a,n)}var rf=(r,t,e)=>r&t^~r&e,nf=(r,t,e)=>r&t^r&e^t&e,zr=class extends Kr{constructor(t,e,n,o){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=zo(this.buffer)}update(t){$r(this);let{view:e,buffer:n,blockLen:o}=this;t=Ln(t);let s=t.length;for(let i=0;i<s;){let a=Math.min(o-this.pos,s-i);if(a===o){let c=zo(t);for(;o<=s-i;i+=o)this.process(c,i);continue}n.set(t.subarray(i,i+a),this.pos),this.pos+=a,i+=a,this.pos===o&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){$r(this),tf(t,this),this.finished=!0;let{buffer:e,view:n,blockLen:o,isLE:s}=this,{pos:i}=this;e[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>o-i&&(this.process(n,0),i=0);for(let l=i;l<o;l++)e[l]=0;Mm(n,o-8,BigInt(this.length*8),s),this.process(n,0);let a=zo(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let u=c/4,f=this.get();if(u>f.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<u;l++)a.setUint32(4*l,f[l],s)}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:e,buffer:n,length:o,finished:s,destroyed:i,pos:a}=this;return t.length=o,t.pos=a,t.finished=s,t.destroyed=i,o%e&&t.buffer.set(n),t}};var Wo=BigInt(4294967295),Ga=BigInt(32);function of(r,t=!1){return t?{h:Number(r&Wo),l:Number(r>>Ga&Wo)}:{h:Number(r>>Ga&Wo)|0,l:Number(r&Wo)|0}}function Um(r,t=!1){let e=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let o=0;o<r.length;o++){let{h:s,l:i}=of(r[o],t);[e[o],n[o]]=[s,i]}return[e,n]}var Om=(r,t)=>BigInt(r>>>0)<<Ga|BigInt(t>>>0),Fm=(r,t,e)=>r>>>e,Vm=(r,t,e)=>r<<32-e|t>>>e,Hm=(r,t,e)=>r>>>e|t<<32-e,$m=(r,t,e)=>r<<32-e|t>>>e,Km=(r,t,e)=>r<<64-e|t>>>e-32,qm=(r,t,e)=>r>>>e-32|t<<64-e,zm=(r,t)=>t,Gm=(r,t)=>r,Wm=(r,t,e)=>r<<e|t>>>32-e,jm=(r,t,e)=>t<<e|r>>>32-e,Zm=(r,t,e)=>t<<e-32|r>>>64-e,Xm=(r,t,e)=>r<<e-32|t>>>64-e;function Ym(r,t,e,n){let o=(t>>>0)+(n>>>0);return{h:r+e+(o/2**32|0)|0,l:o|0}}var Jm=(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),Qm=(r,t,e,n)=>t+e+n+(r/2**32|0)|0,tg=(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),eg=(r,t,e,n,o)=>t+e+n+o+(r/2**32|0)|0,rg=(r,t,e,n,o)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(o>>>0),ng=(r,t,e,n,o,s)=>t+e+n+o+s+(r/2**32|0)|0;var og={fromBig:of,split:Um,toBig:Om,shrSH:Fm,shrSL:Vm,rotrSH:Hm,rotrSL:$m,rotrBH:Km,rotrBL:qm,rotr32H:zm,rotr32L:Gm,rotlSH:Wm,rotlSL:jm,rotlBH:Zm,rotlBL:Xm,add:Ym,add3L:Jm,add3H:Qm,add4L:tg,add4H:eg,add5H:ng,add5L:rg},O=og;var[sg,ig]=O.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))),He=new Uint32Array(80),$e=new Uint32Array(80),Wa=class extends zr{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:t,Al:e,Bh:n,Bl:o,Ch:s,Cl:i,Dh:a,Dl:c,Eh:u,El:f,Fh:l,Fl:d,Gh:h,Gl:p,Hh:m,Hl:g}=this;return[t,e,n,o,s,i,a,c,u,f,l,d,h,p,m,g]}set(t,e,n,o,s,i,a,c,u,f,l,d,h,p,m,g){this.Ah=t|0,this.Al=e|0,this.Bh=n|0,this.Bl=o|0,this.Ch=s|0,this.Cl=i|0,this.Dh=a|0,this.Dl=c|0,this.Eh=u|0,this.El=f|0,this.Fh=l|0,this.Fl=d|0,this.Gh=h|0,this.Gl=p|0,this.Hh=m|0,this.Hl=g|0}process(t,e){for(let w=0;w<16;w++,e+=4)He[w]=t.getUint32(e),$e[w]=t.getUint32(e+=4);for(let w=16;w<80;w++){let x=He[w-15]|0,A=$e[w-15]|0,_=O.rotrSH(x,A,1)^O.rotrSH(x,A,8)^O.shrSH(x,A,7),v=O.rotrSL(x,A,1)^O.rotrSL(x,A,8)^O.shrSL(x,A,7),B=He[w-2]|0,T=$e[w-2]|0,et=O.rotrSH(B,T,19)^O.rotrBH(B,T,61)^O.shrSH(B,T,6),V=O.rotrSL(B,T,19)^O.rotrBL(B,T,61)^O.shrSL(B,T,6),F=O.add4L(v,V,$e[w-7],$e[w-16]),R=O.add4H(F,_,et,He[w-7],He[w-16]);He[w]=R|0,$e[w]=F|0}let{Ah:n,Al:o,Bh:s,Bl:i,Ch:a,Cl:c,Dh:u,Dl:f,Eh:l,El:d,Fh:h,Fl:p,Gh:m,Gl:g,Hh:y,Hl:b}=this;for(let w=0;w<80;w++){let x=O.rotrSH(l,d,14)^O.rotrSH(l,d,18)^O.rotrBH(l,d,41),A=O.rotrSL(l,d,14)^O.rotrSL(l,d,18)^O.rotrBL(l,d,41),_=l&h^~l&m,v=d&p^~d&g,B=O.add5L(b,A,v,ig[w],$e[w]),T=O.add5H(B,y,x,_,sg[w],He[w]),et=B|0,V=O.rotrSH(n,o,28)^O.rotrBH(n,o,34)^O.rotrBH(n,o,39),F=O.rotrSL(n,o,28)^O.rotrBL(n,o,34)^O.rotrBL(n,o,39),R=n&s^n&a^s&a,k=o&i^o&c^i&c;y=m|0,b=g|0,m=h|0,g=p|0,h=l|0,p=d|0,{h:l,l:d}=O.add(u|0,f|0,T|0,et|0),u=a|0,f=c|0,a=s|0,c=i|0,s=n|0,i=o|0;let L=O.add3L(et,F,k);n=O.add3H(L,T,V,R),o=L|0}({h:n,l:o}=O.add(this.Ah|0,this.Al|0,n|0,o|0)),{h:s,l:i}=O.add(this.Bh|0,this.Bl|0,s|0,i|0),{h:a,l:c}=O.add(this.Ch|0,this.Cl|0,a|0,c|0),{h:u,l:f}=O.add(this.Dh|0,this.Dl|0,u|0,f|0),{h:l,l:d}=O.add(this.Eh|0,this.El|0,l|0,d|0),{h,l:p}=O.add(this.Fh|0,this.Fl|0,h|0,p|0),{h:m,l:g}=O.add(this.Gh|0,this.Gl|0,m|0,g|0),{h:y,l:b}=O.add(this.Hh|0,this.Hl|0,y|0,b|0),this.set(n,o,s,i,a,c,u,f,l,d,h,p,m,g,y,b)}roundClean(){He.fill(0),$e.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 sf=Go(()=>new Wa);var Zo={};Rt(Zo,{aInRange:()=>$t,abool:()=>ne,abytes:()=>Gr,bitGet:()=>hg,bitLen:()=>Ja,bitMask:()=>Pn,bitSet:()=>dg,bytesToHex:()=>Be,bytesToNumberBE:()=>Ie,bytesToNumberLE:()=>qe,concatBytes:()=>ke,createHmacDrbg:()=>Qa,ensureBytes:()=>at,equalBytes:()=>ug,hexToBytes:()=>cr,hexToNumber:()=>Ya,inRange:()=>Nn,isBytes:()=>Ke,memoized:()=>ur,notImplemented:()=>mg,numberToBytesBE:()=>ze,numberToBytesLE:()=>lr,numberToHexUnpadded:()=>ar,numberToVarBytesBE:()=>lg,utf8ToBytes:()=>fg,validateObject:()=>ue});var Xa=BigInt(0),jo=BigInt(1),ag=BigInt(2);function Ke(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function Gr(r){if(!Ke(r))throw new Error("Uint8Array expected")}function ne(r,t){if(typeof t!="boolean")throw new Error(`${r} must be valid boolean, got "${t}".`)}var cg=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function Be(r){Gr(r);let t="";for(let e=0;e<r.length;e++)t+=cg[r[e]];return t}function ar(r){let t=r.toString(16);return t.length&1?`0${t}`:t}function Ya(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);return BigInt(r===""?"0":`0x${r}`)}var _e={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function af(r){if(r>=_e._0&&r<=_e._9)return r-_e._0;if(r>=_e._A&&r<=_e._F)return r-(_e._A-10);if(r>=_e._a&&r<=_e._f)return r-(_e._a-10)}function cr(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let t=r.length,e=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(e);for(let o=0,s=0;o<e;o++,s+=2){let i=af(r.charCodeAt(s)),a=af(r.charCodeAt(s+1));if(i===void 0||a===void 0){let c=r[s]+r[s+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+s)}n[o]=i*16+a}return n}function Ie(r){return Ya(Be(r))}function qe(r){return Gr(r),Ya(Be(Uint8Array.from(r).reverse()))}function ze(r,t){return cr(r.toString(16).padStart(t*2,"0"))}function lr(r,t){return ze(r,t).reverse()}function lg(r){return cr(ar(r))}function at(r,t,e){let n;if(typeof t=="string")try{n=cr(t)}catch(s){throw new Error(`${r} must be valid hex string, got "${t}". Cause: ${s}`)}else if(Ke(t))n=Uint8Array.from(t);else throw new Error(`${r} must be hex string or Uint8Array`);let o=n.length;if(typeof e=="number"&&o!==e)throw new Error(`${r} expected ${e} bytes, got ${o}`);return n}function ke(...r){let t=0;for(let n=0;n<r.length;n++){let o=r[n];Gr(o),t+=o.length}let e=new Uint8Array(t);for(let n=0,o=0;n<r.length;n++){let s=r[n];e.set(s,o),o+=s.length}return e}function ug(r,t){if(r.length!==t.length)return!1;let e=0;for(let n=0;n<r.length;n++)e|=r[n]^t[n];return e===0}function fg(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}var ja=r=>typeof r=="bigint"&&Xa<=r;function Nn(r,t,e){return ja(r)&&ja(t)&&ja(e)&&t<=r&&r<e}function $t(r,t,e,n){if(!Nn(t,e,n))throw new Error(`expected valid ${r}: ${e} <= n < ${n}, got ${typeof t} ${t}`)}function Ja(r){let t;for(t=0;r>Xa;r>>=jo,t+=1);return t}function hg(r,t){return r>>BigInt(t)&jo}function dg(r,t,e){return r|(e?jo:Xa)<<BigInt(t)}var Pn=r=>(ag<<BigInt(r-1))-jo,Za=r=>new Uint8Array(r),cf=r=>Uint8Array.from(r);function Qa(r,t,e){if(typeof r!="number"||r<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");let n=Za(r),o=Za(r),s=0,i=()=>{n.fill(1),o.fill(0),s=0},a=(...l)=>e(o,n,...l),c=(l=Za())=>{o=a(cf([0]),l),n=a(),l.length!==0&&(o=a(cf([1]),l),n=a())},u=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let l=0,d=[];for(;l<t;){n=a();let h=n.slice();d.push(h),l+=n.length}return ke(...d)};return(l,d)=>{i(),c(l);let h;for(;!(h=d(u()));)c();return i(),h}}var pg={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"||Ke(r),isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,t)=>t.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function ue(r,t,e={}){let n=(o,s,i)=>{let a=pg[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);let c=r[o];if(!(i&&c===void 0)&&!a(c,r))throw new Error(`Invalid param ${String(o)}=${c} (${typeof c}), expected ${s}`)};for(let[o,s]of Object.entries(t))n(o,s,!1);for(let[o,s]of Object.entries(e))n(o,s,!0);return r}var mg=()=>{throw new Error("not implemented")};function ur(r){let t=new WeakMap;return(e,...n)=>{let o=t.get(e);if(o!==void 0)return o;let s=r(e,...n);return t.set(e,s),s}}var mt=BigInt(0),rt=BigInt(1),fr=BigInt(2),gg=BigInt(3),tc=BigInt(4),lf=BigInt(5),uf=BigInt(8),yg=BigInt(9),wg=BigInt(16);function Y(r,t){let e=r%t;return e>=mt?e:t+e}function bg(r,t,e){if(e<=mt||t<mt)throw new Error("Expected power/modulo > 0");if(e===rt)return mt;let n=rt;for(;t>mt;)t&rt&&(n=n*r%e),r=r*r%e,t>>=rt;return n}function nt(r,t,e){let n=r;for(;t-- >mt;)n*=n,n%=e;return n}function Xo(r,t){if(r===mt||t<=mt)throw new Error(`invert: expected positive integers, got n=${r} mod=${t}`);let e=Y(r,t),n=t,o=mt,s=rt,i=rt,a=mt;for(;e!==mt;){let u=n/e,f=n%e,l=o-i*u,d=s-a*u;n=e,e=f,o=i,s=a,i=l,a=d}if(n!==rt)throw new Error("invert: does not exist");return Y(o,t)}function xg(r){let t=(r-rt)/fr,e,n,o;for(e=r-rt,n=0;e%fr===mt;e/=fr,n++);for(o=fr;o<r&&bg(o,t,r)!==r-rt;o++);if(n===1){let i=(r+rt)/tc;return function(c,u){let f=c.pow(u,i);if(!c.eql(c.sqr(f),u))throw new Error("Cannot find square root");return f}}let s=(e+rt)/fr;return function(a,c){if(a.pow(c,t)===a.neg(a.ONE))throw new Error("Cannot find square root");let u=n,f=a.pow(a.mul(a.ONE,o),e),l=a.pow(c,s),d=a.pow(c,e);for(;!a.eql(d,a.ONE);){if(a.eql(d,a.ZERO))return a.ZERO;let h=1;for(let m=a.sqr(d);h<u&&!a.eql(m,a.ONE);h++)m=a.sqr(m);let p=a.pow(f,rt<<BigInt(u-h-1));f=a.sqr(p),l=a.mul(l,p),d=a.mul(d,f),u=h}return l}}function vg(r){if(r%tc===gg){let t=(r+rt)/tc;return function(n,o){let s=n.pow(o,t);if(!n.eql(n.sqr(s),o))throw new Error("Cannot find square root");return s}}if(r%uf===lf){let t=(r-lf)/uf;return function(n,o){let s=n.mul(o,fr),i=n.pow(s,t),a=n.mul(o,i),c=n.mul(n.mul(a,fr),i),u=n.mul(a,n.sub(c,n.ONE));if(!n.eql(n.sqr(u),o))throw new Error("Cannot find square root");return u}}return r%wg,xg(r)}var ff=(r,t)=>(Y(r,t)&rt)===rt,Eg=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function ec(r){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},e=Eg.reduce((n,o)=>(n[o]="function",n),t);return ue(r,e)}function Ag(r,t,e){if(e<mt)throw new Error("Expected power > 0");if(e===mt)return r.ONE;if(e===rt)return t;let n=r.ONE,o=t;for(;e>mt;)e&rt&&(n=r.mul(n,o)),o=r.sqr(o),e>>=rt;return n}function Sg(r,t){let e=new Array(t.length),n=t.reduce((s,i,a)=>r.is0(i)?s:(e[a]=s,r.mul(s,i)),r.ONE),o=r.inv(n);return t.reduceRight((s,i,a)=>r.is0(i)?s:(e[a]=r.mul(s,e[a]),r.mul(s,i)),o),e}function rc(r,t){let e=t!==void 0?t:r.toString(2).length,n=Math.ceil(e/8);return{nBitLength:e,nByteLength:n}}function Ge(r,t,e=!1,n={}){if(r<=mt)throw new Error(`Expected Field ORDER > 0, got ${r}`);let{nBitLength:o,nByteLength:s}=rc(r,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");let i=vg(r),a=Object.freeze({ORDER:r,BITS:o,BYTES:s,MASK:Pn(o),ZERO:mt,ONE:rt,create:c=>Y(c,r),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return mt<=c&&c<r},is0:c=>c===mt,isOdd:c=>(c&rt)===rt,neg:c=>Y(-c,r),eql:(c,u)=>c===u,sqr:c=>Y(c*c,r),add:(c,u)=>Y(c+u,r),sub:(c,u)=>Y(c-u,r),mul:(c,u)=>Y(c*u,r),pow:(c,u)=>Ag(a,c,u),div:(c,u)=>Y(c*Xo(u,r),r),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>Xo(c,r),sqrt:n.sqrt||(c=>i(a,c)),invertBatch:c=>Sg(a,c),cmov:(c,u,f)=>f?u:c,toBytes:c=>e?lr(c,s):ze(c,s),fromBytes:c=>{if(c.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${c.length}`);return e?qe(c):Ie(c)}});return Object.freeze(a)}function hf(r){if(typeof r!="bigint")throw new Error("field order must be bigint");let t=r.toString(2).length;return Math.ceil(t/8)}function nc(r){let t=hf(r);return t+Math.ceil(t/2)}function df(r,t,e=!1){let n=r.length,o=hf(t),s=nc(t);if(n<16||n<s||n>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);let i=e?Ie(r):qe(r),a=Y(i,t-rt)+rt;return e?lr(a,o):ze(a,o)}var Bg=BigInt(0),oc=BigInt(1),sc=new WeakMap,pf=new WeakMap;function Yo(r,t){let e=(s,i)=>{let a=i.negate();return s?a:i},n=s=>{if(!Number.isSafeInteger(s)||s<=0||s>t)throw new Error(`Wrong window size=${s}, should be [1..${t}]`)},o=s=>{n(s);let i=Math.ceil(t/s)+1,a=2**(s-1);return{windows:i,windowSize:a}};return{constTimeNegate:e,unsafeLadder(s,i){let a=r.ZERO,c=s;for(;i>Bg;)i&oc&&(a=a.add(c)),c=c.double(),i>>=oc;return a},precomputeWindow(s,i){let{windows:a,windowSize:c}=o(i),u=[],f=s,l=f;for(let d=0;d<a;d++){l=f,u.push(l);for(let h=1;h<c;h++)l=l.add(f),u.push(l);f=l.double()}return u},wNAF(s,i,a){let{windows:c,windowSize:u}=o(s),f=r.ZERO,l=r.BASE,d=BigInt(2**s-1),h=2**s,p=BigInt(s);for(let m=0;m<c;m++){let g=m*u,y=Number(a&d);a>>=p,y>u&&(y-=h,a+=oc);let b=g,w=g+Math.abs(y)-1,x=m%2!==0,A=y<0;y===0?l=l.add(e(x,i[b])):f=f.add(e(A,i[w]))}return{p:f,f:l}},wNAFCached(s,i,a){let c=pf.get(s)||1,u=sc.get(s);return u||(u=this.precomputeWindow(s,c),c!==1&&sc.set(s,a(u))),this.wNAF(c,u,i)},setWindowSize(s,i){n(i),pf.set(s,i),sc.delete(s)}}}function Jo(r,t,e,n){if(!Array.isArray(e)||!Array.isArray(n)||n.length!==e.length)throw new Error("arrays of points and scalars must have equal length");n.forEach((f,l)=>{if(!t.isValid(f))throw new Error(`wrong scalar at index ${l}`)}),e.forEach((f,l)=>{if(!(f instanceof r))throw new Error(`wrong point at index ${l}`)});let o=Ja(BigInt(e.length)),s=o>12?o-3:o>4?o-2:o?2:1,i=(1<<s)-1,a=new Array(i+1).fill(r.ZERO),c=Math.floor((t.BITS-1)/s)*s,u=r.ZERO;for(let f=c;f>=0;f-=s){a.fill(r.ZERO);for(let d=0;d<n.length;d++){let h=n[d],p=Number(h>>BigInt(f)&BigInt(i));a[p]=a[p].add(e[d])}let l=r.ZERO;for(let d=a.length-1,h=r.ZERO;d>0;d--)h=h.add(a[d]),l=l.add(h);if(u=u.add(l),f!==0)for(let d=0;d<s;d++)u=u.double()}return u}function Rn(r){return ec(r.Fp),ue(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...rc(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}var oe=BigInt(0),Kt=BigInt(1),Qo=BigInt(2),Ig=BigInt(8),kg={zip215:!0};function Cg(r){let t=Rn(r);return ue(r,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}function mf(r){let t=Cg(r),{Fp:e,n,prehash:o,hash:s,randomBytes:i,nByteLength:a,h:c}=t,u=Qo<<BigInt(a*8)-Kt,f=e.create,l=Ge(t.n,t.nBitLength),d=t.uvRatio||((S,E)=>{try{return{isValid:!0,value:e.sqrt(S*e.inv(E))}}catch{return{isValid:!1,value:oe}}}),h=t.adjustScalarBytes||(S=>S),p=t.domain||((S,E,I)=>{if(ne("phflag",I),E.length||I)throw new Error("Contexts/pre-hash are not supported");return S});function m(S,E){$t("coordinate "+S,E,oe,u)}function g(S){if(!(S instanceof w))throw new Error("ExtendedPoint expected")}let y=ur((S,E)=>{let{ex:I,ey:N,ez:M}=S,U=S.is0();E==null&&(E=U?Ig:e.inv(M));let $=f(I*E),z=f(N*E),K=f(M*E);if(U)return{x:oe,y:Kt};if(K!==Kt)throw new Error("invZ was invalid");return{x:$,y:z}}),b=ur(S=>{let{a:E,d:I}=t;if(S.is0())throw new Error("bad point: ZERO");let{ex:N,ey:M,ez:U,et:$}=S,z=f(N*N),K=f(M*M),X=f(U*U),Q=f(X*X),bt=f(z*E),xt=f(X*f(bt+K)),Et=f(Q+f(I*f(z*K)));if(xt!==Et)throw new Error("bad point: equation left != right (1)");let Pt=f(N*M),dt=f(U*$);if(Pt!==dt)throw new Error("bad point: equation left != right (2)");return!0});class w{constructor(E,I,N,M){this.ex=E,this.ey=I,this.ez=N,this.et=M,m("x",E),m("y",I),m("z",N),m("t",M),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(E){if(E instanceof w)throw new Error("extended point not allowed");let{x:I,y:N}=E||{};return m("x",I),m("y",N),new w(I,N,Kt,f(I*N))}static normalizeZ(E){let I=e.invertBatch(E.map(N=>N.ez));return E.map((N,M)=>N.toAffine(I[M])).map(w.fromAffine)}static msm(E,I){return Jo(w,l,E,I)}_setWindowSize(E){_.setWindowSize(this,E)}assertValidity(){b(this)}equals(E){g(E);let{ex:I,ey:N,ez:M}=this,{ex:U,ey:$,ez:z}=E,K=f(I*z),X=f(U*M),Q=f(N*z),bt=f($*M);return K===X&&Q===bt}is0(){return this.equals(w.ZERO)}negate(){return new w(f(-this.ex),this.ey,this.ez,f(-this.et))}double(){let{a:E}=t,{ex:I,ey:N,ez:M}=this,U=f(I*I),$=f(N*N),z=f(Qo*f(M*M)),K=f(E*U),X=I+N,Q=f(f(X*X)-U-$),bt=K+$,xt=bt-z,Et=K-$,Pt=f(Q*xt),dt=f(bt*Et),Ht=f(Q*Et),we=f(xt*bt);return new w(Pt,dt,we,Ht)}add(E){g(E);let{a:I,d:N}=t,{ex:M,ey:U,ez:$,et:z}=this,{ex:K,ey:X,ez:Q,et:bt}=E;if(I===BigInt(-1)){let Bu=f((U-M)*(X+K)),Iu=f((U+M)*(X-K)),Ta=f(Iu-Bu);if(Ta===oe)return this.double();let ku=f($*Qo*bt),Cu=f(z*Qo*Q),Tu=Cu+ku,Lu=Iu+Bu,Nu=Cu-ku,Vp=f(Tu*Ta),Hp=f(Lu*Nu),$p=f(Tu*Nu),Kp=f(Ta*Lu);return new w(Vp,Hp,Kp,$p)}let xt=f(M*K),Et=f(U*X),Pt=f(z*N*bt),dt=f($*Q),Ht=f((M+U)*(K+X)-xt-Et),we=dt-Pt,An=dt+Pt,Sn=f(Et-I*xt),Mp=f(Ht*we),Up=f(An*Sn),Op=f(Ht*Sn),Fp=f(we*An);return new w(Mp,Up,Fp,Op)}subtract(E){return this.add(E.negate())}wNAF(E){return _.wNAFCached(this,E,w.normalizeZ)}multiply(E){let I=E;$t("scalar",I,Kt,n);let{p:N,f:M}=this.wNAF(I);return w.normalizeZ([N,M])[0]}multiplyUnsafe(E){let I=E;return $t("scalar",I,oe,n),I===oe?A:this.equals(A)||I===Kt?this:this.equals(x)?this.wNAF(I).p:_.unsafeLadder(this,I)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return _.unsafeLadder(this,n).is0()}toAffine(E){return y(this,E)}clearCofactor(){let{h:E}=t;return E===Kt?this:this.multiplyUnsafe(E)}static fromHex(E,I=!1){let{d:N,a:M}=t,U=e.BYTES;E=at("pointHex",E,U),ne("zip215",I);let $=E.slice(),z=E[U-1];$[U-1]=z&-129;let K=qe($),X=I?u:e.ORDER;$t("pointHex.y",K,oe,X);let Q=f(K*K),bt=f(Q-Kt),xt=f(N*Q-M),{isValid:Et,value:Pt}=d(bt,xt);if(!Et)throw new Error("Point.fromHex: invalid y coordinate");let dt=(Pt&Kt)===Kt,Ht=(z&128)!==0;if(!I&&Pt===oe&&Ht)throw new Error("Point.fromHex: x=0 and x_0=1");return Ht!==dt&&(Pt=f(-Pt)),w.fromAffine({x:Pt,y:K})}static fromPrivateKey(E){return T(E).point}toRawBytes(){let{x:E,y:I}=this.toAffine(),N=lr(I,e.BYTES);return N[N.length-1]|=E&Kt?128:0,N}toHex(){return Be(this.toRawBytes())}}w.BASE=new w(t.Gx,t.Gy,Kt,f(t.Gx*t.Gy)),w.ZERO=new w(oe,Kt,Kt,oe);let{BASE:x,ZERO:A}=w,_=Yo(w,a*8);function v(S){return Y(S,n)}function B(S){return v(qe(S))}function T(S){let E=a;S=at("private key",S,E);let I=at("hashed private key",s(S),2*E),N=h(I.slice(0,E)),M=I.slice(E,2*E),U=B(N),$=x.multiply(U),z=$.toRawBytes();return{head:N,prefix:M,scalar:U,point:$,pointBytes:z}}function et(S){return T(S).pointBytes}function V(S=new Uint8Array,...E){let I=ke(...E);return B(s(p(I,at("context",S),!!o)))}function F(S,E,I={}){S=at("message",S),o&&(S=o(S));let{prefix:N,scalar:M,pointBytes:U}=T(E),$=V(I.context,N,S),z=x.multiply($).toRawBytes(),K=V(I.context,z,U,S),X=v($+K*M);$t("signature.s",X,oe,n);let Q=ke(z,lr(X,e.BYTES));return at("result",Q,a*2)}let R=kg;function k(S,E,I,N=R){let{context:M,zip215:U}=N,$=e.BYTES;S=at("signature",S,2*$),E=at("message",E),U!==void 0&&ne("zip215",U),o&&(E=o(E));let z=qe(S.slice($,2*$)),K,X,Q;try{K=w.fromHex(I,U),X=w.fromHex(S.slice(0,$),U),Q=x.multiplyUnsafe(z)}catch{return!1}if(!U&&K.isSmallOrder())return!1;let bt=V(M,X.toRawBytes(),K.toRawBytes(),E);return X.add(K.multiplyUnsafe(bt)).subtract(Q).clearCofactor().equals(w.ZERO)}return x._setWindowSize(8),{CURVE:t,getPublicKey:et,sign:F,verify:k,ExtendedPoint:w,utils:{getExtendedPublicKey:T,randomPrivateKey:()=>i(e.BYTES),precompute(S=8,E=w.BASE){return E._setWindowSize(S),E.multiply(BigInt(3)),E}}}}var ic=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),gf=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),Kx=BigInt(0),Tg=BigInt(1),yf=BigInt(2),qx=BigInt(3),Lg=BigInt(5),Ng=BigInt(8);function Pg(r){let t=BigInt(10),e=BigInt(20),n=BigInt(40),o=BigInt(80),s=ic,a=r*r%s*r%s,c=nt(a,yf,s)*a%s,u=nt(c,Tg,s)*r%s,f=nt(u,Lg,s)*u%s,l=nt(f,t,s)*f%s,d=nt(l,e,s)*l%s,h=nt(d,n,s)*d%s,p=nt(h,o,s)*h%s,m=nt(p,o,s)*h%s,g=nt(m,t,s)*f%s;return{pow_p_5_8:nt(g,yf,s)*r%s,b2:a}}function Rg(r){return r[0]&=248,r[31]&=127,r[31]|=64,r}function Dg(r,t){let e=ic,n=Y(t*t*t,e),o=Y(n*n*t,e),s=Pg(r*o).pow_p_5_8,i=Y(r*n*s,e),a=Y(t*i*i,e),c=i,u=Y(i*gf,e),f=a===r,l=a===Y(-r,e),d=a===Y(-r*gf,e);return f&&(i=c),(l||d)&&(i=u),ff(i,e)&&(i=Y(-i,e)),{isValid:f||l,value:i}}var Mg=Ge(ic,void 0,!0),Ug={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Mg,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:Ng,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:sf,randomBytes:qr,adjustScalarBytes:Rg,uvRatio:Dg},Dn=mf(Ug);var ts=32,es=64,ac=32;function wf(){let r=Dn.utils.randomPrivateKey(),t=Dn.getPublicKey(r);return{privateKey:Og(r,t),publicKey:t}}function bf(r,t){let e=r.subarray(0,ac);return Dn.sign(t instanceof Uint8Array?t:t.subarray(),e)}function xf(r,t,e){return Dn.verify(t,e instanceof Uint8Array?e:e.subarray(),r)}function Og(r,t){let e=new Uint8Array(es);for(let n=0;n<ac;n++)e[n]=r[n],e[ac+n]=t[n];return e}var Mn=class{type="Ed25519";raw;constructor(t){this.raw=ns(t,ts)}toMultihash(){return Se.digest(fe(this))}toCID(){return pt.createV1(114,this.toMultihash())}toString(){return W.encode(this.toMultihash().bytes).substring(1)}equals(t){return t==null||!(t.raw instanceof Uint8Array)?!1:it(this.raw,t.raw)}verify(t,e){return xf(this.raw,e,t)}},rs=class{type="Ed25519";raw;publicKey;constructor(t,e){this.raw=ns(t,es),this.publicKey=new Mn(e)}equals(t){return t==null||!(t.raw instanceof Uint8Array)?!1:it(this.raw,t.raw)}sign(t){return bf(this.raw,t)}};function cc(r){return r=ns(r,ts),new Mn(r)}async function Ef(){let{privateKey:r,publicKey:t}=wf();return new rs(r,t)}function ns(r,t){if(r=Uint8Array.from(r??[]),r.length!==t)throw new D(`Key must be a Uint8Array of length ${t}, got ${r.length}`);return r}function ct(r=0){return new Uint8Array(r)}function It(r=0){return new Uint8Array(r)}var Fg=Math.pow(2,7),Vg=Math.pow(2,14),Hg=Math.pow(2,21),lc=Math.pow(2,28),uc=Math.pow(2,35),fc=Math.pow(2,42),hc=Math.pow(2,49),j=128,kt=127;function ht(r){if(r<Fg)return 1;if(r<Vg)return 2;if(r<Hg)return 3;if(r<lc)return 4;if(r<uc)return 5;if(r<fc)return 6;if(r<hc)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function dc(r,t,e=0){switch(ht(r)){case 8:t[e++]=r&255|j,r/=128;case 7:t[e++]=r&255|j,r/=128;case 6:t[e++]=r&255|j,r/=128;case 5:t[e++]=r&255|j,r/=128;case 4:t[e++]=r&255|j,r>>>=7;case 3:t[e++]=r&255|j,r>>>=7;case 2:t[e++]=r&255|j,r>>>=7;case 1:{t[e++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return t}function $g(r,t,e=0){switch(ht(r)){case 8:t.set(e++,r&255|j),r/=128;case 7:t.set(e++,r&255|j),r/=128;case 6:t.set(e++,r&255|j),r/=128;case 5:t.set(e++,r&255|j),r/=128;case 4:t.set(e++,r&255|j),r>>>=7;case 3:t.set(e++,r&255|j),r>>>=7;case 2:t.set(e++,r&255|j),r>>>=7;case 1:{t.set(e++,r&255),r>>>=7;break}default:throw new Error("unreachable")}return t}function pc(r,t){let e=r[t],n=0;if(n+=e&kt,e<j||(e=r[t+1],n+=(e&kt)<<7,e<j)||(e=r[t+2],n+=(e&kt)<<14,e<j)||(e=r[t+3],n+=(e&kt)<<21,e<j)||(e=r[t+4],n+=(e&kt)*lc,e<j)||(e=r[t+5],n+=(e&kt)*uc,e<j)||(e=r[t+6],n+=(e&kt)*fc,e<j)||(e=r[t+7],n+=(e&kt)*hc,e<j))return n;throw new RangeError("Could not decode varint")}function Kg(r,t){let e=r.get(t),n=0;if(n+=e&kt,e<j||(e=r.get(t+1),n+=(e&kt)<<7,e<j)||(e=r.get(t+2),n+=(e&kt)<<14,e<j)||(e=r.get(t+3),n+=(e&kt)<<21,e<j)||(e=r.get(t+4),n+=(e&kt)*lc,e<j)||(e=r.get(t+5),n+=(e&kt)*uc,e<j)||(e=r.get(t+6),n+=(e&kt)*fc,e<j)||(e=r.get(t+7),n+=(e&kt)*hc,e<j))return n;throw new RangeError("Could not decode varint")}function Ct(r,t,e=0){return t==null&&(t=It(ht(r))),t instanceof Uint8Array?dc(r,t,e):$g(r,t,e)}function se(r,t=0){return r instanceof Uint8Array?pc(r,t):Kg(r,t)}var mc=new Float32Array([-0]),We=new Uint8Array(mc.buffer);function Af(r,t,e){mc[0]=r,t[e]=We[0],t[e+1]=We[1],t[e+2]=We[2],t[e+3]=We[3]}function Sf(r,t){return We[0]=r[t],We[1]=r[t+1],We[2]=r[t+2],We[3]=r[t+3],mc[0]}var gc=new Float64Array([-0]),Tt=new Uint8Array(gc.buffer);function _f(r,t,e){gc[0]=r,t[e]=Tt[0],t[e+1]=Tt[1],t[e+2]=Tt[2],t[e+3]=Tt[3],t[e+4]=Tt[4],t[e+5]=Tt[5],t[e+6]=Tt[6],t[e+7]=Tt[7]}function Bf(r,t){return Tt[0]=r[t],Tt[1]=r[t+1],Tt[2]=r[t+2],Tt[3]=r[t+3],Tt[4]=r[t+4],Tt[5]=r[t+5],Tt[6]=r[t+6],Tt[7]=r[t+7],gc[0]}var qg=BigInt(Number.MAX_SAFE_INTEGER),zg=BigInt(Number.MIN_SAFE_INTEGER),Gt=class r{lo;hi;constructor(t,e){this.lo=t|0,this.hi=e|0}toNumber(t=!1){if(!t&&this.hi>>>31>0){let e=~this.lo+1>>>0,n=~this.hi>>>0;return e===0&&(n=n+1>>>0),-(e+n*4294967296)}return this.lo+this.hi*4294967296}toBigInt(t=!1){if(t)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let e=~this.lo+1>>>0,n=~this.hi>>>0;return e===0&&(n=n+1>>>0),-(BigInt(e)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(t=!1){return this.toBigInt(t).toString()}zzEncode(){let t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this}zzDecode(){let t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this}length(){let t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?e===0?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:n<128?9:10}static fromBigInt(t){if(t===0n)return dr;if(t<qg&&t>zg)return this.fromNumber(Number(t));let e=t<0n;e&&(t=-t);let n=t>>32n,o=t-(n<<32n);return e&&(n=~n|0n,o=~o|0n,++o>If&&(o=0n,++n>If&&(n=0n))),new r(Number(o),Number(n))}static fromNumber(t){if(t===0)return dr;let e=t<0;e&&(t=-t);let n=t>>>0,o=(t-n)/4294967296>>>0;return e&&(o=~o>>>0,n=~n>>>0,++n>4294967295&&(n=0,++o>4294967295&&(o=0))),new r(n,o)}static from(t){return typeof t=="number"?r.fromNumber(t):typeof t=="bigint"?r.fromBigInt(t):typeof t=="string"?r.fromBigInt(BigInt(t)):t.low!=null||t.high!=null?new r(t.low>>>0,t.high>>>0):dr}},dr=new Gt(0,0);dr.toBigInt=function(){return 0n};dr.zzEncode=dr.zzDecode=function(){return this};dr.length=function(){return 1};var If=4294967296n;function kf(r){let t=0,e=0;for(let n=0;n<r.length;++n)e=r.charCodeAt(n),e<128?t+=1:e<2048?t+=2:(e&64512)===55296&&(r.charCodeAt(n+1)&64512)===56320?(++n,t+=4):t+=3;return t}function Cf(r,t,e){if(e-t<1)return"";let o,s=[],i=0,a;for(;t<e;)a=r[t++],a<128?s[i++]=a:a>191&&a<224?s[i++]=(a&31)<<6|r[t++]&63:a>239&&a<365?(a=((a&7)<<18|(r[t++]&63)<<12|(r[t++]&63)<<6|r[t++]&63)-65536,s[i++]=55296+(a>>10),s[i++]=56320+(a&1023)):s[i++]=(a&15)<<12|(r[t++]&63)<<6|r[t++]&63,i>8191&&((o??(o=[])).push(String.fromCharCode.apply(String,s)),i=0);return o!=null?(i>0&&o.push(String.fromCharCode.apply(String,s.slice(0,i))),o.join("")):String.fromCharCode.apply(String,s.slice(0,i))}function yc(r,t,e){let n=e,o,s;for(let i=0;i<r.length;++i)o=r.charCodeAt(i),o<128?t[e++]=o:o<2048?(t[e++]=o>>6|192,t[e++]=o&63|128):(o&64512)===55296&&((s=r.charCodeAt(i+1))&64512)===56320?(o=65536+((o&1023)<<10)+(s&1023),++i,t[e++]=o>>18|240,t[e++]=o>>12&63|128,t[e++]=o>>6&63|128,t[e++]=o&63|128):(t[e++]=o>>12|224,t[e++]=o>>6&63|128,t[e++]=o&63|128);return e-n}function ie(r,t){return RangeError(`index out of range: ${r.pos} + ${t??1} > ${r.len}`)}function os(r,t){return(r[t-4]|r[t-3]<<8|r[t-2]<<16|r[t-1]<<24)>>>0}var wc=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(t){this.buf=t,this.pos=0,this.len=t.length}uint32(){let t=4294967295;if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,ie(this,10);return t}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw ie(this,4);return os(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw ie(this,4);return os(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw ie(this,4);let t=Sf(this.buf,this.pos);return this.pos+=4,t}double(){if(this.pos+8>this.len)throw ie(this,4);let t=Bf(this.buf,this.pos);return this.pos+=8,t}bytes(){let t=this.uint32(),e=this.pos,n=this.pos+t;if(n>this.len)throw ie(this,t);return this.pos+=t,e===n?new Uint8Array(0):this.buf.subarray(e,n)}string(){let t=this.bytes();return Cf(t,0,t.length)}skip(t){if(typeof t=="number"){if(this.pos+t>this.len)throw ie(this,t);this.pos+=t}else do if(this.pos>=this.len)throw ie(this);while(this.buf[this.pos++]&128);return this}skipType(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${t} at offset ${this.pos}`)}return this}readLongVarint(){let t=new Gt(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw ie(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw ie(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw ie(this,8);let t=os(this.buf,this.pos+=4),e=os(this.buf,this.pos+=4);return new Gt(t,e)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){let t=pc(this.buf,this.pos);return this.pos+=ht(t),t}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}};function bc(r){return new wc(r instanceof Uint8Array?r:r.subarray())}function Dt(r,t,e){let n=bc(r);return t.decode(n,void 0,e)}var xc={};Rt(xc,{base10:()=>Gg});var Gg=Ve({prefix:"9",name:"base10",alphabet:"0123456789"});var vc={};Rt(vc,{base16:()=>Wg,base16upper:()=>jg});var Wg=st({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),jg=st({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Ec={};Rt(Ec,{base2:()=>Zg});var Zg=st({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Ac={};Rt(Ac,{base256emoji:()=>t0});var Lf=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}"),Xg=Lf.reduce((r,t,e)=>(r[e]=t,r),[]),Yg=Lf.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function Jg(r){return r.reduce((t,e)=>(t+=Xg[e],t),"")}function Qg(r){let t=[];for(let e of r){let n=Yg[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}var t0=Ur({prefix:"\u{1F680}",name:"base256emoji",encode:Jg,decode:Qg});var Sc={};Rt(Sc,{base36:()=>e0,base36upper:()=>r0});var e0=Ve({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),r0=Ve({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Ic={};Rt(Ic,{base64:()=>_c,base64pad:()=>n0,base64url:()=>Bc,base64urlpad:()=>o0});var _c=st({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),n0=st({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Bc=st({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),o0=st({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var kc={};Rt(kc,{base8:()=>s0});var s0=st({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Cc={};Rt(Cc,{identity:()=>i0});var i0=Ur({prefix:"\0",name:"identity",encode:r=>Fu(r),decode:r=>Ou(r)});var S1=new TextEncoder,_1=new TextDecoder;var Nc={};Rt(Nc,{sha256:()=>Wr,sha512:()=>l0});function Lc({name:r,code:t,encode:e}){return new Tc(r,t,e)}var Tc=class{name;code;encode;constructor(t,e,n){this.name=t,this.code=e,this.encode=n}digest(t){if(t instanceof Uint8Array){let e=this.encode(t);return e instanceof Uint8Array?te(this.code,e):e.then(n=>te(this.code,n))}else throw Error("Unknown type, must be binary type")}};function Pf(r){return async t=>new Uint8Array(await crypto.subtle.digest(r,t))}var Wr=Lc({name:"sha2-256",code:18,encode:Pf("SHA-256")}),l0=Lc({name:"sha2-512",code:19,encode:Pf("SHA-512")});var Un={...Cc,...Ec,...kc,...xc,...vc,...Ha,...Sc,...Va,...Ic,...Ac},U1={...Nc,...qa};function Df(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var Rf=Df("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Pc=Df("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);let t=It(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),u0={utf8:Rf,"utf-8":Rf,hex:Un.base16,latin1:Pc,ascii:Pc,binary:Pc,...Un},ss=u0;function P(r,t="utf8"){let e=ss[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return e.decoder.decode(`${e.prefix}${r}`)}function Rc(r){let t=r??8192,e=t>>>1,n,o=t;return function(i){if(i<1||i>e)return It(i);o+i>t&&(n=It(t),o=0);let a=n.subarray(o,o+=i);return o&7&&(o=(o|7)+1),a}}var pr=class{fn;len;next;val;constructor(t,e,n){this.fn=t,this.len=e,this.next=void 0,this.val=n}};function Dc(){}var Uc=class{head;tail;len;next;constructor(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}},f0=Rc();function h0(r){return globalThis.Buffer!=null?It(r):f0(r)}var Fn=class{len;head;tail;states;constructor(){this.len=0,this.head=new pr(Dc,0,0),this.tail=this.head,this.states=null}_push(t,e,n){return this.tail=this.tail.next=new pr(t,e,n),this.len+=e,this}uint32(t){return this.len+=(this.tail=this.tail.next=new Oc((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this}int32(t){return t<0?this._push(is,10,Gt.fromNumber(t)):this.uint32(t)}sint32(t){return this.uint32((t<<1^t>>31)>>>0)}uint64(t){let e=Gt.fromBigInt(t);return this._push(is,e.length(),e)}uint64Number(t){return this._push(dc,ht(t),t)}uint64String(t){return this.uint64(BigInt(t))}int64(t){return this.uint64(t)}int64Number(t){return this.uint64Number(t)}int64String(t){return this.uint64String(t)}sint64(t){let e=Gt.fromBigInt(t).zzEncode();return this._push(is,e.length(),e)}sint64Number(t){let e=Gt.fromNumber(t).zzEncode();return this._push(is,e.length(),e)}sint64String(t){return this.sint64(BigInt(t))}bool(t){return this._push(Mc,1,t?1:0)}fixed32(t){return this._push(On,4,t>>>0)}sfixed32(t){return this.fixed32(t)}fixed64(t){let e=Gt.fromBigInt(t);return this._push(On,4,e.lo)._push(On,4,e.hi)}fixed64Number(t){let e=Gt.fromNumber(t);return this._push(On,4,e.lo)._push(On,4,e.hi)}fixed64String(t){return this.fixed64(BigInt(t))}sfixed64(t){return this.fixed64(t)}sfixed64Number(t){return this.fixed64Number(t)}sfixed64String(t){return this.fixed64String(t)}float(t){return this._push(Af,4,t)}double(t){return this._push(_f,8,t)}bytes(t){let e=t.length>>>0;return e===0?this._push(Mc,1,0):this.uint32(e)._push(p0,e,t)}string(t){let e=kf(t);return e!==0?this.uint32(e)._push(yc,e,t):this._push(Mc,1,0)}fork(){return this.states=new Uc(this),this.head=this.tail=new pr(Dc,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 pr(Dc,0,0),this.len=0),this}ldelim(){let t=this.head,e=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=t.next,this.tail=e,this.len+=n),this}finish(){let t=this.head.next,e=h0(this.len),n=0;for(;t!=null;)t.fn(t.val,e,n),n+=t.len,t=t.next;return e}};function Mc(r,t,e){t[e]=r&255}function d0(r,t,e){for(;r>127;)t[e++]=r&127|128,r>>>=7;t[e]=r}var Oc=class extends pr{next;constructor(t,e){super(d0,t,e),this.next=void 0}};function is(r,t,e){for(;r.hi!==0;)t[e++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)t[e++]=r.lo&127|128,r.lo=r.lo>>>7;t[e++]=r.lo}function On(r,t,e){t[e]=r&255,t[e+1]=r>>>8&255,t[e+2]=r>>>16&255,t[e+3]=r>>>24}function p0(r,t,e){t.set(r,e)}globalThis.Buffer!=null&&(Fn.prototype.bytes=function(r){let t=r.length>>>0;return this.uint32(t),t>0&&this._push(m0,t,r),this},Fn.prototype.string=function(r){let t=globalThis.Buffer.byteLength(r);return this.uint32(t),t>0&&this._push(g0,t,r),this});function m0(r,t,e){t.set(r,e)}function g0(r,t,e){r.length<40?yc(r,t,e):t.utf8Write!=null?t.utf8Write(r,e):t.set(P(r),e)}function Fc(){return new Fn}function Mt(r,t){let e=Fc();return t.encode(r,e,{lengthDelimited:!1}),e.finish()}var jr;(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"})(jr||(jr={}));function as(r,t,e,n){return{name:r,type:t,encode:e,decode:n}}function Vc(r){function t(o){if(r[o.toString()]==null)throw new Error("Invalid enum value");return r[o]}let e=function(s,i){let a=t(s);i.int32(a)},n=function(s){let i=s.int32();return t(i)};return as("enum",jr.VARINT,e,n)}function Ut(r,t){return as("message",jr.LENGTH_DELIMITED,r,t)}var mr=class extends Error{code="ERR_MAX_LENGTH";name="MaxLengthError"},Vn=class extends Error{code="ERR_MAX_SIZE";name="MaxSizeError"};var gt;(function(r){r.RSA="RSA",r.Ed25519="Ed25519",r.secp256k1="secp256k1"})(gt||(gt={}));var Hc;(function(r){r[r.RSA=0]="RSA",r[r.Ed25519=1]="Ed25519",r[r.secp256k1=2]="secp256k1"})(Hc||(Hc={}));(function(r){r.codec=()=>Vc(Hc)})(gt||(gt={}));var he;(function(r){let t;r.codec=()=>(t==null&&(t=Ut((e,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),e.Type!=null&&(n.uint32(8),gt.codec().encode(e.Type,n)),e.Data!=null&&(n.uint32(18),n.bytes(e.Data)),o.lengthDelimited!==!1&&n.ldelim()},(e,n,o={})=>{let s={},i=n==null?e.len:e.pos+n;for(;e.pos<i;){let a=e.uint32();switch(a>>>3){case 1:{s.Type=gt.codec().decode(e);break}case 2:{s.Data=e.bytes();break}default:{e.skipType(a&7);break}}}return s})),t),r.encode=e=>Mt(e,r.codec()),r.decode=(e,n)=>Dt(e,r.codec(),n)})(he||(he={}));var $c;(function(r){let t;r.codec=()=>(t==null&&(t=Ut((e,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),e.Type!=null&&(n.uint32(8),gt.codec().encode(e.Type,n)),e.Data!=null&&(n.uint32(18),n.bytes(e.Data)),o.lengthDelimited!==!1&&n.ldelim()},(e,n,o={})=>{let s={},i=n==null?e.len:e.pos+n;for(;e.pos<i;){let a=e.uint32();switch(a>>>3){case 1:{s.Type=gt.codec().decode(e);break}case 2:{s.Data=e.bytes();break}default:{e.skipType(a&7);break}}}return s})),t),r.encode=e=>Mt(e,r.codec()),r.decode=(e,n)=>Dt(e,r.codec(),n)})($c||($c={}));var Yn={};Rt(Yn,{MAX_RSA_KEY_SIZE:()=>Js,generateRSAKeyPair:()=>Qc,jwkToJWKKeyPair:()=>Nh,jwkToPkcs1:()=>N0,jwkToPkix:()=>Yc,jwkToRSAPrivateKey:()=>Lh,pkcs1ToJwk:()=>kh,pkcs1ToRSAPrivateKey:()=>Th,pkixToJwk:()=>Ch,pkixToRSAPublicKey:()=>Jc});var y0=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),je=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ze=new Uint32Array(64),Kc=class extends zr{constructor(){super(64,32,8,!1),this.A=je[0]|0,this.B=je[1]|0,this.C=je[2]|0,this.D=je[3]|0,this.E=je[4]|0,this.F=je[5]|0,this.G=je[6]|0,this.H=je[7]|0}get(){let{A:t,B:e,C:n,D:o,E:s,F:i,G:a,H:c}=this;return[t,e,n,o,s,i,a,c]}set(t,e,n,o,s,i,a,c){this.A=t|0,this.B=e|0,this.C=n|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=a|0,this.H=c|0}process(t,e){for(let l=0;l<16;l++,e+=4)Ze[l]=t.getUint32(e,!1);for(let l=16;l<64;l++){let d=Ze[l-15],h=Ze[l-2],p=re(d,7)^re(d,18)^d>>>3,m=re(h,17)^re(h,19)^h>>>10;Ze[l]=m+Ze[l-7]+p+Ze[l-16]|0}let{A:n,B:o,C:s,D:i,E:a,F:c,G:u,H:f}=this;for(let l=0;l<64;l++){let d=re(a,6)^re(a,11)^re(a,25),h=f+d+rf(a,c,u)+y0[l]+Ze[l]|0,m=(re(n,2)^re(n,13)^re(n,22))+nf(n,o,s)|0;f=u,u=c,c=a,a=i+h|0,i=s,s=o,o=n,n=h+m|0}n=n+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,f=f+this.H|0,this.set(n,o,s,i,a,c,u,f)}roundClean(){Ze.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var Zr=Go(()=>new Kc);var q=sr(Uf());function gr(r,t){let e=0;if(r.length===1)return r[0];for(let n=r.length-1;n>=0;n--)e+=r[r.length-1-n]*Math.pow(2,t*n);return e}function Xe(r,t,e=-1){let n=e,o=r,s=0,i=Math.pow(2,t);for(let a=1;a<8;a++){if(r<i){let c;if(n<0)c=new ArrayBuffer(a),s=a;else{if(n<a)return new ArrayBuffer(0);c=new ArrayBuffer(n),s=n}let u=new Uint8Array(c);for(let f=a-1;f>=0;f--){let l=Math.pow(2,f*t);u[s-f-1]=Math.floor(o/l),o-=u[s-f-1]*l}return c}i*=Math.pow(2,t)}return new ArrayBuffer(0)}function us(...r){let t=0,e=0;for(let s of r)t+=s.length;let n=new ArrayBuffer(t),o=new Uint8Array(n);for(let s of r)o.set(s,e),e+=s.length;return o}function zc(){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 t=new ArrayBuffer(this.valueHex.byteLength),e=new Uint8Array(t);for(let a=0;a<this.valueHex.byteLength;a++)e[a]=0;e[0]=r[0]&128;let n=gr(e,8),o=new ArrayBuffer(this.valueHex.byteLength),s=new Uint8Array(o);for(let a=0;a<this.valueHex.byteLength;a++)s[a]=r[a];return s[0]&=127,gr(s,8)-n}function Of(r){let t=r<0?r*-1:r,e=128;for(let n=1;n<8;n++){if(t<=e){if(r<0){let i=e-t,a=Xe(i,8,n),c=new Uint8Array(a);return c[0]|=128,a}let o=Xe(t,8,n),s=new Uint8Array(o);if(s[0]&128){let i=o.slice(0),a=new Uint8Array(i);o=new ArrayBuffer(o.byteLength+1),s=new Uint8Array(o);for(let c=0;c<i.byteLength;c++)s[c+1]=a[c];s[0]=0}return o}e*=Math.pow(2,8)}return new ArrayBuffer(0)}function Ff(r,t){if(r.byteLength!==t.byteLength)return!1;let e=new Uint8Array(r),n=new Uint8Array(t);for(let o=0;o<e.length;o++)if(e[o]!==n[o])return!1;return!0}function qt(r,t){let e=r.toString(10);if(t<e.length)return"";let n=t-e.length,o=new Array(n);for(let i=0;i<n;i++)o[i]="0";return o.join("").concat(e)}var wv=Math.log(2);function fs(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function Gc(r){let t=0,e=0;for(let o=0;o<r.length;o++){let s=r[o];t+=s.byteLength}let n=new Uint8Array(t);for(let o=0;o<r.length;o++){let s=r[o];n.set(new Uint8Array(s),e),e+=s.byteLength}return n.buffer}function Pe(r,t,e,n){return t instanceof Uint8Array?t.byteLength?e<0?(r.error="Wrong parameter: inputOffset less than zero",!1):n<0?(r.error="Wrong parameter: inputLength less than zero",!1):t.byteLength-e-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 $n=class{constructor(){this.items=[]}write(t){this.items.push(t)}final(){return Gc(this.items)}},Hn=[new Uint8Array([1])],Vf="0123456789";var tn="",ae=new ArrayBuffer(0),Wc=new Uint8Array(0),Kn="EndOfContent",$f="OCTET STRING",Kf="BIT STRING";function Re(r){var t;return t=class extends r{constructor(...n){var o;super(...n);let s=n[0]||{};this.isHexOnly=(o=s.isHexOnly)!==null&&o!==void 0?o:!1,this.valueHexView=s.valueHex?q.BufferSourceConverter.toUint8Array(s.valueHex):Wc}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(n){this.valueHexView=new Uint8Array(n)}fromBER(n,o,s){let i=n instanceof ArrayBuffer?new Uint8Array(n):n;if(!Pe(this,i,o,s))return-1;let a=o+s;return this.valueHexView=i.subarray(o,a),this.valueHexView.length?(this.blockLength=s,a):(this.warnings.push("Zero buffer length"),o)}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",ae)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:q.Convert.ToHex(this.valueHexView)}}},t.NAME="hexBlock",t}var Te=class{constructor({blockLength:t=0,error:e=tn,warnings:n=[],valueBeforeDecode:o=Wc}={}){this.blockLength=t,this.error=e,this.warnings=n,this.valueBeforeDecodeView=q.BufferSourceConverter.toUint8Array(o)}static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(t){this.valueBeforeDecodeView=new Uint8Array(t)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:q.Convert.ToHex(this.valueBeforeDecodeView)}}};Te.NAME="baseBlock";var Lt=class extends Te{fromBER(t,e,n){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(t,e){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}};Lt.NAME="valueBlock";var hs=class extends Re(Te){constructor({idBlock:t={}}={}){var e,n,o,s;super(),t?(this.isHexOnly=(e=t.isHexOnly)!==null&&e!==void 0?e:!1,this.valueHexView=t.valueHex?q.BufferSourceConverter.toUint8Array(t.valueHex):Wc,this.tagClass=(n=t.tagClass)!==null&&n!==void 0?n:-1,this.tagNumber=(o=t.tagNumber)!==null&&o!==void 0?o:-1,this.isConstructed=(s=t.isConstructed)!==null&&s!==void 0?s:!1):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(t=!1){let e=0;switch(this.tagClass){case 1:e|=0;break;case 2:e|=64;break;case 3:e|=128;break;case 4:e|=192;break;default:return this.error="Unknown tag class",ae}if(this.isConstructed&&(e|=32),this.tagNumber<31&&!this.isHexOnly){let o=new Uint8Array(1);if(!t){let s=this.tagNumber;s&=31,e|=s,o[0]=e}return o.buffer}if(!this.isHexOnly){let o=Xe(this.tagNumber,7),s=new Uint8Array(o),i=o.byteLength,a=new Uint8Array(i+1);if(a[0]=e|31,!t){for(let c=0;c<i-1;c++)a[c+1]=s[c]|128;a[i]=s[i-1]}return a.buffer}let n=new Uint8Array(this.valueHexView.byteLength+1);if(n[0]=e|31,!t){let o=this.valueHexView;for(let s=0;s<o.length-1;s++)n[s+1]=o[s]|128;n[this.valueHexView.byteLength]=o[o.length-1]}return n.buffer}fromBER(t,e,n){let o=q.BufferSourceConverter.toUint8Array(t);if(!Pe(this,o,e,n))return-1;let s=o.subarray(e,e+n);if(s.length===0)return this.error="Zero buffer length",-1;switch(s[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=(s[0]&32)===32,this.isHexOnly=!1;let a=s[0]&31;if(a!==31)this.tagNumber=a,this.blockLength=1;else{let c=1,u=this.valueHexView=new Uint8Array(255),f=255;for(;s[c]&128;){if(u[c-1]=s[c]&127,c++,c>=s.length)return this.error="End of input reached before message was fully decoded",-1;if(c===f){f+=255;let d=new Uint8Array(f);for(let h=0;h<u.length;h++)d[h]=u[h];u=this.valueHexView=new Uint8Array(f)}}this.blockLength=c+1,u[c-1]=s[c]&127;let l=new Uint8Array(c);for(let d=0;d<c;d++)l[d]=u[d];u=this.valueHexView=new Uint8Array(c),u.set(l),this.blockLength<=9?this.tagNumber=gr(u,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 e+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}};hs.NAME="identificationBlock";var ds=class extends Te{constructor({lenBlock:t={}}={}){var e,n,o;super(),this.isIndefiniteForm=(e=t.isIndefiniteForm)!==null&&e!==void 0?e:!1,this.longFormUsed=(n=t.longFormUsed)!==null&&n!==void 0?n:!1,this.length=(o=t.length)!==null&&o!==void 0?o:0}fromBER(t,e,n){let o=q.BufferSourceConverter.toUint8Array(t);if(!Pe(this,o,e,n))return-1;let s=o.subarray(e,e+n);if(s.length===0)return this.error="Zero buffer length",-1;if(s[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=s[0]===128,this.isIndefiniteForm)return this.blockLength=1,e+this.blockLength;if(this.longFormUsed=!!(s[0]&128),this.longFormUsed===!1)return this.length=s[0],this.blockLength=1,e+this.blockLength;let i=s[0]&127;if(i>8)return this.error="Too big integer",-1;if(i+1>s.length)return this.error="End of input reached before message was fully decoded",-1;let a=e+1,c=o.subarray(a,a+i);return c[i-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=gr(c,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=i+1,e+this.blockLength}toBER(t=!1){let e,n;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return e=new ArrayBuffer(1),t===!1&&(n=new Uint8Array(e),n[0]=128),e;if(this.longFormUsed){let o=Xe(this.length,8);if(o.byteLength>127)return this.error="Too big length",ae;if(e=new ArrayBuffer(o.byteLength+1),t)return e;let s=new Uint8Array(o);n=new Uint8Array(e),n[0]=o.byteLength|128;for(let i=0;i<o.byteLength;i++)n[i+1]=s[i];return e}return e=new ArrayBuffer(1),t===!1&&(n=new Uint8Array(e),n[0]=this.length),e}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}};ds.NAME="lengthBlock";var C={},At=class extends Te{constructor({name:t=tn,optional:e=!1,primitiveSchema:n,...o}={},s){super(o),this.name=t,this.optional=e,n&&(this.primitiveSchema=n),this.idBlock=new hs(o),this.lenBlock=new ds(o),this.valueBlock=s?new s(o):new Lt(o)}fromBER(t,e,n){let o=this.valueBlock.fromBER(t,e,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return o===-1?(this.error=this.valueBlock.error,o):(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),o)}toBER(t,e){let n=e||new $n;e||qf(this);let o=this.idBlock.toBER(t);if(n.write(o),this.lenBlock.isIndefiniteForm)n.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(t,n),n.write(new ArrayBuffer(2));else{let s=this.valueBlock.toBER(t);this.lenBlock.length=s.byteLength;let i=this.lenBlock.toBER(t);n.write(i),n.write(s)}return e?ae:n.final()}toJSON(){let t={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(t.primitiveSchema=this.primitiveSchema.toJSON()),t}toString(t="ascii"){return t==="ascii"?this.onAsciiEncoding():q.Convert.ToHex(this.toBER())}onAsciiEncoding(){return`${this.constructor.NAME} : ${q.Convert.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(t){if(this===t)return!0;if(!(t instanceof this.constructor))return!1;let e=this.toBER(),n=t.toBER();return Ff(e,n)}};At.NAME="BaseBlock";function qf(r){if(r instanceof C.Constructed)for(let t of r.valueBlock.value)qf(t)&&(r.lenBlock.isIndefiniteForm=!0);return!!r.lenBlock.isIndefiniteForm}var ps=class extends At{constructor({value:t=tn,...e}={},n){super(e,n),t&&this.fromString(t)}getValue(){return this.valueBlock.value}setValue(t){this.valueBlock.value=t}fromBER(t,e,n){let o=this.valueBlock.fromBER(t,e,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return o===-1?(this.error=this.valueBlock.error,o):(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),o)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}};ps.NAME="BaseStringBlock";var ms=class extends Re(Lt){constructor({isHexOnly:t=!0,...e}={}){super(e),this.isHexOnly=t}};ms.NAME="PrimitiveValueBlock";var zf,gs=class extends At{constructor(t={}){super(t,ms),this.idBlock.isConstructed=!1}};zf=gs;C.Primitive=zf;gs.NAME="PRIMITIVE";function B0(r,t){if(r instanceof t)return r;let e=new t;return e.idBlock=r.idBlock,e.lenBlock=r.lenBlock,e.warnings=r.warnings,e.valueBeforeDecodeView=r.valueBeforeDecodeView,e}function Xs(r,t=0,e=r.length){let n=t,o=new At({},Lt),s=new Te;if(!Pe(s,r,t,e))return o.error=s.error,{offset:-1,result:o};if(!r.subarray(t,t+e).length)return o.error="Zero buffer length",{offset:-1,result:o};let a=o.idBlock.fromBER(r,t,e);if(o.idBlock.warnings.length&&o.warnings.concat(o.idBlock.warnings),a===-1)return o.error=o.idBlock.error,{offset:-1,result:o};if(t=a,e-=o.idBlock.blockLength,a=o.lenBlock.fromBER(r,t,e),o.lenBlock.warnings.length&&o.warnings.concat(o.lenBlock.warnings),a===-1)return o.error=o.lenBlock.error,{offset:-1,result:o};if(t=a,e-=o.lenBlock.blockLength,!o.idBlock.isConstructed&&o.lenBlock.isIndefiniteForm)return o.error="Indefinite length form used for primitive encoding form",{offset:-1,result:o};let c=At;switch(o.idBlock.tagClass){case 1:if(o.idBlock.tagNumber>=37&&o.idBlock.isHexOnly===!1)return o.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:o};switch(o.idBlock.tagNumber){case 0:if(o.idBlock.isConstructed&&o.lenBlock.length>0)return o.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:o};c=C.EndOfContent;break;case 1:c=C.Boolean;break;case 2:c=C.Integer;break;case 3:c=C.BitString;break;case 4:c=C.OctetString;break;case 5:c=C.Null;break;case 6:c=C.ObjectIdentifier;break;case 10:c=C.Enumerated;break;case 12:c=C.Utf8String;break;case 13:c=C.RelativeObjectIdentifier;break;case 14:c=C.TIME;break;case 15:return o.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:o};case 16:c=C.Sequence;break;case 17:c=C.Set;break;case 18:c=C.NumericString;break;case 19:c=C.PrintableString;break;case 20:c=C.TeletexString;break;case 21:c=C.VideotexString;break;case 22:c=C.IA5String;break;case 23:c=C.UTCTime;break;case 24:c=C.GeneralizedTime;break;case 25:c=C.GraphicString;break;case 26:c=C.VisibleString;break;case 27:c=C.GeneralString;break;case 28:c=C.UniversalString;break;case 29:c=C.CharacterString;break;case 30:c=C.BmpString;break;case 31:c=C.DATE;break;case 32:c=C.TimeOfDay;break;case 33:c=C.DateTime;break;case 34:c=C.Duration;break;default:{let u=o.idBlock.isConstructed?new C.Constructed:new C.Primitive;u.idBlock=o.idBlock,u.lenBlock=o.lenBlock,u.warnings=o.warnings,o=u}}break;case 2:case 3:case 4:default:c=o.idBlock.isConstructed?C.Constructed:C.Primitive}return o=B0(o,c),a=o.fromBER(r,t,o.lenBlock.isIndefiniteForm?e:o.lenBlock.length),o.valueBeforeDecodeView=r.subarray(n,n+o.blockLength),{offset:a,result:o}}function jc(r){if(!r.byteLength){let t=new At({},Lt);return t.error="Input buffer has zero length",{offset:-1,result:t}}return Xs(q.BufferSourceConverter.toUint8Array(r).slice(),0,r.byteLength)}function I0(r,t){return r?1:t}var de=class extends Lt{constructor({value:t=[],isIndefiniteForm:e=!1,...n}={}){super(n),this.value=t,this.isIndefiniteForm=e}fromBER(t,e,n){let o=q.BufferSourceConverter.toUint8Array(t);if(!Pe(this,o,e,n))return-1;if(this.valueBeforeDecodeView=o.subarray(e,e+n),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),e;let s=e;for(;I0(this.isIndefiniteForm,n)>0;){let i=Xs(o,s,n);if(i.offset===-1)return this.error=i.result.error,this.warnings.concat(i.result.warnings),-1;if(s=i.offset,this.blockLength+=i.result.blockLength,n-=i.result.blockLength,this.value.push(i.result),this.isIndefiniteForm&&i.result.constructor.NAME===Kn)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===Kn?this.value.pop():this.warnings.push("No EndOfContent block encoded")),s}toBER(t,e){let n=e||new $n;for(let o=0;o<this.value.length;o++)this.value[o].toBER(t,n);return e?ae:n.final()}toJSON(){let t={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(let e of this.value)t.value.push(e.toJSON());return t}};de.NAME="ConstructedValueBlock";var Gf,Ye=class extends At{constructor(t={}){super(t,de),this.idBlock.isConstructed=!0}fromBER(t,e,n){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;let o=this.valueBlock.fromBER(t,e,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return o===-1?(this.error=this.valueBlock.error,o):(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),o)}onAsciiEncoding(){let t=[];for(let n of this.valueBlock.value)t.push(n.toString("ascii").split(`
|
|
3
3
|
`).map(o=>` ${o}`).join(`
|
|
4
4
|
`));let e=this.idBlock.tagClass===3?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return t.length?`${e} :
|
|
5
5
|
${t.join(`
|
|
@@ -16,7 +16,7 @@ ${t.join(`
|
|
|
16
16
|
`),e),e.log.trace('handle: responded with "%s" for "%s"',o,o),{stream:n.unwrap(),protocol:o};if(o==="ls"){let s=new wt(...t.map(i=>Sa.single(P(`${i}
|
|
17
17
|
`))),P(`
|
|
18
18
|
`));e.log.trace('handle: respond with "%s" for %s',t,o),await Tr(n,s,e),e.log.trace('handle: responded with "%s" for %s',t,o);continue}e.log('handle: respond with "na" for "%s"',o),await Tr(n,P(`na
|
|
19
|
-
`),e),e.log('handle: responded with "na" for "%s"',o)}}var cb=500,_u=class{id;remoteAddr;remotePeer;direction;timeline;multiplexer;encryption;status;limits;log;tags;_newStream;_close;_abort;_getStreams;constructor(t){let{remoteAddr:e,remotePeer:n,newStream:o,close:s,abort:i,getStreams:a}=t;this.id=`${parseInt(String(Math.random()*1e9)).toString(36)}${Date.now()}`,this.remoteAddr=e,this.remotePeer=n,this.direction=t.direction,this.status="open",this.timeline=t.timeline,this.multiplexer=t.multiplexer,this.encryption=t.encryption,this.limits=t.limits,this.log=t.logger.forComponent(`libp2p:connection:${this.direction}:${this.id}`),this.remoteAddr.getPeerId()==null&&(this.remoteAddr=this.remoteAddr.encapsulate(`/p2p/${this.remotePeer}`)),this._newStream=o,this._close=s,this._abort=i,this._getStreams=a,this.tags=[]}[Symbol.toStringTag]="Connection";[Ru]=!0;get streams(){return this._getStreams()}async newStream(t,e){if(this.status==="closing")throw new Ro("the connection is being closed");if(this.status==="closed")throw new Do("the connection is closed");if(Array.isArray(t)||(t=[t]),this.limits!=null&&e?.runOnLimitedConnection!==!0)throw new Mr("Cannot open protocol stream on limited connection");let n=await this._newStream(t,e);return n.direction="outbound",n}async close(t={}){if(!(this.status==="closed"||this.status==="closing")){if(this.log("closing connection to %a",this.remoteAddr),this.status="closing",t.signal==null){let e=AbortSignal.timeout(cb);tt(1/0,e),t={...t,signal:e}}try{this.log.trace("closing all streams"),await Promise.all(this.streams.map(async e=>e.close(t))),this.log.trace("closing underlying transport"),await this._close(t),this.log.trace("updating timeline with close time"),this.status="closed",this.timeline.close=Date.now()}catch(e){this.log.error("error encountered during graceful close of connection to %a",this.remoteAddr,e),this.abort(e)}}}abort(t){this.log.error("aborting connection to %a due to error",this.remoteAddr,t),this.status="closing",this.streams.forEach(e=>{e.abort(t)}),this.log.error("all streams aborted",this.streams.length),this._abort(t),this.timeline.close=Date.now(),this.status="closed"}};function Np(r){return new _u(r)}var lb=3e4;function ub(r,t){try{let{options:e}=t.getHandler(r);return e.maxInboundStreams}catch(e){if(e.name!=="UnhandledProtocolError")throw e}return bu}function fb(r,t,e={}){try{let{options:n}=t.getHandler(r);if(n.maxOutboundStreams!=null)return n.maxOutboundStreams}catch(n){if(n.name!=="UnhandledProtocolError")throw n}return e.maxOutboundStreams??xu}function Pp(r,t,e){let n=0;return e.streams.forEach(o=>{o.direction===t&&o.protocol===r&&n++}),n}var ka=class{components;connectionEncrypters;streamMuxers;inboundUpgradeTimeout;events;constructor(t,e){this.components=t,this.connectionEncrypters=new Map,e.connectionEncrypters.forEach(n=>{this.connectionEncrypters.set(n.protocol,n)}),this.streamMuxers=new Map,e.streamMuxers.forEach(n=>{this.streamMuxers.set(n.protocol,n)}),this.inboundUpgradeTimeout=e.inboundUpgradeTimeout??2e3,this.events=t.events}[Symbol.toStringTag]="@libp2p/upgrader";async shouldBlockConnection(t,e,n){let o=this.components.connectionGater[n];if(o!==void 0&&await o(t,e))throw new Ao(`The multiaddr connection is blocked by gater.${n}`)}async upgradeInbound(t,e){if(!await this.components.connectionManager.acceptIncomingConnection(t))throw new zi("connection denied");let o,s,i,a,c,u=AbortSignal.timeout(this.inboundUpgradeTimeout),f=()=>{t.abort(new Rr("inbound upgrade timeout"))};u.addEventListener("abort",f,{once:!0}),tt(1/0,u);try{if(await this.components.connectionGater.denyInboundConnection?.(t)===!0)throw new Ao("The multiaddr connection is blocked by gater.acceptConnection");this.components.metrics?.trackMultiaddrConnection(t),t.log("starting the inbound connection upgrade");let l=t;if(e?.skipProtection!==!0){let d=this.components.connectionProtector;d!=null&&(t.log("protecting the inbound connection"),l=await d.protect(t))}try{if(o=l,e?.skipEncryption!==!0){e?.onProgress?.(new ft("upgrader:encrypt-inbound-connection")),{conn:o,remotePeer:s,protocol:c}=await this._encryptInbound(l);let d={...l,...o};await this.shouldBlockConnection(s,d,"denyInboundEncryptedConnection")}else{let d=t.remoteAddr.getPeerId();if(d==null)throw new Pr("inbound connection that skipped encryption must have a peer id");let h=ge(d);c="native",s=h}if(i=o,e?.muxerFactory!=null)a=e.muxerFactory;else if(this.streamMuxers.size>0){e?.onProgress?.(new ft("upgrader:multiplex-inbound-connection"));let d=await this._multiplexInbound({...l,...o},this.streamMuxers);a=d.muxerFactory,i=d.stream}}catch(d){throw t.log.error("failed to upgrade inbound connection",d),d}return await this.shouldBlockConnection(s,t,"denyInboundUpgradedConnection"),t.log("successfully upgraded inbound connection"),this._createConnection({cryptoProtocol:c,direction:"inbound",maConn:t,upgradedConn:i,muxerFactory:a,remotePeer:s,limits:e?.limits})}finally{u.removeEventListener("abort",f),this.components.connectionManager.afterUpgradeInbound()}}async upgradeOutbound(t,e){let n=t.remoteAddr.getPeerId(),o;n!=null&&(o=ge(n),await this.shouldBlockConnection(o,t,"denyOutboundConnection"));let s,i,a,c,u;this.components.metrics?.trackMultiaddrConnection(t),t.log("starting the outbound connection upgrade");let f=t;if(e?.skipProtection!==!0){let l=this.components.connectionProtector;l!=null&&(f=await l.protect(t))}try{if(s=f,e?.skipEncryption!==!0){({conn:s,remotePeer:i,protocol:c}=await this._encryptOutbound(f,{...e,remotePeer:o}));let l={...f,...s};await this.shouldBlockConnection(i,l,"denyOutboundEncryptedConnection")}else{if(o==null)throw new Uo("Encryption was skipped but no peer id was passed");c="native",i=o}if(a=s,e?.muxerFactory!=null)u=e.muxerFactory;else if(this.streamMuxers.size>0){let l=await this._multiplexOutbound({...f,...s},this.streamMuxers);u=l.muxerFactory,a=l.stream}}catch(l){throw t.log.error("failed to upgrade outbound connection",l),await t.close(l),l}return await this.shouldBlockConnection(i,t,"denyOutboundUpgradedConnection"),t.log("successfully upgraded outbound connection"),this._createConnection({cryptoProtocol:c,direction:"outbound",maConn:t,upgradedConn:a,muxerFactory:u,remotePeer:i,limits:e?.limits})}_createConnection(t){let{cryptoProtocol:e,direction:n,maConn:o,upgradedConn:s,remotePeer:i,muxerFactory:a,limits:c}=t,u,f,l;a!=null&&(u=a.createStreamMuxer({direction:n,onIncomingStream:p=>{l!=null&&Promise.resolve().then(async()=>{let m=this.components.registrar.getProtocols(),{stream:g,protocol:y}=await To(p,m,{log:p.log,yieldBytes:!1});if(l==null)return;l.log("incoming stream opened on %s",y);let b=ub(y,this.components.registrar);if(Pp(y,"inbound",l)===b){let x=new Ho(`Too many inbound protocol streams for protocol "${y}" - limit ${b}`);throw p.abort(x),x}p.source=g.source,p.sink=g.sink,p.protocol=y,g.closeWrite!=null&&(p.closeWrite=g.closeWrite),g.closeRead!=null&&(p.closeRead=g.closeRead),g.close!=null&&(p.close=g.close),await this.components.peerStore.merge(i,{protocols:[y]}),this.components.metrics?.trackProtocolStream(p,l),this._onStream({connection:l,stream:p,protocol:y})}).catch(async m=>{l.log.error("error handling incoming stream id %s",p.id,m.message,m.code,m.stack),p.timeline.close==null&&await p.close()})}}),f=async(p,m={})=>{if(u==null)throw new Ir("Connection is not multiplexed");l.log("starting new stream for protocols %s",p);let g=await u.newStream();l.log.trace("started new stream %s for protocols %s",g.id,p);try{if(m.signal==null){g.log("no abort signal was passed while trying to negotiate protocols %s falling back to default timeout",p);let A=AbortSignal.timeout(lb);tt(1/0,A),m={...m,signal:A}}g.log.trace("selecting protocol from protocols %s",p);let{stream:y,protocol:b}=await ko(g,p,{...m,log:g.log,yieldBytes:!0});g.log("selected protocol %s",b);let w=fb(b,this.components.registrar,m),x=Pp(b,"outbound",l);if(x>=w){let A=new $o(`Too many outbound protocol streams for protocol "${b}" - ${x}/${w}`);throw g.abort(A),A}return await this.components.peerStore.merge(i,{protocols:[b]}),g.source=y.source,g.sink=y.sink,g.protocol=b,y.closeWrite!=null&&(g.closeWrite=y.closeWrite),y.closeRead!=null&&(g.closeRead=y.closeRead),y.close!=null&&(g.close=y.close),this.components.metrics?.trackProtocolStream(g,l),g}catch(y){throw l.log.error("could not create new stream for protocols %s",p,y),g.timeline.close==null&&g.abort(y),y}},Promise.all([u.sink(s.source),s.sink(u.source)]).catch(p=>{l.log.error("error piping data through muxer",p)}));let d=o.timeline;o.timeline=new Proxy(d,{set:(...p)=>(l!=null&&p[1]==="close"&&p[2]!=null&&d.close==null&&(async()=>{try{l.status==="open"&&await l.close()}catch(m){l.log.error("error closing connection after timeline close",m)}finally{this.events.safeDispatchEvent("connection:close",{detail:l})}})().catch(m=>{l.log.error("error thrown while dispatching connection:close event",m)}),Reflect.set(...p))}),o.timeline.upgraded=Date.now();let h=()=>{throw new Ir("Connection is not multiplexed")};return l=Np({remoteAddr:o.remoteAddr,remotePeer:i,status:"open",direction:n,timeline:o.timeline,multiplexer:u?.protocol,encryption:e,limits:c,logger:this.components.logger,newStream:f??h,getStreams:()=>u!=null?u.streams:[],close:async p=>{u!=null&&(l.log.trace("close muxer"),await u.close(p)),l.log.trace("close maconn"),await o.close(p),l.log.trace("closed maconn")},abort:p=>{o.abort(p),u?.abort(p)}}),this.events.safeDispatchEvent("connection:open",{detail:l}),l}_onStream(t){let{connection:e,stream:n,protocol:o}=t,{handler:s,options:i}=this.components.registrar.getHandler(o);if(e.limits!=null&&i.runOnLimitedConnection!==!0)throw new Mr("Cannot open protocol stream on limited connection");s({connection:e,stream:n})}async _encryptInbound(t,e){let n=Array.from(this.connectionEncrypters.keys());t.log("handling inbound crypto protocol selection",n);try{let{stream:o,protocol:s}=await To(t,n,{log:t.log}),i=this.connectionEncrypters.get(s);if(i==null)throw new Error(`no crypto module found for ${s}`);return t.log("encrypting inbound connection using",s),{...await i.secureInbound(o,e),protocol:s}}catch(o){throw t.log.error("encrypting inbound connection failed",o),new So(o.message)}}async _encryptOutbound(t,e){let n=Array.from(this.connectionEncrypters.keys());t.log("selecting outbound crypto protocol",n);try{t.log.trace("selecting encrypter from %s",n);let{stream:o,protocol:s}=await ko(t,n,{log:t.log,yieldBytes:!0}),i=this.connectionEncrypters.get(s);if(i==null)throw new Error(`no crypto module found for ${s}`);return t.log("encrypting outbound connection to %p using %s",e?.remotePeer,i),{...await i.secureOutbound(o,e),protocol:s}}catch(o){throw t.log.error("encrypting outbound connection to %p failed",e?.remotePeer,o),new So(o.message)}}async _multiplexOutbound(t,e){let n=Array.from(e.keys());t.log("outbound selecting muxer %s",n);try{t.log.trace("selecting stream muxer from %s",n);let{stream:o,protocol:s}=await ko(t,n,{log:t.log,yieldBytes:!0});t.log("selected %s as muxer protocol",s);let i=e.get(s);return{stream:o,muxerFactory:i}}catch(o){throw t.log.error("error multiplexing outbound connection",o),new Ir(String(o))}}async _multiplexInbound(t,e){let n=Array.from(e.keys());t.log("inbound handling muxers %s",n);try{let{stream:o,protocol:s}=await To(t,n,{log:t.log}),i=e.get(s);return{stream:o,muxerFactory:i}}catch(o){throw t.log.error("error multiplexing inbound connection",o),new Ir(String(o))}}};var Rp="2.0.0",Dp="libp2p";var Ca=class extends ve{peerId;peerStore;contentRouting;peerRouting;metrics;services;logger;status;components;log;constructor(t){super(),this.status="stopped";let e=new ve,n=e.dispatchEvent.bind(e);e.dispatchEvent=a=>{let c=n(a),u=this.dispatchEvent(new CustomEvent(a.type,{detail:a.detail}));return c||u},tt(1/0,e),this.peerId=t.peerId,this.logger=t.logger??Ei(),this.log=this.logger.forComponent("libp2p"),this.services={};let o=this.components=up({peerId:t.peerId,privateKey:t.privateKey,nodeInfo:t.nodeInfo??{name:Dp,version:Rp},logger:this.logger,events:e,datastore:t.datastore??new Oi,connectionGater:hp(t.connectionGater),dns:t.dns});this.peerStore=this.configureComponent("peerStore",new Di(o,{addressFilter:this.components.connectionGater.filterMultiaddrForPeer,...t.peerStore})),t.metrics!=null&&(this.metrics=this.configureComponent("metrics",t.metrics(this.components))),o.events.addEventListener("peer:update",a=>{if(a.detail.previous==null){let c={id:a.detail.peer.id,multiaddrs:a.detail.peer.addresses.map(u=>u.multiaddr)};o.events.safeDispatchEvent("peer:discovery",{detail:c})}}),t.connectionProtector!=null&&this.configureComponent("connectionProtector",t.connectionProtector(o)),this.components.upgrader=new ka(this.components,{connectionEncrypters:(t.connectionEncrypters??[]).map((a,c)=>this.configureComponent(`connection-encryption-${c}`,a(this.components))),streamMuxers:(t.streamMuxers??[]).map((a,c)=>this.configureComponent(`stream-muxers-${c}`,a(this.components))),inboundUpgradeTimeout:t.connectionManager?.inboundUpgradeTimeout}),this.configureComponent("transportManager",new wa(this.components,t.transportManager)),this.configureComponent("connectionManager",new ca(this.components,t.connectionManager)),t.connectionMonitor?.enabled!==!1&&this.configureComponent("connectionMonitor",new ha(this.components,t.connectionMonitor)),this.configureComponent("registrar",new ya(this.components)),this.configureComponent("addressManager",new Fi(this.components,t.addresses));let s=(t.peerRouters??[]).map((a,c)=>this.configureComponent(`peer-router-${c}`,a(this.components)));this.peerRouting=this.components.peerRouting=this.configureComponent("peerRouting",new ma(this.components,{routers:s}));let i=(t.contentRouters??[]).map((a,c)=>this.configureComponent(`content-router-${c}`,a(this.components)));if(this.contentRouting=this.components.contentRouting=this.configureComponent("contentRouting",new da(this.components,{routers:i})),this.configureComponent("randomWalk",new ga(this.components)),(t.peerDiscovery??[]).forEach((a,c)=>{this.configureComponent(`peer-discovery-${c}`,a(this.components)).addEventListener("peer",f=>{this.#t(f)})}),t.transports?.forEach((a,c)=>{this.components.transportManager.add(this.configureComponent(`transport-${c}`,a(this.components)))}),t.services!=null)for(let a of Object.keys(t.services)){let c=t.services[a],u=c(this.components);if(u==null){this.log.error("service factory %s returned null or undefined instance",a);continue}this.services[a]=u,this.configureComponent(a,u),u[La]!=null&&(this.log("registering service %s for content routing",a),i.push(u[La])),u[Pa]!=null&&(this.log("registering service %s for peer routing",a),s.push(u[Pa])),u[Na]!=null&&(this.log("registering service %s for peer discovery",a),u[Na].addEventListener?.("peer",f=>{this.#t(f)}))}fp(o)}configureComponent(t,e){return e==null&&this.log.error("component %s was null or undefined",t),this.components[t]=e,e}async start(){if(this.status==="stopped"){this.status="starting",this.log("libp2p is starting");try{await this.components.beforeStart?.(),await this.components.start(),await this.components.afterStart?.(),this.status="started",this.safeDispatchEvent("start",{detail:this}),this.log("libp2p has started")}catch(t){throw this.log.error("An error occurred starting libp2p",t),this.status="started",await this.stop(),t}}}async stop(){this.status==="started"&&(this.log("libp2p is stopping"),this.status="stopping",await this.components.beforeStop?.(),await this.components.stop(),await this.components.afterStop?.(),this.status="stopped",this.safeDispatchEvent("stop",{detail:this}),this.log("libp2p has stopped"))}getConnections(t){return this.components.connectionManager.getConnections(t)}getDialQueue(){return this.components.connectionManager.getDialQueue()}getPeers(){let t=new br;for(let e of this.components.connectionManager.getConnections())t.add(e.remotePeer);return Array.from(t)}async dial(t,e={}){return this.components.connectionManager.openConnection(t,{priority:75,...e})}async dialProtocol(t,e,n={}){if(e==null)throw new D("no protocols were provided to open a stream");if(e=Array.isArray(e)?e:[e],e.length===0)throw new D("no protocols were provided to open a stream");return(await this.dial(t,n)).newStream(e,n)}getMultiaddrs(){return this.components.addressManager.getAddresses()}getProtocols(){return this.components.registrar.getProtocols()}async hangUp(t,e={}){Qe(t)&&(t=ge(t.getPeerId()??"")),await this.components.connectionManager.closeConnections(t,e)}async getPublicKey(t,e={}){if(this.log("getPublicKey %p",t),t.publicKey!=null)return t.publicKey;try{let i=await this.peerStore.get(t);if(i.id.publicKey!=null)return i.id.publicKey}catch(i){if(i.name!=="NotFoundError")throw i}let n=Ft([P("/pk/"),t.toMultihash().bytes]),o=await this.contentRouting.get(n,e),s=nn(o);return await this.peerStore.patch(t,{publicKey:s}),s}async handle(t,e,n){Array.isArray(t)||(t=[t]),await Promise.all(t.map(async o=>{await this.components.registrar.handle(o,e,n)}))}async unhandle(t){Array.isArray(t)||(t=[t]),await Promise.all(t.map(async e=>{await this.components.registrar.unhandle(e)}))}async register(t,e){return this.components.registrar.register(t,e)}unregister(t){this.components.registrar.unregister(t)}async isDialable(t,e={}){return this.components.connectionManager.isDialable(t,e)}#t(t){let{detail:e}=t;if(e.id.toString()===this.peerId.toString()){this.log.error("peer discovery mechanism discovered self");return}this.components.peerStore.merge(e.id,{multiaddrs:e.multiaddrs}).catch(n=>{this.log.error(n)})}};async function db(r={}){r.privateKey??=await Wh("Ed25519");let t=new Ca({...await Od(r),peerId:Yh(r.privateKey)});return r.start!==!1&&await t.start(),t}return Zp(pb);})();
|
|
19
|
+
`),e),e.log('handle: responded with "na" for "%s"',o)}}var cb=500,_u=class{id;remoteAddr;remotePeer;direction;timeline;multiplexer;encryption;status;limits;log;tags;_newStream;_close;_abort;_getStreams;constructor(t){let{remoteAddr:e,remotePeer:n,newStream:o,close:s,abort:i,getStreams:a}=t;this.id=`${parseInt(String(Math.random()*1e9)).toString(36)}${Date.now()}`,this.remoteAddr=e,this.remotePeer=n,this.direction=t.direction,this.status="open",this.timeline=t.timeline,this.multiplexer=t.multiplexer,this.encryption=t.encryption,this.limits=t.limits,this.log=t.logger.forComponent(`libp2p:connection:${this.direction}:${this.id}`),this.remoteAddr.getPeerId()==null&&(this.remoteAddr=this.remoteAddr.encapsulate(`/p2p/${this.remotePeer}`)),this._newStream=o,this._close=s,this._abort=i,this._getStreams=a,this.tags=[]}[Symbol.toStringTag]="Connection";[Ru]=!0;get streams(){return this._getStreams()}async newStream(t,e){if(this.status==="closing")throw new Ro("the connection is being closed");if(this.status==="closed")throw new Do("the connection is closed");if(Array.isArray(t)||(t=[t]),this.limits!=null&&e?.runOnLimitedConnection!==!0)throw new Mr("Cannot open protocol stream on limited connection");let n=await this._newStream(t,e);return n.direction="outbound",n}async close(t={}){if(!(this.status==="closed"||this.status==="closing")){if(this.log("closing connection to %a",this.remoteAddr),this.status="closing",t.signal==null){let e=AbortSignal.timeout(cb);tt(1/0,e),t={...t,signal:e}}try{this.log.trace("closing all streams"),await Promise.all(this.streams.map(async e=>e.close(t))),this.log.trace("closing underlying transport"),await this._close(t),this.log.trace("updating timeline with close time"),this.status="closed",this.timeline.close=Date.now()}catch(e){this.log.error("error encountered during graceful close of connection to %a",this.remoteAddr,e),this.abort(e)}}}abort(t){this.log.error("aborting connection to %a due to error",this.remoteAddr,t),this.status="closing",this.streams.forEach(e=>{e.abort(t)}),this.log.error("all streams aborted",this.streams.length),this._abort(t),this.timeline.close=Date.now(),this.status="closed"}};function Np(r){return new _u(r)}var lb=3e4;function ub(r,t){try{let{options:e}=t.getHandler(r);return e.maxInboundStreams}catch(e){if(e.name!=="UnhandledProtocolError")throw e}return bu}function fb(r,t,e={}){try{let{options:n}=t.getHandler(r);if(n.maxOutboundStreams!=null)return n.maxOutboundStreams}catch(n){if(n.name!=="UnhandledProtocolError")throw n}return e.maxOutboundStreams??xu}function Pp(r,t,e){let n=0;return e.streams.forEach(o=>{o.direction===t&&o.protocol===r&&n++}),n}var ka=class{components;connectionEncrypters;streamMuxers;inboundUpgradeTimeout;events;constructor(t,e){this.components=t,this.connectionEncrypters=new Map,e.connectionEncrypters.forEach(n=>{this.connectionEncrypters.set(n.protocol,n)}),this.streamMuxers=new Map,e.streamMuxers.forEach(n=>{this.streamMuxers.set(n.protocol,n)}),this.inboundUpgradeTimeout=e.inboundUpgradeTimeout??2e3,this.events=t.events}[Symbol.toStringTag]="@libp2p/upgrader";async shouldBlockConnection(t,e,n){let o=this.components.connectionGater[n];if(o!==void 0&&await o(t,e))throw new Ao(`The multiaddr connection is blocked by gater.${n}`)}async upgradeInbound(t,e){if(!await this.components.connectionManager.acceptIncomingConnection(t))throw new zi("connection denied");let o,s,i,a,c,u=AbortSignal.timeout(this.inboundUpgradeTimeout),f=()=>{t.abort(new Rr("inbound upgrade timeout"))};u.addEventListener("abort",f,{once:!0}),tt(1/0,u);try{if(await this.components.connectionGater.denyInboundConnection?.(t)===!0)throw new Ao("The multiaddr connection is blocked by gater.acceptConnection");this.components.metrics?.trackMultiaddrConnection(t),t.log("starting the inbound connection upgrade");let l=t;if(e?.skipProtection!==!0){let d=this.components.connectionProtector;d!=null&&(t.log("protecting the inbound connection"),l=await d.protect(t))}try{if(o=l,e?.skipEncryption!==!0){e?.onProgress?.(new ft("upgrader:encrypt-inbound-connection")),{conn:o,remotePeer:s,protocol:c}=await this._encryptInbound(l);let d={...l,...o};await this.shouldBlockConnection(s,d,"denyInboundEncryptedConnection")}else{let d=t.remoteAddr.getPeerId();if(d==null)throw new Pr("inbound connection that skipped encryption must have a peer id");let h=ge(d);c="native",s=h}if(i=o,e?.muxerFactory!=null)a=e.muxerFactory;else if(this.streamMuxers.size>0){e?.onProgress?.(new ft("upgrader:multiplex-inbound-connection"));let d=await this._multiplexInbound({...l,...o},this.streamMuxers);a=d.muxerFactory,i=d.stream}}catch(d){throw t.log.error("failed to upgrade inbound connection",d),d}return await this.shouldBlockConnection(s,t,"denyInboundUpgradedConnection"),t.log("successfully upgraded inbound connection"),this._createConnection({cryptoProtocol:c,direction:"inbound",maConn:t,upgradedConn:i,muxerFactory:a,remotePeer:s,limits:e?.limits})}finally{u.removeEventListener("abort",f),this.components.connectionManager.afterUpgradeInbound()}}async upgradeOutbound(t,e){let n=t.remoteAddr.getPeerId(),o;n!=null&&(o=ge(n),await this.shouldBlockConnection(o,t,"denyOutboundConnection"));let s,i,a,c,u;this.components.metrics?.trackMultiaddrConnection(t),t.log("starting the outbound connection upgrade");let f=t;if(e?.skipProtection!==!0){let l=this.components.connectionProtector;l!=null&&(f=await l.protect(t))}try{if(s=f,e?.skipEncryption!==!0){({conn:s,remotePeer:i,protocol:c}=await this._encryptOutbound(f,{...e,remotePeer:o}));let l={...f,...s};await this.shouldBlockConnection(i,l,"denyOutboundEncryptedConnection")}else{if(o==null)throw new Uo("Encryption was skipped but no peer id was passed");c="native",i=o}if(a=s,e?.muxerFactory!=null)u=e.muxerFactory;else if(this.streamMuxers.size>0){let l=await this._multiplexOutbound({...f,...s},this.streamMuxers);u=l.muxerFactory,a=l.stream}}catch(l){throw t.log.error("failed to upgrade outbound connection",l),await t.close(l),l}return await this.shouldBlockConnection(i,t,"denyOutboundUpgradedConnection"),t.log("successfully upgraded outbound connection"),this._createConnection({cryptoProtocol:c,direction:"outbound",maConn:t,upgradedConn:a,muxerFactory:u,remotePeer:i,limits:e?.limits})}_createConnection(t){let{cryptoProtocol:e,direction:n,maConn:o,upgradedConn:s,remotePeer:i,muxerFactory:a,limits:c}=t,u,f,l;a!=null&&(u=a.createStreamMuxer({direction:n,onIncomingStream:p=>{l!=null&&Promise.resolve().then(async()=>{let m=this.components.registrar.getProtocols(),{stream:g,protocol:y}=await To(p,m,{log:p.log,yieldBytes:!1});if(l==null)return;l.log("incoming stream opened on %s",y);let b=ub(y,this.components.registrar);if(Pp(y,"inbound",l)===b){let x=new Ho(`Too many inbound protocol streams for protocol "${y}" - limit ${b}`);throw p.abort(x),x}p.source=g.source,p.sink=g.sink,p.protocol=y,g.closeWrite!=null&&(p.closeWrite=g.closeWrite),g.closeRead!=null&&(p.closeRead=g.closeRead),g.close!=null&&(p.close=g.close),await this.components.peerStore.merge(i,{protocols:[y]}),this.components.metrics?.trackProtocolStream(p,l),this._onStream({connection:l,stream:p,protocol:y})}).catch(async m=>{l.log.error("error handling incoming stream id %s",p.id,m.message,m.code,m.stack),p.timeline.close==null&&await p.close()})}}),f=async(p,m={})=>{if(u==null)throw new Ir("Connection is not multiplexed");l.log("starting new stream for protocols %s",p);let g=await u.newStream();l.log.trace("started new stream %s for protocols %s",g.id,p);try{if(m.signal==null){g.log("no abort signal was passed while trying to negotiate protocols %s falling back to default timeout",p);let A=AbortSignal.timeout(lb);tt(1/0,A),m={...m,signal:A}}g.log.trace("selecting protocol from protocols %s",p);let{stream:y,protocol:b}=await ko(g,p,{...m,log:g.log,yieldBytes:!0});g.log("selected protocol %s",b);let w=fb(b,this.components.registrar,m),x=Pp(b,"outbound",l);if(x>=w){let A=new $o(`Too many outbound protocol streams for protocol "${b}" - ${x}/${w}`);throw g.abort(A),A}return await this.components.peerStore.merge(i,{protocols:[b]}),g.source=y.source,g.sink=y.sink,g.protocol=b,y.closeWrite!=null&&(g.closeWrite=y.closeWrite),y.closeRead!=null&&(g.closeRead=y.closeRead),y.close!=null&&(g.close=y.close),this.components.metrics?.trackProtocolStream(g,l),g}catch(y){throw l.log.error("could not create new stream for protocols %s",p,y),g.timeline.close==null&&g.abort(y),y}},Promise.all([u.sink(s.source),s.sink(u.source)]).catch(p=>{l.log.error("error piping data through muxer",p)}));let d=o.timeline;o.timeline=new Proxy(d,{set:(...p)=>(l!=null&&p[1]==="close"&&p[2]!=null&&d.close==null&&(async()=>{try{l.status==="open"&&await l.close()}catch(m){l.log.error("error closing connection after timeline close",m)}finally{this.events.safeDispatchEvent("connection:close",{detail:l})}})().catch(m=>{l.log.error("error thrown while dispatching connection:close event",m)}),Reflect.set(...p))}),o.timeline.upgraded=Date.now();let h=()=>{throw new Ir("Connection is not multiplexed")};return l=Np({remoteAddr:o.remoteAddr,remotePeer:i,status:"open",direction:n,timeline:o.timeline,multiplexer:u?.protocol,encryption:e,limits:c,logger:this.components.logger,newStream:f??h,getStreams:()=>u!=null?u.streams:[],close:async p=>{u!=null&&(l.log.trace("close muxer"),await u.close(p)),l.log.trace("close maconn"),await o.close(p),l.log.trace("closed maconn")},abort:p=>{o.abort(p),u?.abort(p)}}),this.events.safeDispatchEvent("connection:open",{detail:l}),l}_onStream(t){let{connection:e,stream:n,protocol:o}=t,{handler:s,options:i}=this.components.registrar.getHandler(o);if(e.limits!=null&&i.runOnLimitedConnection!==!0)throw new Mr("Cannot open protocol stream on limited connection");s({connection:e,stream:n})}async _encryptInbound(t,e){let n=Array.from(this.connectionEncrypters.keys());t.log("handling inbound crypto protocol selection",n);try{let{stream:o,protocol:s}=await To(t,n,{log:t.log}),i=this.connectionEncrypters.get(s);if(i==null)throw new Error(`no crypto module found for ${s}`);return t.log("encrypting inbound connection using",s),{...await i.secureInbound(o,e),protocol:s}}catch(o){throw t.log.error("encrypting inbound connection failed",o),new So(o.message)}}async _encryptOutbound(t,e){let n=Array.from(this.connectionEncrypters.keys());t.log("selecting outbound crypto protocol",n);try{t.log.trace("selecting encrypter from %s",n);let{stream:o,protocol:s}=await ko(t,n,{log:t.log,yieldBytes:!0}),i=this.connectionEncrypters.get(s);if(i==null)throw new Error(`no crypto module found for ${s}`);return t.log("encrypting outbound connection to %p using %s",e?.remotePeer,i),{...await i.secureOutbound(o,e),protocol:s}}catch(o){throw t.log.error("encrypting outbound connection to %p failed",e?.remotePeer,o),new So(o.message)}}async _multiplexOutbound(t,e){let n=Array.from(e.keys());t.log("outbound selecting muxer %s",n);try{t.log.trace("selecting stream muxer from %s",n);let{stream:o,protocol:s}=await ko(t,n,{log:t.log,yieldBytes:!0});t.log("selected %s as muxer protocol",s);let i=e.get(s);return{stream:o,muxerFactory:i}}catch(o){throw t.log.error("error multiplexing outbound connection",o),new Ir(String(o))}}async _multiplexInbound(t,e){let n=Array.from(e.keys());t.log("inbound handling muxers %s",n);try{let{stream:o,protocol:s}=await To(t,n,{log:t.log}),i=e.get(s);return{stream:o,muxerFactory:i}}catch(o){throw t.log.error("error multiplexing inbound connection",o),new Ir(String(o))}}};var Rp="2.0.1-18dd3cb26",Dp="libp2p";var Ca=class extends ve{peerId;peerStore;contentRouting;peerRouting;metrics;services;logger;status;components;log;constructor(t){super(),this.status="stopped";let e=new ve,n=e.dispatchEvent.bind(e);e.dispatchEvent=a=>{let c=n(a),u=this.dispatchEvent(new CustomEvent(a.type,{detail:a.detail}));return c||u},tt(1/0,e),this.peerId=t.peerId,this.logger=t.logger??Ei(),this.log=this.logger.forComponent("libp2p"),this.services={};let o=this.components=up({peerId:t.peerId,privateKey:t.privateKey,nodeInfo:t.nodeInfo??{name:Dp,version:Rp},logger:this.logger,events:e,datastore:t.datastore??new Oi,connectionGater:hp(t.connectionGater),dns:t.dns});this.peerStore=this.configureComponent("peerStore",new Di(o,{addressFilter:this.components.connectionGater.filterMultiaddrForPeer,...t.peerStore})),t.metrics!=null&&(this.metrics=this.configureComponent("metrics",t.metrics(this.components))),o.events.addEventListener("peer:update",a=>{if(a.detail.previous==null){let c={id:a.detail.peer.id,multiaddrs:a.detail.peer.addresses.map(u=>u.multiaddr)};o.events.safeDispatchEvent("peer:discovery",{detail:c})}}),t.connectionProtector!=null&&this.configureComponent("connectionProtector",t.connectionProtector(o)),this.components.upgrader=new ka(this.components,{connectionEncrypters:(t.connectionEncrypters??[]).map((a,c)=>this.configureComponent(`connection-encryption-${c}`,a(this.components))),streamMuxers:(t.streamMuxers??[]).map((a,c)=>this.configureComponent(`stream-muxers-${c}`,a(this.components))),inboundUpgradeTimeout:t.connectionManager?.inboundUpgradeTimeout}),this.configureComponent("transportManager",new wa(this.components,t.transportManager)),this.configureComponent("connectionManager",new ca(this.components,t.connectionManager)),t.connectionMonitor?.enabled!==!1&&this.configureComponent("connectionMonitor",new ha(this.components,t.connectionMonitor)),this.configureComponent("registrar",new ya(this.components)),this.configureComponent("addressManager",new Fi(this.components,t.addresses));let s=(t.peerRouters??[]).map((a,c)=>this.configureComponent(`peer-router-${c}`,a(this.components)));this.peerRouting=this.components.peerRouting=this.configureComponent("peerRouting",new ma(this.components,{routers:s}));let i=(t.contentRouters??[]).map((a,c)=>this.configureComponent(`content-router-${c}`,a(this.components)));if(this.contentRouting=this.components.contentRouting=this.configureComponent("contentRouting",new da(this.components,{routers:i})),this.configureComponent("randomWalk",new ga(this.components)),(t.peerDiscovery??[]).forEach((a,c)=>{this.configureComponent(`peer-discovery-${c}`,a(this.components)).addEventListener("peer",f=>{this.#t(f)})}),t.transports?.forEach((a,c)=>{this.components.transportManager.add(this.configureComponent(`transport-${c}`,a(this.components)))}),t.services!=null)for(let a of Object.keys(t.services)){let c=t.services[a],u=c(this.components);if(u==null){this.log.error("service factory %s returned null or undefined instance",a);continue}this.services[a]=u,this.configureComponent(a,u),u[La]!=null&&(this.log("registering service %s for content routing",a),i.push(u[La])),u[Pa]!=null&&(this.log("registering service %s for peer routing",a),s.push(u[Pa])),u[Na]!=null&&(this.log("registering service %s for peer discovery",a),u[Na].addEventListener?.("peer",f=>{this.#t(f)}))}fp(o)}configureComponent(t,e){return e==null&&this.log.error("component %s was null or undefined",t),this.components[t]=e,e}async start(){if(this.status==="stopped"){this.status="starting",this.log("libp2p is starting");try{await this.components.beforeStart?.(),await this.components.start(),await this.components.afterStart?.(),this.status="started",this.safeDispatchEvent("start",{detail:this}),this.log("libp2p has started")}catch(t){throw this.log.error("An error occurred starting libp2p",t),this.status="started",await this.stop(),t}}}async stop(){this.status==="started"&&(this.log("libp2p is stopping"),this.status="stopping",await this.components.beforeStop?.(),await this.components.stop(),await this.components.afterStop?.(),this.status="stopped",this.safeDispatchEvent("stop",{detail:this}),this.log("libp2p has stopped"))}getConnections(t){return this.components.connectionManager.getConnections(t)}getDialQueue(){return this.components.connectionManager.getDialQueue()}getPeers(){let t=new br;for(let e of this.components.connectionManager.getConnections())t.add(e.remotePeer);return Array.from(t)}async dial(t,e={}){return this.components.connectionManager.openConnection(t,{priority:75,...e})}async dialProtocol(t,e,n={}){if(e==null)throw new D("no protocols were provided to open a stream");if(e=Array.isArray(e)?e:[e],e.length===0)throw new D("no protocols were provided to open a stream");return(await this.dial(t,n)).newStream(e,n)}getMultiaddrs(){return this.components.addressManager.getAddresses()}getProtocols(){return this.components.registrar.getProtocols()}async hangUp(t,e={}){Qe(t)&&(t=ge(t.getPeerId()??"")),await this.components.connectionManager.closeConnections(t,e)}async getPublicKey(t,e={}){if(this.log("getPublicKey %p",t),t.publicKey!=null)return t.publicKey;try{let i=await this.peerStore.get(t);if(i.id.publicKey!=null)return i.id.publicKey}catch(i){if(i.name!=="NotFoundError")throw i}let n=Ft([P("/pk/"),t.toMultihash().bytes]),o=await this.contentRouting.get(n,e),s=nn(o);return await this.peerStore.patch(t,{publicKey:s}),s}async handle(t,e,n){Array.isArray(t)||(t=[t]),await Promise.all(t.map(async o=>{await this.components.registrar.handle(o,e,n)}))}async unhandle(t){Array.isArray(t)||(t=[t]),await Promise.all(t.map(async e=>{await this.components.registrar.unhandle(e)}))}async register(t,e){return this.components.registrar.register(t,e)}unregister(t){this.components.registrar.unregister(t)}async isDialable(t,e={}){return this.components.connectionManager.isDialable(t,e)}#t(t){let{detail:e}=t;if(e.id.toString()===this.peerId.toString()){this.log.error("peer discovery mechanism discovered self");return}this.components.peerStore.merge(e.id,{multiaddrs:e.multiaddrs}).catch(n=>{this.log.error(n)})}};async function db(r={}){r.privateKey??=await Wh("Ed25519");let t=new Ca({...await Od(r),peerId:Yh(r.privateKey)});return r.start!==!1&&await t.start(),t}return Zp(pb);})();
|
|
20
20
|
/*! Bundled license information:
|
|
21
21
|
|
|
22
22
|
pvtsutils/build/index.js:
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,oBAAoB,CAAA;AACxC,eAAO,MAAM,IAAI,WAAW,CAAA"}
|
package/dist/src/version.js
CHANGED
package/dist/src/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,iBAAiB,CAAA;AACxC,MAAM,CAAC,MAAM,IAAI,GAAG,QAAQ,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "libp2p",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1-18dd3cb26",
|
|
4
4
|
"description": "JavaScript implementation of libp2p, a modular peer to peer network stack",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/libp2p#readme",
|
|
@@ -85,15 +85,15 @@
|
|
|
85
85
|
"test:webkit": "aegir test -t browser -f \"./dist/test/**/*.spec.js\" -- --browser webkit"
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
|
-
"@libp2p/crypto": "
|
|
89
|
-
"@libp2p/interface": "
|
|
90
|
-
"@libp2p/interface-internal": "
|
|
91
|
-
"@libp2p/logger": "
|
|
92
|
-
"@libp2p/multistream-select": "
|
|
93
|
-
"@libp2p/peer-collections": "
|
|
94
|
-
"@libp2p/peer-id": "
|
|
95
|
-
"@libp2p/peer-store": "
|
|
96
|
-
"@libp2p/utils": "
|
|
88
|
+
"@libp2p/crypto": "5.0.0-18dd3cb26",
|
|
89
|
+
"@libp2p/interface": "2.0.0-18dd3cb26",
|
|
90
|
+
"@libp2p/interface-internal": "2.0.0-18dd3cb26",
|
|
91
|
+
"@libp2p/logger": "5.0.0-18dd3cb26",
|
|
92
|
+
"@libp2p/multistream-select": "6.0.0-18dd3cb26",
|
|
93
|
+
"@libp2p/peer-collections": "6.0.0-18dd3cb26",
|
|
94
|
+
"@libp2p/peer-id": "5.0.0-18dd3cb26",
|
|
95
|
+
"@libp2p/peer-store": "11.0.0-18dd3cb26",
|
|
96
|
+
"@libp2p/utils": "6.0.0-18dd3cb26",
|
|
97
97
|
"@multiformats/dns": "^1.0.6",
|
|
98
98
|
"@multiformats/multiaddr": "^12.2.3",
|
|
99
99
|
"@multiformats/multiaddr-matcher": "^1.2.1",
|
|
@@ -113,14 +113,14 @@
|
|
|
113
113
|
"uint8arrays": "^5.1.0"
|
|
114
114
|
},
|
|
115
115
|
"devDependencies": {
|
|
116
|
-
"@chainsafe/libp2p-yamux": "^
|
|
117
|
-
"@libp2p/circuit-relay-v2": "
|
|
118
|
-
"@libp2p/identify": "
|
|
119
|
-
"@libp2p/interface-compliance-tests": "
|
|
120
|
-
"@libp2p/mplex": "
|
|
121
|
-
"@libp2p/plaintext": "
|
|
122
|
-
"@libp2p/tcp": "
|
|
123
|
-
"@libp2p/websockets": "
|
|
116
|
+
"@chainsafe/libp2p-yamux": "^7.0.0",
|
|
117
|
+
"@libp2p/circuit-relay-v2": "2.0.0-18dd3cb26",
|
|
118
|
+
"@libp2p/identify": "3.0.0-18dd3cb26",
|
|
119
|
+
"@libp2p/interface-compliance-tests": "6.0.0-18dd3cb26",
|
|
120
|
+
"@libp2p/mplex": "11.0.0-18dd3cb26",
|
|
121
|
+
"@libp2p/plaintext": "2.0.0-18dd3cb26",
|
|
122
|
+
"@libp2p/tcp": "10.0.0-18dd3cb26",
|
|
123
|
+
"@libp2p/websockets": "9.0.0-18dd3cb26",
|
|
124
124
|
"@multiformats/mafmt": "^12.1.6",
|
|
125
125
|
"aegir": "^44.0.1",
|
|
126
126
|
"delay": "^6.0.0",
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const version = '2.0.
|
|
1
|
+
export const version = '2.0.1-18dd3cb26'
|
|
2
2
|
export const name = 'libp2p'
|
package/dist/typedoc-urls.json
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"Libp2pInit": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.index.Libp2pInit.html",
|
|
3
|
-
".:Libp2pInit": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.index.Libp2pInit.html",
|
|
4
|
-
"Libp2pOptions": "https://libp2p.github.io/js-libp2p/types/libp2p.index.Libp2pOptions.html",
|
|
5
|
-
".:Libp2pOptions": "https://libp2p.github.io/js-libp2p/types/libp2p.index.Libp2pOptions.html",
|
|
6
|
-
"ServiceFactoryMap": "https://libp2p.github.io/js-libp2p/types/libp2p.index.ServiceFactoryMap.html",
|
|
7
|
-
".:ServiceFactoryMap": "https://libp2p.github.io/js-libp2p/types/libp2p.index.ServiceFactoryMap.html",
|
|
8
|
-
"createLibp2p": "https://libp2p.github.io/js-libp2p/functions/libp2p.index.createLibp2p.html",
|
|
9
|
-
".:createLibp2p": "https://libp2p.github.io/js-libp2p/functions/libp2p.index.createLibp2p.html",
|
|
10
|
-
"name": "https://libp2p.github.io/js-libp2p/variables/libp2p.version.name.html",
|
|
11
|
-
"./version:name": "https://libp2p.github.io/js-libp2p/variables/libp2p.version.name.html",
|
|
12
|
-
"version": "https://libp2p.github.io/js-libp2p/variables/libp2p.version.version.html",
|
|
13
|
-
"./version:version": "https://libp2p.github.io/js-libp2p/variables/libp2p.version.version.html"
|
|
14
|
-
}
|