UNPKG

ipfsd-ctl

Version:
2 lines 58.5 kB
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.IpfsdCtl = factory()}(typeof self !== 'undefined' ? self : this, function () { "use strict";var IpfsdCtl=(()=>{var Qn=Object.create;var ve=Object.defineProperty;var Zn=Object.getOwnPropertyDescriptor;var Yn=Object.getOwnPropertyNames;var eo=Object.getPrototypeOf,to=Object.prototype.hasOwnProperty;var Gt=(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 h=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),P=(t,e)=>{for(var r in e)ve(t,r,{get:e[r],enumerable:!0})},Jt=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Yn(e))!to.call(t,o)&&o!==r&&ve(t,o,{get:()=>e[o],enumerable:!(n=Zn(e,o))||n.enumerable});return t};var L=(t,e,r)=>(r=t!=null?Qn(eo(t)):{},Jt(e||!t||!t.__esModule?ve(r,"default",{value:t,enumerable:!0}):r,t)),ro=t=>Jt(ve({},"__esModule",{value:!0}),t);var Kt=h((ua,Xt)=>{"use strict";Xt.exports=t=>{if(Object.prototype.toString.call(t)!=="[object Object]")return!1;let e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}});var De=h((er,tr)=>{"use strict";var Ce=Kt(),{hasOwnProperty:Zt}=Object.prototype,{propertyIsEnumerable:no}=Object,J=(t,e,r)=>Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0}),oo=er,Qt={concatArrays:!1,ignoreUndefined:!1},Ae=t=>{let e=[];for(let r in t)Zt.call(t,r)&&e.push(r);if(Object.getOwnPropertySymbols){let r=Object.getOwnPropertySymbols(t);for(let n of r)no.call(t,n)&&e.push(n)}return e};function X(t){return Array.isArray(t)?so(t):Ce(t)?io(t):t}function so(t){let e=t.slice(0,0);return Ae(t).forEach(r=>{J(e,r,X(t[r]))}),e}function io(t){let e=Object.getPrototypeOf(t)===null?Object.create(null):{};return Ae(t).forEach(r=>{J(e,r,X(t[r]))}),e}var Yt=(t,e,r,n)=>(r.forEach(o=>{typeof e[o]>"u"&&n.ignoreUndefined||(o in t&&t[o]!==Object.getPrototypeOf(t)?J(t,o,je(t[o],e[o],n)):J(t,o,X(e[o])))}),t),ao=(t,e,r)=>{let n=t.slice(0,0),o=0;return[t,e].forEach(s=>{let i=[];for(let a=0;a<s.length;a++)Zt.call(s,a)&&(i.push(String(a)),s===t?J(n,o++,s[a]):J(n,o++,X(s[a])));n=Yt(n,s,Ae(s).filter(a=>!i.includes(a)),r)}),n};function je(t,e,r){return r.concatArrays&&Array.isArray(t)&&Array.isArray(e)?ao(t,e,r):!Ce(e)||!Ce(t)?X(e):Yt(t,e,Ae(e),r)}tr.exports=function(...t){let e=je(X(Qt),this!==oo&&this||{},Qt),r={_:{}};for(let n of t)if(n!==void 0){if(!Ce(n))throw new TypeError("`"+n+"` is not an Option Object");r=je(r,{_:n},e)}return r._}});var $e=h((ma,cr)=>{function co(){return!!(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&process.versions.electron||typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Electron")>=0)}cr.exports=co});var Ke=h(Te=>{"use strict";var Ge=class extends Error{constructor(e="Request timed out"){super(e),this.name="TimeoutError"}};Te.TimeoutError=Ge;var Je=class extends Error{constructor(e="The operation was aborted."){super(e),this.name="AbortError"}};Te.AbortError=Je;var Xe=class extends Error{constructor(e){super(e.statusText),this.name="HTTPError",this.response=e}};Te.HTTPError=Xe});var ue=h(()=>{});var fr=h((Ca,Qe)=>{"use strict";globalThis.fetch&&globalThis.Headers&&globalThis.Request&&globalThis.Response?Qe.exports={default:globalThis.fetch,Headers:globalThis.Headers,Request:globalThis.Request,Response:globalThis.Response}:Qe.exports={default:ue().default,Headers:ue().Headers,Request:ue().Request,Response:ue().Response}});var mr=h((Aa,hr)=>{"use strict";hr.exports=fr()});var gr=h((Ea,br)=>{"use strict";var{TimeoutError:lo,AbortError:uo}=Ke(),{Response:wr,Request:po,Headers:Ye,default:fo}=mr(),ho=(t,e={})=>{let r=new XMLHttpRequest;r.open(e.method||"GET",t.toString(),!0);let{timeout:n,headers:o}=e;if(n&&n>0&&n<1/0&&(r.timeout=n),e.overrideMimeType!=null&&r.overrideMimeType(e.overrideMimeType),o)for(let[s,i]of new Ye(o))r.setRequestHeader(s,i);return e.signal&&(e.signal.onabort=()=>r.abort()),e.onUploadProgress&&(r.upload.onprogress=e.onUploadProgress),r.responseType="arraybuffer",new Promise((s,i)=>{let a=d=>{switch(d.type){case"error":{s(wr.error());break}case"load":{s(new Ze(r.responseURL,r.response,{status:r.status,statusText:r.statusText,headers:bo(r.getAllResponseHeaders())}));break}case"timeout":{i(new lo);break}case"abort":{i(new uo);break}default:break}};r.onerror=a,r.onload=a,r.ontimeout=a,r.onabort=a,r.send(e.body)})},mo=fo,wo=(t,e={})=>e.onUploadProgress!=null?ho(t,e):mo(t,e),bo=t=>{let e=new Ye;for(let r of t.trim().split(/[\r\n]+/)){let n=r.indexOf(": ");n>0&&e.set(r.slice(0,n),r.slice(n+1))}return e},Ze=class extends wr{constructor(e,r,n){super(r,n),Object.defineProperty(this,"url",{value:e})}};br.exports={fetch:wo,Request:po,Headers:Ye}});var tt=h((Sa,xr)=>{"use strict";var go=typeof navigator<"u"&&navigator.product==="ReactNative";function yo(){return go?"http://localhost":self.location?self.location.protocol+"//"+self.location.host:""}var pe=self.URL,yr=yo(),et=class{constructor(e="",r=yr){this.super=new pe(e,r),this.path=this.pathname+this.search,this.auth=this.username&&this.password?this.username+":"+this.password:null,this.query=this.search&&this.search.startsWith("?")?this.search.slice(1):null}get hash(){return this.super.hash}get host(){return this.super.host}get hostname(){return this.super.hostname}get href(){return this.super.href}get origin(){return this.super.origin}get password(){return this.super.password}get pathname(){return this.super.pathname}get port(){return this.super.port}get protocol(){return this.super.protocol}get search(){return this.super.search}get searchParams(){return this.super.searchParams}get username(){return this.super.username}set hash(e){this.super.hash=e}set host(e){this.super.host=e}set hostname(e){this.super.hostname=e}set href(e){this.super.href=e}set password(e){this.super.password=e}set pathname(e){this.super.pathname=e}set port(e){this.super.port=e}set protocol(e){this.super.protocol=e}set search(e){this.super.search=e}set username(e){this.super.username=e}static createObjectURL(e){return pe.createObjectURL(e)}static revokeObjectURL(e){pe.revokeObjectURL(e)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}};function xo(t){if(typeof t=="string")return new pe(t).toString();if(!(t instanceof pe)){let e=t.username&&t.password?`${t.username}:${t.password}@`:"",r=t.auth?t.auth+"@":"",n=t.port?":"+t.port:"",o=t.protocol?t.protocol+"//":"",s=t.host||"",i=t.hostname||"",a=t.search||(t.query?"?"+t.query:""),d=t.hash||"",x=t.pathname||"",c=t.path||x+a;return`${o}${e||r}${s||i+n}${c}${d}`}}xr.exports={URLWithLegacySupport:et,URLSearchParams:self.URLSearchParams,defaultBase:yr,format:xo}});var Ar=h((Ta,Cr)=>{"use strict";var{URLWithLegacySupport:vr,format:vo}=tt();Cr.exports=(t,e={},r={},n)=>{let o=e.protocol?e.protocol.replace(":",""):"http";o=(r[o]||n||o)+":";let s;try{s=new vr(t)}catch{s={}}let i=Object.assign({},e,{protocol:o||s.protocol,host:e.host||s.host});return new vr(t,vo(i)).toString()}});var Sr=h((Pa,Er)=>{"use strict";var{URLWithLegacySupport:Co,format:Ao,URLSearchParams:Eo,defaultBase:So}=tt(),To=Ar();Er.exports={URL:Co,URLSearchParams:Eo,format:Ao,relative:To,defaultBase:So}});var Pr=h((Oa,rt)=>{function Tr(t){let e=new globalThis.AbortController;function r(){e.abort();for(let n of t)!n||!n.removeEventListener||n.removeEventListener("abort",r)}for(let n of t)if(!(!n||!n.addEventListener)){if(n.aborted){r();break}n.addEventListener("abort",r)}return e.signal}rt.exports=Tr;rt.exports.anySignal=Tr});var Ur=h((Ua,Or)=>{"use strict";async function*Po(t,e={}){let r=t.getReader();try{for(;;){let n=await r.read();if(n.done)return;yield n.value}}finally{e.preventCancel!==!0&&r.cancel(),r.releaseLock()}}Or.exports=Po});var Fr=h((Ra,Rr)=>{"use strict";var Oo=$e(),Pe=typeof window=="object"&&typeof document=="object"&&document.nodeType===9,de=Oo(),Uo=Pe&&!de,Ro=de&&!Pe,Fo=de&&Pe,Io=typeof Gt=="function"&&typeof process<"u"&&typeof process.release<"u"&&process.release.name==="node"&&!de,No=typeof importScripts=="function"&&typeof self<"u"&&typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,Mo=typeof process<"u"&&typeof process.env<"u"&&!1,Bo=typeof navigator<"u"&&navigator.product==="ReactNative";Rr.exports={isTest:Mo,isElectron:de,isElectronMain:Ro,isElectronRenderer:Fo,isNode:Io,isBrowser:Uo,isWebWorker:No,isEnvWithDom:Pe,isReactNative:Bo}});var Nr=h((Ia,Ir)=>{"use strict";var Lo=async t=>{let e=[];for await(let r of t)e.push(r);return e};Ir.exports=Lo});var ot=h((Na,_r)=>{"use strict";var{fetch:qo,Request:ko,Headers:_o}=gr(),{TimeoutError:nt,HTTPError:qr}=Ke(),Mr=De().bind({ignoreUndefined:!0}),{URL:Br,URLSearchParams:Lr}=Sr(),zo=Pr(),jo=Ur(),{isBrowser:Do,isWebWorker:$o}=Fr(),Vo=Nr(),Wo=(t,e,r)=>{if(e===void 0)return t;let n=Date.now(),o=()=>Date.now()-n>=e;return new Promise((s,i)=>{let a=setTimeout(()=>{o()&&(i(new nt),r.abort())},e),d=x=>l=>{if(clearTimeout(a),o()){i(new nt);return}x(l)};t.then(d(s),d(i))})},Ho={throwHttpErrors:!0,credentials:"same-origin"},C=class{constructor(e={}){this.opts=Mr(Ho,e)}async fetch(e,r={}){let n=Mr(this.opts,r),o=new _o(n.headers);if(typeof e!="string"&&!(e instanceof Br||e instanceof ko))throw new TypeError("`resource` must be a string, URL, or Request");let s=new Br(e.toString(),n.base),{searchParams:i,transformSearchParams:a,json:d}=n;i&&(typeof a=="function"?s.search=a(new Lr(n.searchParams)):s.search=new Lr(n.searchParams)),d&&(n.body=JSON.stringify(n.json),o.set("content-type","application/json"));let x=new AbortController,c=zo([x.signal,n.signal]);globalThis.ReadableStream!=null&&n.body instanceof globalThis.ReadableStream&&(Do||$o)&&(n.body=new Blob(await Vo(jo(n.body))));let l=await Wo(qo(s.toString(),{...n,signal:c,timeout:void 0,headers:o,duplex:"half"}),n.timeout,x);if(!l.ok&&n.throwHttpErrors)throw n.handleError&&await n.handleError(l),new qr(l);return l.iterator=async function*(){yield*kr(l.body)},l.ndjson=async function*(){for await(let u of Go(l.iterator()))r.transform?yield r.transform(u):yield u},l}post(e,r={}){return this.fetch(e,{...r,method:"POST"})}get(e,r={}){return this.fetch(e,{...r,method:"GET"})}put(e,r={}){return this.fetch(e,{...r,method:"PUT"})}delete(e,r={}){return this.fetch(e,{...r,method:"DELETE"})}options(e,r={}){return this.fetch(e,{...r,method:"OPTIONS"})}},Go=async function*(t){let e=new TextDecoder,r="";for await(let n of t){r+=e.decode(n,{stream:!0});let o=r.split(/\r?\n/);for(let s=0;s<o.length-1;s++){let i=o[s].trim();i.length>0&&(yield JSON.parse(i))}r=o[o.length-1]}r+=e.decode(),r=r.trim(),r.length!==0&&(yield JSON.parse(r))},kr=t=>{if(Jo(t))return t;if(Ko(t)){let e=t[Symbol.asyncIterator]();return{[Symbol.asyncIterator](){return{next:e.next.bind(e),return(r){return t.destroy(),typeof e.return=="function"?e.return():Promise.resolve({done:!0,value:r})}}}}}if(Xo(t)){let e=t.getReader();return async function*(){try{for(;;){let{done:r,value:n}=await e.read();if(r)return;n&&(yield n)}}finally{e.releaseLock()}}()}throw new TypeError("Body can't be converted to AsyncIterable")},Jo=t=>typeof t=="object"&&t!==null&&typeof t[Symbol.asyncIterator]=="function",Xo=t=>t&&typeof t.getReader=="function",Ko=t=>Object.prototype.hasOwnProperty.call(t,"readable")&&Object.prototype.hasOwnProperty.call(t,"writable");C.HTTPError=qr;C.TimeoutError=nt;C.streamToAsyncIterator=kr;C.post=(t,e)=>new C(e).post(t,e);C.get=(t,e)=>new C(e).get(t,e);C.put=(t,e)=>new C(e).put(t,e);C.delete=(t,e)=>new C(e).delete(t,e);C.options=(t,e)=>new C(e).options(t,e);_r.exports=C});var bn=h((Ic,wn)=>{wn.exports=Ut;var mn=128,li=127,ui=~li,pi=Math.pow(2,31);function Ut(t,e,r){if(Number.MAX_SAFE_INTEGER&&t>Number.MAX_SAFE_INTEGER)throw Ut.bytes=0,new RangeError("Could not encode varint");e=e||[],r=r||0;for(var n=r;t>=pi;)e[r++]=t&255|mn,t/=128;for(;t&ui;)e[r++]=t&255|mn,t>>>=7;return e[r]=t|0,Ut.bytes=r-n+1,e}});var xn=h((Nc,yn)=>{yn.exports=Rt;var di=128,gn=127;function Rt(t,n){var r=0,n=n||0,o=0,s=n,i,a=t.length;do{if(s>=a||o>49)throw Rt.bytes=0,new RangeError("Could not decode varint");i=t[s++],r+=o<28?(i&gn)<<o:(i&gn)*Math.pow(2,o),o+=7}while(i>=di);return Rt.bytes=s-n,r}});var Cn=h((Mc,vn)=>{var fi=Math.pow(2,7),hi=Math.pow(2,14),mi=Math.pow(2,21),wi=Math.pow(2,28),bi=Math.pow(2,35),gi=Math.pow(2,42),yi=Math.pow(2,49),xi=Math.pow(2,56),vi=Math.pow(2,63);vn.exports=function(t){return t<fi?1:t<hi?2:t<mi?3:t<wi?4:t<bi?5:t<gi?6:t<yi?7:t<xi?8:t<vi?9:10}});var Me=h((Bc,An)=>{An.exports={encode:bn(),decode:xn(),encodingLength:Cn()}});var Nn=h((tl,In)=>{"use strict";function Fn(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function ki(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return Fn(t,r)}catch{r.message=t.message,r.stack=t.stack;let o=function(){};return o.prototype=Object.create(Object.getPrototypeOf(t)),Fn(new o,r)}}In.exports=ki});var zn=h((ll,_n)=>{var ae=1e3,ce=ae*60,le=ce*60,V=le*24,$i=V*7,Vi=V*365.25;_n.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return Wi(t);if(r==="number"&&isFinite(t))return e.long?Gi(t):Hi(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function Wi(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*Vi;case"weeks":case"week":case"w":return r*$i;case"days":case"day":case"d":return r*V;case"hours":case"hour":case"hrs":case"hr":case"h":return r*le;case"minutes":case"minute":case"mins":case"min":case"m":return r*ce;case"seconds":case"second":case"secs":case"sec":case"s":return r*ae;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function Hi(t){var e=Math.abs(t);return e>=V?Math.round(t/V)+"d":e>=le?Math.round(t/le)+"h":e>=ce?Math.round(t/ce)+"m":e>=ae?Math.round(t/ae)+"s":t+"ms"}function Gi(t){var e=Math.abs(t);return e>=V?ke(t,e,V,"day"):e>=le?ke(t,e,le,"hour"):e>=ce?ke(t,e,ce,"minute"):e>=ae?ke(t,e,ae,"second"):t+" ms"}function ke(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var Dn=h((ul,jn)=>{function Ji(t){r.debug=r,r.default=r,r.coerce=d,r.disable=s,r.enable=o,r.enabled=i,r.humanize=zn(),r.destroy=x,Object.keys(t).forEach(c=>{r[c]=t[c]}),r.names=[],r.skips=[],r.formatters={};function e(c){let l=0;for(let u=0;u<c.length;u++)l=(l<<5)-l+c.charCodeAt(u),l|=0;return r.colors[Math.abs(l)%r.colors.length]}r.selectColor=e;function r(c){let l,u=null,H,p;function f(...b){if(!f.enabled)return;let y=f,E=Number(new Date),U=E-(l||E);y.diff=U,y.prev=l,y.curr=E,l=E,b[0]=r.coerce(b[0]),typeof b[0]!="string"&&b.unshift("%O");let v=0;b[0]=b[0].replace(/%([a-zA-Z%])/g,(R,T)=>{if(R==="%%")return"%";v++;let F=r.formatters[T];if(typeof F=="function"){let G=b[v];R=F.call(y,G),b.splice(v,1),v--}return R}),r.formatArgs.call(y,b),(y.log||r.log).apply(y,b)}return f.namespace=c,f.useColors=r.useColors(),f.color=r.selectColor(c),f.extend=n,f.destroy=r.destroy,Object.defineProperty(f,"enabled",{enumerable:!0,configurable:!1,get:()=>u!==null?u:(H!==r.namespaces&&(H=r.namespaces,p=r.enabled(c)),p),set:b=>{u=b}}),typeof r.init=="function"&&r.init(f),f}function n(c,l){let u=r(this.namespace+(typeof l>"u"?":":l)+c);return u.log=this.log,u}function o(c){r.save(c),r.namespaces=c,r.names=[],r.skips=[];let l,u=(typeof c=="string"?c:"").split(/[\s,]+/),H=u.length;for(l=0;l<H;l++)u[l]&&(c=u[l].replace(/\*/g,".*?"),c[0]==="-"?r.skips.push(new RegExp("^"+c.slice(1)+"$")):r.names.push(new RegExp("^"+c+"$")))}function s(){let c=[...r.names.map(a),...r.skips.map(a).map(l=>"-"+l)].join(",");return r.enable(""),c}function i(c){if(c[c.length-1]==="*")return!0;let l,u;for(l=0,u=r.skips.length;l<u;l++)if(r.skips[l].test(c))return!1;for(l=0,u=r.names.length;l<u;l++)if(r.names[l].test(c))return!0;return!1}function a(c){return c.toString().substring(2,c.toString().length-2).replace(/\.\*\?$/,"*")}function d(c){return c instanceof Error?c.stack||c.message:c}function x(){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=Ji});var $n=h((O,_e)=>{O.formatArgs=Ki;O.save=Qi;O.load=Zi;O.useColors=Xi;O.storage=Yi();O.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`."))}})();O.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 Xi(){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 Ki(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+_e.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)}O.log=console.debug||console.log||(()=>{});function Qi(t){try{t?O.storage.setItem("debug",t):O.storage.removeItem("debug")}catch{}}function Zi(){let t;try{t=O.storage.getItem("debug")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function Yi(){try{return localStorage}catch{}}_e.exports=Dn()(O);var{formatters:ea}=_e.exports;ea.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var ca={};P(ca,{createController:()=>ia,createFactory:()=>Kn,createServer:()=>aa});var rr=L(De(),1),K=rr.default;var nr=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((e,r)=>(r&=63,r<36?e+=r.toString(36):r<62?e+=(r-26).toString(36).toUpperCase():r>62?e+="-":e+="_",e),"");var Ee=async t=>await new Promise((e,r)=>{let n=self.indexedDB.deleteDatabase(t);n.onerror=o=>r(o),n.onsuccess=()=>e()}),or=async t=>{await Ee(t),await Ee(t+"/keys"),await Ee(t+"/blocks"),await Ee(t+"/datastore")},sr=async t=>await new Promise((e,r)=>{let n=self.indexedDB.open(t),o=!0;n.onerror=()=>r(n.error),n.onsuccess=function(){n.result.close(),o||self.indexedDB.deleteDatabase(t),e(o)},n.onupgradeneeded=function(){o=!1}}),ir=()=>"ipfs",ar=()=>null,Se=(t="")=>`${t}_ipfs_${nr()}`;var lr=L($e(),1),ur=typeof window=="object"&&typeof document=="object"&&document.nodeType===9,Ve=(0,lr.default)(),We=ur&&!Ve,pr=Ve&&!ur;var dr=typeof globalThis.process<"u"&&typeof globalThis.process.release<"u"&&globalThis.process.release.name==="node"&&!Ve,He=typeof importScripts=="function"&&typeof self<"u"&&typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,wa=typeof globalThis.process<"u"&&typeof globalThis.process.env<"u"&&globalThis.process.env["NODE"+(()=>"_")()+"ENV"]==="test",ba=typeof navigator<"u"&&navigator.product==="ReactNative";var $t=L(ot(),1);var Oe=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 s=0,i=0,a=this.peekChar();if(a===void 0)return;let d=a==="0",x=2**(8*o)-1;for(;;){let c=this.readAtomically(()=>{let l=this.readChar();if(l===void 0)return;let u=Number.parseInt(l,e);if(!Number.isNaN(u))return u});if(c===void 0)break;if(s*=e,s+=c,s>x||(i+=1,r!==void 0&&i>r))return}if(i!==0)return!n&&d&&i>1?void 0:s})}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 i=this.readSeparator(":",n,()=>this.readIPv4Addr());if(i!==void 0)return r[o]=i[0],r[o+1]=i[1],r[o+2]=i[2],r[o+3]=i[3],[o+4,!0]}let s=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(s===void 0)return[o,!1];r[o]=s>>8,r[o+1]=s&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 s=new Uint8Array(14),i=16-(n+2),[a]=e(s.subarray(0,i));return r.set(s.subarray(0,a),16-a),r})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var zr=45,Qo=15,Q=new Oe;function jr(t){if(!(t.length>Qo))return Q.new(t).parseWith(()=>Q.readIPv4Addr())}function Dr(t){if(!(t.length>zr))return Q.new(t).parseWith(()=>Q.readIPv6Addr())}function $r(t){if(!(t.length>zr))return Q.new(t).parseWith(()=>Q.readIPAddr())}function Vr(t){return Boolean(jr(t))}function Wr(t){return Boolean(Dr(t))}function Ue(t){return Boolean($r(t))}var lt={};P(lt,{identity:()=>ns});function Zo(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 s=t.charAt(o),i=s.charCodeAt(0);if(r[i]!==255)throw new TypeError(s+" is ambiguous");r[i]=o}var a=t.length,d=t.charAt(0),x=Math.log(a)/Math.log(256),c=Math.log(256)/Math.log(a);function l(p){if(p instanceof Uint8Array||(ArrayBuffer.isView(p)?p=new Uint8Array(p.buffer,p.byteOffset,p.byteLength):Array.isArray(p)&&(p=Uint8Array.from(p))),!(p instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(p.length===0)return"";for(var f=0,b=0,y=0,E=p.length;y!==E&&p[y]===0;)y++,f++;for(var U=(E-y)*c+1>>>0,v=new Uint8Array(U);y!==E;){for(var I=p[y],R=0,T=U-1;(I!==0||R<b)&&T!==-1;T--,R++)I+=256*v[T]>>>0,v[T]=I%a>>>0,I=I/a>>>0;if(I!==0)throw new Error("Non-zero carry");b=R,y++}for(var F=U-b;F!==U&&v[F]===0;)F++;for(var G=d.repeat(f);F<U;++F)G+=t.charAt(v[F]);return G}function u(p){if(typeof p!="string")throw new TypeError("Expected String");if(p.length===0)return new Uint8Array;var f=0;if(p[f]!==" "){for(var b=0,y=0;p[f]===d;)b++,f++;for(var E=(p.length-f)*x+1>>>0,U=new Uint8Array(E);p[f];){var v=r[p.charCodeAt(f)];if(v===255)return;for(var I=0,R=E-1;(v!==0||I<y)&&R!==-1;R--,I++)v+=a*U[R]>>>0,U[R]=v%256>>>0,v=v/256>>>0;if(v!==0)throw new Error("Non-zero carry");y=I,f++}if(p[f]!==" "){for(var T=E-y;T!==E&&U[T]===0;)T++;for(var F=new Uint8Array(b+(E-T)),G=b;T!==E;)F[G++]=U[T++];return F}}}function H(p){var f=u(p);if(f)return f;throw new Error(`Non-${e} character`)}return{encode:l,decodeUnsafe:u,decode:H}}var Yo=Zo,es=Yo,Hr=es;var za=new Uint8Array(0);var Gr=(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},q=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 Jr=t=>new TextEncoder().encode(t),Xr=t=>new TextDecoder().decode(t);var st=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 Qr(this,e)}},at=class{constructor(e){this.decoders=e}or(e){return Qr(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`)}},Qr=(t,e)=>new at({...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 st(e,r,n),this.decoder=new it(e,r,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Z=({name:t,prefix:e,encode:r,decode:n})=>new ct(t,e,r,n),z=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:o}=Hr(r,e);return Z({prefix:t,name:e,encode:n,decode:s=>q(o(s))})},ts=(t,e,r,n)=>{let o={};for(let c=0;c<e.length;++c)o[e[c]]=c;let s=t.length;for(;t[s-1]==="=";)--s;let i=new Uint8Array(s*r/8|0),a=0,d=0,x=0;for(let c=0;c<s;++c){let l=o[t[c]];if(l===void 0)throw new SyntaxError(`Non-${n} character`);d=d<<r|l,a+=r,a>=8&&(a-=8,i[x++]=255&d>>a)}if(a>=r||255&d<<8-a)throw new SyntaxError("Unexpected end of data");return i},rs=(t,e,r)=>{let n=e[e.length-1]==="=",o=(1<<r)-1,s="",i=0,a=0;for(let d=0;d<t.length;++d)for(a=a<<8|t[d],i+=8;i>r;)i-=r,s+=e[o&a>>i];if(i&&(s+=e[o&a<<r-i]),n)for(;s.length*r&7;)s+="=";return s},w=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>Z({prefix:e,name:t,encode(o){return rs(o,n,r)},decode(o){return ts(o,n,r,t)}});var ns=Z({prefix:"\0",name:"identity",encode:t=>Xr(t),decode:t=>Jr(t)});var ut={};P(ut,{base2:()=>os});var os=w({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var pt={};P(pt,{base8:()=>ss});var ss=w({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var dt={};P(dt,{base10:()=>is});var is=z({prefix:"9",name:"base10",alphabet:"0123456789"});var ft={};P(ft,{base16:()=>as,base16upper:()=>cs});var as=w({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),cs=w({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var ht={};P(ht,{base32:()=>N,base32hex:()=>ds,base32hexpad:()=>hs,base32hexpadupper:()=>ms,base32hexupper:()=>fs,base32pad:()=>us,base32padupper:()=>ps,base32upper:()=>ls,base32z:()=>ws});var N=w({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ls=w({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),us=w({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ps=w({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ds=w({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),fs=w({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),hs=w({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),ms=w({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),ws=w({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var mt={};P(mt,{base36:()=>bs,base36upper:()=>gs});var bs=z({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),gs=z({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var wt={};P(wt,{base58btc:()=>A,base58flickr:()=>ys});var A=z({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),ys=z({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var gt={};P(gt,{base64:()=>bt,base64pad:()=>xs,base64url:()=>vs,base64urlpad:()=>Cs});var bt=w({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),xs=w({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),vs=w({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Cs=w({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var yt={};P(yt,{base256emoji:()=>Ps});var Zr=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}"),As=Zr.reduce((t,e,r)=>(t[r]=e,t),[]),Es=Zr.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Ss(t){return t.reduce((e,r)=>(e+=As[r],e),"")}function Ts(t){let e=[];for(let r of t){let n=Es[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var Ps=Z({prefix:"\u{1F680}",name:"base256emoji",encode:Ss,decode:Ts});var At={};P(At,{sha256:()=>Hs,sha512:()=>Gs});var Os=tn,Yr=128,Us=127,Rs=~Us,Fs=Math.pow(2,31);function tn(t,e,r){e=e||[],r=r||0;for(var n=r;t>=Fs;)e[r++]=t&255|Yr,t/=128;for(;t&Rs;)e[r++]=t&255|Yr,t>>>=7;return e[r]=t|0,tn.bytes=r-n+1,e}var Is=xt,Ns=128,en=127;function xt(t,n){var r=0,n=n||0,o=0,s=n,i,a=t.length;do{if(s>=a)throw xt.bytes=0,new RangeError("Could not decode varint");i=t[s++],r+=o<28?(i&en)<<o:(i&en)*Math.pow(2,o),o+=7}while(i>=Ns);return xt.bytes=s-n,r}var Ms=Math.pow(2,7),Bs=Math.pow(2,14),Ls=Math.pow(2,21),qs=Math.pow(2,28),ks=Math.pow(2,35),_s=Math.pow(2,42),zs=Math.pow(2,49),js=Math.pow(2,56),Ds=Math.pow(2,63),$s=function(t){return t<Ms?1:t<Bs?2:t<Ls?3:t<qs?4:t<ks?5:t<_s?6:t<zs?7:t<js?8:t<Ds?9:10},Vs={encode:Os,decode:Is,encodingLength:$s},Ws=Vs,fe=Ws;var he=(t,e=0)=>[fe.decode(t,e),fe.decode.bytes],Y=(t,e,r=0)=>(fe.encode(t,e,r),e),ee=t=>fe.encodingLength(t);var $=(t,e)=>{let r=e.byteLength,n=ee(t),o=n+ee(r),s=new Uint8Array(o+r);return Y(t,s,0),Y(r,s,n),s.set(e,o),new te(t,r,e,s)},Fe=t=>{let e=q(t),[r,n]=he(e),[o,s]=he(e.subarray(n)),i=e.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new te(r,o,i,e)},rn=(t,e)=>{if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&Gr(t.bytes,r.bytes)}},te=class{constructor(e,r,n,o){this.code=e,this.size=r,this.digest=n,this.bytes=o}};var Ct=({name:t,code:e,encode:r})=>new vt(t,e,r),vt=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?$(this.code,r):r.then(n=>$(this.code,n))}else throw Error("Unknown type, must be binary type")}};var on=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),Hs=Ct({name:"sha2-256",code:18,encode:on("SHA-256")}),Gs=Ct({name:"sha2-512",code:19,encode:on("SHA-512")});var Et={};P(Et,{identity:()=>Ks});var sn=0,Js="identity",an=q,Xs=t=>$(sn,an(t)),Ks={code:sn,name:Js,encode:an,digest:Xs};var ac=new TextEncoder,cc=new TextDecoder;var cn=(t,e)=>{let{bytes:r,version:n}=t;switch(n){case 0:return ei(r,St(t),e||A.encoder);default:return ti(r,St(t),e||N.encoder)}};var ln=new WeakMap,St=t=>{let e=ln.get(t);if(e==null){let r=new Map;return ln.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!==me)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==ri)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,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&&rn(e.multihash,n.multihash)}toString(e){return cn(this,e)}toJSON(){return{"/":cn(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:s,bytes:i}=r;return new m(n,o,s,i||un(n,o,s.bytes))}else if(r[ni]===!0){let{version:n,multihash:o,code:s}=r,i=Fe(o);return m.create(n,s,i)}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!==me)throw new Error(`Version 0 CID must use dag-pb (code: ${me}) block encoding`);return new m(e,r,n,n.bytes)}case 1:{let o=un(e,r,n.bytes);return new m(e,r,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return m.create(0,me,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=q(e.subarray(n,n+r.multihashSize));if(o.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=o.subarray(r.multihashSize-r.digestSize),i=new te(r.multihashCode,r.digestSize,s,o);return[r.version===0?m.createV0(i):m.createV1(r.codec,i),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[l,u]=he(e.subarray(r));return r+=u,l},o=n(),s=me;if(o===18?(o=0,r=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=r,a=n(),d=n(),x=r+d,c=x-i;return{version:o,codec:s,multihashCode:a,digestSize:d,multihashSize:c,size:x}}static parse(e,r){let[n,o]=Ys(e,r),s=m.decode(o);return St(s).set(n,e),s}},Ys=(t,e)=>{switch(t[0]){case"Q":{let r=e||A;return[A.prefix,r.decode(`${A.prefix}${t}`)]}case A.prefix:{let r=e||A;return[A.prefix,r.decode(t)]}case N.prefix:{let r=e||N;return[N.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)]}}},ei=(t,e,r)=>{let{prefix:n}=r;if(n!==A.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let o=e.get(n);if(o==null){let s=r.encode(t).slice(1);return e.set(n,s),s}else return o},ti=(t,e,r)=>{let{prefix:n}=r,o=e.get(n);if(o==null){let s=r.encode(t);return e.set(n,s),s}else return o},me=112,ri=18,un=(t,e,r)=>{let n=ee(t),o=n+ee(e),s=new Uint8Array(o+r.byteLength);return Y(t,s,0),Y(e,s,n),s.set(r,o),s},ni=Symbol.for("@ipld/js-cid/CID");var we={...lt,...ut,...pt,...dt,...ft,...ht,...mt,...wt,...gt,...yt},gc={...At,...Et};function ne(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function Ie(t=0){return globalThis.Buffer?.allocUnsafe!=null?ne(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function dn(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var pn=dn("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Tt=dn("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=Ie(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),oi={utf8:pn,"utf-8":pn,hex:we.base16,latin1:Tt,ascii:Tt,binary:Tt,...we},Ne=oi;function S(t,e="utf8"){let r=Ne[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 fn=Vr,si=Wr,Pt=function(t){let e=0;if(t=t.toString().trim(),fn(t)){let r=new Uint8Array(e+4);return t.split(/\./g).forEach(n=>{r[e++]=parseInt(n,10)&255}),r}if(si(t)){let r=t.split(":",8),n;for(n=0;n<r.length;n++){let s=fn(r[n]),i;s&&(i=Pt(r[n]),r[n]=S(i.slice(0,2),"base16")),i!=null&&++n<8&&r.splice(n,0,S(i.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 s=[n,1];for(n=9-r.length;n>0;n--)s.push("0");r.splice.apply(r,s)}let o=new Uint8Array(e+16);for(n=0;n<r.length;n++){let s=parseInt(r[n],16);o[e++]=s>>8&255,o[e++]=s&255}return o}throw new Error("invalid ip address")},hn=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 s=0;s<r;s++)o.push(t[e+s]);return o.join(".")}if(r===16){let o=[];for(let s=0;s<r;s+=2)o.push(n.getUint16(e+s).toString(16));return o.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var be={},Ot={},ai=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,-1,"ip6zone"],[53,-1,"dns",!0],[54,-1,"dns4",!0],[55,-1,"dns6",!0],[56,-1,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,-1,"unix",!1,!0],[421,-1,"ipfs"],[421,-1,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,-1,"garlic64"],[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"]];ai.forEach(t=>{let e=ci(...t);Ot[e.code]=e,be[e.name]=e});function ci(t,e,r,n,o){return{code:t,size:e,name:r,resolvable:Boolean(n),path:Boolean(o)}}function g(t){if(typeof t=="number"){if(Ot[t]!=null)return Ot[t];throw new Error(`no protocol with code: ${t}`)}else if(typeof t=="string"){if(be[t]!=null)return be[t];throw new Error(`no protocol with name: ${t}`)}throw new Error(`invalid protocol id type: ${typeof t}`)}var M=L(Me(),1);function Ft(t,e="utf8"){let r=Ne[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?ne(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}function k(t,e){e==null&&(e=t.reduce((o,s)=>o+s.length,0));let r=Ie(e),n=0;for(let o of t)r.set(o,n),n+=o.length;return ne(r)}function Tn(t,e){switch(g(t).code){case 4:case 41:return Ai(e);case 6:case 273:case 33:case 132:return On(e).toString();case 53:case 54:case 55:case 56:case 400:case 777:return Si(e);case 421:return Ui(e);case 444:return Sn(e);case 445:return Sn(e);case 466:return Oi(e);default:return S(e,"base16")}}function Pn(t,e){switch(g(t).code){case 4:return En(e);case 41:return En(e);case 6:case 273:case 33:case 132:return Nt(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 777:return Ei(e);case 421:return Ti(e);case 444:return Ri(e);case 445:return Fi(e);case 466:return Pi(e);default:return Ft(e,"base16")}}var It=Object.values(we).map(t=>t.decoder),Ci=function(){let t=It[0].or(It[1]);return It.slice(2).forEach(e=>t=t.or(e)),t}();function En(t){if(!Ue(t))throw new Error("invalid ip address");return Pt(t)}function Ai(t){let e=hn(t,0,t.length);if(e==null)throw new Error("ipBuff is required");if(!Ue(e))throw new Error("invalid ip address");return e}function Nt(t){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,t),new Uint8Array(e)}function On(t){return new DataView(t.buffer).getUint16(t.byteOffset)}function Ei(t){let e=Ft(t),r=Uint8Array.from(M.default.encode(e.length));return k([r,e],r.length+e.length)}function Si(t){let e=M.default.decode(t);if(t=t.slice(M.default.decode.bytes),t.length!==e)throw new Error("inconsistent lengths");return S(t)}function Ti(t){let e;t[0]==="Q"||t[0]==="1"?e=Fe(A.decode(`z${t}`)).bytes:e=m.parse(t).multihash.bytes;let r=Uint8Array.from(M.default.encode(e.length));return k([r,e],r.length+e.length)}function Pi(t){let e=Ci.decode(t),r=Uint8Array.from(M.default.encode(e.length));return k([r,e],r.length+e.length)}function Oi(t){let e=M.default.decode(t),r=t.slice(M.default.decode.bytes);if(r.length!==e)throw new Error("inconsistent lengths");return"u"+S(r,"base64url")}function Ui(t){let e=M.default.decode(t),r=t.slice(M.default.decode.bytes);if(r.length!==e)throw new Error("inconsistent lengths");return S(r,"base58btc")}function Ri(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=N.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=Nt(n);return k([r,o],r.length+o.length)}function Fi(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=N.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=Nt(n);return k([r,o],r.length+o.length)}function Sn(t){let e=t.slice(0,t.length-2),r=t.slice(t.length-2),n=S(e,"base32"),o=On(r);return`${n}:${o}`}var oe=L(Me(),1);function Ii(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],s=g(o);if(s.size===0){e.push([o]);continue}if(n++,n>=r.length)throw Rn("invalid address: "+t);if(s.path===!0){e.push([o,kt(r.slice(n).join("/"))]);break}e.push([o,r[n]])}return e}function Ni(t){let e=[];return t.map(r=>{let n=qe(r);return e.push(n.name),r.length>1&&r[1]!=null&&e.push(r[1]),null}),kt(e.join("/"))}function Mi(t){return t.map(e=>{Array.isArray(e)||(e=[e]);let r=qe(e);return e.length>1?[r.code,Pn(r.code,e[1])]:[r.code]})}function Mt(t){return t.map(e=>{let r=qe(e);return e[1]!=null?[r.code,Tn(r.code,e[1])]:[r.code]})}function Bt(t){return Le(k(t.map(e=>{let r=qe(e),n=Uint8Array.from(oe.default.encode(r.code));return e.length>1&&e[1]!=null&&(n=k([n,e[1]])),n})))}function Lt(t,e){return t.size>0?t.size/8:t.size===0?0:oe.default.decode(e)+(oe.default.decode.bytes??0)}function Be(t){let e=[],r=0;for(;r<t.length;){let n=oe.default.decode(t,r),o=oe.default.decode.bytes??0,s=g(n),i=Lt(s,t.slice(r+o));if(i===0){e.push([n]),r+=o;continue}let a=t.slice(r+o,r+o+i);if(r+=i+o,r>t.length)throw Rn("Invalid address Uint8Array: "+S(t,"base16"));e.push([n,a])}return e}function qt(t){let e=Be(t),r=Mt(e);return Ni(r)}function Bi(t){t=kt(t);let e=Ii(t),r=Mi(e);return Bt(r)}function Un(t){return Bi(t)}function Le(t){let e=Li(t);if(e!=null)throw e;return Uint8Array.from(t)}function Li(t){try{Be(t)}catch(e){return e}}function kt(t){return"/"+t.trim().split("/").filter(e=>e).join("/")}function Rn(t){return new Error("Error parsing address: "+t)}function qe(t){return g(t[0])}var zt=L(Me(),1);var qn=L(Nn(),1);function Mn(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 se=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},_t=function(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},ge,ye,xe,Bn,_i=Symbol.for("nodejs.util.inspect.custom"),Ln=[g("dns").code,g("dns4").code,g("dns6").code,g("dnsaddr").code],zi=[g("p2p").code,g("ipfs").code],ji=new Map,kn=Symbol.for("@multiformats/js-multiaddr/multiaddr");function Di(t){return Boolean(t?.[kn])}var _=class{constructor(e){if(ge.set(this,void 0),ye.set(this,void 0),xe.set(this,void 0),this[Bn]=!0,e==null&&(e=""),e instanceof Uint8Array)this.bytes=Le(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);this.bytes=Un(e)}else if(Di(e))this.bytes=Le(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return se(this,ge,"f")==null&&_t(this,ge,qt(this.bytes),"f"),se(this,ge,"f")}toJSON(){return this.toString()}toOptions(){let e=this.protoCodes(),r=this.toString().split("/").slice(1),n,o;if(r.length>2)Ln.includes(e[0])&&zi.includes(e[1])?(n=g("tcp").name,o=443):(n=g(r[2]).name,o=parseInt(r[3]));else if(Ln.includes(e[0]))n=g("tcp").name,o=443;else throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e[0]===41||e[0]===55?6:4,host:r[1],transport:n,port:o}}protos(){return this.protoCodes().map(e=>Object.assign({},g(e)))}protoCodes(){let e=[],r=this.bytes,n=0;for(;n<r.length;){let o=zt.default.decode(r,n),s=zt.default.decode.bytes??0,i=g(o),a=Lt(i,r.slice(n+s));n+=a+s,e.push(o)}return e}protoNames(){return this.protos().map(e=>e.name)}tuples(){return se(this,ye,"f")==null&&_t(this,ye,Be(this.bytes),"f"),se(this,ye,"f")}stringTuples(){return se(this,xe,"f")==null&&_t(this,xe,Mt(this.tuples()),"f"),se(this,xe,"f")}encapsulate(e){return e=new _(e),new _(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 _(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 _(Bt(r.slice(0,n)));return this}getPeerId(){try{let r=this.stringTuples().filter(n=>n[0]===be.ipfs.code).pop();if(r?.[1]!=null){let n=r[1];return n[0]==="Q"||n[0]==="1"?S(A.decode(`z${n}`),"base58btc"):S(m.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){let e=null;try{e=this.stringTuples().filter(r=>g(r[0]).path===!0)[0][1],e==null&&(e=null)}catch{e=null}return e}equals(e){return Mn(this.bytes,e.bytes)}async resolve(e){let r=this.protos().find(s=>s.resolvable);if(r==null)return[this];let n=ji.get(r.name);if(n==null)throw(0,qn.default)(new Error(`no available resolver for ${r.name}`),"ERR_NO_AVAILABLE_RESOLVER");return(await n(thi