ipfs-http-client
Version:
A client library for the IPFS HTTP API
27 lines (24 loc) • 160 kB
JavaScript
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.IpfsHttpClient = factory()}(typeof self !== 'undefined' ? self : this, function () {
var IpfsHttpClient=(()=>{var Vd=Object.create;var et=Object.defineProperty;var Gd=Object.getOwnPropertyDescriptor;var Wd=Object.getOwnPropertyNames;var Jd=Object.getPrototypeOf,Kd=Object.prototype.hasOwnProperty;var Go=e=>et(e,"__esModule",{value:!0});var Wo=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(r,t)=>(typeof require!="undefined"?require:r)[t]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var _=(e,r)=>()=>(e&&(r=e(e=0)),r);var w=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),I=(e,r)=>{Go(e);for(var t in r)et(e,t,{get:r[t],enumerable:!0})},Xd=(e,r,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of Wd(r))!Kd.call(e,n)&&n!=="default"&&et(e,n,{get:()=>r[n],enumerable:!(t=Gd(r,n))||t.enumerable});return e},y=e=>Xd(Go(et(e!=null?Vd(Jd(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);function Ko(e,r,t){r=r||[],t=t||0;for(var n=t;e>=np;)r[t++]=e&255|Jo,e/=128;for(;e&tp;)r[t++]=e&255|Jo,e>>>=7;return r[t]=e|0,Ko.bytes=t-n+1,r}function fn(e,r){var t=0,r=r||0,n=0,o=r,s,i=e.length;do{if(o>=i)throw fn.bytes=0,new RangeError("Could not decode varint");s=e[o++],t+=n<28?(s&Xo)<<n:(s&Xo)*Math.pow(2,n),n+=7}while(s>=sp);return fn.bytes=o-r,t}var ep,Jo,rp,tp,np,op,sp,Xo,ip,ap,cp,up,lp,fp,mp,dp,pp,hp,gp,yp,Er,Qo=_(()=>{ep=Ko,Jo=128,rp=127,tp=~rp,np=Math.pow(2,31);op=fn,sp=128,Xo=127;ip=Math.pow(2,7),ap=Math.pow(2,14),cp=Math.pow(2,21),up=Math.pow(2,28),lp=Math.pow(2,35),fp=Math.pow(2,42),mp=Math.pow(2,49),dp=Math.pow(2,56),pp=Math.pow(2,63),hp=function(e){return e<ip?1:e<ap?2:e<cp?3:e<up?4:e<lp?5:e<fp?6:e<mp?7:e<dp?8:e<pp?9:10},gp={encode:ep,decode:op,encodingLength:hp},yp=gp,Er=yp});var Pr,Ye,er,rt=_(()=>{Qo();Pr=e=>[Er.decode(e),Er.decode.bytes],Ye=(e,r,t=0)=>(Er.encode(e,r,t),r),er=e=>Er.encodingLength(e)});var Jb,Yo,he,es,rs,De=_(()=>{Jb=new Uint8Array(0),Yo=(e,r)=>{if(e===r)return!0;if(e.byteLength!==r.byteLength)return!1;for(let t=0;t<e.byteLength;t++)if(e[t]!==r[t])return!1;return!0},he=e=>{if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")},es=e=>new TextEncoder().encode(e),rs=e=>new TextDecoder().decode(e)});var tt={};I(tt,{Digest:()=>rr,create:()=>Tr,decode:()=>mn,equals:()=>dn});var Tr,mn,dn,rr,vr=_(()=>{De();rt();Tr=(e,r)=>{let t=r.byteLength,n=er(e),o=n+er(t),s=new Uint8Array(o+t);return Ye(e,s,0),Ye(t,s,n),s.set(r,o),new rr(e,t,r,s)},mn=e=>{let r=he(e),[t,n]=Pr(r),[o,s]=Pr(r.subarray(n)),i=r.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new rr(t,o,i,r)},dn=(e,r)=>e===r?!0:e.code===r.code&&e.size===r.size&&Yo(e.bytes,r.bytes),rr=class{constructor(r,t,n,o){this.code=r,this.size=t,this.digest=n,this.bytes=o}}});function bp(e,r){if(e.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<e.length;o++){var s=e.charAt(o),i=s.charCodeAt(0);if(t[i]!==255)throw new TypeError(s+" is ambiguous");t[i]=o}var a=e.length,c=e.charAt(0),f=Math.log(a)/Math.log(256),m=Math.log(256)/Math.log(a);function h(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 U=0,N=0,z=0,G=C.length;z!==G&&C[z]===0;)z++,U++;for(var ie=(G-z)*m+1>>>0,H=new Uint8Array(ie);z!==G;){for(var pe=C[z],ae=0,Y=ie-1;(pe!==0||ae<N)&&Y!==-1;Y--,ae++)pe+=256*H[Y]>>>0,H[Y]=pe%a>>>0,pe=pe/a>>>0;if(pe!==0)throw new Error("Non-zero carry");N=ae,z++}for(var ce=ie-N;ce!==ie&&H[ce]===0;)ce++;for(var Ze=c.repeat(U);ce<ie;++ce)Ze+=e.charAt(H[ce]);return Ze}function S(C){if(typeof C!="string")throw new TypeError("Expected String");if(C.length===0)return new Uint8Array;var U=0;if(C[U]!==" "){for(var N=0,z=0;C[U]===c;)N++,U++;for(var G=(C.length-U)*f+1>>>0,ie=new Uint8Array(G);C[U];){var H=t[C.charCodeAt(U)];if(H===255)return;for(var pe=0,ae=G-1;(H!==0||pe<z)&&ae!==-1;ae--,pe++)H+=a*ie[ae]>>>0,ie[ae]=H%256>>>0,H=H/256>>>0;if(H!==0)throw new Error("Non-zero carry");z=pe,U++}if(C[U]!==" "){for(var Y=G-z;Y!==G&&ie[Y]===0;)Y++;for(var ce=new Uint8Array(N+(G-Y)),Ze=N;Y!==G;)ce[Ze++]=ie[Y++];return ce}}}function k(C){var U=S(C);if(U)return U;throw new Error(`Non-${r} character`)}return{encode:h,decodeUnsafe:S,decode:k}}var wp,jp,ns,os=_(()=>{wp=bp,jp=wp,ns=jp});var ss,is,nt,as,ot,Oe,xp,Sp,D,Ee=_(()=>{os();De();ss=class{constructor(r,t,n){this.name=r,this.prefix=t,this.baseEncode=n}encode(r){if(r instanceof Uint8Array)return`${this.prefix}${this.baseEncode(r)}`;throw Error("Unknown type, must be binary type")}},is=class{constructor(r,t,n){this.name=r,this.prefix=t,this.baseDecode=n}decode(r){if(typeof r=="string")switch(r[0]){case this.prefix:return this.baseDecode(r.slice(1));default:throw Error(`Unable to decode multibase string ${JSON.stringify(r)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`)}else throw Error("Can only multibase decode strings")}or(r){let t={[this.prefix]:this,...r.decoders||{[r.prefix]:r}};return new nt(t)}},nt=class{constructor(r){this.decoders=r}or(r){let t=r.decoders||{[r.prefix]:r};return new nt({...this.decoders,...t})}decode(r){let t=r[0],n=this.decoders[t];if(n)return n.decode(r);throw RangeError(`Unable to decode multibase string ${JSON.stringify(r)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},as=class{constructor(r,t,n,o){this.name=r,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new ss(r,t,n),this.decoder=new is(r,t,o)}encode(r){return this.encoder.encode(r)}decode(r){return this.decoder.decode(r)}},ot=({name:e,prefix:r,encode:t,decode:n})=>new as(e,r,t,n),Oe=({prefix:e,name:r,alphabet:t})=>{let{encode:n,decode:o}=ns(t,r);return ot({prefix:e,name:r,encode:n,decode:s=>he(o(s))})},xp=(e,r,t,n)=>{let o={};for(let m=0;m<r.length;++m)o[r[m]]=m;let s=e.length;for(;e[s-1]==="=";)--s;let i=new Uint8Array(s*t/8|0),a=0,c=0,f=0;for(let m=0;m<s;++m){let h=o[e[m]];if(h===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<t|h,a+=t,a>=8&&(a-=8,i[f++]=255&c>>a)}if(a>=t||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return i},Sp=(e,r,t)=>{let n=r[r.length-1]==="=",o=(1<<t)-1,s="",i=0,a=0;for(let c=0;c<e.length;++c)for(a=a<<8|e[c],i+=8;i>t;)i-=t,s+=r[o&a>>i];if(i&&(s+=r[o&a<<t-i]),n)for(;s.length*t&7;)s+="=";return s},D=({name:e,prefix:r,bitsPerChar:t,alphabet:n})=>ot({prefix:r,name:e,encode(o){return Sp(o,n,t)},decode(o){return xp(o,n,t,e)}})});var Cr={};I(Cr,{base58btc:()=>Pe,base58flickr:()=>Ep});var Pe,Ep,Ar=_(()=>{Ee();Pe=Oe({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Ep=Oe({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var st={};I(st,{base32:()=>tr,base32hex:()=>Cp,base32hexpad:()=>Bp,base32hexpadupper:()=>Up,base32hexupper:()=>Ap,base32pad:()=>Tp,base32padupper:()=>vp,base32upper:()=>Pp,base32z:()=>_p});var tr,Pp,Tp,vp,Cp,Ap,Bp,Up,_p,it=_(()=>{Ee();tr=D({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Pp=D({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Tp=D({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),vp=D({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Cp=D({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Ap=D({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Bp=D({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Up=D({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),_p=D({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var pn={};I(pn,{CID:()=>p});var p,kp,Np,Ip,Br,Dp,cs,us,at,ct,Op,Rp,Lp,T=_(()=>{rt();vr();Ar();it();De();p=class{constructor(r,t,n,o){this.code=t,this.version=r,this.multihash=n,this.bytes=o,this.byteOffset=o.byteOffset,this.byteLength=o.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:ct,byteLength:ct,code:at,version:at,multihash:at,bytes:at,_baseCache:ct,asCID:ct})}toV0(){switch(this.version){case 0:return this;default:{let{code:r,multihash:t}=this;if(r!==Br)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==Dp)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return p.createV0(t)}}}toV1(){switch(this.version){case 0:{let{code:r,digest:t}=this.multihash,n=Tr(r,t);return p.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}equals(r){return r&&this.code===r.code&&this.version===r.version&&dn(this.multihash,r.multihash)}toString(r){let{bytes:t,version:n,_baseCache:o}=this;switch(n){case 0:return Np(t,o,r||Pe.encoder);default:return Ip(t,o,r||tr.encoder)}}toJSON(){return{code:this.code,version:this.version,hash:this.multihash.bytes}}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}static isCID(r){return Rp(/^0\.0/,Lp),!!(r&&(r[us]||r.asCID===r))}get toBaseEncodedString(){throw new Error("Deprecated, use .toString()")}get codec(){throw new Error('"codec" property is deprecated, use integer "code" property instead')}get buffer(){throw new Error("Deprecated .buffer property, use .bytes to get Uint8Array instead")}get multibaseName(){throw new Error('"multibaseName" property is deprecated')}get prefix(){throw new Error('"prefix" property is deprecated')}static asCID(r){if(r instanceof p)return r;if(r!=null&&r.asCID===r){let{version:t,code:n,multihash:o,bytes:s}=r;return new p(t,n,o,s||cs(t,n,o.bytes))}else if(r!=null&&r[us]===!0){let{version:t,multihash:n,code:o}=r,s=mn(n);return p.create(t,o,s)}else return null}static create(r,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");switch(r){case 0:{if(t!==Br)throw new Error(`Version 0 CID must use dag-pb (code: ${Br}) block encoding`);return new p(r,t,n,n.bytes)}case 1:{let o=cs(r,t,n.bytes);return new p(r,t,n,o)}default:throw new Error("Invalid version")}}static createV0(r){return p.create(0,Br,r)}static createV1(r,t){return p.create(1,r,t)}static decode(r){let[t,n]=p.decodeFirst(r);if(n.length)throw new Error("Incorrect length");return t}static decodeFirst(r){let t=p.inspectBytes(r),n=t.size-t.multihashSize,o=he(r.subarray(n,n+t.multihashSize));if(o.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=o.subarray(t.multihashSize-t.digestSize),i=new rr(t.multihashCode,t.digestSize,s,o);return[t.version===0?p.createV0(i):p.createV1(t.codec,i),r.subarray(t.size)]}static inspectBytes(r){let t=0,n=()=>{let[h,S]=Pr(r.subarray(t));return t+=S,h},o=n(),s=Br;if(o===18?(o=0,t=0):o===1&&(s=n()),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=t,a=n(),c=n(),f=t+c,m=f-i;return{version:o,codec:s,multihashCode:a,digestSize:c,multihashSize:m,size:f}}static parse(r,t){let[n,o]=kp(r,t),s=p.decode(o);return s._baseCache.set(n,r),s}},kp=(e,r)=>{switch(e[0]){case"Q":{let t=r||Pe;return[Pe.prefix,t.decode(`${Pe.prefix}${e}`)]}case Pe.prefix:{let t=r||Pe;return[Pe.prefix,t.decode(e)]}case tr.prefix:{let t=r||tr;return[tr.prefix,t.decode(e)]}default:{if(r==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[e[0],r.decode(e)]}}},Np=(e,r,t)=>{let{prefix:n}=t;if(n!==Pe.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let o=r.get(n);if(o==null){let s=t.encode(e).slice(1);return r.set(n,s),s}else return o},Ip=(e,r,t)=>{let{prefix:n}=t,o=r.get(n);if(o==null){let s=t.encode(e);return r.set(n,s),s}else return o},Br=112,Dp=18,cs=(e,r,t)=>{let n=er(e),o=n+er(r),s=new Uint8Array(o+t.byteLength);return Ye(e,s,0),Ye(r,s,n),s.set(t,o),s},us=Symbol.for("@ipld/js-cid/CID"),at={writable:!1,configurable:!1,enumerable:!0},ct={writable:!1,enumerable:!1,configurable:!1},Op="0.0.0-dev",Rp=(e,r)=>{if(e.test(Op))console.warn(r);else throw new Error(r)},Lp=`CID.isCID(v) is deprecated and will be removed in the next major release.
Following code pattern:
if (CID.isCID(value)) {
doSomethingWithCID(value)
}
Is replaced with:
const cid = CID.asCID(value)
if (cid) {
// Make sure to use cid instead of value
doSomethingWithCID(cid)
}
`});var Rr,Ci,wt=_(()=>{vr();Rr=({name:e,code:r,encode:t})=>new Ci(e,r,t),Ci=class{constructor(r,t,n){this.name=r,this.code=t,this.encode=n}async digest(r){if(r instanceof Uint8Array){let t=await this.encode(r);return Tr(this.code,t)}else throw Error("Unknown type, must be binary type")}}});var kn={};I(kn,{identity:()=>jt});var jt,Nn=_(()=>{wt();De();jt=Rr({name:"identity",code:0,encode:e=>he(e)})});var In={};I(In,{identity:()=>Bh});var Bh,Bi=_(()=>{Ee();De();Bh=ot({prefix:"\0",name:"identity",encode:e=>rs(e),decode:e=>es(e)})});var Dn={};I(Dn,{base2:()=>Uh});var Uh,Ui=_(()=>{Ee();Uh=D({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var On={};I(On,{base8:()=>_h});var _h,_i=_(()=>{Ee();_h=D({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var Rn={};I(Rn,{base10:()=>kh});var kh,ki=_(()=>{Ee();kh=Oe({prefix:"9",name:"base10",alphabet:"0123456789"})});var Ln={};I(Ln,{base16:()=>Nh,base16upper:()=>Ih});var Nh,Ih,Ni=_(()=>{Ee();Nh=D({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Ih=D({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var $n={};I($n,{base36:()=>Dh,base36upper:()=>Oh});var Dh,Oh,Ii=_(()=>{Ee();Dh=Oe({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Oh=Oe({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var zn={};I(zn,{base64:()=>Rh,base64pad:()=>Lh,base64url:()=>$h,base64urlpad:()=>zh});var Rh,Lh,$h,zh,Di=_(()=>{Ee();Rh=D({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Lh=D({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),$h=D({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),zh=D({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var Fn={};I(Fn,{sha256:()=>Fh,sha512:()=>Mh});var Oi,Fh,Mh,Ri=_(()=>{wt();Oi=e=>async r=>new Uint8Array(await crypto.subtle.digest(e,r)),Fh=Rr({name:"sha2-256",code:18,encode:Oi("SHA-256")}),Mh=Rr({name:"sha2-512",code:19,encode:Oi("SHA-512")})});var Mn={};I(Mn,{code:()=>Hh,decode:()=>Gh,encode:()=>Vh,name:()=>qh});var qh,Hh,Vh,Gh,Li=_(()=>{De();qh="raw",Hh=85,Vh=e=>he(e),Gh=e=>he(e)});var qn={};I(qn,{code:()=>Xh,decode:()=>Zh,encode:()=>Qh,name:()=>Kh});var Wh,Jh,Kh,Xh,Qh,Zh,$i=_(()=>{Wh=new TextEncoder,Jh=new TextDecoder,Kh="json",Xh=512,Qh=e=>Wh.encode(JSON.stringify(e)),Zh=e=>JSON.parse(Jh.decode(e))});var zi=_(()=>{T();rt();De();wt();vr()});var Lr,Fi,Mi,Hn=_(()=>{Bi();Ui();_i();ki();Ni();it();Ii();Ar();Di();Ri();Nn();Li();$i();zi();Lr={...In,...Dn,...On,...Rn,...Ln,...st,...$n,...Cr,...zn},Fi={...Fn,...kn},Mi={raw:Mn,json:qn}});var Vi=w((rj,Hi)=>{"use strict";var qi="[a-fA-F\\d:]",$e=e=>e&&e.includeBoundaries?`(?:(?<=\\s|^)(?=${qi})|(?<=${qi})(?=\\s|$))`:"",be="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",R="[a-fA-F\\d]{1,4}",xt=`
(?:
(?:${R}:){7}(?:${R}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
(?:${R}:){6}(?:${be}|:${R}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4
(?:${R}:){5}(?::${be}|(?::${R}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4
(?:${R}:){4}(?:(?::${R}){0,1}:${be}|(?::${R}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4
(?:${R}:){3}(?:(?::${R}){0,2}:${be}|(?::${R}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4
(?:${R}:){2}(?:(?::${R}){0,3}:${be}|(?::${R}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4
(?:${R}:){1}(?:(?::${R}){0,4}:${be}|(?::${R}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4
(?::(?:(?::${R}){0,5}:${be}|(?::${R}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4
)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1
`.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),Yh=new RegExp(`(?:^${be}$)|(?:^${xt}$)`),eg=new RegExp(`^${be}$`),rg=new RegExp(`^${xt}$`),Vn=e=>e&&e.exact?Yh:new RegExp(`(?:${$e(e)}${be}${$e(e)})|(?:${$e(e)}${xt}${$e(e)})`,"g");Vn.v4=e=>e&&e.exact?eg:new RegExp(`${$e(e)}${be}${$e(e)}`,"g");Vn.v6=e=>e&&e.exact?rg:new RegExp(`${$e(e)}${xt}${$e(e)}`,"g");Hi.exports=Vn});var Wi=w((tj,Gi)=>{"use strict";var Gn=Vi(),cr=e=>Gn({exact:!0}).test(e);cr.v4=e=>Gn.v4({exact:!0}).test(e);cr.v6=e=>Gn.v6({exact:!0}).test(e);cr.version=e=>cr(e)?cr.v4(e)?4:6:void 0;Gi.exports=cr});function Ji(e,r,t,n){return{name:e,prefix:r,encoder:{name:e,prefix:r,encode:t},decoder:{decode:n}}}var Ki,Wn,tg,St,Jn=_(()=>{Hn();Ki=Ji("utf8","u",e=>{let r=new TextDecoder("utf8");return"u"+r.decode(e)},e=>new TextEncoder().encode(e.substring(1))),Wn=Ji("ascii","a",e=>{let r="a";for(let t=0;t<e.length;t++)r+=String.fromCharCode(e[t]);return r},e=>{e=e.substring(1);let r=new Uint8Array(e.length);for(let t=0;t<e.length;t++)r[t]=e.charCodeAt(t);return r}),tg={utf8:Ki,"utf-8":Ki,hex:Lr.base16,latin1:Wn,ascii:Wn,binary:Wn,...Lr},St=tg});var $r={};I($r,{toString:()=>He});function He(e,r="utf8"){let t=St[r];if(!t)throw new Error(`Unsupported encoding "${r}"`);return t.encoder.encode(e).substring(1)}var ze=_(()=>{Jn()});var ea=w((ij,Yi)=>{"use strict";var Kn=Wi(),{toString:Xi}=(ze(),$r),ng=Kn,Xn=Kn.v4,Qi=Kn.v6,Zi=function(e,r,t){t=~~t;let n;if(Xn(e))n=r||new Uint8Array(t+4),e.split(/\./g).map(function(o){n[t++]=parseInt(o,10)&255});else if(Qi(e)){let o=e.split(":",8),s;for(s=0;s<o.length;s++){let i=Xn(o[s]),a;i&&(a=Zi(o[s]),o[s]=Xi(a.slice(0,2),"base16")),a&&++s<8&&o.splice(s,0,Xi(a.slice(2,4),"base16"))}if(o[0]==="")for(;o.length<8;)o.unshift("0");else if(o[o.length-1]==="")for(;o.length<8;)o.push("0");else if(o.length<8){for(s=0;s<o.length&&o[s]!=="";s++);let i=[s,"1"];for(s=9-o.length;s>0;s--)i.push("0");o.splice.apply(o,i)}for(n=r||new Uint8Array(t+16),s=0;s<o.length;s++){let i=parseInt(o[s],16);n[t++]=i>>8&255,n[t++]=i&255}}if(!n)throw Error("Invalid ip address: "+e);return n},og=function(e,r,t){r=~~r,t=t||e.length-r;let n=[],o,s=new DataView(e.buffer);if(t===4){for(let i=0;i<t;i++)n.push(e[r+i]);o=n.join(".")}else if(t===16){for(let i=0;i<t;i+=2)n.push(s.getUint16(r+i).toString(16));o=n.join(":"),o=o.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3"),o=o.replace(/:{3,4}/,"::")}return o};Yi.exports={isIP:ng,isV4:Xn,isV6:Qi,toBytes:Zi,toString:og}});var Et=w((aj,ta)=>{"use strict";function X(e){if(typeof e=="number"){if(X.codes[e])return X.codes[e];throw new Error("no protocol with code: "+e)}else if(typeof e=="string"){if(X.names[e])return X.names[e];throw new Error("no protocol with name: "+e)}throw new Error("invalid protocol id type: "+e)}var fe=-1;X.lengthPrefixedVarSize=fe;X.V=fe;X.table=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,fe,"ip6zone"],[53,fe,"dns","resolvable"],[54,fe,"dns4","resolvable"],[55,fe,"dns6","resolvable"],[56,fe,"dnsaddr","resolvable"],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,fe,"unix",!1,"path"],[421,fe,"ipfs"],[421,fe,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,fe,"garlic64"],[460,0,"quic"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,fe,"memory"]];X.names={};X.codes={};X.table.map(e=>{let r=ra.apply(null,e);return X.codes[r.code]=r,X.names[r.name]=r,null});X.object=ra;function ra(e,r,t,n,o){return{code:e,size:r,name:t,resolvable:Boolean(n),path:Boolean(o)}}ta.exports=X});var sa=w((cj,oa)=>{oa.exports=Qn;var na=128,sg=127,ig=~sg,ag=Math.pow(2,31);function Qn(e,r,t){if(Number.MAX_SAFE_INTEGER&&e>Number.MAX_SAFE_INTEGER)throw Qn.bytes=0,new RangeError("Could not encode varint");r=r||[],t=t||0;for(var n=t;e>=ag;)r[t++]=e&255|na,e/=128;for(;e&ig;)r[t++]=e&255|na,e>>>=7;return r[t]=e|0,Qn.bytes=t-n+1,r}});var ca=w((uj,aa)=>{aa.exports=Zn;var cg=128,ia=127;function Zn(e,r){var t=0,r=r||0,n=0,o=r,s,i=e.length;do{if(o>=i||n>49)throw Zn.bytes=0,new RangeError("Could not decode varint");s=e[o++],t+=n<28?(s&ia)<<n:(s&ia)*Math.pow(2,n),n+=7}while(s>=cg);return Zn.bytes=o-r,t}});var la=w((lj,ua)=>{var ug=Math.pow(2,7),lg=Math.pow(2,14),fg=Math.pow(2,21),mg=Math.pow(2,28),dg=Math.pow(2,35),pg=Math.pow(2,42),hg=Math.pow(2,49),gg=Math.pow(2,56),yg=Math.pow(2,63);ua.exports=function(e){return e<ug?1:e<lg?2:e<fg?3:e<mg?4:e<dg?5:e<pg?6:e<hg?7:e<gg?8:e<yg?9:10}});var Pt=w((fj,fa)=>{fa.exports={encode:sa(),decode:ca(),encodingLength:la()}});var ma={};I(ma,{fromString:()=>oe});function oe(e,r="utf8"){let t=St[r];if(!t)throw new Error(`Unsupported encoding "${r}"`);return t.decoder.decode(`${t.prefix}${e}`)}var Ve=_(()=>{Jn()});var Yn={};I(Yn,{concat:()=>bg});function bg(e,r){r||(r=e.reduce((o,s)=>o+s.length,0));let t=new Uint8Array(r),n=0;for(let o of e)t.set(o,n),n+=o.length;return t}var eo=_(()=>{});var ja=w((dj,wa)=>{"use strict";var Tt=ea(),da=Et(),{CID:wg}=(T(),pn),{base32:pa}=(it(),st),{base58btc:jg}=(Ar(),Cr),xg=(vr(),tt),ur=Pt(),{toString:vt}=(ze(),$r),{fromString:ha}=(Ve(),ma),{concat:Ct}=(eo(),Yn);wa.exports=zr;function zr(e,r){return r instanceof Uint8Array?zr.toString(e,r):zr.toBytes(e,r)}zr.toString=function(r,t){switch(da(r).code){case 4:case 41:return Sg(t);case 6:case 273:case 33:case 132:return ya(t).toString();case 53:case 54:case 55:case 56:case 400:case 777:return Pg(t);case 421:return vg(t);case 444:return ba(t);case 445:return ba(t);default:return vt(t,"base16")}};zr.toBytes=function(r,t){switch(da(r).code){case 4:return ga(t);case 41:return ga(t);case 6:case 273:case 33:case 132:return ro(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 777:return Eg(t);case 421:return Tg(t);case 444:return Cg(t);case 445:return Ag(t);default:return ha(t,"base16")}};function ga(e){if(!Tt.isIP(e))throw new Error("invalid ip address");return Tt.toBytes(e)}function Sg(e){let r=Tt.toString(e);if(!r||!Tt.isIP(r))throw new Error("invalid ip address");return r}function ro(e){let r=new ArrayBuffer(2);return new DataView(r).setUint16(0,e),new Uint8Array(r)}function ya(e){return new DataView(e.buffer).getUint16(e.byteOffset)}function Eg(e){let r=ha(e),t=Uint8Array.from(ur.encode(r.length));return Ct([t,r],t.length+r.length)}function Pg(e){let r=ur.decode(e);if(e=e.slice(ur.decode.bytes),e.length!==r)throw new Error("inconsistent lengths");return vt(e)}function Tg(e){let r;e[0]==="Q"||e[0]==="1"?r=xg.decode(jg.decode(`z${e}`)).bytes:r=wg.parse(e).multihash.bytes;let t=Uint8Array.from(ur.encode(r.length));return Ct([t,r],t.length+r.length)}function vg(e){let r=ur.decode(e),t=e.slice(ur.decode.bytes);if(t.length!==r)throw new Error("inconsistent lengths");return vt(t,"base58btc")}function Cg(e){let r=e.split(":");if(r.length!==2)throw new Error("failed to parse onion addr: "+r+" does not contain a port number");if(r[0].length!==16)throw new Error("failed to parse onion addr: "+r[0]+" not a Tor onion address.");let t=pa.decode("b"+r[0]),n=parseInt(r[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=ro(n);return Ct([t,o],t.length+o.length)}function Ag(e){let r=e.split(":");if(r.length!==2)throw new Error("failed to parse onion addr: "+r+" does not contain a port number");if(r[0].length!==56)throw new Error("failed to parse onion addr: "+r[0]+" not a Tor onion3 address.");let t=pa.decode("b"+r[0]),n=parseInt(r[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=ro(n);return Ct([t,o],t.length+o.length)}function ba(e){let r=e.slice(0,e.length-2),t=e.slice(e.length-2),n=vt(r,"base32"),o=ya(t);return n+":"+o}});var ka=w((pj,_a)=>{"use strict";var xa=ja(),to=Et(),Fr=Pt(),{concat:Sa}=(eo(),Yn),{toString:Bg}=(ze(),$r);_a.exports={stringToStringTuples:Ea,stringTuplesToString:Pa,tuplesToStringTuples:va,stringTuplesToTuples:Ta,bytesToTuples:no,tuplesToBytes:Ca,bytesToString:Ug,stringToBytes:Ba,fromString:_g,fromBytes:Ua,validateBytes:oo,isValidBytes:kg,cleanPath:At,ParseError:so,protoFromTuple:Mr,sizeForAddr:Aa};function Ea(e){let r=[],t=e.split("/").slice(1);if(t.length===1&&t[0]==="")return[];for(let n=0;n<t.length;n++){let o=t[n],s=to(o);if(s.size===0){r.push([o]);continue}if(n++,n>=t.length)throw so("invalid address: "+e);if(s.path){r.push([o,At(t.slice(n).join("/"))]);break}r.push([o,t[n]])}return r}function Pa(e){let r=[];return e.map(t=>{let n=Mr(t);return r.push(n.name),t.length>1&&r.push(t[1]),null}),At(r.join("/"))}function Ta(e){return e.map(r=>{Array.isArray(r)||(r=[r]);let t=Mr(r);return r.length>1?[t.code,xa.toBytes(t.code,r[1])]:[t.code]})}function va(e){return e.map(r=>{let t=Mr(r);return r[1]?[t.code,xa.toString(t.code,r[1])]:[t.code]})}function Ca(e){return Ua(Sa(e.map(r=>{let t=Mr(r),n=Uint8Array.from(Fr.encode(t.code));return r.length>1&&(n=Sa([n,r[1]])),n})))}function Aa(e,r){return e.size>0?e.size/8:e.size===0?0:Fr.decode(r)+Fr.decode.bytes}function no(e){let r=[],t=0;for(;t<e.length;){let n=Fr.decode(e,t),o=Fr.decode.bytes,s=to(n),i=Aa(s,e.slice(t+o));if(i===0){r.push([n]),t+=o;continue}let a=e.slice(t+o,t+o+i);if(t+=i+o,t>e.length)throw so("Invalid address Uint8Array: "+Bg(e,"base16"));r.push([n,a])}return r}function Ug(e){let r=no(e),t=va(r);return Pa(t)}function Ba(e){e=At(e);let r=Ea(e),t=Ta(r);return Ca(t)}function _g(e){return Ba(e)}function Ua(e){let r=oo(e);if(r)throw r;return Uint8Array.from(e)}function oo(e){try{no(e)}catch(r){return r}}function kg(e){return oo(e)===void 0}function At(e){return"/"+e.trim().split("/").filter(r=>r).join("/")}function so(e){return new Error("Error parsing address: "+e)}function Mr(e){return to(e[0])}});var Da=w((hj,Ia)=>{"use strict";function Na(e,r){for(let t in r)Object.defineProperty(e,t,{value:r[t],enumerable:!0,configurable:!0});return e}function Ng(e,r,t){if(!e||typeof e=="string")throw new TypeError("Please pass an Error to err-code");t||(t={}),typeof r=="object"&&(t=r,r=""),r&&(t.code=r);try{return Na(e,t)}catch(n){t.message=e.message,t.stack=e.stack;let o=function(){};return o.prototype=Object.create(Object.getPrototypeOf(e)),Na(new o,t)}}Ia.exports=Ng});var Oa={};I(Oa,{equals:()=>Ig});function Ig(e,r){if(e===r)return!0;if(e.byteLength!==r.byteLength)return!1;for(let t=0;t<e.byteLength;t++)if(e[t]!==r[t])return!1;return!0}var Ra=_(()=>{});var F=w((gj,za)=>{"use strict";var we=ka(),lr=Et(),La=Pt(),{CID:Dg}=(T(),pn),{base58btc:Og}=(Ar(),Cr),Rg=Da(),Lg=Symbol.for("nodejs.util.inspect.custom"),{toString:Bt}=(ze(),$r),{equals:$g}=(Ra(),Oa),io=new Map,$a=Symbol.for("@multiformats/js-multiaddr/multiaddr"),W=class{constructor(r){if(r==null&&(r=""),Object.defineProperty(this,$a,{value:!0}),r instanceof Uint8Array)this.bytes=we.fromBytes(r);else if(typeof r=="string"){if(r.length>0&&r.charAt(0)!=="/")throw new Error(`multiaddr "${r}" must start with a "/"`);this.bytes=we.fromString(r)}else if(W.isMultiaddr(r))this.bytes=we.fromBytes(r.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return we.bytesToString(this.bytes)}toJSON(){return this.toString()}toOptions(){let r={},t=this.toString().split("/");return r.family=t[1]==="ip4"?4:6,r.host=t[2],r.transport=t[3],r.port=parseInt(t[4]),r}protos(){return this.protoCodes().map(r=>Object.assign({},lr(r)))}protoCodes(){let r=[],t=this.bytes,n=0;for(;n<t.length;){let o=La.decode(t,n),s=La.decode.bytes,i=lr(o);n+=we.sizeForAddr(i,t.slice(n+s))+s,r.push(o)}return r}protoNames(){return this.protos().map(r=>r.name)}tuples(){return we.bytesToTuples(this.bytes)}stringTuples(){let r=we.bytesToTuples(this.bytes);return we.tuplesToStringTuples(r)}encapsulate(r){return r=new W(r),new W(this.toString()+r.toString())}decapsulate(r){let t=r.toString(),n=this.toString(),o=n.lastIndexOf(t);if(o<0)throw new Error("Address "+this+" does not contain subaddress: "+r);return new W(n.slice(0,o))}decapsulateCode(r){let t=this.tuples();for(let n=t.length-1;n>=0;n--)if(t[n][0]===r)return new W(we.tuplesToBytes(t.slice(0,n)));return this}getPeerId(){try{let t=this.stringTuples().filter(n=>n[0]===lr.names.ipfs.code).pop();if(t&&t[1]){let n=t[1];return n[0]==="Q"||n[0]==="1"?Bt(Og.decode(`z${n}`),"base58btc"):Bt(Dg.parse(n).multihash.bytes,"base58btc")}return null}catch(r){return null}}getPath(){let r=null;try{r=this.stringTuples().filter(t=>!!lr(t[0]).path)[0][1],r||(r=null)}catch(t){r=null}return r}equals(r){return $g(this.bytes,r.bytes)}async resolve(){let r=this.protos().find(o=>o.resolvable);if(!r)return[this];let t=io.get(r.name);if(!t)throw Rg(new Error(`no available resolver for ${r.name}`),"ERR_NO_AVAILABLE_RESOLVER");return(await t(this)).map(o=>new W(o))}nodeAddress(){let r=this.protoCodes(),t=this.protoNames(),n=this.toString().split("/").slice(1);if(n.length<4)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6}/{address}/{tcp, udp}/{port}".');if(r[0]!==4&&r[0]!==41&&r[0]!==54&&r[0]!==55)throw new Error(`no protocol with name: "'${t[0]}'". Must have a valid family name: "{ip4, ip6, dns4, dns6}".`);if(n[2]!=="tcp"&&n[2]!=="udp")throw new Error(`no protocol with name: "'${t[1]}'". Must have a valid transport protocol: "{tcp, udp}".`);return{family:r[0]===41||r[0]===55?6:4,address:n[1],port:parseInt(n[3])}}isThinWaistAddress(r){let t=(r||this).protos();return!(t.length!==2||t[0].code!==4&&t[0].code!==41||t[1].code!==6&&t[1].code!==273)}static fromNodeAddress(r,t){if(!r)throw new Error("requires node address object");if(!t)throw new Error("requires transport protocol");let n;switch(r.family){case 4:n="ip4";break;case 6:n="ip6";break;default:throw Error(`Invalid addr family. Got '${r.family}' instead of 4 or 6`)}return new W("/"+[n,r.address,t,r.port].join("/"))}static isName(r){return W.isMultiaddr(r)?r.protos().some(t=>t.resolvable):!1}static isMultiaddr(r){return r instanceof W||Boolean(r&&r[$a])}[Lg](){return"<Multiaddr "+Bt(this.bytes,"base16")+" - "+we.bytesToString(this.bytes)+">"}inspect(){return"<Multiaddr "+Bt(this.bytes,"base16")+" - "+we.bytesToString(this.bytes)+">"}};W.protocols=lr;W.resolvers=io;function zg(e){return new W(e)}za.exports={Multiaddr:W,multiaddr:zg,protocols:lr,resolvers:io}});var Ma=w((yj,Fa)=>{function Fg(){return typeof window!="undefined"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process!="undefined"&&typeof process.versions=="object"&&!!process.versions.electron||typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Electron")>=0}Fa.exports=Fg});var ao=w((bj,qa)=>{"use strict";var Mg=Ma(),Ut=typeof window=="object"&&typeof document=="object"&&document.nodeType===9,qr=Mg(),qg=Ut&&!qr,Hg=qr&&!Ut,Vg=qr&&Ut,Gg=typeof Wo=="function"&&typeof process!="undefined"&&typeof process.release!="undefined"&&process.release.name==="node"&&!qr,Wg=typeof importScripts=="function"&&typeof self!="undefined"&&typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope,Jg=typeof process!="undefined"&&typeof process.env!="undefined"&&!1,Kg=typeof navigator!="undefined"&&navigator.product==="ReactNative";qa.exports={isTest:Jg,isElectron:qr,isElectronMain:Hg,isElectronRenderer:Vg,isNode:Gg,isBrowser:qg,isWebWorker:Wg,isEnvWithDom:Ut,isReactNative:Kg}});var Wa=w((jj,Ga)=>{var fr=1e3,mr=fr*60,dr=mr*60,Ge=dr*24,Qg=Ge*7,Zg=Ge*365.25;Ga.exports=function(e,r){r=r||{};var t=typeof e;if(t==="string"&&e.length>0)return Yg(e);if(t==="number"&&isFinite(e))return r.long?ry(e):ey(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Yg(e){if(e=String(e),!(e.length>100)){var r=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!!r){var t=parseFloat(r[1]),n=(r[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return t*Zg;case"weeks":case"week":case"w":return t*Qg;case"days":case"day":case"d":return t*Ge;case"hours":case"hour":case"hrs":case"hr":case"h":return t*dr;case"minutes":case"minute":case"mins":case"min":case"m":return t*mr;case"seconds":case"second":case"secs":case"sec":case"s":return t*fr;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function ey(e){var r=Math.abs(e);return r>=Ge?Math.round(e/Ge)+"d":r>=dr?Math.round(e/dr)+"h":r>=mr?Math.round(e/mr)+"m":r>=fr?Math.round(e/fr)+"s":e+"ms"}function ry(e){var r=Math.abs(e);return r>=Ge?_t(e,r,Ge,"day"):r>=dr?_t(e,r,dr,"hour"):r>=mr?_t(e,r,mr,"minute"):r>=fr?_t(e,r,fr,"second"):e+" ms"}function _t(e,r,t,n){var o=r>=t*1.5;return Math.round(e/t)+" "+n+(o?"s":"")}});var Ka=w((xj,Ja)=>{function ty(e){t.debug=t,t.default=t,t.coerce=c,t.disable=s,t.enable=o,t.enabled=i,t.humanize=Wa(),t.destroy=f,Object.keys(e).forEach(m=>{t[m]=e[m]}),t.names=[],t.skips=[],t.formatters={};function r(m){let h=0;for(let S=0;S<m.length;S++)h=(h<<5)-h+m.charCodeAt(S),h|=0;return t.colors[Math.abs(h)%t.colors.length]}t.selectColor=r;function t(m){let h,S=null,k,C;function U(...N){if(!U.enabled)return;let z=U,G=Number(new Date),ie=G-(h||G);z.diff=ie,z.prev=h,z.curr=G,h=G,N[0]=t.coerce(N[0]),typeof N[0]!="string"&&N.unshift("%O");let H=0;N[0]=N[0].replace(/%([a-zA-Z%])/g,(ae,Y)=>{if(ae==="%%")return"%";H++;let ce=t.formatters[Y];if(typeof ce=="function"){let Ze=N[H];ae=ce.call(z,Ze),N.splice(H,1),H--}return ae}),t.formatArgs.call(z,N),(z.log||t.log).apply(z,N)}return U.namespace=m,U.useColors=t.useColors(),U.color=t.selectColor(m),U.extend=n,U.destroy=t.destroy,Object.defineProperty(U,"enabled",{enumerable:!0,configurable:!1,get:()=>S!==null?S:(k!==t.namespaces&&(k=t.namespaces,C=t.enabled(m)),C),set:N=>{S=N}}),typeof t.init=="function"&&t.init(U),U}function n(m,h){let S=t(this.namespace+(typeof h=="undefined"?":":h)+m);return S.log=this.log,S}function o(m){t.save(m),t.namespaces=m,t.names=[],t.skips=[];let h,S=(typeof m=="string"?m:"").split(/[\s,]+/),k=S.length;for(h=0;h<k;h++)!S[h]||(m=S[h].replace(/\*/g,".*?"),m[0]==="-"?t.skips.push(new RegExp("^"+m.substr(1)+"$")):t.names.push(new RegExp("^"+m+"$")))}function s(){let m=[...t.names.map(a),...t.skips.map(a).map(h=>"-"+h)].join(",");return t.enable(""),m}function i(m){if(m[m.length-1]==="*")return!0;let h,S;for(h=0,S=t.skips.length;h<S;h++)if(t.skips[h].test(m))return!1;for(h=0,S=t.names.length;h<S;h++)if(t.names[h].test(m))return!0;return!1}function a(m){return m.toString().substring(2,m.toString().length-2).replace(/\.\*\?$/,"*")}function c(m){return m instanceof Error?m.stack||m.message:m}function f(){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}Ja.exports=ty});var co=w((se,kt)=>{se.formatArgs=oy;se.save=sy;se.load=iy;se.useColors=ny;se.storage=ay();se.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();se.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 ny(){return typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function oy(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+kt.exports.humanize(this.diff),!this.useColors)return;let r="color: "+this.color;e.splice(1,0,r,"color: inherit");let t=0,n=0;e[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(t++,o==="%c"&&(n=t))}),e.splice(n,0,r)}se.log=console.debug||console.log||(()=>{});function sy(e){try{e?se.storage.setItem("debug",e):se.storage.removeItem("debug")}catch(r){}}function iy(){let e;try{e=se.storage.getItem("debug")}catch(r){}return!e&&typeof process!="undefined"&&"env"in process&&(e=process.env.DEBUG),e}function ay(){try{return localStorage}catch(e){}}kt.exports=Ka()(se);var{formatters:cy}=kt.exports;cy.j=function(e){try{return JSON.stringify(e)}catch(r){return"[UnexpectedJSONParseError]: "+r.message}}});var uo=w(Nt=>{"use strict";var Xa=class extends Error{constructor(r="Request timed out"){super(r);this.name="TimeoutError"}};Nt.TimeoutError=Xa;var Qa=class extends Error{constructor(r="The operation was aborted."){super(r);this.name="AbortError"}};Nt.AbortError=Qa;var Za=class extends Error{constructor(r){super(r.statusText);this.name="HTTPError",this.response=r}};Nt.HTTPError=Za});var Ya=w(()=>{});var Hr=w((pr,ec)=>{"use strict";var uy=function(){if(typeof self!="undefined")return self;if(typeof window!="undefined")return window;if(typeof _e!="undefined")return _e;throw new Error("unable to locate global object")},_e=uy();ec.exports=pr=_e.fetch;_e.fetch&&(pr.default=_e.fetch.bind(_e));pr.Headers=_e.Headers;pr.Request=_e.Request;pr.Response=_e.Response});var rc=w((Tj,lo)=>{"use strict";globalThis.fetch&&globalThis.Headers&&globalThis.Request&&globalThis.Response?lo.exports={default:globalThis.fetch,Headers:globalThis.Headers,Request:globalThis.Request,Response:globalThis.Response}:lo.exports={default:Hr().default,Headers:Hr().Headers,Request:Hr().Request,Response:Hr().Response}});var tc=w((vj,fo)=>{"use strict";var{isElectronMain:ly}=ao();ly?fo.exports=Ya():fo.exports=rc()});var ic=w((Cj,sc)=>{"use strict";var{TimeoutError:fy,AbortError:my}=uo(),{Response:nc,Request:dy,Headers:mo,default:py}=tc(),hy=(e,r={})=>{let t=new XMLHttpRequest;t.open(r.method||"GET",e.toString(),!0);let{timeout:n,headers:o}=r;if(n&&n>0&&n<1/0&&(t.timeout=n),r.overrideMimeType!=null&&t.overrideMimeType(r.overrideMimeType),o)for(let[s,i]of new mo(o))t.setRequestHeader(s,i);return r.signal&&(r.signal.onabort=()=>t.abort()),r.onUploadProgress&&(t.upload.onprogress=r.onUploadProgress),t.responseType="arraybuffer",new Promise((s,i)=>{let a=c=>{switch(c.type){case"error":{s(nc.error());break}case"load":{s(new oc(t.responseURL,t.response,{status:t.status,statusText:t.statusText,headers:by(t.getAllResponseHeaders())}));break}case"timeout":{i(new fy);break}case"abort":{i(new my);break}default:break}};t.onerror=a,t.onload=a,t.ontimeout=a,t.onabort=a,t.send(r.body)})},gy=py,yy=(e,r={})=>r.onUploadProgress!=null?hy(e,r):gy(e,r),by=e=>{let r=new mo;for(let t of e.trim().split(/[\r\n]+/)){let n=t.indexOf(": ");n>0&&r.set(t.slice(0,n),t.slice(n+1))}return r},oc=class extends nc{constructor(r,t,n){super(t,n);Object.defineProperty(this,"url",{value:r})}};sc.exports={fetch:yy,Request:dy,Headers:mo}});var cc=w((Aj,ac)=>{"use strict";ac.exports=e=>{if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let r=Object.getPrototypeOf(e);return r===null||r===Object.prototype}});var ho=w((mc,dc)=>{"use strict";var It=cc(),{hasOwnProperty:uc}=Object.prototype,{propertyIsEnumerable:wy}=Object,hr=(e,r,t)=>Object.defineProperty(e,r,{value:t,writable:!0,enumerable:!0,configurable:!0}),jy=mc,lc={concatArrays:!1,ignoreUndefined:!1},Dt=e=>{let r=[];for(let t in e)uc.call(e,t)&&r.push(t);if(Object.getOwnPropertySymbols){let t=Object.getOwnPropertySymbols(e);for(let n of t)wy.call(e,n)&&r.push(n)}return r};function gr(e){return Array.isArray(e)?xy(e):It(e)?Sy(e):e}function xy(e){let r=e.slice(0,0);return Dt(e).forEach(t=>{hr(r,t,gr(e[t]))}),r}function Sy(e){let r=Object.getPrototypeOf(e)===null?Object.create(null):{};return Dt(e).forEach(t=>{hr(r,t,gr(e[t]))}),r}var fc=(e,r,t,n)=>(t.forEach(o=>{typeof r[o]=="undefined"&&n.ignoreUndefined||(o in e&&e[o]!==Object.getPrototypeOf(e)?hr(e,o,po(e[o],r[o],n)):hr(e,o,gr(r[o])))}),e),Ey=(e,r,t)=>{let n=e.slice(0,0),o=0;return[e,r].forEach(s=>{let i=[];for(let a=0;a<s.length;a++)!uc.call(s,a)||(i.push(String(a)),s===e?hr(n,o++,s[a]):hr(n,o++,gr(s[a])));n=fc(n,s,Dt(s).filter(a=>!i.includes(a)),t)}),n};function po(e,r,t){return t.concatArrays&&Array.isArray(e)&&Array.isArray(r)?Ey(e,r,t):!It(r)||!It(e)?gr(r):fc(e,r,Dt(r),t)}dc.exports=function(...e){let r=po(gr(lc),this!==jy&&this||{},lc),t={_:{}};for(let n of e)if(n!==void 0){if(!It(n))throw new TypeError("`"+n+"` is not an Option Object");t=po(t,{_:n},r)}return t._}});var go=w((Bj,gc)=>{"use strict";var Py=typeof navigator!="undefined"&&navigator.product==="ReactNative";function Ty(){return Py?"http://localhost":self.location?self.location.protocol+"//"+self.location.host:""}var Vr=self.URL,pc=Ty(),hc=class{constructor(r="",t=pc){this.super=new Vr(r,t),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(r){this.super.hash=r}set host(r){this.super.host=r}set hostname(r){this.super.hostname=r}set href(r){this.super.href=r}set password(r){this.super.password=r}set pathname(r){this.super.pathname=r}set port(r){this.super.port=r}set protocol(r){this.super.protocol=r}set search(r){this.super.search=r}set username(r){this.super.username=r}static createObjectURL(r){return Vr.createObjectURL(r)}static revokeObjectURL(r){Vr.revokeObjectURL(r)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}};function vy(e){if(typeof e=="string")return new Vr(e).toString();if(!(e instanceof Vr)){let r=e.username&&e.password?`${e.username}:${e.password}@`:"",t=e.auth?e.auth+"@":"",n=e.port?":"+e.port:"",o=e.protocol?e.protocol+"//":"",s=e.host||"",i=e.hostname||"",a=e.search||(e.query?"?"+e.query:""),c=e.hash||"",f=e.pathname||"",m=e.path||f+a;return`${o}${r||t}${s||i+n}${m}${c}`}}gc.exports={URLWithLegacySupport:hc,URLSearchParams:self.URLSearchParams,defaultBase:pc,format:vy}});var wc=w((Uj,bc)=>{"use strict";var{URLWithLegacySupport:yc,format:Cy}=go();bc.exports=(e,r={},t={},n)=>{let o=r.protocol?r.protocol.replace(":",""):"http";o=(t[o]||n||o)+":";let s;try{s=new yc(e)}catch(a){s={}}let i=Object.assign({},r,{protocol:o||s.protocol,host:r.host||s.host});return new yc(e,Cy(i)).toString()}});var xc=w((_j,jc)=>{"use strict";var{URLWithLegacySupport:Ay,format:By,URLSearchParams:Uy,defaultBase:_y}=go(),ky=wc();jc.exports={URL:Ay,URLSearchParams:Uy,format:By,relative:ky,defaultBase:_y}});var Ec=w((kj,Ot)=>{"use strict";var{AbortController:Sc,AbortSignal:Ny}=typeof self!="undefined"?self:typeof window!="undefined"?window:void 0;Ot.exports=Sc;Ot.exports.AbortSignal=Ny;Ot.exports.default=Sc});var Q=w((Nj,yo)=>{"use strict";var Rt;globalThis.AbortController&&globalThis.AbortSignal?Rt=globalThis:Rt=Ec();yo.exports.AbortSignal=Rt.AbortSignal;yo.exports.AbortController=Rt.AbortController});var wo=w((Ij,bo)=>{var{AbortController:Iy}=Q();function Pc(e){let r=new Iy;function t(){r.abort();for(let n of e)!n||!n.removeEventListener||n.removeEventListener("abort",t)}for(let n of e)if(!(!n||!n.addEventListener)){if(n.aborted){t();break}n.addEventListener("abort",t)}return r.signal}bo.exports=Pc;bo.exports.anySignal=Pc});var xo=w((Dj,Uc)=>{"use strict";var{fetch:Dy,Request:Oy,Headers:Ry}=ic(),{TimeoutError:jo,HTTPError:Tc}=uo(),vc=ho().bind({ignoreUndefined:!0}),{URL:Cc,URLSearchParams:Ac}=xc(),{AbortController:Ly}=Q(),$y=wo(),zy=(e,r,t)=>{if(r===void 0)return e;let n=Date.now(),o=()=>Date.now()-n>=r;return new Promise((s,i)=>{let a=setTimeout(()=>{o()&&(i(new jo),t.abort())},r),c=f=>h=>{if(clearTimeout(a),o()){i(new jo);return}f(h)};e.then(c(s),c(i))})},Fy={throwHttpErrors:!0,credentials:"same-origin"},J=class{constructor(r={}){this.opts=vc(Fy,r)}async fetch(r,t={}){let n=vc(this.opts,t),o=new Ry(n.headers);if(typeof r!="string"&&!(r instanceof Cc||r instanceof Oy))throw new TypeError("`resource` must be a string, URL, or Request");let s=new Cc(r.toString(),n.base),{searchParams:i,transformSearchParams:a,json:c}=n;i&&(typeof a=="function"?s.search=a(new Ac(n.searchParams)):s.search=new Ac(n.searchParams)),c&&(n.body=JSON.stringify(n.json),o.set("content-type","application/json"));let f=new Ly,m=$y([f.signal,n.signal]),h=await zy(Dy(s.toString(),{...n,signal:m,timeout:void 0,headers:o}),n.timeout,f);if(!h.ok&&n.throwHttpErrors)throw n.handleError&&await n.handleError(h),new Tc(h);return h.iterator=function(){return Bc(h.body)},h.ndjson=async function*(){for await(let S of My(h.iterator()))t.transform?yield t.transform(S):yield S},h}post(r,t={}){return this.fetch(r,{...t,method:"POST"})}get(r,t={}){return this.fetch(r,{...t,method:"GET"})}put(r,t={}){return this.fetch(r,{...t,method:"PUT"})}delete(r,t={}){return this.fetch(r,{...t,method:"DELETE"})}options(r,t={}){return this.fetch(r,{...t,method:"OPTIONS"})}},My=async function*(e){let r=new TextDecoder,t="";for await(let n of e){t+=r.decode(n,{stream:!0});let o=t.split(/\r?\n/);for(let s=0;s<o.length-1;s++){let i=o[s].trim();i.length>0&&(yield JSON.parse(i))}t=o[o.length-1]}t+=r.decode(),t=t.trim(),t.length!==0&&(yield JSON.parse(t))},Bc=e=>{if(Vy(e)){let r=e[Symbol.asyncIterator]();return{[Symbol.asyncIterator](){return{next:r.next.bind(r),return(t){return e.destroy(),typeof r.return=="function"?r.return():Promise.resolve({done:!0,value:t})}}}}}if(Hy(e)){let r=e.getReader();return async function*(){try{for(;;){let{done:t,value:n}=await r.read();if(t)return;n&&(yield n)}}finally{r.releaseLock()}}()}if(qy(e))return e;throw new TypeError("Body can't be converted to AsyncIterable")},qy=e=>typeof e=="object"&&e!==null&&typeof e[Symbol.asyncIterator]=="function",Hy=e=>e&&typeof e.getReader=="function",Vy=e=>Object.prototype.hasOwnProperty.call(e,"readable")&&Object.prototype.hasOwnProperty.call(e,"writable");J.HTTPError=Tc;J.TimeoutError=jo;J.streamToAsyncIterator=Bc;J.post=(e,r)=>new J(r).post(e,r);J.get=(e,r)=>new J(r).get(e,r);J.put=(e,r)=>new J(r).put(e,r);J.delete=(e,r)=>new J(r).delete(e,r);J.options=(e,r)=>new J(r).options(e,r);Uc.exports=J});var Ic=w((Rj,Nc)=>{var{Multiaddr:Gy}=F(),Lt=(e,r)=>r,Wy=(e,r,t,n)=>{if(n&&n.assumeHttp===!1)return`tcp://${e}:${r}`;let o="tcp",s=`:${r}`;return t[t.length-1].protocol==="tcp"&&(o=r==="443"?"https":"http",s=r==="443"||r==="80"?"":s),`${o}://${e}${s}`},Jy={ip4:Lt,ip6:(e,r,t,n)=>n.length===1&&n[0].protocol==="ip6"?r:`[${r}]`,tcp:(e,r,t,n,o)=>n.some(s=>["http","https","ws","wss"].includes(s.protocol))?`${e}:${r}`:Wy(e,r,n,o),udp:(e,r)=>`udp://${e}:${r}`,dnsaddr:Lt,dns4:Lt,dns6:Lt,ipfs:(e,r)=>`${e}/ipfs/${r}`,p2p:(e,r)=>`${e}/p2p/${r}`,http:e=>`http://${e}`,https:e=>`https://${e}`,ws:e=>`ws://${e}`,wss:e=>`wss://${e}`,"p2p-websocket-star":e=>`${e}/p2p-websocket-star`,"p2p-webrtc-star":e=>`${e}/p2p-webrtc-star`,"p2p-webrtc-direct":e=>`${e}/p2p-webrtc-direct`};Nc.exports=(e,r)=>{let t=new Gy(e),n=e.toString().split("/").slice(1);return t.tuples().map(o=>({protocol:n.shift(),content:o[1]?n.shift():null})).reduce((o,s,i,a)=>{let c=Jy[s.protocol];if(!c)throw new Error(`Unsupported protocol ${s.protocol}`);return c(o,s.content,i,a,r)},"")}});var Ke=w((Kj,Mc)=>{"use strict";function Fc(e,r){for(let t in r)Object.defineProperty(e,t,{value:r[t],enumerable:!0,configurable:!0});return e}function nb(e,r,t){if(!e||typeof e=="string")throw new TypeError("Please pass an Error to err-code");t||(t={}),typeof r=="object"&&(t=r,r=""),r&&(t.code=r);try{return Fc(e,t)}catch(n){t.message=e.message,t.stack=e.stac