@libp2p/mdns 9.0.2 → 9.0.3-87165551

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.Libp2PMdns = factory()}(typeof self !== 'undefined' ? self : this, function () {
2
- "use strict";var Libp2PMdns=(()=>{var Gn=Object.create;var Ze=Object.defineProperty;var Xn=Object.getOwnPropertyDescriptor;var Qn=Object.getOwnPropertyNames;var Wn=Object.getPrototypeOf,Jn=Object.prototype.hasOwnProperty;var ce=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var L=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),q=(r,e)=>{for(var t in e)Ze(r,t,{get:e[t],enumerable:!0})},It=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Qn(e))!Jn.call(r,o)&&o!==t&&Ze(r,o,{get:()=>e[o],enumerable:!(n=Xn(e,o))||n.enumerable});return r};var $e=(r,e,t)=>(t=r!=null?Gn(Wn(r)):{},It(e||!r||!r.__esModule?Ze(t,"default",{value:r,enumerable:!0}):t,r)),Zn=r=>It(Ze({},"__esModule",{value:!0}),r);var vt=L((Ms,Ct)=>{var Te=1e3,Be=Te*60,Ne=Be*60,Se=Ne*24,fn=Se*7,eo=Se*365.25;Ct.exports=function(r,e){e=e||{};var t=typeof r;if(t==="string"&&r.length>0)return ro(r);if(t==="number"&&isFinite(r))return e.long?no(r):to(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function ro(r){if(r=String(r),!(r.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(e){var t=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return t*eo;case"weeks":case"week":case"w":return t*fn;case"days":case"day":case"d":return t*Se;case"hours":case"hour":case"hrs":case"hr":case"h":return t*Ne;case"minutes":case"minute":case"mins":case"min":case"m":return t*Be;case"seconds":case"second":case"secs":case"sec":case"s":return t*Te;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function to(r){var e=Math.abs(r);return e>=Se?Math.round(r/Se)+"d":e>=Ne?Math.round(r/Ne)+"h":e>=Be?Math.round(r/Be)+"m":e>=Te?Math.round(r/Te)+"s":r+"ms"}function no(r){var e=Math.abs(r);return e>=Se?rr(r,e,Se,"day"):e>=Ne?rr(r,e,Ne,"hour"):e>=Be?rr(r,e,Be,"minute"):e>=Te?rr(r,e,Te,"second"):r+" ms"}function rr(r,e,t,n){var o=e>=t*1.5;return Math.round(r/t)+" "+n+(o?"s":"")}});var Er=L((ks,bt)=>{function oo(r){t.debug=t,t.default=t,t.coerce=w,t.disable=i,t.enable=o,t.enabled=s,t.humanize=vt(),t.destroy=E,Object.keys(r).forEach(p=>{t[p]=r[p]}),t.names=[],t.skips=[],t.formatters={};function e(p){let a=0;for(let d=0;d<p.length;d++)a=(a<<5)-a+p.charCodeAt(d),a|=0;return t.colors[Math.abs(a)%t.colors.length]}t.selectColor=e;function t(p){let a,d=null,u,c;function g(...I){if(!g.enabled)return;let C=g,v=Number(new Date),B=v-(a||v);C.diff=B,C.prev=a,C.curr=v,a=v,I[0]=t.coerce(I[0]),typeof I[0]!="string"&&I.unshift("%O");let S=0;I[0]=I[0].replace(/%([a-zA-Z%])/g,(U,k)=>{if(U==="%%")return"%";S++;let H=t.formatters[k];if(typeof H=="function"){let Le=I[S];U=H.call(C,Le),I.splice(S,1),S--}return U}),t.formatArgs.call(C,I),(C.log||t.log).apply(C,I)}return g.namespace=p,g.useColors=t.useColors(),g.color=t.selectColor(p),g.extend=n,g.destroy=t.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(u!==t.namespaces&&(u=t.namespaces,c=t.enabled(p)),c),set:I=>{d=I}}),typeof t.init=="function"&&t.init(g),g}function n(p,a){let d=t(this.namespace+(typeof a>"u"?":":a)+p);return d.log=this.log,d}function o(p){t.save(p),t.namespaces=p,t.names=[],t.skips=[];let a,d=(typeof p=="string"?p:"").split(/[\s,]+/),u=d.length;for(a=0;a<u;a++)d[a]&&(p=d[a].replace(/\*/g,".*?"),p[0]==="-"?t.skips.push(new RegExp("^"+p.slice(1)+"$")):t.names.push(new RegExp("^"+p+"$")))}function i(){let p=[...t.names.map(l),...t.skips.map(l).map(a=>"-"+a)].join(",");return t.enable(""),p}function s(p){if(p[p.length-1]==="*")return!0;let a,d;for(a=0,d=t.skips.length;a<d;a++)if(t.skips[a].test(p))return!1;for(a=0,d=t.names.length;a<d;a++)if(t.names[a].test(p))return!0;return!1}function l(p){return p.toString().substring(2,p.toString().length-2).replace(/\.\*\?$/,"*")}function w(p){return p instanceof Error?p.stack||p.message:p}function E(){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 t.enable(t.load()),t}bt.exports=oo});var St=L((z,tr)=>{z.formatArgs=so;z.save=co;z.load=ao;z.useColors=io;z.storage=lo();z.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`."))}})();z.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 io(){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 so(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+tr.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;r.splice(1,0,e,"color: inherit");let t=0,n=0;r[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(t++,o==="%c"&&(n=t))}),r.splice(n,0,e)}z.log=console.debug||console.log||(()=>{});function co(r){try{r?z.storage.setItem("debug",r):z.storage.removeItem("debug")}catch{}}function ao(){let r;try{r=z.storage.getItem("debug")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function lo(){try{return localStorage}catch{}}tr.exports=Er()(z);var{formatters:uo}=tr.exports;uo.j=function(r){try{return JSON.stringify(r)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var At=L((qs,Ut)=>{"use strict";Ut.exports=(r,e)=>{e=e||process.argv;let t=r.startsWith("-")?"":r.length===1?"-":"--",n=e.indexOf(t+r),o=e.indexOf("--");return n!==-1&&(o===-1?!0:n<o)}});var Lt=L((zs,Ot)=>{"use strict";var ho=ce("os"),G=At(),R=process.env,Pe;G("no-color")||G("no-colors")||G("color=false")?Pe=!1:(G("color")||G("colors")||G("color=true")||G("color=always"))&&(Pe=!0);"FORCE_COLOR"in R&&(Pe=R.FORCE_COLOR.length===0||parseInt(R.FORCE_COLOR,10)!==0);function po(r){return r===0?!1:{level:r,hasBasic:!0,has256:r>=2,has16m:r>=3}}function go(r){if(Pe===!1)return 0;if(G("color=16m")||G("color=full")||G("color=truecolor"))return 3;if(G("color=256"))return 2;if(r&&!r.isTTY&&Pe!==!0)return 0;let e=Pe?1:0;if(process.platform==="win32"){let t=ho.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in R)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(t=>t in R)||R.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in R)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(R.TEAMCITY_VERSION)?1:0;if(R.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in R){let t=parseInt((R.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(R.TERM_PROGRAM){case"iTerm.app":return t>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(R.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(R.TERM)||"COLORTERM"in R?1:(R.TERM==="dumb",e)}function Ir(r){let e=go(r);return po(e)}Ot.exports={supportsColor:Ir,stdout:Ir(process.stdout),stderr:Ir(process.stderr)}});var Bt=L((P,or)=>{var mo=ce("tty"),nr=ce("util");P.init=vo;P.log=Io;P.formatArgs=wo;P.save=xo;P.load=Co;P.useColors=yo;P.destroy=nr.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");P.colors=[6,2,3,4,5,1];try{let r=Lt();r&&(r.stderr||r).level>=2&&(P.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{}P.inspectOpts=Object.keys(process.env).filter(r=>/^debug_/i.test(r)).reduce((r,e)=>{let t=e.substring(6).toLowerCase().replace(/_([a-z])/g,(o,i)=>i.toUpperCase()),n=process.env[e];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),r[t]=n,r},{});function yo(){return"colors"in P.inspectOpts?!!P.inspectOpts.colors:mo.isatty(process.stderr.fd)}function wo(r){let{namespace:e,useColors:t}=this;if(t){let n=this.color,o="\x1B[3"+(n<8?n:"8;5;"+n),i=` ${o};1m${e} \x1B[0m`;r[0]=i+r[0].split(`
2
+ "use strict";var Libp2PMdns=(()=>{var Gt=Object.create;var fe=Object.defineProperty;var Xt=Object.getOwnPropertyDescriptor;var Qt=Object.getOwnPropertyNames;var Wt=Object.getPrototypeOf,Jt=Object.prototype.hasOwnProperty;var ce=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var L=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),q=(r,e)=>{for(var n in e)fe(r,n,{get:e[n],enumerable:!0})},xn=(r,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Qt(e))!Jt.call(r,o)&&o!==n&&fe(r,o,{get:()=>e[o],enumerable:!(t=Xt(e,o))||t.enumerable});return r};var $e=(r,e,n)=>(n=r!=null?Gt(Wt(r)):{},xn(e||!r||!r.__esModule?fe(n,"default",{value:r,enumerable:!0}):n,r)),Zt=r=>xn(fe({},"__esModule",{value:!0}),r);var bn=L((Ms,vn)=>{var Te=1e3,Be=Te*60,Ne=Be*60,Se=Ne*24,ft=Se*7,eo=Se*365.25;vn.exports=function(r,e){e=e||{};var n=typeof r;if(n==="string"&&r.length>0)return ro(r);if(n==="number"&&isFinite(r))return e.long?to(r):no(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function ro(r){if(r=String(r),!(r.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(e){var n=parseFloat(e[1]),t=(e[2]||"ms").toLowerCase();switch(t){case"years":case"year":case"yrs":case"yr":case"y":return n*eo;case"weeks":case"week":case"w":return n*ft;case"days":case"day":case"d":return n*Se;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Ne;case"minutes":case"minute":case"mins":case"min":case"m":return n*Be;case"seconds":case"second":case"secs":case"sec":case"s":return n*Te;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function no(r){var e=Math.abs(r);return e>=Se?Math.round(r/Se)+"d":e>=Ne?Math.round(r/Ne)+"h":e>=Be?Math.round(r/Be)+"m":e>=Te?Math.round(r/Te)+"s":r+"ms"}function to(r){var e=Math.abs(r);return e>=Se?nr(r,e,Se,"day"):e>=Ne?nr(r,e,Ne,"hour"):e>=Be?nr(r,e,Be,"minute"):e>=Te?nr(r,e,Te,"second"):r+" ms"}function nr(r,e,n,t){var o=e>=n*1.5;return Math.round(r/n)+" "+t+(o?"s":"")}});var Er=L((ks,Sn)=>{function oo(r){n.debug=n,n.default=n,n.coerce=w,n.disable=i,n.enable=o,n.enabled=s,n.humanize=bn(),n.destroy=E,Object.keys(r).forEach(p=>{n[p]=r[p]}),n.names=[],n.skips=[],n.formatters={};function e(p){let a=0;for(let d=0;d<p.length;d++)a=(a<<5)-a+p.charCodeAt(d),a|=0;return n.colors[Math.abs(a)%n.colors.length]}n.selectColor=e;function n(p){let a,d=null,u,c;function g(...I){if(!g.enabled)return;let C=g,v=Number(new Date),B=v-(a||v);C.diff=B,C.prev=a,C.curr=v,a=v,I[0]=n.coerce(I[0]),typeof I[0]!="string"&&I.unshift("%O");let S=0;I[0]=I[0].replace(/%([a-zA-Z%])/g,(U,k)=>{if(U==="%%")return"%";S++;let H=n.formatters[k];if(typeof H=="function"){let Le=I[S];U=H.call(C,Le),I.splice(S,1),S--}return U}),n.formatArgs.call(C,I),(C.log||n.log).apply(C,I)}return g.namespace=p,g.useColors=n.useColors(),g.color=n.selectColor(p),g.extend=t,g.destroy=n.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(u!==n.namespaces&&(u=n.namespaces,c=n.enabled(p)),c),set:I=>{d=I}}),typeof n.init=="function"&&n.init(g),g}function t(p,a){let d=n(this.namespace+(typeof a>"u"?":":a)+p);return d.log=this.log,d}function o(p){n.save(p),n.namespaces=p,n.names=[],n.skips=[];let a,d=(typeof p=="string"?p:"").split(/[\s,]+/),u=d.length;for(a=0;a<u;a++)d[a]&&(p=d[a].replace(/\*/g,".*?"),p[0]==="-"?n.skips.push(new RegExp("^"+p.slice(1)+"$")):n.names.push(new RegExp("^"+p+"$")))}function i(){let p=[...n.names.map(l),...n.skips.map(l).map(a=>"-"+a)].join(",");return n.enable(""),p}function s(p){if(p[p.length-1]==="*")return!0;let a,d;for(a=0,d=n.skips.length;a<d;a++)if(n.skips[a].test(p))return!1;for(a=0,d=n.names.length;a<d;a++)if(n.names[a].test(p))return!0;return!1}function l(p){return p.toString().substring(2,p.toString().length-2).replace(/\.\*\?$/,"*")}function w(p){return p instanceof Error?p.stack||p.message:p}function E(){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 n.enable(n.load()),n}Sn.exports=oo});var Un=L((z,tr)=>{z.formatArgs=so;z.save=co;z.load=ao;z.useColors=io;z.storage=lo();z.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`."))}})();z.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 io(){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 so(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+tr.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;r.splice(1,0,e,"color: inherit");let n=0,t=0;r[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(n++,o==="%c"&&(t=n))}),r.splice(t,0,e)}z.log=console.debug||console.log||(()=>{});function co(r){try{r?z.storage.setItem("debug",r):z.storage.removeItem("debug")}catch{}}function ao(){let r;try{r=z.storage.getItem("debug")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function lo(){try{return localStorage}catch{}}tr.exports=Er()(z);var{formatters:uo}=tr.exports;uo.j=function(r){try{return JSON.stringify(r)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var On=L((qs,An)=>{"use strict";An.exports=(r,e)=>{e=e||process.argv;let n=r.startsWith("-")?"":r.length===1?"-":"--",t=e.indexOf(n+r),o=e.indexOf("--");return t!==-1&&(o===-1?!0:t<o)}});var Tn=L((zs,Ln)=>{"use strict";var ho=ce("os"),G=On(),R=process.env,Pe;G("no-color")||G("no-colors")||G("color=false")?Pe=!1:(G("color")||G("colors")||G("color=true")||G("color=always"))&&(Pe=!0);"FORCE_COLOR"in R&&(Pe=R.FORCE_COLOR.length===0||parseInt(R.FORCE_COLOR,10)!==0);function po(r){return r===0?!1:{level:r,hasBasic:!0,has256:r>=2,has16m:r>=3}}function go(r){if(Pe===!1)return 0;if(G("color=16m")||G("color=full")||G("color=truecolor"))return 3;if(G("color=256"))return 2;if(r&&!r.isTTY&&Pe!==!0)return 0;let e=Pe?1:0;if(process.platform==="win32"){let n=ho.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in R)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(n=>n in R)||R.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in R)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(R.TEAMCITY_VERSION)?1:0;if(R.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in R){let n=parseInt((R.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(R.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(R.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(R.TERM)||"COLORTERM"in R?1:(R.TERM==="dumb",e)}function Ir(r){let e=go(r);return po(e)}Ln.exports={supportsColor:Ir,stdout:Ir(process.stdout),stderr:Ir(process.stderr)}});var Nn=L((P,ir)=>{var mo=ce("tty"),or=ce("util");P.init=vo;P.log=Io;P.formatArgs=wo;P.save=xo;P.load=Co;P.useColors=yo;P.destroy=or.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");P.colors=[6,2,3,4,5,1];try{let r=Tn();r&&(r.stderr||r).level>=2&&(P.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{}P.inspectOpts=Object.keys(process.env).filter(r=>/^debug_/i.test(r)).reduce((r,e)=>{let n=e.substring(6).toLowerCase().replace(/_([a-z])/g,(o,i)=>i.toUpperCase()),t=process.env[e];return/^(yes|on|true|enabled)$/i.test(t)?t=!0:/^(no|off|false|disabled)$/i.test(t)?t=!1:t==="null"?t=null:t=Number(t),r[n]=t,r},{});function yo(){return"colors"in P.inspectOpts?!!P.inspectOpts.colors:mo.isatty(process.stderr.fd)}function wo(r){let{namespace:e,useColors:n}=this;if(n){let t=this.color,o="\x1B[3"+(t<8?t:"8;5;"+t),i=` ${o};1m${e} \x1B[0m`;r[0]=i+r[0].split(`
3
3
  `).join(`
4
- `+i),r.push(o+"m+"+or.exports.humanize(this.diff)+"\x1B[0m")}else r[0]=Eo()+e+" "+r[0]}function Eo(){return P.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Io(...r){return process.stderr.write(nr.format(...r)+`
5
- `)}function xo(r){r?process.env.DEBUG=r:delete process.env.DEBUG}function Co(){return process.env.DEBUG}function vo(r){r.inspectOpts={};let e=Object.keys(P.inspectOpts);for(let t=0;t<e.length;t++)r.inspectOpts[e[t]]=P.inspectOpts[e[t]]}or.exports=Er()(P);var{formatters:Tt}=or.exports;Tt.o=function(r){return this.inspectOpts.colors=this.useColors,nr.inspect(r,this.inspectOpts).split(`
6
- `).map(e=>e.trim()).join(" ")};Tt.O=function(r){return this.inspectOpts.colors=this.useColors,nr.inspect(r,this.inspectOpts)}});var Nt=L(($s,xr)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?xr.exports=St():xr.exports=Bt()});var kt=L(Tr=>{"use strict";Tr.toString=function(r){switch(r){case 1:return"A";case 10:return"NULL";case 28:return"AAAA";case 18:return"AFSDB";case 42:return"APL";case 257:return"CAA";case 60:return"CDNSKEY";case 59:return"CDS";case 37:return"CERT";case 5:return"CNAME";case 49:return"DHCID";case 32769:return"DLV";case 39:return"DNAME";case 48:return"DNSKEY";case 43:return"DS";case 55:return"HIP";case 13:return"HINFO";case 45:return"IPSECKEY";case 25:return"KEY";case 36:return"KX";case 29:return"LOC";case 15:return"MX";case 35:return"NAPTR";case 2:return"NS";case 47:return"NSEC";case 50:return"NSEC3";case 51:return"NSEC3PARAM";case 12:return"PTR";case 46:return"RRSIG";case 17:return"RP";case 24:return"SIG";case 6:return"SOA";case 99:return"SPF";case 33:return"SRV";case 44:return"SSHFP";case 32768:return"TA";case 249:return"TKEY";case 52:return"TLSA";case 250:return"TSIG";case 16:return"TXT";case 252:return"AXFR";case 251:return"IXFR";case 41:return"OPT";case 255:return"ANY"}return"UNKNOWN_"+r};Tr.toType=function(r){switch(r.toUpperCase()){case"A":return 1;case"NULL":return 10;case"AAAA":return 28;case"AFSDB":return 18;case"APL":return 42;case"CAA":return 257;case"CDNSKEY":return 60;case"CDS":return 59;case"CERT":return 37;case"CNAME":return 5;case"DHCID":return 49;case"DLV":return 32769;case"DNAME":return 39;case"DNSKEY":return 48;case"DS":return 43;case"HIP":return 55;case"HINFO":return 13;case"IPSECKEY":return 45;case"KEY":return 25;case"KX":return 36;case"LOC":return 29;case"MX":return 15;case"NAPTR":return 35;case"NS":return 2;case"NSEC":return 47;case"NSEC3":return 50;case"NSEC3PARAM":return 51;case"PTR":return 12;case"RRSIG":return 46;case"RP":return 17;case"SIG":return 24;case"SOA":return 6;case"SPF":return 99;case"SRV":return 33;case"SSHFP":return 44;case"TA":return 32768;case"TKEY":return 249;case"TLSA":return 52;case"TSIG":return 250;case"TXT":return 16;case"AXFR":return 252;case"IXFR":return 251;case"OPT":return 41;case"ANY":return 255;case"*":return 255}return r.toUpperCase().startsWith("UNKNOWN_")?parseInt(r.slice(8)):0}});var qt=L(Br=>{"use strict";Br.toString=function(r){switch(r){case 0:return"NOERROR";case 1:return"FORMERR";case 2:return"SERVFAIL";case 3:return"NXDOMAIN";case 4:return"NOTIMP";case 5:return"REFUSED";case 6:return"YXDOMAIN";case 7:return"YXRRSET";case 8:return"NXRRSET";case 9:return"NOTAUTH";case 10:return"NOTZONE";case 11:return"RCODE_11";case 12:return"RCODE_12";case 13:return"RCODE_13";case 14:return"RCODE_14";case 15:return"RCODE_15"}return"RCODE_"+r};Br.toRcode=function(r){switch(r.toUpperCase()){case"NOERROR":return 0;case"FORMERR":return 1;case"SERVFAIL":return 2;case"NXDOMAIN":return 3;case"NOTIMP":return 4;case"REFUSED":return 5;case"YXDOMAIN":return 6;case"YXRRSET":return 7;case"NXRRSET":return 8;case"NOTAUTH":return 9;case"NOTZONE":return 10;case"RCODE_11":return 11;case"RCODE_12":return 12;case"RCODE_13":return 13;case"RCODE_14":return 14;case"RCODE_15":return 15}return 0}});var zt=L(Nr=>{"use strict";Nr.toString=function(r){switch(r){case 0:return"QUERY";case 1:return"IQUERY";case 2:return"STATUS";case 3:return"OPCODE_3";case 4:return"NOTIFY";case 5:return"UPDATE";case 6:return"OPCODE_6";case 7:return"OPCODE_7";case 8:return"OPCODE_8";case 9:return"OPCODE_9";case 10:return"OPCODE_10";case 11:return"OPCODE_11";case 12:return"OPCODE_12";case 13:return"OPCODE_13";case 14:return"OPCODE_14";case 15:return"OPCODE_15"}return"OPCODE_"+r};Nr.toOpcode=function(r){switch(r.toUpperCase()){case"QUERY":return 0;case"IQUERY":return 1;case"STATUS":return 2;case"OPCODE_3":return 3;case"NOTIFY":return 4;case"UPDATE":return 5;case"OPCODE_6":return 6;case"OPCODE_7":return 7;case"OPCODE_8":return 8;case"OPCODE_9":return 9;case"OPCODE_10":return 10;case"OPCODE_11":return 11;case"OPCODE_12":return 12;case"OPCODE_13":return 13;case"OPCODE_14":return 14;case"OPCODE_15":return 15}return 0}});var $t=L(Pr=>{"use strict";Pr.toString=function(r){switch(r){case 1:return"IN";case 2:return"CS";case 3:return"CH";case 4:return"HS";case 255:return"ANY"}return"UNKNOWN_"+r};Pr.toClass=function(r){switch(r.toUpperCase()){case"IN":return 1;case"CS":return 2;case"CH":return 3;case"HS":return 4;case"ANY":return 255}return 0}});var Vt=L(Dr=>{"use strict";Dr.toString=function(r){switch(r){case 1:return"LLQ";case 2:return"UL";case 3:return"NSID";case 5:return"DAU";case 6:return"DHU";case 7:return"N3U";case 8:return"CLIENT_SUBNET";case 9:return"EXPIRE";case 10:return"COOKIE";case 11:return"TCP_KEEPALIVE";case 12:return"PADDING";case 13:return"CHAIN";case 14:return"KEY_TAG";case 26946:return"DEVICEID"}return r<0?null:`OPTION_${r}`};Dr.toCode=function(r){if(typeof r=="number")return r;if(!r)return-1;switch(r.toUpperCase()){case"OPTION_0":return 0;case"LLQ":return 1;case"UL":return 2;case"NSID":return 3;case"OPTION_4":return 4;case"DAU":return 5;case"DHU":return 6;case"N3U":return 7;case"CLIENT_SUBNET":return 8;case"EXPIRE":return 9;case"COOKIE":return 10;case"TCP_KEEPALIVE":return 11;case"PADDING":return 12;case"CHAIN":return 13;case"KEY_TAG":return 14;case"DEVICEID":return 26946;case"OPTION_65535":return 65535}let e=r.match(/_(\d+)$/);return e?parseInt(e[1],10):-1}});var Ht=L((Kt,Rr)=>{var jt=function(r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.decode=a,r.encode=p,r.familyOf=E,r.name=void 0,r.sizeOf=w,r.v6=r.v4=void 0;let e=/^(\d{1,3}\.){3,3}\d{1,3}$/,t=4,n=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i,o=16,i={name:"v4",size:t,isFormat:d=>e.test(d),encode(d,u,c){c=~~c,u=u||new Uint8Array(c+t);let g=d.length,I=0;for(let C=0;C<g;){let v=d.charCodeAt(C++);v===46?(u[c++]=I,I=0):I=I*10+(v-48)}return u[c]=I,u},decode(d,u){return u=~~u,`${d[u++]}.${d[u++]}.${d[u++]}.${d[u]}`}};r.v4=i;let s={name:"v6",size:o,isFormat:d=>d.length>0&&n.test(d),encode(d,u,c){c=~~c;let g=c+o,I=-1,C=0,v=0,B=!0,S=!1;u=u||new Uint8Array(c+o);for(let O=0;O<d.length;O++){let U=d.charCodeAt(O);U===58?(B?I!==-1?(c<g&&(u[c]=0),c<g-1&&(u[c+1]=0),c+=2):c<g&&(I=c):(S===!0?(c<g&&(u[c]=v),c++):(c<g&&(u[c]=C>>8),c<g-1&&(u[c+1]=C&255),c+=2),C=0,v=0),B=!0,S=!1):U===46?(c<g&&(u[c]=v),c++,v=0,C=0,B=!1,S=!0):(B=!1,U>=97?U-=87:U>=65?U-=55:(U-=48,v=v*10+U),C=(C<<4)+U)}if(B===!1)S===!0?(c<g&&(u[c]=v),c++):(c<g&&(u[c]=C>>8),c<g-1&&(u[c+1]=C&255),c+=2);else if(I===0)c<g&&(u[c]=0),c<g-1&&(u[c+1]=0),c+=2;else if(I!==-1){c+=2;for(let O=Math.min(c-1,g-1);O>=I+2;O--)u[O]=u[O-2];u[I]=0,u[I+1]=0,I=c}if(I!==c&&I!==-1)for(c>g-2&&(c=g-2);g>I;)u[--g]=c<g&&c>I?u[--c]:0;else for(;c<g;)u[c++]=0;return u},decode(d,u){u=~~u;let c="";for(let g=0;g<o;g+=2)g!==0&&(c+=":"),c+=(d[u+g]<<8|d[u+g+1]).toString(16);return c.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}};r.v6=s;let l="ip";r.name=l;function w(d){if(i.isFormat(d))return i.size;if(s.isFormat(d))return s.size;throw Error(`Invalid ip address: ${d}`)}function E(d){return w(d)===i.size?1:2}function p(d,u,c){c=~~c;let g=w(d);return typeof u=="function"&&(u=u(c+g)),g===i.size?i.encode(d,u,c):s.encode(d,u,c)}function a(d,u,c){if(u=~~u,c=c||d.length-u,c===i.size)return i.decode(d,u,c);if(c===s.size)return s.decode(d,u,c);throw Error(`Invalid buffer size needs to be ${i.size} for v4 or ${s.size} for v6.`)}return"default"in r?r.default:r}({});typeof define=="function"&&define.amd?define([],function(){return jt}):typeof Rr=="object"&&typeof Kt=="object"&&(Rr.exports=jt)});var Xt=L(m=>{"use strict";var y=ce("buffer").Buffer,we=kt(),$o=qt(),Vo=zt(),cr=$t(),Fr=Vt(),Ue=Ht(),jo=0,Yt=32768,_r=32768,Ko=~_r,Gt=32768,Ho=~Gt,h=m.name={};h.encode=function(r,e,t){e||(e=y.alloc(h.encodingLength(r))),t||(t=0);let n=t,o=r.replace(/^\.|\.$/gm,"");if(o.length){let i=o.split(".");for(let s=0;s<i.length;s++){let l=e.write(i[s],t+1);e[t]=l,t+=l+1}}return e[t++]=0,h.encode.bytes=t-n,e};h.encode.bytes=0;h.decode=function(r,e){e||(e=0);let t=[],n=e,o=0,i=0,s=!1;for(;;){if(e>=r.length)throw new Error("Cannot decode name (buffer overflow)");let l=r[e++];if(i+=s?0:1,l===0)break;if(l&192)if((l&192)===192){if(e+1>r.length)throw new Error("Cannot decode name (buffer overflow)");let w=r.readUInt16BE(e-1)-49152;if(w>=n)throw new Error("Cannot decode name (bad pointer)");e=w,n=w,i+=s?0:1,s=!0}else throw new Error("Cannot decode name (bad label)");else{if(e+l>r.length)throw new Error("Cannot decode name (buffer overflow)");if(o+=l+1,o>254)throw new Error("Cannot decode name (name too long)");t.push(r.toString("utf-8",e,e+l)),e+=l,i+=s?0:l}}return h.decode.bytes=i,t.length===0?".":t.join(".")};h.decode.bytes=0;h.encodingLength=function(r){return r==="."||r===".."?1:y.byteLength(r.replace(/^\.|\.$/gm,""))+2};var x={};x.encode=function(r,e,t){e||(e=y.alloc(x.encodingLength(r))),t||(t=0);let n=e.write(r,t+1);return e[t]=n,x.encode.bytes=n+1,e};x.encode.bytes=0;x.decode=function(r,e){e||(e=0);let t=r[e],n=r.toString("utf-8",e+1,e+1+t);return x.decode.bytes=t+1,n};x.decode.bytes=0;x.encodingLength=function(r){return y.byteLength(r)+1};var J={};J.encode=function(r,e,t){e||(e=J.encodingLength(r)),t||(t=0);let n=(r.flags||0)&32767,o=r.type==="response"?Yt:jo;return e.writeUInt16BE(r.id||0,t),e.writeUInt16BE(n|o,t+2),e.writeUInt16BE(r.questions.length,t+4),e.writeUInt16BE(r.answers.length,t+6),e.writeUInt16BE(r.authorities.length,t+8),e.writeUInt16BE(r.additionals.length,t+10),e};J.encode.bytes=12;J.decode=function(r,e){if(e||(e=0),r.length<12)throw new Error("Header must be 12 bytes");let t=r.readUInt16BE(e+2);return{id:r.readUInt16BE(e),type:t&Yt?"response":"query",flags:t&32767,flag_qr:(t>>15&1)===1,opcode:Vo.toString(t>>11&15),flag_aa:(t>>10&1)===1,flag_tc:(t>>9&1)===1,flag_rd:(t>>8&1)===1,flag_ra:(t>>7&1)===1,flag_z:(t>>6&1)===1,flag_ad:(t>>5&1)===1,flag_cd:(t>>4&1)===1,rcode:$o.toString(t&15),questions:new Array(r.readUInt16BE(e+4)),answers:new Array(r.readUInt16BE(e+6)),authorities:new Array(r.readUInt16BE(e+8)),additionals:new Array(r.readUInt16BE(e+10))}};J.decode.bytes=12;J.encodingLength=function(){return 12};var ae=m.unknown={};ae.encode=function(r,e,t){return e||(e=y.alloc(ae.encodingLength(r))),t||(t=0),e.writeUInt16BE(r.length,t),r.copy(e,t+2),ae.encode.bytes=r.length+2,e};ae.encode.bytes=0;ae.decode=function(r,e){e||(e=0);let t=r.readUInt16BE(e),n=r.slice(e+2,e+2+t);return ae.decode.bytes=t+2,n};ae.decode.bytes=0;ae.encodingLength=function(r){return r.length+2};var de=m.ns={};de.encode=function(r,e,t){return e||(e=y.alloc(de.encodingLength(r))),t||(t=0),h.encode(r,e,t+2),e.writeUInt16BE(h.encode.bytes,t),de.encode.bytes=h.encode.bytes+2,e};de.encode.bytes=0;de.decode=function(r,e){e||(e=0);let t=r.readUInt16BE(e),n=h.decode(r,e+2);return de.decode.bytes=t+2,n};de.decode.bytes=0;de.encodingLength=function(r){return h.encodingLength(r)+2};var le=m.soa={};le.encode=function(r,e,t){e||(e=y.alloc(le.encodingLength(r))),t||(t=0);let n=t;return t+=2,h.encode(r.mname,e,t),t+=h.encode.bytes,h.encode(r.rname,e,t),t+=h.encode.bytes,e.writeUInt32BE(r.serial||0,t),t+=4,e.writeUInt32BE(r.refresh||0,t),t+=4,e.writeUInt32BE(r.retry||0,t),t+=4,e.writeUInt32BE(r.expire||0,t),t+=4,e.writeUInt32BE(r.minimum||0,t),t+=4,e.writeUInt16BE(t-n-2,n),le.encode.bytes=t-n,e};le.encode.bytes=0;le.decode=function(r,e){e||(e=0);let t=e,n={};return e+=2,n.mname=h.decode(r,e),e+=h.decode.bytes,n.rname=h.decode(r,e),e+=h.decode.bytes,n.serial=r.readUInt32BE(e),e+=4,n.refresh=r.readUInt32BE(e),e+=4,n.retry=r.readUInt32BE(e),e+=4,n.expire=r.readUInt32BE(e),e+=4,n.minimum=r.readUInt32BE(e),e+=4,le.decode.bytes=e-t,n};le.decode.bytes=0;le.encodingLength=function(r){return 22+h.encodingLength(r.mname)+h.encodingLength(r.rname)};var ue=m.txt={};ue.encode=function(r,e,t){Array.isArray(r)||(r=[r]);for(let o=0;o<r.length;o++)if(typeof r[o]=="string"&&(r[o]=y.from(r[o])),!y.isBuffer(r[o]))throw new Error("Must be a Buffer");e||(e=y.alloc(ue.encodingLength(r))),t||(t=0);let n=t;return t+=2,r.forEach(function(o){e[t++]=o.length,o.copy(e,t,0,o.length),t+=o.length}),e.writeUInt16BE(t-n-2,n),ue.encode.bytes=t-n,e};ue.encode.bytes=0;ue.decode=function(r,e){e||(e=0);let t=e,n=r.readUInt16BE(e);e+=2;let o=[];for(;n>0;){let i=r[e++];if(--n,n<i)throw new Error("Buffer overflow");o.push(r.slice(e,e+i)),e+=i,n-=i}return ue.decode.bytes=e-t,o};ue.decode.bytes=0;ue.encodingLength=function(r){Array.isArray(r)||(r=[r]);let e=2;return r.forEach(function(t){typeof t=="string"?e+=y.byteLength(t)+1:e+=t.length+1}),e};var he=m.null={};he.encode=function(r,e,t){e||(e=y.alloc(he.encodingLength(r))),t||(t=0),typeof r=="string"&&(r=y.from(r)),r||(r=y.alloc(0));let n=t;t+=2;let o=r.length;return r.copy(e,t,0,o),t+=o,e.writeUInt16BE(t-n-2,n),he.encode.bytes=t-n,e};he.encode.bytes=0;he.decode=function(r,e){e||(e=0);let t=e,n=r.readUInt16BE(e);e+=2;let o=r.slice(e,e+n);return e+=n,he.decode.bytes=e-t,o};he.decode.bytes=0;he.encodingLength=function(r){return r?(y.isBuffer(r)?r.length:y.byteLength(r))+2:2};var pe=m.hinfo={};pe.encode=function(r,e,t){e||(e=y.alloc(pe.encodingLength(r))),t||(t=0);let n=t;return t+=2,x.encode(r.cpu,e,t),t+=x.encode.bytes,x.encode(r.os,e,t),t+=x.encode.bytes,e.writeUInt16BE(t-n-2,n),pe.encode.bytes=t-n,e};pe.encode.bytes=0;pe.decode=function(r,e){e||(e=0);let t=e,n={};return e+=2,n.cpu=x.decode(r,e),e+=x.decode.bytes,n.os=x.decode(r,e),e+=x.decode.bytes,pe.decode.bytes=e-t,n};pe.decode.bytes=0;pe.encodingLength=function(r){return x.encodingLength(r.cpu)+x.encodingLength(r.os)+2};var Q=m.ptr={},Yo=m.cname=Q,Go=m.dname=Q;Q.encode=function(r,e,t){return e||(e=y.alloc(Q.encodingLength(r))),t||(t=0),h.encode(r,e,t+2),e.writeUInt16BE(h.encode.bytes,t),Q.encode.bytes=h.encode.bytes+2,e};Q.encode.bytes=0;Q.decode=function(r,e){e||(e=0);let t=h.decode(r,e+2);return Q.decode.bytes=h.decode.bytes+2,t};Q.decode.bytes=0;Q.encodingLength=function(r){return h.encodingLength(r)+2};var ge=m.srv={};ge.encode=function(r,e,t){e||(e=y.alloc(ge.encodingLength(r))),t||(t=0),e.writeUInt16BE(r.priority||0,t+2),e.writeUInt16BE(r.weight||0,t+4),e.writeUInt16BE(r.port||0,t+6),h.encode(r.target,e,t+8);let n=h.encode.bytes+6;return e.writeUInt16BE(n,t),ge.encode.bytes=n+2,e};ge.encode.bytes=0;ge.decode=function(r,e){e||(e=0);let t=r.readUInt16BE(e),n={};return n.priority=r.readUInt16BE(e+2),n.weight=r.readUInt16BE(e+4),n.port=r.readUInt16BE(e+6),n.target=h.decode(r,e+8),ge.decode.bytes=t+2,n};ge.decode.bytes=0;ge.encodingLength=function(r){return 8+h.encodingLength(r.target)};var V=m.caa={};V.ISSUER_CRITICAL=128;V.encode=function(r,e,t){let n=V.encodingLength(r);return e||(e=y.alloc(V.encodingLength(r))),t||(t=0),r.issuerCritical&&(r.flags=V.ISSUER_CRITICAL),e.writeUInt16BE(n-2,t),t+=2,e.writeUInt8(r.flags||0,t),t+=1,x.encode(r.tag,e,t),t+=x.encode.bytes,e.write(r.value,t),t+=y.byteLength(r.value),V.encode.bytes=n,e};V.encode.bytes=0;V.decode=function(r,e){e||(e=0);let t=r.readUInt16BE(e);e+=2;let n=e,o={};return o.flags=r.readUInt8(e),e+=1,o.tag=x.decode(r,e),e+=x.decode.bytes,o.value=r.toString("utf-8",e,n+t),o.issuerCritical=!!(o.flags&V.ISSUER_CRITICAL),V.decode.bytes=t+2,o};V.decode.bytes=0;V.encodingLength=function(r){return x.encodingLength(r.tag)+x.encodingLength(r.value)+2};var xe=m.mx={};xe.encode=function(r,e,t){e||(e=y.alloc(xe.encodingLength(r))),t||(t=0);let n=t;return t+=2,e.writeUInt16BE(r.preference||0,t),t+=2,h.encode(r.exchange,e,t),t+=h.encode.bytes,e.writeUInt16BE(t-n-2,n),xe.encode.bytes=t-n,e};xe.encode.bytes=0;xe.decode=function(r,e){e||(e=0);let t=e,n={};return e+=2,n.preference=r.readUInt16BE(e),e+=2,n.exchange=h.decode(r,e),e+=h.decode.bytes,xe.decode.bytes=e-t,n};xe.encodingLength=function(r){return 4+h.encodingLength(r.exchange)};var me=m.a={};me.encode=function(r,e,t){return e||(e=y.alloc(me.encodingLength(r))),t||(t=0),e.writeUInt16BE(4,t),t+=2,Ue.v4.encode(r,e,t),me.encode.bytes=6,e};me.encode.bytes=0;me.decode=function(r,e){e||(e=0),e+=2;let t=Ue.v4.decode(r,e);return me.decode.bytes=6,t};me.decode.bytes=0;me.encodingLength=function(){return 6};var ye=m.aaaa={};ye.encode=function(r,e,t){return e||(e=y.alloc(ye.encodingLength(r))),t||(t=0),e.writeUInt16BE(16,t),t+=2,Ue.v6.encode(r,e,t),ye.encode.bytes=18,e};ye.encode.bytes=0;ye.decode=function(r,e){e||(e=0),e+=2;let t=Ue.v6.decode(r,e);return ye.decode.bytes=18,t};ye.decode.bytes=0;ye.encodingLength=function(){return 18};var _=m.option={};_.encode=function(r,e,t){e||(e=y.alloc(_.encodingLength(r))),t||(t=0);let n=t,o=Fr.toCode(r.code);if(e.writeUInt16BE(o,t),t+=2,r.data)e.writeUInt16BE(r.data.length,t),t+=2,r.data.copy(e,t),t+=r.data.length;else switch(o){case 8:let i=r.sourcePrefixLength||0,s=r.family||Ue.familyOf(r.ip),l=Ue.encode(r.ip,y.alloc),w=Math.ceil(i/8);e.writeUInt16BE(w+4,t),t+=2,e.writeUInt16BE(s,t),t+=2,e.writeUInt8(i,t++),e.writeUInt8(r.scopePrefixLength||0,t++),l.copy(e,t,0,w),t+=w;break;case 11:r.timeout?(e.writeUInt16BE(2,t),t+=2,e.writeUInt16BE(r.timeout,t),t+=2):(e.writeUInt16BE(0,t),t+=2);break;case 12:let E=r.length||0;e.writeUInt16BE(E,t),t+=2,e.fill(0,t,t+E),t+=E;break;case 14:let p=r.tags.length*2;e.writeUInt16BE(p,t),t+=2;for(let a of r.tags)e.writeUInt16BE(a,t),t+=2;break;default:throw new Error(`Unknown roption code: ${r.code}`)}return _.encode.bytes=t-n,e};_.encode.bytes=0;_.decode=function(r,e){e||(e=0);let t={};t.code=r.readUInt16BE(e),t.type=Fr.toString(t.code),e+=2;let n=r.readUInt16BE(e);switch(e+=2,t.data=r.slice(e,e+n),t.code){case 8:t.family=r.readUInt16BE(e),e+=2,t.sourcePrefixLength=r.readUInt8(e++),t.scopePrefixLength=r.readUInt8(e++);let o=y.alloc(t.family===1?4:16);r.copy(o,0,e,e+n-4),t.ip=Ue.decode(o);break;case 11:n>0&&(t.timeout=r.readUInt16BE(e),e+=2);break;case 14:t.tags=[];for(let i=0;i<n;i+=2)t.tags.push(r.readUInt16BE(e)),e+=2}return _.decode.bytes=n+4,t};_.decode.bytes=0;_.encodingLength=function(r){if(r.data)return r.data.length+4;switch(Fr.toCode(r.code)){case 8:let t=r.sourcePrefixLength||0;return Math.ceil(t/8)+8;case 11:return typeof r.timeout=="number"?6:4;case 12:return r.length+4;case 14:return 4+r.tags.length*2}throw new Error(`Unknown roption code: ${r.code}`)};var K=m.opt={};K.encode=function(r,e,t){e||(e=y.alloc(K.encodingLength(r))),t||(t=0);let n=t,o=Re(r,_);return e.writeUInt16BE(o,t),t=Ve(r,_,e,t+2),K.encode.bytes=t-n,e};K.encode.bytes=0;K.decode=function(r,e){e||(e=0);let t=e,n=[],o=r.readUInt16BE(e);e+=2;let i=0;for(;o>0;)n[i++]=_.decode(r,e),e+=_.decode.bytes,o-=_.decode.bytes;return K.decode.bytes=e-t,n};K.decode.bytes=0;K.encodingLength=function(r){return 2+Re(r||[],_)};var F=m.dnskey={};F.PROTOCOL_DNSSEC=3;F.ZONE_KEY=128;F.SECURE_ENTRYPOINT=32768;F.encode=function(r,e,t){e||(e=y.alloc(F.encodingLength(r))),t||(t=0);let n=t,o=r.key;if(!y.isBuffer(o))throw new Error("Key must be a Buffer");return t+=2,e.writeUInt16BE(r.flags,t),t+=2,e.writeUInt8(F.PROTOCOL_DNSSEC,t),t+=1,e.writeUInt8(r.algorithm,t),t+=1,o.copy(e,t,0,o.length),t+=o.length,F.encode.bytes=t-n,e.writeUInt16BE(F.encode.bytes-2,n),e};F.encode.bytes=0;F.decode=function(r,e){e||(e=0);let t=e;var n={},o=r.readUInt16BE(e);if(e+=2,n.flags=r.readUInt16BE(e),e+=2,r.readUInt8(e)!==F.PROTOCOL_DNSSEC)throw new Error("Protocol must be 3");return e+=1,n.algorithm=r.readUInt8(e),e+=1,n.key=r.slice(e,t+o+2),e+=n.key.length,F.decode.bytes=e-t,n};F.decode.bytes=0;F.encodingLength=function(r){return 6+y.byteLength(r.key)};var f=m.rrsig={};f.encode=function(r,e,t){e||(e=y.alloc(f.encodingLength(r))),t||(t=0);let n=t,o=r.signature;if(!y.isBuffer(o))throw new Error("Signature must be a Buffer");return t+=2,e.writeUInt16BE(we.toType(r.typeCovered),t),t+=2,e.writeUInt8(r.algorithm,t),t+=1,e.writeUInt8(r.labels,t),t+=1,e.writeUInt32BE(r.originalTTL,t),t+=4,e.writeUInt32BE(r.expiration,t),t+=4,e.writeUInt32BE(r.inception,t),t+=4,e.writeUInt16BE(r.keyTag,t),t+=2,h.encode(r.signersName,e,t),t+=h.encode.bytes,o.copy(e,t,0,o.length),t+=o.length,f.encode.bytes=t-n,e.writeUInt16BE(f.encode.bytes-2,n),e};f.encode.bytes=0;f.decode=function(r,e){e||(e=0);let t=e;var n={},o=r.readUInt16BE(e);return e+=2,n.typeCovered=we.toString(r.readUInt16BE(e)),e+=2,n.algorithm=r.readUInt8(e),e+=1,n.labels=r.readUInt8(e),e+=1,n.originalTTL=r.readUInt32BE(e),e+=4,n.expiration=r.readUInt32BE(e),e+=4,n.inception=r.readUInt32BE(e),e+=4,n.keyTag=r.readUInt16BE(e),e+=2,n.signersName=h.decode(r,e),e+=h.decode.bytes,n.signature=r.slice(e,t+o+2),e+=n.signature.length,f.decode.bytes=e-t,n};f.decode.bytes=0;f.encodingLength=function(r){return 20+h.encodingLength(r.signersName)+y.byteLength(r.signature)};var ee=m.rp={};ee.encode=function(r,e,t){e||(e=y.alloc(ee.encodingLength(r))),t||(t=0);let n=t;return t+=2,h.encode(r.mbox||".",e,t),t+=h.encode.bytes,h.encode(r.txt||".",e,t),t+=h.encode.bytes,ee.encode.bytes=t-n,e.writeUInt16BE(ee.encode.bytes-2,n),e};ee.encode.bytes=0;ee.decode=function(r,e){e||(e=0);let t=e,n={};return e+=2,n.mbox=h.decode(r,e)||".",e+=h.decode.bytes,n.txt=h.decode(r,e)||".",e+=h.decode.bytes,ee.decode.bytes=e-t,n};ee.decode.bytes=0;ee.encodingLength=function(r){return 2+h.encodingLength(r.mbox||".")+h.encodingLength(r.txt||".")};var N={};N.encode=function(r,e,t){e||(e=y.alloc(N.encodingLength(r))),t||(t=0);let n=t;for(var o=[],i=0;i<r.length;i++){var s=we.toType(r[i]);o[s>>8]===void 0&&(o[s>>8]=[]),o[s>>8][s>>3&31]|=1<<7-(s&7)}for(i=0;i<o.length;i++)if(o[i]!==void 0){var l=y.from(o[i]);e.writeUInt8(i,t),t+=1,e.writeUInt8(l.length,t),t+=1,l.copy(e,t),t+=l.length}return N.encode.bytes=t-n,e};N.encode.bytes=0;N.decode=function(r,e,t){e||(e=0);let n=e;for(var o=[];e-n<t;){var i=r.readUInt8(e);e+=1;var s=r.readUInt8(e);e+=1;for(var l=0;l<s;l++)for(var w=r.readUInt8(e+l),E=0;E<8;E++)if(w&1<<7-E){var p=we.toString(i<<8|l<<3|E);o.push(p)}e+=s}return N.decode.bytes=e-n,o};N.decode.bytes=0;N.encodingLength=function(r){for(var e=[],t=0;t<r.length;t++){var n=we.toType(r[t]);e[n>>8]=Math.max(e[n>>8]||0,n&255)}var o=0;for(t=0;t<e.length;t++)e[t]!==void 0&&(o+=2+Math.ceil((e[t]+1)/8));return o};var re=m.nsec={};re.encode=function(r,e,t){e||(e=y.alloc(re.encodingLength(r))),t||(t=0);let n=t;return t+=2,h.encode(r.nextDomain,e,t),t+=h.encode.bytes,N.encode(r.rrtypes,e,t),t+=N.encode.bytes,re.encode.bytes=t-n,e.writeUInt16BE(re.encode.bytes-2,n),e};re.encode.bytes=0;re.decode=function(r,e){e||(e=0);let t=e;var n={},o=r.readUInt16BE(e);return e+=2,n.nextDomain=h.decode(r,e),e+=h.decode.bytes,n.rrtypes=N.decode(r,e,o-(e-t)),e+=N.decode.bytes,re.decode.bytes=e-t,n};re.decode.bytes=0;re.encodingLength=function(r){return 2+h.encodingLength(r.nextDomain)+N.encodingLength(r.rrtypes)};var te=m.nsec3={};te.encode=function(r,e,t){e||(e=y.alloc(te.encodingLength(r))),t||(t=0);let n=t,o=r.salt;if(!y.isBuffer(o))throw new Error("salt must be a Buffer");let i=r.nextDomain;if(!y.isBuffer(i))throw new Error("nextDomain must be a Buffer");return t+=2,e.writeUInt8(r.algorithm,t),t+=1,e.writeUInt8(r.flags,t),t+=1,e.writeUInt16BE(r.iterations,t),t+=2,e.writeUInt8(o.length,t),t+=1,o.copy(e,t,0,o.length),t+=o.length,e.writeUInt8(i.length,t),t+=1,i.copy(e,t,0,i.length),t+=i.length,N.encode(r.rrtypes,e,t),t+=N.encode.bytes,te.encode.bytes=t-n,e.writeUInt16BE(te.encode.bytes-2,n),e};te.encode.bytes=0;te.decode=function(r,e){e||(e=0);let t=e;var n={},o=r.readUInt16BE(e);e+=2,n.algorithm=r.readUInt8(e),e+=1,n.flags=r.readUInt8(e),e+=1,n.iterations=r.readUInt16BE(e),e+=2;let i=r.readUInt8(e);e+=1,n.salt=r.slice(e,e+i),e+=i;let s=r.readUInt8(e);return e+=1,n.nextDomain=r.slice(e,e+s),e+=s,n.rrtypes=N.decode(r,e,o-(e-t)),e+=N.decode.bytes,te.decode.bytes=e-t,n};te.decode.bytes=0;te.encodingLength=function(r){return 8+r.salt.length+r.nextDomain.length+N.encodingLength(r.rrtypes)};var ne=m.ds={};ne.encode=function(r,e,t){e||(e=y.alloc(ne.encodingLength(r))),t||(t=0);let n=t,o=r.digest;if(!y.isBuffer(o))throw new Error("Digest must be a Buffer");return t+=2,e.writeUInt16BE(r.keyTag,t),t+=2,e.writeUInt8(r.algorithm,t),t+=1,e.writeUInt8(r.digestType,t),t+=1,o.copy(e,t,0,o.length),t+=o.length,ne.encode.bytes=t-n,e.writeUInt16BE(ne.encode.bytes-2,n),e};ne.encode.bytes=0;ne.decode=function(r,e){e||(e=0);let t=e;var n={},o=r.readUInt16BE(e);return e+=2,n.keyTag=r.readUInt16BE(e),e+=2,n.algorithm=r.readUInt8(e),e+=1,n.digestType=r.readUInt8(e),e+=1,n.digest=r.slice(e,t+o+2),e+=n.digest.length,ne.decode.bytes=e-t,n};ne.decode.bytes=0;ne.encodingLength=function(r){return 6+y.byteLength(r.digest)};var j=m.sshfp={};j.getFingerprintLengthForHashType=function(e){switch(e){case 1:return 20;case 2:return 32}};j.encode=function(e,t,n){t||(t=y.alloc(j.encodingLength(e))),n||(n=0);let o=n;n+=2,t[n]=e.algorithm,n+=1,t[n]=e.hash,n+=1;let i=y.from(e.fingerprint.toUpperCase(),"hex");if(i.length!==j.getFingerprintLengthForHashType(e.hash))throw new Error("Invalid fingerprint length");return i.copy(t,n),n+=i.byteLength,j.encode.bytes=n-o,t.writeUInt16BE(j.encode.bytes-2,o),t};j.encode.bytes=0;j.decode=function(e,t){t||(t=0);let n=t,o={};t+=2,o.algorithm=e[t],t+=1,o.hash=e[t],t+=1;let i=j.getFingerprintLengthForHashType(o.hash);return o.fingerprint=e.slice(t,t+i).toString("hex").toUpperCase(),t+=i,j.decode.bytes=t-n,o};j.decode.bytes=0;j.encodingLength=function(r){return 4+y.from(r.fingerprint,"hex").byteLength};var oe=m.naptr={};oe.encode=function(r,e,t){e||(e=y.alloc(oe.encodingLength(r))),t||(t=0);let n=t;return t+=2,e.writeUInt16BE(r.order||0,t),t+=2,e.writeUInt16BE(r.preference||0,t),t+=2,x.encode(r.flags,e,t),t+=x.encode.bytes,x.encode(r.services,e,t),t+=x.encode.bytes,x.encode(r.regexp,e,t),t+=x.encode.bytes,h.encode(r.replacement,e,t),t+=h.encode.bytes,oe.encode.bytes=t-n,e.writeUInt16BE(oe.encode.bytes-2,n),e};oe.encode.bytes=0;oe.decode=function(r,e){e||(e=0);let t=e,n={};return e+=2,n.order=r.readUInt16BE(e),e+=2,n.preference=r.readUInt16BE(e),e+=2,n.flags=x.decode(r,e),e+=x.decode.bytes,n.services=x.decode(r,e),e+=x.decode.bytes,n.regexp=x.decode(r,e),e+=x.decode.bytes,n.replacement=h.decode(r,e),e+=h.decode.bytes,oe.decode.bytes=e-t,n};oe.decode.bytes=0;oe.encodingLength=function(r){return x.encodingLength(r.flags)+x.encodingLength(r.services)+x.encodingLength(r.regexp)+h.encodingLength(r.replacement)+6};var ie=m.tlsa={};ie.encode=function(r,e,t){e||(e=y.alloc(ie.encodingLength(r))),t||(t=0);let n=t,o=r.certificate;if(!y.isBuffer(o))throw new Error("Certificate must be a Buffer");return t+=2,e.writeUInt8(r.usage,t),t+=1,e.writeUInt8(r.selector,t),t+=1,e.writeUInt8(r.matchingType,t),t+=1,o.copy(e,t,0,o.length),t+=o.length,ie.encode.bytes=t-n,e.writeUInt16BE(ie.encode.bytes-2,n),e};ie.encode.bytes=0;ie.decode=function(r,e){e||(e=0);let t=e,n={},o=r.readUInt16BE(e);return e+=2,n.usage=r.readUInt8(e),e+=1,n.selector=r.readUInt8(e),e+=1,n.matchingType=r.readUInt8(e),e+=1,n.certificate=r.slice(e,t+o+2),e+=n.certificate.length,ie.decode.bytes=e-t,n};ie.decode.bytes=0;ie.encodingLength=function(r){return 5+y.byteLength(r.certificate)};var Mr=m.record=function(r){switch(r.toUpperCase()){case"A":return me;case"PTR":return Q;case"CNAME":return Yo;case"DNAME":return Go;case"TXT":return ue;case"NULL":return he;case"AAAA":return ye;case"SRV":return ge;case"HINFO":return pe;case"CAA":return V;case"NS":return de;case"SOA":return le;case"MX":return xe;case"OPT":return K;case"DNSKEY":return F;case"RRSIG":return f;case"RP":return ee;case"NSEC":return re;case"NSEC3":return te;case"SSHFP":return j;case"DS":return ne;case"NAPTR":return oe;case"TLSA":return ie}return ae},D=m.answer={};D.encode=function(r,e,t){e||(e=y.alloc(D.encodingLength(r))),t||(t=0);let n=t;if(h.encode(r.name,e,t),t+=h.encode.bytes,e.writeUInt16BE(we.toType(r.type),t),r.type.toUpperCase()==="OPT"){if(r.name!==".")throw new Error("OPT name must be root.");e.writeUInt16BE(r.udpPayloadSize||4096,t+2),e.writeUInt8(r.extendedRcode||0,t+4),e.writeUInt8(r.ednsVersion||0,t+5),e.writeUInt16BE(r.flags||0,t+6),t+=8,K.encode(r.options||[],e,t),t+=K.encode.bytes}else{let o=cr.toClass(r.class===void 0?"IN":r.class);r.flush&&(o|=_r),e.writeUInt16BE(o,t+2),e.writeUInt32BE(r.ttl||0,t+4),t+=8;let i=Mr(r.type);i.encode(r.data,e,t),t+=i.encode.bytes}return D.encode.bytes=t-n,e};D.encode.bytes=0;D.decode=function(r,e){e||(e=0);let t={},n=e;if(t.name=h.decode(r,e),e+=h.decode.bytes,t.type=we.toString(r.readUInt16BE(e)),t.type==="OPT")t.udpPayloadSize=r.readUInt16BE(e+2),t.extendedRcode=r.readUInt8(e+4),t.ednsVersion=r.readUInt8(e+5),t.flags=r.readUInt16BE(e+6),t.flag_do=(t.flags>>15&1)===1,t.options=K.decode(r,e+8),e+=8+K.decode.bytes;else{let o=r.readUInt16BE(e+2);t.ttl=r.readUInt32BE(e+4),t.class=cr.toString(o&Ko),t.flush=!!(o&_r);let i=Mr(t.type);t.data=i.decode(r,e+8),e+=8+i.decode.bytes}return D.decode.bytes=e-n,t};D.decode.bytes=0;D.encodingLength=function(r){let e=r.data!==null&&r.data!==void 0?r.data:r.options;return h.encodingLength(r.name)+8+Mr(r.type).encodingLength(e)};var W=m.question={};W.encode=function(r,e,t){e||(e=y.alloc(W.encodingLength(r))),t||(t=0);let n=t;return h.encode(r.name,e,t),t+=h.encode.bytes,e.writeUInt16BE(we.toType(r.type),t),t+=2,e.writeUInt16BE(cr.toClass(r.class===void 0?"IN":r.class),t),t+=2,W.encode.bytes=t-n,r};W.encode.bytes=0;W.decode=function(r,e){e||(e=0);let t=e,n={};return n.name=h.decode(r,e),e+=h.decode.bytes,n.type=we.toString(r.readUInt16BE(e)),e+=2,n.class=cr.toString(r.readUInt16BE(e)),e+=2,!!(n.class&Gt)&&(n.class&=Ho),W.decode.bytes=e-t,n};W.decode.bytes=0;W.encodingLength=function(r){return h.encodingLength(r.name)+4};m.AUTHORITATIVE_ANSWER=1024;m.TRUNCATED_RESPONSE=512;m.RECURSION_DESIRED=256;m.RECURSION_AVAILABLE=128;m.AUTHENTIC_DATA=32;m.CHECKING_DISABLED=16;m.DNSSEC_OK=32768;m.encode=function(r,e,t){let n=!e;n&&(e=y.alloc(m.encodingLength(r))),t||(t=0);let o=t;return r.questions||(r.questions=[]),r.answers||(r.answers=[]),r.authorities||(r.authorities=[]),r.additionals||(r.additionals=[]),J.encode(r,e,t),t+=J.encode.bytes,t=Ve(r.questions,W,e,t),t=Ve(r.answers,D,e,t),t=Ve(r.authorities,D,e,t),t=Ve(r.additionals,D,e,t),m.encode.bytes=t-o,n&&m.encode.bytes!==e.length?e.slice(0,m.encode.bytes):e};m.encode.bytes=0;m.decode=function(r,e){e||(e=0);let t=e,n=J.decode(r,e);return e+=J.decode.bytes,e=sr(n.questions,W,r,e),e=sr(n.answers,D,r,e),e=sr(n.authorities,D,r,e),e=sr(n.additionals,D,r,e),m.decode.bytes=e-t,n};m.decode.bytes=0;m.encodingLength=function(r){return J.encodingLength(r)+Re(r.questions||[],W)+Re(r.answers||[],D)+Re(r.authorities||[],D)+Re(r.additionals||[],D)};m.streamEncode=function(r){let e=m.encode(r),t=y.alloc(2);t.writeUInt16BE(e.byteLength);let n=y.concat([t,e]);return m.streamEncode.bytes=n.byteLength,n};m.streamEncode.bytes=0;m.streamDecode=function(r){let e=r.readUInt16BE(0);if(r.byteLength<e+2)return null;let t=m.decode(r.slice(2));return m.streamDecode.bytes=m.decode.bytes,t};m.streamDecode.bytes=0;function Re(r,e){let t=0;for(let n=0;n<r.length;n++)t+=e.encodingLength(r[n]);return t}function Ve(r,e,t,n){for(let o=0;o<r.length;o++)e.encode(r[o],t,n),n+=e.encode.bytes;return n}function sr(r,e,t,n){for(let o=0;o<r.length;o++)r[o]=e.decode(t,n),n+=e.decode.bytes;return n}});var Jt=L((sc,Wt)=>{"use strict";var Qt=fo;process.nextTick(Zo,42);Wt.exports=Xo;function Xo(r){var e=n;return t;function t(o){e(o||Wo)}function n(o){var i=[o];e=s,r(l);function s(w){i.push(w)}function l(w){var E=arguments;for(e=Qo(w)?n:p;i.length;)p(i.shift());function p(a){Qt(Jo,a,E)}}}}function Qo(r){return Object.prototype.toString.call(r)==="[object Error]"}function Wo(){}function Jo(r,e){r.apply(null,e)}function Zo(r){r===42&&(Qt=process.nextTick)}function fo(r,e,t){process.nextTick(function(){r(e,t)})}});var en=L((cc,ft)=>{var kr=Xt(),ei=ce("dgram"),ri=Jt(),ti=ce("events"),zr=ce("os"),qr=function(){};ft.exports=function(r){r||(r={});var e=new ti.EventEmitter,t=typeof r.port=="number"?r.port:5353,n=r.type||"udp4",o=r.ip||r.host||(n==="udp4"?"224.0.0.251":null),i={address:o,port:t},s={},l=!1,w=null;if(n==="udp6"&&(!o||!r.interface))throw new Error("For IPv6 multicast you must specify `ip` and `interface`");var E=r.socket||ei.createSocket({type:n,reuseAddr:r.reuseAddr!==!1,toString:function(){return n}});E.on("error",function(a){a.code==="EACCES"||a.code==="EADDRINUSE"?e.emit("error",a):e.emit("warning",a)}),E.on("message",function(a,d){try{a=kr.decode(a)}catch(u){e.emit("warning",u);return}e.emit("packet",a,d),a.type==="query"&&e.emit("query",a,d),a.type==="response"&&e.emit("response",a,d)}),E.on("listening",function(){t||(t=i.port=E.address().port),r.multicast!==!1&&(e.update(),w=setInterval(e.update,5e3),E.setMulticastTTL(r.ttl||255),E.setMulticastLoopback(r.loopback!==!1))});var p=ri(function(a){if(!t||r.bind===!1)return a(null);E.once("error",a),E.bind(t,r.bind||r.interface,function(){E.removeListener("error",a),a(null)})});return p(function(a){if(a)return e.emit("error",a);e.emit("ready")}),e.send=function(a,d,u){if(typeof d=="function")return e.send(a,null,d);u||(u=qr),d?!d.host&&!d.address&&(d.address=i.address):d=i,p(c);function c(g){if(l)return u();if(g)return u(g);var I=kr.encode(a);E.send(I,0,I.length,d.port,d.address||d.host,u)}},e.response=e.respond=function(a,d,u){Array.isArray(a)&&(a={answers:a}),a.type="response",a.flags=(a.flags||0)|kr.AUTHORITATIVE_ANSWER,e.send(a,d,u)},e.query=function(a,d,u,c){if(typeof d=="function")return e.query(a,null,null,d);if(typeof d=="object"&&d&&d.port)return e.query(a,null,d,u);if(typeof u=="function")return e.query(a,d,null,u);c||(c=qr),typeof a=="string"&&(a=[{name:a,type:d||"ANY"}]),Array.isArray(a)&&(a={type:"query",questions:a}),a.type="query",e.send(a,u,c)},e.destroy=function(a){if(a||(a=qr),l)return process.nextTick(a);l=!0,clearInterval(w);for(var d in s)try{E.dropMembership(o,d)}catch{}s={},E.close(a)},e.update=function(){for(var a=r.interface?[].concat(r.interface):oi(),d=!1,u=0;u<a.length;u++){var c=a[u];if(!s[c])try{E.addMembership(o,c),s[c]=!0,d=!0}catch(g){e.emit("warning",g)}}if(d){if(E.setMulticastInterface)try{E.setMulticastInterface(r.interface||ni())}catch(g){e.emit("warning",g)}e.emit("networkInterface")}},e};function ni(){for(var r=zr.networkInterfaces(),e=Object.keys(r),t=0;t<e.length;t++)for(var n=r[e[t]],o=0;o<n.length;o++){var i=n[o];if(Zt(i.family)&&!i.internal)return zr.platform()==="darwin"&&e[t]==="en0"?i.address:"0.0.0.0"}return"127.0.0.1"}function oi(){for(var r=zr.networkInterfaces(),e=Object.keys(r),t=[],n=0;n<e.length;n++)for(var o=r[e[n]],i=0;i<o.length;i++){var s=o[i];if(Zt(s.family)){t.push(s.address);break}}return t}function Zt(r){return r===4||r==="IPv4"}});var vn=L((ca,Cn)=>{Cn.exports=nt;var xn=128,Wi=127,Ji=~Wi,Zi=Math.pow(2,31);function nt(r,e,t){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw nt.bytes=0,new RangeError("Could not encode varint");e=e||[],t=t||0;for(var n=t;r>=Zi;)e[t++]=r&255|xn,r/=128;for(;r&Ji;)e[t++]=r&255|xn,r>>>=7;return e[t]=r|0,nt.bytes=t-n+1,e}});var Un=L((aa,Sn)=>{Sn.exports=ot;var fi=128,bn=127;function ot(r,n){var t=0,n=n||0,o=0,i=n,s,l=r.length;do{if(i>=l||o>49)throw ot.bytes=0,new RangeError("Could not decode varint");s=r[i++],t+=o<28?(s&bn)<<o:(s&bn)*Math.pow(2,o),o+=7}while(s>=fi);return ot.bytes=i-n,t}});var On=L((da,An)=>{var es=Math.pow(2,7),rs=Math.pow(2,14),ts=Math.pow(2,21),ns=Math.pow(2,28),os=Math.pow(2,35),is=Math.pow(2,42),ss=Math.pow(2,49),cs=Math.pow(2,56),as=Math.pow(2,63);An.exports=function(r){return r<es?1:r<rs?2:r<ts?3:r<ns?4:r<os?5:r<is?6:r<ss?7:r<cs?8:r<as?9:10}});var it=L((la,Ln)=>{Ln.exports={encode:vn(),decode:Un(),encodingLength:On()}});var Ds={};q(Ds,{mdns:()=>Ps});var fe=class extends EventTarget{#e=new Map;listenerCount(e){let t=this.#e.get(e);return t==null?0:t.length}addEventListener(e,t,n){super.addEventListener(e,t,n);let o=this.#e.get(e);o==null&&(o=[],this.#e.set(e,o)),o.push({callback:t,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(e,t,n){super.removeEventListener(e.toString(),t??null,n);let o=this.#e.get(e);o!=null&&(o=o.filter(({callback:i})=>i!==t),this.#e.set(e,o))}dispatchEvent(e){let t=super.dispatchEvent(e),n=this.#e.get(e.type);return n==null||(n=n.filter(({once:o})=>!o),this.#e.set(e.type,n)),t}safeDispatchEvent(e,t){return this.dispatchEvent(new er(e,t))}},wr=class extends Event{detail;constructor(e,t){super(e,t),this.detail=t?.detail}},er=globalThis.CustomEvent??wr;var xt=Symbol.for("@libp2p/peer-discovery");var $=$e(Nt(),1);var Ur={};q(Ur,{base32:()=>X,base32hex:()=>No,base32hexpad:()=>Do,base32hexpadupper:()=>Ro,base32hexupper:()=>Po,base32pad:()=>To,base32padupper:()=>Bo,base32upper:()=>Lo,base32z:()=>Fo});function bo(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var o=0;o<r.length;o++){var i=r.charAt(o),s=i.charCodeAt(0);if(t[s]!==255)throw new TypeError(i+" is ambiguous");t[s]=o}var l=r.length,w=r.charAt(0),E=Math.log(l)/Math.log(256),p=Math.log(256)/Math.log(l);function a(c){if(c instanceof Uint8Array||(ArrayBuffer.isView(c)?c=new Uint8Array(c.buffer,c.byteOffset,c.byteLength):Array.isArray(c)&&(c=Uint8Array.from(c))),!(c instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(c.length===0)return"";for(var g=0,I=0,C=0,v=c.length;C!==v&&c[C]===0;)C++,g++;for(var B=(v-C)*p+1>>>0,S=new Uint8Array(B);C!==v;){for(var O=c[C],U=0,k=B-1;(O!==0||U<I)&&k!==-1;k--,U++)O+=256*S[k]>>>0,S[k]=O%l>>>0,O=O/l>>>0;if(O!==0)throw new Error("Non-zero carry");I=U,C++}for(var H=B-I;H!==B&&S[H]===0;)H++;for(var Le=w.repeat(g);H<B;++H)Le+=r.charAt(S[H]);return Le}function d(c){if(typeof c!="string")throw new TypeError("Expected String");if(c.length===0)return new Uint8Array;var g=0;if(c[g]!==" "){for(var I=0,C=0;c[g]===w;)I++,g++;for(var v=(c.length-g)*E+1>>>0,B=new Uint8Array(v);c[g];){var S=t[c.charCodeAt(g)];if(S===255)return;for(var O=0,U=v-1;(S!==0||O<C)&&U!==-1;U--,O++)S+=l*B[U]>>>0,B[U]=S%256>>>0,S=S/256>>>0;if(S!==0)throw new Error("Non-zero carry");C=O,g++}if(c[g]!==" "){for(var k=v-C;k!==v&&B[k]===0;)k++;for(var H=new Uint8Array(I+(v-k)),Le=I;k!==v;)H[Le++]=B[k++];return H}}}function u(c){var g=d(c);if(g)return g;throw new Error(`Non-${e} character`)}return{encode:a,decodeUnsafe:d,decode:u}}var So=bo,Uo=So,Pt=Uo;var js=new Uint8Array(0);var Dt=(r,e)=>{if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0},Y=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 Rt=r=>new TextEncoder().encode(r),Ft=r=>new TextDecoder().decode(r);var Cr=class{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},vr=class{constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Mt(this,e)}},br=class{constructor(e){this.decoders=e}or(e){return Mt(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},Mt=(r,e)=>new br({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),Sr=class{constructor(e,t,n,o){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new Cr(e,t,n),this.decoder=new vr(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},De=({name:r,prefix:e,encode:t,decode:n})=>new Sr(r,e,t,n),Ie=({prefix:r,name:e,alphabet:t})=>{let{encode:n,decode:o}=Pt(t,e);return De({prefix:r,name:e,encode:n,decode:i=>Y(o(i))})},Ao=(r,e,t,n)=>{let o={};for(let p=0;p<e.length;++p)o[e[p]]=p;let i=r.length;for(;r[i-1]==="=";)--i;let s=new Uint8Array(i*t/8|0),l=0,w=0,E=0;for(let p=0;p<i;++p){let a=o[r[p]];if(a===void 0)throw new SyntaxError(`Non-${n} character`);w=w<<t|a,l+=t,l>=8&&(l-=8,s[E++]=255&w>>l)}if(l>=t||255&w<<8-l)throw new SyntaxError("Unexpected end of data");return s},Oo=(r,e,t)=>{let n=e[e.length-1]==="=",o=(1<<t)-1,i="",s=0,l=0;for(let w=0;w<r.length;++w)for(l=l<<8|r[w],s+=8;s>t;)s-=t,i+=e[o&l>>s];if(s&&(i+=e[o&l<<t-s]),n)for(;i.length*t&7;)i+="=";return i},A=({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>De({prefix:e,name:r,encode(o){return Oo(o,n,t)},decode(o){return Ao(o,n,t,r)}});var X=A({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Lo=A({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),To=A({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Bo=A({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),No=A({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Po=A({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Do=A({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Ro=A({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Fo=A({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Ar={};q(Ar,{base58btc:()=>T,base58flickr:()=>_o});var T=Ie({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),_o=Ie({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Lr={};q(Lr,{base64:()=>Or,base64pad:()=>Mo,base64url:()=>ko,base64urlpad:()=>qo});var Or=A({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Mo=A({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),ko=A({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),qo=A({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});$.default.formatters.b=r=>r==null?"undefined":T.baseEncode(r);$.default.formatters.t=r=>r==null?"undefined":X.baseEncode(r);$.default.formatters.m=r=>r==null?"undefined":Or.baseEncode(r);$.default.formatters.p=r=>r==null?"undefined":r.toString();$.default.formatters.c=r=>r==null?"undefined":r.toString();$.default.formatters.k=r=>r==null?"undefined":r.toString();$.default.formatters.a=r=>r==null?"undefined":r.toString();function zo(r){let e=()=>{};return e.enabled=!1,e.color="",e.diff=0,e.log=()=>{},e.namespace=r,e.destroy=()=>!0,e.extend=()=>e,e}function ir(r){let e=zo(`${r}:trace`);return $.default.enabled(`${r}:trace`)&&$.default.names.map(t=>t.toString()).find(t=>t.includes(":trace"))!=null&&(e=(0,$.default)(`${r}:trace`)),Object.assign((0,$.default)(r),{error:(0,$.default)(`${r}:error`),trace:e})}var Yn=$e(en(),1);var rn=Symbol.for("@libp2p/peer-id");var $r={};q($r,{identity:()=>ii});var ii=De({prefix:"\0",name:"identity",encode:r=>Ft(r),decode:r=>Rt(r)});var Vr={};q(Vr,{base2:()=>si});var si=A({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var jr={};q(jr,{base8:()=>ci});var ci=A({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Kr={};q(Kr,{base10:()=>ai});var ai=Ie({prefix:"9",name:"base10",alphabet:"0123456789"});var Hr={};q(Hr,{base16:()=>di,base16upper:()=>li});var di=A({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),li=A({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Yr={};q(Yr,{base36:()=>ui,base36upper:()=>hi});var ui=Ie({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),hi=Ie({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Gr={};q(Gr,{base256emoji:()=>wi});var tn=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}"),pi=tn.reduce((r,e,t)=>(r[t]=e,r),[]),gi=tn.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function mi(r){return r.reduce((e,t)=>(e+=pi[t],e),"")}function yi(r){let e=[];for(let t of r){let n=gi[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}var wi=De({prefix:"\u{1F680}",name:"base256emoji",encode:mi,decode:yi});var Zr={};q(Zr,{sha256:()=>dr,sha512:()=>_i});var Jr=$e(ce("crypto"),1);var Ei=sn,nn=128,Ii=127,xi=~Ii,Ci=Math.pow(2,31);function sn(r,e,t){e=e||[],t=t||0;for(var n=t;r>=Ci;)e[t++]=r&255|nn,r/=128;for(;r&xi;)e[t++]=r&255|nn,r>>>=7;return e[t]=r|0,sn.bytes=t-n+1,e}var vi=Xr,bi=128,on=127;function Xr(r,n){var t=0,n=n||0,o=0,i=n,s,l=r.length;do{if(i>=l)throw Xr.bytes=0,new RangeError("Could not decode varint");s=r[i++],t+=o<28?(s&on)<<o:(s&on)*Math.pow(2,o),o+=7}while(s>=bi);return Xr.bytes=i-n,t}var Si=Math.pow(2,7),Ui=Math.pow(2,14),Ai=Math.pow(2,21),Oi=Math.pow(2,28),Li=Math.pow(2,35),Ti=Math.pow(2,42),Bi=Math.pow(2,49),Ni=Math.pow(2,56),Pi=Math.pow(2,63),Di=function(r){return r<Si?1:r<Ui?2:r<Ai?3:r<Oi?4:r<Li?5:r<Ti?6:r<Bi?7:r<Ni?8:r<Pi?9:10},Ri={encode:Ei,decode:vi,encodingLength:Di},Fi=Ri,je=Fi;var Ke=(r,e=0)=>[je.decode(r,e),je.decode.bytes],Fe=(r,e,t=0)=>(je.encode(r,e,t),e),_e=r=>je.encodingLength(r);var Ce=(r,e)=>{let t=e.byteLength,n=_e(r),o=n+_e(t),i=new Uint8Array(o+t);return Fe(r,i,0),Fe(t,i,n),i.set(e,o),new Me(r,t,e,i)},Ae=r=>{let e=Y(r),[t,n]=Ke(e),[o,i]=Ke(e.subarray(n)),s=e.subarray(n+i);if(s.byteLength!==o)throw new Error("Incorrect length");return new Me(t,o,s,e)},cn=(r,e)=>{if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&Dt(r.bytes,t.bytes)}},Me=class{constructor(e,t,n,o){this.code=e,this.size=t,this.digest=n,this.bytes=o}};var Wr=({name:r,code:e,encode:t})=>new Qr(r,e,t),Qr=class{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?Ce(this.code,t):t.then(n=>Ce(this.code,n))}else throw Error("Unknown type, must be binary type")}};var dr=Wr({name:"sha2-256",code:18,encode:r=>Y(Jr.default.createHash("sha256").update(r).digest())}),_i=Wr({name:"sha2-512",code:19,encode:r=>Y(Jr.default.createHash("sha512").update(r).digest())});var fr={};q(fr,{identity:()=>lr});var dn=0,Mi="identity",ln=Y,ki=r=>Ce(dn,ln(r)),lr={code:dn,name:Mi,encode:ln,digest:ki};var Uc=new TextEncoder,Ac=new TextDecoder;var un=(r,e)=>{let{bytes:t,version:n}=r;switch(n){case 0:return Vi(t,et(r),e||T.encoder);default:return ji(t,et(r),e||X.encoder)}};var hn=new WeakMap,et=r=>{let e=hn.get(r);if(e==null){let t=new Map;return hn.set(r,t),t}return e},Z=class r{constructor(e,t,n,o){this.code=t,this.version=e,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:t}=this;if(e!==He)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==Ki)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,n=Ce(e,t);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(e){return r.equals(this,e)}static equals(e,t){let n=t;return n&&e.code===n.code&&e.version===n.version&&cn(e.multihash,n.multihash)}toString(e){return un(this,e)}toJSON(){return{"/":un(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof r)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:o,multihash:i,bytes:s}=t;return new r(n,o,i,s||pn(n,o,i.bytes))}else if(t[Hi]===!0){let{version:n,multihash:o,code:i}=t,s=Ae(o);return r.create(n,i,s)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==He)throw new Error(`Version 0 CID must use dag-pb (code: ${He}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let o=pn(e,t,n.bytes);return new r(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,He,e)}static createV1(e,t){return r.create(1,e,t)}static decode(e){let[t,n]=r.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=r.inspectBytes(e),n=t.size-t.multihashSize,o=Y(e.subarray(n,n+t.multihashSize));if(o.byteLength!==t.multihashSize)throw new Error("Incorrect length");let i=o.subarray(t.multihashSize-t.digestSize),s=new Me(t.multihashCode,t.digestSize,i,o);return[t.version===0?r.createV0(s):r.createV1(t.codec,s),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[a,d]=Ke(e.subarray(t));return t+=d,a},o=n(),i=He;if(o===18?(o=0,t=0):i=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let s=t,l=n(),w=n(),E=t+w,p=E-s;return{version:o,codec:i,multihashCode:l,digestSize:w,multihashSize:p,size:E}}static parse(e,t){let[n,o]=$i(e,t),i=r.decode(o);if(i.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return et(i).set(n,e),i}},$i=(r,e)=>{switch(r[0]){case"Q":{let t=e||T;return[T.prefix,t.decode(`${T.prefix}${r}`)]}case T.prefix:{let t=e||T;return[T.prefix,t.decode(r)]}case X.prefix:{let t=e||X;return[X.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}},Vi=(r,e,t)=>{let{prefix:n}=t;if(n!==T.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let o=e.get(n);if(o==null){let i=t.encode(r).slice(1);return e.set(n,i),i}else return o},ji=(r,e,t)=>{let{prefix:n}=t,o=e.get(n);if(o==null){let i=t.encode(r);return e.set(n,i),i}else return o},He=112,Ki=18,pn=(r,e,t)=>{let n=_e(r),o=n+_e(e),i=new Uint8Array(o+t.byteLength);return Fe(r,i,0),Fe(e,i,n),i.set(t,o),i},Hi=Symbol.for("@ipld/js-cid/CID");var ve={...$r,...Vr,...jr,...Kr,...Hr,...Ur,...Yr,...Ar,...Lr,...Gr},_c={...Zr,...fr};function Ye(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}var Yi=Symbol.for("nodejs.util.inspect.custom"),gn=Object.values(ve).map(r=>r.decoder).reduce((r,e)=>r.or(e),ve.identity.decoder),mn=114,yn=36,wn=37,Ge=class{type;multihash;privateKey;publicKey;string;constructor(e){this.type=e.type,this.multihash=e.multihash,this.privateKey=e.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}[rn]=!0;toString(){return this.string==null&&(this.string=T.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return Z.createV1(mn,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e instanceof Uint8Array)return Ye(this.multihash.bytes,e);if(typeof e=="string")return rt(e).equals(this);if(e?.multihash?.bytes!=null)return Ye(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[Yi](){return`PeerId(${this.toString()})`}},Xe=class extends Ge{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},Qe=class extends Ge{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.multihash.digest}},We=class extends Ge{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.multihash.digest}};function rt(r,e){if(e=e??gn,r.charAt(0)==="1"||r.charAt(0)==="Q"){let t=Ae(T.decode(`z${r}`));return r.startsWith("12D")?new Qe({multihash:t}):r.startsWith("16U")?new We({multihash:t}):new Xe({multihash:t})}return Gi(gn.decode(r))}function Gi(r){try{let e=Ae(r);if(e.code===lr.code){if(e.digest.length===yn)return new Qe({multihash:e});if(e.digest.length===wn)return new We({multihash:e})}if(e.code===dr.code)return new Xe({multihash:e})}catch{return Xi(Z.decode(r))}throw new Error("Supplied PeerID CID is invalid")}function Xi(r){if(r==null||r.multihash==null||r.version==null||r.version===1&&r.code!==mn)throw new Error("Supplied PeerID CID is invalid");let e=r.multihash;if(e.code===dr.code)return new Xe({multihash:r.multihash});if(e.code===lr.code){if(e.digest.length===yn)return new Qe({multihash:r.multihash});if(e.digest.length===wn)return new We({multihash:r.multihash})}throw new Error("Supplied PeerID CID is invalid")}var ur=class extends Error{code;props;constructor(e,t,n){super(e),this.code=t,this.name=n?.name??"CodeError",this.props=n??{}}};function ke(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function hr(r=0){return globalThis.Buffer?.allocUnsafe!=null?ke(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function In(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var En=In("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),tt=In("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=hr(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),Qi={utf8:En,"utf-8":En,hex:ve.base16,latin1:tt,ascii:tt,binary:tt,...ve},pr=Qi;function M(r,e="utf8"){let t=pr[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):t.encoder.encode(r).substring(1)}function Ee(r,e){e==null&&(e=r.reduce((o,i)=>o+i.length,0));let t=hr(e),n=0;for(let o of r)t.set(o,n),n+=o.length;return ke(t)}var ze=$e(it(),1);var gr=class{index=0;input="";new(e){return this.index=0,this.input=e,this}readAtomically(e){let t=this.index,n=e();return n===void 0&&(this.index=t),n}parseWith(e){let t=e();if(this.index===this.input.length)return t}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(e){return this.readAtomically(()=>{let t=this.readChar();if(t===e)return t})}readSeparator(e,t,n){return this.readAtomically(()=>{if(!(t>0&&this.readGivenChar(e)===void 0))return n()})}readNumber(e,t,n,o){return this.readAtomically(()=>{let i=0,s=0,l=this.peekChar();if(l===void 0)return;let w=l==="0",E=2**(8*o)-1;for(;;){let p=this.readAtomically(()=>{let a=this.readChar();if(a===void 0)return;let d=Number.parseInt(a,e);if(!Number.isNaN(d))return d});if(p===void 0)break;if(i*=e,i+=p,i>E||(s+=1,t!==void 0&&s>t))return}if(s!==0)return!n&&w&&s>1?void 0:i})}readIPv4Addr(){return this.readAtomically(()=>{let e=new Uint8Array(4);for(let t=0;t<e.length;t++){let n=this.readSeparator(".",t,()=>this.readNumber(10,3,!1,1));if(n===void 0)return;e[t]=n}return e})}readIPv6Addr(){let e=t=>{for(let n=0;n<t.length/2;n++){let o=n*2;if(n<t.length-3){let s=this.readSeparator(":",n,()=>this.readIPv4Addr());if(s!==void 0)return t[o]=s[0],t[o+1]=s[1],t[o+2]=s[2],t[o+3]=s[3],[o+4,!0]}let i=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(i===void 0)return[o,!1];t[o]=i>>8,t[o+1]=i&255}return[t.length,!1]};return this.readAtomically(()=>{let t=new Uint8Array(16),[n,o]=e(t);if(n===16)return t;if(o||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let i=new Uint8Array(14),s=16-(n+2),[l]=e(i.subarray(0,s));return t.set(i.subarray(0,l),16-l),t})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var pa=new gr;var Ca=parseInt("0xFFFF",16),va=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);function st(r,e="utf8"){let t=pr[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?ke(globalThis.Buffer.from(r,"utf-8")):t.decoder.decode(`${t.prefix}${r}`)}var se=$e(it(),1);var be=ce("node:net");function mr(r){return!!(0,be.isIP)(r)}var Nn=be.isIPv4,gs=be.isIPv6,ct=function(r){let e=0;if(r=r.toString().trim(),Nn(r)){let t=new Uint8Array(e+4);return r.split(/\./g).forEach(n=>{t[e++]=parseInt(n,10)&255}),t}if(gs(r)){let t=r.split(":",8),n;for(n=0;n<t.length;n++){let i=Nn(t[n]),s;i&&(s=ct(t[n]),t[n]=M(s.slice(0,2),"base16")),s!=null&&++n<8&&t.splice(n,0,M(s.slice(2,4),"base16"))}if(t[0]==="")for(;t.length<8;)t.unshift("0");else if(t[t.length-1]==="")for(;t.length<8;)t.push("0");else if(t.length<8){for(n=0;n<t.length&&t[n]!=="";n++);let i=[n,1];for(n=9-t.length;n>0;n--)i.push("0");t.splice.apply(t,i)}let o=new Uint8Array(e+16);for(n=0;n<t.length;n++){let i=parseInt(t[n],16);o[e++]=i>>8&255,o[e++]=i&255}return o}throw new Error("invalid ip address")},Pn=function(r,e=0,t){e=~~e,t=t??r.length-e;let n=new DataView(r.buffer);if(t===4){let o=[];for(let i=0;i<t;i++)o.push(r[e+i]);return o.join(".")}if(t===16){let o=[];for(let i=0;i<t;i+=2)o.push(n.getUint16(e+i).toString(16));return o.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var qe={},at={},ys=[[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"]];ys.forEach(r=>{let e=ws(...r);at[e.code]=e,qe[e.name]=e});function ws(r,e,t,n,o){return{code:r,size:e,name:t,resolvable:!!n,path:!!o}}function b(r){if(typeof r=="number"){if(at[r]!=null)return at[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(qe[r]!=null)return qe[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var dd=b("ip4"),ld=b("ip6"),ud=b("ipcidr");function lt(r,e){switch(b(r).code){case 4:case 41:return Is(e);case 42:return Fn(e);case 6:case 273:case 33:case 132:return Mn(e).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Fn(e);case 421:return bs(e);case 444:return _n(e);case 445:return _n(e);case 466:return vs(e);default:return M(e,"base16")}}function ut(r,e){switch(b(r).code){case 4:return Dn(e);case 41:return Dn(e);case 42:return Rn(e);case 6:case 273:case 33:case 132:return ht(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Rn(e);case 421:return xs(e);case 444:return Ss(e);case 445:return Us(e);case 466:return Cs(e);default:return st(e,"base16")}}var dt=Object.values(ve).map(r=>r.decoder),Es=function(){let r=dt[0].or(dt[1]);return dt.slice(2).forEach(e=>r=r.or(e)),r}();function Dn(r){if(!mr(r))throw new Error("invalid ip address");return ct(r)}function Is(r){let e=Pn(r,0,r.length);if(e==null)throw new Error("ipBuff is required");if(!mr(e))throw new Error("invalid ip address");return e}function ht(r){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,r),new Uint8Array(e)}function Mn(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function Rn(r){let e=st(r),t=Uint8Array.from(se.default.encode(e.length));return Ee([t,e],t.length+e.length)}function Fn(r){let e=se.default.decode(r);if(r=r.slice(se.default.decode.bytes),r.length!==e)throw new Error("inconsistent lengths");return M(r)}function xs(r){let e;r[0]==="Q"||r[0]==="1"?e=Ae(T.decode(`z${r}`)).bytes:e=Z.parse(r).multihash.bytes;let t=Uint8Array.from(se.default.encode(e.length));return Ee([t,e],t.length+e.length)}function Cs(r){let e=Es.decode(r),t=Uint8Array.from(se.default.encode(e.length));return Ee([t,e],t.length+e.length)}function vs(r){let e=se.default.decode(r),t=r.slice(se.default.decode.bytes);if(t.length!==e)throw new Error("inconsistent lengths");return"u"+M(t,"base64url")}function bs(r){let e=se.default.decode(r),t=r.slice(se.default.decode.bytes);if(t.length!==e)throw new Error("inconsistent lengths");return M(t,"base58btc")}function Ss(r){let e=r.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==16)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion address.`);let t=X.decode("b"+e[0]),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=ht(n);return Ee([t,o],t.length+o.length)}function Us(r){let e=r.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==56)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion3 address.`);let t=X.decode(`b${e[0]}`),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=ht(n);return Ee([t,o],t.length+o.length)}function _n(r){let e=r.slice(0,r.length-2),t=r.slice(r.length-2),n=M(e,"base32"),o=Mn(t);return`${n}:${o}`}function kn(r){r=pt(r);let e=[],t=[],n=null,o=r.split("/").slice(1);if(o.length===1&&o[0]==="")return{bytes:new Uint8Array,string:"/",tuples:[],stringTuples:[],path:null};for(let i=0;i<o.length;i++){let s=o[i],l=b(s);if(l.size===0){e.push([l.code]),t.push([l.code]);continue}if(i++,i>=o.length)throw zn("invalid address: "+r);if(l.path===!0){n=pt(o.slice(i).join("/")),e.push([l.code,ut(l.code,n)]),t.push([l.code,n]);break}let w=ut(l.code,o[i]);e.push([l.code,w]),t.push([l.code,lt(l.code,w)])}return{string:qn(t),bytes:mt(e),tuples:e,stringTuples:t,path:n}}function gt(r){let e=[],t=[],n=null,o=0;for(;o<r.length;){let i=ze.default.decode(r,o),s=ze.default.decode.bytes??0,l=b(i),w=As(l,r.slice(o+s));if(w===0){e.push([i]),t.push([i]),o+=s;continue}let E=r.slice(o+s,o+s+w);if(o+=w+s,o>r.length)throw zn("Invalid address Uint8Array: "+M(r,"base16"));e.push([i,E]);let p=lt(i,E);if(t.push([i,p]),l.path===!0){n=p;break}}return{bytes:Uint8Array.from(r),string:qn(t),tuples:e,stringTuples:t,path:n}}function qn(r){let e=[];return r.map(t=>{let n=b(t[0]);return e.push(n.name),t.length>1&&t[1]!=null&&e.push(t[1]),null}),pt(e.join("/"))}function mt(r){return Ee(r.map(e=>{let t=b(e[0]),n=Uint8Array.from(ze.default.encode(t.code));return e.length>1&&e[1]!=null&&(n=Ee([n,e[1]])),n}))}function As(r,e){return r.size>0?r.size/8:r.size===0?0:ze.default.decode(e)+(ze.default.decode.bytes??0)}function pt(r){return"/"+r.trim().split("/").filter(e=>e).join("/")}function zn(r){return new Error("Error parsing address: "+r)}var Os=Symbol.for("nodejs.util.inspect.custom"),Ls=[b("dns").code,b("dns4").code,b("dns6").code,b("dnsaddr").code],Ts=new Map,$n=Symbol.for("@multiformats/js-multiaddr/multiaddr");function Bs(r){return!!r?.[$n]}var wt=class r{bytes;#e;#r;#t;#n;[$n]=!0;constructor(e){e==null&&(e="");let t;if(e instanceof Uint8Array)t=gt(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);t=kn(e)}else if(Bs(e))t=gt(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=t.bytes,this.#e=t.string,this.#r=t.tuples,this.#t=t.stringTuples,this.#n=t.path}toString(){return this.#e}toJSON(){return this.toString()}toOptions(){let e,t,n,o,i="",s=b("tcp"),l=b("udp"),w=b("ip4"),E=b("ip6"),p=b("dns6"),a=b("ip6zone");for(let[u,c]of this.stringTuples())u===a.code&&(i=`%${c??""}`),Ls.includes(u)&&(t=s.name,o=443,n=`${c??""}${i}`,e=u===p.code?6:4),(u===s.code||u===l.code)&&(t=b(u).name,o=parseInt(c??"")),(u===w.code||u===E.code)&&(t=b(u).name,n=`${c??""}${i}`,e=u===E.code?6:4);if(e==null||t==null||n==null||o==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:n,transport:t,port:o}}protos(){return this.#r.map(([e])=>Object.assign({},b(e)))}protoCodes(){return this.#r.map(([e])=>e)}protoNames(){return this.#r.map(([e])=>b(e).name)}tuples(){return this.#r}stringTuples(){return this.#t}encapsulate(e){return e=new r(e),new r(this.toString()+e.toString())}decapsulate(e){let t=e.toString(),n=this.toString(),o=n.lastIndexOf(t);if(o<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${e.toString()}`);return new r(n.slice(0,o))}decapsulateCode(e){let t=this.tuples();for(let n=t.length-1;n>=0;n--)if(t[n][0]===e)return new r(mt(t.slice(0,n)));return this}getPeerId(){try{let e=[];this.stringTuples().forEach(([n,o])=>{n===qe.p2p.code&&e.push([n,o]),n===qe["p2p-circuit"].code&&(e=[])});let t=e.pop();if(t?.[1]!=null){let n=t[1];return n[0]==="Q"||n[0]==="1"?M(T.decode(`z${n}`),"base58btc"):M(Z.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return this.#n}equals(e){return Ye(this.bytes,e.bytes)}async resolve(e){let t=this.protos().find(i=>i.resolvable);if(t==null)return[this];let n=Ts.get(t.name);if(n==null)throw new ur(`no available resolver for ${t.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,e)).map(i=>new r(i))}nodeAddress(){let e=this.toOptions();if(e.transport!=="tcp"&&e.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${e.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:e.family,address:e.host,port:e.port}}isThinWaistAddress(e){let t=(e??this).protos();return!(t.length!==2||t[0].code!==4&&t[0].code!==41||t[1].code!==6&&t[1].code!==273)}[Os](){return`Multiaddr(${this.#e})`}};function yt(r){return new wt(r)}var Je=ir("libp2p:mdns:query");function Vn(r,e,t){let n=()=>{Je("query",e),r.query({questions:[{name:e,type:"PTR"}]})};return n(),setInterval(n,t)}function jn(r,e,t){if(r.answers==null)return;let n,o=[];if(r.answers.forEach(i=>{switch(i.type){case"PTR":n=i;break;case"TXT":o.push(i);break;default:break}}),!(n==null||n?.name!==t||o.length===0||n.data.startsWith(e)))try{let i=o.flatMap(l=>l.data).filter(l=>l.toString().startsWith("dnsaddr=")).map(l=>yt(l.toString().substring(8))),s=i[0].getPeerId();if(s==null)throw new Error("Multiaddr doesn't contain PeerId");return Je("peer found %p",s),{id:rt(s),multiaddrs:i,protocols:[]}}catch(i){Je.error("failed to parse mdns response",i)}}function Kn(r,e,t,n,o,i){if(!i){Je("not responding to mDNS query as broadcast mode is false");return}if(n.length!==0&&r.questions[0]!=null&&r.questions[0].name===o){let s=[];s.push({name:o,type:"PTR",class:"IN",ttl:120,data:t+"."+o}),n.forEach(l=>{l.getPeerId()!=null&&s.push({name:t+"."+o,type:"TXT",class:"IN",ttl:120,data:"dnsaddr="+l.toString()})}),Je("responding to query"),e.respond(s)}}function Hn(r){let e="",t="abcdefghijklmnopqrstuvwxyz0123456789";for(let n=0;n<r;n++)e+=t.charAt(Math.floor(Math.random()*t.length));return e}var yr=ir("libp2p:mdns"),Et=class extends fe{mdns;broadcast;interval;serviceTag;peerName;port;ip;_queryInterval;components;constructor(e,t={}){if(super(),this.broadcast=t.broadcast!==!1,this.interval=t.interval??1e3*10,this.serviceTag=t.serviceTag??"_p2p._udp.local",this.ip=t.ip??"224.0.0.251",this.peerName=t.peerName??Hn(63),this.peerName.length>=64)throw new Error("Peer name should be less than 64 chars long");this.port=t.port??5353,this.components=e,this._queryInterval=null,this._onPeer=this._onPeer.bind(this),this._onMdnsQuery=this._onMdnsQuery.bind(this),this._onMdnsResponse=this._onMdnsResponse.bind(this)}[xt]=this;[Symbol.toStringTag]="@libp2p/mdns";isStarted(){return!!this.mdns}async start(){this.mdns==null&&(this.mdns=(0,Yn.default)({port:this.port,ip:this.ip}),this.mdns.on("query",this._onMdnsQuery),this.mdns.on("response",this._onMdnsResponse),this._queryInterval=Vn(this.mdns,this.serviceTag,this.interval))}_onMdnsQuery(e){this.mdns!=null&&(yr.trace("received incoming mDNS query"),Kn(e,this.mdns,this.peerName,this.components.addressManager.getAddresses(),this.serviceTag,this.broadcast))}_onMdnsResponse(e){yr.trace("received mDNS query response");try{let t=jn(e,this.peerName,this.serviceTag);t!=null&&(yr("discovered peer in mDNS query response %p",t.id),this.dispatchEvent(new er("peer",{detail:t})))}catch(t){yr.error("Error processing peer response",t)}}_onPeer(e){this.mdns!=null&&this.dispatchEvent(new er("peer",{detail:e.detail}))}async stop(){this.mdns!=null&&(this.mdns.removeListener("query",this._onMdnsQuery),this.mdns.removeListener("response",this._onMdnsResponse),this._queryInterval!=null&&(clearInterval(this._queryInterval),this._queryInterval=null),await new Promise(e=>{this.mdns!=null?this.mdns.destroy(e):e()}),this.mdns=void 0)}};function Ps(r={}){return e=>new Et(e,r)}return Zn(Ds);})();
4
+ `+i),r.push(o+"m+"+ir.exports.humanize(this.diff)+"\x1B[0m")}else r[0]=Eo()+e+" "+r[0]}function Eo(){return P.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Io(...r){return process.stderr.write(or.format(...r)+`
5
+ `)}function xo(r){r?process.env.DEBUG=r:delete process.env.DEBUG}function Co(){return process.env.DEBUG}function vo(r){r.inspectOpts={};let e=Object.keys(P.inspectOpts);for(let n=0;n<e.length;n++)r.inspectOpts[e[n]]=P.inspectOpts[e[n]]}ir.exports=Er()(P);var{formatters:Bn}=ir.exports;Bn.o=function(r){return this.inspectOpts.colors=this.useColors,or.inspect(r,this.inspectOpts).split(`
6
+ `).map(e=>e.trim()).join(" ")};Bn.O=function(r){return this.inspectOpts.colors=this.useColors,or.inspect(r,this.inspectOpts)}});var Pn=L(($s,xr)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?xr.exports=Un():xr.exports=Nn()});var qn=L(Tr=>{"use strict";Tr.toString=function(r){switch(r){case 1:return"A";case 10:return"NULL";case 28:return"AAAA";case 18:return"AFSDB";case 42:return"APL";case 257:return"CAA";case 60:return"CDNSKEY";case 59:return"CDS";case 37:return"CERT";case 5:return"CNAME";case 49:return"DHCID";case 32769:return"DLV";case 39:return"DNAME";case 48:return"DNSKEY";case 43:return"DS";case 55:return"HIP";case 13:return"HINFO";case 45:return"IPSECKEY";case 25:return"KEY";case 36:return"KX";case 29:return"LOC";case 15:return"MX";case 35:return"NAPTR";case 2:return"NS";case 47:return"NSEC";case 50:return"NSEC3";case 51:return"NSEC3PARAM";case 12:return"PTR";case 46:return"RRSIG";case 17:return"RP";case 24:return"SIG";case 6:return"SOA";case 99:return"SPF";case 33:return"SRV";case 44:return"SSHFP";case 32768:return"TA";case 249:return"TKEY";case 52:return"TLSA";case 250:return"TSIG";case 16:return"TXT";case 252:return"AXFR";case 251:return"IXFR";case 41:return"OPT";case 255:return"ANY"}return"UNKNOWN_"+r};Tr.toType=function(r){switch(r.toUpperCase()){case"A":return 1;case"NULL":return 10;case"AAAA":return 28;case"AFSDB":return 18;case"APL":return 42;case"CAA":return 257;case"CDNSKEY":return 60;case"CDS":return 59;case"CERT":return 37;case"CNAME":return 5;case"DHCID":return 49;case"DLV":return 32769;case"DNAME":return 39;case"DNSKEY":return 48;case"DS":return 43;case"HIP":return 55;case"HINFO":return 13;case"IPSECKEY":return 45;case"KEY":return 25;case"KX":return 36;case"LOC":return 29;case"MX":return 15;case"NAPTR":return 35;case"NS":return 2;case"NSEC":return 47;case"NSEC3":return 50;case"NSEC3PARAM":return 51;case"PTR":return 12;case"RRSIG":return 46;case"RP":return 17;case"SIG":return 24;case"SOA":return 6;case"SPF":return 99;case"SRV":return 33;case"SSHFP":return 44;case"TA":return 32768;case"TKEY":return 249;case"TLSA":return 52;case"TSIG":return 250;case"TXT":return 16;case"AXFR":return 252;case"IXFR":return 251;case"OPT":return 41;case"ANY":return 255;case"*":return 255}return r.toUpperCase().startsWith("UNKNOWN_")?parseInt(r.slice(8)):0}});var zn=L(Br=>{"use strict";Br.toString=function(r){switch(r){case 0:return"NOERROR";case 1:return"FORMERR";case 2:return"SERVFAIL";case 3:return"NXDOMAIN";case 4:return"NOTIMP";case 5:return"REFUSED";case 6:return"YXDOMAIN";case 7:return"YXRRSET";case 8:return"NXRRSET";case 9:return"NOTAUTH";case 10:return"NOTZONE";case 11:return"RCODE_11";case 12:return"RCODE_12";case 13:return"RCODE_13";case 14:return"RCODE_14";case 15:return"RCODE_15"}return"RCODE_"+r};Br.toRcode=function(r){switch(r.toUpperCase()){case"NOERROR":return 0;case"FORMERR":return 1;case"SERVFAIL":return 2;case"NXDOMAIN":return 3;case"NOTIMP":return 4;case"REFUSED":return 5;case"YXDOMAIN":return 6;case"YXRRSET":return 7;case"NXRRSET":return 8;case"NOTAUTH":return 9;case"NOTZONE":return 10;case"RCODE_11":return 11;case"RCODE_12":return 12;case"RCODE_13":return 13;case"RCODE_14":return 14;case"RCODE_15":return 15}return 0}});var $n=L(Nr=>{"use strict";Nr.toString=function(r){switch(r){case 0:return"QUERY";case 1:return"IQUERY";case 2:return"STATUS";case 3:return"OPCODE_3";case 4:return"NOTIFY";case 5:return"UPDATE";case 6:return"OPCODE_6";case 7:return"OPCODE_7";case 8:return"OPCODE_8";case 9:return"OPCODE_9";case 10:return"OPCODE_10";case 11:return"OPCODE_11";case 12:return"OPCODE_12";case 13:return"OPCODE_13";case 14:return"OPCODE_14";case 15:return"OPCODE_15"}return"OPCODE_"+r};Nr.toOpcode=function(r){switch(r.toUpperCase()){case"QUERY":return 0;case"IQUERY":return 1;case"STATUS":return 2;case"OPCODE_3":return 3;case"NOTIFY":return 4;case"UPDATE":return 5;case"OPCODE_6":return 6;case"OPCODE_7":return 7;case"OPCODE_8":return 8;case"OPCODE_9":return 9;case"OPCODE_10":return 10;case"OPCODE_11":return 11;case"OPCODE_12":return 12;case"OPCODE_13":return 13;case"OPCODE_14":return 14;case"OPCODE_15":return 15}return 0}});var Vn=L(Pr=>{"use strict";Pr.toString=function(r){switch(r){case 1:return"IN";case 2:return"CS";case 3:return"CH";case 4:return"HS";case 255:return"ANY"}return"UNKNOWN_"+r};Pr.toClass=function(r){switch(r.toUpperCase()){case"IN":return 1;case"CS":return 2;case"CH":return 3;case"HS":return 4;case"ANY":return 255}return 0}});var jn=L(Dr=>{"use strict";Dr.toString=function(r){switch(r){case 1:return"LLQ";case 2:return"UL";case 3:return"NSID";case 5:return"DAU";case 6:return"DHU";case 7:return"N3U";case 8:return"CLIENT_SUBNET";case 9:return"EXPIRE";case 10:return"COOKIE";case 11:return"TCP_KEEPALIVE";case 12:return"PADDING";case 13:return"CHAIN";case 14:return"KEY_TAG";case 26946:return"DEVICEID"}return r<0?null:`OPTION_${r}`};Dr.toCode=function(r){if(typeof r=="number")return r;if(!r)return-1;switch(r.toUpperCase()){case"OPTION_0":return 0;case"LLQ":return 1;case"UL":return 2;case"NSID":return 3;case"OPTION_4":return 4;case"DAU":return 5;case"DHU":return 6;case"N3U":return 7;case"CLIENT_SUBNET":return 8;case"EXPIRE":return 9;case"COOKIE":return 10;case"TCP_KEEPALIVE":return 11;case"PADDING":return 12;case"CHAIN":return 13;case"KEY_TAG":return 14;case"DEVICEID":return 26946;case"OPTION_65535":return 65535}let e=r.match(/_(\d+)$/);return e?parseInt(e[1],10):-1}});var Yn=L((Hn,Rr)=>{var Kn=function(r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.decode=a,r.encode=p,r.familyOf=E,r.name=void 0,r.sizeOf=w,r.v6=r.v4=void 0;let e=/^(\d{1,3}\.){3,3}\d{1,3}$/,n=4,t=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i,o=16,i={name:"v4",size:n,isFormat:d=>e.test(d),encode(d,u,c){c=~~c,u=u||new Uint8Array(c+n);let g=d.length,I=0;for(let C=0;C<g;){let v=d.charCodeAt(C++);v===46?(u[c++]=I,I=0):I=I*10+(v-48)}return u[c]=I,u},decode(d,u){return u=~~u,`${d[u++]}.${d[u++]}.${d[u++]}.${d[u]}`}};r.v4=i;let s={name:"v6",size:o,isFormat:d=>d.length>0&&t.test(d),encode(d,u,c){c=~~c;let g=c+o,I=-1,C=0,v=0,B=!0,S=!1;u=u||new Uint8Array(c+o);for(let O=0;O<d.length;O++){let U=d.charCodeAt(O);U===58?(B?I!==-1?(c<g&&(u[c]=0),c<g-1&&(u[c+1]=0),c+=2):c<g&&(I=c):(S===!0?(c<g&&(u[c]=v),c++):(c<g&&(u[c]=C>>8),c<g-1&&(u[c+1]=C&255),c+=2),C=0,v=0),B=!0,S=!1):U===46?(c<g&&(u[c]=v),c++,v=0,C=0,B=!1,S=!0):(B=!1,U>=97?U-=87:U>=65?U-=55:(U-=48,v=v*10+U),C=(C<<4)+U)}if(B===!1)S===!0?(c<g&&(u[c]=v),c++):(c<g&&(u[c]=C>>8),c<g-1&&(u[c+1]=C&255),c+=2);else if(I===0)c<g&&(u[c]=0),c<g-1&&(u[c+1]=0),c+=2;else if(I!==-1){c+=2;for(let O=Math.min(c-1,g-1);O>=I+2;O--)u[O]=u[O-2];u[I]=0,u[I+1]=0,I=c}if(I!==c&&I!==-1)for(c>g-2&&(c=g-2);g>I;)u[--g]=c<g&&c>I?u[--c]:0;else for(;c<g;)u[c++]=0;return u},decode(d,u){u=~~u;let c="";for(let g=0;g<o;g+=2)g!==0&&(c+=":"),c+=(d[u+g]<<8|d[u+g+1]).toString(16);return c.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}};r.v6=s;let l="ip";r.name=l;function w(d){if(i.isFormat(d))return i.size;if(s.isFormat(d))return s.size;throw Error(`Invalid ip address: ${d}`)}function E(d){return w(d)===i.size?1:2}function p(d,u,c){c=~~c;let g=w(d);return typeof u=="function"&&(u=u(c+g)),g===i.size?i.encode(d,u,c):s.encode(d,u,c)}function a(d,u,c){if(u=~~u,c=c||d.length-u,c===i.size)return i.decode(d,u,c);if(c===s.size)return s.decode(d,u,c);throw Error(`Invalid buffer size needs to be ${i.size} for v4 or ${s.size} for v6.`)}return"default"in r?r.default:r}({});typeof define=="function"&&define.amd?define([],function(){return Kn}):typeof Rr=="object"&&typeof Hn=="object"&&(Rr.exports=Kn)});var Qn=L(m=>{"use strict";var y=ce("buffer").Buffer,we=qn(),$o=zn(),Vo=$n(),ar=Vn(),Fr=jn(),Ue=Yn(),jo=0,Gn=32768,_r=32768,Ko=~_r,Xn=32768,Ho=~Xn,h=m.name={};h.encode=function(r,e,n){e||(e=y.alloc(h.encodingLength(r))),n||(n=0);let t=n,o=r.replace(/^\.|\.$/gm,"");if(o.length){let i=o.split(".");for(let s=0;s<i.length;s++){let l=e.write(i[s],n+1);e[n]=l,n+=l+1}}return e[n++]=0,h.encode.bytes=n-t,e};h.encode.bytes=0;h.decode=function(r,e){e||(e=0);let n=[],t=e,o=0,i=0,s=!1;for(;;){if(e>=r.length)throw new Error("Cannot decode name (buffer overflow)");let l=r[e++];if(i+=s?0:1,l===0)break;if(l&192)if((l&192)===192){if(e+1>r.length)throw new Error("Cannot decode name (buffer overflow)");let w=r.readUInt16BE(e-1)-49152;if(w>=t)throw new Error("Cannot decode name (bad pointer)");e=w,t=w,i+=s?0:1,s=!0}else throw new Error("Cannot decode name (bad label)");else{if(e+l>r.length)throw new Error("Cannot decode name (buffer overflow)");if(o+=l+1,o>254)throw new Error("Cannot decode name (name too long)");n.push(r.toString("utf-8",e,e+l)),e+=l,i+=s?0:l}}return h.decode.bytes=i,n.length===0?".":n.join(".")};h.decode.bytes=0;h.encodingLength=function(r){return r==="."||r===".."?1:y.byteLength(r.replace(/^\.|\.$/gm,""))+2};var x={};x.encode=function(r,e,n){e||(e=y.alloc(x.encodingLength(r))),n||(n=0);let t=e.write(r,n+1);return e[n]=t,x.encode.bytes=t+1,e};x.encode.bytes=0;x.decode=function(r,e){e||(e=0);let n=r[e],t=r.toString("utf-8",e+1,e+1+n);return x.decode.bytes=n+1,t};x.decode.bytes=0;x.encodingLength=function(r){return y.byteLength(r)+1};var J={};J.encode=function(r,e,n){e||(e=J.encodingLength(r)),n||(n=0);let t=(r.flags||0)&32767,o=r.type==="response"?Gn:jo;return e.writeUInt16BE(r.id||0,n),e.writeUInt16BE(t|o,n+2),e.writeUInt16BE(r.questions.length,n+4),e.writeUInt16BE(r.answers.length,n+6),e.writeUInt16BE(r.authorities.length,n+8),e.writeUInt16BE(r.additionals.length,n+10),e};J.encode.bytes=12;J.decode=function(r,e){if(e||(e=0),r.length<12)throw new Error("Header must be 12 bytes");let n=r.readUInt16BE(e+2);return{id:r.readUInt16BE(e),type:n&Gn?"response":"query",flags:n&32767,flag_qr:(n>>15&1)===1,opcode:Vo.toString(n>>11&15),flag_aa:(n>>10&1)===1,flag_tc:(n>>9&1)===1,flag_rd:(n>>8&1)===1,flag_ra:(n>>7&1)===1,flag_z:(n>>6&1)===1,flag_ad:(n>>5&1)===1,flag_cd:(n>>4&1)===1,rcode:$o.toString(n&15),questions:new Array(r.readUInt16BE(e+4)),answers:new Array(r.readUInt16BE(e+6)),authorities:new Array(r.readUInt16BE(e+8)),additionals:new Array(r.readUInt16BE(e+10))}};J.decode.bytes=12;J.encodingLength=function(){return 12};var ae=m.unknown={};ae.encode=function(r,e,n){return e||(e=y.alloc(ae.encodingLength(r))),n||(n=0),e.writeUInt16BE(r.length,n),r.copy(e,n+2),ae.encode.bytes=r.length+2,e};ae.encode.bytes=0;ae.decode=function(r,e){e||(e=0);let n=r.readUInt16BE(e),t=r.slice(e+2,e+2+n);return ae.decode.bytes=n+2,t};ae.decode.bytes=0;ae.encodingLength=function(r){return r.length+2};var de=m.ns={};de.encode=function(r,e,n){return e||(e=y.alloc(de.encodingLength(r))),n||(n=0),h.encode(r,e,n+2),e.writeUInt16BE(h.encode.bytes,n),de.encode.bytes=h.encode.bytes+2,e};de.encode.bytes=0;de.decode=function(r,e){e||(e=0);let n=r.readUInt16BE(e),t=h.decode(r,e+2);return de.decode.bytes=n+2,t};de.decode.bytes=0;de.encodingLength=function(r){return h.encodingLength(r)+2};var le=m.soa={};le.encode=function(r,e,n){e||(e=y.alloc(le.encodingLength(r))),n||(n=0);let t=n;return n+=2,h.encode(r.mname,e,n),n+=h.encode.bytes,h.encode(r.rname,e,n),n+=h.encode.bytes,e.writeUInt32BE(r.serial||0,n),n+=4,e.writeUInt32BE(r.refresh||0,n),n+=4,e.writeUInt32BE(r.retry||0,n),n+=4,e.writeUInt32BE(r.expire||0,n),n+=4,e.writeUInt32BE(r.minimum||0,n),n+=4,e.writeUInt16BE(n-t-2,t),le.encode.bytes=n-t,e};le.encode.bytes=0;le.decode=function(r,e){e||(e=0);let n=e,t={};return e+=2,t.mname=h.decode(r,e),e+=h.decode.bytes,t.rname=h.decode(r,e),e+=h.decode.bytes,t.serial=r.readUInt32BE(e),e+=4,t.refresh=r.readUInt32BE(e),e+=4,t.retry=r.readUInt32BE(e),e+=4,t.expire=r.readUInt32BE(e),e+=4,t.minimum=r.readUInt32BE(e),e+=4,le.decode.bytes=e-n,t};le.decode.bytes=0;le.encodingLength=function(r){return 22+h.encodingLength(r.mname)+h.encodingLength(r.rname)};var ue=m.txt={};ue.encode=function(r,e,n){Array.isArray(r)||(r=[r]);for(let o=0;o<r.length;o++)if(typeof r[o]=="string"&&(r[o]=y.from(r[o])),!y.isBuffer(r[o]))throw new Error("Must be a Buffer");e||(e=y.alloc(ue.encodingLength(r))),n||(n=0);let t=n;return n+=2,r.forEach(function(o){e[n++]=o.length,o.copy(e,n,0,o.length),n+=o.length}),e.writeUInt16BE(n-t-2,t),ue.encode.bytes=n-t,e};ue.encode.bytes=0;ue.decode=function(r,e){e||(e=0);let n=e,t=r.readUInt16BE(e);e+=2;let o=[];for(;t>0;){let i=r[e++];if(--t,t<i)throw new Error("Buffer overflow");o.push(r.slice(e,e+i)),e+=i,t-=i}return ue.decode.bytes=e-n,o};ue.decode.bytes=0;ue.encodingLength=function(r){Array.isArray(r)||(r=[r]);let e=2;return r.forEach(function(n){typeof n=="string"?e+=y.byteLength(n)+1:e+=n.length+1}),e};var he=m.null={};he.encode=function(r,e,n){e||(e=y.alloc(he.encodingLength(r))),n||(n=0),typeof r=="string"&&(r=y.from(r)),r||(r=y.alloc(0));let t=n;n+=2;let o=r.length;return r.copy(e,n,0,o),n+=o,e.writeUInt16BE(n-t-2,t),he.encode.bytes=n-t,e};he.encode.bytes=0;he.decode=function(r,e){e||(e=0);let n=e,t=r.readUInt16BE(e);e+=2;let o=r.slice(e,e+t);return e+=t,he.decode.bytes=e-n,o};he.decode.bytes=0;he.encodingLength=function(r){return r?(y.isBuffer(r)?r.length:y.byteLength(r))+2:2};var pe=m.hinfo={};pe.encode=function(r,e,n){e||(e=y.alloc(pe.encodingLength(r))),n||(n=0);let t=n;return n+=2,x.encode(r.cpu,e,n),n+=x.encode.bytes,x.encode(r.os,e,n),n+=x.encode.bytes,e.writeUInt16BE(n-t-2,t),pe.encode.bytes=n-t,e};pe.encode.bytes=0;pe.decode=function(r,e){e||(e=0);let n=e,t={};return e+=2,t.cpu=x.decode(r,e),e+=x.decode.bytes,t.os=x.decode(r,e),e+=x.decode.bytes,pe.decode.bytes=e-n,t};pe.decode.bytes=0;pe.encodingLength=function(r){return x.encodingLength(r.cpu)+x.encodingLength(r.os)+2};var Q=m.ptr={},Yo=m.cname=Q,Go=m.dname=Q;Q.encode=function(r,e,n){return e||(e=y.alloc(Q.encodingLength(r))),n||(n=0),h.encode(r,e,n+2),e.writeUInt16BE(h.encode.bytes,n),Q.encode.bytes=h.encode.bytes+2,e};Q.encode.bytes=0;Q.decode=function(r,e){e||(e=0);let n=h.decode(r,e+2);return Q.decode.bytes=h.decode.bytes+2,n};Q.decode.bytes=0;Q.encodingLength=function(r){return h.encodingLength(r)+2};var ge=m.srv={};ge.encode=function(r,e,n){e||(e=y.alloc(ge.encodingLength(r))),n||(n=0),e.writeUInt16BE(r.priority||0,n+2),e.writeUInt16BE(r.weight||0,n+4),e.writeUInt16BE(r.port||0,n+6),h.encode(r.target,e,n+8);let t=h.encode.bytes+6;return e.writeUInt16BE(t,n),ge.encode.bytes=t+2,e};ge.encode.bytes=0;ge.decode=function(r,e){e||(e=0);let n=r.readUInt16BE(e),t={};return t.priority=r.readUInt16BE(e+2),t.weight=r.readUInt16BE(e+4),t.port=r.readUInt16BE(e+6),t.target=h.decode(r,e+8),ge.decode.bytes=n+2,t};ge.decode.bytes=0;ge.encodingLength=function(r){return 8+h.encodingLength(r.target)};var V=m.caa={};V.ISSUER_CRITICAL=128;V.encode=function(r,e,n){let t=V.encodingLength(r);return e||(e=y.alloc(V.encodingLength(r))),n||(n=0),r.issuerCritical&&(r.flags=V.ISSUER_CRITICAL),e.writeUInt16BE(t-2,n),n+=2,e.writeUInt8(r.flags||0,n),n+=1,x.encode(r.tag,e,n),n+=x.encode.bytes,e.write(r.value,n),n+=y.byteLength(r.value),V.encode.bytes=t,e};V.encode.bytes=0;V.decode=function(r,e){e||(e=0);let n=r.readUInt16BE(e);e+=2;let t=e,o={};return o.flags=r.readUInt8(e),e+=1,o.tag=x.decode(r,e),e+=x.decode.bytes,o.value=r.toString("utf-8",e,t+n),o.issuerCritical=!!(o.flags&V.ISSUER_CRITICAL),V.decode.bytes=n+2,o};V.decode.bytes=0;V.encodingLength=function(r){return x.encodingLength(r.tag)+x.encodingLength(r.value)+2};var xe=m.mx={};xe.encode=function(r,e,n){e||(e=y.alloc(xe.encodingLength(r))),n||(n=0);let t=n;return n+=2,e.writeUInt16BE(r.preference||0,n),n+=2,h.encode(r.exchange,e,n),n+=h.encode.bytes,e.writeUInt16BE(n-t-2,t),xe.encode.bytes=n-t,e};xe.encode.bytes=0;xe.decode=function(r,e){e||(e=0);let n=e,t={};return e+=2,t.preference=r.readUInt16BE(e),e+=2,t.exchange=h.decode(r,e),e+=h.decode.bytes,xe.decode.bytes=e-n,t};xe.encodingLength=function(r){return 4+h.encodingLength(r.exchange)};var me=m.a={};me.encode=function(r,e,n){return e||(e=y.alloc(me.encodingLength(r))),n||(n=0),e.writeUInt16BE(4,n),n+=2,Ue.v4.encode(r,e,n),me.encode.bytes=6,e};me.encode.bytes=0;me.decode=function(r,e){e||(e=0),e+=2;let n=Ue.v4.decode(r,e);return me.decode.bytes=6,n};me.decode.bytes=0;me.encodingLength=function(){return 6};var ye=m.aaaa={};ye.encode=function(r,e,n){return e||(e=y.alloc(ye.encodingLength(r))),n||(n=0),e.writeUInt16BE(16,n),n+=2,Ue.v6.encode(r,e,n),ye.encode.bytes=18,e};ye.encode.bytes=0;ye.decode=function(r,e){e||(e=0),e+=2;let n=Ue.v6.decode(r,e);return ye.decode.bytes=18,n};ye.decode.bytes=0;ye.encodingLength=function(){return 18};var _=m.option={};_.encode=function(r,e,n){e||(e=y.alloc(_.encodingLength(r))),n||(n=0);let t=n,o=Fr.toCode(r.code);if(e.writeUInt16BE(o,n),n+=2,r.data)e.writeUInt16BE(r.data.length,n),n+=2,r.data.copy(e,n),n+=r.data.length;else switch(o){case 8:let i=r.sourcePrefixLength||0,s=r.family||Ue.familyOf(r.ip),l=Ue.encode(r.ip,y.alloc),w=Math.ceil(i/8);e.writeUInt16BE(w+4,n),n+=2,e.writeUInt16BE(s,n),n+=2,e.writeUInt8(i,n++),e.writeUInt8(r.scopePrefixLength||0,n++),l.copy(e,n,0,w),n+=w;break;case 11:r.timeout?(e.writeUInt16BE(2,n),n+=2,e.writeUInt16BE(r.timeout,n),n+=2):(e.writeUInt16BE(0,n),n+=2);break;case 12:let E=r.length||0;e.writeUInt16BE(E,n),n+=2,e.fill(0,n,n+E),n+=E;break;case 14:let p=r.tags.length*2;e.writeUInt16BE(p,n),n+=2;for(let a of r.tags)e.writeUInt16BE(a,n),n+=2;break;default:throw new Error(`Unknown roption code: ${r.code}`)}return _.encode.bytes=n-t,e};_.encode.bytes=0;_.decode=function(r,e){e||(e=0);let n={};n.code=r.readUInt16BE(e),n.type=Fr.toString(n.code),e+=2;let t=r.readUInt16BE(e);switch(e+=2,n.data=r.slice(e,e+t),n.code){case 8:n.family=r.readUInt16BE(e),e+=2,n.sourcePrefixLength=r.readUInt8(e++),n.scopePrefixLength=r.readUInt8(e++);let o=y.alloc(n.family===1?4:16);r.copy(o,0,e,e+t-4),n.ip=Ue.decode(o);break;case 11:t>0&&(n.timeout=r.readUInt16BE(e),e+=2);break;case 14:n.tags=[];for(let i=0;i<t;i+=2)n.tags.push(r.readUInt16BE(e)),e+=2}return _.decode.bytes=t+4,n};_.decode.bytes=0;_.encodingLength=function(r){if(r.data)return r.data.length+4;switch(Fr.toCode(r.code)){case 8:let n=r.sourcePrefixLength||0;return Math.ceil(n/8)+8;case 11:return typeof r.timeout=="number"?6:4;case 12:return r.length+4;case 14:return 4+r.tags.length*2}throw new Error(`Unknown roption code: ${r.code}`)};var K=m.opt={};K.encode=function(r,e,n){e||(e=y.alloc(K.encodingLength(r))),n||(n=0);let t=n,o=Re(r,_);return e.writeUInt16BE(o,n),n=Ve(r,_,e,n+2),K.encode.bytes=n-t,e};K.encode.bytes=0;K.decode=function(r,e){e||(e=0);let n=e,t=[],o=r.readUInt16BE(e);e+=2;let i=0;for(;o>0;)t[i++]=_.decode(r,e),e+=_.decode.bytes,o-=_.decode.bytes;return K.decode.bytes=e-n,t};K.decode.bytes=0;K.encodingLength=function(r){return 2+Re(r||[],_)};var F=m.dnskey={};F.PROTOCOL_DNSSEC=3;F.ZONE_KEY=128;F.SECURE_ENTRYPOINT=32768;F.encode=function(r,e,n){e||(e=y.alloc(F.encodingLength(r))),n||(n=0);let t=n,o=r.key;if(!y.isBuffer(o))throw new Error("Key must be a Buffer");return n+=2,e.writeUInt16BE(r.flags,n),n+=2,e.writeUInt8(F.PROTOCOL_DNSSEC,n),n+=1,e.writeUInt8(r.algorithm,n),n+=1,o.copy(e,n,0,o.length),n+=o.length,F.encode.bytes=n-t,e.writeUInt16BE(F.encode.bytes-2,t),e};F.encode.bytes=0;F.decode=function(r,e){e||(e=0);let n=e;var t={},o=r.readUInt16BE(e);if(e+=2,t.flags=r.readUInt16BE(e),e+=2,r.readUInt8(e)!==F.PROTOCOL_DNSSEC)throw new Error("Protocol must be 3");return e+=1,t.algorithm=r.readUInt8(e),e+=1,t.key=r.slice(e,n+o+2),e+=t.key.length,F.decode.bytes=e-n,t};F.decode.bytes=0;F.encodingLength=function(r){return 6+y.byteLength(r.key)};var f=m.rrsig={};f.encode=function(r,e,n){e||(e=y.alloc(f.encodingLength(r))),n||(n=0);let t=n,o=r.signature;if(!y.isBuffer(o))throw new Error("Signature must be a Buffer");return n+=2,e.writeUInt16BE(we.toType(r.typeCovered),n),n+=2,e.writeUInt8(r.algorithm,n),n+=1,e.writeUInt8(r.labels,n),n+=1,e.writeUInt32BE(r.originalTTL,n),n+=4,e.writeUInt32BE(r.expiration,n),n+=4,e.writeUInt32BE(r.inception,n),n+=4,e.writeUInt16BE(r.keyTag,n),n+=2,h.encode(r.signersName,e,n),n+=h.encode.bytes,o.copy(e,n,0,o.length),n+=o.length,f.encode.bytes=n-t,e.writeUInt16BE(f.encode.bytes-2,t),e};f.encode.bytes=0;f.decode=function(r,e){e||(e=0);let n=e;var t={},o=r.readUInt16BE(e);return e+=2,t.typeCovered=we.toString(r.readUInt16BE(e)),e+=2,t.algorithm=r.readUInt8(e),e+=1,t.labels=r.readUInt8(e),e+=1,t.originalTTL=r.readUInt32BE(e),e+=4,t.expiration=r.readUInt32BE(e),e+=4,t.inception=r.readUInt32BE(e),e+=4,t.keyTag=r.readUInt16BE(e),e+=2,t.signersName=h.decode(r,e),e+=h.decode.bytes,t.signature=r.slice(e,n+o+2),e+=t.signature.length,f.decode.bytes=e-n,t};f.decode.bytes=0;f.encodingLength=function(r){return 20+h.encodingLength(r.signersName)+y.byteLength(r.signature)};var ee=m.rp={};ee.encode=function(r,e,n){e||(e=y.alloc(ee.encodingLength(r))),n||(n=0);let t=n;return n+=2,h.encode(r.mbox||".",e,n),n+=h.encode.bytes,h.encode(r.txt||".",e,n),n+=h.encode.bytes,ee.encode.bytes=n-t,e.writeUInt16BE(ee.encode.bytes-2,t),e};ee.encode.bytes=0;ee.decode=function(r,e){e||(e=0);let n=e,t={};return e+=2,t.mbox=h.decode(r,e)||".",e+=h.decode.bytes,t.txt=h.decode(r,e)||".",e+=h.decode.bytes,ee.decode.bytes=e-n,t};ee.decode.bytes=0;ee.encodingLength=function(r){return 2+h.encodingLength(r.mbox||".")+h.encodingLength(r.txt||".")};var N={};N.encode=function(r,e,n){e||(e=y.alloc(N.encodingLength(r))),n||(n=0);let t=n;for(var o=[],i=0;i<r.length;i++){var s=we.toType(r[i]);o[s>>8]===void 0&&(o[s>>8]=[]),o[s>>8][s>>3&31]|=1<<7-(s&7)}for(i=0;i<o.length;i++)if(o[i]!==void 0){var l=y.from(o[i]);e.writeUInt8(i,n),n+=1,e.writeUInt8(l.length,n),n+=1,l.copy(e,n),n+=l.length}return N.encode.bytes=n-t,e};N.encode.bytes=0;N.decode=function(r,e,n){e||(e=0);let t=e;for(var o=[];e-t<n;){var i=r.readUInt8(e);e+=1;var s=r.readUInt8(e);e+=1;for(var l=0;l<s;l++)for(var w=r.readUInt8(e+l),E=0;E<8;E++)if(w&1<<7-E){var p=we.toString(i<<8|l<<3|E);o.push(p)}e+=s}return N.decode.bytes=e-t,o};N.decode.bytes=0;N.encodingLength=function(r){for(var e=[],n=0;n<r.length;n++){var t=we.toType(r[n]);e[t>>8]=Math.max(e[t>>8]||0,t&255)}var o=0;for(n=0;n<e.length;n++)e[n]!==void 0&&(o+=2+Math.ceil((e[n]+1)/8));return o};var re=m.nsec={};re.encode=function(r,e,n){e||(e=y.alloc(re.encodingLength(r))),n||(n=0);let t=n;return n+=2,h.encode(r.nextDomain,e,n),n+=h.encode.bytes,N.encode(r.rrtypes,e,n),n+=N.encode.bytes,re.encode.bytes=n-t,e.writeUInt16BE(re.encode.bytes-2,t),e};re.encode.bytes=0;re.decode=function(r,e){e||(e=0);let n=e;var t={},o=r.readUInt16BE(e);return e+=2,t.nextDomain=h.decode(r,e),e+=h.decode.bytes,t.rrtypes=N.decode(r,e,o-(e-n)),e+=N.decode.bytes,re.decode.bytes=e-n,t};re.decode.bytes=0;re.encodingLength=function(r){return 2+h.encodingLength(r.nextDomain)+N.encodingLength(r.rrtypes)};var ne=m.nsec3={};ne.encode=function(r,e,n){e||(e=y.alloc(ne.encodingLength(r))),n||(n=0);let t=n,o=r.salt;if(!y.isBuffer(o))throw new Error("salt must be a Buffer");let i=r.nextDomain;if(!y.isBuffer(i))throw new Error("nextDomain must be a Buffer");return n+=2,e.writeUInt8(r.algorithm,n),n+=1,e.writeUInt8(r.flags,n),n+=1,e.writeUInt16BE(r.iterations,n),n+=2,e.writeUInt8(o.length,n),n+=1,o.copy(e,n,0,o.length),n+=o.length,e.writeUInt8(i.length,n),n+=1,i.copy(e,n,0,i.length),n+=i.length,N.encode(r.rrtypes,e,n),n+=N.encode.bytes,ne.encode.bytes=n-t,e.writeUInt16BE(ne.encode.bytes-2,t),e};ne.encode.bytes=0;ne.decode=function(r,e){e||(e=0);let n=e;var t={},o=r.readUInt16BE(e);e+=2,t.algorithm=r.readUInt8(e),e+=1,t.flags=r.readUInt8(e),e+=1,t.iterations=r.readUInt16BE(e),e+=2;let i=r.readUInt8(e);e+=1,t.salt=r.slice(e,e+i),e+=i;let s=r.readUInt8(e);return e+=1,t.nextDomain=r.slice(e,e+s),e+=s,t.rrtypes=N.decode(r,e,o-(e-n)),e+=N.decode.bytes,ne.decode.bytes=e-n,t};ne.decode.bytes=0;ne.encodingLength=function(r){return 8+r.salt.length+r.nextDomain.length+N.encodingLength(r.rrtypes)};var te=m.ds={};te.encode=function(r,e,n){e||(e=y.alloc(te.encodingLength(r))),n||(n=0);let t=n,o=r.digest;if(!y.isBuffer(o))throw new Error("Digest must be a Buffer");return n+=2,e.writeUInt16BE(r.keyTag,n),n+=2,e.writeUInt8(r.algorithm,n),n+=1,e.writeUInt8(r.digestType,n),n+=1,o.copy(e,n,0,o.length),n+=o.length,te.encode.bytes=n-t,e.writeUInt16BE(te.encode.bytes-2,t),e};te.encode.bytes=0;te.decode=function(r,e){e||(e=0);let n=e;var t={},o=r.readUInt16BE(e);return e+=2,t.keyTag=r.readUInt16BE(e),e+=2,t.algorithm=r.readUInt8(e),e+=1,t.digestType=r.readUInt8(e),e+=1,t.digest=r.slice(e,n+o+2),e+=t.digest.length,te.decode.bytes=e-n,t};te.decode.bytes=0;te.encodingLength=function(r){return 6+y.byteLength(r.digest)};var j=m.sshfp={};j.getFingerprintLengthForHashType=function(e){switch(e){case 1:return 20;case 2:return 32}};j.encode=function(e,n,t){n||(n=y.alloc(j.encodingLength(e))),t||(t=0);let o=t;t+=2,n[t]=e.algorithm,t+=1,n[t]=e.hash,t+=1;let i=y.from(e.fingerprint.toUpperCase(),"hex");if(i.length!==j.getFingerprintLengthForHashType(e.hash))throw new Error("Invalid fingerprint length");return i.copy(n,t),t+=i.byteLength,j.encode.bytes=t-o,n.writeUInt16BE(j.encode.bytes-2,o),n};j.encode.bytes=0;j.decode=function(e,n){n||(n=0);let t=n,o={};n+=2,o.algorithm=e[n],n+=1,o.hash=e[n],n+=1;let i=j.getFingerprintLengthForHashType(o.hash);return o.fingerprint=e.slice(n,n+i).toString("hex").toUpperCase(),n+=i,j.decode.bytes=n-t,o};j.decode.bytes=0;j.encodingLength=function(r){return 4+y.from(r.fingerprint,"hex").byteLength};var oe=m.naptr={};oe.encode=function(r,e,n){e||(e=y.alloc(oe.encodingLength(r))),n||(n=0);let t=n;return n+=2,e.writeUInt16BE(r.order||0,n),n+=2,e.writeUInt16BE(r.preference||0,n),n+=2,x.encode(r.flags,e,n),n+=x.encode.bytes,x.encode(r.services,e,n),n+=x.encode.bytes,x.encode(r.regexp,e,n),n+=x.encode.bytes,h.encode(r.replacement,e,n),n+=h.encode.bytes,oe.encode.bytes=n-t,e.writeUInt16BE(oe.encode.bytes-2,t),e};oe.encode.bytes=0;oe.decode=function(r,e){e||(e=0);let n=e,t={};return e+=2,t.order=r.readUInt16BE(e),e+=2,t.preference=r.readUInt16BE(e),e+=2,t.flags=x.decode(r,e),e+=x.decode.bytes,t.services=x.decode(r,e),e+=x.decode.bytes,t.regexp=x.decode(r,e),e+=x.decode.bytes,t.replacement=h.decode(r,e),e+=h.decode.bytes,oe.decode.bytes=e-n,t};oe.decode.bytes=0;oe.encodingLength=function(r){return x.encodingLength(r.flags)+x.encodingLength(r.services)+x.encodingLength(r.regexp)+h.encodingLength(r.replacement)+6};var ie=m.tlsa={};ie.encode=function(r,e,n){e||(e=y.alloc(ie.encodingLength(r))),n||(n=0);let t=n,o=r.certificate;if(!y.isBuffer(o))throw new Error("Certificate must be a Buffer");return n+=2,e.writeUInt8(r.usage,n),n+=1,e.writeUInt8(r.selector,n),n+=1,e.writeUInt8(r.matchingType,n),n+=1,o.copy(e,n,0,o.length),n+=o.length,ie.encode.bytes=n-t,e.writeUInt16BE(ie.encode.bytes-2,t),e};ie.encode.bytes=0;ie.decode=function(r,e){e||(e=0);let n=e,t={},o=r.readUInt16BE(e);return e+=2,t.usage=r.readUInt8(e),e+=1,t.selector=r.readUInt8(e),e+=1,t.matchingType=r.readUInt8(e),e+=1,t.certificate=r.slice(e,n+o+2),e+=t.certificate.length,ie.decode.bytes=e-n,t};ie.decode.bytes=0;ie.encodingLength=function(r){return 5+y.byteLength(r.certificate)};var Mr=m.record=function(r){switch(r.toUpperCase()){case"A":return me;case"PTR":return Q;case"CNAME":return Yo;case"DNAME":return Go;case"TXT":return ue;case"NULL":return he;case"AAAA":return ye;case"SRV":return ge;case"HINFO":return pe;case"CAA":return V;case"NS":return de;case"SOA":return le;case"MX":return xe;case"OPT":return K;case"DNSKEY":return F;case"RRSIG":return f;case"RP":return ee;case"NSEC":return re;case"NSEC3":return ne;case"SSHFP":return j;case"DS":return te;case"NAPTR":return oe;case"TLSA":return ie}return ae},D=m.answer={};D.encode=function(r,e,n){e||(e=y.alloc(D.encodingLength(r))),n||(n=0);let t=n;if(h.encode(r.name,e,n),n+=h.encode.bytes,e.writeUInt16BE(we.toType(r.type),n),r.type.toUpperCase()==="OPT"){if(r.name!==".")throw new Error("OPT name must be root.");e.writeUInt16BE(r.udpPayloadSize||4096,n+2),e.writeUInt8(r.extendedRcode||0,n+4),e.writeUInt8(r.ednsVersion||0,n+5),e.writeUInt16BE(r.flags||0,n+6),n+=8,K.encode(r.options||[],e,n),n+=K.encode.bytes}else{let o=ar.toClass(r.class===void 0?"IN":r.class);r.flush&&(o|=_r),e.writeUInt16BE(o,n+2),e.writeUInt32BE(r.ttl||0,n+4),n+=8;let i=Mr(r.type);i.encode(r.data,e,n),n+=i.encode.bytes}return D.encode.bytes=n-t,e};D.encode.bytes=0;D.decode=function(r,e){e||(e=0);let n={},t=e;if(n.name=h.decode(r,e),e+=h.decode.bytes,n.type=we.toString(r.readUInt16BE(e)),n.type==="OPT")n.udpPayloadSize=r.readUInt16BE(e+2),n.extendedRcode=r.readUInt8(e+4),n.ednsVersion=r.readUInt8(e+5),n.flags=r.readUInt16BE(e+6),n.flag_do=(n.flags>>15&1)===1,n.options=K.decode(r,e+8),e+=8+K.decode.bytes;else{let o=r.readUInt16BE(e+2);n.ttl=r.readUInt32BE(e+4),n.class=ar.toString(o&Ko),n.flush=!!(o&_r);let i=Mr(n.type);n.data=i.decode(r,e+8),e+=8+i.decode.bytes}return D.decode.bytes=e-t,n};D.decode.bytes=0;D.encodingLength=function(r){let e=r.data!==null&&r.data!==void 0?r.data:r.options;return h.encodingLength(r.name)+8+Mr(r.type).encodingLength(e)};var W=m.question={};W.encode=function(r,e,n){e||(e=y.alloc(W.encodingLength(r))),n||(n=0);let t=n;return h.encode(r.name,e,n),n+=h.encode.bytes,e.writeUInt16BE(we.toType(r.type),n),n+=2,e.writeUInt16BE(ar.toClass(r.class===void 0?"IN":r.class),n),n+=2,W.encode.bytes=n-t,r};W.encode.bytes=0;W.decode=function(r,e){e||(e=0);let n=e,t={};return t.name=h.decode(r,e),e+=h.decode.bytes,t.type=we.toString(r.readUInt16BE(e)),e+=2,t.class=ar.toString(r.readUInt16BE(e)),e+=2,!!(t.class&Xn)&&(t.class&=Ho),W.decode.bytes=e-n,t};W.decode.bytes=0;W.encodingLength=function(r){return h.encodingLength(r.name)+4};m.AUTHORITATIVE_ANSWER=1024;m.TRUNCATED_RESPONSE=512;m.RECURSION_DESIRED=256;m.RECURSION_AVAILABLE=128;m.AUTHENTIC_DATA=32;m.CHECKING_DISABLED=16;m.DNSSEC_OK=32768;m.encode=function(r,e,n){let t=!e;t&&(e=y.alloc(m.encodingLength(r))),n||(n=0);let o=n;return r.questions||(r.questions=[]),r.answers||(r.answers=[]),r.authorities||(r.authorities=[]),r.additionals||(r.additionals=[]),J.encode(r,e,n),n+=J.encode.bytes,n=Ve(r.questions,W,e,n),n=Ve(r.answers,D,e,n),n=Ve(r.authorities,D,e,n),n=Ve(r.additionals,D,e,n),m.encode.bytes=n-o,t&&m.encode.bytes!==e.length?e.slice(0,m.encode.bytes):e};m.encode.bytes=0;m.decode=function(r,e){e||(e=0);let n=e,t=J.decode(r,e);return e+=J.decode.bytes,e=cr(t.questions,W,r,e),e=cr(t.answers,D,r,e),e=cr(t.authorities,D,r,e),e=cr(t.additionals,D,r,e),m.decode.bytes=e-n,t};m.decode.bytes=0;m.encodingLength=function(r){return J.encodingLength(r)+Re(r.questions||[],W)+Re(r.answers||[],D)+Re(r.authorities||[],D)+Re(r.additionals||[],D)};m.streamEncode=function(r){let e=m.encode(r),n=y.alloc(2);n.writeUInt16BE(e.byteLength);let t=y.concat([n,e]);return m.streamEncode.bytes=t.byteLength,t};m.streamEncode.bytes=0;m.streamDecode=function(r){let e=r.readUInt16BE(0);if(r.byteLength<e+2)return null;let n=m.decode(r.slice(2));return m.streamDecode.bytes=m.decode.bytes,n};m.streamDecode.bytes=0;function Re(r,e){let n=0;for(let t=0;t<r.length;t++)n+=e.encodingLength(r[t]);return n}function Ve(r,e,n,t){for(let o=0;o<r.length;o++)e.encode(r[o],n,t),t+=e.encode.bytes;return t}function cr(r,e,n,t){for(let o=0;o<r.length;o++)r[o]=e.decode(n,t),t+=e.decode.bytes;return t}});var Zn=L((sc,Jn)=>{"use strict";var Wn=fo;process.nextTick(Zo,42);Jn.exports=Xo;function Xo(r){var e=t;return n;function n(o){e(o||Wo)}function t(o){var i=[o];e=s,r(l);function s(w){i.push(w)}function l(w){var E=arguments;for(e=Qo(w)?t:p;i.length;)p(i.shift());function p(a){Wn(Jo,a,E)}}}}function Qo(r){return Object.prototype.toString.call(r)==="[object Error]"}function Wo(){}function Jo(r,e){r.apply(null,e)}function Zo(r){r===42&&(Wn=process.nextTick)}function fo(r,e,n){process.nextTick(function(){r(e,n)})}});var rt=L((cc,et)=>{var kr=Qn(),ei=ce("dgram"),ri=Zn(),ni=ce("events"),zr=ce("os"),qr=function(){};et.exports=function(r){r||(r={});var e=new ni.EventEmitter,n=typeof r.port=="number"?r.port:5353,t=r.type||"udp4",o=r.ip||r.host||(t==="udp4"?"224.0.0.251":null),i={address:o,port:n},s={},l=!1,w=null;if(t==="udp6"&&(!o||!r.interface))throw new Error("For IPv6 multicast you must specify `ip` and `interface`");var E=r.socket||ei.createSocket({type:t,reuseAddr:r.reuseAddr!==!1,toString:function(){return t}});E.on("error",function(a){a.code==="EACCES"||a.code==="EADDRINUSE"?e.emit("error",a):e.emit("warning",a)}),E.on("message",function(a,d){try{a=kr.decode(a)}catch(u){e.emit("warning",u);return}e.emit("packet",a,d),a.type==="query"&&e.emit("query",a,d),a.type==="response"&&e.emit("response",a,d)}),E.on("listening",function(){n||(n=i.port=E.address().port),r.multicast!==!1&&(e.update(),w=setInterval(e.update,5e3),E.setMulticastTTL(r.ttl||255),E.setMulticastLoopback(r.loopback!==!1))});var p=ri(function(a){if(!n||r.bind===!1)return a(null);E.once("error",a),E.bind(n,r.bind||r.interface,function(){E.removeListener("error",a),a(null)})});return p(function(a){if(a)return e.emit("error",a);e.emit("ready")}),e.send=function(a,d,u){if(typeof d=="function")return e.send(a,null,d);u||(u=qr),d?!d.host&&!d.address&&(d.address=i.address):d=i,p(c);function c(g){if(l)return u();if(g)return u(g);var I=kr.encode(a);E.send(I,0,I.length,d.port,d.address||d.host,u)}},e.response=e.respond=function(a,d,u){Array.isArray(a)&&(a={answers:a}),a.type="response",a.flags=(a.flags||0)|kr.AUTHORITATIVE_ANSWER,e.send(a,d,u)},e.query=function(a,d,u,c){if(typeof d=="function")return e.query(a,null,null,d);if(typeof d=="object"&&d&&d.port)return e.query(a,null,d,u);if(typeof u=="function")return e.query(a,d,null,u);c||(c=qr),typeof a=="string"&&(a=[{name:a,type:d||"ANY"}]),Array.isArray(a)&&(a={type:"query",questions:a}),a.type="query",e.send(a,u,c)},e.destroy=function(a){if(a||(a=qr),l)return process.nextTick(a);l=!0,clearInterval(w);for(var d in s)try{E.dropMembership(o,d)}catch{}s={},E.close(a)},e.update=function(){for(var a=r.interface?[].concat(r.interface):oi(),d=!1,u=0;u<a.length;u++){var c=a[u];if(!s[c])try{E.addMembership(o,c),s[c]=!0,d=!0}catch(g){e.emit("warning",g)}}if(d){if(E.setMulticastInterface)try{E.setMulticastInterface(r.interface||ti())}catch(g){e.emit("warning",g)}e.emit("networkInterface")}},e};function ti(){for(var r=zr.networkInterfaces(),e=Object.keys(r),n=0;n<e.length;n++)for(var t=r[e[n]],o=0;o<t.length;o++){var i=t[o];if(fn(i.family)&&!i.internal)return zr.platform()==="darwin"&&e[n]==="en0"?i.address:"0.0.0.0"}return"127.0.0.1"}function oi(){for(var r=zr.networkInterfaces(),e=Object.keys(r),n=[],t=0;t<e.length;t++)for(var o=r[e[t]],i=0;i<o.length;i++){var s=o[i];if(fn(s.family)){n.push(s.address);break}}return n}function fn(r){return r===4||r==="IPv4"}});var vt=L((ia,Ct)=>{Ct.exports=tn;var xt=128,Wi=127,Ji=~Wi,Zi=Math.pow(2,31);function tn(r,e,n){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw tn.bytes=0,new RangeError("Could not encode varint");e=e||[],n=n||0;for(var t=n;r>=Zi;)e[n++]=r&255|xt,r/=128;for(;r&Ji;)e[n++]=r&255|xt,r>>>=7;return e[n]=r|0,tn.bytes=n-t+1,e}});var Ut=L((sa,St)=>{St.exports=on;var fi=128,bt=127;function on(r,t){var n=0,t=t||0,o=0,i=t,s,l=r.length;do{if(i>=l||o>49)throw on.bytes=0,new RangeError("Could not decode varint");s=r[i++],n+=o<28?(s&bt)<<o:(s&bt)*Math.pow(2,o),o+=7}while(s>=fi);return on.bytes=i-t,n}});var Ot=L((ca,At)=>{var es=Math.pow(2,7),rs=Math.pow(2,14),ns=Math.pow(2,21),ts=Math.pow(2,28),os=Math.pow(2,35),is=Math.pow(2,42),ss=Math.pow(2,49),cs=Math.pow(2,56),as=Math.pow(2,63);At.exports=function(r){return r<es?1:r<rs?2:r<ns?3:r<ts?4:r<os?5:r<is?6:r<ss?7:r<cs?8:r<as?9:10}});var sn=L((aa,Lt)=>{Lt.exports={encode:vt(),decode:Ut(),encodingLength:Ot()}});var Ds={};q(Ds,{mdns:()=>Ps});var er=class extends EventTarget{#e=new Map;listenerCount(e){let n=this.#e.get(e);return n==null?0:n.length}addEventListener(e,n,t){super.addEventListener(e,n,t);let o=this.#e.get(e);o==null&&(o=[],this.#e.set(e,o)),o.push({callback:n,once:(t!==!0&&t!==!1&&t?.once)??!1})}removeEventListener(e,n,t){super.removeEventListener(e.toString(),n??null,t);let o=this.#e.get(e);o!=null&&(o=o.filter(({callback:i})=>i!==n),this.#e.set(e,o))}dispatchEvent(e){let n=super.dispatchEvent(e),t=this.#e.get(e.type);return t==null||(t=t.filter(({once:o})=>!o),this.#e.set(e.type,t)),n}safeDispatchEvent(e,n){return this.dispatchEvent(new rr(e,n))}},wr=class extends Event{detail;constructor(e,n){super(e,n),this.detail=n?.detail}},rr=globalThis.CustomEvent??wr;var Cn=Symbol.for("@libp2p/peer-discovery");var $=$e(Pn(),1);var Ur={};q(Ur,{base32:()=>X,base32hex:()=>No,base32hexpad:()=>Do,base32hexpadupper:()=>Ro,base32hexupper:()=>Po,base32pad:()=>To,base32padupper:()=>Bo,base32upper:()=>Lo,base32z:()=>Fo});function bo(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),t=0;t<n.length;t++)n[t]=255;for(var o=0;o<r.length;o++){var i=r.charAt(o),s=i.charCodeAt(0);if(n[s]!==255)throw new TypeError(i+" is ambiguous");n[s]=o}var l=r.length,w=r.charAt(0),E=Math.log(l)/Math.log(256),p=Math.log(256)/Math.log(l);function a(c){if(c instanceof Uint8Array||(ArrayBuffer.isView(c)?c=new Uint8Array(c.buffer,c.byteOffset,c.byteLength):Array.isArray(c)&&(c=Uint8Array.from(c))),!(c instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(c.length===0)return"";for(var g=0,I=0,C=0,v=c.length;C!==v&&c[C]===0;)C++,g++;for(var B=(v-C)*p+1>>>0,S=new Uint8Array(B);C!==v;){for(var O=c[C],U=0,k=B-1;(O!==0||U<I)&&k!==-1;k--,U++)O+=256*S[k]>>>0,S[k]=O%l>>>0,O=O/l>>>0;if(O!==0)throw new Error("Non-zero carry");I=U,C++}for(var H=B-I;H!==B&&S[H]===0;)H++;for(var Le=w.repeat(g);H<B;++H)Le+=r.charAt(S[H]);return Le}function d(c){if(typeof c!="string")throw new TypeError("Expected String");if(c.length===0)return new Uint8Array;var g=0;if(c[g]!==" "){for(var I=0,C=0;c[g]===w;)I++,g++;for(var v=(c.length-g)*E+1>>>0,B=new Uint8Array(v);c[g];){var S=n[c.charCodeAt(g)];if(S===255)return;for(var O=0,U=v-1;(S!==0||O<C)&&U!==-1;U--,O++)S+=l*B[U]>>>0,B[U]=S%256>>>0,S=S/256>>>0;if(S!==0)throw new Error("Non-zero carry");C=O,g++}if(c[g]!==" "){for(var k=v-C;k!==v&&B[k]===0;)k++;for(var H=new Uint8Array(I+(v-k)),Le=I;k!==v;)H[Le++]=B[k++];return H}}}function u(c){var g=d(c);if(g)return g;throw new Error(`Non-${e} character`)}return{encode:a,decodeUnsafe:d,decode:u}}var So=bo,Uo=So,Dn=Uo;var js=new Uint8Array(0);var Rn=(r,e)=>{if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let n=0;n<r.byteLength;n++)if(r[n]!==e[n])return!1;return!0},Y=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 Fn=r=>new TextEncoder().encode(r),_n=r=>new TextDecoder().decode(r);var Cr=class{constructor(e,n,t){this.name=e,this.prefix=n,this.baseEncode=t}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},vr=class{constructor(e,n,t){if(this.name=e,this.prefix=n,n.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=n.codePointAt(0),this.baseDecode=t}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return kn(this,e)}},br=class{constructor(e){this.decoders=e}or(e){return kn(this,e)}decode(e){let n=e[0],t=this.decoders[n];if(t)return t.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},kn=(r,e)=>new br({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),Sr=class{constructor(e,n,t,o){this.name=e,this.prefix=n,this.baseEncode=t,this.baseDecode=o,this.encoder=new Cr(e,n,t),this.decoder=new vr(e,n,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},De=({name:r,prefix:e,encode:n,decode:t})=>new Sr(r,e,n,t),Ie=({prefix:r,name:e,alphabet:n})=>{let{encode:t,decode:o}=Dn(n,e);return De({prefix:r,name:e,encode:t,decode:i=>Y(o(i))})},Ao=(r,e,n,t)=>{let o={};for(let p=0;p<e.length;++p)o[e[p]]=p;let i=r.length;for(;r[i-1]==="=";)--i;let s=new Uint8Array(i*n/8|0),l=0,w=0,E=0;for(let p=0;p<i;++p){let a=o[r[p]];if(a===void 0)throw new SyntaxError(`Non-${t} character`);w=w<<n|a,l+=n,l>=8&&(l-=8,s[E++]=255&w>>l)}if(l>=n||255&w<<8-l)throw new SyntaxError("Unexpected end of data");return s},Oo=(r,e,n)=>{let t=e[e.length-1]==="=",o=(1<<n)-1,i="",s=0,l=0;for(let w=0;w<r.length;++w)for(l=l<<8|r[w],s+=8;s>n;)s-=n,i+=e[o&l>>s];if(s&&(i+=e[o&l<<n-s]),t)for(;i.length*n&7;)i+="=";return i},A=({name:r,prefix:e,bitsPerChar:n,alphabet:t})=>De({prefix:e,name:r,encode(o){return Oo(o,t,n)},decode(o){return Ao(o,t,n,r)}});var X=A({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Lo=A({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),To=A({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Bo=A({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),No=A({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Po=A({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Do=A({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Ro=A({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Fo=A({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Ar={};q(Ar,{base58btc:()=>T,base58flickr:()=>_o});var T=Ie({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),_o=Ie({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Lr={};q(Lr,{base64:()=>Or,base64pad:()=>Mo,base64url:()=>ko,base64urlpad:()=>qo});var Or=A({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Mo=A({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),ko=A({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),qo=A({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});$.default.formatters.b=r=>r==null?"undefined":T.baseEncode(r);$.default.formatters.t=r=>r==null?"undefined":X.baseEncode(r);$.default.formatters.m=r=>r==null?"undefined":Or.baseEncode(r);$.default.formatters.p=r=>r==null?"undefined":r.toString();$.default.formatters.c=r=>r==null?"undefined":r.toString();$.default.formatters.k=r=>r==null?"undefined":r.toString();$.default.formatters.a=r=>r==null?"undefined":r.toString();function zo(r){let e=()=>{};return e.enabled=!1,e.color="",e.diff=0,e.log=()=>{},e.namespace=r,e.destroy=()=>!0,e.extend=()=>e,e}function sr(r){let e=zo(`${r}:trace`);return $.default.enabled(`${r}:trace`)&&$.default.names.map(n=>n.toString()).find(n=>n.includes(":trace"))!=null&&(e=(0,$.default)(`${r}:trace`)),Object.assign((0,$.default)(r),{error:(0,$.default)(`${r}:error`),trace:e})}var Yt=$e(rt(),1);var je=class extends Error{code;props;constructor(e,n,t){super(e),this.code=n,this.name=t?.name??"CodeError",this.props=t??{}}};var nt=Symbol.for("@libp2p/peer-id");var $r={};q($r,{identity:()=>ii});var ii=De({prefix:"\0",name:"identity",encode:r=>_n(r),decode:r=>Fn(r)});var Vr={};q(Vr,{base2:()=>si});var si=A({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var jr={};q(jr,{base8:()=>ci});var ci=A({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Kr={};q(Kr,{base10:()=>ai});var ai=Ie({prefix:"9",name:"base10",alphabet:"0123456789"});var Hr={};q(Hr,{base16:()=>di,base16upper:()=>li});var di=A({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),li=A({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Yr={};q(Yr,{base36:()=>ui,base36upper:()=>hi});var ui=Ie({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),hi=Ie({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Gr={};q(Gr,{base256emoji:()=>wi});var tt=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}"),pi=tt.reduce((r,e,n)=>(r[n]=e,r),[]),gi=tt.reduce((r,e,n)=>(r[e.codePointAt(0)]=n,r),[]);function mi(r){return r.reduce((e,n)=>(e+=pi[n],e),"")}function yi(r){let e=[];for(let n of r){let t=gi[n.codePointAt(0)];if(t===void 0)throw new Error(`Non-base256emoji character: ${n}`);e.push(t)}return new Uint8Array(e)}var wi=De({prefix:"\u{1F680}",name:"base256emoji",encode:mi,decode:yi});var Zr={};q(Zr,{sha256:()=>lr,sha512:()=>_i});var Jr=$e(ce("crypto"),1);var Ei=st,ot=128,Ii=127,xi=~Ii,Ci=Math.pow(2,31);function st(r,e,n){e=e||[],n=n||0;for(var t=n;r>=Ci;)e[n++]=r&255|ot,r/=128;for(;r&xi;)e[n++]=r&255|ot,r>>>=7;return e[n]=r|0,st.bytes=n-t+1,e}var vi=Xr,bi=128,it=127;function Xr(r,t){var n=0,t=t||0,o=0,i=t,s,l=r.length;do{if(i>=l)throw Xr.bytes=0,new RangeError("Could not decode varint");s=r[i++],n+=o<28?(s&it)<<o:(s&it)*Math.pow(2,o),o+=7}while(s>=bi);return Xr.bytes=i-t,n}var Si=Math.pow(2,7),Ui=Math.pow(2,14),Ai=Math.pow(2,21),Oi=Math.pow(2,28),Li=Math.pow(2,35),Ti=Math.pow(2,42),Bi=Math.pow(2,49),Ni=Math.pow(2,56),Pi=Math.pow(2,63),Di=function(r){return r<Si?1:r<Ui?2:r<Ai?3:r<Oi?4:r<Li?5:r<Ti?6:r<Bi?7:r<Ni?8:r<Pi?9:10},Ri={encode:Ei,decode:vi,encodingLength:Di},Fi=Ri,Ke=Fi;var He=(r,e=0)=>[Ke.decode(r,e),Ke.decode.bytes],Fe=(r,e,n=0)=>(Ke.encode(r,e,n),e),_e=r=>Ke.encodingLength(r);var Ce=(r,e)=>{let n=e.byteLength,t=_e(r),o=t+_e(n),i=new Uint8Array(o+n);return Fe(r,i,0),Fe(n,i,t),i.set(e,o),new Me(r,n,e,i)},Ae=r=>{let e=Y(r),[n,t]=He(e),[o,i]=He(e.subarray(t)),s=e.subarray(t+i);if(s.byteLength!==o)throw new Error("Incorrect length");return new Me(n,o,s,e)},ct=(r,e)=>{if(r===e)return!0;{let n=e;return r.code===n.code&&r.size===n.size&&n.bytes instanceof Uint8Array&&Rn(r.bytes,n.bytes)}},Me=class{constructor(e,n,t,o){this.code=e,this.size=n,this.digest=t,this.bytes=o}};var Wr=({name:r,code:e,encode:n})=>new Qr(r,e,n),Qr=class{constructor(e,n,t){this.name=e,this.code=n,this.encode=t}digest(e){if(e instanceof Uint8Array){let n=this.encode(e);return n instanceof Uint8Array?Ce(this.code,n):n.then(t=>Ce(this.code,t))}else throw Error("Unknown type, must be binary type")}};var lr=Wr({name:"sha2-256",code:18,encode:r=>Y(Jr.default.createHash("sha256").update(r).digest())}),_i=Wr({name:"sha2-512",code:19,encode:r=>Y(Jr.default.createHash("sha512").update(r).digest())});var fr={};q(fr,{identity:()=>ur});var dt=0,Mi="identity",lt=Y,ki=r=>Ce(dt,lt(r)),ur={code:dt,name:Mi,encode:lt,digest:ki};var Uc=new TextEncoder,Ac=new TextDecoder;var ut=(r,e)=>{let{bytes:n,version:t}=r;switch(t){case 0:return Vi(n,en(r),e||T.encoder);default:return ji(n,en(r),e||X.encoder)}};var ht=new WeakMap,en=r=>{let e=ht.get(r);if(e==null){let n=new Map;return ht.set(r,n),n}return e},Z=class r{constructor(e,n,t,o){this.code=n,this.version=e,this.multihash=t,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:n}=this;if(e!==Ye)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(n.code!==Ki)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(n)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:n}=this.multihash,t=Ce(e,n);return r.createV1(this.code,t)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return r.equals(this,e)}static equals(e,n){let t=n;return t&&e.code===t.code&&e.version===t.version&&ct(e.multihash,t.multihash)}toString(e){return ut(this,e)}toJSON(){return{"/":ut(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let n=e;if(n instanceof r)return n;if(n["/"]!=null&&n["/"]===n.bytes||n.asCID===n){let{version:t,code:o,multihash:i,bytes:s}=n;return new r(t,o,i,s||pt(t,o,i.bytes))}else if(n[Hi]===!0){let{version:t,multihash:o,code:i}=n,s=Ae(o);return r.create(t,i,s)}else return null}static create(e,n,t){if(typeof n!="number")throw new Error("String codecs are no longer supported");if(!(t.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(n!==Ye)throw new Error(`Version 0 CID must use dag-pb (code: ${Ye}) block encoding`);return new r(e,n,t,t.bytes)}case 1:{let o=pt(e,n,t.bytes);return new r(e,n,t,o)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,Ye,e)}static createV1(e,n){return r.create(1,e,n)}static decode(e){let[n,t]=r.decodeFirst(e);if(t.length)throw new Error("Incorrect length");return n}static decodeFirst(e){let n=r.inspectBytes(e),t=n.size-n.multihashSize,o=Y(e.subarray(t,t+n.multihashSize));if(o.byteLength!==n.multihashSize)throw new Error("Incorrect length");let i=o.subarray(n.multihashSize-n.digestSize),s=new Me(n.multihashCode,n.digestSize,i,o);return[n.version===0?r.createV0(s):r.createV1(n.codec,s),e.subarray(n.size)]}static inspectBytes(e){let n=0,t=()=>{let[a,d]=He(e.subarray(n));return n+=d,a},o=t(),i=Ye;if(o===18?(o=0,n=0):i=t(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let s=n,l=t(),w=t(),E=n+w,p=E-s;return{version:o,codec:i,multihashCode:l,digestSize:w,multihashSize:p,size:E}}static parse(e,n){let[t,o]=$i(e,n),i=r.decode(o);if(i.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return en(i).set(t,e),i}},$i=(r,e)=>{switch(r[0]){case"Q":{let n=e||T;return[T.prefix,n.decode(`${T.prefix}${r}`)]}case T.prefix:{let n=e||T;return[T.prefix,n.decode(r)]}case X.prefix:{let n=e||X;return[X.prefix,n.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}},Vi=(r,e,n)=>{let{prefix:t}=n;if(t!==T.prefix)throw Error(`Cannot string encode V0 in ${n.name} encoding`);let o=e.get(t);if(o==null){let i=n.encode(r).slice(1);return e.set(t,i),i}else return o},ji=(r,e,n)=>{let{prefix:t}=n,o=e.get(t);if(o==null){let i=n.encode(r);return e.set(t,i),i}else return o},Ye=112,Ki=18,pt=(r,e,n)=>{let t=_e(r),o=t+_e(e),i=new Uint8Array(o+n.byteLength);return Fe(r,i,0),Fe(e,i,t),i.set(n,o),i},Hi=Symbol.for("@ipld/js-cid/CID");var ve={...$r,...Vr,...jr,...Kr,...Hr,...Ur,...Yr,...Ar,...Lr,...Gr},_c={...Zr,...fr};function Ge(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let n=0;n<r.byteLength;n++)if(r[n]!==e[n])return!1;return!0}var Yi=Symbol.for("nodejs.util.inspect.custom"),gt=Object.values(ve).map(r=>r.decoder).reduce((r,e)=>r.or(e),ve.identity.decoder),mt=114,yt=36,wt=37,Xe=class{type;multihash;privateKey;publicKey;string;constructor(e){this.type=e.type,this.multihash=e.multihash,this.privateKey=e.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}[nt]=!0;toString(){return this.string==null&&(this.string=T.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return Z.createV1(mt,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e instanceof Uint8Array)return Ge(this.multihash.bytes,e);if(typeof e=="string")return rn(e).equals(this);if(e?.multihash?.bytes!=null)return Ge(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[Yi](){return`PeerId(${this.toString()})`}},Qe=class extends Xe{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},We=class extends Xe{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.multihash.digest}},Je=class extends Xe{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.multihash.digest}};function rn(r,e){if(e=e??gt,r.charAt(0)==="1"||r.charAt(0)==="Q"){let n=Ae(T.decode(`z${r}`));return r.startsWith("12D")?new We({multihash:n}):r.startsWith("16U")?new Je({multihash:n}):new Qe({multihash:n})}return Gi(gt.decode(r))}function Gi(r){try{let e=Ae(r);if(e.code===ur.code){if(e.digest.length===yt)return new We({multihash:e});if(e.digest.length===wt)return new Je({multihash:e})}if(e.code===lr.code)return new Qe({multihash:e})}catch{return Xi(Z.decode(r))}throw new Error("Supplied PeerID CID is invalid")}function Xi(r){if(r==null||r.multihash==null||r.version==null||r.version===1&&r.code!==mt)throw new Error("Supplied PeerID CID is invalid");let e=r.multihash;if(e.code===lr.code)return new Qe({multihash:r.multihash});if(e.code===ur.code){if(e.digest.length===yt)return new We({multihash:r.multihash});if(e.digest.length===wt)return new Je({multihash:r.multihash})}throw new Error("Supplied PeerID CID is invalid")}function ke(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function hr(r=0){return globalThis.Buffer?.allocUnsafe!=null?ke(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function It(r,e,n,t){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:n},decoder:{decode:t}}}var Et=It("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),nn=It("ascii","a",r=>{let e="a";for(let n=0;n<r.length;n++)e+=String.fromCharCode(r[n]);return e},r=>{r=r.substring(1);let e=hr(r.length);for(let n=0;n<r.length;n++)e[n]=r.charCodeAt(n);return e}),Qi={utf8:Et,"utf-8":Et,hex:ve.base16,latin1:nn,ascii:nn,binary:nn,...ve},pr=Qi;function M(r,e="utf8"){let n=pr[e];if(n==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):n.encoder.encode(r).substring(1)}function Ee(r,e){e==null&&(e=r.reduce((o,i)=>o+i.length,0));let n=hr(e),t=0;for(let o of r)n.set(o,t),t+=o.length;return ke(n)}var ze=$e(sn(),1);var gr=class{index=0;input="";new(e){return this.index=0,this.input=e,this}readAtomically(e){let n=this.index,t=e();return t===void 0&&(this.index=n),t}parseWith(e){let n=e();if(this.index===this.input.length)return n}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(e){return this.readAtomically(()=>{let n=this.readChar();if(n===e)return n})}readSeparator(e,n,t){return this.readAtomically(()=>{if(!(n>0&&this.readGivenChar(e)===void 0))return t()})}readNumber(e,n,t,o){return this.readAtomically(()=>{let i=0,s=0,l=this.peekChar();if(l===void 0)return;let w=l==="0",E=2**(8*o)-1;for(;;){let p=this.readAtomically(()=>{let a=this.readChar();if(a===void 0)return;let d=Number.parseInt(a,e);if(!Number.isNaN(d))return d});if(p===void 0)break;if(i*=e,i+=p,i>E||(s+=1,n!==void 0&&s>n))return}if(s!==0)return!t&&w&&s>1?void 0:i})}readIPv4Addr(){return this.readAtomically(()=>{let e=new Uint8Array(4);for(let n=0;n<e.length;n++){let t=this.readSeparator(".",n,()=>this.readNumber(10,3,!1,1));if(t===void 0)return;e[n]=t}return e})}readIPv6Addr(){let e=n=>{for(let t=0;t<n.length/2;t++){let o=t*2;if(t<n.length-3){let s=this.readSeparator(":",t,()=>this.readIPv4Addr());if(s!==void 0)return n[o]=s[0],n[o+1]=s[1],n[o+2]=s[2],n[o+3]=s[3],[o+4,!0]}let i=this.readSeparator(":",t,()=>this.readNumber(16,4,!0,2));if(i===void 0)return[o,!1];n[o]=i>>8,n[o+1]=i&255}return[n.length,!1]};return this.readAtomically(()=>{let n=new Uint8Array(16),[t,o]=e(n);if(t===16)return n;if(o||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let i=new Uint8Array(14),s=16-(t+2),[l]=e(i.subarray(0,s));return n.set(i.subarray(0,l),16-l),n})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var ua=new gr;var Ia=parseInt("0xFFFF",16),xa=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);function cn(r,e="utf8"){let n=pr[e];if(n==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?ke(globalThis.Buffer.from(r,"utf-8")):n.decoder.decode(`${n.prefix}${r}`)}var se=$e(sn(),1);var be=ce("node:net");function mr(r){return!!(0,be.isIP)(r)}var Nt=be.isIPv4,gs=be.isIPv6,an=function(r){let e=0;if(r=r.toString().trim(),Nt(r)){let n=new Uint8Array(e+4);return r.split(/\./g).forEach(t=>{n[e++]=parseInt(t,10)&255}),n}if(gs(r)){let n=r.split(":",8),t;for(t=0;t<n.length;t++){let i=Nt(n[t]),s;i&&(s=an(n[t]),n[t]=M(s.slice(0,2),"base16")),s!=null&&++t<8&&n.splice(t,0,M(s.slice(2,4),"base16"))}if(n[0]==="")for(;n.length<8;)n.unshift("0");else if(n[n.length-1]==="")for(;n.length<8;)n.push("0");else if(n.length<8){for(t=0;t<n.length&&n[t]!=="";t++);let i=[t,1];for(t=9-n.length;t>0;t--)i.push("0");n.splice.apply(n,i)}let o=new Uint8Array(e+16);for(t=0;t<n.length;t++){let i=parseInt(n[t],16);o[e++]=i>>8&255,o[e++]=i&255}return o}throw new Error("invalid ip address")},Pt=function(r,e=0,n){e=~~e,n=n??r.length-e;let t=new DataView(r.buffer);if(n===4){let o=[];for(let i=0;i<n;i++)o.push(r[e+i]);return o.join(".")}if(n===16){let o=[];for(let i=0;i<n;i+=2)o.push(t.getUint16(e+i).toString(16));return o.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var qe={},dn={},ys=[[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"]];ys.forEach(r=>{let e=ws(...r);dn[e.code]=e,qe[e.name]=e});function ws(r,e,n,t,o){return{code:r,size:e,name:n,resolvable:!!t,path:!!o}}function b(r){if(typeof r=="number"){if(dn[r]!=null)return dn[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(qe[r]!=null)return qe[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var cd=b("ip4"),ad=b("ip6"),dd=b("ipcidr");function un(r,e){switch(b(r).code){case 4:case 41:return Is(e);case 42:return Ft(e);case 6:case 273:case 33:case 132:return Mt(e).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Ft(e);case 421:return bs(e);case 444:return _t(e);case 445:return _t(e);case 466:return vs(e);default:return M(e,"base16")}}function hn(r,e){switch(b(r).code){case 4:return Dt(e);case 41:return Dt(e);case 42:return Rt(e);case 6:case 273:case 33:case 132:return pn(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Rt(e);case 421:return xs(e);case 444:return Ss(e);case 445:return Us(e);case 466:return Cs(e);default:return cn(e,"base16")}}var ln=Object.values(ve).map(r=>r.decoder),Es=function(){let r=ln[0].or(ln[1]);return ln.slice(2).forEach(e=>r=r.or(e)),r}();function Dt(r){if(!mr(r))throw new Error("invalid ip address");return an(r)}function Is(r){let e=Pt(r,0,r.length);if(e==null)throw new Error("ipBuff is required");if(!mr(e))throw new Error("invalid ip address");return e}function pn(r){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,r),new Uint8Array(e)}function Mt(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function Rt(r){let e=cn(r),n=Uint8Array.from(se.default.encode(e.length));return Ee([n,e],n.length+e.length)}function Ft(r){let e=se.default.decode(r);if(r=r.slice(se.default.decode.bytes),r.length!==e)throw new Error("inconsistent lengths");return M(r)}function xs(r){let e;r[0]==="Q"||r[0]==="1"?e=Ae(T.decode(`z${r}`)).bytes:e=Z.parse(r).multihash.bytes;let n=Uint8Array.from(se.default.encode(e.length));return Ee([n,e],n.length+e.length)}function Cs(r){let e=Es.decode(r),n=Uint8Array.from(se.default.encode(e.length));return Ee([n,e],n.length+e.length)}function vs(r){let e=se.default.decode(r),n=r.slice(se.default.decode.bytes);if(n.length!==e)throw new Error("inconsistent lengths");return"u"+M(n,"base64url")}function bs(r){let e=se.default.decode(r),n=r.slice(se.default.decode.bytes);if(n.length!==e)throw new Error("inconsistent lengths");return M(n,"base58btc")}function Ss(r){let e=r.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==16)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion address.`);let n=X.decode("b"+e[0]),t=parseInt(e[1],10);if(t<1||t>65536)throw new Error("Port number is not in range(1, 65536)");let o=pn(t);return Ee([n,o],n.length+o.length)}function Us(r){let e=r.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==56)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion3 address.`);let n=X.decode(`b${e[0]}`),t=parseInt(e[1],10);if(t<1||t>65536)throw new Error("Port number is not in range(1, 65536)");let o=pn(t);return Ee([n,o],n.length+o.length)}function _t(r){let e=r.slice(0,r.length-2),n=r.slice(r.length-2),t=M(e,"base32"),o=Mt(n);return`${t}:${o}`}function kt(r){r=gn(r);let e=[],n=[],t=null,o=r.split("/").slice(1);if(o.length===1&&o[0]==="")return{bytes:new Uint8Array,string:"/",tuples:[],stringTuples:[],path:null};for(let i=0;i<o.length;i++){let s=o[i],l=b(s);if(l.size===0){e.push([l.code]),n.push([l.code]);continue}if(i++,i>=o.length)throw zt("invalid address: "+r);if(l.path===!0){t=gn(o.slice(i).join("/")),e.push([l.code,hn(l.code,t)]),n.push([l.code,t]);break}let w=hn(l.code,o[i]);e.push([l.code,w]),n.push([l.code,un(l.code,w)])}return{string:qt(n),bytes:yn(e),tuples:e,stringTuples:n,path:t}}function mn(r){let e=[],n=[],t=null,o=0;for(;o<r.length;){let i=ze.default.decode(r,o),s=ze.default.decode.bytes??0,l=b(i),w=As(l,r.slice(o+s));if(w===0){e.push([i]),n.push([i]),o+=s;continue}let E=r.slice(o+s,o+s+w);if(o+=w+s,o>r.length)throw zt("Invalid address Uint8Array: "+M(r,"base16"));e.push([i,E]);let p=un(i,E);if(n.push([i,p]),l.path===!0){t=p;break}}return{bytes:Uint8Array.from(r),string:qt(n),tuples:e,stringTuples:n,path:t}}function qt(r){let e=[];return r.map(n=>{let t=b(n[0]);return e.push(t.name),n.length>1&&n[1]!=null&&e.push(n[1]),null}),gn(e.join("/"))}function yn(r){return Ee(r.map(e=>{let n=b(e[0]),t=Uint8Array.from(ze.default.encode(n.code));return e.length>1&&e[1]!=null&&(t=Ee([t,e[1]])),t}))}function As(r,e){return r.size>0?r.size/8:r.size===0?0:ze.default.decode(e)+(ze.default.decode.bytes??0)}function gn(r){return"/"+r.trim().split("/").filter(e=>e).join("/")}function zt(r){return new Error("Error parsing address: "+r)}var Os=Symbol.for("nodejs.util.inspect.custom"),Ls=[b("dns").code,b("dns4").code,b("dns6").code,b("dnsaddr").code],Ts=new Map,$t=Symbol.for("@multiformats/js-multiaddr/multiaddr");function Bs(r){return!!r?.[$t]}var En=class r{bytes;#e;#r;#n;#t;[$t]=!0;constructor(e){e==null&&(e="");let n;if(e instanceof Uint8Array)n=mn(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);n=kt(e)}else if(Bs(e))n=mn(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=n.bytes,this.#e=n.string,this.#r=n.tuples,this.#n=n.stringTuples,this.#t=n.path}toString(){return this.#e}toJSON(){return this.toString()}toOptions(){let e,n,t,o,i="",s=b("tcp"),l=b("udp"),w=b("ip4"),E=b("ip6"),p=b("dns6"),a=b("ip6zone");for(let[u,c]of this.stringTuples())u===a.code&&(i=`%${c??""}`),Ls.includes(u)&&(n=s.name,o=443,t=`${c??""}${i}`,e=u===p.code?6:4),(u===s.code||u===l.code)&&(n=b(u).name,o=parseInt(c??"")),(u===w.code||u===E.code)&&(n=b(u).name,t=`${c??""}${i}`,e=u===E.code?6:4);if(e==null||n==null||t==null||o==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:t,transport:n,port:o}}protos(){return this.#r.map(([e])=>Object.assign({},b(e)))}protoCodes(){return this.#r.map(([e])=>e)}protoNames(){return this.#r.map(([e])=>b(e).name)}tuples(){return this.#r}stringTuples(){return this.#n}encapsulate(e){return e=new r(e),new r(this.toString()+e.toString())}decapsulate(e){let n=e.toString(),t=this.toString(),o=t.lastIndexOf(n);if(o<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${e.toString()}`);return new r(t.slice(0,o))}decapsulateCode(e){let n=this.tuples();for(let t=n.length-1;t>=0;t--)if(n[t][0]===e)return new r(yn(n.slice(0,t)));return this}getPeerId(){try{let e=[];this.stringTuples().forEach(([t,o])=>{t===qe.p2p.code&&e.push([t,o]),t===qe["p2p-circuit"].code&&(e=[])});let n=e.pop();if(n?.[1]!=null){let t=n[1];return t[0]==="Q"||t[0]==="1"?M(T.decode(`z${t}`),"base58btc"):M(Z.parse(t).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return this.#t}equals(e){return Ge(this.bytes,e.bytes)}async resolve(e){let n=this.protos().find(i=>i.resolvable);if(n==null)return[this];let t=Ts.get(n.name);if(t==null)throw new je(`no available resolver for ${n.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await t(this,e)).map(i=>new r(i))}nodeAddress(){let e=this.toOptions();if(e.transport!=="tcp"&&e.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${e.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:e.family,address:e.host,port:e.port}}isThinWaistAddress(e){let n=(e??this).protos();return!(n.length!==2||n[0].code!==4&&n[0].code!==41||n[1].code!==6&&n[1].code!==273)}[Os](){return`Multiaddr(${this.#e})`}};function wn(r){return new En(r)}var Ze=sr("libp2p:mdns:query");function Vt(r,e,n){let t=()=>{Ze("query",e),r.query({questions:[{name:e,type:"PTR"}]})};return t(),setInterval(t,n)}function jt(r,e,n){if(r.answers==null)return;let t,o=[];if(r.answers.forEach(i=>{switch(i.type){case"PTR":t=i;break;case"TXT":o.push(i);break;default:break}}),!(t==null||t?.name!==n||o.length===0||t.data.startsWith(e)))try{let i=o.flatMap(l=>l.data).filter(l=>l.toString().startsWith("dnsaddr=")).map(l=>wn(l.toString().substring(8))),s=i[0].getPeerId();if(s==null)throw new Error("Multiaddr doesn't contain PeerId");return Ze("peer found %p",s),{id:rn(s),multiaddrs:i,protocols:[]}}catch(i){Ze.error("failed to parse mdns response",i)}}function Kt(r,e,n,t,o,i){if(!i){Ze("not responding to mDNS query as broadcast mode is false");return}if(t.length!==0&&r.questions[0]!=null&&r.questions[0].name===o){let s=[];s.push({name:o,type:"PTR",class:"IN",ttl:120,data:n+"."+o}),t.forEach(l=>{l.getPeerId()!=null&&s.push({name:n+"."+o,type:"TXT",class:"IN",ttl:120,data:"dnsaddr="+l.toString()})}),Ze("responding to query"),e.respond(s)}}function Ht(r){let e="",n="abcdefghijklmnopqrstuvwxyz0123456789";for(let t=0;t<r;t++)e+=n.charAt(Math.floor(Math.random()*n.length));return e}var yr=sr("libp2p:mdns"),In=class extends er{mdns;broadcast;interval;serviceTag;peerName;port;ip;_queryInterval;components;constructor(e,n={}){if(super(),this.broadcast=n.broadcast!==!1,this.interval=n.interval??1e3*10,this.serviceTag=n.serviceTag??"_p2p._udp.local",this.ip=n.ip??"224.0.0.251",this.peerName=n.peerName??Ht(63),this.peerName.length>=64)throw new Error("Peer name should be less than 64 chars long");this.port=n.port??5353,this.components=e,this._queryInterval=null,this._onPeer=this._onPeer.bind(this),this._onMdnsQuery=this._onMdnsQuery.bind(this),this._onMdnsResponse=this._onMdnsResponse.bind(this)}[Cn]=this;[Symbol.toStringTag]="@libp2p/mdns";isStarted(){return!!this.mdns}async start(){this.mdns==null&&(this.mdns=(0,Yt.default)({port:this.port,ip:this.ip}),this.mdns.on("query",this._onMdnsQuery),this.mdns.on("response",this._onMdnsResponse),this._queryInterval=Vt(this.mdns,this.serviceTag,this.interval))}_onMdnsQuery(e){this.mdns!=null&&(yr.trace("received incoming mDNS query"),Kt(e,this.mdns,this.peerName,this.components.addressManager.getAddresses(),this.serviceTag,this.broadcast))}_onMdnsResponse(e){yr.trace("received mDNS query response");try{let n=jt(e,this.peerName,this.serviceTag);n!=null&&(yr("discovered peer in mDNS query response %p",n.id),this.dispatchEvent(new rr("peer",{detail:n})))}catch(n){yr.error("Error processing peer response",n)}}_onPeer(e){this.mdns!=null&&this.dispatchEvent(new rr("peer",{detail:e.detail}))}async stop(){this.mdns!=null&&(this.mdns.removeListener("query",this._onMdnsQuery),this.mdns.removeListener("response",this._onMdnsResponse),this._queryInterval!=null&&(clearInterval(this._queryInterval),this._queryInterval=null),await new Promise(e=>{this.mdns!=null?this.mdns.destroy(e):e()}),this.mdns=void 0)}};function Ps(r={}){return e=>new In(e,r)}return Zt(Ds);})();
7
7
  return Libp2PMdns}));
@@ -1,8 +1,7 @@
1
- /// <reference types="node" />
2
1
  import { type Multiaddr } from '@multiformats/multiaddr';
3
2
  import type { PeerInfo } from '@libp2p/interface/peer-info';
4
3
  import type { MulticastDNS, QueryPacket, ResponsePacket } from 'multicast-dns';
5
- export declare function queryLAN(mdns: MulticastDNS, serviceTag: string, interval: number): NodeJS.Timer;
4
+ export declare function queryLAN(mdns: MulticastDNS, serviceTag: string, interval: number): ReturnType<typeof setInterval>;
6
5
  export declare function gotResponse(rsp: ResponsePacket, localPeerName: string, serviceTag: string): PeerInfo | undefined;
7
6
  export declare function gotQuery(qry: QueryPacket, mdns: MulticastDNS, peerName: string, multiaddrs: Multiaddr[], serviceTag: string, broadcast: boolean): void;
8
7
  //# sourceMappingURL=query.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/query.ts"],"names":[],"mappings":";AAEA,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACnE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAE3D,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAI9E,wBAAgB,QAAQ,CAAE,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,CAehG;AAED,wBAAgB,WAAW,CAAE,GAAG,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CA6CjH;AAED,wBAAgB,QAAQ,CAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,IAAI,CAqCvJ"}
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/query.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACnE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAE3D,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAI9E,wBAAgB,QAAQ,CAAE,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAelH;AAED,wBAAgB,WAAW,CAAE,GAAG,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CA6CjH;AAED,wBAAgB,QAAQ,CAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,IAAI,CAqCvJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/mdns",
3
- "version": "9.0.2",
3
+ "version": "9.0.3-87165551",
4
4
  "description": "Node.js libp2p mDNS discovery implementation for peer discovery",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/peer-discovery-mdns#readme",
@@ -44,19 +44,19 @@
44
44
  "test:electron-main": "aegir test -t electron-main"
45
45
  },
46
46
  "dependencies": {
47
- "@libp2p/interface": "^0.1.1",
48
- "@libp2p/logger": "^3.0.1",
49
- "@libp2p/peer-id": "^3.0.1",
50
- "@multiformats/multiaddr": "^12.1.3",
47
+ "@libp2p/interface": "0.1.2-87165551",
48
+ "@libp2p/logger": "3.0.2-87165551",
49
+ "@libp2p/peer-id": "3.0.2-87165551",
50
+ "@multiformats/multiaddr": "^12.1.5",
51
51
  "@types/multicast-dns": "^7.2.1",
52
52
  "dns-packet": "^5.4.0",
53
53
  "multicast-dns": "^7.2.5"
54
54
  },
55
55
  "devDependencies": {
56
- "@libp2p/interface-compliance-tests": "^4.0.2",
57
- "@libp2p/interface-internal": "^0.1.2",
58
- "@libp2p/peer-id-factory": "^3.0.2",
59
- "aegir": "^40.0.1",
56
+ "@libp2p/interface-compliance-tests": "4.0.3-87165551",
57
+ "@libp2p/interface-internal": "0.1.3-87165551",
58
+ "@libp2p/peer-id-factory": "3.0.3-87165551",
59
+ "aegir": "^40.0.8",
60
60
  "p-wait-for": "^5.0.2",
61
61
  "ts-sinon": "^2.0.2"
62
62
  }
package/src/query.ts CHANGED
@@ -7,7 +7,7 @@ import type { MulticastDNS, QueryPacket, ResponsePacket } from 'multicast-dns'
7
7
 
8
8
  const log = logger('libp2p:mdns:query')
9
9
 
10
- export function queryLAN (mdns: MulticastDNS, serviceTag: string, interval: number): NodeJS.Timer {
10
+ export function queryLAN (mdns: MulticastDNS, serviceTag: string, interval: number): ReturnType<typeof setInterval> {
11
11
  const query = (): void => {
12
12
  log('query', serviceTag)
13
13
 
@@ -1,5 +0,0 @@
1
- {
2
- "MulticastDNSComponents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_mdns.MulticastDNSComponents.html",
3
- "MulticastDNSInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_mdns.MulticastDNSInit.html",
4
- "mdns": "https://libp2p.github.io/js-libp2p/functions/_libp2p_mdns.mdns.html"
5
- }