@libp2p/dcutr 0.0.0-97ab31c0c

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/LICENSE ADDED
@@ -0,0 +1,4 @@
1
+ This project is dual licensed under MIT and Apache-2.0.
2
+
3
+ MIT: https://www.opensource.org/licenses/mit
4
+ Apache-2.0: https://www.apache.org/licenses/license-2.0
package/README.md ADDED
@@ -0,0 +1,88 @@
1
+ [![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/)
2
+ [![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io)
3
+ [![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p)
4
+ [![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster)
5
+
6
+ > Implementation of the DCUtR Protocol
7
+
8
+ # About
9
+
10
+ Direct Connection Upgrade through Relay (DCUtR) is a protocol that allows two
11
+ nodes to connect to each other who would otherwise be prevented doing so due
12
+ to being behind NATed connections or firewalls.
13
+
14
+ The protocol involves making a relayed connection between the two peers and
15
+ using the relay to synchronise connection timings so that they dial each other
16
+ at precisely the same moment.
17
+
18
+ ## Example
19
+
20
+ ```ts
21
+ import { createLibp2p } from 'libp2p'
22
+ import { circuitRelayTransport } from 'libp2p/circuit-relay'
23
+ import { tcp } from '@libp2p/tcp'
24
+ import { identify } from '@libp2p/identify'
25
+ import { dcutr } from '@libp2p/dcutr'
26
+
27
+ const node = await createLibp2p({
28
+ transports: [
29
+ circuitRelayTransport(),
30
+ tcp()
31
+ ],
32
+ services: {
33
+ identify: identify(),
34
+ dcutr: dcutr()
35
+ }
36
+ })
37
+
38
+ // QmTarget is a peer that is behind a NAT, supports TCP and has a relay
39
+ // reservation
40
+ await node.dial('/ip4/.../p2p/QmRelay/p2p-circuit/p2p/QmTarget')
41
+
42
+ // after a while the connection should automatically get upgraded to a
43
+ // direct connection (e.g. non-transient)
44
+ while (true) {
45
+ const connections = node.getConnections()
46
+
47
+ if (connections.find(conn => conn.transient === false)) {
48
+ console.info('have direct connection')
49
+ break
50
+ } else {
51
+ console.info('have relayed connection')
52
+
53
+ // wait a few seconds to see if it's succeeded yet
54
+ await new Promise((resolve) => {
55
+ setTimeout(() => resolve(), 5000)
56
+ })
57
+ }
58
+ }
59
+ ```
60
+
61
+ # Install
62
+
63
+ ```console
64
+ $ npm i @libp2p/dcutr
65
+ ```
66
+
67
+ ## Browser `<script>` tag
68
+
69
+ Loading this module through a script tag will make it's exports available as `Libp2pDcutr` in the global namespace.
70
+
71
+ ```html
72
+ <script src="https://unpkg.com/@libp2p/dcutr/dist/index.min.js"></script>
73
+ ```
74
+
75
+ # API Docs
76
+
77
+ - <https://libp2p.github.io/js-libp2p/modules/_libp2p_dcutr.html>
78
+
79
+ # License
80
+
81
+ Licensed under either of
82
+
83
+ - Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
84
+ - MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
85
+
86
+ # Contribution
87
+
88
+ Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
@@ -0,0 +1,14 @@
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 ti=Object.getPrototypeOf,ei=Object.prototype.hasOwnProperty;var fe=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),$=(r,t)=>{for(var e in t)Mt(r,e,{get:t[e],enumerable:!0})},Sr=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Yn(t))!ei.call(r,i)&&i!==e&&Mt(r,i,{get:()=>t[i],enumerable:!(n=Kn(t,i))||n.enumerable});return r};var le=(r,t,e)=>(e=r!=null?Zn(ti(r)):{},Sr(t||!r||!r.__esModule?Mt(e,"default",{value:r,enumerable:!0}):e,r)),ri=r=>Sr(Mt({},"__esModule",{value:!0}),r);var gn=fe((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 _o(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 i=function(){};return i.prototype=Object.create(Object.getPrototypeOf(r)),pn(new i,e)}}mn.exports=_o});var On=fe(kt=>{(function(){var r,t,e,n,i,o,c,h;h=function(d){var l,b,w,m;return l=(d&255<<24)>>>24,b=(d&255<<16)>>>16,w=(d&65280)>>>8,m=d&255,[l,b,w,m].join(".")},c=function(d){var l,b,w,m,s,a;for(l=[],w=m=0;m<=3&&d.length!==0;w=++m){if(w>0){if(d[0]!==".")throw new Error("Invalid IP");d=d.substring(1)}a=t(d),s=a[0],b=a[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"),o=e("a"),i=e("A"),t=function(d){var l,b,w,m,s;for(m=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)m=m*l+(e(d[w])-n)>>>0;else if(l===16)if("a"<=d[w]&&d[w]<="f")m=m*l+(10+e(d[w])-o)>>>0;else if("A"<=d[w]&&d[w]<="F")m=m*l+(10+e(d[w])-i)>>>0;else break;else break;if(m>4294967295)throw new Error("too large");w++}if(w===s)throw new Error("empty octet");return[m,w]},r=function(){function d(l,b){var w,m,s,a;if(typeof l!="string")throw new Error("Missing `net' parameter");if(b||(a=l.split("/",2),l=a[0],b=a[1]),b||(b=32),typeof b=="string"&&b.indexOf(".")>-1){try{this.maskLong=c(b)}catch(f){throw w=f,new Error("Invalid mask: "+b)}for(m=s=32;s>=0;m=--s)if(this.maskLong===4294967295<<32-m>>>0){this.bitmask=m;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=(c(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):(c(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,m;for(m=c(this.first),w=c(this.last),b=0;m<=w;)l(h(m),m,b),b++,m++},d.prototype.toString=function(){return this.base+"/"+this.bitmask},d}(),kt.ip2long=c,kt.long2ip=h,kt.Netmask=r}).call(kt)});var jn=fe((_n,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"),i=new RegExp("^0x[a-f0-9]+$","i"),o="%[0-9a-z]{1,}",c="(?:[0-9a-f]+::?)+",h={zoneIndex:new RegExp(o,"i"),native:new RegExp(`^(::)?(${c})?([0-9a-f]+)?(::)?(${o})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${o})?)$`,"i"),transitional:new RegExp(`^((?:${c})|(?:::)(?:${c})?)${t}\\.${t}\\.${t}\\.${t}(${o})?$`,"i")};function d(s,a){if(s.indexOf("::")!==s.lastIndexOf("::"))return null;let f=0,u=-1,p=(s.match(h.zoneIndex)||[])[0],g,y;for(p&&(p=p.substring(1),s=s.replace(/%.+$/,""));(u=s.indexOf(":",u+1))>=0;)f++;if(s.substr(0,2)==="::"&&f--,s.substr(-2,2)==="::"&&f--,f>a)return null;for(y=a-f,g=":";y--;)g+="0:";return s=s.replace("::",g),s[0]===":"&&(s=s.slice(1)),s[s.length-1]===":"&&(s=s.slice(0,-1)),a=function(){let P=s.split(":"),T=[];for(let M=0;M<P.length;M++)T.push(parseInt(P[M],16));return T}(),{parts:a,zoneId:p}}function l(s,a,f,u){if(s.length!==a.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let p=0,g;for(;u>0;){if(g=f-u,g<0&&(g=0),s[p]>>g!==a[p]>>g)return!1;u-=f,p+=1}return!0}function b(s){if(i.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,a){for(;s.length<a;)s=`0${s}`;return s}let m={};m.IPv4=function(){function s(a){if(a.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let f,u;for(f=0;f<a.length;f++)if(u=a[f],!(0<=u&&u<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=a}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(a,f){let u;if(f===void 0&&(u=a,a=u[0],f=u[1]),a.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return l(this.octets,a.octets,8,f)},s.prototype.prefixLengthFromSubnetMask=function(){let a=0,f=!1,u={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},p,g,y;for(p=3;p>=0;p-=1)if(g=this.octets[p],g in u){if(y=u[g],f&&y!==0)return null;y!==8&&(f=!0),a+=y}else return null;return 32-a},s.prototype.range=function(){return m.subnetMatch(this,this.SpecialRanges)},s.prototype.toByteArray=function(){return this.octets.slice(0)},s.prototype.toIPv4MappedAddress=function(){return m.IPv6.parse(`::ffff:${this.toString()}`)},s.prototype.toNormalizedString=function(){return this.toString()},s.prototype.toString=function(){return this.octets.join(".")},s}(),m.IPv4.broadcastAddressFromCIDR=function(s){try{let a=this.parseCIDR(s),f=a[0].toByteArray(),u=this.subnetMaskFromPrefixLength(a[1]).toByteArray(),p=[],g=0;for(;g<4;)p.push(parseInt(f[g],10)|parseInt(u[g],10)^255),g++;return new this(p)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},m.IPv4.isIPv4=function(s){return this.parser(s)!==null},m.IPv4.isValid=function(s){try{return new this(this.parser(s)),!0}catch{return!1}},m.IPv4.isValidFourPartDecimal=function(s){return!!(m.IPv4.isValid(s)&&s.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},m.IPv4.networkAddressFromCIDR=function(s){let a,f,u,p,g;try{for(a=this.parseCIDR(s),u=a[0].toByteArray(),g=this.subnetMaskFromPrefixLength(a[1]).toByteArray(),p=[],f=0;f<4;)p.push(parseInt(u[f],10)&parseInt(g[f],10)),f++;return new this(p)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},m.IPv4.parse=function(s){let a=this.parser(s);if(a===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(a)},m.IPv4.parseCIDR=function(s){let a;if(a=s.match(/^(.+)\/(\d+)$/)){let f=parseInt(a[2]);if(f>=0&&f<=32){let u=[this.parse(a[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")},m.IPv4.parser=function(s){let a,f,u;if(a=s.match(e.fourOctet))return function(){let p=a.slice(1,6),g=[];for(let y=0;y<p.length;y++)f=p[y],g.push(b(f));return g}();if(a=s.match(e.longValue)){if(u=b(a[1]),u>4294967295||u<0)throw new Error("ipaddr: address outside defined range");return function(){let p=[],g;for(g=0;g<=24;g+=8)p.push(u>>g&255);return p}().reverse()}else return(a=s.match(e.twoOctet))?function(){let p=a.slice(1,4),g=[];if(u=b(p[1]),u>16777215||u<0)throw new Error("ipaddr: address outside defined range");return g.push(b(p[0])),g.push(u>>16&255),g.push(u>>8&255),g.push(u&255),g}():(a=s.match(e.threeOctet))?function(){let p=a.slice(1,5),g=[];if(u=b(p[2]),u>65535||u<0)throw new Error("ipaddr: address outside defined range");return g.push(b(p[0])),g.push(b(p[1])),g.push(u>>8&255),g.push(u&255),g}():null},m.IPv4.subnetMaskFromPrefixLength=function(s){if(s=parseInt(s),s<0||s>32)throw new Error("ipaddr: invalid IPv4 prefix length");let a=[0,0,0,0],f=0,u=Math.floor(s/8);for(;f<u;)a[f]=255,f++;return u<4&&(a[u]=Math.pow(2,s%8)-1<<8-s%8),new this(a)},m.IPv6=function(){function s(a,f){let u,p;if(a.length===16)for(this.parts=[],u=0;u<=14;u+=2)this.parts.push(a[u]<<8|a[u+1]);else if(a.length===8)this.parts=a;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(u=0;u<this.parts.length;u++)if(p=this.parts[u],!(0<=p&&p<=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(a,f){let u;if(f===void 0&&(u=a,a=u[0],f=u[1]),a.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return l(this.parts,a.parts,16,f)},s.prototype.prefixLengthFromSubnetMask=function(){let a=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},p,g;for(let y=7;y>=0;y-=1)if(p=this.parts[y],p in u){if(g=u[p],f&&g!==0)return null;g!==16&&(f=!0),a+=g}else return null;return 128-a},s.prototype.range=function(){return m.subnetMatch(this,this.SpecialRanges)},s.prototype.toByteArray=function(){let a,f=[],u=this.parts;for(let p=0;p<u.length;p++)a=u[p],f.push(a>>8),f.push(a&255);return f},s.prototype.toFixedLengthString=function(){let a=function(){let u=[];for(let p=0;p<this.parts.length;p++)u.push(w(this.parts[p].toString(16),4));return u}.call(this).join(":"),f="";return this.zoneId&&(f=`%${this.zoneId}`),a+f},s.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let a=this.parts.slice(-2),f=a[0],u=a[1];return new m.IPv4([f>>8,f&255,u>>8,u&255])},s.prototype.toNormalizedString=function(){let a=function(){let u=[];for(let p=0;p<this.parts.length;p++)u.push(this.parts[p].toString(16));return u}.call(this).join(":"),f="";return this.zoneId&&(f=`%${this.zoneId}`),a+f},s.prototype.toRFC5952String=function(){let a=/((^|:)(0(:|$)){2,})/g,f=this.toNormalizedString(),u=0,p=-1,g;for(;g=a.exec(f);)g[0].length>p&&(u=g.index,p=g[0].length);return p<0?f:`${f.substring(0,u)}::${f.substring(u+p)}`},s.prototype.toString=function(){return this.toRFC5952String()},s}(),m.IPv6.broadcastAddressFromCIDR=function(s){try{let a=this.parseCIDR(s),f=a[0].toByteArray(),u=this.subnetMaskFromPrefixLength(a[1]).toByteArray(),p=[],g=0;for(;g<16;)p.push(parseInt(f[g],10)|parseInt(u[g],10)^255),g++;return new this(p)}catch(a){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${a})`)}},m.IPv6.isIPv6=function(s){return this.parser(s)!==null},m.IPv6.isValid=function(s){if(typeof s=="string"&&s.indexOf(":")===-1)return!1;try{let a=this.parser(s);return new this(a.parts,a.zoneId),!0}catch{return!1}},m.IPv6.networkAddressFromCIDR=function(s){let a,f,u,p,g;try{for(a=this.parseCIDR(s),u=a[0].toByteArray(),g=this.subnetMaskFromPrefixLength(a[1]).toByteArray(),p=[],f=0;f<16;)p.push(parseInt(u[f],10)&parseInt(g[f],10)),f++;return new this(p)}catch(y){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${y})`)}},m.IPv6.parse=function(s){let a=this.parser(s);if(a.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(a.parts,a.zoneId)},m.IPv6.parseCIDR=function(s){let a,f,u;if((f=s.match(/^(.+)\/(\d+)$/))&&(a=parseInt(f[2]),a>=0&&a<=128))return u=[this.parse(f[1]),a],Object.defineProperty(u,"toString",{value:function(){return this.join("/")}}),u;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},m.IPv6.parser=function(s){let a,f,u,p,g,y;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))&&(y=u[6]||"",a=d(u[1].slice(0,-1)+y,6),a.parts)){for(g=[parseInt(u[2]),parseInt(u[3]),parseInt(u[4]),parseInt(u[5])],f=0;f<g.length;f++)if(p=g[f],!(0<=p&&p<=255))return null;return a.parts.push(g[0]<<8|g[1]),a.parts.push(g[2]<<8|g[3]),{parts:a.parts,zoneId:a.zoneId}}return null},m.IPv6.subnetMaskFromPrefixLength=function(s){if(s=parseInt(s),s<0||s>128)throw new Error("ipaddr: invalid IPv6 prefix length");let a=[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;)a[f]=255,f++;return u<16&&(a[u]=Math.pow(2,s%8)-1<<8-s%8),new this(a)},m.fromByteArray=function(s){let a=s.length;if(a===4)return new m.IPv4(s);if(a===16)return new m.IPv6(s);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},m.isValid=function(s){return m.IPv6.isValid(s)||m.IPv4.isValid(s)},m.parse=function(s){if(m.IPv6.isValid(s))return m.IPv6.parse(s);if(m.IPv4.isValid(s))return m.IPv4.parse(s);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},m.parseCIDR=function(s){try{return m.IPv6.parseCIDR(s)}catch{try{return m.IPv4.parseCIDR(s)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},m.process=function(s){let a=this.parse(s);return a.kind()==="ipv6"&&a.isIPv4MappedAddress()?a.toIPv4Address():a},m.subnetMatch=function(s,a,f){let u,p,g,y;f==null&&(f="unicast");for(p in a)if(Object.prototype.hasOwnProperty.call(a,p)){for(g=a[p],g[0]&&!(g[0]instanceof Array)&&(g=[g]),u=0;u<g.length;u++)if(y=g[u],s.kind()===y[0].kind()&&s.match.apply(s,y))return p}return f},typeof ce<"u"&&ce.exports?ce.exports=m:r.ipaddr=m})(_n)});var ps={};$(ps,{dcutr:()=>ds,multicodec:()=>It});var _=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 we={};$(we,{base58btc:()=>D,base58flickr:()=>ci});function ni(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 i=0;i<r.length;i++){var o=r.charAt(i),c=o.charCodeAt(0);if(e[c]!==255)throw new TypeError(o+" is ambiguous");e[c]=i}var h=r.length,d=r.charAt(0),l=Math.log(h)/Math.log(256),b=Math.log(256)/Math.log(h);function w(a){if(a instanceof Uint8Array||(ArrayBuffer.isView(a)?a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength):Array.isArray(a)&&(a=Uint8Array.from(a))),!(a instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(a.length===0)return"";for(var f=0,u=0,p=0,g=a.length;p!==g&&a[p]===0;)p++,f++;for(var y=(g-p)*b+1>>>0,P=new Uint8Array(y);p!==g;){for(var T=a[p],M=0,V=y-1;(T!==0||M<u)&&V!==-1;V--,M++)T+=256*P[V]>>>0,P[V]=T%h>>>0,T=T/h>>>0;if(T!==0)throw new Error("Non-zero carry");u=M,p++}for(var Q=y-u;Q!==y&&P[Q]===0;)Q++;for(var $t=d.repeat(f);Q<y;++Q)$t+=r.charAt(P[Q]);return $t}function m(a){if(typeof a!="string")throw new TypeError("Expected String");if(a.length===0)return new Uint8Array;var f=0;if(a[f]!==" "){for(var u=0,p=0;a[f]===d;)u++,f++;for(var g=(a.length-f)*l+1>>>0,y=new Uint8Array(g);a[f];){var P=e[a.charCodeAt(f)];if(P===255)return;for(var T=0,M=g-1;(P!==0||T<p)&&M!==-1;M--,T++)P+=h*y[M]>>>0,y[M]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");p=T,f++}if(a[f]!==" "){for(var V=g-p;V!==g&&y[V]===0;)V++;for(var Q=new Uint8Array(u+(g-V)),$t=u;V!==g;)Q[$t++]=y[V++];return Q}}}function s(a){var f=m(a);if(f)return f;throw new Error(`Non-${t} character`)}return{encode:w,decodeUnsafe:m,decode:s}}var ii=ni,oi=ii,Lr=oi;var bs=new Uint8Array(0);var Pr=(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 Dr=r=>new TextEncoder().encode(r),Nr=r=>new TextDecoder().decode(r);var de=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")}},pe=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 Rr(this,t)}},me=class{constructor(t){this.decoders=t}or(t){return Rr(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`)}},Rr=(r,t)=>new me({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),ge=class{constructor(t,e,n,i){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=i,this.encoder=new de(t,e,n),this.decoder=new pe(t,e,i)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}},ht=({name:r,prefix:t,encode:e,decode:n})=>new ge(r,t,e,n),Y=({prefix:r,name:t,alphabet:e})=>{let{encode:n,decode:i}=Lr(e,t);return ht({prefix:r,name:t,encode:n,decode:o=>J(i(o))})},si=(r,t,e,n)=>{let i={};for(let b=0;b<t.length;++b)i[t[b]]=b;let o=r.length;for(;r[o-1]==="=";)--o;let c=new Uint8Array(o*e/8|0),h=0,d=0,l=0;for(let b=0;b<o;++b){let w=i[r[b]];if(w===void 0)throw new SyntaxError(`Non-${n} character`);d=d<<e|w,h+=e,h>=8&&(h-=8,c[l++]=255&d>>h)}if(h>=e||255&d<<8-h)throw new SyntaxError("Unexpected end of data");return c},ai=(r,t,e)=>{let n=t[t.length-1]==="=",i=(1<<e)-1,o="",c=0,h=0;for(let d=0;d<r.length;++d)for(h=h<<8|r[d],c+=8;c>e;)c-=e,o+=t[i&h>>c];if(c&&(o+=t[i&h<<e-c]),n)for(;o.length*e&7;)o+="=";return o},A=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>ht({prefix:t,name:r,encode(i){return ai(i,n,e)},decode(i){return si(i,n,e,r)}});var D=Y({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),ci=Y({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var be={};$(be,{base32:()=>Z,base32hex:()=>li,base32hexpad:()=>pi,base32hexpadupper:()=>mi,base32hexupper:()=>di,base32pad:()=>hi,base32padupper:()=>fi,base32upper:()=>ui,base32z:()=>gi});var Z=A({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ui=A({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),hi=A({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),fi=A({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),li=A({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),di=A({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),pi=A({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),mi=A({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),gi=A({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var wi=Ur,Tr=128,bi=127,yi=~bi,xi=Math.pow(2,31);function Ur(r,t,e){t=t||[],e=e||0;for(var n=e;r>=xi;)t[e++]=r&255|Tr,r/=128;for(;r&yi;)t[e++]=r&255|Tr,r>>>=7;return t[e]=r|0,Ur.bytes=e-n+1,t}var Ii=ye,Ai=128,Cr=127;function ye(r,n){var e=0,n=n||0,i=0,o=n,c,h=r.length;do{if(o>=h)throw ye.bytes=0,new RangeError("Could not decode varint");c=r[o++],e+=i<28?(c&Cr)<<i:(c&Cr)*Math.pow(2,i),i+=7}while(c>=Ai);return ye.bytes=o-n,e}var Ei=Math.pow(2,7),vi=Math.pow(2,14),Si=Math.pow(2,21),Li=Math.pow(2,28),Pi=Math.pow(2,35),Di=Math.pow(2,42),Ni=Math.pow(2,49),Fi=Math.pow(2,56),Ri=Math.pow(2,63),Ti=function(r){return r<Ei?1:r<vi?2:r<Si?3:r<Li?4:r<Pi?5:r<Di?6:r<Ni?7:r<Fi?8:r<Ri?9:10},Ci={encode:wi,decode:Ii,encodingLength:Ti},Ui=Ci,At=Ui;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 ot=(r,t)=>{let e=t.byteLength,n=lt(r),i=n+lt(e),o=new Uint8Array(i+e);return ft(r,o,0),ft(e,o,n),o.set(t,i),new dt(r,e,t,o)},Ot=r=>{let t=J(r),[e,n]=Et(t),[i,o]=Et(t.subarray(n)),c=t.subarray(n+o);if(c.byteLength!==i)throw new Error("Incorrect length");return new dt(e,i,c,t)},kr=(r,t)=>{if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&Pr(r.bytes,e.bytes)}},dt=class{constructor(t,e,n,i){this.code=t,this.size=e,this.digest=n,this.bytes=i}};var $r=(r,t)=>{let{bytes:e,version:n}=r;switch(n){case 0:return $i(e,xe(r),t||D.encoder);default:return Mi(e,xe(r),t||Z.encoder)}};var Mr=new WeakMap,xe=r=>{let t=Mr.get(r);if(t==null){let e=new Map;return Mr.set(r,e),e}return t},tt=class r{constructor(t,e,n,i){this.code=e,this.version=t,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:e}=this;if(t!==vt)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==Bi)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=ot(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&&kr(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:i,multihash:o,bytes:c}=e;return new r(n,i,o,c||Br(n,i,o.bytes))}else if(e[Oi]===!0){let{version:n,multihash:i,code:o}=e,c=Ot(i);return r.create(n,o,c)}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 i=Br(t,e,n.bytes);return new r(t,e,n,i)}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,i=J(t.subarray(n,n+e.multihashSize));if(i.byteLength!==e.multihashSize)throw new Error("Incorrect length");let o=i.subarray(e.multihashSize-e.digestSize),c=new dt(e.multihashCode,e.digestSize,o,i);return[e.version===0?r.createV0(c):r.createV1(e.codec,c),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[w,m]=Et(t.subarray(e));return e+=m,w},i=n(),o=vt;if(i===18?(i=0,e=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let c=e,h=n(),d=n(),l=e+d,b=l-c;return{version:i,codec:o,multihashCode:h,digestSize:d,multihashSize:b,size:l}}static parse(t,e){let[n,i]=ki(t,e),o=r.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return xe(o).set(n,t),o}},ki=(r,t)=>{switch(r[0]){case"Q":{let e=t||D;return[D.prefix,e.decode(`${D.prefix}${r}`)]}case D.prefix:{let e=t||D;return[D.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)]}}},$i=(r,t,e)=>{let{prefix:n}=e;if(n!==D.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let i=t.get(n);if(i==null){let o=e.encode(r).slice(1);return t.set(n,o),o}else return i},Mi=(r,t,e)=>{let{prefix:n}=e,i=t.get(n);if(i==null){let o=e.encode(r);return t.set(n,o),o}else return i},vt=112,Bi=18,Br=(r,t,e)=>{let n=lt(r),i=n+lt(t),o=new Uint8Array(i+e.byteLength);return ft(r,o,0),ft(t,o,n),o.set(e,i),o},Oi=Symbol.for("@ipld/js-cid/CID");function zt(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 Ie={};$(Ie,{base10:()=>zi});var zi=Y({prefix:"9",name:"base10",alphabet:"0123456789"});var Ae={};$(Ae,{base16:()=>Vi,base16upper:()=>_i});var Vi=A({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),_i=A({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Ee={};$(Ee,{base2:()=>ji});var ji=A({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var ve={};$(ve,{base256emoji:()=>Hi});var Or=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}"),Gi=Or.reduce((r,t,e)=>(r[e]=t,r),[]),Wi=Or.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function qi(r){return r.reduce((t,e)=>(t+=Gi[e],t),"")}function Xi(r){let t=[];for(let e of r){let n=Wi[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}var Hi=ht({prefix:"\u{1F680}",name:"base256emoji",encode:qi,decode:Xi});var Se={};$(Se,{base36:()=>Qi,base36upper:()=>Ji});var Qi=Y({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Ji=Y({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Pe={};$(Pe,{base64:()=>Zi,base64pad:()=>Ki,base64url:()=>Le,base64urlpad:()=>Yi});var Zi=A({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Ki=A({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Le=A({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Yi=A({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var De={};$(De,{base8:()=>to});var to=A({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Ne={};$(Ne,{identity:()=>eo});var eo=ht({prefix:"\0",name:"identity",encode:r=>Nr(r),decode:r=>Dr(r)});var _s=new TextEncoder,js=new TextDecoder;var Fe={};$(Fe,{identity:()=>so});var zr=0,io="identity",Vr=J,oo=r=>ot(zr,Vr(r)),so={code:zr,name:io,encode:Vr,digest:oo};var Ce={};$(Ce,{sha256:()=>ao,sha512:()=>co});var Te=({name:r,code:t,encode:e})=>new Re(r,t,e),Re=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?ot(this.code,e):e.then(n=>ot(this.code,n))}else throw Error("Unknown type, must be binary type")}};var jr=r=>async t=>new Uint8Array(await crypto.subtle.digest(r,t)),ao=Te({name:"sha2-256",code:18,encode:jr("SHA-256")}),co=Te({name:"sha2-512",code:19,encode:jr("SHA-512")});var St={...Ne,...Ee,...De,...Ie,...Ae,...be,...Se,...we,...Pe,...ve},Zs={...Ce,...Fe};function st(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function K(r=0){return globalThis.Buffer?.alloc!=null?st(globalThis.Buffer.alloc(r)):new Uint8Array(r)}function N(r=0){return globalThis.Buffer?.allocUnsafe!=null?st(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Wr(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var Gr=Wr("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Ue=Wr("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}),uo={utf8:Gr,"utf-8":Gr,hex:St.base16,latin1:Ue,ascii:Ue,binary:Ue,...St},Vt=uo;function C(r,t="utf8"){let e=Vt[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 ho=Math.pow(2,7),fo=Math.pow(2,14),lo=Math.pow(2,21),ke=Math.pow(2,28),$e=Math.pow(2,35),Me=Math.pow(2,42),Be=Math.pow(2,49),x=128,F=127;function U(r){if(r<ho)return 1;if(r<fo)return 2;if(r<lo)return 3;if(r<ke)return 4;if(r<$e)return 5;if(r<Me)return 6;if(r<Be)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function po(r,t,e=0){switch(U(r)){case 8:t[e++]=r&255|x,r/=128;case 7:t[e++]=r&255|x,r/=128;case 6:t[e++]=r&255|x,r/=128;case 5:t[e++]=r&255|x,r/=128;case 4:t[e++]=r&255|x,r>>>=7;case 3:t[e++]=r&255|x,r>>>=7;case 2:t[e++]=r&255|x,r>>>=7;case 1:{t[e++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return t}function mo(r,t,e=0){switch(U(r)){case 8:t.set(e++,r&255|x),r/=128;case 7:t.set(e++,r&255|x),r/=128;case 6:t.set(e++,r&255|x),r/=128;case 5:t.set(e++,r&255|x),r/=128;case 4:t.set(e++,r&255|x),r>>>=7;case 3:t.set(e++,r&255|x),r>>>=7;case 2:t.set(e++,r&255|x),r>>>=7;case 1:{t.set(e++,r&255),r>>>=7;break}default:throw new Error("unreachable")}return t}function go(r,t){let e=r[t],n=0;if(n+=e&F,e<x||(e=r[t+1],n+=(e&F)<<7,e<x)||(e=r[t+2],n+=(e&F)<<14,e<x)||(e=r[t+3],n+=(e&F)<<21,e<x)||(e=r[t+4],n+=(e&F)*ke,e<x)||(e=r[t+5],n+=(e&F)*$e,e<x)||(e=r[t+6],n+=(e&F)*Me,e<x)||(e=r[t+7],n+=(e&F)*Be,e<x))return n;throw new RangeError("Could not decode varint")}function wo(r,t){let e=r.get(t),n=0;if(n+=e&F,e<x||(e=r.get(t+1),n+=(e&F)<<7,e<x)||(e=r.get(t+2),n+=(e&F)<<14,e<x)||(e=r.get(t+3),n+=(e&F)<<21,e<x)||(e=r.get(t+4),n+=(e&F)*ke,e<x)||(e=r.get(t+5),n+=(e&F)*$e,e<x)||(e=r.get(t+6),n+=(e&F)*Me,e<x)||(e=r.get(t+7),n+=(e&F)*Be,e<x))return n;throw new RangeError("Could not decode varint")}function et(r,t,e=0){return t==null&&(t=N(U(r))),t instanceof Uint8Array?po(r,t,e):mo(r,t,e)}function j(r,t=0){return r instanceof Uint8Array?go(r,t):wo(r,t)}function B(r,t){t==null&&(t=r.reduce((i,o)=>i+o.length,0));let e=N(t),n=0;for(let i of r)e.set(i,n),n+=i.length;return st(e)}var _t=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,i){return this.readAtomically(()=>{let o=0,c=0,h=this.peekChar();if(h===void 0)return;let d=h==="0",l=2**(8*i)-1;for(;;){let b=this.readAtomically(()=>{let w=this.readChar();if(w===void 0)return;let m=Number.parseInt(w,t);if(!Number.isNaN(m))return m});if(b===void 0)break;if(o*=t,o+=b,o>l||(c+=1,e!==void 0&&c>e))return}if(c!==0)return!n&&d&&c>1?void 0:o})}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 i=n*2;if(n<e.length-3){let c=this.readSeparator(":",n,()=>this.readIPv4Addr());if(c!==void 0)return e[i]=c[0],e[i+1]=c[1],e[i+2]=c[2],e[i+3]=c[3],[i+4,!0]}let o=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(o===void 0)return[i,!1];e[i]=o>>8,e[i+1]=o&255}return[e.length,!1]};return this.readAtomically(()=>{let e=new Uint8Array(16),[n,i]=t(e);if(n===16)return e;if(i||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let o=new Uint8Array(14),c=16-(n+2),[h]=t(o.subarray(0,c));return e.set(o.subarray(0,h),16-h),e})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var qr=45,bo=15,mt=new _t;function Oe(r){if(!(r.length>bo))return mt.new(r).parseWith(()=>mt.readIPv4Addr())}function ze(r){if(r.includes("%")&&(r=r.split("%")[0]),!(r.length>qr))return mt.new(r).parseWith(()=>mt.readIPv6Addr())}function jt(r){if(r.includes("%")&&(r=r.split("%")[0]),!(r.length>qr))return mt.new(r).parseWith(()=>mt.readIPAddr())}var xa=parseInt("0xFFFF",16),Ia=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);function Pt(r,t="utf8"){let e=Vt[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?st(globalThis.Buffer.from(r,"utf-8")):e.decoder.decode(`${e.prefix}${r}`)}function Gt(r){return!!Oe(r)}function Wt(r){return!!ze(r)}function gt(r){return!!jt(r)}var Qr=Gt,Eo=Wt,Ve=function(r){let t=0;if(r=r.toString().trim(),Qr(r)){let e=new Uint8Array(t+4);return r.split(/\./g).forEach(n=>{e[t++]=parseInt(n,10)&255}),e}if(Eo(r)){let e=r.split(":",8),n;for(n=0;n<e.length;n++){let o=Qr(e[n]),c;o&&(c=Ve(e[n]),e[n]=C(c.slice(0,2),"base16")),c!=null&&++n<8&&e.splice(n,0,C(c.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 o=[n,1];for(n=9-e.length;n>0;n--)o.push("0");e.splice.apply(e,o)}let i=new Uint8Array(t+16);for(n=0;n<e.length;n++){let o=parseInt(e[n],16);i[t++]=o>>8&255,i[t++]=o&255}return i}throw new Error("invalid ip address")},Jr=function(r,t=0,e){t=~~t,e=e??r.length-t;let n=new DataView(r.buffer);if(e===4){let i=[];for(let o=0;o<e;o++)i.push(r[t+o]);return i.join(".")}if(e===16){let i=[];for(let o=0;o<e;o+=2)i.push(n.getUint16(t+o).toString(16));return i.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var wt={},_e={},So=[[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"]];So.forEach(r=>{let t=Lo(...r);_e[t.code]=t,wt[t.name]=t});function Lo(r,t,e,n,i){return{code:r,size:t,name:e,resolvable:!!n,path:!!i}}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 ac=I("ip4"),cc=I("ip6"),uc=I("ipcidr");function Ge(r,t){switch(I(r).code){case 4:case 41:return Do(t);case 42:return Yr(t);case 6:case 273:case 33:case 132:return en(t).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Yr(t);case 421:return To(t);case 444:return tn(t);case 445:return tn(t);case 466:return Ro(t);default:return C(t,"base16")}}function We(r,t){switch(I(r).code){case 4:return Zr(t);case 41:return Zr(t);case 42:return Kr(t);case 6:case 273:case 33:case 132:return qe(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Kr(t);case 421:return No(t);case 444:return Co(t);case 445:return Uo(t);case 466:return Fo(t);default:return Pt(t,"base16")}}var je=Object.values(St).map(r=>r.decoder),Po=function(){let r=je[0].or(je[1]);return je.slice(2).forEach(t=>r=r.or(t)),r}();function Zr(r){if(!gt(r))throw new Error("invalid ip address");return Ve(r)}function Do(r){let t=Jr(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 qe(r){let t=new ArrayBuffer(2);return new DataView(t).setUint16(0,r),new Uint8Array(t)}function en(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function Kr(r){let t=Pt(r),e=Uint8Array.from(et(t.length));return B([e,t],e.length+t.length)}function Yr(r){let t=j(r);if(r=r.slice(U(t)),r.length!==t)throw new Error("inconsistent lengths");return C(r)}function No(r){let t;r[0]==="Q"||r[0]==="1"?t=Ot(D.decode(`z${r}`)).bytes:t=tt.parse(r).multihash.bytes;let e=Uint8Array.from(et(t.length));return B([e,t],e.length+t.length)}function Fo(r){let t=Po.decode(r),e=Uint8Array.from(et(t.length));return B([e,t],e.length+t.length)}function Ro(r){let t=j(r),e=r.slice(U(t));if(e.length!==t)throw new Error("inconsistent lengths");return"u"+C(e,"base64url")}function To(r){let t=j(r),e=r.slice(U(t));if(e.length!==t)throw new Error("inconsistent lengths");return C(e,"base58btc")}function Co(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 i=qe(n);return B([e,i],e.length+i.length)}function Uo(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 i=qe(n);return B([e,i],e.length+i.length)}function tn(r){let t=r.slice(0,r.length-2),e=r.slice(r.length-2),n=C(t,"base32"),i=en(e);return`${n}:${i}`}function rn(r){r=Xe(r);let t=[],e=[],n=null,i=r.split("/").slice(1);if(i.length===1&&i[0]==="")return{bytes:new Uint8Array,string:"/",tuples:[],stringTuples:[],path:null};for(let o=0;o<i.length;o++){let c=i[o],h=I(c);if(h.size===0){t.push([h.code]),e.push([h.code]);continue}if(o++,o>=i.length)throw on("invalid address: "+r);if(h.path===!0){n=Xe(i.slice(o).join("/")),t.push([h.code,We(h.code,n)]),e.push([h.code,n]);break}let d=We(h.code,i[o]);t.push([h.code,d]),e.push([h.code,Ge(h.code,d)])}return{string:nn(e),bytes:Qe(t),tuples:t,stringTuples:e,path:n}}function He(r){let t=[],e=[],n=null,i=0;for(;i<r.length;){let o=j(r,i),c=U(o),h=I(o),d=ko(h,r.slice(i+c));if(d===0){t.push([o]),e.push([o]),i+=c;continue}let l=r.slice(i+c,i+c+d);if(i+=d+c,i>r.length)throw on("Invalid address Uint8Array: "+C(r,"base16"));t.push([o,l]);let b=Ge(o,l);if(e.push([o,b]),h.path===!0){n=b;break}}return{bytes:Uint8Array.from(r),string:nn(e),tuples:t,stringTuples:e,path:n}}function nn(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}),Xe(t.join("/"))}function Qe(r){return B(r.map(t=>{let e=I(t[0]),n=Uint8Array.from(et(e.code));return t.length>1&&t[1]!=null&&(n=B([n,t[1]])),n}))}function ko(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+U(e)}}function Xe(r){return"/"+r.trim().split("/").filter(t=>t).join("/")}function on(r){return new Error("Error parsing address: "+r)}var $o=Symbol.for("nodejs.util.inspect.custom"),Je=Symbol.for("@multiformats/js-multiaddr/multiaddr"),Mo=[I("dns").code,I("dns4").code,I("dns6").code,I("dnsaddr").code],qt=class r{bytes;#e;#t;#r;#n;[Je]=!0;constructor(t){t==null&&(t="");let e;if(t instanceof Uint8Array)e=He(t);else if(typeof t=="string"){if(t.length>0&&t.charAt(0)!=="/")throw new Error(`multiaddr "${t}" must start with a "/"`);e=rn(t)}else if(an(t))e=He(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,i,o="",c=I("tcp"),h=I("udp"),d=I("ip4"),l=I("ip6"),b=I("dns6"),w=I("ip6zone");for(let[s,a]of this.stringTuples())s===w.code&&(o=`%${a??""}`),Mo.includes(s)&&(e=c.name,i=443,n=`${a??""}${o}`,t=s===b.code?6:4),(s===c.code||s===h.code)&&(e=I(s).name,i=parseInt(a??"")),(s===d.code||s===l.code)&&(e=I(s).name,n=`${a??""}${o}`,t=s===l.code?6:4);if(t==null||e==null||n==null||i==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:i}}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(),i=n.lastIndexOf(e);if(i<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${t.toString()}`);return new r(n.slice(0,i))}decapsulateCode(t){let e=this.tuples();for(let n=e.length-1;n>=0;n--)if(e[n][0]===t)return new r(Qe(e.slice(0,n)));return this}getPeerId(){try{let t=[];this.stringTuples().forEach(([n,i])=>{n===wt.p2p.code&&t.push([n,i]),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(D.decode(`z${n}`),"base58btc"):C(tt.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return this.#n}equals(t){return zt(this.bytes,t.bytes)}async resolve(t){let e=this.protos().find(o=>o.resolvable);if(e==null)return[this];let n=sn.get(e.name);if(n==null)throw new _(`no available resolver for ${e.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,t)).map(o=>new r(o))}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)}[$o](){return`Multiaddr(${this.#e})`}};var sn=new Map;function an(r){return!!r?.[Je]}function Ze(r){return new qt(r)}var cn=()=>{let r=new Error("Delay aborted");return r.name="AbortError",r},Bo=new WeakMap;function Oo({clearTimeout:r,setTimeout:t}={}){return(e,{value:n,signal:i}={})=>{if(i?.aborted)return Promise.reject(cn());let o,c,h,d=r??clearTimeout,l=()=>{d(o),h(cn())},b=()=>{i&&i.removeEventListener("abort",l)},w=new Promise((m,s)=>{c=()=>{b(),m(n)},h=s,o=(t??setTimeout)(c,e)});return i&&i.addEventListener("abort",l,{once:!0}),Bo.set(w,()=>{d(o),o=null,c()}),w}}var zo=Oo(),un=zo;function Xt(){let r={};return r.promise=new Promise((t,e)=>{r.resolve=t,r.reject=e}),r}var Ht=class{buffer;mask;top;btm;next;constructor(t){if(!(t>0)||t-1&t)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(t),this.mask=t-1,this.top=0,this.btm=0,this.next=null}push(t){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=t,this.top=this.top+1&this.mask,!0)}shift(){let t=this.buffer[this.btm];if(t!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,t}isEmpty(){return this.buffer[this.btm]===void 0}},bt=class{size;hwm;head;tail;constructor(t={}){this.hwm=t.splitLimit??16,this.head=new Ht(this.hwm),this.tail=this.head,this.size=0}calculateSize(t){return t?.byteLength!=null?t.byteLength:1}push(t){if(t?.value!=null&&(this.size+=this.calculateSize(t.value)),!this.head.push(t)){let e=this.head;this.head=e.next=new Ht(2*this.head.buffer.length),this.head.push(t)}}shift(){let t=this.tail.shift();if(t===void 0&&this.tail.next!=null){let e=this.tail.next;this.tail.next=null,this.tail=e,t=this.tail.shift()}return t?.value!=null&&(this.size-=this.calculateSize(t.value)),t}isEmpty(){return this.head.isEmpty()}};var Ke=class extends Error{type;code;constructor(t,e){super(t??"The operation was aborted"),this.type="aborted",this.code=e??"ABORT_ERR"}};function hn(r={}){return Vo(e=>{let n=e.shift();if(n==null)return{done:!0};if(n.error!=null)throw n.error;return{done:n.done===!0,value:n.value}},r)}function Vo(r,t){t=t??{};let e=t.onEnd,n=new bt,i,o,c,h=Xt(),d=async()=>{try{return n.isEmpty()?c?{done:!0}:await new Promise((u,p)=>{o=g=>{o=null,n.push(g);try{u(r(n))}catch(y){p(y)}return i}}):r(n)}finally{n.isEmpty()&&queueMicrotask(()=>{h.resolve(),h=Xt()})}},l=u=>o!=null?o(u):(n.push(u),i),b=u=>(n=new bt,o!=null?o({error:u}):(n.push({error:u}),i)),w=u=>{if(c)return i;if(t?.objectMode!==!0&&u?.byteLength==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return l({done:!1,value:u})},m=u=>c?i:(c=!0,u!=null?b(u):l({done:!0})),s=()=>(n=new bt,m(),{done:!0}),a=u=>(m(u),{done:!0});if(i={[Symbol.asyncIterator](){return this},next:d,return:s,throw:a,push:w,end:m,get readableLength(){return n.size},onEmpty:async u=>{let p=u?.signal;if(p?.throwIfAborted(),n.isEmpty())return;let g,y;p!=null&&(g=new Promise((P,T)=>{y=()=>{T(new Ke)},p.addEventListener("abort",y)}));try{await Promise.race([h.promise,g])}finally{y!=null&&p!=null&&p?.removeEventListener("abort",y)}}},e==null)return i;let f=i;return i={[Symbol.asyncIterator](){return this},next(){return f.next()},throw(u){return f.throw(u),e!=null&&(e(u),e=void 0),{done:!0}},return(){return f.return(),e!=null&&(e(),e=void 0),{done:!0}},push:w,end(u){return f.end(u),e!=null&&(e(u),e=void 0),i},get readableLength(){return f.readableLength}},i}var ln=Symbol.for("@achingbrain/uint8arraylist");function fn(r,t){if(t==null||t<0)throw new RangeError("index is out of bounds");let e=0;for(let n of r){let i=e+n.byteLength;if(t<i)return{buf:n,index:t-e};e=i}throw new RangeError("index is out of bounds")}function Qt(r){return!!r?.[ln]}var O=class r{constructor(...t){Object.defineProperty(this,ln,{value:!0}),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(Qt(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(Qt(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=fn(this.bufs,t);return e.buf[e.index]}set(t,e){let n=fn(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(Qt(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:i}=this._subList(t,e);return B(n,i)}subarray(t,e){let{bufs:n,length:i}=this._subList(t,e);return n.length===1?n[0]:B(n,i)}sublist(t,e){let{bufs:n,length:i}=this._subList(t,e),o=new r;return o.length=i,o.bufs=n,o}_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=[],i=0;for(let o=0;o<this.bufs.length;o++){let c=this.bufs[o],h=i,d=h+c.byteLength;if(i=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(c);break}let w=t-h;n.push(c.subarray(w,w+(e-t)));break}if(l){if(t===0){n.push(c);continue}n.push(c.subarray(t-h));continue}if(b){if(e===d){n.push(c);break}n.push(c.subarray(0,e-h));break}n.push(c)}return{bufs:n,length:e-t}}indexOf(t,e=0){if(!Qt(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 i=n.byteLength;if(i===0)throw new TypeError("search must be at least 1 byte long");let o=256,c=new Int32Array(o);for(let w=0;w<o;w++)c[w]=-1;for(let w=0;w<i;w++)c[n[w]]=w;let h=c,d=this.byteLength-n.byteLength,l=n.byteLength-1,b;for(let w=e;w<=d;w+=b){b=0;for(let m=l;m>=0;m--){let s=this.get(w+m);if(n[m]!==s){b=Math.max(1,m-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 i=K(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt16(0,e,n),this.write(i,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 i=K(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt32(0,e,n),this.write(i,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 i=K(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigInt64(0,e,n),this.write(i,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 i=K(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint16(0,e,n),this.write(i,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 i=K(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,e,n),this.write(i,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 i=K(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigUint64(0,e,n),this.write(i,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 i=K(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat32(0,e,n),this.write(i,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 i=K(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat64(0,e,n),this.write(i,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(!zt(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((i,o)=>i+o.byteLength,0)),n.length=e,n}};var Jt=class extends Error{code;constructor(t,e){super(t),this.code=e}},Ye=class extends Jt{type;constructor(t){super(t,"ABORT_ERR"),this.type="aborted"}};function dn(r){let t=hn();r.sink(t).catch(o=>{t.end(o)}),r.sink=async o=>{for await(let c of o)t.push(c);t.end()};let e=r.source;r.source[Symbol.iterator]!=null?e=r.source[Symbol.iterator]():r.source[Symbol.asyncIterator]!=null&&(e=r.source[Symbol.asyncIterator]());let n=new O;return{read:async(o,c)=>{c?.signal?.throwIfAborted();let h,d=new Promise((l,b)=>{h=()=>{b(new Ye("Read aborted"))},c?.signal?.addEventListener("abort",h)});try{if(o==null){let{done:b,value:w}=await Promise.race([e.next(),d]);return b===!0?new O:w}for(;n.byteLength<o;){let{value:b,done:w}=await Promise.race([e.next(),d]);if(w===!0)throw new Jt("unexpected end of input","ERR_UNEXPECTED_EOF");n.append(b)}let l=n.sublist(0,o);return n.consume(o),l}finally{h!=null&&c?.signal?.removeEventListener("abort",h)}},write:async(o,c)=>{c?.signal?.throwIfAborted(),o instanceof Uint8Array?t.push(o):t.push(o.subarray()),await t.onEmpty(c)},unwrap:()=>{let o=r.source;return r.source=async function*(){yield*n,yield*o}(),r}}}function Zt(r){return r[Symbol.asyncIterator]!=null}var Kt=r=>{let t=U(r),e=N(t);return et(r,e),Kt.bytes=t,e};Kt.bytes=0;function Dt(r,t){t=t??{};let e=t.lengthEncoder??Kt;function*n(i){let o=e(i.byteLength);o instanceof Uint8Array?yield o:yield*o,i instanceof Uint8Array?yield i:yield*i}return Zt(r)?async function*(){for await(let i of r)yield*n(i)}():function*(){for(let i of r)yield*n(i)}()}Dt.single=(r,t)=>{t=t??{};let e=t.lengthEncoder??Kt;return new O(e(r.byteLength),r)};var yt=le(gn(),1);var jo=8,Go=1024*1024*4,at;(function(r){r[r.LENGTH=0]="LENGTH",r[r.DATA=1]="DATA"})(at||(at={}));var er=r=>{let t=j(r);return er.bytes=U(t),t};er.bytes=0;function tr(r,t){let e=new O,n=at.LENGTH,i=-1,o=t?.lengthDecoder??er,c=t?.maxLengthLength??jo,h=t?.maxDataLength??Go;function*d(){for(;e.byteLength>0;){if(n===at.LENGTH)try{if(i=o(e),i<0)throw(0,yt.default)(new Error("invalid message length"),"ERR_INVALID_MSG_LENGTH");if(i>h)throw(0,yt.default)(new Error("message length too long"),"ERR_MSG_DATA_TOO_LONG");let l=o.bytes;e.consume(l),t?.onLength!=null&&t.onLength(i),n=at.DATA}catch(l){if(l instanceof RangeError){if(e.byteLength>c)throw(0,yt.default)(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG");break}throw l}if(n===at.DATA){if(e.byteLength<i)break;let l=e.sublist(0,i);e.consume(i),t?.onData!=null&&t.onData(l),yield l,n=at.LENGTH}}}return Zt(r)?async function*(){for await(let l of r)e.append(l),yield*d();if(e.byteLength>0)throw(0,yt.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,yt.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}()}tr.fromReader=(r,t)=>{let e=1,n=async function*(){for(;;)try{let{done:o,value:c}=await r.next(e);if(o===!0)return;c!=null&&(yield c)}catch(o){if(o.code==="ERR_UNDER_READ")return{done:!0,value:null};throw o}finally{e=1}}();return tr(n,{...t??{},onLength:o=>{e=o}})};var Yt=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);return{read:async i=>{let o=-1,c=new O,h=t?.lengthDecoder??wn;for(;;){c.append(await e.read(1,i));try{o=h(c)}catch(d){if(d instanceof RangeError)continue;throw d}if(o>-1)break;if(t?.maxLengthLength!=null&&c.byteLength>t.maxLengthLength)throw new Yt("message length length too long","ERR_MSG_LENGTH_TOO_LONG")}if(t?.maxDataLength!=null&&o>t.maxDataLength)throw new Yt("message length too long","ERR_MSG_DATA_TOO_LONG");return e.read(o,i)},write:async(i,o)=>{await e.write(Dt.single(i,t),o)},writeV:async(i,o)=>{let c=new O(...i.map(h=>Dt.single(h,t)));await e.write(c,o)},unwrap:()=>e.unwrap()}}function rr(r,t){let e=bn(r,t),n={read:async(i,o)=>{let c=await e.read(o);return i.decode(c)},write:async(i,o,c)=>{await e.write(o.encode(i),c)},writeV:async(i,o,c)=>{await e.writeV(i.map(h=>o.encode(h)),c)},pb:i=>({read:async o=>n.read(i,o),write:async(o,c)=>n.write(o,i,c),writeV:async(o,c)=>n.writeV(o,i,c),unwrap:()=>n}),unwrap:()=>e.unwrap()};return n}var nr=new Float32Array([-0]),rt=new Uint8Array(nr.buffer);function yn(r,t,e){nr[0]=r,t[e]=rt[0],t[e+1]=rt[1],t[e+2]=rt[2],t[e+3]=rt[3]}function xn(r,t){return rt[0]=r[t],rt[1]=r[t+1],rt[2]=r[t+2],rt[3]=r[t+3],nr[0]}var ir=new Float64Array([-0]),R=new Uint8Array(ir.buffer);function In(r,t,e){ir[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],ir[0]}var qo=BigInt(Number.MAX_SAFE_INTEGER),Xo=BigInt(Number.MIN_SAFE_INTEGER),k=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<qo&&t>Xo)return this.fromNumber(Number(t));let e=t<0n;e&&(t=-t);let n=t>>32n,i=t-(n<<32n);return e&&(n=~n|0n,i=~i|0n,++i>En&&(i=0n,++n>En&&(n=0n))),new r(Number(i),Number(n))}static fromNumber(t){if(t===0)return ct;let e=t<0;e&&(t=-t);let n=t>>>0,i=(t-n)/4294967296>>>0;return e&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new r(n,i)}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 k(0,0);ct.toBigInt=function(){return 0n};ct.zzEncode=ct.zzDecode=function(){return this};ct.length=function(){return 1};var En=4294967296n;function vn(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 i,o=[],c=0,h;for(;t<e;)h=r[t++],h<128?o[c++]=h:h>191&&h<224?o[c++]=(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,o[c++]=55296+(h>>10),o[c++]=56320+(h&1023)):o[c++]=(h&15)<<12|(r[t++]&63)<<6|r[t++]&63,c>8191&&((i??(i=[])).push(String.fromCharCode.apply(String,o)),c=0);return i!=null?(c>0&&i.push(String.fromCharCode.apply(String,o.slice(0,c))),i.join("")):String.fromCharCode.apply(String,o.slice(0,c))}function or(r,t,e){let n=e,i,o;for(let c=0;c<r.length;++c)i=r.charCodeAt(c),i<128?t[e++]=i:i<2048?(t[e++]=i>>6|192,t[e++]=i&63|128):(i&64512)===55296&&((o=r.charCodeAt(c+1))&64512)===56320?(i=65536+((i&1023)<<10)+(o&1023),++c,t[e++]=i>>18|240,t[e++]=i>>12&63|128,t[e++]=i>>6&63|128,t[e++]=i&63|128):(t[e++]=i>>12|224,t[e++]=i>>6&63|128,t[e++]=i&63|128);return e-n}function G(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 sr=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 te(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw G(this,4);return te(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw G(this,4);let t=xn(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 k(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=te(this.buf,this.pos+=4),e=te(this.buf,this.pos+=4);return new k(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 ar(r){return new sr(r instanceof Uint8Array?r:r.subarray())}function cr(r,t){let e=ar(r);return t.decode(e)}function ur(r){let t=r??8192,e=t>>>1,n,i=t;return function(c){if(c<1||c>e)return N(c);i+c>t&&(n=N(t),i=0);let h=n.subarray(i,i+=c);return i&7&&(i=(i|7)+1),h}}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 hr(){}var lr=class{head;tail;len;next;constructor(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}},Ho=ur();function Qo(r){return globalThis.Buffer!=null?N(r):Ho(r)}var Rt=class{len;head;tail;states;constructor(){this.len=0,this.head=new ut(hr,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 dr((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(Nt,10,k.fromNumber(t)):this.uint32(t)}sint32(t){return this.uint32((t<<1^t>>31)>>>0)}uint64(t){let e=k.fromBigInt(t);return this._push(Nt,e.length(),e)}uint64Number(t){let e=k.fromNumber(t);return this._push(Nt,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=k.fromBigInt(t).zzEncode();return this._push(Nt,e.length(),e)}sint64Number(t){let e=k.fromNumber(t).zzEncode();return this._push(Nt,e.length(),e)}sint64String(t){return this.sint64(BigInt(t))}bool(t){return this._push(fr,1,t?1:0)}fixed32(t){return this._push(Ft,4,t>>>0)}sfixed32(t){return this.fixed32(t)}fixed64(t){let e=k.fromBigInt(t);return this._push(Ft,4,e.lo)._push(Ft,4,e.hi)}fixed64Number(t){let e=k.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(yn,4,t)}double(t){return this._push(In,8,t)}bytes(t){let e=t.length>>>0;return e===0?this._push(fr,1,0):this.uint32(e)._push(Zo,e,t)}string(t){let e=vn(t);return e!==0?this.uint32(e)._push(or,e,t):this._push(fr,1,0)}fork(){return this.states=new lr(this),this.head=this.tail=new ut(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 ut(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=Qo(this.len),n=0;for(;t!=null;)t.fn(t.val,e,n),n+=t.len,t=t.next;return e}};function fr(r,t,e){t[e]=r&255}function Jo(r,t,e){for(;r>127;)t[e++]=r&127|128,r>>>=7;t[e]=r}var dr=class extends ut{next;constructor(t,e){super(Jo,t,e),this.next=void 0}};function Nt(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 Zo(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(Ko,t,r),this},Rt.prototype.string=function(r){let t=globalThis.Buffer.byteLength(r);return this.uint32(t),t>0&&this._push(Yo,t,r),this});function Ko(r,t,e){t.set(r,e)}function Yo(r,t,e){r.length<40?or(r,t,e):t.utf8Write!=null?t.utf8Write(r,e):t.set(Pt(r),e)}function pr(){return new Rt}function mr(r,t){let e=pr();return t.encode(r,e,{lengthDelimited:!1}),e.finish()}var xt;(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"})(xt||(xt={}));function ee(r,t,e,n){return{name:r,type:t,encode:e,decode:n}}function gr(r){function t(i){if(r[i.toString()]==null)throw new Error("Invalid enum value");return r[i]}let e=function(o,c){let h=t(o);c.int32(h)},n=function(o){let c=o.int32();return t(c)};return ee("enum",xt.VARINT,e,n)}function wr(r,t){return ee("message",xt.LENGTH_DELIMITED,r,t)}var W;(function(r){let t;(function(i){i.UNUSED="UNUSED",i.CONNECT="CONNECT",i.SYNC="SYNC"})(t=r.Type||(r.Type={}));let e;(function(i){i[i.UNUSED=0]="UNUSED",i[i.CONNECT=100]="CONNECT",i[i.SYNC=300]="SYNC"})(e||(e={})),function(i){i.codec=()=>gr(e)}(t=r.Type||(r.Type={}));let n;r.codec=()=>(n==null&&(n=wr((i,o,c={})=>{if(c.lengthDelimited!==!1&&o.fork(),i.type!=null&&(o.uint32(8),r.Type.codec().encode(i.type,o)),i.observedAddresses!=null)for(let h of i.observedAddresses)o.uint32(18),o.bytes(h);c.lengthDelimited!==!1&&o.ldelim()},(i,o)=>{let c={observedAddresses:[]},h=o==null?i.len:i.pos+o;for(;i.pos<h;){let d=i.uint32();switch(d>>>3){case 1:c.type=r.Type.codec().decode(i);break;case 2:c.observedAddresses.push(i.bytes());break;default:i.skipType(d&7);break}}return c})),n),r.encode=i=>mr(i,r.codec()),r.decode=i=>cr(i,r.codec())})(W||(W={}));var ts=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}),ie=()=>({match:r=>Tt(t=>typeof t=="string").match(r),pattern:"{string}"}),Pn=()=>({match:r=>Tt(t=>!isNaN(parseInt(t))).match(r),pattern:"{number}"}),z=()=>({match:r=>{if(r.length<2||r[0]!=="p2p"&&r[0]!=="ipfs")return!1;if(r[1].startsWith("Q")||r[1].startsWith("1"))try{D.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{Le.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 i=n.match(t);i!==!1&&(e==null||i.length<e.length)&&(e=i)}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(i){let o=ts(i);for(let c of r){let h=c.match(o);if(h===!1)return!1;o=h}return o}function e(i){return t(i)!==!1}function n(i){let o=t(i);return o===!1?!1:o.length===0}return{matches:e,exactMatch:n}}var yr=v(E("dns4"),ie()),xr=v(E("dns6"),ie()),Ir=v(E("dnsaddr"),ie()),Dn=v(E("dns"),ie()),Gu=L(yr),Wu=L(xr),qu=L(Ir),Nn=L(H(Dn,Ir,yr,xr)),Fn=v(E("ip4"),Tt(Gt)),Rn=v(E("ip6"),Tt(Wt)),Tn=H(Fn,Rn),Ct=H(Tn,Dn,yr,xr,Ir),Xu=L(Ct),Hu=L(Fn),Qu=L(Rn),Cn=L(Tn),oe=v(Ct,E("tcp"),Pn()),Ut=v(Ct,E("udp"),Pn()),es=H(oe,Ut),Ju=L(oe),Zu=L(Ut),Ar=v(Ut,E("quic")),se=v(Ut,E("quic-v1")),rs=H(Ar,se),Ku=L(Ar),Yu=L(se),br=H(Ct,oe,Ut,Ar,se),Un=H(v(br,E("ws"),X(z()))),th=L(Un),kn=H(v(br,E("wss"),X(z())),v(br,E("tls"),E("ws"),X(z()))),eh=L(kn),$n=v(es,E("webrtc-direct"),re(),X(re()),X(z())),rh=L($n),Mn=v(se,E("webtransport"),re(),re(),X(z())),nh=L(Mn),ne=H(Un,kn,v(oe,X(z())),v(rs,X(z())),v(Ct,X(z())),$n,Mn,z()),ih=L(ne),ns=v(ne,E("p2p-circuit"),z()),Bn=L(ns),is=H(v(ne,E("p2p-circuit"),E("webrtc"),z()),v(ne,E("webrtc"),X(z())),E("webrtc")),oh=L(is);var Wn=le(On(),1);var zn="[a-fA-F\\d:]",nt=r=>r&&r.includeBoundaries?`(?:(?<=\\s|^)(?=${zn})|(?<=${zn})(?=\\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}",ae=`
3
+ (?:
4
+ (?:${S}:){7}(?:${S}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
5
+ (?:${S}:){6}(?:${q}|:${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}(?::${q}|(?::${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}:${q}|(?::${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}:${q}|(?::${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}:${q}|(?::${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}:${q}|(?::${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}:${q}|(?::${S}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4
12
+ )(?:%[0-9a-zA-Z]{1,})? // %eth0 %1
13
+ `.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),os=new RegExp(`(?:^${q}$)|(?:^${ae}$)`),ss=new RegExp(`^${q}$`),as=new RegExp(`^${ae}$`),Er=r=>r&&r.exact?os:new RegExp(`(?:${nt(r)}${q}${nt(r)})|(?:${nt(r)}${ae}${nt(r)})`,"g");Er.v4=r=>r&&r.exact?ss:new RegExp(`${nt(r)}${q}${nt(r)}`,"g");Er.v6=r=>r&&r.exact?as:new RegExp(`${nt(r)}${ae}${nt(r)}`,"g");var Vn=Er;var qn=le(jn(),1),{isValid:cs,parse:us}=qn.default,hs=["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"],fs=hs.map(r=>new Wn.Netmask(r));function ls(r){for(let t of fs)if(t.contains(r))return!0;return!1}function Gn(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 Xn=r=>{if(cs(r)){let t=us(r);if(t.kind()==="ipv4")return ls(t.toNormalizedString());if(t.kind()==="ipv6")return Gn(r)}else if(gt(r)&&Vn.v6().test(r))return Gn(r)};var Hn=Xn;function vr(r,t){return Bn.matches(r)||t.transportForMultiaddr(r)==null?!1:Nn.matches(r)?!0:Cn.matches(r)?Hn(r.toOptions().host)===!1:!1}var Qn=1024*4,Jn=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 i={signal:AbortSignal.timeout(this.timeout)};try{e=await t.newStream([It],{signal:i.signal,runOnTransientConnection:!0});let o=rr(e,{maxDataLength:Qn}).pb(W);this.log("B sending connect to %p",t.remotePeer);let c=Date.now();await o.write({type:W.Type.CONNECT,observedAddresses:this.addressManager.getAddresses().map(w=>w.bytes)},i),this.log("B receiving connect from %p",t.remotePeer);let h=await o.read(i);if(h.type!==W.Type.CONNECT)throw this.log("A sent wrong message type"),new _("DCUtR message type was incorrect",it);let d=this.getDialableMultiaddrs(h.observedAddresses);if(d.length===0)throw this.log("A did not have any dialable multiaddrs"),new _("DCUtR connect message had no multiaddrs",it);let l=Date.now()-c;this.log("A sending sync, rtt %dms",l),await o.write({type:W.Type.SYNC,observedAddresses:[]},i),this.log("A waiting for half RTT"),await un(l/2),this.log("B dialing",d);let b=await this.connectionManager.openConnection(d,{signal:i.signal,priority:Jn});this.log("DCUtR to %p succeeded to address %a, closing relayed connection",t.remotePeer,b.remoteAddr),await t.close(i);break}catch(o){if(this.log.error("error while attempting DCUtR on attempt %d of %d",n+1,this.retries,o),e?.abort(o),n===this.retries)throw o}finally{e!=null&&await e.close(i)}}}async attemptUnilateralConnectionUpgrade(t){let n=(await this.peerStore.get(t.remotePeer)).addresses.map(i=>{let o=i.multiaddr;return o.getPeerId()==null?o.encapsulate(`/p2p/${t.remotePeer}`):o}).filter(i=>vr(i,this.transportManager));if(n.length>0){let i=AbortSignal.timeout(this.timeout);try{this.log("attempting unilateral connection upgrade to %a",n);let o=await this.connectionManager.openConnection(n,{signal:i,force:!0});if(o.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,o.remoteAddr),await t.close({signal:i}),!0}catch(o){this.log.error("unilateral connection upgrade to %p on addresses %a failed",t.remotePeer,n,o)}}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 i=rr(t,{maxDataLength:Qn}).pb(W);this.log("A receiving connect");let o=await i.read(n);if(o.type!==W.Type.CONNECT)throw this.log("B sent wrong message type"),new _("DCUtR message type was incorrect",it);if(o.observedAddresses.length===0)throw this.log("B sent no multiaddrs"),new _("DCUtR connect message had no multiaddrs",it);let c=this.getDialableMultiaddrs(o.observedAddresses);if(c.length===0)throw this.log("B had no dialable multiaddrs"),new _("DCUtR connect message had no dialable multiaddrs",it);if(this.log("A sending connect"),await i.write({type:W.Type.CONNECT,observedAddresses:this.addressManager.getAddresses().map(l=>l.bytes)}),this.log("A receiving sync"),(await i.read(n)).type!==W.Type.SYNC)throw new _("DCUtR message type was incorrect",it);this.log("A dialing",c);let d=await this.connectionManager.openConnection(c,{signal:n.signal,priority:Jn,force:!0});this.log("DCUtR to %p succeeded via %a, closing relayed connection",e.remotePeer,d.remoteAddr),await e.close(n)}catch(i){this.log.error("incoming DCUtR from %p failed",e.remotePeer,i),t.abort(i)}finally{await t.close(n)}}getDialableMultiaddrs(t){let e=[];for(let n of t)if(!(n==null||n.length===0))try{let i=Ze(n);if(!vr(i,this.transportManager))continue;e.push(i)}catch{}return e}};var It="/libp2p/dcutr";function ds(r={}){return t=>new he(t,r)}return ri(ps);})();
14
+ return Libp2PDcutr}));
@@ -0,0 +1,44 @@
1
+ import { type Multiaddr } from '@multiformats/multiaddr';
2
+ import type { DCUtRServiceComponents, DCUtRServiceInit } from './index.js';
3
+ import type { Connection, Stream } from '@libp2p/interface/connection';
4
+ import type { Startable } from '@libp2p/interface/startable';
5
+ export declare class DefaultDCUtRService implements Startable {
6
+ private started;
7
+ private readonly timeout;
8
+ private readonly retries;
9
+ private readonly maxInboundStreams;
10
+ private readonly maxOutboundStreams;
11
+ private readonly peerStore;
12
+ private readonly registrar;
13
+ private readonly connectionManager;
14
+ private readonly addressManager;
15
+ private readonly transportManager;
16
+ private topologyId?;
17
+ private readonly log;
18
+ constructor(components: DCUtRServiceComponents, init: DCUtRServiceInit);
19
+ isStarted(): boolean;
20
+ start(): Promise<void>;
21
+ stop(): Promise<void>;
22
+ /**
23
+ * Perform the inbound connection upgrade as B
24
+ *
25
+ * @see https://github.com/libp2p/specs/blob/master/relay/DCUtR.md#the-protocol
26
+ */
27
+ upgradeInbound(relayedConnection: Connection): Promise<void>;
28
+ /**
29
+ * This is performed when A has dialed B via a relay but A also has a public
30
+ * address that B can dial directly
31
+ */
32
+ attemptUnilateralConnectionUpgrade(relayedConnection: Connection): Promise<boolean>;
33
+ /**
34
+ * Perform the connection upgrade as A
35
+ *
36
+ * @see https://github.com/libp2p/specs/blob/master/relay/DCUtR.md#the-protocol
37
+ */
38
+ handleIncomingUpgrade(stream: Stream, relayedConnection: Connection): Promise<void>;
39
+ /**
40
+ * Takes the `addr` and converts it to a Multiaddr if possible
41
+ */
42
+ getDialableMultiaddrs(addrs: Array<Uint8Array | string | null | undefined>): Multiaddr[];
43
+ }
44
+ //# sourceMappingURL=dcutr.d.ts.map
@@ -0,0 +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;AAE1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAEtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAA;AAoB5D,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"}