@libp2p/tcp 6.1.2 → 6.1.4

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