@libp2p/tcp 8.0.1 → 8.0.2-e26848b0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.min.js +4 -4
- package/package.json +5 -5
- package/dist/typedoc-urls.json +0 -10
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 Ei=Object.create;var de=Object.defineProperty;var Ai=Object.getOwnPropertyDescriptor;var Ii=Object.getOwnPropertyNames;var Ri=Object.getPrototypeOf,Bi=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})},cn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ii(t))!Bi.call(e,i)&&i!==r&&de(e,i,{get:()=>t[i],enumerable:!(n=Ai(t,i))||n.enumerable});return e};var H=(e,t,r)=>(r=e!=null?Ei(Ri(e)):{},cn(t||!e||!e.__esModule?de(r,"default",{value:e,enumerable:!0}):r,e)),Mi=e=>cn(de({},"__esModule",{value:!0}),e);var pn=N((vu,ln)=>{var $t=1e3,Vt=$t*60,jt=Vt*60,Dt=jt*24,Di=Dt*7,ki=Dt*365.25;ln.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return Pi(e);if(r==="number"&&isFinite(e))return t.long?Ni(e):Oi(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Pi(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*ki;case"weeks":case"week":case"w":return r*Di;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 Oi(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 Ni(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 Ge=N((xu,hn)=>{function _i(e){r.debug=r,r.default=r,r.coerce=g,r.disable=c,r.enable=i,r.enabled=f,r.humanize=pn(),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 at=R[O];Z=W.call(E,at),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}hn.exports=_i});var dn=N((et,ge)=>{et.formatArgs=Li;et.save=Ui;et.load=$i;et.useColors=Fi;et.storage=Vi();et.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`."))}})();et.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Fi(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Li(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)}et.log=console.debug||console.log||(()=>{});function Ui(e){try{e?et.storage.setItem("debug",e):et.storage.removeItem("debug")}catch{}}function $i(){let e;try{e=et.storage.getItem("debug")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function Vi(){try{return localStorage}catch{}}ge.exports=Ge()(et);var{formatters:ji}=ge.exports;ji.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var gn=N((Su,mn)=>{"use strict";mn.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 wn=N((Tu,bn)=>{"use strict";var zi=bt("os"),lt=gn(),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 qi(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function Gi(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=zi.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 He(e){let t=Gi(e);return qi(t)}bn.exports={supportsColor:He,stdout:He(process.stdout),stderr:He(process.stderr)}});var vn=N((L,we)=>{var Hi=bt("tty"),be=bt("util");L.init=Ki;L.log=Ji;L.formatArgs=Wi;L.save=Yi;L.load=Qi;L.useColors=Zi;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=wn();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 Zi(){return"colors"in L.inspectOpts?!!L.inspectOpts.colors:Hi.isatty(process.stderr.fd)}function Wi(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
|
-
`+c),e.push(i+"m+"+we.exports.humanize(this.diff)+"\x1B[0m")}else e[0]=
|
|
5
|
-
`)}function
|
|
6
|
-
`).map(t=>t.trim()).join(" ")};vn.O=function(e){return this.inspectOpts.colors=this.useColors,be.inspect(e,this.inspectOpts)}});var Sn=N((Eu,We)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?We.exports=mn():We.exports=xn()});var Gn=N((Af,qn)=>{qn.exports=wr;var zn=128,uc=127,fc=~uc,lc=Math.pow(2,31);function wr(e,t,r){if(Number.MAX_SAFE_INTEGER&&e>Number.MAX_SAFE_INTEGER)throw wr.bytes=0,new RangeError("Could not encode varint");t=t||[],r=r||0;for(var n=r;e>=lc;)t[r++]=e&255|zn,e/=128;for(;e&fc;)t[r++]=e&255|zn,e>>>=7;return t[r]=e|0,wr.bytes=r-n+1,t}});var Wn=N((If,Zn)=>{Zn.exports=yr;var pc=128,Hn=127;function yr(e,n){var r=0,n=n||0,i=0,c=n,f,h=e.length;do{if(c>=h||i>49)throw yr.bytes=0,new RangeError("Could not decode varint");f=e[c++],r+=i<28?(f&Hn)<<i:(f&Hn)*Math.pow(2,i),i+=7}while(f>=pc);return yr.bytes=c-n,r}});var Jn=N((Rf,Xn)=>{var hc=Math.pow(2,7),dc=Math.pow(2,14),mc=Math.pow(2,21),gc=Math.pow(2,28),bc=Math.pow(2,35),wc=Math.pow(2,42),yc=Math.pow(2,49),vc=Math.pow(2,56),xc=Math.pow(2,63);Xn.exports=function(e){return e<hc?1:e<dc?2:e<mc?3:e<gc?4:e<bc?5:e<wc?6:e<yc?7:e<vc?8:e<xc?9:10}});var vr=N((Bf,Yn)=>{Yn.exports={encode:Gn(),decode:Wn(),encodingLength:Jn()}});var Lr=N((Pe,Ss)=>{(function(){var e,t=0xdeadbeefcafe,r=(t&16777215)==15715070;function n(s,o,a){s!=null&&(typeof s=="number"?this.fromNumber(s,o,a):o==null&&typeof s!="string"?this.fromString(s,256):this.fromString(s,o))}function i(){return new n(null)}function c(s,o,a,u,p,d){for(;--d>=0;){var b=o*this[s++]+a[u]+p;p=Math.floor(b/67108864),a[u++]=b&67108863}return p}function f(s,o,a,u,p,d){for(var b=o&32767,v=o>>15;--d>=0;){var M=this[s]&32767,F=this[s++]>>15,st=v*M+F*b;M=b*M+((st&32767)<<15)+a[u]+(p&1073741823),p=(M>>>30)+(st>>>15)+v*F+(p>>>30),a[u++]=M&1073741823}return p}function h(s,o,a,u,p,d){for(var b=o&16383,v=o>>14;--d>=0;){var M=this[s]&16383,F=this[s++]>>14,st=v*M+F*b;M=b*M+((st&16383)<<14)+a[u]+p,p=(M>>28)+(st>>14)+v*F,a[u++]=M&268435455}return p}var g=typeof navigator<"u";g&&r&&navigator.appName=="Microsoft Internet Explorer"?(n.prototype.am=f,e=30):g&&r&&navigator.appName!="Netscape"?(n.prototype.am=c,e=26):(n.prototype.am=h,e=28),n.prototype.DB=e,n.prototype.DM=(1<<e)-1,n.prototype.DV=1<<e;var C=52;n.prototype.FV=Math.pow(2,C),n.prototype.F1=C-e,n.prototype.F2=2*e-C;var l="0123456789abcdefghijklmnopqrstuvwxyz",y=new Array,x,S;for(x="0".charCodeAt(0),S=0;S<=9;++S)y[x++]=S;for(x="a".charCodeAt(0),S=10;S<36;++S)y[x++]=S;for(x="A".charCodeAt(0),S=10;S<36;++S)y[x++]=S;function m(s){return l.charAt(s)}function A(s,o){var a=y[s.charCodeAt(o)];return a??-1}function R(s){for(var o=this.t-1;o>=0;--o)s[o]=this[o];s.t=this.t,s.s=this.s}function E(s){this.t=1,this.s=s<0?-1:0,s>0?this[0]=s:s<-1?this[0]=s+this.DV:this.t=0}function I(s){var o=i();return o.fromInt(s),o}function k(s,o){var a;if(o==16)a=4;else if(o==8)a=3;else if(o==256)a=8;else if(o==2)a=1;else if(o==32)a=5;else if(o==4)a=2;else{this.fromRadix(s,o);return}this.t=0,this.s=0;for(var u=s.length,p=!1,d=0;--u>=0;){var b=a==8?s[u]&255:A(s,u);if(b<0){s.charAt(u)=="-"&&(p=!0);continue}p=!1,d==0?this[this.t++]=b:d+a>this.DB?(this[this.t-1]|=(b&(1<<this.DB-d)-1)<<d,this[this.t++]=b>>this.DB-d):this[this.t-1]|=b<<d,d+=a,d>=this.DB&&(d-=this.DB)}a==8&&s[0]&128&&(this.s=-1,d>0&&(this[this.t-1]|=(1<<this.DB-d)-1<<d)),this.clamp(),p&&n.ZERO.subTo(this,this)}function O(){for(var s=this.s&this.DM;this.t>0&&this[this.t-1]==s;)--this.t}function J(s){if(this.s<0)return"-"+this.negate().toString(s);var o;if(s==16)o=4;else if(s==8)o=3;else if(s==2)o=1;else if(s==32)o=5;else if(s==4)o=2;else return this.toRadix(s);var a=(1<<o)-1,u,p=!1,d="",b=this.t,v=this.DB-b*this.DB%o;if(b-- >0)for(v<this.DB&&(u=this[b]>>v)>0&&(p=!0,d=m(u));b>=0;)v<o?(u=(this[b]&(1<<v)-1)<<o-v,u|=this[--b]>>(v+=this.DB-o)):(u=this[b]>>(v-=o)&a,v<=0&&(v+=this.DB,--b)),u>0&&(p=!0),p&&(d+=m(u));return p?d:"0"}function Z(){var s=i();return n.ZERO.subTo(this,s),s}function q(){return this.s<0?this.negate():this}function W(s){var o=this.s-s.s;if(o!=0)return o;var a=this.t;if(o=a-s.t,o!=0)return this.s<0?-o:o;for(;--a>=0;)if((o=this[a]-s[a])!=0)return o;return 0}function it(s){var o=1,a;return(a=s>>>16)!=0&&(s=a,o+=16),(a=s>>8)!=0&&(s=a,o+=8),(a=s>>4)!=0&&(s=a,o+=4),(a=s>>2)!=0&&(s=a,o+=2),(a=s>>1)!=0&&(s=a,o+=1),o}function Gs(){return this.t<=0?0:this.DB*(this.t-1)+it(this[this.t-1]^this.s&this.DM)}function Hs(s,o){var a;for(a=this.t-1;a>=0;--a)o[a+s]=this[a];for(a=s-1;a>=0;--a)o[a]=0;o.t=this.t+s,o.s=this.s}function Zs(s,o){for(var a=s;a<this.t;++a)o[a-s]=this[a];o.t=Math.max(this.t-s,0),o.s=this.s}function Ws(s,o){var a=s%this.DB,u=this.DB-a,p=(1<<u)-1,d=Math.floor(s/this.DB),b=this.s<<a&this.DM,v;for(v=this.t-1;v>=0;--v)o[v+d+1]=this[v]>>u|b,b=(this[v]&p)<<a;for(v=d-1;v>=0;--v)o[v]=0;o[d]=b,o.t=this.t+d+1,o.s=this.s,o.clamp()}function Xs(s,o){o.s=this.s;var a=Math.floor(s/this.DB);if(a>=this.t){o.t=0;return}var u=s%this.DB,p=this.DB-u,d=(1<<u)-1;o[0]=this[a]>>u;for(var b=a+1;b<this.t;++b)o[b-a-1]|=(this[b]&d)<<p,o[b-a]=this[b]>>u;u>0&&(o[this.t-a-1]|=(this.s&d)<<p),o.t=this.t-a,o.clamp()}function Js(s,o){for(var a=0,u=0,p=Math.min(s.t,this.t);a<p;)u+=this[a]-s[a],o[a++]=u&this.DM,u>>=this.DB;if(s.t<this.t){for(u-=s.s;a<this.t;)u+=this[a],o[a++]=u&this.DM,u>>=this.DB;u+=this.s}else{for(u+=this.s;a<s.t;)u-=s[a],o[a++]=u&this.DM,u>>=this.DB;u-=s.s}o.s=u<0?-1:0,u<-1?o[a++]=this.DV+u:u>0&&(o[a++]=u),o.t=a,o.clamp()}function Ys(s,o){var a=this.abs(),u=s.abs(),p=a.t;for(o.t=p+u.t;--p>=0;)o[p]=0;for(p=0;p<u.t;++p)o[p+a.t]=a.am(0,u[p],o,p,0,a.t);o.s=0,o.clamp(),this.s!=s.s&&n.ZERO.subTo(o,o)}function Qs(s){for(var o=this.abs(),a=s.t=2*o.t;--a>=0;)s[a]=0;for(a=0;a<o.t-1;++a){var u=o.am(a,o[a],s,2*a,0,1);(s[a+o.t]+=o.am(a+1,2*o[a],s,2*a+1,u,o.t-a-1))>=o.DV&&(s[a+o.t]-=o.DV,s[a+o.t+1]=1)}s.t>0&&(s[s.t-1]+=o.am(a,o[a],s,2*a,0,1)),s.s=0,s.clamp()}function Ks(s,o,a){var u=s.abs();if(!(u.t<=0)){var p=this.abs();if(p.t<u.t){o?.fromInt(0),a!=null&&this.copyTo(a);return}a==null&&(a=i());var d=i(),b=this.s,v=s.s,M=this.DB-it(u[u.t-1]);M>0?(u.lShiftTo(M,d),p.lShiftTo(M,a)):(u.copyTo(d),p.copyTo(a));var F=d.t,st=d[F-1];if(st!=0){var Q=st*(1<<this.F1)+(F>1?d[F-2]>>this.F2:0),gt=this.FV/Q,pe=(1<<this.F1)/Q,ct=1<<this.F2,ut=a.t,he=ut-F,xt=o??i();for(d.dlShiftTo(he,xt),a.compareTo(xt)>=0&&(a[a.t++]=1,a.subTo(xt,a)),n.ONE.dlShiftTo(F,xt),xt.subTo(d,d);d.t<F;)d[d.t++]=0;for(;--he>=0;){var Ge=a[--ut]==st?this.DM:Math.floor(a[ut]*gt+(a[ut-1]+ct)*pe);if((a[ut]+=d.am(0,Ge,a,he,0,F))<Ge)for(d.dlShiftTo(he,xt),a.subTo(xt,a);a[ut]<--Ge;)a.subTo(xt,a)}o!=null&&(a.drShiftTo(F,o),b!=v&&n.ZERO.subTo(o,o)),a.t=F,a.clamp(),M>0&&a.rShiftTo(M,a),b<0&&n.ZERO.subTo(a,a)}}}function to(s){var o=i();return this.abs().divRemTo(s,null,o),this.s<0&&o.compareTo(n.ZERO)>0&&s.subTo(o,o),o}function Rt(s){this.m=s}function eo(s){return s.s<0||s.compareTo(this.m)>=0?s.mod(this.m):s}function ro(s){return s}function no(s){s.divRemTo(this.m,null,s)}function so(s,o,a){s.multiplyTo(o,a),this.reduce(a)}function oo(s,o){s.squareTo(o),this.reduce(o)}Rt.prototype.convert=eo,Rt.prototype.revert=ro,Rt.prototype.reduce=no,Rt.prototype.mulTo=so,Rt.prototype.sqrTo=oo;function io(){if(this.t<1)return 0;var s=this[0];if(!(s&1))return 0;var o=s&3;return o=o*(2-(s&15)*o)&15,o=o*(2-(s&255)*o)&255,o=o*(2-((s&65535)*o&65535))&65535,o=o*(2-s*o%this.DV)%this.DV,o>0?this.DV-o:-o}function Bt(s){this.m=s,this.mp=s.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<s.DB-15)-1,this.mt2=2*s.t}function ao(s){var o=i();return s.abs().dlShiftTo(this.m.t,o),o.divRemTo(this.m,null,o),s.s<0&&o.compareTo(n.ZERO)>0&&this.m.subTo(o,o),o}function co(s){var o=i();return s.copyTo(o),this.reduce(o),o}function uo(s){for(;s.t<=this.mt2;)s[s.t++]=0;for(var o=0;o<this.m.t;++o){var a=s[o]&32767,u=a*this.mpl+((a*this.mph+(s[o]>>15)*this.mpl&this.um)<<15)&s.DM;for(a=o+this.m.t,s[a]+=this.m.am(0,u,s,o,0,this.m.t);s[a]>=s.DV;)s[a]-=s.DV,s[++a]++}s.clamp(),s.drShiftTo(this.m.t,s),s.compareTo(this.m)>=0&&s.subTo(this.m,s)}function fo(s,o){s.squareTo(o),this.reduce(o)}function lo(s,o,a){s.multiplyTo(o,a),this.reduce(a)}Bt.prototype.convert=ao,Bt.prototype.revert=co,Bt.prototype.reduce=uo,Bt.prototype.mulTo=lo,Bt.prototype.sqrTo=fo;function po(){return(this.t>0?this[0]&1:this.s)==0}function ho(s,o){if(s>4294967295||s<1)return n.ONE;var a=i(),u=i(),p=o.convert(this),d=it(s)-1;for(p.copyTo(a);--d>=0;)if(o.sqrTo(a,u),(s&1<<d)>0)o.mulTo(u,p,a);else{var b=a;a=u,u=b}return o.revert(a)}function mo(s,o){var a;return s<256||o.isEven()?a=new Rt(o):a=new Bt(o),this.exp(s,a)}n.prototype.copyTo=R,n.prototype.fromInt=E,n.prototype.fromString=k,n.prototype.clamp=O,n.prototype.dlShiftTo=Hs,n.prototype.drShiftTo=Zs,n.prototype.lShiftTo=Ws,n.prototype.rShiftTo=Xs,n.prototype.subTo=Js,n.prototype.multiplyTo=Ys,n.prototype.squareTo=Qs,n.prototype.divRemTo=Ks,n.prototype.invDigit=io,n.prototype.isEven=po,n.prototype.exp=ho,n.prototype.toString=J,n.prototype.negate=Z,n.prototype.abs=q,n.prototype.compareTo=W,n.prototype.bitLength=Gs,n.prototype.mod=to,n.prototype.modPowInt=mo,n.ZERO=I(0),n.ONE=I(1);function go(){var s=i();return this.copyTo(s),s}function bo(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function wo(){return this.t==0?this.s:this[0]<<24>>24}function yo(){return this.t==0?this.s:this[0]<<16>>16}function vo(s){return Math.floor(Math.LN2*this.DB/Math.log(s))}function xo(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function So(s){if(s==null&&(s=10),this.signum()==0||s<2||s>36)return"0";var o=this.chunkSize(s),a=Math.pow(s,o),u=I(a),p=i(),d=i(),b="";for(this.divRemTo(u,p,d);p.signum()>0;)b=(a+d.intValue()).toString(s).substr(1)+b,p.divRemTo(u,p,d);return d.intValue().toString(s)+b}function To(s,o){this.fromInt(0),o==null&&(o=10);for(var a=this.chunkSize(o),u=Math.pow(o,a),p=!1,d=0,b=0,v=0;v<s.length;++v){var M=A(s,v);if(M<0){s.charAt(v)=="-"&&this.signum()==0&&(p=!0);continue}b=o*b+M,++d>=a&&(this.dMultiply(u),this.dAddOffset(b,0),d=0,b=0)}d>0&&(this.dMultiply(Math.pow(o,d)),this.dAddOffset(b,0)),p&&n.ZERO.subTo(this,this)}function Co(s,o,a){if(typeof o=="number")if(s<2)this.fromInt(1);else for(this.fromNumber(s,a),this.testBit(s-1)||this.bitwiseTo(n.ONE.shiftLeft(s-1),Ve,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(o);)this.dAddOffset(2,0),this.bitLength()>s&&this.subTo(n.ONE.shiftLeft(s-1),this);else{var u=new Array,p=s&7;u.length=(s>>3)+1,o.nextBytes(u),p>0?u[0]&=(1<<p)-1:u[0]=0,this.fromString(u,256)}}function Eo(){var s=this.t,o=new Array;o[0]=this.s;var a=this.DB-s*this.DB%8,u,p=0;if(s-- >0)for(a<this.DB&&(u=this[s]>>a)!=(this.s&this.DM)>>a&&(o[p++]=u|this.s<<this.DB-a);s>=0;)a<8?(u=(this[s]&(1<<a)-1)<<8-a,u|=this[--s]>>(a+=this.DB-8)):(u=this[s]>>(a-=8)&255,a<=0&&(a+=this.DB,--s)),u&128&&(u|=-256),p==0&&(this.s&128)!=(u&128)&&++p,(p>0||u!=this.s)&&(o[p++]=u);return o}function Ao(s){return this.compareTo(s)==0}function Io(s){return this.compareTo(s)<0?this:s}function Ro(s){return this.compareTo(s)>0?this:s}function Bo(s,o,a){var u,p,d=Math.min(s.t,this.t);for(u=0;u<d;++u)a[u]=o(this[u],s[u]);if(s.t<this.t){for(p=s.s&this.DM,u=d;u<this.t;++u)a[u]=o(this[u],p);a.t=this.t}else{for(p=this.s&this.DM,u=d;u<s.t;++u)a[u]=o(p,s[u]);a.t=s.t}a.s=o(this.s,s.s),a.clamp()}function Mo(s,o){return s&o}function Do(s){var o=i();return this.bitwiseTo(s,Mo,o),o}function Ve(s,o){return s|o}function ko(s){var o=i();return this.bitwiseTo(s,Ve,o),o}function rn(s,o){return s^o}function Po(s){var o=i();return this.bitwiseTo(s,rn,o),o}function nn(s,o){return s&~o}function Oo(s){var o=i();return this.bitwiseTo(s,nn,o),o}function No(){for(var s=i(),o=0;o<this.t;++o)s[o]=this.DM&~this[o];return s.t=this.t,s.s=~this.s,s}function _o(s){var o=i();return s<0?this.rShiftTo(-s,o):this.lShiftTo(s,o),o}function Fo(s){var o=i();return s<0?this.lShiftTo(-s,o):this.rShiftTo(s,o),o}function Lo(s){if(s==0)return-1;var o=0;return s&65535||(s>>=16,o+=16),s&255||(s>>=8,o+=8),s&15||(s>>=4,o+=4),s&3||(s>>=2,o+=2),s&1||++o,o}function Uo(){for(var s=0;s<this.t;++s)if(this[s]!=0)return s*this.DB+Lo(this[s]);return this.s<0?this.t*this.DB:-1}function $o(s){for(var o=0;s!=0;)s&=s-1,++o;return o}function Vo(){for(var s=0,o=this.s&this.DM,a=0;a<this.t;++a)s+=$o(this[a]^o);return s}function jo(s){var o=Math.floor(s/this.DB);return o>=this.t?this.s!=0:(this[o]&1<<s%this.DB)!=0}function zo(s,o){var a=n.ONE.shiftLeft(s);return this.bitwiseTo(a,o,a),a}function qo(s){return this.changeBit(s,Ve)}function Go(s){return this.changeBit(s,nn)}function Ho(s){return this.changeBit(s,rn)}function Zo(s,o){for(var a=0,u=0,p=Math.min(s.t,this.t);a<p;)u+=this[a]+s[a],o[a++]=u&this.DM,u>>=this.DB;if(s.t<this.t){for(u+=s.s;a<this.t;)u+=this[a],o[a++]=u&this.DM,u>>=this.DB;u+=this.s}else{for(u+=this.s;a<s.t;)u+=s[a],o[a++]=u&this.DM,u>>=this.DB;u+=s.s}o.s=u<0?-1:0,u>0?o[a++]=u:u<-1&&(o[a++]=this.DV+u),o.t=a,o.clamp()}function Wo(s){var o=i();return this.addTo(s,o),o}function Xo(s){var o=i();return this.subTo(s,o),o}function Jo(s){var o=i();return this.multiplyTo(s,o),o}function Yo(){var s=i();return this.squareTo(s),s}function Qo(s){var o=i();return this.divRemTo(s,o,null),o}function Ko(s){var o=i();return this.divRemTo(s,null,o),o}function ti(s){var o=i(),a=i();return this.divRemTo(s,o,a),new Array(o,a)}function ei(s){this[this.t]=this.am(0,s-1,this,0,0,this.t),++this.t,this.clamp()}function ri(s,o){if(s!=0){for(;this.t<=o;)this[this.t++]=0;for(this[o]+=s;this[o]>=this.DV;)this[o]-=this.DV,++o>=this.t&&(this[this.t++]=0),++this[o]}}function se(){}function sn(s){return s}function ni(s,o,a){s.multiplyTo(o,a)}function si(s,o){s.squareTo(o)}se.prototype.convert=sn,se.prototype.revert=sn,se.prototype.mulTo=ni,se.prototype.sqrTo=si;function oi(s){return this.exp(s,new se)}function ii(s,o,a){var u=Math.min(this.t+s.t,o);for(a.s=0,a.t=u;u>0;)a[--u]=0;var p;for(p=a.t-this.t;u<p;++u)a[u+this.t]=this.am(0,s[u],a,u,0,this.t);for(p=Math.min(s.t,o);u<p;++u)this.am(0,s[u],a,u,0,o-u);a.clamp()}function ai(s,o,a){--o;var u=a.t=this.t+s.t-o;for(a.s=0;--u>=0;)a[u]=0;for(u=Math.max(o-this.t,0);u<s.t;++u)a[this.t+u-o]=this.am(o-u,s[u],a,0,0,this.t+u-o);a.clamp(),a.drShiftTo(1,a)}function Mt(s){this.r2=i(),this.q3=i(),n.ONE.dlShiftTo(2*s.t,this.r2),this.mu=this.r2.divide(s),this.m=s}function ci(s){if(s.s<0||s.t>2*this.m.t)return s.mod(this.m);if(s.compareTo(this.m)<0)return s;var o=i();return s.copyTo(o),this.reduce(o),o}function ui(s){return s}function fi(s){for(s.drShiftTo(this.m.t-1,this.r2),s.t>this.m.t+1&&(s.t=this.m.t+1,s.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);s.compareTo(this.r2)<0;)s.dAddOffset(1,this.m.t+1);for(s.subTo(this.r2,s);s.compareTo(this.m)>=0;)s.subTo(this.m,s)}function li(s,o){s.squareTo(o),this.reduce(o)}function pi(s,o,a){s.multiplyTo(o,a),this.reduce(a)}Mt.prototype.convert=ci,Mt.prototype.revert=ui,Mt.prototype.reduce=fi,Mt.prototype.mulTo=pi,Mt.prototype.sqrTo=li;function hi(s,o){var a=s.bitLength(),u,p=I(1),d;if(a<=0)return p;a<18?u=1:a<48?u=3:a<144?u=4:a<768?u=5:u=6,a<8?d=new Rt(o):o.isEven()?d=new Mt(o):d=new Bt(o);var b=new Array,v=3,M=u-1,F=(1<<u)-1;if(b[1]=d.convert(this),u>1){var st=i();for(d.sqrTo(b[1],st);v<=F;)b[v]=i(),d.mulTo(st,b[v-2],b[v]),v+=2}var Q=s.t-1,gt,pe=!0,ct=i(),ut;for(a=it(s[Q])-1;Q>=0;){for(a>=M?gt=s[Q]>>a-M&F:(gt=(s[Q]&(1<<a+1)-1)<<M-a,Q>0&&(gt|=s[Q-1]>>this.DB+a-M)),v=u;!(gt&1);)gt>>=1,--v;if((a-=v)<0&&(a+=this.DB,--Q),pe)b[gt].copyTo(p),pe=!1;else{for(;v>1;)d.sqrTo(p,ct),d.sqrTo(ct,p),v-=2;v>0?d.sqrTo(p,ct):(ut=p,p=ct,ct=ut),d.mulTo(ct,b[gt],p)}for(;Q>=0&&!(s[Q]&1<<a);)d.sqrTo(p,ct),ut=p,p=ct,ct=ut,--a<0&&(a=this.DB-1,--Q)}return d.revert(p)}function di(s){var o=this.s<0?this.negate():this.clone(),a=s.s<0?s.negate():s.clone();if(o.compareTo(a)<0){var u=o;o=a,a=u}var p=o.getLowestSetBit(),d=a.getLowestSetBit();if(d<0)return o;for(p<d&&(d=p),d>0&&(o.rShiftTo(d,o),a.rShiftTo(d,a));o.signum()>0;)(p=o.getLowestSetBit())>0&&o.rShiftTo(p,o),(p=a.getLowestSetBit())>0&&a.rShiftTo(p,a),o.compareTo(a)>=0?(o.subTo(a,o),o.rShiftTo(1,o)):(a.subTo(o,a),a.rShiftTo(1,a));return d>0&&a.lShiftTo(d,a),a}function mi(s){if(s<=0)return 0;var o=this.DV%s,a=this.s<0?s-1:0;if(this.t>0)if(o==0)a=this[0]%s;else for(var u=this.t-1;u>=0;--u)a=(o*a+this[u])%s;return a}function gi(s){var o=s.isEven();if(this.isEven()&&o||s.signum()==0)return n.ZERO;for(var a=s.clone(),u=this.clone(),p=I(1),d=I(0),b=I(0),v=I(1);a.signum()!=0;){for(;a.isEven();)a.rShiftTo(1,a),o?((!p.isEven()||!d.isEven())&&(p.addTo(this,p),d.subTo(s,d)),p.rShiftTo(1,p)):d.isEven()||d.subTo(s,d),d.rShiftTo(1,d);for(;u.isEven();)u.rShiftTo(1,u),o?((!b.isEven()||!v.isEven())&&(b.addTo(this,b),v.subTo(s,v)),b.rShiftTo(1,b)):v.isEven()||v.subTo(s,v),v.rShiftTo(1,v);a.compareTo(u)>=0?(a.subTo(u,a),o&&p.subTo(b,p),d.subTo(v,d)):(u.subTo(a,u),o&&b.subTo(p,b),v.subTo(d,v))}if(u.compareTo(n.ONE)!=0)return n.ZERO;if(v.compareTo(s)>=0)return v.subtract(s);if(v.signum()<0)v.addTo(s,v);else return v;return v.signum()<0?v.add(s):v}var G=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],bi=(1<<26)/G[G.length-1];function wi(s){var o,a=this.abs();if(a.t==1&&a[0]<=G[G.length-1]){for(o=0;o<G.length;++o)if(a[0]==G[o])return!0;return!1}if(a.isEven())return!1;for(o=1;o<G.length;){for(var u=G[o],p=o+1;p<G.length&&u<bi;)u*=G[p++];for(u=a.modInt(u);o<p;)if(u%G[o++]==0)return!1}return a.millerRabin(s)}function yi(s){var o=this.subtract(n.ONE),a=o.getLowestSetBit();if(a<=0)return!1;var u=o.shiftRight(a);s=s+1>>1,s>G.length&&(s=G.length);for(var p=i(),d=0;d<s;++d){p.fromInt(G[Math.floor(Math.random()*G.length)]);var b=p.modPow(u,this);if(b.compareTo(n.ONE)!=0&&b.compareTo(o)!=0){for(var v=1;v++<a&&b.compareTo(o)!=0;)if(b=b.modPowInt(2,this),b.compareTo(n.ONE)==0)return!1;if(b.compareTo(o)!=0)return!1}}return!0}n.prototype.chunkSize=vo,n.prototype.toRadix=So,n.prototype.fromRadix=To,n.prototype.fromNumber=Co,n.prototype.bitwiseTo=Bo,n.prototype.changeBit=zo,n.prototype.addTo=Zo,n.prototype.dMultiply=ei,n.prototype.dAddOffset=ri,n.prototype.multiplyLowerTo=ii,n.prototype.multiplyUpperTo=ai,n.prototype.modInt=mi,n.prototype.millerRabin=yi,n.prototype.clone=go,n.prototype.intValue=bo,n.prototype.byteValue=wo,n.prototype.shortValue=yo,n.prototype.signum=xo,n.prototype.toByteArray=Eo,n.prototype.equals=Ao,n.prototype.min=Io,n.prototype.max=Ro,n.prototype.and=Do,n.prototype.or=ko,n.prototype.xor=Po,n.prototype.andNot=Oo,n.prototype.not=No,n.prototype.shiftLeft=_o,n.prototype.shiftRight=Fo,n.prototype.getLowestSetBit=Uo,n.prototype.bitCount=Vo,n.prototype.testBit=jo,n.prototype.setBit=qo,n.prototype.clearBit=Go,n.prototype.flipBit=Ho,n.prototype.add=Wo,n.prototype.subtract=Xo,n.prototype.multiply=Jo,n.prototype.divide=Qo,n.prototype.remainder=Ko,n.prototype.divideAndRemainder=ti,n.prototype.modPow=hi,n.prototype.modInverse=gi,n.prototype.pow=oi,n.prototype.gcd=di,n.prototype.isProbablePrime=wi,n.prototype.square=Yo,n.prototype.Barrett=Mt;var le,Y,_;function vi(s){Y[_++]^=s&255,Y[_++]^=s>>8&255,Y[_++]^=s>>16&255,Y[_++]^=s>>24&255,_>=qe&&(_-=qe)}function on(){vi(new Date().getTime())}if(Y==null){Y=new Array,_=0;var at;if(typeof window<"u"&&window.crypto){if(window.crypto.getRandomValues){var an=new Uint8Array(32);for(window.crypto.getRandomValues(an),at=0;at<32;++at)Y[_++]=an[at]}else if(navigator.appName=="Netscape"&&navigator.appVersion<"5"){var cn=window.crypto.random(32);for(at=0;at<cn.length;++at)Y[_++]=cn.charCodeAt(at)&255}}for(;_<qe;)at=Math.floor(65536*Math.random()),Y[_++]=at>>>8,Y[_++]=at&255;_=0,on()}function xi(){if(le==null){for(on(),le=Ei(),le.init(Y),_=0;_<Y.length;++_)Y[_]=0;_=0}return le.next()}function Si(s){var o;for(o=0;o<s.length;++o)s[o]=xi()}function je(){}je.prototype.nextBytes=Si;function ze(){this.i=0,this.j=0,this.S=new Array}function Ti(s){var o,a,u;for(o=0;o<256;++o)this.S[o]=o;for(a=0,o=0;o<256;++o)a=a+this.S[o]+s[o%s.length]&255,u=this.S[o],this.S[o]=this.S[a],this.S[a]=u;this.i=0,this.j=0}function Ci(){var s;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,s=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=s,this.S[s+this.S[this.i]&255]}ze.prototype.init=Ti,ze.prototype.next=Ci;function Ei(){return new ze}var qe=256;typeof Pe<"u"?Pe=Ss.exports={default:n,BigInteger:n,SecureRandom:je}:this.jsbn={BigInteger:n,SecureRandom:je}}).call(Pe)});var ue=N(Oe=>{(function(){"use strict";var e={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function t(f){return n(c(f),arguments)}function r(f,h){return t.apply(null,[f].concat(h||[]))}function n(f,h){var g=1,C=f.length,l,y="",x,S,m,A,R,E,I,k;for(x=0;x<C;x++)if(typeof f[x]=="string")y+=f[x];else if(typeof f[x]=="object"){if(m=f[x],m.keys)for(l=h[g],S=0;S<m.keys.length;S++){if(l==null)throw new Error(t('[sprintf] Cannot access property "%s" of undefined value "%s"',m.keys[S],m.keys[S-1]));l=l[m.keys[S]]}else m.param_no?l=h[m.param_no]:l=h[g++];if(e.not_type.test(m.type)&&e.not_primitive.test(m.type)&&l instanceof Function&&(l=l()),e.numeric_arg.test(m.type)&&typeof l!="number"&&isNaN(l))throw new TypeError(t("[sprintf] expecting number but found %T",l));switch(e.number.test(m.type)&&(I=l>=0),m.type){case"b":l=parseInt(l,10).toString(2);break;case"c":l=String.fromCharCode(parseInt(l,10));break;case"d":case"i":l=parseInt(l,10);break;case"j":l=JSON.stringify(l,null,m.width?parseInt(m.width):0);break;case"e":l=m.precision?parseFloat(l).toExponential(m.precision):parseFloat(l).toExponential();break;case"f":l=m.precision?parseFloat(l).toFixed(m.precision):parseFloat(l);break;case"g":l=m.precision?String(Number(l.toPrecision(m.precision))):parseFloat(l);break;case"o":l=(parseInt(l,10)>>>0).toString(8);break;case"s":l=String(l),l=m.precision?l.substring(0,m.precision):l;break;case"t":l=String(!!l),l=m.precision?l.substring(0,m.precision):l;break;case"T":l=Object.prototype.toString.call(l).slice(8,-1).toLowerCase(),l=m.precision?l.substring(0,m.precision):l;break;case"u":l=parseInt(l,10)>>>0;break;case"v":l=l.valueOf(),l=m.precision?l.substring(0,m.precision):l;break;case"x":l=(parseInt(l,10)>>>0).toString(16);break;case"X":l=(parseInt(l,10)>>>0).toString(16).toUpperCase();break}e.json.test(m.type)?y+=l:(e.number.test(m.type)&&(!I||m.sign)?(k=I?"+":"-",l=l.toString().replace(e.sign,"")):k="",R=m.pad_char?m.pad_char==="0"?"0":m.pad_char.charAt(1):" ",E=m.width-(k+l).length,A=m.width&&E>0?R.repeat(E):"",y+=m.align?k+l+A:R==="0"?k+A+l:A+k+l)}return y}var i=Object.create(null);function c(f){if(i[f])return i[f];for(var h=f,g,C=[],l=0;h;){if((g=e.text.exec(h))!==null)C.push(g[0]);else if((g=e.modulo.exec(h))!==null)C.push("%");else if((g=e.placeholder.exec(h))!==null){if(g[2]){l|=1;var y=[],x=g[2],S=[];if((S=e.key.exec(x))!==null)for(y.push(S[1]);(x=x.substring(S[0].length))!=="";)if((S=e.key_access.exec(x))!==null)y.push(S[1]);else if((S=e.index_access.exec(x))!==null)y.push(S[1]);else throw new SyntaxError("[sprintf] failed to parse named argument key");else throw new SyntaxError("[sprintf] failed to parse named argument key");g[2]=y}else l|=2;if(l===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");C.push({placeholder:g[0],param_no:g[1],keys:g[2],sign:g[3],pad_char:g[4],align:g[5],width:g[6],precision:g[7],type:g[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");h=h.substring(g[0].length)}return i[f]=C}typeof Oe<"u"&&(Oe.sprintf=t,Oe.vsprintf=r),typeof window<"u"&&(window.sprintf=t,window.vsprintf=r,typeof define=="function"&&define.amd&&define(function(){return{sprintf:t,vsprintf:r}}))})()});var Le=N((Sp,Ps)=>{Ps.exports=e=>{if(e[Symbol.asyncIterator])return e;if(e.getReader)return async function*(){let t=e.getReader();try{for(;;){let{done:r,value:n}=await t.read();if(r)return;yield n}}finally{t.releaseLock()}}();throw new Error("unknown stream")}});var Ns=N((Tp,Os)=>{Os.exports=function(t){if(t){if(typeof t[Symbol.iterator]=="function")return t[Symbol.iterator]();if(typeof t[Symbol.asyncIterator]=="function")return t[Symbol.asyncIterator]();if(typeof t.next=="function")return t}throw new Error("argument is not an iterator or iterable")}});var Xr=N((Cp,_s)=>{var ru=Ns();_s.exports=e=>async t=>{t=ru(t);let r=E=>{typeof E.return=="function"&&E.return()},n=null,i=null,c=E=>{n=E,i&&i(E),r(t)},f=null,h=!1,g=()=>{h=!0,f&&f()},C=null,l=!1,y=()=>{l=!0,C&&C()},x=null,S=()=>{x&&x()},m=()=>new Promise((E,I)=>{f=x=E,i=I,e.once("drain",S)}),A=()=>(r(t),new Promise((E,I)=>{if(h||l||n)return E();C=f=E,i=I})),R=()=>{e.removeListener("error",c),e.removeListener("close",g),e.removeListener("finish",y),e.removeListener("drain",S)};e.once("error",c),e.once("close",g),e.once("finish",y);try{for await(let E of t){if(!e.writable||e.destroyed||n)break;e.write(E)===!1&&await m()}}catch(E){n||e.destroy(),n=E}try{if(e.writable&&e.end(),await A(),n)throw n}finally{R()}}});var Jr=N((Ep,Fs)=>{var nu=Xr(),su=Le();Fs.exports=e=>({sink:nu(e),source:su(e)})});var Us=N((Ap,Ls)=>{var ou=Jr();Ls.exports=e=>async function*(t){let r=ou(e),n;if(r.sink(t).catch(i=>{n=i}),yield*r.source,n)throw n}});var $s=N((Ip,re)=>{re.exports=Le();re.exports.source=Le();re.exports.sink=Xr();re.exports.transform=Us();re.exports.duplex=Jr()});var bu={};K(bu,{tcp:()=>gu});var qs=H(bt("net"),1);var Ut=class e extends Error{code;type;constructor(t="The operation was aborted"){super(t),this.code=e.code,this.type=e.type}static code="ABORT_ERR";static type="aborted"},ft=class extends Error{code;props;constructor(t,r,n){super(t),this.code=r,this.name=n?.name??"CodeError",this.props=n??{}}};var ln=Symbol.for("@libp2p/transport");var fn;(function(e){e[e.FATAL_ALL=0]="FATAL_ALL",e[e.NO_FATAL=1]="NO_FATAL"})(fn||(fn={}));var et=H(Sn(),1);var Ke={};K(Ke,{base32:()=>pt,base32hex:()=>ua,base32hexpad:()=>la,base32hexpadupper:()=>pa,base32hexupper:()=>fa,base32pad:()=>aa,base32padupper:()=>ca,base32upper:()=>ia,base32z:()=>ha});function ea(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var c=e.charAt(i),f=c.charCodeAt(0);if(r[f]!==255)throw new TypeError(c+" is ambiguous");r[f]=i}var h=e.length,g=e.charAt(0),C=Math.log(h)/Math.log(256),l=Math.log(256)/Math.log(h);function y(m){if(m instanceof Uint8Array||(ArrayBuffer.isView(m)?m=new Uint8Array(m.buffer,m.byteOffset,m.byteLength):Array.isArray(m)&&(m=Uint8Array.from(m))),!(m instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(m.length===0)return"";for(var A=0,R=0,E=0,I=m.length;E!==I&&m[E]===0;)E++,A++;for(var k=(I-E)*l+1>>>0,O=new Uint8Array(k);E!==I;){for(var J=m[E],Z=0,q=k-1;(J!==0||Z<R)&&q!==-1;q--,Z++)J+=256*O[q]>>>0,O[q]=J%h>>>0,J=J/h>>>0;if(J!==0)throw new Error("Non-zero carry");R=Z,E++}for(var W=k-R;W!==k&&O[W]===0;)W++;for(var it=g.repeat(A);W<k;++W)it+=e.charAt(O[W]);return it}function x(m){if(typeof m!="string")throw new TypeError("Expected String");if(m.length===0)return new Uint8Array;var A=0;if(m[A]!==" "){for(var R=0,E=0;m[A]===g;)R++,A++;for(var I=(m.length-A)*C+1>>>0,k=new Uint8Array(I);m[A];){var O=r[m.charCodeAt(A)];if(O===255)return;for(var J=0,Z=I-1;(O!==0||J<E)&&Z!==-1;Z--,J++)O+=h*k[Z]>>>0,k[Z]=O%256>>>0,O=O/256>>>0;if(O!==0)throw new Error("Non-zero carry");E=J,A++}if(m[A]!==" "){for(var q=I-E;q!==I&&k[q]===0;)q++;for(var W=new Uint8Array(R+(I-q)),it=R;q!==I;)W[it++]=k[q++];return W}}}function S(m){var A=x(m);if(A)return A;throw new Error(`Non-${t} character`)}return{encode:y,decodeUnsafe:x,decode:S}}var ra=ea,na=ra,Tn=na;var Iu=new Uint8Array(0);var Cn=(e,t)=>{if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0},ot=e=>{if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")};var En=e=>new TextEncoder().encode(e),An=e=>new TextDecoder().decode(e);var Xe=class{constructor(t,r,n){this.name=t,this.prefix=r,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},Je=class{constructor(t,r,n){if(this.name=t,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return Rn(this,t)}},Ye=class{constructor(t){this.decoders=t}or(t){return Rn(this,t)}decode(t){let r=t[0],n=this.decoders[r];if(n)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},Rn=(e,t)=>new Ye({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}}),Qe=class{constructor(t,r,n,i){this.name=t,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Xe(t,r,n),this.decoder=new Je(t,r,i)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}},qt=({name:e,prefix:t,encode:r,decode:n})=>new Qe(e,t,r,n),St=({prefix:e,name:t,alphabet:r})=>{let{encode:n,decode:i}=Tn(r,t);return qt({prefix:e,name:t,encode:n,decode:c=>ot(i(c))})},sa=(e,t,r,n)=>{let i={};for(let l=0;l<t.length;++l)i[t[l]]=l;let c=e.length;for(;e[c-1]==="=";)--c;let f=new Uint8Array(c*r/8|0),h=0,g=0,C=0;for(let l=0;l<c;++l){let y=i[e[l]];if(y===void 0)throw new SyntaxError(`Non-${n} character`);g=g<<r|y,h+=r,h>=8&&(h-=8,f[C++]=255&g>>h)}if(h>=r||255&g<<8-h)throw new SyntaxError("Unexpected end of data");return f},oa=(e,t,r)=>{let n=t[t.length-1]==="=",i=(1<<r)-1,c="",f=0,h=0;for(let g=0;g<e.length;++g)for(h=h<<8|e[g],f+=8;f>r;)f-=r,c+=t[i&h>>f];if(f&&(c+=t[i&h<<r-f]),n)for(;c.length*r&7;)c+="=";return c},D=({name:e,prefix:t,bitsPerChar:r,alphabet:n})=>qt({prefix:t,name:e,encode(i){return oa(i,n,r)},decode(i){return sa(i,n,r,e)}});var pt=D({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ia=D({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),aa=D({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ca=D({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ua=D({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),fa=D({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),la=D({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),pa=D({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),ha=D({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var tr={};K(tr,{base58btc:()=>$,base58flickr:()=>da});var $=St({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),da=St({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var rr={};K(rr,{base64:()=>er,base64pad:()=>ma,base64url:()=>ga,base64urlpad:()=>ba});var er=D({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),ma=D({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),ga=D({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ba=D({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});et.default.formatters.b=e=>e==null?"undefined":$.baseEncode(e);et.default.formatters.t=e=>e==null?"undefined":pt.baseEncode(e);et.default.formatters.m=e=>e==null?"undefined":er.baseEncode(e);et.default.formatters.p=e=>e==null?"undefined":e.toString();et.default.formatters.c=e=>e==null?"undefined":e.toString();et.default.formatters.k=e=>e==null?"undefined":e.toString();et.default.formatters.a=e=>e==null?"undefined":e.toString();function wa(e){let t=()=>{};return t.enabled=!1,t.color="",t.diff=0,t.log=()=>{},t.namespace=e,t.destroy=()=>!0,t.extend=()=>t,t}function Tt(e){let t=wa(`${e}:trace`);return et.default.enabled(`${e}:trace`)&&et.default.names.map(r=>r.toString()).find(r=>r.includes(":trace"))!=null&&(t=(0,et.default)(`${e}:trace`)),Object.assign((0,et.default)(e),{error:(0,et.default)(`${e}:error`),trace:t})}var ye=class extends Error{code;props;constructor(t,r,n){super(t),this.code=r,this.name=n?.name??"CodeError",this.props=n??{}}};var ya=Dn,Bn=128,va=127,xa=~va,Sa=Math.pow(2,31);function Dn(e,t,r){t=t||[],r=r||0;for(var n=r;e>=Sa;)t[r++]=e&255|Bn,e/=128;for(;e&xa;)t[r++]=e&255|Bn,e>>>=7;return t[r]=e|0,Dn.bytes=r-n+1,t}var Ta=nr,Ca=128,Mn=127;function nr(e,n){var r=0,n=n||0,i=0,c=n,f,h=e.length;do{if(c>=h)throw nr.bytes=0,new RangeError("Could not decode varint");f=e[c++],r+=i<28?(f&Mn)<<i:(f&Mn)*Math.pow(2,i),i+=7}while(f>=Ca);return nr.bytes=c-n,r}var Ea=Math.pow(2,7),Aa=Math.pow(2,14),Ia=Math.pow(2,21),Ra=Math.pow(2,28),Ba=Math.pow(2,35),Ma=Math.pow(2,42),Da=Math.pow(2,49),ka=Math.pow(2,56),Pa=Math.pow(2,63),Oa=function(e){return e<Ea?1:e<Aa?2:e<Ia?3:e<Ra?4:e<Ba?5:e<Ma?6:e<Da?7:e<ka?8:e<Pa?9:10},Na={encode:ya,decode:Ta,encodingLength:Oa},_a=Na,oe=_a;var ie=(e,t=0)=>[oe.decode(e,t),oe.decode.bytes],Gt=(e,t,r=0)=>(oe.encode(e,t,r),t),Ht=e=>oe.encodingLength(e);var kt=(e,t)=>{let r=t.byteLength,n=Ht(e),i=n+Ht(r),c=new Uint8Array(i+r);return Gt(e,c,0),Gt(r,c,n),c.set(t,i),new Zt(e,r,t,c)},xe=e=>{let t=ot(e),[r,n]=ie(t),[i,c]=ie(t.subarray(n)),f=t.subarray(n+c);if(f.byteLength!==i)throw new Error("Incorrect length");return new Zt(r,i,f,t)},kn=(e,t)=>{if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&Cn(e.bytes,r.bytes)}},Zt=class{constructor(t,r,n,i){this.code=t,this.size=r,this.digest=n,this.bytes=i}};var Pn=(e,t)=>{let{bytes:r,version:n}=e;switch(n){case 0:return La(r,sr(e),t||$.encoder);default:return Ua(r,sr(e),t||pt.encoder)}};var On=new WeakMap,sr=e=>{let t=On.get(e);if(t==null){let r=new Map;return On.set(e,r),r}return t},Ct=class e{constructor(t,r,n,i){this.code=r,this.version=t,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:r}=this;if(t!==ae)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==$a)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return e.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:r}=this.multihash,n=kt(t,r);return e.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return e.equals(this,t)}static equals(t,r){let n=r;return n&&t.code===n.code&&t.version===n.version&&kn(t.multihash,n.multihash)}toString(t){return Pn(this,t)}toJSON(){return{"/":Pn(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let r=t;if(r instanceof e)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:c,bytes:f}=r;return new e(n,i,c,f||Nn(n,i,c.bytes))}else if(r[Va]===!0){let{version:n,multihash:i,code:c}=r,f=xe(i);return e.create(n,c,f)}else return null}static create(t,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(r!==ae)throw new Error(`Version 0 CID must use dag-pb (code: ${ae}) block encoding`);return new e(t,r,n,n.bytes)}case 1:{let i=Nn(t,r,n.bytes);return new e(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return e.create(0,ae,t)}static createV1(t,r){return e.create(1,t,r)}static decode(t){let[r,n]=e.decodeFirst(t);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=e.inspectBytes(t),n=r.size-r.multihashSize,i=ot(t.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let c=i.subarray(r.multihashSize-r.digestSize),f=new Zt(r.multihashCode,r.digestSize,c,i);return[r.version===0?e.createV0(f):e.createV1(r.codec,f),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[y,x]=ie(t.subarray(r));return r+=x,y},i=n(),c=ae;if(i===18?(i=0,r=0):c=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let f=r,h=n(),g=n(),C=r+g,l=C-f;return{version:i,codec:c,multihashCode:h,digestSize:g,multihashSize:l,size:C}}static parse(t,r){let[n,i]=Fa(t,r),c=e.decode(i);if(c.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return sr(c).set(n,t),c}},Fa=(e,t)=>{switch(e[0]){case"Q":{let r=t||$;return[$.prefix,r.decode(`${$.prefix}${e}`)]}case $.prefix:{let r=t||$;return[$.prefix,r.decode(e)]}case pt.prefix:{let r=t||pt;return[pt.prefix,r.decode(e)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}},La=(e,t,r)=>{let{prefix:n}=r;if(n!==$.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=t.get(n);if(i==null){let c=r.encode(e).slice(1);return t.set(n,c),c}else return i},Ua=(e,t,r)=>{let{prefix:n}=r,i=t.get(n);if(i==null){let c=r.encode(e);return t.set(n,c),c}else return i},ae=112,$a=18,Nn=(e,t,r)=>{let n=Ht(e),i=n+Ht(t),c=new Uint8Array(i+r.byteLength);return Gt(e,c,0),Gt(t,c,n),c.set(r,i),c},Va=Symbol.for("@ipld/js-cid/CID");function _n(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}var or={};K(or,{identity:()=>ja});var ja=qt({prefix:"\0",name:"identity",encode:e=>An(e),decode:e=>En(e)});var ir={};K(ir,{base2:()=>za});var za=D({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var ar={};K(ar,{base8:()=>qa});var qa=D({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var cr={};K(cr,{base10:()=>Ga});var Ga=St({prefix:"9",name:"base10",alphabet:"0123456789"});var ur={};K(ur,{base16:()=>Ha,base16upper:()=>Za});var Ha=D({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Za=D({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var fr={};K(fr,{base36:()=>Wa,base36upper:()=>Xa});var Wa=St({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Xa=St({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var lr={};K(lr,{base256emoji:()=>tc});var Fn=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Ja=Fn.reduce((e,t,r)=>(e[r]=t,e),[]),Ya=Fn.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]);function Qa(e){return e.reduce((t,r)=>(t+=Ja[r],t),"")}function Ka(e){let t=[];for(let r of e){let n=Ya[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);t.push(n)}return new Uint8Array(t)}var tc=qt({prefix:"\u{1F680}",name:"base256emoji",encode:Qa,decode:Ka});var mr={};K(mr,{sha256:()=>ec,sha512:()=>rc});var dr=H(bt("crypto"),1);var hr=({name:e,code:t,encode:r})=>new pr(e,t,r),pr=class{constructor(t,r,n){this.name=t,this.code=r,this.encode=n}digest(t){if(t instanceof Uint8Array){let r=this.encode(t);return r instanceof Uint8Array?kt(this.code,r):r.then(n=>kt(this.code,n))}else throw Error("Unknown type, must be binary type")}};var ec=hr({name:"sha2-256",code:18,encode:e=>ot(dr.default.createHash("sha256").update(e).digest())}),rc=hr({name:"sha2-512",code:19,encode:e=>ot(dr.default.createHash("sha512").update(e).digest())});var gr={};K(gr,{identity:()=>oc});var Un=0,nc="identity",$n=ot,sc=e=>kt(Un,$n(e)),oc={code:Un,name:nc,encode:$n,digest:sc};var af=new TextEncoder,cf=new TextDecoder;var ce={...or,...ir,...ar,...cr,...ur,...Ke,...fr,...tr,...rr,...lr},hf={...mr,...gr};function Xt(e){return globalThis.Buffer!=null?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function Se(e=0){return globalThis.Buffer?.allocUnsafe!=null?Xt(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}function jn(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}var Vn=jn("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),br=jn("ascii","a",e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},e=>{e=e.substring(1);let t=Se(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),cc={utf8:Vn,"utf-8":Vn,hex:ce.base16,latin1:br,ascii:br,binary:br,...ce},Te=cc;function X(e,t="utf8"){let r=Te[t];if(r==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8"):r.encoder.encode(e).substring(1)}function wt(e,t){t==null&&(t=e.reduce((i,c)=>i+c.length,0));let r=Se(t),n=0;for(let i of e)r.set(i,n),n+=i.length;return Xt(r)}var Yt=H(vr(),1);var Ce=class{index=0;input="";new(t){return this.index=0,this.input=t,this}readAtomically(t){let r=this.index,n=t();return n===void 0&&(this.index=r),n}parseWith(t){let r=t();if(this.index===this.input.length)return r}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(t){return this.readAtomically(()=>{let r=this.readChar();if(r===t)return r})}readSeparator(t,r,n){return this.readAtomically(()=>{if(!(r>0&&this.readGivenChar(t)===void 0))return n()})}readNumber(t,r,n,i){return this.readAtomically(()=>{let c=0,f=0,h=this.peekChar();if(h===void 0)return;let g=h==="0",C=2**(8*i)-1;for(;;){let l=this.readAtomically(()=>{let y=this.readChar();if(y===void 0)return;let x=Number.parseInt(y,t);if(!Number.isNaN(x))return x});if(l===void 0)break;if(c*=t,c+=l,c>C||(f+=1,r!==void 0&&f>r))return}if(f!==0)return!n&&g&&f>1?void 0:c})}readIPv4Addr(){return this.readAtomically(()=>{let t=new Uint8Array(4);for(let r=0;r<t.length;r++){let n=this.readSeparator(".",r,()=>this.readNumber(10,3,!1,1));if(n===void 0)return;t[r]=n}return t})}readIPv6Addr(){let t=r=>{for(let n=0;n<r.length/2;n++){let i=n*2;if(n<r.length-3){let f=this.readSeparator(":",n,()=>this.readIPv4Addr());if(f!==void 0)return r[i]=f[0],r[i+1]=f[1],r[i+2]=f[2],r[i+3]=f[3],[i+4,!0]}let c=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(c===void 0)return[i,!1];r[i]=c>>8,r[i+1]=c&255}return[r.length,!1]};return this.readAtomically(()=>{let r=new Uint8Array(16),[n,i]=t(r);if(n===16)return r;if(i||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let c=new Uint8Array(14),f=16-(n+2),[h]=t(c.subarray(0,f));return r.set(c.subarray(0,h),16-h),r})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var kf=new Ce;var $f=parseInt("0xFFFF",16),Vf=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);function xr(e,t="utf8"){let r=Te[t];if(r==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Xt(globalThis.Buffer.from(e,"utf-8")):r.decoder.decode(`${r.prefix}${e}`)}var ht=H(vr(),1);var Et=bt("node:net");function Ee(e){return!!(0,Et.isIP)(e)}var ts=Et.isIPv4,Ic=Et.isIPv6,Sr=function(e){let t=0;if(e=e.toString().trim(),ts(e)){let r=new Uint8Array(t+4);return e.split(/\./g).forEach(n=>{r[t++]=parseInt(n,10)&255}),r}if(Ic(e)){let r=e.split(":",8),n;for(n=0;n<r.length;n++){let c=ts(r[n]),f;c&&(f=Sr(r[n]),r[n]=X(f.slice(0,2),"base16")),f!=null&&++n<8&&r.splice(n,0,X(f.slice(2,4),"base16"))}if(r[0]==="")for(;r.length<8;)r.unshift("0");else if(r[r.length-1]==="")for(;r.length<8;)r.push("0");else if(r.length<8){for(n=0;n<r.length&&r[n]!=="";n++);let c=[n,1];for(n=9-r.length;n>0;n--)c.push("0");r.splice.apply(r,c)}let i=new Uint8Array(t+16);for(n=0;n<r.length;n++){let c=parseInt(r[n],16);i[t++]=c>>8&255,i[t++]=c&255}return i}throw new Error("invalid ip address")},es=function(e,t=0,r){t=~~t,r=r??e.length-t;let n=new DataView(e.buffer);if(r===4){let i=[];for(let c=0;c<r;c++)i.push(e[t+c]);return i.join(".")}if(r===16){let i=[];for(let c=0;c<r;c+=2)i.push(n.getUint16(t+c).toString(16));return i.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var Jt={},Tr={},Bc=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,-1,"ip6zone"],[43,8,"ipcidr"],[53,-1,"dns",!0],[54,-1,"dns4",!0],[55,-1,"dns6",!0],[56,-1,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc-direct"],[281,0,"webrtc"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,-1,"unix",!1,!0],[421,-1,"ipfs"],[421,-1,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,-1,"garlic64"],[448,0,"tls"],[449,-1,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,-1,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,-1,"memory"]];Bc.forEach(e=>{let t=Mc(...e);Tr[t.code]=t,Jt[t.name]=t});function Mc(e,t,r,n,i){return{code:e,size:t,name:r,resolvable:!!n,path:!!i}}function B(e){if(typeof e=="number"){if(Tr[e]!=null)return Tr[e];throw new Error(`no protocol with code: ${e}`)}else if(typeof e=="string"){if(Jt[e]!=null)return Jt[e];throw new Error(`no protocol with name: ${e}`)}throw new Error(`invalid protocol id type: ${typeof e}`)}var Rl=B("ip4"),Bl=B("ip6"),Ml=B("ipcidr");function Er(e,t){switch(B(e).code){case 4:case 41:return kc(t);case 42:return ss(t);case 6:case 273:case 33:case 132:return is(t).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return ss(t);case 421:return _c(t);case 444:return os(t);case 445:return os(t);case 466:return Nc(t);default:return X(t,"base16")}}function Ar(e,t){switch(B(e).code){case 4:return rs(t);case 41:return rs(t);case 42:return ns(t);case 6:case 273:case 33:case 132:return Ir(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return ns(t);case 421:return Pc(t);case 444:return Fc(t);case 445:return Lc(t);case 466:return Oc(t);default:return xr(t,"base16")}}var Cr=Object.values(ce).map(e=>e.decoder),Dc=function(){let e=Cr[0].or(Cr[1]);return Cr.slice(2).forEach(t=>e=e.or(t)),e}();function rs(e){if(!Ee(e))throw new Error("invalid ip address");return Sr(e)}function kc(e){let t=es(e,0,e.length);if(t==null)throw new Error("ipBuff is required");if(!Ee(t))throw new Error("invalid ip address");return t}function Ir(e){let t=new ArrayBuffer(2);return new DataView(t).setUint16(0,e),new Uint8Array(t)}function is(e){return new DataView(e.buffer).getUint16(e.byteOffset)}function ns(e){let t=xr(e),r=Uint8Array.from(ht.default.encode(t.length));return wt([r,t],r.length+t.length)}function ss(e){let t=ht.default.decode(e);if(e=e.slice(ht.default.decode.bytes),e.length!==t)throw new Error("inconsistent lengths");return X(e)}function Pc(e){let t;e[0]==="Q"||e[0]==="1"?t=xe($.decode(`z${e}`)).bytes:t=Ct.parse(e).multihash.bytes;let r=Uint8Array.from(ht.default.encode(t.length));return wt([r,t],r.length+t.length)}function Oc(e){let t=Dc.decode(e),r=Uint8Array.from(ht.default.encode(t.length));return wt([r,t],r.length+t.length)}function Nc(e){let t=ht.default.decode(e),r=e.slice(ht.default.decode.bytes);if(r.length!==t)throw new Error("inconsistent lengths");return"u"+X(r,"base64url")}function _c(e){let t=ht.default.decode(e),r=e.slice(ht.default.decode.bytes);if(r.length!==t)throw new Error("inconsistent lengths");return X(r,"base58btc")}function Fc(e){let t=e.split(":");if(t.length!==2)throw new Error(`failed to parse onion addr: ["'${t.join('", "')}'"]' does not contain a port number`);if(t[0].length!==16)throw new Error(`failed to parse onion addr: ${t[0]} not a Tor onion address.`);let r=pt.decode("b"+t[0]),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let i=Ir(n);return wt([r,i],r.length+i.length)}function Lc(e){let t=e.split(":");if(t.length!==2)throw new Error(`failed to parse onion addr: ["'${t.join('", "')}'"]' does not contain a port number`);if(t[0].length!==56)throw new Error(`failed to parse onion addr: ${t[0]} not a Tor onion3 address.`);let r=pt.decode(`b${t[0]}`),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let i=Ir(n);return wt([r,i],r.length+i.length)}function os(e){let t=e.slice(0,e.length-2),r=e.slice(e.length-2),n=X(t,"base32"),i=is(r);return`${n}:${i}`}function as(e){e=Rr(e);let t=[],r=[],n=null,i=e.split("/").slice(1);if(i.length===1&&i[0]==="")return{bytes:new Uint8Array,string:"/",tuples:[],stringTuples:[],path:null};for(let c=0;c<i.length;c++){let f=i[c],h=B(f);if(h.size===0){t.push([h.code]),r.push([h.code]);continue}if(c++,c>=i.length)throw us("invalid address: "+e);if(h.path===!0){n=Rr(i.slice(c).join("/")),t.push([h.code,Ar(h.code,n)]),r.push([h.code,n]);break}let g=Ar(h.code,i[c]);t.push([h.code,g]),r.push([h.code,Er(h.code,g)])}return{string:cs(r),bytes:Mr(t),tuples:t,stringTuples:r,path:n}}function Br(e){let t=[],r=[],n=null,i=0;for(;i<e.length;){let c=Yt.default.decode(e,i),f=Yt.default.decode.bytes??0,h=B(c),g=Uc(h,e.slice(i+f));if(g===0){t.push([c]),r.push([c]),i+=f;continue}let C=e.slice(i+f,i+f+g);if(i+=g+f,i>e.length)throw us("Invalid address Uint8Array: "+X(e,"base16"));t.push([c,C]);let l=Er(c,C);if(r.push([c,l]),h.path===!0){n=l;break}}return{bytes:Uint8Array.from(e),string:cs(r),tuples:t,stringTuples:r,path:n}}function cs(e){let t=[];return e.map(r=>{let n=B(r[0]);return t.push(n.name),r.length>1&&r[1]!=null&&t.push(r[1]),null}),Rr(t.join("/"))}function Mr(e){return wt(e.map(t=>{let r=B(t[0]),n=Uint8Array.from(Yt.default.encode(r.code));return t.length>1&&t[1]!=null&&(n=wt([n,t[1]])),n}))}function Uc(e,t){return e.size>0?e.size/8:e.size===0?0:Yt.default.decode(t)+(Yt.default.decode.bytes??0)}function Rr(e){return"/"+e.trim().split("/").filter(t=>t).join("/")}function us(e){return new Error("Error parsing address: "+e)}var $c=Symbol.for("nodejs.util.inspect.custom"),Vc=[B("dns").code,B("dns4").code,B("dns6").code,B("dnsaddr").code],jc=new Map,fs=Symbol.for("@multiformats/js-multiaddr/multiaddr");function zc(e){return!!e?.[fs]}var Dr=class e{bytes;#t;#e;#r;#n;[fs]=!0;constructor(t){t==null&&(t="");let r;if(t instanceof Uint8Array)r=Br(t);else if(typeof t=="string"){if(t.length>0&&t.charAt(0)!=="/")throw new Error(`multiaddr "${t}" must start with a "/"`);r=as(t)}else if(zc(t))r=Br(t.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=r.bytes,this.#t=r.string,this.#e=r.tuples,this.#r=r.stringTuples,this.#n=r.path}toString(){return this.#t}toJSON(){return this.toString()}toOptions(){let t,r,n,i,c="",f=B("tcp"),h=B("udp"),g=B("ip4"),C=B("ip6"),l=B("dns6"),y=B("ip6zone");for(let[S,m]of this.stringTuples())S===y.code&&(c=`%${m??""}`),Vc.includes(S)&&(r=f.name,i=443,n=`${m??""}${c}`,t=S===l.code?6:4),(S===f.code||S===h.code)&&(r=B(S).name,i=parseInt(m??"")),(S===g.code||S===C.code)&&(r=B(S).name,n=`${m??""}${c}`,t=S===C.code?6:4);if(t==null||r==null||n==null||i==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:t,host:n,transport:r,port:i}}protos(){return this.#e.map(([t])=>Object.assign({},B(t)))}protoCodes(){return this.#e.map(([t])=>t)}protoNames(){return this.#e.map(([t])=>B(t).name)}tuples(){return this.#e}stringTuples(){return this.#r}encapsulate(t){return t=new e(t),new e(this.toString()+t.toString())}decapsulate(t){let r=t.toString(),n=this.toString(),i=n.lastIndexOf(r);if(i<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${t.toString()}`);return new e(n.slice(0,i))}decapsulateCode(t){let r=this.tuples();for(let n=r.length-1;n>=0;n--)if(r[n][0]===t)return new e(Mr(r.slice(0,n)));return this}getPeerId(){try{let t=[];this.stringTuples().forEach(([n,i])=>{n===Jt.p2p.code&&t.push([n,i]),n===Jt["p2p-circuit"].code&&(t=[])});let r=t.pop();if(r?.[1]!=null){let n=r[1];return n[0]==="Q"||n[0]==="1"?X($.decode(`z${n}`),"base58btc"):X(Ct.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return this.#n}equals(t){return _n(this.bytes,t.bytes)}async resolve(t){let r=this.protos().find(c=>c.resolvable);if(r==null)return[this];let n=jc.get(r.name);if(n==null)throw new ye(`no available resolver for ${r.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,t)).map(c=>new e(c))}nodeAddress(){let t=this.toOptions();if(t.transport!=="tcp"&&t.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${t.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:t.family,address:t.host,port:t.port}}isThinWaistAddress(t){let r=(t??this).protos();return!(r.length!==2||r[0].code!==4&&r[0].code!==41||r[1].code!==6&&r[1].code!==273)}[$c](){return`Multiaddr(${this.#t})`}};function dt(e){return new Dr(e)}var qc=w("dns4"),Gc=w("dns6"),Hc=w("dnsaddr"),Ot=P(w("dns"),Hc,qc,Gc),Re=P(w("ip4"),w("ip6")),It=P(T(Re,w("tcp")),T(Ot,w("tcp"))),Be=T(Re,w("udp")),Zc=T(Be,w("utp")),Wc=T(Be,w("quic")),Xc=T(Be,w("quic-v1")),kr=P(T(It,w("ws")),T(Ot,w("ws"))),Ae=P(T(kr,w("p2p")),kr),Pr=P(T(It,w("wss")),T(Ot,w("wss")),T(It,w("tls"),w("ws")),T(Ot,w("tls"),w("ws"))),Ie=P(T(Pr,w("p2p")),Pr),Or=P(T(It,w("http")),T(Re,w("http")),T(Ot,w("http"))),Nr=P(T(It,w("https")),T(Re,w("https")),T(Ot,w("https"))),ls=T(Be,w("webrtc-direct"),w("certhash")),ds=P(T(ls,w("p2p")),ls),ps=T(Xc,w("webtransport"),w("certhash"),w("certhash")),ms=P(T(ps,w("p2p")),ps),gs=P(T(Ae,w("p2p-webrtc-star"),w("p2p")),T(Ie,w("p2p-webrtc-star"),w("p2p")),T(Ae,w("p2p-webrtc-star")),T(Ie,w("p2p-webrtc-star"))),Ql=P(T(Ae,w("p2p-websocket-star"),w("p2p")),T(Ie,w("p2p-websocket-star"),w("p2p")),T(Ae,w("p2p-websocket-star")),T(Ie,w("p2p-websocket-star"))),bs=P(T(Or,w("p2p-webrtc-direct"),w("p2p")),T(Nr,w("p2p-webrtc-direct"),w("p2p")),T(Or,w("p2p-webrtc-direct")),T(Nr,w("p2p-webrtc-direct"))),Nt=P(kr,Pr,Or,Nr,gs,bs,It,Zc,Wc,Ot,ds,ms),Kl=P(T(Nt,w("p2p-stardust"),w("p2p")),T(Nt,w("p2p-stardust"))),At=P(T(Nt,w("p2p")),gs,bs,ds,ms,w("p2p")),hs=P(T(At,w("p2p-circuit"),At),T(At,w("p2p-circuit")),T(w("p2p-circuit"),At),T(Nt,w("p2p-circuit")),T(w("p2p-circuit"),Nt),w("p2p-circuit")),ws=()=>P(T(hs,ws),hs),Pt=ws(),tp=P(T(Pt,At,Pt),T(At,Pt),T(Pt,At),Pt,At);var ep=P(T(Pt,w("webrtc"),w("p2p")),T(Pt,w("webrtc")),T(Nt,w("webrtc"),w("p2p")),T(Nt,w("webrtc")),w("webrtc"));function ys(e){function t(r){let n;try{n=dt(r)}catch{return!1}let i=e(n.protoNames());return i===null?!1:i===!0||i===!1?i:i.length===0}return t}function T(...e){function t(r){if(r.length<e.length)return null;let n=r;return e.some(i=>(n=typeof i=="function"?i().partialMatch(r):i.partialMatch(r),Array.isArray(n)&&(r=n),n===null)),n}return{toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:ys(t),partialMatch:t}}function P(...e){function t(n){let i=null;return e.some(c=>{let f=typeof c=="function"?c().partialMatch(n):c.partialMatch(n);return f!=null?(i=f,!0):!1}),i}return{toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:ys(t),partialMatch:t}}function w(e){let t=e;function r(i){let c;try{c=dt(i)}catch{return!1}let f=c.protoNames();return f.length===1&&f[0]===t}function n(i){return i.length===0?null:i[0]===t?i.slice(1):null}return{toString:function(){return t},matches:r,partialMatch:n}}var zs=H(bt("net"),1);var Me=class extends EventTarget{#t=new Map;listenerCount(t){let r=this.#t.get(t);return r==null?0:r.length}addEventListener(t,r,n){super.addEventListener(t,r,n);let i=this.#t.get(t);i==null&&(i=[],this.#t.set(t,i)),i.push({callback:r,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(t,r,n){super.removeEventListener(t.toString(),r??null,n);let i=this.#t.get(t);i!=null&&(i=i.filter(({callback:c})=>c!==r),this.#t.set(t,i))}dispatchEvent(t){let r=super.dispatchEvent(t),n=this.#t.get(t.type);return n==null||(n=n.filter(({once:i})=>!i),this.#t.set(t.type,n)),r}safeDispatchEvent(t,r){return this.dispatchEvent(new Qt(t,r))}},_r=class extends Event{detail;constructor(t,r){super(t,r),this.detail=r?.detail}},Qt=globalThis.CustomEvent??_r;function De(e){return this.subnetMask<e.subnetMask?!1:this.mask(e.subnetMask)===e.mask()}function ke(e){return function(){return this.addressMinusSuffix!==this.correctForm()?!1:this.subnetMask===e&&!this.parsedSubnet?!0:this.parsedSubnet===String(this.subnetMask)}}var Kt=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g,Fr=/\/\d{1,2}$/;var V=class extends Error{constructor(t,r){super(t),this.name="AddressError",r!==null&&(this.parseMessage=r)}};var te=H(Lr(),1),_t=H(ue(),1),rt=class e{constructor(t){this.groups=4,this.parsedAddress=[],this.parsedSubnet="",this.subnet="/32",this.subnetMask=32,this.v4=!0,this.isCorrect=ke(32),this.isInSubnet=De,this.address=t;let r=Fr.exec(t);if(r){if(this.parsedSubnet=r[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,this.subnetMask<0||this.subnetMask>32)throw new V("Invalid subnet mask.");t=t.replace(Fr,"")}this.addressMinusSuffix=t,this.parsedAddress=this.parse(t)}static isValid(t){try{return new e(t),!0}catch{return!1}}parse(t){let r=t.split(".");if(!t.match(Kt))throw new V("Invalid IPv4 address.");return r}correctForm(){return this.parsedAddress.map(t=>parseInt(t,10)).join(".")}static fromHex(t){let r=t.replace(/:/g,"").padStart(8,"0"),n=[],i;for(i=0;i<8;i+=2){let c=r.slice(i,i+2);n.push(parseInt(c,16))}return new e(n.join("."))}static fromInteger(t){return e.fromHex(t.toString(16))}static fromArpa(t){let n=t.replace(/(\.in-addr\.arpa)?\.$/,"").split(".").reverse().join(".");return new e(n)}toHex(){return this.parsedAddress.map(t=>(0,_t.sprintf)("%02x",parseInt(t,10))).join(":")}toArray(){return this.parsedAddress.map(t=>parseInt(t,10))}toGroup6(){let t=[],r;for(r=0;r<4;r+=2){let n=(0,_t.sprintf)("%02x%02x",parseInt(this.parsedAddress[r],10),parseInt(this.parsedAddress[r+1],10));t.push((0,_t.sprintf)("%x",parseInt(n,16)))}return t.join(":")}bigInteger(){return new te.BigInteger(this.parsedAddress.map(t=>(0,_t.sprintf)("%02x",parseInt(t,10))).join(""),16)}_startAddress(){return new te.BigInteger(this.mask()+"0".repeat(32-this.subnetMask),2)}startAddress(){return e.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new te.BigInteger("1");return e.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new te.BigInteger(this.mask()+"1".repeat(32-this.subnetMask),2)}endAddress(){return e.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new te.BigInteger("1");return e.fromBigInteger(this._endAddress().subtract(t))}static fromBigInteger(t){return e.fromInteger(parseInt(t.toString(),10))}mask(t){return t===void 0&&(t=this.subnetMask),this.getBitsBase2(0,t)}getBitsBase2(t,r){return this.binaryZeroPad().slice(t,r)}reverseForm(t){t||(t={});let r=this.correctForm().split(".").reverse().join(".");return t.omitSuffix?r:(0,_t.sprintf)("%s.in-addr.arpa.",r)}isMulticast(){return this.isInSubnet(new e("224.0.0.0/4"))}binaryZeroPad(){return this.bigInteger().toString(2).padStart(32,"0")}groupForV6(){let t=this.parsedAddress;return this.address.replace(Kt,(0,_t.sprintf)('<span class="hover-group group-v4 group-6">%s</span>.<span class="hover-group group-v4 group-7">%s</span>',t.slice(0,2).join("."),t.slice(2,4).join(".")))}};var Cs={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"},Ur={"ff01::1/128":"Multicast (All nodes on this interface)","ff01::2/128":"Multicast (All routers on this interface)","ff02::1/128":"Multicast (All nodes on this link)","ff02::2/128":"Multicast (All routers on this link)","ff05::2/128":"Multicast (All routers in this site)","ff02::5/128":"Multicast (OSPFv3 AllSPF routers)","ff02::6/128":"Multicast (OSPFv3 AllDR routers)","ff02::9/128":"Multicast (RIP routers)","ff02::a/128":"Multicast (EIGRP routers)","ff02::d/128":"Multicast (PIM routers)","ff02::16/128":"Multicast (MLDv2 reports)","ff01::fb/128":"Multicast (mDNSv6)","ff02::fb/128":"Multicast (mDNSv6)","ff05::fb/128":"Multicast (mDNSv6)","ff02::1:2/128":"Multicast (All DHCP servers and relay agents on this link)","ff05::1:2/128":"Multicast (All DHCP servers and relay agents in this site)","ff02::1:3/128":"Multicast (All DHCP servers on this link)","ff05::1:3/128":"Multicast (All DHCP servers in this site)","::/128":"Unspecified","::1/128":"Loopback","ff00::/8":"Multicast","fe80::/10":"Link-local unicast"},$r=/([^0-9a-f:/%])/gi,Vr=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi,jr=/\/\d{1,3}(?=%|$)/,zr=/%.*$/,Es=new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/),As=new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/);var Rs=H(ue(),1);function Yc(e){return e.replace(/^(0+)/,'<span class="zero">$1</span>')}function Ne(e,t=0){return e.split(":").map((n,i)=>/group-v4/.test(n)?n:(0,Rs.sprintf)('<span class="hover-group group-%d">%s</span>',i+t,Yc(n)))}var Lt=H(ue(),1);function Gr(e){return(0,Lt.sprintf)("(%s)",e.join("|"))}function qr(e){return e.length<4?(0,Lt.sprintf)("0{0,%d}%s",4-e.length,e):e}var Hr="[^A-Fa-f0-9:]";function _e(e){let t=[];e.forEach((n,i)=>{parseInt(n,16)===0&&t.push(i)});let r=t.map(n=>e.map((i,c)=>{if(c===n){let f=c===0||c===8-1?":":"";return Gr([qr(i),f])}return qr(i)}).join(":"));return r.push(e.map(qr).join(":")),Gr(r)}function Zr(e,t,r){let n=t?"":":",i=r?"":":",c=[];!t&&!r&&c.push("::"),t&&r&&c.push(""),(r&&!t||!r&&t)&&c.push(":"),c.push((0,Lt.sprintf)("%s(:0{1,4}){1,%d}",n,e-1)),c.push((0,Lt.sprintf)("(0{1,4}:){1,%d}%s",e-1,i)),c.push((0,Lt.sprintf)("(0{1,4}:){%d}0{1,4}",e-1));for(let f=1;f<e-1;f++)for(let h=1;h<e-f;h++)c.push((0,Lt.sprintf)("(0{1,4}:){%d}:(0{1,4}:){%d}0{1,4}",h,e-h-f-1));return Gr(c)}var j=H(Lr(),1),z=H(ue(),1);function Fe(e){if(!e)throw new Error("Assertion failed.")}function Qc(e){let t=/(\d+)(\d{3})/;for(;t.test(e);)e=e.replace(t,"$1,$2");return e}function Kc(e){return e=e.replace(/^(0{1,})([1-9]+)$/,'<span class="parse-error">$1</span>$2'),e=e.replace(/^(0{1,})(0)$/,'<span class="parse-error">$1</span>$2'),e}function tu(e,t){let r=[],n=[],i;for(i=0;i<e.length;i++)i<t[0]?r.push(e[i]):i>t[1]&&n.push(e[i]);return r.concat(["compact"]).concat(n)}function Ms(e){return(0,z.sprintf)("%04x",parseInt(e,16))}function Ds(e){return e&255}var fe=class e{constructor(t,r){this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=De,this.isCorrect=ke(128),r===void 0?this.groups=8:this.groups=r,this.address=t;let n=jr.exec(t);if(n){if(this.parsedSubnet=n[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,Number.isNaN(this.subnetMask)||this.subnetMask<0||this.subnetMask>128)throw new V("Invalid subnet mask.");t=t.replace(jr,"")}else if(/\//.test(t))throw new V("Invalid subnet mask.");let i=zr.exec(t);i&&(this.zone=i[0],t=t.replace(zr,"")),this.addressMinusSuffix=t,this.parsedAddress=this.parse(this.addressMinusSuffix)}static isValid(t){try{return new e(t),!0}catch{return!1}}static fromBigInteger(t){let r=t.toString(16).padStart(32,"0"),n=[],i;for(i=0;i<8;i++)n.push(r.slice(i*4,(i+1)*4));return new e(n.join(":"))}static fromURL(t){let r,n=null,i;if(t.indexOf("[")!==-1&&t.indexOf("]:")!==-1){if(i=As.exec(t),i===null)return{error:"failed to parse address with port",address:null,port:null};r=i[1],n=i[2]}else if(t.indexOf("/")!==-1){if(t=t.replace(/^[a-z0-9]+:\/\//,""),i=Es.exec(t),i===null)return{error:"failed to parse address from URL",address:null,port:null};r=i[1]}else r=t;return n?(n=parseInt(n,10),(n<0||n>65536)&&(n=null)):n=null,{address:new e(r),port:n}}static fromAddress4(t){let r=new rt(t),n=128-(32-r.subnetMask);return new e(`::ffff:${r.correctForm()}/${n}`)}static fromArpa(t){let r=t.replace(/(\.ip6\.arpa)?\.$/,""),n=7;if(r.length!==63)throw new V("Invalid 'ip6.arpa' form.");let i=r.split(".").reverse();for(let c=n;c>0;c--){let f=c*4;i.splice(f,0,":")}return r=i.join(""),new e(r)}microsoftTranscription(){return(0,z.sprintf)("%s.ipv6-literal.net",this.correctForm().replace(/:/g,"-"))}mask(t=this.subnetMask){return this.getBitsBase2(0,t)}possibleSubnets(t=128){let r=128-this.subnetMask,n=Math.abs(t-128),i=r-n;return i<0?"0":Qc(new j.BigInteger("2",10).pow(i).toString(10))}_startAddress(){return new j.BigInteger(this.mask()+"0".repeat(128-this.subnetMask),2)}startAddress(){return e.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new j.BigInteger("1");return e.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new j.BigInteger(this.mask()+"1".repeat(128-this.subnetMask),2)}endAddress(){return e.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new j.BigInteger("1");return e.fromBigInteger(this._endAddress().subtract(t))}getScope(){let t=Cs[this.getBits(12,16).intValue()];return this.getType()==="Global unicast"&&t!=="Link local"&&(t="Global"),t||"Unknown"}getType(){for(let t of Object.keys(Ur))if(this.isInSubnet(new e(t)))return Ur[t];return"Global unicast"}getBits(t,r){return new j.BigInteger(this.getBitsBase2(t,r),2)}getBitsBase2(t,r){return this.binaryZeroPad().slice(t,r)}getBitsBase16(t,r){let n=r-t;if(n%4!==0)throw new Error("Length of bits to retrieve must be divisible by four");return this.getBits(t,r).toString(16).padStart(n/4,"0")}getBitsPastSubnet(){return this.getBitsBase2(this.subnetMask,128)}reverseForm(t){t||(t={});let r=Math.floor(this.subnetMask/4),n=this.canonicalForm().replace(/:/g,"").split("").slice(0,r).reverse().join(".");return r>0?t.omitSuffix?n:(0,z.sprintf)("%s.ip6.arpa.",n):t.omitSuffix?"":"ip6.arpa."}correctForm(){let t,r=[],n=0,i=[];for(t=0;t<this.parsedAddress.length;t++){let h=parseInt(this.parsedAddress[t],16);h===0&&n++,h!==0&&n>0&&(n>1&&i.push([t-n,t-1]),n=0)}n>1&&i.push([this.parsedAddress.length-n,this.parsedAddress.length-1]);let c=i.map(h=>h[1]-h[0]+1);if(i.length>0){let h=c.indexOf(Math.max(...c));r=tu(this.parsedAddress,i[h])}else r=this.parsedAddress;for(t=0;t<r.length;t++)r[t]!=="compact"&&(r[t]=parseInt(r[t],16).toString(16));let f=r.join(":");return f=f.replace(/^compact$/,"::"),f=f.replace(/^compact|compact$/,":"),f=f.replace(/compact/,""),f}binaryZeroPad(){return this.bigInteger().toString(2).padStart(128,"0")}parse4in6(t){let r=t.split(":"),i=r.slice(-1)[0].match(Kt);if(i){this.parsedAddress4=i[0],this.address4=new rt(this.parsedAddress4);for(let c=0;c<this.address4.groups;c++)if(/^0[0-9]+/.test(this.address4.parsedAddress[c]))throw new V("IPv4 addresses can't have leading zeroes.",t.replace(Kt,this.address4.parsedAddress.map(Kc).join(".")));this.v4=!0,r[r.length-1]=this.address4.toGroup6(),t=r.join(":")}return t}parse(t){t=this.parse4in6(t);let r=t.match($r);if(r)throw new V((0,z.sprintf)("Bad character%s detected in address: %s",r.length>1?"s":"",r.join("")),t.replace($r,'<span class="parse-error">$1</span>'));let n=t.match(Vr);if(n)throw new V((0,z.sprintf)("Address failed regex: %s",n.join("")),t.replace(Vr,'<span class="parse-error">$1</span>'));let i=[],c=t.split("::");if(c.length===2){let f=c[0].split(":"),h=c[1].split(":");f.length===1&&f[0]===""&&(f=[]),h.length===1&&h[0]===""&&(h=[]);let g=this.groups-(f.length+h.length);if(!g)throw new V("Error parsing groups");this.elidedGroups=g,this.elisionBegin=f.length,this.elisionEnd=f.length+this.elidedGroups,i=i.concat(f);for(let C=0;C<g;C++)i.push("0");i=i.concat(h)}else if(c.length===1)i=t.split(":"),this.elidedGroups=0;else throw new V("Too many :: groups found");if(i=i.map(f=>(0,z.sprintf)("%x",parseInt(f,16))),i.length!==this.groups)throw new V("Incorrect number of groups found");return i}canonicalForm(){return this.parsedAddress.map(Ms).join(":")}decimal(){return this.parsedAddress.map(t=>(0,z.sprintf)("%05d",parseInt(t,16))).join(":")}bigInteger(){return new j.BigInteger(this.parsedAddress.map(Ms).join(""),16)}to4(){let t=this.binaryZeroPad().split("");return rt.fromHex(new j.BigInteger(t.slice(96,128).join(""),2).toString(16))}to4in6(){let t=this.to4(),n=new e(this.parsedAddress.slice(0,6).join(":"),6).correctForm(),i="";return/:$/.test(n)||(i=":"),n+i+t.address}inspectTeredo(){let t=this.getBitsBase16(0,32),r=this.getBits(80,96).xor(new j.BigInteger("ffff",16)).toString(),n=rt.fromHex(this.getBitsBase16(32,64)),i=rt.fromHex(this.getBits(96,128).xor(new j.BigInteger("ffffffff",16)).toString(16)),c=this.getBits(64,80),f=this.getBitsBase2(64,80),h=c.testBit(15),g=c.testBit(14),C=c.testBit(8),l=c.testBit(9),y=new j.BigInteger(f.slice(2,6)+f.slice(8,16),2).toString(10);return{prefix:(0,z.sprintf)("%s:%s",t.slice(0,4),t.slice(4,8)),server4:n.address,client4:i.address,flags:f,coneNat:h,microsoft:{reserved:g,universalLocal:l,groupIndividual:C,nonce:y},udpPort:r}}inspect6to4(){let t=this.getBitsBase16(0,16),r=rt.fromHex(this.getBitsBase16(16,48));return{prefix:(0,z.sprintf)("%s",t.slice(0,4)),gateway:r.address}}to6to4(){if(!this.is4())return null;let t=["2002",this.getBitsBase16(96,112),this.getBitsBase16(112,128),"","/16"].join(":");return new e(t)}toByteArray(){let t=this.bigInteger().toByteArray();return t.length===17&&t[0]===0?t.slice(1):t}toUnsignedByteArray(){return this.toByteArray().map(Ds)}static fromByteArray(t){return this.fromUnsignedByteArray(t.map(Ds))}static fromUnsignedByteArray(t){let r=new j.BigInteger("256",10),n=new j.BigInteger("0",10),i=new j.BigInteger("1",10);for(let c=t.length-1;c>=0;c--)n=n.add(i.multiply(new j.BigInteger(t[c].toString(10),10))),i=i.multiply(r);return e.fromBigInteger(n)}isCanonical(){return this.addressMinusSuffix===this.canonicalForm()}isLinkLocal(){return this.getBitsBase2(0,64)==="1111111010000000000000000000000000000000000000000000000000000000"}isMulticast(){return this.getType()==="Multicast"}is4(){return this.v4}isTeredo(){return this.isInSubnet(new e("2001::/32"))}is6to4(){return this.isInSubnet(new e("2002::/16"))}isLoopback(){return this.getType()==="Loopback"}href(t){return t===void 0?t="":t=(0,z.sprintf)(":%s",t),(0,z.sprintf)("http://[%s]%s/",this.correctForm(),t)}link(t){t||(t={}),t.className===void 0&&(t.className=""),t.prefix===void 0&&(t.prefix="/#address="),t.v4===void 0&&(t.v4=!1);let r=this.correctForm;return t.v4&&(r=this.to4in6),t.className?(0,z.sprintf)('<a href="%1$s%2$s" class="%3$s">%2$s</a>',t.prefix,r.call(this),t.className):(0,z.sprintf)('<a href="%1$s%2$s">%2$s</a>',t.prefix,r.call(this))}group(){if(this.elidedGroups===0)return Ne(this.address).join(":");Fe(typeof this.elidedGroups=="number"),Fe(typeof this.elisionBegin=="number");let t=[],[r,n]=this.address.split("::");r.length?t.push(...Ne(r)):t.push("");let i=["hover-group"];for(let c=this.elisionBegin;c<this.elisionBegin+this.elidedGroups;c++)i.push((0,z.sprintf)("group-%d",c));return t.push((0,z.sprintf)('<span class="%s"></span>',i.join(" "))),n.length?t.push(...Ne(n,this.elisionEnd)):t.push(""),this.is4()&&(Fe(this.address4 instanceof rt),t.pop(),t.push(this.address4.groupForV6())),t.join(":")}regularExpressionString(t=!1){let r=[],n=new e(this.correctForm());if(n.elidedGroups===0)r.push(_e(n.parsedAddress));else if(n.elidedGroups===8)r.push(Zr(8));else{let i=n.address.split("::");i[0].length&&r.push(_e(i[0].split(":"))),Fe(typeof n.elidedGroups=="number"),r.push(Zr(n.elidedGroups,i[0].length!==0,i[1].length!==0)),i[1].length&&r.push(_e(i[1].split(":"))),r=[r.join(":")]}return t||(r=["(?=^|",Hr,"|[^\\w\\:])(",...r,")(?=[^\\w\\:]|",Hr,"|$)"]),r.join("")}regularExpression(t=!1){return new RegExp(this.regularExpressionString(t),"i")}};var eu=Tt("libp2p:ip-port-to-multiaddr"),Wr={ERR_INVALID_IP_PARAMETER:"ERR_INVALID_IP_PARAMETER",ERR_INVALID_PORT_PARAMETER:"ERR_INVALID_PORT_PARAMETER",ERR_INVALID_IP:"ERR_INVALID_IP"};function ks(e,t){if(typeof e!="string")throw new ft(`invalid ip provided: ${e}`,Wr.ERR_INVALID_IP_PARAMETER);if(typeof t=="string"&&(t=parseInt(t)),isNaN(t))throw new ft(`invalid port provided: ${t}`,Wr.ERR_INVALID_PORT_PARAMETER);try{return new rt(e),dt(`/ip4/${e}/tcp/${t}`)}catch{}try{let r=new fe(e);return r.is4()?dt(`/ip4/${r.to4().correctForm()}/tcp/${t}`):dt(`/ip6/${e}/tcp/${t}`)}catch{let n=`invalid ip:port for creating a multiaddr: ${e}:${t}`;throw eu.error(n),new ft(n,Wr.ERR_INVALID_IP)}}var js=H($s(),1);var Yr=H(bt("os"),1),Vs=H(bt("path"),1);var iu={ip4:"IPv4",ip6:"IPv6"};function ne(e,t={}){let r=e.getPath();return r!=null?Yr.default.platform()==="win32"?{path:Vs.default.join("\\\\.\\pipe\\",r)}:{path:r}:{...e.toOptions(),...t}}function Qr(e,t,r){let n=i=>dt(`/${e}/${i}/tcp/${r}`);return(au(t)?uu(iu[e]):[t]).map(n)}function au(e){return["0.0.0.0","::"].includes(e)}var cu=Yr.default.networkInterfaces();function uu(e){let t=[];for(let[,r]of Object.entries(cu))if(r!=null)for(let n of r)n.family===e&&t.push(n.address);return t}var mt=Tt("libp2p:tcp:socket"),Ue=(e,t)=>{let r=t.metrics,n=t.metricPrefix??"",i=t.socketInactivityTimeout??3e5,c=t.socketCloseTimeout??500;t.listeningAddr?.getPath()!=null&&(t.remoteAddr=t.listeningAddr),t.remoteAddr?.getPath()!=null&&(t.localAddr=t.remoteAddr);let f;if(t.remoteAddr!=null)f=t.remoteAddr;else{if(e.remoteAddress==null||e.remotePort==null)throw new ft("Could not determine remote address or port","ERR_NO_REMOTE_ADDRESS");f=ks(e.remoteAddress,e.remotePort)}let h=ne(f),g=h.path??`${h.host??""}:${h.port??""}`,{sink:C,source:l}=js.default.duplex(e);e.setTimeout(i,()=>{mt("%s socket read timeout",g),r?.increment({[`${n}timeout`]:!0});let x;e.readable&&(x=new ft("Socket read timeout","ERR_SOCKET_READ_TIMEOUT")),e.destroy(x)}),e.once("close",()=>{mt("%s socket close",g),r?.increment({[`${n}close`]:!0}),y.timeline.close==null&&(y.timeline.close=Date.now())}),e.once("end",()=>{mt("%s socket end",g),r?.increment({[`${n}end`]:!0})});let y={async sink(x){try{await C(x)}catch(S){S.type!=="aborted"&&mt(S)}e.end()},source:l,remoteAddr:f,timeline:{open:Date.now()},async close(x={}){if(e.destroyed){mt("%s socket was already destroyed when trying to close",g);return}x.signal=x.signal??AbortSignal.timeout(c);try{mt("%s closing socket",g),await new Promise((S,m)=>{e.once("close",()=>{mt("%s socket closed",g),S()}),e.once("error",A=>{mt("%s socket error",g,A),y.timeline.close==null&&(y.timeline.close=Date.now()),m(A)}),e.setTimeout(c),e.end(),e.writableLength>0?e.once("drain",()=>{mt("%s socket drained",g),e.destroy()}):e.destroy()})}catch(S){this.abort(S)}},abort:x=>{mt("%s socket abort due to error",g,x),e.destroy(x)}};return y};var nt=Tt("libp2p:tcp:listener");async function Kr(e){try{await e.close()}catch(t){nt.error("an error occurred closing the connection",t)}}var pu=1,hu=0,$e=class extends Me{context;server;connections=new Set;status={started:!1};metrics;addr;constructor(t){if(super(),this.context=t,t.keepAlive=t.keepAlive??!0,this.addr="unknown",this.server=zs.default.createServer(t,this.onSocket.bind(this)),t.maxConnections!==void 0&&(this.server.maxConnections=t.maxConnections),t.closeServerOnMaxConnections!=null&&t.closeServerOnMaxConnections.closeAbove<t.closeServerOnMaxConnections.listenBelow)throw Error("closeAbove must be >= listenBelow");this.server.on("listening",()=>{if(t.metrics!=null){let r=this.server.address();r==null?this.addr="unknown":typeof r=="string"?this.addr=r:this.addr=`${r.address}:${r.port}`,t.metrics?.registerMetricGroup("libp2p_tcp_inbound_connections_total",{label:"address",help:"Current active connections in TCP listener",calculate:()=>({[this.addr]:this.connections.size})}),this.metrics={status:t.metrics.registerMetricGroup("libp2p_tcp_listener_status_info",{label:"address",help:"Current status of the TCP listener socket"}),errors:t.metrics.registerMetricGroup("libp2p_tcp_listener_errors_total",{label:"address",help:"Total count of TCP listener errors by type"}),events:t.metrics.registerMetricGroup("libp2p_tcp_listener_events_total",{label:"address",help:"Total count of TCP listener events by type"})},this.metrics?.status.update({[this.addr]:pu})}this.dispatchEvent(new Qt("listening"))}).on("error",r=>{this.metrics?.errors.increment({[`${this.addr} listen_error`]:!0}),this.dispatchEvent(new Qt("error",{detail:r}))}).on("close",()=>{this.metrics?.status.update({[this.addr]:hu}),this.dispatchEvent(new Qt("close"))})}onSocket(t){t.on("error",n=>{nt("socket error",n),this.metrics?.events.increment({[`${this.addr} error`]:!0})});let r;try{r=Ue(t,{listeningAddr:this.status.started?this.status.listeningAddr:void 0,socketInactivityTimeout:this.context.socketInactivityTimeout,socketCloseTimeout:this.context.socketCloseTimeout,metrics:this.metrics?.events,metricPrefix:`${this.addr} `})}catch(n){nt.error("inbound connection failed",n),this.metrics?.errors.increment({[`${this.addr} inbound_to_connection`]:!0});return}nt("new inbound connection %s",r.remoteAddr);try{this.context.upgrader.upgradeInbound(r).then(n=>{nt("inbound connection upgraded %s",r.remoteAddr),this.connections.add(r),t.once("close",()=>{this.connections.delete(r),this.context.closeServerOnMaxConnections!=null&&this.connections.size<this.context.closeServerOnMaxConnections.listenBelow&&this.netListen().catch(i=>{nt.error("error attempting to listen server once connection count under limit",i),this.context.closeServerOnMaxConnections?.onListenError?.(i)})}),this.context.handler!=null&&this.context.handler(n),this.context.closeServerOnMaxConnections!=null&&this.connections.size>=this.context.closeServerOnMaxConnections.closeAbove&&this.netClose(),this.dispatchEvent(new Qt("connection",{detail:n}))}).catch(async n=>{nt.error("inbound connection failed",n),this.metrics?.errors.increment({[`${this.addr} inbound_upgrade`]:!0}),await Kr(r)}).catch(n=>{nt.error("closing inbound connection failed",n)})}catch(n){nt.error("inbound connection failed",n),Kr(r).catch(i=>{nt.error("closing inbound connection failed",i),this.metrics?.errors.increment({[`${this.addr} inbound_closing_failed`]:!0})})}}getAddrs(){if(!this.status.started)return[];let t=[],r=this.server.address(),{listeningAddr:n,peerId:i}=this.status;if(r==null)return[];if(typeof r=="string")t=[n];else try{n.toString().startsWith("/ip4")?t=t.concat(Qr("ip4",r.address,r.port)):r.family==="IPv6"&&(t=t.concat(Qr("ip6",r.address,r.port)))}catch(c){nt.error("could not turn %s:%s into multiaddr",r.address,r.port,c)}return t.map(c=>i!=null?c.encapsulate(`/p2p/${i}`):c)}async listen(t){if(this.status.started)throw Error("server is already listening");let r=t.getPeerId(),n=r==null?t.decapsulateCode(421):t,{backlog:i}=this.context;this.status={started:!0,listeningAddr:n,peerId:r,netConfig:ne(n,{backlog:i})},await this.netListen()}async close(){await Promise.all(Array.from(this.connections.values()).map(async t=>{await Kr(t)})),this.netClose()}async netListen(){if(!this.status.started||this.server.listening)return;let t=this.status.netConfig;await new Promise((r,n)=>{this.server.once("error",n),this.server.listen(t,r)}),nt("Listening on %s",this.server.address())}netClose(){!this.status.started||!this.server.listening||(nt("Closing server on %s",this.server.address()),this.server.close())}};var vt=Tt("libp2p:tcp"),en=class{opts;metrics;components;constructor(t,r={}){this.opts=r,this.components=t,t.metrics!=null&&(this.metrics={dialerEvents:t.metrics.registerCounterGroup("libp2p_tcp_dialer_events_total",{label:"event",help:"Total count of TCP dialer events by type"})})}[ln]=!0;[Symbol.toStringTag]="@libp2p/tcp";async dial(t,r){r.keepAlive=r.keepAlive??!0;let n=await this._connect(t,r);n.on("error",h=>{vt("socket error",h)});let i=Ue(n,{remoteAddr:t,socketInactivityTimeout:this.opts.outboundSocketInactivityTimeout,socketCloseTimeout:this.opts.socketCloseTimeout,metrics:this.metrics?.dialerEvents}),c=()=>{i.close().catch(h=>{vt.error("Error closing maConn after abort",h)})};r.signal?.addEventListener("abort",c,{once:!0}),vt("new outbound connection %s",i.remoteAddr);let f=await r.upgrader.upgradeOutbound(i);if(vt("outbound connection %s upgraded",i.remoteAddr),r.signal?.removeEventListener("abort",c),r.signal?.aborted===!0)throw f.close().catch(h=>{vt.error("Error closing conn after abort",h)}),new Ut;return f}async _connect(t,r){if(r.signal?.aborted===!0)throw new Ut;return new Promise((n,i)=>{let c=Date.now(),f=ne(t),h=f.path??`${f.host??""}:${f.port}`;vt("dialing %j",f);let g=qs.default.connect(f),C=m=>{m.message=`connection error ${h}: ${m.message}`,this.metrics?.dialerEvents.increment({error:!0}),S(m)},l=()=>{vt("connection timeout %s",h),this.metrics?.dialerEvents.increment({timeout:!0});let m=new ft(`connection timeout after ${Date.now()-c}ms`,"ERR_CONNECT_TIMEOUT");g.emit("error",m)},y=()=>{vt("connection opened %j",f),this.metrics?.dialerEvents.increment({connect:!0}),S()},x=()=>{vt("connection aborted %j",f),this.metrics?.dialerEvents.increment({abort:!0}),g.destroy(),S(new Ut)},S=m=>{if(g.removeListener("error",C),g.removeListener("timeout",l),g.removeListener("connect",y),r.signal!=null&&r.signal.removeEventListener("abort",x),m!=null){i(m);return}n(g)};g.on("error",C),g.on("timeout",l),g.on("connect",y),r.signal!=null&&r.signal.addEventListener("abort",x)})}createListener(t){return new $e({...t,maxConnections:this.opts.maxConnections,backlog:this.opts.backlog,closeServerOnMaxConnections:this.opts.closeServerOnMaxConnections,socketInactivityTimeout:this.opts.inboundSocketInactivityTimeout,socketCloseTimeout:this.opts.socketCloseTimeout,metrics:this.components.metrics})}filter(t){return t=Array.isArray(t)?t:[t],t.filter(r=>r.protoCodes().includes(290)?!1:r.protoCodes().includes(400)?!0:It.matches(r.decapsulateCode(421)))}};function gu(e={}){return(t={})=>new en(t,e)}return Di(bu);})();
|
|
4
|
+
`+c),e.push(i+"m+"+we.exports.humanize(this.diff)+"\x1B[0m")}else e[0]=Xi()+t+" "+e[0]}function Xi(){return L.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Ji(...e){return process.stderr.write(be.format(...e)+`
|
|
5
|
+
`)}function Yi(e){e?process.env.DEBUG=e:delete process.env.DEBUG}function Qi(){return process.env.DEBUG}function Ki(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=Ge()(L);var{formatters:yn}=we.exports;yn.o=function(e){return this.inspectOpts.colors=this.useColors,be.inspect(e,this.inspectOpts).split(`
|
|
6
|
+
`).map(t=>t.trim()).join(" ")};yn.O=function(e){return this.inspectOpts.colors=this.useColors,be.inspect(e,this.inspectOpts)}});var xn=N((Cu,Ze)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?Ze.exports=dn():Ze.exports=vn()});var qn=N((Cf,zn)=>{zn.exports=br;var jn=128,cc=127,uc=~cc,fc=Math.pow(2,31);function br(e,t,r){if(Number.MAX_SAFE_INTEGER&&e>Number.MAX_SAFE_INTEGER)throw br.bytes=0,new RangeError("Could not encode varint");t=t||[],r=r||0;for(var n=r;e>=fc;)t[r++]=e&255|jn,e/=128;for(;e&uc;)t[r++]=e&255|jn,e>>>=7;return t[r]=e|0,br.bytes=r-n+1,t}});var Zn=N((Ef,Hn)=>{Hn.exports=wr;var lc=128,Gn=127;function wr(e,n){var r=0,n=n||0,i=0,c=n,f,h=e.length;do{if(c>=h||i>49)throw wr.bytes=0,new RangeError("Could not decode varint");f=e[c++],r+=i<28?(f&Gn)<<i:(f&Gn)*Math.pow(2,i),i+=7}while(f>=lc);return wr.bytes=c-n,r}});var Xn=N((Af,Wn)=>{var pc=Math.pow(2,7),hc=Math.pow(2,14),dc=Math.pow(2,21),mc=Math.pow(2,28),gc=Math.pow(2,35),bc=Math.pow(2,42),wc=Math.pow(2,49),yc=Math.pow(2,56),vc=Math.pow(2,63);Wn.exports=function(e){return e<pc?1:e<hc?2:e<dc?3:e<mc?4:e<gc?5:e<bc?6:e<wc?7:e<yc?8:e<vc?9:10}});var yr=N((If,Jn)=>{Jn.exports={encode:qn(),decode:Zn(),encodingLength:Xn()}});var Fr=N((ke,xs)=>{(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,ot=v*M+F*b;M=b*M+((ot&32767)<<15)+a[u]+(p&1073741823),p=(M>>>30)+(ot>>>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,ot=v*M+F*b;M=b*M+((ot&16383)<<14)+a[u]+p,p=(M>>28)+(ot>>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 at(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 qs(){return this.t<=0?0:this.DB*(this.t-1)+at(this[this.t-1]^this.s&this.DM)}function Gs(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 Hs(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 Zs(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 Ws(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 Xs(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 Js(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 Ys(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 Qs(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-at(u[u.t-1]);M>0?(u.lShiftTo(M,d),p.lShiftTo(M,a)):(u.copyTo(d),p.copyTo(a));var F=d.t,ot=d[F-1];if(ot!=0){var Q=ot*(1<<this.F1)+(F>1?d[F-2]>>this.F2:0),gt=this.FV/Q,pe=(1<<this.F1)/Q,ut=1<<this.F2,ft=a.t,he=ft-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 qe=a[--ft]==ot?this.DM:Math.floor(a[ft]*gt+(a[ft-1]+ut)*pe);if((a[ft]+=d.am(0,qe,a,he,0,F))<qe)for(d.dlShiftTo(he,xt),a.subTo(xt,a);a[ft]<--qe;)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 Ks(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 to(s){return s.s<0||s.compareTo(this.m)>=0?s.mod(this.m):s}function eo(s){return s}function ro(s){s.divRemTo(this.m,null,s)}function no(s,o,a){s.multiplyTo(o,a),this.reduce(a)}function so(s,o){s.squareTo(o),this.reduce(o)}Rt.prototype.convert=to,Rt.prototype.revert=eo,Rt.prototype.reduce=ro,Rt.prototype.mulTo=no,Rt.prototype.sqrTo=so;function oo(){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 io(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 ao(s){var o=i();return s.copyTo(o),this.reduce(o),o}function co(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 uo(s,o){s.squareTo(o),this.reduce(o)}function fo(s,o,a){s.multiplyTo(o,a),this.reduce(a)}Bt.prototype.convert=io,Bt.prototype.revert=ao,Bt.prototype.reduce=co,Bt.prototype.mulTo=fo,Bt.prototype.sqrTo=uo;function lo(){return(this.t>0?this[0]&1:this.s)==0}function po(s,o){if(s>4294967295||s<1)return n.ONE;var a=i(),u=i(),p=o.convert(this),d=at(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 ho(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=Gs,n.prototype.drShiftTo=Hs,n.prototype.lShiftTo=Zs,n.prototype.rShiftTo=Ws,n.prototype.subTo=Xs,n.prototype.multiplyTo=Js,n.prototype.squareTo=Ys,n.prototype.divRemTo=Qs,n.prototype.invDigit=oo,n.prototype.isEven=lo,n.prototype.exp=po,n.prototype.toString=J,n.prototype.negate=Z,n.prototype.abs=q,n.prototype.compareTo=W,n.prototype.bitLength=qs,n.prototype.mod=Ks,n.prototype.modPowInt=ho,n.ZERO=I(0),n.ONE=I(1);function mo(){var s=i();return this.copyTo(s),s}function go(){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 bo(){return this.t==0?this.s:this[0]<<24>>24}function wo(){return this.t==0?this.s:this[0]<<16>>16}function yo(s){return Math.floor(Math.LN2*this.DB/Math.log(s))}function vo(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function xo(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 So(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 To(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),$e,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 Co(){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 Eo(s){return this.compareTo(s)==0}function Ao(s){return this.compareTo(s)<0?this:s}function Io(s){return this.compareTo(s)>0?this:s}function Ro(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 Bo(s,o){return s&o}function Mo(s){var o=i();return this.bitwiseTo(s,Bo,o),o}function $e(s,o){return s|o}function Do(s){var o=i();return this.bitwiseTo(s,$e,o),o}function en(s,o){return s^o}function ko(s){var o=i();return this.bitwiseTo(s,en,o),o}function rn(s,o){return s&~o}function Po(s){var o=i();return this.bitwiseTo(s,rn,o),o}function Oo(){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 No(s){var o=i();return s<0?this.rShiftTo(-s,o):this.lShiftTo(s,o),o}function _o(s){var o=i();return s<0?this.lShiftTo(-s,o):this.rShiftTo(s,o),o}function Fo(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 Lo(){for(var s=0;s<this.t;++s)if(this[s]!=0)return s*this.DB+Fo(this[s]);return this.s<0?this.t*this.DB:-1}function Uo(s){for(var o=0;s!=0;)s&=s-1,++o;return o}function $o(){for(var s=0,o=this.s&this.DM,a=0;a<this.t;++a)s+=Uo(this[a]^o);return s}function Vo(s){var o=Math.floor(s/this.DB);return o>=this.t?this.s!=0:(this[o]&1<<s%this.DB)!=0}function jo(s,o){var a=n.ONE.shiftLeft(s);return this.bitwiseTo(a,o,a),a}function zo(s){return this.changeBit(s,$e)}function qo(s){return this.changeBit(s,rn)}function Go(s){return this.changeBit(s,en)}function Ho(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 Zo(s){var o=i();return this.addTo(s,o),o}function Wo(s){var o=i();return this.subTo(s,o),o}function Xo(s){var o=i();return this.multiplyTo(s,o),o}function Jo(){var s=i();return this.squareTo(s),s}function Yo(s){var o=i();return this.divRemTo(s,o,null),o}function Qo(s){var o=i();return this.divRemTo(s,null,o),o}function Ko(s){var o=i(),a=i();return this.divRemTo(s,o,a),new Array(o,a)}function ti(s){this[this.t]=this.am(0,s-1,this,0,0,this.t),++this.t,this.clamp()}function ei(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 nn(s){return s}function ri(s,o,a){s.multiplyTo(o,a)}function ni(s,o){s.squareTo(o)}se.prototype.convert=nn,se.prototype.revert=nn,se.prototype.mulTo=ri,se.prototype.sqrTo=ni;function si(s){return this.exp(s,new se)}function oi(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 ii(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 ai(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 ci(s){return s}function ui(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 fi(s,o){s.squareTo(o),this.reduce(o)}function li(s,o,a){s.multiplyTo(o,a),this.reduce(a)}Mt.prototype.convert=ai,Mt.prototype.revert=ci,Mt.prototype.reduce=ui,Mt.prototype.mulTo=li,Mt.prototype.sqrTo=fi;function pi(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 ot=i();for(d.sqrTo(b[1],ot);v<=F;)b[v]=i(),d.mulTo(ot,b[v-2],b[v]),v+=2}var Q=s.t-1,gt,pe=!0,ut=i(),ft;for(a=at(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,ut),d.sqrTo(ut,p),v-=2;v>0?d.sqrTo(p,ut):(ft=p,p=ut,ut=ft),d.mulTo(ut,b[gt],p)}for(;Q>=0&&!(s[Q]&1<<a);)d.sqrTo(p,ut),ft=p,p=ut,ut=ft,--a<0&&(a=this.DB-1,--Q)}return d.revert(p)}function hi(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 di(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 mi(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],gi=(1<<26)/G[G.length-1];function bi(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<gi;)u*=G[p++];for(u=a.modInt(u);o<p;)if(u%G[o++]==0)return!1}return a.millerRabin(s)}function wi(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=yo,n.prototype.toRadix=xo,n.prototype.fromRadix=So,n.prototype.fromNumber=To,n.prototype.bitwiseTo=Ro,n.prototype.changeBit=jo,n.prototype.addTo=Ho,n.prototype.dMultiply=ti,n.prototype.dAddOffset=ei,n.prototype.multiplyLowerTo=oi,n.prototype.multiplyUpperTo=ii,n.prototype.modInt=di,n.prototype.millerRabin=wi,n.prototype.clone=mo,n.prototype.intValue=go,n.prototype.byteValue=bo,n.prototype.shortValue=wo,n.prototype.signum=vo,n.prototype.toByteArray=Co,n.prototype.equals=Eo,n.prototype.min=Ao,n.prototype.max=Io,n.prototype.and=Mo,n.prototype.or=Do,n.prototype.xor=ko,n.prototype.andNot=Po,n.prototype.not=Oo,n.prototype.shiftLeft=No,n.prototype.shiftRight=_o,n.prototype.getLowestSetBit=Lo,n.prototype.bitCount=$o,n.prototype.testBit=Vo,n.prototype.setBit=zo,n.prototype.clearBit=qo,n.prototype.flipBit=Go,n.prototype.add=Zo,n.prototype.subtract=Wo,n.prototype.multiply=Xo,n.prototype.divide=Yo,n.prototype.remainder=Qo,n.prototype.divideAndRemainder=Ko,n.prototype.modPow=pi,n.prototype.modInverse=mi,n.prototype.pow=si,n.prototype.gcd=hi,n.prototype.isProbablePrime=bi,n.prototype.square=Jo,n.prototype.Barrett=Mt;var le,Y,_;function yi(s){Y[_++]^=s&255,Y[_++]^=s>>8&255,Y[_++]^=s>>16&255,Y[_++]^=s>>24&255,_>=ze&&(_-=ze)}function sn(){yi(new Date().getTime())}if(Y==null){Y=new Array,_=0;var ct;if(typeof window<"u"&&window.crypto){if(window.crypto.getRandomValues){var on=new Uint8Array(32);for(window.crypto.getRandomValues(on),ct=0;ct<32;++ct)Y[_++]=on[ct]}else if(navigator.appName=="Netscape"&&navigator.appVersion<"5"){var an=window.crypto.random(32);for(ct=0;ct<an.length;++ct)Y[_++]=an.charCodeAt(ct)&255}}for(;_<ze;)ct=Math.floor(65536*Math.random()),Y[_++]=ct>>>8,Y[_++]=ct&255;_=0,sn()}function vi(){if(le==null){for(sn(),le=Ci(),le.init(Y),_=0;_<Y.length;++_)Y[_]=0;_=0}return le.next()}function xi(s){var o;for(o=0;o<s.length;++o)s[o]=vi()}function Ve(){}Ve.prototype.nextBytes=xi;function je(){this.i=0,this.j=0,this.S=new Array}function Si(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 Ti(){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]}je.prototype.init=Si,je.prototype.next=Ti;function Ci(){return new je}var ze=256;typeof ke<"u"?ke=xs.exports={default:n,BigInteger:n,SecureRandom:Ve}:this.jsbn={BigInteger:n,SecureRandom:Ve}}).call(ke)});var ue=N(Pe=>{(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 Pe<"u"&&(Pe.sprintf=t,Pe.vsprintf=r),typeof window<"u"&&(window.sprintf=t,window.vsprintf=r,typeof define=="function"&&define.amd&&define(function(){return{sprintf:t,vsprintf:r}}))})()});var Fe=N((vp,ks)=>{ks.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 Os=N((xp,Ps)=>{Ps.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 Wr=N((Sp,Ns)=>{var eu=Os();Ns.exports=e=>async t=>{t=eu(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 Xr=N((Tp,_s)=>{var ru=Wr(),nu=Fe();_s.exports=e=>({sink:ru(e),source:nu(e)})});var Ls=N((Cp,Fs)=>{var su=Xr();Fs.exports=e=>async function*(t){let r=su(e),n;if(r.sink(t).catch(i=>{n=i}),yield*r.source,n)throw n}});var Us=N((Ep,re)=>{re.exports=Fe();re.exports.source=Fe();re.exports.sink=Wr();re.exports.transform=Ls();re.exports.duplex=Xr()});var gu={};K(gu,{tcp:()=>mu});var zs=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"},tt=class extends Error{code;props;constructor(t,r,n){super(t),this.code=r,this.name=n?.name??"CodeError",this.props=n??{}}};var fn=Symbol.for("@libp2p/transport");var un;(function(e){e[e.FATAL_ALL=0]="FATAL_ALL",e[e.NO_FATAL=1]="NO_FATAL"})(un||(un={}));var rt=H(xn(),1);var Qe={};K(Qe,{base32:()=>pt,base32hex:()=>ca,base32hexpad:()=>fa,base32hexpadupper:()=>la,base32hexupper:()=>ua,base32pad:()=>ia,base32padupper:()=>aa,base32upper:()=>oa,base32z:()=>pa});function ta(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 at=g.repeat(A);W<k;++W)at+=e.charAt(O[W]);return at}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)),at=R;q!==I;)W[at++]=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 ea=ta,ra=ea,Sn=ra;var Au=new Uint8Array(0);var Tn=(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},it=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 Cn=e=>new TextEncoder().encode(e),En=e=>new TextDecoder().decode(e);var We=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")}},Xe=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 In(this,t)}},Je=class{constructor(t){this.decoders=t}or(t){return In(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`)}},In=(e,t)=>new Je({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}}),Ye=class{constructor(t,r,n,i){this.name=t,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new We(t,r,n),this.decoder=new Xe(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 Ye(e,t,r,n),St=({prefix:e,name:t,alphabet:r})=>{let{encode:n,decode:i}=Sn(r,t);return qt({prefix:e,name:t,encode:n,decode:c=>it(i(c))})},na=(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},sa=(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 sa(i,n,r)},decode(i){return na(i,n,r,e)}});var pt=D({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),oa=D({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ia=D({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),aa=D({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ca=D({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ua=D({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),fa=D({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),la=D({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),pa=D({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Ke={};K(Ke,{base58btc:()=>$,base58flickr:()=>ha});var $=St({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),ha=St({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var er={};K(er,{base64:()=>tr,base64pad:()=>da,base64url:()=>ma,base64urlpad:()=>ga});var tr=D({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),da=D({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),ma=D({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ga=D({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});rt.default.formatters.b=e=>e==null?"undefined":$.baseEncode(e);rt.default.formatters.t=e=>e==null?"undefined":pt.baseEncode(e);rt.default.formatters.m=e=>e==null?"undefined":tr.baseEncode(e);rt.default.formatters.p=e=>e==null?"undefined":e.toString();rt.default.formatters.c=e=>e==null?"undefined":e.toString();rt.default.formatters.k=e=>e==null?"undefined":e.toString();rt.default.formatters.a=e=>e==null?"undefined":e.toString();function ba(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=ba(`${e}:trace`);return rt.default.enabled(`${e}:trace`)&&rt.default.names.map(r=>r.toString()).find(r=>r.includes(":trace"))!=null&&(t=(0,rt.default)(`${e}:trace`)),Object.assign((0,rt.default)(e),{error:(0,rt.default)(`${e}:error`),trace:t})}var wa=Mn,Rn=128,ya=127,va=~ya,xa=Math.pow(2,31);function Mn(e,t,r){t=t||[],r=r||0;for(var n=r;e>=xa;)t[r++]=e&255|Rn,e/=128;for(;e&va;)t[r++]=e&255|Rn,e>>>=7;return t[r]=e|0,Mn.bytes=r-n+1,t}var Sa=rr,Ta=128,Bn=127;function rr(e,n){var r=0,n=n||0,i=0,c=n,f,h=e.length;do{if(c>=h)throw rr.bytes=0,new RangeError("Could not decode varint");f=e[c++],r+=i<28?(f&Bn)<<i:(f&Bn)*Math.pow(2,i),i+=7}while(f>=Ta);return rr.bytes=c-n,r}var Ca=Math.pow(2,7),Ea=Math.pow(2,14),Aa=Math.pow(2,21),Ia=Math.pow(2,28),Ra=Math.pow(2,35),Ba=Math.pow(2,42),Ma=Math.pow(2,49),Da=Math.pow(2,56),ka=Math.pow(2,63),Pa=function(e){return e<Ca?1:e<Ea?2:e<Aa?3:e<Ia?4:e<Ra?5:e<Ba?6:e<Ma?7:e<Da?8:e<ka?9:10},Oa={encode:wa,decode:Sa,encodingLength:Pa},Na=Oa,oe=Na;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)},ve=e=>{let t=it(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)},Dn=(e,t)=>{if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&Tn(e.bytes,r.bytes)}},Zt=class{constructor(t,r,n,i){this.code=t,this.size=r,this.digest=n,this.bytes=i}};var kn=(e,t)=>{let{bytes:r,version:n}=e;switch(n){case 0:return Fa(r,nr(e),t||$.encoder);default:return La(r,nr(e),t||pt.encoder)}};var Pn=new WeakMap,nr=e=>{let t=Pn.get(e);if(t==null){let r=new Map;return Pn.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!==Ua)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&&Dn(t.multihash,n.multihash)}toString(t){return kn(this,t)}toJSON(){return{"/":kn(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||On(n,i,c.bytes))}else if(r[$a]===!0){let{version:n,multihash:i,code:c}=r,f=ve(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=On(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=it(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]=_a(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 nr(c).set(n,t),c}},_a=(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)]}}},Fa=(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},La=(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,Ua=18,On=(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},$a=Symbol.for("@ipld/js-cid/CID");function Nn(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 sr={};K(sr,{identity:()=>Va});var Va=qt({prefix:"\0",name:"identity",encode:e=>En(e),decode:e=>Cn(e)});var or={};K(or,{base2:()=>ja});var ja=D({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var ir={};K(ir,{base8:()=>za});var za=D({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var ar={};K(ar,{base10:()=>qa});var qa=St({prefix:"9",name:"base10",alphabet:"0123456789"});var cr={};K(cr,{base16:()=>Ga,base16upper:()=>Ha});var Ga=D({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Ha=D({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var ur={};K(ur,{base36:()=>Za,base36upper:()=>Wa});var Za=St({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Wa=St({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var fr={};K(fr,{base256emoji:()=>Ka});var _n=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}"),Xa=_n.reduce((e,t,r)=>(e[r]=t,e),[]),Ja=_n.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]);function Ya(e){return e.reduce((t,r)=>(t+=Xa[r],t),"")}function Qa(e){let t=[];for(let r of e){let n=Ja[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);t.push(n)}return new Uint8Array(t)}var Ka=qt({prefix:"\u{1F680}",name:"base256emoji",encode:Ya,decode:Qa});var dr={};K(dr,{sha256:()=>tc,sha512:()=>ec});var hr=H(bt("crypto"),1);var pr=({name:e,code:t,encode:r})=>new lr(e,t,r),lr=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 tc=pr({name:"sha2-256",code:18,encode:e=>it(hr.default.createHash("sha256").update(e).digest())}),ec=pr({name:"sha2-512",code:19,encode:e=>it(hr.default.createHash("sha512").update(e).digest())});var mr={};K(mr,{identity:()=>sc});var Ln=0,rc="identity",Un=it,nc=e=>kt(Ln,Un(e)),sc={code:Ln,name:rc,encode:Un,digest:nc};var sf=new TextEncoder,of=new TextDecoder;var ce={...sr,...or,...ir,...ar,...cr,...Qe,...ur,...Ke,...er,...fr},lf={...dr,...mr};function Xt(e){return globalThis.Buffer!=null?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function xe(e=0){return globalThis.Buffer?.allocUnsafe!=null?Xt(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}function Vn(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}var $n=Vn("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),gr=Vn("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=xe(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),ac={utf8:$n,"utf-8":$n,hex:ce.base16,latin1:gr,ascii:gr,binary:gr,...ce},Se=ac;function X(e,t="utf8"){let r=Se[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=xe(t),n=0;for(let i of e)r.set(i,n),n+=i.length;return Xt(r)}var Yt=H(yr(),1);var Te=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 Mf=new Te;var Lf=parseInt("0xFFFF",16),Uf=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);function vr(e,t="utf8"){let r=Se[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(yr(),1);var Et=bt("node:net");function Ce(e){return!!(0,Et.isIP)(e)}var Kn=Et.isIPv4,Ac=Et.isIPv6,xr=function(e){let t=0;if(e=e.toString().trim(),Kn(e)){let r=new Uint8Array(t+4);return e.split(/\./g).forEach(n=>{r[t++]=parseInt(n,10)&255}),r}if(Ac(e)){let r=e.split(":",8),n;for(n=0;n<r.length;n++){let c=Kn(r[n]),f;c&&(f=xr(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")},ts=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={},Sr={},Rc=[[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"]];Rc.forEach(e=>{let t=Bc(...e);Sr[t.code]=t,Jt[t.name]=t});function Bc(e,t,r,n,i){return{code:e,size:t,name:r,resolvable:!!n,path:!!i}}function B(e){if(typeof e=="number"){if(Sr[e]!=null)return Sr[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 Al=B("ip4"),Il=B("ip6"),Rl=B("ipcidr");function Cr(e,t){switch(B(e).code){case 4:case 41:return Dc(t);case 42:return ns(t);case 6:case 273:case 33:case 132:return os(t).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return ns(t);case 421:return Nc(t);case 444:return ss(t);case 445:return ss(t);case 466:return Oc(t);default:return X(t,"base16")}}function Er(e,t){switch(B(e).code){case 4:return es(t);case 41:return es(t);case 42:return rs(t);case 6:case 273:case 33:case 132:return Ar(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return rs(t);case 421:return kc(t);case 444:return _c(t);case 445:return Fc(t);case 466:return Pc(t);default:return vr(t,"base16")}}var Tr=Object.values(ce).map(e=>e.decoder),Mc=function(){let e=Tr[0].or(Tr[1]);return Tr.slice(2).forEach(t=>e=e.or(t)),e}();function es(e){if(!Ce(e))throw new Error("invalid ip address");return xr(e)}function Dc(e){let t=ts(e,0,e.length);if(t==null)throw new Error("ipBuff is required");if(!Ce(t))throw new Error("invalid ip address");return t}function Ar(e){let t=new ArrayBuffer(2);return new DataView(t).setUint16(0,e),new Uint8Array(t)}function os(e){return new DataView(e.buffer).getUint16(e.byteOffset)}function rs(e){let t=vr(e),r=Uint8Array.from(ht.default.encode(t.length));return wt([r,t],r.length+t.length)}function ns(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 kc(e){let t;e[0]==="Q"||e[0]==="1"?t=ve($.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 Pc(e){let t=Mc.decode(e),r=Uint8Array.from(ht.default.encode(t.length));return wt([r,t],r.length+t.length)}function Oc(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 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 X(r,"base58btc")}function _c(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=Ar(n);return wt([r,i],r.length+i.length)}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!==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=Ar(n);return wt([r,i],r.length+i.length)}function ss(e){let t=e.slice(0,e.length-2),r=e.slice(e.length-2),n=X(t,"base32"),i=os(r);return`${n}:${i}`}function is(e){e=Ir(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 cs("invalid address: "+e);if(h.path===!0){n=Ir(i.slice(c).join("/")),t.push([h.code,Er(h.code,n)]),r.push([h.code,n]);break}let g=Er(h.code,i[c]);t.push([h.code,g]),r.push([h.code,Cr(h.code,g)])}return{string:as(r),bytes:Br(t),tuples:t,stringTuples:r,path:n}}function Rr(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=Lc(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 cs("Invalid address Uint8Array: "+X(e,"base16"));t.push([c,C]);let l=Cr(c,C);if(r.push([c,l]),h.path===!0){n=l;break}}return{bytes:Uint8Array.from(e),string:as(r),tuples:t,stringTuples:r,path:n}}function as(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}),Ir(t.join("/"))}function Br(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 Lc(e,t){return e.size>0?e.size/8:e.size===0?0:Yt.default.decode(t)+(Yt.default.decode.bytes??0)}function Ir(e){return"/"+e.trim().split("/").filter(t=>t).join("/")}function cs(e){return new Error("Error parsing address: "+e)}var Uc=Symbol.for("nodejs.util.inspect.custom"),$c=[B("dns").code,B("dns4").code,B("dns6").code,B("dnsaddr").code],Vc=new Map,us=Symbol.for("@multiformats/js-multiaddr/multiaddr");function jc(e){return!!e?.[us]}var Mr=class e{bytes;#t;#e;#r;#n;[us]=!0;constructor(t){t==null&&(t="");let r;if(t instanceof Uint8Array)r=Rr(t);else if(typeof t=="string"){if(t.length>0&&t.charAt(0)!=="/")throw new Error(`multiaddr "${t}" must start with a "/"`);r=is(t)}else if(jc(t))r=Rr(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??""}`),$c.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(Br(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 Nn(this.bytes,t.bytes)}async resolve(t){let r=this.protos().find(c=>c.resolvable);if(r==null)return[this];let n=Vc.get(r.name);if(n==null)throw new tt(`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)}[Uc](){return`Multiaddr(${this.#t})`}};function dt(e){return new Mr(e)}var zc=w("dns4"),qc=w("dns6"),Gc=w("dnsaddr"),Ot=P(w("dns"),Gc,zc,qc),Ie=P(w("ip4"),w("ip6")),It=P(T(Ie,w("tcp")),T(Ot,w("tcp"))),Re=T(Ie,w("udp")),Hc=T(Re,w("utp")),Zc=T(Re,w("quic")),Wc=T(Re,w("quic-v1")),Dr=P(T(It,w("ws")),T(Ot,w("ws"))),Ee=P(T(Dr,w("p2p")),Dr),kr=P(T(It,w("wss")),T(Ot,w("wss")),T(It,w("tls"),w("ws")),T(Ot,w("tls"),w("ws"))),Ae=P(T(kr,w("p2p")),kr),Pr=P(T(It,w("http")),T(Ie,w("http")),T(Ot,w("http"))),Or=P(T(It,w("https")),T(Ie,w("https")),T(Ot,w("https"))),fs=T(Re,w("webrtc-direct"),w("certhash")),hs=P(T(fs,w("p2p")),fs),ls=T(Wc,w("webtransport"),w("certhash"),w("certhash")),ds=P(T(ls,w("p2p")),ls),ms=P(T(Ee,w("p2p-webrtc-star"),w("p2p")),T(Ae,w("p2p-webrtc-star"),w("p2p")),T(Ee,w("p2p-webrtc-star")),T(Ae,w("p2p-webrtc-star"))),Jl=P(T(Ee,w("p2p-websocket-star"),w("p2p")),T(Ae,w("p2p-websocket-star"),w("p2p")),T(Ee,w("p2p-websocket-star")),T(Ae,w("p2p-websocket-star"))),gs=P(T(Pr,w("p2p-webrtc-direct"),w("p2p")),T(Or,w("p2p-webrtc-direct"),w("p2p")),T(Pr,w("p2p-webrtc-direct")),T(Or,w("p2p-webrtc-direct"))),Nt=P(Dr,kr,Pr,Or,ms,gs,It,Hc,Zc,Ot,hs,ds),Yl=P(T(Nt,w("p2p-stardust"),w("p2p")),T(Nt,w("p2p-stardust"))),At=P(T(Nt,w("p2p")),ms,gs,hs,ds,w("p2p")),ps=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")),bs=()=>P(T(ps,bs),ps),Pt=bs(),Ql=P(T(Pt,At,Pt),T(At,Pt),T(Pt,At),Pt,At);var Kl=P(T(Pt,w("webrtc"),w("p2p")),T(Pt,w("webrtc")),T(Nt,w("webrtc"),w("p2p")),T(Nt,w("webrtc")),w("webrtc"));function ws(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:ws(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:ws(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 js=H(bt("net"),1);var Be=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))}},Nr=class extends Event{detail;constructor(t,r){super(t,r),this.detail=r?.detail}},Qt=globalThis.CustomEvent??Nr;function Me(e){return this.subnetMask<e.subnetMask?!1:this.mask(e.subnetMask)===e.mask()}function De(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,_r=/\/\d{1,2}$/;var V=class extends Error{constructor(t,r){super(t),this.name="AddressError",r!==null&&(this.parseMessage=r)}};var te=H(Fr(),1),_t=H(ue(),1),nt=class e{constructor(t){this.groups=4,this.parsedAddress=[],this.parsedSubnet="",this.subnet="/32",this.subnetMask=32,this.v4=!0,this.isCorrect=De(32),this.isInSubnet=Me,this.address=t;let r=_r.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(_r,"")}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 Ts={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"},Lr={"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"},Ur=/([^0-9a-f:/%])/gi,$r=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi,Vr=/\/\d{1,3}(?=%|$)/,jr=/%.*$/,Cs=new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/),Es=new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/);var Is=H(ue(),1);function Jc(e){return e.replace(/^(0+)/,'<span class="zero">$1</span>')}function Oe(e,t=0){return e.split(":").map((n,i)=>/group-v4/.test(n)?n:(0,Is.sprintf)('<span class="hover-group group-%d">%s</span>',i+t,Jc(n)))}var Lt=H(ue(),1);function qr(e){return(0,Lt.sprintf)("(%s)",e.join("|"))}function zr(e){return e.length<4?(0,Lt.sprintf)("0{0,%d}%s",4-e.length,e):e}var Gr="[^A-Fa-f0-9:]";function Ne(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 qr([zr(i),f])}return zr(i)}).join(":"));return r.push(e.map(zr).join(":")),qr(r)}function Hr(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 qr(c)}var j=H(Fr(),1),z=H(ue(),1);function _e(e){if(!e)throw new Error("Assertion failed.")}function Yc(e){let t=/(\d+)(\d{3})/;for(;t.test(e);)e=e.replace(t,"$1,$2");return e}function Qc(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 Kc(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 Bs(e){return(0,z.sprintf)("%04x",parseInt(e,16))}function Ms(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=Me,this.isCorrect=De(128),r===void 0?this.groups=8:this.groups=r,this.address=t;let n=Vr.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(Vr,"")}else if(/\//.test(t))throw new V("Invalid subnet mask.");let i=jr.exec(t);i&&(this.zone=i[0],t=t.replace(jr,"")),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=Es.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=Cs.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 nt(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":Yc(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=Ts[this.getBits(12,16).intValue()];return this.getType()==="Global unicast"&&t!=="Link local"&&(t="Global"),t||"Unknown"}getType(){for(let t of Object.keys(Lr))if(this.isInSubnet(new e(t)))return Lr[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=Kc(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 nt(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(Qc).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(Ur);if(r)throw new V((0,z.sprintf)("Bad character%s detected in address: %s",r.length>1?"s":"",r.join("")),t.replace(Ur,'<span class="parse-error">$1</span>'));let n=t.match($r);if(n)throw new V((0,z.sprintf)("Address failed regex: %s",n.join("")),t.replace($r,'<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(Bs).join(":")}decimal(){return this.parsedAddress.map(t=>(0,z.sprintf)("%05d",parseInt(t,16))).join(":")}bigInteger(){return new j.BigInteger(this.parsedAddress.map(Bs).join(""),16)}to4(){let t=this.binaryZeroPad().split("");return nt.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=nt.fromHex(this.getBitsBase16(32,64)),i=nt.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=nt.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(Ms)}static fromByteArray(t){return this.fromUnsignedByteArray(t.map(Ms))}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 Oe(this.address).join(":");_e(typeof this.elidedGroups=="number"),_e(typeof this.elisionBegin=="number");let t=[],[r,n]=this.address.split("::");r.length?t.push(...Oe(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(...Oe(n,this.elisionEnd)):t.push(""),this.is4()&&(_e(this.address4 instanceof nt),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(Ne(n.parsedAddress));else if(n.elidedGroups===8)r.push(Hr(8));else{let i=n.address.split("::");i[0].length&&r.push(Ne(i[0].split(":"))),_e(typeof n.elidedGroups=="number"),r.push(Hr(n.elidedGroups,i[0].length!==0,i[1].length!==0)),i[1].length&&r.push(Ne(i[1].split(":"))),r=[r.join(":")]}return t||(r=["(?=^|",Gr,"|[^\\w\\:])(",...r,")(?=[^\\w\\:]|",Gr,"|$)"]),r.join("")}regularExpression(t=!1){return new RegExp(this.regularExpressionString(t),"i")}};var tu=Tt("libp2p:ip-port-to-multiaddr"),Zr={ERR_INVALID_IP_PARAMETER:"ERR_INVALID_IP_PARAMETER",ERR_INVALID_PORT_PARAMETER:"ERR_INVALID_PORT_PARAMETER",ERR_INVALID_IP:"ERR_INVALID_IP"};function Ds(e,t){if(typeof e!="string")throw new tt(`invalid ip provided: ${e}`,Zr.ERR_INVALID_IP_PARAMETER);if(typeof t=="string"&&(t=parseInt(t)),isNaN(t))throw new tt(`invalid port provided: ${t}`,Zr.ERR_INVALID_PORT_PARAMETER);try{return new nt(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 tu.error(n),new tt(n,Zr.ERR_INVALID_IP)}}var Vs=H(Us(),1);var Jr=H(bt("os"),1),$s=H(bt("path"),1);var ou={ip4:"IPv4",ip6:"IPv6"};function ne(e,t={}){let r=e.getPath();return r!=null?Jr.default.platform()==="win32"?{path:$s.default.join("\\\\.\\pipe\\",r)}:{path:r}:{...e.toOptions(),...t}}function Yr(e,t,r){let n=i=>dt(`/${e}/${i}/tcp/${r}`);return(iu(t)?cu(ou[e]):[t]).map(n)}function iu(e){return["0.0.0.0","::"].includes(e)}var au=Jr.default.networkInterfaces();function cu(e){let t=[];for(let[,r]of Object.entries(au))if(r!=null)for(let n of r)n.family===e&&t.push(n.address);return t}var mt=Tt("libp2p:tcp:socket"),Le=(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 tt("Could not determine remote address or port","ERR_NO_REMOTE_ADDRESS");f=Ds(e.remoteAddress,e.remotePort)}let h=ne(f),g=h.path??`${h.host??""}:${h.port??""}`,{sink:C,source:l}=Vs.default.duplex(e);e.setTimeout(i,()=>{mt("%s socket read timeout",g),r?.increment({[`${n}timeout`]:!0});let x;e.readable&&(x=new tt("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 st=Tt("libp2p:tcp:listener");async function Qr(e){try{await e.close()}catch(t){st.error("an error occurred closing the connection",t)}}var lu=1,pu=0,Ue=class extends Be{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=js.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]:lu})}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]:pu}),this.dispatchEvent(new Qt("close"))})}onSocket(t){t.on("error",n=>{st("socket error",n),this.metrics?.events.increment({[`${this.addr} error`]:!0})});let r;try{r=Le(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){st.error("inbound connection failed",n),this.metrics?.errors.increment({[`${this.addr} inbound_to_connection`]:!0});return}st("new inbound connection %s",r.remoteAddr);try{this.context.upgrader.upgradeInbound(r).then(n=>{st("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=>{st.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=>{st.error("inbound connection failed",n),this.metrics?.errors.increment({[`${this.addr} inbound_upgrade`]:!0}),await Qr(r)}).catch(n=>{st.error("closing inbound connection failed",n)})}catch(n){st.error("inbound connection failed",n),Qr(r).catch(i=>{st.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(Yr("ip4",r.address,r.port)):r.family==="IPv6"&&(t=t.concat(Yr("ip6",r.address,r.port)))}catch(c){st.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 Qr(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)}),st("Listening on %s",this.server.address())}netClose(){!this.status.started||!this.server.listening||(st("Closing server on %s",this.server.address()),this.server.close())}};var vt=Tt("libp2p:tcp"),tn=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"})})}[fn]=!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=Le(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=zs.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 tt(`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 Ue({...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 mu(e={}){return(t={})=>new tn(t,e)}return Mi(gu);})();
|
|
7
7
|
return Libp2PTcp}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/tcp",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.2-e26848b0",
|
|
4
4
|
"description": "A TCP transport for libp2p",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/transport-tcp#readme",
|
|
@@ -50,16 +50,16 @@
|
|
|
50
50
|
"test:electron-main": "aegir test -t electron-main"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@libp2p/interface": "
|
|
54
|
-
"@libp2p/logger": "
|
|
55
|
-
"@libp2p/utils": "
|
|
53
|
+
"@libp2p/interface": "0.1.1-e26848b0",
|
|
54
|
+
"@libp2p/logger": "3.0.1-e26848b0",
|
|
55
|
+
"@libp2p/utils": "4.0.1-e26848b0",
|
|
56
56
|
"@multiformats/mafmt": "^12.1.2",
|
|
57
57
|
"@multiformats/multiaddr": "^12.1.3",
|
|
58
58
|
"@types/sinon": "^10.0.15",
|
|
59
59
|
"stream-to-it": "^0.2.2"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@libp2p/interface-compliance-tests": "
|
|
62
|
+
"@libp2p/interface-compliance-tests": "4.0.2-e26848b0",
|
|
63
63
|
"aegir": "^40.0.1",
|
|
64
64
|
"it-all": "^3.0.1",
|
|
65
65
|
"it-pipe": "^3.0.1",
|
package/dist/typedoc-urls.json
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"CloseServerOnMaxConnectionsOpts": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_tcp.unknown.CloseServerOnMaxConnectionsOpts.html",
|
|
3
|
-
"TCPComponents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_tcp.TCPComponents.html",
|
|
4
|
-
"TCPCreateListenerOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_tcp.TCPCreateListenerOptions.html",
|
|
5
|
-
"TCPDialOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_tcp.TCPDialOptions.html",
|
|
6
|
-
"TCPMetrics": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_tcp.TCPMetrics.html",
|
|
7
|
-
"TCPOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_tcp.TCPOptions.html",
|
|
8
|
-
"TCPSocketOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_tcp.TCPSocketOptions.html",
|
|
9
|
-
"tcp": "https://libp2p.github.io/js-libp2p/functions/_libp2p_tcp.tcp.html"
|
|
10
|
-
}
|