@libp2p/tcp 8.0.2 → 8.0.3
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 +4 -4
- package/package.json +7 -7
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
|
|
2
|
+
"use strict";var Libp2PTcp=(()=>{var bn=Object.create;var Pe=Object.defineProperty;var wn=Object.getOwnPropertyDescriptor;var yn=Object.getOwnPropertyNames;var xn=Object.getPrototypeOf,Cn=Object.prototype.hasOwnProperty;var W=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var I=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),F=(t,e)=>{for(var r in e)Pe(t,r,{get:e[r],enumerable:!0})},Wt=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of yn(e))!Cn.call(t,o)&&o!==r&&Pe(t,o,{get:()=>e[o],enumerable:!(n=wn(e,o))||n.enumerable});return t};var J=(t,e,r)=>(r=t!=null?bn(xn(t)):{},Wt(e||!t||!t.__esModule?Pe(r,"default",{value:t,enumerable:!0}):r,t)),vn=t=>Wt(Pe({},"__esModule",{value:!0}),t);var Qt=I((li,Ht)=>{var le=1e3,ue=le*60,de=ue*60,re=de*24,En=re*7,An=re*365.25;Ht.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return In(t);if(r==="number"&&isFinite(t))return e.long?Tn(t):Sn(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function In(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*An;case"weeks":case"week":case"w":return r*En;case"days":case"day":case"d":return r*re;case"hours":case"hour":case"hrs":case"hr":case"h":return r*de;case"minutes":case"minute":case"mins":case"min":case"m":return r*ue;case"seconds":case"second":case"secs":case"sec":case"s":return r*le;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function Sn(t){var e=Math.abs(t);return e>=re?Math.round(t/re)+"d":e>=de?Math.round(t/de)+"h":e>=ue?Math.round(t/ue)+"m":e>=le?Math.round(t/le)+"s":t+"ms"}function Tn(t){var e=Math.abs(t);return e>=re?Oe(t,e,re,"day"):e>=de?Oe(t,e,de,"hour"):e>=ue?Oe(t,e,ue,"minute"):e>=le?Oe(t,e,le,"second"):t+" ms"}function Oe(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var Je=I((ui,Kt)=>{function Pn(t){r.debug=r,r.default=r,r.coerce=p,r.disable=s,r.enable=o,r.enabled=i,r.humanize=Qt(),r.destroy=y,Object.keys(t).forEach(l=>{r[l]=t[l]}),r.names=[],r.skips=[],r.formatters={};function e(l){let u=0;for(let f=0;f<l.length;f++)u=(u<<5)-u+l.charCodeAt(f),u|=0;return r.colors[Math.abs(u)%r.colors.length]}r.selectColor=e;function r(l){let u,f=null,g,h;function b(...x){if(!b.enabled)return;let m=b,E=Number(new Date),_=E-(u||E);m.diff=_,m.prev=u,m.curr=E,u=E,x[0]=r.coerce(x[0]),typeof x[0]!="string"&&x.unshift("%O");let A=0;x[0]=x[0].replace(/%([a-zA-Z%])/g,(L,R)=>{if(L==="%%")return"%";A++;let U=r.formatters[R];if(typeof U=="function"){let ce=x[A];L=U.call(m,ce),x.splice(A,1),A--}return L}),r.formatArgs.call(m,x),(m.log||r.log).apply(m,x)}return b.namespace=l,b.useColors=r.useColors(),b.color=r.selectColor(l),b.extend=n,b.destroy=r.destroy,Object.defineProperty(b,"enabled",{enumerable:!0,configurable:!1,get:()=>f!==null?f:(g!==r.namespaces&&(g=r.namespaces,h=r.enabled(l)),h),set:x=>{f=x}}),typeof r.init=="function"&&r.init(b),b}function n(l,u){let f=r(this.namespace+(typeof u>"u"?":":u)+l);return f.log=this.log,f}function o(l){r.save(l),r.namespaces=l,r.names=[],r.skips=[];let u,f=(typeof l=="string"?l:"").split(/[\s,]+/),g=f.length;for(u=0;u<g;u++)f[u]&&(l=f[u].replace(/\*/g,".*?"),l[0]==="-"?r.skips.push(new RegExp("^"+l.slice(1)+"$")):r.names.push(new RegExp("^"+l+"$")))}function s(){let l=[...r.names.map(a),...r.skips.map(a).map(u=>"-"+u)].join(",");return r.enable(""),l}function i(l){if(l[l.length-1]==="*")return!0;let u,f;for(u=0,f=r.skips.length;u<f;u++)if(r.skips[u].test(l))return!1;for(u=0,f=r.names.length;u<f;u++)if(r.names[u].test(l))return!0;return!1}function a(l){return l.toString().substring(2,l.toString().length-2).replace(/\.\*\?$/,"*")}function p(l){return l instanceof Error?l.stack||l.message:l}function y(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}Kt.exports=Pn});var Yt=I((k,Re)=>{k.formatArgs=Rn;k.save=Fn;k.load=Mn;k.useColors=On;k.storage=kn();k.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();k.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 On(){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 Rn(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Re.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),t.splice(n,0,e)}k.log=console.debug||console.log||(()=>{});function Fn(t){try{t?k.storage.setItem("debug",t):k.storage.removeItem("debug")}catch{}}function Mn(){let t;try{t=k.storage.getItem("debug")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function kn(){try{return localStorage}catch{}}Re.exports=Je()(k);var{formatters:Nn}=Re.exports;Nn.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var er=I((di,Zt)=>{"use strict";Zt.exports=(t,e)=>{e=e||process.argv;let r=t.startsWith("-")?"":t.length===1?"-":"--",n=e.indexOf(r+t),o=e.indexOf("--");return n!==-1&&(o===-1?!0:n<o)}});var rr=I((pi,tr)=>{"use strict";var Dn=W("os"),V=er(),T=process.env,pe;V("no-color")||V("no-colors")||V("color=false")?pe=!1:(V("color")||V("colors")||V("color=true")||V("color=always"))&&(pe=!0);"FORCE_COLOR"in T&&(pe=T.FORCE_COLOR.length===0||parseInt(T.FORCE_COLOR,10)!==0);function _n(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function Ln(t){if(pe===!1)return 0;if(V("color=16m")||V("color=full")||V("color=truecolor"))return 3;if(V("color=256"))return 2;if(t&&!t.isTTY&&pe!==!0)return 0;let e=pe?1:0;if(process.platform==="win32"){let r=Dn.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in T)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(r=>r in T)||T.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in T)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(T.TEAMCITY_VERSION)?1:0;if(T.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in T){let r=parseInt((T.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(T.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(T.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(T.TERM)||"COLORTERM"in T?1:(T.TERM==="dumb",e)}function Xe(t){let e=Ln(t);return _n(e)}tr.exports={supportsColor:Xe,stdout:Xe(process.stdout),stderr:Xe(process.stderr)}});var or=I((S,Me)=>{var Un=W("tty"),Fe=W("util");S.init=Gn;S.log=Vn;S.formatArgs=Bn;S.save=qn;S.load=jn;S.useColors=$n;S.destroy=Fe.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");S.colors=[6,2,3,4,5,1];try{let t=rr();t&&(t.stderr||t).level>=2&&(S.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{}S.inspectOpts=Object.keys(process.env).filter(t=>/^debug_/i.test(t)).reduce((t,e)=>{let r=e.substring(6).toLowerCase().replace(/_([a-z])/g,(o,s)=>s.toUpperCase()),n=process.env[e];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),t[r]=n,t},{});function $n(){return"colors"in S.inspectOpts?!!S.inspectOpts.colors:Un.isatty(process.stderr.fd)}function Bn(t){let{namespace:e,useColors:r}=this;if(r){let n=this.color,o="\x1B[3"+(n<8?n:"8;5;"+n),s=` ${o};1m${e} \x1B[0m`;t[0]=s+t[0].split(`
|
|
3
3
|
`).join(`
|
|
4
|
-
`+
|
|
5
|
-
`)}function
|
|
6
|
-
`).map(t=>t.trim()).join(" ")};vn.O=function(e){return this.inspectOpts.colors=this.useColors,be.inspect(e,this.inspectOpts)}});var Sn=N((Eu,We)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?We.exports=mn():We.exports=xn()});var Gn=N((Af,qn)=>{qn.exports=wr;var zn=128,uc=127,fc=~uc,lc=Math.pow(2,31);function wr(e,t,r){if(Number.MAX_SAFE_INTEGER&&e>Number.MAX_SAFE_INTEGER)throw wr.bytes=0,new RangeError("Could not encode varint");t=t||[],r=r||0;for(var n=r;e>=lc;)t[r++]=e&255|zn,e/=128;for(;e&fc;)t[r++]=e&255|zn,e>>>=7;return t[r]=e|0,wr.bytes=r-n+1,t}});var Wn=N((If,Zn)=>{Zn.exports=yr;var pc=128,Hn=127;function yr(e,n){var r=0,n=n||0,i=0,c=n,f,h=e.length;do{if(c>=h||i>49)throw yr.bytes=0,new RangeError("Could not decode varint");f=e[c++],r+=i<28?(f&Hn)<<i:(f&Hn)*Math.pow(2,i),i+=7}while(f>=pc);return yr.bytes=c-n,r}});var Jn=N((Rf,Xn)=>{var hc=Math.pow(2,7),dc=Math.pow(2,14),mc=Math.pow(2,21),gc=Math.pow(2,28),bc=Math.pow(2,35),wc=Math.pow(2,42),yc=Math.pow(2,49),vc=Math.pow(2,56),xc=Math.pow(2,63);Xn.exports=function(e){return e<hc?1:e<dc?2:e<mc?3:e<gc?4:e<bc?5:e<wc?6:e<yc?7:e<vc?8:e<xc?9:10}});var vr=N((Bf,Yn)=>{Yn.exports={encode:Gn(),decode:Wn(),encodingLength:Jn()}});var Lr=N((Pe,Ss)=>{(function(){var e,t=0xdeadbeefcafe,r=(t&16777215)==15715070;function n(s,o,a){s!=null&&(typeof s=="number"?this.fromNumber(s,o,a):o==null&&typeof s!="string"?this.fromString(s,256):this.fromString(s,o))}function i(){return new n(null)}function c(s,o,a,u,p,d){for(;--d>=0;){var b=o*this[s++]+a[u]+p;p=Math.floor(b/67108864),a[u++]=b&67108863}return p}function f(s,o,a,u,p,d){for(var b=o&32767,v=o>>15;--d>=0;){var M=this[s]&32767,F=this[s++]>>15,st=v*M+F*b;M=b*M+((st&32767)<<15)+a[u]+(p&1073741823),p=(M>>>30)+(st>>>15)+v*F+(p>>>30),a[u++]=M&1073741823}return p}function h(s,o,a,u,p,d){for(var b=o&16383,v=o>>14;--d>=0;){var M=this[s]&16383,F=this[s++]>>14,st=v*M+F*b;M=b*M+((st&16383)<<14)+a[u]+p,p=(M>>28)+(st>>14)+v*F,a[u++]=M&268435455}return p}var g=typeof navigator<"u";g&&r&&navigator.appName=="Microsoft Internet Explorer"?(n.prototype.am=f,e=30):g&&r&&navigator.appName!="Netscape"?(n.prototype.am=c,e=26):(n.prototype.am=h,e=28),n.prototype.DB=e,n.prototype.DM=(1<<e)-1,n.prototype.DV=1<<e;var C=52;n.prototype.FV=Math.pow(2,C),n.prototype.F1=C-e,n.prototype.F2=2*e-C;var l="0123456789abcdefghijklmnopqrstuvwxyz",y=new Array,x,S;for(x="0".charCodeAt(0),S=0;S<=9;++S)y[x++]=S;for(x="a".charCodeAt(0),S=10;S<36;++S)y[x++]=S;for(x="A".charCodeAt(0),S=10;S<36;++S)y[x++]=S;function m(s){return l.charAt(s)}function A(s,o){var a=y[s.charCodeAt(o)];return a??-1}function R(s){for(var o=this.t-1;o>=0;--o)s[o]=this[o];s.t=this.t,s.s=this.s}function E(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 o=i();return o.fromInt(s),o}function k(s,o){var a;if(o==16)a=4;else if(o==8)a=3;else if(o==256)a=8;else if(o==2)a=1;else if(o==32)a=5;else if(o==4)a=2;else{this.fromRadix(s,o);return}this.t=0,this.s=0;for(var u=s.length,p=!1,d=0;--u>=0;){var b=a==8?s[u]&255:A(s,u);if(b<0){s.charAt(u)=="-"&&(p=!0);continue}p=!1,d==0?this[this.t++]=b:d+a>this.DB?(this[this.t-1]|=(b&(1<<this.DB-d)-1)<<d,this[this.t++]=b>>this.DB-d):this[this.t-1]|=b<<d,d+=a,d>=this.DB&&(d-=this.DB)}a==8&&s[0]&128&&(this.s=-1,d>0&&(this[this.t-1]|=(1<<this.DB-d)-1<<d)),this.clamp(),p&&n.ZERO.subTo(this,this)}function O(){for(var s=this.s&this.DM;this.t>0&&this[this.t-1]==s;)--this.t}function J(s){if(this.s<0)return"-"+this.negate().toString(s);var o;if(s==16)o=4;else if(s==8)o=3;else if(s==2)o=1;else if(s==32)o=5;else if(s==4)o=2;else return this.toRadix(s);var a=(1<<o)-1,u,p=!1,d="",b=this.t,v=this.DB-b*this.DB%o;if(b-- >0)for(v<this.DB&&(u=this[b]>>v)>0&&(p=!0,d=m(u));b>=0;)v<o?(u=(this[b]&(1<<v)-1)<<o-v,u|=this[--b]>>(v+=this.DB-o)):(u=this[b]>>(v-=o)&a,v<=0&&(v+=this.DB,--b)),u>0&&(p=!0),p&&(d+=m(u));return p?d:"0"}function Z(){var s=i();return n.ZERO.subTo(this,s),s}function q(){return this.s<0?this.negate():this}function W(s){var o=this.s-s.s;if(o!=0)return o;var a=this.t;if(o=a-s.t,o!=0)return this.s<0?-o:o;for(;--a>=0;)if((o=this[a]-s[a])!=0)return o;return 0}function it(s){var o=1,a;return(a=s>>>16)!=0&&(s=a,o+=16),(a=s>>8)!=0&&(s=a,o+=8),(a=s>>4)!=0&&(s=a,o+=4),(a=s>>2)!=0&&(s=a,o+=2),(a=s>>1)!=0&&(s=a,o+=1),o}function Gs(){return this.t<=0?0:this.DB*(this.t-1)+it(this[this.t-1]^this.s&this.DM)}function Hs(s,o){var a;for(a=this.t-1;a>=0;--a)o[a+s]=this[a];for(a=s-1;a>=0;--a)o[a]=0;o.t=this.t+s,o.s=this.s}function Zs(s,o){for(var a=s;a<this.t;++a)o[a-s]=this[a];o.t=Math.max(this.t-s,0),o.s=this.s}function Ws(s,o){var a=s%this.DB,u=this.DB-a,p=(1<<u)-1,d=Math.floor(s/this.DB),b=this.s<<a&this.DM,v;for(v=this.t-1;v>=0;--v)o[v+d+1]=this[v]>>u|b,b=(this[v]&p)<<a;for(v=d-1;v>=0;--v)o[v]=0;o[d]=b,o.t=this.t+d+1,o.s=this.s,o.clamp()}function Xs(s,o){o.s=this.s;var a=Math.floor(s/this.DB);if(a>=this.t){o.t=0;return}var u=s%this.DB,p=this.DB-u,d=(1<<u)-1;o[0]=this[a]>>u;for(var b=a+1;b<this.t;++b)o[b-a-1]|=(this[b]&d)<<p,o[b-a]=this[b]>>u;u>0&&(o[this.t-a-1]|=(this.s&d)<<p),o.t=this.t-a,o.clamp()}function Js(s,o){for(var a=0,u=0,p=Math.min(s.t,this.t);a<p;)u+=this[a]-s[a],o[a++]=u&this.DM,u>>=this.DB;if(s.t<this.t){for(u-=s.s;a<this.t;)u+=this[a],o[a++]=u&this.DM,u>>=this.DB;u+=this.s}else{for(u+=this.s;a<s.t;)u-=s[a],o[a++]=u&this.DM,u>>=this.DB;u-=s.s}o.s=u<0?-1:0,u<-1?o[a++]=this.DV+u:u>0&&(o[a++]=u),o.t=a,o.clamp()}function Ys(s,o){var a=this.abs(),u=s.abs(),p=a.t;for(o.t=p+u.t;--p>=0;)o[p]=0;for(p=0;p<u.t;++p)o[p+a.t]=a.am(0,u[p],o,p,0,a.t);o.s=0,o.clamp(),this.s!=s.s&&n.ZERO.subTo(o,o)}function Qs(s){for(var o=this.abs(),a=s.t=2*o.t;--a>=0;)s[a]=0;for(a=0;a<o.t-1;++a){var u=o.am(a,o[a],s,2*a,0,1);(s[a+o.t]+=o.am(a+1,2*o[a],s,2*a+1,u,o.t-a-1))>=o.DV&&(s[a+o.t]-=o.DV,s[a+o.t+1]=1)}s.t>0&&(s[s.t-1]+=o.am(a,o[a],s,2*a,0,1)),s.s=0,s.clamp()}function Ks(s,o,a){var u=s.abs();if(!(u.t<=0)){var p=this.abs();if(p.t<u.t){o?.fromInt(0),a!=null&&this.copyTo(a);return}a==null&&(a=i());var d=i(),b=this.s,v=s.s,M=this.DB-it(u[u.t-1]);M>0?(u.lShiftTo(M,d),p.lShiftTo(M,a)):(u.copyTo(d),p.copyTo(a));var F=d.t,st=d[F-1];if(st!=0){var Q=st*(1<<this.F1)+(F>1?d[F-2]>>this.F2:0),gt=this.FV/Q,pe=(1<<this.F1)/Q,ct=1<<this.F2,ut=a.t,he=ut-F,xt=o??i();for(d.dlShiftTo(he,xt),a.compareTo(xt)>=0&&(a[a.t++]=1,a.subTo(xt,a)),n.ONE.dlShiftTo(F,xt),xt.subTo(d,d);d.t<F;)d[d.t++]=0;for(;--he>=0;){var Ge=a[--ut]==st?this.DM:Math.floor(a[ut]*gt+(a[ut-1]+ct)*pe);if((a[ut]+=d.am(0,Ge,a,he,0,F))<Ge)for(d.dlShiftTo(he,xt),a.subTo(xt,a);a[ut]<--Ge;)a.subTo(xt,a)}o!=null&&(a.drShiftTo(F,o),b!=v&&n.ZERO.subTo(o,o)),a.t=F,a.clamp(),M>0&&a.rShiftTo(M,a),b<0&&n.ZERO.subTo(a,a)}}}function to(s){var o=i();return this.abs().divRemTo(s,null,o),this.s<0&&o.compareTo(n.ZERO)>0&&s.subTo(o,o),o}function Rt(s){this.m=s}function eo(s){return s.s<0||s.compareTo(this.m)>=0?s.mod(this.m):s}function ro(s){return s}function no(s){s.divRemTo(this.m,null,s)}function so(s,o,a){s.multiplyTo(o,a),this.reduce(a)}function oo(s,o){s.squareTo(o),this.reduce(o)}Rt.prototype.convert=eo,Rt.prototype.revert=ro,Rt.prototype.reduce=no,Rt.prototype.mulTo=so,Rt.prototype.sqrTo=oo;function io(){if(this.t<1)return 0;var s=this[0];if(!(s&1))return 0;var o=s&3;return o=o*(2-(s&15)*o)&15,o=o*(2-(s&255)*o)&255,o=o*(2-((s&65535)*o&65535))&65535,o=o*(2-s*o%this.DV)%this.DV,o>0?this.DV-o:-o}function Bt(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 ao(s){var o=i();return s.abs().dlShiftTo(this.m.t,o),o.divRemTo(this.m,null,o),s.s<0&&o.compareTo(n.ZERO)>0&&this.m.subTo(o,o),o}function co(s){var o=i();return s.copyTo(o),this.reduce(o),o}function uo(s){for(;s.t<=this.mt2;)s[s.t++]=0;for(var o=0;o<this.m.t;++o){var a=s[o]&32767,u=a*this.mpl+((a*this.mph+(s[o]>>15)*this.mpl&this.um)<<15)&s.DM;for(a=o+this.m.t,s[a]+=this.m.am(0,u,s,o,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 fo(s,o){s.squareTo(o),this.reduce(o)}function lo(s,o,a){s.multiplyTo(o,a),this.reduce(a)}Bt.prototype.convert=ao,Bt.prototype.revert=co,Bt.prototype.reduce=uo,Bt.prototype.mulTo=lo,Bt.prototype.sqrTo=fo;function po(){return(this.t>0?this[0]&1:this.s)==0}function ho(s,o){if(s>4294967295||s<1)return n.ONE;var a=i(),u=i(),p=o.convert(this),d=it(s)-1;for(p.copyTo(a);--d>=0;)if(o.sqrTo(a,u),(s&1<<d)>0)o.mulTo(u,p,a);else{var b=a;a=u,u=b}return o.revert(a)}function mo(s,o){var a;return s<256||o.isEven()?a=new Rt(o):a=new Bt(o),this.exp(s,a)}n.prototype.copyTo=R,n.prototype.fromInt=E,n.prototype.fromString=k,n.prototype.clamp=O,n.prototype.dlShiftTo=Hs,n.prototype.drShiftTo=Zs,n.prototype.lShiftTo=Ws,n.prototype.rShiftTo=Xs,n.prototype.subTo=Js,n.prototype.multiplyTo=Ys,n.prototype.squareTo=Qs,n.prototype.divRemTo=Ks,n.prototype.invDigit=io,n.prototype.isEven=po,n.prototype.exp=ho,n.prototype.toString=J,n.prototype.negate=Z,n.prototype.abs=q,n.prototype.compareTo=W,n.prototype.bitLength=Gs,n.prototype.mod=to,n.prototype.modPowInt=mo,n.ZERO=I(0),n.ONE=I(1);function go(){var s=i();return this.copyTo(s),s}function bo(){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 wo(){return this.t==0?this.s:this[0]<<24>>24}function yo(){return this.t==0?this.s:this[0]<<16>>16}function vo(s){return Math.floor(Math.LN2*this.DB/Math.log(s))}function xo(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function So(s){if(s==null&&(s=10),this.signum()==0||s<2||s>36)return"0";var o=this.chunkSize(s),a=Math.pow(s,o),u=I(a),p=i(),d=i(),b="";for(this.divRemTo(u,p,d);p.signum()>0;)b=(a+d.intValue()).toString(s).substr(1)+b,p.divRemTo(u,p,d);return d.intValue().toString(s)+b}function To(s,o){this.fromInt(0),o==null&&(o=10);for(var a=this.chunkSize(o),u=Math.pow(o,a),p=!1,d=0,b=0,v=0;v<s.length;++v){var M=A(s,v);if(M<0){s.charAt(v)=="-"&&this.signum()==0&&(p=!0);continue}b=o*b+M,++d>=a&&(this.dMultiply(u),this.dAddOffset(b,0),d=0,b=0)}d>0&&(this.dMultiply(Math.pow(o,d)),this.dAddOffset(b,0)),p&&n.ZERO.subTo(this,this)}function Co(s,o,a){if(typeof o=="number")if(s<2)this.fromInt(1);else for(this.fromNumber(s,a),this.testBit(s-1)||this.bitwiseTo(n.ONE.shiftLeft(s-1),Ve,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(o);)this.dAddOffset(2,0),this.bitLength()>s&&this.subTo(n.ONE.shiftLeft(s-1),this);else{var u=new Array,p=s&7;u.length=(s>>3)+1,o.nextBytes(u),p>0?u[0]&=(1<<p)-1:u[0]=0,this.fromString(u,256)}}function Eo(){var s=this.t,o=new Array;o[0]=this.s;var a=this.DB-s*this.DB%8,u,p=0;if(s-- >0)for(a<this.DB&&(u=this[s]>>a)!=(this.s&this.DM)>>a&&(o[p++]=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),p==0&&(this.s&128)!=(u&128)&&++p,(p>0||u!=this.s)&&(o[p++]=u);return o}function Ao(s){return this.compareTo(s)==0}function Io(s){return this.compareTo(s)<0?this:s}function Ro(s){return this.compareTo(s)>0?this:s}function Bo(s,o,a){var u,p,d=Math.min(s.t,this.t);for(u=0;u<d;++u)a[u]=o(this[u],s[u]);if(s.t<this.t){for(p=s.s&this.DM,u=d;u<this.t;++u)a[u]=o(this[u],p);a.t=this.t}else{for(p=this.s&this.DM,u=d;u<s.t;++u)a[u]=o(p,s[u]);a.t=s.t}a.s=o(this.s,s.s),a.clamp()}function Mo(s,o){return s&o}function Do(s){var o=i();return this.bitwiseTo(s,Mo,o),o}function Ve(s,o){return s|o}function ko(s){var o=i();return this.bitwiseTo(s,Ve,o),o}function rn(s,o){return s^o}function Po(s){var o=i();return this.bitwiseTo(s,rn,o),o}function nn(s,o){return s&~o}function Oo(s){var o=i();return this.bitwiseTo(s,nn,o),o}function No(){for(var s=i(),o=0;o<this.t;++o)s[o]=this.DM&~this[o];return s.t=this.t,s.s=~this.s,s}function _o(s){var o=i();return s<0?this.rShiftTo(-s,o):this.lShiftTo(s,o),o}function Fo(s){var o=i();return s<0?this.lShiftTo(-s,o):this.rShiftTo(s,o),o}function Lo(s){if(s==0)return-1;var o=0;return s&65535||(s>>=16,o+=16),s&255||(s>>=8,o+=8),s&15||(s>>=4,o+=4),s&3||(s>>=2,o+=2),s&1||++o,o}function Uo(){for(var s=0;s<this.t;++s)if(this[s]!=0)return s*this.DB+Lo(this[s]);return this.s<0?this.t*this.DB:-1}function $o(s){for(var o=0;s!=0;)s&=s-1,++o;return o}function Vo(){for(var s=0,o=this.s&this.DM,a=0;a<this.t;++a)s+=$o(this[a]^o);return s}function jo(s){var o=Math.floor(s/this.DB);return o>=this.t?this.s!=0:(this[o]&1<<s%this.DB)!=0}function zo(s,o){var a=n.ONE.shiftLeft(s);return this.bitwiseTo(a,o,a),a}function qo(s){return this.changeBit(s,Ve)}function Go(s){return this.changeBit(s,nn)}function Ho(s){return this.changeBit(s,rn)}function Zo(s,o){for(var a=0,u=0,p=Math.min(s.t,this.t);a<p;)u+=this[a]+s[a],o[a++]=u&this.DM,u>>=this.DB;if(s.t<this.t){for(u+=s.s;a<this.t;)u+=this[a],o[a++]=u&this.DM,u>>=this.DB;u+=this.s}else{for(u+=this.s;a<s.t;)u+=s[a],o[a++]=u&this.DM,u>>=this.DB;u+=s.s}o.s=u<0?-1:0,u>0?o[a++]=u:u<-1&&(o[a++]=this.DV+u),o.t=a,o.clamp()}function Wo(s){var o=i();return this.addTo(s,o),o}function Xo(s){var o=i();return this.subTo(s,o),o}function Jo(s){var o=i();return this.multiplyTo(s,o),o}function Yo(){var s=i();return this.squareTo(s),s}function Qo(s){var o=i();return this.divRemTo(s,o,null),o}function Ko(s){var o=i();return this.divRemTo(s,null,o),o}function ti(s){var o=i(),a=i();return this.divRemTo(s,o,a),new Array(o,a)}function ei(s){this[this.t]=this.am(0,s-1,this,0,0,this.t),++this.t,this.clamp()}function ri(s,o){if(s!=0){for(;this.t<=o;)this[this.t++]=0;for(this[o]+=s;this[o]>=this.DV;)this[o]-=this.DV,++o>=this.t&&(this[this.t++]=0),++this[o]}}function se(){}function sn(s){return s}function ni(s,o,a){s.multiplyTo(o,a)}function si(s,o){s.squareTo(o)}se.prototype.convert=sn,se.prototype.revert=sn,se.prototype.mulTo=ni,se.prototype.sqrTo=si;function oi(s){return this.exp(s,new se)}function ii(s,o,a){var u=Math.min(this.t+s.t,o);for(a.s=0,a.t=u;u>0;)a[--u]=0;var p;for(p=a.t-this.t;u<p;++u)a[u+this.t]=this.am(0,s[u],a,u,0,this.t);for(p=Math.min(s.t,o);u<p;++u)this.am(0,s[u],a,u,0,o-u);a.clamp()}function ai(s,o,a){--o;var u=a.t=this.t+s.t-o;for(a.s=0;--u>=0;)a[u]=0;for(u=Math.max(o-this.t,0);u<s.t;++u)a[this.t+u-o]=this.am(o-u,s[u],a,0,0,this.t+u-o);a.clamp(),a.drShiftTo(1,a)}function Mt(s){this.r2=i(),this.q3=i(),n.ONE.dlShiftTo(2*s.t,this.r2),this.mu=this.r2.divide(s),this.m=s}function ci(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 o=i();return s.copyTo(o),this.reduce(o),o}function ui(s){return s}function fi(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 li(s,o){s.squareTo(o),this.reduce(o)}function pi(s,o,a){s.multiplyTo(o,a),this.reduce(a)}Mt.prototype.convert=ci,Mt.prototype.revert=ui,Mt.prototype.reduce=fi,Mt.prototype.mulTo=pi,Mt.prototype.sqrTo=li;function hi(s,o){var a=s.bitLength(),u,p=I(1),d;if(a<=0)return p;a<18?u=1:a<48?u=3:a<144?u=4:a<768?u=5:u=6,a<8?d=new Rt(o):o.isEven()?d=new Mt(o):d=new Bt(o);var b=new Array,v=3,M=u-1,F=(1<<u)-1;if(b[1]=d.convert(this),u>1){var st=i();for(d.sqrTo(b[1],st);v<=F;)b[v]=i(),d.mulTo(st,b[v-2],b[v]),v+=2}var Q=s.t-1,gt,pe=!0,ct=i(),ut;for(a=it(s[Q])-1;Q>=0;){for(a>=M?gt=s[Q]>>a-M&F:(gt=(s[Q]&(1<<a+1)-1)<<M-a,Q>0&&(gt|=s[Q-1]>>this.DB+a-M)),v=u;!(gt&1);)gt>>=1,--v;if((a-=v)<0&&(a+=this.DB,--Q),pe)b[gt].copyTo(p),pe=!1;else{for(;v>1;)d.sqrTo(p,ct),d.sqrTo(ct,p),v-=2;v>0?d.sqrTo(p,ct):(ut=p,p=ct,ct=ut),d.mulTo(ct,b[gt],p)}for(;Q>=0&&!(s[Q]&1<<a);)d.sqrTo(p,ct),ut=p,p=ct,ct=ut,--a<0&&(a=this.DB-1,--Q)}return d.revert(p)}function di(s){var o=this.s<0?this.negate():this.clone(),a=s.s<0?s.negate():s.clone();if(o.compareTo(a)<0){var u=o;o=a,a=u}var p=o.getLowestSetBit(),d=a.getLowestSetBit();if(d<0)return o;for(p<d&&(d=p),d>0&&(o.rShiftTo(d,o),a.rShiftTo(d,a));o.signum()>0;)(p=o.getLowestSetBit())>0&&o.rShiftTo(p,o),(p=a.getLowestSetBit())>0&&a.rShiftTo(p,a),o.compareTo(a)>=0?(o.subTo(a,o),o.rShiftTo(1,o)):(a.subTo(o,a),a.rShiftTo(1,a));return d>0&&a.lShiftTo(d,a),a}function mi(s){if(s<=0)return 0;var o=this.DV%s,a=this.s<0?s-1:0;if(this.t>0)if(o==0)a=this[0]%s;else for(var u=this.t-1;u>=0;--u)a=(o*a+this[u])%s;return a}function gi(s){var o=s.isEven();if(this.isEven()&&o||s.signum()==0)return n.ZERO;for(var a=s.clone(),u=this.clone(),p=I(1),d=I(0),b=I(0),v=I(1);a.signum()!=0;){for(;a.isEven();)a.rShiftTo(1,a),o?((!p.isEven()||!d.isEven())&&(p.addTo(this,p),d.subTo(s,d)),p.rShiftTo(1,p)):d.isEven()||d.subTo(s,d),d.rShiftTo(1,d);for(;u.isEven();)u.rShiftTo(1,u),o?((!b.isEven()||!v.isEven())&&(b.addTo(this,b),v.subTo(s,v)),b.rShiftTo(1,b)):v.isEven()||v.subTo(s,v),v.rShiftTo(1,v);a.compareTo(u)>=0?(a.subTo(u,a),o&&p.subTo(b,p),d.subTo(v,d)):(u.subTo(a,u),o&&b.subTo(p,b),v.subTo(d,v))}if(u.compareTo(n.ONE)!=0)return n.ZERO;if(v.compareTo(s)>=0)return v.subtract(s);if(v.signum()<0)v.addTo(s,v);else return v;return v.signum()<0?v.add(s):v}var G=[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],bi=(1<<26)/G[G.length-1];function wi(s){var o,a=this.abs();if(a.t==1&&a[0]<=G[G.length-1]){for(o=0;o<G.length;++o)if(a[0]==G[o])return!0;return!1}if(a.isEven())return!1;for(o=1;o<G.length;){for(var u=G[o],p=o+1;p<G.length&&u<bi;)u*=G[p++];for(u=a.modInt(u);o<p;)if(u%G[o++]==0)return!1}return a.millerRabin(s)}function yi(s){var o=this.subtract(n.ONE),a=o.getLowestSetBit();if(a<=0)return!1;var u=o.shiftRight(a);s=s+1>>1,s>G.length&&(s=G.length);for(var p=i(),d=0;d<s;++d){p.fromInt(G[Math.floor(Math.random()*G.length)]);var b=p.modPow(u,this);if(b.compareTo(n.ONE)!=0&&b.compareTo(o)!=0){for(var v=1;v++<a&&b.compareTo(o)!=0;)if(b=b.modPowInt(2,this),b.compareTo(n.ONE)==0)return!1;if(b.compareTo(o)!=0)return!1}}return!0}n.prototype.chunkSize=vo,n.prototype.toRadix=So,n.prototype.fromRadix=To,n.prototype.fromNumber=Co,n.prototype.bitwiseTo=Bo,n.prototype.changeBit=zo,n.prototype.addTo=Zo,n.prototype.dMultiply=ei,n.prototype.dAddOffset=ri,n.prototype.multiplyLowerTo=ii,n.prototype.multiplyUpperTo=ai,n.prototype.modInt=mi,n.prototype.millerRabin=yi,n.prototype.clone=go,n.prototype.intValue=bo,n.prototype.byteValue=wo,n.prototype.shortValue=yo,n.prototype.signum=xo,n.prototype.toByteArray=Eo,n.prototype.equals=Ao,n.prototype.min=Io,n.prototype.max=Ro,n.prototype.and=Do,n.prototype.or=ko,n.prototype.xor=Po,n.prototype.andNot=Oo,n.prototype.not=No,n.prototype.shiftLeft=_o,n.prototype.shiftRight=Fo,n.prototype.getLowestSetBit=Uo,n.prototype.bitCount=Vo,n.prototype.testBit=jo,n.prototype.setBit=qo,n.prototype.clearBit=Go,n.prototype.flipBit=Ho,n.prototype.add=Wo,n.prototype.subtract=Xo,n.prototype.multiply=Jo,n.prototype.divide=Qo,n.prototype.remainder=Ko,n.prototype.divideAndRemainder=ti,n.prototype.modPow=hi,n.prototype.modInverse=gi,n.prototype.pow=oi,n.prototype.gcd=di,n.prototype.isProbablePrime=wi,n.prototype.square=Yo,n.prototype.Barrett=Mt;var le,Y,_;function vi(s){Y[_++]^=s&255,Y[_++]^=s>>8&255,Y[_++]^=s>>16&255,Y[_++]^=s>>24&255,_>=qe&&(_-=qe)}function on(){vi(new Date().getTime())}if(Y==null){Y=new Array,_=0;var at;if(typeof window<"u"&&window.crypto){if(window.crypto.getRandomValues){var an=new Uint8Array(32);for(window.crypto.getRandomValues(an),at=0;at<32;++at)Y[_++]=an[at]}else if(navigator.appName=="Netscape"&&navigator.appVersion<"5"){var cn=window.crypto.random(32);for(at=0;at<cn.length;++at)Y[_++]=cn.charCodeAt(at)&255}}for(;_<qe;)at=Math.floor(65536*Math.random()),Y[_++]=at>>>8,Y[_++]=at&255;_=0,on()}function xi(){if(le==null){for(on(),le=Ei(),le.init(Y),_=0;_<Y.length;++_)Y[_]=0;_=0}return le.next()}function Si(s){var o;for(o=0;o<s.length;++o)s[o]=xi()}function je(){}je.prototype.nextBytes=Si;function ze(){this.i=0,this.j=0,this.S=new Array}function Ti(s){var o,a,u;for(o=0;o<256;++o)this.S[o]=o;for(a=0,o=0;o<256;++o)a=a+this.S[o]+s[o%s.length]&255,u=this.S[o],this.S[o]=this.S[a],this.S[a]=u;this.i=0,this.j=0}function Ci(){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]}ze.prototype.init=Ti,ze.prototype.next=Ci;function Ei(){return new ze}var qe=256;typeof Pe<"u"?Pe=Ss.exports={default:n,BigInteger:n,SecureRandom:je}:this.jsbn={BigInteger:n,SecureRandom:je}}).call(Pe)});var ue=N(Oe=>{(function(){"use strict";var e={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 r(f,h){return t.apply(null,[f].concat(h||[]))}function n(f,h){var g=1,C=f.length,l,y="",x,S,m,A,R,E,I,k;for(x=0;x<C;x++)if(typeof f[x]=="string")y+=f[x];else if(typeof f[x]=="object"){if(m=f[x],m.keys)for(l=h[g],S=0;S<m.keys.length;S++){if(l==null)throw new Error(t('[sprintf] Cannot access property "%s" of undefined value "%s"',m.keys[S],m.keys[S-1]));l=l[m.keys[S]]}else m.param_no?l=h[m.param_no]:l=h[g++];if(e.not_type.test(m.type)&&e.not_primitive.test(m.type)&&l instanceof Function&&(l=l()),e.numeric_arg.test(m.type)&&typeof l!="number"&&isNaN(l))throw new TypeError(t("[sprintf] expecting number but found %T",l));switch(e.number.test(m.type)&&(I=l>=0),m.type){case"b":l=parseInt(l,10).toString(2);break;case"c":l=String.fromCharCode(parseInt(l,10));break;case"d":case"i":l=parseInt(l,10);break;case"j":l=JSON.stringify(l,null,m.width?parseInt(m.width):0);break;case"e":l=m.precision?parseFloat(l).toExponential(m.precision):parseFloat(l).toExponential();break;case"f":l=m.precision?parseFloat(l).toFixed(m.precision):parseFloat(l);break;case"g":l=m.precision?String(Number(l.toPrecision(m.precision))):parseFloat(l);break;case"o":l=(parseInt(l,10)>>>0).toString(8);break;case"s":l=String(l),l=m.precision?l.substring(0,m.precision):l;break;case"t":l=String(!!l),l=m.precision?l.substring(0,m.precision):l;break;case"T":l=Object.prototype.toString.call(l).slice(8,-1).toLowerCase(),l=m.precision?l.substring(0,m.precision):l;break;case"u":l=parseInt(l,10)>>>0;break;case"v":l=l.valueOf(),l=m.precision?l.substring(0,m.precision):l;break;case"x":l=(parseInt(l,10)>>>0).toString(16);break;case"X":l=(parseInt(l,10)>>>0).toString(16).toUpperCase();break}e.json.test(m.type)?y+=l:(e.number.test(m.type)&&(!I||m.sign)?(k=I?"+":"-",l=l.toString().replace(e.sign,"")):k="",R=m.pad_char?m.pad_char==="0"?"0":m.pad_char.charAt(1):" ",E=m.width-(k+l).length,A=m.width&&E>0?R.repeat(E):"",y+=m.align?k+l+A:R==="0"?k+A+l:A+k+l)}return y}var i=Object.create(null);function c(f){if(i[f])return i[f];for(var h=f,g,C=[],l=0;h;){if((g=e.text.exec(h))!==null)C.push(g[0]);else if((g=e.modulo.exec(h))!==null)C.push("%");else if((g=e.placeholder.exec(h))!==null){if(g[2]){l|=1;var y=[],x=g[2],S=[];if((S=e.key.exec(x))!==null)for(y.push(S[1]);(x=x.substring(S[0].length))!=="";)if((S=e.key_access.exec(x))!==null)y.push(S[1]);else if((S=e.index_access.exec(x))!==null)y.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]=y}else l|=2;if(l===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");C.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");h=h.substring(g[0].length)}return i[f]=C}typeof Oe<"u"&&(Oe.sprintf=t,Oe.vsprintf=r),typeof window<"u"&&(window.sprintf=t,window.vsprintf=r,typeof define=="function"&&define.amd&&define(function(){return{sprintf:t,vsprintf:r}}))})()});var Le=N((Sp,Ps)=>{Ps.exports=e=>{if(e[Symbol.asyncIterator])return e;if(e.getReader)return async function*(){let t=e.getReader();try{for(;;){let{done:r,value:n}=await t.read();if(r)return;yield n}}finally{t.releaseLock()}}();throw new Error("unknown stream")}});var Ns=N((Tp,Os)=>{Os.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 Xr=N((Cp,_s)=>{var ru=Ns();_s.exports=e=>async t=>{t=ru(t);let r=E=>{typeof E.return=="function"&&E.return()},n=null,i=null,c=E=>{n=E,i&&i(E),r(t)},f=null,h=!1,g=()=>{h=!0,f&&f()},C=null,l=!1,y=()=>{l=!0,C&&C()},x=null,S=()=>{x&&x()},m=()=>new Promise((E,I)=>{f=x=E,i=I,e.once("drain",S)}),A=()=>(r(t),new Promise((E,I)=>{if(h||l||n)return E();C=f=E,i=I})),R=()=>{e.removeListener("error",c),e.removeListener("close",g),e.removeListener("finish",y),e.removeListener("drain",S)};e.once("error",c),e.once("close",g),e.once("finish",y);try{for await(let E of t){if(!e.writable||e.destroyed||n)break;e.write(E)===!1&&await m()}}catch(E){n||e.destroy(),n=E}try{if(e.writable&&e.end(),await A(),n)throw n}finally{R()}}});var Jr=N((Ep,Fs)=>{var nu=Xr(),su=Le();Fs.exports=e=>({sink:nu(e),source:su(e)})});var Us=N((Ap,Ls)=>{var ou=Jr();Ls.exports=e=>async function*(t){let r=ou(e),n;if(r.sink(t).catch(i=>{n=i}),yield*r.source,n)throw n}});var $s=N((Ip,re)=>{re.exports=Le();re.exports.source=Le();re.exports.sink=Xr();re.exports.transform=Us();re.exports.duplex=Jr()});var bu={};K(bu,{tcp:()=>gu});var qs=H(bt("net"),1);var Ut=class e extends Error{code;type;constructor(t="The operation was aborted"){super(t),this.code=e.code,this.type=e.type}static code="ABORT_ERR";static type="aborted"},ft=class extends Error{code;props;constructor(t,r,n){super(t),this.code=r,this.name=n?.name??"CodeError",this.props=n??{}}};var ln=Symbol.for("@libp2p/transport");var fn;(function(e){e[e.FATAL_ALL=0]="FATAL_ALL",e[e.NO_FATAL=1]="NO_FATAL"})(fn||(fn={}));var et=H(Sn(),1);var Ke={};K(Ke,{base32:()=>pt,base32hex:()=>ua,base32hexpad:()=>la,base32hexpadupper:()=>pa,base32hexupper:()=>fa,base32pad:()=>aa,base32padupper:()=>ca,base32upper:()=>ia,base32z:()=>ha});function ea(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var c=e.charAt(i),f=c.charCodeAt(0);if(r[f]!==255)throw new TypeError(c+" is ambiguous");r[f]=i}var h=e.length,g=e.charAt(0),C=Math.log(h)/Math.log(256),l=Math.log(256)/Math.log(h);function y(m){if(m instanceof Uint8Array||(ArrayBuffer.isView(m)?m=new Uint8Array(m.buffer,m.byteOffset,m.byteLength):Array.isArray(m)&&(m=Uint8Array.from(m))),!(m instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(m.length===0)return"";for(var A=0,R=0,E=0,I=m.length;E!==I&&m[E]===0;)E++,A++;for(var k=(I-E)*l+1>>>0,O=new Uint8Array(k);E!==I;){for(var J=m[E],Z=0,q=k-1;(J!==0||Z<R)&&q!==-1;q--,Z++)J+=256*O[q]>>>0,O[q]=J%h>>>0,J=J/h>>>0;if(J!==0)throw new Error("Non-zero carry");R=Z,E++}for(var W=k-R;W!==k&&O[W]===0;)W++;for(var it=g.repeat(A);W<k;++W)it+=e.charAt(O[W]);return it}function x(m){if(typeof m!="string")throw new TypeError("Expected String");if(m.length===0)return new Uint8Array;var A=0;if(m[A]!==" "){for(var R=0,E=0;m[A]===g;)R++,A++;for(var I=(m.length-A)*C+1>>>0,k=new Uint8Array(I);m[A];){var O=r[m.charCodeAt(A)];if(O===255)return;for(var J=0,Z=I-1;(O!==0||J<E)&&Z!==-1;Z--,J++)O+=h*k[Z]>>>0,k[Z]=O%256>>>0,O=O/256>>>0;if(O!==0)throw new Error("Non-zero carry");E=J,A++}if(m[A]!==" "){for(var q=I-E;q!==I&&k[q]===0;)q++;for(var W=new Uint8Array(R+(I-q)),it=R;q!==I;)W[it++]=k[q++];return W}}}function S(m){var A=x(m);if(A)return A;throw new Error(`Non-${t} character`)}return{encode:y,decodeUnsafe:x,decode:S}}var ra=ea,na=ra,Tn=na;var Iu=new Uint8Array(0);var Cn=(e,t)=>{if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0},ot=e=>{if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")};var En=e=>new TextEncoder().encode(e),An=e=>new TextDecoder().decode(e);var Xe=class{constructor(t,r,n){this.name=t,this.prefix=r,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},Je=class{constructor(t,r,n){if(this.name=t,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.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 Rn(this,t)}},Ye=class{constructor(t){this.decoders=t}or(t){return Rn(this,t)}decode(t){let r=t[0],n=this.decoders[r];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`)}},Rn=(e,t)=>new Ye({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}}),Qe=class{constructor(t,r,n,i){this.name=t,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Xe(t,r,n),this.decoder=new Je(t,r,i)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}},qt=({name:e,prefix:t,encode:r,decode:n})=>new Qe(e,t,r,n),St=({prefix:e,name:t,alphabet:r})=>{let{encode:n,decode:i}=Tn(r,t);return qt({prefix:e,name:t,encode:n,decode:c=>ot(i(c))})},sa=(e,t,r,n)=>{let i={};for(let l=0;l<t.length;++l)i[t[l]]=l;let c=e.length;for(;e[c-1]==="=";)--c;let f=new Uint8Array(c*r/8|0),h=0,g=0,C=0;for(let l=0;l<c;++l){let y=i[e[l]];if(y===void 0)throw new SyntaxError(`Non-${n} character`);g=g<<r|y,h+=r,h>=8&&(h-=8,f[C++]=255&g>>h)}if(h>=r||255&g<<8-h)throw new SyntaxError("Unexpected end of data");return f},oa=(e,t,r)=>{let n=t[t.length-1]==="=",i=(1<<r)-1,c="",f=0,h=0;for(let g=0;g<e.length;++g)for(h=h<<8|e[g],f+=8;f>r;)f-=r,c+=t[i&h>>f];if(f&&(c+=t[i&h<<r-f]),n)for(;c.length*r&7;)c+="=";return c},D=({name:e,prefix:t,bitsPerChar:r,alphabet:n})=>qt({prefix:t,name:e,encode(i){return oa(i,n,r)},decode(i){return sa(i,n,r,e)}});var pt=D({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ia=D({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),aa=D({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ca=D({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ua=D({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),fa=D({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),la=D({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),pa=D({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),ha=D({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var tr={};K(tr,{base58btc:()=>$,base58flickr:()=>da});var $=St({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),da=St({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var rr={};K(rr,{base64:()=>er,base64pad:()=>ma,base64url:()=>ga,base64urlpad:()=>ba});var er=D({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),ma=D({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),ga=D({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ba=D({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});et.default.formatters.b=e=>e==null?"undefined":$.baseEncode(e);et.default.formatters.t=e=>e==null?"undefined":pt.baseEncode(e);et.default.formatters.m=e=>e==null?"undefined":er.baseEncode(e);et.default.formatters.p=e=>e==null?"undefined":e.toString();et.default.formatters.c=e=>e==null?"undefined":e.toString();et.default.formatters.k=e=>e==null?"undefined":e.toString();et.default.formatters.a=e=>e==null?"undefined":e.toString();function wa(e){let t=()=>{};return t.enabled=!1,t.color="",t.diff=0,t.log=()=>{},t.namespace=e,t.destroy=()=>!0,t.extend=()=>t,t}function Tt(e){let t=wa(`${e}:trace`);return et.default.enabled(`${e}:trace`)&&et.default.names.map(r=>r.toString()).find(r=>r.includes(":trace"))!=null&&(t=(0,et.default)(`${e}:trace`)),Object.assign((0,et.default)(e),{error:(0,et.default)(`${e}:error`),trace:t})}var ye=class extends Error{code;props;constructor(t,r,n){super(t),this.code=r,this.name=n?.name??"CodeError",this.props=n??{}}};var ya=Dn,Bn=128,va=127,xa=~va,Sa=Math.pow(2,31);function Dn(e,t,r){t=t||[],r=r||0;for(var n=r;e>=Sa;)t[r++]=e&255|Bn,e/=128;for(;e&xa;)t[r++]=e&255|Bn,e>>>=7;return t[r]=e|0,Dn.bytes=r-n+1,t}var Ta=nr,Ca=128,Mn=127;function nr(e,n){var r=0,n=n||0,i=0,c=n,f,h=e.length;do{if(c>=h)throw nr.bytes=0,new RangeError("Could not decode varint");f=e[c++],r+=i<28?(f&Mn)<<i:(f&Mn)*Math.pow(2,i),i+=7}while(f>=Ca);return nr.bytes=c-n,r}var Ea=Math.pow(2,7),Aa=Math.pow(2,14),Ia=Math.pow(2,21),Ra=Math.pow(2,28),Ba=Math.pow(2,35),Ma=Math.pow(2,42),Da=Math.pow(2,49),ka=Math.pow(2,56),Pa=Math.pow(2,63),Oa=function(e){return e<Ea?1:e<Aa?2:e<Ia?3:e<Ra?4:e<Ba?5:e<Ma?6:e<Da?7:e<ka?8:e<Pa?9:10},Na={encode:ya,decode:Ta,encodingLength:Oa},_a=Na,oe=_a;var ie=(e,t=0)=>[oe.decode(e,t),oe.decode.bytes],Gt=(e,t,r=0)=>(oe.encode(e,t,r),t),Ht=e=>oe.encodingLength(e);var kt=(e,t)=>{let r=t.byteLength,n=Ht(e),i=n+Ht(r),c=new Uint8Array(i+r);return Gt(e,c,0),Gt(r,c,n),c.set(t,i),new Zt(e,r,t,c)},xe=e=>{let t=ot(e),[r,n]=ie(t),[i,c]=ie(t.subarray(n)),f=t.subarray(n+c);if(f.byteLength!==i)throw new Error("Incorrect length");return new Zt(r,i,f,t)},kn=(e,t)=>{if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&Cn(e.bytes,r.bytes)}},Zt=class{constructor(t,r,n,i){this.code=t,this.size=r,this.digest=n,this.bytes=i}};var Pn=(e,t)=>{let{bytes:r,version:n}=e;switch(n){case 0:return La(r,sr(e),t||$.encoder);default:return Ua(r,sr(e),t||pt.encoder)}};var On=new WeakMap,sr=e=>{let t=On.get(e);if(t==null){let r=new Map;return On.set(e,r),r}return t},Ct=class e{constructor(t,r,n,i){this.code=r,this.version=t,this.multihash=n,this.bytes=i,this["/"]=i}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:r}=this;if(t!==ae)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==$a)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return e.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:r}=this.multihash,n=kt(t,r);return e.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 e.equals(this,t)}static equals(t,r){let n=r;return n&&t.code===n.code&&t.version===n.version&&kn(t.multihash,n.multihash)}toString(t){return Pn(this,t)}toJSON(){return{"/":Pn(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 r=t;if(r instanceof e)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:c,bytes:f}=r;return new e(n,i,c,f||Nn(n,i,c.bytes))}else if(r[Va]===!0){let{version:n,multihash:i,code:c}=r,f=xe(i);return e.create(n,c,f)}else return null}static create(t,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(r!==ae)throw new Error(`Version 0 CID must use dag-pb (code: ${ae}) block encoding`);return new e(t,r,n,n.bytes)}case 1:{let i=Nn(t,r,n.bytes);return new e(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return e.create(0,ae,t)}static createV1(t,r){return e.create(1,t,r)}static decode(t){let[r,n]=e.decodeFirst(t);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=e.inspectBytes(t),n=r.size-r.multihashSize,i=ot(t.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let c=i.subarray(r.multihashSize-r.digestSize),f=new Zt(r.multihashCode,r.digestSize,c,i);return[r.version===0?e.createV0(f):e.createV1(r.codec,f),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[y,x]=ie(t.subarray(r));return r+=x,y},i=n(),c=ae;if(i===18?(i=0,r=0):c=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let f=r,h=n(),g=n(),C=r+g,l=C-f;return{version:i,codec:c,multihashCode:h,digestSize:g,multihashSize:l,size:C}}static parse(t,r){let[n,i]=Fa(t,r),c=e.decode(i);if(c.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return sr(c).set(n,t),c}},Fa=(e,t)=>{switch(e[0]){case"Q":{let r=t||$;return[$.prefix,r.decode(`${$.prefix}${e}`)]}case $.prefix:{let r=t||$;return[$.prefix,r.decode(e)]}case pt.prefix:{let r=t||pt;return[pt.prefix,r.decode(e)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}},La=(e,t,r)=>{let{prefix:n}=r;if(n!==$.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=t.get(n);if(i==null){let c=r.encode(e).slice(1);return t.set(n,c),c}else return i},Ua=(e,t,r)=>{let{prefix:n}=r,i=t.get(n);if(i==null){let c=r.encode(e);return t.set(n,c),c}else return i},ae=112,$a=18,Nn=(e,t,r)=>{let n=Ht(e),i=n+Ht(t),c=new Uint8Array(i+r.byteLength);return Gt(e,c,0),Gt(t,c,n),c.set(r,i),c},Va=Symbol.for("@ipld/js-cid/CID");function _n(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}var or={};K(or,{identity:()=>ja});var ja=qt({prefix:"\0",name:"identity",encode:e=>An(e),decode:e=>En(e)});var ir={};K(ir,{base2:()=>za});var za=D({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var ar={};K(ar,{base8:()=>qa});var qa=D({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var cr={};K(cr,{base10:()=>Ga});var Ga=St({prefix:"9",name:"base10",alphabet:"0123456789"});var ur={};K(ur,{base16:()=>Ha,base16upper:()=>Za});var Ha=D({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Za=D({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var fr={};K(fr,{base36:()=>Wa,base36upper:()=>Xa});var Wa=St({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Xa=St({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var lr={};K(lr,{base256emoji:()=>tc});var Fn=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}"),Ja=Fn.reduce((e,t,r)=>(e[r]=t,e),[]),Ya=Fn.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]);function Qa(e){return e.reduce((t,r)=>(t+=Ja[r],t),"")}function Ka(e){let t=[];for(let r of e){let n=Ya[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);t.push(n)}return new Uint8Array(t)}var tc=qt({prefix:"\u{1F680}",name:"base256emoji",encode:Qa,decode:Ka});var mr={};K(mr,{sha256:()=>ec,sha512:()=>rc});var dr=H(bt("crypto"),1);var hr=({name:e,code:t,encode:r})=>new pr(e,t,r),pr=class{constructor(t,r,n){this.name=t,this.code=r,this.encode=n}digest(t){if(t instanceof Uint8Array){let r=this.encode(t);return r instanceof Uint8Array?kt(this.code,r):r.then(n=>kt(this.code,n))}else throw Error("Unknown type, must be binary type")}};var ec=hr({name:"sha2-256",code:18,encode:e=>ot(dr.default.createHash("sha256").update(e).digest())}),rc=hr({name:"sha2-512",code:19,encode:e=>ot(dr.default.createHash("sha512").update(e).digest())});var gr={};K(gr,{identity:()=>oc});var Un=0,nc="identity",$n=ot,sc=e=>kt(Un,$n(e)),oc={code:Un,name:nc,encode:$n,digest:sc};var af=new TextEncoder,cf=new TextDecoder;var ce={...or,...ir,...ar,...cr,...ur,...Ke,...fr,...tr,...rr,...lr},hf={...mr,...gr};function Xt(e){return globalThis.Buffer!=null?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function Se(e=0){return globalThis.Buffer?.allocUnsafe!=null?Xt(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}function jn(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}var Vn=jn("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),br=jn("ascii","a",e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},e=>{e=e.substring(1);let t=Se(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),cc={utf8:Vn,"utf-8":Vn,hex:ce.base16,latin1:br,ascii:br,binary:br,...ce},Te=cc;function X(e,t="utf8"){let r=Te[t];if(r==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8"):r.encoder.encode(e).substring(1)}function wt(e,t){t==null&&(t=e.reduce((i,c)=>i+c.length,0));let r=Se(t),n=0;for(let i of e)r.set(i,n),n+=i.length;return Xt(r)}var Yt=H(vr(),1);var Ce=class{index=0;input="";new(t){return this.index=0,this.input=t,this}readAtomically(t){let r=this.index,n=t();return n===void 0&&(this.index=r),n}parseWith(t){let r=t();if(this.index===this.input.length)return r}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(t){return this.readAtomically(()=>{let r=this.readChar();if(r===t)return r})}readSeparator(t,r,n){return this.readAtomically(()=>{if(!(r>0&&this.readGivenChar(t)===void 0))return n()})}readNumber(t,r,n,i){return this.readAtomically(()=>{let c=0,f=0,h=this.peekChar();if(h===void 0)return;let g=h==="0",C=2**(8*i)-1;for(;;){let l=this.readAtomically(()=>{let y=this.readChar();if(y===void 0)return;let x=Number.parseInt(y,t);if(!Number.isNaN(x))return x});if(l===void 0)break;if(c*=t,c+=l,c>C||(f+=1,r!==void 0&&f>r))return}if(f!==0)return!n&&g&&f>1?void 0:c})}readIPv4Addr(){return this.readAtomically(()=>{let t=new Uint8Array(4);for(let r=0;r<t.length;r++){let n=this.readSeparator(".",r,()=>this.readNumber(10,3,!1,1));if(n===void 0)return;t[r]=n}return t})}readIPv6Addr(){let t=r=>{for(let n=0;n<r.length/2;n++){let i=n*2;if(n<r.length-3){let f=this.readSeparator(":",n,()=>this.readIPv4Addr());if(f!==void 0)return r[i]=f[0],r[i+1]=f[1],r[i+2]=f[2],r[i+3]=f[3],[i+4,!0]}let c=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(c===void 0)return[i,!1];r[i]=c>>8,r[i+1]=c&255}return[r.length,!1]};return this.readAtomically(()=>{let r=new Uint8Array(16),[n,i]=t(r);if(n===16)return r;if(i||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let c=new Uint8Array(14),f=16-(n+2),[h]=t(c.subarray(0,f));return r.set(c.subarray(0,h),16-h),r})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var kf=new Ce;var $f=parseInt("0xFFFF",16),Vf=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);function xr(e,t="utf8"){let r=Te[t];if(r==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Xt(globalThis.Buffer.from(e,"utf-8")):r.decoder.decode(`${r.prefix}${e}`)}var ht=H(vr(),1);var Et=bt("node:net");function Ee(e){return!!(0,Et.isIP)(e)}var ts=Et.isIPv4,Ic=Et.isIPv6,Sr=function(e){let t=0;if(e=e.toString().trim(),ts(e)){let r=new Uint8Array(t+4);return e.split(/\./g).forEach(n=>{r[t++]=parseInt(n,10)&255}),r}if(Ic(e)){let r=e.split(":",8),n;for(n=0;n<r.length;n++){let c=ts(r[n]),f;c&&(f=Sr(r[n]),r[n]=X(f.slice(0,2),"base16")),f!=null&&++n<8&&r.splice(n,0,X(f.slice(2,4),"base16"))}if(r[0]==="")for(;r.length<8;)r.unshift("0");else if(r[r.length-1]==="")for(;r.length<8;)r.push("0");else if(r.length<8){for(n=0;n<r.length&&r[n]!=="";n++);let c=[n,1];for(n=9-r.length;n>0;n--)c.push("0");r.splice.apply(r,c)}let i=new Uint8Array(t+16);for(n=0;n<r.length;n++){let c=parseInt(r[n],16);i[t++]=c>>8&255,i[t++]=c&255}return i}throw new Error("invalid ip address")},es=function(e,t=0,r){t=~~t,r=r??e.length-t;let n=new DataView(e.buffer);if(r===4){let i=[];for(let c=0;c<r;c++)i.push(e[t+c]);return i.join(".")}if(r===16){let i=[];for(let c=0;c<r;c+=2)i.push(n.getUint16(t+c).toString(16));return i.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var Jt={},Tr={},Bc=[[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"]];Bc.forEach(e=>{let t=Mc(...e);Tr[t.code]=t,Jt[t.name]=t});function Mc(e,t,r,n,i){return{code:e,size:t,name:r,resolvable:!!n,path:!!i}}function B(e){if(typeof e=="number"){if(Tr[e]!=null)return Tr[e];throw new Error(`no protocol with code: ${e}`)}else if(typeof e=="string"){if(Jt[e]!=null)return Jt[e];throw new Error(`no protocol with name: ${e}`)}throw new Error(`invalid protocol id type: ${typeof e}`)}var Rl=B("ip4"),Bl=B("ip6"),Ml=B("ipcidr");function Er(e,t){switch(B(e).code){case 4:case 41:return kc(t);case 42:return ss(t);case 6:case 273:case 33:case 132:return is(t).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return ss(t);case 421:return _c(t);case 444:return os(t);case 445:return os(t);case 466:return Nc(t);default:return X(t,"base16")}}function Ar(e,t){switch(B(e).code){case 4:return rs(t);case 41:return rs(t);case 42:return ns(t);case 6:case 273:case 33:case 132:return Ir(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return ns(t);case 421:return Pc(t);case 444:return Fc(t);case 445:return Lc(t);case 466:return Oc(t);default:return xr(t,"base16")}}var Cr=Object.values(ce).map(e=>e.decoder),Dc=function(){let e=Cr[0].or(Cr[1]);return Cr.slice(2).forEach(t=>e=e.or(t)),e}();function rs(e){if(!Ee(e))throw new Error("invalid ip address");return Sr(e)}function kc(e){let t=es(e,0,e.length);if(t==null)throw new Error("ipBuff is required");if(!Ee(t))throw new Error("invalid ip address");return t}function Ir(e){let t=new ArrayBuffer(2);return new DataView(t).setUint16(0,e),new Uint8Array(t)}function is(e){return new DataView(e.buffer).getUint16(e.byteOffset)}function ns(e){let t=xr(e),r=Uint8Array.from(ht.default.encode(t.length));return wt([r,t],r.length+t.length)}function ss(e){let t=ht.default.decode(e);if(e=e.slice(ht.default.decode.bytes),e.length!==t)throw new Error("inconsistent lengths");return X(e)}function Pc(e){let t;e[0]==="Q"||e[0]==="1"?t=xe($.decode(`z${e}`)).bytes:t=Ct.parse(e).multihash.bytes;let r=Uint8Array.from(ht.default.encode(t.length));return wt([r,t],r.length+t.length)}function Oc(e){let t=Dc.decode(e),r=Uint8Array.from(ht.default.encode(t.length));return wt([r,t],r.length+t.length)}function Nc(e){let t=ht.default.decode(e),r=e.slice(ht.default.decode.bytes);if(r.length!==t)throw new Error("inconsistent lengths");return"u"+X(r,"base64url")}function _c(e){let t=ht.default.decode(e),r=e.slice(ht.default.decode.bytes);if(r.length!==t)throw new Error("inconsistent lengths");return X(r,"base58btc")}function Fc(e){let t=e.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 r=pt.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 i=Ir(n);return wt([r,i],r.length+i.length)}function Lc(e){let t=e.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 r=pt.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 i=Ir(n);return wt([r,i],r.length+i.length)}function os(e){let t=e.slice(0,e.length-2),r=e.slice(e.length-2),n=X(t,"base32"),i=is(r);return`${n}:${i}`}function as(e){e=Rr(e);let t=[],r=[],n=null,i=e.split("/").slice(1);if(i.length===1&&i[0]==="")return{bytes:new Uint8Array,string:"/",tuples:[],stringTuples:[],path:null};for(let c=0;c<i.length;c++){let f=i[c],h=B(f);if(h.size===0){t.push([h.code]),r.push([h.code]);continue}if(c++,c>=i.length)throw us("invalid address: "+e);if(h.path===!0){n=Rr(i.slice(c).join("/")),t.push([h.code,Ar(h.code,n)]),r.push([h.code,n]);break}let g=Ar(h.code,i[c]);t.push([h.code,g]),r.push([h.code,Er(h.code,g)])}return{string:cs(r),bytes:Mr(t),tuples:t,stringTuples:r,path:n}}function Br(e){let t=[],r=[],n=null,i=0;for(;i<e.length;){let c=Yt.default.decode(e,i),f=Yt.default.decode.bytes??0,h=B(c),g=Uc(h,e.slice(i+f));if(g===0){t.push([c]),r.push([c]),i+=f;continue}let C=e.slice(i+f,i+f+g);if(i+=g+f,i>e.length)throw us("Invalid address Uint8Array: "+X(e,"base16"));t.push([c,C]);let l=Er(c,C);if(r.push([c,l]),h.path===!0){n=l;break}}return{bytes:Uint8Array.from(e),string:cs(r),tuples:t,stringTuples:r,path:n}}function cs(e){let t=[];return e.map(r=>{let n=B(r[0]);return t.push(n.name),r.length>1&&r[1]!=null&&t.push(r[1]),null}),Rr(t.join("/"))}function Mr(e){return wt(e.map(t=>{let r=B(t[0]),n=Uint8Array.from(Yt.default.encode(r.code));return t.length>1&&t[1]!=null&&(n=wt([n,t[1]])),n}))}function Uc(e,t){return e.size>0?e.size/8:e.size===0?0:Yt.default.decode(t)+(Yt.default.decode.bytes??0)}function Rr(e){return"/"+e.trim().split("/").filter(t=>t).join("/")}function us(e){return new Error("Error parsing address: "+e)}var $c=Symbol.for("nodejs.util.inspect.custom"),Vc=[B("dns").code,B("dns4").code,B("dns6").code,B("dnsaddr").code],jc=new Map,fs=Symbol.for("@multiformats/js-multiaddr/multiaddr");function zc(e){return!!e?.[fs]}var Dr=class e{bytes;#t;#e;#r;#n;[fs]=!0;constructor(t){t==null&&(t="");let r;if(t instanceof Uint8Array)r=Br(t);else if(typeof t=="string"){if(t.length>0&&t.charAt(0)!=="/")throw new Error(`multiaddr "${t}" must start with a "/"`);r=as(t)}else if(zc(t))r=Br(t.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=r.bytes,this.#t=r.string,this.#e=r.tuples,this.#r=r.stringTuples,this.#n=r.path}toString(){return this.#t}toJSON(){return this.toString()}toOptions(){let t,r,n,i,c="",f=B("tcp"),h=B("udp"),g=B("ip4"),C=B("ip6"),l=B("dns6"),y=B("ip6zone");for(let[S,m]of this.stringTuples())S===y.code&&(c=`%${m??""}`),Vc.includes(S)&&(r=f.name,i=443,n=`${m??""}${c}`,t=S===l.code?6:4),(S===f.code||S===h.code)&&(r=B(S).name,i=parseInt(m??"")),(S===g.code||S===C.code)&&(r=B(S).name,n=`${m??""}${c}`,t=S===C.code?6:4);if(t==null||r==null||n==null||i==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:r,port:i}}protos(){return this.#e.map(([t])=>Object.assign({},B(t)))}protoCodes(){return this.#e.map(([t])=>t)}protoNames(){return this.#e.map(([t])=>B(t).name)}tuples(){return this.#e}stringTuples(){return this.#r}encapsulate(t){return t=new e(t),new e(this.toString()+t.toString())}decapsulate(t){let r=t.toString(),n=this.toString(),i=n.lastIndexOf(r);if(i<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${t.toString()}`);return new e(n.slice(0,i))}decapsulateCode(t){let r=this.tuples();for(let n=r.length-1;n>=0;n--)if(r[n][0]===t)return new e(Mr(r.slice(0,n)));return this}getPeerId(){try{let t=[];this.stringTuples().forEach(([n,i])=>{n===Jt.p2p.code&&t.push([n,i]),n===Jt["p2p-circuit"].code&&(t=[])});let r=t.pop();if(r?.[1]!=null){let n=r[1];return n[0]==="Q"||n[0]==="1"?X($.decode(`z${n}`),"base58btc"):X(Ct.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return this.#n}equals(t){return _n(this.bytes,t.bytes)}async resolve(t){let r=this.protos().find(c=>c.resolvable);if(r==null)return[this];let n=jc.get(r.name);if(n==null)throw new ye(`no available resolver for ${r.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,t)).map(c=>new e(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 r=(t??this).protos();return!(r.length!==2||r[0].code!==4&&r[0].code!==41||r[1].code!==6&&r[1].code!==273)}[$c](){return`Multiaddr(${this.#t})`}};function dt(e){return new Dr(e)}var qc=w("dns4"),Gc=w("dns6"),Hc=w("dnsaddr"),Ot=P(w("dns"),Hc,qc,Gc),Re=P(w("ip4"),w("ip6")),It=P(T(Re,w("tcp")),T(Ot,w("tcp"))),Be=T(Re,w("udp")),Zc=T(Be,w("utp")),Wc=T(Be,w("quic")),Xc=T(Be,w("quic-v1")),kr=P(T(It,w("ws")),T(Ot,w("ws"))),Ae=P(T(kr,w("p2p")),kr),Pr=P(T(It,w("wss")),T(Ot,w("wss")),T(It,w("tls"),w("ws")),T(Ot,w("tls"),w("ws"))),Ie=P(T(Pr,w("p2p")),Pr),Or=P(T(It,w("http")),T(Re,w("http")),T(Ot,w("http"))),Nr=P(T(It,w("https")),T(Re,w("https")),T(Ot,w("https"))),ls=T(Be,w("webrtc-direct"),w("certhash")),ds=P(T(ls,w("p2p")),ls),ps=T(Xc,w("webtransport"),w("certhash"),w("certhash")),ms=P(T(ps,w("p2p")),ps),gs=P(T(Ae,w("p2p-webrtc-star"),w("p2p")),T(Ie,w("p2p-webrtc-star"),w("p2p")),T(Ae,w("p2p-webrtc-star")),T(Ie,w("p2p-webrtc-star"))),Ql=P(T(Ae,w("p2p-websocket-star"),w("p2p")),T(Ie,w("p2p-websocket-star"),w("p2p")),T(Ae,w("p2p-websocket-star")),T(Ie,w("p2p-websocket-star"))),bs=P(T(Or,w("p2p-webrtc-direct"),w("p2p")),T(Nr,w("p2p-webrtc-direct"),w("p2p")),T(Or,w("p2p-webrtc-direct")),T(Nr,w("p2p-webrtc-direct"))),Nt=P(kr,Pr,Or,Nr,gs,bs,It,Zc,Wc,Ot,ds,ms),Kl=P(T(Nt,w("p2p-stardust"),w("p2p")),T(Nt,w("p2p-stardust"))),At=P(T(Nt,w("p2p")),gs,bs,ds,ms,w("p2p")),hs=P(T(At,w("p2p-circuit"),At),T(At,w("p2p-circuit")),T(w("p2p-circuit"),At),T(Nt,w("p2p-circuit")),T(w("p2p-circuit"),Nt),w("p2p-circuit")),ws=()=>P(T(hs,ws),hs),Pt=ws(),tp=P(T(Pt,At,Pt),T(At,Pt),T(Pt,At),Pt,At);var ep=P(T(Pt,w("webrtc"),w("p2p")),T(Pt,w("webrtc")),T(Nt,w("webrtc"),w("p2p")),T(Nt,w("webrtc")),w("webrtc"));function ys(e){function t(r){let n;try{n=dt(r)}catch{return!1}let i=e(n.protoNames());return i===null?!1:i===!0||i===!1?i:i.length===0}return t}function T(...e){function t(r){if(r.length<e.length)return null;let n=r;return e.some(i=>(n=typeof i=="function"?i().partialMatch(r):i.partialMatch(r),Array.isArray(n)&&(r=n),n===null)),n}return{toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:ys(t),partialMatch:t}}function P(...e){function t(n){let i=null;return e.some(c=>{let f=typeof c=="function"?c().partialMatch(n):c.partialMatch(n);return f!=null?(i=f,!0):!1}),i}return{toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:ys(t),partialMatch:t}}function w(e){let t=e;function r(i){let c;try{c=dt(i)}catch{return!1}let f=c.protoNames();return f.length===1&&f[0]===t}function n(i){return i.length===0?null:i[0]===t?i.slice(1):null}return{toString:function(){return t},matches:r,partialMatch:n}}var zs=H(bt("net"),1);var Me=class extends EventTarget{#t=new Map;listenerCount(t){let r=this.#t.get(t);return r==null?0:r.length}addEventListener(t,r,n){super.addEventListener(t,r,n);let i=this.#t.get(t);i==null&&(i=[],this.#t.set(t,i)),i.push({callback:r,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(t,r,n){super.removeEventListener(t.toString(),r??null,n);let i=this.#t.get(t);i!=null&&(i=i.filter(({callback:c})=>c!==r),this.#t.set(t,i))}dispatchEvent(t){let r=super.dispatchEvent(t),n=this.#t.get(t.type);return n==null||(n=n.filter(({once:i})=>!i),this.#t.set(t.type,n)),r}safeDispatchEvent(t,r){return this.dispatchEvent(new Qt(t,r))}},_r=class extends Event{detail;constructor(t,r){super(t,r),this.detail=r?.detail}},Qt=globalThis.CustomEvent??_r;function De(e){return this.subnetMask<e.subnetMask?!1:this.mask(e.subnetMask)===e.mask()}function ke(e){return function(){return this.addressMinusSuffix!==this.correctForm()?!1:this.subnetMask===e&&!this.parsedSubnet?!0:this.parsedSubnet===String(this.subnetMask)}}var Kt=/^(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,Fr=/\/\d{1,2}$/;var V=class extends Error{constructor(t,r){super(t),this.name="AddressError",r!==null&&(this.parseMessage=r)}};var te=H(Lr(),1),_t=H(ue(),1),rt=class e{constructor(t){this.groups=4,this.parsedAddress=[],this.parsedSubnet="",this.subnet="/32",this.subnetMask=32,this.v4=!0,this.isCorrect=ke(32),this.isInSubnet=De,this.address=t;let r=Fr.exec(t);if(r){if(this.parsedSubnet=r[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,this.subnetMask<0||this.subnetMask>32)throw new V("Invalid subnet mask.");t=t.replace(Fr,"")}this.addressMinusSuffix=t,this.parsedAddress=this.parse(t)}static isValid(t){try{return new e(t),!0}catch{return!1}}parse(t){let r=t.split(".");if(!t.match(Kt))throw new V("Invalid IPv4 address.");return r}correctForm(){return this.parsedAddress.map(t=>parseInt(t,10)).join(".")}static fromHex(t){let r=t.replace(/:/g,"").padStart(8,"0"),n=[],i;for(i=0;i<8;i+=2){let c=r.slice(i,i+2);n.push(parseInt(c,16))}return new e(n.join("."))}static fromInteger(t){return e.fromHex(t.toString(16))}static fromArpa(t){let n=t.replace(/(\.in-addr\.arpa)?\.$/,"").split(".").reverse().join(".");return new e(n)}toHex(){return this.parsedAddress.map(t=>(0,_t.sprintf)("%02x",parseInt(t,10))).join(":")}toArray(){return this.parsedAddress.map(t=>parseInt(t,10))}toGroup6(){let t=[],r;for(r=0;r<4;r+=2){let n=(0,_t.sprintf)("%02x%02x",parseInt(this.parsedAddress[r],10),parseInt(this.parsedAddress[r+1],10));t.push((0,_t.sprintf)("%x",parseInt(n,16)))}return t.join(":")}bigInteger(){return new te.BigInteger(this.parsedAddress.map(t=>(0,_t.sprintf)("%02x",parseInt(t,10))).join(""),16)}_startAddress(){return new te.BigInteger(this.mask()+"0".repeat(32-this.subnetMask),2)}startAddress(){return e.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new te.BigInteger("1");return e.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new te.BigInteger(this.mask()+"1".repeat(32-this.subnetMask),2)}endAddress(){return e.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new te.BigInteger("1");return e.fromBigInteger(this._endAddress().subtract(t))}static fromBigInteger(t){return e.fromInteger(parseInt(t.toString(),10))}mask(t){return t===void 0&&(t=this.subnetMask),this.getBitsBase2(0,t)}getBitsBase2(t,r){return this.binaryZeroPad().slice(t,r)}reverseForm(t){t||(t={});let r=this.correctForm().split(".").reverse().join(".");return t.omitSuffix?r:(0,_t.sprintf)("%s.in-addr.arpa.",r)}isMulticast(){return this.isInSubnet(new e("224.0.0.0/4"))}binaryZeroPad(){return this.bigInteger().toString(2).padStart(32,"0")}groupForV6(){let t=this.parsedAddress;return this.address.replace(Kt,(0,_t.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 Cs={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"},Ur={"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"},$r=/([^0-9a-f:/%])/gi,Vr=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi,jr=/\/\d{1,3}(?=%|$)/,zr=/%.*$/,Es=new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/),As=new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/);var Rs=H(ue(),1);function Yc(e){return e.replace(/^(0+)/,'<span class="zero">$1</span>')}function Ne(e,t=0){return e.split(":").map((n,i)=>/group-v4/.test(n)?n:(0,Rs.sprintf)('<span class="hover-group group-%d">%s</span>',i+t,Yc(n)))}var Lt=H(ue(),1);function Gr(e){return(0,Lt.sprintf)("(%s)",e.join("|"))}function qr(e){return e.length<4?(0,Lt.sprintf)("0{0,%d}%s",4-e.length,e):e}var Hr="[^A-Fa-f0-9:]";function _e(e){let t=[];e.forEach((n,i)=>{parseInt(n,16)===0&&t.push(i)});let r=t.map(n=>e.map((i,c)=>{if(c===n){let f=c===0||c===8-1?":":"";return Gr([qr(i),f])}return qr(i)}).join(":"));return r.push(e.map(qr).join(":")),Gr(r)}function Zr(e,t,r){let n=t?"":":",i=r?"":":",c=[];!t&&!r&&c.push("::"),t&&r&&c.push(""),(r&&!t||!r&&t)&&c.push(":"),c.push((0,Lt.sprintf)("%s(:0{1,4}){1,%d}",n,e-1)),c.push((0,Lt.sprintf)("(0{1,4}:){1,%d}%s",e-1,i)),c.push((0,Lt.sprintf)("(0{1,4}:){%d}0{1,4}",e-1));for(let f=1;f<e-1;f++)for(let h=1;h<e-f;h++)c.push((0,Lt.sprintf)("(0{1,4}:){%d}:(0{1,4}:){%d}0{1,4}",h,e-h-f-1));return Gr(c)}var j=H(Lr(),1),z=H(ue(),1);function Fe(e){if(!e)throw new Error("Assertion failed.")}function Qc(e){let t=/(\d+)(\d{3})/;for(;t.test(e);)e=e.replace(t,"$1,$2");return e}function Kc(e){return e=e.replace(/^(0{1,})([1-9]+)$/,'<span class="parse-error">$1</span>$2'),e=e.replace(/^(0{1,})(0)$/,'<span class="parse-error">$1</span>$2'),e}function tu(e,t){let r=[],n=[],i;for(i=0;i<e.length;i++)i<t[0]?r.push(e[i]):i>t[1]&&n.push(e[i]);return r.concat(["compact"]).concat(n)}function Ms(e){return(0,z.sprintf)("%04x",parseInt(e,16))}function Ds(e){return e&255}var fe=class e{constructor(t,r){this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=De,this.isCorrect=ke(128),r===void 0?this.groups=8:this.groups=r,this.address=t;let n=jr.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 V("Invalid subnet mask.");t=t.replace(jr,"")}else if(/\//.test(t))throw new V("Invalid subnet mask.");let i=zr.exec(t);i&&(this.zone=i[0],t=t.replace(zr,"")),this.addressMinusSuffix=t,this.parsedAddress=this.parse(this.addressMinusSuffix)}static isValid(t){try{return new e(t),!0}catch{return!1}}static fromBigInteger(t){let r=t.toString(16).padStart(32,"0"),n=[],i;for(i=0;i<8;i++)n.push(r.slice(i*4,(i+1)*4));return new e(n.join(":"))}static fromURL(t){let r,n=null,i;if(t.indexOf("[")!==-1&&t.indexOf("]:")!==-1){if(i=As.exec(t),i===null)return{error:"failed to parse address with port",address:null,port:null};r=i[1],n=i[2]}else if(t.indexOf("/")!==-1){if(t=t.replace(/^[a-z0-9]+:\/\//,""),i=Es.exec(t),i===null)return{error:"failed to parse address from URL",address:null,port:null};r=i[1]}else r=t;return n?(n=parseInt(n,10),(n<0||n>65536)&&(n=null)):n=null,{address:new e(r),port:n}}static fromAddress4(t){let r=new rt(t),n=128-(32-r.subnetMask);return new e(`::ffff:${r.correctForm()}/${n}`)}static fromArpa(t){let r=t.replace(/(\.ip6\.arpa)?\.$/,""),n=7;if(r.length!==63)throw new V("Invalid 'ip6.arpa' form.");let i=r.split(".").reverse();for(let c=n;c>0;c--){let f=c*4;i.splice(f,0,":")}return r=i.join(""),new e(r)}microsoftTranscription(){return(0,z.sprintf)("%s.ipv6-literal.net",this.correctForm().replace(/:/g,"-"))}mask(t=this.subnetMask){return this.getBitsBase2(0,t)}possibleSubnets(t=128){let r=128-this.subnetMask,n=Math.abs(t-128),i=r-n;return i<0?"0":Qc(new j.BigInteger("2",10).pow(i).toString(10))}_startAddress(){return new j.BigInteger(this.mask()+"0".repeat(128-this.subnetMask),2)}startAddress(){return e.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new j.BigInteger("1");return e.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new j.BigInteger(this.mask()+"1".repeat(128-this.subnetMask),2)}endAddress(){return e.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new j.BigInteger("1");return e.fromBigInteger(this._endAddress().subtract(t))}getScope(){let t=Cs[this.getBits(12,16).intValue()];return this.getType()==="Global unicast"&&t!=="Link local"&&(t="Global"),t||"Unknown"}getType(){for(let t of Object.keys(Ur))if(this.isInSubnet(new e(t)))return Ur[t];return"Global unicast"}getBits(t,r){return new j.BigInteger(this.getBitsBase2(t,r),2)}getBitsBase2(t,r){return this.binaryZeroPad().slice(t,r)}getBitsBase16(t,r){let n=r-t;if(n%4!==0)throw new Error("Length of bits to retrieve must be divisible by four");return this.getBits(t,r).toString(16).padStart(n/4,"0")}getBitsPastSubnet(){return this.getBitsBase2(this.subnetMask,128)}reverseForm(t){t||(t={});let r=Math.floor(this.subnetMask/4),n=this.canonicalForm().replace(/:/g,"").split("").slice(0,r).reverse().join(".");return r>0?t.omitSuffix?n:(0,z.sprintf)("%s.ip6.arpa.",n):t.omitSuffix?"":"ip6.arpa."}correctForm(){let t,r=[],n=0,i=[];for(t=0;t<this.parsedAddress.length;t++){let h=parseInt(this.parsedAddress[t],16);h===0&&n++,h!==0&&n>0&&(n>1&&i.push([t-n,t-1]),n=0)}n>1&&i.push([this.parsedAddress.length-n,this.parsedAddress.length-1]);let c=i.map(h=>h[1]-h[0]+1);if(i.length>0){let h=c.indexOf(Math.max(...c));r=tu(this.parsedAddress,i[h])}else r=this.parsedAddress;for(t=0;t<r.length;t++)r[t]!=="compact"&&(r[t]=parseInt(r[t],16).toString(16));let f=r.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 r=t.split(":"),i=r.slice(-1)[0].match(Kt);if(i){this.parsedAddress4=i[0],this.address4=new rt(this.parsedAddress4);for(let c=0;c<this.address4.groups;c++)if(/^0[0-9]+/.test(this.address4.parsedAddress[c]))throw new V("IPv4 addresses can't have leading zeroes.",t.replace(Kt,this.address4.parsedAddress.map(Kc).join(".")));this.v4=!0,r[r.length-1]=this.address4.toGroup6(),t=r.join(":")}return t}parse(t){t=this.parse4in6(t);let r=t.match($r);if(r)throw new V((0,z.sprintf)("Bad character%s detected in address: %s",r.length>1?"s":"",r.join("")),t.replace($r,'<span class="parse-error">$1</span>'));let n=t.match(Vr);if(n)throw new V((0,z.sprintf)("Address failed regex: %s",n.join("")),t.replace(Vr,'<span class="parse-error">$1</span>'));let i=[],c=t.split("::");if(c.length===2){let f=c[0].split(":"),h=c[1].split(":");f.length===1&&f[0]===""&&(f=[]),h.length===1&&h[0]===""&&(h=[]);let g=this.groups-(f.length+h.length);if(!g)throw new V("Error parsing groups");this.elidedGroups=g,this.elisionBegin=f.length,this.elisionEnd=f.length+this.elidedGroups,i=i.concat(f);for(let C=0;C<g;C++)i.push("0");i=i.concat(h)}else if(c.length===1)i=t.split(":"),this.elidedGroups=0;else throw new V("Too many :: groups found");if(i=i.map(f=>(0,z.sprintf)("%x",parseInt(f,16))),i.length!==this.groups)throw new V("Incorrect number of groups found");return i}canonicalForm(){return this.parsedAddress.map(Ms).join(":")}decimal(){return this.parsedAddress.map(t=>(0,z.sprintf)("%05d",parseInt(t,16))).join(":")}bigInteger(){return new j.BigInteger(this.parsedAddress.map(Ms).join(""),16)}to4(){let t=this.binaryZeroPad().split("");return rt.fromHex(new j.BigInteger(t.slice(96,128).join(""),2).toString(16))}to4in6(){let t=this.to4(),n=new e(this.parsedAddress.slice(0,6).join(":"),6).correctForm(),i="";return/:$/.test(n)||(i=":"),n+i+t.address}inspectTeredo(){let t=this.getBitsBase16(0,32),r=this.getBits(80,96).xor(new j.BigInteger("ffff",16)).toString(),n=rt.fromHex(this.getBitsBase16(32,64)),i=rt.fromHex(this.getBits(96,128).xor(new j.BigInteger("ffffffff",16)).toString(16)),c=this.getBits(64,80),f=this.getBitsBase2(64,80),h=c.testBit(15),g=c.testBit(14),C=c.testBit(8),l=c.testBit(9),y=new j.BigInteger(f.slice(2,6)+f.slice(8,16),2).toString(10);return{prefix:(0,z.sprintf)("%s:%s",t.slice(0,4),t.slice(4,8)),server4:n.address,client4:i.address,flags:f,coneNat:h,microsoft:{reserved:g,universalLocal:l,groupIndividual:C,nonce:y},udpPort:r}}inspect6to4(){let t=this.getBitsBase16(0,16),r=rt.fromHex(this.getBitsBase16(16,48));return{prefix:(0,z.sprintf)("%s",t.slice(0,4)),gateway:r.address}}to6to4(){if(!this.is4())return null;let t=["2002",this.getBitsBase16(96,112),this.getBitsBase16(112,128),"","/16"].join(":");return new e(t)}toByteArray(){let t=this.bigInteger().toByteArray();return t.length===17&&t[0]===0?t.slice(1):t}toUnsignedByteArray(){return this.toByteArray().map(Ds)}static fromByteArray(t){return this.fromUnsignedByteArray(t.map(Ds))}static fromUnsignedByteArray(t){let r=new j.BigInteger("256",10),n=new j.BigInteger("0",10),i=new j.BigInteger("1",10);for(let c=t.length-1;c>=0;c--)n=n.add(i.multiply(new j.BigInteger(t[c].toString(10),10))),i=i.multiply(r);return e.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 e("2001::/32"))}is6to4(){return this.isInSubnet(new e("2002::/16"))}isLoopback(){return this.getType()==="Loopback"}href(t){return t===void 0?t="":t=(0,z.sprintf)(":%s",t),(0,z.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 r=this.correctForm;return t.v4&&(r=this.to4in6),t.className?(0,z.sprintf)('<a href="%1$s%2$s" class="%3$s">%2$s</a>',t.prefix,r.call(this),t.className):(0,z.sprintf)('<a href="%1$s%2$s">%2$s</a>',t.prefix,r.call(this))}group(){if(this.elidedGroups===0)return Ne(this.address).join(":");Fe(typeof this.elidedGroups=="number"),Fe(typeof this.elisionBegin=="number");let t=[],[r,n]=this.address.split("::");r.length?t.push(...Ne(r)):t.push("");let i=["hover-group"];for(let c=this.elisionBegin;c<this.elisionBegin+this.elidedGroups;c++)i.push((0,z.sprintf)("group-%d",c));return t.push((0,z.sprintf)('<span class="%s"></span>',i.join(" "))),n.length?t.push(...Ne(n,this.elisionEnd)):t.push(""),this.is4()&&(Fe(this.address4 instanceof rt),t.pop(),t.push(this.address4.groupForV6())),t.join(":")}regularExpressionString(t=!1){let r=[],n=new e(this.correctForm());if(n.elidedGroups===0)r.push(_e(n.parsedAddress));else if(n.elidedGroups===8)r.push(Zr(8));else{let i=n.address.split("::");i[0].length&&r.push(_e(i[0].split(":"))),Fe(typeof n.elidedGroups=="number"),r.push(Zr(n.elidedGroups,i[0].length!==0,i[1].length!==0)),i[1].length&&r.push(_e(i[1].split(":"))),r=[r.join(":")]}return t||(r=["(?=^|",Hr,"|[^\\w\\:])(",...r,")(?=[^\\w\\:]|",Hr,"|$)"]),r.join("")}regularExpression(t=!1){return new RegExp(this.regularExpressionString(t),"i")}};var eu=Tt("libp2p:ip-port-to-multiaddr"),Wr={ERR_INVALID_IP_PARAMETER:"ERR_INVALID_IP_PARAMETER",ERR_INVALID_PORT_PARAMETER:"ERR_INVALID_PORT_PARAMETER",ERR_INVALID_IP:"ERR_INVALID_IP"};function ks(e,t){if(typeof e!="string")throw new ft(`invalid ip provided: ${e}`,Wr.ERR_INVALID_IP_PARAMETER);if(typeof t=="string"&&(t=parseInt(t)),isNaN(t))throw new ft(`invalid port provided: ${t}`,Wr.ERR_INVALID_PORT_PARAMETER);try{return new rt(e),dt(`/ip4/${e}/tcp/${t}`)}catch{}try{let r=new fe(e);return r.is4()?dt(`/ip4/${r.to4().correctForm()}/tcp/${t}`):dt(`/ip6/${e}/tcp/${t}`)}catch{let n=`invalid ip:port for creating a multiaddr: ${e}:${t}`;throw eu.error(n),new ft(n,Wr.ERR_INVALID_IP)}}var js=H($s(),1);var Yr=H(bt("os"),1),Vs=H(bt("path"),1);var iu={ip4:"IPv4",ip6:"IPv6"};function ne(e,t={}){let r=e.getPath();return r!=null?Yr.default.platform()==="win32"?{path:Vs.default.join("\\\\.\\pipe\\",r)}:{path:r}:{...e.toOptions(),...t}}function Qr(e,t,r){let n=i=>dt(`/${e}/${i}/tcp/${r}`);return(au(t)?uu(iu[e]):[t]).map(n)}function au(e){return["0.0.0.0","::"].includes(e)}var cu=Yr.default.networkInterfaces();function uu(e){let t=[];for(let[,r]of Object.entries(cu))if(r!=null)for(let n of r)n.family===e&&t.push(n.address);return t}var mt=Tt("libp2p:tcp:socket"),Ue=(e,t)=>{let r=t.metrics,n=t.metricPrefix??"",i=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(e.remoteAddress==null||e.remotePort==null)throw new ft("Could not determine remote address or port","ERR_NO_REMOTE_ADDRESS");f=ks(e.remoteAddress,e.remotePort)}let h=ne(f),g=h.path??`${h.host??""}:${h.port??""}`,{sink:C,source:l}=js.default.duplex(e);e.setTimeout(i,()=>{mt("%s socket read timeout",g),r?.increment({[`${n}timeout`]:!0});let x;e.readable&&(x=new ft("Socket read timeout","ERR_SOCKET_READ_TIMEOUT")),e.destroy(x)}),e.once("close",()=>{mt("%s socket close",g),r?.increment({[`${n}close`]:!0}),y.timeline.close==null&&(y.timeline.close=Date.now())}),e.once("end",()=>{mt("%s socket end",g),r?.increment({[`${n}end`]:!0})});let y={async sink(x){try{await C(x)}catch(S){S.type!=="aborted"&&mt(S)}e.end()},source:l,remoteAddr:f,timeline:{open:Date.now()},async close(x={}){if(e.destroyed){mt("%s socket was already destroyed when trying to close",g);return}x.signal=x.signal??AbortSignal.timeout(c);try{mt("%s closing socket",g),await new Promise((S,m)=>{e.once("close",()=>{mt("%s socket closed",g),S()}),e.once("error",A=>{mt("%s socket error",g,A),y.timeline.close==null&&(y.timeline.close=Date.now()),m(A)}),e.setTimeout(c),e.end(),e.writableLength>0?e.once("drain",()=>{mt("%s socket drained",g),e.destroy()}):e.destroy()})}catch(S){this.abort(S)}},abort:x=>{mt("%s socket abort due to error",g,x),e.destroy(x)}};return y};var nt=Tt("libp2p:tcp:listener");async function Kr(e){try{await e.close()}catch(t){nt.error("an error occurred closing the connection",t)}}var pu=1,hu=0,$e=class extends Me{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=zs.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 r=this.server.address();r==null?this.addr="unknown":typeof r=="string"?this.addr=r:this.addr=`${r.address}:${r.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]:pu})}this.dispatchEvent(new Qt("listening"))}).on("error",r=>{this.metrics?.errors.increment({[`${this.addr} listen_error`]:!0}),this.dispatchEvent(new Qt("error",{detail:r}))}).on("close",()=>{this.metrics?.status.update({[this.addr]:hu}),this.dispatchEvent(new Qt("close"))})}onSocket(t){t.on("error",n=>{nt("socket error",n),this.metrics?.events.increment({[`${this.addr} error`]:!0})});let r;try{r=Ue(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){nt.error("inbound connection failed",n),this.metrics?.errors.increment({[`${this.addr} inbound_to_connection`]:!0});return}nt("new inbound connection %s",r.remoteAddr);try{this.context.upgrader.upgradeInbound(r).then(n=>{nt("inbound connection upgraded %s",r.remoteAddr),this.connections.add(r),t.once("close",()=>{this.connections.delete(r),this.context.closeServerOnMaxConnections!=null&&this.connections.size<this.context.closeServerOnMaxConnections.listenBelow&&this.netListen().catch(i=>{nt.error("error attempting to listen server once connection count under limit",i),this.context.closeServerOnMaxConnections?.onListenError?.(i)})}),this.context.handler!=null&&this.context.handler(n),this.context.closeServerOnMaxConnections!=null&&this.connections.size>=this.context.closeServerOnMaxConnections.closeAbove&&this.netClose(),this.dispatchEvent(new Qt("connection",{detail:n}))}).catch(async n=>{nt.error("inbound connection failed",n),this.metrics?.errors.increment({[`${this.addr} inbound_upgrade`]:!0}),await Kr(r)}).catch(n=>{nt.error("closing inbound connection failed",n)})}catch(n){nt.error("inbound connection failed",n),Kr(r).catch(i=>{nt.error("closing inbound connection failed",i),this.metrics?.errors.increment({[`${this.addr} inbound_closing_failed`]:!0})})}}getAddrs(){if(!this.status.started)return[];let t=[],r=this.server.address(),{listeningAddr:n,peerId:i}=this.status;if(r==null)return[];if(typeof r=="string")t=[n];else try{n.toString().startsWith("/ip4")?t=t.concat(Qr("ip4",r.address,r.port)):r.family==="IPv6"&&(t=t.concat(Qr("ip6",r.address,r.port)))}catch(c){nt.error("could not turn %s:%s into multiaddr",r.address,r.port,c)}return t.map(c=>i!=null?c.encapsulate(`/p2p/${i}`):c)}async listen(t){if(this.status.started)throw Error("server is already listening");let r=t.getPeerId(),n=r==null?t.decapsulateCode(421):t,{backlog:i}=this.context;this.status={started:!0,listeningAddr:n,peerId:r,netConfig:ne(n,{backlog:i})},await this.netListen()}async close(){await Promise.all(Array.from(this.connections.values()).map(async t=>{await Kr(t)})),this.netClose()}async netListen(){if(!this.status.started||this.server.listening)return;let t=this.status.netConfig;await new Promise((r,n)=>{this.server.once("error",n),this.server.listen(t,r)}),nt("Listening on %s",this.server.address())}netClose(){!this.status.started||!this.server.listening||(nt("Closing server on %s",this.server.address()),this.server.close())}};var vt=Tt("libp2p:tcp"),en=class{opts;metrics;components;constructor(t,r={}){this.opts=r,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"})})}[ln]=!0;[Symbol.toStringTag]="@libp2p/tcp";async dial(t,r){r.keepAlive=r.keepAlive??!0;let n=await this._connect(t,r);n.on("error",h=>{vt("socket error",h)});let i=Ue(n,{remoteAddr:t,socketInactivityTimeout:this.opts.outboundSocketInactivityTimeout,socketCloseTimeout:this.opts.socketCloseTimeout,metrics:this.metrics?.dialerEvents}),c=()=>{i.close().catch(h=>{vt.error("Error closing maConn after abort",h)})};r.signal?.addEventListener("abort",c,{once:!0}),vt("new outbound connection %s",i.remoteAddr);let f=await r.upgrader.upgradeOutbound(i);if(vt("outbound connection %s upgraded",i.remoteAddr),r.signal?.removeEventListener("abort",c),r.signal?.aborted===!0)throw f.close().catch(h=>{vt.error("Error closing conn after abort",h)}),new Ut;return f}async _connect(t,r){if(r.signal?.aborted===!0)throw new Ut;return new Promise((n,i)=>{let c=Date.now(),f=ne(t),h=f.path??`${f.host??""}:${f.port}`;vt("dialing %j",f);let g=qs.default.connect(f),C=m=>{m.message=`connection error ${h}: ${m.message}`,this.metrics?.dialerEvents.increment({error:!0}),S(m)},l=()=>{vt("connection timeout %s",h),this.metrics?.dialerEvents.increment({timeout:!0});let m=new ft(`connection timeout after ${Date.now()-c}ms`,"ERR_CONNECT_TIMEOUT");g.emit("error",m)},y=()=>{vt("connection opened %j",f),this.metrics?.dialerEvents.increment({connect:!0}),S()},x=()=>{vt("connection aborted %j",f),this.metrics?.dialerEvents.increment({abort:!0}),g.destroy(),S(new Ut)},S=m=>{if(g.removeListener("error",C),g.removeListener("timeout",l),g.removeListener("connect",y),r.signal!=null&&r.signal.removeEventListener("abort",x),m!=null){i(m);return}n(g)};g.on("error",C),g.on("timeout",l),g.on("connect",y),r.signal!=null&&r.signal.addEventListener("abort",x)})}createListener(t){return new $e({...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(r=>r.protoCodes().includes(290)?!1:r.protoCodes().includes(400)?!0:It.matches(r.decapsulateCode(421)))}};function gu(e={}){return(t={})=>new en(t,e)}return Di(bu);})();
|
|
4
|
+
`+s),t.push(o+"m+"+Me.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=zn()+e+" "+t[0]}function zn(){return S.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Vn(...t){return process.stderr.write(Fe.format(...t)+`
|
|
5
|
+
`)}function qn(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function jn(){return process.env.DEBUG}function Gn(t){t.inspectOpts={};let e=Object.keys(S.inspectOpts);for(let r=0;r<e.length;r++)t.inspectOpts[e[r]]=S.inspectOpts[e[r]]}Me.exports=Je()(S);var{formatters:nr}=Me.exports;nr.o=function(t){return this.inspectOpts.colors=this.useColors,Fe.inspect(t,this.inspectOpts).split(`
|
|
6
|
+
`).map(e=>e.trim()).join(" ")};nr.O=function(t){return this.inspectOpts.colors=this.useColors,Fe.inspect(t,this.inspectOpts)}});var sr=I((fi,He)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?He.exports=Yt():He.exports=or()});var Pr=I((pc,Tr)=>{Tr.exports=yt;var Sr=128,ts=127,rs=~ts,ns=Math.pow(2,31);function yt(t,e,r){if(Number.MAX_SAFE_INTEGER&&t>Number.MAX_SAFE_INTEGER)throw yt.bytes=0,new RangeError("Could not encode varint");e=e||[],r=r||0;for(var n=r;t>=ns;)e[r++]=t&255|Sr,t/=128;for(;t&rs;)e[r++]=t&255|Sr,t>>>=7;return e[r]=t|0,yt.bytes=r-n+1,e}});var Fr=I((fc,Rr)=>{Rr.exports=xt;var os=128,Or=127;function xt(t,n){var r=0,n=n||0,o=0,s=n,i,a=t.length;do{if(s>=a||o>49)throw xt.bytes=0,new RangeError("Could not decode varint");i=t[s++],r+=o<28?(i&Or)<<o:(i&Or)*Math.pow(2,o),o+=7}while(i>=os);return xt.bytes=s-n,r}});var kr=I((hc,Mr)=>{var ss=Math.pow(2,7),is=Math.pow(2,14),cs=Math.pow(2,21),as=Math.pow(2,28),ls=Math.pow(2,35),us=Math.pow(2,42),ds=Math.pow(2,49),ps=Math.pow(2,56),fs=Math.pow(2,63);Mr.exports=function(t){return t<ss?1:t<is?2:t<cs?3:t<as?4:t<ls?5:t<us?6:t<ds?7:t<ps?8:t<fs?9:10}});var Ct=I((mc,Nr)=>{Nr.exports={encode:Pr(),decode:Fr(),encodingLength:kr()}});var je=I((Ha,on)=>{on.exports=t=>{if(t[Symbol.asyncIterator])return t;if(t.getReader)return async function*(){let e=t.getReader();try{for(;;){let{done:r,value:n}=await e.read();if(r)return;yield n}}finally{e.releaseLock()}}();throw new Error("unknown stream")}});var cn=I((Qa,sn)=>{sn.exports=function(e){if(e){if(typeof e[Symbol.iterator]=="function")return e[Symbol.iterator]();if(typeof e[Symbol.asyncIterator]=="function")return e[Symbol.asyncIterator]();if(typeof e.next=="function")return e}throw new Error("argument is not an iterator or iterable")}});var $t=I((Ka,an)=>{var js=cn();an.exports=t=>async e=>{e=js(e);let r=m=>{typeof m.return=="function"&&m.return()},n=null,o=null,s=m=>{n=m,o&&o(m),r(e)},i=null,a=!1,p=()=>{a=!0,i&&i()},y=null,l=!1,u=()=>{l=!0,y&&y()},f=null,g=()=>{f&&f()},h=()=>new Promise((m,E)=>{i=f=m,o=E,t.once("drain",g)}),b=()=>(r(e),new Promise((m,E)=>{if(a||l||n)return m();y=i=m,o=E})),x=()=>{t.removeListener("error",s),t.removeListener("close",p),t.removeListener("finish",u),t.removeListener("drain",g)};t.once("error",s),t.once("close",p),t.once("finish",u);try{for await(let m of e){if(!t.writable||t.destroyed||n)break;t.write(m)===!1&&await h()}}catch(m){n||t.destroy(),n=m}try{if(t.writable&&t.end(),await b(),n)throw n}finally{x()}}});var Bt=I((Ya,ln)=>{var Gs=$t(),Ws=je();ln.exports=t=>({sink:Gs(t),source:Ws(t)})});var dn=I((Za,un)=>{var Js=Bt();un.exports=t=>async function*(e){let r=Js(t),n;if(r.sink(e).catch(o=>{n=o}),yield*r.source,n)throw n}});var pn=I((el,ve)=>{ve.exports=je();ve.exports.source=je();ve.exports.sink=$t();ve.exports.transform=dn();ve.exports.duplex=Bt()});var si={};F(si,{tcp:()=>oi});var gn=J(W("net"),1);var ae=class t extends Error{code;type;constructor(e="The operation was aborted"){super(e),this.code=t.code,this.type=t.type}static code="ABORT_ERR";static type="aborted"},M=class extends Error{code;props;constructor(e,r,n){super(e),this.code=r,this.name=n?.name??"CodeError",this.props=n??{}}};var Xt=Symbol.for("@libp2p/transport");var Jt;(function(t){t[t.FATAL_ALL=0]="FATAL_ALL",t[t.NO_FATAL=1]="NO_FATAL"})(Jt||(Jt={}));var N=J(sr(),1);var et={};F(et,{base32:()=>q,base32hex:()=>eo,base32hexpad:()=>ro,base32hexpadupper:()=>no,base32hexupper:()=>to,base32pad:()=>Yn,base32padupper:()=>Zn,base32upper:()=>Kn,base32z:()=>oo});function Wn(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<t.length;o++){var s=t.charAt(o),i=s.charCodeAt(0);if(r[i]!==255)throw new TypeError(s+" is ambiguous");r[i]=o}var a=t.length,p=t.charAt(0),y=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function u(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 b=0,x=0,m=0,E=h.length;m!==E&&h[m]===0;)m++,b++;for(var _=(E-m)*l+1>>>0,A=new Uint8Array(_);m!==E;){for(var z=h[m],L=0,R=_-1;(z!==0||L<x)&&R!==-1;R--,L++)z+=256*A[R]>>>0,A[R]=z%a>>>0,z=z/a>>>0;if(z!==0)throw new Error("Non-zero carry");x=L,m++}for(var U=_-x;U!==_&&A[U]===0;)U++;for(var ce=p.repeat(b);U<_;++U)ce+=t.charAt(A[U]);return ce}function f(h){if(typeof h!="string")throw new TypeError("Expected String");if(h.length===0)return new Uint8Array;var b=0;if(h[b]!==" "){for(var x=0,m=0;h[b]===p;)x++,b++;for(var E=(h.length-b)*y+1>>>0,_=new Uint8Array(E);h[b];){var A=r[h.charCodeAt(b)];if(A===255)return;for(var z=0,L=E-1;(A!==0||z<m)&&L!==-1;L--,z++)A+=a*_[L]>>>0,_[L]=A%256>>>0,A=A/256>>>0;if(A!==0)throw new Error("Non-zero carry");m=z,b++}if(h[b]!==" "){for(var R=E-m;R!==E&&_[R]===0;)R++;for(var U=new Uint8Array(x+(E-R)),ce=x;R!==E;)U[ce++]=_[R++];return U}}}function g(h){var b=f(h);if(b)return b;throw new Error(`Non-${e} character`)}return{encode:u,decodeUnsafe:f,decode:g}}var Jn=Wn,Xn=Jn,ir=Xn;var mi=new Uint8Array(0);var cr=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0},$=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")};var ar=t=>new TextEncoder().encode(t),lr=t=>new TextDecoder().decode(t);var Qe=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Ke=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return dr(this,e)}},Ye=class{constructor(e){this.decoders=e}or(e){return dr(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},dr=(t,e)=>new Ye({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),Ze=class{constructor(e,r,n,o){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=o,this.encoder=new Qe(e,r,n),this.decoder=new Ke(e,r,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},fe=({name:t,prefix:e,encode:r,decode:n})=>new Ze(t,e,r,n),K=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:o}=ir(r,e);return fe({prefix:t,name:e,encode:n,decode:s=>$(o(s))})},Hn=(t,e,r,n)=>{let o={};for(let l=0;l<e.length;++l)o[e[l]]=l;let s=t.length;for(;t[s-1]==="=";)--s;let i=new Uint8Array(s*r/8|0),a=0,p=0,y=0;for(let l=0;l<s;++l){let u=o[t[l]];if(u===void 0)throw new SyntaxError(`Non-${n} character`);p=p<<r|u,a+=r,a>=8&&(a-=8,i[y++]=255&p>>a)}if(a>=r||255&p<<8-a)throw new SyntaxError("Unexpected end of data");return i},Qn=(t,e,r)=>{let n=e[e.length-1]==="=",o=(1<<r)-1,s="",i=0,a=0;for(let p=0;p<t.length;++p)for(a=a<<8|t[p],i+=8;i>r;)i-=r,s+=e[o&a>>i];if(i&&(s+=e[o&a<<r-i]),n)for(;s.length*r&7;)s+="=";return s},C=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>fe({prefix:e,name:t,encode(o){return Qn(o,n,r)},decode(o){return Hn(o,n,r,t)}});var q=C({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Kn=C({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Yn=C({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Zn=C({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),eo=C({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),to=C({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),ro=C({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),no=C({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),oo=C({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var tt={};F(tt,{base58btc:()=>P,base58flickr:()=>so});var P=K({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),so=K({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var nt={};F(nt,{base64:()=>rt,base64pad:()=>io,base64url:()=>co,base64urlpad:()=>ao});var rt=C({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),io=C({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),co=C({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ao=C({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});N.default.formatters.b=t=>t==null?"undefined":P.baseEncode(t);N.default.formatters.t=t=>t==null?"undefined":q.baseEncode(t);N.default.formatters.m=t=>t==null?"undefined":rt.baseEncode(t);N.default.formatters.p=t=>t==null?"undefined":t.toString();N.default.formatters.c=t=>t==null?"undefined":t.toString();N.default.formatters.k=t=>t==null?"undefined":t.toString();N.default.formatters.a=t=>t==null?"undefined":t.toString();function lo(t){let e=()=>{};return e.enabled=!1,e.color="",e.diff=0,e.log=()=>{},e.namespace=t,e.destroy=()=>!0,e.extend=()=>e,e}function Y(t){let e=lo(`${t}:trace`);return N.default.enabled(`${t}:trace`)&&N.default.names.map(r=>r.toString()).find(r=>r.includes(":trace"))!=null&&(e=(0,N.default)(`${t}:trace`)),Object.assign((0,N.default)(t),{error:(0,N.default)(`${t}:error`),trace:e})}var uo=hr,pr=128,po=127,fo=~po,ho=Math.pow(2,31);function hr(t,e,r){e=e||[],r=r||0;for(var n=r;t>=ho;)e[r++]=t&255|pr,t/=128;for(;t&fo;)e[r++]=t&255|pr,t>>>=7;return e[r]=t|0,hr.bytes=r-n+1,e}var mo=ot,go=128,fr=127;function ot(t,n){var r=0,n=n||0,o=0,s=n,i,a=t.length;do{if(s>=a)throw ot.bytes=0,new RangeError("Could not decode varint");i=t[s++],r+=o<28?(i&fr)<<o:(i&fr)*Math.pow(2,o),o+=7}while(i>=go);return ot.bytes=s-n,r}var bo=Math.pow(2,7),wo=Math.pow(2,14),yo=Math.pow(2,21),xo=Math.pow(2,28),Co=Math.pow(2,35),vo=Math.pow(2,42),Eo=Math.pow(2,49),Ao=Math.pow(2,56),Io=Math.pow(2,63),So=function(t){return t<bo?1:t<wo?2:t<yo?3:t<xo?4:t<Co?5:t<vo?6:t<Eo?7:t<Ao?8:t<Io?9:10},To={encode:uo,decode:mo,encodingLength:So},Po=To,Ae=Po;var Ie=(t,e=0)=>[Ae.decode(t,e),Ae.decode.bytes],he=(t,e,r=0)=>(Ae.encode(t,e,r),e),me=t=>Ae.encodingLength(t);var ne=(t,e)=>{let r=e.byteLength,n=me(t),o=n+me(r),s=new Uint8Array(o+r);return he(t,s,0),he(r,s,n),s.set(e,o),new ge(t,r,e,s)},Ne=t=>{let e=$(t),[r,n]=Ie(e),[o,s]=Ie(e.subarray(n)),i=e.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new ge(r,o,i,e)},mr=(t,e)=>{if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&cr(t.bytes,r.bytes)}},ge=class{constructor(e,r,n,o){this.code=e,this.size=r,this.digest=n,this.bytes=o}};var gr=(t,e)=>{let{bytes:r,version:n}=t;switch(n){case 0:return Ro(r,st(t),e||P.encoder);default:return Fo(r,st(t),e||q.encoder)}};var br=new WeakMap,st=t=>{let e=br.get(t);if(e==null){let r=new Map;return br.set(t,r),r}return e},Z=class t{constructor(e,r,n,o){this.code=r,this.version=e,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:r}=this;if(e!==Se)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Mo)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return t.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=ne(e,r);return t.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return t.equals(this,e)}static equals(e,r){let n=r;return n&&e.code===n.code&&e.version===n.version&&mr(e.multihash,n.multihash)}toString(e){return gr(this,e)}toJSON(){return{"/":gr(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let r=e;if(r instanceof t)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:o,multihash:s,bytes:i}=r;return new t(n,o,s,i||wr(n,o,s.bytes))}else if(r[ko]===!0){let{version:n,multihash:o,code:s}=r,i=Ne(o);return t.create(n,s,i)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(r!==Se)throw new Error(`Version 0 CID must use dag-pb (code: ${Se}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let o=wr(e,r,n.bytes);return new t(e,r,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,Se,e)}static createV1(e,r){return t.create(1,e,r)}static decode(e){let[r,n]=t.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=t.inspectBytes(e),n=r.size-r.multihashSize,o=$(e.subarray(n,n+r.multihashSize));if(o.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=o.subarray(r.multihashSize-r.digestSize),i=new ge(r.multihashCode,r.digestSize,s,o);return[r.version===0?t.createV0(i):t.createV1(r.codec,i),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[u,f]=Ie(e.subarray(r));return r+=f,u},o=n(),s=Se;if(o===18?(o=0,r=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=r,a=n(),p=n(),y=r+p,l=y-i;return{version:o,codec:s,multihashCode:a,digestSize:p,multihashSize:l,size:y}}static parse(e,r){let[n,o]=Oo(e,r),s=t.decode(o);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return st(s).set(n,e),s}},Oo=(t,e)=>{switch(t[0]){case"Q":{let r=e||P;return[P.prefix,r.decode(`${P.prefix}${t}`)]}case P.prefix:{let r=e||P;return[P.prefix,r.decode(t)]}case q.prefix:{let r=e||q;return[q.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}},Ro=(t,e,r)=>{let{prefix:n}=r;if(n!==P.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let o=e.get(n);if(o==null){let s=r.encode(t).slice(1);return e.set(n,s),s}else return o},Fo=(t,e,r)=>{let{prefix:n}=r,o=e.get(n);if(o==null){let s=r.encode(t);return e.set(n,s),s}else return o},Se=112,Mo=18,wr=(t,e,r)=>{let n=me(t),o=n+me(e),s=new Uint8Array(o+r.byteLength);return he(t,s,0),he(e,s,n),s.set(r,o),s},ko=Symbol.for("@ipld/js-cid/CID");function yr(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0}var it={};F(it,{identity:()=>No});var No=fe({prefix:"\0",name:"identity",encode:t=>lr(t),decode:t=>ar(t)});var ct={};F(ct,{base2:()=>Do});var Do=C({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var at={};F(at,{base8:()=>_o});var _o=C({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var lt={};F(lt,{base10:()=>Lo});var Lo=K({prefix:"9",name:"base10",alphabet:"0123456789"});var ut={};F(ut,{base16:()=>Uo,base16upper:()=>$o});var Uo=C({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),$o=C({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var dt={};F(dt,{base36:()=>Bo,base36upper:()=>zo});var Bo=K({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),zo=K({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var pt={};F(pt,{base256emoji:()=>Wo});var xr=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}"),Vo=xr.reduce((t,e,r)=>(t[r]=e,t),[]),qo=xr.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function jo(t){return t.reduce((e,r)=>(e+=Vo[r],e),"")}function Go(t){let e=[];for(let r of t){let n=qo[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var Wo=fe({prefix:"\u{1F680}",name:"base256emoji",encode:jo,decode:Go});var gt={};F(gt,{sha256:()=>Jo,sha512:()=>Xo});var mt=J(W("crypto"),1);var ht=({name:t,code:e,encode:r})=>new ft(t,e,r),ft=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?ne(this.code,r):r.then(n=>ne(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Jo=ht({name:"sha2-256",code:18,encode:t=>$(mt.default.createHash("sha256").update(t).digest())}),Xo=ht({name:"sha2-512",code:19,encode:t=>$(mt.default.createHash("sha512").update(t).digest())});var bt={};F(bt,{identity:()=>Ko});var vr=0,Ho="identity",Er=$,Qo=t=>ne(vr,Er(t)),Ko={code:vr,name:Ho,encode:Er,digest:Qo};var Ji=new TextEncoder,Xi=new TextDecoder;var Te={...it,...ct,...at,...lt,...ut,...et,...dt,...tt,...nt,...pt},Zi={...gt,...bt};function we(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function De(t=0){return globalThis.Buffer?.allocUnsafe!=null?we(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function Ir(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var Ar=Ir("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),wt=Ir("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);let e=De(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),es={utf8:Ar,"utf-8":Ar,hex:Te.base16,latin1:wt,ascii:wt,binary:wt,...Te},_e=es;function O(t,e="utf8"){let r=_e[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):r.encoder.encode(t).substring(1)}function X(t,e){e==null&&(e=t.reduce((o,s)=>o+s.length,0));let r=De(e),n=0;for(let o of t)r.set(o,n),n+=o.length;return we(r)}var xe=J(Ct(),1);var Le=class{index=0;input="";new(e){return this.index=0,this.input=e,this}readAtomically(e){let r=this.index,n=e();return n===void 0&&(this.index=r),n}parseWith(e){let r=e();if(this.index===this.input.length)return r}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(e){return this.readAtomically(()=>{let r=this.readChar();if(r===e)return r})}readSeparator(e,r,n){return this.readAtomically(()=>{if(!(r>0&&this.readGivenChar(e)===void 0))return n()})}readNumber(e,r,n,o){return this.readAtomically(()=>{let s=0,i=0,a=this.peekChar();if(a===void 0)return;let p=a==="0",y=2**(8*o)-1;for(;;){let l=this.readAtomically(()=>{let u=this.readChar();if(u===void 0)return;let f=Number.parseInt(u,e);if(!Number.isNaN(f))return f});if(l===void 0)break;if(s*=e,s+=l,s>y||(i+=1,r!==void 0&&i>r))return}if(i!==0)return!n&&p&&i>1?void 0:s})}readIPv4Addr(){return this.readAtomically(()=>{let e=new Uint8Array(4);for(let r=0;r<e.length;r++){let n=this.readSeparator(".",r,()=>this.readNumber(10,3,!1,1));if(n===void 0)return;e[r]=n}return e})}readIPv6Addr(){let e=r=>{for(let n=0;n<r.length/2;n++){let o=n*2;if(n<r.length-3){let i=this.readSeparator(":",n,()=>this.readIPv4Addr());if(i!==void 0)return r[o]=i[0],r[o+1]=i[1],r[o+2]=i[2],r[o+3]=i[3],[o+4,!0]}let s=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(s===void 0)return[o,!1];r[o]=s>>8,r[o+1]=s&255}return[r.length,!1]};return this.readAtomically(()=>{let r=new Uint8Array(16),[n,o]=e(r);if(n===16)return r;if(o||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let s=new Uint8Array(14),i=16-(n+2),[a]=e(s.subarray(0,i));return r.set(s.subarray(0,a),16-a),r})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var wc=new Le;var Sc=parseInt("0xFFFF",16),Tc=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);function vt(t,e="utf8"){let r=_e[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?we(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var j=J(Ct(),1);var B=W("node:net");function Ue(t){return!!(0,B.isIP)(t)}var Lr=B.isIPv4,ys=B.isIPv6,Et=function(t){let e=0;if(t=t.toString().trim(),Lr(t)){let r=new Uint8Array(e+4);return t.split(/\./g).forEach(n=>{r[e++]=parseInt(n,10)&255}),r}if(ys(t)){let r=t.split(":",8),n;for(n=0;n<r.length;n++){let s=Lr(r[n]),i;s&&(i=Et(r[n]),r[n]=O(i.slice(0,2),"base16")),i!=null&&++n<8&&r.splice(n,0,O(i.slice(2,4),"base16"))}if(r[0]==="")for(;r.length<8;)r.unshift("0");else if(r[r.length-1]==="")for(;r.length<8;)r.push("0");else if(r.length<8){for(n=0;n<r.length&&r[n]!=="";n++);let s=[n,1];for(n=9-r.length;n>0;n--)s.push("0");r.splice.apply(r,s)}let o=new Uint8Array(e+16);for(n=0;n<r.length;n++){let s=parseInt(r[n],16);o[e++]=s>>8&255,o[e++]=s&255}return o}throw new Error("invalid ip address")},Ur=function(t,e=0,r){e=~~e,r=r??t.length-e;let n=new DataView(t.buffer);if(r===4){let o=[];for(let s=0;s<r;s++)o.push(t[e+s]);return o.join(".")}if(r===16){let o=[];for(let s=0;s<r;s+=2)o.push(n.getUint16(e+s).toString(16));return o.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var ye={},At={},Cs=[[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"]];Cs.forEach(t=>{let e=vs(...t);At[e.code]=e,ye[e.name]=e});function vs(t,e,r,n,o){return{code:t,size:e,name:r,resolvable:!!n,path:!!o}}function w(t){if(typeof t=="number"){if(At[t]!=null)return At[t];throw new Error(`no protocol with code: ${t}`)}else if(typeof t=="string"){if(ye[t]!=null)return ye[t];throw new Error(`no protocol with name: ${t}`)}throw new Error(`invalid protocol id type: ${typeof t}`)}var ha=w("ip4"),ma=w("ip6"),ga=w("ipcidr");function St(t,e){switch(w(t).code){case 4:case 41:return As(e);case 42:return zr(e);case 6:case 273:case 33:case 132:return qr(e).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return zr(e);case 421:return Ps(e);case 444:return Vr(e);case 445:return Vr(e);case 466:return Ts(e);default:return O(e,"base16")}}function Tt(t,e){switch(w(t).code){case 4:return $r(e);case 41:return $r(e);case 42:return Br(e);case 6:case 273:case 33:case 132:return Pt(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Br(e);case 421:return Is(e);case 444:return Os(e);case 445:return Rs(e);case 466:return Ss(e);default:return vt(e,"base16")}}var It=Object.values(Te).map(t=>t.decoder),Es=function(){let t=It[0].or(It[1]);return It.slice(2).forEach(e=>t=t.or(e)),t}();function $r(t){if(!Ue(t))throw new Error("invalid ip address");return Et(t)}function As(t){let e=Ur(t,0,t.length);if(e==null)throw new Error("ipBuff is required");if(!Ue(e))throw new Error("invalid ip address");return e}function Pt(t){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,t),new Uint8Array(e)}function qr(t){return new DataView(t.buffer).getUint16(t.byteOffset)}function Br(t){let e=vt(t),r=Uint8Array.from(j.default.encode(e.length));return X([r,e],r.length+e.length)}function zr(t){let e=j.default.decode(t);if(t=t.slice(j.default.decode.bytes),t.length!==e)throw new Error("inconsistent lengths");return O(t)}function Is(t){let e;t[0]==="Q"||t[0]==="1"?e=Ne(P.decode(`z${t}`)).bytes:e=Z.parse(t).multihash.bytes;let r=Uint8Array.from(j.default.encode(e.length));return X([r,e],r.length+e.length)}function Ss(t){let e=Es.decode(t),r=Uint8Array.from(j.default.encode(e.length));return X([r,e],r.length+e.length)}function Ts(t){let e=j.default.decode(t),r=t.slice(j.default.decode.bytes);if(r.length!==e)throw new Error("inconsistent lengths");return"u"+O(r,"base64url")}function Ps(t){let e=j.default.decode(t),r=t.slice(j.default.decode.bytes);if(r.length!==e)throw new Error("inconsistent lengths");return O(r,"base58btc")}function Os(t){let e=t.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==16)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion address.`);let r=q.decode("b"+e[0]),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=Pt(n);return X([r,o],r.length+o.length)}function Rs(t){let e=t.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==56)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion3 address.`);let r=q.decode(`b${e[0]}`),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=Pt(n);return X([r,o],r.length+o.length)}function Vr(t){let e=t.slice(0,t.length-2),r=t.slice(t.length-2),n=O(e,"base32"),o=qr(r);return`${n}:${o}`}function jr(t){t=Ot(t);let e=[],r=[],n=null,o=t.split("/").slice(1);if(o.length===1&&o[0]==="")return{bytes:new Uint8Array,string:"/",tuples:[],stringTuples:[],path:null};for(let s=0;s<o.length;s++){let i=o[s],a=w(i);if(a.size===0){e.push([a.code]),r.push([a.code]);continue}if(s++,s>=o.length)throw Wr("invalid address: "+t);if(a.path===!0){n=Ot(o.slice(s).join("/")),e.push([a.code,Tt(a.code,n)]),r.push([a.code,n]);break}let p=Tt(a.code,o[s]);e.push([a.code,p]),r.push([a.code,St(a.code,p)])}return{string:Gr(r),bytes:Ft(e),tuples:e,stringTuples:r,path:n}}function Rt(t){let e=[],r=[],n=null,o=0;for(;o<t.length;){let s=xe.default.decode(t,o),i=xe.default.decode.bytes??0,a=w(s),p=Fs(a,t.slice(o+i));if(p===0){e.push([s]),r.push([s]),o+=i;continue}let y=t.slice(o+i,o+i+p);if(o+=p+i,o>t.length)throw Wr("Invalid address Uint8Array: "+O(t,"base16"));e.push([s,y]);let l=St(s,y);if(r.push([s,l]),a.path===!0){n=l;break}}return{bytes:Uint8Array.from(t),string:Gr(r),tuples:e,stringTuples:r,path:n}}function Gr(t){let e=[];return t.map(r=>{let n=w(r[0]);return e.push(n.name),r.length>1&&r[1]!=null&&e.push(r[1]),null}),Ot(e.join("/"))}function Ft(t){return X(t.map(e=>{let r=w(e[0]),n=Uint8Array.from(xe.default.encode(r.code));return e.length>1&&e[1]!=null&&(n=X([n,e[1]])),n}))}function Fs(t,e){return t.size>0?t.size/8:t.size===0?0:xe.default.decode(e)+(xe.default.decode.bytes??0)}function Ot(t){return"/"+t.trim().split("/").filter(e=>e).join("/")}function Wr(t){return new Error("Error parsing address: "+t)}var Ms=Symbol.for("nodejs.util.inspect.custom"),ks=[w("dns").code,w("dns4").code,w("dns6").code,w("dnsaddr").code],Ns=new Map,Jr=Symbol.for("@multiformats/js-multiaddr/multiaddr");function Ds(t){return!!t?.[Jr]}var Mt=class t{bytes;#e;#t;#r;#n;[Jr]=!0;constructor(e){e==null&&(e="");let r;if(e instanceof Uint8Array)r=Rt(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);r=jr(e)}else if(Ds(e))r=Rt(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=r.bytes,this.#e=r.string,this.#t=r.tuples,this.#r=r.stringTuples,this.#n=r.path}toString(){return this.#e}toJSON(){return this.toString()}toOptions(){let e,r,n,o,s="",i=w("tcp"),a=w("udp"),p=w("ip4"),y=w("ip6"),l=w("dns6"),u=w("ip6zone");for(let[g,h]of this.stringTuples())g===u.code&&(s=`%${h??""}`),ks.includes(g)&&(r=i.name,o=443,n=`${h??""}${s}`,e=g===l.code?6:4),(g===i.code||g===a.code)&&(r=w(g).name,o=parseInt(h??"")),(g===p.code||g===y.code)&&(r=w(g).name,n=`${h??""}${s}`,e=g===y.code?6:4);if(e==null||r==null||n==null||o==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:n,transport:r,port:o}}protos(){return this.#t.map(([e])=>Object.assign({},w(e)))}protoCodes(){return this.#t.map(([e])=>e)}protoNames(){return this.#t.map(([e])=>w(e).name)}tuples(){return this.#t}stringTuples(){return this.#r}encapsulate(e){return e=new t(e),new t(this.toString()+e.toString())}decapsulate(e){let r=e.toString(),n=this.toString(),o=n.lastIndexOf(r);if(o<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${e.toString()}`);return new t(n.slice(0,o))}decapsulateCode(e){let r=this.tuples();for(let n=r.length-1;n>=0;n--)if(r[n][0]===e)return new t(Ft(r.slice(0,n)));return this}getPeerId(){try{let e=[];this.stringTuples().forEach(([n,o])=>{n===ye.p2p.code&&e.push([n,o]),n===ye["p2p-circuit"].code&&(e=[])});let r=e.pop();if(r?.[1]!=null){let n=r[1];return n[0]==="Q"||n[0]==="1"?O(P.decode(`z${n}`),"base58btc"):O(Z.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return this.#n}equals(e){return yr(this.bytes,e.bytes)}async resolve(e){let r=this.protos().find(s=>s.resolvable);if(r==null)return[this];let n=Ns.get(r.name);if(n==null)throw new M(`no available resolver for ${r.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,e)).map(s=>new t(s))}nodeAddress(){let e=this.toOptions();if(e.transport!=="tcp"&&e.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${e.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:e.family,address:e.host,port:e.port}}isThinWaistAddress(e){let r=(e??this).protos();return!(r.length!==2||r[0].code!==4&&r[0].code!==41||r[1].code!==6&&r[1].code!==273)}[Ms](){return`Multiaddr(${this.#e})`}};function H(t){return new Mt(t)}var _s=c("dns4"),Ls=c("dns6"),Us=c("dnsaddr"),se=v(c("dns"),Us,_s,Ls),ze=v(c("ip4"),c("ip6")),te=v(d(ze,c("tcp")),d(se,c("tcp"))),Ve=d(ze,c("udp")),$s=d(Ve,c("utp")),Bs=d(Ve,c("quic")),zs=d(Ve,c("quic-v1")),kt=v(d(te,c("ws")),d(se,c("ws"))),$e=v(d(kt,c("p2p")),kt),Nt=v(d(te,c("wss")),d(se,c("wss")),d(te,c("tls"),c("ws")),d(se,c("tls"),c("ws"))),Be=v(d(Nt,c("p2p")),Nt),Dt=v(d(te,c("http")),d(ze,c("http")),d(se,c("http"))),_t=v(d(te,c("https")),d(ze,c("https")),d(se,c("https"))),Xr=d(Ve,c("webrtc-direct"),c("certhash")),Kr=v(d(Xr,c("p2p")),Xr),Hr=d(zs,c("webtransport"),c("certhash"),c("certhash")),Yr=v(d(Hr,c("p2p")),Hr),Zr=v(d($e,c("p2p-webrtc-star"),c("p2p")),d(Be,c("p2p-webrtc-star"),c("p2p")),d($e,c("p2p-webrtc-star")),d(Be,c("p2p-webrtc-star"))),Ua=v(d($e,c("p2p-websocket-star"),c("p2p")),d(Be,c("p2p-websocket-star"),c("p2p")),d($e,c("p2p-websocket-star")),d(Be,c("p2p-websocket-star"))),en=v(d(Dt,c("p2p-webrtc-direct"),c("p2p")),d(_t,c("p2p-webrtc-direct"),c("p2p")),d(Dt,c("p2p-webrtc-direct")),d(_t,c("p2p-webrtc-direct"))),ie=v(kt,Nt,Dt,_t,Zr,en,te,$s,Bs,se,Kr,Yr),$a=v(d(ie,c("p2p-stardust"),c("p2p")),d(ie,c("p2p-stardust"))),ee=v(d(ie,c("p2p")),Zr,en,Kr,Yr,c("p2p")),Qr=v(d(ee,c("p2p-circuit"),ee),d(ee,c("p2p-circuit")),d(c("p2p-circuit"),ee),d(ie,c("p2p-circuit")),d(c("p2p-circuit"),ie),c("p2p-circuit")),tn=()=>v(d(Qr,tn),Qr),oe=tn(),Ba=v(d(oe,ee,oe),d(ee,oe),d(oe,ee),oe,ee);var za=v(d(oe,c("webrtc"),c("p2p")),d(oe,c("webrtc")),d(ie,c("webrtc"),c("p2p")),d(ie,c("webrtc")),c("webrtc"));function rn(t){function e(r){let n;try{n=H(r)}catch{return!1}let o=t(n.protoNames());return o===null?!1:o===!0||o===!1?o:o.length===0}return e}function d(...t){function e(r){if(r.length<t.length)return null;let n=r;return t.some(o=>(n=typeof o=="function"?o().partialMatch(r):o.partialMatch(r),Array.isArray(n)&&(r=n),n===null)),n}return{toString:function(){return"{ "+t.join(" ")+" }"},input:t,matches:rn(e),partialMatch:e}}function v(...t){function e(n){let o=null;return t.some(s=>{let i=typeof s=="function"?s().partialMatch(n):s.partialMatch(n);return i!=null?(o=i,!0):!1}),o}return{toString:function(){return"{ "+t.join(" ")+" }"},input:t,matches:rn(e),partialMatch:e}}function c(t){let e=t;function r(o){let s;try{s=H(o)}catch{return!1}let i=s.protoNames();return i.length===1&&i[0]===e}function n(o){return o.length===0?null:o[0]===e?o.slice(1):null}return{toString:function(){return e},matches:r,partialMatch:n}}var mn=J(W("net"),1);var qe=class extends EventTarget{#e=new Map;listenerCount(e){let r=this.#e.get(e);return r==null?0:r.length}addEventListener(e,r,n){super.addEventListener(e,r,n);let o=this.#e.get(e);o==null&&(o=[],this.#e.set(e,o)),o.push({callback:r,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(e,r,n){super.removeEventListener(e.toString(),r??null,n);let o=this.#e.get(e);o!=null&&(o=o.filter(({callback:s})=>s!==r),this.#e.set(e,o))}dispatchEvent(e){let r=super.dispatchEvent(e),n=this.#e.get(e.type);return n==null||(n=n.filter(({once:o})=>!o),this.#e.set(e.type,n)),r}safeDispatchEvent(e,r){return this.dispatchEvent(new Ce(e,r))}},Lt=class extends Event{detail;constructor(e,r){super(e,r),this.detail=r?.detail}},Ce=globalThis.CustomEvent??Lt;var qs=Y("libp2p:ip-port-to-multiaddr"),Ut={ERR_INVALID_IP_PARAMETER:"ERR_INVALID_IP_PARAMETER",ERR_INVALID_PORT_PARAMETER:"ERR_INVALID_PORT_PARAMETER",ERR_INVALID_IP:"ERR_INVALID_IP"};function nn(t,e){if(typeof t!="string")throw new M(`invalid ip provided: ${t}`,Ut.ERR_INVALID_IP_PARAMETER);if(typeof e=="string"&&(e=parseInt(e)),isNaN(e))throw new M(`invalid port provided: ${e}`,Ut.ERR_INVALID_PORT_PARAMETER);if((0,B.isIPv4)(t))return H(`/ip4/${t}/tcp/${e}`);if((0,B.isIPv6)(t))return H(`/ip6/${t}/tcp/${e}`);let r=`invalid ip:port for creating a multiaddr: ${t}:${e}`;throw qs.error(r),new M(r,Ut.ERR_INVALID_IP)}var hn=J(pn(),1);var zt=J(W("os"),1),fn=J(W("path"),1);var Xs={ip4:"IPv4",ip6:"IPv6"};function Ee(t,e={}){let r=t.getPath();return r!=null?zt.default.platform()==="win32"?{path:fn.default.join("\\\\.\\pipe\\",r)}:{path:r}:{...t.toOptions(),...e}}function Vt(t,e,r){let n=o=>H(`/${t}/${o}/tcp/${r}`);return(Hs(e)?Ks(Xs[t]):[e]).map(n)}function Hs(t){return["0.0.0.0","::"].includes(t)}var Qs=zt.default.networkInterfaces();function Ks(t){let e=[];for(let[,r]of Object.entries(Qs))if(r!=null)for(let n of r)n.family===t&&e.push(n.address);return e}var G=Y("libp2p:tcp:socket"),Ge=(t,e)=>{let r=e.metrics,n=e.metricPrefix??"",o=e.socketInactivityTimeout??3e5,s=e.socketCloseTimeout??500;e.listeningAddr?.getPath()!=null&&(e.remoteAddr=e.listeningAddr),e.remoteAddr?.getPath()!=null&&(e.localAddr=e.remoteAddr);let i;if(e.remoteAddr!=null)i=e.remoteAddr;else{if(t.remoteAddress==null||t.remotePort==null)throw new M("Could not determine remote address or port","ERR_NO_REMOTE_ADDRESS");i=nn(t.remoteAddress,t.remotePort)}let a=Ee(i),p=a.path??`${a.host??""}:${a.port??""}`,{sink:y,source:l}=hn.default.duplex(t);t.setTimeout(o,()=>{G("%s socket read timeout",p),r?.increment({[`${n}timeout`]:!0});let f;t.readable&&(f=new M("Socket read timeout","ERR_SOCKET_READ_TIMEOUT")),t.destroy(f)}),t.once("close",()=>{G("%s socket close",p),r?.increment({[`${n}close`]:!0}),u.timeline.close==null&&(u.timeline.close=Date.now())}),t.once("end",()=>{G("%s socket end",p),r?.increment({[`${n}end`]:!0})});let u={async sink(f){try{await y(f)}catch(g){g.type!=="aborted"&&G(g)}t.end()},source:l,remoteAddr:i,timeline:{open:Date.now()},async close(f={}){if(t.destroyed){G("%s socket was already destroyed when trying to close",p);return}f.signal=f.signal??AbortSignal.timeout(s);try{G("%s closing socket",p),await new Promise((g,h)=>{t.once("close",()=>{G("%s socket closed",p),g()}),t.once("error",b=>{G("%s socket error",p,b),u.timeline.close==null&&(u.timeline.close=Date.now()),h(b)}),t.setTimeout(s),t.end(),t.writableLength>0?t.once("drain",()=>{G("%s socket drained",p),t.destroy()}):t.destroy()})}catch(g){this.abort(g)}},abort:f=>{G("%s socket abort due to error",p,f),t.destroy(f)}};return u};var D=Y("libp2p:tcp:listener");async function qt(t){try{await t.close()}catch(e){D.error("an error occurred closing the connection",e)}}var ei=1,ti=0,We=class extends qe{context;server;connections=new Set;status={started:!1};metrics;addr;constructor(e){if(super(),this.context=e,e.keepAlive=e.keepAlive??!0,this.addr="unknown",this.server=mn.default.createServer(e,this.onSocket.bind(this)),e.maxConnections!==void 0&&(this.server.maxConnections=e.maxConnections),e.closeServerOnMaxConnections!=null&&e.closeServerOnMaxConnections.closeAbove<e.closeServerOnMaxConnections.listenBelow)throw Error("closeAbove must be >= listenBelow");this.server.on("listening",()=>{if(e.metrics!=null){let r=this.server.address();r==null?this.addr="unknown":typeof r=="string"?this.addr=r:this.addr=`${r.address}:${r.port}`,e.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:e.metrics.registerMetricGroup("libp2p_tcp_listener_status_info",{label:"address",help:"Current status of the TCP listener socket"}),errors:e.metrics.registerMetricGroup("libp2p_tcp_listener_errors_total",{label:"address",help:"Total count of TCP listener errors by type"}),events:e.metrics.registerMetricGroup("libp2p_tcp_listener_events_total",{label:"address",help:"Total count of TCP listener events by type"})},this.metrics?.status.update({[this.addr]:ei})}this.dispatchEvent(new Ce("listening"))}).on("error",r=>{this.metrics?.errors.increment({[`${this.addr} listen_error`]:!0}),this.dispatchEvent(new Ce("error",{detail:r}))}).on("close",()=>{this.metrics?.status.update({[this.addr]:ti}),this.dispatchEvent(new Ce("close"))})}onSocket(e){e.on("error",n=>{D("socket error",n),this.metrics?.events.increment({[`${this.addr} error`]:!0})});let r;try{r=Ge(e,{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){D.error("inbound connection failed",n),this.metrics?.errors.increment({[`${this.addr} inbound_to_connection`]:!0});return}D("new inbound connection %s",r.remoteAddr);try{this.context.upgrader.upgradeInbound(r).then(n=>{D("inbound connection upgraded %s",r.remoteAddr),this.connections.add(r),e.once("close",()=>{this.connections.delete(r),this.context.closeServerOnMaxConnections!=null&&this.connections.size<this.context.closeServerOnMaxConnections.listenBelow&&this.netListen().catch(o=>{D.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=>{D.error("inbound connection failed",n),this.metrics?.errors.increment({[`${this.addr} inbound_upgrade`]:!0}),await qt(r)}).catch(n=>{D.error("closing inbound connection failed",n)})}catch(n){D.error("inbound connection failed",n),qt(r).catch(o=>{D.error("closing inbound connection failed",o),this.metrics?.errors.increment({[`${this.addr} inbound_closing_failed`]:!0})})}}getAddrs(){if(!this.status.started)return[];let e=[],r=this.server.address(),{listeningAddr:n,peerId:o}=this.status;if(r==null)return[];if(typeof r=="string")e=[n];else try{n.toString().startsWith("/ip4")?e=e.concat(Vt("ip4",r.address,r.port)):r.family==="IPv6"&&(e=e.concat(Vt("ip6",r.address,r.port)))}catch(s){D.error("could not turn %s:%s into multiaddr",r.address,r.port,s)}return e.map(s=>o!=null?s.encapsulate(`/p2p/${o}`):s)}async listen(e){if(this.status.started)throw Error("server is already listening");let r=e.getPeerId(),n=r==null?e.decapsulateCode(421):e,{backlog:o}=this.context;this.status={started:!0,listeningAddr:n,peerId:r,netConfig:Ee(n,{backlog:o})},await this.netListen()}async close(){await Promise.all(Array.from(this.connections.values()).map(async e=>{await qt(e)})),this.netClose()}async netListen(){if(!this.status.started||this.server.listening)return;let e=this.status.netConfig;await new Promise((r,n)=>{this.server.once("error",n),this.server.listen(e,r)}),D("Listening on %s",this.server.address())}netClose(){!this.status.started||!this.server.listening||(D("Closing server on %s",this.server.address()),this.server.close())}};var Q=Y("libp2p:tcp"),Gt=class{opts;metrics;components;constructor(e,r={}){this.opts=r,this.components=e,e.metrics!=null&&(this.metrics={dialerEvents:e.metrics.registerCounterGroup("libp2p_tcp_dialer_events_total",{label:"event",help:"Total count of TCP dialer events by type"})})}[Xt]=!0;[Symbol.toStringTag]="@libp2p/tcp";async dial(e,r){r.keepAlive=r.keepAlive??!0;let n=await this._connect(e,r);n.on("error",a=>{Q("socket error",a)});let o=Ge(n,{remoteAddr:e,socketInactivityTimeout:this.opts.outboundSocketInactivityTimeout,socketCloseTimeout:this.opts.socketCloseTimeout,metrics:this.metrics?.dialerEvents}),s=()=>{o.close().catch(a=>{Q.error("Error closing maConn after abort",a)})};r.signal?.addEventListener("abort",s,{once:!0}),Q("new outbound connection %s",o.remoteAddr);let i=await r.upgrader.upgradeOutbound(o);if(Q("outbound connection %s upgraded",o.remoteAddr),r.signal?.removeEventListener("abort",s),r.signal?.aborted===!0)throw i.close().catch(a=>{Q.error("Error closing conn after abort",a)}),new ae;return i}async _connect(e,r){if(r.signal?.aborted===!0)throw new ae;return new Promise((n,o)=>{let s=Date.now(),i=Ee(e),a=i.path??`${i.host??""}:${i.port}`;Q("dialing %j",i);let p=gn.default.connect(i),y=h=>{h.message=`connection error ${a}: ${h.message}`,this.metrics?.dialerEvents.increment({error:!0}),g(h)},l=()=>{Q("connection timeout %s",a),this.metrics?.dialerEvents.increment({timeout:!0});let h=new M(`connection timeout after ${Date.now()-s}ms`,"ERR_CONNECT_TIMEOUT");p.emit("error",h)},u=()=>{Q("connection opened %j",i),this.metrics?.dialerEvents.increment({connect:!0}),g()},f=()=>{Q("connection aborted %j",i),this.metrics?.dialerEvents.increment({abort:!0}),p.destroy(),g(new ae)},g=h=>{if(p.removeListener("error",y),p.removeListener("timeout",l),p.removeListener("connect",u),r.signal!=null&&r.signal.removeEventListener("abort",f),h!=null){o(h);return}n(p)};p.on("error",y),p.on("timeout",l),p.on("connect",u),r.signal!=null&&r.signal.addEventListener("abort",f)})}createListener(e){return new We({...e,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(e){return e=Array.isArray(e)?e:[e],e.filter(r=>r.protoCodes().includes(290)?!1:r.protoCodes().includes(400)?!0:te.matches(r.decapsulateCode(421)))}};function oi(t={}){return(e={})=>new Gt(e,t)}return vn(si);})();
|
|
7
7
|
return Libp2PTcp}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/tcp",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.3",
|
|
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,17 +50,17 @@
|
|
|
50
50
|
"test:electron-main": "aegir test -t electron-main"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@libp2p/interface": "^0.1.
|
|
54
|
-
"@libp2p/logger": "^3.0.
|
|
55
|
-
"@libp2p/utils": "^4.0.
|
|
53
|
+
"@libp2p/interface": "^0.1.2",
|
|
54
|
+
"@libp2p/logger": "^3.0.2",
|
|
55
|
+
"@libp2p/utils": "^4.0.2",
|
|
56
56
|
"@multiformats/mafmt": "^12.1.2",
|
|
57
|
-
"@multiformats/multiaddr": "^12.1.
|
|
57
|
+
"@multiformats/multiaddr": "^12.1.5",
|
|
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": "^4.0.
|
|
63
|
-
"aegir": "^40.0.
|
|
62
|
+
"@libp2p/interface-compliance-tests": "^4.0.3",
|
|
63
|
+
"aegir": "^40.0.8",
|
|
64
64
|
"it-all": "^3.0.1",
|
|
65
65
|
"it-pipe": "^3.0.1",
|
|
66
66
|
"p-defer": "^4.0.0",
|