New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@libp2p/bootstrap

Package Overview
Dependencies
Maintainers
6
Versions
606
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@libp2p/bootstrap - npm Package Compare versions

Comparing version 6.0.1 to 6.0.2

2

dist/index.min.js
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PBootstrap = factory()}(typeof self !== 'undefined' ? self : this, function () {
"use strict";var Libp2PBootstrap=(()=>{var en=Object.create;var Ie=Object.defineProperty;var tn=Object.getOwnPropertyDescriptor;var rn=Object.getOwnPropertyNames;var nn=Object.getPrototypeOf,on=Object.prototype.hasOwnProperty;var k=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),I=(t,e)=>{for(var r in e)Ie(t,r,{get:e[r],enumerable:!0})},Ot=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of rn(e))!on.call(t,o)&&o!==r&&Ie(t,o,{get:()=>e[o],enumerable:!(n=tn(e,o))||n.enumerable});return t};var de=(t,e,r)=>(r=t!=null?en(nn(t)):{},Ot(e||!t||!t.__esModule?Ie(r,"default",{value:t,enumerable:!0}):r,t)),sn=t=>Ot(Ie({},"__esModule",{value:!0}),t);var fr=k((vi,dr)=>{dr.exports=gt;var lr=128,wo=127,yo=~wo,xo=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>=xo;)e[r++]=t&255|lr,t/=128;for(;t&yo;)e[r++]=t&255|lr,t>>>=7;return e[r]=t|0,gt.bytes=r-n+1,e}});var mr=k((Ci,hr)=>{hr.exports=wt;var vo=128,pr=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&pr)<<o:(i&pr)*Math.pow(2,o),o+=7}while(i>=vo);return wt.bytes=s-n,r}});var gr=k((Ei,br)=>{var Co=Math.pow(2,7),Eo=Math.pow(2,14),So=Math.pow(2,21),Ao=Math.pow(2,28),To=Math.pow(2,35),Fo=Math.pow(2,42),Po=Math.pow(2,49),Io=Math.pow(2,56),Uo=Math.pow(2,63);br.exports=function(t){return t<Co?1:t<Eo?2:t<So?3:t<Ao?4:t<To?5:t<Fo?6:t<Po?7:t<Io?8:t<Uo?9:10}});var Le=k((Si,wr)=>{wr.exports={encode:fr(),decode:mr(),encodingLength:gr()}});var Ur=k((qi,Ir)=>{"use strict";function Pr(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function Go(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 Pr(t,r)}catch{r.message=t.message,r.stack=t.stack;let o=function(){};return o.prototype=Object.create(Object.getPrototypeOf(t)),Pr(new o,r)}}Ir.exports=Go});var jr=k((na,kr)=>{var ce=1e3,ue=ce*60,le=ue*60,K=le*24,ts=K*7,rs=K*365.25;kr.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return ns(t);if(r==="number"&&isFinite(t))return e.long?ss(t):os(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function ns(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*rs;case"weeks":case"week":case"w":return r*ts;case"days":case"day":case"d":return r*K;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 os(t){var e=Math.abs(t);return e>=K?Math.round(t/K)+"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 ss(t){var e=Math.abs(t);return e>=K?je(t,e,K,"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 Gr=k((oa,qr)=>{function is(t){r.debug=r,r.default=r,r.coerce=w,r.disable=s,r.enable=o,r.enabled=i,r.humanize=jr(),r.destroy=F,Object.keys(t).forEach(c=>{r[c]=t[c]}),r.names=[],r.skips=[],r.formatters={};function e(c){let l=0;for(let p=0;p<c.length;p++)l=(l<<5)-l+c.charCodeAt(p),l|=0;return r.colors[Math.abs(l)%r.colors.length]}r.selectColor=e;function r(c){let l,p=null,C,f;function m(...y){if(!m.enabled)return;let x=m,A=Number(new Date),B=A-(l||A);x.diff=B,x.prev=l,x.curr=A,l=A,y[0]=r.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");let E=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,(M,P)=>{if(M==="%%")return"%";E++;let D=r.formatters[P];if(typeof D=="function"){let Y=y[E];M=D.call(x,Y),y.splice(E,1),E--}return M}),r.formatArgs.call(x,y),(x.log||r.log).apply(x,y)}return m.namespace=c,m.useColors=r.useColors(),m.color=r.selectColor(c),m.extend=n,m.destroy=r.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(C!==r.namespaces&&(C=r.namespaces,f=r.enabled(c)),f),set:y=>{p=y}}),typeof r.init=="function"&&r.init(m),m}function n(c,l){let p=r(this.namespace+(typeof l>"u"?":":l)+c);return p.log=this.log,p}function o(c){r.save(c),r.namespaces=c,r.names=[],r.skips=[];let l,p=(typeof c=="string"?c:"").split(/[\s,]+/),C=p.length;for(l=0;l<C;l++)p[l]&&(c=p[l].replace(/\*/g,".*?"),c[0]==="-"?r.skips.push(new RegExp("^"+c.slice(1)+"$")):r.names.push(new RegExp("^"+c+"$")))}function s(){let c=[...r.names.map(d),...r.skips.map(d).map(l=>"-"+l)].join(",");return r.enable(""),c}function i(c){if(c[c.length-1]==="*")return!0;let l,p;for(l=0,p=r.skips.length;l<p;l++)if(r.skips[l].test(c))return!1;for(l=0,p=r.names.length;l<p;l++)if(r.names[l].test(c))return!0;return!1}function d(c){return c.toString().substring(2,c.toString().length-2).replace(/\.\*\?$/,"*")}function w(c){return c instanceof Error?c.stack||c.message:c}function F(){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}qr.exports=is});var Wr=k((U,qe)=>{U.formatArgs=cs;U.save=us;U.load=ls;U.useColors=as;U.storage=ds();U.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`."))}})();U.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 as(){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 cs(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)}U.log=console.debug||console.log||(()=>{});function us(t){try{t?U.storage.setItem("debug",t):U.storage.removeItem("debug")}catch{}}function ls(){let t;try{t=U.storage.getItem("debug")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function ds(){try{return localStorage}catch{}}qe.exports=Gr()(U);var{formatters:fs}=qe.exports;fs.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var vs={};I(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 w=d==="0",F=2**(8*o)-1;for(;;){let c=this.readAtomically(()=>{let l=this.readChar();if(l===void 0)return;let p=Number.parseInt(l,e);if(!Number.isNaN(p))return p});if(c===void 0)break;if(s*=e,s+=c,s>F||(i+=1,r!==void 0&&i>r))return}if(i!==0)return!n&&w&&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 zt=45,an=15,Z=new Ue;function Lt(t){if(!(t.length>an))return Z.new(t).parseWith(()=>Z.readIPv4Addr())}function _t(t){if(!(t.length>zt))return Z.new(t).parseWith(()=>Z.readIPv6Addr())}function Rt(t){if(!(t.length>zt))return Z.new(t).parseWith(()=>Z.readIPAddr())}function $t(t){return!!Lt(t)}function Vt(t){return!!_t(t)}function Be(t){return!!Rt(t)}var Ke={};I(Ke,{identity:()=>pn});function cn(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,w=t.charAt(0),F=Math.log(d)/Math.log(256),c=Math.log(256)/Math.log(d);function l(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,y=0,x=0,A=f.length;x!==A&&f[x]===0;)x++,m++;for(var B=(A-x)*c+1>>>0,E=new Uint8Array(B);x!==A;){for(var N=f[x],M=0,P=B-1;(N!==0||M<y)&&P!==-1;P--,M++)N+=256*E[P]>>>0,E[P]=N%d>>>0,N=N/d>>>0;if(N!==0)throw new Error("Non-zero carry");y=M,x++}for(var D=B-y;D!==B&&E[D]===0;)D++;for(var Y=w.repeat(m);D<B;++D)Y+=t.charAt(E[D]);return Y}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 y=0,x=0;f[m]===w;)y++,m++;for(var A=(f.length-m)*F+1>>>0,B=new Uint8Array(A);f[m];){var E=r[f.charCodeAt(m)];if(E===255)return;for(var N=0,M=A-1;(E!==0||N<x)&&M!==-1;M--,N++)E+=d*B[M]>>>0,B[M]=E%256>>>0,E=E/256>>>0;if(E!==0)throw new Error("Non-zero carry");x=N,m++}if(f[m]!==" "){for(var P=A-x;P!==A&&B[P]===0;)P++;for(var D=new Uint8Array(y+(A-P)),Y=y;P!==A;)D[Y++]=B[P++];return D}}}function C(f){var m=p(f);if(m)return m;throw new Error(`Non-${e} character`)}return{encode:l,decodeUnsafe:p,decode:C}}var un=cn,ln=un,kt=ln;var Is=new Uint8Array(0);var jt=(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 qt=t=>new TextEncoder().encode(t),Gt=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 Jt(this,e)}},Xe=class{constructor(e){this.decoders=e}or(e){return Jt(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`)}},Jt=(t,e)=>new Xe({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),Qe=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 Qe(t,e,r,n),j=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:o}=kt(r,e);return ee({prefix:t,name:e,encode:n,decode:s=>_(o(s))})},dn=(t,e,r,n)=>{let o={};for(let c=0;c<e.length;++c)o[e[c]]=c;let s=t.length;for(;t[s-1]==="=";)--s;let i=new Uint8Array(s*r/8|0),d=0,w=0,F=0;for(let c=0;c<s;++c){let l=o[t[c]];if(l===void 0)throw new SyntaxError(`Non-${n} character`);w=w<<r|l,d+=r,d>=8&&(d-=8,i[F++]=255&w>>d)}if(d>=r||255&w<<8-d)throw new SyntaxError("Unexpected end of data");return i},fn=(t,e,r)=>{let n=e[e.length-1]==="=",o=(1<<r)-1,s="",i=0,d=0;for(let w=0;w<t.length;++w)for(d=d<<8|t[w],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},g=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>ee({prefix:e,name:t,encode(o){return fn(o,n,r)},decode(o){return dn(o,n,r,t)}});var pn=ee({prefix:"\0",name:"identity",encode:t=>Gt(t),decode:t=>qt(t)});var Ye={};I(Ye,{base2:()=>hn});var hn=g({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Ze={};I(Ze,{base8:()=>mn});var mn=g({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var et={};I(et,{base10:()=>bn});var bn=j({prefix:"9",name:"base10",alphabet:"0123456789"});var tt={};I(tt,{base16:()=>gn,base16upper:()=>wn});var gn=g({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),wn=g({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var rt={};I(rt,{base32:()=>O,base32hex:()=>Cn,base32hexpad:()=>Sn,base32hexpadupper:()=>An,base32hexupper:()=>En,base32pad:()=>xn,base32padupper:()=>vn,base32upper:()=>yn,base32z:()=>Tn});var O=g({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),yn=g({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),xn=g({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),vn=g({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Cn=g({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),En=g({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Sn=g({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),An=g({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Tn=g({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var nt={};I(nt,{base36:()=>Fn,base36upper:()=>Pn});var Fn=j({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Pn=j({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var ot={};I(ot,{base58btc:()=>v,base58flickr:()=>In});var v=j({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),In=j({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var it={};I(it,{base64:()=>st,base64pad:()=>Un,base64url:()=>Bn,base64urlpad:()=>Mn});var st=g({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Un=g({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Bn=g({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Mn=g({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var at={};I(at,{base256emoji:()=>Ln});var Ht=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}"),Dn=Ht.reduce((t,e,r)=>(t[r]=e,t),[]),Nn=Ht.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function On(t){return t.reduce((e,r)=>(e+=Dn[r],e),"")}function zn(t){let e=[];for(let r of t){let n=Nn[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var Ln=ee({prefix:"\u{1F680}",name:"base256emoji",encode:On,decode:zn});var dt={};I(dt,{sha256:()=>De,sha512:()=>ro});var _n=Kt,Xt=128,Rn=127,$n=~Rn,Vn=Math.pow(2,31);function Kt(t,e,r){e=e||[],r=r||0;for(var n=r;t>=Vn;)e[r++]=t&255|Xt,t/=128;for(;t&$n;)e[r++]=t&255|Xt,t>>>=7;return e[r]=t|0,Kt.bytes=r-n+1,e}var kn=ct,jn=128,Qt=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&Qt)<<o:(i&Qt)*Math.pow(2,o),o+=7}while(i>=jn);return ct.bytes=s-n,r}var qn=Math.pow(2,7),Gn=Math.pow(2,14),Wn=Math.pow(2,21),Jn=Math.pow(2,28),Hn=Math.pow(2,35),Xn=Math.pow(2,42),Qn=Math.pow(2,49),Kn=Math.pow(2,56),Yn=Math.pow(2,63),Zn=function(t){return t<qn?1:t<Gn?2:t<Wn?3:t<Jn?4:t<Hn?5:t<Xn?6:t<Qn?7:t<Kn?8:t<Yn?9:10},eo={encode:_n,decode:kn,encodingLength:Zn},to=eo,fe=to;var pe=(t,e=0)=>[fe.decode(t,e),fe.decode.bytes],te=(t,e,r=0)=>(fe.encode(t,e,r),e),re=t=>fe.encodingLength(t);var q=(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)},J=t=>{let e=_(t),[r,n]=pe(e),[o,s]=pe(e.subarray(n)),i=e.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new ne(r,o,i,e)},Yt=(t,e)=>{if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&jt(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?q(this.code,r):r.then(n=>q(this.code,n))}else throw Error("Unknown type, must be binary type")}};var er=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),De=lt({name:"sha2-256",code:18,encode:er("SHA-256")}),ro=lt({name:"sha2-512",code:19,encode:er("SHA-512")});var ft={};I(ft,{identity:()=>Ne});var tr=0,no="identity",rr=_,oo=t=>q(tr,rr(t)),Ne={code:tr,name:no,encode:rr,digest:oo};var Qs=new TextEncoder,Ks=new TextDecoder;var nr=(t,e)=>{let{bytes:r,version:n}=t;switch(n){case 0:return co(r,pt(t),e||v.encoder);default:return uo(r,pt(t),e||O.encoder)}};var or=new WeakMap,pt=t=>{let e=or.get(t);if(e==null){let r=new Map;return or.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!==he)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==lo)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=q(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&&Yt(e.multihash,n.multihash)}toString(e){return nr(this,e)}toJSON(){return{"/":nr(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||sr(n,o,s.bytes))}else if(r[fo]===!0){let{version:n,multihash:o,code:s}=r,i=J(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!==he)throw new Error(`Version 0 CID must use dag-pb (code: ${he}) block encoding`);return new h(e,r,n,n.bytes)}case 1:{let o=sr(e,r,n.bytes);return new h(e,r,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return h.create(0,he,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[l,p]=pe(e.subarray(r));return r+=p,l},o=n(),s=he;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(),w=n(),F=r+w,c=F-i;return{version:o,codec:s,multihashCode:d,digestSize:w,multihashSize:c,size:F}}static parse(e,r){let[n,o]=ao(e,r),s=h.decode(o);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return pt(s).set(n,e),s}},ao=(t,e)=>{switch(t[0]){case"Q":{let r=e||v;return[v.prefix,r.decode(`${v.prefix}${t}`)]}case v.prefix:{let r=e||v;return[v.prefix,r.decode(t)]}case O.prefix:{let r=e||O;return[O.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)]}}},co=(t,e,r)=>{let{prefix:n}=r;if(n!==v.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},uo=(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},he=112,lo=18,sr=(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},fo=Symbol.for("@ipld/js-cid/CID");var G={...Ke,...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 ar(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var ir=ar("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),ht=ar("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}),po={utf8:ir,"utf-8":ir,hex:G.base16,latin1:ht,ascii:ht,binary:ht,...G},ze=po;function T(t,e="utf8"){let r=ze[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 cr=$t,ho=Vt,mt=function(t){let e=0;if(t=t.toString().trim(),cr(t)){let r=new Uint8Array(e+4);return t.split(/\./g).forEach(n=>{r[e++]=parseInt(n,10)&255}),r}if(ho(t)){let r=t.split(":",8),n;for(n=0;n<r.length;n++){let s=cr(r[n]),i;s&&(i=mt(r[n]),r[n]=T(i.slice(0,2),"base16")),i!=null&&++n<8&&r.splice(n,0,T(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")},ur=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 me={},bt={},bo=[[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"]];bo.forEach(t=>{let e=go(...t);bt[e.code]=e,me[e.name]=e});function go(t,e,r,n,o){return{code:t,size:e,name:r,resolvable:!!n,path:!!o}}function b(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(me[t]!=null)return me[t];throw new Error(`no protocol with name: ${t}`)}throw new Error(`invalid protocol id type: ${typeof t}`)}var z=de(Le(),1);function yt(t,e="utf8"){let r=ze[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 R(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 Er(t,e){switch(b(t).code){case 4:case 41:return Mo(e);case 42:return vr(e);case 6:case 273:case 33:case 132:return Ar(e).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return vr(e);case 421:return zo(e);case 444:return Cr(e);case 445:return Cr(e);case 466:return Oo(e);default:return T(e,"base16")}}function Sr(t,e){switch(b(t).code){case 4:return yr(e);case 41:return yr(e);case 42:return xr(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 449:case 777:return xr(e);case 421:return Do(e);case 444:return Lo(e);case 445:return _o(e);case 466:return No(e);default:return yt(e,"base16")}}var xt=Object.values(G).map(t=>t.decoder),Bo=function(){let t=xt[0].or(xt[1]);return xt.slice(2).forEach(e=>t=t.or(e)),t}();function yr(t){if(!Be(t))throw new Error("invalid ip address");return mt(t)}function Mo(t){let e=ur(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 Ar(t){return new DataView(t.buffer).getUint16(t.byteOffset)}function xr(t){let e=yt(t),r=Uint8Array.from(z.default.encode(e.length));return R([r,e],r.length+e.length)}function vr(t){let e=z.default.decode(t);if(t=t.slice(z.default.decode.bytes),t.length!==e)throw new Error("inconsistent lengths");return T(t)}function Do(t){let e;t[0]==="Q"||t[0]==="1"?e=J(v.decode(`z${t}`)).bytes:e=h.parse(t).multihash.bytes;let r=Uint8Array.from(z.default.encode(e.length));return R([r,e],r.length+e.length)}function No(t){let e=Bo.decode(t),r=Uint8Array.from(z.default.encode(e.length));return R([r,e],r.length+e.length)}function Oo(t){let e=z.default.decode(t),r=t.slice(z.default.decode.bytes);if(r.length!==e)throw new Error("inconsistent lengths");return"u"+T(r,"base64url")}function zo(t){let e=z.default.decode(t),r=t.slice(z.default.decode.bytes);if(r.length!==e)throw new Error("inconsistent lengths");return T(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=O.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 R([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=O.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 R([r,o],r.length+o.length)}function Cr(t){let e=t.slice(0,t.length-2),r=t.slice(t.length-2),n=T(e,"base32"),o=Ar(r);return`${n}:${o}`}var se=de(Le(),1);function Ro(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=b(o);if(s.size===0){e.push([o]);continue}if(n++,n>=r.length)throw Fr("invalid address: "+t);if(s.path===!0){e.push([o,Tt(r.slice(n).join("/"))]);break}e.push([o,r[n]])}return e}function $o(t){let e=[];return t.map(r=>{let n=$e(r);return e.push(n.name),r.length>1&&r[1]!=null&&e.push(r[1]),null}),Tt(e.join("/"))}function Vo(t){return t.map(e=>{Array.isArray(e)||(e=[e]);let r=$e(e);return e.length>1?[r.code,Sr(r.code,e[1])]:[r.code]})}function Ct(t){return t.map(e=>{let r=$e(e);return e[1]!=null?[r.code,Er(r.code,e[1])]:[r.code]})}function Et(t){return Re(R(t.map(e=>{let r=$e(e),n=Uint8Array.from(se.default.encode(r.code));return e.length>1&&e[1]!=null&&(n=R([n,e[1]])),n})))}function St(t,e){return t.size>0?t.size/8:t.size===0?0:se.default.decode(e)+(se.default.decode.bytes??0)}function _e(t){let e=[],r=0;for(;r<t.length;){let n=se.default.decode(t,r),o=se.default.decode.bytes??0,s=b(n),i=St(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 Fr("Invalid address Uint8Array: "+T(t,"base16"));e.push([n,d])}return e}function At(t){let e=_e(t),r=Ct(e);return $o(r)}function ko(t){t=Tt(t);let e=Ro(t),r=Vo(e);return Et(r)}function Tr(t){return ko(t)}function Re(t){let e=jo(t);if(e!=null)throw e;return Uint8Array.from(t)}function jo(t){try{_e(t)}catch(e){return e}}function Tt(t){return"/"+t.trim().split("/").filter(e=>e).join("/")}function Fr(t){return new Error("Error parsing address: "+t)}function $e(t){return b(t[0])}var Pt=de(Le(),1);var Mr=de(Ur(),1);function be(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)},Ft=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},ge,we,ye,Br,Wo=Symbol.for("nodejs.util.inspect.custom"),Jo=[b("dns").code,b("dns4").code,b("dns6").code,b("dnsaddr").code],Ho=new Map,Dr=Symbol.for("@multiformats/js-multiaddr/multiaddr");function Xo(t){return!!t?.[Dr]}var $=class{constructor(e){if(ge.set(this,void 0),we.set(this,void 0),ye.set(this,void 0),this[Br]=!0,e==null&&(e=""),e instanceof Uint8Array)this.bytes=Re(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);this.bytes=Tr(e)}else if(Xo(e))this.bytes=Re(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return ie(this,ge,"f")==null&&Ft(this,ge,At(this.bytes),"f"),ie(this,ge,"f")}toJSON(){return this.toString()}toOptions(){let e,r,n,o,s="",i=b("tcp"),d=b("udp"),w=b("ip4"),F=b("ip6"),c=b("dns6"),l=b("ip6zone");for(let[C,f]of this.stringTuples())C===l.code&&(s=`%${f??""}`),Jo.includes(C)&&(r=i.name,o=443,n=`${f??""}${s}`,e=C===c.code?6:4),(C===i.code||C===d.code)&&(r=b(C).name,o=parseInt(f??"")),(C===w.code||C===F.code)&&(r=b(C).name,n=`${f??""}${s}`,e=C===F.code?6:4);if(e==null||r==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:r,port:o}}protos(){return this.protoCodes().map(e=>Object.assign({},b(e)))}protoCodes(){let e=[],r=this.bytes,n=0;for(;n<r.length;){let o=Pt.default.decode(r,n),s=Pt.default.decode.bytes??0,i=b(o),d=St(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,we,"f")==null&&Ft(this,we,_e(this.bytes),"f"),ie(this,we,"f")}stringTuples(){return ie(this,ye,"f")==null&&Ft(this,ye,Ct(this.tuples()),"f"),ie(this,ye,"f")}encapsulate(e){return e=new $(e),new $(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 $(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 $(Et(r.slice(0,n)));return this}getPeerId(){try{let r=this.stringTuples().filter(n=>n[0]===me.ipfs.code).pop();if(r?.[1]!=null){let n=r[1];return n[0]==="Q"||n[0]==="1"?T(v.decode(`z${n}`),"base58btc"):T(h.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){let e=null;try{e=this.stringTuples().filter(r=>b(r[0]).path===!0)[0][1],e==null&&(e=null)}catch{e=null}return e}equals(e){return be(this.bytes,e.bytes)}async resolve(e){let r=this.protos().find(s=>s.resolvable);if(r==null)return[this];let n=Ho.get(r.name);if(n==null)throw(0,Mr.default)(new Error(`no available resolver for ${r.name}`),"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,e)).map(s=>new $(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)}[(ge=new WeakMap,we=new WeakMap,ye=new WeakMap,Br=Dr,Wo)](){return`Multiaddr(${At(this.bytes)})`}};function xe(t){return new $(t)}var Qo=a("dns4"),Ko=a("dns6"),Yo=a("dnsaddr"),X=S(a("dns"),Yo,Qo,Ko),Ve=S(a("ip4"),a("ip6")),ae=S(u(Ve,a("tcp")),u(X,a("tcp"))),Bt=u(Ve,a("udp")),Zo=u(Bt,a("utp")),es=u(Bt,a("quic")),Ce=S(u(ae,a("ws")),u(X,a("ws"))),Ee=S(u(ae,a("wss")),u(X,a("wss")),u(ae,a("tls"),a("ws")),u(X,a("tls"),a("ws"))),It=S(u(ae,a("http")),u(Ve,a("http")),u(X,a("http"))),Ut=S(u(ae,a("https")),u(Ve,a("https")),u(X,a("https"))),Nr=u(Bt,a("webrtc"),a("certhash")),zr=S(u(Nr,a("p2p")),Nr),Lr=S(u(Ce,a("p2p-webrtc-star"),a("p2p")),u(Ee,a("p2p-webrtc-star"),a("p2p")),u(Ce,a("p2p-webrtc-star")),u(Ee,a("p2p-webrtc-star"))),Zi=S(u(Ce,a("p2p-websocket-star"),a("p2p")),u(Ee,a("p2p-websocket-star"),a("p2p")),u(Ce,a("p2p-websocket-star")),u(Ee,a("p2p-websocket-star"))),_r=S(u(It,a("p2p-webrtc-direct"),a("p2p")),u(Ut,a("p2p-webrtc-direct"),a("p2p")),u(It,a("p2p-webrtc-direct")),u(Ut,a("p2p-webrtc-direct"))),Se=S(Ce,Ee,It,Ut,Lr,_r,ae,Zo,es,X,zr),ea=S(u(Se,a("p2p-stardust"),a("p2p")),u(Se,a("p2p-stardust"))),W=S(u(Se,a("p2p")),Lr,_r,zr,a("p2p")),Or=S(u(W,a("p2p-circuit"),W),u(W,a("p2p-circuit")),u(a("p2p-circuit"),W),u(Se,a("p2p-circuit")),u(a("p2p-circuit"),Se),a("p2p-circuit")),Rr=()=>S(u(Or,Rr),Or),ve=Rr(),$r=S(u(ve,W,ve),u(W,ve),u(ve,W),ve,W);function Vr(t){function e(r){let n;try{n=xe(r)}catch{return!1}let o=t(n.protoNames());return o===null?!1:o===!0||o===!1?o:o.length===0}return e}function u(...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:Vr(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:Vr(e),partialMatch:e}}function a(t){let e=t;function r(o){let s;try{s=xe(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 Q=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)},V,ke=class extends EventTarget{constructor(){super(...arguments),V.set(this,new Map)}listenerCount(e){let r=Q(this,V,"f").get(e);return r==null?0:r.length}addEventListener(e,r,n){super.addEventListener(e,r,n);let o=Q(this,V,"f").get(e);o==null&&(o=[],Q(this,V,"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=Q(this,V,"f").get(e);o!=null&&(o=o.filter(({callback:s})=>s!==r),Q(this,V,"f").set(e,o))}dispatchEvent(e){let r=super.dispatchEvent(e),n=Q(this,V,"f").get(e.type);return n==null||(n=n.filter(({once:o})=>!o),Q(this,V,"f").set(e.type,n)),r}safeDispatchEvent(e,r){return this.dispatchEvent(new Dt(e,r))}};V=new WeakMap;var Mt=class extends Event{constructor(e,r){super(e,r),this.detail=r?.detail}},Dt=globalThis.CustomEvent??Mt;var L=de(Wr(),1);L.default.formatters.b=t=>t==null?"undefined":v.baseEncode(t);L.default.formatters.t=t=>t==null?"undefined":O.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 Jr(t){return Object.assign((0,L.default)(t),{error:(0,L.default)(`${t}:error`),trace:(0,L.default)(`${t}:trace`)})}var Hr=Symbol.for("@libp2p/peer-id");var ps=Symbol.for("nodejs.util.inspect.custom"),Xr=Object.values(G).map(t=>t.decoder).reduce((t,e)=>t.or(e),G.identity.decoder),Qr=114,Kr=36,Yr=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[Hr](){return!0}toString(){return this.string==null&&(this.string=v.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return h.createV1(Qr,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e instanceof Uint8Array)return be(this.multihash.bytes,e);if(typeof e=="string")return Nt(e).equals(this);if(e?.multihash?.bytes!=null)return be(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 Nt(t,e){if(e=e??Xr,t.charAt(0)==="1"||t.charAt(0)==="Q"){let r=J(v.decode(`z${t}`));return t.startsWith("12D")?new Fe({multihash:r}):t.startsWith("16U")?new Pe({multihash:r}):new Te({multihash:r})}return hs(Xr.decode(t))}function hs(t){try{let e=J(t);if(e.code===Ne.code){if(e.digest.length===Kr)return new Fe({multihash:e});if(e.digest.length===Yr)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!==Qr)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===Kr)return new Fe({multihash:t.multihash});if(e.digest.length===Yr)return new Pe({multihash:t.multihash})}throw new Error("Supplied PeerID CID is invalid")}var Zr=Symbol.for("@libp2p/peer-discovery");var Ge=Jr("libp2p:bootstrap"),bs="bootstrap",gs=50,ws=12e4,ys=1e3,We=class extends ke{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(!$r.matches(n)){Ge.error("Invalid multiaddr");continue}let o=xe(n),s=o.getPeerId();if(s==null){Ge.error("Invalid bootstrap multiaddr without peer id");continue}let i={id:Nt(s),multiaddrs:[o],protocols:[]};this.list.push(i)}this._init=r}get[Zr](){return!0}get[Symbol.toStringTag](){return"@libp2p/bootstrap"}isStarted(){return!!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 Dt("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 sn(vs);})();
"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);})();
return Libp2PBootstrap}));
{
"name": "@libp2p/bootstrap",
"version": "6.0.1",
"version": "6.0.2",
"description": "Node.js IPFS Implementation of the railing process of a Node through a bootstrap peer list",

@@ -149,3 +149,3 @@ "license": "Apache-2.0 OR MIT",

"@multiformats/mafmt": "^11.0.3",
"@multiformats/multiaddr": "^11.0.0"
"@multiformats/multiaddr": "^12.0.0"
},

@@ -152,0 +152,0 @@ "devDependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc