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