@libp2p/peer-collections 5.2.6 → 5.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.min.js CHANGED
@@ -1,3 +1,3 @@
1
1
  (function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PPeerCollections = factory()}(typeof self !== 'undefined' ? self : this, function () {
2
- "use strict";var Libp2PPeerCollections=(()=>{var Rt=Object.create;var le=Object.defineProperty;var Ot=Object.getOwnPropertyDescriptor;var Vt=Object.getOwnPropertyNames;var qt=Object.getPrototypeOf,$t=Object.prototype.hasOwnProperty;var We=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),A=(r,e)=>{for(var t in e)le(r,t,{get:e[t],enumerable:!0})},Ye=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Vt(e))!$t.call(r,i)&&i!==t&&le(r,i,{get:()=>e[i],enumerable:!(n=Ot(e,i))||n.enumerable});return r};var jt=(r,e,t)=>(t=r!=null?Rt(qt(r)):{},Ye(e||!r||!r.__esModule?le(t,"default",{value:r,enumerable:!0}):t,r)),Kt=r=>Ye(le({},"__esModule",{value:!0}),r);var kt=We((se,xe)=>{(function(r,e){"use strict";var t={version:"3.0.0",x86:{},x64:{},inputValidation:!0};function n(o){if(!Array.isArray(o)&&!ArrayBuffer.isView(o))return!1;for(var s=0;s<o.length;s++)if(!Number.isInteger(o[s])||o[s]<0||o[s]>255)return!1;return!0}function i(o,s){return(o&65535)*s+(((o>>>16)*s&65535)<<16)}function a(o,s){return o<<s|o>>>32-s}function d(o){return o^=o>>>16,o=i(o,2246822507),o^=o>>>13,o=i(o,3266489909),o^=o>>>16,o}function _(o,s){o=[o[0]>>>16,o[0]&65535,o[1]>>>16,o[1]&65535],s=[s[0]>>>16,s[0]&65535,s[1]>>>16,s[1]&65535];var c=[0,0,0,0];return c[3]+=o[3]+s[3],c[2]+=c[3]>>>16,c[3]&=65535,c[2]+=o[2]+s[2],c[1]+=c[2]>>>16,c[2]&=65535,c[1]+=o[1]+s[1],c[0]+=c[1]>>>16,c[1]&=65535,c[0]+=o[0]+s[0],c[0]&=65535,[c[0]<<16|c[1],c[2]<<16|c[3]]}function w(o,s){o=[o[0]>>>16,o[0]&65535,o[1]>>>16,o[1]&65535],s=[s[0]>>>16,s[0]&65535,s[1]>>>16,s[1]&65535];var c=[0,0,0,0];return c[3]+=o[3]*s[3],c[2]+=c[3]>>>16,c[3]&=65535,c[2]+=o[2]*s[3],c[1]+=c[2]>>>16,c[2]&=65535,c[2]+=o[3]*s[2],c[1]+=c[2]>>>16,c[2]&=65535,c[1]+=o[1]*s[3],c[0]+=c[1]>>>16,c[1]&=65535,c[1]+=o[2]*s[2],c[0]+=c[1]>>>16,c[1]&=65535,c[1]+=o[3]*s[1],c[0]+=c[1]>>>16,c[1]&=65535,c[0]+=o[0]*s[3]+o[1]*s[2]+o[2]*s[1]+o[3]*s[0],c[0]&=65535,[c[0]<<16|c[1],c[2]<<16|c[3]]}function C(o,s){return s%=64,s===32?[o[1],o[0]]:s<32?[o[0]<<s|o[1]>>>32-s,o[1]<<s|o[0]>>>32-s]:(s-=32,[o[1]<<s|o[0]>>>32-s,o[0]<<s|o[1]>>>32-s])}function v(o,s){return s%=64,s===0?o:s<32?[o[0]<<s|o[1]>>>32-s,o[1]<<s]:[o[1]<<s-32,0]}function b(o,s){return[o[0]^s[0],o[1]^s[1]]}function O(o){return o=b(o,[0,o[0]>>>1]),o=w(o,[4283543511,3981806797]),o=b(o,[0,o[0]>>>1]),o=w(o,[3301882366,444984403]),o=b(o,[0,o[0]>>>1]),o}t.x86.hash32=function(o,s){if(t.inputValidation&&!n(o))return e;s=s||0;for(var c=o.length%4,I=o.length-c,f=s,u=0,p=3432918353,l=461845907,m=0;m<I;m=m+4)u=o[m]|o[m+1]<<8|o[m+2]<<16|o[m+3]<<24,u=i(u,p),u=a(u,15),u=i(u,l),f^=u,f=a(f,13),f=i(f,5)+3864292196;switch(u=0,c){case 3:u^=o[m+2]<<16;case 2:u^=o[m+1]<<8;case 1:u^=o[m],u=i(u,p),u=a(u,15),u=i(u,l),f^=u}return f^=o.length,f=d(f),f>>>0},t.x86.hash128=function(o,s){if(t.inputValidation&&!n(o))return e;s=s||0;for(var c=o.length%16,I=o.length-c,f=s,u=s,p=s,l=s,m=0,x=0,h=0,S=0,M=597399067,ue=2869860233,he=951274213,pe=2716044179,g=0;g<I;g=g+16)m=o[g]|o[g+1]<<8|o[g+2]<<16|o[g+3]<<24,x=o[g+4]|o[g+5]<<8|o[g+6]<<16|o[g+7]<<24,h=o[g+8]|o[g+9]<<8|o[g+10]<<16|o[g+11]<<24,S=o[g+12]|o[g+13]<<8|o[g+14]<<16|o[g+15]<<24,m=i(m,M),m=a(m,15),m=i(m,ue),f^=m,f=a(f,19),f+=u,f=i(f,5)+1444728091,x=i(x,ue),x=a(x,16),x=i(x,he),u^=x,u=a(u,17),u+=p,u=i(u,5)+197830471,h=i(h,he),h=a(h,17),h=i(h,pe),p^=h,p=a(p,15),p+=l,p=i(p,5)+2530024501,S=i(S,pe),S=a(S,18),S=i(S,M),l^=S,l=a(l,13),l+=f,l=i(l,5)+850148119;switch(m=0,x=0,h=0,S=0,c){case 15:S^=o[g+14]<<16;case 14:S^=o[g+13]<<8;case 13:S^=o[g+12],S=i(S,pe),S=a(S,18),S=i(S,M),l^=S;case 12:h^=o[g+11]<<24;case 11:h^=o[g+10]<<16;case 10:h^=o[g+9]<<8;case 9:h^=o[g+8],h=i(h,he),h=a(h,17),h=i(h,pe),p^=h;case 8:x^=o[g+7]<<24;case 7:x^=o[g+6]<<16;case 6:x^=o[g+5]<<8;case 5:x^=o[g+4],x=i(x,ue),x=a(x,16),x=i(x,he),u^=x;case 4:m^=o[g+3]<<24;case 3:m^=o[g+2]<<16;case 2:m^=o[g+1]<<8;case 1:m^=o[g],m=i(m,M),m=a(m,15),m=i(m,ue),f^=m}return f^=o.length,u^=o.length,p^=o.length,l^=o.length,f+=u,f+=p,f+=l,u+=f,p+=f,l+=f,f=d(f),u=d(u),p=d(p),l=d(l),f+=u,f+=p,f+=l,u+=f,p+=f,l+=f,("00000000"+(f>>>0).toString(16)).slice(-8)+("00000000"+(u>>>0).toString(16)).slice(-8)+("00000000"+(p>>>0).toString(16)).slice(-8)+("00000000"+(l>>>0).toString(16)).slice(-8)},t.x64.hash128=function(o,s){if(t.inputValidation&&!n(o))return e;s=s||0;for(var c=o.length%16,I=o.length-c,f=[0,s],u=[0,s],p=[0,0],l=[0,0],m=[2277735313,289559509],x=[1291169091,658871167],h=0;h<I;h=h+16)p=[o[h+4]|o[h+5]<<8|o[h+6]<<16|o[h+7]<<24,o[h]|o[h+1]<<8|o[h+2]<<16|o[h+3]<<24],l=[o[h+12]|o[h+13]<<8|o[h+14]<<16|o[h+15]<<24,o[h+8]|o[h+9]<<8|o[h+10]<<16|o[h+11]<<24],p=w(p,m),p=C(p,31),p=w(p,x),f=b(f,p),f=C(f,27),f=_(f,u),f=_(w(f,[0,5]),[0,1390208809]),l=w(l,x),l=C(l,33),l=w(l,m),u=b(u,l),u=C(u,31),u=_(u,f),u=_(w(u,[0,5]),[0,944331445]);switch(p=[0,0],l=[0,0],c){case 15:l=b(l,v([0,o[h+14]],48));case 14:l=b(l,v([0,o[h+13]],40));case 13:l=b(l,v([0,o[h+12]],32));case 12:l=b(l,v([0,o[h+11]],24));case 11:l=b(l,v([0,o[h+10]],16));case 10:l=b(l,v([0,o[h+9]],8));case 9:l=b(l,[0,o[h+8]]),l=w(l,x),l=C(l,33),l=w(l,m),u=b(u,l);case 8:p=b(p,v([0,o[h+7]],56));case 7:p=b(p,v([0,o[h+6]],48));case 6:p=b(p,v([0,o[h+5]],40));case 5:p=b(p,v([0,o[h+4]],32));case 4:p=b(p,v([0,o[h+3]],24));case 3:p=b(p,v([0,o[h+2]],16));case 2:p=b(p,v([0,o[h+1]],8));case 1:p=b(p,[0,o[h]]),p=w(p,m),p=C(p,31),p=w(p,x),f=b(f,p)}return f=b(f,[0,o.length]),u=b(u,[0,o.length]),f=_(f,u),u=_(u,f),f=O(f),u=O(u),f=_(f,u),u=_(u,f),("00000000"+(f[0]>>>0).toString(16)).slice(-8)+("00000000"+(f[1]>>>0).toString(16)).slice(-8)+("00000000"+(u[0]>>>0).toString(16)).slice(-8)+("00000000"+(u[1]>>>0).toString(16)).slice(-8)},typeof se<"u"?(typeof xe<"u"&&xe.exports&&(se=xe.exports=t),se.murmurHash3=t):typeof define=="function"&&define.amd?define([],function(){return t}):(t._murmurHash3=r.murmurHash3,t.noConflict=function(){return r.murmurHash3=t._murmurHash3,t._murmurHash3=e,t.noConflict=e,t},r.murmurHash3=t)})(se)});var Mt=We((Ao,Dt)=>{Dt.exports=kt()});var cn={};A(cn,{PeerFilter:()=>fe,PeerList:()=>R,PeerMap:()=>B,PeerSet:()=>L,peerFilter:()=>Pt,peerList:()=>zt,peerMap:()=>It,peerSet:()=>At,trackedPeerList:()=>Lt,trackedPeerMap:()=>Nt,trackedPeerSet:()=>Bt});var we=Symbol.for("@libp2p/peer-id");var Ee={};A(Ee,{base58btc:()=>z,base58flickr:()=>Wt});var hn=new Uint8Array(0);function Ze(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}function U(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")}function et(r){return new TextEncoder().encode(r)}function tt(r){return new TextDecoder().decode(r)}function Ht(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 i=0;i<r.length;i++){var a=r.charAt(i),d=a.charCodeAt(0);if(t[d]!==255)throw new TypeError(a+" is ambiguous");t[d]=i}var _=r.length,w=r.charAt(0),C=Math.log(_)/Math.log(256),v=Math.log(256)/Math.log(_);function b(s){if(s instanceof Uint8Array||(ArrayBuffer.isView(s)?s=new Uint8Array(s.buffer,s.byteOffset,s.byteLength):Array.isArray(s)&&(s=Uint8Array.from(s))),!(s instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(s.length===0)return"";for(var c=0,I=0,f=0,u=s.length;f!==u&&s[f]===0;)f++,c++;for(var p=(u-f)*v+1>>>0,l=new Uint8Array(p);f!==u;){for(var m=s[f],x=0,h=p-1;(m!==0||x<I)&&h!==-1;h--,x++)m+=256*l[h]>>>0,l[h]=m%_>>>0,m=m/_>>>0;if(m!==0)throw new Error("Non-zero carry");I=x,f++}for(var S=p-I;S!==p&&l[S]===0;)S++;for(var M=w.repeat(c);S<p;++S)M+=r.charAt(l[S]);return M}function O(s){if(typeof s!="string")throw new TypeError("Expected String");if(s.length===0)return new Uint8Array;var c=0;if(s[c]!==" "){for(var I=0,f=0;s[c]===w;)I++,c++;for(var u=(s.length-c)*C+1>>>0,p=new Uint8Array(u);s[c];){var l=t[s.charCodeAt(c)];if(l===255)return;for(var m=0,x=u-1;(l!==0||m<f)&&x!==-1;x--,m++)l+=_*p[x]>>>0,p[x]=l%256>>>0,l=l/256>>>0;if(l!==0)throw new Error("Non-zero carry");f=m,c++}if(s[c]!==" "){for(var h=u-f;h!==u&&p[h]===0;)h++;for(var S=new Uint8Array(I+(u-h)),M=I;h!==u;)S[M++]=p[h++];return S}}}function o(s){var c=O(s);if(c)return c;throw new Error(`Non-${e} character`)}return{encode:b,decodeUnsafe:O,decode:o}}var Jt=Ht,Xt=Jt,nt=Xt;var be=class{name;prefix;baseEncode;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")}},Se=class{name;prefix;baseDecode;prefixCodePoint;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 ot(this,e)}},ve=class{decoders;constructor(e){this.decoders=e}or(e){return ot(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function ot(r,e){return new ve({...r.decoders??{[r.prefix]:r},...e.decoders??{[e.prefix]:e}})}var ye=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,n,i){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=i,this.encoder=new be(e,t,n),this.decoder=new Se(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function $({name:r,prefix:e,encode:t,decode:n}){return new ye(r,e,t,n)}function T({name:r,prefix:e,alphabet:t}){let{encode:n,decode:i}=nt(t,r);return $({prefix:e,name:r,encode:n,decode:a=>U(i(a))})}function Gt(r,e,t,n){let i={};for(let v=0;v<e.length;++v)i[e[v]]=v;let a=r.length;for(;r[a-1]==="=";)--a;let d=new Uint8Array(a*t/8|0),_=0,w=0,C=0;for(let v=0;v<a;++v){let b=i[r[v]];if(b===void 0)throw new SyntaxError(`Non-${n} character`);w=w<<t|b,_+=t,_>=8&&(_-=8,d[C++]=255&w>>_)}if(_>=t||255&w<<8-_)throw new SyntaxError("Unexpected end of data");return d}function Qt(r,e,t){let n=e[e.length-1]==="=",i=(1<<t)-1,a="",d=0,_=0;for(let w=0;w<r.length;++w)for(_=_<<8|r[w],d+=8;d>t;)d-=t,a+=e[i&_>>d];if(d!==0&&(a+=e[i&_<<t-d]),n)for(;a.length*t&7;)a+="=";return a}function y({name:r,prefix:e,bitsPerChar:t,alphabet:n}){return $({prefix:e,name:r,encode(i){return Qt(i,n,t)},decode(i){return Gt(i,n,t,r)}})}var z=T({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Wt=T({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Ce={};A(Ce,{base10:()=>Yt});var Yt=T({prefix:"9",name:"base10",alphabet:"0123456789"});var Ie={};A(Ie,{base16:()=>Zt,base16upper:()=>er});var Zt=y({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),er=y({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Ae={};A(Ae,{base2:()=>tr});var tr=y({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var ze={};A(ze,{base256emoji:()=>sr});var it=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}"),rr=it.reduce((r,e,t)=>(r[t]=e,r),[]),nr=it.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function or(r){return r.reduce((e,t)=>(e+=rr[t],e),"")}function ir(r){let e=[];for(let t of r){let n=nr[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}var sr=$({prefix:"\u{1F680}",name:"base256emoji",encode:or,decode:ir});var ke={};A(ke,{base32:()=>j,base32hex:()=>ur,base32hexpad:()=>pr,base32hexpadupper:()=>lr,base32hexupper:()=>hr,base32pad:()=>cr,base32padupper:()=>fr,base32upper:()=>ar,base32z:()=>dr});var j=y({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ar=y({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),cr=y({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),fr=y({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ur=y({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),hr=y({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),pr=y({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),lr=y({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),dr=y({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var De={};A(De,{base36:()=>mr,base36upper:()=>_r});var mr=T({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),_r=T({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Me={};A(Me,{base64:()=>xr,base64pad:()=>gr,base64url:()=>wr,base64urlpad:()=>br});var xr=y({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),gr=y({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),wr=y({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),br=y({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Ue={};A(Ue,{base8:()=>Sr});var Sr=y({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Fe={};A(Fe,{identity:()=>vr});var vr=$({prefix:"\0",name:"identity",encode:r=>tt(r),decode:r=>et(r)});var An=new TextEncoder,zn=new TextDecoder;var Pe={};A(Pe,{identity:()=>Z});var Cr=ct,st=128,Ir=127,Ar=~Ir,zr=Math.pow(2,31);function ct(r,e,t){e=e||[],t=t||0;for(var n=t;r>=zr;)e[t++]=r&255|st,r/=128;for(;r&Ar;)e[t++]=r&255|st,r>>>=7;return e[t]=r|0,ct.bytes=t-n+1,e}var kr=Te,Dr=128,at=127;function Te(r,n){var t=0,n=n||0,i=0,a=n,d,_=r.length;do{if(a>=_)throw Te.bytes=0,new RangeError("Could not decode varint");d=r[a++],t+=i<28?(d&at)<<i:(d&at)*Math.pow(2,i),i+=7}while(d>=Dr);return Te.bytes=a-n,t}var Mr=Math.pow(2,7),Ur=Math.pow(2,14),Fr=Math.pow(2,21),Tr=Math.pow(2,28),Pr=Math.pow(2,35),Nr=Math.pow(2,42),Br=Math.pow(2,49),Lr=Math.pow(2,56),Rr=Math.pow(2,63),Or=function(r){return r<Mr?1:r<Ur?2:r<Fr?3:r<Tr?4:r<Pr?5:r<Nr?6:r<Br?7:r<Lr?8:r<Rr?9:10},Vr={encode:Cr,decode:kr,encodingLength:Or},qr=Vr,Q=qr;function W(r,e=0){return[Q.decode(r,e),Q.decode.bytes]}function K(r,e,t=0){return Q.encode(r,e,t),e}function H(r){return Q.encodingLength(r)}function P(r,e){let t=e.byteLength,n=H(r),i=n+H(t),a=new Uint8Array(i+t);return K(r,a,0),K(t,a,n),a.set(e,i),new J(r,t,e,a)}function Y(r){let e=U(r),[t,n]=W(e),[i,a]=W(e.subarray(n)),d=e.subarray(n+a);if(d.byteLength!==i)throw new Error("Incorrect length");return new J(t,i,d,e)}function ft(r,e){if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&Ze(r.bytes,t.bytes)}}var J=class{code;size;digest;bytes;constructor(e,t,n,i){this.code=e,this.size=t,this.digest=n,this.bytes=i}};var ut=0,$r="identity",ht=U;function jr(r){return P(ut,ht(r))}var Z={code:ut,name:$r,encode:ht,digest:jr};var Le={};A(Le,{sha256:()=>me,sha512:()=>Kr});function Be({name:r,code:e,encode:t}){return new Ne(r,e,t)}var Ne=class{name;code;encode;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?P(this.code,t):t.then(n=>P(this.code,n))}else throw Error("Unknown type, must be binary type")}};function lt(r){return async e=>new Uint8Array(await crypto.subtle.digest(r,e))}var me=Be({name:"sha2-256",code:18,encode:lt("SHA-256")}),Kr=Be({name:"sha2-512",code:19,encode:lt("SHA-512")});function dt(r,e){let{bytes:t,version:n}=r;switch(n){case 0:return Jr(t,Re(r),e??z.encoder);default:return Xr(t,Re(r),e??j.encoder)}}var mt=new WeakMap;function Re(r){let e=mt.get(r);if(e==null){let t=new Map;return mt.set(r,t),t}return e}var N=class r{code;version;multihash;bytes;"/";constructor(e,t,n,i){this.code=t,this.version=e,this.multihash=n,this.bytes=i,this["/"]=i}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!==ee)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==Gr)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,n=P(e,t);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return r.equals(this,e)}static equals(e,t){let n=t;return n!=null&&e.code===n.code&&e.version===n.version&&ft(e.multihash,n.multihash)}toString(e){return dt(this,e)}toJSON(){return{"/":dt(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof r)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:i,multihash:a,bytes:d}=t;return new r(n,i,a,d??_t(n,i,a.bytes))}else if(t[Qr]===!0){let{version:n,multihash:i,code:a}=t,d=Y(i);return r.create(n,a,d)}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!==ee)throw new Error(`Version 0 CID must use dag-pb (code: ${ee}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let i=_t(e,t,n.bytes);return new r(e,t,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,ee,e)}static createV1(e,t){return r.create(1,e,t)}static decode(e){let[t,n]=r.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=r.inspectBytes(e),n=t.size-t.multihashSize,i=U(e.subarray(n,n+t.multihashSize));if(i.byteLength!==t.multihashSize)throw new Error("Incorrect length");let a=i.subarray(t.multihashSize-t.digestSize),d=new J(t.multihashCode,t.digestSize,a,i);return[t.version===0?r.createV0(d):r.createV1(t.codec,d),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[b,O]=W(e.subarray(t));return t+=O,b},i=n(),a=ee;if(i===18?(i=0,t=0):a=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let d=t,_=n(),w=n(),C=t+w,v=C-d;return{version:i,codec:a,multihashCode:_,digestSize:w,multihashSize:v,size:C}}static parse(e,t){let[n,i]=Hr(e,t),a=r.decode(i);if(a.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Re(a).set(n,e),a}};function Hr(r,e){switch(r[0]){case"Q":{let t=e??z;return[z.prefix,t.decode(`${z.prefix}${r}`)]}case z.prefix:{let t=e??z;return[z.prefix,t.decode(r)]}case j.prefix:{let t=e??j;return[j.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)]}}}function Jr(r,e,t){let{prefix:n}=t;if(n!==z.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let i=e.get(n);if(i==null){let a=t.encode(r).slice(1);return e.set(n,a),a}else return i}function Xr(r,e,t){let{prefix:n}=t,i=e.get(n);if(i==null){let a=t.encode(r);return e.set(n,a),a}else return i}var ee=112,Gr=18;function _t(r,e,t){let n=H(r),i=n+H(e),a=new Uint8Array(i+t.byteLength);return K(r,a,0),K(e,a,n),a.set(t,i),a}var Qr=Symbol.for("@ipld/js-cid/CID");var G={...Fe,...Ae,...Ue,...Ce,...Ie,...ke,...De,...Ee,...Me,...ze},Gn={...Le,...Pe};function te(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}function xt(r=0){return new Uint8Array(r)}function gt(r=0){return new Uint8Array(r)}function bt(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var wt=bt("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Oe=bt("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=gt(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),Wr={utf8:wt,"utf-8":wt,hex:G.base16,latin1:Oe,ascii:Oe,binary:Oe,...G},_e=Wr;function k(r,e="utf8"){let t=_e[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.decoder.decode(`${t.prefix}${r}`)}function Ve(r,e="utf8"){let t=_e[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.encoder.encode(r).substring(1)}var vt=Symbol.for("nodejs.util.inspect.custom"),St=Object.values(G).map(r=>r.decoder).reduce((r,e)=>r.or(e),G.identity.decoder),yt=114,Et=36,Ct=37,re=class{type;multihash;privateKey;publicKey;string;constructor(e){this.type=e.type,this.multihash=e.multihash,this.privateKey=e.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}[we]=!0;toString(){return this.string==null&&(this.string=z.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return N.createV1(yt,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e==null)return!1;if(e instanceof Uint8Array)return te(this.multihash.bytes,e);if(typeof e=="string")return E(e).equals(this);if(e?.multihash?.bytes!=null)return te(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[vt](){return`PeerId(${this.toString()})`}},ne=class extends re{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},oe=class extends re{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.multihash.digest}},ie=class extends re{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.multihash.digest}},qe=2336,$e=class{type="url";multihash;privateKey;publicKey;url;constructor(e){this.url=e.toString(),this.multihash=Z.digest(k(this.url))}[vt](){return`PeerId(${this.url})`}[we]=!0;toString(){return this.toCID().toString()}toCID(){return N.createV1(qe,this.multihash)}toBytes(){return this.toCID().bytes}equals(e){return e==null?!1:(e instanceof Uint8Array&&(e=Ve(e)),e.toString()===this.toString())}};function E(r,e){if(e=e??St,r.charAt(0)==="1"||r.charAt(0)==="Q"){let t=Y(z.decode(`z${r}`));return r.startsWith("12D")?new oe({multihash:t}):r.startsWith("16U")?new ie({multihash:t}):new ne({multihash:t})}return Yr(St.decode(r))}function Yr(r){try{let e=Y(r);if(e.code===Z.code){if(e.digest.length===Et)return new oe({multihash:e});if(e.digest.length===Ct)return new ie({multihash:e})}if(e.code===me.code)return new ne({multihash:e})}catch{return Zr(N.decode(r))}throw new Error("Supplied PeerID CID is invalid")}function Zr(r){if(r==null||r.multihash==null||r.version==null||r.version===1&&r.code!==yt&&r.code!==qe)throw new Error("Supplied PeerID CID is invalid");if(r.code===qe){let t=Ve(r.multihash.digest);return new $e(new URL(t))}let e=r.multihash;if(e.code===me.code)return new ne({multihash:r.multihash});if(e.code===Z.code){if(e.digest.length===Et)return new oe({multihash:r.multihash});if(e.digest.length===Ct)return new ie({multihash:r.multihash})}throw new Error("Supplied PeerID CID is invalid")}function F(r,e){let t={[Symbol.iterator]:()=>t,next:()=>{let n=r.next(),i=n.value;return n.done===!0||i==null?{done:!0,value:void 0}:{done:!1,value:e(i)}}};return t}var B=class{map;constructor(e){if(this.map=new Map,e!=null)for(let[t,n]of e.entries())this.map.set(t.toString(),n)}[Symbol.iterator](){return this.entries()}clear(){this.map.clear()}delete(e){return this.map.delete(e.toString())}entries(){return F(this.map.entries(),e=>[E(e[0]),e[1]])}forEach(e){this.map.forEach((t,n)=>{e(t,E(n),this)})}get(e){return this.map.get(e.toString())}has(e){return this.map.has(e.toString())}set(e,t){this.map.set(e.toString(),t)}keys(){return F(this.map.keys(),e=>E(e))}values(){return this.map.values()}get size(){return this.map.size}};function It(){return new B}var L=class r{set;constructor(e){if(this.set=new Set,e!=null)for(let t of e)this.set.add(t.toString())}get size(){return this.set.size}[Symbol.iterator](){return this.values()}add(e){this.set.add(e.toString())}clear(){this.set.clear()}delete(e){this.set.delete(e.toString())}entries(){return F(this.set.entries(),e=>{let t=E(e[0]);return[t,t]})}forEach(e){this.set.forEach(t=>{let n=E(t);e(n,n,this)})}has(e){return this.set.has(e.toString())}values(){return F(this.set.values(),e=>E(e))}intersection(e){let t=new r;for(let n of e)this.has(n)&&t.add(n);return t}difference(e){let t=new r;for(let n of this)e.has(n)||t.add(n);return t}union(e){let t=new r;for(let n of e)t.add(n);for(let n of this)t.add(n);return t}};function At(){return new L}var R=class r{list;constructor(e){if(this.list=[],e!=null)for(let t of e)this.list.push(t.toString())}[Symbol.iterator](){return F(this.list.entries(),e=>E(e[1]))}concat(e){let t=new r(this);for(let n of e)t.push(n);return t}entries(){return F(this.list.entries(),e=>[e[0],E(e[1])])}every(e){return this.list.every((t,n)=>e(E(t),n,this))}filter(e){let t=new r;return this.list.forEach((n,i)=>{let a=E(n);e(a,i,this)&&t.push(a)}),t}find(e){let t=this.list.find((n,i)=>e(E(n),i,this));if(t!=null)return E(t)}findIndex(e){return this.list.findIndex((t,n)=>e(E(t),n,this))}forEach(e){this.list.forEach((t,n)=>{e(E(t),n,this)})}includes(e){return this.list.includes(e.toString())}indexOf(e){return this.list.indexOf(e.toString())}pop(){let e=this.list.pop();if(e!=null)return E(e)}push(...e){for(let t of e)this.list.push(t.toString())}shift(){let e=this.list.shift();if(e!=null)return E(e)}unshift(...e){let t=this.list.length;for(let n=e.length-1;n>-1;n--)t=this.list.unshift(e[n].toString());return t}clear(){this.list=[]}get length(){return this.list.length}};function zt(){return new R}var je=64,D=class{fp;h;seed;constructor(e,t,n,i=2){if(i>je)throw new TypeError("Invalid Fingerprint Size");let a=t.hashV(e,n),d=xt(i);for(let _=0;_<d.length;_++)d[_]=a[_];d.length===0&&(d[0]=7),this.fp=d,this.h=t,this.seed=n}hash(){return this.h.hash(this.fp,this.seed)}equals(e){return e?.fp instanceof Uint8Array?te(this.fp,e.fp):!1}};function V(r,e){return Math.floor(Math.random()*(e-r))+r}var q=class{contents;constructor(e){this.contents=new Array(e).fill(null)}has(e){if(!(e instanceof D))throw new TypeError("Invalid Fingerprint");return this.contents.some(t=>e.equals(t))}add(e){if(!(e instanceof D))throw new TypeError("Invalid Fingerprint");for(let t=0;t<this.contents.length;t++)if(this.contents[t]==null)return this.contents[t]=e,!0;return!0}swap(e){if(!(e instanceof D))throw new TypeError("Invalid Fingerprint");let t=V(0,this.contents.length-1),n=this.contents[t];return this.contents[t]=e,n}remove(e){if(!(e instanceof D))throw new TypeError("Invalid Fingerprint");let t=this.contents.findIndex(n=>e.equals(n));return t>-1?(this.contents[t]=null,!0):!1}};var Ke={32:16777619n,64:1099511628211n,128:309485009821345068724781371n,256:374144419156711147060143317175368453031918731002211n,512:35835915874844867368919076489095108449946327955754392558399825615420669938882575126094039892345713852759n,1024:5016456510113118655434598811035278955030765345404790744303017523831112055108147451509157692220295382716162651878526895249385292291816524375083746691371804094271873160484737966720260389217684476157468082573n},Ut={32:2166136261n,64:14695981039346656037n,128:144066263297769815596495629667062367629n,256:100029257958052580907070968620625704837092796014241193945225284501741471925557n,512:9659303129496669498009435400716310466090418745672637896108374329434462657994582932197716438449813051892206539805784495328239340083876191928701583869517785n,1024:14197795064947621068722070641403218320880622795441933960878474914617582723252296732303717722150864096521202355549365628174669108571814760471015076148029755969804077320157692458563003215304957150157403644460363550505412711285966361610267868082893823963790439336411086884584107735010676915n},Ft=new globalThis.TextEncoder;function en(r,e){let t=Ke[e],n=Ut[e];for(let i=0;i<r.length;i++)n^=BigInt(r[i]),n=BigInt.asUintN(e,n*t);return n}function tn(r,e,t){if(t.length===0)throw new Error("The `utf8Buffer` option must have a length greater than zero");let n=Ke[e],i=Ut[e],a=r;for(;a.length>0;){let d=Ft.encodeInto(a,t);a=a.slice(d.read);for(let _=0;_<d.written;_++)i^=BigInt(t[_]),i=BigInt.asUintN(e,i*n)}return i}function He(r,{size:e=32,utf8Buffer:t}={}){if(!Ke[e])throw new Error("The `size` option must be one of 32, 64, 128, 256, 512, or 1024");if(typeof r=="string"){if(t)return tn(r,e,t);r=Ft.encode(r)}return en(r,e)}var rn=jt(Mt(),1);var ae={hash:r=>Number(He(r,{size:32})),hashV:(r,e)=>nn(ae.hash(r,e))};function nn(r){let e=r.toString(16);return e.length%2===1&&(e=`0${e}`),k(e,"base16")}var on=500,ce=class{bucketSize;filterSize;fingerprintSize;buckets;count;hash;seed;constructor(e){this.filterSize=e.filterSize,this.bucketSize=e.bucketSize??4,this.fingerprintSize=e.fingerprintSize??2,this.count=0,this.buckets=[],this.hash=e.hash??ae,this.seed=e.seed??V(0,Math.pow(2,10))}add(e){typeof e=="string"&&(e=k(e));let t=new D(e,this.hash,this.seed,this.fingerprintSize),n=this.hash.hash(e,this.seed)%this.filterSize,i=(n^t.hash())%this.filterSize;if(this.buckets[n]==null&&(this.buckets[n]=new q(this.bucketSize)),this.buckets[i]==null&&(this.buckets[i]=new q(this.bucketSize)),this.buckets[n].add(t)||this.buckets[i].add(t))return this.count++,!0;let a=[n,i],d=a[V(0,a.length-1)];this.buckets[d]==null&&(this.buckets[d]=new q(this.bucketSize));for(let _=0;_<on;_++){let w=this.buckets[d].swap(t);if(w!=null&&(d=(d^w.hash())%this.filterSize,this.buckets[d]==null&&(this.buckets[d]=new q(this.bucketSize)),this.buckets[d].add(w)))return this.count++,!0}return!1}has(e){typeof e=="string"&&(e=k(e));let t=new D(e,this.hash,this.seed,this.fingerprintSize),n=this.hash.hash(e,this.seed)%this.filterSize,i=this.buckets[n]?.has(t)??!1;if(i)return i;let a=(n^t.hash())%this.filterSize;return this.buckets[a]?.has(t)??!1}remove(e){typeof e=="string"&&(e=k(e));let t=new D(e,this.hash,this.seed,this.fingerprintSize),n=this.hash.hash(e,this.seed)%this.filterSize,i=this.buckets[n]?.remove(t)??!1;if(i)return this.count--,i;let a=(n^t.hash())%this.filterSize,d=this.buckets[a]?.remove(t)??!1;return d&&this.count--,d}get reliable(){return Math.floor(100*(this.count/this.filterSize))<=95}},sn={1:.5,2:.84,4:.95,8:.98};function an(r=.001){return r>.002?2:r>1e-5?4:8}function Tt(r,e=.001){let t=an(e),n=sn[t],i=Math.round(r/n),a=Math.min(Math.ceil(Math.log(i/t))+2,je);return{filterSize:i,bucketSize:t,fingerprintSize:a}}var ge=class{filterSize;bucketSize;fingerprintSize;scale;filterSeries;hash;seed;constructor(e){this.bucketSize=e.bucketSize??4,this.filterSize=e.filterSize??(1<<18)/this.bucketSize,this.fingerprintSize=e.fingerprintSize??2,this.scale=e.scale??2,this.hash=e.hash??ae,this.seed=e.seed??V(0,Math.pow(2,10)),this.filterSeries=[new ce({filterSize:this.filterSize,bucketSize:this.bucketSize,fingerprintSize:this.fingerprintSize,hash:this.hash,seed:this.seed})]}add(e){if(typeof e=="string"&&(e=k(e)),this.has(e))return!0;let t=this.filterSeries.find(n=>n.reliable);if(t==null){let n=this.filterSize*Math.pow(this.scale,this.filterSeries.length);t=new ce({filterSize:n,bucketSize:this.bucketSize,fingerprintSize:this.fingerprintSize,hash:this.hash,seed:this.seed}),this.filterSeries.push(t)}return t.add(e)}has(e){typeof e=="string"&&(e=k(e));for(let t=0;t<this.filterSeries.length;t++)if(this.filterSeries[t].has(e))return!0;return!1}remove(e){typeof e=="string"&&(e=k(e));for(let t=0;t<this.filterSeries.length;t++)if(this.filterSeries[t].remove(e))return!0;return!1}get count(){return this.filterSeries.reduce((e,t)=>e+t.count,0)}};function Je(r,e=.001,t){return new ge({...Tt(r,e),...t??{}})}var fe=class{filter;constructor(e,t){this.filter=Je(e,t)}has(e){return this.filter.has(e.toBytes())}add(e){this.filter.add(e.toBytes())}remove(e){this.filter.remove?.(e.toBytes())}};function Pt(r,e=.001){return new fe(r,e)}var Xe=class extends B{metric;constructor(e){super();let{name:t,metrics:n}=e;this.metric=n.registerMetric(t),this.updateComponentMetric()}set(e,t){return super.set(e,t),this.updateComponentMetric(),this}delete(e){let t=super.delete(e);return this.updateComponentMetric(),t}clear(){super.clear(),this.updateComponentMetric()}updateComponentMetric(){this.metric.update(this.size)}};function Nt(r){let{name:e,metrics:t}=r,n;return t!=null?n=new Xe({name:e,metrics:t}):n=new B,n}var Ge=class extends L{metric;constructor(e){super();let{name:t,metrics:n}=e;this.metric=n.registerMetric(t),this.updateComponentMetric()}add(e){super.add(e),this.updateComponentMetric()}delete(e){super.delete(e),this.updateComponentMetric()}clear(){super.clear(),this.updateComponentMetric()}updateComponentMetric(){this.metric.update(this.size)}};function Bt(r){let{name:e,metrics:t}=r,n;return t!=null?n=new Ge({name:e,metrics:t}):n=new L,n}var Qe=class extends R{metric;constructor(e){super();let{name:t,metrics:n}=e;this.metric=n.registerMetric(t),this.updateComponentMetric()}pop(){let e=super.pop();return this.updateComponentMetric(),e}push(...e){super.push(...e),this.updateComponentMetric()}shift(){let e=super.shift();return this.updateComponentMetric(),e}unshift(...e){let t=super.unshift(...e);return this.updateComponentMetric(),t}clear(){super.clear(),this.updateComponentMetric()}updateComponentMetric(){this.metric.update(this.length)}};function Lt(r){let{name:e,metrics:t}=r,n;return t!=null?n=new Qe({name:e,metrics:t}):n=new R,n}return Kt(cn);})();
2
+ "use strict";var Libp2PPeerCollections=(()=>{var Rt=Object.create;var le=Object.defineProperty;var Ot=Object.getOwnPropertyDescriptor;var Vt=Object.getOwnPropertyNames;var qt=Object.getPrototypeOf,$t=Object.prototype.hasOwnProperty;var We=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),A=(r,e)=>{for(var t in e)le(r,t,{get:e[t],enumerable:!0})},Ye=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Vt(e))!$t.call(r,i)&&i!==t&&le(r,i,{get:()=>e[i],enumerable:!(n=Ot(e,i))||n.enumerable});return r};var jt=(r,e,t)=>(t=r!=null?Rt(qt(r)):{},Ye(e||!r||!r.__esModule?le(t,"default",{value:r,enumerable:!0}):t,r)),Kt=r=>Ye(le({},"__esModule",{value:!0}),r);var kt=We((se,xe)=>{(function(r,e){"use strict";var t={version:"3.0.0",x86:{},x64:{},inputValidation:!0};function n(o){if(!Array.isArray(o)&&!ArrayBuffer.isView(o))return!1;for(var s=0;s<o.length;s++)if(!Number.isInteger(o[s])||o[s]<0||o[s]>255)return!1;return!0}function i(o,s){return(o&65535)*s+(((o>>>16)*s&65535)<<16)}function a(o,s){return o<<s|o>>>32-s}function d(o){return o^=o>>>16,o=i(o,2246822507),o^=o>>>13,o=i(o,3266489909),o^=o>>>16,o}function _(o,s){o=[o[0]>>>16,o[0]&65535,o[1]>>>16,o[1]&65535],s=[s[0]>>>16,s[0]&65535,s[1]>>>16,s[1]&65535];var c=[0,0,0,0];return c[3]+=o[3]+s[3],c[2]+=c[3]>>>16,c[3]&=65535,c[2]+=o[2]+s[2],c[1]+=c[2]>>>16,c[2]&=65535,c[1]+=o[1]+s[1],c[0]+=c[1]>>>16,c[1]&=65535,c[0]+=o[0]+s[0],c[0]&=65535,[c[0]<<16|c[1],c[2]<<16|c[3]]}function w(o,s){o=[o[0]>>>16,o[0]&65535,o[1]>>>16,o[1]&65535],s=[s[0]>>>16,s[0]&65535,s[1]>>>16,s[1]&65535];var c=[0,0,0,0];return c[3]+=o[3]*s[3],c[2]+=c[3]>>>16,c[3]&=65535,c[2]+=o[2]*s[3],c[1]+=c[2]>>>16,c[2]&=65535,c[2]+=o[3]*s[2],c[1]+=c[2]>>>16,c[2]&=65535,c[1]+=o[1]*s[3],c[0]+=c[1]>>>16,c[1]&=65535,c[1]+=o[2]*s[2],c[0]+=c[1]>>>16,c[1]&=65535,c[1]+=o[3]*s[1],c[0]+=c[1]>>>16,c[1]&=65535,c[0]+=o[0]*s[3]+o[1]*s[2]+o[2]*s[1]+o[3]*s[0],c[0]&=65535,[c[0]<<16|c[1],c[2]<<16|c[3]]}function C(o,s){return s%=64,s===32?[o[1],o[0]]:s<32?[o[0]<<s|o[1]>>>32-s,o[1]<<s|o[0]>>>32-s]:(s-=32,[o[1]<<s|o[0]>>>32-s,o[0]<<s|o[1]>>>32-s])}function v(o,s){return s%=64,s===0?o:s<32?[o[0]<<s|o[1]>>>32-s,o[1]<<s]:[o[1]<<s-32,0]}function b(o,s){return[o[0]^s[0],o[1]^s[1]]}function O(o){return o=b(o,[0,o[0]>>>1]),o=w(o,[4283543511,3981806797]),o=b(o,[0,o[0]>>>1]),o=w(o,[3301882366,444984403]),o=b(o,[0,o[0]>>>1]),o}t.x86.hash32=function(o,s){if(t.inputValidation&&!n(o))return e;s=s||0;for(var c=o.length%4,I=o.length-c,f=s,u=0,p=3432918353,l=461845907,m=0;m<I;m=m+4)u=o[m]|o[m+1]<<8|o[m+2]<<16|o[m+3]<<24,u=i(u,p),u=a(u,15),u=i(u,l),f^=u,f=a(f,13),f=i(f,5)+3864292196;switch(u=0,c){case 3:u^=o[m+2]<<16;case 2:u^=o[m+1]<<8;case 1:u^=o[m],u=i(u,p),u=a(u,15),u=i(u,l),f^=u}return f^=o.length,f=d(f),f>>>0},t.x86.hash128=function(o,s){if(t.inputValidation&&!n(o))return e;s=s||0;for(var c=o.length%16,I=o.length-c,f=s,u=s,p=s,l=s,m=0,x=0,h=0,S=0,D=597399067,ue=2869860233,he=951274213,pe=2716044179,g=0;g<I;g=g+16)m=o[g]|o[g+1]<<8|o[g+2]<<16|o[g+3]<<24,x=o[g+4]|o[g+5]<<8|o[g+6]<<16|o[g+7]<<24,h=o[g+8]|o[g+9]<<8|o[g+10]<<16|o[g+11]<<24,S=o[g+12]|o[g+13]<<8|o[g+14]<<16|o[g+15]<<24,m=i(m,D),m=a(m,15),m=i(m,ue),f^=m,f=a(f,19),f+=u,f=i(f,5)+1444728091,x=i(x,ue),x=a(x,16),x=i(x,he),u^=x,u=a(u,17),u+=p,u=i(u,5)+197830471,h=i(h,he),h=a(h,17),h=i(h,pe),p^=h,p=a(p,15),p+=l,p=i(p,5)+2530024501,S=i(S,pe),S=a(S,18),S=i(S,D),l^=S,l=a(l,13),l+=f,l=i(l,5)+850148119;switch(m=0,x=0,h=0,S=0,c){case 15:S^=o[g+14]<<16;case 14:S^=o[g+13]<<8;case 13:S^=o[g+12],S=i(S,pe),S=a(S,18),S=i(S,D),l^=S;case 12:h^=o[g+11]<<24;case 11:h^=o[g+10]<<16;case 10:h^=o[g+9]<<8;case 9:h^=o[g+8],h=i(h,he),h=a(h,17),h=i(h,pe),p^=h;case 8:x^=o[g+7]<<24;case 7:x^=o[g+6]<<16;case 6:x^=o[g+5]<<8;case 5:x^=o[g+4],x=i(x,ue),x=a(x,16),x=i(x,he),u^=x;case 4:m^=o[g+3]<<24;case 3:m^=o[g+2]<<16;case 2:m^=o[g+1]<<8;case 1:m^=o[g],m=i(m,D),m=a(m,15),m=i(m,ue),f^=m}return f^=o.length,u^=o.length,p^=o.length,l^=o.length,f+=u,f+=p,f+=l,u+=f,p+=f,l+=f,f=d(f),u=d(u),p=d(p),l=d(l),f+=u,f+=p,f+=l,u+=f,p+=f,l+=f,("00000000"+(f>>>0).toString(16)).slice(-8)+("00000000"+(u>>>0).toString(16)).slice(-8)+("00000000"+(p>>>0).toString(16)).slice(-8)+("00000000"+(l>>>0).toString(16)).slice(-8)},t.x64.hash128=function(o,s){if(t.inputValidation&&!n(o))return e;s=s||0;for(var c=o.length%16,I=o.length-c,f=[0,s],u=[0,s],p=[0,0],l=[0,0],m=[2277735313,289559509],x=[1291169091,658871167],h=0;h<I;h=h+16)p=[o[h+4]|o[h+5]<<8|o[h+6]<<16|o[h+7]<<24,o[h]|o[h+1]<<8|o[h+2]<<16|o[h+3]<<24],l=[o[h+12]|o[h+13]<<8|o[h+14]<<16|o[h+15]<<24,o[h+8]|o[h+9]<<8|o[h+10]<<16|o[h+11]<<24],p=w(p,m),p=C(p,31),p=w(p,x),f=b(f,p),f=C(f,27),f=_(f,u),f=_(w(f,[0,5]),[0,1390208809]),l=w(l,x),l=C(l,33),l=w(l,m),u=b(u,l),u=C(u,31),u=_(u,f),u=_(w(u,[0,5]),[0,944331445]);switch(p=[0,0],l=[0,0],c){case 15:l=b(l,v([0,o[h+14]],48));case 14:l=b(l,v([0,o[h+13]],40));case 13:l=b(l,v([0,o[h+12]],32));case 12:l=b(l,v([0,o[h+11]],24));case 11:l=b(l,v([0,o[h+10]],16));case 10:l=b(l,v([0,o[h+9]],8));case 9:l=b(l,[0,o[h+8]]),l=w(l,x),l=C(l,33),l=w(l,m),u=b(u,l);case 8:p=b(p,v([0,o[h+7]],56));case 7:p=b(p,v([0,o[h+6]],48));case 6:p=b(p,v([0,o[h+5]],40));case 5:p=b(p,v([0,o[h+4]],32));case 4:p=b(p,v([0,o[h+3]],24));case 3:p=b(p,v([0,o[h+2]],16));case 2:p=b(p,v([0,o[h+1]],8));case 1:p=b(p,[0,o[h]]),p=w(p,m),p=C(p,31),p=w(p,x),f=b(f,p)}return f=b(f,[0,o.length]),u=b(u,[0,o.length]),f=_(f,u),u=_(u,f),f=O(f),u=O(u),f=_(f,u),u=_(u,f),("00000000"+(f[0]>>>0).toString(16)).slice(-8)+("00000000"+(f[1]>>>0).toString(16)).slice(-8)+("00000000"+(u[0]>>>0).toString(16)).slice(-8)+("00000000"+(u[1]>>>0).toString(16)).slice(-8)},typeof se<"u"?(typeof xe<"u"&&xe.exports&&(se=xe.exports=t),se.murmurHash3=t):typeof define=="function"&&define.amd?define([],function(){return t}):(t._murmurHash3=r.murmurHash3,t.noConflict=function(){return r.murmurHash3=t._murmurHash3,t._murmurHash3=e,t.noConflict=e,t},r.murmurHash3=t)})(se)});var Dt=We((Ao,Mt)=>{Mt.exports=kt()});var cn={};A(cn,{PeerFilter:()=>fe,PeerList:()=>R,PeerMap:()=>B,PeerSet:()=>L,peerFilter:()=>Pt,peerList:()=>zt,peerMap:()=>It,peerSet:()=>At,trackedPeerList:()=>Lt,trackedPeerMap:()=>Nt,trackedPeerSet:()=>Bt});var we=Symbol.for("@libp2p/peer-id");var Ee={};A(Ee,{base58btc:()=>z,base58flickr:()=>Wt});var hn=new Uint8Array(0);function Ze(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}function U(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")}function et(r){return new TextEncoder().encode(r)}function tt(r){return new TextDecoder().decode(r)}function Ht(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 i=0;i<r.length;i++){var a=r.charAt(i),d=a.charCodeAt(0);if(t[d]!==255)throw new TypeError(a+" is ambiguous");t[d]=i}var _=r.length,w=r.charAt(0),C=Math.log(_)/Math.log(256),v=Math.log(256)/Math.log(_);function b(s){if(s instanceof Uint8Array||(ArrayBuffer.isView(s)?s=new Uint8Array(s.buffer,s.byteOffset,s.byteLength):Array.isArray(s)&&(s=Uint8Array.from(s))),!(s instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(s.length===0)return"";for(var c=0,I=0,f=0,u=s.length;f!==u&&s[f]===0;)f++,c++;for(var p=(u-f)*v+1>>>0,l=new Uint8Array(p);f!==u;){for(var m=s[f],x=0,h=p-1;(m!==0||x<I)&&h!==-1;h--,x++)m+=256*l[h]>>>0,l[h]=m%_>>>0,m=m/_>>>0;if(m!==0)throw new Error("Non-zero carry");I=x,f++}for(var S=p-I;S!==p&&l[S]===0;)S++;for(var D=w.repeat(c);S<p;++S)D+=r.charAt(l[S]);return D}function O(s){if(typeof s!="string")throw new TypeError("Expected String");if(s.length===0)return new Uint8Array;var c=0;if(s[c]!==" "){for(var I=0,f=0;s[c]===w;)I++,c++;for(var u=(s.length-c)*C+1>>>0,p=new Uint8Array(u);s[c];){var l=t[s.charCodeAt(c)];if(l===255)return;for(var m=0,x=u-1;(l!==0||m<f)&&x!==-1;x--,m++)l+=_*p[x]>>>0,p[x]=l%256>>>0,l=l/256>>>0;if(l!==0)throw new Error("Non-zero carry");f=m,c++}if(s[c]!==" "){for(var h=u-f;h!==u&&p[h]===0;)h++;for(var S=new Uint8Array(I+(u-h)),D=I;h!==u;)S[D++]=p[h++];return S}}}function o(s){var c=O(s);if(c)return c;throw new Error(`Non-${e} character`)}return{encode:b,decodeUnsafe:O,decode:o}}var Jt=Ht,Xt=Jt,nt=Xt;var be=class{name;prefix;baseEncode;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")}},Se=class{name;prefix;baseDecode;prefixCodePoint;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 ot(this,e)}},ve=class{decoders;constructor(e){this.decoders=e}or(e){return ot(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function ot(r,e){return new ve({...r.decoders??{[r.prefix]:r},...e.decoders??{[e.prefix]:e}})}var ye=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,n,i){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=i,this.encoder=new be(e,t,n),this.decoder=new Se(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function $({name:r,prefix:e,encode:t,decode:n}){return new ye(r,e,t,n)}function T({name:r,prefix:e,alphabet:t}){let{encode:n,decode:i}=nt(t,r);return $({prefix:e,name:r,encode:n,decode:a=>U(i(a))})}function Gt(r,e,t,n){let i={};for(let v=0;v<e.length;++v)i[e[v]]=v;let a=r.length;for(;r[a-1]==="=";)--a;let d=new Uint8Array(a*t/8|0),_=0,w=0,C=0;for(let v=0;v<a;++v){let b=i[r[v]];if(b===void 0)throw new SyntaxError(`Non-${n} character`);w=w<<t|b,_+=t,_>=8&&(_-=8,d[C++]=255&w>>_)}if(_>=t||255&w<<8-_)throw new SyntaxError("Unexpected end of data");return d}function Qt(r,e,t){let n=e[e.length-1]==="=",i=(1<<t)-1,a="",d=0,_=0;for(let w=0;w<r.length;++w)for(_=_<<8|r[w],d+=8;d>t;)d-=t,a+=e[i&_>>d];if(d!==0&&(a+=e[i&_<<t-d]),n)for(;a.length*t&7;)a+="=";return a}function y({name:r,prefix:e,bitsPerChar:t,alphabet:n}){return $({prefix:e,name:r,encode(i){return Qt(i,n,t)},decode(i){return Gt(i,n,t,r)}})}var z=T({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Wt=T({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Ce={};A(Ce,{base10:()=>Yt});var Yt=T({prefix:"9",name:"base10",alphabet:"0123456789"});var Ie={};A(Ie,{base16:()=>Zt,base16upper:()=>er});var Zt=y({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),er=y({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Ae={};A(Ae,{base2:()=>tr});var tr=y({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var ze={};A(ze,{base256emoji:()=>sr});var it=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}"),rr=it.reduce((r,e,t)=>(r[t]=e,r),[]),nr=it.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function or(r){return r.reduce((e,t)=>(e+=rr[t],e),"")}function ir(r){let e=[];for(let t of r){let n=nr[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}var sr=$({prefix:"\u{1F680}",name:"base256emoji",encode:or,decode:ir});var ke={};A(ke,{base32:()=>j,base32hex:()=>ur,base32hexpad:()=>pr,base32hexpadupper:()=>lr,base32hexupper:()=>hr,base32pad:()=>cr,base32padupper:()=>fr,base32upper:()=>ar,base32z:()=>dr});var j=y({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ar=y({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),cr=y({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),fr=y({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ur=y({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),hr=y({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),pr=y({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),lr=y({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),dr=y({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Me={};A(Me,{base36:()=>mr,base36upper:()=>_r});var mr=T({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),_r=T({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var De={};A(De,{base64:()=>xr,base64pad:()=>gr,base64url:()=>wr,base64urlpad:()=>br});var xr=y({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),gr=y({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),wr=y({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),br=y({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Ue={};A(Ue,{base8:()=>Sr});var Sr=y({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Fe={};A(Fe,{identity:()=>vr});var vr=$({prefix:"\0",name:"identity",encode:r=>tt(r),decode:r=>et(r)});var An=new TextEncoder,zn=new TextDecoder;var Pe={};A(Pe,{identity:()=>Z});var Cr=ct,st=128,Ir=127,Ar=~Ir,zr=Math.pow(2,31);function ct(r,e,t){e=e||[],t=t||0;for(var n=t;r>=zr;)e[t++]=r&255|st,r/=128;for(;r&Ar;)e[t++]=r&255|st,r>>>=7;return e[t]=r|0,ct.bytes=t-n+1,e}var kr=Te,Mr=128,at=127;function Te(r,n){var t=0,n=n||0,i=0,a=n,d,_=r.length;do{if(a>=_)throw Te.bytes=0,new RangeError("Could not decode varint");d=r[a++],t+=i<28?(d&at)<<i:(d&at)*Math.pow(2,i),i+=7}while(d>=Mr);return Te.bytes=a-n,t}var Dr=Math.pow(2,7),Ur=Math.pow(2,14),Fr=Math.pow(2,21),Tr=Math.pow(2,28),Pr=Math.pow(2,35),Nr=Math.pow(2,42),Br=Math.pow(2,49),Lr=Math.pow(2,56),Rr=Math.pow(2,63),Or=function(r){return r<Dr?1:r<Ur?2:r<Fr?3:r<Tr?4:r<Pr?5:r<Nr?6:r<Br?7:r<Lr?8:r<Rr?9:10},Vr={encode:Cr,decode:kr,encodingLength:Or},qr=Vr,Q=qr;function W(r,e=0){return[Q.decode(r,e),Q.decode.bytes]}function K(r,e,t=0){return Q.encode(r,e,t),e}function H(r){return Q.encodingLength(r)}function P(r,e){let t=e.byteLength,n=H(r),i=n+H(t),a=new Uint8Array(i+t);return K(r,a,0),K(t,a,n),a.set(e,i),new J(r,t,e,a)}function Y(r){let e=U(r),[t,n]=W(e),[i,a]=W(e.subarray(n)),d=e.subarray(n+a);if(d.byteLength!==i)throw new Error("Incorrect length");return new J(t,i,d,e)}function ft(r,e){if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&Ze(r.bytes,t.bytes)}}var J=class{code;size;digest;bytes;constructor(e,t,n,i){this.code=e,this.size=t,this.digest=n,this.bytes=i}};var ut=0,$r="identity",ht=U;function jr(r){return P(ut,ht(r))}var Z={code:ut,name:$r,encode:ht,digest:jr};var Le={};A(Le,{sha256:()=>me,sha512:()=>Kr});function Be({name:r,code:e,encode:t}){return new Ne(r,e,t)}var Ne=class{name;code;encode;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?P(this.code,t):t.then(n=>P(this.code,n))}else throw Error("Unknown type, must be binary type")}};function lt(r){return async e=>new Uint8Array(await crypto.subtle.digest(r,e))}var me=Be({name:"sha2-256",code:18,encode:lt("SHA-256")}),Kr=Be({name:"sha2-512",code:19,encode:lt("SHA-512")});function dt(r,e){let{bytes:t,version:n}=r;switch(n){case 0:return Jr(t,Re(r),e??z.encoder);default:return Xr(t,Re(r),e??j.encoder)}}var mt=new WeakMap;function Re(r){let e=mt.get(r);if(e==null){let t=new Map;return mt.set(r,t),t}return e}var N=class r{code;version;multihash;bytes;"/";constructor(e,t,n,i){this.code=t,this.version=e,this.multihash=n,this.bytes=i,this["/"]=i}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!==ee)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==Gr)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,n=P(e,t);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return r.equals(this,e)}static equals(e,t){let n=t;return n!=null&&e.code===n.code&&e.version===n.version&&ft(e.multihash,n.multihash)}toString(e){return dt(this,e)}toJSON(){return{"/":dt(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof r)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:i,multihash:a,bytes:d}=t;return new r(n,i,a,d??_t(n,i,a.bytes))}else if(t[Qr]===!0){let{version:n,multihash:i,code:a}=t,d=Y(i);return r.create(n,a,d)}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!==ee)throw new Error(`Version 0 CID must use dag-pb (code: ${ee}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let i=_t(e,t,n.bytes);return new r(e,t,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,ee,e)}static createV1(e,t){return r.create(1,e,t)}static decode(e){let[t,n]=r.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=r.inspectBytes(e),n=t.size-t.multihashSize,i=U(e.subarray(n,n+t.multihashSize));if(i.byteLength!==t.multihashSize)throw new Error("Incorrect length");let a=i.subarray(t.multihashSize-t.digestSize),d=new J(t.multihashCode,t.digestSize,a,i);return[t.version===0?r.createV0(d):r.createV1(t.codec,d),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[b,O]=W(e.subarray(t));return t+=O,b},i=n(),a=ee;if(i===18?(i=0,t=0):a=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let d=t,_=n(),w=n(),C=t+w,v=C-d;return{version:i,codec:a,multihashCode:_,digestSize:w,multihashSize:v,size:C}}static parse(e,t){let[n,i]=Hr(e,t),a=r.decode(i);if(a.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Re(a).set(n,e),a}};function Hr(r,e){switch(r[0]){case"Q":{let t=e??z;return[z.prefix,t.decode(`${z.prefix}${r}`)]}case z.prefix:{let t=e??z;return[z.prefix,t.decode(r)]}case j.prefix:{let t=e??j;return[j.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)]}}}function Jr(r,e,t){let{prefix:n}=t;if(n!==z.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let i=e.get(n);if(i==null){let a=t.encode(r).slice(1);return e.set(n,a),a}else return i}function Xr(r,e,t){let{prefix:n}=t,i=e.get(n);if(i==null){let a=t.encode(r);return e.set(n,a),a}else return i}var ee=112,Gr=18;function _t(r,e,t){let n=H(r),i=n+H(e),a=new Uint8Array(i+t.byteLength);return K(r,a,0),K(e,a,n),a.set(t,i),a}var Qr=Symbol.for("@ipld/js-cid/CID");var G={...Fe,...Ae,...Ue,...Ce,...Ie,...ke,...Me,...Ee,...De,...ze},Gn={...Le,...Pe};function te(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}function xt(r=0){return new Uint8Array(r)}function gt(r=0){return new Uint8Array(r)}function bt(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var wt=bt("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Oe=bt("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=gt(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),Wr={utf8:wt,"utf-8":wt,hex:G.base16,latin1:Oe,ascii:Oe,binary:Oe,...G},_e=Wr;function k(r,e="utf8"){let t=_e[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.decoder.decode(`${t.prefix}${r}`)}function Ve(r,e="utf8"){let t=_e[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.encoder.encode(r).substring(1)}var vt=Symbol.for("nodejs.util.inspect.custom"),St=Object.values(G).map(r=>r.decoder).reduce((r,e)=>r.or(e),G.identity.decoder),yt=114,Et=36,Ct=37,re=class{type;multihash;privateKey;publicKey;string;constructor(e){this.type=e.type,this.multihash=e.multihash,this.privateKey=e.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}[we]=!0;toString(){return this.string==null&&(this.string=z.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return N.createV1(yt,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e==null)return!1;if(e instanceof Uint8Array)return te(this.multihash.bytes,e);if(typeof e=="string")return E(e).equals(this);if(e?.multihash?.bytes!=null)return te(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[vt](){return`PeerId(${this.toString()})`}},ne=class extends re{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},oe=class extends re{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.multihash.digest}},ie=class extends re{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.multihash.digest}},qe=2336,$e=class{type="url";multihash;privateKey;publicKey;url;constructor(e){this.url=e.toString(),this.multihash=Z.digest(k(this.url))}[vt](){return`PeerId(${this.url})`}[we]=!0;toString(){return this.toCID().toString()}toCID(){return N.createV1(qe,this.multihash)}toBytes(){return this.toCID().bytes}equals(e){return e==null?!1:(e instanceof Uint8Array&&(e=Ve(e)),e.toString()===this.toString())}};function E(r,e){if(e=e??St,r.charAt(0)==="1"||r.charAt(0)==="Q"){let t=Y(z.decode(`z${r}`));return r.startsWith("12D")?new oe({multihash:t}):r.startsWith("16U")?new ie({multihash:t}):new ne({multihash:t})}return Yr(St.decode(r))}function Yr(r){try{let e=Y(r);if(e.code===Z.code){if(e.digest.length===Et)return new oe({multihash:e});if(e.digest.length===Ct)return new ie({multihash:e})}if(e.code===me.code)return new ne({multihash:e})}catch{return Zr(N.decode(r))}throw new Error("Supplied PeerID CID is invalid")}function Zr(r){if(r==null||r.multihash==null||r.version==null||r.version===1&&r.code!==yt&&r.code!==qe)throw new Error("Supplied PeerID CID is invalid");if(r.code===qe){let t=Ve(r.multihash.digest);return new $e(new URL(t))}let e=r.multihash;if(e.code===me.code)return new ne({multihash:r.multihash});if(e.code===Z.code){if(e.digest.length===Et)return new oe({multihash:r.multihash});if(e.digest.length===Ct)return new ie({multihash:r.multihash})}throw new Error("Supplied PeerID CID is invalid")}function F(r,e){let t={[Symbol.iterator]:()=>t,next:()=>{let n=r.next(),i=n.value;return n.done===!0||i==null?{done:!0,value:void 0}:{done:!1,value:e(i)}}};return t}var B=class{map;constructor(e){if(this.map=new Map,e!=null)for(let[t,n]of e.entries())this.map.set(t.toString(),n)}[Symbol.iterator](){return this.entries()}clear(){this.map.clear()}delete(e){return this.map.delete(e.toString())}entries(){return F(this.map.entries(),e=>[E(e[0]),e[1]])}forEach(e){this.map.forEach((t,n)=>{e(t,E(n),this)})}get(e){return this.map.get(e.toString())}has(e){return this.map.has(e.toString())}set(e,t){this.map.set(e.toString(),t)}keys(){return F(this.map.keys(),e=>E(e))}values(){return this.map.values()}get size(){return this.map.size}};function It(){return new B}var L=class r{set;constructor(e){if(this.set=new Set,e!=null)for(let t of e)this.set.add(t.toString())}get size(){return this.set.size}[Symbol.iterator](){return this.values()}add(e){this.set.add(e.toString())}clear(){this.set.clear()}delete(e){this.set.delete(e.toString())}entries(){return F(this.set.entries(),e=>{let t=E(e[0]);return[t,t]})}forEach(e){this.set.forEach(t=>{let n=E(t);e(n,n,this)})}has(e){return this.set.has(e.toString())}values(){return F(this.set.values(),e=>E(e))}intersection(e){let t=new r;for(let n of e)this.has(n)&&t.add(n);return t}difference(e){let t=new r;for(let n of this)e.has(n)||t.add(n);return t}union(e){let t=new r;for(let n of e)t.add(n);for(let n of this)t.add(n);return t}};function At(){return new L}var R=class r{list;constructor(e){if(this.list=[],e!=null)for(let t of e)this.list.push(t.toString())}[Symbol.iterator](){return F(this.list.entries(),e=>E(e[1]))}concat(e){let t=new r(this);for(let n of e)t.push(n);return t}entries(){return F(this.list.entries(),e=>[e[0],E(e[1])])}every(e){return this.list.every((t,n)=>e(E(t),n,this))}filter(e){let t=new r;return this.list.forEach((n,i)=>{let a=E(n);e(a,i,this)&&t.push(a)}),t}find(e){let t=this.list.find((n,i)=>e(E(n),i,this));if(t!=null)return E(t)}findIndex(e){return this.list.findIndex((t,n)=>e(E(t),n,this))}forEach(e){this.list.forEach((t,n)=>{e(E(t),n,this)})}includes(e){return this.list.includes(e.toString())}indexOf(e){return this.list.indexOf(e.toString())}pop(){let e=this.list.pop();if(e!=null)return E(e)}push(...e){for(let t of e)this.list.push(t.toString())}shift(){let e=this.list.shift();if(e!=null)return E(e)}unshift(...e){let t=this.list.length;for(let n=e.length-1;n>-1;n--)t=this.list.unshift(e[n].toString());return t}clear(){this.list=[]}get length(){return this.list.length}};function zt(){return new R}var je=64,M=class{fp;h;seed;constructor(e,t,n,i=2){if(i>je)throw new TypeError("Invalid Fingerprint Size");let a=t.hashV(e,n),d=xt(i);for(let _=0;_<d.length;_++)d[_]=a[_];d.length===0&&(d[0]=7),this.fp=d,this.h=t,this.seed=n}hash(){return this.h.hash(this.fp,this.seed)}equals(e){return e?.fp instanceof Uint8Array?te(this.fp,e.fp):!1}};function V(r,e){return Math.floor(Math.random()*(e-r))+r}var q=class{contents;constructor(e){this.contents=new Array(e).fill(null)}has(e){if(!(e instanceof M))throw new TypeError("Invalid Fingerprint");return this.contents.some(t=>e.equals(t))}add(e){if(!(e instanceof M))throw new TypeError("Invalid Fingerprint");for(let t=0;t<this.contents.length;t++)if(this.contents[t]==null)return this.contents[t]=e,!0;return!0}swap(e){if(!(e instanceof M))throw new TypeError("Invalid Fingerprint");let t=V(0,this.contents.length-1),n=this.contents[t];return this.contents[t]=e,n}remove(e){if(!(e instanceof M))throw new TypeError("Invalid Fingerprint");let t=this.contents.findIndex(n=>e.equals(n));return t>-1?(this.contents[t]=null,!0):!1}};var Ke={32:16777619n,64:1099511628211n,128:309485009821345068724781371n,256:374144419156711147060143317175368453031918731002211n,512:35835915874844867368919076489095108449946327955754392558399825615420669938882575126094039892345713852759n,1024:5016456510113118655434598811035278955030765345404790744303017523831112055108147451509157692220295382716162651878526895249385292291816524375083746691371804094271873160484737966720260389217684476157468082573n},Ut={32:2166136261n,64:14695981039346656037n,128:144066263297769815596495629667062367629n,256:100029257958052580907070968620625704837092796014241193945225284501741471925557n,512:9659303129496669498009435400716310466090418745672637896108374329434462657994582932197716438449813051892206539805784495328239340083876191928701583869517785n,1024:14197795064947621068722070641403218320880622795441933960878474914617582723252296732303717722150864096521202355549365628174669108571814760471015076148029755969804077320157692458563003215304957150157403644460363550505412711285966361610267868082893823963790439336411086884584107735010676915n},Ft=new globalThis.TextEncoder;function en(r,e){let t=Ke[e],n=Ut[e];for(let i=0;i<r.length;i++)n^=BigInt(r[i]),n=BigInt.asUintN(e,n*t);return n}function tn(r,e,t){if(t.length===0)throw new Error("The `utf8Buffer` option must have a length greater than zero");let n=Ke[e],i=Ut[e],a=r;for(;a.length>0;){let d=Ft.encodeInto(a,t);a=a.slice(d.read);for(let _=0;_<d.written;_++)i^=BigInt(t[_]),i=BigInt.asUintN(e,i*n)}return i}function He(r,{size:e=32,utf8Buffer:t}={}){if(!Ke[e])throw new Error("The `size` option must be one of 32, 64, 128, 256, 512, or 1024");if(typeof r=="string"){if(t)return tn(r,e,t);r=Ft.encode(r)}return en(r,e)}var rn=jt(Dt(),1);var ae={hash:r=>Number(He(r,{size:32})),hashV:(r,e)=>nn(ae.hash(r,e))};function nn(r){let e=r.toString(16);return e.length%2===1&&(e=`0${e}`),k(e,"base16")}var on=500,ce=class{bucketSize;filterSize;fingerprintSize;buckets;count;hash;seed;constructor(e){this.filterSize=e.filterSize,this.bucketSize=e.bucketSize??4,this.fingerprintSize=e.fingerprintSize??2,this.count=0,this.buckets=[],this.hash=e.hash??ae,this.seed=e.seed??V(0,Math.pow(2,10))}add(e){typeof e=="string"&&(e=k(e));let t=new M(e,this.hash,this.seed,this.fingerprintSize),n=this.hash.hash(e,this.seed)%this.filterSize,i=(n^t.hash())%this.filterSize;if(this.buckets[n]==null&&(this.buckets[n]=new q(this.bucketSize)),this.buckets[i]==null&&(this.buckets[i]=new q(this.bucketSize)),this.buckets[n].add(t)||this.buckets[i].add(t))return this.count++,!0;let a=[n,i],d=a[V(0,a.length-1)];this.buckets[d]==null&&(this.buckets[d]=new q(this.bucketSize));for(let _=0;_<on;_++){let w=this.buckets[d].swap(t);if(w!=null&&(d=(d^w.hash())%this.filterSize,this.buckets[d]==null&&(this.buckets[d]=new q(this.bucketSize)),this.buckets[d].add(w)))return this.count++,!0}return!1}has(e){typeof e=="string"&&(e=k(e));let t=new M(e,this.hash,this.seed,this.fingerprintSize),n=this.hash.hash(e,this.seed)%this.filterSize,i=this.buckets[n]?.has(t)??!1;if(i)return i;let a=(n^t.hash())%this.filterSize;return this.buckets[a]?.has(t)??!1}remove(e){typeof e=="string"&&(e=k(e));let t=new M(e,this.hash,this.seed,this.fingerprintSize),n=this.hash.hash(e,this.seed)%this.filterSize,i=this.buckets[n]?.remove(t)??!1;if(i)return this.count--,i;let a=(n^t.hash())%this.filterSize,d=this.buckets[a]?.remove(t)??!1;return d&&this.count--,d}get reliable(){return Math.floor(100*(this.count/this.filterSize))<=90}},sn={1:.5,2:.84,4:.95,8:.98};function an(r=.001){return r>.002?2:r>1e-5?4:8}function Tt(r,e=.001){let t=an(e),n=sn[t],i=Math.round(r/n),a=Math.min(Math.ceil(Math.log2(1/e)+Math.log2(2*t)),je);return{filterSize:i,bucketSize:t,fingerprintSize:a}}var ge=class{filterSize;bucketSize;fingerprintSize;scale;filterSeries;hash;seed;constructor(e){this.bucketSize=e.bucketSize??4,this.filterSize=e.filterSize??(1<<18)/this.bucketSize,this.fingerprintSize=e.fingerprintSize??2,this.scale=e.scale??2,this.hash=e.hash??ae,this.seed=e.seed??V(0,Math.pow(2,10)),this.filterSeries=[new ce({filterSize:this.filterSize,bucketSize:this.bucketSize,fingerprintSize:this.fingerprintSize,hash:this.hash,seed:this.seed})]}add(e){if(typeof e=="string"&&(e=k(e)),this.has(e))return!0;let t=this.filterSeries.find(n=>n.reliable);if(t==null){let n=this.filterSize*Math.pow(this.scale,this.filterSeries.length);t=new ce({filterSize:n,bucketSize:this.bucketSize,fingerprintSize:this.fingerprintSize,hash:this.hash,seed:this.seed}),this.filterSeries.push(t)}return t.add(e)}has(e){typeof e=="string"&&(e=k(e));for(let t=0;t<this.filterSeries.length;t++)if(this.filterSeries[t].has(e))return!0;return!1}remove(e){typeof e=="string"&&(e=k(e));for(let t=0;t<this.filterSeries.length;t++)if(this.filterSeries[t].remove(e))return!0;return!1}get count(){return this.filterSeries.reduce((e,t)=>e+t.count,0)}};function Je(r,e=.001,t){return new ge({...Tt(r,e),...t??{}})}var fe=class{filter;constructor(e,t){this.filter=Je(e,t)}has(e){return this.filter.has(e.toBytes())}add(e){this.filter.add(e.toBytes())}remove(e){this.filter.remove?.(e.toBytes())}};function Pt(r,e=.001){return new fe(r,e)}var Xe=class extends B{metric;constructor(e){super();let{name:t,metrics:n}=e;this.metric=n.registerMetric(t),this.updateComponentMetric()}set(e,t){return super.set(e,t),this.updateComponentMetric(),this}delete(e){let t=super.delete(e);return this.updateComponentMetric(),t}clear(){super.clear(),this.updateComponentMetric()}updateComponentMetric(){this.metric.update(this.size)}};function Nt(r){let{name:e,metrics:t}=r,n;return t!=null?n=new Xe({name:e,metrics:t}):n=new B,n}var Ge=class extends L{metric;constructor(e){super();let{name:t,metrics:n}=e;this.metric=n.registerMetric(t),this.updateComponentMetric()}add(e){super.add(e),this.updateComponentMetric()}delete(e){super.delete(e),this.updateComponentMetric()}clear(){super.clear(),this.updateComponentMetric()}updateComponentMetric(){this.metric.update(this.size)}};function Bt(r){let{name:e,metrics:t}=r,n;return t!=null?n=new Ge({name:e,metrics:t}):n=new L,n}var Qe=class extends R{metric;constructor(e){super();let{name:t,metrics:n}=e;this.metric=n.registerMetric(t),this.updateComponentMetric()}pop(){let e=super.pop();return this.updateComponentMetric(),e}push(...e){super.push(...e),this.updateComponentMetric()}shift(){let e=super.shift();return this.updateComponentMetric(),e}unshift(...e){let t=super.unshift(...e);return this.updateComponentMetric(),t}clear(){super.clear(),this.updateComponentMetric()}updateComponentMetric(){this.metric.update(this.length)}};function Lt(r){let{name:e,metrics:t}=r,n;return t!=null?n=new Qe({name:e,metrics:t}):n=new R,n}return Kt(cn);})();
3
3
  return Libp2PPeerCollections}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/peer-collections",
3
- "version": "5.2.6",
3
+ "version": "5.2.7",
4
4
  "description": "Stores values against a peer id",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/peer-collections#readme",
@@ -54,12 +54,12 @@
54
54
  "test:electron-main": "aegir test -t electron-main"
55
55
  },
56
56
  "dependencies": {
57
- "@libp2p/interface": "^1.6.1",
58
- "@libp2p/peer-id": "^4.2.1",
59
- "@libp2p/utils": "^5.4.6"
57
+ "@libp2p/interface": "^1.6.2",
58
+ "@libp2p/peer-id": "^4.2.2",
59
+ "@libp2p/utils": "^5.4.7"
60
60
  },
61
61
  "devDependencies": {
62
- "@libp2p/peer-id-factory": "^4.2.1",
62
+ "@libp2p/peer-id-factory": "^4.2.2",
63
63
  "@types/sinon": "^17.0.3",
64
64
  "aegir": "^43.0.1",
65
65
  "sinon": "^18.0.0",