@libp2p/mdns 8.0.0-b36ec7f2 → 8.0.0-c999d6a7

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.
Files changed (2) hide show
  1. package/dist/index.min.js +4 -4
  2. package/package.json +8 -11
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 ns=Object.create;var Or=Object.defineProperty;var os=Object.getOwnPropertyDescriptor;var is=Object.getOwnPropertyNames;var ss=Object.getPrototypeOf,cs=Object.prototype.hasOwnProperty;var te=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var F=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),O=(t,e)=>{for(var r in e)Or(t,r,{get:e[r],enumerable:!0})},Gn=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of is(e))!cs.call(t,o)&&o!==r&&Or(t,o,{get:()=>e[o],enumerable:!(n=os(e,o))||n.enumerable});return t};var Te=(t,e,r)=>(r=t!=null?ns(ss(t)):{},Gn(e||!t||!t.__esModule?Or(r,"default",{value:t,enumerable:!0}):r,t)),as=t=>Gn(Or({},"__esModule",{value:!0}),t);var Yn=F((hu,Hn)=>{var Ve=1e3,qe=Ve*60,$e=qe*60,Me=$e*24,ds=Me*7,ls=Me*365.25;Hn.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return us(t);if(r==="number"&&isFinite(t))return e.long?ps(t):hs(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function us(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*ls;case"weeks":case"week":case"w":return r*ds;case"days":case"day":case"d":return r*Me;case"hours":case"hour":case"hrs":case"hr":case"h":return r*$e;case"minutes":case"minute":case"mins":case"min":case"m":return r*qe;case"seconds":case"second":case"secs":case"sec":case"s":return r*Ve;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function hs(t){var e=Math.abs(t);return e>=Me?Math.round(t/Me)+"d":e>=$e?Math.round(t/$e)+"h":e>=qe?Math.round(t/qe)+"m":e>=Ve?Math.round(t/Ve)+"s":t+"ms"}function ps(t){var e=Math.abs(t);return e>=Me?Br(t,e,Me,"day"):e>=$e?Br(t,e,$e,"hour"):e>=qe?Br(t,e,qe,"minute"):e>=Ve?Br(t,e,Ve,"second"):t+" ms"}function Br(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var rt=F((pu,Jn)=>{function ms(t){r.debug=r,r.default=r,r.coerce=g,r.disable=i,r.enable=o,r.enabled=s,r.humanize=Yn(),r.destroy=w,Object.keys(t).forEach(p=>{r[p]=t[p]}),r.names=[],r.skips=[],r.formatters={};function e(p){let d=0;for(let l=0;l<p.length;l++)d=(d<<5)-d+p.charCodeAt(l),d|=0;return r.colors[Math.abs(d)%r.colors.length]}r.selectColor=e;function r(p){let d,l=null,u,c;function h(...y){if(!h.enabled)return;let E=h,v=Number(new Date),I=v-(d||v);E.diff=I,E.prev=d,E.curr=v,d=v,y[0]=r.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");let f=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,(S,U)=>{if(S==="%%")return"%";f++;let T=r.formatters[U];if(typeof T=="function"){let V=y[f];S=T.call(E,V),y.splice(f,1),f--}return S}),r.formatArgs.call(E,y),(E.log||r.log).apply(E,y)}return h.namespace=p,h.useColors=r.useColors(),h.color=r.selectColor(p),h.extend=n,h.destroy=r.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:()=>l!==null?l:(u!==r.namespaces&&(u=r.namespaces,c=r.enabled(p)),c),set:y=>{l=y}}),typeof r.init=="function"&&r.init(h),h}function n(p,d){let l=r(this.namespace+(typeof d>"u"?":":d)+p);return l.log=this.log,l}function o(p){r.save(p),r.namespaces=p,r.names=[],r.skips=[];let d,l=(typeof p=="string"?p:"").split(/[\s,]+/),u=l.length;for(d=0;d<u;d++)l[d]&&(p=l[d].replace(/\*/g,".*?"),p[0]==="-"?r.skips.push(new RegExp("^"+p.slice(1)+"$")):r.names.push(new RegExp("^"+p+"$")))}function i(){let p=[...r.names.map(a),...r.skips.map(a).map(d=>"-"+d)].join(",");return r.enable(""),p}function s(p){if(p[p.length-1]==="*")return!0;let d,l;for(d=0,l=r.skips.length;d<l;d++)if(r.skips[d].test(p))return!1;for(d=0,l=r.names.length;d<l;d++)if(r.names[d].test(p))return!0;return!1}function a(p){return p.toString().substring(2,p.toString().length-2).replace(/\.\*\?$/,"*")}function g(p){return p instanceof Error?p.stack||p.message:p}function w(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}Jn.exports=ms});var Qn=F((H,Nr)=>{H.formatArgs=ys;H.save=ws;H.load=bs;H.useColors=gs;H.storage=xs();H.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();H.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 gs(){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 ys(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Nr.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),t.splice(n,0,e)}H.log=console.debug||console.log||(()=>{});function ws(t){try{t?H.storage.setItem("debug",t):H.storage.removeItem("debug")}catch{}}function bs(){let t;try{t=H.storage.getItem("debug")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function xs(){try{return localStorage}catch{}}Nr.exports=rt()(H);var{formatters:Es}=Nr.exports;Es.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Zn=F((mu,Wn)=>{"use strict";Wn.exports=(t,e)=>{e=e||process.argv;let r=t.startsWith("-")?"":t.length===1?"-":"--",n=e.indexOf(r+t),o=e.indexOf("--");return n!==-1&&(o===-1?!0:n<o)}});var ro=F((gu,eo)=>{"use strict";var vs=te("os"),ne=Zn(),q=process.env,je;ne("no-color")||ne("no-colors")||ne("color=false")?je=!1:(ne("color")||ne("colors")||ne("color=true")||ne("color=always"))&&(je=!0);"FORCE_COLOR"in q&&(je=q.FORCE_COLOR.length===0||parseInt(q.FORCE_COLOR,10)!==0);function fs(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function Cs(t){if(je===!1)return 0;if(ne("color=16m")||ne("color=full")||ne("color=truecolor"))return 3;if(ne("color=256"))return 2;if(t&&!t.isTTY&&je!==!0)return 0;let e=je?1:0;if(process.platform==="win32"){let r=vs.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in q)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(r=>r in q)||q.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in q)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(q.TEAMCITY_VERSION)?1:0;if(q.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in q){let r=parseInt((q.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(q.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(q.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(q.TERM)||"COLORTERM"in q?1:(q.TERM==="dumb",e)}function tt(t){let e=Cs(t);return fs(e)}eo.exports={supportsColor:tt,stdout:tt(process.stdout),stderr:tt(process.stderr)}});var no=F((z,Dr)=>{var Is=te("tty"),Pr=te("util");z.init=Bs;z.log=Os;z.formatArgs=As;z.save=Ts;z.load=Ls;z.useColors=Ss;z.destroy=Pr.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");z.colors=[6,2,3,4,5,1];try{let t=ro();t&&(t.stderr||t).level>=2&&(z.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{}z.inspectOpts=Object.keys(process.env).filter(t=>/^debug_/i.test(t)).reduce((t,e)=>{let r=e.substring(6).toLowerCase().replace(/_([a-z])/g,(o,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),t[r]=n,t},{});function Ss(){return"colors"in z.inspectOpts?!!z.inspectOpts.colors:Is.isatty(process.stderr.fd)}function As(t){let{namespace:e,useColors:r}=this;if(r){let n=this.color,o="\x1B[3"+(n<8?n:"8;5;"+n),i=` ${o};1m${e} \x1B[0m`;t[0]=i+t[0].split(`
2
+ "use strict";var Libp2PMdns=(()=>{var ns=Object.create;var Ar=Object.defineProperty;var os=Object.getOwnPropertyDescriptor;var is=Object.getOwnPropertyNames;var ss=Object.getPrototypeOf,cs=Object.prototype.hasOwnProperty;var Z=(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 P=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),O=(r,e)=>{for(var t in e)Ar(r,t,{get:e[t],enumerable:!0})},Gn=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of is(e))!cs.call(r,o)&&o!==t&&Ar(r,o,{get:()=>e[o],enumerable:!(n=os(e,o))||n.enumerable});return r};var Se=(r,e,t)=>(t=r!=null?ns(ss(r)):{},Gn(e||!r||!r.__esModule?Ar(t,"default",{value:r,enumerable:!0}):t,r)),as=r=>Gn(Ar({},"__esModule",{value:!0}),r);var Yn=P((uu,Hn)=>{var ze=1e3,_e=ze*60,Ve=_e*60,Pe=Ve*24,ds=Pe*7,ls=Pe*365.25;Hn.exports=function(r,e){e=e||{};var t=typeof r;if(t==="string"&&r.length>0)return us(r);if(t==="number"&&isFinite(r))return e.long?ps(r):hs(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function us(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*ls;case"weeks":case"week":case"w":return t*ds;case"days":case"day":case"d":return t*Pe;case"hours":case"hour":case"hrs":case"hr":case"h":return t*Ve;case"minutes":case"minute":case"mins":case"min":case"m":return t*_e;case"seconds":case"second":case"secs":case"sec":case"s":return t*ze;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function hs(r){var e=Math.abs(r);return e>=Pe?Math.round(r/Pe)+"d":e>=Ve?Math.round(r/Ve)+"h":e>=_e?Math.round(r/_e)+"m":e>=ze?Math.round(r/ze)+"s":r+"ms"}function ps(r){var e=Math.abs(r);return e>=Pe?Tr(r,e,Pe,"day"):e>=Ve?Tr(r,e,Ve,"hour"):e>=_e?Tr(r,e,_e,"minute"):e>=ze?Tr(r,e,ze,"second"):r+" ms"}function Tr(r,e,t,n){var o=e>=t*1.5;return Math.round(r/t)+" "+n+(o?"s":"")}});var et=P((hu,Jn)=>{function ms(r){t.debug=t,t.default=t,t.coerce=g,t.disable=i,t.enable=o,t.enabled=s,t.humanize=Yn(),t.destroy=w,Object.keys(r).forEach(p=>{t[p]=r[p]}),t.names=[],t.skips=[],t.formatters={};function e(p){let d=0;for(let l=0;l<p.length;l++)d=(d<<5)-d+p.charCodeAt(l),d|=0;return t.colors[Math.abs(d)%t.colors.length]}t.selectColor=e;function t(p){let d,l=null,u,c;function h(...y){if(!h.enabled)return;let E=h,v=Number(new Date),I=v-(d||v);E.diff=I,E.prev=d,E.curr=v,d=v,y[0]=t.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");let f=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,(S,U)=>{if(S==="%%")return"%";f++;let T=t.formatters[U];if(typeof T=="function"){let k=y[f];S=T.call(E,k),y.splice(f,1),f--}return S}),t.formatArgs.call(E,y),(E.log||t.log).apply(E,y)}return h.namespace=p,h.useColors=t.useColors(),h.color=t.selectColor(p),h.extend=n,h.destroy=t.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:()=>l!==null?l:(u!==t.namespaces&&(u=t.namespaces,c=t.enabled(p)),c),set:y=>{l=y}}),typeof t.init=="function"&&t.init(h),h}function n(p,d){let l=t(this.namespace+(typeof d>"u"?":":d)+p);return l.log=this.log,l}function o(p){t.save(p),t.namespaces=p,t.names=[],t.skips=[];let d,l=(typeof p=="string"?p:"").split(/[\s,]+/),u=l.length;for(d=0;d<u;d++)l[d]&&(p=l[d].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(a),...t.skips.map(a).map(d=>"-"+d)].join(",");return t.enable(""),p}function s(p){if(p[p.length-1]==="*")return!0;let d,l;for(d=0,l=t.skips.length;d<l;d++)if(t.skips[d].test(p))return!1;for(d=0,l=t.names.length;d<l;d++)if(t.names[d].test(p))return!0;return!1}function a(p){return p.toString().substring(2,p.toString().length-2).replace(/\.\*\?$/,"*")}function g(p){return p instanceof Error?p.stack||p.message:p}function w(){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}Jn.exports=ms});var Qn=P((K,Lr)=>{K.formatArgs=ys;K.save=ws;K.load=bs;K.useColors=gs;K.storage=xs();K.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`."))}})();K.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function gs(){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 ys(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+Lr.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)}K.log=console.debug||console.log||(()=>{});function ws(r){try{r?K.storage.setItem("debug",r):K.storage.removeItem("debug")}catch{}}function bs(){let r;try{r=K.storage.getItem("debug")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function xs(){try{return localStorage}catch{}}Lr.exports=et()(K);var{formatters:Es}=Lr.exports;Es.j=function(r){try{return JSON.stringify(r)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Zn=P((pu,Wn)=>{"use strict";Wn.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 ro=P((mu,eo)=>{"use strict";var vs=Z("os"),ee=Zn(),z=process.env,qe;ee("no-color")||ee("no-colors")||ee("color=false")?qe=!1:(ee("color")||ee("colors")||ee("color=true")||ee("color=always"))&&(qe=!0);"FORCE_COLOR"in z&&(qe=z.FORCE_COLOR.length===0||parseInt(z.FORCE_COLOR,10)!==0);function fs(r){return r===0?!1:{level:r,hasBasic:!0,has256:r>=2,has16m:r>=3}}function Cs(r){if(qe===!1)return 0;if(ee("color=16m")||ee("color=full")||ee("color=truecolor"))return 3;if(ee("color=256"))return 2;if(r&&!r.isTTY&&qe!==!0)return 0;let e=qe?1:0;if(process.platform==="win32"){let t=vs.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 z)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(t=>t in z)||z.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in z)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(z.TEAMCITY_VERSION)?1:0;if(z.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in z){let t=parseInt((z.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(z.TERM_PROGRAM){case"iTerm.app":return t>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(z.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(z.TERM)||"COLORTERM"in z?1:(z.TERM==="dumb",e)}function rt(r){let e=Cs(r);return fs(e)}eo.exports={supportsColor:rt,stdout:rt(process.stdout),stderr:rt(process.stderr)}});var no=P((F,Br)=>{var Is=Z("tty"),Dr=Z("util");F.init=Ds;F.log=Os;F.formatArgs=As;F.save=Ts;F.load=Ls;F.useColors=Ss;F.destroy=Dr.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");F.colors=[6,2,3,4,5,1];try{let r=ro();r&&(r.stderr||r).level>=2&&(F.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{}F.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 Ss(){return"colors"in F.inspectOpts?!!F.inspectOpts.colors:Is.isatty(process.stderr.fd)}function As(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(`
3
3
  `).join(`
4
- `+i),t.push(o+"m+"+Dr.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=Us()+e+" "+t[0]}function Us(){return z.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Os(...t){return process.stderr.write(Pr.format(...t)+`
5
- `)}function Ts(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function Ls(){return process.env.DEBUG}function Bs(t){t.inspectOpts={};let e=Object.keys(z.inspectOpts);for(let r=0;r<e.length;r++)t.inspectOpts[e[r]]=z.inspectOpts[e[r]]}Dr.exports=rt()(z);var{formatters:to}=Dr.exports;to.o=function(t){return this.inspectOpts.colors=this.useColors,Pr.inspect(t,this.inspectOpts).split(`
6
- `).map(e=>e.trim()).join(" ")};to.O=function(t){return this.inspectOpts.colors=this.useColors,Pr.inspect(t,this.inspectOpts)}});var oo=F((yu,nt)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?nt.exports=Qn():nt.exports=no()});var ho=F(ht=>{"use strict";ht.toString=function(t){switch(t){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_"+t};ht.toType=function(t){switch(t.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 t.toUpperCase().startsWith("UNKNOWN_")?parseInt(t.slice(8)):0}});var po=F(pt=>{"use strict";pt.toString=function(t){switch(t){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_"+t};pt.toRcode=function(t){switch(t.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 mo=F(mt=>{"use strict";mt.toString=function(t){switch(t){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_"+t};mt.toOpcode=function(t){switch(t.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 go=F(gt=>{"use strict";gt.toString=function(t){switch(t){case 1:return"IN";case 2:return"CS";case 3:return"CH";case 4:return"HS";case 255:return"ANY"}return"UNKNOWN_"+t};gt.toClass=function(t){switch(t.toUpperCase()){case"IN":return 1;case"CS":return 2;case"CH":return 3;case"HS":return 4;case"ANY":return 255}return 0}});var yo=F(yt=>{"use strict";yt.toString=function(t){switch(t){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 t<0?null:`OPTION_${t}`};yt.toCode=function(t){if(typeof t=="number")return t;if(!t)return-1;switch(t.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=t.match(/_(\d+)$/);return e?parseInt(e[1],10):-1}});var xo=F((bo,wt)=>{var wo=function(t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decode=d,t.encode=p,t.familyOf=w,t.name=void 0,t.sizeOf=g,t.v6=t.v4=void 0;let e=/^(\d{1,3}\.){3,3}\d{1,3}$/,r=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:r,isFormat:l=>e.test(l),encode(l,u,c){c=~~c,u=u||new Uint8Array(c+r);let h=l.length,y=0;for(let E=0;E<h;){let v=l.charCodeAt(E++);v===46?(u[c++]=y,y=0):y=y*10+(v-48)}return u[c]=y,u},decode(l,u){return u=~~u,`${l[u++]}.${l[u++]}.${l[u++]}.${l[u]}`}};t.v4=i;let s={name:"v6",size:o,isFormat:l=>l.length>0&&n.test(l),encode(l,u,c){c=~~c;let h=c+o,y=-1,E=0,v=0,I=!0,f=!1;u=u||new Uint8Array(c+o);for(let C=0;C<l.length;C++){let S=l.charCodeAt(C);S===58?(I?y!==-1?(c<h&&(u[c]=0),c<h-1&&(u[c+1]=0),c+=2):c<h&&(y=c):(f===!0?(c<h&&(u[c]=v),c++):(c<h&&(u[c]=E>>8),c<h-1&&(u[c+1]=E&255),c+=2),E=0,v=0),I=!0,f=!1):S===46?(c<h&&(u[c]=v),c++,v=0,E=0,I=!1,f=!0):(I=!1,S>=97?S-=87:S>=65?S-=55:(S-=48,v=v*10+S),E=(E<<4)+S)}if(I===!1)f===!0?(c<h&&(u[c]=v),c++):(c<h&&(u[c]=E>>8),c<h-1&&(u[c+1]=E&255),c+=2);else if(y===0)c<h&&(u[c]=0),c<h-1&&(u[c+1]=0),c+=2;else if(y!==-1){c+=2;for(let C=Math.min(c-1,h-1);C>=y+2;C--)u[C]=u[C-2];u[y]=0,u[y+1]=0,y=c}if(y!==c&&y!==-1)for(c>h-2&&(c=h-2);h>y;)u[--h]=c<h&&c>y?u[--c]:0;else for(;c<h;)u[c++]=0;return u},decode(l,u){u=~~u;let c="";for(let h=0;h<o;h+=2)h!==0&&(c+=":"),c+=(l[u+h]<<8|l[u+h+1]).toString(16);return c.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}};t.v6=s;let a="ip";t.name=a;function g(l){if(i.isFormat(l))return i.size;if(s.isFormat(l))return s.size;throw Error(`Invalid ip address: ${l}`)}function w(l){return g(l)===i.size?1:2}function p(l,u,c){c=~~c;let h=g(l);return typeof u=="function"&&(u=u(c+h)),h===i.size?i.encode(l,u,c):s.encode(l,u,c)}function d(l,u,c){if(u=~~u,c=c||l.length-u,c===i.size)return i.decode(l,u,c);if(c===s.size)return s.decode(l,u,c);throw Error(`Invalid buffer size needs to be ${i.size} for v4 or ${s.size} for v6.`)}return"default"in t?t.default:t}({});typeof define=="function"&&define.amd?define([],function(){return wo}):typeof wt=="object"&&typeof bo=="object"&&(wt.exports=wo)});var fo=F(b=>{"use strict";var x=te("buffer").Buffer,Se=ho(),Js=po(),Qs=mo(),Mr=go(),bt=yo(),ke=xo(),Ws=0,Eo=32768,xt=32768,Zs=~xt,vo=32768,ec=~vo,m=b.name={};m.encode=function(t,e,r){e||(e=x.alloc(m.encodingLength(t))),r||(r=0);let n=r,o=t.replace(/^\.|\.$/gm,"");if(o.length){let i=o.split(".");for(let s=0;s<i.length;s++){let a=e.write(i[s],r+1);e[r]=a,r+=a+1}}return e[r++]=0,m.encode.bytes=r-n,e};m.encode.bytes=0;m.decode=function(t,e){e||(e=0);let r=[],n=e,o=0,i=0,s=!1;for(;;){if(e>=t.length)throw new Error("Cannot decode name (buffer overflow)");let a=t[e++];if(i+=s?0:1,a===0)break;if(a&192)if((a&192)===192){if(e+1>t.length)throw new Error("Cannot decode name (buffer overflow)");let g=t.readUInt16BE(e-1)-49152;if(g>=n)throw new Error("Cannot decode name (bad pointer)");e=g,n=g,i+=s?0:1,s=!0}else throw new Error("Cannot decode name (bad label)");else{if(e+a>t.length)throw new Error("Cannot decode name (buffer overflow)");if(o+=a+1,o>254)throw new Error("Cannot decode name (name too long)");r.push(t.toString("utf-8",e,e+a)),e+=a,i+=s?0:a}}return m.decode.bytes=i,r.length===0?".":r.join(".")};m.decode.bytes=0;m.encodingLength=function(t){return t==="."||t===".."?1:x.byteLength(t.replace(/^\.|\.$/gm,""))+2};var A={};A.encode=function(t,e,r){e||(e=x.alloc(A.encodingLength(t))),r||(r=0);let n=e.write(t,r+1);return e[r]=n,A.encode.bytes=n+1,e};A.encode.bytes=0;A.decode=function(t,e){e||(e=0);let r=t[e],n=t.toString("utf-8",e+1,e+1+r);return A.decode.bytes=r+1,n};A.decode.bytes=0;A.encodingLength=function(t){return x.byteLength(t)+1};var se={};se.encode=function(t,e,r){e||(e=se.encodingLength(t)),r||(r=0);let n=(t.flags||0)&32767,o=t.type==="response"?Eo:Ws;return e.writeUInt16BE(t.id||0,r),e.writeUInt16BE(n|o,r+2),e.writeUInt16BE(t.questions.length,r+4),e.writeUInt16BE(t.answers.length,r+6),e.writeUInt16BE(t.authorities.length,r+8),e.writeUInt16BE(t.additionals.length,r+10),e};se.encode.bytes=12;se.decode=function(t,e){if(e||(e=0),t.length<12)throw new Error("Header must be 12 bytes");let r=t.readUInt16BE(e+2);return{id:t.readUInt16BE(e),type:r&Eo?"response":"query",flags:r&32767,flag_qr:(r>>15&1)===1,opcode:Qs.toString(r>>11&15),flag_aa:(r>>10&1)===1,flag_tc:(r>>9&1)===1,flag_rd:(r>>8&1)===1,flag_ra:(r>>7&1)===1,flag_z:(r>>6&1)===1,flag_ad:(r>>5&1)===1,flag_cd:(r>>4&1)===1,rcode:Js.toString(r&15),questions:new Array(t.readUInt16BE(e+4)),answers:new Array(t.readUInt16BE(e+6)),authorities:new Array(t.readUInt16BE(e+8)),additionals:new Array(t.readUInt16BE(e+10))}};se.decode.bytes=12;se.encodingLength=function(){return 12};var ye=b.unknown={};ye.encode=function(t,e,r){return e||(e=x.alloc(ye.encodingLength(t))),r||(r=0),e.writeUInt16BE(t.length,r),t.copy(e,r+2),ye.encode.bytes=t.length+2,e};ye.encode.bytes=0;ye.decode=function(t,e){e||(e=0);let r=t.readUInt16BE(e),n=t.slice(e+2,e+2+r);return ye.decode.bytes=r+2,n};ye.decode.bytes=0;ye.encodingLength=function(t){return t.length+2};var we=b.ns={};we.encode=function(t,e,r){return e||(e=x.alloc(we.encodingLength(t))),r||(r=0),m.encode(t,e,r+2),e.writeUInt16BE(m.encode.bytes,r),we.encode.bytes=m.encode.bytes+2,e};we.encode.bytes=0;we.decode=function(t,e){e||(e=0);let r=t.readUInt16BE(e),n=m.decode(t,e+2);return we.decode.bytes=r+2,n};we.decode.bytes=0;we.encodingLength=function(t){return m.encodingLength(t)+2};var be=b.soa={};be.encode=function(t,e,r){e||(e=x.alloc(be.encodingLength(t))),r||(r=0);let n=r;return r+=2,m.encode(t.mname,e,r),r+=m.encode.bytes,m.encode(t.rname,e,r),r+=m.encode.bytes,e.writeUInt32BE(t.serial||0,r),r+=4,e.writeUInt32BE(t.refresh||0,r),r+=4,e.writeUInt32BE(t.retry||0,r),r+=4,e.writeUInt32BE(t.expire||0,r),r+=4,e.writeUInt32BE(t.minimum||0,r),r+=4,e.writeUInt16BE(r-n-2,n),be.encode.bytes=r-n,e};be.encode.bytes=0;be.decode=function(t,e){e||(e=0);let r=e,n={};return e+=2,n.mname=m.decode(t,e),e+=m.decode.bytes,n.rname=m.decode(t,e),e+=m.decode.bytes,n.serial=t.readUInt32BE(e),e+=4,n.refresh=t.readUInt32BE(e),e+=4,n.retry=t.readUInt32BE(e),e+=4,n.expire=t.readUInt32BE(e),e+=4,n.minimum=t.readUInt32BE(e),e+=4,be.decode.bytes=e-r,n};be.decode.bytes=0;be.encodingLength=function(t){return 22+m.encodingLength(t.mname)+m.encodingLength(t.rname)};var xe=b.txt={};xe.encode=function(t,e,r){Array.isArray(t)||(t=[t]);for(let o=0;o<t.length;o++)if(typeof t[o]=="string"&&(t[o]=x.from(t[o])),!x.isBuffer(t[o]))throw new Error("Must be a Buffer");e||(e=x.alloc(xe.encodingLength(t))),r||(r=0);let n=r;return r+=2,t.forEach(function(o){e[r++]=o.length,o.copy(e,r,0,o.length),r+=o.length}),e.writeUInt16BE(r-n-2,n),xe.encode.bytes=r-n,e};xe.encode.bytes=0;xe.decode=function(t,e){e||(e=0);let r=e,n=t.readUInt16BE(e);e+=2;let o=[];for(;n>0;){let i=t[e++];if(--n,n<i)throw new Error("Buffer overflow");o.push(t.slice(e,e+i)),e+=i,n-=i}return xe.decode.bytes=e-r,o};xe.decode.bytes=0;xe.encodingLength=function(t){Array.isArray(t)||(t=[t]);let e=2;return t.forEach(function(r){typeof r=="string"?e+=x.byteLength(r)+1:e+=r.length+1}),e};var Ee=b.null={};Ee.encode=function(t,e,r){e||(e=x.alloc(Ee.encodingLength(t))),r||(r=0),typeof t=="string"&&(t=x.from(t)),t||(t=x.alloc(0));let n=r;r+=2;let o=t.length;return t.copy(e,r,0,o),r+=o,e.writeUInt16BE(r-n-2,n),Ee.encode.bytes=r-n,e};Ee.encode.bytes=0;Ee.decode=function(t,e){e||(e=0);let r=e,n=t.readUInt16BE(e);e+=2;let o=t.slice(e,e+n);return e+=n,Ee.decode.bytes=e-r,o};Ee.decode.bytes=0;Ee.encodingLength=function(t){return t?(x.isBuffer(t)?t.length:x.byteLength(t))+2:2};var ve=b.hinfo={};ve.encode=function(t,e,r){e||(e=x.alloc(ve.encodingLength(t))),r||(r=0);let n=r;return r+=2,A.encode(t.cpu,e,r),r+=A.encode.bytes,A.encode(t.os,e,r),r+=A.encode.bytes,e.writeUInt16BE(r-n-2,n),ve.encode.bytes=r-n,e};ve.encode.bytes=0;ve.decode=function(t,e){e||(e=0);let r=e,n={};return e+=2,n.cpu=A.decode(t,e),e+=A.decode.bytes,n.os=A.decode(t,e),e+=A.decode.bytes,ve.decode.bytes=e-r,n};ve.decode.bytes=0;ve.encodingLength=function(t){return A.encodingLength(t.cpu)+A.encodingLength(t.os)+2};var oe=b.ptr={},rc=b.cname=oe,tc=b.dname=oe;oe.encode=function(t,e,r){return e||(e=x.alloc(oe.encodingLength(t))),r||(r=0),m.encode(t,e,r+2),e.writeUInt16BE(m.encode.bytes,r),oe.encode.bytes=m.encode.bytes+2,e};oe.encode.bytes=0;oe.decode=function(t,e){e||(e=0);let r=m.decode(t,e+2);return oe.decode.bytes=m.decode.bytes+2,r};oe.decode.bytes=0;oe.encodingLength=function(t){return m.encodingLength(t)+2};var fe=b.srv={};fe.encode=function(t,e,r){e||(e=x.alloc(fe.encodingLength(t))),r||(r=0),e.writeUInt16BE(t.priority||0,r+2),e.writeUInt16BE(t.weight||0,r+4),e.writeUInt16BE(t.port||0,r+6),m.encode(t.target,e,r+8);let n=m.encode.bytes+6;return e.writeUInt16BE(n,r),fe.encode.bytes=n+2,e};fe.encode.bytes=0;fe.decode=function(t,e){e||(e=0);let r=t.readUInt16BE(e),n={};return n.priority=t.readUInt16BE(e+2),n.weight=t.readUInt16BE(e+4),n.port=t.readUInt16BE(e+6),n.target=m.decode(t,e+8),fe.decode.bytes=r+2,n};fe.decode.bytes=0;fe.encodingLength=function(t){return 8+m.encodingLength(t.target)};var J=b.caa={};J.ISSUER_CRITICAL=128;J.encode=function(t,e,r){let n=J.encodingLength(t);return e||(e=x.alloc(J.encodingLength(t))),r||(r=0),t.issuerCritical&&(t.flags=J.ISSUER_CRITICAL),e.writeUInt16BE(n-2,r),r+=2,e.writeUInt8(t.flags||0,r),r+=1,A.encode(t.tag,e,r),r+=A.encode.bytes,e.write(t.value,r),r+=x.byteLength(t.value),J.encode.bytes=n,e};J.encode.bytes=0;J.decode=function(t,e){e||(e=0);let r=t.readUInt16BE(e);e+=2;let n=e,o={};return o.flags=t.readUInt8(e),e+=1,o.tag=A.decode(t,e),e+=A.decode.bytes,o.value=t.toString("utf-8",e,n+r),o.issuerCritical=!!(o.flags&J.ISSUER_CRITICAL),J.decode.bytes=r+2,o};J.decode.bytes=0;J.encodingLength=function(t){return A.encodingLength(t.tag)+A.encodingLength(t.value)+2};var Ne=b.mx={};Ne.encode=function(t,e,r){e||(e=x.alloc(Ne.encodingLength(t))),r||(r=0);let n=r;return r+=2,e.writeUInt16BE(t.preference||0,r),r+=2,m.encode(t.exchange,e,r),r+=m.encode.bytes,e.writeUInt16BE(r-n-2,n),Ne.encode.bytes=r-n,e};Ne.encode.bytes=0;Ne.decode=function(t,e){e||(e=0);let r=e,n={};return e+=2,n.preference=t.readUInt16BE(e),e+=2,n.exchange=m.decode(t,e),e+=m.decode.bytes,Ne.decode.bytes=e-r,n};Ne.encodingLength=function(t){return 4+m.encodingLength(t.exchange)};var Ce=b.a={};Ce.encode=function(t,e,r){return e||(e=x.alloc(Ce.encodingLength(t))),r||(r=0),e.writeUInt16BE(4,r),r+=2,ke.v4.encode(t,e,r),Ce.encode.bytes=6,e};Ce.encode.bytes=0;Ce.decode=function(t,e){e||(e=0),e+=2;let r=ke.v4.decode(t,e);return Ce.decode.bytes=6,r};Ce.decode.bytes=0;Ce.encodingLength=function(){return 6};var Ie=b.aaaa={};Ie.encode=function(t,e,r){return e||(e=x.alloc(Ie.encodingLength(t))),r||(r=0),e.writeUInt16BE(16,r),r+=2,ke.v6.encode(t,e,r),Ie.encode.bytes=18,e};Ie.encode.bytes=0;Ie.decode=function(t,e){e||(e=0),e+=2;let r=ke.v6.decode(t,e);return Ie.decode.bytes=18,r};Ie.decode.bytes=0;Ie.encodingLength=function(){return 18};var K=b.option={};K.encode=function(t,e,r){e||(e=x.alloc(K.encodingLength(t))),r||(r=0);let n=r,o=bt.toCode(t.code);if(e.writeUInt16BE(o,r),r+=2,t.data)e.writeUInt16BE(t.data.length,r),r+=2,t.data.copy(e,r),r+=t.data.length;else switch(o){case 8:let i=t.sourcePrefixLength||0,s=t.family||ke.familyOf(t.ip),a=ke.encode(t.ip,x.alloc),g=Math.ceil(i/8);e.writeUInt16BE(g+4,r),r+=2,e.writeUInt16BE(s,r),r+=2,e.writeUInt8(i,r++),e.writeUInt8(t.scopePrefixLength||0,r++),a.copy(e,r,0,g),r+=g;break;case 11:t.timeout?(e.writeUInt16BE(2,r),r+=2,e.writeUInt16BE(t.timeout,r),r+=2):(e.writeUInt16BE(0,r),r+=2);break;case 12:let w=t.length||0;e.writeUInt16BE(w,r),r+=2,e.fill(0,r,r+w),r+=w;break;case 14:let p=t.tags.length*2;e.writeUInt16BE(p,r),r+=2;for(let d of t.tags)e.writeUInt16BE(d,r),r+=2;break;default:throw new Error(`Unknown roption code: ${t.code}`)}return K.encode.bytes=r-n,e};K.encode.bytes=0;K.decode=function(t,e){e||(e=0);let r={};r.code=t.readUInt16BE(e),r.type=bt.toString(r.code),e+=2;let n=t.readUInt16BE(e);switch(e+=2,r.data=t.slice(e,e+n),r.code){case 8:r.family=t.readUInt16BE(e),e+=2,r.sourcePrefixLength=t.readUInt8(e++),r.scopePrefixLength=t.readUInt8(e++);let o=x.alloc(r.family===1?4:16);t.copy(o,0,e,e+n-4),r.ip=ke.decode(o);break;case 11:n>0&&(r.timeout=t.readUInt16BE(e),e+=2);break;case 14:r.tags=[];for(let i=0;i<n;i+=2)r.tags.push(t.readUInt16BE(e)),e+=2}return K.decode.bytes=n+4,r};K.decode.bytes=0;K.encodingLength=function(t){if(t.data)return t.data.length+4;switch(bt.toCode(t.code)){case 8:let r=t.sourcePrefixLength||0;return Math.ceil(r/8)+8;case 11:return typeof t.timeout=="number"?6:4;case 12:return t.length+4;case 14:return 4+t.tags.length*2}throw new Error(`Unknown roption code: ${t.code}`)};var W=b.opt={};W.encode=function(t,e,r){e||(e=x.alloc(W.encodingLength(t))),r||(r=0);let n=r,o=Ge(t,K);return e.writeUInt16BE(o,r),r=dr(t,K,e,r+2),W.encode.bytes=r-n,e};W.encode.bytes=0;W.decode=function(t,e){e||(e=0);let r=e,n=[],o=t.readUInt16BE(e);e+=2;let i=0;for(;o>0;)n[i++]=K.decode(t,e),e+=K.decode.bytes,o-=K.decode.bytes;return W.decode.bytes=e-r,n};W.decode.bytes=0;W.encodingLength=function(t){return 2+Ge(t||[],K)};var j=b.dnskey={};j.PROTOCOL_DNSSEC=3;j.ZONE_KEY=128;j.SECURE_ENTRYPOINT=32768;j.encode=function(t,e,r){e||(e=x.alloc(j.encodingLength(t))),r||(r=0);let n=r,o=t.key;if(!x.isBuffer(o))throw new Error("Key must be a Buffer");return r+=2,e.writeUInt16BE(t.flags,r),r+=2,e.writeUInt8(j.PROTOCOL_DNSSEC,r),r+=1,e.writeUInt8(t.algorithm,r),r+=1,o.copy(e,r,0,o.length),r+=o.length,j.encode.bytes=r-n,e.writeUInt16BE(j.encode.bytes-2,n),e};j.encode.bytes=0;j.decode=function(t,e){e||(e=0);let r=e;var n={},o=t.readUInt16BE(e);if(e+=2,n.flags=t.readUInt16BE(e),e+=2,t.readUInt8(e)!==j.PROTOCOL_DNSSEC)throw new Error("Protocol must be 3");return e+=1,n.algorithm=t.readUInt8(e),e+=1,n.key=t.slice(e,r+o+2),e+=n.key.length,j.decode.bytes=e-r,n};j.decode.bytes=0;j.encodingLength=function(t){return 6+x.byteLength(t.key)};var ce=b.rrsig={};ce.encode=function(t,e,r){e||(e=x.alloc(ce.encodingLength(t))),r||(r=0);let n=r,o=t.signature;if(!x.isBuffer(o))throw new Error("Signature must be a Buffer");return r+=2,e.writeUInt16BE(Se.toType(t.typeCovered),r),r+=2,e.writeUInt8(t.algorithm,r),r+=1,e.writeUInt8(t.labels,r),r+=1,e.writeUInt32BE(t.originalTTL,r),r+=4,e.writeUInt32BE(t.expiration,r),r+=4,e.writeUInt32BE(t.inception,r),r+=4,e.writeUInt16BE(t.keyTag,r),r+=2,m.encode(t.signersName,e,r),r+=m.encode.bytes,o.copy(e,r,0,o.length),r+=o.length,ce.encode.bytes=r-n,e.writeUInt16BE(ce.encode.bytes-2,n),e};ce.encode.bytes=0;ce.decode=function(t,e){e||(e=0);let r=e;var n={},o=t.readUInt16BE(e);return e+=2,n.typeCovered=Se.toString(t.readUInt16BE(e)),e+=2,n.algorithm=t.readUInt8(e),e+=1,n.labels=t.readUInt8(e),e+=1,n.originalTTL=t.readUInt32BE(e),e+=4,n.expiration=t.readUInt32BE(e),e+=4,n.inception=t.readUInt32BE(e),e+=4,n.keyTag=t.readUInt16BE(e),e+=2,n.signersName=m.decode(t,e),e+=m.decode.bytes,n.signature=t.slice(e,r+o+2),e+=n.signature.length,ce.decode.bytes=e-r,n};ce.decode.bytes=0;ce.encodingLength=function(t){return 20+m.encodingLength(t.signersName)+x.byteLength(t.signature)};var ae=b.rp={};ae.encode=function(t,e,r){e||(e=x.alloc(ae.encodingLength(t))),r||(r=0);let n=r;return r+=2,m.encode(t.mbox||".",e,r),r+=m.encode.bytes,m.encode(t.txt||".",e,r),r+=m.encode.bytes,ae.encode.bytes=r-n,e.writeUInt16BE(ae.encode.bytes-2,n),e};ae.encode.bytes=0;ae.decode=function(t,e){e||(e=0);let r=e,n={};return e+=2,n.mbox=m.decode(t,e)||".",e+=m.decode.bytes,n.txt=m.decode(t,e)||".",e+=m.decode.bytes,ae.decode.bytes=e-r,n};ae.decode.bytes=0;ae.encodingLength=function(t){return 2+m.encodingLength(t.mbox||".")+m.encodingLength(t.txt||".")};var k={};k.encode=function(t,e,r){e||(e=x.alloc(k.encodingLength(t))),r||(r=0);let n=r;for(var o=[],i=0;i<t.length;i++){var s=Se.toType(t[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 a=x.from(o[i]);e.writeUInt8(i,r),r+=1,e.writeUInt8(a.length,r),r+=1,a.copy(e,r),r+=a.length}return k.encode.bytes=r-n,e};k.encode.bytes=0;k.decode=function(t,e,r){e||(e=0);let n=e;for(var o=[];e-n<r;){var i=t.readUInt8(e);e+=1;var s=t.readUInt8(e);e+=1;for(var a=0;a<s;a++)for(var g=t.readUInt8(e+a),w=0;w<8;w++)if(g&1<<7-w){var p=Se.toString(i<<8|a<<3|w);o.push(p)}e+=s}return k.decode.bytes=e-n,o};k.decode.bytes=0;k.encodingLength=function(t){for(var e=[],r=0;r<t.length;r++){var n=Se.toType(t[r]);e[n>>8]=Math.max(e[n>>8]||0,n&255)}var o=0;for(r=0;r<e.length;r++)e[r]!==void 0&&(o+=2+Math.ceil((e[r]+1)/8));return o};var de=b.nsec={};de.encode=function(t,e,r){e||(e=x.alloc(de.encodingLength(t))),r||(r=0);let n=r;return r+=2,m.encode(t.nextDomain,e,r),r+=m.encode.bytes,k.encode(t.rrtypes,e,r),r+=k.encode.bytes,de.encode.bytes=r-n,e.writeUInt16BE(de.encode.bytes-2,n),e};de.encode.bytes=0;de.decode=function(t,e){e||(e=0);let r=e;var n={},o=t.readUInt16BE(e);return e+=2,n.nextDomain=m.decode(t,e),e+=m.decode.bytes,n.rrtypes=k.decode(t,e,o-(e-r)),e+=k.decode.bytes,de.decode.bytes=e-r,n};de.decode.bytes=0;de.encodingLength=function(t){return 2+m.encodingLength(t.nextDomain)+k.encodingLength(t.rrtypes)};var le=b.nsec3={};le.encode=function(t,e,r){e||(e=x.alloc(le.encodingLength(t))),r||(r=0);let n=r,o=t.salt;if(!x.isBuffer(o))throw new Error("salt must be a Buffer");let i=t.nextDomain;if(!x.isBuffer(i))throw new Error("nextDomain must be a Buffer");return r+=2,e.writeUInt8(t.algorithm,r),r+=1,e.writeUInt8(t.flags,r),r+=1,e.writeUInt16BE(t.iterations,r),r+=2,e.writeUInt8(o.length,r),r+=1,o.copy(e,r,0,o.length),r+=o.length,e.writeUInt8(i.length,r),r+=1,i.copy(e,r,0,i.length),r+=i.length,k.encode(t.rrtypes,e,r),r+=k.encode.bytes,le.encode.bytes=r-n,e.writeUInt16BE(le.encode.bytes-2,n),e};le.encode.bytes=0;le.decode=function(t,e){e||(e=0);let r=e;var n={},o=t.readUInt16BE(e);e+=2,n.algorithm=t.readUInt8(e),e+=1,n.flags=t.readUInt8(e),e+=1,n.iterations=t.readUInt16BE(e),e+=2;let i=t.readUInt8(e);e+=1,n.salt=t.slice(e,e+i),e+=i;let s=t.readUInt8(e);return e+=1,n.nextDomain=t.slice(e,e+s),e+=s,n.rrtypes=k.decode(t,e,o-(e-r)),e+=k.decode.bytes,le.decode.bytes=e-r,n};le.decode.bytes=0;le.encodingLength=function(t){return 8+t.salt.length+t.nextDomain.length+k.encodingLength(t.rrtypes)};var ue=b.ds={};ue.encode=function(t,e,r){e||(e=x.alloc(ue.encodingLength(t))),r||(r=0);let n=r,o=t.digest;if(!x.isBuffer(o))throw new Error("Digest must be a Buffer");return r+=2,e.writeUInt16BE(t.keyTag,r),r+=2,e.writeUInt8(t.algorithm,r),r+=1,e.writeUInt8(t.digestType,r),r+=1,o.copy(e,r,0,o.length),r+=o.length,ue.encode.bytes=r-n,e.writeUInt16BE(ue.encode.bytes-2,n),e};ue.encode.bytes=0;ue.decode=function(t,e){e||(e=0);let r=e;var n={},o=t.readUInt16BE(e);return e+=2,n.keyTag=t.readUInt16BE(e),e+=2,n.algorithm=t.readUInt8(e),e+=1,n.digestType=t.readUInt8(e),e+=1,n.digest=t.slice(e,r+o+2),e+=n.digest.length,ue.decode.bytes=e-r,n};ue.decode.bytes=0;ue.encodingLength=function(t){return 6+x.byteLength(t.digest)};var Q=b.sshfp={};Q.getFingerprintLengthForHashType=function(e){switch(e){case 1:return 20;case 2:return 32}};Q.encode=function(e,r,n){r||(r=x.alloc(Q.encodingLength(e))),n||(n=0);let o=n;n+=2,r[n]=e.algorithm,n+=1,r[n]=e.hash,n+=1;let i=x.from(e.fingerprint.toUpperCase(),"hex");if(i.length!==Q.getFingerprintLengthForHashType(e.hash))throw new Error("Invalid fingerprint length");return i.copy(r,n),n+=i.byteLength,Q.encode.bytes=n-o,r.writeUInt16BE(Q.encode.bytes-2,o),r};Q.encode.bytes=0;Q.decode=function(e,r){r||(r=0);let n=r,o={};r+=2,o.algorithm=e[r],r+=1,o.hash=e[r],r+=1;let i=Q.getFingerprintLengthForHashType(o.hash);return o.fingerprint=e.slice(r,r+i).toString("hex").toUpperCase(),r+=i,Q.decode.bytes=r-n,o};Q.decode.bytes=0;Q.encodingLength=function(t){return 4+x.from(t.fingerprint,"hex").byteLength};var he=b.naptr={};he.encode=function(t,e,r){e||(e=x.alloc(he.encodingLength(t))),r||(r=0);let n=r;return r+=2,e.writeUInt16BE(t.order||0,r),r+=2,e.writeUInt16BE(t.preference||0,r),r+=2,A.encode(t.flags,e,r),r+=A.encode.bytes,A.encode(t.services,e,r),r+=A.encode.bytes,A.encode(t.regexp,e,r),r+=A.encode.bytes,m.encode(t.replacement,e,r),r+=m.encode.bytes,he.encode.bytes=r-n,e.writeUInt16BE(he.encode.bytes-2,n),e};he.encode.bytes=0;he.decode=function(t,e){e||(e=0);let r=e,n={};return e+=2,n.order=t.readUInt16BE(e),e+=2,n.preference=t.readUInt16BE(e),e+=2,n.flags=A.decode(t,e),e+=A.decode.bytes,n.services=A.decode(t,e),e+=A.decode.bytes,n.regexp=A.decode(t,e),e+=A.decode.bytes,n.replacement=m.decode(t,e),e+=m.decode.bytes,he.decode.bytes=e-r,n};he.decode.bytes=0;he.encodingLength=function(t){return A.encodingLength(t.flags)+A.encodingLength(t.services)+A.encodingLength(t.regexp)+m.encodingLength(t.replacement)+6};var pe=b.tlsa={};pe.encode=function(t,e,r){e||(e=x.alloc(pe.encodingLength(t))),r||(r=0);let n=r,o=t.certificate;if(!x.isBuffer(o))throw new Error("Certificate must be a Buffer");return r+=2,e.writeUInt8(t.usage,r),r+=1,e.writeUInt8(t.selector,r),r+=1,e.writeUInt8(t.matchingType,r),r+=1,o.copy(e,r,0,o.length),r+=o.length,pe.encode.bytes=r-n,e.writeUInt16BE(pe.encode.bytes-2,n),e};pe.encode.bytes=0;pe.decode=function(t,e){e||(e=0);let r=e,n={},o=t.readUInt16BE(e);return e+=2,n.usage=t.readUInt8(e),e+=1,n.selector=t.readUInt8(e),e+=1,n.matchingType=t.readUInt8(e),e+=1,n.certificate=t.slice(e,r+o+2),e+=n.certificate.length,pe.decode.bytes=e-r,n};pe.decode.bytes=0;pe.encodingLength=function(t){return 5+x.byteLength(t.certificate)};var Et=b.record=function(t){switch(t.toUpperCase()){case"A":return Ce;case"PTR":return oe;case"CNAME":return rc;case"DNAME":return tc;case"TXT":return xe;case"NULL":return Ee;case"AAAA":return Ie;case"SRV":return fe;case"HINFO":return ve;case"CAA":return J;case"NS":return we;case"SOA":return be;case"MX":return Ne;case"OPT":return W;case"DNSKEY":return j;case"RRSIG":return ce;case"RP":return ae;case"NSEC":return de;case"NSEC3":return le;case"SSHFP":return Q;case"DS":return ue;case"NAPTR":return he;case"TLSA":return pe}return ye},_=b.answer={};_.encode=function(t,e,r){e||(e=x.alloc(_.encodingLength(t))),r||(r=0);let n=r;if(m.encode(t.name,e,r),r+=m.encode.bytes,e.writeUInt16BE(Se.toType(t.type),r),t.type.toUpperCase()==="OPT"){if(t.name!==".")throw new Error("OPT name must be root.");e.writeUInt16BE(t.udpPayloadSize||4096,r+2),e.writeUInt8(t.extendedRcode||0,r+4),e.writeUInt8(t.ednsVersion||0,r+5),e.writeUInt16BE(t.flags||0,r+6),r+=8,W.encode(t.options||[],e,r),r+=W.encode.bytes}else{let o=Mr.toClass(t.class===void 0?"IN":t.class);t.flush&&(o|=xt),e.writeUInt16BE(o,r+2),e.writeUInt32BE(t.ttl||0,r+4),r+=8;let i=Et(t.type);i.encode(t.data,e,r),r+=i.encode.bytes}return _.encode.bytes=r-n,e};_.encode.bytes=0;_.decode=function(t,e){e||(e=0);let r={},n=e;if(r.name=m.decode(t,e),e+=m.decode.bytes,r.type=Se.toString(t.readUInt16BE(e)),r.type==="OPT")r.udpPayloadSize=t.readUInt16BE(e+2),r.extendedRcode=t.readUInt8(e+4),r.ednsVersion=t.readUInt8(e+5),r.flags=t.readUInt16BE(e+6),r.flag_do=(r.flags>>15&1)===1,r.options=W.decode(t,e+8),e+=8+W.decode.bytes;else{let o=t.readUInt16BE(e+2);r.ttl=t.readUInt32BE(e+4),r.class=Mr.toString(o&Zs),r.flush=!!(o&xt);let i=Et(r.type);r.data=i.decode(t,e+8),e+=8+i.decode.bytes}return _.decode.bytes=e-n,r};_.decode.bytes=0;_.encodingLength=function(t){let e=t.data!==null&&t.data!==void 0?t.data:t.options;return m.encodingLength(t.name)+8+Et(t.type).encodingLength(e)};var ie=b.question={};ie.encode=function(t,e,r){e||(e=x.alloc(ie.encodingLength(t))),r||(r=0);let n=r;return m.encode(t.name,e,r),r+=m.encode.bytes,e.writeUInt16BE(Se.toType(t.type),r),r+=2,e.writeUInt16BE(Mr.toClass(t.class===void 0?"IN":t.class),r),r+=2,ie.encode.bytes=r-n,t};ie.encode.bytes=0;ie.decode=function(t,e){e||(e=0);let r=e,n={};return n.name=m.decode(t,e),e+=m.decode.bytes,n.type=Se.toString(t.readUInt16BE(e)),e+=2,n.class=Mr.toString(t.readUInt16BE(e)),e+=2,!!(n.class&vo)&&(n.class&=ec),ie.decode.bytes=e-r,n};ie.decode.bytes=0;ie.encodingLength=function(t){return m.encodingLength(t.name)+4};b.AUTHORITATIVE_ANSWER=1024;b.TRUNCATED_RESPONSE=512;b.RECURSION_DESIRED=256;b.RECURSION_AVAILABLE=128;b.AUTHENTIC_DATA=32;b.CHECKING_DISABLED=16;b.DNSSEC_OK=32768;b.encode=function(t,e,r){let n=!e;n&&(e=x.alloc(b.encodingLength(t))),r||(r=0);let o=r;return t.questions||(t.questions=[]),t.answers||(t.answers=[]),t.authorities||(t.authorities=[]),t.additionals||(t.additionals=[]),se.encode(t,e,r),r+=se.encode.bytes,r=dr(t.questions,ie,e,r),r=dr(t.answers,_,e,r),r=dr(t.authorities,_,e,r),r=dr(t.additionals,_,e,r),b.encode.bytes=r-o,n&&b.encode.bytes!==e.length?e.slice(0,b.encode.bytes):e};b.encode.bytes=0;b.decode=function(t,e){e||(e=0);let r=e,n=se.decode(t,e);return e+=se.decode.bytes,e=Fr(n.questions,ie,t,e),e=Fr(n.answers,_,t,e),e=Fr(n.authorities,_,t,e),e=Fr(n.additionals,_,t,e),b.decode.bytes=e-r,n};b.decode.bytes=0;b.encodingLength=function(t){return se.encodingLength(t)+Ge(t.questions||[],ie)+Ge(t.answers||[],_)+Ge(t.authorities||[],_)+Ge(t.additionals||[],_)};b.streamEncode=function(t){let e=b.encode(t),r=x.alloc(2);r.writeUInt16BE(e.byteLength);let n=x.concat([r,e]);return b.streamEncode.bytes=n.byteLength,n};b.streamEncode.bytes=0;b.streamDecode=function(t){let e=t.readUInt16BE(0);if(t.byteLength<e+2)return null;let r=b.decode(t.slice(2));return b.streamDecode.bytes=b.decode.bytes,r};b.streamDecode.bytes=0;function Ge(t,e){let r=0;for(let n=0;n<t.length;n++)r+=e.encodingLength(t[n]);return r}function dr(t,e,r,n){for(let o=0;o<t.length;o++)e.encode(t[o],r,n),n+=e.encode.bytes;return n}function Fr(t,e,r,n){for(let o=0;o<t.length;o++)t[o]=e.decode(r,n),n+=e.decode.bytes;return n}});var So=F((Ru,Io)=>{"use strict";var Co=ac;process.nextTick(cc,42);Io.exports=nc;function nc(t){var e=n;return r;function r(o){e(o||ic)}function n(o){var i=[o];e=s,t(a);function s(g){i.push(g)}function a(g){var w=arguments;for(e=oc(g)?n:p;i.length;)p(i.shift());function p(d){Co(sc,d,w)}}}}function oc(t){return Object.prototype.toString.call(t)==="[object Error]"}function ic(){}function sc(t,e){t.apply(null,e)}function cc(t){t===42&&(Co=process.nextTick)}function ac(t,e,r){process.nextTick(function(){t(e,r)})}});var Oo=F((Fu,Uo)=>{var vt=fo(),dc=te("dgram"),lc=So(),uc=te("events"),Ct=te("os"),ft=function(){};Uo.exports=function(t){t||(t={});var e=new uc.EventEmitter,r=typeof t.port=="number"?t.port:5353,n=t.type||"udp4",o=t.ip||t.host||(n==="udp4"?"224.0.0.251":null),i={address:o,port:r},s={},a=!1,g=null;if(n==="udp6"&&(!o||!t.interface))throw new Error("For IPv6 multicast you must specify `ip` and `interface`");var w=t.socket||dc.createSocket({type:n,reuseAddr:t.reuseAddr!==!1,toString:function(){return n}});w.on("error",function(d){d.code==="EACCES"||d.code==="EADDRINUSE"?e.emit("error",d):e.emit("warning",d)}),w.on("message",function(d,l){try{d=vt.decode(d)}catch(u){e.emit("warning",u);return}e.emit("packet",d,l),d.type==="query"&&e.emit("query",d,l),d.type==="response"&&e.emit("response",d,l)}),w.on("listening",function(){r||(r=i.port=w.address().port),t.multicast!==!1&&(e.update(),g=setInterval(e.update,5e3),w.setMulticastTTL(t.ttl||255),w.setMulticastLoopback(t.loopback!==!1))});var p=lc(function(d){if(!r||t.bind===!1)return d(null);w.once("error",d),w.bind(r,t.bind||t.interface,function(){w.removeListener("error",d),d(null)})});return p(function(d){if(d)return e.emit("error",d);e.emit("ready")}),e.send=function(d,l,u){if(typeof l=="function")return e.send(d,null,l);u||(u=ft),l?!l.host&&!l.address&&(l.address=i.address):l=i,p(c);function c(h){if(a)return u();if(h)return u(h);var y=vt.encode(d);w.send(y,0,y.length,l.port,l.address||l.host,u)}},e.response=e.respond=function(d,l,u){Array.isArray(d)&&(d={answers:d}),d.type="response",d.flags=(d.flags||0)|vt.AUTHORITATIVE_ANSWER,e.send(d,l,u)},e.query=function(d,l,u,c){if(typeof l=="function")return e.query(d,null,null,l);if(typeof l=="object"&&l&&l.port)return e.query(d,null,l,u);if(typeof u=="function")return e.query(d,l,null,u);c||(c=ft),typeof d=="string"&&(d=[{name:d,type:l||"ANY"}]),Array.isArray(d)&&(d={type:"query",questions:d}),d.type="query",e.send(d,u,c)},e.destroy=function(d){if(d||(d=ft),a)return process.nextTick(d);a=!0,clearInterval(g);for(var l in s)try{w.dropMembership(o,l)}catch{}s={},w.close(d)},e.update=function(){for(var d=t.interface?[].concat(t.interface):pc(),l=!1,u=0;u<d.length;u++){var c=d[u];if(!s[c])try{w.addMembership(o,c),s[c]=!0,l=!0}catch(h){e.emit("warning",h)}}if(l){if(w.setMulticastInterface)try{w.setMulticastInterface(t.interface||hc())}catch(h){e.emit("warning",h)}e.emit("networkInterface")}},e};function hc(){for(var t=Ct.networkInterfaces(),e=Object.keys(t),r=0;r<e.length;r++)for(var n=t[e[r]],o=0;o<n.length;o++){var i=n[o];if(Ao(i.family)&&!i.internal)return Ct.platform()==="darwin"&&e[r]==="en0"?i.address:"0.0.0.0"}return"127.0.0.1"}function pc(){for(var t=Ct.networkInterfaces(),e=Object.keys(t),r=[],n=0;n<e.length;n++)for(var o=t[e[n]],i=0;i<o.length;i++){var s=o[i];if(Ao(s.family)){r.push(s.address);break}}return r}function Ao(t){return t===4||t==="IPv4"}});var Ai=F((Np,Si)=>{Si.exports=bn;var Ii=128,Jd=127,Qd=~Jd,Wd=Math.pow(2,31);function bn(t,e,r){if(Number.MAX_SAFE_INTEGER&&t>Number.MAX_SAFE_INTEGER)throw bn.bytes=0,new RangeError("Could not encode varint");e=e||[],r=r||0;for(var n=r;t>=Wd;)e[r++]=t&255|Ii,t/=128;for(;t&Qd;)e[r++]=t&255|Ii,t>>>=7;return e[r]=t|0,bn.bytes=r-n+1,e}});var Ti=F((Pp,Oi)=>{Oi.exports=xn;var Zd=128,Ui=127;function xn(t,n){var r=0,n=n||0,o=0,i=n,s,a=t.length;do{if(i>=a||o>49)throw xn.bytes=0,new RangeError("Could not decode varint");s=t[i++],r+=o<28?(s&Ui)<<o:(s&Ui)*Math.pow(2,o),o+=7}while(s>=Zd);return xn.bytes=i-n,r}});var Bi=F((Dp,Li)=>{var el=Math.pow(2,7),rl=Math.pow(2,14),tl=Math.pow(2,21),nl=Math.pow(2,28),ol=Math.pow(2,35),il=Math.pow(2,42),sl=Math.pow(2,49),cl=Math.pow(2,56),al=Math.pow(2,63);Li.exports=function(t){return t<el?1:t<rl?2:t<tl?3:t<nl?4:t<ol?5:t<il?6:t<sl?7:t<cl?8:t<al?9:10}});var Xr=F((Rp,Ni)=>{Ni.exports={encode:Ai(),decode:Ti(),encodingLength:Bi()}});var au={};O(au,{mdns:()=>cu});var Tr=class extends EventTarget{#e=new Map;listenerCount(e){let r=this.#e.get(e);return r==null?0:r.length}addEventListener(e,r,n){super.addEventListener(e,r,n);let o=this.#e.get(e);o==null&&(o=[],this.#e.set(e,o)),o.push({callback:r,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(e,r,n){super.removeEventListener(e.toString(),r??null,n);let o=this.#e.get(e);o!=null&&(o=o.filter(({callback:i})=>i!==r),this.#e.set(e,o))}dispatchEvent(e){let r=super.dispatchEvent(e),n=this.#e.get(e.type);return n==null||(n=n.filter(({once:o})=>!o),this.#e.set(e.type,n)),r}safeDispatchEvent(e,r){return this.dispatchEvent(new Lr(e,r))}},et=class extends Event{detail;constructor(e,r){super(e,r),this.detail=r?.detail}},Lr=globalThis.CustomEvent??et;var Xn=Symbol.for("@libp2p/peer-discovery");var Y=Te(oo(),1);var at={};O(at,{base32:()=>Be,base32hex:()=>_s,base32hexpad:()=>qs,base32hexpadupper:()=>$s,base32hexupper:()=>Vs,base32pad:()=>ks,base32padupper:()=>zs,base32upper:()=>Ms,base32z:()=>js});function Ns(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<t.length;o++){var i=t.charAt(o),s=i.charCodeAt(0);if(r[s]!==255)throw new TypeError(i+" is ambiguous");r[s]=o}var a=t.length,g=t.charAt(0),w=Math.log(a)/Math.log(256),p=Math.log(256)/Math.log(a);function d(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 h=0,y=0,E=0,v=c.length;E!==v&&c[E]===0;)E++,h++;for(var I=(v-E)*p+1>>>0,f=new Uint8Array(I);E!==v;){for(var C=c[E],S=0,U=I-1;(C!==0||S<y)&&U!==-1;U--,S++)C+=256*f[U]>>>0,f[U]=C%a>>>0,C=C/a>>>0;if(C!==0)throw new Error("Non-zero carry");y=S,E++}for(var T=I-y;T!==I&&f[T]===0;)T++;for(var V=g.repeat(h);T<I;++T)V+=t.charAt(f[T]);return V}function l(c){if(typeof c!="string")throw new TypeError("Expected String");if(c.length===0)return new Uint8Array;var h=0;if(c[h]!==" "){for(var y=0,E=0;c[h]===g;)y++,h++;for(var v=(c.length-h)*w+1>>>0,I=new Uint8Array(v);c[h];){var f=r[c.charCodeAt(h)];if(f===255)return;for(var C=0,S=v-1;(f!==0||C<E)&&S!==-1;S--,C++)f+=a*I[S]>>>0,I[S]=f%256>>>0,f=f/256>>>0;if(f!==0)throw new Error("Non-zero carry");E=C,h++}if(c[h]!==" "){for(var U=v-E;U!==v&&I[U]===0;)U++;for(var T=new Uint8Array(y+(v-U)),V=y;U!==v;)T[V++]=I[U++];return T}}}function u(c){var h=l(c);if(h)return h;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:l,decode:u}}var Ps=Ns,Ds=Ps,io=Ds;var bu=new Uint8Array(0);var so=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0},Z=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")};var co=t=>new TextEncoder().encode(t),ao=t=>new TextDecoder().decode(t);var ot=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},it=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return uo(this,e)}},st=class{constructor(e){this.decoders=e}or(e){return uo(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},uo=(t,e)=>new st({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),ct=class{constructor(e,r,n,o){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=o,this.encoder=new ot(e,r,n),this.decoder=new it(e,r,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Ke=({name:t,prefix:e,encode:r,decode:n})=>new ct(t,e,r,n),Le=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:o}=io(r,e);return Ke({prefix:t,name:e,encode:n,decode:i=>Z(o(i))})},Rs=(t,e,r,n)=>{let o={};for(let p=0;p<e.length;++p)o[e[p]]=p;let i=t.length;for(;t[i-1]==="=";)--i;let s=new Uint8Array(i*r/8|0),a=0,g=0,w=0;for(let p=0;p<i;++p){let d=o[t[p]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);g=g<<r|d,a+=r,a>=8&&(a-=8,s[w++]=255&g>>a)}if(a>=r||255&g<<8-a)throw new SyntaxError("Unexpected end of data");return s},Fs=(t,e,r)=>{let n=e[e.length-1]==="=",o=(1<<r)-1,i="",s=0,a=0;for(let g=0;g<t.length;++g)for(a=a<<8|t[g],s+=8;s>r;)s-=r,i+=e[o&a>>s];if(s&&(i+=e[o&a<<r-s]),n)for(;i.length*r&7;)i+="=";return i},P=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>Ke({prefix:e,name:t,encode(o){return Fs(o,n,r)},decode(o){return Rs(o,n,r,t)}});var Be=P({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Ms=P({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ks=P({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),zs=P({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),_s=P({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Vs=P({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),qs=P({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),$s=P({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),js=P({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var dt={};O(dt,{base58btc:()=>$,base58flickr:()=>Ks});var $=Le({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Ks=Le({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var ut={};O(ut,{base64:()=>lt,base64pad:()=>Gs,base64url:()=>Xs,base64urlpad:()=>Hs});var lt=P({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Gs=P({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Xs=P({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Hs=P({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});Y.default.formatters.b=t=>t==null?"undefined":$.baseEncode(t);Y.default.formatters.t=t=>t==null?"undefined":Be.baseEncode(t);Y.default.formatters.m=t=>t==null?"undefined":lt.baseEncode(t);Y.default.formatters.p=t=>t==null?"undefined":t.toString();Y.default.formatters.c=t=>t==null?"undefined":t.toString();Y.default.formatters.k=t=>t==null?"undefined":t.toString();Y.default.formatters.a=t=>t==null?"undefined":t.toString();function Ys(t){let e=()=>{};return e.enabled=!1,e.color="",e.diff=0,e.log=()=>{},e.namespace=t,e.destroy=()=>!0,e.extend=()=>e,e}function Rr(t){let e=Ys(`${t}:trace`);return Y.default.enabled(`${t}:trace`)&&Y.default.names.map(r=>r.toString()).find(r=>r.includes(":trace"))!=null&&(e=(0,Y.default)(`${t}:trace`)),Object.assign((0,Y.default)(t),{error:(0,Y.default)(`${t}:error`),trace:e})}var ts=Te(Oo(),1);var To=Symbol.for("@libp2p/peer-id");var It={};O(It,{identity:()=>gc});var gc=Ke({prefix:"\0",name:"identity",encode:t=>ao(t),decode:t=>co(t)});var St={};O(St,{base2:()=>yc});var yc=P({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var At={};O(At,{base8:()=>wc});var wc=P({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Ut={};O(Ut,{base10:()=>bc});var bc=Le({prefix:"9",name:"base10",alphabet:"0123456789"});var Ot={};O(Ot,{base16:()=>xc,base16upper:()=>Ec});var xc=P({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Ec=P({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Tt={};O(Tt,{base36:()=>vc,base36upper:()=>fc});var vc=Le({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),fc=Le({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Lt={};O(Lt,{base256emoji:()=>Uc});var Lo=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}"),Cc=Lo.reduce((t,e,r)=>(t[r]=e,t),[]),Ic=Lo.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Sc(t){return t.reduce((e,r)=>(e+=Cc[r],e),"")}function Ac(t){let e=[];for(let r of t){let n=Ic[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var Uc=Ke({prefix:"\u{1F680}",name:"base256emoji",encode:Sc,decode:Ac});var Rt={};O(Rt,{sha256:()=>zr,sha512:()=>Gc});var Dt=Te(te("crypto"),1);var Oc=Po,Bo=128,Tc=127,Lc=~Tc,Bc=Math.pow(2,31);function Po(t,e,r){e=e||[],r=r||0;for(var n=r;t>=Bc;)e[r++]=t&255|Bo,t/=128;for(;t&Lc;)e[r++]=t&255|Bo,t>>>=7;return e[r]=t|0,Po.bytes=r-n+1,e}var Nc=Bt,Pc=128,No=127;function Bt(t,n){var r=0,n=n||0,o=0,i=n,s,a=t.length;do{if(i>=a)throw Bt.bytes=0,new RangeError("Could not decode varint");s=t[i++],r+=o<28?(s&No)<<o:(s&No)*Math.pow(2,o),o+=7}while(s>=Pc);return Bt.bytes=i-n,r}var Dc=Math.pow(2,7),Rc=Math.pow(2,14),Fc=Math.pow(2,21),Mc=Math.pow(2,28),kc=Math.pow(2,35),zc=Math.pow(2,42),_c=Math.pow(2,49),Vc=Math.pow(2,56),qc=Math.pow(2,63),$c=function(t){return t<Dc?1:t<Rc?2:t<Fc?3:t<Mc?4:t<kc?5:t<zc?6:t<_c?7:t<Vc?8:t<qc?9:10},jc={encode:Oc,decode:Nc,encodingLength:$c},Kc=jc,lr=Kc;var ur=(t,e=0)=>[lr.decode(t,e),lr.decode.bytes],Xe=(t,e,r=0)=>(lr.encode(t,e,r),e),He=t=>lr.encodingLength(t);var Pe=(t,e)=>{let r=e.byteLength,n=He(t),o=n+He(r),i=new Uint8Array(o+r);return Xe(t,i,0),Xe(r,i,n),i.set(e,o),new Ye(t,r,e,i)},hr=t=>{let e=Z(t),[r,n]=ur(e),[o,i]=ur(e.subarray(n)),s=e.subarray(n+i);if(s.byteLength!==o)throw new Error("Incorrect length");return new Ye(r,o,s,e)},Do=(t,e)=>{if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&so(t.bytes,r.bytes)}},Ye=class{constructor(e,r,n,o){this.code=e,this.size=r,this.digest=n,this.bytes=o}};var Pt=({name:t,code:e,encode:r})=>new Nt(t,e,r),Nt=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?Pe(this.code,r):r.then(n=>Pe(this.code,n))}else throw Error("Unknown type, must be binary type")}};var zr=Pt({name:"sha2-256",code:18,encode:t=>Z(Dt.default.createHash("sha256").update(t).digest())}),Gc=Pt({name:"sha2-512",code:19,encode:t=>Z(Dt.default.createHash("sha512").update(t).digest())});var Ft={};O(Ft,{identity:()=>_r});var Fo=0,Xc="identity",Mo=Z,Hc=t=>Pe(Fo,Mo(t)),_r={code:Fo,name:Xc,encode:Mo,digest:Hc};var rh=new TextEncoder,th=new TextDecoder;var ko=(t,e)=>{let{bytes:r,version:n}=t;switch(n){case 0:return Wc(r,Mt(t),e||$.encoder);default:return Zc(r,Mt(t),e||Be.encoder)}};var zo=new WeakMap,Mt=t=>{let e=zo.get(t);if(e==null){let r=new Map;return zo.set(t,r),r}return e},N=class{constructor(e,r,n,o){this.code=r,this.version=e,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:r}=this;if(e!==pr)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==ea)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return N.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=Pe(e,r);return N.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 N.equals(this,e)}static equals(e,r){let n=r;return n&&e.code===n.code&&e.version===n.version&&Do(e.multihash,n.multihash)}toString(e){return ko(this,e)}toJSON(){return{"/":ko(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let r=e;if(r instanceof N)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:o,multihash:i,bytes:s}=r;return new N(n,o,i,s||_o(n,o,i.bytes))}else if(r[ra]===!0){let{version:n,multihash:o,code:i}=r,s=hr(o);return N.create(n,i,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(r!==pr)throw new Error(`Version 0 CID must use dag-pb (code: ${pr}) block encoding`);return new N(e,r,n,n.bytes)}case 1:{let o=_o(e,r,n.bytes);return new N(e,r,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return N.create(0,pr,e)}static createV1(e,r){return N.create(1,e,r)}static decode(e){let[r,n]=N.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=N.inspectBytes(e),n=r.size-r.multihashSize,o=Z(e.subarray(n,n+r.multihashSize));if(o.byteLength!==r.multihashSize)throw new Error("Incorrect length");let i=o.subarray(r.multihashSize-r.digestSize),s=new Ye(r.multihashCode,r.digestSize,i,o);return[r.version===0?N.createV0(s):N.createV1(r.codec,s),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[d,l]=ur(e.subarray(r));return r+=l,d},o=n(),i=pr;if(o===18?(o=0,r=0):i=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let s=r,a=n(),g=n(),w=r+g,p=w-s;return{version:o,codec:i,multihashCode:a,digestSize:g,multihashSize:p,size:w}}static parse(e,r){let[n,o]=Qc(e,r),i=N.decode(o);if(i.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Mt(i).set(n,e),i}},Qc=(t,e)=>{switch(t[0]){case"Q":{let r=e||$;return[$.prefix,r.decode(`${$.prefix}${t}`)]}case $.prefix:{let r=e||$;return[$.prefix,r.decode(t)]}case Be.prefix:{let r=e||Be;return[Be.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}},Wc=(t,e,r)=>{let{prefix:n}=r;if(n!==$.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let o=e.get(n);if(o==null){let i=r.encode(t).slice(1);return e.set(n,i),i}else return o},Zc=(t,e,r)=>{let{prefix:n}=r,o=e.get(n);if(o==null){let i=r.encode(t);return e.set(n,i),i}else return o},pr=112,ea=18,_o=(t,e,r)=>{let n=He(t),o=n+He(e),i=new Uint8Array(o+r.byteLength);return Xe(t,i,0),Xe(e,i,n),i.set(r,o),i},ra=Symbol.for("@ipld/js-cid/CID");var kt={...It,...St,...At,...Ut,...Ot,...at,...Tt,...dt,...ut,...Lt},hh={...Rt,...Ft};function mr(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0}var ta=Symbol.for("nodejs.util.inspect.custom"),Vo=Object.values(kt).map(t=>t.decoder).reduce((t,e)=>t.or(e),kt.identity.decoder),qo=114,$o=36,jo=37,gr=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()})`}[To]=!0;toString(){return this.string==null&&(this.string=$.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return N.createV1(qo,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e instanceof Uint8Array)return mr(this.multihash.bytes,e);if(typeof e=="string")return zt(e).equals(this);if(e?.multihash?.bytes!=null)return mr(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[ta](){return`PeerId(${this.toString()})`}},yr=class extends gr{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},wr=class extends gr{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.multihash.digest}},br=class extends gr{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.multihash.digest}};function zt(t,e){if(e=e??Vo,t.charAt(0)==="1"||t.charAt(0)==="Q"){let r=hr($.decode(`z${t}`));return t.startsWith("12D")?new wr({multihash:r}):t.startsWith("16U")?new br({multihash:r}):new yr({multihash:r})}return na(Vo.decode(t))}function na(t){try{let e=hr(t);if(e.code===_r.code){if(e.digest.length===$o)return new wr({multihash:e});if(e.digest.length===jo)return new br({multihash:e})}if(e.code===zr.code)return new yr({multihash:e})}catch{return oa(N.decode(t))}throw new Error("Supplied PeerID CID is invalid")}function oa(t){if(t==null||t.multihash==null||t.version==null||t.version===1&&t.code!==qo)throw new Error("Supplied PeerID CID is invalid");let e=t.multihash;if(e.code===zr.code)return new yr({multihash:t.multihash});if(e.code===_r.code){if(e.digest.length===$o)return new wr({multihash:t.multihash});if(e.digest.length===jo)return new br({multihash:t.multihash})}throw new Error("Supplied PeerID CID is invalid")}var Vr=class extends Error{code;props;constructor(e,r,n){super(e),this.code=r,this.name=n?.name??"CodeError",this.props=n??{}}};var jt={};O(jt,{base58btc:()=>G,base58flickr:()=>la});function ia(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<t.length;o++){var i=t.charAt(o),s=i.charCodeAt(0);if(r[s]!==255)throw new TypeError(i+" is ambiguous");r[s]=o}var a=t.length,g=t.charAt(0),w=Math.log(a)/Math.log(256),p=Math.log(256)/Math.log(a);function d(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 h=0,y=0,E=0,v=c.length;E!==v&&c[E]===0;)E++,h++;for(var I=(v-E)*p+1>>>0,f=new Uint8Array(I);E!==v;){for(var C=c[E],S=0,U=I-1;(C!==0||S<y)&&U!==-1;U--,S++)C+=256*f[U]>>>0,f[U]=C%a>>>0,C=C/a>>>0;if(C!==0)throw new Error("Non-zero carry");y=S,E++}for(var T=I-y;T!==I&&f[T]===0;)T++;for(var V=g.repeat(h);T<I;++T)V+=t.charAt(f[T]);return V}function l(c){if(typeof c!="string")throw new TypeError("Expected String");if(c.length===0)return new Uint8Array;var h=0;if(c[h]!==" "){for(var y=0,E=0;c[h]===g;)y++,h++;for(var v=(c.length-h)*w+1>>>0,I=new Uint8Array(v);c[h];){var f=r[c.charCodeAt(h)];if(f===255)return;for(var C=0,S=v-1;(f!==0||C<E)&&S!==-1;S--,C++)f+=a*I[S]>>>0,I[S]=f%256>>>0,f=f/256>>>0;if(f!==0)throw new Error("Non-zero carry");E=C,h++}if(c[h]!==" "){for(var U=v-E;U!==v&&I[U]===0;)U++;for(var T=new Uint8Array(y+(v-U)),V=y;U!==v;)T[V++]=I[U++];return T}}}function u(c){var h=l(c);if(h)return h;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:l,decode:u}}var sa=ia,ca=sa,Ko=ca;var Oh=new Uint8Array(0);var Go=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0},ee=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")};var Xo=t=>new TextEncoder().encode(t),Ho=t=>new TextDecoder().decode(t);var _t=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Vt=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Jo(this,e)}},qt=class{constructor(e){this.decoders=e}or(e){return Jo(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},Jo=(t,e)=>new qt({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),$t=class{constructor(e,r,n,o){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=o,this.encoder=new _t(e,r,n),this.decoder=new Vt(e,r,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Qe=({name:t,prefix:e,encode:r,decode:n})=>new $t(t,e,r,n),De=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:o}=Ko(r,e);return Qe({prefix:t,name:e,encode:n,decode:i=>ee(o(i))})},aa=(t,e,r,n)=>{let o={};for(let p=0;p<e.length;++p)o[e[p]]=p;let i=t.length;for(;t[i-1]==="=";)--i;let s=new Uint8Array(i*r/8|0),a=0,g=0,w=0;for(let p=0;p<i;++p){let d=o[t[p]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);g=g<<r|d,a+=r,a>=8&&(a-=8,s[w++]=255&g>>a)}if(a>=r||255&g<<8-a)throw new SyntaxError("Unexpected end of data");return s},da=(t,e,r)=>{let n=e[e.length-1]==="=",o=(1<<r)-1,i="",s=0,a=0;for(let g=0;g<t.length;++g)for(a=a<<8|t[g],s+=8;s>r;)s-=r,i+=e[o&a>>s];if(s&&(i+=e[o&a<<r-s]),n)for(;i.length*r&7;)i+="=";return i},D=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>Qe({prefix:e,name:t,encode(o){return da(o,n,r)},decode(o){return aa(o,n,r,t)}});var G=De({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),la=De({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var ua=Zo,Qo=128,ha=127,pa=~ha,ma=Math.pow(2,31);function Zo(t,e,r){e=e||[],r=r||0;for(var n=r;t>=ma;)e[r++]=t&255|Qo,t/=128;for(;t&pa;)e[r++]=t&255|Qo,t>>>=7;return e[r]=t|0,Zo.bytes=r-n+1,e}var ga=Kt,ya=128,Wo=127;function Kt(t,n){var r=0,n=n||0,o=0,i=n,s,a=t.length;do{if(i>=a)throw Kt.bytes=0,new RangeError("Could not decode varint");s=t[i++],r+=o<28?(s&Wo)<<o:(s&Wo)*Math.pow(2,o),o+=7}while(s>=ya);return Kt.bytes=i-n,r}var wa=Math.pow(2,7),ba=Math.pow(2,14),xa=Math.pow(2,21),Ea=Math.pow(2,28),va=Math.pow(2,35),fa=Math.pow(2,42),Ca=Math.pow(2,49),Ia=Math.pow(2,56),Sa=Math.pow(2,63),Aa=function(t){return t<wa?1:t<ba?2:t<xa?3:t<Ea?4:t<va?5:t<fa?6:t<Ca?7:t<Ia?8:t<Sa?9:10},Ua={encode:ua,decode:ga,encodingLength:Aa},Oa=Ua,xr=Oa;var Er=(t,e=0)=>[xr.decode(t,e),xr.decode.bytes],We=(t,e,r=0)=>(xr.encode(t,e,r),e),Ze=t=>xr.encodingLength(t);var ze=(t,e)=>{let r=e.byteLength,n=Ze(t),o=n+Ze(r),i=new Uint8Array(o+r);return We(t,i,0),We(r,i,n),i.set(e,o),new er(t,r,e,i)},$r=t=>{let e=ee(t),[r,n]=Er(e),[o,i]=Er(e.subarray(n)),s=e.subarray(n+i);if(s.byteLength!==o)throw new Error("Incorrect length");return new er(r,o,s,e)},ei=(t,e)=>{if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&Go(t.bytes,r.bytes)}},er=class{constructor(e,r,n,o){this.code=e,this.size=r,this.digest=n,this.bytes=o}};var Gt={};O(Gt,{base32:()=>Ae,base32hex:()=>Na,base32hexpad:()=>Da,base32hexpadupper:()=>Ra,base32hexupper:()=>Pa,base32pad:()=>La,base32padupper:()=>Ba,base32upper:()=>Ta,base32z:()=>Fa});var Ae=D({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Ta=D({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),La=D({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ba=D({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Na=D({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Pa=D({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Da=D({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Ra=D({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Fa=D({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var ri=(t,e)=>{let{bytes:r,version:n}=t;switch(n){case 0:return ka(r,Xt(t),e||G.encoder);default:return za(r,Xt(t),e||Ae.encoder)}};var ti=new WeakMap,Xt=t=>{let e=ti.get(t);if(e==null){let r=new Map;return ti.set(t,r),r}return e},B=class{constructor(e,r,n,o){this.code=r,this.version=e,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:r}=this;if(e!==vr)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==_a)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return B.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=ze(e,r);return B.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 B.equals(this,e)}static equals(e,r){let n=r;return n&&e.code===n.code&&e.version===n.version&&ei(e.multihash,n.multihash)}toString(e){return ri(this,e)}toJSON(){return{"/":ri(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let r=e;if(r instanceof B)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:o,multihash:i,bytes:s}=r;return new B(n,o,i,s||ni(n,o,i.bytes))}else if(r[Va]===!0){let{version:n,multihash:o,code:i}=r,s=$r(o);return B.create(n,i,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(r!==vr)throw new Error(`Version 0 CID must use dag-pb (code: ${vr}) block encoding`);return new B(e,r,n,n.bytes)}case 1:{let o=ni(e,r,n.bytes);return new B(e,r,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return B.create(0,vr,e)}static createV1(e,r){return B.create(1,e,r)}static decode(e){let[r,n]=B.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=B.inspectBytes(e),n=r.size-r.multihashSize,o=ee(e.subarray(n,n+r.multihashSize));if(o.byteLength!==r.multihashSize)throw new Error("Incorrect length");let i=o.subarray(r.multihashSize-r.digestSize),s=new er(r.multihashCode,r.digestSize,i,o);return[r.version===0?B.createV0(s):B.createV1(r.codec,s),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[d,l]=Er(e.subarray(r));return r+=l,d},o=n(),i=vr;if(o===18?(o=0,r=0):i=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let s=r,a=n(),g=n(),w=r+g,p=w-s;return{version:o,codec:i,multihashCode:a,digestSize:g,multihashSize:p,size:w}}static parse(e,r){let[n,o]=Ma(e,r),i=B.decode(o);if(i.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Xt(i).set(n,e),i}},Ma=(t,e)=>{switch(t[0]){case"Q":{let r=e||G;return[G.prefix,r.decode(`${G.prefix}${t}`)]}case G.prefix:{let r=e||G;return[G.prefix,r.decode(t)]}case Ae.prefix:{let r=e||Ae;return[Ae.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}},ka=(t,e,r)=>{let{prefix:n}=r;if(n!==G.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let o=e.get(n);if(o==null){let i=r.encode(t).slice(1);return e.set(n,i),i}else return o},za=(t,e,r)=>{let{prefix:n}=r,o=e.get(n);if(o==null){let i=r.encode(t);return e.set(n,i),i}else return o},vr=112,_a=18,ni=(t,e,r)=>{let n=Ze(t),o=n+Ze(e),i=new Uint8Array(o+r.byteLength);return We(t,i,0),We(e,i,n),i.set(r,o),i},Va=Symbol.for("@ipld/js-cid/CID");var Wt={};O(Wt,{identity:()=>Xa});function qa(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<t.length;o++){var i=t.charAt(o),s=i.charCodeAt(0);if(r[s]!==255)throw new TypeError(i+" is ambiguous");r[s]=o}var a=t.length,g=t.charAt(0),w=Math.log(a)/Math.log(256),p=Math.log(256)/Math.log(a);function d(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 h=0,y=0,E=0,v=c.length;E!==v&&c[E]===0;)E++,h++;for(var I=(v-E)*p+1>>>0,f=new Uint8Array(I);E!==v;){for(var C=c[E],S=0,U=I-1;(C!==0||S<y)&&U!==-1;U--,S++)C+=256*f[U]>>>0,f[U]=C%a>>>0,C=C/a>>>0;if(C!==0)throw new Error("Non-zero carry");y=S,E++}for(var T=I-y;T!==I&&f[T]===0;)T++;for(var V=g.repeat(h);T<I;++T)V+=t.charAt(f[T]);return V}function l(c){if(typeof c!="string")throw new TypeError("Expected String");if(c.length===0)return new Uint8Array;var h=0;if(c[h]!==" "){for(var y=0,E=0;c[h]===g;)y++,h++;for(var v=(c.length-h)*w+1>>>0,I=new Uint8Array(v);c[h];){var f=r[c.charCodeAt(h)];if(f===255)return;for(var C=0,S=v-1;(f!==0||C<E)&&S!==-1;S--,C++)f+=a*I[S]>>>0,I[S]=f%256>>>0,f=f/256>>>0;if(f!==0)throw new Error("Non-zero carry");E=C,h++}if(c[h]!==" "){for(var U=v-E;U!==v&&I[U]===0;)U++;for(var T=new Uint8Array(y+(v-U)),V=y;U!==v;)T[V++]=I[U++];return T}}}function u(c){var h=l(c);if(h)return h;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:l,decode:u}}var $a=qa,ja=$a,oi=ja;var $h=new Uint8Array(0);var ii=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0},re=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")};var si=t=>new TextEncoder().encode(t),ci=t=>new TextDecoder().decode(t);var Ht=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Yt=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return di(this,e)}},Jt=class{constructor(e){this.decoders=e}or(e){return di(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},di=(t,e)=>new Jt({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),Qt=class{constructor(e,r,n,o){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=o,this.encoder=new Ht(e,r,n),this.decoder=new Yt(e,r,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},tr=({name:t,prefix:e,encode:r,decode:n})=>new Qt(t,e,r,n),Re=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:o}=oi(r,e);return tr({prefix:t,name:e,encode:n,decode:i=>re(o(i))})},Ka=(t,e,r,n)=>{let o={};for(let p=0;p<e.length;++p)o[e[p]]=p;let i=t.length;for(;t[i-1]==="=";)--i;let s=new Uint8Array(i*r/8|0),a=0,g=0,w=0;for(let p=0;p<i;++p){let d=o[t[p]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);g=g<<r|d,a+=r,a>=8&&(a-=8,s[w++]=255&g>>a)}if(a>=r||255&g<<8-a)throw new SyntaxError("Unexpected end of data");return s},Ga=(t,e,r)=>{let n=e[e.length-1]==="=",o=(1<<r)-1,i="",s=0,a=0;for(let g=0;g<t.length;++g)for(a=a<<8|t[g],s+=8;s>r;)s-=r,i+=e[o&a>>s];if(s&&(i+=e[o&a<<r-s]),n)for(;i.length*r&7;)i+="=";return i},R=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>tr({prefix:e,name:t,encode(o){return Ga(o,n,r)},decode(o){return Ka(o,n,r,t)}});var Xa=tr({prefix:"\0",name:"identity",encode:t=>ci(t),decode:t=>si(t)});var Zt={};O(Zt,{base2:()=>Ha});var Ha=R({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var en={};O(en,{base8:()=>Ya});var Ya=R({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var rn={};O(rn,{base10:()=>Ja});var Ja=Re({prefix:"9",name:"base10",alphabet:"0123456789"});var tn={};O(tn,{base16:()=>Qa,base16upper:()=>Wa});var Qa=R({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Wa=R({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var nn={};O(nn,{base32:()=>nr,base32hex:()=>td,base32hexpad:()=>od,base32hexpadupper:()=>id,base32hexupper:()=>nd,base32pad:()=>ed,base32padupper:()=>rd,base32upper:()=>Za,base32z:()=>sd});var nr=R({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Za=R({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ed=R({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),rd=R({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),td=R({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),nd=R({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),od=R({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),id=R({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),sd=R({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var on={};O(on,{base36:()=>cd,base36upper:()=>ad});var cd=Re({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),ad=Re({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var sn={};O(sn,{base58btc:()=>me,base58flickr:()=>dd});var me=Re({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),dd=Re({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var cn={};O(cn,{base64:()=>ld,base64pad:()=>ud,base64url:()=>hd,base64urlpad:()=>pd});var ld=R({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),ud=R({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),hd=R({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),pd=R({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var an={};O(an,{base256emoji:()=>bd});var li=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}"),md=li.reduce((t,e,r)=>(t[r]=e,t),[]),gd=li.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function yd(t){return t.reduce((e,r)=>(e+=md[r],e),"")}function wd(t){let e=[];for(let r of t){let n=gd[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var bd=tr({prefix:"\u{1F680}",name:"base256emoji",encode:yd,decode:wd});var pn={};O(pn,{sha256:()=>Md,sha512:()=>kd});var hn=Te(te("crypto"),1);var xd=pi,ui=128,Ed=127,vd=~Ed,fd=Math.pow(2,31);function pi(t,e,r){e=e||[],r=r||0;for(var n=r;t>=fd;)e[r++]=t&255|ui,t/=128;for(;t&vd;)e[r++]=t&255|ui,t>>>=7;return e[r]=t|0,pi.bytes=r-n+1,e}var Cd=dn,Id=128,hi=127;function dn(t,n){var r=0,n=n||0,o=0,i=n,s,a=t.length;do{if(i>=a)throw dn.bytes=0,new RangeError("Could not decode varint");s=t[i++],r+=o<28?(s&hi)<<o:(s&hi)*Math.pow(2,o),o+=7}while(s>=Id);return dn.bytes=i-n,r}var Sd=Math.pow(2,7),Ad=Math.pow(2,14),Ud=Math.pow(2,21),Od=Math.pow(2,28),Td=Math.pow(2,35),Ld=Math.pow(2,42),Bd=Math.pow(2,49),Nd=Math.pow(2,56),Pd=Math.pow(2,63),Dd=function(t){return t<Sd?1:t<Ad?2:t<Ud?3:t<Od?4:t<Td?5:t<Ld?6:t<Bd?7:t<Nd?8:t<Pd?9:10},Rd={encode:xd,decode:Cd,encodingLength:Dd},Fd=Rd,fr=Fd;var Cr=(t,e=0)=>[fr.decode(t,e),fr.decode.bytes],or=(t,e,r=0)=>(fr.encode(t,e,r),e),ir=t=>fr.encodingLength(t);var _e=(t,e)=>{let r=e.byteLength,n=ir(t),o=n+ir(r),i=new Uint8Array(o+r);return or(t,i,0),or(r,i,n),i.set(e,o),new sr(t,r,e,i)},mi=t=>{let e=re(t),[r,n]=Cr(e),[o,i]=Cr(e.subarray(n)),s=e.subarray(n+i);if(s.byteLength!==o)throw new Error("Incorrect length");return new sr(r,o,s,e)},gi=(t,e)=>{if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&ii(t.bytes,r.bytes)}},sr=class{constructor(e,r,n,o){this.code=e,this.size=r,this.digest=n,this.bytes=o}};var un=({name:t,code:e,encode:r})=>new ln(t,e,r),ln=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?_e(this.code,r):r.then(n=>_e(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Md=un({name:"sha2-256",code:18,encode:t=>re(hn.default.createHash("sha256").update(t).digest())}),kd=un({name:"sha2-512",code:19,encode:t=>re(hn.default.createHash("sha512").update(t).digest())});var mn={};O(mn,{identity:()=>Vd});var wi=0,zd="identity",bi=re,_d=t=>_e(wi,bi(t)),Vd={code:wi,name:zd,encode:bi,digest:_d};var up=new TextEncoder,hp=new TextDecoder;var xi=(t,e)=>{let{bytes:r,version:n}=t;switch(n){case 0:return Kd(r,gn(t),e||me.encoder);default:return Gd(r,gn(t),e||nr.encoder)}};var Ei=new WeakMap,gn=t=>{let e=Ei.get(t);if(e==null){let r=new Map;return Ei.set(t,r),r}return e},M=class{constructor(e,r,n,o){this.code=r,this.version=e,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:r}=this;if(e!==Sr)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Xd)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return M.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=_e(e,r);return M.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return M.equals(this,e)}static equals(e,r){let n=r;return n&&e.code===n.code&&e.version===n.version&&gi(e.multihash,n.multihash)}toString(e){return xi(this,e)}toJSON(){return{"/":xi(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let r=e;if(r instanceof M)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:o,multihash:i,bytes:s}=r;return new M(n,o,i,s||vi(n,o,i.bytes))}else if(r[Hd]===!0){let{version:n,multihash:o,code:i}=r,s=mi(o);return M.create(n,i,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(r!==Sr)throw new Error(`Version 0 CID must use dag-pb (code: ${Sr}) block encoding`);return new M(e,r,n,n.bytes)}case 1:{let o=vi(e,r,n.bytes);return new M(e,r,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return M.create(0,Sr,e)}static createV1(e,r){return M.create(1,e,r)}static decode(e){let[r,n]=M.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=M.inspectBytes(e),n=r.size-r.multihashSize,o=re(e.subarray(n,n+r.multihashSize));if(o.byteLength!==r.multihashSize)throw new Error("Incorrect length");let i=o.subarray(r.multihashSize-r.digestSize),s=new sr(r.multihashCode,r.digestSize,i,o);return[r.version===0?M.createV0(s):M.createV1(r.codec,s),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[d,l]=Cr(e.subarray(r));return r+=l,d},o=n(),i=Sr;if(o===18?(o=0,r=0):i=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let s=r,a=n(),g=n(),w=r+g,p=w-s;return{version:o,codec:i,multihashCode:a,digestSize:g,multihashSize:p,size:w}}static parse(e,r){let[n,o]=jd(e,r),i=M.decode(o);if(i.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return gn(i).set(n,e),i}},jd=(t,e)=>{switch(t[0]){case"Q":{let r=e||me;return[me.prefix,r.decode(`${me.prefix}${t}`)]}case me.prefix:{let r=e||me;return[me.prefix,r.decode(t)]}case nr.prefix:{let r=e||nr;return[nr.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}},Kd=(t,e,r)=>{let{prefix:n}=r;if(n!==me.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let o=e.get(n);if(o==null){let i=r.encode(t).slice(1);return e.set(n,i),i}else return o},Gd=(t,e,r)=>{let{prefix:n}=r,o=e.get(n);if(o==null){let i=r.encode(t);return e.set(n,i),i}else return o},Sr=112,Xd=18,vi=(t,e,r)=>{let n=ir(t),o=n+ir(e),i=new Uint8Array(o+r.byteLength);return or(t,i,0),or(e,i,n),i.set(r,o),i},Hd=Symbol.for("@ipld/js-cid/CID");var yn={...Wt,...Zt,...en,...rn,...tn,...nn,...on,...sn,...cn,...an},fp={...pn,...mn};function cr(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function Kr(t=0){return globalThis.Buffer?.allocUnsafe!=null?cr(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function Ci(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var fi=Ci("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),wn=Ci("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);let e=Kr(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),Yd={utf8:fi,"utf-8":fi,hex:yn.base16,latin1:wn,ascii:wn,binary:wn,...yn},Gr=Yd;function X(t,e="utf8"){let r=Gr[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):r.encoder.encode(t).substring(1)}var jn=Te(Xr(),1);function Ue(t,e){e==null&&(e=t.reduce((o,i)=>o+i.length,0));let r=Kr(e),n=0;for(let o of t)r.set(o,n),n+=o.length;return cr(r)}var ar=Te(Xr(),1);var Hr=class{index=0;input="";new(e){return this.index=0,this.input=e,this}readAtomically(e){let r=this.index,n=e();return n===void 0&&(this.index=r),n}parseWith(e){let r=e();if(this.index===this.input.length)return r}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(e){return this.readAtomically(()=>{let r=this.readChar();if(r===e)return r})}readSeparator(e,r,n){return this.readAtomically(()=>{if(!(r>0&&this.readGivenChar(e)===void 0))return n()})}readNumber(e,r,n,o){return this.readAtomically(()=>{let i=0,s=0,a=this.peekChar();if(a===void 0)return;let g=a==="0",w=2**(8*o)-1;for(;;){let p=this.readAtomically(()=>{let d=this.readChar();if(d===void 0)return;let l=Number.parseInt(d,e);if(!Number.isNaN(l))return l});if(p===void 0)break;if(i*=e,i+=p,i>w||(s+=1,r!==void 0&&s>r))return}if(s!==0)return!n&&g&&s>1?void 0:i})}readIPv4Addr(){return this.readAtomically(()=>{let e=new Uint8Array(4);for(let r=0;r<e.length;r++){let n=this.readSeparator(".",r,()=>this.readNumber(10,3,!1,1));if(n===void 0)return;e[r]=n}return e})}readIPv6Addr(){let e=r=>{for(let n=0;n<r.length/2;n++){let o=n*2;if(n<r.length-3){let s=this.readSeparator(":",n,()=>this.readIPv4Addr());if(s!==void 0)return r[o]=s[0],r[o+1]=s[1],r[o+2]=s[2],r[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];r[o]=i>>8,r[o+1]=i&255}return[r.length,!1]};return this.readAtomically(()=>{let r=new Uint8Array(16),[n,o]=e(r);if(n===16)return r;if(o||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let i=new Uint8Array(14),s=16-(n+2),[a]=e(i.subarray(0,s));return r.set(i.subarray(0,a),16-a),r})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var Vp=new Hr;var Yp=parseInt("0xFFFF",16),Jp=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);var En={};O(En,{identity:()=>ml});var ml=Qe({prefix:"\0",name:"identity",encode:t=>Ho(t),decode:t=>Xo(t)});var vn={};O(vn,{base2:()=>gl});var gl=D({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var fn={};O(fn,{base8:()=>yl});var yl=D({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Cn={};O(Cn,{base10:()=>wl});var wl=De({prefix:"9",name:"base10",alphabet:"0123456789"});var In={};O(In,{base16:()=>bl,base16upper:()=>xl});var bl=D({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),xl=D({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Sn={};O(Sn,{base36:()=>El,base36upper:()=>vl});var El=De({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),vl=De({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var An={};O(An,{base64:()=>fl,base64pad:()=>Cl,base64url:()=>Il,base64urlpad:()=>Sl});var fl=D({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Cl=D({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Il=D({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Sl=D({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Un={};O(Un,{base256emoji:()=>Ll});var Ri=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}"),Al=Ri.reduce((t,e,r)=>(t[r]=e,t),[]),Ul=Ri.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Ol(t){return t.reduce((e,r)=>(e+=Al[r],e),"")}function Tl(t){let e=[];for(let r of t){let n=Ul[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var Ll=Qe({prefix:"\u{1F680}",name:"base256emoji",encode:Ol,decode:Tl});var Bn={};O(Bn,{sha256:()=>Bl,sha512:()=>Nl});var Ln=Te(te("crypto"),1);var Tn=({name:t,code:e,encode:r})=>new On(t,e,r),On=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?ze(this.code,r):r.then(n=>ze(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Bl=Tn({name:"sha2-256",code:18,encode:t=>ee(Ln.default.createHash("sha256").update(t).digest())}),Nl=Tn({name:"sha2-512",code:19,encode:t=>ee(Ln.default.createHash("sha512").update(t).digest())});var Nn={};O(Nn,{identity:()=>Rl});var Mi=0,Pl="identity",ki=ee,Dl=t=>ze(Mi,ki(t)),Rl={code:Mi,name:Pl,encode:ki,digest:Dl};var Pm=new TextEncoder,Dm=new TextDecoder;var zi={...En,...vn,...fn,...Cn,...In,...Gt,...Sn,...jt,...An,...Un},zm={...Bn,...Nn};function Pn(t,e="utf8"){let r=Gr[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?cr(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var ge=Te(Xr(),1);var Fe=te("node:net");function Yr(t){return!!(0,Fe.isIP)(t)}var _i=Fe.isIPv4,kl=Fe.isIPv6,Dn=function(t){let e=0;if(t=t.toString().trim(),_i(t)){let r=new Uint8Array(e+4);return t.split(/\./g).forEach(n=>{r[e++]=parseInt(n,10)&255}),r}if(kl(t)){let r=t.split(":",8),n;for(n=0;n<r.length;n++){let i=_i(r[n]),s;i&&(s=Dn(r[n]),r[n]=X(s.slice(0,2),"base16")),s!=null&&++n<8&&r.splice(n,0,X(s.slice(2,4),"base16"))}if(r[0]==="")for(;r.length<8;)r.unshift("0");else if(r[r.length-1]==="")for(;r.length<8;)r.push("0");else if(r.length<8){for(n=0;n<r.length&&r[n]!=="";n++);let i=[n,1];for(n=9-r.length;n>0;n--)i.push("0");r.splice.apply(r,i)}let o=new Uint8Array(e+16);for(n=0;n<r.length;n++){let i=parseInt(r[n],16);o[e++]=i>>8&255,o[e++]=i&255}return o}throw new Error("invalid ip address")},Vi=function(t,e=0,r){e=~~e,r=r??t.length-e;let n=new DataView(t.buffer);if(r===4){let o=[];for(let i=0;i<r;i++)o.push(t[e+i]);return o.join(".")}if(r===16){let o=[];for(let i=0;i<r;i+=2)o.push(n.getUint16(e+i).toString(16));return o.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var Ar={},Rn={},_l=[[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"]];_l.forEach(t=>{let e=Vl(...t);Rn[e.code]=e,Ar[e.name]=e});function Vl(t,e,r,n,o){return{code:t,size:e,name:r,resolvable:!!n,path:!!o}}function L(t){if(typeof t=="number"){if(Rn[t]!=null)return Rn[t];throw new Error(`no protocol with code: ${t}`)}else if(typeof t=="string"){if(Ar[t]!=null)return Ar[t];throw new Error(`no protocol with name: ${t}`)}throw new Error(`invalid protocol id type: ${typeof t}`)}var og=L("ip4"),ig=L("ip6"),sg=L("ipcidr");function Gi(t,e){switch(L(t).code){case 4:case 41:return $l(e);case 42:return ji(e);case 6:case 273:case 33:case 132:return Hi(e).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return ji(e);case 421:return Xl(e);case 444:return Ki(e);case 445:return Ki(e);case 466:return Gl(e);default:return X(e,"base16")}}function Xi(t,e){switch(L(t).code){case 4:return qi(e);case 41:return qi(e);case 42:return $i(e);case 6:case 273:case 33:case 132:return Mn(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return $i(e);case 421:return jl(e);case 444:return Hl(e);case 445:return Yl(e);case 466:return Kl(e);default:return Pn(e,"base16")}}var Fn=Object.values(zi).map(t=>t.decoder),ql=function(){let t=Fn[0].or(Fn[1]);return Fn.slice(2).forEach(e=>t=t.or(e)),t}();function qi(t){if(!Yr(t))throw new Error("invalid ip address");return Dn(t)}function $l(t){let e=Vi(t,0,t.length);if(e==null)throw new Error("ipBuff is required");if(!Yr(e))throw new Error("invalid ip address");return e}function Mn(t){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,t),new Uint8Array(e)}function Hi(t){return new DataView(t.buffer).getUint16(t.byteOffset)}function $i(t){let e=Pn(t),r=Uint8Array.from(ge.default.encode(e.length));return Ue([r,e],r.length+e.length)}function ji(t){let e=ge.default.decode(t);if(t=t.slice(ge.default.decode.bytes),t.length!==e)throw new Error("inconsistent lengths");return X(t)}function jl(t){let e;t[0]==="Q"||t[0]==="1"?e=$r(G.decode(`z${t}`)).bytes:e=B.parse(t).multihash.bytes;let r=Uint8Array.from(ge.default.encode(e.length));return Ue([r,e],r.length+e.length)}function Kl(t){let e=ql.decode(t),r=Uint8Array.from(ge.default.encode(e.length));return Ue([r,e],r.length+e.length)}function Gl(t){let e=ge.default.decode(t),r=t.slice(ge.default.decode.bytes);if(r.length!==e)throw new Error("inconsistent lengths");return"u"+X(r,"base64url")}function Xl(t){let e=ge.default.decode(t),r=t.slice(ge.default.decode.bytes);if(r.length!==e)throw new Error("inconsistent lengths");return X(r,"base58btc")}function Hl(t){let e=t.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==16)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion address.`);let r=Ae.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=Mn(n);return Ue([r,o],r.length+o.length)}function Yl(t){let e=t.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==56)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion3 address.`);let r=Ae.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=Mn(n);return Ue([r,o],r.length+o.length)}function Ki(t){let e=t.slice(0,t.length-2),r=t.slice(t.length-2),n=X(e,"base32"),o=Hi(r);return`${n}:${o}`}function Jl(t){let e=[],r=t.split("/").slice(1);if(r.length===1&&r[0]==="")return[];for(let n=0;n<r.length;n++){let o=r[n],i=L(o);if(i.size===0){e.push([o]);continue}if(n++,n>=r.length)throw Ji("invalid address: "+t);if(i.path===!0){e.push([o,qn(r.slice(n).join("/"))]);break}e.push([o,r[n]])}return e}function Ql(t){let e=[];return t.map(r=>{let n=Wr(r);return e.push(n.name),r.length>1&&r[1]!=null&&e.push(r[1]),null}),qn(e.join("/"))}function Wl(t){return t.map(e=>{Array.isArray(e)||(e=[e]);let r=Wr(e);return e.length>1?[r.code,Xi(r.code,e[1])]:[r.code]})}function kn(t){return t.map(e=>{let r=Wr(e);return e[1]!=null?[r.code,Gi(r.code,e[1])]:[r.code]})}function zn(t){return Qr(Ue(t.map(e=>{let r=Wr(e),n=Uint8Array.from(ar.default.encode(r.code));return e.length>1&&e[1]!=null&&(n=Ue([n,e[1]])),n})))}function _n(t,e){return t.size>0?t.size/8:t.size===0?0:ar.default.decode(e)+(ar.default.decode.bytes??0)}function Jr(t){let e=[],r=0;for(;r<t.length;){let n=ar.default.decode(t,r),o=ar.default.decode.bytes??0,i=L(n),s=_n(i,t.slice(r+o));if(s===0){e.push([n]),r+=o;continue}let a=t.slice(r+o,r+o+s);if(r+=s+o,r>t.length)throw Ji("Invalid address Uint8Array: "+X(t,"base16"));e.push([n,a])}return e}function Vn(t){let e=Jr(t),r=kn(e);return Ql(r)}function Zl(t){t=qn(t);let e=Jl(t),r=Wl(e);return zn(r)}function Yi(t){return Zl(t)}function Qr(t){let e=eu(t);if(e!=null)throw e;return Uint8Array.from(t)}function eu(t){try{Jr(t)}catch(e){return e}}function qn(t){return"/"+t.trim().split("/").filter(e=>e).join("/")}function Ji(t){return new Error("Error parsing address: "+t)}function Wr(t){return L(t[0])}var tu=Symbol.for("nodejs.util.inspect.custom"),nu=[L("dns").code,L("dns4").code,L("dns6").code,L("dnsaddr").code],ou=new Map,Qi=Symbol.for("@multiformats/js-multiaddr/multiaddr");function iu(t){return!!t?.[Qi]}var Oe=class{bytes;#e;#t;#n;#r;[Qi]=!0;constructor(e){if(e==null&&(e=""),e instanceof Uint8Array)this.bytes=Qr(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);this.bytes=Yi(e)}else if(iu(e))this.bytes=Qr(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return this.#e==null&&(this.#e=Vn(this.bytes)),this.#e}toJSON(){return this.toString()}toOptions(){let e,r,n,o,i="",s=L("tcp"),a=L("udp"),g=L("ip4"),w=L("ip6"),p=L("dns6"),d=L("ip6zone");for(let[u,c]of this.stringTuples())u===d.code&&(i=`%${c??""}`),nu.includes(u)&&(r=s.name,o=443,n=`${c??""}${i}`,e=u===p.code?6:4),(u===s.code||u===a.code)&&(r=L(u).name,o=parseInt(c??"")),(u===g.code||u===w.code)&&(r=L(u).name,n=`${c??""}${i}`,e=u===w.code?6:4);if(e==null||r==null||n==null||o==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:n,transport:r,port:o}}protos(){return this.protoCodes().map(e=>Object.assign({},L(e)))}protoCodes(){let e=[],r=this.bytes,n=0;for(;n<r.length;){let o=jn.default.decode(r,n),i=jn.default.decode.bytes??0,s=L(o),a=_n(s,r.slice(n+i));n+=a+i,e.push(o)}return e}protoNames(){return this.protos().map(e=>e.name)}tuples(){return this.#t==null&&(this.#t=Jr(this.bytes)),this.#t}stringTuples(){return this.#n==null&&(this.#n=kn(this.tuples())),this.#n}encapsulate(e){return e=new Oe(e),new Oe(this.toString()+e.toString())}decapsulate(e){let r=e.toString(),n=this.toString(),o=n.lastIndexOf(r);if(o<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${e.toString()}`);return new Oe(n.slice(0,o))}decapsulateCode(e){let r=this.tuples();for(let n=r.length-1;n>=0;n--)if(r[n][0]===e)return new Oe(zn(r.slice(0,n)));return this}getPeerId(){try{let r=this.stringTuples().filter(n=>n[0]===Ar.ipfs.code).pop();if(r?.[1]!=null){let n=r[1];return n[0]==="Q"||n[0]==="1"?X(G.decode(`z${n}`),"base58btc"):X(B.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){if(this.#r===void 0)try{this.#r=this.stringTuples().filter(e=>L(e[0]).path===!0)[0][1],this.#r==null&&(this.#r=null)}catch{this.#r=null}return this.#r}equals(e){return mr(this.bytes,e.bytes)}async resolve(e){let r=this.protos().find(i=>i.resolvable);if(r==null)return[this];let n=ou.get(r.name);if(n==null)throw new Vr(`no available resolver for ${r.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,e)).map(i=>new Oe(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 r=(e??this).protos();return!(r.length!==2||r[0].code!==4&&r[0].code!==41||r[1].code!==6&&r[1].code!==273)}[tu](){return`Multiaddr(${Vn(this.bytes)})`}};function $n(t){return new Oe(t)}var Ur=Rr("libp2p:mdns:query");function Wi(t,e,r){let n=()=>{Ur("query",e),t.query({questions:[{name:e,type:"PTR"}]})};return n(),setInterval(n,r)}function Zi(t,e,r){if(t.answers==null)return;let n,o=[];if(t.answers.forEach(i=>{switch(i.type){case"PTR":n=i;break;case"TXT":o.push(i);break;default:break}}),!(n==null||n?.name!==r||o.length===0||n.data.startsWith(e)))try{let i=o.flatMap(a=>a.data).filter(a=>a.toString().startsWith("dnsaddr=")).map(a=>$n(a.toString().substring(8))),s=i[0].getPeerId();if(s==null)throw new Error("Multiaddr doesn't contain PeerId");return Ur("peer found %p",s),{id:zt(s),multiaddrs:i,protocols:[]}}catch(i){Ur.error("failed to parse mdns response",i)}}function es(t,e,r,n,o,i){if(!i){Ur("not responding to mDNS query as broadcast mode is false");return}if(n.length!==0&&t.questions[0]!=null&&t.questions[0].name===o){let s=[];s.push({name:o,type:"PTR",class:"IN",ttl:120,data:r+"."+o}),n.forEach(a=>{a.getPeerId()!=null&&s.push({name:r+"."+o,type:"TXT",class:"IN",ttl:120,data:"dnsaddr="+a.toString()})}),Ur("responding to query"),e.respond(s)}}function rs(t){let e="",r="abcdefghijklmnopqrstuvwxyz0123456789";for(let n=0;n<t;n++)e+=r.charAt(Math.floor(Math.random()*r.length));return e}var Zr=Rr("libp2p:mdns"),Kn=class extends Tr{mdns;broadcast;interval;serviceTag;peerName;port;ip;_queryInterval;components;constructor(e,r={}){if(super(),this.broadcast=r.broadcast!==!1,this.interval=r.interval??1e3*10,this.serviceTag=r.serviceTag??"_p2p._udp.local",this.ip=r.ip??"224.0.0.251",this.peerName=r.peerName??rs(63),this.peerName.length>=64)throw new Error("Peer name should be less than 64 chars long");this.port=r.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)}[Xn]=this;[Symbol.toStringTag]="@libp2p/mdns";isStarted(){return!!this.mdns}async start(){this.mdns==null&&(this.mdns=(0,ts.default)({port:this.port,ip:this.ip}),this.mdns.on("query",this._onMdnsQuery),this.mdns.on("response",this._onMdnsResponse),this._queryInterval=Wi(this.mdns,this.serviceTag,this.interval))}_onMdnsQuery(e){this.mdns!=null&&(Zr.trace("received incoming mDNS query"),es(e,this.mdns,this.peerName,this.components.addressManager.getAddresses(),this.serviceTag,this.broadcast))}_onMdnsResponse(e){Zr.trace("received mDNS query response");try{let r=Zi(e,this.peerName,this.serviceTag);r!=null&&(Zr("discovered peer in mDNS query response %p",r.id),this.dispatchEvent(new Lr("peer",{detail:r})))}catch(r){Zr.error("Error processing peer response",r)}}_onPeer(e){this.mdns!=null&&this.dispatchEvent(new Lr("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 cu(t={}){return e=>new Kn(e,t)}return as(au);})();
4
+ `+i),r.push(o+"m+"+Br.exports.humanize(this.diff)+"\x1B[0m")}else r[0]=Us()+e+" "+r[0]}function Us(){return F.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Os(...r){return process.stderr.write(Dr.format(...r)+`
5
+ `)}function Ts(r){r?process.env.DEBUG=r:delete process.env.DEBUG}function Ls(){return process.env.DEBUG}function Ds(r){r.inspectOpts={};let e=Object.keys(F.inspectOpts);for(let t=0;t<e.length;t++)r.inspectOpts[e[t]]=F.inspectOpts[e[t]]}Br.exports=et()(F);var{formatters:to}=Br.exports;to.o=function(r){return this.inspectOpts.colors=this.useColors,Dr.inspect(r,this.inspectOpts).split(`
6
+ `).map(e=>e.trim()).join(" ")};to.O=function(r){return this.inspectOpts.colors=this.useColors,Dr.inspect(r,this.inspectOpts)}});var oo=P((gu,tt)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?tt.exports=Qn():tt.exports=no()});var ho=P(ut=>{"use strict";ut.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};ut.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 po=P(ht=>{"use strict";ht.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};ht.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 mo=P(pt=>{"use strict";pt.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};pt.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 go=P(mt=>{"use strict";mt.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};mt.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 yo=P(gt=>{"use strict";gt.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}`};gt.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 xo=P((bo,yt)=>{var wo=function(r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.decode=d,r.encode=p,r.familyOf=w,r.name=void 0,r.sizeOf=g,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:l=>e.test(l),encode(l,u,c){c=~~c,u=u||new Uint8Array(c+t);let h=l.length,y=0;for(let E=0;E<h;){let v=l.charCodeAt(E++);v===46?(u[c++]=y,y=0):y=y*10+(v-48)}return u[c]=y,u},decode(l,u){return u=~~u,`${l[u++]}.${l[u++]}.${l[u++]}.${l[u]}`}};r.v4=i;let s={name:"v6",size:o,isFormat:l=>l.length>0&&n.test(l),encode(l,u,c){c=~~c;let h=c+o,y=-1,E=0,v=0,I=!0,f=!1;u=u||new Uint8Array(c+o);for(let C=0;C<l.length;C++){let S=l.charCodeAt(C);S===58?(I?y!==-1?(c<h&&(u[c]=0),c<h-1&&(u[c+1]=0),c+=2):c<h&&(y=c):(f===!0?(c<h&&(u[c]=v),c++):(c<h&&(u[c]=E>>8),c<h-1&&(u[c+1]=E&255),c+=2),E=0,v=0),I=!0,f=!1):S===46?(c<h&&(u[c]=v),c++,v=0,E=0,I=!1,f=!0):(I=!1,S>=97?S-=87:S>=65?S-=55:(S-=48,v=v*10+S),E=(E<<4)+S)}if(I===!1)f===!0?(c<h&&(u[c]=v),c++):(c<h&&(u[c]=E>>8),c<h-1&&(u[c+1]=E&255),c+=2);else if(y===0)c<h&&(u[c]=0),c<h-1&&(u[c+1]=0),c+=2;else if(y!==-1){c+=2;for(let C=Math.min(c-1,h-1);C>=y+2;C--)u[C]=u[C-2];u[y]=0,u[y+1]=0,y=c}if(y!==c&&y!==-1)for(c>h-2&&(c=h-2);h>y;)u[--h]=c<h&&c>y?u[--c]:0;else for(;c<h;)u[c++]=0;return u},decode(l,u){u=~~u;let c="";for(let h=0;h<o;h+=2)h!==0&&(c+=":"),c+=(l[u+h]<<8|l[u+h+1]).toString(16);return c.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}};r.v6=s;let a="ip";r.name=a;function g(l){if(i.isFormat(l))return i.size;if(s.isFormat(l))return s.size;throw Error(`Invalid ip address: ${l}`)}function w(l){return g(l)===i.size?1:2}function p(l,u,c){c=~~c;let h=g(l);return typeof u=="function"&&(u=u(c+h)),h===i.size?i.encode(l,u,c):s.encode(l,u,c)}function d(l,u,c){if(u=~~u,c=c||l.length-u,c===i.size)return i.decode(l,u,c);if(c===s.size)return s.decode(l,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 wo}):typeof yt=="object"&&typeof bo=="object"&&(yt.exports=wo)});var fo=P(b=>{"use strict";var x=Z("buffer").Buffer,fe=ho(),Js=po(),Qs=mo(),Rr=go(),wt=yo(),Re=xo(),Ws=0,Eo=32768,bt=32768,Zs=~bt,vo=32768,ec=~vo,m=b.name={};m.encode=function(r,e,t){e||(e=x.alloc(m.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 a=e.write(i[s],t+1);e[t]=a,t+=a+1}}return e[t++]=0,m.encode.bytes=t-n,e};m.encode.bytes=0;m.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 a=r[e++];if(i+=s?0:1,a===0)break;if(a&192)if((a&192)===192){if(e+1>r.length)throw new Error("Cannot decode name (buffer overflow)");let g=r.readUInt16BE(e-1)-49152;if(g>=n)throw new Error("Cannot decode name (bad pointer)");e=g,n=g,i+=s?0:1,s=!0}else throw new Error("Cannot decode name (bad label)");else{if(e+a>r.length)throw new Error("Cannot decode name (buffer overflow)");if(o+=a+1,o>254)throw new Error("Cannot decode name (name too long)");t.push(r.toString("utf-8",e,e+a)),e+=a,i+=s?0:a}}return m.decode.bytes=i,t.length===0?".":t.join(".")};m.decode.bytes=0;m.encodingLength=function(r){return r==="."||r===".."?1:x.byteLength(r.replace(/^\.|\.$/gm,""))+2};var A={};A.encode=function(r,e,t){e||(e=x.alloc(A.encodingLength(r))),t||(t=0);let n=e.write(r,t+1);return e[t]=n,A.encode.bytes=n+1,e};A.encode.bytes=0;A.decode=function(r,e){e||(e=0);let t=r[e],n=r.toString("utf-8",e+1,e+1+t);return A.decode.bytes=t+1,n};A.decode.bytes=0;A.encodingLength=function(r){return x.byteLength(r)+1};var ne={};ne.encode=function(r,e,t){e||(e=ne.encodingLength(r)),t||(t=0);let n=(r.flags||0)&32767,o=r.type==="response"?Eo:Ws;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};ne.encode.bytes=12;ne.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&Eo?"response":"query",flags:t&32767,flag_qr:(t>>15&1)===1,opcode:Qs.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:Js.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))}};ne.decode.bytes=12;ne.encodingLength=function(){return 12};var pe=b.unknown={};pe.encode=function(r,e,t){return e||(e=x.alloc(pe.encodingLength(r))),t||(t=0),e.writeUInt16BE(r.length,t),r.copy(e,t+2),pe.encode.bytes=r.length+2,e};pe.encode.bytes=0;pe.decode=function(r,e){e||(e=0);let t=r.readUInt16BE(e),n=r.slice(e+2,e+2+t);return pe.decode.bytes=t+2,n};pe.decode.bytes=0;pe.encodingLength=function(r){return r.length+2};var me=b.ns={};me.encode=function(r,e,t){return e||(e=x.alloc(me.encodingLength(r))),t||(t=0),m.encode(r,e,t+2),e.writeUInt16BE(m.encode.bytes,t),me.encode.bytes=m.encode.bytes+2,e};me.encode.bytes=0;me.decode=function(r,e){e||(e=0);let t=r.readUInt16BE(e),n=m.decode(r,e+2);return me.decode.bytes=t+2,n};me.decode.bytes=0;me.encodingLength=function(r){return m.encodingLength(r)+2};var ge=b.soa={};ge.encode=function(r,e,t){e||(e=x.alloc(ge.encodingLength(r))),t||(t=0);let n=t;return t+=2,m.encode(r.mname,e,t),t+=m.encode.bytes,m.encode(r.rname,e,t),t+=m.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),ge.encode.bytes=t-n,e};ge.encode.bytes=0;ge.decode=function(r,e){e||(e=0);let t=e,n={};return e+=2,n.mname=m.decode(r,e),e+=m.decode.bytes,n.rname=m.decode(r,e),e+=m.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,ge.decode.bytes=e-t,n};ge.decode.bytes=0;ge.encodingLength=function(r){return 22+m.encodingLength(r.mname)+m.encodingLength(r.rname)};var ye=b.txt={};ye.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]=x.from(r[o])),!x.isBuffer(r[o]))throw new Error("Must be a Buffer");e||(e=x.alloc(ye.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),ye.encode.bytes=t-n,e};ye.encode.bytes=0;ye.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 ye.decode.bytes=e-t,o};ye.decode.bytes=0;ye.encodingLength=function(r){Array.isArray(r)||(r=[r]);let e=2;return r.forEach(function(t){typeof t=="string"?e+=x.byteLength(t)+1:e+=t.length+1}),e};var we=b.null={};we.encode=function(r,e,t){e||(e=x.alloc(we.encodingLength(r))),t||(t=0),typeof r=="string"&&(r=x.from(r)),r||(r=x.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),we.encode.bytes=t-n,e};we.encode.bytes=0;we.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,we.decode.bytes=e-t,o};we.decode.bytes=0;we.encodingLength=function(r){return r?(x.isBuffer(r)?r.length:x.byteLength(r))+2:2};var be=b.hinfo={};be.encode=function(r,e,t){e||(e=x.alloc(be.encodingLength(r))),t||(t=0);let n=t;return t+=2,A.encode(r.cpu,e,t),t+=A.encode.bytes,A.encode(r.os,e,t),t+=A.encode.bytes,e.writeUInt16BE(t-n-2,n),be.encode.bytes=t-n,e};be.encode.bytes=0;be.decode=function(r,e){e||(e=0);let t=e,n={};return e+=2,n.cpu=A.decode(r,e),e+=A.decode.bytes,n.os=A.decode(r,e),e+=A.decode.bytes,be.decode.bytes=e-t,n};be.decode.bytes=0;be.encodingLength=function(r){return A.encodingLength(r.cpu)+A.encodingLength(r.os)+2};var re=b.ptr={},rc=b.cname=re,tc=b.dname=re;re.encode=function(r,e,t){return e||(e=x.alloc(re.encodingLength(r))),t||(t=0),m.encode(r,e,t+2),e.writeUInt16BE(m.encode.bytes,t),re.encode.bytes=m.encode.bytes+2,e};re.encode.bytes=0;re.decode=function(r,e){e||(e=0);let t=m.decode(r,e+2);return re.decode.bytes=m.decode.bytes+2,t};re.decode.bytes=0;re.encodingLength=function(r){return m.encodingLength(r)+2};var xe=b.srv={};xe.encode=function(r,e,t){e||(e=x.alloc(xe.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),m.encode(r.target,e,t+8);let n=m.encode.bytes+6;return e.writeUInt16BE(n,t),xe.encode.bytes=n+2,e};xe.encode.bytes=0;xe.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=m.decode(r,e+8),xe.decode.bytes=t+2,n};xe.decode.bytes=0;xe.encodingLength=function(r){return 8+m.encodingLength(r.target)};var X=b.caa={};X.ISSUER_CRITICAL=128;X.encode=function(r,e,t){let n=X.encodingLength(r);return e||(e=x.alloc(X.encodingLength(r))),t||(t=0),r.issuerCritical&&(r.flags=X.ISSUER_CRITICAL),e.writeUInt16BE(n-2,t),t+=2,e.writeUInt8(r.flags||0,t),t+=1,A.encode(r.tag,e,t),t+=A.encode.bytes,e.write(r.value,t),t+=x.byteLength(r.value),X.encode.bytes=n,e};X.encode.bytes=0;X.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=A.decode(r,e),e+=A.decode.bytes,o.value=r.toString("utf-8",e,n+t),o.issuerCritical=!!(o.flags&X.ISSUER_CRITICAL),X.decode.bytes=t+2,o};X.decode.bytes=0;X.encodingLength=function(r){return A.encodingLength(r.tag)+A.encodingLength(r.value)+2};var Oe=b.mx={};Oe.encode=function(r,e,t){e||(e=x.alloc(Oe.encodingLength(r))),t||(t=0);let n=t;return t+=2,e.writeUInt16BE(r.preference||0,t),t+=2,m.encode(r.exchange,e,t),t+=m.encode.bytes,e.writeUInt16BE(t-n-2,n),Oe.encode.bytes=t-n,e};Oe.encode.bytes=0;Oe.decode=function(r,e){e||(e=0);let t=e,n={};return e+=2,n.preference=r.readUInt16BE(e),e+=2,n.exchange=m.decode(r,e),e+=m.decode.bytes,Oe.decode.bytes=e-t,n};Oe.encodingLength=function(r){return 4+m.encodingLength(r.exchange)};var Ee=b.a={};Ee.encode=function(r,e,t){return e||(e=x.alloc(Ee.encodingLength(r))),t||(t=0),e.writeUInt16BE(4,t),t+=2,Re.v4.encode(r,e,t),Ee.encode.bytes=6,e};Ee.encode.bytes=0;Ee.decode=function(r,e){e||(e=0),e+=2;let t=Re.v4.decode(r,e);return Ee.decode.bytes=6,t};Ee.decode.bytes=0;Ee.encodingLength=function(){return 6};var ve=b.aaaa={};ve.encode=function(r,e,t){return e||(e=x.alloc(ve.encodingLength(r))),t||(t=0),e.writeUInt16BE(16,t),t+=2,Re.v6.encode(r,e,t),ve.encode.bytes=18,e};ve.encode.bytes=0;ve.decode=function(r,e){e||(e=0),e+=2;let t=Re.v6.decode(r,e);return ve.decode.bytes=18,t};ve.decode.bytes=0;ve.encodingLength=function(){return 18};var q=b.option={};q.encode=function(r,e,t){e||(e=x.alloc(q.encodingLength(r))),t||(t=0);let n=t,o=wt.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||Re.familyOf(r.ip),a=Re.encode(r.ip,x.alloc),g=Math.ceil(i/8);e.writeUInt16BE(g+4,t),t+=2,e.writeUInt16BE(s,t),t+=2,e.writeUInt8(i,t++),e.writeUInt8(r.scopePrefixLength||0,t++),a.copy(e,t,0,g),t+=g;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 w=r.length||0;e.writeUInt16BE(w,t),t+=2,e.fill(0,t,t+w),t+=w;break;case 14:let p=r.tags.length*2;e.writeUInt16BE(p,t),t+=2;for(let d of r.tags)e.writeUInt16BE(d,t),t+=2;break;default:throw new Error(`Unknown roption code: ${r.code}`)}return q.encode.bytes=t-n,e};q.encode.bytes=0;q.decode=function(r,e){e||(e=0);let t={};t.code=r.readUInt16BE(e),t.type=wt.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=x.alloc(t.family===1?4:16);r.copy(o,0,e,e+n-4),t.ip=Re.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 q.decode.bytes=n+4,t};q.decode.bytes=0;q.encodingLength=function(r){if(r.data)return r.data.length+4;switch(wt.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 Y=b.opt={};Y.encode=function(r,e,t){e||(e=x.alloc(Y.encodingLength(r))),t||(t=0);let n=t,o=je(r,q);return e.writeUInt16BE(o,t),t=cr(r,q,e,t+2),Y.encode.bytes=t-n,e};Y.encode.bytes=0;Y.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++]=q.decode(r,e),e+=q.decode.bytes,o-=q.decode.bytes;return Y.decode.bytes=e-t,n};Y.decode.bytes=0;Y.encodingLength=function(r){return 2+je(r||[],q)};var V=b.dnskey={};V.PROTOCOL_DNSSEC=3;V.ZONE_KEY=128;V.SECURE_ENTRYPOINT=32768;V.encode=function(r,e,t){e||(e=x.alloc(V.encodingLength(r))),t||(t=0);let n=t,o=r.key;if(!x.isBuffer(o))throw new Error("Key must be a Buffer");return t+=2,e.writeUInt16BE(r.flags,t),t+=2,e.writeUInt8(V.PROTOCOL_DNSSEC,t),t+=1,e.writeUInt8(r.algorithm,t),t+=1,o.copy(e,t,0,o.length),t+=o.length,V.encode.bytes=t-n,e.writeUInt16BE(V.encode.bytes-2,n),e};V.encode.bytes=0;V.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)!==V.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,V.decode.bytes=e-t,n};V.decode.bytes=0;V.encodingLength=function(r){return 6+x.byteLength(r.key)};var oe=b.rrsig={};oe.encode=function(r,e,t){e||(e=x.alloc(oe.encodingLength(r))),t||(t=0);let n=t,o=r.signature;if(!x.isBuffer(o))throw new Error("Signature must be a Buffer");return t+=2,e.writeUInt16BE(fe.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,m.encode(r.signersName,e,t),t+=m.encode.bytes,o.copy(e,t,0,o.length),t+=o.length,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;var n={},o=r.readUInt16BE(e);return e+=2,n.typeCovered=fe.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=m.decode(r,e),e+=m.decode.bytes,n.signature=r.slice(e,t+o+2),e+=n.signature.length,oe.decode.bytes=e-t,n};oe.decode.bytes=0;oe.encodingLength=function(r){return 20+m.encodingLength(r.signersName)+x.byteLength(r.signature)};var ie=b.rp={};ie.encode=function(r,e,t){e||(e=x.alloc(ie.encodingLength(r))),t||(t=0);let n=t;return t+=2,m.encode(r.mbox||".",e,t),t+=m.encode.bytes,m.encode(r.txt||".",e,t),t+=m.encode.bytes,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={};return e+=2,n.mbox=m.decode(r,e)||".",e+=m.decode.bytes,n.txt=m.decode(r,e)||".",e+=m.decode.bytes,ie.decode.bytes=e-t,n};ie.decode.bytes=0;ie.encodingLength=function(r){return 2+m.encodingLength(r.mbox||".")+m.encodingLength(r.txt||".")};var R={};R.encode=function(r,e,t){e||(e=x.alloc(R.encodingLength(r))),t||(t=0);let n=t;for(var o=[],i=0;i<r.length;i++){var s=fe.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 a=x.from(o[i]);e.writeUInt8(i,t),t+=1,e.writeUInt8(a.length,t),t+=1,a.copy(e,t),t+=a.length}return R.encode.bytes=t-n,e};R.encode.bytes=0;R.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 a=0;a<s;a++)for(var g=r.readUInt8(e+a),w=0;w<8;w++)if(g&1<<7-w){var p=fe.toString(i<<8|a<<3|w);o.push(p)}e+=s}return R.decode.bytes=e-n,o};R.decode.bytes=0;R.encodingLength=function(r){for(var e=[],t=0;t<r.length;t++){var n=fe.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 se=b.nsec={};se.encode=function(r,e,t){e||(e=x.alloc(se.encodingLength(r))),t||(t=0);let n=t;return t+=2,m.encode(r.nextDomain,e,t),t+=m.encode.bytes,R.encode(r.rrtypes,e,t),t+=R.encode.bytes,se.encode.bytes=t-n,e.writeUInt16BE(se.encode.bytes-2,n),e};se.encode.bytes=0;se.decode=function(r,e){e||(e=0);let t=e;var n={},o=r.readUInt16BE(e);return e+=2,n.nextDomain=m.decode(r,e),e+=m.decode.bytes,n.rrtypes=R.decode(r,e,o-(e-t)),e+=R.decode.bytes,se.decode.bytes=e-t,n};se.decode.bytes=0;se.encodingLength=function(r){return 2+m.encodingLength(r.nextDomain)+R.encodingLength(r.rrtypes)};var ce=b.nsec3={};ce.encode=function(r,e,t){e||(e=x.alloc(ce.encodingLength(r))),t||(t=0);let n=t,o=r.salt;if(!x.isBuffer(o))throw new Error("salt must be a Buffer");let i=r.nextDomain;if(!x.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,R.encode(r.rrtypes,e,t),t+=R.encode.bytes,ce.encode.bytes=t-n,e.writeUInt16BE(ce.encode.bytes-2,n),e};ce.encode.bytes=0;ce.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=R.decode(r,e,o-(e-t)),e+=R.decode.bytes,ce.decode.bytes=e-t,n};ce.decode.bytes=0;ce.encodingLength=function(r){return 8+r.salt.length+r.nextDomain.length+R.encodingLength(r.rrtypes)};var ae=b.ds={};ae.encode=function(r,e,t){e||(e=x.alloc(ae.encodingLength(r))),t||(t=0);let n=t,o=r.digest;if(!x.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,ae.encode.bytes=t-n,e.writeUInt16BE(ae.encode.bytes-2,n),e};ae.encode.bytes=0;ae.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,ae.decode.bytes=e-t,n};ae.decode.bytes=0;ae.encodingLength=function(r){return 6+x.byteLength(r.digest)};var H=b.sshfp={};H.getFingerprintLengthForHashType=function(e){switch(e){case 1:return 20;case 2:return 32}};H.encode=function(e,t,n){t||(t=x.alloc(H.encodingLength(e))),n||(n=0);let o=n;n+=2,t[n]=e.algorithm,n+=1,t[n]=e.hash,n+=1;let i=x.from(e.fingerprint.toUpperCase(),"hex");if(i.length!==H.getFingerprintLengthForHashType(e.hash))throw new Error("Invalid fingerprint length");return i.copy(t,n),n+=i.byteLength,H.encode.bytes=n-o,t.writeUInt16BE(H.encode.bytes-2,o),t};H.encode.bytes=0;H.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=H.getFingerprintLengthForHashType(o.hash);return o.fingerprint=e.slice(t,t+i).toString("hex").toUpperCase(),t+=i,H.decode.bytes=t-n,o};H.decode.bytes=0;H.encodingLength=function(r){return 4+x.from(r.fingerprint,"hex").byteLength};var de=b.naptr={};de.encode=function(r,e,t){e||(e=x.alloc(de.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,A.encode(r.flags,e,t),t+=A.encode.bytes,A.encode(r.services,e,t),t+=A.encode.bytes,A.encode(r.regexp,e,t),t+=A.encode.bytes,m.encode(r.replacement,e,t),t+=m.encode.bytes,de.encode.bytes=t-n,e.writeUInt16BE(de.encode.bytes-2,n),e};de.encode.bytes=0;de.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=A.decode(r,e),e+=A.decode.bytes,n.services=A.decode(r,e),e+=A.decode.bytes,n.regexp=A.decode(r,e),e+=A.decode.bytes,n.replacement=m.decode(r,e),e+=m.decode.bytes,de.decode.bytes=e-t,n};de.decode.bytes=0;de.encodingLength=function(r){return A.encodingLength(r.flags)+A.encodingLength(r.services)+A.encodingLength(r.regexp)+m.encodingLength(r.replacement)+6};var le=b.tlsa={};le.encode=function(r,e,t){e||(e=x.alloc(le.encodingLength(r))),t||(t=0);let n=t,o=r.certificate;if(!x.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,le.encode.bytes=t-n,e.writeUInt16BE(le.encode.bytes-2,n),e};le.encode.bytes=0;le.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,le.decode.bytes=e-t,n};le.decode.bytes=0;le.encodingLength=function(r){return 5+x.byteLength(r.certificate)};var xt=b.record=function(r){switch(r.toUpperCase()){case"A":return Ee;case"PTR":return re;case"CNAME":return rc;case"DNAME":return tc;case"TXT":return ye;case"NULL":return we;case"AAAA":return ve;case"SRV":return xe;case"HINFO":return be;case"CAA":return X;case"NS":return me;case"SOA":return ge;case"MX":return Oe;case"OPT":return Y;case"DNSKEY":return V;case"RRSIG":return oe;case"RP":return ie;case"NSEC":return se;case"NSEC3":return ce;case"SSHFP":return H;case"DS":return ae;case"NAPTR":return de;case"TLSA":return le}return pe},M=b.answer={};M.encode=function(r,e,t){e||(e=x.alloc(M.encodingLength(r))),t||(t=0);let n=t;if(m.encode(r.name,e,t),t+=m.encode.bytes,e.writeUInt16BE(fe.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,Y.encode(r.options||[],e,t),t+=Y.encode.bytes}else{let o=Rr.toClass(r.class===void 0?"IN":r.class);r.flush&&(o|=bt),e.writeUInt16BE(o,t+2),e.writeUInt32BE(r.ttl||0,t+4),t+=8;let i=xt(r.type);i.encode(r.data,e,t),t+=i.encode.bytes}return M.encode.bytes=t-n,e};M.encode.bytes=0;M.decode=function(r,e){e||(e=0);let t={},n=e;if(t.name=m.decode(r,e),e+=m.decode.bytes,t.type=fe.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=Y.decode(r,e+8),e+=8+Y.decode.bytes;else{let o=r.readUInt16BE(e+2);t.ttl=r.readUInt32BE(e+4),t.class=Rr.toString(o&Zs),t.flush=!!(o&bt);let i=xt(t.type);t.data=i.decode(r,e+8),e+=8+i.decode.bytes}return M.decode.bytes=e-n,t};M.decode.bytes=0;M.encodingLength=function(r){let e=r.data!==null&&r.data!==void 0?r.data:r.options;return m.encodingLength(r.name)+8+xt(r.type).encodingLength(e)};var te=b.question={};te.encode=function(r,e,t){e||(e=x.alloc(te.encodingLength(r))),t||(t=0);let n=t;return m.encode(r.name,e,t),t+=m.encode.bytes,e.writeUInt16BE(fe.toType(r.type),t),t+=2,e.writeUInt16BE(Rr.toClass(r.class===void 0?"IN":r.class),t),t+=2,te.encode.bytes=t-n,r};te.encode.bytes=0;te.decode=function(r,e){e||(e=0);let t=e,n={};return n.name=m.decode(r,e),e+=m.decode.bytes,n.type=fe.toString(r.readUInt16BE(e)),e+=2,n.class=Rr.toString(r.readUInt16BE(e)),e+=2,!!(n.class&vo)&&(n.class&=ec),te.decode.bytes=e-t,n};te.decode.bytes=0;te.encodingLength=function(r){return m.encodingLength(r.name)+4};b.AUTHORITATIVE_ANSWER=1024;b.TRUNCATED_RESPONSE=512;b.RECURSION_DESIRED=256;b.RECURSION_AVAILABLE=128;b.AUTHENTIC_DATA=32;b.CHECKING_DISABLED=16;b.DNSSEC_OK=32768;b.encode=function(r,e,t){let n=!e;n&&(e=x.alloc(b.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=[]),ne.encode(r,e,t),t+=ne.encode.bytes,t=cr(r.questions,te,e,t),t=cr(r.answers,M,e,t),t=cr(r.authorities,M,e,t),t=cr(r.additionals,M,e,t),b.encode.bytes=t-o,n&&b.encode.bytes!==e.length?e.slice(0,b.encode.bytes):e};b.encode.bytes=0;b.decode=function(r,e){e||(e=0);let t=e,n=ne.decode(r,e);return e+=ne.decode.bytes,e=Pr(n.questions,te,r,e),e=Pr(n.answers,M,r,e),e=Pr(n.authorities,M,r,e),e=Pr(n.additionals,M,r,e),b.decode.bytes=e-t,n};b.decode.bytes=0;b.encodingLength=function(r){return ne.encodingLength(r)+je(r.questions||[],te)+je(r.answers||[],M)+je(r.authorities||[],M)+je(r.additionals||[],M)};b.streamEncode=function(r){let e=b.encode(r),t=x.alloc(2);t.writeUInt16BE(e.byteLength);let n=x.concat([t,e]);return b.streamEncode.bytes=n.byteLength,n};b.streamEncode.bytes=0;b.streamDecode=function(r){let e=r.readUInt16BE(0);if(r.byteLength<e+2)return null;let t=b.decode(r.slice(2));return b.streamDecode.bytes=b.decode.bytes,t};b.streamDecode.bytes=0;function je(r,e){let t=0;for(let n=0;n<r.length;n++)t+=e.encodingLength(r[n]);return t}function cr(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 Pr(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 So=P((Pu,Io)=>{"use strict";var Co=ac;process.nextTick(cc,42);Io.exports=nc;function nc(r){var e=n;return t;function t(o){e(o||ic)}function n(o){var i=[o];e=s,r(a);function s(g){i.push(g)}function a(g){var w=arguments;for(e=oc(g)?n:p;i.length;)p(i.shift());function p(d){Co(sc,d,w)}}}}function oc(r){return Object.prototype.toString.call(r)==="[object Error]"}function ic(){}function sc(r,e){r.apply(null,e)}function cc(r){r===42&&(Co=process.nextTick)}function ac(r,e,t){process.nextTick(function(){r(e,t)})}});var Oo=P((Ru,Uo)=>{var Et=fo(),dc=Z("dgram"),lc=So(),uc=Z("events"),ft=Z("os"),vt=function(){};Uo.exports=function(r){r||(r={});var e=new uc.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={},a=!1,g=null;if(n==="udp6"&&(!o||!r.interface))throw new Error("For IPv6 multicast you must specify `ip` and `interface`");var w=r.socket||dc.createSocket({type:n,reuseAddr:r.reuseAddr!==!1,toString:function(){return n}});w.on("error",function(d){d.code==="EACCES"||d.code==="EADDRINUSE"?e.emit("error",d):e.emit("warning",d)}),w.on("message",function(d,l){try{d=Et.decode(d)}catch(u){e.emit("warning",u);return}e.emit("packet",d,l),d.type==="query"&&e.emit("query",d,l),d.type==="response"&&e.emit("response",d,l)}),w.on("listening",function(){t||(t=i.port=w.address().port),r.multicast!==!1&&(e.update(),g=setInterval(e.update,5e3),w.setMulticastTTL(r.ttl||255),w.setMulticastLoopback(r.loopback!==!1))});var p=lc(function(d){if(!t||r.bind===!1)return d(null);w.once("error",d),w.bind(t,r.bind||r.interface,function(){w.removeListener("error",d),d(null)})});return p(function(d){if(d)return e.emit("error",d);e.emit("ready")}),e.send=function(d,l,u){if(typeof l=="function")return e.send(d,null,l);u||(u=vt),l?!l.host&&!l.address&&(l.address=i.address):l=i,p(c);function c(h){if(a)return u();if(h)return u(h);var y=Et.encode(d);w.send(y,0,y.length,l.port,l.address||l.host,u)}},e.response=e.respond=function(d,l,u){Array.isArray(d)&&(d={answers:d}),d.type="response",d.flags=(d.flags||0)|Et.AUTHORITATIVE_ANSWER,e.send(d,l,u)},e.query=function(d,l,u,c){if(typeof l=="function")return e.query(d,null,null,l);if(typeof l=="object"&&l&&l.port)return e.query(d,null,l,u);if(typeof u=="function")return e.query(d,l,null,u);c||(c=vt),typeof d=="string"&&(d=[{name:d,type:l||"ANY"}]),Array.isArray(d)&&(d={type:"query",questions:d}),d.type="query",e.send(d,u,c)},e.destroy=function(d){if(d||(d=vt),a)return process.nextTick(d);a=!0,clearInterval(g);for(var l in s)try{w.dropMembership(o,l)}catch{}s={},w.close(d)},e.update=function(){for(var d=r.interface?[].concat(r.interface):pc(),l=!1,u=0;u<d.length;u++){var c=d[u];if(!s[c])try{w.addMembership(o,c),s[c]=!0,l=!0}catch(h){e.emit("warning",h)}}if(l){if(w.setMulticastInterface)try{w.setMulticastInterface(r.interface||hc())}catch(h){e.emit("warning",h)}e.emit("networkInterface")}},e};function hc(){for(var r=ft.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(Ao(i.family)&&!i.internal)return ft.platform()==="darwin"&&e[t]==="en0"?i.address:"0.0.0.0"}return"127.0.0.1"}function pc(){for(var r=ft.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(Ao(s.family)){t.push(s.address);break}}return t}function Ao(r){return r===4||r==="IPv4"}});var Ai=P((Tp,Si)=>{Si.exports=wn;var Ii=128,Yd=127,Jd=~Yd,Qd=Math.pow(2,31);function wn(r,e,t){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw wn.bytes=0,new RangeError("Could not encode varint");e=e||[],t=t||0;for(var n=t;r>=Qd;)e[t++]=r&255|Ii,r/=128;for(;r&Jd;)e[t++]=r&255|Ii,r>>>=7;return e[t]=r|0,wn.bytes=t-n+1,e}});var Ti=P((Lp,Oi)=>{Oi.exports=bn;var Wd=128,Ui=127;function bn(r,n){var t=0,n=n||0,o=0,i=n,s,a=r.length;do{if(i>=a||o>49)throw bn.bytes=0,new RangeError("Could not decode varint");s=r[i++],t+=o<28?(s&Ui)<<o:(s&Ui)*Math.pow(2,o),o+=7}while(s>=Wd);return bn.bytes=i-n,t}});var Di=P((Dp,Li)=>{var Zd=Math.pow(2,7),el=Math.pow(2,14),rl=Math.pow(2,21),tl=Math.pow(2,28),nl=Math.pow(2,35),ol=Math.pow(2,42),il=Math.pow(2,49),sl=Math.pow(2,56),cl=Math.pow(2,63);Li.exports=function(r){return r<Zd?1:r<el?2:r<rl?3:r<tl?4:r<nl?5:r<ol?6:r<il?7:r<sl?8:r<cl?9:10}});var Gr=P((Bp,Bi)=>{Bi.exports={encode:Ai(),decode:Ti(),encodingLength:Di()}});var cu={};O(cu,{mdns:()=>su});var Ur=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 Or(e,t))}},Zr=class extends Event{detail;constructor(e,t){super(e,t),this.detail=t?.detail}},Or=globalThis.CustomEvent??Zr;var Xn=Symbol.for("@libp2p/peer-discovery");var G=Se(oo(),1);var ct={};O(ct,{base32:()=>Ue,base32hex:()=>_s,base32hexpad:()=>qs,base32hexpadupper:()=>$s,base32hexupper:()=>Vs,base32pad:()=>ks,base32padupper:()=>zs,base32upper:()=>Ms,base32z:()=>js});function Bs(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 a=r.length,g=r.charAt(0),w=Math.log(a)/Math.log(256),p=Math.log(256)/Math.log(a);function d(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 h=0,y=0,E=0,v=c.length;E!==v&&c[E]===0;)E++,h++;for(var I=(v-E)*p+1>>>0,f=new Uint8Array(I);E!==v;){for(var C=c[E],S=0,U=I-1;(C!==0||S<y)&&U!==-1;U--,S++)C+=256*f[U]>>>0,f[U]=C%a>>>0,C=C/a>>>0;if(C!==0)throw new Error("Non-zero carry");y=S,E++}for(var T=I-y;T!==I&&f[T]===0;)T++;for(var k=g.repeat(h);T<I;++T)k+=r.charAt(f[T]);return k}function l(c){if(typeof c!="string")throw new TypeError("Expected String");if(c.length===0)return new Uint8Array;var h=0;if(c[h]!==" "){for(var y=0,E=0;c[h]===g;)y++,h++;for(var v=(c.length-h)*w+1>>>0,I=new Uint8Array(v);c[h];){var f=t[c.charCodeAt(h)];if(f===255)return;for(var C=0,S=v-1;(f!==0||C<E)&&S!==-1;S--,C++)f+=a*I[S]>>>0,I[S]=f%256>>>0,f=f/256>>>0;if(f!==0)throw new Error("Non-zero carry");E=C,h++}if(c[h]!==" "){for(var U=v-E;U!==v&&I[U]===0;)U++;for(var T=new Uint8Array(y+(v-U)),k=y;U!==v;)T[k++]=I[U++];return T}}}function u(c){var h=l(c);if(h)return h;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:l,decode:u}}var Ns=Bs,Ps=Ns,io=Ps;var wu=new Uint8Array(0);var so=(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},J=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 co=r=>new TextEncoder().encode(r),ao=r=>new TextDecoder().decode(r);var nt=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")}},ot=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 uo(this,e)}},it=class{constructor(e){this.decoders=e}or(e){return uo(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`)}},uo=(r,e)=>new it({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),st=class{constructor(e,t,n,o){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new nt(e,t,n),this.decoder=new ot(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},$e=({name:r,prefix:e,encode:t,decode:n})=>new st(r,e,t,n),Ae=({prefix:r,name:e,alphabet:t})=>{let{encode:n,decode:o}=io(t,e);return $e({prefix:r,name:e,encode:n,decode:i=>J(o(i))})},Rs=(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),a=0,g=0,w=0;for(let p=0;p<i;++p){let d=o[r[p]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);g=g<<t|d,a+=t,a>=8&&(a-=8,s[w++]=255&g>>a)}if(a>=t||255&g<<8-a)throw new SyntaxError("Unexpected end of data");return s},Fs=(r,e,t)=>{let n=e[e.length-1]==="=",o=(1<<t)-1,i="",s=0,a=0;for(let g=0;g<r.length;++g)for(a=a<<8|r[g],s+=8;s>t;)s-=t,i+=e[o&a>>s];if(s&&(i+=e[o&a<<t-s]),n)for(;i.length*t&7;)i+="=";return i},D=({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>$e({prefix:e,name:r,encode(o){return Fs(o,n,t)},decode(o){return Rs(o,n,t,r)}});var Ue=D({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Ms=D({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ks=D({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),zs=D({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),_s=D({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Vs=D({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),qs=D({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),$s=D({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),js=D({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var at={};O(at,{base58btc:()=>_,base58flickr:()=>Ks});var _=Ae({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Ks=Ae({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var lt={};O(lt,{base64:()=>dt,base64pad:()=>Gs,base64url:()=>Xs,base64urlpad:()=>Hs});var dt=D({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Gs=D({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Xs=D({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Hs=D({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});G.default.formatters.b=r=>r==null?"undefined":_.baseEncode(r);G.default.formatters.t=r=>r==null?"undefined":Ue.baseEncode(r);G.default.formatters.m=r=>r==null?"undefined":dt.baseEncode(r);G.default.formatters.p=r=>r==null?"undefined":r.toString();G.default.formatters.c=r=>r==null?"undefined":r.toString();G.default.formatters.k=r=>r==null?"undefined":r.toString();G.default.formatters.a=r=>r==null?"undefined":r.toString();function Ys(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 Nr(r){let e=Ys(`${r}:trace`);return G.default.enabled(`${r}:trace`)&&G.default.names.map(t=>t.toString()).find(t=>t.includes(":trace"))!=null&&(e=(0,G.default)(`${r}:trace`)),Object.assign((0,G.default)(r),{error:(0,G.default)(`${r}:error`),trace:e})}var ts=Se(Oo(),1);var To=Symbol.for("@libp2p/peer-id");var Ct={};O(Ct,{identity:()=>mc});var mc=$e({prefix:"\0",name:"identity",encode:r=>ao(r),decode:r=>co(r)});var It={};O(It,{base2:()=>gc});var gc=D({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var St={};O(St,{base8:()=>yc});var yc=D({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var At={};O(At,{base10:()=>wc});var wc=Ae({prefix:"9",name:"base10",alphabet:"0123456789"});var Ut={};O(Ut,{base16:()=>bc,base16upper:()=>xc});var bc=D({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),xc=D({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Ot={};O(Ot,{base36:()=>Ec,base36upper:()=>vc});var Ec=Ae({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),vc=Ae({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Tt={};O(Tt,{base256emoji:()=>Ac});var Lo=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}"),fc=Lo.reduce((r,e,t)=>(r[t]=e,r),[]),Cc=Lo.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function Ic(r){return r.reduce((e,t)=>(e+=fc[t],e),"")}function Sc(r){let e=[];for(let t of r){let n=Cc[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}var Ac=$e({prefix:"\u{1F680}",name:"base256emoji",encode:Ic,decode:Sc});var Pt={};O(Pt,{sha256:()=>Mr,sha512:()=>Kc});var Nt=Se(Z("crypto"),1);var Uc=No,Do=128,Oc=127,Tc=~Oc,Lc=Math.pow(2,31);function No(r,e,t){e=e||[],t=t||0;for(var n=t;r>=Lc;)e[t++]=r&255|Do,r/=128;for(;r&Tc;)e[t++]=r&255|Do,r>>>=7;return e[t]=r|0,No.bytes=t-n+1,e}var Dc=Lt,Bc=128,Bo=127;function Lt(r,n){var t=0,n=n||0,o=0,i=n,s,a=r.length;do{if(i>=a)throw Lt.bytes=0,new RangeError("Could not decode varint");s=r[i++],t+=o<28?(s&Bo)<<o:(s&Bo)*Math.pow(2,o),o+=7}while(s>=Bc);return Lt.bytes=i-n,t}var Nc=Math.pow(2,7),Pc=Math.pow(2,14),Rc=Math.pow(2,21),Fc=Math.pow(2,28),Mc=Math.pow(2,35),kc=Math.pow(2,42),zc=Math.pow(2,49),_c=Math.pow(2,56),Vc=Math.pow(2,63),qc=function(r){return r<Nc?1:r<Pc?2:r<Rc?3:r<Fc?4:r<Mc?5:r<kc?6:r<zc?7:r<_c?8:r<Vc?9:10},$c={encode:Uc,decode:Dc,encodingLength:qc},jc=$c,ar=jc;var dr=(r,e=0)=>[ar.decode(r,e),ar.decode.bytes],Ke=(r,e,t=0)=>(ar.encode(r,e,t),e),Ge=r=>ar.encodingLength(r);var Te=(r,e)=>{let t=e.byteLength,n=Ge(r),o=n+Ge(t),i=new Uint8Array(o+t);return Ke(r,i,0),Ke(t,i,n),i.set(e,o),new Xe(r,t,e,i)},lr=r=>{let e=J(r),[t,n]=dr(e),[o,i]=dr(e.subarray(n)),s=e.subarray(n+i);if(s.byteLength!==o)throw new Error("Incorrect length");return new Xe(t,o,s,e)},Po=(r,e)=>{if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&so(r.bytes,t.bytes)}},Xe=class{constructor(e,t,n,o){this.code=e,this.size=t,this.digest=n,this.bytes=o}};var Bt=({name:r,code:e,encode:t})=>new Dt(r,e,t),Dt=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?Te(this.code,t):t.then(n=>Te(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Mr=Bt({name:"sha2-256",code:18,encode:r=>J(Nt.default.createHash("sha256").update(r).digest())}),Kc=Bt({name:"sha2-512",code:19,encode:r=>J(Nt.default.createHash("sha512").update(r).digest())});var Rt={};O(Rt,{identity:()=>kr});var Fo=0,Gc="identity",Mo=J,Xc=r=>Te(Fo,Mo(r)),kr={code:Fo,name:Gc,encode:Mo,digest:Xc};var Zu=new TextEncoder,eh=new TextDecoder;var ko=(r,e)=>{let{bytes:t,version:n}=r;switch(n){case 0:return Qc(t,Ft(r),e||_.encoder);default:return Wc(t,Ft(r),e||Ue.encoder)}};var zo=new WeakMap,Ft=r=>{let e=zo.get(r);if(e==null){let t=new Map;return zo.set(r,t),t}return e},Fe=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!==ur)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==Zc)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=Te(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&&Po(e.multihash,n.multihash)}toString(e){return ko(this,e)}toJSON(){return{"/":ko(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||_o(n,o,i.bytes))}else if(t[ea]===!0){let{version:n,multihash:o,code:i}=t,s=lr(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!==ur)throw new Error(`Version 0 CID must use dag-pb (code: ${ur}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let o=_o(e,t,n.bytes);return new r(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,ur,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=J(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 Xe(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[d,l]=dr(e.subarray(t));return t+=l,d},o=n(),i=ur;if(o===18?(o=0,t=0):i=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let s=t,a=n(),g=n(),w=t+g,p=w-s;return{version:o,codec:i,multihashCode:a,digestSize:g,multihashSize:p,size:w}}static parse(e,t){let[n,o]=Jc(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 Ft(i).set(n,e),i}},Jc=(r,e)=>{switch(r[0]){case"Q":{let t=e||_;return[_.prefix,t.decode(`${_.prefix}${r}`)]}case _.prefix:{let t=e||_;return[_.prefix,t.decode(r)]}case Ue.prefix:{let t=e||Ue;return[Ue.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)]}}},Qc=(r,e,t)=>{let{prefix:n}=t;if(n!==_.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},Wc=(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},ur=112,Zc=18,_o=(r,e,t)=>{let n=Ge(r),o=n+Ge(e),i=new Uint8Array(o+t.byteLength);return Ke(r,i,0),Ke(e,i,n),i.set(t,o),i},ea=Symbol.for("@ipld/js-cid/CID");var Mt={...Ct,...It,...St,...At,...Ut,...ct,...Ot,...at,...lt,...Tt},lh={...Pt,...Rt};function hr(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 ra=Symbol.for("nodejs.util.inspect.custom"),Vo=Object.values(Mt).map(r=>r.decoder).reduce((r,e)=>r.or(e),Mt.identity.decoder),qo=114,$o=36,jo=37,pr=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()})`}[To]=!0;toString(){return this.string==null&&(this.string=_.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return Fe.createV1(qo,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e instanceof Uint8Array)return hr(this.multihash.bytes,e);if(typeof e=="string")return kt(e).equals(this);if(e?.multihash?.bytes!=null)return hr(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[ra](){return`PeerId(${this.toString()})`}},mr=class extends pr{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},gr=class extends pr{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.multihash.digest}},yr=class extends pr{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.multihash.digest}};function kt(r,e){if(e=e??Vo,r.charAt(0)==="1"||r.charAt(0)==="Q"){let t=lr(_.decode(`z${r}`));return r.startsWith("12D")?new gr({multihash:t}):r.startsWith("16U")?new yr({multihash:t}):new mr({multihash:t})}return ta(Vo.decode(r))}function ta(r){try{let e=lr(r);if(e.code===kr.code){if(e.digest.length===$o)return new gr({multihash:e});if(e.digest.length===jo)return new yr({multihash:e})}if(e.code===Mr.code)return new mr({multihash:e})}catch{return na(Fe.decode(r))}throw new Error("Supplied PeerID CID is invalid")}function na(r){if(r==null||r.multihash==null||r.version==null||r.version===1&&r.code!==qo)throw new Error("Supplied PeerID CID is invalid");let e=r.multihash;if(e.code===Mr.code)return new mr({multihash:r.multihash});if(e.code===kr.code){if(e.digest.length===$o)return new gr({multihash:r.multihash});if(e.digest.length===jo)return new yr({multihash:r.multihash})}throw new Error("Supplied PeerID CID is invalid")}var zr=class extends Error{code;props;constructor(e,t,n){super(e),this.code=t,this.name=n?.name??"CodeError",this.props=n??{}}};var $t={};O($t,{base58btc:()=>$,base58flickr:()=>da});function oa(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 a=r.length,g=r.charAt(0),w=Math.log(a)/Math.log(256),p=Math.log(256)/Math.log(a);function d(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 h=0,y=0,E=0,v=c.length;E!==v&&c[E]===0;)E++,h++;for(var I=(v-E)*p+1>>>0,f=new Uint8Array(I);E!==v;){for(var C=c[E],S=0,U=I-1;(C!==0||S<y)&&U!==-1;U--,S++)C+=256*f[U]>>>0,f[U]=C%a>>>0,C=C/a>>>0;if(C!==0)throw new Error("Non-zero carry");y=S,E++}for(var T=I-y;T!==I&&f[T]===0;)T++;for(var k=g.repeat(h);T<I;++T)k+=r.charAt(f[T]);return k}function l(c){if(typeof c!="string")throw new TypeError("Expected String");if(c.length===0)return new Uint8Array;var h=0;if(c[h]!==" "){for(var y=0,E=0;c[h]===g;)y++,h++;for(var v=(c.length-h)*w+1>>>0,I=new Uint8Array(v);c[h];){var f=t[c.charCodeAt(h)];if(f===255)return;for(var C=0,S=v-1;(f!==0||C<E)&&S!==-1;S--,C++)f+=a*I[S]>>>0,I[S]=f%256>>>0,f=f/256>>>0;if(f!==0)throw new Error("Non-zero carry");E=C,h++}if(c[h]!==" "){for(var U=v-E;U!==v&&I[U]===0;)U++;for(var T=new Uint8Array(y+(v-U)),k=y;U!==v;)T[k++]=I[U++];return T}}}function u(c){var h=l(c);if(h)return h;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:l,decode:u}}var ia=oa,sa=ia,Ko=sa;var Sh=new Uint8Array(0);var Go=(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},Q=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 Xo=r=>new TextEncoder().encode(r),Ho=r=>new TextDecoder().decode(r);var zt=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")}},_t=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 Jo(this,e)}},Vt=class{constructor(e){this.decoders=e}or(e){return Jo(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`)}},Jo=(r,e)=>new Vt({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),qt=class{constructor(e,t,n,o){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new zt(e,t,n),this.decoder=new _t(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Ye=({name:r,prefix:e,encode:t,decode:n})=>new qt(r,e,t,n),Le=({prefix:r,name:e,alphabet:t})=>{let{encode:n,decode:o}=Ko(t,e);return Ye({prefix:r,name:e,encode:n,decode:i=>Q(o(i))})},ca=(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),a=0,g=0,w=0;for(let p=0;p<i;++p){let d=o[r[p]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);g=g<<t|d,a+=t,a>=8&&(a-=8,s[w++]=255&g>>a)}if(a>=t||255&g<<8-a)throw new SyntaxError("Unexpected end of data");return s},aa=(r,e,t)=>{let n=e[e.length-1]==="=",o=(1<<t)-1,i="",s=0,a=0;for(let g=0;g<r.length;++g)for(a=a<<8|r[g],s+=8;s>t;)s-=t,i+=e[o&a>>s];if(s&&(i+=e[o&a<<t-s]),n)for(;i.length*t&7;)i+="=";return i},B=({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>Ye({prefix:e,name:r,encode(o){return aa(o,n,t)},decode(o){return ca(o,n,t,r)}});var $=Le({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),da=Le({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var la=Zo,Qo=128,ua=127,ha=~ua,pa=Math.pow(2,31);function Zo(r,e,t){e=e||[],t=t||0;for(var n=t;r>=pa;)e[t++]=r&255|Qo,r/=128;for(;r&ha;)e[t++]=r&255|Qo,r>>>=7;return e[t]=r|0,Zo.bytes=t-n+1,e}var ma=jt,ga=128,Wo=127;function jt(r,n){var t=0,n=n||0,o=0,i=n,s,a=r.length;do{if(i>=a)throw jt.bytes=0,new RangeError("Could not decode varint");s=r[i++],t+=o<28?(s&Wo)<<o:(s&Wo)*Math.pow(2,o),o+=7}while(s>=ga);return jt.bytes=i-n,t}var ya=Math.pow(2,7),wa=Math.pow(2,14),ba=Math.pow(2,21),xa=Math.pow(2,28),Ea=Math.pow(2,35),va=Math.pow(2,42),fa=Math.pow(2,49),Ca=Math.pow(2,56),Ia=Math.pow(2,63),Sa=function(r){return r<ya?1:r<wa?2:r<ba?3:r<xa?4:r<Ea?5:r<va?6:r<fa?7:r<Ca?8:r<Ia?9:10},Aa={encode:la,decode:ma,encodingLength:Sa},Ua=Aa,wr=Ua;var br=(r,e=0)=>[wr.decode(r,e),wr.decode.bytes],Je=(r,e,t=0)=>(wr.encode(r,e,t),e),Qe=r=>wr.encodingLength(r);var Me=(r,e)=>{let t=e.byteLength,n=Qe(r),o=n+Qe(t),i=new Uint8Array(o+t);return Je(r,i,0),Je(t,i,n),i.set(e,o),new We(r,t,e,i)},Vr=r=>{let e=Q(r),[t,n]=br(e),[o,i]=br(e.subarray(n)),s=e.subarray(n+i);if(s.byteLength!==o)throw new Error("Incorrect length");return new We(t,o,s,e)},ei=(r,e)=>{if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&Go(r.bytes,t.bytes)}},We=class{constructor(e,t,n,o){this.code=e,this.size=t,this.digest=n,this.bytes=o}};var Kt={};O(Kt,{base32:()=>Ce,base32hex:()=>Da,base32hexpad:()=>Na,base32hexpadupper:()=>Pa,base32hexupper:()=>Ba,base32pad:()=>Ta,base32padupper:()=>La,base32upper:()=>Oa,base32z:()=>Ra});var Ce=B({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Oa=B({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Ta=B({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),La=B({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Da=B({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Ba=B({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Na=B({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Pa=B({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Ra=B({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var ri=(r,e)=>{let{bytes:t,version:n}=r;switch(n){case 0:return Ma(t,Gt(r),e||$.encoder);default:return ka(t,Gt(r),e||Ce.encoder)}};var ti=new WeakMap,Gt=r=>{let e=ti.get(r);if(e==null){let t=new Map;return ti.set(r,t),t}return e},De=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!==xr)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==za)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=Me(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&&ei(e.multihash,n.multihash)}toString(e){return ri(this,e)}toJSON(){return{"/":ri(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||ni(n,o,i.bytes))}else if(t[_a]===!0){let{version:n,multihash:o,code:i}=t,s=Vr(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!==xr)throw new Error(`Version 0 CID must use dag-pb (code: ${xr}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let o=ni(e,t,n.bytes);return new r(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,xr,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=Q(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 We(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[d,l]=br(e.subarray(t));return t+=l,d},o=n(),i=xr;if(o===18?(o=0,t=0):i=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let s=t,a=n(),g=n(),w=t+g,p=w-s;return{version:o,codec:i,multihashCode:a,digestSize:g,multihashSize:p,size:w}}static parse(e,t){let[n,o]=Fa(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 Gt(i).set(n,e),i}},Fa=(r,e)=>{switch(r[0]){case"Q":{let t=e||$;return[$.prefix,t.decode(`${$.prefix}${r}`)]}case $.prefix:{let t=e||$;return[$.prefix,t.decode(r)]}case Ce.prefix:{let t=e||Ce;return[Ce.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)]}}},Ma=(r,e,t)=>{let{prefix:n}=t;if(n!==$.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},ka=(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},xr=112,za=18,ni=(r,e,t)=>{let n=Qe(r),o=n+Qe(e),i=new Uint8Array(o+t.byteLength);return Je(r,i,0),Je(e,i,n),i.set(t,o),i},_a=Symbol.for("@ipld/js-cid/CID");var Qt={};O(Qt,{identity:()=>Ga});function Va(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 a=r.length,g=r.charAt(0),w=Math.log(a)/Math.log(256),p=Math.log(256)/Math.log(a);function d(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 h=0,y=0,E=0,v=c.length;E!==v&&c[E]===0;)E++,h++;for(var I=(v-E)*p+1>>>0,f=new Uint8Array(I);E!==v;){for(var C=c[E],S=0,U=I-1;(C!==0||S<y)&&U!==-1;U--,S++)C+=256*f[U]>>>0,f[U]=C%a>>>0,C=C/a>>>0;if(C!==0)throw new Error("Non-zero carry");y=S,E++}for(var T=I-y;T!==I&&f[T]===0;)T++;for(var k=g.repeat(h);T<I;++T)k+=r.charAt(f[T]);return k}function l(c){if(typeof c!="string")throw new TypeError("Expected String");if(c.length===0)return new Uint8Array;var h=0;if(c[h]!==" "){for(var y=0,E=0;c[h]===g;)y++,h++;for(var v=(c.length-h)*w+1>>>0,I=new Uint8Array(v);c[h];){var f=t[c.charCodeAt(h)];if(f===255)return;for(var C=0,S=v-1;(f!==0||C<E)&&S!==-1;S--,C++)f+=a*I[S]>>>0,I[S]=f%256>>>0,f=f/256>>>0;if(f!==0)throw new Error("Non-zero carry");E=C,h++}if(c[h]!==" "){for(var U=v-E;U!==v&&I[U]===0;)U++;for(var T=new Uint8Array(y+(v-U)),k=y;U!==v;)T[k++]=I[U++];return T}}}function u(c){var h=l(c);if(h)return h;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:l,decode:u}}var qa=Va,$a=qa,oi=$a;var _h=new Uint8Array(0);var ii=(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},W=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 si=r=>new TextEncoder().encode(r),ci=r=>new TextDecoder().decode(r);var Xt=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")}},Ht=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 di(this,e)}},Yt=class{constructor(e){this.decoders=e}or(e){return di(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`)}},di=(r,e)=>new Yt({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),Jt=class{constructor(e,t,n,o){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new Xt(e,t,n),this.decoder=new Ht(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},er=({name:r,prefix:e,encode:t,decode:n})=>new Jt(r,e,t,n),Be=({prefix:r,name:e,alphabet:t})=>{let{encode:n,decode:o}=oi(t,e);return er({prefix:r,name:e,encode:n,decode:i=>W(o(i))})},ja=(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),a=0,g=0,w=0;for(let p=0;p<i;++p){let d=o[r[p]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);g=g<<t|d,a+=t,a>=8&&(a-=8,s[w++]=255&g>>a)}if(a>=t||255&g<<8-a)throw new SyntaxError("Unexpected end of data");return s},Ka=(r,e,t)=>{let n=e[e.length-1]==="=",o=(1<<t)-1,i="",s=0,a=0;for(let g=0;g<r.length;++g)for(a=a<<8|r[g],s+=8;s>t;)s-=t,i+=e[o&a>>s];if(s&&(i+=e[o&a<<t-s]),n)for(;i.length*t&7;)i+="=";return i},N=({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>er({prefix:e,name:r,encode(o){return Ka(o,n,t)},decode(o){return ja(o,n,t,r)}});var Ga=er({prefix:"\0",name:"identity",encode:r=>ci(r),decode:r=>si(r)});var Wt={};O(Wt,{base2:()=>Xa});var Xa=N({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Zt={};O(Zt,{base8:()=>Ha});var Ha=N({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var en={};O(en,{base10:()=>Ya});var Ya=Be({prefix:"9",name:"base10",alphabet:"0123456789"});var rn={};O(rn,{base16:()=>Ja,base16upper:()=>Qa});var Ja=N({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Qa=N({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var tn={};O(tn,{base32:()=>rr,base32hex:()=>rd,base32hexpad:()=>nd,base32hexpadupper:()=>od,base32hexupper:()=>td,base32pad:()=>Za,base32padupper:()=>ed,base32upper:()=>Wa,base32z:()=>id});var rr=N({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Wa=N({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Za=N({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ed=N({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),rd=N({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),td=N({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),nd=N({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),od=N({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),id=N({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var nn={};O(nn,{base36:()=>sd,base36upper:()=>cd});var sd=Be({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),cd=Be({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var on={};O(on,{base58btc:()=>ue,base58flickr:()=>ad});var ue=Be({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),ad=Be({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var sn={};O(sn,{base64:()=>dd,base64pad:()=>ld,base64url:()=>ud,base64urlpad:()=>hd});var dd=N({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),ld=N({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),ud=N({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),hd=N({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var cn={};O(cn,{base256emoji:()=>wd});var li=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}"),pd=li.reduce((r,e,t)=>(r[t]=e,r),[]),md=li.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function gd(r){return r.reduce((e,t)=>(e+=pd[t],e),"")}function yd(r){let e=[];for(let t of r){let n=md[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}var wd=er({prefix:"\u{1F680}",name:"base256emoji",encode:gd,decode:yd});var hn={};O(hn,{sha256:()=>Fd,sha512:()=>Md});var un=Se(Z("crypto"),1);var bd=pi,ui=128,xd=127,Ed=~xd,vd=Math.pow(2,31);function pi(r,e,t){e=e||[],t=t||0;for(var n=t;r>=vd;)e[t++]=r&255|ui,r/=128;for(;r&Ed;)e[t++]=r&255|ui,r>>>=7;return e[t]=r|0,pi.bytes=t-n+1,e}var fd=an,Cd=128,hi=127;function an(r,n){var t=0,n=n||0,o=0,i=n,s,a=r.length;do{if(i>=a)throw an.bytes=0,new RangeError("Could not decode varint");s=r[i++],t+=o<28?(s&hi)<<o:(s&hi)*Math.pow(2,o),o+=7}while(s>=Cd);return an.bytes=i-n,t}var Id=Math.pow(2,7),Sd=Math.pow(2,14),Ad=Math.pow(2,21),Ud=Math.pow(2,28),Od=Math.pow(2,35),Td=Math.pow(2,42),Ld=Math.pow(2,49),Dd=Math.pow(2,56),Bd=Math.pow(2,63),Nd=function(r){return r<Id?1:r<Sd?2:r<Ad?3:r<Ud?4:r<Od?5:r<Td?6:r<Ld?7:r<Dd?8:r<Bd?9:10},Pd={encode:bd,decode:fd,encodingLength:Nd},Rd=Pd,Er=Rd;var vr=(r,e=0)=>[Er.decode(r,e),Er.decode.bytes],tr=(r,e,t=0)=>(Er.encode(r,e,t),e),nr=r=>Er.encodingLength(r);var ke=(r,e)=>{let t=e.byteLength,n=nr(r),o=n+nr(t),i=new Uint8Array(o+t);return tr(r,i,0),tr(t,i,n),i.set(e,o),new or(r,t,e,i)},mi=r=>{let e=W(r),[t,n]=vr(e),[o,i]=vr(e.subarray(n)),s=e.subarray(n+i);if(s.byteLength!==o)throw new Error("Incorrect length");return new or(t,o,s,e)},gi=(r,e)=>{if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&ii(r.bytes,t.bytes)}},or=class{constructor(e,t,n,o){this.code=e,this.size=t,this.digest=n,this.bytes=o}};var ln=({name:r,code:e,encode:t})=>new dn(r,e,t),dn=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?ke(this.code,t):t.then(n=>ke(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Fd=ln({name:"sha2-256",code:18,encode:r=>W(un.default.createHash("sha256").update(r).digest())}),Md=ln({name:"sha2-512",code:19,encode:r=>W(un.default.createHash("sha512").update(r).digest())});var pn={};O(pn,{identity:()=>_d});var wi=0,kd="identity",bi=W,zd=r=>ke(wi,bi(r)),_d={code:wi,name:kd,encode:bi,digest:zd};var ap=new TextEncoder,dp=new TextDecoder;var xi=(r,e)=>{let{bytes:t,version:n}=r;switch(n){case 0:return jd(t,mn(r),e||ue.encoder);default:return Kd(t,mn(r),e||rr.encoder)}};var Ei=new WeakMap,mn=r=>{let e=Ei.get(r);if(e==null){let t=new Map;return Ei.set(r,t),t}return e},$r=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!==Cr)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==Gd)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=ke(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&&gi(e.multihash,n.multihash)}toString(e){return xi(this,e)}toJSON(){return{"/":xi(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||vi(n,o,i.bytes))}else if(t[Xd]===!0){let{version:n,multihash:o,code:i}=t,s=mi(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!==Cr)throw new Error(`Version 0 CID must use dag-pb (code: ${Cr}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let o=vi(e,t,n.bytes);return new r(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,Cr,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=W(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 or(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[d,l]=vr(e.subarray(t));return t+=l,d},o=n(),i=Cr;if(o===18?(o=0,t=0):i=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let s=t,a=n(),g=n(),w=t+g,p=w-s;return{version:o,codec:i,multihashCode:a,digestSize:g,multihashSize:p,size:w}}static parse(e,t){let[n,o]=$d(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 mn(i).set(n,e),i}},$d=(r,e)=>{switch(r[0]){case"Q":{let t=e||ue;return[ue.prefix,t.decode(`${ue.prefix}${r}`)]}case ue.prefix:{let t=e||ue;return[ue.prefix,t.decode(r)]}case rr.prefix:{let t=e||rr;return[rr.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)]}}},jd=(r,e,t)=>{let{prefix:n}=t;if(n!==ue.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},Kd=(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},Cr=112,Gd=18,vi=(r,e,t)=>{let n=nr(r),o=n+nr(e),i=new Uint8Array(o+t.byteLength);return tr(r,i,0),tr(e,i,n),i.set(t,o),i},Xd=Symbol.for("@ipld/js-cid/CID");var gn={...Qt,...Wt,...Zt,...en,...rn,...tn,...nn,...on,...sn,...cn},xp={...hn,...pn};function ir(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function jr(r=0){return globalThis.Buffer?.allocUnsafe!=null?ir(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Ci(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var fi=Ci("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),yn=Ci("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=jr(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),Hd={utf8:fi,"utf-8":fi,hex:gn.base16,latin1:yn,ascii:yn,binary:yn,...gn},Kr=Hd;function j(r,e="utf8"){let t=Kr[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)}var $n=Se(Gr(),1);function Ie(r,e){e==null&&(e=r.reduce((o,i)=>o+i.length,0));let t=jr(e),n=0;for(let o of r)t.set(o,n),n+=o.length;return ir(t)}var sr=Se(Gr(),1);var Xr=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,a=this.peekChar();if(a===void 0)return;let g=a==="0",w=2**(8*o)-1;for(;;){let p=this.readAtomically(()=>{let d=this.readChar();if(d===void 0)return;let l=Number.parseInt(d,e);if(!Number.isNaN(l))return l});if(p===void 0)break;if(i*=e,i+=p,i>w||(s+=1,t!==void 0&&s>t))return}if(s!==0)return!n&&g&&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),[a]=e(i.subarray(0,s));return t.set(i.subarray(0,a),16-a),t})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var kp=new Xr;var Gp=parseInt("0xFFFF",16),Xp=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);var xn={};O(xn,{identity:()=>pl});var pl=Ye({prefix:"\0",name:"identity",encode:r=>Ho(r),decode:r=>Xo(r)});var En={};O(En,{base2:()=>ml});var ml=B({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var vn={};O(vn,{base8:()=>gl});var gl=B({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var fn={};O(fn,{base10:()=>yl});var yl=Le({prefix:"9",name:"base10",alphabet:"0123456789"});var Cn={};O(Cn,{base16:()=>wl,base16upper:()=>bl});var wl=B({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),bl=B({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var In={};O(In,{base36:()=>xl,base36upper:()=>El});var xl=Le({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),El=Le({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Sn={};O(Sn,{base64:()=>vl,base64pad:()=>fl,base64url:()=>Cl,base64urlpad:()=>Il});var vl=B({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),fl=B({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Cl=B({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Il=B({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var An={};O(An,{base256emoji:()=>Tl});var Ri=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}"),Sl=Ri.reduce((r,e,t)=>(r[t]=e,r),[]),Al=Ri.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function Ul(r){return r.reduce((e,t)=>(e+=Sl[t],e),"")}function Ol(r){let e=[];for(let t of r){let n=Al[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}var Tl=Ye({prefix:"\u{1F680}",name:"base256emoji",encode:Ul,decode:Ol});var Ln={};O(Ln,{sha256:()=>Ll,sha512:()=>Dl});var Tn=Se(Z("crypto"),1);var On=({name:r,code:e,encode:t})=>new Un(r,e,t),Un=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?Me(this.code,t):t.then(n=>Me(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Ll=On({name:"sha2-256",code:18,encode:r=>Q(Tn.default.createHash("sha256").update(r).digest())}),Dl=On({name:"sha2-512",code:19,encode:r=>Q(Tn.default.createHash("sha512").update(r).digest())});var Dn={};O(Dn,{identity:()=>Pl});var Mi=0,Bl="identity",ki=Q,Nl=r=>Me(Mi,ki(r)),Pl={code:Mi,name:Bl,encode:ki,digest:Nl};var Lm=new TextEncoder,Dm=new TextDecoder;var zi={...xn,...En,...vn,...fn,...Cn,...Kt,...In,...$t,...Sn,...An},Fm={...Ln,...Dn};function Bn(r,e="utf8"){let t=Kr[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?ir(globalThis.Buffer.from(r,"utf-8")):t.decoder.decode(`${t.prefix}${r}`)}var he=Se(Gr(),1);var Ne=Z("node:net");function Hr(r){return!!(0,Ne.isIP)(r)}var _i=Ne.isIPv4,Ml=Ne.isIPv6,Nn=function(r){let e=0;if(r=r.toString().trim(),_i(r)){let t=new Uint8Array(e+4);return r.split(/\./g).forEach(n=>{t[e++]=parseInt(n,10)&255}),t}if(Ml(r)){let t=r.split(":",8),n;for(n=0;n<t.length;n++){let i=_i(t[n]),s;i&&(s=Nn(t[n]),t[n]=j(s.slice(0,2),"base16")),s!=null&&++n<8&&t.splice(n,0,j(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")},Vi=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 Ir={},Pn={},zl=[[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"]];zl.forEach(r=>{let e=_l(...r);Pn[e.code]=e,Ir[e.name]=e});function _l(r,e,t,n,o){return{code:r,size:e,name:t,resolvable:!!n,path:!!o}}function L(r){if(typeof r=="number"){if(Pn[r]!=null)return Pn[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(Ir[r]!=null)return Ir[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var rg=L("ip4"),tg=L("ip6"),ng=L("ipcidr");function Gi(r,e){switch(L(r).code){case 4:case 41:return ql(e);case 42:return ji(e);case 6:case 273:case 33:case 132:return Hi(e).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return ji(e);case 421:return Gl(e);case 444:return Ki(e);case 445:return Ki(e);case 466:return Kl(e);default:return j(e,"base16")}}function Xi(r,e){switch(L(r).code){case 4:return qi(e);case 41:return qi(e);case 42:return $i(e);case 6:case 273:case 33:case 132:return Fn(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return $i(e);case 421:return $l(e);case 444:return Xl(e);case 445:return Hl(e);case 466:return jl(e);default:return Bn(e,"base16")}}var Rn=Object.values(zi).map(r=>r.decoder),Vl=function(){let r=Rn[0].or(Rn[1]);return Rn.slice(2).forEach(e=>r=r.or(e)),r}();function qi(r){if(!Hr(r))throw new Error("invalid ip address");return Nn(r)}function ql(r){let e=Vi(r,0,r.length);if(e==null)throw new Error("ipBuff is required");if(!Hr(e))throw new Error("invalid ip address");return e}function Fn(r){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,r),new Uint8Array(e)}function Hi(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function $i(r){let e=Bn(r),t=Uint8Array.from(he.default.encode(e.length));return Ie([t,e],t.length+e.length)}function ji(r){let e=he.default.decode(r);if(r=r.slice(he.default.decode.bytes),r.length!==e)throw new Error("inconsistent lengths");return j(r)}function $l(r){let e;r[0]==="Q"||r[0]==="1"?e=Vr($.decode(`z${r}`)).bytes:e=De.parse(r).multihash.bytes;let t=Uint8Array.from(he.default.encode(e.length));return Ie([t,e],t.length+e.length)}function jl(r){let e=Vl.decode(r),t=Uint8Array.from(he.default.encode(e.length));return Ie([t,e],t.length+e.length)}function Kl(r){let e=he.default.decode(r),t=r.slice(he.default.decode.bytes);if(t.length!==e)throw new Error("inconsistent lengths");return"u"+j(t,"base64url")}function Gl(r){let e=he.default.decode(r),t=r.slice(he.default.decode.bytes);if(t.length!==e)throw new Error("inconsistent lengths");return j(t,"base58btc")}function Xl(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=Ce.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=Fn(n);return Ie([t,o],t.length+o.length)}function Hl(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=Ce.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=Fn(n);return Ie([t,o],t.length+o.length)}function Ki(r){let e=r.slice(0,r.length-2),t=r.slice(r.length-2),n=j(e,"base32"),o=Hi(t);return`${n}:${o}`}function Yl(r){let e=[],t=r.split("/").slice(1);if(t.length===1&&t[0]==="")return[];for(let n=0;n<t.length;n++){let o=t[n],i=L(o);if(i.size===0){e.push([o]);continue}if(n++,n>=t.length)throw Ji("invalid address: "+r);if(i.path===!0){e.push([o,Vn(t.slice(n).join("/"))]);break}e.push([o,t[n]])}return e}function Jl(r){let e=[];return r.map(t=>{let n=Qr(t);return e.push(n.name),t.length>1&&t[1]!=null&&e.push(t[1]),null}),Vn(e.join("/"))}function Ql(r){return r.map(e=>{Array.isArray(e)||(e=[e]);let t=Qr(e);return e.length>1?[t.code,Xi(t.code,e[1])]:[t.code]})}function Mn(r){return r.map(e=>{let t=Qr(e);return e[1]!=null?[t.code,Gi(t.code,e[1])]:[t.code]})}function kn(r){return Jr(Ie(r.map(e=>{let t=Qr(e),n=Uint8Array.from(sr.default.encode(t.code));return e.length>1&&e[1]!=null&&(n=Ie([n,e[1]])),n})))}function zn(r,e){return r.size>0?r.size/8:r.size===0?0:sr.default.decode(e)+(sr.default.decode.bytes??0)}function Yr(r){let e=[],t=0;for(;t<r.length;){let n=sr.default.decode(r,t),o=sr.default.decode.bytes??0,i=L(n),s=zn(i,r.slice(t+o));if(s===0){e.push([n]),t+=o;continue}let a=r.slice(t+o,t+o+s);if(t+=s+o,t>r.length)throw Ji("Invalid address Uint8Array: "+j(r,"base16"));e.push([n,a])}return e}function _n(r){let e=Yr(r),t=Mn(e);return Jl(t)}function Wl(r){r=Vn(r);let e=Yl(r),t=Ql(e);return kn(t)}function Yi(r){return Wl(r)}function Jr(r){let e=Zl(r);if(e!=null)throw e;return Uint8Array.from(r)}function Zl(r){try{Yr(r)}catch(e){return e}}function Vn(r){return"/"+r.trim().split("/").filter(e=>e).join("/")}function Ji(r){return new Error("Error parsing address: "+r)}function Qr(r){return L(r[0])}var ru=Symbol.for("nodejs.util.inspect.custom"),tu=[L("dns").code,L("dns4").code,L("dns6").code,L("dnsaddr").code],nu=new Map,Qi=Symbol.for("@multiformats/js-multiaddr/multiaddr");function ou(r){return!!r?.[Qi]}var jn=class r{bytes;#e;#t;#n;#r;[Qi]=!0;constructor(e){if(e==null&&(e=""),e instanceof Uint8Array)this.bytes=Jr(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);this.bytes=Yi(e)}else if(ou(e))this.bytes=Jr(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return this.#e==null&&(this.#e=_n(this.bytes)),this.#e}toJSON(){return this.toString()}toOptions(){let e,t,n,o,i="",s=L("tcp"),a=L("udp"),g=L("ip4"),w=L("ip6"),p=L("dns6"),d=L("ip6zone");for(let[u,c]of this.stringTuples())u===d.code&&(i=`%${c??""}`),tu.includes(u)&&(t=s.name,o=443,n=`${c??""}${i}`,e=u===p.code?6:4),(u===s.code||u===a.code)&&(t=L(u).name,o=parseInt(c??"")),(u===g.code||u===w.code)&&(t=L(u).name,n=`${c??""}${i}`,e=u===w.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.protoCodes().map(e=>Object.assign({},L(e)))}protoCodes(){let e=[],t=this.bytes,n=0;for(;n<t.length;){let o=$n.default.decode(t,n),i=$n.default.decode.bytes??0,s=L(o),a=zn(s,t.slice(n+i));n+=a+i,e.push(o)}return e}protoNames(){return this.protos().map(e=>e.name)}tuples(){return this.#t==null&&(this.#t=Yr(this.bytes)),this.#t}stringTuples(){return this.#n==null&&(this.#n=Mn(this.tuples())),this.#n}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(kn(t.slice(0,n)));return this}getPeerId(){try{let t=this.stringTuples().filter(n=>n[0]===Ir.ipfs.code).pop();if(t?.[1]!=null){let n=t[1];return n[0]==="Q"||n[0]==="1"?j($.decode(`z${n}`),"base58btc"):j(De.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){if(this.#r===void 0)try{this.#r=this.stringTuples().filter(e=>L(e[0]).path===!0)[0][1],this.#r==null&&(this.#r=null)}catch{this.#r=null}return this.#r}equals(e){return hr(this.bytes,e.bytes)}async resolve(e){let t=this.protos().find(i=>i.resolvable);if(t==null)return[this];let n=nu.get(t.name);if(n==null)throw new zr(`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)}[ru](){return`Multiaddr(${_n(this.bytes)})`}};function qn(r){return new jn(r)}var Sr=Nr("libp2p:mdns:query");function Wi(r,e,t){let n=()=>{Sr("query",e),r.query({questions:[{name:e,type:"PTR"}]})};return n(),setInterval(n,t)}function Zi(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(a=>a.data).filter(a=>a.toString().startsWith("dnsaddr=")).map(a=>qn(a.toString().substring(8))),s=i[0].getPeerId();if(s==null)throw new Error("Multiaddr doesn't contain PeerId");return Sr("peer found %p",s),{id:kt(s),multiaddrs:i,protocols:[]}}catch(i){Sr.error("failed to parse mdns response",i)}}function es(r,e,t,n,o,i){if(!i){Sr("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(a=>{a.getPeerId()!=null&&s.push({name:t+"."+o,type:"TXT",class:"IN",ttl:120,data:"dnsaddr="+a.toString()})}),Sr("responding to query"),e.respond(s)}}function rs(r){let e="",t="abcdefghijklmnopqrstuvwxyz0123456789";for(let n=0;n<r;n++)e+=t.charAt(Math.floor(Math.random()*t.length));return e}var Wr=Nr("libp2p:mdns"),Kn=class extends Ur{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??rs(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)}[Xn]=this;[Symbol.toStringTag]="@libp2p/mdns";isStarted(){return!!this.mdns}async start(){this.mdns==null&&(this.mdns=(0,ts.default)({port:this.port,ip:this.ip}),this.mdns.on("query",this._onMdnsQuery),this.mdns.on("response",this._onMdnsResponse),this._queryInterval=Wi(this.mdns,this.serviceTag,this.interval))}_onMdnsQuery(e){this.mdns!=null&&(Wr.trace("received incoming mDNS query"),es(e,this.mdns,this.peerName,this.components.addressManager.getAddresses(),this.serviceTag,this.broadcast))}_onMdnsResponse(e){Wr.trace("received mDNS query response");try{let t=Zi(e,this.peerName,this.serviceTag);t!=null&&(Wr("discovered peer in mDNS query response %p",t.id),this.dispatchEvent(new Or("peer",{detail:t})))}catch(t){Wr.error("Error processing peer response",t)}}_onPeer(e){this.mdns!=null&&this.dispatchEvent(new Or("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 su(r={}){return e=>new Kn(e,r)}return as(cu);})();
7
7
  return Libp2PMdns}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/mdns",
3
- "version": "8.0.0-b36ec7f2",
3
+ "version": "8.0.0-c999d6a7",
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,23 +44,20 @@
44
44
  "test:electron-main": "aegir test -t electron-main"
45
45
  },
46
46
  "dependencies": {
47
- "@libp2p/interface": "0.0.1-b36ec7f2",
48
- "@libp2p/logger": "2.1.1-b36ec7f2",
49
- "@libp2p/peer-id": "2.0.3-b36ec7f2",
47
+ "@libp2p/interface": "0.0.1-c999d6a7",
48
+ "@libp2p/logger": "2.1.1-c999d6a7",
49
+ "@libp2p/peer-id": "2.0.3-c999d6a7",
50
50
  "@multiformats/multiaddr": "^12.1.3",
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": "3.0.7-b36ec7f2",
57
- "@libp2p/interface-internal": "0.0.1-b36ec7f2",
58
- "@libp2p/peer-id-factory": "2.0.3-b36ec7f2",
59
- "aegir": "^39.0.13",
56
+ "@libp2p/interface-compliance-tests": "3.0.7-c999d6a7",
57
+ "@libp2p/interface-internal": "0.0.1-c999d6a7",
58
+ "@libp2p/peer-id-factory": "2.0.3-c999d6a7",
59
+ "aegir": "^40.0.1",
60
60
  "p-wait-for": "^5.0.2",
61
61
  "ts-sinon": "^2.0.2"
62
- },
63
- "typedoc": {
64
- "entryPoint": "./src/index.ts"
65
62
  }
66
63
  }