@libp2p/tcp 7.0.3-7debe031 → 7.0.3-7f60b579

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.min.js CHANGED
@@ -1,7 +1,7 @@
1
1
  (function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PTcp = factory()}(typeof self !== 'undefined' ? self : this, function () {
2
- "use strict";var Libp2PTcp=(()=>{var Za=Object.create;var we=Object.defineProperty;var Ja=Object.getOwnPropertyDescriptor;var Xa=Object.getOwnPropertyNames;var Wa=Object.getPrototypeOf,Qa=Object.prototype.hasOwnProperty;var Ya=(r,t,e)=>t in r?we(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var wt=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+r+'" is not supported')});var H=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),U=(r,t)=>{for(var e in t)we(r,e,{get:t[e],enumerable:!0})},ns=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Xa(t))!Qa.call(r,s)&&s!==e&&we(r,s,{get:()=>t[s],enumerable:!(n=Ja(t,s))||n.enumerable});return r};var X=(r,t,e)=>(e=r!=null?Za(Wa(r)):{},ns(t||!r||!r.__esModule?we(e,"default",{value:r,enumerable:!0}):e,r)),Ka=r=>ns(we({},"__esModule",{value:!0}),r);var De=(r,t,e)=>(Ya(r,typeof t!="symbol"?t+"":t,e),e);var as=H((fl,is)=>{var Xt=1e3,Wt=Xt*60,Qt=Wt*60,$t=Qt*24,tc=$t*7,ec=$t*365.25;is.exports=function(r,t){t=t||{};var e=typeof r;if(e==="string"&&r.length>0)return rc(r);if(e==="number"&&isFinite(r))return t.long?sc(r):nc(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function rc(r){if(r=String(r),!(r.length>100)){var t=/^(-?(?:\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(t){var e=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return e*ec;case"weeks":case"week":case"w":return e*tc;case"days":case"day":case"d":return e*$t;case"hours":case"hour":case"hrs":case"hr":case"h":return e*Qt;case"minutes":case"minute":case"mins":case"min":case"m":return e*Wt;case"seconds":case"second":case"secs":case"sec":case"s":return e*Xt;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return e;default:return}}}}function nc(r){var t=Math.abs(r);return t>=$t?Math.round(r/$t)+"d":t>=Qt?Math.round(r/Qt)+"h":t>=Wt?Math.round(r/Wt)+"m":t>=Xt?Math.round(r/Xt)+"s":r+"ms"}function sc(r){var t=Math.abs(r);return t>=$t?Pe(r,t,$t,"day"):t>=Qt?Pe(r,t,Qt,"hour"):t>=Wt?Pe(r,t,Wt,"minute"):t>=Xt?Pe(r,t,Xt,"second"):r+" ms"}function Pe(r,t,e,n){var s=t>=e*1.5;return Math.round(r/e)+" "+n+(s?"s":"")}});var mr=H((ul,cs)=>{function oc(r){e.debug=e,e.default=e,e.coerce=m,e.disable=c,e.enable=s,e.enabled=u,e.humanize=as(),e.destroy=I,Object.keys(r).forEach(p=>{e[p]=r[p]}),e.names=[],e.skips=[],e.formatters={};function t(p){let g=0;for(let w=0;w<p.length;w++)g=(g<<5)-g+p.charCodeAt(w),g|=0;return e.colors[Math.abs(g)%e.colors.length]}e.selectColor=t;function e(p){let g,w=null,E,l;function x(...R){if(!x.enabled)return;let T=x,A=Number(new Date),M=A-(g||A);T.diff=M,T.prev=g,T.curr=A,g=A,R[0]=e.coerce(R[0]),typeof R[0]!="string"&&R.unshift("%O");let B=0;R[0]=R[0].replace(/%([a-zA-Z%])/g,(O,D)=>{if(O==="%%")return"%";B++;let P=e.formatters[D];if(typeof P=="function"){let j=R[B];O=P.call(T,j),R.splice(B,1),B--}return O}),e.formatArgs.call(T,R),(T.log||e.log).apply(T,R)}return x.namespace=p,x.useColors=e.useColors(),x.color=e.selectColor(p),x.extend=n,x.destroy=e.destroy,Object.defineProperty(x,"enabled",{enumerable:!0,configurable:!1,get:()=>w!==null?w:(E!==e.namespaces&&(E=e.namespaces,l=e.enabled(p)),l),set:R=>{w=R}}),typeof e.init=="function"&&e.init(x),x}function n(p,g){let w=e(this.namespace+(typeof g>"u"?":":g)+p);return w.log=this.log,w}function s(p){e.save(p),e.namespaces=p,e.names=[],e.skips=[];let g,w=(typeof p=="string"?p:"").split(/[\s,]+/),E=w.length;for(g=0;g<E;g++)w[g]&&(p=w[g].replace(/\*/g,".*?"),p[0]==="-"?e.skips.push(new RegExp("^"+p.slice(1)+"$")):e.names.push(new RegExp("^"+p+"$")))}function c(){let p=[...e.names.map(h),...e.skips.map(h).map(g=>"-"+g)].join(",");return e.enable(""),p}function u(p){if(p[p.length-1]==="*")return!0;let g,w;for(g=0,w=e.skips.length;g<w;g++)if(e.skips[g].test(p))return!1;for(g=0,w=e.names.length;g<w;g++)if(e.names[g].test(p))return!0;return!1}function h(p){return p.toString().substring(2,p.toString().length-2).replace(/\.\*\?$/,"*")}function m(p){return p instanceof Error?p.stack||p.message:p}function I(){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 e.enable(e.load()),e}cs.exports=oc});var fs=H((at,Oe)=>{at.formatArgs=ac;at.save=cc;at.load=fc;at.useColors=ic;at.storage=uc();at.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`."))}})();at.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 ic(){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 ac(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+Oe.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;r.splice(1,0,t,"color: inherit");let e=0,n=0;r[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(e++,s==="%c"&&(n=e))}),r.splice(n,0,t)}at.log=console.debug||console.log||(()=>{});function cc(r){try{r?at.storage.setItem("debug",r):at.storage.removeItem("debug")}catch{}}function fc(){let r;try{r=at.storage.getItem("debug")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function uc(){try{return localStorage}catch{}}Oe.exports=mr()(at);var{formatters:pc}=Oe.exports;pc.j=function(r){try{return JSON.stringify(r)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var ps=H((pl,us)=>{"use strict";us.exports=(r,t)=>{t=t||process.argv;let e=r.startsWith("-")?"":r.length===1?"-":"--",n=t.indexOf(e+r),s=t.indexOf("--");return n!==-1&&(s===-1?!0:n<s)}});var hs=H((ll,ls)=>{"use strict";var lc=wt("os"),gt=ps(),Q=process.env,Yt;gt("no-color")||gt("no-colors")||gt("color=false")?Yt=!1:(gt("color")||gt("colors")||gt("color=true")||gt("color=always"))&&(Yt=!0);"FORCE_COLOR"in Q&&(Yt=Q.FORCE_COLOR.length===0||parseInt(Q.FORCE_COLOR,10)!==0);function hc(r){return r===0?!1:{level:r,hasBasic:!0,has256:r>=2,has16m:r>=3}}function dc(r){if(Yt===!1)return 0;if(gt("color=16m")||gt("color=full")||gt("color=truecolor"))return 3;if(gt("color=256"))return 2;if(r&&!r.isTTY&&Yt!==!0)return 0;let t=Yt?1:0;if(process.platform==="win32"){let e=lc.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in Q)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(e=>e in Q)||Q.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in Q)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Q.TEAMCITY_VERSION)?1:0;if(Q.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in Q){let e=parseInt((Q.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Q.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Q.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Q.TERM)||"COLORTERM"in Q?1:(Q.TERM==="dumb",t)}function br(r){let t=dc(r);return hc(t)}ls.exports={supportsColor:br,stdout:br(process.stdout),stderr:br(process.stderr)}});var ms=H((W,Fe)=>{var mc=wt("tty"),Ne=wt("util");W.init=Sc;W.log=yc;W.formatArgs=gc;W.save=vc;W.load=xc;W.useColors=bc;W.destroy=Ne.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");W.colors=[6,2,3,4,5,1];try{let r=hs();r&&(r.stderr||r).level>=2&&(W.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}W.inspectOpts=Object.keys(process.env).filter(r=>/^debug_/i.test(r)).reduce((r,t)=>{let e=t.substring(6).toLowerCase().replace(/_([a-z])/g,(s,c)=>c.toUpperCase()),n=process.env[t];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),r[e]=n,r},{});function bc(){return"colors"in W.inspectOpts?!!W.inspectOpts.colors:mc.isatty(process.stderr.fd)}function gc(r){let{namespace:t,useColors:e}=this;if(e){let n=this.color,s="\x1B[3"+(n<8?n:"8;5;"+n),c=` ${s};1m${t} \x1B[0m`;r[0]=c+r[0].split(`
2
+ "use strict";var Libp2PTcp=(()=>{var Ba=Object.create;var Ie=Object.defineProperty;var Ma=Object.getOwnPropertyDescriptor;var Ra=Object.getOwnPropertyNames;var Da=Object.getPrototypeOf,Pa=Object.prototype.hasOwnProperty;var mt=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var z=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),O=(r,t)=>{for(var e in t)Ie(r,e,{get:t[e],enumerable:!0})},Hn=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ra(t))!Pa.call(r,o)&&o!==e&&Ie(r,o,{get:()=>t[o],enumerable:!(n=Ma(t,o))||n.enumerable});return r};var H=(r,t,e)=>(e=r!=null?Ba(Da(r)):{},Hn(t||!r||!r.__esModule?Ie(e,"default",{value:r,enumerable:!0}):e,r)),ka=r=>Hn(Ie({},"__esModule",{value:!0}),r);var Xn=z((Dp,Jn)=>{var Gt=1e3,Ht=Gt*60,Zt=Ht*60,Nt=Zt*24,Oa=Nt*7,Na=Nt*365.25;Jn.exports=function(r,t){t=t||{};var e=typeof r;if(e==="string"&&r.length>0)return Fa(r);if(e==="number"&&isFinite(r))return t.long?Ua(r):_a(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function Fa(r){if(r=String(r),!(r.length>100)){var t=/^(-?(?:\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(t){var e=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return e*Na;case"weeks":case"week":case"w":return e*Oa;case"days":case"day":case"d":return e*Nt;case"hours":case"hour":case"hrs":case"hr":case"h":return e*Zt;case"minutes":case"minute":case"mins":case"min":case"m":return e*Ht;case"seconds":case"second":case"secs":case"sec":case"s":return e*Gt;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return e;default:return}}}}function _a(r){var t=Math.abs(r);return t>=Nt?Math.round(r/Nt)+"d":t>=Zt?Math.round(r/Zt)+"h":t>=Ht?Math.round(r/Ht)+"m":t>=Gt?Math.round(r/Gt)+"s":r+"ms"}function Ua(r){var t=Math.abs(r);return t>=Nt?Be(r,t,Nt,"day"):t>=Zt?Be(r,t,Zt,"hour"):t>=Ht?Be(r,t,Ht,"minute"):t>=Gt?Be(r,t,Gt,"second"):r+" ms"}function Be(r,t,e,n){var o=t>=e*1.5;return Math.round(r/e)+" "+n+(o?"s":"")}});var ar=z((Pp,Qn)=>{function La(r){e.debug=e,e.default=e,e.coerce=g,e.disable=c,e.enable=o,e.enabled=f,e.humanize=Xn(),e.destroy=A,Object.keys(r).forEach(p=>{e[p]=r[p]}),e.names=[],e.skips=[],e.formatters={};function t(p){let b=0;for(let y=0;y<p.length;y++)b=(b<<5)-b+p.charCodeAt(y),b|=0;return e.colors[Math.abs(b)%e.colors.length]}e.selectColor=t;function e(p){let b,y=null,S,h;function T(...B){if(!T.enabled)return;let C=T,I=Number(new Date),M=I-(b||I);C.diff=M,C.prev=b,C.curr=I,b=I,B[0]=e.coerce(B[0]),typeof B[0]!="string"&&B.unshift("%O");let R=0;B[0]=B[0].replace(/%([a-zA-Z%])/g,(_,D)=>{if(_==="%%")return"%";R++;let F=e.formatters[D];if(typeof F=="function"){let G=B[R];_=F.call(C,G),B.splice(R,1),R--}return _}),e.formatArgs.call(C,B),(C.log||e.log).apply(C,B)}return T.namespace=p,T.useColors=e.useColors(),T.color=e.selectColor(p),T.extend=n,T.destroy=e.destroy,Object.defineProperty(T,"enabled",{enumerable:!0,configurable:!1,get:()=>y!==null?y:(S!==e.namespaces&&(S=e.namespaces,h=e.enabled(p)),h),set:B=>{y=B}}),typeof e.init=="function"&&e.init(T),T}function n(p,b){let y=e(this.namespace+(typeof b>"u"?":":b)+p);return y.log=this.log,y}function o(p){e.save(p),e.namespaces=p,e.names=[],e.skips=[];let b,y=(typeof p=="string"?p:"").split(/[\s,]+/),S=y.length;for(b=0;b<S;b++)y[b]&&(p=y[b].replace(/\*/g,".*?"),p[0]==="-"?e.skips.push(new RegExp("^"+p.slice(1)+"$")):e.names.push(new RegExp("^"+p+"$")))}function c(){let p=[...e.names.map(l),...e.skips.map(l).map(b=>"-"+b)].join(",");return e.enable(""),p}function f(p){if(p[p.length-1]==="*")return!0;let b,y;for(b=0,y=e.skips.length;b<y;b++)if(e.skips[b].test(p))return!1;for(b=0,y=e.names.length;b<y;b++)if(e.names[b].test(p))return!0;return!1}function l(p){return p.toString().substring(2,p.toString().length-2).replace(/\.\*\?$/,"*")}function g(p){return p instanceof Error?p.stack||p.message:p}function A(){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 e.enable(e.load()),e}Qn.exports=La});var Yn=z((rt,Me)=>{rt.formatArgs=za;rt.save=Va;rt.load=ja;rt.useColors=$a;rt.storage=qa();rt.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`."))}})();rt.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 $a(){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 za(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+Me.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;r.splice(1,0,t,"color: inherit");let e=0,n=0;r[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(e++,o==="%c"&&(n=e))}),r.splice(n,0,t)}rt.log=console.debug||console.log||(()=>{});function Va(r){try{r?rt.storage.setItem("debug",r):rt.storage.removeItem("debug")}catch{}}function ja(){let r;try{r=rt.storage.getItem("debug")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function qa(){try{return localStorage}catch{}}Me.exports=ar()(rt);var{formatters:Ga}=Me.exports;Ga.j=function(r){try{return JSON.stringify(r)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var ts=z((kp,Kn)=>{"use strict";Kn.exports=(r,t)=>{t=t||process.argv;let e=r.startsWith("-")?"":r.length===1?"-":"--",n=t.indexOf(e+r),o=t.indexOf("--");return n!==-1&&(o===-1?!0:n<o)}});var rs=z((Op,es)=>{"use strict";var Ha=mt("os"),ht=ts(),Z=process.env,Wt;ht("no-color")||ht("no-colors")||ht("color=false")?Wt=!1:(ht("color")||ht("colors")||ht("color=true")||ht("color=always"))&&(Wt=!0);"FORCE_COLOR"in Z&&(Wt=Z.FORCE_COLOR.length===0||parseInt(Z.FORCE_COLOR,10)!==0);function Za(r){return r===0?!1:{level:r,hasBasic:!0,has256:r>=2,has16m:r>=3}}function Wa(r){if(Wt===!1)return 0;if(ht("color=16m")||ht("color=full")||ht("color=truecolor"))return 3;if(ht("color=256"))return 2;if(r&&!r.isTTY&&Wt!==!0)return 0;let t=Wt?1:0;if(process.platform==="win32"){let e=Ha.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in Z)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(e=>e in Z)||Z.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in Z)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Z.TEAMCITY_VERSION)?1:0;if(Z.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in Z){let e=parseInt((Z.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Z.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Z.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Z.TERM)||"COLORTERM"in Z?1:(Z.TERM==="dumb",t)}function cr(r){let t=Wa(r);return Za(t)}es.exports={supportsColor:cr,stdout:cr(process.stdout),stderr:cr(process.stderr)}});var ss=z((q,De)=>{var Ja=mt("tty"),Re=mt("util");q.init=rc;q.log=Ka;q.formatArgs=Qa;q.save=tc;q.load=ec;q.useColors=Xa;q.destroy=Re.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");q.colors=[6,2,3,4,5,1];try{let r=rs();r&&(r.stderr||r).level>=2&&(q.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}q.inspectOpts=Object.keys(process.env).filter(r=>/^debug_/i.test(r)).reduce((r,t)=>{let e=t.substring(6).toLowerCase().replace(/_([a-z])/g,(o,c)=>c.toUpperCase()),n=process.env[t];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),r[e]=n,r},{});function Xa(){return"colors"in q.inspectOpts?!!q.inspectOpts.colors:Ja.isatty(process.stderr.fd)}function Qa(r){let{namespace:t,useColors:e}=this;if(e){let n=this.color,o="\x1B[3"+(n<8?n:"8;5;"+n),c=` ${o};1m${t} \x1B[0m`;r[0]=c+r[0].split(`
3
3
  `).join(`
4
- `+c),r.push(s+"m+"+Fe.exports.humanize(this.diff)+"\x1B[0m")}else r[0]=wc()+t+" "+r[0]}function wc(){return W.inspectOpts.hideDate?"":new Date().toISOString()+" "}function yc(...r){return process.stderr.write(Ne.format(...r)+`
5
- `)}function vc(r){r?process.env.DEBUG=r:delete process.env.DEBUG}function xc(){return process.env.DEBUG}function Sc(r){r.inspectOpts={};let t=Object.keys(W.inspectOpts);for(let e=0;e<t.length;e++)r.inspectOpts[t[e]]=W.inspectOpts[t[e]]}Fe.exports=mr()(W);var{formatters:ds}=Fe.exports;ds.o=function(r){return this.inspectOpts.colors=this.useColors,Ne.inspect(r,this.inspectOpts).split(`
6
- `).map(t=>t.trim()).join(" ")};ds.O=function(r){return this.inspectOpts.colors=this.useColors,Ne.inspect(r,this.inspectOpts)}});var bs=H((hl,gr)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?gr.exports=fs():gr.exports=ms()});var io=H((Wh,oo)=>{oo.exports=tn;var so=128,xu=127,Su=~xu,Tu=Math.pow(2,31);function tn(r,t,e){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw tn.bytes=0,new RangeError("Could not encode varint");t=t||[],e=e||0;for(var n=e;r>=Tu;)t[e++]=r&255|so,r/=128;for(;r&Su;)t[e++]=r&255|so,r>>>=7;return t[e]=r|0,tn.bytes=e-n+1,t}});var fo=H((Qh,co)=>{co.exports=en;var Eu=128,ao=127;function en(r,n){var e=0,n=n||0,s=0,c=n,u,h=r.length;do{if(c>=h||s>49)throw en.bytes=0,new RangeError("Could not decode varint");u=r[c++],e+=s<28?(u&ao)<<s:(u&ao)*Math.pow(2,s),s+=7}while(u>=Eu);return en.bytes=c-n,e}});var po=H((Yh,uo)=>{var Au=Math.pow(2,7),Cu=Math.pow(2,14),Iu=Math.pow(2,21),Bu=Math.pow(2,28),Ru=Math.pow(2,35),Mu=Math.pow(2,42),Du=Math.pow(2,49),ku=Math.pow(2,56),Pu=Math.pow(2,63);uo.exports=function(r){return r<Au?1:r<Cu?2:r<Iu?3:r<Bu?4:r<Ru?5:r<Mu?6:r<Du?7:r<ku?8:r<Pu?9:10}});var je=H((Kh,lo)=>{lo.exports={encode:io(),decode:fo(),encodingLength:po()}});var Pn=H((rr,qo)=>{(function(){var r,t=0xdeadbeefcafe,e=(t&16777215)==15715070;function n(o,i,a){o!=null&&(typeof o=="number"?this.fromNumber(o,i,a):i==null&&typeof o!="string"?this.fromString(o,256):this.fromString(o,i))}function s(){return new n(null)}function c(o,i,a,f,d,b){for(;--b>=0;){var y=i*this[o++]+a[f]+d;d=Math.floor(y/67108864),a[f++]=y&67108863}return d}function u(o,i,a,f,d,b){for(var y=i&32767,S=i>>15;--b>=0;){var F=this[o]&32767,J=this[o++]>>15,ut=S*F+J*y;F=y*F+((ut&32767)<<15)+a[f]+(d&1073741823),d=(F>>>30)+(ut>>>15)+S*J+(d>>>30),a[f++]=F&1073741823}return d}function h(o,i,a,f,d,b){for(var y=i&16383,S=i>>14;--b>=0;){var F=this[o]&16383,J=this[o++]>>14,ut=S*F+J*y;F=y*F+((ut&16383)<<14)+a[f]+d,d=(F>>28)+(ut>>14)+S*J,a[f++]=F&268435455}return d}var m=typeof navigator<"u";m&&e&&navigator.appName=="Microsoft Internet Explorer"?(n.prototype.am=u,r=30):m&&e&&navigator.appName!="Netscape"?(n.prototype.am=c,r=26):(n.prototype.am=h,r=28),n.prototype.DB=r,n.prototype.DM=(1<<r)-1,n.prototype.DV=1<<r;var I=52;n.prototype.FV=Math.pow(2,I),n.prototype.F1=I-r,n.prototype.F2=2*r-I;var p="0123456789abcdefghijklmnopqrstuvwxyz",g=new Array,w,E;for(w="0".charCodeAt(0),E=0;E<=9;++E)g[w++]=E;for(w="a".charCodeAt(0),E=10;E<36;++E)g[w++]=E;for(w="A".charCodeAt(0),E=10;E<36;++E)g[w++]=E;function l(o){return p.charAt(o)}function x(o,i){var a=g[o.charCodeAt(i)];return a??-1}function R(o){for(var i=this.t-1;i>=0;--i)o[i]=this[i];o.t=this.t,o.s=this.s}function T(o){this.t=1,this.s=o<0?-1:0,o>0?this[0]=o:o<-1?this[0]=o+this.DV:this.t=0}function A(o){var i=s();return i.fromInt(o),i}function M(o,i){var a;if(i==16)a=4;else if(i==8)a=3;else if(i==256)a=8;else if(i==2)a=1;else if(i==32)a=5;else if(i==4)a=2;else{this.fromRadix(o,i);return}this.t=0,this.s=0;for(var f=o.length,d=!1,b=0;--f>=0;){var y=a==8?o[f]&255:x(o,f);if(y<0){o.charAt(f)=="-"&&(d=!0);continue}d=!1,b==0?this[this.t++]=y:b+a>this.DB?(this[this.t-1]|=(y&(1<<this.DB-b)-1)<<b,this[this.t++]=y>>this.DB-b):this[this.t-1]|=y<<b,b+=a,b>=this.DB&&(b-=this.DB)}a==8&&o[0]&128&&(this.s=-1,b>0&&(this[this.t-1]|=(1<<this.DB-b)-1<<b)),this.clamp(),d&&n.ZERO.subTo(this,this)}function B(){for(var o=this.s&this.DM;this.t>0&&this[this.t-1]==o;)--this.t}function k(o){if(this.s<0)return"-"+this.negate().toString(o);var i;if(o==16)i=4;else if(o==8)i=3;else if(o==2)i=1;else if(o==32)i=5;else if(o==4)i=2;else return this.toRadix(o);var a=(1<<i)-1,f,d=!1,b="",y=this.t,S=this.DB-y*this.DB%i;if(y-- >0)for(S<this.DB&&(f=this[y]>>S)>0&&(d=!0,b=l(f));y>=0;)S<i?(f=(this[y]&(1<<S)-1)<<i-S,f|=this[--y]>>(S+=this.DB-i)):(f=this[y]>>(S-=i)&a,S<=0&&(S+=this.DB,--y)),f>0&&(d=!0),d&&(b+=l(f));return d?b:"0"}function O(){var o=s();return n.ZERO.subTo(this,o),o}function D(){return this.s<0?this.negate():this}function P(o){var i=this.s-o.s;if(i!=0)return i;var a=this.t;if(i=a-o.t,i!=0)return this.s<0?-i:i;for(;--a>=0;)if((i=this[a]-o[a])!=0)return i;return 0}function j(o){var i=1,a;return(a=o>>>16)!=0&&(o=a,i+=16),(a=o>>8)!=0&&(o=a,i+=8),(a=o>>4)!=0&&(o=a,i+=4),(a=o>>2)!=0&&(o=a,i+=2),(a=o>>1)!=0&&(o=a,i+=1),i}function hi(){return this.t<=0?0:this.DB*(this.t-1)+j(this[this.t-1]^this.s&this.DM)}function di(o,i){var a;for(a=this.t-1;a>=0;--a)i[a+o]=this[a];for(a=o-1;a>=0;--a)i[a]=0;i.t=this.t+o,i.s=this.s}function mi(o,i){for(var a=o;a<this.t;++a)i[a-o]=this[a];i.t=Math.max(this.t-o,0),i.s=this.s}function bi(o,i){var a=o%this.DB,f=this.DB-a,d=(1<<f)-1,b=Math.floor(o/this.DB),y=this.s<<a&this.DM,S;for(S=this.t-1;S>=0;--S)i[S+b+1]=this[S]>>f|y,y=(this[S]&d)<<a;for(S=b-1;S>=0;--S)i[S]=0;i[b]=y,i.t=this.t+b+1,i.s=this.s,i.clamp()}function gi(o,i){i.s=this.s;var a=Math.floor(o/this.DB);if(a>=this.t){i.t=0;return}var f=o%this.DB,d=this.DB-f,b=(1<<f)-1;i[0]=this[a]>>f;for(var y=a+1;y<this.t;++y)i[y-a-1]|=(this[y]&b)<<d,i[y-a]=this[y]>>f;f>0&&(i[this.t-a-1]|=(this.s&b)<<d),i.t=this.t-a,i.clamp()}function wi(o,i){for(var a=0,f=0,d=Math.min(o.t,this.t);a<d;)f+=this[a]-o[a],i[a++]=f&this.DM,f>>=this.DB;if(o.t<this.t){for(f-=o.s;a<this.t;)f+=this[a],i[a++]=f&this.DM,f>>=this.DB;f+=this.s}else{for(f+=this.s;a<o.t;)f-=o[a],i[a++]=f&this.DM,f>>=this.DB;f-=o.s}i.s=f<0?-1:0,f<-1?i[a++]=this.DV+f:f>0&&(i[a++]=f),i.t=a,i.clamp()}function yi(o,i){var a=this.abs(),f=o.abs(),d=a.t;for(i.t=d+f.t;--d>=0;)i[d]=0;for(d=0;d<f.t;++d)i[d+a.t]=a.am(0,f[d],i,d,0,a.t);i.s=0,i.clamp(),this.s!=o.s&&n.ZERO.subTo(i,i)}function vi(o){for(var i=this.abs(),a=o.t=2*i.t;--a>=0;)o[a]=0;for(a=0;a<i.t-1;++a){var f=i.am(a,i[a],o,2*a,0,1);(o[a+i.t]+=i.am(a+1,2*i[a],o,2*a+1,f,i.t-a-1))>=i.DV&&(o[a+i.t]-=i.DV,o[a+i.t+1]=1)}o.t>0&&(o[o.t-1]+=i.am(a,i[a],o,2*a,0,1)),o.s=0,o.clamp()}function xi(o,i,a){var f=o.abs();if(!(f.t<=0)){var d=this.abs();if(d.t<f.t){i?.fromInt(0),a!=null&&this.copyTo(a);return}a==null&&(a=s());var b=s(),y=this.s,S=o.s,F=this.DB-j(f[f.t-1]);F>0?(f.lShiftTo(F,b),d.lShiftTo(F,a)):(f.copyTo(b),d.copyTo(a));var J=b.t,ut=b[J-1];if(ut!=0){var it=ut*(1<<this.F1)+(J>1?b[J-2]>>this.F2:0),Tt=this.FV/it,Re=(1<<this.F1)/it,dt=1<<this.F2,mt=a.t,Me=mt-J,Rt=i??s();for(b.dlShiftTo(Me,Rt),a.compareTo(Rt)>=0&&(a[a.t++]=1,a.subTo(Rt,a)),n.ONE.dlShiftTo(J,Rt),Rt.subTo(b,b);b.t<J;)b[b.t++]=0;for(;--Me>=0;){var dr=a[--mt]==ut?this.DM:Math.floor(a[mt]*Tt+(a[mt-1]+dt)*Re);if((a[mt]+=b.am(0,dr,a,Me,0,J))<dr)for(b.dlShiftTo(Me,Rt),a.subTo(Rt,a);a[mt]<--dr;)a.subTo(Rt,a)}i!=null&&(a.drShiftTo(J,i),y!=S&&n.ZERO.subTo(i,i)),a.t=J,a.clamp(),F>0&&a.rShiftTo(F,a),y<0&&n.ZERO.subTo(a,a)}}}function Si(o){var i=s();return this.abs().divRemTo(o,null,i),this.s<0&&i.compareTo(n.ZERO)>0&&o.subTo(i,i),i}function Ut(o){this.m=o}function Ti(o){return o.s<0||o.compareTo(this.m)>=0?o.mod(this.m):o}function Ei(o){return o}function Ai(o){o.divRemTo(this.m,null,o)}function Ci(o,i,a){o.multiplyTo(i,a),this.reduce(a)}function Ii(o,i){o.squareTo(i),this.reduce(i)}Ut.prototype.convert=Ti,Ut.prototype.revert=Ei,Ut.prototype.reduce=Ai,Ut.prototype.mulTo=Ci,Ut.prototype.sqrTo=Ii;function Bi(){if(this.t<1)return 0;var o=this[0];if(!(o&1))return 0;var i=o&3;return i=i*(2-(o&15)*i)&15,i=i*(2-(o&255)*i)&255,i=i*(2-((o&65535)*i&65535))&65535,i=i*(2-o*i%this.DV)%this.DV,i>0?this.DV-i:-i}function _t(o){this.m=o,this.mp=o.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<o.DB-15)-1,this.mt2=2*o.t}function Ri(o){var i=s();return o.abs().dlShiftTo(this.m.t,i),i.divRemTo(this.m,null,i),o.s<0&&i.compareTo(n.ZERO)>0&&this.m.subTo(i,i),i}function Mi(o){var i=s();return o.copyTo(i),this.reduce(i),i}function Di(o){for(;o.t<=this.mt2;)o[o.t++]=0;for(var i=0;i<this.m.t;++i){var a=o[i]&32767,f=a*this.mpl+((a*this.mph+(o[i]>>15)*this.mpl&this.um)<<15)&o.DM;for(a=i+this.m.t,o[a]+=this.m.am(0,f,o,i,0,this.m.t);o[a]>=o.DV;)o[a]-=o.DV,o[++a]++}o.clamp(),o.drShiftTo(this.m.t,o),o.compareTo(this.m)>=0&&o.subTo(this.m,o)}function ki(o,i){o.squareTo(i),this.reduce(i)}function Pi(o,i,a){o.multiplyTo(i,a),this.reduce(a)}_t.prototype.convert=Ri,_t.prototype.revert=Mi,_t.prototype.reduce=Di,_t.prototype.mulTo=Pi,_t.prototype.sqrTo=ki;function Oi(){return(this.t>0?this[0]&1:this.s)==0}function Ni(o,i){if(o>4294967295||o<1)return n.ONE;var a=s(),f=s(),d=i.convert(this),b=j(o)-1;for(d.copyTo(a);--b>=0;)if(i.sqrTo(a,f),(o&1<<b)>0)i.mulTo(f,d,a);else{var y=a;a=f,f=y}return i.revert(a)}function Fi(o,i){var a;return o<256||i.isEven()?a=new Ut(i):a=new _t(i),this.exp(o,a)}n.prototype.copyTo=R,n.prototype.fromInt=T,n.prototype.fromString=M,n.prototype.clamp=B,n.prototype.dlShiftTo=di,n.prototype.drShiftTo=mi,n.prototype.lShiftTo=bi,n.prototype.rShiftTo=gi,n.prototype.subTo=wi,n.prototype.multiplyTo=yi,n.prototype.squareTo=vi,n.prototype.divRemTo=xi,n.prototype.invDigit=Bi,n.prototype.isEven=Oi,n.prototype.exp=Ni,n.prototype.toString=k,n.prototype.negate=O,n.prototype.abs=D,n.prototype.compareTo=P,n.prototype.bitLength=hi,n.prototype.mod=Si,n.prototype.modPowInt=Fi,n.ZERO=A(0),n.ONE=A(1);function Ui(){var o=s();return this.copyTo(o),o}function _i(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function Li(){return this.t==0?this.s:this[0]<<24>>24}function $i(){return this.t==0?this.s:this[0]<<16>>16}function zi(o){return Math.floor(Math.LN2*this.DB/Math.log(o))}function Vi(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function ji(o){if(o==null&&(o=10),this.signum()==0||o<2||o>36)return"0";var i=this.chunkSize(o),a=Math.pow(o,i),f=A(a),d=s(),b=s(),y="";for(this.divRemTo(f,d,b);d.signum()>0;)y=(a+b.intValue()).toString(o).substr(1)+y,d.divRemTo(f,d,b);return b.intValue().toString(o)+y}function qi(o,i){this.fromInt(0),i==null&&(i=10);for(var a=this.chunkSize(i),f=Math.pow(i,a),d=!1,b=0,y=0,S=0;S<o.length;++S){var F=x(o,S);if(F<0){o.charAt(S)=="-"&&this.signum()==0&&(d=!0);continue}y=i*y+F,++b>=a&&(this.dMultiply(f),this.dAddOffset(y,0),b=0,y=0)}b>0&&(this.dMultiply(Math.pow(i,b)),this.dAddOffset(y,0)),d&&n.ZERO.subTo(this,this)}function Gi(o,i,a){if(typeof i=="number")if(o<2)this.fromInt(1);else for(this.fromNumber(o,a),this.testBit(o-1)||this.bitwiseTo(n.ONE.shiftLeft(o-1),ur,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(i);)this.dAddOffset(2,0),this.bitLength()>o&&this.subTo(n.ONE.shiftLeft(o-1),this);else{var f=new Array,d=o&7;f.length=(o>>3)+1,i.nextBytes(f),d>0?f[0]&=(1<<d)-1:f[0]=0,this.fromString(f,256)}}function Hi(){var o=this.t,i=new Array;i[0]=this.s;var a=this.DB-o*this.DB%8,f,d=0;if(o-- >0)for(a<this.DB&&(f=this[o]>>a)!=(this.s&this.DM)>>a&&(i[d++]=f|this.s<<this.DB-a);o>=0;)a<8?(f=(this[o]&(1<<a)-1)<<8-a,f|=this[--o]>>(a+=this.DB-8)):(f=this[o]>>(a-=8)&255,a<=0&&(a+=this.DB,--o)),f&128&&(f|=-256),d==0&&(this.s&128)!=(f&128)&&++d,(d>0||f!=this.s)&&(i[d++]=f);return i}function Zi(o){return this.compareTo(o)==0}function Ji(o){return this.compareTo(o)<0?this:o}function Xi(o){return this.compareTo(o)>0?this:o}function Wi(o,i,a){var f,d,b=Math.min(o.t,this.t);for(f=0;f<b;++f)a[f]=i(this[f],o[f]);if(o.t<this.t){for(d=o.s&this.DM,f=b;f<this.t;++f)a[f]=i(this[f],d);a.t=this.t}else{for(d=this.s&this.DM,f=b;f<o.t;++f)a[f]=i(d,o[f]);a.t=o.t}a.s=i(this.s,o.s),a.clamp()}function Qi(o,i){return o&i}function Yi(o){var i=s();return this.bitwiseTo(o,Qi,i),i}function ur(o,i){return o|i}function Ki(o){var i=s();return this.bitwiseTo(o,ur,i),i}function Qn(o,i){return o^i}function ta(o){var i=s();return this.bitwiseTo(o,Qn,i),i}function Yn(o,i){return o&~i}function ea(o){var i=s();return this.bitwiseTo(o,Yn,i),i}function ra(){for(var o=s(),i=0;i<this.t;++i)o[i]=this.DM&~this[i];return o.t=this.t,o.s=~this.s,o}function na(o){var i=s();return o<0?this.rShiftTo(-o,i):this.lShiftTo(o,i),i}function sa(o){var i=s();return o<0?this.lShiftTo(-o,i):this.rShiftTo(o,i),i}function oa(o){if(o==0)return-1;var i=0;return o&65535||(o>>=16,i+=16),o&255||(o>>=8,i+=8),o&15||(o>>=4,i+=4),o&3||(o>>=2,i+=2),o&1||++i,i}function ia(){for(var o=0;o<this.t;++o)if(this[o]!=0)return o*this.DB+oa(this[o]);return this.s<0?this.t*this.DB:-1}function aa(o){for(var i=0;o!=0;)o&=o-1,++i;return i}function ca(){for(var o=0,i=this.s&this.DM,a=0;a<this.t;++a)o+=aa(this[a]^i);return o}function fa(o){var i=Math.floor(o/this.DB);return i>=this.t?this.s!=0:(this[i]&1<<o%this.DB)!=0}function ua(o,i){var a=n.ONE.shiftLeft(o);return this.bitwiseTo(a,i,a),a}function pa(o){return this.changeBit(o,ur)}function la(o){return this.changeBit(o,Yn)}function ha(o){return this.changeBit(o,Qn)}function da(o,i){for(var a=0,f=0,d=Math.min(o.t,this.t);a<d;)f+=this[a]+o[a],i[a++]=f&this.DM,f>>=this.DB;if(o.t<this.t){for(f+=o.s;a<this.t;)f+=this[a],i[a++]=f&this.DM,f>>=this.DB;f+=this.s}else{for(f+=this.s;a<o.t;)f+=o[a],i[a++]=f&this.DM,f>>=this.DB;f+=o.s}i.s=f<0?-1:0,f>0?i[a++]=f:f<-1&&(i[a++]=this.DV+f),i.t=a,i.clamp()}function ma(o){var i=s();return this.addTo(o,i),i}function ba(o){var i=s();return this.subTo(o,i),i}function ga(o){var i=s();return this.multiplyTo(o,i),i}function wa(){var o=s();return this.squareTo(o),o}function ya(o){var i=s();return this.divRemTo(o,i,null),i}function va(o){var i=s();return this.divRemTo(o,null,i),i}function xa(o){var i=s(),a=s();return this.divRemTo(o,i,a),new Array(i,a)}function Sa(o){this[this.t]=this.am(0,o-1,this,0,0,this.t),++this.t,this.clamp()}function Ta(o,i){if(o!=0){for(;this.t<=i;)this[this.t++]=0;for(this[i]+=o;this[i]>=this.DV;)this[i]-=this.DV,++i>=this.t&&(this[this.t++]=0),++this[i]}}function ge(){}function Kn(o){return o}function Ea(o,i,a){o.multiplyTo(i,a)}function Aa(o,i){o.squareTo(i)}ge.prototype.convert=Kn,ge.prototype.revert=Kn,ge.prototype.mulTo=Ea,ge.prototype.sqrTo=Aa;function Ca(o){return this.exp(o,new ge)}function Ia(o,i,a){var f=Math.min(this.t+o.t,i);for(a.s=0,a.t=f;f>0;)a[--f]=0;var d;for(d=a.t-this.t;f<d;++f)a[f+this.t]=this.am(0,o[f],a,f,0,this.t);for(d=Math.min(o.t,i);f<d;++f)this.am(0,o[f],a,f,0,i-f);a.clamp()}function Ba(o,i,a){--i;var f=a.t=this.t+o.t-i;for(a.s=0;--f>=0;)a[f]=0;for(f=Math.max(i-this.t,0);f<o.t;++f)a[this.t+f-i]=this.am(i-f,o[f],a,0,0,this.t+f-i);a.clamp(),a.drShiftTo(1,a)}function Lt(o){this.r2=s(),this.q3=s(),n.ONE.dlShiftTo(2*o.t,this.r2),this.mu=this.r2.divide(o),this.m=o}function Ra(o){if(o.s<0||o.t>2*this.m.t)return o.mod(this.m);if(o.compareTo(this.m)<0)return o;var i=s();return o.copyTo(i),this.reduce(i),i}function Ma(o){return o}function Da(o){for(o.drShiftTo(this.m.t-1,this.r2),o.t>this.m.t+1&&(o.t=this.m.t+1,o.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);o.compareTo(this.r2)<0;)o.dAddOffset(1,this.m.t+1);for(o.subTo(this.r2,o);o.compareTo(this.m)>=0;)o.subTo(this.m,o)}function ka(o,i){o.squareTo(i),this.reduce(i)}function Pa(o,i,a){o.multiplyTo(i,a),this.reduce(a)}Lt.prototype.convert=Ra,Lt.prototype.revert=Ma,Lt.prototype.reduce=Da,Lt.prototype.mulTo=Pa,Lt.prototype.sqrTo=ka;function Oa(o,i){var a=o.bitLength(),f,d=A(1),b;if(a<=0)return d;a<18?f=1:a<48?f=3:a<144?f=4:a<768?f=5:f=6,a<8?b=new Ut(i):i.isEven()?b=new Lt(i):b=new _t(i);var y=new Array,S=3,F=f-1,J=(1<<f)-1;if(y[1]=b.convert(this),f>1){var ut=s();for(b.sqrTo(y[1],ut);S<=J;)y[S]=s(),b.mulTo(ut,y[S-2],y[S]),S+=2}var it=o.t-1,Tt,Re=!0,dt=s(),mt;for(a=j(o[it])-1;it>=0;){for(a>=F?Tt=o[it]>>a-F&J:(Tt=(o[it]&(1<<a+1)-1)<<F-a,it>0&&(Tt|=o[it-1]>>this.DB+a-F)),S=f;!(Tt&1);)Tt>>=1,--S;if((a-=S)<0&&(a+=this.DB,--it),Re)y[Tt].copyTo(d),Re=!1;else{for(;S>1;)b.sqrTo(d,dt),b.sqrTo(dt,d),S-=2;S>0?b.sqrTo(d,dt):(mt=d,d=dt,dt=mt),b.mulTo(dt,y[Tt],d)}for(;it>=0&&!(o[it]&1<<a);)b.sqrTo(d,dt),mt=d,d=dt,dt=mt,--a<0&&(a=this.DB-1,--it)}return b.revert(d)}function Na(o){var i=this.s<0?this.negate():this.clone(),a=o.s<0?o.negate():o.clone();if(i.compareTo(a)<0){var f=i;i=a,a=f}var d=i.getLowestSetBit(),b=a.getLowestSetBit();if(b<0)return i;for(d<b&&(b=d),b>0&&(i.rShiftTo(b,i),a.rShiftTo(b,a));i.signum()>0;)(d=i.getLowestSetBit())>0&&i.rShiftTo(d,i),(d=a.getLowestSetBit())>0&&a.rShiftTo(d,a),i.compareTo(a)>=0?(i.subTo(a,i),i.rShiftTo(1,i)):(a.subTo(i,a),a.rShiftTo(1,a));return b>0&&a.lShiftTo(b,a),a}function Fa(o){if(o<=0)return 0;var i=this.DV%o,a=this.s<0?o-1:0;if(this.t>0)if(i==0)a=this[0]%o;else for(var f=this.t-1;f>=0;--f)a=(i*a+this[f])%o;return a}function Ua(o){var i=o.isEven();if(this.isEven()&&i||o.signum()==0)return n.ZERO;for(var a=o.clone(),f=this.clone(),d=A(1),b=A(0),y=A(0),S=A(1);a.signum()!=0;){for(;a.isEven();)a.rShiftTo(1,a),i?((!d.isEven()||!b.isEven())&&(d.addTo(this,d),b.subTo(o,b)),d.rShiftTo(1,d)):b.isEven()||b.subTo(o,b),b.rShiftTo(1,b);for(;f.isEven();)f.rShiftTo(1,f),i?((!y.isEven()||!S.isEven())&&(y.addTo(this,y),S.subTo(o,S)),y.rShiftTo(1,y)):S.isEven()||S.subTo(o,S),S.rShiftTo(1,S);a.compareTo(f)>=0?(a.subTo(f,a),i&&d.subTo(y,d),b.subTo(S,b)):(f.subTo(a,f),i&&y.subTo(d,y),S.subTo(b,S))}if(f.compareTo(n.ONE)!=0)return n.ZERO;if(S.compareTo(o)>=0)return S.subtract(o);if(S.signum()<0)S.addTo(o,S);else return S;return S.signum()<0?S.add(o):S}var et=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],_a=(1<<26)/et[et.length-1];function La(o){var i,a=this.abs();if(a.t==1&&a[0]<=et[et.length-1]){for(i=0;i<et.length;++i)if(a[0]==et[i])return!0;return!1}if(a.isEven())return!1;for(i=1;i<et.length;){for(var f=et[i],d=i+1;d<et.length&&f<_a;)f*=et[d++];for(f=a.modInt(f);i<d;)if(f%et[i++]==0)return!1}return a.millerRabin(o)}function $a(o){var i=this.subtract(n.ONE),a=i.getLowestSetBit();if(a<=0)return!1;var f=i.shiftRight(a);o=o+1>>1,o>et.length&&(o=et.length);for(var d=s(),b=0;b<o;++b){d.fromInt(et[Math.floor(Math.random()*et.length)]);var y=d.modPow(f,this);if(y.compareTo(n.ONE)!=0&&y.compareTo(i)!=0){for(var S=1;S++<a&&y.compareTo(i)!=0;)if(y=y.modPowInt(2,this),y.compareTo(n.ONE)==0)return!1;if(y.compareTo(i)!=0)return!1}}return!0}n.prototype.chunkSize=zi,n.prototype.toRadix=ji,n.prototype.fromRadix=qi,n.prototype.fromNumber=Gi,n.prototype.bitwiseTo=Wi,n.prototype.changeBit=ua,n.prototype.addTo=da,n.prototype.dMultiply=Sa,n.prototype.dAddOffset=Ta,n.prototype.multiplyLowerTo=Ia,n.prototype.multiplyUpperTo=Ba,n.prototype.modInt=Fa,n.prototype.millerRabin=$a,n.prototype.clone=Ui,n.prototype.intValue=_i,n.prototype.byteValue=Li,n.prototype.shortValue=$i,n.prototype.signum=Vi,n.prototype.toByteArray=Hi,n.prototype.equals=Zi,n.prototype.min=Ji,n.prototype.max=Xi,n.prototype.and=Yi,n.prototype.or=Ki,n.prototype.xor=ta,n.prototype.andNot=ea,n.prototype.not=ra,n.prototype.shiftLeft=na,n.prototype.shiftRight=sa,n.prototype.getLowestSetBit=ia,n.prototype.bitCount=ca,n.prototype.testBit=fa,n.prototype.setBit=pa,n.prototype.clearBit=la,n.prototype.flipBit=ha,n.prototype.add=ma,n.prototype.subtract=ba,n.prototype.multiply=ga,n.prototype.divide=ya,n.prototype.remainder=va,n.prototype.divideAndRemainder=xa,n.prototype.modPow=Oa,n.prototype.modInverse=Ua,n.prototype.pow=Ca,n.prototype.gcd=Na,n.prototype.isProbablePrime=La,n.prototype.square=wa,n.prototype.Barrett=Lt;var Be,ot,Z;function za(o){ot[Z++]^=o&255,ot[Z++]^=o>>8&255,ot[Z++]^=o>>16&255,ot[Z++]^=o>>24&255,Z>=hr&&(Z-=hr)}function ts(){za(new Date().getTime())}if(ot==null){ot=new Array,Z=0;var ht;if(typeof window<"u"&&window.crypto){if(window.crypto.getRandomValues){var es=new Uint8Array(32);for(window.crypto.getRandomValues(es),ht=0;ht<32;++ht)ot[Z++]=es[ht]}else if(navigator.appName=="Netscape"&&navigator.appVersion<"5"){var rs=window.crypto.random(32);for(ht=0;ht<rs.length;++ht)ot[Z++]=rs.charCodeAt(ht)&255}}for(;Z<hr;)ht=Math.floor(65536*Math.random()),ot[Z++]=ht>>>8,ot[Z++]=ht&255;Z=0,ts()}function Va(){if(Be==null){for(ts(),Be=Ha(),Be.init(ot),Z=0;Z<ot.length;++Z)ot[Z]=0;Z=0}return Be.next()}function ja(o){var i;for(i=0;i<o.length;++i)o[i]=Va()}function pr(){}pr.prototype.nextBytes=ja;function lr(){this.i=0,this.j=0,this.S=new Array}function qa(o){var i,a,f;for(i=0;i<256;++i)this.S[i]=i;for(a=0,i=0;i<256;++i)a=a+this.S[i]+o[i%o.length]&255,f=this.S[i],this.S[i]=this.S[a],this.S[a]=f;this.i=0,this.j=0}function Ga(){var o;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,o=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=o,this.S[o+this.S[this.i]&255]}lr.prototype.init=qa,lr.prototype.next=Ga;function Ha(){return new lr}var hr=256;typeof rr<"u"?rr=qo.exports={default:n,BigInteger:n,SecureRandom:pr}:this.jsbn={BigInteger:n,SecureRandom:pr}}).call(rr)});var Ie=H(nr=>{(function(){"use strict";var r={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function t(u){return n(c(u),arguments)}function e(u,h){return t.apply(null,[u].concat(h||[]))}function n(u,h){var m=1,I=u.length,p,g="",w,E,l,x,R,T,A,M;for(w=0;w<I;w++)if(typeof u[w]=="string")g+=u[w];else if(typeof u[w]=="object"){if(l=u[w],l.keys)for(p=h[m],E=0;E<l.keys.length;E++){if(p==null)throw new Error(t('[sprintf] Cannot access property "%s" of undefined value "%s"',l.keys[E],l.keys[E-1]));p=p[l.keys[E]]}else l.param_no?p=h[l.param_no]:p=h[m++];if(r.not_type.test(l.type)&&r.not_primitive.test(l.type)&&p instanceof Function&&(p=p()),r.numeric_arg.test(l.type)&&typeof p!="number"&&isNaN(p))throw new TypeError(t("[sprintf] expecting number but found %T",p));switch(r.number.test(l.type)&&(A=p>=0),l.type){case"b":p=parseInt(p,10).toString(2);break;case"c":p=String.fromCharCode(parseInt(p,10));break;case"d":case"i":p=parseInt(p,10);break;case"j":p=JSON.stringify(p,null,l.width?parseInt(l.width):0);break;case"e":p=l.precision?parseFloat(p).toExponential(l.precision):parseFloat(p).toExponential();break;case"f":p=l.precision?parseFloat(p).toFixed(l.precision):parseFloat(p);break;case"g":p=l.precision?String(Number(p.toPrecision(l.precision))):parseFloat(p);break;case"o":p=(parseInt(p,10)>>>0).toString(8);break;case"s":p=String(p),p=l.precision?p.substring(0,l.precision):p;break;case"t":p=String(!!p),p=l.precision?p.substring(0,l.precision):p;break;case"T":p=Object.prototype.toString.call(p).slice(8,-1).toLowerCase(),p=l.precision?p.substring(0,l.precision):p;break;case"u":p=parseInt(p,10)>>>0;break;case"v":p=p.valueOf(),p=l.precision?p.substring(0,l.precision):p;break;case"x":p=(parseInt(p,10)>>>0).toString(16);break;case"X":p=(parseInt(p,10)>>>0).toString(16).toUpperCase();break}r.json.test(l.type)?g+=p:(r.number.test(l.type)&&(!A||l.sign)?(M=A?"+":"-",p=p.toString().replace(r.sign,"")):M="",R=l.pad_char?l.pad_char==="0"?"0":l.pad_char.charAt(1):" ",T=l.width-(M+p).length,x=l.width&&T>0?R.repeat(T):"",g+=l.align?M+p+x:R==="0"?M+x+p:x+M+p)}return g}var s=Object.create(null);function c(u){if(s[u])return s[u];for(var h=u,m,I=[],p=0;h;){if((m=r.text.exec(h))!==null)I.push(m[0]);else if((m=r.modulo.exec(h))!==null)I.push("%");else if((m=r.placeholder.exec(h))!==null){if(m[2]){p|=1;var g=[],w=m[2],E=[];if((E=r.key.exec(w))!==null)for(g.push(E[1]);(w=w.substring(E[0].length))!=="";)if((E=r.key_access.exec(w))!==null)g.push(E[1]);else if((E=r.index_access.exec(w))!==null)g.push(E[1]);else throw new SyntaxError("[sprintf] failed to parse named argument key");else throw new SyntaxError("[sprintf] failed to parse named argument key");m[2]=g}else p|=2;if(p===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");I.push({placeholder:m[0],param_no:m[1],keys:m[2],sign:m[3],pad_char:m[4],align:m[5],width:m[6],precision:m[7],type:m[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");h=h.substring(m[0].length)}return s[u]=I}typeof nr<"u"&&(nr.sprintf=t,nr.vsprintf=e),typeof window<"u"&&(window.sprintf=t,window.vsprintf=e,typeof define=="function"&&define.amd&&define(function(){return{sprintf:t,vsprintf:e}}))})()});var ar=H((d0,ei)=>{ei.exports=r=>{if(r[Symbol.asyncIterator])return r;if(r.getReader)return async function*(){let t=r.getReader();try{for(;;){let{done:e,value:n}=await t.read();if(e)return;yield n}}finally{t.releaseLock()}}();throw new Error("unknown stream")}});var ni=H((m0,ri)=>{ri.exports=function(t){if(t){if(typeof t[Symbol.iterator]=="function")return t[Symbol.iterator]();if(typeof t[Symbol.asyncIterator]=="function")return t[Symbol.asyncIterator]();if(typeof t.next=="function")return t}throw new Error("argument is not an iterator or iterable")}});var qn=H((b0,si)=>{var jp=ni();si.exports=r=>async t=>{t=jp(t);let e=T=>{typeof T.return=="function"&&T.return()},n=null,s=null,c=T=>{n=T,s&&s(T),e(t)},u=null,h=!1,m=()=>{h=!0,u&&u()},I=null,p=!1,g=()=>{p=!0,I&&I()},w=null,E=()=>{w&&w()},l=()=>new Promise((T,A)=>{u=w=T,s=A,r.once("drain",E)}),x=()=>(e(t),new Promise((T,A)=>{if(h||p||n)return T();I=u=T,s=A})),R=()=>{r.removeListener("error",c),r.removeListener("close",m),r.removeListener("finish",g),r.removeListener("drain",E)};r.once("error",c),r.once("close",m),r.once("finish",g);try{for await(let T of t){if(!r.writable||r.destroyed||n)break;r.write(T)===!1&&await l()}}catch(T){n||r.destroy(),n=T}try{if(r.writable&&r.end(),await x(),n)throw n}finally{R()}}});var Gn=H((g0,oi)=>{var qp=qn(),Gp=ar();oi.exports=r=>({sink:qp(r),source:Gp(r)})});var ai=H((w0,ii)=>{var Hp=Gn();ii.exports=r=>async function*(t){let e=Hp(r),n;if(e.sink(t).catch(s=>{n=s}),yield*e.source,n)throw n}});var ci=H((y0,me)=>{me.exports=ar();me.exports.source=ar();me.exports.sink=qn();me.exports.transform=ai();me.exports.duplex=Gn()});var sl={};U(sl,{tcp:()=>nl});var li=X(wt("net"),1);var ke=class extends Error{code;type;constructor(t="The operation was aborted"){super(t),this.code=ke.code,this.type=ke.type}},Mt=ke;De(Mt,"code","ABORT_ERR"),De(Mt,"type","aborted");var bt=class extends Error{code;props;constructor(t,e,n){super(t),this.code=e,this.name=n?.name??"CodeError",this.props=n??{}}};var os=Symbol.for("@libp2p/transport");var ss;(function(r){r[r.FATAL_ALL=0]="FATAL_ALL",r[r.NO_FATAL=1]="NO_FATAL"})(ss||(ss={}));var ct=X(bs(),1);function Tc(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var s=0;s<r.length;s++){var c=r.charAt(s),u=c.charCodeAt(0);if(e[u]!==255)throw new TypeError(c+" is ambiguous");e[u]=s}var h=r.length,m=r.charAt(0),I=Math.log(h)/Math.log(256),p=Math.log(256)/Math.log(h);function g(l){if(l instanceof Uint8Array||(ArrayBuffer.isView(l)?l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength):Array.isArray(l)&&(l=Uint8Array.from(l))),!(l instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(l.length===0)return"";for(var x=0,R=0,T=0,A=l.length;T!==A&&l[T]===0;)T++,x++;for(var M=(A-T)*p+1>>>0,B=new Uint8Array(M);T!==A;){for(var k=l[T],O=0,D=M-1;(k!==0||O<R)&&D!==-1;D--,O++)k+=256*B[D]>>>0,B[D]=k%h>>>0,k=k/h>>>0;if(k!==0)throw new Error("Non-zero carry");R=O,T++}for(var P=M-R;P!==M&&B[P]===0;)P++;for(var j=m.repeat(x);P<M;++P)j+=r.charAt(B[P]);return j}function w(l){if(typeof l!="string")throw new TypeError("Expected String");if(l.length===0)return new Uint8Array;var x=0;if(l[x]!==" "){for(var R=0,T=0;l[x]===m;)R++,x++;for(var A=(l.length-x)*I+1>>>0,M=new Uint8Array(A);l[x];){var B=e[l.charCodeAt(x)];if(B===255)return;for(var k=0,O=A-1;(B!==0||k<T)&&O!==-1;O--,k++)B+=h*M[O]>>>0,M[O]=B%256>>>0,B=B/256>>>0;if(B!==0)throw new Error("Non-zero carry");T=k,x++}if(l[x]!==" "){for(var D=A-T;D!==A&&M[D]===0;)D++;for(var P=new Uint8Array(R+(A-D)),j=R;D!==A;)P[j++]=M[D++];return P}}}function E(l){var x=w(l);if(x)return x;throw new Error(`Non-${t} character`)}return{encode:g,decodeUnsafe:w,decode:E}}var Ec=Tc,Ac=Ec,gs=Ac;var ml=new Uint8Array(0);var ws=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 wr=class{constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},yr=class{constructor(t,e,n){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return ys(this,t)}},vr=class{constructor(t){this.decoders=t}or(t){return ys(this,t)}decode(t){let e=t[0],n=this.decoders[e];if(n)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},ys=(r,t)=>new vr({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),xr=class{constructor(t,e,n,s){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=s,this.encoder=new wr(t,e,n),this.decoder=new yr(t,e,s)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}},vs=({name:r,prefix:t,encode:e,decode:n})=>new xr(r,t,e,n),Sr=({prefix:r,name:t,alphabet:e})=>{let{encode:n,decode:s}=gs(e,t);return vs({prefix:r,name:t,encode:n,decode:c=>ws(s(c))})},Cc=(r,t,e,n)=>{let s={};for(let p=0;p<t.length;++p)s[t[p]]=p;let c=r.length;for(;r[c-1]==="=";)--c;let u=new Uint8Array(c*e/8|0),h=0,m=0,I=0;for(let p=0;p<c;++p){let g=s[r[p]];if(g===void 0)throw new SyntaxError(`Non-${n} character`);m=m<<e|g,h+=e,h>=8&&(h-=8,u[I++]=255&m>>h)}if(h>=e||255&m<<8-h)throw new SyntaxError("Unexpected end of data");return u},Ic=(r,t,e)=>{let n=t[t.length-1]==="=",s=(1<<e)-1,c="",u=0,h=0;for(let m=0;m<r.length;++m)for(h=h<<8|r[m],u+=8;u>e;)u-=e,c+=t[s&h>>u];if(u&&(c+=t[s&h<<e-u]),n)for(;c.length*e&7;)c+="=";return c},rt=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>vs({prefix:t,name:r,encode(s){return Ic(s,n,e)},decode(s){return Cc(s,n,e,r)}});var xs=rt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),xl=rt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Sl=rt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Tl=rt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),El=rt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Al=rt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Cl=rt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Il=rt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Bl=rt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Ss=Sr({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Dl=Sr({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Ts=rt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Ol=rt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Nl=rt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Fl=rt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});ct.default.formatters.b=r=>r==null?"undefined":Ss.baseEncode(r);ct.default.formatters.t=r=>r==null?"undefined":xs.baseEncode(r);ct.default.formatters.m=r=>r==null?"undefined":Ts.baseEncode(r);ct.default.formatters.p=r=>r==null?"undefined":r.toString();ct.default.formatters.c=r=>r==null?"undefined":r.toString();ct.default.formatters.k=r=>r==null?"undefined":r.toString();ct.default.formatters.a=r=>r==null?"undefined":r.toString();function Bc(r){let t=()=>{};return t.enabled=!1,t.color="",t.diff=0,t.log=()=>{},t.namespace=r,t.destroy=()=>!0,t.extend=()=>t,t}function Dt(r){let t=Bc(`${r}:trace`);return ct.default.enabled(`${r}:trace`)&&ct.default.names.map(e=>e.toString()).find(e=>e.includes(":trace"))!=null&&(t=(0,ct.default)(`${r}:trace`)),Object.assign((0,ct.default)(r),{error:(0,ct.default)(`${r}:error`),trace:t})}var Ue=class extends Error{code;props;constructor(t,e,n){super(t),this.code=e,this.name=n?.name??"CodeError",this.props=n??{}}};var Ir={};U(Ir,{base58btc:()=>nt,base58flickr:()=>Oc});function Rc(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var s=0;s<r.length;s++){var c=r.charAt(s),u=c.charCodeAt(0);if(e[u]!==255)throw new TypeError(c+" is ambiguous");e[u]=s}var h=r.length,m=r.charAt(0),I=Math.log(h)/Math.log(256),p=Math.log(256)/Math.log(h);function g(l){if(l instanceof Uint8Array||(ArrayBuffer.isView(l)?l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength):Array.isArray(l)&&(l=Uint8Array.from(l))),!(l instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(l.length===0)return"";for(var x=0,R=0,T=0,A=l.length;T!==A&&l[T]===0;)T++,x++;for(var M=(A-T)*p+1>>>0,B=new Uint8Array(M);T!==A;){for(var k=l[T],O=0,D=M-1;(k!==0||O<R)&&D!==-1;D--,O++)k+=256*B[D]>>>0,B[D]=k%h>>>0,k=k/h>>>0;if(k!==0)throw new Error("Non-zero carry");R=O,T++}for(var P=M-R;P!==M&&B[P]===0;)P++;for(var j=m.repeat(x);P<M;++P)j+=r.charAt(B[P]);return j}function w(l){if(typeof l!="string")throw new TypeError("Expected String");if(l.length===0)return new Uint8Array;var x=0;if(l[x]!==" "){for(var R=0,T=0;l[x]===m;)R++,x++;for(var A=(l.length-x)*I+1>>>0,M=new Uint8Array(A);l[x];){var B=e[l.charCodeAt(x)];if(B===255)return;for(var k=0,O=A-1;(B!==0||k<T)&&O!==-1;O--,k++)B+=h*M[O]>>>0,M[O]=B%256>>>0,B=B/256>>>0;if(B!==0)throw new Error("Non-zero carry");T=k,x++}if(l[x]!==" "){for(var D=A-T;D!==A&&M[D]===0;)D++;for(var P=new Uint8Array(R+(A-D)),j=R;D!==A;)P[j++]=M[D++];return P}}}function E(l){var x=w(l);if(x)return x;throw new Error(`Non-${t} character`)}return{encode:g,decodeUnsafe:w,decode:E}}var Mc=Rc,Dc=Mc,Es=Dc;var Gl=new Uint8Array(0);var As=(r,t)=>{if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0},pt=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 Cs=r=>new TextEncoder().encode(r),Is=r=>new TextDecoder().decode(r);var Tr=class{constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},Er=class{constructor(t,e,n){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return Rs(this,t)}},Ar=class{constructor(t){this.decoders=t}or(t){return Rs(this,t)}decode(t){let e=t[0],n=this.decoders[e];if(n)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},Rs=(r,t)=>new Ar({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),Cr=class{constructor(t,e,n,s){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=s,this.encoder=new Tr(t,e,n),this.decoder=new Er(t,e,s)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}},Kt=({name:r,prefix:t,encode:e,decode:n})=>new Cr(r,t,e,n),kt=({prefix:r,name:t,alphabet:e})=>{let{encode:n,decode:s}=Es(e,t);return Kt({prefix:r,name:t,encode:n,decode:c=>pt(s(c))})},kc=(r,t,e,n)=>{let s={};for(let p=0;p<t.length;++p)s[t[p]]=p;let c=r.length;for(;r[c-1]==="=";)--c;let u=new Uint8Array(c*e/8|0),h=0,m=0,I=0;for(let p=0;p<c;++p){let g=s[r[p]];if(g===void 0)throw new SyntaxError(`Non-${n} character`);m=m<<e|g,h+=e,h>=8&&(h-=8,u[I++]=255&m>>h)}if(h>=e||255&m<<8-h)throw new SyntaxError("Unexpected end of data");return u},Pc=(r,t,e)=>{let n=t[t.length-1]==="=",s=(1<<e)-1,c="",u=0,h=0;for(let m=0;m<r.length;++m)for(h=h<<8|r[m],u+=8;u>e;)u-=e,c+=t[s&h>>u];if(u&&(c+=t[s&h<<e-u]),n)for(;c.length*e&7;)c+="=";return c},$=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>Kt({prefix:t,name:r,encode(s){return Pc(s,n,e)},decode(s){return kc(s,n,e,r)}});var nt=kt({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Oc=kt({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Nc=ks,Ms=128,Fc=127,Uc=~Fc,_c=Math.pow(2,31);function ks(r,t,e){t=t||[],e=e||0;for(var n=e;r>=_c;)t[e++]=r&255|Ms,r/=128;for(;r&Uc;)t[e++]=r&255|Ms,r>>>=7;return t[e]=r|0,ks.bytes=e-n+1,t}var Lc=Br,$c=128,Ds=127;function Br(r,n){var e=0,n=n||0,s=0,c=n,u,h=r.length;do{if(c>=h)throw Br.bytes=0,new RangeError("Could not decode varint");u=r[c++],e+=s<28?(u&Ds)<<s:(u&Ds)*Math.pow(2,s),s+=7}while(u>=$c);return Br.bytes=c-n,e}var zc=Math.pow(2,7),Vc=Math.pow(2,14),jc=Math.pow(2,21),qc=Math.pow(2,28),Gc=Math.pow(2,35),Hc=Math.pow(2,42),Zc=Math.pow(2,49),Jc=Math.pow(2,56),Xc=Math.pow(2,63),Wc=function(r){return r<zc?1:r<Vc?2:r<jc?3:r<qc?4:r<Gc?5:r<Hc?6:r<Zc?7:r<Jc?8:r<Xc?9:10},Qc={encode:Nc,decode:Lc,encodingLength:Wc},Yc=Qc,ye=Yc;var ve=(r,t=0)=>[ye.decode(r,t),ye.decode.bytes],te=(r,t,e=0)=>(ye.encode(r,t,e),t),ee=r=>ye.encodingLength(r);var zt=(r,t)=>{let e=t.byteLength,n=ee(r),s=n+ee(e),c=new Uint8Array(s+e);return te(r,c,0),te(e,c,n),c.set(t,s),new re(r,e,t,c)},Le=r=>{let t=pt(r),[e,n]=ve(t),[s,c]=ve(t.subarray(n)),u=t.subarray(n+c);if(u.byteLength!==s)throw new Error("Incorrect length");return new re(e,s,u,t)},Ps=(r,t)=>{if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&As(r.bytes,e.bytes)}},re=class{constructor(t,e,n,s){this.code=t,this.size=e,this.digest=n,this.bytes=s}};var Rr={};U(Rr,{base32:()=>Et,base32hex:()=>rf,base32hexpad:()=>sf,base32hexpadupper:()=>of,base32hexupper:()=>nf,base32pad:()=>tf,base32padupper:()=>ef,base32upper:()=>Kc,base32z:()=>af});var Et=$({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Kc=$({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),tf=$({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ef=$({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),rf=$({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),nf=$({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),sf=$({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),of=$({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),af=$({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Os=(r,t)=>{let{bytes:e,version:n}=r;switch(n){case 0:return ff(e,Mr(r),t||nt.encoder);default:return uf(e,Mr(r),t||Et.encoder)}};var Ns=new WeakMap,Mr=r=>{let t=Ns.get(r);if(t==null){let e=new Map;return Ns.set(r,e),e}return t},_=class{constructor(t,e,n,s){this.code=e,this.version=t,this.multihash=n,this.bytes=s,this["/"]=s}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:e}=this;if(t!==xe)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==pf)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return _.createV0(e)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:e}=this.multihash,n=zt(t,e);return _.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return _.equals(this,t)}static equals(t,e){let n=e;return n&&t.code===n.code&&t.version===n.version&&Ps(t.multihash,n.multihash)}toString(t){return Os(this,t)}toJSON(){return{"/":Os(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let e=t;if(e instanceof _)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:n,code:s,multihash:c,bytes:u}=e;return new _(n,s,c,u||Fs(n,s,c.bytes))}else if(e[lf]===!0){let{version:n,multihash:s,code:c}=e,u=Le(s);return _.create(n,c,u)}else return null}static create(t,e,n){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==xe)throw new Error(`Version 0 CID must use dag-pb (code: ${xe}) block encoding`);return new _(t,e,n,n.bytes)}case 1:{let s=Fs(t,e,n.bytes);return new _(t,e,n,s)}default:throw new Error("Invalid version")}}static createV0(t){return _.create(0,xe,t)}static createV1(t,e){return _.create(1,t,e)}static decode(t){let[e,n]=_.decodeFirst(t);if(n.length)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=_.inspectBytes(t),n=e.size-e.multihashSize,s=pt(t.subarray(n,n+e.multihashSize));if(s.byteLength!==e.multihashSize)throw new Error("Incorrect length");let c=s.subarray(e.multihashSize-e.digestSize),u=new re(e.multihashCode,e.digestSize,c,s);return[e.version===0?_.createV0(u):_.createV1(e.codec,u),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[g,w]=ve(t.subarray(e));return e+=w,g},s=n(),c=xe;if(s===18?(s=0,e=0):c=n(),s!==0&&s!==1)throw new RangeError(`Invalid CID version ${s}`);let u=e,h=n(),m=n(),I=e+m,p=I-u;return{version:s,codec:c,multihashCode:h,digestSize:m,multihashSize:p,size:I}}static parse(t,e){let[n,s]=cf(t,e),c=_.decode(s);if(c.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Mr(c).set(n,t),c}},cf=(r,t)=>{switch(r[0]){case"Q":{let e=t||nt;return[nt.prefix,e.decode(`${nt.prefix}${r}`)]}case nt.prefix:{let e=t||nt;return[nt.prefix,e.decode(r)]}case Et.prefix:{let e=t||Et;return[Et.prefix,e.decode(r)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],t.decode(r)]}}},ff=(r,t,e)=>{let{prefix:n}=e;if(n!==nt.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let s=t.get(n);if(s==null){let c=e.encode(r).slice(1);return t.set(n,c),c}else return s},uf=(r,t,e)=>{let{prefix:n}=e,s=t.get(n);if(s==null){let c=e.encode(r);return t.set(n,c),c}else return s},xe=112,pf=18,Fs=(r,t,e)=>{let n=ee(r),s=n+ee(t),c=new Uint8Array(s+e.byteLength);return te(r,c,0),te(t,c,n),c.set(e,s),c},lf=Symbol.for("@ipld/js-cid/CID");function Us(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}var Nr={};U(Nr,{identity:()=>wf});function hf(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var s=0;s<r.length;s++){var c=r.charAt(s),u=c.charCodeAt(0);if(e[u]!==255)throw new TypeError(c+" is ambiguous");e[u]=s}var h=r.length,m=r.charAt(0),I=Math.log(h)/Math.log(256),p=Math.log(256)/Math.log(h);function g(l){if(l instanceof Uint8Array||(ArrayBuffer.isView(l)?l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength):Array.isArray(l)&&(l=Uint8Array.from(l))),!(l instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(l.length===0)return"";for(var x=0,R=0,T=0,A=l.length;T!==A&&l[T]===0;)T++,x++;for(var M=(A-T)*p+1>>>0,B=new Uint8Array(M);T!==A;){for(var k=l[T],O=0,D=M-1;(k!==0||O<R)&&D!==-1;D--,O++)k+=256*B[D]>>>0,B[D]=k%h>>>0,k=k/h>>>0;if(k!==0)throw new Error("Non-zero carry");R=O,T++}for(var P=M-R;P!==M&&B[P]===0;)P++;for(var j=m.repeat(x);P<M;++P)j+=r.charAt(B[P]);return j}function w(l){if(typeof l!="string")throw new TypeError("Expected String");if(l.length===0)return new Uint8Array;var x=0;if(l[x]!==" "){for(var R=0,T=0;l[x]===m;)R++,x++;for(var A=(l.length-x)*I+1>>>0,M=new Uint8Array(A);l[x];){var B=e[l.charCodeAt(x)];if(B===255)return;for(var k=0,O=A-1;(B!==0||k<T)&&O!==-1;O--,k++)B+=h*M[O]>>>0,M[O]=B%256>>>0,B=B/256>>>0;if(B!==0)throw new Error("Non-zero carry");T=k,x++}if(l[x]!==" "){for(var D=A-T;D!==A&&M[D]===0;)D++;for(var P=new Uint8Array(R+(A-D)),j=R;D!==A;)P[j++]=M[D++];return P}}}function E(l){var x=w(l);if(x)return x;throw new Error(`Non-${t} character`)}return{encode:g,decodeUnsafe:w,decode:E}}var df=hf,mf=df,_s=mf;var ah=new Uint8Array(0);var Ls=(r,t)=>{if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0},lt=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 $s=r=>new TextEncoder().encode(r),zs=r=>new TextDecoder().decode(r);var Dr=class{constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},kr=class{constructor(t,e,n){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return js(this,t)}},Pr=class{constructor(t){this.decoders=t}or(t){return js(this,t)}decode(t){let e=t[0],n=this.decoders[e];if(n)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},js=(r,t)=>new Pr({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),Or=class{constructor(t,e,n,s){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=s,this.encoder=new Dr(t,e,n),this.decoder=new kr(t,e,s)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}},se=({name:r,prefix:t,encode:e,decode:n})=>new Or(r,t,e,n),Pt=({prefix:r,name:t,alphabet:e})=>{let{encode:n,decode:s}=_s(e,t);return se({prefix:r,name:t,encode:n,decode:c=>lt(s(c))})},bf=(r,t,e,n)=>{let s={};for(let p=0;p<t.length;++p)s[t[p]]=p;let c=r.length;for(;r[c-1]==="=";)--c;let u=new Uint8Array(c*e/8|0),h=0,m=0,I=0;for(let p=0;p<c;++p){let g=s[r[p]];if(g===void 0)throw new SyntaxError(`Non-${n} character`);m=m<<e|g,h+=e,h>=8&&(h-=8,u[I++]=255&m>>h)}if(h>=e||255&m<<8-h)throw new SyntaxError("Unexpected end of data");return u},gf=(r,t,e)=>{let n=t[t.length-1]==="=",s=(1<<e)-1,c="",u=0,h=0;for(let m=0;m<r.length;++m)for(h=h<<8|r[m],u+=8;u>e;)u-=e,c+=t[s&h>>u];if(u&&(c+=t[s&h<<e-u]),n)for(;c.length*e&7;)c+="=";return c},z=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>se({prefix:t,name:r,encode(s){return gf(s,n,e)},decode(s){return bf(s,n,e,r)}});var wf=se({prefix:"\0",name:"identity",encode:r=>zs(r),decode:r=>$s(r)});var Fr={};U(Fr,{base2:()=>yf});var yf=z({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Ur={};U(Ur,{base8:()=>vf});var vf=z({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var _r={};U(_r,{base10:()=>xf});var xf=Pt({prefix:"9",name:"base10",alphabet:"0123456789"});var Lr={};U(Lr,{base16:()=>Sf,base16upper:()=>Tf});var Sf=z({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Tf=z({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var $r={};U($r,{base32:()=>oe,base32hex:()=>If,base32hexpad:()=>Rf,base32hexpadupper:()=>Mf,base32hexupper:()=>Bf,base32pad:()=>Af,base32padupper:()=>Cf,base32upper:()=>Ef,base32z:()=>Df});var oe=z({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Ef=z({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Af=z({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Cf=z({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),If=z({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Bf=z({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Rf=z({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Mf=z({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Df=z({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var zr={};U(zr,{base36:()=>kf,base36upper:()=>Pf});var kf=Pt({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Pf=Pt({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Vr={};U(Vr,{base58btc:()=>yt,base58flickr:()=>Of});var yt=Pt({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Of=Pt({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var jr={};U(jr,{base64:()=>Nf,base64pad:()=>Ff,base64url:()=>Uf,base64urlpad:()=>_f});var Nf=z({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Ff=z({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Uf=z({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),_f=z({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var qr={};U(qr,{base256emoji:()=>jf});var qs=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}"),Lf=qs.reduce((r,t,e)=>(r[e]=t,r),[]),$f=qs.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function zf(r){return r.reduce((t,e)=>(t+=Lf[e],t),"")}function Vf(r){let t=[];for(let e of r){let n=$f[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}var jf=se({prefix:"\u{1F680}",name:"base256emoji",encode:zf,decode:Vf});var Xr={};U(Xr,{sha256:()=>cu,sha512:()=>fu});var Jr=X(wt("crypto"),1);var qf=Zs,Gs=128,Gf=127,Hf=~Gf,Zf=Math.pow(2,31);function Zs(r,t,e){t=t||[],e=e||0;for(var n=e;r>=Zf;)t[e++]=r&255|Gs,r/=128;for(;r&Hf;)t[e++]=r&255|Gs,r>>>=7;return t[e]=r|0,Zs.bytes=e-n+1,t}var Jf=Gr,Xf=128,Hs=127;function Gr(r,n){var e=0,n=n||0,s=0,c=n,u,h=r.length;do{if(c>=h)throw Gr.bytes=0,new RangeError("Could not decode varint");u=r[c++],e+=s<28?(u&Hs)<<s:(u&Hs)*Math.pow(2,s),s+=7}while(u>=Xf);return Gr.bytes=c-n,e}var Wf=Math.pow(2,7),Qf=Math.pow(2,14),Yf=Math.pow(2,21),Kf=Math.pow(2,28),tu=Math.pow(2,35),eu=Math.pow(2,42),ru=Math.pow(2,49),nu=Math.pow(2,56),su=Math.pow(2,63),ou=function(r){return r<Wf?1:r<Qf?2:r<Yf?3:r<Kf?4:r<tu?5:r<eu?6:r<ru?7:r<nu?8:r<su?9:10},iu={encode:qf,decode:Jf,encodingLength:ou},au=iu,Se=au;var Te=(r,t=0)=>[Se.decode(r,t),Se.decode.bytes],ie=(r,t,e=0)=>(Se.encode(r,t,e),t),ae=r=>Se.encodingLength(r);var Vt=(r,t)=>{let e=t.byteLength,n=ae(r),s=n+ae(e),c=new Uint8Array(s+e);return ie(r,c,0),ie(e,c,n),c.set(t,s),new ce(r,e,t,c)},Js=r=>{let t=lt(r),[e,n]=Te(t),[s,c]=Te(t.subarray(n)),u=t.subarray(n+c);if(u.byteLength!==s)throw new Error("Incorrect length");return new ce(e,s,u,t)},Xs=(r,t)=>{if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&Ls(r.bytes,e.bytes)}},ce=class{constructor(t,e,n,s){this.code=t,this.size=e,this.digest=n,this.bytes=s}};var Zr=({name:r,code:t,encode:e})=>new Hr(r,t,e),Hr=class{constructor(t,e,n){this.name=t,this.code=e,this.encode=n}digest(t){if(t instanceof Uint8Array){let e=this.encode(t);return e instanceof Uint8Array?Vt(this.code,e):e.then(n=>Vt(this.code,n))}else throw Error("Unknown type, must be binary type")}};var cu=Zr({name:"sha2-256",code:18,encode:r=>lt(Jr.default.createHash("sha256").update(r).digest())}),fu=Zr({name:"sha2-512",code:19,encode:r=>lt(Jr.default.createHash("sha512").update(r).digest())});var Wr={};U(Wr,{identity:()=>lu});var Qs=0,uu="identity",Ys=lt,pu=r=>Vt(Qs,Ys(r)),lu={code:Qs,name:uu,encode:Ys,digest:pu};var Rh=new TextEncoder,Mh=new TextDecoder;var Ks=(r,t)=>{let{bytes:e,version:n}=r;switch(n){case 0:return bu(e,Qr(r),t||yt.encoder);default:return gu(e,Qr(r),t||oe.encoder)}};var to=new WeakMap,Qr=r=>{let t=to.get(r);if(t==null){let e=new Map;return to.set(r,e),e}return t},G=class{constructor(t,e,n,s){this.code=e,this.version=t,this.multihash=n,this.bytes=s,this["/"]=s}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:e}=this;if(t!==Ae)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==wu)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return G.createV0(e)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:e}=this.multihash,n=Vt(t,e);return G.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return G.equals(this,t)}static equals(t,e){let n=e;return n&&t.code===n.code&&t.version===n.version&&Xs(t.multihash,n.multihash)}toString(t){return Ks(this,t)}toJSON(){return{"/":Ks(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let e=t;if(e instanceof G)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:n,code:s,multihash:c,bytes:u}=e;return new G(n,s,c,u||eo(n,s,c.bytes))}else if(e[yu]===!0){let{version:n,multihash:s,code:c}=e,u=Js(s);return G.create(n,c,u)}else return null}static create(t,e,n){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==Ae)throw new Error(`Version 0 CID must use dag-pb (code: ${Ae}) block encoding`);return new G(t,e,n,n.bytes)}case 1:{let s=eo(t,e,n.bytes);return new G(t,e,n,s)}default:throw new Error("Invalid version")}}static createV0(t){return G.create(0,Ae,t)}static createV1(t,e){return G.create(1,t,e)}static decode(t){let[e,n]=G.decodeFirst(t);if(n.length)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=G.inspectBytes(t),n=e.size-e.multihashSize,s=lt(t.subarray(n,n+e.multihashSize));if(s.byteLength!==e.multihashSize)throw new Error("Incorrect length");let c=s.subarray(e.multihashSize-e.digestSize),u=new ce(e.multihashCode,e.digestSize,c,s);return[e.version===0?G.createV0(u):G.createV1(e.codec,u),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[g,w]=Te(t.subarray(e));return e+=w,g},s=n(),c=Ae;if(s===18?(s=0,e=0):c=n(),s!==0&&s!==1)throw new RangeError(`Invalid CID version ${s}`);let u=e,h=n(),m=n(),I=e+m,p=I-u;return{version:s,codec:c,multihashCode:h,digestSize:m,multihashSize:p,size:I}}static parse(t,e){let[n,s]=mu(t,e),c=G.decode(s);if(c.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Qr(c).set(n,t),c}},mu=(r,t)=>{switch(r[0]){case"Q":{let e=t||yt;return[yt.prefix,e.decode(`${yt.prefix}${r}`)]}case yt.prefix:{let e=t||yt;return[yt.prefix,e.decode(r)]}case oe.prefix:{let e=t||oe;return[oe.prefix,e.decode(r)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],t.decode(r)]}}},bu=(r,t,e)=>{let{prefix:n}=e;if(n!==yt.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let s=t.get(n);if(s==null){let c=e.encode(r).slice(1);return t.set(n,c),c}else return s},gu=(r,t,e)=>{let{prefix:n}=e,s=t.get(n);if(s==null){let c=e.encode(r);return t.set(n,c),c}else return s},Ae=112,wu=18,eo=(r,t,e)=>{let n=ae(r),s=n+ae(t),c=new Uint8Array(s+e.byteLength);return ie(r,c,0),ie(t,c,n),c.set(e,s),c},yu=Symbol.for("@ipld/js-cid/CID");var Yr={...Nr,...Fr,...Ur,..._r,...Lr,...$r,...zr,...Vr,...jr,...qr},$h={...Xr,...Wr};function fe(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function ze(r=0){return globalThis.Buffer?.allocUnsafe!=null?fe(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function no(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var ro=no("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Kr=no("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);let t=ze(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),vu={utf8:ro,"utf-8":ro,hex:Yr.base16,latin1:Kr,ascii:Kr,binary:Kr,...Yr},Ve=vu;function st(r,t="utf8"){let e=Ve[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):e.encoder.encode(r).substring(1)}var Cn=X(je(),1);function At(r,t){t==null&&(t=r.reduce((s,c)=>s+c.length,0));let e=ze(t),n=0;for(let s of r)e.set(s,n),n+=s.length;return fe(e)}var ue=X(je(),1);var qe=class{index=0;input="";new(t){return this.index=0,this.input=t,this}readAtomically(t){let e=this.index,n=t();return n===void 0&&(this.index=e),n}parseWith(t){let e=t();if(this.index===this.input.length)return e}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(t){return this.readAtomically(()=>{let e=this.readChar();if(e===t)return e})}readSeparator(t,e,n){return this.readAtomically(()=>{if(!(e>0&&this.readGivenChar(t)===void 0))return n()})}readNumber(t,e,n,s){return this.readAtomically(()=>{let c=0,u=0,h=this.peekChar();if(h===void 0)return;let m=h==="0",I=2**(8*s)-1;for(;;){let p=this.readAtomically(()=>{let g=this.readChar();if(g===void 0)return;let w=Number.parseInt(g,t);if(!Number.isNaN(w))return w});if(p===void 0)break;if(c*=t,c+=p,c>I||(u+=1,e!==void 0&&u>e))return}if(u!==0)return!n&&m&&u>1?void 0:c})}readIPv4Addr(){return this.readAtomically(()=>{let t=new Uint8Array(4);for(let e=0;e<t.length;e++){let n=this.readSeparator(".",e,()=>this.readNumber(10,3,!1,1));if(n===void 0)return;t[e]=n}return t})}readIPv6Addr(){let t=e=>{for(let n=0;n<e.length/2;n++){let s=n*2;if(n<e.length-3){let u=this.readSeparator(":",n,()=>this.readIPv4Addr());if(u!==void 0)return e[s]=u[0],e[s+1]=u[1],e[s+2]=u[2],e[s+3]=u[3],[s+4,!0]}let c=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(c===void 0)return[s,!1];e[s]=c>>8,e[s+1]=c&255}return[e.length,!1]};return this.readAtomically(()=>{let e=new Uint8Array(16),[n,s]=t(e);if(n===16)return e;if(s||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let c=new Uint8Array(14),u=16-(n+2),[h]=t(c.subarray(0,u));return e.set(c.subarray(0,h),16-h),e})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var od=new qe;var hd=parseInt("0xFFFF",16),dd=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);var rn={};U(rn,{identity:()=>Lu});var Lu=Kt({prefix:"\0",name:"identity",encode:r=>Is(r),decode:r=>Cs(r)});var nn={};U(nn,{base2:()=>$u});var $u=$({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var sn={};U(sn,{base8:()=>zu});var zu=$({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var on={};U(on,{base10:()=>Vu});var Vu=kt({prefix:"9",name:"base10",alphabet:"0123456789"});var an={};U(an,{base16:()=>ju,base16upper:()=>qu});var ju=$({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),qu=$({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var cn={};U(cn,{base36:()=>Gu,base36upper:()=>Hu});var Gu=kt({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Hu=kt({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var fn={};U(fn,{base64:()=>Zu,base64pad:()=>Ju,base64url:()=>Xu,base64urlpad:()=>Wu});var Zu=$({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Ju=$({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Xu=$({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Wu=$({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var un={};U(un,{base256emoji:()=>ep});var bo=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}"),Qu=bo.reduce((r,t,e)=>(r[e]=t,r),[]),Yu=bo.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function Ku(r){return r.reduce((t,e)=>(t+=Qu[e],t),"")}function tp(r){let t=[];for(let e of r){let n=Yu[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}var ep=Kt({prefix:"\u{1F680}",name:"base256emoji",encode:Ku,decode:tp});var dn={};U(dn,{sha256:()=>rp,sha512:()=>np});var hn=X(wt("crypto"),1);var ln=({name:r,code:t,encode:e})=>new pn(r,t,e),pn=class{constructor(t,e,n){this.name=t,this.code=e,this.encode=n}digest(t){if(t instanceof Uint8Array){let e=this.encode(t);return e instanceof Uint8Array?zt(this.code,e):e.then(n=>zt(this.code,n))}else throw Error("Unknown type, must be binary type")}};var rp=ln({name:"sha2-256",code:18,encode:r=>pt(hn.default.createHash("sha256").update(r).digest())}),np=ln({name:"sha2-512",code:19,encode:r=>pt(hn.default.createHash("sha512").update(r).digest())});var mn={};U(mn,{identity:()=>ip});var wo=0,sp="identity",yo=pt,op=r=>zt(wo,yo(r)),ip={code:wo,name:sp,encode:yo,digest:op};var Qd=new TextEncoder,Yd=new TextDecoder;var vo={...rn,...nn,...sn,...on,...an,...Rr,...cn,...Ir,...fn,...un},nm={...dn,...mn};function bn(r,t="utf8"){let e=Ve[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?fe(globalThis.Buffer.from(r,"utf-8")):e.decoder.decode(`${e.prefix}${r}`)}var vt=X(je(),1);var Ot=wt("node:net");function Ge(r){return!!(0,Ot.isIP)(r)}var xo=Ot.isIPv4,fp=Ot.isIPv6,gn=function(r){let t=0;if(r=r.toString().trim(),xo(r)){let e=new Uint8Array(t+4);return r.split(/\./g).forEach(n=>{e[t++]=parseInt(n,10)&255}),e}if(fp(r)){let e=r.split(":",8),n;for(n=0;n<e.length;n++){let c=xo(e[n]),u;c&&(u=gn(e[n]),e[n]=st(u.slice(0,2),"base16")),u!=null&&++n<8&&e.splice(n,0,st(u.slice(2,4),"base16"))}if(e[0]==="")for(;e.length<8;)e.unshift("0");else if(e[e.length-1]==="")for(;e.length<8;)e.push("0");else if(e.length<8){for(n=0;n<e.length&&e[n]!=="";n++);let c=[n,1];for(n=9-e.length;n>0;n--)c.push("0");e.splice.apply(e,c)}let s=new Uint8Array(t+16);for(n=0;n<e.length;n++){let c=parseInt(e[n],16);s[t++]=c>>8&255,s[t++]=c&255}return s}throw new Error("invalid ip address")},So=function(r,t=0,e){t=~~t,e=e??r.length-t;let n=new DataView(r.buffer);if(e===4){let s=[];for(let c=0;c<e;c++)s.push(r[t+c]);return s.join(".")}if(e===16){let s=[];for(let c=0;c<e;c+=2)s.push(n.getUint16(t+c).toString(16));return s.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var Ce={},wn={},pp=[[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"]];pp.forEach(r=>{let t=lp(...r);wn[t.code]=t,Ce[t.name]=t});function lp(r,t,e,n,s){return{code:r,size:t,name:e,resolvable:!!n,path:!!s}}function N(r){if(typeof r=="number"){if(wn[r]!=null)return wn[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(Ce[r]!=null)return Ce[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var Sm=N("ip4"),Tm=N("ip6"),Em=N("ipcidr");function Io(r,t){switch(N(r).code){case 4:case 41:return dp(t);case 42:return Ao(t);case 6:case 273:case 33:case 132:return Ro(t).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Ao(t);case 421:return wp(t);case 444:return Co(t);case 445:return Co(t);case 466:return gp(t);default:return st(t,"base16")}}function Bo(r,t){switch(N(r).code){case 4:return To(t);case 41:return To(t);case 42:return Eo(t);case 6:case 273:case 33:case 132:return vn(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Eo(t);case 421:return mp(t);case 444:return yp(t);case 445:return vp(t);case 466:return bp(t);default:return bn(t,"base16")}}var yn=Object.values(vo).map(r=>r.decoder),hp=function(){let r=yn[0].or(yn[1]);return yn.slice(2).forEach(t=>r=r.or(t)),r}();function To(r){if(!Ge(r))throw new Error("invalid ip address");return gn(r)}function dp(r){let t=So(r,0,r.length);if(t==null)throw new Error("ipBuff is required");if(!Ge(t))throw new Error("invalid ip address");return t}function vn(r){let t=new ArrayBuffer(2);return new DataView(t).setUint16(0,r),new Uint8Array(t)}function Ro(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function Eo(r){let t=bn(r),e=Uint8Array.from(vt.default.encode(t.length));return At([e,t],e.length+t.length)}function Ao(r){let t=vt.default.decode(r);if(r=r.slice(vt.default.decode.bytes),r.length!==t)throw new Error("inconsistent lengths");return st(r)}function mp(r){let t;r[0]==="Q"||r[0]==="1"?t=Le(nt.decode(`z${r}`)).bytes:t=_.parse(r).multihash.bytes;let e=Uint8Array.from(vt.default.encode(t.length));return At([e,t],e.length+t.length)}function bp(r){let t=hp.decode(r),e=Uint8Array.from(vt.default.encode(t.length));return At([e,t],e.length+t.length)}function gp(r){let t=vt.default.decode(r),e=r.slice(vt.default.decode.bytes);if(e.length!==t)throw new Error("inconsistent lengths");return"u"+st(e,"base64url")}function wp(r){let t=vt.default.decode(r),e=r.slice(vt.default.decode.bytes);if(e.length!==t)throw new Error("inconsistent lengths");return st(e,"base58btc")}function yp(r){let t=r.split(":");if(t.length!==2)throw new Error(`failed to parse onion addr: ["'${t.join('", "')}'"]' does not contain a port number`);if(t[0].length!==16)throw new Error(`failed to parse onion addr: ${t[0]} not a Tor onion address.`);let e=Et.decode("b"+t[0]),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let s=vn(n);return At([e,s],e.length+s.length)}function vp(r){let t=r.split(":");if(t.length!==2)throw new Error(`failed to parse onion addr: ["'${t.join('", "')}'"]' does not contain a port number`);if(t[0].length!==56)throw new Error(`failed to parse onion addr: ${t[0]} not a Tor onion3 address.`);let e=Et.decode(`b${t[0]}`),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let s=vn(n);return At([e,s],e.length+s.length)}function Co(r){let t=r.slice(0,r.length-2),e=r.slice(r.length-2),n=st(t,"base32"),s=Ro(e);return`${n}:${s}`}function xp(r){let t=[],e=r.split("/").slice(1);if(e.length===1&&e[0]==="")return[];for(let n=0;n<e.length;n++){let s=e[n],c=N(s);if(c.size===0){t.push([s]);continue}if(n++,n>=e.length)throw Do("invalid address: "+r);if(c.path===!0){t.push([s,An(e.slice(n).join("/"))]);break}t.push([s,e[n]])}return t}function Sp(r){let t=[];return r.map(e=>{let n=Je(e);return t.push(n.name),e.length>1&&e[1]!=null&&t.push(e[1]),null}),An(t.join("/"))}function Tp(r){return r.map(t=>{Array.isArray(t)||(t=[t]);let e=Je(t);return t.length>1?[e.code,Bo(e.code,t[1])]:[e.code]})}function xn(r){return r.map(t=>{let e=Je(t);return t[1]!=null?[e.code,Io(e.code,t[1])]:[e.code]})}function Sn(r){return Ze(At(r.map(t=>{let e=Je(t),n=Uint8Array.from(ue.default.encode(e.code));return t.length>1&&t[1]!=null&&(n=At([n,t[1]])),n})))}function Tn(r,t){return r.size>0?r.size/8:r.size===0?0:ue.default.decode(t)+(ue.default.decode.bytes??0)}function He(r){let t=[],e=0;for(;e<r.length;){let n=ue.default.decode(r,e),s=ue.default.decode.bytes??0,c=N(n),u=Tn(c,r.slice(e+s));if(u===0){t.push([n]),e+=s;continue}let h=r.slice(e+s,e+s+u);if(e+=u+s,e>r.length)throw Do("Invalid address Uint8Array: "+st(r,"base16"));t.push([n,h])}return t}function En(r){let t=He(r),e=xn(t);return Sp(e)}function Ep(r){r=An(r);let t=xp(r),e=Tp(t);return Sn(e)}function Mo(r){return Ep(r)}function Ze(r){let t=Ap(r);if(t!=null)throw t;return Uint8Array.from(r)}function Ap(r){try{He(r)}catch(t){return t}}function An(r){return"/"+r.trim().split("/").filter(t=>t).join("/")}function Do(r){return new Error("Error parsing address: "+r)}function Je(r){return N(r[0])}var Ip=Symbol.for("nodejs.util.inspect.custom"),Bp=[N("dns").code,N("dns4").code,N("dns6").code,N("dnsaddr").code],Rp=new Map,ko=Symbol.for("@multiformats/js-multiaddr/multiaddr");function Mp(r){return!!r?.[ko]}var Ct=class{bytes;#t;#r;#n;#e;[ko]=!0;constructor(t){if(t==null&&(t=""),t instanceof Uint8Array)this.bytes=Ze(t);else if(typeof t=="string"){if(t.length>0&&t.charAt(0)!=="/")throw new Error(`multiaddr "${t}" must start with a "/"`);this.bytes=Mo(t)}else if(Mp(t))this.bytes=Ze(t.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return this.#t==null&&(this.#t=En(this.bytes)),this.#t}toJSON(){return this.toString()}toOptions(){let t,e,n,s,c="",u=N("tcp"),h=N("udp"),m=N("ip4"),I=N("ip6"),p=N("dns6"),g=N("ip6zone");for(let[E,l]of this.stringTuples())E===g.code&&(c=`%${l??""}`),Bp.includes(E)&&(e=u.name,s=443,n=`${l??""}${c}`,t=E===p.code?6:4),(E===u.code||E===h.code)&&(e=N(E).name,s=parseInt(l??"")),(E===m.code||E===I.code)&&(e=N(E).name,n=`${l??""}${c}`,t=E===I.code?6:4);if(t==null||e==null||n==null||s==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:t,host:n,transport:e,port:s}}protos(){return this.protoCodes().map(t=>Object.assign({},N(t)))}protoCodes(){let t=[],e=this.bytes,n=0;for(;n<e.length;){let s=Cn.default.decode(e,n),c=Cn.default.decode.bytes??0,u=N(s),h=Tn(u,e.slice(n+c));n+=h+c,t.push(s)}return t}protoNames(){return this.protos().map(t=>t.name)}tuples(){return this.#r==null&&(this.#r=He(this.bytes)),this.#r}stringTuples(){return this.#n==null&&(this.#n=xn(this.tuples())),this.#n}encapsulate(t){return t=new Ct(t),new Ct(this.toString()+t.toString())}decapsulate(t){let e=t.toString(),n=this.toString(),s=n.lastIndexOf(e);if(s<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${t.toString()}`);return new Ct(n.slice(0,s))}decapsulateCode(t){let e=this.tuples();for(let n=e.length-1;n>=0;n--)if(e[n][0]===t)return new Ct(Sn(e.slice(0,n)));return this}getPeerId(){try{let e=this.stringTuples().filter(n=>n[0]===Ce.ipfs.code).pop();if(e?.[1]!=null){let n=e[1];return n[0]==="Q"||n[0]==="1"?st(nt.decode(`z${n}`),"base58btc"):st(_.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){if(this.#e===void 0)try{this.#e=this.stringTuples().filter(t=>N(t[0]).path===!0)[0][1],this.#e==null&&(this.#e=null)}catch{this.#e=null}return this.#e}equals(t){return Us(this.bytes,t.bytes)}async resolve(t){let e=this.protos().find(c=>c.resolvable);if(e==null)return[this];let n=Rp.get(e.name);if(n==null)throw new Ue(`no available resolver for ${e.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,t)).map(c=>new Ct(c))}nodeAddress(){let t=this.toOptions();if(t.transport!=="tcp"&&t.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${t.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:t.family,address:t.host,port:t.port}}isThinWaistAddress(t){let e=(t??this).protos();return!(e.length!==2||e[0].code!==4&&e[0].code!==41||e[1].code!==6&&e[1].code!==273)}[Ip](){return`Multiaddr(${En(this.bytes)})`}};function xt(r){return new Ct(r)}var Dp=v("dns4"),kp=v("dns6"),Pp=v("dnsaddr"),qt=q(v("dns"),Pp,Dp,kp),Qe=q(v("ip4"),v("ip6")),Ft=q(C(Qe,v("tcp")),C(qt,v("tcp"))),Ye=C(Qe,v("udp")),Op=C(Ye,v("utp")),Np=C(Ye,v("quic")),Fp=C(Ye,v("quic-v1")),In=q(C(Ft,v("ws")),C(qt,v("ws"))),Xe=q(C(In,v("p2p")),In),Bn=q(C(Ft,v("wss")),C(qt,v("wss")),C(Ft,v("tls"),v("ws")),C(qt,v("tls"),v("ws"))),We=q(C(Bn,v("p2p")),Bn),Rn=q(C(Ft,v("http")),C(Qe,v("http")),C(qt,v("http"))),Mn=q(C(Ft,v("https")),C(Qe,v("https")),C(qt,v("https"))),Po=C(Ye,v("webrtc-direct"),v("certhash")),Fo=q(C(Po,v("p2p")),Po),Oo=C(Fp,v("webtransport"),v("certhash"),v("certhash")),Uo=q(C(Oo,v("p2p")),Oo),_o=q(C(Xe,v("p2p-webrtc-star"),v("p2p")),C(We,v("p2p-webrtc-star"),v("p2p")),C(Xe,v("p2p-webrtc-star")),C(We,v("p2p-webrtc-star"))),qm=q(C(Xe,v("p2p-websocket-star"),v("p2p")),C(We,v("p2p-websocket-star"),v("p2p")),C(Xe,v("p2p-websocket-star")),C(We,v("p2p-websocket-star"))),Lo=q(C(Rn,v("p2p-webrtc-direct"),v("p2p")),C(Mn,v("p2p-webrtc-direct"),v("p2p")),C(Rn,v("p2p-webrtc-direct")),C(Mn,v("p2p-webrtc-direct"))),Gt=q(In,Bn,Rn,Mn,_o,Lo,Ft,Op,Np,qt,Fo,Uo),Gm=q(C(Gt,v("p2p-stardust"),v("p2p")),C(Gt,v("p2p-stardust"))),Nt=q(C(Gt,v("p2p")),_o,Lo,Fo,Uo,v("p2p")),No=q(C(Nt,v("p2p-circuit"),Nt),C(Nt,v("p2p-circuit")),C(v("p2p-circuit"),Nt),C(Gt,v("p2p-circuit")),C(v("p2p-circuit"),Gt),v("p2p-circuit")),$o=()=>q(C(No,$o),No),jt=$o(),Hm=q(C(jt,Nt,jt),C(Nt,jt),C(jt,Nt),jt,Nt);var Zm=q(C(jt,v("webrtc"),v("p2p")),C(jt,v("webrtc")),C(Gt,v("webrtc"),v("p2p")),C(Gt,v("webrtc")),v("webrtc"));function zo(r){function t(e){let n;try{n=xt(e)}catch{return!1}let s=r(n.protoNames());return s===null?!1:s===!0||s===!1?s:s.length===0}return t}function C(...r){function t(e){if(e.length<r.length)return null;let n=e;return r.some(s=>(n=typeof s=="function"?s().partialMatch(e):s.partialMatch(e),Array.isArray(n)&&(e=n),n===null)),n}return{toString:function(){return"{ "+r.join(" ")+" }"},input:r,matches:zo(t),partialMatch:t}}function q(...r){function t(n){let s=null;return r.some(c=>{let u=typeof c=="function"?c().partialMatch(n):c.partialMatch(n);return u!=null?(s=u,!0):!1}),s}return{toString:function(){return"{ "+r.join(" ")+" }"},input:r,matches:zo(t),partialMatch:t}}function v(r){let t=r;function e(s){let c;try{c=xt(s)}catch{return!1}let u=c.protoNames();return u.length===1&&u[0]===t}function n(s){return s.length===0?null:s[0]===t?s.slice(1):null}return{toString:function(){return t},matches:e,partialMatch:n}}var pi=X(wt("net"),1);var Ke=class extends EventTarget{#t=new Map;listenerCount(t){let e=this.#t.get(t);return e==null?0:e.length}addEventListener(t,e,n){super.addEventListener(t,e,n);let s=this.#t.get(t);s==null&&(s=[],this.#t.set(t,s)),s.push({callback:e,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(t,e,n){super.removeEventListener(t.toString(),e??null,n);let s=this.#t.get(t);s!=null&&(s=s.filter(({callback:c})=>c!==e),this.#t.set(t,s))}dispatchEvent(t){let e=super.dispatchEvent(t),n=this.#t.get(t.type);return n==null||(n=n.filter(({once:s})=>!s),this.#t.set(t.type,n)),e}safeDispatchEvent(t,e){return this.dispatchEvent(new pe(t,e))}},Dn=class extends Event{detail;constructor(t,e){super(t,e),this.detail=e?.detail}},pe=globalThis.CustomEvent??Dn;function tr(r){return this.subnetMask<r.subnetMask?!1:this.mask(r.subnetMask)===r.mask()}function er(r){return function(){return this.addressMinusSuffix!==this.correctForm()?!1:this.subnetMask===r&&!this.parsedSubnet?!0:this.parsedSubnet===String(this.subnetMask)}}var le=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g,kn=/\/\d{1,2}$/;var Y=class extends Error{constructor(t,e){super(t),this.name="AddressError",e!==null&&(this.parseMessage=e)}};var he=X(Pn(),1),Ht=X(Ie(),1),L=class{constructor(t){this.groups=4,this.parsedAddress=[],this.parsedSubnet="",this.subnet="/32",this.subnetMask=32,this.v4=!0,this.isCorrect=er(32),this.isInSubnet=tr,this.address=t;let e=kn.exec(t);if(e){if(this.parsedSubnet=e[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,this.subnetMask<0||this.subnetMask>32)throw new Y("Invalid subnet mask.");t=t.replace(kn,"")}this.addressMinusSuffix=t,this.parsedAddress=this.parse(t)}static isValid(t){try{return new L(t),!0}catch{return!1}}parse(t){let e=t.split(".");if(!t.match(le))throw new Y("Invalid IPv4 address.");return e}correctForm(){return this.parsedAddress.map(t=>parseInt(t,10)).join(".")}static fromHex(t){let e=t.replace(/:/g,"").padStart(8,"0"),n=[],s;for(s=0;s<8;s+=2){let c=e.slice(s,s+2);n.push(parseInt(c,16))}return new L(n.join("."))}static fromInteger(t){return L.fromHex(t.toString(16))}static fromArpa(t){let n=t.replace(/(\.in-addr\.arpa)?\.$/,"").split(".").reverse().join(".");return new L(n)}toHex(){return this.parsedAddress.map(t=>(0,Ht.sprintf)("%02x",parseInt(t,10))).join(":")}toArray(){return this.parsedAddress.map(t=>parseInt(t,10))}toGroup6(){let t=[],e;for(e=0;e<4;e+=2){let n=(0,Ht.sprintf)("%02x%02x",parseInt(this.parsedAddress[e],10),parseInt(this.parsedAddress[e+1],10));t.push((0,Ht.sprintf)("%x",parseInt(n,16)))}return t.join(":")}bigInteger(){return new he.BigInteger(this.parsedAddress.map(t=>(0,Ht.sprintf)("%02x",parseInt(t,10))).join(""),16)}_startAddress(){return new he.BigInteger(this.mask()+"0".repeat(32-this.subnetMask),2)}startAddress(){return L.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new he.BigInteger("1");return L.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new he.BigInteger(this.mask()+"1".repeat(32-this.subnetMask),2)}endAddress(){return L.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new he.BigInteger("1");return L.fromBigInteger(this._endAddress().subtract(t))}static fromBigInteger(t){return L.fromInteger(parseInt(t.toString(),10))}mask(t){return t===void 0&&(t=this.subnetMask),this.getBitsBase2(0,t)}getBitsBase2(t,e){return this.binaryZeroPad().slice(t,e)}reverseForm(t){t||(t={});let e=this.correctForm().split(".").reverse().join(".");return t.omitSuffix?e:(0,Ht.sprintf)("%s.in-addr.arpa.",e)}isMulticast(){return this.isInSubnet(new L("224.0.0.0/4"))}binaryZeroPad(){return this.bigInteger().toString(2).padStart(32,"0")}groupForV6(){let t=this.parsedAddress;return this.address.replace(le,(0,Ht.sprintf)('<span class="hover-group group-v4 group-6">%s</span>.<span class="hover-group group-v4 group-7">%s</span>',t.slice(0,2).join("."),t.slice(2,4).join(".")))}};var Ho={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"},On={"ff01::1/128":"Multicast (All nodes on this interface)","ff01::2/128":"Multicast (All routers on this interface)","ff02::1/128":"Multicast (All nodes on this link)","ff02::2/128":"Multicast (All routers on this link)","ff05::2/128":"Multicast (All routers in this site)","ff02::5/128":"Multicast (OSPFv3 AllSPF routers)","ff02::6/128":"Multicast (OSPFv3 AllDR routers)","ff02::9/128":"Multicast (RIP routers)","ff02::a/128":"Multicast (EIGRP routers)","ff02::d/128":"Multicast (PIM routers)","ff02::16/128":"Multicast (MLDv2 reports)","ff01::fb/128":"Multicast (mDNSv6)","ff02::fb/128":"Multicast (mDNSv6)","ff05::fb/128":"Multicast (mDNSv6)","ff02::1:2/128":"Multicast (All DHCP servers and relay agents on this link)","ff05::1:2/128":"Multicast (All DHCP servers and relay agents in this site)","ff02::1:3/128":"Multicast (All DHCP servers on this link)","ff05::1:3/128":"Multicast (All DHCP servers in this site)","::/128":"Unspecified","::1/128":"Loopback","ff00::/8":"Multicast","fe80::/10":"Link-local unicast"},Nn=/([^0-9a-f:/%])/gi,Fn=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi,Un=/\/\d{1,3}(?=%|$)/,_n=/%.*$/,Zo=new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/),Jo=new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/);var Wo=X(Ie(),1);function _p(r){return r.replace(/^(0+)/,'<span class="zero">$1</span>')}function sr(r,t=0){return r.split(":").map((n,s)=>/group-v4/.test(n)?n:(0,Wo.sprintf)('<span class="hover-group group-%d">%s</span>',s+t,_p(n)))}var Jt=X(Ie(),1);function $n(r){return(0,Jt.sprintf)("(%s)",r.join("|"))}function Ln(r){return r.length<4?(0,Jt.sprintf)("0{0,%d}%s",4-r.length,r):r}var zn="[^A-Fa-f0-9:]";function or(r){let t=[];r.forEach((n,s)=>{parseInt(n,16)===0&&t.push(s)});let e=t.map(n=>r.map((s,c)=>{if(c===n){let u=c===0||c===8-1?":":"";return $n([Ln(s),u])}return Ln(s)}).join(":"));return e.push(r.map(Ln).join(":")),$n(e)}function Vn(r,t,e){let n=t?"":":",s=e?"":":",c=[];!t&&!e&&c.push("::"),t&&e&&c.push(""),(e&&!t||!e&&t)&&c.push(":"),c.push((0,Jt.sprintf)("%s(:0{1,4}){1,%d}",n,r-1)),c.push((0,Jt.sprintf)("(0{1,4}:){1,%d}%s",r-1,s)),c.push((0,Jt.sprintf)("(0{1,4}:){%d}0{1,4}",r-1));for(let u=1;u<r-1;u++)for(let h=1;h<r-u;h++)c.push((0,Jt.sprintf)("(0{1,4}:){%d}:(0{1,4}:){%d}0{1,4}",h,r-h-u-1));return $n(c)}var K=X(Pn(),1),tt=X(Ie(),1);function ir(r){if(!r)throw new Error("Assertion failed.")}function Lp(r){let t=/(\d+)(\d{3})/;for(;t.test(r);)r=r.replace(t,"$1,$2");return r}function $p(r){return r=r.replace(/^(0{1,})([1-9]+)$/,'<span class="parse-error">$1</span>$2'),r=r.replace(/^(0{1,})(0)$/,'<span class="parse-error">$1</span>$2'),r}function zp(r,t){let e=[],n=[],s;for(s=0;s<r.length;s++)s<t[0]?e.push(r[s]):s>t[1]&&n.push(r[s]);return e.concat(["compact"]).concat(n)}function Yo(r){return(0,tt.sprintf)("%04x",parseInt(r,16))}function Ko(r){return r&255}var V=class{constructor(t,e){this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=tr,this.isCorrect=er(128),e===void 0?this.groups=8:this.groups=e,this.address=t;let n=Un.exec(t);if(n){if(this.parsedSubnet=n[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,Number.isNaN(this.subnetMask)||this.subnetMask<0||this.subnetMask>128)throw new Y("Invalid subnet mask.");t=t.replace(Un,"")}else if(/\//.test(t))throw new Y("Invalid subnet mask.");let s=_n.exec(t);s&&(this.zone=s[0],t=t.replace(_n,"")),this.addressMinusSuffix=t,this.parsedAddress=this.parse(this.addressMinusSuffix)}static isValid(t){try{return new V(t),!0}catch{return!1}}static fromBigInteger(t){let e=t.toString(16).padStart(32,"0"),n=[],s;for(s=0;s<8;s++)n.push(e.slice(s*4,(s+1)*4));return new V(n.join(":"))}static fromURL(t){let e,n=null,s;if(t.indexOf("[")!==-1&&t.indexOf("]:")!==-1){if(s=Jo.exec(t),s===null)return{error:"failed to parse address with port",address:null,port:null};e=s[1],n=s[2]}else if(t.indexOf("/")!==-1){if(t=t.replace(/^[a-z0-9]+:\/\//,""),s=Zo.exec(t),s===null)return{error:"failed to parse address from URL",address:null,port:null};e=s[1]}else e=t;return n?(n=parseInt(n,10),(n<0||n>65536)&&(n=null)):n=null,{address:new V(e),port:n}}static fromAddress4(t){let e=new L(t),n=128-(32-e.subnetMask);return new V(`::ffff:${e.correctForm()}/${n}`)}static fromArpa(t){let e=t.replace(/(\.ip6\.arpa)?\.$/,""),n=7;if(e.length!==63)throw new Y("Invalid 'ip6.arpa' form.");let s=e.split(".").reverse();for(let c=n;c>0;c--){let u=c*4;s.splice(u,0,":")}return e=s.join(""),new V(e)}microsoftTranscription(){return(0,tt.sprintf)("%s.ipv6-literal.net",this.correctForm().replace(/:/g,"-"))}mask(t=this.subnetMask){return this.getBitsBase2(0,t)}possibleSubnets(t=128){let e=128-this.subnetMask,n=Math.abs(t-128),s=e-n;return s<0?"0":Lp(new K.BigInteger("2",10).pow(s).toString(10))}_startAddress(){return new K.BigInteger(this.mask()+"0".repeat(128-this.subnetMask),2)}startAddress(){return V.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new K.BigInteger("1");return V.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new K.BigInteger(this.mask()+"1".repeat(128-this.subnetMask),2)}endAddress(){return V.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new K.BigInteger("1");return V.fromBigInteger(this._endAddress().subtract(t))}getScope(){let t=Ho[this.getBits(12,16).intValue()];return this.getType()==="Global unicast"&&t!=="Link local"&&(t="Global"),t||"Unknown"}getType(){for(let t of Object.keys(On))if(this.isInSubnet(new V(t)))return On[t];return"Global unicast"}getBits(t,e){return new K.BigInteger(this.getBitsBase2(t,e),2)}getBitsBase2(t,e){return this.binaryZeroPad().slice(t,e)}getBitsBase16(t,e){let n=e-t;if(n%4!==0)throw new Error("Length of bits to retrieve must be divisible by four");return this.getBits(t,e).toString(16).padStart(n/4,"0")}getBitsPastSubnet(){return this.getBitsBase2(this.subnetMask,128)}reverseForm(t){t||(t={});let e=Math.floor(this.subnetMask/4),n=this.canonicalForm().replace(/:/g,"").split("").slice(0,e).reverse().join(".");return e>0?t.omitSuffix?n:(0,tt.sprintf)("%s.ip6.arpa.",n):t.omitSuffix?"":"ip6.arpa."}correctForm(){let t,e=[],n=0,s=[];for(t=0;t<this.parsedAddress.length;t++){let h=parseInt(this.parsedAddress[t],16);h===0&&n++,h!==0&&n>0&&(n>1&&s.push([t-n,t-1]),n=0)}n>1&&s.push([this.parsedAddress.length-n,this.parsedAddress.length-1]);let c=s.map(h=>h[1]-h[0]+1);if(s.length>0){let h=c.indexOf(Math.max(...c));e=zp(this.parsedAddress,s[h])}else e=this.parsedAddress;for(t=0;t<e.length;t++)e[t]!=="compact"&&(e[t]=parseInt(e[t],16).toString(16));let u=e.join(":");return u=u.replace(/^compact$/,"::"),u=u.replace(/^compact|compact$/,":"),u=u.replace(/compact/,""),u}binaryZeroPad(){return this.bigInteger().toString(2).padStart(128,"0")}parse4in6(t){let e=t.split(":"),s=e.slice(-1)[0].match(le);if(s){this.parsedAddress4=s[0],this.address4=new L(this.parsedAddress4);for(let c=0;c<this.address4.groups;c++)if(/^0[0-9]+/.test(this.address4.parsedAddress[c]))throw new Y("IPv4 addresses can't have leading zeroes.",t.replace(le,this.address4.parsedAddress.map($p).join(".")));this.v4=!0,e[e.length-1]=this.address4.toGroup6(),t=e.join(":")}return t}parse(t){t=this.parse4in6(t);let e=t.match(Nn);if(e)throw new Y((0,tt.sprintf)("Bad character%s detected in address: %s",e.length>1?"s":"",e.join("")),t.replace(Nn,'<span class="parse-error">$1</span>'));let n=t.match(Fn);if(n)throw new Y((0,tt.sprintf)("Address failed regex: %s",n.join("")),t.replace(Fn,'<span class="parse-error">$1</span>'));let s=[],c=t.split("::");if(c.length===2){let u=c[0].split(":"),h=c[1].split(":");u.length===1&&u[0]===""&&(u=[]),h.length===1&&h[0]===""&&(h=[]);let m=this.groups-(u.length+h.length);if(!m)throw new Y("Error parsing groups");this.elidedGroups=m,this.elisionBegin=u.length,this.elisionEnd=u.length+this.elidedGroups,s=s.concat(u);for(let I=0;I<m;I++)s.push("0");s=s.concat(h)}else if(c.length===1)s=t.split(":"),this.elidedGroups=0;else throw new Y("Too many :: groups found");if(s=s.map(u=>(0,tt.sprintf)("%x",parseInt(u,16))),s.length!==this.groups)throw new Y("Incorrect number of groups found");return s}canonicalForm(){return this.parsedAddress.map(Yo).join(":")}decimal(){return this.parsedAddress.map(t=>(0,tt.sprintf)("%05d",parseInt(t,16))).join(":")}bigInteger(){return new K.BigInteger(this.parsedAddress.map(Yo).join(""),16)}to4(){let t=this.binaryZeroPad().split("");return L.fromHex(new K.BigInteger(t.slice(96,128).join(""),2).toString(16))}to4in6(){let t=this.to4(),n=new V(this.parsedAddress.slice(0,6).join(":"),6).correctForm(),s="";return/:$/.test(n)||(s=":"),n+s+t.address}inspectTeredo(){let t=this.getBitsBase16(0,32),e=this.getBits(80,96).xor(new K.BigInteger("ffff",16)).toString(),n=L.fromHex(this.getBitsBase16(32,64)),s=L.fromHex(this.getBits(96,128).xor(new K.BigInteger("ffffffff",16)).toString(16)),c=this.getBits(64,80),u=this.getBitsBase2(64,80),h=c.testBit(15),m=c.testBit(14),I=c.testBit(8),p=c.testBit(9),g=new K.BigInteger(u.slice(2,6)+u.slice(8,16),2).toString(10);return{prefix:(0,tt.sprintf)("%s:%s",t.slice(0,4),t.slice(4,8)),server4:n.address,client4:s.address,flags:u,coneNat:h,microsoft:{reserved:m,universalLocal:p,groupIndividual:I,nonce:g},udpPort:e}}inspect6to4(){let t=this.getBitsBase16(0,16),e=L.fromHex(this.getBitsBase16(16,48));return{prefix:(0,tt.sprintf)("%s",t.slice(0,4)),gateway:e.address}}to6to4(){if(!this.is4())return null;let t=["2002",this.getBitsBase16(96,112),this.getBitsBase16(112,128),"","/16"].join(":");return new V(t)}toByteArray(){let t=this.bigInteger().toByteArray();return t.length===17&&t[0]===0?t.slice(1):t}toUnsignedByteArray(){return this.toByteArray().map(Ko)}static fromByteArray(t){return this.fromUnsignedByteArray(t.map(Ko))}static fromUnsignedByteArray(t){let e=new K.BigInteger("256",10),n=new K.BigInteger("0",10),s=new K.BigInteger("1",10);for(let c=t.length-1;c>=0;c--)n=n.add(s.multiply(new K.BigInteger(t[c].toString(10),10))),s=s.multiply(e);return V.fromBigInteger(n)}isCanonical(){return this.addressMinusSuffix===this.canonicalForm()}isLinkLocal(){return this.getBitsBase2(0,64)==="1111111010000000000000000000000000000000000000000000000000000000"}isMulticast(){return this.getType()==="Multicast"}is4(){return this.v4}isTeredo(){return this.isInSubnet(new V("2001::/32"))}is6to4(){return this.isInSubnet(new V("2002::/16"))}isLoopback(){return this.getType()==="Loopback"}href(t){return t===void 0?t="":t=(0,tt.sprintf)(":%s",t),(0,tt.sprintf)("http://[%s]%s/",this.correctForm(),t)}link(t){t||(t={}),t.className===void 0&&(t.className=""),t.prefix===void 0&&(t.prefix="/#address="),t.v4===void 0&&(t.v4=!1);let e=this.correctForm;return t.v4&&(e=this.to4in6),t.className?(0,tt.sprintf)('<a href="%1$s%2$s" class="%3$s">%2$s</a>',t.prefix,e.call(this),t.className):(0,tt.sprintf)('<a href="%1$s%2$s">%2$s</a>',t.prefix,e.call(this))}group(){if(this.elidedGroups===0)return sr(this.address).join(":");ir(typeof this.elidedGroups=="number"),ir(typeof this.elisionBegin=="number");let t=[],[e,n]=this.address.split("::");e.length?t.push(...sr(e)):t.push("");let s=["hover-group"];for(let c=this.elisionBegin;c<this.elisionBegin+this.elidedGroups;c++)s.push((0,tt.sprintf)("group-%d",c));return t.push((0,tt.sprintf)('<span class="%s"></span>',s.join(" "))),n.length?t.push(...sr(n,this.elisionEnd)):t.push(""),this.is4()&&(ir(this.address4 instanceof L),t.pop(),t.push(this.address4.groupForV6())),t.join(":")}regularExpressionString(t=!1){let e=[],n=new V(this.correctForm());if(n.elidedGroups===0)e.push(or(n.parsedAddress));else if(n.elidedGroups===8)e.push(Vn(8));else{let s=n.address.split("::");s[0].length&&e.push(or(s[0].split(":"))),ir(typeof n.elidedGroups=="number"),e.push(Vn(n.elidedGroups,s[0].length!==0,s[1].length!==0)),s[1].length&&e.push(or(s[1].split(":"))),e=[e.join(":")]}return t||(e=["(?=^|",zn,"|[^\\w\\:])(",...e,")(?=[^\\w\\:]|",zn,"|$)"]),e.join("")}regularExpression(t=!1){return new RegExp(this.regularExpressionString(t),"i")}};var Vp=Dt("libp2p:ip-port-to-multiaddr"),jn={ERR_INVALID_IP_PARAMETER:"ERR_INVALID_IP_PARAMETER",ERR_INVALID_PORT_PARAMETER:"ERR_INVALID_PORT_PARAMETER",ERR_INVALID_IP:"ERR_INVALID_IP"};function ti(r,t){if(typeof r!="string")throw new bt(`invalid ip provided: ${r}`,jn.ERR_INVALID_IP_PARAMETER);if(typeof t=="string"&&(t=parseInt(t)),isNaN(t))throw new bt(`invalid port provided: ${t}`,jn.ERR_INVALID_PORT_PARAMETER);try{return new L(r),xt(`/ip4/${r}/tcp/${t}`)}catch{}try{let e=new V(r);return e.is4()?xt(`/ip4/${e.to4().correctForm()}/tcp/${t}`):xt(`/ip6/${r}/tcp/${t}`)}catch{let n=`invalid ip:port for creating a multiaddr: ${r}:${t}`;throw Vp.error(n),new bt(n,jn.ERR_INVALID_IP)}}var ui=X(ci(),1);var Hn=X(wt("os"),1),fi=X(wt("path"),1);var Zp={ip4:"IPv4",ip6:"IPv6"};function be(r,t={}){let e=r.getPath();return e!=null?Hn.default.platform()==="win32"?{path:fi.default.join("\\\\.\\pipe\\",e)}:{path:e}:{...r.toOptions(),...t}}function Zn(r,t,e){let n=s=>xt(`/${r}/${s}/tcp/${e}`);return(Jp(t)?Wp(Zp[r]):[t]).map(n)}function Jp(r){return["0.0.0.0","::"].includes(r)}var Xp=Hn.default.networkInterfaces();function Wp(r){let t=[];for(let[,e]of Object.entries(Xp))if(e!=null)for(let n of e)n.family===r&&t.push(n.address);return t}var St=Dt("libp2p:tcp:socket"),cr=(r,t)=>{let e=t.metrics,n=t.metricPrefix??"",s=t.socketInactivityTimeout??3e5,c=t.socketCloseTimeout??500;t.listeningAddr?.getPath()!=null&&(t.remoteAddr=t.listeningAddr),t.remoteAddr?.getPath()!=null&&(t.localAddr=t.remoteAddr);let u;if(t.remoteAddr!=null)u=t.remoteAddr;else{if(r.remoteAddress==null||r.remotePort==null)throw new bt("Could not determine remote address or port","ERR_NO_REMOTE_ADDRESS");u=ti(r.remoteAddress,r.remotePort)}let h=be(u),m=h.path??`${h.host??""}:${h.port??""}`,{sink:I,source:p}=ui.default.duplex(r);r.setTimeout(s,()=>{St("%s socket read timeout",m),e?.increment({[`${n}timeout`]:!0});let w;r.readable&&(w=new bt("Socket read timeout","ERR_SOCKET_READ_TIMEOUT")),r.destroy(w)}),r.once("close",()=>{St("%s socket close",m),e?.increment({[`${n}close`]:!0}),g.timeline.close==null&&(g.timeline.close=Date.now())}),r.once("end",()=>{St("%s socket end",m),e?.increment({[`${n}end`]:!0})});let g={async sink(w){try{await I(w)}catch(E){E.type!=="aborted"&&St(E)}r.end()},source:p,remoteAddr:u,timeline:{open:Date.now()},async close(w={}){if(r.destroyed){St("%s socket was already destroyed when trying to close",m);return}w.signal=w.signal??AbortSignal.timeout(c);try{St("%s closing socket",m),await new Promise((E,l)=>{r.once("close",()=>{St("%s socket closed",m),E()}),r.once("error",x=>{St("%s socket error",m,x),g.timeline.close==null&&(g.timeline.close=Date.now()),l(x)}),r.setTimeout(c),r.end(),r.writableLength>0?r.once("drain",()=>{St("%s socket drained",m),r.destroy()}):r.destroy()})}catch(E){this.abort(E)}},abort:w=>{St("%s socket abort due to error",m,w),r.destroy(w)}};return g};var ft=Dt("libp2p:tcp:listener");async function Jn(r){try{await r.close()}catch(t){ft.error("an error occurred closing the connection",t)}}var Kp=1,tl=0,fr=class extends Ke{context;server;connections=new Set;status={started:!1};metrics;addr;constructor(t){if(super(),this.context=t,t.keepAlive=t.keepAlive??!0,this.addr="unknown",this.server=pi.default.createServer(t,this.onSocket.bind(this)),t.maxConnections!==void 0&&(this.server.maxConnections=t.maxConnections),t.closeServerOnMaxConnections!=null&&t.closeServerOnMaxConnections.closeAbove<t.closeServerOnMaxConnections.listenBelow)throw Error("closeAbove must be >= listenBelow");this.server.on("listening",()=>{if(t.metrics!=null){let e=this.server.address();e==null?this.addr="unknown":typeof e=="string"?this.addr=e:this.addr=`${e.address}:${e.port}`,t.metrics?.registerMetricGroup("libp2p_tcp_inbound_connections_total",{label:"address",help:"Current active connections in TCP listener",calculate:()=>({[this.addr]:this.connections.size})}),this.metrics={status:t.metrics.registerMetricGroup("libp2p_tcp_listener_status_info",{label:"address",help:"Current status of the TCP listener socket"}),errors:t.metrics.registerMetricGroup("libp2p_tcp_listener_errors_total",{label:"address",help:"Total count of TCP listener errors by type"}),events:t.metrics.registerMetricGroup("libp2p_tcp_listener_events_total",{label:"address",help:"Total count of TCP listener events by type"})},this.metrics?.status.update({[this.addr]:Kp})}this.dispatchEvent(new pe("listening"))}).on("error",e=>{this.metrics?.errors.increment({[`${this.addr} listen_error`]:!0}),this.dispatchEvent(new pe("error",{detail:e}))}).on("close",()=>{this.metrics?.status.update({[this.addr]:tl}),this.dispatchEvent(new pe("close"))})}onSocket(t){t.on("error",n=>{ft("socket error",n),this.metrics?.events.increment({[`${this.addr} error`]:!0})});let e;try{e=cr(t,{listeningAddr:this.status.started?this.status.listeningAddr:void 0,socketInactivityTimeout:this.context.socketInactivityTimeout,socketCloseTimeout:this.context.socketCloseTimeout,metrics:this.metrics?.events,metricPrefix:`${this.addr} `})}catch(n){ft.error("inbound connection failed",n),this.metrics?.errors.increment({[`${this.addr} inbound_to_connection`]:!0});return}ft("new inbound connection %s",e.remoteAddr);try{this.context.upgrader.upgradeInbound(e).then(n=>{ft("inbound connection upgraded %s",e.remoteAddr),this.connections.add(e),t.once("close",()=>{this.connections.delete(e),this.context.closeServerOnMaxConnections!=null&&this.connections.size<this.context.closeServerOnMaxConnections.listenBelow&&this.netListen().catch(s=>{ft.error("error attempting to listen server once connection count under limit",s),this.context.closeServerOnMaxConnections?.onListenError?.(s)})}),this.context.handler!=null&&this.context.handler(n),this.context.closeServerOnMaxConnections!=null&&this.connections.size>=this.context.closeServerOnMaxConnections.closeAbove&&this.netClose(),this.dispatchEvent(new pe("connection",{detail:n}))}).catch(async n=>{ft.error("inbound connection failed",n),this.metrics?.errors.increment({[`${this.addr} inbound_upgrade`]:!0}),await Jn(e)}).catch(n=>{ft.error("closing inbound connection failed",n)})}catch(n){ft.error("inbound connection failed",n),Jn(e).catch(s=>{ft.error("closing inbound connection failed",s),this.metrics?.errors.increment({[`${this.addr} inbound_closing_failed`]:!0})})}}getAddrs(){if(!this.status.started)return[];let t=[],e=this.server.address(),{listeningAddr:n,peerId:s}=this.status;if(e==null)return[];if(typeof e=="string")t=[n];else try{n.toString().startsWith("/ip4")?t=t.concat(Zn("ip4",e.address,e.port)):e.family==="IPv6"&&(t=t.concat(Zn("ip6",e.address,e.port)))}catch(c){ft.error("could not turn %s:%s into multiaddr",e.address,e.port,c)}return t.map(c=>s!=null?c.encapsulate(`/p2p/${s}`):c)}async listen(t){if(this.status.started)throw Error("server is already listening");let e=t.getPeerId(),n=e==null?t.decapsulateCode(421):t,{backlog:s}=this.context;this.status={started:!0,listeningAddr:n,peerId:e,netConfig:be(n,{backlog:s})},await this.netListen()}async close(){await Promise.all(Array.from(this.connections.values()).map(async t=>{await Jn(t)})),this.netClose()}async netListen(){if(!this.status.started||this.server.listening)return;let t=this.status.netConfig;await new Promise((e,n)=>{this.server.once("error",n),this.server.listen(t,e)}),ft("Listening on %s",this.server.address())}netClose(){!this.status.started||!this.server.listening||(ft("Closing server on %s",this.server.address()),this.server.close())}};var Bt=Dt("libp2p:tcp"),Wn=class{opts;metrics;components;constructor(t,e={}){this.opts=e,this.components=t,t.metrics!=null&&(this.metrics={dialerEvents:t.metrics.registerCounterGroup("libp2p_tcp_dialer_events_total",{label:"event",help:"Total count of TCP dialer events by type"})})}[os]=!0;[Symbol.toStringTag]="@libp2p/tcp";async dial(t,e){e.keepAlive=e.keepAlive??!0;let n=await this._connect(t,e);n.on("error",h=>{Bt("socket error",h)});let s=cr(n,{remoteAddr:t,socketInactivityTimeout:this.opts.outboundSocketInactivityTimeout,socketCloseTimeout:this.opts.socketCloseTimeout,metrics:this.metrics?.dialerEvents}),c=()=>{s.close().catch(h=>{Bt.error("Error closing maConn after abort",h)})};e.signal?.addEventListener("abort",c,{once:!0}),Bt("new outbound connection %s",s.remoteAddr);let u=await e.upgrader.upgradeOutbound(s);if(Bt("outbound connection %s upgraded",s.remoteAddr),e.signal?.removeEventListener("abort",c),e.signal?.aborted===!0)throw u.close().catch(h=>{Bt.error("Error closing conn after abort",h)}),new Mt;return u}async _connect(t,e){if(e.signal?.aborted===!0)throw new Mt;return new Promise((n,s)=>{let c=Date.now(),u=be(t),h=u.path??`${u.host??""}:${u.port}`;Bt("dialing %j",u);let m=li.default.connect(u),I=l=>{l.message=`connection error ${h}: ${l.message}`,this.metrics?.dialerEvents.increment({error:!0}),E(l)},p=()=>{Bt("connection timeout %s",h),this.metrics?.dialerEvents.increment({timeout:!0});let l=new bt(`connection timeout after ${Date.now()-c}ms`,"ERR_CONNECT_TIMEOUT");m.emit("error",l)},g=()=>{Bt("connection opened %j",u),this.metrics?.dialerEvents.increment({connect:!0}),E()},w=()=>{Bt("connection aborted %j",u),this.metrics?.dialerEvents.increment({abort:!0}),m.destroy(),E(new Mt)},E=l=>{if(m.removeListener("error",I),m.removeListener("timeout",p),m.removeListener("connect",g),e.signal!=null&&e.signal.removeEventListener("abort",w),l!=null){s(l);return}n(m)};m.on("error",I),m.on("timeout",p),m.on("connect",g),e.signal!=null&&e.signal.addEventListener("abort",w)})}createListener(t){return new fr({...t,maxConnections:this.opts.maxConnections,backlog:this.opts.backlog,closeServerOnMaxConnections:this.opts.closeServerOnMaxConnections,socketInactivityTimeout:this.opts.inboundSocketInactivityTimeout,socketCloseTimeout:this.opts.socketCloseTimeout,metrics:this.components.metrics})}filter(t){return t=Array.isArray(t)?t:[t],t.filter(e=>e.protoCodes().includes(290)?!1:e.protoCodes().includes(400)?!0:Ft.matches(e.decapsulateCode(421)))}};function nl(r={}){return(t={})=>new Wn(t,r)}return Ka(sl);})();
4
+ `+c),r.push(o+"m+"+De.exports.humanize(this.diff)+"\x1B[0m")}else r[0]=Ya()+t+" "+r[0]}function Ya(){return q.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Ka(...r){return process.stderr.write(Re.format(...r)+`
5
+ `)}function tc(r){r?process.env.DEBUG=r:delete process.env.DEBUG}function ec(){return process.env.DEBUG}function rc(r){r.inspectOpts={};let t=Object.keys(q.inspectOpts);for(let e=0;e<t.length;e++)r.inspectOpts[t[e]]=q.inspectOpts[t[e]]}De.exports=ar()(q);var{formatters:ns}=De.exports;ns.o=function(r){return this.inspectOpts.colors=this.useColors,Re.inspect(r,this.inspectOpts).split(`
6
+ `).map(t=>t.trim()).join(" ")};ns.O=function(r){return this.inspectOpts.colors=this.useColors,Re.inspect(r,this.inspectOpts)}});var os=z((Np,ur)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?ur.exports=Yn():ur.exports=ss()});var Vs=z((Ql,zs)=>{zs.exports=jr;var $s=128,Yu=127,Ku=~Yu,tf=Math.pow(2,31);function jr(r,t,e){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw jr.bytes=0,new RangeError("Could not encode varint");t=t||[],e=e||0;for(var n=e;r>=tf;)t[e++]=r&255|$s,r/=128;for(;r&Ku;)t[e++]=r&255|$s,r>>>=7;return t[e]=r|0,jr.bytes=e-n+1,t}});var Gs=z((Yl,qs)=>{qs.exports=qr;var ef=128,js=127;function qr(r,n){var e=0,n=n||0,o=0,c=n,f,l=r.length;do{if(c>=l||o>49)throw qr.bytes=0,new RangeError("Could not decode varint");f=r[c++],e+=o<28?(f&js)<<o:(f&js)*Math.pow(2,o),o+=7}while(f>=ef);return qr.bytes=c-n,e}});var Zs=z((Kl,Hs)=>{var rf=Math.pow(2,7),nf=Math.pow(2,14),sf=Math.pow(2,21),of=Math.pow(2,28),af=Math.pow(2,35),cf=Math.pow(2,42),uf=Math.pow(2,49),ff=Math.pow(2,56),pf=Math.pow(2,63);Hs.exports=function(r){return r<rf?1:r<nf?2:r<sf?3:r<of?4:r<af?5:r<cf?6:r<uf?7:r<ff?8:r<pf?9:10}});var Gr=z((th,Ws)=>{Ws.exports={encode:Vs(),decode:Gs(),encodingLength:Zs()}});var Sn=z((We,Eo)=>{(function(){var r,t=0xdeadbeefcafe,e=(t&16777215)==15715070;function n(s,i,a){s!=null&&(typeof s=="number"?this.fromNumber(s,i,a):i==null&&typeof s!="string"?this.fromString(s,256):this.fromString(s,i))}function o(){return new n(null)}function c(s,i,a,u,d,m){for(;--m>=0;){var w=i*this[s++]+a[u]+d;d=Math.floor(w/67108864),a[u++]=w&67108863}return d}function f(s,i,a,u,d,m){for(var w=i&32767,x=i>>15;--m>=0;){var k=this[s]&32767,j=this[s++]>>15,it=x*k+j*w;k=w*k+((it&32767)<<15)+a[u]+(d&1073741823),d=(k>>>30)+(it>>>15)+x*j+(d>>>30),a[u++]=k&1073741823}return d}function l(s,i,a,u,d,m){for(var w=i&16383,x=i>>14;--m>=0;){var k=this[s]&16383,j=this[s++]>>14,it=x*k+j*w;k=w*k+((it&16383)<<14)+a[u]+d,d=(k>>28)+(it>>14)+x*j,a[u++]=k&268435455}return d}var g=typeof navigator<"u";g&&e&&navigator.appName=="Microsoft Internet Explorer"?(n.prototype.am=f,r=30):g&&e&&navigator.appName!="Netscape"?(n.prototype.am=c,r=26):(n.prototype.am=l,r=28),n.prototype.DB=r,n.prototype.DM=(1<<r)-1,n.prototype.DV=1<<r;var A=52;n.prototype.FV=Math.pow(2,A),n.prototype.F1=A-r,n.prototype.F2=2*r-A;var p="0123456789abcdefghijklmnopqrstuvwxyz",b=new Array,y,S;for(y="0".charCodeAt(0),S=0;S<=9;++S)b[y++]=S;for(y="a".charCodeAt(0),S=10;S<36;++S)b[y++]=S;for(y="A".charCodeAt(0),S=10;S<36;++S)b[y++]=S;function h(s){return p.charAt(s)}function T(s,i){var a=b[s.charCodeAt(i)];return a??-1}function B(s){for(var i=this.t-1;i>=0;--i)s[i]=this[i];s.t=this.t,s.s=this.s}function C(s){this.t=1,this.s=s<0?-1:0,s>0?this[0]=s:s<-1?this[0]=s+this.DV:this.t=0}function I(s){var i=o();return i.fromInt(s),i}function M(s,i){var a;if(i==16)a=4;else if(i==8)a=3;else if(i==256)a=8;else if(i==2)a=1;else if(i==32)a=5;else if(i==4)a=2;else{this.fromRadix(s,i);return}this.t=0,this.s=0;for(var u=s.length,d=!1,m=0;--u>=0;){var w=a==8?s[u]&255:T(s,u);if(w<0){s.charAt(u)=="-"&&(d=!0);continue}d=!1,m==0?this[this.t++]=w:m+a>this.DB?(this[this.t-1]|=(w&(1<<this.DB-m)-1)<<m,this[this.t++]=w>>this.DB-m):this[this.t-1]|=w<<m,m+=a,m>=this.DB&&(m-=this.DB)}a==8&&s[0]&128&&(this.s=-1,m>0&&(this[this.t-1]|=(1<<this.DB-m)-1<<m)),this.clamp(),d&&n.ZERO.subTo(this,this)}function R(){for(var s=this.s&this.DM;this.t>0&&this[this.t-1]==s;)--this.t}function N(s){if(this.s<0)return"-"+this.negate().toString(s);var i;if(s==16)i=4;else if(s==8)i=3;else if(s==2)i=1;else if(s==32)i=5;else if(s==4)i=2;else return this.toRadix(s);var a=(1<<i)-1,u,d=!1,m="",w=this.t,x=this.DB-w*this.DB%i;if(w-- >0)for(x<this.DB&&(u=this[w]>>x)>0&&(d=!0,m=h(u));w>=0;)x<i?(u=(this[w]&(1<<x)-1)<<i-x,u|=this[--w]>>(x+=this.DB-i)):(u=this[w]>>(x-=i)&a,x<=0&&(x+=this.DB,--w)),u>0&&(d=!0),d&&(m+=h(u));return d?m:"0"}function _(){var s=o();return n.ZERO.subTo(this,s),s}function D(){return this.s<0?this.negate():this}function F(s){var i=this.s-s.s;if(i!=0)return i;var a=this.t;if(i=a-s.t,i!=0)return this.s<0?-i:i;for(;--a>=0;)if((i=this[a]-s[a])!=0)return i;return 0}function G(s){var i=1,a;return(a=s>>>16)!=0&&(s=a,i+=16),(a=s>>8)!=0&&(s=a,i+=8),(a=s>>4)!=0&&(s=a,i+=4),(a=s>>2)!=0&&(s=a,i+=2),(a=s>>1)!=0&&(s=a,i+=1),i}function Wo(){return this.t<=0?0:this.DB*(this.t-1)+G(this[this.t-1]^this.s&this.DM)}function Jo(s,i){var a;for(a=this.t-1;a>=0;--a)i[a+s]=this[a];for(a=s-1;a>=0;--a)i[a]=0;i.t=this.t+s,i.s=this.s}function Xo(s,i){for(var a=s;a<this.t;++a)i[a-s]=this[a];i.t=Math.max(this.t-s,0),i.s=this.s}function Qo(s,i){var a=s%this.DB,u=this.DB-a,d=(1<<u)-1,m=Math.floor(s/this.DB),w=this.s<<a&this.DM,x;for(x=this.t-1;x>=0;--x)i[x+m+1]=this[x]>>u|w,w=(this[x]&d)<<a;for(x=m-1;x>=0;--x)i[x]=0;i[m]=w,i.t=this.t+m+1,i.s=this.s,i.clamp()}function Yo(s,i){i.s=this.s;var a=Math.floor(s/this.DB);if(a>=this.t){i.t=0;return}var u=s%this.DB,d=this.DB-u,m=(1<<u)-1;i[0]=this[a]>>u;for(var w=a+1;w<this.t;++w)i[w-a-1]|=(this[w]&m)<<d,i[w-a]=this[w]>>u;u>0&&(i[this.t-a-1]|=(this.s&m)<<d),i.t=this.t-a,i.clamp()}function Ko(s,i){for(var a=0,u=0,d=Math.min(s.t,this.t);a<d;)u+=this[a]-s[a],i[a++]=u&this.DM,u>>=this.DB;if(s.t<this.t){for(u-=s.s;a<this.t;)u+=this[a],i[a++]=u&this.DM,u>>=this.DB;u+=this.s}else{for(u+=this.s;a<s.t;)u-=s[a],i[a++]=u&this.DM,u>>=this.DB;u-=s.s}i.s=u<0?-1:0,u<-1?i[a++]=this.DV+u:u>0&&(i[a++]=u),i.t=a,i.clamp()}function ti(s,i){var a=this.abs(),u=s.abs(),d=a.t;for(i.t=d+u.t;--d>=0;)i[d]=0;for(d=0;d<u.t;++d)i[d+a.t]=a.am(0,u[d],i,d,0,a.t);i.s=0,i.clamp(),this.s!=s.s&&n.ZERO.subTo(i,i)}function ei(s){for(var i=this.abs(),a=s.t=2*i.t;--a>=0;)s[a]=0;for(a=0;a<i.t-1;++a){var u=i.am(a,i[a],s,2*a,0,1);(s[a+i.t]+=i.am(a+1,2*i[a],s,2*a+1,u,i.t-a-1))>=i.DV&&(s[a+i.t]-=i.DV,s[a+i.t+1]=1)}s.t>0&&(s[s.t-1]+=i.am(a,i[a],s,2*a,0,1)),s.s=0,s.clamp()}function ri(s,i,a){var u=s.abs();if(!(u.t<=0)){var d=this.abs();if(d.t<u.t){i?.fromInt(0),a!=null&&this.copyTo(a);return}a==null&&(a=o());var m=o(),w=this.s,x=s.s,k=this.DB-G(u[u.t-1]);k>0?(u.lShiftTo(k,m),d.lShiftTo(k,a)):(u.copyTo(m),d.copyTo(a));var j=m.t,it=m[j-1];if(it!=0){var et=it*(1<<this.F1)+(j>1?m[j-2]>>this.F2:0),vt=this.FV/et,Ee=(1<<this.F1)/et,ft=1<<this.F2,pt=a.t,Ae=pt-j,Ct=i??o();for(m.dlShiftTo(Ae,Ct),a.compareTo(Ct)>=0&&(a[a.t++]=1,a.subTo(Ct,a)),n.ONE.dlShiftTo(j,Ct),Ct.subTo(m,m);m.t<j;)m[m.t++]=0;for(;--Ae>=0;){var ir=a[--pt]==it?this.DM:Math.floor(a[pt]*vt+(a[pt-1]+ft)*Ee);if((a[pt]+=m.am(0,ir,a,Ae,0,j))<ir)for(m.dlShiftTo(Ae,Ct),a.subTo(Ct,a);a[pt]<--ir;)a.subTo(Ct,a)}i!=null&&(a.drShiftTo(j,i),w!=x&&n.ZERO.subTo(i,i)),a.t=j,a.clamp(),k>0&&a.rShiftTo(k,a),w<0&&n.ZERO.subTo(a,a)}}}function ni(s){var i=o();return this.abs().divRemTo(s,null,i),this.s<0&&i.compareTo(n.ZERO)>0&&s.subTo(i,i),i}function Pt(s){this.m=s}function si(s){return s.s<0||s.compareTo(this.m)>=0?s.mod(this.m):s}function oi(s){return s}function ii(s){s.divRemTo(this.m,null,s)}function ai(s,i,a){s.multiplyTo(i,a),this.reduce(a)}function ci(s,i){s.squareTo(i),this.reduce(i)}Pt.prototype.convert=si,Pt.prototype.revert=oi,Pt.prototype.reduce=ii,Pt.prototype.mulTo=ai,Pt.prototype.sqrTo=ci;function ui(){if(this.t<1)return 0;var s=this[0];if(!(s&1))return 0;var i=s&3;return i=i*(2-(s&15)*i)&15,i=i*(2-(s&255)*i)&255,i=i*(2-((s&65535)*i&65535))&65535,i=i*(2-s*i%this.DV)%this.DV,i>0?this.DV-i:-i}function kt(s){this.m=s,this.mp=s.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<s.DB-15)-1,this.mt2=2*s.t}function fi(s){var i=o();return s.abs().dlShiftTo(this.m.t,i),i.divRemTo(this.m,null,i),s.s<0&&i.compareTo(n.ZERO)>0&&this.m.subTo(i,i),i}function pi(s){var i=o();return s.copyTo(i),this.reduce(i),i}function li(s){for(;s.t<=this.mt2;)s[s.t++]=0;for(var i=0;i<this.m.t;++i){var a=s[i]&32767,u=a*this.mpl+((a*this.mph+(s[i]>>15)*this.mpl&this.um)<<15)&s.DM;for(a=i+this.m.t,s[a]+=this.m.am(0,u,s,i,0,this.m.t);s[a]>=s.DV;)s[a]-=s.DV,s[++a]++}s.clamp(),s.drShiftTo(this.m.t,s),s.compareTo(this.m)>=0&&s.subTo(this.m,s)}function hi(s,i){s.squareTo(i),this.reduce(i)}function di(s,i,a){s.multiplyTo(i,a),this.reduce(a)}kt.prototype.convert=fi,kt.prototype.revert=pi,kt.prototype.reduce=li,kt.prototype.mulTo=di,kt.prototype.sqrTo=hi;function mi(){return(this.t>0?this[0]&1:this.s)==0}function gi(s,i){if(s>4294967295||s<1)return n.ONE;var a=o(),u=o(),d=i.convert(this),m=G(s)-1;for(d.copyTo(a);--m>=0;)if(i.sqrTo(a,u),(s&1<<m)>0)i.mulTo(u,d,a);else{var w=a;a=u,u=w}return i.revert(a)}function bi(s,i){var a;return s<256||i.isEven()?a=new Pt(i):a=new kt(i),this.exp(s,a)}n.prototype.copyTo=B,n.prototype.fromInt=C,n.prototype.fromString=M,n.prototype.clamp=R,n.prototype.dlShiftTo=Jo,n.prototype.drShiftTo=Xo,n.prototype.lShiftTo=Qo,n.prototype.rShiftTo=Yo,n.prototype.subTo=Ko,n.prototype.multiplyTo=ti,n.prototype.squareTo=ei,n.prototype.divRemTo=ri,n.prototype.invDigit=ui,n.prototype.isEven=mi,n.prototype.exp=gi,n.prototype.toString=N,n.prototype.negate=_,n.prototype.abs=D,n.prototype.compareTo=F,n.prototype.bitLength=Wo,n.prototype.mod=ni,n.prototype.modPowInt=bi,n.ZERO=I(0),n.ONE=I(1);function wi(){var s=o();return this.copyTo(s),s}function yi(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function vi(){return this.t==0?this.s:this[0]<<24>>24}function xi(){return this.t==0?this.s:this[0]<<16>>16}function Si(s){return Math.floor(Math.LN2*this.DB/Math.log(s))}function Ti(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function Ci(s){if(s==null&&(s=10),this.signum()==0||s<2||s>36)return"0";var i=this.chunkSize(s),a=Math.pow(s,i),u=I(a),d=o(),m=o(),w="";for(this.divRemTo(u,d,m);d.signum()>0;)w=(a+m.intValue()).toString(s).substr(1)+w,d.divRemTo(u,d,m);return m.intValue().toString(s)+w}function Ei(s,i){this.fromInt(0),i==null&&(i=10);for(var a=this.chunkSize(i),u=Math.pow(i,a),d=!1,m=0,w=0,x=0;x<s.length;++x){var k=T(s,x);if(k<0){s.charAt(x)=="-"&&this.signum()==0&&(d=!0);continue}w=i*w+k,++m>=a&&(this.dMultiply(u),this.dAddOffset(w,0),m=0,w=0)}m>0&&(this.dMultiply(Math.pow(i,m)),this.dAddOffset(w,0)),d&&n.ZERO.subTo(this,this)}function Ai(s,i,a){if(typeof i=="number")if(s<2)this.fromInt(1);else for(this.fromNumber(s,a),this.testBit(s-1)||this.bitwiseTo(n.ONE.shiftLeft(s-1),rr,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(i);)this.dAddOffset(2,0),this.bitLength()>s&&this.subTo(n.ONE.shiftLeft(s-1),this);else{var u=new Array,d=s&7;u.length=(s>>3)+1,i.nextBytes(u),d>0?u[0]&=(1<<d)-1:u[0]=0,this.fromString(u,256)}}function Ii(){var s=this.t,i=new Array;i[0]=this.s;var a=this.DB-s*this.DB%8,u,d=0;if(s-- >0)for(a<this.DB&&(u=this[s]>>a)!=(this.s&this.DM)>>a&&(i[d++]=u|this.s<<this.DB-a);s>=0;)a<8?(u=(this[s]&(1<<a)-1)<<8-a,u|=this[--s]>>(a+=this.DB-8)):(u=this[s]>>(a-=8)&255,a<=0&&(a+=this.DB,--s)),u&128&&(u|=-256),d==0&&(this.s&128)!=(u&128)&&++d,(d>0||u!=this.s)&&(i[d++]=u);return i}function Bi(s){return this.compareTo(s)==0}function Mi(s){return this.compareTo(s)<0?this:s}function Ri(s){return this.compareTo(s)>0?this:s}function Di(s,i,a){var u,d,m=Math.min(s.t,this.t);for(u=0;u<m;++u)a[u]=i(this[u],s[u]);if(s.t<this.t){for(d=s.s&this.DM,u=m;u<this.t;++u)a[u]=i(this[u],d);a.t=this.t}else{for(d=this.s&this.DM,u=m;u<s.t;++u)a[u]=i(d,s[u]);a.t=s.t}a.s=i(this.s,s.s),a.clamp()}function Pi(s,i){return s&i}function ki(s){var i=o();return this.bitwiseTo(s,Pi,i),i}function rr(s,i){return s|i}function Oi(s){var i=o();return this.bitwiseTo(s,rr,i),i}function $n(s,i){return s^i}function Ni(s){var i=o();return this.bitwiseTo(s,$n,i),i}function zn(s,i){return s&~i}function Fi(s){var i=o();return this.bitwiseTo(s,zn,i),i}function _i(){for(var s=o(),i=0;i<this.t;++i)s[i]=this.DM&~this[i];return s.t=this.t,s.s=~this.s,s}function Ui(s){var i=o();return s<0?this.rShiftTo(-s,i):this.lShiftTo(s,i),i}function Li(s){var i=o();return s<0?this.lShiftTo(-s,i):this.rShiftTo(s,i),i}function $i(s){if(s==0)return-1;var i=0;return s&65535||(s>>=16,i+=16),s&255||(s>>=8,i+=8),s&15||(s>>=4,i+=4),s&3||(s>>=2,i+=2),s&1||++i,i}function zi(){for(var s=0;s<this.t;++s)if(this[s]!=0)return s*this.DB+$i(this[s]);return this.s<0?this.t*this.DB:-1}function Vi(s){for(var i=0;s!=0;)s&=s-1,++i;return i}function ji(){for(var s=0,i=this.s&this.DM,a=0;a<this.t;++a)s+=Vi(this[a]^i);return s}function qi(s){var i=Math.floor(s/this.DB);return i>=this.t?this.s!=0:(this[i]&1<<s%this.DB)!=0}function Gi(s,i){var a=n.ONE.shiftLeft(s);return this.bitwiseTo(a,i,a),a}function Hi(s){return this.changeBit(s,rr)}function Zi(s){return this.changeBit(s,zn)}function Wi(s){return this.changeBit(s,$n)}function Ji(s,i){for(var a=0,u=0,d=Math.min(s.t,this.t);a<d;)u+=this[a]+s[a],i[a++]=u&this.DM,u>>=this.DB;if(s.t<this.t){for(u+=s.s;a<this.t;)u+=this[a],i[a++]=u&this.DM,u>>=this.DB;u+=this.s}else{for(u+=this.s;a<s.t;)u+=s[a],i[a++]=u&this.DM,u>>=this.DB;u+=s.s}i.s=u<0?-1:0,u>0?i[a++]=u:u<-1&&(i[a++]=this.DV+u),i.t=a,i.clamp()}function Xi(s){var i=o();return this.addTo(s,i),i}function Qi(s){var i=o();return this.subTo(s,i),i}function Yi(s){var i=o();return this.multiplyTo(s,i),i}function Ki(){var s=o();return this.squareTo(s),s}function ta(s){var i=o();return this.divRemTo(s,i,null),i}function ea(s){var i=o();return this.divRemTo(s,null,i),i}function ra(s){var i=o(),a=o();return this.divRemTo(s,i,a),new Array(i,a)}function na(s){this[this.t]=this.am(0,s-1,this,0,0,this.t),++this.t,this.clamp()}function sa(s,i){if(s!=0){for(;this.t<=i;)this[this.t++]=0;for(this[i]+=s;this[i]>=this.DV;)this[i]-=this.DV,++i>=this.t&&(this[this.t++]=0),++this[i]}}function de(){}function Vn(s){return s}function oa(s,i,a){s.multiplyTo(i,a)}function ia(s,i){s.squareTo(i)}de.prototype.convert=Vn,de.prototype.revert=Vn,de.prototype.mulTo=oa,de.prototype.sqrTo=ia;function aa(s){return this.exp(s,new de)}function ca(s,i,a){var u=Math.min(this.t+s.t,i);for(a.s=0,a.t=u;u>0;)a[--u]=0;var d;for(d=a.t-this.t;u<d;++u)a[u+this.t]=this.am(0,s[u],a,u,0,this.t);for(d=Math.min(s.t,i);u<d;++u)this.am(0,s[u],a,u,0,i-u);a.clamp()}function ua(s,i,a){--i;var u=a.t=this.t+s.t-i;for(a.s=0;--u>=0;)a[u]=0;for(u=Math.max(i-this.t,0);u<s.t;++u)a[this.t+u-i]=this.am(i-u,s[u],a,0,0,this.t+u-i);a.clamp(),a.drShiftTo(1,a)}function Ot(s){this.r2=o(),this.q3=o(),n.ONE.dlShiftTo(2*s.t,this.r2),this.mu=this.r2.divide(s),this.m=s}function fa(s){if(s.s<0||s.t>2*this.m.t)return s.mod(this.m);if(s.compareTo(this.m)<0)return s;var i=o();return s.copyTo(i),this.reduce(i),i}function pa(s){return s}function la(s){for(s.drShiftTo(this.m.t-1,this.r2),s.t>this.m.t+1&&(s.t=this.m.t+1,s.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);s.compareTo(this.r2)<0;)s.dAddOffset(1,this.m.t+1);for(s.subTo(this.r2,s);s.compareTo(this.m)>=0;)s.subTo(this.m,s)}function ha(s,i){s.squareTo(i),this.reduce(i)}function da(s,i,a){s.multiplyTo(i,a),this.reduce(a)}Ot.prototype.convert=fa,Ot.prototype.revert=pa,Ot.prototype.reduce=la,Ot.prototype.mulTo=da,Ot.prototype.sqrTo=ha;function ma(s,i){var a=s.bitLength(),u,d=I(1),m;if(a<=0)return d;a<18?u=1:a<48?u=3:a<144?u=4:a<768?u=5:u=6,a<8?m=new Pt(i):i.isEven()?m=new Ot(i):m=new kt(i);var w=new Array,x=3,k=u-1,j=(1<<u)-1;if(w[1]=m.convert(this),u>1){var it=o();for(m.sqrTo(w[1],it);x<=j;)w[x]=o(),m.mulTo(it,w[x-2],w[x]),x+=2}var et=s.t-1,vt,Ee=!0,ft=o(),pt;for(a=G(s[et])-1;et>=0;){for(a>=k?vt=s[et]>>a-k&j:(vt=(s[et]&(1<<a+1)-1)<<k-a,et>0&&(vt|=s[et-1]>>this.DB+a-k)),x=u;!(vt&1);)vt>>=1,--x;if((a-=x)<0&&(a+=this.DB,--et),Ee)w[vt].copyTo(d),Ee=!1;else{for(;x>1;)m.sqrTo(d,ft),m.sqrTo(ft,d),x-=2;x>0?m.sqrTo(d,ft):(pt=d,d=ft,ft=pt),m.mulTo(ft,w[vt],d)}for(;et>=0&&!(s[et]&1<<a);)m.sqrTo(d,ft),pt=d,d=ft,ft=pt,--a<0&&(a=this.DB-1,--et)}return m.revert(d)}function ga(s){var i=this.s<0?this.negate():this.clone(),a=s.s<0?s.negate():s.clone();if(i.compareTo(a)<0){var u=i;i=a,a=u}var d=i.getLowestSetBit(),m=a.getLowestSetBit();if(m<0)return i;for(d<m&&(m=d),m>0&&(i.rShiftTo(m,i),a.rShiftTo(m,a));i.signum()>0;)(d=i.getLowestSetBit())>0&&i.rShiftTo(d,i),(d=a.getLowestSetBit())>0&&a.rShiftTo(d,a),i.compareTo(a)>=0?(i.subTo(a,i),i.rShiftTo(1,i)):(a.subTo(i,a),a.rShiftTo(1,a));return m>0&&a.lShiftTo(m,a),a}function ba(s){if(s<=0)return 0;var i=this.DV%s,a=this.s<0?s-1:0;if(this.t>0)if(i==0)a=this[0]%s;else for(var u=this.t-1;u>=0;--u)a=(i*a+this[u])%s;return a}function wa(s){var i=s.isEven();if(this.isEven()&&i||s.signum()==0)return n.ZERO;for(var a=s.clone(),u=this.clone(),d=I(1),m=I(0),w=I(0),x=I(1);a.signum()!=0;){for(;a.isEven();)a.rShiftTo(1,a),i?((!d.isEven()||!m.isEven())&&(d.addTo(this,d),m.subTo(s,m)),d.rShiftTo(1,d)):m.isEven()||m.subTo(s,m),m.rShiftTo(1,m);for(;u.isEven();)u.rShiftTo(1,u),i?((!w.isEven()||!x.isEven())&&(w.addTo(this,w),x.subTo(s,x)),w.rShiftTo(1,w)):x.isEven()||x.subTo(s,x),x.rShiftTo(1,x);a.compareTo(u)>=0?(a.subTo(u,a),i&&d.subTo(w,d),m.subTo(x,m)):(u.subTo(a,u),i&&w.subTo(d,w),x.subTo(m,x))}if(u.compareTo(n.ONE)!=0)return n.ZERO;if(x.compareTo(s)>=0)return x.subtract(s);if(x.signum()<0)x.addTo(s,x);else return x;return x.signum()<0?x.add(s):x}var Y=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],ya=(1<<26)/Y[Y.length-1];function va(s){var i,a=this.abs();if(a.t==1&&a[0]<=Y[Y.length-1]){for(i=0;i<Y.length;++i)if(a[0]==Y[i])return!0;return!1}if(a.isEven())return!1;for(i=1;i<Y.length;){for(var u=Y[i],d=i+1;d<Y.length&&u<ya;)u*=Y[d++];for(u=a.modInt(u);i<d;)if(u%Y[i++]==0)return!1}return a.millerRabin(s)}function xa(s){var i=this.subtract(n.ONE),a=i.getLowestSetBit();if(a<=0)return!1;var u=i.shiftRight(a);s=s+1>>1,s>Y.length&&(s=Y.length);for(var d=o(),m=0;m<s;++m){d.fromInt(Y[Math.floor(Math.random()*Y.length)]);var w=d.modPow(u,this);if(w.compareTo(n.ONE)!=0&&w.compareTo(i)!=0){for(var x=1;x++<a&&w.compareTo(i)!=0;)if(w=w.modPowInt(2,this),w.compareTo(n.ONE)==0)return!1;if(w.compareTo(i)!=0)return!1}}return!0}n.prototype.chunkSize=Si,n.prototype.toRadix=Ci,n.prototype.fromRadix=Ei,n.prototype.fromNumber=Ai,n.prototype.bitwiseTo=Di,n.prototype.changeBit=Gi,n.prototype.addTo=Ji,n.prototype.dMultiply=na,n.prototype.dAddOffset=sa,n.prototype.multiplyLowerTo=ca,n.prototype.multiplyUpperTo=ua,n.prototype.modInt=ba,n.prototype.millerRabin=xa,n.prototype.clone=wi,n.prototype.intValue=yi,n.prototype.byteValue=vi,n.prototype.shortValue=xi,n.prototype.signum=Ti,n.prototype.toByteArray=Ii,n.prototype.equals=Bi,n.prototype.min=Mi,n.prototype.max=Ri,n.prototype.and=ki,n.prototype.or=Oi,n.prototype.xor=Ni,n.prototype.andNot=Fi,n.prototype.not=_i,n.prototype.shiftLeft=Ui,n.prototype.shiftRight=Li,n.prototype.getLowestSetBit=zi,n.prototype.bitCount=ji,n.prototype.testBit=qi,n.prototype.setBit=Hi,n.prototype.clearBit=Zi,n.prototype.flipBit=Wi,n.prototype.add=Xi,n.prototype.subtract=Qi,n.prototype.multiply=Yi,n.prototype.divide=ta,n.prototype.remainder=ea,n.prototype.divideAndRemainder=ra,n.prototype.modPow=ma,n.prototype.modInverse=wa,n.prototype.pow=aa,n.prototype.gcd=ga,n.prototype.isProbablePrime=va,n.prototype.square=Ki,n.prototype.Barrett=Ot;var Ce,tt,V;function Sa(s){tt[V++]^=s&255,tt[V++]^=s>>8&255,tt[V++]^=s>>16&255,tt[V++]^=s>>24&255,V>=or&&(V-=or)}function jn(){Sa(new Date().getTime())}if(tt==null){tt=new Array,V=0;var ut;if(typeof window<"u"&&window.crypto){if(window.crypto.getRandomValues){var qn=new Uint8Array(32);for(window.crypto.getRandomValues(qn),ut=0;ut<32;++ut)tt[V++]=qn[ut]}else if(navigator.appName=="Netscape"&&navigator.appVersion<"5"){var Gn=window.crypto.random(32);for(ut=0;ut<Gn.length;++ut)tt[V++]=Gn.charCodeAt(ut)&255}}for(;V<or;)ut=Math.floor(65536*Math.random()),tt[V++]=ut>>>8,tt[V++]=ut&255;V=0,jn()}function Ta(){if(Ce==null){for(jn(),Ce=Ia(),Ce.init(tt),V=0;V<tt.length;++V)tt[V]=0;V=0}return Ce.next()}function Ca(s){var i;for(i=0;i<s.length;++i)s[i]=Ta()}function nr(){}nr.prototype.nextBytes=Ca;function sr(){this.i=0,this.j=0,this.S=new Array}function Ea(s){var i,a,u;for(i=0;i<256;++i)this.S[i]=i;for(a=0,i=0;i<256;++i)a=a+this.S[i]+s[i%s.length]&255,u=this.S[i],this.S[i]=this.S[a],this.S[a]=u;this.i=0,this.j=0}function Aa(){var s;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,s=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=s,this.S[s+this.S[this.i]&255]}sr.prototype.init=Ea,sr.prototype.next=Aa;function Ia(){return new sr}var or=256;typeof We<"u"?We=Eo.exports={default:n,BigInteger:n,SecureRandom:nr}:this.jsbn={BigInteger:n,SecureRandom:nr}}).call(We)});var Se=z(Je=>{(function(){"use strict";var r={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function t(f){return n(c(f),arguments)}function e(f,l){return t.apply(null,[f].concat(l||[]))}function n(f,l){var g=1,A=f.length,p,b="",y,S,h,T,B,C,I,M;for(y=0;y<A;y++)if(typeof f[y]=="string")b+=f[y];else if(typeof f[y]=="object"){if(h=f[y],h.keys)for(p=l[g],S=0;S<h.keys.length;S++){if(p==null)throw new Error(t('[sprintf] Cannot access property "%s" of undefined value "%s"',h.keys[S],h.keys[S-1]));p=p[h.keys[S]]}else h.param_no?p=l[h.param_no]:p=l[g++];if(r.not_type.test(h.type)&&r.not_primitive.test(h.type)&&p instanceof Function&&(p=p()),r.numeric_arg.test(h.type)&&typeof p!="number"&&isNaN(p))throw new TypeError(t("[sprintf] expecting number but found %T",p));switch(r.number.test(h.type)&&(I=p>=0),h.type){case"b":p=parseInt(p,10).toString(2);break;case"c":p=String.fromCharCode(parseInt(p,10));break;case"d":case"i":p=parseInt(p,10);break;case"j":p=JSON.stringify(p,null,h.width?parseInt(h.width):0);break;case"e":p=h.precision?parseFloat(p).toExponential(h.precision):parseFloat(p).toExponential();break;case"f":p=h.precision?parseFloat(p).toFixed(h.precision):parseFloat(p);break;case"g":p=h.precision?String(Number(p.toPrecision(h.precision))):parseFloat(p);break;case"o":p=(parseInt(p,10)>>>0).toString(8);break;case"s":p=String(p),p=h.precision?p.substring(0,h.precision):p;break;case"t":p=String(!!p),p=h.precision?p.substring(0,h.precision):p;break;case"T":p=Object.prototype.toString.call(p).slice(8,-1).toLowerCase(),p=h.precision?p.substring(0,h.precision):p;break;case"u":p=parseInt(p,10)>>>0;break;case"v":p=p.valueOf(),p=h.precision?p.substring(0,h.precision):p;break;case"x":p=(parseInt(p,10)>>>0).toString(16);break;case"X":p=(parseInt(p,10)>>>0).toString(16).toUpperCase();break}r.json.test(h.type)?b+=p:(r.number.test(h.type)&&(!I||h.sign)?(M=I?"+":"-",p=p.toString().replace(r.sign,"")):M="",B=h.pad_char?h.pad_char==="0"?"0":h.pad_char.charAt(1):" ",C=h.width-(M+p).length,T=h.width&&C>0?B.repeat(C):"",b+=h.align?M+p+T:B==="0"?M+T+p:T+M+p)}return b}var o=Object.create(null);function c(f){if(o[f])return o[f];for(var l=f,g,A=[],p=0;l;){if((g=r.text.exec(l))!==null)A.push(g[0]);else if((g=r.modulo.exec(l))!==null)A.push("%");else if((g=r.placeholder.exec(l))!==null){if(g[2]){p|=1;var b=[],y=g[2],S=[];if((S=r.key.exec(y))!==null)for(b.push(S[1]);(y=y.substring(S[0].length))!=="";)if((S=r.key_access.exec(y))!==null)b.push(S[1]);else if((S=r.index_access.exec(y))!==null)b.push(S[1]);else throw new SyntaxError("[sprintf] failed to parse named argument key");else throw new SyntaxError("[sprintf] failed to parse named argument key");g[2]=b}else p|=2;if(p===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");A.push({placeholder:g[0],param_no:g[1],keys:g[2],sign:g[3],pad_char:g[4],align:g[5],width:g[6],precision:g[7],type:g[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");l=l.substring(g[0].length)}return o[f]=A}typeof Je<"u"&&(Je.sprintf=t,Je.vsprintf=e),typeof window<"u"&&(window.sprintf=t,window.vsprintf=e,typeof define=="function"&&define.amd&&define(function(){return{sprintf:t,vsprintf:e}}))})()});var Ke=z((hm,Fo)=>{Fo.exports=r=>{if(r[Symbol.asyncIterator])return r;if(r.getReader)return async function*(){let t=r.getReader();try{for(;;){let{done:e,value:n}=await t.read();if(e)return;yield n}}finally{t.releaseLock()}}();throw new Error("unknown stream")}});var Uo=z((dm,_o)=>{_o.exports=function(t){if(t){if(typeof t[Symbol.iterator]=="function")return t[Symbol.iterator]();if(typeof t[Symbol.asyncIterator]=="function")return t[Symbol.asyncIterator]();if(typeof t.next=="function")return t}throw new Error("argument is not an iterator or iterable")}});var kn=z((mm,Lo)=>{var lp=Uo();Lo.exports=r=>async t=>{t=lp(t);let e=C=>{typeof C.return=="function"&&C.return()},n=null,o=null,c=C=>{n=C,o&&o(C),e(t)},f=null,l=!1,g=()=>{l=!0,f&&f()},A=null,p=!1,b=()=>{p=!0,A&&A()},y=null,S=()=>{y&&y()},h=()=>new Promise((C,I)=>{f=y=C,o=I,r.once("drain",S)}),T=()=>(e(t),new Promise((C,I)=>{if(l||p||n)return C();A=f=C,o=I})),B=()=>{r.removeListener("error",c),r.removeListener("close",g),r.removeListener("finish",b),r.removeListener("drain",S)};r.once("error",c),r.once("close",g),r.once("finish",b);try{for await(let C of t){if(!r.writable||r.destroyed||n)break;r.write(C)===!1&&await h()}}catch(C){n||r.destroy(),n=C}try{if(r.writable&&r.end(),await T(),n)throw n}finally{B()}}});var On=z((gm,$o)=>{var hp=kn(),dp=Ke();$o.exports=r=>({sink:hp(r),source:dp(r)})});var Vo=z((bm,zo)=>{var mp=On();zo.exports=r=>async function*(t){let e=mp(r),n;if(e.sink(t).catch(o=>{n=o}),yield*e.source,n)throw n}});var jo=z((wm,le)=>{le.exports=Ke();le.exports.source=Ke();le.exports.sink=kn();le.exports.transform=Vo();le.exports.duplex=On()});var Ip={};O(Ip,{tcp:()=>Ap});var Zo=H(mt("net"),1);var qt=class r extends Error{code;type;constructor(t="The operation was aborted"){super(t),this.code=r.code,this.type=r.type}static code="ABORT_ERR";static type="aborted"},lt=class extends Error{code;props;constructor(t,e,n){super(t),this.code=e,this.name=n?.name??"CodeError",this.props=n??{}}};var Wn=Symbol.for("@libp2p/transport");var Zn;(function(r){r[r.FATAL_ALL=0]="FATAL_ALL",r[r.NO_FATAL=1]="NO_FATAL"})(Zn||(Zn={}));var nt=H(os(),1);var dr={};O(dr,{base32:()=>dt,base32hex:()=>pc,base32hexpad:()=>hc,base32hexpadupper:()=>dc,base32hexupper:()=>lc,base32pad:()=>uc,base32padupper:()=>fc,base32upper:()=>cc,base32z:()=>mc});function nc(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var o=0;o<r.length;o++){var c=r.charAt(o),f=c.charCodeAt(0);if(e[f]!==255)throw new TypeError(c+" is ambiguous");e[f]=o}var l=r.length,g=r.charAt(0),A=Math.log(l)/Math.log(256),p=Math.log(256)/Math.log(l);function b(h){if(h instanceof Uint8Array||(ArrayBuffer.isView(h)?h=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):Array.isArray(h)&&(h=Uint8Array.from(h))),!(h instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(h.length===0)return"";for(var T=0,B=0,C=0,I=h.length;C!==I&&h[C]===0;)C++,T++;for(var M=(I-C)*p+1>>>0,R=new Uint8Array(M);C!==I;){for(var N=h[C],_=0,D=M-1;(N!==0||_<B)&&D!==-1;D--,_++)N+=256*R[D]>>>0,R[D]=N%l>>>0,N=N/l>>>0;if(N!==0)throw new Error("Non-zero carry");B=_,C++}for(var F=M-B;F!==M&&R[F]===0;)F++;for(var G=g.repeat(T);F<M;++F)G+=r.charAt(R[F]);return G}function y(h){if(typeof h!="string")throw new TypeError("Expected String");if(h.length===0)return new Uint8Array;var T=0;if(h[T]!==" "){for(var B=0,C=0;h[T]===g;)B++,T++;for(var I=(h.length-T)*A+1>>>0,M=new Uint8Array(I);h[T];){var R=e[h.charCodeAt(T)];if(R===255)return;for(var N=0,_=I-1;(R!==0||N<C)&&_!==-1;_--,N++)R+=l*M[_]>>>0,M[_]=R%256>>>0,R=R/256>>>0;if(R!==0)throw new Error("Non-zero carry");C=N,T++}if(h[T]!==" "){for(var D=I-C;D!==I&&M[D]===0;)D++;for(var F=new Uint8Array(B+(I-D)),G=B;D!==I;)F[G++]=M[D++];return F}}}function S(h){var T=y(h);if(T)return T;throw new Error(`Non-${t} character`)}return{encode:b,decodeUnsafe:y,decode:S}}var sc=nc,oc=sc,is=oc;var _p=new Uint8Array(0);var as=(r,t)=>{if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0},at=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 cs=r=>new TextEncoder().encode(r),us=r=>new TextDecoder().decode(r);var fr=class{constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},pr=class{constructor(t,e,n){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return ps(this,t)}},lr=class{constructor(t){this.decoders=t}or(t){return ps(this,t)}decode(t){let e=t[0],n=this.decoders[e];if(n)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},ps=(r,t)=>new lr({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),hr=class{constructor(t,e,n,o){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=o,this.encoder=new fr(t,e,n),this.decoder=new pr(t,e,o)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}},Jt=({name:r,prefix:t,encode:e,decode:n})=>new hr(r,t,e,n),Et=({prefix:r,name:t,alphabet:e})=>{let{encode:n,decode:o}=is(e,t);return Jt({prefix:r,name:t,encode:n,decode:c=>at(o(c))})},ic=(r,t,e,n)=>{let o={};for(let p=0;p<t.length;++p)o[t[p]]=p;let c=r.length;for(;r[c-1]==="=";)--c;let f=new Uint8Array(c*e/8|0),l=0,g=0,A=0;for(let p=0;p<c;++p){let b=o[r[p]];if(b===void 0)throw new SyntaxError(`Non-${n} character`);g=g<<e|b,l+=e,l>=8&&(l-=8,f[A++]=255&g>>l)}if(l>=e||255&g<<8-l)throw new SyntaxError("Unexpected end of data");return f},ac=(r,t,e)=>{let n=t[t.length-1]==="=",o=(1<<e)-1,c="",f=0,l=0;for(let g=0;g<r.length;++g)for(l=l<<8|r[g],f+=8;f>e;)f-=e,c+=t[o&l>>f];if(f&&(c+=t[o&l<<e-f]),n)for(;c.length*e&7;)c+="=";return c},U=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>Jt({prefix:t,name:r,encode(o){return ac(o,n,e)},decode(o){return ic(o,n,e,r)}});var dt=U({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),cc=U({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),uc=U({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),fc=U({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),pc=U({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),lc=U({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),hc=U({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),dc=U({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),mc=U({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var mr={};O(mr,{base58btc:()=>W,base58flickr:()=>gc});var W=Et({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),gc=Et({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var br={};O(br,{base64:()=>gr,base64pad:()=>bc,base64url:()=>wc,base64urlpad:()=>yc});var gr=U({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),bc=U({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),wc=U({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),yc=U({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});nt.default.formatters.b=r=>r==null?"undefined":W.baseEncode(r);nt.default.formatters.t=r=>r==null?"undefined":dt.baseEncode(r);nt.default.formatters.m=r=>r==null?"undefined":gr.baseEncode(r);nt.default.formatters.p=r=>r==null?"undefined":r.toString();nt.default.formatters.c=r=>r==null?"undefined":r.toString();nt.default.formatters.k=r=>r==null?"undefined":r.toString();nt.default.formatters.a=r=>r==null?"undefined":r.toString();function vc(r){let t=()=>{};return t.enabled=!1,t.color="",t.diff=0,t.log=()=>{},t.namespace=r,t.destroy=()=>!0,t.extend=()=>t,t}function At(r){let t=vc(`${r}:trace`);return nt.default.enabled(`${r}:trace`)&&nt.default.names.map(e=>e.toString()).find(e=>e.includes(":trace"))!=null&&(t=(0,nt.default)(`${r}:trace`)),Object.assign((0,nt.default)(r),{error:(0,nt.default)(`${r}:error`),trace:t})}var Pe=class extends Error{code;props;constructor(t,e,n){super(t),this.code=e,this.name=n?.name??"CodeError",this.props=n??{}}};var xc=ds,ls=128,Sc=127,Tc=~Sc,Cc=Math.pow(2,31);function ds(r,t,e){t=t||[],e=e||0;for(var n=e;r>=Cc;)t[e++]=r&255|ls,r/=128;for(;r&Tc;)t[e++]=r&255|ls,r>>>=7;return t[e]=r|0,ds.bytes=e-n+1,t}var Ec=wr,Ac=128,hs=127;function wr(r,n){var e=0,n=n||0,o=0,c=n,f,l=r.length;do{if(c>=l)throw wr.bytes=0,new RangeError("Could not decode varint");f=r[c++],e+=o<28?(f&hs)<<o:(f&hs)*Math.pow(2,o),o+=7}while(f>=Ac);return wr.bytes=c-n,e}var Ic=Math.pow(2,7),Bc=Math.pow(2,14),Mc=Math.pow(2,21),Rc=Math.pow(2,28),Dc=Math.pow(2,35),Pc=Math.pow(2,42),kc=Math.pow(2,49),Oc=Math.pow(2,56),Nc=Math.pow(2,63),Fc=function(r){return r<Ic?1:r<Bc?2:r<Mc?3:r<Rc?4:r<Dc?5:r<Pc?6:r<kc?7:r<Oc?8:r<Nc?9:10},_c={encode:xc,decode:Ec,encodingLength:Fc},Uc=_c,me=Uc;var ge=(r,t=0)=>[me.decode(r,t),me.decode.bytes],Xt=(r,t,e=0)=>(me.encode(r,t,e),t),Qt=r=>me.encodingLength(r);var Ft=(r,t)=>{let e=t.byteLength,n=Qt(r),o=n+Qt(e),c=new Uint8Array(o+e);return Xt(r,c,0),Xt(e,c,n),c.set(t,o),new Yt(r,e,t,c)},Oe=r=>{let t=at(r),[e,n]=ge(t),[o,c]=ge(t.subarray(n)),f=t.subarray(n+c);if(f.byteLength!==o)throw new Error("Incorrect length");return new Yt(e,o,f,t)},ms=(r,t)=>{if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&as(r.bytes,e.bytes)}},Yt=class{constructor(t,e,n,o){this.code=t,this.size=e,this.digest=n,this.bytes=o}};var gs=(r,t)=>{let{bytes:e,version:n}=r;switch(n){case 0:return $c(e,yr(r),t||W.encoder);default:return zc(e,yr(r),t||dt.encoder)}};var bs=new WeakMap,yr=r=>{let t=bs.get(r);if(t==null){let e=new Map;return bs.set(r,e),e}return t},It=class r{constructor(t,e,n,o){this.code=e,this.version=t,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:e}=this;if(t!==be)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==Vc)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(e)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:e}=this.multihash,n=Ft(t,e);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return r.equals(this,t)}static equals(t,e){let n=e;return n&&t.code===n.code&&t.version===n.version&&ms(t.multihash,n.multihash)}toString(t){return gs(this,t)}toJSON(){return{"/":gs(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let e=t;if(e instanceof r)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:n,code:o,multihash:c,bytes:f}=e;return new r(n,o,c,f||ws(n,o,c.bytes))}else if(e[jc]===!0){let{version:n,multihash:o,code:c}=e,f=Oe(o);return r.create(n,c,f)}else return null}static create(t,e,n){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==be)throw new Error(`Version 0 CID must use dag-pb (code: ${be}) block encoding`);return new r(t,e,n,n.bytes)}case 1:{let o=ws(t,e,n.bytes);return new r(t,e,n,o)}default:throw new Error("Invalid version")}}static createV0(t){return r.create(0,be,t)}static createV1(t,e){return r.create(1,t,e)}static decode(t){let[e,n]=r.decodeFirst(t);if(n.length)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=r.inspectBytes(t),n=e.size-e.multihashSize,o=at(t.subarray(n,n+e.multihashSize));if(o.byteLength!==e.multihashSize)throw new Error("Incorrect length");let c=o.subarray(e.multihashSize-e.digestSize),f=new Yt(e.multihashCode,e.digestSize,c,o);return[e.version===0?r.createV0(f):r.createV1(e.codec,f),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[b,y]=ge(t.subarray(e));return e+=y,b},o=n(),c=be;if(o===18?(o=0,e=0):c=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let f=e,l=n(),g=n(),A=e+g,p=A-f;return{version:o,codec:c,multihashCode:l,digestSize:g,multihashSize:p,size:A}}static parse(t,e){let[n,o]=Lc(t,e),c=r.decode(o);if(c.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return yr(c).set(n,t),c}},Lc=(r,t)=>{switch(r[0]){case"Q":{let e=t||W;return[W.prefix,e.decode(`${W.prefix}${r}`)]}case W.prefix:{let e=t||W;return[W.prefix,e.decode(r)]}case dt.prefix:{let e=t||dt;return[dt.prefix,e.decode(r)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],t.decode(r)]}}},$c=(r,t,e)=>{let{prefix:n}=e;if(n!==W.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let o=t.get(n);if(o==null){let c=e.encode(r).slice(1);return t.set(n,c),c}else return o},zc=(r,t,e)=>{let{prefix:n}=e,o=t.get(n);if(o==null){let c=e.encode(r);return t.set(n,c),c}else return o},be=112,Vc=18,ws=(r,t,e)=>{let n=Qt(r),o=n+Qt(t),c=new Uint8Array(o+e.byteLength);return Xt(r,c,0),Xt(t,c,n),c.set(e,o),c},jc=Symbol.for("@ipld/js-cid/CID");function ys(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}var Cr={};O(Cr,{identity:()=>Jc});function qc(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var o=0;o<r.length;o++){var c=r.charAt(o),f=c.charCodeAt(0);if(e[f]!==255)throw new TypeError(c+" is ambiguous");e[f]=o}var l=r.length,g=r.charAt(0),A=Math.log(l)/Math.log(256),p=Math.log(256)/Math.log(l);function b(h){if(h instanceof Uint8Array||(ArrayBuffer.isView(h)?h=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):Array.isArray(h)&&(h=Uint8Array.from(h))),!(h instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(h.length===0)return"";for(var T=0,B=0,C=0,I=h.length;C!==I&&h[C]===0;)C++,T++;for(var M=(I-C)*p+1>>>0,R=new Uint8Array(M);C!==I;){for(var N=h[C],_=0,D=M-1;(N!==0||_<B)&&D!==-1;D--,_++)N+=256*R[D]>>>0,R[D]=N%l>>>0,N=N/l>>>0;if(N!==0)throw new Error("Non-zero carry");B=_,C++}for(var F=M-B;F!==M&&R[F]===0;)F++;for(var G=g.repeat(T);F<M;++F)G+=r.charAt(R[F]);return G}function y(h){if(typeof h!="string")throw new TypeError("Expected String");if(h.length===0)return new Uint8Array;var T=0;if(h[T]!==" "){for(var B=0,C=0;h[T]===g;)B++,T++;for(var I=(h.length-T)*A+1>>>0,M=new Uint8Array(I);h[T];){var R=e[h.charCodeAt(T)];if(R===255)return;for(var N=0,_=I-1;(R!==0||N<C)&&_!==-1;_--,N++)R+=l*M[_]>>>0,M[_]=R%256>>>0,R=R/256>>>0;if(R!==0)throw new Error("Non-zero carry");C=N,T++}if(h[T]!==" "){for(var D=I-C;D!==I&&M[D]===0;)D++;for(var F=new Uint8Array(B+(I-D)),G=B;D!==I;)F[G++]=M[D++];return F}}}function S(h){var T=y(h);if(T)return T;throw new Error(`Non-${t} character`)}return{encode:b,decodeUnsafe:y,decode:S}}var Gc=qc,Hc=Gc,vs=Hc;var ol=new Uint8Array(0);var xs=(r,t)=>{if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0},ct=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 Ss=r=>new TextEncoder().encode(r),Ts=r=>new TextDecoder().decode(r);var vr=class{constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},xr=class{constructor(t,e,n){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return Es(this,t)}},Sr=class{constructor(t){this.decoders=t}or(t){return Es(this,t)}decode(t){let e=t[0],n=this.decoders[e];if(n)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},Es=(r,t)=>new Sr({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),Tr=class{constructor(t,e,n,o){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=o,this.encoder=new vr(t,e,n),this.decoder=new xr(t,e,o)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}},te=({name:r,prefix:t,encode:e,decode:n})=>new Tr(r,t,e,n),Bt=({prefix:r,name:t,alphabet:e})=>{let{encode:n,decode:o}=vs(e,t);return te({prefix:r,name:t,encode:n,decode:c=>ct(o(c))})},Zc=(r,t,e,n)=>{let o={};for(let p=0;p<t.length;++p)o[t[p]]=p;let c=r.length;for(;r[c-1]==="=";)--c;let f=new Uint8Array(c*e/8|0),l=0,g=0,A=0;for(let p=0;p<c;++p){let b=o[r[p]];if(b===void 0)throw new SyntaxError(`Non-${n} character`);g=g<<e|b,l+=e,l>=8&&(l-=8,f[A++]=255&g>>l)}if(l>=e||255&g<<8-l)throw new SyntaxError("Unexpected end of data");return f},Wc=(r,t,e)=>{let n=t[t.length-1]==="=",o=(1<<e)-1,c="",f=0,l=0;for(let g=0;g<r.length;++g)for(l=l<<8|r[g],f+=8;f>e;)f-=e,c+=t[o&l>>f];if(f&&(c+=t[o&l<<e-f]),n)for(;c.length*e&7;)c+="=";return c},L=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>te({prefix:t,name:r,encode(o){return Wc(o,n,e)},decode(o){return Zc(o,n,e,r)}});var Jc=te({prefix:"\0",name:"identity",encode:r=>Ts(r),decode:r=>Ss(r)});var Er={};O(Er,{base2:()=>Xc});var Xc=L({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Ar={};O(Ar,{base8:()=>Qc});var Qc=L({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Ir={};O(Ir,{base10:()=>Yc});var Yc=Bt({prefix:"9",name:"base10",alphabet:"0123456789"});var Br={};O(Br,{base16:()=>Kc,base16upper:()=>tu});var Kc=L({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),tu=L({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Mr={};O(Mr,{base32:()=>ee,base32hex:()=>su,base32hexpad:()=>iu,base32hexpadupper:()=>au,base32hexupper:()=>ou,base32pad:()=>ru,base32padupper:()=>nu,base32upper:()=>eu,base32z:()=>cu});var ee=L({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),eu=L({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ru=L({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),nu=L({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),su=L({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ou=L({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),iu=L({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),au=L({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),cu=L({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Rr={};O(Rr,{base36:()=>uu,base36upper:()=>fu});var uu=Bt({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),fu=Bt({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Dr={};O(Dr,{base58btc:()=>gt,base58flickr:()=>pu});var gt=Bt({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),pu=Bt({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Pr={};O(Pr,{base64:()=>lu,base64pad:()=>hu,base64url:()=>du,base64urlpad:()=>mu});var lu=L({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),hu=L({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),du=L({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),mu=L({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var kr={};O(kr,{base256emoji:()=>vu});var As=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}"),gu=As.reduce((r,t,e)=>(r[e]=t,r),[]),bu=As.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function wu(r){return r.reduce((t,e)=>(t+=gu[e],t),"")}function yu(r){let t=[];for(let e of r){let n=bu[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}var vu=te({prefix:"\u{1F680}",name:"base256emoji",encode:wu,decode:yu});var Ur={};O(Ur,{sha256:()=>Lu,sha512:()=>$u});var _r=H(mt("crypto"),1);var xu=Ms,Is=128,Su=127,Tu=~Su,Cu=Math.pow(2,31);function Ms(r,t,e){t=t||[],e=e||0;for(var n=e;r>=Cu;)t[e++]=r&255|Is,r/=128;for(;r&Tu;)t[e++]=r&255|Is,r>>>=7;return t[e]=r|0,Ms.bytes=e-n+1,t}var Eu=Or,Au=128,Bs=127;function Or(r,n){var e=0,n=n||0,o=0,c=n,f,l=r.length;do{if(c>=l)throw Or.bytes=0,new RangeError("Could not decode varint");f=r[c++],e+=o<28?(f&Bs)<<o:(f&Bs)*Math.pow(2,o),o+=7}while(f>=Au);return Or.bytes=c-n,e}var Iu=Math.pow(2,7),Bu=Math.pow(2,14),Mu=Math.pow(2,21),Ru=Math.pow(2,28),Du=Math.pow(2,35),Pu=Math.pow(2,42),ku=Math.pow(2,49),Ou=Math.pow(2,56),Nu=Math.pow(2,63),Fu=function(r){return r<Iu?1:r<Bu?2:r<Mu?3:r<Ru?4:r<Du?5:r<Pu?6:r<ku?7:r<Ou?8:r<Nu?9:10},_u={encode:xu,decode:Eu,encodingLength:Fu},Uu=_u,we=Uu;var ye=(r,t=0)=>[we.decode(r,t),we.decode.bytes],re=(r,t,e=0)=>(we.encode(r,t,e),t),ne=r=>we.encodingLength(r);var _t=(r,t)=>{let e=t.byteLength,n=ne(r),o=n+ne(e),c=new Uint8Array(o+e);return re(r,c,0),re(e,c,n),c.set(t,o),new se(r,e,t,c)},Rs=r=>{let t=ct(r),[e,n]=ye(t),[o,c]=ye(t.subarray(n)),f=t.subarray(n+c);if(f.byteLength!==o)throw new Error("Incorrect length");return new se(e,o,f,t)},Ds=(r,t)=>{if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&xs(r.bytes,e.bytes)}},se=class{constructor(t,e,n,o){this.code=t,this.size=e,this.digest=n,this.bytes=o}};var Fr=({name:r,code:t,encode:e})=>new Nr(r,t,e),Nr=class{constructor(t,e,n){this.name=t,this.code=e,this.encode=n}digest(t){if(t instanceof Uint8Array){let e=this.encode(t);return e instanceof Uint8Array?_t(this.code,e):e.then(n=>_t(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Lu=Fr({name:"sha2-256",code:18,encode:r=>ct(_r.default.createHash("sha256").update(r).digest())}),$u=Fr({name:"sha2-512",code:19,encode:r=>ct(_r.default.createHash("sha512").update(r).digest())});var Lr={};O(Lr,{identity:()=>ju});var ks=0,zu="identity",Os=ct,Vu=r=>_t(ks,Os(r)),ju={code:ks,name:zu,encode:Os,digest:Vu};var Il=new TextEncoder,Bl=new TextDecoder;var Ns=(r,t)=>{let{bytes:e,version:n}=r;switch(n){case 0:return Zu(e,$r(r),t||gt.encoder);default:return Wu(e,$r(r),t||ee.encoder)}};var Fs=new WeakMap,$r=r=>{let t=Fs.get(r);if(t==null){let e=new Map;return Fs.set(r,e),e}return t},Fe=class r{constructor(t,e,n,o){this.code=e,this.version=t,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:e}=this;if(t!==xe)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==Ju)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(e)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:e}=this.multihash,n=_t(t,e);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return r.equals(this,t)}static equals(t,e){let n=e;return n&&t.code===n.code&&t.version===n.version&&Ds(t.multihash,n.multihash)}toString(t){return Ns(this,t)}toJSON(){return{"/":Ns(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let e=t;if(e instanceof r)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:n,code:o,multihash:c,bytes:f}=e;return new r(n,o,c,f||_s(n,o,c.bytes))}else if(e[Xu]===!0){let{version:n,multihash:o,code:c}=e,f=Rs(o);return r.create(n,c,f)}else return null}static create(t,e,n){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==xe)throw new Error(`Version 0 CID must use dag-pb (code: ${xe}) block encoding`);return new r(t,e,n,n.bytes)}case 1:{let o=_s(t,e,n.bytes);return new r(t,e,n,o)}default:throw new Error("Invalid version")}}static createV0(t){return r.create(0,xe,t)}static createV1(t,e){return r.create(1,t,e)}static decode(t){let[e,n]=r.decodeFirst(t);if(n.length)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=r.inspectBytes(t),n=e.size-e.multihashSize,o=ct(t.subarray(n,n+e.multihashSize));if(o.byteLength!==e.multihashSize)throw new Error("Incorrect length");let c=o.subarray(e.multihashSize-e.digestSize),f=new se(e.multihashCode,e.digestSize,c,o);return[e.version===0?r.createV0(f):r.createV1(e.codec,f),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[b,y]=ye(t.subarray(e));return e+=y,b},o=n(),c=xe;if(o===18?(o=0,e=0):c=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let f=e,l=n(),g=n(),A=e+g,p=A-f;return{version:o,codec:c,multihashCode:l,digestSize:g,multihashSize:p,size:A}}static parse(t,e){let[n,o]=Hu(t,e),c=r.decode(o);if(c.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return $r(c).set(n,t),c}},Hu=(r,t)=>{switch(r[0]){case"Q":{let e=t||gt;return[gt.prefix,e.decode(`${gt.prefix}${r}`)]}case gt.prefix:{let e=t||gt;return[gt.prefix,e.decode(r)]}case ee.prefix:{let e=t||ee;return[ee.prefix,e.decode(r)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],t.decode(r)]}}},Zu=(r,t,e)=>{let{prefix:n}=e;if(n!==gt.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let o=t.get(n);if(o==null){let c=e.encode(r).slice(1);return t.set(n,c),c}else return o},Wu=(r,t,e)=>{let{prefix:n}=e,o=t.get(n);if(o==null){let c=e.encode(r);return t.set(n,c),c}else return o},xe=112,Ju=18,_s=(r,t,e)=>{let n=ne(r),o=n+ne(t),c=new Uint8Array(o+e.byteLength);return re(r,c,0),re(t,c,n),c.set(e,o),c},Xu=Symbol.for("@ipld/js-cid/CID");var zr={...Cr,...Er,...Ar,...Ir,...Br,...Mr,...Rr,...Dr,...Pr,...kr},Ul={...Ur,...Lr};function oe(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function _e(r=0){return globalThis.Buffer?.allocUnsafe!=null?oe(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Ls(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var Us=Ls("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Vr=Ls("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);let t=_e(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),Qu={utf8:Us,"utf-8":Us,hex:zr.base16,latin1:Vr,ascii:Vr,binary:Vr,...zr},Ue=Qu;function K(r,t="utf8"){let e=Ue[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):e.encoder.encode(r).substring(1)}function xt(r,t){t==null&&(t=r.reduce((o,c)=>o+c.length,0));let e=_e(t),n=0;for(let o of r)e.set(o,n),n+=o.length;return oe(e)}var ae=H(Gr(),1);var Le=class{index=0;input="";new(t){return this.index=0,this.input=t,this}readAtomically(t){let e=this.index,n=t();return n===void 0&&(this.index=e),n}parseWith(t){let e=t();if(this.index===this.input.length)return e}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(t){return this.readAtomically(()=>{let e=this.readChar();if(e===t)return e})}readSeparator(t,e,n){return this.readAtomically(()=>{if(!(e>0&&this.readGivenChar(t)===void 0))return n()})}readNumber(t,e,n,o){return this.readAtomically(()=>{let c=0,f=0,l=this.peekChar();if(l===void 0)return;let g=l==="0",A=2**(8*o)-1;for(;;){let p=this.readAtomically(()=>{let b=this.readChar();if(b===void 0)return;let y=Number.parseInt(b,t);if(!Number.isNaN(y))return y});if(p===void 0)break;if(c*=t,c+=p,c>A||(f+=1,e!==void 0&&f>e))return}if(f!==0)return!n&&g&&f>1?void 0:c})}readIPv4Addr(){return this.readAtomically(()=>{let t=new Uint8Array(4);for(let e=0;e<t.length;e++){let n=this.readSeparator(".",e,()=>this.readNumber(10,3,!1,1));if(n===void 0)return;t[e]=n}return t})}readIPv6Addr(){let t=e=>{for(let n=0;n<e.length/2;n++){let o=n*2;if(n<e.length-3){let f=this.readSeparator(":",n,()=>this.readIPv4Addr());if(f!==void 0)return e[o]=f[0],e[o+1]=f[1],e[o+2]=f[2],e[o+3]=f[3],[o+4,!0]}let c=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(c===void 0)return[o,!1];e[o]=c>>8,e[o+1]=c&255}return[e.length,!1]};return this.readAtomically(()=>{let e=new Uint8Array(16),[n,o]=t(e);if(n===16)return e;if(o||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let c=new Uint8Array(14),f=16-(n+2),[l]=t(c.subarray(0,f));return e.set(c.subarray(0,l),16-l),e})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var nh=new Le;var ph=parseInt("0xFFFF",16),lh=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);var Hr={};O(Hr,{identity:()=>bf});var bf=Jt({prefix:"\0",name:"identity",encode:r=>us(r),decode:r=>cs(r)});var Zr={};O(Zr,{base2:()=>wf});var wf=U({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Wr={};O(Wr,{base8:()=>yf});var yf=U({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Jr={};O(Jr,{base10:()=>vf});var vf=Et({prefix:"9",name:"base10",alphabet:"0123456789"});var Xr={};O(Xr,{base16:()=>xf,base16upper:()=>Sf});var xf=U({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Sf=U({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Qr={};O(Qr,{base36:()=>Tf,base36upper:()=>Cf});var Tf=Et({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Cf=Et({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Yr={};O(Yr,{base256emoji:()=>Mf});var Qs=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}"),Ef=Qs.reduce((r,t,e)=>(r[e]=t,r),[]),Af=Qs.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function If(r){return r.reduce((t,e)=>(t+=Ef[e],t),"")}function Bf(r){let t=[];for(let e of r){let n=Af[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}var Mf=Jt({prefix:"\u{1F680}",name:"base256emoji",encode:If,decode:Bf});var rn={};O(rn,{sha256:()=>Rf,sha512:()=>Df});var en=H(mt("crypto"),1);var tn=({name:r,code:t,encode:e})=>new Kr(r,t,e),Kr=class{constructor(t,e,n){this.name=t,this.code=e,this.encode=n}digest(t){if(t instanceof Uint8Array){let e=this.encode(t);return e instanceof Uint8Array?Ft(this.code,e):e.then(n=>Ft(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Rf=tn({name:"sha2-256",code:18,encode:r=>at(en.default.createHash("sha256").update(r).digest())}),Df=tn({name:"sha2-512",code:19,encode:r=>at(en.default.createHash("sha512").update(r).digest())});var nn={};O(nn,{identity:()=>Of});var Ks=0,Pf="identity",to=at,kf=r=>Ft(Ks,to(r)),Of={code:Ks,name:Pf,encode:to,digest:kf};var Wh=new TextEncoder,Jh=new TextDecoder;var eo={...Hr,...Zr,...Wr,...Jr,...Xr,...dr,...Qr,...mr,...br,...Yr},td={...rn,...nn};function sn(r,t="utf8"){let e=Ue[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?oe(globalThis.Buffer.from(r,"utf-8")):e.decoder.decode(`${e.prefix}${r}`)}var bt=H(Gr(),1);var Mt=mt("node:net");function $e(r){return!!(0,Mt.isIP)(r)}var ro=Mt.isIPv4,_f=Mt.isIPv6,on=function(r){let t=0;if(r=r.toString().trim(),ro(r)){let e=new Uint8Array(t+4);return r.split(/\./g).forEach(n=>{e[t++]=parseInt(n,10)&255}),e}if(_f(r)){let e=r.split(":",8),n;for(n=0;n<e.length;n++){let c=ro(e[n]),f;c&&(f=on(e[n]),e[n]=K(f.slice(0,2),"base16")),f!=null&&++n<8&&e.splice(n,0,K(f.slice(2,4),"base16"))}if(e[0]==="")for(;e.length<8;)e.unshift("0");else if(e[e.length-1]==="")for(;e.length<8;)e.push("0");else if(e.length<8){for(n=0;n<e.length&&e[n]!=="";n++);let c=[n,1];for(n=9-e.length;n>0;n--)c.push("0");e.splice.apply(e,c)}let o=new Uint8Array(t+16);for(n=0;n<e.length;n++){let c=parseInt(e[n],16);o[t++]=c>>8&255,o[t++]=c&255}return o}throw new Error("invalid ip address")},no=function(r,t=0,e){t=~~t,e=e??r.length-t;let n=new DataView(r.buffer);if(e===4){let o=[];for(let c=0;c<e;c++)o.push(r[t+c]);return o.join(".")}if(e===16){let o=[];for(let c=0;c<e;c+=2)o.push(n.getUint16(t+c).toString(16));return o.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var ie={},an={},Lf=[[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"]];Lf.forEach(r=>{let t=$f(...r);an[t.code]=t,ie[t.name]=t});function $f(r,t,e,n,o){return{code:r,size:t,name:e,resolvable:!!n,path:!!o}}function P(r){if(typeof r=="number"){if(an[r]!=null)return an[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(ie[r]!=null)return ie[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var yd=P("ip4"),vd=P("ip6"),xd=P("ipcidr");function un(r,t){switch(P(r).code){case 4:case 41:return Vf(t);case 42:return io(t);case 6:case 273:case 33:case 132:return co(t).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return io(t);case 421:return Hf(t);case 444:return ao(t);case 445:return ao(t);case 466:return Gf(t);default:return K(t,"base16")}}function fn(r,t){switch(P(r).code){case 4:return so(t);case 41:return so(t);case 42:return oo(t);case 6:case 273:case 33:case 132:return pn(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return oo(t);case 421:return jf(t);case 444:return Zf(t);case 445:return Wf(t);case 466:return qf(t);default:return sn(t,"base16")}}var cn=Object.values(eo).map(r=>r.decoder),zf=function(){let r=cn[0].or(cn[1]);return cn.slice(2).forEach(t=>r=r.or(t)),r}();function so(r){if(!$e(r))throw new Error("invalid ip address");return on(r)}function Vf(r){let t=no(r,0,r.length);if(t==null)throw new Error("ipBuff is required");if(!$e(t))throw new Error("invalid ip address");return t}function pn(r){let t=new ArrayBuffer(2);return new DataView(t).setUint16(0,r),new Uint8Array(t)}function co(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function oo(r){let t=sn(r),e=Uint8Array.from(bt.default.encode(t.length));return xt([e,t],e.length+t.length)}function io(r){let t=bt.default.decode(r);if(r=r.slice(bt.default.decode.bytes),r.length!==t)throw new Error("inconsistent lengths");return K(r)}function jf(r){let t;r[0]==="Q"||r[0]==="1"?t=Oe(W.decode(`z${r}`)).bytes:t=It.parse(r).multihash.bytes;let e=Uint8Array.from(bt.default.encode(t.length));return xt([e,t],e.length+t.length)}function qf(r){let t=zf.decode(r),e=Uint8Array.from(bt.default.encode(t.length));return xt([e,t],e.length+t.length)}function Gf(r){let t=bt.default.decode(r),e=r.slice(bt.default.decode.bytes);if(e.length!==t)throw new Error("inconsistent lengths");return"u"+K(e,"base64url")}function Hf(r){let t=bt.default.decode(r),e=r.slice(bt.default.decode.bytes);if(e.length!==t)throw new Error("inconsistent lengths");return K(e,"base58btc")}function Zf(r){let t=r.split(":");if(t.length!==2)throw new Error(`failed to parse onion addr: ["'${t.join('", "')}'"]' does not contain a port number`);if(t[0].length!==16)throw new Error(`failed to parse onion addr: ${t[0]} not a Tor onion address.`);let e=dt.decode("b"+t[0]),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=pn(n);return xt([e,o],e.length+o.length)}function Wf(r){let t=r.split(":");if(t.length!==2)throw new Error(`failed to parse onion addr: ["'${t.join('", "')}'"]' does not contain a port number`);if(t[0].length!==56)throw new Error(`failed to parse onion addr: ${t[0]} not a Tor onion3 address.`);let e=dt.decode(`b${t[0]}`),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=pn(n);return xt([e,o],e.length+o.length)}function ao(r){let t=r.slice(0,r.length-2),e=r.slice(r.length-2),n=K(t,"base32"),o=co(e);return`${n}:${o}`}function uo(r){r=ln(r);let t=[],e=[],n=null,o=r.split("/").slice(1);if(o.length===1&&o[0]==="")return{bytes:new Uint8Array,string:"/",tuples:[],stringTuples:[],path:null};for(let c=0;c<o.length;c++){let f=o[c],l=P(f);if(l.size===0){t.push([l.code]),e.push([l.code]);continue}if(c++,c>=o.length)throw po("invalid address: "+r);if(l.path===!0){n=ln(o.slice(c).join("/")),t.push([l.code,fn(l.code,n)]),e.push([l.code,n]);break}let g=fn(l.code,o[c]);t.push([l.code,g]),e.push([l.code,un(l.code,g)])}return{string:fo(e),bytes:dn(t),tuples:t,stringTuples:e,path:n}}function hn(r){let t=[],e=[],n=null,o=0;for(;o<r.length;){let c=ae.default.decode(r,o),f=ae.default.decode.bytes??0,l=P(c),g=Jf(l,r.slice(o+f));if(g===0){t.push([c]),e.push([c]),o+=f;continue}let A=r.slice(o+f,o+f+g);if(o+=g+f,o>r.length)throw po("Invalid address Uint8Array: "+K(r,"base16"));t.push([c,A]);let p=un(c,A);if(e.push([c,p]),l.path===!0){n=p;break}}return{bytes:Uint8Array.from(r),string:fo(e),tuples:t,stringTuples:e,path:n}}function fo(r){let t=[];return r.map(e=>{let n=P(e[0]);return t.push(n.name),e.length>1&&e[1]!=null&&t.push(e[1]),null}),ln(t.join("/"))}function dn(r){return xt(r.map(t=>{let e=P(t[0]),n=Uint8Array.from(ae.default.encode(e.code));return t.length>1&&t[1]!=null&&(n=xt([n,t[1]])),n}))}function Jf(r,t){return r.size>0?r.size/8:r.size===0?0:ae.default.decode(t)+(ae.default.decode.bytes??0)}function ln(r){return"/"+r.trim().split("/").filter(t=>t).join("/")}function po(r){return new Error("Error parsing address: "+r)}var Xf=Symbol.for("nodejs.util.inspect.custom"),Qf=[P("dns").code,P("dns4").code,P("dns6").code,P("dnsaddr").code],Yf=new Map,lo=Symbol.for("@multiformats/js-multiaddr/multiaddr");function Kf(r){return!!r?.[lo]}var mn=class r{bytes;#t;#e;#r;#n;[lo]=!0;constructor(t){t==null&&(t="");let e;if(t instanceof Uint8Array)e=hn(t);else if(typeof t=="string"){if(t.length>0&&t.charAt(0)!=="/")throw new Error(`multiaddr "${t}" must start with a "/"`);e=uo(t)}else if(Kf(t))e=hn(t.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=e.bytes,this.#t=e.string,this.#e=e.tuples,this.#r=e.stringTuples,this.#n=e.path}toString(){return this.#t}toJSON(){return this.toString()}toOptions(){let t,e,n,o,c="",f=P("tcp"),l=P("udp"),g=P("ip4"),A=P("ip6"),p=P("dns6"),b=P("ip6zone");for(let[S,h]of this.stringTuples())S===b.code&&(c=`%${h??""}`),Qf.includes(S)&&(e=f.name,o=443,n=`${h??""}${c}`,t=S===p.code?6:4),(S===f.code||S===l.code)&&(e=P(S).name,o=parseInt(h??"")),(S===g.code||S===A.code)&&(e=P(S).name,n=`${h??""}${c}`,t=S===A.code?6:4);if(t==null||e==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:t,host:n,transport:e,port:o}}protos(){return this.#e.map(([t])=>Object.assign({},P(t)))}protoCodes(){return this.#e.map(([t])=>t)}protoNames(){return this.#e.map(([t])=>P(t).name)}tuples(){return this.#e}stringTuples(){return this.#r}encapsulate(t){return t=new r(t),new r(this.toString()+t.toString())}decapsulate(t){let e=t.toString(),n=this.toString(),o=n.lastIndexOf(e);if(o<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${t.toString()}`);return new r(n.slice(0,o))}decapsulateCode(t){let e=this.tuples();for(let n=e.length-1;n>=0;n--)if(e[n][0]===t)return new r(dn(e.slice(0,n)));return this}getPeerId(){try{let t=[];this.stringTuples().forEach(([n,o])=>{n===ie.p2p.code&&t.push([n,o]),n===ie["p2p-circuit"].code&&(t=[])});let e=t.pop();if(e?.[1]!=null){let n=e[1];return n[0]==="Q"||n[0]==="1"?K(W.decode(`z${n}`),"base58btc"):K(It.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return this.#n}equals(t){return ys(this.bytes,t.bytes)}async resolve(t){let e=this.protos().find(c=>c.resolvable);if(e==null)return[this];let n=Yf.get(e.name);if(n==null)throw new Pe(`no available resolver for ${e.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,t)).map(c=>new r(c))}nodeAddress(){let t=this.toOptions();if(t.transport!=="tcp"&&t.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${t.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:t.family,address:t.host,port:t.port}}isThinWaistAddress(t){let e=(t??this).protos();return!(e.length!==2||e[0].code!==4&&e[0].code!==41||e[1].code!==6&&e[1].code!==273)}[Xf](){return`Multiaddr(${this.#t})`}};function wt(r){return new mn(r)}var tp=v("dns4"),ep=v("dns6"),rp=v("dnsaddr"),Lt=$(v("dns"),rp,tp,ep),je=$(v("ip4"),v("ip6")),Dt=$(E(je,v("tcp")),E(Lt,v("tcp"))),qe=E(je,v("udp")),np=E(qe,v("utp")),sp=E(qe,v("quic")),op=E(qe,v("quic-v1")),gn=$(E(Dt,v("ws")),E(Lt,v("ws"))),ze=$(E(gn,v("p2p")),gn),bn=$(E(Dt,v("wss")),E(Lt,v("wss")),E(Dt,v("tls"),v("ws")),E(Lt,v("tls"),v("ws"))),Ve=$(E(bn,v("p2p")),bn),wn=$(E(Dt,v("http")),E(je,v("http")),E(Lt,v("http"))),yn=$(E(Dt,v("https")),E(je,v("https")),E(Lt,v("https"))),ho=E(qe,v("webrtc-direct"),v("certhash")),bo=$(E(ho,v("p2p")),ho),mo=E(op,v("webtransport"),v("certhash"),v("certhash")),wo=$(E(mo,v("p2p")),mo),yo=$(E(ze,v("p2p-webrtc-star"),v("p2p")),E(Ve,v("p2p-webrtc-star"),v("p2p")),E(ze,v("p2p-webrtc-star")),E(Ve,v("p2p-webrtc-star"))),jd=$(E(ze,v("p2p-websocket-star"),v("p2p")),E(Ve,v("p2p-websocket-star"),v("p2p")),E(ze,v("p2p-websocket-star")),E(Ve,v("p2p-websocket-star"))),vo=$(E(wn,v("p2p-webrtc-direct"),v("p2p")),E(yn,v("p2p-webrtc-direct"),v("p2p")),E(wn,v("p2p-webrtc-direct")),E(yn,v("p2p-webrtc-direct"))),$t=$(gn,bn,wn,yn,yo,vo,Dt,np,sp,Lt,bo,wo),qd=$(E($t,v("p2p-stardust"),v("p2p")),E($t,v("p2p-stardust"))),Rt=$(E($t,v("p2p")),yo,vo,bo,wo,v("p2p")),go=$(E(Rt,v("p2p-circuit"),Rt),E(Rt,v("p2p-circuit")),E(v("p2p-circuit"),Rt),E($t,v("p2p-circuit")),E(v("p2p-circuit"),$t),v("p2p-circuit")),xo=()=>$(E(go,xo),go),Ut=xo(),Gd=$(E(Ut,Rt,Ut),E(Rt,Ut),E(Ut,Rt),Ut,Rt);var Hd=$(E(Ut,v("webrtc"),v("p2p")),E(Ut,v("webrtc")),E($t,v("webrtc"),v("p2p")),E($t,v("webrtc")),v("webrtc"));function So(r){function t(e){let n;try{n=wt(e)}catch{return!1}let o=r(n.protoNames());return o===null?!1:o===!0||o===!1?o:o.length===0}return t}function E(...r){function t(e){if(e.length<r.length)return null;let n=e;return r.some(o=>(n=typeof o=="function"?o().partialMatch(e):o.partialMatch(e),Array.isArray(n)&&(e=n),n===null)),n}return{toString:function(){return"{ "+r.join(" ")+" }"},input:r,matches:So(t),partialMatch:t}}function $(...r){function t(n){let o=null;return r.some(c=>{let f=typeof c=="function"?c().partialMatch(n):c.partialMatch(n);return f!=null?(o=f,!0):!1}),o}return{toString:function(){return"{ "+r.join(" ")+" }"},input:r,matches:So(t),partialMatch:t}}function v(r){let t=r;function e(o){let c;try{c=wt(o)}catch{return!1}let f=c.protoNames();return f.length===1&&f[0]===t}function n(o){return o.length===0?null:o[0]===t?o.slice(1):null}return{toString:function(){return t},matches:e,partialMatch:n}}var Ho=H(mt("net"),1);var Ge=class extends EventTarget{#t=new Map;listenerCount(t){let e=this.#t.get(t);return e==null?0:e.length}addEventListener(t,e,n){super.addEventListener(t,e,n);let o=this.#t.get(t);o==null&&(o=[],this.#t.set(t,o)),o.push({callback:e,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(t,e,n){super.removeEventListener(t.toString(),e??null,n);let o=this.#t.get(t);o!=null&&(o=o.filter(({callback:c})=>c!==e),this.#t.set(t,o))}dispatchEvent(t){let e=super.dispatchEvent(t),n=this.#t.get(t.type);return n==null||(n=n.filter(({once:o})=>!o),this.#t.set(t.type,n)),e}safeDispatchEvent(t,e){return this.dispatchEvent(new ce(t,e))}},vn=class extends Event{detail;constructor(t,e){super(t,e),this.detail=e?.detail}},ce=globalThis.CustomEvent??vn;function He(r){return this.subnetMask<r.subnetMask?!1:this.mask(r.subnetMask)===r.mask()}function Ze(r){return function(){return this.addressMinusSuffix!==this.correctForm()?!1:this.subnetMask===r&&!this.parsedSubnet?!0:this.parsedSubnet===String(this.subnetMask)}}var ue=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g,xn=/\/\d{1,2}$/;var J=class extends Error{constructor(t,e){super(t),this.name="AddressError",e!==null&&(this.parseMessage=e)}};var fe=H(Sn(),1),zt=H(Se(),1),st=class r{constructor(t){this.groups=4,this.parsedAddress=[],this.parsedSubnet="",this.subnet="/32",this.subnetMask=32,this.v4=!0,this.isCorrect=Ze(32),this.isInSubnet=He,this.address=t;let e=xn.exec(t);if(e){if(this.parsedSubnet=e[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,this.subnetMask<0||this.subnetMask>32)throw new J("Invalid subnet mask.");t=t.replace(xn,"")}this.addressMinusSuffix=t,this.parsedAddress=this.parse(t)}static isValid(t){try{return new r(t),!0}catch{return!1}}parse(t){let e=t.split(".");if(!t.match(ue))throw new J("Invalid IPv4 address.");return e}correctForm(){return this.parsedAddress.map(t=>parseInt(t,10)).join(".")}static fromHex(t){let e=t.replace(/:/g,"").padStart(8,"0"),n=[],o;for(o=0;o<8;o+=2){let c=e.slice(o,o+2);n.push(parseInt(c,16))}return new r(n.join("."))}static fromInteger(t){return r.fromHex(t.toString(16))}static fromArpa(t){let n=t.replace(/(\.in-addr\.arpa)?\.$/,"").split(".").reverse().join(".");return new r(n)}toHex(){return this.parsedAddress.map(t=>(0,zt.sprintf)("%02x",parseInt(t,10))).join(":")}toArray(){return this.parsedAddress.map(t=>parseInt(t,10))}toGroup6(){let t=[],e;for(e=0;e<4;e+=2){let n=(0,zt.sprintf)("%02x%02x",parseInt(this.parsedAddress[e],10),parseInt(this.parsedAddress[e+1],10));t.push((0,zt.sprintf)("%x",parseInt(n,16)))}return t.join(":")}bigInteger(){return new fe.BigInteger(this.parsedAddress.map(t=>(0,zt.sprintf)("%02x",parseInt(t,10))).join(""),16)}_startAddress(){return new fe.BigInteger(this.mask()+"0".repeat(32-this.subnetMask),2)}startAddress(){return r.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new fe.BigInteger("1");return r.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new fe.BigInteger(this.mask()+"1".repeat(32-this.subnetMask),2)}endAddress(){return r.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new fe.BigInteger("1");return r.fromBigInteger(this._endAddress().subtract(t))}static fromBigInteger(t){return r.fromInteger(parseInt(t.toString(),10))}mask(t){return t===void 0&&(t=this.subnetMask),this.getBitsBase2(0,t)}getBitsBase2(t,e){return this.binaryZeroPad().slice(t,e)}reverseForm(t){t||(t={});let e=this.correctForm().split(".").reverse().join(".");return t.omitSuffix?e:(0,zt.sprintf)("%s.in-addr.arpa.",e)}isMulticast(){return this.isInSubnet(new r("224.0.0.0/4"))}binaryZeroPad(){return this.bigInteger().toString(2).padStart(32,"0")}groupForV6(){let t=this.parsedAddress;return this.address.replace(ue,(0,zt.sprintf)('<span class="hover-group group-v4 group-6">%s</span>.<span class="hover-group group-v4 group-7">%s</span>',t.slice(0,2).join("."),t.slice(2,4).join(".")))}};var Io={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"},Tn={"ff01::1/128":"Multicast (All nodes on this interface)","ff01::2/128":"Multicast (All routers on this interface)","ff02::1/128":"Multicast (All nodes on this link)","ff02::2/128":"Multicast (All routers on this link)","ff05::2/128":"Multicast (All routers in this site)","ff02::5/128":"Multicast (OSPFv3 AllSPF routers)","ff02::6/128":"Multicast (OSPFv3 AllDR routers)","ff02::9/128":"Multicast (RIP routers)","ff02::a/128":"Multicast (EIGRP routers)","ff02::d/128":"Multicast (PIM routers)","ff02::16/128":"Multicast (MLDv2 reports)","ff01::fb/128":"Multicast (mDNSv6)","ff02::fb/128":"Multicast (mDNSv6)","ff05::fb/128":"Multicast (mDNSv6)","ff02::1:2/128":"Multicast (All DHCP servers and relay agents on this link)","ff05::1:2/128":"Multicast (All DHCP servers and relay agents in this site)","ff02::1:3/128":"Multicast (All DHCP servers on this link)","ff05::1:3/128":"Multicast (All DHCP servers in this site)","::/128":"Unspecified","::1/128":"Loopback","ff00::/8":"Multicast","fe80::/10":"Link-local unicast"},Cn=/([^0-9a-f:/%])/gi,En=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi,An=/\/\d{1,3}(?=%|$)/,In=/%.*$/,Bo=new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/),Mo=new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/);var Do=H(Se(),1);function ap(r){return r.replace(/^(0+)/,'<span class="zero">$1</span>')}function Xe(r,t=0){return r.split(":").map((n,o)=>/group-v4/.test(n)?n:(0,Do.sprintf)('<span class="hover-group group-%d">%s</span>',o+t,ap(n)))}var jt=H(Se(),1);function Mn(r){return(0,jt.sprintf)("(%s)",r.join("|"))}function Bn(r){return r.length<4?(0,jt.sprintf)("0{0,%d}%s",4-r.length,r):r}var Rn="[^A-Fa-f0-9:]";function Qe(r){let t=[];r.forEach((n,o)=>{parseInt(n,16)===0&&t.push(o)});let e=t.map(n=>r.map((o,c)=>{if(c===n){let f=c===0||c===8-1?":":"";return Mn([Bn(o),f])}return Bn(o)}).join(":"));return e.push(r.map(Bn).join(":")),Mn(e)}function Dn(r,t,e){let n=t?"":":",o=e?"":":",c=[];!t&&!e&&c.push("::"),t&&e&&c.push(""),(e&&!t||!e&&t)&&c.push(":"),c.push((0,jt.sprintf)("%s(:0{1,4}){1,%d}",n,r-1)),c.push((0,jt.sprintf)("(0{1,4}:){1,%d}%s",r-1,o)),c.push((0,jt.sprintf)("(0{1,4}:){%d}0{1,4}",r-1));for(let f=1;f<r-1;f++)for(let l=1;l<r-f;l++)c.push((0,jt.sprintf)("(0{1,4}:){%d}:(0{1,4}:){%d}0{1,4}",l,r-l-f-1));return Mn(c)}var X=H(Sn(),1),Q=H(Se(),1);function Ye(r){if(!r)throw new Error("Assertion failed.")}function cp(r){let t=/(\d+)(\d{3})/;for(;t.test(r);)r=r.replace(t,"$1,$2");return r}function up(r){return r=r.replace(/^(0{1,})([1-9]+)$/,'<span class="parse-error">$1</span>$2'),r=r.replace(/^(0{1,})(0)$/,'<span class="parse-error">$1</span>$2'),r}function fp(r,t){let e=[],n=[],o;for(o=0;o<r.length;o++)o<t[0]?e.push(r[o]):o>t[1]&&n.push(r[o]);return e.concat(["compact"]).concat(n)}function ko(r){return(0,Q.sprintf)("%04x",parseInt(r,16))}function Oo(r){return r&255}var Te=class r{constructor(t,e){this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=He,this.isCorrect=Ze(128),e===void 0?this.groups=8:this.groups=e,this.address=t;let n=An.exec(t);if(n){if(this.parsedSubnet=n[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,Number.isNaN(this.subnetMask)||this.subnetMask<0||this.subnetMask>128)throw new J("Invalid subnet mask.");t=t.replace(An,"")}else if(/\//.test(t))throw new J("Invalid subnet mask.");let o=In.exec(t);o&&(this.zone=o[0],t=t.replace(In,"")),this.addressMinusSuffix=t,this.parsedAddress=this.parse(this.addressMinusSuffix)}static isValid(t){try{return new r(t),!0}catch{return!1}}static fromBigInteger(t){let e=t.toString(16).padStart(32,"0"),n=[],o;for(o=0;o<8;o++)n.push(e.slice(o*4,(o+1)*4));return new r(n.join(":"))}static fromURL(t){let e,n=null,o;if(t.indexOf("[")!==-1&&t.indexOf("]:")!==-1){if(o=Mo.exec(t),o===null)return{error:"failed to parse address with port",address:null,port:null};e=o[1],n=o[2]}else if(t.indexOf("/")!==-1){if(t=t.replace(/^[a-z0-9]+:\/\//,""),o=Bo.exec(t),o===null)return{error:"failed to parse address from URL",address:null,port:null};e=o[1]}else e=t;return n?(n=parseInt(n,10),(n<0||n>65536)&&(n=null)):n=null,{address:new r(e),port:n}}static fromAddress4(t){let e=new st(t),n=128-(32-e.subnetMask);return new r(`::ffff:${e.correctForm()}/${n}`)}static fromArpa(t){let e=t.replace(/(\.ip6\.arpa)?\.$/,""),n=7;if(e.length!==63)throw new J("Invalid 'ip6.arpa' form.");let o=e.split(".").reverse();for(let c=n;c>0;c--){let f=c*4;o.splice(f,0,":")}return e=o.join(""),new r(e)}microsoftTranscription(){return(0,Q.sprintf)("%s.ipv6-literal.net",this.correctForm().replace(/:/g,"-"))}mask(t=this.subnetMask){return this.getBitsBase2(0,t)}possibleSubnets(t=128){let e=128-this.subnetMask,n=Math.abs(t-128),o=e-n;return o<0?"0":cp(new X.BigInteger("2",10).pow(o).toString(10))}_startAddress(){return new X.BigInteger(this.mask()+"0".repeat(128-this.subnetMask),2)}startAddress(){return r.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new X.BigInteger("1");return r.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new X.BigInteger(this.mask()+"1".repeat(128-this.subnetMask),2)}endAddress(){return r.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new X.BigInteger("1");return r.fromBigInteger(this._endAddress().subtract(t))}getScope(){let t=Io[this.getBits(12,16).intValue()];return this.getType()==="Global unicast"&&t!=="Link local"&&(t="Global"),t||"Unknown"}getType(){for(let t of Object.keys(Tn))if(this.isInSubnet(new r(t)))return Tn[t];return"Global unicast"}getBits(t,e){return new X.BigInteger(this.getBitsBase2(t,e),2)}getBitsBase2(t,e){return this.binaryZeroPad().slice(t,e)}getBitsBase16(t,e){let n=e-t;if(n%4!==0)throw new Error("Length of bits to retrieve must be divisible by four");return this.getBits(t,e).toString(16).padStart(n/4,"0")}getBitsPastSubnet(){return this.getBitsBase2(this.subnetMask,128)}reverseForm(t){t||(t={});let e=Math.floor(this.subnetMask/4),n=this.canonicalForm().replace(/:/g,"").split("").slice(0,e).reverse().join(".");return e>0?t.omitSuffix?n:(0,Q.sprintf)("%s.ip6.arpa.",n):t.omitSuffix?"":"ip6.arpa."}correctForm(){let t,e=[],n=0,o=[];for(t=0;t<this.parsedAddress.length;t++){let l=parseInt(this.parsedAddress[t],16);l===0&&n++,l!==0&&n>0&&(n>1&&o.push([t-n,t-1]),n=0)}n>1&&o.push([this.parsedAddress.length-n,this.parsedAddress.length-1]);let c=o.map(l=>l[1]-l[0]+1);if(o.length>0){let l=c.indexOf(Math.max(...c));e=fp(this.parsedAddress,o[l])}else e=this.parsedAddress;for(t=0;t<e.length;t++)e[t]!=="compact"&&(e[t]=parseInt(e[t],16).toString(16));let f=e.join(":");return f=f.replace(/^compact$/,"::"),f=f.replace(/^compact|compact$/,":"),f=f.replace(/compact/,""),f}binaryZeroPad(){return this.bigInteger().toString(2).padStart(128,"0")}parse4in6(t){let e=t.split(":"),o=e.slice(-1)[0].match(ue);if(o){this.parsedAddress4=o[0],this.address4=new st(this.parsedAddress4);for(let c=0;c<this.address4.groups;c++)if(/^0[0-9]+/.test(this.address4.parsedAddress[c]))throw new J("IPv4 addresses can't have leading zeroes.",t.replace(ue,this.address4.parsedAddress.map(up).join(".")));this.v4=!0,e[e.length-1]=this.address4.toGroup6(),t=e.join(":")}return t}parse(t){t=this.parse4in6(t);let e=t.match(Cn);if(e)throw new J((0,Q.sprintf)("Bad character%s detected in address: %s",e.length>1?"s":"",e.join("")),t.replace(Cn,'<span class="parse-error">$1</span>'));let n=t.match(En);if(n)throw new J((0,Q.sprintf)("Address failed regex: %s",n.join("")),t.replace(En,'<span class="parse-error">$1</span>'));let o=[],c=t.split("::");if(c.length===2){let f=c[0].split(":"),l=c[1].split(":");f.length===1&&f[0]===""&&(f=[]),l.length===1&&l[0]===""&&(l=[]);let g=this.groups-(f.length+l.length);if(!g)throw new J("Error parsing groups");this.elidedGroups=g,this.elisionBegin=f.length,this.elisionEnd=f.length+this.elidedGroups,o=o.concat(f);for(let A=0;A<g;A++)o.push("0");o=o.concat(l)}else if(c.length===1)o=t.split(":"),this.elidedGroups=0;else throw new J("Too many :: groups found");if(o=o.map(f=>(0,Q.sprintf)("%x",parseInt(f,16))),o.length!==this.groups)throw new J("Incorrect number of groups found");return o}canonicalForm(){return this.parsedAddress.map(ko).join(":")}decimal(){return this.parsedAddress.map(t=>(0,Q.sprintf)("%05d",parseInt(t,16))).join(":")}bigInteger(){return new X.BigInteger(this.parsedAddress.map(ko).join(""),16)}to4(){let t=this.binaryZeroPad().split("");return st.fromHex(new X.BigInteger(t.slice(96,128).join(""),2).toString(16))}to4in6(){let t=this.to4(),n=new r(this.parsedAddress.slice(0,6).join(":"),6).correctForm(),o="";return/:$/.test(n)||(o=":"),n+o+t.address}inspectTeredo(){let t=this.getBitsBase16(0,32),e=this.getBits(80,96).xor(new X.BigInteger("ffff",16)).toString(),n=st.fromHex(this.getBitsBase16(32,64)),o=st.fromHex(this.getBits(96,128).xor(new X.BigInteger("ffffffff",16)).toString(16)),c=this.getBits(64,80),f=this.getBitsBase2(64,80),l=c.testBit(15),g=c.testBit(14),A=c.testBit(8),p=c.testBit(9),b=new X.BigInteger(f.slice(2,6)+f.slice(8,16),2).toString(10);return{prefix:(0,Q.sprintf)("%s:%s",t.slice(0,4),t.slice(4,8)),server4:n.address,client4:o.address,flags:f,coneNat:l,microsoft:{reserved:g,universalLocal:p,groupIndividual:A,nonce:b},udpPort:e}}inspect6to4(){let t=this.getBitsBase16(0,16),e=st.fromHex(this.getBitsBase16(16,48));return{prefix:(0,Q.sprintf)("%s",t.slice(0,4)),gateway:e.address}}to6to4(){if(!this.is4())return null;let t=["2002",this.getBitsBase16(96,112),this.getBitsBase16(112,128),"","/16"].join(":");return new r(t)}toByteArray(){let t=this.bigInteger().toByteArray();return t.length===17&&t[0]===0?t.slice(1):t}toUnsignedByteArray(){return this.toByteArray().map(Oo)}static fromByteArray(t){return this.fromUnsignedByteArray(t.map(Oo))}static fromUnsignedByteArray(t){let e=new X.BigInteger("256",10),n=new X.BigInteger("0",10),o=new X.BigInteger("1",10);for(let c=t.length-1;c>=0;c--)n=n.add(o.multiply(new X.BigInteger(t[c].toString(10),10))),o=o.multiply(e);return r.fromBigInteger(n)}isCanonical(){return this.addressMinusSuffix===this.canonicalForm()}isLinkLocal(){return this.getBitsBase2(0,64)==="1111111010000000000000000000000000000000000000000000000000000000"}isMulticast(){return this.getType()==="Multicast"}is4(){return this.v4}isTeredo(){return this.isInSubnet(new r("2001::/32"))}is6to4(){return this.isInSubnet(new r("2002::/16"))}isLoopback(){return this.getType()==="Loopback"}href(t){return t===void 0?t="":t=(0,Q.sprintf)(":%s",t),(0,Q.sprintf)("http://[%s]%s/",this.correctForm(),t)}link(t){t||(t={}),t.className===void 0&&(t.className=""),t.prefix===void 0&&(t.prefix="/#address="),t.v4===void 0&&(t.v4=!1);let e=this.correctForm;return t.v4&&(e=this.to4in6),t.className?(0,Q.sprintf)('<a href="%1$s%2$s" class="%3$s">%2$s</a>',t.prefix,e.call(this),t.className):(0,Q.sprintf)('<a href="%1$s%2$s">%2$s</a>',t.prefix,e.call(this))}group(){if(this.elidedGroups===0)return Xe(this.address).join(":");Ye(typeof this.elidedGroups=="number"),Ye(typeof this.elisionBegin=="number");let t=[],[e,n]=this.address.split("::");e.length?t.push(...Xe(e)):t.push("");let o=["hover-group"];for(let c=this.elisionBegin;c<this.elisionBegin+this.elidedGroups;c++)o.push((0,Q.sprintf)("group-%d",c));return t.push((0,Q.sprintf)('<span class="%s"></span>',o.join(" "))),n.length?t.push(...Xe(n,this.elisionEnd)):t.push(""),this.is4()&&(Ye(this.address4 instanceof st),t.pop(),t.push(this.address4.groupForV6())),t.join(":")}regularExpressionString(t=!1){let e=[],n=new r(this.correctForm());if(n.elidedGroups===0)e.push(Qe(n.parsedAddress));else if(n.elidedGroups===8)e.push(Dn(8));else{let o=n.address.split("::");o[0].length&&e.push(Qe(o[0].split(":"))),Ye(typeof n.elidedGroups=="number"),e.push(Dn(n.elidedGroups,o[0].length!==0,o[1].length!==0)),o[1].length&&e.push(Qe(o[1].split(":"))),e=[e.join(":")]}return t||(e=["(?=^|",Rn,"|[^\\w\\:])(",...e,")(?=[^\\w\\:]|",Rn,"|$)"]),e.join("")}regularExpression(t=!1){return new RegExp(this.regularExpressionString(t),"i")}};var pp=At("libp2p:ip-port-to-multiaddr"),Pn={ERR_INVALID_IP_PARAMETER:"ERR_INVALID_IP_PARAMETER",ERR_INVALID_PORT_PARAMETER:"ERR_INVALID_PORT_PARAMETER",ERR_INVALID_IP:"ERR_INVALID_IP"};function No(r,t){if(typeof r!="string")throw new lt(`invalid ip provided: ${r}`,Pn.ERR_INVALID_IP_PARAMETER);if(typeof t=="string"&&(t=parseInt(t)),isNaN(t))throw new lt(`invalid port provided: ${t}`,Pn.ERR_INVALID_PORT_PARAMETER);try{return new st(r),wt(`/ip4/${r}/tcp/${t}`)}catch{}try{let e=new Te(r);return e.is4()?wt(`/ip4/${e.to4().correctForm()}/tcp/${t}`):wt(`/ip6/${r}/tcp/${t}`)}catch{let n=`invalid ip:port for creating a multiaddr: ${r}:${t}`;throw pp.error(n),new lt(n,Pn.ERR_INVALID_IP)}}var Go=H(jo(),1);var Nn=H(mt("os"),1),qo=H(mt("path"),1);var gp={ip4:"IPv4",ip6:"IPv6"};function he(r,t={}){let e=r.getPath();return e!=null?Nn.default.platform()==="win32"?{path:qo.default.join("\\\\.\\pipe\\",e)}:{path:e}:{...r.toOptions(),...t}}function Fn(r,t,e){let n=o=>wt(`/${r}/${o}/tcp/${e}`);return(bp(t)?yp(gp[r]):[t]).map(n)}function bp(r){return["0.0.0.0","::"].includes(r)}var wp=Nn.default.networkInterfaces();function yp(r){let t=[];for(let[,e]of Object.entries(wp))if(e!=null)for(let n of e)n.family===r&&t.push(n.address);return t}var yt=At("libp2p:tcp:socket"),tr=(r,t)=>{let e=t.metrics,n=t.metricPrefix??"",o=t.socketInactivityTimeout??3e5,c=t.socketCloseTimeout??500;t.listeningAddr?.getPath()!=null&&(t.remoteAddr=t.listeningAddr),t.remoteAddr?.getPath()!=null&&(t.localAddr=t.remoteAddr);let f;if(t.remoteAddr!=null)f=t.remoteAddr;else{if(r.remoteAddress==null||r.remotePort==null)throw new lt("Could not determine remote address or port","ERR_NO_REMOTE_ADDRESS");f=No(r.remoteAddress,r.remotePort)}let l=he(f),g=l.path??`${l.host??""}:${l.port??""}`,{sink:A,source:p}=Go.default.duplex(r);r.setTimeout(o,()=>{yt("%s socket read timeout",g),e?.increment({[`${n}timeout`]:!0});let y;r.readable&&(y=new lt("Socket read timeout","ERR_SOCKET_READ_TIMEOUT")),r.destroy(y)}),r.once("close",()=>{yt("%s socket close",g),e?.increment({[`${n}close`]:!0}),b.timeline.close==null&&(b.timeline.close=Date.now())}),r.once("end",()=>{yt("%s socket end",g),e?.increment({[`${n}end`]:!0})});let b={async sink(y){try{await A(y)}catch(S){S.type!=="aborted"&&yt(S)}r.end()},source:p,remoteAddr:f,timeline:{open:Date.now()},async close(y={}){if(r.destroyed){yt("%s socket was already destroyed when trying to close",g);return}y.signal=y.signal??AbortSignal.timeout(c);try{yt("%s closing socket",g),await new Promise((S,h)=>{r.once("close",()=>{yt("%s socket closed",g),S()}),r.once("error",T=>{yt("%s socket error",g,T),b.timeline.close==null&&(b.timeline.close=Date.now()),h(T)}),r.setTimeout(c),r.end(),r.writableLength>0?r.once("drain",()=>{yt("%s socket drained",g),r.destroy()}):r.destroy()})}catch(S){this.abort(S)}},abort:y=>{yt("%s socket abort due to error",g,y),r.destroy(y)}};return b};var ot=At("libp2p:tcp:listener");async function _n(r){try{await r.close()}catch(t){ot.error("an error occurred closing the connection",t)}}var Sp=1,Tp=0,er=class extends Ge{context;server;connections=new Set;status={started:!1};metrics;addr;constructor(t){if(super(),this.context=t,t.keepAlive=t.keepAlive??!0,this.addr="unknown",this.server=Ho.default.createServer(t,this.onSocket.bind(this)),t.maxConnections!==void 0&&(this.server.maxConnections=t.maxConnections),t.closeServerOnMaxConnections!=null&&t.closeServerOnMaxConnections.closeAbove<t.closeServerOnMaxConnections.listenBelow)throw Error("closeAbove must be >= listenBelow");this.server.on("listening",()=>{if(t.metrics!=null){let e=this.server.address();e==null?this.addr="unknown":typeof e=="string"?this.addr=e:this.addr=`${e.address}:${e.port}`,t.metrics?.registerMetricGroup("libp2p_tcp_inbound_connections_total",{label:"address",help:"Current active connections in TCP listener",calculate:()=>({[this.addr]:this.connections.size})}),this.metrics={status:t.metrics.registerMetricGroup("libp2p_tcp_listener_status_info",{label:"address",help:"Current status of the TCP listener socket"}),errors:t.metrics.registerMetricGroup("libp2p_tcp_listener_errors_total",{label:"address",help:"Total count of TCP listener errors by type"}),events:t.metrics.registerMetricGroup("libp2p_tcp_listener_events_total",{label:"address",help:"Total count of TCP listener events by type"})},this.metrics?.status.update({[this.addr]:Sp})}this.dispatchEvent(new ce("listening"))}).on("error",e=>{this.metrics?.errors.increment({[`${this.addr} listen_error`]:!0}),this.dispatchEvent(new ce("error",{detail:e}))}).on("close",()=>{this.metrics?.status.update({[this.addr]:Tp}),this.dispatchEvent(new ce("close"))})}onSocket(t){t.on("error",n=>{ot("socket error",n),this.metrics?.events.increment({[`${this.addr} error`]:!0})});let e;try{e=tr(t,{listeningAddr:this.status.started?this.status.listeningAddr:void 0,socketInactivityTimeout:this.context.socketInactivityTimeout,socketCloseTimeout:this.context.socketCloseTimeout,metrics:this.metrics?.events,metricPrefix:`${this.addr} `})}catch(n){ot.error("inbound connection failed",n),this.metrics?.errors.increment({[`${this.addr} inbound_to_connection`]:!0});return}ot("new inbound connection %s",e.remoteAddr);try{this.context.upgrader.upgradeInbound(e).then(n=>{ot("inbound connection upgraded %s",e.remoteAddr),this.connections.add(e),t.once("close",()=>{this.connections.delete(e),this.context.closeServerOnMaxConnections!=null&&this.connections.size<this.context.closeServerOnMaxConnections.listenBelow&&this.netListen().catch(o=>{ot.error("error attempting to listen server once connection count under limit",o),this.context.closeServerOnMaxConnections?.onListenError?.(o)})}),this.context.handler!=null&&this.context.handler(n),this.context.closeServerOnMaxConnections!=null&&this.connections.size>=this.context.closeServerOnMaxConnections.closeAbove&&this.netClose(),this.dispatchEvent(new ce("connection",{detail:n}))}).catch(async n=>{ot.error("inbound connection failed",n),this.metrics?.errors.increment({[`${this.addr} inbound_upgrade`]:!0}),await _n(e)}).catch(n=>{ot.error("closing inbound connection failed",n)})}catch(n){ot.error("inbound connection failed",n),_n(e).catch(o=>{ot.error("closing inbound connection failed",o),this.metrics?.errors.increment({[`${this.addr} inbound_closing_failed`]:!0})})}}getAddrs(){if(!this.status.started)return[];let t=[],e=this.server.address(),{listeningAddr:n,peerId:o}=this.status;if(e==null)return[];if(typeof e=="string")t=[n];else try{n.toString().startsWith("/ip4")?t=t.concat(Fn("ip4",e.address,e.port)):e.family==="IPv6"&&(t=t.concat(Fn("ip6",e.address,e.port)))}catch(c){ot.error("could not turn %s:%s into multiaddr",e.address,e.port,c)}return t.map(c=>o!=null?c.encapsulate(`/p2p/${o}`):c)}async listen(t){if(this.status.started)throw Error("server is already listening");let e=t.getPeerId(),n=e==null?t.decapsulateCode(421):t,{backlog:o}=this.context;this.status={started:!0,listeningAddr:n,peerId:e,netConfig:he(n,{backlog:o})},await this.netListen()}async close(){await Promise.all(Array.from(this.connections.values()).map(async t=>{await _n(t)})),this.netClose()}async netListen(){if(!this.status.started||this.server.listening)return;let t=this.status.netConfig;await new Promise((e,n)=>{this.server.once("error",n),this.server.listen(t,e)}),ot("Listening on %s",this.server.address())}netClose(){!this.status.started||!this.server.listening||(ot("Closing server on %s",this.server.address()),this.server.close())}};var Tt=At("libp2p:tcp"),Ln=class{opts;metrics;components;constructor(t,e={}){this.opts=e,this.components=t,t.metrics!=null&&(this.metrics={dialerEvents:t.metrics.registerCounterGroup("libp2p_tcp_dialer_events_total",{label:"event",help:"Total count of TCP dialer events by type"})})}[Wn]=!0;[Symbol.toStringTag]="@libp2p/tcp";async dial(t,e){e.keepAlive=e.keepAlive??!0;let n=await this._connect(t,e);n.on("error",l=>{Tt("socket error",l)});let o=tr(n,{remoteAddr:t,socketInactivityTimeout:this.opts.outboundSocketInactivityTimeout,socketCloseTimeout:this.opts.socketCloseTimeout,metrics:this.metrics?.dialerEvents}),c=()=>{o.close().catch(l=>{Tt.error("Error closing maConn after abort",l)})};e.signal?.addEventListener("abort",c,{once:!0}),Tt("new outbound connection %s",o.remoteAddr);let f=await e.upgrader.upgradeOutbound(o);if(Tt("outbound connection %s upgraded",o.remoteAddr),e.signal?.removeEventListener("abort",c),e.signal?.aborted===!0)throw f.close().catch(l=>{Tt.error("Error closing conn after abort",l)}),new qt;return f}async _connect(t,e){if(e.signal?.aborted===!0)throw new qt;return new Promise((n,o)=>{let c=Date.now(),f=he(t),l=f.path??`${f.host??""}:${f.port}`;Tt("dialing %j",f);let g=Zo.default.connect(f),A=h=>{h.message=`connection error ${l}: ${h.message}`,this.metrics?.dialerEvents.increment({error:!0}),S(h)},p=()=>{Tt("connection timeout %s",l),this.metrics?.dialerEvents.increment({timeout:!0});let h=new lt(`connection timeout after ${Date.now()-c}ms`,"ERR_CONNECT_TIMEOUT");g.emit("error",h)},b=()=>{Tt("connection opened %j",f),this.metrics?.dialerEvents.increment({connect:!0}),S()},y=()=>{Tt("connection aborted %j",f),this.metrics?.dialerEvents.increment({abort:!0}),g.destroy(),S(new qt)},S=h=>{if(g.removeListener("error",A),g.removeListener("timeout",p),g.removeListener("connect",b),e.signal!=null&&e.signal.removeEventListener("abort",y),h!=null){o(h);return}n(g)};g.on("error",A),g.on("timeout",p),g.on("connect",b),e.signal!=null&&e.signal.addEventListener("abort",y)})}createListener(t){return new er({...t,maxConnections:this.opts.maxConnections,backlog:this.opts.backlog,closeServerOnMaxConnections:this.opts.closeServerOnMaxConnections,socketInactivityTimeout:this.opts.inboundSocketInactivityTimeout,socketCloseTimeout:this.opts.socketCloseTimeout,metrics:this.components.metrics})}filter(t){return t=Array.isArray(t)?t:[t],t.filter(e=>e.protoCodes().includes(290)?!1:e.protoCodes().includes(400)?!0:Dt.matches(e.decapsulateCode(421)))}};function Ap(r={}){return(t={})=>new Ln(t,r)}return ka(Ip);})();
7
7
  return Libp2PTcp}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/tcp",
3
- "version": "7.0.3-7debe031",
3
+ "version": "7.0.3-7f60b579",
4
4
  "description": "A TCP transport for libp2p",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/transport-tcp#readme",
@@ -50,24 +50,21 @@
50
50
  "test:electron-main": "aegir test -t electron-main"
51
51
  },
52
52
  "dependencies": {
53
- "@libp2p/interface": "0.0.1-7debe031",
54
- "@libp2p/logger": "2.1.1-7debe031",
55
- "@libp2p/utils": "3.0.12-7debe031",
53
+ "@libp2p/interface": "0.0.1-7f60b579",
54
+ "@libp2p/logger": "2.1.1-7f60b579",
55
+ "@libp2p/utils": "3.0.12-7f60b579",
56
56
  "@multiformats/mafmt": "^12.1.2",
57
57
  "@multiformats/multiaddr": "^12.1.3",
58
58
  "@types/sinon": "^10.0.15",
59
59
  "stream-to-it": "^0.2.2"
60
60
  },
61
61
  "devDependencies": {
62
- "@libp2p/interface-compliance-tests": "3.0.7-7debe031",
63
- "aegir": "^39.0.13",
62
+ "@libp2p/interface-compliance-tests": "3.0.7-7f60b579",
63
+ "aegir": "^40.0.1",
64
64
  "it-all": "^3.0.1",
65
65
  "it-pipe": "^3.0.1",
66
66
  "p-defer": "^4.0.0",
67
67
  "sinon": "^15.1.2",
68
68
  "uint8arrays": "^4.0.4"
69
- },
70
- "typedoc": {
71
- "entryPoint": "./src/index.ts"
72
69
  }
73
70
  }