@libp2p/daemon-server 6.0.0 → 6.0.1
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 +4 -4
- package/package.json +2 -2
package/dist/index.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PDaemonServer = factory()}(typeof self !== 'undefined' ? self : this, function () {
|
|
2
|
-
"use strict";var Libp2PDaemonServer=(()=>{var vh=Object.create;var tn=Object.defineProperty;var Eh=Object.getOwnPropertyDescriptor;var Sh=Object.getOwnPropertyNames;var Ah=Object.getPrototypeOf,Th=Object.prototype.hasOwnProperty;var Rt=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var P=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),U=(r,t)=>{for(var e in t)tn(r,e,{get:t[e],enumerable:!0})},Xs=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Sh(t))!Th.call(r,o)&&o!==e&&tn(r,o,{get:()=>t[o],enumerable:!(n=Eh(t,o))||n.enumerable});return r};var G=(r,t,e)=>(e=r!=null?vh(Ah(r)):{},Xs(t||!r||!r.__esModule?tn(e,"default",{value:r,enumerable:!0}):e,r)),Ih=r=>Xs(tn({},"__esModule",{value:!0}),r);var Ks=P((Vg,Ws)=>{"use strict";Ws.exports=Ch;function Ch(r,t){for(var e=new Array(arguments.length-1),n=0,o=2,i=!0;o<arguments.length;)e[n++]=arguments[o++];return new Promise(function(u,l){e[n]=function(h){if(i)if(i=!1,h)l(h);else{for(var b=new Array(arguments.length-1),w=0;w<b.length;)b[w++]=arguments[w];u.apply(null,b)}};try{r.apply(t||null,e)}catch(m){i&&(i=!1,l(m))}})}});var ta=P(Ys=>{"use strict";var en=Ys;en.length=function(t){var e=t.length;if(!e)return 0;for(var n=0;--e%4>1&&t.charAt(e)==="=";)++n;return Math.ceil(t.length*3)/4-n};var Ue=new Array(64),Qs=new Array(123);for(Ot=0;Ot<64;)Qs[Ue[Ot]=Ot<26?Ot+65:Ot<52?Ot+71:Ot<62?Ot-4:Ot-59|43]=Ot++;var Ot;en.encode=function(t,e,n){for(var o=null,i=[],s=0,u=0,l;e<n;){var m=t[e++];switch(u){case 0:i[s++]=Ue[m>>2],l=(m&3)<<4,u=1;break;case 1:i[s++]=Ue[l|m>>4],l=(m&15)<<2,u=2;break;case 2:i[s++]=Ue[l|m>>6],i[s++]=Ue[m&63],u=0;break}s>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,i)),s=0)}return u&&(i[s++]=Ue[l],i[s++]=61,u===1&&(i[s++]=61)),o?(s&&o.push(String.fromCharCode.apply(String,i.slice(0,s))),o.join("")):String.fromCharCode.apply(String,i.slice(0,s))};var Zs="invalid encoding";en.decode=function(t,e,n){for(var o=n,i=0,s,u=0;u<t.length;){var l=t.charCodeAt(u++);if(l===61&&i>1)break;if((l=Qs[l])===void 0)throw Error(Zs);switch(i){case 0:s=l,i=1;break;case 1:e[n++]=s<<2|(l&48)>>4,s=l,i=2;break;case 2:e[n++]=(s&15)<<4|(l&60)>>2,s=l,i=3;break;case 3:e[n++]=(s&3)<<6|l,i=0;break}}if(i===1)throw Error(Zs);return n-o};en.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var ra=P((Gg,ea)=>{"use strict";ea.exports=rn;function rn(){this._listeners={}}rn.prototype.on=function(t,e,n){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:e,ctx:n||this}),this};rn.prototype.off=function(t,e){if(t===void 0)this._listeners={};else if(e===void 0)this._listeners[t]=[];else for(var n=this._listeners[t],o=0;o<n.length;)n[o].fn===e?n.splice(o,1):++o;return this};rn.prototype.emit=function(t){var e=this._listeners[t];if(e){for(var n=[],o=1;o<arguments.length;)n.push(arguments[o++]);for(o=0;o<e.length;)e[o].fn.apply(e[o++].ctx,n)}return this}});var ua=P((Hg,ca)=>{"use strict";ca.exports=na(na);function na(r){return typeof Float32Array<"u"?function(){var t=new Float32Array([-0]),e=new Uint8Array(t.buffer),n=e[3]===128;function o(l,m,h){t[0]=l,m[h]=e[0],m[h+1]=e[1],m[h+2]=e[2],m[h+3]=e[3]}function i(l,m,h){t[0]=l,m[h]=e[3],m[h+1]=e[2],m[h+2]=e[1],m[h+3]=e[0]}r.writeFloatLE=n?o:i,r.writeFloatBE=n?i:o;function s(l,m){return e[0]=l[m],e[1]=l[m+1],e[2]=l[m+2],e[3]=l[m+3],t[0]}function u(l,m){return e[3]=l[m],e[2]=l[m+1],e[1]=l[m+2],e[0]=l[m+3],t[0]}r.readFloatLE=n?s:u,r.readFloatBE=n?u:s}():function(){function t(n,o,i,s){var u=o<0?1:0;if(u&&(o=-o),o===0)n(1/o>0?0:2147483648,i,s);else if(isNaN(o))n(2143289344,i,s);else if(o>34028234663852886e22)n((u<<31|2139095040)>>>0,i,s);else if(o<11754943508222875e-54)n((u<<31|Math.round(o/1401298464324817e-60))>>>0,i,s);else{var l=Math.floor(Math.log(o)/Math.LN2),m=Math.round(o*Math.pow(2,-l)*8388608)&8388607;n((u<<31|l+127<<23|m)>>>0,i,s)}}r.writeFloatLE=t.bind(null,oa),r.writeFloatBE=t.bind(null,ia);function e(n,o,i){var s=n(o,i),u=(s>>31)*2+1,l=s>>>23&255,m=s&8388607;return l===255?m?NaN:u*(1/0):l===0?u*1401298464324817e-60*m:u*Math.pow(2,l-150)*(m+8388608)}r.readFloatLE=e.bind(null,sa),r.readFloatBE=e.bind(null,aa)}(),typeof Float64Array<"u"?function(){var t=new Float64Array([-0]),e=new Uint8Array(t.buffer),n=e[7]===128;function o(l,m,h){t[0]=l,m[h]=e[0],m[h+1]=e[1],m[h+2]=e[2],m[h+3]=e[3],m[h+4]=e[4],m[h+5]=e[5],m[h+6]=e[6],m[h+7]=e[7]}function i(l,m,h){t[0]=l,m[h]=e[7],m[h+1]=e[6],m[h+2]=e[5],m[h+3]=e[4],m[h+4]=e[3],m[h+5]=e[2],m[h+6]=e[1],m[h+7]=e[0]}r.writeDoubleLE=n?o:i,r.writeDoubleBE=n?i:o;function s(l,m){return e[0]=l[m],e[1]=l[m+1],e[2]=l[m+2],e[3]=l[m+3],e[4]=l[m+4],e[5]=l[m+5],e[6]=l[m+6],e[7]=l[m+7],t[0]}function u(l,m){return e[7]=l[m],e[6]=l[m+1],e[5]=l[m+2],e[4]=l[m+3],e[3]=l[m+4],e[2]=l[m+5],e[1]=l[m+6],e[0]=l[m+7],t[0]}r.readDoubleLE=n?s:u,r.readDoubleBE=n?u:s}():function(){function t(n,o,i,s,u,l){var m=s<0?1:0;if(m&&(s=-s),s===0)n(0,u,l+o),n(1/s>0?0:2147483648,u,l+i);else if(isNaN(s))n(0,u,l+o),n(2146959360,u,l+i);else if(s>17976931348623157e292)n(0,u,l+o),n((m<<31|2146435072)>>>0,u,l+i);else{var h;if(s<22250738585072014e-324)h=s/5e-324,n(h>>>0,u,l+o),n((m<<31|h/4294967296)>>>0,u,l+i);else{var b=Math.floor(Math.log(s)/Math.LN2);b===1024&&(b=1023),h=s*Math.pow(2,-b),n(h*4503599627370496>>>0,u,l+o),n((m<<31|b+1023<<20|h*1048576&1048575)>>>0,u,l+i)}}}r.writeDoubleLE=t.bind(null,oa,0,4),r.writeDoubleBE=t.bind(null,ia,4,0);function e(n,o,i,s,u){var l=n(s,u+o),m=n(s,u+i),h=(m>>31)*2+1,b=m>>>20&2047,w=4294967296*(m&1048575)+l;return b===2047?w?NaN:h*(1/0):b===0?h*5e-324*w:h*Math.pow(2,b-1075)*(w+4503599627370496)}r.readDoubleLE=e.bind(null,sa,0,4),r.readDoubleBE=e.bind(null,aa,4,0)}(),r}function oa(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 ia(r,t,e){t[e]=r>>>24,t[e+1]=r>>>16&255,t[e+2]=r>>>8&255,t[e+3]=r&255}function sa(r,t){return(r[t]|r[t+1]<<8|r[t+2]<<16|r[t+3]<<24)>>>0}function aa(r,t){return(r[t]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3])>>>0}});var fa=P((exports,module)=>{"use strict";module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(r){}return null}});var ha=P(la=>{"use strict";var uo=la;uo.length=function(t){for(var e=0,n=0,o=0;o<t.length;++o)n=t.charCodeAt(o),n<128?e+=1:n<2048?e+=2:(n&64512)===55296&&(t.charCodeAt(o+1)&64512)===56320?(++o,e+=4):e+=3;return e};uo.read=function(t,e,n){var o=n-e;if(o<1)return"";for(var i=null,s=[],u=0,l;e<n;)l=t[e++],l<128?s[u++]=l:l>191&&l<224?s[u++]=(l&31)<<6|t[e++]&63:l>239&&l<365?(l=((l&7)<<18|(t[e++]&63)<<12|(t[e++]&63)<<6|t[e++]&63)-65536,s[u++]=55296+(l>>10),s[u++]=56320+(l&1023)):s[u++]=(l&15)<<12|(t[e++]&63)<<6|t[e++]&63,u>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),u=0);return i?(u&&i.push(String.fromCharCode.apply(String,s.slice(0,u))),i.join("")):String.fromCharCode.apply(String,s.slice(0,u))};uo.write=function(t,e,n){for(var o=n,i,s,u=0;u<t.length;++u)i=t.charCodeAt(u),i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=i&63|128):(i&64512)===55296&&((s=t.charCodeAt(u+1))&64512)===56320?(i=65536+((i&1023)<<10)+(s&1023),++u,e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128);return n-o}});var da=P((jg,pa)=>{"use strict";pa.exports=Dh;function Dh(r,t,e){var n=e||8192,o=n>>>1,i=null,s=n;return function(l){if(l<1||l>o)return r(l);s+l>n&&(i=r(n),s=0);var m=t.call(i,s,s+=l);return s&7&&(s=(s|7)+1),m}}});var ba=P((Jg,ma)=>{"use strict";ma.exports=et;var Sr=ge();function et(r,t){this.lo=r>>>0,this.hi=t>>>0}var be=et.zero=new et(0,0);be.toNumber=function(){return 0};be.zzEncode=be.zzDecode=function(){return this};be.length=function(){return 1};var kh=et.zeroHash="\0\0\0\0\0\0\0\0";et.fromNumber=function(t){if(t===0)return be;var e=t<0;e&&(t=-t);var 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 et(n,o)};et.from=function(t){if(typeof t=="number")return et.fromNumber(t);if(Sr.isString(t))if(Sr.Long)t=Sr.Long.fromString(t);else return et.fromNumber(parseInt(t,10));return t.low||t.high?new et(t.low>>>0,t.high>>>0):be};et.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var e=~this.lo+1>>>0,n=~this.hi>>>0;return e||(n=n+1>>>0),-(e+n*4294967296)}return this.lo+this.hi*4294967296};et.prototype.toLong=function(t){return Sr.Long?new Sr.Long(this.lo|0,this.hi|0,!!t):{low:this.lo|0,high:this.hi|0,unsigned:!!t}};var ee=String.prototype.charCodeAt;et.fromHash=function(t){return t===kh?be:new et((ee.call(t,0)|ee.call(t,1)<<8|ee.call(t,2)<<16|ee.call(t,3)<<24)>>>0,(ee.call(t,4)|ee.call(t,5)<<8|ee.call(t,6)<<16|ee.call(t,7)<<24)>>>0)};et.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};et.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this};et.prototype.zzDecode=function(){var t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this};et.prototype.length=function(){var 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}});var ge=P(fo=>{"use strict";var L=fo;L.asPromise=Ks();L.base64=ta();L.EventEmitter=ra();L.float=ua();L.inquire=fa();L.utf8=ha();L.pool=da();L.LongBits=ba();L.isNode=!!(typeof globalThis<"u"&&globalThis&&globalThis.process&&globalThis.process.versions&&globalThis.process.versions.node);L.global=L.isNode&&globalThis||typeof window<"u"&&window||typeof self<"u"&&self||fo;L.emptyArray=Object.freeze?Object.freeze([]):[];L.emptyObject=Object.freeze?Object.freeze({}):{};L.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};L.isString=function(t){return typeof t=="string"||t instanceof String};L.isObject=function(t){return t&&typeof t=="object"};L.isset=L.isSet=function(t,e){var n=t[e];return n!=null&&t.hasOwnProperty(e)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};L.Buffer=function(){try{var r=L.inquire("buffer").Buffer;return r.prototype.utf8Write?r:null}catch{return null}}();L._Buffer_from=null;L._Buffer_allocUnsafe=null;L.newBuffer=function(t){return typeof t=="number"?L.Buffer?L._Buffer_allocUnsafe(t):new L.Array(t):L.Buffer?L._Buffer_from(t):typeof Uint8Array>"u"?t:new Uint8Array(t)};L.Array=typeof Uint8Array<"u"?Uint8Array:Array;L.Long=L.global.dcodeIO&&L.global.dcodeIO.Long||L.global.Long||L.inquire("long");L.key2Re=/^true|false|0|1$/;L.key32Re=/^-?(?:0|[1-9][0-9]*)$/;L.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;L.longToHash=function(t){return t?L.LongBits.from(t).toHash():L.LongBits.zeroHash};L.longFromHash=function(t,e){var n=L.LongBits.fromHash(t);return L.Long?L.Long.fromBits(n.lo,n.hi,e):n.toNumber(!!e)};function ga(r,t,e){for(var n=Object.keys(t),o=0;o<n.length;++o)(r[n[o]]===void 0||!e)&&(r[n[o]]=t[n[o]]);return r}L.merge=ga;L.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function ya(r){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:new Error().stack||""}),n&&ga(this,n)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return r},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}L.newError=ya;L.ProtocolError=ya("ProtocolError");L.oneOfGetter=function(t){for(var e={},n=0;n<t.length;++n)e[t[n]]=1;return function(){for(var o=Object.keys(this),i=o.length-1;i>-1;--i)if(e[o[i]]===1&&this[o[i]]!==void 0&&this[o[i]]!==null)return o[i]}};L.oneOfSetter=function(t){return function(e){for(var n=0;n<t.length;++n)t[n]!==e&&delete this[t[n]]}};L.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};L._configure=function(){var r=L.Buffer;if(!r){L._Buffer_from=L._Buffer_allocUnsafe=null;return}L._Buffer_from=r.from!==Uint8Array.from&&r.from||function(e,n){return new r(e,n)},L._Buffer_allocUnsafe=r.allocUnsafe||function(e){return new r(e)}}});var po=P((Wg,Sa)=>{"use strict";Sa.exports=J;var _t=ge(),ho,va=_t.LongBits,Bh=_t.utf8;function Mt(r,t){return RangeError("index out of range: "+r.pos+" + "+(t||1)+" > "+r.len)}function J(r){this.buf=r,this.pos=0,this.len=r.length}var wa=typeof Uint8Array<"u"?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new J(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new J(t);throw Error("illegal buffer")},Ea=function(){return _t.Buffer?function(e){return(J.create=function(o){return _t.Buffer.isBuffer(o)?new ho(o):wa(o)})(e)}:wa};J.create=Ea();J.prototype._slice=_t.Array.prototype.subarray||_t.Array.prototype.slice;J.prototype.uint32=function(){var t=4294967295;return function(){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,Mt(this,10);return t}}();J.prototype.int32=function(){return this.uint32()|0};J.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function lo(){var r=new va(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(r.lo=(r.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return r;if(r.lo=(r.lo|(this.buf[this.pos]&127)<<28)>>>0,r.hi=(r.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return r;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw Mt(this);if(r.lo=(r.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return r}return r.lo=(r.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,r}if(this.len-this.pos>4){for(;t<5;++t)if(r.hi=(r.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return r}else for(;t<5;++t){if(this.pos>=this.len)throw Mt(this);if(r.hi=(r.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return r}throw Error("invalid varint encoding")}J.prototype.bool=function(){return this.uint32()!==0};function nn(r,t){return(r[t-4]|r[t-3]<<8|r[t-2]<<16|r[t-1]<<24)>>>0}J.prototype.fixed32=function(){if(this.pos+4>this.len)throw Mt(this,4);return nn(this.buf,this.pos+=4)};J.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Mt(this,4);return nn(this.buf,this.pos+=4)|0};function xa(){if(this.pos+8>this.len)throw Mt(this,8);return new va(nn(this.buf,this.pos+=4),nn(this.buf,this.pos+=4))}J.prototype.float=function(){if(this.pos+4>this.len)throw Mt(this,4);var t=_t.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};J.prototype.double=function(){if(this.pos+8>this.len)throw Mt(this,4);var t=_t.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t};J.prototype.bytes=function(){var t=this.uint32(),e=this.pos,n=this.pos+t;if(n>this.len)throw Mt(this,t);return this.pos+=t,Array.isArray(this.buf)?this.buf.slice(e,n):e===n?new this.buf.constructor(0):this._slice.call(this.buf,e,n)};J.prototype.string=function(){var t=this.bytes();return Bh.read(t,0,t.length)};J.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw Mt(this,t);this.pos+=t}else do if(this.pos>=this.len)throw Mt(this);while(this.buf[this.pos++]&128);return this};J.prototype.skipType=function(r){switch(r){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(r=this.uint32()&7)!==4;)this.skipType(r);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+r+" at offset "+this.pos)}return this};J._configure=function(r){ho=r,J.create=Ea(),ho._configure();var t=_t.Long?"toLong":"toNumber";_t.merge(J.prototype,{int64:function(){return lo.call(this)[t](!1)},uint64:function(){return lo.call(this)[t](!0)},sint64:function(){return lo.call(this).zzDecode()[t](!1)},fixed64:function(){return xa.call(this)[t](!0)},sfixed64:function(){return xa.call(this)[t](!1)}})}});var Ca=P((Kg,Ia)=>{"use strict";Ia.exports=ye;var Ta=po();(ye.prototype=Object.create(Ta.prototype)).constructor=ye;var Aa=ge();function ye(r){Ta.call(this,r)}ye._configure=function(){Aa.Buffer&&(ye.prototype._slice=Aa.Buffer.prototype.slice)};ye.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))};ye._configure()});var vo=P((Zg,Na)=>{"use strict";Na.exports=_;var Et=ge(),mo,on=Et.LongBits,Da=Et.base64,ka=Et.utf8;function Ar(r,t,e){this.fn=r,this.len=t,this.next=void 0,this.val=e}function go(){}function Nh(r){this.head=r.head,this.tail=r.tail,this.len=r.len,this.next=r.states}function _(){this.len=0,this.head=new Ar(go,0,0),this.tail=this.head,this.states=null}var Ba=function(){return Et.Buffer?function(){return(_.create=function(){return new mo})()}:function(){return new _}};_.create=Ba();_.alloc=function(t){return new Et.Array(t)};Et.Array!==Array&&(_.alloc=Et.pool(_.alloc,Et.Array.prototype.subarray));_.prototype._push=function(t,e,n){return this.tail=this.tail.next=new Ar(t,e,n),this.len+=e,this};function yo(r,t,e){t[e]=r&255}function Lh(r,t,e){for(;r>127;)t[e++]=r&127|128,r>>>=7;t[e]=r}function wo(r,t){this.len=r,this.next=void 0,this.val=t}wo.prototype=Object.create(Ar.prototype);wo.prototype.fn=Lh;_.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new wo((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this};_.prototype.int32=function(t){return t<0?this._push(xo,10,on.fromNumber(t)):this.uint32(t)};_.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function xo(r,t,e){for(;r.hi;)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}_.prototype.uint64=function(t){var e=on.from(t);return this._push(xo,e.length(),e)};_.prototype.int64=_.prototype.uint64;_.prototype.sint64=function(t){var e=on.from(t).zzEncode();return this._push(xo,e.length(),e)};_.prototype.bool=function(t){return this._push(yo,1,t?1:0)};function bo(r,t,e){t[e]=r&255,t[e+1]=r>>>8&255,t[e+2]=r>>>16&255,t[e+3]=r>>>24}_.prototype.fixed32=function(t){return this._push(bo,4,t>>>0)};_.prototype.sfixed32=_.prototype.fixed32;_.prototype.fixed64=function(t){var e=on.from(t);return this._push(bo,4,e.lo)._push(bo,4,e.hi)};_.prototype.sfixed64=_.prototype.fixed64;_.prototype.float=function(t){return this._push(Et.float.writeFloatLE,4,t)};_.prototype.double=function(t){return this._push(Et.float.writeDoubleLE,8,t)};var Rh=Et.Array.prototype.set?function(t,e,n){e.set(t,n)}:function(t,e,n){for(var o=0;o<t.length;++o)e[n+o]=t[o]};_.prototype.bytes=function(t){var e=t.length>>>0;if(!e)return this._push(yo,1,0);if(Et.isString(t)){var n=_.alloc(e=Da.length(t));Da.decode(t,n,0),t=n}return this.uint32(e)._push(Rh,e,t)};_.prototype.string=function(t){var e=ka.length(t);return e?this.uint32(e)._push(ka.write,e,t):this._push(yo,1,0)};_.prototype.fork=function(){return this.states=new Nh(this),this.head=this.tail=new Ar(go,0,0),this.len=0,this};_.prototype.reset=function(){return this.states?(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 Ar(go,0,0),this.len=0),this};_.prototype.ldelim=function(){var t=this.head,e=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=t.next,this.tail=e,this.len+=n),this};_.prototype.finish=function(){for(var t=this.head.next,e=this.constructor.alloc(this.len),n=0;t;)t.fn(t.val,e,n),n+=t.len,t=t.next;return e};_._configure=function(r){mo=r,_.create=Ba(),mo._configure()}});var Oa=P((Qg,Ra)=>{"use strict";Ra.exports=Ft;var La=vo();(Ft.prototype=Object.create(La.prototype)).constructor=Ft;var re=ge();function Ft(){La.call(this)}Ft._configure=function(){Ft.alloc=re._Buffer_allocUnsafe,Ft.writeBytesBuffer=re.Buffer&&re.Buffer.prototype instanceof Uint8Array&&re.Buffer.prototype.set.name==="set"?function(t,e,n){e.set(t,n)}:function(t,e,n){if(t.copy)t.copy(e,n,0,t.length);else for(var o=0;o<t.length;)e[n++]=t[o++]}};Ft.prototype.bytes=function(t){re.isString(t)&&(t=re._Buffer_from(t,"base64"));var e=t.length>>>0;return this.uint32(e),e&&this._push(Ft.writeBytesBuffer,e,t),this};function Oh(r,t,e){r.length<40?re.utf8.write(r,t,e):t.utf8Write?t.utf8Write(r,e):t.write(r,e)}Ft.prototype.string=function(t){var e=re.Buffer.byteLength(t);return this.uint32(e),e&&this._push(Oh,e,t),this};Ft._configure()});var za=P((gy,Fa)=>{var Fe=1e3,ze=Fe*60,Ve=ze*60,ve=Ve*24,_h=ve*7,Fh=ve*365.25;Fa.exports=function(r,t){t=t||{};var e=typeof r;if(e==="string"&&r.length>0)return zh(r);if(e==="number"&&isFinite(r))return t.long?$h(r):Vh(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function zh(r){if(r=String(r),!(r.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(t){var e=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return e*Fh;case"weeks":case"week":case"w":return e*_h;case"days":case"day":case"d":return e*ve;case"hours":case"hour":case"hrs":case"hr":case"h":return e*Ve;case"minutes":case"minute":case"mins":case"min":case"m":return e*ze;case"seconds":case"second":case"secs":case"sec":case"s":return e*Fe;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return e;default:return}}}}function Vh(r){var t=Math.abs(r);return t>=ve?Math.round(r/ve)+"d":t>=Ve?Math.round(r/Ve)+"h":t>=ze?Math.round(r/ze)+"m":t>=Fe?Math.round(r/Fe)+"s":r+"ms"}function $h(r){var t=Math.abs(r);return t>=ve?bn(r,t,ve,"day"):t>=Ve?bn(r,t,Ve,"hour"):t>=ze?bn(r,t,ze,"minute"):t>=Fe?bn(r,t,Fe,"second"):r+" ms"}function bn(r,t,e,n){var o=t>=e*1.5;return Math.round(r/e)+" "+n+(o?"s":"")}});var Io=P((yy,Va)=>{function Gh(r){e.debug=e,e.default=e,e.coerce=l,e.disable=i,e.enable=o,e.enabled=s,e.humanize=za(),e.destroy=m,Object.keys(r).forEach(h=>{e[h]=r[h]}),e.names=[],e.skips=[],e.formatters={};function t(h){let b=0;for(let w=0;w<h.length;w++)b=(b<<5)-b+h.charCodeAt(w),b|=0;return e.colors[Math.abs(b)%e.colors.length]}e.selectColor=t;function e(h){let b,w=null,T,p;function y(...E){if(!y.enabled)return;let v=y,S=Number(new Date),I=S-(b||S);v.diff=I,v.prev=b,v.curr=S,b=S,E[0]=e.coerce(E[0]),typeof E[0]!="string"&&E.unshift("%O");let C=0;E[0]=E[0].replace(/%([a-zA-Z%])/g,(M,B)=>{if(M==="%%")return"%";C++;let R=e.formatters[B];if(typeof R=="function"){let F=E[C];M=R.call(v,F),E.splice(C,1),C--}return M}),e.formatArgs.call(v,E),(v.log||e.log).apply(v,E)}return y.namespace=h,y.useColors=e.useColors(),y.color=e.selectColor(h),y.extend=n,y.destroy=e.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>w!==null?w:(T!==e.namespaces&&(T=e.namespaces,p=e.enabled(h)),p),set:E=>{w=E}}),typeof e.init=="function"&&e.init(y),y}function n(h,b){let w=e(this.namespace+(typeof b>"u"?":":b)+h);return w.log=this.log,w}function o(h){e.save(h),e.namespaces=h,e.names=[],e.skips=[];let b,w=(typeof h=="string"?h:"").split(/[\s,]+/),T=w.length;for(b=0;b<T;b++)w[b]&&(h=w[b].replace(/\*/g,".*?"),h[0]==="-"?e.skips.push(new RegExp("^"+h.slice(1)+"$")):e.names.push(new RegExp("^"+h+"$")))}function i(){let h=[...e.names.map(u),...e.skips.map(u).map(b=>"-"+b)].join(",");return e.enable(""),h}function s(h){if(h[h.length-1]==="*")return!0;let b,w;for(b=0,w=e.skips.length;b<w;b++)if(e.skips[b].test(h))return!1;for(b=0,w=e.names.length;b<w;b++)if(e.names[b].test(h))return!0;return!1}function u(h){return h.toString().substring(2,h.toString().length-2).replace(/\.\*\?$/,"*")}function l(h){return h instanceof Error?h.stack||h.message:h}function m(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return e.enable(e.load()),e}Va.exports=Gh});var $a=P((mt,gn)=>{mt.formatArgs=qh;mt.save=jh;mt.load=Jh;mt.useColors=Hh;mt.storage=Xh();mt.destroy=(()=>{let r=!1;return()=>{r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();mt.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Hh(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function qh(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+gn.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;r.splice(1,0,t,"color: inherit");let e=0,n=0;r[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(e++,o==="%c"&&(n=e))}),r.splice(n,0,t)}mt.log=console.debug||console.log||(()=>{});function jh(r){try{r?mt.storage.setItem("debug",r):mt.storage.removeItem("debug")}catch{}}function Jh(){let r;try{r=mt.storage.getItem("debug")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function Xh(){try{return localStorage}catch{}}gn.exports=Io()(mt);var{formatters:Wh}=gn.exports;Wh.j=function(r){try{return JSON.stringify(r)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var Ha=P((wy,Ga)=>{"use strict";Ga.exports=(r,t)=>{t=t||process.argv;let e=r.startsWith("-")?"":r.length===1?"-":"--",n=t.indexOf(e+r),o=t.indexOf("--");return n!==-1&&(o===-1?!0:n<o)}});var ja=P((xy,qa)=>{"use strict";var Kh=Rt("os"),Ut=Ha(),ot=process.env,$e;Ut("no-color")||Ut("no-colors")||Ut("color=false")?$e=!1:(Ut("color")||Ut("colors")||Ut("color=true")||Ut("color=always"))&&($e=!0);"FORCE_COLOR"in ot&&($e=ot.FORCE_COLOR.length===0||parseInt(ot.FORCE_COLOR,10)!==0);function Zh(r){return r===0?!1:{level:r,hasBasic:!0,has256:r>=2,has16m:r>=3}}function Qh(r){if($e===!1)return 0;if(Ut("color=16m")||Ut("color=full")||Ut("color=truecolor"))return 3;if(Ut("color=256"))return 2;if(r&&!r.isTTY&&$e!==!0)return 0;let t=$e?1:0;if(process.platform==="win32"){let e=Kh.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in ot)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(e=>e in ot)||ot.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in ot)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(ot.TEAMCITY_VERSION)?1:0;if(ot.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in ot){let e=parseInt((ot.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(ot.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(ot.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(ot.TERM)||"COLORTERM"in ot?1:(ot.TERM==="dumb",t)}function Co(r){let t=Qh(r);return Zh(t)}qa.exports={supportsColor:Co,stdout:Co(process.stdout),stderr:Co(process.stderr)}});var Xa=P((nt,wn)=>{var Yh=Rt("tty"),yn=Rt("util");nt.init=sp;nt.log=np;nt.formatArgs=ep;nt.save=op;nt.load=ip;nt.useColors=tp;nt.destroy=yn.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");nt.colors=[6,2,3,4,5,1];try{let r=ja();r&&(r.stderr||r).level>=2&&(nt.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}nt.inspectOpts=Object.keys(process.env).filter(r=>/^debug_/i.test(r)).reduce((r,t)=>{let e=t.substring(6).toLowerCase().replace(/_([a-z])/g,(o,i)=>i.toUpperCase()),n=process.env[t];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),r[e]=n,r},{});function tp(){return"colors"in nt.inspectOpts?!!nt.inspectOpts.colors:Yh.isatty(process.stderr.fd)}function ep(r){let{namespace:t,useColors:e}=this;if(e){let n=this.color,o="\x1B[3"+(n<8?n:"8;5;"+n),i=` ${o};1m${t} \x1B[0m`;r[0]=i+r[0].split(`
|
|
2
|
+
"use strict";var Libp2PDaemonServer=(()=>{var Iu=Object.create;var dr=Object.defineProperty;var Cu=Object.getOwnPropertyDescriptor;var ku=Object.getOwnPropertyNames;var Du=Object.getPrototypeOf,Bu=Object.prototype.hasOwnProperty;var Ft=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var B=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),ft=(r,t)=>{for(var e in t)dr(r,e,{get:t[e],enumerable:!0})},rs=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ku(t))!Bu.call(r,i)&&i!==e&&dr(r,i,{get:()=>t[i],enumerable:!(n=Cu(t,i))||n.enumerable});return r};var M=(r,t,e)=>(e=r!=null?Iu(Du(r)):{},rs(t||!r||!r.__esModule?dr(e,"default",{value:r,enumerable:!0}):e,r)),Ru=r=>rs(dr({},"__esModule",{value:!0}),r);var is=B((Jh,ns)=>{"use strict";ns.exports=_u;function _u(r,t){for(var e=new Array(arguments.length-1),n=0,i=2,s=!0;i<arguments.length;)e[n++]=arguments[i++];return new Promise(function(l,f){e[n]=function(h){if(s)if(s=!1,h)f(h);else{for(var g=new Array(arguments.length-1),w=0;w<g.length;)g[w++]=arguments[w];l.apply(null,g)}};try{r.apply(t||null,e)}catch(d){s&&(s=!1,f(d))}})}});var as=B(cs=>{"use strict";var mr=cs;mr.length=function(t){var e=t.length;if(!e)return 0;for(var n=0;--e%4>1&&t.charAt(e)==="=";)++n;return Math.ceil(t.length*3)/4-n};var Ae=new Array(64),os=new Array(123);for(kt=0;kt<64;)os[Ae[kt]=kt<26?kt+65:kt<52?kt+71:kt<62?kt-4:kt-59|43]=kt++;var kt;mr.encode=function(t,e,n){for(var i=null,s=[],a=0,l=0,f;e<n;){var d=t[e++];switch(l){case 0:s[a++]=Ae[d>>2],f=(d&3)<<4,l=1;break;case 1:s[a++]=Ae[f|d>>4],f=(d&15)<<2,l=2;break;case 2:s[a++]=Ae[f|d>>6],s[a++]=Ae[d&63],l=0;break}a>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),a=0)}return l&&(s[a++]=Ae[f],s[a++]=61,l===1&&(s[a++]=61)),i?(a&&i.push(String.fromCharCode.apply(String,s.slice(0,a))),i.join("")):String.fromCharCode.apply(String,s.slice(0,a))};var ss="invalid encoding";mr.decode=function(t,e,n){for(var i=n,s=0,a,l=0;l<t.length;){var f=t.charCodeAt(l++);if(f===61&&s>1)break;if((f=os[f])===void 0)throw Error(ss);switch(s){case 0:a=f,s=1;break;case 1:e[n++]=a<<2|(f&48)>>4,a=f,s=2;break;case 2:e[n++]=(a&15)<<4|(f&60)>>2,a=f,s=3;break;case 3:e[n++]=(a&3)<<6|f,s=0;break}}if(s===1)throw Error(ss);return n-i};mr.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var ls=B((tp,us)=>{"use strict";us.exports=gr;function gr(){this._listeners={}}gr.prototype.on=function(t,e,n){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:e,ctx:n||this}),this};gr.prototype.off=function(t,e){if(t===void 0)this._listeners={};else if(e===void 0)this._listeners[t]=[];else for(var n=this._listeners[t],i=0;i<n.length;)n[i].fn===e?n.splice(i,1):++i;return this};gr.prototype.emit=function(t){var e=this._listeners[t];if(e){for(var n=[],i=1;i<arguments.length;)n.push(arguments[i++]);for(i=0;i<e.length;)e[i].fn.apply(e[i++].ctx,n)}return this}});var ys=B((ep,gs)=>{"use strict";gs.exports=fs(fs);function fs(r){return typeof Float32Array<"u"?function(){var t=new Float32Array([-0]),e=new Uint8Array(t.buffer),n=e[3]===128;function i(f,d,h){t[0]=f,d[h]=e[0],d[h+1]=e[1],d[h+2]=e[2],d[h+3]=e[3]}function s(f,d,h){t[0]=f,d[h]=e[3],d[h+1]=e[2],d[h+2]=e[1],d[h+3]=e[0]}r.writeFloatLE=n?i:s,r.writeFloatBE=n?s:i;function a(f,d){return e[0]=f[d],e[1]=f[d+1],e[2]=f[d+2],e[3]=f[d+3],t[0]}function l(f,d){return e[3]=f[d],e[2]=f[d+1],e[1]=f[d+2],e[0]=f[d+3],t[0]}r.readFloatLE=n?a:l,r.readFloatBE=n?l:a}():function(){function t(n,i,s,a){var l=i<0?1:0;if(l&&(i=-i),i===0)n(1/i>0?0:2147483648,s,a);else if(isNaN(i))n(2143289344,s,a);else if(i>34028234663852886e22)n((l<<31|2139095040)>>>0,s,a);else if(i<11754943508222875e-54)n((l<<31|Math.round(i/1401298464324817e-60))>>>0,s,a);else{var f=Math.floor(Math.log(i)/Math.LN2),d=Math.round(i*Math.pow(2,-f)*8388608)&8388607;n((l<<31|f+127<<23|d)>>>0,s,a)}}r.writeFloatLE=t.bind(null,hs),r.writeFloatBE=t.bind(null,ps);function e(n,i,s){var a=n(i,s),l=(a>>31)*2+1,f=a>>>23&255,d=a&8388607;return f===255?d?NaN:l*(1/0):f===0?l*1401298464324817e-60*d:l*Math.pow(2,f-150)*(d+8388608)}r.readFloatLE=e.bind(null,ds),r.readFloatBE=e.bind(null,ms)}(),typeof Float64Array<"u"?function(){var t=new Float64Array([-0]),e=new Uint8Array(t.buffer),n=e[7]===128;function i(f,d,h){t[0]=f,d[h]=e[0],d[h+1]=e[1],d[h+2]=e[2],d[h+3]=e[3],d[h+4]=e[4],d[h+5]=e[5],d[h+6]=e[6],d[h+7]=e[7]}function s(f,d,h){t[0]=f,d[h]=e[7],d[h+1]=e[6],d[h+2]=e[5],d[h+3]=e[4],d[h+4]=e[3],d[h+5]=e[2],d[h+6]=e[1],d[h+7]=e[0]}r.writeDoubleLE=n?i:s,r.writeDoubleBE=n?s:i;function a(f,d){return e[0]=f[d],e[1]=f[d+1],e[2]=f[d+2],e[3]=f[d+3],e[4]=f[d+4],e[5]=f[d+5],e[6]=f[d+6],e[7]=f[d+7],t[0]}function l(f,d){return e[7]=f[d],e[6]=f[d+1],e[5]=f[d+2],e[4]=f[d+3],e[3]=f[d+4],e[2]=f[d+5],e[1]=f[d+6],e[0]=f[d+7],t[0]}r.readDoubleLE=n?a:l,r.readDoubleBE=n?l:a}():function(){function t(n,i,s,a,l,f){var d=a<0?1:0;if(d&&(a=-a),a===0)n(0,l,f+i),n(1/a>0?0:2147483648,l,f+s);else if(isNaN(a))n(0,l,f+i),n(2146959360,l,f+s);else if(a>17976931348623157e292)n(0,l,f+i),n((d<<31|2146435072)>>>0,l,f+s);else{var h;if(a<22250738585072014e-324)h=a/5e-324,n(h>>>0,l,f+i),n((d<<31|h/4294967296)>>>0,l,f+s);else{var g=Math.floor(Math.log(a)/Math.LN2);g===1024&&(g=1023),h=a*Math.pow(2,-g),n(h*4503599627370496>>>0,l,f+i),n((d<<31|g+1023<<20|h*1048576&1048575)>>>0,l,f+s)}}}r.writeDoubleLE=t.bind(null,hs,0,4),r.writeDoubleBE=t.bind(null,ps,4,0);function e(n,i,s,a,l){var f=n(a,l+i),d=n(a,l+s),h=(d>>31)*2+1,g=d>>>20&2047,w=4294967296*(d&1048575)+f;return g===2047?w?NaN:h*(1/0):g===0?h*5e-324*w:h*Math.pow(2,g-1075)*(w+4503599627370496)}r.readDoubleLE=e.bind(null,ds,0,4),r.readDoubleBE=e.bind(null,ms,4,0)}(),r}function hs(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 ps(r,t,e){t[e]=r>>>24,t[e+1]=r>>>16&255,t[e+2]=r>>>8&255,t[e+3]=r&255}function ds(r,t){return(r[t]|r[t+1]<<8|r[t+2]<<16|r[t+3]<<24)>>>0}function ms(r,t){return(r[t]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3])>>>0}});var bs=B((exports,module)=>{"use strict";module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(r){}return null}});var Es=B(ws=>{"use strict";var wn=ws;wn.length=function(t){for(var e=0,n=0,i=0;i<t.length;++i)n=t.charCodeAt(i),n<128?e+=1:n<2048?e+=2:(n&64512)===55296&&(t.charCodeAt(i+1)&64512)===56320?(++i,e+=4):e+=3;return e};wn.read=function(t,e,n){var i=n-e;if(i<1)return"";for(var s=null,a=[],l=0,f;e<n;)f=t[e++],f<128?a[l++]=f:f>191&&f<224?a[l++]=(f&31)<<6|t[e++]&63:f>239&&f<365?(f=((f&7)<<18|(t[e++]&63)<<12|(t[e++]&63)<<6|t[e++]&63)-65536,a[l++]=55296+(f>>10),a[l++]=56320+(f&1023)):a[l++]=(f&15)<<12|(t[e++]&63)<<6|t[e++]&63,l>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,a)),l=0);return s?(l&&s.push(String.fromCharCode.apply(String,a.slice(0,l))),s.join("")):String.fromCharCode.apply(String,a.slice(0,l))};wn.write=function(t,e,n){for(var i=n,s,a,l=0;l<t.length;++l)s=t.charCodeAt(l),s<128?e[n++]=s:s<2048?(e[n++]=s>>6|192,e[n++]=s&63|128):(s&64512)===55296&&((a=t.charCodeAt(l+1))&64512)===56320?(s=65536+((s&1023)<<10)+(a&1023),++l,e[n++]=s>>18|240,e[n++]=s>>12&63|128,e[n++]=s>>6&63|128,e[n++]=s&63|128):(e[n++]=s>>12|224,e[n++]=s>>6&63|128,e[n++]=s&63|128);return n-i}});var xs=B((np,vs)=>{"use strict";vs.exports=Lu;function Lu(r,t,e){var n=e||8192,i=n>>>1,s=null,a=n;return function(f){if(f<1||f>i)return r(f);a+f>n&&(s=r(n),a=0);var d=t.call(s,a,a+=f);return a&7&&(a=(a|7)+1),d}}});var Ts=B((ip,Ss)=>{"use strict";Ss.exports=K;var Ye=ce();function K(r,t){this.lo=r>>>0,this.hi=t>>>0}var oe=K.zero=new K(0,0);oe.toNumber=function(){return 0};oe.zzEncode=oe.zzDecode=function(){return this};oe.length=function(){return 1};var Nu=K.zeroHash="\0\0\0\0\0\0\0\0";K.fromNumber=function(t){if(t===0)return oe;var e=t<0;e&&(t=-t);var 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 K(n,i)};K.from=function(t){if(typeof t=="number")return K.fromNumber(t);if(Ye.isString(t))if(Ye.Long)t=Ye.Long.fromString(t);else return K.fromNumber(parseInt(t,10));return t.low||t.high?new K(t.low>>>0,t.high>>>0):oe};K.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var e=~this.lo+1>>>0,n=~this.hi>>>0;return e||(n=n+1>>>0),-(e+n*4294967296)}return this.lo+this.hi*4294967296};K.prototype.toLong=function(t){return Ye.Long?new Ye.Long(this.lo|0,this.hi|0,!!t):{low:this.lo|0,high:this.hi|0,unsigned:!!t}};var Zt=String.prototype.charCodeAt;K.fromHash=function(t){return t===Nu?oe:new K((Zt.call(t,0)|Zt.call(t,1)<<8|Zt.call(t,2)<<16|Zt.call(t,3)<<24)>>>0,(Zt.call(t,4)|Zt.call(t,5)<<8|Zt.call(t,6)<<16|Zt.call(t,7)<<24)>>>0)};K.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};K.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this};K.prototype.zzDecode=function(){var t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this};K.prototype.length=function(){var 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}});var ce=B(En=>{"use strict";var T=En;T.asPromise=is();T.base64=as();T.EventEmitter=ls();T.float=ys();T.inquire=bs();T.utf8=Es();T.pool=xs();T.LongBits=Ts();T.isNode=!!(typeof globalThis<"u"&&globalThis&&globalThis.process&&globalThis.process.versions&&globalThis.process.versions.node);T.global=T.isNode&&globalThis||typeof window<"u"&&window||typeof self<"u"&&self||En;T.emptyArray=Object.freeze?Object.freeze([]):[];T.emptyObject=Object.freeze?Object.freeze({}):{};T.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};T.isString=function(t){return typeof t=="string"||t instanceof String};T.isObject=function(t){return t&&typeof t=="object"};T.isset=T.isSet=function(t,e){var n=t[e];return n!=null&&t.hasOwnProperty(e)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};T.Buffer=function(){try{var r=T.inquire("buffer").Buffer;return r.prototype.utf8Write?r:null}catch{return null}}();T._Buffer_from=null;T._Buffer_allocUnsafe=null;T.newBuffer=function(t){return typeof t=="number"?T.Buffer?T._Buffer_allocUnsafe(t):new T.Array(t):T.Buffer?T._Buffer_from(t):typeof Uint8Array>"u"?t:new Uint8Array(t)};T.Array=typeof Uint8Array<"u"?Uint8Array:Array;T.Long=T.global.dcodeIO&&T.global.dcodeIO.Long||T.global.Long||T.inquire("long");T.key2Re=/^true|false|0|1$/;T.key32Re=/^-?(?:0|[1-9][0-9]*)$/;T.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;T.longToHash=function(t){return t?T.LongBits.from(t).toHash():T.LongBits.zeroHash};T.longFromHash=function(t,e){var n=T.LongBits.fromHash(t);return T.Long?T.Long.fromBits(n.lo,n.hi,e):n.toNumber(!!e)};function As(r,t,e){for(var n=Object.keys(t),i=0;i<n.length;++i)(r[n[i]]===void 0||!e)&&(r[n[i]]=t[n[i]]);return r}T.merge=As;T.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function Is(r){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:new Error().stack||""}),n&&As(this,n)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return r},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}T.newError=Is;T.ProtocolError=Is("ProtocolError");T.oneOfGetter=function(t){for(var e={},n=0;n<t.length;++n)e[t[n]]=1;return function(){for(var i=Object.keys(this),s=i.length-1;s>-1;--s)if(e[i[s]]===1&&this[i[s]]!==void 0&&this[i[s]]!==null)return i[s]}};T.oneOfSetter=function(t){return function(e){for(var n=0;n<t.length;++n)t[n]!==e&&delete this[t[n]]}};T.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};T._configure=function(){var r=T.Buffer;if(!r){T._Buffer_from=T._Buffer_allocUnsafe=null;return}T._Buffer_from=r.from!==Uint8Array.from&&r.from||function(e,n){return new r(e,n)},T._Buffer_allocUnsafe=r.allocUnsafe||function(e){return new r(e)}}});var Sn=B((op,Rs)=>{"use strict";Rs.exports=U;var Lt=ce(),xn,Ds=Lt.LongBits,Ou=Lt.utf8;function Dt(r,t){return RangeError("index out of range: "+r.pos+" + "+(t||1)+" > "+r.len)}function U(r){this.buf=r,this.pos=0,this.len=r.length}var Cs=typeof Uint8Array<"u"?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new U(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new U(t);throw Error("illegal buffer")},Bs=function(){return Lt.Buffer?function(e){return(U.create=function(i){return Lt.Buffer.isBuffer(i)?new xn(i):Cs(i)})(e)}:Cs};U.create=Bs();U.prototype._slice=Lt.Array.prototype.subarray||Lt.Array.prototype.slice;U.prototype.uint32=function(){var t=4294967295;return function(){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,Dt(this,10);return t}}();U.prototype.int32=function(){return this.uint32()|0};U.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function vn(){var r=new Ds(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(r.lo=(r.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return r;if(r.lo=(r.lo|(this.buf[this.pos]&127)<<28)>>>0,r.hi=(r.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return r;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw Dt(this);if(r.lo=(r.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return r}return r.lo=(r.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,r}if(this.len-this.pos>4){for(;t<5;++t)if(r.hi=(r.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return r}else for(;t<5;++t){if(this.pos>=this.len)throw Dt(this);if(r.hi=(r.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return r}throw Error("invalid varint encoding")}U.prototype.bool=function(){return this.uint32()!==0};function yr(r,t){return(r[t-4]|r[t-3]<<8|r[t-2]<<16|r[t-1]<<24)>>>0}U.prototype.fixed32=function(){if(this.pos+4>this.len)throw Dt(this,4);return yr(this.buf,this.pos+=4)};U.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Dt(this,4);return yr(this.buf,this.pos+=4)|0};function ks(){if(this.pos+8>this.len)throw Dt(this,8);return new Ds(yr(this.buf,this.pos+=4),yr(this.buf,this.pos+=4))}U.prototype.float=function(){if(this.pos+4>this.len)throw Dt(this,4);var t=Lt.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};U.prototype.double=function(){if(this.pos+8>this.len)throw Dt(this,4);var t=Lt.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t};U.prototype.bytes=function(){var t=this.uint32(),e=this.pos,n=this.pos+t;if(n>this.len)throw Dt(this,t);return this.pos+=t,Array.isArray(this.buf)?this.buf.slice(e,n):e===n?new this.buf.constructor(0):this._slice.call(this.buf,e,n)};U.prototype.string=function(){var t=this.bytes();return Ou.read(t,0,t.length)};U.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw Dt(this,t);this.pos+=t}else do if(this.pos>=this.len)throw Dt(this);while(this.buf[this.pos++]&128);return this};U.prototype.skipType=function(r){switch(r){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(r=this.uint32()&7)!==4;)this.skipType(r);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+r+" at offset "+this.pos)}return this};U._configure=function(r){xn=r,U.create=Bs(),xn._configure();var t=Lt.Long?"toLong":"toNumber";Lt.merge(U.prototype,{int64:function(){return vn.call(this)[t](!1)},uint64:function(){return vn.call(this)[t](!0)},sint64:function(){return vn.call(this).zzDecode()[t](!1)},fixed64:function(){return ks.call(this)[t](!0)},sfixed64:function(){return ks.call(this)[t](!1)}})}});var Os=B((cp,Ns)=>{"use strict";Ns.exports=ae;var Ls=Sn();(ae.prototype=Object.create(Ls.prototype)).constructor=ae;var _s=ce();function ae(r){Ls.call(this,r)}ae._configure=function(){_s.Buffer&&(ae.prototype._slice=_s.Buffer.prototype.slice)};ae.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))};ae._configure()});var Bn=B((ap,Fs)=>{"use strict";Fs.exports=R;var bt=ce(),Tn,br=bt.LongBits,Ps=bt.base64,Ms=bt.utf8;function je(r,t,e){this.fn=r,this.len=t,this.next=void 0,this.val=e}function In(){}function Pu(r){this.head=r.head,this.tail=r.tail,this.len=r.len,this.next=r.states}function R(){this.len=0,this.head=new je(In,0,0),this.tail=this.head,this.states=null}var Us=function(){return bt.Buffer?function(){return(R.create=function(){return new Tn})()}:function(){return new R}};R.create=Us();R.alloc=function(t){return new bt.Array(t)};bt.Array!==Array&&(R.alloc=bt.pool(R.alloc,bt.Array.prototype.subarray));R.prototype._push=function(t,e,n){return this.tail=this.tail.next=new je(t,e,n),this.len+=e,this};function Cn(r,t,e){t[e]=r&255}function Mu(r,t,e){for(;r>127;)t[e++]=r&127|128,r>>>=7;t[e]=r}function kn(r,t){this.len=r,this.next=void 0,this.val=t}kn.prototype=Object.create(je.prototype);kn.prototype.fn=Mu;R.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new kn((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this};R.prototype.int32=function(t){return t<0?this._push(Dn,10,br.fromNumber(t)):this.uint32(t)};R.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function Dn(r,t,e){for(;r.hi;)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}R.prototype.uint64=function(t){var e=br.from(t);return this._push(Dn,e.length(),e)};R.prototype.int64=R.prototype.uint64;R.prototype.sint64=function(t){var e=br.from(t).zzEncode();return this._push(Dn,e.length(),e)};R.prototype.bool=function(t){return this._push(Cn,1,t?1:0)};function An(r,t,e){t[e]=r&255,t[e+1]=r>>>8&255,t[e+2]=r>>>16&255,t[e+3]=r>>>24}R.prototype.fixed32=function(t){return this._push(An,4,t>>>0)};R.prototype.sfixed32=R.prototype.fixed32;R.prototype.fixed64=function(t){var e=br.from(t);return this._push(An,4,e.lo)._push(An,4,e.hi)};R.prototype.sfixed64=R.prototype.fixed64;R.prototype.float=function(t){return this._push(bt.float.writeFloatLE,4,t)};R.prototype.double=function(t){return this._push(bt.float.writeDoubleLE,8,t)};var Uu=bt.Array.prototype.set?function(t,e,n){e.set(t,n)}:function(t,e,n){for(var i=0;i<t.length;++i)e[n+i]=t[i]};R.prototype.bytes=function(t){var e=t.length>>>0;if(!e)return this._push(Cn,1,0);if(bt.isString(t)){var n=R.alloc(e=Ps.length(t));Ps.decode(t,n,0),t=n}return this.uint32(e)._push(Uu,e,t)};R.prototype.string=function(t){var e=Ms.length(t);return e?this.uint32(e)._push(Ms.write,e,t):this._push(Cn,1,0)};R.prototype.fork=function(){return this.states=new Pu(this),this.head=this.tail=new je(In,0,0),this.len=0,this};R.prototype.reset=function(){return this.states?(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 je(In,0,0),this.len=0),this};R.prototype.ldelim=function(){var t=this.head,e=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=t.next,this.tail=e,this.len+=n),this};R.prototype.finish=function(){for(var t=this.head.next,e=this.constructor.alloc(this.len),n=0;t;)t.fn(t.val,e,n),n+=t.len,t=t.next;return e};R._configure=function(r){Tn=r,R.create=Us(),Tn._configure()}});var zs=B((up,$s)=>{"use strict";$s.exports=Nt;var Gs=Bn();(Nt.prototype=Object.create(Gs.prototype)).constructor=Nt;var Kt=ce();function Nt(){Gs.call(this)}Nt._configure=function(){Nt.alloc=Kt._Buffer_allocUnsafe,Nt.writeBytesBuffer=Kt.Buffer&&Kt.Buffer.prototype instanceof Uint8Array&&Kt.Buffer.prototype.set.name==="set"?function(t,e,n){e.set(t,n)}:function(t,e,n){if(t.copy)t.copy(e,n,0,t.length);else for(var i=0;i<t.length;)e[n++]=t[i++]}};Nt.prototype.bytes=function(t){Kt.isString(t)&&(t=Kt._Buffer_from(t,"base64"));var e=t.length>>>0;return this.uint32(e),e&&this._push(Nt.writeBytesBuffer,e,t),this};function Fu(r,t,e){r.length<40?Kt.utf8.write(r,t,e):t.utf8Write?t.utf8Write(r,e):t.write(r,e)}Nt.prototype.string=function(t){var e=Kt.Buffer.byteLength(t);return this.uint32(e),e&&this._push(Fu,e,t),this};Nt._configure()});var Ks=B((kp,Zs)=>{var ke=1e3,De=ke*60,Be=De*60,fe=Be*24,Vu=fe*7,Hu=fe*365.25;Zs.exports=function(r,t){t=t||{};var e=typeof r;if(e==="string"&&r.length>0)return Wu(r);if(e==="number"&&isFinite(r))return t.long?Zu(r):qu(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function Wu(r){if(r=String(r),!(r.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(t){var e=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return e*Hu;case"weeks":case"week":case"w":return e*Vu;case"days":case"day":case"d":return e*fe;case"hours":case"hour":case"hrs":case"hr":case"h":return e*Be;case"minutes":case"minute":case"mins":case"min":case"m":return e*De;case"seconds":case"second":case"secs":case"sec":case"s":return e*ke;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return e;default:return}}}}function qu(r){var t=Math.abs(r);return t>=fe?Math.round(r/fe)+"d":t>=Be?Math.round(r/Be)+"h":t>=De?Math.round(r/De)+"m":t>=ke?Math.round(r/ke)+"s":r+"ms"}function Zu(r){var t=Math.abs(r);return t>=fe?Dr(r,t,fe,"day"):t>=Be?Dr(r,t,Be,"hour"):t>=De?Dr(r,t,De,"minute"):t>=ke?Dr(r,t,ke,"second"):r+" ms"}function Dr(r,t,e,n){var i=t>=e*1.5;return Math.round(r/e)+" "+n+(i?"s":"")}});var On=B((Dp,Xs)=>{function Ku(r){e.debug=e,e.default=e,e.coerce=f,e.disable=s,e.enable=i,e.enabled=a,e.humanize=Ks(),e.destroy=d,Object.keys(r).forEach(h=>{e[h]=r[h]}),e.names=[],e.skips=[],e.formatters={};function t(h){let g=0;for(let w=0;w<h.length;w++)g=(g<<5)-g+h.charCodeAt(w),g|=0;return e.colors[Math.abs(g)%e.colors.length]}e.selectColor=t;function e(h){let g,w=null,S,b;function k(...A){if(!k.enabled)return;let C=k,D=Number(new Date),_=D-(g||D);C.diff=_,C.prev=g,C.curr=D,g=D,A[0]=e.coerce(A[0]),typeof A[0]!="string"&&A.unshift("%O");let G=0;A[0]=A[0].replace(/%([a-zA-Z%])/g,(st,nt)=>{if(st==="%%")return"%";G++;let ot=e.formatters[nt];if(typeof ot=="function"){let Tt=A[G];st=ot.call(C,Tt),A.splice(G,1),G--}return st}),e.formatArgs.call(C,A),(C.log||e.log).apply(C,A)}return k.namespace=h,k.useColors=e.useColors(),k.color=e.selectColor(h),k.extend=n,k.destroy=e.destroy,Object.defineProperty(k,"enabled",{enumerable:!0,configurable:!1,get:()=>w!==null?w:(S!==e.namespaces&&(S=e.namespaces,b=e.enabled(h)),b),set:A=>{w=A}}),typeof e.init=="function"&&e.init(k),k}function n(h,g){let w=e(this.namespace+(typeof g>"u"?":":g)+h);return w.log=this.log,w}function i(h){e.save(h),e.namespaces=h,e.names=[],e.skips=[];let g,w=(typeof h=="string"?h:"").split(/[\s,]+/),S=w.length;for(g=0;g<S;g++)w[g]&&(h=w[g].replace(/\*/g,".*?"),h[0]==="-"?e.skips.push(new RegExp("^"+h.slice(1)+"$")):e.names.push(new RegExp("^"+h+"$")))}function s(){let h=[...e.names.map(l),...e.skips.map(l).map(g=>"-"+g)].join(",");return e.enable(""),h}function a(h){if(h[h.length-1]==="*")return!0;let g,w;for(g=0,w=e.skips.length;g<w;g++)if(e.skips[g].test(h))return!1;for(g=0,w=e.names.length;g<w;g++)if(e.names[g].test(h))return!0;return!1}function l(h){return h.toString().substring(2,h.toString().length-2).replace(/\.\*\?$/,"*")}function f(h){return h instanceof Error?h.stack||h.message:h}function d(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return e.enable(e.load()),e}Xs.exports=Ku});var Ys=B((ht,Br)=>{ht.formatArgs=Yu;ht.save=ju;ht.load=Ju;ht.useColors=Xu;ht.storage=Qu();ht.destroy=(()=>{let r=!1;return()=>{r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();ht.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Xu(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Yu(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+Br.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;r.splice(1,0,t,"color: inherit");let e=0,n=0;r[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(e++,i==="%c"&&(n=e))}),r.splice(n,0,t)}ht.log=console.debug||console.log||(()=>{});function ju(r){try{r?ht.storage.setItem("debug",r):ht.storage.removeItem("debug")}catch{}}function Ju(){let r;try{r=ht.storage.getItem("debug")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function Qu(){try{return localStorage}catch{}}Br.exports=On()(ht);var{formatters:tl}=Br.exports;tl.j=function(r){try{return JSON.stringify(r)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var Js=B((Bp,js)=>{"use strict";js.exports=(r,t)=>{t=t||process.argv;let e=r.startsWith("-")?"":r.length===1?"-":"--",n=t.indexOf(e+r),i=t.indexOf("--");return n!==-1&&(i===-1?!0:n<i)}});var to=B((Rp,Qs)=>{"use strict";var el=Ft("os"),Bt=Js(),j=process.env,Re;Bt("no-color")||Bt("no-colors")||Bt("color=false")?Re=!1:(Bt("color")||Bt("colors")||Bt("color=true")||Bt("color=always"))&&(Re=!0);"FORCE_COLOR"in j&&(Re=j.FORCE_COLOR.length===0||parseInt(j.FORCE_COLOR,10)!==0);function rl(r){return r===0?!1:{level:r,hasBasic:!0,has256:r>=2,has16m:r>=3}}function nl(r){if(Re===!1)return 0;if(Bt("color=16m")||Bt("color=full")||Bt("color=truecolor"))return 3;if(Bt("color=256"))return 2;if(r&&!r.isTTY&&Re!==!0)return 0;let t=Re?1:0;if(process.platform==="win32"){let e=el.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in j)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(e=>e in j)||j.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in j)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(j.TEAMCITY_VERSION)?1:0;if(j.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in j){let e=parseInt((j.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(j.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(j.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(j.TERM)||"COLORTERM"in j?1:(j.TERM==="dumb",t)}function Pn(r){let t=nl(r);return rl(t)}Qs.exports={supportsColor:Pn,stdout:Pn(process.stdout),stderr:Pn(process.stderr)}});var ro=B((Y,_r)=>{var il=Ft("tty"),Rr=Ft("util");Y.init=fl;Y.log=al;Y.formatArgs=ol;Y.save=ul;Y.load=ll;Y.useColors=sl;Y.destroy=Rr.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");Y.colors=[6,2,3,4,5,1];try{let r=to();r&&(r.stderr||r).level>=2&&(Y.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}Y.inspectOpts=Object.keys(process.env).filter(r=>/^debug_/i.test(r)).reduce((r,t)=>{let e=t.substring(6).toLowerCase().replace(/_([a-z])/g,(i,s)=>s.toUpperCase()),n=process.env[t];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),r[e]=n,r},{});function sl(){return"colors"in Y.inspectOpts?!!Y.inspectOpts.colors:il.isatty(process.stderr.fd)}function ol(r){let{namespace:t,useColors:e}=this;if(e){let n=this.color,i="\x1B[3"+(n<8?n:"8;5;"+n),s=` ${i};1m${t} \x1B[0m`;r[0]=s+r[0].split(`
|
|
3
3
|
`).join(`
|
|
4
|
-
`+
|
|
5
|
-
`)}function
|
|
6
|
-
`).map(t=>t.trim()).join(" ")};Ja.O=function(r){return this.inspectOpts.colors=this.useColors,yn.inspect(r,this.inspectOpts)}});var Wa=P((vy,Do)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?Do.exports=$a():Do.exports=Xa()});var fc=P((Bw,uc)=>{"use strict";function cc(r,t){for(let e in t)Object.defineProperty(r,e,{value:t[e],enumerable:!0,configurable:!0});return r}function Sp(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 cc(r,e)}catch{e.message=r.message,e.stack=r.stack;let o=function(){};return o.prototype=Object.create(Object.getPrototypeOf(r)),cc(new o,e)}}uc.exports=Sp});var gu=P((_1,bu)=>{bu.exports=Pi;var mu=128,T0=127,I0=~T0,C0=Math.pow(2,31);function Pi(r,t,e){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw Pi.bytes=0,new RangeError("Could not encode varint");t=t||[],e=e||0;for(var n=e;r>=C0;)t[e++]=r&255|mu,r/=128;for(;r&I0;)t[e++]=r&255|mu,r>>>=7;return t[e]=r|0,Pi.bytes=e-n+1,t}});var xu=P((F1,wu)=>{wu.exports=_i;var D0=128,yu=127;function _i(r,n){var e=0,n=n||0,o=0,i=n,s,u=r.length;do{if(i>=u||o>49)throw _i.bytes=0,new RangeError("Could not decode varint");s=r[i++],e+=o<28?(s&yu)<<o:(s&yu)*Math.pow(2,o),o+=7}while(s>=D0);return _i.bytes=i-n,e}});var Eu=P((z1,vu)=>{var k0=Math.pow(2,7),B0=Math.pow(2,14),N0=Math.pow(2,21),L0=Math.pow(2,28),R0=Math.pow(2,35),O0=Math.pow(2,42),M0=Math.pow(2,49),U0=Math.pow(2,56),P0=Math.pow(2,63);vu.exports=function(r){return r<k0?1:r<B0?2:r<N0?3:r<L0?4:r<R0?5:r<O0?6:r<M0?7:r<U0?8:r<P0?9:10}});var Fi=P((V1,Su)=>{Su.exports={encode:gu(),decode:xu(),encodingLength:Eu()}});var ms=P((Hn,Yu)=>{(function(){var r,t=0xdeadbeefcafe,e=(t&16777215)==15715070;function n(a,c,f){a!=null&&(typeof a=="number"?this.fromNumber(a,c,f):c==null&&typeof a!="string"?this.fromString(a,256):this.fromString(a,c))}function o(){return new n(null)}function i(a,c,f,d,g,x){for(;--x>=0;){var A=c*this[a++]+f[d]+g;g=Math.floor(A/67108864),f[d++]=A&67108863}return g}function s(a,c,f,d,g,x){for(var A=c&32767,k=c>>15;--x>=0;){var V=this[a]&32767,tt=this[a++]>>15,vt=k*V+tt*A;V=A*V+((vt&32767)<<15)+f[d]+(g&1073741823),g=(V>>>30)+(vt>>>15)+k*tt+(g>>>30),f[d++]=V&1073741823}return g}function u(a,c,f,d,g,x){for(var A=c&16383,k=c>>14;--x>=0;){var V=this[a]&16383,tt=this[a++]>>14,vt=k*V+tt*A;V=A*V+((vt&16383)<<14)+f[d]+g,g=(V>>28)+(vt>>14)+k*tt,f[d++]=V&268435455}return g}var l=typeof navigator<"u";l&&e&&navigator.appName=="Microsoft Internet Explorer"?(n.prototype.am=s,r=30):l&&e&&navigator.appName!="Netscape"?(n.prototype.am=i,r=26):(n.prototype.am=u,r=28),n.prototype.DB=r,n.prototype.DM=(1<<r)-1,n.prototype.DV=1<<r;var m=52;n.prototype.FV=Math.pow(2,m),n.prototype.F1=m-r,n.prototype.F2=2*r-m;var h="0123456789abcdefghijklmnopqrstuvwxyz",b=new Array,w,T;for(w="0".charCodeAt(0),T=0;T<=9;++T)b[w++]=T;for(w="a".charCodeAt(0),T=10;T<36;++T)b[w++]=T;for(w="A".charCodeAt(0),T=10;T<36;++T)b[w++]=T;function p(a){return h.charAt(a)}function y(a,c){var f=b[a.charCodeAt(c)];return f??-1}function E(a){for(var c=this.t-1;c>=0;--c)a[c]=this[c];a.t=this.t,a.s=this.s}function v(a){this.t=1,this.s=a<0?-1:0,a>0?this[0]=a:a<-1?this[0]=a+this.DV:this.t=0}function S(a){var c=o();return c.fromInt(a),c}function I(a,c){var f;if(c==16)f=4;else if(c==8)f=3;else if(c==256)f=8;else if(c==2)f=1;else if(c==32)f=5;else if(c==4)f=2;else{this.fromRadix(a,c);return}this.t=0,this.s=0;for(var d=a.length,g=!1,x=0;--d>=0;){var A=f==8?a[d]&255:y(a,d);if(A<0){a.charAt(d)=="-"&&(g=!0);continue}g=!1,x==0?this[this.t++]=A:x+f>this.DB?(this[this.t-1]|=(A&(1<<this.DB-x)-1)<<x,this[this.t++]=A>>this.DB-x):this[this.t-1]|=A<<x,x+=f,x>=this.DB&&(x-=this.DB)}f==8&&a[0]&128&&(this.s=-1,x>0&&(this[this.t-1]|=(1<<this.DB-x)-1<<x)),this.clamp(),g&&n.ZERO.subTo(this,this)}function C(){for(var a=this.s&this.DM;this.t>0&&this[this.t-1]==a;)--this.t}function N(a){if(this.s<0)return"-"+this.negate().toString(a);var c;if(a==16)c=4;else if(a==8)c=3;else if(a==2)c=1;else if(a==32)c=5;else if(a==4)c=2;else return this.toRadix(a);var f=(1<<c)-1,d,g=!1,x="",A=this.t,k=this.DB-A*this.DB%c;if(A-- >0)for(k<this.DB&&(d=this[A]>>k)>0&&(g=!0,x=p(d));A>=0;)k<c?(d=(this[A]&(1<<k)-1)<<c-k,d|=this[--A]>>(k+=this.DB-c)):(d=this[A]>>(k-=c)&f,k<=0&&(k+=this.DB,--A)),d>0&&(g=!0),g&&(x+=p(d));return g?x:"0"}function M(){var a=o();return n.ZERO.subTo(this,a),a}function B(){return this.s<0?this.negate():this}function R(a){var c=this.s-a.s;if(c!=0)return c;var f=this.t;if(c=f-a.t,c!=0)return this.s<0?-c:c;for(;--f>=0;)if((c=this[f]-a[f])!=0)return c;return 0}function F(a){var c=1,f;return(f=a>>>16)!=0&&(a=f,c+=16),(f=a>>8)!=0&&(a=f,c+=8),(f=a>>4)!=0&&(a=f,c+=4),(f=a>>2)!=0&&(a=f,c+=2),(f=a>>1)!=0&&(a=f,c+=1),c}function Vf(){return this.t<=0?0:this.DB*(this.t-1)+F(this[this.t-1]^this.s&this.DM)}function $f(a,c){var f;for(f=this.t-1;f>=0;--f)c[f+a]=this[f];for(f=a-1;f>=0;--f)c[f]=0;c.t=this.t+a,c.s=this.s}function Gf(a,c){for(var f=a;f<this.t;++f)c[f-a]=this[f];c.t=Math.max(this.t-a,0),c.s=this.s}function Hf(a,c){var f=a%this.DB,d=this.DB-f,g=(1<<d)-1,x=Math.floor(a/this.DB),A=this.s<<f&this.DM,k;for(k=this.t-1;k>=0;--k)c[k+x+1]=this[k]>>d|A,A=(this[k]&g)<<f;for(k=x-1;k>=0;--k)c[k]=0;c[x]=A,c.t=this.t+x+1,c.s=this.s,c.clamp()}function qf(a,c){c.s=this.s;var f=Math.floor(a/this.DB);if(f>=this.t){c.t=0;return}var d=a%this.DB,g=this.DB-d,x=(1<<d)-1;c[0]=this[f]>>d;for(var A=f+1;A<this.t;++A)c[A-f-1]|=(this[A]&x)<<g,c[A-f]=this[A]>>d;d>0&&(c[this.t-f-1]|=(this.s&x)<<g),c.t=this.t-f,c.clamp()}function jf(a,c){for(var f=0,d=0,g=Math.min(a.t,this.t);f<g;)d+=this[f]-a[f],c[f++]=d&this.DM,d>>=this.DB;if(a.t<this.t){for(d-=a.s;f<this.t;)d+=this[f],c[f++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;f<a.t;)d-=a[f],c[f++]=d&this.DM,d>>=this.DB;d-=a.s}c.s=d<0?-1:0,d<-1?c[f++]=this.DV+d:d>0&&(c[f++]=d),c.t=f,c.clamp()}function Jf(a,c){var f=this.abs(),d=a.abs(),g=f.t;for(c.t=g+d.t;--g>=0;)c[g]=0;for(g=0;g<d.t;++g)c[g+f.t]=f.am(0,d[g],c,g,0,f.t);c.s=0,c.clamp(),this.s!=a.s&&n.ZERO.subTo(c,c)}function Xf(a){for(var c=this.abs(),f=a.t=2*c.t;--f>=0;)a[f]=0;for(f=0;f<c.t-1;++f){var d=c.am(f,c[f],a,2*f,0,1);(a[f+c.t]+=c.am(f+1,2*c[f],a,2*f+1,d,c.t-f-1))>=c.DV&&(a[f+c.t]-=c.DV,a[f+c.t+1]=1)}a.t>0&&(a[a.t-1]+=c.am(f,c[f],a,2*f,0,1)),a.s=0,a.clamp()}function Wf(a,c,f){var d=a.abs();if(!(d.t<=0)){var g=this.abs();if(g.t<d.t){c?.fromInt(0),f!=null&&this.copyTo(f);return}f==null&&(f=o());var x=o(),A=this.s,k=a.s,V=this.DB-F(d[d.t-1]);V>0?(d.lShiftTo(V,x),g.lShiftTo(V,f)):(d.copyTo(x),g.copyTo(f));var tt=x.t,vt=x[tt-1];if(vt!=0){var dt=vt*(1<<this.F1)+(tt>1?x[tt-2]>>this.F2:0),qt=this.FV/dt,Qr=(1<<this.F1)/dt,Nt=1<<this.F2,Lt=f.t,Yr=Lt-tt,te=c??o();for(x.dlShiftTo(Yr,te),f.compareTo(te)>=0&&(f[f.t++]=1,f.subTo(te,f)),n.ONE.dlShiftTo(tt,te),te.subTo(x,x);x.t<tt;)x[x.t++]=0;for(;--Yr>=0;){var co=f[--Lt]==vt?this.DM:Math.floor(f[Lt]*qt+(f[Lt-1]+Nt)*Qr);if((f[Lt]+=x.am(0,co,f,Yr,0,tt))<co)for(x.dlShiftTo(Yr,te),f.subTo(te,f);f[Lt]<--co;)f.subTo(te,f)}c!=null&&(f.drShiftTo(tt,c),A!=k&&n.ZERO.subTo(c,c)),f.t=tt,f.clamp(),V>0&&f.rShiftTo(V,f),A<0&&n.ZERO.subTo(f,f)}}}function Kf(a){var c=o();return this.abs().divRemTo(a,null,c),this.s<0&&c.compareTo(n.ZERO)>0&&a.subTo(c,c),c}function pe(a){this.m=a}function Zf(a){return a.s<0||a.compareTo(this.m)>=0?a.mod(this.m):a}function Qf(a){return a}function Yf(a){a.divRemTo(this.m,null,a)}function tl(a,c,f){a.multiplyTo(c,f),this.reduce(f)}function el(a,c){a.squareTo(c),this.reduce(c)}pe.prototype.convert=Zf,pe.prototype.revert=Qf,pe.prototype.reduce=Yf,pe.prototype.mulTo=tl,pe.prototype.sqrTo=el;function rl(){if(this.t<1)return 0;var a=this[0];if(!(a&1))return 0;var c=a&3;return c=c*(2-(a&15)*c)&15,c=c*(2-(a&255)*c)&255,c=c*(2-((a&65535)*c&65535))&65535,c=c*(2-a*c%this.DV)%this.DV,c>0?this.DV-c:-c}function de(a){this.m=a,this.mp=a.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<a.DB-15)-1,this.mt2=2*a.t}function nl(a){var c=o();return a.abs().dlShiftTo(this.m.t,c),c.divRemTo(this.m,null,c),a.s<0&&c.compareTo(n.ZERO)>0&&this.m.subTo(c,c),c}function ol(a){var c=o();return a.copyTo(c),this.reduce(c),c}function il(a){for(;a.t<=this.mt2;)a[a.t++]=0;for(var c=0;c<this.m.t;++c){var f=a[c]&32767,d=f*this.mpl+((f*this.mph+(a[c]>>15)*this.mpl&this.um)<<15)&a.DM;for(f=c+this.m.t,a[f]+=this.m.am(0,d,a,c,0,this.m.t);a[f]>=a.DV;)a[f]-=a.DV,a[++f]++}a.clamp(),a.drShiftTo(this.m.t,a),a.compareTo(this.m)>=0&&a.subTo(this.m,a)}function sl(a,c){a.squareTo(c),this.reduce(c)}function al(a,c,f){a.multiplyTo(c,f),this.reduce(f)}de.prototype.convert=nl,de.prototype.revert=ol,de.prototype.reduce=il,de.prototype.mulTo=al,de.prototype.sqrTo=sl;function cl(){return(this.t>0?this[0]&1:this.s)==0}function ul(a,c){if(a>4294967295||a<1)return n.ONE;var f=o(),d=o(),g=c.convert(this),x=F(a)-1;for(g.copyTo(f);--x>=0;)if(c.sqrTo(f,d),(a&1<<x)>0)c.mulTo(d,g,f);else{var A=f;f=d,d=A}return c.revert(f)}function fl(a,c){var f;return a<256||c.isEven()?f=new pe(c):f=new de(c),this.exp(a,f)}n.prototype.copyTo=E,n.prototype.fromInt=v,n.prototype.fromString=I,n.prototype.clamp=C,n.prototype.dlShiftTo=$f,n.prototype.drShiftTo=Gf,n.prototype.lShiftTo=Hf,n.prototype.rShiftTo=qf,n.prototype.subTo=jf,n.prototype.multiplyTo=Jf,n.prototype.squareTo=Xf,n.prototype.divRemTo=Wf,n.prototype.invDigit=rl,n.prototype.isEven=cl,n.prototype.exp=ul,n.prototype.toString=N,n.prototype.negate=M,n.prototype.abs=B,n.prototype.compareTo=R,n.prototype.bitLength=Vf,n.prototype.mod=Kf,n.prototype.modPowInt=fl,n.ZERO=S(0),n.ONE=S(1);function ll(){var a=o();return this.copyTo(a),a}function hl(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function pl(){return this.t==0?this.s:this[0]<<24>>24}function dl(){return this.t==0?this.s:this[0]<<16>>16}function ml(a){return Math.floor(Math.LN2*this.DB/Math.log(a))}function bl(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function gl(a){if(a==null&&(a=10),this.signum()==0||a<2||a>36)return"0";var c=this.chunkSize(a),f=Math.pow(a,c),d=S(f),g=o(),x=o(),A="";for(this.divRemTo(d,g,x);g.signum()>0;)A=(f+x.intValue()).toString(a).substr(1)+A,g.divRemTo(d,g,x);return x.intValue().toString(a)+A}function yl(a,c){this.fromInt(0),c==null&&(c=10);for(var f=this.chunkSize(c),d=Math.pow(c,f),g=!1,x=0,A=0,k=0;k<a.length;++k){var V=y(a,k);if(V<0){a.charAt(k)=="-"&&this.signum()==0&&(g=!0);continue}A=c*A+V,++x>=f&&(this.dMultiply(d),this.dAddOffset(A,0),x=0,A=0)}x>0&&(this.dMultiply(Math.pow(c,x)),this.dAddOffset(A,0)),g&&n.ZERO.subTo(this,this)}function wl(a,c,f){if(typeof c=="number")if(a<2)this.fromInt(1);else for(this.fromNumber(a,f),this.testBit(a-1)||this.bitwiseTo(n.ONE.shiftLeft(a-1),oo,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(c);)this.dAddOffset(2,0),this.bitLength()>a&&this.subTo(n.ONE.shiftLeft(a-1),this);else{var d=new Array,g=a&7;d.length=(a>>3)+1,c.nextBytes(d),g>0?d[0]&=(1<<g)-1:d[0]=0,this.fromString(d,256)}}function xl(){var a=this.t,c=new Array;c[0]=this.s;var f=this.DB-a*this.DB%8,d,g=0;if(a-- >0)for(f<this.DB&&(d=this[a]>>f)!=(this.s&this.DM)>>f&&(c[g++]=d|this.s<<this.DB-f);a>=0;)f<8?(d=(this[a]&(1<<f)-1)<<8-f,d|=this[--a]>>(f+=this.DB-8)):(d=this[a]>>(f-=8)&255,f<=0&&(f+=this.DB,--a)),d&128&&(d|=-256),g==0&&(this.s&128)!=(d&128)&&++g,(g>0||d!=this.s)&&(c[g++]=d);return c}function vl(a){return this.compareTo(a)==0}function El(a){return this.compareTo(a)<0?this:a}function Sl(a){return this.compareTo(a)>0?this:a}function Al(a,c,f){var d,g,x=Math.min(a.t,this.t);for(d=0;d<x;++d)f[d]=c(this[d],a[d]);if(a.t<this.t){for(g=a.s&this.DM,d=x;d<this.t;++d)f[d]=c(this[d],g);f.t=this.t}else{for(g=this.s&this.DM,d=x;d<a.t;++d)f[d]=c(g,a[d]);f.t=a.t}f.s=c(this.s,a.s),f.clamp()}function Tl(a,c){return a&c}function Il(a){var c=o();return this.bitwiseTo(a,Tl,c),c}function oo(a,c){return a|c}function Cl(a){var c=o();return this.bitwiseTo(a,oo,c),c}function $s(a,c){return a^c}function Dl(a){var c=o();return this.bitwiseTo(a,$s,c),c}function Gs(a,c){return a&~c}function kl(a){var c=o();return this.bitwiseTo(a,Gs,c),c}function Bl(){for(var a=o(),c=0;c<this.t;++c)a[c]=this.DM&~this[c];return a.t=this.t,a.s=~this.s,a}function Nl(a){var c=o();return a<0?this.rShiftTo(-a,c):this.lShiftTo(a,c),c}function Ll(a){var c=o();return a<0?this.lShiftTo(-a,c):this.rShiftTo(a,c),c}function Rl(a){if(a==0)return-1;var c=0;return a&65535||(a>>=16,c+=16),a&255||(a>>=8,c+=8),a&15||(a>>=4,c+=4),a&3||(a>>=2,c+=2),a&1||++c,c}function Ol(){for(var a=0;a<this.t;++a)if(this[a]!=0)return a*this.DB+Rl(this[a]);return this.s<0?this.t*this.DB:-1}function Ml(a){for(var c=0;a!=0;)a&=a-1,++c;return c}function Ul(){for(var a=0,c=this.s&this.DM,f=0;f<this.t;++f)a+=Ml(this[f]^c);return a}function Pl(a){var c=Math.floor(a/this.DB);return c>=this.t?this.s!=0:(this[c]&1<<a%this.DB)!=0}function _l(a,c){var f=n.ONE.shiftLeft(a);return this.bitwiseTo(f,c,f),f}function Fl(a){return this.changeBit(a,oo)}function zl(a){return this.changeBit(a,Gs)}function Vl(a){return this.changeBit(a,$s)}function $l(a,c){for(var f=0,d=0,g=Math.min(a.t,this.t);f<g;)d+=this[f]+a[f],c[f++]=d&this.DM,d>>=this.DB;if(a.t<this.t){for(d+=a.s;f<this.t;)d+=this[f],c[f++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;f<a.t;)d+=a[f],c[f++]=d&this.DM,d>>=this.DB;d+=a.s}c.s=d<0?-1:0,d>0?c[f++]=d:d<-1&&(c[f++]=this.DV+d),c.t=f,c.clamp()}function Gl(a){var c=o();return this.addTo(a,c),c}function Hl(a){var c=o();return this.subTo(a,c),c}function ql(a){var c=o();return this.multiplyTo(a,c),c}function jl(){var a=o();return this.squareTo(a),a}function Jl(a){var c=o();return this.divRemTo(a,c,null),c}function Xl(a){var c=o();return this.divRemTo(a,null,c),c}function Wl(a){var c=o(),f=o();return this.divRemTo(a,c,f),new Array(c,f)}function Kl(a){this[this.t]=this.am(0,a-1,this,0,0,this.t),++this.t,this.clamp()}function Zl(a,c){if(a!=0){for(;this.t<=c;)this[this.t++]=0;for(this[c]+=a;this[c]>=this.DV;)this[c]-=this.DV,++c>=this.t&&(this[this.t++]=0),++this[c]}}function Er(){}function Hs(a){return a}function Ql(a,c,f){a.multiplyTo(c,f)}function Yl(a,c){a.squareTo(c)}Er.prototype.convert=Hs,Er.prototype.revert=Hs,Er.prototype.mulTo=Ql,Er.prototype.sqrTo=Yl;function th(a){return this.exp(a,new Er)}function eh(a,c,f){var d=Math.min(this.t+a.t,c);for(f.s=0,f.t=d;d>0;)f[--d]=0;var g;for(g=f.t-this.t;d<g;++d)f[d+this.t]=this.am(0,a[d],f,d,0,this.t);for(g=Math.min(a.t,c);d<g;++d)this.am(0,a[d],f,d,0,c-d);f.clamp()}function rh(a,c,f){--c;var d=f.t=this.t+a.t-c;for(f.s=0;--d>=0;)f[d]=0;for(d=Math.max(c-this.t,0);d<a.t;++d)f[this.t+d-c]=this.am(c-d,a[d],f,0,0,this.t+d-c);f.clamp(),f.drShiftTo(1,f)}function me(a){this.r2=o(),this.q3=o(),n.ONE.dlShiftTo(2*a.t,this.r2),this.mu=this.r2.divide(a),this.m=a}function nh(a){if(a.s<0||a.t>2*this.m.t)return a.mod(this.m);if(a.compareTo(this.m)<0)return a;var c=o();return a.copyTo(c),this.reduce(c),c}function oh(a){return a}function ih(a){for(a.drShiftTo(this.m.t-1,this.r2),a.t>this.m.t+1&&(a.t=this.m.t+1,a.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);a.compareTo(this.r2)<0;)a.dAddOffset(1,this.m.t+1);for(a.subTo(this.r2,a);a.compareTo(this.m)>=0;)a.subTo(this.m,a)}function sh(a,c){a.squareTo(c),this.reduce(c)}function ah(a,c,f){a.multiplyTo(c,f),this.reduce(f)}me.prototype.convert=nh,me.prototype.revert=oh,me.prototype.reduce=ih,me.prototype.mulTo=ah,me.prototype.sqrTo=sh;function ch(a,c){var f=a.bitLength(),d,g=S(1),x;if(f<=0)return g;f<18?d=1:f<48?d=3:f<144?d=4:f<768?d=5:d=6,f<8?x=new pe(c):c.isEven()?x=new me(c):x=new de(c);var A=new Array,k=3,V=d-1,tt=(1<<d)-1;if(A[1]=x.convert(this),d>1){var vt=o();for(x.sqrTo(A[1],vt);k<=tt;)A[k]=o(),x.mulTo(vt,A[k-2],A[k]),k+=2}var dt=a.t-1,qt,Qr=!0,Nt=o(),Lt;for(f=F(a[dt])-1;dt>=0;){for(f>=V?qt=a[dt]>>f-V&tt:(qt=(a[dt]&(1<<f+1)-1)<<V-f,dt>0&&(qt|=a[dt-1]>>this.DB+f-V)),k=d;!(qt&1);)qt>>=1,--k;if((f-=k)<0&&(f+=this.DB,--dt),Qr)A[qt].copyTo(g),Qr=!1;else{for(;k>1;)x.sqrTo(g,Nt),x.sqrTo(Nt,g),k-=2;k>0?x.sqrTo(g,Nt):(Lt=g,g=Nt,Nt=Lt),x.mulTo(Nt,A[qt],g)}for(;dt>=0&&!(a[dt]&1<<f);)x.sqrTo(g,Nt),Lt=g,g=Nt,Nt=Lt,--f<0&&(f=this.DB-1,--dt)}return x.revert(g)}function uh(a){var c=this.s<0?this.negate():this.clone(),f=a.s<0?a.negate():a.clone();if(c.compareTo(f)<0){var d=c;c=f,f=d}var g=c.getLowestSetBit(),x=f.getLowestSetBit();if(x<0)return c;for(g<x&&(x=g),x>0&&(c.rShiftTo(x,c),f.rShiftTo(x,f));c.signum()>0;)(g=c.getLowestSetBit())>0&&c.rShiftTo(g,c),(g=f.getLowestSetBit())>0&&f.rShiftTo(g,f),c.compareTo(f)>=0?(c.subTo(f,c),c.rShiftTo(1,c)):(f.subTo(c,f),f.rShiftTo(1,f));return x>0&&f.lShiftTo(x,f),f}function fh(a){if(a<=0)return 0;var c=this.DV%a,f=this.s<0?a-1:0;if(this.t>0)if(c==0)f=this[0]%a;else for(var d=this.t-1;d>=0;--d)f=(c*f+this[d])%a;return f}function lh(a){var c=a.isEven();if(this.isEven()&&c||a.signum()==0)return n.ZERO;for(var f=a.clone(),d=this.clone(),g=S(1),x=S(0),A=S(0),k=S(1);f.signum()!=0;){for(;f.isEven();)f.rShiftTo(1,f),c?((!g.isEven()||!x.isEven())&&(g.addTo(this,g),x.subTo(a,x)),g.rShiftTo(1,g)):x.isEven()||x.subTo(a,x),x.rShiftTo(1,x);for(;d.isEven();)d.rShiftTo(1,d),c?((!A.isEven()||!k.isEven())&&(A.addTo(this,A),k.subTo(a,k)),A.rShiftTo(1,A)):k.isEven()||k.subTo(a,k),k.rShiftTo(1,k);f.compareTo(d)>=0?(f.subTo(d,f),c&&g.subTo(A,g),x.subTo(k,x)):(d.subTo(f,d),c&&A.subTo(g,A),k.subTo(x,k))}if(d.compareTo(n.ONE)!=0)return n.ZERO;if(k.compareTo(a)>=0)return k.subtract(a);if(k.signum()<0)k.addTo(a,k);else return k;return k.signum()<0?k.add(a):k}var ut=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],hh=(1<<26)/ut[ut.length-1];function ph(a){var c,f=this.abs();if(f.t==1&&f[0]<=ut[ut.length-1]){for(c=0;c<ut.length;++c)if(f[0]==ut[c])return!0;return!1}if(f.isEven())return!1;for(c=1;c<ut.length;){for(var d=ut[c],g=c+1;g<ut.length&&d<hh;)d*=ut[g++];for(d=f.modInt(d);c<g;)if(d%ut[c++]==0)return!1}return f.millerRabin(a)}function dh(a){var c=this.subtract(n.ONE),f=c.getLowestSetBit();if(f<=0)return!1;var d=c.shiftRight(f);a=a+1>>1,a>ut.length&&(a=ut.length);for(var g=o(),x=0;x<a;++x){g.fromInt(ut[Math.floor(Math.random()*ut.length)]);var A=g.modPow(d,this);if(A.compareTo(n.ONE)!=0&&A.compareTo(c)!=0){for(var k=1;k++<f&&A.compareTo(c)!=0;)if(A=A.modPowInt(2,this),A.compareTo(n.ONE)==0)return!1;if(A.compareTo(c)!=0)return!1}}return!0}n.prototype.chunkSize=ml,n.prototype.toRadix=gl,n.prototype.fromRadix=yl,n.prototype.fromNumber=wl,n.prototype.bitwiseTo=Al,n.prototype.changeBit=_l,n.prototype.addTo=$l,n.prototype.dMultiply=Kl,n.prototype.dAddOffset=Zl,n.prototype.multiplyLowerTo=eh,n.prototype.multiplyUpperTo=rh,n.prototype.modInt=fh,n.prototype.millerRabin=dh,n.prototype.clone=ll,n.prototype.intValue=hl,n.prototype.byteValue=pl,n.prototype.shortValue=dl,n.prototype.signum=bl,n.prototype.toByteArray=xl,n.prototype.equals=vl,n.prototype.min=El,n.prototype.max=Sl,n.prototype.and=Il,n.prototype.or=Cl,n.prototype.xor=Dl,n.prototype.andNot=kl,n.prototype.not=Bl,n.prototype.shiftLeft=Nl,n.prototype.shiftRight=Ll,n.prototype.getLowestSetBit=Ol,n.prototype.bitCount=Ul,n.prototype.testBit=Pl,n.prototype.setBit=Fl,n.prototype.clearBit=zl,n.prototype.flipBit=Vl,n.prototype.add=Gl,n.prototype.subtract=Hl,n.prototype.multiply=ql,n.prototype.divide=Jl,n.prototype.remainder=Xl,n.prototype.divideAndRemainder=Wl,n.prototype.modPow=ch,n.prototype.modInverse=lh,n.prototype.pow=th,n.prototype.gcd=uh,n.prototype.isProbablePrime=ph,n.prototype.square=jl,n.prototype.Barrett=me;var Zr,pt,Y;function mh(a){pt[Y++]^=a&255,pt[Y++]^=a>>8&255,pt[Y++]^=a>>16&255,pt[Y++]^=a>>24&255,Y>=ao&&(Y-=ao)}function qs(){mh(new Date().getTime())}if(pt==null){pt=new Array,Y=0;var Bt;if(typeof window<"u"&&window.crypto){if(window.crypto.getRandomValues){var js=new Uint8Array(32);for(window.crypto.getRandomValues(js),Bt=0;Bt<32;++Bt)pt[Y++]=js[Bt]}else if(navigator.appName=="Netscape"&&navigator.appVersion<"5"){var Js=window.crypto.random(32);for(Bt=0;Bt<Js.length;++Bt)pt[Y++]=Js.charCodeAt(Bt)&255}}for(;Y<ao;)Bt=Math.floor(65536*Math.random()),pt[Y++]=Bt>>>8,pt[Y++]=Bt&255;Y=0,qs()}function bh(){if(Zr==null){for(qs(),Zr=xh(),Zr.init(pt),Y=0;Y<pt.length;++Y)pt[Y]=0;Y=0}return Zr.next()}function gh(a){var c;for(c=0;c<a.length;++c)a[c]=bh()}function io(){}io.prototype.nextBytes=gh;function so(){this.i=0,this.j=0,this.S=new Array}function yh(a){var c,f,d;for(c=0;c<256;++c)this.S[c]=c;for(f=0,c=0;c<256;++c)f=f+this.S[c]+a[c%a.length]&255,d=this.S[c],this.S[c]=this.S[f],this.S[f]=d;this.i=0,this.j=0}function wh(){var a;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,a=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=a,this.S[a+this.S[this.i]&255]}so.prototype.init=yh,so.prototype.next=wh;function xh(){return new so}var ao=256;typeof Hn<"u"?Hn=Yu.exports={default:n,BigInteger:n,SecureRandom:io}:this.jsbn={BigInteger:n,SecureRandom:io}}).call(Hn)});var Hr=P(qn=>{(function(){"use strict";var r={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function t(s){return n(i(s),arguments)}function e(s,u){return t.apply(null,[s].concat(u||[]))}function n(s,u){var l=1,m=s.length,h,b="",w,T,p,y,E,v,S,I;for(w=0;w<m;w++)if(typeof s[w]=="string")b+=s[w];else if(typeof s[w]=="object"){if(p=s[w],p.keys)for(h=u[l],T=0;T<p.keys.length;T++){if(h==null)throw new Error(t('[sprintf] Cannot access property "%s" of undefined value "%s"',p.keys[T],p.keys[T-1]));h=h[p.keys[T]]}else p.param_no?h=u[p.param_no]:h=u[l++];if(r.not_type.test(p.type)&&r.not_primitive.test(p.type)&&h instanceof Function&&(h=h()),r.numeric_arg.test(p.type)&&typeof h!="number"&&isNaN(h))throw new TypeError(t("[sprintf] expecting number but found %T",h));switch(r.number.test(p.type)&&(S=h>=0),p.type){case"b":h=parseInt(h,10).toString(2);break;case"c":h=String.fromCharCode(parseInt(h,10));break;case"d":case"i":h=parseInt(h,10);break;case"j":h=JSON.stringify(h,null,p.width?parseInt(p.width):0);break;case"e":h=p.precision?parseFloat(h).toExponential(p.precision):parseFloat(h).toExponential();break;case"f":h=p.precision?parseFloat(h).toFixed(p.precision):parseFloat(h);break;case"g":h=p.precision?String(Number(h.toPrecision(p.precision))):parseFloat(h);break;case"o":h=(parseInt(h,10)>>>0).toString(8);break;case"s":h=String(h),h=p.precision?h.substring(0,p.precision):h;break;case"t":h=String(!!h),h=p.precision?h.substring(0,p.precision):h;break;case"T":h=Object.prototype.toString.call(h).slice(8,-1).toLowerCase(),h=p.precision?h.substring(0,p.precision):h;break;case"u":h=parseInt(h,10)>>>0;break;case"v":h=h.valueOf(),h=p.precision?h.substring(0,p.precision):h;break;case"x":h=(parseInt(h,10)>>>0).toString(16);break;case"X":h=(parseInt(h,10)>>>0).toString(16).toUpperCase();break}r.json.test(p.type)?b+=h:(r.number.test(p.type)&&(!S||p.sign)?(I=S?"+":"-",h=h.toString().replace(r.sign,"")):I="",E=p.pad_char?p.pad_char==="0"?"0":p.pad_char.charAt(1):" ",v=p.width-(I+h).length,y=p.width&&v>0?E.repeat(v):"",b+=p.align?I+h+y:E==="0"?I+y+h:y+I+h)}return b}var o=Object.create(null);function i(s){if(o[s])return o[s];for(var u=s,l,m=[],h=0;u;){if((l=r.text.exec(u))!==null)m.push(l[0]);else if((l=r.modulo.exec(u))!==null)m.push("%");else if((l=r.placeholder.exec(u))!==null){if(l[2]){h|=1;var b=[],w=l[2],T=[];if((T=r.key.exec(w))!==null)for(b.push(T[1]);(w=w.substring(T[0].length))!=="";)if((T=r.key_access.exec(w))!==null)b.push(T[1]);else if((T=r.index_access.exec(w))!==null)b.push(T[1]);else throw new SyntaxError("[sprintf] failed to parse named argument key");else throw new SyntaxError("[sprintf] failed to parse named argument key");l[2]=b}else h|=2;if(h===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");m.push({placeholder:l[0],param_no:l[1],keys:l[2],sign:l[3],pad_char:l[4],align:l[5],width:l[6],precision:l[7],type:l[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");u=u.substring(l[0].length)}return o[s]=m}typeof qn<"u"&&(qn.sprintf=t,qn.vsprintf=e),typeof window<"u"&&(window.sprintf=t,window.vsprintf=e,typeof define=="function"&&define.amd&&define(function(){return{sprintf:t,vsprintf:e}}))})()});var Wn=P((eE,lf)=>{lf.exports=r=>{if(r[Symbol.asyncIterator])return r;if(r.getReader)return async function*(){let t=r.getReader();try{for(;;){let{done:e,value:n}=await t.read();if(e)return;yield n}}finally{t.releaseLock()}}();throw new Error("unknown stream")}});var pf=P((rE,hf)=>{hf.exports=function(t){if(t){if(typeof t[Symbol.iterator]=="function")return t[Symbol.iterator]();if(typeof t[Symbol.asyncIterator]=="function")return t[Symbol.asyncIterator]();if(typeof t.next=="function")return t}throw new Error("argument is not an iterator or iterable")}});var Is=P((nE,df)=>{var $b=pf();df.exports=r=>async t=>{t=$b(t);let e=v=>{typeof v.return=="function"&&v.return()},n=null,o=null,i=v=>{n=v,o&&o(v),e(t)},s=null,u=!1,l=()=>{u=!0,s&&s()},m=null,h=!1,b=()=>{h=!0,m&&m()},w=null,T=()=>{w&&w()},p=()=>new Promise((v,S)=>{s=w=v,o=S,r.once("drain",T)}),y=()=>(e(t),new Promise((v,S)=>{if(u||h||n)return v();m=s=v,o=S})),E=()=>{r.removeListener("error",i),r.removeListener("close",l),r.removeListener("finish",b),r.removeListener("drain",T)};r.once("error",i),r.once("close",l),r.once("finish",b);try{for await(let v of t){if(!r.writable||r.destroyed||n)break;r.write(v)===!1&&await p()}}catch(v){n||r.destroy(),n=v}try{if(r.writable&&r.end(),await y(),n)throw n}finally{E()}}});var Cs=P((oE,mf)=>{var Gb=Is(),Hb=Wn();mf.exports=r=>({sink:Gb(r),source:Hb(r)})});var gf=P((iE,bf)=>{var qb=Cs();bf.exports=r=>async function*(t){let e=qb(r),n;if(e.sink(t).catch(o=>{n=o}),yield*e.source,n)throw n}});var yf=P((sE,br)=>{br.exports=Wn();br.exports.source=Wn();br.exports.sink=Is();br.exports.transform=gf();br.exports.duplex=Cs()});var Fg={};U(Fg,{Server:()=>no,createServer:()=>_g});var Eo=G(po(),1),Ma=G(Ca(),1),Ua=G(ge(),1),So=G(vo(),1),Pa=G(Oa(),1);function Mh(){Ua.default._configure(),Eo.default._configure(Ma.default),So.default._configure(Pa.default)}Mh();var _a=["uint64","int64","sint64","fixed64","sfixed64"];function Uh(r){for(let t of _a){if(r[t]==null)continue;let e=r[t];r[t]=function(){return BigInt(e.call(this).toString())}}return r}function Ao(r){return Uh(new Eo.default(r))}function Ph(r){for(let t of _a){if(r[t]==null)continue;let e=r[t];r[t]=function(n){return e.call(this,n.toString())}}return r}function To(){return Ph(So.default.create())}function W(r,t){let e=Ao(r instanceof Uint8Array?r:r.subarray());return t.decode(e)}function K(r,t){let e=To();return t.encode(r,e,{lengthDelimited:!1}),e.finish()}var Pe;(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"})(Pe||(Pe={}));function sn(r,t,e,n){return{name:r,type:t,encode:e,decode:n}}function jt(r){function t(o){if(r[o.toString()]==null)throw new Error("Invalid enum value");return r[o]}let e=function(i,s){let u=t(i);s.int32(u)},n=function(i){let s=i.int32();return t(s)};return sn("enum",Pe.VARINT,e,n)}function Z(r,t){return sn("message",Pe.LENGTH_DELIMITED,r,t)}var St;(function(r){let t;(function(o){o.IDENTIFY="IDENTIFY",o.CONNECT="CONNECT",o.STREAM_OPEN="STREAM_OPEN",o.STREAM_HANDLER="STREAM_HANDLER",o.DHT="DHT",o.LIST_PEERS="LIST_PEERS",o.CONNMANAGER="CONNMANAGER",o.DISCONNECT="DISCONNECT",o.PUBSUB="PUBSUB",o.PEERSTORE="PEERSTORE"})(t=r.Type||(r.Type={}));let e;(function(o){o[o.IDENTIFY=0]="IDENTIFY",o[o.CONNECT=1]="CONNECT",o[o.STREAM_OPEN=2]="STREAM_OPEN",o[o.STREAM_HANDLER=3]="STREAM_HANDLER",o[o.DHT=4]="DHT",o[o.LIST_PEERS=5]="LIST_PEERS",o[o.CONNMANAGER=6]="CONNMANAGER",o[o.DISCONNECT=7]="DISCONNECT",o[o.PUBSUB=8]="PUBSUB",o[o.PEERSTORE=9]="PEERSTORE"})(e||(e={})),function(o){o.codec=()=>jt(e)}(t=r.Type||(r.Type={}));let n;r.codec=()=>(n==null&&(n=Z((o,i,s={})=>{s.lengthDelimited!==!1&&i.fork(),o.type!=null&&(i.uint32(8),r.Type.codec().encode(o.type,i)),o.connect!=null&&(i.uint32(18),cn.codec().encode(o.connect,i)),o.streamOpen!=null&&(i.uint32(26),un.codec().encode(o.streamOpen,i)),o.streamHandler!=null&&(i.uint32(34),fn.codec().encode(o.streamHandler,i)),o.dht!=null&&(i.uint32(42),At.codec().encode(o.dht,i)),o.connManager!=null&&(i.uint32(50),hn.codec().encode(o.connManager,i)),o.disconnect!=null&&(i.uint32(58),pn.codec().encode(o.disconnect,i)),o.pubsub!=null&&(i.uint32(66),Jt.codec().encode(o.pubsub,i)),o.peerStore!=null&&(i.uint32(74),xe.codec().encode(o.peerStore,i)),s.lengthDelimited!==!1&&i.ldelim()},(o,i)=>{let s={},u=i==null?o.len:o.pos+i;for(;o.pos<u;){let l=o.uint32();switch(l>>>3){case 1:s.type=r.Type.codec().decode(o);break;case 2:s.connect=cn.codec().decode(o,o.uint32());break;case 3:s.streamOpen=un.codec().decode(o,o.uint32());break;case 4:s.streamHandler=fn.codec().decode(o,o.uint32());break;case 5:s.dht=At.codec().decode(o,o.uint32());break;case 6:s.connManager=hn.codec().decode(o,o.uint32());break;case 7:s.disconnect=pn.codec().decode(o,o.uint32());break;case 8:s.pubsub=Jt.codec().decode(o,o.uint32());break;case 9:s.peerStore=xe.codec().decode(o,o.uint32());break;default:o.skipType(l&7);break}}return s})),n),r.encode=o=>K(o,r.codec()),r.decode=o=>W(o,r.codec())})(St||(St={}));var we;(function(r){let t;(function(o){o.OK="OK",o.ERROR="ERROR"})(t=r.Type||(r.Type={}));let e;(function(o){o[o.OK=0]="OK",o[o.ERROR=1]="ERROR"})(e||(e={})),function(o){o.codec=()=>jt(e)}(t=r.Type||(r.Type={}));let n;r.codec=()=>(n==null&&(n=Z((o,i,s={})=>{if(s.lengthDelimited!==!1&&i.fork(),o.type!=null&&(i.uint32(8),r.Type.codec().encode(o.type,i)),o.error!=null&&(i.uint32(18),ln.codec().encode(o.error,i)),o.streamInfo!=null&&(i.uint32(26),_e.codec().encode(o.streamInfo,i)),o.identify!=null&&(i.uint32(34),an.codec().encode(o.identify,i)),o.dht!=null&&(i.uint32(42),rt.codec().encode(o.dht,i)),o.peers!=null)for(let u of o.peers)i.uint32(50),ne.codec().encode(u,i);o.pubsub!=null&&(i.uint32(58),dn.codec().encode(o.pubsub,i)),o.peerStore!=null&&(i.uint32(66),mn.codec().encode(o.peerStore,i)),s.lengthDelimited!==!1&&i.ldelim()},(o,i)=>{let s={peers:[]},u=i==null?o.len:o.pos+i;for(;o.pos<u;){let l=o.uint32();switch(l>>>3){case 1:s.type=r.Type.codec().decode(o);break;case 2:s.error=ln.codec().decode(o,o.uint32());break;case 3:s.streamInfo=_e.codec().decode(o,o.uint32());break;case 4:s.identify=an.codec().decode(o,o.uint32());break;case 5:s.dht=rt.codec().decode(o,o.uint32());break;case 6:s.peers.push(ne.codec().decode(o,o.uint32()));break;case 7:s.pubsub=dn.codec().decode(o,o.uint32());break;case 8:s.peerStore=mn.codec().decode(o,o.uint32());break;default:o.skipType(l&7);break}}return s})),n),r.encode=o=>K(o,r.codec()),r.decode=o=>W(o,r.codec())})(we||(we={}));var an;(function(r){let t;r.codec=()=>(t==null&&(t=Z((e,n,o={})=>{if(o.lengthDelimited!==!1&&n.fork(),e.id!=null&&e.id.byteLength>0&&(n.uint32(10),n.bytes(e.id)),e.addrs!=null)for(let i of e.addrs)n.uint32(18),n.bytes(i);o.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let o={id:new Uint8Array(0),addrs:[]},i=n==null?e.len:e.pos+n;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:o.id=e.bytes();break;case 2:o.addrs.push(e.bytes());break;default:e.skipType(s&7);break}}return o})),t),r.encode=e=>K(e,r.codec()),r.decode=e=>W(e,r.codec())})(an||(an={}));var cn;(function(r){let t;r.codec=()=>(t==null&&(t=Z((e,n,o={})=>{if(o.lengthDelimited!==!1&&n.fork(),e.peer!=null&&e.peer.byteLength>0&&(n.uint32(10),n.bytes(e.peer)),e.addrs!=null)for(let i of e.addrs)n.uint32(18),n.bytes(i);e.timeout!=null&&(n.uint32(24),n.int64(e.timeout)),o.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let o={peer:new Uint8Array(0),addrs:[]},i=n==null?e.len:e.pos+n;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:o.peer=e.bytes();break;case 2:o.addrs.push(e.bytes());break;case 3:o.timeout=e.int64();break;default:e.skipType(s&7);break}}return o})),t),r.encode=e=>K(e,r.codec()),r.decode=e=>W(e,r.codec())})(cn||(cn={}));var un;(function(r){let t;r.codec=()=>(t==null&&(t=Z((e,n,o={})=>{if(o.lengthDelimited!==!1&&n.fork(),e.peer!=null&&e.peer.byteLength>0&&(n.uint32(10),n.bytes(e.peer)),e.proto!=null)for(let i of e.proto)n.uint32(18),n.string(i);e.timeout!=null&&(n.uint32(24),n.int64(e.timeout)),o.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let o={peer:new Uint8Array(0),proto:[]},i=n==null?e.len:e.pos+n;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:o.peer=e.bytes();break;case 2:o.proto.push(e.string());break;case 3:o.timeout=e.int64();break;default:e.skipType(s&7);break}}return o})),t),r.encode=e=>K(e,r.codec()),r.decode=e=>W(e,r.codec())})(un||(un={}));var fn;(function(r){let t;r.codec=()=>(t==null&&(t=Z((e,n,o={})=>{if(o.lengthDelimited!==!1&&n.fork(),e.addr!=null&&e.addr.byteLength>0&&(n.uint32(10),n.bytes(e.addr)),e.proto!=null)for(let i of e.proto)n.uint32(18),n.string(i);o.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let o={addr:new Uint8Array(0),proto:[]},i=n==null?e.len:e.pos+n;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:o.addr=e.bytes();break;case 2:o.proto.push(e.string());break;default:e.skipType(s&7);break}}return o})),t),r.encode=e=>K(e,r.codec()),r.decode=e=>W(e,r.codec())})(fn||(fn={}));var ln;(function(r){let t;r.codec=()=>(t==null&&(t=Z((e,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),e.msg!=null&&e.msg!==""&&(n.uint32(10),n.string(e.msg)),o.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let o={msg:""},i=n==null?e.len:e.pos+n;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:o.msg=e.string();break;default:e.skipType(s&7);break}}return o})),t),r.encode=e=>K(e,r.codec()),r.decode=e=>W(e,r.codec())})(ln||(ln={}));var _e;(function(r){let t;r.codec=()=>(t==null&&(t=Z((e,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),e.peer!=null&&e.peer.byteLength>0&&(n.uint32(10),n.bytes(e.peer)),e.addr!=null&&e.addr.byteLength>0&&(n.uint32(18),n.bytes(e.addr)),e.proto!=null&&e.proto!==""&&(n.uint32(26),n.string(e.proto)),o.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let o={peer:new Uint8Array(0),addr:new Uint8Array(0),proto:""},i=n==null?e.len:e.pos+n;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:o.peer=e.bytes();break;case 2:o.addr=e.bytes();break;case 3:o.proto=e.string();break;default:e.skipType(s&7);break}}return o})),t),r.encode=e=>K(e,r.codec()),r.decode=e=>W(e,r.codec())})(_e||(_e={}));var At;(function(r){let t;(function(o){o.FIND_PEER="FIND_PEER",o.FIND_PEERS_CONNECTED_TO_PEER="FIND_PEERS_CONNECTED_TO_PEER",o.FIND_PROVIDERS="FIND_PROVIDERS",o.GET_CLOSEST_PEERS="GET_CLOSEST_PEERS",o.GET_PUBLIC_KEY="GET_PUBLIC_KEY",o.GET_VALUE="GET_VALUE",o.SEARCH_VALUE="SEARCH_VALUE",o.PUT_VALUE="PUT_VALUE",o.PROVIDE="PROVIDE"})(t=r.Type||(r.Type={}));let e;(function(o){o[o.FIND_PEER=0]="FIND_PEER",o[o.FIND_PEERS_CONNECTED_TO_PEER=1]="FIND_PEERS_CONNECTED_TO_PEER",o[o.FIND_PROVIDERS=2]="FIND_PROVIDERS",o[o.GET_CLOSEST_PEERS=3]="GET_CLOSEST_PEERS",o[o.GET_PUBLIC_KEY=4]="GET_PUBLIC_KEY",o[o.GET_VALUE=5]="GET_VALUE",o[o.SEARCH_VALUE=6]="SEARCH_VALUE",o[o.PUT_VALUE=7]="PUT_VALUE",o[o.PROVIDE=8]="PROVIDE"})(e||(e={})),function(o){o.codec=()=>jt(e)}(t=r.Type||(r.Type={}));let n;r.codec=()=>(n==null&&(n=Z((o,i,s={})=>{s.lengthDelimited!==!1&&i.fork(),o.type!=null&&(i.uint32(8),r.Type.codec().encode(o.type,i)),o.peer!=null&&(i.uint32(18),i.bytes(o.peer)),o.cid!=null&&(i.uint32(26),i.bytes(o.cid)),o.key!=null&&(i.uint32(34),i.bytes(o.key)),o.value!=null&&(i.uint32(42),i.bytes(o.value)),o.count!=null&&(i.uint32(48),i.int32(o.count)),o.timeout!=null&&(i.uint32(56),i.int64(o.timeout)),s.lengthDelimited!==!1&&i.ldelim()},(o,i)=>{let s={},u=i==null?o.len:o.pos+i;for(;o.pos<u;){let l=o.uint32();switch(l>>>3){case 1:s.type=r.Type.codec().decode(o);break;case 2:s.peer=o.bytes();break;case 3:s.cid=o.bytes();break;case 4:s.key=o.bytes();break;case 5:s.value=o.bytes();break;case 6:s.count=o.int32();break;case 7:s.timeout=o.int64();break;default:o.skipType(l&7);break}}return s})),n),r.encode=o=>K(o,r.codec()),r.decode=o=>W(o,r.codec())})(At||(At={}));var rt;(function(r){let t;(function(o){o.BEGIN="BEGIN",o.VALUE="VALUE",o.END="END"})(t=r.Type||(r.Type={}));let e;(function(o){o[o.BEGIN=0]="BEGIN",o[o.VALUE=1]="VALUE",o[o.END=2]="END"})(e||(e={})),function(o){o.codec=()=>jt(e)}(t=r.Type||(r.Type={}));let n;r.codec=()=>(n==null&&(n=Z((o,i,s={})=>{s.lengthDelimited!==!1&&i.fork(),o.type!=null&&(i.uint32(8),r.Type.codec().encode(o.type,i)),o.peer!=null&&(i.uint32(18),ne.codec().encode(o.peer,i)),o.value!=null&&(i.uint32(26),i.bytes(o.value)),s.lengthDelimited!==!1&&i.ldelim()},(o,i)=>{let s={},u=i==null?o.len:o.pos+i;for(;o.pos<u;){let l=o.uint32();switch(l>>>3){case 1:s.type=r.Type.codec().decode(o);break;case 2:s.peer=ne.codec().decode(o,o.uint32());break;case 3:s.value=o.bytes();break;default:o.skipType(l&7);break}}return s})),n),r.encode=o=>K(o,r.codec()),r.decode=o=>W(o,r.codec())})(rt||(rt={}));var ne;(function(r){let t;r.codec=()=>(t==null&&(t=Z((e,n,o={})=>{if(o.lengthDelimited!==!1&&n.fork(),e.id!=null&&e.id.byteLength>0&&(n.uint32(10),n.bytes(e.id)),e.addrs!=null)for(let i of e.addrs)n.uint32(18),n.bytes(i);o.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let o={id:new Uint8Array(0),addrs:[]},i=n==null?e.len:e.pos+n;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:o.id=e.bytes();break;case 2:o.addrs.push(e.bytes());break;default:e.skipType(s&7);break}}return o})),t),r.encode=e=>K(e,r.codec()),r.decode=e=>W(e,r.codec())})(ne||(ne={}));var hn;(function(r){let t;(function(o){o.TAG_PEER="TAG_PEER",o.UNTAG_PEER="UNTAG_PEER",o.TRIM="TRIM"})(t=r.Type||(r.Type={}));let e;(function(o){o[o.TAG_PEER=0]="TAG_PEER",o[o.UNTAG_PEER=1]="UNTAG_PEER",o[o.TRIM=2]="TRIM"})(e||(e={})),function(o){o.codec=()=>jt(e)}(t=r.Type||(r.Type={}));let n;r.codec=()=>(n==null&&(n=Z((o,i,s={})=>{s.lengthDelimited!==!1&&i.fork(),o.type!=null&&(i.uint32(8),r.Type.codec().encode(o.type,i)),o.peer!=null&&(i.uint32(18),i.bytes(o.peer)),o.tag!=null&&(i.uint32(26),i.string(o.tag)),o.weight!=null&&(i.uint32(32),i.int64(o.weight)),s.lengthDelimited!==!1&&i.ldelim()},(o,i)=>{let s={},u=i==null?o.len:o.pos+i;for(;o.pos<u;){let l=o.uint32();switch(l>>>3){case 1:s.type=r.Type.codec().decode(o);break;case 2:s.peer=o.bytes();break;case 3:s.tag=o.string();break;case 4:s.weight=o.int64();break;default:o.skipType(l&7);break}}return s})),n),r.encode=o=>K(o,r.codec()),r.decode=o=>W(o,r.codec())})(hn||(hn={}));var pn;(function(r){let t;r.codec=()=>(t==null&&(t=Z((e,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),e.peer!=null&&e.peer.byteLength>0&&(n.uint32(10),n.bytes(e.peer)),o.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let o={peer:new Uint8Array(0)},i=n==null?e.len:e.pos+n;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:o.peer=e.bytes();break;default:e.skipType(s&7);break}}return o})),t),r.encode=e=>K(e,r.codec()),r.decode=e=>W(e,r.codec())})(pn||(pn={}));var Jt;(function(r){let t;(function(o){o.GET_TOPICS="GET_TOPICS",o.LIST_PEERS="LIST_PEERS",o.PUBLISH="PUBLISH",o.SUBSCRIBE="SUBSCRIBE"})(t=r.Type||(r.Type={}));let e;(function(o){o[o.GET_TOPICS=0]="GET_TOPICS",o[o.LIST_PEERS=1]="LIST_PEERS",o[o.PUBLISH=2]="PUBLISH",o[o.SUBSCRIBE=3]="SUBSCRIBE"})(e||(e={})),function(o){o.codec=()=>jt(e)}(t=r.Type||(r.Type={}));let n;r.codec=()=>(n==null&&(n=Z((o,i,s={})=>{s.lengthDelimited!==!1&&i.fork(),o.type!=null&&(i.uint32(8),r.Type.codec().encode(o.type,i)),o.topic!=null&&(i.uint32(18),i.string(o.topic)),o.data!=null&&(i.uint32(26),i.bytes(o.data)),s.lengthDelimited!==!1&&i.ldelim()},(o,i)=>{let s={},u=i==null?o.len:o.pos+i;for(;o.pos<u;){let l=o.uint32();switch(l>>>3){case 1:s.type=r.Type.codec().decode(o);break;case 2:s.topic=o.string();break;case 3:s.data=o.bytes();break;default:o.skipType(l&7);break}}return s})),n),r.encode=o=>K(o,r.codec()),r.decode=o=>W(o,r.codec())})(Jt||(Jt={}));var Tr;(function(r){let t;r.codec=()=>(t==null&&(t=Z((e,n,o={})=>{if(o.lengthDelimited!==!1&&n.fork(),e.from!=null&&(n.uint32(10),n.bytes(e.from)),e.data!=null&&(n.uint32(18),n.bytes(e.data)),e.seqno!=null&&(n.uint32(26),n.bytes(e.seqno)),e.topicIDs!=null)for(let i of e.topicIDs)n.uint32(34),n.string(i);e.signature!=null&&(n.uint32(42),n.bytes(e.signature)),e.key!=null&&(n.uint32(50),n.bytes(e.key)),o.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let o={topicIDs:[]},i=n==null?e.len:e.pos+n;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:o.from=e.bytes();break;case 2:o.data=e.bytes();break;case 3:o.seqno=e.bytes();break;case 4:o.topicIDs.push(e.string());break;case 5:o.signature=e.bytes();break;case 6:o.key=e.bytes();break;default:e.skipType(s&7);break}}return o})),t),r.encode=e=>K(e,r.codec()),r.decode=e=>W(e,r.codec())})(Tr||(Tr={}));var dn;(function(r){let t;r.codec=()=>(t==null&&(t=Z((e,n,o={})=>{if(o.lengthDelimited!==!1&&n.fork(),e.topics!=null)for(let i of e.topics)n.uint32(10),n.string(i);if(e.peerIDs!=null)for(let i of e.peerIDs)n.uint32(18),n.bytes(i);o.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let o={topics:[],peerIDs:[]},i=n==null?e.len:e.pos+n;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:o.topics.push(e.string());break;case 2:o.peerIDs.push(e.bytes());break;default:e.skipType(s&7);break}}return o})),t),r.encode=e=>K(e,r.codec()),r.decode=e=>W(e,r.codec())})(dn||(dn={}));var xe;(function(r){let t;(function(o){o.UNSPECIFIED="UNSPECIFIED",o.GET_PROTOCOLS="GET_PROTOCOLS",o.GET_PEER_INFO="GET_PEER_INFO"})(t=r.Type||(r.Type={}));let e;(function(o){o[o.UNSPECIFIED=0]="UNSPECIFIED",o[o.GET_PROTOCOLS=1]="GET_PROTOCOLS",o[o.GET_PEER_INFO=2]="GET_PEER_INFO"})(e||(e={})),function(o){o.codec=()=>jt(e)}(t=r.Type||(r.Type={}));let n;r.codec=()=>(n==null&&(n=Z((o,i,s={})=>{if(s.lengthDelimited!==!1&&i.fork(),o.type!=null&&(i.uint32(8),r.Type.codec().encode(o.type,i)),o.id!=null&&(i.uint32(18),i.bytes(o.id)),o.protos!=null)for(let u of o.protos)i.uint32(26),i.string(u);s.lengthDelimited!==!1&&i.ldelim()},(o,i)=>{let s={protos:[]},u=i==null?o.len:o.pos+i;for(;o.pos<u;){let l=o.uint32();switch(l>>>3){case 1:s.type=r.Type.codec().decode(o);break;case 2:s.id=o.bytes();break;case 3:s.protos.push(o.string());break;default:o.skipType(l&7);break}}return s})),n),r.encode=o=>K(o,r.codec()),r.decode=o=>W(o,r.codec())})(xe||(xe={}));var mn;(function(r){let t;r.codec=()=>(t==null&&(t=Z((e,n,o={})=>{if(o.lengthDelimited!==!1&&n.fork(),e.peer!=null&&(n.uint32(10),ne.codec().encode(e.peer,n)),e.protos!=null)for(let i of e.protos)n.uint32(18),n.string(i);o.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let o={protos:[]},i=n==null?e.len:e.pos+n;for(;e.pos<i;){let s=e.uint32();switch(s>>>3){case 1:o.peer=ne.codec().decode(e,e.uint32());break;case 2:o.protos.push(e.string());break;default:e.skipType(s&7);break}}return o})),t),r.encode=e=>K(e,r.codec()),r.decode=e=>W(e,r.codec())})(mn||(mn={}));var bt=G(Wa(),1);function ap(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),s=i.charCodeAt(0);if(e[s]!==255)throw new TypeError(i+" is ambiguous");e[s]=o}var u=r.length,l=r.charAt(0),m=Math.log(u)/Math.log(256),h=Math.log(256)/Math.log(u);function b(p){if(p instanceof Uint8Array||(ArrayBuffer.isView(p)?p=new Uint8Array(p.buffer,p.byteOffset,p.byteLength):Array.isArray(p)&&(p=Uint8Array.from(p))),!(p instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(p.length===0)return"";for(var y=0,E=0,v=0,S=p.length;v!==S&&p[v]===0;)v++,y++;for(var I=(S-v)*h+1>>>0,C=new Uint8Array(I);v!==S;){for(var N=p[v],M=0,B=I-1;(N!==0||M<E)&&B!==-1;B--,M++)N+=256*C[B]>>>0,C[B]=N%u>>>0,N=N/u>>>0;if(N!==0)throw new Error("Non-zero carry");E=M,v++}for(var R=I-E;R!==I&&C[R]===0;)R++;for(var F=l.repeat(y);R<I;++R)F+=r.charAt(C[R]);return F}function w(p){if(typeof p!="string")throw new TypeError("Expected String");if(p.length===0)return new Uint8Array;var y=0;if(p[y]!==" "){for(var E=0,v=0;p[y]===l;)E++,y++;for(var S=(p.length-y)*m+1>>>0,I=new Uint8Array(S);p[y];){var C=e[p.charCodeAt(y)];if(C===255)return;for(var N=0,M=S-1;(C!==0||N<v)&&M!==-1;M--,N++)C+=u*I[M]>>>0,I[M]=C%256>>>0,C=C/256>>>0;if(C!==0)throw new Error("Non-zero carry");v=N,y++}if(p[y]!==" "){for(var B=S-v;B!==S&&I[B]===0;)B++;for(var R=new Uint8Array(E+(S-B)),F=E;B!==S;)R[F++]=I[B++];return R}}}function T(p){var y=w(p);if(y)return y;throw new Error(`Non-${t} character`)}return{encode:b,decodeUnsafe:w,decode:T}}var cp=ap,up=cp,Ka=up;var Sy=new Uint8Array(0);var Za=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 ko=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")}},Bo=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 Qa(this,t)}},No=class{constructor(t){this.decoders=t}or(t){return Qa(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`)}},Qa=(r,t)=>new No({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),Lo=class{constructor(t,e,n,o){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=o,this.encoder=new ko(t,e,n),this.decoder=new Bo(t,e,o)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}},Ya=({name:r,prefix:t,encode:e,decode:n})=>new Lo(r,t,e,n),Ro=({prefix:r,name:t,alphabet:e})=>{let{encode:n,decode:o}=Ka(e,t);return Ya({prefix:r,name:t,encode:n,decode:i=>Za(o(i))})},fp=(r,t,e,n)=>{let o={};for(let h=0;h<t.length;++h)o[t[h]]=h;let i=r.length;for(;r[i-1]==="=";)--i;let s=new Uint8Array(i*e/8|0),u=0,l=0,m=0;for(let h=0;h<i;++h){let b=o[r[h]];if(b===void 0)throw new SyntaxError(`Non-${n} character`);l=l<<e|b,u+=e,u>=8&&(u-=8,s[m++]=255&l>>u)}if(u>=e||255&l<<8-u)throw new SyntaxError("Unexpected end of data");return s},lp=(r,t,e)=>{let n=t[t.length-1]==="=",o=(1<<e)-1,i="",s=0,u=0;for(let l=0;l<r.length;++l)for(u=u<<8|r[l],s+=8;s>e;)s-=e,i+=t[o&u>>s];if(s&&(i+=t[o&u<<e-s]),n)for(;i.length*e&7;)i+="=";return i},ft=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>Ya({prefix:t,name:r,encode(o){return lp(o,n,e)},decode(o){return fp(o,n,e,r)}});var tc=ft({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ky=ft({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),By=ft({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ny=ft({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Ly=ft({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Ry=ft({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Oy=ft({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),My=ft({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Uy=ft({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var ec=Ro({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Fy=Ro({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var rc=ft({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),$y=ft({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Gy=ft({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Hy=ft({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});bt.default.formatters.b=r=>r==null?"undefined":ec.baseEncode(r);bt.default.formatters.t=r=>r==null?"undefined":tc.baseEncode(r);bt.default.formatters.m=r=>r==null?"undefined":rc.baseEncode(r);bt.default.formatters.p=r=>r==null?"undefined":r.toString();bt.default.formatters.c=r=>r==null?"undefined":r.toString();bt.default.formatters.k=r=>r==null?"undefined":r.toString();bt.default.formatters.a=r=>r==null?"undefined":r.toString();function hp(r){let t=()=>{};return t.enabled=!1,t.color="",t.diff=0,t.log=()=>{},t.namespace=r,t.destroy=()=>!0,t.extend=()=>t,t}function it(r){let t=hp(`${r}:trace`);return bt.default.enabled(`${r}:trace`)&&bt.default.names.map(e=>e.toString()).find(e=>e.includes(":trace"))!=null&&(t=(0,bt.default)(`${r}:trace`)),Object.assign((0,bt.default)(r),{error:(0,bt.default)(`${r}:error`),trace:t})}function Ee(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function Xt(r=0){return globalThis.Buffer?.alloc!=null?Ee(globalThis.Buffer.alloc(r)):new Uint8Array(r)}function Pt(r=0){return globalThis.Buffer?.allocUnsafe!=null?Ee(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Tt(r,t){t==null&&(t=r.reduce((o,i)=>o+i.length,0));let e=Pt(t),n=0;for(let o of r)e.set(o,n),n+=o.length;return Ee(e)}function Se(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 oc=Symbol.for("@achingbrain/uint8arraylist");function nc(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 xn(r){return!!r?.[oc]}var zt=class r{constructor(...t){Object.defineProperty(this,oc,{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(xn(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(xn(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=nc(this.bufs,t);return e.buf[e.index]}set(t,e){let n=nc(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(xn(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 Tt(n,o)}subarray(t,e){let{bufs:n,length:o}=this._subList(t,e);return n.length===1?n[0]:Tt(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 s=this.bufs[i],u=o,l=u+s.byteLength;if(o=l,t>=l)continue;let m=t>=u&&t<l,h=e>u&&e<=l;if(m&&h){if(t===u&&e===l){n.push(s);break}let b=t-u;n.push(s.subarray(b,b+(e-t)));break}if(m){if(t===0){n.push(s);continue}n.push(s.subarray(t-u));continue}if(h){if(e===l){n.push(s);break}n.push(s.subarray(0,e-u));break}n.push(s)}return{bufs:n,length:e-t}}indexOf(t,e=0){if(!xn(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,s=new Int32Array(i);for(let b=0;b<i;b++)s[b]=-1;for(let b=0;b<o;b++)s[n[b]]=b;let u=s,l=this.byteLength-n.byteLength,m=n.byteLength-1,h;for(let b=e;b<=l;b+=h){h=0;for(let w=m;w>=0;w--){let T=this.get(b+w);if(n[w]!==T){h=Math.max(1,w-u[T]);break}}if(h===0)return b}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=Pt(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=Xt(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=Xt(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=Xt(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=Pt(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=Xt(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=Xt(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=Xt(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=Xt(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=Xt(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(!Se(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 ic(r){let t=async function*(){let e=yield,n=new zt;for await(let o of r){if(e==null){n.append(o),e=yield n,n=new zt;continue}for(n.append(o);n.length>=e;){let i=n.sublist(0,e);if(n.consume(e),e=yield i,e==null){n.length>0&&(e=yield n,n=new zt);break}}}if(e!=null)throw Object.assign(new Error(`stream ended before ${e} bytes became available`),{code:"ERR_UNDER_READ",buffer:n})}();return t.next(),t}function Ge(){let r={};return r.promise=new Promise((t,e)=>{r.resolve=t,r.reject=e}),r}var vn=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}},He=class{size;hwm;head;tail;constructor(t={}){this.hwm=t.splitLimit??16,this.head=new vn(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 vn(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 Oo=class extends Error{type;code;constructor(t,e){super(t??"The operation was aborted"),this.type="aborted",this.code=e??"ABORT_ERR"}};function oe(r={}){return pp(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 pp(r,t){t=t??{};let e=t.onEnd,n=new He,o,i,s,u=Ge(),l=async()=>{try{return n.isEmpty()?s?{done:!0}:await new Promise((E,v)=>{i=S=>{i=null,n.push(S);try{E(r(n))}catch(I){v(I)}return o}}):r(n)}finally{n.isEmpty()&&queueMicrotask(()=>{u.resolve(),u=Ge()})}},m=E=>i!=null?i(E):(n.push(E),o),h=E=>(n=new He,i!=null?i({error:E}):(n.push({error:E}),o)),b=E=>{if(s)return o;if(t?.objectMode!==!0&&E?.byteLength==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return m({done:!1,value:E})},w=E=>s?o:(s=!0,E!=null?h(E):m({done:!0})),T=()=>(n=new He,w(),{done:!0}),p=E=>(w(E),{done:!0});if(o={[Symbol.asyncIterator](){return this},next:l,return:T,throw:p,push:b,end:w,get readableLength(){return n.size},onEmpty:async E=>{let v=E?.signal;if(v?.throwIfAborted(),n.isEmpty())return;let S,I;v!=null&&(S=new Promise((C,N)=>{I=()=>{N(new Oo)},v.addEventListener("abort",I)}));try{await Promise.race([u.promise,S])}finally{I!=null&&v!=null&&v?.removeEventListener("abort",I)}}},e==null)return o;let y=o;return o={[Symbol.asyncIterator](){return this},next(){return y.next()},throw(E){return y.throw(E),e!=null&&(e(E),e=void 0),{done:!0}},return(){return y.return(),e!=null&&(e(),e=void 0),{done:!0}},push:b,end(E){return y.end(E),e!=null&&(e(E),e=void 0),o},get readableLength(){return y.readableLength}},o}function sc(r){let t=oe(),e=ic(r.source),n=Ge(),o,i=r.sink(async function*(){yield*t,yield*await n.promise}());return i.catch(u=>{o=u}),{reader:e,writer:t,stream:{sink:async u=>{if(o!=null){await Promise.reject(o);return}n.resolve(u),await i},source:e},rest:()=>t.end(),write:t.push,read:async()=>{let u=await e.next();if(u.value!=null)return u.value}}}function En(r){return r instanceof Uint8Array?{get(t){return r[t]},set(t,e){r[t]=e}}:{get(t){return r.get(t)},set(t,e){r.set(t,e)}}}var ac=4294967296,Ir=class r{constructor(t=0,e=0){this.hi=t,this.lo=e}toBigInt(t){if(t===!0)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)}toNumber(t){return Number(this.toBigInt(t))}zzDecode(){let t=-(this.lo&1),e=((this.lo>>>1|this.hi<<31)^t)>>>0,n=(this.hi>>>1^t)>>>0;return new r(n,e)}zzEncode(){let t=this.hi>>31,e=((this.hi<<1|this.lo>>>31)^t)>>>0,n=(this.lo<<1^t)>>>0;return new r(e,n)}toBytes(t,e=0){let n=En(t);for(;this.hi>0;)n.set(e++,this.lo&127|128),this.lo=(this.lo>>>7|this.hi<<25)>>>0,this.hi>>>=7;for(;this.lo>127;)n.set(e++,this.lo&127|128),this.lo=this.lo>>>7;n.set(e++,this.lo)}static fromBigInt(t){if(t===0n)return new r;let e=t<0;e&&(t=-t);let n=Number(t>>32n)|0,o=Number(t-(BigInt(n)<<32n))|0;return e&&(n=~n>>>0,o=~o>>>0,++o>ac&&(o=0,++n>ac&&(n=0))),new r(n,o)}static fromNumber(t){if(t===0)return new r;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(o,n)}static fromBytes(t,e=0){let n=En(t),o=new r,i=0;if(t.length-e>4){for(;i<4;++i)if(o.lo=(o.lo|(n.get(e)&127)<<i*7)>>>0,n.get(e++)<128)return o;if(o.lo=(o.lo|(n.get(e)&127)<<28)>>>0,o.hi=(o.hi|(n.get(e)&127)>>4)>>>0,n.get(e++)<128)return o;i=0}else for(;i<4;++i){if(e>=t.length)throw RangeError(`index out of range: ${e} > ${t.length}`);if(o.lo=(o.lo|(n.get(e)&127)<<i*7)>>>0,n.get(e++)<128)return o}if(t.length-e>4){for(;i<5;++i)if(o.hi=(o.hi|(n.get(e)&127)<<i*7+3)>>>0,n.get(e++)<128)return o}else if(e<t.byteLength)for(;i<5;++i){if(e>=t.length)throw RangeError(`index out of range: ${e} > ${t.length}`);if(o.hi=(o.hi|(n.get(e)&127)<<i*7+3)>>>0,n.get(e++)<128)return o}throw RangeError("invalid varint encoding")}};var dp=Math.pow(2,7),mp=Math.pow(2,14),bp=Math.pow(2,21),gp=Math.pow(2,28),yp=Math.pow(2,35),wp=Math.pow(2,42),xp=Math.pow(2,49),vp=Math.pow(2,56),Ep=Math.pow(2,63),Ae={encodingLength(r){return r<dp?1:r<mp?2:r<bp?3:r<gp?4:r<yp?5:r<wp?6:r<xp?7:r<vp?8:r<Ep?9:10},encode(r,t,e=0){if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return t==null&&(t=Pt(Ae.encodingLength(r))),Ir.fromNumber(r).toBytes(t,e),t},decode(r,t=0){return Ir.fromBytes(r,t).toNumber(!0)}};function Sn(r){return r[Symbol.asyncIterator]!=null}var An=r=>{let t=Ae.encodingLength(r),e=Pt(t);return Ae.encode(r,e),An.bytes=t,e};An.bytes=0;function qe(r,t){t=t??{};let e=t.lengthEncoder??An;function*n(o){let i=e(o.byteLength);i instanceof Uint8Array?yield i:yield*i,o instanceof Uint8Array?yield o:yield*o}return Sn(r)?async function*(){for await(let o of r)yield*n(o)}():function*(){for(let o of r)yield*n(o)}()}qe.single=(r,t)=>{t=t??{};let e=t.lengthEncoder??An;return new zt(e(r.byteLength),r)};var je=G(fc(),1);var Ap=8,Tp=1024*1024*4,Te;(function(r){r[r.LENGTH=0]="LENGTH",r[r.DATA=1]="DATA"})(Te||(Te={}));var Mo=r=>{let t=Ae.decode(r);return Mo.bytes=Ae.encodingLength(t),t};Mo.bytes=0;function Cr(r,t){let e=new zt,n=Te.LENGTH,o=-1,i=t?.lengthDecoder??Mo,s=t?.maxLengthLength??Ap,u=t?.maxDataLength??Tp;function*l(){for(;e.byteLength>0;){if(n===Te.LENGTH)try{if(o=i(e),o<0)throw(0,je.default)(new Error("invalid message length"),"ERR_INVALID_MSG_LENGTH");if(o>u)throw(0,je.default)(new Error("message length too long"),"ERR_MSG_DATA_TOO_LONG");let m=i.bytes;e.consume(m),t?.onLength!=null&&t.onLength(o),n=Te.DATA}catch(m){if(m instanceof RangeError){if(e.byteLength>s)throw(0,je.default)(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG");break}throw m}if(n===Te.DATA){if(e.byteLength<o)break;let m=e.sublist(0,o);e.consume(o),t?.onData!=null&&t.onData(m),yield m,n=Te.LENGTH}}}return Sn(r)?async function*(){for await(let m of r)e.append(m),yield*l();if(e.byteLength>0)throw(0,je.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}():function*(){for(let m of r)e.append(m),yield*l();if(e.byteLength>0)throw(0,je.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}()}Cr.fromReader=(r,t)=>{let e=1,n=async function*(){for(;;)try{let{done:i,value:s}=await r.next(e);if(i===!0)return;s!=null&&(yield s)}catch(i){if(i.code==="ERR_UNDER_READ")return{done:!0,value:null};throw i}finally{e=1}}();return Cr(n,{...t??{},onLength:i=>{e=i}})};var Uo=it("libp2p:daemon-protocol:stream-handler"),Tn=class{stream;shake;decoder;constructor(t){let{stream:e,maxLength:n}=t;this.stream=e,this.shake=sc(this.stream),this.decoder=Cr.fromReader(this.shake.reader,{maxDataLength:n??4096})}async read(){let t=await this.decoder.next();if(t.value!=null)return t.value.subarray();Uo("read received no value, closing stream"),await this.close()}write(t){Uo("write message"),this.shake.write(qe.single(t).subarray())}rest(){return this.shake.rest(),this.shake.stream}async close(){Uo("closing the stream"),await this.rest().sink([])}};var Po={upgradeInbound:async r=>r,upgradeOutbound:async r=>r};var Je=class r extends Error{code;type;constructor(t="The operation was aborted"){super(t),this.code=r.code,this.type=r.type}static code="ABORT_ERR";static type="aborted"},It=class extends Error{code;props;constructor(t,e,n){super(t),this.code=e,this.name=n?.name??"CodeError",this.props=n??{}}};var hc=Symbol.for("@libp2p/peer-id");var $o={};U($o,{base58btc:()=>gt,base58flickr:()=>Np});function Ip(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),s=i.charCodeAt(0);if(e[s]!==255)throw new TypeError(i+" is ambiguous");e[s]=o}var u=r.length,l=r.charAt(0),m=Math.log(u)/Math.log(256),h=Math.log(256)/Math.log(u);function b(p){if(p instanceof Uint8Array||(ArrayBuffer.isView(p)?p=new Uint8Array(p.buffer,p.byteOffset,p.byteLength):Array.isArray(p)&&(p=Uint8Array.from(p))),!(p instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(p.length===0)return"";for(var y=0,E=0,v=0,S=p.length;v!==S&&p[v]===0;)v++,y++;for(var I=(S-v)*h+1>>>0,C=new Uint8Array(I);v!==S;){for(var N=p[v],M=0,B=I-1;(N!==0||M<E)&&B!==-1;B--,M++)N+=256*C[B]>>>0,C[B]=N%u>>>0,N=N/u>>>0;if(N!==0)throw new Error("Non-zero carry");E=M,v++}for(var R=I-E;R!==I&&C[R]===0;)R++;for(var F=l.repeat(y);R<I;++R)F+=r.charAt(C[R]);return F}function w(p){if(typeof p!="string")throw new TypeError("Expected String");if(p.length===0)return new Uint8Array;var y=0;if(p[y]!==" "){for(var E=0,v=0;p[y]===l;)E++,y++;for(var S=(p.length-y)*m+1>>>0,I=new Uint8Array(S);p[y];){var C=e[p.charCodeAt(y)];if(C===255)return;for(var N=0,M=S-1;(C!==0||N<v)&&M!==-1;M--,N++)C+=u*I[M]>>>0,I[M]=C%256>>>0,C=C/256>>>0;if(C!==0)throw new Error("Non-zero carry");v=N,y++}if(p[y]!==" "){for(var B=S-v;B!==S&&I[B]===0;)B++;for(var R=new Uint8Array(E+(S-B)),F=E;B!==S;)R[F++]=I[B++];return R}}}function T(p){var y=w(p);if(y)return y;throw new Error(`Non-${t} character`)}return{encode:b,decodeUnsafe:w,decode:T}}var Cp=Ip,Dp=Cp,pc=Dp;var Hw=new Uint8Array(0);var dc=(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},Ct=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 mc=r=>new TextEncoder().encode(r),bc=r=>new TextDecoder().decode(r);var _o=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")}},Fo=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 yc(this,t)}},zo=class{constructor(t){this.decoders=t}or(t){return yc(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`)}},yc=(r,t)=>new zo({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),Vo=class{constructor(t,e,n,o){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=o,this.encoder=new _o(t,e,n),this.decoder=new Fo(t,e,o)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}},Xe=({name:r,prefix:t,encode:e,decode:n})=>new Vo(r,t,e,n),ie=({prefix:r,name:t,alphabet:e})=>{let{encode:n,decode:o}=pc(e,t);return Xe({prefix:r,name:t,encode:n,decode:i=>Ct(o(i))})},kp=(r,t,e,n)=>{let o={};for(let h=0;h<t.length;++h)o[t[h]]=h;let i=r.length;for(;r[i-1]==="=";)--i;let s=new Uint8Array(i*e/8|0),u=0,l=0,m=0;for(let h=0;h<i;++h){let b=o[r[h]];if(b===void 0)throw new SyntaxError(`Non-${n} character`);l=l<<e|b,u+=e,u>=8&&(u-=8,s[m++]=255&l>>u)}if(u>=e||255&l<<8-u)throw new SyntaxError("Unexpected end of data");return s},Bp=(r,t,e)=>{let n=t[t.length-1]==="=",o=(1<<e)-1,i="",s=0,u=0;for(let l=0;l<r.length;++l)for(u=u<<8|r[l],s+=8;s>e;)s-=e,i+=t[o&u>>s];if(s&&(i+=t[o&u<<e-s]),n)for(;i.length*e&7;)i+="=";return i},H=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>Xe({prefix:t,name:r,encode(o){return Bp(o,n,e)},decode(o){return kp(o,n,e,r)}});var gt=ie({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Np=ie({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Go={};U(Go,{identity:()=>Lp});var Lp=Xe({prefix:"\0",name:"identity",encode:r=>bc(r),decode:r=>mc(r)});var Ho={};U(Ho,{base2:()=>Rp});var Rp=H({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var qo={};U(qo,{base8:()=>Op});var Op=H({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var jo={};U(jo,{base10:()=>Mp});var Mp=ie({prefix:"9",name:"base10",alphabet:"0123456789"});var Jo={};U(Jo,{base16:()=>Up,base16upper:()=>Pp});var Up=H({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Pp=H({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Xo={};U(Xo,{base32:()=>We,base32hex:()=>Vp,base32hexpad:()=>Gp,base32hexpadupper:()=>Hp,base32hexupper:()=>$p,base32pad:()=>Fp,base32padupper:()=>zp,base32upper:()=>_p,base32z:()=>qp});var We=H({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),_p=H({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Fp=H({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),zp=H({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Vp=H({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),$p=H({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Gp=H({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Hp=H({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),qp=H({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Wo={};U(Wo,{base36:()=>jp,base36upper:()=>Jp});var jp=ie({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Jp=ie({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Ko={};U(Ko,{base64:()=>Xp,base64pad:()=>Wp,base64url:()=>Kp,base64urlpad:()=>Zp});var Xp=H({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Wp=H({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Kp=H({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Zp=H({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Zo={};U(Zo,{base256emoji:()=>rd});var wc=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}"),Qp=wc.reduce((r,t,e)=>(r[e]=t,r),[]),Yp=wc.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function td(r){return r.reduce((t,e)=>(t+=Qp[e],t),"")}function ed(r){let t=[];for(let e of r){let n=Yp[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}var rd=Xe({prefix:"\u{1F680}",name:"base256emoji",encode:td,decode:ed});var ri={};U(ri,{sha256:()=>Cn,sha512:()=>vd});var ei=G(Rt("crypto"),1);var nd=Ec,xc=128,od=127,id=~od,sd=Math.pow(2,31);function Ec(r,t,e){t=t||[],e=e||0;for(var n=e;r>=sd;)t[e++]=r&255|xc,r/=128;for(;r&id;)t[e++]=r&255|xc,r>>>=7;return t[e]=r|0,Ec.bytes=e-n+1,t}var ad=Qo,cd=128,vc=127;function Qo(r,n){var e=0,n=n||0,o=0,i=n,s,u=r.length;do{if(i>=u)throw Qo.bytes=0,new RangeError("Could not decode varint");s=r[i++],e+=o<28?(s&vc)<<o:(s&vc)*Math.pow(2,o),o+=7}while(s>=cd);return Qo.bytes=i-n,e}var ud=Math.pow(2,7),fd=Math.pow(2,14),ld=Math.pow(2,21),hd=Math.pow(2,28),pd=Math.pow(2,35),dd=Math.pow(2,42),md=Math.pow(2,49),bd=Math.pow(2,56),gd=Math.pow(2,63),yd=function(r){return r<ud?1:r<fd?2:r<ld?3:r<hd?4:r<pd?5:r<dd?6:r<md?7:r<bd?8:r<gd?9:10},wd={encode:nd,decode:ad,encodingLength:yd},xd=wd,Dr=xd;var kr=(r,t=0)=>[Dr.decode(r,t),Dr.decode.bytes],Ke=(r,t,e=0)=>(Dr.encode(r,t,e),t),Ze=r=>Dr.encodingLength(r);var se=(r,t)=>{let e=t.byteLength,n=Ze(r),o=n+Ze(e),i=new Uint8Array(o+e);return Ke(r,i,0),Ke(e,i,n),i.set(t,o),new Qe(r,e,t,i)},Br=r=>{let t=Ct(r),[e,n]=kr(t),[o,i]=kr(t.subarray(n)),s=t.subarray(n+i);if(s.byteLength!==o)throw new Error("Incorrect length");return new Qe(e,o,s,t)},Sc=(r,t)=>{if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&dc(r.bytes,e.bytes)}},Qe=class{constructor(t,e,n,o){this.code=t,this.size=e,this.digest=n,this.bytes=o}};var ti=({name:r,code:t,encode:e})=>new Yo(r,t,e),Yo=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?se(this.code,e):e.then(n=>se(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Cn=ti({name:"sha2-256",code:18,encode:r=>Ct(ei.default.createHash("sha256").update(r).digest())}),vd=ti({name:"sha2-512",code:19,encode:r=>Ct(ei.default.createHash("sha512").update(r).digest())});var ni={};U(ni,{identity:()=>Dn});var Tc=0,Ed="identity",Ic=Ct,Sd=r=>se(Tc,Ic(r)),Dn={code:Tc,name:Ed,encode:Ic,digest:Sd};var h2=new TextEncoder,p2=new TextDecoder;var Cc=(r,t)=>{let{bytes:e,version:n}=r;switch(n){case 0:return Cd(e,oi(r),t||gt.encoder);default:return Dd(e,oi(r),t||We.encoder)}};var Dc=new WeakMap,oi=r=>{let t=Dc.get(r);if(t==null){let e=new Map;return Dc.set(r,e),e}return t},Ie=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!==Nr)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==kd)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=se(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&&Sc(t.multihash,n.multihash)}toString(t){return Cc(this,t)}toJSON(){return{"/":Cc(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:s}=e;return new r(n,o,i,s||kc(n,o,i.bytes))}else if(e[Bd]===!0){let{version:n,multihash:o,code:i}=e,s=Br(o);return r.create(n,i,s)}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!==Nr)throw new Error(`Version 0 CID must use dag-pb (code: ${Nr}) block encoding`);return new r(t,e,n,n.bytes)}case 1:{let o=kc(t,e,n.bytes);return new r(t,e,n,o)}default:throw new Error("Invalid version")}}static createV0(t){return r.create(0,Nr,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=Ct(t.subarray(n,n+e.multihashSize));if(o.byteLength!==e.multihashSize)throw new Error("Incorrect length");let i=o.subarray(e.multihashSize-e.digestSize),s=new Qe(e.multihashCode,e.digestSize,i,o);return[e.version===0?r.createV0(s):r.createV1(e.codec,s),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[b,w]=kr(t.subarray(e));return e+=w,b},o=n(),i=Nr;if(o===18?(o=0,e=0):i=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let s=e,u=n(),l=n(),m=e+l,h=m-s;return{version:o,codec:i,multihashCode:u,digestSize:l,multihashSize:h,size:m}}static parse(t,e){let[n,o]=Id(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 oi(i).set(n,t),i}},Id=(r,t)=>{switch(r[0]){case"Q":{let e=t||gt;return[gt.prefix,e.decode(`${gt.prefix}${r}`)]}case gt.prefix:{let e=t||gt;return[gt.prefix,e.decode(r)]}case We.prefix:{let e=t||We;return[We.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)]}}},Cd=(r,t,e)=>{let{prefix:n}=e;if(n!==gt.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},Dd=(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},Nr=112,kd=18,kc=(r,t,e)=>{let n=Ze(r),o=n+Ze(t),i=new Uint8Array(o+e.byteLength);return Ke(r,i,0),Ke(t,i,n),i.set(e,o),i},Bd=Symbol.for("@ipld/js-cid/CID");var ii={...Go,...Ho,...qo,...jo,...Jo,...Xo,...Wo,...$o,...Ko,...Zo},S2={...ri,...ni};var Nd=Symbol.for("nodejs.util.inspect.custom"),Bc=Object.values(ii).map(r=>r.decoder).reduce((r,t)=>r.or(t),ii.identity.decoder),Nc=114,Lc=36,Rc=37,Lr=class{type;multihash;privateKey;publicKey;string;constructor(t){this.type=t.type,this.multihash=t.multihash,this.privateKey=t.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}[hc]=!0;toString(){return this.string==null&&(this.string=gt.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return Ie.createV1(Nc,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(t){if(t instanceof Uint8Array)return Se(this.multihash.bytes,t);if(typeof t=="string")return Ld(t).equals(this);if(t?.multihash?.bytes!=null)return Se(this.multihash.bytes,t.multihash.bytes);throw new Error("not valid Id")}[Nd](){return`PeerId(${this.toString()})`}},Rr=class extends Lr{type="RSA";publicKey;constructor(t){super({...t,type:"RSA"}),this.publicKey=t.publicKey}},Or=class extends Lr{type="Ed25519";publicKey;constructor(t){super({...t,type:"Ed25519"}),this.publicKey=t.multihash.digest}},Mr=class extends Lr{type="secp256k1";publicKey;constructor(t){super({...t,type:"secp256k1"}),this.publicKey=t.multihash.digest}};function Ld(r,t){if(t=t??Bc,r.charAt(0)==="1"||r.charAt(0)==="Q"){let e=Br(gt.decode(`z${r}`));return r.startsWith("12D")?new Or({multihash:e}):r.startsWith("16U")?new Mr({multihash:e}):new Rr({multihash:e})}return Ce(Bc.decode(r))}function Ce(r){try{let t=Br(r);if(t.code===Dn.code){if(t.digest.length===Lc)return new Or({multihash:t});if(t.digest.length===Rc)return new Mr({multihash:t})}if(t.code===Cn.code)return new Rr({multihash:t})}catch{return Rd(Ie.decode(r))}throw new Error("Supplied PeerID CID is invalid")}function Rd(r){if(r==null||r.multihash==null||r.version==null||r.version===1&&r.code!==Nc)throw new Error("Supplied PeerID CID is invalid");let t=r.multihash;if(t.code===Cn.code)return new Rr({multihash:r.multihash});if(t.code===Dn.code){if(t.digest.length===Lc)return new Or({multihash:r.multihash});if(t.digest.length===Rc)return new Mr({multihash:r.multihash})}throw new Error("Supplied PeerID CID is invalid")}var Ef=G(Rt("net"),1);var Mc=Symbol.for("@libp2p/transport");var Oc;(function(r){r[r.FATAL_ALL=0]="FATAL_ALL",r[r.NO_FATAL=1]="NO_FATAL"})(Oc||(Oc={}));var kn=class extends Error{code;props;constructor(t,e,n){super(t),this.code=e,this.name=n?.name??"CodeError",this.props=n??{}}};var fi={};U(fi,{base58btc:()=>lt,base58flickr:()=>Fd});function Od(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),s=i.charCodeAt(0);if(e[s]!==255)throw new TypeError(i+" is ambiguous");e[s]=o}var u=r.length,l=r.charAt(0),m=Math.log(u)/Math.log(256),h=Math.log(256)/Math.log(u);function b(p){if(p instanceof Uint8Array||(ArrayBuffer.isView(p)?p=new Uint8Array(p.buffer,p.byteOffset,p.byteLength):Array.isArray(p)&&(p=Uint8Array.from(p))),!(p instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(p.length===0)return"";for(var y=0,E=0,v=0,S=p.length;v!==S&&p[v]===0;)v++,y++;for(var I=(S-v)*h+1>>>0,C=new Uint8Array(I);v!==S;){for(var N=p[v],M=0,B=I-1;(N!==0||M<E)&&B!==-1;B--,M++)N+=256*C[B]>>>0,C[B]=N%u>>>0,N=N/u>>>0;if(N!==0)throw new Error("Non-zero carry");E=M,v++}for(var R=I-E;R!==I&&C[R]===0;)R++;for(var F=l.repeat(y);R<I;++R)F+=r.charAt(C[R]);return F}function w(p){if(typeof p!="string")throw new TypeError("Expected String");if(p.length===0)return new Uint8Array;var y=0;if(p[y]!==" "){for(var E=0,v=0;p[y]===l;)E++,y++;for(var S=(p.length-y)*m+1>>>0,I=new Uint8Array(S);p[y];){var C=e[p.charCodeAt(y)];if(C===255)return;for(var N=0,M=S-1;(C!==0||N<v)&&M!==-1;M--,N++)C+=u*I[M]>>>0,I[M]=C%256>>>0,C=C/256>>>0;if(C!==0)throw new Error("Non-zero carry");v=N,y++}if(p[y]!==" "){for(var B=S-v;B!==S&&I[B]===0;)B++;for(var R=new Uint8Array(E+(S-B)),F=E;B!==S;)R[F++]=I[B++];return R}}}function T(p){var y=w(p);if(y)return y;throw new Error(`Non-${t} character`)}return{encode:b,decodeUnsafe:w,decode:T}}var Md=Od,Ud=Md,Uc=Ud;var P2=new Uint8Array(0);var Pc=(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},Dt=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 _c=r=>new TextEncoder().encode(r),Fc=r=>new TextDecoder().decode(r);var si=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")}},ai=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 Vc(this,t)}},ci=class{constructor(t){this.decoders=t}or(t){return Vc(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`)}},Vc=(r,t)=>new ci({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),ui=class{constructor(t,e,n,o){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=o,this.encoder=new si(t,e,n),this.decoder=new ai(t,e,o)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}},tr=({name:r,prefix:t,encode:e,decode:n})=>new ui(r,t,e,n),ae=({prefix:r,name:t,alphabet:e})=>{let{encode:n,decode:o}=Uc(e,t);return tr({prefix:r,name:t,encode:n,decode:i=>Dt(o(i))})},Pd=(r,t,e,n)=>{let o={};for(let h=0;h<t.length;++h)o[t[h]]=h;let i=r.length;for(;r[i-1]==="=";)--i;let s=new Uint8Array(i*e/8|0),u=0,l=0,m=0;for(let h=0;h<i;++h){let b=o[r[h]];if(b===void 0)throw new SyntaxError(`Non-${n} character`);l=l<<e|b,u+=e,u>=8&&(u-=8,s[m++]=255&l>>u)}if(u>=e||255&l<<8-u)throw new SyntaxError("Unexpected end of data");return s},_d=(r,t,e)=>{let n=t[t.length-1]==="=",o=(1<<e)-1,i="",s=0,u=0;for(let l=0;l<r.length;++l)for(u=u<<8|r[l],s+=8;s>e;)s-=e,i+=t[o&u>>s];if(s&&(i+=t[o&u<<e-s]),n)for(;i.length*e&7;)i+="=";return i},q=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>tr({prefix:t,name:r,encode(o){return _d(o,n,e)},decode(o){return Pd(o,n,e,r)}});var lt=ae({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Fd=ae({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var zd=Hc,$c=128,Vd=127,$d=~Vd,Gd=Math.pow(2,31);function Hc(r,t,e){t=t||[],e=e||0;for(var n=e;r>=Gd;)t[e++]=r&255|$c,r/=128;for(;r&$d;)t[e++]=r&255|$c,r>>>=7;return t[e]=r|0,Hc.bytes=e-n+1,t}var Hd=li,qd=128,Gc=127;function li(r,n){var e=0,n=n||0,o=0,i=n,s,u=r.length;do{if(i>=u)throw li.bytes=0,new RangeError("Could not decode varint");s=r[i++],e+=o<28?(s&Gc)<<o:(s&Gc)*Math.pow(2,o),o+=7}while(s>=qd);return li.bytes=i-n,e}var jd=Math.pow(2,7),Jd=Math.pow(2,14),Xd=Math.pow(2,21),Wd=Math.pow(2,28),Kd=Math.pow(2,35),Zd=Math.pow(2,42),Qd=Math.pow(2,49),Yd=Math.pow(2,56),tm=Math.pow(2,63),em=function(r){return r<jd?1:r<Jd?2:r<Xd?3:r<Wd?4:r<Kd?5:r<Zd?6:r<Qd?7:r<Yd?8:r<tm?9:10},rm={encode:zd,decode:Hd,encodingLength:em},nm=rm,Ur=nm;var Pr=(r,t=0)=>[Ur.decode(r,t),Ur.decode.bytes],er=(r,t,e=0)=>(Ur.encode(r,t,e),t),rr=r=>Ur.encodingLength(r);var De=(r,t)=>{let e=t.byteLength,n=rr(r),o=n+rr(e),i=new Uint8Array(o+e);return er(r,i,0),er(e,i,n),i.set(t,o),new nr(r,e,t,i)},Nn=r=>{let t=Dt(r),[e,n]=Pr(t),[o,i]=Pr(t.subarray(n)),s=t.subarray(n+i);if(s.byteLength!==o)throw new Error("Incorrect length");return new nr(e,o,s,t)},qc=(r,t)=>{if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&Pc(r.bytes,e.bytes)}},nr=class{constructor(t,e,n,o){this.code=t,this.size=e,this.digest=n,this.bytes=o}};var hi={};U(hi,{base32:()=>Wt,base32hex:()=>am,base32hexpad:()=>um,base32hexpadupper:()=>fm,base32hexupper:()=>cm,base32pad:()=>im,base32padupper:()=>sm,base32upper:()=>om,base32z:()=>lm});var Wt=q({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),om=q({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),im=q({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),sm=q({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),am=q({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),cm=q({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),um=q({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),fm=q({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),lm=q({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var jc=(r,t)=>{let{bytes:e,version:n}=r;switch(n){case 0:return pm(e,pi(r),t||lt.encoder);default:return dm(e,pi(r),t||Wt.encoder)}};var Jc=new WeakMap,pi=r=>{let t=Jc.get(r);if(t==null){let e=new Map;return Jc.set(r,e),e}return t},ce=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!==_r)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==mm)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=De(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&&qc(t.multihash,n.multihash)}toString(t){return jc(this,t)}toJSON(){return{"/":jc(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:s}=e;return new r(n,o,i,s||Xc(n,o,i.bytes))}else if(e[bm]===!0){let{version:n,multihash:o,code:i}=e,s=Nn(o);return r.create(n,i,s)}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!==_r)throw new Error(`Version 0 CID must use dag-pb (code: ${_r}) block encoding`);return new r(t,e,n,n.bytes)}case 1:{let o=Xc(t,e,n.bytes);return new r(t,e,n,o)}default:throw new Error("Invalid version")}}static createV0(t){return r.create(0,_r,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=Dt(t.subarray(n,n+e.multihashSize));if(o.byteLength!==e.multihashSize)throw new Error("Incorrect length");let i=o.subarray(e.multihashSize-e.digestSize),s=new nr(e.multihashCode,e.digestSize,i,o);return[e.version===0?r.createV0(s):r.createV1(e.codec,s),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[b,w]=Pr(t.subarray(e));return e+=w,b},o=n(),i=_r;if(o===18?(o=0,e=0):i=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let s=e,u=n(),l=n(),m=e+l,h=m-s;return{version:o,codec:i,multihashCode:u,digestSize:l,multihashSize:h,size:m}}static parse(t,e){let[n,o]=hm(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 pi(i).set(n,t),i}},hm=(r,t)=>{switch(r[0]){case"Q":{let e=t||lt;return[lt.prefix,e.decode(`${lt.prefix}${r}`)]}case lt.prefix:{let e=t||lt;return[lt.prefix,e.decode(r)]}case Wt.prefix:{let e=t||Wt;return[Wt.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)]}}},pm=(r,t,e)=>{let{prefix:n}=e;if(n!==lt.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},dm=(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},_r=112,mm=18,Xc=(r,t,e)=>{let n=rr(r),o=n+rr(t),i=new Uint8Array(o+e.byteLength);return er(r,i,0),er(t,i,n),i.set(e,o),i},bm=Symbol.for("@ipld/js-cid/CID");var yi={};U(yi,{identity:()=>Em});function gm(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),s=i.charCodeAt(0);if(e[s]!==255)throw new TypeError(i+" is ambiguous");e[s]=o}var u=r.length,l=r.charAt(0),m=Math.log(u)/Math.log(256),h=Math.log(256)/Math.log(u);function b(p){if(p instanceof Uint8Array||(ArrayBuffer.isView(p)?p=new Uint8Array(p.buffer,p.byteOffset,p.byteLength):Array.isArray(p)&&(p=Uint8Array.from(p))),!(p instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(p.length===0)return"";for(var y=0,E=0,v=0,S=p.length;v!==S&&p[v]===0;)v++,y++;for(var I=(S-v)*h+1>>>0,C=new Uint8Array(I);v!==S;){for(var N=p[v],M=0,B=I-1;(N!==0||M<E)&&B!==-1;B--,M++)N+=256*C[B]>>>0,C[B]=N%u>>>0,N=N/u>>>0;if(N!==0)throw new Error("Non-zero carry");E=M,v++}for(var R=I-E;R!==I&&C[R]===0;)R++;for(var F=l.repeat(y);R<I;++R)F+=r.charAt(C[R]);return F}function w(p){if(typeof p!="string")throw new TypeError("Expected String");if(p.length===0)return new Uint8Array;var y=0;if(p[y]!==" "){for(var E=0,v=0;p[y]===l;)E++,y++;for(var S=(p.length-y)*m+1>>>0,I=new Uint8Array(S);p[y];){var C=e[p.charCodeAt(y)];if(C===255)return;for(var N=0,M=S-1;(C!==0||N<v)&&M!==-1;M--,N++)C+=u*I[M]>>>0,I[M]=C%256>>>0,C=C/256>>>0;if(C!==0)throw new Error("Non-zero carry");v=N,y++}if(p[y]!==" "){for(var B=S-v;B!==S&&I[B]===0;)B++;for(var R=new Uint8Array(E+(S-B)),F=E;B!==S;)R[F++]=I[B++];return R}}}function T(p){var y=w(p);if(y)return y;throw new Error(`Non-${t} character`)}return{encode:b,decodeUnsafe:w,decode:T}}var ym=gm,wm=ym,Wc=wm;var Q2=new Uint8Array(0);var Kc=(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},kt=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 Zc=r=>new TextEncoder().encode(r),Qc=r=>new TextDecoder().decode(r);var di=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")}},mi=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 tu(this,t)}},bi=class{constructor(t){this.decoders=t}or(t){return tu(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`)}},tu=(r,t)=>new bi({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),gi=class{constructor(t,e,n,o){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=o,this.encoder=new di(t,e,n),this.decoder=new mi(t,e,o)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}},ir=({name:r,prefix:t,encode:e,decode:n})=>new gi(r,t,e,n),ue=({prefix:r,name:t,alphabet:e})=>{let{encode:n,decode:o}=Wc(e,t);return ir({prefix:r,name:t,encode:n,decode:i=>kt(o(i))})},xm=(r,t,e,n)=>{let o={};for(let h=0;h<t.length;++h)o[t[h]]=h;let i=r.length;for(;r[i-1]==="=";)--i;let s=new Uint8Array(i*e/8|0),u=0,l=0,m=0;for(let h=0;h<i;++h){let b=o[r[h]];if(b===void 0)throw new SyntaxError(`Non-${n} character`);l=l<<e|b,u+=e,u>=8&&(u-=8,s[m++]=255&l>>u)}if(u>=e||255&l<<8-u)throw new SyntaxError("Unexpected end of data");return s},vm=(r,t,e)=>{let n=t[t.length-1]==="=",o=(1<<e)-1,i="",s=0,u=0;for(let l=0;l<r.length;++l)for(u=u<<8|r[l],s+=8;s>e;)s-=e,i+=t[o&u>>s];if(s&&(i+=t[o&u<<e-s]),n)for(;i.length*e&7;)i+="=";return i},j=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>ir({prefix:t,name:r,encode(o){return vm(o,n,e)},decode(o){return xm(o,n,e,r)}});var Em=ir({prefix:"\0",name:"identity",encode:r=>Qc(r),decode:r=>Zc(r)});var wi={};U(wi,{base2:()=>Sm});var Sm=j({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var xi={};U(xi,{base8:()=>Am});var Am=j({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var vi={};U(vi,{base10:()=>Tm});var Tm=ue({prefix:"9",name:"base10",alphabet:"0123456789"});var Ei={};U(Ei,{base16:()=>Im,base16upper:()=>Cm});var Im=j({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Cm=j({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Si={};U(Si,{base32:()=>sr,base32hex:()=>Nm,base32hexpad:()=>Rm,base32hexpadupper:()=>Om,base32hexupper:()=>Lm,base32pad:()=>km,base32padupper:()=>Bm,base32upper:()=>Dm,base32z:()=>Mm});var sr=j({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Dm=j({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),km=j({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Bm=j({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Nm=j({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Lm=j({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Rm=j({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Om=j({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Mm=j({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Ai={};U(Ai,{base36:()=>Um,base36upper:()=>Pm});var Um=ue({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Pm=ue({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Ti={};U(Ti,{base58btc:()=>Vt,base58flickr:()=>_m});var Vt=ue({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),_m=ue({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Ii={};U(Ii,{base64:()=>Fm,base64pad:()=>zm,base64url:()=>Vm,base64urlpad:()=>$m});var Fm=j({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),zm=j({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Vm=j({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),$m=j({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Ci={};U(Ci,{base256emoji:()=>Jm});var eu=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}"),Gm=eu.reduce((r,t,e)=>(r[e]=t,r),[]),Hm=eu.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function qm(r){return r.reduce((t,e)=>(t+=Gm[e],t),"")}function jm(r){let t=[];for(let e of r){let n=Hm[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}var Jm=ir({prefix:"\u{1F680}",name:"base256emoji",encode:qm,decode:jm});var Li={};U(Li,{sha256:()=>h0,sha512:()=>p0});var Ni=G(Rt("crypto"),1);var Xm=ou,ru=128,Wm=127,Km=~Wm,Zm=Math.pow(2,31);function ou(r,t,e){t=t||[],e=e||0;for(var n=e;r>=Zm;)t[e++]=r&255|ru,r/=128;for(;r&Km;)t[e++]=r&255|ru,r>>>=7;return t[e]=r|0,ou.bytes=e-n+1,t}var Qm=Di,Ym=128,nu=127;function Di(r,n){var e=0,n=n||0,o=0,i=n,s,u=r.length;do{if(i>=u)throw Di.bytes=0,new RangeError("Could not decode varint");s=r[i++],e+=o<28?(s&nu)<<o:(s&nu)*Math.pow(2,o),o+=7}while(s>=Ym);return Di.bytes=i-n,e}var t0=Math.pow(2,7),e0=Math.pow(2,14),r0=Math.pow(2,21),n0=Math.pow(2,28),o0=Math.pow(2,35),i0=Math.pow(2,42),s0=Math.pow(2,49),a0=Math.pow(2,56),c0=Math.pow(2,63),u0=function(r){return r<t0?1:r<e0?2:r<r0?3:r<n0?4:r<o0?5:r<i0?6:r<s0?7:r<a0?8:r<c0?9:10},f0={encode:Xm,decode:Qm,encodingLength:u0},l0=f0,Fr=l0;var zr=(r,t=0)=>[Fr.decode(r,t),Fr.decode.bytes],ar=(r,t,e=0)=>(Fr.encode(r,t,e),t),cr=r=>Fr.encodingLength(r);var ke=(r,t)=>{let e=t.byteLength,n=cr(r),o=n+cr(e),i=new Uint8Array(o+e);return ar(r,i,0),ar(e,i,n),i.set(t,o),new ur(r,e,t,i)},iu=r=>{let t=kt(r),[e,n]=zr(t),[o,i]=zr(t.subarray(n)),s=t.subarray(n+i);if(s.byteLength!==o)throw new Error("Incorrect length");return new ur(e,o,s,t)},su=(r,t)=>{if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&Kc(r.bytes,e.bytes)}},ur=class{constructor(t,e,n,o){this.code=t,this.size=e,this.digest=n,this.bytes=o}};var Bi=({name:r,code:t,encode:e})=>new ki(r,t,e),ki=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?ke(this.code,e):e.then(n=>ke(this.code,n))}else throw Error("Unknown type, must be binary type")}};var h0=Bi({name:"sha2-256",code:18,encode:r=>kt(Ni.default.createHash("sha256").update(r).digest())}),p0=Bi({name:"sha2-512",code:19,encode:r=>kt(Ni.default.createHash("sha512").update(r).digest())});var Ri={};U(Ri,{identity:()=>b0});var cu=0,d0="identity",uu=kt,m0=r=>ke(cu,uu(r)),b0={code:cu,name:d0,encode:uu,digest:m0};var x1=new TextEncoder,v1=new TextDecoder;var fu=(r,t)=>{let{bytes:e,version:n}=r;switch(n){case 0:return x0(e,Oi(r),t||Vt.encoder);default:return v0(e,Oi(r),t||sr.encoder)}};var lu=new WeakMap,Oi=r=>{let t=lu.get(r);if(t==null){let e=new Map;return lu.set(r,e),e}return t},Rn=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!==$r)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==E0)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=ke(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&&su(t.multihash,n.multihash)}toString(t){return fu(this,t)}toJSON(){return{"/":fu(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:s}=e;return new r(n,o,i,s||hu(n,o,i.bytes))}else if(e[S0]===!0){let{version:n,multihash:o,code:i}=e,s=iu(o);return r.create(n,i,s)}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!==$r)throw new Error(`Version 0 CID must use dag-pb (code: ${$r}) block encoding`);return new r(t,e,n,n.bytes)}case 1:{let o=hu(t,e,n.bytes);return new r(t,e,n,o)}default:throw new Error("Invalid version")}}static createV0(t){return r.create(0,$r,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=kt(t.subarray(n,n+e.multihashSize));if(o.byteLength!==e.multihashSize)throw new Error("Incorrect length");let i=o.subarray(e.multihashSize-e.digestSize),s=new ur(e.multihashCode,e.digestSize,i,o);return[e.version===0?r.createV0(s):r.createV1(e.codec,s),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[b,w]=zr(t.subarray(e));return e+=w,b},o=n(),i=$r;if(o===18?(o=0,e=0):i=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let s=e,u=n(),l=n(),m=e+l,h=m-s;return{version:o,codec:i,multihashCode:u,digestSize:l,multihashSize:h,size:m}}static parse(t,e){let[n,o]=w0(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 Oi(i).set(n,t),i}},w0=(r,t)=>{switch(r[0]){case"Q":{let e=t||Vt;return[Vt.prefix,e.decode(`${Vt.prefix}${r}`)]}case Vt.prefix:{let e=t||Vt;return[Vt.prefix,e.decode(r)]}case sr.prefix:{let e=t||sr;return[sr.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)]}}},x0=(r,t,e)=>{let{prefix:n}=e;if(n!==Vt.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},v0=(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},$r=112,E0=18,hu=(r,t,e)=>{let n=cr(r),o=n+cr(t),i=new Uint8Array(o+e.byteLength);return ar(r,i,0),ar(t,i,n),i.set(e,o),i},S0=Symbol.for("@ipld/js-cid/CID");var Mi={...yi,...wi,...xi,...vi,...Ei,...Si,...Ai,...Ti,...Ii,...Ci},N1={...Li,...Ri};function du(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var pu=du("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Ui=du("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=Pt(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),A0={utf8:pu,"utf-8":pu,hex:Mi.base16,latin1:Ui,ascii:Ui,binary:Ui,...Mi},On=A0;function ht(r,t="utf8"){let e=On[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 lr=G(Fi(),1);var Mn=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,s=0,u=this.peekChar();if(u===void 0)return;let l=u==="0",m=2**(8*o)-1;for(;;){let h=this.readAtomically(()=>{let b=this.readChar();if(b===void 0)return;let w=Number.parseInt(b,t);if(!Number.isNaN(w))return w});if(h===void 0)break;if(i*=t,i+=h,i>m||(s+=1,e!==void 0&&s>e))return}if(s!==0)return!n&&l&&s>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 s=this.readSeparator(":",n,()=>this.readIPv4Addr());if(s!==void 0)return e[o]=s[0],e[o+1]=s[1],e[o+2]=s[2],e[o+3]=s[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),s=16-(n+2),[u]=t(i.subarray(0,s));return e.set(i.subarray(0,u),16-u),e})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var H1=new Mn;var Q1=parseInt("0xFFFF",16),Y1=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);var zi={};U(zi,{identity:()=>G0});var G0=tr({prefix:"\0",name:"identity",encode:r=>Fc(r),decode:r=>_c(r)});var Vi={};U(Vi,{base2:()=>H0});var H0=q({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var $i={};U($i,{base8:()=>q0});var q0=q({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Gi={};U(Gi,{base10:()=>j0});var j0=ae({prefix:"9",name:"base10",alphabet:"0123456789"});var Hi={};U(Hi,{base16:()=>J0,base16upper:()=>X0});var J0=q({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),X0=q({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var qi={};U(qi,{base36:()=>W0,base36upper:()=>K0});var W0=ae({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),K0=ae({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var ji={};U(ji,{base64:()=>Z0,base64pad:()=>Q0,base64url:()=>Y0,base64urlpad:()=>tb});var Z0=q({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Q0=q({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Y0=q({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),tb=q({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Ji={};U(Ji,{base256emoji:()=>ib});var Iu=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}"),eb=Iu.reduce((r,t,e)=>(r[e]=t,r),[]),rb=Iu.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function nb(r){return r.reduce((t,e)=>(t+=eb[e],t),"")}function ob(r){let t=[];for(let e of r){let n=rb[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}var ib=tr({prefix:"\u{1F680}",name:"base256emoji",encode:nb,decode:ob});var Zi={};U(Zi,{sha256:()=>sb,sha512:()=>ab});var Ki=G(Rt("crypto"),1);var Wi=({name:r,code:t,encode:e})=>new Xi(r,t,e),Xi=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?De(this.code,e):e.then(n=>De(this.code,n))}else throw Error("Unknown type, must be binary type")}};var sb=Wi({name:"sha2-256",code:18,encode:r=>Dt(Ki.default.createHash("sha256").update(r).digest())}),ab=Wi({name:"sha2-512",code:19,encode:r=>Dt(Ki.default.createHash("sha512").update(r).digest())});var Qi={};U(Qi,{identity:()=>fb});var Du=0,cb="identity",ku=Dt,ub=r=>De(Du,ku(r)),fb={code:Du,name:cb,encode:ku,digest:ub};var Ux=new TextEncoder,Px=new TextDecoder;var Bu={...zi,...Vi,...$i,...Gi,...Hi,...hi,...qi,...fi,...ji,...Ji},$x={...Zi,...Qi};function Gr(r,t="utf8"){let e=On[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Ee(globalThis.Buffer.from(r,"utf-8")):e.decoder.decode(`${e.prefix}${r}`)}var $t=G(Fi(),1);var fe=Rt("node:net");function Un(r){return!!(0,fe.isIP)(r)}var Nu=fe.isIPv4,pb=fe.isIPv6,Yi=function(r){let t=0;if(r=r.toString().trim(),Nu(r)){let e=new Uint8Array(t+4);return r.split(/\./g).forEach(n=>{e[t++]=parseInt(n,10)&255}),e}if(pb(r)){let e=r.split(":",8),n;for(n=0;n<e.length;n++){let i=Nu(e[n]),s;i&&(s=Yi(e[n]),e[n]=ht(s.slice(0,2),"base16")),s!=null&&++n<8&&e.splice(n,0,ht(s.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")},Lu=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 fr={},ts={},mb=[[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"]];mb.forEach(r=>{let t=bb(...r);ts[t.code]=t,fr[t.name]=t});function bb(r,t,e,n,o){return{code:r,size:t,name:e,resolvable:!!n,path:!!o}}function z(r){if(typeof r=="number"){if(ts[r]!=null)return ts[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(fr[r]!=null)return fr[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var av=z("ip4"),cv=z("ip6"),uv=z("ipcidr");function rs(r,t){switch(z(r).code){case 4:case 41:return yb(t);case 42:return Mu(t);case 6:case 273:case 33:case 132:return Pu(t).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Mu(t);case 421:return Eb(t);case 444:return Uu(t);case 445:return Uu(t);case 466:return vb(t);default:return ht(t,"base16")}}function ns(r,t){switch(z(r).code){case 4:return Ru(t);case 41:return Ru(t);case 42:return Ou(t);case 6:case 273:case 33:case 132:return os(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Ou(t);case 421:return wb(t);case 444:return Sb(t);case 445:return Ab(t);case 466:return xb(t);default:return Gr(t,"base16")}}var es=Object.values(Bu).map(r=>r.decoder),gb=function(){let r=es[0].or(es[1]);return es.slice(2).forEach(t=>r=r.or(t)),r}();function Ru(r){if(!Un(r))throw new Error("invalid ip address");return Yi(r)}function yb(r){let t=Lu(r,0,r.length);if(t==null)throw new Error("ipBuff is required");if(!Un(t))throw new Error("invalid ip address");return t}function os(r){let t=new ArrayBuffer(2);return new DataView(t).setUint16(0,r),new Uint8Array(t)}function Pu(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function Ou(r){let t=Gr(r),e=Uint8Array.from($t.default.encode(t.length));return Tt([e,t],e.length+t.length)}function Mu(r){let t=$t.default.decode(r);if(r=r.slice($t.default.decode.bytes),r.length!==t)throw new Error("inconsistent lengths");return ht(r)}function wb(r){let t;r[0]==="Q"||r[0]==="1"?t=Nn(lt.decode(`z${r}`)).bytes:t=ce.parse(r).multihash.bytes;let e=Uint8Array.from($t.default.encode(t.length));return Tt([e,t],e.length+t.length)}function xb(r){let t=gb.decode(r),e=Uint8Array.from($t.default.encode(t.length));return Tt([e,t],e.length+t.length)}function vb(r){let t=$t.default.decode(r),e=r.slice($t.default.decode.bytes);if(e.length!==t)throw new Error("inconsistent lengths");return"u"+ht(e,"base64url")}function Eb(r){let t=$t.default.decode(r),e=r.slice($t.default.decode.bytes);if(e.length!==t)throw new Error("inconsistent lengths");return ht(e,"base58btc")}function Sb(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=Wt.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=os(n);return Tt([e,o],e.length+o.length)}function Ab(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=Wt.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=os(n);return Tt([e,o],e.length+o.length)}function Uu(r){let t=r.slice(0,r.length-2),e=r.slice(r.length-2),n=ht(t,"base32"),o=Pu(e);return`${n}:${o}`}function _u(r){r=is(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 s=o[i],u=z(s);if(u.size===0){t.push([u.code]),e.push([u.code]);continue}if(i++,i>=o.length)throw zu("invalid address: "+r);if(u.path===!0){n=is(o.slice(i).join("/")),t.push([u.code,ns(u.code,n)]),e.push([u.code,n]);break}let l=ns(u.code,o[i]);t.push([u.code,l]),e.push([u.code,rs(u.code,l)])}return{string:Fu(e),bytes:as(t),tuples:t,stringTuples:e,path:n}}function ss(r){let t=[],e=[],n=null,o=0;for(;o<r.length;){let i=lr.default.decode(r,o),s=lr.default.decode.bytes??0,u=z(i),l=Tb(u,r.slice(o+s));if(l===0){t.push([i]),e.push([i]),o+=s;continue}let m=r.slice(o+s,o+s+l);if(o+=l+s,o>r.length)throw zu("Invalid address Uint8Array: "+ht(r,"base16"));t.push([i,m]);let h=rs(i,m);if(e.push([i,h]),u.path===!0){n=h;break}}return{bytes:Uint8Array.from(r),string:Fu(e),tuples:t,stringTuples:e,path:n}}function Fu(r){let t=[];return r.map(e=>{let n=z(e[0]);return t.push(n.name),e.length>1&&e[1]!=null&&t.push(e[1]),null}),is(t.join("/"))}function as(r){return Tt(r.map(t=>{let e=z(t[0]),n=Uint8Array.from(lr.default.encode(e.code));return t.length>1&&t[1]!=null&&(n=Tt([n,t[1]])),n}))}function Tb(r,t){return r.size>0?r.size/8:r.size===0?0:lr.default.decode(t)+(lr.default.decode.bytes??0)}function is(r){return"/"+r.trim().split("/").filter(t=>t).join("/")}function zu(r){return new Error("Error parsing address: "+r)}var Ib=Symbol.for("nodejs.util.inspect.custom"),Cb=[z("dns").code,z("dns4").code,z("dns6").code,z("dnsaddr").code],Db=new Map,Vu=Symbol.for("@multiformats/js-multiaddr/multiaddr");function kb(r){return!!r?.[Vu]}var cs=class r{bytes;#t;#e;#r;#n;[Vu]=!0;constructor(t){t==null&&(t="");let e;if(t instanceof Uint8Array)e=ss(t);else if(typeof t=="string"){if(t.length>0&&t.charAt(0)!=="/")throw new Error(`multiaddr "${t}" must start with a "/"`);e=_u(t)}else if(kb(t))e=ss(t.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=e.bytes,this.#t=e.string,this.#e=e.tuples,this.#r=e.stringTuples,this.#n=e.path}toString(){return this.#t}toJSON(){return this.toString()}toOptions(){let t,e,n,o,i="",s=z("tcp"),u=z("udp"),l=z("ip4"),m=z("ip6"),h=z("dns6"),b=z("ip6zone");for(let[T,p]of this.stringTuples())T===b.code&&(i=`%${p??""}`),Cb.includes(T)&&(e=s.name,o=443,n=`${p??""}${i}`,t=T===h.code?6:4),(T===s.code||T===u.code)&&(e=z(T).name,o=parseInt(p??"")),(T===l.code||T===m.code)&&(e=z(T).name,n=`${p??""}${i}`,t=T===m.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.#e.map(([t])=>Object.assign({},z(t)))}protoCodes(){return this.#e.map(([t])=>t)}protoNames(){return this.#e.map(([t])=>z(t).name)}tuples(){return this.#e}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(as(e.slice(0,n)));return this}getPeerId(){try{let t=[];this.stringTuples().forEach(([n,o])=>{n===fr.p2p.code&&t.push([n,o]),n===fr["p2p-circuit"].code&&(t=[])});let e=t.pop();if(e?.[1]!=null){let n=e[1];return n[0]==="Q"||n[0]==="1"?ht(lt.decode(`z${n}`),"base58btc"):ht(ce.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return this.#n}equals(t){return Se(this.bytes,t.bytes)}async resolve(t){let e=this.protos().find(i=>i.resolvable);if(e==null)return[this];let n=Db.get(e.name);if(n==null)throw new kn(`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)}[Ib](){return`Multiaddr(${this.#t})`}};function yt(r){return new cs(r)}var Bb=D("dns4"),Nb=D("dns6"),Lb=D("dnsaddr"),Ne=X(D("dns"),Lb,Bb,Nb),Fn=X(D("ip4"),D("ip6")),he=X(O(Fn,D("tcp")),O(Ne,D("tcp"))),zn=O(Fn,D("udp")),Rb=O(zn,D("utp")),Ob=O(zn,D("quic")),Mb=O(zn,D("quic-v1")),us=X(O(he,D("ws")),O(Ne,D("ws"))),Pn=X(O(us,D("p2p")),us),fs=X(O(he,D("wss")),O(Ne,D("wss")),O(he,D("tls"),D("ws")),O(Ne,D("tls"),D("ws"))),_n=X(O(fs,D("p2p")),fs),ls=X(O(he,D("http")),O(Fn,D("http")),O(Ne,D("http"))),hs=X(O(he,D("https")),O(Fn,D("https")),O(Ne,D("https"))),$u=O(zn,D("webrtc-direct"),D("certhash")),qu=X(O($u,D("p2p")),$u),Gu=O(Mb,D("webtransport"),D("certhash"),D("certhash")),ju=X(O(Gu,D("p2p")),Gu),Ju=X(O(Pn,D("p2p-webrtc-star"),D("p2p")),O(_n,D("p2p-webrtc-star"),D("p2p")),O(Pn,D("p2p-webrtc-star")),O(_n,D("p2p-webrtc-star"))),Nv=X(O(Pn,D("p2p-websocket-star"),D("p2p")),O(_n,D("p2p-websocket-star"),D("p2p")),O(Pn,D("p2p-websocket-star")),O(_n,D("p2p-websocket-star"))),Xu=X(O(ls,D("p2p-webrtc-direct"),D("p2p")),O(hs,D("p2p-webrtc-direct"),D("p2p")),O(ls,D("p2p-webrtc-direct")),O(hs,D("p2p-webrtc-direct"))),Le=X(us,fs,ls,hs,Ju,Xu,he,Rb,Ob,Ne,qu,ju),Lv=X(O(Le,D("p2p-stardust"),D("p2p")),O(Le,D("p2p-stardust"))),le=X(O(Le,D("p2p")),Ju,Xu,qu,ju,D("p2p")),Hu=X(O(le,D("p2p-circuit"),le),O(le,D("p2p-circuit")),O(D("p2p-circuit"),le),O(Le,D("p2p-circuit")),O(D("p2p-circuit"),Le),D("p2p-circuit")),Wu=()=>X(O(Hu,Wu),Hu),Be=Wu(),Rv=X(O(Be,le,Be),O(le,Be),O(Be,le),Be,le);var Ov=X(O(Be,D("webrtc"),D("p2p")),O(Be,D("webrtc")),O(Le,D("webrtc"),D("p2p")),O(Le,D("webrtc")),D("webrtc"));function Ku(r){function t(e){let n;try{n=yt(e)}catch{return!1}let o=r(n.protoNames());return o===null?!1:o===!0||o===!1?o:o.length===0}return t}function O(...r){function t(e){if(e.length<r.length)return null;let n=e;return r.some(o=>(n=typeof o=="function"?o().partialMatch(e):o.partialMatch(e),Array.isArray(n)&&(e=n),n===null)),n}return{toString:function(){return"{ "+r.join(" ")+" }"},input:r,matches:Ku(t),partialMatch:t}}function X(...r){function t(n){let o=null;return r.some(i=>{let s=typeof i=="function"?i().partialMatch(n):i.partialMatch(n);return s!=null?(o=s,!0):!1}),o}return{toString:function(){return"{ "+r.join(" ")+" }"},input:r,matches:Ku(t),partialMatch:t}}function D(r){let t=r;function e(o){let i;try{i=yt(o)}catch{return!1}let s=i.protoNames();return s.length===1&&s[0]===t}function n(o){return o.length===0?null:o[0]===t?o.slice(1):null}return{toString:function(){return t},matches:e,partialMatch:n}}var vf=G(Rt("net"),1);var Vn=class extends EventTarget{#t=new Map;listenerCount(t){let e=this.#t.get(t);return e==null?0:e.length}addEventListener(t,e,n){super.addEventListener(t,e,n);let o=this.#t.get(t);o==null&&(o=[],this.#t.set(t,o)),o.push({callback:e,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(t,e,n){super.removeEventListener(t.toString(),e??null,n);let o=this.#t.get(t);o!=null&&(o=o.filter(({callback:i})=>i!==e),this.#t.set(t,o))}dispatchEvent(t){let e=super.dispatchEvent(t),n=this.#t.get(t.type);return n==null||(n=n.filter(({once:o})=>!o),this.#t.set(t.type,n)),e}safeDispatchEvent(t,e){return this.dispatchEvent(new hr(t,e))}},ps=class extends Event{detail;constructor(t,e){super(t,e),this.detail=e?.detail}},hr=globalThis.CustomEvent??ps;function $n(r){return this.subnetMask<r.subnetMask?!1:this.mask(r.subnetMask)===r.mask()}function Gn(r){return function(){return this.addressMinusSuffix!==this.correctForm()?!1:this.subnetMask===r&&!this.parsedSubnet?!0:this.parsedSubnet===String(this.subnetMask)}}var pr=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g,ds=/\/\d{1,2}$/;var st=class extends Error{constructor(t,e){super(t),this.name="AddressError",e!==null&&(this.parseMessage=e)}};var dr=G(ms(),1),Re=G(Hr(),1),wt=class r{constructor(t){this.groups=4,this.parsedAddress=[],this.parsedSubnet="",this.subnet="/32",this.subnetMask=32,this.v4=!0,this.isCorrect=Gn(32),this.isInSubnet=$n,this.address=t;let e=ds.exec(t);if(e){if(this.parsedSubnet=e[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,this.subnetMask<0||this.subnetMask>32)throw new st("Invalid subnet mask.");t=t.replace(ds,"")}this.addressMinusSuffix=t,this.parsedAddress=this.parse(t)}static isValid(t){try{return new r(t),!0}catch{return!1}}parse(t){let e=t.split(".");if(!t.match(pr))throw new st("Invalid IPv4 address.");return e}correctForm(){return this.parsedAddress.map(t=>parseInt(t,10)).join(".")}static fromHex(t){let e=t.replace(/:/g,"").padStart(8,"0"),n=[],o;for(o=0;o<8;o+=2){let i=e.slice(o,o+2);n.push(parseInt(i,16))}return new r(n.join("."))}static fromInteger(t){return r.fromHex(t.toString(16))}static fromArpa(t){let n=t.replace(/(\.in-addr\.arpa)?\.$/,"").split(".").reverse().join(".");return new r(n)}toHex(){return this.parsedAddress.map(t=>(0,Re.sprintf)("%02x",parseInt(t,10))).join(":")}toArray(){return this.parsedAddress.map(t=>parseInt(t,10))}toGroup6(){let t=[],e;for(e=0;e<4;e+=2){let n=(0,Re.sprintf)("%02x%02x",parseInt(this.parsedAddress[e],10),parseInt(this.parsedAddress[e+1],10));t.push((0,Re.sprintf)("%x",parseInt(n,16)))}return t.join(":")}bigInteger(){return new dr.BigInteger(this.parsedAddress.map(t=>(0,Re.sprintf)("%02x",parseInt(t,10))).join(""),16)}_startAddress(){return new dr.BigInteger(this.mask()+"0".repeat(32-this.subnetMask),2)}startAddress(){return r.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new dr.BigInteger("1");return r.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new dr.BigInteger(this.mask()+"1".repeat(32-this.subnetMask),2)}endAddress(){return r.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new dr.BigInteger("1");return r.fromBigInteger(this._endAddress().subtract(t))}static fromBigInteger(t){return r.fromInteger(parseInt(t.toString(),10))}mask(t){return t===void 0&&(t=this.subnetMask),this.getBitsBase2(0,t)}getBitsBase2(t,e){return this.binaryZeroPad().slice(t,e)}reverseForm(t){t||(t={});let e=this.correctForm().split(".").reverse().join(".");return t.omitSuffix?e:(0,Re.sprintf)("%s.in-addr.arpa.",e)}isMulticast(){return this.isInSubnet(new r("224.0.0.0/4"))}binaryZeroPad(){return this.bigInteger().toString(2).padStart(32,"0")}groupForV6(){let t=this.parsedAddress;return this.address.replace(pr,(0,Re.sprintf)('<span class="hover-group group-v4 group-6">%s</span>.<span class="hover-group group-v4 group-7">%s</span>',t.slice(0,2).join("."),t.slice(2,4).join(".")))}};var ef={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"},bs={"ff01::1/128":"Multicast (All nodes on this interface)","ff01::2/128":"Multicast (All routers on this interface)","ff02::1/128":"Multicast (All nodes on this link)","ff02::2/128":"Multicast (All routers on this link)","ff05::2/128":"Multicast (All routers in this site)","ff02::5/128":"Multicast (OSPFv3 AllSPF routers)","ff02::6/128":"Multicast (OSPFv3 AllDR routers)","ff02::9/128":"Multicast (RIP routers)","ff02::a/128":"Multicast (EIGRP routers)","ff02::d/128":"Multicast (PIM routers)","ff02::16/128":"Multicast (MLDv2 reports)","ff01::fb/128":"Multicast (mDNSv6)","ff02::fb/128":"Multicast (mDNSv6)","ff05::fb/128":"Multicast (mDNSv6)","ff02::1:2/128":"Multicast (All DHCP servers and relay agents on this link)","ff05::1:2/128":"Multicast (All DHCP servers and relay agents in this site)","ff02::1:3/128":"Multicast (All DHCP servers on this link)","ff05::1:3/128":"Multicast (All DHCP servers in this site)","::/128":"Unspecified","::1/128":"Loopback","ff00::/8":"Multicast","fe80::/10":"Link-local unicast"},gs=/([^0-9a-f:/%])/gi,ys=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi,ws=/\/\d{1,3}(?=%|$)/,xs=/%.*$/,rf=new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/),nf=new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/);var sf=G(Hr(),1);function Pb(r){return r.replace(/^(0+)/,'<span class="zero">$1</span>')}function jn(r,t=0){return r.split(":").map((n,o)=>/group-v4/.test(n)?n:(0,sf.sprintf)('<span class="hover-group group-%d">%s</span>',o+t,Pb(n)))}var Me=G(Hr(),1);function Es(r){return(0,Me.sprintf)("(%s)",r.join("|"))}function vs(r){return r.length<4?(0,Me.sprintf)("0{0,%d}%s",4-r.length,r):r}var Ss="[^A-Fa-f0-9:]";function Jn(r){let t=[];r.forEach((n,o)=>{parseInt(n,16)===0&&t.push(o)});let e=t.map(n=>r.map((o,i)=>{if(i===n){let s=i===0||i===8-1?":":"";return Es([vs(o),s])}return vs(o)}).join(":"));return e.push(r.map(vs).join(":")),Es(e)}function As(r,t,e){let n=t?"":":",o=e?"":":",i=[];!t&&!e&&i.push("::"),t&&e&&i.push(""),(e&&!t||!e&&t)&&i.push(":"),i.push((0,Me.sprintf)("%s(:0{1,4}){1,%d}",n,r-1)),i.push((0,Me.sprintf)("(0{1,4}:){1,%d}%s",r-1,o)),i.push((0,Me.sprintf)("(0{1,4}:){%d}0{1,4}",r-1));for(let s=1;s<r-1;s++)for(let u=1;u<r-s;u++)i.push((0,Me.sprintf)("(0{1,4}:){%d}:(0{1,4}:){%d}0{1,4}",u,r-u-s-1));return Es(i)}var at=G(ms(),1),ct=G(Hr(),1);function Xn(r){if(!r)throw new Error("Assertion failed.")}function _b(r){let t=/(\d+)(\d{3})/;for(;t.test(r);)r=r.replace(t,"$1,$2");return r}function Fb(r){return r=r.replace(/^(0{1,})([1-9]+)$/,'<span class="parse-error">$1</span>$2'),r=r.replace(/^(0{1,})(0)$/,'<span class="parse-error">$1</span>$2'),r}function zb(r,t){let e=[],n=[],o;for(o=0;o<r.length;o++)o<t[0]?e.push(r[o]):o>t[1]&&n.push(r[o]);return e.concat(["compact"]).concat(n)}function cf(r){return(0,ct.sprintf)("%04x",parseInt(r,16))}function uf(r){return r&255}var qr=class r{constructor(t,e){this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=$n,this.isCorrect=Gn(128),e===void 0?this.groups=8:this.groups=e,this.address=t;let n=ws.exec(t);if(n){if(this.parsedSubnet=n[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,Number.isNaN(this.subnetMask)||this.subnetMask<0||this.subnetMask>128)throw new st("Invalid subnet mask.");t=t.replace(ws,"")}else if(/\//.test(t))throw new st("Invalid subnet mask.");let o=xs.exec(t);o&&(this.zone=o[0],t=t.replace(xs,"")),this.addressMinusSuffix=t,this.parsedAddress=this.parse(this.addressMinusSuffix)}static isValid(t){try{return new r(t),!0}catch{return!1}}static fromBigInteger(t){let e=t.toString(16).padStart(32,"0"),n=[],o;for(o=0;o<8;o++)n.push(e.slice(o*4,(o+1)*4));return new r(n.join(":"))}static fromURL(t){let e,n=null,o;if(t.indexOf("[")!==-1&&t.indexOf("]:")!==-1){if(o=nf.exec(t),o===null)return{error:"failed to parse address with port",address:null,port:null};e=o[1],n=o[2]}else if(t.indexOf("/")!==-1){if(t=t.replace(/^[a-z0-9]+:\/\//,""),o=rf.exec(t),o===null)return{error:"failed to parse address from URL",address:null,port:null};e=o[1]}else e=t;return n?(n=parseInt(n,10),(n<0||n>65536)&&(n=null)):n=null,{address:new r(e),port:n}}static fromAddress4(t){let e=new wt(t),n=128-(32-e.subnetMask);return new r(`::ffff:${e.correctForm()}/${n}`)}static fromArpa(t){let e=t.replace(/(\.ip6\.arpa)?\.$/,""),n=7;if(e.length!==63)throw new st("Invalid 'ip6.arpa' form.");let o=e.split(".").reverse();for(let i=n;i>0;i--){let s=i*4;o.splice(s,0,":")}return e=o.join(""),new r(e)}microsoftTranscription(){return(0,ct.sprintf)("%s.ipv6-literal.net",this.correctForm().replace(/:/g,"-"))}mask(t=this.subnetMask){return this.getBitsBase2(0,t)}possibleSubnets(t=128){let e=128-this.subnetMask,n=Math.abs(t-128),o=e-n;return o<0?"0":_b(new at.BigInteger("2",10).pow(o).toString(10))}_startAddress(){return new at.BigInteger(this.mask()+"0".repeat(128-this.subnetMask),2)}startAddress(){return r.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new at.BigInteger("1");return r.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new at.BigInteger(this.mask()+"1".repeat(128-this.subnetMask),2)}endAddress(){return r.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new at.BigInteger("1");return r.fromBigInteger(this._endAddress().subtract(t))}getScope(){let t=ef[this.getBits(12,16).intValue()];return this.getType()==="Global unicast"&&t!=="Link local"&&(t="Global"),t||"Unknown"}getType(){for(let t of Object.keys(bs))if(this.isInSubnet(new r(t)))return bs[t];return"Global unicast"}getBits(t,e){return new at.BigInteger(this.getBitsBase2(t,e),2)}getBitsBase2(t,e){return this.binaryZeroPad().slice(t,e)}getBitsBase16(t,e){let n=e-t;if(n%4!==0)throw new Error("Length of bits to retrieve must be divisible by four");return this.getBits(t,e).toString(16).padStart(n/4,"0")}getBitsPastSubnet(){return this.getBitsBase2(this.subnetMask,128)}reverseForm(t){t||(t={});let e=Math.floor(this.subnetMask/4),n=this.canonicalForm().replace(/:/g,"").split("").slice(0,e).reverse().join(".");return e>0?t.omitSuffix?n:(0,ct.sprintf)("%s.ip6.arpa.",n):t.omitSuffix?"":"ip6.arpa."}correctForm(){let t,e=[],n=0,o=[];for(t=0;t<this.parsedAddress.length;t++){let u=parseInt(this.parsedAddress[t],16);u===0&&n++,u!==0&&n>0&&(n>1&&o.push([t-n,t-1]),n=0)}n>1&&o.push([this.parsedAddress.length-n,this.parsedAddress.length-1]);let i=o.map(u=>u[1]-u[0]+1);if(o.length>0){let u=i.indexOf(Math.max(...i));e=zb(this.parsedAddress,o[u])}else e=this.parsedAddress;for(t=0;t<e.length;t++)e[t]!=="compact"&&(e[t]=parseInt(e[t],16).toString(16));let s=e.join(":");return s=s.replace(/^compact$/,"::"),s=s.replace(/^compact|compact$/,":"),s=s.replace(/compact/,""),s}binaryZeroPad(){return this.bigInteger().toString(2).padStart(128,"0")}parse4in6(t){let e=t.split(":"),o=e.slice(-1)[0].match(pr);if(o){this.parsedAddress4=o[0],this.address4=new wt(this.parsedAddress4);for(let i=0;i<this.address4.groups;i++)if(/^0[0-9]+/.test(this.address4.parsedAddress[i]))throw new st("IPv4 addresses can't have leading zeroes.",t.replace(pr,this.address4.parsedAddress.map(Fb).join(".")));this.v4=!0,e[e.length-1]=this.address4.toGroup6(),t=e.join(":")}return t}parse(t){t=this.parse4in6(t);let e=t.match(gs);if(e)throw new st((0,ct.sprintf)("Bad character%s detected in address: %s",e.length>1?"s":"",e.join("")),t.replace(gs,'<span class="parse-error">$1</span>'));let n=t.match(ys);if(n)throw new st((0,ct.sprintf)("Address failed regex: %s",n.join("")),t.replace(ys,'<span class="parse-error">$1</span>'));let o=[],i=t.split("::");if(i.length===2){let s=i[0].split(":"),u=i[1].split(":");s.length===1&&s[0]===""&&(s=[]),u.length===1&&u[0]===""&&(u=[]);let l=this.groups-(s.length+u.length);if(!l)throw new st("Error parsing groups");this.elidedGroups=l,this.elisionBegin=s.length,this.elisionEnd=s.length+this.elidedGroups,o=o.concat(s);for(let m=0;m<l;m++)o.push("0");o=o.concat(u)}else if(i.length===1)o=t.split(":"),this.elidedGroups=0;else throw new st("Too many :: groups found");if(o=o.map(s=>(0,ct.sprintf)("%x",parseInt(s,16))),o.length!==this.groups)throw new st("Incorrect number of groups found");return o}canonicalForm(){return this.parsedAddress.map(cf).join(":")}decimal(){return this.parsedAddress.map(t=>(0,ct.sprintf)("%05d",parseInt(t,16))).join(":")}bigInteger(){return new at.BigInteger(this.parsedAddress.map(cf).join(""),16)}to4(){let t=this.binaryZeroPad().split("");return wt.fromHex(new at.BigInteger(t.slice(96,128).join(""),2).toString(16))}to4in6(){let t=this.to4(),n=new r(this.parsedAddress.slice(0,6).join(":"),6).correctForm(),o="";return/:$/.test(n)||(o=":"),n+o+t.address}inspectTeredo(){let t=this.getBitsBase16(0,32),e=this.getBits(80,96).xor(new at.BigInteger("ffff",16)).toString(),n=wt.fromHex(this.getBitsBase16(32,64)),o=wt.fromHex(this.getBits(96,128).xor(new at.BigInteger("ffffffff",16)).toString(16)),i=this.getBits(64,80),s=this.getBitsBase2(64,80),u=i.testBit(15),l=i.testBit(14),m=i.testBit(8),h=i.testBit(9),b=new at.BigInteger(s.slice(2,6)+s.slice(8,16),2).toString(10);return{prefix:(0,ct.sprintf)("%s:%s",t.slice(0,4),t.slice(4,8)),server4:n.address,client4:o.address,flags:s,coneNat:u,microsoft:{reserved:l,universalLocal:h,groupIndividual:m,nonce:b},udpPort:e}}inspect6to4(){let t=this.getBitsBase16(0,16),e=wt.fromHex(this.getBitsBase16(16,48));return{prefix:(0,ct.sprintf)("%s",t.slice(0,4)),gateway:e.address}}to6to4(){if(!this.is4())return null;let t=["2002",this.getBitsBase16(96,112),this.getBitsBase16(112,128),"","/16"].join(":");return new r(t)}toByteArray(){let t=this.bigInteger().toByteArray();return t.length===17&&t[0]===0?t.slice(1):t}toUnsignedByteArray(){return this.toByteArray().map(uf)}static fromByteArray(t){return this.fromUnsignedByteArray(t.map(uf))}static fromUnsignedByteArray(t){let e=new at.BigInteger("256",10),n=new at.BigInteger("0",10),o=new at.BigInteger("1",10);for(let i=t.length-1;i>=0;i--)n=n.add(o.multiply(new at.BigInteger(t[i].toString(10),10))),o=o.multiply(e);return r.fromBigInteger(n)}isCanonical(){return this.addressMinusSuffix===this.canonicalForm()}isLinkLocal(){return this.getBitsBase2(0,64)==="1111111010000000000000000000000000000000000000000000000000000000"}isMulticast(){return this.getType()==="Multicast"}is4(){return this.v4}isTeredo(){return this.isInSubnet(new r("2001::/32"))}is6to4(){return this.isInSubnet(new r("2002::/16"))}isLoopback(){return this.getType()==="Loopback"}href(t){return t===void 0?t="":t=(0,ct.sprintf)(":%s",t),(0,ct.sprintf)("http://[%s]%s/",this.correctForm(),t)}link(t){t||(t={}),t.className===void 0&&(t.className=""),t.prefix===void 0&&(t.prefix="/#address="),t.v4===void 0&&(t.v4=!1);let e=this.correctForm;return t.v4&&(e=this.to4in6),t.className?(0,ct.sprintf)('<a href="%1$s%2$s" class="%3$s">%2$s</a>',t.prefix,e.call(this),t.className):(0,ct.sprintf)('<a href="%1$s%2$s">%2$s</a>',t.prefix,e.call(this))}group(){if(this.elidedGroups===0)return jn(this.address).join(":");Xn(typeof this.elidedGroups=="number"),Xn(typeof this.elisionBegin=="number");let t=[],[e,n]=this.address.split("::");e.length?t.push(...jn(e)):t.push("");let o=["hover-group"];for(let i=this.elisionBegin;i<this.elisionBegin+this.elidedGroups;i++)o.push((0,ct.sprintf)("group-%d",i));return t.push((0,ct.sprintf)('<span class="%s"></span>',o.join(" "))),n.length?t.push(...jn(n,this.elisionEnd)):t.push(""),this.is4()&&(Xn(this.address4 instanceof wt),t.pop(),t.push(this.address4.groupForV6())),t.join(":")}regularExpressionString(t=!1){let e=[],n=new r(this.correctForm());if(n.elidedGroups===0)e.push(Jn(n.parsedAddress));else if(n.elidedGroups===8)e.push(As(8));else{let o=n.address.split("::");o[0].length&&e.push(Jn(o[0].split(":"))),Xn(typeof n.elidedGroups=="number"),e.push(As(n.elidedGroups,o[0].length!==0,o[1].length!==0)),o[1].length&&e.push(Jn(o[1].split(":"))),e=[e.join(":")]}return t||(e=["(?=^|",Ss,"|[^\\w\\:])(",...e,")(?=[^\\w\\:]|",Ss,"|$)"]),e.join("")}regularExpression(t=!1){return new RegExp(this.regularExpressionString(t),"i")}};var Vb=it("libp2p:ip-port-to-multiaddr"),Ts={ERR_INVALID_IP_PARAMETER:"ERR_INVALID_IP_PARAMETER",ERR_INVALID_PORT_PARAMETER:"ERR_INVALID_PORT_PARAMETER",ERR_INVALID_IP:"ERR_INVALID_IP"};function ff(r,t){if(typeof r!="string")throw new It(`invalid ip provided: ${r}`,Ts.ERR_INVALID_IP_PARAMETER);if(typeof t=="string"&&(t=parseInt(t)),isNaN(t))throw new It(`invalid port provided: ${t}`,Ts.ERR_INVALID_PORT_PARAMETER);try{return new wt(r),yt(`/ip4/${r}/tcp/${t}`)}catch{}try{let e=new qr(r);return e.is4()?yt(`/ip4/${e.to4().correctForm()}/tcp/${t}`):yt(`/ip6/${r}/tcp/${t}`)}catch{let n=`invalid ip:port for creating a multiaddr: ${r}:${t}`;throw Vb.error(n),new It(n,Ts.ERR_INVALID_IP)}}var xf=G(yf(),1);var Ds=G(Rt("os"),1),wf=G(Rt("path"),1);var jb={ip4:"IPv4",ip6:"IPv6"};function gr(r,t={}){let e=r.getPath();return e!=null?Ds.default.platform()==="win32"?{path:wf.default.join("\\\\.\\pipe\\",e)}:{path:e}:{...r.toOptions(),...t}}function ks(r,t,e){let n=o=>yt(`/${r}/${o}/tcp/${e}`);return(Jb(t)?Wb(jb[r]):[t]).map(n)}function Jb(r){return["0.0.0.0","::"].includes(r)}var Xb=Ds.default.networkInterfaces();function Wb(r){let t=[];for(let[,e]of Object.entries(Xb))if(e!=null)for(let n of e)n.family===r&&t.push(n.address);return t}var Gt=it("libp2p:tcp:socket"),Kn=(r,t)=>{let e=t.metrics,n=t.metricPrefix??"",o=t.socketInactivityTimeout??3e5,i=t.socketCloseTimeout??500;t.listeningAddr?.getPath()!=null&&(t.remoteAddr=t.listeningAddr),t.remoteAddr?.getPath()!=null&&(t.localAddr=t.remoteAddr);let s;if(t.remoteAddr!=null)s=t.remoteAddr;else{if(r.remoteAddress==null||r.remotePort==null)throw new It("Could not determine remote address or port","ERR_NO_REMOTE_ADDRESS");s=ff(r.remoteAddress,r.remotePort)}let u=gr(s),l=u.path??`${u.host??""}:${u.port??""}`,{sink:m,source:h}=xf.default.duplex(r);r.setTimeout(o,()=>{Gt("%s socket read timeout",l),e?.increment({[`${n}timeout`]:!0});let w;r.readable&&(w=new It("Socket read timeout","ERR_SOCKET_READ_TIMEOUT")),r.destroy(w)}),r.once("close",()=>{Gt("%s socket close",l),e?.increment({[`${n}close`]:!0}),b.timeline.close==null&&(b.timeline.close=Date.now())}),r.once("end",()=>{Gt("%s socket end",l),e?.increment({[`${n}end`]:!0})});let b={async sink(w){try{await m(w)}catch(T){T.type!=="aborted"&&Gt(T)}r.end()},source:h,remoteAddr:s,timeline:{open:Date.now()},async close(w={}){if(r.destroyed){Gt("%s socket was already destroyed when trying to close",l);return}w.signal=w.signal??AbortSignal.timeout(i);try{Gt("%s closing socket",l),await new Promise((T,p)=>{r.once("close",()=>{Gt("%s socket closed",l),T()}),r.once("error",y=>{Gt("%s socket error",l,y),b.timeline.close==null&&(b.timeline.close=Date.now()),p(y)}),r.setTimeout(i),r.end(),r.writableLength>0?r.once("drain",()=>{Gt("%s socket drained",l),r.destroy()}):r.destroy()})}catch(T){this.abort(T)}},abort:w=>{Gt("%s socket abort due to error",l,w),r.destroy(w)}};return b};var xt=it("libp2p:tcp:listener");async function Bs(r){try{await r.close()}catch(t){xt.error("an error occurred closing the connection",t)}}var Qb=1,Yb=0,Zn=class extends Vn{context;server;connections=new Set;status={started:!1};metrics;addr;constructor(t){if(super(),this.context=t,t.keepAlive=t.keepAlive??!0,this.addr="unknown",this.server=vf.default.createServer(t,this.onSocket.bind(this)),t.maxConnections!==void 0&&(this.server.maxConnections=t.maxConnections),t.closeServerOnMaxConnections!=null&&t.closeServerOnMaxConnections.closeAbove<t.closeServerOnMaxConnections.listenBelow)throw Error("closeAbove must be >= listenBelow");this.server.on("listening",()=>{if(t.metrics!=null){let e=this.server.address();e==null?this.addr="unknown":typeof e=="string"?this.addr=e:this.addr=`${e.address}:${e.port}`,t.metrics?.registerMetricGroup("libp2p_tcp_inbound_connections_total",{label:"address",help:"Current active connections in TCP listener",calculate:()=>({[this.addr]:this.connections.size})}),this.metrics={status:t.metrics.registerMetricGroup("libp2p_tcp_listener_status_info",{label:"address",help:"Current status of the TCP listener socket"}),errors:t.metrics.registerMetricGroup("libp2p_tcp_listener_errors_total",{label:"address",help:"Total count of TCP listener errors by type"}),events:t.metrics.registerMetricGroup("libp2p_tcp_listener_events_total",{label:"address",help:"Total count of TCP listener events by type"})},this.metrics?.status.update({[this.addr]:Qb})}this.dispatchEvent(new hr("listening"))}).on("error",e=>{this.metrics?.errors.increment({[`${this.addr} listen_error`]:!0}),this.dispatchEvent(new hr("error",{detail:e}))}).on("close",()=>{this.metrics?.status.update({[this.addr]:Yb}),this.dispatchEvent(new hr("close"))})}onSocket(t){t.on("error",n=>{xt("socket error",n),this.metrics?.events.increment({[`${this.addr} error`]:!0})});let e;try{e=Kn(t,{listeningAddr:this.status.started?this.status.listeningAddr:void 0,socketInactivityTimeout:this.context.socketInactivityTimeout,socketCloseTimeout:this.context.socketCloseTimeout,metrics:this.metrics?.events,metricPrefix:`${this.addr} `})}catch(n){xt.error("inbound connection failed",n),this.metrics?.errors.increment({[`${this.addr} inbound_to_connection`]:!0});return}xt("new inbound connection %s",e.remoteAddr);try{this.context.upgrader.upgradeInbound(e).then(n=>{xt("inbound connection upgraded %s",e.remoteAddr),this.connections.add(e),t.once("close",()=>{this.connections.delete(e),this.context.closeServerOnMaxConnections!=null&&this.connections.size<this.context.closeServerOnMaxConnections.listenBelow&&this.netListen().catch(o=>{xt.error("error attempting to listen server once connection count under limit",o),this.context.closeServerOnMaxConnections?.onListenError?.(o)})}),this.context.handler!=null&&this.context.handler(n),this.context.closeServerOnMaxConnections!=null&&this.connections.size>=this.context.closeServerOnMaxConnections.closeAbove&&this.netClose(),this.dispatchEvent(new hr("connection",{detail:n}))}).catch(async n=>{xt.error("inbound connection failed",n),this.metrics?.errors.increment({[`${this.addr} inbound_upgrade`]:!0}),await Bs(e)}).catch(n=>{xt.error("closing inbound connection failed",n)})}catch(n){xt.error("inbound connection failed",n),Bs(e).catch(o=>{xt.error("closing inbound connection failed",o),this.metrics?.errors.increment({[`${this.addr} inbound_closing_failed`]:!0})})}}getAddrs(){if(!this.status.started)return[];let t=[],e=this.server.address(),{listeningAddr:n,peerId:o}=this.status;if(e==null)return[];if(typeof e=="string")t=[n];else try{n.toString().startsWith("/ip4")?t=t.concat(ks("ip4",e.address,e.port)):e.family==="IPv6"&&(t=t.concat(ks("ip6",e.address,e.port)))}catch(i){xt.error("could not turn %s:%s into multiaddr",e.address,e.port,i)}return t.map(i=>o!=null?i.encapsulate(`/p2p/${o}`):i)}async listen(t){if(this.status.started)throw Error("server is already listening");let e=t.getPeerId(),n=e==null?t.decapsulateCode(421):t,{backlog:o}=this.context;this.status={started:!0,listeningAddr:n,peerId:e,netConfig:gr(n,{backlog:o})},await this.netListen()}async close(){await Promise.all(Array.from(this.connections.values()).map(async t=>{await Bs(t)})),this.netClose()}async netListen(){if(!this.status.started||this.server.listening)return;let t=this.status.netConfig;await new Promise((e,n)=>{this.server.once("error",n),this.server.listen(t,e)}),xt("Listening on %s",this.server.address())}netClose(){!this.status.started||!this.server.listening||(xt("Closing server on %s",this.server.address()),this.server.close())}};var Zt=it("libp2p:tcp"),Ls=class{opts;metrics;components;constructor(t,e={}){this.opts=e,this.components=t,t.metrics!=null&&(this.metrics={dialerEvents:t.metrics.registerCounterGroup("libp2p_tcp_dialer_events_total",{label:"event",help:"Total count of TCP dialer events by type"})})}[Mc]=!0;[Symbol.toStringTag]="@libp2p/tcp";async dial(t,e){e.keepAlive=e.keepAlive??!0;let n=await this._connect(t,e);n.on("error",u=>{Zt("socket error",u)});let o=Kn(n,{remoteAddr:t,socketInactivityTimeout:this.opts.outboundSocketInactivityTimeout,socketCloseTimeout:this.opts.socketCloseTimeout,metrics:this.metrics?.dialerEvents}),i=()=>{o.close().catch(u=>{Zt.error("Error closing maConn after abort",u)})};e.signal?.addEventListener("abort",i,{once:!0}),Zt("new outbound connection %s",o.remoteAddr);let s=await e.upgrader.upgradeOutbound(o);if(Zt("outbound connection %s upgraded",o.remoteAddr),e.signal?.removeEventListener("abort",i),e.signal?.aborted===!0)throw s.close().catch(u=>{Zt.error("Error closing conn after abort",u)}),new Je;return s}async _connect(t,e){if(e.signal?.aborted===!0)throw new Je;return new Promise((n,o)=>{let i=Date.now(),s=gr(t),u=s.path??`${s.host??""}:${s.port}`;Zt("dialing %j",s);let l=Ef.default.connect(s),m=p=>{p.message=`connection error ${u}: ${p.message}`,this.metrics?.dialerEvents.increment({error:!0}),T(p)},h=()=>{Zt("connection timeout %s",u),this.metrics?.dialerEvents.increment({timeout:!0});let p=new It(`connection timeout after ${Date.now()-i}ms`,"ERR_CONNECT_TIMEOUT");l.emit("error",p)},b=()=>{Zt("connection opened %j",s),this.metrics?.dialerEvents.increment({connect:!0}),T()},w=()=>{Zt("connection aborted %j",s),this.metrics?.dialerEvents.increment({abort:!0}),l.destroy(),T(new Je)},T=p=>{if(l.removeListener("error",m),l.removeListener("timeout",h),l.removeListener("connect",b),e.signal!=null&&e.signal.removeEventListener("abort",w),p!=null){o(p);return}n(l)};l.on("error",m),l.on("timeout",h),l.on("connect",b),e.signal!=null&&e.signal.addEventListener("abort",w)})}createListener(t){return new Zn({...t,maxConnections:this.opts.maxConnections,backlog:this.opts.backlog,closeServerOnMaxConnections:this.opts.closeServerOnMaxConnections,socketInactivityTimeout:this.opts.inboundSocketInactivityTimeout,socketCloseTimeout:this.opts.socketCloseTimeout,metrics:this.components.metrics})}filter(t){return t=Array.isArray(t)?t:[t],t.filter(e=>e.protoCodes().includes(290)?!1:e.protoCodes().includes(400)?!0:he.matches(e.decapsulateCode(421)))}};function Sf(r={}){return(t={})=>new Ls(t,r)}function rg(r){return r[Symbol.asyncIterator]!=null}function ng(...r){let t=[];for(let e of r)rg(e)||t.push(e);return t.length===r.length?function*(){for(let e of t)yield*e}():async function*(){let e=oe({objectMode:!0});Promise.resolve().then(async()=>{try{await Promise.all(r.map(async n=>{for await(let o of n)e.push(o)})),e.end()}catch(n){e.end(n)}}),yield*e}()}var Af=ng;function Qn(r,...t){if(r==null)throw new Error("Empty pipeline");if(Rs(r)){let n=r;r=()=>n.source}else if(If(r)||Tf(r)){let n=r;r=()=>n}let e=[r,...t];if(e.length>1&&Rs(e[e.length-1])&&(e[e.length-1]=e[e.length-1].sink),e.length>2)for(let n=1;n<e.length-1;n++)Rs(e[n])&&(e[n]=ig(e[n]));return og(...e)}var og=(...r)=>{let t;for(;r.length>0;)t=r.shift()(t);return t},Tf=r=>r?.[Symbol.asyncIterator]!=null,If=r=>r?.[Symbol.iterator]!=null,Rs=r=>r==null?!1:r.sink!=null&&r.source!=null,ig=r=>t=>{let e=r.sink(t);if(e?.then!=null){let n=oe({objectMode:!0});e.then(()=>{n.end()},s=>{n.end(s)});let o,i=r.source;if(Tf(i))o=async function*(){yield*i,n.end()};else if(If(i))o=function*(){yield*i,n.end()};else throw new Error("Unknown duplex source type - must be Iterable or AsyncIterable");return Af(n,o())}return r.source};var sg=kf,Cf=128,ag=127,cg=~ag,ug=Math.pow(2,31);function kf(r,t,e){t=t||[],e=e||0;for(var n=e;r>=ug;)t[e++]=r&255|Cf,r/=128;for(;r&cg;)t[e++]=r&255|Cf,r>>>=7;return t[e]=r|0,kf.bytes=e-n+1,t}var fg=Os,lg=128,Df=127;function Os(r,n){var e=0,n=n||0,o=0,i=n,s,u=r.length;do{if(i>=u)throw Os.bytes=0,new RangeError("Could not decode varint");s=r[i++],e+=o<28?(s&Df)<<o:(s&Df)*Math.pow(2,o),o+=7}while(s>=lg);return Os.bytes=i-n,e}var hg=Math.pow(2,7),pg=Math.pow(2,14),dg=Math.pow(2,21),mg=Math.pow(2,28),bg=Math.pow(2,35),gg=Math.pow(2,42),yg=Math.pow(2,49),wg=Math.pow(2,56),xg=Math.pow(2,63),vg=function(r){return r<hg?1:r<pg?2:r<dg?3:r<mg?4:r<bg?5:r<gg?6:r<yg?7:r<wg?8:r<xg?9:10},Eg={encode:sg,decode:fg,encodingLength:vg},Sg=Eg,jr=Sg;var Jr=(r,t=0)=>[jr.decode(r,t),jr.decode.bytes],yr=(r,t,e=0)=>(jr.encode(r,t,e),t),wr=r=>jr.encodingLength(r);var UE=new Uint8Array(0);var Nf=(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},xr=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 Lf=(r,t)=>{let e=t.byteLength,n=wr(r),o=n+wr(e),i=new Uint8Array(o+e);return yr(r,i,0),yr(e,i,n),i.set(t,o),new vr(r,e,t,i)},Rf=r=>{let t=xr(r),[e,n]=Jr(t),[o,i]=Jr(t.subarray(n)),s=t.subarray(n+i);if(s.byteLength!==o)throw new Error("Incorrect length");return new vr(e,o,s,t)},Of=(r,t)=>{if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&Nf(r.bytes,e.bytes)}},vr=class{constructor(t,e,n,o){this.code=t,this.size=e,this.digest=n,this.bytes=o}};function Tg(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),s=i.charCodeAt(0);if(e[s]!==255)throw new TypeError(i+" is ambiguous");e[s]=o}var u=r.length,l=r.charAt(0),m=Math.log(u)/Math.log(256),h=Math.log(256)/Math.log(u);function b(p){if(p instanceof Uint8Array||(ArrayBuffer.isView(p)?p=new Uint8Array(p.buffer,p.byteOffset,p.byteLength):Array.isArray(p)&&(p=Uint8Array.from(p))),!(p instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(p.length===0)return"";for(var y=0,E=0,v=0,S=p.length;v!==S&&p[v]===0;)v++,y++;for(var I=(S-v)*h+1>>>0,C=new Uint8Array(I);v!==S;){for(var N=p[v],M=0,B=I-1;(N!==0||M<E)&&B!==-1;B--,M++)N+=256*C[B]>>>0,C[B]=N%u>>>0,N=N/u>>>0;if(N!==0)throw new Error("Non-zero carry");E=M,v++}for(var R=I-E;R!==I&&C[R]===0;)R++;for(var F=l.repeat(y);R<I;++R)F+=r.charAt(C[R]);return F}function w(p){if(typeof p!="string")throw new TypeError("Expected String");if(p.length===0)return new Uint8Array;var y=0;if(p[y]!==" "){for(var E=0,v=0;p[y]===l;)E++,y++;for(var S=(p.length-y)*m+1>>>0,I=new Uint8Array(S);p[y];){var C=e[p.charCodeAt(y)];if(C===255)return;for(var N=0,M=S-1;(C!==0||N<v)&&M!==-1;M--,N++)C+=u*I[M]>>>0,I[M]=C%256>>>0,C=C/256>>>0;if(C!==0)throw new Error("Non-zero carry");v=N,y++}if(p[y]!==" "){for(var B=S-v;B!==S&&I[B]===0;)B++;for(var R=new Uint8Array(E+(S-B)),F=E;B!==S;)R[F++]=I[B++];return R}}}function T(p){var y=w(p);if(y)return y;throw new Error(`Non-${t} character`)}return{encode:b,decodeUnsafe:w,decode:T}}var Ig=Tg,Cg=Ig,Mf=Cg;var Ms=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")}},Us=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 Uf(this,t)}},Ps=class{constructor(t){this.decoders=t}or(t){return Uf(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`)}},Uf=(r,t)=>new Ps({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),_s=class{constructor(t,e,n,o){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=o,this.encoder=new Ms(t,e,n),this.decoder=new Us(t,e,o)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}},Pf=({name:r,prefix:t,encode:e,decode:n})=>new _s(r,t,e,n),Fs=({prefix:r,name:t,alphabet:e})=>{let{encode:n,decode:o}=Mf(e,t);return Pf({prefix:r,name:t,encode:n,decode:i=>xr(o(i))})},Dg=(r,t,e,n)=>{let o={};for(let h=0;h<t.length;++h)o[t[h]]=h;let i=r.length;for(;r[i-1]==="=";)--i;let s=new Uint8Array(i*e/8|0),u=0,l=0,m=0;for(let h=0;h<i;++h){let b=o[r[h]];if(b===void 0)throw new SyntaxError(`Non-${n} character`);l=l<<e|b,u+=e,u>=8&&(u-=8,s[m++]=255&l>>u)}if(u>=e||255&l<<8-u)throw new SyntaxError("Unexpected end of data");return s},kg=(r,t,e)=>{let n=t[t.length-1]==="=",o=(1<<e)-1,i="",s=0,u=0;for(let l=0;l<r.length;++l)for(u=u<<8|r[l],s+=8;s>e;)s-=e,i+=t[o&u>>s];if(s&&(i+=t[o&u<<e-s]),n)for(;i.length*e&7;)i+="=";return i},Ht=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>Pf({prefix:t,name:r,encode(o){return kg(o,n,e)},decode(o){return Dg(o,n,e,r)}});var Qt=Fs({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),HE=Fs({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Xr=Ht({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),JE=Ht({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),XE=Ht({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),WE=Ht({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),KE=Ht({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ZE=Ht({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),QE=Ht({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),YE=Ht({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),t6=Ht({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var _f=(r,t)=>{let{bytes:e,version:n}=r;switch(n){case 0:return Ng(e,zs(r),t||Qt.encoder);default:return Lg(e,zs(r),t||Xr.encoder)}};var Ff=new WeakMap,zs=r=>{let t=Ff.get(r);if(t==null){let e=new Map;return Ff.set(r,e),e}return t},Kr=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!==Wr)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==Rg)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=Lf(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&&Of(t.multihash,n.multihash)}toString(t){return _f(this,t)}toJSON(){return{"/":_f(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:s}=e;return new r(n,o,i,s||zf(n,o,i.bytes))}else if(e[Og]===!0){let{version:n,multihash:o,code:i}=e,s=Rf(o);return r.create(n,i,s)}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!==Wr)throw new Error(`Version 0 CID must use dag-pb (code: ${Wr}) block encoding`);return new r(t,e,n,n.bytes)}case 1:{let o=zf(t,e,n.bytes);return new r(t,e,n,o)}default:throw new Error("Invalid version")}}static createV0(t){return r.create(0,Wr,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=xr(t.subarray(n,n+e.multihashSize));if(o.byteLength!==e.multihashSize)throw new Error("Incorrect length");let i=o.subarray(e.multihashSize-e.digestSize),s=new vr(e.multihashCode,e.digestSize,i,o);return[e.version===0?r.createV0(s):r.createV1(e.codec,s),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[b,w]=Jr(t.subarray(e));return e+=w,b},o=n(),i=Wr;if(o===18?(o=0,e=0):i=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let s=e,u=n(),l=n(),m=e+l,h=m-s;return{version:o,codec:i,multihashCode:u,digestSize:l,multihashSize:h,size:m}}static parse(t,e){let[n,o]=Bg(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 zs(i).set(n,t),i}},Bg=(r,t)=>{switch(r[0]){case"Q":{let e=t||Qt;return[Qt.prefix,e.decode(`${Qt.prefix}${r}`)]}case Qt.prefix:{let e=t||Qt;return[Qt.prefix,e.decode(r)]}case Xr.prefix:{let e=t||Xr;return[Xr.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)]}}},Ng=(r,t,e)=>{let{prefix:n}=e;if(n!==Qt.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},Lg=(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},Wr=112,Rg=18,zf=(r,t,e)=>{let n=wr(r),o=n+wr(t),i=new Uint8Array(o+e.byteLength);return yr(r,i,0),yr(t,i,n),i.set(e,o),i},Og=Symbol.for("@ipld/js-cid/CID");function Mg(r){return r[Symbol.asyncIterator]!=null}function Ug(r){if(Mg(r))return(async()=>{for await(let t of r);})();for(let t of r);}var Vs=Ug;function Q(r){return we.encode({type:we.Type.OK,peers:[],...r}).subarray()}function $(r){return we.encode({type:we.Type.ERROR,error:{msg:r.message},peers:[]}).subarray()}var Yn=it("libp2p:daemon-server:dht"),to=class{dht;constructor(t){let{dht:e}=t;this.dht=e}async*provide(t){try{await Vs(this.dht.provide(t)),yield Q()}catch(e){Yn.error(e),yield $(e)}}async*getClosestPeers(t){yield Q({dht:{type:rt.Type.BEGIN}});for await(let e of this.dht.getClosestPeers(t))e.name==="PEER_RESPONSE"&&(yield*e.closer.map(n=>rt.encode({type:rt.Type.VALUE,value:n.id.toBytes()})));yield rt.encode({type:rt.Type.END})}async*getPublicKey(t){yield $(new Error("FIX ME: not implemented"))}async*getValue(t){try{for await(let e of this.dht.get(t))e.name==="VALUE"&&(yield Q({dht:{type:rt.Type.VALUE,value:e.value}}))}catch(e){Yn.error(e),yield $(e)}}async*putValue(t,e){try{await Vs(this.dht.put(t,e)),yield Q()}catch(n){Yn.error(n),yield $(n)}}async*findPeer(t){try{for await(let e of this.dht.findPeer(t))e.name==="FINAL_PEER"&&(yield Q({dht:{type:rt.Type.VALUE,peer:{id:e.peer.id.toBytes(),addrs:e.peer.multiaddrs.map(n=>n.bytes)}}}));throw new Error("Peer not found")}catch(e){Yn.error(e),yield $(e)}}async*findProviders(t,e){yield Q({dht:{type:rt.Type.BEGIN}});try{let n=e,o=0;for await(let i of this.dht.findProviders(t))if(i.name==="PEER_RESPONSE"){for(let s of i.providers)o++,yield rt.encode({type:rt.Type.VALUE,peer:{id:s.id.toBytes(),addrs:(s.multiaddrs??[]).map(u=>u.bytes)}});if(n===o)break}}catch(n){yield $(n)}yield rt.encode({type:rt.Type.END})}};var eo=it("libp2p:daemon-server:pubsub"),ro=class{pubsub;constructor(t){let{pubsub:e}=t;this.pubsub=e}async*getTopics(){try{yield Q({pubsub:{topics:this.pubsub.getTopics(),peerIDs:[]}})}catch(t){eo.error(t),yield $(t)}}async*subscribe(t){try{let e=oe();this.pubsub.subscribe(t),this.pubsub.addEventListener("message",n=>{let o=n.detail;o.topic===t&&(o.type==="signed"?e.push(Tr.encode({from:o.from.toBytes(),data:o.data,seqno:o.sequenceNumber==null?void 0:Gr(o.sequenceNumber.toString(16).padStart(16,"0"),"base16"),topicIDs:[o.topic],signature:o.signature,key:o.key}).subarray()):e.push(Tr.encode({data:o.data,topicIDs:[o.topic]}).subarray()))}),yield Q(),yield*e}catch(e){eo.error(e),yield $(e)}}async*publish(t,e){try{await this.pubsub.publish(t,e),yield Q()}catch(n){eo.error(n),yield $(n)}}async*listPeers(t){try{yield Q({pubsub:{topics:[t],peerIDs:this.pubsub.getSubscribers(t).map(e=>e.toBytes())}})}catch(e){eo.error(e),yield $(e)}}};var Pg=1<<22,Yt=it("libp2p:daemon-server"),no=class{multiaddr;libp2p;tcp;listener;dhtOperations;pubsubOperations;constructor(t){let{multiaddr:e,libp2pNode:n}=t;this.multiaddr=e,this.libp2p=n,this.tcp=Sf()(),this.listener=this.tcp.createListener({handler:this.handleConnection.bind(this),upgrader:Po}),this._onExit=this._onExit.bind(this),n.services.dht!=null&&(this.dhtOperations=new to({dht:n.services.dht})),n.services.pubsub!=null&&(this.pubsubOperations=new ro({pubsub:n.services.pubsub}))}async connect(t){if(t.connect==null||t.connect.addrs==null)throw new Error("Invalid request");let e=t.connect.peer,n=t.connect.addrs.map(i=>yt(i)),o=Ce(e);return await this.libp2p.peerStore.merge(o,{multiaddrs:n}),this.libp2p.dial(o)}async openStream(t){if(t.streamOpen==null||t.streamOpen.proto==null)throw new Error("Invalid request");let{peer:e,proto:n}=t.streamOpen,o=Ce(e),i=await this.libp2p.dial(o),s=await i.newStream(n,{runOnTransientConnection:!0});return{streamInfo:{peer:o.toBytes(),addr:i.remoteAddr.bytes,proto:s.protocol??""},connection:s}}async registerStreamHandler(t){if(t.streamHandler==null||t.streamHandler.proto==null)throw new Error("Invalid request");let e=t.streamHandler.proto,n=yt(t.streamHandler.addr),o;await this.libp2p.handle(e,({connection:i,stream:s})=>{Promise.resolve().then(async()=>{o=await this.tcp.dial(n,{upgrader:Po});let u=_e.encode({peer:i.remotePeer.toBytes(),addr:i.remoteAddr.bytes,proto:s.protocol??""}),l=qe.single(u);await Qn(async function*(){yield l,yield*s.source}(),async function*(m){for await(let h of m)yield*h},o,s.sink)}).catch(async u=>{Yt.error(u),o!=null&&await o.close(u)}).finally(()=>{o?.close().catch(u=>{Yt.error(u)})})},{runOnTransientConnection:!0})}_listen(){process.on("SIGTERM",this._onExit),process.on("SIGINT",this._onExit),process.on("SIGHUP",this._onExit)}_onExit(){this.stop({exit:!0}).catch(t=>{Yt.error(t)})}async start(){this._listen(),await this.libp2p.start(),await this.listener.listen(this.multiaddr)}getMultiaddr(){let t=this.listener.getAddrs();if(t.length>0)return t[0];throw new Error("Not started")}async stop(t={exit:!1}){await this.libp2p.stop(),await this.listener.close(),t.exit&&Yt("server closed, exiting"),process.removeListener("SIGTERM",this._onExit),process.removeListener("SIGINT",this._onExit),process.removeListener("SIGHUP",this._onExit)}async*handlePeerStoreRequest(t){try{switch(t.type){case xe.Type.GET_PROTOCOLS:if(t.id==null)throw new Error("Invalid request");let e=Ce(t.id),o=(await this.libp2p.peerStore.get(e)).protocols;yield Q({peerStore:{protos:o}});return;case xe.Type.GET_PEER_INFO:throw new Error("ERR_NOT_IMPLEMENTED");default:throw new Error("ERR_INVALID_REQUEST_TYPE")}}catch(e){Yt.error(e),yield $(e)}}async*handlePubsubRequest(t){try{if(this.libp2p.services.pubsub==null||this.pubsubOperations==null)throw new Error("PubSub not configured");switch(t.type){case Jt.Type.GET_TOPICS:yield*this.pubsubOperations.getTopics();return;case Jt.Type.SUBSCRIBE:if(t.topic==null)throw new Error("Invalid request");yield*this.pubsubOperations.subscribe(t.topic);return;case Jt.Type.PUBLISH:if(t.topic==null||t.data==null)throw new Error("Invalid request");yield*this.pubsubOperations.publish(t.topic,t.data);return;case Jt.Type.LIST_PEERS:if(t.topic==null)throw new Error("Invalid request");yield*this.pubsubOperations.listPeers(t.topic);return;default:throw new Error("ERR_INVALID_REQUEST_TYPE")}}catch(e){Yt.error(e),yield $(e)}}async*handleDHTRequest(t){try{if(this.libp2p.services.dht==null||this.dhtOperations==null)throw new Error("DHT not configured");switch(t.type){case At.Type.FIND_PEER:if(t.peer==null)throw new Error("Invalid request");yield*this.dhtOperations.findPeer(Ce(t.peer));return;case At.Type.FIND_PROVIDERS:if(t.cid==null)throw new Error("Invalid request");yield*this.dhtOperations.findProviders(Kr.decode(t.cid),t.count??20);return;case At.Type.PROVIDE:if(t.cid==null)throw new Error("Invalid request");yield*this.dhtOperations.provide(Kr.decode(t.cid));return;case At.Type.GET_CLOSEST_PEERS:if(t.key==null)throw new Error("Invalid request");yield*this.dhtOperations.getClosestPeers(t.key);return;case At.Type.GET_PUBLIC_KEY:if(t.peer==null)throw new Error("Invalid request");yield*this.dhtOperations.getPublicKey(Ce(t.peer));return;case At.Type.GET_VALUE:if(t.key==null)throw new Error("Invalid request");yield*this.dhtOperations.getValue(t.key);return;case At.Type.PUT_VALUE:if(t.key==null||t.value==null)throw new Error("Invalid request");yield*this.dhtOperations.putValue(t.key,t.value);return;default:throw new Error("ERR_INVALID_REQUEST_TYPE")}}catch(e){Yt.error(e),yield $(e)}}handleConnection(t){let e=this,n=new Tn({stream:t,maxLength:Pg});Qn(n.decoder,o=>async function*(){let i;for await(let s of o)try{switch(i=St.decode(s),i.type){case St.Type.CONNECT:{try{await e.connect(i)}catch(u){yield $(u);break}yield Q();break}case St.Type.IDENTIFY:{yield Q({identify:{id:e.libp2p.peerId.toBytes(),addrs:e.libp2p.getMultiaddrs().map(u=>u.decapsulateCode(z("p2p").code)).map(u=>u.bytes)}});break}case St.Type.LIST_PEERS:{let u=[],l=new Set;for(let m of e.libp2p.getConnections()){let h=m.remotePeer.toString();l.has(h)||(l.add(h),u.push({id:m.remotePeer.toBytes(),addrs:[m.remoteAddr.bytes]}))}yield Q({peers:u});break}case St.Type.STREAM_OPEN:{let u;try{u=await e.openStream(i)}catch(m){yield $(m);break}yield Q({streamInfo:u.streamInfo});let l=n.rest();await Qn(l,u.connection,async function*(m){for await(let h of m)yield*h},l);return}case St.Type.STREAM_HANDLER:{try{await e.registerStreamHandler(i)}catch(u){yield $(u);break}yield Q();break}case St.Type.PEERSTORE:{if(i.peerStore==null){yield $(new Error("ERR_INVALID_REQUEST"));break}yield*e.handlePeerStoreRequest(i.peerStore);break}case St.Type.PUBSUB:{if(i.pubsub==null){yield $(new Error("ERR_INVALID_REQUEST"));break}yield*e.handlePubsubRequest(i.pubsub);break}case St.Type.DHT:{if(i.dht==null){yield $(new Error("ERR_INVALID_REQUEST"));break}yield*e.handleDHTRequest(i.dht);break}default:yield $(new Error("ERR_INVALID_REQUEST_TYPE"));break}}catch(u){Yt.error(u),yield $(u);continue}}(),async function(o){for await(let i of o)n.write(i)}).catch(o=>{Yt(o)})}},_g=(r,t)=>new no({multiaddr:r,libp2pNode:t});return Ih(Fg);})();
|
|
4
|
+
`+s),r.push(i+"m+"+_r.exports.humanize(this.diff)+"\x1B[0m")}else r[0]=cl()+t+" "+r[0]}function cl(){return Y.inspectOpts.hideDate?"":new Date().toISOString()+" "}function al(...r){return process.stderr.write(Rr.format(...r)+`
|
|
5
|
+
`)}function ul(r){r?process.env.DEBUG=r:delete process.env.DEBUG}function ll(){return process.env.DEBUG}function fl(r){r.inspectOpts={};let t=Object.keys(Y.inspectOpts);for(let e=0;e<t.length;e++)r.inspectOpts[t[e]]=Y.inspectOpts[t[e]]}_r.exports=On()(Y);var{formatters:eo}=_r.exports;eo.o=function(r){return this.inspectOpts.colors=this.useColors,Rr.inspect(r,this.inspectOpts).split(`
|
|
6
|
+
`).map(t=>t.trim()).join(" ")};eo.O=function(r){return this.inspectOpts.colors=this.useColors,Rr.inspect(r,this.inspectOpts)}});var no=B((_p,Mn)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?Mn.exports=Ys():Mn.exports=ro()});var bo=B((Ad,yo)=>{"use strict";function go(r,t){for(let e in t)Object.defineProperty(r,e,{value:t[e],enumerable:!0,configurable:!0});return r}function Gl(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 go(r,e)}catch{e.message=r.message,e.stack=r.stack;let i=function(){};return i.prototype=Object.create(Object.getPrototypeOf(r)),go(new i,e)}}yo.exports=Gl});var zo=B((km,$o)=>{$o.exports=fi;var Go=128,Of=127,Pf=~Of,Mf=Math.pow(2,31);function fi(r,t,e){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw fi.bytes=0,new RangeError("Could not encode varint");t=t||[],e=e||0;for(var n=e;r>=Mf;)t[e++]=r&255|Go,r/=128;for(;r&Pf;)t[e++]=r&255|Go,r>>>=7;return t[e]=r|0,fi.bytes=e-n+1,t}});var Wo=B((Dm,Ho)=>{Ho.exports=hi;var Uf=128,Vo=127;function hi(r,n){var e=0,n=n||0,i=0,s=n,a,l=r.length;do{if(s>=l||i>49)throw hi.bytes=0,new RangeError("Could not decode varint");a=r[s++],e+=i<28?(a&Vo)<<i:(a&Vo)*Math.pow(2,i),i+=7}while(a>=Uf);return hi.bytes=s-n,e}});var Zo=B((Bm,qo)=>{var Ff=Math.pow(2,7),Gf=Math.pow(2,14),$f=Math.pow(2,21),zf=Math.pow(2,28),Vf=Math.pow(2,35),Hf=Math.pow(2,42),Wf=Math.pow(2,49),qf=Math.pow(2,56),Zf=Math.pow(2,63);qo.exports=function(r){return r<Ff?1:r<Gf?2:r<$f?3:r<zf?4:r<Vf?5:r<Hf?6:r<Wf?7:r<qf?8:r<Zf?9:10}});var pi=B((Rm,Ko)=>{Ko.exports={encode:zo(),decode:Wo(),encodingLength:Zo()}});var Bi=B((Qr,wc)=>{(function(){var r,t=0xdeadbeefcafe,e=(t&16777215)==15715070;function n(o,c,u){o!=null&&(typeof o=="number"?this.fromNumber(o,c,u):c==null&&typeof o!="string"?this.fromString(o,256):this.fromString(o,c))}function i(){return new n(null)}function s(o,c,u,p,m,y){for(;--y>=0;){var E=c*this[o++]+u[p]+m;m=Math.floor(E/67108864),u[p++]=E&67108863}return m}function a(o,c,u,p,m,y){for(var E=c&32767,x=c>>15;--y>=0;){var N=this[o]&32767,Z=this[o++]>>15,yt=x*N+Z*E;N=E*N+((yt&32767)<<15)+u[p]+(m&1073741823),m=(N>>>30)+(yt>>>15)+x*Z+(m>>>30),u[p++]=N&1073741823}return m}function l(o,c,u,p,m,y){for(var E=c&16383,x=c>>14;--y>=0;){var N=this[o]&16383,Z=this[o++]>>14,yt=x*N+Z*E;N=E*N+((yt&16383)<<14)+u[p]+m,m=(N>>28)+(yt>>14)+x*Z,u[p++]=N&268435455}return m}var f=typeof navigator<"u";f&&e&&navigator.appName=="Microsoft Internet Explorer"?(n.prototype.am=a,r=30):f&&e&&navigator.appName!="Netscape"?(n.prototype.am=s,r=26):(n.prototype.am=l,r=28),n.prototype.DB=r,n.prototype.DM=(1<<r)-1,n.prototype.DV=1<<r;var d=52;n.prototype.FV=Math.pow(2,d),n.prototype.F1=d-r,n.prototype.F2=2*r-d;var h="0123456789abcdefghijklmnopqrstuvwxyz",g=new Array,w,S;for(w="0".charCodeAt(0),S=0;S<=9;++S)g[w++]=S;for(w="a".charCodeAt(0),S=10;S<36;++S)g[w++]=S;for(w="A".charCodeAt(0),S=10;S<36;++S)g[w++]=S;function b(o){return h.charAt(o)}function k(o,c){var u=g[o.charCodeAt(c)];return u??-1}function A(o){for(var c=this.t-1;c>=0;--c)o[c]=this[c];o.t=this.t,o.s=this.s}function C(o){this.t=1,this.s=o<0?-1:0,o>0?this[0]=o:o<-1?this[0]=o+this.DV:this.t=0}function D(o){var c=i();return c.fromInt(o),c}function _(o,c){var u;if(c==16)u=4;else if(c==8)u=3;else if(c==256)u=8;else if(c==2)u=1;else if(c==32)u=5;else if(c==4)u=2;else{this.fromRadix(o,c);return}this.t=0,this.s=0;for(var p=o.length,m=!1,y=0;--p>=0;){var E=u==8?o[p]&255:k(o,p);if(E<0){o.charAt(p)=="-"&&(m=!0);continue}m=!1,y==0?this[this.t++]=E:y+u>this.DB?(this[this.t-1]|=(E&(1<<this.DB-y)-1)<<y,this[this.t++]=E>>this.DB-y):this[this.t-1]|=E<<y,y+=u,y>=this.DB&&(y-=this.DB)}u==8&&o[0]&128&&(this.s=-1,y>0&&(this[this.t-1]|=(1<<this.DB-y)-1<<y)),this.clamp(),m&&n.ZERO.subTo(this,this)}function G(){for(var o=this.s&this.DM;this.t>0&&this[this.t-1]==o;)--this.t}function rt(o){if(this.s<0)return"-"+this.negate().toString(o);var c;if(o==16)c=4;else if(o==8)c=3;else if(o==2)c=1;else if(o==32)c=5;else if(o==4)c=2;else return this.toRadix(o);var u=(1<<c)-1,p,m=!1,y="",E=this.t,x=this.DB-E*this.DB%c;if(E-- >0)for(x<this.DB&&(p=this[E]>>x)>0&&(m=!0,y=b(p));E>=0;)x<c?(p=(this[E]&(1<<x)-1)<<c-x,p|=this[--E]>>(x+=this.DB-c)):(p=this[E]>>(x-=c)&u,x<=0&&(x+=this.DB,--E)),p>0&&(m=!0),m&&(y+=b(p));return m?y:"0"}function st(){var o=i();return n.ZERO.subTo(this,o),o}function nt(){return this.s<0?this.negate():this}function ot(o){var c=this.s-o.s;if(c!=0)return c;var u=this.t;if(c=u-o.t,c!=0)return this.s<0?-c:c;for(;--u>=0;)if((c=this[u]-o[u])!=0)return c;return 0}function Tt(o){var c=1,u;return(u=o>>>16)!=0&&(o=u,c+=16),(u=o>>8)!=0&&(o=u,c+=8),(u=o>>4)!=0&&(o=u,c+=4),(u=o>>2)!=0&&(o=u,c+=2),(u=o>>1)!=0&&(o=u,c+=1),c}function qc(){return this.t<=0?0:this.DB*(this.t-1)+Tt(this[this.t-1]^this.s&this.DM)}function Zc(o,c){var u;for(u=this.t-1;u>=0;--u)c[u+o]=this[u];for(u=o-1;u>=0;--u)c[u]=0;c.t=this.t+o,c.s=this.s}function Kc(o,c){for(var u=o;u<this.t;++u)c[u-o]=this[u];c.t=Math.max(this.t-o,0),c.s=this.s}function Xc(o,c){var u=o%this.DB,p=this.DB-u,m=(1<<p)-1,y=Math.floor(o/this.DB),E=this.s<<u&this.DM,x;for(x=this.t-1;x>=0;--x)c[x+y+1]=this[x]>>p|E,E=(this[x]&m)<<u;for(x=y-1;x>=0;--x)c[x]=0;c[y]=E,c.t=this.t+y+1,c.s=this.s,c.clamp()}function Yc(o,c){c.s=this.s;var u=Math.floor(o/this.DB);if(u>=this.t){c.t=0;return}var p=o%this.DB,m=this.DB-p,y=(1<<p)-1;c[0]=this[u]>>p;for(var E=u+1;E<this.t;++E)c[E-u-1]|=(this[E]&y)<<m,c[E-u]=this[E]>>p;p>0&&(c[this.t-u-1]|=(this.s&y)<<m),c.t=this.t-u,c.clamp()}function jc(o,c){for(var u=0,p=0,m=Math.min(o.t,this.t);u<m;)p+=this[u]-o[u],c[u++]=p&this.DM,p>>=this.DB;if(o.t<this.t){for(p-=o.s;u<this.t;)p+=this[u],c[u++]=p&this.DM,p>>=this.DB;p+=this.s}else{for(p+=this.s;u<o.t;)p-=o[u],c[u++]=p&this.DM,p>>=this.DB;p-=o.s}c.s=p<0?-1:0,p<-1?c[u++]=this.DV+p:p>0&&(c[u++]=p),c.t=u,c.clamp()}function Jc(o,c){var u=this.abs(),p=o.abs(),m=u.t;for(c.t=m+p.t;--m>=0;)c[m]=0;for(m=0;m<p.t;++m)c[m+u.t]=u.am(0,p[m],c,m,0,u.t);c.s=0,c.clamp(),this.s!=o.s&&n.ZERO.subTo(c,c)}function Qc(o){for(var c=this.abs(),u=o.t=2*c.t;--u>=0;)o[u]=0;for(u=0;u<c.t-1;++u){var p=c.am(u,c[u],o,2*u,0,1);(o[u+c.t]+=c.am(u+1,2*c[u],o,2*u+1,p,c.t-u-1))>=c.DV&&(o[u+c.t]-=c.DV,o[u+c.t+1]=1)}o.t>0&&(o[o.t-1]+=c.am(u,c[u],o,2*u,0,1)),o.s=0,o.clamp()}function ta(o,c,u){var p=o.abs();if(!(p.t<=0)){var m=this.abs();if(m.t<p.t){c?.fromInt(0),u!=null&&this.copyTo(u);return}u==null&&(u=i());var y=i(),E=this.s,x=o.s,N=this.DB-Tt(p[p.t-1]);N>0?(p.lShiftTo(N,y),m.lShiftTo(N,u)):(p.copyTo(y),m.copyTo(u));var Z=y.t,yt=y[Z-1];if(yt!=0){var lt=yt*(1<<this.F1)+(Z>1?y[Z-2]>>this.F2:0),Ut=this.FV/lt,hr=(1<<this.F1)/lt,It=1<<this.F2,Ct=u.t,pr=Ct-Z,qt=c??i();for(y.dlShiftTo(pr,qt),u.compareTo(qt)>=0&&(u[u.t++]=1,u.subTo(qt,u)),n.ONE.dlShiftTo(Z,qt),qt.subTo(y,y);y.t<Z;)y[y.t++]=0;for(;--pr>=0;){var bn=u[--Ct]==yt?this.DM:Math.floor(u[Ct]*Ut+(u[Ct-1]+It)*hr);if((u[Ct]+=y.am(0,bn,u,pr,0,Z))<bn)for(y.dlShiftTo(pr,qt),u.subTo(qt,u);u[Ct]<--bn;)u.subTo(qt,u)}c!=null&&(u.drShiftTo(Z,c),E!=x&&n.ZERO.subTo(c,c)),u.t=Z,u.clamp(),N>0&&u.rShiftTo(N,u),E<0&&n.ZERO.subTo(u,u)}}}function ea(o){var c=i();return this.abs().divRemTo(o,null,c),this.s<0&&c.compareTo(n.ZERO)>0&&o.subTo(c,c),c}function ne(o){this.m=o}function ra(o){return o.s<0||o.compareTo(this.m)>=0?o.mod(this.m):o}function na(o){return o}function ia(o){o.divRemTo(this.m,null,o)}function sa(o,c,u){o.multiplyTo(c,u),this.reduce(u)}function oa(o,c){o.squareTo(c),this.reduce(c)}ne.prototype.convert=ra,ne.prototype.revert=na,ne.prototype.reduce=ia,ne.prototype.mulTo=sa,ne.prototype.sqrTo=oa;function ca(){if(this.t<1)return 0;var o=this[0];if(!(o&1))return 0;var c=o&3;return c=c*(2-(o&15)*c)&15,c=c*(2-(o&255)*c)&255,c=c*(2-((o&65535)*c&65535))&65535,c=c*(2-o*c%this.DV)%this.DV,c>0?this.DV-c:-c}function ie(o){this.m=o,this.mp=o.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<o.DB-15)-1,this.mt2=2*o.t}function aa(o){var c=i();return o.abs().dlShiftTo(this.m.t,c),c.divRemTo(this.m,null,c),o.s<0&&c.compareTo(n.ZERO)>0&&this.m.subTo(c,c),c}function ua(o){var c=i();return o.copyTo(c),this.reduce(c),c}function la(o){for(;o.t<=this.mt2;)o[o.t++]=0;for(var c=0;c<this.m.t;++c){var u=o[c]&32767,p=u*this.mpl+((u*this.mph+(o[c]>>15)*this.mpl&this.um)<<15)&o.DM;for(u=c+this.m.t,o[u]+=this.m.am(0,p,o,c,0,this.m.t);o[u]>=o.DV;)o[u]-=o.DV,o[++u]++}o.clamp(),o.drShiftTo(this.m.t,o),o.compareTo(this.m)>=0&&o.subTo(this.m,o)}function fa(o,c){o.squareTo(c),this.reduce(c)}function ha(o,c,u){o.multiplyTo(c,u),this.reduce(u)}ie.prototype.convert=aa,ie.prototype.revert=ua,ie.prototype.reduce=la,ie.prototype.mulTo=ha,ie.prototype.sqrTo=fa;function pa(){return(this.t>0?this[0]&1:this.s)==0}function da(o,c){if(o>4294967295||o<1)return n.ONE;var u=i(),p=i(),m=c.convert(this),y=Tt(o)-1;for(m.copyTo(u);--y>=0;)if(c.sqrTo(u,p),(o&1<<y)>0)c.mulTo(p,m,u);else{var E=u;u=p,p=E}return c.revert(u)}function ma(o,c){var u;return o<256||c.isEven()?u=new ne(c):u=new ie(c),this.exp(o,u)}n.prototype.copyTo=A,n.prototype.fromInt=C,n.prototype.fromString=_,n.prototype.clamp=G,n.prototype.dlShiftTo=Zc,n.prototype.drShiftTo=Kc,n.prototype.lShiftTo=Xc,n.prototype.rShiftTo=Yc,n.prototype.subTo=jc,n.prototype.multiplyTo=Jc,n.prototype.squareTo=Qc,n.prototype.divRemTo=ta,n.prototype.invDigit=ca,n.prototype.isEven=pa,n.prototype.exp=da,n.prototype.toString=rt,n.prototype.negate=st,n.prototype.abs=nt,n.prototype.compareTo=ot,n.prototype.bitLength=qc,n.prototype.mod=ea,n.prototype.modPowInt=ma,n.ZERO=D(0),n.ONE=D(1);function ga(){var o=i();return this.copyTo(o),o}function ya(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function ba(){return this.t==0?this.s:this[0]<<24>>24}function wa(){return this.t==0?this.s:this[0]<<16>>16}function Ea(o){return Math.floor(Math.LN2*this.DB/Math.log(o))}function va(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function xa(o){if(o==null&&(o=10),this.signum()==0||o<2||o>36)return"0";var c=this.chunkSize(o),u=Math.pow(o,c),p=D(u),m=i(),y=i(),E="";for(this.divRemTo(p,m,y);m.signum()>0;)E=(u+y.intValue()).toString(o).substr(1)+E,m.divRemTo(p,m,y);return y.intValue().toString(o)+E}function Sa(o,c){this.fromInt(0),c==null&&(c=10);for(var u=this.chunkSize(c),p=Math.pow(c,u),m=!1,y=0,E=0,x=0;x<o.length;++x){var N=k(o,x);if(N<0){o.charAt(x)=="-"&&this.signum()==0&&(m=!0);continue}E=c*E+N,++y>=u&&(this.dMultiply(p),this.dAddOffset(E,0),y=0,E=0)}y>0&&(this.dMultiply(Math.pow(c,y)),this.dAddOffset(E,0)),m&&n.ZERO.subTo(this,this)}function Ta(o,c,u){if(typeof c=="number")if(o<2)this.fromInt(1);else for(this.fromNumber(o,u),this.testBit(o-1)||this.bitwiseTo(n.ONE.shiftLeft(o-1),dn,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(c);)this.dAddOffset(2,0),this.bitLength()>o&&this.subTo(n.ONE.shiftLeft(o-1),this);else{var p=new Array,m=o&7;p.length=(o>>3)+1,c.nextBytes(p),m>0?p[0]&=(1<<m)-1:p[0]=0,this.fromString(p,256)}}function Aa(){var o=this.t,c=new Array;c[0]=this.s;var u=this.DB-o*this.DB%8,p,m=0;if(o-- >0)for(u<this.DB&&(p=this[o]>>u)!=(this.s&this.DM)>>u&&(c[m++]=p|this.s<<this.DB-u);o>=0;)u<8?(p=(this[o]&(1<<u)-1)<<8-u,p|=this[--o]>>(u+=this.DB-8)):(p=this[o]>>(u-=8)&255,u<=0&&(u+=this.DB,--o)),p&128&&(p|=-256),m==0&&(this.s&128)!=(p&128)&&++m,(m>0||p!=this.s)&&(c[m++]=p);return c}function Ia(o){return this.compareTo(o)==0}function Ca(o){return this.compareTo(o)<0?this:o}function ka(o){return this.compareTo(o)>0?this:o}function Da(o,c,u){var p,m,y=Math.min(o.t,this.t);for(p=0;p<y;++p)u[p]=c(this[p],o[p]);if(o.t<this.t){for(m=o.s&this.DM,p=y;p<this.t;++p)u[p]=c(this[p],m);u.t=this.t}else{for(m=this.s&this.DM,p=y;p<o.t;++p)u[p]=c(m,o[p]);u.t=o.t}u.s=c(this.s,o.s),u.clamp()}function Ba(o,c){return o&c}function Ra(o){var c=i();return this.bitwiseTo(o,Ba,c),c}function dn(o,c){return o|c}function _a(o){var c=i();return this.bitwiseTo(o,dn,c),c}function Yi(o,c){return o^c}function La(o){var c=i();return this.bitwiseTo(o,Yi,c),c}function ji(o,c){return o&~c}function Na(o){var c=i();return this.bitwiseTo(o,ji,c),c}function Oa(){for(var o=i(),c=0;c<this.t;++c)o[c]=this.DM&~this[c];return o.t=this.t,o.s=~this.s,o}function Pa(o){var c=i();return o<0?this.rShiftTo(-o,c):this.lShiftTo(o,c),c}function Ma(o){var c=i();return o<0?this.lShiftTo(-o,c):this.rShiftTo(o,c),c}function Ua(o){if(o==0)return-1;var c=0;return o&65535||(o>>=16,c+=16),o&255||(o>>=8,c+=8),o&15||(o>>=4,c+=4),o&3||(o>>=2,c+=2),o&1||++c,c}function Fa(){for(var o=0;o<this.t;++o)if(this[o]!=0)return o*this.DB+Ua(this[o]);return this.s<0?this.t*this.DB:-1}function Ga(o){for(var c=0;o!=0;)o&=o-1,++c;return c}function $a(){for(var o=0,c=this.s&this.DM,u=0;u<this.t;++u)o+=Ga(this[u]^c);return o}function za(o){var c=Math.floor(o/this.DB);return c>=this.t?this.s!=0:(this[c]&1<<o%this.DB)!=0}function Va(o,c){var u=n.ONE.shiftLeft(o);return this.bitwiseTo(u,c,u),u}function Ha(o){return this.changeBit(o,dn)}function Wa(o){return this.changeBit(o,ji)}function qa(o){return this.changeBit(o,Yi)}function Za(o,c){for(var u=0,p=0,m=Math.min(o.t,this.t);u<m;)p+=this[u]+o[u],c[u++]=p&this.DM,p>>=this.DB;if(o.t<this.t){for(p+=o.s;u<this.t;)p+=this[u],c[u++]=p&this.DM,p>>=this.DB;p+=this.s}else{for(p+=this.s;u<o.t;)p+=o[u],c[u++]=p&this.DM,p>>=this.DB;p+=o.s}c.s=p<0?-1:0,p>0?c[u++]=p:p<-1&&(c[u++]=this.DV+p),c.t=u,c.clamp()}function Ka(o){var c=i();return this.addTo(o,c),c}function Xa(o){var c=i();return this.subTo(o,c),c}function Ya(o){var c=i();return this.multiplyTo(o,c),c}function ja(){var o=i();return this.squareTo(o),o}function Ja(o){var c=i();return this.divRemTo(o,c,null),c}function Qa(o){var c=i();return this.divRemTo(o,null,c),c}function tu(o){var c=i(),u=i();return this.divRemTo(o,c,u),new Array(c,u)}function eu(o){this[this.t]=this.am(0,o-1,this,0,0,this.t),++this.t,this.clamp()}function ru(o,c){if(o!=0){for(;this.t<=c;)this[this.t++]=0;for(this[c]+=o;this[c]>=this.DV;)this[c]-=this.DV,++c>=this.t&&(this[this.t++]=0),++this[c]}}function Xe(){}function Ji(o){return o}function nu(o,c,u){o.multiplyTo(c,u)}function iu(o,c){o.squareTo(c)}Xe.prototype.convert=Ji,Xe.prototype.revert=Ji,Xe.prototype.mulTo=nu,Xe.prototype.sqrTo=iu;function su(o){return this.exp(o,new Xe)}function ou(o,c,u){var p=Math.min(this.t+o.t,c);for(u.s=0,u.t=p;p>0;)u[--p]=0;var m;for(m=u.t-this.t;p<m;++p)u[p+this.t]=this.am(0,o[p],u,p,0,this.t);for(m=Math.min(o.t,c);p<m;++p)this.am(0,o[p],u,p,0,c-p);u.clamp()}function cu(o,c,u){--c;var p=u.t=this.t+o.t-c;for(u.s=0;--p>=0;)u[p]=0;for(p=Math.max(c-this.t,0);p<o.t;++p)u[this.t+p-c]=this.am(c-p,o[p],u,0,0,this.t+p-c);u.clamp(),u.drShiftTo(1,u)}function se(o){this.r2=i(),this.q3=i(),n.ONE.dlShiftTo(2*o.t,this.r2),this.mu=this.r2.divide(o),this.m=o}function au(o){if(o.s<0||o.t>2*this.m.t)return o.mod(this.m);if(o.compareTo(this.m)<0)return o;var c=i();return o.copyTo(c),this.reduce(c),c}function uu(o){return o}function lu(o){for(o.drShiftTo(this.m.t-1,this.r2),o.t>this.m.t+1&&(o.t=this.m.t+1,o.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);o.compareTo(this.r2)<0;)o.dAddOffset(1,this.m.t+1);for(o.subTo(this.r2,o);o.compareTo(this.m)>=0;)o.subTo(this.m,o)}function fu(o,c){o.squareTo(c),this.reduce(c)}function hu(o,c,u){o.multiplyTo(c,u),this.reduce(u)}se.prototype.convert=au,se.prototype.revert=uu,se.prototype.reduce=lu,se.prototype.mulTo=hu,se.prototype.sqrTo=fu;function pu(o,c){var u=o.bitLength(),p,m=D(1),y;if(u<=0)return m;u<18?p=1:u<48?p=3:u<144?p=4:u<768?p=5:p=6,u<8?y=new ne(c):c.isEven()?y=new se(c):y=new ie(c);var E=new Array,x=3,N=p-1,Z=(1<<p)-1;if(E[1]=y.convert(this),p>1){var yt=i();for(y.sqrTo(E[1],yt);x<=Z;)E[x]=i(),y.mulTo(yt,E[x-2],E[x]),x+=2}var lt=o.t-1,Ut,hr=!0,It=i(),Ct;for(u=Tt(o[lt])-1;lt>=0;){for(u>=N?Ut=o[lt]>>u-N&Z:(Ut=(o[lt]&(1<<u+1)-1)<<N-u,lt>0&&(Ut|=o[lt-1]>>this.DB+u-N)),x=p;!(Ut&1);)Ut>>=1,--x;if((u-=x)<0&&(u+=this.DB,--lt),hr)E[Ut].copyTo(m),hr=!1;else{for(;x>1;)y.sqrTo(m,It),y.sqrTo(It,m),x-=2;x>0?y.sqrTo(m,It):(Ct=m,m=It,It=Ct),y.mulTo(It,E[Ut],m)}for(;lt>=0&&!(o[lt]&1<<u);)y.sqrTo(m,It),Ct=m,m=It,It=Ct,--u<0&&(u=this.DB-1,--lt)}return y.revert(m)}function du(o){var c=this.s<0?this.negate():this.clone(),u=o.s<0?o.negate():o.clone();if(c.compareTo(u)<0){var p=c;c=u,u=p}var m=c.getLowestSetBit(),y=u.getLowestSetBit();if(y<0)return c;for(m<y&&(y=m),y>0&&(c.rShiftTo(y,c),u.rShiftTo(y,u));c.signum()>0;)(m=c.getLowestSetBit())>0&&c.rShiftTo(m,c),(m=u.getLowestSetBit())>0&&u.rShiftTo(m,u),c.compareTo(u)>=0?(c.subTo(u,c),c.rShiftTo(1,c)):(u.subTo(c,u),u.rShiftTo(1,u));return y>0&&u.lShiftTo(y,u),u}function mu(o){if(o<=0)return 0;var c=this.DV%o,u=this.s<0?o-1:0;if(this.t>0)if(c==0)u=this[0]%o;else for(var p=this.t-1;p>=0;--p)u=(c*u+this[p])%o;return u}function gu(o){var c=o.isEven();if(this.isEven()&&c||o.signum()==0)return n.ZERO;for(var u=o.clone(),p=this.clone(),m=D(1),y=D(0),E=D(0),x=D(1);u.signum()!=0;){for(;u.isEven();)u.rShiftTo(1,u),c?((!m.isEven()||!y.isEven())&&(m.addTo(this,m),y.subTo(o,y)),m.rShiftTo(1,m)):y.isEven()||y.subTo(o,y),y.rShiftTo(1,y);for(;p.isEven();)p.rShiftTo(1,p),c?((!E.isEven()||!x.isEven())&&(E.addTo(this,E),x.subTo(o,x)),E.rShiftTo(1,E)):x.isEven()||x.subTo(o,x),x.rShiftTo(1,x);u.compareTo(p)>=0?(u.subTo(p,u),c&&m.subTo(E,m),y.subTo(x,y)):(p.subTo(u,p),c&&E.subTo(m,E),x.subTo(y,x))}if(p.compareTo(n.ONE)!=0)return n.ZERO;if(x.compareTo(o)>=0)return x.subtract(o);if(x.signum()<0)x.addTo(o,x);else return x;return x.signum()<0?x.add(o):x}var it=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],yu=(1<<26)/it[it.length-1];function bu(o){var c,u=this.abs();if(u.t==1&&u[0]<=it[it.length-1]){for(c=0;c<it.length;++c)if(u[0]==it[c])return!0;return!1}if(u.isEven())return!1;for(c=1;c<it.length;){for(var p=it[c],m=c+1;m<it.length&&p<yu;)p*=it[m++];for(p=u.modInt(p);c<m;)if(p%it[c++]==0)return!1}return u.millerRabin(o)}function wu(o){var c=this.subtract(n.ONE),u=c.getLowestSetBit();if(u<=0)return!1;var p=c.shiftRight(u);o=o+1>>1,o>it.length&&(o=it.length);for(var m=i(),y=0;y<o;++y){m.fromInt(it[Math.floor(Math.random()*it.length)]);var E=m.modPow(p,this);if(E.compareTo(n.ONE)!=0&&E.compareTo(c)!=0){for(var x=1;x++<u&&E.compareTo(c)!=0;)if(E=E.modPowInt(2,this),E.compareTo(n.ONE)==0)return!1;if(E.compareTo(c)!=0)return!1}}return!0}n.prototype.chunkSize=Ea,n.prototype.toRadix=xa,n.prototype.fromRadix=Sa,n.prototype.fromNumber=Ta,n.prototype.bitwiseTo=Da,n.prototype.changeBit=Va,n.prototype.addTo=Za,n.prototype.dMultiply=eu,n.prototype.dAddOffset=ru,n.prototype.multiplyLowerTo=ou,n.prototype.multiplyUpperTo=cu,n.prototype.modInt=mu,n.prototype.millerRabin=wu,n.prototype.clone=ga,n.prototype.intValue=ya,n.prototype.byteValue=ba,n.prototype.shortValue=wa,n.prototype.signum=va,n.prototype.toByteArray=Aa,n.prototype.equals=Ia,n.prototype.min=Ca,n.prototype.max=ka,n.prototype.and=Ra,n.prototype.or=_a,n.prototype.xor=La,n.prototype.andNot=Na,n.prototype.not=Oa,n.prototype.shiftLeft=Pa,n.prototype.shiftRight=Ma,n.prototype.getLowestSetBit=Fa,n.prototype.bitCount=$a,n.prototype.testBit=za,n.prototype.setBit=Ha,n.prototype.clearBit=Wa,n.prototype.flipBit=qa,n.prototype.add=Ka,n.prototype.subtract=Xa,n.prototype.multiply=Ya,n.prototype.divide=Ja,n.prototype.remainder=Qa,n.prototype.divideAndRemainder=tu,n.prototype.modPow=pu,n.prototype.modInverse=gu,n.prototype.pow=su,n.prototype.gcd=du,n.prototype.isProbablePrime=bu,n.prototype.square=ja,n.prototype.Barrett=se;var fr,ut,q;function Eu(o){ut[q++]^=o&255,ut[q++]^=o>>8&255,ut[q++]^=o>>16&255,ut[q++]^=o>>24&255,q>=yn&&(q-=yn)}function Qi(){Eu(new Date().getTime())}if(ut==null){ut=new Array,q=0;var At;if(typeof window<"u"&&window.crypto){if(window.crypto.getRandomValues){var ts=new Uint8Array(32);for(window.crypto.getRandomValues(ts),At=0;At<32;++At)ut[q++]=ts[At]}else if(navigator.appName=="Netscape"&&navigator.appVersion<"5"){var es=window.crypto.random(32);for(At=0;At<es.length;++At)ut[q++]=es.charCodeAt(At)&255}}for(;q<yn;)At=Math.floor(65536*Math.random()),ut[q++]=At>>>8,ut[q++]=At&255;q=0,Qi()}function vu(){if(fr==null){for(Qi(),fr=Au(),fr.init(ut),q=0;q<ut.length;++q)ut[q]=0;q=0}return fr.next()}function xu(o){var c;for(c=0;c<o.length;++c)o[c]=vu()}function mn(){}mn.prototype.nextBytes=xu;function gn(){this.i=0,this.j=0,this.S=new Array}function Su(o){var c,u,p;for(c=0;c<256;++c)this.S[c]=c;for(u=0,c=0;c<256;++c)u=u+this.S[c]+o[c%o.length]&255,p=this.S[c],this.S[c]=this.S[u],this.S[u]=p;this.i=0,this.j=0}function Tu(){var o;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,o=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=o,this.S[o+this.S[this.i]&255]}gn.prototype.init=Su,gn.prototype.next=Tu;function Au(){return new gn}var yn=256;typeof Qr<"u"?Qr=wc.exports={default:n,BigInteger:n,SecureRandom:mn}:this.jsbn={BigInteger:n,SecureRandom:mn}}).call(Qr)});var ur=B(tn=>{(function(){"use strict";var r={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function t(a){return n(s(a),arguments)}function e(a,l){return t.apply(null,[a].concat(l||[]))}function n(a,l){var f=1,d=a.length,h,g="",w,S,b,k,A,C,D,_;for(w=0;w<d;w++)if(typeof a[w]=="string")g+=a[w];else if(typeof a[w]=="object"){if(b=a[w],b.keys)for(h=l[f],S=0;S<b.keys.length;S++){if(h==null)throw new Error(t('[sprintf] Cannot access property "%s" of undefined value "%s"',b.keys[S],b.keys[S-1]));h=h[b.keys[S]]}else b.param_no?h=l[b.param_no]:h=l[f++];if(r.not_type.test(b.type)&&r.not_primitive.test(b.type)&&h instanceof Function&&(h=h()),r.numeric_arg.test(b.type)&&typeof h!="number"&&isNaN(h))throw new TypeError(t("[sprintf] expecting number but found %T",h));switch(r.number.test(b.type)&&(D=h>=0),b.type){case"b":h=parseInt(h,10).toString(2);break;case"c":h=String.fromCharCode(parseInt(h,10));break;case"d":case"i":h=parseInt(h,10);break;case"j":h=JSON.stringify(h,null,b.width?parseInt(b.width):0);break;case"e":h=b.precision?parseFloat(h).toExponential(b.precision):parseFloat(h).toExponential();break;case"f":h=b.precision?parseFloat(h).toFixed(b.precision):parseFloat(h);break;case"g":h=b.precision?String(Number(h.toPrecision(b.precision))):parseFloat(h);break;case"o":h=(parseInt(h,10)>>>0).toString(8);break;case"s":h=String(h),h=b.precision?h.substring(0,b.precision):h;break;case"t":h=String(!!h),h=b.precision?h.substring(0,b.precision):h;break;case"T":h=Object.prototype.toString.call(h).slice(8,-1).toLowerCase(),h=b.precision?h.substring(0,b.precision):h;break;case"u":h=parseInt(h,10)>>>0;break;case"v":h=h.valueOf(),h=b.precision?h.substring(0,b.precision):h;break;case"x":h=(parseInt(h,10)>>>0).toString(16);break;case"X":h=(parseInt(h,10)>>>0).toString(16).toUpperCase();break}r.json.test(b.type)?g+=h:(r.number.test(b.type)&&(!D||b.sign)?(_=D?"+":"-",h=h.toString().replace(r.sign,"")):_="",A=b.pad_char?b.pad_char==="0"?"0":b.pad_char.charAt(1):" ",C=b.width-(_+h).length,k=b.width&&C>0?A.repeat(C):"",g+=b.align?_+h+k:A==="0"?_+k+h:k+_+h)}return g}var i=Object.create(null);function s(a){if(i[a])return i[a];for(var l=a,f,d=[],h=0;l;){if((f=r.text.exec(l))!==null)d.push(f[0]);else if((f=r.modulo.exec(l))!==null)d.push("%");else if((f=r.placeholder.exec(l))!==null){if(f[2]){h|=1;var g=[],w=f[2],S=[];if((S=r.key.exec(w))!==null)for(g.push(S[1]);(w=w.substring(S[0].length))!=="";)if((S=r.key_access.exec(w))!==null)g.push(S[1]);else if((S=r.index_access.exec(w))!==null)g.push(S[1]);else throw new SyntaxError("[sprintf] failed to parse named argument key");else throw new SyntaxError("[sprintf] failed to parse named argument key");f[2]=g}else h|=2;if(h===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");d.push({placeholder:f[0],param_no:f[1],keys:f[2],sign:f[3],pad_char:f[4],align:f[5],width:f[6],precision:f[7],type:f[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");l=l.substring(f[0].length)}return i[a]=d}typeof tn<"u"&&(tn.sprintf=t,tn.vsprintf=e),typeof window<"u"&&(window.sprintf=t,window.vsprintf=e,typeof define=="function"&&define.amd&&define(function(){return{sprintf:t,vsprintf:e}}))})()});var sn=B((Tg,Bc)=>{Bc.exports=r=>{if(r[Symbol.asyncIterator])return r;if(r.getReader)return async function*(){let t=r.getReader();try{for(;;){let{done:e,value:n}=await t.read();if(e)return;yield n}}finally{t.releaseLock()}}();throw new Error("unknown stream")}});var _c=B((Ag,Rc)=>{Rc.exports=function(t){if(t){if(typeof t[Symbol.iterator]=="function")return t[Symbol.iterator]();if(typeof t[Symbol.asyncIterator]=="function")return t[Symbol.asyncIterator]();if(typeof t.next=="function")return t}throw new Error("argument is not an iterator or iterable")}});var $i=B((Ig,Lc)=>{var kh=_c();Lc.exports=r=>async t=>{t=kh(t);let e=C=>{typeof C.return=="function"&&C.return()},n=null,i=null,s=C=>{n=C,i&&i(C),e(t)},a=null,l=!1,f=()=>{l=!0,a&&a()},d=null,h=!1,g=()=>{h=!0,d&&d()},w=null,S=()=>{w&&w()},b=()=>new Promise((C,D)=>{a=w=C,i=D,r.once("drain",S)}),k=()=>(e(t),new Promise((C,D)=>{if(l||h||n)return C();d=a=C,i=D})),A=()=>{r.removeListener("error",s),r.removeListener("close",f),r.removeListener("finish",g),r.removeListener("drain",S)};r.once("error",s),r.once("close",f),r.once("finish",g);try{for await(let C of t){if(!r.writable||r.destroyed||n)break;r.write(C)===!1&&await b()}}catch(C){n||r.destroy(),n=C}try{if(r.writable&&r.end(),await k(),n)throw n}finally{A()}}});var zi=B((Cg,Nc)=>{var Dh=$i(),Bh=sn();Nc.exports=r=>({sink:Dh(r),source:Bh(r)})});var Pc=B((kg,Oc)=>{var Rh=zi();Oc.exports=r=>async function*(t){let e=Rh(r),n;if(e.sink(t).catch(i=>{n=i}),yield*e.source,n)throw n}});var Mc=B((Dg,Ze)=>{Ze.exports=sn();Ze.exports.source=sn();Ze.exports.sink=$i();Ze.exports.transform=Pc();Ze.exports.duplex=zi()});var Yh={};ft(Yh,{Server:()=>pn,createServer:()=>Xh});var Rn=M(Sn(),1),Vs=M(Os(),1),Hs=M(ce(),1),_n=M(Bn(),1),Ws=M(zs(),1);function Gu(){Hs.default._configure(),Rn.default._configure(Vs.default),_n.default._configure(Ws.default)}Gu();var qs=["uint64","int64","sint64","fixed64","sfixed64"];function $u(r){for(let t of qs){if(r[t]==null)continue;let e=r[t];r[t]=function(){return BigInt(e.call(this).toString())}}return r}function Ln(r){return $u(new Rn.default(r))}function zu(r){for(let t of qs){if(r[t]==null)continue;let e=r[t];r[t]=function(n){return e.call(this,n.toString())}}return r}function Nn(){return zu(_n.default.create())}function $(r,t){let e=Ln(r instanceof Uint8Array?r:r.subarray());return t.decode(e)}function z(r,t){let e=Nn();return t.encode(r,e,{lengthDelimited:!1}),e.finish()}var Ie;(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"})(Ie||(Ie={}));function wr(r,t,e,n){return{name:r,type:t,encode:e,decode:n}}function Gt(r){function t(i){if(r[i.toString()]==null)throw new Error("Invalid enum value");return r[i]}let e=function(s,a){let l=t(s);a.int32(l)},n=function(s){let a=s.int32();return t(a)};return wr("enum",Ie.VARINT,e,n)}function V(r,t){return wr("message",Ie.LENGTH_DELIMITED,r,t)}var wt;(function(r){let t;(function(i){i.IDENTIFY="IDENTIFY",i.CONNECT="CONNECT",i.STREAM_OPEN="STREAM_OPEN",i.STREAM_HANDLER="STREAM_HANDLER",i.DHT="DHT",i.LIST_PEERS="LIST_PEERS",i.CONNMANAGER="CONNMANAGER",i.DISCONNECT="DISCONNECT",i.PUBSUB="PUBSUB",i.PEERSTORE="PEERSTORE"})(t=r.Type||(r.Type={}));let e;(function(i){i[i.IDENTIFY=0]="IDENTIFY",i[i.CONNECT=1]="CONNECT",i[i.STREAM_OPEN=2]="STREAM_OPEN",i[i.STREAM_HANDLER=3]="STREAM_HANDLER",i[i.DHT=4]="DHT",i[i.LIST_PEERS=5]="LIST_PEERS",i[i.CONNMANAGER=6]="CONNMANAGER",i[i.DISCONNECT=7]="DISCONNECT",i[i.PUBSUB=8]="PUBSUB",i[i.PEERSTORE=9]="PEERSTORE"})(e||(e={})),function(i){i.codec=()=>Gt(e)}(t=r.Type||(r.Type={}));let n;r.codec=()=>(n==null&&(n=V((i,s,a={})=>{a.lengthDelimited!==!1&&s.fork(),i.type!=null&&(s.uint32(8),r.Type.codec().encode(i.type,s)),i.connect!=null&&(s.uint32(18),vr.codec().encode(i.connect,s)),i.streamOpen!=null&&(s.uint32(26),xr.codec().encode(i.streamOpen,s)),i.streamHandler!=null&&(s.uint32(34),Sr.codec().encode(i.streamHandler,s)),i.dht!=null&&(s.uint32(42),Et.codec().encode(i.dht,s)),i.connManager!=null&&(s.uint32(50),Ar.codec().encode(i.connManager,s)),i.disconnect!=null&&(s.uint32(58),Ir.codec().encode(i.disconnect,s)),i.pubsub!=null&&(s.uint32(66),$t.codec().encode(i.pubsub,s)),i.peerStore!=null&&(s.uint32(74),le.codec().encode(i.peerStore,s)),a.lengthDelimited!==!1&&s.ldelim()},(i,s)=>{let a={},l=s==null?i.len:i.pos+s;for(;i.pos<l;){let f=i.uint32();switch(f>>>3){case 1:a.type=r.Type.codec().decode(i);break;case 2:a.connect=vr.codec().decode(i,i.uint32());break;case 3:a.streamOpen=xr.codec().decode(i,i.uint32());break;case 4:a.streamHandler=Sr.codec().decode(i,i.uint32());break;case 5:a.dht=Et.codec().decode(i,i.uint32());break;case 6:a.connManager=Ar.codec().decode(i,i.uint32());break;case 7:a.disconnect=Ir.codec().decode(i,i.uint32());break;case 8:a.pubsub=$t.codec().decode(i,i.uint32());break;case 9:a.peerStore=le.codec().decode(i,i.uint32());break;default:i.skipType(f&7);break}}return a})),n),r.encode=i=>z(i,r.codec()),r.decode=i=>$(i,r.codec())})(wt||(wt={}));var ue;(function(r){let t;(function(i){i.OK="OK",i.ERROR="ERROR"})(t=r.Type||(r.Type={}));let e;(function(i){i[i.OK=0]="OK",i[i.ERROR=1]="ERROR"})(e||(e={})),function(i){i.codec=()=>Gt(e)}(t=r.Type||(r.Type={}));let n;r.codec=()=>(n==null&&(n=V((i,s,a={})=>{if(a.lengthDelimited!==!1&&s.fork(),i.type!=null&&(s.uint32(8),r.Type.codec().encode(i.type,s)),i.error!=null&&(s.uint32(18),Tr.codec().encode(i.error,s)),i.streamInfo!=null&&(s.uint32(26),Ce.codec().encode(i.streamInfo,s)),i.identify!=null&&(s.uint32(34),Er.codec().encode(i.identify,s)),i.dht!=null&&(s.uint32(42),X.codec().encode(i.dht,s)),i.peers!=null)for(let l of i.peers)s.uint32(50),Xt.codec().encode(l,s);i.pubsub!=null&&(s.uint32(58),Cr.codec().encode(i.pubsub,s)),i.peerStore!=null&&(s.uint32(66),kr.codec().encode(i.peerStore,s)),a.lengthDelimited!==!1&&s.ldelim()},(i,s)=>{let a={peers:[]},l=s==null?i.len:i.pos+s;for(;i.pos<l;){let f=i.uint32();switch(f>>>3){case 1:a.type=r.Type.codec().decode(i);break;case 2:a.error=Tr.codec().decode(i,i.uint32());break;case 3:a.streamInfo=Ce.codec().decode(i,i.uint32());break;case 4:a.identify=Er.codec().decode(i,i.uint32());break;case 5:a.dht=X.codec().decode(i,i.uint32());break;case 6:a.peers.push(Xt.codec().decode(i,i.uint32()));break;case 7:a.pubsub=Cr.codec().decode(i,i.uint32());break;case 8:a.peerStore=kr.codec().decode(i,i.uint32());break;default:i.skipType(f&7);break}}return a})),n),r.encode=i=>z(i,r.codec()),r.decode=i=>$(i,r.codec())})(ue||(ue={}));var Er;(function(r){let t;r.codec=()=>(t==null&&(t=V((e,n,i={})=>{if(i.lengthDelimited!==!1&&n.fork(),e.id!=null&&e.id.byteLength>0&&(n.uint32(10),n.bytes(e.id)),e.addrs!=null)for(let s of e.addrs)n.uint32(18),n.bytes(s);i.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let i={id:new Uint8Array(0),addrs:[]},s=n==null?e.len:e.pos+n;for(;e.pos<s;){let a=e.uint32();switch(a>>>3){case 1:i.id=e.bytes();break;case 2:i.addrs.push(e.bytes());break;default:e.skipType(a&7);break}}return i})),t),r.encode=e=>z(e,r.codec()),r.decode=e=>$(e,r.codec())})(Er||(Er={}));var vr;(function(r){let t;r.codec=()=>(t==null&&(t=V((e,n,i={})=>{if(i.lengthDelimited!==!1&&n.fork(),e.peer!=null&&e.peer.byteLength>0&&(n.uint32(10),n.bytes(e.peer)),e.addrs!=null)for(let s of e.addrs)n.uint32(18),n.bytes(s);e.timeout!=null&&(n.uint32(24),n.int64(e.timeout)),i.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let i={peer:new Uint8Array(0),addrs:[]},s=n==null?e.len:e.pos+n;for(;e.pos<s;){let a=e.uint32();switch(a>>>3){case 1:i.peer=e.bytes();break;case 2:i.addrs.push(e.bytes());break;case 3:i.timeout=e.int64();break;default:e.skipType(a&7);break}}return i})),t),r.encode=e=>z(e,r.codec()),r.decode=e=>$(e,r.codec())})(vr||(vr={}));var xr;(function(r){let t;r.codec=()=>(t==null&&(t=V((e,n,i={})=>{if(i.lengthDelimited!==!1&&n.fork(),e.peer!=null&&e.peer.byteLength>0&&(n.uint32(10),n.bytes(e.peer)),e.proto!=null)for(let s of e.proto)n.uint32(18),n.string(s);e.timeout!=null&&(n.uint32(24),n.int64(e.timeout)),i.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let i={peer:new Uint8Array(0),proto:[]},s=n==null?e.len:e.pos+n;for(;e.pos<s;){let a=e.uint32();switch(a>>>3){case 1:i.peer=e.bytes();break;case 2:i.proto.push(e.string());break;case 3:i.timeout=e.int64();break;default:e.skipType(a&7);break}}return i})),t),r.encode=e=>z(e,r.codec()),r.decode=e=>$(e,r.codec())})(xr||(xr={}));var Sr;(function(r){let t;r.codec=()=>(t==null&&(t=V((e,n,i={})=>{if(i.lengthDelimited!==!1&&n.fork(),e.addr!=null&&e.addr.byteLength>0&&(n.uint32(10),n.bytes(e.addr)),e.proto!=null)for(let s of e.proto)n.uint32(18),n.string(s);i.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let i={addr:new Uint8Array(0),proto:[]},s=n==null?e.len:e.pos+n;for(;e.pos<s;){let a=e.uint32();switch(a>>>3){case 1:i.addr=e.bytes();break;case 2:i.proto.push(e.string());break;default:e.skipType(a&7);break}}return i})),t),r.encode=e=>z(e,r.codec()),r.decode=e=>$(e,r.codec())})(Sr||(Sr={}));var Tr;(function(r){let t;r.codec=()=>(t==null&&(t=V((e,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),e.msg!=null&&e.msg!==""&&(n.uint32(10),n.string(e.msg)),i.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let i={msg:""},s=n==null?e.len:e.pos+n;for(;e.pos<s;){let a=e.uint32();switch(a>>>3){case 1:i.msg=e.string();break;default:e.skipType(a&7);break}}return i})),t),r.encode=e=>z(e,r.codec()),r.decode=e=>$(e,r.codec())})(Tr||(Tr={}));var Ce;(function(r){let t;r.codec=()=>(t==null&&(t=V((e,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),e.peer!=null&&e.peer.byteLength>0&&(n.uint32(10),n.bytes(e.peer)),e.addr!=null&&e.addr.byteLength>0&&(n.uint32(18),n.bytes(e.addr)),e.proto!=null&&e.proto!==""&&(n.uint32(26),n.string(e.proto)),i.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let i={peer:new Uint8Array(0),addr:new Uint8Array(0),proto:""},s=n==null?e.len:e.pos+n;for(;e.pos<s;){let a=e.uint32();switch(a>>>3){case 1:i.peer=e.bytes();break;case 2:i.addr=e.bytes();break;case 3:i.proto=e.string();break;default:e.skipType(a&7);break}}return i})),t),r.encode=e=>z(e,r.codec()),r.decode=e=>$(e,r.codec())})(Ce||(Ce={}));var Et;(function(r){let t;(function(i){i.FIND_PEER="FIND_PEER",i.FIND_PEERS_CONNECTED_TO_PEER="FIND_PEERS_CONNECTED_TO_PEER",i.FIND_PROVIDERS="FIND_PROVIDERS",i.GET_CLOSEST_PEERS="GET_CLOSEST_PEERS",i.GET_PUBLIC_KEY="GET_PUBLIC_KEY",i.GET_VALUE="GET_VALUE",i.SEARCH_VALUE="SEARCH_VALUE",i.PUT_VALUE="PUT_VALUE",i.PROVIDE="PROVIDE"})(t=r.Type||(r.Type={}));let e;(function(i){i[i.FIND_PEER=0]="FIND_PEER",i[i.FIND_PEERS_CONNECTED_TO_PEER=1]="FIND_PEERS_CONNECTED_TO_PEER",i[i.FIND_PROVIDERS=2]="FIND_PROVIDERS",i[i.GET_CLOSEST_PEERS=3]="GET_CLOSEST_PEERS",i[i.GET_PUBLIC_KEY=4]="GET_PUBLIC_KEY",i[i.GET_VALUE=5]="GET_VALUE",i[i.SEARCH_VALUE=6]="SEARCH_VALUE",i[i.PUT_VALUE=7]="PUT_VALUE",i[i.PROVIDE=8]="PROVIDE"})(e||(e={})),function(i){i.codec=()=>Gt(e)}(t=r.Type||(r.Type={}));let n;r.codec=()=>(n==null&&(n=V((i,s,a={})=>{a.lengthDelimited!==!1&&s.fork(),i.type!=null&&(s.uint32(8),r.Type.codec().encode(i.type,s)),i.peer!=null&&(s.uint32(18),s.bytes(i.peer)),i.cid!=null&&(s.uint32(26),s.bytes(i.cid)),i.key!=null&&(s.uint32(34),s.bytes(i.key)),i.value!=null&&(s.uint32(42),s.bytes(i.value)),i.count!=null&&(s.uint32(48),s.int32(i.count)),i.timeout!=null&&(s.uint32(56),s.int64(i.timeout)),a.lengthDelimited!==!1&&s.ldelim()},(i,s)=>{let a={},l=s==null?i.len:i.pos+s;for(;i.pos<l;){let f=i.uint32();switch(f>>>3){case 1:a.type=r.Type.codec().decode(i);break;case 2:a.peer=i.bytes();break;case 3:a.cid=i.bytes();break;case 4:a.key=i.bytes();break;case 5:a.value=i.bytes();break;case 6:a.count=i.int32();break;case 7:a.timeout=i.int64();break;default:i.skipType(f&7);break}}return a})),n),r.encode=i=>z(i,r.codec()),r.decode=i=>$(i,r.codec())})(Et||(Et={}));var X;(function(r){let t;(function(i){i.BEGIN="BEGIN",i.VALUE="VALUE",i.END="END"})(t=r.Type||(r.Type={}));let e;(function(i){i[i.BEGIN=0]="BEGIN",i[i.VALUE=1]="VALUE",i[i.END=2]="END"})(e||(e={})),function(i){i.codec=()=>Gt(e)}(t=r.Type||(r.Type={}));let n;r.codec=()=>(n==null&&(n=V((i,s,a={})=>{a.lengthDelimited!==!1&&s.fork(),i.type!=null&&(s.uint32(8),r.Type.codec().encode(i.type,s)),i.peer!=null&&(s.uint32(18),Xt.codec().encode(i.peer,s)),i.value!=null&&(s.uint32(26),s.bytes(i.value)),a.lengthDelimited!==!1&&s.ldelim()},(i,s)=>{let a={},l=s==null?i.len:i.pos+s;for(;i.pos<l;){let f=i.uint32();switch(f>>>3){case 1:a.type=r.Type.codec().decode(i);break;case 2:a.peer=Xt.codec().decode(i,i.uint32());break;case 3:a.value=i.bytes();break;default:i.skipType(f&7);break}}return a})),n),r.encode=i=>z(i,r.codec()),r.decode=i=>$(i,r.codec())})(X||(X={}));var Xt;(function(r){let t;r.codec=()=>(t==null&&(t=V((e,n,i={})=>{if(i.lengthDelimited!==!1&&n.fork(),e.id!=null&&e.id.byteLength>0&&(n.uint32(10),n.bytes(e.id)),e.addrs!=null)for(let s of e.addrs)n.uint32(18),n.bytes(s);i.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let i={id:new Uint8Array(0),addrs:[]},s=n==null?e.len:e.pos+n;for(;e.pos<s;){let a=e.uint32();switch(a>>>3){case 1:i.id=e.bytes();break;case 2:i.addrs.push(e.bytes());break;default:e.skipType(a&7);break}}return i})),t),r.encode=e=>z(e,r.codec()),r.decode=e=>$(e,r.codec())})(Xt||(Xt={}));var Ar;(function(r){let t;(function(i){i.TAG_PEER="TAG_PEER",i.UNTAG_PEER="UNTAG_PEER",i.TRIM="TRIM"})(t=r.Type||(r.Type={}));let e;(function(i){i[i.TAG_PEER=0]="TAG_PEER",i[i.UNTAG_PEER=1]="UNTAG_PEER",i[i.TRIM=2]="TRIM"})(e||(e={})),function(i){i.codec=()=>Gt(e)}(t=r.Type||(r.Type={}));let n;r.codec=()=>(n==null&&(n=V((i,s,a={})=>{a.lengthDelimited!==!1&&s.fork(),i.type!=null&&(s.uint32(8),r.Type.codec().encode(i.type,s)),i.peer!=null&&(s.uint32(18),s.bytes(i.peer)),i.tag!=null&&(s.uint32(26),s.string(i.tag)),i.weight!=null&&(s.uint32(32),s.int64(i.weight)),a.lengthDelimited!==!1&&s.ldelim()},(i,s)=>{let a={},l=s==null?i.len:i.pos+s;for(;i.pos<l;){let f=i.uint32();switch(f>>>3){case 1:a.type=r.Type.codec().decode(i);break;case 2:a.peer=i.bytes();break;case 3:a.tag=i.string();break;case 4:a.weight=i.int64();break;default:i.skipType(f&7);break}}return a})),n),r.encode=i=>z(i,r.codec()),r.decode=i=>$(i,r.codec())})(Ar||(Ar={}));var Ir;(function(r){let t;r.codec=()=>(t==null&&(t=V((e,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),e.peer!=null&&e.peer.byteLength>0&&(n.uint32(10),n.bytes(e.peer)),i.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let i={peer:new Uint8Array(0)},s=n==null?e.len:e.pos+n;for(;e.pos<s;){let a=e.uint32();switch(a>>>3){case 1:i.peer=e.bytes();break;default:e.skipType(a&7);break}}return i})),t),r.encode=e=>z(e,r.codec()),r.decode=e=>$(e,r.codec())})(Ir||(Ir={}));var $t;(function(r){let t;(function(i){i.GET_TOPICS="GET_TOPICS",i.LIST_PEERS="LIST_PEERS",i.PUBLISH="PUBLISH",i.SUBSCRIBE="SUBSCRIBE"})(t=r.Type||(r.Type={}));let e;(function(i){i[i.GET_TOPICS=0]="GET_TOPICS",i[i.LIST_PEERS=1]="LIST_PEERS",i[i.PUBLISH=2]="PUBLISH",i[i.SUBSCRIBE=3]="SUBSCRIBE"})(e||(e={})),function(i){i.codec=()=>Gt(e)}(t=r.Type||(r.Type={}));let n;r.codec=()=>(n==null&&(n=V((i,s,a={})=>{a.lengthDelimited!==!1&&s.fork(),i.type!=null&&(s.uint32(8),r.Type.codec().encode(i.type,s)),i.topic!=null&&(s.uint32(18),s.string(i.topic)),i.data!=null&&(s.uint32(26),s.bytes(i.data)),a.lengthDelimited!==!1&&s.ldelim()},(i,s)=>{let a={},l=s==null?i.len:i.pos+s;for(;i.pos<l;){let f=i.uint32();switch(f>>>3){case 1:a.type=r.Type.codec().decode(i);break;case 2:a.topic=i.string();break;case 3:a.data=i.bytes();break;default:i.skipType(f&7);break}}return a})),n),r.encode=i=>z(i,r.codec()),r.decode=i=>$(i,r.codec())})($t||($t={}));var Je;(function(r){let t;r.codec=()=>(t==null&&(t=V((e,n,i={})=>{if(i.lengthDelimited!==!1&&n.fork(),e.from!=null&&(n.uint32(10),n.bytes(e.from)),e.data!=null&&(n.uint32(18),n.bytes(e.data)),e.seqno!=null&&(n.uint32(26),n.bytes(e.seqno)),e.topicIDs!=null)for(let s of e.topicIDs)n.uint32(34),n.string(s);e.signature!=null&&(n.uint32(42),n.bytes(e.signature)),e.key!=null&&(n.uint32(50),n.bytes(e.key)),i.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let i={topicIDs:[]},s=n==null?e.len:e.pos+n;for(;e.pos<s;){let a=e.uint32();switch(a>>>3){case 1:i.from=e.bytes();break;case 2:i.data=e.bytes();break;case 3:i.seqno=e.bytes();break;case 4:i.topicIDs.push(e.string());break;case 5:i.signature=e.bytes();break;case 6:i.key=e.bytes();break;default:e.skipType(a&7);break}}return i})),t),r.encode=e=>z(e,r.codec()),r.decode=e=>$(e,r.codec())})(Je||(Je={}));var Cr;(function(r){let t;r.codec=()=>(t==null&&(t=V((e,n,i={})=>{if(i.lengthDelimited!==!1&&n.fork(),e.topics!=null)for(let s of e.topics)n.uint32(10),n.string(s);if(e.peerIDs!=null)for(let s of e.peerIDs)n.uint32(18),n.bytes(s);i.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let i={topics:[],peerIDs:[]},s=n==null?e.len:e.pos+n;for(;e.pos<s;){let a=e.uint32();switch(a>>>3){case 1:i.topics.push(e.string());break;case 2:i.peerIDs.push(e.bytes());break;default:e.skipType(a&7);break}}return i})),t),r.encode=e=>z(e,r.codec()),r.decode=e=>$(e,r.codec())})(Cr||(Cr={}));var le;(function(r){let t;(function(i){i.UNSPECIFIED="UNSPECIFIED",i.GET_PROTOCOLS="GET_PROTOCOLS",i.GET_PEER_INFO="GET_PEER_INFO"})(t=r.Type||(r.Type={}));let e;(function(i){i[i.UNSPECIFIED=0]="UNSPECIFIED",i[i.GET_PROTOCOLS=1]="GET_PROTOCOLS",i[i.GET_PEER_INFO=2]="GET_PEER_INFO"})(e||(e={})),function(i){i.codec=()=>Gt(e)}(t=r.Type||(r.Type={}));let n;r.codec=()=>(n==null&&(n=V((i,s,a={})=>{if(a.lengthDelimited!==!1&&s.fork(),i.type!=null&&(s.uint32(8),r.Type.codec().encode(i.type,s)),i.id!=null&&(s.uint32(18),s.bytes(i.id)),i.protos!=null)for(let l of i.protos)s.uint32(26),s.string(l);a.lengthDelimited!==!1&&s.ldelim()},(i,s)=>{let a={protos:[]},l=s==null?i.len:i.pos+s;for(;i.pos<l;){let f=i.uint32();switch(f>>>3){case 1:a.type=r.Type.codec().decode(i);break;case 2:a.id=i.bytes();break;case 3:a.protos.push(i.string());break;default:i.skipType(f&7);break}}return a})),n),r.encode=i=>z(i,r.codec()),r.decode=i=>$(i,r.codec())})(le||(le={}));var kr;(function(r){let t;r.codec=()=>(t==null&&(t=V((e,n,i={})=>{if(i.lengthDelimited!==!1&&n.fork(),e.peer!=null&&(n.uint32(10),Xt.codec().encode(e.peer,n)),e.protos!=null)for(let s of e.protos)n.uint32(18),n.string(s);i.lengthDelimited!==!1&&n.ldelim()},(e,n)=>{let i={protos:[]},s=n==null?e.len:e.pos+n;for(;e.pos<s;){let a=e.uint32();switch(a>>>3){case 1:i.peer=Xt.codec().decode(e,e.uint32());break;case 2:i.protos.push(e.string());break;default:e.skipType(a&7);break}}return i})),t),r.encode=e=>z(e,r.codec()),r.decode=e=>$(e,r.codec())})(kr||(kr={}));var pt=M(no(),1);var zn={};ft(zn,{base32:()=>Rt,base32hex:()=>El,base32hexpad:()=>xl,base32hexpadupper:()=>Sl,base32hexupper:()=>vl,base32pad:()=>bl,base32padupper:()=>wl,base32upper:()=>yl,base32z:()=>Tl});function hl(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 s=r.charAt(i),a=s.charCodeAt(0);if(e[a]!==255)throw new TypeError(s+" is ambiguous");e[a]=i}var l=r.length,f=r.charAt(0),d=Math.log(l)/Math.log(256),h=Math.log(256)/Math.log(l);function g(b){if(b instanceof Uint8Array||(ArrayBuffer.isView(b)?b=new Uint8Array(b.buffer,b.byteOffset,b.byteLength):Array.isArray(b)&&(b=Uint8Array.from(b))),!(b instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(b.length===0)return"";for(var k=0,A=0,C=0,D=b.length;C!==D&&b[C]===0;)C++,k++;for(var _=(D-C)*h+1>>>0,G=new Uint8Array(_);C!==D;){for(var rt=b[C],st=0,nt=_-1;(rt!==0||st<A)&&nt!==-1;nt--,st++)rt+=256*G[nt]>>>0,G[nt]=rt%l>>>0,rt=rt/l>>>0;if(rt!==0)throw new Error("Non-zero carry");A=st,C++}for(var ot=_-A;ot!==_&&G[ot]===0;)ot++;for(var Tt=f.repeat(k);ot<_;++ot)Tt+=r.charAt(G[ot]);return Tt}function w(b){if(typeof b!="string")throw new TypeError("Expected String");if(b.length===0)return new Uint8Array;var k=0;if(b[k]!==" "){for(var A=0,C=0;b[k]===f;)A++,k++;for(var D=(b.length-k)*d+1>>>0,_=new Uint8Array(D);b[k];){var G=e[b.charCodeAt(k)];if(G===255)return;for(var rt=0,st=D-1;(G!==0||rt<C)&&st!==-1;st--,rt++)G+=l*_[st]>>>0,_[st]=G%256>>>0,G=G/256>>>0;if(G!==0)throw new Error("Non-zero carry");C=rt,k++}if(b[k]!==" "){for(var nt=D-C;nt!==D&&_[nt]===0;)nt++;for(var ot=new Uint8Array(A+(D-nt)),Tt=A;nt!==D;)ot[Tt++]=_[nt++];return ot}}}function S(b){var k=w(b);if(k)return k;throw new Error(`Non-${t} character`)}return{encode:g,decodeUnsafe:w,decode:S}}var pl=hl,dl=pl,io=dl;var Np=new Uint8Array(0);var so=(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},vt=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 oo=r=>new TextEncoder().encode(r),co=r=>new TextDecoder().decode(r);var Un=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")}},Fn=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 uo(this,t)}},Gn=class{constructor(t){this.decoders=t}or(t){return uo(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`)}},uo=(r,t)=>new Gn({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}}),$n=class{constructor(t,e,n,i){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=i,this.encoder=new Un(t,e,n),this.decoder=new Fn(t,e,i)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}},_e=({name:r,prefix:t,encode:e,decode:n})=>new $n(r,t,e,n),Yt=({prefix:r,name:t,alphabet:e})=>{let{encode:n,decode:i}=io(e,t);return _e({prefix:r,name:t,encode:n,decode:s=>vt(i(s))})},ml=(r,t,e,n)=>{let i={};for(let h=0;h<t.length;++h)i[t[h]]=h;let s=r.length;for(;r[s-1]==="=";)--s;let a=new Uint8Array(s*e/8|0),l=0,f=0,d=0;for(let h=0;h<s;++h){let g=i[r[h]];if(g===void 0)throw new SyntaxError(`Non-${n} character`);f=f<<e|g,l+=e,l>=8&&(l-=8,a[d++]=255&f>>l)}if(l>=e||255&f<<8-l)throw new SyntaxError("Unexpected end of data");return a},gl=(r,t,e)=>{let n=t[t.length-1]==="=",i=(1<<e)-1,s="",a=0,l=0;for(let f=0;f<r.length;++f)for(l=l<<8|r[f],a+=8;a>e;)a-=e,s+=t[i&l>>a];if(a&&(s+=t[i&l<<e-a]),n)for(;s.length*e&7;)s+="=";return s},P=({name:r,prefix:t,bitsPerChar:e,alphabet:n})=>_e({prefix:t,name:r,encode(i){return gl(i,n,e)},decode(i){return ml(i,n,e,r)}});var Rt=P({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),yl=P({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),bl=P({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),wl=P({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),El=P({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),vl=P({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),xl=P({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Sl=P({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Tl=P({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Vn={};ft(Vn,{base58btc:()=>H,base58flickr:()=>Al});var H=Yt({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Al=Yt({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Wn={};ft(Wn,{base64:()=>Hn,base64pad:()=>Il,base64url:()=>Cl,base64urlpad:()=>kl});var Hn=P({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Il=P({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Cl=P({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),kl=P({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});pt.default.formatters.b=r=>r==null?"undefined":H.baseEncode(r);pt.default.formatters.t=r=>r==null?"undefined":Rt.baseEncode(r);pt.default.formatters.m=r=>r==null?"undefined":Hn.baseEncode(r);pt.default.formatters.p=r=>r==null?"undefined":r.toString();pt.default.formatters.c=r=>r==null?"undefined":r.toString();pt.default.formatters.k=r=>r==null?"undefined":r.toString();pt.default.formatters.a=r=>r==null?"undefined":r.toString();function Dl(r){let t=()=>{};return t.enabled=!1,t.color="",t.diff=0,t.log=()=>{},t.namespace=r,t.destroy=()=>!0,t.extend=()=>t,t}function J(r){let t=Dl(`${r}:trace`);return pt.default.enabled(`${r}:trace`)&&pt.default.names.map(e=>e.toString()).find(e=>e.includes(":trace"))!=null&&(t=(0,pt.default)(`${r}:trace`)),Object.assign((0,pt.default)(r),{error:(0,pt.default)(`${r}:error`),trace:t})}function he(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function zt(r=0){return globalThis.Buffer?.alloc!=null?he(globalThis.Buffer.alloc(r)):new Uint8Array(r)}function _t(r=0){return globalThis.Buffer?.allocUnsafe!=null?he(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function xt(r,t){t==null&&(t=r.reduce((i,s)=>i+s.length,0));let e=_t(t),n=0;for(let i of r)e.set(i,n),n+=i.length;return he(e)}function pe(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 fo=Symbol.for("@achingbrain/uint8arraylist");function lo(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 Lr(r){return!!r?.[fo]}var Ot=class r{constructor(...t){Object.defineProperty(this,fo,{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(Lr(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(Lr(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=lo(this.bufs,t);return e.buf[e.index]}set(t,e){let n=lo(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(Lr(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 xt(n,i)}subarray(t,e){let{bufs:n,length:i}=this._subList(t,e);return n.length===1?n[0]:xt(n,i)}sublist(t,e){let{bufs:n,length:i}=this._subList(t,e),s=new r;return s.length=i,s.bufs=n,s}_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 s=0;s<this.bufs.length;s++){let a=this.bufs[s],l=i,f=l+a.byteLength;if(i=f,t>=f)continue;let d=t>=l&&t<f,h=e>l&&e<=f;if(d&&h){if(t===l&&e===f){n.push(a);break}let g=t-l;n.push(a.subarray(g,g+(e-t)));break}if(d){if(t===0){n.push(a);continue}n.push(a.subarray(t-l));continue}if(h){if(e===f){n.push(a);break}n.push(a.subarray(0,e-l));break}n.push(a)}return{bufs:n,length:e-t}}indexOf(t,e=0){if(!Lr(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 s=256,a=new Int32Array(s);for(let g=0;g<s;g++)a[g]=-1;for(let g=0;g<i;g++)a[n[g]]=g;let l=a,f=this.byteLength-n.byteLength,d=n.byteLength-1,h;for(let g=e;g<=f;g+=h){h=0;for(let w=d;w>=0;w--){let S=this.get(g+w);if(n[w]!==S){h=Math.max(1,w-l[S]);break}}if(h===0)return g}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=_t(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=zt(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=zt(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=zt(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=_t(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=zt(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=zt(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=zt(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=zt(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=zt(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(!pe(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,s)=>i+s.byteLength,0)),n.length=e,n}};function ho(r){let t=async function*(){let e=yield,n=new Ot;for await(let i of r){if(e==null){n.append(i),e=yield n,n=new Ot;continue}for(n.append(i);n.length>=e;){let s=n.sublist(0,e);if(n.consume(e),e=yield s,e==null){n.length>0&&(e=yield n,n=new Ot);break}}}if(e!=null)throw Object.assign(new Error(`stream ended before ${e} bytes became available`),{code:"ERR_UNDER_READ",buffer:n})}();return t.next(),t}function Le(){let r={};return r.promise=new Promise((t,e)=>{r.resolve=t,r.reject=e}),r}var Nr=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}},Ne=class{size;hwm;head;tail;constructor(t={}){this.hwm=t.splitLimit??16,this.head=new Nr(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 Nr(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 qn=class extends Error{type;code;constructor(t,e){super(t??"The operation was aborted"),this.type="aborted",this.code=e??"ABORT_ERR"}};function jt(r={}){return Bl(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 Bl(r,t){t=t??{};let e=t.onEnd,n=new Ne,i,s,a,l=Le(),f=async()=>{try{return n.isEmpty()?a?{done:!0}:await new Promise((A,C)=>{s=D=>{s=null,n.push(D);try{A(r(n))}catch(_){C(_)}return i}}):r(n)}finally{n.isEmpty()&&queueMicrotask(()=>{l.resolve(),l=Le()})}},d=A=>s!=null?s(A):(n.push(A),i),h=A=>(n=new Ne,s!=null?s({error:A}):(n.push({error:A}),i)),g=A=>{if(a)return i;if(t?.objectMode!==!0&&A?.byteLength==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return d({done:!1,value:A})},w=A=>a?i:(a=!0,A!=null?h(A):d({done:!0})),S=()=>(n=new Ne,w(),{done:!0}),b=A=>(w(A),{done:!0});if(i={[Symbol.asyncIterator](){return this},next:f,return:S,throw:b,push:g,end:w,get readableLength(){return n.size},onEmpty:async A=>{let C=A?.signal;if(C?.throwIfAborted(),n.isEmpty())return;let D,_;C!=null&&(D=new Promise((G,rt)=>{_=()=>{rt(new qn)},C.addEventListener("abort",_)}));try{await Promise.race([l.promise,D])}finally{_!=null&&C!=null&&C?.removeEventListener("abort",_)}}},e==null)return i;let k=i;return i={[Symbol.asyncIterator](){return this},next(){return k.next()},throw(A){return k.throw(A),e!=null&&(e(A),e=void 0),{done:!0}},return(){return k.return(),e!=null&&(e(),e=void 0),{done:!0}},push:g,end(A){return k.end(A),e!=null&&(e(A),e=void 0),i},get readableLength(){return k.readableLength}},i}function po(r){let t=jt(),e=ho(r.source),n=Le(),i,s=r.sink(async function*(){yield*t,yield*await n.promise}());return s.catch(l=>{i=l}),{reader:e,writer:t,stream:{sink:async l=>{if(i!=null){await Promise.reject(i);return}n.resolve(l),await s},source:e},rest:()=>t.end(),write:t.push,read:async()=>{let l=await e.next();if(l.value!=null)return l.value}}}function Or(r){return r instanceof Uint8Array?{get(t){return r[t]},set(t,e){r[t]=e}}:{get(t){return r.get(t)},set(t,e){r.set(t,e)}}}var mo=4294967296,Qe=class r{constructor(t=0,e=0){this.hi=t,this.lo=e}toBigInt(t){if(t===!0)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)}toNumber(t){return Number(this.toBigInt(t))}zzDecode(){let t=-(this.lo&1),e=((this.lo>>>1|this.hi<<31)^t)>>>0,n=(this.hi>>>1^t)>>>0;return new r(n,e)}zzEncode(){let t=this.hi>>31,e=((this.hi<<1|this.lo>>>31)^t)>>>0,n=(this.lo<<1^t)>>>0;return new r(e,n)}toBytes(t,e=0){let n=Or(t);for(;this.hi>0;)n.set(e++,this.lo&127|128),this.lo=(this.lo>>>7|this.hi<<25)>>>0,this.hi>>>=7;for(;this.lo>127;)n.set(e++,this.lo&127|128),this.lo=this.lo>>>7;n.set(e++,this.lo)}static fromBigInt(t){if(t===0n)return new r;let e=t<0;e&&(t=-t);let n=Number(t>>32n)|0,i=Number(t-(BigInt(n)<<32n))|0;return e&&(n=~n>>>0,i=~i>>>0,++i>mo&&(i=0,++n>mo&&(n=0))),new r(n,i)}static fromNumber(t){if(t===0)return new r;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(i,n)}static fromBytes(t,e=0){let n=Or(t),i=new r,s=0;if(t.length-e>4){for(;s<4;++s)if(i.lo=(i.lo|(n.get(e)&127)<<s*7)>>>0,n.get(e++)<128)return i;if(i.lo=(i.lo|(n.get(e)&127)<<28)>>>0,i.hi=(i.hi|(n.get(e)&127)>>4)>>>0,n.get(e++)<128)return i;s=0}else for(;s<4;++s){if(e>=t.length)throw RangeError(`index out of range: ${e} > ${t.length}`);if(i.lo=(i.lo|(n.get(e)&127)<<s*7)>>>0,n.get(e++)<128)return i}if(t.length-e>4){for(;s<5;++s)if(i.hi=(i.hi|(n.get(e)&127)<<s*7+3)>>>0,n.get(e++)<128)return i}else if(e<t.byteLength)for(;s<5;++s){if(e>=t.length)throw RangeError(`index out of range: ${e} > ${t.length}`);if(i.hi=(i.hi|(n.get(e)&127)<<s*7+3)>>>0,n.get(e++)<128)return i}throw RangeError("invalid varint encoding")}};var Rl=Math.pow(2,7),_l=Math.pow(2,14),Ll=Math.pow(2,21),Nl=Math.pow(2,28),Ol=Math.pow(2,35),Pl=Math.pow(2,42),Ml=Math.pow(2,49),Ul=Math.pow(2,56),Fl=Math.pow(2,63),de={encodingLength(r){return r<Rl?1:r<_l?2:r<Ll?3:r<Nl?4:r<Ol?5:r<Pl?6:r<Ml?7:r<Ul?8:r<Fl?9:10},encode(r,t,e=0){if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return t==null&&(t=_t(de.encodingLength(r))),Qe.fromNumber(r).toBytes(t,e),t},decode(r,t=0){return Qe.fromBytes(r,t).toNumber(!0)}};function Pr(r){return r[Symbol.asyncIterator]!=null}var Mr=r=>{let t=de.encodingLength(r),e=_t(t);return de.encode(r,e),Mr.bytes=t,e};Mr.bytes=0;function Oe(r,t){t=t??{};let e=t.lengthEncoder??Mr;function*n(i){let s=e(i.byteLength);s instanceof Uint8Array?yield s:yield*s,i instanceof Uint8Array?yield i:yield*i}return Pr(r)?async function*(){for await(let i of r)yield*n(i)}():function*(){for(let i of r)yield*n(i)}()}Oe.single=(r,t)=>{t=t??{};let e=t.lengthEncoder??Mr;return new Ot(e(r.byteLength),r)};var Pe=M(bo(),1);var $l=8,zl=1024*1024*4,me;(function(r){r[r.LENGTH=0]="LENGTH",r[r.DATA=1]="DATA"})(me||(me={}));var Zn=r=>{let t=de.decode(r);return Zn.bytes=de.encodingLength(t),t};Zn.bytes=0;function tr(r,t){let e=new Ot,n=me.LENGTH,i=-1,s=t?.lengthDecoder??Zn,a=t?.maxLengthLength??$l,l=t?.maxDataLength??zl;function*f(){for(;e.byteLength>0;){if(n===me.LENGTH)try{if(i=s(e),i<0)throw(0,Pe.default)(new Error("invalid message length"),"ERR_INVALID_MSG_LENGTH");if(i>l)throw(0,Pe.default)(new Error("message length too long"),"ERR_MSG_DATA_TOO_LONG");let d=s.bytes;e.consume(d),t?.onLength!=null&&t.onLength(i),n=me.DATA}catch(d){if(d instanceof RangeError){if(e.byteLength>a)throw(0,Pe.default)(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG");break}throw d}if(n===me.DATA){if(e.byteLength<i)break;let d=e.sublist(0,i);e.consume(i),t?.onData!=null&&t.onData(d),yield d,n=me.LENGTH}}}return Pr(r)?async function*(){for await(let d of r)e.append(d),yield*f();if(e.byteLength>0)throw(0,Pe.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}():function*(){for(let d of r)e.append(d),yield*f();if(e.byteLength>0)throw(0,Pe.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}()}tr.fromReader=(r,t)=>{let e=1,n=async function*(){for(;;)try{let{done:s,value:a}=await r.next(e);if(s===!0)return;a!=null&&(yield a)}catch(s){if(s.code==="ERR_UNDER_READ")return{done:!0,value:null};throw s}finally{e=1}}();return tr(n,{...t??{},onLength:s=>{e=s}})};var Kn=J("libp2p:daemon-protocol:stream-handler"),Ur=class{stream;shake;decoder;constructor(t){let{stream:e,maxLength:n}=t;this.stream=e,this.shake=po(this.stream),this.decoder=tr.fromReader(this.shake.reader,{maxDataLength:n??4096})}async read(){let t=await this.decoder.next();if(t.value!=null)return t.value.subarray();Kn("read received no value, closing stream"),await this.close()}write(t){Kn("write message"),this.shake.write(Oe.single(t).subarray())}rest(){return this.shake.rest(),this.shake.stream}async close(){Kn("closing the stream"),await this.rest().sink([])}};var Xn={upgradeInbound:async r=>r,upgradeOutbound:async r=>r};var Me=class r extends Error{code;type;constructor(t="The operation was aborted"){super(t),this.code=r.code,this.type=r.type}static code="ABORT_ERR";static type="aborted"},St=class extends Error{code;props;constructor(t,e,n){super(t),this.code=e,this.name=n?.name??"CodeError",this.props=n??{}}};var Eo=Symbol.for("@libp2p/peer-id");var Yn={};ft(Yn,{identity:()=>Vl});var Vl=_e({prefix:"\0",name:"identity",encode:r=>co(r),decode:r=>oo(r)});var jn={};ft(jn,{base2:()=>Hl});var Hl=P({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Jn={};ft(Jn,{base8:()=>Wl});var Wl=P({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Qn={};ft(Qn,{base10:()=>ql});var ql=Yt({prefix:"9",name:"base10",alphabet:"0123456789"});var ti={};ft(ti,{base16:()=>Zl,base16upper:()=>Kl});var Zl=P({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Kl=P({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var ei={};ft(ei,{base36:()=>Xl,base36upper:()=>Yl});var Xl=Yt({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Yl=Yt({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var ri={};ft(ri,{base256emoji:()=>ef});var vo=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}"),jl=vo.reduce((r,t,e)=>(r[e]=t,r),[]),Jl=vo.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function Ql(r){return r.reduce((t,e)=>(t+=jl[e],t),"")}function tf(r){let t=[];for(let e of r){let n=Jl[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}var ef=_e({prefix:"\u{1F680}",name:"base256emoji",encode:Ql,decode:tf});var ci={};ft(ci,{sha256:()=>Gr,sha512:()=>vf});var oi=M(Ft("crypto"),1);var rf=To,xo=128,nf=127,sf=~nf,of=Math.pow(2,31);function To(r,t,e){t=t||[],e=e||0;for(var n=e;r>=of;)t[e++]=r&255|xo,r/=128;for(;r&sf;)t[e++]=r&255|xo,r>>>=7;return t[e]=r|0,To.bytes=e-n+1,t}var cf=ni,af=128,So=127;function ni(r,n){var e=0,n=n||0,i=0,s=n,a,l=r.length;do{if(s>=l)throw ni.bytes=0,new RangeError("Could not decode varint");a=r[s++],e+=i<28?(a&So)<<i:(a&So)*Math.pow(2,i),i+=7}while(a>=af);return ni.bytes=s-n,e}var uf=Math.pow(2,7),lf=Math.pow(2,14),ff=Math.pow(2,21),hf=Math.pow(2,28),pf=Math.pow(2,35),df=Math.pow(2,42),mf=Math.pow(2,49),gf=Math.pow(2,56),yf=Math.pow(2,63),bf=function(r){return r<uf?1:r<lf?2:r<ff?3:r<hf?4:r<pf?5:r<df?6:r<mf?7:r<gf?8:r<yf?9:10},wf={encode:rf,decode:cf,encodingLength:bf},Ef=wf,er=Ef;var rr=(r,t=0)=>[er.decode(r,t),er.decode.bytes],Ue=(r,t,e=0)=>(er.encode(r,t,e),t),Fe=r=>er.encodingLength(r);var Jt=(r,t)=>{let e=t.byteLength,n=Fe(r),i=n+Fe(e),s=new Uint8Array(i+e);return Ue(r,s,0),Ue(e,s,n),s.set(t,i),new Ge(r,e,t,s)},ge=r=>{let t=vt(r),[e,n]=rr(t),[i,s]=rr(t.subarray(n)),a=t.subarray(n+s);if(a.byteLength!==i)throw new Error("Incorrect length");return new Ge(e,i,a,t)},Ao=(r,t)=>{if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&so(r.bytes,e.bytes)}},Ge=class{constructor(t,e,n,i){this.code=t,this.size=e,this.digest=n,this.bytes=i}};var si=({name:r,code:t,encode:e})=>new ii(r,t,e),ii=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?Jt(this.code,e):e.then(n=>Jt(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Gr=si({name:"sha2-256",code:18,encode:r=>vt(oi.default.createHash("sha256").update(r).digest())}),vf=si({name:"sha2-512",code:19,encode:r=>vt(oi.default.createHash("sha512").update(r).digest())});var ai={};ft(ai,{identity:()=>$r});var Co=0,xf="identity",ko=vt,Sf=r=>Jt(Co,ko(r)),$r={code:Co,name:xf,encode:ko,digest:Sf};var Qd=new TextEncoder,tm=new TextDecoder;var Do=(r,t)=>{let{bytes:e,version:n}=r;switch(n){case 0:return Cf(e,ui(r),t||H.encoder);default:return kf(e,ui(r),t||Rt.encoder)}};var Bo=new WeakMap,ui=r=>{let t=Bo.get(r);if(t==null){let e=new Map;return Bo.set(r,e),e}return t},ct=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!==nr)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==Df)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=Jt(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&&Ao(t.multihash,n.multihash)}toString(t){return Do(this,t)}toJSON(){return{"/":Do(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:s,bytes:a}=e;return new r(n,i,s,a||Ro(n,i,s.bytes))}else if(e[Bf]===!0){let{version:n,multihash:i,code:s}=e,a=ge(i);return r.create(n,s,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!==nr)throw new Error(`Version 0 CID must use dag-pb (code: ${nr}) block encoding`);return new r(t,e,n,n.bytes)}case 1:{let i=Ro(t,e,n.bytes);return new r(t,e,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return r.create(0,nr,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=vt(t.subarray(n,n+e.multihashSize));if(i.byteLength!==e.multihashSize)throw new Error("Incorrect length");let s=i.subarray(e.multihashSize-e.digestSize),a=new Ge(e.multihashCode,e.digestSize,s,i);return[e.version===0?r.createV0(a):r.createV1(e.codec,a),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[g,w]=rr(t.subarray(e));return e+=w,g},i=n(),s=nr;if(i===18?(i=0,e=0):s=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let a=e,l=n(),f=n(),d=e+f,h=d-a;return{version:i,codec:s,multihashCode:l,digestSize:f,multihashSize:h,size:d}}static parse(t,e){let[n,i]=If(t,e),s=r.decode(i);if(s.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return ui(s).set(n,t),s}},If=(r,t)=>{switch(r[0]){case"Q":{let e=t||H;return[H.prefix,e.decode(`${H.prefix}${r}`)]}case H.prefix:{let e=t||H;return[H.prefix,e.decode(r)]}case Rt.prefix:{let e=t||Rt;return[Rt.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)]}}},Cf=(r,t,e)=>{let{prefix:n}=e;if(n!==H.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let i=t.get(n);if(i==null){let s=e.encode(r).slice(1);return t.set(n,s),s}else return i},kf=(r,t,e)=>{let{prefix:n}=e,i=t.get(n);if(i==null){let s=e.encode(r);return t.set(n,s),s}else return i},nr=112,Df=18,Ro=(r,t,e)=>{let n=Fe(r),i=n+Fe(t),s=new Uint8Array(i+e.byteLength);return Ue(r,s,0),Ue(t,s,n),s.set(e,i),s},Bf=Symbol.for("@ipld/js-cid/CID");var Qt={...Yn,...jn,...Jn,...Qn,...ti,...zn,...ei,...Vn,...Wn,...ri},lm={...ci,...ai};var Rf=Symbol.for("nodejs.util.inspect.custom"),_o=Object.values(Qt).map(r=>r.decoder).reduce((r,t)=>r.or(t),Qt.identity.decoder),Lo=114,No=36,Oo=37,ir=class{type;multihash;privateKey;publicKey;string;constructor(t){this.type=t.type,this.multihash=t.multihash,this.privateKey=t.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}[Eo]=!0;toString(){return this.string==null&&(this.string=H.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return ct.createV1(Lo,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(t){if(t instanceof Uint8Array)return pe(this.multihash.bytes,t);if(typeof t=="string")return _f(t).equals(this);if(t?.multihash?.bytes!=null)return pe(this.multihash.bytes,t.multihash.bytes);throw new Error("not valid Id")}[Rf](){return`PeerId(${this.toString()})`}},sr=class extends ir{type="RSA";publicKey;constructor(t){super({...t,type:"RSA"}),this.publicKey=t.publicKey}},or=class extends ir{type="Ed25519";publicKey;constructor(t){super({...t,type:"Ed25519"}),this.publicKey=t.multihash.digest}},cr=class extends ir{type="secp256k1";publicKey;constructor(t){super({...t,type:"secp256k1"}),this.publicKey=t.multihash.digest}};function _f(r,t){if(t=t??_o,r.charAt(0)==="1"||r.charAt(0)==="Q"){let e=ge(H.decode(`z${r}`));return r.startsWith("12D")?new or({multihash:e}):r.startsWith("16U")?new cr({multihash:e}):new sr({multihash:e})}return be(_o.decode(r))}function be(r){try{let t=ge(r);if(t.code===$r.code){if(t.digest.length===No)return new or({multihash:t});if(t.digest.length===Oo)return new cr({multihash:t})}if(t.code===Gr.code)return new sr({multihash:t})}catch{return Lf(ct.decode(r))}throw new Error("Supplied PeerID CID is invalid")}function Lf(r){if(r==null||r.multihash==null||r.version==null||r.version===1&&r.code!==Lo)throw new Error("Supplied PeerID CID is invalid");let t=r.multihash;if(t.code===Gr.code)return new sr({multihash:r.multihash});if(t.code===$r.code){if(t.digest.length===No)return new or({multihash:r.multihash});if(t.digest.length===Oo)return new cr({multihash:r.multihash})}throw new Error("Supplied PeerID CID is invalid")}var $c=M(Ft("net"),1);var Mo=Symbol.for("@libp2p/transport");var Po;(function(r){r[r.FATAL_ALL=0]="FATAL_ALL",r[r.NO_FATAL=1]="NO_FATAL"})(Po||(Po={}));var zr=class extends Error{code;props;constructor(t,e,n){super(t),this.code=e,this.name=n?.name??"CodeError",this.props=n??{}}};function Fo(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var Uo=Fo("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),li=Fo("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=_t(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),Nf={utf8:Uo,"utf-8":Uo,hex:Qt.base16,latin1:li,ascii:li,binary:li,...Qt},Vr=Nf;function at(r,t="utf8"){let e=Vr[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 ze=M(pi(),1);var Hr=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 s=0,a=0,l=this.peekChar();if(l===void 0)return;let f=l==="0",d=2**(8*i)-1;for(;;){let h=this.readAtomically(()=>{let g=this.readChar();if(g===void 0)return;let w=Number.parseInt(g,t);if(!Number.isNaN(w))return w});if(h===void 0)break;if(s*=t,s+=h,s>d||(a+=1,e!==void 0&&a>e))return}if(a!==0)return!n&&f&&a>1?void 0:s})}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 a=this.readSeparator(":",n,()=>this.readIPv4Addr());if(a!==void 0)return e[i]=a[0],e[i+1]=a[1],e[i+2]=a[2],e[i+3]=a[3],[i+4,!0]}let s=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(s===void 0)return[i,!1];e[i]=s>>8,e[i+1]=s&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 s=new Uint8Array(14),a=16-(n+2),[l]=t(s.subarray(0,a));return e.set(s.subarray(0,l),16-l),e})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var Nm=new Hr;var zm=parseInt("0xFFFF",16),Vm=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);function ar(r,t="utf8"){let e=Vr[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?he(globalThis.Buffer.from(r,"utf-8")):e.decoder.decode(`${e.prefix}${r}`)}var Pt=M(pi(),1);var te=Ft("node:net");function Wr(r){return!!(0,te.isIP)(r)}var jo=te.isIPv4,Qf=te.isIPv6,di=function(r){let t=0;if(r=r.toString().trim(),jo(r)){let e=new Uint8Array(t+4);return r.split(/\./g).forEach(n=>{e[t++]=parseInt(n,10)&255}),e}if(Qf(r)){let e=r.split(":",8),n;for(n=0;n<e.length;n++){let s=jo(e[n]),a;s&&(a=di(e[n]),e[n]=at(a.slice(0,2),"base16")),a!=null&&++n<8&&e.splice(n,0,at(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 s=[n,1];for(n=9-e.length;n>0;n--)s.push("0");e.splice.apply(e,s)}let i=new Uint8Array(t+16);for(n=0;n<e.length;n++){let s=parseInt(e[n],16);i[t++]=s>>8&255,i[t++]=s&255}return i}throw new Error("invalid ip address")},Jo=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 s=0;s<e;s++)i.push(r[t+s]);return i.join(".")}if(e===16){let i=[];for(let s=0;s<e;s+=2)i.push(n.getUint16(t+s).toString(16));return i.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var $e={},mi={},eh=[[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"]];eh.forEach(r=>{let t=rh(...r);mi[t.code]=t,$e[t.name]=t});function rh(r,t,e,n,i){return{code:r,size:t,name:e,resolvable:!!n,path:!!i}}function L(r){if(typeof r=="number"){if(mi[r]!=null)return mi[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if($e[r]!=null)return $e[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var B0=L("ip4"),R0=L("ip6"),_0=L("ipcidr");function yi(r,t){switch(L(r).code){case 4:case 41:return ih(t);case 42:return ec(t);case 6:case 273:case 33:case 132:return nc(t).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return ec(t);case 421:return ah(t);case 444:return rc(t);case 445:return rc(t);case 466:return ch(t);default:return at(t,"base16")}}function bi(r,t){switch(L(r).code){case 4:return Qo(t);case 41:return Qo(t);case 42:return tc(t);case 6:case 273:case 33:case 132:return wi(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return tc(t);case 421:return sh(t);case 444:return uh(t);case 445:return lh(t);case 466:return oh(t);default:return ar(t,"base16")}}var gi=Object.values(Qt).map(r=>r.decoder),nh=function(){let r=gi[0].or(gi[1]);return gi.slice(2).forEach(t=>r=r.or(t)),r}();function Qo(r){if(!Wr(r))throw new Error("invalid ip address");return di(r)}function ih(r){let t=Jo(r,0,r.length);if(t==null)throw new Error("ipBuff is required");if(!Wr(t))throw new Error("invalid ip address");return t}function wi(r){let t=new ArrayBuffer(2);return new DataView(t).setUint16(0,r),new Uint8Array(t)}function nc(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function tc(r){let t=ar(r),e=Uint8Array.from(Pt.default.encode(t.length));return xt([e,t],e.length+t.length)}function ec(r){let t=Pt.default.decode(r);if(r=r.slice(Pt.default.decode.bytes),r.length!==t)throw new Error("inconsistent lengths");return at(r)}function sh(r){let t;r[0]==="Q"||r[0]==="1"?t=ge(H.decode(`z${r}`)).bytes:t=ct.parse(r).multihash.bytes;let e=Uint8Array.from(Pt.default.encode(t.length));return xt([e,t],e.length+t.length)}function oh(r){let t=nh.decode(r),e=Uint8Array.from(Pt.default.encode(t.length));return xt([e,t],e.length+t.length)}function ch(r){let t=Pt.default.decode(r),e=r.slice(Pt.default.decode.bytes);if(e.length!==t)throw new Error("inconsistent lengths");return"u"+at(e,"base64url")}function ah(r){let t=Pt.default.decode(r),e=r.slice(Pt.default.decode.bytes);if(e.length!==t)throw new Error("inconsistent lengths");return at(e,"base58btc")}function uh(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=Rt.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=wi(n);return xt([e,i],e.length+i.length)}function lh(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=Rt.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=wi(n);return xt([e,i],e.length+i.length)}function rc(r){let t=r.slice(0,r.length-2),e=r.slice(r.length-2),n=at(t,"base32"),i=nc(e);return`${n}:${i}`}function ic(r){r=Ei(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 s=0;s<i.length;s++){let a=i[s],l=L(a);if(l.size===0){t.push([l.code]),e.push([l.code]);continue}if(s++,s>=i.length)throw oc("invalid address: "+r);if(l.path===!0){n=Ei(i.slice(s).join("/")),t.push([l.code,bi(l.code,n)]),e.push([l.code,n]);break}let f=bi(l.code,i[s]);t.push([l.code,f]),e.push([l.code,yi(l.code,f)])}return{string:sc(e),bytes:xi(t),tuples:t,stringTuples:e,path:n}}function vi(r){let t=[],e=[],n=null,i=0;for(;i<r.length;){let s=ze.default.decode(r,i),a=ze.default.decode.bytes??0,l=L(s),f=fh(l,r.slice(i+a));if(f===0){t.push([s]),e.push([s]),i+=a;continue}let d=r.slice(i+a,i+a+f);if(i+=f+a,i>r.length)throw oc("Invalid address Uint8Array: "+at(r,"base16"));t.push([s,d]);let h=yi(s,d);if(e.push([s,h]),l.path===!0){n=h;break}}return{bytes:Uint8Array.from(r),string:sc(e),tuples:t,stringTuples:e,path:n}}function sc(r){let t=[];return r.map(e=>{let n=L(e[0]);return t.push(n.name),e.length>1&&e[1]!=null&&t.push(e[1]),null}),Ei(t.join("/"))}function xi(r){return xt(r.map(t=>{let e=L(t[0]),n=Uint8Array.from(ze.default.encode(e.code));return t.length>1&&t[1]!=null&&(n=xt([n,t[1]])),n}))}function fh(r,t){return r.size>0?r.size/8:r.size===0?0:ze.default.decode(t)+(ze.default.decode.bytes??0)}function Ei(r){return"/"+r.trim().split("/").filter(t=>t).join("/")}function oc(r){return new Error("Error parsing address: "+r)}var hh=Symbol.for("nodejs.util.inspect.custom"),ph=[L("dns").code,L("dns4").code,L("dns6").code,L("dnsaddr").code],dh=new Map,cc=Symbol.for("@multiformats/js-multiaddr/multiaddr");function mh(r){return!!r?.[cc]}var Si=class r{bytes;#t;#e;#r;#n;[cc]=!0;constructor(t){t==null&&(t="");let e;if(t instanceof Uint8Array)e=vi(t);else if(typeof t=="string"){if(t.length>0&&t.charAt(0)!=="/")throw new Error(`multiaddr "${t}" must start with a "/"`);e=ic(t)}else if(mh(t))e=vi(t.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=e.bytes,this.#t=e.string,this.#e=e.tuples,this.#r=e.stringTuples,this.#n=e.path}toString(){return this.#t}toJSON(){return this.toString()}toOptions(){let t,e,n,i,s="",a=L("tcp"),l=L("udp"),f=L("ip4"),d=L("ip6"),h=L("dns6"),g=L("ip6zone");for(let[S,b]of this.stringTuples())S===g.code&&(s=`%${b??""}`),ph.includes(S)&&(e=a.name,i=443,n=`${b??""}${s}`,t=S===h.code?6:4),(S===a.code||S===l.code)&&(e=L(S).name,i=parseInt(b??"")),(S===f.code||S===d.code)&&(e=L(S).name,n=`${b??""}${s}`,t=S===d.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.#e.map(([t])=>Object.assign({},L(t)))}protoCodes(){return this.#e.map(([t])=>t)}protoNames(){return this.#e.map(([t])=>L(t).name)}tuples(){return this.#e}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(xi(e.slice(0,n)));return this}getPeerId(){try{let t=[];this.stringTuples().forEach(([n,i])=>{n===$e.p2p.code&&t.push([n,i]),n===$e["p2p-circuit"].code&&(t=[])});let e=t.pop();if(e?.[1]!=null){let n=e[1];return n[0]==="Q"||n[0]==="1"?at(H.decode(`z${n}`),"base58btc"):at(ct.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return this.#n}equals(t){return pe(this.bytes,t.bytes)}async resolve(t){let e=this.protos().find(s=>s.resolvable);if(e==null)return[this];let n=dh.get(e.name);if(n==null)throw new zr(`no available resolver for ${e.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,t)).map(s=>new r(s))}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)}[hh](){return`Multiaddr(${this.#t})`}};function dt(r){return new Si(r)}var gh=v("dns4"),yh=v("dns6"),bh=v("dnsaddr"),Ee=F(v("dns"),bh,gh,yh),Kr=F(v("ip4"),v("ip6")),re=F(I(Kr,v("tcp")),I(Ee,v("tcp"))),Xr=I(Kr,v("udp")),wh=I(Xr,v("utp")),Eh=I(Xr,v("quic")),vh=I(Xr,v("quic-v1")),Ti=F(I(re,v("ws")),I(Ee,v("ws"))),qr=F(I(Ti,v("p2p")),Ti),Ai=F(I(re,v("wss")),I(Ee,v("wss")),I(re,v("tls"),v("ws")),I(Ee,v("tls"),v("ws"))),Zr=F(I(Ai,v("p2p")),Ai),Ii=F(I(re,v("http")),I(Kr,v("http")),I(Ee,v("http"))),Ci=F(I(re,v("https")),I(Kr,v("https")),I(Ee,v("https"))),ac=I(Xr,v("webrtc-direct"),v("certhash")),fc=F(I(ac,v("p2p")),ac),uc=I(vh,v("webtransport"),v("certhash"),v("certhash")),hc=F(I(uc,v("p2p")),uc),pc=F(I(qr,v("p2p-webrtc-star"),v("p2p")),I(Zr,v("p2p-webrtc-star"),v("p2p")),I(qr,v("p2p-webrtc-star")),I(Zr,v("p2p-webrtc-star"))),tg=F(I(qr,v("p2p-websocket-star"),v("p2p")),I(Zr,v("p2p-websocket-star"),v("p2p")),I(qr,v("p2p-websocket-star")),I(Zr,v("p2p-websocket-star"))),dc=F(I(Ii,v("p2p-webrtc-direct"),v("p2p")),I(Ci,v("p2p-webrtc-direct"),v("p2p")),I(Ii,v("p2p-webrtc-direct")),I(Ci,v("p2p-webrtc-direct"))),ve=F(Ti,Ai,Ii,Ci,pc,dc,re,wh,Eh,Ee,fc,hc),eg=F(I(ve,v("p2p-stardust"),v("p2p")),I(ve,v("p2p-stardust"))),ee=F(I(ve,v("p2p")),pc,dc,fc,hc,v("p2p")),lc=F(I(ee,v("p2p-circuit"),ee),I(ee,v("p2p-circuit")),I(v("p2p-circuit"),ee),I(ve,v("p2p-circuit")),I(v("p2p-circuit"),ve),v("p2p-circuit")),mc=()=>F(I(lc,mc),lc),we=mc(),rg=F(I(we,ee,we),I(ee,we),I(we,ee),we,ee);var ng=F(I(we,v("webrtc"),v("p2p")),I(we,v("webrtc")),I(ve,v("webrtc"),v("p2p")),I(ve,v("webrtc")),v("webrtc"));function gc(r){function t(e){let n;try{n=dt(e)}catch{return!1}let i=r(n.protoNames());return i===null?!1:i===!0||i===!1?i:i.length===0}return t}function I(...r){function t(e){if(e.length<r.length)return null;let n=e;return r.some(i=>(n=typeof i=="function"?i().partialMatch(e):i.partialMatch(e),Array.isArray(n)&&(e=n),n===null)),n}return{toString:function(){return"{ "+r.join(" ")+" }"},input:r,matches:gc(t),partialMatch:t}}function F(...r){function t(n){let i=null;return r.some(s=>{let a=typeof s=="function"?s().partialMatch(n):s.partialMatch(n);return a!=null?(i=a,!0):!1}),i}return{toString:function(){return"{ "+r.join(" ")+" }"},input:r,matches:gc(t),partialMatch:t}}function v(r){let t=r;function e(i){let s;try{s=dt(i)}catch{return!1}let a=s.protoNames();return a.length===1&&a[0]===t}function n(i){return i.length===0?null:i[0]===t?i.slice(1):null}return{toString:function(){return t},matches:e,partialMatch:n}}var Gc=M(Ft("net"),1);var Yr=class extends EventTarget{#t=new Map;listenerCount(t){let e=this.#t.get(t);return e==null?0:e.length}addEventListener(t,e,n){super.addEventListener(t,e,n);let i=this.#t.get(t);i==null&&(i=[],this.#t.set(t,i)),i.push({callback:e,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(t,e,n){super.removeEventListener(t.toString(),e??null,n);let i=this.#t.get(t);i!=null&&(i=i.filter(({callback:s})=>s!==e),this.#t.set(t,i))}dispatchEvent(t){let e=super.dispatchEvent(t),n=this.#t.get(t.type);return n==null||(n=n.filter(({once:i})=>!i),this.#t.set(t.type,n)),e}safeDispatchEvent(t,e){return this.dispatchEvent(new Ve(t,e))}},ki=class extends Event{detail;constructor(t,e){super(t,e),this.detail=e?.detail}},Ve=globalThis.CustomEvent??ki;function jr(r){return this.subnetMask<r.subnetMask?!1:this.mask(r.subnetMask)===r.mask()}function Jr(r){return function(){return this.addressMinusSuffix!==this.correctForm()?!1:this.subnetMask===r&&!this.parsedSubnet?!0:this.parsedSubnet===String(this.subnetMask)}}var He=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g,Di=/\/\d{1,2}$/;var Q=class extends Error{constructor(t,e){super(t),this.name="AddressError",e!==null&&(this.parseMessage=e)}};var We=M(Bi(),1),xe=M(ur(),1),mt=class r{constructor(t){this.groups=4,this.parsedAddress=[],this.parsedSubnet="",this.subnet="/32",this.subnetMask=32,this.v4=!0,this.isCorrect=Jr(32),this.isInSubnet=jr,this.address=t;let e=Di.exec(t);if(e){if(this.parsedSubnet=e[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,this.subnetMask<0||this.subnetMask>32)throw new Q("Invalid subnet mask.");t=t.replace(Di,"")}this.addressMinusSuffix=t,this.parsedAddress=this.parse(t)}static isValid(t){try{return new r(t),!0}catch{return!1}}parse(t){let e=t.split(".");if(!t.match(He))throw new Q("Invalid IPv4 address.");return e}correctForm(){return this.parsedAddress.map(t=>parseInt(t,10)).join(".")}static fromHex(t){let e=t.replace(/:/g,"").padStart(8,"0"),n=[],i;for(i=0;i<8;i+=2){let s=e.slice(i,i+2);n.push(parseInt(s,16))}return new r(n.join("."))}static fromInteger(t){return r.fromHex(t.toString(16))}static fromArpa(t){let n=t.replace(/(\.in-addr\.arpa)?\.$/,"").split(".").reverse().join(".");return new r(n)}toHex(){return this.parsedAddress.map(t=>(0,xe.sprintf)("%02x",parseInt(t,10))).join(":")}toArray(){return this.parsedAddress.map(t=>parseInt(t,10))}toGroup6(){let t=[],e;for(e=0;e<4;e+=2){let n=(0,xe.sprintf)("%02x%02x",parseInt(this.parsedAddress[e],10),parseInt(this.parsedAddress[e+1],10));t.push((0,xe.sprintf)("%x",parseInt(n,16)))}return t.join(":")}bigInteger(){return new We.BigInteger(this.parsedAddress.map(t=>(0,xe.sprintf)("%02x",parseInt(t,10))).join(""),16)}_startAddress(){return new We.BigInteger(this.mask()+"0".repeat(32-this.subnetMask),2)}startAddress(){return r.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new We.BigInteger("1");return r.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new We.BigInteger(this.mask()+"1".repeat(32-this.subnetMask),2)}endAddress(){return r.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new We.BigInteger("1");return r.fromBigInteger(this._endAddress().subtract(t))}static fromBigInteger(t){return r.fromInteger(parseInt(t.toString(),10))}mask(t){return t===void 0&&(t=this.subnetMask),this.getBitsBase2(0,t)}getBitsBase2(t,e){return this.binaryZeroPad().slice(t,e)}reverseForm(t){t||(t={});let e=this.correctForm().split(".").reverse().join(".");return t.omitSuffix?e:(0,xe.sprintf)("%s.in-addr.arpa.",e)}isMulticast(){return this.isInSubnet(new r("224.0.0.0/4"))}binaryZeroPad(){return this.bigInteger().toString(2).padStart(32,"0")}groupForV6(){let t=this.parsedAddress;return this.address.replace(He,(0,xe.sprintf)('<span class="hover-group group-v4 group-6">%s</span>.<span class="hover-group group-v4 group-7">%s</span>',t.slice(0,2).join("."),t.slice(2,4).join(".")))}};var vc={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"},Ri={"ff01::1/128":"Multicast (All nodes on this interface)","ff01::2/128":"Multicast (All routers on this interface)","ff02::1/128":"Multicast (All nodes on this link)","ff02::2/128":"Multicast (All routers on this link)","ff05::2/128":"Multicast (All routers in this site)","ff02::5/128":"Multicast (OSPFv3 AllSPF routers)","ff02::6/128":"Multicast (OSPFv3 AllDR routers)","ff02::9/128":"Multicast (RIP routers)","ff02::a/128":"Multicast (EIGRP routers)","ff02::d/128":"Multicast (PIM routers)","ff02::16/128":"Multicast (MLDv2 reports)","ff01::fb/128":"Multicast (mDNSv6)","ff02::fb/128":"Multicast (mDNSv6)","ff05::fb/128":"Multicast (mDNSv6)","ff02::1:2/128":"Multicast (All DHCP servers and relay agents on this link)","ff05::1:2/128":"Multicast (All DHCP servers and relay agents in this site)","ff02::1:3/128":"Multicast (All DHCP servers on this link)","ff05::1:3/128":"Multicast (All DHCP servers in this site)","::/128":"Unspecified","::1/128":"Loopback","ff00::/8":"Multicast","fe80::/10":"Link-local unicast"},_i=/([^0-9a-f:/%])/gi,Li=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi,Ni=/\/\d{1,3}(?=%|$)/,Oi=/%.*$/,xc=new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/),Sc=new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/);var Ac=M(ur(),1);function Sh(r){return r.replace(/^(0+)/,'<span class="zero">$1</span>')}function en(r,t=0){return r.split(":").map((n,i)=>/group-v4/.test(n)?n:(0,Ac.sprintf)('<span class="hover-group group-%d">%s</span>',i+t,Sh(n)))}var Te=M(ur(),1);function Mi(r){return(0,Te.sprintf)("(%s)",r.join("|"))}function Pi(r){return r.length<4?(0,Te.sprintf)("0{0,%d}%s",4-r.length,r):r}var Ui="[^A-Fa-f0-9:]";function rn(r){let t=[];r.forEach((n,i)=>{parseInt(n,16)===0&&t.push(i)});let e=t.map(n=>r.map((i,s)=>{if(s===n){let a=s===0||s===8-1?":":"";return Mi([Pi(i),a])}return Pi(i)}).join(":"));return e.push(r.map(Pi).join(":")),Mi(e)}function Fi(r,t,e){let n=t?"":":",i=e?"":":",s=[];!t&&!e&&s.push("::"),t&&e&&s.push(""),(e&&!t||!e&&t)&&s.push(":"),s.push((0,Te.sprintf)("%s(:0{1,4}){1,%d}",n,r-1)),s.push((0,Te.sprintf)("(0{1,4}:){1,%d}%s",r-1,i)),s.push((0,Te.sprintf)("(0{1,4}:){%d}0{1,4}",r-1));for(let a=1;a<r-1;a++)for(let l=1;l<r-a;l++)s.push((0,Te.sprintf)("(0{1,4}:){%d}:(0{1,4}:){%d}0{1,4}",l,r-l-a-1));return Mi(s)}var tt=M(Bi(),1),et=M(ur(),1);function nn(r){if(!r)throw new Error("Assertion failed.")}function Th(r){let t=/(\d+)(\d{3})/;for(;t.test(r);)r=r.replace(t,"$1,$2");return r}function Ah(r){return r=r.replace(/^(0{1,})([1-9]+)$/,'<span class="parse-error">$1</span>$2'),r=r.replace(/^(0{1,})(0)$/,'<span class="parse-error">$1</span>$2'),r}function Ih(r,t){let e=[],n=[],i;for(i=0;i<r.length;i++)i<t[0]?e.push(r[i]):i>t[1]&&n.push(r[i]);return e.concat(["compact"]).concat(n)}function Cc(r){return(0,et.sprintf)("%04x",parseInt(r,16))}function kc(r){return r&255}var lr=class r{constructor(t,e){this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=jr,this.isCorrect=Jr(128),e===void 0?this.groups=8:this.groups=e,this.address=t;let n=Ni.exec(t);if(n){if(this.parsedSubnet=n[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,Number.isNaN(this.subnetMask)||this.subnetMask<0||this.subnetMask>128)throw new Q("Invalid subnet mask.");t=t.replace(Ni,"")}else if(/\//.test(t))throw new Q("Invalid subnet mask.");let i=Oi.exec(t);i&&(this.zone=i[0],t=t.replace(Oi,"")),this.addressMinusSuffix=t,this.parsedAddress=this.parse(this.addressMinusSuffix)}static isValid(t){try{return new r(t),!0}catch{return!1}}static fromBigInteger(t){let e=t.toString(16).padStart(32,"0"),n=[],i;for(i=0;i<8;i++)n.push(e.slice(i*4,(i+1)*4));return new r(n.join(":"))}static fromURL(t){let e,n=null,i;if(t.indexOf("[")!==-1&&t.indexOf("]:")!==-1){if(i=Sc.exec(t),i===null)return{error:"failed to parse address with port",address:null,port:null};e=i[1],n=i[2]}else if(t.indexOf("/")!==-1){if(t=t.replace(/^[a-z0-9]+:\/\//,""),i=xc.exec(t),i===null)return{error:"failed to parse address from URL",address:null,port:null};e=i[1]}else e=t;return n?(n=parseInt(n,10),(n<0||n>65536)&&(n=null)):n=null,{address:new r(e),port:n}}static fromAddress4(t){let e=new mt(t),n=128-(32-e.subnetMask);return new r(`::ffff:${e.correctForm()}/${n}`)}static fromArpa(t){let e=t.replace(/(\.ip6\.arpa)?\.$/,""),n=7;if(e.length!==63)throw new Q("Invalid 'ip6.arpa' form.");let i=e.split(".").reverse();for(let s=n;s>0;s--){let a=s*4;i.splice(a,0,":")}return e=i.join(""),new r(e)}microsoftTranscription(){return(0,et.sprintf)("%s.ipv6-literal.net",this.correctForm().replace(/:/g,"-"))}mask(t=this.subnetMask){return this.getBitsBase2(0,t)}possibleSubnets(t=128){let e=128-this.subnetMask,n=Math.abs(t-128),i=e-n;return i<0?"0":Th(new tt.BigInteger("2",10).pow(i).toString(10))}_startAddress(){return new tt.BigInteger(this.mask()+"0".repeat(128-this.subnetMask),2)}startAddress(){return r.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new tt.BigInteger("1");return r.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new tt.BigInteger(this.mask()+"1".repeat(128-this.subnetMask),2)}endAddress(){return r.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new tt.BigInteger("1");return r.fromBigInteger(this._endAddress().subtract(t))}getScope(){let t=vc[this.getBits(12,16).intValue()];return this.getType()==="Global unicast"&&t!=="Link local"&&(t="Global"),t||"Unknown"}getType(){for(let t of Object.keys(Ri))if(this.isInSubnet(new r(t)))return Ri[t];return"Global unicast"}getBits(t,e){return new tt.BigInteger(this.getBitsBase2(t,e),2)}getBitsBase2(t,e){return this.binaryZeroPad().slice(t,e)}getBitsBase16(t,e){let n=e-t;if(n%4!==0)throw new Error("Length of bits to retrieve must be divisible by four");return this.getBits(t,e).toString(16).padStart(n/4,"0")}getBitsPastSubnet(){return this.getBitsBase2(this.subnetMask,128)}reverseForm(t){t||(t={});let e=Math.floor(this.subnetMask/4),n=this.canonicalForm().replace(/:/g,"").split("").slice(0,e).reverse().join(".");return e>0?t.omitSuffix?n:(0,et.sprintf)("%s.ip6.arpa.",n):t.omitSuffix?"":"ip6.arpa."}correctForm(){let t,e=[],n=0,i=[];for(t=0;t<this.parsedAddress.length;t++){let l=parseInt(this.parsedAddress[t],16);l===0&&n++,l!==0&&n>0&&(n>1&&i.push([t-n,t-1]),n=0)}n>1&&i.push([this.parsedAddress.length-n,this.parsedAddress.length-1]);let s=i.map(l=>l[1]-l[0]+1);if(i.length>0){let l=s.indexOf(Math.max(...s));e=Ih(this.parsedAddress,i[l])}else e=this.parsedAddress;for(t=0;t<e.length;t++)e[t]!=="compact"&&(e[t]=parseInt(e[t],16).toString(16));let a=e.join(":");return a=a.replace(/^compact$/,"::"),a=a.replace(/^compact|compact$/,":"),a=a.replace(/compact/,""),a}binaryZeroPad(){return this.bigInteger().toString(2).padStart(128,"0")}parse4in6(t){let e=t.split(":"),i=e.slice(-1)[0].match(He);if(i){this.parsedAddress4=i[0],this.address4=new mt(this.parsedAddress4);for(let s=0;s<this.address4.groups;s++)if(/^0[0-9]+/.test(this.address4.parsedAddress[s]))throw new Q("IPv4 addresses can't have leading zeroes.",t.replace(He,this.address4.parsedAddress.map(Ah).join(".")));this.v4=!0,e[e.length-1]=this.address4.toGroup6(),t=e.join(":")}return t}parse(t){t=this.parse4in6(t);let e=t.match(_i);if(e)throw new Q((0,et.sprintf)("Bad character%s detected in address: %s",e.length>1?"s":"",e.join("")),t.replace(_i,'<span class="parse-error">$1</span>'));let n=t.match(Li);if(n)throw new Q((0,et.sprintf)("Address failed regex: %s",n.join("")),t.replace(Li,'<span class="parse-error">$1</span>'));let i=[],s=t.split("::");if(s.length===2){let a=s[0].split(":"),l=s[1].split(":");a.length===1&&a[0]===""&&(a=[]),l.length===1&&l[0]===""&&(l=[]);let f=this.groups-(a.length+l.length);if(!f)throw new Q("Error parsing groups");this.elidedGroups=f,this.elisionBegin=a.length,this.elisionEnd=a.length+this.elidedGroups,i=i.concat(a);for(let d=0;d<f;d++)i.push("0");i=i.concat(l)}else if(s.length===1)i=t.split(":"),this.elidedGroups=0;else throw new Q("Too many :: groups found");if(i=i.map(a=>(0,et.sprintf)("%x",parseInt(a,16))),i.length!==this.groups)throw new Q("Incorrect number of groups found");return i}canonicalForm(){return this.parsedAddress.map(Cc).join(":")}decimal(){return this.parsedAddress.map(t=>(0,et.sprintf)("%05d",parseInt(t,16))).join(":")}bigInteger(){return new tt.BigInteger(this.parsedAddress.map(Cc).join(""),16)}to4(){let t=this.binaryZeroPad().split("");return mt.fromHex(new tt.BigInteger(t.slice(96,128).join(""),2).toString(16))}to4in6(){let t=this.to4(),n=new r(this.parsedAddress.slice(0,6).join(":"),6).correctForm(),i="";return/:$/.test(n)||(i=":"),n+i+t.address}inspectTeredo(){let t=this.getBitsBase16(0,32),e=this.getBits(80,96).xor(new tt.BigInteger("ffff",16)).toString(),n=mt.fromHex(this.getBitsBase16(32,64)),i=mt.fromHex(this.getBits(96,128).xor(new tt.BigInteger("ffffffff",16)).toString(16)),s=this.getBits(64,80),a=this.getBitsBase2(64,80),l=s.testBit(15),f=s.testBit(14),d=s.testBit(8),h=s.testBit(9),g=new tt.BigInteger(a.slice(2,6)+a.slice(8,16),2).toString(10);return{prefix:(0,et.sprintf)("%s:%s",t.slice(0,4),t.slice(4,8)),server4:n.address,client4:i.address,flags:a,coneNat:l,microsoft:{reserved:f,universalLocal:h,groupIndividual:d,nonce:g},udpPort:e}}inspect6to4(){let t=this.getBitsBase16(0,16),e=mt.fromHex(this.getBitsBase16(16,48));return{prefix:(0,et.sprintf)("%s",t.slice(0,4)),gateway:e.address}}to6to4(){if(!this.is4())return null;let t=["2002",this.getBitsBase16(96,112),this.getBitsBase16(112,128),"","/16"].join(":");return new r(t)}toByteArray(){let t=this.bigInteger().toByteArray();return t.length===17&&t[0]===0?t.slice(1):t}toUnsignedByteArray(){return this.toByteArray().map(kc)}static fromByteArray(t){return this.fromUnsignedByteArray(t.map(kc))}static fromUnsignedByteArray(t){let e=new tt.BigInteger("256",10),n=new tt.BigInteger("0",10),i=new tt.BigInteger("1",10);for(let s=t.length-1;s>=0;s--)n=n.add(i.multiply(new tt.BigInteger(t[s].toString(10),10))),i=i.multiply(e);return r.fromBigInteger(n)}isCanonical(){return this.addressMinusSuffix===this.canonicalForm()}isLinkLocal(){return this.getBitsBase2(0,64)==="1111111010000000000000000000000000000000000000000000000000000000"}isMulticast(){return this.getType()==="Multicast"}is4(){return this.v4}isTeredo(){return this.isInSubnet(new r("2001::/32"))}is6to4(){return this.isInSubnet(new r("2002::/16"))}isLoopback(){return this.getType()==="Loopback"}href(t){return t===void 0?t="":t=(0,et.sprintf)(":%s",t),(0,et.sprintf)("http://[%s]%s/",this.correctForm(),t)}link(t){t||(t={}),t.className===void 0&&(t.className=""),t.prefix===void 0&&(t.prefix="/#address="),t.v4===void 0&&(t.v4=!1);let e=this.correctForm;return t.v4&&(e=this.to4in6),t.className?(0,et.sprintf)('<a href="%1$s%2$s" class="%3$s">%2$s</a>',t.prefix,e.call(this),t.className):(0,et.sprintf)('<a href="%1$s%2$s">%2$s</a>',t.prefix,e.call(this))}group(){if(this.elidedGroups===0)return en(this.address).join(":");nn(typeof this.elidedGroups=="number"),nn(typeof this.elisionBegin=="number");let t=[],[e,n]=this.address.split("::");e.length?t.push(...en(e)):t.push("");let i=["hover-group"];for(let s=this.elisionBegin;s<this.elisionBegin+this.elidedGroups;s++)i.push((0,et.sprintf)("group-%d",s));return t.push((0,et.sprintf)('<span class="%s"></span>',i.join(" "))),n.length?t.push(...en(n,this.elisionEnd)):t.push(""),this.is4()&&(nn(this.address4 instanceof mt),t.pop(),t.push(this.address4.groupForV6())),t.join(":")}regularExpressionString(t=!1){let e=[],n=new r(this.correctForm());if(n.elidedGroups===0)e.push(rn(n.parsedAddress));else if(n.elidedGroups===8)e.push(Fi(8));else{let i=n.address.split("::");i[0].length&&e.push(rn(i[0].split(":"))),nn(typeof n.elidedGroups=="number"),e.push(Fi(n.elidedGroups,i[0].length!==0,i[1].length!==0)),i[1].length&&e.push(rn(i[1].split(":"))),e=[e.join(":")]}return t||(e=["(?=^|",Ui,"|[^\\w\\:])(",...e,")(?=[^\\w\\:]|",Ui,"|$)"]),e.join("")}regularExpression(t=!1){return new RegExp(this.regularExpressionString(t),"i")}};var Ch=J("libp2p:ip-port-to-multiaddr"),Gi={ERR_INVALID_IP_PARAMETER:"ERR_INVALID_IP_PARAMETER",ERR_INVALID_PORT_PARAMETER:"ERR_INVALID_PORT_PARAMETER",ERR_INVALID_IP:"ERR_INVALID_IP"};function Dc(r,t){if(typeof r!="string")throw new St(`invalid ip provided: ${r}`,Gi.ERR_INVALID_IP_PARAMETER);if(typeof t=="string"&&(t=parseInt(t)),isNaN(t))throw new St(`invalid port provided: ${t}`,Gi.ERR_INVALID_PORT_PARAMETER);try{return new mt(r),dt(`/ip4/${r}/tcp/${t}`)}catch{}try{let e=new lr(r);return e.is4()?dt(`/ip4/${e.to4().correctForm()}/tcp/${t}`):dt(`/ip6/${r}/tcp/${t}`)}catch{let n=`invalid ip:port for creating a multiaddr: ${r}:${t}`;throw Ch.error(n),new St(n,Gi.ERR_INVALID_IP)}}var Fc=M(Mc(),1);var Vi=M(Ft("os"),1),Uc=M(Ft("path"),1);var _h={ip4:"IPv4",ip6:"IPv6"};function Ke(r,t={}){let e=r.getPath();return e!=null?Vi.default.platform()==="win32"?{path:Uc.default.join("\\\\.\\pipe\\",e)}:{path:e}:{...r.toOptions(),...t}}function Hi(r,t,e){let n=i=>dt(`/${r}/${i}/tcp/${e}`);return(Lh(t)?Oh(_h[r]):[t]).map(n)}function Lh(r){return["0.0.0.0","::"].includes(r)}var Nh=Vi.default.networkInterfaces();function Oh(r){let t=[];for(let[,e]of Object.entries(Nh))if(e!=null)for(let n of e)n.family===r&&t.push(n.address);return t}var Mt=J("libp2p:tcp:socket"),on=(r,t)=>{let e=t.metrics,n=t.metricPrefix??"",i=t.socketInactivityTimeout??3e5,s=t.socketCloseTimeout??500;t.listeningAddr?.getPath()!=null&&(t.remoteAddr=t.listeningAddr),t.remoteAddr?.getPath()!=null&&(t.localAddr=t.remoteAddr);let a;if(t.remoteAddr!=null)a=t.remoteAddr;else{if(r.remoteAddress==null||r.remotePort==null)throw new St("Could not determine remote address or port","ERR_NO_REMOTE_ADDRESS");a=Dc(r.remoteAddress,r.remotePort)}let l=Ke(a),f=l.path??`${l.host??""}:${l.port??""}`,{sink:d,source:h}=Fc.default.duplex(r);r.setTimeout(i,()=>{Mt("%s socket read timeout",f),e?.increment({[`${n}timeout`]:!0});let w;r.readable&&(w=new St("Socket read timeout","ERR_SOCKET_READ_TIMEOUT")),r.destroy(w)}),r.once("close",()=>{Mt("%s socket close",f),e?.increment({[`${n}close`]:!0}),g.timeline.close==null&&(g.timeline.close=Date.now())}),r.once("end",()=>{Mt("%s socket end",f),e?.increment({[`${n}end`]:!0})});let g={async sink(w){try{await d(w)}catch(S){S.type!=="aborted"&&Mt(S)}r.end()},source:h,remoteAddr:a,timeline:{open:Date.now()},async close(w={}){if(r.destroyed){Mt("%s socket was already destroyed when trying to close",f);return}w.signal=w.signal??AbortSignal.timeout(s);try{Mt("%s closing socket",f),await new Promise((S,b)=>{r.once("close",()=>{Mt("%s socket closed",f),S()}),r.once("error",k=>{Mt("%s socket error",f,k),g.timeline.close==null&&(g.timeline.close=Date.now()),b(k)}),r.setTimeout(s),r.end(),r.writableLength>0?r.once("drain",()=>{Mt("%s socket drained",f),r.destroy()}):r.destroy()})}catch(S){this.abort(S)}},abort:w=>{Mt("%s socket abort due to error",f,w),r.destroy(w)}};return g};var gt=J("libp2p:tcp:listener");async function Wi(r){try{await r.close()}catch(t){gt.error("an error occurred closing the connection",t)}}var Uh=1,Fh=0,cn=class extends Yr{context;server;connections=new Set;status={started:!1};metrics;addr;constructor(t){if(super(),this.context=t,t.keepAlive=t.keepAlive??!0,this.addr="unknown",this.server=Gc.default.createServer(t,this.onSocket.bind(this)),t.maxConnections!==void 0&&(this.server.maxConnections=t.maxConnections),t.closeServerOnMaxConnections!=null&&t.closeServerOnMaxConnections.closeAbove<t.closeServerOnMaxConnections.listenBelow)throw Error("closeAbove must be >= listenBelow");this.server.on("listening",()=>{if(t.metrics!=null){let e=this.server.address();e==null?this.addr="unknown":typeof e=="string"?this.addr=e:this.addr=`${e.address}:${e.port}`,t.metrics?.registerMetricGroup("libp2p_tcp_inbound_connections_total",{label:"address",help:"Current active connections in TCP listener",calculate:()=>({[this.addr]:this.connections.size})}),this.metrics={status:t.metrics.registerMetricGroup("libp2p_tcp_listener_status_info",{label:"address",help:"Current status of the TCP listener socket"}),errors:t.metrics.registerMetricGroup("libp2p_tcp_listener_errors_total",{label:"address",help:"Total count of TCP listener errors by type"}),events:t.metrics.registerMetricGroup("libp2p_tcp_listener_events_total",{label:"address",help:"Total count of TCP listener events by type"})},this.metrics?.status.update({[this.addr]:Uh})}this.dispatchEvent(new Ve("listening"))}).on("error",e=>{this.metrics?.errors.increment({[`${this.addr} listen_error`]:!0}),this.dispatchEvent(new Ve("error",{detail:e}))}).on("close",()=>{this.metrics?.status.update({[this.addr]:Fh}),this.dispatchEvent(new Ve("close"))})}onSocket(t){t.on("error",n=>{gt("socket error",n),this.metrics?.events.increment({[`${this.addr} error`]:!0})});let e;try{e=on(t,{listeningAddr:this.status.started?this.status.listeningAddr:void 0,socketInactivityTimeout:this.context.socketInactivityTimeout,socketCloseTimeout:this.context.socketCloseTimeout,metrics:this.metrics?.events,metricPrefix:`${this.addr} `})}catch(n){gt.error("inbound connection failed",n),this.metrics?.errors.increment({[`${this.addr} inbound_to_connection`]:!0});return}gt("new inbound connection %s",e.remoteAddr);try{this.context.upgrader.upgradeInbound(e).then(n=>{gt("inbound connection upgraded %s",e.remoteAddr),this.connections.add(e),t.once("close",()=>{this.connections.delete(e),this.context.closeServerOnMaxConnections!=null&&this.connections.size<this.context.closeServerOnMaxConnections.listenBelow&&this.netListen().catch(i=>{gt.error("error attempting to listen server once connection count under limit",i),this.context.closeServerOnMaxConnections?.onListenError?.(i)})}),this.context.handler!=null&&this.context.handler(n),this.context.closeServerOnMaxConnections!=null&&this.connections.size>=this.context.closeServerOnMaxConnections.closeAbove&&this.netClose(),this.dispatchEvent(new Ve("connection",{detail:n}))}).catch(async n=>{gt.error("inbound connection failed",n),this.metrics?.errors.increment({[`${this.addr} inbound_upgrade`]:!0}),await Wi(e)}).catch(n=>{gt.error("closing inbound connection failed",n)})}catch(n){gt.error("inbound connection failed",n),Wi(e).catch(i=>{gt.error("closing inbound connection failed",i),this.metrics?.errors.increment({[`${this.addr} inbound_closing_failed`]:!0})})}}getAddrs(){if(!this.status.started)return[];let t=[],e=this.server.address(),{listeningAddr:n,peerId:i}=this.status;if(e==null)return[];if(typeof e=="string")t=[n];else try{n.toString().startsWith("/ip4")?t=t.concat(Hi("ip4",e.address,e.port)):e.family==="IPv6"&&(t=t.concat(Hi("ip6",e.address,e.port)))}catch(s){gt.error("could not turn %s:%s into multiaddr",e.address,e.port,s)}return t.map(s=>i!=null?s.encapsulate(`/p2p/${i}`):s)}async listen(t){if(this.status.started)throw Error("server is already listening");let e=t.getPeerId(),n=e==null?t.decapsulateCode(421):t,{backlog:i}=this.context;this.status={started:!0,listeningAddr:n,peerId:e,netConfig:Ke(n,{backlog:i})},await this.netListen()}async close(){await Promise.all(Array.from(this.connections.values()).map(async t=>{await Wi(t)})),this.netClose()}async netListen(){if(!this.status.started||this.server.listening)return;let t=this.status.netConfig;await new Promise((e,n)=>{this.server.once("error",n),this.server.listen(t,e)}),gt("Listening on %s",this.server.address())}netClose(){!this.status.started||!this.server.listening||(gt("Closing server on %s",this.server.address()),this.server.close())}};var Ht=J("libp2p:tcp"),Zi=class{opts;metrics;components;constructor(t,e={}){this.opts=e,this.components=t,t.metrics!=null&&(this.metrics={dialerEvents:t.metrics.registerCounterGroup("libp2p_tcp_dialer_events_total",{label:"event",help:"Total count of TCP dialer events by type"})})}[Mo]=!0;[Symbol.toStringTag]="@libp2p/tcp";async dial(t,e){e.keepAlive=e.keepAlive??!0;let n=await this._connect(t,e);n.on("error",l=>{Ht("socket error",l)});let i=on(n,{remoteAddr:t,socketInactivityTimeout:this.opts.outboundSocketInactivityTimeout,socketCloseTimeout:this.opts.socketCloseTimeout,metrics:this.metrics?.dialerEvents}),s=()=>{i.close().catch(l=>{Ht.error("Error closing maConn after abort",l)})};e.signal?.addEventListener("abort",s,{once:!0}),Ht("new outbound connection %s",i.remoteAddr);let a=await e.upgrader.upgradeOutbound(i);if(Ht("outbound connection %s upgraded",i.remoteAddr),e.signal?.removeEventListener("abort",s),e.signal?.aborted===!0)throw a.close().catch(l=>{Ht.error("Error closing conn after abort",l)}),new Me;return a}async _connect(t,e){if(e.signal?.aborted===!0)throw new Me;return new Promise((n,i)=>{let s=Date.now(),a=Ke(t),l=a.path??`${a.host??""}:${a.port}`;Ht("dialing %j",a);let f=$c.default.connect(a),d=b=>{b.message=`connection error ${l}: ${b.message}`,this.metrics?.dialerEvents.increment({error:!0}),S(b)},h=()=>{Ht("connection timeout %s",l),this.metrics?.dialerEvents.increment({timeout:!0});let b=new St(`connection timeout after ${Date.now()-s}ms`,"ERR_CONNECT_TIMEOUT");f.emit("error",b)},g=()=>{Ht("connection opened %j",a),this.metrics?.dialerEvents.increment({connect:!0}),S()},w=()=>{Ht("connection aborted %j",a),this.metrics?.dialerEvents.increment({abort:!0}),f.destroy(),S(new Me)},S=b=>{if(f.removeListener("error",d),f.removeListener("timeout",h),f.removeListener("connect",g),e.signal!=null&&e.signal.removeEventListener("abort",w),b!=null){i(b);return}n(f)};f.on("error",d),f.on("timeout",h),f.on("connect",g),e.signal!=null&&e.signal.addEventListener("abort",w)})}createListener(t){return new cn({...t,maxConnections:this.opts.maxConnections,backlog:this.opts.backlog,closeServerOnMaxConnections:this.opts.closeServerOnMaxConnections,socketInactivityTimeout:this.opts.inboundSocketInactivityTimeout,socketCloseTimeout:this.opts.socketCloseTimeout,metrics:this.components.metrics})}filter(t){return t=Array.isArray(t)?t:[t],t.filter(e=>e.protoCodes().includes(290)?!1:e.protoCodes().includes(400)?!0:re.matches(e.decapsulateCode(421)))}};function zc(r={}){return(t={})=>new Zi(t,r)}function zh(r){return r[Symbol.asyncIterator]!=null}function Vh(...r){let t=[];for(let e of r)zh(e)||t.push(e);return t.length===r.length?function*(){for(let e of t)yield*e}():async function*(){let e=jt({objectMode:!0});Promise.resolve().then(async()=>{try{await Promise.all(r.map(async n=>{for await(let i of n)e.push(i)})),e.end()}catch(n){e.end(n)}}),yield*e}()}var Vc=Vh;function an(r,...t){if(r==null)throw new Error("Empty pipeline");if(Ki(r)){let n=r;r=()=>n.source}else if(Wc(r)||Hc(r)){let n=r;r=()=>n}let e=[r,...t];if(e.length>1&&Ki(e[e.length-1])&&(e[e.length-1]=e[e.length-1].sink),e.length>2)for(let n=1;n<e.length-1;n++)Ki(e[n])&&(e[n]=Wh(e[n]));return Hh(...e)}var Hh=(...r)=>{let t;for(;r.length>0;)t=r.shift()(t);return t},Hc=r=>r?.[Symbol.asyncIterator]!=null,Wc=r=>r?.[Symbol.iterator]!=null,Ki=r=>r==null?!1:r.sink!=null&&r.source!=null,Wh=r=>t=>{let e=r.sink(t);if(e?.then!=null){let n=jt({objectMode:!0});e.then(()=>{n.end()},a=>{n.end(a)});let i,s=r.source;if(Hc(s))i=async function*(){yield*s,n.end()};else if(Wc(s))i=function*(){yield*s,n.end()};else throw new Error("Unknown duplex source type - must be Iterable or AsyncIterable");return Vc(n,i())}return r.source};function qh(r){return r[Symbol.asyncIterator]!=null}function Zh(r){if(qh(r))return(async()=>{for await(let t of r);})();for(let t of r);}var Xi=Zh;function W(r){return ue.encode({type:ue.Type.OK,peers:[],...r}).subarray()}function O(r){return ue.encode({type:ue.Type.ERROR,error:{msg:r.message},peers:[]}).subarray()}var un=J("libp2p:daemon-server:dht"),ln=class{dht;constructor(t){let{dht:e}=t;this.dht=e}async*provide(t){try{await Xi(this.dht.provide(t)),yield W()}catch(e){un.error(e),yield O(e)}}async*getClosestPeers(t){yield W({dht:{type:X.Type.BEGIN}});for await(let e of this.dht.getClosestPeers(t))e.name==="PEER_RESPONSE"&&(yield*e.closer.map(n=>X.encode({type:X.Type.VALUE,value:n.id.toBytes()})));yield X.encode({type:X.Type.END})}async*getPublicKey(t){yield O(new Error("FIX ME: not implemented"))}async*getValue(t){try{for await(let e of this.dht.get(t))e.name==="VALUE"&&(yield W({dht:{type:X.Type.VALUE,value:e.value}}))}catch(e){un.error(e),yield O(e)}}async*putValue(t,e){try{await Xi(this.dht.put(t,e)),yield W()}catch(n){un.error(n),yield O(n)}}async*findPeer(t){try{for await(let e of this.dht.findPeer(t))e.name==="FINAL_PEER"&&(yield W({dht:{type:X.Type.VALUE,peer:{id:e.peer.id.toBytes(),addrs:e.peer.multiaddrs.map(n=>n.bytes)}}}));throw new Error("Peer not found")}catch(e){un.error(e),yield O(e)}}async*findProviders(t,e){yield W({dht:{type:X.Type.BEGIN}});try{let n=e,i=0;for await(let s of this.dht.findProviders(t))if(s.name==="PEER_RESPONSE"){for(let a of s.providers)i++,yield X.encode({type:X.Type.VALUE,peer:{id:a.id.toBytes(),addrs:(a.multiaddrs??[]).map(l=>l.bytes)}});if(n===i)break}}catch(n){yield O(n)}yield X.encode({type:X.Type.END})}};var fn=J("libp2p:daemon-server:pubsub"),hn=class{pubsub;constructor(t){let{pubsub:e}=t;this.pubsub=e}async*getTopics(){try{yield W({pubsub:{topics:this.pubsub.getTopics(),peerIDs:[]}})}catch(t){fn.error(t),yield O(t)}}async*subscribe(t){try{let e=jt();this.pubsub.subscribe(t),this.pubsub.addEventListener("message",n=>{let i=n.detail;i.topic===t&&(i.type==="signed"?e.push(Je.encode({from:i.from.toBytes(),data:i.data,seqno:i.sequenceNumber==null?void 0:ar(i.sequenceNumber.toString(16).padStart(16,"0"),"base16"),topicIDs:[i.topic],signature:i.signature,key:i.key}).subarray()):e.push(Je.encode({data:i.data,topicIDs:[i.topic]}).subarray()))}),yield W(),yield*e}catch(e){fn.error(e),yield O(e)}}async*publish(t,e){try{await this.pubsub.publish(t,e),yield W()}catch(n){fn.error(n),yield O(n)}}async*listPeers(t){try{yield W({pubsub:{topics:[t],peerIDs:this.pubsub.getSubscribers(t).map(e=>e.toBytes())}})}catch(e){fn.error(e),yield O(e)}}};var Kh=1<<22,Wt=J("libp2p:daemon-server"),pn=class{multiaddr;libp2p;tcp;listener;dhtOperations;pubsubOperations;constructor(t){let{multiaddr:e,libp2pNode:n}=t;this.multiaddr=e,this.libp2p=n,this.tcp=zc()(),this.listener=this.tcp.createListener({handler:this.handleConnection.bind(this),upgrader:Xn}),this._onExit=this._onExit.bind(this),n.services.dht!=null&&(this.dhtOperations=new ln({dht:n.services.dht})),n.services.pubsub!=null&&(this.pubsubOperations=new hn({pubsub:n.services.pubsub}))}async connect(t){if(t.connect==null||t.connect.addrs==null)throw new Error("Invalid request");let e=t.connect.peer,n=t.connect.addrs.map(s=>dt(s)),i=be(e);return await this.libp2p.peerStore.merge(i,{multiaddrs:n}),this.libp2p.dial(i)}async openStream(t){if(t.streamOpen==null||t.streamOpen.proto==null)throw new Error("Invalid request");let{peer:e,proto:n}=t.streamOpen,i=be(e),s=await this.libp2p.dial(i),a=await s.newStream(n,{runOnTransientConnection:!0});return{streamInfo:{peer:i.toBytes(),addr:s.remoteAddr.bytes,proto:a.protocol??""},connection:a}}async registerStreamHandler(t){if(t.streamHandler==null||t.streamHandler.proto==null)throw new Error("Invalid request");let e=t.streamHandler.proto,n=dt(t.streamHandler.addr),i;await this.libp2p.handle(e,({connection:s,stream:a})=>{Promise.resolve().then(async()=>{i=await this.tcp.dial(n,{upgrader:Xn});let l=Ce.encode({peer:s.remotePeer.toBytes(),addr:s.remoteAddr.bytes,proto:a.protocol??""}),f=Oe.single(l);await an(async function*(){yield f,yield*a.source}(),async function*(d){for await(let h of d)yield*h},i,a.sink)}).catch(async l=>{Wt.error(l),i!=null&&await i.close(l)}).finally(()=>{i?.close().catch(l=>{Wt.error(l)})})},{runOnTransientConnection:!0})}_listen(){process.on("SIGTERM",this._onExit),process.on("SIGINT",this._onExit),process.on("SIGHUP",this._onExit)}_onExit(){this.stop({exit:!0}).catch(t=>{Wt.error(t)})}async start(){this._listen(),await this.libp2p.start(),await this.listener.listen(this.multiaddr)}getMultiaddr(){let t=this.listener.getAddrs();if(t.length>0)return t[0];throw new Error("Not started")}async stop(t={exit:!1}){await this.libp2p.stop(),await this.listener.close(),t.exit&&Wt("server closed, exiting"),process.removeListener("SIGTERM",this._onExit),process.removeListener("SIGINT",this._onExit),process.removeListener("SIGHUP",this._onExit)}async*handlePeerStoreRequest(t){try{switch(t.type){case le.Type.GET_PROTOCOLS:if(t.id==null)throw new Error("Invalid request");let e=be(t.id),i=(await this.libp2p.peerStore.get(e)).protocols;yield W({peerStore:{protos:i}});return;case le.Type.GET_PEER_INFO:throw new Error("ERR_NOT_IMPLEMENTED");default:throw new Error("ERR_INVALID_REQUEST_TYPE")}}catch(e){Wt.error(e),yield O(e)}}async*handlePubsubRequest(t){try{if(this.libp2p.services.pubsub==null||this.pubsubOperations==null)throw new Error("PubSub not configured");switch(t.type){case $t.Type.GET_TOPICS:yield*this.pubsubOperations.getTopics();return;case $t.Type.SUBSCRIBE:if(t.topic==null)throw new Error("Invalid request");yield*this.pubsubOperations.subscribe(t.topic);return;case $t.Type.PUBLISH:if(t.topic==null||t.data==null)throw new Error("Invalid request");yield*this.pubsubOperations.publish(t.topic,t.data);return;case $t.Type.LIST_PEERS:if(t.topic==null)throw new Error("Invalid request");yield*this.pubsubOperations.listPeers(t.topic);return;default:throw new Error("ERR_INVALID_REQUEST_TYPE")}}catch(e){Wt.error(e),yield O(e)}}async*handleDHTRequest(t){try{if(this.libp2p.services.dht==null||this.dhtOperations==null)throw new Error("DHT not configured");switch(t.type){case Et.Type.FIND_PEER:if(t.peer==null)throw new Error("Invalid request");yield*this.dhtOperations.findPeer(be(t.peer));return;case Et.Type.FIND_PROVIDERS:if(t.cid==null)throw new Error("Invalid request");yield*this.dhtOperations.findProviders(ct.decode(t.cid),t.count??20);return;case Et.Type.PROVIDE:if(t.cid==null)throw new Error("Invalid request");yield*this.dhtOperations.provide(ct.decode(t.cid));return;case Et.Type.GET_CLOSEST_PEERS:if(t.key==null)throw new Error("Invalid request");yield*this.dhtOperations.getClosestPeers(t.key);return;case Et.Type.GET_PUBLIC_KEY:if(t.peer==null)throw new Error("Invalid request");yield*this.dhtOperations.getPublicKey(be(t.peer));return;case Et.Type.GET_VALUE:if(t.key==null)throw new Error("Invalid request");yield*this.dhtOperations.getValue(t.key);return;case Et.Type.PUT_VALUE:if(t.key==null||t.value==null)throw new Error("Invalid request");yield*this.dhtOperations.putValue(t.key,t.value);return;default:throw new Error("ERR_INVALID_REQUEST_TYPE")}}catch(e){Wt.error(e),yield O(e)}}handleConnection(t){let e=this,n=new Ur({stream:t,maxLength:Kh});an(n.decoder,i=>async function*(){let s;for await(let a of i)try{switch(s=wt.decode(a),s.type){case wt.Type.CONNECT:{try{await e.connect(s)}catch(l){yield O(l);break}yield W();break}case wt.Type.IDENTIFY:{yield W({identify:{id:e.libp2p.peerId.toBytes(),addrs:e.libp2p.getMultiaddrs().map(l=>l.decapsulateCode(L("p2p").code)).map(l=>l.bytes)}});break}case wt.Type.LIST_PEERS:{let l=[],f=new Set;for(let d of e.libp2p.getConnections()){let h=d.remotePeer.toString();f.has(h)||(f.add(h),l.push({id:d.remotePeer.toBytes(),addrs:[d.remoteAddr.bytes]}))}yield W({peers:l});break}case wt.Type.STREAM_OPEN:{let l;try{l=await e.openStream(s)}catch(d){yield O(d);break}yield W({streamInfo:l.streamInfo});let f=n.rest();await an(f,l.connection,async function*(d){for await(let h of d)yield*h},f);return}case wt.Type.STREAM_HANDLER:{try{await e.registerStreamHandler(s)}catch(l){yield O(l);break}yield W();break}case wt.Type.PEERSTORE:{if(s.peerStore==null){yield O(new Error("ERR_INVALID_REQUEST"));break}yield*e.handlePeerStoreRequest(s.peerStore);break}case wt.Type.PUBSUB:{if(s.pubsub==null){yield O(new Error("ERR_INVALID_REQUEST"));break}yield*e.handlePubsubRequest(s.pubsub);break}case wt.Type.DHT:{if(s.dht==null){yield O(new Error("ERR_INVALID_REQUEST"));break}yield*e.handleDHTRequest(s.dht);break}default:yield O(new Error("ERR_INVALID_REQUEST_TYPE"));break}}catch(l){Wt.error(l),yield O(l);continue}}(),async function(i){for await(let s of i)n.write(s)}).catch(i=>{Wt(i)})}},Xh=(r,t)=>new pn({multiaddr:r,libp2pNode:t});return Ru(Yh);})();
|
|
7
7
|
return Libp2PDaemonServer}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/daemon-server",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"description": "API server for libp2p-daemon instances",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p-daemon/tree/master/packages/libp2p-daemon-server#readme",
|
|
@@ -134,7 +134,7 @@
|
|
|
134
134
|
"release": "aegir release"
|
|
135
135
|
},
|
|
136
136
|
"dependencies": {
|
|
137
|
-
"@chainsafe/libp2p-gossipsub": "^
|
|
137
|
+
"@chainsafe/libp2p-gossipsub": "^10.0.0",
|
|
138
138
|
"@libp2p/daemon-protocol": "^5.0.0",
|
|
139
139
|
"@libp2p/interface": "^0.1.0",
|
|
140
140
|
"@libp2p/kad-dht": "^10.0.0",
|