@multiformats/mafmt
Advanced tools
Comparing version 12.1.3 to 12.1.4
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.MultiformatsMafmt = factory()}(typeof self !== 'undefined' ? self : this, function () { | ||
"use strict";var MultiformatsMafmt=(()=>{var yr=Object.create;var fe=Object.defineProperty;var vr=Object.getOwnPropertyDescriptor;var Sr=Object.getOwnPropertyNames;var Ar=Object.getPrototypeOf,Er=Object.prototype.hasOwnProperty;var ue=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),y=(r,e)=>{for(var t in e)fe(r,t,{get:e[t],enumerable:!0})},ht=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Sr(e))!Er.call(r,o)&&o!==t&&fe(r,o,{get:()=>e[o],enumerable:!(n=vr(e,o))||n.enumerable});return r};var Pe=(r,e,t)=>(t=r!=null?yr(Ar(r)):{},ht(e||!r||!r.__esModule?fe(t,"default",{value:r,enumerable:!0}):t,r)),Tr=r=>ht(fe({},"__esModule",{value:!0}),r);var $t=ue((vs,Dt)=>{Dt.exports=He;var Ft=128,Vn=127,Fn=~Vn,Dn=Math.pow(2,31);function He(r,e,t){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw He.bytes=0,new RangeError("Could not encode varint");e=e||[],t=t||0;for(var n=t;r>=Dn;)e[t++]=r&255|Ft,r/=128;for(;r&Fn;)e[t++]=r&255|Ft,r>>>=7;return e[t]=r|0,He.bytes=t-n+1,e}});var Ot=ue((Ss,Rt)=>{Rt.exports=Ke;var $n=128,Lt=127;function Ke(r,n){var t=0,n=n||0,o=0,s=n,c,p=r.length;do{if(s>=p||o>49)throw Ke.bytes=0,new RangeError("Could not decode varint");c=r[s++],t+=o<28?(c&Lt)<<o:(c&Lt)*Math.pow(2,o),o+=7}while(c>=$n);return Ke.bytes=s-n,t}});var qt=ue((As,jt)=>{var Ln=Math.pow(2,7),Rn=Math.pow(2,14),On=Math.pow(2,21),jn=Math.pow(2,28),qn=Math.pow(2,35),Wn=Math.pow(2,42),Gn=Math.pow(2,49),Jn=Math.pow(2,56),Xn=Math.pow(2,63);jt.exports=function(r){return r<Ln?1:r<Rn?2:r<On?3:r<jn?4:r<qn?5:r<Wn?6:r<Gn?7:r<Jn?8:r<Xn?9:10}});var we=ue((Es,Wt)=>{Wt.exports={encode:$t(),decode:Ot(),encodingLength:qt()}});var Io={};y(Io,{Circuit:()=>L,DNS:()=>O,DNS4:()=>ur,DNS6:()=>dr,DNSADDR:()=>lr,HTTP:()=>Te,HTTPS:()=>Ie,IP:()=>ce,IPFS:()=>Eo,P2P:()=>gr,P2PWebRTCDirect:()=>lt,P2PWebRTCStar:()=>dt,QUIC:()=>mr,QUICV1:()=>br,Reliable:()=>j,Stardust:()=>Ao,TCP:()=>G,UDP:()=>ae,UTP:()=>hr,WebRTC:()=>To,WebRTCDirect:()=>ft,WebSocketStar:()=>So,WebSockets:()=>ee,WebSocketsSecure:()=>te,WebTransport:()=>ut});var de=class extends Error{code;props;constructor(e,t,n){super(e),this.code=t,this.name=n?.name??"CodeError",this.props=n??{}}};var Be={};y(Be,{base58btc:()=>g,base58flickr:()=>kr});function Ir(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var o=0;o<r.length;o++){var s=r.charAt(o),c=s.charCodeAt(0);if(t[c]!==255)throw new TypeError(s+" is ambiguous");t[c]=o}var p=r.length,m=r.charAt(0),A=Math.log(p)/Math.log(256),b=Math.log(256)/Math.log(p);function E(f){if(f instanceof Uint8Array||(ArrayBuffer.isView(f)?f=new Uint8Array(f.buffer,f.byteOffset,f.byteLength):Array.isArray(f)&&(f=Uint8Array.from(f))),!(f instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(f.length===0)return"";for(var w=0,q=0,T=0,P=f.length;T!==P&&f[T]===0;)T++,w++;for(var C=(P-T)*b+1>>>0,S=new Uint8Array(C);T!==P;){for(var U=f[T],D=0,I=C-1;(U!==0||D<q)&&I!==-1;I--,D++)U+=256*S[I]>>>0,S[I]=U%p>>>0,U=U/p>>>0;if(U!==0)throw new Error("Non-zero carry");q=D,T++}for(var k=C-q;k!==C&&S[k]===0;)k++;for(var pe=m.repeat(w);k<C;++k)pe+=r.charAt(S[k]);return pe}function F(f){if(typeof f!="string")throw new TypeError("Expected String");if(f.length===0)return new Uint8Array;var w=0;if(f[w]!==" "){for(var q=0,T=0;f[w]===m;)q++,w++;for(var P=(f.length-w)*A+1>>>0,C=new Uint8Array(P);f[w];){var S=t[f.charCodeAt(w)];if(S===255)return;for(var U=0,D=P-1;(S!==0||U<T)&&D!==-1;D--,U++)S+=p*C[D]>>>0,C[D]=S%256>>>0,S=S/256>>>0;if(S!==0)throw new Error("Non-zero carry");T=U,w++}if(f[w]!==" "){for(var I=P-T;I!==P&&C[I]===0;)I++;for(var k=new Uint8Array(q+(P-I)),pe=q;I!==P;)k[pe++]=C[I++];return k}}}function v(f){var w=F(f);if(w)return w;throw new Error(`Non-${e} character`)}return{encode:E,decodeUnsafe:F,decode:v}}var Pr=Ir,Cr=Pr,mt=Cr;var Bo=new Uint8Array(0);var bt=(r,e)=>{if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0},B=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")};var wt=r=>new TextEncoder().encode(r),gt=r=>new TextDecoder().decode(r);var Ce=class{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Ue=class{constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return yt(this,e)}},Ne=class{constructor(e){this.decoders=e}or(e){return yt(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},yt=(r,e)=>new Ne({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),ke=class{constructor(e,t,n,o){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new Ce(e,t,n),this.decoder=new Ue(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},J=({name:r,prefix:e,encode:t,decode:n})=>new ke(r,e,t,n),$=({prefix:r,name:e,alphabet:t})=>{let{encode:n,decode:o}=mt(t,e);return J({prefix:r,name:e,encode:n,decode:s=>B(o(s))})},Ur=(r,e,t,n)=>{let o={};for(let b=0;b<e.length;++b)o[e[b]]=b;let s=r.length;for(;r[s-1]==="=";)--s;let c=new Uint8Array(s*t/8|0),p=0,m=0,A=0;for(let b=0;b<s;++b){let E=o[r[b]];if(E===void 0)throw new SyntaxError(`Non-${n} character`);m=m<<t|E,p+=t,p>=8&&(p-=8,c[A++]=255&m>>p)}if(p>=t||255&m<<8-p)throw new SyntaxError("Unexpected end of data");return c},Nr=(r,e,t)=>{let n=e[e.length-1]==="=",o=(1<<t)-1,s="",c=0,p=0;for(let m=0;m<r.length;++m)for(p=p<<8|r[m],c+=8;c>t;)c-=t,s+=e[o&p>>c];if(c&&(s+=e[o&p<<t-c]),n)for(;s.length*t&7;)s+="=";return s},l=({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>J({prefix:e,name:r,encode(o){return Nr(o,n,t)},decode(o){return Ur(o,n,t,r)}});var g=$({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),kr=$({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Br=At,vt=128,zr=127,Mr=~zr,Vr=Math.pow(2,31);function At(r,e,t){e=e||[],t=t||0;for(var n=t;r>=Vr;)e[t++]=r&255|vt,r/=128;for(;r&Mr;)e[t++]=r&255|vt,r>>>=7;return e[t]=r|0,At.bytes=t-n+1,e}var Fr=ze,Dr=128,St=127;function ze(r,n){var t=0,n=n||0,o=0,s=n,c,p=r.length;do{if(s>=p)throw ze.bytes=0,new RangeError("Could not decode varint");c=r[s++],t+=o<28?(c&St)<<o:(c&St)*Math.pow(2,o),o+=7}while(c>=Dr);return ze.bytes=s-n,t}var $r=Math.pow(2,7),Lr=Math.pow(2,14),Rr=Math.pow(2,21),Or=Math.pow(2,28),jr=Math.pow(2,35),qr=Math.pow(2,42),Wr=Math.pow(2,49),Gr=Math.pow(2,56),Jr=Math.pow(2,63),Xr=function(r){return r<$r?1:r<Lr?2:r<Rr?3:r<Or?4:r<jr?5:r<qr?6:r<Wr?7:r<Gr?8:r<Jr?9:10},Qr={encode:Br,decode:Fr,encodingLength:Xr},Hr=Qr,re=Hr;var ne=(r,e=0)=>[re.decode(r,e),re.decode.bytes],X=(r,e,t=0)=>(re.encode(r,e,t),e),Q=r=>re.encodingLength(r);var W=(r,e)=>{let t=e.byteLength,n=Q(r),o=n+Q(t),s=new Uint8Array(o+t);return X(r,s,0),X(t,s,n),s.set(e,o),new H(r,t,e,s)},he=r=>{let e=B(r),[t,n]=ne(e),[o,s]=ne(e.subarray(n)),c=e.subarray(n+s);if(c.byteLength!==o)throw new Error("Incorrect length");return new H(t,o,c,e)},Et=(r,e)=>{if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&bt(r.bytes,t.bytes)}},H=class{constructor(e,t,n,o){this.code=e,this.size=t,this.digest=n,this.bytes=o}};var Me={};y(Me,{base32:()=>z,base32hex:()=>Yr,base32hexpad:()=>tn,base32hexpadupper:()=>rn,base32hexupper:()=>en,base32pad:()=>Zr,base32padupper:()=>_r,base32upper:()=>Kr,base32z:()=>nn});var z=l({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Kr=l({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Zr=l({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),_r=l({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Yr=l({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),en=l({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),tn=l({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),rn=l({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),nn=l({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Tt=(r,e)=>{let{bytes:t,version:n}=r;switch(n){case 0:return sn(t,Ve(r),e||g.encoder);default:return cn(t,Ve(r),e||z.encoder)}};var It=new WeakMap,Ve=r=>{let e=It.get(r);if(e==null){let t=new Map;return It.set(r,t),t}return e},d=class{constructor(e,t,n,o){this.code=t,this.version=e,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:t}=this;if(e!==oe)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==an)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return d.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,n=W(e,t);return d.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 d.equals(this,e)}static equals(e,t){let n=t;return n&&e.code===n.code&&e.version===n.version&&Et(e.multihash,n.multihash)}toString(e){return Tt(this,e)}toJSON(){return{"/":Tt(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof d)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:o,multihash:s,bytes:c}=t;return new d(n,o,s,c||Pt(n,o,s.bytes))}else if(t[pn]===!0){let{version:n,multihash:o,code:s}=t,c=he(o);return d.create(n,s,c)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==oe)throw new Error(`Version 0 CID must use dag-pb (code: ${oe}) block encoding`);return new d(e,t,n,n.bytes)}case 1:{let o=Pt(e,t,n.bytes);return new d(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return d.create(0,oe,e)}static createV1(e,t){return d.create(1,e,t)}static decode(e){let[t,n]=d.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=d.inspectBytes(e),n=t.size-t.multihashSize,o=B(e.subarray(n,n+t.multihashSize));if(o.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=o.subarray(t.multihashSize-t.digestSize),c=new H(t.multihashCode,t.digestSize,s,o);return[t.version===0?d.createV0(c):d.createV1(t.codec,c),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[E,F]=ne(e.subarray(t));return t+=F,E},o=n(),s=oe;if(o===18?(o=0,t=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let c=t,p=n(),m=n(),A=t+m,b=A-c;return{version:o,codec:s,multihashCode:p,digestSize:m,multihashSize:b,size:A}}static parse(e,t){let[n,o]=on(e,t),s=d.decode(o);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Ve(s).set(n,e),s}},on=(r,e)=>{switch(r[0]){case"Q":{let t=e||g;return[g.prefix,t.decode(`${g.prefix}${r}`)]}case g.prefix:{let t=e||g;return[g.prefix,t.decode(r)]}case z.prefix:{let t=e||z;return[z.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}},sn=(r,e,t)=>{let{prefix:n}=t;if(n!==g.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let o=e.get(n);if(o==null){let s=t.encode(r).slice(1);return e.set(n,s),s}else return o},cn=(r,e,t)=>{let{prefix:n}=t,o=e.get(n);if(o==null){let s=t.encode(r);return e.set(n,s),s}else return o},oe=112,an=18,Pt=(r,e,t)=>{let n=Q(r),o=n+Q(e),s=new Uint8Array(o+t.byteLength);return X(r,s,0),X(e,s,n),s.set(t,o),s},pn=Symbol.for("@ipld/js-cid/CID");function Ct(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}var Fe={};y(Fe,{identity:()=>fn});var fn=J({prefix:"\0",name:"identity",encode:r=>gt(r),decode:r=>wt(r)});var De={};y(De,{base2:()=>un});var un=l({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var $e={};y($e,{base8:()=>dn});var dn=l({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Le={};y(Le,{base10:()=>ln});var ln=$({prefix:"9",name:"base10",alphabet:"0123456789"});var Re={};y(Re,{base16:()=>hn,base16upper:()=>mn});var hn=l({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),mn=l({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Oe={};y(Oe,{base36:()=>bn,base36upper:()=>wn});var bn=$({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),wn=$({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var je={};y(je,{base64:()=>gn,base64pad:()=>xn,base64url:()=>yn,base64urlpad:()=>vn});var gn=l({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),xn=l({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),yn=l({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),vn=l({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var qe={};y(qe,{base256emoji:()=>In});var Ut=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}"),Sn=Ut.reduce((r,e,t)=>(r[t]=e,r),[]),An=Ut.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function En(r){return r.reduce((e,t)=>(e+=Sn[t],e),"")}function Tn(r){let e=[];for(let t of r){let n=An[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}var In=J({prefix:"\u{1F680}",name:"base256emoji",encode:En,decode:Tn});var Je={};y(Je,{sha256:()=>Pn,sha512:()=>Cn});var Ge=({name:r,code:e,encode:t})=>new We(r,e,t),We=class{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?W(this.code,t):t.then(n=>W(this.code,n))}else throw Error("Unknown type, must be binary type")}};var kt=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),Pn=Ge({name:"sha2-256",code:18,encode:kt("SHA-256")}),Cn=Ge({name:"sha2-512",code:19,encode:kt("SHA-512")});var Xe={};y(Xe,{identity:()=>kn});var Bt=0,Un="identity",zt=B,Nn=r=>W(Bt,zt(r)),kn={code:Bt,name:Un,encode:zt,digest:Nn};var ss=new TextEncoder,is=new TextDecoder;var se={...Fe,...De,...$e,...Le,...Re,...Me,...Oe,...Be,...je,...qe},us={...Je,...Xe};function Z(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function me(r=0){return globalThis.Buffer?.allocUnsafe!=null?Z(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Vt(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var Mt=Vt("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Qe=Vt("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=me(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),Mn={utf8:Mt,"utf-8":Mt,hex:se.base16,latin1:Qe,ascii:Qe,binary:Qe,...se},be=Mn;function x(r,e="utf8"){let t=be[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):t.encoder.encode(r).substring(1)}var pt=Pe(we(),1);function M(r,e){e==null&&(e=r.reduce((o,s)=>o+s.length,0));let t=me(e),n=0;for(let o of r)t.set(o,n),n+=o.length;return Z(t)}var Y=Pe(we(),1);var ge=class{index=0;input="";new(e){return this.index=0,this.input=e,this}readAtomically(e){let t=this.index,n=e();return n===void 0&&(this.index=t),n}parseWith(e){let t=e();if(this.index===this.input.length)return t}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(e){return this.readAtomically(()=>{let t=this.readChar();if(t===e)return t})}readSeparator(e,t,n){return this.readAtomically(()=>{if(!(t>0&&this.readGivenChar(e)===void 0))return n()})}readNumber(e,t,n,o){return this.readAtomically(()=>{let s=0,c=0,p=this.peekChar();if(p===void 0)return;let m=p==="0",A=2**(8*o)-1;for(;;){let b=this.readAtomically(()=>{let E=this.readChar();if(E===void 0)return;let F=Number.parseInt(E,e);if(!Number.isNaN(F))return F});if(b===void 0)break;if(s*=e,s+=b,s>A||(c+=1,t!==void 0&&c>t))return}if(c!==0)return!n&&m&&c>1?void 0:s})}readIPv4Addr(){return this.readAtomically(()=>{let e=new Uint8Array(4);for(let t=0;t<e.length;t++){let n=this.readSeparator(".",t,()=>this.readNumber(10,3,!1,1));if(n===void 0)return;e[t]=n}return e})}readIPv6Addr(){let e=t=>{for(let n=0;n<t.length/2;n++){let o=n*2;if(n<t.length-3){let c=this.readSeparator(":",n,()=>this.readIPv4Addr());if(c!==void 0)return t[o]=c[0],t[o+1]=c[1],t[o+2]=c[2],t[o+3]=c[3],[o+4,!0]}let s=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(s===void 0)return[o,!1];t[o]=s>>8,t[o+1]=s&255}return[t.length,!1]};return this.readAtomically(()=>{let t=new Uint8Array(16),[n,o]=e(t);if(n===16)return t;if(o||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let s=new Uint8Array(14),c=16-(n+2),[p]=e(s.subarray(0,c));return t.set(s.subarray(0,p),16-p),t})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var Gt=45,Qn=15,_=new ge;function Ze(r){if(!(r.length>Qn))return _.new(r).parseWith(()=>_.readIPv4Addr())}function _e(r){if(!(r.length>Gt))return _.new(r).parseWith(()=>_.readIPv6Addr())}function xe(r){if(!(r.length>Gt))return _.new(r).parseWith(()=>_.readIPAddr())}var Ds=parseInt("0xFFFF",16),$s=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);function Ye(r,e="utf8"){let t=be[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Z(globalThis.Buffer.from(r,"utf-8")):t.decoder.decode(`${t.prefix}${r}`)}var N=Pe(we(),1);function Qt(r){return!!Ze(r)}function Ht(r){return!!_e(r)}function ye(r){return!!xe(r)}var Kt=Qt,Yn=Ht,et=function(r){let e=0;if(r=r.toString().trim(),Kt(r)){let t=new Uint8Array(e+4);return r.split(/\./g).forEach(n=>{t[e++]=parseInt(n,10)&255}),t}if(Yn(r)){let t=r.split(":",8),n;for(n=0;n<t.length;n++){let s=Kt(t[n]),c;s&&(c=et(t[n]),t[n]=x(c.slice(0,2),"base16")),c!=null&&++n<8&&t.splice(n,0,x(c.slice(2,4),"base16"))}if(t[0]==="")for(;t.length<8;)t.unshift("0");else if(t[t.length-1]==="")for(;t.length<8;)t.push("0");else if(t.length<8){for(n=0;n<t.length&&t[n]!=="";n++);let s=[n,1];for(n=9-t.length;n>0;n--)s.push("0");t.splice.apply(t,s)}let o=new Uint8Array(e+16);for(n=0;n<t.length;n++){let s=parseInt(t[n],16);o[e++]=s>>8&255,o[e++]=s&255}return o}throw new Error("invalid ip address")},Zt=function(r,e=0,t){e=~~e,t=t??r.length-e;let n=new DataView(r.buffer);if(t===4){let o=[];for(let s=0;s<t;s++)o.push(r[e+s]);return o.join(".")}if(t===16){let o=[];for(let s=0;s<t;s+=2)o.push(n.getUint16(e+s).toString(16));return o.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var ie={},tt={},to=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,-1,"ip6zone"],[43,8,"ipcidr"],[53,-1,"dns",!0],[54,-1,"dns4",!0],[55,-1,"dns6",!0],[56,-1,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc-direct"],[281,0,"webrtc"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,-1,"unix",!1,!0],[421,-1,"ipfs"],[421,-1,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,-1,"garlic64"],[448,0,"tls"],[449,-1,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,-1,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,-1,"memory"]];to.forEach(r=>{let e=ro(...r);tt[e.code]=e,ie[e.name]=e});function ro(r,e,t,n,o){return{code:r,size:e,name:t,resolvable:!!n,path:!!o}}function u(r){if(typeof r=="number"){if(tt[r]!=null)return tt[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(ie[r]!=null)return ie[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var Ei=u("ip4"),Ti=u("ip6"),Ii=u("ipcidr");function rr(r,e){switch(u(r).code){case 4:case 41:return oo(e);case 42:return er(e);case 6:case 273:case 33:case 132:return or(e).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return er(e);case 421:return ao(e);case 444:return tr(e);case 445:return tr(e);case 466:return co(e);default:return x(e,"base16")}}function nr(r,e){switch(u(r).code){case 4:return _t(e);case 41:return _t(e);case 42:return Yt(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 449:case 777:return Yt(e);case 421:return so(e);case 444:return po(e);case 445:return fo(e);case 466:return io(e);default:return Ye(e,"base16")}}var rt=Object.values(se).map(r=>r.decoder),no=function(){let r=rt[0].or(rt[1]);return rt.slice(2).forEach(e=>r=r.or(e)),r}();function _t(r){if(!ye(r))throw new Error("invalid ip address");return et(r)}function oo(r){let e=Zt(r,0,r.length);if(e==null)throw new Error("ipBuff is required");if(!ye(e))throw new Error("invalid ip address");return e}function nt(r){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,r),new Uint8Array(e)}function or(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function Yt(r){let e=Ye(r),t=Uint8Array.from(N.default.encode(e.length));return M([t,e],t.length+e.length)}function er(r){let e=N.default.decode(r);if(r=r.slice(N.default.decode.bytes),r.length!==e)throw new Error("inconsistent lengths");return x(r)}function so(r){let e;r[0]==="Q"||r[0]==="1"?e=he(g.decode(`z${r}`)).bytes:e=d.parse(r).multihash.bytes;let t=Uint8Array.from(N.default.encode(e.length));return M([t,e],t.length+e.length)}function io(r){let e=no.decode(r),t=Uint8Array.from(N.default.encode(e.length));return M([t,e],t.length+e.length)}function co(r){let e=N.default.decode(r),t=r.slice(N.default.decode.bytes);if(t.length!==e)throw new Error("inconsistent lengths");return"u"+x(t,"base64url")}function ao(r){let e=N.default.decode(r),t=r.slice(N.default.decode.bytes);if(t.length!==e)throw new Error("inconsistent lengths");return x(t,"base58btc")}function po(r){let e=r.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==16)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion address.`);let t=z.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 M([t,o],t.length+o.length)}function fo(r){let e=r.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==56)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion3 address.`);let t=z.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 M([t,o],t.length+o.length)}function tr(r){let e=r.slice(0,r.length-2),t=r.slice(r.length-2),n=x(e,"base32"),o=or(t);return`${n}:${o}`}function uo(r){let e=[],t=r.split("/").slice(1);if(t.length===1&&t[0]==="")return[];for(let n=0;n<t.length;n++){let o=t[n],s=u(o);if(s.size===0){e.push([o]);continue}if(n++,n>=t.length)throw ir("invalid address: "+r);if(s.path===!0){e.push([o,at(t.slice(n).join("/"))]);break}e.push([o,t[n]])}return e}function lo(r){let e=[];return r.map(t=>{let n=Ae(t);return e.push(n.name),t.length>1&&t[1]!=null&&e.push(t[1]),null}),at(e.join("/"))}function ho(r){return r.map(e=>{Array.isArray(e)||(e=[e]);let t=Ae(e);return e.length>1?[t.code,nr(t.code,e[1])]:[t.code]})}function ot(r){return r.map(e=>{let t=Ae(e);return e[1]!=null?[t.code,rr(t.code,e[1])]:[t.code]})}function st(r){return Se(M(r.map(e=>{let t=Ae(e),n=Uint8Array.from(Y.default.encode(t.code));return e.length>1&&e[1]!=null&&(n=M([n,e[1]])),n})))}function it(r,e){return r.size>0?r.size/8:r.size===0?0:Y.default.decode(e)+(Y.default.decode.bytes??0)}function ve(r){let e=[],t=0;for(;t<r.length;){let n=Y.default.decode(r,t),o=Y.default.decode.bytes??0,s=u(n),c=it(s,r.slice(t+o));if(c===0){e.push([n]),t+=o;continue}let p=r.slice(t+o,t+o+c);if(t+=c+o,t>r.length)throw ir("Invalid address Uint8Array: "+x(r,"base16"));e.push([n,p])}return e}function ct(r){let e=ve(r),t=ot(e);return lo(t)}function mo(r){r=at(r);let e=uo(r),t=ho(e);return st(t)}function sr(r){return mo(r)}function Se(r){let e=bo(r);if(e!=null)throw e;return Uint8Array.from(r)}function bo(r){try{ve(r)}catch(e){return e}}function at(r){return"/"+r.trim().split("/").filter(e=>e).join("/")}function ir(r){return new Error("Error parsing address: "+r)}function Ae(r){return u(r[0])}var go=Symbol.for("nodejs.util.inspect.custom"),xo=[u("dns").code,u("dns4").code,u("dns6").code,u("dnsaddr").code],yo=new Map,cr=Symbol.for("@multiformats/js-multiaddr/multiaddr");function vo(r){return!!r?.[cr]}var V=class{bytes;#t;#r;#n;#e;[cr]=!0;constructor(e){if(e==null&&(e=""),e instanceof Uint8Array)this.bytes=Se(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);this.bytes=sr(e)}else if(vo(e))this.bytes=Se(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return this.#t==null&&(this.#t=ct(this.bytes)),this.#t}toJSON(){return this.toString()}toOptions(){let e,t,n,o,s="",c=u("tcp"),p=u("udp"),m=u("ip4"),A=u("ip6"),b=u("dns6"),E=u("ip6zone");for(let[v,f]of this.stringTuples())v===E.code&&(s=`%${f??""}`),xo.includes(v)&&(t=c.name,o=443,n=`${f??""}${s}`,e=v===b.code?6:4),(v===c.code||v===p.code)&&(t=u(v).name,o=parseInt(f??"")),(v===m.code||v===A.code)&&(t=u(v).name,n=`${f??""}${s}`,e=v===A.code?6:4);if(e==null||t==null||n==null||o==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:n,transport:t,port:o}}protos(){return this.protoCodes().map(e=>Object.assign({},u(e)))}protoCodes(){let e=[],t=this.bytes,n=0;for(;n<t.length;){let o=pt.default.decode(t,n),s=pt.default.decode.bytes??0,c=u(o),p=it(c,t.slice(n+s));n+=p+s,e.push(o)}return e}protoNames(){return this.protos().map(e=>e.name)}tuples(){return this.#r==null&&(this.#r=ve(this.bytes)),this.#r}stringTuples(){return this.#n==null&&(this.#n=ot(this.tuples())),this.#n}encapsulate(e){return e=new V(e),new V(this.toString()+e.toString())}decapsulate(e){let t=e.toString(),n=this.toString(),o=n.lastIndexOf(t);if(o<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${e.toString()}`);return new V(n.slice(0,o))}decapsulateCode(e){let t=this.tuples();for(let n=t.length-1;n>=0;n--)if(t[n][0]===e)return new V(st(t.slice(0,n)));return this}getPeerId(){try{let t=this.stringTuples().filter(n=>n[0]===ie.ipfs.code).pop();if(t?.[1]!=null){let n=t[1];return n[0]==="Q"||n[0]==="1"?x(g.decode(`z${n}`),"base58btc"):x(d.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){if(this.#e===void 0)try{this.#e=this.stringTuples().filter(e=>u(e[0]).path===!0)[0][1],this.#e==null&&(this.#e=null)}catch{this.#e=null}return this.#e}equals(e){return Ct(this.bytes,e.bytes)}async resolve(e){let t=this.protos().find(s=>s.resolvable);if(t==null)return[this];let n=yo.get(t.name);if(n==null)throw new de(`no available resolver for ${t.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,e)).map(s=>new V(s))}nodeAddress(){let e=this.toOptions();if(e.transport!=="tcp"&&e.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${e.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:e.family,address:e.host,port:e.port}}isThinWaistAddress(e){let t=(e??this).protos();return!(t.length!==2||t[0].code!==4&&t[0].code!==41||t[1].code!==6&&t[1].code!==273)}[go](){return`Multiaddr(${ct(this.bytes)})`}};function Ee(r){return new V(r)}var ur=i("dns4"),dr=i("dns6"),lr=i("dnsaddr"),O=h(i("dns"),lr,ur,dr),ce=h(i("ip4"),i("ip6")),G=h(a(ce,i("tcp")),a(O,i("tcp"))),ae=a(ce,i("udp")),hr=a(ae,i("utp")),mr=a(ae,i("quic")),br=a(ae,i("quic-v1")),ee=h(a(G,i("ws")),a(O,i("ws"))),te=h(a(G,i("wss")),a(O,i("wss")),a(G,i("tls"),i("ws")),a(O,i("tls"),i("ws"))),Te=h(a(G,i("http")),a(ce,i("http")),a(O,i("http"))),Ie=h(a(G,i("https")),a(ce,i("https")),a(O,i("https"))),ar=a(ae,i("webrtc-direct"),i("certhash")),ft=h(a(ar,i("p2p")),ar),pr=a(br,i("webtransport"),i("certhash"),i("certhash")),ut=h(a(pr,i("p2p")),pr),dt=h(a(ee,i("p2p-webrtc-star"),i("p2p")),a(te,i("p2p-webrtc-star"),i("p2p")),a(ee,i("p2p-webrtc-star")),a(te,i("p2p-webrtc-star"))),So=h(a(ee,i("p2p-websocket-star"),i("p2p")),a(te,i("p2p-websocket-star"),i("p2p")),a(ee,i("p2p-websocket-star")),a(te,i("p2p-websocket-star"))),lt=h(a(Te,i("p2p-webrtc-direct"),i("p2p")),a(Ie,i("p2p-webrtc-direct"),i("p2p")),a(Te,i("p2p-webrtc-direct")),a(Ie,i("p2p-webrtc-direct"))),j=h(ee,te,Te,Ie,dt,lt,G,hr,mr,O,ft,ut),Ao=h(a(j,i("p2p-stardust"),i("p2p")),a(j,i("p2p-stardust"))),R=h(a(j,i("p2p")),dt,lt,ft,ut,i("p2p")),fr=h(a(R,i("p2p-circuit"),R),a(R,i("p2p-circuit")),a(i("p2p-circuit"),R),a(j,i("p2p-circuit")),a(i("p2p-circuit"),j),i("p2p-circuit")),wr=()=>h(a(fr,wr),fr),L=wr(),gr=h(a(L,R,L),a(R,L),a(L,R),L,R),Eo=gr,To=h(a(L,i("webrtc"),i("p2p")),a(L,i("webrtc")),a(j,i("webrtc"),i("p2p")),a(j,i("webrtc")),i("webrtc"));function xr(r){function e(t){let n;try{n=Ee(t)}catch{return!1}let o=r(n.protoNames());return o===null?!1:o===!0||o===!1?o:o.length===0}return e}function a(...r){function e(t){if(t.length<r.length)return null;let n=t;return r.some(o=>(n=typeof o=="function"?o().partialMatch(t):o.partialMatch(t),Array.isArray(n)&&(t=n),n===null)),n}return{toString:function(){return"{ "+r.join(" ")+" }"},input:r,matches:xr(e),partialMatch:e}}function h(...r){function e(n){let o=null;return r.some(s=>{let c=typeof s=="function"?s().partialMatch(n):s.partialMatch(n);return c!=null?(o=c,!0):!1}),o}return{toString:function(){return"{ "+r.join(" ")+" }"},input:r,matches:xr(e),partialMatch:e}}function i(r){let e=r;function t(o){let s;try{s=Ee(o)}catch{return!1}let c=s.protoNames();return c.length===1&&c[0]===e}function n(o){return o.length===0?null:o[0]===e?o.slice(1):null}return{toString:function(){return e},matches:t,partialMatch:n}}return Tr(Io);})(); | ||
"use strict";var MultiformatsMafmt=(()=>{var Sr=Object.create;var fe=Object.defineProperty;var Ar=Object.getOwnPropertyDescriptor;var Er=Object.getOwnPropertyNames;var Tr=Object.getPrototypeOf,Ir=Object.prototype.hasOwnProperty;var ue=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),y=(r,e)=>{for(var t in e)fe(r,t,{get:e[t],enumerable:!0})},bt=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Er(e))!Ir.call(r,o)&&o!==t&&fe(r,o,{get:()=>e[o],enumerable:!(n=Ar(e,o))||n.enumerable});return r};var Pe=(r,e,t)=>(t=r!=null?Sr(Tr(r)):{},bt(e||!r||!r.__esModule?fe(t,"default",{value:r,enumerable:!0}):t,r)),Pr=r=>bt(fe({},"__esModule",{value:!0}),r);var Rt=ue((As,Lt)=>{Lt.exports=He;var $t=128,Dn=127,$n=~Dn,Ln=Math.pow(2,31);function He(r,e,t){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw He.bytes=0,new RangeError("Could not encode varint");e=e||[],t=t||0;for(var n=t;r>=Ln;)e[t++]=r&255|$t,r/=128;for(;r&$n;)e[t++]=r&255|$t,r>>>=7;return e[t]=r|0,He.bytes=t-n+1,e}});var qt=ue((Es,jt)=>{jt.exports=Ke;var Rn=128,Ot=127;function Ke(r,n){var t=0,n=n||0,o=0,s=n,c,p=r.length;do{if(s>=p||o>49)throw Ke.bytes=0,new RangeError("Could not decode varint");c=r[s++],t+=o<28?(c&Ot)<<o:(c&Ot)*Math.pow(2,o),o+=7}while(c>=Rn);return Ke.bytes=s-n,t}});var Gt=ue((Ts,Wt)=>{var On=Math.pow(2,7),jn=Math.pow(2,14),qn=Math.pow(2,21),Wn=Math.pow(2,28),Gn=Math.pow(2,35),Jn=Math.pow(2,42),Xn=Math.pow(2,49),Qn=Math.pow(2,56),Hn=Math.pow(2,63);Wt.exports=function(r){return r<On?1:r<jn?2:r<qn?3:r<Wn?4:r<Gn?5:r<Jn?6:r<Xn?7:r<Qn?8:r<Hn?9:10}});var we=ue((Is,Jt)=>{Jt.exports={encode:Rt(),decode:qt(),encodingLength:Gt()}});var Co={};y(Co,{Circuit:()=>L,DNS:()=>O,DNS4:()=>lr,DNS6:()=>hr,DNSADDR:()=>mr,HTTP:()=>Te,HTTPS:()=>Ie,IP:()=>ce,IPFS:()=>Io,P2P:()=>yr,P2PWebRTCDirect:()=>mt,P2PWebRTCStar:()=>ht,QUIC:()=>wr,QUICV1:()=>gr,Reliable:()=>j,Stardust:()=>To,TCP:()=>G,UDP:()=>ae,UTP:()=>br,WebRTC:()=>Po,WebRTCDirect:()=>dt,WebSocketStar:()=>Eo,WebSockets:()=>se,WebSocketsSecure:()=>ie,WebTransport:()=>lt});var de=class extends Error{code;props;constructor(e,t,n){super(e),this.code=t,this.name=n?.name??"CodeError",this.props=n??{}}};var Be={};y(Be,{base58btc:()=>g,base58flickr:()=>zr});function Cr(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var o=0;o<r.length;o++){var s=r.charAt(o),c=s.charCodeAt(0);if(t[c]!==255)throw new TypeError(s+" is ambiguous");t[c]=o}var p=r.length,m=r.charAt(0),A=Math.log(p)/Math.log(256),b=Math.log(256)/Math.log(p);function E(f){if(f instanceof Uint8Array||(ArrayBuffer.isView(f)?f=new Uint8Array(f.buffer,f.byteOffset,f.byteLength):Array.isArray(f)&&(f=Uint8Array.from(f))),!(f instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(f.length===0)return"";for(var w=0,q=0,T=0,P=f.length;T!==P&&f[T]===0;)T++,w++;for(var C=(P-T)*b+1>>>0,S=new Uint8Array(C);T!==P;){for(var U=f[T],D=0,I=C-1;(U!==0||D<q)&&I!==-1;I--,D++)U+=256*S[I]>>>0,S[I]=U%p>>>0,U=U/p>>>0;if(U!==0)throw new Error("Non-zero carry");q=D,T++}for(var k=C-q;k!==C&&S[k]===0;)k++;for(var pe=m.repeat(w);k<C;++k)pe+=r.charAt(S[k]);return pe}function F(f){if(typeof f!="string")throw new TypeError("Expected String");if(f.length===0)return new Uint8Array;var w=0;if(f[w]!==" "){for(var q=0,T=0;f[w]===m;)q++,w++;for(var P=(f.length-w)*A+1>>>0,C=new Uint8Array(P);f[w];){var S=t[f.charCodeAt(w)];if(S===255)return;for(var U=0,D=P-1;(S!==0||U<T)&&D!==-1;D--,U++)S+=p*C[D]>>>0,C[D]=S%256>>>0,S=S/256>>>0;if(S!==0)throw new Error("Non-zero carry");T=U,w++}if(f[w]!==" "){for(var I=P-T;I!==P&&C[I]===0;)I++;for(var k=new Uint8Array(q+(P-I)),pe=q;I!==P;)k[pe++]=C[I++];return k}}}function v(f){var w=F(f);if(w)return w;throw new Error(`Non-${e} character`)}return{encode:E,decodeUnsafe:F,decode:v}}var Ur=Cr,Nr=Ur,wt=Nr;var Mo=new Uint8Array(0);var gt=(r,e)=>{if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0},B=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")};var xt=r=>new TextEncoder().encode(r),yt=r=>new TextDecoder().decode(r);var Ce=class{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Ue=class{constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return St(this,e)}},Ne=class{constructor(e){this.decoders=e}or(e){return St(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},St=(r,e)=>new Ne({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),ke=class{constructor(e,t,n,o){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new Ce(e,t,n),this.decoder=new Ue(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},J=({name:r,prefix:e,encode:t,decode:n})=>new ke(r,e,t,n),$=({prefix:r,name:e,alphabet:t})=>{let{encode:n,decode:o}=wt(t,e);return J({prefix:r,name:e,encode:n,decode:s=>B(o(s))})},kr=(r,e,t,n)=>{let o={};for(let b=0;b<e.length;++b)o[e[b]]=b;let s=r.length;for(;r[s-1]==="=";)--s;let c=new Uint8Array(s*t/8|0),p=0,m=0,A=0;for(let b=0;b<s;++b){let E=o[r[b]];if(E===void 0)throw new SyntaxError(`Non-${n} character`);m=m<<t|E,p+=t,p>=8&&(p-=8,c[A++]=255&m>>p)}if(p>=t||255&m<<8-p)throw new SyntaxError("Unexpected end of data");return c},Br=(r,e,t)=>{let n=e[e.length-1]==="=",o=(1<<t)-1,s="",c=0,p=0;for(let m=0;m<r.length;++m)for(p=p<<8|r[m],c+=8;c>t;)c-=t,s+=e[o&p>>c];if(c&&(s+=e[o&p<<t-c]),n)for(;s.length*t&7;)s+="=";return s},l=({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>J({prefix:e,name:r,encode(o){return Br(o,n,t)},decode(o){return kr(o,n,t,r)}});var g=$({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),zr=$({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Mr=Tt,At=128,Vr=127,Fr=~Vr,Dr=Math.pow(2,31);function Tt(r,e,t){e=e||[],t=t||0;for(var n=t;r>=Dr;)e[t++]=r&255|At,r/=128;for(;r&Fr;)e[t++]=r&255|At,r>>>=7;return e[t]=r|0,Tt.bytes=t-n+1,e}var $r=ze,Lr=128,Et=127;function ze(r,n){var t=0,n=n||0,o=0,s=n,c,p=r.length;do{if(s>=p)throw ze.bytes=0,new RangeError("Could not decode varint");c=r[s++],t+=o<28?(c&Et)<<o:(c&Et)*Math.pow(2,o),o+=7}while(c>=Lr);return ze.bytes=s-n,t}var Rr=Math.pow(2,7),Or=Math.pow(2,14),jr=Math.pow(2,21),qr=Math.pow(2,28),Wr=Math.pow(2,35),Gr=Math.pow(2,42),Jr=Math.pow(2,49),Xr=Math.pow(2,56),Qr=Math.pow(2,63),Hr=function(r){return r<Rr?1:r<Or?2:r<jr?3:r<qr?4:r<Wr?5:r<Gr?6:r<Jr?7:r<Xr?8:r<Qr?9:10},Kr={encode:Mr,decode:$r,encodingLength:Hr},_r=Kr,ee=_r;var te=(r,e=0)=>[ee.decode(r,e),ee.decode.bytes],X=(r,e,t=0)=>(ee.encode(r,e,t),e),Q=r=>ee.encodingLength(r);var W=(r,e)=>{let t=e.byteLength,n=Q(r),o=n+Q(t),s=new Uint8Array(o+t);return X(r,s,0),X(t,s,n),s.set(e,o),new H(r,t,e,s)},he=r=>{let e=B(r),[t,n]=te(e),[o,s]=te(e.subarray(n)),c=e.subarray(n+s);if(c.byteLength!==o)throw new Error("Incorrect length");return new H(t,o,c,e)},It=(r,e)=>{if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&>(r.bytes,t.bytes)}},H=class{constructor(e,t,n,o){this.code=e,this.size=t,this.digest=n,this.bytes=o}};var Me={};y(Me,{base32:()=>z,base32hex:()=>tn,base32hexpad:()=>nn,base32hexpadupper:()=>on,base32hexupper:()=>rn,base32pad:()=>Yr,base32padupper:()=>en,base32upper:()=>Zr,base32z:()=>sn});var z=l({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Zr=l({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Yr=l({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),en=l({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),tn=l({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),rn=l({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),nn=l({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),on=l({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),sn=l({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Pt=(r,e)=>{let{bytes:t,version:n}=r;switch(n){case 0:return an(t,Ve(r),e||g.encoder);default:return pn(t,Ve(r),e||z.encoder)}};var Ct=new WeakMap,Ve=r=>{let e=Ct.get(r);if(e==null){let t=new Map;return Ct.set(r,t),t}return e},d=class{constructor(e,t,n,o){this.code=t,this.version=e,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:t}=this;if(e!==re)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==fn)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return d.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,n=W(e,t);return d.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 d.equals(this,e)}static equals(e,t){let n=t;return n&&e.code===n.code&&e.version===n.version&&It(e.multihash,n.multihash)}toString(e){return Pt(this,e)}toJSON(){return{"/":Pt(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof d)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:o,multihash:s,bytes:c}=t;return new d(n,o,s,c||Ut(n,o,s.bytes))}else if(t[un]===!0){let{version:n,multihash:o,code:s}=t,c=he(o);return d.create(n,s,c)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==re)throw new Error(`Version 0 CID must use dag-pb (code: ${re}) block encoding`);return new d(e,t,n,n.bytes)}case 1:{let o=Ut(e,t,n.bytes);return new d(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return d.create(0,re,e)}static createV1(e,t){return d.create(1,e,t)}static decode(e){let[t,n]=d.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=d.inspectBytes(e),n=t.size-t.multihashSize,o=B(e.subarray(n,n+t.multihashSize));if(o.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=o.subarray(t.multihashSize-t.digestSize),c=new H(t.multihashCode,t.digestSize,s,o);return[t.version===0?d.createV0(c):d.createV1(t.codec,c),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[E,F]=te(e.subarray(t));return t+=F,E},o=n(),s=re;if(o===18?(o=0,t=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let c=t,p=n(),m=n(),A=t+m,b=A-c;return{version:o,codec:s,multihashCode:p,digestSize:m,multihashSize:b,size:A}}static parse(e,t){let[n,o]=cn(e,t),s=d.decode(o);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Ve(s).set(n,e),s}},cn=(r,e)=>{switch(r[0]){case"Q":{let t=e||g;return[g.prefix,t.decode(`${g.prefix}${r}`)]}case g.prefix:{let t=e||g;return[g.prefix,t.decode(r)]}case z.prefix:{let t=e||z;return[z.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}},an=(r,e,t)=>{let{prefix:n}=t;if(n!==g.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let o=e.get(n);if(o==null){let s=t.encode(r).slice(1);return e.set(n,s),s}else return o},pn=(r,e,t)=>{let{prefix:n}=t,o=e.get(n);if(o==null){let s=t.encode(r);return e.set(n,s),s}else return o},re=112,fn=18,Ut=(r,e,t)=>{let n=Q(r),o=n+Q(e),s=new Uint8Array(o+t.byteLength);return X(r,s,0),X(e,s,n),s.set(t,o),s},un=Symbol.for("@ipld/js-cid/CID");function Nt(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}var Fe={};y(Fe,{identity:()=>dn});var dn=J({prefix:"\0",name:"identity",encode:r=>yt(r),decode:r=>xt(r)});var De={};y(De,{base2:()=>ln});var ln=l({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var $e={};y($e,{base8:()=>hn});var hn=l({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Le={};y(Le,{base10:()=>mn});var mn=$({prefix:"9",name:"base10",alphabet:"0123456789"});var Re={};y(Re,{base16:()=>bn,base16upper:()=>wn});var bn=l({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),wn=l({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Oe={};y(Oe,{base36:()=>gn,base36upper:()=>xn});var gn=$({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),xn=$({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var je={};y(je,{base64:()=>yn,base64pad:()=>vn,base64url:()=>Sn,base64urlpad:()=>An});var yn=l({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),vn=l({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Sn=l({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),An=l({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var qe={};y(qe,{base256emoji:()=>Cn});var kt=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}"),En=kt.reduce((r,e,t)=>(r[t]=e,r),[]),Tn=kt.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function In(r){return r.reduce((e,t)=>(e+=En[t],e),"")}function Pn(r){let e=[];for(let t of r){let n=Tn[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}var Cn=J({prefix:"\u{1F680}",name:"base256emoji",encode:In,decode:Pn});var Je={};y(Je,{sha256:()=>Un,sha512:()=>Nn});var Ge=({name:r,code:e,encode:t})=>new We(r,e,t),We=class{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?W(this.code,t):t.then(n=>W(this.code,n))}else throw Error("Unknown type, must be binary type")}};var zt=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),Un=Ge({name:"sha2-256",code:18,encode:zt("SHA-256")}),Nn=Ge({name:"sha2-512",code:19,encode:zt("SHA-512")});var Xe={};y(Xe,{identity:()=>zn});var Mt=0,kn="identity",Vt=B,Bn=r=>W(Mt,Vt(r)),zn={code:Mt,name:kn,encode:Vt,digest:Bn};var cs=new TextEncoder,as=new TextDecoder;var ne={...Fe,...De,...$e,...Le,...Re,...Me,...Oe,...Be,...je,...qe},ls={...Je,...Xe};function _(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function me(r=0){return globalThis.Buffer?.allocUnsafe!=null?_(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Dt(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var Ft=Dt("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Qe=Dt("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=me(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),Fn={utf8:Ft,"utf-8":Ft,hex:ne.base16,latin1:Qe,ascii:Qe,binary:Qe,...ne},be=Fn;function x(r,e="utf8"){let t=be[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):t.encoder.encode(r).substring(1)}var pt=Pe(we(),1);function M(r,e){e==null&&(e=r.reduce((o,s)=>o+s.length,0));let t=me(e),n=0;for(let o of r)t.set(o,n),n+=o.length;return _(t)}var Y=Pe(we(),1);var ge=class{index=0;input="";new(e){return this.index=0,this.input=e,this}readAtomically(e){let t=this.index,n=e();return n===void 0&&(this.index=t),n}parseWith(e){let t=e();if(this.index===this.input.length)return t}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(e){return this.readAtomically(()=>{let t=this.readChar();if(t===e)return t})}readSeparator(e,t,n){return this.readAtomically(()=>{if(!(t>0&&this.readGivenChar(e)===void 0))return n()})}readNumber(e,t,n,o){return this.readAtomically(()=>{let s=0,c=0,p=this.peekChar();if(p===void 0)return;let m=p==="0",A=2**(8*o)-1;for(;;){let b=this.readAtomically(()=>{let E=this.readChar();if(E===void 0)return;let F=Number.parseInt(E,e);if(!Number.isNaN(F))return F});if(b===void 0)break;if(s*=e,s+=b,s>A||(c+=1,t!==void 0&&c>t))return}if(c!==0)return!n&&m&&c>1?void 0:s})}readIPv4Addr(){return this.readAtomically(()=>{let e=new Uint8Array(4);for(let t=0;t<e.length;t++){let n=this.readSeparator(".",t,()=>this.readNumber(10,3,!1,1));if(n===void 0)return;e[t]=n}return e})}readIPv6Addr(){let e=t=>{for(let n=0;n<t.length/2;n++){let o=n*2;if(n<t.length-3){let c=this.readSeparator(":",n,()=>this.readIPv4Addr());if(c!==void 0)return t[o]=c[0],t[o+1]=c[1],t[o+2]=c[2],t[o+3]=c[3],[o+4,!0]}let s=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(s===void 0)return[o,!1];t[o]=s>>8,t[o+1]=s&255}return[t.length,!1]};return this.readAtomically(()=>{let t=new Uint8Array(16),[n,o]=e(t);if(n===16)return t;if(o||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let s=new Uint8Array(14),c=16-(n+2),[p]=e(s.subarray(0,c));return t.set(s.subarray(0,p),16-p),t})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var Xt=45,Kn=15,Z=new ge;function _e(r){if(!(r.length>Kn))return Z.new(r).parseWith(()=>Z.readIPv4Addr())}function Ze(r){if(!(r.length>Xt))return Z.new(r).parseWith(()=>Z.readIPv6Addr())}function xe(r){if(!(r.length>Xt))return Z.new(r).parseWith(()=>Z.readIPAddr())}var Ls=parseInt("0xFFFF",16),Rs=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);function Ye(r,e="utf8"){let t=be[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?_(globalThis.Buffer.from(r,"utf-8")):t.decoder.decode(`${t.prefix}${r}`)}var N=Pe(we(),1);function Kt(r){return!!_e(r)}function _t(r){return!!Ze(r)}function ye(r){return!!xe(r)}var Zt=Kt,to=_t,et=function(r){let e=0;if(r=r.toString().trim(),Zt(r)){let t=new Uint8Array(e+4);return r.split(/\./g).forEach(n=>{t[e++]=parseInt(n,10)&255}),t}if(to(r)){let t=r.split(":",8),n;for(n=0;n<t.length;n++){let s=Zt(t[n]),c;s&&(c=et(t[n]),t[n]=x(c.slice(0,2),"base16")),c!=null&&++n<8&&t.splice(n,0,x(c.slice(2,4),"base16"))}if(t[0]==="")for(;t.length<8;)t.unshift("0");else if(t[t.length-1]==="")for(;t.length<8;)t.push("0");else if(t.length<8){for(n=0;n<t.length&&t[n]!=="";n++);let s=[n,1];for(n=9-t.length;n>0;n--)s.push("0");t.splice.apply(t,s)}let o=new Uint8Array(e+16);for(n=0;n<t.length;n++){let s=parseInt(t[n],16);o[e++]=s>>8&255,o[e++]=s&255}return o}throw new Error("invalid ip address")},Yt=function(r,e=0,t){e=~~e,t=t??r.length-e;let n=new DataView(r.buffer);if(t===4){let o=[];for(let s=0;s<t;s++)o.push(r[e+s]);return o.join(".")}if(t===16){let o=[];for(let s=0;s<t;s+=2)o.push(n.getUint16(e+s).toString(16));return o.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var oe={},tt={},no=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,-1,"ip6zone"],[43,8,"ipcidr"],[53,-1,"dns",!0],[54,-1,"dns4",!0],[55,-1,"dns6",!0],[56,-1,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc-direct"],[281,0,"webrtc"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,-1,"unix",!1,!0],[421,-1,"ipfs"],[421,-1,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,-1,"garlic64"],[448,0,"tls"],[449,-1,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,-1,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,-1,"memory"]];no.forEach(r=>{let e=oo(...r);tt[e.code]=e,oe[e.name]=e});function oo(r,e,t,n,o){return{code:r,size:e,name:t,resolvable:!!n,path:!!o}}function u(r){if(typeof r=="number"){if(tt[r]!=null)return tt[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(oe[r]!=null)return oe[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var Ii=u("ip4"),Pi=u("ip6"),Ci=u("ipcidr");function or(r,e){switch(u(r).code){case 4:case 41:return io(e);case 42:return rr(e);case 6:case 273:case 33:case 132:return ir(e).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return rr(e);case 421:return fo(e);case 444:return nr(e);case 445:return nr(e);case 466:return po(e);default:return x(e,"base16")}}function sr(r,e){switch(u(r).code){case 4:return er(e);case 41:return er(e);case 42:return tr(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 449:case 777:return tr(e);case 421:return co(e);case 444:return uo(e);case 445:return lo(e);case 466:return ao(e);default:return Ye(e,"base16")}}var rt=Object.values(ne).map(r=>r.decoder),so=function(){let r=rt[0].or(rt[1]);return rt.slice(2).forEach(e=>r=r.or(e)),r}();function er(r){if(!ye(r))throw new Error("invalid ip address");return et(r)}function io(r){let e=Yt(r,0,r.length);if(e==null)throw new Error("ipBuff is required");if(!ye(e))throw new Error("invalid ip address");return e}function nt(r){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,r),new Uint8Array(e)}function ir(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function tr(r){let e=Ye(r),t=Uint8Array.from(N.default.encode(e.length));return M([t,e],t.length+e.length)}function rr(r){let e=N.default.decode(r);if(r=r.slice(N.default.decode.bytes),r.length!==e)throw new Error("inconsistent lengths");return x(r)}function co(r){let e;r[0]==="Q"||r[0]==="1"?e=he(g.decode(`z${r}`)).bytes:e=d.parse(r).multihash.bytes;let t=Uint8Array.from(N.default.encode(e.length));return M([t,e],t.length+e.length)}function ao(r){let e=so.decode(r),t=Uint8Array.from(N.default.encode(e.length));return M([t,e],t.length+e.length)}function po(r){let e=N.default.decode(r),t=r.slice(N.default.decode.bytes);if(t.length!==e)throw new Error("inconsistent lengths");return"u"+x(t,"base64url")}function fo(r){let e=N.default.decode(r),t=r.slice(N.default.decode.bytes);if(t.length!==e)throw new Error("inconsistent lengths");return x(t,"base58btc")}function uo(r){let e=r.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==16)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion address.`);let t=z.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 M([t,o],t.length+o.length)}function lo(r){let e=r.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==56)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion3 address.`);let t=z.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 M([t,o],t.length+o.length)}function nr(r){let e=r.slice(0,r.length-2),t=r.slice(r.length-2),n=x(e,"base32"),o=ir(t);return`${n}:${o}`}function ho(r){let e=[],t=r.split("/").slice(1);if(t.length===1&&t[0]==="")return[];for(let n=0;n<t.length;n++){let o=t[n],s=u(o);if(s.size===0){e.push([o]);continue}if(n++,n>=t.length)throw ar("invalid address: "+r);if(s.path===!0){e.push([o,at(t.slice(n).join("/"))]);break}e.push([o,t[n]])}return e}function mo(r){let e=[];return r.map(t=>{let n=Ae(t);return e.push(n.name),t.length>1&&t[1]!=null&&e.push(t[1]),null}),at(e.join("/"))}function bo(r){return r.map(e=>{Array.isArray(e)||(e=[e]);let t=Ae(e);return e.length>1?[t.code,sr(t.code,e[1])]:[t.code]})}function ot(r){return r.map(e=>{let t=Ae(e);return e[1]!=null?[t.code,or(t.code,e[1])]:[t.code]})}function st(r){return Se(M(r.map(e=>{let t=Ae(e),n=Uint8Array.from(Y.default.encode(t.code));return e.length>1&&e[1]!=null&&(n=M([n,e[1]])),n})))}function it(r,e){return r.size>0?r.size/8:r.size===0?0:Y.default.decode(e)+(Y.default.decode.bytes??0)}function ve(r){let e=[],t=0;for(;t<r.length;){let n=Y.default.decode(r,t),o=Y.default.decode.bytes??0,s=u(n),c=it(s,r.slice(t+o));if(c===0){e.push([n]),t+=o;continue}let p=r.slice(t+o,t+o+c);if(t+=c+o,t>r.length)throw ar("Invalid address Uint8Array: "+x(r,"base16"));e.push([n,p])}return e}function ct(r){let e=ve(r),t=ot(e);return mo(t)}function wo(r){r=at(r);let e=ho(r),t=bo(e);return st(t)}function cr(r){return wo(r)}function Se(r){let e=go(r);if(e!=null)throw e;return Uint8Array.from(r)}function go(r){try{ve(r)}catch(e){return e}}function at(r){return"/"+r.trim().split("/").filter(e=>e).join("/")}function ar(r){return new Error("Error parsing address: "+r)}function Ae(r){return u(r[0])}var yo=Symbol.for("nodejs.util.inspect.custom"),vo=[u("dns").code,u("dns4").code,u("dns6").code,u("dnsaddr").code],So=new Map,pr=Symbol.for("@multiformats/js-multiaddr/multiaddr");function Ao(r){return!!r?.[pr]}var V=class{bytes;#t;#r;#n;#e;[pr]=!0;constructor(e){if(e==null&&(e=""),e instanceof Uint8Array)this.bytes=Se(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);this.bytes=cr(e)}else if(Ao(e))this.bytes=Se(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return this.#t==null&&(this.#t=ct(this.bytes)),this.#t}toJSON(){return this.toString()}toOptions(){let e,t,n,o,s="",c=u("tcp"),p=u("udp"),m=u("ip4"),A=u("ip6"),b=u("dns6"),E=u("ip6zone");for(let[v,f]of this.stringTuples())v===E.code&&(s=`%${f??""}`),vo.includes(v)&&(t=c.name,o=443,n=`${f??""}${s}`,e=v===b.code?6:4),(v===c.code||v===p.code)&&(t=u(v).name,o=parseInt(f??"")),(v===m.code||v===A.code)&&(t=u(v).name,n=`${f??""}${s}`,e=v===A.code?6:4);if(e==null||t==null||n==null||o==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:n,transport:t,port:o}}protos(){return this.protoCodes().map(e=>Object.assign({},u(e)))}protoCodes(){let e=[],t=this.bytes,n=0;for(;n<t.length;){let o=pt.default.decode(t,n),s=pt.default.decode.bytes??0,c=u(o),p=it(c,t.slice(n+s));n+=p+s,e.push(o)}return e}protoNames(){return this.protos().map(e=>e.name)}tuples(){return this.#r==null&&(this.#r=ve(this.bytes)),this.#r}stringTuples(){return this.#n==null&&(this.#n=ot(this.tuples())),this.#n}encapsulate(e){return e=new V(e),new V(this.toString()+e.toString())}decapsulate(e){let t=e.toString(),n=this.toString(),o=n.lastIndexOf(t);if(o<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${e.toString()}`);return new V(n.slice(0,o))}decapsulateCode(e){let t=this.tuples();for(let n=t.length-1;n>=0;n--)if(t[n][0]===e)return new V(st(t.slice(0,n)));return this}getPeerId(){try{let t=this.stringTuples().filter(n=>n[0]===oe.ipfs.code).pop();if(t?.[1]!=null){let n=t[1];return n[0]==="Q"||n[0]==="1"?x(g.decode(`z${n}`),"base58btc"):x(d.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){if(this.#e===void 0)try{this.#e=this.stringTuples().filter(e=>u(e[0]).path===!0)[0][1],this.#e==null&&(this.#e=null)}catch{this.#e=null}return this.#e}equals(e){return Nt(this.bytes,e.bytes)}async resolve(e){let t=this.protos().find(s=>s.resolvable);if(t==null)return[this];let n=So.get(t.name);if(n==null)throw new de(`no available resolver for ${t.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,e)).map(s=>new V(s))}nodeAddress(){let e=this.toOptions();if(e.transport!=="tcp"&&e.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${e.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:e.family,address:e.host,port:e.port}}isThinWaistAddress(e){let t=(e??this).protos();return!(t.length!==2||t[0].code!==4&&t[0].code!==41||t[1].code!==6&&t[1].code!==273)}[yo](){return`Multiaddr(${ct(this.bytes)})`}};function Ee(r){return new V(r)}var lr=i("dns4"),hr=i("dns6"),mr=i("dnsaddr"),O=h(i("dns"),mr,lr,hr),ce=h(i("ip4"),i("ip6")),G=h(a(ce,i("tcp")),a(O,i("tcp"))),ae=a(ce,i("udp")),br=a(ae,i("utp")),wr=a(ae,i("quic")),gr=a(ae,i("quic-v1")),ft=h(a(G,i("ws")),a(O,i("ws"))),se=h(ft,a(ft,i("p2p"))),ut=h(a(G,i("wss")),a(O,i("wss")),a(G,i("tls"),i("ws")),a(O,i("tls"),i("ws"))),ie=h(ut,a(ut,i("p2p"))),Te=h(a(G,i("http")),a(ce,i("http")),a(O,i("http"))),Ie=h(a(G,i("https")),a(ce,i("https")),a(O,i("https"))),fr=a(ae,i("webrtc-direct"),i("certhash")),dt=h(a(fr,i("p2p")),fr),ur=a(gr,i("webtransport"),i("certhash"),i("certhash")),lt=h(a(ur,i("p2p")),ur),ht=h(a(se,i("p2p-webrtc-star"),i("p2p")),a(ie,i("p2p-webrtc-star"),i("p2p")),a(se,i("p2p-webrtc-star")),a(ie,i("p2p-webrtc-star"))),Eo=h(a(se,i("p2p-websocket-star"),i("p2p")),a(ie,i("p2p-websocket-star"),i("p2p")),a(se,i("p2p-websocket-star")),a(ie,i("p2p-websocket-star"))),mt=h(a(Te,i("p2p-webrtc-direct"),i("p2p")),a(Ie,i("p2p-webrtc-direct"),i("p2p")),a(Te,i("p2p-webrtc-direct")),a(Ie,i("p2p-webrtc-direct"))),j=h(ft,ut,Te,Ie,ht,mt,G,br,wr,O,dt,lt),To=h(a(j,i("p2p-stardust"),i("p2p")),a(j,i("p2p-stardust"))),R=h(a(j,i("p2p")),ht,mt,dt,lt,i("p2p")),dr=h(a(R,i("p2p-circuit"),R),a(R,i("p2p-circuit")),a(i("p2p-circuit"),R),a(j,i("p2p-circuit")),a(i("p2p-circuit"),j),i("p2p-circuit")),xr=()=>h(a(dr,xr),dr),L=xr(),yr=h(a(L,R,L),a(R,L),a(L,R),L,R),Io=yr,Po=h(a(L,i("webrtc"),i("p2p")),a(L,i("webrtc")),a(j,i("webrtc"),i("p2p")),a(j,i("webrtc")),i("webrtc"));function vr(r){function e(t){let n;try{n=Ee(t)}catch{return!1}let o=r(n.protoNames());return o===null?!1:o===!0||o===!1?o:o.length===0}return e}function a(...r){function e(t){if(t.length<r.length)return null;let n=t;return r.some(o=>(n=typeof o=="function"?o().partialMatch(t):o.partialMatch(t),Array.isArray(n)&&(t=n),n===null)),n}return{toString:function(){return"{ "+r.join(" ")+" }"},input:r,matches:vr(e),partialMatch:e}}function h(...r){function e(n){let o=null;return r.some(s=>{let c=typeof s=="function"?s().partialMatch(n):s.partialMatch(n);return c!=null?(o=c,!0):!1}),o}return{toString:function(){return"{ "+r.join(" ")+" }"},input:r,matches:vr(e),partialMatch:e}}function i(r){let e=r;function t(o){let s;try{s=Ee(o)}catch{return!1}let c=s.protoNames();return c.length===1&&c[0]===e}function n(o){return o.length===0?null:o[0]===e?o.slice(1):null}return{toString:function(){return e},matches:t,partialMatch:n}}return Pr(Co);})(); | ||
return MultiformatsMafmt})); |
@@ -15,4 +15,6 @@ import { multiaddr } from '@multiformats/multiaddr'; | ||
export const QUICV1 = and(UDP, base('quic-v1')); | ||
export const WebSockets = or(and(TCP, base('ws')), and(DNS, base('ws'))); | ||
export const WebSocketsSecure = or(and(TCP, base('wss')), and(DNS, base('wss')), and(TCP, base('tls'), base('ws')), and(DNS, base('tls'), base('ws'))); | ||
const _WebSockets = or(and(TCP, base('ws')), and(DNS, base('ws'))); | ||
export const WebSockets = or(_WebSockets, and(_WebSockets, base('p2p'))); | ||
const _WebSocketsSecure = or(and(TCP, base('wss')), and(DNS, base('wss')), and(TCP, base('tls'), base('ws')), and(DNS, base('tls'), base('ws'))); | ||
export const WebSocketsSecure = or(_WebSocketsSecure, and(_WebSocketsSecure, base('p2p'))); | ||
export const HTTP = or(and(TCP, base('http')), and(IP, base('http')), and(DNS, base('http'))); | ||
@@ -33,3 +35,3 @@ export const HTTPS = or(and(TCP, base('https')), and(IP, base('https')), and(DNS, base('https'))); | ||
export const P2PWebRTCDirect = or(and(HTTP, base('p2p-webrtc-direct'), base('p2p')), and(HTTPS, base('p2p-webrtc-direct'), base('p2p')), and(HTTP, base('p2p-webrtc-direct')), and(HTTPS, base('p2p-webrtc-direct'))); | ||
export const Reliable = or(WebSockets, WebSocketsSecure, HTTP, HTTPS, P2PWebRTCStar, P2PWebRTCDirect, TCP, UTP, QUIC, DNS, WebRTCDirect, WebTransport); | ||
export const Reliable = or(_WebSockets, _WebSocketsSecure, HTTP, HTTPS, P2PWebRTCStar, P2PWebRTCDirect, TCP, UTP, QUIC, DNS, WebRTCDirect, WebTransport); | ||
// Unlike ws-star, stardust can run over any transport thus removing the requirement for websockets (but don't even think about running a stardust server over webrtc-star ;) ) | ||
@@ -36,0 +38,0 @@ export const Stardust = or(and(Reliable, base('p2p-stardust'), base('p2p')), and(Reliable, base('p2p-stardust'))); |
{ | ||
"name": "@multiformats/mafmt", | ||
"version": "12.1.3", | ||
"version": "12.1.4", | ||
"description": "A multiaddr validator", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0 OR MIT", |
@@ -38,3 +38,3 @@ import { multiaddr } from '@multiformats/multiaddr' | ||
export const WebSockets = or( | ||
const _WebSockets = or( | ||
and(TCP, base('ws')), | ||
@@ -44,3 +44,8 @@ and(DNS, base('ws')) | ||
export const WebSocketsSecure = or( | ||
export const WebSockets = or( | ||
_WebSockets, | ||
and(_WebSockets, base('p2p')) | ||
) | ||
const _WebSocketsSecure = or( | ||
and(TCP, base('wss')), | ||
@@ -52,2 +57,7 @@ and(DNS, base('wss')), | ||
export const WebSocketsSecure = or( | ||
_WebSocketsSecure, | ||
and(_WebSocketsSecure, base('p2p')) | ||
) | ||
export const HTTP = or( | ||
@@ -105,4 +115,4 @@ and(TCP, base('http')), | ||
export const Reliable = or( | ||
WebSockets, | ||
WebSocketsSecure, | ||
_WebSockets, | ||
_WebSocketsSecure, | ||
HTTP, | ||
@@ -109,0 +119,0 @@ HTTPS, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
73168
602