@libp2p/dcutr 0.0.0-e2267d437 → 1.0.0
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 +9 -9
- package/dist/src/dcutr.d.ts +1 -2
- package/dist/src/dcutr.d.ts.map +1 -1
- package/dist/src/dcutr.js +1 -1
- package/dist/src/dcutr.js.map +1 -1
- package/dist/src/index.d.ts +2 -6
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/utils.d.ts +1 -1
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/typedoc-urls.json +10 -0
- package/package.json +7 -3
- package/src/dcutr.ts +3 -9
- package/src/index.ts +2 -6
- package/src/utils.ts +1 -1
package/dist/index.min.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PDcutr = factory()}(typeof self !== 'undefined' ? self : this, function () {
|
|
2
|
-
"use strict";var Libp2PDcutr=(()=>{var Zn=Object.create;var Mt=Object.defineProperty;var Kn=Object.getOwnPropertyDescriptor;var Yn=Object.getOwnPropertyNames;var to=Object.getPrototypeOf,eo=Object.prototype.hasOwnProperty;var ue=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),k=(r,t)=>{for(var e in t)Mt(r,e,{get:t[e],enumerable:!0})},Er=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Yn(t))!eo.call(r,o)&&o!==e&&Mt(r,o,{get:()=>t[o],enumerable:!(n=Kn(t,o))||n.enumerable});return r};var fe=(r,t,e)=>(e=r!=null?Zn(to(r)):{},Er(t||!r||!r.__esModule?Mt(e,"default",{value:r,enumerable:!0}):e,r)),ro=r=>Er(Mt({},"__esModule",{value:!0}),r);var gn=ue((Kc,mn)=>{"use strict";function pn(r,t){for(let e in t)Object.defineProperty(r,e,{value:t[e],enumerable:!0,configurable:!0});return r}function _i(r,t,e){if(!r||typeof r=="string")throw new TypeError("Please pass an Error to err-code");e||(e={}),typeof t=="object"&&(e=t,t=""),t&&(e.code=t);try{return pn(r,e)}catch{e.message=r.message,e.stack=r.stack;let o=function(){};return o.prototype=Object.create(Object.getPrototypeOf(r)),pn(new o,e)}}mn.exports=_i});var On=ue($t=>{(function(){var r,t,e,n,o,i,a,h;h=function(d){var l,b,w,p;return l=(d&255<<24)>>>24,b=(d&255<<16)>>>16,w=(d&65280)>>>8,p=d&255,[l,b,w,p].join(".")},a=function(d){var l,b,w,p,s,c;for(l=[],w=p=0;p<=3&&d.length!==0;w=++p){if(w>0){if(d[0]!==".")throw new Error("Invalid IP");d=d.substring(1)}c=t(d),s=c[0],b=c[1],d=d.substring(b),l.push(s)}if(d.length!==0)throw new Error("Invalid IP");switch(l.length){case 1:if(l[0]>4294967295)throw new Error("Invalid IP");return l[0]>>>0;case 2:if(l[0]>255||l[1]>16777215)throw new Error("Invalid IP");return(l[0]<<24|l[1])>>>0;case 3:if(l[0]>255||l[1]>255||l[2]>65535)throw new Error("Invalid IP");return(l[0]<<24|l[1]<<16|l[2])>>>0;case 4:if(l[0]>255||l[1]>255||l[2]>255||l[3]>255)throw new Error("Invalid IP");return(l[0]<<24|l[1]<<16|l[2]<<8|l[3])>>>0;default:throw new Error("Invalid IP")}},e=function(d){return d.charCodeAt(0)},n=e("0"),i=e("a"),o=e("A"),t=function(d){var l,b,w,p,s;for(p=0,l=10,b="9",w=0,d.length>1&&d[w]==="0"&&(d[w+1]==="x"||d[w+1]==="X"?(w+=2,l=16):"0"<=d[w+1]&&d[w+1]<="9"&&(w++,l=8,b="7")),s=w;w<d.length;){if("0"<=d[w]&&d[w]<=b)p=p*l+(e(d[w])-n)>>>0;else if(l===16)if("a"<=d[w]&&d[w]<="f")p=p*l+(10+e(d[w])-i)>>>0;else if("A"<=d[w]&&d[w]<="F")p=p*l+(10+e(d[w])-o)>>>0;else break;else break;if(p>4294967295)throw new Error("too large");w++}if(w===s)throw new Error("empty octet");return[p,w]},r=function(){function d(l,b){var w,p,s,c;if(typeof l!="string")throw new Error("Missing `net' parameter");if(b||(c=l.split("/",2),l=c[0],b=c[1]),b||(b=32),typeof b=="string"&&b.indexOf(".")>-1){try{this.maskLong=a(b)}catch(f){throw w=f,new Error("Invalid mask: "+b)}for(p=s=32;s>=0;p=--s)if(this.maskLong===4294967295<<32-p>>>0){this.bitmask=p;break}}else if(b||b===0)this.bitmask=parseInt(b,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0);else throw new Error("Invalid mask: empty");try{this.netLong=(a(l)&this.maskLong)>>>0}catch(f){throw w=f,new Error("Invalid net address: "+l)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+b);this.size=Math.pow(2,32-this.bitmask),this.base=h(this.netLong),this.mask=h(this.maskLong),this.hostmask=h(~this.maskLong),this.first=this.bitmask<=30?h(this.netLong+1):this.base,this.last=this.bitmask<=30?h(this.netLong+this.size-2):h(this.netLong+this.size-1),this.broadcast=this.bitmask<=30?h(this.netLong+this.size-1):void 0}return d.prototype.contains=function(l){return typeof l=="string"&&(l.indexOf("/")>0||l.split(".").length!==4)&&(l=new d(l)),l instanceof d?this.contains(l.base)&&this.contains(l.broadcast||l.last):(a(l)&this.maskLong)>>>0===(this.netLong&this.maskLong)>>>0},d.prototype.next=function(l){return l==null&&(l=1),new d(h(this.netLong+this.size*l),this.mask)},d.prototype.forEach=function(l){var b,w,p;for(p=a(this.first),w=a(this.last),b=0;p<=w;)l(h(p),p,b),b++,p++},d.prototype.toString=function(){return this.base+"/"+this.bitmask},d}(),$t.ip2long=a,$t.long2ip=h,$t.Netmask=r}).call($t)});var jn=ue((zn,ae)=>{(function(r){"use strict";let t="(0?\\d+|0x[a-f0-9]+)",e={fourOctet:new RegExp(`^${t}\\.${t}\\.${t}\\.${t}$`,"i"),threeOctet:new RegExp(`^${t}\\.${t}\\.${t}$`,"i"),twoOctet:new RegExp(`^${t}\\.${t}$`,"i"),longValue:new RegExp(`^${t}$`,"i")},n=new RegExp("^0[0-7]+$","i"),o=new RegExp("^0x[a-f0-9]+$","i"),i="%[0-9a-z]{1,}",a="(?:[0-9a-f]+::?)+",h={zoneIndex:new RegExp(i,"i"),native:new RegExp(`^(::)?(${a})?([0-9a-f]+)?(::)?(${i})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${i})?)$`,"i"),transitional:new RegExp(`^((?:${a})|(?:::)(?:${a})?)${t}\\.${t}\\.${t}\\.${t}(${i})?$`,"i")};function d(s,c){if(s.indexOf("::")!==s.lastIndexOf("::"))return null;let f=0,u=-1,m=(s.match(h.zoneIndex)||[])[0],g,x;for(m&&(m=m.substring(1),s=s.replace(/%.+$/,""));(u=s.indexOf(":",u+1))>=0;)f++;if(s.substr(0,2)==="::"&&f--,s.substr(-2,2)==="::"&&f--,f>c)return null;for(x=c-f,g=":";x--;)g+="0:";return s=s.replace("::",g),s[0]===":"&&(s=s.slice(1)),s[s.length-1]===":"&&(s=s.slice(0,-1)),c=function(){let T=s.split(":"),$=[];for(let M=0;M<T.length;M++)$.push(parseInt(T[M],16));return $}(),{parts:c,zoneId:m}}function l(s,c,f,u){if(s.length!==c.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let m=0,g;for(;u>0;){if(g=f-u,g<0&&(g=0),s[m]>>g!==c[m]>>g)return!1;u-=f,m+=1}return!0}function b(s){if(o.test(s))return parseInt(s,16);if(s[0]==="0"&&!isNaN(parseInt(s[1],10))){if(n.test(s))return parseInt(s,8);throw new Error(`ipaddr: cannot parse ${s} as octal`)}return parseInt(s,10)}function w(s,c){for(;s.length<c;)s=`0${s}`;return s}let p={};p.IPv4=function(){function s(c){if(c.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let f,u;for(f=0;f<c.length;f++)if(u=c[f],!(0<=u&&u<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=c}return s.prototype.SpecialRanges={unspecified:[[new s([0,0,0,0]),8]],broadcast:[[new s([255,255,255,255]),32]],multicast:[[new s([224,0,0,0]),4]],linkLocal:[[new s([169,254,0,0]),16]],loopback:[[new s([127,0,0,0]),8]],carrierGradeNat:[[new s([100,64,0,0]),10]],private:[[new s([10,0,0,0]),8],[new s([172,16,0,0]),12],[new s([192,168,0,0]),16]],reserved:[[new s([192,0,0,0]),24],[new s([192,0,2,0]),24],[new s([192,88,99,0]),24],[new s([198,18,0,0]),15],[new s([198,51,100,0]),24],[new s([203,0,113,0]),24],[new s([240,0,0,0]),4]]},s.prototype.kind=function(){return"ipv4"},s.prototype.match=function(c,f){let u;if(f===void 0&&(u=c,c=u[0],f=u[1]),c.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return l(this.octets,c.octets,8,f)},s.prototype.prefixLengthFromSubnetMask=function(){let c=0,f=!1,u={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},m,g,x;for(m=3;m>=0;m-=1)if(g=this.octets[m],g in u){if(x=u[g],f&&x!==0)return null;x!==8&&(f=!0),c+=x}else return null;return 32-c},s.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},s.prototype.toByteArray=function(){return this.octets.slice(0)},s.prototype.toIPv4MappedAddress=function(){return p.IPv6.parse(`::ffff:${this.toString()}`)},s.prototype.toNormalizedString=function(){return this.toString()},s.prototype.toString=function(){return this.octets.join(".")},s}(),p.IPv4.broadcastAddressFromCIDR=function(s){try{let c=this.parseCIDR(s),f=c[0].toByteArray(),u=this.subnetMaskFromPrefixLength(c[1]).toByteArray(),m=[],g=0;for(;g<4;)m.push(parseInt(f[g],10)|parseInt(u[g],10)^255),g++;return new this(m)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},p.IPv4.isIPv4=function(s){return this.parser(s)!==null},p.IPv4.isValid=function(s){try{return new this(this.parser(s)),!0}catch{return!1}},p.IPv4.isValidFourPartDecimal=function(s){return!!(p.IPv4.isValid(s)&&s.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},p.IPv4.networkAddressFromCIDR=function(s){let c,f,u,m,g;try{for(c=this.parseCIDR(s),u=c[0].toByteArray(),g=this.subnetMaskFromPrefixLength(c[1]).toByteArray(),m=[],f=0;f<4;)m.push(parseInt(u[f],10)&parseInt(g[f],10)),f++;return new this(m)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},p.IPv4.parse=function(s){let c=this.parser(s);if(c===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(c)},p.IPv4.parseCIDR=function(s){let c;if(c=s.match(/^(.+)\/(\d+)$/)){let f=parseInt(c[2]);if(f>=0&&f<=32){let u=[this.parse(c[1]),f];return Object.defineProperty(u,"toString",{value:function(){return this.join("/")}}),u}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},p.IPv4.parser=function(s){let c,f,u;if(c=s.match(e.fourOctet))return function(){let m=c.slice(1,6),g=[];for(let x=0;x<m.length;x++)f=m[x],g.push(b(f));return g}();if(c=s.match(e.longValue)){if(u=b(c[1]),u>4294967295||u<0)throw new Error("ipaddr: address outside defined range");return function(){let m=[],g;for(g=0;g<=24;g+=8)m.push(u>>g&255);return m}().reverse()}else return(c=s.match(e.twoOctet))?function(){let m=c.slice(1,4),g=[];if(u=b(m[1]),u>16777215||u<0)throw new Error("ipaddr: address outside defined range");return g.push(b(m[0])),g.push(u>>16&255),g.push(u>>8&255),g.push(u&255),g}():(c=s.match(e.threeOctet))?function(){let m=c.slice(1,5),g=[];if(u=b(m[2]),u>65535||u<0)throw new Error("ipaddr: address outside defined range");return g.push(b(m[0])),g.push(b(m[1])),g.push(u>>8&255),g.push(u&255),g}():null},p.IPv4.subnetMaskFromPrefixLength=function(s){if(s=parseInt(s),s<0||s>32)throw new Error("ipaddr: invalid IPv4 prefix length");let c=[0,0,0,0],f=0,u=Math.floor(s/8);for(;f<u;)c[f]=255,f++;return u<4&&(c[u]=Math.pow(2,s%8)-1<<8-s%8),new this(c)},p.IPv6=function(){function s(c,f){let u,m;if(c.length===16)for(this.parts=[],u=0;u<=14;u+=2)this.parts.push(c[u]<<8|c[u+1]);else if(c.length===8)this.parts=c;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(u=0;u<this.parts.length;u++)if(m=this.parts[u],!(0<=m&&m<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");f&&(this.zoneId=f)}return s.prototype.SpecialRanges={unspecified:[new s([0,0,0,0,0,0,0,0]),128],linkLocal:[new s([65152,0,0,0,0,0,0,0]),10],multicast:[new s([65280,0,0,0,0,0,0,0]),8],loopback:[new s([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new s([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new s([0,0,0,0,0,65535,0,0]),96],rfc6145:[new s([0,0,0,0,65535,0,0,0]),96],rfc6052:[new s([100,65435,0,0,0,0,0,0]),96],"6to4":[new s([8194,0,0,0,0,0,0,0]),16],teredo:[new s([8193,0,0,0,0,0,0,0]),32],reserved:[[new s([8193,3512,0,0,0,0,0,0]),32]],benchmarking:[new s([8193,2,0,0,0,0,0,0]),48],amt:[new s([8193,3,0,0,0,0,0,0]),32],as112v6:[new s([8193,4,274,0,0,0,0,0]),48],deprecated:[new s([8193,16,0,0,0,0,0,0]),28],orchid2:[new s([8193,32,0,0,0,0,0,0]),28]},s.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},s.prototype.kind=function(){return"ipv6"},s.prototype.match=function(c,f){let u;if(f===void 0&&(u=c,c=u[0],f=u[1]),c.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return l(this.parts,c.parts,16,f)},s.prototype.prefixLengthFromSubnetMask=function(){let c=0,f=!1,u={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},m,g;for(let x=7;x>=0;x-=1)if(m=this.parts[x],m in u){if(g=u[m],f&&g!==0)return null;g!==16&&(f=!0),c+=g}else return null;return 128-c},s.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},s.prototype.toByteArray=function(){let c,f=[],u=this.parts;for(let m=0;m<u.length;m++)c=u[m],f.push(c>>8),f.push(c&255);return f},s.prototype.toFixedLengthString=function(){let c=function(){let u=[];for(let m=0;m<this.parts.length;m++)u.push(w(this.parts[m].toString(16),4));return u}.call(this).join(":"),f="";return this.zoneId&&(f=`%${this.zoneId}`),c+f},s.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let c=this.parts.slice(-2),f=c[0],u=c[1];return new p.IPv4([f>>8,f&255,u>>8,u&255])},s.prototype.toNormalizedString=function(){let c=function(){let u=[];for(let m=0;m<this.parts.length;m++)u.push(this.parts[m].toString(16));return u}.call(this).join(":"),f="";return this.zoneId&&(f=`%${this.zoneId}`),c+f},s.prototype.toRFC5952String=function(){let c=/((^|:)(0(:|$)){2,})/g,f=this.toNormalizedString(),u=0,m=-1,g;for(;g=c.exec(f);)g[0].length>m&&(u=g.index,m=g[0].length);return m<0?f:`${f.substring(0,u)}::${f.substring(u+m)}`},s.prototype.toString=function(){return this.toRFC5952String()},s}(),p.IPv6.broadcastAddressFromCIDR=function(s){try{let c=this.parseCIDR(s),f=c[0].toByteArray(),u=this.subnetMaskFromPrefixLength(c[1]).toByteArray(),m=[],g=0;for(;g<16;)m.push(parseInt(f[g],10)|parseInt(u[g],10)^255),g++;return new this(m)}catch(c){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${c})`)}},p.IPv6.isIPv6=function(s){return this.parser(s)!==null},p.IPv6.isValid=function(s){if(typeof s=="string"&&s.indexOf(":")===-1)return!1;try{let c=this.parser(s);return new this(c.parts,c.zoneId),!0}catch{return!1}},p.IPv6.networkAddressFromCIDR=function(s){let c,f,u,m,g;try{for(c=this.parseCIDR(s),u=c[0].toByteArray(),g=this.subnetMaskFromPrefixLength(c[1]).toByteArray(),m=[],f=0;f<16;)m.push(parseInt(u[f],10)&parseInt(g[f],10)),f++;return new this(m)}catch(x){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${x})`)}},p.IPv6.parse=function(s){let c=this.parser(s);if(c.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(c.parts,c.zoneId)},p.IPv6.parseCIDR=function(s){let c,f,u;if((f=s.match(/^(.+)\/(\d+)$/))&&(c=parseInt(f[2]),c>=0&&c<=128))return u=[this.parse(f[1]),c],Object.defineProperty(u,"toString",{value:function(){return this.join("/")}}),u;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},p.IPv6.parser=function(s){let c,f,u,m,g,x;if(u=s.match(h.deprecatedTransitional))return this.parser(`::ffff:${u[1]}`);if(h.native.test(s))return d(s,8);if((u=s.match(h.transitional))&&(x=u[6]||"",c=d(u[1].slice(0,-1)+x,6),c.parts)){for(g=[parseInt(u[2]),parseInt(u[3]),parseInt(u[4]),parseInt(u[5])],f=0;f<g.length;f++)if(m=g[f],!(0<=m&&m<=255))return null;return c.parts.push(g[0]<<8|g[1]),c.parts.push(g[2]<<8|g[3]),{parts:c.parts,zoneId:c.zoneId}}return null},p.IPv6.subnetMaskFromPrefixLength=function(s){if(s=parseInt(s),s<0||s>128)throw new Error("ipaddr: invalid IPv6 prefix length");let c=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],f=0,u=Math.floor(s/8);for(;f<u;)c[f]=255,f++;return u<16&&(c[u]=Math.pow(2,s%8)-1<<8-s%8),new this(c)},p.fromByteArray=function(s){let c=s.length;if(c===4)return new p.IPv4(s);if(c===16)return new p.IPv6(s);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},p.isValid=function(s){return p.IPv6.isValid(s)||p.IPv4.isValid(s)},p.parse=function(s){if(p.IPv6.isValid(s))return p.IPv6.parse(s);if(p.IPv4.isValid(s))return p.IPv4.parse(s);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},p.parseCIDR=function(s){try{return p.IPv6.parseCIDR(s)}catch{try{return p.IPv4.parseCIDR(s)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},p.process=function(s){let c=this.parse(s);return c.kind()==="ipv6"&&c.isIPv4MappedAddress()?c.toIPv4Address():c},p.subnetMatch=function(s,c,f){let u,m,g,x;f==null&&(f="unicast");for(m in c)if(Object.prototype.hasOwnProperty.call(c,m)){for(g=c[m],g[0]&&!(g[0]instanceof Array)&&(g=[g]),u=0;u<g.length;u++)if(x=g[u],s.kind()===x[0].kind()&&s.match.apply(s,x))return m}return f},typeof ae<"u"&&ae.exports?ae.exports=p:r.ipaddr=p})(zn)});var ds={};k(ds,{dcutr:()=>ls,multicodec:()=>It});var z=class extends Error{code;props;constructor(t,e,n){super(t),this.code=e,this.name=n?.name??"CodeError",this.props=n??{}}};var it="ERR_INVALID_MESSAGE";var ge={};k(ge,{base58btc:()=>P,base58flickr:()=>co});function no(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var o=0;o<r.length;o++){var i=r.charAt(o),a=i.charCodeAt(0);if(e[a]!==255)throw new TypeError(i+" is ambiguous");e[a]=o}var h=r.length,d=r.charAt(0),l=Math.log(h)/Math.log(256),b=Math.log(256)/Math.log(h);function w(c){if(c instanceof Uint8Array||(ArrayBuffer.isView(c)?c=new Uint8Array(c.buffer,c.byteOffset,c.byteLength):Array.isArray(c)&&(c=Uint8Array.from(c))),!(c instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(c.length===0)return"";for(var f=0,u=0,m=0,g=c.length;m!==g&&c[m]===0;)m++,f++;for(var x=(g-m)*b+1>>>0,T=new Uint8Array(x);m!==g;){for(var $=c[m],M=0,_=x-1;($!==0||M<u)&&_!==-1;_--,M++)$+=256*T[_]>>>0,T[_]=$%h>>>0,$=$/h>>>0;if($!==0)throw new Error("Non-zero carry");u=M,m++}for(var Q=x-u;Q!==x&&T[Q]===0;)Q++;for(var kt=d.repeat(f);Q<x;++Q)kt+=r.charAt(T[Q]);return kt}function p(c){if(typeof c!="string")throw new TypeError("Expected String");if(c.length===0)return new Uint8Array;var f=0;if(c[f]!==" "){for(var u=0,m=0;c[f]===d;)u++,f++;for(var g=(c.length-f)*l+1>>>0,x=new Uint8Array(g);c[f];){var T=e[c.charCodeAt(f)];if(T===255)return;for(var $=0,M=g-1;(T!==0||$<m)&&M!==-1;M--,$++)T+=h*x[M]>>>0,x[M]=T%256>>>0,T=T/256>>>0;if(T!==0)throw new Error("Non-zero carry");m=$,f++}if(c[f]!==" "){for(var _=g-m;_!==g&&x[_]===0;)_++;for(var Q=new Uint8Array(u+(g-_)),kt=u;_!==g;)Q[kt++]=x[_++];return Q}}}function s(c){var f=p(c);if(f)return f;throw new Error(`Non-${t} character`)}return{encode:w,decodeUnsafe:p,decode:s}}var oo=no,io=oo,Sr=io;var ws=new Uint8Array(0);var Lr=(r,t)=>{if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0},J=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")};var Pr=r=>new TextEncoder().encode(r),Nr=r=>new TextDecoder().decode(r);var le=class{constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},de=class{constructor(t,e,n){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return Fr(this,t)}},pe=class{constructor(t){this.decoders=t}or(t){return Fr(this,t)}decode(t){let e=t[0],n=this.decoders[e];if(n)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},Fr=(r,t)=>new pe({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),me=class{constructor(t,e,n,o){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=o,this.encoder=new le(t,e,n),this.decoder=new de(t,e,o)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}},ut=({name:r,prefix:t,encode:e,decode:n})=>new me(r,t,e,n),Y=({prefix:r,name:t,alphabet:e})=>{let{encode:n,decode:o}=Sr(e,t);return ut({prefix:r,name:t,encode:n,decode:i=>J(o(i))})},so=(r,t,e,n)=>{let o={};for(let b=0;b<t.length;++b)o[t[b]]=b;let i=r.length;for(;r[i-1]==="=";)--i;let a=new Uint8Array(i*e/8|0),h=0,d=0,l=0;for(let b=0;b<i;++b){let w=o[r[b]];if(w===void 0)throw new SyntaxError(`Non-${n} character`);d=d<<e|w,h+=e,h>=8&&(h-=8,a[l++]=255&d>>h)}if(h>=e||255&d<<8-h)throw new SyntaxError("Unexpected end of data");return a},ao=(r,t,e)=>{let n=t[t.length-1]==="=",o=(1<<e)-1,i="",a=0,h=0;for(let d=0;d<r.length;++d)for(h=h<<8|r[d],a+=8;a>e;)a-=e,i+=t[o&h>>a];if(a&&(i+=t[o&h<<e-a]),n)for(;i.length*e&7;)i+="=";return i},A=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>ut({prefix:t,name:r,encode(o){return ao(o,n,e)},decode(o){return so(o,n,e,r)}});var P=Y({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),co=Y({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var we={};k(we,{base32:()=>Z,base32hex:()=>lo,base32hexpad:()=>mo,base32hexpadupper:()=>go,base32hexupper:()=>po,base32pad:()=>uo,base32padupper:()=>fo,base32upper:()=>ho,base32z:()=>wo});var Z=A({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ho=A({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),uo=A({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),fo=A({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),lo=A({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),po=A({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),mo=A({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),go=A({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),wo=A({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var bo=Cr,Rr=128,xo=127,yo=~xo,Io=Math.pow(2,31);function Cr(r,t,e){t=t||[],e=e||0;for(var n=e;r>=Io;)t[e++]=r&255|Rr,r/=128;for(;r&yo;)t[e++]=r&255|Rr,r>>>=7;return t[e]=r|0,Cr.bytes=e-n+1,t}var Ao=be,vo=128,Tr=127;function be(r,n){var e=0,n=n||0,o=0,i=n,a,h=r.length;do{if(i>=h)throw be.bytes=0,new RangeError("Could not decode varint");a=r[i++],e+=o<28?(a&Tr)<<o:(a&Tr)*Math.pow(2,o),o+=7}while(a>=vo);return be.bytes=i-n,e}var Eo=Math.pow(2,7),So=Math.pow(2,14),Lo=Math.pow(2,21),Po=Math.pow(2,28),No=Math.pow(2,35),Do=Math.pow(2,42),Fo=Math.pow(2,49),Ro=Math.pow(2,56),To=Math.pow(2,63),Co=function(r){return r<Eo?1:r<So?2:r<Lo?3:r<Po?4:r<No?5:r<Do?6:r<Fo?7:r<Ro?8:r<To?9:10},Uo={encode:bo,decode:Ao,encodingLength:Co},$o=Uo,At=$o;var vt=(r,t=0)=>[At.decode(r,t),At.decode.bytes],ft=(r,t,e=0)=>(At.encode(r,t,e),t),lt=r=>At.encodingLength(r);var st=(r,t)=>{let e=t.byteLength,n=lt(r),o=n+lt(e),i=new Uint8Array(o+e);return ft(r,i,0),ft(e,i,n),i.set(t,o),new dt(r,e,t,i)},Ot=r=>{let t=J(r),[e,n]=vt(t),[o,i]=vt(t.subarray(n)),a=t.subarray(n+i);if(a.byteLength!==o)throw new Error("Incorrect length");return new dt(e,o,a,t)},Ur=(r,t)=>{if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&Lr(r.bytes,e.bytes)}},dt=class{constructor(t,e,n,o){this.code=t,this.size=e,this.digest=n,this.bytes=o}};var $r=(r,t)=>{let{bytes:e,version:n}=r;switch(n){case 0:return Mo(e,xe(r),t||P.encoder);default:return Bo(e,xe(r),t||Z.encoder)}};var kr=new WeakMap,xe=r=>{let t=kr.get(r);if(t==null){let e=new Map;return kr.set(r,e),e}return t},tt=class r{constructor(t,e,n,o){this.code=e,this.version=t,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:t,multihash:e}=this;if(t!==Et)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==Oo)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(e)}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:t,digest:e}=this.multihash,n=st(t,e);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(t){return r.equals(this,t)}static equals(t,e){let n=e;return n&&t.code===n.code&&t.version===n.version&&Ur(t.multihash,n.multihash)}toString(t){return $r(this,t)}toJSON(){return{"/":$r(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let e=t;if(e instanceof r)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:n,code:o,multihash:i,bytes:a}=e;return new r(n,o,i,a||Mr(n,o,i.bytes))}else if(e[Vo]===!0){let{version:n,multihash:o,code:i}=e,a=Ot(o);return r.create(n,i,a)}else return null}static create(t,e,n){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==Et)throw new Error(`Version 0 CID must use dag-pb (code: ${Et}) block encoding`);return new r(t,e,n,n.bytes)}case 1:{let o=Mr(t,e,n.bytes);return new r(t,e,n,o)}default:throw new Error("Invalid version")}}static createV0(t){return r.create(0,Et,t)}static createV1(t,e){return r.create(1,t,e)}static decode(t){let[e,n]=r.decodeFirst(t);if(n.length)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=r.inspectBytes(t),n=e.size-e.multihashSize,o=J(t.subarray(n,n+e.multihashSize));if(o.byteLength!==e.multihashSize)throw new Error("Incorrect length");let i=o.subarray(e.multihashSize-e.digestSize),a=new dt(e.multihashCode,e.digestSize,i,o);return[e.version===0?r.createV0(a):r.createV1(e.codec,a),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[w,p]=vt(t.subarray(e));return e+=p,w},o=n(),i=Et;if(o===18?(o=0,e=0):i=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let a=e,h=n(),d=n(),l=e+d,b=l-a;return{version:o,codec:i,multihashCode:h,digestSize:d,multihashSize:b,size:l}}static parse(t,e){let[n,o]=ko(t,e),i=r.decode(o);if(i.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return xe(i).set(n,t),i}},ko=(r,t)=>{switch(r[0]){case"Q":{let e=t||P;return[P.prefix,e.decode(`${P.prefix}${r}`)]}case P.prefix:{let e=t||P;return[P.prefix,e.decode(r)]}case Z.prefix:{let e=t||Z;return[Z.prefix,e.decode(r)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],t.decode(r)]}}},Mo=(r,t,e)=>{let{prefix:n}=e;if(n!==P.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let o=t.get(n);if(o==null){let i=e.encode(r).slice(1);return t.set(n,i),i}else return o},Bo=(r,t,e)=>{let{prefix:n}=e,o=t.get(n);if(o==null){let i=e.encode(r);return t.set(n,i),i}else return o},Et=112,Oo=18,Mr=(r,t,e)=>{let n=lt(r),o=n+lt(t),i=new Uint8Array(o+e.byteLength);return ft(r,i,0),ft(t,i,n),i.set(e,o),i},Vo=Symbol.for("@ipld/js-cid/CID");function Vt(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}var ye={};k(ye,{base10:()=>_o});var _o=Y({prefix:"9",name:"base10",alphabet:"0123456789"});var Ie={};k(Ie,{base16:()=>zo,base16upper:()=>jo});var zo=A({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),jo=A({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Ae={};k(Ae,{base2:()=>Go});var Go=A({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var ve={};k(ve,{base256emoji:()=>Qo});var Br=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}"),Wo=Br.reduce((r,t,e)=>(r[e]=t,r),[]),qo=Br.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function Xo(r){return r.reduce((t,e)=>(t+=Wo[e],t),"")}function Ho(r){let t=[];for(let e of r){let n=qo[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}var Qo=ut({prefix:"\u{1F680}",name:"base256emoji",encode:Xo,decode:Ho});var Ee={};k(Ee,{base36:()=>Jo,base36upper:()=>Zo});var Jo=Y({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Zo=Y({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Le={};k(Le,{base64:()=>Ko,base64pad:()=>Yo,base64url:()=>Se,base64urlpad:()=>ti});var Ko=A({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Yo=A({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Se=A({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ti=A({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Pe={};k(Pe,{base8:()=>ei});var ei=A({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Ne={};k(Ne,{identity:()=>ri});var ri=ut({prefix:"\0",name:"identity",encode:r=>Nr(r),decode:r=>Pr(r)});var _s=new TextEncoder,zs=new TextDecoder;var De={};k(De,{identity:()=>ai});var Or=0,ii="identity",Vr=J,si=r=>st(Or,Vr(r)),ai={code:Or,name:ii,encode:Vr,digest:si};var Te={};k(Te,{sha256:()=>ci,sha512:()=>hi});var Re=({name:r,code:t,encode:e})=>new Fe(r,t,e),Fe=class{constructor(t,e,n){this.name=t,this.code=e,this.encode=n}digest(t){if(t instanceof Uint8Array){let e=this.encode(t);return e instanceof Uint8Array?st(this.code,e):e.then(n=>st(this.code,n))}else throw Error("Unknown type, must be binary type")}};var zr=r=>async t=>new Uint8Array(await crypto.subtle.digest(r,t)),ci=Re({name:"sha2-256",code:18,encode:zr("SHA-256")}),hi=Re({name:"sha2-512",code:19,encode:zr("SHA-512")});var St={...Ne,...Ae,...Pe,...ye,...Ie,...we,...Ee,...ge,...Le,...ve},Js={...Te,...De};function et(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function K(r=0){return globalThis.Buffer?.alloc!=null?et(globalThis.Buffer.alloc(r)):new Uint8Array(r)}function N(r=0){return globalThis.Buffer?.allocUnsafe!=null?et(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Gr(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var jr=Gr("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Ce=Gr("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);let t=N(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),ui={utf8:jr,"utf-8":jr,hex:St.base16,latin1:Ce,ascii:Ce,binary:Ce,...St},_t=ui;function C(r,t="utf8"){let e=_t[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):e.encoder.encode(r).substring(1)}var fi=Math.pow(2,7),li=Math.pow(2,14),di=Math.pow(2,21),Ue=Math.pow(2,28),$e=Math.pow(2,35),ke=Math.pow(2,42),Me=Math.pow(2,49),y=128,D=127;function F(r){if(r<fi)return 1;if(r<li)return 2;if(r<di)return 3;if(r<Ue)return 4;if(r<$e)return 5;if(r<ke)return 6;if(r<Me)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function pi(r,t,e=0){switch(F(r)){case 8:t[e++]=r&255|y,r/=128;case 7:t[e++]=r&255|y,r/=128;case 6:t[e++]=r&255|y,r/=128;case 5:t[e++]=r&255|y,r/=128;case 4:t[e++]=r&255|y,r>>>=7;case 3:t[e++]=r&255|y,r>>>=7;case 2:t[e++]=r&255|y,r>>>=7;case 1:{t[e++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return t}function mi(r,t,e=0){switch(F(r)){case 8:t.set(e++,r&255|y),r/=128;case 7:t.set(e++,r&255|y),r/=128;case 6:t.set(e++,r&255|y),r/=128;case 5:t.set(e++,r&255|y),r/=128;case 4:t.set(e++,r&255|y),r>>>=7;case 3:t.set(e++,r&255|y),r>>>=7;case 2:t.set(e++,r&255|y),r>>>=7;case 1:{t.set(e++,r&255),r>>>=7;break}default:throw new Error("unreachable")}return t}function gi(r,t){let e=r[t],n=0;if(n+=e&D,e<y||(e=r[t+1],n+=(e&D)<<7,e<y)||(e=r[t+2],n+=(e&D)<<14,e<y)||(e=r[t+3],n+=(e&D)<<21,e<y)||(e=r[t+4],n+=(e&D)*Ue,e<y)||(e=r[t+5],n+=(e&D)*$e,e<y)||(e=r[t+6],n+=(e&D)*ke,e<y)||(e=r[t+7],n+=(e&D)*Me,e<y))return n;throw new RangeError("Could not decode varint")}function wi(r,t){let e=r.get(t),n=0;if(n+=e&D,e<y||(e=r.get(t+1),n+=(e&D)<<7,e<y)||(e=r.get(t+2),n+=(e&D)<<14,e<y)||(e=r.get(t+3),n+=(e&D)<<21,e<y)||(e=r.get(t+4),n+=(e&D)*Ue,e<y)||(e=r.get(t+5),n+=(e&D)*$e,e<y)||(e=r.get(t+6),n+=(e&D)*ke,e<y)||(e=r.get(t+7),n+=(e&D)*Me,e<y))return n;throw new RangeError("Could not decode varint")}function rt(r,t,e=0){return t==null&&(t=N(F(r))),t instanceof Uint8Array?pi(r,t,e):mi(r,t,e)}function j(r,t=0){return r instanceof Uint8Array?gi(r,t):wi(r,t)}function B(r,t){if(globalThis.Buffer!=null)return et(globalThis.Buffer.concat(r,t));t==null&&(t=r.reduce((o,i)=>o+i.length,0));let e=N(t),n=0;for(let o of r)e.set(o,n),n+=o.length;return et(e)}var zt=class{index=0;input="";new(t){return this.index=0,this.input=t,this}readAtomically(t){let e=this.index,n=t();return n===void 0&&(this.index=e),n}parseWith(t){let e=t();if(this.index===this.input.length)return e}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(t){return this.readAtomically(()=>{let e=this.readChar();if(e===t)return e})}readSeparator(t,e,n){return this.readAtomically(()=>{if(!(e>0&&this.readGivenChar(t)===void 0))return n()})}readNumber(t,e,n,o){return this.readAtomically(()=>{let i=0,a=0,h=this.peekChar();if(h===void 0)return;let d=h==="0",l=2**(8*o)-1;for(;;){let b=this.readAtomically(()=>{let w=this.readChar();if(w===void 0)return;let p=Number.parseInt(w,t);if(!Number.isNaN(p))return p});if(b===void 0)break;if(i*=t,i+=b,i>l||(a+=1,e!==void 0&&a>e))return}if(a!==0)return!n&&d&&a>1?void 0:i})}readIPv4Addr(){return this.readAtomically(()=>{let t=new Uint8Array(4);for(let e=0;e<t.length;e++){let n=this.readSeparator(".",e,()=>this.readNumber(10,3,!1,1));if(n===void 0)return;t[e]=n}return t})}readIPv6Addr(){let t=e=>{for(let n=0;n<e.length/2;n++){let o=n*2;if(n<e.length-3){let a=this.readSeparator(":",n,()=>this.readIPv4Addr());if(a!==void 0)return e[o]=a[0],e[o+1]=a[1],e[o+2]=a[2],e[o+3]=a[3],[o+4,!0]}let i=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(i===void 0)return[o,!1];e[o]=i>>8,e[o+1]=i&255}return[e.length,!1]};return this.readAtomically(()=>{let e=new Uint8Array(16),[n,o]=t(e);if(n===16)return e;if(o||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let i=new Uint8Array(14),a=16-(n+2),[h]=t(i.subarray(0,a));return e.set(i.subarray(0,h),16-h),e})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var Wr=45,bi=15,mt=new zt;function Be(r){if(!(r.length>bi))return mt.new(r).parseWith(()=>mt.readIPv4Addr())}function Oe(r){if(r.includes("%")&&(r=r.split("%")[0]),!(r.length>Wr))return mt.new(r).parseWith(()=>mt.readIPv6Addr())}function jt(r){if(r.includes("%")&&(r=r.split("%")[0]),!(r.length>Wr))return mt.new(r).parseWith(()=>mt.readIPAddr())}var xa=parseInt("0xFFFF",16),ya=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);function Pt(r,t="utf8"){let e=_t[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?et(globalThis.Buffer.from(r,"utf-8")):e.decoder.decode(`${e.prefix}${r}`)}function Gt(r){return!!Be(r)}function Wt(r){return!!Oe(r)}function gt(r){return!!jt(r)}var Hr=Gt,vi=Wt,Ve=function(r){let t=0;if(r=r.toString().trim(),Hr(r)){let e=new Uint8Array(t+4);return r.split(/\./g).forEach(n=>{e[t++]=parseInt(n,10)&255}),e}if(vi(r)){let e=r.split(":",8),n;for(n=0;n<e.length;n++){let i=Hr(e[n]),a;i&&(a=Ve(e[n]),e[n]=C(a.slice(0,2),"base16")),a!=null&&++n<8&&e.splice(n,0,C(a.slice(2,4),"base16"))}if(e[0]==="")for(;e.length<8;)e.unshift("0");else if(e[e.length-1]==="")for(;e.length<8;)e.push("0");else if(e.length<8){for(n=0;n<e.length&&e[n]!=="";n++);let i=[n,1];for(n=9-e.length;n>0;n--)i.push("0");e.splice.apply(e,i)}let o=new Uint8Array(t+16);for(n=0;n<e.length;n++){let i=parseInt(e[n],16);o[t++]=i>>8&255,o[t++]=i&255}return o}throw new Error("invalid ip address")},Qr=function(r,t=0,e){t=~~t,e=e??r.length-t;let n=new DataView(r.buffer);if(e===4){let o=[];for(let i=0;i<e;i++)o.push(r[t+i]);return o.join(".")}if(e===16){let o=[];for(let i=0;i<e;i+=2)o.push(n.getUint16(t+i).toString(16));return o.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var wt={},_e={},Si=[[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"]];Si.forEach(r=>{let t=Li(...r);_e[t.code]=t,wt[t.name]=t});function Li(r,t,e,n,o){return{code:r,size:t,name:e,resolvable:!!n,path:!!o}}function I(r){if(typeof r=="number"){if(_e[r]!=null)return _e[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(wt[r]!=null)return wt[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var sc=I("ip4"),ac=I("ip6"),cc=I("ipcidr");function je(r,t){switch(I(r).code){case 4:case 41:return Ni(t);case 42:return Kr(t);case 6:case 273:case 33:case 132:return tn(t).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Kr(t);case 421:return Ti(t);case 444:return Yr(t);case 445:return Yr(t);case 466:return Ri(t);default:return C(t,"base16")}}function Ge(r,t){switch(I(r).code){case 4:return Jr(t);case 41:return Jr(t);case 42:return Zr(t);case 6:case 273:case 33:case 132:return We(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Zr(t);case 421:return Di(t);case 444:return Ci(t);case 445:return Ui(t);case 466:return Fi(t);default:return Pt(t,"base16")}}var ze=Object.values(St).map(r=>r.decoder),Pi=function(){let r=ze[0].or(ze[1]);return ze.slice(2).forEach(t=>r=r.or(t)),r}();function Jr(r){if(!gt(r))throw new Error("invalid ip address");return Ve(r)}function Ni(r){let t=Qr(r,0,r.length);if(t==null)throw new Error("ipBuff is required");if(!gt(t))throw new Error("invalid ip address");return t}function We(r){let t=new ArrayBuffer(2);return new DataView(t).setUint16(0,r),new Uint8Array(t)}function tn(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function Zr(r){let t=Pt(r),e=Uint8Array.from(rt(t.length));return B([e,t],e.length+t.length)}function Kr(r){let t=j(r);if(r=r.slice(F(t)),r.length!==t)throw new Error("inconsistent lengths");return C(r)}function Di(r){let t;r[0]==="Q"||r[0]==="1"?t=Ot(P.decode(`z${r}`)).bytes:t=tt.parse(r).multihash.bytes;let e=Uint8Array.from(rt(t.length));return B([e,t],e.length+t.length)}function Fi(r){let t=Pi.decode(r),e=Uint8Array.from(rt(t.length));return B([e,t],e.length+t.length)}function Ri(r){let t=j(r),e=r.slice(F(t));if(e.length!==t)throw new Error("inconsistent lengths");return"u"+C(e,"base64url")}function Ti(r){let t=j(r),e=r.slice(F(t));if(e.length!==t)throw new Error("inconsistent lengths");return C(e,"base58btc")}function Ci(r){let t=r.split(":");if(t.length!==2)throw new Error(`failed to parse onion addr: ["'${t.join('", "')}'"]' does not contain a port number`);if(t[0].length!==16)throw new Error(`failed to parse onion addr: ${t[0]} not a Tor onion address.`);let e=Z.decode("b"+t[0]),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=We(n);return B([e,o],e.length+o.length)}function Ui(r){let t=r.split(":");if(t.length!==2)throw new Error(`failed to parse onion addr: ["'${t.join('", "')}'"]' does not contain a port number`);if(t[0].length!==56)throw new Error(`failed to parse onion addr: ${t[0]} not a Tor onion3 address.`);let e=Z.decode(`b${t[0]}`),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=We(n);return B([e,o],e.length+o.length)}function Yr(r){let t=r.slice(0,r.length-2),e=r.slice(r.length-2),n=C(t,"base32"),o=tn(e);return`${n}:${o}`}function en(r){r=qe(r);let t=[],e=[],n=null,o=r.split("/").slice(1);if(o.length===1&&o[0]==="")return{bytes:new Uint8Array,string:"/",tuples:[],stringTuples:[],path:null};for(let i=0;i<o.length;i++){let a=o[i],h=I(a);if(h.size===0){t.push([h.code]),e.push([h.code]);continue}if(i++,i>=o.length)throw nn("invalid address: "+r);if(h.path===!0){n=qe(o.slice(i).join("/")),t.push([h.code,Ge(h.code,n)]),e.push([h.code,n]);break}let d=Ge(h.code,o[i]);t.push([h.code,d]),e.push([h.code,je(h.code,d)])}return{string:rn(e),bytes:He(t),tuples:t,stringTuples:e,path:n}}function Xe(r){let t=[],e=[],n=null,o=0;for(;o<r.length;){let i=j(r,o),a=F(i),h=I(i),d=$i(h,r.slice(o+a));if(d===0){t.push([i]),e.push([i]),o+=a;continue}let l=r.slice(o+a,o+a+d);if(o+=d+a,o>r.length)throw nn("Invalid address Uint8Array: "+C(r,"base16"));t.push([i,l]);let b=je(i,l);if(e.push([i,b]),h.path===!0){n=b;break}}return{bytes:Uint8Array.from(r),string:rn(e),tuples:t,stringTuples:e,path:n}}function rn(r){let t=[];return r.map(e=>{let n=I(e[0]);return t.push(n.name),e.length>1&&e[1]!=null&&t.push(e[1]),null}),qe(t.join("/"))}function He(r){return B(r.map(t=>{let e=I(t[0]),n=Uint8Array.from(rt(e.code));return t.length>1&&t[1]!=null&&(n=B([n,t[1]])),n}))}function $i(r,t){if(r.size>0)return r.size/8;if(r.size===0)return 0;{let e=j(t instanceof Uint8Array?t:Uint8Array.from(t));return e+F(e)}}function qe(r){return"/"+r.trim().split("/").filter(t=>t).join("/")}function nn(r){return new Error("Error parsing address: "+r)}var ki=Symbol.for("nodejs.util.inspect.custom"),Qe=Symbol.for("@multiformats/js-multiaddr/multiaddr"),Mi=[I("dns").code,I("dns4").code,I("dns6").code,I("dnsaddr").code],qt=class r{bytes;#e;#t;#r;#n;[Qe]=!0;constructor(t){t==null&&(t="");let e;if(t instanceof Uint8Array)e=Xe(t);else if(typeof t=="string"){if(t.length>0&&t.charAt(0)!=="/")throw new Error(`multiaddr "${t}" must start with a "/"`);e=en(t)}else if(sn(t))e=Xe(t.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=e.bytes,this.#e=e.string,this.#t=e.tuples,this.#r=e.stringTuples,this.#n=e.path}toString(){return this.#e}toJSON(){return this.toString()}toOptions(){let t,e,n,o,i="",a=I("tcp"),h=I("udp"),d=I("ip4"),l=I("ip6"),b=I("dns6"),w=I("ip6zone");for(let[s,c]of this.stringTuples())s===w.code&&(i=`%${c??""}`),Mi.includes(s)&&(e=a.name,o=443,n=`${c??""}${i}`,t=s===b.code?6:4),(s===a.code||s===h.code)&&(e=I(s).name,o=parseInt(c??"")),(s===d.code||s===l.code)&&(e=I(s).name,n=`${c??""}${i}`,t=s===l.code?6:4);if(t==null||e==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:t,host:n,transport:e,port:o}}protos(){return this.#t.map(([t])=>Object.assign({},I(t)))}protoCodes(){return this.#t.map(([t])=>t)}protoNames(){return this.#t.map(([t])=>I(t).name)}tuples(){return this.#t}stringTuples(){return this.#r}encapsulate(t){return t=new r(t),new r(this.toString()+t.toString())}decapsulate(t){let e=t.toString(),n=this.toString(),o=n.lastIndexOf(e);if(o<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${t.toString()}`);return new r(n.slice(0,o))}decapsulateCode(t){let e=this.tuples();for(let n=e.length-1;n>=0;n--)if(e[n][0]===t)return new r(He(e.slice(0,n)));return this}getPeerId(){try{let t=[];this.stringTuples().forEach(([n,o])=>{n===wt.p2p.code&&t.push([n,o]),n===wt["p2p-circuit"].code&&(t=[])});let e=t.pop();if(e?.[1]!=null){let n=e[1];return n[0]==="Q"||n[0]==="1"?C(P.decode(`z${n}`),"base58btc"):C(tt.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return this.#n}equals(t){return Vt(this.bytes,t.bytes)}async resolve(t){let e=this.protos().find(i=>i.resolvable);if(e==null)return[this];let n=on.get(e.name);if(n==null)throw new z(`no available resolver for ${e.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,t)).map(i=>new r(i))}nodeAddress(){let t=this.toOptions();if(t.transport!=="tcp"&&t.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${t.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:t.family,address:t.host,port:t.port}}isThinWaistAddress(t){let e=(t??this).protos();return!(e.length!==2||e[0].code!==4&&e[0].code!==41||e[1].code!==6&&e[1].code!==273)}[ki](){return`Multiaddr(${this.#e})`}};var on=new Map;function sn(r){return!!r?.[Qe]}function Je(r){return new qt(r)}var an=()=>{let r=new Error("Delay aborted");return r.name="AbortError",r},Bi=new WeakMap;function Oi({clearTimeout:r,setTimeout:t}={}){return(e,{value:n,signal:o}={})=>{if(o?.aborted)return Promise.reject(an());let i,a,h,d=r??clearTimeout,l=()=>{d(i),h(an())},b=()=>{o&&o.removeEventListener("abort",l)},w=new Promise((p,s)=>{a=()=>{b(),p(n)},h=s,i=(t??setTimeout)(a,e)});return o&&o.addEventListener("abort",l,{once:!0}),Bi.set(w,()=>{d(i),i=null,a()}),w}}var Vi=Oi(),cn=Vi;var un=Symbol.for("@achingbrain/uint8arraylist");function hn(r,t){if(t==null||t<0)throw new RangeError("index is out of bounds");let e=0;for(let n of r){let o=e+n.byteLength;if(t<o)return{buf:n,index:t-e};e=o}throw new RangeError("index is out of bounds")}function Xt(r){return!!r?.[un]}var O=class r{bufs;length;[un]=!0;constructor(...t){this.bufs=[],this.length=0,t.length>0&&this.appendAll(t)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...t){this.appendAll(t)}appendAll(t){let e=0;for(let n of t)if(n instanceof Uint8Array)e+=n.byteLength,this.bufs.push(n);else if(Xt(n))e+=n.byteLength,this.bufs.push(...n.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=e}prepend(...t){this.prependAll(t)}prependAll(t){let e=0;for(let n of t.reverse())if(n instanceof Uint8Array)e+=n.byteLength,this.bufs.unshift(n);else if(Xt(n))e+=n.byteLength,this.bufs.unshift(...n.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=e}get(t){let e=hn(this.bufs,t);return e.buf[e.index]}set(t,e){let n=hn(this.bufs,t);n.buf[n.index]=e}write(t,e=0){if(t instanceof Uint8Array)for(let n=0;n<t.length;n++)this.set(e+n,t[n]);else if(Xt(t))for(let n=0;n<t.length;n++)this.set(e+n,t.get(n));else throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList")}consume(t){if(t=Math.trunc(t),!(Number.isNaN(t)||t<=0)){if(t===this.byteLength){this.bufs=[],this.length=0;return}for(;this.bufs.length>0;)if(t>=this.bufs[0].byteLength)t-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(t),this.length-=t;break}}}slice(t,e){let{bufs:n,length:o}=this._subList(t,e);return B(n,o)}subarray(t,e){let{bufs:n,length:o}=this._subList(t,e);return n.length===1?n[0]:B(n,o)}sublist(t,e){let{bufs:n,length:o}=this._subList(t,e),i=new r;return i.length=o,i.bufs=[...n],i}_subList(t,e){if(t=t??0,e=e??this.length,t<0&&(t=this.length+t),e<0&&(e=this.length+e),t<0||e>this.length)throw new RangeError("index is out of bounds");if(t===e)return{bufs:[],length:0};if(t===0&&e===this.length)return{bufs:this.bufs,length:this.length};let n=[],o=0;for(let i=0;i<this.bufs.length;i++){let a=this.bufs[i],h=o,d=h+a.byteLength;if(o=d,t>=d)continue;let l=t>=h&&t<d,b=e>h&&e<=d;if(l&&b){if(t===h&&e===d){n.push(a);break}let w=t-h;n.push(a.subarray(w,w+(e-t)));break}if(l){if(t===0){n.push(a);continue}n.push(a.subarray(t-h));continue}if(b){if(e===d){n.push(a);break}n.push(a.subarray(0,e-h));break}n.push(a)}return{bufs:n,length:e-t}}indexOf(t,e=0){if(!Xt(t)&&!(t instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');let n=t instanceof Uint8Array?t:t.subarray();if(e=Number(e??0),isNaN(e)&&(e=0),e<0&&(e=this.length+e),e<0&&(e=0),t.length===0)return e>this.length?this.length:e;let o=n.byteLength;if(o===0)throw new TypeError("search must be at least 1 byte long");let i=256,a=new Int32Array(i);for(let w=0;w<i;w++)a[w]=-1;for(let w=0;w<o;w++)a[n[w]]=w;let h=a,d=this.byteLength-n.byteLength,l=n.byteLength-1,b;for(let w=e;w<=d;w+=b){b=0;for(let p=l;p>=0;p--){let s=this.get(w+p);if(n[p]!==s){b=Math.max(1,p-h[s]);break}}if(b===0)return w}return-1}getInt8(t){let e=this.subarray(t,t+1);return new DataView(e.buffer,e.byteOffset,e.byteLength).getInt8(0)}setInt8(t,e){let n=N(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt8(0,e),this.write(n,t)}getInt16(t,e){let n=this.subarray(t,t+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt16(0,e)}setInt16(t,e,n){let o=K(2);new DataView(o.buffer,o.byteOffset,o.byteLength).setInt16(0,e,n),this.write(o,t)}getInt32(t,e){let n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt32(0,e)}setInt32(t,e,n){let o=K(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setInt32(0,e,n),this.write(o,t)}getBigInt64(t,e){let n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigInt64(0,e)}setBigInt64(t,e,n){let o=K(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setBigInt64(0,e,n),this.write(o,t)}getUint8(t){let e=this.subarray(t,t+1);return new DataView(e.buffer,e.byteOffset,e.byteLength).getUint8(0)}setUint8(t,e){let n=N(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint8(0,e),this.write(n,t)}getUint16(t,e){let n=this.subarray(t,t+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint16(0,e)}setUint16(t,e,n){let o=K(2);new DataView(o.buffer,o.byteOffset,o.byteLength).setUint16(0,e,n),this.write(o,t)}getUint32(t,e){let n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint32(0,e)}setUint32(t,e,n){let o=K(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setUint32(0,e,n),this.write(o,t)}getBigUint64(t,e){let n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigUint64(0,e)}setBigUint64(t,e,n){let o=K(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setBigUint64(0,e,n),this.write(o,t)}getFloat32(t,e){let n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat32(0,e)}setFloat32(t,e,n){let o=K(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setFloat32(0,e,n),this.write(o,t)}getFloat64(t,e){let n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat64(0,e)}setFloat64(t,e,n){let o=K(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setFloat64(0,e,n),this.write(o,t)}equals(t){if(t==null||!(t instanceof r)||t.bufs.length!==this.bufs.length)return!1;for(let e=0;e<this.bufs.length;e++)if(!Vt(this.bufs[e],t.bufs[e]))return!1;return!0}static fromUint8Arrays(t,e){let n=new r;return n.bufs=t,e==null&&(e=t.reduce((o,i)=>o+i.byteLength,0)),n.length=e,n}};function bt(){let r={};return r.promise=new Promise((t,e)=>{r.resolve=t,r.reject=e}),r}var Ht=class extends Error{type;code;constructor(t,e){super(t??"The operation was aborted"),this.type="aborted",this.name="AbortError",this.code=e??"ABORT_ERR"}};async function fn(r,t,e){if(t==null)return r;if(t.aborted)return Promise.reject(new Ht(e?.errorMessage,e?.errorCode));let n,o=new Ht(e?.errorMessage,e?.errorCode);try{return await Promise.race([r,new Promise((i,a)=>{n=()=>{a(o)},t.addEventListener("abort",n)})])}finally{n!=null&&t.removeEventListener("abort",n)}}var Ze=class{needNext;haveNext;ended;nextResult;constructor(){this.ended=!1,this.needNext=bt(),this.needNext.resolve(),this.haveNext=bt()}[Symbol.asyncIterator](){return this}async next(){if(this.nextResult==null&&await this.haveNext.promise,this.nextResult==null)throw new Error("Have next but next was undefined");let t=this.nextResult;return this.nextResult=void 0,this.needNext.resolve(),this.needNext=bt(),t}async throw(t){return this.ended=!0,t!=null&&this.haveNext.reject(t),{done:!0,value:void 0}}async return(){let t={done:!0,value:void 0};return await this._push(void 0),t}async push(t,e){await this._push(t,e)}async end(t,e){t!=null?await this.throw(t):await this._push(void 0,e)}async _push(t,e){if(t!=null&&this.ended)throw new Error("Cannot push value onto an ended pushable");this.nextResult!=null&&await this.needNext.promise,t!=null?this.nextResult={done:!1,value:t}:(this.ended=!0,this.nextResult={done:!0,value:void 0}),this.haveNext.resolve(),this.haveNext=bt(),await fn(this.needNext.promise,e?.signal,e)}};function ln(){return new Ze}var Qt=class extends Error{code;constructor(t,e){super(t),this.code=e}},Ke=class extends Qt{type;constructor(t){super(t,"ABORT_ERR"),this.type="aborted"}};function dn(r,t){let e=ln();r.sink(e).catch(async a=>{await e.end(a)}),r.sink=async a=>{for await(let h of a)await e.push(h);await e.end()};let n=r.source;r.source[Symbol.iterator]!=null?n=r.source[Symbol.iterator]():r.source[Symbol.asyncIterator]!=null&&(n=r.source[Symbol.asyncIterator]());let o=new O;return{read:async(a,h)=>{h?.signal?.throwIfAborted();let d,l=new Promise((b,w)=>{d=()=>{w(new Ke("Read aborted"))},h?.signal?.addEventListener("abort",d)});try{if(a==null){let{done:w,value:p}=await Promise.race([n.next(),l]);return w===!0?new O:p}for(;o.byteLength<a;){let{value:w,done:p}=await Promise.race([n.next(),l]);if(p===!0)throw new Qt("unexpected end of input","ERR_UNEXPECTED_EOF");o.append(w)}let b=o.sublist(0,a);return o.consume(a),b}finally{d!=null&&h?.signal?.removeEventListener("abort",d)}},write:async(a,h)=>{h?.signal?.throwIfAborted(),a instanceof Uint8Array?await e.push(a,h):await e.push(a.subarray(),h)},unwrap:()=>{if(o.byteLength>0){let a=r.source;r.source=async function*(){t?.yieldBytes===!1?yield o:yield*o,yield*a}()}return r}}}function Jt(r){return r[Symbol.asyncIterator]!=null}var Zt=r=>{let t=F(r),e=N(t);return rt(r,e),Zt.bytes=t,e};Zt.bytes=0;function Nt(r,t){t=t??{};let e=t.lengthEncoder??Zt;function*n(o){let i=e(o.byteLength);i instanceof Uint8Array?yield i:yield*i,o instanceof Uint8Array?yield o:yield*o}return Jt(r)?async function*(){for await(let o of r)yield*n(o)}():function*(){for(let o of r)yield*n(o)}()}Nt.single=(r,t)=>{t=t??{};let e=t.lengthEncoder??Zt;return new O(e(r.byteLength),r)};var xt=fe(gn(),1);var zi=8,ji=1024*1024*4,at;(function(r){r[r.LENGTH=0]="LENGTH",r[r.DATA=1]="DATA"})(at||(at={}));var tr=r=>{let t=j(r);return tr.bytes=F(t),t};tr.bytes=0;function Ye(r,t){let e=new O,n=at.LENGTH,o=-1,i=t?.lengthDecoder??tr,a=t?.maxLengthLength??zi,h=t?.maxDataLength??ji;function*d(){for(;e.byteLength>0;){if(n===at.LENGTH)try{if(o=i(e),o<0)throw(0,xt.default)(new Error("invalid message length"),"ERR_INVALID_MSG_LENGTH");if(o>h)throw(0,xt.default)(new Error("message length too long"),"ERR_MSG_DATA_TOO_LONG");let l=i.bytes;e.consume(l),t?.onLength!=null&&t.onLength(o),n=at.DATA}catch(l){if(l instanceof RangeError){if(e.byteLength>a)throw(0,xt.default)(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG");break}throw l}if(n===at.DATA){if(e.byteLength<o)break;let l=e.sublist(0,o);e.consume(o),t?.onData!=null&&t.onData(l),yield l,n=at.LENGTH}}}return Jt(r)?async function*(){for await(let l of r)e.append(l),yield*d();if(e.byteLength>0)throw(0,xt.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}():function*(){for(let l of r)e.append(l),yield*d();if(e.byteLength>0)throw(0,xt.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}()}Ye.fromReader=(r,t)=>{let e=1,n=async function*(){for(;;)try{let{done:i,value:a}=await r.next(e);if(i===!0)return;a!=null&&(yield a)}catch(i){if(i.code==="ERR_UNDER_READ")return{done:!0,value:null};throw i}finally{e=1}}();return Ye(n,{...t??{},onLength:i=>{e=i}})};var Kt=class extends Error{code;constructor(t,e){super(t),this.code=e}},wn=r=>j(r);wn.bytes=0;function bn(r,t={}){let e=dn(r,t);return t.maxDataLength!=null&&t.maxLengthLength==null&&(t.maxLengthLength=F(t.maxDataLength)),{read:async o=>{let i=-1,a=new O,h=t?.lengthDecoder??wn;for(;;){a.append(await e.read(1,o));try{i=h(a)}catch(d){if(d instanceof RangeError)continue;throw d}if(t?.maxLengthLength!=null&&a.byteLength>t.maxLengthLength)throw new Kt("message length length too long","ERR_MSG_LENGTH_TOO_LONG");if(i>-1)break}if(t?.maxDataLength!=null&&i>t.maxDataLength)throw new Kt("message length too long","ERR_MSG_DATA_TOO_LONG");return e.read(i,o)},write:async(o,i)=>{await e.write(Nt.single(o,t),i)},writeV:async(o,i)=>{let a=new O(...o.map(h=>Nt.single(h,t)));await e.write(a,i)},unwrap:()=>e.unwrap()}}function er(r,t){let e=bn(r,t),n={read:async(o,i)=>{let a=await e.read(i);return o.decode(a)},write:async(o,i,a)=>{await e.write(i.encode(o),a)},writeV:async(o,i,a)=>{await e.writeV(o.map(h=>i.encode(h)),a)},pb:o=>({read:async i=>n.read(o,i),write:async(i,a)=>n.write(i,o,a),writeV:async(i,a)=>n.writeV(i,o,a),unwrap:()=>n}),unwrap:()=>e.unwrap()};return n}var rr=new Float32Array([-0]),nt=new Uint8Array(rr.buffer);function xn(r,t,e){rr[0]=r,t[e]=nt[0],t[e+1]=nt[1],t[e+2]=nt[2],t[e+3]=nt[3]}function yn(r,t){return nt[0]=r[t],nt[1]=r[t+1],nt[2]=r[t+2],nt[3]=r[t+3],rr[0]}var nr=new Float64Array([-0]),R=new Uint8Array(nr.buffer);function In(r,t,e){nr[0]=r,t[e]=R[0],t[e+1]=R[1],t[e+2]=R[2],t[e+3]=R[3],t[e+4]=R[4],t[e+5]=R[5],t[e+6]=R[6],t[e+7]=R[7]}function An(r,t){return R[0]=r[t],R[1]=r[t+1],R[2]=r[t+2],R[3]=r[t+3],R[4]=r[t+4],R[5]=r[t+5],R[6]=r[t+6],R[7]=r[t+7],nr[0]}var Wi=BigInt(Number.MAX_SAFE_INTEGER),qi=BigInt(Number.MIN_SAFE_INTEGER),U=class r{lo;hi;constructor(t,e){this.lo=t|0,this.hi=e|0}toNumber(t=!1){if(!t&&this.hi>>>31>0){let e=~this.lo+1>>>0,n=~this.hi>>>0;return e===0&&(n=n+1>>>0),-(e+n*4294967296)}return this.lo+this.hi*4294967296}toBigInt(t=!1){if(t)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let e=~this.lo+1>>>0,n=~this.hi>>>0;return e===0&&(n=n+1>>>0),-(BigInt(e)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(t=!1){return this.toBigInt(t).toString()}zzEncode(){let t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this}zzDecode(){let t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this}length(){let t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?e===0?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:n<128?9:10}static fromBigInt(t){if(t===0n)return ct;if(t<Wi&&t>qi)return this.fromNumber(Number(t));let e=t<0n;e&&(t=-t);let n=t>>32n,o=t-(n<<32n);return e&&(n=~n|0n,o=~o|0n,++o>vn&&(o=0n,++n>vn&&(n=0n))),new r(Number(o),Number(n))}static fromNumber(t){if(t===0)return ct;let e=t<0;e&&(t=-t);let n=t>>>0,o=(t-n)/4294967296>>>0;return e&&(o=~o>>>0,n=~n>>>0,++n>4294967295&&(n=0,++o>4294967295&&(o=0))),new r(n,o)}static from(t){return typeof t=="number"?r.fromNumber(t):typeof t=="bigint"?r.fromBigInt(t):typeof t=="string"?r.fromBigInt(BigInt(t)):t.low!=null||t.high!=null?new r(t.low>>>0,t.high>>>0):ct}},ct=new U(0,0);ct.toBigInt=function(){return 0n};ct.zzEncode=ct.zzDecode=function(){return this};ct.length=function(){return 1};var vn=4294967296n;function En(r){let t=0,e=0;for(let n=0;n<r.length;++n)e=r.charCodeAt(n),e<128?t+=1:e<2048?t+=2:(e&64512)===55296&&(r.charCodeAt(n+1)&64512)===56320?(++n,t+=4):t+=3;return t}function Sn(r,t,e){if(e-t<1)return"";let o,i=[],a=0,h;for(;t<e;)h=r[t++],h<128?i[a++]=h:h>191&&h<224?i[a++]=(h&31)<<6|r[t++]&63:h>239&&h<365?(h=((h&7)<<18|(r[t++]&63)<<12|(r[t++]&63)<<6|r[t++]&63)-65536,i[a++]=55296+(h>>10),i[a++]=56320+(h&1023)):i[a++]=(h&15)<<12|(r[t++]&63)<<6|r[t++]&63,a>8191&&((o??(o=[])).push(String.fromCharCode.apply(String,i)),a=0);return o!=null?(a>0&&o.push(String.fromCharCode.apply(String,i.slice(0,a))),o.join("")):String.fromCharCode.apply(String,i.slice(0,a))}function or(r,t,e){let n=e,o,i;for(let a=0;a<r.length;++a)o=r.charCodeAt(a),o<128?t[e++]=o:o<2048?(t[e++]=o>>6|192,t[e++]=o&63|128):(o&64512)===55296&&((i=r.charCodeAt(a+1))&64512)===56320?(o=65536+((o&1023)<<10)+(i&1023),++a,t[e++]=o>>18|240,t[e++]=o>>12&63|128,t[e++]=o>>6&63|128,t[e++]=o&63|128):(t[e++]=o>>12|224,t[e++]=o>>6&63|128,t[e++]=o&63|128);return e-n}function G(r,t){return RangeError(`index out of range: ${r.pos} + ${t??1} > ${r.len}`)}function Yt(r,t){return(r[t-4]|r[t-3]<<8|r[t-2]<<16|r[t-1]<<24)>>>0}var ir=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(t){this.buf=t,this.pos=0,this.len=t.length}uint32(){let t=4294967295;if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,G(this,10);return t}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw G(this,4);return Yt(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw G(this,4);return Yt(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw G(this,4);let t=yn(this.buf,this.pos);return this.pos+=4,t}double(){if(this.pos+8>this.len)throw G(this,4);let t=An(this.buf,this.pos);return this.pos+=8,t}bytes(){let t=this.uint32(),e=this.pos,n=this.pos+t;if(n>this.len)throw G(this,t);return this.pos+=t,e===n?new Uint8Array(0):this.buf.subarray(e,n)}string(){let t=this.bytes();return Sn(t,0,t.length)}skip(t){if(typeof t=="number"){if(this.pos+t>this.len)throw G(this,t);this.pos+=t}else do if(this.pos>=this.len)throw G(this);while(this.buf[this.pos++]&128);return this}skipType(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${t} at offset ${this.pos}`)}return this}readLongVarint(){let t=new U(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw G(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw G(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw G(this,8);let t=Yt(this.buf,this.pos+=4),e=Yt(this.buf,this.pos+=4);return new U(t,e)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){return this.readLongVarint().toNumber(!0)}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}};function sr(r){return new ir(r instanceof Uint8Array?r:r.subarray())}function ar(r,t){let e=sr(r);return t.decode(e)}function cr(r){let t=r??8192,e=t>>>1,n,o=t;return function(a){if(a<1||a>e)return N(a);o+a>t&&(n=N(t),o=0);let h=n.subarray(o,o+=a);return o&7&&(o=(o|7)+1),h}}var ht=class{fn;len;next;val;constructor(t,e,n){this.fn=t,this.len=e,this.next=void 0,this.val=n}};function hr(){}var fr=class{head;tail;len;next;constructor(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}},Xi=cr();function Hi(r){return globalThis.Buffer!=null?N(r):Xi(r)}var Rt=class{len;head;tail;states;constructor(){this.len=0,this.head=new ht(hr,0,0),this.tail=this.head,this.states=null}_push(t,e,n){return this.tail=this.tail.next=new ht(t,e,n),this.len+=e,this}uint32(t){return this.len+=(this.tail=this.tail.next=new lr((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this}int32(t){return t<0?this._push(Dt,10,U.fromNumber(t)):this.uint32(t)}sint32(t){return this.uint32((t<<1^t>>31)>>>0)}uint64(t){let e=U.fromBigInt(t);return this._push(Dt,e.length(),e)}uint64Number(t){let e=U.fromNumber(t);return this._push(Dt,e.length(),e)}uint64String(t){return this.uint64(BigInt(t))}int64(t){return this.uint64(t)}int64Number(t){return this.uint64Number(t)}int64String(t){return this.uint64String(t)}sint64(t){let e=U.fromBigInt(t).zzEncode();return this._push(Dt,e.length(),e)}sint64Number(t){let e=U.fromNumber(t).zzEncode();return this._push(Dt,e.length(),e)}sint64String(t){return this.sint64(BigInt(t))}bool(t){return this._push(ur,1,t?1:0)}fixed32(t){return this._push(Ft,4,t>>>0)}sfixed32(t){return this.fixed32(t)}fixed64(t){let e=U.fromBigInt(t);return this._push(Ft,4,e.lo)._push(Ft,4,e.hi)}fixed64Number(t){let e=U.fromNumber(t);return this._push(Ft,4,e.lo)._push(Ft,4,e.hi)}fixed64String(t){return this.fixed64(BigInt(t))}sfixed64(t){return this.fixed64(t)}sfixed64Number(t){return this.fixed64Number(t)}sfixed64String(t){return this.fixed64String(t)}float(t){return this._push(xn,4,t)}double(t){return this._push(In,8,t)}bytes(t){let e=t.length>>>0;return e===0?this._push(ur,1,0):this.uint32(e)._push(Ji,e,t)}string(t){let e=En(t);return e!==0?this.uint32(e)._push(or,e,t):this._push(ur,1,0)}fork(){return this.states=new fr(this),this.head=this.tail=new ht(hr,0,0),this.len=0,this}reset(){return this.states!=null?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new ht(hr,0,0),this.len=0),this}ldelim(){let t=this.head,e=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=t.next,this.tail=e,this.len+=n),this}finish(){let t=this.head.next,e=Hi(this.len),n=0;for(;t!=null;)t.fn(t.val,e,n),n+=t.len,t=t.next;return e}};function ur(r,t,e){t[e]=r&255}function Qi(r,t,e){for(;r>127;)t[e++]=r&127|128,r>>>=7;t[e]=r}var lr=class extends ht{next;constructor(t,e){super(Qi,t,e),this.next=void 0}};function Dt(r,t,e){for(;r.hi!==0;)t[e++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)t[e++]=r.lo&127|128,r.lo=r.lo>>>7;t[e++]=r.lo}function Ft(r,t,e){t[e]=r&255,t[e+1]=r>>>8&255,t[e+2]=r>>>16&255,t[e+3]=r>>>24}function Ji(r,t,e){t.set(r,e)}globalThis.Buffer!=null&&(Rt.prototype.bytes=function(r){let t=r.length>>>0;return this.uint32(t),t>0&&this._push(Zi,t,r),this},Rt.prototype.string=function(r){let t=globalThis.Buffer.byteLength(r);return this.uint32(t),t>0&&this._push(Ki,t,r),this});function Zi(r,t,e){t.set(r,e)}function Ki(r,t,e){r.length<40?or(r,t,e):t.utf8Write!=null?t.utf8Write(r,e):t.set(Pt(r),e)}function dr(){return new Rt}function pr(r,t){let e=dr();return t.encode(r,e,{lengthDelimited:!1}),e.finish()}var yt;(function(r){r[r.VARINT=0]="VARINT",r[r.BIT64=1]="BIT64",r[r.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",r[r.START_GROUP=3]="START_GROUP",r[r.END_GROUP=4]="END_GROUP",r[r.BIT32=5]="BIT32"})(yt||(yt={}));function te(r,t,e,n){return{name:r,type:t,encode:e,decode:n}}function mr(r){function t(o){if(r[o.toString()]==null)throw new Error("Invalid enum value");return r[o]}let e=function(i,a){let h=t(i);a.int32(h)},n=function(i){let a=i.int32();return t(a)};return te("enum",yt.VARINT,e,n)}function gr(r,t){return te("message",yt.LENGTH_DELIMITED,r,t)}var W;(function(r){let t;(function(o){o.UNUSED="UNUSED",o.CONNECT="CONNECT",o.SYNC="SYNC"})(t=r.Type||(r.Type={}));let e;(function(o){o[o.UNUSED=0]="UNUSED",o[o.CONNECT=100]="CONNECT",o[o.SYNC=300]="SYNC"})(e||(e={})),function(o){o.codec=()=>mr(e)}(t=r.Type||(r.Type={}));let n;r.codec=()=>(n==null&&(n=gr((o,i,a={})=>{if(a.lengthDelimited!==!1&&i.fork(),o.type!=null&&(i.uint32(8),r.Type.codec().encode(o.type,i)),o.observedAddresses!=null)for(let h of o.observedAddresses)i.uint32(18),i.bytes(h);a.lengthDelimited!==!1&&i.ldelim()},(o,i)=>{let a={observedAddresses:[]},h=i==null?o.len:o.pos+i;for(;o.pos<h;){let d=o.uint32();switch(d>>>3){case 1:a.type=r.Type.codec().decode(o);break;case 2:a.observedAddresses.push(o.bytes());break;default:o.skipType(d&7);break}}return a})),n),r.encode=o=>pr(o,r.codec()),r.decode=o=>ar(o,r.codec())})(W||(W={}));var Yi=r=>r.toString().split("/").slice(1),Tt=r=>({match:t=>t.length<1?!1:r(t[0])?t.slice(1):!1,pattern:"fn"}),v=r=>({match:t=>Tt(e=>e===r).match(t),pattern:r}),ne=()=>({match:r=>Tt(t=>typeof t=="string").match(r),pattern:"{string}"}),Pn=()=>({match:r=>Tt(t=>!isNaN(parseInt(t))).match(r),pattern:"{number}"}),V=()=>({match:r=>{if(r.length<2||r[0]!=="p2p"&&r[0]!=="ipfs")return!1;if(r[1].startsWith("Q")||r[1].startsWith("1"))try{P.decode(`z${r[1]}`)}catch{return!1}else return!1;return r.slice(2)},pattern:"/p2p/{peerid}"}),ee=()=>({match:r=>{if(r.length<2||r[0]!=="certhash")return!1;try{Se.decode(r[1])}catch{return!1}return r.slice(2)},pattern:"/certhash/{certhash}"}),X=r=>({match:t=>{let e=r.match(t);return e===!1?t:e},pattern:`optional(${r.pattern})`}),H=(...r)=>({match:t=>{let e;for(let n of r){let o=n.match(t);o!==!1&&(e==null||o.length<e.length)&&(e=o)}return e??!1},pattern:`or(${r.map(t=>t.pattern).join(", ")})`}),E=(...r)=>({match:t=>{for(let e of r){let n=e.match(t);if(n===!1)return!1;t=n}return t},pattern:`and(${r.map(t=>t.pattern).join(", ")})`});function L(...r){function t(o){let i=Yi(o);for(let a of r){let h=a.match(i);if(h===!1)return!1;i=h}return i}function e(o){return t(o)!==!1}function n(o){let i=t(o);return i===!1?!1:i.length===0}return{matches:e,exactMatch:n}}var br=E(v("dns4"),ne()),xr=E(v("dns6"),ne()),yr=E(v("dnsaddr"),ne()),Nn=E(v("dns"),ne()),Gh=L(br),Wh=L(xr),qh=L(yr),Dn=L(H(Nn,yr,br,xr)),Fn=E(v("ip4"),Tt(Gt)),Rn=E(v("ip6"),Tt(Wt)),Tn=H(Fn,Rn),Ct=H(Tn,Nn,br,xr,yr),Xh=L(Ct),Hh=L(Fn),Qh=L(Rn),Cn=L(Tn),oe=E(Ct,v("tcp"),Pn()),Ut=E(Ct,v("udp"),Pn()),ts=H(oe,Ut),Jh=L(oe),Zh=L(Ut),Ir=E(Ut,v("quic")),ie=E(Ut,v("quic-v1")),es=H(Ir,ie),Kh=L(Ir),Yh=L(ie),wr=H(Ct,oe,Ut,Ir,ie),Un=H(E(wr,v("ws"),X(V()))),tu=L(Un),$n=H(E(wr,v("wss"),X(V())),E(wr,v("tls"),v("ws"),X(V()))),eu=L($n),kn=E(ts,v("webrtc-direct"),ee(),X(ee()),X(V())),ru=L(kn),Mn=E(ie,v("webtransport"),ee(),ee(),X(V())),nu=L(Mn),re=H(Un,$n,E(oe,X(V())),E(es,X(V())),E(Ct,X(V())),kn,Mn,V()),ou=L(re),rs=E(re,v("p2p-circuit"),V()),Bn=L(rs),ns=H(E(re,v("p2p-circuit"),v("webrtc"),V()),E(re,v("webrtc"),X(V())),v("webrtc")),iu=L(ns);var Wn=fe(On(),1);var Vn="[a-fA-F\\d:]",ot=r=>r&&r.includeBoundaries?`(?:(?<=\\s|^)(?=${Vn})|(?<=${Vn})(?=\\s|$))`:"",q="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",S="[a-fA-F\\d]{1,4}",se=`
|
|
2
|
+
"use strict";var Libp2PDcutr=(()=>{var eo=Object.create;var Mt=Object.defineProperty;var ro=Object.getOwnPropertyDescriptor;var no=Object.getOwnPropertyNames;var oo=Object.getPrototypeOf,io=Object.prototype.hasOwnProperty;var fe=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),k=(r,t)=>{for(var e in t)Mt(r,e,{get:t[e],enumerable:!0})},Lr=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of no(t))!io.call(r,o)&&o!==e&&Mt(r,o,{get:()=>t[o],enumerable:!(n=ro(t,o))||n.enumerable});return r};var le=(r,t,e)=>(e=r!=null?eo(oo(r)):{},Lr(t||!r||!r.__esModule?Mt(e,"default",{value:r,enumerable:!0}):e,r)),so=r=>Lr(Mt({},"__esModule",{value:!0}),r);var yn=fe((qu,xn)=>{"use strict";function bn(r,t){for(let e in t)Object.defineProperty(r,e,{value:t[e],enumerable:!0,configurable:!0});return r}function Wi(r,t,e){if(!r||typeof r=="string")throw new TypeError("Please pass an Error to err-code");e||(e={}),typeof t=="object"&&(e=t,t=""),t&&(e.code=t);try{return bn(r,e)}catch{e.message=r.message,e.stack=r.stack;let o=function(){};return o.prototype=Object.create(Object.getPrototypeOf(r)),bn(new o,e)}}xn.exports=Wi});var jn=fe($t=>{(function(){var r,t,e,n,o,i,a,u;u=function(d){var l,b,w,p;return l=(d&255<<24)>>>24,b=(d&255<<16)>>>16,w=(d&65280)>>>8,p=d&255,[l,b,w,p].join(".")},a=function(d){var l,b,w,p,s,c;for(l=[],w=p=0;p<=3&&d.length!==0;w=++p){if(w>0){if(d[0]!==".")throw new Error("Invalid IP");d=d.substring(1)}c=t(d),s=c[0],b=c[1],d=d.substring(b),l.push(s)}if(d.length!==0)throw new Error("Invalid IP");switch(l.length){case 1:if(l[0]>4294967295)throw new Error("Invalid IP");return l[0]>>>0;case 2:if(l[0]>255||l[1]>16777215)throw new Error("Invalid IP");return(l[0]<<24|l[1])>>>0;case 3:if(l[0]>255||l[1]>255||l[2]>65535)throw new Error("Invalid IP");return(l[0]<<24|l[1]<<16|l[2])>>>0;case 4:if(l[0]>255||l[1]>255||l[2]>255||l[3]>255)throw new Error("Invalid IP");return(l[0]<<24|l[1]<<16|l[2]<<8|l[3])>>>0;default:throw new Error("Invalid IP")}},e=function(d){return d.charCodeAt(0)},n=e("0"),i=e("a"),o=e("A"),t=function(d){var l,b,w,p,s;for(p=0,l=10,b="9",w=0,d.length>1&&d[w]==="0"&&(d[w+1]==="x"||d[w+1]==="X"?(w+=2,l=16):"0"<=d[w+1]&&d[w+1]<="9"&&(w++,l=8,b="7")),s=w;w<d.length;){if("0"<=d[w]&&d[w]<=b)p=p*l+(e(d[w])-n)>>>0;else if(l===16)if("a"<=d[w]&&d[w]<="f")p=p*l+(10+e(d[w])-i)>>>0;else if("A"<=d[w]&&d[w]<="F")p=p*l+(10+e(d[w])-o)>>>0;else break;else break;if(p>4294967295)throw new Error("too large");w++}if(w===s)throw new Error("empty octet");return[p,w]},r=function(){function d(l,b){var w,p,s,c;if(typeof l!="string")throw new Error("Missing `net' parameter");if(b||(c=l.split("/",2),l=c[0],b=c[1]),b||(b=32),typeof b=="string"&&b.indexOf(".")>-1){try{this.maskLong=a(b)}catch(f){throw w=f,new Error("Invalid mask: "+b)}for(p=s=32;s>=0;p=--s)if(this.maskLong===4294967295<<32-p>>>0){this.bitmask=p;break}}else if(b||b===0)this.bitmask=parseInt(b,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0);else throw new Error("Invalid mask: empty");try{this.netLong=(a(l)&this.maskLong)>>>0}catch(f){throw w=f,new Error("Invalid net address: "+l)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+b);this.size=Math.pow(2,32-this.bitmask),this.base=u(this.netLong),this.mask=u(this.maskLong),this.hostmask=u(~this.maskLong),this.first=this.bitmask<=30?u(this.netLong+1):this.base,this.last=this.bitmask<=30?u(this.netLong+this.size-2):u(this.netLong+this.size-1),this.broadcast=this.bitmask<=30?u(this.netLong+this.size-1):void 0}return d.prototype.contains=function(l){return typeof l=="string"&&(l.indexOf("/")>0||l.split(".").length!==4)&&(l=new d(l)),l instanceof d?this.contains(l.base)&&this.contains(l.broadcast||l.last):(a(l)&this.maskLong)>>>0===(this.netLong&this.maskLong)>>>0},d.prototype.next=function(l){return l==null&&(l=1),new d(u(this.netLong+this.size*l),this.mask)},d.prototype.forEach=function(l){var b,w,p;for(p=a(this.first),w=a(this.last),b=0;p<=w;)l(u(p),p,b),b++,p++},d.prototype.toString=function(){return this.base+"/"+this.bitmask},d}(),$t.ip2long=a,$t.long2ip=u,$t.Netmask=r}).call($t)});var Xn=fe((qn,ce)=>{(function(r){"use strict";let t="(0?\\d+|0x[a-f0-9]+)",e={fourOctet:new RegExp(`^${t}\\.${t}\\.${t}\\.${t}$`,"i"),threeOctet:new RegExp(`^${t}\\.${t}\\.${t}$`,"i"),twoOctet:new RegExp(`^${t}\\.${t}$`,"i"),longValue:new RegExp(`^${t}$`,"i")},n=new RegExp("^0[0-7]+$","i"),o=new RegExp("^0x[a-f0-9]+$","i"),i="%[0-9a-z]{1,}",a="(?:[0-9a-f]+::?)+",u={zoneIndex:new RegExp(i,"i"),native:new RegExp(`^(::)?(${a})?([0-9a-f]+)?(::)?(${i})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${i})?)$`,"i"),transitional:new RegExp(`^((?:${a})|(?:::)(?:${a})?)${t}\\.${t}\\.${t}\\.${t}(${i})?$`,"i")};function d(s,c){if(s.indexOf("::")!==s.lastIndexOf("::"))return null;let f=0,h=-1,m=(s.match(u.zoneIndex)||[])[0],g,x;for(m&&(m=m.substring(1),s=s.replace(/%.+$/,""));(h=s.indexOf(":",h+1))>=0;)f++;if(s.substr(0,2)==="::"&&f--,s.substr(-2,2)==="::"&&f--,f>c)return null;for(x=c-f,g=":";x--;)g+="0:";return s=s.replace("::",g),s[0]===":"&&(s=s.slice(1)),s[s.length-1]===":"&&(s=s.slice(0,-1)),c=function(){let T=s.split(":"),$=[];for(let M=0;M<T.length;M++)$.push(parseInt(T[M],16));return $}(),{parts:c,zoneId:m}}function l(s,c,f,h){if(s.length!==c.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let m=0,g;for(;h>0;){if(g=f-h,g<0&&(g=0),s[m]>>g!==c[m]>>g)return!1;h-=f,m+=1}return!0}function b(s){if(o.test(s))return parseInt(s,16);if(s[0]==="0"&&!isNaN(parseInt(s[1],10))){if(n.test(s))return parseInt(s,8);throw new Error(`ipaddr: cannot parse ${s} as octal`)}return parseInt(s,10)}function w(s,c){for(;s.length<c;)s=`0${s}`;return s}let p={};p.IPv4=function(){function s(c){if(c.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let f,h;for(f=0;f<c.length;f++)if(h=c[f],!(0<=h&&h<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=c}return s.prototype.SpecialRanges={unspecified:[[new s([0,0,0,0]),8]],broadcast:[[new s([255,255,255,255]),32]],multicast:[[new s([224,0,0,0]),4]],linkLocal:[[new s([169,254,0,0]),16]],loopback:[[new s([127,0,0,0]),8]],carrierGradeNat:[[new s([100,64,0,0]),10]],private:[[new s([10,0,0,0]),8],[new s([172,16,0,0]),12],[new s([192,168,0,0]),16]],reserved:[[new s([192,0,0,0]),24],[new s([192,0,2,0]),24],[new s([192,88,99,0]),24],[new s([198,18,0,0]),15],[new s([198,51,100,0]),24],[new s([203,0,113,0]),24],[new s([240,0,0,0]),4]]},s.prototype.kind=function(){return"ipv4"},s.prototype.match=function(c,f){let h;if(f===void 0&&(h=c,c=h[0],f=h[1]),c.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return l(this.octets,c.octets,8,f)},s.prototype.prefixLengthFromSubnetMask=function(){let c=0,f=!1,h={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},m,g,x;for(m=3;m>=0;m-=1)if(g=this.octets[m],g in h){if(x=h[g],f&&x!==0)return null;x!==8&&(f=!0),c+=x}else return null;return 32-c},s.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},s.prototype.toByteArray=function(){return this.octets.slice(0)},s.prototype.toIPv4MappedAddress=function(){return p.IPv6.parse(`::ffff:${this.toString()}`)},s.prototype.toNormalizedString=function(){return this.toString()},s.prototype.toString=function(){return this.octets.join(".")},s}(),p.IPv4.broadcastAddressFromCIDR=function(s){try{let c=this.parseCIDR(s),f=c[0].toByteArray(),h=this.subnetMaskFromPrefixLength(c[1]).toByteArray(),m=[],g=0;for(;g<4;)m.push(parseInt(f[g],10)|parseInt(h[g],10)^255),g++;return new this(m)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},p.IPv4.isIPv4=function(s){return this.parser(s)!==null},p.IPv4.isValid=function(s){try{return new this(this.parser(s)),!0}catch{return!1}},p.IPv4.isValidFourPartDecimal=function(s){return!!(p.IPv4.isValid(s)&&s.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},p.IPv4.networkAddressFromCIDR=function(s){let c,f,h,m,g;try{for(c=this.parseCIDR(s),h=c[0].toByteArray(),g=this.subnetMaskFromPrefixLength(c[1]).toByteArray(),m=[],f=0;f<4;)m.push(parseInt(h[f],10)&parseInt(g[f],10)),f++;return new this(m)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},p.IPv4.parse=function(s){let c=this.parser(s);if(c===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(c)},p.IPv4.parseCIDR=function(s){let c;if(c=s.match(/^(.+)\/(\d+)$/)){let f=parseInt(c[2]);if(f>=0&&f<=32){let h=[this.parse(c[1]),f];return Object.defineProperty(h,"toString",{value:function(){return this.join("/")}}),h}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},p.IPv4.parser=function(s){let c,f,h;if(c=s.match(e.fourOctet))return function(){let m=c.slice(1,6),g=[];for(let x=0;x<m.length;x++)f=m[x],g.push(b(f));return g}();if(c=s.match(e.longValue)){if(h=b(c[1]),h>4294967295||h<0)throw new Error("ipaddr: address outside defined range");return function(){let m=[],g;for(g=0;g<=24;g+=8)m.push(h>>g&255);return m}().reverse()}else return(c=s.match(e.twoOctet))?function(){let m=c.slice(1,4),g=[];if(h=b(m[1]),h>16777215||h<0)throw new Error("ipaddr: address outside defined range");return g.push(b(m[0])),g.push(h>>16&255),g.push(h>>8&255),g.push(h&255),g}():(c=s.match(e.threeOctet))?function(){let m=c.slice(1,5),g=[];if(h=b(m[2]),h>65535||h<0)throw new Error("ipaddr: address outside defined range");return g.push(b(m[0])),g.push(b(m[1])),g.push(h>>8&255),g.push(h&255),g}():null},p.IPv4.subnetMaskFromPrefixLength=function(s){if(s=parseInt(s),s<0||s>32)throw new Error("ipaddr: invalid IPv4 prefix length");let c=[0,0,0,0],f=0,h=Math.floor(s/8);for(;f<h;)c[f]=255,f++;return h<4&&(c[h]=Math.pow(2,s%8)-1<<8-s%8),new this(c)},p.IPv6=function(){function s(c,f){let h,m;if(c.length===16)for(this.parts=[],h=0;h<=14;h+=2)this.parts.push(c[h]<<8|c[h+1]);else if(c.length===8)this.parts=c;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(h=0;h<this.parts.length;h++)if(m=this.parts[h],!(0<=m&&m<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");f&&(this.zoneId=f)}return s.prototype.SpecialRanges={unspecified:[new s([0,0,0,0,0,0,0,0]),128],linkLocal:[new s([65152,0,0,0,0,0,0,0]),10],multicast:[new s([65280,0,0,0,0,0,0,0]),8],loopback:[new s([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new s([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new s([0,0,0,0,0,65535,0,0]),96],rfc6145:[new s([0,0,0,0,65535,0,0,0]),96],rfc6052:[new s([100,65435,0,0,0,0,0,0]),96],"6to4":[new s([8194,0,0,0,0,0,0,0]),16],teredo:[new s([8193,0,0,0,0,0,0,0]),32],reserved:[[new s([8193,3512,0,0,0,0,0,0]),32]],benchmarking:[new s([8193,2,0,0,0,0,0,0]),48],amt:[new s([8193,3,0,0,0,0,0,0]),32],as112v6:[new s([8193,4,274,0,0,0,0,0]),48],deprecated:[new s([8193,16,0,0,0,0,0,0]),28],orchid2:[new s([8193,32,0,0,0,0,0,0]),28]},s.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},s.prototype.kind=function(){return"ipv6"},s.prototype.match=function(c,f){let h;if(f===void 0&&(h=c,c=h[0],f=h[1]),c.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return l(this.parts,c.parts,16,f)},s.prototype.prefixLengthFromSubnetMask=function(){let c=0,f=!1,h={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},m,g;for(let x=7;x>=0;x-=1)if(m=this.parts[x],m in h){if(g=h[m],f&&g!==0)return null;g!==16&&(f=!0),c+=g}else return null;return 128-c},s.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},s.prototype.toByteArray=function(){let c,f=[],h=this.parts;for(let m=0;m<h.length;m++)c=h[m],f.push(c>>8),f.push(c&255);return f},s.prototype.toFixedLengthString=function(){let c=function(){let h=[];for(let m=0;m<this.parts.length;m++)h.push(w(this.parts[m].toString(16),4));return h}.call(this).join(":"),f="";return this.zoneId&&(f=`%${this.zoneId}`),c+f},s.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let c=this.parts.slice(-2),f=c[0],h=c[1];return new p.IPv4([f>>8,f&255,h>>8,h&255])},s.prototype.toNormalizedString=function(){let c=function(){let h=[];for(let m=0;m<this.parts.length;m++)h.push(this.parts[m].toString(16));return h}.call(this).join(":"),f="";return this.zoneId&&(f=`%${this.zoneId}`),c+f},s.prototype.toRFC5952String=function(){let c=/((^|:)(0(:|$)){2,})/g,f=this.toNormalizedString(),h=0,m=-1,g;for(;g=c.exec(f);)g[0].length>m&&(h=g.index,m=g[0].length);return m<0?f:`${f.substring(0,h)}::${f.substring(h+m)}`},s.prototype.toString=function(){return this.toRFC5952String()},s}(),p.IPv6.broadcastAddressFromCIDR=function(s){try{let c=this.parseCIDR(s),f=c[0].toByteArray(),h=this.subnetMaskFromPrefixLength(c[1]).toByteArray(),m=[],g=0;for(;g<16;)m.push(parseInt(f[g],10)|parseInt(h[g],10)^255),g++;return new this(m)}catch(c){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${c})`)}},p.IPv6.isIPv6=function(s){return this.parser(s)!==null},p.IPv6.isValid=function(s){if(typeof s=="string"&&s.indexOf(":")===-1)return!1;try{let c=this.parser(s);return new this(c.parts,c.zoneId),!0}catch{return!1}},p.IPv6.networkAddressFromCIDR=function(s){let c,f,h,m,g;try{for(c=this.parseCIDR(s),h=c[0].toByteArray(),g=this.subnetMaskFromPrefixLength(c[1]).toByteArray(),m=[],f=0;f<16;)m.push(parseInt(h[f],10)&parseInt(g[f],10)),f++;return new this(m)}catch(x){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${x})`)}},p.IPv6.parse=function(s){let c=this.parser(s);if(c.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(c.parts,c.zoneId)},p.IPv6.parseCIDR=function(s){let c,f,h;if((f=s.match(/^(.+)\/(\d+)$/))&&(c=parseInt(f[2]),c>=0&&c<=128))return h=[this.parse(f[1]),c],Object.defineProperty(h,"toString",{value:function(){return this.join("/")}}),h;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},p.IPv6.parser=function(s){let c,f,h,m,g,x;if(h=s.match(u.deprecatedTransitional))return this.parser(`::ffff:${h[1]}`);if(u.native.test(s))return d(s,8);if((h=s.match(u.transitional))&&(x=h[6]||"",c=d(h[1].slice(0,-1)+x,6),c.parts)){for(g=[parseInt(h[2]),parseInt(h[3]),parseInt(h[4]),parseInt(h[5])],f=0;f<g.length;f++)if(m=g[f],!(0<=m&&m<=255))return null;return c.parts.push(g[0]<<8|g[1]),c.parts.push(g[2]<<8|g[3]),{parts:c.parts,zoneId:c.zoneId}}return null},p.IPv6.subnetMaskFromPrefixLength=function(s){if(s=parseInt(s),s<0||s>128)throw new Error("ipaddr: invalid IPv6 prefix length");let c=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],f=0,h=Math.floor(s/8);for(;f<h;)c[f]=255,f++;return h<16&&(c[h]=Math.pow(2,s%8)-1<<8-s%8),new this(c)},p.fromByteArray=function(s){let c=s.length;if(c===4)return new p.IPv4(s);if(c===16)return new p.IPv6(s);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},p.isValid=function(s){return p.IPv6.isValid(s)||p.IPv4.isValid(s)},p.parse=function(s){if(p.IPv6.isValid(s))return p.IPv6.parse(s);if(p.IPv4.isValid(s))return p.IPv4.parse(s);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},p.parseCIDR=function(s){try{return p.IPv6.parseCIDR(s)}catch{try{return p.IPv4.parseCIDR(s)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},p.process=function(s){let c=this.parse(s);return c.kind()==="ipv6"&&c.isIPv4MappedAddress()?c.toIPv4Address():c},p.subnetMatch=function(s,c,f){let h,m,g,x;f==null&&(f="unicast");for(m in c)if(Object.prototype.hasOwnProperty.call(c,m)){for(g=c[m],g[0]&&!(g[0]instanceof Array)&&(g=[g]),h=0;h<g.length;h++)if(x=g[h],s.kind()===x[0].kind()&&s.match.apply(s,x))return m}return f},typeof ce<"u"&&ce.exports?ce.exports=p:r.ipaddr=p})(qn)});var ws={};k(ws,{dcutr:()=>gs,multicodec:()=>It});var xs=Symbol.for("@libp2p/connection");var Is=Symbol.for("@libp2p/content-routing");var vs=Symbol.for("@libp2p/peer-discovery");var Ls=Symbol.for("@libp2p/peer-id");var Ns=Symbol.for("@libp2p/peer-routing");var Pr;(function(r){r.Accept="accept",r.Ignore="ignore",r.Reject="reject"})(Pr||(Pr={}));var Ts=Symbol.for("@libp2p/transport");var Nr;(function(r){r[r.FATAL_ALL=0]="FATAL_ALL",r[r.NO_FATAL=1]="NO_FATAL"})(Nr||(Nr={}));var Q=class extends Error{code;props;constructor(t,e,n){super(t),this.code=e,this.name=n?.name??"CodeError",this.props=n??{}}};var it="ERR_INVALID_MESSAGE";var de=class extends Event{detail;constructor(t,e){super(t,e),this.detail=e?.detail}},Bs=globalThis.CustomEvent??de;var Bt=class extends Error{code;props;constructor(t,e,n){super(t),this.code=e,this.name=n?.name??"CodeError",this.props=n??{}}};var be={};k(be,{base58btc:()=>P,base58flickr:()=>lo});function ao(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var o=0;o<r.length;o++){var i=r.charAt(o),a=i.charCodeAt(0);if(e[a]!==255)throw new TypeError(i+" is ambiguous");e[a]=o}var u=r.length,d=r.charAt(0),l=Math.log(u)/Math.log(256),b=Math.log(256)/Math.log(u);function w(c){if(c instanceof Uint8Array||(ArrayBuffer.isView(c)?c=new Uint8Array(c.buffer,c.byteOffset,c.byteLength):Array.isArray(c)&&(c=Uint8Array.from(c))),!(c instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(c.length===0)return"";for(var f=0,h=0,m=0,g=c.length;m!==g&&c[m]===0;)m++,f++;for(var x=(g-m)*b+1>>>0,T=new Uint8Array(x);m!==g;){for(var $=c[m],M=0,V=x-1;($!==0||M<h)&&V!==-1;V--,M++)$+=256*T[V]>>>0,T[V]=$%u>>>0,$=$/u>>>0;if($!==0)throw new Error("Non-zero carry");h=M,m++}for(var H=x-h;H!==x&&T[H]===0;)H++;for(var kt=d.repeat(f);H<x;++H)kt+=r.charAt(T[H]);return kt}function p(c){if(typeof c!="string")throw new TypeError("Expected String");if(c.length===0)return new Uint8Array;var f=0;if(c[f]!==" "){for(var h=0,m=0;c[f]===d;)h++,f++;for(var g=(c.length-f)*l+1>>>0,x=new Uint8Array(g);c[f];){var T=e[c.charCodeAt(f)];if(T===255)return;for(var $=0,M=g-1;(T!==0||$<m)&&M!==-1;M--,$++)T+=u*x[M]>>>0,x[M]=T%256>>>0,T=T/256>>>0;if(T!==0)throw new Error("Non-zero carry");m=$,f++}if(c[f]!==" "){for(var V=g-m;V!==g&&x[V]===0;)V++;for(var H=new Uint8Array(h+(g-V)),kt=h;V!==g;)H[kt++]=x[V++];return H}}}function s(c){var f=p(c);if(f)return f;throw new Error(`Non-${t} character`)}return{encode:w,decodeUnsafe:p,decode:s}}var co=ao,uo=co,Dr=uo;var fa=new Uint8Array(0);var Rr=(r,t)=>{if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0},J=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")};var Fr=r=>new TextEncoder().encode(r),Tr=r=>new TextDecoder().decode(r);var pe=class{constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},me=class{constructor(t,e,n){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return Ur(this,t)}},ge=class{constructor(t){this.decoders=t}or(t){return Ur(this,t)}decode(t){let e=t[0],n=this.decoders[e];if(n)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},Ur=(r,t)=>new ge({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),we=class{constructor(t,e,n,o){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=o,this.encoder=new pe(t,e,n),this.decoder=new me(t,e,o)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}},ht=({name:r,prefix:t,encode:e,decode:n})=>new we(r,t,e,n),Y=({prefix:r,name:t,alphabet:e})=>{let{encode:n,decode:o}=Dr(e,t);return ht({prefix:r,name:t,encode:n,decode:i=>J(o(i))})},ho=(r,t,e,n)=>{let o={};for(let b=0;b<t.length;++b)o[t[b]]=b;let i=r.length;for(;r[i-1]==="=";)--i;let a=new Uint8Array(i*e/8|0),u=0,d=0,l=0;for(let b=0;b<i;++b){let w=o[r[b]];if(w===void 0)throw new SyntaxError(`Non-${n} character`);d=d<<e|w,u+=e,u>=8&&(u-=8,a[l++]=255&d>>u)}if(u>=e||255&d<<8-u)throw new SyntaxError("Unexpected end of data");return a},fo=(r,t,e)=>{let n=t[t.length-1]==="=",o=(1<<e)-1,i="",a=0,u=0;for(let d=0;d<r.length;++d)for(u=u<<8|r[d],a+=8;a>e;)a-=e,i+=t[o&u>>a];if(a&&(i+=t[o&u<<e-a]),n)for(;i.length*e&7;)i+="=";return i},A=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>ht({prefix:t,name:r,encode(o){return fo(o,n,e)},decode(o){return ho(o,n,e,r)}});var P=Y({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),lo=Y({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var xe={};k(xe,{base32:()=>K,base32hex:()=>wo,base32hexpad:()=>xo,base32hexpadupper:()=>yo,base32hexupper:()=>bo,base32pad:()=>mo,base32padupper:()=>go,base32upper:()=>po,base32z:()=>Io});var K=A({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),po=A({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),mo=A({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),go=A({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),wo=A({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),bo=A({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),xo=A({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),yo=A({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Io=A({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Ao=Mr,$r=128,Eo=127,vo=~Eo,So=Math.pow(2,31);function Mr(r,t,e){t=t||[],e=e||0;for(var n=e;r>=So;)t[e++]=r&255|$r,r/=128;for(;r&vo;)t[e++]=r&255|$r,r>>>=7;return t[e]=r|0,Mr.bytes=e-n+1,t}var Lo=ye,Po=128,kr=127;function ye(r,n){var e=0,n=n||0,o=0,i=n,a,u=r.length;do{if(i>=u)throw ye.bytes=0,new RangeError("Could not decode varint");a=r[i++],e+=o<28?(a&kr)<<o:(a&kr)*Math.pow(2,o),o+=7}while(a>=Po);return ye.bytes=i-n,e}var No=Math.pow(2,7),Do=Math.pow(2,14),Ro=Math.pow(2,21),Fo=Math.pow(2,28),To=Math.pow(2,35),Co=Math.pow(2,42),Uo=Math.pow(2,49),$o=Math.pow(2,56),ko=Math.pow(2,63),Mo=function(r){return r<No?1:r<Do?2:r<Ro?3:r<Fo?4:r<To?5:r<Co?6:r<Uo?7:r<$o?8:r<ko?9:10},Bo={encode:Ao,decode:Lo,encodingLength:Mo},Oo=Bo,At=Oo;var Et=(r,t=0)=>[At.decode(r,t),At.decode.bytes],ft=(r,t,e=0)=>(At.encode(r,t,e),t),lt=r=>At.encodingLength(r);var st=(r,t)=>{let e=t.byteLength,n=lt(r),o=n+lt(e),i=new Uint8Array(o+e);return ft(r,i,0),ft(e,i,n),i.set(t,o),new dt(r,e,t,i)},_t=r=>{let t=J(r),[e,n]=Et(t),[o,i]=Et(t.subarray(n)),a=t.subarray(n+i);if(a.byteLength!==o)throw new Error("Incorrect length");return new dt(e,o,a,t)},Br=(r,t)=>{if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&Rr(r.bytes,e.bytes)}},dt=class{constructor(t,e,n,o){this.code=t,this.size=e,this.digest=n,this.bytes=o}};var Or=(r,t)=>{let{bytes:e,version:n}=r;switch(n){case 0:return Vo(e,Ie(r),t||P.encoder);default:return zo(e,Ie(r),t||K.encoder)}};var _r=new WeakMap,Ie=r=>{let t=_r.get(r);if(t==null){let e=new Map;return _r.set(r,e),e}return t},tt=class r{constructor(t,e,n,o){this.code=e,this.version=t,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:t,multihash:e}=this;if(t!==vt)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==jo)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(e)}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:t,digest:e}=this.multihash,n=st(t,e);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(t){return r.equals(this,t)}static equals(t,e){let n=e;return n&&t.code===n.code&&t.version===n.version&&Br(t.multihash,n.multihash)}toString(t){return Or(this,t)}toJSON(){return{"/":Or(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let e=t;if(e instanceof r)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:n,code:o,multihash:i,bytes:a}=e;return new r(n,o,i,a||Vr(n,o,i.bytes))}else if(e[Go]===!0){let{version:n,multihash:o,code:i}=e,a=_t(o);return r.create(n,i,a)}else return null}static create(t,e,n){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==vt)throw new Error(`Version 0 CID must use dag-pb (code: ${vt}) block encoding`);return new r(t,e,n,n.bytes)}case 1:{let o=Vr(t,e,n.bytes);return new r(t,e,n,o)}default:throw new Error("Invalid version")}}static createV0(t){return r.create(0,vt,t)}static createV1(t,e){return r.create(1,t,e)}static decode(t){let[e,n]=r.decodeFirst(t);if(n.length)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=r.inspectBytes(t),n=e.size-e.multihashSize,o=J(t.subarray(n,n+e.multihashSize));if(o.byteLength!==e.multihashSize)throw new Error("Incorrect length");let i=o.subarray(e.multihashSize-e.digestSize),a=new dt(e.multihashCode,e.digestSize,i,o);return[e.version===0?r.createV0(a):r.createV1(e.codec,a),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[w,p]=Et(t.subarray(e));return e+=p,w},o=n(),i=vt;if(o===18?(o=0,e=0):i=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let a=e,u=n(),d=n(),l=e+d,b=l-a;return{version:o,codec:i,multihashCode:u,digestSize:d,multihashSize:b,size:l}}static parse(t,e){let[n,o]=_o(t,e),i=r.decode(o);if(i.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Ie(i).set(n,t),i}},_o=(r,t)=>{switch(r[0]){case"Q":{let e=t||P;return[P.prefix,e.decode(`${P.prefix}${r}`)]}case P.prefix:{let e=t||P;return[P.prefix,e.decode(r)]}case K.prefix:{let e=t||K;return[K.prefix,e.decode(r)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],t.decode(r)]}}},Vo=(r,t,e)=>{let{prefix:n}=e;if(n!==P.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let o=t.get(n);if(o==null){let i=e.encode(r).slice(1);return t.set(n,i),i}else return o},zo=(r,t,e)=>{let{prefix:n}=e,o=t.get(n);if(o==null){let i=e.encode(r);return t.set(n,i),i}else return o},vt=112,jo=18,Vr=(r,t,e)=>{let n=lt(r),o=n+lt(t),i=new Uint8Array(o+e.byteLength);return ft(r,i,0),ft(t,i,n),i.set(e,o),i},Go=Symbol.for("@ipld/js-cid/CID");function Vt(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}var Ae={};k(Ae,{base10:()=>Wo});var Wo=Y({prefix:"9",name:"base10",alphabet:"0123456789"});var Ee={};k(Ee,{base16:()=>qo,base16upper:()=>Xo});var qo=A({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Xo=A({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var ve={};k(ve,{base2:()=>Ho});var Ho=A({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Se={};k(Se,{base256emoji:()=>Yo});var zr=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Qo=zr.reduce((r,t,e)=>(r[e]=t,r),[]),Jo=zr.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function Ko(r){return r.reduce((t,e)=>(t+=Qo[e],t),"")}function Zo(r){let t=[];for(let e of r){let n=Jo[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}var Yo=ht({prefix:"\u{1F680}",name:"base256emoji",encode:Ko,decode:Zo});var Le={};k(Le,{base36:()=>ti,base36upper:()=>ei});var ti=Y({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),ei=Y({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Ne={};k(Ne,{base64:()=>ri,base64pad:()=>ni,base64url:()=>Pe,base64urlpad:()=>oi});var ri=A({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),ni=A({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Pe=A({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),oi=A({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var De={};k(De,{base8:()=>ii});var ii=A({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Re={};k(Re,{identity:()=>si});var si=ht({prefix:"\0",name:"identity",encode:r=>Tr(r),decode:r=>Fr(r)});var $a=new TextEncoder,ka=new TextDecoder;var Fe={};k(Fe,{identity:()=>fi});var jr=0,ui="identity",Gr=J,hi=r=>st(jr,Gr(r)),fi={code:jr,name:ui,encode:Gr,digest:hi};var Ue={};k(Ue,{sha256:()=>li,sha512:()=>di});var Ce=({name:r,code:t,encode:e})=>new Te(r,t,e),Te=class{constructor(t,e,n){this.name=t,this.code=e,this.encode=n}digest(t){if(t instanceof Uint8Array){let e=this.encode(t);return e instanceof Uint8Array?st(this.code,e):e.then(n=>st(this.code,n))}else throw Error("Unknown type, must be binary type")}};var qr=r=>async t=>new Uint8Array(await crypto.subtle.digest(r,t)),li=Ce({name:"sha2-256",code:18,encode:qr("SHA-256")}),di=Ce({name:"sha2-512",code:19,encode:qr("SHA-512")});var St={...Re,...ve,...De,...Ae,...Ee,...xe,...Le,...be,...Ne,...Se},Ga={...Ue,...Fe};function et(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function Z(r=0){return globalThis.Buffer?.alloc!=null?et(globalThis.Buffer.alloc(r)):new Uint8Array(r)}function N(r=0){return globalThis.Buffer?.allocUnsafe!=null?et(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Hr(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var Xr=Hr("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),$e=Hr("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);let t=N(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),pi={utf8:Xr,"utf-8":Xr,hex:St.base16,latin1:$e,ascii:$e,binary:$e,...St},zt=pi;function C(r,t="utf8"){let e=zt[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):e.encoder.encode(r).substring(1)}var mi=Math.pow(2,7),gi=Math.pow(2,14),wi=Math.pow(2,21),ke=Math.pow(2,28),Me=Math.pow(2,35),Be=Math.pow(2,42),Oe=Math.pow(2,49),y=128,D=127;function R(r){if(r<mi)return 1;if(r<gi)return 2;if(r<wi)return 3;if(r<ke)return 4;if(r<Me)return 5;if(r<Be)return 6;if(r<Oe)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function bi(r,t,e=0){switch(R(r)){case 8:t[e++]=r&255|y,r/=128;case 7:t[e++]=r&255|y,r/=128;case 6:t[e++]=r&255|y,r/=128;case 5:t[e++]=r&255|y,r/=128;case 4:t[e++]=r&255|y,r>>>=7;case 3:t[e++]=r&255|y,r>>>=7;case 2:t[e++]=r&255|y,r>>>=7;case 1:{t[e++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return t}function xi(r,t,e=0){switch(R(r)){case 8:t.set(e++,r&255|y),r/=128;case 7:t.set(e++,r&255|y),r/=128;case 6:t.set(e++,r&255|y),r/=128;case 5:t.set(e++,r&255|y),r/=128;case 4:t.set(e++,r&255|y),r>>>=7;case 3:t.set(e++,r&255|y),r>>>=7;case 2:t.set(e++,r&255|y),r>>>=7;case 1:{t.set(e++,r&255),r>>>=7;break}default:throw new Error("unreachable")}return t}function yi(r,t){let e=r[t],n=0;if(n+=e&D,e<y||(e=r[t+1],n+=(e&D)<<7,e<y)||(e=r[t+2],n+=(e&D)<<14,e<y)||(e=r[t+3],n+=(e&D)<<21,e<y)||(e=r[t+4],n+=(e&D)*ke,e<y)||(e=r[t+5],n+=(e&D)*Me,e<y)||(e=r[t+6],n+=(e&D)*Be,e<y)||(e=r[t+7],n+=(e&D)*Oe,e<y))return n;throw new RangeError("Could not decode varint")}function Ii(r,t){let e=r.get(t),n=0;if(n+=e&D,e<y||(e=r.get(t+1),n+=(e&D)<<7,e<y)||(e=r.get(t+2),n+=(e&D)<<14,e<y)||(e=r.get(t+3),n+=(e&D)<<21,e<y)||(e=r.get(t+4),n+=(e&D)*ke,e<y)||(e=r.get(t+5),n+=(e&D)*Me,e<y)||(e=r.get(t+6),n+=(e&D)*Be,e<y)||(e=r.get(t+7),n+=(e&D)*Oe,e<y))return n;throw new RangeError("Could not decode varint")}function rt(r,t,e=0){return t==null&&(t=N(R(r))),t instanceof Uint8Array?bi(r,t,e):xi(r,t,e)}function z(r,t=0){return r instanceof Uint8Array?yi(r,t):Ii(r,t)}function B(r,t){if(globalThis.Buffer!=null)return et(globalThis.Buffer.concat(r,t));t==null&&(t=r.reduce((o,i)=>o+i.length,0));let e=N(t),n=0;for(let o of r)e.set(o,n),n+=o.length;return et(e)}var jt=class{index=0;input="";new(t){return this.index=0,this.input=t,this}readAtomically(t){let e=this.index,n=t();return n===void 0&&(this.index=e),n}parseWith(t){let e=t();if(this.index===this.input.length)return e}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(t){return this.readAtomically(()=>{let e=this.readChar();if(e===t)return e})}readSeparator(t,e,n){return this.readAtomically(()=>{if(!(e>0&&this.readGivenChar(t)===void 0))return n()})}readNumber(t,e,n,o){return this.readAtomically(()=>{let i=0,a=0,u=this.peekChar();if(u===void 0)return;let d=u==="0",l=2**(8*o)-1;for(;;){let b=this.readAtomically(()=>{let w=this.readChar();if(w===void 0)return;let p=Number.parseInt(w,t);if(!Number.isNaN(p))return p});if(b===void 0)break;if(i*=t,i+=b,i>l||(a+=1,e!==void 0&&a>e))return}if(a!==0)return!n&&d&&a>1?void 0:i})}readIPv4Addr(){return this.readAtomically(()=>{let t=new Uint8Array(4);for(let e=0;e<t.length;e++){let n=this.readSeparator(".",e,()=>this.readNumber(10,3,!1,1));if(n===void 0)return;t[e]=n}return t})}readIPv6Addr(){let t=e=>{for(let n=0;n<e.length/2;n++){let o=n*2;if(n<e.length-3){let a=this.readSeparator(":",n,()=>this.readIPv4Addr());if(a!==void 0)return e[o]=a[0],e[o+1]=a[1],e[o+2]=a[2],e[o+3]=a[3],[o+4,!0]}let i=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(i===void 0)return[o,!1];e[o]=i>>8,e[o+1]=i&255}return[e.length,!1]};return this.readAtomically(()=>{let e=new Uint8Array(16),[n,o]=t(e);if(n===16)return e;if(o||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let i=new Uint8Array(14),a=16-(n+2),[u]=t(i.subarray(0,a));return e.set(i.subarray(0,u),16-u),e})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var Qr=45,Ai=15,mt=new jt;function _e(r){if(!(r.length>Ai))return mt.new(r).parseWith(()=>mt.readIPv4Addr())}function Ve(r){if(r.includes("%")&&(r=r.split("%")[0]),!(r.length>Qr))return mt.new(r).parseWith(()=>mt.readIPv6Addr())}function Gt(r){if(r.includes("%")&&(r=r.split("%")[0]),!(r.length>Qr))return mt.new(r).parseWith(()=>mt.readIPAddr())}var dc=parseInt("0xFFFF",16),pc=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);function Pt(r,t="utf8"){let e=zt[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?et(globalThis.Buffer.from(r,"utf-8")):e.decoder.decode(`${e.prefix}${r}`)}function Wt(r){return!!_e(r)}function qt(r){return!!Ve(r)}function gt(r){return!!Gt(r)}var Zr=Wt,Pi=qt,ze=function(r){let t=0;if(r=r.toString().trim(),Zr(r)){let e=new Uint8Array(t+4);return r.split(/\./g).forEach(n=>{e[t++]=parseInt(n,10)&255}),e}if(Pi(r)){let e=r.split(":",8),n;for(n=0;n<e.length;n++){let i=Zr(e[n]),a;i&&(a=ze(e[n]),e[n]=C(a.slice(0,2),"base16")),a!=null&&++n<8&&e.splice(n,0,C(a.slice(2,4),"base16"))}if(e[0]==="")for(;e.length<8;)e.unshift("0");else if(e[e.length-1]==="")for(;e.length<8;)e.push("0");else if(e.length<8){for(n=0;n<e.length&&e[n]!=="";n++);let i=[n,1];for(n=9-e.length;n>0;n--)i.push("0");e.splice.apply(e,i)}let o=new Uint8Array(t+16);for(n=0;n<e.length;n++){let i=parseInt(e[n],16);o[t++]=i>>8&255,o[t++]=i&255}return o}throw new Error("invalid ip address")},Yr=function(r,t=0,e){t=~~t,e=e??r.length-t;let n=new DataView(r.buffer);if(e===4){let o=[];for(let i=0;i<e;i++)o.push(r[t+i]);return o.join(".")}if(e===16){let o=[];for(let i=0;i<e;i+=2)o.push(n.getUint16(t+i).toString(16));return o.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var wt={},je={},Di=[[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"]];Di.forEach(r=>{let t=Ri(...r);je[t.code]=t,wt[t.name]=t});function Ri(r,t,e,n,o){return{code:r,size:t,name:e,resolvable:!!n,path:!!o}}function I(r){if(typeof r=="number"){if(je[r]!=null)return je[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(wt[r]!=null)return wt[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var tu=I("ip4"),eu=I("ip6"),ru=I("ipcidr");function We(r,t){switch(I(r).code){case 4:case 41:return Ti(t);case 42:return rn(t);case 6:case 273:case 33:case 132:return on(t).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return rn(t);case 421:return ki(t);case 444:return nn(t);case 445:return nn(t);case 466:return $i(t);default:return C(t,"base16")}}function qe(r,t){switch(I(r).code){case 4:return tn(t);case 41:return tn(t);case 42:return en(t);case 6:case 273:case 33:case 132:return Xe(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return en(t);case 421:return Ci(t);case 444:return Mi(t);case 445:return Bi(t);case 466:return Ui(t);default:return Pt(t,"base16")}}var Ge=Object.values(St).map(r=>r.decoder),Fi=function(){let r=Ge[0].or(Ge[1]);return Ge.slice(2).forEach(t=>r=r.or(t)),r}();function tn(r){if(!gt(r))throw new Error("invalid ip address");return ze(r)}function Ti(r){let t=Yr(r,0,r.length);if(t==null)throw new Error("ipBuff is required");if(!gt(t))throw new Error("invalid ip address");return t}function Xe(r){let t=new ArrayBuffer(2);return new DataView(t).setUint16(0,r),new Uint8Array(t)}function on(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function en(r){let t=Pt(r),e=Uint8Array.from(rt(t.length));return B([e,t],e.length+t.length)}function rn(r){let t=z(r);if(r=r.slice(R(t)),r.length!==t)throw new Error("inconsistent lengths");return C(r)}function Ci(r){let t;r[0]==="Q"||r[0]==="1"?t=_t(P.decode(`z${r}`)).bytes:t=tt.parse(r).multihash.bytes;let e=Uint8Array.from(rt(t.length));return B([e,t],e.length+t.length)}function Ui(r){let t=Fi.decode(r),e=Uint8Array.from(rt(t.length));return B([e,t],e.length+t.length)}function $i(r){let t=z(r),e=r.slice(R(t));if(e.length!==t)throw new Error("inconsistent lengths");return"u"+C(e,"base64url")}function ki(r){let t=z(r),e=r.slice(R(t));if(e.length!==t)throw new Error("inconsistent lengths");return C(e,"base58btc")}function Mi(r){let t=r.split(":");if(t.length!==2)throw new Error(`failed to parse onion addr: ["'${t.join('", "')}'"]' does not contain a port number`);if(t[0].length!==16)throw new Error(`failed to parse onion addr: ${t[0]} not a Tor onion address.`);let e=K.decode("b"+t[0]),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=Xe(n);return B([e,o],e.length+o.length)}function Bi(r){let t=r.split(":");if(t.length!==2)throw new Error(`failed to parse onion addr: ["'${t.join('", "')}'"]' does not contain a port number`);if(t[0].length!==56)throw new Error(`failed to parse onion addr: ${t[0]} not a Tor onion3 address.`);let e=K.decode(`b${t[0]}`),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=Xe(n);return B([e,o],e.length+o.length)}function nn(r){let t=r.slice(0,r.length-2),e=r.slice(r.length-2),n=C(t,"base32"),o=on(e);return`${n}:${o}`}function sn(r){r=He(r);let t=[],e=[],n=null,o=r.split("/").slice(1);if(o.length===1&&o[0]==="")return{bytes:new Uint8Array,string:"/",tuples:[],stringTuples:[],path:null};for(let i=0;i<o.length;i++){let a=o[i],u=I(a);if(u.size===0){t.push([u.code]),e.push([u.code]);continue}if(i++,i>=o.length)throw cn("invalid address: "+r);if(u.path===!0){n=He(o.slice(i).join("/")),t.push([u.code,qe(u.code,n)]),e.push([u.code,n]);break}let d=qe(u.code,o[i]);t.push([u.code,d]),e.push([u.code,We(u.code,d)])}return{string:an(e),bytes:Je(t),tuples:t,stringTuples:e,path:n}}function Qe(r){let t=[],e=[],n=null,o=0;for(;o<r.length;){let i=z(r,o),a=R(i),u=I(i),d=Oi(u,r.slice(o+a));if(d===0){t.push([i]),e.push([i]),o+=a;continue}let l=r.slice(o+a,o+a+d);if(o+=d+a,o>r.length)throw cn("Invalid address Uint8Array: "+C(r,"base16"));t.push([i,l]);let b=We(i,l);if(e.push([i,b]),u.path===!0){n=b;break}}return{bytes:Uint8Array.from(r),string:an(e),tuples:t,stringTuples:e,path:n}}function an(r){let t=[];return r.map(e=>{let n=I(e[0]);return t.push(n.name),e.length>1&&e[1]!=null&&t.push(e[1]),null}),He(t.join("/"))}function Je(r){return B(r.map(t=>{let e=I(t[0]),n=Uint8Array.from(rt(e.code));return t.length>1&&t[1]!=null&&(n=B([n,t[1]])),n}))}function Oi(r,t){if(r.size>0)return r.size/8;if(r.size===0)return 0;{let e=z(t instanceof Uint8Array?t:Uint8Array.from(t));return e+R(e)}}function He(r){return"/"+r.trim().split("/").filter(t=>t).join("/")}function cn(r){return new Error("Error parsing address: "+r)}var _i=Symbol.for("nodejs.util.inspect.custom"),Ke=Symbol.for("@multiformats/js-multiaddr/multiaddr"),Vi=[I("dns").code,I("dns4").code,I("dns6").code,I("dnsaddr").code],Xt=class r{bytes;#e;#t;#r;#n;[Ke]=!0;constructor(t){t==null&&(t="");let e;if(t instanceof Uint8Array)e=Qe(t);else if(typeof t=="string"){if(t.length>0&&t.charAt(0)!=="/")throw new Error(`multiaddr "${t}" must start with a "/"`);e=sn(t)}else if(hn(t))e=Qe(t.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=e.bytes,this.#e=e.string,this.#t=e.tuples,this.#r=e.stringTuples,this.#n=e.path}toString(){return this.#e}toJSON(){return this.toString()}toOptions(){let t,e,n,o,i="",a=I("tcp"),u=I("udp"),d=I("ip4"),l=I("ip6"),b=I("dns6"),w=I("ip6zone");for(let[s,c]of this.stringTuples())s===w.code&&(i=`%${c??""}`),Vi.includes(s)&&(e=a.name,o=443,n=`${c??""}${i}`,t=s===b.code?6:4),(s===a.code||s===u.code)&&(e=I(s).name,o=parseInt(c??"")),(s===d.code||s===l.code)&&(e=I(s).name,n=`${c??""}${i}`,t=s===l.code?6:4);if(t==null||e==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:t,host:n,transport:e,port:o}}protos(){return this.#t.map(([t])=>Object.assign({},I(t)))}protoCodes(){return this.#t.map(([t])=>t)}protoNames(){return this.#t.map(([t])=>I(t).name)}tuples(){return this.#t}stringTuples(){return this.#r}encapsulate(t){return t=new r(t),new r(this.toString()+t.toString())}decapsulate(t){let e=t.toString(),n=this.toString(),o=n.lastIndexOf(e);if(o<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${t.toString()}`);return new r(n.slice(0,o))}decapsulateCode(t){let e=this.tuples();for(let n=e.length-1;n>=0;n--)if(e[n][0]===t)return new r(Je(e.slice(0,n)));return this}getPeerId(){try{let t=[];this.stringTuples().forEach(([n,o])=>{n===wt.p2p.code&&t.push([n,o]),n===wt["p2p-circuit"].code&&(t=[])});let e=t.pop();if(e?.[1]!=null){let n=e[1];return n[0]==="Q"||n[0]==="1"?C(P.decode(`z${n}`),"base58btc"):C(tt.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return this.#n}equals(t){return Vt(this.bytes,t.bytes)}async resolve(t){let e=this.protos().find(i=>i.resolvable);if(e==null)return[this];let n=un.get(e.name);if(n==null)throw new Bt(`no available resolver for ${e.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,t)).map(i=>new r(i))}nodeAddress(){let t=this.toOptions();if(t.transport!=="tcp"&&t.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${t.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:t.family,address:t.host,port:t.port}}isThinWaistAddress(t){let e=(t??this).protos();return!(e.length!==2||e[0].code!==4&&e[0].code!==41||e[1].code!==6&&e[1].code!==273)}[_i](){return`Multiaddr(${this.#e})`}};var un=new Map;function hn(r){return!!r?.[Ke]}function Ze(r){return new Xt(r)}var fn=()=>{let r=new Error("Delay aborted");return r.name="AbortError",r},zi=new WeakMap;function ji({clearTimeout:r,setTimeout:t}={}){return(e,{value:n,signal:o}={})=>{if(o?.aborted)return Promise.reject(fn());let i,a,u,d=r??clearTimeout,l=()=>{d(i),u(fn())},b=()=>{o&&o.removeEventListener("abort",l)},w=new Promise((p,s)=>{a=()=>{b(),p(n)},u=s,i=(t??setTimeout)(a,e)});return o&&o.addEventListener("abort",l,{once:!0}),zi.set(w,()=>{d(i),i=null,a()}),w}}var Gi=ji(),ln=Gi;var pn=Symbol.for("@achingbrain/uint8arraylist");function dn(r,t){if(t==null||t<0)throw new RangeError("index is out of bounds");let e=0;for(let n of r){let o=e+n.byteLength;if(t<o)return{buf:n,index:t-e};e=o}throw new RangeError("index is out of bounds")}function Ht(r){return!!r?.[pn]}var O=class r{bufs;length;[pn]=!0;constructor(...t){this.bufs=[],this.length=0,t.length>0&&this.appendAll(t)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...t){this.appendAll(t)}appendAll(t){let e=0;for(let n of t)if(n instanceof Uint8Array)e+=n.byteLength,this.bufs.push(n);else if(Ht(n))e+=n.byteLength,this.bufs.push(...n.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=e}prepend(...t){this.prependAll(t)}prependAll(t){let e=0;for(let n of t.reverse())if(n instanceof Uint8Array)e+=n.byteLength,this.bufs.unshift(n);else if(Ht(n))e+=n.byteLength,this.bufs.unshift(...n.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=e}get(t){let e=dn(this.bufs,t);return e.buf[e.index]}set(t,e){let n=dn(this.bufs,t);n.buf[n.index]=e}write(t,e=0){if(t instanceof Uint8Array)for(let n=0;n<t.length;n++)this.set(e+n,t[n]);else if(Ht(t))for(let n=0;n<t.length;n++)this.set(e+n,t.get(n));else throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList")}consume(t){if(t=Math.trunc(t),!(Number.isNaN(t)||t<=0)){if(t===this.byteLength){this.bufs=[],this.length=0;return}for(;this.bufs.length>0;)if(t>=this.bufs[0].byteLength)t-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(t),this.length-=t;break}}}slice(t,e){let{bufs:n,length:o}=this._subList(t,e);return B(n,o)}subarray(t,e){let{bufs:n,length:o}=this._subList(t,e);return n.length===1?n[0]:B(n,o)}sublist(t,e){let{bufs:n,length:o}=this._subList(t,e),i=new r;return i.length=o,i.bufs=[...n],i}_subList(t,e){if(t=t??0,e=e??this.length,t<0&&(t=this.length+t),e<0&&(e=this.length+e),t<0||e>this.length)throw new RangeError("index is out of bounds");if(t===e)return{bufs:[],length:0};if(t===0&&e===this.length)return{bufs:this.bufs,length:this.length};let n=[],o=0;for(let i=0;i<this.bufs.length;i++){let a=this.bufs[i],u=o,d=u+a.byteLength;if(o=d,t>=d)continue;let l=t>=u&&t<d,b=e>u&&e<=d;if(l&&b){if(t===u&&e===d){n.push(a);break}let w=t-u;n.push(a.subarray(w,w+(e-t)));break}if(l){if(t===0){n.push(a);continue}n.push(a.subarray(t-u));continue}if(b){if(e===d){n.push(a);break}n.push(a.subarray(0,e-u));break}n.push(a)}return{bufs:n,length:e-t}}indexOf(t,e=0){if(!Ht(t)&&!(t instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');let n=t instanceof Uint8Array?t:t.subarray();if(e=Number(e??0),isNaN(e)&&(e=0),e<0&&(e=this.length+e),e<0&&(e=0),t.length===0)return e>this.length?this.length:e;let o=n.byteLength;if(o===0)throw new TypeError("search must be at least 1 byte long");let i=256,a=new Int32Array(i);for(let w=0;w<i;w++)a[w]=-1;for(let w=0;w<o;w++)a[n[w]]=w;let u=a,d=this.byteLength-n.byteLength,l=n.byteLength-1,b;for(let w=e;w<=d;w+=b){b=0;for(let p=l;p>=0;p--){let s=this.get(w+p);if(n[p]!==s){b=Math.max(1,p-u[s]);break}}if(b===0)return w}return-1}getInt8(t){let e=this.subarray(t,t+1);return new DataView(e.buffer,e.byteOffset,e.byteLength).getInt8(0)}setInt8(t,e){let n=N(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt8(0,e),this.write(n,t)}getInt16(t,e){let n=this.subarray(t,t+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt16(0,e)}setInt16(t,e,n){let o=Z(2);new DataView(o.buffer,o.byteOffset,o.byteLength).setInt16(0,e,n),this.write(o,t)}getInt32(t,e){let n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt32(0,e)}setInt32(t,e,n){let o=Z(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setInt32(0,e,n),this.write(o,t)}getBigInt64(t,e){let n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigInt64(0,e)}setBigInt64(t,e,n){let o=Z(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setBigInt64(0,e,n),this.write(o,t)}getUint8(t){let e=this.subarray(t,t+1);return new DataView(e.buffer,e.byteOffset,e.byteLength).getUint8(0)}setUint8(t,e){let n=N(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint8(0,e),this.write(n,t)}getUint16(t,e){let n=this.subarray(t,t+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint16(0,e)}setUint16(t,e,n){let o=Z(2);new DataView(o.buffer,o.byteOffset,o.byteLength).setUint16(0,e,n),this.write(o,t)}getUint32(t,e){let n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint32(0,e)}setUint32(t,e,n){let o=Z(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setUint32(0,e,n),this.write(o,t)}getBigUint64(t,e){let n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigUint64(0,e)}setBigUint64(t,e,n){let o=Z(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setBigUint64(0,e,n),this.write(o,t)}getFloat32(t,e){let n=this.subarray(t,t+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat32(0,e)}setFloat32(t,e,n){let o=Z(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setFloat32(0,e,n),this.write(o,t)}getFloat64(t,e){let n=this.subarray(t,t+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat64(0,e)}setFloat64(t,e,n){let o=Z(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setFloat64(0,e,n),this.write(o,t)}equals(t){if(t==null||!(t instanceof r)||t.bufs.length!==this.bufs.length)return!1;for(let e=0;e<this.bufs.length;e++)if(!Vt(this.bufs[e],t.bufs[e]))return!1;return!0}static fromUint8Arrays(t,e){let n=new r;return n.bufs=t,e==null&&(e=t.reduce((o,i)=>o+i.byteLength,0)),n.length=e,n}};function bt(){let r={};return r.promise=new Promise((t,e)=>{r.resolve=t,r.reject=e}),r}var Qt=class extends Error{type;code;constructor(t,e){super(t??"The operation was aborted"),this.type="aborted",this.name="AbortError",this.code=e??"ABORT_ERR"}};async function mn(r,t,e){if(t==null)return r;if(t.aborted)return Promise.reject(new Qt(e?.errorMessage,e?.errorCode));let n,o=new Qt(e?.errorMessage,e?.errorCode);try{return await Promise.race([r,new Promise((i,a)=>{n=()=>{a(o)},t.addEventListener("abort",n)})])}finally{n!=null&&t.removeEventListener("abort",n)}}var Ye=class{needNext;haveNext;ended;nextResult;constructor(){this.ended=!1,this.needNext=bt(),this.needNext.resolve(),this.haveNext=bt()}[Symbol.asyncIterator](){return this}async next(){if(this.nextResult==null&&await this.haveNext.promise,this.nextResult==null)throw new Error("Have next but next was undefined");let t=this.nextResult;return this.nextResult=void 0,this.needNext.resolve(),this.needNext=bt(),t}async throw(t){return this.ended=!0,t!=null&&this.haveNext.reject(t),{done:!0,value:void 0}}async return(){let t={done:!0,value:void 0};return await this._push(void 0),t}async push(t,e){await this._push(t,e)}async end(t,e){t!=null?await this.throw(t):await this._push(void 0,e)}async _push(t,e){if(t!=null&&this.ended)throw new Error("Cannot push value onto an ended pushable");this.nextResult!=null&&await this.needNext.promise,t!=null?this.nextResult={done:!1,value:t}:(this.ended=!0,this.nextResult={done:!0,value:void 0}),this.haveNext.resolve(),this.haveNext=bt(),await mn(this.needNext.promise,e?.signal,e)}};function gn(){return new Ye}var Jt=class extends Error{code;constructor(t,e){super(t),this.code=e}},tr=class extends Jt{type;constructor(t){super(t,"ABORT_ERR"),this.type="aborted"}};function wn(r,t){let e=gn();r.sink(e).catch(async a=>{await e.end(a)}),r.sink=async a=>{for await(let u of a)await e.push(u);await e.end()};let n=r.source;r.source[Symbol.iterator]!=null?n=r.source[Symbol.iterator]():r.source[Symbol.asyncIterator]!=null&&(n=r.source[Symbol.asyncIterator]());let o=new O;return{read:async(a,u)=>{u?.signal?.throwIfAborted();let d,l=new Promise((b,w)=>{d=()=>{w(new tr("Read aborted"))},u?.signal?.addEventListener("abort",d)});try{if(a==null){let{done:w,value:p}=await Promise.race([n.next(),l]);return w===!0?new O:p}for(;o.byteLength<a;){let{value:w,done:p}=await Promise.race([n.next(),l]);if(p===!0)throw new Jt("unexpected end of input","ERR_UNEXPECTED_EOF");o.append(w)}let b=o.sublist(0,a);return o.consume(a),b}finally{d!=null&&u?.signal?.removeEventListener("abort",d)}},write:async(a,u)=>{u?.signal?.throwIfAborted(),a instanceof Uint8Array?await e.push(a,u):await e.push(a.subarray(),u)},unwrap:()=>{if(o.byteLength>0){let a=r.source;r.source=async function*(){t?.yieldBytes===!1?yield o:yield*o,yield*a}()}return r}}}function Kt(r){return r[Symbol.asyncIterator]!=null}var Zt=r=>{let t=R(r),e=N(t);return rt(r,e),Zt.bytes=t,e};Zt.bytes=0;function Nt(r,t){t=t??{};let e=t.lengthEncoder??Zt;function*n(o){let i=e(o.byteLength);i instanceof Uint8Array?yield i:yield*i,o instanceof Uint8Array?yield o:yield*o}return Kt(r)?async function*(){for await(let o of r)yield*n(o)}():function*(){for(let o of r)yield*n(o)}()}Nt.single=(r,t)=>{t=t??{};let e=t.lengthEncoder??Zt;return new O(e(r.byteLength),r)};var xt=le(yn(),1);var qi=8,Xi=1024*1024*4,at;(function(r){r[r.LENGTH=0]="LENGTH",r[r.DATA=1]="DATA"})(at||(at={}));var rr=r=>{let t=z(r);return rr.bytes=R(t),t};rr.bytes=0;function er(r,t){let e=new O,n=at.LENGTH,o=-1,i=t?.lengthDecoder??rr,a=t?.maxLengthLength??qi,u=t?.maxDataLength??Xi;function*d(){for(;e.byteLength>0;){if(n===at.LENGTH)try{if(o=i(e),o<0)throw(0,xt.default)(new Error("invalid message length"),"ERR_INVALID_MSG_LENGTH");if(o>u)throw(0,xt.default)(new Error("message length too long"),"ERR_MSG_DATA_TOO_LONG");let l=i.bytes;e.consume(l),t?.onLength!=null&&t.onLength(o),n=at.DATA}catch(l){if(l instanceof RangeError){if(e.byteLength>a)throw(0,xt.default)(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG");break}throw l}if(n===at.DATA){if(e.byteLength<o)break;let l=e.sublist(0,o);e.consume(o),t?.onData!=null&&t.onData(l),yield l,n=at.LENGTH}}}return Kt(r)?async function*(){for await(let l of r)e.append(l),yield*d();if(e.byteLength>0)throw(0,xt.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}():function*(){for(let l of r)e.append(l),yield*d();if(e.byteLength>0)throw(0,xt.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}()}er.fromReader=(r,t)=>{let e=1,n=async function*(){for(;;)try{let{done:i,value:a}=await r.next(e);if(i===!0)return;a!=null&&(yield a)}catch(i){if(i.code==="ERR_UNDER_READ")return{done:!0,value:null};throw i}finally{e=1}}();return er(n,{...t??{},onLength:i=>{e=i}})};var Yt=class extends Error{code;constructor(t,e){super(t),this.code=e}},In=r=>z(r);In.bytes=0;function An(r,t={}){let e=wn(r,t);return t.maxDataLength!=null&&t.maxLengthLength==null&&(t.maxLengthLength=R(t.maxDataLength)),{read:async o=>{let i=-1,a=new O,u=t?.lengthDecoder??In;for(;;){a.append(await e.read(1,o));try{i=u(a)}catch(d){if(d instanceof RangeError)continue;throw d}if(t?.maxLengthLength!=null&&a.byteLength>t.maxLengthLength)throw new Yt("message length length too long","ERR_MSG_LENGTH_TOO_LONG");if(i>-1)break}if(t?.maxDataLength!=null&&i>t.maxDataLength)throw new Yt("message length too long","ERR_MSG_DATA_TOO_LONG");return e.read(i,o)},write:async(o,i)=>{await e.write(Nt.single(o,t),i)},writeV:async(o,i)=>{let a=new O(...o.map(u=>Nt.single(u,t)));await e.write(a,i)},unwrap:()=>e.unwrap()}}function nr(r,t){let e=An(r,t),n={read:async(o,i)=>{let a=await e.read(i);return o.decode(a)},write:async(o,i,a)=>{await e.write(i.encode(o),a)},writeV:async(o,i,a)=>{await e.writeV(o.map(u=>i.encode(u)),a)},pb:o=>({read:async i=>n.read(o,i),write:async(i,a)=>n.write(i,o,a),writeV:async(i,a)=>n.writeV(i,o,a),unwrap:()=>n}),unwrap:()=>e.unwrap()};return n}var or=new Float32Array([-0]),nt=new Uint8Array(or.buffer);function En(r,t,e){or[0]=r,t[e]=nt[0],t[e+1]=nt[1],t[e+2]=nt[2],t[e+3]=nt[3]}function vn(r,t){return nt[0]=r[t],nt[1]=r[t+1],nt[2]=r[t+2],nt[3]=r[t+3],or[0]}var ir=new Float64Array([-0]),F=new Uint8Array(ir.buffer);function Sn(r,t,e){ir[0]=r,t[e]=F[0],t[e+1]=F[1],t[e+2]=F[2],t[e+3]=F[3],t[e+4]=F[4],t[e+5]=F[5],t[e+6]=F[6],t[e+7]=F[7]}function Ln(r,t){return F[0]=r[t],F[1]=r[t+1],F[2]=r[t+2],F[3]=r[t+3],F[4]=r[t+4],F[5]=r[t+5],F[6]=r[t+6],F[7]=r[t+7],ir[0]}var Qi=BigInt(Number.MAX_SAFE_INTEGER),Ji=BigInt(Number.MIN_SAFE_INTEGER),U=class r{lo;hi;constructor(t,e){this.lo=t|0,this.hi=e|0}toNumber(t=!1){if(!t&&this.hi>>>31>0){let e=~this.lo+1>>>0,n=~this.hi>>>0;return e===0&&(n=n+1>>>0),-(e+n*4294967296)}return this.lo+this.hi*4294967296}toBigInt(t=!1){if(t)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let e=~this.lo+1>>>0,n=~this.hi>>>0;return e===0&&(n=n+1>>>0),-(BigInt(e)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(t=!1){return this.toBigInt(t).toString()}zzEncode(){let t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this}zzDecode(){let t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this}length(){let t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?e===0?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:n<128?9:10}static fromBigInt(t){if(t===0n)return ct;if(t<Qi&&t>Ji)return this.fromNumber(Number(t));let e=t<0n;e&&(t=-t);let n=t>>32n,o=t-(n<<32n);return e&&(n=~n|0n,o=~o|0n,++o>Pn&&(o=0n,++n>Pn&&(n=0n))),new r(Number(o),Number(n))}static fromNumber(t){if(t===0)return ct;let e=t<0;e&&(t=-t);let n=t>>>0,o=(t-n)/4294967296>>>0;return e&&(o=~o>>>0,n=~n>>>0,++n>4294967295&&(n=0,++o>4294967295&&(o=0))),new r(n,o)}static from(t){return typeof t=="number"?r.fromNumber(t):typeof t=="bigint"?r.fromBigInt(t):typeof t=="string"?r.fromBigInt(BigInt(t)):t.low!=null||t.high!=null?new r(t.low>>>0,t.high>>>0):ct}},ct=new U(0,0);ct.toBigInt=function(){return 0n};ct.zzEncode=ct.zzDecode=function(){return this};ct.length=function(){return 1};var Pn=4294967296n;function Nn(r){let t=0,e=0;for(let n=0;n<r.length;++n)e=r.charCodeAt(n),e<128?t+=1:e<2048?t+=2:(e&64512)===55296&&(r.charCodeAt(n+1)&64512)===56320?(++n,t+=4):t+=3;return t}function Dn(r,t,e){if(e-t<1)return"";let o,i=[],a=0,u;for(;t<e;)u=r[t++],u<128?i[a++]=u:u>191&&u<224?i[a++]=(u&31)<<6|r[t++]&63:u>239&&u<365?(u=((u&7)<<18|(r[t++]&63)<<12|(r[t++]&63)<<6|r[t++]&63)-65536,i[a++]=55296+(u>>10),i[a++]=56320+(u&1023)):i[a++]=(u&15)<<12|(r[t++]&63)<<6|r[t++]&63,a>8191&&((o??(o=[])).push(String.fromCharCode.apply(String,i)),a=0);return o!=null?(a>0&&o.push(String.fromCharCode.apply(String,i.slice(0,a))),o.join("")):String.fromCharCode.apply(String,i.slice(0,a))}function sr(r,t,e){let n=e,o,i;for(let a=0;a<r.length;++a)o=r.charCodeAt(a),o<128?t[e++]=o:o<2048?(t[e++]=o>>6|192,t[e++]=o&63|128):(o&64512)===55296&&((i=r.charCodeAt(a+1))&64512)===56320?(o=65536+((o&1023)<<10)+(i&1023),++a,t[e++]=o>>18|240,t[e++]=o>>12&63|128,t[e++]=o>>6&63|128,t[e++]=o&63|128):(t[e++]=o>>12|224,t[e++]=o>>6&63|128,t[e++]=o&63|128);return e-n}function j(r,t){return RangeError(`index out of range: ${r.pos} + ${t??1} > ${r.len}`)}function te(r,t){return(r[t-4]|r[t-3]<<8|r[t-2]<<16|r[t-1]<<24)>>>0}var ar=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(t){this.buf=t,this.pos=0,this.len=t.length}uint32(){let t=4294967295;if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,j(this,10);return t}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw j(this,4);return te(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw j(this,4);return te(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw j(this,4);let t=vn(this.buf,this.pos);return this.pos+=4,t}double(){if(this.pos+8>this.len)throw j(this,4);let t=Ln(this.buf,this.pos);return this.pos+=8,t}bytes(){let t=this.uint32(),e=this.pos,n=this.pos+t;if(n>this.len)throw j(this,t);return this.pos+=t,e===n?new Uint8Array(0):this.buf.subarray(e,n)}string(){let t=this.bytes();return Dn(t,0,t.length)}skip(t){if(typeof t=="number"){if(this.pos+t>this.len)throw j(this,t);this.pos+=t}else do if(this.pos>=this.len)throw j(this);while(this.buf[this.pos++]&128);return this}skipType(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${t} at offset ${this.pos}`)}return this}readLongVarint(){let t=new U(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw j(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw j(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw j(this,8);let t=te(this.buf,this.pos+=4),e=te(this.buf,this.pos+=4);return new U(t,e)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){return this.readLongVarint().toNumber(!0)}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}};function cr(r){return new ar(r instanceof Uint8Array?r:r.subarray())}function ur(r,t){let e=cr(r);return t.decode(e)}function hr(r){let t=r??8192,e=t>>>1,n,o=t;return function(a){if(a<1||a>e)return N(a);o+a>t&&(n=N(t),o=0);let u=n.subarray(o,o+=a);return o&7&&(o=(o|7)+1),u}}var ut=class{fn;len;next;val;constructor(t,e,n){this.fn=t,this.len=e,this.next=void 0,this.val=n}};function fr(){}var dr=class{head;tail;len;next;constructor(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}},Ki=hr();function Zi(r){return globalThis.Buffer!=null?N(r):Ki(r)}var Ft=class{len;head;tail;states;constructor(){this.len=0,this.head=new ut(fr,0,0),this.tail=this.head,this.states=null}_push(t,e,n){return this.tail=this.tail.next=new ut(t,e,n),this.len+=e,this}uint32(t){return this.len+=(this.tail=this.tail.next=new pr((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this}int32(t){return t<0?this._push(Dt,10,U.fromNumber(t)):this.uint32(t)}sint32(t){return this.uint32((t<<1^t>>31)>>>0)}uint64(t){let e=U.fromBigInt(t);return this._push(Dt,e.length(),e)}uint64Number(t){let e=U.fromNumber(t);return this._push(Dt,e.length(),e)}uint64String(t){return this.uint64(BigInt(t))}int64(t){return this.uint64(t)}int64Number(t){return this.uint64Number(t)}int64String(t){return this.uint64String(t)}sint64(t){let e=U.fromBigInt(t).zzEncode();return this._push(Dt,e.length(),e)}sint64Number(t){let e=U.fromNumber(t).zzEncode();return this._push(Dt,e.length(),e)}sint64String(t){return this.sint64(BigInt(t))}bool(t){return this._push(lr,1,t?1:0)}fixed32(t){return this._push(Rt,4,t>>>0)}sfixed32(t){return this.fixed32(t)}fixed64(t){let e=U.fromBigInt(t);return this._push(Rt,4,e.lo)._push(Rt,4,e.hi)}fixed64Number(t){let e=U.fromNumber(t);return this._push(Rt,4,e.lo)._push(Rt,4,e.hi)}fixed64String(t){return this.fixed64(BigInt(t))}sfixed64(t){return this.fixed64(t)}sfixed64Number(t){return this.fixed64Number(t)}sfixed64String(t){return this.fixed64String(t)}float(t){return this._push(En,4,t)}double(t){return this._push(Sn,8,t)}bytes(t){let e=t.length>>>0;return e===0?this._push(lr,1,0):this.uint32(e)._push(ts,e,t)}string(t){let e=Nn(t);return e!==0?this.uint32(e)._push(sr,e,t):this._push(lr,1,0)}fork(){return this.states=new dr(this),this.head=this.tail=new ut(fr,0,0),this.len=0,this}reset(){return this.states!=null?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new ut(fr,0,0),this.len=0),this}ldelim(){let t=this.head,e=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=t.next,this.tail=e,this.len+=n),this}finish(){let t=this.head.next,e=Zi(this.len),n=0;for(;t!=null;)t.fn(t.val,e,n),n+=t.len,t=t.next;return e}};function lr(r,t,e){t[e]=r&255}function Yi(r,t,e){for(;r>127;)t[e++]=r&127|128,r>>>=7;t[e]=r}var pr=class extends ut{next;constructor(t,e){super(Yi,t,e),this.next=void 0}};function Dt(r,t,e){for(;r.hi!==0;)t[e++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)t[e++]=r.lo&127|128,r.lo=r.lo>>>7;t[e++]=r.lo}function Rt(r,t,e){t[e]=r&255,t[e+1]=r>>>8&255,t[e+2]=r>>>16&255,t[e+3]=r>>>24}function ts(r,t,e){t.set(r,e)}globalThis.Buffer!=null&&(Ft.prototype.bytes=function(r){let t=r.length>>>0;return this.uint32(t),t>0&&this._push(es,t,r),this},Ft.prototype.string=function(r){let t=globalThis.Buffer.byteLength(r);return this.uint32(t),t>0&&this._push(rs,t,r),this});function es(r,t,e){t.set(r,e)}function rs(r,t,e){r.length<40?sr(r,t,e):t.utf8Write!=null?t.utf8Write(r,e):t.set(Pt(r),e)}function mr(){return new Ft}function gr(r,t){let e=mr();return t.encode(r,e,{lengthDelimited:!1}),e.finish()}var yt;(function(r){r[r.VARINT=0]="VARINT",r[r.BIT64=1]="BIT64",r[r.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",r[r.START_GROUP=3]="START_GROUP",r[r.END_GROUP=4]="END_GROUP",r[r.BIT32=5]="BIT32"})(yt||(yt={}));function ee(r,t,e,n){return{name:r,type:t,encode:e,decode:n}}function wr(r){function t(o){if(r[o.toString()]==null)throw new Error("Invalid enum value");return r[o]}let e=function(i,a){let u=t(i);a.int32(u)},n=function(i){let a=i.int32();return t(a)};return ee("enum",yt.VARINT,e,n)}function br(r,t){return ee("message",yt.LENGTH_DELIMITED,r,t)}var G;(function(r){let t;(function(o){o.UNUSED="UNUSED",o.CONNECT="CONNECT",o.SYNC="SYNC"})(t=r.Type||(r.Type={}));let e;(function(o){o[o.UNUSED=0]="UNUSED",o[o.CONNECT=100]="CONNECT",o[o.SYNC=300]="SYNC"})(e||(e={})),function(o){o.codec=()=>wr(e)}(t=r.Type||(r.Type={}));let n;r.codec=()=>(n==null&&(n=br((o,i,a={})=>{if(a.lengthDelimited!==!1&&i.fork(),o.type!=null&&(i.uint32(8),r.Type.codec().encode(o.type,i)),o.observedAddresses!=null)for(let u of o.observedAddresses)i.uint32(18),i.bytes(u);a.lengthDelimited!==!1&&i.ldelim()},(o,i)=>{let a={observedAddresses:[]},u=i==null?o.len:o.pos+i;for(;o.pos<u;){let d=o.uint32();switch(d>>>3){case 1:a.type=r.Type.codec().decode(o);break;case 2:a.observedAddresses.push(o.bytes());break;default:o.skipType(d&7);break}}return a})),n),r.encode=o=>gr(o,r.codec()),r.decode=o=>ur(o,r.codec())})(G||(G={}));var ns=r=>r.toString().split("/").slice(1),Tt=r=>({match:t=>t.length<1?!1:r(t[0])?t.slice(1):!1,pattern:"fn"}),E=r=>({match:t=>Tt(e=>e===r).match(t),pattern:r}),oe=()=>({match:r=>Tt(t=>typeof t=="string").match(r),pattern:"{string}"}),Fn=()=>({match:r=>Tt(t=>!isNaN(parseInt(t))).match(r),pattern:"{number}"}),_=()=>({match:r=>{if(r.length<2||r[0]!=="p2p"&&r[0]!=="ipfs")return!1;if(r[1].startsWith("Q")||r[1].startsWith("1"))try{P.decode(`z${r[1]}`)}catch{return!1}else return!1;return r.slice(2)},pattern:"/p2p/{peerid}"}),re=()=>({match:r=>{if(r.length<2||r[0]!=="certhash")return!1;try{Pe.decode(r[1])}catch{return!1}return r.slice(2)},pattern:"/certhash/{certhash}"}),q=r=>({match:t=>{let e=r.match(t);return e===!1?t:e},pattern:`optional(${r.pattern})`}),X=(...r)=>({match:t=>{let e;for(let n of r){let o=n.match(t);o!==!1&&(e==null||o.length<e.length)&&(e=o)}return e??!1},pattern:`or(${r.map(t=>t.pattern).join(", ")})`}),v=(...r)=>({match:t=>{for(let e of r){let n=e.match(t);if(n===!1)return!1;t=n}return t},pattern:`and(${r.map(t=>t.pattern).join(", ")})`});function L(...r){function t(o){let i=ns(o);for(let a of r){let u=a.match(i);if(u===!1)return!1;i=u}return i}function e(o){return t(o)!==!1}function n(o){let i=t(o);return i===!1?!1:i.length===0}return{matches:e,exactMatch:n}}var yr=v(E("dns4"),oe()),Ir=v(E("dns6"),oe()),Ar=v(E("dnsaddr"),oe()),Tn=v(E("dns"),oe()),Bh=L(yr),Oh=L(Ir),_h=L(Ar),Cn=L(X(Tn,Ar,yr,Ir)),Un=v(E("ip4"),Tt(Wt)),$n=v(E("ip6"),Tt(qt)),kn=X(Un,$n),Ct=X(kn,Tn,yr,Ir,Ar),Vh=L(Ct),zh=L(Un),jh=L($n),Mn=L(kn),ie=v(Ct,E("tcp"),Fn()),Ut=v(Ct,E("udp"),Fn()),os=X(ie,Ut),Gh=L(ie),Wh=L(Ut),Er=v(Ut,E("quic")),se=v(Ut,E("quic-v1")),is=X(Er,se),qh=L(Er),Xh=L(se),xr=X(Ct,ie,Ut,Er,se),Bn=X(v(xr,E("ws"),q(_()))),Hh=L(Bn),On=X(v(xr,E("wss"),q(_())),v(xr,E("tls"),E("ws"),q(_()))),Qh=L(On),_n=v(os,E("webrtc-direct"),re(),q(re()),q(_())),Jh=L(_n),Vn=v(se,E("webtransport"),re(),re(),q(_())),Kh=L(Vn),ne=X(Bn,On,v(ie,q(_())),v(is,q(_())),v(Ct,q(_())),_n,Vn,_()),Zh=L(ne),ss=v(ne,E("p2p-circuit"),_()),zn=L(ss),as=X(v(ne,E("p2p-circuit"),E("webrtc"),_()),v(ne,E("webrtc"),q(_())),E("webrtc")),Yh=L(as);var Qn=le(jn(),1);var Gn="[a-fA-F\\d:]",ot=r=>r&&r.includeBoundaries?`(?:(?<=\\s|^)(?=${Gn})|(?<=${Gn})(?=\\s|$))`:"",W="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",S="[a-fA-F\\d]{1,4}",ae=`
|
|
3
3
|
(?:
|
|
4
4
|
(?:${S}:){7}(?:${S}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
|
|
5
|
-
(?:${S}:){6}(?:${
|
|
6
|
-
(?:${S}:){5}(?::${
|
|
7
|
-
(?:${S}:){4}(?:(?::${S}){0,1}:${
|
|
8
|
-
(?:${S}:){3}(?:(?::${S}){0,2}:${
|
|
9
|
-
(?:${S}:){2}(?:(?::${S}){0,3}:${
|
|
10
|
-
(?:${S}:){1}(?:(?::${S}){0,4}:${
|
|
11
|
-
(?::(?:(?::${S}){0,5}:${
|
|
5
|
+
(?:${S}:){6}(?:${W}|:${S}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4
|
|
6
|
+
(?:${S}:){5}(?::${W}|(?::${S}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4
|
|
7
|
+
(?:${S}:){4}(?:(?::${S}){0,1}:${W}|(?::${S}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4
|
|
8
|
+
(?:${S}:){3}(?:(?::${S}){0,2}:${W}|(?::${S}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4
|
|
9
|
+
(?:${S}:){2}(?:(?::${S}){0,3}:${W}|(?::${S}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4
|
|
10
|
+
(?:${S}:){1}(?:(?::${S}){0,4}:${W}|(?::${S}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4
|
|
11
|
+
(?::(?:(?::${S}){0,5}:${W}|(?::${S}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4
|
|
12
12
|
)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1
|
|
13
|
-
`.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),
|
|
13
|
+
`.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),cs=new RegExp(`(?:^${W}$)|(?:^${ae}$)`),us=new RegExp(`^${W}$`),hs=new RegExp(`^${ae}$`),vr=r=>r&&r.exact?cs:new RegExp(`(?:${ot(r)}${W}${ot(r)})|(?:${ot(r)}${ae}${ot(r)})`,"g");vr.v4=r=>r&&r.exact?us:new RegExp(`${ot(r)}${W}${ot(r)}`,"g");vr.v6=r=>r&&r.exact?hs:new RegExp(`${ot(r)}${ae}${ot(r)}`,"g");var Wn=vr;var Jn=le(Xn(),1),{isValid:fs,parse:ls}=Jn.default,ds=["0.0.0.0/8","10.0.0.0/8","100.64.0.0/10","127.0.0.0/8","169.254.0.0/16","172.16.0.0/12","192.0.0.0/24","192.0.0.0/29","192.0.0.8/32","192.0.0.9/32","192.0.0.10/32","192.0.0.170/32","192.0.0.171/32","192.0.2.0/24","192.31.196.0/24","192.52.193.0/24","192.88.99.0/24","192.168.0.0/16","192.175.48.0/24","198.18.0.0/15","198.51.100.0/24","203.0.113.0/24","240.0.0.0/4","255.255.255.255/32"],ps=ds.map(r=>new Qn.Netmask(r));function ms(r){for(let t of ps)if(t.contains(r))return!0;return!1}function Hn(r){return/^::$/.test(r)||/^::1$/.test(r)||/^::f{4}:([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(r)||/^::f{4}:0.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(r)||/^64:ff9b::([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(r)||/^100::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(r)||/^2001::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(r)||/^2001:2[0-9a-fA-F]:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(r)||/^2001:db8:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(r)||/^2002:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(r)||/^f[c-d]([0-9a-fA-F]{2,2}):/i.test(r)||/^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(r)||/^ff([0-9a-fA-F]{2,2}):/i.test(r)}var Kn=r=>{if(fs(r)){let t=ls(r);if(t.kind()==="ipv4")return ms(t.toNormalizedString());if(t.kind()==="ipv6")return Hn(r)}else if(gt(r)&&Wn.v6().test(r))return Hn(r)};var Zn=Kn;function Sr(r,t){return zn.matches(r)||t.transportForMultiaddr(r)==null?!1:Cn.matches(r)?!0:Mn.matches(r)?Zn(r.toOptions().host)===!1:!1}var Yn=1024*4,to=100,ue={timeout:5e3,retries:3,maxInboundStreams:1,maxOutboundStreams:1},he=class{started;timeout;retries;maxInboundStreams;maxOutboundStreams;peerStore;registrar;connectionManager;addressManager;transportManager;topologyId;log;constructor(t,e){this.log=t.logger.forComponent("libp2p:dcutr"),this.started=!1,this.peerStore=t.peerStore,this.registrar=t.registrar,this.addressManager=t.addressManager,this.connectionManager=t.connectionManager,this.transportManager=t.transportManager,this.timeout=e.timeout??ue.timeout,this.retries=e.retries??ue.retries,this.maxInboundStreams=e.maxInboundStreams??ue.maxInboundStreams,this.maxOutboundStreams=e.maxOutboundStreams??ue.maxOutboundStreams}isStarted(){return this.started}async start(){this.started||(this.topologyId=await this.registrar.register(It,{notifyOnTransient:!0,onConnect:(t,e)=>{e.transient&&e.direction==="inbound"&&this.upgradeInbound(e).catch(n=>{this.log.error("error during outgoing DCUtR attempt",n)})}}),await this.registrar.handle(It,t=>{this.handleIncomingUpgrade(t.stream,t.connection).catch(e=>{this.log.error("error during incoming DCUtR attempt",e),t.stream.abort(e)})},{maxInboundStreams:this.maxInboundStreams,maxOutboundStreams:this.maxOutboundStreams,runOnTransientConnection:!0}),this.started=!0)}async stop(){await this.registrar.unhandle(It),this.topologyId!=null&&this.registrar.unregister(this.topologyId),this.started=!1}async upgradeInbound(t){if(await this.attemptUnilateralConnectionUpgrade(t))return;let e;for(let n=0;n<this.retries;n++){let o={signal:AbortSignal.timeout(this.timeout)};try{e=await t.newStream([It],{signal:o.signal,runOnTransientConnection:!0});let i=nr(e,{maxDataLength:Yn}).pb(G);this.log("B sending connect to %p",t.remotePeer);let a=Date.now();await i.write({type:G.Type.CONNECT,observedAddresses:this.addressManager.getAddresses().map(w=>w.bytes)},o),this.log("B receiving connect from %p",t.remotePeer);let u=await i.read(o);if(u.type!==G.Type.CONNECT)throw this.log("A sent wrong message type"),new Q("DCUtR message type was incorrect",it);let d=this.getDialableMultiaddrs(u.observedAddresses);if(d.length===0)throw this.log("A did not have any dialable multiaddrs"),new Q("DCUtR connect message had no multiaddrs",it);let l=Date.now()-a;this.log("A sending sync, rtt %dms",l),await i.write({type:G.Type.SYNC,observedAddresses:[]},o),this.log("A waiting for half RTT"),await ln(l/2),this.log("B dialing",d);let b=await this.connectionManager.openConnection(d,{signal:o.signal,priority:to});this.log("DCUtR to %p succeeded to address %a, closing relayed connection",t.remotePeer,b.remoteAddr),await t.close(o);break}catch(i){if(this.log.error("error while attempting DCUtR on attempt %d of %d",n+1,this.retries,i),e?.abort(i),n===this.retries)throw i}finally{e!=null&&await e.close(o)}}}async attemptUnilateralConnectionUpgrade(t){let n=(await this.peerStore.get(t.remotePeer)).addresses.map(o=>{let i=o.multiaddr;return i.getPeerId()==null?i.encapsulate(`/p2p/${t.remotePeer}`):i}).filter(o=>Sr(o,this.transportManager));if(n.length>0){let o=AbortSignal.timeout(this.timeout);try{this.log("attempting unilateral connection upgrade to %a",n);let i=await this.connectionManager.openConnection(n,{signal:o,force:!0});if(i.transient)throw new Error("Could not open a new, non-transient, connection");return this.log("unilateral connection upgrade to %p succeeded via %a, closing relayed connection",t.remotePeer,i.remoteAddr),await t.close({signal:o}),!0}catch(i){this.log.error("unilateral connection upgrade to %p on addresses %a failed",t.remotePeer,n,i)}}else this.log("peer %p has no public addresses, not attempting unilateral connection upgrade",t.remotePeer);return!1}async handleIncomingUpgrade(t,e){let n={signal:AbortSignal.timeout(this.timeout)};try{let o=nr(t,{maxDataLength:Yn}).pb(G);this.log("A receiving connect");let i=await o.read(n);if(i.type!==G.Type.CONNECT)throw this.log("B sent wrong message type"),new Q("DCUtR message type was incorrect",it);if(i.observedAddresses.length===0)throw this.log("B sent no multiaddrs"),new Q("DCUtR connect message had no multiaddrs",it);let a=this.getDialableMultiaddrs(i.observedAddresses);if(a.length===0)throw this.log("B had no dialable multiaddrs"),new Q("DCUtR connect message had no dialable multiaddrs",it);if(this.log("A sending connect"),await o.write({type:G.Type.CONNECT,observedAddresses:this.addressManager.getAddresses().map(l=>l.bytes)}),this.log("A receiving sync"),(await o.read(n)).type!==G.Type.SYNC)throw new Q("DCUtR message type was incorrect",it);this.log("A dialing",a);let d=await this.connectionManager.openConnection(a,{signal:n.signal,priority:to,force:!0});this.log("DCUtR to %p succeeded via %a, closing relayed connection",e.remotePeer,d.remoteAddr),await e.close(n)}catch(o){this.log.error("incoming DCUtR from %p failed",e.remotePeer,o),t.abort(o)}finally{await t.close(n)}}getDialableMultiaddrs(t){let e=[];for(let n of t)if(!(n==null||n.length===0))try{let o=Ze(n);if(!Sr(o,this.transportManager))continue;e.push(o)}catch{}return e}};var It="/libp2p/dcutr";function gs(r={}){return t=>new he(t,r)}return so(ws);})();
|
|
14
14
|
return Libp2PDcutr}));
|
package/dist/src/dcutr.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type Multiaddr } from '@multiformats/multiaddr';
|
|
2
2
|
import type { DCUtRServiceComponents, DCUtRServiceInit } from './index.js';
|
|
3
|
-
import type { Connection, Stream } from '@libp2p/interface
|
|
4
|
-
import type { Startable } from '@libp2p/interface/startable';
|
|
3
|
+
import type { Connection, Stream, Startable } from '@libp2p/interface';
|
|
5
4
|
export declare class DefaultDCUtRService implements Startable {
|
|
6
5
|
private started;
|
|
7
6
|
private readonly timeout;
|
package/dist/src/dcutr.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dcutr.d.ts","sourceRoot":"","sources":["../../src/dcutr.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,yBAAyB,CAAA;AAMnE,OAAO,KAAK,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"dcutr.d.ts","sourceRoot":"","sources":["../../src/dcutr.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,yBAAyB,CAAA;AAMnE,OAAO,KAAK,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC1E,OAAO,KAAK,EAAU,UAAU,EAAE,MAAM,EAAa,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAiBzF,qBAAa,mBAAoB,YAAW,SAAS;IACnD,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAQ;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAQ;IAChC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAQ;IAC1C,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAQ;IAC3C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAW;IACrC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAW;IACrC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAmB;IACrD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAgB;IAC/C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAkB;IACnD,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC3B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAQ;gBAEf,UAAU,EAAE,sBAAsB,EAAE,IAAI,EAAE,gBAAgB;IAevE,SAAS,IAAK,OAAO;IAIf,KAAK,IAAK,OAAO,CAAC,IAAI,CAAC;IAyCvB,IAAI,IAAK,OAAO,CAAC,IAAI,CAAC;IAU5B;;;;OAIG;IACG,cAAc,CAAE,iBAAiB,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAkGnE;;;OAGG;IACG,kCAAkC,CAAE,iBAAiB,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC;IA0D1F;;;;OAIG;IACG,qBAAqB,CAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAmE1F;;OAEG;IACH,qBAAqB,CAAE,KAAK,EAAE,KAAK,CAAC,UAAU,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,SAAS,EAAE;CAqB1F"}
|
package/dist/src/dcutr.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CodeError, ERR_INVALID_MESSAGE } from '@libp2p/interface
|
|
1
|
+
import { CodeError, ERR_INVALID_MESSAGE } from '@libp2p/interface';
|
|
2
2
|
import { multiaddr } from '@multiformats/multiaddr';
|
|
3
3
|
import delay from 'delay';
|
|
4
4
|
import { pbStream } from 'it-protobuf-stream';
|
package/dist/src/dcutr.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dcutr.js","sourceRoot":"","sources":["../../src/dcutr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"dcutr.js","sourceRoot":"","sources":["../../src/dcutr.ts"],"names":[],"mappings":"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"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -52,12 +52,8 @@
|
|
|
52
52
|
* }
|
|
53
53
|
* ```
|
|
54
54
|
*/
|
|
55
|
-
import type { ComponentLogger } from '@libp2p/interface';
|
|
56
|
-
import type {
|
|
57
|
-
import type { AddressManager } from '@libp2p/interface-internal/address-manager';
|
|
58
|
-
import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager';
|
|
59
|
-
import type { Registrar } from '@libp2p/interface-internal/registrar';
|
|
60
|
-
import type { TransportManager } from '@libp2p/interface-internal/transport-manager';
|
|
55
|
+
import type { ComponentLogger, PeerStore } from '@libp2p/interface';
|
|
56
|
+
import type { AddressManager, ConnectionManager, Registrar, TransportManager } from '@libp2p/interface-internal';
|
|
61
57
|
export interface DCUtRServiceInit {
|
|
62
58
|
/**
|
|
63
59
|
* How long we should wait for the connection upgrade to complete (default: 5s)
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAEhH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAE1B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,SAAS,CAAA;IACpB,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,SAAS,EAAE,SAAS,CAAA;IACpB,cAAc,EAAE,cAAc,CAAA;IAC9B,gBAAgB,EAAE,gBAAgB,CAAA;IAClC,MAAM,EAAE,eAAe,CAAA;CACxB;AAED;;GAEG;AACH,eAAO,MAAM,UAAU,kBAAkB,CAAA;AAEzC,wBAAgB,KAAK,CAAE,IAAI,GAAE,gBAAqB,GAAG,CAAC,UAAU,EAAE,sBAAsB,KAAK,OAAO,CAEnG"}
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAqChD;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,CAAA;AAEzC,MAAM,UAAU,KAAK,CAAE,OAAyB,EAAE;IAChD,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,mBAAmB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;AAClE,CAAC"}
|
package/dist/src/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Multiaddr } from '@multiformats/multiaddr';
|
|
2
|
-
import type { TransportManager } from '@libp2p/interface-internal
|
|
2
|
+
import type { TransportManager } from '@libp2p/interface-internal';
|
|
3
3
|
/**
|
|
4
4
|
* Returns true if the passed multiaddr is public, not relayed and we have a
|
|
5
5
|
* transport that can dial it
|
package/dist/src/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAGxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAGxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAElE;;;GAGG;AACH,wBAAgB,mBAAmB,CAAE,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,gBAAgB,GAAG,OAAO,CAuB/F"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"DCUtRServiceComponents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_dcutr.DCUtRServiceComponents.html",
|
|
3
|
+
".:DCUtRServiceComponents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_dcutr.DCUtRServiceComponents.html",
|
|
4
|
+
"DCUtRServiceInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_dcutr.DCUtRServiceInit.html",
|
|
5
|
+
".:DCUtRServiceInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_dcutr.DCUtRServiceInit.html",
|
|
6
|
+
"multicodec": "https://libp2p.github.io/js-libp2p/variables/_libp2p_dcutr.multicodec.html",
|
|
7
|
+
".:multicodec": "https://libp2p.github.io/js-libp2p/variables/_libp2p_dcutr.multicodec.html",
|
|
8
|
+
"dcutr": "https://libp2p.github.io/js-libp2p/functions/_libp2p_dcutr.dcutr.html",
|
|
9
|
+
".:dcutr": "https://libp2p.github.io/js-libp2p/functions/_libp2p_dcutr.dcutr.html"
|
|
10
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/dcutr",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Implementation of the DCUtR Protocol",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/protocol-dcutr#readme",
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
"bugs": {
|
|
12
12
|
"url": "https://github.com/libp2p/js-libp2p/issues"
|
|
13
13
|
},
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public",
|
|
16
|
+
"provenance": true
|
|
17
|
+
},
|
|
14
18
|
"type": "module",
|
|
15
19
|
"types": "./dist/src/index.d.ts",
|
|
16
20
|
"files": [
|
|
@@ -47,8 +51,8 @@
|
|
|
47
51
|
"dep-check": "aegir dep-check"
|
|
48
52
|
},
|
|
49
53
|
"dependencies": {
|
|
50
|
-
"@libp2p/interface": "0.
|
|
51
|
-
"@libp2p/interface-internal": "0.1.
|
|
54
|
+
"@libp2p/interface": "^1.0.0",
|
|
55
|
+
"@libp2p/interface-internal": "^0.1.10",
|
|
52
56
|
"@multiformats/multiaddr": "^12.1.10",
|
|
53
57
|
"@multiformats/multiaddr-matcher": "^1.1.0",
|
|
54
58
|
"delay": "^6.0.0",
|
package/src/dcutr.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CodeError, ERR_INVALID_MESSAGE } from '@libp2p/interface
|
|
1
|
+
import { CodeError, ERR_INVALID_MESSAGE } from '@libp2p/interface'
|
|
2
2
|
import { type Multiaddr, multiaddr } from '@multiformats/multiaddr'
|
|
3
3
|
import delay from 'delay'
|
|
4
4
|
import { pbStream } from 'it-protobuf-stream'
|
|
@@ -6,14 +6,8 @@ import { HolePunch } from './pb/message.js'
|
|
|
6
6
|
import { isPublicAndDialable } from './utils.js'
|
|
7
7
|
import { multicodec } from './index.js'
|
|
8
8
|
import type { DCUtRServiceComponents, DCUtRServiceInit } from './index.js'
|
|
9
|
-
import type { Logger } from '@libp2p/interface'
|
|
10
|
-
import type {
|
|
11
|
-
import type { PeerStore } from '@libp2p/interface/peer-store'
|
|
12
|
-
import type { Startable } from '@libp2p/interface/startable'
|
|
13
|
-
import type { AddressManager } from '@libp2p/interface-internal/address-manager'
|
|
14
|
-
import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager'
|
|
15
|
-
import type { Registrar } from '@libp2p/interface-internal/registrar'
|
|
16
|
-
import type { TransportManager } from '@libp2p/interface-internal/src/transport-manager/index.js'
|
|
9
|
+
import type { Logger, Connection, Stream, PeerStore, Startable } from '@libp2p/interface'
|
|
10
|
+
import type { AddressManager, ConnectionManager, Registrar, TransportManager } from '@libp2p/interface-internal'
|
|
17
11
|
|
|
18
12
|
// https://github.com/libp2p/specs/blob/master/relay/DCUtR.md#rpc-messages
|
|
19
13
|
const MAX_DCUTR_MESSAGE_SIZE = 1024 * 4
|
package/src/index.ts
CHANGED
|
@@ -54,12 +54,8 @@
|
|
|
54
54
|
*/
|
|
55
55
|
|
|
56
56
|
import { DefaultDCUtRService } from './dcutr.js'
|
|
57
|
-
import type { ComponentLogger } from '@libp2p/interface'
|
|
58
|
-
import type {
|
|
59
|
-
import type { AddressManager } from '@libp2p/interface-internal/address-manager'
|
|
60
|
-
import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager'
|
|
61
|
-
import type { Registrar } from '@libp2p/interface-internal/registrar'
|
|
62
|
-
import type { TransportManager } from '@libp2p/interface-internal/transport-manager'
|
|
57
|
+
import type { ComponentLogger, PeerStore } from '@libp2p/interface'
|
|
58
|
+
import type { AddressManager, ConnectionManager, Registrar, TransportManager } from '@libp2p/interface-internal'
|
|
63
59
|
|
|
64
60
|
export interface DCUtRServiceInit {
|
|
65
61
|
/**
|
package/src/utils.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Multiaddr } from '@multiformats/multiaddr'
|
|
2
2
|
import { Circuit, IP, DNS } from '@multiformats/multiaddr-matcher'
|
|
3
3
|
import isPrivate from 'private-ip'
|
|
4
|
-
import type { TransportManager } from '@libp2p/interface-internal
|
|
4
|
+
import type { TransportManager } from '@libp2p/interface-internal'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Returns true if the passed multiaddr is public, not relayed and we have a
|