@libp2p/bootstrap 6.0.0 → 6.0.2

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/README.md CHANGED
@@ -12,10 +12,9 @@
12
12
  - [Install](#install)
13
13
  - [Browser `<script>` tag](#browser-script-tag)
14
14
  - [Usage](#usage)
15
- - [Contribute](#contribute)
16
15
  - [API Docs](#api-docs)
17
16
  - [License](#license)
18
- - [Contribute](#contribute-1)
17
+ - [Contribution](#contribution)
19
18
 
20
19
  ## Install
21
20
 
@@ -88,13 +87,6 @@ async function start () {
88
87
  start()
89
88
  ```
90
89
 
91
- ## Contribute
92
-
93
- The libp2p implementation in JavaScript is a work in progress. As such, there are a few things you can do right now to help out:
94
-
95
- - Go through the modules and **check out existing issues**. This is especially useful for modules in active development. Some knowledge of IPFS/libp2p may be required, as well as the infrastructure behind it - for instance, you may need to read up on p2p and more complex operations like muxing to be able to help technically.
96
- - **Perform code reviews**. More eyes will help a) speed the project along b) ensure quality and c) reduce possible future bugs.
97
-
98
90
  ## API Docs
99
91
 
100
92
  - <https://libp2p.github.io/js-libp2p-bootstrap>
@@ -106,6 +98,6 @@ Licensed under either of
106
98
  - Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
107
99
  - MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
108
100
 
109
- ## Contribute
101
+ ## Contribution
110
102
 
111
103
  Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
package/dist/index.min.js CHANGED
@@ -1,3 +1,3 @@
1
1
  (function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PBootstrap = factory()}(typeof self !== 'undefined' ? self : this, function () {
2
- "use strict";var Libp2PBootstrap=(()=>{var Qr=Object.create;var Ie=Object.defineProperty;var Yr=Object.getOwnPropertyDescriptor;var Zr=Object.getOwnPropertyNames;var en=Object.getPrototypeOf,tn=Object.prototype.hasOwnProperty;var R=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),F=(t,e)=>{for(var r in e)Ie(t,r,{get:e[r],enumerable:!0})},Nt=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Zr(e))!tn.call(t,o)&&o!==r&&Ie(t,o,{get:()=>e[o],enumerable:!(n=Yr(e,o))||n.enumerable});return t};var Y=(t,e,r)=>(r=t!=null?Qr(en(t)):{},Nt(e||!t||!t.__esModule?Ie(r,"default",{value:t,enumerable:!0}):r,t)),rn=t=>Nt(Ie({},"__esModule",{value:!0}),t);var dr=R((vi,lr)=>{lr.exports=gt;var ur=128,mo=127,bo=~mo,go=Math.pow(2,31);function gt(t,e,r){if(Number.MAX_SAFE_INTEGER&&t>Number.MAX_SAFE_INTEGER)throw gt.bytes=0,new RangeError("Could not encode varint");e=e||[],r=r||0;for(var n=r;t>=go;)e[r++]=t&255|ur,t/=128;for(;t&bo;)e[r++]=t&255|ur,t>>>=7;return e[r]=t|0,gt.bytes=r-n+1,e}});var hr=R((Ci,pr)=>{pr.exports=wt;var wo=128,fr=127;function wt(t,n){var r=0,n=n||0,o=0,s=n,i,d=t.length;do{if(s>=d||o>49)throw wt.bytes=0,new RangeError("Could not decode varint");i=t[s++],r+=o<28?(i&fr)<<o:(i&fr)*Math.pow(2,o),o+=7}while(i>=wo);return wt.bytes=s-n,r}});var br=R((Si,mr)=>{var yo=Math.pow(2,7),xo=Math.pow(2,14),vo=Math.pow(2,21),Co=Math.pow(2,28),So=Math.pow(2,35),Eo=Math.pow(2,42),Ao=Math.pow(2,49),To=Math.pow(2,56),Fo=Math.pow(2,63);mr.exports=function(t){return t<yo?1:t<xo?2:t<vo?3:t<Co?4:t<So?5:t<Eo?6:t<Ao?7:t<To?8:t<Fo?9:10}});var _e=R((Ei,gr)=>{gr.exports={encode:dr(),decode:hr(),encodingLength:br()}});var Ft=R((qi,Tr)=>{"use strict";function Ar(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function qo(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return Ar(t,r)}catch{r.message=t.message,r.stack=t.stack;let o=function(){};return o.prototype=Object.create(Object.getPrototypeOf(t)),Ar(new o,r)}}Tr.exports=qo});var kr=R((na,Vr)=>{var ce=1e3,ue=ce*60,le=ue*60,X=le*24,es=X*7,ts=X*365.25;Vr.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return rs(t);if(r==="number"&&isFinite(t))return e.long?os(t):ns(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function rs(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*ts;case"weeks":case"week":case"w":return r*es;case"days":case"day":case"d":return r*X;case"hours":case"hour":case"hrs":case"hr":case"h":return r*le;case"minutes":case"minute":case"mins":case"min":case"m":return r*ue;case"seconds":case"second":case"secs":case"sec":case"s":return r*ce;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function ns(t){var e=Math.abs(t);return e>=X?Math.round(t/X)+"d":e>=le?Math.round(t/le)+"h":e>=ue?Math.round(t/ue)+"m":e>=ce?Math.round(t/ce)+"s":t+"ms"}function os(t){var e=Math.abs(t);return e>=X?je(t,e,X,"day"):e>=le?je(t,e,le,"hour"):e>=ue?je(t,e,ue,"minute"):e>=ce?je(t,e,ce,"second"):t+" ms"}function je(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var $r=R((oa,Rr)=>{function ss(t){r.debug=r,r.default=r,r.coerce=v,r.disable=s,r.enable=o,r.enabled=i,r.humanize=kr(),r.destroy=N,Object.keys(t).forEach(a=>{r[a]=t[a]}),r.names=[],r.skips=[],r.formatters={};function e(a){let u=0;for(let p=0;p<a.length;p++)u=(u<<5)-u+a.charCodeAt(p),u|=0;return r.colors[Math.abs(u)%r.colors.length]}r.selectColor=e;function r(a){let u,p=null,K,f;function m(...g){if(!m.enabled)return;let y=m,E=Number(new Date),I=E-(u||E);y.diff=I,y.prev=u,y.curr=E,u=E,g[0]=r.coerce(g[0]),typeof g[0]!="string"&&g.unshift("%O");let C=0;g[0]=g[0].replace(/%([a-zA-Z%])/g,(U,T)=>{if(U==="%%")return"%";C++;let B=r.formatters[T];if(typeof B=="function"){let Q=g[C];U=B.call(y,Q),g.splice(C,1),C--}return U}),r.formatArgs.call(y,g),(y.log||r.log).apply(y,g)}return m.namespace=a,m.useColors=r.useColors(),m.color=r.selectColor(a),m.extend=n,m.destroy=r.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(K!==r.namespaces&&(K=r.namespaces,f=r.enabled(a)),f),set:g=>{p=g}}),typeof r.init=="function"&&r.init(m),m}function n(a,u){let p=r(this.namespace+(typeof u>"u"?":":u)+a);return p.log=this.log,p}function o(a){r.save(a),r.namespaces=a,r.names=[],r.skips=[];let u,p=(typeof a=="string"?a:"").split(/[\s,]+/),K=p.length;for(u=0;u<K;u++)p[u]&&(a=p[u].replace(/\*/g,".*?"),a[0]==="-"?r.skips.push(new RegExp("^"+a.slice(1)+"$")):r.names.push(new RegExp("^"+a+"$")))}function s(){let a=[...r.names.map(d),...r.skips.map(d).map(u=>"-"+u)].join(",");return r.enable(""),a}function i(a){if(a[a.length-1]==="*")return!0;let u,p;for(u=0,p=r.skips.length;u<p;u++)if(r.skips[u].test(a))return!1;for(u=0,p=r.names.length;u<p;u++)if(r.names[u].test(a))return!0;return!1}function d(a){return a.toString().substring(2,a.toString().length-2).replace(/\.\*\?$/,"*")}function v(a){return a instanceof Error?a.stack||a.message:a}function N(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}Rr.exports=ss});var jr=R((P,qe)=>{P.formatArgs=as;P.save=cs;P.load=us;P.useColors=is;P.storage=ls();P.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();P.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function is(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function as(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+qe.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),t.splice(n,0,e)}P.log=console.debug||console.log||(()=>{});function cs(t){try{t?P.storage.setItem("debug",t):P.storage.removeItem("debug")}catch{}}function us(){let t;try{t=P.storage.getItem("debug")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function ls(){try{return localStorage}catch{}}qe.exports=$r()(P);var{formatters:ds}=qe.exports;ds.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var vs={};F(vs,{bootstrap:()=>xs});var Ue=class{index=0;input="";new(e){return this.index=0,this.input=e,this}readAtomically(e){let r=this.index,n=e();return n===void 0&&(this.index=r),n}parseWith(e){let r=e();if(this.index===this.input.length)return r}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(e){return this.readAtomically(()=>{let r=this.readChar();if(r===e)return r})}readSeparator(e,r,n){return this.readAtomically(()=>{if(!(r>0&&this.readGivenChar(e)===void 0))return n()})}readNumber(e,r,n,o){return this.readAtomically(()=>{let s=0,i=0,d=this.peekChar();if(d===void 0)return;let v=d==="0",N=2**(8*o)-1;for(;;){let a=this.readAtomically(()=>{let u=this.readChar();if(u===void 0)return;let p=Number.parseInt(u,e);if(!Number.isNaN(p))return p});if(a===void 0)break;if(s*=e,s+=a,s>N||(i+=1,r!==void 0&&i>r))return}if(i!==0)return!n&&v&&i>1?void 0:s})}readIPv4Addr(){return this.readAtomically(()=>{let e=new Uint8Array(4);for(let r=0;r<e.length;r++){let n=this.readSeparator(".",r,()=>this.readNumber(10,3,!1,1));if(n===void 0)return;e[r]=n}return e})}readIPv6Addr(){let e=r=>{for(let n=0;n<r.length/2;n++){let o=n*2;if(n<r.length-3){let i=this.readSeparator(":",n,()=>this.readIPv4Addr());if(i!==void 0)return r[o]=i[0],r[o+1]=i[1],r[o+2]=i[2],r[o+3]=i[3],[o+4,!0]}let s=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(s===void 0)return[o,!1];r[o]=s>>8,r[o+1]=s&255}return[r.length,!1]};return this.readAtomically(()=>{let r=new Uint8Array(16),[n,o]=e(r);if(n===16)return r;if(o||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let s=new Uint8Array(14),i=16-(n+2),[d]=e(s.subarray(0,i));return r.set(s.subarray(0,d),16-d),r})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var Ot=45,nn=15,Z=new Ue;function Lt(t){if(!(t.length>nn))return Z.new(t).parseWith(()=>Z.readIPv4Addr())}function _t(t){if(!(t.length>Ot))return Z.new(t).parseWith(()=>Z.readIPv6Addr())}function zt(t){if(!(t.length>Ot))return Z.new(t).parseWith(()=>Z.readIPAddr())}function Vt(t){return Boolean(Lt(t))}function kt(t){return Boolean(_t(t))}function Be(t){return Boolean(zt(t))}var Qe={};F(Qe,{identity:()=>ln});function on(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<t.length;o++){var s=t.charAt(o),i=s.charCodeAt(0);if(r[i]!==255)throw new TypeError(s+" is ambiguous");r[i]=o}var d=t.length,v=t.charAt(0),N=Math.log(d)/Math.log(256),a=Math.log(256)/Math.log(d);function u(f){if(f instanceof Uint8Array||(ArrayBuffer.isView(f)?f=new Uint8Array(f.buffer,f.byteOffset,f.byteLength):Array.isArray(f)&&(f=Uint8Array.from(f))),!(f instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(f.length===0)return"";for(var m=0,g=0,y=0,E=f.length;y!==E&&f[y]===0;)y++,m++;for(var I=(E-y)*a+1>>>0,C=new Uint8Array(I);y!==E;){for(var M=f[y],U=0,T=I-1;(M!==0||U<g)&&T!==-1;T--,U++)M+=256*C[T]>>>0,C[T]=M%d>>>0,M=M/d>>>0;if(M!==0)throw new Error("Non-zero carry");g=U,y++}for(var B=I-g;B!==I&&C[B]===0;)B++;for(var Q=v.repeat(m);B<I;++B)Q+=t.charAt(C[B]);return Q}function p(f){if(typeof f!="string")throw new TypeError("Expected String");if(f.length===0)return new Uint8Array;var m=0;if(f[m]!==" "){for(var g=0,y=0;f[m]===v;)g++,m++;for(var E=(f.length-m)*N+1>>>0,I=new Uint8Array(E);f[m];){var C=r[f.charCodeAt(m)];if(C===255)return;for(var M=0,U=E-1;(C!==0||M<y)&&U!==-1;U--,M++)C+=d*I[U]>>>0,I[U]=C%256>>>0,C=C/256>>>0;if(C!==0)throw new Error("Non-zero carry");y=M,m++}if(f[m]!==" "){for(var T=E-y;T!==E&&I[T]===0;)T++;for(var B=new Uint8Array(g+(E-T)),Q=g;T!==E;)B[Q++]=I[T++];return B}}}function K(f){var m=p(f);if(m)return m;throw new Error(`Non-${e} character`)}return{encode:u,decodeUnsafe:p,decode:K}}var sn=on,an=sn,Rt=an;var Is=new Uint8Array(0);var $t=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0},_=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")};var jt=t=>new TextEncoder().encode(t),qt=t=>new TextDecoder().decode(t);var Je=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},He=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Wt(this,e)}},Xe=class{constructor(e){this.decoders=e}or(e){return Wt(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},Wt=(t,e)=>new Xe({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),Ke=class{constructor(e,r,n,o){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=o,this.encoder=new Je(e,r,n),this.decoder=new He(e,r,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},ee=({name:t,prefix:e,encode:r,decode:n})=>new Ke(t,e,r,n),$=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:o}=Rt(r,e);return ee({prefix:t,name:e,encode:n,decode:s=>_(o(s))})},cn=(t,e,r,n)=>{let o={};for(let a=0;a<e.length;++a)o[e[a]]=a;let s=t.length;for(;t[s-1]==="=";)--s;let i=new Uint8Array(s*r/8|0),d=0,v=0,N=0;for(let a=0;a<s;++a){let u=o[t[a]];if(u===void 0)throw new SyntaxError(`Non-${n} character`);v=v<<r|u,d+=r,d>=8&&(d-=8,i[N++]=255&v>>d)}if(d>=r||255&v<<8-d)throw new SyntaxError("Unexpected end of data");return i},un=(t,e,r)=>{let n=e[e.length-1]==="=",o=(1<<r)-1,s="",i=0,d=0;for(let v=0;v<t.length;++v)for(d=d<<8|t[v],i+=8;i>r;)i-=r,s+=e[o&d>>i];if(i&&(s+=e[o&d<<r-i]),n)for(;s.length*r&7;)s+="=";return s},b=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>ee({prefix:e,name:t,encode(o){return un(o,n,r)},decode(o){return cn(o,n,r,t)}});var ln=ee({prefix:"\0",name:"identity",encode:t=>qt(t),decode:t=>jt(t)});var Ye={};F(Ye,{base2:()=>dn});var dn=b({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Ze={};F(Ze,{base8:()=>fn});var fn=b({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var et={};F(et,{base10:()=>pn});var pn=$({prefix:"9",name:"base10",alphabet:"0123456789"});var tt={};F(tt,{base16:()=>hn,base16upper:()=>mn});var hn=b({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),mn=b({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var rt={};F(rt,{base32:()=>D,base32hex:()=>yn,base32hexpad:()=>vn,base32hexpadupper:()=>Cn,base32hexupper:()=>xn,base32pad:()=>gn,base32padupper:()=>wn,base32upper:()=>bn,base32z:()=>Sn});var D=b({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),bn=b({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),gn=b({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),wn=b({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),yn=b({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),xn=b({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),vn=b({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Cn=b({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Sn=b({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var nt={};F(nt,{base36:()=>En,base36upper:()=>An});var En=$({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),An=$({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var ot={};F(ot,{base58btc:()=>x,base58flickr:()=>Tn});var x=$({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Tn=$({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var it={};F(it,{base64:()=>st,base64pad:()=>Fn,base64url:()=>Pn,base64urlpad:()=>In});var st=b({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Fn=b({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Pn=b({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),In=b({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var at={};F(at,{base256emoji:()=>Nn});var Jt=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}"),Un=Jt.reduce((t,e,r)=>(t[r]=e,t),[]),Bn=Jt.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Mn(t){return t.reduce((e,r)=>(e+=Un[r],e),"")}function Dn(t){let e=[];for(let r of t){let n=Bn[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var Nn=ee({prefix:"\u{1F680}",name:"base256emoji",encode:Mn,decode:Dn});var dt={};F(dt,{sha256:()=>De,sha512:()=>Zn});var On=Kt,Ht=128,Ln=127,_n=~Ln,zn=Math.pow(2,31);function Kt(t,e,r){e=e||[],r=r||0;for(var n=r;t>=zn;)e[r++]=t&255|Ht,t/=128;for(;t&_n;)e[r++]=t&255|Ht,t>>>=7;return e[r]=t|0,Kt.bytes=r-n+1,e}var Vn=ct,kn=128,Xt=127;function ct(t,n){var r=0,n=n||0,o=0,s=n,i,d=t.length;do{if(s>=d)throw ct.bytes=0,new RangeError("Could not decode varint");i=t[s++],r+=o<28?(i&Xt)<<o:(i&Xt)*Math.pow(2,o),o+=7}while(i>=kn);return ct.bytes=s-n,r}var Rn=Math.pow(2,7),$n=Math.pow(2,14),jn=Math.pow(2,21),qn=Math.pow(2,28),Gn=Math.pow(2,35),Wn=Math.pow(2,42),Jn=Math.pow(2,49),Hn=Math.pow(2,56),Xn=Math.pow(2,63),Kn=function(t){return t<Rn?1:t<$n?2:t<jn?3:t<qn?4:t<Gn?5:t<Wn?6:t<Jn?7:t<Hn?8:t<Xn?9:10},Qn={encode:On,decode:Vn,encodingLength:Kn},Yn=Qn,de=Yn;var fe=(t,e=0)=>[de.decode(t,e),de.decode.bytes],te=(t,e,r=0)=>(de.encode(t,e,r),e),re=t=>de.encodingLength(t);var j=(t,e)=>{let r=e.byteLength,n=re(t),o=n+re(r),s=new Uint8Array(o+r);return te(t,s,0),te(r,s,n),s.set(e,o),new ne(t,r,e,s)},W=t=>{let e=_(t),[r,n]=fe(e),[o,s]=fe(e.subarray(n)),i=e.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new ne(r,o,i,e)},Qt=(t,e)=>{if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&$t(t.bytes,r.bytes)}},ne=class{constructor(e,r,n,o){this.code=e,this.size=r,this.digest=n,this.bytes=o}};var lt=({name:t,code:e,encode:r})=>new ut(t,e,r),ut=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?j(this.code,r):r.then(n=>j(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Zt=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),De=lt({name:"sha2-256",code:18,encode:Zt("SHA-256")}),Zn=lt({name:"sha2-512",code:19,encode:Zt("SHA-512")});var ft={};F(ft,{identity:()=>Ne});var er=0,eo="identity",tr=_,to=t=>j(er,tr(t)),Ne={code:er,name:eo,encode:tr,digest:to};var Ks=new TextEncoder,Qs=new TextDecoder;var rr=(t,e)=>{let{bytes:r,version:n}=t;switch(n){case 0:return so(r,pt(t),e||x.encoder);default:return io(r,pt(t),e||D.encoder)}};var nr=new WeakMap,pt=t=>{let e=nr.get(t);if(e==null){let r=new Map;return nr.set(t,r),r}return e},h=class{constructor(e,r,n,o){this.code=r,this.version=e,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:e,multihash:r}=this;if(e!==pe)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==ao)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return h.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=j(e,r);return h.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return h.equals(this,e)}static equals(e,r){let n=r;return n&&e.code===n.code&&e.version===n.version&&Qt(e.multihash,n.multihash)}toString(e){return rr(this,e)}toJSON(){return{"/":rr(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let r=e;if(r instanceof h)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:o,multihash:s,bytes:i}=r;return new h(n,o,s,i||or(n,o,s.bytes))}else if(r[co]===!0){let{version:n,multihash:o,code:s}=r,i=W(o);return h.create(n,s,i)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(r!==pe)throw new Error(`Version 0 CID must use dag-pb (code: ${pe}) block encoding`);return new h(e,r,n,n.bytes)}case 1:{let o=or(e,r,n.bytes);return new h(e,r,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return h.create(0,pe,e)}static createV1(e,r){return h.create(1,e,r)}static decode(e){let[r,n]=h.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=h.inspectBytes(e),n=r.size-r.multihashSize,o=_(e.subarray(n,n+r.multihashSize));if(o.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=o.subarray(r.multihashSize-r.digestSize),i=new ne(r.multihashCode,r.digestSize,s,o);return[r.version===0?h.createV0(i):h.createV1(r.codec,i),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[u,p]=fe(e.subarray(r));return r+=p,u},o=n(),s=pe;if(o===18?(o=0,r=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=r,d=n(),v=n(),N=r+v,a=N-i;return{version:o,codec:s,multihashCode:d,digestSize:v,multihashSize:a,size:N}}static parse(e,r){let[n,o]=oo(e,r),s=h.decode(o);return pt(s).set(n,e),s}},oo=(t,e)=>{switch(t[0]){case"Q":{let r=e||x;return[x.prefix,r.decode(`${x.prefix}${t}`)]}case x.prefix:{let r=e||x;return[x.prefix,r.decode(t)]}case D.prefix:{let r=e||D;return[D.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}},so=(t,e,r)=>{let{prefix:n}=r;if(n!==x.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let o=e.get(n);if(o==null){let s=r.encode(t).slice(1);return e.set(n,s),s}else return o},io=(t,e,r)=>{let{prefix:n}=r,o=e.get(n);if(o==null){let s=r.encode(t);return e.set(n,s),s}else return o},pe=112,ao=18,or=(t,e,r)=>{let n=re(t),o=n+re(e),s=new Uint8Array(o+r.byteLength);return te(t,s,0),te(e,s,n),s.set(r,o),s},co=Symbol.for("@ipld/js-cid/CID");var q={...Qe,...Ye,...Ze,...et,...tt,...rt,...nt,...ot,...it,...at},ai={...dt,...ft};function oe(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function Oe(t=0){return globalThis.Buffer?.allocUnsafe!=null?oe(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function ir(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var sr=ir("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),ht=ir("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);let e=Oe(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),uo={utf8:sr,"utf-8":sr,hex:q.base16,latin1:ht,ascii:ht,binary:ht,...q},Le=uo;function A(t,e="utf8"){let r=Le[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):r.encoder.encode(t).substring(1)}var ar=Vt,lo=kt,mt=function(t){let e=0;if(t=t.toString().trim(),ar(t)){let r=new Uint8Array(e+4);return t.split(/\./g).forEach(n=>{r[e++]=parseInt(n,10)&255}),r}if(lo(t)){let r=t.split(":",8),n;for(n=0;n<r.length;n++){let s=ar(r[n]),i;s&&(i=mt(r[n]),r[n]=A(i.slice(0,2),"base16")),i!=null&&++n<8&&r.splice(n,0,A(i.slice(2,4),"base16"))}if(r[0]==="")for(;r.length<8;)r.unshift("0");else if(r[r.length-1]==="")for(;r.length<8;)r.push("0");else if(r.length<8){for(n=0;n<r.length&&r[n]!=="";n++);let s=[n,1];for(n=9-r.length;n>0;n--)s.push("0");r.splice.apply(r,s)}let o=new Uint8Array(e+16);for(n=0;n<r.length;n++){let s=parseInt(r[n],16);o[e++]=s>>8&255,o[e++]=s&255}return o}throw new Error("invalid ip address")},cr=function(t,e=0,r){e=~~e,r=r??t.length-e;let n=new DataView(t.buffer);if(r===4){let o=[];for(let s=0;s<r;s++)o.push(t[e+s]);return o.join(".")}if(r===16){let o=[];for(let s=0;s<r;s+=2)o.push(n.getUint16(e+s).toString(16));return o.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var he={},bt={},po=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,-1,"ip6zone"],[53,-1,"dns",!0],[54,-1,"dns4",!0],[55,-1,"dns6",!0],[56,-1,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,-1,"unix",!1,!0],[421,-1,"ipfs"],[421,-1,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,-1,"garlic64"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,-1,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,-1,"memory"]];po.forEach(t=>{let e=ho(...t);bt[e.code]=e,he[e.name]=e});function ho(t,e,r,n,o){return{code:t,size:e,name:r,resolvable:Boolean(n),path:Boolean(o)}}function w(t){if(typeof t=="number"){if(bt[t]!=null)return bt[t];throw new Error(`no protocol with code: ${t}`)}else if(typeof t=="string"){if(he[t]!=null)return he[t];throw new Error(`no protocol with name: ${t}`)}throw new Error(`invalid protocol id type: ${typeof t}`)}var O=Y(_e(),1);function yt(t,e="utf8"){let r=Le[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?oe(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}function z(t,e){e==null&&(e=t.reduce((o,s)=>o+s.length,0));let r=Oe(e),n=0;for(let o of t)r.set(o,n),n+=o.length;return oe(r)}function xr(t,e){switch(w(t).code){case 4:case 41:return Io(e);case 6:case 273:case 33:case 132:return Cr(e).toString();case 53:case 54:case 55:case 56:case 400:case 777:return Bo(e);case 421:return Oo(e);case 444:return yr(e);case 445:return yr(e);case 466:return No(e);default:return A(e,"base16")}}function vr(t,e){switch(w(t).code){case 4:return wr(e);case 41:return wr(e);case 6:case 273:case 33:case 132:return vt(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 777:return Uo(e);case 421:return Mo(e);case 444:return Lo(e);case 445:return _o(e);case 466:return Do(e);default:return yt(e,"base16")}}var xt=Object.values(q).map(t=>t.decoder),Po=function(){let t=xt[0].or(xt[1]);return xt.slice(2).forEach(e=>t=t.or(e)),t}();function wr(t){if(!Be(t))throw new Error("invalid ip address");return mt(t)}function Io(t){let e=cr(t,0,t.length);if(e==null)throw new Error("ipBuff is required");if(!Be(e))throw new Error("invalid ip address");return e}function vt(t){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,t),new Uint8Array(e)}function Cr(t){return new DataView(t.buffer).getUint16(t.byteOffset)}function Uo(t){let e=yt(t),r=Uint8Array.from(O.default.encode(e.length));return z([r,e],r.length+e.length)}function Bo(t){let e=O.default.decode(t);if(t=t.slice(O.default.decode.bytes),t.length!==e)throw new Error("inconsistent lengths");return A(t)}function Mo(t){let e;t[0]==="Q"||t[0]==="1"?e=W(x.decode(`z${t}`)).bytes:e=h.parse(t).multihash.bytes;let r=Uint8Array.from(O.default.encode(e.length));return z([r,e],r.length+e.length)}function Do(t){let e=Po.decode(t),r=Uint8Array.from(O.default.encode(e.length));return z([r,e],r.length+e.length)}function No(t){let e=O.default.decode(t),r=t.slice(O.default.decode.bytes);if(r.length!==e)throw new Error("inconsistent lengths");return"u"+A(r,"base64url")}function Oo(t){let e=O.default.decode(t),r=t.slice(O.default.decode.bytes);if(r.length!==e)throw new Error("inconsistent lengths");return A(r,"base58btc")}function Lo(t){let e=t.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==16)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion address.`);let r=D.decode("b"+e[0]),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=vt(n);return z([r,o],r.length+o.length)}function _o(t){let e=t.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==56)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion3 address.`);let r=D.decode(`b${e[0]}`),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=vt(n);return z([r,o],r.length+o.length)}function yr(t){let e=t.slice(0,t.length-2),r=t.slice(t.length-2),n=A(e,"base32"),o=Cr(r);return`${n}:${o}`}var se=Y(_e(),1);function zo(t){let e=[],r=t.split("/").slice(1);if(r.length===1&&r[0]==="")return[];for(let n=0;n<r.length;n++){let o=r[n],s=w(o);if(s.size===0){e.push([o]);continue}if(n++,n>=r.length)throw Er("invalid address: "+t);if(s.path===!0){e.push([o,Tt(r.slice(n).join("/"))]);break}e.push([o,r[n]])}return e}function Vo(t){let e=[];return t.map(r=>{let n=ke(r);return e.push(n.name),r.length>1&&r[1]!=null&&e.push(r[1]),null}),Tt(e.join("/"))}function ko(t){return t.map(e=>{Array.isArray(e)||(e=[e]);let r=ke(e);return e.length>1?[r.code,vr(r.code,e[1])]:[r.code]})}function Ct(t){return t.map(e=>{let r=ke(e);return e[1]!=null?[r.code,xr(r.code,e[1])]:[r.code]})}function St(t){return Ve(z(t.map(e=>{let r=ke(e),n=Uint8Array.from(se.default.encode(r.code));return e.length>1&&e[1]!=null&&(n=z([n,e[1]])),n})))}function Et(t,e){return t.size>0?t.size/8:t.size===0?0:se.default.decode(e)+(se.default.decode.bytes??0)}function ze(t){let e=[],r=0;for(;r<t.length;){let n=se.default.decode(t,r),o=se.default.decode.bytes??0,s=w(n),i=Et(s,t.slice(r+o));if(i===0){e.push([n]),r+=o;continue}let d=t.slice(r+o,r+o+i);if(r+=i+o,r>t.length)throw Er("Invalid address Uint8Array: "+A(t,"base16"));e.push([n,d])}return e}function At(t){let e=ze(t),r=Ct(e);return Vo(r)}function Ro(t){t=Tt(t);let e=zo(t),r=ko(e);return St(r)}function Sr(t){return Ro(t)}function Ve(t){let e=$o(t);if(e!=null)throw e;return Uint8Array.from(t)}function $o(t){try{ze(t)}catch(e){return e}}function Tt(t){return"/"+t.trim().split("/").filter(e=>e).join("/")}function Er(t){return new Error("Error parsing address: "+t)}function ke(t){return w(t[0])}var It=Y(_e(),1);var Ir=Y(Ft(),1);function me(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0}var ie=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Pt=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},be,ge,we,Fr,Go=Symbol.for("nodejs.util.inspect.custom"),Pr=[w("dns").code,w("dns4").code,w("dns6").code,w("dnsaddr").code],Wo=[w("p2p").code,w("ipfs").code],Jo=new Map,Ur=Symbol.for("@multiformats/js-multiaddr/multiaddr");function Ho(t){return Boolean(t?.[Ur])}var V=class{constructor(e){if(be.set(this,void 0),ge.set(this,void 0),we.set(this,void 0),this[Fr]=!0,e==null&&(e=""),e instanceof Uint8Array)this.bytes=Ve(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);this.bytes=Sr(e)}else if(Ho(e))this.bytes=Ve(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return ie(this,be,"f")==null&&Pt(this,be,At(this.bytes),"f"),ie(this,be,"f")}toJSON(){return this.toString()}toOptions(){let e=this.protoCodes(),r=this.toString().split("/").slice(1),n,o;if(r.length>2)Pr.includes(e[0])&&Wo.includes(e[1])?(n=w("tcp").name,o=443):(n=w(r[2]).name,o=parseInt(r[3]));else if(Pr.includes(e[0]))n=w("tcp").name,o=443;else throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e[0]===41||e[0]===55?6:4,host:r[1],transport:n,port:o}}protos(){return this.protoCodes().map(e=>Object.assign({},w(e)))}protoCodes(){let e=[],r=this.bytes,n=0;for(;n<r.length;){let o=It.default.decode(r,n),s=It.default.decode.bytes??0,i=w(o),d=Et(i,r.slice(n+s));n+=d+s,e.push(o)}return e}protoNames(){return this.protos().map(e=>e.name)}tuples(){return ie(this,ge,"f")==null&&Pt(this,ge,ze(this.bytes),"f"),ie(this,ge,"f")}stringTuples(){return ie(this,we,"f")==null&&Pt(this,we,Ct(this.tuples()),"f"),ie(this,we,"f")}encapsulate(e){return e=new V(e),new V(this.toString()+e.toString())}decapsulate(e){let r=e.toString(),n=this.toString(),o=n.lastIndexOf(r);if(o<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${e.toString()}`);return new V(n.slice(0,o))}decapsulateCode(e){let r=this.tuples();for(let n=r.length-1;n>=0;n--)if(r[n][0]===e)return new V(St(r.slice(0,n)));return this}getPeerId(){try{let r=this.stringTuples().filter(n=>n[0]===he.ipfs.code).pop();if(r?.[1]!=null){let n=r[1];return n[0]==="Q"||n[0]==="1"?A(x.decode(`z${n}`),"base58btc"):A(h.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){let e=null;try{e=this.stringTuples().filter(r=>w(r[0]).path===!0)[0][1],e==null&&(e=null)}catch{e=null}return e}equals(e){return me(this.bytes,e.bytes)}async resolve(e){let r=this.protos().find(s=>s.resolvable);if(r==null)return[this];let n=Jo.get(r.name);if(n==null)throw(0,Ir.default)(new Error(`no available resolver for ${r.name}`),"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,e)).map(s=>new V(s))}nodeAddress(){let e=this.toOptions();if(e.transport!=="tcp"&&e.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${e.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:e.family,address:e.host,port:e.port}}isThinWaistAddress(e){let r=(e??this).protos();return!(r.length!==2||r[0].code!==4&&r[0].code!==41||r[1].code!==6&&r[1].code!==273)}[(be=new WeakMap,ge=new WeakMap,we=new WeakMap,Fr=Ur,Go)](){return`Multiaddr(${At(this.bytes)})`}};function ye(t){return new V(t)}var Xo=c("dns4"),Ko=c("dns6"),Qo=c("dnsaddr"),ae=S(c("dns"),Qo,Xo,Ko),Re=S(c("ip4"),c("ip6")),Ee=S(l(Re,c("tcp")),l(ae,c("tcp"))),Mr=l(Re,c("udp")),Yo=l(Mr,c("utp")),Zo=l(Mr,c("quic")),ve=S(l(Ee,c("ws")),l(ae,c("ws"))),Ce=S(l(Ee,c("wss")),l(ae,c("wss"))),Ut=S(l(Ee,c("http")),l(Re,c("http")),l(ae,c("http"))),Bt=S(l(Ee,c("https")),l(Re,c("https")),l(ae,c("https"))),Dr=S(l(ve,c("p2p-webrtc-star"),c("p2p")),l(Ce,c("p2p-webrtc-star"),c("p2p")),l(ve,c("p2p-webrtc-star")),l(Ce,c("p2p-webrtc-star"))),Zi=S(l(ve,c("p2p-websocket-star"),c("p2p")),l(Ce,c("p2p-websocket-star"),c("p2p")),l(ve,c("p2p-websocket-star")),l(Ce,c("p2p-websocket-star"))),Nr=S(l(Ut,c("p2p-webrtc-direct"),c("p2p")),l(Bt,c("p2p-webrtc-direct"),c("p2p")),l(Ut,c("p2p-webrtc-direct")),l(Bt,c("p2p-webrtc-direct"))),Se=S(ve,Ce,Ut,Bt,Dr,Nr,Ee,Yo,Zo,ae),ea=S(l(Se,c("p2p-stardust"),c("p2p")),l(Se,c("p2p-stardust"))),G=S(l(Se,c("p2p")),Dr,Nr,c("p2p")),Br=S(l(G,c("p2p-circuit"),G),l(G,c("p2p-circuit")),l(c("p2p-circuit"),G),l(Se,c("p2p-circuit")),l(c("p2p-circuit"),Se),c("p2p-circuit")),Or=()=>S(l(Br,Or),Br),xe=Or(),Lr=S(l(xe,G,xe),l(G,xe),l(xe,G),xe,G);function _r(t){function e(r){let n;try{n=ye(r)}catch{return!1}let o=t(n.protoNames());return o===null?!1:o===!0||o===!1?o:o.length===0}return e}function l(...t){function e(r){if(r.length<t.length)return null;let n=r;return t.some(o=>(n=typeof o=="function"?o().partialMatch(r):o.partialMatch(r),Array.isArray(n)&&(r=n),n===null)),n}return{toString:function(){return"{ "+t.join(" ")+" }"},input:t,matches:_r(e),partialMatch:e}}function S(...t){function e(n){let o=null;return t.some(s=>{let i=typeof s=="function"?s().partialMatch(n):s.partialMatch(n);return i!=null?(o=i,!0):!1}),o}return{toString:function(){return"{ "+t.join(" ")+" }"},input:t,matches:_r(e),partialMatch:e}}function c(t){let e=t;function r(o){let s;try{s=ye(o)}catch{return!1}let i=s.protoNames();return i.length===1&&i[0]===e}function n(o){return o.length===0?null:o[0]===e?o.slice(1):null}return{toString:function(){return e},matches:r,partialMatch:n}}var H=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},k,$e=class extends EventTarget{constructor(){super(...arguments),k.set(this,new Map)}listenerCount(e){let r=H(this,k,"f").get(e);return r==null?0:r.length}addEventListener(e,r,n){super.addEventListener(e,r,n);let o=H(this,k,"f").get(e);o==null&&(o=[],H(this,k,"f").set(e,o)),o.push({callback:r,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(e,r,n){super.removeEventListener(e.toString(),r??null,n);let o=H(this,k,"f").get(e);o!=null&&(o=o.filter(({callback:s})=>s!==r),H(this,k,"f").set(e,o))}dispatchEvent(e){let r=super.dispatchEvent(e),n=H(this,k,"f").get(e.type);return n==null||(n=n.filter(({once:o})=>!o),H(this,k,"f").set(e.type,n)),r}};k=new WeakMap;var Mt=class extends Event{constructor(e,r){super(e,r),this.detail=r?.detail}},zr=globalThis.CustomEvent??Mt;var L=Y(jr(),1);L.default.formatters.b=t=>t==null?"undefined":x.baseEncode(t);L.default.formatters.t=t=>t==null?"undefined":D.baseEncode(t);L.default.formatters.m=t=>t==null?"undefined":st.baseEncode(t);L.default.formatters.p=t=>t==null?"undefined":t.toString();L.default.formatters.c=t=>t==null?"undefined":t.toString();L.default.formatters.k=t=>t==null?"undefined":t.toString();function qr(t){return Object.assign((0,L.default)(t),{error:(0,L.default)(`${t}:error`),trace:(0,L.default)(`${t}:trace`)})}var fs=Y(Ft(),1);var Gr=Symbol.for("@libp2p/peer-id");var ps=Symbol.for("nodejs.util.inspect.custom"),Wr=Object.values(q).map(t=>t.decoder).reduce((t,e)=>t.or(e),q.identity.decoder),Jr=114,Hr=36,Xr=37,Ae=class{constructor(e){this.type=e.type,this.multihash=e.multihash,this.privateKey=e.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}get[Gr](){return!0}toString(){return this.string==null&&(this.string=x.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return h.createV1(Jr,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e instanceof Uint8Array)return me(this.multihash.bytes,e);if(typeof e=="string")return Dt(e).equals(this);if(e?.multihash?.bytes!=null)return me(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[ps](){return`PeerId(${this.toString()})`}},Te=class extends Ae{constructor(e){super({...e,type:"RSA"}),this.type="RSA",this.publicKey=e.publicKey}},Fe=class extends Ae{constructor(e){super({...e,type:"Ed25519"}),this.type="Ed25519",this.publicKey=e.multihash.digest}},Pe=class extends Ae{constructor(e){super({...e,type:"secp256k1"}),this.type="secp256k1",this.publicKey=e.multihash.digest}};function Dt(t,e){if(e=e??Wr,t.charAt(0)==="1"||t.charAt(0)==="Q"){let r=W(x.decode(`z${t}`));return t.startsWith("12D")?new Fe({multihash:r}):t.startsWith("16U")?new Pe({multihash:r}):new Te({multihash:r})}return hs(Wr.decode(t))}function hs(t){try{let e=W(t);if(e.code===Ne.code){if(e.digest.length===Hr)return new Fe({multihash:e});if(e.digest.length===Xr)return new Pe({multihash:e})}if(e.code===De.code)return new Te({multihash:e})}catch{return ms(h.decode(t))}throw new Error("Supplied PeerID CID is invalid")}function ms(t){if(t==null||t.multihash==null||t.version==null||t.version===1&&t.code!==Jr)throw new Error("Supplied PeerID CID is invalid");let e=t.multihash;if(e.code===De.code)return new Te({multihash:t.multihash});if(e.code===Ne.code){if(e.digest.length===Hr)return new Fe({multihash:t.multihash});if(e.digest.length===Xr)return new Pe({multihash:t.multihash})}throw new Error("Supplied PeerID CID is invalid")}var Kr=Symbol.for("@libp2p/peer-discovery");var Ge=qr("libp2p:bootstrap"),bs="bootstrap",gs=50,ws=12e4,ys=1e3,We=class extends $e{constructor(e,r={list:[]}){if(r.list==null||r.list.length===0)throw new Error("Bootstrap requires a list of peer addresses");super(),this.components=e,this.timeout=r.timeout??ys,this.list=[];for(let n of r.list){if(!Lr.matches(n)){Ge.error("Invalid multiaddr");continue}let o=ye(n),s=o.getPeerId();if(s==null){Ge.error("Invalid bootstrap multiaddr without peer id");continue}let i={id:Dt(s),multiaddrs:[o],protocols:[]};this.list.push(i)}this._init=r}get[Kr](){return!0}get[Symbol.toStringTag](){return"@libp2p/bootstrap"}isStarted(){return Boolean(this.timer)}start(){this.isStarted()||(Ge("Starting bootstrap node discovery, discovering peers after %s ms",this.timeout),this.timer=setTimeout(()=>{this._discoverBootstrapPeers().catch(e=>{Ge.error(e)})},this.timeout))}async _discoverBootstrapPeers(){if(this.timer!=null)for(let e of this.list){if(await this.components.peerStore.tagPeer(e.id,this._init.tagName??bs,{value:this._init.tagValue??gs,ttl:this._init.tagTTL??ws}),this.timer==null)return;this.dispatchEvent(new zr("peer",{detail:e}))}}stop(){this.timer!=null&&clearTimeout(this.timer),this.timer=void 0}};We.tag="bootstrap";function xs(t){return e=>new We(e,t)}return rn(vs);})();
2
+ "use strict";var Libp2PBootstrap=(()=>{var _n=Object.create;var Le=Object.defineProperty;var Ln=Object.getOwnPropertyDescriptor;var jn=Object.getOwnPropertyNames;var Rn=Object.getPrototypeOf,kn=Object.prototype.hasOwnProperty;var Q=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),z=(r,e)=>{for(var t in e)Le(r,t,{get:e[t],enumerable:!0})},cr=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of jn(e))!kn.call(r,o)&&o!==t&&Le(r,o,{get:()=>e[o],enumerable:!(n=Ln(e,o))||n.enumerable});return r};var R=(r,e,t)=>(t=r!=null?_n(Rn(r)):{},cr(e||!r||!r.__esModule?Le(t,"default",{value:r,enumerable:!0}):t,r)),qn=r=>cr(Le({},"__esModule",{value:!0}),r);var Nr=Q((Fc,$r)=>{$r.exports=Ut;var Mr=128,rs=127,ns=~rs,os=Math.pow(2,31);function Ut(r,e,t){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw Ut.bytes=0,new RangeError("Could not encode varint");e=e||[],t=t||0;for(var n=t;r>=os;)e[t++]=r&255|Mr,r/=128;for(;r&ns;)e[t++]=r&255|Mr,r>>>=7;return e[t]=r|0,Ut.bytes=t-n+1,e}});var _r=Q((Pc,Vr)=>{Vr.exports=zt;var ss=128,Or=127;function zt(r,n){var t=0,n=n||0,o=0,s=n,i,u=r.length;do{if(s>=u||o>49)throw zt.bytes=0,new RangeError("Could not decode varint");i=r[s++],t+=o<28?(i&Or)<<o:(i&Or)*Math.pow(2,o),o+=7}while(i>=ss);return zt.bytes=s-n,t}});var jr=Q((Ic,Lr)=>{var is=Math.pow(2,7),cs=Math.pow(2,14),as=Math.pow(2,21),us=Math.pow(2,28),ls=Math.pow(2,35),ds=Math.pow(2,42),ps=Math.pow(2,49),fs=Math.pow(2,56),hs=Math.pow(2,63);Lr.exports=function(r){return r<is?1:r<cs?2:r<as?3:r<us?4:r<ls?5:r<ds?6:r<ps?7:r<fs?8:r<hs?9:10}});var ee=Q((Bc,Rr)=>{Rr.exports={encode:Nr(),decode:_r(),encodingLength:jr()}});var Lt=Q((Xc,Zr)=>{"use strict";function Yr(r,e){for(let t in e)Object.defineProperty(r,t,{value:e[t],enumerable:!0,configurable:!0});return r}function Is(r,e,t){if(!r||typeof r=="string")throw new TypeError("Please pass an Error to err-code");t||(t={}),typeof e=="object"&&(t=e,e=""),e&&(t.code=e);try{return Yr(r,t)}catch{t.message=r.message,t.stack=r.stack;let o=function(){};return o.prototype=Object.create(Object.getPrototypeOf(r)),Yr(new o,t)}}Zr.exports=Is});var Pn=Q((za,Fn)=>{var be=1e3,ye=be*60,xe=ye*60,oe=xe*24,ci=oe*7,ai=oe*365.25;Fn.exports=function(r,e){e=e||{};var t=typeof r;if(t==="string"&&r.length>0)return ui(r);if(t==="number"&&isFinite(r))return e.long?di(r):li(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function ui(r){if(r=String(r),!(r.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(e){var t=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return t*ai;case"weeks":case"week":case"w":return t*ci;case"days":case"day":case"d":return t*oe;case"hours":case"hour":case"hrs":case"hr":case"h":return t*xe;case"minutes":case"minute":case"mins":case"min":case"m":return t*ye;case"seconds":case"second":case"secs":case"sec":case"s":return t*be;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function li(r){var e=Math.abs(r);return e>=oe?Math.round(r/oe)+"d":e>=xe?Math.round(r/xe)+"h":e>=ye?Math.round(r/ye)+"m":e>=be?Math.round(r/be)+"s":r+"ms"}function di(r){var e=Math.abs(r);return e>=oe?nt(r,e,oe,"day"):e>=xe?nt(r,e,xe,"hour"):e>=ye?nt(r,e,ye,"minute"):e>=be?nt(r,e,be,"second"):r+" ms"}function nt(r,e,t,n){var o=e>=t*1.5;return Math.round(r/t)+" "+n+(o?"s":"")}});var Bn=Q((Da,In)=>{function pi(r){t.debug=t,t.default=t,t.coerce=v,t.disable=s,t.enable=o,t.enabled=i,t.humanize=Pn(),t.destroy=P,Object.keys(r).forEach(a=>{t[a]=r[a]}),t.names=[],t.skips=[],t.formatters={};function e(a){let l=0;for(let h=0;h<a.length;h++)l=(l<<5)-l+a.charCodeAt(h),l|=0;return t.colors[Math.abs(l)%t.colors.length]}t.selectColor=e;function t(a){let l,h=null,m,p;function g(...S){if(!g.enabled)return;let E=g,I=Number(new Date),M=I-(l||I);E.diff=M,E.prev=l,E.curr=I,l=I,S[0]=t.coerce(S[0]),typeof S[0]!="string"&&S.unshift("%O");let T=0;S[0]=S[0].replace(/%([a-zA-Z%])/g,($,U)=>{if($==="%%")return"%";T++;let N=t.formatters[U];if(typeof N=="function"){let se=S[T];$=N.call(E,se),S.splice(T,1),T--}return $}),t.formatArgs.call(E,S),(E.log||t.log).apply(E,S)}return g.namespace=a,g.useColors=t.useColors(),g.color=t.selectColor(a),g.extend=n,g.destroy=t.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>h!==null?h:(m!==t.namespaces&&(m=t.namespaces,p=t.enabled(a)),p),set:S=>{h=S}}),typeof t.init=="function"&&t.init(g),g}function n(a,l){let h=t(this.namespace+(typeof l>"u"?":":l)+a);return h.log=this.log,h}function o(a){t.save(a),t.namespaces=a,t.names=[],t.skips=[];let l,h=(typeof a=="string"?a:"").split(/[\s,]+/),m=h.length;for(l=0;l<m;l++)h[l]&&(a=h[l].replace(/\*/g,".*?"),a[0]==="-"?t.skips.push(new RegExp("^"+a.slice(1)+"$")):t.names.push(new RegExp("^"+a+"$")))}function s(){let a=[...t.names.map(u),...t.skips.map(u).map(l=>"-"+l)].join(",");return t.enable(""),a}function i(a){if(a[a.length-1]==="*")return!0;let l,h;for(l=0,h=t.skips.length;l<h;l++)if(t.skips[l].test(a))return!1;for(l=0,h=t.names.length;l<h;l++)if(t.names[l].test(a))return!0;return!1}function u(a){return a.toString().substring(2,a.toString().length-2).replace(/\.\*\?$/,"*")}function v(a){return a instanceof Error?a.stack||a.message:a}function P(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}In.exports=pi});var Un=Q((D,ot)=>{D.formatArgs=hi;D.save=mi;D.load=wi;D.useColors=fi;D.storage=gi();D.destroy=(()=>{let r=!1;return()=>{r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();D.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function fi(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function hi(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+ot.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;r.splice(1,0,e,"color: inherit");let t=0,n=0;r[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(t++,o==="%c"&&(n=t))}),r.splice(n,0,e)}D.log=console.debug||console.log||(()=>{});function mi(r){try{r?D.storage.setItem("debug",r):D.storage.removeItem("debug")}catch{}}function wi(){let r;try{r=D.storage.getItem("debug")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function gi(){try{return localStorage}catch{}}ot.exports=Bn()(D);var{formatters:bi}=ot.exports;bi.j=function(r){try{return JSON.stringify(r)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Fi={};z(Fi,{bootstrap:()=>Ti});var je=class{index=0;input="";new(e){return this.index=0,this.input=e,this}readAtomically(e){let t=this.index,n=e();return n===void 0&&(this.index=t),n}parseWith(e){let t=e();if(this.index===this.input.length)return t}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(e){return this.readAtomically(()=>{let t=this.readChar();if(t===e)return t})}readSeparator(e,t,n){return this.readAtomically(()=>{if(!(t>0&&this.readGivenChar(e)===void 0))return n()})}readNumber(e,t,n,o){return this.readAtomically(()=>{let s=0,i=0,u=this.peekChar();if(u===void 0)return;let v=u==="0",P=2**(8*o)-1;for(;;){let a=this.readAtomically(()=>{let l=this.readChar();if(l===void 0)return;let h=Number.parseInt(l,e);if(!Number.isNaN(h))return h});if(a===void 0)break;if(s*=e,s+=a,s>P||(i+=1,t!==void 0&&i>t))return}if(i!==0)return!n&&v&&i>1?void 0:s})}readIPv4Addr(){return this.readAtomically(()=>{let e=new Uint8Array(4);for(let t=0;t<e.length;t++){let n=this.readSeparator(".",t,()=>this.readNumber(10,3,!1,1));if(n===void 0)return;e[t]=n}return e})}readIPv6Addr(){let e=t=>{for(let n=0;n<t.length/2;n++){let o=n*2;if(n<t.length-3){let i=this.readSeparator(":",n,()=>this.readIPv4Addr());if(i!==void 0)return t[o]=i[0],t[o+1]=i[1],t[o+2]=i[2],t[o+3]=i[3],[o+4,!0]}let s=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(s===void 0)return[o,!1];t[o]=s>>8,t[o+1]=s&255}return[t.length,!1]};return this.readAtomically(()=>{let t=new Uint8Array(16),[n,o]=e(t);if(n===16)return t;if(o||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let s=new Uint8Array(14),i=16-(n+2),[u]=e(s.subarray(0,i));return t.set(s.subarray(0,u),16-u),t})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var ar=45,Gn=15,ie=new je;function ur(r){if(!(r.length>Gn))return ie.new(r).parseWith(()=>ie.readIPv4Addr())}function lr(r){if(!(r.length>ar))return ie.new(r).parseWith(()=>ie.readIPv6Addr())}function dr(r){if(!(r.length>ar))return ie.new(r).parseWith(()=>ie.readIPAddr())}function Re(r){return!!ur(r)}function ke(r){return!!lr(r)}function H(r){return!!dr(r)}var dt={};z(dt,{identity:()=>Kn});function Wn(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var o=0;o<r.length;o++){var s=r.charAt(o),i=s.charCodeAt(0);if(t[i]!==255)throw new TypeError(s+" is ambiguous");t[i]=o}var u=r.length,v=r.charAt(0),P=Math.log(u)/Math.log(256),a=Math.log(256)/Math.log(u);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 g=0,S=0,E=0,I=p.length;E!==I&&p[E]===0;)E++,g++;for(var M=(I-E)*a+1>>>0,T=new Uint8Array(M);E!==I;){for(var O=p[E],$=0,U=M-1;(O!==0||$<S)&&U!==-1;U--,$++)O+=256*T[U]>>>0,T[U]=O%u>>>0,O=O/u>>>0;if(O!==0)throw new Error("Non-zero carry");S=$,E++}for(var N=M-S;N!==M&&T[N]===0;)N++;for(var se=v.repeat(g);N<M;++N)se+=r.charAt(T[N]);return se}function h(p){if(typeof p!="string")throw new TypeError("Expected String");if(p.length===0)return new Uint8Array;var g=0;if(p[g]!==" "){for(var S=0,E=0;p[g]===v;)S++,g++;for(var I=(p.length-g)*P+1>>>0,M=new Uint8Array(I);p[g];){var T=t[p.charCodeAt(g)];if(T===255)return;for(var O=0,$=I-1;(T!==0||O<E)&&$!==-1;$--,O++)T+=u*M[$]>>>0,M[$]=T%256>>>0,T=T/256>>>0;if(T!==0)throw new Error("Non-zero carry");E=O,g++}if(p[g]!==" "){for(var U=I-E;U!==I&&M[U]===0;)U++;for(var N=new Uint8Array(S+(I-U)),se=S;U!==I;)N[se++]=M[U++];return N}}}function m(p){var g=h(p);if(g)return g;throw new Error(`Non-${e} character`)}return{encode:l,decodeUnsafe:h,decode:m}}var Jn=Wn,Qn=Jn,pr=Qn;var $i=new Uint8Array(0);var fr=(r,e)=>{if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0},k=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")};var hr=r=>new TextEncoder().encode(r),mr=r=>new TextDecoder().decode(r);var ct=class{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},at=class{constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return gr(this,e)}},ut=class{constructor(e){this.decoders=e}or(e){return gr(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},gr=(r,e)=>new ut({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),lt=class{constructor(e,t,n,o){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new ct(e,t,n),this.decoder=new at(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},ce=({name:r,prefix:e,encode:t,decode:n})=>new lt(r,e,t,n),X=({prefix:r,name:e,alphabet:t})=>{let{encode:n,decode:o}=pr(t,e);return ce({prefix:r,name:e,encode:n,decode:s=>k(o(s))})},Hn=(r,e,t,n)=>{let o={};for(let a=0;a<e.length;++a)o[e[a]]=a;let s=r.length;for(;r[s-1]==="=";)--s;let i=new Uint8Array(s*t/8|0),u=0,v=0,P=0;for(let a=0;a<s;++a){let l=o[r[a]];if(l===void 0)throw new SyntaxError(`Non-${n} character`);v=v<<t|l,u+=t,u>=8&&(u-=8,i[P++]=255&v>>u)}if(u>=t||255&v<<8-u)throw new SyntaxError("Unexpected end of data");return i},Xn=(r,e,t)=>{let n=e[e.length-1]==="=",o=(1<<t)-1,s="",i=0,u=0;for(let v=0;v<r.length;++v)for(u=u<<8|r[v],i+=8;i>t;)i-=t,s+=e[o&u>>i];if(i&&(s+=e[o&u<<t-i]),n)for(;s.length*t&7;)s+="=";return s},C=({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>ce({prefix:e,name:r,encode(o){return Xn(o,n,t)},decode(o){return Hn(o,n,t,r)}});var Kn=ce({prefix:"\0",name:"identity",encode:r=>mr(r),decode:r=>hr(r)});var pt={};z(pt,{base2:()=>Yn});var Yn=C({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var ft={};z(ft,{base8:()=>Zn});var Zn=C({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var ht={};z(ht,{base10:()=>eo});var eo=X({prefix:"9",name:"base10",alphabet:"0123456789"});var mt={};z(mt,{base16:()=>to,base16upper:()=>ro});var to=C({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ro=C({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var wt={};z(wt,{base32:()=>B,base32hex:()=>io,base32hexpad:()=>ao,base32hexpadupper:()=>uo,base32hexupper:()=>co,base32pad:()=>oo,base32padupper:()=>so,base32upper:()=>no,base32z:()=>lo});var B=C({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),no=C({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),oo=C({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),so=C({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),io=C({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),co=C({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),ao=C({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),uo=C({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),lo=C({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var gt={};z(gt,{base36:()=>po,base36upper:()=>fo});var po=X({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),fo=X({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var bt={};z(bt,{base58btc:()=>b,base58flickr:()=>ho});var b=X({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),ho=X({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var xt={};z(xt,{base64:()=>yt,base64pad:()=>mo,base64url:()=>wo,base64urlpad:()=>go});var yt=C({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),mo=C({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),wo=C({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),go=C({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var vt={};z(vt,{base256emoji:()=>Co});var br=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}"),bo=br.reduce((r,e,t)=>(r[t]=e,r),[]),yo=br.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function xo(r){return r.reduce((e,t)=>(e+=bo[t],e),"")}function vo(r){let e=[];for(let t of r){let n=yo[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}var Co=ce({prefix:"\u{1F680}",name:"base256emoji",encode:xo,decode:vo});var At={};z(At,{sha256:()=>Ge,sha512:()=>jo});var So=vr,yr=128,Eo=127,Ao=~Eo,To=Math.pow(2,31);function vr(r,e,t){e=e||[],t=t||0;for(var n=t;r>=To;)e[t++]=r&255|yr,r/=128;for(;r&Ao;)e[t++]=r&255|yr,r>>>=7;return e[t]=r|0,vr.bytes=t-n+1,e}var Fo=Ct,Po=128,xr=127;function Ct(r,n){var t=0,n=n||0,o=0,s=n,i,u=r.length;do{if(s>=u)throw Ct.bytes=0,new RangeError("Could not decode varint");i=r[s++],t+=o<28?(i&xr)<<o:(i&xr)*Math.pow(2,o),o+=7}while(i>=Po);return Ct.bytes=s-n,t}var Io=Math.pow(2,7),Bo=Math.pow(2,14),Uo=Math.pow(2,21),zo=Math.pow(2,28),Do=Math.pow(2,35),Mo=Math.pow(2,42),$o=Math.pow(2,49),No=Math.pow(2,56),Oo=Math.pow(2,63),Vo=function(r){return r<Io?1:r<Bo?2:r<Uo?3:r<zo?4:r<Do?5:r<Mo?6:r<$o?7:r<No?8:r<Oo?9:10},_o={encode:So,decode:Fo,encodingLength:Vo},Lo=_o,ve=Lo;var Ce=(r,e=0)=>[ve.decode(r,e),ve.decode.bytes],ae=(r,e,t=0)=>(ve.encode(r,e,t),e),ue=r=>ve.encodingLength(r);var K=(r,e)=>{let t=e.byteLength,n=ue(r),o=n+ue(t),s=new Uint8Array(o+t);return ae(r,s,0),ae(t,s,n),s.set(e,o),new le(r,t,e,s)},q=r=>{let e=k(r),[t,n]=Ce(e),[o,s]=Ce(e.subarray(n)),i=e.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new le(t,o,i,e)},Cr=(r,e)=>{if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&fr(r.bytes,t.bytes)}},le=class{constructor(e,t,n,o){this.code=e,this.size=t,this.digest=n,this.bytes=o}};var Et=({name:r,code:e,encode:t})=>new St(r,e,t),St=class{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?K(this.code,t):t.then(n=>K(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Er=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),Ge=Et({name:"sha2-256",code:18,encode:Er("SHA-256")}),jo=Et({name:"sha2-512",code:19,encode:Er("SHA-512")});var Tt={};z(Tt,{identity:()=>We});var Ar=0,Ro="identity",Tr=k,ko=r=>K(Ar,Tr(r)),We={code:Ar,name:Ro,encode:Tr,digest:ko};var rc=new TextEncoder,nc=new TextDecoder;var Fr=(r,e)=>{let{bytes:t,version:n}=r;switch(n){case 0:return Jo(t,Ft(r),e||b.encoder);default:return Qo(t,Ft(r),e||B.encoder)}};var Pr=new WeakMap,Ft=r=>{let e=Pr.get(r);if(e==null){let t=new Map;return Pr.set(r,t),t}return e},f=class{constructor(e,t,n,o){this.code=t,this.version=e,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:e,multihash:t}=this;if(e!==Se)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==Ho)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return f.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,n=K(e,t);return f.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return f.equals(this,e)}static equals(e,t){let n=t;return n&&e.code===n.code&&e.version===n.version&&Cr(e.multihash,n.multihash)}toString(e){return Fr(this,e)}toJSON(){return{"/":Fr(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof f)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:o,multihash:s,bytes:i}=t;return new f(n,o,s,i||Ir(n,o,s.bytes))}else if(t[Xo]===!0){let{version:n,multihash:o,code:s}=t,i=q(o);return f.create(n,s,i)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==Se)throw new Error(`Version 0 CID must use dag-pb (code: ${Se}) block encoding`);return new f(e,t,n,n.bytes)}case 1:{let o=Ir(e,t,n.bytes);return new f(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return f.create(0,Se,e)}static createV1(e,t){return f.create(1,e,t)}static decode(e){let[t,n]=f.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=f.inspectBytes(e),n=t.size-t.multihashSize,o=k(e.subarray(n,n+t.multihashSize));if(o.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=o.subarray(t.multihashSize-t.digestSize),i=new le(t.multihashCode,t.digestSize,s,o);return[t.version===0?f.createV0(i):f.createV1(t.codec,i),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[l,h]=Ce(e.subarray(t));return t+=h,l},o=n(),s=Se;if(o===18?(o=0,t=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=t,u=n(),v=n(),P=t+v,a=P-i;return{version:o,codec:s,multihashCode:u,digestSize:v,multihashSize:a,size:P}}static parse(e,t){let[n,o]=Wo(e,t),s=f.decode(o);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Ft(s).set(n,e),s}},Wo=(r,e)=>{switch(r[0]){case"Q":{let t=e||b;return[b.prefix,t.decode(`${b.prefix}${r}`)]}case b.prefix:{let t=e||b;return[b.prefix,t.decode(r)]}case B.prefix:{let t=e||B;return[B.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}},Jo=(r,e,t)=>{let{prefix:n}=t;if(n!==b.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let o=e.get(n);if(o==null){let s=t.encode(r).slice(1);return e.set(n,s),s}else return o},Qo=(r,e,t)=>{let{prefix:n}=t,o=e.get(n);if(o==null){let s=t.encode(r);return e.set(n,s),s}else return o},Se=112,Ho=18,Ir=(r,e,t)=>{let n=ue(r),o=n+ue(e),s=new Uint8Array(o+t.byteLength);return ae(r,s,0),ae(e,s,n),s.set(t,o),s},Xo=Symbol.for("@ipld/js-cid/CID");var V={...dt,...pt,...ft,...ht,...mt,...wt,...gt,...bt,...xt,...vt},fc={...At,...Tt};function de(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function Je(r=0){return globalThis.Buffer?.allocUnsafe!=null?de(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Ur(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var Br=Ur("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Pt=Ur("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=Je(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),Ko={utf8:Br,"utf-8":Br,hex:V.base16,latin1:Pt,ascii:Pt,binary:Pt,...V},Qe=Ko;function w(r,e="utf8"){let t=Qe[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):t.encoder.encode(r).substring(1)}var zr=Re,Yo=ke,It=function(r){let e=0;if(r=r.toString().trim(),zr(r)){let t=new Uint8Array(e+4);return r.split(/\./g).forEach(n=>{t[e++]=parseInt(n,10)&255}),t}if(Yo(r)){let t=r.split(":",8),n;for(n=0;n<t.length;n++){let s=zr(t[n]),i;s&&(i=It(t[n]),t[n]=w(i.slice(0,2),"base16")),i!=null&&++n<8&&t.splice(n,0,w(i.slice(2,4),"base16"))}if(t[0]==="")for(;t.length<8;)t.unshift("0");else if(t[t.length-1]==="")for(;t.length<8;)t.push("0");else if(t.length<8){for(n=0;n<t.length&&t[n]!=="";n++);let s=[n,1];for(n=9-t.length;n>0;n--)s.push("0");t.splice.apply(t,s)}let o=new Uint8Array(e+16);for(n=0;n<t.length;n++){let s=parseInt(t[n],16);o[e++]=s>>8&255,o[e++]=s&255}return o}throw new Error("invalid ip address")},Dr=function(r,e=0,t){e=~~e,t=t??r.length-e;let n=new DataView(r.buffer);if(t===4){let o=[];for(let s=0;s<t;s++)o.push(r[e+s]);return o.join(".")}if(t===16){let o=[];for(let s=0;s<t;s+=2)o.push(n.getUint16(e+s).toString(16));return o.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var Ee={},Bt={},es=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,-1,"ip6zone"],[43,8,"ipcidr"],[53,-1,"dns",!0],[54,-1,"dns4",!0],[55,-1,"dns6",!0],[56,-1,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc-direct"],[281,0,"webrtc"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,-1,"unix",!1,!0],[421,-1,"ipfs"],[421,-1,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,-1,"garlic64"],[448,0,"tls"],[449,-1,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,-1,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,-1,"memory"]];es.forEach(r=>{let e=ts(...r);Bt[e.code]=e,Ee[e.name]=e});function ts(r,e,t,n,o){return{code:r,size:e,name:t,resolvable:!!n,path:!!o}}function y(r){if(typeof r=="number"){if(Bt[r]!=null)return Bt[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(Ee[r]!=null)return Ee[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var _=R(ee(),1);function pe(r,e="utf8"){let t=Qe[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?de(globalThis.Buffer.from(r,"utf-8")):t.decoder.decode(`${t.prefix}${r}`)}function A(r,e){e==null&&(e=r.reduce((o,s)=>o+s.length,0));let t=Je(e),n=0;for(let o of r)t.set(o,n),n+=o.length;return de(t)}function Jr(r,e){switch(y(r).code){case 4:case 41:return ws(e);case 42:return Gr(e);case 6:case 273:case 33:case 132:return Hr(e).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Gr(e);case 421:return xs(e);case 444:return Wr(e);case 445:return Wr(e);case 466:return ys(e);default:return w(e,"base16")}}function Qr(r,e){switch(y(r).code){case 4:return kr(e);case 41:return kr(e);case 42:return qr(e);case 6:case 273:case 33:case 132:return Mt(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return qr(e);case 421:return gs(e);case 444:return vs(e);case 445:return Cs(e);case 466:return bs(e);default:return pe(e,"base16")}}var Dt=Object.values(V).map(r=>r.decoder),ms=function(){let r=Dt[0].or(Dt[1]);return Dt.slice(2).forEach(e=>r=r.or(e)),r}();function kr(r){if(!H(r))throw new Error("invalid ip address");return It(r)}function ws(r){let e=Dr(r,0,r.length);if(e==null)throw new Error("ipBuff is required");if(!H(e))throw new Error("invalid ip address");return e}function Mt(r){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,r),new Uint8Array(e)}function Hr(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function qr(r){let e=pe(r),t=Uint8Array.from(_.default.encode(e.length));return A([t,e],t.length+e.length)}function Gr(r){let e=_.default.decode(r);if(r=r.slice(_.default.decode.bytes),r.length!==e)throw new Error("inconsistent lengths");return w(r)}function gs(r){let e;r[0]==="Q"||r[0]==="1"?e=q(b.decode(`z${r}`)).bytes:e=f.parse(r).multihash.bytes;let t=Uint8Array.from(_.default.encode(e.length));return A([t,e],t.length+e.length)}function bs(r){let e=ms.decode(r),t=Uint8Array.from(_.default.encode(e.length));return A([t,e],t.length+e.length)}function ys(r){let e=_.default.decode(r),t=r.slice(_.default.decode.bytes);if(t.length!==e)throw new Error("inconsistent lengths");return"u"+w(t,"base64url")}function xs(r){let e=_.default.decode(r),t=r.slice(_.default.decode.bytes);if(t.length!==e)throw new Error("inconsistent lengths");return w(t,"base58btc")}function vs(r){let e=r.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==16)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion address.`);let t=B.decode("b"+e[0]),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=Mt(n);return A([t,o],t.length+o.length)}function Cs(r){let e=r.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==56)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion3 address.`);let t=B.decode(`b${e[0]}`),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=Mt(n);return A([t,o],t.length+o.length)}function Wr(r){let e=r.slice(0,r.length-2),t=r.slice(r.length-2),n=w(e,"base32"),o=Hr(t);return`${n}:${o}`}var fe=R(ee(),1);function Ss(r){let e=[],t=r.split("/").slice(1);if(t.length===1&&t[0]==="")return[];for(let n=0;n<t.length;n++){let o=t[n],s=y(o);if(s.size===0){e.push([o]);continue}if(n++,n>=t.length)throw Kr("invalid address: "+r);if(s.path===!0){e.push([o,_t(t.slice(n).join("/"))]);break}e.push([o,t[n]])}return e}function Es(r){let e=[];return r.map(t=>{let n=Ke(t);return e.push(n.name),t.length>1&&t[1]!=null&&e.push(t[1]),null}),_t(e.join("/"))}function As(r){return r.map(e=>{Array.isArray(e)||(e=[e]);let t=Ke(e);return e.length>1?[t.code,Qr(t.code,e[1])]:[t.code]})}function $t(r){return r.map(e=>{let t=Ke(e);return e[1]!=null?[t.code,Jr(t.code,e[1])]:[t.code]})}function Nt(r){return Xe(A(r.map(e=>{let t=Ke(e),n=Uint8Array.from(fe.default.encode(t.code));return e.length>1&&e[1]!=null&&(n=A([n,e[1]])),n})))}function Ot(r,e){return r.size>0?r.size/8:r.size===0?0:fe.default.decode(e)+(fe.default.decode.bytes??0)}function He(r){let e=[],t=0;for(;t<r.length;){let n=fe.default.decode(r,t),o=fe.default.decode.bytes??0,s=y(n),i=Ot(s,r.slice(t+o));if(i===0){e.push([n]),t+=o;continue}let u=r.slice(t+o,t+o+i);if(t+=i+o,t>r.length)throw Kr("Invalid address Uint8Array: "+w(r,"base16"));e.push([n,u])}return e}function Vt(r){let e=He(r),t=$t(e);return Es(t)}function Ts(r){r=_t(r);let e=Ss(r),t=As(e);return Nt(t)}function Xr(r){return Ts(r)}function Xe(r){let e=Fs(r);if(e!=null)throw e;return Uint8Array.from(r)}function Fs(r){try{He(r)}catch(e){return e}}function _t(r){return"/"+r.trim().split("/").filter(e=>e).join("/")}function Kr(r){return new Error("Error parsing address: "+r)}function Ke(r){return y(r[0])}var Rt=R(ee(),1);var tn=R(Lt(),1);function te(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}var he=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},jt=function(r,e,t,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!o:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(r,t):o?o.value=t:e.set(r,t),t},Ae,Te,Fe,en,Bs=Symbol.for("nodejs.util.inspect.custom"),Us=[y("dns").code,y("dns4").code,y("dns6").code,y("dnsaddr").code],zs=new Map,rn=Symbol.for("@multiformats/js-multiaddr/multiaddr");function Ds(r){return!!r?.[rn]}var G=class{constructor(e){if(Ae.set(this,void 0),Te.set(this,void 0),Fe.set(this,void 0),this[en]=!0,e==null&&(e=""),e instanceof Uint8Array)this.bytes=Xe(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);this.bytes=Xr(e)}else if(Ds(e))this.bytes=Xe(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return he(this,Ae,"f")==null&&jt(this,Ae,Vt(this.bytes),"f"),he(this,Ae,"f")}toJSON(){return this.toString()}toOptions(){let e,t,n,o,s="",i=y("tcp"),u=y("udp"),v=y("ip4"),P=y("ip6"),a=y("dns6"),l=y("ip6zone");for(let[m,p]of this.stringTuples())m===l.code&&(s=`%${p??""}`),Us.includes(m)&&(t=i.name,o=443,n=`${p??""}${s}`,e=m===a.code?6:4),(m===i.code||m===u.code)&&(t=y(m).name,o=parseInt(p??"")),(m===v.code||m===P.code)&&(t=y(m).name,n=`${p??""}${s}`,e=m===P.code?6:4);if(e==null||t==null||n==null||o==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:n,transport:t,port:o}}protos(){return this.protoCodes().map(e=>Object.assign({},y(e)))}protoCodes(){let e=[],t=this.bytes,n=0;for(;n<t.length;){let o=Rt.default.decode(t,n),s=Rt.default.decode.bytes??0,i=y(o),u=Ot(i,t.slice(n+s));n+=u+s,e.push(o)}return e}protoNames(){return this.protos().map(e=>e.name)}tuples(){return he(this,Te,"f")==null&&jt(this,Te,He(this.bytes),"f"),he(this,Te,"f")}stringTuples(){return he(this,Fe,"f")==null&&jt(this,Fe,$t(this.tuples()),"f"),he(this,Fe,"f")}encapsulate(e){return e=new G(e),new G(this.toString()+e.toString())}decapsulate(e){let t=e.toString(),n=this.toString(),o=n.lastIndexOf(t);if(o<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${e.toString()}`);return new G(n.slice(0,o))}decapsulateCode(e){let t=this.tuples();for(let n=t.length-1;n>=0;n--)if(t[n][0]===e)return new G(Nt(t.slice(0,n)));return this}getPeerId(){try{let t=this.stringTuples().filter(n=>n[0]===Ee.ipfs.code).pop();if(t?.[1]!=null){let n=t[1];return n[0]==="Q"||n[0]==="1"?w(b.decode(`z${n}`),"base58btc"):w(f.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){let e=null;try{e=this.stringTuples().filter(t=>y(t[0]).path===!0)[0][1],e==null&&(e=null)}catch{e=null}return e}equals(e){return te(this.bytes,e.bytes)}async resolve(e){let t=this.protos().find(s=>s.resolvable);if(t==null)return[this];let n=zs.get(t.name);if(n==null)throw(0,tn.default)(new Error(`no available resolver for ${t.name}`),"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,e)).map(s=>new G(s))}nodeAddress(){let e=this.toOptions();if(e.transport!=="tcp"&&e.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${e.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:e.family,address:e.host,port:e.port}}isThinWaistAddress(e){let t=(e??this).protos();return!(t.length!==2||t[0].code!==4&&t[0].code!==41||t[1].code!==6&&t[1].code!==273)}[(Ae=new WeakMap,Te=new WeakMap,Fe=new WeakMap,en=rn,Bs)](){return`Multiaddr(${Vt(this.bytes)})`}};function nn(r){return new G(r)}var on=Re,Ms=ke,kt=function(r){let e=0;if(r=r.toString().trim(),on(r)){let t=new Uint8Array(e+4);return r.split(/\./g).forEach(n=>{t[e++]=parseInt(n,10)&255}),t}if(Ms(r)){let t=r.split(":",8),n;for(n=0;n<t.length;n++){let s=on(t[n]),i;s&&(i=kt(t[n]),t[n]=w(i.slice(0,2),"base16")),i!=null&&++n<8&&t.splice(n,0,w(i.slice(2,4),"base16"))}if(t[0]==="")for(;t.length<8;)t.unshift("0");else if(t[t.length-1]==="")for(;t.length<8;)t.push("0");else if(t.length<8){for(n=0;n<t.length&&t[n]!=="";n++);let s=[n,1];for(n=9-t.length;n>0;n--)s.push("0");t.splice.apply(t,s)}let o=new Uint8Array(e+16);for(n=0;n<t.length;n++){let s=parseInt(t[n],16);o[e++]=s>>8&255,o[e++]=s&255}return o}throw new Error("invalid ip address")},sn=function(r,e=0,t){e=~~e,t=t??r.length-e;let n=new DataView(r.buffer);if(t===4){let o=[];for(let s=0;s<t;s++)o.push(r[e+s]);return o.join(".")}if(t===16){let o=[];for(let s=0;s<t;s+=2)o.push(n.getUint16(e+s).toString(16));return o.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var Pe={},qt={},Ns=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,-1,"ip6zone"],[43,8,"ipcidr"],[53,-1,"dns",!0],[54,-1,"dns4",!0],[55,-1,"dns6",!0],[56,-1,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc"],[281,0,"webrtc-w3c"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,-1,"unix",!1,!0],[421,-1,"ipfs"],[421,-1,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,-1,"garlic64"],[448,0,"tls"],[449,-1,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,-1,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,-1,"memory"]];Ns.forEach(r=>{let e=Os(...r);qt[e.code]=e,Pe[e.name]=e});function Os(r,e,t,n,o){return{code:r,size:e,name:t,resolvable:!!n,path:!!o}}function x(r){if(typeof r=="number"){if(qt[r]!=null)return qt[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(Pe[r]!=null)return Pe[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var L=R(ee(),1);function dn(r,e){switch(x(r).code){case 4:case 41:return _s(e);case 42:return un(e);case 6:case 273:case 33:case 132:return fn(e).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return un(e);case 421:return ks(e);case 444:return ln(e);case 445:return ln(e);case 466:return Rs(e);default:return w(e,"base16")}}function pn(r,e){switch(x(r).code){case 4:return cn(e);case 41:return cn(e);case 42:return an(e);case 6:case 273:case 33:case 132:return Wt(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return an(e);case 421:return Ls(e);case 444:return qs(e);case 445:return Gs(e);case 466:return js(e);default:return pe(e,"base16")}}var Gt=Object.values(V).map(r=>r.decoder),Vs=function(){let r=Gt[0].or(Gt[1]);return Gt.slice(2).forEach(e=>r=r.or(e)),r}();function cn(r){if(!H(r))throw new Error("invalid ip address");return kt(r)}function _s(r){let e=sn(r,0,r.length);if(e==null)throw new Error("ipBuff is required");if(!H(e))throw new Error("invalid ip address");return e}function Wt(r){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,r),new Uint8Array(e)}function fn(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function an(r){let e=pe(r),t=Uint8Array.from(L.default.encode(e.length));return A([t,e],t.length+e.length)}function un(r){let e=L.default.decode(r);if(r=r.slice(L.default.decode.bytes),r.length!==e)throw new Error("inconsistent lengths");return w(r)}function Ls(r){let e;r[0]==="Q"||r[0]==="1"?e=q(b.decode(`z${r}`)).bytes:e=f.parse(r).multihash.bytes;let t=Uint8Array.from(L.default.encode(e.length));return A([t,e],t.length+e.length)}function js(r){let e=Vs.decode(r),t=Uint8Array.from(L.default.encode(e.length));return A([t,e],t.length+e.length)}function Rs(r){let e=L.default.decode(r),t=r.slice(L.default.decode.bytes);if(t.length!==e)throw new Error("inconsistent lengths");return"u"+w(t,"base64url")}function ks(r){let e=L.default.decode(r),t=r.slice(L.default.decode.bytes);if(t.length!==e)throw new Error("inconsistent lengths");return w(t,"base58btc")}function qs(r){let e=r.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==16)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion address.`);let t=B.decode("b"+e[0]),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=Wt(n);return A([t,o],t.length+o.length)}function Gs(r){let e=r.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==56)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion3 address.`);let t=B.decode(`b${e[0]}`),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=Wt(n);return A([t,o],t.length+o.length)}function ln(r){let e=r.slice(0,r.length-2),t=r.slice(r.length-2),n=w(e,"base32"),o=fn(t);return`${n}:${o}`}var me=R(ee(),1);function Ws(r){let e=[],t=r.split("/").slice(1);if(t.length===1&&t[0]==="")return[];for(let n=0;n<t.length;n++){let o=t[n],s=x(o);if(s.size===0){e.push([o]);continue}if(n++,n>=t.length)throw mn("invalid address: "+r);if(s.path===!0){e.push([o,Kt(t.slice(n).join("/"))]);break}e.push([o,t[n]])}return e}function Js(r){let e=[];return r.map(t=>{let n=et(t);return e.push(n.name),t.length>1&&t[1]!=null&&e.push(t[1]),null}),Kt(e.join("/"))}function Qs(r){return r.map(e=>{Array.isArray(e)||(e=[e]);let t=et(e);return e.length>1?[t.code,pn(t.code,e[1])]:[t.code]})}function Jt(r){return r.map(e=>{let t=et(e);return e[1]!=null?[t.code,dn(t.code,e[1])]:[t.code]})}function Qt(r){return Ze(A(r.map(e=>{let t=et(e),n=Uint8Array.from(me.default.encode(t.code));return e.length>1&&e[1]!=null&&(n=A([n,e[1]])),n})))}function Ht(r,e){return r.size>0?r.size/8:r.size===0?0:me.default.decode(e)+(me.default.decode.bytes??0)}function Ye(r){let e=[],t=0;for(;t<r.length;){let n=me.default.decode(r,t),o=me.default.decode.bytes??0,s=x(n),i=Ht(s,r.slice(t+o));if(i===0){e.push([n]),t+=o;continue}let u=r.slice(t+o,t+o+i);if(t+=i+o,t>r.length)throw mn("Invalid address Uint8Array: "+w(r,"base16"));e.push([n,u])}return e}function Xt(r){let e=Ye(r),t=Jt(e);return Js(t)}function Hs(r){r=Kt(r);let e=Ws(r),t=Qs(e);return Qt(t)}function hn(r){return Hs(r)}function Ze(r){let e=Xs(r);if(e!=null)throw e;return Uint8Array.from(r)}function Xs(r){try{Ye(r)}catch(e){return e}}function Kt(r){return"/"+r.trim().split("/").filter(e=>e).join("/")}function mn(r){return new Error("Error parsing address: "+r)}function et(r){return x(r[0])}var Zt=R(ee(),1);var gn=R(Lt(),1);var we=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Yt=function(r,e,t,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!o:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(r,t):o?o.value=t:e.set(r,t),t},Ie,Be,Ue,wn,Ys=Symbol.for("nodejs.util.inspect.custom"),Zs=[x("dns").code,x("dns4").code,x("dns6").code,x("dnsaddr").code],ei=new Map,bn=Symbol.for("@multiformats/js-multiaddr/multiaddr");function ti(r){return!!r?.[bn]}var W=class{constructor(e){if(Ie.set(this,void 0),Be.set(this,void 0),Ue.set(this,void 0),this[wn]=!0,e==null&&(e=""),e instanceof Uint8Array)this.bytes=Ze(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);this.bytes=hn(e)}else if(ti(e))this.bytes=Ze(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return we(this,Ie,"f")==null&&Yt(this,Ie,Xt(this.bytes),"f"),we(this,Ie,"f")}toJSON(){return this.toString()}toOptions(){let e,t,n,o,s="",i=x("tcp"),u=x("udp"),v=x("ip4"),P=x("ip6"),a=x("dns6"),l=x("ip6zone");for(let[m,p]of this.stringTuples())m===l.code&&(s=`%${p??""}`),Zs.includes(m)&&(t=i.name,o=443,n=`${p??""}${s}`,e=m===a.code?6:4),(m===i.code||m===u.code)&&(t=x(m).name,o=parseInt(p??"")),(m===v.code||m===P.code)&&(t=x(m).name,n=`${p??""}${s}`,e=m===P.code?6:4);if(e==null||t==null||n==null||o==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:n,transport:t,port:o}}protos(){return this.protoCodes().map(e=>Object.assign({},x(e)))}protoCodes(){let e=[],t=this.bytes,n=0;for(;n<t.length;){let o=Zt.default.decode(t,n),s=Zt.default.decode.bytes??0,i=x(o),u=Ht(i,t.slice(n+s));n+=u+s,e.push(o)}return e}protoNames(){return this.protos().map(e=>e.name)}tuples(){return we(this,Be,"f")==null&&Yt(this,Be,Ye(this.bytes),"f"),we(this,Be,"f")}stringTuples(){return we(this,Ue,"f")==null&&Yt(this,Ue,Jt(this.tuples()),"f"),we(this,Ue,"f")}encapsulate(e){return e=new W(e),new W(this.toString()+e.toString())}decapsulate(e){let t=e.toString(),n=this.toString(),o=n.lastIndexOf(t);if(o<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${e.toString()}`);return new W(n.slice(0,o))}decapsulateCode(e){let t=this.tuples();for(let n=t.length-1;n>=0;n--)if(t[n][0]===e)return new W(Qt(t.slice(0,n)));return this}getPeerId(){try{let t=this.stringTuples().filter(n=>n[0]===Pe.ipfs.code).pop();if(t?.[1]!=null){let n=t[1];return n[0]==="Q"||n[0]==="1"?w(b.decode(`z${n}`),"base58btc"):w(f.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){let e=null;try{e=this.stringTuples().filter(t=>x(t[0]).path===!0)[0][1],e==null&&(e=null)}catch{e=null}return e}equals(e){return te(this.bytes,e.bytes)}async resolve(e){let t=this.protos().find(s=>s.resolvable);if(t==null)return[this];let n=ei.get(t.name);if(n==null)throw(0,gn.default)(new Error(`no available resolver for ${t.name}`),"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,e)).map(s=>new W(s))}nodeAddress(){let e=this.toOptions();if(e.transport!=="tcp"&&e.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${e.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:e.family,address:e.host,port:e.port}}isThinWaistAddress(e){let t=(e??this).protos();return!(t.length!==2||t[0].code!==4&&t[0].code!==41||t[1].code!==6&&t[1].code!==273)}[(Ie=new WeakMap,Be=new WeakMap,Ue=new WeakMap,wn=bn,Ys)](){return`Multiaddr(${Xt(this.bytes)})`}};function er(r){return new W(r)}var ri=c("dns4"),ni=c("dns6"),oi=c("dnsaddr"),re=F(c("dns"),oi,ri,ni),tt=F(c("ip4"),c("ip6")),ge=F(d(tt,c("tcp")),d(re,c("tcp"))),nr=d(tt,c("udp")),si=d(nr,c("utp")),ii=d(nr,c("quic")),De=F(d(ge,c("ws")),d(re,c("ws"))),Me=F(d(ge,c("wss")),d(re,c("wss")),d(ge,c("tls"),c("ws")),d(re,c("tls"),c("ws"))),tr=F(d(ge,c("http")),d(tt,c("http")),d(re,c("http"))),rr=F(d(ge,c("https")),d(tt,c("https")),d(re,c("https"))),yn=d(nr,c("webrtc"),c("certhash")),vn=F(d(yn,c("p2p")),yn),Cn=F(d(De,c("p2p-webrtc-star"),c("p2p")),d(Me,c("p2p-webrtc-star"),c("p2p")),d(De,c("p2p-webrtc-star")),d(Me,c("p2p-webrtc-star"))),Pa=F(d(De,c("p2p-websocket-star"),c("p2p")),d(Me,c("p2p-websocket-star"),c("p2p")),d(De,c("p2p-websocket-star")),d(Me,c("p2p-websocket-star"))),Sn=F(d(tr,c("p2p-webrtc-direct"),c("p2p")),d(rr,c("p2p-webrtc-direct"),c("p2p")),d(tr,c("p2p-webrtc-direct")),d(rr,c("p2p-webrtc-direct"))),$e=F(De,Me,tr,rr,Cn,Sn,ge,si,ii,re,vn),Ia=F(d($e,c("p2p-stardust"),c("p2p")),d($e,c("p2p-stardust"))),Z=F(d($e,c("p2p")),Cn,Sn,vn,c("p2p")),xn=F(d(Z,c("p2p-circuit"),Z),d(Z,c("p2p-circuit")),d(c("p2p-circuit"),Z),d($e,c("p2p-circuit")),d(c("p2p-circuit"),$e),c("p2p-circuit")),En=()=>F(d(xn,En),xn),ze=En(),An=F(d(ze,Z,ze),d(Z,ze),d(ze,Z),ze,Z);function Tn(r){function e(t){let n;try{n=er(t)}catch{return!1}let o=r(n.protoNames());return o===null?!1:o===!0||o===!1?o:o.length===0}return e}function d(...r){function e(t){if(t.length<r.length)return null;let n=t;return r.some(o=>(n=typeof o=="function"?o().partialMatch(t):o.partialMatch(t),Array.isArray(n)&&(t=n),n===null)),n}return{toString:function(){return"{ "+r.join(" ")+" }"},input:r,matches:Tn(e),partialMatch:e}}function F(...r){function e(n){let o=null;return r.some(s=>{let i=typeof s=="function"?s().partialMatch(n):s.partialMatch(n);return i!=null?(o=i,!0):!1}),o}return{toString:function(){return"{ "+r.join(" ")+" }"},input:r,matches:Tn(e),partialMatch:e}}function c(r){let e=r;function t(o){let s;try{s=er(o)}catch{return!1}let i=s.protoNames();return i.length===1&&i[0]===e}function n(o){return o.length===0?null:o[0]===e?o.slice(1):null}return{toString:function(){return e},matches:t,partialMatch:n}}var ne=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},J,rt=class extends EventTarget{constructor(){super(...arguments),J.set(this,new Map)}listenerCount(e){let t=ne(this,J,"f").get(e);return t==null?0:t.length}addEventListener(e,t,n){super.addEventListener(e,t,n);let o=ne(this,J,"f").get(e);o==null&&(o=[],ne(this,J,"f").set(e,o)),o.push({callback:t,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(e,t,n){super.removeEventListener(e.toString(),t??null,n);let o=ne(this,J,"f").get(e);o!=null&&(o=o.filter(({callback:s})=>s!==t),ne(this,J,"f").set(e,o))}dispatchEvent(e){let t=super.dispatchEvent(e),n=ne(this,J,"f").get(e.type);return n==null||(n=n.filter(({once:o})=>!o),ne(this,J,"f").set(e.type,n)),t}safeDispatchEvent(e,t){return this.dispatchEvent(new sr(e,t))}};J=new WeakMap;var or=class extends Event{constructor(e,t){super(e,t),this.detail=t?.detail}},sr=globalThis.CustomEvent??or;var j=R(Un(),1);j.default.formatters.b=r=>r==null?"undefined":b.baseEncode(r);j.default.formatters.t=r=>r==null?"undefined":B.baseEncode(r);j.default.formatters.m=r=>r==null?"undefined":yt.baseEncode(r);j.default.formatters.p=r=>r==null?"undefined":r.toString();j.default.formatters.c=r=>r==null?"undefined":r.toString();j.default.formatters.k=r=>r==null?"undefined":r.toString();function zn(r){return Object.assign((0,j.default)(r),{error:(0,j.default)(`${r}:error`),trace:(0,j.default)(`${r}:trace`)})}var Dn=Symbol.for("@libp2p/peer-id");var yi=Symbol.for("nodejs.util.inspect.custom"),Mn=Object.values(V).map(r=>r.decoder).reduce((r,e)=>r.or(e),V.identity.decoder),$n=114,Nn=36,On=37,Ne=class{constructor(e){this.type=e.type,this.multihash=e.multihash,this.privateKey=e.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}get[Dn](){return!0}toString(){return this.string==null&&(this.string=b.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return f.createV1($n,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e instanceof Uint8Array)return te(this.multihash.bytes,e);if(typeof e=="string")return ir(e).equals(this);if(e?.multihash?.bytes!=null)return te(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[yi](){return`PeerId(${this.toString()})`}},Oe=class extends Ne{constructor(e){super({...e,type:"RSA"}),this.type="RSA",this.publicKey=e.publicKey}},Ve=class extends Ne{constructor(e){super({...e,type:"Ed25519"}),this.type="Ed25519",this.publicKey=e.multihash.digest}},_e=class extends Ne{constructor(e){super({...e,type:"secp256k1"}),this.type="secp256k1",this.publicKey=e.multihash.digest}};function ir(r,e){if(e=e??Mn,r.charAt(0)==="1"||r.charAt(0)==="Q"){let t=q(b.decode(`z${r}`));return r.startsWith("12D")?new Ve({multihash:t}):r.startsWith("16U")?new _e({multihash:t}):new Oe({multihash:t})}return xi(Mn.decode(r))}function xi(r){try{let e=q(r);if(e.code===We.code){if(e.digest.length===Nn)return new Ve({multihash:e});if(e.digest.length===On)return new _e({multihash:e})}if(e.code===Ge.code)return new Oe({multihash:e})}catch{return vi(f.decode(r))}throw new Error("Supplied PeerID CID is invalid")}function vi(r){if(r==null||r.multihash==null||r.version==null||r.version===1&&r.code!==$n)throw new Error("Supplied PeerID CID is invalid");let e=r.multihash;if(e.code===Ge.code)return new Oe({multihash:r.multihash});if(e.code===We.code){if(e.digest.length===Nn)return new Ve({multihash:r.multihash});if(e.digest.length===On)return new _e({multihash:r.multihash})}throw new Error("Supplied PeerID CID is invalid")}var Vn=Symbol.for("@libp2p/peer-discovery");var st=zn("libp2p:bootstrap"),Ci="bootstrap",Si=50,Ei=12e4,Ai=1e3,it=class extends rt{constructor(e,t={list:[]}){if(t.list==null||t.list.length===0)throw new Error("Bootstrap requires a list of peer addresses");super(),this.components=e,this.timeout=t.timeout??Ai,this.list=[];for(let n of t.list){if(!An.matches(n)){st.error("Invalid multiaddr");continue}let o=nn(n),s=o.getPeerId();if(s==null){st.error("Invalid bootstrap multiaddr without peer id");continue}let i={id:ir(s),multiaddrs:[o],protocols:[]};this.list.push(i)}this._init=t}get[Vn](){return!0}get[Symbol.toStringTag](){return"@libp2p/bootstrap"}isStarted(){return!!this.timer}start(){this.isStarted()||(st("Starting bootstrap node discovery, discovering peers after %s ms",this.timeout),this.timer=setTimeout(()=>{this._discoverBootstrapPeers().catch(e=>{st.error(e)})},this.timeout))}async _discoverBootstrapPeers(){if(this.timer!=null)for(let e of this.list){if(await this.components.peerStore.tagPeer(e.id,this._init.tagName??Ci,{value:this._init.tagValue??Si,ttl:this._init.tagTTL??Ei}),this.timer==null)return;this.dispatchEvent(new sr("peer",{detail:e}))}}stop(){this.timer!=null&&clearTimeout(this.timer),this.timer=void 0}};it.tag="bootstrap";function Ti(r){return e=>new it(e,r)}return qn(Fi);})();
3
3
  return Libp2PBootstrap}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/bootstrap",
3
- "version": "6.0.0",
3
+ "version": "6.0.2",
4
4
  "description": "Node.js IPFS Implementation of the railing process of a Node through a bootstrap peer list",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/libp2p/js-libp2p-bootstrap#readme",
@@ -146,15 +146,15 @@
146
146
  "@libp2p/logger": "^2.0.1",
147
147
  "@libp2p/peer-id": "^2.0.0",
148
148
  "@multiformats/mafmt": "^11.0.3",
149
- "@multiformats/multiaddr": "^11.0.0"
149
+ "@multiformats/multiaddr": "^12.0.0"
150
150
  },
151
151
  "devDependencies": {
152
152
  "@libp2p/interface-peer-discovery-compliance-tests": "^2.0.0",
153
153
  "@libp2p/interface-peer-id": "^2.0.0",
154
154
  "@libp2p/peer-id-factory": "^2.0.0",
155
- "@libp2p/peer-store": "^6.0.0",
156
- "aegir": "^37.9.1",
157
- "datastore-core": "^8.0.1",
155
+ "@libp2p/peer-store": "^7.0.0",
156
+ "aegir": "^38.1.7",
157
+ "datastore-core": "^9.0.3",
158
158
  "delay": "^5.0.0"
159
159
  }
160
160
  }
package/src/index.ts CHANGED
@@ -99,18 +99,18 @@ class Bootstrap extends EventEmitter<PeerDiscoveryEvents> implements PeerDiscove
99
99
  return true
100
100
  }
101
101
 
102
- get [Symbol.toStringTag] () {
102
+ get [Symbol.toStringTag] (): '@libp2p/bootstrap' {
103
103
  return '@libp2p/bootstrap'
104
104
  }
105
105
 
106
- isStarted () {
106
+ isStarted (): boolean {
107
107
  return Boolean(this.timer)
108
108
  }
109
109
 
110
110
  /**
111
111
  * Start emitting events
112
112
  */
113
- start () {
113
+ start (): void {
114
114
  if (this.isStarted()) {
115
115
  return
116
116
  }
@@ -127,7 +127,7 @@ class Bootstrap extends EventEmitter<PeerDiscoveryEvents> implements PeerDiscove
127
127
  /**
128
128
  * Emit each address in the list as a PeerInfo
129
129
  */
130
- async _discoverBootstrapPeers () {
130
+ async _discoverBootstrapPeers (): Promise<void> {
131
131
  if (this.timer == null) {
132
132
  return
133
133
  }
@@ -150,7 +150,7 @@ class Bootstrap extends EventEmitter<PeerDiscoveryEvents> implements PeerDiscove
150
150
  /**
151
151
  * Stop emitting events
152
152
  */
153
- stop () {
153
+ stop (): void {
154
154
  if (this.timer != null) {
155
155
  clearTimeout(this.timer)
156
156
  }