You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

118 lines
1.7 MiB

(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Ipfs = factory()}(typeof self !== 'undefined' ? self : this, function () {
var Ipfs=(()=>{var bbe=Object.create;var O3=Object.defineProperty;var vbe=Object.getOwnPropertyDescriptor;var wbe=Object.getOwnPropertyNames;var _be=Object.getPrototypeOf,Ebe=Object.prototype.hasOwnProperty;var XO=t=>O3(t,"__esModule",{value:!0});var Ea=typeof require!="undefined"?require:t=>{throw new Error('Dynamic require of "'+t+'" is not supported')};var bt=(t,e)=>()=>(t&&(e=t(t=0)),e);var m=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),zt=(t,e)=>{XO(t);for(var r in e)O3(t,r,{get:e[r],enumerable:!0})},Sbe=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of wbe(e))!Ebe.call(t,i)&&i!=="default"&&O3(t,i,{get:()=>e[i],enumerable:!(r=vbe(e,i))||r.enumerable});return t},M=t=>Sbe(XO(O3(t!=null?bbe(_be(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var JO=m(k3=>{l();"use strict";k3.byteLength=Abe;k3.toByteArray=Tbe;k3.fromByteArray=Cbe;var Sa=[],qs=[],xbe=typeof Uint8Array!="undefined"?Uint8Array:Array,iw="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(El=0,QO=iw.length;El<QO;++El)Sa[El]=iw[El],qs[iw.charCodeAt(El)]=El;var El,QO;qs["-".charCodeAt(0)]=62;qs["_".charCodeAt(0)]=63;function ZO(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var i=r===e?0:4-r%4;return[r,i]}function Abe(t){var e=ZO(t),r=e[0],i=e[1];return(r+i)*3/4-i}function Ibe(t,e,r){return(e+r)*3/4-r}function Tbe(t){var e,r=ZO(t),i=r[0],n=r[1],s=new xbe(Ibe(t,i,n)),o=0,a=n>0?i-4:i,c;for(c=0;c<a;c+=4)e=qs[t.charCodeAt(c)]<<18|qs[t.charCodeAt(c+1)]<<12|qs[t.charCodeAt(c+2)]<<6|qs[t.charCodeAt(c+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return n===2&&(e=qs[t.charCodeAt(c)]<<2|qs[t.charCodeAt(c+1)]>>4,s[o++]=e&255),n===1&&(e=qs[t.charCodeAt(c)]<<10|qs[t.charCodeAt(c+1)]<<4|qs[t.charCodeAt(c+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function Rbe(t){return Sa[t>>18&63]+Sa[t>>12&63]+Sa[t>>6&63]+Sa[t&63]}function Pbe(t,e,r){for(var i,n=[],s=e;s<r;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(t[s+2]&255),n.push(Rbe(i));return n.join("")}function Cbe(t){for(var e,r=t.length,i=r%3,n=[],s=16383,o=0,a=r-i;o<a;o+=s)n.push(Pbe(t,o,o+s>a?a:o+s));return i===1?(e=t[r-1],n.push(Sa[e>>2]+Sa[e<<4&63]+"==")):i===2&&(e=(t[r-2]<<8)+t[r-1],n.push(Sa[e>>10]+Sa[e>>4&63]+Sa[e<<2&63]+"=")),n.join("")}});var ek=m(nw=>{l();nw.read=function(t,e,r,i,n){var s,o,a=n*8-i-1,c=(1<<a)-1,u=c>>1,f=-7,d=r?n-1:0,h=r?-1:1,p=t[e+d];for(d+=h,s=p&(1<<-f)-1,p>>=-f,f+=a;f>0;s=s*256+t[e+d],d+=h,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=i;f>0;o=o*256+t[e+d],d+=h,f-=8);if(s===0)s=1-u;else{if(s===c)return o?NaN:(p?-1:1)*(1/0);o=o+Math.pow(2,i),s=s-u}return(p?-1:1)*o*Math.pow(2,s-i)};nw.write=function(t,e,r,i,n,s){var o,a,c,u=s*8-n-1,f=(1<<u)-1,d=f>>1,h=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:s-1,y=i?1:-1,b=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+d>=1?e+=h/c:e+=h*Math.pow(2,1-d),e*c>=2&&(o++,c/=2),o+d>=f?(a=0,o=f):o+d>=1?(a=(e*c-1)*Math.pow(2,n),o=o+d):(a=e*Math.pow(2,d-1)*Math.pow(2,n),o=0));n>=8;t[r+p]=a&255,p+=y,a/=256,n-=8);for(o=o<<n|a,u+=n;u>0;t[r+p]=o&255,p+=y,o/=256,u-=8);t[r+p-y]|=b*128}});var Ht=m(Bh=>{l();"use strict";var sw=JO(),Oh=ek(),tk=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Bh.Buffer=pe;Bh.SlowBuffer=Mbe;Bh.INSPECT_MAX_BYTES=50;var D3=2147483647;Bh.kMaxLength=D3;pe.TYPED_ARRAY_SUPPORT=Obe();!pe.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Obe(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch(t){return!1}}Object.defineProperty(pe.prototype,"parent",{enumerable:!0,get:function(){if(!!pe.isBuffer(this))return this.buffer}});Object.defineProperty(pe.prototype,"offset",{enumerable:!0,get:function(){if(!!pe.isBuffer(this))return this.byteOffset}});function Uc(t){if(t>D3)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,pe.prototype),e}function pe(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return ow(t)}return rk(t,e,r)}pe.poolSize=8192;function rk(t,e,r){if(typeof t=="string")return Dbe(t,e);if(ArrayBuffer.isView(t))return Bbe(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(xa(t,ArrayBuffer)||t&&xa(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(xa(t,SharedArrayBuffer)||t&&xa(t.buffer,SharedArrayBuffer)))return cw(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=t.valueOf&&t.valueOf();if(i!=null&&i!==t)return pe.from(i,e,r);let n=Nbe(t);if(n)return n;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return pe.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}pe.from=function(t,e,r){return rk(t,e,r)};Object.setPrototypeOf(pe.prototype,Uint8Array.prototype);Object.setPrototypeOf(pe,Uint8Array);function ik(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function kbe(t,e,r){return ik(t),t<=0?Uc(t):e!==void 0?typeof r=="string"?Uc(t).fill(e,r):Uc(t).fill(e):Uc(t)}pe.alloc=function(t,e,r){return kbe(t,e,r)};function ow(t){return ik(t),Uc(t<0?0:uw(t)|0)}pe.allocUnsafe=function(t){return ow(t)};pe.allocUnsafeSlow=function(t){return ow(t)};function Dbe(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!pe.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=nk(t,e)|0,i=Uc(r),n=i.write(t,e);return n!==r&&(i=i.slice(0,n)),i}function aw(t){let e=t.length<0?0:uw(t.length)|0,r=Uc(e);for(let i=0;i<e;i+=1)r[i]=t[i]&255;return r}function Bbe(t){if(xa(t,Uint8Array)){let e=new Uint8Array(t);return cw(e.buffer,e.byteOffset,e.byteLength)}return aw(t)}function cw(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let i;return e===void 0&&r===void 0?i=new Uint8Array(t):r===void 0?i=new Uint8Array(t,e):i=new Uint8Array(t,e,r),Object.setPrototypeOf(i,pe.prototype),i}function Nbe(t){if(pe.isBuffer(t)){let e=uw(t.length)|0,r=Uc(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||dw(t.length)?Uc(0):aw(t);if(t.type==="Buffer"&&Array.isArray(t.data))return aw(t.data)}function uw(t){if(t>=D3)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+D3.toString(16)+" bytes");return t|0}function Mbe(t){return+t!=t&&(t=0),pe.alloc(+t)}pe.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==pe.prototype};pe.compare=function(e,r){if(xa(e,Uint8Array)&&(e=pe.from(e,e.offset,e.byteLength)),xa(r,Uint8Array)&&(r=pe.from(r,r.offset,r.byteLength)),!pe.isBuffer(e)||!pe.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let i=e.length,n=r.length;for(let s=0,o=Math.min(i,n);s<o;++s)if(e[s]!==r[s]){i=e[s],n=r[s];break}return i<n?-1:n<i?1:0};pe.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};pe.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return pe.alloc(0);let i;if(r===void 0)for(r=0,i=0;i<e.length;++i)r+=e[i].length;let n=pe.allocUnsafe(r),s=0;for(i=0;i<e.length;++i){let o=e[i];if(xa(o,Uint8Array))s+o.length>n.length?(pe.isBuffer(o)||(o=pe.from(o)),o.copy(n,s)):Uint8Array.prototype.set.call(n,o,s);else if(pe.isBuffer(o))o.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return n};function nk(t,e){if(pe.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||xa(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&r===0)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return lw(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return gk(t).length;default:if(n)return i?-1:lw(t).length;e=(""+e).toLowerCase(),n=!0}}pe.byteLength=nk;function Lbe(t,e,r){let i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return $be(this,e,r);case"utf8":case"utf-8":return ak(this,e,r);case"ascii":return Hbe(this,e,r);case"latin1":case"binary":return Gbe(this,e,r);case"base64":return Vbe(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Wbe(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}pe.prototype._isBuffer=!0;function Sl(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}pe.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<e;r+=2)Sl(this,r,r+1);return this};pe.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<e;r+=4)Sl(this,r,r+3),Sl(this,r+1,r+2);return this};pe.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<e;r+=8)Sl(this,r,r+7),Sl(this,r+1,r+6),Sl(this,r+2,r+5),Sl(this,r+3,r+4);return this};pe.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?ak(this,0,e):Lbe.apply(this,arguments)};pe.prototype.toLocaleString=pe.prototype.toString;pe.prototype.equals=function(e){if(!pe.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:pe.compare(this,e)===0};pe.prototype.inspect=function(){let e="",r=Bh.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};tk&&(pe.prototype[tk]=pe.prototype.inspect);pe.prototype.compare=function(e,r,i,n,s){if(xa(e,Uint8Array)&&(e=pe.from(e,e.offset,e.byteLength)),!pe.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),i===void 0&&(i=e?e.length:0),n===void 0&&(n=0),s===void 0&&(s=this.length),r<0||i>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&r>=i)return 0;if(n>=s)return-1;if(r>=i)return 1;if(r>>>=0,i>>>=0,n>>>=0,s>>>=0,this===e)return 0;let o=s-n,a=i-r,c=Math.min(o,a),u=this.slice(n,s),f=e.slice(r,i);for(let d=0;d<c;++d)if(u[d]!==f[d]){o=u[d],a=f[d];break}return o<a?-1:a<o?1:0};function sk(t,e,r,i,n){if(t.length===0)return-1;if(typeof r=="string"?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,dw(r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0)if(n)r=0;else return-1;if(typeof e=="string"&&(e=pe.from(e,i)),pe.isBuffer(e))return e.length===0?-1:ok(t,e,r,i,n);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):ok(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function ok(t,e,r,i,n){let s=1,o=t.length,a=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function c(f,d){return s===1?f[d]:f.readUInt16BE(d*s)}let u;if(n){let f=-1;for(u=r;u<o;u++)if(c(t,u)===c(e,f===-1?0:u-f)){if(f===-1&&(f=u),u-f+1===a)return f*s}else f!==-1&&(u-=u-f),f=-1}else for(r+a>o&&(r=o-a),u=r;u>=0;u--){let f=!0;for(let d=0;d<a;d++)if(c(t,u+d)!==c(e,d)){f=!1;break}if(f)return u}return-1}pe.prototype.includes=function(e,r,i){return this.indexOf(e,r,i)!==-1};pe.prototype.indexOf=function(e,r,i){return sk(this,e,r,i,!0)};pe.prototype.lastIndexOf=function(e,r,i){return sk(this,e,r,i,!1)};function qbe(t,e,r,i){r=Number(r)||0;let n=t.length-r;i?(i=Number(i),i>n&&(i=n)):i=n;let s=e.length;i>s/2&&(i=s/2);let o;for(o=0;o<i;++o){let a=parseInt(e.substr(o*2,2),16);if(dw(a))return o;t[r+o]=a}return o}function jbe(t,e,r,i){return B3(lw(e,t.length-r),t,r,i)}function Ube(t,e,r,i){return B3(Zbe(e),t,r,i)}function Fbe(t,e,r,i){return B3(gk(e),t,r,i)}function Kbe(t,e,r,i){return B3(Jbe(e,t.length-r),t,r,i)}pe.prototype.write=function(e,r,i,n){if(r===void 0)n="utf8",i=this.length,r=0;else if(i===void 0&&typeof r=="string")n=r,i=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-r;if((i===void 0||i>s)&&(i=s),e.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return qbe(this,e,r,i);case"utf8":case"utf-8":return jbe(this,e,r,i);case"ascii":case"latin1":case"binary":return Ube(this,e,r,i);case"base64":return Fbe(this,e,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Kbe(this,e,r,i);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}};pe.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Vbe(t,e,r){return e===0&&r===t.length?sw.fromByteArray(t):sw.fromByteArray(t.slice(e,r))}function ak(t,e,r){r=Math.min(t.length,r);let i=[],n=e;for(;n<r;){let s=t[n],o=null,a=s>239?4:s>223?3:s>191?2:1;if(n+a<=r){let c,u,f,d;switch(a){case 1:s<128&&(o=s);break;case 2:c=t[n+1],(c&192)==128&&(d=(s&31)<<6|c&63,d>127&&(o=d));break;case 3:c=t[n+1],u=t[n+2],(c&192)==128&&(u&192)==128&&(d=(s&15)<<12|(c&63)<<6|u&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:c=t[n+1],u=t[n+2],f=t[n+3],(c&192)==128&&(u&192)==128&&(f&192)==128&&(d=(s&15)<<18|(c&63)<<12|(u&63)<<6|f&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,i.push(o>>>10&1023|55296),o=56320|o&1023),i.push(o),n+=a}return zbe(i)}var ck=4096;function zbe(t){let e=t.length;if(e<=ck)return String.fromCharCode.apply(String,t);let r="",i=0;for(;i<e;)r+=String.fromCharCode.apply(String,t.slice(i,i+=ck));return r}function Hbe(t,e,r){let i="";r=Math.min(t.length,r);for(let n=e;n<r;++n)i+=String.fromCharCode(t[n]&127);return i}function Gbe(t,e,r){let i="";r=Math.min(t.length,r);for(let n=e;n<r;++n)i+=String.fromCharCode(t[n]);return i}function $be(t,e,r){let i=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>i)&&(r=i);let n="";for(let s=e;s<r;++s)n+=e5e[t[s]];return n}function Wbe(t,e,r){let i=t.slice(e,r),n="";for(let s=0;s<i.length-1;s+=2)n+=String.fromCharCode(i[s]+i[s+1]*256);return n}pe.prototype.slice=function(e,r){let i=this.length;e=~~e,r=r===void 0?i:~~r,e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),r<e&&(r=e);let n=this.subarray(e,r);return Object.setPrototypeOf(n,pe.prototype),n};function Fi(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}pe.prototype.readUintLE=pe.prototype.readUIntLE=function(e,r,i){e=e>>>0,r=r>>>0,i||Fi(e,r,this.length);let n=this[e],s=1,o=0;for(;++o<r&&(s*=256);)n+=this[e+o]*s;return n};pe.prototype.readUintBE=pe.prototype.readUIntBE=function(e,r,i){e=e>>>0,r=r>>>0,i||Fi(e,r,this.length);let n=this[e+--r],s=1;for(;r>0&&(s*=256);)n+=this[e+--r]*s;return n};pe.prototype.readUint8=pe.prototype.readUInt8=function(e,r){return e=e>>>0,r||Fi(e,1,this.length),this[e]};pe.prototype.readUint16LE=pe.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Fi(e,2,this.length),this[e]|this[e+1]<<8};pe.prototype.readUint16BE=pe.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Fi(e,2,this.length),this[e]<<8|this[e+1]};pe.prototype.readUint32LE=pe.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Fi(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};pe.prototype.readUint32BE=pe.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Fi(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};pe.prototype.readBigUInt64LE=Vu(function(e){e=e>>>0,Dh(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&T2(e,this.length-8);let n=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+i*2**24;return BigInt(n)+(BigInt(s)<<BigInt(32))});pe.prototype.readBigUInt64BE=Vu(function(e){e=e>>>0,Dh(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&T2(e,this.length-8);let n=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+i;return(BigInt(n)<<BigInt(32))+BigInt(s)});pe.prototype.readIntLE=function(e,r,i){e=e>>>0,r=r>>>0,i||Fi(e,r,this.length);let n=this[e],s=1,o=0;for(;++o<r&&(s*=256);)n+=this[e+o]*s;return s*=128,n>=s&&(n-=Math.pow(2,8*r)),n};pe.prototype.readIntBE=function(e,r,i){e=e>>>0,r=r>>>0,i||Fi(e,r,this.length);let n=r,s=1,o=this[e+--n];for(;n>0&&(s*=256);)o+=this[e+--n]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};pe.prototype.readInt8=function(e,r){return e=e>>>0,r||Fi(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};pe.prototype.readInt16LE=function(e,r){e=e>>>0,r||Fi(e,2,this.length);let i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};pe.prototype.readInt16BE=function(e,r){e=e>>>0,r||Fi(e,2,this.length);let i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};pe.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Fi(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};pe.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Fi(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};pe.prototype.readBigInt64LE=Vu(function(e){e=e>>>0,Dh(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&T2(e,this.length-8);let n=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(i<<24);return(BigInt(n)<<BigInt(32))+BigInt(r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});pe.prototype.readBigInt64BE=Vu(function(e){e=e>>>0,Dh(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&T2(e,this.length-8);let n=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+i)});pe.prototype.readFloatLE=function(e,r){return e=e>>>0,r||Fi(e,4,this.length),Oh.read(this,e,!0,23,4)};pe.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Fi(e,4,this.length),Oh.read(this,e,!1,23,4)};pe.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Fi(e,8,this.length),Oh.read(this,e,!0,52,8)};pe.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Fi(e,8,this.length),Oh.read(this,e,!1,52,8)};function Wn(t,e,r,i,n,s){if(!pe.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<s)throw new RangeError('"value" argument is out of bounds');if(r+i>t.length)throw new RangeError("Index out of range")}pe.prototype.writeUintLE=pe.prototype.writeUIntLE=function(e,r,i,n){if(e=+e,r=r>>>0,i=i>>>0,!n){let a=Math.pow(2,8*i)-1;Wn(this,e,r,i,a,0)}let s=1,o=0;for(this[r]=e&255;++o<i&&(s*=256);)this[r+o]=e/s&255;return r+i};pe.prototype.writeUintBE=pe.prototype.writeUIntBE=function(e,r,i,n){if(e=+e,r=r>>>0,i=i>>>0,!n){let a=Math.pow(2,8*i)-1;Wn(this,e,r,i,a,0)}let s=i-1,o=1;for(this[r+s]=e&255;--s>=0&&(o*=256);)this[r+s]=e/o&255;return r+i};pe.prototype.writeUint8=pe.prototype.writeUInt8=function(e,r,i){return e=+e,r=r>>>0,i||Wn(this,e,r,1,255,0),this[r]=e&255,r+1};pe.prototype.writeUint16LE=pe.prototype.writeUInt16LE=function(e,r,i){return e=+e,r=r>>>0,i||Wn(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};pe.prototype.writeUint16BE=pe.prototype.writeUInt16BE=function(e,r,i){return e=+e,r=r>>>0,i||Wn(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};pe.prototype.writeUint32LE=pe.prototype.writeUInt32LE=function(e,r,i){return e=+e,r=r>>>0,i||Wn(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};pe.prototype.writeUint32BE=pe.prototype.writeUInt32BE=function(e,r,i){return e=+e,r=r>>>0,i||Wn(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function uk(t,e,r,i,n){yk(e,i,n,t,r,7);let s=Number(e&BigInt(4294967295));t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,r}function fk(t,e,r,i,n){yk(e,i,n,t,r,7);let s=Number(e&BigInt(4294967295));t[r+7]=s,s=s>>8,t[r+6]=s,s=s>>8,t[r+5]=s,s=s>>8,t[r+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=o,o=o>>8,t[r+2]=o,o=o>>8,t[r+1]=o,o=o>>8,t[r]=o,r+8}pe.prototype.writeBigUInt64LE=Vu(function(e,r=0){return uk(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});pe.prototype.writeBigUInt64BE=Vu(function(e,r=0){return fk(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});pe.prototype.writeIntLE=function(e,r,i,n){if(e=+e,r=r>>>0,!n){let c=Math.pow(2,8*i-1);Wn(this,e,r,i,c-1,-c)}let s=0,o=1,a=0;for(this[r]=e&255;++s<i&&(o*=256);)e<0&&a===0&&this[r+s-1]!==0&&(a=1),this[r+s]=(e/o>>0)-a&255;return r+i};pe.prototype.writeIntBE=function(e,r,i,n){if(e=+e,r=r>>>0,!n){let c=Math.pow(2,8*i-1);Wn(this,e,r,i,c-1,-c)}let s=i-1,o=1,a=0;for(this[r+s]=e&255;--s>=0&&(o*=256);)e<0&&a===0&&this[r+s+1]!==0&&(a=1),this[r+s]=(e/o>>0)-a&255;return r+i};pe.prototype.writeInt8=function(e,r,i){return e=+e,r=r>>>0,i||Wn(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};pe.prototype.writeInt16LE=function(e,r,i){return e=+e,r=r>>>0,i||Wn(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};pe.prototype.writeInt16BE=function(e,r,i){return e=+e,r=r>>>0,i||Wn(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};pe.prototype.writeInt32LE=function(e,r,i){return e=+e,r=r>>>0,i||Wn(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};pe.prototype.writeInt32BE=function(e,r,i){return e=+e,r=r>>>0,i||Wn(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};pe.prototype.writeBigInt64LE=Vu(function(e,r=0){return uk(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});pe.prototype.writeBigInt64BE=Vu(function(e,r=0){return fk(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function lk(t,e,r,i,n,s){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function dk(t,e,r,i,n){return e=+e,r=r>>>0,n||lk(t,e,r,4,34028234663852886e22,-34028234663852886e22),Oh.write(t,e,r,i,23,4),r+4}pe.prototype.writeFloatLE=function(e,r,i){return dk(this,e,r,!0,i)};pe.prototype.writeFloatBE=function(e,r,i){return dk(this,e,r,!1,i)};function hk(t,e,r,i,n){return e=+e,r=r>>>0,n||lk(t,e,r,8,17976931348623157e292,-17976931348623157e292),Oh.write(t,e,r,i,52,8),r+8}pe.prototype.writeDoubleLE=function(e,r,i){return hk(this,e,r,!0,i)};pe.prototype.writeDoubleBE=function(e,r,i){return hk(this,e,r,!1,i)};pe.prototype.copy=function(e,r,i,n){if(!pe.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),r>=e.length&&(r=e.length),r||(r=0),n>0&&n<i&&(n=i),n===i||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-r<n-i&&(n=e.length-r+i);let s=n-i;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,i,n):Uint8Array.prototype.set.call(e,this.subarray(i,n),r),s};pe.prototype.fill=function(e,r,i,n){if(typeof e=="string"){if(typeof r=="string"?(n=r,r=0,i=this.length):typeof i=="string"&&(n=i,i=this.length),n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!pe.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(e.length===1){let o=e.charCodeAt(0);(n==="utf8"&&o<128||n==="latin1")&&(e=o)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<i)throw new RangeError("Out of range index");if(i<=r)return this;r=r>>>0,i=i===void 0?this.length:i>>>0,e||(e=0);let s;if(typeof e=="number")for(s=r;s<i;++s)this[s]=e;else{let o=pe.isBuffer(e)?e:pe.from(e,n),a=o.length;if(a===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<i-r;++s)this[s+r]=o[s%a]}return this};var kh={};function fw(t,e,r){kh[t]=class extends r{constructor(){super();Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(n){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:n,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}fw("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);fw("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);fw("ERR_OUT_OF_RANGE",function(t,e,r){let i=`The value of "${t}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>2**32?n=pk(String(r)):typeof r=="bigint"&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=pk(n)),n+="n"),i+=` It must be ${e}. Received ${n}`,i},RangeError);function pk(t){let e="",r=t.length,i=t[0]==="-"?1:0;for(;r>=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function Ybe(t,e,r){Dh(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&T2(e,t.length-(r+1))}function yk(t,e,r,i,n,s){if(t>r||t<e){let o=typeof e=="bigint"?"n":"",a;throw s>3?e===0||e===BigInt(0)?a=`>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:a=`>= -(2${o} ** ${(s+1)*8-1}${o}) and < 2 ** ${(s+1)*8-1}${o}`:a=`>= ${e}${o} and <= ${r}${o}`,new kh.ERR_OUT_OF_RANGE("value",a,t)}Ybe(i,n,s)}function Dh(t,e){if(typeof t!="number")throw new kh.ERR_INVALID_ARG_TYPE(e,"number",t)}function T2(t,e,r){throw Math.floor(t)!==t?(Dh(t,r),new kh.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new kh.ERR_BUFFER_OUT_OF_BOUNDS:new kh.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var Xbe=/[^+/0-9A-Za-z-_]/g;function Qbe(t){if(t=t.split("=")[0],t=t.trim().replace(Xbe,""),t.length<2)return"";for(;t.length%4!=0;)t=t+"=";return t}function lw(t,e){e=e||1/0;let r,i=t.length,n=null,s=[];for(let o=0;o<i;++o){if(r=t.charCodeAt(o),r>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function Zbe(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function Jbe(t,e){let r,i,n,s=[];for(let o=0;o<t.length&&!((e-=2)<0);++o)r=t.charCodeAt(o),i=r>>8,n=r%256,s.push(n),s.push(i);return s}function gk(t){return sw.toByteArray(Qbe(t))}function B3(t,e,r,i){let n;for(n=0;n<i&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function xa(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function dw(t){return t!==t}var e5e=function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let i=r*16;for(let n=0;n<16;++n)e[i+n]=t[r]+t[n]}return e}();function Vu(t){return typeof BigInt=="undefined"?t5e:t}function t5e(){throw new Error("BigInt not supported")}});var _k=m((dtt,wk)=>{l();var ui=wk.exports={},Aa,Ia;function hw(){throw new Error("setTimeout has not been defined")}function pw(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Aa=setTimeout:Aa=hw}catch(t){Aa=hw}try{typeof clearTimeout=="function"?Ia=clearTimeout:Ia=pw}catch(t){Ia=pw}})();function mk(t){if(Aa===setTimeout)return setTimeout(t,0);if((Aa===hw||!Aa)&&setTimeout)return Aa=setTimeout,setTimeout(t,0);try{return Aa(t,0)}catch(e){try{return Aa.call(null,t,0)}catch(r){return Aa.call(this,t,0)}}}function r5e(t){if(Ia===clearTimeout)return clearTimeout(t);if((Ia===pw||!Ia)&&clearTimeout)return Ia=clearTimeout,clearTimeout(t);try{return Ia(t)}catch(e){try{return Ia.call(null,t)}catch(r){return Ia.call(this,t)}}}var Fc=[],Nh=!1,xl,N3=-1;function i5e(){!Nh||!xl||(Nh=!1,xl.length?Fc=xl.concat(Fc):N3=-1,Fc.length&&bk())}function bk(){if(!Nh){var t=mk(i5e);Nh=!0;for(var e=Fc.length;e;){for(xl=Fc,Fc=[];++N3<e;)xl&&xl[N3].run();N3=-1,e=Fc.length}xl=null,Nh=!1,r5e(t)}}ui.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];Fc.push(new vk(t,e)),Fc.length===1&&!Nh&&mk(bk)};function vk(t,e){this.fun=t,this.array=e}vk.prototype.run=function(){this.fun.apply(null,this.array)};ui.title="browser";ui.browser=!0;ui.env={};ui.argv=[];ui.version="";ui.versions={};function Kc(){}ui.on=Kc;ui.addListener=Kc;ui.once=Kc;ui.off=Kc;ui.removeListener=Kc;ui.removeAllListeners=Kc;ui.emit=Kc;ui.prependListener=Kc;ui.prependOnceListener=Kc;ui.listeners=function(t){return[]};ui.binding=function(t){throw new Error("process.binding is not supported")};ui.cwd=function(){return"/"};ui.chdir=function(t){throw new Error("process.chdir is not supported")};ui.umask=function(){return 0}});var Buffer,process,l=bt(()=>{({Buffer}=Ht()),process=_k()});var Sk=m((ptt,Ek)=>{l();"use strict";Ek.exports=t=>{if(Object.prototype.toString.call(t)!=="[object Object]")return!1;let e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}});var Al=m((Tk,Rk)=>{l();"use strict";var M3=Sk(),{hasOwnProperty:xk}=Object.prototype,{propertyIsEnumerable:n5e}=Object,Mh=(t,e,r)=>Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0}),s5e=Tk,Ak={concatArrays:!1,ignoreUndefined:!1},L3=t=>{let e=[];for(let r in t)xk.call(t,r)&&e.push(r);if(Object.getOwnPropertySymbols){let r=Object.getOwnPropertySymbols(t);for(let i of r)n5e.call(t,i)&&e.push(i)}return e};function Lh(t){return Array.isArray(t)?o5e(t):M3(t)?a5e(t):t}function o5e(t){let e=t.slice(0,0);return L3(t).forEach(r=>{Mh(e,r,Lh(t[r]))}),e}function a5e(t){let e=Object.getPrototypeOf(t)===null?Object.create(null):{};return L3(t).forEach(r=>{Mh(e,r,Lh(t[r]))}),e}var Ik=(t,e,r,i)=>(r.forEach(n=>{typeof e[n]=="undefined"&&i.ignoreUndefined||(n in t&&t[n]!==Object.getPrototypeOf(t)?Mh(t,n,yw(t[n],e[n],i)):Mh(t,n,Lh(e[n])))}),t),c5e=(t,e,r)=>{let i=t.slice(0,0),n=0;return[t,e].forEach(s=>{let o=[];for(let a=0;a<s.length;a++)!xk.call(s,a)||(o.push(String(a)),s===t?Mh(i,n++,s[a]):Mh(i,n++,Lh(s[a])));i=Ik(i,s,L3(s).filter(a=>!o.includes(a)),r)}),i};function yw(t,e,r){return r.concatArrays&&Array.isArray(t)&&Array.isArray(e)?c5e(t,e,r):!M3(e)||!M3(t)?Lh(e):Ik(t,e,L3(e),r)}Rk.exports=function(...t){let e=yw(Lh(Ak),this!==s5e&&this||{},Ak),r={_:{}};for(let i of t)if(i!==void 0){if(!M3(i))throw new TypeError("`"+i+"` is not an Option Object");r=yw(r,{_:i},e)}return r._}});var gw=m((gtt,Ck)=>{l();function u5e(){return typeof window!="undefined"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process!="undefined"&&typeof process.versions=="object"&&!!process.versions.electron||typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Electron")>=0}Ck.exports=u5e});var P2=m((mtt,Ok)=>{l();"use strict";var f5e=gw(),q3=typeof window=="object"&&typeof document=="object"&&document.nodeType===9,R2=f5e(),l5e=q3&&!R2,d5e=R2&&!q3,h5e=R2&&q3,p5e=typeof Ea=="function"&&typeof process!="undefined"&&typeof process.release!="undefined"&&process.release.name==="node"&&!R2,y5e=typeof importScripts=="function"&&typeof self!="undefined"&&typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope,g5e=typeof process!="undefined"&&typeof process.env!="undefined"&&!1,m5e=typeof navigator!="undefined"&&navigator.product==="ReactNative";Ok.exports={isTest:g5e,isElectron:R2,isElectronMain:d5e,isElectronRenderer:h5e,isNode:p5e,isBrowser:l5e,isWebWorker:y5e,isEnvWithDom:q3,isReactNative:m5e}});var mw=m((btt,kk)=>{l();var qh=1e3,jh=qh*60,Uh=jh*60,Il=Uh*24,b5e=Il*7,v5e=Il*365.25;kk.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return w5e(t);if(r==="number"&&isFinite(t))return e.long?E5e(t):_5e(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function w5e(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(!!e){var r=parseFloat(e[1]),i=(e[2]||"ms").toLowerCase();switch(i){case"years":case"year":case"yrs":case"yr":case"y":return r*v5e;case"weeks":case"week":case"w":return r*b5e;case"days":case"day":case"d":return r*Il;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Uh;case"minutes":case"minute":case"mins":case"min":case"m":return r*jh;case"seconds":case"second":case"secs":case"sec":case"s":return r*qh;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function _5e(t){var e=Math.abs(t);return e>=Il?Math.round(t/Il)+"d":e>=Uh?Math.round(t/Uh)+"h":e>=jh?Math.round(t/jh)+"m":e>=qh?Math.round(t/qh)+"s":t+"ms"}function E5e(t){var e=Math.abs(t);return e>=Il?j3(t,e,Il,"day"):e>=Uh?j3(t,e,Uh,"hour"):e>=jh?j3(t,e,jh,"minute"):e>=qh?j3(t,e,qh,"second"):t+" ms"}function j3(t,e,r,i){var n=e>=r*1.5;return Math.round(t/r)+" "+i+(n?"s":"")}});var Bk=m((vtt,Dk)=>{l();function S5e(t){r.debug=r,r.default=r,r.coerce=c,r.disable=s,r.enable=n,r.enabled=o,r.humanize=mw(),r.destroy=u,Object.keys(t).forEach(f=>{r[f]=t[f]}),r.names=[],r.skips=[],r.formatters={};function e(f){let d=0;for(let h=0;h<f.length;h++)d=(d<<5)-d+f.charCodeAt(h),d|=0;return r.colors[Math.abs(d)%r.colors.length]}r.selectColor=e;function r(f){let d,h=null,p,y;function b(...E){if(!b.enabled)return;let v=b,A=Number(new Date),R=A-(d||A);v.diff=R,v.prev=d,v.curr=A,d=A,E[0]=r.coerce(E[0]),typeof E[0]!="string"&&E.unshift("%O");let F=0;E[0]=E[0].replace(/%([a-zA-Z%])/g,(B,H)=>{if(B==="%%")return"%";F++;let W=r.formatters[H];if(typeof W=="function"){let X=E[F];B=W.call(v,X),E.splice(F,1),F--}return B}),r.formatArgs.call(v,E),(v.log||r.log).apply(v,E)}return b.namespace=f,b.useColors=r.useColors(),b.color=r.selectColor(f),b.extend=i,b.destroy=r.destroy,Object.defineProperty(b,"enabled",{enumerable:!0,configurable:!1,get:()=>h!==null?h:(p!==r.namespaces&&(p=r.namespaces,y=r.enabled(f)),y),set:E=>{h=E}}),typeof r.init=="function"&&r.init(b),b}function i(f,d){let h=r(this.namespace+(typeof d=="undefined"?":":d)+f);return h.log=this.log,h}function n(f){r.save(f),r.namespaces=f,r.names=[],r.skips=[];let d,h=(typeof f=="string"?f:"").split(/[\s,]+/),p=h.length;for(d=0;d<p;d++)!h[d]||(f=h[d].replace(/\*/g,".*?"),f[0]==="-"?r.skips.push(new RegExp("^"+f.substr(1)+"$")):r.names.push(new RegExp("^"+f+"$")))}function s(){let f=[...r.names.map(a),...r.skips.map(a).map(d=>"-"+d)].join(",");return r.enable(""),f}function o(f){if(f[f.length-1]==="*")return!0;let d,h;for(d=0,h=r.skips.length;d<h;d++)if(r.skips[d].test(f))return!1;for(d=0,h=r.names.length;d<h;d++)if(r.names[d].test(f))return!0;return!1}function a(f){return f.toString().substring(2,f.toString().length-2).replace(/\.\*\?$/,"*")}function c(f){return f instanceof Error?f.stack||f.message:f}function u(){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 r.enable(r.load()),r}Dk.exports=S5e});var Ee=m((gs,U3)=>{l();gs.formatArgs=A5e;gs.save=I5e;gs.load=T5e;gs.useColors=x5e;gs.storage=R5e();gs.destroy=(()=>{let t=!1;return()=>{t||(t=!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`."))}})();gs.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 x5e(){return typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function A5e(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+U3.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,n=>{n!=="%%"&&(r++,n==="%c"&&(i=r))}),t.splice(i,0,e)}gs.log=console.debug||console.log||(()=>{});function I5e(t){try{t?gs.storage.setItem("debug",t):gs.storage.removeItem("debug")}catch(e){}}function T5e(){let t;try{t=gs.storage.getItem("debug")}catch(e){}return!t&&typeof process!="undefined"&&"env"in process&&(t=process.env.DEBUG),t}function R5e(){try{return localStorage}catch(t){}}U3.exports=Bk()(gs);var{formatters:P5e}=U3.exports;P5e.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Rt=m((wtt,Mk)=>{l();"use strict";function Nk(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function C5e(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return Nk(t,r)}catch(i){r.message=t.message,r.stack=t.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(t)),Nk(new n,r)}}Mk.exports=C5e});var jk=m((_tt,qk)=>{l();"use strict";function Lk(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function O5e(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return Lk(t,r)}catch(i){r.message=t.message,r.stack=t.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(t)),Lk(new n,r)}}qk.exports=O5e});var Fk=m((Ett,Uk)=>{l();"use strict";Uk.exports=k5e;function k5e(t,e){for(var r=new Array(arguments.length-1),i=0,n=2,s=!0;n<arguments.length;)r[i++]=arguments[n++];return new Promise(function(a,c){r[i]=function(f){if(s)if(s=!1,f)c(f);else{for(var d=new Array(arguments.length-1),h=0;h<d.length;)d[h++]=arguments[h];a.apply(null,d)}};try{t.apply(e||null,r)}catch(u){s&&(s=!1,c(u))}})}});var Hk=m(zk=>{l();"use strict";var F3=zk;F3.length=function(e){var r=e.length;if(!r)return 0;for(var i=0;--r%4>1&&e.charAt(r)==="=";)++i;return Math.ceil(e.length*3)/4-i};var Fh=new Array(64),Kk=new Array(123);for(No=0;No<64;)Kk[Fh[No]=No<26?No+65:No<52?No+71:No<62?No-4:No-59|43]=No++;var No;F3.encode=function(e,r,i){for(var n=null,s=[],o=0,a=0,c;r<i;){var u=e[r++];switch(a){case 0:s[o++]=Fh[u>>2],c=(u&3)<<4,a=1;break;case 1:s[o++]=Fh[c|u>>4],c=(u&15)<<2,a=2;break;case 2:s[o++]=Fh[c|u>>6],s[o++]=Fh[u&63],a=0;break}o>8191&&((n||(n=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=Fh[c],s[o++]=61,a===1&&(s[o++]=61)),n?(o&&n.push(String.fromCharCode.apply(String,s.slice(0,o))),n.join("")):String.fromCharCode.apply(String,s.slice(0,o))};var Vk="invalid encoding";F3.decode=function(e,r,i){for(var n=i,s=0,o,a=0;a<e.length;){var c=e.charCodeAt(a++);if(c===61&&s>1)break;if((c=Kk[c])===void 0)throw Error(Vk);switch(s){case 0:o=c,s=1;break;case 1:r[i++]=o<<2|(c&48)>>4,o=c,s=2;break;case 2:r[i++]=(o&15)<<4|(c&60)>>2,o=c,s=3;break;case 3:r[i++]=(o&3)<<6|c,s=0;break}}if(s===1)throw Error(Vk);return i-n};F3.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var $k=m((xtt,Gk)=>{l();"use strict";Gk.exports=K3;function K3(){this._listeners={}}K3.prototype.on=function(e,r,i){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:i||this}),this};K3.prototype.off=function(e,r){if(e===void 0)this._listeners={};else if(r===void 0)this._listeners[e]=[];else for(var i=this._listeners[e],n=0;n<i.length;)i[n].fn===r?i.splice(n,1):++n;return this};K3.prototype.emit=function(e){var r=this._listeners[e];if(r){for(var i=[],n=1;n<arguments.length;)i.push(arguments[n++]);for(n=0;n<r.length;)r[n].fn.apply(r[n++].ctx,i)}return this}});var eD=m((Att,Jk)=>{l();"use strict";Jk.exports=Wk(Wk);function Wk(t){return typeof Float32Array!="undefined"?function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),i=r[3]===128;function n(c,u,f){e[0]=c,u[f]=r[0],u[f+1]=r[1],u[f+2]=r[2],u[f+3]=r[3]}function s(c,u,f){e[0]=c,u[f]=r[3],u[f+1]=r[2],u[f+2]=r[1],u[f+3]=r[0]}t.writeFloatLE=i?n:s,t.writeFloatBE=i?s:n;function o(c,u){return r[0]=c[u],r[1]=c[u+1],r[2]=c[u+2],r[3]=c[u+3],e[0]}function a(c,u){return r[3]=c[u],r[2]=c[u+1],r[1]=c[u+2],r[0]=c[u+3],e[0]}t.readFloatLE=i?o:a,t.readFloatBE=i?a:o}():function(){function e(i,n,s,o){var a=n<0?1:0;if(a&&(n=-n),n===0)i(1/n>0?0:2147483648,s,o);else if(isNaN(n))i(2143289344,s,o);else if(n>34028234663852886e22)i((a<<31|2139095040)>>>0,s,o);else if(n<11754943508222875e-54)i((a<<31|Math.round(n/1401298464324817e-60))>>>0,s,o);else{var c=Math.floor(Math.log(n)/Math.LN2),u=Math.round(n*Math.pow(2,-c)*8388608)&8388607;i((a<<31|c+127<<23|u)>>>0,s,o)}}t.writeFloatLE=e.bind(null,Yk),t.writeFloatBE=e.bind(null,Xk);function r(i,n,s){var o=i(n,s),a=(o>>31)*2+1,c=o>>>23&255,u=o&8388607;return c===255?u?NaN:a*(1/0):c===0?a*1401298464324817e-60*u:a*Math.pow(2,c-150)*(u+8388608)}t.readFloatLE=r.bind(null,Qk),t.readFloatBE=r.bind(null,Zk)}(),typeof Float64Array!="undefined"?function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),i=r[7]===128;function n(c,u,f){e[0]=c,u[f]=r[0],u[f+1]=r[1],u[f+2]=r[2],u[f+3]=r[3],u[f+4]=r[4],u[f+5]=r[5],u[f+6]=r[6],u[f+7]=r[7]}function s(c,u,f){e[0]=c,u[f]=r[7],u[f+1]=r[6],u[f+2]=r[5],u[f+3]=r[4],u[f+4]=r[3],u[f+5]=r[2],u[f+6]=r[1],u[f+7]=r[0]}t.writeDoubleLE=i?n:s,t.writeDoubleBE=i?s:n;function o(c,u){return r[0]=c[u],r[1]=c[u+1],r[2]=c[u+2],r[3]=c[u+3],r[4]=c[u+4],r[5]=c[u+5],r[6]=c[u+6],r[7]=c[u+7],e[0]}function a(c,u){return r[7]=c[u],r[6]=c[u+1],r[5]=c[u+2],r[4]=c[u+3],r[3]=c[u+4],r[2]=c[u+5],r[1]=c[u+6],r[0]=c[u+7],e[0]}t.readDoubleLE=i?o:a,t.readDoubleBE=i?a:o}():function(){function e(i,n,s,o,a,c){var u=o<0?1:0;if(u&&(o=-o),o===0)i(0,a,c+n),i(1/o>0?0:2147483648,a,c+s);else if(isNaN(o))i(0,a,c+n),i(2146959360,a,c+s);else if(o>17976931348623157e292)i(0,a,c+n),i((u<<31|2146435072)>>>0,a,c+s);else{var f;if(o<22250738585072014e-324)f=o/5e-324,i(f>>>0,a,c+n),i((u<<31|f/4294967296)>>>0,a,c+s);else{var d=Math.floor(Math.log(o)/Math.LN2);d===1024&&(d=1023),f=o*Math.pow(2,-d),i(f*4503599627370496>>>0,a,c+n),i((u<<31|d+1023<<20|f*1048576&1048575)>>>0,a,c+s)}}}t.writeDoubleLE=e.bind(null,Yk,0,4),t.writeDoubleBE=e.bind(null,Xk,4,0);function r(i,n,s,o,a){var c=i(o,a+n),u=i(o,a+s),f=(u>>31)*2+1,d=u>>>20&2047,h=4294967296*(u&1048575)+c;return d===2047?h?NaN:f*(1/0):d===0?f*5e-324*h:f*Math.pow(2,d-1075)*(h+4503599627370496)}t.readDoubleLE=r.bind(null,Qk,0,4),t.readDoubleBE=r.bind(null,Zk,4,0)}(),t}function Yk(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}function Xk(t,e,r){e[r]=t>>>24,e[r+1]=t>>>16&255,e[r+2]=t>>>8&255,e[r+3]=t&255}function Qk(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function Zk(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var tD=m((exports,module)=>{l();"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(t){}return null}});var iD=m(rD=>{l();"use strict";var bw=rD;bw.length=function(e){for(var r=0,i=0,n=0;n<e.length;++n)i=e.charCodeAt(n),i<128?r+=1:i<2048?r+=2:(i&64512)==55296&&(e.charCodeAt(n+1)&64512)==56320?(++n,r+=4):r+=3;return r};bw.read=function(e,r,i){var n=i-r;if(n<1)return"";for(var s=null,o=[],a=0,c;r<i;)c=e[r++],c<128?o[a++]=c:c>191&&c<224?o[a++]=(c&31)<<6|e[r++]&63:c>239&&c<365?(c=((c&7)<<18|(e[r++]&63)<<12|(e[r++]&63)<<6|e[r++]&63)-65536,o[a++]=55296+(c>>10),o[a++]=56320+(c&1023)):o[a++]=(c&15)<<12|(e[r++]&63)<<6|e[r++]&63,a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),a=0);return s?(a&&s.push(String.fromCharCode.apply(String,o.slice(0,a))),s.join("")):String.fromCharCode.apply(String,o.slice(0,a))};bw.write=function(e,r,i){for(var n=i,s,o,a=0;a<e.length;++a)s=e.charCodeAt(a),s<128?r[i++]=s:s<2048?(r[i++]=s>>6|192,r[i++]=s&63|128):(s&64512)==55296&&((o=e.charCodeAt(a+1))&64512)==56320?(s=65536+((s&1023)<<10)+(o&1023),++a,r[i++]=s>>18|240,r[i++]=s>>12&63|128,r[i++]=s>>6&63|128,r[i++]=s&63|128):(r[i++]=s>>12|224,r[i++]=s>>6&63|128,r[i++]=s&63|128);return i-n}});var sD=m((Ttt,nD)=>{l();"use strict";nD.exports=D5e;function D5e(t,e,r){var i=r||8192,n=i>>>1,s=null,o=i;return function(c){if(c<1||c>n)return t(c);o+c>i&&(s=t(i),o=0);var u=e.call(s,o,o+=c);return o&7&&(o=(o|7)+1),u}}});var aD=m((Rtt,oD)=>{l();"use strict";oD.exports=Ki;var C2=Hu();function Ki(t,e){this.lo=t>>>0,this.hi=e>>>0}var Tl=Ki.zero=new Ki(0,0);Tl.toNumber=function(){return 0};Tl.zzEncode=Tl.zzDecode=function(){return this};Tl.length=function(){return 1};var B5e=Ki.zeroHash="\0\0\0\0\0\0\0\0";Ki.fromNumber=function(e){if(e===0)return Tl;var r=e<0;r&&(e=-e);var i=e>>>0,n=(e-i)/4294967296>>>0;return r&&(n=~n>>>0,i=~i>>>0,++i>4294967295&&(i=0,++n>4294967295&&(n=0))),new Ki(i,n)};Ki.from=function(e){if(typeof e=="number")return Ki.fromNumber(e);if(C2.isString(e))if(C2.Long)e=C2.Long.fromString(e);else return Ki.fromNumber(parseInt(e,10));return e.low||e.high?new Ki(e.low>>>0,e.high>>>0):Tl};Ki.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var r=~this.lo+1>>>0,i=~this.hi>>>0;return r||(i=i+1>>>0),-(r+i*4294967296)}return this.lo+this.hi*4294967296};Ki.prototype.toLong=function(e){return C2.Long?new C2.Long(this.lo|0,this.hi|0,Boolean(e)):{low:this.lo|0,high:this.hi|0,unsigned:Boolean(e)}};var zu=String.prototype.charCodeAt;Ki.fromHash=function(e){return e===B5e?Tl:new Ki((zu.call(e,0)|zu.call(e,1)<<8|zu.call(e,2)<<16|zu.call(e,3)<<24)>>>0,(zu.call(e,4)|zu.call(e,5)<<8|zu.call(e,6)<<16|zu.call(e,7)<<24)>>>0)};Ki.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)};Ki.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this};Ki.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};Ki.prototype.length=function(){var e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,i=this.hi>>>24;return i===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:i<128?9:10}});var Hu=m(vw=>{l();"use strict";var $e=vw;$e.asPromise=Fk();$e.base64=Hk();$e.EventEmitter=$k();$e.float=eD();$e.inquire=tD();$e.utf8=iD();$e.pool=sD();$e.LongBits=aD();$e.isNode=Boolean(typeof globalThis!="undefined"&&globalThis&&globalThis.process&&globalThis.process.versions&&globalThis.process.versions.node);$e.global=$e.isNode&&globalThis||typeof window!="undefined"&&window||typeof self!="undefined"&&self||vw;$e.emptyArray=Object.freeze?Object.freeze([]):[];$e.emptyObject=Object.freeze?Object.freeze({}):{};$e.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};$e.isString=function(e){return typeof e=="string"||e instanceof String};$e.isObject=function(e){return e&&typeof e=="object"};$e.isset=$e.isSet=function(e,r){var i=e[r];return i!=null&&e.hasOwnProperty(r)?typeof i!="object"||(Array.isArray(i)?i.length:Object.keys(i).length)>0:!1};$e.Buffer=function(){try{var t=$e.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch(e){return null}}();$e._Buffer_from=null;$e._Buffer_allocUnsafe=null;$e.newBuffer=function(e){return typeof e=="number"?$e.Buffer?$e._Buffer_allocUnsafe(e):new $e.Array(e):$e.Buffer?$e._Buffer_from(e):typeof Uint8Array=="undefined"?e:new Uint8Array(e)};$e.Array=typeof Uint8Array!="undefined"?Uint8Array:Array;$e.Long=$e.global.dcodeIO&&$e.global.dcodeIO.Long||$e.global.Long||$e.inquire("long");$e.key2Re=/^true|false|0|1$/;$e.key32Re=/^-?(?:0|[1-9][0-9]*)$/;$e.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;$e.longToHash=function(e){return e?$e.LongBits.from(e).toHash():$e.LongBits.zeroHash};$e.longFromHash=function(e,r){var i=$e.LongBits.fromHash(e);return $e.Long?$e.Long.fromBits(i.lo,i.hi,r):i.toNumber(Boolean(r))};function cD(t,e,r){for(var i=Object.keys(e),n=0;n<i.length;++n)(t[i[n]]===void 0||!r)&&(t[i[n]]=e[i[n]]);return t}$e.merge=cD;$e.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)};function uD(t){function e(r,i){if(!(this instanceof e))return new e(r,i);Object.defineProperty(this,"message",{get:function(){return r}}),Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:new Error().stack||""}),i&&cD(this,i)}return(e.prototype=Object.create(Error.prototype)).constructor=e,Object.defineProperty(e.prototype,"name",{get:function(){return t}}),e.prototype.toString=function(){return this.name+": "+this.message},e}$e.newError=uD;$e.ProtocolError=uD("ProtocolError");$e.oneOfGetter=function(e){for(var r={},i=0;i<e.length;++i)r[e[i]]=1;return function(){for(var n=Object.keys(this),s=n.length-1;s>-1;--s)if(r[n[s]]===1&&this[n[s]]!==void 0&&this[n[s]]!==null)return n[s]}};$e.oneOfSetter=function(e){return function(r){for(var i=0;i<e.length;++i)e[i]!==r&&delete this[e[i]]}};$e.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};$e._configure=function(){var t=$e.Buffer;if(!t){$e._Buffer_from=$e._Buffer_allocUnsafe=null;return}$e._Buffer_from=t.from!==Uint8Array.from&&t.from||function(r,i){return new t(r,i)},$e._Buffer_allocUnsafe=t.allocUnsafe||function(r){return new t(r)}}});var Iw=m((Ctt,hD)=>{l();"use strict";hD.exports=jt;var js=Hu(),ww,V3=js.LongBits,fD=js.base64,lD=js.utf8;function O2(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function _w(){}function N5e(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function jt(){this.len=0,this.head=new O2(_w,0,0),this.tail=this.head,this.states=null}var dD=function(){return js.Buffer?function(){return(jt.create=function(){return new ww})()}:function(){return new jt}};jt.create=dD();jt.alloc=function(e){return new js.Array(e)};js.Array!==Array&&(jt.alloc=js.pool(jt.alloc,js.Array.prototype.subarray));jt.prototype._push=function(e,r,i){return this.tail=this.tail.next=new O2(e,r,i),this.len+=r,this};function Ew(t,e,r){e[r]=t&255}function M5e(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function Sw(t,e){this.len=t,this.next=void 0,this.val=e}Sw.prototype=Object.create(O2.prototype);Sw.prototype.fn=M5e;jt.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new Sw((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};jt.prototype.int32=function(e){return e<0?this._push(xw,10,V3.fromNumber(e)):this.uint32(e)};jt.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function xw(t,e,r){for(;t.hi;)e[r++]=t.lo&127|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[r++]=t.lo&127|128,t.lo=t.lo>>>7;e[r++]=t.lo}jt.prototype.uint64=function(e){var r=V3.from(e);return this._push(xw,r.length(),r)};jt.prototype.int64=jt.prototype.uint64;jt.prototype.sint64=function(e){var r=V3.from(e).zzEncode();return this._push(xw,r.length(),r)};jt.prototype.bool=function(e){return this._push(Ew,1,e?1:0)};function Aw(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}jt.prototype.fixed32=function(e){return this._push(Aw,4,e>>>0)};jt.prototype.sfixed32=jt.prototype.fixed32;jt.prototype.fixed64=function(e){var r=V3.from(e);return this._push(Aw,4,r.lo)._push(Aw,4,r.hi)};jt.prototype.sfixed64=jt.prototype.fixed64;jt.prototype.float=function(e){return this._push(js.float.writeFloatLE,4,e)};jt.prototype.double=function(e){return this._push(js.float.writeDoubleLE,8,e)};var L5e=js.Array.prototype.set?function(e,r,i){r.set(e,i)}:function(e,r,i){for(var n=0;n<e.length;++n)r[i+n]=e[n]};jt.prototype.bytes=function(e){var r=e.length>>>0;if(!r)return this._push(Ew,1,0);if(js.isString(e)){var i=jt.alloc(r=fD.length(e));fD.decode(e,i,0),e=i}return this.uint32(r)._push(L5e,r,e)};jt.prototype.string=function(e){var r=lD.length(e);return r?this.uint32(r)._push(lD.write,r,e):this._push(Ew,1,0)};jt.prototype.fork=function(){return this.states=new N5e(this),this.head=this.tail=new O2(_w,0,0),this.len=0,this};jt.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 O2(_w,0,0),this.len=0),this};jt.prototype.ldelim=function(){var e=this.head,r=this.tail,i=this.len;return this.reset().uint32(i),i&&(this.tail.next=e.next,this.tail=r,this.len+=i),this};jt.prototype.finish=function(){for(var e=this.head.next,r=this.constructor.alloc(this.len),i=0;e;)e.fn(e.val,r,i),i+=e.len,e=e.next;return r};jt._configure=function(t){ww=t,jt.create=dD(),ww._configure()}});var gD=m((Ott,yD)=>{l();"use strict";yD.exports=Ta;var pD=Iw();(Ta.prototype=Object.create(pD.prototype)).constructor=Ta;var Gu=Hu();function Ta(){pD.call(this)}Ta._configure=function(){Ta.alloc=Gu._Buffer_allocUnsafe,Ta.writeBytesBuffer=Gu.Buffer&&Gu.Buffer.prototype instanceof Uint8Array&&Gu.Buffer.prototype.set.name==="set"?function(e,r,i){r.set(e,i)}:function(e,r,i){if(e.copy)e.copy(r,i,0,e.length);else for(var n=0;n<e.length;)r[i++]=e[n++]}};Ta.prototype.bytes=function(e){Gu.isString(e)&&(e=Gu._Buffer_from(e,"base64"));var r=e.length>>>0;return this.uint32(r),r&&this._push(Ta.writeBytesBuffer,r,e),this};function q5e(t,e,r){t.length<40?Gu.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}Ta.prototype.string=function(e){var r=Gu.Buffer.byteLength(e);return this.uint32(r),r&&this._push(q5e,r,e),this};Ta._configure()});var Pw=m((ktt,_D)=>{l();"use strict";_D.exports=fi;var Ra=Hu(),Tw,mD=Ra.LongBits,j5e=Ra.utf8;function Mo(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function fi(t){this.buf=t,this.pos=0,this.len=t.length}var bD=typeof Uint8Array!="undefined"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new fi(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new fi(e);throw Error("illegal buffer")},vD=function(){return Ra.Buffer?function(r){return(fi.create=function(n){return Ra.Buffer.isBuffer(n)?new Tw(n):bD(n)})(r)}:bD};fi.create=vD();fi.prototype._slice=Ra.Array.prototype.subarray||Ra.Array.prototype.slice;fi.prototype.uint32=function(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,Mo(this,10);return e}}();fi.prototype.int32=function(){return this.uint32()|0};fi.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function Rw(){var t=new mD(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw Mo(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw Mo(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}fi.prototype.bool=function(){return this.uint32()!==0};function z3(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}fi.prototype.fixed32=function(){if(this.pos+4>this.len)throw Mo(this,4);return z3(this.buf,this.pos+=4)};fi.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Mo(this,4);return z3(this.buf,this.pos+=4)|0};function wD(){if(this.pos+8>this.len)throw Mo(this,8);return new mD(z3(this.buf,this.pos+=4),z3(this.buf,this.pos+=4))}fi.prototype.float=function(){if(this.pos+4>this.len)throw Mo(this,4);var e=Ra.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};fi.prototype.double=function(){if(this.pos+8>this.len)throw Mo(this,4);var e=Ra.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};fi.prototype.bytes=function(){var e=this.uint32(),r=this.pos,i=this.pos+e;if(i>this.len)throw Mo(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(r,i):r===i?new this.buf.constructor(0):this._slice.call(this.buf,r,i)};fi.prototype.string=function(){var e=this.bytes();return j5e.read(e,0,e.length)};fi.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Mo(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Mo(this);while(this.buf[this.pos++]&128);return this};fi.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!=4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this};fi._configure=function(t){Tw=t,fi.create=vD(),Tw._configure();var e=Ra.Long?"toLong":"toNumber";Ra.merge(fi.prototype,{int64:function(){return Rw.call(this)[e](!1)},uint64:function(){return Rw.call(this)[e](!0)},sint64:function(){return Rw.call(this).zzDecode()[e](!1)},fixed64:function(){return wD.call(this)[e](!0)},sfixed64:function(){return wD.call(this)[e](!1)}})}});var AD=m((Dtt,xD)=>{l();"use strict";xD.exports=Rl;var ED=Pw();(Rl.prototype=Object.create(ED.prototype)).constructor=Rl;var SD=Hu();function Rl(t){ED.call(this,t)}Rl._configure=function(){SD.Buffer&&(Rl.prototype._slice=SD.Buffer.prototype.slice)};Rl.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))};Rl._configure()});var TD=m((Btt,ID)=>{l();"use strict";ID.exports=k2;var Cw=Hu();(k2.prototype=Object.create(Cw.EventEmitter.prototype)).constructor=k2;function k2(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");Cw.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=Boolean(e),this.responseDelimited=Boolean(r)}k2.prototype.rpcCall=function t(e,r,i,n,s){if(!n)throw TypeError("request must be specified");var o=this;if(!s)return Cw.asPromise(t,o,e,r,i,n);if(!o.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return o.rpcImpl(e,r[o.requestDelimited?"encodeDelimited":"encode"](n).finish(),function(c,u){if(c)return o.emit("error",c,e),s(c);if(u===null){o.end(!0);return}if(!(u instanceof i))try{u=i[o.responseDelimited?"decodeDelimited":"decode"](u)}catch(f){return o.emit("error",f,e),s(f)}return o.emit("data",u,e),s(null,u)})}catch(a){o.emit("error",a,e),setTimeout(function(){s(a)},0);return}};k2.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var PD=m(RD=>{l();"use strict";var U5e=RD;U5e.Service=TD()});var OD=m((Mtt,CD)=>{l();"use strict";CD.exports={}});var BD=m(DD=>{l();"use strict";var Yn=DD;Yn.build="minimal";Yn.Writer=Iw();Yn.BufferWriter=gD();Yn.Reader=Pw();Yn.BufferReader=AD();Yn.util=Hu();Yn.rpc=PD();Yn.roots=OD();Yn.configure=kD;function kD(){Yn.util._configure(),Yn.Writer._configure(Yn.BufferWriter),Yn.Reader._configure(Yn.BufferReader)}kD()});var Vi=m((qtt,ND)=>{l();"use strict";ND.exports=BD()});function FD(t,e,r){e=e||[],r=r||0;for(var i=r;t>=H5e;)e[r++]=t&255|UD,t/=128;for(;t&z5e;)e[r++]=t&255|UD,t>>>=7;return e[r]=t|0,FD.bytes=r-i+1,e}function kw(t,e){var r=0,e=e||0,i=0,n=e,s,o=t.length;do{if(n>=o)throw kw.bytes=0,new RangeError("Could not decode varint");s=t[n++],r+=i<28?(s&KD)<<i:(s&KD)*Math.pow(2,i),i+=7}while(s>=$5e);return kw.bytes=n-e,r}var K5e,UD,V5e,z5e,H5e,G5e,$5e,KD,W5e,Y5e,X5e,Q5e,Z5e,J5e,e8e,t8e,r8e,i8e,n8e,s8e,D2,VD=bt(()=>{l();K5e=FD,UD=128,V5e=127,z5e=~V5e,H5e=Math.pow(2,31);G5e=kw,$5e=128,KD=127;W5e=Math.pow(2,7),Y5e=Math.pow(2,14),X5e=Math.pow(2,21),Q5e=Math.pow(2,28),Z5e=Math.pow(2,35),J5e=Math.pow(2,42),e8e=Math.pow(2,49),t8e=Math.pow(2,56),r8e=Math.pow(2,63),i8e=function(t){return t<W5e?1:t<Y5e?2:t<X5e?3:t<Q5e?4:t<Z5e?5:t<J5e?6:t<e8e?7:t<t8e?8:t<r8e?9:10},n8e={encode:K5e,decode:G5e,encodingLength:i8e},s8e=n8e,D2=s8e});var B2,zh,Hh,G3=bt(()=>{l();VD();B2=t=>[D2.decode(t),D2.decode.bytes],zh=(t,e,r=0)=>(D2.encode(t,e,r),e),Hh=t=>D2.encodingLength(t)});var Gh={};zt(Gh,{coerce:()=>Us,empty:()=>HD,equals:()=>Dw,fromHex:()=>a8e,fromString:()=>Bw,isBinary:()=>c8e,toHex:()=>o8e,toString:()=>Nw});var HD,o8e,a8e,Dw,Us,c8e,Bw,Nw,$u=bt(()=>{l();HD=new Uint8Array(0),o8e=t=>t.reduce((e,r)=>e+r.toString(16).padStart(2,"0"),""),a8e=t=>{let e=t.match(/../g);return e?new Uint8Array(e.map(r=>parseInt(r,16))):HD},Dw=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0},Us=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},c8e=t=>t instanceof ArrayBuffer||ArrayBuffer.isView(t),Bw=t=>new TextEncoder().encode(t),Nw=t=>new TextDecoder().decode(t)});var Wh={};zt(Wh,{Digest:()=>$h,create:()=>N2,decode:()=>Ri,equals:()=>Mw});var N2,Ri,Mw,$h,Bn=bt(()=>{l();$u();G3();N2=(t,e)=>{let r=e.byteLength,i=Hh(t),n=i+Hh(r),s=new Uint8Array(n+r);return zh(t,s,0),zh(r,s,i),s.set(e,n),new $h(t,r,e,s)},Ri=t=>{let e=Us(t),[r,i]=B2(e),[n,s]=B2(e.subarray(i)),o=e.subarray(i+s);if(o.byteLength!==n)throw new Error("Incorrect length");return new $h(r,n,o,e)},Mw=(t,e)=>t===e?!0:t.code===e.code&&t.size===e.size&&Dw(t.bytes,e.bytes),$h=class{constructor(e,r,i,n){this.code=e,this.size=r,this.digest=i,this.bytes=n}}});function u8e(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),i=0;i<r.length;i++)r[i]=255;for(var n=0;n<t.length;n++){var s=t.charAt(n),o=s.charCodeAt(0);if(r[o]!==255)throw new TypeError(s+" is ambiguous");r[o]=n}var a=t.length,c=t.charAt(0),u=Math.log(a)/Math.log(256),f=Math.log(256)/Math.log(a);function d(y){if(y instanceof Uint8Array||(ArrayBuffer.isView(y)?y=new Uint8Array(y.buffer,y.byteOffset,y.byteLength):Array.isArray(y)&&(y=Uint8Array.from(y))),!(y instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(y.length===0)return"";for(var b=0,E=0,v=0,A=y.length;v!==A&&y[v]===0;)v++,b++;for(var R=(A-v)*f+1>>>0,F=new Uint8Array(R);v!==A;){for(var D=y[v],B=0,H=R-1;(D!==0||B<E)&&H!==-1;H--,B++)D+=256*F[H]>>>0,F[H]=D%a>>>0,D=D/a>>>0;if(D!==0)throw new Error("Non-zero carry");E=B,v++}for(var W=R-E;W!==R&&F[W]===0;)W++;for(var X=c.repeat(b);W<R;++W)X+=t.charAt(F[W]);return X}function h(y){if(typeof y!="string")throw new TypeError("Expected String");if(y.length===0)return new Uint8Array;var b=0;if(y[b]!==" "){for(var E=0,v=0;y[b]===c;)E++,b++;for(var A=(y.length-b)*u+1>>>0,R=new Uint8Array(A);y[b];){var F=r[y.charCodeAt(b)];if(F===255)return;for(var D=0,B=A-1;(F!==0||D<v)&&B!==-1;B--,D++)F+=a*R[B]>>>0,R[B]=F%256>>>0,F=F/256>>>0;if(F!==0)throw new Error("Non-zero carry");v=D,b++}if(y[b]!==" "){for(var H=A-v;H!==A&&R[H]===0;)H++;for(var W=new Uint8Array(E+(A-H)),X=E;H!==A;)W[X++]=R[H++];return W}}}function p(y){var b=h(y);if(b)return b;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:h,decode:p}}var f8e,l8e,GD,$D=bt(()=>{l();f8e=u8e,l8e=f8e,GD=l8e});var WD,YD,$3,XD,W3,Wu,d8e,h8e,Qr,Pa=bt(()=>{l();$D();$u();WD=class{constructor(e,r,i){this.name=e,this.prefix=r,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},YD=class{constructor(e,r,i){this.name=e,this.prefix=r,this.baseDecode=i}decode(e){if(typeof e=="string")switch(e[0]){case this.prefix:return this.baseDecode(e.slice(1));default:throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`)}else throw Error("Can only multibase decode strings")}or(e){let r={[this.prefix]:this,...e.decoders||{[e.prefix]:e}};return new $3(r)}},$3=class{constructor(e){this.decoders=e}or(e){let r=e.decoders||{[e.prefix]:e};return new $3({...this.decoders,...r})}decode(e){let r=e[0],i=this.decoders[r];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},XD=class{constructor(e,r,i,n){this.name=e,this.prefix=r,this.baseEncode=i,this.baseDecode=n,this.encoder=new WD(e,r,i),this.decoder=new YD(e,r,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},W3=({name:t,prefix:e,encode:r,decode:i})=>new XD(t,e,r,i),Wu=({prefix:t,name:e,alphabet:r})=>{let{encode:i,decode:n}=GD(r,e);return W3({prefix:t,name:e,encode:i,decode:s=>Us(n(s))})},d8e=(t,e,r,i)=>{let n={};for(let f=0;f<e.length;++f)n[e[f]]=f;let s=t.length;for(;t[s-1]==="=";)--s;let o=new Uint8Array(s*r/8|0),a=0,c=0,u=0;for(let f=0;f<s;++f){let d=n[t[f]];if(d===void 0)throw new SyntaxError(`Non-${i} character`);c=c<<r|d,a+=r,a>=8&&(a-=8,o[u++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o},h8e=(t,e,r)=>{let i=e[e.length-1]==="=",n=(1<<r)-1,s="",o=0,a=0;for(let c=0;c<t.length;++c)for(a=a<<8|t[c],o+=8;o>r;)o-=r,s+=e[n&a>>o];if(o&&(s+=e[n&a<<r-o]),i)for(;s.length*r&7;)s+="=";return s},Qr=({name:t,prefix:e,bitsPerChar:r,alphabet:i})=>W3({prefix:e,name:t,encode(n){return h8e(n,i,r)},decode(n){return d8e(n,i,r,t)}})});var Fs={};zt(Fs,{base58btc:()=>pt,base58flickr:()=>p8e});var pt,p8e,li=bt(()=>{l();Pa();pt=Wu({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),p8e=Wu({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var Yu={};zt(Yu,{base32:()=>rr,base32hex:()=>g8e,base32hexpad:()=>b8e,base32hexpadupper:()=>v8e,base32hexupper:()=>m8e,base32pad:()=>qw,base32padupper:()=>y8e,base32upper:()=>Lw,base32z:()=>w8e});var rr,Lw,qw,y8e,g8e,m8e,b8e,v8e,w8e,yn=bt(()=>{l();Pa();rr=Qr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Lw=Qr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),qw=Qr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),y8e=Qr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),g8e=Qr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),m8e=Qr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),b8e=Qr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),v8e=Qr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),w8e=Qr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var Xu={};zt(Xu,{CID:()=>J});var J,_8e,E8e,S8e,M2,x8e,QD,ZD,Y3,X3,A8e,I8e,T8e,Te=bt(()=>{l();G3();Bn();li();yn();$u();J=class{constructor(e,r,i,n){this.code=r,this.version=e,this.multihash=i,this.bytes=n,this.byteOffset=n.byteOffset,this.byteLength=n.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:X3,byteLength:X3,code:Y3,version:Y3,multihash:Y3,bytes:Y3,_baseCache:X3,asCID:X3})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:r}=this;if(e!==M2)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==x8e)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return J.createV0(r)}}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,i=N2(e,r);return J.createV1(this.code,i)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}equals(e){return e&&this.code===e.code&&this.version===e.version&&Mw(this.multihash,e.multihash)}toString(e){let{bytes:r,version:i,_baseCache:n}=this;switch(i){case 0:return E8e(r,n,e||pt.encoder);default:return S8e(r,n,e||rr.encoder)}}toJSON(){return{code:this.code,version:this.version,hash:this.multihash.bytes}}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}static isCID(e){return I8e(/^0\.0/,T8e),!!(e&&(e[ZD]||e.asCID===e))}get toBaseEncodedString(){throw new Error("Deprecated, use .toString()")}get codec(){throw new Error('"codec" property is deprecated, use integer "code" property instead')}get buffer(){throw new Error("Deprecated .buffer property, use .bytes to get Uint8Array instead")}get multibaseName(){throw new Error('"multibaseName" property is deprecated')}get prefix(){throw new Error('"prefix" property is deprecated')}static asCID(e){if(e instanceof J)return e;if(e!=null&&e.asCID===e){let{version:r,code:i,multihash:n,bytes:s}=e;return new J(r,i,n,s||QD(r,i,n.bytes))}else if(e!=null&&e[ZD]===!0){let{version:r,multihash:i,code:n}=e,s=Ri(i);return J.create(r,n,s)}else return null}static create(e,r,i){if(typeof r!="number")throw new Error("String codecs are no longer supported");switch(e){case 0:{if(r!==M2)throw new Error(`Version 0 CID must use dag-pb (code: ${M2}) block encoding`);return new J(e,r,i,i.bytes)}case 1:{let n=QD(e,r,i.bytes);return new J(e,r,i,n)}default:throw new Error("Invalid version")}}static createV0(e){return J.create(0,M2,e)}static createV1(e,r){return J.create(1,e,r)}static decode(e){let[r,i]=J.decodeFirst(e);if(i.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=J.inspectBytes(e),i=r.size-r.multihashSize,n=Us(e.subarray(i,i+r.multihashSize));if(n.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=n.subarray(r.multihashSize-r.digestSize),o=new $h(r.multihashCode,r.digestSize,s,n);return[r.version===0?J.createV0(o):J.createV1(r.codec,o),e.subarray(r.size)]}static inspectBytes(e){let r=0,i=()=>{let[d,h]=B2(e.subarray(r));return r+=h,d},n=i(),s=M2;if(n===18?(n=0,r=0):n===1&&(s=i()),n!==0&&n!==1)throw new RangeError(`Invalid CID version ${n}`);let o=r,a=i(),c=i(),u=r+c,f=u-o;return{version:n,codec:s,multihashCode:a,digestSize:c,multihashSize:f,size:u}}static parse(e,r){let[i,n]=_8e(e,r),s=J.decode(n);return s._baseCache.set(i,e),s}},_8e=(t,e)=>{switch(t[0]){case"Q":{let r=e||pt;return[pt.prefix,r.decode(`${pt.prefix}${t}`)]}case pt.prefix:{let r=e||pt;return[pt.prefix,r.decode(t)]}case rr.prefix:{let r=e||rr;return[rr.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}},E8e=(t,e,r)=>{let{prefix:i}=r;if(i!==pt.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let n=e.get(i);if(n==null){let s=r.encode(t).slice(1);return e.set(i,s),s}else return n},S8e=(t,e,r)=>{let{prefix:i}=r,n=e.get(i);if(n==null){let s=r.encode(t);return e.set(i,s),s}else return n},M2=112,x8e=18,QD=(t,e,r)=>{let i=Hh(t),n=i+Hh(e),s=new Uint8Array(n+r.byteLength);return zh(t,s,0),zh(e,s,i),s.set(r,n),s},ZD=Symbol.for("@ipld/js-cid/CID"),Y3={writable:!1,configurable:!1,enumerable:!0},X3={writable:!1,enumerable:!1,configurable:!1},A8e="0.0.0-dev",I8e=(t,e)=>{if(t.test(A8e))console.warn(e);else throw new Error(e)},T8e=`CID.isCID(v) is deprecated and will be removed in the next major release.
Following code pattern:
if (CID.isCID(value)) {
doSomethingWithCID(value)
}
Is replaced with:
const cid = CID.asCID(value)
if (cid) {
// Make sure to use cid instead of value
doSomethingWithCID(cid)
}
`});var Ju,gN,H2=bt(()=>{l();Bn();Ju=({name:t,code:e,encode:r})=>new gN(t,e,r),gN=class{constructor(e,r,i){this.name=e,this.code=r,this.encode=i}async digest(e){if(e instanceof Uint8Array){let r=await this.encode(e);return N2(this.code,r)}else throw Error("Unknown type, must be binary type")}}});var G2={};zt(G2,{identity:()=>_s});var _s,Gc=bt(()=>{l();H2();$u();_s=Ju({name:"identity",code:0,encode:t=>Us(t)})});var Zw={};zt(Zw,{identity:()=>dve});var dve,bN=bt(()=>{l();Pa();$u();dve=W3({prefix:"\0",name:"identity",encode:t=>Nw(t),decode:t=>Bw(t)})});var Jw={};zt(Jw,{base2:()=>hve});var hve,vN=bt(()=>{l();Pa();hve=Qr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var e9={};zt(e9,{base8:()=>pve});var pve,wN=bt(()=>{l();Pa();pve=Qr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var t9={};zt(t9,{base10:()=>yve});var yve,_N=bt(()=>{l();Pa();yve=Wu({prefix:"9",name:"base10",alphabet:"0123456789"})});var a6={};zt(a6,{base16:()=>gve,base16upper:()=>mve});var gve,mve,r9=bt(()=>{l();Pa();gve=Qr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),mve=Qr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var c6={};zt(c6,{base36:()=>bve,base36upper:()=>vve});var bve,vve,i9=bt(()=>{l();Pa();bve=Wu({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),vve=Wu({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var e0={};zt(e0,{base64:()=>wve,base64pad:()=>_ve,base64url:()=>Eve,base64urlpad:()=>Sve});var wve,_ve,Eve,Sve,$2=bt(()=>{l();Pa();wve=Qr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),_ve=Qr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Eve=Qr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Sve=Qr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var zs={};zt(zs,{sha256:()=>dr,sha512:()=>n9});var EN,dr,n9,di=bt(()=>{l();H2();EN=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),dr=Ju({name:"sha2-256",code:18,encode:EN("SHA-256")}),n9=Ju({name:"sha2-512",code:19,encode:EN("SHA-512")})});var W2={};zt(W2,{code:()=>Pi,decode:()=>Ive,encode:()=>Ave,name:()=>xve});var xve,Pi,Ave,Ive,Hs=bt(()=>{l();$u();xve="raw",Pi=85,Ave=t=>Us(t),Ive=t=>Us(t)});var o9={};zt(o9,{code:()=>s9,decode:()=>Ove,encode:()=>Cve,name:()=>Pve});var Tve,Rve,Pve,s9,Cve,Ove,a9=bt(()=>{l();Tve=new TextEncoder,Rve=new TextDecoder,Pve="json",s9=512,Cve=t=>Tve.encode(JSON.stringify(t)),Ove=t=>JSON.parse(Rve.decode(t))});var Y2=bt(()=>{l();Te();G3();$u();H2();Bn()});var kl,u6,f6,l6=bt(()=>{l();bN();vN();wN();_N();r9();yn();i9();li();$2();di();Gc();Hs();a9();Y2();kl={...Zw,...Jw,...e9,...t9,...a6,...Yu,...c6,...Fs,...e0},u6={...zs,...G2},f6={raw:W2,json:o9}});function AN(t,e,r,i){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:i}}}var IN,c9,kve,d6,u9=bt(()=>{l();l6();IN=AN("utf8","u",t=>{let e=new TextDecoder("utf8");return"u"+e.decode(t)},t=>new TextEncoder().encode(t.substring(1))),c9=AN("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);let e=new Uint8Array(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),kve={utf8:IN,"utf-8":IN,hex:kl.base16,latin1:c9,ascii:c9,binary:c9,...kl},d6=kve});var bi={};zt(bi,{fromString:()=>Xe});function Xe(t,e="utf8"){let r=d6[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return r.decoder.decode(`${r.prefix}${t}`)}var dt=bt(()=>{l();u9()});var l9=m((int,RN)=>{l();"use strict";var TN="[a-fA-F\\d:]",rf=t=>t&&t.includeBoundaries?`(?:(?<=\\s|^)(?=${TN})|(?<=${TN})(?=\\s|$))`:"",Uo="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",vi="[a-fA-F\\d]{1,4}",h6=`
(?:
(?:${vi}:){7}(?:${vi}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
(?:${vi}:){6}(?:${Uo}|:${vi}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4
(?:${vi}:){5}(?::${Uo}|(?::${vi}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4
(?:${vi}:){4}(?:(?::${vi}){0,1}:${Uo}|(?::${vi}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4
(?:${vi}:){3}(?:(?::${vi}){0,2}:${Uo}|(?::${vi}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4
(?:${vi}:){2}(?:(?::${vi}){0,3}:${Uo}|(?::${vi}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4
(?:${vi}:){1}(?:(?::${vi}){0,4}:${Uo}|(?::${vi}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4
(?::(?:(?::${vi}){0,5}:${Uo}|(?::${vi}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4
)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1
`.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),Dve=new RegExp(`(?:^${Uo}$)|(?:^${h6}$)`),Bve=new RegExp(`^${Uo}$`),Nve=new RegExp(`^${h6}$`),f9=t=>t&&t.exact?Dve:new RegExp(`(?:${rf(t)}${Uo}${rf(t)})|(?:${rf(t)}${h6}${rf(t)})`,"g");f9.v4=t=>t&&t.exact?Bve:new RegExp(`${rf(t)}${Uo}${rf(t)}`,"g");f9.v6=t=>t&&t.exact?Nve:new RegExp(`${rf(t)}${h6}${rf(t)}`,"g");RN.exports=f9});var CN=m((nnt,PN)=>{l();"use strict";var d9=l9(),i0=t=>d9({exact:!0}).test(t);i0.v4=t=>d9.v4({exact:!0}).test(t);i0.v6=t=>d9.v6({exact:!0}).test(t);i0.version=t=>i0(t)?i0.v4(t)?4:6:void 0;PN.exports=i0});var hr={};zt(hr,{toString:()=>Ge});function Ge(t,e="utf8"){let r=d6[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return r.encoder.encode(t).substring(1)}var tt=bt(()=>{l();u9()});var NN=m((ont,BN)=>{l();"use strict";var h9=CN(),{toString:ON}=(tt(),hr),Mve=h9,p9=h9.v4,kN=h9.v6,DN=function(t,e,r){r=~~r;let i;if(p9(t))i=e||new Uint8Array(r+4),t.split(/\./g).map(function(n){i[r++]=parseInt(n,10)&255});else if(kN(t)){let n=t.split(":",8),s;for(s=0;s<n.length;s++){let o=p9(n[s]),a;o&&(a=DN(n[s]),n[s]=ON(a.slice(0,2),"base16")),a&&++s<8&&n.splice(s,0,ON(a.slice(2,4),"base16"))}if(n[0]==="")for(;n.length<8;)n.unshift("0");else if(n[n.length-1]==="")for(;n.length<8;)n.push("0");else if(n.length<8){for(s=0;s<n.length&&n[s]!=="";s++);let o=[s,"1"];for(s=9-n.length;s>0;s--)o.push("0");n.splice.apply(n,o)}for(i=e||new Uint8Array(r+16),s=0;s<n.length;s++){let o=parseInt(n[s],16);i[r++]=o>>8&255,i[r++]=o&255}}if(!i)throw Error("Invalid ip address: "+t);return i},Lve=function(t,e,r){e=~~e,r=r||t.length-e;let i=[],n,s=new DataView(t.buffer);if(r===4){for(let o=0;o<r;o++)i.push(t[e+o]);n=i.join(".")}else if(r===16){for(let o=0;o<r;o+=2)i.push(s.getUint16(e+o).toString(16));n=i.join(":"),n=n.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3"),n=n.replace(/:{3,4}/,"::")}return n};BN.exports={isIP:Mve,isV4:p9,isV6:kN,toBytes:DN,toString:Lve}});var X2=m((ant,LN)=>{l();"use strict";function Zn(t){if(typeof t=="number"){if(Zn.codes[t])return Zn.codes[t];throw new Error("no protocol with code: "+t)}else if(typeof t=="string"){if(Zn.names[t])return Zn.names[t];throw new Error("no protocol with name: "+t)}throw new Error("invalid protocol id type: "+t)}var Gs=-1;Zn.lengthPrefixedVarSize=Gs;Zn.V=Gs;Zn.table=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,Gs,"ip6zone"],[53,Gs,"dns","resolvable"],[54,Gs,"dns4","resolvable"],[55,Gs,"dns6","resolvable"],[56,Gs,"dnsaddr","resolvable"],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,Gs,"unix",!1,"path"],[421,Gs,"ipfs"],[421,Gs,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,Gs,"garlic64"],[460,0,"quic"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,Gs,"memory"]];Zn.names={};Zn.codes={};Zn.table.map(t=>{let e=MN.apply(null,t);return Zn.codes[e.code]=e,Zn.names[e.name]=e,null});Zn.object=MN;function MN(t,e,r,i,n){return{code:t,size:e,name:r,resolvable:Boolean(i),path:Boolean(n)}}LN.exports=Zn});var UN=m((cnt,jN)=>{l();jN.exports=y9;var qN=128,qve=127,jve=~qve,Uve=Math.pow(2,31);function y9(t,e,r){if(Number.MAX_SAFE_INTEGER&&t>Number.MAX_SAFE_INTEGER)throw y9.bytes=0,new RangeError("Could not encode varint");e=e||[],r=r||0;for(var i=r;t>=Uve;)e[r++]=t&255|qN,t/=128;for(;t&jve;)e[r++]=t&255|qN,t>>>=7;return e[r]=t|0,y9.bytes=r-i+1,e}});var VN=m((unt,KN)=>{l();KN.exports=g9;var Fve=128,FN=127;function g9(t,e){var r=0,e=e||0,i=0,n=e,s,o=t.length;do{if(n>=o||i>49)throw g9.bytes=0,new RangeError("Could not decode varint");s=t[n++],r+=i<28?(s&FN)<<i:(s&FN)*Math.pow(2,i),i+=7}while(s>=Fve);return g9.bytes=n-e,r}});var HN=m((fnt,zN)=>{l();var Kve=Math.pow(2,7),Vve=Math.pow(2,14),zve=Math.pow(2,21),Hve=Math.pow(2,28),Gve=Math.pow(2,35),$ve=Math.pow(2,42),Wve=Math.pow(2,49),Yve=Math.pow(2,56),Xve=Math.pow(2,63);zN.exports=function(t){return t<Kve?1:t<Vve?2:t<zve?3:t<Hve?4:t<Gve?5:t<$ve?6:t<Wve?7:t<Yve?8:t<Xve?9:10}});var Es=m((lnt,GN)=>{l();GN.exports={encode:UN(),decode:VN(),encodingLength:HN()}});var $s={};zt($s,{concat:()=>gn});function gn(t,e){e||(e=t.reduce((n,s)=>n+s.length,0));let r=new Uint8Array(e),i=0;for(let n of t)r.set(n,i),i+=n.length;return r}var mn=bt(()=>{l()});var eM=m((dnt,JN)=>{l();"use strict";var p6=NN(),$N=X2(),{CID:Qve}=(Te(),Xu),{base32:WN}=(yn(),Yu),{base58btc:Zve}=(li(),Fs),Jve=(Bn(),Wh),n0=Es(),{toString:y6}=(tt(),hr),{fromString:YN}=(dt(),bi),{concat:g6}=(mn(),$s);JN.exports=Q2;function Q2(t,e){return e instanceof Uint8Array?Q2.toString(t,e):Q2.toBytes(t,e)}Q2.toString=function(e,r){switch($N(e).code){case 4:case 41:return e7e(r);case 6:case 273:case 33:case 132:return QN(r).toString();case 53:case 54:case 55:case 56:case 400:case 777:return r7e(r);case 421:return n7e(r);case 444:return ZN(r);case 445:return ZN(r);default:return y6(r,"base16")}};Q2.toBytes=function(e,r){switch($N(e).code){case 4:return XN(r);case 41:return XN(r);case 6:case 273:case 33:case 132:return m9(parseInt(r,10));case 53:case 54:case 55:case 56:case 400:case 777:return t7e(r);case 421:return i7e(r);case 444:return s7e(r);case 445:return o7e(r);default:return YN(r,"base16")}};function XN(t){if(!p6.isIP(t))throw new Error("invalid ip address");return p6.toBytes(t)}function e7e(t){let e=p6.toString(t);if(!e||!p6.isIP(e))throw new Error("invalid ip address");return e}function m9(t){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,t),new Uint8Array(e)}function QN(t){return new DataView(t.buffer).getUint16(t.byteOffset)}function t7e(t){let e=YN(t),r=Uint8Array.from(n0.encode(e.length));return g6([r,e],r.length+e.length)}function r7e(t){let e=n0.decode(t);if(t=t.slice(n0.decode.bytes),t.length!==e)throw new Error("inconsistent lengths");return y6(t)}function i7e(t){let e;t[0]==="Q"||t[0]==="1"?e=Jve.decode(Zve.decode(`z${t}`)).bytes:e=Qve.parse(t).multihash.bytes;let r=Uint8Array.from(n0.encode(e.length));return g6([r,e],r.length+e.length)}function n7e(t){let e=n0.decode(t),r=t.slice(n0.decode.bytes);if(r.length!==e)throw new Error("inconsistent lengths");return y6(r,"base58btc")}function s7e(t){let e=t.split(":");if(e.length!==2)throw new Error("failed to parse onion addr: "+e+" does not contain a port number");if(e[0].length!==16)throw new Error("failed to parse onion addr: "+e[0]+" not a Tor onion address.");let r=WN.decode("b"+e[0]),i=parseInt(e[1],10);if(i<1||i>65536)throw new Error("Port number is not in range(1, 65536)");let n=m9(i);return g6([r,n],r.length+n.length)}function o7e(t){let e=t.split(":");if(e.length!==2)throw new Error("failed to parse onion addr: "+e+" does not contain a port number");if(e[0].length!==56)throw new Error("failed to parse onion addr: "+e[0]+" not a Tor onion3 address.");let r=WN.decode("b"+e[0]),i=parseInt(e[1],10);if(i<1||i>65536)throw new Error("Port number is not in range(1, 65536)");let n=m9(i);return g6([r,n],r.length+n.length)}function ZN(t){let e=t.slice(0,t.length-2),r=t.slice(t.length-2),i=y6(e,"base32"),n=QN(r);return i+":"+n}});var dM=m((hnt,lM)=>{l();"use strict";var tM=eM(),b9=X2(),Z2=Es(),{concat:rM}=(mn(),$s),{toString:a7e}=(tt(),hr);lM.exports={stringToStringTuples:iM,stringTuplesToString:nM,tuplesToStringTuples:oM,stringTuplesToTuples:sM,bytesToTuples:v9,tuplesToBytes:aM,bytesToString:c7e,stringToBytes:uM,fromString:u7e,fromBytes:fM,validateBytes:w9,isValidBytes:f7e,cleanPath:m6,ParseError:_9,protoFromTuple:J2,sizeForAddr:cM};function iM(t){let e=[],r=t.split("/").slice(1);if(r.length===1&&r[0]==="")return[];for(let i=0;i<r.length;i++){let n=r[i],s=b9(n);if(s.size===0){e.push([n]);continue}if(i++,i>=r.length)throw _9("invalid address: "+t);if(s.path){e.push([n,m6(r.slice(i).join("/"))]);break}e.push([n,r[i]])}return e}function nM(t){let e=[];return t.map(r=>{let i=J2(r);return e.push(i.name),r.length>1&&e.push(r[1]),null}),m6(e.join("/"))}function sM(t){return t.map(e=>{Array.isArray(e)||(e=[e]);let r=J2(e);return e.length>1?[r.code,tM.toBytes(r.code,e[1])]:[r.code]})}function oM(t){return t.map(e=>{let r=J2(e);return e[1]?[r.code,tM.toString(r.code,e[1])]:[r.code]})}function aM(t){return fM(rM(t.map(e=>{let r=J2(e),i=Uint8Array.from(Z2.encode(r.code));return e.length>1&&(i=rM([i,e[1]])),i})))}function cM(t,e){return t.size>0?t.size/8:t.size===0?0:Z2.decode(e)+Z2.decode.bytes}function v9(t){let e=[],r=0;for(;r<t.length;){let i=Z2.decode(t,r),n=Z2.decode.bytes,s=b9(i),o=cM(s,t.slice(r+n));if(o===0){e.push([i]),r+=n;continue}let a=t.slice(r+n,r+n+o);if(r+=o+n,r>t.length)throw _9("Invalid address Uint8Array: "+a7e(t,"base16"));e.push([i,a])}return e}function c7e(t){let e=v9(t),r=oM(e);return nM(r)}function uM(t){t=m6(t);let e=iM(t),r=sM(e);return aM(r)}function u7e(t){return uM(t)}function fM(t){let e=w9(t);if(e)throw e;return Uint8Array.from(t)}function w9(t){try{v9(t)}catch(e){return e}}function f7e(t){return w9(t)===void 0}function m6(t){return"/"+t.trim().split("/").filter(e=>e).join("/")}function _9(t){return new Error("Error parsing address: "+t)}function J2(t){return b9(t[0])}});var yM=m((pnt,pM)=>{l();"use strict";function hM(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function l7e(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return hM(t,r)}catch(i){r.message=t.message,r.stack=t.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(t)),hM(new n,r)}}pM.exports=l7e});var bn={};zt(bn,{equals:()=>Ba});function Ba(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0}var wi=bt(()=>{l()});var rt=m((ynt,bM)=>{l();"use strict";var Fo=dM(),s0=X2(),gM=Es(),{CID:d7e}=(Te(),Xu),{base58btc:h7e}=(li(),Fs),p7e=yM(),y7e=Symbol.for("nodejs.util.inspect.custom"),{toString:b6}=(tt(),hr),{equals:g7e}=(wi(),bn),E9=new Map,mM=Symbol.for("@multiformats/js-multiaddr/multiaddr"),Mn=class{constructor(e){if(e==null&&(e=""),Object.defineProperty(this,mM,{value:!0}),e instanceof Uint8Array)this.bytes=Fo.fromBytes(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);this.bytes=Fo.fromString(e)}else if(Mn.isMultiaddr(e))this.bytes=Fo.fromBytes(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return Fo.bytesToString(this.bytes)}toJSON(){return this.toString()}toOptions(){let e={},r=this.toString().split("/");return e.family=r[1]==="ip4"?4:6,e.host=r[2],e.transport=r[3],e.port=parseInt(r[4]),e}protos(){return this.protoCodes().map(e=>Object.assign({},s0(e)))}protoCodes(){let e=[],r=this.bytes,i=0;for(;i<r.length;){let n=gM.decode(r,i),s=gM.decode.bytes,o=s0(n);i+=Fo.sizeForAddr(o,r.slice(i+s))+s,e.push(n)}return e}protoNames(){return this.protos().map(e=>e.name)}tuples(){return Fo.bytesToTuples(this.bytes)}stringTuples(){let e=Fo.bytesToTuples(this.bytes);return Fo.tuplesToStringTuples(e)}encapsulate(e){return e=new Mn(e),new Mn(this.toString()+e.toString())}decapsulate(e){let r=e.toString(),i=this.toString(),n=i.lastIndexOf(r);if(n<0)throw new Error("Address "+this+" does not contain subaddress: "+e);return new Mn(i.slice(0,n))}decapsulateCode(e){let r=this.tuples();for(let i=r.length-1;i>=0;i--)if(r[i][0]===e)return new Mn(Fo.tuplesToBytes(r.slice(0,i)));return this}getPeerId(){try{let r=this.stringTuples().filter(i=>i[0]===s0.names.ipfs.code).pop();if(r&&r[1]){let i=r[1];return i[0]==="Q"||i[0]==="1"?b6(h7e.decode(`z${i}`),"base58btc"):b6(d7e.parse(i).multihash.bytes,"base58btc")}return null}catch(e){return null}}getPath(){let e=null;try{e=this.stringTuples().filter(r=>!!s0(r[0]).path)[0][1],e||(e=null)}catch(r){e=null}return e}equals(e){return g7e(this.bytes,e.bytes)}async resolve(){let e=this.protos().find(n=>n.resolvable);if(!e)return[this];let r=E9.get(e.name);if(!r)throw p7e(new Error(`no available resolver for ${e.name}`),"ERR_NO_AVAILABLE_RESOLVER");return(await r(this)).map(n=>new Mn(n))}nodeAddress(){let e=this.protoCodes(),r=this.protoNames(),i=this.toString().split("/").slice(1);if(i.length<4)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6}/{address}/{tcp, udp}/{port}".');if(e[0]!==4&&e[0]!==41&&e[0]!==54&&e[0]!==55)throw new Error(`no protocol with name: "'${r[0]}'". Must have a valid family name: "{ip4, ip6, dns4, dns6}".`);if(i[2]!=="tcp"&&i[2]!=="udp")throw new Error(`no protocol with name: "'${r[1]}'". Must have a valid transport protocol: "{tcp, udp}".`);return{family:e[0]===41||e[0]===55?6:4,address:i[1],port:parseInt(i[3])}}isThinWaistAddress(e){let r=(e||this).protos();return!(r.length!==2||r[0].code!==4&&r[0].code!==41||r[1].code!==6&&r[1].code!==273)}static fromNodeAddress(e,r){if(!e)throw new Error("requires node address object");if(!r)throw new Error("requires transport protocol");let i;switch(e.family){case 4:i="ip4";break;case 6:i="ip6";break;default:throw Error(`Invalid addr family. Got '${e.family}' instead of 4 or 6`)}return new Mn("/"+[i,e.address,r,e.port].join("/"))}static isName(e){return Mn.isMultiaddr(e)?e.protos().some(r=>r.resolvable):!1}static isMultiaddr(e){return e instanceof Mn||Boolean(e&&e[mM])}[y7e](){return"<Multiaddr "+b6(this.bytes,"base16")+" - "+Fo.bytesToString(this.bytes)+">"}inspect(){return"<Multiaddr "+b6(this.bytes,"base16")+" - "+Fo.bytesToString(this.bytes)+">"}};Mn.protocols=s0;Mn.resolvers=E9;function m7e(t){return new Mn(t)}bM.exports={Multiaddr:Mn,multiaddr:m7e,protocols:s0,resolvers:E9}});var Bl=m((gnt,RM)=>{l();"use strict";var{Multiaddr:S9}=rt(),vM=Ze("dns4"),wM=Ze("dns6"),_M=Ze("dnsaddr"),Dl=vn(Ze("dns"),_M,vM,wM),ey=vn(Ze("ip4"),Ze("ip6")),o0=vn(gt(ey,Ze("tcp")),gt(Dl,Ze("tcp"))),x9=gt(ey,Ze("udp")),EM=gt(x9,Ze("utp")),SM=gt(x9,Ze("quic")),a0=vn(gt(o0,Ze("ws")),gt(Dl,Ze("ws"))),c0=vn(gt(o0,Ze("wss")),gt(Dl,Ze("wss"))),v6=vn(gt(o0,Ze("http")),gt(ey,Ze("http")),gt(Dl,Ze("http"))),w6=vn(gt(o0,Ze("https")),gt(ey,Ze("https")),gt(Dl,Ze("https"))),A9=vn(gt(a0,Ze("p2p-webrtc-star"),Ze("p2p")),gt(c0,Ze("p2p-webrtc-star"),Ze("p2p")),gt(a0,Ze("p2p-webrtc-star")),gt(c0,Ze("p2p-webrtc-star"))),b7e=vn(gt(a0,Ze("p2p-websocket-star"),Ze("p2p")),gt(c0,Ze("p2p-websocket-star"),Ze("p2p")),gt(a0,Ze("p2p-websocket-star")),gt(c0,Ze("p2p-websocket-star"))),I9=vn(gt(v6,Ze("p2p-webrtc-direct"),Ze("p2p")),gt(w6,Ze("p2p-webrtc-direct"),Ze("p2p")),gt(v6,Ze("p2p-webrtc-direct")),gt(w6,Ze("p2p-webrtc-direct"))),u0=vn(a0,c0,v6,w6,A9,I9,o0,EM,SM,Dl),v7e=vn(gt(u0,Ze("p2p-stardust"),Ze("p2p")),gt(u0,Ze("p2p-stardust"))),nf=vn(gt(u0,Ze("p2p")),A9,I9,Ze("p2p")),xM=vn(gt(nf,Ze("p2p-circuit"),nf),gt(nf,Ze("p2p-circuit")),gt(Ze("p2p-circuit"),nf),gt(u0,Ze("p2p-circuit")),gt(Ze("p2p-circuit"),u0),Ze("p2p-circuit")),AM=()=>vn(gt(xM,AM),xM),f0=AM(),IM=vn(gt(f0,nf,f0),gt(nf,f0),gt(f0,nf),f0,nf);RM.exports={DNS:Dl,DNS4:vM,DNS6:wM,DNSADDR:_M,IP:ey,TCP:o0,UDP:x9,QUIC:SM,UTP:EM,HTTP:v6,HTTPS:w6,WebSockets:a0,WebSocketsSecure:c0,WebSocketStar:b7e,WebRTCStar:A9,WebRTCDirect:I9,Reliable:u0,Stardust:v7e,Circuit:f0,P2P:IM,IPFS:IM};function TM(t){function e(r){if(!S9.isMultiaddr(r))try{r=new S9(r)}catch(n){return!1}let i=t(r.protoNames());return i===null?!1:i===!0||i===!1?i:i.length===0}return e}function gt(...t){function e(r){if(r.length<t.length)return null;let i=r;return t.some(n=>(i=typeof n=="function"?n().partialMatch(r):n.partialMatch(r),Array.isArray(i)&&(r=i),i===null)),i}return{toString:function(){return"{ "+t.join(" ")+" }"},input:t,matches:TM(e),partialMatch:e}}function vn(...t){function e(i){let n=null;return t.some(s=>{let o=typeof s=="function"?s().partialMatch(i):s.partialMatch(i);return o?(n=o,!0):!1}),n}return{toString:function(){return"{ "+t.join(" ")+" }"},input:t,matches:TM(e),partialMatch:e}}function Ze(t){let e=t;function r(n){let s;if(typeof n=="string"||n instanceof Uint8Array)try{s=new S9(n)}catch(a){return!1}else s=n;let o=s.protoNames();return o.length===1&&o[0]===e}function i(n){return n.length===0?null:n[0]===e?n.slice(1):null}return{toString:function(){return e},matches:r,partialMatch:i}}});var T9=m((mnt,OM)=>{l();"use strict";var w7e=typeof navigator!="undefined"&&navigator.product==="ReactNative";function _7e(){return w7e?"http://localhost":self.location.protocol+"//"+self.location.host}var ty=self.URL,PM=_7e(),CM=class{constructor(e="",r=PM){this.super=new ty(e,r),this.path=this.pathname+this.search,this.auth=this.username&&this.password?this.username+":"+this.password:null,this.query=this.search&&this.search.startsWith("?")?this.search.slice(1):null}get hash(){return this.super.hash}get host(){return this.super.host}get hostname(){return this.super.hostname}get href(){return this.super.href}get origin(){return this.super.origin}get password(){return this.super.password}get pathname(){return this.super.pathname}get port(){return this.super.port}get protocol(){return this.super.protocol}get search(){return this.super.search}get searchParams(){return this.super.searchParams}get username(){return this.super.username}set hash(e){this.super.hash=e}set host(e){this.super.host=e}set hostname(e){this.super.hostname=e}set href(e){this.super.href=e}set password(e){this.super.password=e}set pathname(e){this.super.pathname=e}set port(e){this.super.port=e}set protocol(e){this.super.protocol=e}set search(e){this.super.search=e}set username(e){this.super.username=e}static createObjectURL(e){return ty.createObjectURL(e)}static revokeObjectURL(e){ty.revokeObjectURL(e)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}};function E7e(t){if(typeof t=="string")return new ty(t).toString();if(!(t instanceof ty)){let e=t.username&&t.password?`${t.username}:${t.password}@`:"",r=t.auth?t.auth+"@":"",i=t.port?":"+t.port:"",n=t.protocol?t.protocol+"//":"",s=t.host||"",o=t.hostname||"",a=t.search||(t.query?"?"+t.query:""),c=t.hash||"",u=t.pathname||"",f=t.path||u+a;return`${n}${e||r}${s||o+i}${f}${c}`}}OM.exports={URLWithLegacySupport:CM,URLSearchParams:self.URLSearchParams,defaultBase:PM,format:E7e}});var BM=m((bnt,DM)=>{l();"use strict";var{URLWithLegacySupport:kM,format:S7e}=T9();DM.exports=(t,e={},r={},i)=>{let n=e.protocol?e.protocol.replace(":",""):"http";n=(r[n]||i||n)+":";let s;try{s=new kM(t)}catch(a){s={}}let o=Object.assign({},e,{protocol:n||s.protocol,host:e.host||s.host});return new kM(t,S7e(o)).toString()}});var _6=m((vnt,NM)=>{l();"use strict";var{URLWithLegacySupport:x7e,format:A7e,URLSearchParams:I7e,defaultBase:T7e}=T9(),R7e=BM();NM.exports={URL:x7e,URLSearchParams:I7e,format:A7e,relative:R7e,defaultBase:T7e}});var d0=m((wnt,WM)=>{l();"use strict";var{base58btc:P7e}=(li(),Fs),{base32:C7e}=(yn(),Yu),O7e=(Bn(),Wh),{Multiaddr:MM}=rt(),k7e=Bl(),{CID:R9}=(Te(),Xu),{URL:D7e}=_6(),{toString:B7e}=(tt(),hr),P9=/^https?:\/\/[^/]+\/(ip[fn]s)\/([^/?#]+)/,l0=/^\/(ip[fn]s)\/([^/?#]+)/,LM=1,qM=2,ry=/^https?:\/\/([^/]+)\.(ip[fn]s)\.[^/?]+/,jM=1,UM=2,N7e=/^(([a-z0-9]|[a-z0-9][a-z0-9-]*[a-z0-9])\.)+([a-z0-9]|[a-z0-9][a-z0-9-]*[a-z0-9])$/;function M7e(t){let e=C9(t);try{O7e.decode(P7e.decode("z"+e))}catch{return!1}return!0}function L7e(t){try{C7e.decode(t)}catch{return!1}return!0}function iy(t){try{return typeof t=="string"?Boolean(R9.parse(t)):t instanceof Uint8Array?Boolean(R9.decode(t)):Boolean(R9.asCID(t))}catch(e){return!1}}function FM(t){if(!t)return!1;if(MM.isMultiaddr(t))return!0;try{return new MM(t),!0}catch(e){return!1}}function q7e(t){return FM(t)&&k7e.P2P.matches(t)}function ny(t,e,r=LM,i=qM){let n=C9(t);if(!n)return!1;let s=n.match(e);if(!s||s[r]!=="ipfs")return!1;let o=s[i];return o&&e===ry&&(o=o.toLowerCase()),iy(o)}function E6(t,e,r=LM,i=qM){let n=C9(t);if(!n)return!1;let s=n.match(e);if(!s||s[r]!=="ipns")return!1;let o=s[i];if(o&&e===ry){if(o=o.toLowerCase(),iy(o))return!0;try{!o.includes(".")&&o.includes("-")&&(o=o.replace(/--/g,"@").replace(/-/g,".").replace(/@/g,"-"));let{hostname:a}=new D7e(`http://${o}`);return N7e.test(a)}catch(a){return!1}}return!0}function KM(t){return typeof t=="string"}function C9(t){return t instanceof Uint8Array?B7e(t,"base58btc"):KM(t)?t:!1}var O9=t=>ny(t,ry,UM,jM),k9=t=>E6(t,ry,UM,jM),VM=t=>O9(t)||k9(t),zM=t=>ny(t,P9)||O9(t),HM=t=>E6(t,P9)||k9(t),GM=t=>zM(t)||HM(t)||VM(t),$M=t=>ny(t,l0)||E6(t,l0);WM.exports={multihash:M7e,multiaddr:FM,peerMultiaddr:q7e,cid:iy,base32cid:t=>L7e(t)&&iy(t),ipfsSubdomain:O9,ipnsSubdomain:k9,subdomain:VM,subdomainGatewayPattern:ry,ipfsUrl:zM,ipnsUrl:HM,url:GM,pathGatewayPattern:P9,ipfsPath:t=>ny(t,l0),ipnsPath:t=>E6(t,l0),path:$M,pathPattern:l0,urlOrPath:t=>GM(t)||$M(t),cidPath:t=>KM(t)&&!iy(t)&&ny(`/ipfs/${t}`,l0)}});var YM,XM=bt(()=>{l();YM="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"});var B9={};zt(B9,{customAlphabet:()=>j7e,customRandom:()=>ZM,nanoid:()=>D9,random:()=>QM,urlAlphabet:()=>YM});var QM,ZM,j7e,D9,S6=bt(()=>{l();XM();QM=t=>crypto.getRandomValues(new Uint8Array(t)),ZM=(t,e,r)=>{let i=(2<<Math.log(t.length-1)/Math.LN2)-1,n=-~(1.6*i*e/t.length);return()=>{let s="";for(;;){let o=r(n),a=n;for(;a--;)if(s+=t[o[a]&i]||"",s.length===e)return s}}},j7e=(t,e)=>ZM(t,e,QM),D9=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t));for(;t--;){let i=r[t]&63;i<36?e+=i.toString(36):i<62?e+=(i-26).toString(36).toUpperCase():i<63?e+="_":e+="-"}return e}});var sy={};zt(sy,{Key:()=>qe});function U7e(t){let e=t.split(":");return e.length<2?"":e.slice(0,-1).join(":")}function F7e(t){let e=t.split(":");return e[e.length-1]}function K7e(t){return[].concat(...t)}var $c,JM,x6,qe,Br=bt(()=>{l();S6();tt();dt();$c="/",JM=new TextEncoder().encode($c),x6=JM[0],qe=class{constructor(e,r){if(typeof e=="string")this._buf=Xe(e);else if(e instanceof Uint8Array)this._buf=e;else throw new Error("Invalid key, should be String of Uint8Array");if(r==null&&(r=!0),r&&this.clean(),this._buf.byteLength===0||this._buf[0]!==x6)throw new Error("Invalid key")}toString(e="utf8"){return Ge(this._buf,e)}uint8Array(){return this._buf}get[Symbol.toStringTag](){return`Key(${this.toString()})`}static withNamespaces(e){return new qe(e.join($c))}static random(){return new qe(D9().replace(/-/g,""))}static asKey(e){return e instanceof Uint8Array||typeof e=="string"?new qe(e):e.uint8Array?new qe(e.uint8Array()):null}clean(){if((!this._buf||this._buf.byteLength===0)&&(this._buf=JM),this._buf[0]!==x6){let e=new Uint8Array(this._buf.byteLength+1);e.fill(x6,0,1),e.set(this._buf,1),this._buf=e}for(;this._buf.byteLength>1&&this._buf[this._buf.byteLength-1]===x6;)this._buf=this._buf.subarray(0,-1)}less(e){let r=this.list(),i=e.list();for(let n=0;n<r.length;n++){if(i.length<n+1)return!1;let s=r[n],o=i[n];if(s<o)return!0;if(s>o)return!1}return r.length<i.length}reverse(){return qe.withNamespaces(this.list().slice().reverse())}namespaces(){return this.list()}baseNamespace(){let e=this.namespaces();return e[e.length-1]}list(){return this.toString().split($c).slice(1)}type(){return U7e(this.baseNamespace())}name(){return F7e(this.baseNamespace())}instance(e){return new qe(this.toString()+":"+e)}path(){let e=this.parent().toString();return e.endsWith($c)||(e+=$c),e+=this.type(),new qe(e)}parent(){let e=this.list();return e.length===1?new qe($c):new qe(e.slice(0,-1).join($c))}child(e){return this.toString()===$c?e:e.toString()===$c?this:new qe(this.toString()+e.toString(),!1)}isAncestorOf(e){return e.toString()===this.toString()?!1:e.toString().startsWith(this.toString())}isDecendantOf(e){return e.toString()===this.toString()?!1:this.toString().startsWith(e.toString())}isTopLevel(){return this.list().length===1}concat(...e){return qe.withNamespaces([...this.namespaces(),...K7e(e.map(r=>r.namespaces()))])}}});var h0=m((Int,A6)=>{l();"use strict";var{AbortController:eL,AbortSignal:V7e}=typeof self!="undefined"?self:typeof window!="undefined"?window:void 0;A6.exports=eL;A6.exports.AbortSignal=V7e;A6.exports.default=eL});var rL=m((Tnt,tL)=>{l();"use strict";tL.exports=function(){return Date.now()}});var nL=m((Rnt,iL)=>{l();"use strict";var N9=rL();function M9(t,e,r){var i=this;this._started=N9(),this._rescheduled=0,this._scheduled=e,this._args=r,this._timer=setTimeout(n,e);function n(){i._rescheduled>0?(i._scheduled=i._rescheduled-(N9()-i._started),i._timer=setTimeout(n,i._scheduled),i._rescheduled=0):t.apply(null,i._args)}}M9.prototype.reschedule=function(t){var e=N9();return e+t-(this._started+this._scheduled)<0?!1:(this._started=e,this._rescheduled=t,!0)};M9.prototype.clear=function(){clearTimeout(this._timer)};function z7e(){if(typeof arguments[0]!="function")throw new Error("callback needed");if(typeof arguments[1]!="number")throw new Error("timeout needed");var t;if(arguments.length>0){t=new Array(arguments.length-2);for(var e=0;e<t.length;e++)t[e]=arguments[e+2]}return new M9(arguments[0],arguments[1],t)}iL.exports=z7e});var I6=m((Pnt,L9)=>{l();"use strict";var{AbortController:H7e}=typeof self!="undefined"?self:typeof window!="undefined"?window:h0(),sL=nL(),oy=class extends H7e{constructor(e){super();this._ms=e,this._timer=sL(()=>this.abort(),e),Object.setPrototypeOf(this,oy.prototype)}abort(){return this._timer.clear(),super.abort()}clear(){this._timer.clear()}reset(){this._timer.clear(),this._timer=sL(()=>this.abort(),this._ms)}};L9.exports=oy;L9.exports.TimeoutController=oy});var wn=m((Cnt,oL)=>{l();"use strict";var T6;globalThis.AbortController&&globalThis.AbortSignal?T6=globalThis:T6=h0();oL.exports={AbortController:T6.AbortController,AbortSignal:T6.AbortSignal}});var sf=m((Ont,q9)=>{l();var{AbortController:G7e}=wn();function aL(t){let e=new G7e;function r(){e.abort();for(let i of t)!i||!i.removeEventListener||i.removeEventListener("abort",r)}for(let i of t)if(!(!i||!i.addEventListener)){if(i.aborted){r();break}i.addEventListener("abort",r)}return e.signal}q9.exports=aL;q9.exports.anySignal=aL});var p0=m((Lnt,dL)=>{l();"use strict";function lL(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function W7e(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return lL(t,r)}catch(i){r.message=t.message,r.stack=t.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(t)),lL(new n,r)}}dL.exports=W7e});var g0=m((Jnt,vL)=>{l();vL.exports=function(t){if(!t)throw Error("hashlru must have a max value, of type number, greater than 0");var e=0,r=Object.create(null),i=Object.create(null);function n(s,o){r[s]=o,e++,e>=t&&(e=0,i=r,r=Object.create(null))}return{has:function(s){return r[s]!==void 0||i[s]!==void 0},remove:function(s){r[s]!==void 0&&(r[s]=void 0),i[s]!==void 0&&(i[s]=void 0)},get:function(s){var o=r[s];if(o!==void 0)return o;if((o=i[s])!==void 0)return n(s,o),o},set:function(s,o){r[s]!==void 0?r[s]=o:n(s,o)},clear:function(){r=Object.create(null),i=Object.create(null)}}}});var EL=m((tst,K9)=>{l();"use strict";var X7e=Object.prototype.hasOwnProperty,qn="~";function uy(){}Object.create&&(uy.prototype=Object.create(null),new uy().__proto__||(qn=!1));function Q7e(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function _L(t,e,r,i,n){if(typeof r!="function")throw new TypeError("The listener must be a function");var s=new Q7e(r,i||t,n),o=qn?qn+e:e;return t._events[o]?t._events[o].fn?t._events[o]=[t._events[o],s]:t._events[o].push(s):(t._events[o]=s,t._eventsCount++),t}function C6(t,e){--t._eventsCount==0?t._events=new uy:delete t._events[e]}function _n(){this._events=new uy,this._eventsCount=0}_n.prototype.eventNames=function(){var e=[],r,i;if(this._eventsCount===0)return e;for(i in r=this._events)X7e.call(r,i)&&e.push(qn?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};_n.prototype.listeners=function(e){var r=qn?qn+e:e,i=this._events[r];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,s=i.length,o=new Array(s);n<s;n++)o[n]=i[n].fn;return o};_n.prototype.listenerCount=function(e){var r=qn?qn+e:e,i=this._events[r];return i?i.fn?1:i.length:0};_n.prototype.emit=function(e,r,i,n,s,o){var a=qn?qn+e:e;if(!this._events[a])return!1;var c=this._events[a],u=arguments.length,f,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),u){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,r),!0;case 3:return c.fn.call(c.context,r,i),!0;case 4:return c.fn.call(c.context,r,i,n),!0;case 5:return c.fn.call(c.context,r,i,n,s),!0;case 6:return c.fn.call(c.context,r,i,n,s,o),!0}for(d=1,f=new Array(u-1);d<u;d++)f[d-1]=arguments[d];c.fn.apply(c.context,f)}else{var h=c.length,p;for(d=0;d<h;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),u){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,r);break;case 3:c[d].fn.call(c[d].context,r,i);break;case 4:c[d].fn.call(c[d].context,r,i,n);break;default:if(!f)for(p=1,f=new Array(u-1);p<u;p++)f[p-1]=arguments[p];c[d].fn.apply(c[d].context,f)}}return!0};_n.prototype.on=function(e,r,i){return _L(this,e,r,i,!1)};_n.prototype.once=function(e,r,i){return _L(this,e,r,i,!0)};_n.prototype.removeListener=function(e,r,i,n){var s=qn?qn+e:e;if(!this._events[s])return this;if(!r)return C6(this,s),this;var o=this._events[s];if(o.fn)o.fn===r&&(!n||o.once)&&(!i||o.context===i)&&C6(this,s);else{for(var a=0,c=[],u=o.length;a<u;a++)(o[a].fn!==r||n&&!o[a].once||i&&o[a].context!==i)&&c.push(o[a]);c.length?this._events[s]=c.length===1?c[0]:c:C6(this,s)}return this};_n.prototype.removeAllListeners=function(e){var r;return e?(r=qn?qn+e:e,this._events[r]&&C6(this,r)):(this._events=new uy,this._eventsCount=0),this};_n.prototype.off=_n.prototype.removeListener;_n.prototype.addListener=_n.prototype.on;_n.prefixed=qn;_n.EventEmitter=_n;typeof K9!="undefined"&&(K9.exports=_n)});var xL=m((rst,SL)=>{l();"use strict";SL.exports=(t,e)=>(e=e||(()=>{}),t.then(r=>new Promise(i=>{i(e())}).then(()=>r),r=>new Promise(i=>{i(e())}).then(()=>{throw r})))});var IL=m((ist,O6)=>{l();"use strict";var Z7e=xL(),V9=class extends Error{constructor(e){super(e);this.name="TimeoutError"}},AL=(t,e,r)=>new Promise((i,n)=>{if(typeof e!="number"||e<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(e===1/0){i(t);return}let s=setTimeout(()=>{if(typeof r=="function"){try{i(r())}catch(c){n(c)}return}let o=typeof r=="string"?r:`Promise timed out after ${e} milliseconds`,a=r instanceof Error?r:new V9(o);typeof t.cancel=="function"&&t.cancel(),n(a)},e);Z7e(t.then(i,n),()=>{clearTimeout(s)})});O6.exports=AL;O6.exports.default=AL;O6.exports.TimeoutError=V9});var TL=m(z9=>{l();"use strict";Object.defineProperty(z9,"__esModule",{value:!0});function J7e(t,e,r){let i=0,n=t.length;for(;n>0;){let s=n/2|0,o=i+s;r(t[o],e)<=0?(i=++o,n-=s+1):n=s}return i}z9.default=J7e});var PL=m(H9=>{l();"use strict";Object.defineProperty(H9,"__esModule",{value:!0});var ewe=TL(),RL=class{constructor(){this._queue=[]}enqueue(e,r){r=Object.assign({priority:0},r);let i={priority:r.priority,run:e};if(this.size&&this._queue[this.size-1].priority>=r.priority){this._queue.push(i);return}let n=ewe.default(this._queue,i,(s,o)=>o.priority-s.priority);this._queue.splice(n,0,i)}dequeue(){let e=this._queue.shift();return e==null?void 0:e.run}filter(e){return this._queue.filter(r=>r.priority===e.priority).map(r=>r.run)}get size(){return this._queue.length}};H9.default=RL});var Yc=m(G9=>{l();"use strict";Object.defineProperty(G9,"__esModule",{value:!0});var twe=EL(),CL=IL(),rwe=PL(),k6=()=>{},iwe=new CL.TimeoutError,OL=class extends twe{constructor(e){var r,i,n,s;super();if(this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=k6,this._resolveIdle=k6,e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:rwe.default},e),!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(i=(r=e.intervalCap)===null||r===void 0?void 0:r.toString())!==null&&i!==void 0?i:""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(s=(n=e.interval)===null||n===void 0?void 0:n.toString())!==null&&s!==void 0?s:""}\` (${typeof e.interval})`);this._carryoverConcurrencyCount=e.carryoverConcurrencyCount,this._isIntervalIgnored=e.intervalCap===1/0||e.interval===0,this._intervalCap=e.intervalCap,this._interval=e.interval,this._queue=new e.queueClass,this._queueClass=e.queueClass,this.concurrency=e.concurrency,this._timeout=e.timeout,this._throwOnTimeout=e.throwOnTimeout===!0,this._isPaused=e.autoStart===!1}get _doesIntervalAllowAnother(){return this._isIntervalIgnored||this._intervalCount<this._intervalCap}get _doesConcurrentAllowAnother(){return this._pendingCount<this._concurrency}_next(){this._pendingCount--,this._tryToStartAnother(),this.emit("next")}_resolvePromises(){this._resolveEmpty(),this._resolveEmpty=k6,this._pendingCount===0&&(this._resolveIdle(),this._resolveIdle=k6,this.emit("idle"))}_onResumeInterval(){this._onInterval(),this._initializeIntervalIfNeeded(),this._timeoutId=void 0}_isIntervalPaused(){let e=Date.now();if(this._intervalId===void 0){let r=this._intervalEnd-e;if(r<0)this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0;else return this._timeoutId===void 0&&(this._timeoutId=setTimeout(()=>{this._onResumeInterval()},r)),!0}return!1}_tryToStartAnother(){if(this._queue.size===0)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){let e=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother){let r=this._queue.dequeue();return r?(this.emit("active"),r(),e&&this._initializeIntervalIfNeeded(),!0):!1}}return!1}_initializeIntervalIfNeeded(){this._isIntervalIgnored||this._intervalId!==void 0||(this._intervalId=setInterval(()=>{this._onInterval()},this._interval),this._intervalEnd=Date.now()+this._interval)}_onInterval(){this._intervalCount===0&&this._pendingCount===0&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}_processQueue(){for(;this._tryToStartAnother(););}get concurrency(){return this._concurrency}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this._concurrency=e,this._processQueue()}async add(e,r={}){return new Promise((i,n)=>{let s=async()=>{this._pendingCount++,this._intervalCount++;try{let o=this._timeout===void 0&&r.timeout===void 0?e():CL.default(Promise.resolve(e()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&n(iwe)});i(await o)}catch(o){n(o)}this._next()};this._queue.enqueue(s,r),this._tryToStartAnother(),this.emit("add")})}async addAll(e,r){return Promise.all(e.map(async i=>this.add(i,r)))}start(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}pause(){this._isPaused=!0}clear(){this._queue=new this._queueClass}async onEmpty(){if(this._queue.size!==0)return new Promise(e=>{let r=this._resolveEmpty;this._resolveEmpty=()=>{r(),e()}})}async onIdle(){if(!(this._pendingCount===0&&this._queue.size===0))return new Promise(e=>{let r=this._resolveIdle;this._resolveIdle=()=>{r(),e()}})}get size(){return this._queue.size}sizeBy(e){return this._queue.filter(e).length}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}get timeout(){return this._timeout}set timeout(e){this._timeout=e}};G9.default=OL});var $9=m(D6=>{l();"use strict";var kL=class extends Error{constructor(e="Request timed out"){super(e);this.name="TimeoutError"}};D6.TimeoutError=kL;var DL=class extends Error{constructor(e="The operation was aborted."){super(e);this.name="AbortError"}};D6.AbortError=DL;var BL=class extends Error{constructor(e){super(e.statusText);this.name="HTTPError",this.response=e}};D6.HTTPError=BL});var NL=m(()=>{l()});var fy=m((m0,ML)=>{l();"use strict";var nwe=function(){if(typeof self!="undefined")return self;if(typeof window!="undefined")return window;if(typeof Xc!="undefined")return Xc;throw new Error("unable to locate global object")},Xc=nwe();ML.exports=m0=Xc.fetch;Xc.fetch&&(m0.default=Xc.fetch.bind(Xc));m0.Headers=Xc.Headers;m0.Request=Xc.Request;m0.Response=Xc.Response});var Y9=m((fst,W9)=>{l();"use strict";globalThis.fetch&&globalThis.Headers&&globalThis.Request&&globalThis.Response?W9.exports={default:globalThis.fetch,Headers:globalThis.Headers,Request:globalThis.Request,Response:globalThis.Response}:W9.exports={default:fy().default,Headers:fy().Headers,Request:fy().Request,Response:fy().Response}});var LL=m((lst,X9)=>{l();"use strict";var{isElectronMain:swe}=P2();swe?X9.exports=NL():X9.exports=Y9()});var FL=m((dst,UL)=>{l();"use strict";var{TimeoutError:owe,AbortError:awe}=$9(),{Response:qL,Request:cwe,Headers:Q9,default:uwe}=LL(),fwe=(t,e={})=>{let r=new XMLHttpRequest;r.open(e.method||"GET",t.toString(),!0);let{timeout:i,headers:n}=e;if(i&&i>0&&i<1/0&&(r.timeout=i),e.overrideMimeType!=null&&r.overrideMimeType(e.overrideMimeType),n)for(let[s,o]of new Q9(n))r.setRequestHeader(s,o);return e.signal&&(e.signal.onabort=()=>r.abort()),e.onUploadProgress&&(r.upload.onprogress=e.onUploadProgress),r.responseType="arraybuffer",new Promise((s,o)=>{let a=c=>{switch(c.type){case"error":{s(qL.error());break}case"load":{s(new jL(r.responseURL,r.response,{status:r.status,statusText:r.statusText,headers:hwe(r.getAllResponseHeaders())}));break}case"timeout":{o(new owe);break}case"abort":{o(new awe);break}default:break}};r.onerror=a,r.onload=a,r.ontimeout=a,r.onabort=a,r.send(e.body)})},lwe=uwe,dwe=(t,e={})=>e.onUploadProgress!=null?fwe(t,e):lwe(t,e),hwe=t=>{let e=new Q9;for(let r of t.trim().split(/[\r\n]+/)){let i=r.indexOf(": ");i>0&&e.set(r.slice(0,i),r.slice(i+1))}return e},jL=class extends qL{constructor(e,r,i){super(r,i);Object.defineProperty(this,"url",{value:e})}};UL.exports={fetch:dwe,Request:cwe,Headers:Q9}});var ly=m((hst,$L)=>{l();"use strict";var{fetch:pwe,Request:ywe,Headers:gwe}=FL(),{TimeoutError:Z9,HTTPError:KL}=$9(),VL=Al().bind({ignoreUndefined:!0}),{URL:zL,URLSearchParams:HL}=_6(),{AbortController:mwe}=wn(),bwe=sf(),vwe=(t,e,r)=>{if(e===void 0)return t;let i=Date.now(),n=()=>Date.now()-i>=e;return new Promise((s,o)=>{let a=setTimeout(()=>{n()&&(o(new Z9),r.abort())},e),c=u=>d=>{if(clearTimeout(a),n()){o(new Z9);return}u(d)};t.then(c(s),c(o))})},wwe={throwHttpErrors:!0,credentials:"same-origin"},jn=class{constructor(e={}){this.opts=VL(wwe,e)}async fetch(e,r={}){let i=VL(this.opts,r),n=new gwe(i.headers);if(typeof e!="string"&&!(e instanceof zL||e instanceof ywe))throw new TypeError("`resource` must be a string, URL, or Request");let s=new zL(e.toString(),i.base),{searchParams:o,transformSearchParams:a,json:c}=i;o&&(typeof a=="function"?s.search=a(new HL(i.searchParams)):s.search=new HL(i.searchParams)),c&&(i.body=JSON.stringify(i.json),n.set("content-type","application/json"));let u=new mwe,f=bwe([u.signal,i.signal]),d=await vwe(pwe(s.toString(),{...i,signal:f,timeout:void 0,headers:n}),i.timeout,u);if(!d.ok&&i.throwHttpErrors)throw i.handleError&&await i.handleError(d),new KL(d);return d.iterator=function(){return GL(d.body)},d.ndjson=async function*(){for await(let h of _we(d.iterator()))r.transform?yield r.transform(h):yield h},d}post(e,r={}){return this.fetch(e,{...r,method:"POST"})}get(e,r={}){return this.fetch(e,{...r,method:"GET"})}put(e,r={}){return this.fetch(e,{...r,method:"PUT"})}delete(e,r={}){return this.fetch(e,{...r,method:"DELETE"})}options(e,r={}){return this.fetch(e,{...r,method:"OPTIONS"})}},_we=async function*(t){let e=new TextDecoder,r="";for await(let i of t){r+=e.decode(i,{stream:!0});let n=r.split(/\r?\n/);for(let s=0;s<n.length-1;s++){let o=n[s].trim();o.length>0&&(yield JSON.parse(o))}r=n[n.length-1]}r+=e.decode(),r=r.trim(),r.length!==0&&(yield JSON.parse(r))},GL=t=>{if(xwe(t)){let e=t[Symbol.asyncIterator]();return{[Symbol.asyncIterator](){return{next:e.next.bind(e),return(r){return t.destroy(),typeof e.return=="function"?e.return():Promise.resolve({done:!0,value:r})}}}}}if(Swe(t)){let e=t.getReader();return async function*(){try{for(;;){let{done:r,value:i}=await e.read();if(r)return;i&&(yield i)}}finally{e.releaseLock()}}()}if(Ewe(t))return t;throw new TypeError("Body can't be converted to AsyncIterable")},Ewe=t=>typeof t=="object"&&t!==null&&typeof t[Symbol.asyncIterator]=="function",Swe=t=>t&&typeof t.getReader=="function",xwe=t=>Object.prototype.hasOwnProperty.call(t,"readable")&&Object.prototype.hasOwnProperty.call(t,"writable");jn.HTTPError=KL;jn.TimeoutError=Z9;jn.streamToAsyncIterator=GL;jn.post=(t,e)=>new jn(e).post(t,e);jn.get=(t,e)=>new jn(e).get(t,e);jn.put=(t,e)=>new jn(e).put(t,e);jn.delete=(t,e)=>new jn(e).delete(t,e);jn.options=(t,e)=>new jn(e).options(t,e);$L.exports=jn});var M6=m((wst,eq)=>{l();"use strict";var Nl=Vi(),N6=Nl.Reader,JL=Nl.Writer,En=Nl.util,Ws=Nl.roots["libp2p-crypto-keys"]||(Nl.roots["libp2p-crypto-keys"]={});Ws.KeyType=function(){var t={},e=Object.create(t);return e[t[0]="RSA"]=0,e[t[1]="Ed25519"]=1,e[t[2]="Secp256k1"]=2,e}();Ws.PublicKey=function(){function t(e){if(e)for(var r=Object.keys(e),i=0;i<r.length;++i)e[r[i]]!=null&&(this[r[i]]=e[r[i]])}return t.prototype.Type=0,t.prototype.Data=En.newBuffer([]),t.encode=function(r,i){return i||(i=JL.create()),i.uint32(8).int32(r.Type),i.uint32(18).bytes(r.Data),i},t.decode=function(r,i){r instanceof N6||(r=N6.create(r));for(var n=i===void 0?r.len:r.pos+i,s=new Ws.PublicKey;r.pos<n;){var o=r.uint32();switch(o>>>3){case 1:s.Type=r.int32();break;case 2:s.Data=r.bytes();break;default:r.skipType(o&7);break}}if(!s.hasOwnProperty("Type"))throw En.ProtocolError("missing required 'Type'",{instance:s});if(!s.hasOwnProperty("Data"))throw En.ProtocolError("missing required 'Data'",{instance:s});return s},t.fromObject=function(r){if(r instanceof Ws.PublicKey)return r;var i=new Ws.PublicKey;switch(r.Type){case"RSA":case 0:i.Type=0;break;case"Ed25519":case 1:i.Type=1;break;case"Secp256k1":case 2:i.Type=2;break}return r.Data!=null&&(typeof r.Data=="string"?En.base64.decode(r.Data,i.Data=En.newBuffer(En.base64.length(r.Data)),0):r.Data.length&&(i.Data=r.Data)),i},t.toObject=function(r,i){i||(i={});var n={};return i.defaults&&(n.Type=i.enums===String?"RSA":0,i.bytes===String?n.Data="":(n.Data=[],i.bytes!==Array&&(n.Data=En.newBuffer(n.Data)))),r.Type!=null&&r.hasOwnProperty("Type")&&(n.Type=i.enums===String?Ws.KeyType[r.Type]:r.Type),r.Data!=null&&r.hasOwnProperty("Data")&&(n.Data=i.bytes===String?En.base64.encode(r.Data,0,r.Data.length):i.bytes===Array?Array.prototype.slice.call(r.Data):r.Data),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,Nl.util.toJSONOptions)},t}();Ws.PrivateKey=function(){function t(e){if(e)for(var r=Object.keys(e),i=0;i<r.length;++i)e[r[i]]!=null&&(this[r[i]]=e[r[i]])}return t.prototype.Type=0,t.prototype.Data=En.newBuffer([]),t.encode=function(r,i){return i||(i=JL.create()),i.uint32(8).int32(r.Type),i.uint32(18).bytes(r.Data),i},t.decode=function(r,i){r instanceof N6||(r=N6.create(r));for(var n=i===void 0?r.len:r.pos+i,s=new Ws.PrivateKey;r.pos<n;){var o=r.uint32();switch(o>>>3){case 1:s.Type=r.int32();break;case 2:s.Data=r.bytes();break;default:r.skipType(o&7);break}}if(!s.hasOwnProperty("Type"))throw En.ProtocolError("missing required 'Type'",{instance:s});if(!s.hasOwnProperty("Data"))throw En.ProtocolError("missing required 'Data'",{instance:s});return s},t.fromObject=function(r){if(r instanceof Ws.PrivateKey)return r;var i=new Ws.PrivateKey;switch(r.Type){case"RSA":case 0:i.Type=0;break;case"Ed25519":case 1:i.Type=1;break;case"Secp256k1":case 2:i.Type=2;break}return r.Data!=null&&(typeof r.Data=="string"?En.base64.decode(r.Data,i.Data=En.newBuffer(En.base64.length(r.Data)),0):r.Data.length&&(i.Data=r.Data)),i},t.toObject=function(r,i){i||(i={});var n={};return i.defaults&&(n.Type=i.enums===String?"RSA":0,i.bytes===String?n.Data="":(n.Data=[],i.bytes!==Array&&(n.Data=En.newBuffer(n.Data)))),r.Type!=null&&r.hasOwnProperty("Type")&&(n.Type=i.enums===String?Ws.KeyType[r.Type]:r.Type),r.Data!=null&&r.hasOwnProperty("Data")&&(n.Data=i.bytes===String?En.base64.encode(r.Data,0,r.Data.length):i.bytes===Array?Array.prototype.slice.call(r.Data):r.Data),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,Nl.util.toJSONOptions)},t}();eq.exports=Ws});var yt=m((_st,tq)=>{l();tq.exports={options:{usePureJavaScript:!1}}});var nq=m((Est,iq)=>{l();var e_={};iq.exports=e_;var rq={};e_.encode=function(t,e,r){if(typeof e!="string")throw new TypeError('"alphabet" must be a string.');if(r!==void 0&&typeof r!="number")throw new TypeError('"maxline" must be a number.');var i="";if(!(t instanceof Uint8Array))i=Pwe(t,e);else{var n=0,s=e.length,o=e.charAt(0),a=[0];for(n=0;n<t.length;++n){for(var c=0,u=t[n];c<a.length;++c)u+=a[c]<<8,a[c]=u%s,u=u/s|0;for(;u>0;)a.push(u%s),u=u/s|0}for(n=0;t[n]===0&&n<t.length-1;++n)i+=o;for(n=a.length-1;n>=0;--n)i+=e[a[n]]}if(r){var f=new RegExp(".{1,"+r+"}","g");i=i.match(f).join(`\r
`)}return i};e_.decode=function(t,e){if(typeof t!="string")throw new TypeError('"input" must be a string.');if(typeof e!="string")throw new TypeError('"alphabet" must be a string.');var r=rq[e];if(!r){r=rq[e]=[];for(var i=0;i<e.length;++i)r[e.charCodeAt(i)]=i}t=t.replace(/\s/g,"");for(var n=e.length,s=e.charAt(0),o=[0],i=0;i<t.length;i++){var a=r[t.charCodeAt(i)];if(a===void 0)return;for(var c=0,u=a;c<o.length;++c)u+=o[c]*n,o[c]=u&255,u>>=8;for(;u>0;)o.push(u&255),u>>=8}for(var f=0;t[f]===s&&f<t.length-1;++f)o.push(0);return typeof Buffer!="undefined"?Buffer.from(o.reverse()):new Uint8Array(o.reverse())};function Pwe(t,e){var r=0,i=e.length,n=e.charAt(0),s=[0];for(r=0;r<t.length();++r){for(var o=0,a=t.at(r);o<s.length;++o)a+=s[o]<<8,s[o]=a%i,a=a/i|0;for(;a>0;)s.push(a%i),a=a/i|0}var c="";for(r=0;t.at(r)===0&&r<t.length()-1;++r)c+=n;for(r=s.length-1;r>=0;--r)c+=e[s[r]];return c}});var nr=m((Sst,cq)=>{l();var sq=yt(),oq=nq(),se=cq.exports=sq.util=sq.util||{};(function(){if(typeof process!="undefined"&&process.nextTick&&!process.browser){se.nextTick=process.nextTick,typeof setImmediate=="function"?se.setImmediate=setImmediate:se.setImmediate=se.nextTick;return}if(typeof setImmediate=="function"){se.setImmediate=function(){return setImmediate.apply(void 0,arguments)},se.nextTick=function(a){return setImmediate(a)};return}if(se.setImmediate=function(a){setTimeout(a,0)},typeof window!="undefined"&&typeof window.postMessage=="function"){let a=function(c){if(c.source===window&&c.data===t){c.stopPropagation();var u=e.slice();e.length=0,u.forEach(function(f){f()})}};var o=a,t="forge.setImmediate",e=[];se.setImmediate=function(c){e.push(c),e.length===1&&window.postMessage(t,"*")},window.addEventListener("message",a,!0)}if(typeof MutationObserver!="undefined"){var r=Date.now(),i=!0,n=document.createElement("div"),e=[];new MutationObserver(function(){var c=e.slice();e.length=0,c.forEach(function(u){u()})}).observe(n,{attributes:!0});var s=se.setImmediate;se.setImmediate=function(c){Date.now()-r>15?(r=Date.now(),s(c)):(e.push(c),e.length===1&&n.setAttribute("a",i=!i))}}se.nextTick=se.setImmediate})();se.isNodejs=typeof process!="undefined"&&process.versions&&process.versions.node;se.globalScope=function(){return se.isNodejs?globalThis:typeof self=="undefined"?window:self}();se.isArray=Array.isArray||function(t){return Object.prototype.toString.call(t)==="[object Array]"};se.isArrayBuffer=function(t){return typeof ArrayBuffer!="undefined"&&t instanceof ArrayBuffer};se.isArrayBufferView=function(t){return t&&se.isArrayBuffer(t.buffer)&&t.byteLength!==void 0};function dy(t){if(!(t===8||t===16||t===24||t===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+t)}se.ByteBuffer=t_;function t_(t){if(this.data="",this.read=0,typeof t=="string")this.data=t;else if(se.isArrayBuffer(t)||se.isArrayBufferView(t))if(typeof Buffer!="undefined"&&t instanceof Buffer)this.data=t.toString("binary");else{var e=new Uint8Array(t);try{this.data=String.fromCharCode.apply(null,e)}catch(i){for(var r=0;r<e.length;++r)this.putByte(e[r])}}else(t instanceof t_||typeof t=="object"&&typeof t.data=="string"&&typeof t.read=="number")&&(this.data=t.data,this.read=t.read);this._constructedStringLength=0}se.ByteStringBuffer=t_;var Cwe=4096;se.ByteStringBuffer.prototype._optimizeConstructedString=function(t){this._constructedStringLength+=t,this._constructedStringLength>Cwe&&(this.data.substr(0,1),this._constructedStringLength=0)};se.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read};se.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0};se.ByteStringBuffer.prototype.putByte=function(t){return this.putBytes(String.fromCharCode(t))};se.ByteStringBuffer.prototype.fillWithByte=function(t,e){t=String.fromCharCode(t);for(var r=this.data;e>0;)e&1&&(r+=t),e>>>=1,e>0&&(t+=t);return this.data=r,this._optimizeConstructedString(e),this};se.ByteStringBuffer.prototype.putBytes=function(t){return this.data+=t,this._optimizeConstructedString(t.length),this};se.ByteStringBuffer.prototype.putString=function(t){return this.putBytes(se.encodeUtf8(t))};se.ByteStringBuffer.prototype.putInt16=function(t){return this.putBytes(String.fromCharCode(t>>8&255)+String.fromCharCode(t&255))};se.ByteStringBuffer.prototype.putInt24=function(t){return this.putBytes(String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t&255))};se.ByteStringBuffer.prototype.putInt32=function(t){return this.putBytes(String.fromCharCode(t>>24&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t&255))};se.ByteStringBuffer.prototype.putInt16Le=function(t){return this.putBytes(String.fromCharCode(t&255)+String.fromCharCode(t>>8&255))};se.ByteStringBuffer.prototype.putInt24Le=function(t){return this.putBytes(String.fromCharCode(t&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t>>16&255))};se.ByteStringBuffer.prototype.putInt32Le=function(t){return this.putBytes(String.fromCharCode(t&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>24&255))};se.ByteStringBuffer.prototype.putInt=function(t,e){dy(e);var r="";do e-=8,r+=String.fromCharCode(t>>e&255);while(e>0);return this.putBytes(r)};se.ByteStringBuffer.prototype.putSignedInt=function(t,e){return t<0&&(t+=2<<e-1),this.putInt(t,e)};se.ByteStringBuffer.prototype.putBuffer=function(t){return this.putBytes(t.getBytes())};se.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)};se.ByteStringBuffer.prototype.getInt16=function(){var t=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,t};se.ByteStringBuffer.prototype.getInt24=function(){var t=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,t};se.ByteStringBuffer.prototype.getInt32=function(){var t=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,t};se.ByteStringBuffer.prototype.getInt16Le=function(){var t=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,t};se.ByteStringBuffer.prototype.getInt24Le=function(){var t=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,t};se.ByteStringBuffer.prototype.getInt32Le=function(){var t=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,t};se.ByteStringBuffer.prototype.getInt=function(t){dy(t);var e=0;do e=(e<<8)+this.data.charCodeAt(this.read++),t-=8;while(t>0);return e};se.ByteStringBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<<t-2;return e>=r&&(e-=r<<1),e};se.ByteStringBuffer.prototype.getBytes=function(t){var e;return t?(t=Math.min(this.length(),t),e=this.data.slice(this.read,this.read+t),this.read+=t):t===0?e="":(e=this.read===0?this.data:this.data.slice(this.read),this.clear()),e};se.ByteStringBuffer.prototype.bytes=function(t){return typeof t=="undefined"?this.data.slice(this.read):this.data.slice(this.read,this.read+t)};se.ByteStringBuffer.prototype.at=function(t){return this.data.charCodeAt(this.read+t)};se.ByteStringBuffer.prototype.setAt=function(t,e){return this.data=this.data.substr(0,this.read+t)+String.fromCharCode(e)+this.data.substr(this.read+t+1),this};se.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)};se.ByteStringBuffer.prototype.copy=function(){var t=se.createBuffer(this.data);return t.read=this.read,t};se.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this};se.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this};se.ByteStringBuffer.prototype.truncate=function(t){var e=Math.max(0,this.length()-t);return this.data=this.data.substr(this.read,e),this.read=0,this};se.ByteStringBuffer.prototype.toHex=function(){for(var t="",e=this.read;e<this.data.length;++e){var r=this.data.charCodeAt(e);r<16&&(t+="0"),t+=r.toString(16)}return t};se.ByteStringBuffer.prototype.toString=function(){return se.decodeUtf8(this.bytes())};function Owe(t,e){e=e||{},this.read=e.readOffset||0,this.growSize=e.growSize||1024;var r=se.isArrayBuffer(t),i=se.isArrayBufferView(t);if(r||i){r?this.data=new DataView(t):this.data=new DataView(t.buffer,t.byteOffset,t.byteLength),this.write="writeOffset"in e?e.writeOffset:this.data.byteLength;return}this.data=new DataView(new ArrayBuffer(0)),this.write=0,t!=null&&this.putBytes(t),"writeOffset"in e&&(this.write=e.writeOffset)}se.DataBuffer=Owe;se.DataBuffer.prototype.length=function(){return this.write-this.read};se.DataBuffer.prototype.isEmpty=function(){return this.length()<=0};se.DataBuffer.prototype.accommodate=function(t,e){if(this.length()>=t)return this;e=Math.max(e||this.growSize,t);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),i=new Uint8Array(this.length()+e);return i.set(r),this.data=new DataView(i.buffer),this};se.DataBuffer.prototype.putByte=function(t){return this.accommodate(1),this.data.setUint8(this.write++,t),this};se.DataBuffer.prototype.fillWithByte=function(t,e){this.accommodate(e);for(var r=0;r<e;++r)this.data.setUint8(t);return this};se.DataBuffer.prototype.putBytes=function(t,e){if(se.isArrayBufferView(t)){var r=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),i=r.byteLength-r.byteOffset;this.accommodate(i);var n=new Uint8Array(this.data.buffer,this.write);return n.set(r),this.write+=i,this}if(se.isArrayBuffer(t)){var r=new Uint8Array(t);this.accommodate(r.byteLength);var n=new Uint8Array(this.data.buffer);return n.set(r,this.write),this.write+=r.byteLength,this}if(t instanceof se.DataBuffer||typeof t=="object"&&typeof t.read=="number"&&typeof t.write=="number"&&se.isArrayBufferView(t.data)){var r=new Uint8Array(t.data.byteLength,t.read,t.length());this.accommodate(r.byteLength);var n=new Uint8Array(t.data.byteLength,this.write);return n.set(r),this.write+=r.byteLength,this}if(t instanceof se.ByteStringBuffer&&(t=t.data,e="binary"),e=e||"binary",typeof t=="string"){var s;if(e==="hex")return this.accommodate(Math.ceil(t.length/2)),s=new Uint8Array(this.data.buffer,this.write),this.write+=se.binary.hex.decode(t,s,this.write),this;if(e==="base64")return this.accommodate(Math.ceil(t.length/4)*3),s=new Uint8Array(this.data.buffer,this.write),this.write+=se.binary.base64.decode(t,s,this.write),this;if(e==="utf8"&&(t=se.encodeUtf8(t),e="binary"),e==="binary"||e==="raw")return this.accommodate(t.length),s=new Uint8Array(this.data.buffer,this.write),this.write+=se.binary.raw.decode(s),this;if(e==="utf16")return this.accommodate(t.length*2),s=new Uint16Array(this.data.buffer,this.write),this.write+=se.text.utf16.encode(s),this;throw new Error("Invalid encoding: "+e)}throw Error("Invalid parameter: "+t)};se.DataBuffer.prototype.putBuffer=function(t){return this.putBytes(t),t.clear(),this};se.DataBuffer.prototype.putString=function(t){return this.putBytes(t,"utf16")};se.DataBuffer.prototype.putInt16=function(t){return this.accommodate(2),this.data.setInt16(this.write,t),this.write+=2,this};se.DataBuffer.prototype.putInt24=function(t){return this.accommodate(3),this.data.setInt16(this.write,t>>8&65535),this.data.setInt8(this.write,t>>16&255),this.write+=3,this};se.DataBuffer.prototype.putInt32=function(t){return this.accommodate(4),this.data.setInt32(this.write,t),this.write+=4,this};se.DataBuffer.prototype.putInt16Le=function(t){return this.accommodate(2),this.data.setInt16(this.write,t,!0),this.write+=2,this};se.DataBuffer.prototype.putInt24Le=function(t){return this.accommodate(3),this.data.setInt8(this.write,t>>16&255),this.data.setInt16(this.write,t>>8&65535,!0),this.write+=3,this};se.DataBuffer.prototype.putInt32Le=function(t){return this.accommodate(4),this.data.setInt32(this.write,t,!0),this.write+=4,this};se.DataBuffer.prototype.putInt=function(t,e){dy(e),this.accommodate(e/8);do e-=8,this.data.setInt8(this.write++,t>>e&255);while(e>0);return this};se.DataBuffer.prototype.putSignedInt=function(t,e){return dy(e),this.accommodate(e/8),t<0&&(t+=2<<e-1),this.putInt(t,e)};se.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)};se.DataBuffer.prototype.getInt16=function(){var t=this.data.getInt16(this.read);return this.read+=2,t};se.DataBuffer.prototype.getInt24=function(){var t=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,t};se.DataBuffer.prototype.getInt32=function(){var t=this.data.getInt32(this.read);return this.read+=4,t};se.DataBuffer.prototype.getInt16Le=function(){var t=this.data.getInt16(this.read,!0);return this.read+=2,t};se.DataBuffer.prototype.getInt24Le=function(){var t=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,t};se.DataBuffer.prototype.getInt32Le=function(){var t=this.data.getInt32(this.read,!0);return this.read+=4,t};se.DataBuffer.prototype.getInt=function(t){dy(t);var e=0;do e=(e<<8)+this.data.getInt8(this.read++),t-=8;while(t>0);return e};se.DataBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<<t-2;return e>=r&&(e-=r<<1),e};se.DataBuffer.prototype.getBytes=function(t){var e;return t?(t=Math.min(this.length(),t),e=this.data.slice(this.read,this.read+t),this.read+=t):t===0?e="":(e=this.read===0?this.data:this.data.slice(this.read),this.clear()),e};se.DataBuffer.prototype.bytes=function(t){return typeof t=="undefined"?this.data.slice(this.read):this.data.slice(this.read,this.read+t)};se.DataBuffer.prototype.at=function(t){return this.data.getUint8(this.read+t)};se.DataBuffer.prototype.setAt=function(t,e){return this.data.setUint8(t,e),this};se.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)};se.DataBuffer.prototype.copy=function(){return new se.DataBuffer(this)};se.DataBuffer.prototype.compact=function(){if(this.read>0){var t=new Uint8Array(this.data.buffer,this.read),e=new Uint8Array(t.byteLength);e.set(t),this.data=new DataView(e),this.write-=this.read,this.read=0}return this};se.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this};se.DataBuffer.prototype.truncate=function(t){return this.write=Math.max(0,this.length()-t),this.read=Math.min(this.read,this.write),this};se.DataBuffer.prototype.toHex=function(){for(var t="",e=this.read;e<this.data.byteLength;++e){var r=this.data.getUint8(e);r<16&&(t+="0"),t+=r.toString(16)}return t};se.DataBuffer.prototype.toString=function(t){var e=new Uint8Array(this.data,this.read,this.length());if(t=t||"utf8",t==="binary"||t==="raw")return se.binary.raw.encode(e);if(t==="hex")return se.binary.hex.encode(e);if(t==="base64")return se.binary.base64.encode(e);if(t==="utf8")return se.text.utf8.decode(e);if(t==="utf16")return se.text.utf16.decode(e);throw new Error("Invalid encoding: "+t)};se.createBuffer=function(t,e){return e=e||"raw",t!==void 0&&e==="utf8"&&(t=se.encodeUtf8(t)),new se.ByteBuffer(t)};se.fillString=function(t,e){for(var r="";e>0;)e&1&&(r+=t),e>>>=1,e>0&&(t+=t);return r};se.xorBytes=function(t,e,r){for(var i="",n="",s="",o=0,a=0;r>0;--r,++o)n=t.charCodeAt(o)^e.charCodeAt(o),a>=10&&(i+=s,s="",a=0),s+=String.fromCharCode(n),++a;return i+=s,i};se.hexToBytes=function(t){var e="",r=0;for(t.length&!0&&(r=1,e+=String.fromCharCode(parseInt(t[0],16)));r<t.length;r+=2)e+=String.fromCharCode(parseInt(t.substr(r,2),16));return e};se.bytesToHex=function(t){return se.createBuffer(t).toHex()};se.int32ToBytes=function(t){return String.fromCharCode(t>>24&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t&255)};var ff="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",lf=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],aq="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";se.encode64=function(t,e){for(var r="",i="",n,s,o,a=0;a<t.length;)n=t.charCodeAt(a++),s=t.charCodeAt(a++),o=t.charCodeAt(a++),r+=ff.charAt(n>>2),r+=ff.charAt((n&3)<<4|s>>4),isNaN(s)?r+="==":(r+=ff.charAt((s&15)<<2|o>>6),r+=isNaN(o)?"=":ff.charAt(o&63)),e&&r.length>e&&(i+=r.substr(0,e)+`\r
`,r=r.substr(e));return i+=r,i};se.decode64=function(t){t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var e="",r,i,n,s,o=0;o<t.length;)r=lf[t.charCodeAt(o++)-43],i=lf[t.charCodeAt(o++)-43],n=lf[t.charCodeAt(o++)-43],s=lf[t.charCodeAt(o++)-43],e+=String.fromCharCode(r<<2|i>>4),n!==64&&(e+=String.fromCharCode((i&15)<<4|n>>2),s!==64&&(e+=String.fromCharCode((n&3)<<6|s)));return e};se.encodeUtf8=function(t){return unescape(encodeURIComponent(t))};se.decodeUtf8=function(t){return decodeURIComponent(escape(t))};se.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:oq.encode,decode:oq.decode}};se.binary.raw.encode=function(t){return String.fromCharCode.apply(null,t)};se.binary.raw.decode=function(t,e,r){var i=e;i||(i=new Uint8Array(t.length)),r=r||0;for(var n=r,s=0;s<t.length;++s)i[n++]=t.charCodeAt(s);return e?n-r:i};se.binary.hex.encode=se.bytesToHex;se.binary.hex.decode=function(t,e,r){var i=e;i||(i=new Uint8Array(Math.ceil(t.length/2))),r=r||0;var n=0,s=r;for(t.length&1&&(n=1,i[s++]=parseInt(t[0],16));n<t.length;n+=2)i[s++]=parseInt(t.substr(n,2),16);return e?s-r:i};se.binary.base64.encode=function(t,e){for(var r="",i="",n,s,o,a=0;a<t.byteLength;)n=t[a++],s=t[a++],o=t[a++],r+=ff.charAt(n>>2),r+=ff.charAt((n&3)<<4|s>>4),isNaN(s)?r+="==":(r+=ff.charAt((s&15)<<2|o>>6),r+=isNaN(o)?"=":ff.charAt(o&63)),e&&r.length>e&&(i+=r.substr(0,e)+`\r
`,r=r.substr(e));return i+=r,i};se.binary.base64.decode=function(t,e,r){var i=e;i||(i=new Uint8Array(Math.ceil(t.length/4)*3)),t=t.replace(/[^A-Za-z0-9\+\/\=]/g,""),r=r||0;for(var n,s,o,a,c=0,u=r;c<t.length;)n=lf[t.charCodeAt(c++)-43],s=lf[t.charCodeAt(c++)-43],o=lf[t.charCodeAt(c++)-43],a=lf[t.charCodeAt(c++)-43],i[u++]=n<<2|s>>4,o!==64&&(i[u++]=(s&15)<<4|o>>2,a!==64&&(i[u++]=(o&3)<<6|a));return e?u-r:i.subarray(0,u)};se.binary.base58.encode=function(t,e){return se.binary.baseN.encode(t,aq,e)};se.binary.base58.decode=function(t,e){return se.binary.baseN.decode(t,aq,e)};se.text={utf8:{},utf16:{}};se.text.utf8.encode=function(t,e,r){t=se.encodeUtf8(t);var i=e;i||(i=new Uint8Array(t.length)),r=r||0;for(var n=r,s=0;s<t.length;++s)i[n++]=t.charCodeAt(s);return e?n-r:i};se.text.utf8.decode=function(t){return se.decodeUtf8(String.fromCharCode.apply(null,t))};se.text.utf16.encode=function(t,e,r){var i=e;i||(i=new Uint8Array(t.length*2));var n=new Uint16Array(i.buffer);r=r||0;for(var s=r,o=r,a=0;a<t.length;++a)n[o++]=t.charCodeAt(a),s+=2;return e?s-r:i};se.text.utf16.decode=function(t){return String.fromCharCode.apply(null,new Uint16Array(t.buffer))};se.deflate=function(t,e,r){if(e=se.decode64(t.deflate(se.encode64(e)).rval),r){var i=2,n=e.charCodeAt(1);n&32&&(i=6),e=e.substring(i,e.length-4)}return e};se.inflate=function(t,e,r){var i=t.inflate(se.encode64(e)).rval;return i===null?null:se.decode64(i)};var r_=function(t,e,r){if(!t)throw new Error("WebStorage not available.");var i;if(r===null?i=t.removeItem(e):(r=se.encode64(JSON.stringify(r)),i=t.setItem(e,r)),typeof i!="undefined"&&i.rval!==!0){var n=new Error(i.error.message);throw n.id=i.error.id,n.name=i.error.name,n}},i_=function(t,e){if(!t)throw new Error("WebStorage not available.");var r=t.getItem(e);if(t.init)if(r.rval===null){if(r.error){var i=new Error(r.error.message);throw i.id=r.error.id,i.name=r.error.name,i}r=null}else r=r.rval;return r!==null&&(r=JSON.parse(se.decode64(r))),r},kwe=function(t,e,r,i){var n=i_(t,e);n===null&&(n={}),n[r]=i,r_(t,e,n)},Dwe=function(t,e,r){var i=i_(t,e);return i!==null&&(i=r in i?i[r]:null),i},Bwe=function(t,e,r){var i=i_(t,e);if(i!==null&&r in i){delete i[r];var n=!0;for(var s in i){n=!1;break}n&&(i=null),r_(t,e,i)}},Nwe=function(t,e){r_(t,e,null)},L6=function(t,e,r){var i=null;typeof r=="undefined"&&(r=["web","flash"]);var n,s=!1,o=null;for(var a in r){n=r[a];try{if(n==="flash"||n==="both"){if(e[0]===null)throw new Error("Flash local storage not available.");i=t.apply(this,e),s=n==="flash"}(n==="web"||n==="both")&&(e[0]=localStorage,i=t.apply(this,e),s=!0)}catch(c){o=c}if(s)break}if(!s)throw o;return i};se.setItem=function(t,e,r,i,n){L6(kwe,arguments,n)};se.getItem=function(t,e,r,i){return L6(Dwe,arguments,i)};se.removeItem=function(t,e,r,i){L6(Bwe,arguments,i)};se.clearItems=function(t,e,r){L6(Nwe,arguments,r)};se.parseUrl=function(t){var e=/^(https?):\/\/([^:&^\/]*):?(\d*)(.*)$/g;e.lastIndex=0;var r=e.exec(t),i=r===null?null:{full:t,scheme:r[1],host:r[2],port:r[3],path:r[4]};return i&&(i.fullHost=i.host,i.port?(i.port!==80&&i.scheme==="http"||i.port!==443&&i.scheme==="https")&&(i.fullHost+=":"+i.port):i.scheme==="http"?i.port=80:i.scheme==="https"&&(i.port=443),i.full=i.scheme+"://"+i.fullHost),i};var q6=null;se.getQueryVariables=function(t){var e=function(i){for(var n={},s=i.split("&"),o=0;o<s.length;o++){var a=s[o].indexOf("="),c,u;a>0?(c=s[o].substring(0,a),u=s[o].substring(a+1)):(c=s[o],u=null),c in n||(n[c]=[]),!(c in Object.prototype)&&u!==null&&n[c].push(unescape(u))}return n},r;return typeof t=="undefined"?(q6===null&&(typeof window!="undefined"&&window.location&&window.location.search?q6=e(window.location.search.substring(1)):q6={}),r=q6):r=e(t),r};se.parseFragment=function(t){var e=t,r="",i=t.indexOf("?");i>0&&(e=t.substring(0,i),r=t.substring(i+1));var n=e.split("/");n.length>0&&n[0]===""&&n.shift();var s=r===""?{}:se.getQueryVariables(r);return{pathString:e,queryString:r,path:n,query:s}};se.makeRequest=function(t){var e=se.parseFragment(t),r={path:e.pathString,query:e.queryString,getPath:function(i){return typeof i=="undefined"?e.path:e.path[i]},getQuery:function(i,n){var s;return typeof i=="undefined"?s=e.query:(s=e.query[i],s&&typeof n!="undefined"&&(s=s[n])),s},getQueryLast:function(i,n){var s,o=r.getQuery(i);return o?s=o[o.length-1]:s=n,s}};return r};se.makeLink=function(t,e,r){t=jQuery.isArray(t)?t.join("/"):t;var i=jQuery.param(e||{});return r=r||"",t+(i.length>0?"?"+i:"")+(r.length>0?"#"+r:"")};se.isEmpty=function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0};se.format=function(t){for(var e=/%./g,r,i,n=0,s=[],o=0;r=e.exec(t);){i=t.substring(o,e.lastIndex-2),i.length>0&&s.push(i),o=e.lastIndex;var a=r[0][1];switch(a){case"s":case"o":n<arguments.length?s.push(arguments[n+++1]):s.push("<?>");break;case"%":s.push("%");break;default:s.push("<%"+a+"?>")}}return s.push(t.substring(o)),s.join("")};se.formatNumber=function(t,e,r,i){var n=t,s=isNaN(e=Math.abs(e))?2:e,o=r===void 0?",":r,a=i===void 0?".":i,c=n<0?"-":"",u=parseInt(n=Math.abs(+n||0).toFixed(s),10)+"",f=u.length>3?u.length%3:0;return c+(f?u.substr(0,f)+a:"")+u.substr(f).replace(/(\d{3})(?=\d)/g,"$1"+a)+(s?o+Math.abs(n-u).toFixed(s).slice(2):"")};se.formatSize=function(t){return t>=1073741824?t=se.formatNumber(t/1073741824,2,".","")+" GiB":t>=1048576?t=se.formatNumber(t/1048576,2,".","")+" MiB":t>=1024?t=se.formatNumber(t/1024,0)+" KiB":t=se.formatNumber(t,0)+" bytes",t};se.bytesFromIP=function(t){return t.indexOf(".")!==-1?se.bytesFromIPv4(t):t.indexOf(":")!==-1?se.bytesFromIPv6(t):null};se.bytesFromIPv4=function(t){if(t=t.split("."),t.length!==4)return null;for(var e=se.createBuffer(),r=0;r<t.length;++r){var i=parseInt(t[r],10);if(isNaN(i))return null;e.putByte(i)}return e.getBytes()};se.bytesFromIPv6=function(t){var e=0;t=t.split(":").filter(function(o){return o.length===0&&++e,!0});for(var r=(8-t.length+e)*2,i=se.createBuffer(),n=0;n<8;++n){if(!t[n]||t[n].length===0){i.fillWithByte(0,r),r=0;continue}var s=se.hexToBytes(t[n]);s.length<2&&i.putByte(0),i.putBytes(s)}return i.getBytes()};se.bytesToIP=function(t){return t.length===4?se.bytesToIPv4(t):t.length===16?se.bytesToIPv6(t):null};se.bytesToIPv4=function(t){if(t.length!==4)return null;for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r));return e.join(".")};se.bytesToIPv6=function(t){if(t.length!==16)return null;for(var e=[],r=[],i=0,n=0;n<t.length;n+=2){for(var s=se.bytesToHex(t[n]+t[n+1]);s[0]==="0"&&s!=="0";)s=s.substr(1);if(s==="0"){var o=r[r.length-1],a=e.length;!o||a!==o.end+1?r.push({start:a,end:a}):(o.end=a,o.end-o.start>r[i].end-r[i].start&&(i=r.length-1))}e.push(s)}if(r.length>0){var c=r[i];c.end-c.start>0&&(e.splice(c.start,c.end-c.start+1,""),c.start===0&&e.unshift(""),c.end===7&&e.push(""))}return e.join(":")};se.estimateCores=function(t,e){if(typeof t=="function"&&(e=t,t={}),t=t||{},"cores"in se&&!t.update)return e(null,se.cores);if(typeof navigator!="undefined"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return se.cores=navigator.hardwareConcurrency,e(null,se.cores);if(typeof Worker=="undefined")return se.cores=1,e(null,se.cores);if(typeof Blob=="undefined")return se.cores=2,e(null,se.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(o){for(var a=Date.now(),c=a+4;Date.now()<c;);self.postMessage({st:a,et:c})})}.toString(),")()"],{type:"application/javascript"}));i([],5,16);function i(o,a,c){if(a===0){var u=Math.floor(o.reduce(function(f,d){return f+d},0)/o.length);return se.cores=Math.max(1,u),URL.revokeObjectURL(r),e(null,se.cores)}n(c,function(f,d){o.push(s(c,d)),i(o,a-1,c)})}function n(o,a){for(var c=[],u=[],f=0;f<o;++f){var d=new Worker(r);d.addEventListener("message",function(h){if(u.push(h.data),u.length===o){for(var p=0;p<o;++p)c[p].terminate();a(null,u)}}),c.push(d)}for(var f=0;f<o;++f)c[f].postMessage(f)}function s(o,a){for(var c=[],u=0;u<o;++u)for(var f=a[u],d=c[u]=[],h=0;h<o;++h)if(u!==h){var p=a[h];(f.st>p.st&&f.st<p.et||p.st>f.st&&p.st<f.et)&&d.push(h)}return c.reduce(function(y,b){return Math.max(y,b.length)},0)}}});var b0=m((xst,uq)=>{l();var hy=yt();hy.pki=hy.pki||{};var n_=uq.exports=hy.pki.oids=hy.oids=hy.oids||{};function Ie(t,e){n_[t]=e,n_[e]=t}function Qt(t,e){n_[t]=e}Ie("1.2.840.113549.1.1.1","rsaEncryption");Ie("1.2.840.113549.1.1.4","md5WithRSAEncryption");Ie("1.2.840.113549.1.1.5","sha1WithRSAEncryption");Ie("1.2.840.113549.1.1.7","RSAES-OAEP");Ie("1.2.840.113549.1.1.8","mgf1");Ie("1.2.840.113549.1.1.9","pSpecified");Ie("1.2.840.113549.1.1.10","RSASSA-PSS");Ie("1.2.840.113549.1.1.11","sha256WithRSAEncryption");Ie("1.2.840.113549.1.1.12","sha384WithRSAEncryption");Ie("1.2.840.113549.1.1.13","sha512WithRSAEncryption");Ie("1.3.101.112","EdDSA25519");Ie("1.2.840.10040.4.3","dsa-with-sha1");Ie("1.3.14.3.2.7","desCBC");Ie("1.3.14.3.2.26","sha1");Ie("2.16.840.1.101.3.4.2.1","sha256");Ie("2.16.840.1.101.3.4.2.2","sha384");Ie("2.16.840.1.101.3.4.2.3","sha512");Ie("1.2.840.113549.2.5","md5");Ie("1.2.840.113549.1.7.1","data");Ie("1.2.840.113549.1.7.2","signedData");Ie("1.2.840.113549.1.7.3","envelopedData");Ie("1.2.840.113549.1.7.4","signedAndEnvelopedData");Ie("1.2.840.113549.1.7.5","digestedData");Ie("1.2.840.113549.1.7.6","encryptedData");Ie("1.2.840.113549.1.9.1","emailAddress");Ie("1.2.840.113549.1.9.2","unstructuredName");Ie("1.2.840.113549.1.9.3","contentType");Ie("1.2.840.113549.1.9.4","messageDigest");Ie("1.2.840.113549.1.9.5","signingTime");Ie("1.2.840.113549.1.9.6","counterSignature");Ie("1.2.840.113549.1.9.7","challengePassword");Ie("1.2.840.113549.1.9.8","unstructuredAddress");Ie("1.2.840.113549.1.9.14","extensionRequest");Ie("1.2.840.113549.1.9.20","friendlyName");Ie("1.2.840.113549.1.9.21","localKeyId");Ie("1.2.840.113549.1.9.22.1","x509Certificate");Ie("1.2.840.113549.1.12.10.1.1","keyBag");Ie("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag");Ie("1.2.840.113549.1.12.10.1.3","certBag");Ie("1.2.840.113549.1.12.10.1.4","crlBag");Ie("1.2.840.113549.1.12.10.1.5","secretBag");Ie("1.2.840.113549.1.12.10.1.6","safeContentsBag");Ie("1.2.840.113549.1.5.13","pkcs5PBES2");Ie("1.2.840.113549.1.5.12","pkcs5PBKDF2");Ie("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4");Ie("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4");Ie("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC");Ie("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC");Ie("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC");Ie("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC");Ie("1.2.840.113549.2.7","hmacWithSHA1");Ie("1.2.840.113549.2.8","hmacWithSHA224");Ie("1.2.840.113549.2.9","hmacWithSHA256");Ie("1.2.840.113549.2.10","hmacWithSHA384");Ie("1.2.840.113549.2.11","hmacWithSHA512");Ie("1.2.840.113549.3.7","des-EDE3-CBC");Ie("2.16.840.1.101.3.4.1.2","aes128-CBC");Ie("2.16.840.1.101.3.4.1.22","aes192-CBC");Ie("2.16.840.1.101.3.4.1.42","aes256-CBC");Ie("2.5.4.3","commonName");Ie("2.5.4.5","serialName");Ie("2.5.4.6","countryName");Ie("2.5.4.7","localityName");Ie("2.5.4.8","stateOrProvinceName");Ie("2.5.4.9","streetAddress");Ie("2.5.4.10","organizationName");Ie("2.5.4.11","organizationalUnitName");Ie("2.5.4.13","description");Ie("2.5.4.15","businessCategory");Ie("2.5.4.17","postalCode");Ie("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName");Ie("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName");Ie("2.16.840.1.113730.1.1","nsCertType");Ie("2.16.840.1.113730.1.13","nsComment");Qt("2.5.29.1","authorityKeyIdentifier");Qt("2.5.29.2","keyAttributes");Qt("2.5.29.3","certificatePolicies");Qt("2.5.29.4","keyUsageRestriction");Qt("2.5.29.5","policyMapping");Qt("2.5.29.6","subtreesConstraint");Qt("2.5.29.7","subjectAltName");Qt("2.5.29.8","issuerAltName");Qt("2.5.29.9","subjectDirectoryAttributes");Qt("2.5.29.10","basicConstraints");Qt("2.5.29.11","nameConstraints");Qt("2.5.29.12","policyConstraints");Qt("2.5.29.13","basicConstraints");Ie("2.5.29.14","subjectKeyIdentifier");Ie("2.5.29.15","keyUsage");Qt("2.5.29.16","privateKeyUsagePeriod");Ie("2.5.29.17","subjectAltName");Ie("2.5.29.18","issuerAltName");Ie("2.5.29.19","basicConstraints");Qt("2.5.29.20","cRLNumber");Qt("2.5.29.21","cRLReason");Qt("2.5.29.22","expirationDate");Qt("2.5.29.23","instructionCode");Qt("2.5.29.24","invalidityDate");Qt("2.5.29.25","cRLDistributionPoints");Qt("2.5.29.26","issuingDistributionPoint");Qt("2.5.29.27","deltaCRLIndicator");Qt("2.5.29.28","issuingDistributionPoint");Qt("2.5.29.29","certificateIssuer");Qt("2.5.29.30","nameConstraints");Ie("2.5.29.31","cRLDistributionPoints");Ie("2.5.29.32","certificatePolicies");Qt("2.5.29.33","policyMappings");Qt("2.5.29.34","policyConstraints");Ie("2.5.29.35","authorityKeyIdentifier");Qt("2.5.29.36","policyConstraints");Ie("2.5.29.37","extKeyUsage");Qt("2.5.29.46","freshestCRL");Qt("2.5.29.54","inhibitAnyPolicy");Ie("1.3.6.1.4.1.11129.2.4.2","timestampList");Ie("1.3.6.1.5.5.7.1.1","authorityInfoAccess");Ie("1.3.6.1.5.5.7.3.1","serverAuth");Ie("1.3.6.1.5.5.7.3.2","clientAuth");Ie("1.3.6.1.5.5.7.3.3","codeSigning");Ie("1.3.6.1.5.5.7.3.4","emailProtection");Ie("1.3.6.1.5.5.7.3.8","timeStamping")});var Qc=m((Ast,lq)=>{l();var Ir=yt();nr();b0();var Me=lq.exports=Ir.asn1=Ir.asn1||{};Me.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192};Me.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30};Me.create=function(t,e,r,i,n){if(Ir.util.isArray(i)){for(var s=[],o=0;o<i.length;++o)i[o]!==void 0&&s.push(i[o]);i=s}var a={tagClass:t,type:e,constructed:r,composed:r||Ir.util.isArray(i),value:i};return n&&"bitStringContents"in n&&(a.bitStringContents=n.bitStringContents,a.original=Me.copy(a)),a};Me.copy=function(t,e){var r;if(Ir.util.isArray(t)){r=[];for(var i=0;i<t.length;++i)r.push(Me.copy(t[i],e));return r}return typeof t=="string"?t:(r={tagClass:t.tagClass,type:t.type,constructed:t.constructed,composed:t.composed,value:Me.copy(t.value,e)},e&&!e.excludeBitStringContents&&(r.bitStringContents=t.bitStringContents),r)};Me.equals=function(t,e,r){if(Ir.util.isArray(t)){if(!Ir.util.isArray(e)||t.length!==e.length)return!1;for(var i=0;i<t.length;++i)if(!Me.equals(t[i],e[i]))return!1;return!0}if(typeof t!=typeof e)return!1;if(typeof t=="string")return t===e;var n=t.tagClass===e.tagClass&&t.type===e.type&&t.constructed===e.constructed&&t.composed===e.composed&&Me.equals(t.value,e.value);return r&&r.includeBitStringContents&&(n=n&&t.bitStringContents===e.bitStringContents),n};Me.getBerValueLength=function(t){var e=t.getByte();if(e!==128){var r,i=e&128;return i?r=t.getInt((e&127)<<3):r=e,r}};function py(t,e,r){if(r>e){var i=new Error("Too few bytes to parse DER.");throw i.available=t.length(),i.remaining=e,i.requested=r,i}}var Mwe=function(t,e){var r=t.getByte();if(e--,r!==128){var i,n=r&128;if(!n)i=r;else{var s=r&127;py(t,e,s),i=t.getInt(s<<3)}if(i<0)throw new Error("Negative length: "+i);return i}};Me.fromDer=function(t,e){return e===void 0&&(e={strict:!0,decodeBitStrings:!0}),typeof e=="boolean"&&(e={strict:e,decodeBitStrings:!0}),"strict"in e||(e.strict=!0),"decodeBitStrings"in e||(e.decodeBitStrings=!0),typeof t=="string"&&(t=Ir.util.createBuffer(t)),j6(t,t.length(),0,e)};function j6(t,e,r,i){var n;py(t,e,2);var s=t.getByte();e--;var o=s&192,a=s&31;n=t.length();var c=Mwe(t,e);if(e-=n-t.length(),c!==void 0&&c>e){if(i.strict){var u=new Error("Too few bytes to read ASN.1 value.");throw u.available=t.length(),u.remaining=e,u.requested=c,u}c=e}var f,d,h=(s&32)==32;if(h)if(f=[],c===void 0)for(;;){if(py(t,e,2),t.bytes(2)===String.fromCharCode(0,0)){t.getBytes(2),e-=2;break}n=t.length(),f.push(j6(t,e,r+1,i)),e-=n-t.length()}else for(;c>0;)n=t.length(),f.push(j6(t,c,r+1,i)),e-=n-t.length(),c-=n-t.length();if(f===void 0&&o===Me.Class.UNIVERSAL&&a===Me.Type.BITSTRING&&(d=t.bytes(c)),f===void 0&&i.decodeBitStrings&&o===Me.Class.UNIVERSAL&&a===Me.Type.BITSTRING&&c>1){var p=t.read,y=e,b=0;if(a===Me.Type.BITSTRING&&(py(t,e,1),b=t.getByte(),e--),b===0)try{n=t.length();var E={verbose:i.verbose,strict:!0,decodeBitStrings:!0},v=j6(t,e,r+1,E),A=n-t.length();e-=A,a==Me.Type.BITSTRING&&A++;var R=v.tagClass;A===c&&(R===Me.Class.UNIVERSAL||R===Me.Class.CONTEXT_SPECIFIC)&&(f=[v])}catch(D){}f===void 0&&(t.read=p,e=y)}if(f===void 0){if(c===void 0){if(i.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");c=e}if(a===Me.Type.BMPSTRING)for(f="";c>0;c-=2)py(t,e,2),f+=String.fromCharCode(t.getInt16()),e-=2;else f=t.getBytes(c)}var F=d===void 0?null:{bitStringContents:d};return Me.create(o,a,h,f,F)}Me.toDer=function(t){var e=Ir.util.createBuffer(),r=t.tagClass|t.type,i=Ir.util.createBuffer(),n=!1;if("bitStringContents"in t&&(n=!0,t.original&&(n=Me.equals(t,t.original))),n)i.putBytes(t.bitStringContents);else if(t.composed){t.constructed?r|=32:i.putByte(0);for(var s=0;s<t.value.length;++s)t.value[s]!==void 0&&i.putBuffer(Me.toDer(t.value[s]))}else if(t.type===Me.Type.BMPSTRING)for(var s=0;s<t.value.length;++s)i.putInt16(t.value.charCodeAt(s));else t.type===Me.Type.INTEGER&&t.value.length>1&&(t.value.charCodeAt(0)===0&&(t.value.charCodeAt(1)&128)==0||t.value.charCodeAt(0)===255&&(t.value.charCodeAt(1)&128)==128)?i.putBytes(t.value.substr(1)):i.putBytes(t.value);if(e.putByte(r),i.length()<=127)e.putByte(i.length()&127);else{var o=i.length(),a="";do a+=String.fromCharCode(o&255),o=o>>>8;while(o>0);e.putByte(a.length|128);for(var s=a.length-1;s>=0;--s)e.putByte(a.charCodeAt(s))}return e.putBuffer(i),e};Me.oidToDer=function(t){var e=t.split("."),r=Ir.util.createBuffer();r.putByte(40*parseInt(e[0],10)+parseInt(e[1],10));for(var i,n,s,o,a=2;a<e.length;++a){i=!0,n=[],s=parseInt(e[a],10);do o=s&127,s=s>>>7,i||(o|=128),n.push(o),i=!1;while(s>0);for(var c=n.length-1;c>=0;--c)r.putByte(n[c])}return r};Me.derToOid=function(t){var e;typeof t=="string"&&(t=Ir.util.createBuffer(t));var r=t.getByte();e=Math.floor(r/40)+"."+r%40;for(var i=0;t.length()>0;)r=t.getByte(),i=i<<7,r&128?i+=r&127:(e+="."+(i+r),i=0);return e};Me.utcTimeToDate=function(t){var e=new Date,r=parseInt(t.substr(0,2),10);r=r>=50?1900+r:2e3+r;var i=parseInt(t.substr(2,2),10)-1,n=parseInt(t.substr(4,2),10),s=parseInt(t.substr(6,2),10),o=parseInt(t.substr(8,2),10),a=0;if(t.length>11){var c=t.charAt(10),u=10;c!=="+"&&c!=="-"&&(a=parseInt(t.substr(10,2),10),u+=2)}if(e.setUTCFullYear(r,i,n),e.setUTCHours(s,o,a,0),u&&(c=t.charAt(u),c==="+"||c==="-")){var f=parseInt(t.substr(u+1,2),10),d=parseInt(t.substr(u+4,2),10),h=f*60+d;h*=6e4,c==="+"?e.setTime(+e-h):e.setTime(+e+h)}return e};Me.generalizedTimeToDate=function(t){var e=new Date,r=parseInt(t.substr(0,4),10),i=parseInt(t.substr(4,2),10)-1,n=parseInt(t.substr(6,2),10),s=parseInt(t.substr(8,2),10),o=parseInt(t.substr(10,2),10),a=parseInt(t.substr(12,2),10),c=0,u=0,f=!1;t.charAt(t.length-1)==="Z"&&(f=!0);var d=t.length-5,h=t.charAt(d);if(h==="+"||h==="-"){var p=parseInt(t.substr(d+1,2),10),y=parseInt(t.substr(d+4,2),10);u=p*60+y,u*=6e4,h==="+"&&(u*=-1),f=!0}return t.charAt(14)==="."&&(c=parseFloat(t.substr(14),10)*1e3),f?(e.setUTCFullYear(r,i,n),e.setUTCHours(s,o,a,c),e.setTime(+e+u)):(e.setFullYear(r,i,n),e.setHours(s,o,a,c)),e};Me.dateToUtcTime=function(t){if(typeof t=="string")return t;var e="",r=[];r.push((""+t.getUTCFullYear()).substr(2)),r.push(""+(t.getUTCMonth()+1)),r.push(""+t.getUTCDate()),r.push(""+t.getUTCHours()),r.push(""+t.getUTCMinutes()),r.push(""+t.getUTCSeconds());for(var i=0;i<r.length;++i)r[i].length<2&&(e+="0"),e+=r[i];return e+="Z",e};Me.dateToGeneralizedTime=function(t){if(typeof t=="string")return t;var e="",r=[];r.push(""+t.getUTCFullYear()),r.push(""+(t.getUTCMonth()+1)),r.push(""+t.getUTCDate()),r.push(""+t.getUTCHours()),r.push(""+t.getUTCMinutes()),r.push(""+t.getUTCSeconds());for(var i=0;i<r.length;++i)r[i].length<2&&(e+="0"),e+=r[i];return e+="Z",e};Me.integerToDer=function(t){var e=Ir.util.createBuffer();if(t>=-128&&t<128)return e.putSignedInt(t,8);if(t>=-32768&&t<32768)return e.putSignedInt(t,16);if(t>=-8388608&&t<8388608)return e.putSignedInt(t,24);if(t>=-2147483648&&t<2147483648)return e.putSignedInt(t,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=t,r};Me.derToInteger=function(t){typeof t=="string"&&(t=Ir.util.createBuffer(t));var e=t.length()*8;if(e>32)throw new Error("Integer too large; max is 32-bits.");return t.getSignedInt(e)};Me.validate=function(t,e,r,i){var n=!1;if((t.tagClass===e.tagClass||typeof e.tagClass=="undefined")&&(t.type===e.type||typeof e.type=="undefined"))if(t.constructed===e.constructed||typeof e.constructed=="undefined"){if(n=!0,e.value&&Ir.util.isArray(e.value))for(var s=0,o=0;n&&o<e.value.length;++o)n=e.value[o].optional||!1,t.value[s]&&(n=Me.validate(t.value[s],e.value[o],r,i),n?++s:e.value[o].optional&&(n=!0)),!n&&i&&i.push("["+e.name+'] Tag class "'+e.tagClass+'", type "'+e.type+'" expected value length "'+e.value.length+'", got "'+t.value.length+'"');if(n&&r&&(e.capture&&(r[e.capture]=t.value),e.captureAsn1&&(r[e.captureAsn1]=t),e.captureBitStringContents&&"bitStringContents"in t&&(r[e.captureBitStringContents]=t.bitStringContents),e.captureBitStringValue&&"bitStringContents"in t)){var a;if(t.bitStringContents.length<2)r[e.captureBitStringValue]="";else{var c=t.bitStringContents.charCodeAt(0);if(c!==0)throw new Error("captureBitStringValue only supported for zero unused bits");r[e.captureBitStringValue]=t.bitStringContents.slice(1)}}}else i&&i.push("["+e.name+'] Expected constructed "'+e.constructed+'", got "'+t.constructed+'"');else i&&(t.tagClass!==e.tagClass&&i.push("["+e.name+'] Expected tag class "'+e.tagClass+'", got "'+t.tagClass+'"'),t.type!==e.type&&i.push("["+e.name+'] Expected type "'+e.type+'", got "'+t.type+'"'));return n};var fq=/[^\\u0000-\\u00ff]/;Me.prettyPrint=function(t,e,r){var i="";e=e||0,r=r||2,e>0&&(i+=`
`);for(var n="",s=0;s<e*r;++s)n+=" ";switch(i+=n+"Tag: ",t.tagClass){case Me.Class.UNIVERSAL:i+="Universal:";break;case Me.Class.APPLICATION:i+="Application:";break;case Me.Class.CONTEXT_SPECIFIC:i+="Context-Specific:";break;case Me.Class.PRIVATE:i+="Private:";break}if(t.tagClass===Me.Class.UNIVERSAL)switch(i+=t.type,t.type){case Me.Type.NONE:i+=" (None)";break;case Me.Type.BOOLEAN:i+=" (Boolean)";break;case Me.Type.INTEGER:i+=" (Integer)";break;case Me.Type.BITSTRING:i+=" (Bit string)";break;case Me.Type.OCTETSTRING:i+=" (Octet string)";break;case Me.Type.NULL:i+=" (Null)";break;case Me.Type.OID:i+=" (Object Identifier)";break;case Me.Type.ODESC:i+=" (Object Descriptor)";break;case Me.Type.EXTERNAL:i+=" (External or Instance of)";break;case Me.Type.REAL:i+=" (Real)";break;case Me.Type.ENUMERATED:i+=" (Enumerated)";break;case Me.Type.EMBEDDED:i+=" (Embedded PDV)";break;case Me.Type.UTF8:i+=" (UTF8)";break;case Me.Type.ROID:i+=" (Relative Object Identifier)";break;case Me.Type.SEQUENCE:i+=" (Sequence)";break;case Me.Type.SET:i+=" (Set)";break;case Me.Type.PRINTABLESTRING:i+=" (Printable String)";break;case Me.Type.IA5String:i+=" (IA5String (ASCII))";break;case Me.Type.UTCTIME:i+=" (UTC time)";break;case Me.Type.GENERALIZEDTIME:i+=" (Generalized time)";break;case Me.Type.BMPSTRING:i+=" (BMP String)";break}else i+=t.type;if(i+=`
`,i+=n+"Constructed: "+t.constructed+`
`,t.composed){for(var o=0,a="",s=0;s<t.value.length;++s)t.value[s]!==void 0&&(o+=1,a+=Me.prettyPrint(t.value[s],e+1,r),s+1<t.value.length&&(a+=","));i+=n+"Sub values: "+o+a}else{if(i+=n+"Value: ",t.type===Me.Type.OID){var c=Me.derToOid(t.value);i+=c,Ir.pki&&Ir.pki.oids&&c in Ir.pki.oids&&(i+=" ("+Ir.pki.oids[c]+") ")}if(t.type===Me.Type.INTEGER)try{i+=Me.derToInteger(t.value)}catch(f){i+="0x"+Ir.util.bytesToHex(t.value)}else if(t.type===Me.Type.BITSTRING){if(t.value.length>1?i+="0x"+Ir.util.bytesToHex(t.value.slice(1)):i+="(none)",t.value.length>0){var u=t.value.charCodeAt(0);u==1?i+=" (1 unused bit shown)":u>1&&(i+=" ("+u+" unused bits shown)")}}else t.type===Me.Type.OCTETSTRING?(fq.test(t.value)||(i+="("+t.value+") "),i+="0x"+Ir.util.bytesToHex(t.value)):t.type===Me.Type.UTF8?i+=Ir.util.decodeUtf8(t.value):t.type===Me.Type.PRINTABLESTRING||t.type===Me.Type.IA5String?i+=t.value:fq.test(t.value)?i+="0x"+Ir.util.bytesToHex(t.value):t.value.length===0?i+="[null]":i+=t.value}return i}});var o_=m((Ist,dq)=>{l();var Gi=yt();nr();dq.exports=Gi.cipher=Gi.cipher||{};Gi.cipher.algorithms=Gi.cipher.algorithms||{};Gi.cipher.createCipher=function(t,e){var r=t;if(typeof r=="string"&&(r=Gi.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+t);return new Gi.cipher.BlockCipher({algorithm:r,key:e,decrypt:!1})};Gi.cipher.createDecipher=function(t,e){var r=t;if(typeof r=="string"&&(r=Gi.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+t);return new Gi.cipher.BlockCipher({algorithm:r,key:e,decrypt:!0})};Gi.cipher.registerAlgorithm=function(t,e){t=t.toUpperCase(),Gi.cipher.algorithms[t]=e};Gi.cipher.getAlgorithm=function(t){return t=t.toUpperCase(),t in Gi.cipher.algorithms?Gi.cipher.algorithms[t]:null};var s_=Gi.cipher.BlockCipher=function(t){this.algorithm=t.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=t.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=t.decrypt,this.algorithm.initialize(t)};s_.prototype.start=function(t){t=t||{};var e={};for(var r in t)e[r]=t[r];e.decrypt=this._decrypt,this._finish=!1,this._input=Gi.util.createBuffer(),this.output=t.output||Gi.util.createBuffer(),this.mode.start(e)};s_.prototype.update=function(t){for(t&&this._input.putBuffer(t);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()};s_.prototype.finish=function(t){t&&(this.mode.name==="ECB"||this.mode.name==="CBC")&&(this.mode.pad=function(r){return t(this.blockSize,r,!1)},this.mode.unpad=function(r){return t(this.blockSize,r,!0)});var e={};return e.decrypt=this._decrypt,e.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,e)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,e))||this.mode.afterFinish&&!this.mode.afterFinish(this.output,e))}});var c_=m((Tst,hq)=>{l();var $i=yt();nr();$i.cipher=$i.cipher||{};var Et=hq.exports=$i.cipher.modes=$i.cipher.modes||{};Et.ecb=function(t){t=t||{},this.name="ECB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};Et.ecb.prototype.start=function(t){};Et.ecb.prototype.encrypt=function(t,e,r){if(t.length()<this.blockSize&&!(r&&t.length()>0))return!0;for(var i=0;i<this._ints;++i)this._inBlock[i]=t.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var i=0;i<this._ints;++i)e.putInt32(this._outBlock[i])};Et.ecb.prototype.decrypt=function(t,e,r){if(t.length()<this.blockSize&&!(r&&t.length()>0))return!0;for(var i=0;i<this._ints;++i)this._inBlock[i]=t.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var i=0;i<this._ints;++i)e.putInt32(this._outBlock[i])};Et.ecb.prototype.pad=function(t,e){var r=t.length()===this.blockSize?this.blockSize:this.blockSize-t.length();return t.fillWithByte(r,r),!0};Et.ecb.prototype.unpad=function(t,e){if(e.overflow>0)return!1;var r=t.length(),i=t.at(r-1);return i>this.blockSize<<2?!1:(t.truncate(i),!0)};Et.cbc=function(t){t=t||{},this.name="CBC",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};Et.cbc.prototype.start=function(t){if(t.iv===null){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in t)this._iv=U6(t.iv,this.blockSize),this._prev=this._iv.slice(0);else throw new Error("Invalid IV parameter.")};Et.cbc.prototype.encrypt=function(t,e,r){if(t.length()<this.blockSize&&!(r&&t.length()>0))return!0;for(var i=0;i<this._ints;++i)this._inBlock[i]=this._prev[i]^t.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var i=0;i<this._ints;++i)e.putInt32(this._outBlock[i]);this._prev=this._outBlock};Et.cbc.prototype.decrypt=function(t,e,r){if(t.length()<this.blockSize&&!(r&&t.length()>0))return!0;for(var i=0;i<this._ints;++i)this._inBlock[i]=t.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var i=0;i<this._ints;++i)e.putInt32(this._prev[i]^this._outBlock[i]);this._prev=this._inBlock.slice(0)};Et.cbc.prototype.pad=function(t,e){var r=t.length()===this.blockSize?this.blockSize:this.blockSize-t.length();return t.fillWithByte(r,r),!0};Et.cbc.prototype.unpad=function(t,e){if(e.overflow>0)return!1;var r=t.length(),i=t.at(r-1);return i>this.blockSize<<2?!1:(t.truncate(i),!0)};Et.cfb=function(t){t=t||{},this.name="CFB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=$i.util.createBuffer(),this._partialBytes=0};Et.cfb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=U6(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};Et.cfb.prototype.encrypt=function(t,e,r){var i=t.length();if(i===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&i>=this.blockSize){for(var n=0;n<this._ints;++n)this._inBlock[n]=t.getInt32()^this._outBlock[n],e.putInt32(this._inBlock[n]);return}var s=(this.blockSize-i)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var n=0;n<this._ints;++n)this._partialBlock[n]=t.getInt32()^this._outBlock[n],this._partialOutput.putInt32(this._partialBlock[n]);if(s>0)t.read-=this.blockSize;else for(var n=0;n<this._ints;++n)this._inBlock[n]=this._partialBlock[n];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0};Et.cfb.prototype.decrypt=function(t,e,r){var i=t.length();if(i===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&i>=this.blockSize){for(var n=0;n<this._ints;++n)this._inBlock[n]=t.getInt32(),e.putInt32(this._inBlock[n]^this._outBlock[n]);return}var s=(this.blockSize-i)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var n=0;n<this._ints;++n)this._partialBlock[n]=t.getInt32(),this._partialOutput.putInt32(this._partialBlock[n]^this._outBlock[n]);if(s>0)t.read-=this.blockSize;else for(var n=0;n<this._ints;++n)this._inBlock[n]=this._partialBlock[n];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0};Et.ofb=function(t){t=t||{},this.name="OFB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=$i.util.createBuffer(),this._partialBytes=0};Et.ofb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=U6(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};Et.ofb.prototype.encrypt=function(t,e,r){var i=t.length();if(t.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&i>=this.blockSize){for(var n=0;n<this._ints;++n)e.putInt32(t.getInt32()^this._outBlock[n]),this._inBlock[n]=this._outBlock[n];return}var s=(this.blockSize-i)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var n=0;n<this._ints;++n)this._partialOutput.putInt32(t.getInt32()^this._outBlock[n]);if(s>0)t.read-=this.blockSize;else for(var n=0;n<this._ints;++n)this._inBlock[n]=this._outBlock[n];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0};Et.ofb.prototype.decrypt=Et.ofb.prototype.encrypt;Et.ctr=function(t){t=t||{},this.name="CTR",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=$i.util.createBuffer(),this._partialBytes=0};Et.ctr.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=U6(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};Et.ctr.prototype.encrypt=function(t,e,r){var i=t.length();if(i===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&i>=this.blockSize)for(var n=0;n<this._ints;++n)e.putInt32(t.getInt32()^this._outBlock[n]);else{var s=(this.blockSize-i)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var n=0;n<this._ints;++n)this._partialOutput.putInt32(t.getInt32()^this._outBlock[n]);if(s>0&&(t.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}F6(this._inBlock)};Et.ctr.prototype.decrypt=Et.ctr.prototype.encrypt;Et.gcm=function(t){t=t||{},this.name="GCM",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=$i.util.createBuffer(),this._partialBytes=0,this._R=3774873600};Et.gcm.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");var e=$i.util.createBuffer(t.iv);this._cipherLength=0;var r;if("additionalData"in t?r=$i.util.createBuffer(t.additionalData):r=$i.util.createBuffer(),"tagLength"in t?this._tagLength=t.tagLength:this._tagLength=128,this._tag=null,t.decrypt&&(this._tag=$i.util.createBuffer(t.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var i=e.length();if(i===12)this._j0=[e.getInt32(),e.getInt32(),e.getInt32(),1];else{for(this._j0=[0,0,0,0];e.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[e.getInt32(),e.getInt32(),e.getInt32(),e.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(a_(i*8)))}this._inBlock=this._j0.slice(0),F6(this._inBlock),this._partialBytes=0,r=$i.util.createBuffer(r),this._aDataLength=a_(r.length()*8);var n=r.length()%this.blockSize;for(n&&r.fillWithByte(0,this.blockSize-n),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])};Et.gcm.prototype.encrypt=function(t,e,r){var i=t.length();if(i===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&i>=this.blockSize){for(var n=0;n<this._ints;++n)e.putInt32(this._outBlock[n]^=t.getInt32());this._cipherLength+=this.blockSize}else{var s=(this.blockSize-i)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var n=0;n<this._ints;++n)this._partialOutput.putInt32(t.getInt32()^this._outBlock[n]);if(s<=0||r){if(r){var o=i%this.blockSize;this._cipherLength+=o,this._partialOutput.truncate(this.blockSize-o)}else this._cipherLength+=this.blockSize;for(var n=0;n<this._ints;++n)this._outBlock[n]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.read-=this.blockSize,e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),F6(this._inBlock)};Et.gcm.prototype.decrypt=function(t,e,r){var i=t.length();if(i<this.blockSize&&!(r&&i>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),F6(this._inBlock),this._hashBlock[0]=t.getInt32(),this._hashBlock[1]=t.getInt32(),this._hashBlock[2]=t.getInt32(),this._hashBlock[3]=t.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var n=0;n<this._ints;++n)e.putInt32(this._outBlock[n]^this._hashBlock[n]);i<this.blockSize?this._cipherLength+=i%this.blockSize:this._cipherLength+=this.blockSize};Et.gcm.prototype.afterFinish=function(t,e){var r=!0;e.decrypt&&e.overflow&&t.truncate(this.blockSize-e.overflow),this.tag=$i.util.createBuffer();var i=this._aDataLength.concat(a_(this._cipherLength*8));this._s=this.ghash(this._hashSubkey,this._s,i);var n=[];this.cipher.encrypt(this._j0,n);for(var s=0;s<this._ints;++s)this.tag.putInt32(this._s[s]^n[s]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),e.decrypt&&this.tag.bytes()!==this._tag&&(r=!1),r};Et.gcm.prototype.multiply=function(t,e){for(var r=[0,0,0,0],i=e.slice(0),n=0;n<128;++n){var s=t[n/32|0]&1<<31-n%32;s&&(r[0]^=i[0],r[1]^=i[1],r[2]^=i[2],r[3]^=i[3]),this.pow(i,i)}return r};Et.gcm.prototype.pow=function(t,e){for(var r=t[3]&1,i=3;i>0;--i)e[i]=t[i]>>>1|(t[i-1]&1)<<31;e[0]=t[0]>>>1,r&&(e[0]^=this._R)};Et.gcm.prototype.tableMultiply=function(t){for(var e=[0,0,0,0],r=0;r<32;++r){var i=r/8|0,n=t[i]>>>(7-r%8)*4&15,s=this._m[r][n];e[0]^=s[0],e[1]^=s[1],e[2]^=s[2],e[3]^=s[3]}return e};Et.gcm.prototype.ghash=function(t,e,r){return e[0]^=r[0],e[1]^=r[1],e[2]^=r[2],e[3]^=r[3],this.tableMultiply(e)};Et.gcm.prototype.generateHashTable=function(t,e){for(var r=8/e,i=4*r,n=16*r,s=new Array(n),o=0;o<n;++o){var a=[0,0,0,0],c=o/i|0,u=(i-1-o%i)*e;a[c]=1<<e-1<<u,s[o]=this.generateSubHashTable(this.multiply(a,t),e)}return s};Et.gcm.prototype.generateSubHashTable=function(t,e){var r=1<<e,i=r>>>1,n=new Array(r);n[i]=t.slice(0);for(var s=i>>>1;s>0;)this.pow(n[2*s],n[s]=[]),s>>=1;for(s=2;s<i;){for(var o=1;o<s;++o){var a=n[s],c=n[o];n[s+o]=[a[0]^c[0],a[1]^c[1],a[2]^c[2],a[3]^c[3]]}s*=2}for(n[0]=[0,0,0,0],s=i+1;s<r;++s){var u=n[s^i];n[s]=[t[0]^u[0],t[1]^u[1],t[2]^u[2],t[3]^u[3]]}return n};function U6(t,e){if(typeof t=="string"&&(t=$i.util.createBuffer(t)),$i.util.isArray(t)&&t.length>4){var r=t;t=$i.util.createBuffer();for(var i=0;i<r.length;++i)t.putByte(r[i])}if(t.length()<e)throw new Error("Invalid IV length; got "+t.length()+" bytes and expected "+e+" bytes.");if(!$i.util.isArray(t)){for(var n=[],s=e/4,i=0;i<s;++i)n.push(t.getInt32());t=n}return t}function F6(t){t[t.length-1]=t[t.length-1]+1&4294967295}function a_(t){return[t/4294967296|0,t&4294967295]}});var _0=m((Rst,mq)=>{l();var pr=yt();o_();c_();nr();mq.exports=pr.aes=pr.aes||{};pr.aes.startEncrypting=function(t,e,r,i){var n=K6({key:t,output:r,decrypt:!1,mode:i});return n.start(e),n};pr.aes.createEncryptionCipher=function(t,e){return K6({key:t,output:null,decrypt:!1,mode:e})};pr.aes.startDecrypting=function(t,e,r,i){var n=K6({key:t,output:r,decrypt:!0,mode:i});return n.start(e),n};pr.aes.createDecryptionCipher=function(t,e){return K6({key:t,output:null,decrypt:!0,mode:e})};pr.aes.Algorithm=function(t,e){u_||yq();var r=this;r.name=t,r.mode=new e({blockSize:16,cipher:{encrypt:function(i,n){return l_(r._w,i,n,!1)},decrypt:function(i,n){return l_(r._w,i,n,!0)}}}),r._init=!1};pr.aes.Algorithm.prototype.initialize=function(t){if(!this._init){var e=t.key,r;if(typeof e=="string"&&(e.length===16||e.length===24||e.length===32))e=pr.util.createBuffer(e);else if(pr.util.isArray(e)&&(e.length===16||e.length===24||e.length===32)){r=e,e=pr.util.createBuffer();for(var i=0;i<r.length;++i)e.putByte(r[i])}if(!pr.util.isArray(e)){r=e,e=[];var n=r.length();if(n===16||n===24||n===32){n=n>>>2;for(var i=0;i<n;++i)e.push(r.getInt32())}}if(!pr.util.isArray(e)||!(e.length===4||e.length===6||e.length===8))throw new Error("Invalid key parameter.");var s=this.mode.name,o=["CFB","OFB","CTR","GCM"].indexOf(s)!==-1;this._w=gq(e,t.decrypt&&!o),this._init=!0}};pr.aes._expandKey=function(t,e){return u_||yq(),gq(t,e)};pr.aes._updateBlock=l_;v0("AES-ECB",pr.cipher.modes.ecb);v0("AES-CBC",pr.cipher.modes.cbc);v0("AES-CFB",pr.cipher.modes.cfb);v0("AES-OFB",pr.cipher.modes.ofb);v0("AES-CTR",pr.cipher.modes.ctr);v0("AES-GCM",pr.cipher.modes.gcm);function v0(t,e){var r=function(){return new pr.aes.Algorithm(t,e)};pr.cipher.registerAlgorithm(t,r)}var u_=!1,w0=4,Un,f_,pq,Ml,Ko;function yq(){u_=!0,pq=[0,1,2,4,8,16,32,64,128,27,54];for(var t=new Array(256),e=0;e<128;++e)t[e]=e<<1,t[e+128]=e+128<<1^283;Un=new Array(256),f_=new Array(256),Ml=new Array(4),Ko=new Array(4);for(var e=0;e<4;++e)Ml[e]=new Array(256),Ko[e]=new Array(256);for(var r=0,i=0,n,s,o,a,c,u,f,e=0;e<256;++e){a=i^i<<1^i<<2^i<<3^i<<4,a=a>>8^a&255^99,Un[r]=a,f_[a]=r,c=t[a],n=t[r],s=t[n],o=t[s],u=c<<24^a<<16^a<<8^(a^c),f=(n^s^o)<<24^(r^o)<<16^(r^s^o)<<8^(r^n^o);for(var d=0;d<4;++d)Ml[d][r]=u,Ko[d][a]=f,u=u<<24|u>>>8,f=f<<24|f>>>8;r===0?r=i=1:(r=n^t[t[t[n^o]]],i^=t[t[i]])}}function gq(t,e){for(var r=t.slice(0),i,n=1,s=r.length,o=s+6+1,a=w0*o,c=s;c<a;++c)i=r[c-1],c%s==0?(i=Un[i>>>16&255]<<24^Un[i>>>8&255]<<16^Un[i&255]<<8^Un[i>>>24]^pq[n]<<24,n++):s>6&&c%s==4&&(i=Un[i>>>24]<<24^Un[i>>>16&255]<<16^Un[i>>>8&255]<<8^Un[i&255]),r[c]=r[c-s]^i;if(e){var u,f=Ko[0],d=Ko[1],h=Ko[2],p=Ko[3],y=r.slice(0);a=r.length;for(var c=0,b=a-w0;c<a;c+=w0,b-=w0)if(c===0||c===a-w0)y[c]=r[b],y[c+1]=r[b+3],y[c+2]=r[b+2],y[c+3]=r[b+1];else for(var E=0;E<w0;++E)u=r[b+E],y[c+(3&-E)]=f[Un[u>>>24]]^d[Un[u>>>16&255]]^h[Un[u>>>8&255]]^p[Un[u&255]];r=y}return r}function l_(t,e,r,i){var n=t.length/4-1,s,o,a,c,u;i?(s=Ko[0],o=Ko[1],a=Ko[2],c=Ko[3],u=f_):(s=Ml[0],o=Ml[1],a=Ml[2],c=Ml[3],u=Un);var f,d,h,p,y,b,E;f=e[0]^t[0],d=e[i?3:1]^t[1],h=e[2]^t[2],p=e[i?1:3]^t[3];for(var v=3,A=1;A<n;++A)y=s[f>>>24]^o[d>>>16&255]^a[h>>>8&255]^c[p&255]^t[++v],b=s[d>>>24]^o[h>>>16&255]^a[p>>>8&255]^c[f&255]^t[++v],E=s[h>>>24]^o[p>>>16&255]^a[f>>>8&255]^c[d&255]^t[++v],p=s[p>>>24]^o[f>>>16&255]^a[d>>>8&255]^c[h&255]^t[++v],f=y,d=b,h=E;r[0]=u[f>>>24]<<24^u[d>>>16&255]<<16^u[h>>>8&255]<<8^u[p&255]^t[++v],r[i?3:1]=u[d>>>24]<<24^u[h>>>16&255]<<16^u[p>>>8&255]<<8^u[f&255]^t[++v],r[2]=u[h>>>24]<<24^u[p>>>16&255]<<16^u[f>>>8&255]<<8^u[d&255]^t[++v],r[i?1:3]=u[p>>>24]<<24^u[f>>>16&255]<<16^u[d>>>8&255]<<8^u[h&255]^t[++v]}function K6(t){t=t||{};var e=(t.mode||"CBC").toUpperCase(),r="AES-"+e,i;t.decrypt?i=pr.cipher.createDecipher(r,t.key):i=pr.cipher.createCipher(r,t.key);var n=i.start;return i.start=function(s,o){var a=null;o instanceof pr.util.ByteBuffer&&(a=o,o={}),o=o||{},o.output=a,o.iv=s,n.call(i,o)},i}});var z6=m((Pst,vq)=>{l();var Tr=yt();o_();c_();nr();vq.exports=Tr.des=Tr.des||{};Tr.des.startEncrypting=function(t,e,r,i){var n=V6({key:t,output:r,decrypt:!1,mode:i||(e===null?"ECB":"CBC")});return n.start(e),n};Tr.des.createEncryptionCipher=function(t,e){return V6({key:t,output:null,decrypt:!1,mode:e})};Tr.des.startDecrypting=function(t,e,r,i){var n=V6({key:t,output:r,decrypt:!0,mode:i||(e===null?"ECB":"CBC")});return n.start(e),n};Tr.des.createDecryptionCipher=function(t,e){return V6({key:t,output:null,decrypt:!0,mode:e})};Tr.des.Algorithm=function(t,e){var r=this;r.name=t,r.mode=new e({blockSize:8,cipher:{encrypt:function(i,n){return bq(r._keys,i,n,!1)},decrypt:function(i,n){return bq(r._keys,i,n,!0)}}}),r._init=!1};Tr.des.Algorithm.prototype.initialize=function(t){if(!this._init){var e=Tr.util.createBuffer(t.key);if(this.name.indexOf("3DES")===0&&e.length()!==24)throw new Error("Invalid Triple-DES key size: "+e.length()*8);this._keys=Hwe(e),this._init=!0}};Na("DES-ECB",Tr.cipher.modes.ecb);Na("DES-CBC",Tr.cipher.modes.cbc);Na("DES-CFB",Tr.cipher.modes.cfb);Na("DES-OFB",Tr.cipher.modes.ofb);Na("DES-CTR",Tr.cipher.modes.ctr);Na("3DES-ECB",Tr.cipher.modes.ecb);Na("3DES-CBC",Tr.cipher.modes.cbc);Na("3DES-CFB",Tr.cipher.modes.cfb);Na("3DES-OFB",Tr.cipher.modes.ofb);Na("3DES-CTR",Tr.cipher.modes.ctr);function Na(t,e){var r=function(){return new Tr.des.Algorithm(t,e)};Tr.cipher.registerAlgorithm(t,r)}var Lwe=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],qwe=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],jwe=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],Uwe=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],Fwe=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],Kwe=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],Vwe=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],zwe=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function Hwe(t){for(var e=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],r=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],i=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],n=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],s=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],o=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],a=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],c=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],u=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],f=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],d=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],h=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],p=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],y=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],b=t.length()>8?3:1,E=[],v=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],A=0,R,F=0;F<b;F++){var D=t.getInt32(),B=t.getInt32();R=(D>>>4^B)&252645135,B^=R,D^=R<<4,R=(B>>>-16^D)&65535,D^=R,B^=R<<-16,R=(D>>>2^B)&858993459,B^=R,D^=R<<2,R=(B>>>-16^D)&65535,D^=R,B^=R<<-16,R=(D>>>1^B)&1431655765,B^=R,D^=R<<1,R=(B>>>8^D)&16711935,D^=R,B^=R<<8,R=(D>>>1^B)&1431655765,B^=R,D^=R<<1,R=D<<8|B>>>20&240,D=B<<24|B<<8&16711680|B>>>8&65280|B>>>24&240,B=R;for(var H=0;H<v.length;++H){v[H]?(D=D<<2|D>>>26,B=B<<2|B>>>26):(D=D<<1|D>>>27,B=B<<1|B>>>27),D&=-15,B&=-15;var W=e[D>>>28]|r[D>>>24&15]|i[D>>>20&15]|n[D>>>16&15]|s[D>>>12&15]|o[D>>>8&15]|a[D>>>4&15],X=c[B>>>28]|u[B>>>24&15]|f[B>>>20&15]|d[B>>>16&15]|h[B>>>12&15]|p[B>>>8&15]|y[B>>>4&15];R=(X>>>16^W)&65535,E[A++]=W^R,E[A++]=X^R<<16}}return E}function bq(t,e,r,i){var n=t.length===32?3:9,s;n===3?s=i?[30,-2,-2]:[0,32,2]:s=i?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var o,a=e[0],c=e[1];o=(a>>>4^c)&252645135,c^=o,a^=o<<4,o=(a>>>16^c)&65535,c^=o,a^=o<<16,o=(c>>>2^a)&858993459,a^=o,c^=o<<2,o=(c>>>8^a)&16711935,a^=o,c^=o<<8,o=(a>>>1^c)&1431655765,c^=o,a^=o<<1,a=a<<1|a>>>31,c=c<<1|c>>>31;for(var u=0;u<n;u+=3){for(var f=s[u+1],d=s[u+2],h=s[u];h!=f;h+=d){var p=c^t[h],y=(c>>>4|c<<28)^t[h+1];o=a,a=c,c=o^(qwe[p>>>24&63]|Uwe[p>>>16&63]|Kwe[p>>>8&63]|zwe[p&63]|Lwe[y>>>24&63]|jwe[y>>>16&63]|Fwe[y>>>8&63]|Vwe[y&63])}o=a,a=c,c=o}a=a>>>1|a<<31,c=c>>>1|c<<31,o=(a>>>1^c)&1431655765,c^=o,a^=o<<1,o=(c>>>8^a)&16711935,a^=o,c^=o<<8,o=(c>>>2^a)&858993459,a^=o,c^=o<<2,o=(a>>>16^c)&65535,c^=o,a^=o<<16,o=(a>>>4^c)&252645135,c^=o,a^=o<<4,r[0]=a,r[1]=c}function V6(t){t=t||{};var e=(t.mode||"CBC").toUpperCase(),r="DES-"+e,i;t.decrypt?i=Tr.cipher.createDecipher(r,t.key):i=Tr.cipher.createCipher(r,t.key);var n=i.start;return i.start=function(s,o){var a=null;o instanceof Tr.util.ByteBuffer&&(a=o,o={}),o=o||{},o.output=a,o.iv=s,n.call(i,o)},i}});var df=m((Cst,wq)=>{l();var H6=yt();wq.exports=H6.md=H6.md||{};H6.md.algorithms=H6.md.algorithms||{}});var Eq=m((Ost,_q)=>{l();var Zc=yt();df();nr();var Gwe=_q.exports=Zc.hmac=Zc.hmac||{};Gwe.create=function(){var t=null,e=null,r=null,i=null,n={};return n.start=function(s,o){if(s!==null)if(typeof s=="string")if(s=s.toLowerCase(),s in Zc.md.algorithms)e=Zc.md.algorithms[s].create();else throw new Error('Unknown hash algorithm "'+s+'"');else e=s;if(o===null)o=t;else{if(typeof o=="string")o=Zc.util.createBuffer(o);else if(Zc.util.isArray(o)){var a=o;o=Zc.util.createBuffer();for(var c=0;c<a.length;++c)o.putByte(a[c])}var u=o.length();u>e.blockLength&&(e.start(),e.update(o.bytes()),o=e.digest()),r=Zc.util.createBuffer(),i=Zc.util.createBuffer(),u=o.length();for(var c=0;c<u;++c){var a=o.at(c);r.putByte(54^a),i.putByte(92^a)}if(u<e.blockLength)for(var a=e.blockLength-u,c=0;c<a;++c)r.putByte(54),i.putByte(92);t=o,r=r.bytes(),i=i.bytes()}e.start(),e.update(r)},n.update=function(s){e.update(s)},n.getMac=function(){var s=e.digest().bytes();return e.start(),e.update(i),e.update(s),e.digest()},n.digest=n.getMac,n}});var E0=m(()=>{l()});var d_=m((Bst,Sq)=>{l();var Fn=yt();Eq();df();nr();var $we=Fn.pkcs5=Fn.pkcs5||{},Jc;Fn.util.isNodejs&&!Fn.options.usePureJavaScript&&(Jc=E0());Sq.exports=Fn.pbkdf2=$we.pbkdf2=function(t,e,r,i,n,s){if(typeof n=="function"&&(s=n,n=null),Fn.util.isNodejs&&!Fn.options.usePureJavaScript&&Jc.pbkdf2&&(n===null||typeof n!="object")&&(Jc.pbkdf2Sync.length>4||!n||n==="sha1"))return typeof n!="string"&&(n="sha1"),t=Buffer.from(t,"binary"),e=Buffer.from(e,"binary"),s?Jc.pbkdf2Sync.length===4?Jc.pbkdf2(t,e,r,i,function(R,F){if(R)return s(R);s(null,F.toString("binary"))}):Jc.pbkdf2(t,e,r,i,n,function(R,F){if(R)return s(R);s(null,F.toString("binary"))}):Jc.pbkdf2Sync.length===4?Jc.pbkdf2Sync(t,e,r,i).toString("binary"):Jc.pbkdf2Sync(t,e,r,i,n).toString("binary");if((typeof n=="undefined"||n===null)&&(n="sha1"),typeof n=="string"){if(!(n in Fn.md.algorithms))throw new Error("Unknown hash algorithm: "+n);n=Fn.md[n].create()}var o=n.digestLength;if(i>4294967295*o){var a=new Error("Derived key is too long.");if(s)return s(a);throw a}var c=Math.ceil(i/o),u=i-(c-1)*o,f=Fn.hmac.create();f.start(n,t);var d="",h,p,y;if(!s){for(var b=1;b<=c;++b){f.start(null,null),f.update(e),f.update(Fn.util.int32ToBytes(b)),h=y=f.digest().getBytes();for(var E=2;E<=r;++E)f.start(null,null),f.update(y),p=f.digest().getBytes(),h=Fn.util.xorBytes(h,p,o),y=p;d+=b<c?h:h.substr(0,u)}return d}var b=1,E;function v(){if(b>c)return s(null,d);f.start(null,null),f.update(e),f.update(Fn.util.int32ToBytes(b)),h=y=f.digest().getBytes(),E=2,A()}function A(){if(E<=r)return f.start(null,null),f.update(y),p=f.digest().getBytes(),h=Fn.util.xorBytes(h,p,o),y=p,++E,Fn.util.setImmediate(A);d+=b<c?h:h.substr(0,u),++b,v()}v()}});var W6=m((Nst,Aq)=>{l();var G6=yt();nr();var xq=Aq.exports=G6.pem=G6.pem||{};xq.encode=function(t,e){e=e||{};var r="-----BEGIN "+t.type+`-----\r
`,i;if(t.procType&&(i={name:"Proc-Type",values:[String(t.procType.version),t.procType.type]},r+=$6(i)),t.contentDomain&&(i={name:"Content-Domain",values:[t.contentDomain]},r+=$6(i)),t.dekInfo&&(i={name:"DEK-Info",values:[t.dekInfo.algorithm]},t.dekInfo.parameters&&i.values.push(t.dekInfo.parameters),r+=$6(i)),t.headers)for(var n=0;n<t.headers.length;++n)r+=$6(t.headers[n]);return t.procType&&(r+=`\r
`),r+=G6.util.encode64(t.body,e.maxline||64)+`\r
`,r+="-----END "+t.type+`-----\r
`,r};xq.decode=function(t){for(var e=[],r=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,i=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,n=/\r?\n/,s;s=r.exec(t),!!s;){var o={type:s[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:G6.util.decode64(s[3])};if(e.push(o),!!s[2]){for(var a=s[2].split(n),c=0;s&&c<a.length;){for(var u=a[c].replace(/\s+$/,""),f=c+1;f<a.length;++f){var d=a[f];if(!/\s/.test(d[0]))break;u+=d,c=f}if(s=u.match(i),s){for(var h={name:s[1],values:[]},p=s[2].split(","),y=0;y<p.length;++y)h.values.push(Wwe(p[y]));if(o.procType)if(!o.contentDomain&&h.name==="Content-Domain")o.contentDomain=p[0]||"";else if(!o.dekInfo&&h.name==="DEK-Info"){if(h.values.length===0)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');o.dekInfo={algorithm:p[0],parameters:p[1]||null}}else o.headers.push(h);else{if(h.name!=="Proc-Type")throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(h.values.length!==2)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');o.procType={version:p[0],type:p[1]}}}++c}if(o.procType==="ENCRYPTED"&&!o.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(e.length===0)throw new Error("Invalid PEM formatted message.");return e};function $6(t){for(var e=t.name+": ",r=[],i=function(c,u){return" "+u},n=0;n<t.values.length;++n)r.push(t.values[n].replace(/^(\S+\r\n)/,i));e+=r.join(",")+`\r
`;for(var s=0,o=-1,n=0;n<e.length;++n,++s)if(s>65&&o!==-1){var a=e[o];a===","?(++o,e=e.substr(0,o)+`\r
`+e.substr(o)):e=e.substr(0,o)+`\r
`+a+e.substr(o+1),s=n-o-1,o=-1,++n}else(e[n]===" "||e[n]===" "||e[n]===",")&&(o=n);return e}function Wwe(t){return t.replace(/^\s+/,"")}});var Oq=m((Mst,Cq)=>{l();var Ma=yt();df();nr();var Iq=Cq.exports=Ma.sha256=Ma.sha256||{};Ma.md.sha256=Ma.md.algorithms.sha256=Iq;Iq.create=function(){Tq||Ywe();var t=null,e=Ma.util.createBuffer(),r=new Array(64),i={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return i.start=function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var n=i.messageLengthSize/4,s=0;s<n;++s)i.fullMessageLength.push(0);return e=Ma.util.createBuffer(),t={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},i},i.start(),i.update=function(n,s){s==="utf8"&&(n=Ma.util.encodeUtf8(n));var o=n.length;i.messageLength+=o,o=[o/4294967296>>>0,o>>>0];for(var a=i.fullMessageLength.length-1;a>=0;--a)i.fullMessageLength[a]+=o[1],o[1]=o[0]+(i.fullMessageLength[a]/4294967296>>>0),i.fullMessageLength[a]=i.fullMessageLength[a]>>>0,o[0]=o[1]/4294967296>>>0;return e.putBytes(n),Pq(t,r,e),(e.read>2048||e.length()===0)&&e.compact(),i},i.digest=function(){var n=Ma.util.createBuffer();n.putBytes(e.bytes());var s=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize,o=s&i.blockLength-1;n.putBytes(h_.substr(0,i.blockLength-o));for(var a,c,u=i.fullMessageLength[0]*8,f=0;f<i.fullMessageLength.length-1;++f)a=i.fullMessageLength[f+1]*8,c=a/4294967296>>>0,u+=c,n.putInt32(u>>>0),u=a>>>0;n.putInt32(u);var d={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4,h5:t.h5,h6:t.h6,h7:t.h7};Pq(d,r,n);var h=Ma.util.createBuffer();return h.putInt32(d.h0),h.putInt32(d.h1),h.putInt32(d.h2),h.putInt32(d.h3),h.putInt32(d.h4),h.putInt32(d.h5),h.putInt32(d.h6),h.putInt32(d.h7),h},i};var h_=null,Tq=!1,Rq=null;function Ywe(){h_=String.fromCharCode(128),h_+=Ma.util.fillString(String.fromCharCode(0),64),Rq=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],Tq=!0}function Pq(t,e,r){for(var i,n,s,o,a,c,u,f,d,h,p,y,b,E,v,A=r.length();A>=64;){for(u=0;u<16;++u)e[u]=r.getInt32();for(;u<64;++u)i=e[u-2],i=(i>>>17|i<<15)^(i>>>19|i<<13)^i>>>10,n=e[u-15],n=(n>>>7|n<<25)^(n>>>18|n<<14)^n>>>3,e[u]=i+e[u-7]+n+e[u-16]|0;for(f=t.h0,d=t.h1,h=t.h2,p=t.h3,y=t.h4,b=t.h5,E=t.h6,v=t.h7,u=0;u<64;++u)o=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7),a=E^y&(b^E),s=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),c=f&d|h&(f^d),i=v+o+a+Rq[u]+e[u],n=s+c,v=E,E=b,b=y,y=p+i>>>0,p=h,h=d,d=f,f=i+n>>>0;t.h0=t.h0+f|0,t.h1=t.h1+d|0,t.h2=t.h2+h|0,t.h3=t.h3+p|0,t.h4=t.h4+y|0,t.h5=t.h5+b|0,t.h6=t.h6+E|0,t.h7=t.h7+v|0,A-=64}}});var Dq=m((Lst,kq)=>{l();var La=yt();nr();var Y6=null;La.util.isNodejs&&!La.options.usePureJavaScript&&!process.versions["node-webkit"]&&(Y6=E0());var Xwe=kq.exports=La.prng=La.prng||{};Xwe.create=function(t){for(var e={plugin:t,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=t.md,i=new Array(32),n=0;n<32;++n)i[n]=r.create();e.pools=i,e.pool=0,e.generate=function(u,f){if(!f)return e.generateSync(u);var d=e.plugin.cipher,h=e.plugin.increment,p=e.plugin.formatKey,y=e.plugin.formatSeed,b=La.util.createBuffer();e.key=null,E();function E(v){if(v)return f(v);if(b.length()>=u)return f(null,b.getBytes(u));if(e.generated>1048575&&(e.key=null),e.key===null)return La.util.nextTick(function(){s(E)});var A=d(e.key,e.seed);e.generated+=A.length,b.putBytes(A),e.key=p(d(e.key,h(e.seed))),e.seed=y(d(e.key,e.seed)),La.util.setImmediate(E)}},e.generateSync=function(u){var f=e.plugin.cipher,d=e.plugin.increment,h=e.plugin.formatKey,p=e.plugin.formatSeed;e.key=null;for(var y=La.util.createBuffer();y.length()<u;){e.generated>1048575&&(e.key=null),e.key===null&&o();var b=f(e.key,e.seed);e.generated+=b.length,y.putBytes(b),e.key=h(f(e.key,d(e.seed))),e.seed=p(f(e.key,e.seed))}return y.getBytes(u)};function s(u){if(e.pools[0].messageLength>=32)return a(),u();var f=32-e.pools[0].messageLength<<5;e.seedFile(f,function(d,h){if(d)return u(d);e.collect(h),a(),u()})}function o(){if(e.pools[0].messageLength>=32)return a();var u=32-e.pools[0].messageLength<<5;e.collect(e.seedFileSync(u)),a()}function a(){e.reseeds=e.reseeds===4294967295?0:e.reseeds+1;var u=e.plugin.md.create();u.update(e.keyBytes);for(var f=1,d=0;d<32;++d)e.reseeds%f==0&&(u.update(e.pools[d].digest().getBytes()),e.pools[d].start()),f=f<<1;e.keyBytes=u.digest().getBytes(),u.start(),u.update(e.keyBytes);var h=u.digest().getBytes();e.key=e.plugin.formatKey(e.keyBytes),e.seed=e.plugin.formatSeed(h),e.generated=0}function c(u){var f=null,d=La.util.globalScope,h=d.crypto||d.msCrypto;h&&h.getRandomValues&&(f=function(D){return h.getRandomValues(D)});var p=La.util.createBuffer();if(f)for(;p.length()<u;){var y=Math.max(1,Math.min(u-p.length(),65536)/4),b=new Uint32Array(Math.floor(y));try{f(b);for(var E=0;E<b.length;++E)p.putInt32(b[E])}catch(D){if(!(typeof QuotaExceededError!="undefined"&&D instanceof QuotaExceededError))throw D}}if(p.length()<u)for(var v,A,R,F=Math.floor(Math.random()*65536);p.length()<u;){A=16807*(F&65535),v=16807*(F>>16),A+=(v&32767)<<16,A+=v>>15,A=(A&2147483647)+(A>>31),F=A&4294967295;for(var E=0;E<3;++E)R=F>>>(E<<3),R^=Math.floor(Math.random()*256),p.putByte(String.fromCharCode(R&255))}return p.getBytes(u)}return Y6?(e.seedFile=function(u,f){Y6.randomBytes(u,function(d,h){if(d)return f(d);f(null,h.toString())})},e.seedFileSync=function(u){return Y6.randomBytes(u).toString()}):(e.seedFile=function(u,f){try{f(null,c(u))}catch(d){f(d)}},e.seedFileSync=c),e.collect=function(u){for(var f=u.length,d=0;d<f;++d)e.pools[e.pool].update(u.substr(d,1)),e.pool=e.pool===31?0:e.pool+1},e.collectInt=function(u,f){for(var d="",h=0;h<f;h+=8)d+=String.fromCharCode(u>>h&255);e.collect(d)},e.registerWorker=function(u){if(u===self)e.seedFile=function(d,h){function p(y){var b=y.data;b.forge&&b.forge.prng&&(self.removeEventListener("message",p),h(b.forge.prng.err,b.forge.prng.bytes))}self.addEventListener("message",p),self.postMessage({forge:{prng:{needed:d}}})};else{var f=function(d){var h=d.data;h.forge&&h.forge.prng&&e.seedFile(h.forge.prng.needed,function(p,y){u.postMessage({forge:{prng:{err:p,bytes:y}}})})};u.addEventListener("message",f)}},e}});var hf=m((qst,p_)=>{l();var Wi=yt();_0();Oq();Dq();nr();(function(){if(Wi.random&&Wi.random.getBytes){p_.exports=Wi.random;return}(function(t){var e={},r=new Array(4),i=Wi.util.createBuffer();e.formatKey=function(d){var h=Wi.util.createBuffer(d);return d=new Array(4),d[0]=h.getInt32(),d[1]=h.getInt32(),d[2]=h.getInt32(),d[3]=h.getInt32(),Wi.aes._expandKey(d,!1)},e.formatSeed=function(d){var h=Wi.util.createBuffer(d);return d=new Array(4),d[0]=h.getInt32(),d[1]=h.getInt32(),d[2]=h.getInt32(),d[3]=h.getInt32(),d},e.cipher=function(d,h){return Wi.aes._updateBlock(d,h,r,!1),i.putInt32(r[0]),i.putInt32(r[1]),i.putInt32(r[2]),i.putInt32(r[3]),i.getBytes()},e.increment=function(d){return++d[3],d},e.md=Wi.md.sha256;function n(){var d=Wi.prng.create(e);return d.getBytes=function(h,p){return d.generate(h,p)},d.getBytesSync=function(h){return d.generate(h)},d}var s=n(),o=null,a=Wi.util.globalScope,c=a.crypto||a.msCrypto;if(c&&c.getRandomValues&&(o=function(d){return c.getRandomValues(d)}),Wi.options.usePureJavaScript||!Wi.util.isNodejs&&!o){if(typeof window=="undefined"||window.document===void 0,s.collectInt(+new Date,32),typeof navigator!="undefined"){var u="";for(var f in navigator)try{typeof navigator[f]=="string"&&(u+=navigator[f])}catch(d){}s.collect(u),u=null}t&&(t().mousemove(function(d){s.collectInt(d.clientX,16),s.collectInt(d.clientY,16)}),t().keypress(function(d){s.collectInt(d.charCode,8)}))}if(!Wi.random)Wi.random=s;else for(var f in s)Wi.random[f]=s[f];Wi.random.createInstance=n,p_.exports=Wi.random})(typeof jQuery!="undefined"?jQuery:null)})()});var Lq=m((jst,Mq)=>{l();var Jn=yt();nr();var y_=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],Bq=[1,2,3,5],Qwe=function(t,e){return t<<e&65535|(t&65535)>>16-e},Zwe=function(t,e){return(t&65535)>>e|t<<16-e&65535};Mq.exports=Jn.rc2=Jn.rc2||{};Jn.rc2.expandKey=function(t,e){typeof t=="string"&&(t=Jn.util.createBuffer(t)),e=e||128;var r=t,i=t.length(),n=e,s=Math.ceil(n/8),o=255>>(n&7),a;for(a=i;a<128;a++)r.putByte(y_[r.at(a-1)+r.at(a-i)&255]);for(r.setAt(128-s,y_[r.at(128-s)&o]),a=127-s;a>=0;a--)r.setAt(a,y_[r.at(a+1)^r.at(a+s)]);return r};var Nq=function(t,e,r){var i=!1,n=null,s=null,o=null,a,c,u,f,d=[];for(t=Jn.rc2.expandKey(t,e),u=0;u<64;u++)d.push(t.getInt16Le());r?(a=function(y){for(u=0;u<4;u++)y[u]+=d[f]+(y[(u+3)%4]&y[(u+2)%4])+(~y[(u+3)%4]&y[(u+1)%4]),y[u]=Qwe(y[u],Bq[u]),f++},c=function(y){for(u=0;u<4;u++)y[u]+=d[y[(u+3)%4]&63]}):(a=function(y){for(u=3;u>=0;u--)y[u]=Zwe(y[u],Bq[u]),y[u]-=d[f]+(y[(u+3)%4]&y[(u+2)%4])+(~y[(u+3)%4]&y[(u+1)%4]),f--},c=function(y){for(u=3;u>=0;u--)y[u]-=d[y[(u+3)%4]&63]});var h=function(y){var b=[];for(u=0;u<4;u++){var E=n.getInt16Le();o!==null&&(r?E^=o.getInt16Le():o.putInt16Le(E)),b.push(E&65535)}f=r?0:63;for(var v=0;v<y.length;v++)for(var A=0;A<y[v][0];A++)y[v][1](b);for(u=0;u<4;u++)o!==null&&(r?o.putInt16Le(b[u]):b[u]^=o.getInt16Le()),s.putInt16Le(b[u])},p=null;return p={start:function(y,b){y&&typeof y=="string"&&(y=Jn.util.createBuffer(y)),i=!1,n=Jn.util.createBuffer(),s=b||new Jn.util.createBuffer,o=y,p.output=s},update:function(y){for(i||n.putBuffer(y);n.length()>=8;)h([[5,a],[1,c],[6,a],[1,c],[5,a]])},finish:function(y){var b=!0;if(r)if(y)b=y(8,n,!r);else{var E=n.length()===8?8:8-n.length();n.fillWithByte(E,E)}if(b&&(i=!0,p.update()),!r&&(b=n.length()===0,b))if(y)b=y(8,s,!r);else{var v=s.length(),A=s.at(v-1);A>v?b=!1:s.truncate(A)}return b}},p};Jn.rc2.startEncrypting=function(t,e,r){var i=Jn.rc2.createEncryptionCipher(t,128);return i.start(e,r),i};Jn.rc2.createEncryptionCipher=function(t,e){return Nq(t,e,!0)};Jn.rc2.startDecrypting=function(t,e,r){var i=Jn.rc2.createDecryptionCipher(t,128);return i.start(e,r),i};Jn.rc2.createDecryptionCipher=function(t,e){return Nq(t,e,!1)}});var gy=m((Ust,Hq)=>{l();var g_=yt();Hq.exports=g_.jsbn=g_.jsbn||{};var eu,Jwe=244837814094590,qq=(Jwe&16777215)==15715070;function Se(t,e,r){this.data=[],t!=null&&(typeof t=="number"?this.fromNumber(t,e,r):e==null&&typeof t!="string"?this.fromString(t,256):this.fromString(t,e))}g_.jsbn.BigInteger=Se;function Ut(){return new Se(null)}function e9e(t,e,r,i,n,s){for(;--s>=0;){var o=e*this.data[t++]+r.data[i]+n;n=Math.floor(o/67108864),r.data[i++]=o&67108863}return n}function t9e(t,e,r,i,n,s){for(var o=e&32767,a=e>>15;--s>=0;){var c=this.data[t]&32767,u=this.data[t++]>>15,f=a*c+u*o;c=o*c+((f&32767)<<15)+r.data[i]+(n&1073741823),n=(c>>>30)+(f>>>15)+a*u+(n>>>30),r.data[i++]=c&1073741823}return n}function jq(t,e,r,i,n,s){for(var o=e&16383,a=e>>14;--s>=0;){var c=this.data[t]&16383,u=this.data[t++]>>14,f=a*c+u*o;c=o*c+((f&16383)<<14)+r.data[i]+n,n=(c>>28)+(f>>14)+a*u,r.data[i++]=c&268435455}return n}typeof navigator=="undefined"?(Se.prototype.am=jq,eu=28):qq&&navigator.appName=="Microsoft Internet Explorer"?(Se.prototype.am=t9e,eu=30):qq&&navigator.appName!="Netscape"?(Se.prototype.am=e9e,eu=26):(Se.prototype.am=jq,eu=28);Se.prototype.DB=eu;Se.prototype.DM=(1<<eu)-1;Se.prototype.DV=1<<eu;var m_=52;Se.prototype.FV=Math.pow(2,m_);Se.prototype.F1=m_-eu;Se.prototype.F2=2*eu-m_;var r9e="0123456789abcdefghijklmnopqrstuvwxyz",X6=new Array,S0,Ys;S0="0".charCodeAt(0);for(Ys=0;Ys<=9;++Ys)X6[S0++]=Ys;S0="a".charCodeAt(0);for(Ys=10;Ys<36;++Ys)X6[S0++]=Ys;S0="A".charCodeAt(0);for(Ys=10;Ys<36;++Ys)X6[S0++]=Ys;function Uq(t){return r9e.charAt(t)}function Fq(t,e){var r=X6[t.charCodeAt(e)];return r??-1}function i9e(t){for(var e=this.t-1;e>=0;--e)t.data[e]=this.data[e];t.t=this.t,t.s=this.s}function n9e(t){this.t=1,this.s=t<0?-1:0,t>0?this.data[0]=t:t<-1?this.data[0]=t+this.DV:this.t=0}function pf(t){var e=Ut();return e.fromInt(t),e}function s9e(t,e){var r;if(e==16)r=4;else if(e==8)r=3;else if(e==256)r=8;else if(e==2)r=1;else if(e==32)r=5;else if(e==4)r=2;else{this.fromRadix(t,e);return}this.t=0,this.s=0;for(var i=t.length,n=!1,s=0;--i>=0;){var o=r==8?t[i]&255:Fq(t,i);if(o<0){t.charAt(i)=="-"&&(n=!0);continue}n=!1,s==0?this.data[this.t++]=o:s+r>this.DB?(this.data[this.t-1]|=(o&(1<<this.DB-s)-1)<<s,this.data[this.t++]=o>>this.DB-s):this.data[this.t-1]|=o<<s,s+=r,s>=this.DB&&(s-=this.DB)}r==8&&(t[0]&128)!=0&&(this.s=-1,s>0&&(this.data[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),n&&Se.ZERO.subTo(this,this)}function o9e(){for(var t=this.s&this.DM;this.t>0&&this.data[this.t-1]==t;)--this.t}function a9e(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(t==16)e=4;else if(t==8)e=3;else if(t==2)e=1;else if(t==32)e=5;else if(t==4)e=2;else return this.toRadix(t);var r=(1<<e)-1,i,n=!1,s="",o=this.t,a=this.DB-o*this.DB%e;if(o-- >0)for(a<this.DB&&(i=this.data[o]>>a)>0&&(n=!0,s=Uq(i));o>=0;)a<e?(i=(this.data[o]&(1<<a)-1)<<e-a,i|=this.data[--o]>>(a+=this.DB-e)):(i=this.data[o]>>(a-=e)&r,a<=0&&(a+=this.DB,--o)),i>0&&(n=!0),n&&(s+=Uq(i));return n?s:"0"}function c9e(){var t=Ut();return Se.ZERO.subTo(this,t),t}function u9e(){return this.s<0?this.negate():this}function f9e(t){var e=this.s-t.s;if(e!=0)return e;var r=this.t;if(e=r-t.t,e!=0)return this.s<0?-e:e;for(;--r>=0;)if((e=this.data[r]-t.data[r])!=0)return e;return 0}function Q6(t){var e=1,r;return(r=t>>>16)!=0&&(t=r,e+=16),(r=t>>8)!=0&&(t=r,e+=8),(r=t>>4)!=0&&(t=r,e+=4),(r=t>>2)!=0&&(t=r,e+=2),(r=t>>1)!=0&&(t=r,e+=1),e}function l9e(){return this.t<=0?0:this.DB*(this.t-1)+Q6(this.data[this.t-1]^this.s&this.DM)}function d9e(t,e){var r;for(r=this.t-1;r>=0;--r)e.data[r+t]=this.data[r];for(r=t-1;r>=0;--r)e.data[r]=0;e.t=this.t+t,e.s=this.s}function h9e(t,e){for(var r=t;r<this.t;++r)e.data[r-t]=this.data[r];e.t=Math.max(this.t-t,0),e.s=this.s}function p9e(t,e){var r=t%this.DB,i=this.DB-r,n=(1<<i)-1,s=Math.floor(t/this.DB),o=this.s<<r&this.DM,a;for(a=this.t-1;a>=0;--a)e.data[a+s+1]=this.data[a]>>i|o,o=(this.data[a]&n)<<r;for(a=s-1;a>=0;--a)e.data[a]=0;e.data[s]=o,e.t=this.t+s+1,e.s=this.s,e.clamp()}function y9e(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t){e.t=0;return}var i=t%this.DB,n=this.DB-i,s=(1<<i)-1;e.data[0]=this.data[r]>>i;for(var o=r+1;o<this.t;++o)e.data[o-r-1]|=(this.data[o]&s)<<n,e.data[o-r]=this.data[o]>>i;i>0&&(e.data[this.t-r-1]|=(this.s&s)<<n),e.t=this.t-r,e.clamp()}function g9e(t,e){for(var r=0,i=0,n=Math.min(t.t,this.t);r<n;)i+=this.data[r]-t.data[r],e.data[r++]=i&this.DM,i>>=this.DB;if(t.t<this.t){for(i-=t.s;r<this.t;)i+=this.data[r],e.data[r++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;r<t.t;)i-=t.data[r],e.data[r++]=i&this.DM,i>>=this.DB;i-=t.s}e.s=i<0?-1:0,i<-1?e.data[r++]=this.DV+i:i>0&&(e.data[r++]=i),e.t=r,e.clamp()}function m9e(t,e){var r=this.abs(),i=t.abs(),n=r.t;for(e.t=n+i.t;--n>=0;)e.data[n]=0;for(n=0;n<i.t;++n)e.data[n+r.t]=r.am(0,i.data[n],e,n,0,r.t);e.s=0,e.clamp(),this.s!=t.s&&Se.ZERO.subTo(e,e)}function b9e(t){for(var e=this.abs(),r=t.t=2*e.t;--r>=0;)t.data[r]=0;for(r=0;r<e.t-1;++r){var i=e.am(r,e.data[r],t,2*r,0,1);(t.data[r+e.t]+=e.am(r+1,2*e.data[r],t,2*r+1,i,e.t-r-1))>=e.DV&&(t.data[r+e.t]-=e.DV,t.data[r+e.t+1]=1)}t.t>0&&(t.data[t.t-1]+=e.am(r,e.data[r],t,2*r,0,1)),t.s=0,t.clamp()}function v9e(t,e,r){var i=t.abs();if(!(i.t<=0)){var n=this.abs();if(n.t<i.t){e!=null&&e.fromInt(0),r!=null&&this.copyTo(r);return}r==null&&(r=Ut());var s=Ut(),o=this.s,a=t.s,c=this.DB-Q6(i.data[i.t-1]);c>0?(i.lShiftTo(c,s),n.lShiftTo(c,r)):(i.copyTo(s),n.copyTo(r));var u=s.t,f=s.data[u-1];if(f!=0){var d=f*(1<<this.F1)+(u>1?s.data[u-2]>>this.F2:0),h=this.FV/d,p=(1<<this.F1)/d,y=1<<this.F2,b=r.t,E=b-u,v=e??Ut();for(s.dlShiftTo(E,v),r.compareTo(v)>=0&&(r.data[r.t++]=1,r.subTo(v,r)),Se.ONE.dlShiftTo(u,v),v.subTo(s,s);s.t<u;)s.data[s.t++]=0;for(;--E>=0;){var A=r.data[--b]==f?this.DM:Math.floor(r.data[b]*h+(r.data[b-1]+y)*p);if((r.data[b]+=s.am(0,A,r,E,0,u))<A)for(s.dlShiftTo(E,v),r.subTo(v,r);r.data[b]<--A;)r.subTo(v,r)}e!=null&&(r.drShiftTo(u,e),o!=a&&Se.ZERO.subTo(e,e)),r.t=u,r.clamp(),c>0&&r.rShiftTo(c,r),o<0&&Se.ZERO.subTo(r,r)}}}function w9e(t){var e=Ut();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(Se.ZERO)>0&&t.subTo(e,e),e}function Ll(t){this.m=t}function _9e(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function E9e(t){return t}function S9e(t){t.divRemTo(this.m,null,t)}function x9e(t,e,r){t.multiplyTo(e,r),this.reduce(r)}function A9e(t,e){t.squareTo(e),this.reduce(e)}Ll.prototype.convert=_9e;Ll.prototype.revert=E9e;Ll.prototype.reduce=S9e;Ll.prototype.mulTo=x9e;Ll.prototype.sqrTo=A9e;function I9e(){if(this.t<1)return 0;var t=this.data[0];if((t&1)==0)return 0;var e=t&3;return e=e*(2-(t&15)*e)&15,e=e*(2-(t&255)*e)&255,e=e*(2-((t&65535)*e&65535))&65535,e=e*(2-t*e%this.DV)%this.DV,e>0?this.DV-e:-e}function ql(t){this.m=t,this.mp=t.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function T9e(t){var e=Ut();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(Se.ZERO)>0&&this.m.subTo(e,e),e}function R9e(t){var e=Ut();return t.copyTo(e),this.reduce(e),e}function P9e(t){for(;t.t<=this.mt2;)t.data[t.t++]=0;for(var e=0;e<this.m.t;++e){var r=t.data[e]&32767,i=r*this.mpl+((r*this.mph+(t.data[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(r=e+this.m.t,t.data[r]+=this.m.am(0,i,t,e,0,this.m.t);t.data[r]>=t.DV;)t.data[r]-=t.DV,t.data[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}function C9e(t,e){t.squareTo(e),this.reduce(e)}function O9e(t,e,r){t.multiplyTo(e,r),this.reduce(r)}ql.prototype.convert=T9e;ql.prototype.revert=R9e;ql.prototype.reduce=P9e;ql.prototype.mulTo=O9e;ql.prototype.sqrTo=C9e;function k9e(){return(this.t>0?this.data[0]&1:this.s)==0}function D9e(t,e){if(t>4294967295||t<1)return Se.ONE;var r=Ut(),i=Ut(),n=e.convert(this),s=Q6(t)-1;for(n.copyTo(r);--s>=0;)if(e.sqrTo(r,i),(t&1<<s)>0)e.mulTo(i,n,r);else{var o=r;r=i,i=o}return e.revert(r)}function B9e(t,e){var r;return t<256||e.isEven()?r=new Ll(e):r=new ql(e),this.exp(t,r)}Se.prototype.copyTo=i9e;Se.prototype.fromInt=n9e;Se.prototype.fromString=s9e;Se.prototype.clamp=o9e;Se.prototype.dlShiftTo=d9e;Se.prototype.drShiftTo=h9e;Se.prototype.lShiftTo=p9e;Se.prototype.rShiftTo=y9e;Se.prototype.subTo=g9e;Se.prototype.multiplyTo=m9e;Se.prototype.squareTo=b9e;Se.prototype.divRemTo=v9e;Se.prototype.invDigit=I9e;Se.prototype.isEven=k9e;Se.prototype.exp=D9e;Se.prototype.toString=a9e;Se.prototype.negate=c9e;Se.prototype.abs=u9e;Se.prototype.compareTo=f9e;Se.prototype.bitLength=l9e;Se.prototype.mod=w9e;Se.prototype.modPowInt=B9e;Se.ZERO=pf(0);Se.ONE=pf(1);function N9e(){var t=Ut();return this.copyTo(t),t}function M9e(){if(this.s<0){if(this.t==1)return this.data[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this.data[0];if(this.t==0)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]}function L9e(){return this.t==0?this.s:this.data[0]<<24>>24}function q9e(){return this.t==0?this.s:this.data[0]<<16>>16}function j9e(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function U9e(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}function F9e(t){if(t==null&&(t=10),this.signum()==0||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),i=pf(r),n=Ut(),s=Ut(),o="";for(this.divRemTo(i,n,s);n.signum()>0;)o=(r+s.intValue()).toString(t).substr(1)+o,n.divRemTo(i,n,s);return s.intValue().toString(t)+o}function K9e(t,e){this.fromInt(0),e==null&&(e=10);for(var r=this.chunkSize(e),i=Math.pow(e,r),n=!1,s=0,o=0,a=0;a<t.length;++a){var c=Fq(t,a);if(c<0){t.charAt(a)=="-"&&this.signum()==0&&(n=!0);continue}o=e*o+c,++s>=r&&(this.dMultiply(i),this.dAddOffset(o,0),s=0,o=0)}s>0&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(o,0)),n&&Se.ZERO.subTo(this,this)}function V9e(t,e,r){if(typeof e=="number")if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(Se.ONE.shiftLeft(t-1),b_,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(Se.ONE.shiftLeft(t-1),this);else{var i=new Array,n=t&7;i.length=(t>>3)+1,e.nextBytes(i),n>0?i[0]&=(1<<n)-1:i[0]=0,this.fromString(i,256)}}function z9e(){var t=this.t,e=new Array;e[0]=this.s;var r=this.DB-t*this.DB%8,i,n=0;if(t-- >0)for(r<this.DB&&(i=this.data[t]>>r)!=(this.s&this.DM)>>r&&(e[n++]=i|this.s<<this.DB-r);t>=0;)r<8?(i=(this.data[t]&(1<<r)-1)<<8-r,i|=this.data[--t]>>(r+=this.DB-8)):(i=this.data[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),(i&128)!=0&&(i|=-256),n==0&&(this.s&128)!=(i&128)&&++n,(n>0||i!=this.s)&&(e[n++]=i);return e}function H9e(t){return this.compareTo(t)==0}function G9e(t){return this.compareTo(t)<0?this:t}function $9e(t){return this.compareTo(t)>0?this:t}function W9e(t,e,r){var i,n,s=Math.min(t.t,this.t);for(i=0;i<s;++i)r.data[i]=e(this.data[i],t.data[i]);if(t.t<this.t){for(n=t.s&this.DM,i=s;i<this.t;++i)r.data[i]=e(this.data[i],n);r.t=this.t}else{for(n=this.s&this.DM,i=s;i<t.t;++i)r.data[i]=e(n,t.data[i]);r.t=t.t}r.s=e(this.s,t.s),r.clamp()}function Y9e(t,e){return t&e}function X9e(t){var e=Ut();return this.bitwiseTo(t,Y9e,e),e}function b_(t,e){return t|e}function Q9e(t){var e=Ut();return this.bitwiseTo(t,b_,e),e}function Kq(t,e){return t^e}function Z9e(t){var e=Ut();return this.bitwiseTo(t,Kq,e),e}function Vq(t,e){return t&~e}function J9e(t){var e=Ut();return this.bitwiseTo(t,Vq,e),e}function e_e(){for(var t=Ut(),e=0;e<this.t;++e)t.data[e]=this.DM&~this.data[e];return t.t=this.t,t.s=~this.s,t}function t_e(t){var e=Ut();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e}function r_e(t){var e=Ut();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e}function i_e(t){if(t==0)return-1;var e=0;return(t&65535)==0&&(t>>=16,e+=16),(t&255)==0&&(t>>=8,e+=8),(t&15)==0&&(t>>=4,e+=4),(t&3)==0&&(t>>=2,e+=2),(t&1)==0&&++e,e}function n_e(){for(var t=0;t<this.t;++t)if(this.data[t]!=0)return t*this.DB+i_e(this.data[t]);return this.s<0?this.t*this.DB:-1}function s_e(t){for(var e=0;t!=0;)t&=t-1,++e;return e}function o_e(){for(var t=0,e=this.s&this.DM,r=0;r<this.t;++r)t+=s_e(this.data[r]^e);return t}function a_e(t){var e=Math.floor(t/this.DB);return e>=this.t?this.s!=0:(this.data[e]&1<<t%this.DB)!=0}function c_e(t,e){var r=Se.ONE.shiftLeft(t);return this.bitwiseTo(r,e,r),r}function u_e(t){return this.changeBit(t,b_)}function f_e(t){return this.changeBit(t,Vq)}function l_e(t){return this.changeBit(t,Kq)}function d_e(t,e){for(var r=0,i=0,n=Math.min(t.t,this.t);r<n;)i+=this.data[r]+t.data[r],e.data[r++]=i&this.DM,i>>=this.DB;if(t.t<this.t){for(i+=t.s;r<this.t;)i+=this.data[r],e.data[r++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;r<t.t;)i+=t.data[r],e.data[r++]=i&this.DM,i>>=this.DB;i+=t.s}e.s=i<0?-1:0,i>0?e.data[r++]=i:i<-1&&(e.data[r++]=this.DV+i),e.t=r,e.clamp()}function h_e(t){var e=Ut();return this.addTo(t,e),e}function p_e(t){var e=Ut();return this.subTo(t,e),e}function y_e(t){var e=Ut();return this.multiplyTo(t,e),e}function g_e(t){var e=Ut();return this.divRemTo(t,e,null),e}function m_e(t){var e=Ut();return this.divRemTo(t,null,e),e}function b_e(t){var e=Ut(),r=Ut();return this.divRemTo(t,e,r),new Array(e,r)}function v_e(t){this.data[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function w_e(t,e){if(t!=0){for(;this.t<=e;)this.data[this.t++]=0;for(this.data[e]+=t;this.data[e]>=this.DV;)this.data[e]-=this.DV,++e>=this.t&&(this.data[this.t++]=0),++this.data[e]}}function yy(){}function zq(t){return t}function __e(t,e,r){t.multiplyTo(e,r)}function E_e(t,e){t.squareTo(e)}yy.prototype.convert=zq;yy.prototype.revert=zq;yy.prototype.mulTo=__e;yy.prototype.sqrTo=E_e;function S_e(t){return this.exp(t,new yy)}function x_e(t,e,r){var i=Math.min(this.t+t.t,e);for(r.s=0,r.t=i;i>0;)r.data[--i]=0;var n;for(n=r.t-this.t;i<n;++i)r.data[i+this.t]=this.am(0,t.data[i],r,i,0,this.t);for(n=Math.min(t.t,e);i<n;++i)this.am(0,t.data[i],r,i,0,e-i);r.clamp()}function A_e(t,e,r){--e;var i=r.t=this.t+t.t-e;for(r.s=0;--i>=0;)r.data[i]=0;for(i=Math.max(e-this.t,0);i<t.t;++i)r.data[this.t+i-e]=this.am(e-i,t.data[i],r,0,0,this.t+i-e);r.clamp(),r.drShiftTo(1,r)}function x0(t){this.r2=Ut(),this.q3=Ut(),Se.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}function I_e(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=Ut();return t.copyTo(e),this.reduce(e),e}function T_e(t){return t}function R_e(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)}function P_e(t,e){t.squareTo(e),this.reduce(e)}function C_e(t,e,r){t.multiplyTo(e,r),this.reduce(r)}x0.prototype.convert=I_e;x0.prototype.revert=T_e;x0.prototype.reduce=R_e;x0.prototype.mulTo=C_e;x0.prototype.sqrTo=P_e;function O_e(t,e){var r=t.bitLength(),i,n=pf(1),s;if(r<=0)return n;r<18?i=1:r<48?i=3:r<144?i=4:r<768?i=5:i=6,r<8?s=new Ll(e):e.isEven()?s=new x0(e):s=new ql(e);var o=new Array,a=3,c=i-1,u=(1<<i)-1;if(o[1]=s.convert(this),i>1){var f=Ut();for(s.sqrTo(o[1],f);a<=u;)o[a]=Ut(),s.mulTo(f,o[a-2],o[a]),a+=2}var d=t.t-1,h,p=!0,y=Ut(),b;for(r=Q6(t.data[d])-1;d>=0;){for(r>=c?h=t.data[d]>>r-c&u:(h=(t.data[d]&(1<<r+1)-1)<<c-r,d>0&&(h|=t.data[d-1]>>this.DB+r-c)),a=i;(h&1)==0;)h>>=1,--a;if((r-=a)<0&&(r+=this.DB,--d),p)o[h].copyTo(n),p=!1;else{for(;a>1;)s.sqrTo(n,y),s.sqrTo(y,n),a-=2;a>0?s.sqrTo(n,y):(b=n,n=y,y=b),s.mulTo(y,o[h],n)}for(;d>=0&&(t.data[d]&1<<r)==0;)s.sqrTo(n,y),b=n,n=y,y=b,--r<0&&(r=this.DB-1,--d)}return s.revert(n)}function k_e(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(e.compareTo(r)<0){var i=e;e=r,r=i}var n=e.getLowestSetBit(),s=r.getLowestSetBit();if(s<0)return e;for(n<s&&(s=n),s>0&&(e.rShiftTo(s,e),r.rShiftTo(s,r));e.signum()>0;)(n=e.getLowestSetBit())>0&&e.rShiftTo(n,e),(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return s>0&&r.lShiftTo(s,r),r}function D_e(t){if(t<=0)return 0;var e=this.DV%t,r=this.s<0?t-1:0;if(this.t>0)if(e==0)r=this.data[0]%t;else for(var i=this.t-1;i>=0;--i)r=(e*r+this.data[i])%t;return r}function B_e(t){var e=t.isEven();if(this.isEven()&&e||t.signum()==0)return Se.ZERO;for(var r=t.clone(),i=this.clone(),n=pf(1),s=pf(0),o=pf(0),a=pf(1);r.signum()!=0;){for(;r.isEven();)r.rShiftTo(1,r),e?((!n.isEven()||!s.isEven())&&(n.addTo(this,n),s.subTo(t,s)),n.rShiftTo(1,n)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);for(;i.isEven();)i.rShiftTo(1,i),e?((!o.isEven()||!a.isEven())&&(o.addTo(this,o),a.subTo(t,a)),o.rShiftTo(1,o)):a.isEven()||a.subTo(t,a),a.rShiftTo(1,a);r.compareTo(i)>=0?(r.subTo(i,r),e&&n.subTo(o,n),s.subTo(a,s)):(i.subTo(r,i),e&&o.subTo(n,o),a.subTo(s,a))}if(i.compareTo(Se.ONE)!=0)return Se.ZERO;if(a.compareTo(t)>=0)return a.subtract(t);if(a.signum()<0)a.addTo(t,a);else return a;return a.signum()<0?a.add(t):a}var Vo=[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],N_e=(1<<26)/Vo[Vo.length-1];function M_e(t){var e,r=this.abs();if(r.t==1&&r.data[0]<=Vo[Vo.length-1]){for(e=0;e<Vo.length;++e)if(r.data[0]==Vo[e])return!0;return!1}if(r.isEven())return!1;for(e=1;e<Vo.length;){for(var i=Vo[e],n=e+1;n<Vo.length&&i<N_e;)i*=Vo[n++];for(i=r.modInt(i);e<n;)if(i%Vo[e++]==0)return!1}return r.millerRabin(t)}function L_e(t){var e=this.subtract(Se.ONE),r=e.getLowestSetBit();if(r<=0)return!1;for(var i=e.shiftRight(r),n=q_e(),s,o=0;o<t;++o){do s=new Se(this.bitLength(),n);while(s.compareTo(Se.ONE)<=0||s.compareTo(e)>=0);var a=s.modPow(i,this);if(a.compareTo(Se.ONE)!=0&&a.compareTo(e)!=0){for(var c=1;c++<r&&a.compareTo(e)!=0;)if(a=a.modPowInt(2,this),a.compareTo(Se.ONE)==0)return!1;if(a.compareTo(e)!=0)return!1}}return!0}function q_e(){return{nextBytes:function(t){for(var e=0;e<t.length;++e)t[e]=Math.floor(Math.random()*256)}}}Se.prototype.chunkSize=j9e;Se.prototype.toRadix=F9e;Se.prototype.fromRadix=K9e;Se.prototype.fromNumber=V9e;Se.prototype.bitwiseTo=W9e;Se.prototype.changeBit=c_e;Se.prototype.addTo=d_e;Se.prototype.dMultiply=v_e;Se.prototype.dAddOffset=w_e;Se.prototype.multiplyLowerTo=x_e;Se.prototype.multiplyUpperTo=A_e;Se.prototype.modInt=D_e;Se.prototype.millerRabin=L_e;Se.prototype.clone=N9e;Se.prototype.intValue=M9e;Se.prototype.byteValue=L9e;Se.prototype.shortValue=q9e;Se.prototype.signum=U9e;Se.prototype.toByteArray=z9e;Se.prototype.equals=H9e;Se.prototype.min=G9e;Se.prototype.max=$9e;Se.prototype.and=X9e;Se.prototype.or=Q9e;Se.prototype.xor=Z9e;Se.prototype.andNot=J9e;Se.prototype.not=e_e;Se.prototype.shiftLeft=t_e;Se.prototype.shiftRight=r_e;Se.prototype.getLowestSetBit=n_e;Se.prototype.bitCount=o_e;Se.prototype.testBit=a_e;Se.prototype.setBit=u_e;Se.prototype.clearBit=f_e;Se.prototype.flipBit=l_e;Se.prototype.add=h_e;Se.prototype.subtract=p_e;Se.prototype.multiply=y_e;Se.prototype.divide=g_e;Se.prototype.remainder=m_e;Se.prototype.divideAndRemainder=b_e;Se.prototype.modPow=O_e;Se.prototype.modInverse=B_e;Se.prototype.pow=S_e;Se.prototype.gcd=k_e;Se.prototype.isProbablePrime=M_e});var Xq=m((Fst,Yq)=>{l();var qa=yt();df();nr();var Gq=Yq.exports=qa.sha1=qa.sha1||{};qa.md.sha1=qa.md.algorithms.sha1=Gq;Gq.create=function(){$q||j_e();var t=null,e=qa.util.createBuffer(),r=new Array(80),i={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return i.start=function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var n=i.messageLengthSize/4,s=0;s<n;++s)i.fullMessageLength.push(0);return e=qa.util.createBuffer(),t={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},i},i.start(),i.update=function(n,s){s==="utf8"&&(n=qa.util.encodeUtf8(n));var o=n.length;i.messageLength+=o,o=[o/4294967296>>>0,o>>>0];for(var a=i.fullMessageLength.length-1;a>=0;--a)i.fullMessageLength[a]+=o[1],o[1]=o[0]+(i.fullMessageLength[a]/4294967296>>>0),i.fullMessageLength[a]=i.fullMessageLength[a]>>>0,o[0]=o[1]/4294967296>>>0;return e.putBytes(n),Wq(t,r,e),(e.read>2048||e.length()===0)&&e.compact(),i},i.digest=function(){var n=qa.util.createBuffer();n.putBytes(e.bytes());var s=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize,o=s&i.blockLength-1;n.putBytes(v_.substr(0,i.blockLength-o));for(var a,c,u=i.fullMessageLength[0]*8,f=0;f<i.fullMessageLength.length-1;++f)a=i.fullMessageLength[f+1]*8,c=a/4294967296>>>0,u+=c,n.putInt32(u>>>0),u=a>>>0;n.putInt32(u);var d={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4};Wq(d,r,n);var h=qa.util.createBuffer();return h.putInt32(d.h0),h.putInt32(d.h1),h.putInt32(d.h2),h.putInt32(d.h3),h.putInt32(d.h4),h},i};var v_=null,$q=!1;function j_e(){v_=String.fromCharCode(128),v_+=qa.util.fillString(String.fromCharCode(0),64),$q=!0}function Wq(t,e,r){for(var i,n,s,o,a,c,u,f,d=r.length();d>=64;){for(n=t.h0,s=t.h1,o=t.h2,a=t.h3,c=t.h4,f=0;f<16;++f)i=r.getInt32(),e[f]=i,u=a^s&(o^a),i=(n<<5|n>>>27)+u+c+1518500249+i,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=n,n=i;for(;f<20;++f)i=e[f-3]^e[f-8]^e[f-14]^e[f-16],i=i<<1|i>>>31,e[f]=i,u=a^s&(o^a),i=(n<<5|n>>>27)+u+c+1518500249+i,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=n,n=i;for(;f<32;++f)i=e[f-3]^e[f-8]^e[f-14]^e[f-16],i=i<<1|i>>>31,e[f]=i,u=s^o^a,i=(n<<5|n>>>27)+u+c+1859775393+i,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=n,n=i;for(;f<40;++f)i=e[f-6]^e[f-16]^e[f-28]^e[f-32],i=i<<2|i>>>30,e[f]=i,u=s^o^a,i=(n<<5|n>>>27)+u+c+1859775393+i,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=n,n=i;for(;f<60;++f)i=e[f-6]^e[f-16]^e[f-28]^e[f-32],i=i<<2|i>>>30,e[f]=i,u=s&o|a&(s^o),i=(n<<5|n>>>27)+u+c+2400959708+i,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=n,n=i;for(;f<80;++f)i=e[f-6]^e[f-16]^e[f-28]^e[f-32],i=i<<2|i>>>30,e[f]=i,u=s^o^a,i=(n<<5|n>>>27)+u+c+3395469782+i,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=n,n=i;t.h0=t.h0+n|0,t.h1=t.h1+s|0,t.h2=t.h2+o|0,t.h3=t.h3+a|0,t.h4=t.h4+c|0,d-=64}}});var Jq=m((Kst,Zq)=>{l();var ja=yt();nr();hf();Xq();var Qq=Zq.exports=ja.pkcs1=ja.pkcs1||{};Qq.encode_rsa_oaep=function(t,e,r){var i,n,s,o;typeof r=="string"?(i=r,n=arguments[3]||void 0,s=arguments[4]||void 0):r&&(i=r.label||void 0,n=r.seed||void 0,s=r.md||void 0,r.mgf1&&r.mgf1.md&&(o=r.mgf1.md)),s?s.start():s=ja.md.sha1.create(),o||(o=s);var a=Math.ceil(t.n.bitLength()/8),c=a-2*s.digestLength-2;if(e.length>c){var u=new Error("RSAES-OAEP input message length is too long.");throw u.length=e.length,u.maxLength=c,u}i||(i=""),s.update(i,"raw");for(var f=s.digest(),d="",h=c-e.length,p=0;p<h;p++)d+="\0";var y=f.getBytes()+d+""+e;if(!n)n=ja.random.getBytes(s.digestLength);else if(n.length!==s.digestLength){var u=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw u.seedLength=n.length,u.digestLength=s.digestLength,u}var b=Z6(n,a-s.digestLength-1,o),E=ja.util.xorBytes(y,b,y.length),v=Z6(E,s.digestLength,o),A=ja.util.xorBytes(n,v,n.length);return"\0"+A+E};Qq.decode_rsa_oaep=function(t,e,r){var i,n,s;typeof r=="string"?(i=r,n=arguments[3]||void 0):r&&(i=r.label||void 0,n=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md));var o=Math.ceil(t.n.bitLength()/8);if(e.length!==o){var E=new Error("RSAES-OAEP encoded message length is invalid.");throw E.length=e.length,E.expectedLength=o,E}if(n===void 0?n=ja.md.sha1.create():n.start(),s||(s=n),o<2*n.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");i||(i=""),n.update(i,"raw");for(var a=n.digest().getBytes(),c=e.charAt(0),u=e.substring(1,n.digestLength+1),f=e.substring(1+n.digestLength),d=Z6(f,n.digestLength,s),h=ja.util.xorBytes(u,d,u.length),p=Z6(h,o-n.digestLength-1,s),y=ja.util.xorBytes(f,p,f.length),b=y.substring(0,n.digestLength),E=c!=="\0",v=0;v<n.digestLength;++v)E|=a.charAt(v)!==b.charAt(v);for(var A=1,R=n.digestLength,F=n.digestLength;F<y.length;F++){var D=y.charCodeAt(F),B=D&1^1,H=A?65534:0;E|=D&H,A=A&B,R+=A}if(E||y.charCodeAt(R)!==1)throw new Error("Invalid RSAES-OAEP padding.");return y.substring(R+1)};function Z6(t,e,r){r||(r=ja.md.sha1.create());for(var i="",n=Math.ceil(e/r.digestLength),s=0;s<n;++s){var o=String.fromCharCode(s>>24&255,s>>16&255,s>>8&255,s&255);r.start(),r.update(t+o),i+=r.digest().getBytes()}return i.substring(0,e)}});var ej=m((Vst,w_)=>{l();var yf=yt();nr();gy();hf();(function(){if(yf.prime){w_.exports=yf.prime;return}var t=w_.exports=yf.prime=yf.prime||{},e=yf.jsbn.BigInteger,r=[6,4,2,4,2,4,6,2],i=new e(null);i.fromInt(30);var n=function(d,h){return d|h};t.generateProbablePrime=function(d,h,p){typeof h=="function"&&(p=h,h={}),h=h||{};var y=h.algorithm||"PRIMEINC";typeof y=="string"&&(y={name:y}),y.options=y.options||{};var b=h.prng||yf.random,E={nextBytes:function(v){for(var A=b.getBytesSync(v.length),R=0;R<v.length;++R)v[R]=A.charCodeAt(R)}};if(y.name==="PRIMEINC")return s(d,E,y.options,p);throw new Error("Invalid prime generation algorithm: "+y.name)};function s(d,h,p,y){return"workers"in p?c(d,h,p,y):o(d,h,p,y)}function o(d,h,p,y){var b=u(d,h),E=0,v=f(b.bitLength());"millerRabinTests"in p&&(v=p.millerRabinTests);var A=10;"maxBlockTime"in p&&(A=p.maxBlockTime),a(b,d,h,E,v,A,y)}function a(d,h,p,y,b,E,v){var A=+new Date;do{if(d.bitLength()>h&&(d=u(h,p)),d.isProbablePrime(b))return v(null,d);d.dAddOffset(r[y++%8],0)}while(E<0||+new Date-A<E);yf.util.setImmediate(function(){a(d,h,p,y,b,E,v)})}function c(d,h,p,y){if(typeof Worker=="undefined")return o(d,h,p,y);var b=u(d,h),E=p.workers,v=p.workLoad||100,A=v*30/8,R=p.workerScript||"forge/prime.worker.js";if(E===-1)return yf.util.estimateCores(function(D,B){D&&(B=2),E=B-1,F()});F();function F(){E=Math.max(1,E);for(var D=[],B=0;B<E;++B)D[B]=new Worker(R);for(var H=E,B=0;B<E;++B)D[B].addEventListener("message",X);var W=!1;function X(P){if(!W){--H;var g=P.data;if(g.found){for(var w=0;w<D.length;++w)D[w].terminate();return W=!0,y(null,new e(g.prime,16))}b.bitLength()>d&&(b=u(d,h));var S=b.toString(16);P.target.postMessage({hex:S,workLoad:v}),b.dAddOffset(A,0)}}}}function u(d,h){var p=new e(d,h),y=d-1;return p.testBit(y)||p.bitwiseTo(e.ONE.shiftLeft(y),n,p),p.dAddOffset(31-p.mod(i).byteValue(),0),p}function f(d){return d<=100?27:d<=150?18:d<=200?15:d<=250?12:d<=300?9:d<=350?8:d<=400?7:d<=500?6:d<=600?5:d<=800?4:d<=1250?3:2}})()});var my=m((zst,aj)=>{l();var ut=yt();Qc();gy();b0();Jq();ej();hf();nr();typeof Nt=="undefined"&&(Nt=ut.jsbn.BigInteger);var Nt,__=ut.util.isNodejs?E0():null,fe=ut.asn1,Xs=ut.util;ut.pki=ut.pki||{};aj.exports=ut.pki.rsa=ut.rsa=ut.rsa||{};var ft=ut.pki,U_e=[6,4,2,4,2,4,6,2],F_e={name:"PrivateKeyInfo",tagClass:fe.Class.UNIVERSAL,type:fe.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:fe.Class.UNIVERSAL,type:fe.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:fe.Class.UNIVERSAL,type:fe.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:fe.Class.UNIVERSAL,type:fe.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:fe.Class.UNIVERSAL,type:fe.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},K_e={name:"RSAPrivateKey",tagClass:fe.Class.UNIVERSAL,type:fe.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:fe.Class.UNIVERSAL,type:fe.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:fe.Class.UNIVERSAL,type:fe.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:fe.Class.UNIVERSAL,type:fe.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:fe.Class.UNIVERSAL,type:fe.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:fe.Class.UNIVERSAL,type:fe.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:fe.Class.UNIVERSAL,type:fe.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:fe.Class.UNIVERSAL,type:fe.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:fe.Class.UNIVERSAL,type:fe.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:fe.Class.UNIVERSAL,type:fe.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},V_e={name:"RSAPublicKey",tagClass:fe.Class.UNIVERSAL,type:fe.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:fe.Class.UNIVERSAL,type:fe.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:fe.Class.UNIVERSAL,type:fe.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},z_e=ut.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:fe.Class.UNIVERSAL,type:fe.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:fe.Class.UNIVERSAL,type:fe.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:fe.Class.UNIVERSAL,type:fe.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:fe.Class.UNIVERSAL,type:fe.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:fe.Class.UNIVERSAL,type:fe.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},H_e=function(t){var e;if(t.algorithm in ft.oids)e=ft.oids[t.algorithm];else{var r=new Error("Unknown message digest algorithm.");throw r.algorithm=t.algorithm,r}var i=fe.oidToDer(e).getBytes(),n=fe.create(fe.Class.UNIVERSAL,fe.Type.SEQUENCE,!0,[]),s=fe.create(fe.Class.UNIVERSAL,fe.Type.SEQUENCE,!0,[]);s.value.push(fe.create(fe.Class.UNIVERSAL,fe.Type.OID,!1,i)),s.value.push(fe.create(fe.Class.UNIVERSAL,fe.Type.NULL,!1,""));var o=fe.create(fe.Class.UNIVERSAL,fe.Type.OCTETSTRING,!1,t.digest().getBytes());return n.value.push(s),n.value.push(o),fe.toDer(n).getBytes()},tj=function(t,e,r){if(r)return t.modPow(e.e,e.n);if(!e.p||!e.q)return t.modPow(e.d,e.n);e.dP||(e.dP=e.d.mod(e.p.subtract(Nt.ONE))),e.dQ||(e.dQ=e.d.mod(e.q.subtract(Nt.ONE))),e.qInv||(e.qInv=e.q.modInverse(e.p));var i;do i=new Nt(ut.util.bytesToHex(ut.random.getBytes(e.n.bitLength()/8)),16);while(i.compareTo(e.n)>=0||!i.gcd(e.n).equals(Nt.ONE));t=t.multiply(i.modPow(e.e,e.n)).mod(e.n);for(var n=t.mod(e.p).modPow(e.dP,e.p),s=t.mod(e.q).modPow(e.dQ,e.q);n.compareTo(s)<0;)n=n.add(e.p);var o=n.subtract(s).multiply(e.qInv).mod(e.p).multiply(e.q).add(s);return o=o.multiply(i.modInverse(e.n)).mod(e.n),o};ft.rsa.encrypt=function(t,e,r){var i=r,n,s=Math.ceil(e.n.bitLength()/8);r!==!1&&r!==!0?(i=r===2,n=rj(t,e,r)):(n=ut.util.createBuffer(),n.putBytes(t));for(var o=new Nt(n.toHex(),16),a=tj(o,e,i),c=a.toString(16),u=ut.util.createBuffer(),f=s-Math.ceil(c.length/2);f>0;)u.putByte(0),--f;return u.putBytes(ut.util.hexToBytes(c)),u.getBytes()};ft.rsa.decrypt=function(t,e,r,i){var n=Math.ceil(e.n.bitLength()/8);if(t.length!==n){var s=new Error("Encrypted message length is invalid.");throw s.length=t.length,s.expected=n,s}var o=new Nt(ut.util.createBuffer(t).toHex(),16);if(o.compareTo(e.n)>=0)throw new Error("Encrypted message is invalid.");for(var a=tj(o,e,r),c=a.toString(16),u=ut.util.createBuffer(),f=n-Math.ceil(c.length/2);f>0;)u.putByte(0),--f;return u.putBytes(ut.util.hexToBytes(c)),i!==!1?J6(u.getBytes(),e,r):u.getBytes()};ft.rsa.createKeyPairGenerationState=function(t,e,r){typeof t=="string"&&(t=parseInt(t,10)),t=t||2048,r=r||{};var i=r.prng||ut.random,n={nextBytes:function(a){for(var c=i.getBytesSync(a.length),u=0;u<a.length;++u)a[u]=c.charCodeAt(u)}},s=r.algorithm||"PRIMEINC",o;if(s==="PRIMEINC")o={algorithm:s,state:0,bits:t,rng:n,eInt:e||65537,e:new Nt(null),p:null,q:null,qBits:t>>1,pBits:t-(t>>1),pqState:0,num:null,keys:null},o.e.fromInt(o.eInt);else throw new Error("Invalid key generation algorithm: "+s);return o};ft.rsa.stepKeyPairGenerationState=function(t,e){"algorithm"in t||(t.algorithm="PRIMEINC");var r=new Nt(null);r.fromInt(30);for(var i=0,n=function(d,h){return d|h},s=+new Date,o,a=0;t.keys===null&&(e<=0||a<e);){if(t.state===0){var c=t.p===null?t.pBits:t.qBits,u=c-1;t.pqState===0?(t.num=new Nt(c,t.rng),t.num.testBit(u)||t.num.bitwiseTo(Nt.ONE.shiftLeft(u),n,t.num),t.num.dAddOffset(31-t.num.mod(r).byteValue(),0),i=0,++t.pqState):t.pqState===1?t.num.bitLength()>c?t.pqState=0:t.num.isProbablePrime($_e(t.num.bitLength()))?++t.pqState:t.num.dAddOffset(U_e[i++%8],0):t.pqState===2?t.pqState=t.num.subtract(Nt.ONE).gcd(t.e).compareTo(Nt.ONE)===0?3:0:t.pqState===3&&(t.pqState=0,t.p===null?t.p=t.num:t.q=t.num,t.p!==null&&t.q!==null&&++t.state,t.num=null)}else if(t.state===1)t.p.compareTo(t.q)<0&&(t.num=t.p,t.p=t.q,t.q=t.num),++t.state;else if(t.state===2)t.p1=t.p.subtract(Nt.ONE),t.q1=t.q.subtract(Nt.ONE),t.phi=t.p1.multiply(t.q1),++t.state;else if(t.state===3)t.phi.gcd(t.e).compareTo(Nt.ONE)===0?++t.state:(t.p=null,t.q=null,t.state=0);else if(t.state===4)t.n=t.p.multiply(t.q),t.n.bitLength()===t.bits?++t.state:(t.q=null,t.state=0);else if(t.state===5){var f=t.e.modInverse(t.phi);t.keys={privateKey:ft.rsa.setPrivateKey(t.n,t.e,f,t.p,t.q,f.mod(t.p1),f.mod(t.q1),t.q.modInverse(t.p)),publicKey:ft.rsa.setPublicKey(t.n,t.e)}}o=+new Date,a+=o-s,s=o}return t.keys!==null};ft.rsa.generateKeyPair=function(t,e,r,i){if(arguments.length===1?typeof t=="object"?(r=t,t=void 0):typeof t=="function"&&(i=t,t=void 0):arguments.length===2?typeof t=="number"?typeof e=="function"?(i=e,e=void 0):typeof e!="number"&&(r=e,e=void 0):(r=t,i=e,t=void 0,e=void 0):arguments.length===3&&(typeof e=="number"?typeof r=="function"&&(i=r,r=void 0):(i=r,r=e,e=void 0)),r=r||{},t===void 0&&(t=r.bits||2048),e===void 0&&(e=r.e||65537),!ut.options.usePureJavaScript&&!r.prng&&t>=256&&t<=16384&&(e===65537||e===3)){if(i){if(ij("generateKeyPair"))return __.generateKeyPair("rsa",{modulusLength:t,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(a,c,u){if(a)return i(a);i(null,{privateKey:ft.privateKeyFromPem(u),publicKey:ft.publicKeyFromPem(c)})});if(nj("generateKey")&&nj("exportKey"))return Xs.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:oj(e),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(a){return Xs.globalScope.crypto.subtle.exportKey("pkcs8",a.privateKey)}).then(void 0,function(a){i(a)}).then(function(a){if(a){var c=ft.privateKeyFromAsn1(fe.fromDer(ut.util.createBuffer(a)));i(null,{privateKey:c,publicKey:ft.setRsaPublicKey(c.n,c.e)})}});if(sj("generateKey")&&sj("exportKey")){var n=Xs.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:oj(e),hash:{name:"SHA-256"}},!0,["sign","verify"]);n.oncomplete=function(a){var c=a.target.result,u=Xs.globalScope.msCrypto.subtle.exportKey("pkcs8",c.privateKey);u.oncomplete=function(f){var d=f.target.result,h=ft.privateKeyFromAsn1(fe.fromDer(ut.util.createBuffer(d)));i(null,{privateKey:h,publicKey:ft.setRsaPublicKey(h.n,h.e)})},u.onerror=function(f){i(f)}},n.onerror=function(a){i(a)};return}}else if(ij("generateKeyPairSync")){var s=__.generateKeyPairSync("rsa",{modulusLength:t,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:ft.privateKeyFromPem(s.privateKey),publicKey:ft.publicKeyFromPem(s.publicKey)}}}var o=ft.rsa.createKeyPairGenerationState(t,e,r);if(!i)return ft.rsa.stepKeyPairGenerationState(o,0),o.keys;G_e(o,r,i)};ft.setRsaPublicKey=ft.rsa.setPublicKey=function(t,e){var r={n:t,e};return r.encrypt=function(i,n,s){if(typeof n=="string"?n=n.toUpperCase():n===void 0&&(n="RSAES-PKCS1-V1_5"),n==="RSAES-PKCS1-V1_5")n={encode:function(a,c,u){return rj(a,c,2).getBytes()}};else if(n==="RSA-OAEP"||n==="RSAES-OAEP")n={encode:function(a,c){return ut.pkcs1.encode_rsa_oaep(c,a,s)}};else if(["RAW","NONE","NULL",null].indexOf(n)!==-1)n={encode:function(a){return a}};else if(typeof n=="string")throw new Error('Unsupported encryption scheme: "'+n+'".');var o=n.encode(i,r,!0);return ft.rsa.encrypt(o,r,!0)},r.verify=function(i,n,s){typeof s=="string"?s=s.toUpperCase():s===void 0&&(s="RSASSA-PKCS1-V1_5"),s==="RSASSA-PKCS1-V1_5"?s={verify:function(a,c){c=J6(c,r,!0);var u=fe.fromDer(c);return a===u.value[1].value}}:(s==="NONE"||s==="NULL"||s===null)&&(s={verify:function(a,c){return c=J6(c,r,!0),a===c}});var o=ft.rsa.decrypt(n,r,!0,!1);return s.verify(i,o,r.n.bitLength())},r};ft.setRsaPrivateKey=ft.rsa.setPrivateKey=function(t,e,r,i,n,s,o,a){var c={n:t,e,d:r,p:i,q:n,dP:s,dQ:o,qInv:a};return c.decrypt=function(u,f,d){typeof f=="string"?f=f.toUpperCase():f===void 0&&(f="RSAES-PKCS1-V1_5");var h=ft.rsa.decrypt(u,c,!1,!1);if(f==="RSAES-PKCS1-V1_5")f={decode:J6};else if(f==="RSA-OAEP"||f==="RSAES-OAEP")f={decode:function(p,y){return ut.pkcs1.decode_rsa_oaep(y,p,d)}};else if(["RAW","NONE","NULL",null].indexOf(f)!==-1)f={decode:function(p){return p}};else throw new Error('Unsupported encryption scheme: "'+f+'".');return f.decode(h,c,!1)},c.sign=function(u,f){var d=!1;typeof f=="string"&&(f=f.toUpperCase()),f===void 0||f==="RSASSA-PKCS1-V1_5"?(f={encode:H_e},d=1):(f==="NONE"||f==="NULL"||f===null)&&(f={encode:function(){return u}},d=1);var h=f.encode(u,c.n.bitLength());return ft.rsa.encrypt(h,c,d)},c};ft.wrapRsaPrivateKey=function(t){return fe.create(fe.Class.UNIVERSAL,fe.Type.SEQUENCE,!0,[fe.create(fe.Class.UNIVERSAL,fe.Type.INTEGER,!1,fe.integerToDer(0).getBytes()),fe.create(fe.Class.UNIVERSAL,fe.Type.SEQUENCE,!0,[fe.create(fe.Class.UNIVERSAL,fe.Type.OID,!1,fe.oidToDer(ft.oids.rsaEncryption).getBytes()),fe.create(fe.Class.UNIVERSAL,fe.Type.NULL,!1,"")]),fe.create(fe.Class.UNIVERSAL,fe.Type.OCTETSTRING,!1,fe.toDer(t).getBytes())])};ft.privateKeyFromAsn1=function(t){var e={},r=[];if(fe.validate(t,F_e,e,r)&&(t=fe.fromDer(ut.util.createBuffer(e.privateKey))),e={},r=[],!fe.validate(t,K_e,e,r)){var i=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw i.errors=r,i}var n,s,o,a,c,u,f,d;return n=ut.util.createBuffer(e.privateKeyModulus).toHex(),s=ut.util.createBuffer(e.privateKeyPublicExponent).toHex(),o=ut.util.createBuffer(e.privateKeyPrivateExponent).toHex(),a=ut.util.createBuffer(e.privateKeyPrime1).toHex(),c=ut.util.createBuffer(e.privateKeyPrime2).toHex(),u=ut.util.createBuffer(e.privateKeyExponent1).toHex(),f=ut.util.createBuffer(e.privateKeyExponent2).toHex(),d=ut.util.createBuffer(e.privateKeyCoefficient).toHex(),ft.setRsaPrivateKey(new Nt(n,16),new Nt(s,16),new Nt(o,16),new Nt(a,16),new Nt(c,16),new Nt(u,16),new Nt(f,16),new Nt(d,16))};ft.privateKeyToAsn1=ft.privateKeyToRSAPrivateKey=function(t){return fe.create(fe.Class.UNIVERSAL,fe.Type.SEQUENCE,!0,[fe.create(fe.Class.UNIVERSAL,fe.Type.INTEGER,!1,fe.integerToDer(0).getBytes()),fe.create(fe.Class.UNIVERSAL,fe.Type.INTEGER,!1,Ua(t.n)),fe.create(fe.Class.UNIVERSAL,fe.Type.INTEGER,!1,Ua(t.e)),fe.create(fe.Class.UNIVERSAL,fe.Type.INTEGER,!1,Ua(t.d)),fe.create(fe.Class.UNIVERSAL,fe.Type.INTEGER,!1,Ua(t.p)),fe.create(fe.Class.UNIVERSAL,fe.Type.INTEGER,!1,Ua(t.q)),fe.create(fe.Class.UNIVERSAL,fe.Type.INTEGER,!1,Ua(t.dP)),fe.create(fe.Class.UNIVERSAL,fe.Type.INTEGER,!1,Ua(t.dQ)),fe.create(fe.Class.UNIVERSAL,fe.Type.INTEGER,!1,Ua(t.qInv))])};ft.publicKeyFromAsn1=function(t){var e={},r=[];if(fe.validate(t,z_e,e,r)){var i=fe.derToOid(e.publicKeyOid);if(i!==ft.oids.rsaEncryption){var n=new Error("Cannot read public key. Unknown OID.");throw n.oid=i,n}t=e.rsaPublicKey}if(r=[],!fe.validate(t,V_e,e,r)){var n=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw n.errors=r,n}var s=ut.util.createBuffer(e.publicKeyModulus).toHex(),o=ut.util.createBuffer(e.publicKeyExponent).toHex();return ft.setRsaPublicKey(new Nt(s,16),new Nt(o,16))};ft.publicKeyToAsn1=ft.publicKeyToSubjectPublicKeyInfo=function(t){return fe.create(fe.Class.UNIVERSAL,fe.Type.SEQUENCE,!0,[fe.create(fe.Class.UNIVERSAL,fe.Type.SEQUENCE,!0,[fe.create(fe.Class.UNIVERSAL,fe.Type.OID,!1,fe.oidToDer(ft.oids.rsaEncryption).getBytes()),fe.create(fe.Class.UNIVERSAL,fe.Type.NULL,!1,"")]),fe.create(fe.Class.UNIVERSAL,fe.Type.BITSTRING,!1,[ft.publicKeyToRSAPublicKey(t)])])};ft.publicKeyToRSAPublicKey=function(t){return fe.create(fe.Class.UNIVERSAL,fe.Type.SEQUENCE,!0,[fe.create(fe.Class.UNIVERSAL,fe.Type.INTEGER,!1,Ua(t.n)),fe.create(fe.Class.UNIVERSAL,fe.Type.INTEGER,!1,Ua(t.e))])};function rj(t,e,r){var i=ut.util.createBuffer(),n=Math.ceil(e.n.bitLength()/8);if(t.length>n-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=t.length,s.max=n-11,s}i.putByte(0),i.putByte(r);var o=n-3-t.length,a;if(r===0||r===1){a=r===0?0:255;for(var c=0;c<o;++c)i.putByte(a)}else for(;o>0;){for(var u=0,f=ut.random.getBytes(o),c=0;c<o;++c)a=f.charCodeAt(c),a===0?++u:i.putByte(a);o=u}return i.putByte(0),i.putBytes(t),i}function J6(t,e,r,i){var n=Math.ceil(e.n.bitLength()/8),s=ut.util.createBuffer(t),o=s.getByte(),a=s.getByte();if(o!==0||r&&a!==0&&a!==1||!r&&a!=2||r&&a===0&&typeof i=="undefined")throw new Error("Encryption block is invalid.");var c=0;if(a===0){c=n-3-i;for(var u=0;u<c;++u)if(s.getByte()!==0)throw new Error("Encryption block is invalid.")}else if(a===1)for(c=0;s.length()>1;){if(s.getByte()!==255){--s.read;break}++c}else if(a===2)for(c=0;s.length()>1;){if(s.getByte()===0){--s.read;break}++c}var f=s.getByte();if(f!==0||c!==n-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}function G_e(t,e,r){typeof e=="function"&&(r=e,e={}),e=e||{};var i={algorithm:{name:e.algorithm||"PRIMEINC",options:{workers:e.workers||2,workLoad:e.workLoad||100,workerScript:e.workerScript}}};"prng"in e&&(i.prng=e.prng),n();function n(){s(t.pBits,function(a,c){if(a)return r(a);if(t.p=c,t.q!==null)return o(a,t.q);s(t.qBits,o)})}function s(a,c){ut.prime.generateProbablePrime(a,i,c)}function o(a,c){if(a)return r(a);if(t.q=c,t.p.compareTo(t.q)<0){var u=t.p;t.p=t.q,t.q=u}if(t.p.subtract(Nt.ONE).gcd(t.e).compareTo(Nt.ONE)!==0){t.p=null,n();return}if(t.q.subtract(Nt.ONE).gcd(t.e).compareTo(Nt.ONE)!==0){t.q=null,s(t.qBits,o);return}if(t.p1=t.p.subtract(Nt.ONE),t.q1=t.q.subtract(Nt.ONE),t.phi=t.p1.multiply(t.q1),t.phi.gcd(t.e).compareTo(Nt.ONE)!==0){t.p=t.q=null,n();return}if(t.n=t.p.multiply(t.q),t.n.bitLength()!==t.bits){t.q=null,s(t.qBits,o);return}var f=t.e.modInverse(t.phi);t.keys={privateKey:ft.rsa.setPrivateKey(t.n,t.e,f,t.p,t.q,f.mod(t.p1),f.mod(t.q1),t.q.modInverse(t.p)),publicKey:ft.rsa.setPublicKey(t.n,t.e)},r(null,t.keys)}}function Ua(t){var e=t.toString(16);e[0]>="8"&&(e="00"+e);var r=ut.util.hexToBytes(e);return r.length>1&&(r.charCodeAt(0)===0&&(r.charCodeAt(1)&128)==0||r.charCodeAt(0)===255&&(r.charCodeAt(1)&128)==128)?r.substr(1):r}function $_e(t){return t<=100?27:t<=150?18:t<=200?15:t<=250?12:t<=300?9:t<=350?8:t<=400?7:t<=500?6:t<=600?5:t<=800?4:t<=1250?3:2}function ij(t){return ut.util.isNodejs&&typeof __[t]=="function"}function nj(t){return typeof Xs.globalScope!="undefined"&&typeof Xs.globalScope.crypto=="object"&&typeof Xs.globalScope.crypto.subtle=="object"&&typeof Xs.globalScope.crypto.subtle[t]=="function"}function sj(t){return typeof Xs.globalScope!="undefined"&&typeof Xs.globalScope.msCrypto=="object"&&typeof Xs.globalScope.msCrypto.subtle=="object"&&typeof Xs.globalScope.msCrypto.subtle[t]=="function"}function oj(t){for(var e=ut.util.hexToBytes(t.toString(16)),r=new Uint8Array(e.length),i=0;i<e.length;++i)r[i]=e.charCodeAt(i);return r}});var E_=m((Hst,dj)=>{l();var je=yt();_0();Qc();z6();df();b0();d_();W6();hf();Lq();my();nr();typeof cj=="undefined"&&(cj=je.jsbn.BigInteger);var cj,ye=je.asn1,ht=je.pki=je.pki||{};dj.exports=ht.pbe=je.pbe=je.pbe||{};var jl=ht.oids,W_e={name:"EncryptedPrivateKeyInfo",tagClass:ye.Class.UNIVERSAL,type:ye.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:ye.Class.UNIVERSAL,type:ye.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:ye.Class.UNIVERSAL,type:ye.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:ye.Class.UNIVERSAL,type:ye.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:ye.Class.UNIVERSAL,type:ye.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},Y_e={name:"PBES2Algorithms",tagClass:ye.Class.UNIVERSAL,type:ye.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:ye.Class.UNIVERSAL,type:ye.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:ye.Class.UNIVERSAL,type:ye.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:ye.Class.UNIVERSAL,type:ye.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:ye.Class.UNIVERSAL,type:ye.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:ye.Class.UNIVERSAL,type:ye.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:ye.Class.UNIVERSAL,type:ye.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:ye.Class.UNIVERSAL,type:ye.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:ye.Class.UNIVERSAL,type:ye.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:ye.Class.UNIVERSAL,type:ye.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:ye.Class.UNIVERSAL,type:ye.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:ye.Class.UNIVERSAL,type:ye.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},X_e={name:"pkcs-12PbeParams",tagClass:ye.Class.UNIVERSAL,type:ye.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:ye.Class.UNIVERSAL,type:ye.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:ye.Class.UNIVERSAL,type:ye.Type.INTEGER,constructed:!1,capture:"iterations"}]};ht.encryptPrivateKeyInfo=function(t,e,r){r=r||{},r.saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var i=je.random.getBytesSync(r.saltSize),n=r.count,s=ye.integerToDer(n),o,a,c;if(r.algorithm.indexOf("aes")===0||r.algorithm==="des"){var u,f,d;switch(r.algorithm){case"aes128":o=16,u=16,f=jl["aes128-CBC"],d=je.aes.createEncryptionCipher;break;case"aes192":o=24,u=16,f=jl["aes192-CBC"],d=je.aes.createEncryptionCipher;break;case"aes256":o=32,u=16,f=jl["aes256-CBC"],d=je.aes.createEncryptionCipher;break;case"des":o=8,u=8,f=jl.desCBC,d=je.des.createEncryptionCipher;break;default:var h=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw h.algorithm=r.algorithm,h}var p="hmacWith"+r.prfAlgorithm.toUpperCase(),y=lj(p),b=je.pkcs5.pbkdf2(e,i,n,o,y),E=je.random.getBytesSync(u),v=d(b);v.start(E),v.update(ye.toDer(t)),v.finish(),c=v.output.getBytes();var A=Q_e(i,s,o,p);a=ye.create(ye.Class.UNIVERSAL,ye.Type.SEQUENCE,!0,[ye.create(ye.Class.UNIVERSAL,ye.Type.OID,!1,ye.oidToDer(jl.pkcs5PBES2).getBytes()),ye.create(ye.Class.UNIVERSAL,ye.Type.SEQUENCE,!0,[ye.create(ye.Class.UNIVERSAL,ye.Type.SEQUENCE,!0,[ye.create(ye.Class.UNIVERSAL,ye.Type.OID,!1,ye.oidToDer(jl.pkcs5PBKDF2).getBytes()),A]),ye.create(ye.Class.UNIVERSAL,ye.Type.SEQUENCE,!0,[ye.create(ye.Class.UNIVERSAL,ye.Type.OID,!1,ye.oidToDer(f).getBytes()),ye.create(ye.Class.UNIVERSAL,ye.Type.OCTETSTRING,!1,E)])])])}else if(r.algorithm==="3des"){o=24;var R=new je.util.ByteBuffer(i),b=ht.pbe.generatePkcs12Key(e,R,1,n,o),E=ht.pbe.generatePkcs12Key(e,R,2,n,o),v=je.des.createEncryptionCipher(b);v.start(E),v.update(ye.toDer(t)),v.finish(),c=v.output.getBytes(),a=ye.create(ye.Class.UNIVERSAL,ye.Type.SEQUENCE,!0,[ye.create(ye.Class.UNIVERSAL,ye.Type.OID,!1,ye.oidToDer(jl["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),ye.create(ye.Class.UNIVERSAL,ye.Type.SEQUENCE,!0,[ye.create(ye.Class.UNIVERSAL,ye.Type.OCTETSTRING,!1,i),ye.create(ye.Class.UNIVERSAL,ye.Type.INTEGER,!1,s.getBytes())])])}else{var h=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw h.algorithm=r.algorithm,h}var F=ye.create(ye.Class.UNIVERSAL,ye.Type.SEQUENCE,!0,[a,ye.create(ye.Class.UNIVERSAL,ye.Type.OCTETSTRING,!1,c)]);return F};ht.decryptPrivateKeyInfo=function(t,e){var r=null,i={},n=[];if(!ye.validate(t,W_e,i,n)){var s=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=n,s}var o=ye.derToOid(i.encryptionOid),a=ht.pbe.getCipher(o,i.encryptionParams,e),c=je.util.createBuffer(i.encryptedData);return a.update(c),a.finish()&&(r=ye.fromDer(a.output)),r};ht.encryptedPrivateKeyToPem=function(t,e){var r={type:"ENCRYPTED PRIVATE KEY",body:ye.toDer(t).getBytes()};return je.pem.encode(r,{maxline:e})};ht.encryptedPrivateKeyFromPem=function(t){var e=je.pem.decode(t)[0];if(e.type!=="ENCRYPTED PRIVATE KEY"){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=e.type,r}if(e.procType&&e.procType.type==="ENCRYPTED")throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return ye.fromDer(e.body)};ht.encryptRsaPrivateKey=function(t,e,r){if(r=r||{},!r.legacy){var i=ht.wrapRsaPrivateKey(ht.privateKeyToAsn1(t));return i=ht.encryptPrivateKeyInfo(i,e,r),ht.encryptedPrivateKeyToPem(i)}var n,s,o,a;switch(r.algorithm){case"aes128":n="AES-128-CBC",o=16,s=je.random.getBytesSync(16),a=je.aes.createEncryptionCipher;break;case"aes192":n="AES-192-CBC",o=24,s=je.random.getBytesSync(16),a=je.aes.createEncryptionCipher;break;case"aes256":n="AES-256-CBC",o=32,s=je.random.getBytesSync(16),a=je.aes.createEncryptionCipher;break;case"3des":n="DES-EDE3-CBC",o=24,s=je.random.getBytesSync(8),a=je.des.createEncryptionCipher;break;case"des":n="DES-CBC",o=8,s=je.random.getBytesSync(8),a=je.des.createEncryptionCipher;break;default:var c=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw c.algorithm=r.algorithm,c}var u=je.pbe.opensslDeriveBytes(e,s.substr(0,8),o),f=a(u);f.start(s),f.update(ye.toDer(ht.privateKeyToAsn1(t))),f.finish();var d={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:n,parameters:je.util.bytesToHex(s).toUpperCase()},body:f.output.getBytes()};return je.pem.encode(d)};ht.decryptRsaPrivateKey=function(t,e){var r=null,i=je.pem.decode(t)[0];if(i.type!=="ENCRYPTED PRIVATE KEY"&&i.type!=="PRIVATE KEY"&&i.type!=="RSA PRIVATE KEY"){var n=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw n.headerType=n,n}if(i.procType&&i.procType.type==="ENCRYPTED"){var s,o;switch(i.dekInfo.algorithm){case"DES-CBC":s=8,o=je.des.createDecryptionCipher;break;case"DES-EDE3-CBC":s=24,o=je.des.createDecryptionCipher;break;case"AES-128-CBC":s=16,o=je.aes.createDecryptionCipher;break;case"AES-192-CBC":s=24,o=je.aes.createDecryptionCipher;break;case"AES-256-CBC":s=32,o=je.aes.createDecryptionCipher;break;case"RC2-40-CBC":s=5,o=function(d){return je.rc2.createDecryptionCipher(d,40)};break;case"RC2-64-CBC":s=8,o=function(d){return je.rc2.createDecryptionCipher(d,64)};break;case"RC2-128-CBC":s=16,o=function(d){return je.rc2.createDecryptionCipher(d,128)};break;default:var n=new Error('Could not decrypt private key; unsupported encryption algorithm "'+i.dekInfo.algorithm+'".');throw n.algorithm=i.dekInfo.algorithm,n}var a=je.util.hexToBytes(i.dekInfo.parameters),c=je.pbe.opensslDeriveBytes(e,a.substr(0,8),s),u=o(c);if(u.start(a),u.update(je.util.createBuffer(i.body)),u.finish())r=u.output.getBytes();else return r}else r=i.body;return i.type==="ENCRYPTED PRIVATE KEY"?r=ht.decryptPrivateKeyInfo(ye.fromDer(r),e):r=ye.fromDer(r),r!==null&&(r=ht.privateKeyFromAsn1(r)),r};ht.pbe.generatePkcs12Key=function(t,e,r,i,n,s){var o,a;if(typeof s=="undefined"||s===null){if(!("sha1"in je.md))throw new Error('"sha1" hash algorithm unavailable.');s=je.md.sha1.create()}var c=s.digestLength,u=s.blockLength,f=new je.util.ByteBuffer,d=new je.util.ByteBuffer;if(t!=null){for(a=0;a<t.length;a++)d.putInt16(t.charCodeAt(a));d.putInt16(0)}var h=d.length(),p=e.length(),y=new je.util.ByteBuffer;y.fillWithByte(r,u);var b=u*Math.ceil(p/u),E=new je.util.ByteBuffer;for(a=0;a<b;a++)E.putByte(e.at(a%p));var v=u*Math.ceil(h/u),A=new je.util.ByteBuffer;for(a=0;a<v;a++)A.putByte(d.at(a%h));var R=E;R.putBuffer(A);for(var F=Math.ceil(n/c),D=1;D<=F;D++){var B=new je.util.ByteBuffer;B.putBytes(y.bytes()),B.putBytes(R.bytes());for(var H=0;H<i;H++)s.start(),s.update(B.getBytes()),B=s.digest();var W=new je.util.ByteBuffer;for(a=0;a<u;a++)W.putByte(B.at(a%c));var X=Math.ceil(p/u)+Math.ceil(h/u),P=new je.util.ByteBuffer;for(o=0;o<X;o++){var g=new je.util.ByteBuffer(R.getBytes(u)),w=511;for(a=W.length()-1;a>=0;a--)w=w>>8,w+=W.at(a)+g.at(a),g.setAt(a,w&255);P.putBuffer(g)}R=P,f.putBuffer(B)}return f.truncate(f.length()-n),f};ht.pbe.getCipher=function(t,e,r){switch(t){case ht.oids.pkcs5PBES2:return ht.pbe.getCipherForPBES2(t,e,r);case ht.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case ht.oids["pbewithSHAAnd40BitRC2-CBC"]:return ht.pbe.getCipherForPKCS12PBE(t,e,r);default:var i=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw i.oid=t,i.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],i}};ht.pbe.getCipherForPBES2=function(t,e,r){var i={},n=[];if(!ye.validate(e,Y_e,i,n)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=n,s}if(t=ye.derToOid(i.kdfOid),t!==ht.oids.pkcs5PBKDF2){var s=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw s.oid=t,s.supportedOids=["pkcs5PBKDF2"],s}if(t=ye.derToOid(i.encOid),t!==ht.oids["aes128-CBC"]&&t!==ht.oids["aes192-CBC"]&&t!==ht.oids["aes256-CBC"]&&t!==ht.oids["des-EDE3-CBC"]&&t!==ht.oids.desCBC){var s=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw s.oid=t,s.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],s}var o=i.kdfSalt,a=je.util.createBuffer(i.kdfIterationCount);a=a.getInt(a.length()<<3);var c,u;switch(ht.oids[t]){case"aes128-CBC":c=16,u=je.aes.createDecryptionCipher;break;case"aes192-CBC":c=24,u=je.aes.createDecryptionCipher;break;case"aes256-CBC":c=32,u=je.aes.createDecryptionCipher;break;case"des-EDE3-CBC":c=24,u=je.des.createDecryptionCipher;break;case"desCBC":c=8,u=je.des.createDecryptionCipher;break}var f=fj(i.prfOid),d=je.pkcs5.pbkdf2(r,o,a,c,f),h=i.encIv,p=u(d);return p.start(h),p};ht.pbe.getCipherForPKCS12PBE=function(t,e,r){var i={},n=[];if(!ye.validate(e,X_e,i,n)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=n,s}var o=je.util.createBuffer(i.salt),a=je.util.createBuffer(i.iterations);a=a.getInt(a.length()<<3);var c,u,f;switch(t){case ht.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:c=24,u=8,f=je.des.startDecrypting;break;case ht.oids["pbewithSHAAnd40BitRC2-CBC"]:c=5,u=8,f=function(b,E){var v=je.rc2.createDecryptionCipher(b,40);return v.start(E,null),v};break;default:var s=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw s.oid=t,s}var d=fj(i.prfOid),h=ht.pbe.generatePkcs12Key(r,o,1,a,c,d);d.start();var p=ht.pbe.generatePkcs12Key(r,o,2,a,u,d);return f(h,p)};ht.pbe.opensslDeriveBytes=function(t,e,r,i){if(typeof i=="undefined"||i===null){if(!("md5"in je.md))throw new Error('"md5" hash algorithm unavailable.');i=je.md.md5.create()}e===null&&(e="");for(var n=[uj(i,t+e)],s=16,o=1;s<r;++o,s+=16)n.push(uj(i,n[o-1]+t+e));return n.join("").substr(0,r)};function uj(t,e){return t.start().update(e).digest().getBytes()}function fj(t){var e;if(!t)e="hmacWithSHA1";else if(e=ht.oids[ye.derToOid(t)],!e){var r=new Error("Unsupported PRF OID.");throw r.oid=t,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}return lj(e)}function lj(t){var e=je.md;switch(t){case"hmacWithSHA224":e=je.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":t=t.substr(8).toLowerCase();break;default:var r=new Error("Unsupported PRF algorithm.");throw r.algorithm=t,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}if(!e||!(t in e))throw new Error("Unknown hash algorithm: "+t);return e[t].create()}function Q_e(t,e,r,i){var n=ye.create(ye.Class.UNIVERSAL,ye.Type.SEQUENCE,!0,[ye.create(ye.Class.UNIVERSAL,ye.Type.OCTETSTRING,!1,t),ye.create(ye.Class.UNIVERSAL,ye.Type.INTEGER,!1,e.getBytes())]);return i!=="hmacWithSHA1"&&n.value.push(ye.create(ye.Class.UNIVERSAL,ye.Type.INTEGER,!1,je.util.hexToBytes(r.toString(16))),ye.create(ye.Class.UNIVERSAL,ye.Type.SEQUENCE,!0,[ye.create(ye.Class.UNIVERSAL,ye.Type.OID,!1,ye.oidToDer(ht.oids[i]).getBytes()),ye.create(ye.Class.UNIVERSAL,ye.Type.NULL,!1,"")])),n}});var zo=m((Gst,pj)=>{l();"use strict";function hj(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function Z_e(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return hj(t,r)}catch(i){r.message=t.message,r.stack=t.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(t)),hj(new n,r)}}pj.exports=Z_e});var by=m(yj=>{l();"use strict";yj.get=(t=self)=>{let e=t.crypto||t.msCrypto;if(!e||!e.subtle)throw Object.assign(new Error("Missing Web Crypto API. The most likely cause of this error is that this page is being accessed from an insecure context (i.e. not HTTPS). For more information and possible resolutions see https://github.com/libp2p/js-libp2p-crypto/blob/master/README.md#web-crypto-api"),{code:"ERR_MISSING_WEB_CRYPTO"});return e}});var S_=m((Wst,mj)=>{l();"use strict";var{concat:J_e}=(mn(),$s),{fromString:gj}=(dt(),bi),eEe=by();function tEe({algorithm:t="AES-GCM",nonceLength:e=12,keyLength:r=16,digest:i="SHA-256",saltLength:n=16,iterations:s=32767}={}){let o=eEe.get();r*=8;async function a(u,f){let d=o.getRandomValues(new Uint8Array(n)),h=o.getRandomValues(new Uint8Array(e)),p={name:t,iv:h},y={name:"PBKDF2",salt:d,iterations:s,hash:{name:i}},b=await o.subtle.importKey("raw",gj(f),{name:"PBKDF2"},!1,["deriveKey","deriveBits"]),E=await o.subtle.deriveKey(y,b,{name:t,length:r},!0,["encrypt"]),v=await o.subtle.encrypt(p,E,u);return J_e([d,p.iv,new Uint8Array(v)])}async function c(u,f){let d=u.slice(0,n),h=u.slice(n,n+e),p=u.slice(n+e),y={name:t,iv:h},b={name:"PBKDF2",salt:d,iterations:s,hash:{name:i}},E=await o.subtle.importKey("raw",gj(f),{name:"PBKDF2"},!1,["deriveKey","deriveBits"]),v=await o.subtle.deriveKey(b,E,{name:t,length:r},!0,["decrypt"]),A=await o.subtle.decrypt(y,v,p);return new Uint8Array(A)}return{encrypt:a,decrypt:c}}mj.exports={create:tEe}});var vj=m((Yst,bj)=>{l();"use strict";var{base64:rEe}=($2(),e0),iEe=S_();bj.exports={import:async function(t,e){let r=rEe.decode(t);return await iEe.create().decrypt(r,e)}}});var e4=m((Xst,Sj)=>{l();var Ar=yt();df();nr();var vy=Sj.exports=Ar.sha512=Ar.sha512||{};Ar.md.sha512=Ar.md.algorithms.sha512=vy;var wj=Ar.sha384=Ar.sha512.sha384=Ar.sha512.sha384||{};wj.create=function(){return vy.create("SHA-384")};Ar.md.sha384=Ar.md.algorithms.sha384=wj;Ar.sha512.sha256=Ar.sha512.sha256||{create:function(){return vy.create("SHA-512/256")}};Ar.md["sha512/256"]=Ar.md.algorithms["sha512/256"]=Ar.sha512.sha256;Ar.sha512.sha224=Ar.sha512.sha224||{create:function(){return vy.create("SHA-512/224")}};Ar.md["sha512/224"]=Ar.md.algorithms["sha512/224"]=Ar.sha512.sha224;vy.create=function(t){if(_j||nEe(),typeof t=="undefined"&&(t="SHA-512"),!(t in Ul))throw new Error("Invalid SHA-512 algorithm: "+t);for(var e=Ul[t],r=null,i=Ar.util.createBuffer(),n=new Array(80),s=0;s<80;++s)n[s]=new Array(2);var o=64;switch(t){case"SHA-384":o=48;break;case"SHA-512/256":o=32;break;case"SHA-512/224":o=28;break}var a={algorithm:t.replace("-","").toLowerCase(),blockLength:128,digestLength:o,messageLength:0,fullMessageLength:null,messageLengthSize:16};return a.start=function(){a.messageLength=0,a.fullMessageLength=a.messageLength128=[];for(var c=a.messageLengthSize/4,u=0;u<c;++u)a.fullMessageLength.push(0);i=Ar.util.createBuffer(),r=new Array(e.length);for(var u=0;u<e.length;++u)r[u]=e[u].slice(0);return a},a.start(),a.update=function(c,u){u==="utf8"&&(c=Ar.util.encodeUtf8(c));var f=c.length;a.messageLength+=f,f=[f/4294967296>>>0,f>>>0];for(var d=a.fullMessageLength.length-1;d>=0;--d)a.fullMessageLength[d]+=f[1],f[1]=f[0]+(a.fullMessageLength[d]/4294967296>>>0),a.fullMessageLength[d]=a.fullMessageLength[d]>>>0,f[0]=f[1]/4294967296>>>0;return i.putBytes(c),Ej(r,n,i),(i.read>2048||i.length()===0)&&i.compact(),a},a.digest=function(){var c=Ar.util.createBuffer();c.putBytes(i.bytes());var u=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize,f=u&a.blockLength-1;c.putBytes(x_.substr(0,a.blockLength-f));for(var d,h,p=a.fullMessageLength[0]*8,y=0;y<a.fullMessageLength.length-1;++y)d=a.fullMessageLength[y+1]*8,h=d/4294967296>>>0,p+=h,c.putInt32(p>>>0),p=d>>>0;c.putInt32(p);for(var b=new Array(r.length),y=0;y<r.length;++y)b[y]=r[y].slice(0);Ej(b,n,c);var E=Ar.util.createBuffer(),v;t==="SHA-512"?v=b.length:t==="SHA-384"?v=b.length-2:v=b.length-4;for(var y=0;y<v;++y)E.putInt32(b[y][0]),(y!==v-1||t!=="SHA-512/224")&&E.putInt32(b[y][1]);return E},a};var x_=null,_j=!1,A_=null,Ul=null;function nEe(){x_=String.fromCharCode(128),x_+=Ar.util.fillString(String.fromCharCode(0),128),A_=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],Ul={},Ul["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],Ul["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],Ul["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],Ul["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],_j=!0}function Ej(t,e,r){for(var i,n,s,o,a,c,u,f,d,h,p,y,b,E,v,A,R,F,D,B,H,W,X,P,g,w,S,C,L,Y,V,q,_,j,de,Q=r.length();Q>=128;){for(L=0;L<16;++L)e[L][0]=r.getInt32()>>>0,e[L][1]=r.getInt32()>>>0;for(;L<80;++L)q=e[L-2],Y=q[0],V=q[1],i=((Y>>>19|V<<13)^(V>>>29|Y<<3)^Y>>>6)>>>0,n=((Y<<13|V>>>19)^(V<<3|Y>>>29)^(Y<<26|V>>>6))>>>0,j=e[L-15],Y=j[0],V=j[1],s=((Y>>>1|V<<31)^(Y>>>8|V<<24)^Y>>>7)>>>0,o=((Y<<31|V>>>1)^(Y<<24|V>>>8)^(Y<<25|V>>>7))>>>0,_=e[L-7],de=e[L-16],V=n+_[1]+o+de[1],e[L][0]=i+_[0]+s+de[0]+(V/4294967296>>>0)>>>0,e[L][1]=V>>>0;for(b=t[0][0],E=t[0][1],v=t[1][0],A=t[1][1],R=t[2][0],F=t[2][1],D=t[3][0],B=t[3][1],H=t[4][0],W=t[4][1],X=t[5][0],P=t[5][1],g=t[6][0],w=t[6][1],S=t[7][0],C=t[7][1],L=0;L<80;++L)u=((H>>>14|W<<18)^(H>>>18|W<<14)^(W>>>9|H<<23))>>>0,f=((H<<18|W>>>14)^(H<<14|W>>>18)^(W<<23|H>>>9))>>>0,d=(g^H&(X^g))>>>0,h=(w^W&(P^w))>>>0,a=((b>>>28|E<<4)^(E>>>2|b<<30)^(E>>>7|b<<25))>>>0,c=((b<<4|E>>>28)^(E<<30|b>>>2)^(E<<25|b>>>7))>>>0,p=(b&v|R&(b^v))>>>0,y=(E&A|F&(E^A))>>>0,V=C+f+h+A_[L][1]+e[L][1],i=S+u+d+A_[L][0]+e[L][0]+(V/4294967296>>>0)>>>0,n=V>>>0,V=c+y,s=a+p+(V/4294967296>>>0)>>>0,o=V>>>0,S=g,C=w,g=X,w=P,X=H,P=W,V=B+n,H=D+i+(V/4294967296>>>0)>>>0,W=V>>>0,D=R,B=F,R=v,F=A,v=b,A=E,V=n+o,b=i+s+(V/4294967296>>>0)>>>0,E=V>>>0;V=t[0][1]+E,t[0][0]=t[0][0]+b+(V/4294967296>>>0)>>>0,t[0][1]=V>>>0,V=t[1][1]+A,t[1][0]=t[1][0]+v+(V/4294967296>>>0)>>>0,t[1][1]=V>>>0,V=t[2][1]+F,t[2][0]=t[2][0]+R+(V/4294967296>>>0)>>>0,t[2][1]=V>>>0,V=t[3][1]+B,t[3][0]=t[3][0]+D+(V/4294967296>>>0)>>>0,t[3][1]=V>>>0,V=t[4][1]+W,t[4][0]=t[4][0]+H+(V/4294967296>>>0)>>>0,t[4][1]=V>>>0,V=t[5][1]+P,t[5][0]=t[5][0]+X+(V/4294967296>>>0)>>>0,t[5][1]=V>>>0,V=t[6][1]+w,t[6][0]=t[6][0]+g+(V/4294967296>>>0)>>>0,t[6][1]=V>>>0,V=t[7][1]+C,t[7][0]=t[7][0]+S+(V/4294967296>>>0)>>>0,t[7][1]=V>>>0,Q-=128}}});var xj=m(I_=>{l();var sEe=yt();Qc();var Yi=sEe.asn1;I_.privateKeyValidator={name:"PrivateKeyInfo",tagClass:Yi.Class.UNIVERSAL,type:Yi.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:Yi.Class.UNIVERSAL,type:Yi.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:Yi.Class.UNIVERSAL,type:Yi.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Yi.Class.UNIVERSAL,type:Yi.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:Yi.Class.UNIVERSAL,type:Yi.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]};I_.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:Yi.Class.UNIVERSAL,type:Yi.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:Yi.Class.UNIVERSAL,type:Yi.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Yi.Class.UNIVERSAL,type:Yi.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:Yi.Class.UNIVERSAL,type:Yi.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]}});var N_=m((Zst,Mj)=>{l();var sn=yt();gy();hf();e4();nr();var Aj=xj(),oEe=Aj.publicKeyValidator,aEe=Aj.privateKeyValidator;typeof Ij=="undefined"&&(Ij=sn.jsbn.BigInteger);var Ij,T_=sn.util.ByteBuffer,es=typeof Buffer=="undefined"?Uint8Array:Buffer;sn.pki=sn.pki||{};Mj.exports=sn.pki.ed25519=sn.ed25519=sn.ed25519||{};var St=sn.ed25519;St.constants={};St.constants.PUBLIC_KEY_BYTE_LENGTH=32;St.constants.PRIVATE_KEY_BYTE_LENGTH=64;St.constants.SEED_BYTE_LENGTH=32;St.constants.SIGN_BYTE_LENGTH=64;St.constants.HASH_BYTE_LENGTH=64;St.generateKeyPair=function(t){t=t||{};var e=t.seed;if(e===void 0)e=sn.random.getBytesSync(St.constants.SEED_BYTE_LENGTH);else if(typeof e=="string"){if(e.length!==St.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+St.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(e instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');e=tu({message:e,encoding:"binary"});for(var r=new es(St.constants.PUBLIC_KEY_BYTE_LENGTH),i=new es(St.constants.PRIVATE_KEY_BYTE_LENGTH),n=0;n<32;++n)i[n]=e[n];return lEe(r,i),{publicKey:r,privateKey:i}};St.privateKeyFromAsn1=function(t){var e={},r=[],i=sn.asn1.validate(t,aEe,e,r);if(!i){var n=new Error("Invalid Key.");throw n.errors=r,n}var s=sn.asn1.derToOid(e.privateKeyOid),o=sn.oids.EdDSA25519;if(s!==o)throw new Error('Invalid OID "'+s+'"; OID must be "'+o+'".');var a=e.privateKey,c=tu({message:sn.asn1.fromDer(a).value,encoding:"binary"});return{privateKeyBytes:c}};St.publicKeyFromAsn1=function(t){var e={},r=[],i=sn.asn1.validate(t,oEe,e,r);if(!i){var n=new Error("Invalid Key.");throw n.errors=r,n}var s=sn.asn1.derToOid(e.publicKeyOid),o=sn.oids.EdDSA25519;if(s!==o)throw new Error('Invalid OID "'+s+'"; OID must be "'+o+'".');var a=e.ed25519PublicKey;if(a.length!==St.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return tu({message:a,encoding:"binary"})};St.publicKeyFromPrivateKey=function(t){t=t||{};var e=tu({message:t.privateKey,encoding:"binary"});if(e.length!==St.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+St.constants.PRIVATE_KEY_BYTE_LENGTH);for(var r=new es(St.constants.PUBLIC_KEY_BYTE_LENGTH),i=0;i<r.length;++i)r[i]=e[32+i];return r};St.sign=function(t){t=t||{};var e=tu(t),r=tu({message:t.privateKey,encoding:"binary"});if(r.length===St.constants.SEED_BYTE_LENGTH){var i=St.generateKeyPair({seed:r});r=i.privateKey}else if(r.length!==St.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+St.constants.SEED_BYTE_LENGTH+" or "+St.constants.PRIVATE_KEY_BYTE_LENGTH);var n=new es(St.constants.SIGN_BYTE_LENGTH+e.length);dEe(n,e,e.length,r);for(var s=new es(St.constants.SIGN_BYTE_LENGTH),o=0;o<s.length;++o)s[o]=n[o];return s};St.verify=function(t){t=t||{};var e=tu(t);if(t.signature===void 0)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var r=tu({message:t.signature,encoding:"binary"});if(r.length!==St.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+St.constants.SIGN_BYTE_LENGTH);var i=tu({message:t.publicKey,encoding:"binary"});if(i.length!==St.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+St.constants.PUBLIC_KEY_BYTE_LENGTH);var n=new es(St.constants.SIGN_BYTE_LENGTH+e.length),s=new es(St.constants.SIGN_BYTE_LENGTH+e.length),o;for(o=0;o<St.constants.SIGN_BYTE_LENGTH;++o)n[o]=r[o];for(o=0;o<e.length;++o)n[o+St.constants.SIGN_BYTE_LENGTH]=e[o];return hEe(s,n,n.length,i)>=0};function tu(t){var e=t.message;if(e instanceof Uint8Array||e instanceof es)return e;var r=t.encoding;if(e===void 0)if(t.md)e=t.md.digest().getBytes(),r="binary";else throw new TypeError('"options.message" or "options.md" not specified.');if(typeof e=="string"&&!r)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if(typeof e=="string"){if(typeof Buffer!="undefined")return Buffer.from(e,r);e=new T_(e,r)}else if(!(e instanceof T_))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var i=new es(e.length()),n=0;n<i.length;++n)i[n]=e.at(n);return i}var R_=Je(),t4=Je([1]),cEe=Je([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),uEe=Je([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),Tj=Je([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),Rj=Je([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),P_=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),fEe=Je([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function wy(t,e){var r=sn.md.sha512.create(),i=new T_(t);r.update(i.getBytes(e),"binary");var n=r.digest().getBytes();if(typeof Buffer!="undefined")return Buffer.from(n,"binary");for(var s=new es(St.constants.HASH_BYTE_LENGTH),o=0;o<64;++o)s[o]=n.charCodeAt(o);return s}function lEe(t,e){var r=[Je(),Je(),Je(),Je()],i,n=wy(e,32);for(n[0]&=248,n[31]&=127,n[31]|=64,D_(r,n),k_(t,r),i=0;i<32;++i)e[i+32]=t[i];return 0}function dEe(t,e,r,i){var n,s,o=new Float64Array(64),a=[Je(),Je(),Je(),Je()],c=wy(i,32);c[0]&=248,c[31]&=127,c[31]|=64;var u=r+64;for(n=0;n<r;++n)t[64+n]=e[n];for(n=0;n<32;++n)t[32+n]=c[32+n];var f=wy(t.subarray(32),r+32);for(C_(f),D_(a,f),k_(t,a),n=32;n<64;++n)t[n]=i[n];var d=wy(t,r+64);for(C_(d),n=32;n<64;++n)o[n]=0;for(n=0;n<32;++n)o[n]=f[n];for(n=0;n<32;++n)for(s=0;s<32;s++)o[n+s]+=d[n]*c[s];return Pj(t.subarray(32),o),u}function hEe(t,e,r,i){var n,s,o=new es(32),a=[Je(),Je(),Je(),Je()],c=[Je(),Je(),Je(),Je()];if(s=-1,r<64||pEe(c,i))return-1;for(n=0;n<r;++n)t[n]=e[n];for(n=0;n<32;++n)t[n+32]=i[n];var u=wy(t,r);if(C_(u),Bj(a,c,u),D_(c,e.subarray(32)),O_(a,c),k_(o,a),r-=64,kj(e,0,o,0)){for(n=0;n<r;++n)t[n]=0;return-1}for(n=0;n<r;++n)t[n]=e[n+64];return s=r,s}function Pj(t,e){var r,i,n,s;for(i=63;i>=32;--i){for(r=0,n=i-32,s=i-12;n<s;++n)e[n]+=r-16*e[i]*P_[n-(i-32)],r=e[n]+128>>8,e[n]-=r*256;e[n]+=r,e[i]=0}for(r=0,n=0;n<32;++n)e[n]+=r-(e[31]>>4)*P_[n],r=e[n]>>8,e[n]&=255;for(n=0;n<32;++n)e[n]-=r*P_[n];for(i=0;i<32;++i)e[i+1]+=e[i]>>8,t[i]=e[i]&255}function C_(t){for(var e=new Float64Array(64),r=0;r<64;++r)e[r]=t[r],t[r]=0;Pj(t,e)}function O_(t,e){var r=Je(),i=Je(),n=Je(),s=Je(),o=Je(),a=Je(),c=Je(),u=Je(),f=Je();I0(r,t[1],t[0]),I0(f,e[1],e[0]),sr(r,r,f),A0(i,t[0],t[1]),A0(f,e[0],e[1]),sr(i,i,f),sr(n,t[3],e[3]),sr(n,n,uEe),sr(s,t[2],e[2]),A0(s,s,s),I0(o,i,r),I0(a,s,n),A0(c,s,n),A0(u,i,r),sr(t[0],o,a),sr(t[1],u,c),sr(t[2],c,a),sr(t[3],o,u)}function Cj(t,e,r){for(var i=0;i<4;++i)Nj(t[i],e[i],r)}function k_(t,e){var r=Je(),i=Je(),n=Je();bEe(n,e[2]),sr(r,e[0],n),sr(i,e[1],n),r4(t,i),t[31]^=Dj(r)<<7}function r4(t,e){var r,i,n,s=Je(),o=Je();for(r=0;r<16;++r)o[r]=e[r];for(B_(o),B_(o),B_(o),i=0;i<2;++i){for(s[0]=o[0]-65517,r=1;r<15;++r)s[r]=o[r]-65535-(s[r-1]>>16&1),s[r-1]&=65535;s[15]=o[15]-32767-(s[14]>>16&1),n=s[15]>>16&1,s[14]&=65535,Nj(o,s,1-n)}for(r=0;r<16;r++)t[2*r]=o[r]&255,t[2*r+1]=o[r]>>8}function pEe(t,e){var r=Je(),i=Je(),n=Je(),s=Je(),o=Je(),a=Je(),c=Je();return gf(t[2],t4),yEe(t[1],e),Fl(n,t[1]),sr(s,n,cEe),I0(n,n,t[2]),A0(s,t[2],s),Fl(o,s),Fl(a,o),sr(c,a,o),sr(r,c,n),sr(r,r,s),gEe(r,r),sr(r,r,n),sr(r,r,s),sr(r,r,s),sr(t[0],r,s),Fl(i,t[0]),sr(i,i,s),Oj(i,n)&&sr(t[0],t[0],fEe),Fl(i,t[0]),sr(i,i,s),Oj(i,n)?-1:(Dj(t[0])===e[31]>>7&&I0(t[0],R_,t[0]),sr(t[3],t[0],t[1]),0)}function yEe(t,e){var r;for(r=0;r<16;++r)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function gEe(t,e){var r=Je(),i;for(i=0;i<16;++i)r[i]=e[i];for(i=250;i>=0;--i)Fl(r,r),i!==1&&sr(r,r,e);for(i=0;i<16;++i)t[i]=r[i]}function Oj(t,e){var r=new es(32),i=new es(32);return r4(r,t),r4(i,e),kj(r,0,i,0)}function kj(t,e,r,i){return mEe(t,e,r,i,32)}function mEe(t,e,r,i,n){var s,o=0;for(s=0;s<n;++s)o|=t[e+s]^r[i+s];return(1&o-1>>>8)-1}function Dj(t){var e=new es(32);return r4(e,t),e[0]&1}function Bj(t,e,r){var i,n;for(gf(t[0],R_),gf(t[1],t4),gf(t[2],t4),gf(t[3],R_),n=255;n>=0;--n)i=r[n/8|0]>>(n&7)&1,Cj(t,e,i),O_(e,t),O_(t,t),Cj(t,e,i)}function D_(t,e){var r=[Je(),Je(),Je(),Je()];gf(r[0],Tj),gf(r[1],Rj),gf(r[2],t4),sr(r[3],Tj,Rj),Bj(t,r,e)}function gf(t,e){var r;for(r=0;r<16;r++)t[r]=e[r]|0}function bEe(t,e){var r=Je(),i;for(i=0;i<16;++i)r[i]=e[i];for(i=253;i>=0;--i)Fl(r,r),i!==2&&i!==4&&sr(r,r,e);for(i=0;i<16;++i)t[i]=r[i]}function B_(t){var e,r,i=1;for(e=0;e<16;++e)r=t[e]+i+65535,i=Math.floor(r/65536),t[e]=r-i*65536;t[0]+=i-1+37*(i-1)}function Nj(t,e,r){for(var i,n=~(r-1),s=0;s<16;++s)i=n&(t[s]^e[s]),t[s]^=i,e[s]^=i}function Je(t){var e,r=new Float64Array(16);if(t)for(e=0;e<t.length;++e)r[e]=t[e];return r}function A0(t,e,r){for(var i=0;i<16;++i)t[i]=e[i]+r[i]}function I0(t,e,r){for(var i=0;i<16;++i)t[i]=e[i]-r[i]}function Fl(t,e){sr(t,e,e)}function sr(t,e,r){var i,n,s=0,o=0,a=0,c=0,u=0,f=0,d=0,h=0,p=0,y=0,b=0,E=0,v=0,A=0,R=0,F=0,D=0,B=0,H=0,W=0,X=0,P=0,g=0,w=0,S=0,C=0,L=0,Y=0,V=0,q=0,_=0,j=r[0],de=r[1],Q=r[2],ue=r[3],le=r[4],me=r[5],be=r[6],xe=r[7],k=r[8],K=r[9],$=r[10],ee=r[11],I=r[12],U=r[13],z=r[14],N=r[15];i=e[0],s+=i*j,o+=i*de,a+=i*Q,c+=i*ue,u+=i*le,f+=i*me,d+=i*be,h+=i*xe,p+=i*k,y+=i*K,b+=i*$,E+=i*ee,v+=i*I,A+=i*U,R+=i*z,F+=i*N,i=e[1],o+=i*j,a+=i*de,c+=i*Q,u+=i*ue,f+=i*le,d+=i*me,h+=i*be,p+=i*xe,y+=i*k,b+=i*K,E+=i*$,v+=i*ee,A+=i*I,R+=i*U,F+=i*z,D+=i*N,i=e[2],a+=i*j,c+=i*de,u+=i*Q,f+=i*ue,d+=i*le,h+=i*me,p+=i*be,y+=i*xe,b+=i*k,E+=i*K,v+=i*$,A+=i*ee,R+=i*I,F+=i*U,D+=i*z,B+=i*N,i=e[3],c+=i*j,u+=i*de,f+=i*Q,d+=i*ue,h+=i*le,p+=i*me,y+=i*be,b+=i*xe,E+=i*k,v+=i*K,A+=i*$,R+=i*ee,F+=i*I,D+=i*U,B+=i*z,H+=i*N,i=e[4],u+=i*j,f+=i*de,d+=i*Q,h+=i*ue,p+=i*le,y+=i*me,b+=i*be,E+=i*xe,v+=i*k,A+=i*K,R+=i*$,F+=i*ee,D+=i*I,B+=i*U,H+=i*z,W+=i*N,i=e[5],f+=i*j,d+=i*de,h+=i*Q,p+=i*ue,y+=i*le,b+=i*me,E+=i*be,v+=i*xe,A+=i*k,R+=i*K,F+=i*$,D+=i*ee,B+=i*I,H+=i*U,W+=i*z,X+=i*N,i=e[6],d+=i*j,h+=i*de,p+=i*Q,y+=i*ue,b+=i*le,E+=i*me,v+=i*be,A+=i*xe,R+=i*k,F+=i*K,D+=i*$,B+=i*ee,H+=i*I,W+=i*U,X+=i*z,P+=i*N,i=e[7],h+=i*j,p+=i*de,y+=i*Q,b+=i*ue,E+=i*le,v+=i*me,A+=i*be,R+=i*xe,F+=i*k,D+=i*K,B+=i*$,H+=i*ee,W+=i*I,X+=i*U,P+=i*z,g+=i*N,i=e[8],p+=i*j,y+=i*de,b+=i*Q,E+=i*ue,v+=i*le,A+=i*me,R+=i*be,F+=i*xe,D+=i*k,B+=i*K,H+=i*$,W+=i*ee,X+=i*I,P+=i*U,g+=i*z,w+=i*N,i=e[9],y+=i*j,b+=i*de,E+=i*Q,v+=i*ue,A+=i*le,R+=i*me,F+=i*be,D+=i*xe,B+=i*k,H+=i*K,W+=i*$,X+=i*ee,P+=i*I,g+=i*U,w+=i*z,S+=i*N,i=e[10],b+=i*j,E+=i*de,v+=i*Q,A+=i*ue,R+=i*le,F+=i*me,D+=i*be,B+=i*xe,H+=i*k,W+=i*K,X+=i*$,P+=i*ee,g+=i*I,w+=i*U,S+=i*z,C+=i*N,i=e[11],E+=i*j,v+=i*de,A+=i*Q,R+=i*ue,F+=i*le,D+=i*me,B+=i*be,H+=i*xe,W+=i*k,X+=i*K,P+=i*$,g+=i*ee,w+=i*I,S+=i*U,C+=i*z,L+=i*N,i=e[12],v+=i*j,A+=i*de,R+=i*Q,F+=i*ue,D+=i*le,B+=i*me,H+=i*be,W+=i*xe,X+=i*k,P+=i*K,g+=i*$,w+=i*ee,S+=i*I,C+=i*U,L+=i*z,Y+=i*N,i=e[13],A+=i*j,R+=i*de,F+=i*Q,D+=i*ue,B+=i*le,H+=i*me,W+=i*be,X+=i*xe,P+=i*k,g+=i*K,w+=i*$,S+=i*ee,C+=i*I,L+=i*U,Y+=i*z,V+=i*N,i=e[14],R+=i*j,F+=i*de,D+=i*Q,B+=i*ue,H+=i*le,W+=i*me,X+=i*be,P+=i*xe,g+=i*k,w+=i*K,S+=i*$,C+=i*ee,L+=i*I,Y+=i*U,V+=i*z,q+=i*N,i=e[15],F+=i*j,D+=i*de,B+=i*Q,H+=i*ue,W+=i*le,X+=i*me,P+=i*be,g+=i*xe,w+=i*k,S+=i*K,C+=i*$,L+=i*ee,Y+=i*I,V+=i*U,q+=i*z,_+=i*N,s+=38*D,o+=38*B,a+=38*H,c+=38*W,u+=38*X,f+=38*P,d+=38*g,h+=38*w,p+=38*S,y+=38*C,b+=38*L,E+=38*Y,v+=38*V,A+=38*q,R+=38*_,n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-n*65536,i=o+n+65535,n=Math.floor(i/65536),o=i-n*65536,i=a+n+65535,n=Math.floor(i/65536),a=i-n*65536,i=c+n+65535,n=Math.floor(i/65536),c=i-n*65536,i=u+n+65535,n=Math.floor(i/65536),u=i-n*65536,i=f+n+65535,n=Math.floor(i/65536),f=i-n*65536,i=d+n+65535,n=Math.floor(i/65536),d=i-n*65536,i=h+n+65535,n=Math.floor(i/65536),h=i-n*65536,i=p+n+65535,n=Math.floor(i/65536),p=i-n*65536,i=y+n+65535,n=Math.floor(i/65536),y=i-n*65536,i=b+n+65535,n=Math.floor(i/65536),b=i-n*65536,i=E+n+65535,n=Math.floor(i/65536),E=i-n*65536,i=v+n+65535,n=Math.floor(i/65536),v=i-n*65536,i=A+n+65535,n=Math.floor(i/65536),A=i-n*65536,i=R+n+65535,n=Math.floor(i/65536),R=i-n*65536,i=F+n+65535,n=Math.floor(i/65536),F=i-n*65536,s+=n-1+37*(n-1),n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-n*65536,i=o+n+65535,n=Math.floor(i/65536),o=i-n*65536,i=a+n+65535,n=Math.floor(i/65536),a=i-n*65536,i=c+n+65535,n=Math.floor(i/65536),c=i-n*65536,i=u+n+65535,n=Math.floor(i/65536),u=i-n*65536,i=f+n+65535,n=Math.floor(i/65536),f=i-n*65536,i=d+n+65535,n=Math.floor(i/65536),d=i-n*65536,i=h+n+65535,n=Math.floor(i/65536),h=i-n*65536,i=p+n+65535,n=Math.floor(i/65536),p=i-n*65536,i=y+n+65535,n=Math.floor(i/65536),y=i-n*65536,i=b+n+65535,n=Math.floor(i/65536),b=i-n*65536,i=E+n+65535,n=Math.floor(i/65536),E=i-n*65536,i=v+n+65535,n=Math.floor(i/65536),v=i-n*65536,i=A+n+65535,n=Math.floor(i/65536),A=i-n*65536,i=R+n+65535,n=Math.floor(i/65536),R=i-n*65536,i=F+n+65535,n=Math.floor(i/65536),F=i-n*65536,s+=n-1+37*(n-1),t[0]=s,t[1]=o,t[2]=a,t[3]=c,t[4]=u,t[5]=f,t[6]=d,t[7]=h,t[8]=p,t[9]=y,t[10]=b,t[11]=E,t[12]=v,t[13]=A,t[14]=R,t[15]=F}});var qj=m((Jst,Lj)=>{l();"use strict";var i4=65536;function vEe(t){let e=new Uint8Array(t),r=0;if(t>0)if(t>i4)for(;r<t;)r+i4>t?(crypto.getRandomValues(e.subarray(r,r+(t-r))),r+=t-r):(crypto.getRandomValues(e.subarray(r,r+i4)),r+=i4);else crypto.getRandomValues(e);return e}Lj.exports=vEe});var _y=m((eot,jj)=>{l();"use strict";var wEe=qj(),_Ee=zo();jj.exports=function(t){if(isNaN(t)||t<=0)throw _Ee(new Error("random bytes length must be a Number bigger than 0"),"ERR_INVALID_LENGTH");return wEe(t)}});var n4=m(Ey=>{l();"use strict";nr();gy();var EEe=yt(),{fromString:SEe}=(dt(),bi),{toString:Uj}=(tt(),hr),{concat:Fj}=(mn(),$s);Ey.bigIntegerToUintBase64url=(t,e)=>{let r=Uint8Array.from(t.abs().toByteArray());if(r=r[0]===0?r.slice(1):r,e!=null){if(r.length>e)throw new Error("byte array longer than desired length");r=Fj([new Uint8Array(e-r.length),r])}return Uj(r,"base64url")};Ey.base64urlToBigInteger=t=>{let e=Ey.base64urlToBuffer(t);return new EEe.jsbn.BigInteger(Uj(e,"base16"),16)};Ey.base64urlToBuffer=(t,e)=>{let r=SEe(t,"base64urlpad");if(e!=null){if(r.length>e)throw new Error("byte array longer than desired length");r=Fj([new Uint8Array(e-r.length),r])}return r}});var zj=m(Sy=>{l();"use strict";Qc();my();var mf=yt(),{bigIntegerToUintBase64url:Fa,base64urlToBigInteger:Ka}=n4(),{fromString:Kj}=(dt(),bi),{toString:Vj}=(tt(),hr);Sy.pkcs1ToJwk=function(t){let e=mf.asn1.fromDer(Vj(t,"ascii")),r=mf.pki.privateKeyFromAsn1(e);return{kty:"RSA",n:Fa(r.n),e:Fa(r.e),d:Fa(r.d),p:Fa(r.p),q:Fa(r.q),dp:Fa(r.dP),dq:Fa(r.dQ),qi:Fa(r.qInv),alg:"RS256",kid:"2011-04-29"}};Sy.jwkToPkcs1=function(t){let e=mf.pki.privateKeyToAsn1({n:Ka(t.n),e:Ka(t.e),d:Ka(t.d),p:Ka(t.p),q:Ka(t.q),dP:Ka(t.dp),dQ:Ka(t.dq),qInv:Ka(t.qi)});return Kj(mf.asn1.toDer(e).getBytes(),"ascii")};Sy.pkixToJwk=function(t){let e=mf.asn1.fromDer(Vj(t,"ascii")),r=mf.pki.publicKeyFromAsn1(e);return{kty:"RSA",n:Fa(r.n),e:Fa(r.e),alg:"RS256",kid:"2011-04-29"}};Sy.jwkToPkix=function(t){let e=mf.pki.publicKeyToAsn1({n:Ka(t.n),e:Ka(t.e)});return Kj(mf.asn1.toDer(e).getBytes(),"ascii")}});var Wj=m((iot,$j)=>{l();"use strict";my();var Hj=yt(),{base64urlToBigInteger:xEe}=n4();function Gj(t,e){return e.map(r=>xEe(t[r]))}function AEe(t){return Hj.pki.setRsaPrivateKey(...Gj(t,["n","e","d","p","q","dp","dq","qi"]))}function IEe(t){return Hj.pki.setRsaPublicKey(...Gj(t,["n","e"]))}$j.exports={jwk2pub:IEe,jwk2priv:AEe}});var Qj=m(iu=>{l();"use strict";var ru=by(),TEe=_y(),{toString:REe}=(tt(),hr),{fromString:PEe}=(dt(),bi);iu.utils=zj();iu.generateKey=async function(t){let e=await ru.get().subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]),r=await Yj(e);return{privateKey:r[0],publicKey:r[1]}};iu.unmarshalPrivateKey=async function(t){let r=[await ru.get().subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]),await CEe(t)],i=await Yj({privateKey:r[0],publicKey:r[1]});return{privateKey:i[0],publicKey:i[1]}};iu.getRandomValues=TEe;iu.hashAndSign=async function(t,e){let r=await ru.get().subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]),i=await ru.get().subtle.sign({name:"RSASSA-PKCS1-v1_5"},r,Uint8Array.from(e));return new Uint8Array(i,i.byteOffset,i.byteLength)};iu.hashAndVerify=async function(t,e,r){let i=await ru.get().subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]);return ru.get().subtle.verify({name:"RSASSA-PKCS1-v1_5"},i,e,r)};function Yj(t){return Promise.all([ru.get().subtle.exportKey("jwk",t.privateKey),ru.get().subtle.exportKey("jwk",t.publicKey)])}function CEe(t){return ru.get().subtle.importKey("jwk",{kty:t.kty,n:t.n,e:t.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}var{jwk2pub:OEe,jwk2priv:kEe}=Wj();function Xj(t,e,r,i){let n=e?OEe(t):kEe(t),s=REe(Uint8Array.from(r),"ascii"),o=i(s,n);return PEe(o,"ascii")}iu.encrypt=function(t,e){return Xj(t,!0,e,(r,i)=>i.encrypt(r))};iu.decrypt=function(t,e){return Xj(t,!1,e,(r,i)=>i.decrypt(r))}});var s4=m((sot,Zj)=>{l();"use strict";var{base64:DEe}=($2(),e0),BEe=S_();Zj.exports={export:async function(t,e){let i=await BEe.create().encrypt(t,e);return DEe.encode(i)}}});var iU=m((oot,rU)=>{l();"use strict";var{sha256:Jj}=(di(),zs),eU=zo(),{equals:tU}=(wi(),bn),{toString:NEe}=(tt(),hr);e4();N_();var o4=yt(),Qs=Qj(),a4=M6(),MEe=s4(),c4=class{constructor(e){this._key=e}async verify(e,r){return Qs.hashAndVerify(this._key,r,e)}marshal(){return Qs.utils.jwkToPkix(this._key)}get bytes(){return a4.PublicKey.encode({Type:a4.KeyType.RSA,Data:this.marshal()}).finish()}encrypt(e){return Qs.encrypt(this._key,e)}equals(e){return tU(this.bytes,e.bytes)}async hash(){let{bytes:e}=await Jj.digest(this.bytes);return e}},xy=class{constructor(e,r){this._key=e,this._publicKey=r}genSecret(){return Qs.getRandomValues(16)}async sign(e){return Qs.hashAndSign(this._key,e)}get public(){if(!this._publicKey)throw eU(new Error("public key not provided"),"ERR_PUBKEY_NOT_PROVIDED");return new c4(this._publicKey)}decrypt(e){return Qs.decrypt(this._key,e)}marshal(){return Qs.utils.jwkToPkcs1(this._key)}get bytes(){return a4.PrivateKey.encode({Type:a4.KeyType.RSA,Data:this.marshal()}).finish()}equals(e){return tU(this.bytes,e.bytes)}async hash(){let{bytes:e}=await Jj.digest(this.bytes);return e}async id(){let e=await this.public.hash();return NEe(e,"base58btc")}async export(e,r="pkcs-8"){if(r==="pkcs-8"){let i=new o4.util.ByteBuffer(this.marshal()),n=o4.asn1.fromDer(i),s=o4.pki.privateKeyFromAsn1(n),o={algorithm:"aes256",count:1e4,saltSize:128/8,prfAlgorithm:"sha512"};return o4.pki.encryptRsaPrivateKey(s,e,o)}else{if(r==="libp2p-key")return MEe.export(this.bytes,e);throw eU(new Error(`export format '${r}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")}}};async function LEe(t){let e=Qs.utils.pkcs1ToJwk(t),r=await Qs.unmarshalPrivateKey(e);return new xy(r.privateKey,r.publicKey)}function qEe(t){let e=Qs.utils.pkixToJwk(t);return new c4(e)}async function jEe(t){let e=await Qs.unmarshalPrivateKey(t);return new xy(e.privateKey,e.publicKey)}async function UEe(t){let e=await Qs.generateKey(t);return new xy(e.privateKey,e.publicKey)}rU.exports={RsaPublicKey:c4,RsaPrivateKey:xy,unmarshalRsaPublicKey:qEe,unmarshalRsaPrivateKey:LEe,generateKeyPair:UEe,fromJwk:jEe}});var nU=m(Kl=>{l();"use strict";N_();var T0=yt();Kl.publicKeyLength=T0.pki.ed25519.constants.PUBLIC_KEY_BYTE_LENGTH;Kl.privateKeyLength=T0.pki.ed25519.constants.PRIVATE_KEY_BYTE_LENGTH;Kl.generateKey=async function(){return T0.pki.ed25519.generateKeyPair()};Kl.generateKeyFromSeed=async function(t){return T0.pki.ed25519.generateKeyPair({seed:t})};Kl.hashAndSign=async function(t,e){return T0.pki.ed25519.sign({message:e,privateKey:t})};Kl.hashAndVerify=async function(t,e,r){return T0.pki.ed25519.verify({signature:e,message:r,publicKey:t})}});var uU=m((cot,cU)=>{l();"use strict";var sU=zo(),{equals:oU}=(wi(),bn),{sha256:aU}=(di(),zs),{base58btc:FEe}=(li(),Fs),{identity:KEe}=(Gc(),G2),Sn=nU(),u4=M6(),VEe=s4(),f4=class{constructor(e){this._key=P0(e,Sn.publicKeyLength)}async verify(e,r){return Sn.hashAndVerify(this._key,r,e)}marshal(){return this._key}get bytes(){return u4.PublicKey.encode({Type:u4.KeyType.Ed25519,Data:this.marshal()}).finish()}equals(e){return oU(this.bytes,e.bytes)}async hash(){let{bytes:e}=await aU.digest(this.bytes);return e}},R0=class{constructor(e,r){this._key=P0(e,Sn.privateKeyLength),this._publicKey=P0(r,Sn.publicKeyLength)}async sign(e){return Sn.hashAndSign(this._key,e)}get public(){return new f4(this._publicKey)}marshal(){return this._key}get bytes(){return u4.PrivateKey.encode({Type:u4.KeyType.Ed25519,Data:this.marshal()}).finish()}equals(e){return oU(this.bytes,e.bytes)}async hash(){let{bytes:e}=await aU.digest(this.bytes);return e}async id(){let e=await KEe.digest(this.public.bytes);return FEe.encode(e.bytes).substring(1)}async export(e,r="libp2p-key"){if(r==="libp2p-key")return VEe.export(this.bytes,e);throw sU(new Error(`export format '${r}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")}};function zEe(t){if(t.length>Sn.privateKeyLength){t=P0(t,Sn.privateKeyLength+Sn.publicKeyLength);let i=t.slice(0,Sn.privateKeyLength),n=t.slice(Sn.privateKeyLength,t.length);return new R0(i,n)}t=P0(t,Sn.privateKeyLength);let e=t.slice(0,Sn.privateKeyLength),r=t.slice(Sn.publicKeyLength);return new R0(e,r)}function HEe(t){return t=P0(t,Sn.publicKeyLength),new f4(t)}async function GEe(){let{privateKey:t,publicKey:e}=await Sn.generateKey();return new R0(t,e)}async function $Ee(t){let{privateKey:e,publicKey:r}=await Sn.generateKeyFromSeed(t);return new R0(e,r)}function P0(t,e){if(t=Uint8Array.from(t||[]),t.length!==e)throw sU(new Error(`Key must be a Uint8Array of length ${e}, got ${t.length}`),"ERR_INVALID_KEY_TYPE");return t}cU.exports={Ed25519PublicKey:f4,Ed25519PrivateKey:R0,unmarshalEd25519PrivateKey:zEe,unmarshalEd25519PublicKey:HEe,generateKeyPair:GEe,generateKeyPairFromSeed:$Ee}});var lU=m((uot,fU)=>{l();var $t={IMPOSSIBLE_CASE:"Impossible case. Please create issue.",TWEAK_ADD:"The tweak was out of range or the resulted private key is invalid",TWEAK_MUL:"The tweak was out of range or equal to zero",CONTEXT_RANDOMIZE_UNKNOW:"Unknow error on context randomization",SECKEY_INVALID:"Private Key is invalid",PUBKEY_PARSE:"Public Key could not be parsed",PUBKEY_SERIALIZE:"Public Key serialization error",PUBKEY_COMBINE:"The sum of the public keys is not valid",SIG_PARSE:"Signature could not be parsed",SIGN:"The nonce generation function failed, or the private key was invalid",RECOVER:"Public key could not be recover",ECDH:"Scalar was invalid (zero or overflow)"};function Zs(t,e){if(!t)throw new Error(e)}function Mt(t,e,r){if(Zs(e instanceof Uint8Array,`Expected ${t} to be an Uint8Array`),r!==void 0)if(Array.isArray(r)){let i=r.join(", "),n=`Expected ${t} to be an Uint8Array with length [${i}]`;Zs(r.includes(e.length),n)}else{let i=`Expected ${t} to be an Uint8Array with length ${r}`;Zs(e.length===r,i)}}function Vl(t){Zs(C0(t)==="Boolean","Expected compressed to be a Boolean")}function Ho(t=r=>new Uint8Array(r),e){return typeof t=="function"&&(t=t(e)),Mt("output",t,e),t}function C0(t){return Object.prototype.toString.call(t).slice(8,-1)}fU.exports=t=>({contextRandomize(e){switch(Zs(e===null||e instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),e!==null&&Mt("seed",e,32),t.contextRandomize(e)){case 1:throw new Error($t.CONTEXT_RANDOMIZE_UNKNOW)}},privateKeyVerify(e){return Mt("private key",e,32),t.privateKeyVerify(e)===0},privateKeyNegate(e){switch(Mt("private key",e,32),t.privateKeyNegate(e)){case 0:return e;case 1:throw new Error($t.IMPOSSIBLE_CASE)}},privateKeyTweakAdd(e,r){switch(Mt("private key",e,32),Mt("tweak",r,32),t.privateKeyTweakAdd(e,r)){case 0:return e;case 1:throw new Error($t.TWEAK_ADD)}},privateKeyTweakMul(e,r){switch(Mt("private key",e,32),Mt("tweak",r,32),t.privateKeyTweakMul(e,r)){case 0:return e;case 1:throw new Error($t.TWEAK_MUL)}},publicKeyVerify(e){return Mt("public key",e,[33,65]),t.publicKeyVerify(e)===0},publicKeyCreate(e,r=!0,i){switch(Mt("private key",e,32),Vl(r),i=Ho(i,r?33:65),t.publicKeyCreate(i,e)){case 0:return i;case 1:throw new Error($t.SECKEY_INVALID);case 2:throw new Error($t.PUBKEY_SERIALIZE)}},publicKeyConvert(e,r=!0,i){switch(Mt("public key",e,[33,65]),Vl(r),i=Ho(i,r?33:65),t.publicKeyConvert(i,e)){case 0:return i;case 1:throw new Error($t.PUBKEY_PARSE);case 2:throw new Error($t.PUBKEY_SERIALIZE)}},publicKeyNegate(e,r=!0,i){switch(Mt("public key",e,[33,65]),Vl(r),i=Ho(i,r?33:65),t.publicKeyNegate(i,e)){case 0:return i;case 1:throw new Error($t.PUBKEY_PARSE);case 2:throw new Error($t.IMPOSSIBLE_CASE);case 3:throw new Error($t.PUBKEY_SERIALIZE)}},publicKeyCombine(e,r=!0,i){Zs(Array.isArray(e),"Expected public keys to be an Array"),Zs(e.length>0,"Expected public keys array will have more than zero items");for(let n of e)Mt("public key",n,[33,65]);switch(Vl(r),i=Ho(i,r?33:65),t.publicKeyCombine(i,e)){case 0:return i;case 1:throw new Error($t.PUBKEY_PARSE);case 2:throw new Error($t.PUBKEY_COMBINE);case 3:throw new Error($t.PUBKEY_SERIALIZE)}},publicKeyTweakAdd(e,r,i=!0,n){switch(Mt("public key",e,[33,65]),Mt("tweak",r,32),Vl(i),n=Ho(n,i?33:65),t.publicKeyTweakAdd(n,e,r)){case 0:return n;case 1:throw new Error($t.PUBKEY_PARSE);case 2:throw new Error($t.TWEAK_ADD)}},publicKeyTweakMul(e,r,i=!0,n){switch(Mt("public key",e,[33,65]),Mt("tweak",r,32),Vl(i),n=Ho(n,i?33:65),t.publicKeyTweakMul(n,e,r)){case 0:return n;case 1:throw new Error($t.PUBKEY_PARSE);case 2:throw new Error($t.TWEAK_MUL)}},signatureNormalize(e){switch(Mt("signature",e,64),t.signatureNormalize(e)){case 0:return e;case 1:throw new Error($t.SIG_PARSE)}},signatureExport(e,r){Mt("signature",e,64),r=Ho(r,72);let i={output:r,outputlen:72};switch(t.signatureExport(i,e)){case 0:return r.slice(0,i.outputlen);case 1:throw new Error($t.SIG_PARSE);case 2:throw new Error($t.IMPOSSIBLE_CASE)}},signatureImport(e,r){switch(Mt("signature",e),r=Ho(r,64),t.signatureImport(r,e)){case 0:return r;case 1:throw new Error($t.SIG_PARSE);case 2:throw new Error($t.IMPOSSIBLE_CASE)}},ecdsaSign(e,r,i={},n){Mt("message",e,32),Mt("private key",r,32),Zs(C0(i)==="Object","Expected options to be an Object"),i.data!==void 0&&Mt("options.data",i.data),i.noncefn!==void 0&&Zs(C0(i.noncefn)==="Function","Expected options.noncefn to be a Function"),n=Ho(n,64);let s={signature:n,recid:null};switch(t.ecdsaSign(s,e,r,i.data,i.noncefn)){case 0:return s;case 1:throw new Error($t.SIGN);case 2:throw new Error($t.IMPOSSIBLE_CASE)}},ecdsaVerify(e,r,i){switch(Mt("signature",e,64),Mt("message",r,32),Mt("public key",i,[33,65]),t.ecdsaVerify(e,r,i)){case 0:return!0;case 3:return!1;case 1:throw new Error($t.SIG_PARSE);case 2:throw new Error($t.PUBKEY_PARSE)}},ecdsaRecover(e,r,i,n=!0,s){switch(Mt("signature",e,64),Zs(C0(r)==="Number"&&r>=0&&r<=3,"Expected recovery id to be a Number within interval [0, 3]"),Mt("message",i,32),Vl(n),s=Ho(s,n?33:65),t.ecdsaRecover(s,e,r,i)){case 0:return s;case 1:throw new Error($t.SIG_PARSE);case 2:throw new Error($t.RECOVER);case 3:throw new Error($t.IMPOSSIBLE_CASE)}},ecdh(e,r,i={},n){switch(Mt("public key",e,[33,65]),Mt("private key",r,32),Zs(C0(i)==="Object","Expected options to be an Object"),i.data!==void 0&&Mt("options.data",i.data),i.hashfn!==void 0?(Zs(C0(i.hashfn)==="Function","Expected options.hashfn to be a Function"),i.xbuf!==void 0&&Mt("options.xbuf",i.xbuf,32),i.ybuf!==void 0&&Mt("options.ybuf",i.ybuf,32),Mt("output",n)):n=Ho(n,32),t.ecdh(n,e,r,i.data,i.hashfn,i.xbuf,i.ybuf)){case 0:return n;case 1:throw new Error($t.PUBKEY_PARSE);case 2:throw new Error($t.ECDH)}}})});var dU=m((fot,WEe)=>{WEe.exports={name:"elliptic",version:"6.5.4",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny <fedor@indutny.com>",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}});var hU=m(()=>{l()});var Va=m((pU,M_)=>{l();(function(t,e){"use strict";function r(P,g){if(!P)throw new Error(g||"Assertion failed")}function i(P,g){P.super_=g;var w=function(){};w.prototype=g.prototype,P.prototype=new w,P.prototype.constructor=P}function n(P,g,w){if(n.isBN(P))return P;this.negative=0,this.words=null,this.length=0,this.red=null,P!==null&&((g==="le"||g==="be")&&(w=g,g=10),this._init(P||0,g||10,w||"be"))}typeof t=="object"?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;var s;try{typeof window!="undefined"&&typeof window.Buffer!="undefined"?s=window.Buffer:s=hU().Buffer}catch(P){}n.isBN=function(g){return g instanceof n?!0:g!==null&&typeof g=="object"&&g.constructor.wordSize===n.wordSize&&Array.isArray(g.words)},n.max=function(g,w){return g.cmp(w)>0?g:w},n.min=function(g,w){return g.cmp(w)<0?g:w},n.prototype._init=function(g,w,S){if(typeof g=="number")return this._initNumber(g,w,S);if(typeof g=="object")return this._initArray(g,w,S);w==="hex"&&(w=16),r(w===(w|0)&&w>=2&&w<=36),g=g.toString().replace(/\s+/g,"");var C=0;g[0]==="-"&&(C++,this.negative=1),C<g.length&&(w===16?this._parseHex(g,C,S):(this._parseBase(g,w,C),S==="le"&&this._initArray(this.toArray(),w,S)))},n.prototype._initNumber=function(g,w,S){g<0&&(this.negative=1,g=-g),g<67108864?(this.words=[g&67108863],this.length=1):g<4503599627370496?(this.words=[g&67108863,g/67108864&67108863],this.length=2):(r(g<9007199254740992),this.words=[g&67108863,g/67108864&67108863,1],this.length=3),S==="le"&&this._initArray(this.toArray(),w,S)},n.prototype._initArray=function(g,w,S){if(r(typeof g.length=="number"),g.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(g.length/3),this.words=new Array(this.length);for(var C=0;C<this.length;C++)this.words[C]=0;var L,Y,V=0;if(S==="be")for(C=g.length-1,L=0;C>=0;C-=3)Y=g[C]|g[C-1]<<8|g[C-2]<<16,this.words[L]|=Y<<V&67108863,this.words[L+1]=Y>>>26-V&67108863,V+=24,V>=26&&(V-=26,L++);else if(S==="le")for(C=0,L=0;C<g.length;C+=3)Y=g[C]|g[C+1]<<8|g[C+2]<<16,this.words[L]|=Y<<V&67108863,this.words[L+1]=Y>>>26-V&67108863,V+=24,V>=26&&(V-=26,L++);return this.strip()};function o(P,g){var w=P.charCodeAt(g);return w>=65&&w<=70?w-55:w>=97&&w<=102?w-87:w-48&15}function a(P,g,w){var S=o(P,w);return w-1>=g&&(S|=o(P,w-1)<<4),S}n.prototype._parseHex=function(g,w,S){this.length=Math.ceil((g.length-w)/6),this.words=new Array(this.length);for(var C=0;C<this.length;C++)this.words[C]=0;var L=0,Y=0,V;if(S==="be")for(C=g.length-1;C>=w;C-=2)V=a(g,w,C)<<L,this.words[Y]|=V&67108863,L>=18?(L-=18,Y+=1,this.words[Y]|=V>>>26):L+=8;else{var q=g.length-w;for(C=q%2==0?w+1:w;C<g.length;C+=2)V=a(g,w,C)<<L,this.words[Y]|=V&67108863,L>=18?(L-=18,Y+=1,this.words[Y]|=V>>>26):L+=8}this.strip()};function c(P,g,w,S){for(var C=0,L=Math.min(P.length,w),Y=g;Y<L;Y++){var V=P.charCodeAt(Y)-48;C*=S,V>=49?C+=V-49+10:V>=17?C+=V-17+10:C+=V}return C}n.prototype._parseBase=function(g,w,S){this.words=[0],this.length=1;for(var C=0,L=1;L<=67108863;L*=w)C++;C--,L=L/w|0;for(var Y=g.length-S,V=Y%C,q=Math.min(Y,Y-V)+S,_=0,j=S;j<q;j+=C)_=c(g,j,j+C,w),this.imuln(L),this.words[0]+_<67108864?this.words[0]+=_:this._iaddn(_);if(V!==0){var de=1;for(_=c(g,j,g.length,w),j=0;j<V;j++)de*=w;this.imuln(de),this.words[0]+_<67108864?this.words[0]+=_:this._iaddn(_)}this.strip()},n.prototype.copy=function(g){g.words=new Array(this.length);for(var w=0;w<this.length;w++)g.words[w]=this.words[w];g.length=this.length,g.negative=this.negative,g.red=this.red},n.prototype.clone=function(){var g=new n(null);return this.copy(g),g},n.prototype._expand=function(g){for(;this.length<g;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},n.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];n.prototype.toString=function(g,w){g=g||10,w=w|0||1;var S;if(g===16||g==="hex"){S="";for(var C=0,L=0,Y=0;Y<this.length;Y++){var V=this.words[Y],q=((V<<C|L)&16777215).toString(16);L=V>>>24-C&16777215,L!==0||Y!==this.length-1?S=u[6-q.length]+q+S:S=q+S,C+=2,C>=26&&(C-=26,Y--)}for(L!==0&&(S=L.toString(16)+S);S.length%w!=0;)S="0"+S;return this.negative!==0&&(S="-"+S),S}if(g===(g|0)&&g>=2&&g<=36){var _=f[g],j=d[g];S="";var de=this.clone();for(de.negative=0;!de.isZero();){var Q=de.modn(j).toString(g);de=de.idivn(j),de.isZero()?S=Q+S:S=u[_-Q.length]+Q+S}for(this.isZero()&&(S="0"+S);S.length%w!=0;)S="0"+S;return this.negative!==0&&(S="-"+S),S}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var g=this.words[0];return this.length===2?g+=this.words[1]*67108864:this.length===3&&this.words[2]===1?g+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-g:g},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(g,w){return r(typeof s!="undefined"),this.toArrayLike(s,g,w)},n.prototype.toArray=function(g,w){return this.toArrayLike(Array,g,w)},n.prototype.toArrayLike=function(g,w,S){var C=this.byteLength(),L=S||Math.max(1,C);r(C<=L,"byte array longer than desired length"),r(L>0,"Requested array length <= 0"),this.strip();var Y=w==="le",V=new g(L),q,_,j=this.clone();if(Y){for(_=0;!j.isZero();_++)q=j.andln(255),j.iushrn(8),V[_]=q;for(;_<L;_++)V[_]=0}else{for(_=0;_<L-C;_++)V[_]=0;for(_=0;!j.isZero();_++)q=j.andln(255),j.iushrn(8),V[L-_-1]=q}return V},Math.clz32?n.prototype._countBits=function(g){return 32-Math.clz32(g)}:n.prototype._countBits=function(g){var w=g,S=0;return w>=4096&&(S+=13,w>>>=13),w>=64&&(S+=7,w>>>=7),w>=8&&(S+=4,w>>>=4),w>=2&&(S+=2,w>>>=2),S+w},n.prototype._zeroBits=function(g){if(g===0)return 26;var w=g,S=0;return(w&8191)==0&&(S+=13,w>>>=13),(w&127)==0&&(S+=7,w>>>=7),(w&15)==0&&(S+=4,w>>>=4),(w&3)==0&&(S+=2,w>>>=2),(w&1)==0&&S++,S},n.prototype.bitLength=function(){var g=this.words[this.length-1],w=this._countBits(g);return(this.length-1)*26+w};function h(P){for(var g=new Array(P.bitLength()),w=0;w<g.length;w++){var S=w/26|0,C=w%26;g[w]=(P.words[S]&1<<C)>>>C}return g}n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var g=0,w=0;w<this.length;w++){var S=this._zeroBits(this.words[w]);if(g+=S,S!==26)break}return g},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(g){return this.negative!==0?this.abs().inotn(g).iaddn(1):this.clone()},n.prototype.fromTwos=function(g){return this.testn(g-1)?this.notn(g).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return this.negative!==0},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(g){for(;this.length<g.length;)this.words[this.length++]=0;for(var w=0;w<g.length;w++)this.words[w]=this.words[w]|g.words[w];return this.strip()},n.prototype.ior=function(g){return r((this.negative|g.negative)==0),this.iuor(g)},n.prototype.or=function(g){return this.length>g.length?this.clone().ior(g):g.clone().ior(this)},n.prototype.uor=function(g){return this.length>g.length?this.clone().iuor(g):g.clone().iuor(this)},n.prototype.iuand=function(g){var w;this.length>g.length?w=g:w=this;for(var S=0;S<w.length;S++)this.words[S]=this.words[S]&g.words[S];return this.length=w.length,this.strip()},n.prototype.iand=function(g){return r((this.negative|g.negative)==0),this.iuand(g)},n.prototype.and=function(g){return this.length>g.length?this.clone().iand(g):g.clone().iand(this)},n.prototype.uand=function(g){return this.length>g.length?this.clone().iuand(g):g.clone().iuand(this)},n.prototype.iuxor=function(g){var w,S;this.length>g.length?(w=this,S=g):(w=g,S=this);for(var C=0;C<S.length;C++)this.words[C]=w.words[C]^S.words[C];if(this!==w)for(;C<w.length;C++)this.words[C]=w.words[C];return this.length=w.length,this.strip()},n.prototype.ixor=function(g){return r((this.negative|g.negative)==0),this.iuxor(g)},n.prototype.xor=function(g){return this.length>g.length?this.clone().ixor(g):g.clone().ixor(this)},n.prototype.uxor=function(g){return this.length>g.length?this.clone().iuxor(g):g.clone().iuxor(this)},n.prototype.inotn=function(g){r(typeof g=="number"&&g>=0);var w=Math.ceil(g/26)|0,S=g%26;this._expand(w),S>0&&w--;for(var C=0;C<w;C++)this.words[C]=~this.words[C]&67108863;return S>0&&(this.words[C]=~this.words[C]&67108863>>26-S),this.strip()},n.prototype.notn=function(g){return this.clone().inotn(g)},n.prototype.setn=function(g,w){r(typeof g=="number"&&g>=0);var S=g/26|0,C=g%26;return this._expand(S+1),w?this.words[S]=this.words[S]|1<<C:this.words[S]=this.words[S]&~(1<<C),this.strip()},n.prototype.iadd=function(g){var w;if(this.negative!==0&&g.negative===0)return this.negative=0,w=this.isub(g),this.negative^=1,this._normSign();if(this.negative===0&&g.negative!==0)return g.negative=0,w=this.isub(g),g.negative=1,w._normSign();var S,C;this.length>g.length?(S=this,C=g):(S=g,C=this);for(var L=0,Y=0;Y<C.length;Y++)w=(S.words[Y]|0)+(C.words[Y]|0)+L,this.words[Y]=w&67108863,L=w>>>26;for(;L!==0&&Y<S.length;Y++)w=(S.words[Y]|0)+L,this.words[Y]=w&67108863,L=w>>>26;if(this.length=S.length,L!==0)this.words[this.length]=L,this.length++;else if(S!==this)for(;Y<S.length;Y++)this.words[Y]=S.words[Y];return this},n.prototype.add=function(g){var w;return g.negative!==0&&this.negative===0?(g.negative=0,w=this.sub(g),g.negative^=1,w):g.negative===0&&this.negative!==0?(this.negative=0,w=g.sub(this),this.negative=1,w):this.length>g.length?this.clone().iadd(g):g.clone().iadd(this)},n.prototype.isub=function(g){if(g.negative!==0){g.negative=0;var w=this.iadd(g);return g.negative=1,w._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(g),this.negative=1,this._normSign();var S=this.cmp(g);if(S===0)return this.negative=0,this.length=1,this.words[0]=0,this;var C,L;S>0?(C=this,L=g):(C=g,L=this);for(var Y=0,V=0;V<L.length;V++)w=(C.words[V]|0)-(L.words[V]|0)+Y,Y=w>>26,this.words[V]=w&67108863;for(;Y!==0&&V<C.length;V++)w=(C.words[V]|0)+Y,Y=w>>26,this.words[V]=w&67108863;if(Y===0&&V<C.length&&C!==this)for(;V<C.length;V++)this.words[V]=C.words[V];return this.length=Math.max(this.length,V),C!==this&&(this.negative=1),this.strip()},n.prototype.sub=function(g){return this.clone().isub(g)};function p(P,g,w){w.negative=g.negative^P.negative;var S=P.length+g.length|0;w.length=S,S=S-1|0;var C=P.words[0]|0,L=g.words[0]|0,Y=C*L,V=Y&67108863,q=Y/67108864|0;w.words[0]=V;for(var _=1;_<S;_++){for(var j=q>>>26,de=q&67108863,Q=Math.min(_,g.length-1),ue=Math.max(0,_-P.length+1);ue<=Q;ue++){var le=_-ue|0;C=P.words[le]|0,L=g.words[ue]|0,Y=C*L+de,j+=Y/67108864|0,de=Y&67108863}w.words[_]=de|0,q=j|0}return q!==0?w.words[_]=q|0:w.length--,w.strip()}var y=function(g,w,S){var C=g.words,L=w.words,Y=S.words,V=0,q,_,j,de=C[0]|0,Q=de&8191,ue=de>>>13,le=C[1]|0,me=le&8191,be=le>>>13,xe=C[2]|0,k=xe&8191,K=xe>>>13,$=C[3]|0,ee=$&8191,I=$>>>13,U=C[4]|0,z=U&8191,N=U>>>13,Z=C[5]|0,ie=Z&8191,te=Z>>>13,he=C[6]|0,we=he&8191,_e=he>>>13,Ke=C[7]|0,Pe=Ke&8191,Ve=Ke>>>13,et=C[8]|0,He=et&8191,ze=et>>>13,mt=C[9]|0,tr=mt&8191,fr=mt>>>13,Dn=L[0]|0,Xt=Dn&8191,Ot=Dn>>>13,ci=L[1]|0,nt=ci&8191,Dr=ci>>>13,w3=L[2]|0,Mr=w3&8191,Lr=w3>>>13,_3=L[3]|0,qr=_3&8191,jr=_3>>>13,E3=L[4]|0,Ur=E3&8191,Fr=E3>>>13,S3=L[5]|0,Kr=S3&8191,Vr=S3>>>13,x3=L[6]|0,zr=x3&8191,Hr=x3>>>13,A3=L[7]|0,Gr=A3&8191,$r=A3>>>13,I3=L[8]|0,Wr=I3&8191,Yr=I3>>>13,T3=L[9]|0,Xr=T3&8191,lr=T3>>>13;S.negative=g.negative^w.negative,S.length=19,q=Math.imul(Q,Xt),_=Math.imul(Q,Ot),_=_+Math.imul(ue,Xt)|0,j=Math.imul(ue,Ot);var Ch=(V+q|0)+((_&8191)<<13)|0;V=(j+(_>>>13)|0)+(Ch>>>26)|0,Ch&=67108863,q=Math.imul(me,Xt),_=Math.imul(me,Ot),_=_+Math.imul(be,Xt)|0,j=Math.imul(be,Ot),q=q+Math.imul(Q,nt)|0,_=_+Math.imul(Q,Dr)|0,_=_+Math.imul(ue,nt)|0,j=j+Math.imul(ue,Dr)|0;var l2=(V+q|0)+((_&8191)<<13)|0;V=(j+(_>>>13)|0)+(l2>>>26)|0,l2&=67108863,q=Math.imul(k,Xt),_=Math.imul(k,Ot),_=_+Math.imul(K,Xt)|0,j=Math.imul(K,Ot),q=q+Math.imul(me,nt)|0,_=_+Math.imul(me,Dr)|0,_=_+Math.imul(be,nt)|0,j=j+Math.imul(be,Dr)|0,q=q+Math.imul(Q,Mr)|0,_=_+Math.imul(Q,Lr)|0,_=_+Math.imul(ue,Mr)|0,j=j+Math.imul(ue,Lr)|0;var d2=(V+q|0)+((_&8191)<<13)|0;V=(j+(_>>>13)|0)+(d2>>>26)|0,d2&=67108863,q=Math.imul(ee,Xt),_=Math.imul(ee,Ot),_=_+Math.imul(I,Xt)|0,j=Math.imul(I,Ot),q=q+Math.imul(k,nt)|0,_=_+Math.imul(k,Dr)|0,_=_+Math.imul(K,nt)|0,j=j+Math.imul(K,Dr)|0,q=q+Math.imul(me,Mr)|0,_=_+Math.imul(me,Lr)|0,_=_+Math.imul(be,Mr)|0,j=j+Math.imul(be,Lr)|0,q=q+Math.imul(Q,qr)|0,_=_+Math.imul(Q,jr)|0,_=_+Math.imul(ue,qr)|0,j=j+Math.imul(ue,jr)|0;var h2=(V+q|0)+((_&8191)<<13)|0;V=(j+(_>>>13)|0)+(h2>>>26)|0,h2&=67108863,q=Math.imul(z,Xt),_=Math.imul(z,Ot),_=_+Math.imul(N,Xt)|0,j=Math.imul(N,Ot),q=q+Math.imul(ee,nt)|0,_=_+Math.imul(ee,Dr)|0,_=_+Math.imul(I,nt)|0,j=j+Math.imul(I,Dr)|0,q=q+Math.imul(k,Mr)|0,_=_+Math.imul(k,Lr)|0,_=_+Math.imul(K,Mr)|0,j=j+Math.imul(K,Lr)|0,q=q+Math.imul(me,qr)|0,_=_+Math.imul(me,jr)|0,_=_+Math.imul(be,qr)|0,j=j+Math.imul(be,jr)|0,q=q+Math.imul(Q,Ur)|0,_=_+Math.imul(Q,Fr)|0,_=_+Math.imul(ue,Ur)|0,j=j+Math.imul(ue,Fr)|0;var p2=(V+q|0)+((_&8191)<<13)|0;V=(j+(_>>>13)|0)+(p2>>>26)|0,p2&=67108863,q=Math.imul(ie,Xt),_=Math.imul(ie,Ot),_=_+Math.imul(te,Xt)|0,j=Math.imul(te,Ot),q=q+Math.imul(z,nt)|0,_=_+Math.imul(z,Dr)|0,_=_+Math.imul(N,nt)|0,j=j+Math.imul(N,Dr)|0,q=q+Math.imul(ee,Mr)|0,_=_+Math.imul(ee,Lr)|0,_=_+Math.imul(I,Mr)|0,j=j+Math.imul(I,Lr)|0,q=q+Math.imul(k,qr)|0,_=_+Math.imul(k,jr)|0,_=_+Math.imul(K,qr)|0,j=j+Math.imul(K,jr)|0,q=q+Math.imul(me,Ur)|0,_=_+Math.imul(me,Fr)|0,_=_+Math.imul(be,Ur)|0,j=j+Math.imul(be,Fr)|0,q=q+Math.imul(Q,Kr)|0,_=_+Math.imul(Q,Vr)|0,_=_+Math.imul(ue,Kr)|0,j=j+Math.imul(ue,Vr)|0;var y2=(V+q|0)+((_&8191)<<13)|0;V=(j+(_>>>13)|0)+(y2>>>26)|0,y2&=67108863,q=Math.imul(we,Xt),_=Math.imul(we,Ot),_=_+Math.imul(_e,Xt)|0,j=Math.imul(_e,Ot),q=q+Math.imul(ie,nt)|0,_=_+Math.imul(ie,Dr)|0,_=_+Math.imul(te,nt)|0,j=j+Math.imul(te,Dr)|0,q=q+Math.imul(z,Mr)|0,_=_+Math.imul(z,Lr)|0,_=_+Math.imul(N,Mr)|0,j=j+Math.imul(N,Lr)|0,q=q+Math.imul(ee,qr)|0,_=_+Math.imul(ee,jr)|0,_=_+Math.imul(I,qr)|0,j=j+Math.imul(I,jr)|0,q=q+Math.imul(k,Ur)|0,_=_+Math.imul(k,Fr)|0,_=_+Math.imul(K,Ur)|0,j=j+Math.imul(K,Fr)|0,q=q+Math.imul(me,Kr)|0,_=_+Math.imul(me,Vr)|0,_=_+Math.imul(be,Kr)|0,j=j+Math.imul(be,Vr)|0,q=q+Math.imul(Q,zr)|0,_=_+Math.imul(Q,Hr)|0,_=_+Math.imul(ue,zr)|0,j=j+Math.imul(ue,Hr)|0;var Oo=(V+q|0)+((_&8191)<<13)|0;V=(j+(_>>>13)|0)+(Oo>>>26)|0,Oo&=67108863,q=Math.imul(Pe,Xt),_=Math.imul(Pe,Ot),_=_+Math.imul(Ve,Xt)|0,j=Math.imul(Ve,Ot),q=q+Math.imul(we,nt)|0,_=_+Math.imul(we,Dr)|0,_=_+Math.imul(_e,nt)|0,j=j+Math.imul(_e,Dr)|0,q=q+Math.imul(ie,Mr)|0,_=_+Math.imul(ie,Lr)|0,_=_+Math.imul(te,Mr)|0,j=j+Math.imul(te,Lr)|0,q=q+Math.imul(z,qr)|0,_=_+Math.imul(z,jr)|0,_=_+Math.imul(N,qr)|0,j=j+Math.imul(N,jr)|0,q=q+Math.imul(ee,Ur)|0,_=_+Math.imul(ee,Fr)|0,_=_+Math.imul(I,Ur)|0,j=j+Math.imul(I,Fr)|0,q=q+Math.imul(k,Kr)|0,_=_+Math.imul(k,Vr)|0,_=_+Math.imul(K,Kr)|0,j=j+Math.imul(K,Vr)|0,q=q+Math.imul(me,zr)|0,_=_+Math.imul(me,Hr)|0,_=_+Math.imul(be,zr)|0,j=j+Math.imul(be,Hr)|0,q=q+Math.imul(Q,Gr)|0,_=_+Math.imul(Q,$r)|0,_=_+Math.imul(ue,Gr)|0,j=j+Math.imul(ue,$r)|0;var g2=(V+q|0)+((_&8191)<<13)|0;V=(j+(_>>>13)|0)+(g2>>>26)|0,g2&=67108863,q=Math.imul(He,Xt),_=Math.imul(He,Ot),_=_+Math.imul(ze,Xt)|0,j=Math.imul(ze,Ot),q=q+Math.imul(Pe,nt)|0,_=_+Math.imul(Pe,Dr)|0,_=_+Math.imul(Ve,nt)|0,j=j+Math.imul(Ve,Dr)|0,q=q+Math.imul(we,Mr)|0,_=_+Math.imul(we,Lr)|0,_=_+Math.imul(_e,Mr)|0,j=j+Math.imul(_e,Lr)|0,q=q+Math.imul(ie,qr)|0,_=_+Math.imul(ie,jr)|0,_=_+Math.imul(te,qr)|0,j=j+Math.imul(te,jr)|0,q=q+Math.imul(z,Ur)|0,_=_+Math.imul(z,Fr)|0,_=_+Math.imul(N,Ur)|0,j=j+Math.imul(N,Fr)|0,q=q+Math.imul(ee,Kr)|0,_=_+Math.imul(ee,Vr)|0,_=_+Math.imul(I,Kr)|0,j=j+Math.imul(I,Vr)|0,q=q+Math.imul(k,zr)|0,_=_+Math.imul(k,Hr)|0,_=_+Math.imul(K,zr)|0,j=j+Math.imul(K,Hr)|0,q=q+Math.imul(me,Gr)|0,_=_+Math.imul(me,$r)|0,_=_+Math.imul(be,Gr)|0,j=j+Math.imul(be,$r)|0,q=q+Math.imul(Q,Wr)|0,_=_+Math.imul(Q,Yr)|0,_=_+Math.imul(ue,Wr)|0,j=j+Math.imul(ue,Yr)|0;var m2=(V+q|0)+((_&8191)<<13)|0;V=(j+(_>>>13)|0)+(m2>>>26)|0,m2&=67108863,q=Math.imul(tr,Xt),_=Math.imul(tr,Ot),_=_+Math.imul(fr,Xt)|0,j=Math.imul(fr,Ot),q=q+Math.imul(He,nt)|0,_=_+Math.imul(He,Dr)|0,_=_+Math.imul(ze,nt)|0,j=j+Math.imul(ze,Dr)|0,q=q+Math.imul(Pe,Mr)|0,_=_+Math.imul(Pe,Lr)|0,_=_+Math.imul(Ve,Mr)|0,j=j+Math.imul(Ve,Lr)|0,q=q+Math.imul(we,qr)|0,_=_+Math.imul(we,jr)|0,_=_+Math.imul(_e,qr)|0,j=j+Math.imul(_e,jr)|0,q=q+Math.imul(ie,Ur)|0,_=_+Math.imul(ie,Fr)|0,_=_+Math.imul(te,Ur)|0,j=j+Math.imul(te,Fr)|0,q=q+Math.imul(z,Kr)|0,_=_+Math.imul(z,Vr)|0,_=_+Math.imul(N,Kr)|0,j=j+Math.imul(N,Vr)|0,q=q+Math.imul(ee,zr)|0,_=_+Math.imul(ee,Hr)|0,_=_+Math.imul(I,zr)|0,j=j+Math.imul(I,Hr)|0,q=q+Math.imul(k,Gr)|0,_=_+Math.imul(k,$r)|0,_=_+Math.imul(K,Gr)|0,j=j+Math.imul(K,$r)|0,q=q+Math.imul(me,Wr)|0,_=_+Math.imul(me,Yr)|0,_=_+Math.imul(be,Wr)|0,j=j+Math.imul(be,Yr)|0,q=q+Math.imul(Q,Xr)|0,_=_+Math.imul(Q,lr)|0,_=_+Math.imul(ue,Xr)|0,j=j+Math.imul(ue,lr)|0;var b2=(V+q|0)+((_&8191)<<13)|0;V=(j+(_>>>13)|0)+(b2>>>26)|0,b2&=67108863,q=Math.imul(tr,nt),_=Math.imul(tr,Dr),_=_+Math.imul(fr,nt)|0,j=Math.imul(fr,Dr),q=q+Math.imul(He,Mr)|0,_=_+Math.imul(He,Lr)|0,_=_+Math.imul(ze,Mr)|0,j=j+Math.imul(ze,Lr)|0,q=q+Math.imul(Pe,qr)|0,_=_+Math.imul(Pe,jr)|0,_=_+Math.imul(Ve,qr)|0,j=j+Math.imul(Ve,jr)|0,q=q+Math.imul(we,Ur)|0,_=_+Math.imul(we,Fr)|0,_=_+Math.imul(_e,Ur)|0,j=j+Math.imul(_e,Fr)|0,q=q+Math.imul(ie,Kr)|0,_=_+Math.imul(ie,Vr)|0,_=_+Math.imul(te,Kr)|0,j=j+Math.imul(te,Vr)|0,q=q+Math.imul(z,zr)|0,_=_+Math.imul(z,Hr)|0,_=_+Math.imul(N,zr)|0,j=j+Math.imul(N,Hr)|0,q=q+Math.imul(ee,Gr)|0,_=_+Math.imul(ee,$r)|0,_=_+Math.imul(I,Gr)|0,j=j+Math.imul(I,$r)|0,q=q+Math.imul(k,Wr)|0,_=_+Math.imul(k,Yr)|0,_=_+Math.imul(K,Wr)|0,j=j+Math.imul(K,Yr)|0,q=q+Math.imul(me,Xr)|0,_=_+Math.imul(me,lr)|0,_=_+Math.imul(be,Xr)|0,j=j+Math.imul(be,lr)|0;var v2=(V+q|0)+((_&8191)<<13)|0;V=(j+(_>>>13)|0)+(v2>>>26)|0,v2&=67108863,q=Math.imul(tr,Mr),_=Math.imul(tr,Lr),_=_+Math.imul(fr,Mr)|0,j=Math.imul(fr,Lr),q=q+Math.imul(He,qr)|0,_=_+Math.imul(He,jr)|0,_=_+Math.imul(ze,qr)|0,j=j+Math.imul(ze,jr)|0,q=q+Math.imul(Pe,Ur)|0,_=_+Math.imul(Pe,Fr)|0,_=_+Math.imul(Ve,Ur)|0,j=j+Math.imul(Ve,Fr)|0,q=q+Math.imul(we,Kr)|0,_=_+Math.imul(we,Vr)|0,_=_+Math.imul(_e,Kr)|0,j=j+Math.imul(_e,Vr)|0,q=q+Math.imul(ie,zr)|0,_=_+Math.imul(ie,Hr)|0,_=_+Math.imul(te,zr)|0,j=j+Math.imul(te,Hr)|0,q=q+Math.imul(z,Gr)|0,_=_+Math.imul(z,$r)|0,_=_+Math.imul(N,Gr)|0,j=j+Math.imul(N,$r)|0,q=q+Math.imul(ee,Wr)|0,_=_+Math.imul(ee,Yr)|0,_=_+Math.imul(I,Wr)|0,j=j+Math.imul(I,Yr)|0,q=q+Math.imul(k,Xr)|0,_=_+Math.imul(k,lr)|0,_=_+Math.imul(K,Xr)|0,j=j+Math.imul(K,lr)|0;var w2=(V+q|0)+((_&8191)<<13)|0;V=(j+(_>>>13)|0)+(w2>>>26)|0,w2&=67108863,q=Math.imul(tr,qr),_=Math.imul(tr,jr),_=_+Math.imul(fr,qr)|0,j=Math.imul(fr,jr),q=q+Math.imul(He,Ur)|0,_=_+Math.imul(He,Fr)|0,_=_+Math.imul(ze,Ur)|0,j=j+Math.imul(ze,Fr)|0,q=q+Math.imul(Pe,Kr)|0,_=_+Math.imul(Pe,Vr)|0,_=_+Math.imul(Ve,Kr)|0,j=j+Math.imul(Ve,Vr)|0,q=q+Math.imul(we,zr)|0,_=_+Math.imul(we,Hr)|0,_=_+Math.imul(_e,zr)|0,j=j+Math.imul(_e,Hr)|0,q=q+Math.imul(ie,Gr)|0,_=_+Math.imul(ie,$r)|0,_=_+Math.imul(te,Gr)|0,j=j+Math.imul(te,$r)|0,q=q+Math.imul(z,Wr)|0,_=_+Math.imul(z,Yr)|0,_=_+Math.imul(N,Wr)|0,j=j+Math.imul(N,Yr)|0,q=q+Math.imul(ee,Xr)|0,_=_+Math.imul(ee,lr)|0,_=_+Math.imul(I,Xr)|0,j=j+Math.imul(I,lr)|0;var _2=(V+q|0)+((_&8191)<<13)|0;V=(j+(_>>>13)|0)+(_2>>>26)|0,_2&=67108863,q=Math.imul(tr,Ur),_=Math.imul(tr,Fr),_=_+Math.imul(fr,Ur)|0,j=Math.imul(fr,Fr),q=q+Math.imul(He,Kr)|0,_=_+Math.imul(He,Vr)|0,_=_+Math.imul(ze,Kr)|0,j=j+Math.imul(ze,Vr)|0,q=q+Math.imul(Pe,zr)|0,_=_+Math.imul(Pe,Hr)|0,_=_+Math.imul(Ve,zr)|0,j=j+Math.imul(Ve,Hr)|0,q=q+Math.imul(we,Gr)|0,_=_+Math.imul(we,$r)|0,_=_+Math.imul(_e,Gr)|0,j=j+Math.imul(_e,$r)|0,q=q+Math.imul(ie,Wr)|0,_=_+Math.imul(ie,Yr)|0,_=_+Math.imul(te,Wr)|0,j=j+Math.imul(te,Yr)|0,q=q+Math.imul(z,Xr)|0,_=_+Math.imul(z,lr)|0,_=_+Math.imul(N,Xr)|0,j=j+Math.imul(N,lr)|0;var E2=(V+q|0)+((_&8191)<<13)|0;V=(j+(_>>>13)|0)+(E2>>>26)|0,E2&=67108863,q=Math.imul(tr,Kr),_=Math.imul(tr,Vr),_=_+Math.imul(fr,Kr)|0,j=Math.imul(fr,Vr),q=q+Math.imul(He,zr)|0,_=_+Math.imul(He,Hr)|0,_=_+Math.imul(ze,zr)|0,j=j+Math.imul(ze,Hr)|0,q=q+Math.imul(Pe,Gr)|0,_=_+Math.imul(Pe,$r)|0,_=_+Math.imul(Ve,Gr)|0,j=j+Math.imul(Ve,$r)|0,q=q+Math.imul(we,Wr)|0,_=_+Math.imul(we,Yr)|0,_=_+Math.imul(_e,Wr)|0,j=j+Math.imul(_e,Yr)|0,q=q+Math.imul(ie,Xr)|0,_=_+Math.imul(ie,lr)|0,_=_+Math.imul(te,Xr)|0,j=j+Math.imul(te,lr)|0;var S2=(V+q|0)+((_&8191)<<13)|0;V=(j+(_>>>13)|0)+(S2>>>26)|0,S2&=67108863,q=Math.imul(tr,zr),_=Math.imul(tr,Hr),_=_+Math.imul(fr,zr)|0,j=Math.imul(fr,Hr),q=q+Math.imul(He,Gr)|0,_=_+Math.imul(He,$r)|0,_=_+Math.imul(ze,Gr)|0,j=j+Math.imul(ze,$r)|0,q=q+Math.imul(Pe,Wr)|0,_=_+Math.imul(Pe,Yr)|0,_=_+Math.imul(Ve,Wr)|0,j=j+Math.imul(Ve,Yr)|0,q=q+Math.imul(we,Xr)|0,_=_+Math.imul(we,lr)|0,_=_+Math.imul(_e,Xr)|0,j=j+Math.imul(_e,lr)|0;var x2=(V+q|0)+((_&8191)<<13)|0;V=(j+(_>>>13)|0)+(x2>>>26)|0,x2&=67108863,q=Math.imul(tr,Gr),_=Math.imul(tr,$r),_=_+Math.imul(fr,Gr)|0,j=Math.imul(fr,$r),q=q+Math.imul(He,Wr)|0,_=_+Math.imul(He,Yr)|0,_=_+Math.imul(ze,Wr)|0,j=j+Math.imul(ze,Yr)|0,q=q+Math.imul(Pe,Xr)|0,_=_+Math.imul(Pe,lr)|0,_=_+Math.imul(Ve,Xr)|0,j=j+Math.imul(Ve,lr)|0;var Ti=(V+q|0)+((_&8191)<<13)|0;V=(j+(_>>>13)|0)+(Ti>>>26)|0,Ti&=67108863,q=Math.imul(tr,Wr),_=Math.imul(tr,Yr),_=_+Math.imul(fr,Wr)|0,j=Math.imul(fr,Yr),q=q+Math.imul(He,Xr)|0,_=_+Math.imul(He,lr)|0,_=_+Math.imul(ze,Xr)|0,j=j+Math.imul(ze,lr)|0;var A2=(V+q|0)+((_&8191)<<13)|0;V=(j+(_>>>13)|0)+(A2>>>26)|0,A2&=67108863,q=Math.imul(tr,Xr),_=Math.imul(tr,lr),_=_+Math.imul(fr,Xr)|0,j=Math.imul(fr,lr);var I2=(V+q|0)+((_&8191)<<13)|0;return V=(j+(_>>>13)|0)+(I2>>>26)|0,I2&=67108863,Y[0]=Ch,Y[1]=l2,Y[2]=d2,Y[3]=h2,Y[4]=p2,Y[5]=y2,Y[6]=Oo,Y[7]=g2,Y[8]=m2,Y[9]=b2,Y[10]=v2,Y[11]=w2,Y[12]=_2,Y[13]=E2,Y[14]=S2,Y[15]=x2,Y[16]=Ti,Y[17]=A2,Y[18]=I2,V!==0&&(Y[19]=V,S.length++),S};Math.imul||(y=p);function b(P,g,w){w.negative=g.negative^P.negative,w.length=P.length+g.length;for(var S=0,C=0,L=0;L<w.length-1;L++){var Y=C;C=0;for(var V=S&67108863,q=Math.min(L,g.length-1),_=Math.max(0,L-P.length+1);_<=q;_++){var j=L-_,de=P.words[j]|0,Q=g.words[_]|0,ue=de*Q,le=ue&67108863;Y=Y+(ue/67108864|0)|0,le=le+V|0,V=le&67108863,Y=Y+(le>>>26)|0,C+=Y>>>26,Y&=67108863}w.words[L]=V,S=Y,Y=C}return S!==0?w.words[L]=S:w.length--,w.strip()}function E(P,g,w){var S=new v;return S.mulp(P,g,w)}n.prototype.mulTo=function(g,w){var S,C=this.length+g.length;return this.length===10&&g.length===10?S=y(this,g,w):C<63?S=p(this,g,w):C<1024?S=b(this,g,w):S=E(this,g,w),S};function v(P,g){this.x=P,this.y=g}v.prototype.makeRBT=function(g){for(var w=new Array(g),S=n.prototype._countBits(g)-1,C=0;C<g;C++)w[C]=this.revBin(C,S,g);return w},v.prototype.revBin=function(g,w,S){if(g===0||g===S-1)return g;for(var C=0,L=0;L<w;L++)C|=(g&1)<<w-L-1,g>>=1;return C},v.prototype.permute=function(g,w,S,C,L,Y){for(var V=0;V<Y;V++)C[V]=w[g[V]],L[V]=S[g[V]]},v.prototype.transform=function(g,w,S,C,L,Y){this.permute(Y,g,w,S,C,L);for(var V=1;V<L;V<<=1)for(var q=V<<1,_=Math.cos(2*Math.PI/q),j=Math.sin(2*Math.PI/q),de=0;de<L;de+=q)for(var Q=_,ue=j,le=0;le<V;le++){var me=S[de+le],be=C[de+le],xe=S[de+le+V],k=C[de+le+V],K=Q*xe-ue*k;k=Q*k+ue*xe,xe=K,S[de+le]=me+xe,C[de+le]=be+k,S[de+le+V]=me-xe,C[de+le+V]=be-k,le!==q&&(K=_*Q-j*ue,ue=_*ue+j*Q,Q=K)}},v.prototype.guessLen13b=function(g,w){var S=Math.max(w,g)|1,C=S&1,L=0;for(S=S/2|0;S;S=S>>>1)L++;return 1<<L+1+C},v.prototype.conjugate=function(g,w,S){if(!(S<=1))for(var C=0;C<S/2;C++){var L=g[C];g[C]=g[S-C-1],g[S-C-1]=L,L=w[C],w[C]=-w[S-C-1],w[S-C-1]=-L}},v.prototype.normalize13b=function(g,w){for(var S=0,C=0;C<w/2;C++){var L=Math.round(g[2*C+1]/w)*8192+Math.round(g[2*C]/w)+S;g[C]=L&67108863,L<67108864?S=0:S=L/67108864|0}return g},v.prototype.convert13b=function(g,w,S,C){for(var L=0,Y=0;Y<w;Y++)L=L+(g[Y]|0),S[2*Y]=L&8191,L=L>>>13,S[2*Y+1]=L&8191,L=L>>>13;for(Y=2*w;Y<C;++Y)S[Y]=0;r(L===0),r((L&~8191)==0)},v.prototype.stub=function(g){for(var w=new Array(g),S=0;S<g;S++)w[S]=0;return w},v.prototype.mulp=function(g,w,S){var C=2*this.guessLen13b(g.length,w.length),L=this.makeRBT(C),Y=this.stub(C),V=new Array(C),q=new Array(C),_=new Array(C),j=new Array(C),de=new Array(C),Q=new Array(C),ue=S.words;ue.length=C,this.convert13b(g.words,g.length,V,C),this.convert13b(w.words,w.length,j,C),this.transform(V,Y,q,_,C,L),this.transform(j,Y,de,Q,C,L);for(var le=0;le<C;le++){var me=q[le]*de[le]-_[le]*Q[le];_[le]=q[le]*Q[le]+_[le]*de[le],q[le]=me}return this.conjugate(q,_,C),this.transform(q,_,ue,Y,C,L),this.conjugate(ue,Y,C),this.normalize13b(ue,C),S.negative=g.negative^w.negative,S.length=g.length+w.length,S.strip()},n.prototype.mul=function(g){var w=new n(null);return w.words=new Array(this.length+g.length),this.mulTo(g,w)},n.prototype.mulf=function(g){var w=new n(null);return w.words=new Array(this.length+g.length),E(this,g,w)},n.prototype.imul=function(g){return this.clone().mulTo(g,this)},n.prototype.imuln=function(g){r(typeof g=="number"),r(g<67108864);for(var w=0,S=0;S<this.length;S++){var C=(this.words[S]|0)*g,L=(C&67108863)+(w&67108863);w>>=26,w+=C/67108864|0,w+=L>>>26,this.words[S]=L&67108863}return w!==0&&(this.words[S]=w,this.length++),this},n.prototype.muln=function(g){return this.clone().imuln(g)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(g){var w=h(g);if(w.length===0)return new n(1);for(var S=this,C=0;C<w.length&&w[C]===0;C++,S=S.sqr());if(++C<w.length)for(var L=S.sqr();C<w.length;C++,L=L.sqr())w[C]!==0&&(S=S.mul(L));return S},n.prototype.iushln=function(g){r(typeof g=="number"&&g>=0);var w=g%26,S=(g-w)/26,C=67108863>>>26-w<<26-w,L;if(w!==0){var Y=0;for(L=0;L<this.length;L++){var V=this.words[L]&C,q=(this.words[L]|0)-V<<w;this.words[L]=q|Y,Y=V>>>26-w}Y&&(this.words[L]=Y,this.length++)}if(S!==0){for(L=this.length-1;L>=0;L--)this.words[L+S]=this.words[L];for(L=0;L<S;L++)this.words[L]=0;this.length+=S}return this.strip()},n.prototype.ishln=function(g){return r(this.negative===0),this.iushln(g)},n.prototype.iushrn=function(g,w,S){r(typeof g=="number"&&g>=0);var C;w?C=(w-w%26)/26:C=0;var L=g%26,Y=Math.min((g-L)/26,this.length),V=67108863^67108863>>>L<<L,q=S;if(C-=Y,C=Math.max(0,C),q){for(var _=0;_<Y;_++)q.words[_]=this.words[_];q.length=Y}if(Y!==0)if(this.length>Y)for(this.length-=Y,_=0;_<this.length;_++)this.words[_]=this.words[_+Y];else this.words[0]=0,this.length=1;var j=0;for(_=this.length-1;_>=0&&(j!==0||_>=C);_--){var de=this.words[_]|0;this.words[_]=j<<26-L|de>>>L,j=de&V}return q&&j!==0&&(q.words[q.length++]=j),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(g,w,S){return r(this.negative===0),this.iushrn(g,w,S)},n.prototype.shln=function(g){return this.clone().ishln(g)},n.prototype.ushln=function(g){return this.clone().iushln(g)},n.prototype.shrn=function(g){return this.clone().ishrn(g)},n.prototype.ushrn=function(g){return this.clone().iushrn(g)},n.prototype.testn=function(g){r(typeof g=="number"&&g>=0);var w=g%26,S=(g-w)/26,C=1<<w;if(this.length<=S)return!1;var L=this.words[S];return!!(L&C)},n.prototype.imaskn=function(g){r(typeof g=="number"&&g>=0);var w=g%26,S=(g-w)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=S)return this;if(w!==0&&S++,this.length=Math.min(S,this.length),w!==0){var C=67108863^67108863>>>w<<w;this.words[this.length-1]&=C}return this.strip()},n.prototype.maskn=function(g){return this.clone().imaskn(g)},n.prototype.iaddn=function(g){return r(typeof g=="number"),r(g<67108864),g<0?this.isubn(-g):this.negative!==0?this.length===1&&(this.words[0]|0)<g?(this.words[0]=g-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(g),this.negative=1,this):this._iaddn(g)},n.prototype._iaddn=function(g){this.words[0]+=g;for(var w=0;w<this.length&&this.words[w]>=67108864;w++)this.words[w]-=67108864,w===this.length-1?this.words[w+1]=1:this.words[w+1]++;return this.length=Math.max(this.length,w+1),this},n.prototype.isubn=function(g){if(r(typeof g=="number"),r(g<67108864),g<0)return this.iaddn(-g);if(this.negative!==0)return this.negative=0,this.iaddn(g),this.negative=1,this;if(this.words[0]-=g,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var w=0;w<this.length&&this.words[w]<0;w++)this.words[w]+=67108864,this.words[w+1]-=1;return this.strip()},n.prototype.addn=function(g){return this.clone().iaddn(g)},n.prototype.subn=function(g){return this.clone().isubn(g)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(g,w,S){var C=g.length+S,L;this._expand(C);var Y,V=0;for(L=0;L<g.length;L++){Y=(this.words[L+S]|0)+V;var q=(g.words[L]|0)*w;Y-=q&67108863,V=(Y>>26)-(q/67108864|0),this.words[L+S]=Y&67108863}for(;L<this.length-S;L++)Y=(this.words[L+S]|0)+V,V=Y>>26,this.words[L+S]=Y&67108863;if(V===0)return this.strip();for(r(V===-1),V=0,L=0;L<this.length;L++)Y=-(this.words[L]|0)+V,V=Y>>26,this.words[L]=Y&67108863;return this.negative=1,this.strip()},n.prototype._wordDiv=function(g,w){var S=this.length-g.length,C=this.clone(),L=g,Y=L.words[L.length-1]|0,V=this._countBits(Y);S=26-V,S!==0&&(L=L.ushln(S),C.iushln(S),Y=L.words[L.length-1]|0);var q=C.length-L.length,_;if(w!=="mod"){_=new n(null),_.length=q+1,_.words=new Array(_.length);for(var j=0;j<_.length;j++)_.words[j]=0}var de=C.clone()._ishlnsubmul(L,1,q);de.negative===0&&(C=de,_&&(_.words[q]=1));for(var Q=q-1;Q>=0;Q--){var ue=(C.words[L.length+Q]|0)*67108864+(C.words[L.length+Q-1]|0);for(ue=Math.min(ue/Y|0,67108863),C._ishlnsubmul(L,ue,Q);C.negative!==0;)ue--,C.negative=0,C._ishlnsubmul(L,1,Q),C.isZero()||(C.negative^=1);_&&(_.words[Q]=ue)}return _&&_.strip(),C.strip(),w!=="div"&&S!==0&&C.iushrn(S),{div:_||null,mod:C}},n.prototype.divmod=function(g,w,S){if(r(!g.isZero()),this.isZero())return{div:new n(0),mod:new n(0)};var C,L,Y;return this.negative!==0&&g.negative===0?(Y=this.neg().divmod(g,w),w!=="mod"&&(C=Y.div.neg()),w!=="div"&&(L=Y.mod.neg(),S&&L.negative!==0&&L.iadd(g)),{div:C,mod:L}):this.negative===0&&g.negative!==0?(Y=this.divmod(g.neg(),w),w!=="mod"&&(C=Y.div.neg()),{div:C,mod:Y.mod}):(this.negative&g.negative)!=0?(Y=this.neg().divmod(g.neg(),w),w!=="div"&&(L=Y.mod.neg(),S&&L.negative!==0&&L.isub(g)),{div:Y.div,mod:L}):g.length>this.length||this.cmp(g)<0?{div:new n(0),mod:this}:g.length===1?w==="div"?{div:this.divn(g.words[0]),mod:null}:w==="mod"?{div:null,mod:new n(this.modn(g.words[0]))}:{div:this.divn(g.words[0]),mod:new n(this.modn(g.words[0]))}:this._wordDiv(g,w)},n.prototype.div=function(g){return this.divmod(g,"div",!1).div},n.prototype.mod=function(g){return this.divmod(g,"mod",!1).mod},n.prototype.umod=function(g){return this.divmod(g,"mod",!0).mod},n.prototype.divRound=function(g){var w=this.divmod(g);if(w.mod.isZero())return w.div;var S=w.div.negative!==0?w.mod.isub(g):w.mod,C=g.ushrn(1),L=g.andln(1),Y=S.cmp(C);return Y<0||L===1&&Y===0?w.div:w.div.negative!==0?w.div.isubn(1):w.div.iaddn(1)},n.prototype.modn=function(g){r(g<=67108863);for(var w=(1<<26)%g,S=0,C=this.length-1;C>=0;C--)S=(w*S+(this.words[C]|0))%g;return S},n.prototype.idivn=function(g){r(g<=67108863);for(var w=0,S=this.length-1;S>=0;S--){var C=(this.words[S]|0)+w*67108864;this.words[S]=C/g|0,w=C%g}return this.strip()},n.prototype.divn=function(g){return this.clone().idivn(g)},n.prototype.egcd=function(g){r(g.negative===0),r(!g.isZero());var w=this,S=g.clone();w.negative!==0?w=w.umod(g):w=w.clone();for(var C=new n(1),L=new n(0),Y=new n(0),V=new n(1),q=0;w.isEven()&&S.isEven();)w.iushrn(1),S.iushrn(1),++q;for(var _=S.clone(),j=w.clone();!w.isZero();){for(var de=0,Q=1;(w.words[0]&Q)==0&&de<26;++de,Q<<=1);if(de>0)for(w.iushrn(de);de-- >0;)(C.isOdd()||L.isOdd())&&(C.iadd(_),L.isub(j)),C.iushrn(1),L.iushrn(1);for(var ue=0,le=1;(S.words[0]&le)==0&&ue<26;++ue,le<<=1);if(ue>0)for(S.iushrn(ue);ue-- >0;)(Y.isOdd()||V.isOdd())&&(Y.iadd(_),V.isub(j)),Y.iushrn(1),V.iushrn(1);w.cmp(S)>=0?(w.isub(S),C.isub(Y),L.isub(V)):(S.isub(w),Y.isub(C),V.isub(L))}return{a:Y,b:V,gcd:S.iushln(q)}},n.prototype._invmp=function(g){r(g.negative===0),r(!g.isZero());var w=this,S=g.clone();w.negative!==0?w=w.umod(g):w=w.clone();for(var C=new n(1),L=new n(0),Y=S.clone();w.cmpn(1)>0&&S.cmpn(1)>0;){for(var V=0,q=1;(w.words[0]&q)==0&&V<26;++V,q<<=1);if(V>0)for(w.iushrn(V);V-- >0;)C.isOdd()&&C.iadd(Y),C.iushrn(1);for(var _=0,j=1;(S.words[0]&j)==0&&_<26;++_,j<<=1);if(_>0)for(S.iushrn(_);_-- >0;)L.isOdd()&&L.iadd(Y),L.iushrn(1);w.cmp(S)>=0?(w.isub(S),C.isub(L)):(S.isub(w),L.isub(C))}var de;return w.cmpn(1)===0?de=C:de=L,de.cmpn(0)<0&&de.iadd(g),de},n.prototype.gcd=function(g){if(this.isZero())return g.abs();if(g.isZero())return this.abs();var w=this.clone(),S=g.clone();w.negative=0,S.negative=0;for(var C=0;w.isEven()&&S.isEven();C++)w.iushrn(1),S.iushrn(1);do{for(;w.isEven();)w.iushrn(1);for(;S.isEven();)S.iushrn(1);var L=w.cmp(S);if(L<0){var Y=w;w=S,S=Y}else if(L===0||S.cmpn(1)===0)break;w.isub(S)}while(!0);return S.iushln(C)},n.prototype.invm=function(g){return this.egcd(g).a.umod(g)},n.prototype.isEven=function(){return(this.words[0]&1)==0},n.prototype.isOdd=function(){return(this.words[0]&1)==1},n.prototype.andln=function(g){return this.words[0]&g},n.prototype.bincn=function(g){r(typeof g=="number");var w=g%26,S=(g-w)/26,C=1<<w;if(this.length<=S)return this._expand(S+1),this.words[S]|=C,this;for(var L=C,Y=S;L!==0&&Y<this.length;Y++){var V=this.words[Y]|0;V+=L,L=V>>>26,V&=67108863,this.words[Y]=V}return L!==0&&(this.words[Y]=L,this.length++),this},n.prototype.isZero=function(){return this.length===1&&this.words[0]===0},n.prototype.cmpn=function(g){var w=g<0;if(this.negative!==0&&!w)return-1;if(this.negative===0&&w)return 1;this.strip();var S;if(this.length>1)S=1;else{w&&(g=-g),r(g<=67108863,"Number is too big");var C=this.words[0]|0;S=C===g?0:C<g?-1:1}return this.negative!==0?-S|0:S},n.prototype.cmp=function(g){if(this.negative!==0&&g.negative===0)return-1;if(this.negative===0&&g.negative!==0)return 1;var w=this.ucmp(g);return this.negative!==0?-w|0:w},n.prototype.ucmp=function(g){if(this.length>g.length)return 1;if(this.length<g.length)return-1;for(var w=0,S=this.length-1;S>=0;S--){var C=this.words[S]|0,L=g.words[S]|0;if(C!==L){C<L?w=-1:C>L&&(w=1);break}}return w},n.prototype.gtn=function(g){return this.cmpn(g)===1},n.prototype.gt=function(g){return this.cmp(g)===1},n.prototype.gten=function(g){return this.cmpn(g)>=0},n.prototype.gte=function(g){return this.cmp(g)>=0},n.prototype.ltn=function(g){return this.cmpn(g)===-1},n.prototype.lt=function(g){return this.cmp(g)===-1},n.prototype.lten=function(g){return this.cmpn(g)<=0},n.prototype.lte=function(g){return this.cmp(g)<=0},n.prototype.eqn=function(g){return this.cmpn(g)===0},n.prototype.eq=function(g){return this.cmp(g)===0},n.red=function(g){return new W(g)},n.prototype.toRed=function(g){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),g.convertTo(this)._forceRed(g)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(g){return this.red=g,this},n.prototype.forceRed=function(g){return r(!this.red,"Already a number in reduction context"),this._forceRed(g)},n.prototype.redAdd=function(g){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,g)},n.prototype.redIAdd=function(g){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,g)},n.prototype.redSub=function(g){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,g)},n.prototype.redISub=function(g){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,g)},n.prototype.redShl=function(g){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,g)},n.prototype.redMul=function(g){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,g),this.red.mul(this,g)},n.prototype.redIMul=function(g){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,g),this.red.imul(this,g)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(g){return r(this.red&&!g.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,g)};var A={k256:null,p224:null,p192:null,p25519:null};function R(P,g){this.name=P,this.p=new n(g,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}R.prototype._tmp=function(){var g=new n(null);return g.words=new Array(Math.ceil(this.n/13)),g},R.prototype.ireduce=function(g){var w=g,S;do this.split(w,this.tmp),w=this.imulK(w),w=w.iadd(this.tmp),S=w.bitLength();while(S>this.n);var C=S<this.n?-1:w.ucmp(this.p);return C===0?(w.words[0]=0,w.length=1):C>0?w.isub(this.p):w.strip!==void 0?w.strip():w._strip(),w},R.prototype.split=function(g,w){g.iushrn(this.n,0,w)},R.prototype.imulK=function(g){return g.imul(this.k)};function F(){R.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(F,R),F.prototype.split=function(g,w){for(var S=4194303,C=Math.min(g.length,9),L=0;L<C;L++)w.words[L]=g.words[L];if(w.length=C,g.length<=9){g.words[0]=0,g.length=1;return}var Y=g.words[9];for(w.words[w.length++]=Y&S,L=10;L<g.length;L++){var V=g.words[L]|0;g.words[L-10]=(V&S)<<4|Y>>>22,Y=V}Y>>>=22,g.words[L-10]=Y,Y===0&&g.length>10?g.length-=10:g.length-=9},F.prototype.imulK=function(g){g.words[g.length]=0,g.words[g.length+1]=0,g.length+=2;for(var w=0,S=0;S<g.length;S++){var C=g.words[S]|0;w+=C*977,g.words[S]=w&67108863,w=C*64+(w/67108864|0)}return g.words[g.length-1]===0&&(g.length--,g.words[g.length-1]===0&&g.length--),g};function D(){R.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i(D,R);function B(){R.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(B,R);function H(){R.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i(H,R),H.prototype.imulK=function(g){for(var w=0,S=0;S<g.length;S++){var C=(g.words[S]|0)*19+w,L=C&67108863;C>>>=26,g.words[S]=L,w=C}return w!==0&&(g.words[g.length++]=w),g},n._prime=function(g){if(A[g])return A[g];var w;if(g==="k256")w=new F;else if(g==="p224")w=new D;else if(g==="p192")w=new B;else if(g==="p25519")w=new H;else throw new Error("Unknown prime "+g);return A[g]=w,w};function W(P){if(typeof P=="string"){var g=n._prime(P);this.m=g.p,this.prime=g}else r(P.gtn(1),"modulus must be greater than 1"),this.m=P,this.prime=null}W.prototype._verify1=function(g){r(g.negative===0,"red works only with positives"),r(g.red,"red works only with red numbers")},W.prototype._verify2=function(g,w){r((g.negative|w.negative)==0,"red works only with positives"),r(g.red&&g.red===w.red,"red works only with red numbers")},W.prototype.imod=function(g){return this.prime?this.prime.ireduce(g)._forceRed(this):g.umod(this.m)._forceRed(this)},W.prototype.neg=function(g){return g.isZero()?g.clone():this.m.sub(g)._forceRed(this)},W.prototype.add=function(g,w){this._verify2(g,w);var S=g.add(w);return S.cmp(this.m)>=0&&S.isub(this.m),S._forceRed(this)},W.prototype.iadd=function(g,w){this._verify2(g,w);var S=g.iadd(w);return S.cmp(this.m)>=0&&S.isub(this.m),S},W.prototype.sub=function(g,w){this._verify2(g,w);var S=g.sub(w);return S.cmpn(0)<0&&S.iadd(this.m),S._forceRed(this)},W.prototype.isub=function(g,w){this._verify2(g,w);var S=g.isub(w);return S.cmpn(0)<0&&S.iadd(this.m),S},W.prototype.shl=function(g,w){return this._verify1(g),this.imod(g.ushln(w))},W.prototype.imul=function(g,w){return this._verify2(g,w),this.imod(g.imul(w))},W.prototype.mul=function(g,w){return this._verify2(g,w),this.imod(g.mul(w))},W.prototype.isqr=function(g){return this.imul(g,g.clone())},W.prototype.sqr=function(g){return this.mul(g,g)},W.prototype.sqrt=function(g){if(g.isZero())return g.clone();var w=this.m.andln(3);if(r(w%2==1),w===3){var S=this.m.add(new n(1)).iushrn(2);return this.pow(g,S)}for(var C=this.m.subn(1),L=0;!C.isZero()&&C.andln(1)===0;)L++,C.iushrn(1);r(!C.isZero());var Y=new n(1).toRed(this),V=Y.redNeg(),q=this.m.subn(1).iushrn(1),_=this.m.bitLength();for(_=new n(2*_*_).toRed(this);this.pow(_,q).cmp(V)!==0;)_.redIAdd(V);for(var j=this.pow(_,C),de=this.pow(g,C.addn(1).iushrn(1)),Q=this.pow(g,C),ue=L;Q.cmp(Y)!==0;){for(var le=Q,me=0;le.cmp(Y)!==0;me++)le=le.redSqr();r(me<ue);var be=this.pow(j,new n(1).iushln(ue-me-1));de=de.redMul(be),j=be.redSqr(),Q=Q.redMul(j),ue=me}return de},W.prototype.invm=function(g){var w=g._invmp(this.m);return w.negative!==0?(w.negative=0,this.imod(w).redNeg()):this.imod(w)},W.prototype.pow=function(g,w){if(w.isZero())return new n(1).toRed(this);if(w.cmpn(1)===0)return g.clone();var S=4,C=new Array(1<<S);C[0]=new n(1).toRed(this),C[1]=g;for(var L=2;L<C.length;L++)C[L]=this.mul(C[L-1],g);var Y=C[0],V=0,q=0,_=w.bitLength()%26;for(_===0&&(_=26),L=w.length-1;L>=0;L--){for(var j=w.words[L],de=_-1;de>=0;de--){var Q=j>>de&1;if(Y!==C[0]&&(Y=this.sqr(Y)),Q===0&&V===0){q=0;continue}V<<=1,V|=Q,q++,!(q!==S&&(L!==0||de!==0))&&(Y=this.mul(Y,C[V]),q=0,V=0)}_=26}return Y},W.prototype.convertTo=function(g){var w=g.umod(this.m);return w===g?w.clone():w},W.prototype.convertFrom=function(g){var w=g.clone();return w.red=null,w},n.mont=function(g){return new X(g)};function X(P){W.call(this,P),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(X,W),X.prototype.convertTo=function(g){return this.imod(g.ushln(this.shift))},X.prototype.convertFrom=function(g){var w=this.imod(g.mul(this.rinv));return w.red=null,w},X.prototype.imul=function(g,w){if(g.isZero()||w.isZero())return g.words[0]=0,g.length=1,g;var S=g.imul(w),C=S.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),L=S.isub(C).iushrn(this.shift),Y=L;return L.cmp(this.m)>=0?Y=L.isub(this.m):L.cmpn(0)<0&&(Y=L.iadd(this.m)),Y._forceRed(this)},X.prototype.mul=function(g,w){if(g.isZero()||w.isZero())return new n(0)._forceRed(this);var S=g.mul(w),C=S.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),L=S.isub(C).iushrn(this.shift),Y=L;return L.cmp(this.m)>=0?Y=L.isub(this.m):L.cmpn(0)<0&&(Y=L.iadd(this.m)),Y._forceRed(this)},X.prototype.invm=function(g){var w=this.imod(g._invmp(this.m).mul(this.r2));return w._forceRed(this)}})(typeof M_=="undefined"||M_,pU)});var bf=m((hot,gU)=>{l();gU.exports=yU;function yU(t,e){if(!t)throw new Error(e||"Assertion failed")}yU.equal=function(e,r,i){if(e!=r)throw new Error(i||"Assertion failed: "+e+" != "+r)}});var L_=m(vU=>{l();"use strict";var l4=vU;function YEe(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t!="string"){for(var i=0;i<t.length;i++)r[i]=t[i]|0;return r}if(e==="hex"){t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!=0&&(t="0"+t);for(var i=0;i<t.length;i+=2)r.push(parseInt(t[i]+t[i+1],16))}else for(var i=0;i<t.length;i++){var n=t.charCodeAt(i),s=n>>8,o=n&255;s?r.push(s,o):r.push(o)}return r}l4.toArray=YEe;function mU(t){return t.length===1?"0"+t:t}l4.zero2=mU;function bU(t){for(var e="",r=0;r<t.length;r++)e+=mU(t[r].toString(16));return e}l4.toHex=bU;l4.encode=function(e,r){return r==="hex"?bU(e):e}});var Ss=m(wU=>{l();"use strict";var Go=wU,XEe=Va(),QEe=bf(),d4=L_();Go.assert=QEe;Go.toArray=d4.toArray;Go.zero2=d4.zero2;Go.toHex=d4.toHex;Go.encode=d4.encode;function ZEe(t,e,r){var i=new Array(Math.max(t.bitLength(),r)+1);i.fill(0);for(var n=1<<e+1,s=t.clone(),o=0;o<i.length;o++){var a,c=s.andln(n-1);s.isOdd()?(c>(n>>1)-1?a=(n>>1)-c:a=c,s.isubn(a)):a=0,i[o]=a,s.iushrn(1)}return i}Go.getNAF=ZEe;function JEe(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var i=0,n=0,s;t.cmpn(-i)>0||e.cmpn(-n)>0;){var o=t.andln(3)+i&3,a=e.andln(3)+n&3;o===3&&(o=-1),a===3&&(a=-1);var c;(o&1)==0?c=0:(s=t.andln(7)+i&7,(s===3||s===5)&&a===2?c=-o:c=o),r[0].push(c);var u;(a&1)==0?u=0:(s=e.andln(7)+n&7,(s===3||s===5)&&o===2?u=-a:u=a),r[1].push(u),2*i===c+1&&(i=1-i),2*n===u+1&&(n=1-n),t.iushrn(1),e.iushrn(1)}return r}Go.getJSF=JEe;function eSe(t,e,r){var i="_"+e;t.prototype[e]=function(){return this[i]!==void 0?this[i]:this[i]=r.call(this)}}Go.cachedProperty=eSe;function tSe(t){return typeof t=="string"?Go.toArray(t,"hex"):t}Go.parseBytes=tSe;function rSe(t){return new XEe(t,"hex","le")}Go.intFromLE=rSe});var F_=m((got,U_)=>{l();var q_;U_.exports=function(e){return q_||(q_=new vf(null)),q_.generate(e)};function vf(t){this.rand=t}U_.exports.Rand=vf;vf.prototype.generate=function(e){return this._rand(e)};vf.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),i=0;i<r.length;i++)r[i]=this.rand.getByte();return r};if(typeof self=="object")self.crypto&&self.crypto.getRandomValues?vf.prototype._rand=function(e){var r=new Uint8Array(e);return self.crypto.getRandomValues(r),r}:self.msCrypto&&self.msCrypto.getRandomValues?vf.prototype._rand=function(e){var r=new Uint8Array(e);return self.msCrypto.getRandomValues(r),r}:typeof window=="object"&&(vf.prototype._rand=function(){throw new Error("Not implemented yet")});else try{if(j_=E0(),typeof j_.randomBytes!="function")throw new Error("Not supported");vf.prototype._rand=function(e){return j_.randomBytes(e)}}catch(t){}var j_});var Iy=m((mot,_U)=>{l();"use strict";var zl=Va(),Ay=Ss(),h4=Ay.getNAF,iSe=Ay.getJSF,p4=Ay.assert;function wf(t,e){this.type=t,this.p=new zl(e.p,16),this.red=e.prime?zl.red(e.prime):zl.mont(this.p),this.zero=new zl(0).toRed(this.red),this.one=new zl(1).toRed(this.red),this.two=new zl(2).toRed(this.red),this.n=e.n&&new zl(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}_U.exports=wf;wf.prototype.point=function(){throw new Error("Not implemented")};wf.prototype.validate=function(){throw new Error("Not implemented")};wf.prototype._fixedNafMul=function(e,r){p4(e.precomputed);var i=e._getDoubles(),n=h4(r,1,this._bitLength),s=(1<<i.step+1)-(i.step%2==0?2:1);s/=3;var o=[],a,c;for(a=0;a<n.length;a+=i.step){c=0;for(var u=a+i.step-1;u>=a;u--)c=(c<<1)+n[u];o.push(c)}for(var f=this.jpoint(null,null,null),d=this.jpoint(null,null,null),h=s;h>0;h--){for(a=0;a<o.length;a++)c=o[a],c===h?d=d.mixedAdd(i.points[a]):c===-h&&(d=d.mixedAdd(i.points[a].neg()));f=f.add(d)}return f.toP()};wf.prototype._wnafMul=function(e,r){var i=4,n=e._getNAFPoints(i);i=n.wnd;for(var s=n.points,o=h4(r,i,this._bitLength),a=this.jpoint(null,null,null),c=o.length-1;c>=0;c--){for(var u=0;c>=0&&o[c]===0;c--)u++;if(c>=0&&u++,a=a.dblp(u),c<0)break;var f=o[c];p4(f!==0),e.type==="affine"?f>0?a=a.mixedAdd(s[f-1>>1]):a=a.mixedAdd(s[-f-1>>1].neg()):f>0?a=a.add(s[f-1>>1]):a=a.add(s[-f-1>>1].neg())}return e.type==="affine"?a.toP():a};wf.prototype._wnafMulAdd=function(e,r,i,n,s){var o=this._wnafT1,a=this._wnafT2,c=this._wnafT3,u=0,f,d,h;for(f=0;f<n;f++){h=r[f];var p=h._getNAFPoints(e);o[f]=p.wnd,a[f]=p.points}for(f=n-1;f>=1;f-=2){var y=f-1,b=f;if(o[y]!==1||o[b]!==1){c[y]=h4(i[y],o[y],this._bitLength),c[b]=h4(i[b],o[b],this._bitLength),u=Math.max(c[y].length,u),u=Math.max(c[b].length,u);continue}var E=[r[y],null,null,r[b]];r[y].y.cmp(r[b].y)===0?(E[1]=r[y].add(r[b]),E[2]=r[y].toJ().mixedAdd(r[b].neg())):r[y].y.cmp(r[b].y.redNeg())===0?(E[1]=r[y].toJ().mixedAdd(r[b]),E[2]=r[y].add(r[b].neg())):(E[1]=r[y].toJ().mixedAdd(r[b]),E[2]=r[y].toJ().mixedAdd(r[b].neg()));var v=[-3,-1,-5,-7,0,7,5,1,3],A=iSe(i[y],i[b]);for(u=Math.max(A[0].length,u),c[y]=new Array(u),c[b]=new Array(u),d=0;d<u;d++){var R=A[0][d]|0,F=A[1][d]|0;c[y][d]=v[(R+1)*3+(F+1)],c[b][d]=0,a[y]=E}}var D=this.jpoint(null,null,null),B=this._wnafT4;for(f=u;f>=0;f--){for(var H=0;f>=0;){var W=!0;for(d=0;d<n;d++)B[d]=c[d][f]|0,B[d]!==0&&(W=!1);if(!W)break;H++,f--}if(f>=0&&H++,D=D.dblp(H),f<0)break;for(d=0;d<n;d++){var X=B[d];X!==0&&(X>0?h=a[d][X-1>>1]:X<0&&(h=a[d][-X-1>>1].neg()),h.type==="affine"?D=D.mixedAdd(h):D=D.add(h))}}for(f=0;f<n;f++)a[f]=null;return s?D:D.toP()};function Js(t,e){this.curve=t,this.type=e,this.precomputed=null}wf.BasePoint=Js;Js.prototype.eq=function(){throw new Error("Not implemented")};Js.prototype.validate=function(){return this.curve.validate(this)};wf.prototype.decodePoint=function(e,r){e=Ay.toArray(e,r);var i=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1==2*i){e[0]===6?p4(e[e.length-1]%2==0):e[0]===7&&p4(e[e.length-1]%2==1);var n=this.point(e.slice(1,1+i),e.slice(1+i,1+2*i));return n}else if((e[0]===2||e[0]===3)&&e.length-1===i)return this.pointFromX(e.slice(1,1+i),e[0]===3);throw new Error("Unknown point format")};Js.prototype.encodeCompressed=function(e){return this.encode(e,!0)};Js.prototype._encode=function(e){var r=this.curve.p.byteLength(),i=this.getX().toArray("be",r);return e?[this.getY().isEven()?2:3].concat(i):[4].concat(i,this.getY().toArray("be",r))};Js.prototype.encode=function(e,r){return Ay.encode(this._encode(r),e)};Js.prototype.precompute=function(e){if(this.precomputed)return this;var r={doubles:null,naf:null,beta:null};return r.naf=this._getNAFPoints(8),r.doubles=this._getDoubles(4,e),r.beta=this._getBeta(),this.precomputed=r,this};Js.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var r=this.precomputed.doubles;return r?r.points.length>=Math.ceil((e.bitLength()+1)/r.step):!1};Js.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var i=[this],n=this,s=0;s<r;s+=e){for(var o=0;o<e;o++)n=n.dbl();i.push(n)}return{step:e,points:i}};Js.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var r=[this],i=(1<<e)-1,n=i===1?null:this.dbl(),s=1;s<i;s++)r[s]=r[s-1].add(n);return{wnd:e,points:r}};Js.prototype._getBeta=function(){return null};Js.prototype.dblp=function(e){for(var r=this,i=0;i<e;i++)r=r.dbl();return r}});var on=m((bot,K_)=>{l();typeof Object.create=="function"?K_.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:K_.exports=function(e,r){if(r){e.super_=r;var i=function(){};i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}}});var SU=m((vot,EU)=>{l();"use strict";var nSe=Ss(),Zr=Va(),V_=on(),O0=Iy(),sSe=nSe.assert;function eo(t){O0.call(this,"short",t),this.a=new Zr(t.a,16).toRed(this.red),this.b=new Zr(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}V_(eo,O0);EU.exports=eo;eo.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var r,i;if(e.beta)r=new Zr(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);r=n[0].cmp(n[1])<0?n[0]:n[1],r=r.toRed(this.red)}if(e.lambda)i=new Zr(e.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(r))===0?i=s[0]:(i=s[1],sSe(this.g.mul(i).x.cmp(this.g.x.redMul(r))===0))}var o;return e.basis?o=e.basis.map(function(a){return{a:new Zr(a.a,16),b:new Zr(a.b,16)}}):o=this._getEndoBasis(i),{beta:r,lambda:i,basis:o}}};eo.prototype._getEndoRoots=function(e){var r=e===this.p?this.red:Zr.mont(e),i=new Zr(2).toRed(r).redInvm(),n=i.redNeg(),s=new Zr(3).toRed(r).redNeg().redSqrt().redMul(i),o=n.redAdd(s).fromRed(),a=n.redSub(s).fromRed();return[o,a]};eo.prototype._getEndoBasis=function(e){for(var r=this.n.ushrn(Math.floor(this.n.bitLength()/2)),i=e,n=this.n.clone(),s=new Zr(1),o=new Zr(0),a=new Zr(0),c=new Zr(1),u,f,d,h,p,y,b,E=0,v,A;i.cmpn(0)!==0;){var R=n.div(i);v=n.sub(R.mul(i)),A=a.sub(R.mul(s));var F=c.sub(R.mul(o));if(!d&&v.cmp(r)<0)u=b.neg(),f=s,d=v.neg(),h=A;else if(d&&++E==2)break;b=v,n=i,i=v,a=s,s=A,c=o,o=F}p=v.neg(),y=A;var D=d.sqr().add(h.sqr()),B=p.sqr().add(y.sqr());return B.cmp(D)>=0&&(p=u,y=f),d.negative&&(d=d.neg(),h=h.neg()),p.negative&&(p=p.neg(),y=y.neg()),[{a:d,b:h},{a:p,b:y}]};eo.prototype._endoSplit=function(e){var r=this.endo.basis,i=r[0],n=r[1],s=n.b.mul(e).divRound(this.n),o=i.b.neg().mul(e).divRound(this.n),a=s.mul(i.a),c=o.mul(n.a),u=s.mul(i.b),f=o.mul(n.b),d=e.sub(a).sub(c),h=u.add(f).neg();return{k1:d,k2:h}};eo.prototype.pointFromX=function(e,r){e=new Zr(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=i.redSqrt();if(n.redSqr().redSub(i).cmp(this.zero)!==0)throw new Error("invalid point");var s=n.fromRed().isOdd();return(r&&!s||!r&&s)&&(n=n.redNeg()),this.point(e,n)};eo.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,i=e.y,n=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(n).redIAdd(this.b);return i.redSqr().redISub(s).cmpn(0)===0};eo.prototype._endoWnafMulAdd=function(e,r,i){for(var n=this._endoWnafT1,s=this._endoWnafT2,o=0;o<e.length;o++){var a=this._endoSplit(r[o]),c=e[o],u=c._getBeta();a.k1.negative&&(a.k1.ineg(),c=c.neg(!0)),a.k2.negative&&(a.k2.ineg(),u=u.neg(!0)),n[o*2]=c,n[o*2+1]=u,s[o*2]=a.k1,s[o*2+1]=a.k2}for(var f=this._wnafMulAdd(1,n,s,o*2,i),d=0;d<o*2;d++)n[d]=null,s[d]=null;return f};function Xi(t,e,r,i){O0.BasePoint.call(this,t,"affine"),e===null&&r===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new Zr(e,16),this.y=new Zr(r,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}V_(Xi,O0.BasePoint);eo.prototype.point=function(e,r,i){return new Xi(this,e,r,i)};eo.prototype.pointFromJSON=function(e,r){return Xi.fromJSON(this,e,r)};Xi.prototype._getBeta=function(){if(!!this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var r=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var i=this.curve,n=function(s){return i.point(s.x.redMul(i.endo.beta),s.y)};e.beta=r,r.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return r}};Xi.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]};Xi.fromJSON=function(e,r,i){typeof r=="string"&&(r=JSON.parse(r));var n=e.point(r[0],r[1],i);if(!r[2])return n;function s(a){return e.point(a[0],a[1],i)}var o=r[2];return n.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[n].concat(o.doubles.points.map(s))},naf:o.naf&&{wnd:o.naf.wnd,points:[n].concat(o.naf.points.map(s))}},n};Xi.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"};Xi.prototype.isInfinity=function(){return this.inf};Xi.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var i=r.redSqr().redISub(this.x).redISub(e.x),n=r.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,n)};Xi.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,i=this.x.redSqr(),n=e.redInvm(),s=i.redAdd(i).redIAdd(i).redIAdd(r).redMul(n),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)};Xi.prototype.getX=function(){return this.x.fromRed()};Xi.prototype.getY=function(){return this.y.fromRed()};Xi.prototype.mul=function(e){return e=new Zr(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};Xi.prototype.mulAdd=function(e,r,i){var n=[this,r],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s):this.curve._wnafMulAdd(1,n,s,2)};Xi.prototype.jmulAdd=function(e,r,i){var n=[this,r],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s,!0):this.curve._wnafMulAdd(1,n,s,2,!0)};Xi.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};Xi.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var i=this.precomputed,n=function(s){return s.neg()};r.precomputed={naf:i.naf&&{wnd:i.naf.wnd,points:i.naf.points.map(n)},doubles:i.doubles&&{step:i.doubles.step,points:i.doubles.points.map(n)}}}return r};Xi.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function an(t,e,r,i){O0.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Zr(0)):(this.x=new Zr(e,16),this.y=new Zr(r,16),this.z=new Zr(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}V_(an,O0.BasePoint);eo.prototype.jpoint=function(e,r,i){return new an(this,e,r,i)};an.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),i=this.x.redMul(r),n=this.y.redMul(r).redMul(e);return this.curve.point(i,n)};an.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};an.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),i=this.z.redSqr(),n=this.x.redMul(r),s=e.x.redMul(i),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(i.redMul(this.z)),c=n.redSub(s),u=o.redSub(a);if(c.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var f=c.redSqr(),d=f.redMul(c),h=n.redMul(f),p=u.redSqr().redIAdd(d).redISub(h).redISub(h),y=u.redMul(h.redISub(p)).redISub(o.redMul(d)),b=this.z.redMul(e.z).redMul(c);return this.curve.jpoint(p,y,b)};an.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),i=this.x,n=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=i.redSub(n),c=s.redSub(o);if(a.cmpn(0)===0)return c.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),f=u.redMul(a),d=i.redMul(u),h=c.redSqr().redIAdd(f).redISub(d).redISub(d),p=c.redMul(d.redISub(h)).redISub(s.redMul(f)),y=this.z.redMul(a);return this.curve.jpoint(h,p,y)};an.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var i=this;for(r=0;r<e;r++)i=i.dbl();return i}var n=this.curve.a,s=this.curve.tinv,o=this.x,a=this.y,c=this.z,u=c.redSqr().redSqr(),f=a.redAdd(a);for(r=0;r<e;r++){var d=o.redSqr(),h=f.redSqr(),p=h.redSqr(),y=d.redAdd(d).redIAdd(d).redIAdd(n.redMul(u)),b=o.redMul(h),E=y.redSqr().redISub(b.redAdd(b)),v=b.redISub(E),A=y.redMul(v);A=A.redIAdd(A).redISub(p);var R=f.redMul(c);r+1<e&&(u=u.redMul(p)),o=E,c=R,f=A}return this.curve.jpoint(o,f.redMul(s),c)};an.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()};an.prototype._zeroDbl=function(){var e,r,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),o=s.redSqr(),a=this.x.redAdd(s).redSqr().redISub(n).redISub(o);a=a.redIAdd(a);var c=n.redAdd(n).redIAdd(n),u=c.redSqr().redISub(a).redISub(a),f=o.redIAdd(o);f=f.redIAdd(f),f=f.redIAdd(f),e=u,r=c.redMul(a.redISub(u)).redISub(f),i=this.y.redAdd(this.y)}else{var d=this.x.redSqr(),h=this.y.redSqr(),p=h.redSqr(),y=this.x.redAdd(h).redSqr().redISub(d).redISub(p);y=y.redIAdd(y);var b=d.redAdd(d).redIAdd(d),E=b.redSqr(),v=p.redIAdd(p);v=v.redIAdd(v),v=v.redIAdd(v),e=E.redISub(y).redISub(y),r=b.redMul(y.redISub(e)).redISub(v),i=this.y.redMul(this.z),i=i.redIAdd(i)}return this.curve.jpoint(e,r,i)};an.prototype._threeDbl=function(){var e,r,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),o=s.redSqr(),a=this.x.redAdd(s).redSqr().redISub(n).redISub(o);a=a.redIAdd(a);var c=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),u=c.redSqr().redISub(a).redISub(a);e=u;var f=o.redIAdd(o);f=f.redIAdd(f),f=f.redIAdd(f),r=c.redMul(a.redISub(u)).redISub(f),i=this.y.redAdd(this.y)}else{var d=this.z.redSqr(),h=this.y.redSqr(),p=this.x.redMul(h),y=this.x.redSub(d).redMul(this.x.redAdd(d));y=y.redAdd(y).redIAdd(y);var b=p.redIAdd(p);b=b.redIAdd(b);var E=b.redAdd(b);e=y.redSqr().redISub(E),i=this.y.redAdd(this.z).redSqr().redISub(h).redISub(d);var v=h.redSqr();v=v.redIAdd(v),v=v.redIAdd(v),v=v.redIAdd(v),r=y.redMul(b.redISub(e)).redISub(v)}return this.curve.jpoint(e,r,i)};an.prototype._dbl=function(){var e=this.curve.a,r=this.x,i=this.y,n=this.z,s=n.redSqr().redSqr(),o=r.redSqr(),a=i.redSqr(),c=o.redAdd(o).redIAdd(o).redIAdd(e.redMul(s)),u=r.redAdd(r);u=u.redIAdd(u);var f=u.redMul(a),d=c.redSqr().redISub(f.redAdd(f)),h=f.redISub(d),p=a.redSqr();p=p.redIAdd(p),p=p.redIAdd(p),p=p.redIAdd(p);var y=c.redMul(h).redISub(p),b=i.redAdd(i).redMul(n);return this.curve.jpoint(d,y,b)};an.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),r=this.y.redSqr(),i=this.z.redSqr(),n=r.redSqr(),s=e.redAdd(e).redIAdd(e),o=s.redSqr(),a=this.x.redAdd(r).redSqr().redISub(e).redISub(n);a=a.redIAdd(a),a=a.redAdd(a).redIAdd(a),a=a.redISub(o);var c=a.redSqr(),u=n.redIAdd(n);u=u.redIAdd(u),u=u.redIAdd(u),u=u.redIAdd(u);var f=s.redIAdd(a).redSqr().redISub(o).redISub(c).redISub(u),d=r.redMul(f);d=d.redIAdd(d),d=d.redIAdd(d);var h=this.x.redMul(c).redISub(d);h=h.redIAdd(h),h=h.redIAdd(h);var p=this.y.redMul(f.redMul(u.redISub(f)).redISub(a.redMul(c)));p=p.redIAdd(p),p=p.redIAdd(p),p=p.redIAdd(p);var y=this.z.redAdd(a).redSqr().redISub(i).redISub(c);return this.curve.jpoint(h,p,y)};an.prototype.mul=function(e,r){return e=new Zr(e,r),this.curve._wnafMul(this,e)};an.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var r=this.z.redSqr(),i=e.z.redSqr();if(this.x.redMul(i).redISub(e.x.redMul(r)).cmpn(0)!==0)return!1;var n=r.redMul(this.z),s=i.redMul(e.z);return this.y.redMul(s).redISub(e.y.redMul(n)).cmpn(0)===0};an.prototype.eqXToP=function(e){var r=this.z.redSqr(),i=e.toRed(this.curve.red).redMul(r);if(this.x.cmp(i)===0)return!0;for(var n=e.clone(),s=this.curve.redN.redMul(r);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(i.redIAdd(s),this.x.cmp(i)===0)return!0}};an.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"};an.prototype.isInfinity=function(){return this.z.cmpn(0)===0}});var IU=m((wot,AU)=>{l();"use strict";var k0=Va(),xU=on(),y4=Iy(),oSe=Ss();function D0(t){y4.call(this,"mont",t),this.a=new k0(t.a,16).toRed(this.red),this.b=new k0(t.b,16).toRed(this.red),this.i4=new k0(4).toRed(this.red).redInvm(),this.two=new k0(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}xU(D0,y4);AU.exports=D0;D0.prototype.validate=function(e){var r=e.normalize().x,i=r.redSqr(),n=i.redMul(r).redAdd(i.redMul(this.a)).redAdd(r),s=n.redSqrt();return s.redSqr().cmp(n)===0};function Qi(t,e,r){y4.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new k0(e,16),this.z=new k0(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}xU(Qi,y4.BasePoint);D0.prototype.decodePoint=function(e,r){return this.point(oSe.toArray(e,r),1)};D0.prototype.point=function(e,r){return new Qi(this,e,r)};D0.prototype.pointFromJSON=function(e){return Qi.fromJSON(this,e)};Qi.prototype.precompute=function(){};Qi.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())};Qi.fromJSON=function(e,r){return new Qi(e,r[0],r[1]||e.one)};Qi.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"};Qi.prototype.isInfinity=function(){return this.z.cmpn(0)===0};Qi.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),i=this.x.redSub(this.z),n=i.redSqr(),s=r.redSub(n),o=r.redMul(n),a=s.redMul(n.redAdd(this.curve.a24.redMul(s)));return this.curve.point(o,a)};Qi.prototype.add=function(){throw new Error("Not supported on Montgomery curve")};Qi.prototype.diffAdd=function(e,r){var i=this.x.redAdd(this.z),n=this.x.redSub(this.z),s=e.x.redAdd(e.z),o=e.x.redSub(e.z),a=o.redMul(i),c=s.redMul(n),u=r.z.redMul(a.redAdd(c).redSqr()),f=r.x.redMul(a.redISub(c).redSqr());return this.curve.point(u,f)};Qi.prototype.mul=function(e){for(var r=e.clone(),i=this,n=this.curve.point(null,null),s=this,o=[];r.cmpn(0)!==0;r.iushrn(1))o.push(r.andln(1));for(var a=o.length-1;a>=0;a--)o[a]===0?(i=i.diffAdd(n,s),n=n.dbl()):(n=i.diffAdd(n,s),i=i.dbl());return n};Qi.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")};Qi.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")};Qi.prototype.eq=function(e){return this.getX().cmp(e.getX())===0};Qi.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};Qi.prototype.getX=function(){return this.normalize(),this.x.fromRed()}});var PU=m((_ot,RU)=>{l();"use strict";var aSe=Ss(),nu=Va(),TU=on(),g4=Iy(),cSe=aSe.assert;function za(t){this.twisted=(t.a|0)!=1,this.mOneA=this.twisted&&(t.a|0)==-1,this.extended=this.mOneA,g4.call(this,"edwards",t),this.a=new nu(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new nu(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new nu(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),cSe(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)==1}TU(za,g4);RU.exports=za;za.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)};za.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)};za.prototype.jpoint=function(e,r,i,n){return this.point(e,r,i,n)};za.prototype.pointFromX=function(e,r){e=new nu(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr(),n=this.c2.redSub(this.a.redMul(i)),s=this.one.redSub(this.c2.redMul(this.d).redMul(i)),o=n.redMul(s.redInvm()),a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");var c=a.fromRed().isOdd();return(r&&!c||!r&&c)&&(a=a.redNeg()),this.point(e,a)};za.prototype.pointFromY=function(e,r){e=new nu(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr(),n=i.redSub(this.c2),s=i.redMul(this.d).redMul(this.c2).redSub(this.a),o=n.redMul(s.redInvm());if(o.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");return a.fromRed().isOdd()!==r&&(a=a.redNeg()),this.point(a,e)};za.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),i=e.y.redSqr(),n=r.redMul(this.a).redAdd(i),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(i)));return n.cmp(s)===0};function yr(t,e,r,i,n){g4.BasePoint.call(this,t,"projective"),e===null&&r===null&&i===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new nu(e,16),this.y=new nu(r,16),this.z=i?new nu(i,16):this.curve.one,this.t=n&&new nu(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}TU(yr,g4.BasePoint);za.prototype.pointFromJSON=function(e){return yr.fromJSON(this,e)};za.prototype.point=function(e,r,i,n){return new yr(this,e,r,i,n)};yr.fromJSON=function(e,r){return new yr(e,r[0],r[1],r[2])};yr.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"};yr.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};yr.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),i=this.z.redSqr();i=i.redIAdd(i);var n=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),o=n.redAdd(r),a=o.redSub(i),c=n.redSub(r),u=s.redMul(a),f=o.redMul(c),d=s.redMul(c),h=a.redMul(o);return this.curve.point(u,f,h,d)};yr.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),i=this.y.redSqr(),n,s,o,a,c,u;if(this.curve.twisted){a=this.curve._mulA(r);var f=a.redAdd(i);this.zOne?(n=e.redSub(r).redSub(i).redMul(f.redSub(this.curve.two)),s=f.redMul(a.redSub(i)),o=f.redSqr().redSub(f).redSub(f)):(c=this.z.redSqr(),u=f.redSub(c).redISub(c),n=e.redSub(r).redISub(i).redMul(u),s=f.redMul(a.redSub(i)),o=f.redMul(u))}else a=r.redAdd(i),c=this.curve._mulC(this.z).redSqr(),u=a.redSub(c).redSub(c),n=this.curve._mulC(e.redISub(a)).redMul(u),s=this.curve._mulC(a).redMul(r.redISub(i)),o=a.redMul(u);return this.curve.point(n,s,o)};yr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};yr.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),i=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),o=i.redSub(r),a=s.redSub(n),c=s.redAdd(n),u=i.redAdd(r),f=o.redMul(a),d=c.redMul(u),h=o.redMul(u),p=a.redMul(c);return this.curve.point(f,d,p,h)};yr.prototype._projAdd=function(e){var r=this.z.redMul(e.z),i=r.redSqr(),n=this.x.redMul(e.x),s=this.y.redMul(e.y),o=this.curve.d.redMul(n).redMul(s),a=i.redSub(o),c=i.redAdd(o),u=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(n).redISub(s),f=r.redMul(a).redMul(u),d,h;return this.curve.twisted?(d=r.redMul(c).redMul(s.redSub(this.curve._mulA(n))),h=a.redMul(c)):(d=r.redMul(c).redMul(s.redSub(n)),h=this.curve._mulC(a).redMul(c)),this.curve.point(f,d,h)};yr.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)};yr.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)};yr.prototype.mulAdd=function(e,r,i){return this.curve._wnafMulAdd(1,[this,r],[e,i],2,!1)};yr.prototype.jmulAdd=function(e,r,i){return this.curve._wnafMulAdd(1,[this,r],[e,i],2,!0)};yr.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this};yr.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};yr.prototype.getX=function(){return this.normalize(),this.x.fromRed()};yr.prototype.getY=function(){return this.normalize(),this.y.fromRed()};yr.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0};yr.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var i=e.clone(),n=this.curve.redN.redMul(this.z);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(n),this.x.cmp(r)===0)return!0}};yr.prototype.toP=yr.prototype.normalize;yr.prototype.mixedAdd=yr.prototype.add});var z_=m(CU=>{l();"use strict";var m4=CU;m4.base=Iy();m4.short=SU();m4.mont=IU();m4.edwards=PU()});var $o=m(or=>{l();"use strict";var uSe=bf(),fSe=on();or.inherits=fSe;function lSe(t,e){return(t.charCodeAt(e)&64512)!=55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)==56320}function dSe(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!=0&&(t="0"+t),n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16))}else for(var i=0,n=0;n<t.length;n++){var s=t.charCodeAt(n);s<128?r[i++]=s:s<2048?(r[i++]=s>>6|192,r[i++]=s&63|128):lSe(t,n)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++n)&1023),r[i++]=s>>18|240,r[i++]=s>>12&63|128,r[i++]=s>>6&63|128,r[i++]=s&63|128):(r[i++]=s>>12|224,r[i++]=s>>6&63|128,r[i++]=s&63|128)}else for(n=0;n<t.length;n++)r[n]=t[n]|0;return r}or.toArray=dSe;function hSe(t){for(var e="",r=0;r<t.length;r++)e+=kU(t[r].toString(16));return e}or.toHex=hSe;function OU(t){var e=t>>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}or.htonl=OU;function pSe(t,e){for(var r="",i=0;i<t.length;i++){var n=t[i];e==="little"&&(n=OU(n)),r+=DU(n.toString(16))}return r}or.toHex32=pSe;function kU(t){return t.length===1?"0"+t:t}or.zero2=kU;function DU(t){return t.length===7?"0"+t:t.length===6?"00"+t:t.length===5?"000"+t:t.length===4?"0000"+t:t.length===3?"00000"+t:t.length===2?"000000"+t:t.length===1?"0000000"+t:t}or.zero8=DU;function ySe(t,e,r,i){var n=r-e;uSe(n%4==0);for(var s=new Array(n/4),o=0,a=e;o<s.length;o++,a+=4){var c;i==="big"?c=t[a]<<24|t[a+1]<<16|t[a+2]<<8|t[a+3]:c=t[a+3]<<24|t[a+2]<<16|t[a+1]<<8|t[a],s[o]=c>>>0}return s}or.join32=ySe;function gSe(t,e){for(var r=new Array(t.length*4),i=0,n=0;i<t.length;i++,n+=4){var s=t[i];e==="big"?(r[n]=s>>>24,r[n+1]=s>>>16&255,r[n+2]=s>>>8&255,r[n+3]=s&255):(r[n+3]=s>>>24,r[n+2]=s>>>16&255,r[n+1]=s>>>8&255,r[n]=s&255)}return r}or.split32=gSe;function mSe(t,e){return t>>>e|t<<32-e}or.rotr32=mSe;function bSe(t,e){return t<<e|t>>>32-e}or.rotl32=bSe;function vSe(t,e){return t+e>>>0}or.sum32=vSe;function wSe(t,e,r){return t+e+r>>>0}or.sum32_3=wSe;function _Se(t,e,r,i){return t+e+r+i>>>0}or.sum32_4=_Se;function ESe(t,e,r,i,n){return t+e+r+i+n>>>0}or.sum32_5=ESe;function SSe(t,e,r,i){var n=t[e],s=t[e+1],o=i+s>>>0,a=(o<i?1:0)+r+n;t[e]=a>>>0,t[e+1]=o}or.sum64=SSe;function xSe(t,e,r,i){var n=e+i>>>0,s=(n<e?1:0)+t+r;return s>>>0}or.sum64_hi=xSe;function ASe(t,e,r,i){var n=e+i;return n>>>0}or.sum64_lo=ASe;function ISe(t,e,r,i,n,s,o,a){var c=0,u=e;u=u+i>>>0,c+=u<e?1:0,u=u+s>>>0,c+=u<s?1:0,u=u+a>>>0,c+=u<a?1:0;var f=t+r+n+o+c;return f>>>0}or.sum64_4_hi=ISe;function TSe(t,e,r,i,n,s,o,a){var c=e+i+s+a;return c>>>0}or.sum64_4_lo=TSe;function RSe(t,e,r,i,n,s,o,a,c,u){var f=0,d=e;d=d+i>>>0,f+=d<e?1:0,d=d+s>>>0,f+=d<s?1:0,d=d+a>>>0,f+=d<a?1:0,d=d+u>>>0,f+=d<u?1:0;var h=t+r+n+o+c+f;return h>>>0}or.sum64_5_hi=RSe;function PSe(t,e,r,i,n,s,o,a,c,u){var f=e+i+s+a+u;return f>>>0}or.sum64_5_lo=PSe;function CSe(t,e,r){var i=e<<32-r|t>>>r;return i>>>0}or.rotr64_hi=CSe;function OSe(t,e,r){var i=t<<32-r|e>>>r;return i>>>0}or.rotr64_lo=OSe;function kSe(t,e,r){return t>>>r}or.shr64_hi=kSe;function DSe(t,e,r){var i=t<<32-r|e>>>r;return i>>>0}or.shr64_lo=DSe});var B0=m(NU=>{l();"use strict";var BU=$o(),BSe=bf();function b4(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}NU.BlockHash=b4;b4.prototype.update=function(e,r){if(e=BU.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var i=e.length%this._delta8;this.pending=e.slice(e.length-i,e.length),this.pending.length===0&&(this.pending=null),e=BU.join32(e,0,e.length-i,this.endian);for(var n=0;n<e.length;n+=this._delta32)this._update(e,n,n+this._delta32)}return this};b4.prototype.digest=function(e){return this.update(this._pad()),BSe(this.pending===null),this._digest(e)};b4.prototype._pad=function(){var e=this.pendingTotal,r=this._delta8,i=r-(e+this.padLength)%r,n=new Array(i+this.padLength);n[0]=128;for(var s=1;s<i;s++)n[s]=0;if(e<<=3,this.endian==="big"){for(var o=8;o<this.padLength;o++)n[s++]=0;n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=e>>>24&255,n[s++]=e>>>16&255,n[s++]=e>>>8&255,n[s++]=e&255}else for(n[s++]=e&255,n[s++]=e>>>8&255,n[s++]=e>>>16&255,n[s++]=e>>>24&255,n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=0,o=8;o<this.padLength;o++)n[s++]=0;return n}});var H_=m(su=>{l();"use strict";var NSe=$o(),Ha=NSe.rotr32;function MSe(t,e,r,i){if(t===0)return MU(e,r,i);if(t===1||t===3)return qU(e,r,i);if(t===2)return LU(e,r,i)}su.ft_1=MSe;function MU(t,e,r){return t&e^~t&r}su.ch32=MU;function LU(t,e,r){return t&e^t&r^e&r}su.maj32=LU;function qU(t,e,r){return t^e^r}su.p32=qU;function LSe(t){return Ha(t,2)^Ha(t,13)^Ha(t,22)}su.s0_256=LSe;function qSe(t){return Ha(t,6)^Ha(t,11)^Ha(t,25)}su.s1_256=qSe;function jSe(t){return Ha(t,7)^Ha(t,18)^t>>>3}su.g0_256=jSe;function USe(t){return Ha(t,17)^Ha(t,19)^t>>>10}su.g1_256=USe});var FU=m((Iot,UU)=>{l();"use strict";var N0=$o(),FSe=B0(),KSe=H_(),G_=N0.rotl32,Ty=N0.sum32,VSe=N0.sum32_5,zSe=KSe.ft_1,jU=FSe.BlockHash,HSe=[1518500249,1859775393,2400959708,3395469782];function Ga(){if(!(this instanceof Ga))return new Ga;jU.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}N0.inherits(Ga,jU);UU.exports=Ga;Ga.blockSize=512;Ga.outSize=160;Ga.hmacStrength=80;Ga.padLength=64;Ga.prototype._update=function(e,r){for(var i=this.W,n=0;n<16;n++)i[n]=e[r+n];for(;n<i.length;n++)i[n]=G_(i[n-3]^i[n-8]^i[n-14]^i[n-16],1);var s=this.h[0],o=this.h[1],a=this.h[2],c=this.h[3],u=this.h[4];for(n=0;n<i.length;n++){var f=~~(n/20),d=VSe(G_(s,5),zSe(f,o,a,c),u,i[n],HSe[f]);u=c,c=a,a=G_(o,30),o=s,s=d}this.h[0]=Ty(this.h[0],s),this.h[1]=Ty(this.h[1],o),this.h[2]=Ty(this.h[2],a),this.h[3]=Ty(this.h[3],c),this.h[4]=Ty(this.h[4],u)};Ga.prototype._digest=function(e){return e==="hex"?N0.toHex32(this.h,"big"):N0.split32(this.h,"big")}});var $_=m((Tot,VU)=>{l();"use strict";var M0=$o(),GSe=B0(),L0=H_(),$Se=bf(),Wo=M0.sum32,WSe=M0.sum32_4,YSe=M0.sum32_5,XSe=L0.ch32,QSe=L0.maj32,ZSe=L0.s0_256,JSe=L0.s1_256,exe=L0.g0_256,txe=L0.g1_256,KU=GSe.BlockHash,rxe=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function $a(){if(!(this instanceof $a))return new $a;KU.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=rxe,this.W=new Array(64)}M0.inherits($a,KU);VU.exports=$a;$a.blockSize=512;$a.outSize=256;$a.hmacStrength=192;$a.padLength=64;$a.prototype._update=function(e,r){for(var i=this.W,n=0;n<16;n++)i[n]=e[r+n];for(;n<i.length;n++)i[n]=WSe(txe(i[n-2]),i[n-7],exe(i[n-15]),i[n-16]);var s=this.h[0],o=this.h[1],a=this.h[2],c=this.h[3],u=this.h[4],f=this.h[5],d=this.h[6],h=this.h[7];for($Se(this.k.length===i.length),n=0;n<i.length;n++){var p=YSe(h,JSe(u),XSe(u,f,d),this.k[n],i[n]),y=Wo(ZSe(s),QSe(s,o,a));h=d,d=f,f=u,u=Wo(c,p),c=a,a=o,o=s,s=Wo(p,y)}this.h[0]=Wo(this.h[0],s),this.h[1]=Wo(this.h[1],o),this.h[2]=Wo(this.h[2],a),this.h[3]=Wo(this.h[3],c),this.h[4]=Wo(this.h[4],u),this.h[5]=Wo(this.h[5],f),this.h[6]=Wo(this.h[6],d),this.h[7]=Wo(this.h[7],h)};$a.prototype._digest=function(e){return e==="hex"?M0.toHex32(this.h,"big"):M0.split32(this.h,"big")}});var GU=m((Rot,HU)=>{l();"use strict";var W_=$o(),zU=$_();function ou(){if(!(this instanceof ou))return new ou;zU.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}W_.inherits(ou,zU);HU.exports=ou;ou.blockSize=512;ou.outSize=224;ou.hmacStrength=192;ou.padLength=64;ou.prototype._digest=function(e){return e==="hex"?W_.toHex32(this.h.slice(0,7),"big"):W_.split32(this.h.slice(0,7),"big")}});var Q_=m((Pot,XU)=>{l();"use strict";var ts=$o(),ixe=B0(),nxe=bf(),Wa=ts.rotr64_hi,Ya=ts.rotr64_lo,$U=ts.shr64_hi,WU=ts.shr64_lo,_f=ts.sum64,Y_=ts.sum64_hi,X_=ts.sum64_lo,sxe=ts.sum64_4_hi,oxe=ts.sum64_4_lo,axe=ts.sum64_5_hi,cxe=ts.sum64_5_lo,YU=ixe.BlockHash,uxe=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Yo(){if(!(this instanceof Yo))return new Yo;YU.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=uxe,this.W=new Array(160)}ts.inherits(Yo,YU);XU.exports=Yo;Yo.blockSize=1024;Yo.outSize=512;Yo.hmacStrength=192;Yo.padLength=128;Yo.prototype._prepareBlock=function(e,r){for(var i=this.W,n=0;n<32;n++)i[n]=e[r+n];for(;n<i.length;n+=2){var s=wxe(i[n-4],i[n-3]),o=_xe(i[n-4],i[n-3]),a=i[n-14],c=i[n-13],u=bxe(i[n-30],i[n-29]),f=vxe(i[n-30],i[n-29]),d=i[n-32],h=i[n-31];i[n]=sxe(s,o,a,c,u,f,d,h),i[n+1]=oxe(s,o,a,c,u,f,d,h)}};Yo.prototype._update=function(e,r){this._prepareBlock(e,r);var i=this.W,n=this.h[0],s=this.h[1],o=this.h[2],a=this.h[3],c=this.h[4],u=this.h[5],f=this.h[6],d=this.h[7],h=this.h[8],p=this.h[9],y=this.h[10],b=this.h[11],E=this.h[12],v=this.h[13],A=this.h[14],R=this.h[15];nxe(this.k.length===i.length);for(var F=0;F<i.length;F+=2){var D=A,B=R,H=gxe(h,p),W=mxe(h,p),X=fxe(h,p,y,b,E,v),P=lxe(h,p,y,b,E,v),g=this.k[F],w=this.k[F+1],S=i[F],C=i[F+1],L=axe(D,B,H,W,X,P,g,w,S,C),Y=cxe(D,B,H,W,X,P,g,w,S,C);D=pxe(n,s),B=yxe(n,s),H=dxe(n,s,o,a,c,u),W=hxe(n,s,o,a,c,u);var V=Y_(D,B,H,W),q=X_(D,B,H,W);A=E,R=v,E=y,v=b,y=h,b=p,h=Y_(f,d,L,Y),p=X_(d,d,L,Y),f=c,d=u,c=o,u=a,o=n,a=s,n=Y_(L,Y,V,q),s=X_(L,Y,V,q)}_f(this.h,0,n,s),_f(this.h,2,o,a),_f(this.h,4,c,u),_f(this.h,6,f,d),_f(this.h,8,h,p),_f(this.h,10,y,b),_f(this.h,12,E,v),_f(this.h,14,A,R)};Yo.prototype._digest=function(e){return e==="hex"?ts.toHex32(this.h,"big"):ts.split32(this.h,"big")};function fxe(t,e,r,i,n){var s=t&r^~t&n;return s<0&&(s+=4294967296),s}function lxe(t,e,r,i,n,s){var o=e&i^~e&s;return o<0&&(o+=4294967296),o}function dxe(t,e,r,i,n){var s=t&r^t&n^r&n;return s<0&&(s+=4294967296),s}function hxe(t,e,r,i,n,s){var o=e&i^e&s^i&s;return o<0&&(o+=4294967296),o}function pxe(t,e){var r=Wa(t,e,28),i=Wa(e,t,2),n=Wa(e,t,7),s=r^i^n;return s<0&&(s+=4294967296),s}function yxe(t,e){var r=Ya(t,e,28),i=Ya(e,t,2),n=Ya(e,t,7),s=r^i^n;return s<0&&(s+=4294967296),s}function gxe(t,e){var r=Wa(t,e,14),i=Wa(t,e,18),n=Wa(e,t,9),s=r^i^n;return s<0&&(s+=4294967296),s}function mxe(t,e){var r=Ya(t,e,14),i=Ya(t,e,18),n=Ya(e,t,9),s=r^i^n;return s<0&&(s+=4294967296),s}function bxe(t,e){var r=Wa(t,e,1),i=Wa(t,e,8),n=$U(t,e,7),s=r^i^n;return s<0&&(s+=4294967296),s}function vxe(t,e){var r=Ya(t,e,1),i=Ya(t,e,8),n=WU(t,e,7),s=r^i^n;return s<0&&(s+=4294967296),s}function wxe(t,e){var r=Wa(t,e,19),i=Wa(e,t,29),n=$U(t,e,6),s=r^i^n;return s<0&&(s+=4294967296),s}function _xe(t,e){var r=Ya(t,e,19),i=Ya(e,t,29),n=WU(t,e,6),s=r^i^n;return s<0&&(s+=4294967296),s}});var JU=m((Cot,ZU)=>{l();"use strict";var Z_=$o(),QU=Q_();function au(){if(!(this instanceof au))return new au;QU.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}Z_.inherits(au,QU);ZU.exports=au;au.blockSize=1024;au.outSize=384;au.hmacStrength=192;au.padLength=128;au.prototype._digest=function(e){return e==="hex"?Z_.toHex32(this.h.slice(0,12),"big"):Z_.split32(this.h.slice(0,12),"big")}});var eF=m(q0=>{l();"use strict";q0.sha1=FU();q0.sha224=GU();q0.sha256=$_();q0.sha384=JU();q0.sha512=Q_()});var oF=m(sF=>{l();"use strict";var Hl=$o(),Exe=B0(),v4=Hl.rotl32,tF=Hl.sum32,Ry=Hl.sum32_3,rF=Hl.sum32_4,iF=Exe.BlockHash;function Xa(){if(!(this instanceof Xa))return new Xa;iF.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}Hl.inherits(Xa,iF);sF.ripemd160=Xa;Xa.blockSize=512;Xa.outSize=160;Xa.hmacStrength=192;Xa.padLength=64;Xa.prototype._update=function(e,r){for(var i=this.h[0],n=this.h[1],s=this.h[2],o=this.h[3],a=this.h[4],c=i,u=n,f=s,d=o,h=a,p=0;p<80;p++){var y=tF(v4(rF(i,nF(p,n,s,o),e[Axe[p]+r],Sxe(p)),Txe[p]),a);i=a,a=o,o=v4(s,10),s=n,n=y,y=tF(v4(rF(c,nF(79-p,u,f,d),e[Ixe[p]+r],xxe(p)),Rxe[p]),h),c=h,h=d,d=v4(f,10),f=u,u=y}y=Ry(this.h[1],s,d),this.h[1]=Ry(this.h[2],o,h),this.h[2]=Ry(this.h[3],a,c),this.h[3]=Ry(this.h[4],i,u),this.h[4]=Ry(this.h[0],n,f),this.h[0]=y};Xa.prototype._digest=function(e){return e==="hex"?Hl.toHex32(this.h,"little"):Hl.split32(this.h,"little")};function nF(t,e,r,i){return t<=15?e^r^i:t<=31?e&r|~e&i:t<=47?(e|~r)^i:t<=63?e&i|r&~i:e^(r|~i)}function Sxe(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function xxe(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}var Axe=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],Ixe=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],Txe=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],Rxe=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]});var cF=m((Dot,aF)=>{l();"use strict";var Pxe=$o(),Cxe=bf();function j0(t,e,r){if(!(this instanceof j0))return new j0(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(Pxe.toArray(e,r))}aF.exports=j0;j0.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),Cxe(e.length<=this.blockSize);for(var r=e.length;r<this.blockSize;r++)e.push(0);for(r=0;r<e.length;r++)e[r]^=54;for(this.inner=new this.Hash().update(e),r=0;r<e.length;r++)e[r]^=106;this.outer=new this.Hash().update(e)};j0.prototype.update=function(e,r){return this.inner.update(e,r),this};j0.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)}});var w4=m(uF=>{l();var cn=uF;cn.utils=$o();cn.common=B0();cn.sha=eF();cn.ripemd=oF();cn.hmac=cF();cn.sha1=cn.sha.sha1;cn.sha256=cn.sha.sha256;cn.sha224=cn.sha.sha224;cn.sha384=cn.sha.sha384;cn.sha512=cn.sha.sha512;cn.ripemd160=cn.ripemd.ripemd160});var lF=m((Not,fF)=>{l();fF.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}});var _4=m(pF=>{l();"use strict";var J_=pF,Ef=w4(),eE=z_(),Oxe=Ss(),dF=Oxe.assert;function hF(t){t.type==="short"?this.curve=new eE.short(t):t.type==="edwards"?this.curve=new eE.edwards(t):this.curve=new eE.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,dF(this.g.validate(),"Invalid curve"),dF(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}J_.PresetCurve=hF;function Sf(t,e){Object.defineProperty(J_,t,{configurable:!0,enumerable:!0,get:function(){var r=new hF(e);return Object.defineProperty(J_,t,{configurable:!0,enumerable:!0,value:r}),r}})}Sf("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Ef.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]});Sf("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Ef.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]});Sf("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Ef.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]});Sf("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Ef.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]});Sf("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Ef.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]});Sf("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Ef.sha256,gRed:!1,g:["9"]});Sf("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Ef.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var tE;try{tE=lF()}catch(t){tE=void 0}Sf("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Ef.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",tE]})});var mF=m((Lot,gF)=>{l();"use strict";var kxe=w4(),Gl=L_(),yF=bf();function xf(t){if(!(this instanceof xf))return new xf(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Gl.toArray(t.entropy,t.entropyEnc||"hex"),r=Gl.toArray(t.nonce,t.nonceEnc||"hex"),i=Gl.toArray(t.pers,t.persEnc||"hex");yF(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}gF.exports=xf;xf.prototype._init=function(e,r,i){var n=e.concat(r).concat(i);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s<this.V.length;s++)this.K[s]=0,this.V[s]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656};xf.prototype._hmac=function(){return new kxe.hmac(this.hash,this.K)};xf.prototype._update=function(e){var r=this._hmac().update(this.V).update([0]);e&&(r=r.update(e)),this.K=r.digest(),this.V=this._hmac().update(this.V).digest(),!!e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())};xf.prototype.reseed=function(e,r,i,n){typeof r!="string"&&(n=i,i=r,r=null),e=Gl.toArray(e,r),i=Gl.toArray(i,n),yF(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(i||[])),this._reseed=1};xf.prototype.generate=function(e,r,i,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(n=i,i=r,r=null),i&&(i=Gl.toArray(i,n||"hex"),this._update(i));for(var s=[];s.length<e;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var o=s.slice(0,e);return this._update(i),this._reseed++,Gl.encode(o,r)}});var vF=m((qot,bF)=>{l();"use strict";var Dxe=Va(),Bxe=Ss(),rE=Bxe.assert;function xn(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}bF.exports=xn;xn.fromPublic=function(e,r,i){return r instanceof xn?r:new xn(e,{pub:r,pubEnc:i})};xn.fromPrivate=function(e,r,i){return r instanceof xn?r:new xn(e,{priv:r,privEnc:i})};xn.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}};xn.prototype.getPublic=function(e,r){return typeof e=="string"&&(r=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),r?this.pub.encode(r,e):this.pub};xn.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv};xn.prototype._importPrivate=function(e,r){this.priv=new Dxe(e,r||16),this.priv=this.priv.umod(this.ec.curve.n)};xn.prototype._importPublic=function(e,r){if(e.x||e.y){this.ec.curve.type==="mont"?rE(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&rE(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,r)};xn.prototype.derive=function(e){return e.validate()||rE(e.validate(),"public point not validated"),e.mul(this.priv).getX()};xn.prototype.sign=function(e,r,i){return this.ec.sign(e,this,r,i)};xn.prototype.verify=function(e,r){return this.ec.verify(e,r,this)};xn.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}});var EF=m((jot,_F)=>{l();"use strict";var E4=Va(),iE=Ss(),Nxe=iE.assert;function S4(t,e){if(t instanceof S4)return t;this._importDER(t,e)||(Nxe(t.r&&t.s,"Signature without r or s"),this.r=new E4(t.r,16),this.s=new E4(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}_F.exports=S4;function Mxe(){this.place=0}function nE(t,e){var r=t[e.place++];if(!(r&128))return r;var i=r&15;if(i===0||i>4)return!1;for(var n=0,s=0,o=e.place;s<i;s++,o++)n<<=8,n|=t[o],n>>>=0;return n<=127?!1:(e.place=o,n)}function wF(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e<r;)e++;return e===0?t:t.slice(e)}S4.prototype._importDER=function(e,r){e=iE.toArray(e,r);var i=new Mxe;if(e[i.place++]!==48)return!1;var n=nE(e,i);if(n===!1||n+i.place!==e.length||e[i.place++]!==2)return!1;var s=nE(e,i);if(s===!1)return!1;var o=e.slice(i.place,s+i.place);if(i.place+=s,e[i.place++]!==2)return!1;var a=nE(e,i);if(a===!1||e.length!==a+i.place)return!1;var c=e.slice(i.place,a+i.place);if(o[0]===0)if(o[1]&128)o=o.slice(1);else return!1;if(c[0]===0)if(c[1]&128)c=c.slice(1);else return!1;return this.r=new E4(o),this.s=new E4(c),this.recoveryParam=null,!0};function sE(t,e){if(e<128){t.push(e);return}var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}S4.prototype.toDER=function(e){var r=this.r.toArray(),i=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),i[0]&128&&(i=[0].concat(i)),r=wF(r),i=wF(i);!i[0]&&!(i[1]&128);)i=i.slice(1);var n=[2];sE(n,r.length),n=n.concat(r),n.push(2),sE(n,i.length);var s=n.concat(i),o=[48];return sE(o,s.length),o=o.concat(s),iE.encode(o,e)}});var IF=m((Uot,AF)=>{l();"use strict";var $l=Va(),SF=mF(),Lxe=Ss(),oE=_4(),qxe=F_(),xF=Lxe.assert,aE=vF(),x4=EF();function to(t){if(!(this instanceof to))return new to(t);typeof t=="string"&&(xF(Object.prototype.hasOwnProperty.call(oE,t),"Unknown curve "+t),t=oE[t]),t instanceof oE.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}AF.exports=to;to.prototype.keyPair=function(e){return new aE(this,e)};to.prototype.keyFromPrivate=function(e,r){return aE.fromPrivate(this,e,r)};to.prototype.keyFromPublic=function(e,r){return aE.fromPublic(this,e,r)};to.prototype.genKeyPair=function(e){e||(e={});for(var r=new SF({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||qxe(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),i=this.n.byteLength(),n=this.n.sub(new $l(2));;){var s=new $l(r.generate(i));if(!(s.cmp(n)>0))return s.iaddn(1),this.keyFromPrivate(s)}};to.prototype._truncateToN=function(e,r){var i=e.byteLength()*8-this.n.bitLength();return i>0&&(e=e.ushrn(i)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e};to.prototype.sign=function(e,r,i,n){typeof i=="object"&&(n=i,i=null),n||(n={}),r=this.keyFromPrivate(r,i),e=this._truncateToN(new $l(e,16));for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),c=new SF({hash:this.hash,entropy:o,nonce:a,pers:n.pers,persEnc:n.persEnc||"utf8"}),u=this.n.sub(new $l(1)),f=0;;f++){var d=n.k?n.k(f):new $l(c.generate(this.n.byteLength()));if(d=this._truncateToN(d,!0),!(d.cmpn(1)<=0||d.cmp(u)>=0)){var h=this.g.mul(d);if(!h.isInfinity()){var p=h.getX(),y=p.umod(this.n);if(y.cmpn(0)!==0){var b=d.invm(this.n).mul(y.mul(r.getPrivate()).iadd(e));if(b=b.umod(this.n),b.cmpn(0)!==0){var E=(h.getY().isOdd()?1:0)|(p.cmp(y)!==0?2:0);return n.canonical&&b.cmp(this.nh)>0&&(b=this.n.sub(b),E^=1),new x4({r:y,s:b,recoveryParam:E})}}}}}};to.prototype.verify=function(e,r,i,n){e=this._truncateToN(new $l(e,16)),i=this.keyFromPublic(i,n),r=new x4(r,"hex");var s=r.r,o=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),c=a.mul(e).umod(this.n),u=a.mul(s).umod(this.n),f;return this.curve._maxwellTrick?(f=this.g.jmulAdd(c,i.getPublic(),u),f.isInfinity()?!1:f.eqXToP(s)):(f=this.g.mulAdd(c,i.getPublic(),u),f.isInfinity()?!1:f.getX().umod(this.n).cmp(s)===0)};to.prototype.recoverPubKey=function(t,e,r,i){xF((3&r)===r,"The recovery param is more than two bits"),e=new x4(e,i);var n=this.n,s=new $l(t),o=e.r,a=e.s,c=r&1,u=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");u?o=this.curve.pointFromX(o.add(this.curve.n),c):o=this.curve.pointFromX(o,c);var f=e.r.invm(n),d=n.sub(s).mul(f).umod(n),h=a.mul(f).umod(n);return this.g.mulAdd(d,o,h)};to.prototype.getKeyRecoveryParam=function(t,e,r,i){if(e=new x4(e,i),e.recoveryParam!==null)return e.recoveryParam;for(var n=0;n<4;n++){var s;try{s=this.recoverPubKey(t,e,n)}catch(o){continue}if(s.eq(r))return n}throw new Error("Unable to find valid recovery factor")}});var CF=m((Fot,PF)=>{l();"use strict";var Py=Ss(),TF=Py.assert,RF=Py.parseBytes,U0=Py.cachedProperty;function Zi(t,e){this.eddsa=t,this._secret=RF(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=RF(e.pub)}Zi.fromPublic=function(e,r){return r instanceof Zi?r:new Zi(e,{pub:r})};Zi.fromSecret=function(e,r){return r instanceof Zi?r:new Zi(e,{secret:r})};Zi.prototype.secret=function(){return this._secret};U0(Zi,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())});U0(Zi,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});U0(Zi,"privBytes",function(){var e=this.eddsa,r=this.hash(),i=e.encodingLength-1,n=r.slice(0,e.encodingLength);return n[0]&=248,n[i]&=127,n[i]|=64,n});U0(Zi,"priv",function(){return this.eddsa.decodeInt(this.privBytes())});U0(Zi,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()});U0(Zi,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)});Zi.prototype.sign=function(e){return TF(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)};Zi.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)};Zi.prototype.getSecret=function(e){return TF(this._secret,"KeyPair is public only"),Py.encode(this.secret(),e)};Zi.prototype.getPublic=function(e){return Py.encode(this.pubBytes(),e)};PF.exports=Zi});var kF=m((Kot,OF)=>{l();"use strict";var jxe=Va(),A4=Ss(),Uxe=A4.assert,I4=A4.cachedProperty,Fxe=A4.parseBytes;function Wl(t,e){this.eddsa=t,typeof e!="object"&&(e=Fxe(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),Uxe(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof jxe&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}I4(Wl,"S",function(){return this.eddsa.decodeInt(this.Sencoded())});I4(Wl,"R",function(){return this.eddsa.decodePoint(this.Rencoded())});I4(Wl,"Rencoded",function(){return this.eddsa.encodePoint(this.R())});I4(Wl,"Sencoded",function(){return this.eddsa.encodeInt(this.S())});Wl.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())};Wl.prototype.toHex=function(){return A4.encode(this.toBytes(),"hex").toUpperCase()};OF.exports=Wl});var LF=m((Vot,MF)=>{l();"use strict";var Kxe=w4(),Vxe=_4(),F0=Ss(),zxe=F0.assert,DF=F0.parseBytes,BF=CF(),NF=kF();function rs(t){if(zxe(t==="ed25519","only tested with ed25519 so far"),!(this instanceof rs))return new rs(t);t=Vxe[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=Kxe.sha512}MF.exports=rs;rs.prototype.sign=function(e,r){e=DF(e);var i=this.keyFromSecret(r),n=this.hashInt(i.messagePrefix(),e),s=this.g.mul(n),o=this.encodePoint(s),a=this.hashInt(o,i.pubBytes(),e).mul(i.priv()),c=n.add(a).umod(this.curve.n);return this.makeSignature({R:s,S:c,Rencoded:o})};rs.prototype.verify=function(e,r,i){e=DF(e),r=this.makeSignature(r);var n=this.keyFromPublic(i),s=this.hashInt(r.Rencoded(),n.pubBytes(),e),o=this.g.mul(r.S()),a=r.R().add(n.pub().mul(s));return a.eq(o)};rs.prototype.hashInt=function(){for(var e=this.hash(),r=0;r<arguments.length;r++)e.update(arguments[r]);return F0.intFromLE(e.digest()).umod(this.curve.n)};rs.prototype.keyFromPublic=function(e){return BF.fromPublic(this,e)};rs.prototype.keyFromSecret=function(e){return BF.fromSecret(this,e)};rs.prototype.makeSignature=function(e){return e instanceof NF?e:new NF(this,e)};rs.prototype.encodePoint=function(e){var r=e.getY().toArray("le",this.encodingLength);return r[this.encodingLength-1]|=e.getX().isOdd()?128:0,r};rs.prototype.decodePoint=function(e){e=F0.parseBytes(e);var r=e.length-1,i=e.slice(0,r).concat(e[r]&~128),n=(e[r]&128)!=0,s=F0.intFromLE(i);return this.curve.pointFromY(s,n)};rs.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)};rs.prototype.decodeInt=function(e){return F0.intFromLE(e)};rs.prototype.isPoint=function(e){return e instanceof this.pointClass}});var jF=m(qF=>{l();"use strict";var Yl=qF;Yl.version=dU().version;Yl.utils=Ss();Yl.rand=F_();Yl.curve=z_();Yl.curves=_4();Yl.ec=IF();Yl.eddsa=LF()});var FF=m((Hot,UF)=>{l();var Hxe=jF().ec,Qa=new Hxe("secp256k1"),kt=Qa.curve,ar=kt.n.constructor;function Gxe(t,e){let r=new ar(e);if(r.cmp(kt.p)>=0)return null;r=r.toRed(kt.red);let i=r.redSqr().redIMul(r).redIAdd(kt.b).redSqrt();return t===3!==i.isOdd()&&(i=i.redNeg()),Qa.keyPair({pub:{x:r,y:i}})}function $xe(t,e,r){let i=new ar(e),n=new ar(r);if(i.cmp(kt.p)>=0||n.cmp(kt.p)>=0||(i=i.toRed(kt.red),n=n.toRed(kt.red),(t===6||t===7)&&n.isOdd()!==(t===7)))return null;let s=i.redSqr().redIMul(i);return n.redSqr().redISub(s.redIAdd(kt.b)).isZero()?Qa.keyPair({pub:{x:i,y:n}}):null}function Af(t){let e=t[0];switch(e){case 2:case 3:return t.length!==33?null:Gxe(e,t.subarray(1,33));case 4:case 6:case 7:return t.length!==65?null:$xe(e,t.subarray(1,33),t.subarray(33,65));default:return null}}function Xl(t,e){let r=e.encode(null,t.length===33);for(let i=0;i<t.length;++i)t[i]=r[i]}UF.exports={contextRandomize(){return 0},privateKeyVerify(t){let e=new ar(t);return e.cmp(kt.n)<0&&!e.isZero()?0:1},privateKeyNegate(t){let e=new ar(t),r=kt.n.sub(e).umod(kt.n).toArrayLike(Uint8Array,"be",32);return t.set(r),0},privateKeyTweakAdd(t,e){let r=new ar(e);if(r.cmp(kt.n)>=0||(r.iadd(new ar(t)),r.cmp(kt.n)>=0&&r.isub(kt.n),r.isZero()))return 1;let i=r.toArrayLike(Uint8Array,"be",32);return t.set(i),0},privateKeyTweakMul(t,e){let r=new ar(e);if(r.cmp(kt.n)>=0||r.isZero())return 1;r.imul(new ar(t)),r.cmp(kt.n)>=0&&(r=r.umod(kt.n));let i=r.toArrayLike(Uint8Array,"be",32);return t.set(i),0},publicKeyVerify(t){return Af(t)===null?1:0},publicKeyCreate(t,e){let r=new ar(e);if(r.cmp(kt.n)>=0||r.isZero())return 1;let i=Qa.keyFromPrivate(e).getPublic();return Xl(t,i),0},publicKeyConvert(t,e){let r=Af(e);if(r===null)return 1;let i=r.getPublic();return Xl(t,i),0},publicKeyNegate(t,e){let r=Af(e);if(r===null)return 1;let i=r.getPublic();return i.y=i.y.redNeg(),Xl(t,i),0},publicKeyCombine(t,e){let r=new Array(e.length);for(let n=0;n<e.length;++n)if(r[n]=Af(e[n]),r[n]===null)return 1;let i=r[0].getPublic();for(let n=1;n<r.length;++n)i=i.add(r[n].pub);return i.isInfinity()?2:(Xl(t,i),0)},publicKeyTweakAdd(t,e,r){let i=Af(e);if(i===null)return 1;if(r=new ar(r),r.cmp(kt.n)>=0)return 2;let n=i.getPublic().add(kt.g.mul(r));return n.isInfinity()?2:(Xl(t,n),0)},publicKeyTweakMul(t,e,r){let i=Af(e);if(i===null)return 1;if(r=new ar(r),r.cmp(kt.n)>=0||r.isZero())return 2;let n=i.getPublic().mul(r);return Xl(t,n),0},signatureNormalize(t){let e=new ar(t.subarray(0,32)),r=new ar(t.subarray(32,64));return e.cmp(kt.n)>=0||r.cmp(kt.n)>=0?1:(r.cmp(Qa.nh)===1&&t.set(kt.n.sub(r).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(t,e){let r=e.subarray(0,32),i=e.subarray(32,64);if(new ar(r).cmp(kt.n)>=0||new ar(i).cmp(kt.n)>=0)return 1;let{output:n}=t,s=n.subarray(4,4+33);s[0]=0,s.set(r,1);let o=33,a=0;for(;o>1&&s[a]===0&&!(s[a+1]&128);--o,++a);if(s=s.subarray(a),s[0]&128||o>1&&s[0]===0&&!(s[1]&128))return 1;let c=n.subarray(6+33,6+33+33);c[0]=0,c.set(i,1);let u=33,f=0;for(;u>1&&c[f]===0&&!(c[f+1]&128);--u,++f);return c=c.subarray(f),c[0]&128||u>1&&c[0]===0&&!(c[1]&128)?1:(t.outputlen=6+o+u,n[0]=48,n[1]=t.outputlen-2,n[2]=2,n[3]=s.length,n.set(s,4),n[4+o]=2,n[5+o]=c.length,n.set(c,6+o),0)},signatureImport(t,e){if(e.length<8||e.length>72||e[0]!==48||e[1]!==e.length-2||e[2]!==2)return 1;let r=e[3];if(r===0||5+r>=e.length||e[4+r]!==2)return 1;let i=e[5+r];if(i===0||6+r+i!==e.length||e[4]&128||r>1&&e[4]===0&&!(e[5]&128)||e[r+6]&128||i>1&&e[r+6]===0&&!(e[r+7]&128))return 1;let n=e.subarray(4,4+r);if(n.length===33&&n[0]===0&&(n=n.subarray(1)),n.length>32)return 1;let s=e.subarray(6+r);if(s.length===33&&s[0]===0&&(s=s.slice(1)),s.length>32)throw new Error("S length is too long");let o=new ar(n);o.cmp(kt.n)>=0&&(o=new ar(0));let a=new ar(e.subarray(6+r));return a.cmp(kt.n)>=0&&(a=new ar(0)),t.set(o.toArrayLike(Uint8Array,"be",32),0),t.set(a.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(t,e,r,i,n){if(n){let a=n;n=c=>{let u=a(e,r,null,i,c);if(!(u instanceof Uint8Array&&u.length===32))throw new Error("This is the way");return new ar(u)}}let s=new ar(r);if(s.cmp(kt.n)>=0||s.isZero())return 1;let o;try{o=Qa.sign(e,r,{canonical:!0,k:n,pers:i})}catch(a){return 1}return t.signature.set(o.r.toArrayLike(Uint8Array,"be",32),0),t.signature.set(o.s.toArrayLike(Uint8Array,"be",32),32),t.recid=o.recoveryParam,0},ecdsaVerify(t,e,r){let i={r:t.subarray(0,32),s:t.subarray(32,64)},n=new ar(i.r),s=new ar(i.s);if(n.cmp(kt.n)>=0||s.cmp(kt.n)>=0)return 1;if(s.cmp(Qa.nh)===1||n.isZero()||s.isZero())return 3;let o=Af(r);if(o===null)return 2;let a=o.getPublic();return Qa.verify(e,i,a)?0:3},ecdsaRecover(t,e,r,i){let n={r:e.slice(0,32),s:e.slice(32,64)},s=new ar(n.r),o=new ar(n.s);if(s.cmp(kt.n)>=0||o.cmp(kt.n)>=0)return 1;if(s.isZero()||o.isZero())return 2;let a;try{a=Qa.recoverPubKey(i,n,r)}catch(c){return 2}return Xl(t,a),0},ecdh(t,e,r,i,n,s,o){let a=Af(e);if(a===null)return 1;let c=new ar(r);if(c.cmp(kt.n)>=0||c.isZero())return 2;let u=a.getPublic().mul(c);if(n===void 0){let f=u.encode(null,!0),d=Qa.hash().update(f).digest();for(let h=0;h<32;++h)t[h]=d[h]}else{s||(s=new Uint8Array(32));let f=u.getX().toArray("be",32);for(let y=0;y<32;++y)s[y]=f[y];o||(o=new Uint8Array(32));let d=u.getY().toArray("be",32);for(let y=0;y<32;++y)o[y]=d[y];let h=n(s,o,i);if(!(h instanceof Uint8Array&&h.length===t.length))return 2;t.set(h)}return 0}}});var VF=m((Got,KF)=>{l();KF.exports=lU()(FF())});var GF=m(($ot,HF)=>{l();"use strict";var Xo=VF(),{sha256:zF}=(di(),zs);HF.exports=t=>{let e=32;function r(){let f;do f=t(32);while(!Xo.privateKeyVerify(f));return f}async function i(f,d){let{digest:h}=await zF.digest(d),p=Xo.ecdsaSign(h,f);return Xo.signatureExport(p.signature)}async function n(f,d,h){let{digest:p}=await zF.digest(h);return d=Xo.signatureImport(d),Xo.ecdsaVerify(d,p,f)}function s(f){if(!Xo.publicKeyVerify(f))throw new Error("Invalid public key");return Xo.publicKeyConvert(f,!0)}function o(f){return Xo.publicKeyConvert(f,!1)}function a(f){if(!Xo.privateKeyVerify(f))throw new Error("Invalid private key")}function c(f){if(!Xo.publicKeyVerify(f))throw new Error("Invalid public key")}function u(f){return a(f),Xo.publicKeyCreate(f)}return{generateKey:r,privateKeyLength:e,hashAndSign:i,hashAndVerify:n,compressPublicKey:s,decompressPublicKey:o,validatePrivateKey:a,validatePublicKey:c,computePublicKey:u}}});var XF=m((Wot,YF)=>{l();"use strict";var{sha256:$F}=(di(),zs),Wxe=zo(),{equals:WF}=(wi(),bn),{toString:Yxe}=(tt(),hr),Xxe=s4();YF.exports=(t,e,r)=>{r=r||GF()(e);class i{constructor(u){r.validatePublicKey(u),this._key=u}verify(u,f){return r.hashAndVerify(this._key,f,u)}marshal(){return r.compressPublicKey(this._key)}get bytes(){return t.PublicKey.encode({Type:t.KeyType.Secp256k1,Data:this.marshal()}).finish()}equals(u){return WF(this.bytes,u.bytes)}async hash(){let{bytes:u}=await $F.digest(this.bytes);return u}}class n{constructor(u,f){this._key=u,this._publicKey=f||r.computePublicKey(u),r.validatePrivateKey(this._key),r.validatePublicKey(this._publicKey)}sign(u){return r.hashAndSign(this._key,u)}get public(){return new i(this._publicKey)}marshal(){return this._key}get bytes(){return t.PrivateKey.encode({Type:t.KeyType.Secp256k1,Data:this.marshal()}).finish()}equals(u){return WF(this.bytes,u.bytes)}async hash(){let{bytes:u}=await $F.digest(this.bytes);return u}async id(){let u=await this.public.hash();return Yxe(u,"base58btc")}async export(u,f="libp2p-key"){if(f==="libp2p-key")return Xxe.export(this.bytes,u);throw Wxe(new Error(`export format '${f}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")}}function s(c){return new n(c)}function o(c){return new i(c)}async function a(){let c=await r.generateKey();return new n(c)}return{Secp256k1PublicKey:i,Secp256k1PrivateKey:n,unmarshalSecp256k1PrivateKey:s,unmarshalSecp256k1PublicKey:o,generateKeyPair:a}}});var ZF=m((Yot,QF)=>{l();"use strict";QF.exports={SHA1:20,SHA256:32,SHA512:64}});var cE=m(eK=>{l();"use strict";var JF=by(),Qxe=ZF(),Zxe={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"},Jxe=async(t,e)=>{let r=await JF.get().subtle.sign({name:"HMAC"},t,e);return new Uint8Array(r,r.byteOffset,r.byteLength)};eK.create=async function(t,e){let r=Zxe[t],i=await JF.get().subtle.importKey("raw",e,{name:"HMAC",hash:{name:r}},!1,["sign"]);return{async digest(n){return Jxe(i,n)},length:Qxe[t]}}});var sK=m((Qot,nK)=>{l();"use strict";var tK=zo(),{concat:rK}=(mn(),$s),{fromString:eAe}=(dt(),bi),tAe=cE(),iK={"AES-128":{ivSize:16,keySize:16},"AES-256":{ivSize:16,keySize:32},Blowfish:{ivSize:8,cipherKeySize:32}};nK.exports=async(t,e,r)=>{let i=iK[t];if(!i){let A=Object.keys(iK).join(" / ");throw tK(new Error(`unknown cipher type '${t}'. Must be ${A}`),"ERR_INVALID_CIPHER_TYPE")}if(!e)throw tK(new Error("missing hash type"),"ERR_MISSING_HASH_TYPE");let n=i.keySize,s=i.ivSize,o=20,a=eAe("key expansion"),c=2*(s+n+o),u=await tAe.create(e,r),f=await u.digest(a),d=[],h=0;for(;h<c;){let A=await u.digest(rK([f,a])),R=A.length;h+R>c&&(R=c-h),d.push(A),h+=R,f=await u.digest(f)}let p=c/2,y=rK(d),b=y.slice(0,p),E=y.slice(p,c),v=A=>({iv:A.slice(0,s),cipherKey:A.slice(s,s+n),macKey:A.slice(s+n)});return{k1:v(b),k2:v(E)}}});var aK=m((Zot,oK)=>{l();"use strict";var rAe=zo();oK.exports=function(t,e){if(!t.includes(e)){let r=t.join(" / ");throw rAe(new Error(`Unknown curve: ${e}. Must be ${r}`),"ERR_INVALID_CURVE")}}});var hK=m(dK=>{l();"use strict";var iAe=zo(),Cy=by(),{base64urlToBuffer:cK}=n4(),nAe=aK(),{toString:uE}=(tt(),hr),{concat:sAe}=(mn(),$s),{equals:oAe}=(wi(),bn),uK={"P-256":256,"P-384":384,"P-521":521};dK.generateEphmeralKeyPair=async function(t){nAe(Object.keys(uK),t);let e=await Cy.get().subtle.generateKey({name:"ECDH",namedCurve:t},!0,["deriveBits"]),r=async(n,s)=>{let o;s?o=await Cy.get().subtle.importKey("jwk",cAe(t,s),{name:"ECDH",namedCurve:t},!1,["deriveBits"]):o=e.privateKey;let a=[await Cy.get().subtle.importKey("jwk",lK(t,n),{name:"ECDH",namedCurve:t},!1,[]),o],c=await Cy.get().subtle.deriveBits({name:"ECDH",namedCurve:t,public:a[0]},a[1],uK[t]);return new Uint8Array(c,c.byteOffset,c.byteLength)},i=await Cy.get().subtle.exportKey("jwk",e.publicKey);return{key:aAe(i),genSharedKey:r}};var fK={"P-256":32,"P-384":48,"P-521":66};function aAe(t){let e=fK[t.crv];return sAe([Uint8Array.from([4]),cK(t.x,e),cK(t.y,e)],1+e*2)}function lK(t,e){let r=fK[t];if(oAe(!e.slice(0,1),Uint8Array.from([4])))throw iAe(new Error("Cannot unmarshal public key - invalid key format"),"ERR_INVALID_KEY_FORMAT");return{kty:"EC",crv:t,x:uE(e.slice(1,r+1),"base64url"),y:uE(e.slice(1+r),"base64url"),ext:!0}}var cAe=(t,e)=>({...lK(t,e.public),d:uE(e.private,"base64url")})});var yK=m((eat,pK)=>{l();"use strict";var uAe=hK();pK.exports=async t=>uAe.generateEphmeralKeyPair(t)});var R4=m((tat,mK)=>{l();"use strict";var Za=M6();Qc();E_();var fE=yt(),Oy=zo(),{fromString:fAe}=(dt(),bi),lAe=vj(),ro={rsa:iU(),ed25519:uU(),secp256k1:XF()(Za,_y())},T4={message:"secp256k1 support requires libp2p-crypto-secp256k1 package",code:"ERR_MISSING_PACKAGE"};function K0(t){let e=ro[t.toLowerCase()];if(!e){let r=Object.keys(ro).join(" / ");throw Oy(new Error(`invalid or unsupported key type ${t}. Must be ${r}`),"ERR_UNSUPPORTED_KEY_TYPE")}return e}var dAe=async(t,e)=>K0(t).generateKeyPair(e),hAe=async(t,e,r)=>{let i=K0(t);if(t.toLowerCase()!=="ed25519")throw Oy(new Error("Seed key derivation is unimplemented for RSA or secp256k1"),"ERR_UNSUPPORTED_KEY_DERIVATION_TYPE");return i.generateKeyPairFromSeed(e,r)},pAe=t=>{let e=Za.PublicKey.decode(t),r=e.Data;switch(e.Type){case Za.KeyType.RSA:return ro.rsa.unmarshalRsaPublicKey(r);case Za.KeyType.Ed25519:return ro.ed25519.unmarshalEd25519PublicKey(r);case Za.KeyType.Secp256k1:if(ro.secp256k1)return ro.secp256k1.unmarshalSecp256k1PublicKey(r);throw Oy(new Error(T4.message),T4.code);default:K0(e.Type)}},yAe=(t,e)=>(e=(e||"rsa").toLowerCase(),K0(e),t.bytes),gK=async t=>{let e=Za.PrivateKey.decode(t),r=e.Data;switch(e.Type){case Za.KeyType.RSA:return ro.rsa.unmarshalRsaPrivateKey(r);case Za.KeyType.Ed25519:return ro.ed25519.unmarshalEd25519PrivateKey(r);case Za.KeyType.Secp256k1:if(ro.secp256k1)return ro.secp256k1.unmarshalSecp256k1PrivateKey(r);throw Oy(new Error(T4.message),T4.code);default:K0(e.Type)}},gAe=(t,e)=>(e=(e||"rsa").toLowerCase(),K0(e),t.bytes),mAe=async(t,e)=>{try{let n=await lAe.import(t,e);return gK(n)}catch(n){}let r=fE.pki.decryptRsaPrivateKey(t,e);if(r===null)throw Oy(new Error("Cannot read the key, most likely the password is wrong or not a RSA key"),"ERR_CANNOT_DECRYPT_PEM");let i=fE.asn1.toDer(fE.pki.privateKeyToAsn1(r));return i=fAe(i.getBytes(),"ascii"),ro.rsa.unmarshalRsaPrivateKey(i)};mK.exports={supportedKeys:ro,keysPBM:Za,keyStretcher:sK(),generateEphemeralKeyPair:yK(),generateKeyPair:dAe,generateKeyPairFromSeed:hAe,unmarshalPublicKey:pAe,marshalPublicKey:yAe,unmarshalPrivateKey:gK,marshalPrivateKey:gAe,import:mAe}});var P4=m((rat,lE)=>{l();"use strict";function bAe(t,{className:e,symbolName:r}){let i=Symbol.for(r),n={[e]:class extends t{constructor(...s){super(...s);Object.defineProperty(this,i,{value:!0})}get[Symbol.toStringTag](){return e}}}[e];return n[`is${e}`]=s=>!!(s&&s[i]),n}function vAe(t,{className:e,symbolName:r,withoutNew:i}){let n=Symbol.for(r),s={[e]:function(...o){if(i&&!(this instanceof s))return new s(...o);let a=t.call(this,...o)||this;return a&&!a[n]&&Object.defineProperty(a,n,{value:!0}),a}}[e];return s.prototype=Object.create(t.prototype),s.prototype.constructor=s,Object.defineProperty(s.prototype,Symbol.toStringTag,{get(){return e}}),s[`is${e}`]=o=>!!(o&&o[n]),s}lE.exports=bAe;lE.exports.proto=vAe});var wK=m((iat,vK)=>{l();"use strict";var V0=Vi(),bK=V0.Reader,wAe=V0.Writer,Ci=V0.util,ky=V0.roots["libp2p-peer-id"]||(V0.roots["libp2p-peer-id"]={});ky.PeerIdProto=function(){function t(e){if(e)for(var r=Object.keys(e),i=0;i<r.length;++i)e[r[i]]!=null&&(this[r[i]]=e[r[i]])}return t.prototype.id=Ci.newBuffer([]),t.prototype.pubKey=Ci.newBuffer([]),t.prototype.privKey=Ci.newBuffer([]),t.encode=function(r,i){return i||(i=wAe.create()),i.uint32(10).bytes(r.id),r.pubKey!=null&&Object.hasOwnProperty.call(r,"pubKey")&&i.uint32(18).bytes(r.pubKey),r.privKey!=null&&Object.hasOwnProperty.call(r,"privKey")&&i.uint32(26).bytes(r.privKey),i},t.decode=function(r,i){r instanceof bK||(r=bK.create(r));for(var n=i===void 0?r.len:r.pos+i,s=new ky.PeerIdProto;r.pos<n;){var o=r.uint32();switch(o>>>3){case 1:s.id=r.bytes();break;case 2:s.pubKey=r.bytes();break;case 3:s.privKey=r.bytes();break;default:r.skipType(o&7);break}}if(!s.hasOwnProperty("id"))throw Ci.ProtocolError("missing required 'id'",{instance:s});return s},t.fromObject=function(r){if(r instanceof ky.PeerIdProto)return r;var i=new ky.PeerIdProto;return r.id!=null&&(typeof r.id=="string"?Ci.base64.decode(r.id,i.id=Ci.newBuffer(Ci.base64.length(r.id)),0):r.id.length&&(i.id=r.id)),r.pubKey!=null&&(typeof r.pubKey=="string"?Ci.base64.decode(r.pubKey,i.pubKey=Ci.newBuffer(Ci.base64.length(r.pubKey)),0):r.pubKey.length&&(i.pubKey=r.pubKey)),r.privKey!=null&&(typeof r.privKey=="string"?Ci.base64.decode(r.privKey,i.privKey=Ci.newBuffer(Ci.base64.length(r.privKey)),0):r.privKey.length&&(i.privKey=r.privKey)),i},t.toObject=function(r,i){i||(i={});var n={};return i.defaults&&(i.bytes===String?n.id="":(n.id=[],i.bytes!==Array&&(n.id=Ci.newBuffer(n.id))),i.bytes===String?n.pubKey="":(n.pubKey=[],i.bytes!==Array&&(n.pubKey=Ci.newBuffer(n.pubKey))),i.bytes===String?n.privKey="":(n.privKey=[],i.bytes!==Array&&(n.privKey=Ci.newBuffer(n.privKey)))),r.id!=null&&r.hasOwnProperty("id")&&(n.id=i.bytes===String?Ci.base64.encode(r.id,0,r.id.length):i.bytes===Array?Array.prototype.slice.call(r.id):r.id),r.pubKey!=null&&r.hasOwnProperty("pubKey")&&(n.pubKey=i.bytes===String?Ci.base64.encode(r.pubKey,0,r.pubKey.length):i.bytes===Array?Array.prototype.slice.call(r.pubKey):r.pubKey),r.privKey!=null&&r.hasOwnProperty("privKey")&&(n.privKey=i.bytes===String?Ci.base64.encode(r.privKey,0,r.privKey.length):i.bytes===Array?Array.prototype.slice.call(r.privKey):r.privKey),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,V0.util.toJSONOptions)},t}();vK.exports=ky});var it=m((An,RK)=>{l();"use strict";var{CID:dE}=(Te(),Xu),_Ae=(yn(),Yu),EAe=(i9(),c6),SAe=(li(),Fs),xAe=($2(),e0),{base58btc:hE}=(li(),Fs),{base32:AAe}=(yn(),Yu),{base16:_K}=(r9(),a6),Dy=(Bn(),Wh),Ja=R4(),IAe=P4(),{PeerIdProto:EK}=wK(),{equals:Ql}=(wi(),bn),{fromString:By}=(dt(),bi),{toString:TAe}=(tt(),hr),{identity:C4}=(Gc(),G2),SK={..._Ae,...EAe,...SAe,...xAe},RAe=Object.keys(SK).reduce((t,e)=>t.or(SK[e]),AAe.decoder),PAe=112,xK=114,AK=class{constructor(e,r,i){if(!(e instanceof Uint8Array))throw new Error("invalid id provided");if(r&&i&&!Ql(r.public.bytes,i.bytes))throw new Error("inconsistent arguments");this._id=e,this._idB58String=hE.encode(this.id).substring(1),this._privKey=r,this._pubKey=i}get id(){return this._id}set id(e){throw new Error("Id is immutable")}get privKey(){return this._privKey}set privKey(e){this._privKey=e}get pubKey(){if(this._pubKey)return this._pubKey;if(this._privKey)return this._privKey.public;try{let e=Dy.decode(this.id);e.code===C4.code&&(this._pubKey=Ja.unmarshalPublicKey(e.digest))}catch(e){}return this._pubKey}set pubKey(e){this._pubKey=e}marshalPubKey(){if(this.pubKey)return Ja.marshalPublicKey(this.pubKey)}marshalPrivKey(){if(this.privKey)return Ja.marshalPrivateKey(this.privKey)}marshal(e){return EK.encode({id:this.toBytes(),pubKey:this.marshalPubKey(),privKey:e?null:this.marshalPrivKey()}).finish()}toPrint(){let e=this.toB58String();e.startsWith("Qm")&&(e=e.slice(2));let r=6;return e.length<r&&(r=e.length),"<peer.ID "+e.substr(0,r)+">"}toJSON(){return{id:this.toB58String(),privKey:TK(this.marshalPrivKey()),pubKey:TK(this.marshalPubKey())}}toHexString(){return _K.encode(this.id).substring(1)}toBytes(){return this.id}toB58String(){return this._idB58String}toString(){if(!this._idCIDString){let e=dE.createV1(xK,Dy.decode(this.id));Object.defineProperty(this,"_idCIDString",{value:e.toString(),enumerable:!1})}return this._idCIDString}equals(e){if(e instanceof Uint8Array)return Ql(this.id,e);if(e.id)return Ql(this.id,e.id);throw new Error("not valid Id")}isEqual(e){return this.equals(e)}isValid(){return Boolean(this.privKey&&this.privKey.public&&this.privKey.public.bytes&&this.pubKey.bytes instanceof Uint8Array&&Ql(this.privKey.public.bytes,this.pubKey.bytes))}hasInlinePublicKey(){try{if(Dy.decode(this.id).code===C4.code)return!0}catch(e){}return!1}},ec=IAe(AK,{className:"PeerId",symbolName:"@libp2p/js-peer-id/PeerId"});An=RK.exports=ec;var Ny=t=>t.bytes.length<=42?Dy.create(C4.code,t.bytes).bytes:t.hash(),pE=async(t,e)=>{let r=await Ny(e);return new ec(r,t,e)};An.create=async t=>{t=t||{},t.bits=t.bits||2048,t.keyType=t.keyType||"RSA";let e=await Ja.generateKeyPair(t.keyType,t.bits);return pE(e,e.public)};An.createFromHexString=t=>new ec(_K.decode("f"+t));An.createFromBytes=t=>{try{let e=dE.decode(t);if(!IK(e))throw new Error("Supplied PeerID CID is invalid");return An.createFromCID(e)}catch{if(Dy.decode(t).code!==C4.code)throw new Error("Supplied PeerID CID is invalid");return new ec(t)}};An.createFromB58String=t=>An.createFromBytes(hE.decode("z"+t));var IK=t=>t.code===xK||t.code===PAe;An.createFromCID=t=>{if(t=dE.asCID(t),!t||!IK(t))throw new Error("Supplied PeerID CID is invalid");return new ec(t.multihash.bytes)};An.createFromPubKey=async t=>{let e=t;if(typeof e=="string"&&(e=By(t,"base64pad")),!(e instanceof Uint8Array))throw new Error("Supplied key is neither a base64 string nor a Uint8Array");let r=await Ja.unmarshalPublicKey(e);return pE(void 0,r)};An.createFromPrivKey=async t=>{if(typeof t=="string"&&(t=By(t,"base64pad")),!(t instanceof Uint8Array))throw new Error("Supplied key is neither a base64 string nor a Uint8Array");let e=await Ja.unmarshalPrivateKey(t);return pE(e,e.public)};An.createFromJSON=async t=>{let e=hE.decode("z"+t.id),r=t.privKey&&By(t.privKey,"base64pad"),i=t.pubKey&&By(t.pubKey,"base64pad"),n=i&&await Ja.unmarshalPublicKey(i);if(!r)return new ec(e,void 0,n);let s=await Ja.unmarshalPrivateKey(r),o=await Ny(s.public),a;if(n&&(a=await Ny(n)),n&&!Ql(o,a))throw new Error("Public and private key do not match");if(e&&!Ql(o,e))throw new Error("Id and private key do not match");return new ec(e,s,n)};An.createFromProtobuf=async t=>{typeof t=="string"&&(t=By(t,"base16"));let{id:e,privKey:r,pubKey:i}=EK.decode(t);r=r?await Ja.unmarshalPrivateKey(r):!1,i=i?await Ja.unmarshalPublicKey(i):!1;let n,s;if(r&&(s=await Ny(r.public)),i&&(n=await Ny(i)),r){if(i&&!Ql(s,n))throw new Error("Public and private key do not match");return new ec(s,r,r.public)}if(i)return new ec(n,void 0,i);if(e)return new ec(e);throw new Error("Protobuf did not contain any usable key material")};An.parse=t=>((t.charAt(0)==="1"||t.charAt(0)==="Q")&&(t=`z${t}`),An.createFromBytes(RAe.decode(t)));An.isPeerId=t=>Boolean(typeof t=="object"&&t._id&&t._idB58String);function TK(t){if(t)return TAe(t,"base64pad")}});var is=m((cat,OK)=>{l();"use strict";var OAe=async t=>{let e;for await(let r of t)e=r;return e};OK.exports=OAe});var FK=m((Mat,UK)=>{l();"use strict";function jK(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function kAe(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return jK(t,r)}catch(i){r.message=t.message,r.stack=t.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(t)),jK(new n,r)}}UK.exports=kAe});var bE={};zt(bE,{abortedError:()=>DAe,dbDeleteFailedError:()=>k4,dbOpenFailedError:()=>O4,dbWriteFailedError:()=>D4,notFoundError:()=>un});function O4(t){return t=t||new Error("Cannot open database"),(0,H0.default)(t,"ERR_DB_OPEN_FAILED")}function k4(t){return t=t||new Error("Delete failed"),(0,H0.default)(t,"ERR_DB_DELETE_FAILED")}function D4(t){return t=t||new Error("Write failed"),(0,H0.default)(t,"ERR_DB_WRITE_FAILED")}function un(t){return t=t||new Error("Not Found"),(0,H0.default)(t,"ERR_NOT_FOUND")}function DAe(t){return t=t||new Error("Aborted"),(0,H0.default)(t,"ERR_ABORTED")}var H0,Zo=bt(()=>{l();H0=M(FK())});var KK=m((qat,vE)=>{l();var Lat=function(){typeof vE!="undefined"&&(vE.exports=v);var t=24*3600,e=3200,r=(365*400+97)*e/400,i=t*r,n=i*1e3,s=1e3*1e4*1e4*t,o=16777216,a=65536*65536,c=1e3*1e3,u=1e3*1e3*1e3,f="000000000",d=Math.trunc||q,h=v.prototype;v.fromDate=X,v.fromInt64BE=Y(0,1,2,3,0,4),v.fromInt64LE=Y(3,2,1,0,4,0),v.fromString=W,v.fromTimeT=P,h.year=0,h.time=0,h.nano=0,h.addNano=B,h.getNano=H,h.getTimeT=w,h.getYear=A,h.toDate=F,h.toJSON=S,h.toString=C,h.writeInt64BE=L(0,1,2,3,0,4),h.writeInt64LE=L(3,2,1,0,4,0);var p="%Y-%m-%dT%H:%M:%S.%NZ",y=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],b=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],E={"%":"%",F:"%Y-%m-%d",n:`
`,R:"%H:%M",T:"%H:%M:%S",t:" ",X:"%T",Z:"GMT",z:"+0000"};return v;function v(Q,ue,le){var me=this;if(!(me instanceof v))return new v(Q,ue,le);me.time=+Q||0,me.nano=+ue||0,me.year=+le||0,R(me)}function A(){var Q=this.toDate().getUTCFullYear();return Q+this.year}function R(Q){var ue=Q.year,le=Q.time,me=Q.nano,be,xe;if(me<0||c<=me){var k=Math.floor(me/c);me-=k*c,le+=k,be=1}var K=ue%e;if(le<-s||s<le||K){xe=d(le/n),xe&&(ue+=xe*e,le-=xe*n);var $=D(le);$.setUTCFullYear(K+$.getUTCFullYear()),ue-=K,le=+$,xe=d(ue/e);var ee=le+xe*n;xe&&-s<=ee&&ee<=s&&(ue-=xe*e,le=ee),be=1}return be&&(Q.year=ue,Q.time=le,Q.nano=me),Q}function F(){var Q=R(this);return D(Q.time)}function D(Q){var ue=new Date(0);return ue.setTime(Q),ue}function B(Q){return this.nano+=+Q||0,this}function H(){var Q=R(this);return(Q.time%1e3*c+ +Q.nano+u)%u}function W(Q){var ue,le=new v;Q+="";var me=Q.replace(/^\s*[+\-]?\d+/,function(be){var xe=+be,k=1970+(xe-1970)%400;return le.year=xe-k,k}).replace(/(?:Z|([+\-]\d{2}):?(\d{2}))$/,function(be,xe,k){return xe<0&&(k*=-1),ue=(+xe*60+ +k)*6e4,""}).replace(/\.\d+$/,function(be){return le.nano=+(be+f).substr(1,9),""}).split(/\D+/);if(me.length>1?me[1]--:me[1]=0,le.time=ue=Date.UTC.apply(Date,me)-(ue||0),isNaN(ue))throw new TypeError("Invalid Date");return R(le)}function X(Q){return new v(+Q)}function P(Q){return g(Q,0)}function g(Q,ue){ue|=0,ue*=a,Q=+Q||0;var le=d(ue/i)+d(Q/i),me=ue%i+Q%i,be=d(me/i);return be&&(le+=be,me-=be*i),new v(me*1e3,0,le*e)}function w(){var Q=R(this),ue=Math.floor(Q.time/1e3),le=Q.year;return le&&(ue+=le*r*t/e),ue}function S(){return this.toString().replace(/0{1,6}Z$/,"Z")}function C(Q){var ue=this,le=ue.toDate(),me={H:ee,L:z,M:I,N,S:U,Y:xe,a:Z,b:ie,d:K,e:$,m:k};return be(Q||p);function be(te){return te.replace(/%./g,function(he){var we=he[1],_e=E[we],Ke=me[we];return _e?be(_e):Ke?Ke():he})}function xe(){var te=ue.getYear();return te>999999?"+"+te:te>9999?"+"+de(te,6):te>=0?de(te,4):te>=-999999?"-"+de(-te,6):te}function k(){return j(le.getUTCMonth()+1)}function K(){return j(le.getUTCDate())}function $(){return _(le.getUTCDate())}function ee(){return j(le.getUTCHours())}function I(){return j(le.getUTCMinutes())}function U(){return j(le.getUTCSeconds())}function z(){return de(le.getUTCMilliseconds(),3)}function N(){return de(ue.getNano(),9)}function Z(){return b[le.getUTCDay()]}function ie(){return y[le.getUTCMonth()]}}function L(Q,ue,le,me,be,xe){return k;function k($,ee){var I=R(this);$||($=new Array(8)),V($,ee|=0);var U=Math.floor(I.time/1e3),z=I.year*(r*t/e),N=d(z/a)+d(U/a),Z=z%a+U%a,ie=Math.floor(Z/a);return ie&&(N+=ie,Z-=ie*a),K($,ee+be,N),K($,ee+xe,Z),$}function K($,ee,I){$[ee+Q]=I>>24&255,$[ee+ue]=I>>16&255,$[ee+le]=I>>8&255,$[ee+me]=I&255}}function Y(Q,ue,le,me,be,xe){return k;function k($,ee){V($,ee|=0);var I=K($,ee+be),U=K($,ee+xe);return g(U,I)}function K($,ee){return $[ee+Q]*o+($[ee+ue]<<16|$[ee+le]<<8|$[ee+me])}}function V(Q,ue){var le=Q&&Q.length;if(le==null)throw new TypeError("Invalid Buffer");if(le<ue+8)throw new RangeError("Out of range")}function q(Q){var ue=Q-Q%1;return ue===0&&(Q<0||Q===0&&1/Q!=1/0)?-0:ue}function _(Q){return(Q>9?"":" ")+(Q|0)}function j(Q){return(Q>9?"":"0")+(Q|0)}function de(Q,ue){return(f+(Q|0)).substr(-ue)}}()});var HK=m((jat,zK)=>{l();"use strict";_0();var B4=yt(),{toString:G0}=(tt(),hr),{fromString:VK}=(dt(),bi);zK.exports={createCipheriv:(t,e,r)=>{let i=B4.cipher.createCipher("AES-CTR",G0(e,"ascii"));return i.start({iv:G0(r,"ascii")}),{update:n=>(i.update(B4.util.createBuffer(G0(n,"ascii"))),VK(i.output.getBytes(),"ascii"))}},createDecipheriv:(t,e,r)=>{let i=B4.cipher.createDecipher("AES-CTR",G0(e,"ascii"));return i.start({iv:G0(r,"ascii")}),{update:n=>(i.update(B4.util.createBuffer(G0(n,"ascii"))),VK(i.output.getBytes(),"ascii"))}}}});var WK=m((Uat,$K)=>{l();"use strict";var BAe=zo(),GK={16:"aes-128-ctr",32:"aes-256-ctr"};$K.exports=function(t){let e=GK[t.length];if(!e){let r=Object.entries(GK).map(([i,n])=>`${i} (${n})`).join(" / ");throw BAe(new Error(`Invalid key length ${t.length} bytes. Must be ${r}`),"ERR_INVALID_KEY_LENGTH")}return e}});var QK=m(XK=>{l();"use strict";var YK=HK(),NAe=WK();XK.create=async function(t,e){let r=NAe(t),i=YK.createCipheriv(r,t,e),n=YK.createDecipheriv(r,t,e);return{async encrypt(o){return i.update(o)},async decrypt(o){return n.update(o)}}}});var eV=m((Kat,JK)=>{l();"use strict";var MAe=d_(),LAe=nr(),qAe=zo(),ZK={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};function jAe(t,e,r,i,n){let s=ZK[n];if(!s){let a=Object.keys(ZK).join(" / ");throw qAe(new Error(`Hash '${n}' is unknown or not supported. Must be ${a}`),"ERR_UNSUPPORTED_HASH_TYPE")}let o=MAe(t,e,r,i,s);return LAe.encode64(o)}JK.exports=jAe});var rc=m($0=>{l();"use strict";var UAe=cE(),FAe=QK(),KAe=R4();$0.aes=FAe;$0.hmac=UAe;$0.keys=KAe;$0.randomBytes=_y();$0.pbkdf2=eV()});var iV=m((zat,rV)=>{l();"use strict";function tV(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function VAe(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return tV(t,r)}catch(i){r.message=t.message,r.stack=t.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(t)),tV(new n,r)}}rV.exports=VAe});var pV=m((Hat,hV)=>{l();hV.exports=gr;var io=null;try{io=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(t){}function gr(t,e,r){this.low=t|0,this.high=e|0,this.unsigned=!!r}gr.prototype.__isLong__;Object.defineProperty(gr.prototype,"__isLong__",{value:!0});function ns(t){return(t&&t.__isLong__)===!0}gr.isLong=ns;var nV={},sV={};function Zl(t,e){var r,i,n;return e?(t>>>=0,(n=0<=t&&t<256)&&(i=sV[t],i)?i:(r=mr(t,(t|0)<0?-1:0,!0),n&&(sV[t]=r),r)):(t|=0,(n=-128<=t&&t<128)&&(i=nV[t],i)?i:(r=mr(t,t<0?-1:0,!1),n&&(nV[t]=r),r))}gr.fromInt=Zl;function no(t,e){if(isNaN(t))return e?Jl:so;if(e){if(t<0)return Jl;if(t>=aV)return dV}else{if(t<=-cV)return ss;if(t+1>=cV)return lV}return t<0?no(-t,e).neg():mr(t%W0|0,t/W0|0,e)}gr.fromNumber=no;function mr(t,e,r){return new gr(t,e,r)}gr.fromBits=mr;var N4=Math.pow;function wE(t,e,r){if(t.length===0)throw Error("empty string");if(t==="NaN"||t==="Infinity"||t==="+Infinity"||t==="-Infinity")return so;if(typeof e=="number"?(r=e,e=!1):e=!!e,r=r||10,r<2||36<r)throw RangeError("radix");var i;if((i=t.indexOf("-"))>0)throw Error("interior hyphen");if(i===0)return wE(t.substring(1),e,r).neg();for(var n=no(N4(r,8)),s=so,o=0;o<t.length;o+=8){var a=Math.min(8,t.length-o),c=parseInt(t.substring(o,o+a),r);if(a<8){var u=no(N4(r,a));s=s.mul(u).add(no(c))}else s=s.mul(n),s=s.add(no(c))}return s.unsigned=e,s}gr.fromString=wE;function Jo(t,e){return typeof t=="number"?no(t,e):typeof t=="string"?wE(t,e):mr(t.low,t.high,typeof e=="boolean"?e:t.unsigned)}gr.fromValue=Jo;var oV=1<<16,zAe=1<<24,W0=oV*oV,aV=W0*W0,cV=aV/2,uV=Zl(zAe),so=Zl(0);gr.ZERO=so;var Jl=Zl(0,!0);gr.UZERO=Jl;var Y0=Zl(1);gr.ONE=Y0;var fV=Zl(1,!0);gr.UONE=fV;var _E=Zl(-1);gr.NEG_ONE=_E;var lV=mr(4294967295|0,2147483647|0,!1);gr.MAX_VALUE=lV;var dV=mr(4294967295|0,4294967295|0,!0);gr.MAX_UNSIGNED_VALUE=dV;var ss=mr(0,2147483648|0,!1);gr.MIN_VALUE=ss;var Ce=gr.prototype;Ce.toInt=function(){return this.unsigned?this.low>>>0:this.low};Ce.toNumber=function(){return this.unsigned?(this.high>>>0)*W0+(this.low>>>0):this.high*W0+(this.low>>>0)};Ce.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(ss)){var r=no(e),i=this.div(r),n=i.mul(r).sub(this);return i.toString(e)+n.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var s=no(N4(e,6),this.unsigned),o=this,a="";;){var c=o.div(s),u=o.sub(c.mul(s)).toInt()>>>0,f=u.toString(e);if(o=c,o.isZero())return f+a;for(;f.length<6;)f="0"+f;a=""+f+a}};Ce.getHighBits=function(){return this.high};Ce.getHighBitsUnsigned=function(){return this.high>>>0};Ce.getLowBits=function(){return this.low};Ce.getLowBitsUnsigned=function(){return this.low>>>0};Ce.getNumBitsAbs=function(){if(this.isNegative())return this.eq(ss)?64:this.neg().getNumBitsAbs();for(var e=this.high!=0?this.high:this.low,r=31;r>0&&(e&1<<r)==0;r--);return this.high!=0?r+33:r+1};Ce.isZero=function(){return this.high===0&&this.low===0};Ce.eqz=Ce.isZero;Ce.isNegative=function(){return!this.unsigned&&this.high<0};Ce.isPositive=function(){return this.unsigned||this.high>=0};Ce.isOdd=function(){return(this.low&1)==1};Ce.isEven=function(){return(this.low&1)==0};Ce.equals=function(e){return ns(e)||(e=Jo(e)),this.unsigned!==e.unsigned&&this.high>>>31==1&&e.high>>>31==1?!1:this.high===e.high&&this.low===e.low};Ce.eq=Ce.equals;Ce.notEquals=function(e){return!this.eq(e)};Ce.neq=Ce.notEquals;Ce.ne=Ce.notEquals;Ce.lessThan=function(e){return this.comp(e)<0};Ce.lt=Ce.lessThan;Ce.lessThanOrEqual=function(e){return this.comp(e)<=0};Ce.lte=Ce.lessThanOrEqual;Ce.le=Ce.lessThanOrEqual;Ce.greaterThan=function(e){return this.comp(e)>0};Ce.gt=Ce.greaterThan;Ce.greaterThanOrEqual=function(e){return this.comp(e)>=0};Ce.gte=Ce.greaterThanOrEqual;Ce.ge=Ce.greaterThanOrEqual;Ce.compare=function(e){if(ns(e)||(e=Jo(e)),this.eq(e))return 0;var r=this.isNegative(),i=e.isNegative();return r&&!i?-1:!r&&i?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1};Ce.comp=Ce.compare;Ce.negate=function(){return!this.unsigned&&this.eq(ss)?ss:this.not().add(Y0)};Ce.neg=Ce.negate;Ce.add=function(e){ns(e)||(e=Jo(e));var r=this.high>>>16,i=this.high&65535,n=this.low>>>16,s=this.low&65535,o=e.high>>>16,a=e.high&65535,c=e.low>>>16,u=e.low&65535,f=0,d=0,h=0,p=0;return p+=s+u,h+=p>>>16,p&=65535,h+=n+c,d+=h>>>16,h&=65535,d+=i+a,f+=d>>>16,d&=65535,f+=r+o,f&=65535,mr(h<<16|p,f<<16|d,this.unsigned)};Ce.subtract=function(e){return ns(e)||(e=Jo(e)),this.add(e.neg())};Ce.sub=Ce.subtract;Ce.multiply=function(e){if(this.isZero())return so;if(ns(e)||(e=Jo(e)),io){var r=io.mul(this.low,this.high,e.low,e.high);return mr(r,io.get_high(),this.unsigned)}if(e.isZero())return so;if(this.eq(ss))return e.isOdd()?ss:so;if(e.eq(ss))return this.isOdd()?ss:so;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(uV)&&e.lt(uV))return no(this.toNumber()*e.toNumber(),this.unsigned);var i=this.high>>>16,n=this.high&65535,s=this.low>>>16,o=this.low&65535,a=e.high>>>16,c=e.high&65535,u=e.low>>>16,f=e.low&65535,d=0,h=0,p=0,y=0;return y+=o*f,p+=y>>>16,y&=65535,p+=s*f,h+=p>>>16,p&=65535,p+=o*u,h+=p>>>16,p&=65535,h+=n*f,d+=h>>>16,h&=65535,h+=s*u,d+=h>>>16,h&=65535,h+=o*c,d+=h>>>16,h&=65535,d+=i*f+n*u+s*c+o*a,d&=65535,mr(p<<16|y,d<<16|h,this.unsigned)};Ce.mul=Ce.multiply;Ce.divide=function(e){if(ns(e)||(e=Jo(e)),e.isZero())throw Error("division by zero");if(io){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var r=(this.unsigned?io.div_u:io.div_s)(this.low,this.high,e.low,e.high);return mr(r,io.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?Jl:so;var i,n,s;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return Jl;if(e.gt(this.shru(1)))return fV;s=Jl}else{if(this.eq(ss)){if(e.eq(Y0)||e.eq(_E))return ss;if(e.eq(ss))return Y0;var o=this.shr(1);return i=o.div(e).shl(1),i.eq(so)?e.isNegative()?Y0:_E:(n=this.sub(e.mul(i)),s=i.add(n.div(e)),s)}else if(e.eq(ss))return this.unsigned?Jl:so;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();s=so}for(n=this;n.gte(e);){i=Math.max(1,Math.floor(n.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(i)/Math.LN2),c=a<=48?1:N4(2,a-48),u=no(i),f=u.mul(e);f.isNegative()||f.gt(n);)i-=c,u=no(i,this.unsigned),f=u.mul(e);u.isZero()&&(u=Y0),s=s.add(u),n=n.sub(f)}return s};Ce.div=Ce.divide;Ce.modulo=function(e){if(ns(e)||(e=Jo(e)),io){var r=(this.unsigned?io.rem_u:io.rem_s)(this.low,this.high,e.low,e.high);return mr(r,io.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))};Ce.mod=Ce.modulo;Ce.rem=Ce.modulo;Ce.not=function(){return mr(~this.low,~this.high,this.unsigned)};Ce.and=function(e){return ns(e)||(e=Jo(e)),mr(this.low&e.low,this.high&e.high,this.unsigned)};Ce.or=function(e){return ns(e)||(e=Jo(e)),mr(this.low|e.low,this.high|e.high,this.unsigned)};Ce.xor=function(e){return ns(e)||(e=Jo(e)),mr(this.low^e.low,this.high^e.high,this.unsigned)};Ce.shiftLeft=function(e){return ns(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?mr(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):mr(0,this.low<<e-32,this.unsigned)};Ce.shl=Ce.shiftLeft;Ce.shiftRight=function(e){return ns(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?mr(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):mr(this.high>>e-32,this.high>=0?0:-1,this.unsigned)};Ce.shr=Ce.shiftRight;Ce.shiftRightUnsigned=function(e){if(ns(e)&&(e=e.toInt()),e&=63,e===0)return this;var r=this.high;if(e<32){var i=this.low;return mr(i>>>e|r<<32-e,r>>>e,this.unsigned)}else return e===32?mr(r,0,this.unsigned):mr(r>>>e-32,0,this.unsigned)};Ce.shru=Ce.shiftRightUnsigned;Ce.shr_u=Ce.shiftRightUnsigned;Ce.toSigned=function(){return this.unsigned?mr(this.low,this.high,!1):this};Ce.toUnsigned=function(){return this.unsigned?this:mr(this.low,this.high,!0)};Ce.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()};Ce.toBytesLE=function(){var e=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]};Ce.toBytesBE=function(){var e=this.high,r=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,r>>>24,r>>>16&255,r>>>8&255,r&255]};gr.fromBytes=function(e,r,i){return i?gr.fromBytesLE(e,r):gr.fromBytesBE(e,r)};gr.fromBytesLE=function(e,r){return new gr(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,r)};gr.fromBytesBE=function(e,r){return new gr(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],r)}});var nd=m((Tct,jV)=>{l();"use strict";var iIe=async t=>{let e=[];for await(let r of t)e.push(r);return e};jV.exports=iIe});var UV,z4,LE=bt(()=>{l();UV=M(nd()),z4=(t,e)=>async function*(){yield*(await(0,UV.default)(t)).sort(e)}()});var ic=m((Pct,FV)=>{l();"use strict";var nIe=async t=>{for await(let e of t);};FV.exports=nIe});var ea=m((Cct,KV)=>{l();"use strict";var sIe=async function*(t,e){for await(let r of t)await e(r)&&(yield r)};KV.exports=sIe});var Z0=m((Oct,VV)=>{l();"use strict";var oIe=async function*(t,e){let r=0;if(!(e<1)){for await(let i of t)if(yield i,r++,r===e)return}};VV.exports=oIe});var qE,sd,jE,As,od=bt(()=>{l();LE();qE=M(ic()),sd=M(ea()),jE=M(Z0()),As=class{open(){return Promise.reject(new Error(".open is not implemented"))}close(){return Promise.reject(new Error(".close is not implemented"))}put(e,r,i){return Promise.reject(new Error(".put is not implemented"))}get(e,r){return Promise.reject(new Error(".get is not implemented"))}has(e,r){return Promise.reject(new Error(".has is not implemented"))}delete(e,r){return Promise.reject(new Error(".delete is not implemented"))}async*putMany(e,r={}){for await(let{key:i,value:n}of e)await this.put(i,n,r),yield{key:i,value:n}}async*getMany(e,r={}){for await(let i of e)yield this.get(i,r)}async*deleteMany(e,r={}){for await(let i of e)await this.delete(i,r),yield i}batch(){let e=[],r=[];return{put(i,n){e.push({key:i,value:n})},delete(i){r.push(i)},commit:async i=>{await(0,qE.default)(this.putMany(e,i)),e=[],await(0,qE.default)(this.deleteMany(r,i)),r=[]}}}async*_all(e,r){throw new Error("._all is not implemented")}async*_allKeys(e,r){throw new Error("._allKeys is not implemented")}query(e,r){let i=this._all(e,r);if(e.prefix!=null&&(i=(0,sd.default)(i,n=>n.key.toString().startsWith(e.prefix))),Array.isArray(e.filters)&&(i=e.filters.reduce((n,s)=>(0,sd.default)(n,s),i)),Array.isArray(e.orders)&&(i=e.orders.reduce((n,s)=>z4(n,s),i)),e.offset!=null){let n=0;i=(0,sd.default)(i,()=>n++>=e.offset)}return e.limit!=null&&(i=(0,jE.default)(i,e.limit)),i}queryKeys(e,r){let i=this._allKeys(e,r);if(e.prefix!=null&&(i=(0,sd.default)(i,n=>n.toString().startsWith(e.prefix))),Array.isArray(e.filters)&&(i=e.filters.reduce((n,s)=>(0,sd.default)(n,s),i)),Array.isArray(e.orders)&&(i=e.orders.reduce((n,s)=>z4(n,s),i)),e.offset!=null){let n=0;i=(0,sd.default)(i,()=>n++>=e.offset)}return e.limit!=null&&(i=(0,jE.default)(i,e.limit)),i}}});var HV=m((Nct,zV)=>{l();zV.exports=class{constructor(e){if(!(e>0)||(e-1&e)!=0)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){let e=this.buffer[this.btm];if(e!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return this.buffer[this.btm]===void 0}}});var UE=m((Lct,$V)=>{l();var GV=HV();$V.exports=class{constructor(e){this.hwm=e||16,this.head=new GV(this.hwm),this.tail=this.head}push(e){if(!this.head.push(e)){let r=this.head;this.head=r.next=new GV(2*this.head.buffer.length),this.head.push(e)}}shift(){let e=this.tail.shift();if(e===void 0&&this.tail.next){let r=this.tail.next;return this.tail.next=null,this.tail=r,this.tail.shift()}return e}isEmpty(){return this.head.isEmpty()}}});var nc=m((qct,WV)=>{l();var FE=UE();WV.exports=t=>{t=t||{};let e;typeof t=="function"?(e=t,t={}):e=t.onEnd;let r=new FE,i,n,s,o=()=>{if(!r.isEmpty()){if(t.writev){let b,E=[];for(;!r.isEmpty();){if(b=r.shift(),b.error)throw b.error;E.push(b.value)}return{done:b.done,value:E}}let y=r.shift();if(y.error)throw y.error;return y}return s?{done:!0}:new Promise((y,b)=>{n=E=>(n=null,E.error?b(E.error):t.writev&&!E.done?y({done:E.done,value:[E.value]}):y(E),i)})},a=y=>n?n(y):(r.push(y),i),c=y=>(r=new FE,n?n({error:y}):(r.push({error:y}),i)),u=y=>s?i:a({done:!1,value:y}),f=y=>s?i:(s=!0,y?c(y):a({done:!0})),d=()=>(r=new FE,f(),{done:!0}),h=y=>(f(y),{done:!0});if(i={[Symbol.asyncIterator](){return this},next:o,return:d,throw:h,push:u,end:f},!e)return i;let p=i;return i={[Symbol.asyncIterator](){return this},next(){return p.next()},throw(y){return p.throw(y),e&&(e(y),e=null),{done:!0}},return(){return p.return(),e&&(e(),e=null),{done:!0}},push:u,end(y){return p.end(y),e&&(e(y),e=null),i}},i}});var Vy=m((zE,HE)=>{l();(function(t,e){typeof zE=="object"&&typeof HE!="undefined"?HE.exports=function(r,i,n,s,o){for(i=i.split?i.split("."):i,s=0;s<i.length;s++)r=r?r[i[s]]:o;return r===o?n:r}:typeof define=="function"&&define.amd?define(function(){return function(r,i,n,s,o){for(i=i.split?i.split("."):i,s=0;s<i.length;s++)r=r?r[i[s]]:o;return r===o?n:r}}):t.dlv=function(r,i,n,s,o){for(i=i.split?i.split("."):i,s=0;s<i.length;s++)r=r?r[i[s]]:o;return r===o?n:r}})(zE)});var ZV={};zt(ZV,{MemoryDatastore:()=>ZE});var ZE,JE=bt(()=>{l();od();Br();Zo();ZE=class extends As{constructor(){super();this.data={}}open(){return Promise.resolve()}close(){return Promise.resolve()}async put(e,r){this.data[e.toString()]=r}async get(e){if(!await this.has(e))throw un();return this.data[e.toString()]}async has(e){return this.data[e.toString()]!==void 0}async delete(e){delete this.data[e.toString()]}async*_all(){yield*Object.entries(this.data).map(([e,r])=>({key:new qe(e),value:r}))}async*_allKeys(){yield*Object.entries(this.data).map(([e])=>new qe(e))}}});var oo=m((Zct,JV)=>{l();"use strict";var cIe=async function*(t,e){for await(let r of t)yield e(r)};JV.exports=cIe});var Nr=m((Jct,J0)=>{l();var ez=(...t)=>{let e;for(;t.length;)e=t.shift()(e);return e},eS=t=>t&&(typeof t[Symbol.asyncIterator]=="function"||typeof t[Symbol.iterator]=="function"||typeof t.next=="function"),W4=t=>t&&typeof t.sink=="function"&&eS(t.source),uIe=t=>e=>(t.sink(e),t.source),tz=(...t)=>{if(W4(t[0])){let e=t[0];t[0]=()=>e.source}else if(eS(t[0])){let e=t[0];t[0]=()=>e}if(t.length>1&&W4(t[t.length-1])&&(t[t.length-1]=t[t.length-1].sink),t.length>2)for(let e=1;e<t.length-1;e++)W4(t[e])&&(t[e]=uIe(t[e]));return ez(...t)};J0.exports=tz;J0.exports.pipe=tz;J0.exports.rawPipe=ez;J0.exports.isIterable=eS;J0.exports.isDuplex=W4});var ep=m((fut,rz)=>{l();"use strict";var dIe=nc(),hIe=async function*(...t){let e=dIe();setTimeout(async()=>{try{await Promise.all(t.map(async r=>{for await(let i of r)e.push(i)})),e.end()}catch(r){e.end(r)}},0),yield*e};rz.exports=hIe});var rS=m((Dut,nz)=>{l();"use strict";function iz(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function mIe(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return iz(t,r)}catch(i){r.message=t.message,r.stack=t.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(t)),iz(new n,r)}}nz.exports=mIe});var uz=m((Wut,cz)=>{l();"use strict";var ip=Vi(),az=ip.Reader,bIe=ip.Writer,ao=ip.util,Gy=ip.roots["libp2p-record"]||(ip.roots["libp2p-record"]={});Gy.Record=function(){function t(e){if(e)for(var r=Object.keys(e),i=0;i<r.length;++i)e[r[i]]!=null&&(this[r[i]]=e[r[i]])}return t.prototype.key=ao.newBuffer([]),t.prototype.value=ao.newBuffer([]),t.prototype.timeReceived="",t.encode=function(r,i){return i||(i=bIe.create()),r.key!=null&&Object.hasOwnProperty.call(r,"key")&&i.uint32(10).bytes(r.key),r.value!=null&&Object.hasOwnProperty.call(r,"value")&&i.uint32(18).bytes(r.value),r.timeReceived!=null&&Object.hasOwnProperty.call(r,"timeReceived")&&i.uint32(42).string(r.timeReceived),i},t.decode=function(r,i){r instanceof az||(r=az.create(r));for(var n=i===void 0?r.len:r.pos+i,s=new Gy.Record;r.pos<n;){var o=r.uint32();switch(o>>>3){case 1:s.key=r.bytes();break;case 2:s.value=r.bytes();break;case 5:s.timeReceived=r.string();break;default:r.skipType(o&7);break}}return s},t.fromObject=function(r){if(r instanceof Gy.Record)return r;var i=new Gy.Record;return r.key!=null&&(typeof r.key=="string"?ao.base64.decode(r.key,i.key=ao.newBuffer(ao.base64.length(r.key)),0):r.key.length&&(i.key=r.key)),r.value!=null&&(typeof r.value=="string"?ao.base64.decode(r.value,i.value=ao.newBuffer(ao.base64.length(r.value)),0):r.value.length&&(i.value=r.value)),r.timeReceived!=null&&(i.timeReceived=String(r.timeReceived)),i},t.toObject=function(r,i){i||(i={});var n={};return i.defaults&&(i.bytes===String?n.key="":(n.key=[],i.bytes!==Array&&(n.key=ao.newBuffer(n.key))),i.bytes===String?n.value="":(n.value=[],i.bytes!==Array&&(n.value=ao.newBuffer(n.value))),n.timeReceived=""),r.key!=null&&r.hasOwnProperty("key")&&(n.key=i.bytes===String?ao.base64.encode(r.key,0,r.key.length):i.bytes===Array?Array.prototype.slice.call(r.key):r.key),r.value!=null&&r.hasOwnProperty("value")&&(n.value=i.bytes===String?ao.base64.encode(r.value,0,r.value.length):i.bytes===Array?Array.prototype.slice.call(r.value):r.value),r.timeReceived!=null&&r.hasOwnProperty("timeReceived")&&(n.timeReceived=r.timeReceived),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,ip.util.toJSONOptions)},t}();cz.exports=Gy});var fz=m((Yut,uS)=>{l();"use strict";uS.exports.toRFC3339=t=>{let e=t.getUTCFullYear(),r=String(t.getUTCMonth()+1).padStart(2,"0"),i=String(t.getUTCDate()).padStart(2,"0"),n=String(t.getUTCHours()).padStart(2,"0"),s=String(t.getUTCMinutes()).padStart(2,"0"),o=String(t.getUTCSeconds()).padStart(2,"0"),c=t.getUTCMilliseconds()*1e3*1e3;return`${e}-${r}-${i}T${n}:${s}:${o}.${c}Z`};uS.exports.parseRFC3339=t=>{let e=new RegExp("(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d+)Z"),r=String(t).trim().match(e);if(!r)throw new Error("Invalid format");let i=parseInt(r[1],10),n=parseInt(r[2],10)-1,s=parseInt(r[3],10),o=parseInt(r[4],10),a=parseInt(r[5],10),c=parseInt(r[6],10),u=parseInt(r[7].slice(0,-6),10);return new Date(Date.UTC(i,n,s,o,a,c,u))}});var hz=m((Xut,dz)=>{l();"use strict";var{Record:fS}=uz(),lz=fz(),$y=class{constructor(e,r,i){if(!(e instanceof Uint8Array))throw new Error("key must be a Uint8Array");if(!(r instanceof Uint8Array))throw new Error("value must be a Uint8Array");this.key=e,this.value=r,this.timeReceived=i}serialize(){return fS.encode(this.prepareSerialize()).finish()}prepareSerialize(){return{key:this.key,value:this.value,timeReceived:this.timeReceived&&lz.toRFC3339(this.timeReceived)}}static deserialize(e){let r=fS.decode(e);return $y.fromDeserialized(fS.toObject(r,{defaults:!1,arrays:!0,longs:Number,objects:!1}))}static fromDeserialized(e){let r;return e.timeReceived&&(r=lz.parseRFC3339(e.timeReceived)),new $y(e.key,e.value,r)}};dz.exports=$y});var X4=m((Qut,yz)=>{l();"use strict";function pz(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function vIe(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return pz(t,r)}catch(i){r.message=t.message,r.stack=t.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(t)),pz(new n,r)}}yz.exports=vIe});var mz=m((Zut,gz)=>{l();"use strict";var{sha256:wIe}=(di(),zs),Q4=X4(),{toString:_Ie}=(tt(),hr),{equals:EIe}=(wi(),bn),SIe=async(t,e)=>{if(!(t instanceof Uint8Array))throw Q4(new Error('"key" must be a Uint8Array'),"ERR_INVALID_RECORD_KEY_NOT_BUFFER");if(t.byteLength<5)throw Q4(new Error("invalid public key record"),"ERR_INVALID_RECORD_KEY_TOO_SHORT");if(_Ie(t.subarray(0,4))!=="/pk/")throw Q4(new Error("key was not prefixed with /pk/"),"ERR_INVALID_RECORD_KEY_BAD_PREFIX");let i=t.slice(4),n=await wIe.digest(e);if(!EIe(i,n.bytes))throw Q4(new Error("public key does not match passed in key"),"ERR_INVALID_RECORD_HASH_MISMATCH")};gz.exports={func:SIe,sign:!1}});var vz=m((Jut,bz)=>{l();"use strict";bz.exports={pk:mz()}});var _z=m((eft,wz)=>{l();"use strict";var xIe=X4(),{toString:AIe}=(tt(),hr),IIe=(t,e)=>{let r=e.key,n=AIe(r).split("/");if(n.length<3)return;let s=t[n[1].toString()];if(!s){let o="Invalid record keytype";throw xIe(new Error(o),"ERR_INVALID_RECORD_KEY_TYPE")}return s.func(r,e.value)};wz.exports={verifyRecord:IIe,validators:vz()}});var Sz=m((tft,Ez)=>{l();"use strict";var TIe=(t,e)=>0;Ez.exports=TIe});var Az=m((rft,xz)=>{l();"use strict";xz.exports={pk:Sz()}});var Tz=m((ift,Iz)=>{l();"use strict";var lS=X4(),{toString:RIe}=(tt(),hr),PIe=(t,e,r)=>{if(r.length===0){let o="No records given";throw lS(new Error(o),"ERR_NO_RECORDS_RECEIVED")}let n=RIe(e).split("/");if(n.length<3){let o="Record key does not have a selector function";throw lS(new Error(o),"ERR_NO_SELECTOR_FUNCTION_FOR_RECORD_KEY")}let s=t[n[1].toString()];if(!s){let o=`Unrecognized key prefix: ${n[1]}`;throw lS(new Error(o),"ERR_UNRECOGNIZED_KEY_PREFIX")}return s(e,r)};Iz.exports={bestRecord:PIe,selectors:Az()}});var ad=m((nft,Rz)=>{l();"use strict";Rz.exports={Record:hz(),validator:_z(),selection:Tz()}});var Lz=m((Tft,Mz)=>{l();"use strict";var OIe=/^(?:[a-z0-9](?:[a-z0-9\-]{0,61}[a-z0-9])?\.){0,126}(?:[a-z0-9](?:[a-z0-9\-]{0,61}[a-z0-9]))\.?$/i;Mz.exports=function(e,r){if(r==null&&(r=!1),e.length<2||e.length>255)return!1;var i=e[e.length-1];if(r){if(i!==".")return!1}else if(i===".")return!1;return OIe.test(e)}});var fu=m((Hlt,fH)=>{l();"use strict";var UIe=()=>{let t={};return t.promise=new Promise((e,r)=>{t.resolve=e,t.reject=r}),t};fH.exports=UIe});var br=m((Glt,TS)=>{l();"use strict";var op=typeof Reflect=="object"?Reflect:null,lH=op&&typeof op.apply=="function"?op.apply:function(e,r,i){return Function.prototype.apply.call(e,r,i)},rb;op&&typeof op.ownKeys=="function"?rb=op.ownKeys:Object.getOwnPropertySymbols?rb=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:rb=function(e){return Object.getOwnPropertyNames(e)};function FIe(t){console&&console.warn&&console.warn(t)}var dH=Number.isNaN||function(e){return e!==e};function ir(){ir.init.call(this)}TS.exports=ir;TS.exports.once=HIe;ir.EventEmitter=ir;ir.prototype._events=void 0;ir.prototype._eventsCount=0;ir.prototype._maxListeners=void 0;var hH=10;function ib(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(ir,"defaultMaxListeners",{enumerable:!0,get:function(){return hH},set:function(t){if(typeof t!="number"||t<0||dH(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");hH=t}});ir.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};ir.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||dH(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function pH(t){return t._maxListeners===void 0?ir.defaultMaxListeners:t._maxListeners}ir.prototype.getMaxListeners=function(){return pH(this)};ir.prototype.emit=function(e){for(var r=[],i=1;i<arguments.length;i++)r.push(arguments[i]);var n=e==="error",s=this._events;if(s!==void 0)n=n&&s.error===void 0;else if(!n)return!1;if(n){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=s[e];if(c===void 0)return!1;if(typeof c=="function")lH(c,this,r);else for(var u=c.length,f=vH(c,u),i=0;i<u;++i)lH(f[i],this,r);return!0};function yH(t,e,r,i){var n,s,o;if(ib(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),n=pH(t),n>0&&o.length>n&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,FIe(a)}return t}ir.prototype.addListener=function(e,r){return yH(this,e,r,!1)};ir.prototype.on=ir.prototype.addListener;ir.prototype.prependListener=function(e,r){return yH(this,e,r,!0)};function KIe(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function gH(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=KIe.bind(i);return n.listener=r,i.wrapFn=n,n}ir.prototype.once=function(e,r){return ib(r),this.on(e,gH(this,e,r)),this};ir.prototype.prependOnceListener=function(e,r){return ib(r),this.prependListener(e,gH(this,e,r)),this};ir.prototype.removeListener=function(e,r){var i,n,s,o,a;if(ib(r),n=this._events,n===void 0)return this;if(i=n[e],i===void 0)return this;if(i===r||i.listener===r)--this._eventsCount==0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,i.listener||r));else if(typeof i!="function"){for(s=-1,o=i.length-1;o>=0;o--)if(i[o]===r||i[o].listener===r){a=i[o].listener,s=o;break}if(s<0)return this;s===0?i.shift():VIe(i,s),i.length===1&&(n[e]=i[0]),n.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};ir.prototype.off=ir.prototype.removeListener;ir.prototype.removeAllListeners=function(e){var r,i,n;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var s=Object.keys(i),o;for(n=0;n<s.length;++n)o=s[n],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=i[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(n=r.length-1;n>=0;n--)this.removeListener(e,r[n]);return this};function mH(t,e,r){var i=t._events;if(i===void 0)return[];var n=i[e];return n===void 0?[]:typeof n=="function"?r?[n.listener||n]:[n]:r?zIe(n):vH(n,n.length)}ir.prototype.listeners=function(e){return mH(this,e,!0)};ir.prototype.rawListeners=function(e){return mH(this,e,!1)};ir.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):bH.call(t,e)};ir.prototype.listenerCount=bH;function bH(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}ir.prototype.eventNames=function(){return this._eventsCount>0?rb(this._events):[]};function vH(t,e){for(var r=new Array(e),i=0;i<e;++i)r[i]=t[i];return r}function VIe(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function zIe(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function HIe(t,e){return new Promise(function(r,i){function n(o){t.removeListener(e,s),i(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",n),r([].slice.call(arguments))}wH(t,e,s,{once:!0}),e!=="error"&&GIe(t,n,{once:!0})})}function GIe(t,e,r){typeof t.on=="function"&&wH(t,"error",e,r)}function wH(t,e,r,i){if(typeof t.on=="function")i.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function n(s){i.once&&t.removeEventListener(e,n),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}});var EH=m(($lt,_H)=>{l();"use strict";var nb=fu(),$Ie=br().EventEmitter;async function*WIe(t,e=1){e<1&&(e=1);let r=new $Ie,i=[],n=nb(),s=!1,o=nb();for(r.on("task-complete",()=>{o.resolve(),o=nb()}),Promise.resolve().then(async()=>{try{for await(let a of t){i.length===e&&await n.promise;let c={done:!1};i.push(c),a().then(u=>{c.done=!0,c.ok=!0,c.value=u,r.emit("task-complete")},u=>{c.done=!0,c.err=u,r.emit("task-complete")})}s=!0}catch(a){r.emit("task-complete")}});;){for(await o.promise;i.length&&i[0].done;){let a=i[0];if(i.shift(),a.ok)yield a.value;else throw a.err;n.resolve(),n=nb()}if(s&&i.length===0)break}}_H.exports=WIe});var ob=m((cdt,kH)=>{l();"use strict";async function*XIe(t,e=1){let r=[];e<1&&(e=1);for await(let i of t)for(r.push(i);r.length>=e;)yield r.slice(0,e),r=r.slice(e);for(;r.length;)yield r.slice(0,e),r=r.slice(e)}kH.exports=XIe});var ab=m((udt,DH)=>{l();"use strict";var QIe=ob();async function*ZIe(t,e=1){for await(let r of QIe(t,e)){let i=r.map(n=>n().then(s=>({ok:!0,value:s}),s=>({ok:!1,err:s})));for(let n=0;n<i.length;n++){let s=await i[n];if(s.ok)yield s.value;else throw s.err}}}DH.exports=ZIe});var BH=m((Yy,cb)=>{l();(function(t,e){"use strict";var r={version:"3.0.0",x86:{},x64:{},inputValidation:!0};function i(p){if(!Array.isArray(p)&&!ArrayBuffer.isView(p))return!1;for(var y=0;y<p.length;y++)if(!Number.isInteger(p[y])||p[y]<0||p[y]>255)return!1;return!0}function n(p,y){return(p&65535)*y+(((p>>>16)*y&65535)<<16)}function s(p,y){return p<<y|p>>>32-y}function o(p){return p^=p>>>16,p=n(p,2246822507),p^=p>>>13,p=n(p,3266489909),p^=p>>>16,p}function a(p,y){p=[p[0]>>>16,p[0]&65535,p[1]>>>16,p[1]&65535],y=[y[0]>>>16,y[0]&65535,y[1]>>>16,y[1]&65535];var b=[0,0,0,0];return b[3]+=p[3]+y[3],b[2]+=b[3]>>>16,b[3]&=65535,b[2]+=p[2]+y[2],b[1]+=b[2]>>>16,b[2]&=65535,b[1]+=p[1]+y[1],b[0]+=b[1]>>>16,b[1]&=65535,b[0]+=p[0]+y[0],b[0]&=65535,[b[0]<<16|b[1],b[2]<<16|b[3]]}function c(p,y){p=[p[0]>>>16,p[0]&65535,p[1]>>>16,p[1]&65535],y=[y[0]>>>16,y[0]&65535,y[1]>>>16,y[1]&65535];var b=[0,0,0,0];return b[3]+=p[3]*y[3],b[2]+=b[3]>>>16,b[3]&=65535,b[2]+=p[2]*y[3],b[1]+=b[2]>>>16,b[2]&=65535,b[2]+=p[3]*y[2],b[1]+=b[2]>>>16,b[2]&=65535,b[1]+=p[1]*y[3],b[0]+=b[1]>>>16,b[1]&=65535,b[1]+=p[2]*y[2],b[0]+=b[1]>>>16,b[1]&=65535,b[1]+=p[3]*y[1],b[0]+=b[1]>>>16,b[1]&=65535,b[0]+=p[0]*y[3]+p[1]*y[2]+p[2]*y[1]+p[3]*y[0],b[0]&=65535,[b[0]<<16|b[1],b[2]<<16|b[3]]}function u(p,y){return y%=64,y===32?[p[1],p[0]]:y<32?[p[0]<<y|p[1]>>>32-y,p[1]<<y|p[0]>>>32-y]:(y-=32,[p[1]<<y|p[0]>>>32-y,p[0]<<y|p[1]>>>32-y])}function f(p,y){return y%=64,y===0?p:y<32?[p[0]<<y|p[1]>>>32-y,p[1]<<y]:[p[1]<<y-32,0]}function d(p,y){return[p[0]^y[0],p[1]^y[1]]}function h(p){return p=d(p,[0,p[0]>>>1]),p=c(p,[4283543511,3981806797]),p=d(p,[0,p[0]>>>1]),p=c(p,[3301882366,444984403]),p=d(p,[0,p[0]>>>1]),p}r.x86.hash32=function(p,y){if(r.inputValidation&&!i(p))return e;y=y||0;for(var b=p.length%4,E=p.length-b,v=y,A=0,R=3432918353,F=461845907,D=0;D<E;D=D+4)A=p[D]|p[D+1]<<8|p[D+2]<<16|p[D+3]<<24,A=n(A,R),A=s(A,15),A=n(A,F),v^=A,v=s(v,13),v=n(v,5)+3864292196;switch(A=0,b){case 3:A^=p[D+2]<<16;case 2:A^=p[D+1]<<8;case 1:A^=p[D],A=n(A,R),A=s(A,15),A=n(A,F),v^=A}return v^=p.length,v=o(v),v>>>0},r.x86.hash128=function(p,y){if(r.inputValidation&&!i(p))return e;y=y||0;for(var b=p.length%16,E=p.length-b,v=y,A=y,R=y,F=y,D=0,B=0,H=0,W=0,X=597399067,P=2869860233,g=951274213,w=2716044179,S=0;S<E;S=S+16)D=p[S]|p[S+1]<<8|p[S+2]<<16|p[S+3]<<24,B=p[S+4]|p[S+5]<<8|p[S+6]<<16|p[S+7]<<24,H=p[S+8]|p[S+9]<<8|p[S+10]<<16|p[S+11]<<24,W=p[S+12]|p[S+13]<<8|p[S+14]<<16|p[S+15]<<24,D=n(D,X),D=s(D,15),D=n(D,P),v^=D,v=s(v,19),v+=A,v=n(v,5)+1444728091,B=n(B,P),B=s(B,16),B=n(B,g),A^=B,A=s(A,17),A+=R,A=n(A,5)+197830471,H=n(H,g),H=s(H,17),H=n(H,w),R^=H,R=s(R,15),R+=F,R=n(R,5)+2530024501,W=n(W,w),W=s(W,18),W=n(W,X),F^=W,F=s(F,13),F+=v,F=n(F,5)+850148119;switch(D=0,B=0,H=0,W=0,b){case 15:W^=p[S+14]<<16;case 14:W^=p[S+13]<<8;case 13:W^=p[S+12],W=n(W,w),W=s(W,18),W=n(W,X),F^=W;case 12:H^=p[S+11]<<24;case 11:H^=p[S+10]<<16;case 10:H^=p[S+9]<<8;case 9:H^=p[S+8],H=n(H,g),H=s(H,17),H=n(H,w),R^=H;case 8:B^=p[S+7]<<24;case 7:B^=p[S+6]<<16;case 6:B^=p[S+5]<<8;case 5:B^=p[S+4],B=n(B,P),B=s(B,16),B=n(B,g),A^=B;case 4:D^=p[S+3]<<24;case 3:D^=p[S+2]<<16;case 2:D^=p[S+1]<<8;case 1:D^=p[S],D=n(D,X),D=s(D,15),D=n(D,P),v^=D}return v^=p.length,A^=p.length,R^=p.length,F^=p.length,v+=A,v+=R,v+=F,A+=v,R+=v,F+=v,v=o(v),A=o(A),R=o(R),F=o(F),v+=A,v+=R,v+=F,A+=v,R+=v,F+=v,("00000000"+(v>>>0).toString(16)).slice(-8)+("00000000"+(A>>>0).toString(16)).slice(-8)+("00000000"+(R>>>0).toString(16)).slice(-8)+("00000000"+(F>>>0).toString(16)).slice(-8)},r.x64.hash128=function(p,y){if(r.inputValidation&&!i(p))return e;y=y||0;for(var b=p.length%16,E=p.length-b,v=[0,y],A=[0,y],R=[0,0],F=[0,0],D=[2277735313,289559509],B=[1291169091,658871167],H=0;H<E;H=H+16)R=[p[H+4]|p[H+5]<<8|p[H+6]<<16|p[H+7]<<24,p[H]|p[H+1]<<8|p[H+2]<<16|p[H+3]<<24],F=[p[H+12]|p[H+13]<<8|p[H+14]<<16|p[H+15]<<24,p[H+8]|p[H+9]<<8|p[H+10]<<16|p[H+11]<<24],R=c(R,D),R=u(R,31),R=c(R,B),v=d(v,R),v=u(v,27),v=a(v,A),v=a(c(v,[0,5]),[0,1390208809]),F=c(F,B),F=u(F,33),F=c(F,D),A=d(A,F),A=u(A,31),A=a(A,v),A=a(c(A,[0,5]),[0,944331445]);switch(R=[0,0],F=[0,0],b){case 15:F=d(F,f([0,p[H+14]],48));case 14:F=d(F,f([0,p[H+13]],40));case 13:F=d(F,f([0,p[H+12]],32));case 12:F=d(F,f([0,p[H+11]],24));case 11:F=d(F,f([0,p[H+10]],16));case 10:F=d(F,f([0,p[H+9]],8));case 9:F=d(F,[0,p[H+8]]),F=c(F,B),F=u(F,33),F=c(F,D),A=d(A,F);case 8:R=d(R,f([0,p[H+7]],56));case 7:R=d(R,f([0,p[H+6]],48));case 6:R=d(R,f([0,p[H+5]],40));case 5:R=d(R,f([0,p[H+4]],32));case 4:R=d(R,f([0,p[H+3]],24));case 3:R=d(R,f([0,p[H+2]],16));case 2:R=d(R,f([0,p[H+1]],8));case 1:R=d(R,[0,p[H]]),R=c(R,D),R=u(R,31),R=c(R,B),v=d(v,R)}return v=d(v,[0,p.length]),A=d(A,[0,p.length]),v=a(v,A),A=a(A,v),v=h(v),A=h(A),v=a(v,A),A=a(A,v),("00000000"+(v[0]>>>0).toString(16)).slice(-8)+("00000000"+(v[1]>>>0).toString(16)).slice(-8)+("00000000"+(A[0]>>>0).toString(16)).slice(-8)+("00000000"+(A[1]>>>0).toString(16)).slice(-8)},typeof Yy!="undefined"?(typeof cb!="undefined"&&cb.exports&&(Yy=cb.exports=r),Yy.murmurHash3=r):typeof define=="function"&&define.amd?define([],function(){return r}):(r._murmurHash3=t.murmurHash3,r.noConflict=function(){return t.murmurHash3=r._murmurHash3,r._murmurHash3=e,r.noConflict=e,r},t.murmurHash3=r)})(Yy)});var MH=m((fdt,NH)=>{l();NH.exports=BH()});var Xy=m((Idt,UH)=>{l();"use strict";function jH(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function nTe(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return jH(t,r)}catch(i){r.message=t.message,r.stack=t.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(t)),jH(new n,r)}}UH.exports=nTe});var Rn=m((Kdt,eG)=>{l();"use strict";var{Buffer:ra}=Ht(),JH=Symbol.for("BufferList");function vr(t){if(!(this instanceof vr))return new vr(t);vr._init.call(this,t)}vr._init=function(e){Object.defineProperty(this,JH,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)};vr.prototype._new=function(e){return new vr(e)};vr.prototype._offset=function(e){if(e===0)return[0,0];let r=0;for(let i=0;i<this._bufs.length;i++){let n=r+this._bufs[i].length;if(e<n||i===this._bufs.length-1)return[i,e-r];r=n}};vr.prototype._reverseOffset=function(t){let e=t[0],r=t[1];for(let i=0;i<e;i++)r+=this._bufs[i].length;return r};vr.prototype.get=function(e){if(e>this.length||e<0)return;let r=this._offset(e);return this._bufs[r[0]][r[1]]};vr.prototype.slice=function(e,r){return typeof e=="number"&&e<0&&(e+=this.length),typeof r=="number"&&r<0&&(r+=this.length),this.copy(null,0,e,r)};vr.prototype.copy=function(e,r,i,n){if((typeof i!="number"||i<0)&&(i=0),(typeof n!="number"||n>this.length)&&(n=this.length),i>=this.length||n<=0)return e||ra.alloc(0);let s=!!e,o=this._offset(i),a=n-i,c=a,u=s&&r||0,f=o[1];if(i===0&&n===this.length){if(!s)return this._bufs.length===1?this._bufs[0]:ra.concat(this._bufs,this.length);for(let d=0;d<this._bufs.length;d++)this._bufs[d].copy(e,u),u+=this._bufs[d].length;return e}if(c<=this._bufs[o[0]].length-f)return s?this._bufs[o[0]].copy(e,r,f,f+c):this._bufs[o[0]].slice(f,f+c);s||(e=ra.allocUnsafe(a));for(let d=o[0];d<this._bufs.length;d++){let h=this._bufs[d].length-f;if(c>h)this._bufs[d].copy(e,u,f),u+=h;else{this._bufs[d].copy(e,u,f,f+c),u+=h;break}c-=h,f&&(f=0)}return e.length>u?e.slice(0,u):e};vr.prototype.shallowSlice=function(e,r){if(e=e||0,r=typeof r!="number"?this.length:r,e<0&&(e+=this.length),r<0&&(r+=this.length),e===r)return this._new();let i=this._offset(e),n=this._offset(r),s=this._bufs.slice(i[0],n[0]+1);return n[1]===0?s.pop():s[s.length-1]=s[s.length-1].slice(0,n[1]),i[1]!==0&&(s[0]=s[0].slice(i[1])),this._new(s)};vr.prototype.toString=function(e,r,i){return this.slice(r,i).toString(e)};vr.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;)if(e>=this._bufs[0].length)e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}return this};vr.prototype.duplicate=function(){let e=this._new();for(let r=0;r<this._bufs.length;r++)e.append(this._bufs[r]);return e};vr.prototype.append=function(e){if(e==null)return this;if(e.buffer)this._appendBuffer(ra.from(e.buffer,e.byteOffset,e.byteLength));else if(Array.isArray(e))for(let r=0;r<e.length;r++)this.append(e[r]);else if(this._isBufferList(e))for(let r=0;r<e._bufs.length;r++)this.append(e._bufs[r]);else typeof e=="number"&&(e=e.toString()),this._appendBuffer(ra.from(e));return this};vr.prototype._appendBuffer=function(e){this._bufs.push(e),this.length+=e.length};vr.prototype.indexOf=function(t,e,r){if(r===void 0&&typeof e=="string"&&(r=e,e=void 0),typeof t=="function"||Array.isArray(t))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if(typeof t=="number"?t=ra.from([t]):typeof t=="string"?t=ra.from(t,r):this._isBufferList(t)?t=t.slice():Array.isArray(t.buffer)?t=ra.from(t.buffer,t.byteOffset,t.byteLength):ra.isBuffer(t)||(t=ra.from(t)),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=this._offset(e),n=i[0],s=i[1];for(;n<this._bufs.length;n++){let o=this._bufs[n];for(;s<o.length;)if(o.length-s>=t.length){let c=o.indexOf(t,s);if(c!==-1)return this._reverseOffset([n,c]);s=o.length-t.length+1}else{let c=this._reverseOffset([n,s]);if(this._match(c,t))return c;s++}s=0}return-1};vr.prototype._match=function(t,e){if(this.length-t<e.length)return!1;for(let r=0;r<e.length;r++)if(this.get(t+r)!==e[r])return!1;return!0};(function(){let t={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(let e in t)(function(r){t[r]===null?vr.prototype[r]=function(i,n){return this.slice(i,i+n)[r](0,n)}:vr.prototype[r]=function(i=0){return this.slice(i,i+t[r])[r](0)}})(e)})();vr.prototype._isBufferList=function(e){return e instanceof vr||vr.isBufferList(e)};vr.isBufferList=function(e){return e!=null&&e[JH]};eG.exports=vr});var iG=m((Vdt,rG)=>{l();var tG=class{constructor(e,r=12,i=8*1024,n=32*1024,s=64,o){this.bits=r,this.min=i,this.max=n,this.asModule=e,this.rabin=new e.Rabin(r,i,n,s,o),this.polynomial=o}fingerprint(e){let{__retain:r,__release:i,__allocArray:n,__getInt32Array:s,Int32Array_ID:o,Uint8Array_ID:a}=this.asModule,c=new Int32Array(Math.ceil(e.length/this.min)),u=r(n(o,c)),f=r(n(a,e)),d=this.rabin.fingerprint(f,u),h=s(d);i(f),i(u);let p=h.indexOf(0);return p>=0?h.subarray(0,p):h}};rG.exports=tG});var gG=m(Jy=>{l();"use strict";var OS=-8,ub=-4,hTe=0,nG=1,sG=1<<0,fb=1<<1,zdt=1<<2,Hdt=1<<3,oG=5,Gdt=1<<oG,aG=1<<10,cG=1<<11,$dt=1<<12,pTe=1<<13,uG=14,Wdt=1<<uG,Ydt=1<<19,Xdt=1<<20,Qdt=1<<21,Zdt=1<<22,yTe=0,kS=4,gTe=8,mTe=12,fG=12,bTe=16,vTe=typeof BigUint64Array!="undefined",Qy=Symbol(),Zy=1024;function lG(t,e){let r=new Uint32Array(t),i=new Uint16Array(t);var n=r[e+ub>>>2]>>>1,s=e>>>1;if(n<=Zy)return String.fromCharCode.apply(String,i.subarray(s,s+n));let o=[];do{let a=i[s+Zy-1],c=a>=55296&&a<56320?Zy-1:Zy;o.push(String.fromCharCode.apply(String,i.subarray(s,s+=c))),n-=c}while(n>Zy);return o.join("")+String.fromCharCode.apply(String,i.subarray(s,s+n))}function DS(t){let e={};function r(n,s){return n?lG(n.buffer,s):"<yet unknown>"}let i=t.env=t.env||{};return i.abort=i.abort||function(s,o,a,c){let u=e.memory||i.memory;throw Error("abort: "+r(u,s)+" at "+r(u,o)+":"+a+":"+c)},i.trace=i.trace||function(s,o){let a=e.memory||i.memory;console.log("trace: "+r(a,s)+(o?" ":"")+Array.prototype.slice.call(arguments,2,2+o).join(", "))},t.Math=t.Math||Math,t.Date=t.Date||Date,e}function BS(t,e){let r=e.exports,i=r.memory,n=r.table,s=r.__alloc,o=r.__retain,a=r.__rtti_base||~0;function c(B){let H=new Uint32Array(i.buffer),W=H[a>>>2];if((B>>>=0)>=W)throw Error("invalid id: "+B);return H[(a+4>>>2)+B*2]}function u(B){let H=new Uint32Array(i.buffer),W=H[a>>>2];if((B>>>=0)>=W)throw Error("invalid id: "+B);return H[(a+4>>>2)+B*2+1]}function f(B){return 31-Math.clz32(B>>>oG&31)}function d(B){return 31-Math.clz32(B>>>uG&31)}function h(B){let H=B.length,W=s(H<<1,nG),X=new Uint16Array(i.buffer);for(var P=0,g=W>>>1;P<H;++P)X[g+P]=B.charCodeAt(P);return W}t.__allocString=h;function p(B){let H=i.buffer;if(new Uint32Array(H)[B+OS>>>2]!==nG)throw Error("not a string: "+B);return lG(H,B)}t.__getString=p;function y(B,H,W){let X=i.buffer;if(W)switch(B){case 2:return new Float32Array(X);case 3:return new Float64Array(X)}else switch(B){case 0:return new(H?Int8Array:Uint8Array)(X);case 1:return new(H?Int16Array:Uint16Array)(X);case 2:return new(H?Int32Array:Uint32Array)(X);case 3:return new(H?BigInt64Array:BigUint64Array)(X)}throw Error("unsupported align: "+B)}function b(B,H){let W=c(B);if(!(W&(sG|fb)))throw Error("not an array: "+B+" @ "+W);let X=f(W),P=H.length,g=s(P<<X,hTe),w=s(W&fb?bTe:mTe,B),S=new Uint32Array(i.buffer);S[w+yTe>>>2]=o(g),S[w+kS>>>2]=g,S[w+gTe>>>2]=P<<X,W&fb&&(S[w+fG>>>2]=P);let C=y(X,W&aG,W&cG);if(W&pTe)for(let L=0;L<P;++L)C[(g>>>X)+L]=o(H[L]);else C.set(H,g>>>X);return w}t.__allocArray=b;function E(B){let H=new Uint32Array(i.buffer),W=H[B+OS>>>2],X=c(W);if(!(X&sG))throw Error("not an array: "+W);let P=f(X);var g=H[B+kS>>>2];let w=X&fb?H[B+fG>>>2]:H[g+ub>>>2]>>>P;return y(P,X&aG,X&cG).subarray(g>>>=P,g+w)}t.__getArrayView=E;function v(B){let H=E(B),W=H.length,X=new Array(W);for(let P=0;P<W;P++)X[P]=H[P];return X}t.__getArray=v;function A(B){let H=i.buffer,W=new Uint32Array(H)[B+ub>>>2];return H.slice(B,B+W)}t.__getArrayBuffer=A;function R(B,H,W){return new B(F(B,H,W))}function F(B,H,W){let X=i.buffer,P=new Uint32Array(X),g=P[W+kS>>>2];return new B(X,g,P[g+ub>>>2]>>>H)}t.__getInt8Array=R.bind(null,Int8Array,0),t.__getInt8ArrayView=F.bind(null,Int8Array,0),t.__getUint8Array=R.bind(null,Uint8Array,0),t.__getUint8ArrayView=F.bind(null,Uint8Array,0),t.__getUint8ClampedArray=R.bind(null,Uint8ClampedArray,0),t.__getUint8ClampedArrayView=F.bind(null,Uint8ClampedArray,0),t.__getInt16Array=R.bind(null,Int16Array,1),t.__getInt16ArrayView=F.bind(null,Int16Array,1),t.__getUint16Array=R.bind(null,Uint16Array,1),t.__getUint16ArrayView=F.bind(null,Uint16Array,1),t.__getInt32Array=R.bind(null,Int32Array,2),t.__getInt32ArrayView=F.bind(null,Int32Array,2),t.__getUint32Array=R.bind(null,Uint32Array,2),t.__getUint32ArrayView=F.bind(null,Uint32Array,2),vTe&&(t.__getInt64Array=R.bind(null,BigInt64Array,3),t.__getInt64ArrayView=F.bind(null,BigInt64Array,3),t.__getUint64Array=R.bind(null,BigUint64Array,3),t.__getUint64ArrayView=F.bind(null,BigUint64Array,3)),t.__getFloat32Array=R.bind(null,Float32Array,2),t.__getFloat32ArrayView=F.bind(null,Float32Array,2),t.__getFloat64Array=R.bind(null,Float64Array,3),t.__getFloat64ArrayView=F.bind(null,Float64Array,3);function D(B,H){let W=new Uint32Array(i.buffer);var X=W[B+OS>>>2];if(X<=W[a>>>2])do if(X==H)return!0;while(X=u(X));return!1}return t.__instanceof=D,t.memory=t.memory||i,t.table=t.table||n,yG(r,t)}function dG(t){return typeof Response!="undefined"&&t instanceof Response}async function hG(t,e){return dG(t=await t)?pG(t,e):BS(DS(e||(e={})),await WebAssembly.instantiate(t instanceof WebAssembly.Module?t:await WebAssembly.compile(t),e))}Jy.instantiate=hG;function wTe(t,e){return BS(DS(e||(e={})),new WebAssembly.Instance(t instanceof WebAssembly.Module?t:new WebAssembly.Module(t),e))}Jy.instantiateSync=wTe;async function pG(t,e){return WebAssembly.instantiateStreaming?BS(DS(e||(e={})),(await WebAssembly.instantiateStreaming(t,e)).instance):hG(dG(t=await t)?t.arrayBuffer():t,e)}Jy.instantiateStreaming=pG;function yG(t,e){var r=e?Object.create(e):{},i=t.__argumentsLength?function(n){t.__argumentsLength.value=n}:t.__setArgumentsLength||t.__setargc||function(){};for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;let s=t[n],o=n.split("."),a=r;for(;o.length>1;){let f=o.shift();Object.prototype.hasOwnProperty.call(a,f)||(a[f]={}),a=a[f]}let c=o[0],u=c.indexOf("#");if(u>=0){let f=c.substring(0,u),d=a[f];if(typeof d=="undefined"||!d.prototype){let h=function(...p){return h.wrap(h.prototype.constructor(0,...p))};h.prototype={valueOf:function(){return this[Qy]}},h.wrap=function(p){return Object.create(h.prototype,{[Qy]:{value:p,writable:!1}})},d&&Object.getOwnPropertyNames(d).forEach(p=>Object.defineProperty(h,p,Object.getOwnPropertyDescriptor(d,p))),a[f]=h}if(c=c.substring(u+1),a=a[f].prototype,/^(get|set):/.test(c)){if(!Object.prototype.hasOwnProperty.call(a,c=c.substring(4))){let h=t[n.replace("set:","get:")],p=t[n.replace("get:","set:")];Object.defineProperty(a,c,{get:function(){return h(this[Qy])},set:function(y){p(this[Qy],y)},enumerable:!0})}}else c==="constructor"?(a[c]=(...h)=>(i(h.length),s(...h))).original=s:(a[c]=function(...h){return i(h.length),s(this[Qy],...h)}).original=s}else/^(get|set):/.test(c)?Object.prototype.hasOwnProperty.call(a,c=c.substring(4))||Object.defineProperty(a,c,{get:t[n.replace("set:","get:")],set:t[n.replace("get:","set:")],enumerable:!0}):typeof s=="function"&&s!==i?(a[c]=(...f)=>(i(f.length),s(...f))).original=s:a[c]=s}return r}Jy.demangle=yG});var bG=m((eht,mG)=>{l();var{instantiate:_Te}=gG();NS.supported=typeof WebAssembly!="undefined";function NS(t={}){if(!NS.supported)return null;var e=new Uint8Array([0,97,115,109,1,0,0,0,1,78,14,96,2,127,126,0,96,1,127,1,126,96,2,127,127,0,96,1,127,1,127,96,1,127,0,96,2,127,127,1,127,96,3,127,127,127,1,127,96,0,0,96,3,127,127,127,0,96,0,1,127,96,4,127,127,127,127,0,96,5,127,127,127,127,127,1,127,96,1,126,1,127,96,2,126,126,1,126,2,13,1,3,101,110,118,5,97,98,111,114,116,0,10,3,54,53,2,2,8,9,3,5,2,8,6,5,3,4,2,6,9,12,13,2,5,11,3,2,3,2,3,2,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,6,7,7,4,4,5,3,1,0,1,6,47,9,127,1,65,0,11,127,1,65,0,11,127,0,65,3,11,127,0,65,4,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,0,65,240,2,11,127,0,65,6,11,7,240,5,41,6,109,101,109,111,114,121,2,0,7,95,95,97,108,108,111,99,0,10,8,95,95,114,101,116,97,105,110,0,11,9,95,95,114,101,108,101,97,115,101,0,12,9,95,95,99,111,108,108,101,99,116,0,51,11,95,95,114,116,116,105,95,98,97,115,101,3,7,13,73,110,116,51,50,65,114,114,97,121,95,73,68,3,2,13,85,105,110,116,56,65,114,114,97,121,95,73,68,3,3,6,100,101,103,114,101,101,0,16,3,109,111,100,0,17,5,82,97,98,105,110,3,8,16,82,97,98,105,110,35,103,101,116,58,119,105,110,100,111,119,0,21,16,82,97,98,105,110,35,115,101,116,58,119,105,110,100,111,119,0,22,21,82,97,98,105,110,35,103,101,116,58,119,105,110,100,111,119,95,115,105,122,101,0,23,21,82,97,98,105,110,35,115,101,116,58,119,105,110,100,111,119,95,115,105,122,101,0,24,14,82,97,98,105,110,35,103,101,116,58,119,112,111,115,0,25,14,82,97,98,105,110,35,115,101,116,58,119,112,111,115,0,26,15,82,97,98,105,110,35,103,101,116,58,99,111,117,110,116,0,27,15,82,97,98,105,110,35,115,101,116,58,99,111,117,110,116,0,28,13,82,97,98,105,110,35,103,101,116,58,112,111,115,0,29,13,82,97,98,105,110,35,115,101,116,58,112,111,115,0,30,15,82,97,98,105,110,35,103,101,116,58,115,116,97,114,116,0,31,15,82,97,98,105,110,35,115,101,116,58,115,116,97,114,116,0,32,16,82,97,98,105,110,35,103,101,116,58,100,105,103,101,115,116,0,33,16,82,97,98,105,110,35,115,101,116,58,100,105,103,101,115,116,0,34,21,82,97,98,105,110,35,103,101,116,58,99,104,117,110,107,95,115,116,97,114,116,0,35,21,82,97,98,105,110,35,115,101,116,58,99,104,117,110,107,95,115,116,97,114,116,0,36,22,82,97,98,105,110,35,103,101,116,58,99,104,117,110,107,95,108,101,110,103,116,104,0,37,22,82,97,98,105,110,35,115,101,116,58,99,104,117,110,107,95,108,101,110,103,116,104,0,38,31,82,97,98,105,110,35,103,101,116,58,99,104,117,110,107,95,99,117,116,95,102,105,110,103,101,114,112,114,105,110,116,0,39,31,82,97,98,105,110,35,115,101,116,58,99,104,117,110,107,95,99,117,116,95,102,105,110,103,101,114,112,114,105,110,116,0,40,20,82,97,98,105,110,35,103,101,116,58,112,111,108,121,110,111,109,105,97,108,0,41,20,82,97,98,105,110,35,115,101,116,58,112,111,108,121,110,111,109,105,97,108,0,42,17,82,97,98,105,110,35,103,101,116,58,109,105,110,115,105,122,101,0,43,17,82,97,98,105,110,35,115,101,116,58,109,105,110,115,105,122,101,0,44,17,82,97,98,105,110,35,103,101,116,58,109,97,120,115,105,122,101,0,45,17,82,97,98,105,110,35,115,101,116,58,109,97,120,115,105,122,101,0,46,14,82,97,98,105,110,35,103,101,116,58,109,97,115,107,0,47,14,82,97,98,105,110,35,115,101,116,58,109,97,115,107,0,48,17,82,97,98,105,110,35,99,111,110,115,116,114,117,99,116,111,114,0,20,17,82,97,98,105,110,35,102,105,110,103,101,114,112,114,105,110,116,0,49,8,1,50,10,165,31,53,199,1,1,4,127,32,1,40,2,0,65,124,113,34,2,65,128,2,73,4,127,32,2,65,4,118,33,4,65,0,5,32,2,65,31,32,2,103,107,34,3,65,4,107,118,65,16,115,33,4,32,3,65,7,107,11,33,3,32,1,40,2,20,33,2,32,1,40,2,16,34,5,4,64,32,5,32,2,54,2,20,11,32,2,4,64,32,2,32,5,54,2,16,11,32,1,32,0,32,4,32,3,65,4,116,106,65,2,116,106,40,2,96,70,4,64,32,0,32,4,32,3,65,4,116,106,65,2,116,106,32,2,54,2,96,32,2,69,4,64,32,0,32,3,65,2,116,106,32,0,32,3,65,2,116,106,40,2,4,65,1,32,4,116,65,127,115,113,34,1,54,2,4,32,1,69,4,64,32,0,32,0,40,2,0,65,1,32,3,116,65,127,115,113,54,2,0,11,11,11,11,226,2,1,6,127,32,1,40,2,0,33,3,32,1,65,16,106,32,1,40,2,0,65,124,113,106,34,4,40,2,0,34,5,65,1,113,4,64,32,3,65,124,113,65,16,106,32,5,65,124,113,106,34,2,65,240,255,255,255,3,73,4,64,32,0,32,4,16,1,32,1,32,2,32,3,65,3,113,114,34,3,54,2,0,32,1,65,16,106,32,1,40,2,0,65,124,113,106,34,4,40,2,0,33,5,11,11,32,3,65,2,113,4,64,32,1,65,4,107,40,2,0,34,2,40,2,0,34,6,65,124,113,65,16,106,32,3,65,124,113,106,34,7,65,240,255,255,255,3,73,4,64,32,0,32,2,16,1,32,2,32,7,32,6,65,3,113,114,34,3,54,2,0,32,2,33,1,11,11,32,4,32,5,65,2,114,54,2,0,32,4,65,4,107,32,1,54,2,0,32,0,32,3,65,124,113,34,2,65,128,2,73,4,127,32,2,65,4,118,33,4,65,0,5,32,2,65,31,32,2,103,107,34,2,65,4,107,118,65,16,115,33,4,32,2,65,7,107,11,34,3,65,4,116,32,4,106,65,2,116,106,40,2,96,33,2,32,1,65,0,54,2,16,32,1,32,2,54,2,20,32,2,4,64,32,2,32,1,54,2,16,11,32,0,32,4,32,3,65,4,116,106,65,2,116,106,32,1,54,2,96,32,0,32,0,40,2,0,65,1,32,3,116,114,54,2,0,32,0,32,3,65,2,116,106,32,0,32,3,65,2,116,106,40,2,4,65,1,32,4,116,114,54,2,4,11,119,1,1,127,32,2,2,127,32,0,40,2,160,12,34,2,4,64,32,2,32,1,65,16,107,70,4,64,32,2,40,2,0,33,3,32,1,65,16,107,33,1,11,11,32,1,11,107,34,2,65,48,73,4,64,15,11,32,1,32,3,65,2,113,32,2,65,32,107,65,1,114,114,54,2,0,32,1,65,0,54,2,16,32,1,65,0,54,2,20,32,1,32,2,106,65,16,107,34,2,65,2,54,2,0,32,0,32,2,54,2,160,12,32,0,32,1,16,2,11,155,1,1,3,127,35,0,34,0,69,4,64,65,1,63,0,34,0,74,4,127,65,1,32,0,107,64,0,65,0,72,5,65,0,11,4,64,0,11,65,176,3,34,0,65,0,54,2,0,65,208,15,65,0,54,2,0,3,64,32,1,65,23,73,4,64,32,1,65,2,116,65,176,3,106,65,0,54,2,4,65,0,33,2,3,64,32,2,65,16,73,4,64,32,1,65,4,116,32,2,106,65,2,116,65,176,3,106,65,0,54,2,96,32,2,65,1,106,33,2,12,1,11,11,32,1,65,1,106,33,1,12,1,11,11,65,176,3,65,224,15,63,0,65,16,116,16,3,65,176,3,36,0,11,32,0,11,45,0,32,0,65,240,255,255,255,3,79,4,64,65,32,65,224,0,65,201,3,65,29,16,0,0,11,32,0,65,15,106,65,112,113,34,0,65,16,32,0,65,16,75,27,11,169,1,1,1,127,32,0,32,1,65,128,2,73,4,127,32,1,65,4,118,33,1,65,0,5,32,1,65,248,255,255,255,1,73,4,64,32,1,65,1,65,27,32,1,103,107,116,106,65,1,107,33,1,11,32,1,65,31,32,1,103,107,34,2,65,4,107,118,65,16,115,33,1,32,2,65,7,107,11,34,2,65,2,116,106,40,2,4,65,127,32,1,116,113,34,1,4,127,32,0,32,1,104,32,2,65,4,116,106,65,2,116,106,40,2,96,5,32,0,40,2,0,65,127,32,2,65,1,106,116,113,34,1,4,127,32,0,32,0,32,1,104,34,0,65,2,116,106,40,2,4,104,32,0,65,4,116,106,65,2,116,106,40,2,96,5,65,0,11,11,11,111,1,1,127,63,0,34,2,32,1,65,248,255,255,255,1,73,4,127,32,1,65,1,65,27,32,1,103,107,116,65,1,107,106,5,32,1,11,65,16,32,0,40,2,160,12,32,2,65,16,116,65,16,107,71,116,106,65,255,255,3,106,65,128,128,124,113,65,16,118,34,1,32,2,32,1,74,27,64,0,65,0,72,4,64,32,1,64,0,65,0,72,4,64,0,11,11,32,0,32,2,65,16,116,63,0,65,16,116,16,3,11,113,1,2,127,32,1,40,2,0,34,3,65,124,113,32,2,107,34,4,65,32,79,4,64,32,1,32,2,32,3,65,2,113,114,54,2,0,32,2,32,1,65,16,106,106,34,1,32,4,65,16,107,65,1,114,54,2,0,32,0,32,1,16,2,5,32,1,32,3,65,126,113,54,2,0,32,1,65,16,106,32,1,40,2,0,65,124,113,106,32,1,65,16,106,32,1,40,2,0,65,124,113,106,40,2,0,65,125,113,54,2,0,11,11,91,1,2,127,32,0,32,1,16,5,34,4,16,6,34,3,69,4,64,65,1,36,1,65,0,36,1,32,0,32,4,16,6,34,3,69,4,64,32,0,32,4,16,7,32,0,32,4,16,6,33,3,11,11,32,3,65,0,54,2,4,32,3,32,2,54,2,8,32,3,32,1,54,2,12,32,0,32,3,16,1,32,0,32,3,32,4,16,8,32,3,11,13,0,16,4,32,0,32,1,16,9,65,16,106,11,33,1,1,127,32,0,65,172,3,75,4,64,32,0,65,16,107,34,1,32,1,40,2,4,65,1,106,54,2,4,11,32,0,11,18,0,32,0,65,172,3,75,4,64,32,0,65,16,107,16,52,11,11,140,3,1,1,127,2,64,32,1,69,13,0,32,0,65,0,58,0,0,32,0,32,1,106,65,1,107,65,0,58,0,0,32,1,65,2,77,13,0,32,0,65,1,106,65,0,58,0,0,32,0,65,2,106,65,0,58,0,0,32,0,32,1,106,34,2,65,2,107,65,0,58,0,0,32,2,65,3,107,65,0,58,0,0,32,1,65,6,77,13,0,32,0,65,3,106,65,0,58,0,0,32,0,32,1,106,65,4,107,65,0,58,0,0,32,1,65,8,77,13,0,32,1,65,0,32,0,107,65,3,113,34,1,107,33,2,32,0,32,1,106,34,0,65,0,54,2,0,32,0,32,2,65,124,113,34,1,106,65,4,107,65,0,54,2,0,32,1,65,8,77,13,0,32,0,65,4,106,65,0,54,2,0,32,0,65,8,106,65,0,54,2,0,32,0,32,1,106,34,2,65,12,107,65,0,54,2,0,32,2,65,8,107,65,0,54,2,0,32,1,65,24,77,13,0,32,0,65,12,106,65,0,54,2,0,32,0,65,16,106,65,0,54,2,0,32,0,65,20,106,65,0,54,2,0,32,0,65,24,106,65,0,54,2,0,32,0,32,1,106,34,2,65,28,107,65,0,54,2,0,32,2,65,24,107,65,0,54,2,0,32,2,65,20,107,65,0,54,2,0,32,2,65,16,107,65,0,54,2,0,32,0,32,0,65,4,113,65,24,106,34,2,106,33,0,32,1,32,2,107,33,1,3,64,32,1,65,32,79,4,64,32,0,66,0,55,3,0,32,0,65,8,106,66,0,55,3,0,32,0,65,16,106,66,0,55,3,0,32,0,65,24,106,66,0,55,3,0,32,1,65,32,107,33,1,32,0,65,32,106,33,0,12,1,11,11,11,11,178,1,1,3,127,32,1,65,240,255,255,255,3,32,2,118,75,4,64,65,144,1,65,192,1,65,23,65,56,16,0,0,11,32,1,32,2,116,34,3,65,0,16,10,34,2,32,3,16,13,32,0,69,4,64,65,12,65,2,16,10,34,0,65,172,3,75,4,64,32,0,65,16,107,34,1,32,1,40,2,4,65,1,106,54,2,4,11,11,32,0,65,0,54,2,0,32,0,65,0,54,2,4,32,0,65,0,54,2,8,32,2,34,1,32,0,40,2,0,34,4,71,4,64,32,1,65,172,3,75,4,64,32,1,65,16,107,34,5,32,5,40,2,4,65,1,106,54,2,4,11,32,4,16,12,11,32,0,32,1,54,2,0,32,0,32,2,54,2,4,32,0,32,3,54,2,8,32,0,11,46,1,2,127,65,12,65,5,16,10,34,0,65,172,3,75,4,64,32,0,65,16,107,34,1,32,1,40,2,4,65,1,106,54,2,4,11,32,0,65,128,2,65,3,16,14,11,9,0,65,63,32,0,121,167,107,11,49,1,2,127,65,63,32,1,121,167,107,33,2,3,64,65,63,32,0,121,167,107,32,2,107,34,3,65,0,78,4,64,32,0,32,1,32,3,172,134,133,33,0,12,1,11,11,32,0,11,40,0,32,1,32,0,40,2,8,79,4,64,65,128,2,65,192,2,65,163,1,65,44,16,0,0,11,32,1,32,0,40,2,4,106,65,0,58,0,0,11,38,0,32,1,32,0,40,2,8,79,4,64,65,128,2,65,192,2,65,152,1,65,44,16,0,0,11,32,1,32,0,40,2,4,106,45,0,0,11,254,5,2,1,127,4,126,32,0,69,4,64,65,232,0,65,6,16,10,34,0,65,172,3,75,4,64,32,0,65,16,107,34,5,32,5,40,2,4,65,1,106,54,2,4,11,11,32,0,65,0,54,2,0,32,0,65,0,54,2,4,32,0,65,0,54,2,8,32,0,66,0,55,3,16,32,0,66,0,55,3,24,32,0,66,0,55,3,32,32,0,66,0,55,3,40,32,0,66,0,55,3,48,32,0,66,0,55,3,56,32,0,66,0,55,3,64,32,0,66,0,55,3,72,32,0,66,0,55,3,80,32,0,66,0,55,3,88,32,0,66,0,55,3,96,32,0,32,2,173,55,3,80,32,0,32,3,173,55,3,88,65,12,65,4,16,10,34,2,65,172,3,75,4,64,32,2,65,16,107,34,3,32,3,40,2,4,65,1,106,54,2,4,11,32,2,32,4,65,0,16,14,33,2,32,0,40,2,0,16,12,32,0,32,2,54,2,0,32,0,32,4,54,2,4,32,0,66,1,32,1,173,134,66,1,125,55,3,96,32,0,66,243,130,183,218,216,230,232,30,55,3,72,35,4,69,4,64,65,0,33,2,3,64,32,2,65,128,2,72,4,64,32,2,65,255,1,113,173,33,6,32,0,41,3,72,34,7,33,8,65,63,32,7,121,167,107,33,1,3,64,65,63,32,6,121,167,107,32,1,107,34,3,65,0,78,4,64,32,6,32,8,32,3,172,134,133,33,6,12,1,11,11,65,0,33,4,3,64,32,4,32,0,40,2,4,65,1,107,72,4,64,32,6,66,8,134,33,6,32,0,41,3,72,34,7,33,8,65,63,32,7,121,167,107,33,1,3,64,65,63,32,6,121,167,107,32,1,107,34,3,65,0,78,4,64,32,6,32,8,32,3,172,134,133,33,6,12,1,11,11,32,4,65,1,106,33,4,12,1,11,11,35,6,40,2,4,32,2,65,3,116,106,32,6,55,3,0,32,2,65,1,106,33,2,12,1,11,11,65,63,32,0,41,3,72,121,167,107,172,33,7,65,0,33,2,3,64,32,2,65,128,2,72,4,64,35,5,33,1,32,2,172,32,7,134,34,8,33,6,65,63,32,0,41,3,72,34,9,121,167,107,33,3,3,64,65,63,32,6,121,167,107,32,3,107,34,4,65,0,78,4,64,32,6,32,9,32,4,172,134,133,33,6,12,1,11,11,32,1,40,2,4,32,2,65,3,116,106,32,6,32,8,132,55,3,0,32,2,65,1,106,33,2,12,1,11,11,65,1,36,4,11,32,0,66,0,55,3,24,32,0,66,0,55,3,32,65,0,33,2,3,64,32,2,32,0,40,2,4,72,4,64,32,0,40,2,0,32,2,16,18,32,2,65,1,106,33,2,12,1,11,11,32,0,66,0,55,3,40,32,0,65,0,54,2,8,32,0,66,0,55,3,16,32,0,66,0,55,3,40,32,0,40,2,0,32,0,40,2,8,16,19,33,1,32,0,40,2,8,32,0,40,2,0,40,2,4,106,65,1,58,0,0,32,0,32,0,41,3,40,35,6,40,2,4,32,1,65,3,116,106,41,3,0,133,55,3,40,32,0,32,0,40,2,8,65,1,106,32,0,40,2,4,111,54,2,8,32,0,35,5,40,2,4,32,0,41,3,40,34,6,66,45,136,167,65,3,116,106,41,3,0,32,6,66,8,134,66,1,132,133,55,3,40,32,0,11,38,1,1,127,32,0,40,2,0,34,0,65,172,3,75,4,64,32,0,65,16,107,34,1,32,1,40,2,4,65,1,106,54,2,4,11,32,0,11,55,1,2,127,32,1,32,0,40,2,0,34,2,71,4,64,32,1,65,172,3,75,4,64,32,1,65,16,107,34,3,32,3,40,2,4,65,1,106,54,2,4,11,32,2,16,12,11,32,0,32,1,54,2,0,11,7,0,32,0,40,2,4,11,9,0,32,0,32,1,54,2,4,11,7,0,32,0,40,2,8,11,9,0,32,0,32,1,54,2,8,11,7,0,32,0,41,3,16,11,9,0,32,0,32,1,55,3,16,11,7,0,32,0,41,3,24,11,9,0,32,0,32,1,55,3,24,11,7,0,32,0,41,3,32,11,9,0,32,0,32,1,55,3,32,11,7,0,32,0,41,3,40,11,9,0,32,0,32,1,55,3,40,11,7,0,32,0,41,3,48,11,9,0,32,0,32,1,55,3,48,11,7,0,32,0,41,3,56,11,9,0,32,0,32,1,55,3,56,11,7,0,32,0,41,3,64,11,9,0,32,0,32,1,55,3,64,11,7,0,32,0,41,3,72,11,9,0,32,0,32,1,55,3,72,11,7,0,32,0,41,3,80,11,9,0,32,0,32,1,55,3,80,11,7,0,32,0,41,3,88,11,9,0,32,0,32,1,55,3,88,11,7,0,32,0,41,3,96,11,9,0,32,0,32,1,55,3,96,11,172,4,2,5,127,1,126,32,2,65,172,3,75,4,64,32,2,65,16,107,34,4,32,4,40,2,4,65,1,106,54,2,4,11,32,2,33,4,65,0,33,2,32,1,40,2,8,33,5,32,1,40,2,4,33,6,3,64,2,127,65,0,33,3,3,64,32,3,32,5,72,4,64,32,3,32,6,106,45,0,0,33,1,32,0,40,2,0,32,0,40,2,8,16,19,33,7,32,0,40,2,8,32,0,40,2,0,40,2,4,106,32,1,58,0,0,32,0,32,0,41,3,40,35,6,40,2,4,32,7,65,3,116,106,41,3,0,133,55,3,40,32,0,32,0,40,2,8,65,1,106,32,0,40,2,4,111,54,2,8,32,0,35,5,40,2,4,32,0,41,3,40,34,8,66,45,136,167,65,3,116,106,41,3,0,32,1,173,32,8,66,8,134,132,133,55,3,40,32,0,32,0,41,3,16,66,1,124,55,3,16,32,0,32,0,41,3,24,66,1,124,55,3,24,32,0,41,3,16,32,0,41,3,80,90,4,127,32,0,41,3,40,32,0,41,3,96,131,80,5,65,0,11,4,127,65,1,5,32,0,41,3,16,32,0,41,3,88,90,11,4,64,32,0,32,0,41,3,32,55,3,48,32,0,32,0,41,3,16,55,3,56,32,0,32,0,41,3,40,55,3,64,65,0,33,1,3,64,32,1,32,0,40,2,4,72,4,64,32,0,40,2,0,32,1,16,18,32,1,65,1,106,33,1,12,1,11,11,32,0,66,0,55,3,40,32,0,65,0,54,2,8,32,0,66,0,55,3,16,32,0,66,0,55,3,40,32,0,40,2,0,32,0,40,2,8,16,19,33,1,32,0,40,2,8,32,0,40,2,0,40,2,4,106,65,1,58,0,0,32,0,32,0,41,3,40,35,6,40,2,4,32,1,65,3,116,106,41,3,0,133,55,3,40,32,0,32,0,40,2,8,65,1,106,32,0,40,2,4,111,54,2,8,32,0,35,5,40,2,4,32,0,41,3,40,34,8,66,45,136,167,65,3,116,106,41,3,0,32,8,66,8,134,66,1,132,133,55,3,40,32,3,65,1,106,12,3,11,32,3,65,1,106,33,3,12,1,11,11,65,127,11,34,1,65,0,78,4,64,32,5,32,1,107,33,5,32,1,32,6,106,33,6,32,2,34,1,65,1,106,33,2,32,4,40,2,4,32,1,65,2,116,106,32,0,41,3,56,62,2,0,12,1,11,11,32,4,11,10,0,16,15,36,5,16,15,36,6,11,3,0,1,11,73,1,2,127,32,0,40,2,4,34,1,65,255,255,255,255,0,113,34,2,65,1,70,4,64,32,0,65,16,106,16,53,32,0,32,0,40,2,0,65,1,114,54,2,0,35,0,32,0,16,2,5,32,0,32,2,65,1,107,32,1,65,128,128,128,128,127,113,114,54,2,4,11,11,58,0,2,64,2,64,2,64,32,0,65,8,107,40,2,0,14,7,0,0,1,1,1,1,1,2,11,15,11,32,0,40,2,0,34,0,4,64,32,0,65,172,3,79,4,64,32,0,65,16,107,16,52,11,11,15,11,0,11,11,137,3,7,0,65,16,11,55,40,0,0,0,1,0,0,0,1,0,0,0,40,0,0,0,97,0,108,0,108,0,111,0,99,0,97,0,116,0,105,0,111,0,110,0,32,0,116,0,111,0,111,0,32,0,108,0,97,0,114,0,103,0,101,0,65,208,0,11,45,30,0,0,0,1,0,0,0,1,0,0,0,30,0,0,0,126,0,108,0,105,0,98,0,47,0,114,0,116,0,47,0,116,0,108,0,115,0,102,0,46,0,116,0,115,0,65,128,1,11,43,28,0,0,0,1,0,0,0,1,0,0,0,28,0,0,0,73,0,110,0,118,0,97,0,108,0,105,0,100,0,32,0,108,0,101,0,110,0,103,0,116,0,104,0,65,176,1,11,53,38,0,0,0,1,0,0,0,1,0,0,0,38,0,0,0,126,0,108,0,105,0,98,0,47,0,97,0,114,0,114,0,97,0,121,0,98,0,117,0,102,0,102,0,101,0,114,0,46,0,116,0,115,0,65,240,1,11,51,36,0,0,0,1,0,0,0,1,0,0,0,36,0,0,0,73,0,110,0,100,0,101,0,120,0,32,0,111,0,117,0,116,0,32,0,111,0,102,0,32,0,114,0,97,0,110,0,103,0,101,0,65,176,2,11,51,36,0,0,0,1,0,0,0,1,0,0,0,36,0,0,0,126,0,108,0,105,0,98,0,47,0,116,0,121,0,112,0,101,0,100,0,97,0,114,0,114,0,97,0,121,0,46,0,116,0,115,0,65,240,2,11,53,7,0,0,0,16,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,145,4,0,0,2,0,0,0,49,0,0,0,2,0,0,0,17,1,0,0,2,0,0,0,16,0,34,16,115,111,117,114,99,101,77,97,112,112,105,110,103,85,82,76,16,46,47,114,97,98,105,110,46,119,97,115,109,46,109,97,112]);return _Te(new Response(new Blob([e],{type:"application/wasm"})),t)}mG.exports=NS});var _G=m((tht,wG)=>{l();var vG=iG(),ETe=bG(),STe=async(t,e,r,i,n)=>{let s=await ETe();return new vG(s,t,e,r,i,n)};wG.exports={Rabin:vG,create:STe}});var kG=m((vht,OG)=>{l();"use strict";var db=7;OG.exports=class{constructor(){this._bitArrays=[],this._data=[],this._length=0,this._changedLength=!1,this._changedData=!1}set(e,r){let i=this._internalPositionFor(e,!1);if(r===void 0)i!==-1&&(this._unsetInternalPos(i),this._unsetBit(e),this._changedLength=!0,this._changedData=!0);else{let n=!1;i===-1?(i=this._data.length,this._setBit(e),this._changedData=!0):n=!0,this._setInternalPos(i,e,r,n),this._changedLength=!0}}unset(e){this.set(e,void 0)}get(e){this._sortData();let r=this._internalPositionFor(e,!0);if(r!==-1)return this._data[r][1]}push(e){return this.set(this.length,e),this.length}get length(){if(this._sortData(),this._changedLength){let e=this._data[this._data.length-1];this._length=e?e[0]+1:0,this._changedLength=!1}return this._length}forEach(e){let r=0;for(;r<this.length;)e(this.get(r),r,this),r++}map(e){let r=0,i=new Array(this.length);for(;r<this.length;)i[r]=e(this.get(r),r,this),r++;return i}reduce(e,r){let i=0,n=r;for(;i<this.length;){let s=this.get(i);n=e(n,s,i),i++}return n}find(e){let r=0,i,n;for(;r<this.length&&!i;)n=this.get(r),i=e(n),r++;return i?n:void 0}_internalPositionFor(e,r){let i=this._bytePosFor(e,r);if(i>=this._bitArrays.length)return-1;let n=this._bitArrays[i],s=e-i*db;if(!((n&1<<s)>0))return-1;let a=this._bitArrays.slice(0,i).reduce(kTe,0),c=~(4294967295<<s+1),u=CG(n&c);return a+u-1}_bytePosFor(e,r){let i=Math.floor(e/db),n=i+1;for(;!r&&this._bitArrays.length<n;)this._bitArrays.push(0);return i}_setBit(e){let r=this._bytePosFor(e,!1);this._bitArrays[r]|=1<<e-r*db}_unsetBit(e){let r=this._bytePosFor(e,!1);this._bitArrays[r]&=~(1<<e-r*db)}_setInternalPos(e,r,i,n){let s=this._data,o=[r,i];if(n)this._sortData(),s[e]=o;else{if(s.length)if(s[s.length-1][0]>=r)s.push(o);else if(s[0][0]<=r)s.unshift(o);else{let a=Math.round(s.length/2);this._data=s.slice(0,a).concat(o).concat(s.slice(a))}else this._data.push(o);this._changedData=!0,this._changedLength=!0}}_unsetInternalPos(e){this._data.splice(e,1)}_sortData(){this._changedData&&this._data.sort(DTe),this._changedData=!1}bitField(){let e=[],r=8,i=0,n=0,s,o=this._bitArrays.slice();for(;o.length||i;){i===0&&(s=o.shift(),i=7);let c=Math.min(i,r),u=~(255<<c);n|=(s&u)<<8-r,s=s>>>c,i-=c,r-=c,(!r||!i&&!o.length)&&(e.push(n),n=0,r=8)}for(var a=e.length-1;a>0&&e[a]===0;a--)e.pop();return e}compactArray(){return this._sortData(),this._data.map(BTe)}};function kTe(t,e){return t+CG(e)}function CG(t){let e=t;return e=e-(e>>1&1431655765),e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>24}function DTe(t,e){return t[0]-e[0]}function BTe(t){return t[1]}});var NG=m((wht,BG)=>{l();"use strict";var NTe=kG(),{fromString:MTe}=(dt(),bi),ia=class{constructor(e,r,i=0){this._options=e,this._popCount=0,this._parent=r,this._posAtParent=i,this._children=new NTe,this.key=null}async put(e,r){let i=await this._findNewBucketAndPos(e);await i.bucket._putAt(i,e,r)}async get(e){let r=await this._findChild(e);if(r)return r.value}async del(e){let r=await this._findPlace(e),i=r.bucket._at(r.pos);i&&i.key===e&&r.bucket._delAt(r.pos)}leafCount(){return this._children.compactArray().reduce((r,i)=>i instanceof ia?r+i.leafCount():r+1,0)}childrenCount(){return this._children.length}onlyChild(){return this._children.get(0)}*eachLeafSeries(){let e=this._children.compactArray();for(let r of e)r instanceof ia?yield*r.eachLeafSeries():yield r;return[]}serialize(e,r){let i=[];return r(this._children.reduce((n,s,o)=>(s&&(s instanceof ia?n.push(s.serialize(e,r)):n.push(e(s,o))),n),i))}asyncTransform(e,r){return DG(this,e,r)}toJSON(){return this.serialize(qTe,jTe)}prettyPrint(){return JSON.stringify(this.toJSON(),null," ")}tableSize(){return Math.pow(2,this._options.bits)}async _findChild(e){let r=await this._findPlace(e),i=r.bucket._at(r.pos);if(!(i instanceof ia)&&i&&i.key===e)return i}async _findPlace(e){let r=this._options.hash(typeof e=="string"?MTe(e):e),i=await r.take(this._options.bits),n=this._children.get(i);return n instanceof ia?n._findPlace(r):{bucket:this,pos:i,hash:r,existingChild:n}}async _findNewBucketAndPos(e){let r=await this._findPlace(e);if(r.existingChild&&r.existingChild.key!==e){let i=new ia(this._options,r.bucket,r.pos);r.bucket._putObjectAt(r.pos,i);let n=await i._findPlace(r.existingChild.hash);return n.bucket._putAt(n,r.existingChild.key,r.existingChild.value),i._findNewBucketAndPos(r.hash)}return r}_putAt(e,r,i){this._putObjectAt(e.pos,{key:r,value:i,hash:e.hash})}_putObjectAt(e,r){this._children.get(e)||this._popCount++,this._children.set(e,r)}_delAt(e){if(e===-1)throw new Error("Invalid position");this._children.get(e)&&this._popCount--,this._children.unset(e),this._level()}_level(){if(this._parent&&this._popCount<=1)if(this._popCount===1){let e=this._children.find(LTe);if(e&&!(e instanceof ia)){let r=e.hash;r.untake(this._options.bits);let i={pos:this._posAtParent,hash:r,bucket:this._parent};this._parent._putAt(i,e.key,e.value)}}else this._parent._delAt(this._posAtParent)}_at(e){return this._children.get(e)}};function LTe(t){return Boolean(t)}function qTe(t,e){return t.key}function jTe(t){return t}async function DG(t,e,r){let i=[];for(let n of t._children.compactArray())if(n instanceof ia)await DG(n,e,r);else{let s=await e(n);i.push({bitField:t._children.bitField(),children:s})}return r(i)}BG.exports=ia});var LG=m((Eht,MG)=>{l();"use strict";var UTe=[255,254,252,248,240,224,192,128],FTe=[1,3,7,15,31,63,127,255];MG.exports=class{constructor(e){this._value=e,this._currentBytePos=e.length-1,this._currentBitPos=7}availableBits(){return this._currentBitPos+1+this._currentBytePos*8}totalBits(){return this._value.length*8}take(e){let r=e,i=0;for(;r&&this._haveBits();){let n=this._value[this._currentBytePos],s=this._currentBitPos+1,o=Math.min(s,r),a=KTe(n,s-o,o);i=(i<<o)+a,r-=o,this._currentBitPos-=o,this._currentBitPos<0&&(this._currentBitPos=7,this._currentBytePos--)}return i}untake(e){for(this._currentBitPos+=e;this._currentBitPos>7;)this._currentBitPos-=8,this._currentBytePos+=1}_haveBits(){return this._currentBytePos>=0}};function KTe(t,e,r){let i=VTe(e,r);return(t&i)>>>e}function VTe(t,e){return UTe[t]&FTe[Math.min(e+t-1,7)]}});var qG=m((Sht,jS)=>{l();"use strict";var zTe=LG(),{concat:HTe}=(mn(),$s);function GTe(t){function e(r){return r instanceof hb?r:new hb(r,t)}return e}var hb=class{constructor(e,r){if(!(e instanceof Uint8Array))throw new Error("can only hash Uint8Arrays");this._value=e,this._hashFn=r,this._depth=-1,this._availableBits=0,this._currentBufferIndex=0,this._buffers=[]}async take(e){let r=e;for(;this._availableBits<r;)await this._produceMoreBits();let i=0;for(;r>0;){let n=this._buffers[this._currentBufferIndex],s=Math.min(n.availableBits(),r),o=n.take(s);i=(i<<s)+o,r-=s,this._availableBits-=s,n.availableBits()===0&&this._currentBufferIndex++}return i}untake(e){let r=e;for(;r>0;){let i=this._buffers[this._currentBufferIndex],n=Math.min(i.totalBits()-i.availableBits(),r);i.untake(n),r-=n,this._availableBits+=n,this._currentBufferIndex>0&&i.totalBits()===i.availableBits()&&(this._depth--,this._currentBufferIndex--)}}async _produceMoreBits(){this._depth++;let e=this._depth?HTe([this._value,Uint8Array.from([this._depth])]):this._value,r=await this._hashFn(e),i=new zTe(r);this._buffers.push(i),this._availableBits+=i.availableBits()}};jS.exports=GTe;jS.exports.InfiniteHash=hb});var tg=m((xht,UG)=>{l();"use strict";var jG=NG(),$Te=qG();function WTe(t){if(!t||!t.hashFn)throw new Error("please define an options.hashFn");let e={bits:t.bits||8,hash:$Te(t.hashFn)};return new jG(e)}UG.exports={createHAMT:WTe,Bucket:jG}});var rg=m((Vht,XG)=>{l();"use strict";async function*JTe(t,e={}){let r=t.getReader();try{for(;;){let i=await r.read();if(i.done)return;yield i.value}}finally{e.preventCancel!==!0&&r.cancel(),r.releaseLock()}}XG.exports=JTe});var JG=m((zht,ZG)=>{l();"use strict";var QG=rg();function eRe(t){return typeof t.stream=="function"?QG(t.stream()):QG(new Response(t).body)}ZG.exports=eRe});var ig=m((Hht,e$)=>{l();"use strict";function tRe(t){let[e,r]=t[Symbol.asyncIterator]?[t[Symbol.asyncIterator](),Symbol.asyncIterator]:[t[Symbol.iterator](),Symbol.iterator],i=[];return{peek:()=>e.next(),push:n=>{i.push(n)},next:()=>i.length?{done:!1,value:i.shift()}:e.next(),[r](){return this}}}e$.exports=tRe});var du=m((u0t,y$)=>{l();"use strict";function p$(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function cRe(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return p$(t,r)}catch(i){r.message=t.message,r.stack=t.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(t)),p$(new n,r)}}y$.exports=cRe});var L$=m(xb=>{l();var{Buffer:GS}=Ht(),up=Rn(),RRe="0".charCodeAt(0),PRe=GS.from("ustar\0","binary"),CRe=GS.from("ustar ","binary"),ORe=GS.from(" \0","binary"),Sb=257,N$=263,kRe=function(t,e,r){return typeof t!="number"?r:(t=~~t,t>=e?e:t>=0||(t+=e,t>=0)?t:0)},DRe=function(t){switch(t){case 0:return"file";case 1:return"link";case 2:return"symlink";case 3:return"character-device";case 4:return"block-device";case 5:return"directory";case 6:return"fifo";case 7:return"contiguous-file";case 72:return"pax-header";case 55:return"pax-global-header";case 27:return"gnu-long-link-path";case 28:case 30:return"gnu-long-path"}return null},M$=function(t,e,r,i){for(;r<i;r++)if(t.get(r)===e)return r;return i},BRe=function(t){let e=8*32;for(let r=0;r<148;r++)e+=t.get(r);for(let r=156;r<512;r++)e+=t.get(r);return e};function NRe(t){let e;if(t.get(0)===128)e=!0;else if(t.get(0)===255)e=!1;else return null;let r=!1,i=[];for(let o=t.length-1;o>0;o--){let a=t.get(o);e?i.push(a):r&&a===0?i.push(0):r?(r=!1,i.push(256-a)):i.push(255-a)}let n=0,s=i.length;for(let o=0;o<s;o++)n+=i[o]*Math.pow(256,o);return e?n:-1*n}var Rf=function(t,e,r){if(t=t.shallowSlice(e,e+r),e=0,t.get(e)&128)return NRe(t);{for(;e<t.length&&t.get(e)===32;)e++;let i=kRe(M$(t,32,e,t.length),t.length,t.length);for(;e<i&&t.get(e)===0;)e++;return i===e?0:parseInt(t.shallowSlice(e,i).toString(),8)}},fp=function(t,e,r,i){return t.shallowSlice(e,M$(t,0,e,e+r)).toString(i)};xb.decodeLongPath=function(t,e){return t=up.isBufferList(t)?t:new up(t),fp(t,0,t.length,e)};xb.decodePax=function(t){t=up.isBufferList(t)?t:new up(t);let e={};for(;t.length;){let r=0;for(;r<t.length&&t.get(r)!==32;)r++;let i=parseInt(t.shallowSlice(0,r).toString(),10);if(!i)return e;let n=t.shallowSlice(r+1,i-1).toString(),s=n.indexOf("=");if(s===-1)return e;e[n.slice(0,s)]=n.slice(s+1),t=t.shallowSlice(i)}return e};xb.decode=function(t,e){t=up.isBufferList(t)?t:new up(t);let r=t.get(156)===0?0:t.get(156)-RRe,i=fp(t,0,100,e),n=Rf(t,100,8),s=Rf(t,108,8),o=Rf(t,116,8),a=Rf(t,124,12),c=Rf(t,136,12),u=DRe(r),f=t.get(157)===0?null:fp(t,157,100,e),d=fp(t,265,32),h=fp(t,297,32),p=Rf(t,329,8),y=Rf(t,337,8),b=BRe(t);if(b===8*32)return null;if(b!==Rf(t,148,8))throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(PRe.compare(t.slice(Sb,Sb+6))===0)t.get(345)&&(i=fp(t,345,155,e)+"/"+i);else if(!(CRe.compare(t.slice(Sb,Sb+6))===0&&ORe.compare(t.slice(N$,N$+2))===0))throw new Error("Invalid tar header: unknown format.");return r===0&&i&&i[i.length-1]==="/"&&(r=5),{name:i,mode:n,uid:s,gid:o,size:a,mtime:new Date(1e3*c),type:u,linkname:f,uname:d,gname:h,devmajor:p,devminor:y}}});var Ab=m((opt,q$)=>{l();var $S=Rn();q$.exports=t=>{let e=async function*(){let r=yield,i=new $S;for await(let n of t){if(!r){r=yield i.append(n),i=new $S;continue}for(i.append(n);i.length>=r;){let s=i.shallowSlice(0,r);if(i.consume(r),r=yield s,!r){i.length&&(r=yield i,i=new $S);break}}}if(r)throw Object.assign(new Error(`stream ended before ${r} bytes became available`),{code:"ERR_UNDER_READ",buffer:i})}();return e.next(),e}});var U$=m((apt,j$)=>{l();var WS=Rn(),MRe=Ab();j$.exports=function(e){let r=MRe(e),i,n={[Symbol.asyncIterator]:()=>n,async next(s){if(i){let o;if(s==null||i.length===s)o=i,i=null;else if(i.length>s)o=i.shallowSlice(0,s),i=i.shallowSlice(s);else if(i.length<s){let{value:a,done:c}=await r.next(s-i.length);if(c)throw Object.assign(new Error(`stream ended before ${s-i.length} bytes became available`),{code:"ERR_UNDER_READ"});o=new WS([i,a]),i=null}return{value:o}}return r.next(s)},async nextLte(s){let{done:o,value:a}=await n.next();return o?{done:o}:a.length<=s?{value:a}:(a=WS.isBufferList(a)?a:new WS(a),i?i.append(a.shallowSlice(s)):i=a.shallowSlice(s),{value:a.shallowSlice(0,s)})},return(){return r.return()}};return n}});var K$=m((cpt,F$)=>{l();var LRe=fu(),ng=L$(),qRe=U$();function jRe(t){return t&=511,t&&512-t}async function sg(t,e){let r=jRe(e);r&&await t.next(r)}F$.exports=t=>(t=t||{},t.highWaterMark=t.highWaterMark||1024*16,e=>async function*(){let r=qRe(e),i,n,s,o;try{for(;;){let a;try{let{done:p,value:y}=await r.next(512);if(p)return;a=y}catch(p){if(p.code==="ERR_UNDER_READ")return;throw p}let c=ng.decode(a,t.filenameEncoding);if(!c)continue;if(c.type==="gnu-long-path"){let{done:p,value:y}=await r.next(c.size);if(p)return;i=ng.decodeLongPath(y,t.filenameEncoding),await sg(r,c.size);continue}if(c.type==="gnu-long-link-path"){let{done:p,value:y}=await r.next(c.size);if(p)return;n=ng.decodeLongPath(y,t.filenameEncoding),await sg(r,c.size);continue}if(c.type==="pax-global-header"){let{done:p,value:y}=await r.next(c.size);if(p)return;s=ng.decodePax(y,t.filenameEncoding),await sg(r,c.size);continue}if(c.type==="pax-header"){let{done:p,value:y}=await r.next(c.size);if(p)return;o=ng.decodePax(y,t.filenameEncoding),s&&(o={...s,...o}),await sg(r,c.size);continue}if(i&&(c.name=i,i=null),n&&(c.linkname=n,n=null),o&&(o.path&&(c.name=o.path),o.linkpath&&(c.linkname=o.linkpath),o.size&&(c.size=parseInt(o.size,10)),c.pax=o,o=null),!c.size||c.type==="directory"){yield{header:c,body:async function*(){}()};continue}let u=c.size,f=LRe(),d=await r.nextLte(Math.min(u,t.highWaterMark));u-=d.value.length,u||f.resolve();let h=async function*(){try{for(yield d.value;u;){let{done:p,value:y}=await r.nextLte(u);if(p){u=0;return}u-=y.length,yield y}}finally{f.resolve()}}();if(yield{header:c,body:h},await f.promise,u)for await(let p of h);await sg(r,c.size)}}finally{await r.return()}}())});var z$=m((upt,V$)=>{l();"use strict";V$.exports={RTLD_LAZY:1,RTLD_NOW:2,RTLD_GLOBAL:8,RTLD_LOCAL:4,E2BIG:7,EACCES:13,EADDRINUSE:48,EADDRNOTAVAIL:49,EAFNOSUPPORT:47,EAGAIN:35,EALREADY:37,EBADF:9,EBADMSG:94,EBUSY:16,ECANCELED:89,ECHILD:10,ECONNABORTED:53,ECONNREFUSED:61,ECONNRESET:54,EDEADLK:11,EDESTADDRREQ:39,EDOM:33,EDQUOT:69,EEXIST:17,EFAULT:14,EFBIG:27,EHOSTUNREACH:65,EIDRM:90,EILSEQ:92,EINPROGRESS:36,EINTR:4,EINVAL:22,EIO:5,EISCONN:56,EISDIR:21,ELOOP:62,EMFILE:24,EMLINK:31,EMSGSIZE:40,EMULTIHOP:95,ENAMETOOLONG:63,ENETDOWN:50,ENETRESET:52,ENETUNREACH:51,ENFILE:23,ENOBUFS:55,ENODATA:96,ENODEV:19,ENOENT:2,ENOEXEC:8,ENOLCK:77,ENOLINK:97,ENOMEM:12,ENOMSG:91,ENOPROTOOPT:42,ENOSPC:28,ENOSR:98,ENOSTR:99,ENOSYS:78,ENOTCONN:57,ENOTDIR:20,ENOTEMPTY:66,ENOTSOCK:38,ENOTSUP:45,ENOTTY:25,ENXIO:6,EOPNOTSUPP:102,EOVERFLOW:84,EPERM:1,EPIPE:32,EPROTO:100,EPROTONOSUPPORT:43,EPROTOTYPE:41,ERANGE:34,EROFS:30,ESPIPE:29,ESRCH:3,ESTALE:70,ETIME:101,ETIMEDOUT:60,ETXTBSY:26,EWOULDBLOCK:35,EXDEV:18,PRIORITY_LOW:19,PRIORITY_BELOW_NORMAL:10,PRIORITY_NORMAL:0,PRIORITY_ABOVE_NORMAL:-7,PRIORITY_HIGH:-14,PRIORITY_HIGHEST:-20,SIGHUP:1,SIGINT:2,SIGQUIT:3,SIGILL:4,SIGTRAP:5,SIGABRT:6,SIGIOT:6,SIGBUS:10,SIGFPE:8,SIGKILL:9,SIGUSR1:30,SIGSEGV:11,SIGUSR2:31,SIGPIPE:13,SIGALRM:14,SIGTERM:15,SIGCHLD:20,SIGCONT:19,SIGSTOP:17,SIGTSTP:18,SIGTTIN:21,SIGTTOU:22,SIGURG:16,SIGXCPU:24,SIGXFSZ:25,SIGVTALRM:26,SIGPROF:27,SIGWINCH:28,SIGIO:23,SIGINFO:29,SIGSYS:12,UV_FS_SYMLINK_DIR:1,UV_FS_SYMLINK_JUNCTION:2,O_RDONLY:0,O_WRONLY:1,O_RDWR:2,UV_DIRENT_UNKNOWN:0,UV_DIRENT_FILE:1,UV_DIRENT_DIR:2,UV_DIRENT_LINK:3,UV_DIRENT_FIFO:4,UV_DIRENT_SOCKET:5,UV_DIRENT_CHAR:6,UV_DIRENT_BLOCK:7,S_IFMT:61440,S_IFREG:32768,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960,S_IFSOCK:49152,O_CREAT:512,O_EXCL:2048,UV_FS_O_FILEMAP:0,O_NOCTTY:131072,O_TRUNC:1024,O_APPEND:8,O_DIRECTORY:1048576,O_NOFOLLOW:256,O_SYNC:128,O_DSYNC:4194304,O_SYMLINK:2097152,O_NONBLOCK:4,S_IRWXU:448,S_IRUSR:256,S_IWUSR:128,S_IXUSR:64,S_IRWXG:56,S_IRGRP:32,S_IWGRP:16,S_IXGRP:8,S_IRWXO:7,S_IROTH:4,S_IWOTH:2,S_IXOTH:1,F_OK:0,R_OK:4,W_OK:2,X_OK:1,UV_FS_COPYFILE_EXCL:1,COPYFILE_EXCL:1,UV_FS_COPYFILE_FICLONE:2,COPYFILE_FICLONE:2,UV_FS_COPYFILE_FICLONE_FORCE:4,COPYFILE_FICLONE_FORCE:4,OPENSSL_VERSION_NUMBER:269488319,SSL_OP_ALL:2147485780,SSL_OP_ALLOW_NO_DHE_KEX:1024,SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION:262144,SSL_OP_CIPHER_SERVER_PREFERENCE:4194304,SSL_OP_CISCO_ANYCONNECT:32768,SSL_OP_COOKIE_EXCHANGE:8192,SSL_OP_CRYPTOPRO_TLSEXT_BUG:2147483648,SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS:2048,SSL_OP_EPHEMERAL_RSA:0,SSL_OP_LEGACY_SERVER_CONNECT:4,SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER:0,SSL_OP_MICROSOFT_SESS_ID_BUG:0,SSL_OP_MSIE_SSLV2_RSA_PADDING:0,SSL_OP_NETSCAPE_CA_DN_BUG:0,SSL_OP_NETSCAPE_CHALLENGE_BUG:0,SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG:0,SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG:0,SSL_OP_NO_COMPRESSION:131072,SSL_OP_NO_ENCRYPT_THEN_MAC:524288,SSL_OP_NO_QUERY_MTU:4096,SSL_OP_NO_RENEGOTIATION:1073741824,SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION:65536,SSL_OP_NO_SSLv2:0,SSL_OP_NO_SSLv3:33554432,SSL_OP_NO_TICKET:16384,SSL_OP_NO_TLSv1:67108864,SSL_OP_NO_TLSv1_1:268435456,SSL_OP_NO_TLSv1_2:134217728,SSL_OP_NO_TLSv1_3:536870912,SSL_OP_PKCS1_CHECK_1:0,SSL_OP_PKCS1_CHECK_2:0,SSL_OP_PRIORITIZE_CHACHA:2097152,SSL_OP_SINGLE_DH_USE:0,SSL_OP_SINGLE_ECDH_USE:0,SSL_OP_SSLEAY_080_CLIENT_DH_BUG:0,SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG:0,SSL_OP_TLS_BLOCK_PADDING_BUG:0,SSL_OP_TLS_D5_BUG:0,SSL_OP_TLS_ROLLBACK_BUG:8388608,ENGINE_METHOD_RSA:1,ENGINE_METHOD_DSA:2,ENGINE_METHOD_DH:4,ENGINE_METHOD_RAND:8,ENGINE_METHOD_EC:2048,ENGINE_METHOD_CIPHERS:64,ENGINE_METHOD_DIGESTS:128,ENGINE_METHOD_PKEY_METHS:512,ENGINE_METHOD_PKEY_ASN1_METHS:1024,ENGINE_METHOD_ALL:65535,ENGINE_METHOD_NONE:0,DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,RSA_PSS_SALTLEN_DIGEST:-1,RSA_PSS_SALTLEN_MAX_SIGN:-2,RSA_PSS_SALTLEN_AUTO:-2,defaultCoreCipherList:"TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA256:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!SRP:!CAMELLIA",TLS1_VERSION:769,TLS1_1_VERSION:770,TLS1_2_VERSION:771,TLS1_3_VERSION:772,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}});var G$=m((fpt,H$)=>{l();var URe=Rn(),YS={string:()=>"",buffer:()=>URe()};H$.exports=async(t,e)=>{if(e=e||{},e.type&&!YS[e.type])throw new Error(`invalid type "${e.type}"`);let r,i;for await(let n of t)r||(i=e.type||(typeof n=="string"?"string":"buffer"),r=YS[i]()),i==="string"?r+=n:r.append(n);return r||YS[e.type||"buffer"]()}});var $$=m(QS=>{l();var{Buffer:sc}=Ht(),FRe=sc.alloc,KRe="0000000000000000000",VRe="7777777777777777777",zRe="0".charCodeAt(0),HRe=sc.from("ustar\0","binary"),GRe=sc.from("00","binary"),$Re=parseInt("7777",8),WRe=257,YRe=263,XRe=function(t){switch(t){case"file":return 0;case"link":return 1;case"symlink":return 2;case"character-device":return 3;case"block-device":return 4;case"directory":return 5;case"fifo":return 6;case"contiguous-file":return 7;case"pax-header":return 72}return 0},QRe=function(t){let e=8*32;for(let r=0;r<148;r++)e+=t[r];for(let r=156;r<512;r++)e+=t[r];return e},Pf=function(t,e){return t=t.toString(8),t.length>e?VRe.slice(0,e)+" ":KRe.slice(0,e-t.length)+t+" "},XS=function(t){let e=sc.byteLength(t),r=Math.floor(Math.log(e)/Math.log(10))+1;return e+r>=Math.pow(10,r)&&r++,e+r+t};QS.encodePax=function(t){let e="";t.name&&(e+=XS(" path="+t.name+`
`)),t.linkname&&(e+=XS(" linkpath="+t.linkname+`
`));let r=t.pax;if(r)for(let i in r)e+=XS(" "+i+"="+r[i]+`
`);return sc.from(e)};QS.encode=function(t){let e=FRe(512),r=t.name,i="";if(t.typeflag===5&&r[r.length-1]!=="/"&&(r+="/"),sc.byteLength(r)!==r.length)return null;for(;sc.byteLength(r)>100;){let n=r.indexOf("/");if(n===-1)return null;i+=i?"/"+r.slice(0,n):r.slice(0,n),r=r.slice(n+1)}return sc.byteLength(r)>100||sc.byteLength(i)>155||t.linkname&&sc.byteLength(t.linkname)>100?null:(e.write(r),e.write(Pf(t.mode&$Re,6),100),e.write(Pf(t.uid,6),108),e.write(Pf(t.gid,6),116),e.write(Pf(t.size,11),124),e.write(Pf(t.mtime.getTime()/1e3|0,11),136),e[156]=zRe+XRe(t.type),t.linkname&&e.write(t.linkname,157),HRe.copy(e,WRe),GRe.copy(e,YRe),t.uname&&e.write(t.uname,265),t.gname&&e.write(t.gname,297),e.write(Pf(t.devmajor||0,6),329),e.write(Pf(t.devminor||0,6),337),i&&e.write(i,345),e.write(Pf(QRe(e),6),148),e)}});var X$=m((dpt,Y$)=>{l();var{Buffer:ZS}=Ht(),hd=Rn(),{S_IFMT:ZRe,S_IFBLK:JRe,S_IFCHR:ePe,S_IFDIR:tPe,S_IFIFO:rPe,S_IFLNK:iPe}=z$(),nPe=G$(),Ib=$$(),sPe=parseInt("755",8),oPe=parseInt("644",8),W$=ZS.alloc(1024);function aPe(t){switch(t&ZRe){case JRe:return"block-device";case ePe:return"character-device";case tPe:return"directory";case rPe:return"fifo";case iPe:return"symlink"}return"file"}function JS(t){if(t&=511,t)return new hd(W$.slice(0,512-t))}function ex(t){if(!t.pax){let e=Ib.encode(t);if(e)return e}return cPe(t)}function cPe(t){let e=Ib.encodePax({name:t.name,linkname:t.linkname,pax:t.pax}),r={name:"PaxHeader",mode:t.mode,uid:t.uid,gid:t.gid,size:e.length,mtime:t.mtime,type:"pax-header",linkname:t.linkname&&"PaxHeader",uname:t.uname,gname:t.gname,devmajor:t.devmajor,devminor:t.devminor};return new hd([Ib.encode(r),e,JS(e.length),Ib.encode({...r,size:t.size,type:t.type})])}Y$.exports=()=>async function*(t){for await(let{header:e,body:r}of t){if((!e.size||e.type==="symlink")&&(e.size=0),e.type||(e.type=aPe(e.mode)),e.mode||(e.mode=e.type==="directory"?sPe:oPe),e.uid||(e.uid=0),e.gid||(e.gid=0),e.mtime||(e.mtime=new Date),typeof r=="string"&&(r=ZS.from(r)),ZS.isBuffer(r)||hd.isBufferList(r)){e.size=r.length,yield new hd([ex(e),r,JS(e.size)]);continue}if(e.type==="symlink"&&!e.linkname){e.linkname=(await nPe(r)).toString(),yield ex(e);continue}if(yield ex(e),e.type!=="file"&&e.type!=="contiguous-file")continue;let i=0;for await(let s of r)i+=s.length,yield hd.isBufferList(s)?s:new hd(s);if(i!==e.size)throw new Error("size mismatch");let n=JS(e.size);n&&(yield n)}yield new hd(W$)}});var Q$=m(tx=>{l();tx.extract=K$();tx.pack=X$()});var hu=m(Kn=>{l();"use strict";var uPe=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";function fPe(t,e){return Object.prototype.hasOwnProperty.call(t,e)}Kn.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var r=e.shift();if(!!r){if(typeof r!="object")throw new TypeError(r+"must be non-object");for(var i in r)fPe(r,i)&&(t[i]=r[i])}}return t};Kn.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var lPe={arraySet:function(t,e,r,i,n){if(e.subarray&&t.subarray){t.set(e.subarray(r,r+i),n);return}for(var s=0;s<i;s++)t[n+s]=e[r+s]},flattenChunks:function(t){var e,r,i,n,s,o;for(i=0,e=0,r=t.length;e<r;e++)i+=t[e].length;for(o=new Uint8Array(i),n=0,e=0,r=t.length;e<r;e++)s=t[e],o.set(s,n),n+=s.length;return o}},dPe={arraySet:function(t,e,r,i,n){for(var s=0;s<i;s++)t[n+s]=e[r+s]},flattenChunks:function(t){return[].concat.apply([],t)}};Kn.setTyped=function(t){t?(Kn.Buf8=Uint8Array,Kn.Buf16=Uint16Array,Kn.Buf32=Int32Array,Kn.assign(Kn,lPe)):(Kn.Buf8=Array,Kn.Buf16=Array,Kn.Buf32=Array,Kn.assign(Kn,dPe))};Kn.setTyped(uPe)});var wW=m(hp=>{l();"use strict";var hPe=hu(),pPe=4,Z$=0,J$=1,yPe=2;function lp(t){for(var e=t.length;--e>=0;)t[e]=0}var gPe=0,eW=1,mPe=2,bPe=3,vPe=258,rx=29,og=256,ag=og+1+rx,dp=30,ix=19,tW=2*ag+1,pd=15,nx=16,wPe=7,sx=256,rW=16,iW=17,nW=18,ox=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],Tb=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],_Pe=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],sW=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],EPe=512,pu=new Array((ag+2)*2);lp(pu);var cg=new Array(dp*2);lp(cg);var ug=new Array(EPe);lp(ug);var fg=new Array(vPe-bPe+1);lp(fg);var ax=new Array(rx);lp(ax);var Rb=new Array(dp);lp(Rb);function cx(t,e,r,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=t&&t.length}var oW,aW,cW;function ux(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function uW(t){return t<256?ug[t]:ug[256+(t>>>7)]}function lg(t,e){t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255}function os(t,e,r){t.bi_valid>nx-r?(t.bi_buf|=e<<t.bi_valid&65535,lg(t,t.bi_buf),t.bi_buf=e>>nx-t.bi_valid,t.bi_valid+=r-nx):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)}function oc(t,e,r){os(t,r[e*2],r[e*2+1])}function fW(t,e){var r=0;do r|=t&1,t>>>=1,r<<=1;while(--e>0);return r>>>1}function SPe(t){t.bi_valid===16?(lg(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=t.bi_buf&255,t.bi_buf>>=8,t.bi_valid-=8)}function xPe(t,e){var r=e.dyn_tree,i=e.max_code,n=e.stat_desc.static_tree,s=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,c=e.stat_desc.max_length,u,f,d,h,p,y,b=0;for(h=0;h<=pd;h++)t.bl_count[h]=0;for(r[t.heap[t.heap_max]*2+1]=0,u=t.heap_max+1;u<tW;u++)f=t.heap[u],h=r[r[f*2+1]*2+1]+1,h>c&&(h=c,b++),r[f*2+1]=h,!(f>i)&&(t.bl_count[h]++,p=0,f>=a&&(p=o[f-a]),y=r[f*2],t.opt_len+=y*(h+p),s&&(t.static_len+=y*(n[f*2+1]+p)));if(b!==0){do{for(h=c-1;t.bl_count[h]===0;)h--;t.bl_count[h]--,t.bl_count[h+1]+=2,t.bl_count[c]--,b-=2}while(b>0);for(h=c;h!==0;h--)for(f=t.bl_count[h];f!==0;)d=t.heap[--u],!(d>i)&&(r[d*2+1]!==h&&(t.opt_len+=(h-r[d*2+1])*r[d*2],r[d*2+1]=h),f--)}}function lW(t,e,r){var i=new Array(pd+1),n=0,s,o;for(s=1;s<=pd;s++)i[s]=n=n+r[s-1]<<1;for(o=0;o<=e;o++){var a=t[o*2+1];a!==0&&(t[o*2]=fW(i[a]++,a))}}function APe(){var t,e,r,i,n,s=new Array(pd+1);for(r=0,i=0;i<rx-1;i++)for(ax[i]=r,t=0;t<1<<ox[i];t++)fg[r++]=i;for(fg[r-1]=i,n=0,i=0;i<16;i++)for(Rb[i]=n,t=0;t<1<<Tb[i];t++)ug[n++]=i;for(n>>=7;i<dp;i++)for(Rb[i]=n<<7,t=0;t<1<<Tb[i]-7;t++)ug[256+n++]=i;for(e=0;e<=pd;e++)s[e]=0;for(t=0;t<=143;)pu[t*2+1]=8,t++,s[8]++;for(;t<=255;)pu[t*2+1]=9,t++,s[9]++;for(;t<=279;)pu[t*2+1]=7,t++,s[7]++;for(;t<=287;)pu[t*2+1]=8,t++,s[8]++;for(lW(pu,ag+1,s),t=0;t<dp;t++)cg[t*2+1]=5,cg[t*2]=fW(t,5);oW=new cx(pu,ox,og+1,ag,pd),aW=new cx(cg,Tb,0,dp,pd),cW=new cx(new Array(0),_Pe,0,ix,wPe)}function dW(t){var e;for(e=0;e<ag;e++)t.dyn_ltree[e*2]=0;for(e=0;e<dp;e++)t.dyn_dtree[e*2]=0;for(e=0;e<ix;e++)t.bl_tree[e*2]=0;t.dyn_ltree[sx*2]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function hW(t){t.bi_valid>8?lg(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function IPe(t,e,r,i){hW(t),i&&(lg(t,r),lg(t,~r)),hPe.arraySet(t.pending_buf,t.window,e,r,t.pending),t.pending+=r}function pW(t,e,r,i){var n=e*2,s=r*2;return t[n]<t[s]||t[n]===t[s]&&i[e]<=i[r]}function fx(t,e,r){for(var i=t.heap[r],n=r<<1;n<=t.heap_len&&(n<t.heap_len&&pW(e,t.heap[n+1],t.heap[n],t.depth)&&n++,!pW(e,i,t.heap[n],t.depth));)t.heap[r]=t.heap[n],r=n,n<<=1;t.heap[r]=i}function yW(t,e,r){var i,n,s=0,o,a;if(t.last_lit!==0)do i=t.pending_buf[t.d_buf+s*2]<<8|t.pending_buf[t.d_buf+s*2+1],n=t.pending_buf[t.l_buf+s],s++,i===0?oc(t,n,e):(o=fg[n],oc(t,o+og+1,e),a=ox[o],a!==0&&(n-=ax[o],os(t,n,a)),i--,o=uW(i),oc(t,o,r),a=Tb[o],a!==0&&(i-=Rb[o],os(t,i,a)));while(s<t.last_lit);oc(t,sx,e)}function lx(t,e){var r=e.dyn_tree,i=e.stat_desc.static_tree,n=e.stat_desc.has_stree,s=e.stat_desc.elems,o,a,c=-1,u;for(t.heap_len=0,t.heap_max=tW,o=0;o<s;o++)r[o*2]!==0?(t.heap[++t.heap_len]=c=o,t.depth[o]=0):r[o*2+1]=0;for(;t.heap_len<2;)u=t.heap[++t.heap_len]=c<2?++c:0,r[u*2]=1,t.depth[u]=0,t.opt_len--,n&&(t.static_len-=i[u*2+1]);for(e.max_code=c,o=t.heap_len>>1;o>=1;o--)fx(t,r,o);u=s;do o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],fx(t,r,1),a=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=a,r[u*2]=r[o*2]+r[a*2],t.depth[u]=(t.depth[o]>=t.depth[a]?t.depth[o]:t.depth[a])+1,r[o*2+1]=r[a*2+1]=u,t.heap[1]=u++,fx(t,r,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],xPe(t,e),lW(r,c,t.bl_count)}function gW(t,e,r){var i,n=-1,s,o=e[0*2+1],a=0,c=7,u=4;for(o===0&&(c=138,u=3),e[(r+1)*2+1]=65535,i=0;i<=r;i++)s=o,o=e[(i+1)*2+1],!(++a<c&&s===o)&&(a<u?t.bl_tree[s*2]+=a:s!==0?(s!==n&&t.bl_tree[s*2]++,t.bl_tree[rW*2]++):a<=10?t.bl_tree[iW*2]++:t.bl_tree[nW*2]++,a=0,n=s,o===0?(c=138,u=3):s===o?(c=6,u=3):(c=7,u=4))}function mW(t,e,r){var i,n=-1,s,o=e[0*2+1],a=0,c=7,u=4;for(o===0&&(c=138,u=3),i=0;i<=r;i++)if(s=o,o=e[(i+1)*2+1],!(++a<c&&s===o)){if(a<u)do oc(t,s,t.bl_tree);while(--a!=0);else s!==0?(s!==n&&(oc(t,s,t.bl_tree),a--),oc(t,rW,t.bl_tree),os(t,a-3,2)):a<=10?(oc(t,iW,t.bl_tree),os(t,a-3,3)):(oc(t,nW,t.bl_tree),os(t,a-11,7));a=0,n=s,o===0?(c=138,u=3):s===o?(c=6,u=3):(c=7,u=4)}}function TPe(t){var e;for(gW(t,t.dyn_ltree,t.l_desc.max_code),gW(t,t.dyn_dtree,t.d_desc.max_code),lx(t,t.bl_desc),e=ix-1;e>=3&&t.bl_tree[sW[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e}function RPe(t,e,r,i){var n;for(os(t,e-257,5),os(t,r-1,5),os(t,i-4,4),n=0;n<i;n++)os(t,t.bl_tree[sW[n]*2+1],3);mW(t,t.dyn_ltree,e-1),mW(t,t.dyn_dtree,r-1)}function PPe(t){var e=4093624447,r;for(r=0;r<=31;r++,e>>>=1)if(e&1&&t.dyn_ltree[r*2]!==0)return Z$;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return J$;for(r=32;r<og;r++)if(t.dyn_ltree[r*2]!==0)return J$;return Z$}var bW=!1;function CPe(t){bW||(APe(),bW=!0),t.l_desc=new ux(t.dyn_ltree,oW),t.d_desc=new ux(t.dyn_dtree,aW),t.bl_desc=new ux(t.bl_tree,cW),t.bi_buf=0,t.bi_valid=0,dW(t)}function vW(t,e,r,i){os(t,(gPe<<1)+(i?1:0),3),IPe(t,e,r,!0)}function OPe(t){os(t,eW<<1,3),oc(t,sx,pu),SPe(t)}function kPe(t,e,r,i){var n,s,o=0;t.level>0?(t.strm.data_type===yPe&&(t.strm.data_type=PPe(t)),lx(t,t.l_desc),lx(t,t.d_desc),o=TPe(t),n=t.opt_len+3+7>>>3,s=t.static_len+3+7>>>3,s<=n&&(n=s)):n=s=r+5,r+4<=n&&e!==-1?vW(t,e,r,i):t.strategy===pPe||s===n?(os(t,(eW<<1)+(i?1:0),3),yW(t,pu,cg)):(os(t,(mPe<<1)+(i?1:0),3),RPe(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),yW(t,t.dyn_ltree,t.dyn_dtree)),dW(t),i&&hW(t)}function DPe(t,e,r){return t.pending_buf[t.d_buf+t.last_lit*2]=e>>>8&255,t.pending_buf[t.d_buf+t.last_lit*2+1]=e&255,t.pending_buf[t.l_buf+t.last_lit]=r&255,t.last_lit++,e===0?t.dyn_ltree[r*2]++:(t.matches++,e--,t.dyn_ltree[(fg[r]+og+1)*2]++,t.dyn_dtree[uW(e)*2]++),t.last_lit===t.lit_bufsize-1}hp._tr_init=CPe;hp._tr_stored_block=vW;hp._tr_flush_block=kPe;hp._tr_tally=DPe;hp._tr_align=OPe});var dx=m((gpt,_W)=>{l();"use strict";function BPe(t,e,r,i){for(var n=t&65535|0,s=t>>>16&65535|0,o=0;r!==0;){o=r>2e3?2e3:r,r-=o;do n=n+e[i++]|0,s=s+n|0;while(--o);n%=65521,s%=65521}return n|s<<16|0}_W.exports=BPe});var hx=m((mpt,EW)=>{l();"use strict";function NPe(){for(var t,e=[],r=0;r<256;r++){t=r;for(var i=0;i<8;i++)t=t&1?3988292384^t>>>1:t>>>1;e[r]=t}return e}var MPe=NPe();function LPe(t,e,r,i){var n=MPe,s=i+r;t^=-1;for(var o=i;o<s;o++)t=t>>>8^n[(t^e[o])&255];return t^-1}EW.exports=LPe});var Pb=m((bpt,SW)=>{l();"use strict";SW.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var kW=m(uc=>{l();"use strict";var Vn=hu(),co=wW(),xW=dx(),Cf=hx(),qPe=Pb(),yd=0,jPe=1,UPe=3,Of=4,AW=5,ac=0,IW=1,uo=-2,FPe=-3,px=-5,KPe=-1,VPe=1,Cb=2,zPe=3,HPe=4,GPe=0,$Pe=2,Ob=8,WPe=9,YPe=15,XPe=8,QPe=29,ZPe=256,yx=ZPe+1+QPe,JPe=30,eCe=19,tCe=2*yx+1,rCe=15,Dt=3,kf=258,na=kf+Dt+1,iCe=32,kb=42,gx=69,Db=73,Bb=91,Nb=103,gd=113,dg=666,Di=1,hg=2,md=3,pp=4,nCe=3;function Df(t,e){return t.msg=qPe[e],e}function TW(t){return(t<<1)-(t>4?9:0)}function Bf(t){for(var e=t.length;--e>=0;)t[e]=0}function Nf(t){var e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),r!==0&&(Vn.arraySet(t.output,e.pending_buf,e.pending_out,r,t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,e.pending===0&&(e.pending_out=0))}function ln(t,e){co._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Nf(t.strm)}function Wt(t,e){t.pending_buf[t.pending++]=e}function pg(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255}function sCe(t,e,r,i){var n=t.avail_in;return n>i&&(n=i),n===0?0:(t.avail_in-=n,Vn.arraySet(e,t.input,t.next_in,n,r),t.state.wrap===1?t.adler=xW(t.adler,e,n,r):t.state.wrap===2&&(t.adler=Cf(t.adler,e,n,r)),t.next_in+=n,t.total_in+=n,n)}function RW(t,e){var r=t.max_chain_length,i=t.strstart,n,s,o=t.prev_length,a=t.nice_match,c=t.strstart>t.w_size-na?t.strstart-(t.w_size-na):0,u=t.window,f=t.w_mask,d=t.prev,h=t.strstart+kf,p=u[i+o-1],y=u[i+o];t.prev_length>=t.good_match&&(r>>=2),a>t.lookahead&&(a=t.lookahead);do if(n=e,!(u[n+o]!==y||u[n+o-1]!==p||u[n]!==u[i]||u[++n]!==u[i+1])){i+=2,n++;do;while(u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&i<h);if(s=kf-(h-i),i=h-kf,s>o){if(t.match_start=e,o=s,s>=a)break;p=u[i+o-1],y=u[i+o]}}while((e=d[e&f])>c&&--r!=0);return o<=t.lookahead?o:t.lookahead}function bd(t){var e=t.w_size,r,i,n,s,o;do{if(s=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-na)){Vn.arraySet(t.window,t.window,e,e,0),t.match_start-=e,t.strstart-=e,t.block_start-=e,i=t.hash_size,r=i;do n=t.head[--r],t.head[r]=n>=e?n-e:0;while(--i);i=e,r=i;do n=t.prev[--r],t.prev[r]=n>=e?n-e:0;while(--i);s+=e}if(t.strm.avail_in===0)break;if(i=sCe(t.strm,t.window,t.strstart+t.lookahead,s),t.lookahead+=i,t.lookahead+t.insert>=Dt)for(o=t.strstart-t.insert,t.ins_h=t.window[o],t.ins_h=(t.ins_h<<t.hash_shift^t.window[o+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[o+Dt-1])&t.hash_mask,t.prev[o&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=o,o++,t.insert--,!(t.lookahead+t.insert<Dt)););}while(t.lookahead<na&&t.strm.avail_in!==0)}function oCe(t,e){var r=65535;for(r>t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(bd(t),t.lookahead===0&&e===yd)return Di;if(t.lookahead===0)break}t.strstart+=t.lookahead,t.lookahead=0;var i=t.block_start+r;if((t.strstart===0||t.strstart>=i)&&(t.lookahead=t.strstart-i,t.strstart=i,ln(t,!1),t.strm.avail_out===0)||t.strstart-t.block_start>=t.w_size-na&&(ln(t,!1),t.strm.avail_out===0))return Di}return t.insert=0,e===Of?(ln(t,!0),t.strm.avail_out===0?md:pp):(t.strstart>t.block_start&&(ln(t,!1),t.strm.avail_out===0),Di)}function mx(t,e){for(var r,i;;){if(t.lookahead<na){if(bd(t),t.lookahead<na&&e===yd)return Di;if(t.lookahead===0)break}if(r=0,t.lookahead>=Dt&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+Dt-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),r!==0&&t.strstart-r<=t.w_size-na&&(t.match_length=RW(t,r)),t.match_length>=Dt)if(i=co._tr_tally(t,t.strstart-t.match_start,t.match_length-Dt),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=Dt){t.match_length--;do t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+Dt-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart;while(--t.match_length!=0);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else i=co._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(ln(t,!1),t.strm.avail_out===0))return Di}return t.insert=t.strstart<Dt-1?t.strstart:Dt-1,e===Of?(ln(t,!0),t.strm.avail_out===0?md:pp):t.last_lit&&(ln(t,!1),t.strm.avail_out===0)?Di:hg}function yp(t,e){for(var r,i,n;;){if(t.lookahead<na){if(bd(t),t.lookahead<na&&e===yd)return Di;if(t.lookahead===0)break}if(r=0,t.lookahead>=Dt&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+Dt-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=Dt-1,r!==0&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-na&&(t.match_length=RW(t,r),t.match_length<=5&&(t.strategy===VPe||t.match_length===Dt&&t.strstart-t.match_start>4096)&&(t.match_length=Dt-1)),t.prev_length>=Dt&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-Dt,i=co._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-Dt),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=n&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+Dt-1])&t.hash_mask,r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart);while(--t.prev_length!=0);if(t.match_available=0,t.match_length=Dt-1,t.strstart++,i&&(ln(t,!1),t.strm.avail_out===0))return Di}else if(t.match_available){if(i=co._tr_tally(t,0,t.window[t.strstart-1]),i&&ln(t,!1),t.strstart++,t.lookahead--,t.strm.avail_out===0)return Di}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(i=co._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<Dt-1?t.strstart:Dt-1,e===Of?(ln(t,!0),t.strm.avail_out===0?md:pp):t.last_lit&&(ln(t,!1),t.strm.avail_out===0)?Di:hg}function aCe(t,e){for(var r,i,n,s,o=t.window;;){if(t.lookahead<=kf){if(bd(t),t.lookahead<=kf&&e===yd)return Di;if(t.lookahead===0)break}if(t.match_length=0,t.lookahead>=Dt&&t.strstart>0&&(n=t.strstart-1,i=o[n],i===o[++n]&&i===o[++n]&&i===o[++n])){s=t.strstart+kf;do;while(i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&n<s);t.match_length=kf-(s-n),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=Dt?(r=co._tr_tally(t,1,t.match_length-Dt),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=co._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(ln(t,!1),t.strm.avail_out===0))return Di}return t.insert=0,e===Of?(ln(t,!0),t.strm.avail_out===0?md:pp):t.last_lit&&(ln(t,!1),t.strm.avail_out===0)?Di:hg}function cCe(t,e){for(var r;;){if(t.lookahead===0&&(bd(t),t.lookahead===0)){if(e===yd)return Di;break}if(t.match_length=0,r=co._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(ln(t,!1),t.strm.avail_out===0))return Di}return t.insert=0,e===Of?(ln(t,!0),t.strm.avail_out===0?md:pp):t.last_lit&&(ln(t,!1),t.strm.avail_out===0)?Di:hg}function cc(t,e,r,i,n){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=i,this.func=n}var gp;gp=[new cc(0,0,0,0,oCe),new cc(4,4,8,4,mx),new cc(4,5,16,8,mx),new cc(4,6,32,32,mx),new cc(4,4,16,16,yp),new cc(8,16,32,32,yp),new cc(8,16,128,128,yp),new cc(8,32,128,256,yp),new cc(32,128,258,1024,yp),new cc(32,258,258,4096,yp)];function uCe(t){t.window_size=2*t.w_size,Bf(t.head),t.max_lazy_match=gp[t.level].max_lazy,t.good_match=gp[t.level].good_length,t.nice_match=gp[t.level].nice_length,t.max_chain_length=gp[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=Dt-1,t.match_available=0,t.ins_h=0}function fCe(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Ob,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Vn.Buf16(tCe*2),this.dyn_dtree=new Vn.Buf16((2*JPe+1)*2),this.bl_tree=new Vn.Buf16((2*eCe+1)*2),Bf(this.dyn_ltree),Bf(this.dyn_dtree),Bf(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Vn.Buf16(rCe+1),this.heap=new Vn.Buf16(2*yx+1),Bf(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Vn.Buf16(2*yx+1),Bf(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function PW(t){var e;return!t||!t.state?Df(t,uo):(t.total_in=t.total_out=0,t.data_type=$Pe,e=t.state,e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?kb:gd,t.adler=e.wrap===2?0:1,e.last_flush=yd,co._tr_init(e),ac)}function CW(t){var e=PW(t);return e===ac&&uCe(t.state),e}function lCe(t,e){return!t||!t.state||t.state.wrap!==2?uo:(t.state.gzhead=e,ac)}function OW(t,e,r,i,n,s){if(!t)return uo;var o=1;if(e===KPe&&(e=6),i<0?(o=0,i=-i):i>15&&(o=2,i-=16),n<1||n>WPe||r!==Ob||i<8||i>15||e<0||e>9||s<0||s>HPe)return Df(t,uo);i===8&&(i=9);var a=new fCe;return t.state=a,a.strm=t,a.wrap=o,a.gzhead=null,a.w_bits=i,a.w_size=1<<a.w_bits,a.w_mask=a.w_size-1,a.hash_bits=n+7,a.hash_size=1<<a.hash_bits,a.hash_mask=a.hash_size-1,a.hash_shift=~~((a.hash_bits+Dt-1)/Dt),a.window=new Vn.Buf8(a.w_size*2),a.head=new Vn.Buf16(a.hash_size),a.prev=new Vn.Buf16(a.w_size),a.lit_bufsize=1<<n+6,a.pending_buf_size=a.lit_bufsize*4,a.pending_buf=new Vn.Buf8(a.pending_buf_size),a.d_buf=1*a.lit_bufsize,a.l_buf=(1+2)*a.lit_bufsize,a.level=e,a.strategy=s,a.method=r,CW(t)}function dCe(t,e){return OW(t,e,Ob,YPe,XPe,GPe)}function hCe(t,e){var r,i,n,s;if(!t||!t.state||e>AW||e<0)return t?Df(t,uo):uo;if(i=t.state,!t.output||!t.input&&t.avail_in!==0||i.status===dg&&e!==Of)return Df(t,t.avail_out===0?px:uo);if(i.strm=t,r=i.last_flush,i.last_flush=e,i.status===kb)if(i.wrap===2)t.adler=0,Wt(i,31),Wt(i,139),Wt(i,8),i.gzhead?(Wt(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),Wt(i,i.gzhead.time&255),Wt(i,i.gzhead.time>>8&255),Wt(i,i.gzhead.time>>16&255),Wt(i,i.gzhead.time>>24&255),Wt(i,i.level===9?2:i.strategy>=Cb||i.level<2?4:0),Wt(i,i.gzhead.os&255),i.gzhead.extra&&i.gzhead.extra.length&&(Wt(i,i.gzhead.extra.length&255),Wt(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=Cf(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=gx):(Wt(i,0),Wt(i,0),Wt(i,0),Wt(i,0),Wt(i,0),Wt(i,i.level===9?2:i.strategy>=Cb||i.level<2?4:0),Wt(i,nCe),i.status=gd);else{var o=Ob+(i.w_bits-8<<4)<<8,a=-1;i.strategy>=Cb||i.level<2?a=0:i.level<6?a=1:i.level===6?a=2:a=3,o|=a<<6,i.strstart!==0&&(o|=iCe),o+=31-o%31,i.status=gd,pg(i,o),i.strstart!==0&&(pg(i,t.adler>>>16),pg(i,t.adler&65535)),t.adler=1}if(i.status===gx)if(i.gzhead.extra){for(n=i.pending;i.gzindex<(i.gzhead.extra.length&65535)&&!(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=Cf(t.adler,i.pending_buf,i.pending-n,n)),Nf(t),n=i.pending,i.pending===i.pending_buf_size));)Wt(i,i.gzhead.extra[i.gzindex]&255),i.gzindex++;i.gzhead.hcrc&&i.pending>n&&(t.adler=Cf(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=Db)}else i.status=Db;if(i.status===Db)if(i.gzhead.name){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=Cf(t.adler,i.pending_buf,i.pending-n,n)),Nf(t),n=i.pending,i.pending===i.pending_buf_size)){s=1;break}i.gzindex<i.gzhead.name.length?s=i.gzhead.name.charCodeAt(i.gzindex++)&255:s=0,Wt(i,s)}while(s!==0);i.gzhead.hcrc&&i.pending>n&&(t.adler=Cf(t.adler,i.pending_buf,i.pending-n,n)),s===0&&(i.gzindex=0,i.status=Bb)}else i.status=Bb;if(i.status===Bb)if(i.gzhead.comment){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=Cf(t.adler,i.pending_buf,i.pending-n,n)),Nf(t),n=i.pending,i.pending===i.pending_buf_size)){s=1;break}i.gzindex<i.gzhead.comment.length?s=i.gzhead.comment.charCodeAt(i.gzindex++)&255:s=0,Wt(i,s)}while(s!==0);i.gzhead.hcrc&&i.pending>n&&(t.adler=Cf(t.adler,i.pending_buf,i.pending-n,n)),s===0&&(i.status=Nb)}else i.status=Nb;if(i.status===Nb&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&Nf(t),i.pending+2<=i.pending_buf_size&&(Wt(i,t.adler&255),Wt(i,t.adler>>8&255),t.adler=0,i.status=gd)):i.status=gd),i.pending!==0){if(Nf(t),t.avail_out===0)return i.last_flush=-1,ac}else if(t.avail_in===0&&TW(e)<=TW(r)&&e!==Of)return Df(t,px);if(i.status===dg&&t.avail_in!==0)return Df(t,px);if(t.avail_in!==0||i.lookahead!==0||e!==yd&&i.status!==dg){var c=i.strategy===Cb?cCe(i,e):i.strategy===zPe?aCe(i,e):gp[i.level].func(i,e);if((c===md||c===pp)&&(i.status=dg),c===Di||c===md)return t.avail_out===0&&(i.last_flush=-1),ac;if(c===hg&&(e===jPe?co._tr_align(i):e!==AW&&(co._tr_stored_block(i,0,0,!1),e===UPe&&(Bf(i.head),i.lookahead===0&&(i.strstart=0,i.block_start=0,i.insert=0))),Nf(t),t.avail_out===0))return i.last_flush=-1,ac}return e!==Of?ac:i.wrap<=0?IW:(i.wrap===2?(Wt(i,t.adler&255),Wt(i,t.adler>>8&255),Wt(i,t.adler>>16&255),Wt(i,t.adler>>24&255),Wt(i,t.total_in&255),Wt(i,t.total_in>>8&255),Wt(i,t.total_in>>16&255),Wt(i,t.total_in>>24&255)):(pg(i,t.adler>>>16),pg(i,t.adler&65535)),Nf(t),i.wrap>0&&(i.wrap=-i.wrap),i.pending!==0?ac:IW)}function pCe(t){var e;return!t||!t.state?uo:(e=t.state.status,e!==kb&&e!==gx&&e!==Db&&e!==Bb&&e!==Nb&&e!==gd&&e!==dg?Df(t,uo):(t.state=null,e===gd?Df(t,FPe):ac))}function yCe(t,e){var r=e.length,i,n,s,o,a,c,u,f;if(!t||!t.state||(i=t.state,o=i.wrap,o===2||o===1&&i.status!==kb||i.lookahead))return uo;for(o===1&&(t.adler=xW(t.adler,e,r,0)),i.wrap=0,r>=i.w_size&&(o===0&&(Bf(i.head),i.strstart=0,i.block_start=0,i.insert=0),f=new Vn.Buf8(i.w_size),Vn.arraySet(f,e,r-i.w_size,i.w_size,0),e=f,r=i.w_size),a=t.avail_in,c=t.next_in,u=t.input,t.avail_in=r,t.next_in=0,t.input=e,bd(i);i.lookahead>=Dt;){n=i.strstart,s=i.lookahead-(Dt-1);do i.ins_h=(i.ins_h<<i.hash_shift^i.window[n+Dt-1])&i.hash_mask,i.prev[n&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=n,n++;while(--s);i.strstart=n,i.lookahead=Dt-1,bd(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=Dt-1,i.match_available=0,t.next_in=c,t.input=u,t.avail_in=a,i.wrap=o,ac}uc.deflateInit=dCe;uc.deflateInit2=OW;uc.deflateReset=CW;uc.deflateResetKeep=PW;uc.deflateSetHeader=lCe;uc.deflate=hCe;uc.deflateEnd=pCe;uc.deflateSetDictionary=yCe;uc.deflateInfo="pako deflate (from Nodeca project)"});var bx=m(mp=>{l();"use strict";var Mb=hu(),DW=!0,BW=!0;try{String.fromCharCode.apply(null,[0])}catch(t){DW=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){BW=!1}var yg=new Mb.Buf8(256);for(yu=0;yu<256;yu++)yg[yu]=yu>=252?6:yu>=248?5:yu>=240?4:yu>=224?3:yu>=192?2:1;var yu;yg[254]=yg[254]=1;mp.string2buf=function(t){var e,r,i,n,s,o=t.length,a=0;for(n=0;n<o;n++)r=t.charCodeAt(n),(r&64512)==55296&&n+1<o&&(i=t.charCodeAt(n+1),(i&64512)==56320&&(r=65536+(r-55296<<10)+(i-56320),n++)),a+=r<128?1:r<2048?2:r<65536?3:4;for(e=new Mb.Buf8(a),s=0,n=0;s<a;n++)r=t.charCodeAt(n),(r&64512)==55296&&n+1<o&&(i=t.charCodeAt(n+1),(i&64512)==56320&&(r=65536+(r-55296<<10)+(i-56320),n++)),r<128?e[s++]=r:r<2048?(e[s++]=192|r>>>6,e[s++]=128|r&63):r<65536?(e[s++]=224|r>>>12,e[s++]=128|r>>>6&63,e[s++]=128|r&63):(e[s++]=240|r>>>18,e[s++]=128|r>>>12&63,e[s++]=128|r>>>6&63,e[s++]=128|r&63);return e};function NW(t,e){if(e<65534&&(t.subarray&&BW||!t.subarray&&DW))return String.fromCharCode.apply(null,Mb.shrinkBuf(t,e));for(var r="",i=0;i<e;i++)r+=String.fromCharCode(t[i]);return r}mp.buf2binstring=function(t){return NW(t,t.length)};mp.binstring2buf=function(t){for(var e=new Mb.Buf8(t.length),r=0,i=e.length;r<i;r++)e[r]=t.charCodeAt(r);return e};mp.buf2string=function(t,e){var r,i,n,s,o=e||t.length,a=new Array(o*2);for(i=0,r=0;r<o;){if(n=t[r++],n<128){a[i++]=n;continue}if(s=yg[n],s>4){a[i++]=65533,r+=s-1;continue}for(n&=s===2?31:s===3?15:7;s>1&&r<o;)n=n<<6|t[r++]&63,s--;if(s>1){a[i++]=65533;continue}n<65536?a[i++]=n:(n-=65536,a[i++]=55296|n>>10&1023,a[i++]=56320|n&1023)}return NW(a,i)};mp.utf8border=function(t,e){var r;for(e=e||t.length,e>t.length&&(e=t.length),r=e-1;r>=0&&(t[r]&192)==128;)r--;return r<0||r===0?e:r+yg[t[r]]>e?r:e}});var vx=m((_pt,MW)=>{l();"use strict";function gCe(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}MW.exports=gCe});var UW=m(bg=>{l();"use strict";var gg=kW(),mg=hu(),wx=bx(),_x=Pb(),mCe=vx(),LW=Object.prototype.toString,bCe=0,Ex=4,bp=0,qW=1,jW=2,vCe=-1,wCe=0,_Ce=8;function vd(t){if(!(this instanceof vd))return new vd(t);this.options=mg.assign({level:vCe,method:_Ce,chunkSize:16384,windowBits:15,memLevel:8,strategy:wCe,to:""},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new mCe,this.strm.avail_out=0;var r=gg.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==bp)throw new Error(_x[r]);if(e.header&&gg.deflateSetHeader(this.strm,e.header),e.dictionary){var i;if(typeof e.dictionary=="string"?i=wx.string2buf(e.dictionary):LW.call(e.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(e.dictionary):i=e.dictionary,r=gg.deflateSetDictionary(this.strm,i),r!==bp)throw new Error(_x[r]);this._dict_set=!0}}vd.prototype.push=function(t,e){var r=this.strm,i=this.options.chunkSize,n,s;if(this.ended)return!1;s=e===~~e?e:e===!0?Ex:bCe,typeof t=="string"?r.input=wx.string2buf(t):LW.call(t)==="[object ArrayBuffer]"?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new mg.Buf8(i),r.next_out=0,r.avail_out=i),n=gg.deflate(r,s),n!==qW&&n!==bp)return this.onEnd(n),this.ended=!0,!1;(r.avail_out===0||r.avail_in===0&&(s===Ex||s===jW))&&(this.options.to==="string"?this.onData(wx.buf2binstring(mg.shrinkBuf(r.output,r.next_out))):this.onData(mg.shrinkBuf(r.output,r.next_out)))}while((r.avail_in>0||r.avail_out===0)&&n!==qW);return s===Ex?(n=gg.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===bp):(s===jW&&(this.onEnd(bp),r.avail_out=0),!0)};vd.prototype.onData=function(t){this.chunks.push(t)};vd.prototype.onEnd=function(t){t===bp&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=mg.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function Sx(t,e){var r=new vd(e);if(r.push(t,!0),r.err)throw r.msg||_x[r.err];return r.result}function ECe(t,e){return e=e||{},e.raw=!0,Sx(t,e)}function SCe(t,e){return e=e||{},e.gzip=!0,Sx(t,e)}bg.Deflate=vd;bg.deflate=Sx;bg.deflateRaw=ECe;bg.gzip=SCe});var KW=m((Spt,FW)=>{l();"use strict";var Lb=30,xCe=12;FW.exports=function(e,r){var i,n,s,o,a,c,u,f,d,h,p,y,b,E,v,A,R,F,D,B,H,W,X,P,g;i=e.state,n=e.next_in,P=e.input,s=n+(e.avail_in-5),o=e.next_out,g=e.output,a=o-(r-e.avail_out),c=o+(e.avail_out-257),u=i.dmax,f=i.wsize,d=i.whave,h=i.wnext,p=i.window,y=i.hold,b=i.bits,E=i.lencode,v=i.distcode,A=(1<<i.lenbits)-1,R=(1<<i.distbits)-1;e:do{b<15&&(y+=P[n++]<<b,b+=8,y+=P[n++]<<b,b+=8),F=E[y&A];t:for(;;){if(D=F>>>24,y>>>=D,b-=D,D=F>>>16&255,D===0)g[o++]=F&65535;else if(D&16){B=F&65535,D&=15,D&&(b<D&&(y+=P[n++]<<b,b+=8),B+=y&(1<<D)-1,y>>>=D,b-=D),b<15&&(y+=P[n++]<<b,b+=8,y+=P[n++]<<b,b+=8),F=v[y&R];r:for(;;){if(D=F>>>24,y>>>=D,b-=D,D=F>>>16&255,D&16){if(H=F&65535,D&=15,b<D&&(y+=P[n++]<<b,b+=8,b<D&&(y+=P[n++]<<b,b+=8)),H+=y&(1<<D)-1,H>u){e.msg="invalid distance too far back",i.mode=Lb;break e}if(y>>>=D,b-=D,D=o-a,H>D){if(D=H-D,D>d&&i.sane){e.msg="invalid distance too far back",i.mode=Lb;break e}if(W=0,X=p,h===0){if(W+=f-D,D<B){B-=D;do g[o++]=p[W++];while(--D);W=o-H,X=g}}else if(h<D){if(W+=f+h-D,D-=h,D<B){B-=D;do g[o++]=p[W++];while(--D);if(W=0,h<B){D=h,B-=D;do g[o++]=p[W++];while(--D);W=o-H,X=g}}}else if(W+=h-D,D<B){B-=D;do g[o++]=p[W++];while(--D);W=o-H,X=g}for(;B>2;)g[o++]=X[W++],g[o++]=X[W++],g[o++]=X[W++],B-=3;B&&(g[o++]=X[W++],B>1&&(g[o++]=X[W++]))}else{W=o-H;do g[o++]=g[W++],g[o++]=g[W++],g[o++]=g[W++],B-=3;while(B>2);B&&(g[o++]=g[W++],B>1&&(g[o++]=g[W++]))}}else if((D&64)==0){F=v[(F&65535)+(y&(1<<D)-1)];continue r}else{e.msg="invalid distance code",i.mode=Lb;break e}break}}else if((D&64)==0){F=E[(F&65535)+(y&(1<<D)-1)];continue t}else if(D&32){i.mode=xCe;break e}else{e.msg="invalid literal/length code",i.mode=Lb;break e}break}}while(n<s&&o<c);B=b>>3,n-=B,b-=B<<3,y&=(1<<b)-1,e.next_in=n,e.next_out=o,e.avail_in=n<s?5+(s-n):5-(n-s),e.avail_out=o<c?257+(c-o):257-(o-c),i.hold=y,i.bits=b}});var YW=m((xpt,WW)=>{l();"use strict";var VW=hu(),vp=15,zW=852,HW=592,GW=0,xx=1,$W=2,ACe=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],ICe=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],TCe=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],RCe=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];WW.exports=function(e,r,i,n,s,o,a,c){var u=c.bits,f=0,d=0,h=0,p=0,y=0,b=0,E=0,v=0,A=0,R=0,F,D,B,H,W,X=null,P=0,g,w=new VW.Buf16(vp+1),S=new VW.Buf16(vp+1),C=null,L=0,Y,V,q;for(f=0;f<=vp;f++)w[f]=0;for(d=0;d<n;d++)w[r[i+d]]++;for(y=u,p=vp;p>=1&&w[p]===0;p--);if(y>p&&(y=p),p===0)return s[o++]=1<<24|64<<16|0,s[o++]=1<<24|64<<16|0,c.bits=1,0;for(h=1;h<p&&w[h]===0;h++);for(y<h&&(y=h),v=1,f=1;f<=vp;f++)if(v<<=1,v-=w[f],v<0)return-1;if(v>0&&(e===GW||p!==1))return-1;for(S[1]=0,f=1;f<vp;f++)S[f+1]=S[f]+w[f];for(d=0;d<n;d++)r[i+d]!==0&&(a[S[r[i+d]]++]=d);if(e===GW?(X=C=a,g=19):e===xx?(X=ACe,P-=257,C=ICe,L-=257,g=256):(X=TCe,C=RCe,g=-1),R=0,d=0,f=h,W=o,b=y,E=0,B=-1,A=1<<y,H=A-1,e===xx&&A>zW||e===$W&&A>HW)return 1;for(;;){Y=f-E,a[d]<g?(V=0,q=a[d]):a[d]>g?(V=C[L+a[d]],q=X[P+a[d]]):(V=32+64,q=0),F=1<<f-E,D=1<<b,h=D;do D-=F,s[W+(R>>E)+D]=Y<<24|V<<16|q|0;while(D!==0);for(F=1<<f-1;R&F;)F>>=1;if(F!==0?(R&=F-1,R+=F):R=0,d++,--w[f]==0){if(f===p)break;f=r[i+a[d]]}if(f>y&&(R&H)!==B){for(E===0&&(E=y),W+=h,b=f-E,v=1<<b;b+E<p&&(v-=w[b+E],!(v<=0));)b++,v<<=1;if(A+=1<<b,e===xx&&A>zW||e===$W&&A>HW)return 1;B=R&H,s[B]=y<<24|b<<16|W-o|0}}return R!==0&&(s[W+R]=f-E<<24|64<<16|0),c.bits=y,0}});var CY=m(sa=>{l();"use strict";var Ts=hu(),Ax=dx(),fc=hx(),PCe=KW(),vg=YW(),CCe=0,XW=1,QW=2,ZW=4,OCe=5,qb=6,wd=0,kCe=1,DCe=2,fo=-2,JW=-3,Ix=-4,BCe=-5,eY=8,tY=1,rY=2,iY=3,nY=4,sY=5,oY=6,aY=7,cY=8,uY=9,fY=10,jb=11,gu=12,Tx=13,lY=14,Rx=15,dY=16,hY=17,pY=18,yY=19,Ub=20,Fb=21,gY=22,mY=23,bY=24,vY=25,wY=26,Px=27,_Y=28,EY=29,Rr=30,Cx=31,NCe=32,MCe=852,LCe=592,qCe=15,jCe=qCe;function SY(t){return(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24)}function UCe(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Ts.Buf16(320),this.work=new Ts.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function xY(t){var e;return!t||!t.state?fo:(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=tY,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Ts.Buf32(MCe),e.distcode=e.distdyn=new Ts.Buf32(LCe),e.sane=1,e.back=-1,wd)}function AY(t){var e;return!t||!t.state?fo:(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,xY(t))}function IY(t,e){var r,i;return!t||!t.state||(i=t.state,e<0?(r=0,e=-e):(r=(e>>4)+1,e<48&&(e&=15)),e&&(e<8||e>15))?fo:(i.window!==null&&i.wbits!==e&&(i.window=null),i.wrap=r,i.wbits=e,AY(t))}function TY(t,e){var r,i;return t?(i=new UCe,t.state=i,i.window=null,r=IY(t,e),r!==wd&&(t.state=null),r):fo}function FCe(t){return TY(t,jCe)}var RY=!0,Ox,kx;function KCe(t){if(RY){var e;for(Ox=new Ts.Buf32(512),kx=new Ts.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(vg(XW,t.lens,0,288,Ox,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;vg(QW,t.lens,0,32,kx,0,t.work,{bits:5}),RY=!1}t.lencode=Ox,t.lenbits=9,t.distcode=kx,t.distbits=5}function PY(t,e,r,i){var n,s=t.state;return s.window===null&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Ts.Buf8(s.wsize)),i>=s.wsize?(Ts.arraySet(s.window,e,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(n=s.wsize-s.wnext,n>i&&(n=i),Ts.arraySet(s.window,e,r-i,n,s.wnext),i-=n,i?(Ts.arraySet(s.window,e,r-i,i,0),s.wnext=i,s.whave=s.wsize):(s.wnext+=n,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=n))),0}function VCe(t,e){var r,i,n,s,o,a,c,u,f,d,h,p,y,b,E=0,v,A,R,F,D,B,H,W,X=new Ts.Buf8(4),P,g,w=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&t.avail_in!==0)return fo;r=t.state,r.mode===gu&&(r.mode=Tx),o=t.next_out,n=t.output,c=t.avail_out,s=t.next_in,i=t.input,a=t.avail_in,u=r.hold,f=r.bits,d=a,h=c,W=wd;e:for(;;)switch(r.mode){case tY:if(r.wrap===0){r.mode=Tx;break}for(;f<16;){if(a===0)break e;a--,u+=i[s++]<<f,f+=8}if(r.wrap&2&&u===35615){r.check=0,X[0]=u&255,X[1]=u>>>8&255,r.check=fc(r.check,X,2,0),u=0,f=0,r.mode=rY;break}if(r.flags=0,r.head&&(r.head.done=!1),!(r.wrap&1)||(((u&255)<<8)+(u>>8))%31){t.msg="incorrect header check",r.mode=Rr;break}if((u&15)!==eY){t.msg="unknown compression method",r.mode=Rr;break}if(u>>>=4,f-=4,H=(u&15)+8,r.wbits===0)r.wbits=H;else if(H>r.wbits){t.msg="invalid window size",r.mode=Rr;break}r.dmax=1<<H,t.adler=r.check=1,r.mode=u&512?fY:gu,u=0,f=0;break;case rY:for(;f<16;){if(a===0)break e;a--,u+=i[s++]<<f,f+=8}if(r.flags=u,(r.flags&255)!==eY){t.msg="unknown compression method",r.mode=Rr;break}if(r.flags&57344){t.msg="unknown header flags set",r.mode=Rr;break}r.head&&(r.head.text=u>>8&1),r.flags&512&&(X[0]=u&255,X[1]=u>>>8&255,r.check=fc(r.check,X,2,0)),u=0,f=0,r.mode=iY;case iY:for(;f<32;){if(a===0)break e;a--,u+=i[s++]<<f,f+=8}r.head&&(r.head.time=u),r.flags&512&&(X[0]=u&255,X[1]=u>>>8&255,X[2]=u>>>16&255,X[3]=u>>>24&255,r.check=fc(r.check,X,4,0)),u=0,f=0,r.mode=nY;case nY:for(;f<16;){if(a===0)break e;a--,u+=i[s++]<<f,f+=8}r.head&&(r.head.xflags=u&255,r.head.os=u>>8),r.flags&512&&(X[0]=u&255,X[1]=u>>>8&255,r.check=fc(r.check,X,2,0)),u=0,f=0,r.mode=sY;case sY:if(r.flags&1024){for(;f<16;){if(a===0)break e;a--,u+=i[s++]<<f,f+=8}r.length=u,r.head&&(r.head.extra_len=u),r.flags&512&&(X[0]=u&255,X[1]=u>>>8&255,r.check=fc(r.check,X,2,0)),u=0,f=0}else r.head&&(r.head.extra=null);r.mode=oY;case oY:if(r.flags&1024&&(p=r.length,p>a&&(p=a),p&&(r.head&&(H=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),Ts.arraySet(r.head.extra,i,s,p,H)),r.flags&512&&(r.check=fc(r.check,i,p,s)),a-=p,s+=p,r.length-=p),r.length))break e;r.length=0,r.mode=aY;case aY:if(r.flags&2048){if(a===0)break e;p=0;do H=i[s+p++],r.head&&H&&r.length<65536&&(r.head.name+=String.fromCharCode(H));while(H&&p<a);if(r.flags&512&&(r.check=fc(r.check,i,p,s)),a-=p,s+=p,H)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=cY;case cY:if(r.flags&4096){if(a===0)break e;p=0;do H=i[s+p++],r.head&&H&&r.length<65536&&(r.head.comment+=String.fromCharCode(H));while(H&&p<a);if(r.flags&512&&(r.check=fc(r.check,i,p,s)),a-=p,s+=p,H)break e}else r.head&&(r.head.comment=null);r.mode=uY;case uY:if(r.flags&512){for(;f<16;){if(a===0)break e;a--,u+=i[s++]<<f,f+=8}if(u!==(r.check&65535)){t.msg="header crc mismatch",r.mode=Rr;break}u=0,f=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=gu;break;case fY:for(;f<32;){if(a===0)break e;a--,u+=i[s++]<<f,f+=8}t.adler=r.check=SY(u),u=0,f=0,r.mode=jb;case jb:if(r.havedict===0)return t.next_out=o,t.avail_out=c,t.next_in=s,t.avail_in=a,r.hold=u,r.bits=f,DCe;t.adler=r.check=1,r.mode=gu;case gu:if(e===OCe||e===qb)break e;case Tx:if(r.last){u>>>=f&7,f-=f&7,r.mode=Px;break}for(;f<3;){if(a===0)break e;a--,u+=i[s++]<<f,f+=8}switch(r.last=u&1,u>>>=1,f-=1,u&3){case 0:r.mode=lY;break;case 1:if(KCe(r),r.mode=Ub,e===qb){u>>>=2,f-=2;break e}break;case 2:r.mode=hY;break;case 3:t.msg="invalid block type",r.mode=Rr}u>>>=2,f-=2;break;case lY:for(u>>>=f&7,f-=f&7;f<32;){if(a===0)break e;a--,u+=i[s++]<<f,f+=8}if((u&65535)!=(u>>>16^65535)){t.msg="invalid stored block lengths",r.mode=Rr;break}if(r.length=u&65535,u=0,f=0,r.mode=Rx,e===qb)break e;case Rx:r.mode=dY;case dY:if(p=r.length,p){if(p>a&&(p=a),p>c&&(p=c),p===0)break e;Ts.arraySet(n,i,s,p,o),a-=p,s+=p,c-=p,o+=p,r.length-=p;break}r.mode=gu;break;case hY:for(;f<14;){if(a===0)break e;a--,u+=i[s++]<<f,f+=8}if(r.nlen=(u&31)+257,u>>>=5,f-=5,r.ndist=(u&31)+1,u>>>=5,f-=5,r.ncode=(u&15)+4,u>>>=4,f-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=Rr;break}r.have=0,r.mode=pY;case pY:for(;r.have<r.ncode;){for(;f<3;){if(a===0)break e;a--,u+=i[s++]<<f,f+=8}r.lens[w[r.have++]]=u&7,u>>>=3,f-=3}for(;r.have<19;)r.lens[w[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,P={bits:r.lenbits},W=vg(CCe,r.lens,0,19,r.lencode,0,r.work,P),r.lenbits=P.bits,W){t.msg="invalid code lengths set",r.mode=Rr;break}r.have=0,r.mode=yY;case yY:for(;r.have<r.nlen+r.ndist;){for(;E=r.lencode[u&(1<<r.lenbits)-1],v=E>>>24,A=E>>>16&255,R=E&65535,!(v<=f);){if(a===0)break e;a--,u+=i[s++]<<f,f+=8}if(R<16)u>>>=v,f-=v,r.lens[r.have++]=R;else{if(R===16){for(g=v+2;f<g;){if(a===0)break e;a--,u+=i[s++]<<f,f+=8}if(u>>>=v,f-=v,r.have===0){t.msg="invalid bit length repeat",r.mode=Rr;break}H=r.lens[r.have-1],p=3+(u&3),u>>>=2,f-=2}else if(R===17){for(g=v+3;f<g;){if(a===0)break e;a--,u+=i[s++]<<f,f+=8}u>>>=v,f-=v,H=0,p=3+(u&7),u>>>=3,f-=3}else{for(g=v+7;f<g;){if(a===0)break e;a--,u+=i[s++]<<f,f+=8}u>>>=v,f-=v,H=0,p=11+(u&127),u>>>=7,f-=7}if(r.have+p>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=Rr;break}for(;p--;)r.lens[r.have++]=H}}if(r.mode===Rr)break;if(r.lens[256]===0){t.msg="invalid code -- missing end-of-block",r.mode=Rr;break}if(r.lenbits=9,P={bits:r.lenbits},W=vg(XW,r.lens,0,r.nlen,r.lencode,0,r.work,P),r.lenbits=P.bits,W){t.msg="invalid literal/lengths set",r.mode=Rr;break}if(r.distbits=6,r.distcode=r.distdyn,P={bits:r.distbits},W=vg(QW,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,P),r.distbits=P.bits,W){t.msg="invalid distances set",r.mode=Rr;break}if(r.mode=Ub,e===qb)break e;case Ub:r.mode=Fb;case Fb:if(a>=6&&c>=258){t.next_out=o,t.avail_out=c,t.next_in=s,t.avail_in=a,r.hold=u,r.bits=f,PCe(t,h),o=t.next_out,n=t.output,c=t.avail_out,s=t.next_in,i=t.input,a=t.avail_in,u=r.hold,f=r.bits,r.mode===gu&&(r.back=-1);break}for(r.back=0;E=r.lencode[u&(1<<r.lenbits)-1],v=E>>>24,A=E>>>16&255,R=E&65535,!(v<=f);){if(a===0)break e;a--,u+=i[s++]<<f,f+=8}if(A&&(A&240)==0){for(F=v,D=A,B=R;E=r.lencode[B+((u&(1<<F+D)-1)>>F)],v=E>>>24,A=E>>>16&255,R=E&65535,!(F+v<=f);){if(a===0)break e;a--,u+=i[s++]<<f,f+=8}u>>>=F,f-=F,r.back+=F}if(u>>>=v,f-=v,r.back+=v,r.length=R,A===0){r.mode=wY;break}if(A&32){r.back=-1,r.mode=gu;break}if(A&64){t.msg="invalid literal/length code",r.mode=Rr;break}r.extra=A&15,r.mode=gY;case gY:if(r.extra){for(g=r.extra;f<g;){if(a===0)break e;a--,u+=i[s++]<<f,f+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,f-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=mY;case mY:for(;E=r.distcode[u&(1<<r.distbits)-1],v=E>>>24,A=E>>>16&255,R=E&65535,!(v<=f);){if(a===0)break e;a--,u+=i[s++]<<f,f+=8}if((A&240)==0){for(F=v,D=A,B=R;E=r.distcode[B+((u&(1<<F+D)-1)>>F)],v=E>>>24,A=E>>>16&255,R=E&65535,!(F+v<=f);){if(a===0)break e;a--,u+=i[s++]<<f,f+=8}u>>>=F,f-=F,r.back+=F}if(u>>>=v,f-=v,r.back+=v,A&64){t.msg="invalid distance code",r.mode=Rr;break}r.offset=R,r.extra=A&15,r.mode=bY;case bY:if(r.extra){for(g=r.extra;f<g;){if(a===0)break e;a--,u+=i[s++]<<f,f+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,f-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=Rr;break}r.mode=vY;case vY:if(c===0)break e;if(p=h-c,r.offset>p){if(p=r.offset-p,p>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=Rr;break}p>r.wnext?(p-=r.wnext,y=r.wsize-p):y=r.wnext-p,p>r.length&&(p=r.length),b=r.window}else b=n,y=o-r.offset,p=r.length;p>c&&(p=c),c-=p,r.length-=p;do n[o++]=b[y++];while(--p);r.length===0&&(r.mode=Fb);break;case wY:if(c===0)break e;n[o++]=r.length,c--,r.mode=Fb;break;case Px:if(r.wrap){for(;f<32;){if(a===0)break e;a--,u|=i[s++]<<f,f+=8}if(h-=c,t.total_out+=h,r.total+=h,h&&(t.adler=r.check=r.flags?fc(r.check,n,h,o-h):Ax(r.check,n,h,o-h)),h=c,(r.flags?u:SY(u))!==r.check){t.msg="incorrect data check",r.mode=Rr;break}u=0,f=0}r.mode=_Y;case _Y:if(r.wrap&&r.flags){for(;f<32;){if(a===0)break e;a--,u+=i[s++]<<f,f+=8}if(u!==(r.total&4294967295)){t.msg="incorrect length check",r.mode=Rr;break}u=0,f=0}r.mode=EY;case EY:W=kCe;break e;case Rr:W=JW;break e;case Cx:return Ix;case NCe:default:return fo}return t.next_out=o,t.avail_out=c,t.next_in=s,t.avail_in=a,r.hold=u,r.bits=f,(r.wsize||h!==t.avail_out&&r.mode<Rr&&(r.mode<Px||e!==ZW))&&PY(t,t.output,t.next_out,h-t.avail_out)?(r.mode=Cx,Ix):(d-=t.avail_in,h-=t.avail_out,t.total_in+=d,t.total_out+=h,r.total+=h,r.wrap&&h&&(t.adler=r.check=r.flags?fc(r.check,n,h,t.next_out-h):Ax(r.check,n,h,t.next_out-h)),t.data_type=r.bits+(r.last?64:0)+(r.mode===gu?128:0)+(r.mode===Ub||r.mode===Rx?256:0),(d===0&&h===0||e===ZW)&&W===wd&&(W=BCe),W)}function zCe(t){if(!t||!t.state)return fo;var e=t.state;return e.window&&(e.window=null),t.state=null,wd}function HCe(t,e){var r;return!t||!t.state||(r=t.state,(r.wrap&2)==0)?fo:(r.head=e,e.done=!1,wd)}function GCe(t,e){var r=e.length,i,n,s;return!t||!t.state||(i=t.state,i.wrap!==0&&i.mode!==jb)?fo:i.mode===jb&&(n=1,n=Ax(n,e,r,0),n!==i.check)?JW:(s=PY(t,e,r,r),s?(i.mode=Cx,Ix):(i.havedict=1,wd))}sa.inflateReset=AY;sa.inflateReset2=IY;sa.inflateResetKeep=xY;sa.inflateInit=FCe;sa.inflateInit2=TY;sa.inflate=VCe;sa.inflateEnd=zCe;sa.inflateGetHeader=HCe;sa.inflateSetDictionary=GCe;sa.inflateInfo="pako inflate (from Nodeca project)"});var Dx=m((Ipt,OY)=>{l();"use strict";OY.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var DY=m((Tpt,kY)=>{l();"use strict";function $Ce(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}kY.exports=$Ce});var NY=m(_g=>{l();"use strict";var wp=CY(),wg=hu(),Kb=bx(),hi=Dx(),Bx=Pb(),WCe=vx(),YCe=DY(),BY=Object.prototype.toString;function _d(t){if(!(this instanceof _d))return new _d(t);this.options=wg.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(t&&t.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15)==0&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new WCe,this.strm.avail_out=0;var r=wp.inflateInit2(this.strm,e.windowBits);if(r!==hi.Z_OK)throw new Error(Bx[r]);if(this.header=new YCe,wp.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=Kb.string2buf(e.dictionary):BY.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=wp.inflateSetDictionary(this.strm,e.dictionary),r!==hi.Z_OK)))throw new Error(Bx[r])}_d.prototype.push=function(t,e){var r=this.strm,i=this.options.chunkSize,n=this.options.dictionary,s,o,a,c,u,f=!1;if(this.ended)return!1;o=e===~~e?e:e===!0?hi.Z_FINISH:hi.Z_NO_FLUSH,typeof t=="string"?r.input=Kb.binstring2buf(t):BY.call(t)==="[object ArrayBuffer]"?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new wg.Buf8(i),r.next_out=0,r.avail_out=i),s=wp.inflate(r,hi.Z_NO_FLUSH),s===hi.Z_NEED_DICT&&n&&(s=wp.inflateSetDictionary(this.strm,n)),s===hi.Z_BUF_ERROR&&f===!0&&(s=hi.Z_OK,f=!1),s!==hi.Z_STREAM_END&&s!==hi.Z_OK)return this.onEnd(s),this.ended=!0,!1;r.next_out&&(r.avail_out===0||s===hi.Z_STREAM_END||r.avail_in===0&&(o===hi.Z_FINISH||o===hi.Z_SYNC_FLUSH))&&(this.options.to==="string"?(a=Kb.utf8border(r.output,r.next_out),c=r.next_out-a,u=Kb.buf2string(r.output,a),r.next_out=c,r.avail_out=i-c,c&&wg.arraySet(r.output,r.output,a,c,0),this.onData(u)):this.onData(wg.shrinkBuf(r.output,r.next_out))),r.avail_in===0&&r.avail_out===0&&(f=!0)}while((r.avail_in>0||r.avail_out===0)&&s!==hi.Z_STREAM_END);return s===hi.Z_STREAM_END&&(o=hi.Z_FINISH),o===hi.Z_FINISH?(s=wp.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===hi.Z_OK):(o===hi.Z_SYNC_FLUSH&&(this.onEnd(hi.Z_OK),r.avail_out=0),!0)};_d.prototype.onData=function(t){this.chunks.push(t)};_d.prototype.onEnd=function(t){t===hi.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=wg.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function Nx(t,e){var r=new _d(e);if(r.push(t,!0),r.err)throw r.msg||Bx[r.err];return r.result}function XCe(t,e){return e=e||{},e.raw=!0,Nx(t,e)}_g.Inflate=_d;_g.inflate=Nx;_g.inflateRaw=XCe;_g.ungzip=Nx});var qY=m((Ppt,LY)=>{l();"use strict";var QCe=hu().assign,ZCe=UW(),JCe=NY(),eOe=Dx(),MY={};QCe(MY,ZCe,JCe,eOe);LY.exports=MY});var UY=m((Cpt,jY)=>{l();"use strict";var{concat:tOe}=(mn(),$s);async function rOe(t){let e=new Uint8Array(0);for await(let r of t)e=tOe([e,r],e.length+r.length);return e}jY.exports=rOe});var Kx=m((r1t,ZY)=>{l();ZY.exports=iOe;function iOe(t,e,r){var i,n;if(Array.isArray(e)&&(i=e.slice(0)),typeof e=="string"&&(i=e.split(".")),typeof e=="symbol"&&(i=[e]),!Array.isArray(i))throw new Error("props arg must be an array, a string or a symbol");if(n=i.pop(),!n)return!1;QY(n);for(var s;s=i.shift();)if(QY(s),typeof t[s]=="undefined"&&(t[s]={}),t=t[s],!t||typeof t!="object")return!1;return t[n]=r,!0}function QY(t){if(t==="__proto__"||t==="constructor"||t==="prototype")throw new Error("setting of prototype values not supported")}});var Sd=m((C1t,dX)=>{l();"use strict";var yOe=async t=>{for await(let e of t)return e};dX.exports=yOe});var Yb=m((Z1t,RX)=>{l();var{Multiaddr:mOe}=rt(),Wb=(t,e)=>e,bOe=(t,e,r,i)=>{if(i&&i.assumeHttp===!1)return`tcp://${t}:${e}`;let n="tcp",s=`:${e}`;return r[r.length-1].protocol==="tcp"&&(n=e==="443"?"https":"http",s=e==="443"||e==="80"?"":s),`${n}://${t}${s}`},vOe={ip4:Wb,ip6:(t,e,r,i)=>i.length===1&&i[0].protocol==="ip6"?e:`[${e}]`,tcp:(t,e,r,i,n)=>i.some(s=>["http","https","ws","wss"].includes(s.protocol))?`${t}:${e}`:bOe(t,e,i,n),udp:(t,e)=>`udp://${t}:${e}`,dnsaddr:Wb,dns4:Wb,dns6:Wb,ipfs:(t,e)=>`${t}/ipfs/${e}`,p2p:(t,e)=>`${t}/p2p/${e}`,http:t=>`http://${t}`,https:t=>`https://${t}`,ws:t=>`ws://${t}`,wss:t=>`wss://${t}`,"p2p-websocket-star":t=>`${t}/p2p-websocket-star`,"p2p-webrtc-star":t=>`${t}/p2p-webrtc-star`,"p2p-webrtc-direct":t=>`${t}/p2p-webrtc-direct`};RX.exports=(t,e)=>{let r=new mOe(t),i=t.toString().split("/").slice(1);return r.tuples().map(n=>({protocol:i.shift(),content:n[1]?i.shift():null})).reduce((n,s,o,a)=>{let c=vOe[s.protocol];if(!c)throw new Error(`Unsupported protocol ${s.protocol}`);return c(n,s.content,o,a,e)},"")}});var CX=m((J1t,PX)=>{l();"use strict";PX.exports=t=>{if(!Array.isArray(t))throw new TypeError(`Expected an array, got ${typeof t}`);t=[...t];for(let e=t.length-1;e>0;e--){let r=Math.floor(Math.random()*(e+1));[t[e],t[r]]=[t[r],t[e]]}return t}});var tA=m((n2t,jX)=>{l();jX.exports={WORKER_REQUEST_READ_LOCK:"lock:worker:request-read",WORKER_RELEASE_READ_LOCK:"lock:worker:release-read",MASTER_GRANT_READ_LOCK:"lock:master:grant-read",WORKER_REQUEST_WRITE_LOCK:"lock:worker:request-write",WORKER_RELEASE_WRITE_LOCK:"lock:worker:release-write",MASTER_GRANT_WRITE_LOCK:"lock:master:grant-write"}});var UX=m(()=>{l()});var XX=m((a2t,YX)=>{l();var SOe=br().EventEmitter,{nanoid:xOe}=(S6(),B9),{WORKER_REQUEST_READ_LOCK:FX,WORKER_RELEASE_READ_LOCK:KX,MASTER_GRANT_READ_LOCK:VX,WORKER_REQUEST_WRITE_LOCK:zX,WORKER_RELEASE_WRITE_LOCK:HX,MASTER_GRANT_WRITE_LOCK:GX}=tA(),Sg,$X=(t,e,r,i,n)=>(s,o)=>{o&&o.type===r&&t.emit(e,o.name,()=>(s.send({type:n,name:o.name,identifier:o.identifier}),new Promise(a=>{let c=u=>{u&&u.type===i&&u.identifier===o.identifier&&(s.removeListener("message",c),a())};s.on("message",c)})))},WX=(t,e,r,i)=>()=>{let n=xOe();return process.send({type:e,identifier:n,name:t}),new Promise(s=>{let o=a=>{a&&a.type===r&&a.identifier===n&&(process.removeListener("message",o),s(()=>{process.send({type:i,identifier:n,name:t})}))};process.on("message",o)})};YX.exports=t=>{try{if(Sg=UX(),!Object.keys(Sg).length)return}catch(e){return}if(Sg.isMaster||t.singleProcess){let e=new SOe;return Sg.on("message",$X(e,"requestReadLock",FX,KX,VX)),Sg.on("message",$X(e,"requestWriteLock",zX,HX,GX)),e}return{isWorker:!0,readLock:e=>WX(e,FX,VX,KX),writeLock:e=>WX(e,zX,GX,HX)}}});var rA=m((c2t,QX)=>{l();var Lf={},Ip=t=>{t.addEventListener("message",e=>{Ip.dispatchEvent("message",t,e)}),t.port&&t.port.addEventListener("message",e=>{Ip.dispatchEvent("message",t,e)})};Ip.addEventListener=(t,e)=>{Lf[t]||(Lf[t]=[]),Lf[t].push(e)};Ip.removeEventListener=(t,e)=>{!Lf[t]||(Lf[t]=Lf[t].filter(r=>r===e))};Ip.dispatchEvent=function(){let t=Array.prototype.slice.call(arguments),e=t.shift();!Lf[e]||Lf[e].forEach(r=>r.apply(null,t))};QX.exports=Ip});var cQ=m((u2t,aQ)=>{l();var AOe=br().EventEmitter,{nanoid:IOe}=(S6(),B9),{WORKER_REQUEST_READ_LOCK:ZX,WORKER_RELEASE_READ_LOCK:JX,MASTER_GRANT_READ_LOCK:eQ,WORKER_REQUEST_WRITE_LOCK:tQ,WORKER_RELEASE_WRITE_LOCK:rQ,MASTER_GRANT_WRITE_LOCK:iQ}=tA(),nQ=rA(),sQ=(t,e,r,i,n)=>(s,o)=>{if(!o||!o.data||o.data.type!==r)return;let a={type:o.data.type,name:o.data.name,identifier:o.data.identifier};t.emit(e,a.name,()=>(s.postMessage({type:n,name:a.name,identifier:a.identifier}),new Promise(c=>{let u=f=>{if(!f||!f.data)return;let d={type:f.data.type,name:f.data.name,identifier:f.data.identifier};d&&d.type===i&&d.identifier===a.identifier&&(s.removeEventListener("message",u),c())};s.addEventListener("message",u)})))},oQ=(t,e,r,i)=>()=>{let n=IOe();return globalThis.postMessage({type:e,identifier:n,name:t}),new Promise(s=>{let o=a=>{if(!a||!a.data)return;let c={type:a.data.type,identifier:a.data.identifier};c&&c.type===r&&c.identifier===n&&(globalThis.removeEventListener("message",o),s(()=>{globalThis.postMessage({type:i,identifier:n,name:t})}))};globalThis.addEventListener("message",o)})},TOe={singleProcess:!1};aQ.exports=t=>{if(t=Object.assign({},TOe,t),!!globalThis.document||t.singleProcess){let r=new AOe;return nQ.addEventListener("message",sQ(r,"requestReadLock",ZX,JX,eQ)),nQ.addEventListener("message",sQ(r,"requestWriteLock",tQ,rQ,iQ)),r}return{isWorker:!0,readLock:r=>oQ(r,ZX,eQ,JX),writeLock:r=>oQ(r,tQ,iQ,rQ)}}});var uQ=m((l2t,iA)=>{l();"use strict";var Zb,f2t=iA.exports.timeout=function(t,e){var r=new Zb,i;return Promise.race([t,new Promise(function(n,s){i=setTimeout(function(){s(r)},e)})]).then(function(n){return clearTimeout(i),n},function(n){throw clearTimeout(i),n})};Zb=iA.exports.TimeoutError=function(){Error.call(this),this.stack=Error().stack,this.message="Timeout"};Zb.prototype=Object.create(Error.prototype);Zb.prototype.name="TimeoutError"});var oA=m((d2t,sA)=>{l();var ROe=XX(),POe=cQ(),{default:fQ}=Yc(),{timeout:COe}=uQ(),OOe=rA(),xd={},qf;function nA(t,e){let r,i=new Promise(n=>{r=n});return t.add(()=>COe((()=>new Promise(n=>{r(()=>{n()})}))(),e.timeout)),i}var kOe=(t,e)=>{if(qf.isWorker)return{readLock:qf.readLock(t,e),writeLock:qf.writeLock(t,e)};let r=new fQ({concurrency:1}),i=null;return{readLock:()=>{if(i)return nA(i,e);i=new fQ({concurrency:e.concurrency,autoStart:!1});let n=i,s=nA(i,e);return r.add(()=>(n.start(),n.onIdle().then(()=>{i===n&&(i=null)}))),s},writeLock:()=>(i=null,nA(r,e))}},DOe={concurrency:1/0,timeout:846e5,global:globalThis,singleProcess:!1};sA.exports=(t,e)=>(e||(e={}),typeof t=="object"&&(e=t,t="lock"),t||(t="lock"),e=Object.assign({},DOe,e),qf||(qf=ROe(e)||POe(e),qf.isWorker||(qf.on("requestReadLock",(r,i)=>{!xd[r]||xd[r].readLock().then(n=>i().finally(()=>n()))}),qf.on("requestWriteLock",async(r,i)=>{!xd[r]||xd[r].writeLock().then(n=>i().finally(()=>n()))}))),xd[t]||(xd[t]=kOe(t,e)),xd[t]);sA.exports.Worker=function(t,e){e=e||globalThis.Worker;let r;try{r=new e(t)}catch(i){i.message.includes("not a constructor")&&(r=e(t))}if(!r)throw new Error("Could not create Worker from",e);return OOe(r),r}});var EA=m((o6t,DZ)=>{l();DZ.exports=Pke;function Pke(t,e,r){if(!t)return r;var i,n;if(Array.isArray(e)&&(i=e.slice(0)),typeof e=="string"&&(i=e.split(".")),typeof e=="symbol"&&(i=[e]),!Array.isArray(i))throw new Error("props arg must be an array, a string or a symbol");for(;i.length;)if(n=i.shift(),!t||(t=t[n],t===void 0))return r;return t}});var Rd=m((a6t,NZ)=>{l();"use strict";function BZ(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function Cke(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return BZ(t,r)}catch(i){r.message=t.message,r.stack=t.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(t)),BZ(new n,r)}}NZ.exports=Cke});var c5=m((c6t,MZ)=>{l();"use strict";var Oke=async t=>{let e=0;for await(let r of t)e++;return e};MZ.exports=Oke});var HZ=m((m6t,zZ)=>{l();SA.BASE=2166136261;function SA(t){for(var e=SA.BASE,r=0,i=t.length;r<i;r++)e^=t.charCodeAt(r),e+=(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24);return e>>>0}zZ.exports=SA});var TA={};zt(TA,{compare:()=>IA});function IA(t,e){for(let r=0;r<t.byteLength;r++){if(t[r]<e[r])return-1;if(t[r]>e[r])return 1}return t.byteLength>e.byteLength?1:t.byteLength<e.byteLength?-1:0}var l5=bt(()=>{l()});var lJ=m((p4t,g5)=>{l();"use strict";g5.exports=Qke;g5.exports.format=uJ;g5.exports.parse=fJ;var Wke=/\B(?=(\d{3})+(?!\d))/g,Yke=/(?:\.0*|(\.[^0]+)0+)$/,zf={b:1,kb:1<<10,mb:1<<20,gb:1<<30,tb:Math.pow(1024,4),pb:Math.pow(1024,5)},Xke=/^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;function Qke(t,e){return typeof t=="string"?fJ(t):typeof t=="number"?uJ(t,e):null}function uJ(t,e){if(!Number.isFinite(t))return null;var r=Math.abs(t),i=e&&e.thousandsSeparator||"",n=e&&e.unitSeparator||"",s=e&&e.decimalPlaces!==void 0?e.decimalPlaces:2,o=Boolean(e&&e.fixedDecimals),a=e&&e.unit||"";(!a||!zf[a.toLowerCase()])&&(r>=zf.pb?a="PB":r>=zf.tb?a="TB":r>=zf.gb?a="GB":r>=zf.mb?a="MB":r>=zf.kb?a="KB":a="B");var c=t/zf[a.toLowerCase()],u=c.toFixed(s);return o||(u=u.replace(Yke,"$1")),i&&(u=u.replace(Wke,i)),u+n+a}function fJ(t){if(typeof t=="number"&&!isNaN(t))return t;if(typeof t!="string")return null;var e=Xke.exec(t),r,i="b";return e?(r=parseFloat(e[1]),i=e[4].toLowerCase()):(r=parseInt(t,10),i="b"),Math.floor(zf[i]*r)}});var _J=m((P4t,wJ)=>{l();"use strict";wJ.exports=t=>{if(Object.prototype.toString.call(t)!=="[object Object]")return!1;let e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}});var SJ=m((C4t,EJ)=>{l();"use strict";var MA=_J();EJ.exports=(t,e={})=>{if(!MA(t)&&!Array.isArray(t))throw new TypeError("Expected a plain object or array");let{deep:r}=e,i=[],n=[],s=a=>{let c=i.indexOf(a);if(c!==-1)return n[c];let u=[];return i.push(a),n.push(u),u.push(...a.map(f=>Array.isArray(f)?s(f):MA(f)?o(f):f)),u},o=a=>{let c=i.indexOf(a);if(c!==-1)return n[c];let u={},f=Object.keys(a).sort(e.compare);i.push(a),n.push(u);for(let d of f){let h=a[d],p;r&&Array.isArray(h)?p=s(h):p=r&&MA(h)?o(h):h,Object.defineProperty(u,d,{...Object.getOwnPropertyDescriptor(a,d),value:p})}return u};return Array.isArray(t)?r?s(t):t.slice():o(t)}});var ree=m((Obt,tee)=>{l();"use strict";var hDe=nd(),pDe=async function*(t,e){yield*(await hDe(t)).sort(e)};tee.exports=pDe});var HA=m((kbt,iee)=>{l();"use strict";iee.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),i=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var n=42;e[r]=n;for(r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,r);if(o.value!==n||o.enumerable!==!0)return!1}return!0}});var Fg=m((Dbt,nee)=>{l();"use strict";var yDe=HA();nee.exports=function(){return yDe()&&!!Symbol.toStringTag}});var aee=m((Bbt,oee)=>{l();"use strict";var see=typeof Symbol!="undefined"&&Symbol,gDe=HA();oee.exports=function(){return typeof see!="function"||typeof Symbol!="function"||typeof see("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:gDe()}});var uee=m((Nbt,cee)=>{l();"use strict";var mDe="Function.prototype.bind called on incompatible ",GA=Array.prototype.slice,bDe=Object.prototype.toString,vDe="[object Function]";cee.exports=function(e){var r=this;if(typeof r!="function"||bDe.call(r)!==vDe)throw new TypeError(mDe+r);for(var i=GA.call(arguments,1),n,s=function(){if(this instanceof n){var f=r.apply(this,i.concat(GA.call(arguments)));return Object(f)===f?f:this}else return r.apply(e,i.concat(GA.call(arguments)))},o=Math.max(0,r.length-i.length),a=[],c=0;c<o;c++)a.push("$"+c);if(n=Function("binder","return function ("+a.join(",")+"){ return binder.apply(this,arguments); }")(s),r.prototype){var u=function(){};u.prototype=r.prototype,n.prototype=new u,u.prototype=null}return n}});var S5=m((Mbt,fee)=>{l();"use strict";var wDe=uee();fee.exports=Function.prototype.bind||wDe});var dee=m((Lbt,lee)=>{l();"use strict";var _De=S5();lee.exports=_De.call(Function.call,Object.prototype.hasOwnProperty)});var T5=m((qbt,gee)=>{l();"use strict";var Lt,Kg=SyntaxError,hee=Function,Lp=TypeError,$A=function(t){try{return hee('"use strict"; return ('+t+").constructor;")()}catch(e){}},Nd=Object.getOwnPropertyDescriptor;if(Nd)try{Nd({},"")}catch(t){Nd=null}var WA=function(){throw new Lp},EDe=Nd?function(){try{return arguments.callee,WA}catch(t){try{return Nd(arguments,"callee").get}catch(e){return WA}}}():WA,qp=aee()(),Gf=Object.getPrototypeOf||function(t){return t.__proto__},jp={},SDe=typeof Uint8Array=="undefined"?Lt:Gf(Uint8Array),Up={"%AggregateError%":typeof AggregateError=="undefined"?Lt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?Lt:ArrayBuffer,"%ArrayIteratorPrototype%":qp?Gf([][Symbol.iterator]()):Lt,"%AsyncFromSyncIteratorPrototype%":Lt,"%AsyncFunction%":jp,"%AsyncGenerator%":jp,"%AsyncGeneratorFunction%":jp,"%AsyncIteratorPrototype%":jp,"%Atomics%":typeof Atomics=="undefined"?Lt:Atomics,"%BigInt%":typeof BigInt=="undefined"?Lt:BigInt,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?Lt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array=="undefined"?Lt:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?Lt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?Lt:FinalizationRegistry,"%Function%":hee,"%GeneratorFunction%":jp,"%Int8Array%":typeof Int8Array=="undefined"?Lt:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?Lt:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?Lt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":qp?Gf(Gf([][Symbol.iterator]())):Lt,"%JSON%":typeof JSON=="object"?JSON:Lt,"%Map%":typeof Map=="undefined"?Lt:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!qp?Lt:Gf(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?Lt:Promise,"%Proxy%":typeof Proxy=="undefined"?Lt:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect=="undefined"?Lt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?Lt:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!qp?Lt:Gf(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?Lt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":qp?Gf(""[Symbol.iterator]()):Lt,"%Symbol%":qp?Symbol:Lt,"%SyntaxError%":Kg,"%ThrowTypeError%":EDe,"%TypedArray%":SDe,"%TypeError%":Lp,"%Uint8Array%":typeof Uint8Array=="undefined"?Lt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?Lt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?Lt:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?Lt:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap=="undefined"?Lt:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?Lt:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?Lt:WeakSet},xDe=function t(e){var r;if(e==="%AsyncFunction%")r=$A("async function () {}");else if(e==="%GeneratorFunction%")r=$A("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=$A("async function* () {}");else if(e==="%AsyncGenerator%"){var i=t("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var n=t("%AsyncGenerator%");n&&(r=Gf(n.prototype))}return Up[e]=r,r},pee={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},x5=S5(),A5=dee(),ADe=x5.call(Function.call,Array.prototype.concat),IDe=x5.call(Function.apply,Array.prototype.splice),yee=x5.call(Function.call,String.prototype.replace),I5=x5.call(Function.call,String.prototype.slice),TDe=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,RDe=/\\(\\)?/g,PDe=function(e){var r=I5(e,0,1),i=I5(e,-1);if(r==="%"&&i!=="%")throw new Kg("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&r!=="%")throw new Kg("invalid intrinsic syntax, expected opening `%`");var n=[];return yee(e,TDe,function(s,o,a,c){n[n.length]=a?yee(c,RDe,"$1"):o||s}),n},CDe=function(e,r){var i=e,n;if(A5(pee,i)&&(n=pee[i],i="%"+n[0]+"%"),A5(Up,i)){var s=Up[i];if(s===jp&&(s=xDe(i)),typeof s=="undefined"&&!r)throw new Lp("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:i,value:s}}throw new Kg("intrinsic "+e+" does not exist!")};gee.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new Lp("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Lp('"allowMissing" argument must be a boolean');var i=PDe(e),n=i.length>0?i[0]:"",s=CDe("%"+n+"%",r),o=s.name,a=s.value,c=!1,u=s.alias;u&&(n=u[0],IDe(i,ADe([0,1],u)));for(var f=1,d=!0;f<i.length;f+=1){var h=i[f],p=I5(h,0,1),y=I5(h,-1);if((p==='"'||p==="'"||p==="`"||y==='"'||y==="'"||y==="`")&&p!==y)throw new Kg("property names with quotes must have matching quotes");if((h==="constructor"||!d)&&(c=!0),n+="."+h,o="%"+n+"%",A5(Up,o))a=Up[o];else if(a!=null){if(!(h in a)){if(!r)throw new Lp("base intrinsic for "+e+" exists, but the property is not available.");return}if(Nd&&f+1>=i.length){var b=Nd(a,h);d=!!b,d&&"get"in b&&!("originalValue"in b.get)?a=b.get:a=a[h]}else d=A5(a,h),a=a[h];d&&!c&&(Up[o]=a)}}return a}});var Eee=m((jbt,R5)=>{l();"use strict";var YA=S5(),Fp=T5(),mee=Fp("%Function.prototype.apply%"),bee=Fp("%Function.prototype.call%"),vee=Fp("%Reflect.apply%",!0)||YA.call(bee,mee),wee=Fp("%Object.getOwnPropertyDescriptor%",!0),Md=Fp("%Object.defineProperty%",!0),ODe=Fp("%Math.max%");if(Md)try{Md({},"a",{value:1})}catch(t){Md=null}R5.exports=function(e){var r=vee(YA,bee,arguments);if(wee&&Md){var i=wee(r,"length");i.configurable&&Md(r,"length",{value:1+ODe(0,e.length-(arguments.length-1))})}return r};var _ee=function(){return vee(YA,mee,arguments)};Md?Md(R5.exports,"apply",{value:_ee}):R5.exports.apply=_ee});var P5=m((Ubt,Aee)=>{l();"use strict";var See=T5(),xee=Eee(),kDe=xee(See("String.prototype.indexOf"));Aee.exports=function(e,r){var i=See(e,!!r);return typeof i=="function"&&kDe(e,".prototype.")>-1?xee(i):i}});var Ree=m((Fbt,Tee)=>{l();"use strict";var DDe=Fg()(),BDe=P5(),XA=BDe("Object.prototype.toString"),C5=function(e){return DDe&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:XA(e)==="[object Arguments]"},Iee=function(e){return C5(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&XA(e)!=="[object Array]"&&XA(e.callee)==="[object Function]"},NDe=function(){return C5(arguments)}();C5.isLegacyArguments=Iee;Tee.exports=NDe?C5:Iee});var Oee=m((Kbt,Cee)=>{l();"use strict";var MDe=Object.prototype.toString,LDe=Function.prototype.toString,qDe=/^\s*(?:function)?\*/,Pee=Fg()(),QA=Object.getPrototypeOf,jDe=function(){if(!Pee)return!1;try{return Function("return function*() {}")()}catch(t){}},ZA;Cee.exports=function(e){if(typeof e!="function")return!1;if(qDe.test(LDe.call(e)))return!0;if(!Pee){var r=MDe.call(e);return r==="[object GeneratorFunction]"}if(!QA)return!1;if(typeof ZA=="undefined"){var i=jDe();ZA=i?QA(i):!1}return QA(e)===ZA}});var JA=m((Vbt,kee)=>{l();var UDe=Object.prototype.hasOwnProperty,FDe=Object.prototype.toString;kee.exports=function(e,r,i){if(FDe.call(r)!=="[object Function]")throw new TypeError("iterator must be a function");var n=e.length;if(n===+n)for(var s=0;s<n;s++)r.call(i,e[s],s,e);else for(var o in e)UDe.call(e,o)&&r.call(i,e[o],o,e)}});var tI=m((zbt,Dee)=>{l();"use strict";var eI=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],KDe=(typeof globalThis=="undefined",globalThis);Dee.exports=function(){for(var e=[],r=0;r<eI.length;r++)typeof KDe[eI[r]]=="function"&&(e[e.length]=eI[r]);return e}});var rI=m((Hbt,Bee)=>{l();"use strict";var VDe=T5(),O5=VDe("%Object.getOwnPropertyDescriptor%");if(O5)try{O5([],"length")}catch(t){O5=null}Bee.exports=O5});var sI=m((Gbt,jee)=>{l();"use strict";var Nee=JA(),zDe=tI(),iI=P5(),HDe=iI("Object.prototype.toString"),Mee=Fg()(),GDe=(typeof globalThis=="undefined",globalThis),Lee=zDe(),$De=iI("Array.prototype.indexOf",!0)||function(e,r){for(var i=0;i<e.length;i+=1)if(e[i]===r)return i;return-1},WDe=iI("String.prototype.slice"),qee={},k5=rI(),nI=Object.getPrototypeOf;Mee&&k5&&nI&&Nee(Lee,function(t){var e=new GDe[t];if(Symbol.toStringTag in e){var r=nI(e),i=k5(r,Symbol.toStringTag);if(!i){var n=nI(r);i=k5(n,Symbol.toStringTag)}qee[t]=i.get}});var YDe=function(e){var r=!1;return Nee(qee,function(i,n){if(!r)try{r=i.call(e)===n}catch(s){}}),r};jee.exports=function(e){if(!e||typeof e!="object")return!1;if(!Mee||!(Symbol.toStringTag in e)){var r=WDe(HDe(e),8,-1);return $De(Lee,r)>-1}return k5?YDe(e):!1}});var Gee=m(($bt,Hee)=>{l();"use strict";var Uee=JA(),XDe=tI(),Fee=P5(),QDe=Fee("Object.prototype.toString"),Kee=Fg()(),Vee=(typeof globalThis=="undefined",globalThis),ZDe=XDe(),JDe=Fee("String.prototype.slice"),zee={},oI=rI(),aI=Object.getPrototypeOf;Kee&&oI&&aI&&Uee(ZDe,function(t){if(typeof Vee[t]=="function"){var e=new Vee[t];if(Symbol.toStringTag in e){var r=aI(e),i=oI(r,Symbol.toStringTag);if(!i){var n=aI(r);i=oI(n,Symbol.toStringTag)}zee[t]=i.get}}});var eBe=function(e){var r=!1;return Uee(zee,function(i,n){if(!r)try{var s=i.call(e);s===n&&(r=s)}catch(o){}}),r},tBe=sI();Hee.exports=function(e){return tBe(e)?!Kee||!(Symbol.toStringTag in e)?JDe(QDe(e),8,-1):eBe(e):!1}});var ote=m(xt=>{l();"use strict";var rBe=Ree(),iBe=Oee(),aa=Gee(),$ee=sI();function Kp(t){return t.call.bind(t)}var Wee=typeof BigInt!="undefined",Yee=typeof Symbol!="undefined",yo=Kp(Object.prototype.toString),nBe=Kp(Number.prototype.valueOf),sBe=Kp(String.prototype.valueOf),oBe=Kp(Boolean.prototype.valueOf);Wee&&(Xee=Kp(BigInt.prototype.valueOf));var Xee;Yee&&(Qee=Kp(Symbol.prototype.valueOf));var Qee;function Vg(t,e){if(typeof t!="object")return!1;try{return e(t),!0}catch(r){return!1}}xt.isArgumentsObject=rBe;xt.isGeneratorFunction=iBe;xt.isTypedArray=$ee;function aBe(t){return typeof Promise!="undefined"&&t instanceof Promise||t!==null&&typeof t=="object"&&typeof t.then=="function"&&typeof t.catch=="function"}xt.isPromise=aBe;function cBe(t){return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?ArrayBuffer.isView(t):$ee(t)||Jee(t)}xt.isArrayBufferView=cBe;function uBe(t){return aa(t)==="Uint8Array"}xt.isUint8Array=uBe;function fBe(t){return aa(t)==="Uint8ClampedArray"}xt.isUint8ClampedArray=fBe;function lBe(t){return aa(t)==="Uint16Array"}xt.isUint16Array=lBe;function dBe(t){return aa(t)==="Uint32Array"}xt.isUint32Array=dBe;function hBe(t){return aa(t)==="Int8Array"}xt.isInt8Array=hBe;function pBe(t){return aa(t)==="Int16Array"}xt.isInt16Array=pBe;function yBe(t){return aa(t)==="Int32Array"}xt.isInt32Array=yBe;function gBe(t){return aa(t)==="Float32Array"}xt.isFloat32Array=gBe;function mBe(t){return aa(t)==="Float64Array"}xt.isFloat64Array=mBe;function bBe(t){return aa(t)==="BigInt64Array"}xt.isBigInt64Array=bBe;function vBe(t){return aa(t)==="BigUint64Array"}xt.isBigUint64Array=vBe;function D5(t){return yo(t)==="[object Map]"}D5.working=typeof Map!="undefined"&&D5(new Map);function wBe(t){return typeof Map=="undefined"?!1:D5.working?D5(t):t instanceof Map}xt.isMap=wBe;function B5(t){return yo(t)==="[object Set]"}B5.working=typeof Set!="undefined"&&B5(new Set);function _Be(t){return typeof Set=="undefined"?!1:B5.working?B5(t):t instanceof Set}xt.isSet=_Be;function N5(t){return yo(t)==="[object WeakMap]"}N5.working=typeof WeakMap!="undefined"&&N5(new WeakMap);function EBe(t){return typeof WeakMap=="undefined"?!1:N5.working?N5(t):t instanceof WeakMap}xt.isWeakMap=EBe;function cI(t){return yo(t)==="[object WeakSet]"}cI.working=typeof WeakSet!="undefined"&&cI(new WeakSet);function SBe(t){return cI(t)}xt.isWeakSet=SBe;function M5(t){return yo(t)==="[object ArrayBuffer]"}M5.working=typeof ArrayBuffer!="undefined"&&M5(new ArrayBuffer);function Zee(t){return typeof ArrayBuffer=="undefined"?!1:M5.working?M5(t):t instanceof ArrayBuffer}xt.isArrayBuffer=Zee;function L5(t){return yo(t)==="[object DataView]"}L5.working=typeof ArrayBuffer!="undefined"&&typeof DataView!="undefined"&&L5(new DataView(new ArrayBuffer(1),0,1));function Jee(t){return typeof DataView=="undefined"?!1:L5.working?L5(t):t instanceof DataView}xt.isDataView=Jee;var uI=typeof SharedArrayBuffer!="undefined"?SharedArrayBuffer:void 0;function zg(t){return yo(t)==="[object SharedArrayBuffer]"}function ete(t){return typeof uI=="undefined"?!1:(typeof zg.working=="undefined"&&(zg.working=zg(new uI)),zg.working?zg(t):t instanceof uI)}xt.isSharedArrayBuffer=ete;function xBe(t){return yo(t)==="[object AsyncFunction]"}xt.isAsyncFunction=xBe;function ABe(t){return yo(t)==="[object Map Iterator]"}xt.isMapIterator=ABe;function IBe(t){return yo(t)==="[object Set Iterator]"}xt.isSetIterator=IBe;function TBe(t){return yo(t)==="[object Generator]"}xt.isGeneratorObject=TBe;function RBe(t){return yo(t)==="[object WebAssembly.Module]"}xt.isWebAssemblyCompiledModule=RBe;function tte(t){return Vg(t,nBe)}xt.isNumberObject=tte;function rte(t){return Vg(t,sBe)}xt.isStringObject=rte;function ite(t){return Vg(t,oBe)}xt.isBooleanObject=ite;function nte(t){return Wee&&Vg(t,Xee)}xt.isBigIntObject=nte;function ste(t){return Yee&&Vg(t,Qee)}xt.isSymbolObject=ste;function PBe(t){return tte(t)||rte(t)||ite(t)||nte(t)||ste(t)}xt.isBoxedPrimitive=PBe;function CBe(t){return typeof Uint8Array!="undefined"&&(Zee(t)||ete(t))}xt.isAnyArrayBuffer=CBe;["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(t){Object.defineProperty(xt,t,{enumerable:!1,value:function(){throw new Error(t+" is not supported in userland")}})})});var cte=m((Ybt,ate)=>{l();ate.exports=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"}});var pte=m(At=>{l();var ute=Object.getOwnPropertyDescriptors||function(e){for(var r=Object.keys(e),i={},n=0;n<r.length;n++)i[r[n]]=Object.getOwnPropertyDescriptor(e,r[n]);return i},OBe=/%[sdj%]/g;At.format=function(t){if(!K5(t)){for(var e=[],r=0;r<arguments.length;r++)e.push($f(arguments[r]));return e.join(" ")}for(var r=1,i=arguments,n=i.length,s=String(t).replace(OBe,function(a){if(a==="%%")return"%";if(r>=n)return a;switch(a){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch(c){return"[Circular]"}default:return a}}),o=i[r];r<n;o=i[++r])F5(o)||!Vp(o)?s+=" "+o:s+=" "+$f(o);return s};At.deprecate=function(t,e){if(typeof process!="undefined"&&process.noDeprecation===!0)return t;if(typeof process=="undefined")return function(){return At.deprecate(t,e).apply(this,arguments)};var r=!1;function i(){if(!r){if(process.throwDeprecation)throw new Error(e);process.traceDeprecation?console.trace(e):console.error(e),r=!0}return t.apply(this,arguments)}return i};var q5={},fte=/^$/;process.env.NODE_DEBUG&&(j5=process.env.NODE_DEBUG,j5=j5.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),fte=new RegExp("^"+j5+"$","i"));var j5;At.debuglog=function(t){if(t=t.toUpperCase(),!q5[t])if(fte.test(t)){var e=process.pid;q5[t]=function(){var r=At.format.apply(At,arguments);console.error("%s %d: %s",t,e,r)}}else q5[t]=function(){};return q5[t]};function $f(t,e){var r={seen:[],stylize:DBe};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),dI(e)?r.showHidden=e:e&&At._extend(r,e),Ld(r.showHidden)&&(r.showHidden=!1),Ld(r.depth)&&(r.depth=2),Ld(r.colors)&&(r.colors=!1),Ld(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=kBe),U5(r,t,r.depth)}At.inspect=$f;$f.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};$f.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function kBe(t,e){var r=$f.styles[e];return r?"["+$f.colors[r][0]+"m"+t+"["+$f.colors[r][1]+"m":t}function DBe(t,e){return t}function BBe(t){var e={};return t.forEach(function(r,i){e[r]=!0}),e}function U5(t,e,r){if(t.customInspect&&e&&z5(e.inspect)&&e.inspect!==At.inspect&&!(e.constructor&&e.constructor.prototype===e)){var i=e.inspect(r,t);return K5(i)||(i=U5(t,i,r)),i}var n=NBe(t,e);if(n)return n;var s=Object.keys(e),o=BBe(s);if(t.showHidden&&(s=Object.getOwnPropertyNames(e)),Gg(e)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return fI(e);if(s.length===0){if(z5(e)){var a=e.name?": "+e.name:"";return t.stylize("[Function"+a+"]","special")}if(Hg(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(V5(e))return t.stylize(Date.prototype.toString.call(e),"date");if(Gg(e))return fI(e)}var c="",u=!1,f=["{","}"];if(lte(e)&&(u=!0,f=["[","]"]),z5(e)){var d=e.name?": "+e.name:"";c=" [Function"+d+"]"}if(Hg(e)&&(c=" "+RegExp.prototype.toString.call(e)),V5(e)&&(c=" "+Date.prototype.toUTCString.call(e)),Gg(e)&&(c=" "+fI(e)),s.length===0&&(!u||e.length==0))return f[0]+c+f[1];if(r<0)return Hg(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var h;return u?h=MBe(t,e,r,o,s):h=s.map(function(p){return lI(t,e,r,o,p,u)}),t.seen.pop(),LBe(h,c,f)}function NBe(t,e){if(Ld(e))return t.stylize("undefined","undefined");if(K5(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(dte(e))return t.stylize(""+e,"number");if(dI(e))return t.stylize(""+e,"boolean");if(F5(e))return t.stylize("null","null")}function fI(t){return"["+Error.prototype.toString.call(t)+"]"}function MBe(t,e,r,i,n){for(var s=[],o=0,a=e.length;o<a;++o)hte(e,String(o))?s.push(lI(t,e,r,i,String(o),!0)):s.push("");return n.forEach(function(c){c.match(/^\d+$/)||s.push(lI(t,e,r,i,c,!0))}),s}function lI(t,e,r,i,n,s){var o,a,c;if(c=Object.getOwnPropertyDescriptor(e,n)||{value:e[n]},c.get?c.set?a=t.stylize("[Getter/Setter]","special"):a=t.stylize("[Getter]","special"):c.set&&(a=t.stylize("[Setter]","special")),hte(i,n)||(o="["+n+"]"),a||(t.seen.indexOf(c.value)<0?(F5(r)?a=U5(t,c.value,null):a=U5(t,c.value,r-1),a.indexOf(`
`)>-1&&(s?a=a.split(`
`).map(function(u){return" "+u}).join(`
`).substr(2):a=`
`+a.split(`
`).map(function(u){return" "+u}).join(`
`))):a=t.stylize("[Circular]","special")),Ld(o)){if(s&&n.match(/^\d+$/))return a;o=JSON.stringify(""+n),o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+a}function LBe(t,e,r){var i=0,n=t.reduce(function(s,o){return i++,o.indexOf(`
`)>=0&&i++,s+o.replace(/\u001b\[\d\d?m/g,"").length+1},0);return n>60?r[0]+(e===""?"":e+`
`)+" "+t.join(`,
`)+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}At.types=ote();function lte(t){return Array.isArray(t)}At.isArray=lte;function dI(t){return typeof t=="boolean"}At.isBoolean=dI;function F5(t){return t===null}At.isNull=F5;function qBe(t){return t==null}At.isNullOrUndefined=qBe;function dte(t){return typeof t=="number"}At.isNumber=dte;function K5(t){return typeof t=="string"}At.isString=K5;function jBe(t){return typeof t=="symbol"}At.isSymbol=jBe;function Ld(t){return t===void 0}At.isUndefined=Ld;function Hg(t){return Vp(t)&&hI(t)==="[object RegExp]"}At.isRegExp=Hg;At.types.isRegExp=Hg;function Vp(t){return typeof t=="object"&&t!==null}At.isObject=Vp;function V5(t){return Vp(t)&&hI(t)==="[object Date]"}At.isDate=V5;At.types.isDate=V5;function Gg(t){return Vp(t)&&(hI(t)==="[object Error]"||t instanceof Error)}At.isError=Gg;At.types.isNativeError=Gg;function z5(t){return typeof t=="function"}At.isFunction=z5;function UBe(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||typeof t=="symbol"||typeof t=="undefined"}At.isPrimitive=UBe;At.isBuffer=cte();function hI(t){return Object.prototype.toString.call(t)}function pI(t){return t<10?"0"+t.toString(10):t.toString(10)}var FBe=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function KBe(){var t=new Date,e=[pI(t.getHours()),pI(t.getMinutes()),pI(t.getSeconds())].join(":");return[t.getDate(),FBe[t.getMonth()],e].join(" ")}At.log=function(){console.log("%s - %s",KBe(),At.format.apply(At,arguments))};At.inherits=on();At._extend=function(t,e){if(!e||!Vp(e))return t;for(var r=Object.keys(e),i=r.length;i--;)t[r[i]]=e[r[i]];return t};function hte(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var qd=typeof Symbol!="undefined"?Symbol("util.promisify.custom"):void 0;At.promisify=function(e){if(typeof e!="function")throw new TypeError('The "original" argument must be of type Function');if(qd&&e[qd]){var r=e[qd];if(typeof r!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(r,qd,{value:r,enumerable:!1,writable:!1,configurable:!0}),r}function r(){for(var i,n,s=new Promise(function(c,u){i=c,n=u}),o=[],a=0;a<arguments.length;a++)o.push(arguments[a]);o.push(function(c,u){c?n(c):i(u)});try{e.apply(this,o)}catch(c){n(c)}return s}return Object.setPrototypeOf(r,Object.getPrototypeOf(e)),qd&&Object.defineProperty(r,qd,{value:r,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(r,ute(e))};At.promisify.custom=qd;function VBe(t,e){if(!t){var r=new Error("Promise was rejected with a falsy value");r.reason=t,t=r}return e(t)}function zBe(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');function e(){for(var r=[],i=0;i<arguments.length;i++)r.push(arguments[i]);var n=r.pop();if(typeof n!="function")throw new TypeError("The last argument must be of type Function");var s=this,o=function(){return n.apply(s,arguments)};t.apply(this,r).then(function(a){process.nextTick(o.bind(null,null,a))},function(a){process.nextTick(VBe.bind(null,a,o))})}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Object.defineProperties(e,ute(t)),e}At.callbackify=zBe});var yI=m((Qbt,yte)=>{l();"use strict";yte.exports=function(...e){let r=e.reduce((i,n)=>Object.assign(i,n),{});return Object.assign(r,{bufferKeys:r.bufferKeys||!1,snapshots:r.snapshots||!1,permanence:r.permanence||!1,seek:r.seek||!1,clear:r.clear||!1,status:r.status||!1,createIfMissing:r.createIfMissing||!1,errorIfExists:r.errorIfExists||!1,deferredOpen:r.deferredOpen||!1,openCallback:r.openCallback||!1,promises:r.promises||!1,streams:r.streams||!1,encodings:r.encodings||!1,additionalMethods:Object.assign({},r.additionalMethods)})}});var gI=m((Zbt,gte)=>{l();gte.exports=function(e){return e!=null&&e.constructor!=null&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}});var H5=m((Jbt,bte)=>{l();var mte;bte.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window!="undefined"?window:globalThis):t=>(mte||(mte=Promise.resolve())).then(t).catch(e=>setTimeout(()=>{throw e},0))});var G5=m((e5t,wte)=>{l();"use strict";var vte=H5();wte.exports=function(t,...e){e.length===0?vte(t):vte(()=>t(...e))}});var mI=m((t5t,_te)=>{l();"use strict";function Wf(t){if(typeof t!="object"||t===null)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=t,this._ended=!1,this._nexting=!1}Wf.prototype.next=function(t){if(typeof t!="function")throw new Error("next() requires a callback argument");return this._ended?(this._nextTick(t,new Error("cannot call next() after end()")),this):this._nexting?(this._nextTick(t,new Error("cannot call next() before previous next() has completed")),this):(this._nexting=!0,this._next((e,...r)=>{this._nexting=!1,t(e,...r)}),this)};Wf.prototype._next=function(t){this._nextTick(t)};Wf.prototype.seek=function(t){if(this._ended)throw new Error("cannot call seek() after end()");if(this._nexting)throw new Error("cannot call seek() before next() has completed");t=this.db._serializeKey(t),this._seek(t)};Wf.prototype._seek=function(t){};Wf.prototype.end=function(t){if(typeof t!="function")throw new Error("end() requires a callback argument");if(this._ended)return this._nextTick(t,new Error("end() already called on iterator"));this._ended=!0,this._end(t)};Wf.prototype._end=function(t){this._nextTick(t)};Wf.prototype._nextTick=G5();_te.exports=Wf});var bI=m((r5t,Ste)=>{l();"use strict";var Ete=Object.freeze({});function ca(t){if(typeof t!="object"||t===null)throw new TypeError("First argument must be an abstract-leveldown compliant store");this.db=t,this._operations=[],this._written=!1}ca.prototype._checkWritten=function(){if(this._written)throw new Error("write() already called on this batch")};ca.prototype.put=function(t,e,r){this._checkWritten();let i=this.db._checkKey(t)||this.db._checkValue(e);if(i)throw i;return t=this.db._serializeKey(t),e=this.db._serializeValue(e),this._put(t,e,r??Ete),this};ca.prototype._put=function(t,e,r){this._operations.push({...r,type:"put",key:t,value:e})};ca.prototype.del=function(t,e){this._checkWritten();let r=this.db._checkKey(t);if(r)throw r;return t=this.db._serializeKey(t),this._del(t,e??Ete),this};ca.prototype._del=function(t,e){this._operations.push({...e,type:"del",key:t})};ca.prototype.clear=function(){return this._checkWritten(),this._clear(),this};ca.prototype._clear=function(){this._operations=[]};ca.prototype.write=function(t,e){if(this._checkWritten(),typeof t=="function"&&(e=t),typeof e!="function")throw new Error("write() requires a callback argument");(typeof t!="object"||t===null)&&(t={}),this._written=!0,this._write(t,e)};ca.prototype._write=function(t,e){this.db._batch(this._operations,t,e)};ca.prototype._nextTick=G5();Ste.exports=ca});var Ite=m((i5t,Ate)=>{l();"use strict";var HBe=yI(),GBe=gI(),$Be=mI(),WBe=bI(),YBe=Object.prototype.hasOwnProperty,XBe=["lt","lte","gt","gte"];function Pr(t){this.status="new",this.supports=HBe(t,{status:!0})}Pr.prototype.open=function(t,e){let r=this.status;if(typeof t=="function"&&(e=t),typeof e!="function")throw new Error("open() requires a callback argument");(typeof t!="object"||t===null)&&(t={}),t.createIfMissing=t.createIfMissing!==!1,t.errorIfExists=!!t.errorIfExists,this.status="opening",this._open(t,i=>{if(i)return this.status=r,e(i);this.status="open",e()})};Pr.prototype._open=function(t,e){this._nextTick(e)};Pr.prototype.close=function(t){let e=this.status;if(typeof t!="function")throw new Error("close() requires a callback argument");this.status="closing",this._close(r=>{if(r)return this.status=e,t(r);this.status="closed",t()})};Pr.prototype._close=function(t){this._nextTick(t)};Pr.prototype.get=function(t,e,r){if(typeof e=="function"&&(r=e),typeof r!="function")throw new Error("get() requires a callback argument");let i=this._checkKey(t);if(i)return this._nextTick(r,i);t=this._serializeKey(t),(typeof e!="object"||e===null)&&(e={}),e.asBuffer=e.asBuffer!==!1,this._get(t,e,r)};Pr.prototype._get=function(t,e,r){this._nextTick(function(){r(new Error("NotFound"))})};Pr.prototype.put=function(t,e,r,i){if(typeof r=="function"&&(i=r),typeof i!="function")throw new Error("put() requires a callback argument");let n=this._checkKey(t)||this._checkValue(e);if(n)return this._nextTick(i,n);t=this._serializeKey(t),e=this._serializeValue(e),(typeof r!="object"||r===null)&&(r={}),this._put(t,e,r,i)};Pr.prototype._put=function(t,e,r,i){this._nextTick(i)};Pr.prototype.del=function(t,e,r){if(typeof e=="function"&&(r=e),typeof r!="function")throw new Error("del() requires a callback argument");let i=this._checkKey(t);if(i)return this._nextTick(r,i);t=this._serializeKey(t),(typeof e!="object"||e===null)&&(e={}),this._del(t,e,r)};Pr.prototype._del=function(t,e,r){this._nextTick(r)};Pr.prototype.batch=function(t,e,r){if(!arguments.length)return this._chainedBatch();if(typeof e=="function"&&(r=e),typeof t=="function"&&(r=t),typeof r!="function")throw new Error("batch(array) requires a callback argument");if(!Array.isArray(t))return this._nextTick(r,new Error("batch(array) requires an array argument"));if(t.length===0)return this._nextTick(r);(typeof e!="object"||e===null)&&(e={});let i=new Array(t.length);for(let n=0;n<t.length;n++){if(typeof t[n]!="object"||t[n]===null)return this._nextTick(r,new Error("batch(array) element must be an object and not `null`"));let s=Object.assign({},t[n]);if(s.type!=="put"&&s.type!=="del")return this._nextTick(r,new Error("`type` must be 'put' or 'del'"));let o=this._checkKey(s.key);if(o)return this._nextTick(r,o);if(s.key=this._serializeKey(s.key),s.type==="put"){let a=this._checkValue(s.value);if(a)return this._nextTick(r,a);s.value=this._serializeValue(s.value)}i[n]=s}this._batch(i,e,r)};Pr.prototype._batch=function(t,e,r){this._nextTick(r)};Pr.prototype.clear=function(t,e){if(typeof t=="function")e=t;else if(typeof e!="function")throw new Error("clear() requires a callback argument");t=xte(this,t),t.reverse=!!t.reverse,t.limit="limit"in t?t.limit:-1,this._clear(t,e)};Pr.prototype._clear=function(t,e){t.keys=!0,t.values=!1,t.keyAsBuffer=!0,t.valueAsBuffer=!0;let r=this._iterator(t),i={},n=s=>{if(s)return r.end(function(){e(s)});r.next((o,a)=>{if(o)return n(o);if(a===void 0)return r.end(e);this._del(a,i,n)})};n()};Pr.prototype._setupIteratorOptions=function(t){return t=xte(this,t),t.reverse=!!t.reverse,t.keys=t.keys!==!1,t.values=t.values!==!1,t.limit="limit"in t?t.limit:-1,t.keyAsBuffer=t.keyAsBuffer!==!1,t.valueAsBuffer=t.valueAsBuffer!==!1,t};function xte(t,e){let r={};for(let i in e){if(!YBe.call(e,i))continue;if(i==="start"||i==="end")throw new Error('Legacy range options ("start" and "end") have been removed');let n=e[i];QBe(i)&&(n=t._serializeKey(n)),r[i]=n}return r}function QBe(t){return XBe.indexOf(t)!==-1}Pr.prototype.iterator=function(t){return(typeof t!="object"||t===null)&&(t={}),t=this._setupIteratorOptions(t),this._iterator(t)};Pr.prototype._iterator=function(t){return new $Be(this)};Pr.prototype._chainedBatch=function(){return new WBe(this)};Pr.prototype._serializeKey=function(t){return t};Pr.prototype._serializeValue=function(t){return t};Pr.prototype._checkKey=function(t){if(t==null)return new Error("key cannot be `null` or `undefined`");if(GBe(t)&&t.length===0)return new Error("key cannot be an empty Buffer");if(t==="")return new Error("key cannot be an empty String");if(Array.isArray(t)&&t.length===0)return new Error("key cannot be an empty Array")};Pr.prototype._checkValue=function(t){if(t==null)return new Error("value cannot be `null` or `undefined`")};Pr.prototype._nextTick=G5();Ate.exports=Pr});var Yf=m($5=>{l();"use strict";$5.AbstractLevelDOWN=Ite();$5.AbstractIterator=mI();$5.AbstractChainedBatch=bI()});var Pte=m((s5t,Rte)=>{l();"use strict";var Tte=Yf().AbstractIterator,ZBe=on();function zp(t,e){Tte.call(this,t),this._options=e,this._iterator=null,this._operations=[]}ZBe(zp,Tte);zp.prototype.setDb=function(t){let e=this._iterator=t.iterator(this._options);for(let r of this._operations)e[r.method](...r.args)};zp.prototype._operation=function(t,e){if(this._iterator)return this._iterator[t](...e);this._operations.push({method:t,args:e})};for(let t of["next","end"])zp.prototype["_"+t]=function(...e){this._operation(t,e)};zp.prototype.seek=function(...t){this._operation("seek",t)};Rte.exports=zp});var Bte=m((o5t,vI)=>{l();"use strict";var Cte=Yf().AbstractLevelDOWN,JBe=on(),Ote=Pte(),kte="put get del batch clear".split(" "),eNe="approximateSize compactRange".split(" ");function jd(t){Cte.call(this,t.supports||{});for(let e of eNe)typeof t[e]=="function"&&!this.supports.additionalMethods[e]&&(this.supports.additionalMethods[e]=!0);this._db=t,this._operations=[],Dte(this)}JBe(jd,Cte);jd.prototype.type="deferred-leveldown";jd.prototype._open=function(t,e){this._db.open(t,r=>{if(r)return e(r);for(let i of this._operations)i.iterator?i.iterator.setDb(this._db):this._db[i.method](...i.args);this._operations=[],tNe(this),e()})};jd.prototype._close=function(t){this._db.close(e=>{if(e)return t(e);Dte(this),t()})};function tNe(t){for(let e of kte.concat("iterator"))t["_"+e]=function(...r){return this._db[e](...r)};for(let e of Object.keys(t.supports.additionalMethods))t[e]=function(...r){return this._db[e](...r)}}function Dte(t){for(let e of kte)t["_"+e]=function(...r){this._operations.push({method:e,args:r})};for(let e of Object.keys(t.supports.additionalMethods))t[e]=function(...r){this._operations.push({method:e,args:r})};t._iterator=function(e){let r=new Ote(t,e);return this._operations.push({iterator:r}),r}}jd.prototype._serializeKey=function(t){return t};jd.prototype._serializeValue=function(t){return t};vI.exports=jd;vI.exports.DeferredIterator=Ote});var wI=m((a5t,Nte)=>{l();Nte.exports=br().EventEmitter});var _I=m(()=>{l()});var jte=m((f5t,qte)=>{l();"use strict";function Mte(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function rNe(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Mte(Object(r),!0).forEach(function(i){iNe(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Mte(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function iNe(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function nNe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Lte(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function sNe(t,e,r){return e&&Lte(t.prototype,e),r&&Lte(t,r),t}var oNe=Ht(),W5=oNe.Buffer,aNe=_I(),EI=aNe.inspect,cNe=EI&&EI.custom||"inspect";function uNe(t,e,r){W5.prototype.copy.call(t,e,r)}qte.exports=function(){function t(){nNe(this,t),this.head=null,this.tail=null,this.length=0}return sNe(t,[{key:"push",value:function(r){var i={data:r,next:null};this.length>0?this.tail.next=i:this.head=i,this.tail=i,++this.length}},{key:"unshift",value:function(r){var i={data:r,next:this.head};this.length===0&&(this.tail=i),this.head=i,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var i=this.head,n=""+i.data;i=i.next;)n+=r+i.data;return n}},{key:"concat",value:function(r){if(this.length===0)return W5.alloc(0);for(var i=W5.allocUnsafe(r>>>0),n=this.head,s=0;n;)uNe(n.data,i,s),s+=n.data.length,n=n.next;return i}},{key:"consume",value:function(r,i){var n;return r<this.head.data.length?(n=this.head.data.slice(0,r),this.head.data=this.head.data.slice(r)):r===this.head.data.length?n=this.shift():n=i?this._getString(r):this._getBuffer(r),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(r){var i=this.head,n=1,s=i.data;for(r-=s.length;i=i.next;){var o=i.data,a=r>o.length?o.length:r;if(a===o.length?s+=o:s+=o.slice(0,r),r-=a,r===0){a===o.length?(++n,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=o.slice(a));break}++n}return this.length-=n,s}},{key:"_getBuffer",value:function(r){var i=W5.allocUnsafe(r),n=this.head,s=1;for(n.data.copy(i),r-=n.data.length;n=n.next;){var o=n.data,a=r>o.length?o.length:r;if(o.copy(i,i.length-r,0,a),r-=a,r===0){a===o.length?(++s,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(a));break}++s}return this.length-=s,i}},{key:cNe,value:function(r,i){return EI(this,rNe({},i,{depth:0,customInspect:!1}))}}]),t}()});var xI=m((l5t,Fte)=>{l();"use strict";function fNe(t,e){var r=this,i=this._readableState&&this._readableState.destroyed,n=this._writableState&&this._writableState.destroyed;return i||n?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(SI,this,t)):process.nextTick(SI,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(s){!e&&s?r._writableState?r._writableState.errorEmitted?process.nextTick(Y5,r):(r._writableState.errorEmitted=!0,process.nextTick(Ute,r,s)):process.nextTick(Ute,r,s):e?(process.nextTick(Y5,r),e(s)):process.nextTick(Y5,r)}),this)}function Ute(t,e){SI(t,e),Y5(t)}function Y5(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function lNe(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function SI(t,e){t.emit("error",e)}function dNe(t,e){var r=t._readableState,i=t._writableState;r&&r.autoDestroy||i&&i.autoDestroy?t.destroy(e):t.emit("error",e)}Fte.exports={destroy:fNe,undestroy:lNe,errorOrDestroy:dNe}});var Ud=m((d5t,zte)=>{l();"use strict";function hNe(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var Kte={};function go(t,e,r){r||(r=Error);function i(s,o,a){return typeof e=="string"?e:e(s,o,a)}var n=function(s){hNe(o,s);function o(a,c,u){return s.call(this,i(a,c,u))||this}return o}(r);n.prototype.name=r.name,n.prototype.code=t,Kte[t]=n}function Vte(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map(function(i){return String(i)}),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:r===2?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}else return"of ".concat(e," ").concat(String(t))}function pNe(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function yNe(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function gNe(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}go("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);go("ERR_INVALID_ARG_TYPE",function(t,e,r){var i;typeof e=="string"&&pNe(e,"not ")?(i="must not be",e=e.replace(/^not /,"")):i="must be";var n;if(yNe(t," argument"))n="The ".concat(t," ").concat(i," ").concat(Vte(e,"type"));else{var s=gNe(t,".")?"property":"argument";n='The "'.concat(t,'" ').concat(s," ").concat(i," ").concat(Vte(e,"type"))}return n+=". Received type ".concat(typeof r),n},TypeError);go("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");go("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});go("ERR_STREAM_PREMATURE_CLOSE","Premature close");go("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});go("ERR_MULTIPLE_CALLBACK","Callback called multiple times");go("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");go("ERR_STREAM_WRITE_AFTER_END","write after end");go("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);go("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);go("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");zte.exports.codes=Kte});var AI=m((h5t,Hte)=>{l();"use strict";var mNe=Ud().codes.ERR_INVALID_OPT_VALUE;function bNe(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function vNe(t,e,r,i){var n=bNe(e,i,r);if(n!=null){if(!(isFinite(n)&&Math.floor(n)===n)||n<0){var s=i?r:"highWaterMark";throw new mNe(s,n)}return Math.floor(n)}return t.objectMode?16:16*1024}Hte.exports={getHighWaterMark:vNe}});var $te=m((p5t,Gte)=>{l();Gte.exports=wNe;function wNe(t,e){if(II("noDeprecation"))return t;var r=!1;function i(){if(!r){if(II("throwDeprecation"))throw new Error(e);II("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return i}function II(t){try{if(!globalThis.localStorage)return!1}catch(r){return!1}var e=globalThis.localStorage[t];return e==null?!1:String(e).toLowerCase()==="true"}});var PI=m((y5t,Jte)=>{l();"use strict";Jte.exports=ti;function Wte(t){var e=this;this.next=null,this.entry=null,this.finish=function(){$Ne(e,t)}}var Hp;ti.WritableState=$g;var _Ne={deprecate:$te()},Yte=wI(),X5=Ht().Buffer,ENe=globalThis.Uint8Array||function(){};function SNe(t){return X5.from(t)}function xNe(t){return X5.isBuffer(t)||t instanceof ENe}var TI=xI(),ANe=AI(),INe=ANe.getHighWaterMark,Xf=Ud().codes,TNe=Xf.ERR_INVALID_ARG_TYPE,RNe=Xf.ERR_METHOD_NOT_IMPLEMENTED,PNe=Xf.ERR_MULTIPLE_CALLBACK,CNe=Xf.ERR_STREAM_CANNOT_PIPE,ONe=Xf.ERR_STREAM_DESTROYED,kNe=Xf.ERR_STREAM_NULL_VALUES,DNe=Xf.ERR_STREAM_WRITE_AFTER_END,BNe=Xf.ERR_UNKNOWN_ENCODING,Gp=TI.errorOrDestroy;on()(ti,Yte);function NNe(){}function $g(t,e,r){Hp=Hp||Fd(),t=t||{},typeof r!="boolean"&&(r=e instanceof Hp),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=INe(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var i=t.decodeStrings===!1;this.decodeStrings=!i,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(n){KNe(e,n)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new Wte(this)}$g.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty($g.prototype,"buffer",{get:_Ne.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}})();var Q5;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Q5=Function.prototype[Symbol.hasInstance],Object.defineProperty(ti,Symbol.hasInstance,{value:function(e){return Q5.call(this,e)?!0:this!==ti?!1:e&&e._writableState instanceof $g}})):Q5=function(e){return e instanceof this};function ti(t){Hp=Hp||Fd();var e=this instanceof Hp;if(!e&&!Q5.call(ti,this))return new ti(t);this._writableState=new $g(t,this,e),this.writable=!0,t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final)),Yte.call(this)}ti.prototype.pipe=function(){Gp(this,new CNe)};function MNe(t,e){var r=new DNe;Gp(t,r),process.nextTick(e,r)}function LNe(t,e,r,i){var n;return r===null?n=new kNe:typeof r!="string"&&!e.objectMode&&(n=new TNe("chunk",["string","Buffer"],r)),n?(Gp(t,n),process.nextTick(i,n),!1):!0}ti.prototype.write=function(t,e,r){var i=this._writableState,n=!1,s=!i.objectMode&&xNe(t);return s&&!X5.isBuffer(t)&&(t=SNe(t)),typeof e=="function"&&(r=e,e=null),s?e="buffer":e||(e=i.defaultEncoding),typeof r!="function"&&(r=NNe),i.ending?MNe(this,r):(s||LNe(this,i,t,r))&&(i.pendingcb++,n=jNe(this,i,s,t,e,r)),n};ti.prototype.cork=function(){this._writableState.corked++};ti.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&Qte(this,t))};ti.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new BNe(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(ti.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function qNe(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=X5.from(e,r)),e}Object.defineProperty(ti.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function jNe(t,e,r,i,n,s){if(!r){var o=qNe(e,i,n);i!==o&&(r=!0,n="buffer",i=o)}var a=e.objectMode?1:i.length;e.length+=a;var c=e.length<e.highWaterMark;if(c||(e.needDrain=!0),e.writing||e.corked){var u=e.lastBufferedRequest;e.lastBufferedRequest={chunk:i,encoding:n,isBuf:r,callback:s,next:null},u?u.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else RI(t,e,!1,a,i,n,s);return c}function RI(t,e,r,i,n,s,o){e.writelen=i,e.writecb=o,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new ONe("write")):r?t._writev(n,e.onwrite):t._write(n,s,e.onwrite),e.sync=!1}function UNe(t,e,r,i,n){--e.pendingcb,r?(process.nextTick(n,i),process.nextTick(Wg,t,e),t._writableState.errorEmitted=!0,Gp(t,i)):(n(i),t._writableState.errorEmitted=!0,Gp(t,i),Wg(t,e))}function FNe(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}function KNe(t,e){var r=t._writableState,i=r.sync,n=r.writecb;if(typeof n!="function")throw new PNe;if(FNe(r),e)UNe(t,r,i,e,n);else{var s=Zte(r)||t.destroyed;!s&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&Qte(t,r),i?process.nextTick(Xte,t,r,s,n):Xte(t,r,s,n)}}function Xte(t,e,r,i){r||VNe(t,e),e.pendingcb--,i(),Wg(t,e)}function VNe(t,e){e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}function Qte(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var i=e.bufferedRequestCount,n=new Array(i),s=e.corkedRequestsFree;s.entry=r;for(var o=0,a=!0;r;)n[o]=r,r.isBuf||(a=!1),r=r.next,o+=1;n.allBuffers=a,RI(t,e,!0,e.length,n,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new Wte(e),e.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,u=r.encoding,f=r.callback,d=e.objectMode?1:c.length;if(RI(t,e,!1,d,c,u,f),r=r.next,e.bufferedRequestCount--,e.writing)break}r===null&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}ti.prototype._write=function(t,e,r){r(new RNe("_write()"))};ti.prototype._writev=null;ti.prototype.end=function(t,e,r){var i=this._writableState;return typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null),t!=null&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||GNe(this,i,r),this};Object.defineProperty(ti.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function Zte(t){return t.ending&&t.length===0&&t.bufferedRequest===null&&!t.finished&&!t.writing}function zNe(t,e){t._final(function(r){e.pendingcb--,r&&Gp(t,r),e.prefinished=!0,t.emit("prefinish"),Wg(t,e)})}function HNe(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.pendingcb++,e.finalCalled=!0,process.nextTick(zNe,t,e)):(e.prefinished=!0,t.emit("prefinish")))}function Wg(t,e){var r=Zte(e);if(r&&(HNe(t,e),e.pendingcb===0&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return r}function GNe(t,e,r){e.ending=!0,Wg(t,e),r&&(e.finished?process.nextTick(r):t.once("finish",r)),e.ended=!0,t.writable=!1}function $Ne(t,e,r){var i=t.entry;for(t.entry=null;i;){var n=i.callback;e.pendingcb--,n(r),i=i.next}e.corkedRequestsFree.next=t}Object.defineProperty(ti.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(e){!this._writableState||(this._writableState.destroyed=e)}});ti.prototype.destroy=TI.destroy;ti.prototype._undestroy=TI.undestroy;ti.prototype._destroy=function(t,e){e(t)}});var Fd=m((g5t,tre)=>{l();"use strict";var WNe=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};tre.exports=mc;var ere=kI(),CI=PI();on()(mc,ere);for(OI=WNe(CI.prototype),Z5=0;Z5<OI.length;Z5++)J5=OI[Z5],mc.prototype[J5]||(mc.prototype[J5]=CI.prototype[J5]);var OI,J5,Z5;function mc(t){if(!(this instanceof mc))return new mc(t);ere.call(this,t),CI.call(this,t),this.allowHalfOpen=!0,t&&(t.readable===!1&&(this.readable=!1),t.writable===!1&&(this.writable=!1),t.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",YNe)))}Object.defineProperty(mc.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});Object.defineProperty(mc.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});Object.defineProperty(mc.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function YNe(){this._writableState.ended||process.nextTick(XNe,this)}function XNe(t){t.end()}Object.defineProperty(mc.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(e){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=e,this._writableState.destroyed=e)}})});var nre=m((DI,ire)=>{l();var e8=Ht(),bu=e8.Buffer;function rre(t,e){for(var r in t)e[r]=t[r]}bu.from&&bu.alloc&&bu.allocUnsafe&&bu.allocUnsafeSlow?ire.exports=e8:(rre(e8,DI),DI.Buffer=$p);function $p(t,e,r){return bu(t,e,r)}rre(bu,$p);$p.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return bu(t,e,r)};$p.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var i=bu(t);return e!==void 0?typeof r=="string"?i.fill(e,r):i.fill(e):i.fill(0),i};$p.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return bu(t)};$p.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return e8.SlowBuffer(t)}});var MI=m(ore=>{l();"use strict";var BI=nre().Buffer,sre=BI.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function QNe(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function ZNe(t){var e=QNe(t);if(typeof e!="string"&&(BI.isEncoding===sre||!sre(t)))throw new Error("Unknown encoding: "+t);return e||t}ore.StringDecoder=Yg;function Yg(t){this.encoding=ZNe(t);var e;switch(this.encoding){case"utf16le":this.text=nMe,this.end=sMe,e=4;break;case"utf8":this.fillLast=tMe,e=4;break;case"base64":this.text=oMe,this.end=aMe,e=3;break;default:this.write=cMe,this.end=uMe;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=BI.allocUnsafe(e)}Yg.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""};Yg.prototype.end=iMe;Yg.prototype.text=rMe;Yg.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length};function NI(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function JNe(t,e,r){var i=e.length-1;if(i<r)return 0;var n=NI(e[i]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--i<r||n===-2?0:(n=NI(e[i]),n>=0?(n>0&&(t.lastNeed=n-2),n):--i<r||n===-2?0:(n=NI(e[i]),n>=0?(n>0&&(n===2?n=0:t.lastNeed=n-3),n):0))}function eMe(t,e,r){if((e[0]&192)!=128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!=128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!=128)return t.lastNeed=2,"\uFFFD"}}function tMe(t){var e=this.lastTotal-this.lastNeed,r=eMe(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function rMe(t,e){var r=JNe(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)}function iMe(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function nMe(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function sMe(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function oMe(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function aMe(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function cMe(t){return t.toString(this.encoding)}function uMe(t){return t&&t.length?this.write(t):""}});var t8=m((b5t,ure)=>{l();"use strict";var are=Ud().codes.ERR_STREAM_PREMATURE_CLOSE;function fMe(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];t.apply(this,i)}}}function lMe(){}function dMe(t){return t.setHeader&&typeof t.abort=="function"}function cre(t,e,r){if(typeof e=="function")return cre(t,null,e);e||(e={}),r=fMe(r||lMe);var i=e.readable||e.readable!==!1&&t.readable,n=e.writable||e.writable!==!1&&t.writable,s=function(){t.writable||a()},o=t._writableState&&t._writableState.finished,a=function(){n=!1,o=!0,i||r.call(t)},c=t._readableState&&t._readableState.endEmitted,u=function(){i=!1,c=!0,n||r.call(t)},f=function(y){r.call(t,y)},d=function(){var y;if(i&&!c)return(!t._readableState||!t._readableState.ended)&&(y=new are),r.call(t,y);if(n&&!o)return(!t._writableState||!t._writableState.ended)&&(y=new are),r.call(t,y)},h=function(){t.req.on("finish",a)};return dMe(t)?(t.on("complete",a),t.on("abort",d),t.req?h():t.on("request",h)):n&&!t._writableState&&(t.on("end",s),t.on("close",s)),t.on("end",u),t.on("finish",a),e.error!==!1&&t.on("error",f),t.on("close",d),function(){t.removeListener("complete",a),t.removeListener("abort",d),t.removeListener("request",h),t.req&&t.req.removeListener("finish",a),t.removeListener("end",s),t.removeListener("close",s),t.removeListener("finish",a),t.removeListener("end",u),t.removeListener("error",f),t.removeListener("close",d)}}ure.exports=cre});var lre=m((v5t,fre)=>{l();"use strict";var r8;function Qf(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var hMe=t8(),Zf=Symbol("lastResolve"),Kd=Symbol("lastReject"),Xg=Symbol("error"),i8=Symbol("ended"),Vd=Symbol("lastPromise"),LI=Symbol("handlePromise"),zd=Symbol("stream");function Jf(t,e){return{value:t,done:e}}function pMe(t){var e=t[Zf];if(e!==null){var r=t[zd].read();r!==null&&(t[Vd]=null,t[Zf]=null,t[Kd]=null,e(Jf(r,!1)))}}function yMe(t){process.nextTick(pMe,t)}function gMe(t,e){return function(r,i){t.then(function(){if(e[i8]){r(Jf(void 0,!0));return}e[LI](r,i)},i)}}var mMe=Object.getPrototypeOf(function(){}),bMe=Object.setPrototypeOf((r8={get stream(){return this[zd]},next:function(){var e=this,r=this[Xg];if(r!==null)return Promise.reject(r);if(this[i8])return Promise.resolve(Jf(void 0,!0));if(this[zd].destroyed)return new Promise(function(o,a){process.nextTick(function(){e[Xg]?a(e[Xg]):o(Jf(void 0,!0))})});var i=this[Vd],n;if(i)n=new Promise(gMe(i,this));else{var s=this[zd].read();if(s!==null)return Promise.resolve(Jf(s,!1));n=new Promise(this[LI])}return this[Vd]=n,n}},Qf(r8,Symbol.asyncIterator,function(){return this}),Qf(r8,"return",function(){var e=this;return new Promise(function(r,i){e[zd].destroy(null,function(n){if(n){i(n);return}r(Jf(void 0,!0))})})}),r8),mMe),vMe=function(e){var r,i=Object.create(bMe,(r={},Qf(r,zd,{value:e,writable:!0}),Qf(r,Zf,{value:null,writable:!0}),Qf(r,Kd,{value:null,writable:!0}),Qf(r,Xg,{value:null,writable:!0}),Qf(r,i8,{value:e._readableState.endEmitted,writable:!0}),Qf(r,LI,{value:function(s,o){var a=i[zd].read();a?(i[Vd]=null,i[Zf]=null,i[Kd]=null,s(Jf(a,!1))):(i[Zf]=s,i[Kd]=o)},writable:!0}),r));return i[Vd]=null,hMe(e,function(n){if(n&&n.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=i[Kd];s!==null&&(i[Vd]=null,i[Zf]=null,i[Kd]=null,s(n)),i[Xg]=n;return}var o=i[Zf];o!==null&&(i[Vd]=null,i[Zf]=null,i[Kd]=null,o(Jf(void 0,!0))),i[i8]=!0}),e.on("readable",yMe.bind(null,i)),i};fre.exports=vMe});var hre=m((w5t,dre)=>{l();dre.exports=function(){throw new Error("Readable.from is not available in the browser")}});var kI=m((E5t,Sre)=>{l();"use strict";Sre.exports=Ft;var Wp;Ft.ReadableState=yre;var _5t=br().EventEmitter,pre=function(e,r){return e.listeners(r).length},Qg=wI(),n8=Ht().Buffer,wMe=globalThis.Uint8Array||function(){};function _Me(t){return n8.from(t)}function EMe(t){return n8.isBuffer(t)||t instanceof wMe}var qI=_I(),wt;qI&&qI.debuglog?wt=qI.debuglog("stream"):wt=function(){};var SMe=jte(),jI=xI(),xMe=AI(),AMe=xMe.getHighWaterMark,s8=Ud().codes,IMe=s8.ERR_INVALID_ARG_TYPE,TMe=s8.ERR_STREAM_PUSH_AFTER_EOF,RMe=s8.ERR_METHOD_NOT_IMPLEMENTED,PMe=s8.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Yp,UI,FI;on()(Ft,Qg);var Zg=jI.errorOrDestroy,KI=["error","close","destroy","pause","resume"];function CMe(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}function yre(t,e,r){Wp=Wp||Fd(),t=t||{},typeof r!="boolean"&&(r=e instanceof Wp),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=AMe(this,t,"readableHighWaterMark",r),this.buffer=new SMe,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(Yp||(Yp=MI().StringDecoder),this.decoder=new Yp(t.encoding),this.encoding=t.encoding)}function Ft(t){if(Wp=Wp||Fd(),!(this instanceof Ft))return new Ft(t);var e=this instanceof Wp;this._readableState=new yre(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),Qg.call(this)}Object.defineProperty(Ft.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){!this._readableState||(this._readableState.destroyed=e)}});Ft.prototype.destroy=jI.destroy;Ft.prototype._undestroy=jI.undestroy;Ft.prototype._destroy=function(t,e){e(t)};Ft.prototype.push=function(t,e){var r=this._readableState,i;return r.objectMode?i=!0:typeof t=="string"&&(e=e||r.defaultEncoding,e!==r.encoding&&(t=n8.from(t,e),e=""),i=!0),gre(this,t,e,!1,i)};Ft.prototype.unshift=function(t){return gre(this,t,null,!0,!1)};function gre(t,e,r,i,n){wt("readableAddChunk",e);var s=t._readableState;if(e===null)s.reading=!1,DMe(t,s);else{var o;if(n||(o=OMe(s,e)),o)Zg(t,o);else if(s.objectMode||e&&e.length>0)if(typeof e!="string"&&!s.objectMode&&Object.getPrototypeOf(e)!==n8.prototype&&(e=_Me(e)),i)s.endEmitted?Zg(t,new PMe):VI(t,s,e,!0);else if(s.ended)Zg(t,new TMe);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||e.length!==0?VI(t,s,e,!1):zI(t,s)):VI(t,s,e,!1)}else i||(s.reading=!1,zI(t,s))}return!s.ended&&(s.length<s.highWaterMark||s.length===0)}function VI(t,e,r,i){e.flowing&&e.length===0&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&o8(t)),zI(t,e)}function OMe(t,e){var r;return!EMe(e)&&typeof e!="string"&&e!==void 0&&!t.objectMode&&(r=new IMe("chunk",["string","Buffer","Uint8Array"],e)),r}Ft.prototype.isPaused=function(){return this._readableState.flowing===!1};Ft.prototype.setEncoding=function(t){Yp||(Yp=MI().StringDecoder);var e=new Yp(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,i="";r!==null;)i+=e.write(r.data),r=r.next;return this._readableState.buffer.clear(),i!==""&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var mre=1073741824;function kMe(t){return t>=mre?t=mre:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function bre(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=kMe(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}Ft.prototype.read=function(t){wt("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return wt("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?GI(this):o8(this),null;if(t=bre(t,e),t===0&&e.ended)return e.length===0&&GI(this),null;var i=e.needReadable;wt("need readable",i),(e.length===0||e.length-t<e.highWaterMark)&&(i=!0,wt("length less than watermark",i)),e.ended||e.reading?(i=!1,wt("reading or ended",i)):i&&(wt("do read"),e.reading=!0,e.sync=!0,e.length===0&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=bre(r,e)));var n;return t>0?n=_re(t,e):n=null,n===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&GI(this)),n!==null&&this.emit("data",n),n};function DMe(t,e){if(wt("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?o8(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,vre(t)))}}function o8(t){var e=t._readableState;wt("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(wt("emitReadable",e.flowing),e.emittedReadable=!0,process.nextTick(vre,t))}function vre(t){var e=t._readableState;wt("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,HI(t)}function zI(t,e){e.readingMore||(e.readingMore=!0,process.nextTick(BMe,t,e))}function BMe(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){var r=e.length;if(wt("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}Ft.prototype._read=function(t){Zg(this,new RMe("_read()"))};Ft.prototype.pipe=function(t,e){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t);break}i.pipesCount+=1,wt("pipe count=%d opts=%j",i.pipesCount,e);var n=(!e||e.end!==!1)&&t!==process.stdout&&t!==process.stderr,s=n?a:b;i.endEmitted?process.nextTick(s):r.once("end",s),t.on("unpipe",o);function o(E,v){wt("onunpipe"),E===r&&v&&v.hasUnpiped===!1&&(v.hasUnpiped=!0,f())}function a(){wt("onend"),t.end()}var c=NMe(r);t.on("drain",c);var u=!1;function f(){wt("cleanup"),t.removeListener("close",p),t.removeListener("finish",y),t.removeListener("drain",c),t.removeListener("error",h),t.removeListener("unpipe",o),r.removeListener("end",a),r.removeListener("end",b),r.removeListener("data",d),u=!0,i.awaitDrain&&(!t._writableState||t._writableState.needDrain)&&c()}r.on("data",d);function d(E){wt("ondata");var v=t.write(E);wt("dest.write",v),v===!1&&((i.pipesCount===1&&i.pipes===t||i.pipesCount>1&&Ere(i.pipes,t)!==-1)&&!u&&(wt("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function h(E){wt("onerror",E),b(),t.removeListener("error",h),pre(t,"error")===0&&Zg(t,E)}CMe(t,"error",h);function p(){t.removeListener("finish",y),b()}t.once("close",p);function y(){wt("onfinish"),t.removeListener("close",p),b()}t.once("finish",y);function b(){wt("unpipe"),r.unpipe(t)}return t.emit("pipe",r),i.flowing||(wt("pipe resume"),r.resume()),t};function NMe(t){return function(){var r=t._readableState;wt("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&pre(t,"data")&&(r.flowing=!0,HI(t))}}Ft.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s<n;s++)i[s].emit("unpipe",this,{hasUnpiped:!1});return this}var o=Ere(e.pipes,t);return o===-1?this:(e.pipes.splice(o,1),e.pipesCount-=1,e.pipesCount===1&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r),this)};Ft.prototype.on=function(t,e){var r=Qg.prototype.on.call(this,t,e),i=this._readableState;return t==="data"?(i.readableListening=this.listenerCount("readable")>0,i.flowing!==!1&&this.resume()):t==="readable"&&!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,wt("on readable",i.length,i.reading),i.length?o8(this):i.reading||process.nextTick(MMe,this)),r};Ft.prototype.addListener=Ft.prototype.on;Ft.prototype.removeListener=function(t,e){var r=Qg.prototype.removeListener.call(this,t,e);return t==="readable"&&process.nextTick(wre,this),r};Ft.prototype.removeAllListeners=function(t){var e=Qg.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&process.nextTick(wre,this),e};function wre(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function MMe(t){wt("readable nexttick read 0"),t.read(0)}Ft.prototype.resume=function(){var t=this._readableState;return t.flowing||(wt("resume"),t.flowing=!t.readableListening,LMe(this,t)),t.paused=!1,this};function LMe(t,e){e.resumeScheduled||(e.resumeScheduled=!0,process.nextTick(qMe,t,e))}function qMe(t,e){wt("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),HI(t),e.flowing&&!e.reading&&t.read(0)}Ft.prototype.pause=function(){return wt("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(wt("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function HI(t){var e=t._readableState;for(wt("flow",e.flowing);e.flowing&&t.read()!==null;);}Ft.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;t.on("end",function(){if(wt("wrapped end"),r.decoder&&!r.ended){var o=r.decoder.end();o&&o.length&&e.push(o)}e.push(null)}),t.on("data",function(o){if(wt("wrapped data"),r.decoder&&(o=r.decoder.write(o)),!(r.objectMode&&o==null)&&!(!r.objectMode&&(!o||!o.length))){var a=e.push(o);a||(i=!0,t.pause())}});for(var n in t)this[n]===void 0&&typeof t[n]=="function"&&(this[n]=function(a){return function(){return t[a].apply(t,arguments)}}(n));for(var s=0;s<KI.length;s++)t.on(KI[s],this.emit.bind(this,KI[s]));return this._read=function(o){wt("wrapped _read",o),i&&(i=!1,t.resume())},this};typeof Symbol=="function"&&(Ft.prototype[Symbol.asyncIterator]=function(){return UI===void 0&&(UI=lre()),UI(this)});Object.defineProperty(Ft.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});Object.defineProperty(Ft.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}});Object.defineProperty(Ft.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}});Ft._fromList=_re;Object.defineProperty(Ft.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function _re(t,e){if(e.length===0)return null;var r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function GI(t){var e=t._readableState;wt("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,process.nextTick(jMe,e,t))}function jMe(t,e){if(wt("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}typeof Symbol=="function"&&(Ft.from=function(t,e){return FI===void 0&&(FI=hre()),FI(Ft,t,e)});function Ere(t,e){for(var r=0,i=t.length;r<i;r++)if(t[r]===e)return r;return-1}});var $I=m((S5t,Are)=>{l();"use strict";Are.exports=vu;var a8=Ud().codes,UMe=a8.ERR_METHOD_NOT_IMPLEMENTED,FMe=a8.ERR_MULTIPLE_CALLBACK,KMe=a8.ERR_TRANSFORM_ALREADY_TRANSFORMING,VMe=a8.ERR_TRANSFORM_WITH_LENGTH_0,c8=Fd();on()(vu,c8);function zMe(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(i===null)return this.emit("error",new FMe);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}function vu(t){if(!(this instanceof vu))return new vu(t);c8.call(this,t),this._transformState={afterTransform:zMe.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",HMe)}function HMe(){var t=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(e,r){xre(t,e,r)}):xre(this,null,null)}vu.prototype.push=function(t,e){return this._transformState.needTransform=!1,c8.prototype.push.call(this,t,e)};vu.prototype._transform=function(t,e,r){r(new UMe("_transform()"))};vu.prototype._write=function(t,e,r){var i=this._transformState;if(i.writecb=r,i.writechunk=t,i.writeencoding=e,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}};vu.prototype._read=function(t){var e=this._transformState;e.writechunk!==null&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0};vu.prototype._destroy=function(t,e){c8.prototype._destroy.call(this,t,function(r){e(r)})};function xre(t,e,r){if(e)return t.emit("error",e);if(r!=null&&t.push(r),t._writableState.length)throw new VMe;if(t._transformState.transforming)throw new KMe;return t.push(null)}});var Rre=m((x5t,Tre)=>{l();"use strict";Tre.exports=Jg;var Ire=$I();on()(Jg,Ire);function Jg(t){if(!(this instanceof Jg))return new Jg(t);Ire.call(this,t)}Jg.prototype._transform=function(t,e,r){r(null,t)}});var Dre=m((A5t,kre)=>{l();"use strict";var WI;function GMe(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var Pre=Ud().codes,$Me=Pre.ERR_MISSING_ARGS,WMe=Pre.ERR_STREAM_DESTROYED;function Cre(t){if(t)throw t}function YMe(t){return t.setHeader&&typeof t.abort=="function"}function XMe(t,e,r,i){i=GMe(i);var n=!1;t.on("close",function(){n=!0}),WI===void 0&&(WI=t8()),WI(t,{readable:e,writable:r},function(o){if(o)return i(o);n=!0,i()});var s=!1;return function(o){if(!n&&!s){if(s=!0,YMe(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();i(o||new WMe("pipe"))}}}function Ore(t){t()}function QMe(t,e){return t.pipe(e)}function ZMe(t){return!t.length||typeof t[t.length-1]!="function"?Cre:t.pop()}function JMe(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var i=ZMe(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new $Me("streams");var n,s=e.map(function(o,a){var c=a<e.length-1,u=a>0;return XMe(o,c,u,function(f){n||(n=f),f&&s.forEach(Ore),!c&&(s.forEach(Ore),i(n))})});return e.reduce(QMe)}kre.exports=JMe});var YI=m((mo,Bre)=>{l();mo=Bre.exports=kI();mo.Stream=mo;mo.Readable=mo;mo.Writable=PI();mo.Duplex=Fd();mo.Transform=$I();mo.PassThrough=Rre();mo.finished=t8();mo.pipeline=Dre()});var Lre=m((I5t,Mre)=>{l();"use strict";var eLe=on(),{Readable:Nre}=YI();Mre.exports=Xp;eLe(Xp,Nre);function Xp(t,e){if(!(this instanceof Xp))return new Xp(t,e);e=e||{},Nre.call(this,Object.assign({},e,{objectMode:!0})),this._iterator=t,this._options=e,this.on("end",this.destroy.bind(this,null,null))}Xp.prototype._read=function(){this.destroyed||this._iterator.next((t,e,r)=>{if(!this.destroyed){if(t)return this.destroy(t);e===void 0&&r===void 0?this.push(null):this._options.keys!==!1&&this._options.values===!1?this.push(e):this._options.keys===!1&&this._options.values!==!1?this.push(r):this.push({key:e,value:r})}})};Xp.prototype._destroy=function(t,e){this._iterator.end(function(r){e(t||r)})}});var jre=m((qre,u8)=>{l();(function(t,e,r){typeof u8!="undefined"&&u8.exports?u8.exports=r():e[t]=r()})("prr",qre,function(){var t=typeof Object.defineProperty=="function"?function(i,n,s){return Object.defineProperty(i,n,s),i}:function(i,n,s){return i[n]=s.value,i},e=function(i,n){var s=typeof n=="object",o=!s&&typeof n=="string",a=function(c){return s?!!n[c]:o?n.indexOf(c[0])>-1:!1};return{enumerable:a("enumerable"),configurable:a("configurable"),writable:a("writable"),value:i}},r=function(i,n,s,o){var a;if(o=e(s,o),typeof n=="object"){for(a in n)Object.hasOwnProperty.call(n,a)&&(o.value=n[a],t(i,a,o));return i}return t(i,n,o)};return r})});var Kre=m((T5t,Fre)=>{l();var tLe=jre();function Ure(t,e,r){!!e&&typeof e!="string"&&(e=e.message||e.name),tLe(this,{type:t,name:t,cause:typeof e!="string"?e:r,message:e},"ewr")}function XI(t,e){Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),Ure.call(this,"CustomError",t,e)}XI.prototype=new Error;function rLe(t,e,r){var i=function(n,s){Ure.call(this,e,n,s),e=="FilesystemError"&&(this.code=this.cause.code,this.path=this.cause.path,this.errno=this.cause.errno,this.message=(t.errno[this.cause.errno]?t.errno[this.cause.errno].description:this.cause.message)+(this.cause.path?" ["+this.cause.path+"]":"")),Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,i)};return i.prototype=r?new r:new XI,i}Fre.exports=function(t){var e=function(r,i){return rLe(t,r,i)};return{CustomError:XI,FilesystemError:e("FilesystemError"),createError:e}}});var Vre=m((R5t,bc)=>{l();var iLe=bc.exports.all=[{errno:-2,code:"ENOENT",description:"no such file or directory"},{errno:-1,code:"UNKNOWN",description:"unknown error"},{errno:0,code:"OK",description:"success"},{errno:1,code:"EOF",description:"end of file"},{errno:2,code:"EADDRINFO",description:"getaddrinfo error"},{errno:3,code:"EACCES",description:"permission denied"},{errno:4,code:"EAGAIN",description:"resource temporarily unavailable"},{errno:5,code:"EADDRINUSE",description:"address already in use"},{errno:6,code:"EADDRNOTAVAIL",description:"address not available"},{errno:7,code:"EAFNOSUPPORT",description:"address family not supported"},{errno:8,code:"EALREADY",description:"connection already in progress"},{errno:9,code:"EBADF",description:"bad file descriptor"},{errno:10,code:"EBUSY",description:"resource busy or locked"},{errno:11,code:"ECONNABORTED",description:"software caused connection abort"},{errno:12,code:"ECONNREFUSED",description:"connection refused"},{errno:13,code:"ECONNRESET",description:"connection reset by peer"},{errno:14,code:"EDESTADDRREQ",description:"destination address required"},{errno:15,code:"EFAULT",description:"bad address in system call argument"},{errno:16,code:"EHOSTUNREACH",description:"host is unreachable"},{errno:17,code:"EINTR",description:"interrupted system call"},{errno:18,code:"EINVAL",description:"invalid argument"},{errno:19,code:"EISCONN",description:"socket is already connected"},{errno:20,code:"EMFILE",description:"too many open files"},{errno:21,code:"EMSGSIZE",description:"message too long"},{errno:22,code:"ENETDOWN",description:"network is down"},{errno:23,code:"ENETUNREACH",description:"network is unreachable"},{errno:24,code:"ENFILE",description:"file table overflow"},{errno:25,code:"ENOBUFS",description:"no buffer space available"},{errno:26,code:"ENOMEM",description:"not enough memory"},{errno:27,code:"ENOTDIR",description:"not a directory"},{errno:28,code:"EISDIR",description:"illegal operation on a directory"},{errno:29,code:"ENONET",description:"machine is not on the network"},{errno:31,code:"ENOTCONN",description:"socket is not connected"},{errno:32,code:"ENOTSOCK",description:"socket operation on non-socket"},{errno:33,code:"ENOTSUP",description:"operation not supported on socket"},{errno:34,code:"ENOENT",description:"no such file or directory"},{errno:35,code:"ENOSYS",description:"function not implemented"},{errno:36,code:"EPIPE",description:"broken pipe"},{errno:37,code:"EPROTO",description:"protocol error"},{errno:38,code:"EPROTONOSUPPORT",description:"protocol not supported"},{errno:39,code:"EPROTOTYPE",description:"protocol wrong type for socket"},{errno:40,code:"ETIMEDOUT",description:"connection timed out"},{errno:41,code:"ECHARSET",description:"invalid Unicode character"},{errno:42,code:"EAIFAMNOSUPPORT",description:"address family for hostname not supported"},{errno:44,code:"EAISERVICE",description:"servname not supported for ai_socktype"},{errno:45,code:"EAISOCKTYPE",description:"ai_socktype not supported"},{errno:46,code:"ESHUTDOWN",description:"cannot send after transport endpoint shutdown"},{errno:47,code:"EEXIST",description:"file already exists"},{errno:48,code:"ESRCH",description:"no such process"},{errno:49,code:"ENAMETOOLONG",description:"name too long"},{errno:50,code:"EPERM",description:"operation not permitted"},{errno:51,code:"ELOOP",description:"too many symbolic links encountered"},{errno:52,code:"EXDEV",description:"cross-device link not permitted"},{errno:53,code:"ENOTEMPTY",description:"directory not empty"},{errno:54,code:"ENOSPC",description:"no space left on device"},{errno:55,code:"EIO",description:"i/o error"},{errno:56,code:"EROFS",description:"read-only file system"},{errno:57,code:"ENODEV",description:"no such device"},{errno:58,code:"ESPIPE",description:"invalid seek"},{errno:59,code:"ECANCELED",description:"operation canceled"}];bc.exports.errno={};bc.exports.code={};iLe.forEach(function(t){bc.exports.errno[t.errno]=t,bc.exports.code[t.code]=t});bc.exports.custom=Kre()(bc.exports);bc.exports.create=bc.exports.custom.createError});var f8=m((P5t,zre)=>{l();"use strict";var Hd=Vre().create,Gd=Hd("LevelUPError"),QI=Hd("NotFoundError",Gd);QI.prototype.notFound=!0;QI.prototype.status=404;zre.exports={LevelUPError:Gd,InitializationError:Hd("InitializationError",Gd),OpenError:Hd("OpenError",Gd),ReadError:Hd("ReadError",Gd),WriteError:Hd("WriteError",Gd),NotFoundError:QI,EncodingError:Hd("EncodingError",Gd)}});var JI=m(ZI=>{l();"use strict";ZI.fromCallback=function(t){if(t===void 0){var e=new Promise(function(r,i){t=function(n,s){n?i(n):r(s)}});t.promise=e}return t};ZI.fromPromise=function(t,e){if(e===void 0)return t;t.then(function(r){process.nextTick(e,null,r)}).catch(function(r){process.nextTick(e,r)})}});var em=m(eT=>{l();"use strict";eT.getCallback=function(t,e){return typeof t=="function"?t:e};eT.getOptions=function(t){return typeof t=="object"&&t!==null?t:{}}});var Gre=m((k5t,Hre)=>{l();"use strict";var tm=f8().WriteError,nLe=JI(),sLe=em().getCallback,oLe=em().getOptions;function rm(t){this.db=t,this.batch=t.db.batch(),this.ops=[],this.length=0}rm.prototype.put=function(t,e,r){try{this.batch.put(t,e,r)}catch(i){throw new tm(i)}return this.ops.push({...r,type:"put",key:t,value:e}),this.length++,this};rm.prototype.del=function(t,e){try{this.batch.del(t,e)}catch(r){throw new tm(r)}return this.ops.push({...e,type:"del",key:t}),this.length++,this};rm.prototype.clear=function(){try{this.batch.clear()}catch(t){throw new tm(t)}return this.ops=[],this.length=0,this};rm.prototype.write=function(t,e){let r=this.db,i=this.ops;e=sLe(t,e),e=nLe.fromCallback(e),t=oLe(t);try{this.batch.write(t,function(n){if(n)return e(new tm(n));r.emit("batch",i),e()})}catch(n){throw new tm(n)}return e.promise};Hre.exports=rm});var Yre=m((D5t,Wre)=>{l();"use strict";var $re=H5();Wre.exports=function(t,...e){e.length===0?$re(t):$re(()=>t(...e))}});var Jre=m((B5t,Zre)=>{l();"use strict";var l8=br().EventEmitter,aLe=pte().inherits,Xre=Bte(),cLe=Lre(),uLe=Gre(),Qp=f8(),fLe=yI(),$d=JI(),im=em().getCallback,Zp=em().getOptions,d8=Yre(),h8=Qp.WriteError,Qre=Qp.ReadError,lLe=Qp.NotFoundError,dLe=Qp.OpenError,hLe=Qp.InitializationError;function wr(t,e,r){if(!(this instanceof wr))return new wr(t,e,r);let i;if(l8.call(this),this.setMaxListeners(1/0),typeof e=="function"&&(r=e,e={}),e=e||{},!t||typeof t!="object"){if(i=new hLe("First argument must be an abstract-leveldown compliant store"),typeof r=="function")return d8(r,i);throw i}if(typeof t.status!="string")throw new Error(".status required, old abstract-leveldown");this.options=Zp(e),this._db=t,this.db=new Xre(t),this.open(r||(n=>{n&&this.emit("error",n)})),this.supports=fLe(this.db.supports,{status:!1,deferredOpen:!0,openCallback:!0,promises:!0,streams:!0});for(let n of Object.keys(this.supports.additionalMethods))this[n]==null&&(this[n]=function(...s){return this.db[n](...s)})}wr.prototype.emit=l8.prototype.emit;wr.prototype.once=l8.prototype.once;aLe(wr,l8);wr.prototype.open=function(t,e){return typeof t=="function"&&(e=t,t=null),e=$d.fromCallback(e),t||(t=this.options),this.isOpen()?(d8(e,null,this),e.promise):this._isOpening()?(this.once("open",()=>{e(null,this)}),e.promise):(this.emit("opening"),this.db.open(t,r=>{if(r)return e(new dLe(r));this.db=this._db,e(null,this),this.emit("open"),this.emit("ready")}),e.promise)};wr.prototype.close=function(t){return t=$d.fromCallback(t),this.isOpen()?(this.db.close((e,...r)=>{this.emit("closed"),t(e,...r)}),this.emit("closing"),this.db=new Xre(this._db)):this.isClosed()?d8(t):this.db.status==="closing"?this.once("closed",t):this._isOpening()&&this.once("open",()=>{this.close(t)}),t.promise};wr.prototype.isOpen=function(){return this.db.status==="open"};wr.prototype._isOpening=function(){return this.db.status==="opening"};wr.prototype.isClosed=function(){return/^clos|new/.test(this.db.status)};wr.prototype.get=function(t,e,r){return r=im(e,r),r=$d.fromCallback(r),nm(this,r)||(e=Zp(e),this.db.get(t,e,function(i,n){if(i)return/notfound/i.test(i)||i.notFound?i=new lLe("Key not found in database ["+t+"]",i):i=new Qre(i),r(i);r(null,n)})),r.promise};wr.prototype.put=function(t,e,r,i){return i=im(r,i),i=$d.fromCallback(i),nm(this,i)||(r=Zp(r),this.db.put(t,e,r,n=>{if(n)return i(new h8(n));this.emit("put",t,e),i()})),i.promise};wr.prototype.del=function(t,e,r){return r=im(e,r),r=$d.fromCallback(r),nm(this,r)||(e=Zp(e),this.db.del(t,e,i=>{if(i)return r(new h8(i));this.emit("del",t),r()})),r.promise};wr.prototype.batch=function(t,e,r){return arguments.length?(typeof t=="function"?r=t:r=im(e,r),r=$d.fromCallback(r),nm(this,r)||(e=Zp(e),this.db.batch(t,e,i=>{if(i)return r(new h8(i));this.emit("batch",t),r()})),r.promise):new uLe(this)};wr.prototype.iterator=function(t){return this.db.iterator(t)};wr.prototype.clear=function(t,e){return e=im(t,e),t=Zp(t),e=$d.fromCallback(e),nm(this,e)||this.db.clear(t,r=>{if(r)return e(new h8(r));this.emit("clear",t),e()}),e.promise};wr.prototype.readStream=wr.prototype.createReadStream=function(t){return t=Object.assign({keys:!0,values:!0},t),typeof t.limit!="number"&&(t.limit=-1),new cLe(this.db.iterator(t),t)};wr.prototype.keyStream=wr.prototype.createKeyStream=function(t){return this.createReadStream(Object.assign({},t,{keys:!0,values:!1}))};wr.prototype.valueStream=wr.prototype.createValueStream=function(t){return this.createReadStream(Object.assign({},t,{keys:!1,values:!0}))};wr.prototype.toString=function(){return"LevelUP"};wr.prototype.type="levelup";function nm(t,e){if(!t._isOpening()&&!t.isOpen())return d8(e,new Qre("Database is not open")),!0}wr.errors=Qp;Zre.exports=wr});var eie=m(wu=>{l();"use strict";var{Buffer:tT}=Ht();wu.utf8=wu["utf-8"]={encode:function(t){return rT(t)?t:String(t)},decode:p8,buffer:!1,type:"utf8"};wu.json={encode:JSON.stringify,decode:JSON.parse,buffer:!1,type:"json"};wu.binary={encode:function(t){return rT(t)?t:tT.from(t)},decode:p8,buffer:!0,type:"binary"};wu.none={encode:p8,decode:p8,buffer:!1,type:"id"};wu.id=wu.none;var pLe=["hex","ascii","base64","ucs2","ucs-2","utf16le","utf-16le"];for(let t of pLe)wu[t]={encode:function(e){return rT(e)?e:tT.from(e,t)},decode:function(e){return e.toString(t)},buffer:!0,type:t};function p8(t){return t}function rT(t){return t==null||tT.isBuffer(t)}});var rie=m((M5t,tie)=>{l();"use strict";var iT=eie(),yLe=new Set(["lt","gt","lte","gte"]);tie.exports=zn;function zn(t){if(!(this instanceof zn))return new zn(t);this.opts=t||{},this.encodings=iT}zn.prototype._encoding=function(t){return typeof t=="string"&&(t=iT[t]),t||(t=iT.id),t};zn.prototype._keyEncoding=function(t,e){return this._encoding(e&&e.keyEncoding||t&&t.keyEncoding||this.opts.keyEncoding)};zn.prototype._valueEncoding=function(t,e){return this._encoding(e&&(e.valueEncoding||e.encoding)||t&&(t.valueEncoding||t.encoding)||this.opts.valueEncoding||this.opts.encoding)};zn.prototype.encodeKey=function(t,e,r){return this._keyEncoding(e,r).encode(t)};zn.prototype.encodeValue=function(t,e,r){return this._valueEncoding(e,r).encode(t)};zn.prototype.decodeKey=function(t,e){return this._keyEncoding(e).decode(t)};zn.prototype.decodeValue=function(t,e){return this._valueEncoding(e).decode(t)};zn.prototype.encodeBatch=function(t,e){return t.map(r=>{let i={type:r.type,key:this.encodeKey(r.key,e,r)};return this.keyAsBuffer(e,r)&&(i.keyEncoding="binary"),r.prefix&&(i.prefix=r.prefix),"value"in r&&(i.value=this.encodeValue(r.value,e,r),this.valueAsBuffer(e,r)&&(i.valueEncoding="binary")),i})};zn.prototype.encodeLtgt=function(t){let e={};for(let r of Object.keys(t)){if(r==="start"||r==="end")throw new Error('Legacy range options ("start" and "end") have been removed');e[r]=yLe.has(r)?this.encodeKey(t[r],t):t[r]}return e};zn.prototype.createStreamDecoder=function(t){return t.keys&&t.values?(e,r)=>({key:this.decodeKey(e,t),value:this.decodeValue(r,t)}):t.keys?e=>this.decodeKey(e,t):t.values?(e,r)=>this.decodeValue(r,t):function(){}};zn.prototype.keyAsBuffer=function(t){return this._keyEncoding(t).buffer};zn.prototype.valueAsBuffer=function(t){return this._valueEncoding(t).buffer}});var cie=m((L5t,aie)=>{l();"use strict";var iie=Yf().AbstractLevelDOWN,nie=Yf().AbstractChainedBatch,sie=Yf().AbstractIterator,nT=on(),gLe=rie(),oie=f8().EncodingError,mLe=["approximateSize","compactRange"];aie.exports=Pn;function Pn(t,e){if(!(this instanceof Pn))return new Pn(t,e);let r=t.supports||{},i=r.additionalMethods||{};iie.call(this,r),this.supports.encodings=!0,this.supports.additionalMethods={},mLe.forEach(function(n){let s=typeof t[n]=="function";(i[n]||s)&&(this.supports.additionalMethods[n]=!0,this[n]=function(o,a,c,u){return o=this.codec.encodeKey(o,c),a=this.codec.encodeKey(a,c),this.db[n](o,a,c,u)})},this),e=e||{},typeof e.keyEncoding=="undefined"&&(e.keyEncoding="utf8"),typeof e.valueEncoding=="undefined"&&(e.valueEncoding="utf8"),this.db=t,this.codec=new gLe(e)}nT(Pn,iie);Pn.prototype.type="encoding-down";Pn.prototype._serializeKey=Pn.prototype._serializeValue=function(t){return t};Pn.prototype._open=function(t,e){this.db.open(t,e)};Pn.prototype._close=function(t){this.db.close(t)};Pn.prototype._put=function(t,e,r,i){t=this.codec.encodeKey(t,r),e=this.codec.encodeValue(e,r),this.db.put(t,e,r,i)};Pn.prototype._get=function(t,e,r){t=this.codec.encodeKey(t,e),e.asBuffer=this.codec.valueAsBuffer(e),this.db.get(t,e,(i,n)=>{if(i)return r(i);try{n=this.codec.decodeValue(n,e)}catch(s){return r(new oie(s))}r(null,n)})};Pn.prototype._del=function(t,e,r){t=this.codec.encodeKey(t,e),this.db.del(t,e,r)};Pn.prototype._chainedBatch=function(){return new Jp(this)};Pn.prototype._batch=function(t,e,r){t=this.codec.encodeBatch(t,e),this.db.batch(t,e,r)};Pn.prototype._iterator=function(t){return t.keyAsBuffer=this.codec.keyAsBuffer(t),t.valueAsBuffer=this.codec.valueAsBuffer(t),new sm(this,t)};Pn.prototype._clear=function(t,e){t=this.codec.encodeLtgt(t),this.db.clear(t,e)};function sm(t,e){sie.call(this,t),this.codec=t.codec,this.keys=e.keys,this.values=e.values,this.opts=this.codec.encodeLtgt(e),this.it=t.db.iterator(this.opts)}nT(sm,sie);sm.prototype._next=function(t){this.it.next((e,r,i)=>{if(e)return t(e);try{this.keys&&typeof r!="undefined"?r=this.codec.decodeKey(r,this.opts):r=void 0,this.values&&typeof i!="undefined"?i=this.codec.decodeValue(i,this.opts):i=void 0}catch(n){return t(new oie(n))}t(null,r,i)})};sm.prototype._seek=function(t){t=this.codec.encodeKey(t,this.opts),this.it.seek(t)};sm.prototype._end=function(t){this.it.end(t)};function Jp(t,e){nie.call(this,t),this.codec=t.codec,this.batch=t.db.batch()}nT(Jp,nie);Jp.prototype._put=function(t,e,r){t=this.codec.encodeKey(t,r),e=this.codec.encodeValue(e,r),this.batch.put(t,e)};Jp.prototype._del=function(t,e){t=this.codec.encodeKey(t,e),this.batch.del(t)};Jp.prototype._clear=function(){this.batch.clear()};Jp.prototype._write=function(t,e){this.batch.write(t,e)}});var lie=m((q5t,fie)=>{l();"use strict";var uie=Jre(),bLe=cie();function vLe(t){function e(i,n,s){return typeof i=="function"?s=i:typeof n=="function"&&(s=n),r(n)||(n=r(i)?i:{}),uie(bLe(t(i,n),n),n,s)}function r(i){return typeof i=="object"&&i!==null}for(let i of["destroy","repair"])typeof t[i]=="function"&&(e[i]=function(...n){t[i](...n)});return e.errors=uie.errors,e}fie.exports=vLe});var hie=m(pi=>{l();pi.compare=function(t,e){if(Buffer.isBuffer(t)){for(var r=Math.min(t.length,e.length),i=0;i<r;i++){var n=t[i]-e[i];if(n)return n}return t.length-e.length}return t<e?-1:t>e?1:0};function die(t){return t!==void 0&&t!==""}function e1(t,e){return Object.hasOwnProperty.call(t,e)}function vc(t,e){return Object.hasOwnProperty.call(t,e)&&e}var wLe=pi.lowerBoundKey=function(t){return vc(t,"gt")||vc(t,"gte")||vc(t,"min")||(t.reverse?vc(t,"end"):vc(t,"start"))||void 0},sT=pi.lowerBound=function(t,e){var r=wLe(t);return r?t[r]:e},oT=pi.lowerBoundInclusive=function(t){return!e1(t,"gt")},aT=pi.upperBoundInclusive=function(t){return!e1(t,"lt")},_Le=pi.lowerBoundExclusive=function(t){return!oT(t)},ELe=pi.upperBoundExclusive=function(t){return!aT(t)},SLe=pi.upperBoundKey=function(t){return vc(t,"lt")||vc(t,"lte")||vc(t,"max")||(t.reverse?vc(t,"start"):vc(t,"end"))||void 0},cT=pi.upperBound=function(t,e){var r=SLe(t);return r?t[r]:e};pi.start=function(t,e){return t.reverse?cT(t,e):sT(t,e)};pi.end=function(t,e){return t.reverse?sT(t,e):cT(t,e)};pi.startInclusive=function(t){return t.reverse?aT(t):oT(t)};pi.endInclusive=function(t){return t.reverse?oT(t):aT(t)};function xLe(t){return t}pi.toLtgt=function(t,e,r,i,n){e=e||{},r=r||xLe;var s=arguments.length>3,o=pi.lowerBoundKey(t),a=pi.upperBoundKey(t);return o?o==="gt"?e.gt=r(t.gt,!1):e.gte=r(t[o],!1):s&&(e.gte=r(i,!1)),a?a==="lt"?e.lt=r(t.lt,!0):e.lte=r(t[a],!0):s&&(e.lte=r(n,!0)),t.reverse!=null&&(e.reverse=!!t.reverse),e1(e,"max")&&delete e.max,e1(e,"min")&&delete e.min,e1(e,"start")&&delete e.start,e1(e,"end")&&delete e.end,e};pi.contains=function(t,e,r){r=r||pi.compare;var i=sT(t);if(die(i)){var n=r(e,i);if(n<0||n===0&&_Le(t))return!1}var s=cT(t);if(die(s)){var n=r(e,s);if(n>0||n===0&&ELe(t))return!1}return!0};pi.filter=function(t,e){return function(r){return pi.contains(t,r,e)}}});var uT=m((U5t,pie)=>{l();"use strict";var y8=hie(),el=Symbol("none");pie.exports=function(e){let r=y8.lowerBound(e,el),i=y8.upperBound(e,el),n=y8.lowerBoundExclusive(e,el),s=y8.upperBoundExclusive(e,el);return r!==el&&i!==el?IDBKeyRange.bound(r,i,n,s):r!==el?IDBKeyRange.lowerBound(r,n):i!==el?IDBKeyRange.upperBound(i,s):null}});var fT=m((F5t,gie)=>{l();"use strict";var g8=Ht().Buffer,ALe=function(){if(globalThis.TextDecoder){let t=new TextDecoder("utf-8");return t.decode.bind(t)}else return function(e){return yie(e).toString()}}(),ILe=function(){if(globalThis.TextDecoder){let t=new TextDecoder("utf-8");return t.decode.bind(t)}else return function(e){return g8.from(e).toString()}}();function yie(t){let e=g8.from(t.buffer);return t.byteLength===t.buffer.byteLength?e:e.slice(t.byteOffset,t.byteOffset+t.byteLength)}gie.exports=function(t,e){return t instanceof Uint8Array?e?yie(t):ALe(t):t instanceof ArrayBuffer?e?g8.from(t):ILe(t):e?g8.from(String(t)):String(t)}});var wie=m((K5t,vie)=>{l();"use strict";var TLe=on(),mie=Yf().AbstractIterator,RLe=uT(),bie=fT(),PLe=function(){};vie.exports=ua;function ua(t,e,r){if(mie.call(this,t),this._limit=r.limit,this._count=0,this._callback=null,this._cache=[],this._completed=!1,this._aborted=!1,this._error=null,this._transaction=null,this._keys=r.keys,this._values=r.values,this._keyAsBuffer=r.keyAsBuffer,this._valueAsBuffer=r.valueAsBuffer,this._limit===0){this._completed=!0;return}let i;try{i=RLe(r)}catch(n){this._completed=!0;return}this.createIterator(e,i,r.reverse)}TLe(ua,mie);ua.prototype.createIterator=function(t,e,r){let i=this.db.db.transaction([t],"readonly"),s=i.objectStore(t).openCursor(e,r?"prev":"next");s.onsuccess=o=>{let a=o.target.result;a&&this.onItem(a)},this._transaction=i,i.onabort=()=>{this.onAbort(this._transaction.error||new Error("aborted by user"))},i.oncomplete=()=>{this.onComplete()}};ua.prototype.onItem=function(t){this._cache.push(t.key,t.value),(this._limit<=0||++this._count<this._limit)&&t.continue(),this.maybeNext()};ua.prototype.onAbort=function(t){this._aborted=!0,this._error=t,this.maybeNext()};ua.prototype.onComplete=function(){this._completed=!0,this.maybeNext()};ua.prototype.maybeNext=function(){this._callback&&(this._next(this._callback),this._callback=null)};ua.prototype._next=function(t){if(this._aborted){let e=this._error;this._error=null,this._nextTick(t,e)}else if(this._cache.length>0){let e=this._cache.shift(),r=this._cache.shift();this._keys&&e!==void 0?e=this._deserializeKey(e,this._keyAsBuffer):e=void 0,this._values&&r!==void 0?r=this._deserializeValue(r,this._valueAsBuffer):r=void 0,this._nextTick(t,null,e,r)}else this._completed?this._nextTick(t):this._callback=t};ua.prototype._deserializeKey=bie;ua.prototype._deserializeValue=bie;ua.prototype._end=function(t){if(this._aborted||this._completed)return this._nextTick(t,this._error);this.onItem=PLe,this.onAbort=t,this.onComplete=t}});var Sie=m((V5t,Eie)=>{l();"use strict";var _ie=Ht().Buffer,CLe=function(){if(globalThis.TextEncoder){let t=new TextEncoder("utf-8");return t.encode.bind(t)}else return _ie.from}();Eie.exports=function(t,e){return e?_ie.isBuffer(t)?t:CLe(String(t)):String(t)}});var xie=m(m8=>{l();"use strict";var OLe=Ht().Buffer;m8.test=function(t){return function(r){try{return r.cmp(t,0),!0}catch(i){return!1}}};m8.bufferKeys=m8.test(OLe.alloc(0))});var Iie=m((H5t,Aie)=>{l();"use strict";Aie.exports=function(e,r,i,n,s){if(n.limit===0)return e._nextTick(s);let o=e.db.transaction([r],"readwrite"),a=o.objectStore(r),c=0;o.oncomplete=function(){s()},o.onabort=function(){s(o.error||new Error("aborted by user"))};let u=a.openKeyCursor?"openKeyCursor":"openCursor",f=n.reverse?"prev":"next";a[u](i,f).onsuccess=function(d){let h=d.target.result;h&&(a.delete(h.key).onsuccess=function(){(n.limit<=0||++c<n.limit)&&h.continue()})}}});var Oie=m((G5t,Cie)=>{l();"use strict";Cie.exports=Bi;var Tie=Yf().AbstractLevelDOWN,kLe=on(),DLe=wie(),Rie=Sie(),lT=fT(),BLe=xie(),NLe=Iie(),MLe=uT(),Pie="level-js-";function Bi(t,e){if(!(this instanceof Bi))return new Bi(t,e);if(Tie.call(this,{bufferKeys:BLe.bufferKeys(indexedDB),snapshots:!0,permanence:!0,clear:!0}),e=e||{},typeof t!="string")throw new Error("constructor requires a location string argument");this.location=t,this.prefix=e.prefix==null?Pie:e.prefix,this.version=parseInt(e.version||1,10)}kLe(Bi,Tie);Bi.prototype.type="level-js";Bi.prototype._open=function(t,e){let r=indexedDB.open(this.prefix+this.location,this.version);r.onerror=function(){e(r.error||new Error("unknown error"))},r.onsuccess=()=>{this.db=r.result,e()},r.onupgradeneeded=i=>{let n=i.target.result;n.objectStoreNames.contains(this.location)||n.createObjectStore(this.location)}};Bi.prototype.store=function(t){return this.db.transaction([this.location],t).objectStore(this.location)};Bi.prototype.await=function(t,e){let r=t.transaction;r.onabort=function(){e(r.error||new Error("aborted by user"))},r.oncomplete=function(){e(null,t.result)}};Bi.prototype._get=function(t,e,r){let i=this.store("readonly"),n;try{n=i.get(t)}catch(s){return this._nextTick(r,s)}this.await(n,function(s,o){if(s)return r(s);if(o===void 0)return r(new Error("NotFound"));r(null,lT(o,e.asBuffer))})};Bi.prototype._del=function(t,e,r){let i=this.store("readwrite"),n;try{n=i.delete(t)}catch(s){return this._nextTick(r,s)}this.await(n,r)};Bi.prototype._put=function(t,e,r,i){let n=this.store("readwrite"),s;try{s=n.put(e,t)}catch(o){return this._nextTick(i,o)}this.await(s,i)};Bi.prototype._serializeKey=function(t){return Rie(t,this.supports.bufferKeys)};Bi.prototype._serializeValue=function(t){return Rie(t,!0)};Bi.prototype._iterator=function(t){return new DLe(this,this.location,t)};Bi.prototype._batch=function(t,e,r){if(t.length===0)return this._nextTick(r);let i=this.store("readwrite"),n=i.transaction,s=0,o;n.onabort=function(){r(o||n.error||new Error("aborted by user"))},n.oncomplete=function(){r()};function a(){let c=t[s++],u=c.key,f;try{f=c.type==="del"?i.delete(u):i.put(c.value,u)}catch(d){o=d,n.abort();return}s<t.length&&(f.onsuccess=a)}a()};Bi.prototype._clear=function(t,e){let r,i;try{r=MLe(t)}catch(n){return this._nextTick(e)}if(t.limit>=0)return NLe(this,this.location,r,t,e);try{let n=this.store("readwrite");i=r?n.delete(r):n.clear()}catch(n){return this._nextTick(e,n)}this.await(i,e)};Bi.prototype._close=function(t){this.db.close(),this._nextTick(t)};Bi.prototype.upgrade=function(t){if(this.status!=="open")return this._nextTick(t,new Error("cannot upgrade() before open()"));let e=this.iterator(),r={},i=this;e._deserializeKey=e._deserializeValue=a,n();function n(c){if(c)return o(c);e.next(s)}function s(c,u,f){if(c||u===void 0)return o(c);let d=i._serializeKey(lT(u,!0)),h=i._serializeValue(lT(f,!0));i._batch([{type:"del",key:u},{type:"put",key:d,value:h}],r,n)}function o(c){e.end(function(u){t(c||u)})}function a(c){return c}};Bi.destroy=function(t,e,r){typeof e=="function"&&(r=e,e=Pie);let i=indexedDB.deleteDatabase(e+t);i.onsuccess=function(){r()},i.onerror=function(n){r(n)}}});var Die=m(($5t,kie)=>{l();kie.exports=lie()(Oie())});var qie=m((Q5t,Lie)=>{l();"use strict";function Mie(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function qLe(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return Mie(t,r)}catch(i){r.message=t.message,r.stack=t.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(t)),Mie(new n,r)}}Lie.exports=qLe});var wT=m((d8t,zie)=>{l();"use strict";function Vie(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function FLe(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return Vie(t,r)}catch(i){r.message=t.message,r.stack=t.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(t)),Vie(new n,r)}}zie.exports=FLe});var _T=m((h8t,Wie)=>{l();"use strict";var Hie=()=>{},Gie=Symbol.for("@libp2p/js-interfaces/topology"),$ie=class{constructor({min:e=0,max:r=1/0,handlers:i={}}){this.min=e,this.max=r,this._onConnect=i.onConnect||Hie,this._onDisconnect=i.onDisconnect||Hie,this.peers=new Set}get[Symbol.toStringTag](){return"Topology"}get[Gie](){return!0}static isTopology(e){return Boolean(e&&e[Gie])}set registrar(e){this._registrar=e}disconnect(e){this._onDisconnect(e)}};Wie.exports=$ie});var b8=m((p8t,Qie)=>{l();"use strict";var KLe=_T(),Yie=Symbol.for("@libp2p/js-interfaces/topology/multicodec-topology"),Xie=class extends KLe{constructor({min:e,max:r,multicodecs:i,handlers:n}){super({min:e,max:r,handlers:n});if(!i)throw new Error("one or more multicodec should be provided");if(!n)throw new Error("the handlers should be provided");if(typeof n.onConnect!="function")throw new Error("the 'onConnect' handler must be provided");if(typeof n.onDisconnect!="function")throw new Error("the 'onDisconnect' handler must be provided");this.multicodecs=Array.isArray(i)?i:[i],this._registrar=void 0,this._onProtocolChange=this._onProtocolChange.bind(this),this._onPeerConnect=this._onPeerConnect.bind(this)}get[Symbol.toStringTag](){return"Topology"}get[Yie](){return!0}static isMulticodecTopology(e){return Boolean(e&&e[Yie])}set registrar(e){this._registrar=e,this._registrar.peerStore.on("change:protocols",this._onProtocolChange),this._registrar.connectionManager.on("peer:connect",this._onPeerConnect),this._updatePeers(this._registrar.peerStore.peers.values())}_updatePeers(e){for(let{id:r,protocols:i}of e)if(this.multicodecs.filter(n=>i.includes(n)).length){this.peers.add(r.toB58String());let n=this._registrar.getConnection(r);n&&this._onConnect(r,n)}else this.peers.delete(r.toB58String())}_onProtocolChange({peerId:e,protocols:r}){let i=this.peers.has(e.toB58String()),n=r.filter(s=>this.multicodecs.includes(s));i&&n.length===0&&this._onDisconnect(e);for(let s of r)if(this.multicodecs.includes(s)){let o=this._registrar.peerStore.get(e);this._updatePeers([o]);return}}_onPeerConnect(e){let r=e.remotePeer,i=this._registrar.peerStore.protoBook.get(r);!i||this.multicodecs.find(n=>i.includes(n))&&(this.peers.add(r.toB58String()),this._onConnect(r,e))}};Qie.exports=Xie});var v8=m(Zie=>{l();"use strict";Zie.codes={ERR_INVALID_SIGNATURE_POLICY:"ERR_INVALID_SIGNATURE_POLICY",ERR_UNHANDLED_SIGNATURE_POLICY:"ERR_UNHANDLED_SIGNATURE_POLICY",ERR_MISSING_SIGNATURE:"ERR_MISSING_SIGNATURE",ERR_MISSING_SEQNO:"ERR_MISSING_SEQNO",ERR_INVALID_SIGNATURE:"ERR_INVALID_SIGNATURE",ERR_UNEXPECTED_FROM:"ERR_UNEXPECTED_FROM",ERR_UNEXPECTED_SIGNATURE:"ERR_UNEXPECTED_SIGNATURE",ERR_UNEXPECTED_KEY:"ERR_UNEXPECTED_KEY",ERR_UNEXPECTED_SEQNO:"ERR_UNEXPECTED_SEQNO"}});var ST=m((g8t,Jie)=>{l();"use strict";var rl=Vi(),r1=rl.Reader,ET=rl.Writer,It=rl.util,Ni=rl.roots["libp2p-pubsub-rpc"]||(rl.roots["libp2p-pubsub-rpc"]={});Ni.RPC=function(){function t(e){if(this.subscriptions=[],this.msgs=[],e)for(var r=Object.keys(e),i=0;i<r.length;++i)e[r[i]]!=null&&(this[r[i]]=e[r[i]])}return t.prototype.subscriptions=It.emptyArray,t.prototype.msgs=It.emptyArray,t.encode=function(r,i){if(i||(i=ET.create()),r.subscriptions!=null&&r.subscriptions.length)for(var n=0;n<r.subscriptions.length;++n)Ni.RPC.SubOpts.encode(r.subscriptions[n],i.uint32(10).fork()).ldelim();if(r.msgs!=null&&r.msgs.length)for(var n=0;n<r.msgs.length;++n)Ni.RPC.Message.encode(r.msgs[n],i.uint32(18).fork()).ldelim();return i},t.decode=function(r,i){r instanceof r1||(r=r1.create(r));for(var n=i===void 0?r.len:r.pos+i,s=new Ni.RPC;r.pos<n;){var o=r.uint32();switch(o>>>3){case 1:s.subscriptions&&s.subscriptions.length||(s.subscriptions=[]),s.subscriptions.push(Ni.RPC.SubOpts.decode(r,r.uint32()));break;case 2:s.msgs&&s.msgs.length||(s.msgs=[]),s.msgs.push(Ni.RPC.Message.decode(r,r.uint32()));break;default:r.skipType(o&7);break}}return s},t.fromObject=function(r){if(r instanceof Ni.RPC)return r;var i=new Ni.RPC;if(r.subscriptions){if(!Array.isArray(r.subscriptions))throw TypeError(".RPC.subscriptions: array expected");i.subscriptions=[];for(var n=0;n<r.subscriptions.length;++n){if(typeof r.subscriptions[n]!="object")throw TypeError(".RPC.subscriptions: object expected");i.subscriptions[n]=Ni.RPC.SubOpts.fromObject(r.subscriptions[n])}}if(r.msgs){if(!Array.isArray(r.msgs))throw TypeError(".RPC.msgs: array expected");i.msgs=[];for(var n=0;n<r.msgs.length;++n){if(typeof r.msgs[n]!="object")throw TypeError(".RPC.msgs: object expected");i.msgs[n]=Ni.RPC.Message.fromObject(r.msgs[n])}}return i},t.toObject=function(r,i){i||(i={});var n={};if((i.arrays||i.defaults)&&(n.subscriptions=[],n.msgs=[]),r.subscriptions&&r.subscriptions.length){n.subscriptions=[];for(var s=0;s<r.subscriptions.length;++s)n.subscriptions[s]=Ni.RPC.SubOpts.toObject(r.subscriptions[s],i)}if(r.msgs&&r.msgs.length){n.msgs=[];for(var s=0;s<r.msgs.length;++s)n.msgs[s]=Ni.RPC.Message.toObject(r.msgs[s],i)}return n},t.prototype.toJSON=function(){return this.constructor.toObject(this,rl.util.toJSONOptions)},t.SubOpts=function(){function e(i){if(i)for(var n=Object.keys(i),s=0;s<n.length;++s)i[n[s]]!=null&&(this[n[s]]=i[n[s]])}e.prototype.subscribe=null,e.prototype.topicID=null;var r;return Object.defineProperty(e.prototype,"_subscribe",{get:It.oneOfGetter(r=["subscribe"]),set:It.oneOfSetter(r)}),Object.defineProperty(e.prototype,"_topicID",{get:It.oneOfGetter(r=["topicID"]),set:It.oneOfSetter(r)}),e.encode=function(n,s){return s||(s=ET.create()),n.subscribe!=null&&Object.hasOwnProperty.call(n,"subscribe")&&s.uint32(8).bool(n.subscribe),n.topicID!=null&&Object.hasOwnProperty.call(n,"topicID")&&s.uint32(18).string(n.topicID),s},e.decode=function(n,s){n instanceof r1||(n=r1.create(n));for(var o=s===void 0?n.len:n.pos+s,a=new Ni.RPC.SubOpts;n.pos<o;){var c=n.uint32();switch(c>>>3){case 1:a.subscribe=n.bool();break;case 2:a.topicID=n.string();break;default:n.skipType(c&7);break}}return a},e.fromObject=function(n){if(n instanceof Ni.RPC.SubOpts)return n;var s=new Ni.RPC.SubOpts;return n.subscribe!=null&&(s.subscribe=Boolean(n.subscribe)),n.topicID!=null&&(s.topicID=String(n.topicID)),s},e.toObject=function(n,s){s||(s={});var o={};return n.subscribe!=null&&n.hasOwnProperty("subscribe")&&(o.subscribe=n.subscribe,s.oneofs&&(o._subscribe="subscribe")),n.topicID!=null&&n.hasOwnProperty("topicID")&&(o.topicID=n.topicID,s.oneofs&&(o._topicID="topicID")),o},e.prototype.toJSON=function(){return this.constructor.toObject(this,rl.util.toJSONOptions)},e}(),t.Message=function(){function e(i){if(this.topicIDs=[],i)for(var n=Object.keys(i),s=0;s<n.length;++s)i[n[s]]!=null&&(this[n[s]]=i[n[s]])}e.prototype.from=null,e.prototype.data=null,e.prototype.seqno=null,e.prototype.topicIDs=It.emptyArray,e.prototype.signature=null,e.prototype.key=null;var r;return Object.defineProperty(e.prototype,"_from",{get:It.oneOfGetter(r=["from"]),set:It.oneOfSetter(r)}),Object.defineProperty(e.prototype,"_data",{get:It.oneOfGetter(r=["data"]),set:It.oneOfSetter(r)}),Object.defineProperty(e.prototype,"_seqno",{get:It.oneOfGetter(r=["seqno"]),set:It.oneOfSetter(r)}),Object.defineProperty(e.prototype,"_signature",{get:It.oneOfGetter(r=["signature"]),set:It.oneOfSetter(r)}),Object.defineProperty(e.prototype,"_key",{get:It.oneOfGetter(r=["key"]),set:It.oneOfSetter(r)}),e.encode=function(n,s){if(s||(s=ET.create()),n.from!=null&&Object.hasOwnProperty.call(n,"from")&&s.uint32(10).bytes(n.from),n.data!=null&&Object.hasOwnProperty.call(n,"data")&&s.uint32(18).bytes(n.data),n.seqno!=null&&Object.hasOwnProperty.call(n,"seqno")&&s.uint32(26).bytes(n.seqno),n.topicIDs!=null&&n.topicIDs.length)for(var o=0;o<n.topicIDs.length;++o)s.uint32(34).string(n.topicIDs[o]);return n.signature!=null&&Object.hasOwnProperty.call(n,"signature")&&s.uint32(42).bytes(n.signature),n.key!=null&&Object.hasOwnProperty.call(n,"key")&&s.uint32(50).bytes(n.key),s},e.decode=function(n,s){n instanceof r1||(n=r1.create(n));for(var o=s===void 0?n.len:n.pos+s,a=new Ni.RPC.Message;n.pos<o;){var c=n.uint32();switch(c>>>3){case 1:a.from=n.bytes();break;case 2:a.data=n.bytes();break;case 3:a.seqno=n.bytes();break;case 4:a.topicIDs&&a.topicIDs.length||(a.topicIDs=[]),a.topicIDs.push(n.string());break;case 5:a.signature=n.bytes();break;case 6:a.key=n.bytes();break;default:n.skipType(c&7);break}}return a},e.fromObject=function(n){if(n instanceof Ni.RPC.Message)return n;var s=new Ni.RPC.Message;if(n.from!=null&&(typeof n.from=="string"?It.base64.decode(n.from,s.from=It.newBuffer(It.base64.length(n.from)),0):n.from.length&&(s.from=n.from)),n.data!=null&&(typeof n.data=="string"?It.base64.decode(n.data,s.data=It.newBuffer(It.base64.length(n.data)),0):n.data.length&&(s.data=n.data)),n.seqno!=null&&(typeof n.seqno=="string"?It.base64.decode(n.seqno,s.seqno=It.newBuffer(It.base64.length(n.seqno)),0):n.seqno.length&&(s.seqno=n.seqno)),n.topicIDs){if(!Array.isArray(n.topicIDs))throw TypeError(".RPC.Message.topicIDs: array expected");s.topicIDs=[];for(var o=0;o<n.topicIDs.length;++o)s.topicIDs[o]=String(n.topicIDs[o])}return n.signature!=null&&(typeof n.signature=="string"?It.base64.decode(n.signature,s.signature=It.newBuffer(It.base64.length(n.signature)),0):n.signature.length&&(s.signature=n.signature)),n.key!=null&&(typeof n.key=="string"?It.base64.decode(n.key,s.key=It.newBuffer(It.base64.length(n.key)),0):n.key.length&&(s.key=n.key)),s},e.toObject=function(n,s){s||(s={});var o={};if((s.arrays||s.defaults)&&(o.topicIDs=[]),n.from!=null&&n.hasOwnProperty("from")&&(o.from=s.bytes===String?It.base64.encode(n.from,0,n.from.length):s.bytes===Array?Array.prototype.slice.call(n.from):n.from,s.oneofs&&(o._from="from")),n.data!=null&&n.hasOwnProperty("data")&&(o.data=s.bytes===String?It.base64.encode(n.data,0,n.data.length):s.bytes===Array?Array.prototype.slice.call(n.data):n.data,s.oneofs&&(o._data="data")),n.seqno!=null&&n.hasOwnProperty("seqno")&&(o.seqno=s.bytes===String?It.base64.encode(n.seqno,0,n.seqno.length):s.bytes===Array?Array.prototype.slice.call(n.seqno):n.seqno,s.oneofs&&(o._seqno="seqno")),n.topicIDs&&n.topicIDs.length){o.topicIDs=[];for(var a=0;a<n.topicIDs.length;++a)o.topicIDs[a]=n.topicIDs[a]}return n.signature!=null&&n.hasOwnProperty("signature")&&(o.signature=s.bytes===String?It.base64.encode(n.signature,0,n.signature.length):s.bytes===Array?Array.prototype.slice.call(n.signature):n.signature,s.oneofs&&(o._signature="signature")),n.key!=null&&n.hasOwnProperty("key")&&(o.key=s.bytes===String?It.base64.encode(n.key,0,n.key.length):s.bytes===Array?Array.prototype.slice.call(n.key):n.key,s.oneofs&&(o._key="key")),o},e.prototype.toJSON=function(){return this.constructor.toObject(this,rl.util.toJSONOptions)},e}(),t}();Jie.exports=Ni});var xT=m((m8t,rne)=>{l();"use strict";var ene=Es(),{Buffer:VLe}=Ht(),tne=(t,e,r)=>{let i=ene.encode(t,e,r);return tne.bytes=ene.encode.bytes,e||VLe.from(i)};rne.exports=tne});var cne=m((b8t,w8)=>{l();"use strict";var{Buffer:ine}=Ht(),nne=Rn(),sne=xT(),AT=8,one=10*1024;function ane(t){t=t||{};let e=Math.max(t.poolSize||one,t.minPoolSize||AT),r=t.lengthEncoder||sne;return async function*(n){let s=ine.alloc(e),o=0;for await(let a of n){r(a.length,s,o);let c=s.slice(o,o+r.bytes);o+=r.bytes,s.length-o<AT&&(s=ine.alloc(e),o=0),yield new nne().append(c).append(a)}}}ane.single=(t,e)=>{e=e||{};let r=e.lengthEncoder||sne;return new nne([r(t.length),t.slice()])};w8.exports=ane;w8.exports.MIN_POOL_SIZE=AT;w8.exports.DEFAULT_POOL_SIZE=one});var IT=m((v8t,lne)=>{l();"use strict";var une=Es(),{Buffer:zLe}=Ht(),HLe=t=>new Proxy({},{get:(e,r)=>r[0]==="l"?t[r]:t.get(parseInt(r))}),fne=t=>{let e=une.decode(zLe.isBuffer(t)?t:HLe(t));return fne.bytes=une.decode.bytes,e};lne.exports=fne});var yne=m((w8t,_8)=>{l();"use strict";var{Buffer:GLe}=Ht(),TT=Rn(),$Le=IT(),dne=8,hne=1024*1024*4,pne=GLe.alloc(0),il={LENGTH:"readLength",DATA:"readData"},WLe={[il.LENGTH]:(t,e,r,i)=>{e=e.append(t);let n;try{n=i.lengthDecoder(e)}catch(s){if(e.length>i.maxLengthLength)throw Object.assign(s,{message:"message length too long",code:"ERR_MSG_LENGTH_TOO_LONG"});if(s instanceof RangeError)return{mode:il.LENGTH,buffer:e,chunk:void 0,state:void 0,data:void 0};throw s}if(n>i.maxDataLength)throw Object.assign(new Error("message data too long"),{code:"ERR_MSG_DATA_TOO_LONG"});return t=e.shallowSlice(i.lengthDecoder.bytes),e=new TT,i.onLength&&i.onLength(n),n<=0?(i.onData&&i.onData(pne),{mode:il.LENGTH,chunk:t,buffer:e,data:pne}):{mode:il.DATA,chunk:t,buffer:e,state:{dataLength:n},data:void 0}},[il.DATA]:(t,e,r,i)=>{if(e=e.append(t),!r)throw new Error("state is required");if(e.length<r.dataLength)return{mode:il.DATA,buffer:e,state:r,chunk:void 0,data:void 0};let{dataLength:n}=r,s=e.shallowSlice(0,n),o=e.length>n?e.shallowSlice(n):void 0;return e=new TT,i.onData&&i.onData(s),{mode:il.LENGTH,chunk:o,buffer:e,state:void 0,data:s}}};function RT(t){t=t||{};let e={lengthDecoder:t.lengthDecoder||$Le,maxLengthLength:t.maxLengthLength||dne,maxDataLength:t.maxDataLength||hne,onLength:t.onLength,onData:t.onData};return async function*(i){let n=new TT,s=il.LENGTH,o;for await(let a of i){let c=a;for(;c;){let u=WLe[s](c,n,o,e);s=u.mode,c=u.chunk,n=u.buffer,o=u.state,u.data&&(yield u.data)}}if(n.length)throw Object.assign(new Error("unexpected end of input"),{code:"ERR_UNEXPECTED_EOF"})}}RT.fromReader=(t,e)=>{let r=1,i={[Symbol.asyncIterator](){return this},next:async()=>{try{return await t.next(r)}catch(s){if(s.code==="ERR_UNDER_READ")return{done:!0,value:null};throw s}finally{r=1}}};return RT({...e||{},onLength:s=>{r=s}})(i)};_8.exports=RT;_8.exports.MAX_LENGTH_LENGTH=dne;_8.exports.MAX_DATA_LENGTH=hne});var bne=m((_8t,mne)=>{l();"use strict";var{Buffer:YLe}=Ht(),gne=(t,e,r)=>(e=e||YLe.allocUnsafe(4),e.writeInt32BE(t,r),e);gne.bytes=4;mne.exports=gne});var _ne=m((E8t,wne)=>{l();"use strict";var vne=t=>{if(t.length<4)throw RangeError("Could not decode int32BE");return t.readInt32BE(0)};vne.bytes=4;wne.exports=vne});var fa=m(Xd=>{l();"use strict";Xd.encode=cne();Xd.decode=yne();Xd.varintEncode=xT();Xd.varintDecode=IT();Xd.int32BEEncode=bne();Xd.int32BEDecode=_ne()});var E8=m((x8t,Ene)=>{l();Ene.exports=function(e){if(e){if(typeof e[Symbol.iterator]=="function")return e[Symbol.iterator]();if(typeof e[Symbol.asyncIterator]=="function")return e[Symbol.asyncIterator]();if(typeof e.next=="function")return e}throw new Error("argument is not an iterator or iterable")}});var xne=m((I8t,Sne)=>{l();Sne.exports=class extends Error{constructor(e,r){super(e||"The operation was aborted");this.type="aborted",this.code=r||"ABORT_ERR"}}});var wc=m((T8t,Qd)=>{l();var XLe=E8(),PT=xne(),Ane=(t,e,r)=>CT(t,Array.isArray(e)?e:[{signal:e,options:r}]),CT=(t,e)=>{t=XLe(t),e=e.map(({signal:i,options:n})=>({signal:i,options:n||{}}));async function*r(){let i,n=()=>{i&&i()};for(let{signal:s}of e)s.addEventListener("abort",n);for(;;){let s;try{for(let{signal:a,options:c}of e)if(a.aborted){let{abortMessage:u,abortCode:f}=c;throw new PT(u,f)}let o=new Promise((a,c)=>{i=()=>{let{options:u}=e.find(({signal:h})=>h.aborted),{abortMessage:f,abortCode:d}=u;c(new PT(f,d))}});s=await Promise.race([o,t.next()]),i=null}catch(o){for(let{signal:u}of e)u.removeEventListener("abort",n);let a=e.find(({signal:u})=>u.aborted),c=o.type==="aborted"&&a;if(c&&a.options.onAbort&&await a.options.onAbort(t),typeof t.return=="function"&&await t.return(),c&&a.options.returnOnAbort)return;throw o}if(s.done)break;yield s.value}for(let{signal:s}of e)s.removeEventListener("abort",n)}return r()},Ine=(t,e,r)=>Tne(t,Array.isArray(e)?e:[{signal:e,options:r}]),Tne=(t,e)=>r=>t(CT(r,e)),QLe=(t,e,r)=>ZLe(t,Array.isArray(e)?e:[{signal:e,options:r}]),ZLe=(t,e)=>({sink:Tne(t.sink,e),source:CT(t.source,e)});Qd.exports=Ane;Qd.exports.AbortError=PT;Qd.exports.source=Ane;Qd.exports.sink=Ine;Qd.exports.transform=Ine;Qd.exports.duplex=QLe});var Dne=m((R8t,kne)=>{l();"use strict";var Rne=Ee(),JLe=Object.assign(Rne("libp2p-pubsub:peer-streams"),{error:Rne("libp2p-pubsub:peer-streams:err")}),{EventEmitter:eqe}=br(),Pne=fa(),tqe=nc(),{pipe:Cne}=Nr(),{source:rqe}=wc(),iqe=h0().default,One=class extends eqe{constructor({id:e,protocol:r}){super();this.id=e,this.protocol=r,this._rawOutboundStream=null,this._rawInboundStream=null,this._inboundAbortController=new iqe,this.outboundStream=null,this.inboundStream=null}get isReadable(){return Boolean(this.inboundStream)}get isWritable(){return Boolean(this.outboundStream)}write(e){if(!this.outboundStream){let r=this.id.toB58String();throw new Error("No writable connection to "+r)}this.outboundStream.push(e)}attachInboundStream(e){return this._rawInboundStream=e,this.inboundStream=rqe(Cne(this._rawInboundStream,Pne.decode()),this._inboundAbortController.signal,{returnOnAbort:!0}),this.emit("stream:inbound"),this.inboundStream}async attachOutboundStream(e){let r=this.outboundStream;this.outboundStream&&await this.outboundStream.end(),this._rawOutboundStream=e,this.outboundStream=tqe({onEnd:i=>{this._rawOutboundStream&&this._rawOutboundStream.reset&&this._rawOutboundStream.reset(),this._rawOutboundStream=null,this.outboundStream=null,i&&this.emit("close")}}),Cne(this.outboundStream,Pne.encode(),this._rawOutboundStream).catch(i=>{JLe.error(i)}),r||this.emit("stream:outbound")}close(){this.outboundStream&&this.outboundStream.end(),this.inboundStream&&this._inboundAbortController.abort(),this._rawOutboundStream=null,this.outboundStream=null,this._rawInboundStream=null,this.inboundStream=null,this.emit("close")}};kne.exports=One});var Nne=m(Bne=>{l();"use strict";var nqe={StrictSign:"StrictSign",StrictNoSign:"StrictNoSign"};Bne.SignaturePolicy=nqe});var OT=m((C8t,qne)=>{l();"use strict";var sqe=_y(),{toString:oqe}=(tt(),hr),{fromString:Mne}=(dt(),bi),Lne=it(),{sha256:aqe}=(di(),zs),cqe=()=>sqe(8),uqe=(t,e)=>{let r;t instanceof Uint8Array?r=Lne.createFromBytes(t).id:r=Lne.parse(t).id;let i=new Uint8Array(r.length+e.length);return i.set(r,0),i.set(e,r.length),i},fqe=t=>aqe.encode(t),lqe=(t,e)=>{let r;Array.isArray(e)?r=i=>e.indexOf(i)>-1:r=i=>e.has(i);for(let i of t)if(r(i))return!0;return!1},dqe=t=>Array.isArray(t)?t:[t],hqe=(t,e)=>{let r=Object.assign({},t);return t.from instanceof Uint8Array&&(r.from=oqe(t.from,"base58btc")),e&&(r.receivedFrom=e),r},pqe=t=>{let e=Object.assign({},t);return typeof t.from=="string"&&(e.from=Mne(t.from,"base58btc")),typeof t.data=="string"&&(e.data=Mne(t.data)),e};qne.exports={randomSeqno:cqe,msgId:uqe,noSignMsgId:fqe,anyMatch:lqe,ensureArray:dqe,normalizeInRpcMessage:hqe,normalizeOutRpcMessage:pqe}});var Vne=m((O8t,Kne)=>{l();"use strict";var kT=it(),{RPC:jne}=ST(),{concat:Une}=(mn(),$s),{fromString:yqe}=(dt(),bi),DT=yqe("libp2p-pubsub:"),{normalizeOutRpcMessage:gqe}=OT();async function mqe(t,e){let r=Une([DT,jne.Message.encode(gqe(e)).finish()]),i=await t.privKey.sign(r);return{...e,signature:i,key:t.pubKey.bytes}}async function bqe(t){if(!t.signature)throw new Error("Message must contain a signature to be verified");if(!t.from)throw new Error("Message must contain a from property to be verified");let e=Une([DT,jne.Message.encode({...t,from:kT.createFromB58String(t.from).toBytes(),signature:void 0,key:void 0}).finish()]);return(await Fne(t)).verify(e,t.signature)}async function Fne(t){if(!t.from)throw new Error("Could not get the public key from the originator id");let e=kT.createFromB58String(t.from);if(t.key){let r=await kT.createFromPubKey(t.key);if(r.equals(e))return r.pubKey;throw new Error("Public Key does not match the originator")}else{if(e.pubKey)return e.pubKey;throw new Error("Could not get the public key from the originator id")}}Kne.exports={messagePublicKey:Fne,signMessage:mqe,SignPrefix:DT,verifySignature:bqe}});var $ne=m((k8t,Gne)=>{l();"use strict";var zne=Ee(),{EventEmitter:vqe}=br(),us=wT(),{pipe:wqe}=Nr(),_qe=b8(),{codes:la}=v8(),{RPC:Hne}=ST(),Eqe=Dne(),{SignaturePolicy:Eu}=Nne(),nl=OT(),{signMessage:Sqe,verifySignature:xqe}=Vne(),S8=class extends vqe{constructor({debugName:e,multicodecs:r,libp2p:i,globalSignaturePolicy:n=Eu.StrictSign,canRelayMessage:s=!1,emitSelf:o=!1}){if(typeof e!="string")throw new Error("a debugname `string` is required");if(!r)throw new Error("multicodecs are required");if(!i)throw new Error("libp2p is required");super();if(this.log=Object.assign(zne(e),{err:zne(`${e}:error`)}),this.multicodecs=nl.ensureArray(r),this._libp2p=i,this.registrar=i.registrar,this.peerId=i.peerId,this.started=!1,this.topics=new Map,this.subscriptions=new Set,this.peers=new Map,!Eu[n])throw us(new Error("Invalid global signature policy"),la.ERR_INVALID_SIGNATURE_POLICY);this.globalSignaturePolicy=n,this.canRelayMessage=s,this.emitSelf=o,this.topicValidators=new Map,this._registrarId=void 0,this._onIncomingStream=this._onIncomingStream.bind(this),this._onPeerConnected=this._onPeerConnected.bind(this),this._onPeerDisconnected=this._onPeerDisconnected.bind(this)}start(){if(this.started)return;this.log("starting"),this.registrar.handle(this.multicodecs,this._onIncomingStream);let e=new _qe({multicodecs:this.multicodecs,handlers:{onConnect:this._onPeerConnected,onDisconnect:this._onPeerDisconnected}});this._registrarId=this.registrar.register(e),this.log("started"),this.started=!0}stop(){!this.started||(this.registrar.unregister(this._registrarId),this.log("stopping"),this.peers.forEach(e=>e.close()),this.peers=new Map,this.subscriptions=new Set,this.started=!1,this.log("stopped"))}_onIncomingStream({protocol:e,stream:r,connection:i}){let n=i.remotePeer,s=n.toB58String(),o=this._addPeer(n,e),a=o.attachInboundStream(r);this._processMessages(s,a,o)}async _onPeerConnected(e,r){let i=e.toB58String();this.log("connected",i);try{let{stream:n,protocol:s}=await r.newStream(this.multicodecs);await this._addPeer(e,s).attachOutboundStream(n)}catch(n){this.log.err(n)}this._sendSubscriptions(i,Array.from(this.subscriptions),!0)}_onPeerDisconnected(e,r){let i=e.toB58String();this.log("connection ended",i,r?r.message:""),this._removePeer(e)}_addPeer(e,r){let i=e.toB58String(),n=this.peers.get(i);if(n)return n;this.log("new peer",i);let s=new Eqe({id:e,protocol:r});return this.peers.set(i,s),s.once("close",()=>this._removePeer(e)),s}_removePeer(e){if(!e)return;let r=e.toB58String(),i=this.peers.get(r);if(!!i){i.removeAllListeners(),i.close(),this.log("delete peer",r),this.peers.delete(r);for(let n of this.topics.values())n.delete(r);return i}}async _processMessages(e,r,i){try{await wqe(r,async n=>{for await(let s of n){let o=s instanceof Uint8Array?s:s.slice(),a=this._decodeRpc(o);await this._processRpc(e,i,a)}})}catch(n){this._onPeerDisconnected(i.id,n)}}async _processRpc(e,r,i){this.log("rpc from",e);let n=i.subscriptions,s=i.msgs;if(n.length&&(n.forEach(o=>{this._processRpcSubOpt(e,o)}),this.emit("pubsub:subscription-change",r.id,n)),!this._acceptFrom(e))return this.log("received message from unacceptable peer %s",e),!1;if(s.length)for(let o of s){if(!(this.canRelayMessage||o.topicIDs&&o.topicIDs.some(c=>this.subscriptions.has(c)))){this.log("received message we didn't subscribe to. Dropping.");continue}let a=nl.normalizeInRpcMessage(o,e);await this._processRpcMessage(a)}return!0}_processRpcSubOpt(e,r){let i=r.topicID;if(!i)return;let n=this.topics.get(i);n||(n=new Set,this.topics.set(i,n)),r.subscribe?n.add(e):n.delete(e)}async _processRpcMessage(e){if(!(this.peerId.toB58String()===e.from&&!this.emitSelf)){try{await this.validate(e)}catch(r){this.log("Message is invalid, dropping it. %O",r);return}return this._emitMessage(e),this._publish(nl.normalizeOutRpcMessage(e))}}_emitMessage(e){e.topicIDs.forEach(r=>{this.subscriptions.has(r)&&this.emit(r,e)})}getMsgId(e){let r=this.globalSignaturePolicy;switch(r){case Eu.StrictSign:return nl.msgId(e.from,e.seqno);case Eu.StrictNoSign:return nl.noSignMsgId(e.data);default:throw us(new Error("Cannot get message id: unhandled signature policy: "+r),la.ERR_UNHANDLED_SIGNATURE_POLICY)}}_acceptFrom(e){return!0}_decodeRpc(e){return Hne.decode(e)}_encodeRpc(e){return Hne.encode(e).finish()}_sendRpc(e,r){let i=this.peers.get(e);if(!i||!i.isWritable){let n=`Cannot send RPC to ${e} as there is no open stream to it available`;this.log.err(n);return}i.write(this._encodeRpc(r))}_sendSubscriptions(e,r,i){return this._sendRpc(e,{subscriptions:r.map(n=>({topicID:n,subscribe:i}))})}async validate(e){let r=this.globalSignaturePolicy;switch(r){case Eu.StrictNoSign:if(e.from)throw us(new Error("StrictNoSigning: from should not be present"),la.ERR_UNEXPECTED_FROM);if(e.signature)throw us(new Error("StrictNoSigning: signature should not be present"),la.ERR_UNEXPECTED_SIGNATURE);if(e.key)throw us(new Error("StrictNoSigning: key should not be present"),la.ERR_UNEXPECTED_KEY);if(e.seqno)throw us(new Error("StrictNoSigning: seqno should not be present"),la.ERR_UNEXPECTED_SEQNO);break;case Eu.StrictSign:if(!e.signature)throw us(new Error("StrictSigning: Signing required and no signature was present"),la.ERR_MISSING_SIGNATURE);if(!e.seqno)throw us(new Error("StrictSigning: Signing required and no seqno was present"),la.ERR_MISSING_SEQNO);if(!await xqe(e))throw us(new Error("StrictSigning: Invalid message signature"),la.ERR_INVALID_SIGNATURE);break;default:throw us(new Error("Cannot validate message: unhandled signature policy: "+r),la.ERR_UNHANDLED_SIGNATURE_POLICY)}for(let i of e.topicIDs){let n=this.topicValidators.get(i);n&&await n(i,e)}}_buildMessage(e){let r=this.globalSignaturePolicy;switch(r){case Eu.StrictSign:return e.from=this.peerId.toB58String(),e.seqno=nl.randomSeqno(),Sqe(this.peerId,e);case Eu.StrictNoSign:return Promise.resolve(e);default:throw us(new Error("Cannot build message: unhandled signature policy: "+r),la.ERR_UNHANDLED_SIGNATURE_POLICY)}}getSubscribers(e){if(!this.started)throw us(new Error("not started yet"),"ERR_NOT_STARTED_YET");if(!e||typeof e!="string")throw us(new Error("a string topic must be provided"),"ERR_NOT_VALID_TOPIC");let r=this.topics.get(e);return r?Array.from(r):[]}async publish(e,r){if(!this.started)throw new Error("Pubsub has not started");this.log("publish",e,r);let n={receivedFrom:this.peerId.toB58String(),data:r,topicIDs:[e]},s=await this._buildMessage(n),o=nl.normalizeInRpcMessage(s);this.emitSelf&&this._emitMessage(o),await this._publish(o)}_publish(e){throw us(new Error("publish must be implemented by the subclass"),"ERR_NOT_IMPLEMENTED")}subscribe(e){if(!this.started)throw new Error("Pubsub has not started");this.subscriptions.has(e)||(this.subscriptions.add(e),this.peers.forEach((r,i)=>this._sendSubscriptions(i,[e],!0)))}unsubscribe(e){if(!this.started)throw new Error("Pubsub is not started");this.subscriptions.has(e)&&this.listenerCount(e)===0&&(this.subscriptions.delete(e),this.peers.forEach((r,i)=>this._sendSubscriptions(i,[e],!1)))}getTopics(){if(!this.started)throw new Error("Pubsub is not started");return Array.from(this.subscriptions)}};S8.utils=nl;S8.SignaturePolicy=Eu;Gne.exports=S8});var Wne=m(x8=>{l();"use strict";Object.defineProperty(x8,"__esModule",{value:!0});x8.createGossipRpc=void 0;function Aqe(t=[],e={}){return{subscriptions:[],msgs:t,control:Object.assign({ihave:[],iwant:[],graft:[],prune:[]},e)}}x8.createGossipRpc=Aqe});var Yne=m(A8=>{l();"use strict";Object.defineProperty(A8,"__esModule",{value:!0});A8.shuffle=void 0;function Iqe(t){if(t.length<=1)return t;let e=()=>Math.floor(Math.random()*Math.floor(t.length));for(let r=0;r<t.length;r++){let i=e(),n=t[r];t[r]=t[i],t[i]=n}return t}A8.shuffle=Iqe});var Zd=m(Oe=>{l();"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.ERR_TOPIC_VALIDATOR_IGNORE=Oe.ERR_TOPIC_VALIDATOR_REJECT=Oe.TimeCacheDuration=Oe.GossipsubIWantFollowupTime=Oe.GossipsubMaxIHaveMessages=Oe.GossipsubMaxIHaveLength=Oe.GossipsubGraftFloodThreshold=Oe.GossipsubOpportunisticGraftPeers=Oe.GossipsubOpportunisticGraftTicks=Oe.GossipsubDirectConnectInitialDelay=Oe.GossipsubDirectConnectTicks=Oe.GossipsubConnectionTimeout=Oe.GossipsubMaxPendingConnections=Oe.GossipsubConnectors=Oe.GossipsubPruneBackoffTicks=Oe.GossipsubPruneBackoff=Oe.GossipsubPrunePeers=Oe.GossipsubFanoutTTL=Oe.GossipsubHeartbeatInterval=Oe.GossipsubHeartbeatInitialDelay=Oe.GossipsubGossipRetransmission=Oe.GossipsubGossipFactor=Oe.GossipsubDlazy=Oe.GossipsubHistoryGossip=Oe.GossipsubHistoryLength=Oe.GossipsubDout=Oe.GossipsubDscore=Oe.GossipsubDhi=Oe.GossipsubDlo=Oe.GossipsubD=Oe.GossipsubIDv11=Oe.GossipsubIDv10=Oe.FloodsubID=Oe.minute=Oe.second=void 0;Oe.second=1e3;Oe.minute=60*Oe.second;Oe.FloodsubID="/floodsub/1.0.0";Oe.GossipsubIDv10="/meshsub/1.0.0";Oe.GossipsubIDv11="/meshsub/1.1.0";Oe.GossipsubD=6;Oe.GossipsubDlo=4;Oe.GossipsubDhi=12;Oe.GossipsubDscore=4;Oe.GossipsubDout=2;Oe.GossipsubHistoryLength=5;Oe.GossipsubHistoryGossip=3;Oe.GossipsubDlazy=6;Oe.GossipsubGossipFactor=.25;Oe.GossipsubGossipRetransmission=3;Oe.GossipsubHeartbeatInitialDelay=100;Oe.GossipsubHeartbeatInterval=Oe.second;Oe.GossipsubFanoutTTL=Oe.minute;Oe.GossipsubPrunePeers=16;Oe.GossipsubPruneBackoff=Oe.minute;Oe.GossipsubPruneBackoffTicks=15;Oe.GossipsubConnectors=8;Oe.GossipsubMaxPendingConnections=128;Oe.GossipsubConnectionTimeout=30*Oe.second;Oe.GossipsubDirectConnectTicks=300;Oe.GossipsubDirectConnectInitialDelay=Oe.second;Oe.GossipsubOpportunisticGraftTicks=60;Oe.GossipsubOpportunisticGraftPeers=2;Oe.GossipsubGraftFloodThreshold=10*Oe.second;Oe.GossipsubMaxIHaveLength=5e3;Oe.GossipsubMaxIHaveMessages=10;Oe.GossipsubIWantFollowupTime=3*Oe.second;Oe.TimeCacheDuration=120*1e3;Oe.ERR_TOPIC_VALIDATOR_REJECT="ERR_TOPIC_VALIDATOR_REJECT";Oe.ERR_TOPIC_VALIDATOR_IGNORE="ERR_TOPIC_VALIDATOR_IGNORE"});var Qne=m(I8=>{l();"use strict";Object.defineProperty(I8,"__esModule",{value:!0});I8.hasGossipProtocol=void 0;var Xne=Zd();function Tqe(t){return t===Xne.GossipsubIDv10||t===Xne.GossipsubIDv11}I8.hasGossipProtocol=Tqe});var Zne=m(T8=>{l();"use strict";Object.defineProperty(T8,"__esModule",{value:!0});T8.messageIdToString=void 0;var Rqe=(tt(),hr);function Pqe(t){return Rqe.toString(t,"base64")}T8.messageIdToString=Pqe});var Jd=m(_c=>{l();"use strict";var Cqe=_c&&_c.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),R8=_c&&_c.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Cqe(e,t,r)};Object.defineProperty(_c,"__esModule",{value:!0});R8(Wne(),_c);R8(Yne(),_c);R8(Qne(),_c);R8(Zne(),_c)});var ese=m(i1=>{l();"use strict";var Oqe=i1&&i1.__awaiter||function(t,e,r,i){function n(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{u(i.next(f))}catch(d){o(d)}}function c(f){try{u(i.throw(f))}catch(d){o(d)}}function u(f){f.done?s(f.value):n(f.value).then(a,c)}u((i=i.apply(t,e||[])).next())})};Object.defineProperty(i1,"__esModule",{value:!0});i1.MessageCache=void 0;var P8=Jd(),Jne=class{constructor(e,r,i){this.msgs=new Map,this.peertx=new Map,this.history=[];for(let n=0;n<r;n++)this.history[n]=[];this.gossip=e,this.msgIdFn=i}put(e){return Oqe(this,void 0,void 0,function*(){let r=yield this.getMsgId(e),i=P8.messageIdToString(r);this.msgs.set(i,e),this.history[0].push({msgID:r,topics:e.topicIDs})})}getMsgId(e){return this.msgIdFn(e)}get(e){return this.msgs.get(P8.messageIdToString(e))}getForPeer(e,r){let i=P8.messageIdToString(e),n=this.msgs.get(i);if(!n)return[void 0,0];let s=this.peertx.get(i);s||(s=new Map,this.peertx.set(i,s));let o=(s.get(r)||0)+1;return s.set(r,o),[n,o]}getGossipIDs(e){let r=[];for(let i=0;i<this.gossip;i++)this.history[i].forEach(n=>{for(let s of n.topics)if(s===e){r.push(n.msgID);break}});return r}shift(){this.history[this.history.length-1].forEach(r=>{let i=P8.messageIdToString(r.msgID);this.msgs.delete(i),this.peertx.delete(i)}),this.history.pop(),this.history.unshift([])}};i1.MessageCache=Jne});var rse=m((tse,am)=>{l();(function(t,e){typeof define=="function"&&define.amd?define(["protobufjs/minimal"],e):typeof Ea=="function"&&typeof am=="object"&&am&&am.exports&&(am.exports=e(Vi()))})(tse,function(t){"use strict";var e=t.Reader,r=t.Writer,i=t.util,n=t.roots.default||(t.roots.default={});return n.RPC=function(){function s(a){if(this.subscriptions=[],this.msgs=[],a)for(var c=Object.keys(a),u=0;u<c.length;++u)a[c[u]]!=null&&(this[c[u]]=a[c[u]])}s.prototype.subscriptions=i.emptyArray,s.prototype.msgs=i.emptyArray,s.prototype.control=null;var o;return Object.defineProperty(s.prototype,"_control",{get:i.oneOfGetter(o=["control"]),set:i.oneOfSetter(o)}),s.encode=function(c,u){if(u||(u=r.create()),c.subscriptions!=null&&c.subscriptions.length)for(var f=0;f<c.subscriptions.length;++f)n.RPC.SubOpts.encode(c.subscriptions[f],u.uint32(10).fork()).ldelim();if(c.msgs!=null&&c.msgs.length)for(var f=0;f<c.msgs.length;++f)n.RPC.Message.encode(c.msgs[f],u.uint32(18).fork()).ldelim();return c.control!=null&&Object.hasOwnProperty.call(c,"control")&&n.RPC.ControlMessage.encode(c.control,u.uint32(26).fork()).ldelim(),u},s.decode=function(c,u){c instanceof e||(c=e.create(c));for(var f=u===void 0?c.len:c.pos+u,d=new n.RPC;c.pos<f;){var h=c.uint32();switch(h>>>3){case 1:d.subscriptions&&d.subscriptions.length||(d.subscriptions=[]),d.subscriptions.push(n.RPC.SubOpts.decode(c,c.uint32()));break;case 2:d.msgs&&d.msgs.length||(d.msgs=[]),d.msgs.push(n.RPC.Message.decode(c,c.uint32()));break;case 3:d.control=n.RPC.ControlMessage.decode(c,c.uint32());break;default:c.skipType(h&7);break}}return d},s.fromObject=function(c){if(c instanceof n.RPC)return c;var u=new n.RPC;if(c.subscriptions){if(!Array.isArray(c.subscriptions))throw TypeError(".RPC.subscriptions: array expected");u.subscriptions=[];for(var f=0;f<c.subscriptions.length;++f){if(typeof c.subscriptions[f]!="object")throw TypeError(".RPC.subscriptions: object expected");u.subscriptions[f]=n.RPC.SubOpts.fromObject(c.subscriptions[f])}}if(c.msgs){if(!Array.isArray(c.msgs))throw TypeError(".RPC.msgs: array expected");u.msgs=[];for(var f=0;f<c.msgs.length;++f){if(typeof c.msgs[f]!="object")throw TypeError(".RPC.msgs: object expected");u.msgs[f]=n.RPC.Message.fromObject(c.msgs[f])}}if(c.control!=null){if(typeof c.control!="object")throw TypeError(".RPC.control: object expected");u.control=n.RPC.ControlMessage.fromObject(c.control)}return u},s.toObject=function(c,u){u||(u={});var f={};if((u.arrays||u.defaults)&&(f.subscriptions=[],f.msgs=[]),c.subscriptions&&c.subscriptions.length){f.subscriptions=[];for(var d=0;d<c.subscriptions.length;++d)f.subscriptions[d]=n.RPC.SubOpts.toObject(c.subscriptions[d],u)}if(c.msgs&&c.msgs.length){f.msgs=[];for(var d=0;d<c.msgs.length;++d)f.msgs[d]=n.RPC.Message.toObject(c.msgs[d],u)}return c.control!=null&&c.hasOwnProperty("control")&&(f.control=n.RPC.ControlMessage.toObject(c.control,u),u.oneofs&&(f._control="control")),f},s.prototype.toJSON=function(){return this.constructor.toObject(this,t.util.toJSONOptions)},s.SubOpts=function(){function a(u){if(u)for(var f=Object.keys(u),d=0;d<f.length;++d)u[f[d]]!=null&&(this[f[d]]=u[f[d]])}a.prototype.subscribe=null,a.prototype.topicID=null;var c;return Object.defineProperty(a.prototype,"_subscribe",{get:i.oneOfGetter(c=["subscribe"]),set:i.oneOfSetter(c)}),Object.defineProperty(a.prototype,"_topicID",{get:i.oneOfGetter(c=["topicID"]),set:i.oneOfSetter(c)}),a.encode=function(f,d){return d||(d=r.create()),f.subscribe!=null&&Object.hasOwnProperty.call(f,"subscribe")&&d.uint32(8).bool(f.subscribe),f.topicID!=null&&Object.hasOwnProperty.call(f,"topicID")&&d.uint32(18).string(f.topicID),d},a.decode=function(f,d){f instanceof e||(f=e.create(f));for(var h=d===void 0?f.len:f.pos+d,p=new n.RPC.SubOpts;f.pos<h;){var y=f.uint32();switch(y>>>3){case 1:p.subscribe=f.bool();break;case 2:p.topicID=f.string();break;default:f.skipType(y&7);break}}return p},a.fromObject=function(f){if(f instanceof n.RPC.SubOpts)return f;var d=new n.RPC.SubOpts;return f.subscribe!=null&&(d.subscribe=Boolean(f.subscribe)),f.topicID!=null&&(d.topicID=String(f.topicID)),d},a.toObject=function(f,d){d||(d={});var h={};return f.subscribe!=null&&f.hasOwnProperty("subscribe")&&(h.subscribe=f.subscribe,d.oneofs&&(h._subscribe="subscribe")),f.topicID!=null&&f.hasOwnProperty("topicID")&&(h.topicID=f.topicID,d.oneofs&&(h._topicID="topicID")),h},a.prototype.toJSON=function(){return this.constructor.toObject(this,t.util.toJSONOptions)},a}(),s.Message=function(){function a(u){if(this.topicIDs=[],u)for(var f=Object.keys(u),d=0;d<f.length;++d)u[f[d]]!=null&&(this[f[d]]=u[f[d]])}a.prototype.from=null,a.prototype.data=null,a.prototype.seqno=null,a.prototype.topicIDs=i.emptyArray,a.prototype.signature=null,a.prototype.key=null;var c;return Object.defineProperty(a.prototype,"_from",{get:i.oneOfGetter(c=["from"]),set:i.oneOfSetter(c)}),Object.defineProperty(a.prototype,"_data",{get:i.oneOfGetter(c=["data"]),set:i.oneOfSetter(c)}),Object.defineProperty(a.prototype,"_seqno",{get:i.oneOfGetter(c=["seqno"]),set:i.oneOfSetter(c)}),Object.defineProperty(a.prototype,"_signature",{get:i.oneOfGetter(c=["signature"]),set:i.oneOfSetter(c)}),Object.defineProperty(a.prototype,"_key",{get:i.oneOfGetter(c=["key"]),set:i.oneOfSetter(c)}),a.encode=function(f,d){if(d||(d=r.create()),f.from!=null&&Object.hasOwnProperty.call(f,"from")&&d.uint32(10).bytes(f.from),f.data!=null&&Object.hasOwnProperty.call(f,"data")&&d.uint32(18).bytes(f.data),f.seqno!=null&&Object.hasOwnProperty.call(f,"seqno")&&d.uint32(26).bytes(f.seqno),f.topicIDs!=null&&f.topicIDs.length)for(var h=0;h<f.topicIDs.length;++h)d.uint32(34).string(f.topicIDs[h]);return f.signature!=null&&Object.hasOwnProperty.call(f,"signature")&&d.uint32(42).bytes(f.signature),f.key!=null&&Object.hasOwnProperty.call(f,"key")&&d.uint32(50).bytes(f.key),d},a.decode=function(f,d){f instanceof e||(f=e.create(f));for(var h=d===void 0?f.len:f.pos+d,p=new n.RPC.Message;f.pos<h;){var y=f.uint32();switch(y>>>3){case 1:p.from=f.bytes();break;case 2:p.data=f.bytes();break;case 3:p.seqno=f.bytes();break;case 4:p.topicIDs&&p.topicIDs.length||(p.topicIDs=[]),p.topicIDs.push(f.string());break;case 5:p.signature=f.bytes();break;case 6:p.key=f.bytes();break;default:f.skipType(y&7);break}}return p},a.fromObject=function(f){if(f instanceof n.RPC.Message)return f;var d=new n.RPC.Message;if(f.from!=null&&(typeof f.from=="string"?i.base64.decode(f.from,d.from=i.newBuffer(i.base64.length(f.from)),0):f.from.length&&(d.from=f.from)),f.data!=null&&(typeof f.data=="string"?i.base64.decode(f.data,d.data=i.newBuffer(i.base64.length(f.data)),0):f.data.length&&(d.data=f.data)),f.seqno!=null&&(typeof f.seqno=="string"?i.base64.decode(f.seqno,d.seqno=i.newBuffer(i.base64.length(f.seqno)),0):f.seqno.length&&(d.seqno=f.seqno)),f.topicIDs){if(!Array.isArray(f.topicIDs))throw TypeError(".RPC.Message.topicIDs: array expected");d.topicIDs=[];for(var h=0;h<f.topicIDs.length;++h)d.topicIDs[h]=String(f.topicIDs[h])}return f.signature!=null&&(typeof f.signature=="string"?i.base64.decode(f.signature,d.signature=i.newBuffer(i.base64.length(f.signature)),0):f.signature.length&&(d.signature=f.signature)),f.key!=null&&(typeof f.key=="string"?i.base64.decode(f.key,d.key=i.newBuffer(i.base64.length(f.key)),0):f.key.length&&(d.key=f.key)),d},a.toObject=function(f,d){d||(d={});var h={};if((d.arrays||d.defaults)&&(h.topicIDs=[]),f.from!=null&&f.hasOwnProperty("from")&&(h.from=d.bytes===String?i.base64.encode(f.from,0,f.from.length):d.bytes===Array?Array.prototype.slice.call(f.from):f.from,d.oneofs&&(h._from="from")),f.data!=null&&f.hasOwnProperty("data")&&(h.data=d.bytes===String?i.base64.encode(f.data,0,f.data.length):d.bytes===Array?Array.prototype.slice.call(f.data):f.data,d.oneofs&&(h._data="data")),f.seqno!=null&&f.hasOwnProperty("seqno")&&(h.seqno=d.bytes===String?i.base64.encode(f.seqno,0,f.seqno.length):d.bytes===Array?Array.prototype.slice.call(f.seqno):f.seqno,d.oneofs&&(h._seqno="seqno")),f.topicIDs&&f.topicIDs.length){h.topicIDs=[];for(var p=0;p<f.topicIDs.length;++p)h.topicIDs[p]=f.topicIDs[p]}return f.signature!=null&&f.hasOwnProperty("signature")&&(h.signature=d.bytes===String?i.base64.encode(f.signature,0,f.signature.length):d.bytes===Array?Array.prototype.slice.call(f.signature):f.signature,d.oneofs&&(h._signature="signature")),f.key!=null&&f.hasOwnProperty("key")&&(h.key=d.bytes===String?i.base64.encode(f.key,0,f.key.length):d.bytes===Array?Array.prototype.slice.call(f.key):f.key,d.oneofs&&(h._key="key")),h},a.prototype.toJSON=function(){return this.constructor.toObject(this,t.util.toJSONOptions)},a}(),s.ControlMessage=function(){function a(c){if(this.ihave=[],this.iwant=[],this.graft=[],this.prune=[],c)for(var u=Object.keys(c),f=0;f<u.length;++f)c[u[f]]!=null&&(this[u[f]]=c[u[f]])}return a.prototype.ihave=i.emptyArray,a.prototype.iwant=i.emptyArray,a.prototype.graft=i.emptyArray,a.prototype.prune=i.emptyArray,a.encode=function(u,f){if(f||(f=r.create()),u.ihave!=null&&u.ihave.length)for(var d=0;d<u.ihave.length;++d)n.RPC.ControlIHave.encode(u.ihave[d],f.uint32(10).fork()).ldelim();if(u.iwant!=null&&u.iwant.length)for(var d=0;d<u.iwant.length;++d)n.RPC.ControlIWant.encode(u.iwant[d],f.uint32(18).fork()).ldelim();if(u.graft!=null&&u.graft.length)for(var d=0;d<u.graft.length;++d)n.RPC.ControlGraft.encode(u.graft[d],f.uint32(26).fork()).ldelim();if(u.prune!=null&&u.prune.length)for(var d=0;d<u.prune.length;++d)n.RPC.ControlPrune.encode(u.prune[d],f.uint32(34).fork()).ldelim();return f},a.decode=function(u,f){u instanceof e||(u=e.create(u));for(var d=f===void 0?u.len:u.pos+f,h=new n.RPC.ControlMessage;u.pos<d;){var p=u.uint32();switch(p>>>3){case 1:h.ihave&&h.ihave.length||(h.ihave=[]),h.ihave.push(n.RPC.ControlIHave.decode(u,u.uint32()));break;case 2:h.iwant&&h.iwant.length||(h.iwant=[]),h.iwant.push(n.RPC.ControlIWant.decode(u,u.uint32()));break;case 3:h.graft&&h.graft.length||(h.graft=[]),h.graft.push(n.RPC.ControlGraft.decode(u,u.uint32()));break;case 4:h.prune&&h.prune.length||(h.prune=[]),h.prune.push(n.RPC.ControlPrune.decode(u,u.uint32()));break;default:u.skipType(p&7);break}}return h},a.fromObject=function(u){if(u instanceof n.RPC.ControlMessage)return u;var f=new n.RPC.ControlMessage;if(u.ihave){if(!Array.isArray(u.ihave))throw TypeError(".RPC.ControlMessage.ihave: array expected");f.ihave=[];for(var d=0;d<u.ihave.length;++d){if(typeof u.ihave[d]!="object")throw TypeError(".RPC.ControlMessage.ihave: object expected");f.ihave[d]=n.RPC.ControlIHave.fromObject(u.ihave[d])}}if(u.iwant){if(!Array.isArray(u.iwant))throw TypeError(".RPC.ControlMessage.iwant: array expected");f.iwant=[];for(var d=0;d<u.iwant.length;++d){if(typeof u.iwant[d]!="object")throw TypeError(".RPC.ControlMessage.iwant: object expected");f.iwant[d]=n.RPC.ControlIWant.fromObject(u.iwant[d])}}if(u.graft){if(!Array.isArray(u.graft))throw TypeError(".RPC.ControlMessage.graft: array expected");f.graft=[];for(var d=0;d<u.graft.length;++d){if(typeof u.graft[d]!="object")throw TypeError(".RPC.ControlMessage.graft: object expected");f.graft[d]=n.RPC.ControlGraft.fromObject(u.graft[d])}}if(u.prune){if(!Array.isArray(u.prune))throw TypeError(".RPC.ControlMessage.prune: array expected");f.prune=[];for(var d=0;d<u.prune.length;++d){if(typeof u.prune[d]!="object")throw TypeError(".RPC.ControlMessage.prune: object expected");f.prune[d]=n.RPC.ControlPrune.fromObject(u.prune[d])}}return f},a.toObject=function(u,f){f||(f={});var d={};if((f.arrays||f.defaults)&&(d.ihave=[],d.iwant=[],d.graft=[],d.prune=[]),u.ihave&&u.ihave.length){d.ihave=[];for(var h=0;h<u.ihave.length;++h)d.ihave[h]=n.RPC.ControlIHave.toObject(u.ihave[h],f)}if(u.iwant&&u.iwant.length){d.iwant=[];for(var h=0;h<u.iwant.length;++h)d.iwant[h]=n.RPC.ControlIWant.toObject(u.iwant[h],f)}if(u.graft&&u.graft.length){d.graft=[];for(var h=0;h<u.graft.length;++h)d.graft[h]=n.RPC.ControlGraft.toObject(u.graft[h],f)}if(u.prune&&u.prune.length){d.prune=[];for(var h=0;h<u.prune.length;++h)d.prune[h]=n.RPC.ControlPrune.toObject(u.prune[h],f)}return d},a.prototype.toJSON=function(){return this.constructor.toObject(this,t.util.toJSONOptions)},a}(),s.ControlIHave=function(){function a(u){if(this.messageIDs=[],u)for(var f=Object.keys(u),d=0;d<f.length;++d)u[f[d]]!=null&&(this[f[d]]=u[f[d]])}a.prototype.topicID=null,a.prototype.messageIDs=i.emptyArray;var c;return Object.defineProperty(a.prototype,"_topicID",{get:i.oneOfGetter(c=["topicID"]),set:i.oneOfSetter(c)}),a.encode=function(f,d){if(d||(d=r.create()),f.topicID!=null&&Object.hasOwnProperty.call(f,"topicID")&&d.uint32(10).string(f.topicID),f.messageIDs!=null&&f.messageIDs.length)for(var h=0;h<f.messageIDs.length;++h)d.uint32(18).bytes(f.messageIDs[h]);return d},a.decode=function(f,d){f instanceof e||(f=e.create(f));for(var h=d===void 0?f.len:f.pos+d,p=new n.RPC.ControlIHave;f.pos<h;){var y=f.uint32();switch(y>>>3){case 1:p.topicID=f.string();break;case 2:p.messageIDs&&p.messageIDs.length||(p.messageIDs=[]),p.messageIDs.push(f.bytes());break;default:f.skipType(y&7);break}}return p},a.fromObject=function(f){if(f instanceof n.RPC.ControlIHave)return f;var d=new n.RPC.ControlIHave;if(f.topicID!=null&&(d.topicID=String(f.topicID)),f.messageIDs){if(!Array.isArray(f.messageIDs))throw TypeError(".RPC.ControlIHave.messageIDs: array expected");d.messageIDs=[];for(var h=0;h<f.messageIDs.length;++h)typeof f.messageIDs[h]=="string"?i.base64.decode(f.messageIDs[h],d.messageIDs[h]=i.newBuffer(i.base64.length(f.messageIDs[h])),0):f.messageIDs[h].length&&(d.messageIDs[h]=f.messageIDs[h])}return d},a.toObject=function(f,d){d||(d={});var h={};if((d.arrays||d.defaults)&&(h.messageIDs=[]),f.topicID!=null&&f.hasOwnProperty("topicID")&&(h.topicID=f.topicID,d.oneofs&&(h._topicID="topicID")),f.messageIDs&&f.messageIDs.length){h.messageIDs=[];for(var p=0;p<f.messageIDs.length;++p)h.messageIDs[p]=d.bytes===String?i.base64.encode(f.messageIDs[p],0,f.messageIDs[p].length):d.bytes===Array?Array.prototype.slice.call(f.messageIDs[p]):f.messageIDs[p]}return h},a.prototype.toJSON=function(){return this.constructor.toObject(this,t.util.toJSONOptions)},a}(),s.ControlIWant=function(){function a(c){if(this.messageIDs=[],c)for(var u=Object.keys(c),f=0;f<u.length;++f)c[u[f]]!=null&&(this[u[f]]=c[u[f]])}return a.prototype.messageIDs=i.emptyArray,a.encode=function(u,f){if(f||(f=r.create()),u.messageIDs!=null&&u.messageIDs.length)for(var d=0;d<u.messageIDs.length;++d)f.uint32(10).bytes(u.messageIDs[d]);return f},a.decode=function(u,f){u instanceof e||(u=e.create(u));for(var d=f===void 0?u.len:u.pos+f,h=new n.RPC.ControlIWant;u.pos<d;){var p=u.uint32();switch(p>>>3){case 1:h.messageIDs&&h.messageIDs.length||(h.messageIDs=[]),h.messageIDs.push(u.bytes());break;default:u.skipType(p&7);break}}return h},a.fromObject=function(u){if(u instanceof n.RPC.ControlIWant)return u;var f=new n.RPC.ControlIWant;if(u.messageIDs){if(!Array.isArray(u.messageIDs))throw TypeError(".RPC.ControlIWant.messageIDs: array expected");f.messageIDs=[];for(var d=0;d<u.messageIDs.length;++d)typeof u.messageIDs[d]=="string"?i.base64.decode(u.messageIDs[d],f.messageIDs[d]=i.newBuffer(i.base64.length(u.messageIDs[d])),0):u.messageIDs[d].length&&(f.messageIDs[d]=u.messageIDs[d])}return f},a.toObject=function(u,f){f||(f={});var d={};if((f.arrays||f.defaults)&&(d.messageIDs=[]),u.messageIDs&&u.messageIDs.length){d.messageIDs=[];for(var h=0;h<u.messageIDs.length;++h)d.messageIDs[h]=f.bytes===String?i.base64.encode(u.messageIDs[h],0,u.messageIDs[h].length):f.bytes===Array?Array.prototype.slice.call(u.messageIDs[h]):u.messageIDs[h]}return d},a.prototype.toJSON=function(){return this.constructor.toObject(this,t.util.toJSONOptions)},a}(),s.ControlGraft=function(){function a(u){if(u)for(var f=Object.keys(u),d=0;d<f.length;++d)u[f[d]]!=null&&(this[f[d]]=u[f[d]])}a.prototype.topicID=null;var c;return Object.defineProperty(a.prototype,"_topicID",{get:i.oneOfGetter(c=["topicID"]),set:i.oneOfSetter(c)}),a.encode=function(f,d){return d||(d=r.create()),f.topicID!=null&&Object.hasOwnProperty.call(f,"topicID")&&d.uint32(10).string(f.topicID),d},a.decode=function(f,d){f instanceof e||(f=e.create(f));for(var h=d===void 0?f.len:f.pos+d,p=new n.RPC.ControlGraft;f.pos<h;){var y=f.uint32();switch(y>>>3){case 1:p.topicID=f.string();break;default:f.skipType(y&7);break}}return p},a.fromObject=function(f){if(f instanceof n.RPC.ControlGraft)return f;var d=new n.RPC.ControlGraft;return f.topicID!=null&&(d.topicID=String(f.topicID)),d},a.toObject=function(f,d){d||(d={});var h={};return f.topicID!=null&&f.hasOwnProperty("topicID")&&(h.topicID=f.topicID,d.oneofs&&(h._topicID="topicID")),h},a.prototype.toJSON=function(){return this.constructor.toObject(this,t.util.toJSONOptions)},a}(),s.ControlPrune=function(){function a(u){if(this.peers=[],u)for(var f=Object.keys(u),d=0;d<f.length;++d)u[f[d]]!=null&&(this[f[d]]=u[f[d]])}a.prototype.topicID=null,a.prototype.peers=i.emptyArray,a.prototype.backoff=null;var c;return Object.defineProperty(a.prototype,"_topicID",{get:i.oneOfGetter(c=["topicID"]),set:i.oneOfSetter(c)}),Object.defineProperty(a.prototype,"_backoff",{get:i.oneOfGetter(c=["backoff"]),set:i.oneOfSetter(c)}),a.encode=function(f,d){if(d||(d=r.create()),f.topicID!=null&&Object.hasOwnProperty.call(f,"topicID")&&d.uint32(10).string(f.topicID),f.peers!=null&&f.peers.length)for(var h=0;h<f.peers.length;++h)n.RPC.PeerInfo.encode(f.peers[h],d.uint32(18).fork()).ldelim();return f.backoff!=null&&Object.hasOwnProperty.call(f,"backoff")&&d.uint32(24).uint64(f.backoff),d},a.decode=function(f,d){f instanceof e||(f=e.create(f));for(var h=d===void 0?f.len:f.pos+d,p=new n.RPC.ControlPrune;f.pos<h;){var y=f.uint32();switch(y>>>3){case 1:p.topicID=f.string();break;case 2:p.peers&&p.peers.length||(p.peers=[]),p.peers.push(n.RPC.PeerInfo.decode(f,f.uint32()));break;case 3:p.backoff=f.uint64();break;default:f.skipType(y&7);break}}return p},a.fromObject=function(f){if(f instanceof n.RPC.ControlPrune)return f;var d=new n.RPC.ControlPrune;if(f.topicID!=null&&(d.topicID=String(f.topicID)),f.peers){if(!Array.isArray(f.peers))throw TypeError(".RPC.ControlPrune.peers: array expected");d.peers=[];for(var h=0;h<f.peers.length;++h){if(typeof f.peers[h]!="object")throw TypeError(".RPC.ControlPrune.peers: object expected");d.peers[h]=n.RPC.PeerInfo.fromObject(f.peers[h])}}return f.backoff!=null&&(i.Long?(d.backoff=i.Long.fromValue(f.backoff)).unsigned=!0:typeof f.backoff=="string"?d.backoff=parseInt(f.backoff,10):typeof f.backoff=="number"?d.backoff=f.backoff:typeof f.backoff=="object"&&(d.backoff=new i.LongBits(f.backoff.low>>>0,f.backoff.high>>>0).toNumber(!0))),d},a.toObject=function(f,d){d||(d={});var h={};if((d.arrays||d.defaults)&&(h.peers=[]),f.topicID!=null&&f.hasOwnProperty("topicID")&&(h.topicID=f.topicID,d.oneofs&&(h._topicID="topicID")),f.peers&&f.peers.length){h.peers=[];for(var p=0;p<f.peers.length;++p)h.peers[p]=n.RPC.PeerInfo.toObject(f.peers[p],d)}return f.backoff!=null&&f.hasOwnProperty("backoff")&&(typeof f.backoff=="number"?h.backoff=d.longs===String?String(f.backoff):f.backoff:h.backoff=d.longs===String?i.Long.prototype.toString.call(f.backoff):d.longs===Number?new i.LongBits(f.backoff.low>>>0,f.backoff.high>>>0).toNumber(!0):f.backoff,d.oneofs&&(h._backoff="backoff")),h},a.prototype.toJSON=function(){return this.constructor.toObject(this,t.util.toJSONOptions)},a}(),s.PeerInfo=function(){function a(u){if(u)for(var f=Object.keys(u),d=0;d<f.length;++d)u[f[d]]!=null&&(this[f[d]]=u[f[d]])}a.prototype.peerID=null,a.prototype.signedPeerRecord=null;var c;return Object.defineProperty(a.prototype,"_peerID",{get:i.oneOfGetter(c=["peerID"]),set:i.oneOfSetter(c)}),Object.defineProperty(a.prototype,"_signedPeerRecord",{get:i.oneOfGetter(c=["signedPeerRecord"]),set:i.oneOfSetter(c)}),a.encode=function(f,d){return d||(d=r.create()),f.peerID!=null&&Object.hasOwnProperty.call(f,"peerID")&&d.uint32(10).bytes(f.peerID),f.signedPeerRecord!=null&&Object.hasOwnProperty.call(f,"signedPeerRecord")&&d.uint32(18).bytes(f.signedPeerRecord),d},a.decode=function(f,d){f instanceof e||(f=e.create(f));for(var h=d===void 0?f.len:f.pos+d,p=new n.RPC.PeerInfo;f.pos<h;){var y=f.uint32();switch(y>>>3){case 1:p.peerID=f.bytes();break;case 2:p.signedPeerRecord=f.bytes();break;default:f.skipType(y&7);break}}return p},a.fromObject=function(f){if(f instanceof n.RPC.PeerInfo)return f;var d=new n.RPC.PeerInfo;return f.peerID!=null&&(typeof f.peerID=="string"?i.base64.decode(f.peerID,d.peerID=i.newBuffer(i.base64.length(f.peerID)),0):f.peerID.length&&(d.peerID=f.peerID)),f.signedPeerRecord!=null&&(typeof f.signedPeerRecord=="string"?i.base64.decode(f.signedPeerRecord,d.signedPeerRecord=i.newBuffer(i.base64.length(f.signedPeerRecord)),0):f.signedPeerRecord.length&&(d.signedPeerRecord=f.signedPeerRecord)),d},a.toObject=function(f,d){d||(d={});var h={};return f.peerID!=null&&f.hasOwnProperty("peerID")&&(h.peerID=d.bytes===String?i.base64.encode(f.peerID,0,f.peerID.length):d.bytes===Array?Array.prototype.slice.call(f.peerID):f.peerID,d.oneofs&&(h._peerID="peerID")),f.signedPeerRecord!=null&&f.hasOwnProperty("signedPeerRecord")&&(h.signedPeerRecord=d.bytes===String?i.base64.encode(f.signedPeerRecord,0,f.signedPeerRecord.length):d.bytes===Array?Array.prototype.slice.call(f.signedPeerRecord):f.signedPeerRecord,d.oneofs&&(h._signedPeerRecord="signedPeerRecord")),h},a.prototype.toJSON=function(){return this.constructor.toObject(this,t.util.toJSONOptions)},a}(),s}(),n})});var BT=m(C8=>{l();"use strict";Object.defineProperty(C8,"__esModule",{value:!0});C8.getGossipPeers=void 0;var ise=Jd();function kqe(t,e,r,i=()=>!0){let n=t.topics.get(e);if(!n)return new Set;let s=[];return n.forEach(o=>{let a=t.peers.get(o);!a||ise.hasGossipProtocol(a.protocol)&&i(o)&&s.push(o)}),s=ise.shuffle(s),r>0&&s.length>r&&(s=s.slice(0,r)),new Set(s)}C8.getGossipPeers=kqe});var sse=m(Ec=>{l();"use strict";var Dqe=Ec&&Ec.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),Bqe=Ec&&Ec.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Nqe=Ec&&Ec.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Dqe(e,t,r);return Bqe(e,t),e};Object.defineProperty(Ec,"__esModule",{value:!0});Ec.Heartbeat=void 0;var cm=Nqe(Zd()),O8=BT(),Mqe=Jd(),nse=class{constructor(e){this.gossipsub=e}start(){if(this._heartbeatTimer)return;let e=this._heartbeat.bind(this),r=setTimeout(()=>{e(),this._heartbeatTimer.runPeriodically(e,cm.GossipsubHeartbeatInterval)},cm.GossipsubHeartbeatInitialDelay);this._heartbeatTimer={_intervalId:void 0,runPeriodically:(i,n)=>{this._heartbeatTimer._intervalId=setInterval(i,n)},cancel:()=>{clearTimeout(r),clearInterval(this._heartbeatTimer._intervalId)}}}stop(){!this._heartbeatTimer||(this._heartbeatTimer.cancel(),this._heartbeatTimer=null)}_heartbeat(){let{D:e,Dlo:r,Dhi:i,Dscore:n,Dout:s}=this.gossipsub._options;this.gossipsub.heartbeatTicks++;let o=new Map,a=h=>{let p=o.get(h);return p===void 0&&(p=this.gossipsub.score.score(h),o.set(h,p)),p},c=new Map,u=new Map,f=new Map;this.gossipsub._clearBackoff(),this.gossipsub.peerhave.clear(),this.gossipsub.iasked.clear(),this.gossipsub._applyIwantPenalties(),this.gossipsub._directConnect(),this.gossipsub.mesh.forEach((h,p)=>{let y=E=>{this.gossipsub.log("HEARTBEAT: Remove mesh link to %s in %s",E,p),this.gossipsub.score.prune(E,p),this.gossipsub._addBackoff(E,p),h.delete(E);let v=u.get(E);v?v.push(p):u.set(E,[p])},b=E=>{this.gossipsub.log("HEARTBEAT: Add mesh link to %s in %s",E,p),this.gossipsub.score.graft(E,p),h.add(E);let v=c.get(E);v?v.push(p):c.set(E,[p])};if(h.forEach(E=>{let v=a(E);v<0&&(this.gossipsub.log("HEARTBEAT: Prune peer %s with negative score: score=%d, topic=%s",E,v,p),y(E),f.set(E,!0))}),h.size<r){let E=this.gossipsub.backoff.get(p),v=e-h.size;O8.getGossipPeers(this.gossipsub,p,v,R=>!h.has(R)&&!this.gossipsub.direct.has(R)&&(!E||!E.has(R))&&a(R)>=0).forEach(b)}if(h.size>i){let E=Array.from(h);E.sort((A,R)=>a(R)-a(A)),E=E.slice(0,n).concat(Mqe.shuffle(E.slice(n)));let v=0;if(E.slice(0,e).forEach(A=>{this.gossipsub.outbound.get(A)&&v++}),v<s){let A=F=>{let D=E[F];for(let B=F;B>0;B--)E[B]=E[B-1];E[0]=D};if(v>0){let F=v;for(let D=1;D<e&&F>0;D++)this.gossipsub.outbound.get(E[D])&&(A(D),F--)}let R=e-v;for(let F=e;F<E.length&&R>0;F++)this.gossipsub.outbound.get(E[F])&&(A(F),R--)}E.slice(e).forEach(y)}if(h.size>=r){let E=0;if(h.forEach(v=>{this.gossipsub.outbound.get(v)&&E++}),E<s){let v=s-E,A=this.gossipsub.backoff.get(p);O8.getGossipPeers(this.gossipsub,p,v,R=>!h.has(R)&&!this.gossipsub.direct.has(R)&&(!A||!A.has(R))&&a(R)>=0).forEach(b)}}if(this.gossipsub.heartbeatTicks%cm.GossipsubOpportunisticGraftTicks==0&&h.size>1){let E=Array.from(h).sort((R,F)=>a(R)-a(F)),v=h.size/2,A=a(E[v]);if(A<this.gossipsub._options.scoreThresholds.opportunisticGraftThreshold){let R=this.gossipsub.backoff.get(p);O8.getGossipPeers(this.gossipsub,p,cm.GossipsubOpportunisticGraftPeers,D=>h.has(D)&&!this.gossipsub.direct.has(D)&&(!R||!R.has(D))&&a(D)>A).forEach(D=>{this.gossipsub.log("HEARTBEAT: Opportunistically graft peer %s on topic %s",D,p),b(D)})}}this.gossipsub._emitGossip(p,h)});let d=this.gossipsub._now();this.gossipsub.lastpub.forEach((h,p)=>{h+cm.GossipsubFanoutTTL<d&&(this.gossipsub.fanout.delete(p),this.gossipsub.lastpub.delete(p))}),this.gossipsub.fanout.forEach((h,p)=>{let y=this.gossipsub.topics.get(p);if(h.forEach(b=>{(!y.has(b)||a(b)<this.gossipsub._options.scoreThresholds.publishThreshold)&&h.delete(b)}),h.size<e){let b=e-h.size;O8.getGossipPeers(this.gossipsub,p,b,v=>!h.has(v)&&!this.gossipsub.direct.has(v)&&a(v)>=this.gossipsub._options.scoreThresholds.publishThreshold).forEach(v=>{h.add(v)})}this.gossipsub._emitGossip(p,h)}),this.gossipsub._sendGraftPrune(c,u,f),this.gossipsub._flush(),this.gossipsub.messageCache.shift(),this.gossipsub.emit("gossipsub:heartbeat")}};Ec.Heartbeat=nse});var NT=m(n1=>{l();"use strict";Object.defineProperty(n1,"__esModule",{value:!0});n1.ERR_INVALID_PEER_SCORE_THRESHOLDS=n1.ERR_INVALID_PEER_SCORE_PARAMS=void 0;n1.ERR_INVALID_PEER_SCORE_PARAMS="ERR_INVALID_PEER_SCORE_PARAMS";n1.ERR_INVALID_PEER_SCORE_THRESHOLDS="ERR_INVALID_PEER_SCORE_THRESHOLDS"});var MT=m((V8t,ase)=>{l();"use strict";function ose(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function Lqe(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return ose(t,r)}catch(i){r.message=t.message,r.stack=t.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(t)),ose(new n,r)}}ase.exports=Lqe});var LT=m(Cn=>{l();"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});Cn.validateTopicScoreParams=Cn.validatePeerScoreParams=Cn.createTopicScoreParams=Cn.createPeerScoreParams=Cn.defaultTopicScoreParams=Cn.defaultPeerScoreParams=void 0;var cr=NT(),ur=MT();Cn.defaultPeerScoreParams={topics:{},topicScoreCap:10,appSpecificScore:()=>0,appSpecificWeight:10,IPColocationFactorWeight:-5,IPColocationFactorThreshold:10,IPColocationFactorWhitelist:new Set,behaviourPenaltyWeight:-10,behaviourPenaltyDecay:.2,decayInterval:1e3,decayToZero:.1,retainScore:3600*1e3};Cn.defaultTopicScoreParams={topicWeight:.5,timeInMeshWeight:1,timeInMeshQuantum:1,timeInMeshCap:3600,firstMessageDeliveriesWeight:1,firstMessageDeliveriesDecay:.5,firstMessageDeliveriesCap:2e3,meshMessageDeliveriesWeight:-1,meshMessageDeliveriesDecay:.5,meshMessageDeliveriesCap:100,meshMessageDeliveriesThreshold:20,meshMessageDeliveriesWindow:10,meshMessageDeliveriesActivation:5e3,meshFailurePenaltyWeight:-1,meshFailurePenaltyDecay:.5,invalidMessageDeliveriesWeight:-1,invalidMessageDeliveriesDecay:.3};function qqe(t={}){return Object.assign(Object.assign(Object.assign({},Cn.defaultPeerScoreParams),t),{topics:t.topics?Object.entries(t.topics).reduce((e,[r,i])=>(e[r]=cse(i),e),{}):{}})}Cn.createPeerScoreParams=qqe;function cse(t={}){return Object.assign(Object.assign({},Cn.defaultTopicScoreParams),t)}Cn.createTopicScoreParams=cse;function jqe(t){for(let[e,r]of Object.entries(t.topics))try{use(r)}catch(i){throw ur(new Error(`invalid score parameters for topic ${e}: ${i.message}`),cr.ERR_INVALID_PEER_SCORE_PARAMS)}if(t.topicScoreCap<0)throw ur(new Error("invalid topic score cap; must be positive (or 0 for no cap)"),cr.ERR_INVALID_PEER_SCORE_PARAMS);if(t.appSpecificScore===null||t.appSpecificScore===void 0)throw ur(new Error("missing application specific score function"),cr.ERR_INVALID_PEER_SCORE_PARAMS);if(t.IPColocationFactorWeight>0)throw ur(new Error("invalid IPColocationFactorWeight; must be negative (or 0 to disable)"),cr.ERR_INVALID_PEER_SCORE_PARAMS);if(t.IPColocationFactorWeight!==0&&t.IPColocationFactorThreshold<1)throw ur(new Error("invalid IPColocationFactorThreshold; must be at least 1"),cr.ERR_INVALID_PEER_SCORE_PARAMS);if(t.behaviourPenaltyWeight>0)throw ur(new Error("invalid BehaviourPenaltyWeight; must be negative (or 0 to disable)"),cr.ERR_INVALID_PEER_SCORE_PARAMS);if(t.behaviourPenaltyWeight!==0&&(t.behaviourPenaltyDecay<=0||t.behaviourPenaltyDecay>=1))throw ur(new Error("invalid BehaviourPenaltyDecay; must be between 0 and 1"),cr.ERR_INVALID_PEER_SCORE_PARAMS);if(t.decayInterval<1e3)throw ur(new Error("invalid DecayInterval; must be at least 1s"),cr.ERR_INVALID_PEER_SCORE_PARAMS);if(t.decayToZero<=0||t.decayToZero>=1)throw ur(new Error("invalid DecayToZero; must be between 0 and 1"),cr.ERR_INVALID_PEER_SCORE_PARAMS)}Cn.validatePeerScoreParams=jqe;function use(t){if(t.topicWeight<0)throw ur(new Error("invalid topic weight; must be >= 0"),cr.ERR_INVALID_PEER_SCORE_PARAMS);if(t.timeInMeshQuantum===0)throw ur(new Error("invalid TimeInMeshQuantum; must be non zero"),cr.ERR_INVALID_PEER_SCORE_PARAMS);if(t.timeInMeshWeight<0)throw ur(new Error("invalid TimeInMeshWeight; must be positive (or 0 to disable)"),cr.ERR_INVALID_PEER_SCORE_PARAMS);if(t.timeInMeshWeight!==0&&t.timeInMeshQuantum<=0)throw ur(new Error("invalid TimeInMeshQuantum; must be positive"),cr.ERR_INVALID_PEER_SCORE_PARAMS);if(t.timeInMeshWeight!==0&&t.timeInMeshCap<=0)throw ur(new Error("invalid TimeInMeshCap; must be positive"),cr.ERR_INVALID_PEER_SCORE_PARAMS);if(t.firstMessageDeliveriesWeight<0)throw ur(new Error("invallid FirstMessageDeliveriesWeight; must be positive (or 0 to disable)"),cr.ERR_INVALID_PEER_SCORE_PARAMS);if(t.firstMessageDeliveriesWeight!==0&&(t.firstMessageDeliveriesDecay<=0||t.firstMessageDeliveriesDecay>=1))throw ur(new Error("invalid FirstMessageDeliveriesDecay; must be between 0 and 1"),cr.ERR_INVALID_PEER_SCORE_PARAMS);if(t.firstMessageDeliveriesWeight!==0&&t.firstMessageDeliveriesCap<=0)throw ur(new Error("invalid FirstMessageDeliveriesCap; must be positive"),cr.ERR_INVALID_PEER_SCORE_PARAMS);if(t.meshMessageDeliveriesWeight>0)throw ur(new Error("invalid MeshMessageDeliveriesWeight; must be negative (or 0 to disable)"),cr.ERR_INVALID_PEER_SCORE_PARAMS);if(t.meshMessageDeliveriesWeight!==0&&(t.meshMessageDeliveriesDecay<=0||t.meshMessageDeliveriesDecay>=1))throw ur(new Error("invalid MeshMessageDeliveriesDecay; must be between 0 and 1"),cr.ERR_INVALID_PEER_SCORE_PARAMS);if(t.meshMessageDeliveriesWeight!==0&&t.meshMessageDeliveriesCap<=0)throw ur(new Error("invalid MeshMessageDeliveriesCap; must be positive"),cr.ERR_INVALID_PEER_SCORE_PARAMS);if(t.meshMessageDeliveriesWeight!==0&&t.meshMessageDeliveriesThreshold<=0)throw ur(new Error("invalid MeshMessageDeliveriesThreshold; must be positive"),cr.ERR_INVALID_PEER_SCORE_PARAMS);if(t.meshMessageDeliveriesWindow<0)throw ur(new Error("invalid MeshMessageDeliveriesWindow; must be non-negative"),cr.ERR_INVALID_PEER_SCORE_PARAMS);if(t.meshMessageDeliveriesWeight!==0&&t.meshMessageDeliveriesActivation<1e3)throw ur(new Error("invalid MeshMessageDeliveriesActivation; must be at least 1s"),cr.ERR_INVALID_PEER_SCORE_PARAMS);if(t.meshFailurePenaltyWeight>0)throw ur(new Error("invalid MeshFailurePenaltyWeight; must be negative (or 0 to disable)"),cr.ERR_INVALID_PEER_SCORE_PARAMS);if(t.meshFailurePenaltyWeight!==0&&(t.meshFailurePenaltyDecay<=0||t.meshFailurePenaltyDecay>=1))throw ur(new Error("invalid MeshFailurePenaltyDecay; must be between 0 and 1"),cr.ERR_INVALID_PEER_SCORE_PARAMS);if(t.invalidMessageDeliveriesWeight>0)throw ur(new Error("invalid InvalidMessageDeliveriesWeight; must be negative (or 0 to disable)"),cr.ERR_INVALID_PEER_SCORE_PARAMS);if(t.invalidMessageDeliveriesDecay<=0||t.invalidMessageDeliveriesDecay>=1)throw ur(new Error("invalid InvalidMessageDeliveriesDecay; must be between 0 and 1"),cr.ERR_INVALID_PEER_SCORE_PARAMS)}Cn.validateTopicScoreParams=use});var fse=m(Su=>{l();"use strict";Object.defineProperty(Su,"__esModule",{value:!0});Su.validatePeerScoreThresholds=Su.createPeerScoreThresholds=Su.defaultPeerScoreThresholds=void 0;var um=NT(),fm=MT();Su.defaultPeerScoreThresholds={gossipThreshold:-10,publishThreshold:-50,graylistThreshold:-80,acceptPXThreshold:10,opportunisticGraftThreshold:20};function Uqe(t={}){return Object.assign(Object.assign({},Su.defaultPeerScoreThresholds),t)}Su.createPeerScoreThresholds=Uqe;function Fqe(t){if(t.gossipThreshold>0)throw fm(new Error("invalid gossip threshold; it must be <= 0"),um.ERR_INVALID_PEER_SCORE_THRESHOLDS);if(t.publishThreshold>0||t.publishThreshold>t.gossipThreshold)throw fm(new Error("invalid publish threshold; it must be <= 0 and <= gossip threshold"),um.ERR_INVALID_PEER_SCORE_THRESHOLDS);if(t.graylistThreshold>0||t.graylistThreshold>t.publishThreshold)throw fm(new Error("invalid graylist threshold; it must be <= 0 and <= publish threshold"),um.ERR_INVALID_PEER_SCORE_THRESHOLDS);if(t.acceptPXThreshold<0)throw fm(new Error("invalid accept PX threshold; it must be >= 0"),um.ERR_INVALID_PEER_SCORE_THRESHOLDS);if(t.opportunisticGraftThreshold<0)throw fm(new Error("invalid opportunistic grafting threshold; it must be >= 0"),um.ERR_INVALID_PEER_SCORE_THRESHOLDS)}Su.validatePeerScoreThresholds=Fqe});var lse=m(sl=>{l();"use strict";Object.defineProperty(sl,"__esModule",{value:!0});sl.ensureTopicStats=sl.createTopicStats=sl.createPeerStats=void 0;function Kqe(t={}){return Object.assign(Object.assign({connected:!1,expire:0,ips:[],behaviourPenalty:0},t),{topics:t.topics?Object.entries(t.topics).reduce((e,[r,i])=>(e[r]=qT(i),e),{}):{}})}sl.createPeerStats=Kqe;function qT(t={}){return Object.assign({inMesh:!1,graftTime:0,meshTime:0,firstMessageDeliveries:0,meshMessageDeliveries:0,meshMessageDeliveriesActive:!1,meshFailurePenalty:0,invalidMessageDeliveries:0},t)}sl.createTopicStats=qT;function Vqe(t,e,r){let i=e.topics[t];if(i)return i;if(!!r.topics[t])return e.topics[t]=i=qT(),i}sl.ensureTopicStats=Vqe});var dse=m(k8=>{l();"use strict";Object.defineProperty(k8,"__esModule",{value:!0});k8.computeScore=void 0;function zqe(t,e,r,i){let n=0;return Object.entries(e.topics).forEach(([a,c])=>{let u=r.topics[a];if(!u)return;let f=0;if(c.inMesh){let y=c.meshTime/u.timeInMeshQuantum;y>u.timeInMeshCap&&(y=u.timeInMeshCap),f+=y*u.timeInMeshWeight}if(f+=c.firstMessageDeliveries*u.firstMessageDeliveriesWeight,c.meshMessageDeliveriesActive&&c.meshMessageDeliveries<u.meshMessageDeliveriesThreshold){let y=u.meshMessageDeliveriesThreshold-c.meshMessageDeliveries;f+=y*y*u.meshMessageDeliveriesWeight}f+=c.meshFailurePenalty*u.meshFailurePenaltyWeight,f+=c.invalidMessageDeliveries*c.invalidMessageDeliveries*u.invalidMessageDeliveriesWeight,n+=f*u.topicWeight}),r.topicScoreCap>0&&n>r.topicScoreCap&&(n=r.topicScoreCap),n+=r.appSpecificScore(t)*r.appSpecificWeight,e.ips.forEach(a=>{if(r.IPColocationFactorWhitelist.has(a))return;let c=i.get(a),u=c?c.size:0;if(u>r.IPColocationFactorThreshold){let f=u-r.IPColocationFactorThreshold;n+=f*f*r.IPColocationFactorWeight}}),n+=e.behaviourPenalty*e.behaviourPenalty*r.behaviourPenaltyWeight,n}k8.computeScore=zqe});var pse=m((W8t,hse)=>{l();"use strict";function ri(t,e){var e=e||{};this._head=0,this._tail=0,this._capacity=e.capacity,this._capacityMask=3,this._list=new Array(4),Array.isArray(t)&&this._fromArray(t)}ri.prototype.peekAt=function(e){var r=e;if(r===(r|0)){var i=this.size();if(!(r>=i||r<-i))return r<0&&(r+=i),r=this._head+r&this._capacityMask,this._list[r]}};ri.prototype.get=function(e){return this.peekAt(e)};ri.prototype.peek=function(){if(this._head!==this._tail)return this._list[this._head]};ri.prototype.peekFront=function(){return this.peek()};ri.prototype.peekBack=function(){return this.peekAt(-1)};Object.defineProperty(ri.prototype,"length",{get:function(){return this.size()}});ri.prototype.size=function(){return this._head===this._tail?0:this._head<this._tail?this._tail-this._head:this._capacityMask+1-(this._head-this._tail)};ri.prototype.unshift=function(e){if(e===void 0)return this.size();var r=this._list.length;return this._head=this._head-1+r&this._capacityMask,this._list[this._head]=e,this._tail===this._head&&this._growArray(),this._capacity&&this.size()>this._capacity&&this.pop(),this._head<this._tail?this._tail-this._head:this._capacityMask+1-(this._head-this._tail)};ri.prototype.shift=function(){var e=this._head;if(e!==this._tail){var r=this._list[e];return this._list[e]=void 0,this._head=e+1&this._capacityMask,e<2&&this._tail>1e4&&this._tail<=this._list.length>>>2&&this._shrinkArray(),r}};ri.prototype.push=function(e){if(e===void 0)return this.size();var r=this._tail;return this._list[r]=e,this._tail=r+1&this._capacityMask,this._tail===this._head&&this._growArray(),this._capacity&&this.size()>this._capacity&&this.shift(),this._head<this._tail?this._tail-this._head:this._capacityMask+1-(this._head-this._tail)};ri.prototype.pop=function(){var e=this._tail;if(e!==this._head){var r=this._list.length;this._tail=e-1+r&this._capacityMask;var i=this._list[this._tail];return this._list[this._tail]=void 0,this._head<2&&e>1e4&&e<=r>>>2&&this._shrinkArray(),i}};ri.prototype.removeOne=function(e){var r=e;if(r===(r|0)&&this._head!==this._tail){var i=this.size(),n=this._list.length;if(!(r>=i||r<-i)){r<0&&(r+=i),r=this._head+r&this._capacityMask;var s=this._list[r],o;if(e<i/2){for(o=e;o>0;o--)this._list[r]=this._list[r=r-1+n&this._capacityMask];this._list[r]=void 0,this._head=this._head+1+n&this._capacityMask}else{for(o=i-1-e;o>0;o--)this._list[r]=this._list[r=r+1+n&this._capacityMask];this._list[r]=void 0,this._tail=this._tail-1+n&this._capacityMask}return s}}};ri.prototype.remove=function(e,r){var i=e,n,s=r;if(i===(i|0)&&this._head!==this._tail){var o=this.size(),a=this._list.length;if(!(i>=o||i<-o||r<1)){if(i<0&&(i+=o),r===1||!r)return n=new Array(1),n[0]=this.removeOne(i),n;if(i===0&&i+r>=o)return n=this.toArray(),this.clear(),n;i+r>o&&(r=o-i);var c;for(n=new Array(r),c=0;c<r;c++)n[c]=this._list[this._head+i+c&this._capacityMask];if(i=this._head+i&this._capacityMask,e+r===o){for(this._tail=this._tail-r+a&this._capacityMask,c=r;c>0;c--)this._list[i=i+1+a&this._capacityMask]=void 0;return n}if(e===0){for(this._head=this._head+r+a&this._capacityMask,c=r-1;c>0;c--)this._list[i=i+1+a&this._capacityMask]=void 0;return n}if(i<o/2){for(this._head=this._head+e+r+a&this._capacityMask,c=e;c>0;c--)this.unshift(this._list[i=i-1+a&this._capacityMask]);for(i=this._head-1+a&this._capacityMask;s>0;)this._list[i=i-1+a&this._capacityMask]=void 0,s--;e<0&&(this._tail=i)}else{for(this._tail=i,i=i+r+a&this._capacityMask,c=o-(r+e);c>0;c--)this.push(this._list[i++]);for(i=this._tail;s>0;)this._list[i=i+1+a&this._capacityMask]=void 0,s--}return this._head<2&&this._tail>1e4&&this._tail<=a>>>2&&this._shrinkArray(),n}}};ri.prototype.splice=function(e,r){var i=e;if(i===(i|0)){var n=this.size();if(i<0&&(i+=n),!(i>n))if(arguments.length>2){var s,o,a,c=arguments.length,u=this._list.length,f=2;if(!n||i<n/2){for(o=new Array(i),s=0;s<i;s++)o[s]=this._list[this._head+s&this._capacityMask];for(r===0?(a=[],i>0&&(this._head=this._head+i+u&this._capacityMask)):(a=this.remove(i,r),this._head=this._head+i+u&this._capacityMask);c>f;)this.unshift(arguments[--c]);for(s=i;s>0;s--)this.unshift(o[s-1])}else{o=new Array(n-(i+r));var d=o.length;for(s=0;s<d;s++)o[s]=this._list[this._head+i+r+s&this._capacityMask];for(r===0?(a=[],i!=n&&(this._tail=this._head+i+u&this._capacityMask)):(a=this.remove(i,r),this._tail=this._tail-d+u&this._capacityMask);f<c;)this.push(arguments[f++]);for(s=0;s<d;s++)this.push(o[s])}return a}else return this.remove(i,r)}};ri.prototype.clear=function(){this._head=0,this._tail=0};ri.prototype.isEmpty=function(){return this._head===this._tail};ri.prototype.toArray=function(){return this._copyArray(!1)};ri.prototype._fromArray=function(e){for(var r=0;r<e.length;r++)this.push(e[r])};ri.prototype._copyArray=function(e){var r=[],i=this._list,n=i.length,s;if(e||this._head>this._tail){for(s=this._head;s<n;s++)r.push(i[s]);for(s=0;s<this._tail;s++)r.push(i[s])}else for(s=this._head;s<this._tail;s++)r.push(i[s]);return r};ri.prototype._growArray=function(){this._head&&(this._list=this._copyArray(!0),this._head=0),this._tail=this._list.length,this._list.length<<=1,this._capacityMask=this._capacityMask<<1|1};ri.prototype._shrinkArray=function(){this._list.length>>>=1,this._capacityMask>>>=1};hse.exports=ri});var mse=m(xu=>{l();"use strict";var Hqe=xu&&xu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(xu,"__esModule",{value:!0});xu.MessageDeliveries=xu.DeliveryRecordStatus=void 0;var Gqe=Zd(),$qe=Hqe(pse()),Wqe=Jd(),yse;(function(t){t[t.unknown=0]="unknown",t[t.valid=1]="valid",t[t.invalid=2]="invalid",t[t.ignored=3]="ignored"})(yse=xu.DeliveryRecordStatus||(xu.DeliveryRecordStatus={}));var gse=class{constructor(){this.records=new Map,this.queue=new $qe.default}ensureRecord(e){let r=Wqe.messageIdToString(e),i=this.records.get(r);if(i)return i;i={status:yse.unknown,firstSeen:Date.now(),validated:0,peers:new Set},this.records.set(r,i);let n={msgId:r,expire:Date.now()+Gqe.TimeCacheDuration};return this.queue.push(n),i}gc(){let e=Date.now(),r=this.queue.peekFront();for(;r&&r.expire<e;)this.records.delete(r.msgId),this.queue.shift(),r=this.queue.peekFront()}clear(){this.records.clear(),this.queue.clear()}};xu.MessageDeliveries=gse});var vse=m(ol=>{l();"use strict";var D8=ol&&ol.__awaiter||function(t,e,r,i){function n(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{u(i.next(f))}catch(d){o(d)}}function c(f){try{u(i.throw(f))}catch(d){o(d)}}function u(f){f.done?s(f.value):n(f.value).then(a,c)}u((i=i.apply(t,e||[])).next())})},Yqe=ol&&ol.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ol,"__esModule",{value:!0});ol.PeerScore=void 0;var Xqe=LT(),s1=lse(),Qqe=dse(),da=mse(),Zqe=Zd(),Jqe=Yqe(it()),eje=Ee(),tje=v8(),{ERR_INVALID_SIGNATURE:rje,ERR_MISSING_SIGNATURE:ije}=tje.codes,o1=eje("libp2p:gossipsub:score"),bse=class{constructor(e,r,i){Xqe.validatePeerScoreParams(e),this.params=e,this._connectionManager=r,this.peerStats=new Map,this.peerIPs=new Map,this.deliveryRecords=new da.MessageDeliveries,this.msgId=i}start(){if(this._backgroundInterval){o1("Peer score already running");return}this._backgroundInterval=setInterval(()=>this.background(),this.params.decayInterval),o1("started")}stop(){if(!this._backgroundInterval){o1("Peer score already stopped");return}clearInterval(this._backgroundInterval),delete this._backgroundInterval,this.peerIPs.clear(),this.peerStats.clear(),this.deliveryRecords.clear(),o1("stopped")}background(){this._refreshScores(),this._updateIPs(),this.deliveryRecords.gc()}_refreshScores(){let e=Date.now(),r=this.params.decayToZero;this.peerStats.forEach((i,n)=>{if(!i.connected){e>i.expire&&(this._removeIPs(n,i.ips),this.peerStats.delete(n));return}Object.entries(i.topics).forEach(([s,o])=>{let a=this.params.topics[s];!a||(o.firstMessageDeliveries*=a.firstMessageDeliveriesDecay,o.firstMessageDeliveries<r&&(o.firstMessageDeliveries=0),o.meshMessageDeliveries*=a.meshMessageDeliveriesDecay,o.meshMessageDeliveries<r&&(o.meshMessageDeliveries=0),o.meshFailurePenalty*=a.meshFailurePenaltyDecay,o.meshFailurePenalty<r&&(o.meshFailurePenalty=0),o.invalidMessageDeliveries*=a.invalidMessageDeliveriesDecay,o.invalidMessageDeliveries<r&&(o.invalidMessageDeliveries=0),o.inMesh&&(o.meshTime=e-o.graftTime,o.meshTime>a.meshMessageDeliveriesActivation&&(o.meshMessageDeliveriesActive=!0)))}),i.behaviourPenalty*=this.params.behaviourPenaltyDecay,i.behaviourPenalty<r&&(i.behaviourPenalty=0)})}score(e){let r=this.peerStats.get(e);return r?Qqe.computeScore(e,r,this.params,this.peerIPs):0}addPenalty(e,r){let i=this.peerStats.get(e);!i||(i.behaviourPenalty+=r)}addPeer(e){let r=s1.createPeerStats({connected:!0});this.peerStats.set(e,r);let i=this._getIPs(e);this._setIPs(e,i,r.ips),r.ips=i}removePeer(e){let r=this.peerStats.get(e);if(!!r){if(this.score(e)>0){this._removeIPs(e,r.ips),this.peerStats.delete(e);return}Object.entries(r.topics).forEach(([i,n])=>{n.firstMessageDeliveries=0;let s=this.params.topics[i].meshMessageDeliveriesThreshold;if(n.inMesh&&n.meshMessageDeliveriesActive&&n.meshMessageDeliveries<s){let o=s-n.meshMessageDeliveries;n.meshFailurePenalty+=o*o}n.inMesh=!1}),r.connected=!1,r.expire=Date.now()+this.params.retainScore}}graft(e,r){let i=this.peerStats.get(e);if(!i)return;let n=s1.ensureTopicStats(r,i,this.params);!n||(n.inMesh=!0,n.graftTime=Date.now(),n.meshTime=0,n.meshMessageDeliveriesActive=!1)}prune(e,r){let i=this.peerStats.get(e);if(!i)return;let n=s1.ensureTopicStats(r,i,this.params);if(!n)return;let s=this.params.topics[r].meshMessageDeliveriesThreshold;if(n.meshMessageDeliveriesActive&&n.meshMessageDeliveries<s){let o=s-n.meshMessageDeliveries;n.meshFailurePenalty+=o*o}n.inMesh=!1}validateMessage(e){return D8(this,void 0,void 0,function*(){this.deliveryRecords.ensureRecord(yield this.msgId(e))})}deliverMessage(e){return D8(this,void 0,void 0,function*(){let r=e.receivedFrom;this._markFirstMessageDelivery(r,e);let i=this.deliveryRecords.ensureRecord(yield this.msgId(e)),n=Date.now();if(i.status!==da.DeliveryRecordStatus.unknown){o1("unexpected delivery: message from %s was first seen %s ago and has delivery status %d",r,n-i.firstSeen,da.DeliveryRecordStatus[i.status]);return}i.status=da.DeliveryRecordStatus.valid,i.validated=n,i.peers.forEach(s=>{s!==r&&this._markDuplicateMessageDelivery(s,e)})})}rejectMessage(e,r){return D8(this,void 0,void 0,function*(){let i=e.receivedFrom;switch(r){case ije:case rje:this._markInvalidMessageDelivery(i,e);return}let n=this.deliveryRecords.ensureRecord(yield this.msgId(e));if(n.status!==da.DeliveryRecordStatus.unknown){o1("unexpected rejection: message from %s was first seen %s ago and has delivery status %d",i,Date.now()-n.firstSeen,da.DeliveryRecordStatus[n.status]);return}switch(r){case Zqe.ERR_TOPIC_VALIDATOR_IGNORE:n.status=da.DeliveryRecordStatus.ignored;return}n.status=da.DeliveryRecordStatus.invalid,this._markInvalidMessageDelivery(i,e),n.peers.forEach(s=>{this._markInvalidMessageDelivery(s,e)})})}duplicateMessage(e){return D8(this,void 0,void 0,function*(){let r=e.receivedFrom,i=this.deliveryRecords.ensureRecord(yield this.msgId(e));if(!i.peers.has(r))switch(i.status){case da.DeliveryRecordStatus.unknown:i.peers.add(r);break;case da.DeliveryRecordStatus.valid:i.peers.add(r),this._markDuplicateMessageDelivery(r,e,i.validated);break;case da.DeliveryRecordStatus.invalid:this._markInvalidMessageDelivery(r,e);break}})}_markInvalidMessageDelivery(e,r){let i=this.peerStats.get(e);!i||r.topicIDs.forEach(n=>{let s=s1.ensureTopicStats(n,i,this.params);!s||(s.invalidMessageDeliveries+=1)})}_markFirstMessageDelivery(e,r){let i=this.peerStats.get(e);!i||r.topicIDs.forEach(n=>{let s=s1.ensureTopicStats(n,i,this.params);if(!s)return;let o=this.params.topics[n].firstMessageDeliveriesCap;s.firstMessageDeliveries+=1,s.firstMessageDeliveries>o&&(s.firstMessageDeliveries=o),!!s.inMesh&&(o=this.params.topics[n].meshMessageDeliveriesCap,s.meshMessageDeliveries+=1,s.meshMessageDeliveries>o&&(s.meshMessageDeliveries=o))})}_markDuplicateMessageDelivery(e,r,i=0){let n=this.peerStats.get(e);if(!n)return;let s=i?Date.now():0;r.topicIDs.forEach(o=>{let a=s1.ensureTopicStats(o,n,this.params);if(!a||!a.inMesh)return;let c=this.params.topics[o];if(i&&s>i+c.meshMessageDeliveriesWindow)return;let u=c.meshMessageDeliveriesCap;a.meshMessageDeliveries+=1,a.meshMessageDeliveries>u&&(a.meshMessageDeliveries=u)})}_getIPs(e){return this._connectionManager.getAll(Jqe.default.createFromB58String(e)).map(r=>r.remoteAddr.toOptions().host)}_setIPs(e,r,i){e:for(let n of r){for(let o of i)if(n===o)continue e;let s=this.peerIPs.get(n);s||(s=new Set,this.peerIPs.set(n,s)),s.add(e)}e:for(let n of i){for(let o of r)if(n===o)continue e;let s=this.peerIPs.get(n);!s||(s.delete(e),s.size||this.peerIPs.delete(n))}}_removeIPs(e,r){r.forEach(i=>{let n=this.peerIPs.get(i);!n||(n.delete(e),n.size||this.peerIPs.delete(i))})}_updateIPs(){this.peerStats.forEach((e,r)=>{let i=this._getIPs(r);this._setIPs(r,i,e.ips),e.ips=i})}};ol.PeerScore=bse});var wse=m(Au=>{l();"use strict";var nje=Au&&Au.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),jT=Au&&Au.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&nje(e,t,r)};Object.defineProperty(Au,"__esModule",{value:!0});jT(LT(),Au);jT(fse(),Au);jT(vse(),Au)});var Sse=m(a1=>{l();"use strict";var _se=a1&&a1.__awaiter||function(t,e,r,i){function n(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{u(i.next(f))}catch(d){o(d)}}function c(f){try{u(i.throw(f))}catch(d){o(d)}}function u(f){f.done?s(f.value):n(f.value).then(a,c)}u((i=i.apply(t,e||[])).next())})};Object.defineProperty(a1,"__esModule",{value:!0});a1.IWantTracer=void 0;var sje=Zd(),UT=Jd(),oje=v8(),{ERR_INVALID_SIGNATURE:aje,ERR_MISSING_SIGNATURE:cje}=oje.codes,Ese=class{constructor(e){this.getMsgId=e,this.promises=new Map}addPromise(e,r){let i=Math.floor(Math.random()*r.length),n=r[i],s=UT.messageIdToString(n),o=this.promises.get(s);o||(o=new Map,this.promises.set(s,o)),o.has(e)||o.set(e,Date.now()+sje.GossipsubIWantFollowupTime)}getBrokenPromises(){let e=Date.now(),r=new Map;return this.promises.forEach((i,n)=>{i.forEach((s,o)=>{s<e&&(r.set(o,(r.get(o)||0)+1),i.delete(o))}),i.size||this.promises.delete(n)}),r}deliverMessage(e){return _se(this,void 0,void 0,function*(){let r=yield this.getMsgId(e),i=UT.messageIdToString(r);this.promises.delete(i)})}rejectMessage(e,r){return _se(this,void 0,void 0,function*(){switch(r){case aje:case cje:return}let i=yield this.getMsgId(e),n=UT.messageIdToString(i);this.promises.delete(n)})}clear(){this.promises.clear()}};a1.IWantTracer=Ese});var Rse=m((J8t,Tse)=>{l();var xse="Expected a function",Ase=0/0,uje="[object Symbol]",fje=/^\s+|\s+$/g,lje=/^[-+]0x[0-9a-f]+$/i,dje=/^0b[01]+$/i,hje=/^0o[0-7]+$/i,pje=parseInt,yje=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis,gje=typeof self=="object"&&self&&self.Object===Object&&self,mje=yje||gje||Function("return this")(),bje=Object.prototype,vje=bje.toString,wje=Math.max,_je=Math.min,FT=function(){return mje.Date.now()};function Eje(t,e,r){var i,n,s,o,a,c,u=0,f=!1,d=!1,h=!0;if(typeof t!="function")throw new TypeError(xse);e=Ise(e)||0,B8(r)&&(f=!!r.leading,d="maxWait"in r,s=d?wje(Ise(r.maxWait)||0,e):s,h="trailing"in r?!!r.trailing:h);function p(B){var H=i,W=n;return i=n=void 0,u=B,o=t.apply(W,H),o}function y(B){return u=B,a=setTimeout(v,e),f?p(B):o}function b(B){var H=B-c,W=B-u,X=e-H;return d?_je(X,s-W):X}function E(B){var H=B-c,W=B-u;return c===void 0||H>=e||H<0||d&&W>=s}function v(){var B=FT();if(E(B))return A(B);a=setTimeout(v,b(B))}function A(B){return a=void 0,h&&i?p(B):(i=n=void 0,o)}function R(){a!==void 0&&clearTimeout(a),u=0,i=c=n=a=void 0}function F(){return a===void 0?o:A(FT())}function D(){var B=FT(),H=E(B);if(i=arguments,n=this,c=B,H){if(a===void 0)return y(c);if(d)return a=setTimeout(v,e),p(c)}return a===void 0&&(a=setTimeout(v,e)),o}return D.cancel=R,D.flush=F,D}function Sje(t,e,r){var i=!0,n=!0;if(typeof t!="function")throw new TypeError(xse);return B8(r)&&(i="leading"in r?!!r.leading:i,n="trailing"in r?!!r.trailing:n),Eje(t,e,{leading:i,maxWait:e,trailing:n})}function B8(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function xje(t){return!!t&&typeof t=="object"}function Aje(t){return typeof t=="symbol"||xje(t)&&vje.call(t)==uje}function Ise(t){if(typeof t=="number")return t;if(Aje(t))return Ase;if(B8(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=B8(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(fje,"");var r=dje.test(t);return r||hje.test(t)?pje(t.slice(2),r?2:8):lje.test(t)?Ase:+t}Tse.exports=Sje});var Ose=m((Pse,Cse)=>{l();"use strict";var Ije=Rse();Pse=Cse.exports=KT;function KT(t){if(!(this instanceof KT))return new KT(t);t=t||{};let e=t.validity||30,r=new Map,i=Ije(()=>{r.forEach((n,s)=>{let o=n.validity||e;Tje(n.timestamp)>o&&r.delete(s)})},200);this.put=(n,s,o)=>{this.has(n)||r.set(n,{value:s,timestamp:new Date,validity:o}),i()},this.get=n=>{if(r.has(n))return r.get(n).value;throw new Error("key does not exist")},this.has=n=>r.has(n)}function Tje(t){let r=new Date().getTime()-t.getTime();return Math.floor(r/1e3)}});var _r=m((evt,Dse)=>{l();"use strict";function kse(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function Rje(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return kse(t,r)}catch(i){r.message=t.message,r.stack=t.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(t)),kse(new n,r)}}Dse.exports=Rje});var _i=m(VT=>{l();"use strict";VT.messages={NOT_STARTED_YET:"The libp2p node is not started yet",DHT_DISABLED:"DHT is not available",CONN_ENCRYPTION_REQUIRED:"At least one connection encryption module is required"};VT.codes={DHT_DISABLED:"ERR_DHT_DISABLED",PUBSUB_NOT_STARTED:"ERR_PUBSUB_NOT_STARTED",DHT_NOT_STARTED:"ERR_DHT_NOT_STARTED",CONN_ENCRYPTION_REQUIRED:"ERR_CONN_ENCRYPTION_REQUIRED",ERR_INVALID_PROTOCOLS_FOR_STREAM:"ERR_INVALID_PROTOCOLS_FOR_STREAM",ERR_CONNECTION_ENDED:"ERR_CONNECTION_ENDED",ERR_CONNECTION_FAILED:"ERR_CONNECTION_FAILED",ERR_NODE_NOT_STARTED:"ERR_NODE_NOT_STARTED",ERR_ALREADY_ABORTED:"ERR_ALREADY_ABORTED",ERR_TOO_MANY_ADDRESSES:"ERR_TOO_MANY_ADDRESSES",ERR_NO_VALID_ADDRESSES:"ERR_NO_VALID_ADDRESSES",ERR_RELAYED_DIAL:"ERR_RELAYED_DIAL",ERR_DIALED_SELF:"ERR_DIALED_SELF",ERR_DISCOVERED_SELF:"ERR_DISCOVERED_SELF",ERR_DUPLICATE_TRANSPORT:"ERR_DUPLICATE_TRANSPORT",ERR_ENCRYPTION_FAILED:"ERR_ENCRYPTION_FAILED",ERR_HOP_REQUEST_FAILED:"ERR_HOP_REQUEST_FAILED",ERR_INVALID_KEY:"ERR_INVALID_KEY",ERR_INVALID_MESSAGE:"ERR_INVALID_MESSAGE",ERR_INVALID_PARAMETERS:"ERR_INVALID_PARAMETERS",ERR_INVALID_PEER:"ERR_INVALID_PEER",ERR_MUXER_UNAVAILABLE:"ERR_MUXER_UNAVAILABLE",ERR_TIMEOUT:"ERR_TIMEOUT",ERR_TRANSPORT_UNAVAILABLE:"ERR_TRANSPORT_UNAVAILABLE",ERR_TRANSPORT_DIAL_FAILED:"ERR_TRANSPORT_DIAL_FAILED",ERR_UNSUPPORTED_PROTOCOL:"ERR_UNSUPPORTED_PROTOCOL",ERR_INVALID_MULTIADDR:"ERR_INVALID_MULTIADDR",ERR_SIGNATURE_NOT_VALID:"ERR_SIGNATURE_NOT_VALID"}});var Mse=m((rvt,Nse)=>{l();"use strict";var c1=Vi(),Bse=c1.Reader,Pje=c1.Writer,Cr=c1.util,lm=c1.roots["libp2p-envelope"]||(c1.roots["libp2p-envelope"]={});lm.Envelope=function(){function t(e){if(e)for(var r=Object.keys(e),i=0;i<r.length;++i)e[r[i]]!=null&&(this[r[i]]=e[r[i]])}return t.prototype.publicKey=Cr.newBuffer([]),t.prototype.payloadType=Cr.newBuffer([]),t.prototype.payload=Cr.newBuffer([]),t.prototype.signature=Cr.newBuffer([]),t.encode=function(r,i){return i||(i=Pje.create()),r.publicKey!=null&&Object.hasOwnProperty.call(r,"publicKey")&&i.uint32(10).bytes(r.publicKey),r.payloadType!=null&&Object.hasOwnProperty.call(r,"payloadType")&&i.uint32(18).bytes(r.payloadType),r.payload!=null&&Object.hasOwnProperty.call(r,"payload")&&i.uint32(26).bytes(r.payload),r.signature!=null&&Object.hasOwnProperty.call(r,"signature")&&i.uint32(42).bytes(r.signature),i},t.decode=function(r,i){r instanceof Bse||(r=Bse.create(r));for(var n=i===void 0?r.len:r.pos+i,s=new lm.Envelope;r.pos<n;){var o=r.uint32();switch(o>>>3){case 1:s.publicKey=r.bytes();break;case 2:s.payloadType=r.bytes();break;case 3:s.payload=r.bytes();break;case 5:s.signature=r.bytes();break;default:r.skipType(o&7);break}}return s},t.fromObject=function(r){if(r instanceof lm.Envelope)return r;var i=new lm.Envelope;return r.publicKey!=null&&(typeof r.publicKey=="string"?Cr.base64.decode(r.publicKey,i.publicKey=Cr.newBuffer(Cr.base64.length(r.publicKey)),0):r.publicKey.length&&(i.publicKey=r.publicKey)),r.payloadType!=null&&(typeof r.payloadType=="string"?Cr.base64.decode(r.payloadType,i.payloadType=Cr.newBuffer(Cr.base64.length(r.payloadType)),0):r.payloadType.length&&(i.payloadType=r.payloadType)),r.payload!=null&&(typeof r.payload=="string"?Cr.base64.decode(r.payload,i.payload=Cr.newBuffer(Cr.base64.length(r.payload)),0):r.payload.length&&(i.payload=r.payload)),r.signature!=null&&(typeof r.signature=="string"?Cr.base64.decode(r.signature,i.signature=Cr.newBuffer(Cr.base64.length(r.signature)),0):r.signature.length&&(i.signature=r.signature)),i},t.toObject=function(r,i){i||(i={});var n={};return i.defaults&&(i.bytes===String?n.publicKey="":(n.publicKey=[],i.bytes!==Array&&(n.publicKey=Cr.newBuffer(n.publicKey))),i.bytes===String?n.payloadType="":(n.payloadType=[],i.bytes!==Array&&(n.payloadType=Cr.newBuffer(n.payloadType))),i.bytes===String?n.payload="":(n.payload=[],i.bytes!==Array&&(n.payload=Cr.newBuffer(n.payload))),i.bytes===String?n.signature="":(n.signature=[],i.bytes!==Array&&(n.signature=Cr.newBuffer(n.signature)))),r.publicKey!=null&&r.hasOwnProperty("publicKey")&&(n.publicKey=i.bytes===String?Cr.base64.encode(r.publicKey,0,r.publicKey.length):i.bytes===Array?Array.prototype.slice.call(r.publicKey):r.publicKey),r.payloadType!=null&&r.hasOwnProperty("payloadType")&&(n.payloadType=i.bytes===String?Cr.base64.encode(r.payloadType,0,r.payloadType.length):i.bytes===Array?Array.prototype.slice.call(r.payloadType):r.payloadType),r.payload!=null&&r.hasOwnProperty("payload")&&(n.payload=i.bytes===String?Cr.base64.encode(r.payload,0,r.payload.length):i.bytes===Array?Array.prototype.slice.call(r.payload):r.payload),r.signature!=null&&r.hasOwnProperty("signature")&&(n.signature=i.bytes===String?Cr.base64.encode(r.signature,0,r.signature.length):i.bytes===Array?Array.prototype.slice.call(r.signature):r.signature),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,c1.util.toJSONOptions)},t}();Nse.exports=lm});var dm=m((ivt,jse)=>{l();"use strict";var Cje=_r(),{concat:Oje}=(mn(),$s),{fromString:kje}=(dt(),bi),Dje=R4(),Bje=it(),zT=Es(),{equals:N8}=(wi(),bn),{codes:Nje}=_i(),{Envelope:Lse}=Mse(),al=class{constructor({peerId:e,payloadType:r,payload:i,signature:n}){this.peerId=e,this.payloadType=r,this.payload=i,this.signature=n,this._marshal=void 0}marshal(){if(this._marshal)return this._marshal;let e=Dje.marshalPublicKey(this.peerId.pubKey);return this._marshal=Lse.encode({publicKey:e,payloadType:this.payloadType,payload:this.payload,signature:this.signature}).finish(),this._marshal}equals(e){return N8(this.peerId.pubKey.bytes,e.peerId.pubKey.bytes)&&N8(this.payloadType,e.payloadType)&&N8(this.payload,e.payload)&&N8(this.signature,e.signature)}validate(e){let r=qse(e,this.payloadType,this.payload);return this.peerId.pubKey.verify(r,this.signature)}},qse=(t,e,r)=>{let i=kje(t),n=zT.encode(i.byteLength),s=zT.encode(e.length),o=zT.encode(r.length);return Oje([new Uint8Array(n),i,new Uint8Array(s),e,new Uint8Array(o),r])};al.createFromProtobuf=async t=>{let e=Lse.decode(t),r=await Bje.createFromPubKey(e.publicKey);return new al({peerId:r,payloadType:e.payloadType,payload:e.payload,signature:e.signature})};al.seal=async(t,e)=>{let r=t.domain,i=t.codec,n=t.marshal(),s=qse(r,i,n),o=await e.privKey.sign(s);return new al({peerId:e,payloadType:i,payload:n,signature:o})};al.openAndCertify=async(t,e)=>{let r=await al.createFromProtobuf(t);if(!await r.validate(e))throw Cje(new Error("envelope signature is not valid for the given domain"),Nje.ERR_SIGNATURE_NOT_VALID);return r};jse.exports=al});var XT=m((Iu,Fse)=>{l();"use strict";var Mje=Iu&&Iu.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),Lje=Iu&&Iu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Use=Iu&&Iu.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Mje(e,t,r);return Lje(e,t),e},u1=Iu&&Iu.__awaiter||function(t,e,r,i){function n(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{u(i.next(f))}catch(d){o(d)}}function c(f){try{u(i.throw(f))}catch(d){o(d)}}function u(f){f.done?s(f.value):n(f.value).then(a,c)}u((i=i.apply(t,e||[])).next())})},HT=Use($ne()),qje=ese(),GT=rse(),Kt=Use(Zd()),jje=sse(),M8=BT(),Ji=Jd(),$T=wse(),Uje=Sse(),Fje=Ose(),WT=it(),Kje=dm(),YT=class extends HT.default{constructor(e,r={}){let i=[Kt.GossipsubIDv11,Kt.GossipsubIDv10],n=Object.assign(Object.assign({gossipIncoming:!0,fallbackToFloodsub:!0,floodPublish:!0,doPX:!1,directPeers:[],D:Kt.GossipsubD,Dlo:Kt.GossipsubDlo,Dhi:Kt.GossipsubDhi,Dscore:Kt.GossipsubDscore,Dout:Kt.GossipsubDout,Dlazy:Kt.GossipsubDlazy},r),{scoreParams:$T.createPeerScoreParams(r.scoreParams),scoreThresholds:$T.createPeerScoreThresholds(r.scoreThresholds)});n.fallbackToFloodsub&&i.push(Kt.FloodsubID);super(Object.assign({debugName:"libp2p:gossipsub",multicodecs:i,libp2p:e},n));this._options=n,this.direct=new Set(n.directPeers.map(s=>s.id.toB58String())),n.directPeers.forEach(s=>{e.peerStore.addressBook.add(s.id,s.addrs)}),this.seenCache=new Fje,this.mesh=new Map,this.fanout=new Map,this.lastpub=new Map,this.gossip=new Map,this.control=new Map,this.peerhave=new Map,this.iasked=new Map,this.backoff=new Map,this.outbound=new Map,this.messageCache=r.messageCache||new qje.MessageCache(Kt.GossipsubHistoryGossip,Kt.GossipsubHistoryLength,this.getMsgId.bind(this)),this.heartbeat=new jje.Heartbeat(this),this.heartbeatTicks=0,this.gossipTracer=new Uje.IWantTracer(this.getMsgId.bind(this)),this._libp2p=e,this.score=new $T.PeerScore(this._options.scoreParams,e.connectionManager,this.getMsgId.bind(this))}_decodeRpc(e){return GT.RPC.decode(e)}_encodeRpc(e){return GT.RPC.encode(e).finish()}_addPeer(e,r){let i=super._addPeer(e,r);this.score.addPeer(e.toB58String());let n=!1;for(let s of this._libp2p.connectionManager.getAll(e))if(s.stat.direction==="outbound"&&Array.from(s.registry.values()).some(o=>r===o.protocol)){n=!0;break}return this.outbound.set(i.id.toB58String(),n),i}_removePeer(e){let r=super._removePeer(e),i=e.toB58String();for(let n of this.mesh.values())n.delete(i);for(let n of this.fanout.values())n.delete(i);return this.gossip.delete(i),this.control.delete(i),this.outbound.delete(i),this.score.removePeer(i),r}_processRpc(e,r,i){let n=Object.create(null,{_processRpc:{get:()=>super._processRpc}});return u1(this,void 0,void 0,function*(){return(yield n._processRpc.call(this,e,r,i))?(i.control&&this._processRpcControlMessage(e,i.control),!0):!1})}_processRpcControlMessage(e,r){if(!r)return;let i=r.ihave?this._handleIHave(e,r.ihave):[],n=r.iwant?this._handleIWant(e,r.iwant):[],s=r.graft?this._handleGraft(e,r.graft):[];if(r.prune&&this._handlePrune(e,r.prune),!i.length&&!n.length&&!s.length)return;let o=Ji.createGossipRpc(n,{iwant:i,prune:s});this._sendRpc(e,o)}_processRpcMessage(e){let r=Object.create(null,{_processRpcMessage:{get:()=>super._processRpcMessage}});return u1(this,void 0,void 0,function*(){let i=yield this.getMsgId(e),n=Ji.messageIdToString(i);if(this.seenCache.has(n)){this.score.duplicateMessage(e);return}this.seenCache.put(n),yield this.score.validateMessage(e),yield r._processRpcMessage.call(this,e)})}_acceptFrom(e){return this.direct.has(e)||this.score.score(e)>=this._options.scoreThresholds.graylistThreshold}validate(e){let r=Object.create(null,{validate:{get:()=>super.validate}});return u1(this,void 0,void 0,function*(){try{yield r.validate.call(this,e)}catch(i){throw this.score.rejectMessage(e,i.code),this.gossipTracer.rejectMessage(e,i.code),i}})}_handleIHave(e,r){if(!r.length)return[];let i=this.score.score(e);if(i<this._options.scoreThresholds.gossipThreshold)return this.log("IHAVE: ignoring peer %s with score below threshold [ score = %d ]",e,i),[];let n=(this.peerhave.get(e)||0)+1;if(this.peerhave.set(e,n),n>Kt.GossipsubMaxIHaveMessages)return this.log("IHAVE: peer %s has advertised too many times (%d) within this heartbeat interval; ignoring",e,n),[];let s=this.iasked.get(e)||0;if(s>=Kt.GossipsubMaxIHaveLength)return this.log("IHAVE: peer %s has already advertised too many messages (%d); ignoring",e,s),[];let o=new Map;if(r.forEach(({topicID:u,messageIDs:f})=>{!u||!f||!this.mesh.has(u)||f.forEach(d=>{let h=Ji.messageIdToString(d);this.seenCache.has(h)||o.set(h,d)})}),!o.size)return[];let a=o.size;a+s>Kt.GossipsubMaxIHaveLength&&(a=Kt.GossipsubMaxIHaveLength-s),this.log("IHAVE: Asking for %d out of %d messages from %s",a,o.size,e);let c=Array.from(o.values());return Ji.shuffle(c),c=c.slice(0,a),this.iasked.set(e,s+a),this.gossipTracer.addPromise(e,c),[{messageIDs:c}]}_handleIWant(e,r){if(!r.length)return[];let i=this.score.score(e);if(i<this._options.scoreThresholds.gossipThreshold)return this.log("IWANT: ignoring peer %s with score below threshold [score = %d]",e,i),[];let n=new Map;return r.forEach(({messageIDs:s})=>{s&&s.forEach(o=>{let[a,c]=this.messageCache.getForPeer(o,e);if(!!a){if(c>Kt.GossipsubGossipRetransmission){this.log("IWANT: Peer %s has asked for message %s too many times: ignoring request",e,o);return}n.set(Ji.messageIdToString(o),a)}})}),n.size?(this.log("IWANT: Sending %d messages to %s",n.size,e),Array.from(n.values()).map(HT.utils.normalizeOutRpcMessage)):[]}_handleGraft(e,r){let i=[],n=this.score.score(e),s=this._now(),o=this._options.doPX;return r.forEach(({topicID:a})=>{var c;if(!a)return;let u=this.mesh.get(a);if(!u){o=!1;return}if(u.has(e))return;if(this.direct.has(e)){this.log("GRAFT: ignoring request from direct peer %s",e),i.push(a),o=!1;return}let f=(c=this.backoff.get(a))===null||c===void 0?void 0:c.get(e);if(typeof f=="number"&&s<f){this.log("GRAFT: ignoring backed off peer %s",e),this.score.addPenalty(e,1),o=!1;let d=f+Kt.GossipsubGraftFloodThreshold-Kt.GossipsubPruneBackoff;s<d&&this.score.addPenalty(e,1),this._addBackoff(e,a),i.push(a);return}if(n<0){this.log("GRAFT: ignoring peer %s with negative score: score=%d, topic=%s",e,n,a),i.push(a),o=!1,this._addBackoff(e,a);return}if(u.size>=this._options.Dhi&&!this.outbound.get(e)){i.push(a),this._addBackoff(e,a);return}this.log("GRAFT: Add mesh link from %s in %s",e,a),this.score.graft(e,a),u.add(e)}),i.length?i.map(a=>this._makePrune(e,a,o)):[]}_handlePrune(e,r){let i=this.score.score(e);r.forEach(({topicID:n,backoff:s,peers:o})=>{if(!n)return;let a=this.mesh.get(n);if(!!a&&(this.log("PRUNE: Remove mesh link to %s in %s",e,n),this.score.prune(e,n),a.delete(e),typeof s=="number"&&s>0?this._doAddBackoff(e,n,s*1e3):this._addBackoff(e,n),o&&o.length)){if(i<this._options.scoreThresholds.acceptPXThreshold){this.log("PRUNE: ignoring PX from peer %s with insufficient score [score = %d, topic = %s]",e,i,n);return}this._pxConnect(o)}})}_addBackoff(e,r){this._doAddBackoff(e,r,Kt.GossipsubPruneBackoff)}_doAddBackoff(e,r,i){let n=this.backoff.get(r);n||(n=new Map,this.backoff.set(r,n));let s=this._now()+i;(n.get(e)||0)<s&&n.set(e,s)}_applyIwantPenalties(){this.gossipTracer.getBrokenPromises().forEach((e,r)=>{this.log("peer %s didn't follow up in %d IWANT requests; adding penalty",r,e),this.score.addPenalty(r,e)})}_clearBackoff(){if(this.heartbeatTicks%Kt.GossipsubPruneBackoffTicks!=0)return;let e=this._now();this.backoff.forEach((r,i)=>{r.forEach((n,s)=>{n<e&&r.delete(s)}),r.size===0&&this.backoff.delete(i)})}_directConnect(){if(this.heartbeatTicks%Kt.GossipsubDirectConnectTicks!=0)return;let e=[];this.direct.forEach(r=>{let i=this.peers.get(r);(!i||!i.isWritable)&&e.push(r)}),e.length&&e.forEach(r=>{this._connect(r)})}_pxConnect(e){return u1(this,void 0,void 0,function*(){e.length>Kt.GossipsubPrunePeers&&(Ji.shuffle(e),e=e.slice(0,Kt.GossipsubPrunePeers));let r=[];yield Promise.all(e.map(i=>u1(this,void 0,void 0,function*(){if(!i.peerID)return;let s=WT.createFromBytes(i.peerID).toB58String();if(!this.peers.has(s)){if(!i.signedPeerRecord){r.push(s);return}try{let o=yield Kje.openAndCertify(i.signedPeerRecord,"libp2p-peer-record"),a=o.peerId.toB58String();if(s!==a){this.log("bogus peer record obtained through px: peer ID %s doesn't match expected peer %s",a,s);return}if(!this._libp2p.peerStore.addressBook.consumePeerRecord(o)){this.log("bogus peer record obtained through px: could not add peer record to address book");return}r.push(s)}catch(o){this.log("bogus peer record obtained through px: invalid signature or not a peer record")}}}))),!!r.length&&r.forEach(i=>this._connect(i))})}start(){super.start(),this.heartbeat.start(),this.score.start(),this._directPeerInitial=setTimeout(()=>{this.direct.forEach(e=>{this._connect(e)})},Kt.GossipsubDirectConnectInitialDelay)}stop(){super.stop(),this.heartbeat.stop(),this.score.stop(),this.mesh=new Map,this.fanout=new Map,this.lastpub=new Map,this.gossip=new Map,this.control=new Map,this.peerhave=new Map,this.iasked=new Map,this.backoff=new Map,this.outbound=new Map,this.gossipTracer.clear(),clearTimeout(this._directPeerInitial)}_connect(e){this.log("Initiating connection with %s",e),this._libp2p.dialProtocol(WT.createFromB58String(e),this.multicodecs)}subscribe(e){super.subscribe(e),this.join(e)}unsubscribe(e){super.unsubscribe(e),this.leave(e)}join(e){if(!this.started)throw new Error("Gossipsub has not started");this.log("JOIN %s",e);let r=this.fanout.get(e);if(r)r.forEach(i=>{this.score.score(i)<0&&r.delete(i)}),r.size<this._options.D&&M8.getGossipPeers(this,e,this._options.D-r.size,i=>!r.has(i)&&!this.direct.has(i)&&this.score.score(i)>=0).forEach(i=>r.add(i)),this.mesh.set(e,r),this.fanout.delete(e),this.lastpub.delete(e);else{let i=M8.getGossipPeers(this,e,this._options.D,n=>!this.direct.has(n)&&this.score.score(n)>=0);this.mesh.set(e,i)}this.mesh.get(e).forEach(i=>{this.log("JOIN: Add mesh link to %s in %s",i,e),this._sendGraft(i,e)})}leave(e){if(!this.started)throw new Error("Gossipsub has not started");this.log("LEAVE %s",e);let r=this.mesh.get(e);r&&(r.forEach(i=>{this.log("LEAVE: Remove mesh link to %s in %s",i,e),this._sendPrune(i,e)}),this.mesh.delete(e))}_publish(e){return u1(this,void 0,void 0,function*(){e.receivedFrom!==this.peerId.toB58String()&&(this.score.deliverMessage(e),this.gossipTracer.deliverMessage(e));let r=yield this.getMsgId(e),i=Ji.messageIdToString(r);this.seenCache.put(i),this.messageCache.put(e);let n=new Set;e.topicIDs.forEach(o=>{let a=this.topics.get(o);if(!!a)if(this._options.floodPublish&&e.from===this.peerId.toB58String())a.forEach(c=>{(this.direct.has(c)||this.score.score(c)>=this._options.scoreThresholds.publishThreshold)&&n.add(c)});else{this.direct.forEach(u=>{n.add(u)}),a.forEach(u=>{let f=this.score.score(u),d=this.peers.get(u);!d||d.protocol===Kt.FloodsubID&&f>=this._options.scoreThresholds.publishThreshold&&n.add(u)});let c=this.mesh.get(o);if(!c||!c.size){if(c=this.fanout.get(o),!c){let u=M8.getGossipPeers(this,o,this._options.D,f=>this.score.score(f)>=this._options.scoreThresholds.publishThreshold);u.size>0?(c=u,this.fanout.set(o,u)):c=new Set}this.lastpub.set(o,this._now())}c.forEach(u=>{n.add(u)})}});let s=Ji.createGossipRpc([HT.utils.normalizeOutRpcMessage(e)]);n.forEach(o=>{o!==e.from&&this._sendRpc(o,s)})})}_sendGraft(e,r){let i=[{topicID:r}],n=Ji.createGossipRpc([],{graft:i});this._sendRpc(e,n)}_sendPrune(e,r){let i=[this._makePrune(e,r,this._options.doPX)],n=Ji.createGossipRpc([],{prune:i});this._sendRpc(e,n)}_sendRpc(e,r){let i=this.peers.get(e);if(!i||!i.isWritable)return;let n=this.control.get(e);n&&(this._piggybackControl(e,r,n),this.control.delete(e));let s=this.gossip.get(e);s&&(this._piggybackGossip(e,r,s),this.gossip.delete(e)),i.write(GT.RPC.encode(r).finish())}_piggybackControl(e,r,i){let n=(i.graft||[]).filter(({topicID:o})=>(o&&this.mesh.get(o)||new Set).has(e)),s=(i.prune||[]).filter(({topicID:o})=>!(o&&this.mesh.get(o)||new Set).has(e));!n.length&&!s.length||(r.control?(r.control.graft=r.control.graft&&r.control.graft.concat(n),r.control.prune=r.control.prune&&r.control.prune.concat(s)):r.control={ihave:[],iwant:[],graft:n,prune:s})}_piggybackGossip(e,r,i){r.control||(r.control={ihave:[],iwant:[],graft:[],prune:[]}),r.control.ihave=i}_sendGraftPrune(e,r,i){let n=this._options.doPX;for(let[s,o]of e){let a=o.map(d=>({topicID:d})),c=[],u=r.get(s);u&&(c=u.map(d=>this._makePrune(s,d,n&&!i.get(s))),r.delete(s));let f=Ji.createGossipRpc([],{graft:a,prune:c});this._sendRpc(s,f)}for(let[s,o]of r){let a=o.map(u=>this._makePrune(s,u,n&&!i.get(s))),c=Ji.createGossipRpc([],{prune:a});this._sendRpc(s,c)}}_emitGossip(e,r){let i=this.messageCache.getGossipIDs(e);if(!i.length)return;Ji.shuffle(i),i.length>Kt.GossipsubMaxIHaveLength&&this.log("too many messages for gossip; will truncate IHAVE list (%d messages)",i.length);let n=[],s=this.topics.get(e);if(!s)return;s.forEach(c=>{let u=this.peers.get(c);!u||!r.has(c)&&!this.direct.has(c)&&Ji.hasGossipProtocol(u.protocol)&&this.score.score(c)>=this._options.scoreThresholds.gossipThreshold&&n.push(c)});let o=this._options.Dlazy,a=Kt.GossipsubGossipFactor*n.length;a>o&&(o=a),o>n.length?o=n.length:Ji.shuffle(n),n.slice(0,o).forEach(c=>{let u=i;i.length>Kt.GossipsubMaxIHaveLength&&(u=Ji.shuffle(u.slice()).slice(0,Kt.GossipsubMaxIHaveLength)),this._pushGossip(c,{topicID:e,messageIDs:u})})}_flush(){for(let[e,r]of this.gossip.entries()){this.gossip.delete(e);let i=Ji.createGossipRpc([],{ihave:r});this._sendRpc(e,i)}for(let[e,r]of this.control.entries()){this.control.delete(e);let i=Ji.createGossipRpc([],{graft:r.graft,prune:r.prune});this._sendRpc(e,i)}}_pushGossip(e,r){this.log("Add gossip to %s",e);let i=this.gossip.get(e)||[];this.gossip.set(e,i.concat(r))}_now(){return Date.now()}_makePrune(e,r,i){if(this.peers.get(e).protocol===Kt.GossipsubIDv10)return{topicID:r,peers:[]};let n=Kt.GossipsubPruneBackoff/1e3,s=[];return i&&M8.getGossipPeers(this,r,Kt.GossipsubPrunePeers,a=>a!==e&&this.score.score(a)>=0).forEach(a=>{let c=WT.createFromB58String(a);s.push({peerID:c.toBytes(),signedPeerRecord:this._libp2p.peerStore.addressBook.getRawEnvelope(c)})}),{topicID:r,peers:s,backoff:n}}};YT.multicodec=Kt.GossipsubIDv11;Fse.exports=YT});var Wse=m((svt,$se)=>{l();"use strict";var ZT=it(),{base58btc:Vje}=(li(),Fs),{default:zje}=Yc(),Vse=fu(),zse=Ee(),cl=zse("libp2p-delegated-peer-routing");cl.error=zse("libp2p-delegated-peer-routing:error");var Hse=3e4,Hje=4,Gse=class{constructor(e){if(e==null)throw new Error("missing ipfs http client");this._client=e,this._httpQueue=new zje({concurrency:Hje});let{protocol:r,host:i,port:n}=e.getEndpointConfig();cl(`enabled DelegatedPeerRouting via ${r}://${i}:${n}`)}async findPeer(e,r={}){let i=e;ZT.isPeerId(i)&&(i=e.toB58String()),cl("findPeer starts: "+e),r.timeout=r.timeout||Hse;try{return await this._httpQueue.add(async()=>{let{addrs:n}=await this._client.dht.findPeer(i,{timeout:r.timeout});return{id:e,multiaddrs:n}})}catch(n){if(n.message.includes("not found"))return;throw n}finally{cl("findPeer finished: "+e)}}async*getClosestPeers(e,r={}){let i=Vje.encode(e).substring(1);cl("getClosestPeers starts:",i),r.timeout=r.timeout||Hse;let n=Vse(),s=Vse();this._httpQueue.add(()=>(n.resolve(),s.promise));try{await n.promise;let o=new Map;for await(let a of this._client.dht.query(i,{timeout:r.timeout}))switch(a.type){case 1:a.responses.forEach(c=>{o.set(c.id,{id:ZT.parse(c.id),multiaddrs:c.addrs})});break;case 2:yield o.get(a.id.string)||{id:ZT.createFromCID(a.id),multiaddrs:[]};break;default:cl("getClosestPeers unhandled response",a)}}catch(o){throw cl.error("getClosestPeers errored:",o),o}finally{s.resolve(),cl("getClosestPeers finished:",i)}}};$se.exports=Gse});var eoe=m((ovt,Jse)=>{l();"use strict";var Yse=Ee(),Gje=it(),$je=ic(),{default:Xse}=Yc(),Qse=fu(),eh=Yse("libp2p-delegated-content-routing");eh.error=Yse("libp2p-delegated-content-routing:error");var Wje=3e4,Yje=4,Zse=class{constructor(e,r){if(e==null)throw new Error("missing self peerId");if(r==null)throw new Error("missing ipfs http client");this._client=r,this.peerId=e;let i={concurrency:Yje};this._httpQueue=new Xse(i),this._httpQueueRefs=new Xse(Object.assign({},i,{concurrency:2}));let{protocol:n,host:s,port:o}=r.getEndpointConfig();eh(`enabled DelegatedContentRouting via ${n}://${s}:${o}`)}async*findProviders(e,r={}){eh(`findProviders starts: ${e}`),r.timeout=r.timeout||Wje;let i=0,n=Qse(),s=Qse();this._httpQueue.add(()=>(n.resolve(),s.promise));try{await n.promise;for await(let{id:o,addrs:a}of this._client.dht.findProvs(e,{numProviders:r.numProviders,timeout:r.timeout}))yield{id:Gje.parse(o),multiaddrs:a},i++}catch(o){throw eh.error("findProviders errored:",o),o}finally{s.resolve(),eh(`findProviders finished: ${e} found ${i} providers`)}}async provide(e){eh(`provide starts: ${e}`),await this._httpQueueRefs.add(async()=>{await this._client.block.stat(e),await $je(this._client.dht.provide(e))}),eh(`provide finished: ${e}`)}};Jse.exports=Zse});var ih=m((_vt,coe)=>{l();"use strict";function aoe(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function aUe(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return aoe(t,r)}catch(i){r.message=t.message,r.stack=t.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(t)),aoe(new n,r)}}coe.exports=aUe});var mm=m((w_t,Oae)=>{l();Oae.exports=t=>{if(t[Symbol.asyncIterator])return t;if(t.getReader)return async function*(){let e=t.getReader();try{for(;;){let{done:r,value:i}=await e.read();if(r)return;yield i}}finally{e.releaseLock()}}();throw new Error("unknown stream")}});var nR=m(()=>{l()});var sR=m((JTt,Cue)=>{l();"use strict";var _Ue=ly(),EUe=(t,e)=>({path:decodeURIComponent(new URL(t).pathname.split("/").pop()||""),content:SUe(t,e)});async function*SUe(t,e){yield*(await new _Ue().get(t,e)).iterator()}Cue.exports=EUe});var kue=m(()=>{l()});var Bue=m((VRt,Due)=>{l();Due.exports=typeof WebSocket=="undefined"?kue():WebSocket});var Mue=m(Y8=>{l();"use strict";Object.defineProperty(Y8,"__esModule",{value:!0});var Nue=class{constructor(){this.pullQueue=[],this.pushQueue=[],this.eventHandlers={},this.isPaused=!1,this.isStopped=!1}push(e){if(this.isStopped)return;let r={value:e,done:!1};if(this.pullQueue.length){let i=this.pullQueue.shift();i&&i.resolve(r)}else this.pushQueue.push(Promise.resolve(r)),this.highWaterMark!==void 0&&this.pushQueue.length>=this.highWaterMark&&!this.isPaused&&(this.isPaused=!0,this.eventHandlers.highWater?this.eventHandlers.highWater():console&&console.warn(`EventIterator queue reached ${this.pushQueue.length} items`))}stop(){if(!this.isStopped){this.isStopped=!0,this.remove();for(let e of this.pullQueue)e.resolve({value:void 0,done:!0});this.pullQueue.length=0}}fail(e){if(!this.isStopped)if(this.isStopped=!0,this.remove(),this.pullQueue.length){for(let r of this.pullQueue)r.reject(e);this.pullQueue.length=0}else{let r=Promise.reject(e);r.catch(()=>{}),this.pushQueue.push(r)}}remove(){Promise.resolve().then(()=>{this.removeCallback&&this.removeCallback()})}[Symbol.asyncIterator](){return{next:e=>{let r=this.pushQueue.shift();return r?(this.lowWaterMark!==void 0&&this.pushQueue.length<=this.lowWaterMark&&this.isPaused&&(this.isPaused=!1,this.eventHandlers.lowWater&&this.eventHandlers.lowWater()),r):this.isStopped?Promise.resolve({value:void 0,done:!0}):new Promise((i,n)=>{this.pullQueue.push({resolve:i,reject:n})})},return:()=>(this.isStopped=!0,this.pushQueue.length=0,this.remove(),Promise.resolve({value:void 0,done:!0}))}}},oR=class{constructor(e,{highWaterMark:r=100,lowWaterMark:i=1}={}){let n=new Nue;n.highWaterMark=r,n.lowWaterMark=i,n.removeCallback=e({push:s=>n.push(s),stop:()=>n.stop(),fail:s=>n.fail(s),on:(s,o)=>{n.eventHandlers[s]=o}})||(()=>{}),this[Symbol.asyncIterator]=()=>n[Symbol.asyncIterator](),Object.freeze(this)}};Y8.EventIterator=oR;Y8.default=oR});var Lue=m(bm=>{l();"use strict";Object.defineProperty(bm,"__esModule",{value:!0});var aR=Mue();bm.EventIterator=aR.EventIterator;function TUe(t,e,r){return new aR.EventIterator(({push:i})=>(this.addEventListener(t,i,e),()=>this.removeEventListener(t,i,e)),r)}bm.subscribe=TUe;bm.default=aR.EventIterator});var jue=m((GRt,que)=>{l();var{Buffer:RUe}=Ht(),{EventIterator:PUe}=Lue();function CUe(t){return t instanceof ArrayBuffer||t!=null&&t.constructor!=null&&t.constructor.name==="ArrayBuffer"&&typeof t.byteLength=="number"}que.exports=t=>{let e=t.removeEventListener||t.removeListener,r=async function*(){let s=new PUe(({push:o,stop:a,fail:c})=>(t.addEventListener("message",o),t.addEventListener("error",c),t.addEventListener("close",a),()=>{e.call(t,"message",o),e.call(t,"error",c),e.call(t,"close",a)}),{highWaterMark:1/0});for await(let{data:o}of s)yield CUe(o)?RUe.from(o):o}(),i=t.readyState===1,n;return t.addEventListener("open",()=>{i=!0,n=null}),t.addEventListener("close",()=>{i=!1,n=null}),t.addEventListener("error",s=>{i||(n=s)}),r.connected=()=>new Promise((s,o)=>{if(i)return s();if(n)return o(n);let a=f=>{e.call(t,"open",c),e.call(t,"error",u),f()},c=()=>a(s),u=f=>a(()=>o(f));t.addEventListener("open",c),t.addEventListener("error",u)}),r}});var Fue=m(($Rt,Uue)=>{l();Uue.exports=async t=>{if(t.readyState>=2)throw new Error("socket closed");if(t.readyState!==1)return new Promise((e,r)=>{let i=t&&(t.removeEventListener||t.removeListener);function n(){typeof i=="function"&&(i.call(t,"open",s),i.call(t,"error",o))}function s(){n(),e()}function o(a){n(),r(a)}t.addEventListener("open",s),t.addEventListener("error",o)})}});var Vue=m((WRt,Kue)=>{l();var OUe=Fue();Kue.exports=(t,e)=>(e=e||{},e.closeOnEnd=e.closeOnEnd!==!1,async r=>{for await(let i of r){try{await OUe(t)}catch(n){if(n.message==="socket closed")break;throw n}t.send(i)}if(e.closeOnEnd&&t.readyState<=1)return new Promise((i,n)=>{t.addEventListener("close",s=>{if(s.wasClean||s.code===1006)i();else{let o=Object.assign(new Error("ws error"),{event:s});n(o)}}),setTimeout(()=>t.close())})})});var Hue=m((YRt,zue)=>{l();var kUe=jue(),DUe=Vue();zue.exports=(t,e)=>{e=e||{},e.binaryType?t.binaryType=e.binaryType:e.binary&&(t.binaryType="arraybuffer");let r={sink:DUe(t,e),source:kUe(t,e),connected:()=>r.source.connected()};return r}});var $ue=m((XRt,Gue)=>{l();var{relative:BUe}=_6(),NUe={http:"ws",https:"wss"},MUe="ws";Gue.exports=(t,e)=>BUe(t,e,NUe,MUe)});var Wue=m((QRt,X8)=>{l();"use strict";var LUe=Bue(),qUe=Hue(),jUe=$ue();X8.exports=function(t,e={}){let r=typeof window=="undefined"?{}:window.location,i=jUe(t,r),n=new LUe(i,e.websocket),s=qUe(n,e);return s.remoteAddress=i,s.close=()=>new Promise((o,a)=>{n.addEventListener("close",o),n.close()}),s.destroy=()=>{n.terminate?n.terminate():n.close()},s.socket=n,s};X8.exports.connect=X8.exports});var Xue=m((ZRt,Yue)=>{l();"use strict";Yue.exports=function(){throw new Error("WebSocket Servers can not be created in the browser!")}});var cR=m(nh=>{l();"use strict";nh.CODE_P2P=421;nh.CODE_CIRCUIT=290;nh.CODE_TCP=6;nh.CODE_WS=477;nh.CODE_WSS=478;nh.CLOSE_TIMEOUT=2e3});var Jue=m((ePt,Zue)=>{l();"use strict";function Que(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function UUe(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return Que(t,r)}catch(i){r.message=t.message,r.stack=t.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(t)),Que(new n,r)}}Zue.exports=UUe});var uR=m(l1=>{l();"use strict";Object.defineProperty(l1,"__esModule",{value:!0});l1.isCorrect=l1.isInSubnet=void 0;function FUe(t){return this.subnetMask<t.subnetMask?!1:this.mask(t.subnetMask)===t.mask()}l1.isInSubnet=FUe;function KUe(t){return function(){return this.addressMinusSuffix!==this.correctForm()?!1:this.subnetMask===t&&!this.parsedSubnet?!0:this.parsedSubnet===String(this.subnetMask)}}l1.isCorrect=KUe});var fR=m(xc=>{l();"use strict";Object.defineProperty(xc,"__esModule",{value:!0});xc.RE_SUBNET_STRING=xc.RE_ADDRESS=xc.GROUPS=xc.BITS=void 0;xc.BITS=32;xc.GROUPS=4;xc.RE_ADDRESS=/^(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;xc.RE_SUBNET_STRING=/\/\d{1,2}$/});var Q8=m(d1=>{l();"use strict";var VUe=d1&&d1.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function i(){this.constructor=e}e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(d1,"__esModule",{value:!0});d1.AddressError=void 0;var zUe=function(t){VUe(e,t);function e(r,i){var n=t.call(this,r)||this;return n.name="AddressError",i!==null&&(n.parseMessage=i),n}return e}(Error);d1.AddressError=zUe});var lR=m((Z8,efe)=>{l();(function(){var t,e=244837814094590,r=(e&16777215)==15715070;function i(x,T,G){x!=null&&(typeof x=="number"?this.fromNumber(x,T,G):T==null&&typeof x!="string"?this.fromString(x,256):this.fromString(x,T))}function n(){return new i(null)}function s(x,T,G,ae,ve,Ae){for(;--Ae>=0;){var Ne=T*this[x++]+G[ae]+ve;ve=Math.floor(Ne/67108864),G[ae++]=Ne&67108863}return ve}function o(x,T,G,ae,ve,Ae){for(var Ne=T&32767,Ue=T>>15;--Ae>=0;){var xr=this[x]&32767,Ui=this[x++]>>15,Ls=Ue*xr+Ui*Ne;xr=Ne*xr+((Ls&32767)<<15)+G[ae]+(ve&1073741823),ve=(xr>>>30)+(Ls>>>15)+Ue*Ui+(ve>>>30),G[ae++]=xr&1073741823}return ve}function a(x,T,G,ae,ve,Ae){for(var Ne=T&16383,Ue=T>>14;--Ae>=0;){var xr=this[x]&16383,Ui=this[x++]>>14,Ls=Ue*xr+Ui*Ne;xr=Ne*xr+((Ls&16383)<<14)+G[ae]+ve,ve=(xr>>28)+(Ls>>14)+Ue*Ui,G[ae++]=xr&268435455}return ve}var c=typeof navigator!="undefined";c&&r&&navigator.appName=="Microsoft Internet Explorer"?(i.prototype.am=o,t=30):c&&r&&navigator.appName!="Netscape"?(i.prototype.am=s,t=26):(i.prototype.am=a,t=28),i.prototype.DB=t,i.prototype.DM=(1<<t)-1,i.prototype.DV=1<<t;var u=52;i.prototype.FV=Math.pow(2,u),i.prototype.F1=u-t,i.prototype.F2=2*t-u;var f="0123456789abcdefghijklmnopqrstuvwxyz",d=new Array,h,p;for(h="0".charCodeAt(0),p=0;p<=9;++p)d[h++]=p;for(h="a".charCodeAt(0),p=10;p<36;++p)d[h++]=p;for(h="A".charCodeAt(0),p=10;p<36;++p)d[h++]=p;function y(x){return f.charAt(x)}function b(x,T){var G=d[x.charCodeAt(T)];return G??-1}function E(x){for(var T=this.t-1;T>=0;--T)x[T]=this[T];x.t=this.t,x.s=this.s}function v(x){this.t=1,this.s=x<0?-1:0,x>0?this[0]=x:x<-1?this[0]=x+this.DV:this.t=0}function A(x){var T=n();return T.fromInt(x),T}function R(x,T){var G;if(T==16)G=4;else if(T==8)G=3;else if(T==256)G=8;else if(T==2)G=1;else if(T==32)G=5;else if(T==4)G=2;else{this.fromRadix(x,T);return}this.t=0,this.s=0;for(var ae=x.length,ve=!1,Ae=0;--ae>=0;){var Ne=G==8?x[ae]&255:b(x,ae);if(Ne<0){x.charAt(ae)=="-"&&(ve=!0);continue}ve=!1,Ae==0?this[this.t++]=Ne:Ae+G>this.DB?(this[this.t-1]|=(Ne&(1<<this.DB-Ae)-1)<<Ae,this[this.t++]=Ne>>this.DB-Ae):this[this.t-1]|=Ne<<Ae,Ae+=G,Ae>=this.DB&&(Ae-=this.DB)}G==8&&(x[0]&128)!=0&&(this.s=-1,Ae>0&&(this[this.t-1]|=(1<<this.DB-Ae)-1<<Ae)),this.clamp(),ve&&i.ZERO.subTo(this,this)}function F(){for(var x=this.s&this.DM;this.t>0&&this[this.t-1]==x;)--this.t}function D(x){if(this.s<0)return"-"+this.negate().toString(x);var T;if(x==16)T=4;else if(x==8)T=3;else if(x==2)T=1;else if(x==32)T=5;else if(x==4)T=2;else return this.toRadix(x);var G=(1<<T)-1,ae,ve=!1,Ae="",Ne=this.t,Ue=this.DB-Ne*this.DB%T;if(Ne-- >0)for(Ue<this.DB&&(ae=this[Ne]>>Ue)>0&&(ve=!0,Ae=y(ae));Ne>=0;)Ue<T?(ae=(this[Ne]&(1<<Ue)-1)<<T-Ue,ae|=this[--Ne]>>(Ue+=this.DB-T)):(ae=this[Ne]>>(Ue-=T)&G,Ue<=0&&(Ue+=this.DB,--Ne)),ae>0&&(ve=!0),ve&&(Ae+=y(ae));return ve?Ae:"0"}function B(){var x=n();return i.ZERO.subTo(this,x),x}function H(){return this.s<0?this.negate():this}function W(x){var T=this.s-x.s;if(T!=0)return T;var G=this.t;if(T=G-x.t,T!=0)return this.s<0?-T:T;for(;--G>=0;)if((T=this[G]-x[G])!=0)return T;return 0}function X(x){var T=1,G;return(G=x>>>16)!=0&&(x=G,T+=16),(G=x>>8)!=0&&(x=G,T+=8),(G=x>>4)!=0&&(x=G,T+=4),(G=x>>2)!=0&&(x=G,T+=2),(G=x>>1)!=0&&(x=G,T+=1),T}function P(){return this.t<=0?0:this.DB*(this.t-1)+X(this[this.t-1]^this.s&this.DM)}function g(x,T){var G;for(G=this.t-1;G>=0;--G)T[G+x]=this[G];for(G=x-1;G>=0;--G)T[G]=0;T.t=this.t+x,T.s=this.s}function w(x,T){for(var G=x;G<this.t;++G)T[G-x]=this[G];T.t=Math.max(this.t-x,0),T.s=this.s}function S(x,T){var G=x%this.DB,ae=this.DB-G,ve=(1<<ae)-1,Ae=Math.floor(x/this.DB),Ne=this.s<<G&this.DM,Ue;for(Ue=this.t-1;Ue>=0;--Ue)T[Ue+Ae+1]=this[Ue]>>ae|Ne,Ne=(this[Ue]&ve)<<G;for(Ue=Ae-1;Ue>=0;--Ue)T[Ue]=0;T[Ae]=Ne,T.t=this.t+Ae+1,T.s=this.s,T.clamp()}function C(x,T){T.s=this.s;var G=Math.floor(x/this.DB);if(G>=this.t){T.t=0;return}var ae=x%this.DB,ve=this.DB-ae,Ae=(1<<ae)-1;T[0]=this[G]>>ae;for(var Ne=G+1;Ne<this.t;++Ne)T[Ne-G-1]|=(this[Ne]&Ae)<<ve,T[Ne-G]=this[Ne]>>ae;ae>0&&(T[this.t-G-1]|=(this.s&Ae)<<ve),T.t=this.t-G,T.clamp()}function L(x,T){for(var G=0,ae=0,ve=Math.min(x.t,this.t);G<ve;)ae+=this[G]-x[G],T[G++]=ae&this.DM,ae>>=this.DB;if(x.t<this.t){for(ae-=x.s;G<this.t;)ae+=this[G],T[G++]=ae&this.DM,ae>>=this.DB;ae+=this.s}else{for(ae+=this.s;G<x.t;)ae-=x[G],T[G++]=ae&this.DM,ae>>=this.DB;ae-=x.s}T.s=ae<0?-1:0,ae<-1?T[G++]=this.DV+ae:ae>0&&(T[G++]=ae),T.t=G,T.clamp()}function Y(x,T){var G=this.abs(),ae=x.abs(),ve=G.t;for(T.t=ve+ae.t;--ve>=0;)T[ve]=0;for(ve=0;ve<ae.t;++ve)T[ve+G.t]=G.am(0,ae[ve],T,ve,0,G.t);T.s=0,T.clamp(),this.s!=x.s&&i.ZERO.subTo(T,T)}function V(x){for(var T=this.abs(),G=x.t=2*T.t;--G>=0;)x[G]=0;for(G=0;G<T.t-1;++G){var ae=T.am(G,T[G],x,2*G,0,1);(x[G+T.t]+=T.am(G+1,2*T[G],x,2*G+1,ae,T.t-G-1))>=T.DV&&(x[G+T.t]-=T.DV,x[G+T.t+1]=1)}x.t>0&&(x[x.t-1]+=T.am(G,T[G],x,2*G,0,1)),x.s=0,x.clamp()}function q(x,T,G){var ae=x.abs();if(!(ae.t<=0)){var ve=this.abs();if(ve.t<ae.t){T!=null&&T.fromInt(0),G!=null&&this.copyTo(G);return}G==null&&(G=n());var Ae=n(),Ne=this.s,Ue=x.s,xr=this.DB-X(ae[ae.t-1]);xr>0?(ae.lShiftTo(xr,Ae),ve.lShiftTo(xr,G)):(ae.copyTo(Ae),ve.copyTo(G));var Ui=Ae.t,Ls=Ae[Ui-1];if(Ls!=0){var ys=Ls*(1<<this.F1)+(Ui>1?Ae[Ui-2]>>this.F2:0),jc=this.FV/ys,P3=(1<<this.F1)/ys,Do=1<<this.F2,Bo=G.t,C3=Bo-Ui,Ku=T??n();for(Ae.dlShiftTo(C3,Ku),G.compareTo(Ku)>=0&&(G[G.t++]=1,G.subTo(Ku,G)),i.ONE.dlShiftTo(Ui,Ku),Ku.subTo(Ae,Ae);Ae.t<Ui;)Ae[Ae.t++]=0;for(;--C3>=0;){var rw=G[--Bo]==Ls?this.DM:Math.floor(G[Bo]*jc+(G[Bo-1]+Do)*P3);if((G[Bo]+=Ae.am(0,rw,G,C3,0,Ui))<rw)for(Ae.dlShiftTo(C3,Ku),G.subTo(Ku,G);G[Bo]<--rw;)G.subTo(Ku,G)}T!=null&&(G.drShiftTo(Ui,T),Ne!=Ue&&i.ZERO.subTo(T,T)),G.t=Ui,G.clamp(),xr>0&&G.rShiftTo(xr,G),Ne<0&&i.ZERO.subTo(G,G)}}}function _(x){var T=n();return this.abs().divRemTo(x,null,T),this.s<0&&T.compareTo(i.ZERO)>0&&x.subTo(T,T),T}function j(x){this.m=x}function de(x){return x.s<0||x.compareTo(this.m)>=0?x.mod(this.m):x}function Q(x){return x}function ue(x){x.divRemTo(this.m,null,x)}function le(x,T,G){x.multiplyTo(T,G),this.reduce(G)}function me(x,T){x.squareTo(T),this.reduce(T)}j.prototype.convert=de,j.prototype.revert=Q,j.prototype.reduce=ue,j.prototype.mulTo=le,j.prototype.sqrTo=me;function be(){if(this.t<1)return 0;var x=this[0];if((x&1)==0)return 0;var T=x&3;return T=T*(2-(x&15)*T)&15,T=T*(2-(x&255)*T)&255,T=T*(2-((x&65535)*T&65535))&65535,T=T*(2-x*T%this.DV)%this.DV,T>0?this.DV-T:-T}function xe(x){this.m=x,this.mp=x.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<x.DB-15)-1,this.mt2=2*x.t}function k(x){var T=n();return x.abs().dlShiftTo(this.m.t,T),T.divRemTo(this.m,null,T),x.s<0&&T.compareTo(i.ZERO)>0&&this.m.subTo(T,T),T}function K(x){var T=n();return x.copyTo(T),this.reduce(T),T}function $(x){for(;x.t<=this.mt2;)x[x.t++]=0;for(var T=0;T<this.m.t;++T){var G=x[T]&32767,ae=G*this.mpl+((G*this.mph+(x[T]>>15)*this.mpl&this.um)<<15)&x.DM;for(G=T+this.m.t,x[G]+=this.m.am(0,ae,x,T,0,this.m.t);x[G]>=x.DV;)x[G]-=x.DV,x[++G]++}x.clamp(),x.drShiftTo(this.m.t,x),x.compareTo(this.m)>=0&&x.subTo(this.m,x)}function ee(x,T){x.squareTo(T),this.reduce(T)}function I(x,T,G){x.multiplyTo(T,G),this.reduce(G)}xe.prototype.convert=k,xe.prototype.revert=K,xe.prototype.reduce=$,xe.prototype.mulTo=I,xe.prototype.sqrTo=ee;function U(){return(this.t>0?this[0]&1:this.s)==0}function z(x,T){if(x>4294967295||x<1)return i.ONE;var G=n(),ae=n(),ve=T.convert(this),Ae=X(x)-1;for(ve.copyTo(G);--Ae>=0;)if(T.sqrTo(G,ae),(x&1<<Ae)>0)T.mulTo(ae,ve,G);else{var Ne=G;G=ae,ae=Ne}return T.revert(G)}function N(x,T){var G;return x<256||T.isEven()?G=new j(T):G=new xe(T),this.exp(x,G)}i.prototype.copyTo=E,i.prototype.fromInt=v,i.prototype.fromString=R,i.prototype.clamp=F,i.prototype.dlShiftTo=g,i.prototype.drShiftTo=w,i.prototype.lShiftTo=S,i.prototype.rShiftTo=C,i.prototype.subTo=L,i.prototype.multiplyTo=Y,i.prototype.squareTo=V,i.prototype.divRemTo=q,i.prototype.invDigit=be,i.prototype.isEven=U,i.prototype.exp=z,i.prototype.toString=D,i.prototype.negate=B,i.prototype.abs=H,i.prototype.compareTo=W,i.prototype.bitLength=P,i.prototype.mod=_,i.prototype.modPowInt=N,i.ZERO=A(0),i.ONE=A(1);function Z(){var x=n();return this.copyTo(x),x}function ie(){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 te(){return this.t==0?this.s:this[0]<<24>>24}function he(){return this.t==0?this.s:this[0]<<16>>16}function we(x){return Math.floor(Math.LN2*this.DB/Math.log(x))}function _e(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function Ke(x){if(x==null&&(x=10),this.signum()==0||x<2||x>36)return"0";var T=this.chunkSize(x),G=Math.pow(x,T),ae=A(G),ve=n(),Ae=n(),Ne="";for(this.divRemTo(ae,ve,Ae);ve.signum()>0;)Ne=(G+Ae.intValue()).toString(x).substr(1)+Ne,ve.divRemTo(ae,ve,Ae);return Ae.intValue().toString(x)+Ne}function Pe(x,T){this.fromInt(0),T==null&&(T=10);for(var G=this.chunkSize(T),ae=Math.pow(T,G),ve=!1,Ae=0,Ne=0,Ue=0;Ue<x.length;++Ue){var xr=b(x,Ue);if(xr<0){x.charAt(Ue)=="-"&&this.signum()==0&&(ve=!0);continue}Ne=T*Ne+xr,++Ae>=G&&(this.dMultiply(ae),this.dAddOffset(Ne,0),Ae=0,Ne=0)}Ae>0&&(this.dMultiply(Math.pow(T,Ae)),this.dAddOffset(Ne,0)),ve&&i.ZERO.subTo(this,this)}function Ve(x,T,G){if(typeof T=="number")if(x<2)this.fromInt(1);else for(this.fromNumber(x,G),this.testBit(x-1)||this.bitwiseTo(i.ONE.shiftLeft(x-1),Xt,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(T);)this.dAddOffset(2,0),this.bitLength()>x&&this.subTo(i.ONE.shiftLeft(x-1),this);else{var ae=new Array,ve=x&7;ae.length=(x>>3)+1,T.nextBytes(ae),ve>0?ae[0]&=(1<<ve)-1:ae[0]=0,this.fromString(ae,256)}}function et(){var x=this.t,T=new Array;T[0]=this.s;var G=this.DB-x*this.DB%8,ae,ve=0;if(x-- >0)for(G<this.DB&&(ae=this[x]>>G)!=(this.s&this.DM)>>G&&(T[ve++]=ae|this.s<<this.DB-G);x>=0;)G<8?(ae=(this[x]&(1<<G)-1)<<8-G,ae|=this[--x]>>(G+=this.DB-8)):(ae=this[x]>>(G-=8)&255,G<=0&&(G+=this.DB,--x)),(ae&128)!=0&&(ae|=-256),ve==0&&(this.s&128)!=(ae&128)&&++ve,(ve>0||ae!=this.s)&&(T[ve++]=ae);return T}function He(x){return this.compareTo(x)==0}function ze(x){return this.compareTo(x)<0?this:x}function mt(x){return this.compareTo(x)>0?this:x}function tr(x,T,G){var ae,ve,Ae=Math.min(x.t,this.t);for(ae=0;ae<Ae;++ae)G[ae]=T(this[ae],x[ae]);if(x.t<this.t){for(ve=x.s&this.DM,ae=Ae;ae<this.t;++ae)G[ae]=T(this[ae],ve);G.t=this.t}else{for(ve=this.s&this.DM,ae=Ae;ae<x.t;++ae)G[ae]=T(ve,x[ae]);G.t=x.t}G.s=T(this.s,x.s),G.clamp()}function fr(x,T){return x&T}function Dn(x){var T=n();return this.bitwiseTo(x,fr,T),T}function Xt(x,T){return x|T}function Ot(x){var T=n();return this.bitwiseTo(x,Xt,T),T}function ci(x,T){return x^T}function nt(x){var T=n();return this.bitwiseTo(x,ci,T),T}function Dr(x,T){return x&~T}function w3(x){var T=n();return this.bitwiseTo(x,Dr,T),T}function Mr(){for(var x=n(),T=0;T<this.t;++T)x[T]=this.DM&~this[T];return x.t=this.t,x.s=~this.s,x}function Lr(x){var T=n();return x<0?this.rShiftTo(-x,T):this.lShiftTo(x,T),T}function _3(x){var T=n();return x<0?this.lShiftTo(-x,T):this.rShiftTo(x,T),T}function qr(x){if(x==0)return-1;var T=0;return(x&65535)==0&&(x>>=16,T+=16),(x&255)==0&&(x>>=8,T+=8),(x&15)==0&&(x>>=4,T+=4),(x&3)==0&&(x>>=2,T+=2),(x&1)==0&&++T,T}function jr(){for(var x=0;x<this.t;++x)if(this[x]!=0)return x*this.DB+qr(this[x]);return this.s<0?this.t*this.DB:-1}function E3(x){for(var T=0;x!=0;)x&=x-1,++T;return T}function Ur(){for(var x=0,T=this.s&this.DM,G=0;G<this.t;++G)x+=E3(this[G]^T);return x}function Fr(x){var T=Math.floor(x/this.DB);return T>=this.t?this.s!=0:(this[T]&1<<x%this.DB)!=0}function S3(x,T){var G=i.ONE.shiftLeft(x);return this.bitwiseTo(G,T,G),G}function Kr(x){return this.changeBit(x,Xt)}function Vr(x){return this.changeBit(x,Dr)}function x3(x){return this.changeBit(x,ci)}function zr(x,T){for(var G=0,ae=0,ve=Math.min(x.t,this.t);G<ve;)ae+=this[G]+x[G],T[G++]=ae&this.DM,ae>>=this.DB;if(x.t<this.t){for(ae+=x.s;G<this.t;)ae+=this[G],T[G++]=ae&this.DM,ae>>=this.DB;ae+=this.s}else{for(ae+=this.s;G<x.t;)ae+=x[G],T[G++]=ae&this.DM,ae>>=this.DB;ae+=x.s}T.s=ae<0?-1:0,ae>0?T[G++]=ae:ae<-1&&(T[G++]=this.DV+ae),T.t=G,T.clamp()}function Hr(x){var T=n();return this.addTo(x,T),T}function A3(x){var T=n();return this.subTo(x,T),T}function Gr(x){var T=n();return this.multiplyTo(x,T),T}function $r(){var x=n();return this.squareTo(x),x}function I3(x){var T=n();return this.divRemTo(x,T,null),T}function Wr(x){var T=n();return this.divRemTo(x,null,T),T}function Yr(x){var T=n(),G=n();return this.divRemTo(x,T,G),new Array(T,G)}function T3(x){this[this.t]=this.am(0,x-1,this,0,0,this.t),++this.t,this.clamp()}function Xr(x,T){if(x!=0){for(;this.t<=T;)this[this.t++]=0;for(this[T]+=x;this[T]>=this.DV;)this[T]-=this.DV,++T>=this.t&&(this[this.t++]=0),++this[T]}}function lr(){}function Ch(x){return x}function l2(x,T,G){x.multiplyTo(T,G)}function d2(x,T){x.squareTo(T)}lr.prototype.convert=Ch,lr.prototype.revert=Ch,lr.prototype.mulTo=l2,lr.prototype.sqrTo=d2;function h2(x){return this.exp(x,new lr)}function p2(x,T,G){var ae=Math.min(this.t+x.t,T);for(G.s=0,G.t=ae;ae>0;)G[--ae]=0;var ve;for(ve=G.t-this.t;ae<ve;++ae)G[ae+this.t]=this.am(0,x[ae],G,ae,0,this.t);for(ve=Math.min(x.t,T);ae<ve;++ae)this.am(0,x[ae],G,ae,0,T-ae);G.clamp()}function y2(x,T,G){--T;var ae=G.t=this.t+x.t-T;for(G.s=0;--ae>=0;)G[ae]=0;for(ae=Math.max(T-this.t,0);ae<x.t;++ae)G[this.t+ae-T]=this.am(T-ae,x[ae],G,0,0,this.t+ae-T);G.clamp(),G.drShiftTo(1,G)}function Oo(x){this.r2=n(),this.q3=n(),i.ONE.dlShiftTo(2*x.t,this.r2),this.mu=this.r2.divide(x),this.m=x}function g2(x){if(x.s<0||x.t>2*this.m.t)return x.mod(this.m);if(x.compareTo(this.m)<0)return x;var T=n();return x.copyTo(T),this.reduce(T),T}function m2(x){return x}function b2(x){for(x.drShiftTo(this.m.t-1,this.r2),x.t>this.m.t+1&&(x.t=this.m.t+1,x.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);x.compareTo(this.r2)<0;)x.dAddOffset(1,this.m.t+1);for(x.subTo(this.r2,x);x.compareTo(this.m)>=0;)x.subTo(this.m,x)}function v2(x,T){x.squareTo(T),this.reduce(T)}function w2(x,T,G){x.multiplyTo(T,G),this.reduce(G)}Oo.prototype.convert=g2,Oo.prototype.revert=m2,Oo.prototype.reduce=b2,Oo.prototype.mulTo=w2,Oo.prototype.sqrTo=v2;function _2(x,T){var G=x.bitLength(),ae,ve=A(1),Ae;if(G<=0)return ve;G<18?ae=1:G<48?ae=3:G<144?ae=4:G<768?ae=5:ae=6,G<8?Ae=new j(T):T.isEven()?Ae=new Oo(T):Ae=new xe(T);var Ne=new Array,Ue=3,xr=ae-1,Ui=(1<<ae)-1;if(Ne[1]=Ae.convert(this),ae>1){var Ls=n();for(Ae.sqrTo(Ne[1],Ls);Ue<=Ui;)Ne[Ue]=n(),Ae.mulTo(Ls,Ne[Ue-2],Ne[Ue]),Ue+=2}var ys=x.t-1,jc,P3=!0,Do=n(),Bo;for(G=X(x[ys])-1;ys>=0;){for(G>=xr?jc=x[ys]>>G-xr&Ui:(jc=(x[ys]&(1<<G+1)-1)<<xr-G,ys>0&&(jc|=x[ys-1]>>this.DB+G-xr)),Ue=ae;(jc&1)==0;)jc>>=1,--Ue;if((G-=Ue)<0&&(G+=this.DB,--ys),P3)Ne[jc].copyTo(ve),P3=!1;else{for(;Ue>1;)Ae.sqrTo(ve,Do),Ae.sqrTo(Do,ve),Ue-=2;Ue>0?Ae.sqrTo(ve,Do):(Bo=ve,ve=Do,Do=Bo),Ae.mulTo(Do,Ne[jc],ve)}for(;ys>=0&&(x[ys]&1<<G)==0;)Ae.sqrTo(ve,Do),Bo=ve,ve=Do,Do=Bo,--G<0&&(G=this.DB-1,--ys)}return Ae.revert(ve)}function E2(x){var T=this.s<0?this.negate():this.clone(),G=x.s<0?x.negate():x.clone();if(T.compareTo(G)<0){var ae=T;T=G,G=ae}var ve=T.getLowestSetBit(),Ae=G.getLowestSetBit();if(Ae<0)return T;for(ve<Ae&&(Ae=ve),Ae>0&&(T.rShiftTo(Ae,T),G.rShiftTo(Ae,G));T.signum()>0;)(ve=T.getLowestSetBit())>0&&T.rShiftTo(ve,T),(ve=G.getLowestSetBit())>0&&G.rShiftTo(ve,G),T.compareTo(G)>=0?(T.subTo(G,T),T.rShiftTo(1,T)):(G.subTo(T,G),G.rShiftTo(1,G));return Ae>0&&G.lShiftTo(Ae,G),G}function S2(x){if(x<=0)return 0;var T=this.DV%x,G=this.s<0?x-1:0;if(this.t>0)if(T==0)G=this[0]%x;else for(var ae=this.t-1;ae>=0;--ae)G=(T*G+this[ae])%x;return G}function x2(x){var T=x.isEven();if(this.isEven()&&T||x.signum()==0)return i.ZERO;for(var G=x.clone(),ae=this.clone(),ve=A(1),Ae=A(0),Ne=A(0),Ue=A(1);G.signum()!=0;){for(;G.isEven();)G.rShiftTo(1,G),T?((!ve.isEven()||!Ae.isEven())&&(ve.addTo(this,ve),Ae.subTo(x,Ae)),ve.rShiftTo(1,ve)):Ae.isEven()||Ae.subTo(x,Ae),Ae.rShiftTo(1,Ae);for(;ae.isEven();)ae.rShiftTo(1,ae),T?((!Ne.isEven()||!Ue.isEven())&&(Ne.addTo(this,Ne),Ue.subTo(x,Ue)),Ne.rShiftTo(1,Ne)):Ue.isEven()||Ue.subTo(x,Ue),Ue.rShiftTo(1,Ue);G.compareTo(ae)>=0?(G.subTo(ae,G),T&&ve.subTo(Ne,ve),Ae.subTo(Ue,Ae)):(ae.subTo(G,ae),T&&Ne.subTo(ve,Ne),Ue.subTo(Ae,Ue))}if(ae.compareTo(i.ONE)!=0)return i.ZERO;if(Ue.compareTo(x)>=0)return Ue.subtract(x);if(Ue.signum()<0)Ue.addTo(x,Ue);else return Ue;return Ue.signum()<0?Ue.add(x):Ue}var Ti=[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],A2=(1<<26)/Ti[Ti.length-1];function I2(x){var T,G=this.abs();if(G.t==1&&G[0]<=Ti[Ti.length-1]){for(T=0;T<Ti.length;++T)if(G[0]==Ti[T])return!0;return!1}if(G.isEven())return!1;for(T=1;T<Ti.length;){for(var ae=Ti[T],ve=T+1;ve<Ti.length&&ae<A2;)ae*=Ti[ve++];for(ae=G.modInt(ae);T<ve;)if(ae%Ti[T++]==0)return!1}return G.millerRabin(x)}function lbe(x){var T=this.subtract(i.ONE),G=T.getLowestSetBit();if(G<=0)return!1;var ae=T.shiftRight(G);x=x+1>>1,x>Ti.length&&(x=Ti.length);for(var ve=n(),Ae=0;Ae<x;++Ae){ve.fromInt(Ti[Math.floor(Math.random()*Ti.length)]);var Ne=ve.modPow(ae,this);if(Ne.compareTo(i.ONE)!=0&&Ne.compareTo(T)!=0){for(var Ue=1;Ue++<G&&Ne.compareTo(T)!=0;)if(Ne=Ne.modPowInt(2,this),Ne.compareTo(i.ONE)==0)return!1;if(Ne.compareTo(T)!=0)return!1}}return!0}i.prototype.chunkSize=we,i.prototype.toRadix=Ke,i.prototype.fromRadix=Pe,i.prototype.fromNumber=Ve,i.prototype.bitwiseTo=tr,i.prototype.changeBit=S3,i.prototype.addTo=zr,i.prototype.dMultiply=T3,i.prototype.dAddOffset=Xr,i.prototype.multiplyLowerTo=p2,i.prototype.multiplyUpperTo=y2,i.prototype.modInt=S2,i.prototype.millerRabin=lbe,i.prototype.clone=Z,i.prototype.intValue=ie,i.prototype.byteValue=te,i.prototype.shortValue=he,i.prototype.signum=_e,i.prototype.toByteArray=et,i.prototype.equals=He,i.prototype.min=ze,i.prototype.max=mt,i.prototype.and=Dn,i.prototype.or=Ot,i.prototype.xor=nt,i.prototype.andNot=w3,i.prototype.not=Mr,i.prototype.shiftLeft=Lr,i.prototype.shiftRight=_3,i.prototype.getLowestSetBit=jr,i.prototype.bitCount=Ur,i.prototype.testBit=Fr,i.prototype.setBit=Kr,i.prototype.clearBit=Vr,i.prototype.flipBit=x3,i.prototype.add=Hr,i.prototype.subtract=A3,i.prototype.multiply=Gr,i.prototype.divide=I3,i.prototype.remainder=Wr,i.prototype.divideAndRemainder=Yr,i.prototype.modPow=_2,i.prototype.modInverse=x2,i.prototype.pow=h2,i.prototype.gcd=E2,i.prototype.isProbablePrime=I2,i.prototype.square=$r,i.prototype.Barrett=Oo;var R3,ps,ji;function dbe(x){ps[ji++]^=x&255,ps[ji++]^=x>>8&255,ps[ji++]^=x>>16&255,ps[ji++]^=x>>24&255,ji>=tw&&(ji-=tw)}function $O(){dbe(new Date().getTime())}if(ps==null){ps=new Array,ji=0;var ko;if(typeof window!="undefined"&&window.crypto){if(window.crypto.getRandomValues){var WO=new Uint8Array(32);for(window.crypto.getRandomValues(WO),ko=0;ko<32;++ko)ps[ji++]=WO[ko]}else if(navigator.appName=="Netscape"&&navigator.appVersion<"5"){var YO=window.crypto.random(32);for(ko=0;ko<YO.length;++ko)ps[ji++]=YO.charCodeAt(ko)&255}}for(;ji<tw;)ko=Math.floor(65536*Math.random()),ps[ji++]=ko>>>8,ps[ji++]=ko&255;ji=0,$O()}function hbe(){if(R3==null){for($O(),R3=mbe(),R3.init(ps),ji=0;ji<ps.length;++ji)ps[ji]=0;ji=0}return R3.next()}function pbe(x){var T;for(T=0;T<x.length;++T)x[T]=hbe()}function J7(){}J7.prototype.nextBytes=pbe;function ew(){this.i=0,this.j=0,this.S=new Array}function ybe(x){var T,G,ae;for(T=0;T<256;++T)this.S[T]=T;for(G=0,T=0;T<256;++T)G=G+this.S[T]+x[T%x.length]&255,ae=this.S[T],this.S[T]=this.S[G],this.S[G]=ae;this.i=0,this.j=0}function gbe(){var x;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,x=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=x,this.S[x+this.S[this.i]&255]}ew.prototype.init=ybe,ew.prototype.next=gbe;function mbe(){return new ew}var tw=256;typeof Z8!="undefined"?Z8=efe.exports={default:i,BigInteger:i,SecureRandom:J7}:this.jsbn={BigInteger:i,SecureRandom:J7}}).call(Z8)});var vm=m(J8=>{l();(function(){"use strict";var t={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 e(o){return i(s(o),arguments)}function r(o,a){return e.apply(null,[o].concat(a||[]))}function i(o,a){var c=1,u=o.length,f,d="",h,p,y,b,E,v,A,R;for(h=0;h<u;h++)if(typeof o[h]=="string")d+=o[h];else if(typeof o[h]=="object"){if(y=o[h],y.keys)for(f=a[c],p=0;p<y.keys.length;p++){if(f==null)throw new Error(e('[sprintf] Cannot access property "%s" of undefined value "%s"',y.keys[p],y.keys[p-1]));f=f[y.keys[p]]}else y.param_no?f=a[y.param_no]:f=a[c++];if(t.not_type.test(y.type)&&t.not_primitive.test(y.type)&&f instanceof Function&&(f=f()),t.numeric_arg.test(y.type)&&typeof f!="number"&&isNaN(f))throw new TypeError(e("[sprintf] expecting number but found %T",f));switch(t.number.test(y.type)&&(A=f>=0),y.type){case"b":f=parseInt(f,10).toString(2);break;case"c":f=String.fromCharCode(parseInt(f,10));break;case"d":case"i":f=parseInt(f,10);break;case"j":f=JSON.stringify(f,null,y.width?parseInt(y.width):0);break;case"e":f=y.precision?parseFloat(f).toExponential(y.precision):parseFloat(f).toExponential();break;case"f":f=y.precision?parseFloat(f).toFixed(y.precision):parseFloat(f);break;case"g":f=y.precision?String(Number(f.toPrecision(y.precision))):parseFloat(f);break;case"o":f=(parseInt(f,10)>>>0).toString(8);break;case"s":f=String(f),f=y.precision?f.substring(0,y.precision):f;break;case"t":f=String(!!f),f=y.precision?f.substring(0,y.precision):f;break;case"T":f=Object.prototype.toString.call(f).slice(8,-1).toLowerCase(),f=y.precision?f.substring(0,y.precision):f;break;case"u":f=parseInt(f,10)>>>0;break;case"v":f=f.valueOf(),f=y.precision?f.substring(0,y.precision):f;break;case"x":f=(parseInt(f,10)>>>0).toString(16);break;case"X":f=(parseInt(f,10)>>>0).toString(16).toUpperCase();break}t.json.test(y.type)?d+=f:(t.number.test(y.type)&&(!A||y.sign)?(R=A?"+":"-",f=f.toString().replace(t.sign,"")):R="",E=y.pad_char?y.pad_char==="0"?"0":y.pad_char.charAt(1):" ",v=y.width-(R+f).length,b=y.width&&v>0?E.repeat(v):"",d+=y.align?R+f+b:E==="0"?R+b+f:b+R+f)}return d}var n=Object.create(null);function s(o){if(n[o])return n[o];for(var a=o,c,u=[],f=0;a;){if((c=t.text.exec(a))!==null)u.push(c[0]);else if((c=t.modulo.exec(a))!==null)u.push("%");else if((c=t.placeholder.exec(a))!==null){if(c[2]){f|=1;var d=[],h=c[2],p=[];if((p=t.key.exec(h))!==null)for(d.push(p[1]);(h=h.substring(p[0].length))!=="";)if((p=t.key_access.exec(h))!==null)d.push(p[1]);else if((p=t.index_access.exec(h))!==null)d.push(p[1]);else throw new SyntaxError("[sprintf] failed to parse named argument key");else throw new SyntaxError("[sprintf] failed to parse named argument key");c[2]=d}else f|=2;if(f===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");u.push({placeholder:c[0],param_no:c[1],keys:c[2],sign:c[3],pad_char:c[4],align:c[5],width:c[6],precision:c[7],type:c[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");a=a.substring(c[0].length)}return n[o]=u}typeof J8!="undefined"&&(J8.sprintf=e,J8.vsprintf=r),typeof window!="undefined"&&(window.sprintf=e,window.vsprintf=r,typeof define=="function"&&define.amd&&define(function(){return{sprintf:e,vsprintf:r}}))})()});var dR=m(Ac=>{l();"use strict";var HUe=Ac&&Ac.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),GUe=Ac&&Ac.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tfe=Ac&&Ac.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&HUe(e,t,r);return GUe(e,t),e};Object.defineProperty(Ac,"__esModule",{value:!0});Ac.Address4=void 0;var rfe=tfe(uR()),ha=tfe(fR()),ife=Q8(),wm=lR(),h1=vm(),$Ue=function(){function t(e){this.groups=ha.GROUPS,this.parsedAddress=[],this.parsedSubnet="",this.subnet="/32",this.subnetMask=32,this.v4=!0,this.isCorrect=rfe.isCorrect(ha.BITS),this.isInSubnet=rfe.isInSubnet,this.address=e;var r=ha.RE_SUBNET_STRING.exec(e);if(r){if(this.parsedSubnet=r[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet="/"+this.subnetMask,this.subnetMask<0||this.subnetMask>ha.BITS)throw new ife.AddressError("Invalid subnet mask.");e=e.replace(ha.RE_SUBNET_STRING,"")}this.addressMinusSuffix=e,this.parsedAddress=this.parse(e)}return t.isValid=function(e){try{return new t(e),!0}catch(r){return!1}},t.prototype.parse=function(e){var r=e.split(".");if(!e.match(ha.RE_ADDRESS))throw new ife.AddressError("Invalid IPv4 address.");return r},t.prototype.correctForm=function(){return this.parsedAddress.map(function(e){return parseInt(e,10)}).join(".")},t.fromHex=function(e){var r=e.replace(/:/g,"").padStart(8,"0"),i=[],n;for(n=0;n<8;n+=2){var s=r.slice(n,n+2);i.push(parseInt(s,16))}return new t(i.join("."))},t.fromInteger=function(e){return t.fromHex(e.toString(16))},t.fromArpa=function(e){var r=e.replace(/(\.in-addr\.arpa)?\.$/,""),i=r.split(".").reverse().join(".");return new t(i)},t.prototype.toHex=function(){return this.parsedAddress.map(function(e){return h1.sprintf("%02x",parseInt(e,10))}).join(":")},t.prototype.toArray=function(){return this.parsedAddress.map(function(e){return parseInt(e,10)})},t.prototype.toGroup6=function(){var e=[],r;for(r=0;r<ha.GROUPS;r+=2){var i=h1.sprintf("%02x%02x",parseInt(this.parsedAddress[r],10),parseInt(this.parsedAddress[r+1],10));e.push(h1.sprintf("%x",parseInt(i,16)))}return e.join(":")},t.prototype.bigInteger=function(){return new wm.BigInteger(this.parsedAddress.map(function(e){return h1.sprintf("%02x",parseInt(e,10))}).join(""),16)},t.prototype._startAddress=function(){return new wm.BigInteger(this.mask()+"0".repeat(ha.BITS-this.subnetMask),2)},t.prototype.startAddress=function(){return t.fromBigInteger(this._startAddress())},t.prototype.startAddressExclusive=function(){var e=new wm.BigInteger("1");return t.fromBigInteger(this._startAddress().add(e))},t.prototype._endAddress=function(){return new wm.BigInteger(this.mask()+"1".repeat(ha.BITS-this.subnetMask),2)},t.prototype.endAddress=function(){return t.fromBigInteger(this._endAddress())},t.prototype.endAddressExclusive=function(){var e=new wm.BigInteger("1");return t.fromBigInteger(this._endAddress().subtract(e))},t.fromBigInteger=function(e){return t.fromInteger(parseInt(e.toString(),10))},t.prototype.mask=function(e){return e===void 0&&(e=this.subnetMask),this.getBitsBase2(0,e)},t.prototype.getBitsBase2=function(e,r){return this.binaryZeroPad().slice(e,r)},t.prototype.reverseForm=function(e){e||(e={});var r=this.correctForm().split(".").reverse().join(".");return e.omitSuffix?r:h1.sprintf("%s.in-addr.arpa.",r)},t.prototype.isMulticast=function(){return this.isInSubnet(new t("224.0.0.0/4"))},t.prototype.binaryZeroPad=function(){return this.bigInteger().toString(2).padStart(ha.BITS,"0")},t.prototype.groupForV6=function(){var e=this.parsedAddress;return this.address.replace(ha.RE_ADDRESS,h1.sprintf('<span class="hover-group group-v4 group-6">%s</span>.<span class="hover-group group-v4 group-7">%s</span>',e.slice(0,2).join("."),e.slice(2,4).join(".")))},t}();Ac.Address4=$Ue});var hR=m(ii=>{l();"use strict";Object.defineProperty(ii,"__esModule",{value:!0});ii.RE_URL_WITH_PORT=ii.RE_URL=ii.RE_ZONE_STRING=ii.RE_SUBNET_STRING=ii.RE_BAD_ADDRESS=ii.RE_BAD_CHARACTERS=ii.TYPES=ii.SCOPES=ii.GROUPS=ii.BITS=void 0;ii.BITS=128;ii.GROUPS=8;ii.SCOPES={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"};ii.TYPES={"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"};ii.RE_BAD_CHARACTERS=/([^0-9a-f:/%])/gi;ii.RE_BAD_ADDRESS=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi;ii.RE_SUBNET_STRING=/\/\d{1,3}(?=%|$)/;ii.RE_ZONE_STRING=/%.*$/;ii.RE_URL=new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/);ii.RE_URL_WITH_PORT=new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/)});var pR=m(Ic=>{l();"use strict";Object.defineProperty(Ic,"__esModule",{value:!0});Ic.simpleGroup=Ic.spanLeadingZeroes=Ic.spanAll=Ic.spanAllZeroes=void 0;var nfe=vm();function sfe(t){return t.replace(/(0+)/g,'<span class="zero">$1</span>')}Ic.spanAllZeroes=sfe;function WUe(t,e){e===void 0&&(e=0);var r=t.split("");return r.map(function(i,n){return nfe.sprintf('<span class="digit value-%s position-%d">%s</span>',i,n+e,sfe(i))}).join("")}Ic.spanAll=WUe;function ofe(t){return t.replace(/^(0+)/,'<span class="zero">$1</span>')}function YUe(t){var e=t.split(":");return e.map(function(r){return ofe(r)}).join(":")}Ic.spanLeadingZeroes=YUe;function XUe(t,e){e===void 0&&(e=0);var r=t.split(":");return r.map(function(i,n){return/group-v4/.test(i)?i:nfe.sprintf('<span class="hover-group group-%d">%s</span>',n+e,ofe(i))})}Ic.simpleGroup=XUe});var afe=m(en=>{l();"use strict";var QUe=en&&en.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),ZUe=en&&en.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JUe=en&&en.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&QUe(e,t,r);return ZUe(e,t),e};Object.defineProperty(en,"__esModule",{value:!0});en.possibleElisions=en.simpleRegularExpression=en.ADDRESS_BOUNDARY=en.padGroup=en.groupPossibilities=void 0;var eFe=JUe(hR()),p1=vm();function ev(t){return p1.sprintf("(%s)",t.join("|"))}en.groupPossibilities=ev;function tv(t){return t.length<4?p1.sprintf("0{0,%d}%s",4-t.length,t):t}en.padGroup=tv;en.ADDRESS_BOUNDARY="[^A-Fa-f0-9:]";function tFe(t){var e=[];t.forEach(function(i,n){var s=parseInt(i,16);s===0&&e.push(n)});var r=e.map(function(i){return t.map(function(n,s){if(s===i){var o=s===0||s===eFe.GROUPS-1?":":"";return ev([tv(n),o])}return tv(n)}).join(":")});return r.push(t.map(tv).join(":")),ev(r)}en.simpleRegularExpression=tFe;function rFe(t,e,r){var i=e?"":":",n=r?"":":",s=[];!e&&!r&&s.push("::"),e&&r&&s.push(""),(r&&!e||!r&&e)&&s.push(":"),s.push(p1.sprintf("%s(:0{1,4}){1,%d}",i,t-1)),s.push(p1.sprintf("(0{1,4}:){1,%d}%s",t-1,n)),s.push(p1.sprintf("(0{1,4}:){%d}0{1,4}",t-1));for(var o=1;o<t-1;o++)for(var a=1;a<t-o;a++)s.push(p1.sprintf("(0{1,4}:){%d}:(0{1,4}:){%d}0{1,4}",a,t-a-o-1));return ev(s)}en.possibleElisions=rFe});var dfe=m(bo=>{l();"use strict";var iFe=bo&&bo.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),nFe=bo&&bo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rv=bo&&bo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&iFe(e,t,r);return nFe(e,t),e},cfe=bo&&bo.__spreadArray||function(t,e){for(var r=0,i=e.length,n=t.length;r<i;r++,n++)t[n]=e[r];return t};Object.defineProperty(bo,"__esModule",{value:!0});bo.Address6=void 0;var ufe=rv(uR()),yR=rv(fR()),Er=rv(hR()),gR=rv(pR()),sh=dR(),oh=afe(),Tu=Q8(),Hn=lR(),Gn=vm();function iv(t){if(!t)throw new Error("Assertion failed.")}function sFe(t){for(var e=/(\d+)(\d{3})/;e.test(t);)t=t.replace(e,"$1,$2");return t}function oFe(t){return t=t.replace(/^(0{1,})([1-9]+)$/,'<span class="parse-error">$1</span>$2'),t=t.replace(/^(0{1,})(0)$/,'<span class="parse-error">$1</span>$2'),t}function aFe(t,e){var r=[],i=[],n;for(n=0;n<t.length;n++)n<e[0]?r.push(t[n]):n>e[1]&&i.push(t[n]);return r.concat(["compact"]).concat(i)}function ffe(t){return Gn.sprintf("%04x",parseInt(t,16))}function lfe(t){return t&255}var cFe=function(){function t(e,r){this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=ufe.isInSubnet,this.isCorrect=ufe.isCorrect(Er.BITS),r===void 0?this.groups=Er.GROUPS:this.groups=r,this.address=e;var i=Er.RE_SUBNET_STRING.exec(e);if(i){if(this.parsedSubnet=i[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet="/"+this.subnetMask,Number.isNaN(this.subnetMask)||this.subnetMask<0||this.subnetMask>Er.BITS)throw new Tu.AddressError("Invalid subnet mask.");e=e.replace(Er.RE_SUBNET_STRING,"")}else if(/\//.test(e))throw new Tu.AddressError("Invalid subnet mask.");var n=Er.RE_ZONE_STRING.exec(e);n&&(this.zone=n[0],e=e.replace(Er.RE_ZONE_STRING,"")),this.addressMinusSuffix=e,this.parsedAddress=this.parse(this.addressMinusSuffix)}return t.isValid=function(e){try{return new t(e),!0}catch(r){return!1}},t.fromBigInteger=function(e){var r=e.toString(16).padStart(32,"0"),i=[],n;for(n=0;n<Er.GROUPS;n++)i.push(r.slice(n*4,(n+1)*4));return new t(i.join(":"))},t.fromURL=function(e){var r,i=null,n;if(e.indexOf("[")!==-1&&e.indexOf("]:")!==-1){if(n=Er.RE_URL_WITH_PORT.exec(e),n===null)return{error:"failed to parse address with port",address:null,port:null};r=n[1],i=n[2]}else if(e.indexOf("/")!==-1){if(e=e.replace(/^[a-z0-9]+:\/\//,""),n=Er.RE_URL.exec(e),n===null)return{error:"failed to parse address from URL",address:null,port:null};r=n[1]}else r=e;return i?(i=parseInt(i,10),(i<0||i>65536)&&(i=null)):i=null,{address:new t(r),port:i}},t.fromAddress4=function(e){var r=new sh.Address4(e),i=Er.BITS-(yR.BITS-r.subnetMask);return new t("::ffff:"+r.correctForm()+"/"+i)},t.fromArpa=function(e){var r=e.replace(/(\.ip6\.arpa)?\.$/,""),i=7;if(r.length!==63)throw new Tu.AddressError("Invalid 'ip6.arpa' form.");for(var n=r.split(".").reverse(),s=i;s>0;s--){var o=s*4;n.splice(o,0,":")}return r=n.join(""),new t(r)},t.prototype.microsoftTranscription=function(){return Gn.sprintf("%s.ipv6-literal.net",this.correctForm().replace(/:/g,"-"))},t.prototype.mask=function(e){return e===void 0&&(e=this.subnetMask),this.getBitsBase2(0,e)},t.prototype.possibleSubnets=function(e){e===void 0&&(e=128);var r=Er.BITS-this.subnetMask,i=Math.abs(e-Er.BITS),n=r-i;return n<0?"0":sFe(new Hn.BigInteger("2",10).pow(n).toString(10))},t.prototype._startAddress=function(){return new Hn.BigInteger(this.mask()+"0".repeat(Er.BITS-this.subnetMask),2)},t.prototype.startAddress=function(){return t.fromBigInteger(this._startAddress())},t.prototype.startAddressExclusive=function(){var e=new Hn.BigInteger("1");return t.fromBigInteger(this._startAddress().add(e))},t.prototype._endAddress=function(){return new Hn.BigInteger(this.mask()+"1".repeat(Er.BITS-this.subnetMask),2)},t.prototype.endAddress=function(){return t.fromBigInteger(this._endAddress())},t.prototype.endAddressExclusive=function(){var e=new Hn.BigInteger("1");return t.fromBigInteger(this._endAddress().subtract(e))},t.prototype.getScope=function(){var e=Er.SCOPES[this.getBits(12,16).intValue()];return this.getType()==="Global unicast"&&e!=="Link local"&&(e="Global"),e||"Unknown"},t.prototype.getType=function(){for(var e=0,r=Object.keys(Er.TYPES);e<r.length;e++){var i=r[e];if(this.isInSubnet(new t(i)))return Er.TYPES[i]}return"Global unicast"},t.prototype.getBits=function(e,r){return new Hn.BigInteger(this.getBitsBase2(e,r),2)},t.prototype.getBitsBase2=function(e,r){return this.binaryZeroPad().slice(e,r)},t.prototype.getBitsBase16=function(e,r){var i=r-e;if(i%4!=0)throw new Error("Length of bits to retrieve must be divisible by four");return this.getBits(e,r).toString(16).padStart(i/4,"0")},t.prototype.getBitsPastSubnet=function(){return this.getBitsBase2(this.subnetMask,Er.BITS)},t.prototype.reverseForm=function(e){e||(e={});var r=Math.floor(this.subnetMask/4),i=this.canonicalForm().replace(/:/g,"").split("").slice(0,r).reverse().join(".");return r>0?e.omitSuffix?i:Gn.sprintf("%s.ip6.arpa.",i):e.omitSuffix?"":"ip6.arpa."},t.prototype.correctForm=function(){var e,r=[],i=0,n=[];for(e=0;e<this.parsedAddress.length;e++){var s=parseInt(this.parsedAddress[e],16);s===0&&i++,s!==0&&i>0&&(i>1&&n.push([e-i,e-1]),i=0)}i>1&&n.push([this.parsedAddress.length-i,this.parsedAddress.length-1]);var o=n.map(function(u){return u[1]-u[0]+1});if(n.length>0){var a=o.indexOf(Math.max.apply(Math,o));r=aFe(this.parsedAddress,n[a])}else r=this.parsedAddress;for(e=0;e<r.length;e++)r[e]!=="compact"&&(r[e]=parseInt(r[e],16).toString(16));var c=r.join(":");return c=c.replace(/^compact$/,"::"),c=c.replace(/^compact|compact$/,":"),c=c.replace(/compact/,""),c},t.prototype.binaryZeroPad=function(){return this.bigInteger().toString(2).padStart(Er.BITS,"0")},t.prototype.parse4in6=function(e){var r=e.split(":"),i=r.slice(-1)[0],n=i.match(yR.RE_ADDRESS);if(n){this.parsedAddress4=n[0],this.address4=new sh.Address4(this.parsedAddress4);for(var s=0;s<this.address4.groups;s++)if(/^0[0-9]+/.test(this.address4.parsedAddress[s]))throw new Tu.AddressError("IPv4 addresses can't have leading zeroes.",e.replace(yR.RE_ADDRESS,this.address4.parsedAddress.map(oFe).join(".")));this.v4=!0,r[r.length-1]=this.address4.toGroup6(),e=r.join(":")}return e},t.prototype.parse=function(e){e=this.parse4in6(e);var r=e.match(Er.RE_BAD_CHARACTERS);if(r)throw new Tu.AddressError(Gn.sprintf("Bad character%s detected in address: %s",r.length>1?"s":"",r.join("")),e.replace(Er.RE_BAD_CHARACTERS,'<span class="parse-error">$1</span>'));var i=e.match(Er.RE_BAD_ADDRESS);if(i)throw new Tu.AddressError(Gn.sprintf("Address failed regex: %s",i.join("")),e.replace(Er.RE_BAD_ADDRESS,'<span class="parse-error">$1</span>'));var n=[],s=e.split("::");if(s.length===2){var o=s[0].split(":"),a=s[1].split(":");o.length===1&&o[0]===""&&(o=[]),a.length===1&&a[0]===""&&(a=[]);var c=this.groups-(o.length+a.length);if(!c)throw new Tu.AddressError("Error parsing groups");this.elidedGroups=c,this.elisionBegin=o.length,this.elisionEnd=o.length+this.elidedGroups,n=n.concat(o);for(var u=0;u<c;u++)n.push("0");n=n.concat(a)}else if(s.length===1)n=e.split(":"),this.elidedGroups=0;else throw new Tu.AddressError("Too many :: groups found");if(n=n.map(function(f){return Gn.sprintf("%x",parseInt(f,16))}),n.length!==this.groups)throw new Tu.AddressError("Incorrect number of groups found");return n},t.prototype.canonicalForm=function(){return this.parsedAddress.map(ffe).join(":")},t.prototype.decimal=function(){return this.parsedAddress.map(function(e){return Gn.sprintf("%05d",parseInt(e,16))}).join(":")},t.prototype.bigInteger=function(){return new Hn.BigInteger(this.parsedAddress.map(ffe).join(""),16)},t.prototype.to4=function(){var e=this.binaryZeroPad().split("");return sh.Address4.fromHex(new Hn.BigInteger(e.slice(96,128).join(""),2).toString(16))},t.prototype.to4in6=function(){var e=this.to4(),r=new t(this.parsedAddress.slice(0,6).join(":"),6),i=r.correctForm(),n="";return/:$/.test(i)||(n=":"),i+n+e.address},t.prototype.inspectTeredo=function(){var e=this.getBitsBase16(0,32),r=this.getBits(80,96).xor(new Hn.BigInteger("ffff",16)).toString(),i=sh.Address4.fromHex(this.getBitsBase16(32,64)),n=sh.Address4.fromHex(this.getBits(96,128).xor(new Hn.BigInteger("ffffffff",16)).toString(16)),s=this.getBits(64,80),o=this.getBitsBase2(64,80),a=s.testBit(15),c=s.testBit(14),u=s.testBit(8),f=s.testBit(9),d=new Hn.BigInteger(o.slice(2,6)+o.slice(8,16),2).toString(10);return{prefix:Gn.sprintf("%s:%s",e.slice(0,4),e.slice(4,8)),server4:i.address,client4:n.address,flags:o,coneNat:a,microsoft:{reserved:c,universalLocal:f,groupIndividual:u,nonce:d},udpPort:r}},t.prototype.inspect6to4=function(){var e=this.getBitsBase16(0,16),r=sh.Address4.fromHex(this.getBitsBase16(16,48));return{prefix:Gn.sprintf("%s",e.slice(0,4)),gateway:r.address}},t.prototype.to6to4=function(){if(!this.is4())return null;var e=["2002",this.getBitsBase16(96,112),this.getBitsBase16(112,128),"","/16"].join(":");return new t(e)},t.prototype.toByteArray=function(){var e=this.bigInteger().toByteArray();return e.length===17&&e[0]===0?e.slice(1):e},t.prototype.toUnsignedByteArray=function(){return this.toByteArray().map(lfe)},t.fromByteArray=function(e){return this.fromUnsignedByteArray(e.map(lfe))},t.fromUnsignedByteArray=function(e){for(var r=new Hn.BigInteger("256",10),i=new Hn.BigInteger("0",10),n=new Hn.BigInteger("1",10),s=e.length-1;s>=0;s--)i=i.add(n.multiply(new Hn.BigInteger(e[s].toString(10),10))),n=n.multiply(r);return t.fromBigInteger(i)},t.prototype.isCanonical=function(){return this.addressMinusSuffix===this.canonicalForm()},t.prototype.isLinkLocal=function(){return this.getBitsBase2(0,64)==="1111111010000000000000000000000000000000000000000000000000000000"},t.prototype.isMulticast=function(){return this.getType()==="Multicast"},t.prototype.is4=function(){return this.v4},t.prototype.isTeredo=function(){return this.isInSubnet(new t("2001::/32"))},t.prototype.is6to4=function(){return this.isInSubnet(new t("2002::/16"))},t.prototype.isLoopback=function(){return this.getType()==="Loopback"},t.prototype.href=function(e){return e===void 0?e="":e=Gn.sprintf(":%s",e),Gn.sprintf("http://[%s]%s/",this.correctForm(),e)},t.prototype.link=function(e){e||(e={}),e.className===void 0&&(e.className=""),e.prefix===void 0&&(e.prefix="/#address="),e.v4===void 0&&(e.v4=!1);var r=this.correctForm;return e.v4&&(r=this.to4in6),e.className?Gn.sprintf('<a href="%1$s%2$s" class="%3$s">%2$s</a>',e.prefix,r.call(this),e.className):Gn.sprintf('<a href="%1$s%2$s">%2$s</a>',e.prefix,r.call(this))},t.prototype.group=function(){if(this.elidedGroups===0)return gR.simpleGroup(this.address).join(":");iv(typeof this.elidedGroups=="number"),iv(typeof this.elisionBegin=="number");var e=[],r=this.address.split("::"),i=r[0],n=r[1];i.length?e.push.apply(e,gR.simpleGroup(i)):e.push("");for(var s=["hover-group"],o=this.elisionBegin;o<this.elisionBegin+this.elidedGroups;o++)s.push(Gn.sprintf("group-%d",o));return e.push(Gn.sprintf('<span class="%s"></span>',s.join(" "))),n.length?e.push.apply(e,gR.simpleGroup(n,this.elisionEnd)):e.push(""),this.is4()&&(iv(this.address4 instanceof sh.Address4),e.pop(),e.push(this.address4.groupForV6())),e.join(":")},t.prototype.regularExpressionString=function(e){e===void 0&&(e=!1);var r=[],i=new t(this.correctForm());if(i.elidedGroups===0)r.push(oh.simpleRegularExpression(i.parsedAddress));else if(i.elidedGroups===Er.GROUPS)r.push(oh.possibleElisions(Er.GROUPS));else{var n=i.address.split("::");n[0].length&&r.push(oh.simpleRegularExpression(n[0].split(":"))),iv(typeof i.elidedGroups=="number"),r.push(oh.possibleElisions(i.elidedGroups,n[0].length!==0,n[1].length!==0)),n[1].length&&r.push(oh.simpleRegularExpression(n[1].split(":"))),r=[r.join(":")]}return e||(r=cfe(cfe(["(?=^|",oh.ADDRESS_BOUNDARY,"|[^\\w\\:])("],r),[")(?=[^\\w\\:]|",oh.ADDRESS_BOUNDARY,"|$)"])),r.join("")},t.prototype.regularExpression=function(e){return e===void 0&&(e=!1),new RegExp(this.regularExpressionString(e),"i")},t}();bo.Address6=cFe});var hfe=m(On=>{l();"use strict";var uFe=On&&On.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),fFe=On&&On.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lFe=On&&On.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&uFe(e,t,r);return fFe(e,t),e};Object.defineProperty(On,"__esModule",{value:!0});On.v6=On.AddressError=On.Address6=On.Address4=void 0;var dFe=dR();Object.defineProperty(On,"Address4",{enumerable:!0,get:function(){return dFe.Address4}});var hFe=dfe();Object.defineProperty(On,"Address6",{enumerable:!0,get:function(){return hFe.Address6}});var pFe=Q8();Object.defineProperty(On,"AddressError",{enumerable:!0,get:function(){return pFe.AddressError}});var yFe=lFe(pR());On.v6={helpers:yFe}});var wR=m((lPt,vR)=>{l();"use strict";var pfe=Ee(),gFe=Object.assign(pfe("libp2p:ip-port-to-multiaddr"),{error:pfe("libp2p:ip-port-to-multiaddr:err")}),{Multiaddr:mR}=rt(),bR=Jue(),{Address4:mFe,Address6:bFe}=hfe(),nv={ERR_INVALID_IP_PARAMETER:"ERR_INVALID_IP_PARAMETER",ERR_INVALID_PORT_PARAMETER:"ERR_INVALID_PORT_PARAMETER",ERR_INVALID_IP:"ERR_INVALID_IP"};function vFe(t,e){if(typeof t!="string")throw bR(new Error(`invalid ip provided: ${t}`),nv.ERR_INVALID_IP_PARAMETER);if(typeof e=="string"&&(e=parseInt(e)),isNaN(e))throw bR(new Error(`invalid port provided: ${e}`),nv.ERR_INVALID_PORT_PARAMETER);try{return new mFe(t),new mR(`/ip4/${t}/tcp/${e}`)}catch{}try{let r=new bFe(t);return r.is4()?new mR(`/ip4/${r.to4().correctForm()}/tcp/${e}`):new mR(`/ip6/${t}/tcp/${e}`)}catch(r){let i=`invalid ip:port for creating a multiaddr: ${t}:${e}`;throw gFe.error(i),bR(new Error(i),nv.ERR_INVALID_IP)}}vR.exports=vFe;vR.exports.Errors=nv});var gfe=m((dPt,sv)=>{l();"use strict";var _R=class extends Error{constructor(e){super(e);this.name="TimeoutError"}},yfe=(t,e,r,i)=>{let n,s=new Promise((o,a)=>{if(typeof e!="number"||e<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(e===1/0){o(t);return}i={customTimers:{setTimeout,clearTimeout},...i},n=i.customTimers.setTimeout.call(void 0,()=>{if(typeof r=="function"){try{o(r())}catch(f){a(f)}return}let c=typeof r=="string"?r:`Promise timed out after ${e} milliseconds`,u=r instanceof Error?r:new _R(c);typeof t.cancel=="function"&&t.cancel(),a(u)},e),(async()=>{try{o(await t)}catch(c){a(c)}finally{i.customTimers.clearTimeout.call(void 0,n)}})()});return s.clear=()=>{clearTimeout(n),n=void 0},s};sv.exports=yfe;sv.exports.default=yfe;sv.exports.TimeoutError=_R});var _fe=m((hPt,wfe)=>{l();"use strict";var mfe=wc(),{CLOSE_TIMEOUT:wFe}=cR(),bfe=wR(),_Fe=gfe(),vfe=Ee(),ER=vfe("libp2p:websockets:socket");ER.error=vfe("libp2p:websockets:socket:error");wfe.exports=(t,e={})=>{let r={async sink(i){e.signal&&(i=mfe(i,e.signal));try{await t.sink(async function*(){for await(let n of i)yield n instanceof Uint8Array?n:n.slice()}())}catch(n){n.type!=="aborted"&&ER.error(n)}},source:e.signal?mfe(t.source,e.signal):t.source,conn:t,localAddr:e.localAddr||(t.localAddress&&t.localPort?bfe(t.localAddress,t.localPort):void 0),remoteAddr:e.remoteAddr||bfe(t.remoteAddress,t.remotePort),timeline:{open:Date.now()},async close(){let i=Date.now();try{await _Fe(t.close(),wFe)}catch(n){let{host:s,port:o}=r.remoteAddr.toOptions();ER("timeout closing stream to %s:%s after %dms, destroying it manually",s,o,Date.now()-i),t.destroy()}finally{r.timeline.close=Date.now()}}};return t.socket.once&&t.socket.once("close",()=>{r.timeline.close||(r.timeline.close=Date.now())}),r}});var xfe=m((pPt,Sfe)=>{l();"use strict";var ul=Bl(),{CODE_CIRCUIT:SR,CODE_P2P:xR,CODE_TCP:AR,CODE_WS:EFe,CODE_WSS:Efe}=cR();Sfe.exports={all:t=>t.filter(e=>{if(e.protoCodes().includes(SR))return!1;let r=e.decapsulateCode(xR);return ul.WebSockets.matches(r)||ul.WebSocketsSecure.matches(r)}),dnsWss:t=>t.filter(e=>{if(e.protoCodes().includes(SR))return!1;let r=e.decapsulateCode(xR);return ul.WebSocketsSecure.matches(r)&&ul.DNS.matches(r.decapsulateCode(AR).decapsulateCode(Efe))}),dnsWsOrWss:t=>t.filter(e=>{if(e.protoCodes().includes(SR))return!1;let r=e.decapsulateCode(xR);return ul.WebSockets.matches(r)?ul.DNS.matches(r.decapsulateCode(AR).decapsulateCode(EFe)):ul.WebSocketsSecure.matches(r)&&ul.DNS.matches(r.decapsulateCode(AR).decapsulateCode(Efe))})}});var Ofe=m((yPt,Cfe)=>{l();"use strict";var SFe=Wue(),xFe=P4(),AFe=Yb(),{AbortError:Afe}=wc(),IFe=fu(),Ife=Ee(),fl=Ife("libp2p:websockets");fl.error=Ife("libp2p:websockets:error");var Tfe=P2(),TFe=Xue(),RFe=_fe(),Rfe=xfe(),Pfe=class{constructor({upgrader:e,filter:r}){if(!e)throw new Error("An upgrader must be provided. See https://github.com/libp2p/interface-transport#upgrader.");this._upgrader=e,this._filter=r}async dial(e,r={}){fl("dialing %s",e);let i=await this._connect(e,r),n=RFe(i,{remoteAddr:e,signal:r.signal});fl("new outbound connection %s",n.remoteAddr);let s=await this._upgrader.upgradeOutbound(n);return fl("outbound connection %s upgraded",n.remoteAddr),s}async _connect(e,r={}){if(r.signal&&r.signal.aborted)throw new Afe;let i=e.toOptions();fl("dialing %s:%s",i.host,i.port);let n=IFe(),s=u=>{let f=`connection error: ${u.message}`;fl.error(f),n.reject(u)},o=SFe(AFe(e),Object.assign({binary:!0},r));if(o.socket.on?o.socket.on("error",s):o.socket.onerror=s,!r.signal)return await Promise.race([o.connected(),n.promise]),fl("connected %s",e),o;let a,c=new Promise((u,f)=>{if(a=()=>{f(new Afe),setTimeout(()=>{o.close()})},r.signal.aborted)return a();r.signal.addEventListener("abort",a)});try{await Promise.race([c,n.promise,o.connected()])}finally{r.signal.removeEventListener("abort",a)}return fl("connected %s",e),o}createListener(e={},r){return typeof e=="function"&&(r=e,e={}),TFe({handler:r,upgrader:this._upgrader},e)}filter(e){return e=Array.isArray(e)?e:[e],this._filter?this._filter(e):Tfe.isBrowser||Tfe.isWebWorker?Rfe.dnsWss(e):Rfe.all(e)}};Cfe.exports=xFe(Pfe,{className:"WebSockets",symbolName:"@libp2p/js-libp2p-websockets/websockets"})});var IR=m((gPt,Dfe)=>{l();"use strict";function kfe(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function PFe(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return kfe(t,r)}catch(i){r.message=t.message,r.stack=t.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(t)),kfe(new n,r)}}Dfe.exports=PFe});var Nfe=m((mPt,Bfe)=>{l();Bfe.exports=function(){if(typeof globalThis=="undefined")return null;var e={RTCPeerConnection:globalThis.RTCPeerConnection||globalThis.mozRTCPeerConnection||globalThis.webkitRTCPeerConnection,RTCSessionDescription:globalThis.RTCSessionDescription||globalThis.mozRTCSessionDescription||globalThis.webkitRTCSessionDescription,RTCIceCandidate:globalThis.RTCIceCandidate||globalThis.mozRTCIceCandidate||globalThis.webkitRTCIceCandidate};return e.RTCPeerConnection?e:null}});var qfe=m((TR,Lfe)=>{l();var ov=Ht(),Tc=ov.Buffer;function Mfe(t,e){for(var r in t)e[r]=t[r]}Tc.from&&Tc.alloc&&Tc.allocUnsafe&&Tc.allocUnsafeSlow?Lfe.exports=ov:(Mfe(ov,TR),TR.Buffer=ah);function ah(t,e,r){return Tc(t,e,r)}ah.prototype=Object.create(Tc.prototype);Mfe(Tc,ah);ah.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return Tc(t,e,r)};ah.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var i=Tc(t);return e!==void 0?typeof r=="string"?i.fill(e,r):i.fill(e):i.fill(0),i};ah.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Tc(t)};ah.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return ov.SlowBuffer(t)}});var CR=m((bPt,PR)=>{l();"use strict";var RR=65536,CFe=4294967295;function OFe(){throw new Error(`Secure random number generation is not supported by this browser.
Use Chrome, Firefox or Internet Explorer 11`)}var kFe=qfe().Buffer,av=globalThis.crypto||globalThis.msCrypto;av&&av.getRandomValues?PR.exports=DFe:PR.exports=OFe;function DFe(t,e){if(t>CFe)throw new RangeError("requested too many random bytes");var r=kFe.allocUnsafe(t);if(t>0)if(t>RR)for(var i=0;i<t;i+=RR)av.getRandomValues(r.slice(i,i+RR));else av.getRandomValues(r);return typeof e=="function"?process.nextTick(function(){e(null,r)}):r}});var Ffe=m((vPt,Ufe)=>{l();"use strict";function jfe(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function BFe(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=void 0),e!=null&&(r.code=e);try{return jfe(t,r)}catch(i){r.message=t.message,r.stack=t.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(t)),jfe(new n,r)}}Ufe.exports=BFe});var DR=m((wPt,Hfe)=>{l();var NFe=Ee()("simple-peer"),Kfe=Nfe(),Vfe=CR(),MFe=YI(),OR=H5(),Sr=Ffe(),kR=64*1024,LFe=5*1e3,qFe=5*1e3;function zfe(t){return t.replace(/a=ice-options:trickle\s\n/g,"")}function jFe(t){console.warn(t)}var ll=class extends MFe.Duplex{constructor(e){e=Object.assign({allowHalfOpen:!1},e);super(e);if(this._id=Vfe(4).toString("hex").slice(0,7),this._debug("new peer %o",e),this.channelName=e.initiator?e.channelName||Vfe(20).toString("hex"):null,this.initiator=e.initiator||!1,this.channelConfig=e.channelConfig||ll.channelConfig,this.negotiated=this.channelConfig.negotiated,this.config=Object.assign({},ll.config,e.config),this.offerOptions=e.offerOptions||{},this.answerOptions=e.answerOptions||{},this.sdpTransform=e.sdpTransform||(r=>r),this.streams=e.streams||(e.stream?[e.stream]:[]),this.trickle=e.trickle!==void 0?e.trickle:!0,this.allowHalfTrickle=e.allowHalfTrickle!==void 0?e.allowHalfTrickle:!1,this.iceCompleteTimeout=e.iceCompleteTimeout||LFe,this._connected=!1,this.remoteAddress=void 0,this.remoteFamily=void 0,this.remotePort=void 0,this.localAddress=void 0,this.localFamily=void 0,this.localPort=void 0,this._wrtc=e.wrtc&&typeof e.wrtc=="object"?e.wrtc:Kfe(),!this._wrtc)throw typeof window=="undefined"?Sr(new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"),"ERR_WEBRTC_SUPPORT"):Sr(new Error("No WebRTC support: Not a supported browser"),"ERR_WEBRTC_SUPPORT");this._pcReady=!1,this._channelReady=!1,this._iceComplete=!1,this._iceCompleteTimer=null,this._channel=null,this._pendingCandidates=[],this._isNegotiating=this.negotiated?!1:!this.initiator,this._batchedNegotiation=!1,this._queuedNegotiation=!1,this._sendersAwaitingStable=[],this._senderMap=new Map,this._firstStable=!0,this._closingInterval=null,this._remoteTracks=[],this._remoteStreams=[],this._chunk=null,this._cb=null,this._interval=null;try{this._pc=new this._wrtc.RTCPeerConnection(this.config)}catch(r){OR(()=>this.destroy(Sr(r,"ERR_PC_CONSTRUCTOR")));return}this._isReactNativeWebrtc=typeof this._pc._peerConnectionId=="number",this._pc.oniceconnectionstatechange=()=>{this._onIceStateChange()},this._pc.onicegatheringstatechange=()=>{this._onIceStateChange()},this._pc.onconnectionstatechange=()=>{this._onConnectionStateChange()},this._pc.onsignalingstatechange=()=>{this._onSignalingStateChange()},this._pc.onicecandidate=r=>{this._onIceCandidate(r)},this.initiator||this.negotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=r=>{this._setupData(r)},this.streams&&this.streams.forEach(r=>{this.addStream(r)}),this._pc.ontrack=r=>{this._onTrack(r)},this.initiator&&this._needsNegotiation(),this._onFinishBound=()=>{this._onFinish()},this.once("finish",this._onFinishBound)}get bufferSize(){return this._channel&&this._channel.bufferedAmount||0}get connected(){return this._connected&&this._channel.readyState==="open"}address(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}signal(e){if(this.destroyed)throw Sr(new Error("cannot signal after peer is destroyed"),"ERR_SIGNALING");if(typeof e=="string")try{e=JSON.parse(e)}catch(r){e={}}this._debug("signal()"),e.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),e.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(e.transceiverRequest.kind,e.transceiverRequest.init)),e.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(e.candidate):this._pendingCandidates.push(e.candidate)),e.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(e)).then(()=>{this.destroyed||(this._pendingCandidates.forEach(r=>{this._addIceCandidate(r)}),this._pendingCandidates=[],this._pc.remoteDescription.type==="offer"&&this._createAnswer())}).catch(r=>{this.destroy(Sr(r,"ERR_SET_REMOTE_DESCRIPTION"))}),!e.sdp&&!e.candidate&&!e.renegotiate&&!e.transceiverRequest&&this.destroy(Sr(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}_addIceCandidate(e){var r=new this._wrtc.RTCIceCandidate(e);this._pc.addIceCandidate(r).catch(i=>{!r.address||r.address.endsWith(".local")?jFe("Ignoring unsupported ICE candidate."):this.destroy(Sr(i,"ERR_ADD_ICE_CANDIDATE"))})}send(e){this._channel.send(e)}addTransceiver(e,r){if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(e,r),this._needsNegotiation()}catch(i){this.destroy(Sr(i,"ERR_ADD_TRANSCEIVER"))}else this.emit("signal",{transceiverRequest:{kind:e,init:r}})}addStream(e){this._debug("addStream()"),e.getTracks().forEach(r=>{this.addTrack(r,e)})}addTrack(e,r){this._debug("addTrack()");var i=this._senderMap.get(e)||new Map,n=i.get(r);if(!n)n=this._pc.addTrack(e,r),i.set(r,n),this._senderMap.set(e,i),this._needsNegotiation();else throw n.removed?Sr(new Error("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):Sr(new Error("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED")}replaceTrack(e,r,i){this._debug("replaceTrack()");var n=this._senderMap.get(e),s=n?n.get(i):null;if(!s)throw Sr(new Error("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED");r&&this._senderMap.set(r,n),s.replaceTrack!=null?s.replaceTrack(r):this.destroy(Sr(new Error("replaceTrack is not supported in this browser"),"ERR_UNSUPPORTED_REPLACETRACK"))}removeTrack(e,r){this._debug("removeSender()");var i=this._senderMap.get(e),n=i?i.get(r):null;if(!n)throw Sr(new Error("Cannot remove track that was never added."),"ERR_TRACK_NOT_ADDED");try{n.removed=!0,this._pc.removeTrack(n)}catch(s){s.name==="NS_ERROR_UNEXPECTED"?this._sendersAwaitingStable.push(n):this.destroy(Sr(s,"ERR_REMOVE_TRACK"))}this._needsNegotiation()}removeStream(e){this._debug("removeSenders()"),e.getTracks().forEach(r=>{this.removeTrack(r,e)})}_needsNegotiation(){this._debug("_needsNegotiation"),!this._batchedNegotiation&&(this._batchedNegotiation=!0,OR(()=>{this._batchedNegotiation=!1,this._debug("starting batched negotiation"),this.negotiate()}))}negotiate(){this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("start negotiation"),setTimeout(()=>{this._createOffer()},0)):this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("requesting negotiation from initiator"),this.emit("signal",{renegotiate:!0})),this._isNegotiating=!0}_destroy(e,r){if(this._debug("destroy (error: %s)",e&&(e.message||e)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this._connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch(i){}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch(i){}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,r(e)}_setupData(e){if(!e.channel)return this.destroy(Sr(new Error("Data channel event is missing `channel` property"),"ERR_DATA_CHANNEL"));this._channel=e.channel,this._channel.binaryType="arraybuffer",typeof this._channel.bufferedAmountLowThreshold=="number"&&(this._channel.bufferedAmountLowThreshold=kR),this.channelName=this._channel.label,this._channel.onmessage=i=>{this._onChannelMessage(i)},this._channel.onbufferedamountlow=()=>{this._onChannelBufferedAmountLow()},this._channel.onopen=()=>{this._onChannelOpen()},this._channel.onclose=()=>{this._onChannelClose()},this._channel.onerror=i=>{this.destroy(Sr(i,"ERR_DATA_CHANNEL"))};var r=!1;this._closingInterval=setInterval(()=>{this._channel&&this._channel.readyState==="closing"?(r&&this._onChannelClose(),r=!0):r=!1},qFe)}_read(){}_write(e,r,i){if(this.destroyed)return i(Sr(new Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(e)}catch(n){return this.destroy(Sr(n,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>kR?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=i):i(null)}else this._debug("write before connect"),this._chunk=e,this._cb=i}_onFinish(){if(this.destroyed)return;let e=()=>{setTimeout(()=>this.destroy(),1e3)};this._connected?e():this.once("connect",e)}_startIceCompleteTimeout(){this.destroyed||this._iceCompleteTimer||(this._debug("started iceComplete timeout"),this._iceCompleteTimer=setTimeout(()=>{this._iceComplete||(this._iceComplete=!0,this._debug("iceComplete timeout completed"),this.emit("iceTimeout"),this.emit("_iceComplete"))},this.iceCompleteTimeout))}_createOffer(){this.destroyed||this._pc.createOffer(this.offerOptions).then(e=>{if(this.destroyed)return;!this.trickle&&!this.allowHalfTrickle&&(e.sdp=zfe(e.sdp)),e.sdp=this.sdpTransform(e.sdp);let r=()=>{if(!this.destroyed){var s=this._pc.localDescription||e;this._debug("signal"),this.emit("signal",{type:s.type,sdp:s.sdp})}},i=()=>{this._debug("createOffer success"),!this.destroyed&&(this.trickle||this._iceComplete?r():this.once("_iceComplete",r))},n=s=>{this.destroy(Sr(s,"ERR_SET_LOCAL_DESCRIPTION"))};this._pc.setLocalDescription(e).then(i).catch(n)}).catch(e=>{this.destroy(Sr(e,"ERR_CREATE_OFFER"))})}_requestMissingTransceivers(){this._pc.getTransceivers&&this._pc.getTransceivers().forEach(e=>{!e.mid&&e.sender.track&&!e.requested&&(e.requested=!0,this.addTransceiver(e.sender.track.kind))})}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then(e=>{if(this.destroyed)return;!this.trickle&&!this.allowHalfTrickle&&(e.sdp=zfe(e.sdp)),e.sdp=this.sdpTransform(e.sdp);let r=()=>{if(!this.destroyed){var s=this._pc.localDescription||e;this._debug("signal"),this.emit("signal",{type:s.type,sdp:s.sdp}),this.initiator||this._requestMissingTransceivers()}},i=()=>{this.destroyed||(this.trickle||this._iceComplete?r():this.once("_iceComplete",r))},n=s=>{this.destroy(Sr(s,"ERR_SET_LOCAL_DESCRIPTION"))};this._pc.setLocalDescription(e).then(i).catch(n)}).catch(e=>{this.destroy(Sr(e,"ERR_CREATE_ANSWER"))})}_onConnectionStateChange(){this.destroyed||this._pc.connectionState==="failed"&&this.destroy(Sr(new Error("Connection failed."),"ERR_CONNECTION_FAILURE"))}_onIceStateChange(){if(!this.destroyed){var e=this._pc.iceConnectionState,r=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",e,r),this.emit("iceStateChange",e,r),(e==="connected"||e==="completed")&&(this._pcReady=!0,this._maybeReady()),e==="failed"&&this.destroy(Sr(new Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),e==="closed"&&this.destroy(Sr(new Error("Ice connection closed."),"ERR_ICE_CONNECTION_CLOSED"))}}getStats(e){let r=i=>(Object.prototype.toString.call(i.values)==="[object Array]"&&i.values.forEach(n=>{Object.assign(i,n)}),i);this._pc.getStats.length===0||this._isReactNativeWebrtc?this._pc.getStats().then(i=>{var n=[];i.forEach(s=>{n.push(r(s))}),e(null,n)},i=>e(i)):this._pc.getStats.length>0?this._pc.getStats(i=>{if(!this.destroyed){var n=[];i.result().forEach(s=>{var o={};s.names().forEach(a=>{o[a]=s.stat(a)}),o.id=s.id,o.type=s.type,o.timestamp=s.timestamp,n.push(r(o))}),e(null,n)}},i=>e(i)):e(null,[])}_maybeReady(){if(this._debug("maybeReady pc %s channel %s",this._pcReady,this._channelReady),this._connected||this._connecting||!this._pcReady||!this._channelReady)return;this._connecting=!0;let e=()=>{this.destroyed||this.getStats((r,i)=>{if(this.destroyed)return;r&&(i=[]);var n={},s={},o={},a=!1;i.forEach(f=>{(f.type==="remotecandidate"||f.type==="remote-candidate")&&(n[f.id]=f),(f.type==="localcandidate"||f.type==="local-candidate")&&(s[f.id]=f),(f.type==="candidatepair"||f.type==="candidate-pair")&&(o[f.id]=f)});let c=f=>{a=!0;var d=s[f.localCandidateId];d&&(d.ip||d.address)?(this.localAddress=d.ip||d.address,this.localPort=Number(d.port)):d&&d.ipAddress?(this.localAddress=d.ipAddress,this.localPort=Number(d.portNumber)):typeof f.googLocalAddress=="string"&&(d=f.googLocalAddress.split(":"),this.localAddress=d[0],this.localPort=Number(d[1])),this.localAddress&&(this.localFamily=this.localAddress.includes(":")?"IPv6":"IPv4");var h=n[f.remoteCandidateId];h&&(h.ip||h.address)?(this.remoteAddress=h.ip||h.address,this.remotePort=Number(h.port)):h&&h.ipAddress?(this.remoteAddress=h.ipAddress,this.remotePort=Number(h.portNumber)):typeof f.googRemoteAddress=="string"&&(h=f.googRemoteAddress.split(":"),this.remoteAddress=h[0],this.remotePort=Number(h[1])),this.remoteAddress&&(this.remoteFamily=this.remoteAddress.includes(":")?"IPv6":"IPv4"),this._debug("connect local: %s:%s remote: %s:%s",this.localAddress,this.localPort,this.remoteAddress,this.remotePort)};if(i.forEach(f=>{f.type==="transport"&&f.selectedCandidatePairId&&c(o[f.selectedCandidatePairId]),(f.type==="googCandidatePair"&&f.googActiveConnection==="true"||(f.type==="candidatepair"||f.type==="candidate-pair")&&f.selected)&&c(f)}),!a&&(!Object.keys(o).length||Object.keys(s).length)){setTimeout(e,100);return}else this._connecting=!1,this._connected=!0;if(this._chunk){try{this.send(this._chunk)}catch(f){return this.destroy(Sr(f,"ERR_DATA_CHANNEL"))}this._chunk=null,this._debug('sent chunk from "write before connect"');var u=this._cb;this._cb=null,u(null)}typeof this._channel.bufferedAmountLowThreshold!="number"&&(this._interval=setInterval(()=>this._onInterval(),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")})};e()}_onInterval(){!this._cb||!this._channel||this._channel.bufferedAmount>kR||this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||(this._pc.signalingState==="stable"&&!this._firstStable&&(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach(e=>{this._pc.removeTrack(e),this._queuedNegotiation=!0}),this._sendersAwaitingStable=[],this._queuedNegotiation&&(this._debug("flushing negotiation queue"),this._queuedNegotiation=!1,this._needsNegotiation()),this._debug("negotiate"),this.emit("negotiate")),this._firstStable=!1,this._debug("signalingStateChange %s",this._pc.signalingState),this.emit("signalingStateChange",this._pc.signalingState))}_onIceCandidate(e){this.destroyed||(e.candidate&&this.trickle?this.emit("signal",{candidate:{candidate:e.candidate.candidate,sdpMLineIndex:e.candidate.sdpMLineIndex,sdpMid:e.candidate.sdpMid}}):!e.candidate&&!this._iceComplete&&(this._iceComplete=!0,this.emit("_iceComplete")),e.candidate&&this._startIceCompleteTimeout())}_onChannelMessage(e){if(!this.destroyed){var r=e.data;r instanceof ArrayBuffer&&(r=new Uint8Array(r)),this.push(r)}}_onChannelBufferedAmountLow(){if(!(this.destroyed||!this._cb)){this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);var e=this._cb;this._cb=null,e(null)}}_onChannelOpen(){this._connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())}_onChannelClose(){this.destroyed||(this._debug("on channel close"),this.destroy())}_onTrack(e){this.destroyed||e.streams.forEach(r=>{this._debug("on track"),this.emit("track",e.track,r),this._remoteTracks.push({track:e.track,stream:r}),!this._remoteStreams.some(i=>i.id===r.id)&&(this._remoteStreams.push(r),OR(()=>{this.emit("stream",r)}))})}_debug(){var e=[].slice.call(arguments);e[0]="["+this._id+"] "+e[0],NFe.apply(null,e)}};ll.WEBRTC_SUPPORT=!!Kfe();ll.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"};ll.channelConfig={};Hfe.exports=ll});var $fe=m((_Pt,Gfe)=>{l();"use strict";Gfe.exports={supportsFileReader:typeof self!="undefined"&&"FileReader"in self,supportsWebRTC:"RTCPeerConnection"in globalThis&&typeof navigator!="undefined"&&typeof navigator.mediaDevices!="undefined"&&"getUserMedia"in navigator.mediaDevices,supportsWebRTCDataChannels:"RTCPeerConnection"in globalThis}});var uv=m(cv=>{l();"use strict";cv.CODE_P2P=421;cv.CODE_CIRCUIT=290;cv.CLOSE_TIMEOUT=2e3});var BR=m((SPt,Wfe)=>{l();var UFe=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,FFe=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];Wfe.exports=function(e){var r=e,i=e.indexOf("["),n=e.indexOf("]");i!=-1&&n!=-1&&(e=e.substring(0,i)+e.substring(i,n).replace(/:/g,";")+e.substring(n,e.length));for(var s=UFe.exec(e||""),o={},a=14;a--;)o[FFe[a]]=s[a]||"";return i!=-1&&n!=-1&&(o.source=r,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=KFe(o,o.path),o.queryKey=VFe(o,o.query),o};function KFe(t,e){var r=/\/{2,9}/g,i=e.replace(r,"/").split("/");return(e.substr(0,1)=="/"||e.length===0)&&i.splice(0,1),e.substr(e.length-1,1)=="/"&&i.splice(i.length-1,1),i}function VFe(t,e){var r={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,n,s){n&&(r[n]=s)}),r}});var Xfe=m(fv=>{l();"use strict";Object.defineProperty(fv,"__esModule",{value:!0});fv.url=void 0;var zFe=BR(),Yfe=Ee()("socket.io-client:url");function HFe(t,e="",r){let i=t;r=r||typeof location!="undefined"&&location,t==null&&(t=r.protocol+"//"+r.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=r.protocol+t:t=r.host+t),/^(https?|wss?):\/\//.test(t)||(Yfe("protocol-less url %s",t),typeof r!="undefined"?t=r.protocol+"//"+t:t="https://"+t),Yfe("parse %s",t),i=zFe(t)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";let s=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+s+":"+i.port+e,i.href=i.protocol+"://"+s+(r&&r.port===i.port?"":":"+i.port),i}fv.url=HFe});var Qfe=m((APt,NR)=>{l();try{NR.exports=typeof XMLHttpRequest!="undefined"&&"withCredentials"in new XMLHttpRequest}catch(t){NR.exports=!1}});var y1=m((IPt,Zfe)=>{l();Zfe.exports=(()=>typeof self!="undefined"?self:typeof window!="undefined"?window:Function("return this")())()});var MR=m((TPt,Jfe)=>{l();var GFe=Qfe(),$Fe=y1();Jfe.exports=function(t){let e=t.xdomain,r=t.xscheme,i=t.enablesXDR;try{if(typeof XMLHttpRequest!="undefined"&&(!e||GFe))return new XMLHttpRequest}catch(n){}try{if(typeof XDomainRequest!="undefined"&&!r&&i)return new XDomainRequest}catch(n){}if(!e)try{return new $Fe[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch(n){}}});var LR=m((RPt,tle)=>{l();var Rc=Object.create(null);Rc.open="0";Rc.close="1";Rc.ping="2";Rc.pong="3";Rc.message="4";Rc.upgrade="5";Rc.noop="6";var ele=Object.create(null);Object.keys(Rc).forEach(t=>{ele[Rc[t]]=t});var WFe={type:"error",data:"parser error"};tle.exports={PACKET_TYPES:Rc,PACKET_TYPES_REVERSE:ele,ERROR_PACKET:WFe}});var nle=m((PPt,ile)=>{l();var{PACKET_TYPES:YFe}=LR(),XFe=typeof Blob=="function"||typeof Blob!="undefined"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",QFe=typeof ArrayBuffer=="function",ZFe=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,JFe=({type:t,data:e},r,i)=>XFe&&e instanceof Blob?r?i(e):rle(e,i):QFe&&(e instanceof ArrayBuffer||ZFe(e))?r?i(e):rle(new Blob([e]),i):i(YFe[t]+(e||"")),rle=(t,e)=>{let r=new FileReader;return r.onload=function(){let i=r.result.split(",")[1];e("b"+i)},r.readAsDataURL(t)};ile.exports=JFe});var sle=m(qR=>{l();(function(t){"use strict";qR.encode=function(e){var r=new Uint8Array(e),i,n=r.length,s="";for(i=0;i<n;i+=3)s+=t[r[i]>>2],s+=t[(r[i]&3)<<4|r[i+1]>>4],s+=t[(r[i+1]&15)<<2|r[i+2]>>6],s+=t[r[i+2]&63];return n%3==2?s=s.substring(0,s.length-1)+"=":n%3==1&&(s=s.substring(0,s.length-2)+"=="),s},qR.decode=function(e){var r=e.length*.75,i=e.length,n,s=0,o,a,c,u;e[e.length-1]==="="&&(r--,e[e.length-2]==="="&&r--);var f=new ArrayBuffer(r),d=new Uint8Array(f);for(n=0;n<i;n+=4)o=t.indexOf(e[n]),a=t.indexOf(e[n+1]),c=t.indexOf(e[n+2]),u=t.indexOf(e[n+3]),d[s++]=o<<2|a>>4,d[s++]=(a&15)<<4|c>>2,d[s++]=(c&3)<<6|u&63;return f}})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")});var cle=m((OPt,ale)=>{l();var{PACKET_TYPES_REVERSE:jR,ERROR_PACKET:eKe}=LR(),tKe=typeof ArrayBuffer=="function",UR;tKe&&(UR=sle());var rKe=(t,e)=>{if(typeof t!="string")return{type:"message",data:ole(t,e)};let r=t.charAt(0);return r==="b"?{type:"message",data:iKe(t.substring(1),e)}:jR[r]?t.length>1?{type:jR[r],data:t.substring(1)}:{type:jR[r]}:eKe},iKe=(t,e)=>{if(UR){let r=UR.decode(t);return ole(r,e)}else return{base64:!0,data:t}},ole=(t,e)=>{switch(e){case"blob":return t instanceof ArrayBuffer?new Blob([t]):t;case"arraybuffer":default:return t}};ale.exports=rKe});var g1=m((kPt,dle)=>{l();var ule=nle(),fle=cle(),lle=String.fromCharCode(30),nKe=(t,e)=>{let r=t.length,i=new Array(r),n=0;t.forEach((s,o)=>{ule(s,!1,a=>{i[o]=a,++n===r&&e(i.join(lle))})})},sKe=(t,e)=>{let r=t.split(lle),i=[];for(let n=0;n<r.length;n++){let s=fle(r[n],e);if(i.push(s),s.type==="error")break}return i};dle.exports={protocol:4,encodePacket:ule,encodePayload:nKe,decodePacket:fle,decodePayload:sKe}});var m1=m((DPt,FR)=>{l();typeof FR!="undefined"&&(FR.exports=Cs);function Cs(t){if(t)return oKe(t)}function oKe(t){for(var e in Cs.prototype)t[e]=Cs.prototype[e];return t}Cs.prototype.on=Cs.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};Cs.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this};Cs.prototype.off=Cs.prototype.removeListener=Cs.prototype.removeAllListeners=Cs.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var r=this._callbacks["$"+t];if(!r)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var i,n=0;n<r.length;n++)if(i=r[n],i===e||i.fn===e){r.splice(n,1);break}return r.length===0&&delete this._callbacks["$"+t],this};Cs.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),r=this._callbacks["$"+t],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(r){r=r.slice(0);for(var i=0,n=r.length;i<n;++i)r[i].apply(this,e)}return this};Cs.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};Cs.prototype.hasListeners=function(t){return!!this.listeners(t).length}});var b1=m((BPt,KR)=>{l();var lv=y1();KR.exports.pick=(t,...e)=>e.reduce((r,i)=>(t.hasOwnProperty(i)&&(r[i]=t[i]),r),{});var aKe=setTimeout,cKe=clearTimeout;KR.exports.installTimerFunctions=(t,e)=>{e.useNativeTimers?(t.setTimeoutFn=aKe.bind(lv),t.clearTimeoutFn=cKe.bind(lv)):(t.setTimeoutFn=setTimeout.bind(lv),t.clearTimeoutFn=clearTimeout.bind(lv))}});var dv=m((NPt,ple)=>{l();var uKe=g1(),fKe=m1(),{installTimerFunctions:lKe}=b1(),dKe=Ee()("engine.io-client:transport"),hle=class extends fKe{constructor(e){super();lKe(this,e),this.opts=e,this.query=e.query,this.readyState="",this.socket=e.socket}onError(e,r){let i=new Error(e);return i.type="TransportError",i.description=r,this.emit("error",i),this}open(){return(this.readyState==="closed"||this.readyState==="")&&(this.readyState="opening",this.doOpen()),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"?this.write(e):dKe("transport is not open, discarding packets")}onOpen(){this.readyState="open",this.writable=!0,this.emit("open")}onData(e){let r=uKe.decodePacket(e,this.socket.binaryType);this.onPacket(r)}onPacket(e){this.emit("packet",e)}onClose(){this.readyState="closed",this.emit("close")}};ple.exports=hle});var hv=m(VR=>{l();VR.encode=function(t){var e="";for(var r in t)t.hasOwnProperty(r)&&(e.length&&(e+="&"),e+=encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e};VR.decode=function(t){for(var e={},r=t.split("&"),i=0,n=r.length;i<n;i++){var s=r[i].split("=");e[decodeURIComponent(s[0])]=decodeURIComponent(s[1])}return e}});var GR=m((LPt,vle)=>{l();"use strict";var yle="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),pv=64,gle={},mle=0,dl=0,ble;function zR(t){var e="";do e=yle[t%pv]+e,t=Math.floor(t/pv);while(t>0);return e}function hKe(t){var e=0;for(dl=0;dl<t.length;dl++)e=e*pv+gle[t.charAt(dl)];return e}function HR(){var t=zR(+new Date);return t!==ble?(mle=0,ble=t):t+"."+zR(mle++)}for(;dl<pv;dl++)gle[yle[dl]]=dl;HR.encode=zR;HR.decode=hKe;vle.exports=HR});var $R=m((qPt,Ele)=>{l();var pKe=dv(),yKe=hv(),wle=g1(),gKe=GR(),pa=Ee()("engine.io-client:polling"),_le=class extends pKe{get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";let r=()=>{pa("paused"),this.readyState="paused",e()};if(this.polling||!this.writable){let i=0;this.polling&&(pa("we are currently polling - waiting to pause"),i++,this.once("pollComplete",function(){pa("pre-pause polling complete"),--i||r()})),this.writable||(pa("we are currently writing - waiting to pause"),i++,this.once("drain",function(){pa("pre-pause writing complete"),--i||r()}))}else r()}poll(){pa("polling"),this.polling=!0,this.doPoll(),this.emit("poll")}onData(e){pa("polling got data %s",e);let r=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose(),!1;this.onPacket(i)};wle.decodePayload(e,this.socket.binaryType).forEach(r),this.readyState!=="closed"&&(this.polling=!1,this.emit("pollComplete"),this.readyState==="open"?this.poll():pa('ignoring poll - transport state "%s"',this.readyState))}doClose(){let e=()=>{pa("writing close packet"),this.write([{type:"close"}])};this.readyState==="open"?(pa("transport open - closing"),e()):(pa("transport not open - deferring close"),this.once("open",e))}write(e){this.writable=!1,wle.encodePayload(e,r=>{this.doWrite(r,()=>{this.writable=!0,this.emit("drain")})})}uri(){let e=this.query||{},r=this.opts.secure?"https":"http",i="";this.opts.timestampRequests!==!1&&(e[this.opts.timestampParam]=gKe()),!this.supportsBinary&&!e.sid&&(e.b64=1),e=yKe.encode(e),this.opts.port&&(r==="https"&&Number(this.opts.port)!==443||r==="http"&&Number(this.opts.port)!==80)&&(i=":"+this.opts.port),e.length&&(e="?"+e);let n=this.opts.hostname.indexOf(":")!==-1;return r+"://"+(n?"["+this.opts.hostname+"]":this.opts.hostname)+i+this.opts.path+e}};Ele.exports=_le});var Tle=m((jPt,YR)=>{l();var Sle=MR(),mKe=$R(),bKe=m1(),{pick:vKe,installTimerFunctions:wKe}=b1(),_Ke=y1(),WR=Ee()("engine.io-client:polling-xhr");function xle(){}var EKe=function(){return new Sle({xdomain:!1}).responseType!=null}(),Ale=class extends mKe{constructor(e){super(e);if(typeof location!="undefined"){let i=location.protocol==="https:",n=location.port;n||(n=i?443:80),this.xd=typeof location!="undefined"&&e.hostname!==location.hostname||n!==e.port,this.xs=e.secure!==i}let r=e&&e.forceBase64;this.supportsBinary=EKe&&!r}request(e={}){return Object.assign(e,{xd:this.xd,xs:this.xs},this.opts),new vo(this.uri(),e)}doWrite(e,r){let i=this.request({method:"POST",data:e});i.on("success",r),i.on("error",n=>{this.onError("xhr post error",n)})}doPoll(){WR("xhr poll");let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",r=>{this.onError("xhr poll error",r)}),this.pollXhr=e}},vo=class extends bKe{constructor(e,r){super();wKe(this,r),this.opts=r,this.method=r.method||"GET",this.uri=e,this.async=r.async!==!1,this.data=r.data!==void 0?r.data:null,this.create()}create(){let e=vKe(this.opts,"agent","enablesXDR","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd,e.xscheme=!!this.opts.xs;let r=this.xhr=new Sle(e);try{WR("xhr open %s: %s",this.method,this.uri),r.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this.opts.extraHeaders[i])}}catch(i){}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(i){}try{r.setRequestHeader("Accept","*/*")}catch(i){}"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),this.hasXDR()?(r.onload=()=>{this.onLoad()},r.onerror=()=>{this.onError(r.responseText)}):r.onreadystatechange=()=>{r.readyState===4&&(r.status===200||r.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof r.status=="number"?r.status:0)},0))},WR("xhr data %s",this.data),r.send(this.data)}catch(i){this.setTimeoutFn(()=>{this.onError(i)},0);return}typeof document!="undefined"&&(this.index=vo.requestsCount++,vo.requests[this.index]=this)}onSuccess(){this.emit("success"),this.cleanup()}onData(e){this.emit("data",e),this.onSuccess()}onError(e){this.emit("error",e),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr=="undefined"||this.xhr===null)){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=xle:this.xhr.onreadystatechange=xle,e)try{this.xhr.abort()}catch(r){}typeof document!="undefined"&&delete vo.requests[this.index],this.xhr=null}}onLoad(){let e=this.xhr.responseText;e!==null&&this.onData(e)}hasXDR(){return typeof XDomainRequest!="undefined"&&!this.xs&&this.enablesXDR}abort(){this.cleanup()}};vo.requestsCount=0;vo.requests={};if(typeof document!="undefined"){if(typeof attachEvent=="function")attachEvent("onunload",Ile);else if(typeof addEventListener=="function"){let t="onpagehide"in _Ke?"pagehide":"unload";addEventListener(t,Ile,!1)}}function Ile(){for(let t in vo.requests)vo.requests.hasOwnProperty(t)&&vo.requests[t].abort()}YR.exports=Ale;YR.exports.Request=vo});var Ole=m((UPt,Cle)=>{l();var SKe=$R(),Rle=y1(),xKe=/\n/g,AKe=/\\n/g,yv,Ple=class extends SKe{constructor(e){super(e);this.query=this.query||{},yv||(yv=Rle.___eio=Rle.___eio||[]),this.index=yv.length,yv.push(this.onData.bind(this)),this.query.j=this.index}get supportsBinary(){return!1}doClose(){this.script&&(this.script.onerror=()=>{},this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),super.doClose()}doPoll(){let e=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),e.async=!0,e.src=this.uri(),e.onerror=n=>{this.onError("jsonp poll error",n)};let r=document.getElementsByTagName("script")[0];r?r.parentNode.insertBefore(e,r):(document.head||document.body).appendChild(e),this.script=e,typeof navigator!="undefined"&&/gecko/i.test(navigator.userAgent)&&this.setTimeoutFn(function(){let n=document.createElement("iframe");document.body.appendChild(n),document.body.removeChild(n)},100)}doWrite(e,r){let i;if(!this.form){let o=document.createElement("form"),a=document.createElement("textarea"),c=this.iframeId="eio_iframe_"+this.index;o.className="socketio",o.style.position="absolute",o.style.top="-1000px",o.style.left="-1000px",o.target=c,o.method="POST",o.setAttribute("accept-charset","utf-8"),a.name="d",o.appendChild(a),document.body.appendChild(o),this.form=o,this.area=a}this.form.action=this.uri();function n(){s(),r()}let s=()=>{if(this.iframe)try{this.form.removeChild(this.iframe)}catch(o){this.onError("jsonp polling iframe removal error",o)}try{let o='<iframe src="javascript:0" name="'+this.iframeId+'">';i=document.createElement(o)}catch(o){i=document.createElement("iframe"),i.name=this.iframeId,i.src="javascript:0"}i.id=this.iframeId,this.form.appendChild(i),this.iframe=i};s(),e=e.replace(AKe,`\\
`),this.area.value=e.replace(xKe,"\\n");try{this.form.submit()}catch(o){}this.iframe.attachEvent?this.iframe.onreadystatechange=()=>{this.iframe.readyState==="complete"&&n()}:this.iframe.onload=n}};Cle.exports=Ple});var Ble=m((FPt,Dle)=>{l();var kle=y1(),IKe=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,r)=>r(e,0))();Dle.exports={WebSocket:kle.WebSocket||kle.MozWebSocket,usingBrowserWebSocket:!0,defaultBinaryType:"arraybuffer",nextTick:IKe}});var qle=m((KPt,Lle)=>{l();var Nle=dv(),TKe=g1(),RKe=hv(),PKe=GR(),{pick:CKe}=b1(),{WebSocket:_m,usingBrowserWebSocket:XR,defaultBinaryType:OKe,nextTick:kKe}=Ble(),DKe=Ee()("engine.io-client:websocket"),Mle=typeof navigator!="undefined"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",gv=class extends Nle{constructor(e){super(e);this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;let e=this.uri(),r=this.opts.protocols,i=Mle?{}:CKe(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=XR&&!Mle?r?new _m(e,r):new _m(e):new _m(e,r,i)}catch(n){return this.emit("error",n)}this.ws.binaryType=this.socket.binaryType||OKe,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=this.onClose.bind(this),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let r=0;r<e.length;r++){let i=e[r],n=r===e.length-1;TKe.encodePacket(i,this.supportsBinary,s=>{let o={};XR||(i.options&&(o.compress=i.options.compress),this.opts.perMessageDeflate&&(typeof s=="string"?Buffer.byteLength(s):s.length)<this.opts.perMessageDeflate.threshold&&(o.compress=!1));try{XR?this.ws.send(s):this.ws.send(s,o)}catch(a){DKe("websocket closed before onclose event")}n&&kKe(()=>{this.writable=!0,this.emit("drain")},this.setTimeoutFn)})}}onClose(){Nle.prototype.onClose.call(this)}doClose(){typeof this.ws!="undefined"&&(this.ws.close(),this.ws=null)}uri(){let e=this.query||{},r=this.opts.secure?"wss":"ws",i="";this.opts.port&&(r==="wss"&&Number(this.opts.port)!==443||r==="ws"&&Number(this.opts.port)!==80)&&(i=":"+this.opts.port),this.opts.timestampRequests&&(e[this.opts.timestampParam]=PKe()),this.supportsBinary||(e.b64=1),e=RKe.encode(e),e.length&&(e="?"+e);let n=this.opts.hostname.indexOf(":")!==-1;return r+"://"+(n?"["+this.opts.hostname+"]":this.opts.hostname)+i+this.opts.path+e}check(){return!!_m&&!("__initialize"in _m&&this.name===gv.prototype.name)}};Lle.exports=gv});var ZR=m(QR=>{l();var BKe=MR(),NKe=Tle(),MKe=Ole(),LKe=qle();QR.polling=qKe;QR.websocket=LKe;function qKe(t){let e,r=!1,i=!1,n=t.jsonp!==!1;if(typeof location!="undefined"){let s=location.protocol==="https:",o=location.port;o||(o=s?443:80),r=t.hostname!==location.hostname||o!==t.port,i=t.secure!==s}if(t.xdomain=r,t.xscheme=i,e=new BKe(t),"open"in e&&!t.forceJSONP)return new NKe(t);if(!n)throw new Error("JSONP disabled");return new MKe(t)}});var Kle=m((zPt,Fle)=>{l();var jKe=ZR(),UKe=m1(),yi=Ee()("engine.io-client:socket"),jle=g1(),Ule=BR(),FKe=hv(),{installTimerFunctions:KKe}=b1(),Pc=class extends UKe{constructor(e,r={}){super();e&&typeof e=="object"&&(r=e,e=null),e?(e=Ule(e),r.hostname=e.host,r.secure=e.protocol==="https"||e.protocol==="wss",r.port=e.port,e.query&&(r.query=e.query)):r.host&&(r.hostname=Ule(r.host).host),KKe(this,r),this.secure=r.secure!=null?r.secure:typeof location!="undefined"&&location.protocol==="https:",r.hostname&&!r.port&&(r.port=this.secure?"443":"80"),this.hostname=r.hostname||(typeof location!="undefined"?location.hostname:"localhost"),this.port=r.port||(typeof location!="undefined"&&location.port?location.port:this.secure?443:80),this.transports=r.transports||["polling","websocket"],this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,jsonp:!0,timestampParam:"t",rememberUpgrade:!1,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},r),this.opts.path=this.opts.path.replace(/\/$/,"")+"/",typeof this.opts.query=="string"&&(this.opts.query=FKe.decode(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&addEventListener("beforeunload",()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},!1),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close")},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){yi('creating transport "%s"',e);let r=VKe(this.opts.query);r.EIO=jle.protocol,r.transport=e,this.id&&(r.sid=this.id);let i=Object.assign({},this.opts.transportOptions[e],this.opts,{query:r,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return yi("options: %j",i),new jKe[e](i)}open(){let e;if(this.opts.rememberUpgrade&&Pc.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emit("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch(r){yi("error while creating transport: %s",r),this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){yi("setting transport %s",e.name),this.transport&&(yi("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",()=>{this.onClose("transport close")})}probe(e){yi('probing transport "%s"',e);let r=this.createTransport(e,{probe:1}),i=!1;Pc.priorWebsocketSuccess=!1;let n=()=>{i||(yi('probe transport "%s" opened',e),r.send([{type:"ping",data:"probe"}]),r.once("packet",d=>{if(!i)if(d.type==="pong"&&d.data==="probe"){if(yi('probe transport "%s" pong',e),this.upgrading=!0,this.emit("upgrading",r),!r)return;Pc.priorWebsocketSuccess=r.name==="websocket",yi('pausing current transport "%s"',this.transport.name),this.transport.pause(()=>{i||this.readyState!=="closed"&&(yi("changing transport and sending upgrade packet"),f(),this.setTransport(r),r.send([{type:"upgrade"}]),this.emit("upgrade",r),r=null,this.upgrading=!1,this.flush())})}else{yi('probe transport "%s" failed',e);let h=new Error("probe error");h.transport=r.name,this.emit("upgradeError",h)}}))};function s(){i||(i=!0,f(),r.close(),r=null)}let o=d=>{let h=new Error("probe error: "+d);h.transport=r.name,s(),yi('probe transport "%s" failed because of error: %s',e,d),this.emit("upgradeError",h)};function a(){o("transport closed")}function c(){o("socket closed")}function u(d){r&&d.name!==r.name&&(yi('"%s" works - aborting "%s"',d.name,r.name),s())}let f=()=>{r.removeListener("open",n),r.removeListener("error",o),r.removeListener("close",a),this.removeListener("close",c),this.removeListener("upgrading",u)};r.once("open",n),r.once("error",o),r.once("close",a),this.once("close",c),this.once("upgrading",u),r.open()}onOpen(){if(yi("socket open"),this.readyState="open",Pc.priorWebsocketSuccess=this.transport.name==="websocket",this.emit("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade&&this.transport.pause){yi("starting upgrade probes");let e=0,r=this.upgrades.length;for(;e<r;e++)this.probe(this.upgrades[e])}}onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(yi('socket receive: type "%s", data "%s"',e.type,e.data),this.emit("packet",e),this.emit("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.resetPingTimeout(),this.sendPacket("pong"),this.emit("ping"),this.emit("pong");break;case"error":let r=new Error("server error");r.code=e.data,this.onError(r);break;case"message":this.emit("data",e.data),this.emit("message",e.data);break}else yi('packet received with socket readyState "%s"',this.readyState)}onHandshake(e){this.emit("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emit("drain"):this.flush()}flush(){this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(yi("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))}write(e,r,i){return this.sendPacket("message",e,r,i),this}send(e,r,i){return this.sendPacket("message",e,r,i),this}sendPacket(e,r,i,n){if(typeof r=="function"&&(n=r,r=void 0),typeof i=="function"&&(n=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;let s={type:e,data:r,options:i};this.emit("packetCreate",s),this.writeBuffer.push(s),n&&this.once("flush",n),this.flush()}close(){let e=()=>{this.onClose("forced close"),yi("socket closing - telling transport to close"),this.transport.close()},r=()=>{this.removeListener("upgrade",r),this.removeListener("upgradeError",r),e()},i=()=>{this.once("upgrade",r),this.once("upgradeError",r)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():e()}):this.upgrading?i():e()),this}onError(e){yi("socket error %j",e),Pc.priorWebsocketSuccess=!1,this.emit("error",e),this.onClose("transport error",e)}onClose(e,r){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(yi('socket close with reason: "%s"',e),this.clearTimeoutFn(this.pingIntervalTimer),this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&removeEventListener("offline",this.offlineEventListener,!1),this.readyState="closed",this.id=null,this.emit("close",e,r),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){let r=[],i=0,n=e.length;for(;i<n;i++)~this.transports.indexOf(e[i])&&r.push(e[i]);return r}};Pc.priorWebsocketSuccess=!1;Pc.protocol=jle.protocol;function VKe(t){let e={};for(let r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}Fle.exports=Pc});var Vle=m((HPt,ch)=>{l();var JR=Kle();ch.exports=(t,e)=>new JR(t,e);ch.exports.Socket=JR;ch.exports.protocol=JR.protocol;ch.exports.Transport=dv();ch.exports.transports=ZR();ch.exports.parser=g1()});var eP=m(v1=>{l();"use strict";Object.defineProperty(v1,"__esModule",{value:!0});v1.hasBinary=v1.isBinary=void 0;var zKe=typeof ArrayBuffer=="function",HKe=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,zle=Object.prototype.toString,GKe=typeof Blob=="function"||typeof Blob!="undefined"&&zle.call(Blob)==="[object BlobConstructor]",$Ke=typeof File=="function"||typeof File!="undefined"&&zle.call(File)==="[object FileConstructor]";function Hle(t){return zKe&&(t instanceof ArrayBuffer||HKe(t))||GKe&&t instanceof Blob||$Ke&&t instanceof File}v1.isBinary=Hle;function mv(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let r=0,i=t.length;r<i;r++)if(mv(t[r]))return!0;return!1}if(Hle(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return mv(t.toJSON(),!0);for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&mv(t[r]))return!0;return!1}v1.hasBinary=mv});var Gle=m(w1=>{l();"use strict";Object.defineProperty(w1,"__esModule",{value:!0});w1.reconstructPacket=w1.deconstructPacket=void 0;var WKe=eP();function YKe(t){let e=[],r=t.data,i=t;return i.data=tP(r,e),i.attachments=e.length,{packet:i,buffers:e}}w1.deconstructPacket=YKe;function tP(t,e){if(!t)return t;if(WKe.isBinary(t)){let r={_placeholder:!0,num:e.length};return e.push(t),r}else if(Array.isArray(t)){let r=new Array(t.length);for(let i=0;i<t.length;i++)r[i]=tP(t[i],e);return r}else if(typeof t=="object"&&!(t instanceof Date)){let r={};for(let i in t)t.hasOwnProperty(i)&&(r[i]=tP(t[i],e));return r}return t}function XKe(t,e){return t.data=rP(t.data,e),t.attachments=void 0,t}w1.reconstructPacket=XKe;function rP(t,e){if(!t)return t;if(t&&t._placeholder)return e[t.num];if(Array.isArray(t))for(let r=0;r<t.length;r++)t[r]=rP(t[r],e);else if(typeof t=="object")for(let r in t)t.hasOwnProperty(r)&&(t[r]=rP(t[r],e));return t}});var vv=m(ya=>{l();"use strict";Object.defineProperty(ya,"__esModule",{value:!0});ya.Decoder=ya.Encoder=ya.PacketType=ya.protocol=void 0;var QKe=m1(),$le=Gle(),Wle=eP(),iP=Ee()("socket.io-parser");ya.protocol=5;var xi;(function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"})(xi=ya.PacketType||(ya.PacketType={}));var Yle=class{encode(e){return iP("encoding packet %j",e),(e.type===xi.EVENT||e.type===xi.ACK)&&Wle.hasBinary(e)?(e.type=e.type===xi.EVENT?xi.BINARY_EVENT:xi.BINARY_ACK,this.encodeAsBinary(e)):[this.encodeAsString(e)]}encodeAsString(e){let r=""+e.type;return(e.type===xi.BINARY_EVENT||e.type===xi.BINARY_ACK)&&(r+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(r+=e.nsp+","),e.id!=null&&(r+=e.id),e.data!=null&&(r+=JSON.stringify(e.data)),iP("encoded %j as %s",e,r),r}encodeAsBinary(e){let r=$le.deconstructPacket(e),i=this.encodeAsString(r.packet),n=r.buffers;return n.unshift(i),n}};ya.Encoder=Yle;var bv=class extends QKe{constructor(){super()}add(e){let r;if(typeof e=="string")r=this.decodeString(e),r.type===xi.BINARY_EVENT||r.type===xi.BINARY_ACK?(this.reconstructor=new Xle(r),r.attachments===0&&super.emit("decoded",r)):super.emit("decoded",r);else if(Wle.isBinary(e)||e.base64)if(this.reconstructor)r=this.reconstructor.takeBinaryData(e),r&&(this.reconstructor=null,super.emit("decoded",r));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let r=0,i={type:Number(e.charAt(0))};if(xi[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===xi.BINARY_EVENT||i.type===xi.BINARY_ACK){let s=r+1;for(;e.charAt(++r)!=="-"&&r!=e.length;);let o=e.substring(s,r);if(o!=Number(o)||e.charAt(r)!=="-")throw new Error("Illegal attachments");i.attachments=Number(o)}if(e.charAt(r+1)==="/"){let s=r+1;for(;++r&&!(e.charAt(r)===","||r===e.length););i.nsp=e.substring(s,r)}else i.nsp="/";let n=e.charAt(r+1);if(n!==""&&Number(n)==n){let s=r+1;for(;++r;){let o=e.charAt(r);if(o==null||Number(o)!=o){--r;break}if(r===e.length)break}i.id=Number(e.substring(s,r+1))}if(e.charAt(++r)){let s=ZKe(e.substr(r));if(bv.isPayloadValid(i.type,s))i.data=s;else throw new Error("invalid payload")}return iP("decoded %s as %j",e,i),i}static isPayloadValid(e,r){switch(e){case xi.CONNECT:return typeof r=="object";case xi.DISCONNECT:return r===void 0;case xi.CONNECT_ERROR:return typeof r=="string"||typeof r=="object";case xi.EVENT:case xi.BINARY_EVENT:return Array.isArray(r)&&r.length>0;case xi.ACK:case xi.BINARY_ACK:return Array.isArray(r)}}destroy(){this.reconstructor&&this.reconstructor.finishedReconstruction()}};ya.Decoder=bv;function ZKe(t){try{return JSON.parse(t)}catch(e){return!1}}var Xle=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let r=$le.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),r}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}});var nP=m(wv=>{l();"use strict";Object.defineProperty(wv,"__esModule",{value:!0});wv.on=void 0;function JKe(t,e,r){return t.on(e,r),function(){t.off(e,r)}}wv.on=JKe});var sP=m(_v=>{l();"use strict";Object.defineProperty(_v,"__esModule",{value:!0});_v.StrictEventEmitter=void 0;var eVe=m1(),Qle=class extends eVe{on(e,r){return super.on(e,r),this}once(e,r){return super.once(e,r),this}emit(e,...r){return super.emit(e,...r),this}emitReserved(e,...r){return super.emit(e,...r),this}listeners(e){return super.listeners(e)}};_v.StrictEventEmitter=Qle});var oP=m(Sv=>{l();"use strict";Object.defineProperty(Sv,"__esModule",{value:!0});Sv.Socket=void 0;var wo=vv(),Ev=nP(),tVe=sP(),_o=Ee()("socket.io-client:socket"),rVe=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),Zle=class extends tVe.StrictEventEmitter{constructor(e,r,i){super();this.connected=!1,this.disconnected=!0,this.receiveBuffer=[],this.sendBuffer=[],this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=r,i&&i.auth&&(this.auth=i.auth),this.io._autoConnect&&this.open()}subEvents(){if(this.subs)return;let e=this.io;this.subs=[(0,Ev.on)(e,"open",this.onopen.bind(this)),(0,Ev.on)(e,"packet",this.onpacket.bind(this)),(0,Ev.on)(e,"error",this.onerror.bind(this)),(0,Ev.on)(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...r){if(rVe.hasOwnProperty(e))throw new Error('"'+e+'" is a reserved event name');r.unshift(e);let i={type:wo.PacketType.EVENT,data:r};i.options={},i.options.compress=this.flags.compress!==!1,typeof r[r.length-1]=="function"&&(_o("emitting packet with ack id %d",this.ids),this.acks[this.ids]=r.pop(),i.id=this.ids++);let n=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!n||!this.connected)?_o("discard packet as the transport is not currently writable"):this.connected?this.packet(i):this.sendBuffer.push(i),this.flags={},this}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){_o("transport is open - connecting"),typeof this.auth=="function"?this.auth(e=>{this.packet({type:wo.PacketType.CONNECT,data:e})}):this.packet({type:wo.PacketType.CONNECT,data:this.auth})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e){_o("close (%s)",e),this.connected=!1,this.disconnected=!0,delete this.id,this.emitReserved("disconnect",e)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case wo.PacketType.CONNECT:if(e.data&&e.data.sid){let n=e.data.sid;this.onconnect(n)}else this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case wo.PacketType.EVENT:this.onevent(e);break;case wo.PacketType.BINARY_EVENT:this.onevent(e);break;case wo.PacketType.ACK:this.onack(e);break;case wo.PacketType.BINARY_ACK:this.onack(e);break;case wo.PacketType.DISCONNECT:this.ondisconnect();break;case wo.PacketType.CONNECT_ERROR:let i=new Error(e.data.message);i.data=e.data.data,this.emitReserved("connect_error",i);break}}onevent(e){let r=e.data||[];_o("emitting event %j",r),e.id!=null&&(_o("attaching ack callback to event"),r.push(this.ack(e.id))),this.connected?this.emitEvent(r):this.receiveBuffer.push(Object.freeze(r))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let r=this._anyListeners.slice();for(let i of r)i.apply(this,e)}super.emit.apply(this,e)}ack(e){let r=this,i=!1;return function(...n){i||(i=!0,_o("sending ack %j",n),r.packet({type:wo.PacketType.ACK,id:e,data:n}))}}onack(e){let r=this.acks[e.id];typeof r=="function"?(_o("calling ack %s with %j",e.id,e.data),r.apply(this,e.data),delete this.acks[e.id]):_o("bad ack %s",e.id)}onconnect(e){_o("socket connected with id %s",e),this.id=e,this.connected=!0,this.disconnected=!1,this.emitBuffered(),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>this.packet(e)),this.sendBuffer=[]}ondisconnect(){_o("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&(_o("performing disconnect (%s)",this.nsp),this.packet({type:wo.PacketType.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let r=this._anyListeners;for(let i=0;i<r.length;i++)if(e===r[i])return r.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}};Sv.Socket=Zle});var ede=m((ZPt,Jle)=>{l();Jle.exports=_1;function _1(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}_1.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),r=Math.floor(e*this.jitter*t);t=(Math.floor(e*10)&1)==0?t-r:t+r}return Math.min(t,this.max)|0};_1.prototype.reset=function(){this.attempts=0};_1.prototype.setMin=function(t){this.ms=t};_1.prototype.setMax=function(t){this.max=t};_1.prototype.setJitter=function(t){this.jitter=t}});var aP=m(xv=>{l();"use strict";Object.defineProperty(xv,"__esModule",{value:!0});xv.Manager=void 0;var iVe=Vle(),nVe=b1(),sVe=oP(),oVe=vv(),uh=nP(),aVe=ede(),cVe=sP(),dn=Ee()("socket.io-client:manager"),tde=class extends cVe.StrictEventEmitter{constructor(e,r){var i;super();this.nsps={},this.subs=[],e&&typeof e=="object"&&(r=e,e=void 0),r=r||{},r.path=r.path||"/socket.io",this.opts=r,(0,nVe.installTimerFunctions)(this,r),this.reconnection(r.reconnection!==!1),this.reconnectionAttempts(r.reconnectionAttempts||1/0),this.reconnectionDelay(r.reconnectionDelay||1e3),this.reconnectionDelayMax(r.reconnectionDelayMax||5e3),this.randomizationFactor((i=r.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new aVe({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(r.timeout==null?2e4:r.timeout),this._readyState="closed",this.uri=e;let n=r.parser||oVe;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=r.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var r;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(r=this.backoff)===null||r===void 0||r.setMin(e),this)}randomizationFactor(e){var r;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(r=this.backoff)===null||r===void 0||r.setJitter(e),this)}reconnectionDelayMax(e){var r;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(r=this.backoff)===null||r===void 0||r.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(dn("readyState %s",this._readyState),~this._readyState.indexOf("open"))return this;dn("opening %s",this.uri),this.engine=iVe(this.uri,this.opts);let r=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;let n=(0,uh.on)(r,"open",function(){i.onopen(),e&&e()}),s=(0,uh.on)(r,"error",o=>{dn("error"),i.cleanup(),i._readyState="closed",this.emitReserved("error",o),e?e(o):i.maybeReconnectOnOpen()});if(this._timeout!==!1){let o=this._timeout;dn("connect attempt will timeout after %d",o),o===0&&n();let a=this.setTimeoutFn(()=>{dn("connect attempt timed out after %d",o),n(),r.close(),r.emit("error",new Error("timeout"))},o);this.opts.autoUnref&&a.unref(),this.subs.push(function(){clearTimeout(a)})}return this.subs.push(n),this.subs.push(s),this}connect(e){return this.open(e)}onopen(){dn("open"),this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push((0,uh.on)(e,"ping",this.onping.bind(this)),(0,uh.on)(e,"data",this.ondata.bind(this)),(0,uh.on)(e,"error",this.onerror.bind(this)),(0,uh.on)(e,"close",this.onclose.bind(this)),(0,uh.on)(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){this.decoder.add(e)}ondecoded(e){this.emitReserved("packet",e)}onerror(e){dn("error",e),this.emitReserved("error",e)}socket(e,r){let i=this.nsps[e];return i||(i=new sVe.Socket(this,e,r),this.nsps[e]=i),i}_destroy(e){let r=Object.keys(this.nsps);for(let i of r)if(this.nsps[i].active){dn("socket %s is still active, skipping close",i);return}this._close()}_packet(e){dn("writing packet %j",e);let r=this.encoder.encode(e);for(let i=0;i<r.length;i++)this.engine.write(r[i],e.options)}cleanup(){dn("cleanup"),this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){dn("disconnect"),this.skipReconnect=!0,this._reconnecting=!1,this._readyState==="opening"&&this.cleanup(),this.backoff.reset(),this._readyState="closed",this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e){dn("onclose"),this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)dn("reconnect failed"),this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let r=this.backoff.duration();dn("will wait %dms before reconnect attempt",r),this._reconnecting=!0;let i=this.setTimeoutFn(()=>{e.skipReconnect||(dn("attempting reconnect"),this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(n=>{n?(dn("reconnect attempt error"),e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",n)):(dn("reconnect success"),e.onreconnect())}))},r);this.opts.autoUnref&&i.unref(),this.subs.push(function(){clearTimeout(i)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}};xv.Manager=tde});var sde=m((fs,nde)=>{l();"use strict";Object.defineProperty(fs,"__esModule",{value:!0});fs.io=fs.Socket=fs.Manager=fs.protocol=void 0;var uVe=Xfe(),rde=aP(),ide=Ee()("socket.io-client");nde.exports=fs=Av;var Em=fs.managers={};function Av(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};let r=(0,uVe.url)(t,e.path||"/socket.io"),i=r.source,n=r.id,s=r.path,o=Em[n]&&s in Em[n].nsps,a=e.forceNew||e["force new connection"]||e.multiplex===!1||o,c;return a?(ide("ignoring socket cache for %s",i),c=new rde.Manager(i,e)):(Em[n]||(ide("new io instance for %s",i),Em[n]=new rde.Manager(i,e)),c=Em[n]),r.query&&!e.query&&(e.query=r.queryKey),c.socket(r.path,e)}fs.io=Av;var fVe=vv();Object.defineProperty(fs,"protocol",{enumerable:!0,get:function(){return fVe.protocol}});fs.connect=Av;var lVe=aP();Object.defineProperty(fs,"Manager",{enumerable:!0,get:function(){return lVe.Manager}});var dVe=oP();Object.defineProperty(fs,"Socket",{enumerable:!0,get:function(){return dVe.Socket}});fs.default=Av});var cP=m((eCt,ode)=>{l();var hVe=E8();ode.exports=t=>async e=>{e=hVe(e);let r=v=>{typeof v.return=="function"&&v.return()},i=null,n=null,s=v=>{i=v,n&&n(v),r(e)},o=null,a=!1,c=()=>{a=!0,o&&o()},u=null,f=!1,d=()=>{f=!0,u&&u()},h=null,p=()=>{h&&h()},y=()=>new Promise((v,A)=>{o=h=v,n=A,t.once("drain",p)}),b=()=>(r(e),new Promise((v,A)=>{if(a||f||i)return v();u=o=v,n=A})),E=()=>{t.removeListener("error",s),t.removeListener("close",c),t.removeListener("finish",d),t.removeListener("drain",p)};t.once("error",s),t.once("close",c),t.once("finish",d);try{for await(let v of e){if(!t.writable||t.destroyed||i)break;t.write(v)===!1&&await y()}}catch(v){i||t.destroy(),i=v}try{if(t.writable&&t.end(),await b(),i)throw i}finally{E()}}});var uP=m((tCt,ade)=>{l();var pVe=cP(),yVe=mm();ade.exports=t=>({sink:pVe(t),source:yVe(t)})});var ude=m((rCt,cde)=>{l();var gVe=uP();cde.exports=t=>async function*(e){let r=gVe(t),i;if(r.sink(e).catch(n=>{i=n}),yield*r.source,i)throw i}});var fde=m((iCt,E1)=>{l();E1.exports=mm();E1.exports.source=mm();E1.exports.sink=cP();E1.exports.transform=ude();E1.exports.duplex=uP()});var fP=m((nCt,yde)=>{l();"use strict";var lde=wc(),mVe=fde(),{CLOSE_TIMEOUT:bVe}=uv(),dde=wR(),hde=Ee(),Iv=hde("libp2p:webrtc-star:socket");Iv.error=hde("libp2p:webrtc-star:socket:error");var pde=(t,e)=>{if(!(!t||!e))try{return dde(t,e)}catch(r){return Iv.error(r),dde("0.0.0.0",e)}};yde.exports=(t,e={})=>{let{sink:r,source:i}=mVe.duplex(t),n=e.remoteAddr||pde(t.remoteAddress,t.remotePort),s=pde(t.localAddress,t.localPort),o={async sink(a){e.signal&&(a=lde(a,e.signal));try{await r(async function*(){for await(let c of a)yield c instanceof Uint8Array?c:c.slice()}())}catch(c){c.type!=="aborted"&&Iv.error(c)}},source:e.signal?lde(i,e.signal):i,conn:t,localAddr:s,remoteAddr:n,timeline:{open:Date.now()},close(){if(!t.destroyed)return new Promise((a,c)=>{let u=Date.now(),f=setTimeout(()=>{if(o.remoteAddr){let{host:d,port:h}=o.remoteAddr.toOptions();Iv("timeout closing socket to %s:%s after %dms, destroying it manually",d,h,Date.now()-u)}t.destroyed||t.destroy()},bVe);t.once("close",()=>{a()}),t.end(d=>{if(clearTimeout(f),o.timeline.close=Date.now(),d)return c(d)})})}};return t.once("close",()=>{o.timeline.close||(o.timeline.close=Date.now())}),o}});var lP=m((sCt,mde)=>{l();"use strict";var{Multiaddr:gde}=rt();function vVe(t){let e=t.toString().split("/"),r=t.protos()[1].name,i=t.protos()[2].name,n=t.stringTuples()[1][1];if(r!=="tcp"||i!=="ws"&&i!=="wss")throw new Error("invalid multiaddr: "+t.toString());if(!gde.isName(t))return"http://"+e[2]+":"+e[4];if(i==="ws")return"http://"+e[2]+(n==="80"?"":":"+n);if(i==="wss")return"https://"+e[2]+(n==="443"?"":":"+n)}function wVe(t){let e="/libp2p-webrtc-star";if(t.indexOf(e)!==-1){t=t.substring(e.length,t.length);let r=new gde(t),i=r.stringTuples().filter(n=>n[0]===421)[0];r=r.decapsulate("p2p"),r=r.encapsulate("/p2p-webrtc-star"),r=r.encapsulate(`/p2p/${i[1]}`),t=r.toString()}return t}mde.exports={cleanUrlSIO:vVe,cleanMultiaddr:wVe}});var _de=m((oCt,wde)=>{l();"use strict";var _Ve=br(),bde=Ee(),fh=bde("libp2p:webrtc-star:listener");fh.error=bde("libp2p:webrtc-star:listener:error");var EVe=IR(),SVe=sde(),xVe=DR(),AVe=fu(),IVe=fP(),{cleanUrlSIO:TVe}=lP(),{CODE_P2P:vde}=uv(),RVe={transports:["websocket"],"force new connection":!0,path:"/socket.io-next/"};wde.exports=({handler:t,upgrader:e},r,i={})=>{let n=new _Ve,s,o;return n.__connections=[],n.__spChannels=new Map,n.__pendingIntents=new Map,n.listen=a=>{if(s)throw EVe(new Error("listener already in use"),"ERR_ALREADY_LISTENING");let c=AVe();s=a;let u;!a.protoCodes().includes(vde)&&e.localPeer?u=a.encapsulate(`/p2p/${e.localPeer.toB58String()}`):u=a,n.on("error",()=>c.reject()),o=TVe(a),fh("Dialing to Signalling Server on: "+o),n.io=SVe.connect(o,RVe);let f=d=>{if(d.answer||d.err||!d.intentId)return;let h=d.intentId,p=n.__pendingIntents.get(h);p||(p=[],n.__pendingIntents.set(h,p));let y=n.__spChannels.get(h);if(y){y.signal(d.signal);return}else if(d.signal.type!=="offer"){p.push(d);return}let b={trickle:!1,...i};r.wrtc&&(b.wrtc=r.wrtc),y=new xVe(b);let E=v=>{fh.error("incoming connection errored",v)};y.on("error",E),y.once("close",(...v)=>{y.removeListener("error",E)}),y.on("signal",v=>{d.signal=v,d.answer=!0,n.io.emit("ss-handshake",d)}),y.signal(d.signal);for(let v of p)y.signal(v.signal);n.__pendingIntents.set(h,[]),y.once("connect",async()=>{let v=IVe(y);fh("new inbound connection %s",v.remoteAddr);let A;try{A=await e.upgradeInbound(v)}catch(R){return fh.error("inbound connection failed to upgrade",R),v.close()}if(!A.remoteAddr)try{A.remoteAddr=a.decapsulateCode(vde).encapsulate(`/p2p/${A.remotePeer.toB58String()}`)}catch(R){fh.error("could not determine remote address",R)}fh("inbound connection %s upgraded",v.remoteAddr),PVe(n,v,h),n.emit("connection",A),t(A)}),n.__spChannels.set(h,y)};return n.io.once("connect_error",d=>c.reject(d)),n.io.once("error",d=>{n.emit("error",d),n.emit("close")}),n.io.on("ws-handshake",f),n.io.on("ws-peer",r._peerDiscovered),n.io.on("connect",()=>{n.io.emit("ss-join",u.toString())}),n.io.once("connect",()=>{n.emit("listening"),c.resolve()}),r.sigReferences.set(o,{listener:n,signallingAddr:u}),c.promise},n.close=async()=>{let a=r.sigReferences.get(o);a&&a.listener.io&&(a.listener.io.emit("ss-leave"),a.listener.io.close()),await Promise.all(n.__connections.map(c=>c.close())),n.emit("close"),n.removeAllListeners(),s=void 0,r.sigReferences.delete(o)},n.getAddrs=()=>[s],n};function PVe(t,e,r){t.__connections.push(e);let i=()=>{t.__connections=t.__connections.filter(n=>n!==e),t.__spChannels.delete(r),t.__pendingIntents.delete(r)};e.conn.once("close",i)}});var Ide=m((aCt,Ade)=>{l();"use strict";var Ede=Ee(),Ru=Ede("libp2p:webrtc-star");Ru.error=Ede("libp2p:webrtc-star:error");var{EventEmitter:CVe}=br(),Tv=IR(),OVe=P4(),{AbortError:Sde}=wc(),kVe=DR(),{supportsWebRTCDataChannels:DVe}=$fe(),{Multiaddr:BVe}=rt(),NVe=Bl(),MVe=it(),{CODE_CIRCUIT:LVe}=uv(),qVe=_de(),jVe=fP(),{cleanMultiaddr:UVe,cleanUrlSIO:FVe}=lP();function KVe(){}var xde=class{constructor(e={}){if(!e.upgrader)throw new Error("An upgrader must be provided. See https://github.com/libp2p/interface-transport#upgrader.");this._upgrader=e.upgrader,this.sioOptions={transports:["websocket"],"force new connection":!0},e.wrtc&&(this.wrtc=e.wrtc),this.sigReferences=new Map,this.discovery=new CVe,this.discovery.tag="webRTCStar",this.discovery._isStarted=!1,this.discovery.start=()=>{this.discovery._isStarted=!0},this.discovery.stop=()=>{this.discovery._isStarted=!1},this._peerDiscovered=this._peerDiscovered.bind(this)}async dial(e,r={}){let i=await this._connect(e,r),n=jVe(i,{remoteAddr:e,signal:r.signal});Ru("new outbound connection %s",n.remoteAddr);let s=await this._upgrader.upgradeOutbound(n);return Ru("outbound connection %s upgraded",n.remoteAddr),s}_connect(e,r={}){if(r.signal&&r.signal.aborted)throw new Sde;let i={initiator:!0,trickle:!1,...r.spOptions||{}};this.wrtc&&(i.wrtc=this.wrtc);let n=e.toOptions(),s=(~~(Math.random()*1e9)).toString(36)+Date.now();return new Promise((o,a)=>{let c=this.sigReferences.get(FVe(e));if(!c||!c.listener)return a(Tv(new Error("unknown signal server to use"),"ERR_UNKNOWN_SIGNAL_SERVER"));let u=c.listener.io,f=Date.now(),d;Ru("dialing %s:%s",n.host,n.port);let h=new kVe(i),p=A=>{if(!d){let R=`connection error ${n.host}:${n.port}: ${A.message}`;Ru.error(R),v(A)}},y=()=>{Ru("connnection timeout %s:%s",n.host,n.port);let A=Tv(new Error(`connection timeout after ${Date.now()-f}ms`),"ERR_CONNECT_TIMEOUT");h.emit("error",A)},b=()=>{d=!0,Ru("connection opened %s:%s",n.host,n.port),v(null)},E=()=>{Ru.error("connection aborted %s:%s",n.host,n.port),h.destroy(),v(new Sde)},v=A=>{h.removeListener("timeout",y),h.removeListener("connect",b),r.signal&&r.signal.removeEventListener("abort",E),A?a(A):o(h)};h.on("error",p),h.once("timeout",y),h.once("connect",b),h.on("close",()=>{h.removeListener("error",p)}),r.signal&&r.signal.addEventListener("abort",E),h.on("signal",A=>{u.emit("ss-handshake",{intentId:s,srcMultiaddr:c.signallingAddr.toString(),dstMultiaddr:e.toString(),signal:A})}),u.on("ws-handshake",A=>{A.intentId===s&&A.err&&(h.destroy(),a(Tv(A.err instanceof Error?A.err:new Error(A.err),"ERR_SIGNALLING_FAILED"))),!(A.intentId!==s||!A.answer||h.destroyed)&&h.signal(A.signal)})})}createListener(e={},r){if(!DVe&&!this.wrtc)throw Tv(new Error("no WebRTC support"),"ERR_NO_WEBRTC_SUPPORT");return typeof e=="function"&&(r=e,e={}),r=r||KVe,qVe({handler:r,upgrader:this._upgrader},this,e)}filter(e){return e=Array.isArray(e)?e:[e],e.filter(r=>r.protoCodes().includes(LVe)?!1:NVe.WebRTCStar.matches(r))}_peerDiscovered(e){if(!this.discovery._isStarted)return;Ru("Peer Discovered:",e),e=UVe(e);let r=new BVe(e),i=MVe.createFromB58String(r.getPeerId());this.discovery.emit("peer",{id:i,multiaddrs:[r]})}};Ade.exports=OVe(xde,{className:"WebRTCStar",symbolName:"@libp2p/js-libp2p-webrtc-star/webrtcstar"})});var Ode=m((cCt,Cde)=>{l();"use strict";var Rv=Es(),Tde=Rn(),dP=10*1024,Rde=class{constructor(){this._pool=new Uint8Array(dP),this._poolOffset=0}write(e){let r=this._pool,i=this._poolOffset;Rv.encode(e.id<<3|e.type,r,i),i+=Rv.encode.bytes,Rv.encode(e.data?e.data.length:0,r,i),i+=Rv.encode.bytes;let n=r.subarray(this._poolOffset,i);return dP-i<100?(this._pool=new Uint8Array(dP),this._poolOffset=0):this._poolOffset=i,e.data?[n,e.data]:n}},Pde=new Rde;Cde.exports=t=>async function*(){for await(let r of t)Array.isArray(r)?yield new Tde(r.map(i=>Pde.write(i))):yield new Tde(Pde.write(r))}()});var Bde=m((uCt,Dde)=>{l();"use strict";var Pv=Es(),VVe=Rn();Dde.exports=t=>async function*(){let r=new kde;for await(let i of t){let n=r.write(i);n.length&&(yield n)}}();var kde=class{constructor(){this._buffer=new VVe,this._bufferProxy=new Proxy({},{get:(e,r)=>r[0]==="l"?this._buffer[r]:this._buffer.get(parseInt(r))}),this._headerInfo=null}write(e){if(!e||!e.length)return[];this._buffer.append(e);let r=[];for(;;){if(!this._headerInfo)try{this._headerInfo=this._decodeHeader(this._bufferProxy)}catch(c){break}let{id:i,type:n,length:s,offset:o}=this._headerInfo;if(this._buffer.length-o<s)break;r.push({id:i,type:n,data:this._buffer.shallowSlice(o,o+s)}),this._buffer.consume(o+s),this._headerInfo=null}return r}_decodeHeader(e){let r=Pv.decode(e),i=Pv.decode.bytes,n=Pv.decode(e,i);return i+=Pv.decode.bytes,{id:r>>3,type:r&7,offset:i,length:n}}}});var Nde=m(hP=>{l();"use strict";hP.encode=Ode();hP.decode=Bde()});var yP=m((lCt,pP)=>{l();"use strict";var Mde=1<<20;pP.exports=t=>{t=t||Mde;let e=r=>{if(r.data&&r.data.length>t)throw Object.assign(new Error("message size too large!"),{code:"ERR_MSG_TOO_BIG"})};return r=>async function*(){for await(let n of r)Array.isArray(n)?n.forEach(e):e(n),yield n}()};pP.exports.MAX_MSG_SIZE=Mde});var gP=m(Sm=>{l();"use strict";var Pu=Object.freeze({NEW_STREAM:0,MESSAGE_RECEIVER:1,MESSAGE_INITIATOR:2,CLOSE_RECEIVER:3,CLOSE_INITIATOR:4,RESET_RECEIVER:5,RESET_INITIATOR:6});Sm.MessageTypes=Pu;Sm.InitiatorMessageTypes=Object.freeze({NEW_STREAM:Pu.NEW_STREAM,MESSAGE:Pu.MESSAGE_INITIATOR,CLOSE:Pu.CLOSE_INITIATOR,RESET:Pu.RESET_INITIATOR});Sm.ReceiverMessageTypes=Object.freeze({MESSAGE:Pu.MESSAGE_RECEIVER,CLOSE:Pu.CLOSE_RECEIVER,RESET:Pu.RESET_RECEIVER});Sm.MessageTypeNames=Object.freeze(Object.entries(Pu).reduce((t,e)=>(t[e[1]]=e[0],t),{}))});var jde=m((hCt,qde)=>{l();"use strict";function Lde(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function zVe(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return Lde(t,r)}catch(i){r.message=t.message,r.stack=t.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(t)),Lde(new n,r)}}qde.exports=zVe});var Vde=m((pCt,Kde)=>{l();"use strict";var HVe=wc(),Ude=h0(),xm=Ee()("libp2p:mplex:stream"),GVe=nc(),Fde=Rn(),$Ve=jde(),{MAX_MSG_SIZE:WVe}=yP(),{InitiatorMessageTypes:YVe,ReceiverMessageTypes:XVe}=gP(),mP="ERR_MPLEX_STREAM_RESET",QVe="ERR_MPLEX_STREAM_ABORT";Kde.exports=({id:t,name:e,send:r,onEnd:i=()=>{},type:n="initiator",maxMsgSize:s=WVe})=>{let o=new Ude,a=new Ude,c=n==="initiator"?YVe:XVe,u=n==="initiator"?`i${t}`:`r${t}`;e=String(e??t);let f=!1,d=!1,h,p=E=>{f||(f=!0,xm("%s stream %s source end",n,e,E),E&&!h&&(h=E),d&&(b.timeline.close=Date.now(),i(h)))},y=E=>{d||(d=!0,xm("%s stream %s sink end",n,e,E),E&&!h&&(h=E),f&&(b.timeline.close=Date.now(),i(h)))},b={close:()=>b.source.end(),abort:E=>{xm("%s stream %s abort",n,e,E),b.source.end(E),o.abort(),y(E)},reset:()=>{let E=$Ve(new Error("stream reset"),mP);a.abort(),b.source.end(E),y(E)},sink:async E=>{E=HVe(E,[{signal:o.signal,options:{abortMessage:"stream aborted",abortCode:QVe}},{signal:a.signal,options:{abortMessage:"stream reset",abortCode:mP}}]),n==="initiator"&&r({id:t,type:c.NEW_STREAM,data:e});try{for await(let v of E)for(;v.length;){if(v.length<=s){r({id:t,type:c.MESSAGE,data:v});break}v=Fde.isBufferList(v)?v:new Fde(v),r({id:t,type:c.MESSAGE,data:v.shallowSlice(0,s)}),v.consume(s)}}catch(v){return v.code===mP?xm("%s stream %s reset",n,e):(xm("%s stream %s error",n,e,v),r({id:t,type:c.RESET})),b.source.end(v),y(v)}r({id:t,type:c.CLOSE}),y()},source:GVe(p),timeline:{open:Date.now(),close:null},id:u};return b}});var $de=m((yCt,Gde)=>{l();"use strict";var ZVe=Nr(),JVe=nc(),Cu=Ee()("libp2p:mplex"),eze=wc(),zde=Nde(),tze=yP(),{MessageTypes:lh,MessageTypeNames:Hde}=gP(),rze=Vde(),bP=class{constructor(e){e=e||{},e=typeof e=="function"?{onStream:e}:e,this._streamId=0,this._streams={initiators:new Map,receivers:new Map},this._options=e,this.sink=this._createSink(),this.source=this._createSource(),this.onStream=e.onStream,this.onStreamEnd=e.onStreamEnd}get streams(){let e=[];return this._streams.initiators.forEach(r=>{e.push(r)}),this._streams.receivers.forEach(r=>{e.push(r)}),e}newStream(e){let r=this._streamId++;e=e==null?r.toString():String(e);let i=this._streams.initiators;return this._newStream({id:r,name:e,type:"initiator",registry:i})}_newReceiverStream({id:e,name:r}){let i=this._streams.receivers;return this._newStream({id:e,name:r,type:"receiver",registry:i})}_newStream({id:e,name:r,type:i,registry:n}){if(n.has(e))throw new Error(`${i} stream ${e} already exists!`);Cu("new %s stream %s %s",i,e,r);let a=rze({id:e,name:r,send:c=>(Cu.enabled&&Cu("%s stream %s %s send",i,e,r,{...c,type:Hde[c.type],data:c.data&&c.data.slice()}),this.source.push(c)),type:i,onEnd:()=>{Cu("%s stream %s %s ended",i,e,r),n.delete(e),this.onStreamEnd&&this.onStreamEnd(a)},maxMsgSize:this._options.maxMsgSize});return n.set(e,a),a}_createSink(){return async e=>{this._options.signal&&(e=eze(e,this._options.signal));try{await ZVe(e,zde.decode,tze(this._options.maxMsgSize),async r=>{for await(let i of r)for(let n of i)this._handleIncoming(n)})}catch(r){return Cu("error in sink",r),this.source.end(r)}this.source.end()}}_createSource(){let r=JVe({onEnd:i=>{let{initiators:n,receivers:s}=this._streams;for(let o of n.values())o.abort(i);for(let o of s.values())o.abort(i)},writev:!0});return Object.assign(zde.encode(r),{push:r.push,end:r.end,return:r.return})}_handleIncoming({id:e,type:r,data:i}){if(Cu.enabled&&Cu("incoming message",{id:e,type:Hde[r],data:i.slice()}),r===lh.NEW_STREAM&&this.onStream){let o=this._newReceiverStream({id:e,name:i.toString()});return this.onStream(o)}let s=(r&1?this._streams.initiators:this._streams.receivers).get(e);if(!s)return Cu("missing stream %s",e);switch(r){case lh.MESSAGE_INITIATOR:case lh.MESSAGE_RECEIVER:s.source.push(i);break;case lh.CLOSE_INITIATOR:case lh.CLOSE_RECEIVER:s.close();break;case lh.RESET_INITIATOR:case lh.RESET_RECEIVER:s.reset();break;default:Cu("unknown message type %s",r)}}};bP.multicodec="/mplex/6.7.0";Gde.exports=bP});var Yde=m((gCt,Wde)=>{l();"use strict";Wde.exports=$de()});var Qde=m(vP=>{l();"use strict";Object.defineProperty(vP,"__esModule",{value:!0});var Xde=65536,ize=function(){function t(){this.isAvailable=!1,this.isInstantiated=!1;var e=typeof self!="undefined"?self.crypto||self.msCrypto:null;e&&e.getRandomValues&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}return t.prototype.randomBytes=function(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");for(var r=new Uint8Array(e),i=0;i<r.length;i+=Xde)this._crypto.getRandomValues(r.subarray(i,i+Math.min(r.length-i,Xde)));return r},t}();vP.BrowserRandomSource=ize});var Cc=m(wP=>{l();"use strict";Object.defineProperty(wP,"__esModule",{value:!0});function nze(t){for(var e=0;e<t.length;e++)t[e]=0;return t}wP.wipe=nze});var Zde=m(_P=>{l();"use strict";Object.defineProperty(_P,"__esModule",{value:!0});var sze=Cc(),oze=function(){function t(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof Ea!="undefined"){var e=E0();e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}return t.prototype.randomBytes=function(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");var r=this._crypto.randomBytes(e);if(r.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");for(var i=new Uint8Array(e),n=0;n<i.length;n++)i[n]=r[n];return sze.wipe(r),i},t}();_P.NodeRandomSource=oze});var Jde=m(EP=>{l();"use strict";Object.defineProperty(EP,"__esModule",{value:!0});var aze=Qde(),cze=Zde(),uze=function(){function t(){if(this.isAvailable=!1,this.name="",this._source=new aze.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new cze.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}return t.prototype.randomBytes=function(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)},t}();EP.SystemRandomSource=uze});var ehe=m(Os=>{l();"use strict";Object.defineProperty(Os,"__esModule",{value:!0});function fze(t,e){var r=t>>>16&65535,i=t&65535,n=e>>>16&65535,s=e&65535;return i*s+(r*s+i*n<<16>>>0)|0}Os.mul=Math.imul||fze;function lze(t,e){return t+e|0}Os.add=lze;function dze(t,e){return t-e|0}Os.sub=dze;function hze(t,e){return t<<e|t>>>32-e}Os.rotl=hze;function pze(t,e){return t<<32-e|t>>>e}Os.rotr=pze;function yze(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t}Os.isInteger=Number.isInteger||yze;Os.MAX_SAFE_INTEGER=9007199254740991;Os.isSafeInteger=function(t){return Os.isInteger(t)&&t>=-Os.MAX_SAFE_INTEGER&&t<=Os.MAX_SAFE_INTEGER}});var Am=m(_t=>{l();"use strict";Object.defineProperty(_t,"__esModule",{value:!0});var the=ehe();function gze(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}_t.readInt16BE=gze;function mze(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}_t.readUint16BE=mze;function bze(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}_t.readInt16LE=bze;function vze(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}_t.readUint16LE=vze;function rhe(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}_t.writeUint16BE=rhe;_t.writeInt16BE=rhe;function ihe(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}_t.writeUint16LE=ihe;_t.writeInt16LE=ihe;function SP(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}_t.readInt32BE=SP;function xP(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}_t.readUint32BE=xP;function AP(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}_t.readInt32LE=AP;function IP(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}_t.readUint32LE=IP;function Cv(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}_t.writeUint32BE=Cv;_t.writeInt32BE=Cv;function Ov(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}_t.writeUint32LE=Ov;_t.writeInt32LE=Ov;function wze(t,e){e===void 0&&(e=0);var r=SP(t,e),i=SP(t,e+4);return r*4294967296+i-(i>>31)*4294967296}_t.readInt64BE=wze;function _ze(t,e){e===void 0&&(e=0);var r=xP(t,e),i=xP(t,e+4);return r*4294967296+i}_t.readUint64BE=_ze;function Eze(t,e){e===void 0&&(e=0);var r=AP(t,e),i=AP(t,e+4);return i*4294967296+r-(r>>31)*4294967296}_t.readInt64LE=Eze;function Sze(t,e){e===void 0&&(e=0);var r=IP(t,e),i=IP(t,e+4);return i*4294967296+r}_t.readUint64LE=Sze;function nhe(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Cv(t/4294967296>>>0,e,r),Cv(t>>>0,e,r+4),e}_t.writeUint64BE=nhe;_t.writeInt64BE=nhe;function she(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Ov(t>>>0,e,r),Ov(t/4294967296>>>0,e,r+4),e}_t.writeUint64LE=she;_t.writeInt64LE=she;function xze(t,e,r){if(r===void 0&&(r=0),t%8!=0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,n=1,s=t/8+r-1;s>=r;s--)i+=e[s]*n,n*=256;return i}_t.readUintBE=xze;function Aze(t,e,r){if(r===void 0&&(r=0),t%8!=0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,n=1,s=r;s<r+t/8;s++)i+=e[s]*n,n*=256;return i}_t.readUintLE=Aze;function Ize(t,e,r,i){if(r===void 0&&(r=new Uint8Array(t/8)),i===void 0&&(i=0),t%8!=0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!the.isSafeInteger(e))throw new Error("writeUintBE value must be an integer");for(var n=1,s=t/8+i-1;s>=i;s--)r[s]=e/n&255,n*=256;return r}_t.writeUintBE=Ize;function Tze(t,e,r,i){if(r===void 0&&(r=new Uint8Array(t/8)),i===void 0&&(i=0),t%8!=0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!the.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var n=1,s=i;s<i+t/8;s++)r[s]=e/n&255,n*=256;return r}_t.writeUintLE=Tze;function Rze(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat32(e)}_t.readFloat32BE=Rze;function Pze(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat32(e,!0)}_t.readFloat32LE=Pze;function Cze(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat64(e)}_t.readFloat64BE=Cze;function Oze(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat64(e,!0)}_t.readFloat64LE=Oze;function kze(t,e,r){e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat32(r,t),e}_t.writeFloat32BE=kze;function Dze(t,e,r){e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat32(r,t,!0),e}_t.writeFloat32LE=Dze;function Bze(t,e,r){e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat64(r,t),e}_t.writeFloat64BE=Bze;function Nze(t,e,r){e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat64(r,t,!0),e}_t.writeFloat64LE=Nze});var uhe=m(ga=>{l();"use strict";Object.defineProperty(ga,"__esModule",{value:!0});var Mze=Jde(),Lze=Am(),ohe=Cc();ga.defaultRandomSource=new Mze.SystemRandomSource;function TP(t,e){return e===void 0&&(e=ga.defaultRandomSource),e.randomBytes(t)}ga.randomBytes=TP;function qze(t){t===void 0&&(t=ga.defaultRandomSource);var e=TP(4,t),r=Lze.readUint32LE(e);return ohe.wipe(e),r}ga.randomUint32=qze;var ahe="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function che(t,e,r){if(e===void 0&&(e=ahe),r===void 0&&(r=ga.defaultRandomSource),e.length<2)throw new Error("randomString charset is too short");if(e.length>256)throw new Error("randomString charset is too long");for(var i="",n=e.length,s=256-256%n;t>0;){for(var o=TP(Math.ceil(t*256/s),r),a=0;a<o.length&&t>0;a++){var c=o[a];c<s&&(i+=e.charAt(c%n),t--)}ohe.wipe(o)}return i}ga.randomString=che;function jze(t,e,r){e===void 0&&(e=ahe),r===void 0&&(r=ga.defaultRandomSource);var i=Math.ceil(t/(Math.log(e.length)/Math.LN2));return che(i,e,r)}ga.randomStringForEntropy=jze});var Bv=m(ls=>{l();"use strict";Object.defineProperty(ls,"__esModule",{value:!0});var Uze=uhe(),Fze=Cc();ls.PUBLIC_KEY_LENGTH=32;ls.SECRET_KEY_LENGTH=32;ls.SHARED_KEY_LENGTH=32;function Oc(t){var e=new Float64Array(16);if(t)for(var r=0;r<t.length;r++)e[r]=t[r];return e}var fhe=new Uint8Array(32);fhe[0]=9;var Kze=Oc([56129,1]);function RP(t){for(var e=1,r=0;r<16;r++){var i=t[r]+e+65535;e=Math.floor(i/65536),t[r]=i-e*65536}t[0]+=e-1+37*(e-1)}function Im(t,e,r){for(var i=~(r-1),n=0;n<16;n++){var s=i&(t[n]^e[n]);t[n]^=s,e[n]^=s}}function Vze(t,e){for(var r=Oc(),i=Oc(),n=0;n<16;n++)i[n]=e[n];RP(i),RP(i),RP(i);for(var s=0;s<2;s++){r[0]=i[0]-65517;for(var n=1;n<15;n++)r[n]=i[n]-65535-(r[n-1]>>16&1),r[n-1]&=65535;r[15]=i[15]-32767-(r[14]>>16&1);var o=r[15]>>16&1;r[14]&=65535,Im(i,r,1-o)}for(var n=0;n<16;n++)t[2*n]=i[n]&255,t[2*n+1]=i[n]>>8}function zze(t,e){for(var r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function kv(t,e,r){for(var i=0;i<16;i++)t[i]=e[i]+r[i]}function Dv(t,e,r){for(var i=0;i<16;i++)t[i]=e[i]-r[i]}function Ou(t,e,r){var i,n,s=0,o=0,a=0,c=0,u=0,f=0,d=0,h=0,p=0,y=0,b=0,E=0,v=0,A=0,R=0,F=0,D=0,B=0,H=0,W=0,X=0,P=0,g=0,w=0,S=0,C=0,L=0,Y=0,V=0,q=0,_=0,j=r[0],de=r[1],Q=r[2],ue=r[3],le=r[4],me=r[5],be=r[6],xe=r[7],k=r[8],K=r[9],$=r[10],ee=r[11],I=r[12],U=r[13],z=r[14],N=r[15];i=e[0],s+=i*j,o+=i*de,a+=i*Q,c+=i*ue,u+=i*le,f+=i*me,d+=i*be,h+=i*xe,p+=i*k,y+=i*K,b+=i*$,E+=i*ee,v+=i*I,A+=i*U,R+=i*z,F+=i*N,i=e[1],o+=i*j,a+=i*de,c+=i*Q,u+=i*ue,f+=i*le,d+=i*me,h+=i*be,p+=i*xe,y+=i*k,b+=i*K,E+=i*$,v+=i*ee,A+=i*I,R+=i*U,F+=i*z,D+=i*N,i=e[2],a+=i*j,c+=i*de,u+=i*Q,f+=i*ue,d+=i*le,h+=i*me,p+=i*be,y+=i*xe,b+=i*k,E+=i*K,v+=i*$,A+=i*ee,R+=i*I,F+=i*U,D+=i*z,B+=i*N,i=e[3],c+=i*j,u+=i*de,f+=i*Q,d+=i*ue,h+=i*le,p+=i*me,y+=i*be,b+=i*xe,E+=i*k,v+=i*K,A+=i*$,R+=i*ee,F+=i*I,D+=i*U,B+=i*z,H+=i*N,i=e[4],u+=i*j,f+=i*de,d+=i*Q,h+=i*ue,p+=i*le,y+=i*me,b+=i*be,E+=i*xe,v+=i*k,A+=i*K,R+=i*$,F+=i*ee,D+=i*I,B+=i*U,H+=i*z,W+=i*N,i=e[5],f+=i*j,d+=i*de,h+=i*Q,p+=i*ue,y+=i*le,b+=i*me,E+=i*be,v+=i*xe,A+=i*k,R+=i*K,F+=i*$,D+=i*ee,B+=i*I,H+=i*U,W+=i*z,X+=i*N,i=e[6],d+=i*j,h+=i*de,p+=i*Q,y+=i*ue,b+=i*le,E+=i*me,v+=i*be,A+=i*xe,R+=i*k,F+=i*K,D+=i*$,B+=i*ee,H+=i*I,W+=i*U,X+=i*z,P+=i*N,i=e[7],h+=i*j,p+=i*de,y+=i*Q,b+=i*ue,E+=i*le,v+=i*me,A+=i*be,R+=i*xe,F+=i*k,D+=i*K,B+=i*$,H+=i*ee,W+=i*I,X+=i*U,P+=i*z,g+=i*N,i=e[8],p+=i*j,y+=i*de,b+=i*Q,E+=i*ue,v+=i*le,A+=i*me,R+=i*be,F+=i*xe,D+=i*k,B+=i*K,H+=i*$,W+=i*ee,X+=i*I,P+=i*U,g+=i*z,w+=i*N,i=e[9],y+=i*j,b+=i*de,E+=i*Q,v+=i*ue,A+=i*le,R+=i*me,F+=i*be,D+=i*xe,B+=i*k,H+=i*K,W+=i*$,X+=i*ee,P+=i*I,g+=i*U,w+=i*z,S+=i*N,i=e[10],b+=i*j,E+=i*de,v+=i*Q,A+=i*ue,R+=i*le,F+=i*me,D+=i*be,B+=i*xe,H+=i*k,W+=i*K,X+=i*$,P+=i*ee,g+=i*I,w+=i*U,S+=i*z,C+=i*N,i=e[11],E+=i*j,v+=i*de,A+=i*Q,R+=i*ue,F+=i*le,D+=i*me,B+=i*be,H+=i*xe,W+=i*k,X+=i*K,P+=i*$,g+=i*ee,w+=i*I,S+=i*U,C+=i*z,L+=i*N,i=e[12],v+=i*j,A+=i*de,R+=i*Q,F+=i*ue,D+=i*le,B+=i*me,H+=i*be,W+=i*xe,X+=i*k,P+=i*K,g+=i*$,w+=i*ee,S+=i*I,C+=i*U,L+=i*z,Y+=i*N,i=e[13],A+=i*j,R+=i*de,F+=i*Q,D+=i*ue,B+=i*le,H+=i*me,W+=i*be,X+=i*xe,P+=i*k,g+=i*K,w+=i*$,S+=i*ee,C+=i*I,L+=i*U,Y+=i*z,V+=i*N,i=e[14],R+=i*j,F+=i*de,D+=i*Q,B+=i*ue,H+=i*le,W+=i*me,X+=i*be,P+=i*xe,g+=i*k,w+=i*K,S+=i*$,C+=i*ee,L+=i*I,Y+=i*U,V+=i*z,q+=i*N,i=e[15],F+=i*j,D+=i*de,B+=i*Q,H+=i*ue,W+=i*le,X+=i*me,P+=i*be,g+=i*xe,w+=i*k,S+=i*K,C+=i*$,L+=i*ee,Y+=i*I,V+=i*U,q+=i*z,_+=i*N,s+=38*D,o+=38*B,a+=38*H,c+=38*W,u+=38*X,f+=38*P,d+=38*g,h+=38*w,p+=38*S,y+=38*C,b+=38*L,E+=38*Y,v+=38*V,A+=38*q,R+=38*_,n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-n*65536,i=o+n+65535,n=Math.floor(i/65536),o=i-n*65536,i=a+n+65535,n=Math.floor(i/65536),a=i-n*65536,i=c+n+65535,n=Math.floor(i/65536),c=i-n*65536,i=u+n+65535,n=Math.floor(i/65536),u=i-n*65536,i=f+n+65535,n=Math.floor(i/65536),f=i-n*65536,i=d+n+65535,n=Math.floor(i/65536),d=i-n*65536,i=h+n+65535,n=Math.floor(i/65536),h=i-n*65536,i=p+n+65535,n=Math.floor(i/65536),p=i-n*65536,i=y+n+65535,n=Math.floor(i/65536),y=i-n*65536,i=b+n+65535,n=Math.floor(i/65536),b=i-n*65536,i=E+n+65535,n=Math.floor(i/65536),E=i-n*65536,i=v+n+65535,n=Math.floor(i/65536),v=i-n*65536,i=A+n+65535,n=Math.floor(i/65536),A=i-n*65536,i=R+n+65535,n=Math.floor(i/65536),R=i-n*65536,i=F+n+65535,n=Math.floor(i/65536),F=i-n*65536,s+=n-1+37*(n-1),n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-n*65536,i=o+n+65535,n=Math.floor(i/65536),o=i-n*65536,i=a+n+65535,n=Math.floor(i/65536),a=i-n*65536,i=c+n+65535,n=Math.floor(i/65536),c=i-n*65536,i=u+n+65535,n=Math.floor(i/65536),u=i-n*65536,i=f+n+65535,n=Math.floor(i/65536),f=i-n*65536,i=d+n+65535,n=Math.floor(i/65536),d=i-n*65536,i=h+n+65535,n=Math.floor(i/65536),h=i-n*65536,i=p+n+65535,n=Math.floor(i/65536),p=i-n*65536,i=y+n+65535,n=Math.floor(i/65536),y=i-n*65536,i=b+n+65535,n=Math.floor(i/65536),b=i-n*65536,i=E+n+65535,n=Math.floor(i/65536),E=i-n*65536,i=v+n+65535,n=Math.floor(i/65536),v=i-n*65536,i=A+n+65535,n=Math.floor(i/65536),A=i-n*65536,i=R+n+65535,n=Math.floor(i/65536),R=i-n*65536,i=F+n+65535,n=Math.floor(i/65536),F=i-n*65536,s+=n-1+37*(n-1),t[0]=s,t[1]=o,t[2]=a,t[3]=c,t[4]=u,t[5]=f,t[6]=d,t[7]=h,t[8]=p,t[9]=y,t[10]=b,t[11]=E,t[12]=v,t[13]=A,t[14]=R,t[15]=F}function Tm(t,e){Ou(t,e,e)}function Hze(t,e){for(var r=Oc(),i=0;i<16;i++)r[i]=e[i];for(var i=253;i>=0;i--)Tm(r,r),i!==2&&i!==4&&Ou(r,r,e);for(var i=0;i<16;i++)t[i]=r[i]}function PP(t,e){for(var r=new Uint8Array(32),i=new Float64Array(80),n=Oc(),s=Oc(),o=Oc(),a=Oc(),c=Oc(),u=Oc(),f=0;f<31;f++)r[f]=t[f];r[31]=t[31]&127|64,r[0]&=248,zze(i,e);for(var f=0;f<16;f++)s[f]=i[f];n[0]=a[0]=1;for(var f=254;f>=0;--f){var d=r[f>>>3]>>>(f&7)&1;Im(n,s,d),Im(o,a,d),kv(c,n,o),Dv(n,n,o),kv(o,s,a),Dv(s,s,a),Tm(a,c),Tm(u,n),Ou(n,o,n),Ou(o,s,c),kv(c,n,o),Dv(n,n,o),Tm(s,n),Dv(o,a,u),Ou(n,o,Kze),kv(n,n,a),Ou(o,o,n),Ou(n,a,u),Ou(a,s,i),Tm(s,c),Im(n,s,d),Im(o,a,d)}for(var f=0;f<16;f++)i[f+16]=n[f],i[f+32]=o[f],i[f+48]=s[f],i[f+64]=a[f];var h=i.subarray(32),p=i.subarray(16);Hze(h,h),Ou(p,p,h);var y=new Uint8Array(32);return Vze(y,p),y}ls.scalarMult=PP;function lhe(t){return PP(t,fhe)}ls.scalarMultBase=lhe;function dhe(t){if(t.length!==ls.SECRET_KEY_LENGTH)throw new Error("x25519: seed must be "+ls.SECRET_KEY_LENGTH+" bytes");var e=new Uint8Array(t),r=lhe(e);return{publicKey:r,secretKey:e}}ls.generateKeyPairFromSeed=dhe;function Gze(t){var e=Uze.randomBytes(32,t),r=dhe(e);return Fze.wipe(e),r}ls.generateKeyPair=Gze;function $ze(t,e,r){if(r===void 0&&(r=!1),t.length!==ls.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==ls.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");var i=PP(t,e);if(r){for(var n=0,s=0;s<i.length;s++)n|=i[s];if(n===0)throw new Error("X25519: invalid shared key")}return i}ls.sharedKey=$ze});var S1=m((ACt,hhe)=>{l();"use strict";var Wze=Ab(),Yze=nc(),Xze=fu();hhe.exports=t=>{let e=Yze(),r=Wze(t.source),i=Xze(),n,s=t.sink(async function*(){yield*e,yield*await i.promise}());return s.catch(a=>{n=a}),{reader:r,writer:e,stream:{sink:a=>n?Promise.reject(n):(i.resolve(a),s),source:r},rest:()=>e.end(),write:e.push,read:async()=>(await r.next()).value}}});var ghe=m((ICt,yhe)=>{l();"use strict";var Qze=gI(),Zze=S1(),phe=fa();yhe.exports=(t,e={})=>{let r=Zze(t),i=phe.decode.fromReader(r.reader,e),n=!1,s={read:async o=>{let{value:a,done:c}=await r.reader.next(o);if(c&&a.length<o)throw new Error("Couldn't read enough bytes");if(n=c,!a)throw new Error("Value is null");return a},readLP:async()=>{let{value:o,done:a}=await i.next();if(n=a,!o)throw new Error("Value is null");return o},readPB:async o=>{let a=await s.readLP();if(!a)throw new Error("Value is null");let c=Qze(a)?a:a.slice();return o.decode(c)},write:o=>{r.writer.push(o)},writeLP:o=>{s.write(phe.encode.single(o,e))},writePB:(o,a)=>{s.writeLP(a.encode(o))},pb:o=>({read:()=>s.readPB(o),write:a=>s.writePB(a,o)}),unwrap:()=>(r.rest(),r.stream)};return s}});var bhe=m((TCt,mhe)=>{l();"use strict";var Jze=E8();mhe.exports=function(){let e,r,i=async s=>{if(e)throw new Error("already piped");e=Jze(s),r&&r(e)},n={[Symbol.asyncIterator](){return this},next(){return e?e.next():new Promise(s=>{r=o=>{r=null,s(o.next())}})}};return{sink:i,source:n}}});var _he=m((RCt,whe)=>{l();var vhe=bhe();whe.exports=function(){var t=vhe(),e=vhe();return[{source:t.source,sink:e.sink},{source:e.source,sink:t.sink}]}});var Lv=m((PCt,Rm)=>{l();"use strict";var{Buffer:Nv}=Ht(),Mv=Rn();Rm.exports=async function*(t){for await(let e of t)Nv.isBuffer(e)?yield e:Mv.isBufferList(e)?yield e.slice():yield Nv.from(e)};Rm.exports.toBuffer=Rm.exports;Rm.exports.toList=async function*(t){for await(let e of t)Nv.isBuffer(e)?yield new Mv().append(e):Mv.isBufferList(e)?yield e:yield new Mv().append(Nv.from(e))}});var Ehe=m(CP=>{l();"use strict";Object.defineProperty(CP,"__esModule",{value:!0});function eHe(t){return typeof t.saveState!="undefined"&&typeof t.restoreState!="undefined"&&typeof t.cleanSavedState!="undefined"}CP.isSerializableHash=eHe});var qv=m(x1=>{l();"use strict";Object.defineProperty(x1,"__esModule",{value:!0});function tHe(t,e,r){return~(t-1)&e|t-1&r}x1.select=tHe;function rHe(t,e){return(t|0)-(e|0)-1>>>31&1}x1.lessOrEqual=rHe;function She(t,e){if(t.length!==e.length)return 0;for(var r=0,i=0;i<t.length;i++)r|=t[i]^e[i];return 1&r-1>>>8}x1.compare=She;function iHe(t,e){return t.length===0||e.length===0?!1:She(t,e)!==0}x1.equal=iHe});var Ahe=m(Pm=>{l();"use strict";Object.defineProperty(Pm,"__esModule",{value:!0});var kc=Ehe(),nHe=qv(),sHe=Cc(),xhe=function(){function t(e,r){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var i=new Uint8Array(this.blockSize);r.length>this.blockSize?this._inner.update(r).finish(i).clean():i.set(r);for(var n=0;n<i.length;n++)i[n]^=54;this._inner.update(i);for(var n=0;n<i.length;n++)i[n]^=54^92;this._outer.update(i),kc.isSerializableHash(this._inner)&&kc.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),sHe.wipe(i)}return t.prototype.reset=function(){if(!kc.isSerializableHash(this._inner)||!kc.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},t.prototype.clean=function(){kc.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),kc.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},t.prototype.update=function(e){return this._inner.update(e),this},t.prototype.finish=function(e){return this._finished?(this._outer.finish(e),this):(this._inner.finish(e),this._outer.update(e.subarray(0,this.digestLength)).finish(e),this._finished=!0,this)},t.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},t.prototype.saveState=function(){if(!kc.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},t.prototype.restoreState=function(e){if(!kc.isSerializableHash(this._inner)||!kc.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(e),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},t.prototype.cleanSavedState=function(e){if(!kc.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},t}();Pm.HMAC=xhe;function oHe(t,e,r){var i=new xhe(t,e);i.update(r);var n=i.digest();return i.clean(),n}Pm.hmac=oHe;Pm.equal=nHe.equal});var Rhe=m(OP=>{l();"use strict";Object.defineProperty(OP,"__esModule",{value:!0});var Ihe=Ahe(),The=Cc(),aHe=function(){function t(e,r,i,n){i===void 0&&(i=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=n;var s=Ihe.hmac(this._hash,i,r);this._hmac=new Ihe.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),i=0;i<r.length;i++)this._bufpos===this._buffer.length&&this._fillBuffer(),r[i]=this._buffer[this._bufpos++];return r},t.prototype.clean=function(){this._hmac.clean(),The.wipe(this._buffer),The.wipe(this._counter),this._bufpos=0},t}();OP.HKDF=aHe});var DP=m(hl=>{l();"use strict";Object.defineProperty(hl,"__esModule",{value:!0});var jv=Am(),Uv=Cc();hl.DIGEST_LENGTH=32;hl.BLOCK_SIZE=64;var Phe=function(){function t(){this.digestLength=hl.DIGEST_LENGTH,this.blockSize=hl.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return t.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},t.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},t.prototype.clean=function(){Uv.wipe(this._buffer),Uv.wipe(this._temp),this.reset()},t.prototype.update=function(e,r){if(r===void 0&&(r=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var i=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&r>0;)this._buffer[this._bufferLength++]=e[i++],r--;this._bufferLength===this.blockSize&&(kP(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(i=kP(this._temp,this._state,e,i,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[i++],r--;return this},t.prototype.finish=function(e){if(!this._finished){var r=this._bytesHashed,i=this._bufferLength,n=r/536870912|0,s=r<<3,o=r%64<56?64:128;this._buffer[i]=128;for(var a=i+1;a<o-8;a++)this._buffer[a]=0;jv.writeUint32BE(n,this._buffer,o-8),jv.writeUint32BE(s,this._buffer,o-4),kP(this._temp,this._state,this._buffer,0,o),this._finished=!0}for(var a=0;a<this.digestLength/4;a++)jv.writeUint32BE(this._state[a],e,a*4);return this},t.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},t.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},t.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},t.prototype.cleanSavedState=function(e){Uv.wipe(e.state),e.buffer&&Uv.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();hl.SHA256=Phe;var cHe=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function kP(t,e,r,i,n){for(;n>=64;){for(var s=e[0],o=e[1],a=e[2],c=e[3],u=e[4],f=e[5],d=e[6],h=e[7],p=0;p<16;p++){var y=i+p*4;t[p]=jv.readUint32BE(r,y)}for(var p=16;p<64;p++){var b=t[p-2],E=(b>>>17|b<<32-17)^(b>>>19|b<<32-19)^b>>>10;b=t[p-15];var v=(b>>>7|b<<32-7)^(b>>>18|b<<32-18)^b>>>3;t[p]=(E+t[p-7]|0)+(v+t[p-16]|0)}for(var p=0;p<64;p++){var E=(((u>>>6|u<<32-6)^(u>>>11|u<<32-11)^(u>>>25|u<<32-25))+(u&f^~u&d)|0)+(h+(cHe[p]+t[p]|0)|0)|0,v=((s>>>2|s<<32-2)^(s>>>13|s<<32-13)^(s>>>22|s<<32-22))+(s&o^s&a^o&a)|0;h=d,d=f,f=u,u=c+E|0,c=a,a=o,o=s,s=E+v|0}e[0]+=s,e[1]+=o,e[2]+=a,e[3]+=c,e[4]+=u,e[5]+=f,e[6]+=d,e[7]+=h,i+=64,n-=64}return i}function uHe(t){var e=new Phe;e.update(t);var r=e.digest();return e.clean(),r}hl.hash=uHe});var Ohe=m((Che,Cm)=>{l();"use strict";(function(t,e){typeof define=="function"&&define.amd?define(["protobufjs/minimal"],e):typeof Ea=="function"&&typeof Cm=="object"&&Cm&&Cm.exports&&(Cm.exports=e(Vi()))})(Che,function(t){"use strict";var e=t.Reader,r=t.Writer,i=t.util,n=t.roots["libp2p-noise"]||(t.roots["libp2p-noise"]={});return n.pb=function(){var s={};return s.NoiseHandshakePayload=function(){function o(a){if(a)for(var c=Object.keys(a),u=0;u<c.length;++u)a[c[u]]!=null&&(this[c[u]]=a[c[u]])}return o.prototype.identityKey=i.newBuffer([]),o.prototype.identitySig=i.newBuffer([]),o.prototype.data=i.newBuffer([]),o.create=function(c){return new o(c)},o.encode=function(c,u){return u||(u=r.create()),c.identityKey!=null&&Object.hasOwnProperty.call(c,"identityKey")&&u.uint32(10).bytes(c.identityKey),c.identitySig!=null&&Object.hasOwnProperty.call(c,"identitySig")&&u.uint32(18).bytes(c.identitySig),c.data!=null&&Object.hasOwnProperty.call(c,"data")&&u.uint32(26).bytes(c.data),u},o.encodeDelimited=function(c,u){return this.encode(c,u).ldelim()},o.decode=function(c,u){c instanceof e||(c=e.create(c));for(var f=u===void 0?c.len:c.pos+u,d=new n.pb.NoiseHandshakePayload;c.pos<f;){var h=c.uint32();switch(h>>>3){case 1:d.identityKey=c.bytes();break;case 2:d.identitySig=c.bytes();break;case 3:d.data=c.bytes();break;default:c.skipType(h&7);break}}return d},o.decodeDelimited=function(c){return c instanceof e||(c=new e(c)),this.decode(c,c.uint32())},o.verify=function(c){return typeof c!="object"||c===null?"object expected":c.identityKey!=null&&c.hasOwnProperty("identityKey")&&!(c.identityKey&&typeof c.identityKey.length=="number"||i.isString(c.identityKey))?"identityKey: buffer expected":c.identitySig!=null&&c.hasOwnProperty("identitySig")&&!(c.identitySig&&typeof c.identitySig.length=="number"||i.isString(c.identitySig))?"identitySig: buffer expected":c.data!=null&&c.hasOwnProperty("data")&&!(c.data&&typeof c.data.length=="number"||i.isString(c.data))?"data: buffer expected":null},o.fromObject=function(c){if(c instanceof n.pb.NoiseHandshakePayload)return c;var u=new n.pb.NoiseHandshakePayload;return c.identityKey!=null&&(typeof c.identityKey=="string"?i.base64.decode(c.identityKey,u.identityKey=i.newBuffer(i.base64.length(c.identityKey)),0):c.identityKey.length&&(u.identityKey=c.identityKey)),c.identitySig!=null&&(typeof c.identitySig=="string"?i.base64.decode(c.identitySig,u.identitySig=i.newBuffer(i.base64.length(c.identitySig)),0):c.identitySig.length&&(u.identitySig=c.identitySig)),c.data!=null&&(typeof c.data=="string"?i.base64.decode(c.data,u.data=i.newBuffer(i.base64.length(c.data)),0):c.data.length&&(u.data=c.data)),u},o.toObject=function(c,u){u||(u={});var f={};return u.defaults&&(u.bytes===String?f.identityKey="":(f.identityKey=[],u.bytes!==Array&&(f.identityKey=i.newBuffer(f.identityKey))),u.bytes===String?f.identitySig="":(f.identitySig=[],u.bytes!==Array&&(f.identitySig=i.newBuffer(f.identitySig))),u.bytes===String?f.data="":(f.data=[],u.bytes!==Array&&(f.data=i.newBuffer(f.data)))),c.identityKey!=null&&c.hasOwnProperty("identityKey")&&(f.identityKey=u.bytes===String?i.base64.encode(c.identityKey,0,c.identityKey.length):u.bytes===Array?Array.prototype.slice.call(c.identityKey):c.identityKey),c.identitySig!=null&&c.hasOwnProperty("identitySig")&&(f.identitySig=u.bytes===String?i.base64.encode(c.identitySig,0,c.identitySig.length):u.bytes===Array?Array.prototype.slice.call(c.identitySig):c.identitySig),c.data!=null&&c.hasOwnProperty("data")&&(f.data=u.bytes===String?i.base64.encode(c.data,0,c.data.length):u.bytes===Array?Array.prototype.slice.call(c.data):c.data),f},o.prototype.toJSON=function(){return this.constructor.toObject(this,t.util.toJSONOptions)},o}(),s}(),n})});var pl=m(Zt=>{l();"use strict";var fHe=Zt&&Zt.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),lHe=Zt&&Zt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dHe=Zt&&Zt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fHe(e,t,r);return lHe(e,t),e},hHe=Zt&&Zt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Zt,"__esModule",{value:!0});Zt.isValidPublicKey=Zt.getHkdf=Zt.verifySignedPayload=Zt.getHandshakePayload=Zt.decodePayload=Zt.getPeerIdFromPayload=Zt.signPayload=Zt.createHandshakePayload=Zt.getPayload=Zt.generateKeypair=void 0;var pHe=Rhe(),yHe=DP(),gHe=dHe(Bv()),ds=Ht(),BP=hHe(it()),mHe=rc(),bHe=Ohe(),vHe=(wi(),bn),Fv=bHe.pb.NoiseHandshakePayload;function wHe(){let t=gHe.generateKeyPair();return{publicKey:ds.Buffer.from(t.publicKey.buffer,t.publicKey.byteOffset,t.publicKey.length),privateKey:ds.Buffer.from(t.secretKey.buffer,t.secretKey.byteOffset,t.secretKey.length)}}Zt.generateKeypair=wHe;async function _He(t,e,r){let i=await Dhe(t,NP(e)),n=r??ds.Buffer.alloc(0);return khe(t.marshalPubKey(),i,n)}Zt.getPayload=_He;function khe(t,e,r){let i=Fv.create({identityKey:ds.Buffer.from(t),identitySig:e,data:r??null});return ds.Buffer.from(Fv.encode(i).finish())}Zt.createHandshakePayload=khe;async function Dhe(t,e){return ds.Buffer.from(await t.privKey.sign(e))}Zt.signPayload=Dhe;async function EHe(t){return await BP.default.createFromPubKey(ds.Buffer.from(t.identityKey))}Zt.getPeerIdFromPayload=EHe;function SHe(t){return Fv.toObject(Fv.decode(ds.Buffer.from(t)))}Zt.decodePayload=SHe;function NP(t){return ds.Buffer.concat([ds.Buffer.from("noise-libp2p-static-key:"),t])}Zt.getHandshakePayload=NP;async function xHe(t,e){let r=await BP.default.createFromPubKey(e);return vHe.equals(r.id,t)}async function AHe(t,e,r){let i=ds.Buffer.from(e.identityKey);if(!await xHe(r.id,i))throw new Error("Peer ID doesn't match libp2p public key.");let n=NP(t),s=mHe.keys.unmarshalPublicKey(i);if(!e.identitySig||!s.verify(n,ds.Buffer.from(e.identitySig)))throw new Error("Static key doesn't match to peer that signed payload!");return await BP.default.createFromPubKey(i)}Zt.verifySignedPayload=AHe;function IHe(t,e){let i=new pHe.HKDF(yHe.SHA256,e,t).expand(96),n=ds.Buffer.from(i.buffer,i.byteOffset,i.length),s=n.slice(0,32),o=n.slice(32,64),a=n.slice(64,96);return[s,o,a]}Zt.getHkdf=IHe;function THe(t){return!(!ds.Buffer.isBuffer(t)||t.length!==32)}Zt.isValidPublicKey=THe});var Nhe=m(Kv=>{l();"use strict";Object.defineProperty(Kv,"__esModule",{value:!0});var kn=Am(),MP=Cc(),RHe=20;function PHe(t,e,r){for(var i=1634760805,n=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],c=r[7]<<24|r[6]<<16|r[5]<<8|r[4],u=r[11]<<24|r[10]<<16|r[9]<<8|r[8],f=r[15]<<24|r[14]<<16|r[13]<<8|r[12],d=r[19]<<24|r[18]<<16|r[17]<<8|r[16],h=r[23]<<24|r[22]<<16|r[21]<<8|r[20],p=r[27]<<24|r[26]<<16|r[25]<<8|r[24],y=r[31]<<24|r[30]<<16|r[29]<<8|r[28],b=e[3]<<24|e[2]<<16|e[1]<<8|e[0],E=e[7]<<24|e[6]<<16|e[5]<<8|e[4],v=e[11]<<24|e[10]<<16|e[9]<<8|e[8],A=e[15]<<24|e[14]<<16|e[13]<<8|e[12],R=i,F=n,D=s,B=o,H=a,W=c,X=u,P=f,g=d,w=h,S=p,C=y,L=b,Y=E,V=v,q=A,_=0;_<RHe;_+=2)R=R+H|0,L^=R,L=L>>>32-16|L<<16,g=g+L|0,H^=g,H=H>>>32-12|H<<12,F=F+W|0,Y^=F,Y=Y>>>32-16|Y<<16,w=w+Y|0,W^=w,W=W>>>32-12|W<<12,D=D+X|0,V^=D,V=V>>>32-16|V<<16,S=S+V|0,X^=S,X=X>>>32-12|X<<12,B=B+P|0,q^=B,q=q>>>32-16|q<<16,C=C+q|0,P^=C,P=P>>>32-12|P<<12,D=D+X|0,V^=D,V=V>>>32-8|V<<8,S=S+V|0,X^=S,X=X>>>32-7|X<<7,B=B+P|0,q^=B,q=q>>>32-8|q<<8,C=C+q|0,P^=C,P=P>>>32-7|P<<7,F=F+W|0,Y^=F,Y=Y>>>32-8|Y<<8,w=w+Y|0,W^=w,W=W>>>32-7|W<<7,R=R+H|0,L^=R,L=L>>>32-8|L<<8,g=g+L|0,H^=g,H=H>>>32-7|H<<7,R=R+W|0,q^=R,q=q>>>32-16|q<<16,S=S+q|0,W^=S,W=W>>>32-12|W<<12,F=F+X|0,L^=F,L=L>>>32-16|L<<16,C=C+L|0,X^=C,X=X>>>32-12|X<<12,D=D+P|0,Y^=D,Y=Y>>>32-16|Y<<16,g=g+Y|0,P^=g,P=P>>>32-12|P<<12,B=B+H|0,V^=B,V=V>>>32-16|V<<16,w=w+V|0,H^=w,H=H>>>32-12|H<<12,D=D+P|0,Y^=D,Y=Y>>>32-8|Y<<8,g=g+Y|0,P^=g,P=P>>>32-7|P<<7,B=B+H|0,V^=B,V=V>>>32-8|V<<8,w=w+V|0,H^=w,H=H>>>32-7|H<<7,F=F+X|0,L^=F,L=L>>>32-8|L<<8,C=C+L|0,X^=C,X=X>>>32-7|X<<7,R=R+W|0,q^=R,q=q>>>32-8|q<<8,S=S+q|0,W^=S,W=W>>>32-7|W<<7;kn.writeUint32LE(R+i|0,t,0),kn.writeUint32LE(F+n|0,t,4),kn.writeUint32LE(D+s|0,t,8),kn.writeUint32LE(B+o|0,t,12),kn.writeUint32LE(H+a|0,t,16),kn.writeUint32LE(W+c|0,t,20),kn.writeUint32LE(X+u|0,t,24),kn.writeUint32LE(P+f|0,t,28),kn.writeUint32LE(g+d|0,t,32),kn.writeUint32LE(w+h|0,t,36),kn.writeUint32LE(S+p|0,t,40),kn.writeUint32LE(C+y|0,t,44),kn.writeUint32LE(L+b|0,t,48),kn.writeUint32LE(Y+E|0,t,52),kn.writeUint32LE(V+v|0,t,56),kn.writeUint32LE(q+A|0,t,60)}function Bhe(t,e,r,i,n){if(n===void 0&&(n=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(i.length<r.length)throw new Error("ChaCha: destination is shorter than source");var s,o;if(n===0){if(e.length!==8&&e.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");s=new Uint8Array(16),o=s.length-e.length,s.set(e,o)}else{if(e.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");s=e,o=n}for(var a=new Uint8Array(64),c=0;c<r.length;c+=64){PHe(a,s,t);for(var u=c;u<c+64&&u<r.length;u++)i[u]=r[u]^a[u-c];OHe(s,0,o)}return MP.wipe(a),n===0&&MP.wipe(s),i}Kv.streamXOR=Bhe;function CHe(t,e,r,i){return i===void 0&&(i=0),MP.wipe(r),Bhe(t,e,r,r,i)}Kv.stream=CHe;function OHe(t,e,r){for(var i=1;r--;)i=i+(t[e]&255)|0,t[e]=i&255,i>>>=8,e++;if(i>0)throw new Error("ChaCha: counter overflow")}});var Lhe=m(ku=>{l();"use strict";Object.defineProperty(ku,"__esModule",{value:!0});var kHe=qv(),Vv=Cc();ku.DIGEST_LENGTH=16;var Mhe=function(){function t(e){this.digestLength=ku.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var r=e[0]|e[1]<<8;this._r[0]=r&8191;var i=e[2]|e[3]<<8;this._r[1]=(r>>>13|i<<3)&8191;var n=e[4]|e[5]<<8;this._r[2]=(i>>>10|n<<6)&7939;var s=e[6]|e[7]<<8;this._r[3]=(n>>>7|s<<9)&8191;var o=e[8]|e[9]<<8;this._r[4]=(s>>>4|o<<12)&255,this._r[5]=o>>>1&8190;var a=e[10]|e[11]<<8;this._r[6]=(o>>>14|a<<2)&8191;var c=e[12]|e[13]<<8;this._r[7]=(a>>>11|c<<5)&8065;var u=e[14]|e[15]<<8;this._r[8]=(c>>>8|u<<8)&8191,this._r[9]=u>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}return t.prototype._blocks=function(e,r,i){for(var n=this._fin?0:1<<11,s=this._h[0],o=this._h[1],a=this._h[2],c=this._h[3],u=this._h[4],f=this._h[5],d=this._h[6],h=this._h[7],p=this._h[8],y=this._h[9],b=this._r[0],E=this._r[1],v=this._r[2],A=this._r[3],R=this._r[4],F=this._r[5],D=this._r[6],B=this._r[7],H=this._r[8],W=this._r[9];i>=16;){var X=e[r+0]|e[r+1]<<8;s+=X&8191;var P=e[r+2]|e[r+3]<<8;o+=(X>>>13|P<<3)&8191;var g=e[r+4]|e[r+5]<<8;a+=(P>>>10|g<<6)&8191;var w=e[r+6]|e[r+7]<<8;c+=(g>>>7|w<<9)&8191;var S=e[r+8]|e[r+9]<<8;u+=(w>>>4|S<<12)&8191,f+=S>>>1&8191;var C=e[r+10]|e[r+11]<<8;d+=(S>>>14|C<<2)&8191;var L=e[r+12]|e[r+13]<<8;h+=(C>>>11|L<<5)&8191;var Y=e[r+14]|e[r+15]<<8;p+=(L>>>8|Y<<8)&8191,y+=Y>>>5|n;var V=0,q=V;q+=s*b,q+=o*(5*W),q+=a*(5*H),q+=c*(5*B),q+=u*(5*D),V=q>>>13,q&=8191,q+=f*(5*F),q+=d*(5*R),q+=h*(5*A),q+=p*(5*v),q+=y*(5*E),V+=q>>>13,q&=8191;var _=V;_+=s*E,_+=o*b,_+=a*(5*W),_+=c*(5*H),_+=u*(5*B),V=_>>>13,_&=8191,_+=f*(5*D),_+=d*(5*F),_+=h*(5*R),_+=p*(5*A),_+=y*(5*v),V+=_>>>13,_&=8191;var j=V;j+=s*v,j+=o*E,j+=a*b,j+=c*(5*W),j+=u*(5*H),V=j>>>13,j&=8191,j+=f*(5*B),j+=d*(5*D),j+=h*(5*F),j+=p*(5*R),j+=y*(5*A),V+=j>>>13,j&=8191;var de=V;de+=s*A,de+=o*v,de+=a*E,de+=c*b,de+=u*(5*W),V=de>>>13,de&=8191,de+=f*(5*H),de+=d*(5*B),de+=h*(5*D),de+=p*(5*F),de+=y*(5*R),V+=de>>>13,de&=8191;var Q=V;Q+=s*R,Q+=o*A,Q+=a*v,Q+=c*E,Q+=u*b,V=Q>>>13,Q&=8191,Q+=f*(5*W),Q+=d*(5*H),Q+=h*(5*B),Q+=p*(5*D),Q+=y*(5*F),V+=Q>>>13,Q&=8191;var ue=V;ue+=s*F,ue+=o*R,ue+=a*A,ue+=c*v,ue+=u*E,V=ue>>>13,ue&=8191,ue+=f*b,ue+=d*(5*W),ue+=h*(5*H),ue+=p*(5*B),ue+=y*(5*D),V+=ue>>>13,ue&=8191;var le=V;le+=s*D,le+=o*F,le+=a*R,le+=c*A,le+=u*v,V=le>>>13,le&=8191,le+=f*E,le+=d*b,le+=h*(5*W),le+=p*(5*H),le+=y*(5*B),V+=le>>>13,le&=8191;var me=V;me+=s*B,me+=o*D,me+=a*F,me+=c*R,me+=u*A,V=me>>>13,me&=8191,me+=f*v,me+=d*E,me+=h*b,me+=p*(5*W),me+=y*(5*H),V+=me>>>13,me&=8191;var be=V;be+=s*H,be+=o*B,be+=a*D,be+=c*F,be+=u*R,V=be>>>13,be&=8191,be+=f*A,be+=d*v,be+=h*E,be+=p*b,be+=y*(5*W),V+=be>>>13,be&=8191;var xe=V;xe+=s*W,xe+=o*H,xe+=a*B,xe+=c*D,xe+=u*F,V=xe>>>13,xe&=8191,xe+=f*R,xe+=d*A,xe+=h*v,xe+=p*E,xe+=y*b,V+=xe>>>13,xe&=8191,V=(V<<2)+V|0,V=V+q|0,q=V&8191,V=V>>>13,_+=V,s=q,o=_,a=j,c=de,u=Q,f=ue,d=le,h=me,p=be,y=xe,r+=16,i-=16}this._h[0]=s,this._h[1]=o,this._h[2]=a,this._h[3]=c,this._h[4]=u,this._h[5]=f,this._h[6]=d,this._h[7]=h,this._h[8]=p,this._h[9]=y},t.prototype.finish=function(e,r){r===void 0&&(r=0);var i=new Uint16Array(10),n,s,o,a;if(this._leftover){for(a=this._leftover,this._buffer[a++]=1;a<16;a++)this._buffer[a]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(n=this._h[1]>>>13,this._h[1]&=8191,a=2;a<10;a++)this._h[a]+=n,n=this._h[a]>>>13,this._h[a]&=8191;for(this._h[0]+=n*5,n=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=n,n=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=n,i[0]=this._h[0]+5,n=i[0]>>>13,i[0]&=8191,a=1;a<10;a++)i[a]=this._h[a]+n,n=i[a]>>>13,i[a]&=8191;for(i[9]-=1<<13,s=(n^1)-1,a=0;a<10;a++)i[a]&=s;for(s=~s,a=0;a<10;a++)this._h[a]=this._h[a]&s|i[a];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,o=this._h[0]+this._pad[0],this._h[0]=o&65535,a=1;a<8;a++)o=(this._h[a]+this._pad[a]|0)+(o>>>16)|0,this._h[a]=o&65535;return e[r+0]=this._h[0]>>>0,e[r+1]=this._h[0]>>>8,e[r+2]=this._h[1]>>>0,e[r+3]=this._h[1]>>>8,e[r+4]=this._h[2]>>>0,e[r+5]=this._h[2]>>>8,e[r+6]=this._h[3]>>>0,e[r+7]=this._h[3]>>>8,e[r+8]=this._h[4]>>>0,e[r+9]=this._h[4]>>>8,e[r+10]=this._h[5]>>>0,e[r+11]=this._h[5]>>>8,e[r+12]=this._h[6]>>>0,e[r+13]=this._h[6]>>>8,e[r+14]=this._h[7]>>>0,e[r+15]=this._h[7]>>>8,this._finished=!0,this},t.prototype.update=function(e){var r=0,i=e.length,n;if(this._leftover){n=16-this._leftover,n>i&&(n=i);for(var s=0;s<n;s++)this._buffer[this._leftover+s]=e[r+s];if(i-=n,r+=n,this._leftover+=n,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(i>=16&&(n=i-i%16,this._blocks(e,r,n),r+=n,i-=n),i){for(var s=0;s<i;s++)this._buffer[this._leftover+s]=e[r+s];this._leftover+=i}return this},t.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var e=new Uint8Array(16);return this.finish(e),e},t.prototype.clean=function(){return Vv.wipe(this._buffer),Vv.wipe(this._r),Vv.wipe(this._h),Vv.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},t}();ku.Poly1305=Mhe;function DHe(t,e){var r=new Mhe(t);r.update(e);var i=r.digest();return r.clean(),i}ku.oneTimeAuth=DHe;function BHe(t,e){return t.length!==ku.DIGEST_LENGTH||e.length!==ku.DIGEST_LENGTH?!1:kHe.equal(t,e)}ku.equal=BHe});var Uhe=m(Du=>{l();"use strict";Object.defineProperty(Du,"__esModule",{value:!0});var zv=Nhe(),NHe=Lhe(),Om=Cc(),qhe=Am(),MHe=qv();Du.KEY_LENGTH=32;Du.NONCE_LENGTH=12;Du.TAG_LENGTH=16;var jhe=new Uint8Array(16),LHe=function(){function t(e){if(this.nonceLength=Du.NONCE_LENGTH,this.tagLength=Du.TAG_LENGTH,e.length!==Du.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return t.prototype.seal=function(e,r,i,n){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var s=new Uint8Array(16);s.set(e,s.length-e.length);var o=new Uint8Array(32);zv.stream(this._key,s,o,4);var a=r.length+this.tagLength,c;if(n){if(n.length!==a)throw new Error("ChaCha20Poly1305: incorrect destination length");c=n}else c=new Uint8Array(a);return zv.streamXOR(this._key,s,r,c,4),this._authenticate(c.subarray(c.length-this.tagLength,c.length),o,c.subarray(0,c.length-this.tagLength),i),Om.wipe(s),c},t.prototype.open=function(e,r,i,n){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(r.length<this.tagLength)return null;var s=new Uint8Array(16);s.set(e,s.length-e.length);var o=new Uint8Array(32);zv.stream(this._key,s,o,4);var a=new Uint8Array(this.tagLength);if(this._authenticate(a,o,r.subarray(0,r.length-this.tagLength),i),!MHe.equal(a,r.subarray(r.length-this.tagLength,r.length)))return null;var c=r.length-this.tagLength,u;if(n){if(n.length!==c)throw new Error("ChaCha20Poly1305: incorrect destination length");u=n}else u=new Uint8Array(c);return zv.streamXOR(this._key,s,r.subarray(0,r.length-this.tagLength),u,4),Om.wipe(s),u},t.prototype.clean=function(){return Om.wipe(this._key),this},t.prototype._authenticate=function(e,r,i,n){var s=new NHe.Poly1305(r);n&&(s.update(n),n.length%16>0&&s.update(jhe.subarray(n.length%16))),s.update(i),i.length%16>0&&s.update(jhe.subarray(i.length%16));var o=new Uint8Array(8);n&&qhe.writeUint64LE(n.length,o),s.update(o),qhe.writeUint64LE(i.length,o),s.update(o);for(var a=s.digest(),c=0;c<a.length;c++)e[c]=a[c];s.clean(),Om.wipe(a),Om.wipe(o)},t}();Du.ChaCha20Poly1305=LHe});var Hv=m(Bu=>{l();"use strict";Object.defineProperty(Bu,"__esModule",{value:!0});Bu.DUMP_SESSION_KEYS=Bu.NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG=Bu.NOISE_MSG_MAX_LENGTH_BYTES=void 0;Bu.NOISE_MSG_MAX_LENGTH_BYTES=65535;Bu.NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG=Bu.NOISE_MSG_MAX_LENGTH_BYTES-16;Bu.DUMP_SESSION_KEYS=process.env.DUMP_SESSION_KEYS});var A1=m(hn=>{l();"use strict";var qHe=hn&&hn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(hn,"__esModule",{value:!0});hn.logCipherState=hn.logRemoteEphemeralKey=hn.logRemoteStaticKey=hn.logLocalEphemeralKeys=hn.logLocalStaticKeys=hn.logger=void 0;var jHe=qHe(Ee()),UHe=Hv();hn.logger=jHe.default("libp2p:noise");var Eo;UHe.DUMP_SESSION_KEYS?Eo=hn.logger:Eo=()=>{};function FHe(t){Eo(`LOCAL_STATIC_PUBLIC_KEY ${t.publicKey.toString("hex")}`),Eo(`LOCAL_STATIC_PRIVATE_KEY ${t.privateKey.toString("hex")}`)}hn.logLocalStaticKeys=FHe;function KHe(t){t?(Eo(`LOCAL_PUBLIC_EPHEMERAL_KEY ${t.publicKey.toString("hex")}`),Eo(`LOCAL_PRIVATE_EPHEMERAL_KEY ${t.privateKey.toString("hex")}`)):Eo("Missing local ephemeral keys.")}hn.logLocalEphemeralKeys=KHe;function VHe(t){Eo(`REMOTE_STATIC_PUBLIC_KEY ${t.toString("hex")}`)}hn.logRemoteStaticKey=VHe;function zHe(t){Eo(`REMOTE_EPHEMERAL_PUBLIC_KEY ${t.toString("hex")}`)}hn.logRemoteEphemeralKey=zHe;function HHe(t){t.cs1&&t.cs2?(Eo(`CIPHER_STATE_1 ${t.cs1.n} ${t.cs1.k.toString("hex")}`),Eo(`CIPHER_STATE_2 ${t.cs2.n} ${t.cs2.k.toString("hex")}`)):Eo("Missing cipher state.")}hn.logCipherState=HHe});var LP=m(ks=>{l();"use strict";var GHe=ks&&ks.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),$He=ks&&ks.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Fhe=ks&&ks.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&GHe(e,t,r);return $He(e,t),e};Object.defineProperty(ks,"__esModule",{value:!0});ks.AbstractHandshake=ks.MIN_NONCE=void 0;var pn=Ht(),WHe=Fhe(Bv()),YHe=Fhe(DP()),Khe=Uhe(),Vhe=pl(),XHe=A1();ks.MIN_NONCE=0;var zhe=class{encryptWithAd(e,r,i){let n=this.encrypt(e.k,e.n,r,i);return this.setNonce(e,this.incrementNonce(e.n)),n}decryptWithAd(e,r,i){let{plaintext:n,valid:s}=this.decrypt(e.k,e.n,r,i);return this.setNonce(e,this.incrementNonce(e.n)),{plaintext:n,valid:s}}hasKey(e){return!this.isEmptyKey(e.k)}setNonce(e,r){e.n=r}createEmptyKey(){return pn.Buffer.alloc(32)}isEmptyKey(e){return this.createEmptyKey().equals(e)}incrementNonce(e){return e+1}nonceToBytes(e){let r=pn.Buffer.alloc(12);return r.writeUInt32LE(e,4),r}encrypt(e,r,i,n){let s=this.nonceToBytes(r),a=new Khe.ChaCha20Poly1305(e).seal(s,n,i);return pn.Buffer.from(a.buffer,a.byteOffset,a.length)}encryptAndHash(e,r){let i;return this.hasKey(e.cs)?i=this.encryptWithAd(e.cs,e.h,r):i=r,this.mixHash(e,i),i}decrypt(e,r,i,n){let s=this.nonceToBytes(r),a=new Khe.ChaCha20Poly1305(e).open(s,n,i);return a?{plaintext:pn.Buffer.from(a.buffer,a.byteOffset,a.length),valid:!0}:{plaintext:pn.Buffer.from(""),valid:!1}}decryptAndHash(e,r){let i,n=!0;return this.hasKey(e.cs)?{plaintext:i,valid:n}=this.decryptWithAd(e.cs,e.h,r):i=r,this.mixHash(e,r),{plaintext:i,valid:n}}dh(e,r){try{let i=WHe.sharedKey(e,r),n=pn.Buffer.from(i.buffer,i.byteOffset,i.length),s=pn.Buffer.alloc(32);return n.copy(s),s}catch(i){return XHe.logger(i.message),pn.Buffer.alloc(32)}}mixHash(e,r){e.h=this.getHash(e.h,r)}getHash(e,r){let i=YHe.hash(pn.Buffer.from([...e,...r]));return pn.Buffer.from(i.buffer,i.byteOffset,i.length)}mixKey(e,r){let[i,n]=Vhe.getHkdf(e.ck,r);e.cs=this.initializeKey(n),e.ck=i}initializeKey(e){let r=ks.MIN_NONCE;return{k:e,n:r}}initializeSymmetric(e){let r=pn.Buffer.from(e,"utf-8"),i=this.hashProtocolName(r),n=i,s=this.createEmptyKey();return{cs:this.initializeKey(s),ck:n,h:i}}hashProtocolName(e){if(e.length<=32){let r=pn.Buffer.alloc(32);return e.copy(r),r}else return this.getHash(e,pn.Buffer.alloc(0))}split(e){let[r,i]=Vhe.getHkdf(e.ck,pn.Buffer.alloc(0)),n=this.initializeKey(r),s=this.initializeKey(i);return{cs1:n,cs2:s}}writeMessageRegular(e,r){let i=this.encryptWithAd(e,pn.Buffer.alloc(0),r),n=this.createEmptyKey(),s=pn.Buffer.alloc(0);return{ne:n,ns:s,ciphertext:i}}readMessageRegular(e,r){return this.decryptWithAd(e,pn.Buffer.alloc(0),r.ciphertext)}};ks.AbstractHandshake=zhe});var Ghe=m(Gv=>{l();"use strict";Object.defineProperty(Gv,"__esModule",{value:!0});Gv.XX=void 0;var dh=Ht(),I1=pl(),QHe=LP(),Hhe=class extends QHe.AbstractHandshake{initializeInitiator(e,r,i,n){let s="Noise_XX_25519_ChaChaPoly_SHA256",o=this.initializeSymmetric(s);this.mixHash(o,e);let a=dh.Buffer.alloc(32);return{ss:o,s:r,rs:i,psk:n,re:a}}initializeResponder(e,r,i,n){let s="Noise_XX_25519_ChaChaPoly_SHA256",o=this.initializeSymmetric(s);this.mixHash(o,e);let a=dh.Buffer.alloc(32);return{ss:o,s:r,rs:i,psk:n,re:a}}writeMessageA(e,r,i){let n=dh.Buffer.alloc(0);i!==void 0?e.e=i:e.e=I1.generateKeypair();let s=e.e.publicKey;this.mixHash(e.ss,s);let o=this.encryptAndHash(e.ss,r);return{ne:s,ns:n,ciphertext:o}}writeMessageB(e,r){e.e=I1.generateKeypair();let i=e.e.publicKey;this.mixHash(e.ss,i),this.mixKey(e.ss,this.dh(e.e.privateKey,e.re));let n=dh.Buffer.from(e.s.publicKey),s=this.encryptAndHash(e.ss,n);this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));let o=this.encryptAndHash(e.ss,r);return{ne:i,ns:s,ciphertext:o}}writeMessageC(e,r){let i=dh.Buffer.from(e.s.publicKey),n=this.encryptAndHash(e.ss,i);this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));let s=this.encryptAndHash(e.ss,r),a={ne:this.createEmptyKey(),ns:n,ciphertext:s},{cs1:c,cs2:u}=this.split(e.ss);return{h:e.ss.h,messageBuffer:a,cs1:c,cs2:u}}readMessageA(e,r){return I1.isValidPublicKey(r.ne)&&(e.re=r.ne),this.mixHash(e.ss,e.re),this.decryptAndHash(e.ss,r.ciphertext)}readMessageB(e,r){if(I1.isValidPublicKey(r.ne)&&(e.re=r.ne),this.mixHash(e.ss,e.re),!e.e)throw new Error("Handshake state `e` param is missing.");this.mixKey(e.ss,this.dh(e.e.privateKey,e.re));let{plaintext:i,valid:n}=this.decryptAndHash(e.ss,r.ns);n&&i.length===32&&I1.isValidPublicKey(i)&&(e.rs=i),this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));let{plaintext:s,valid:o}=this.decryptAndHash(e.ss,r.ciphertext);return{plaintext:s,valid:n&&o}}readMessageC(e,r){let{plaintext:i,valid:n}=this.decryptAndHash(e.ss,r.ns);if(n&&i.length===32&&I1.isValidPublicKey(i)&&(e.rs=i),!e.e)throw new Error("Handshake state `e` param is missing.");this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));let{plaintext:s,valid:o}=this.decryptAndHash(e.ss,r.ciphertext),{cs1:a,cs2:c}=this.split(e.ss);return{h:e.ss.h,plaintext:s,valid:n&&o,cs1:a,cs2:c}}initSession(e,r,i){let n=this.createEmptyKey(),s=dh.Buffer.alloc(32),o;return e?o=this.initializeInitiator(r,i,s,n):o=this.initializeResponder(r,i,s,n),{hs:o,i:e,mc:0}}sendMessage(e,r,i){let n;if(e.mc===0)n=this.writeMessageA(e.hs,r,i);else if(e.mc===1)n=this.writeMessageB(e.hs,r);else if(e.mc===2){let{h:s,messageBuffer:o,cs1:a,cs2:c}=this.writeMessageC(e.hs,r);n=o,e.h=s,e.cs1=a,e.cs2=c}else if(e.mc>2)if(e.i){if(!e.cs1)throw new Error("CS1 (cipher state) is not defined");n=this.writeMessageRegular(e.cs1,r)}else{if(!e.cs2)throw new Error("CS2 (cipher state) is not defined");n=this.writeMessageRegular(e.cs2,r)}else throw new Error("Session invalid.");return e.mc++,n}recvMessage(e,r){let i=dh.Buffer.alloc(0),n=!1;if(e.mc===0)({plaintext:i,valid:n}=this.readMessageA(e.hs,r));else if(e.mc===1)({plaintext:i,valid:n}=this.readMessageB(e.hs,r));else if(e.mc===2){let{h:s,plaintext:o,valid:a,cs1:c,cs2:u}=this.readMessageC(e.hs,r);i=o,n=a,e.h=s,e.cs1=c,e.cs2=u}return e.mc++,{plaintext:i,valid:n}}};Gv.XX=Hhe});var km=m(Ai=>{l();"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});Ai.decode2=Ai.decode1=Ai.decode0=Ai.encode2=Ai.encode1=Ai.encode0=Ai.uint16BEDecode=Ai.uint16BEEncode=void 0;var T1=Ht(),ZHe=(t,e,r)=>(e=e||T1.Buffer.allocUnsafe(2),e.writeUInt16BE(t,r),e);Ai.uint16BEEncode=ZHe;Ai.uint16BEEncode.bytes=2;var JHe=t=>{if(t.length<2)throw RangeError("Could not decode int16BE");return t.readUInt16BE(0)};Ai.uint16BEDecode=JHe;Ai.uint16BEDecode.bytes=2;function eGe(t){return T1.Buffer.concat([t.ne,t.ciphertext])}Ai.encode0=eGe;function tGe(t){return T1.Buffer.concat([t.ne,t.ns,t.ciphertext])}Ai.encode1=tGe;function rGe(t){return T1.Buffer.concat([t.ns,t.ciphertext])}Ai.encode2=rGe;function iGe(t){if(t.length<32)throw new Error("Cannot decode stage 0 MessageBuffer: length less than 32 bytes.");return{ne:t.slice(0,32),ciphertext:t.slice(32,t.length),ns:T1.Buffer.alloc(0)}}Ai.decode0=iGe;function nGe(t){if(t.length<80)throw new Error("Cannot decode stage 1 MessageBuffer: length less than 80 bytes.");return{ne:t.slice(0,32),ns:t.slice(32,80),ciphertext:t.slice(80,t.length)}}Ai.decode1=nGe;function sGe(t){if(t.length<48)throw new Error("Cannot decode stage 2 MessageBuffer: length less than 48 bytes.");return{ne:T1.Buffer.alloc(0),ns:t.slice(0,48),ciphertext:t.slice(48,t.length)}}Ai.decode2=sGe});var qP=m($v=>{l();"use strict";Object.defineProperty($v,"__esModule",{value:!0});$v.XXHandshake=void 0;var Dm=Ht(),oGe=Ghe(),R1=pl(),gi=A1(),P1=km(),$he=class{constructor(e,r,i,n,s,o,a){this.isInitiator=e,this.payload=r,this.prologue=i,this.staticKeypair=n,this.connection=s,o&&(this.remotePeer=o),this.xx=a??new oGe.XX,this.session=this.xx.initSession(this.isInitiator,this.prologue,this.staticKeypair),this.remoteEarlyData=Dm.Buffer.alloc(0)}async propose(){if(gi.logLocalStaticKeys(this.session.hs.s),this.isInitiator){gi.logger("Stage 0 - Initiator starting to send first message.");let e=this.xx.sendMessage(this.session,Dm.Buffer.alloc(0));this.connection.writeLP(P1.encode0(e)),gi.logger("Stage 0 - Initiator finished sending first message."),gi.logLocalEphemeralKeys(this.session.hs.e)}else{gi.logger("Stage 0 - Responder waiting to receive first message...");let e=P1.decode0((await this.connection.readLP()).slice()),{valid:r}=this.xx.recvMessage(this.session,e);if(!r)throw new Error("xx handshake stage 0 validation fail");gi.logger("Stage 0 - Responder received first message."),gi.logRemoteEphemeralKey(this.session.hs.re)}}async exchange(){if(this.isInitiator){gi.logger("Stage 1 - Initiator waiting to receive first message from responder...");let e=P1.decode1((await this.connection.readLP()).slice()),{plaintext:r,valid:i}=this.xx.recvMessage(this.session,e);if(!i)throw new Error("xx handshake stage 1 validation fail");gi.logger("Stage 1 - Initiator received the message."),gi.logRemoteEphemeralKey(this.session.hs.re),gi.logRemoteStaticKey(this.session.hs.rs),gi.logger("Initiator going to check remote's signature...");try{let n=await R1.decodePayload(r);this.remotePeer=this.remotePeer||await R1.getPeerIdFromPayload(n),this.remotePeer=await R1.verifySignedPayload(e.ns,n,this.remotePeer),this.setRemoteEarlyData(n.data)}catch(n){let s=n;throw new Error(`Error occurred while verifying signed payload: ${s.message}`)}gi.logger("All good with the signature!")}else{gi.logger("Stage 1 - Responder sending out first message with signed payload and static key.");let e=this.xx.sendMessage(this.session,this.payload);this.connection.writeLP(P1.encode1(e)),gi.logger("Stage 1 - Responder sent the second handshake message with signed payload."),gi.logLocalEphemeralKeys(this.session.hs.e)}}async finish(){if(this.isInitiator){gi.logger("Stage 2 - Initiator sending third handshake message.");let e=this.xx.sendMessage(this.session,this.payload);this.connection.writeLP(P1.encode2(e)),gi.logger("Stage 2 - Initiator sent message with signed payload.")}else{gi.logger("Stage 2 - Responder waiting for third handshake message...");let e=P1.decode2((await this.connection.readLP()).slice()),{plaintext:r,valid:i}=this.xx.recvMessage(this.session,e);if(!i)throw new Error("xx handshake stage 2 validation fail");gi.logger("Stage 2 - Responder received the message, finished handshake.");try{let n=await R1.decodePayload(r);this.remotePeer=this.remotePeer||await R1.getPeerIdFromPayload(n),await R1.verifySignedPayload(this.session.hs.rs,n,this.remotePeer),this.setRemoteEarlyData(n.data)}catch(n){let s=n;throw new Error(`Error occurred while verifying signed payload: ${s.message}`)}}gi.logCipherState(this.session)}encrypt(e,r){let i=this.getCS(r);return this.xx.encryptWithAd(i,Dm.Buffer.alloc(0),e)}decrypt(e,r){let i=this.getCS(r,!1);return this.xx.decryptWithAd(i,Dm.Buffer.alloc(0),e)}getRemoteStaticKey(){return this.session.hs.rs}getCS(e,r=!0){if(!e.cs1||!e.cs2)throw new Error("Handshake not completed properly, cipher state does not exist.");return this.isInitiator?r?e.cs1:e.cs2:r?e.cs2:e.cs1}setRemoteEarlyData(e){e&&(this.remoteEarlyData=Dm.Buffer.from(e.buffer,e.byteOffset,e.length))}};$v.XXHandshake=$he});var Yhe=m(Yv=>{l();"use strict";Object.defineProperty(Yv,"__esModule",{value:!0});Yv.IK=void 0;var Wv=Ht(),Bm=pl(),aGe=LP(),Whe=class extends aGe.AbstractHandshake{initSession(e,r,i,n){let s=this.createEmptyKey(),o;return e?o=this.initializeInitiator(r,i,n,s):o=this.initializeResponder(r,i,n,s),{hs:o,i:e,mc:0}}sendMessage(e,r){let i;if(e.mc===0)i=this.writeMessageA(e.hs,r);else if(e.mc===1){let{messageBuffer:n,h:s,cs1:o,cs2:a}=this.writeMessageB(e.hs,r);i=n,e.h=s,e.cs1=o,e.cs2=a}else if(e.mc>1)if(e.i){if(!e.cs1)throw new Error("CS1 (cipher state) is not defined");i=this.writeMessageRegular(e.cs1,r)}else{if(!e.cs2)throw new Error("CS2 (cipher state) is not defined");i=this.writeMessageRegular(e.cs2,r)}else throw new Error("Session invalid.");return e.mc++,i}recvMessage(e,r){let i=Wv.Buffer.alloc(0),n=!1;if(e.mc===0&&({plaintext:i,valid:n}=this.readMessageA(e.hs,r)),e.mc===1){let{plaintext:s,valid:o,h:a,cs1:c,cs2:u}=this.readMessageB(e.hs,r);i=s,n=o,e.h=a,e.cs1=c,e.cs2=u}return e.mc++,{plaintext:i,valid:n}}writeMessageA(e,r){e.e=Bm.generateKeypair();let i=e.e.publicKey;this.mixHash(e.ss,i),this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));let n=Wv.Buffer.from(e.s.publicKey),s=this.encryptAndHash(e.ss,n);this.mixKey(e.ss,this.dh(e.s.privateKey,e.rs));let o=this.encryptAndHash(e.ss,r);return{ne:i,ns:s,ciphertext:o}}writeMessageB(e,r){e.e=Bm.generateKeypair();let i=e.e.publicKey;this.mixHash(e.ss,i),this.mixKey(e.ss,this.dh(e.e.privateKey,e.re)),this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));let n=this.encryptAndHash(e.ss,r),s=this.createEmptyKey(),o={ne:i,ns:s,ciphertext:n},{cs1:a,cs2:c}=this.split(e.ss);return{messageBuffer:o,cs1:a,cs2:c,h:e.ss.h}}readMessageA(e,r){Bm.isValidPublicKey(r.ne)&&(e.re=r.ne),this.mixHash(e.ss,e.re),this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));let{plaintext:i,valid:n}=this.decryptAndHash(e.ss,r.ns);n&&i.length===32&&Bm.isValidPublicKey(i)&&(e.rs=i),this.mixKey(e.ss,this.dh(e.s.privateKey,e.rs));let{plaintext:s,valid:o}=this.decryptAndHash(e.ss,r.ciphertext);return{plaintext:s,valid:n&&o}}readMessageB(e,r){if(Bm.isValidPublicKey(r.ne)&&(e.re=r.ne),this.mixHash(e.ss,e.re),!e.e)throw new Error("Handshake state should contain ephemeral key by now.");this.mixKey(e.ss,this.dh(e.e.privateKey,e.re)),this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));let{plaintext:i,valid:n}=this.decryptAndHash(e.ss,r.ciphertext),{cs1:s,cs2:o}=this.split(e.ss);return{h:e.ss.h,valid:n,plaintext:i,cs1:s,cs2:o}}initializeInitiator(e,r,i,n){let s="Noise_IK_25519_ChaChaPoly_SHA256",o=this.initializeSymmetric(s);this.mixHash(o,e),this.mixHash(o,i);let a=Wv.Buffer.alloc(32);return{ss:o,s:r,rs:i,re:a,psk:n}}initializeResponder(e,r,i,n){let s="Noise_IK_25519_ChaChaPoly_SHA256",o=this.initializeSymmetric(s);this.mixHash(o,e),this.mixHash(o,r.publicKey);let a=Wv.Buffer.alloc(32);return{ss:o,s:r,rs:i,re:a,psk:n}}};Yv.IK=Whe});var Qhe=m(Xv=>{l();"use strict";Object.defineProperty(Xv,"__esModule",{value:!0});Xv.FailedIKError=void 0;var Xhe=class extends Error{constructor(e,r){super(r);this.initialMsg=e,this.name="FailedIKhandshake"}};Xv.FailedIKError=Xhe});var e0e=m(Zv=>{l();"use strict";Object.defineProperty(Zv,"__esModule",{value:!0});Zv.IKHandshake=void 0;var cGe=Yhe(),C1=Ht(),Qv=km(),O1=pl(),Zhe=Qhe(),Mi=A1(),Jhe=class{constructor(e,r,i,n,s,o,a,c){this.isInitiator=e,this.payload=C1.Buffer.from(r),this.prologue=i,this.staticKeypair=n,this.connection=s,a&&(this.remotePeer=a),this.ik=c??new cGe.IK,this.session=this.ik.initSession(this.isInitiator,this.prologue,this.staticKeypair,o),this.remoteEarlyData=C1.Buffer.alloc(0)}async stage0(){if(Mi.logLocalStaticKeys(this.session.hs.s),Mi.logRemoteStaticKey(this.session.hs.rs),this.isInitiator){Mi.logger("IK Stage 0 - Initiator sending message...");let e=this.ik.sendMessage(this.session,this.payload);this.connection.writeLP(Qv.encode1(e)),Mi.logger("IK Stage 0 - Initiator sent message."),Mi.logLocalEphemeralKeys(this.session.hs.e)}else{Mi.logger("IK Stage 0 - Responder receiving message...");let e=await this.connection.readLP();try{let r=Qv.decode1(e.slice()),{plaintext:i,valid:n}=this.ik.recvMessage(this.session,r);if(!n)throw new Error("ik handshake stage 0 decryption validation fail");Mi.logger("IK Stage 0 - Responder got message, going to verify payload.");let s=await O1.decodePayload(i);this.remotePeer=this.remotePeer||await O1.getPeerIdFromPayload(s),await O1.verifySignedPayload(this.session.hs.rs,s,this.remotePeer),this.setRemoteEarlyData(s.data),Mi.logger("IK Stage 0 - Responder successfully verified payload!"),Mi.logRemoteEphemeralKey(this.session.hs.re)}catch(r){let i=r;throw Mi.logger("Responder breaking up with IK handshake in stage 0."),new Zhe.FailedIKError(e,`Error occurred while verifying initiator's signed payload: ${i.message}`)}}}async stage1(){if(this.isInitiator){Mi.logger("IK Stage 1 - Initiator receiving message...");let e=(await this.connection.readLP()).slice(),r=Qv.decode0(C1.Buffer.from(e)),{plaintext:i,valid:n}=this.ik.recvMessage(this.session,r);Mi.logger("IK Stage 1 - Initiator got message, going to verify payload.");try{if(!n)throw new Error("ik stage 1 decryption validation fail");let s=await O1.decodePayload(i);this.remotePeer=this.remotePeer||await O1.getPeerIdFromPayload(s),await O1.verifySignedPayload(r.ns.slice(0,32),s,this.remotePeer),this.setRemoteEarlyData(s.data),Mi.logger("IK Stage 1 - Initiator successfully verified payload!"),Mi.logRemoteEphemeralKey(this.session.hs.re)}catch(s){let o=s;throw Mi.logger("Initiator breaking up with IK handshake in stage 1."),new Zhe.FailedIKError(e,`Error occurred while verifying responder's signed payload: ${o.message}`)}}else{Mi.logger("IK Stage 1 - Responder sending message...");let e=this.ik.sendMessage(this.session,this.payload);this.connection.writeLP(Qv.encode0(e)),Mi.logger("IK Stage 1 - Responder sent message..."),Mi.logLocalEphemeralKeys(this.session.hs.e)}Mi.logCipherState(this.session)}decrypt(e,r){let i=this.getCS(r,!1);return this.ik.decryptWithAd(i,C1.Buffer.alloc(0),e)}encrypt(e,r){let i=this.getCS(r);return this.ik.encryptWithAd(i,C1.Buffer.alloc(0),e)}getLocalEphemeralKeys(){if(!this.session.hs.e)throw new Error("Ephemeral keys do not exist.");return this.session.hs.e}getCS(e,r=!0){if(!e.cs1||!e.cs2)throw new Error("Handshake not completed properly, cipher state does not exist.");return this.isInitiator?r?e.cs1:e.cs2:r?e.cs2:e.cs1}setRemoteEarlyData(e){e&&(this.remoteEarlyData=C1.Buffer.from(e.buffer,e.byteOffset,e.length))}};Zv.IKHandshake=Jhe});var i0e=m(Jv=>{l();"use strict";Object.defineProperty(Jv,"__esModule",{value:!0});Jv.XXFallbackHandshake=void 0;var jP=Ht(),uGe=qP(),UP=pl(),So=A1(),t0e=km(),r0e=class extends uGe.XXHandshake{constructor(e,r,i,n,s,o,a,c,u){super(e,r,i,n,s,a,u);c&&(this.ephemeralKeys=c),this.initialMsg=o}async propose(){if(this.isInitiator)this.xx.sendMessage(this.session,jP.Buffer.alloc(0),this.ephemeralKeys),So.logger("XX Fallback Stage 0 - Initialized state as the first message was sent by initiator."),So.logLocalEphemeralKeys(this.session.hs.e);else{So.logger("XX Fallback Stage 0 - Responder decoding initial msg from IK.");let e=t0e.decode0(this.initialMsg),{valid:r}=this.xx.recvMessage(this.session,{ne:e.ne,ns:jP.Buffer.alloc(0),ciphertext:jP.Buffer.alloc(0)});if(!r)throw new Error("xx fallback stage 0 decryption validation fail");So.logger("XX Fallback Stage 0 - Responder used received message from IK."),So.logRemoteEphemeralKey(this.session.hs.re)}}async exchange(){if(this.isInitiator){let e=t0e.decode1(this.initialMsg),{plaintext:r,valid:i}=this.xx.recvMessage(this.session,e);if(!i)throw new Error("xx fallback stage 1 decryption validation fail");So.logger("XX Fallback Stage 1 - Initiator used received message from IK."),So.logRemoteEphemeralKey(this.session.hs.re),So.logRemoteStaticKey(this.session.hs.rs),So.logger("Initiator going to check remote's signature...");try{let n=await UP.decodePayload(r);this.remotePeer=this.remotePeer||await UP.getPeerIdFromPayload(n),await UP.verifySignedPayload(this.session.hs.rs,n,this.remotePeer),this.setRemoteEarlyData(n.data)}catch(n){let s=n;throw new Error(`Error occurred while verifying signed payload from responder: ${s.message}`)}So.logger("All good with the signature!")}else So.logger("XX Fallback Stage 1 - Responder start"),await super.exchange(),So.logger("XX Fallback Stage 1 - Responder end")}};Jv.XXFallbackHandshake=r0e});var s0e=m(k1=>{l();"use strict";Object.defineProperty(k1,"__esModule",{value:!0});k1.decryptStream=k1.encryptStream=void 0;var n0e=Ht(),e7=Hv();function fGe(t){return async function*(e){for await(let r of e){let i=n0e.Buffer.from(r.buffer,r.byteOffset,r.length);for(let n=0;n<i.length;n+=e7.NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG){let s=n+e7.NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG;s>i.length&&(s=i.length),yield t.encrypt(i.slice(n,s),t.session)}}}}k1.encryptStream=fGe;function lGe(t){return async function*(e){for await(let r of e){let i=n0e.Buffer.from(r.buffer,r.byteOffset,r.length);for(let n=0;n<i.length;n+=e7.NOISE_MSG_MAX_LENGTH_BYTES){let s=n+e7.NOISE_MSG_MAX_LENGTH_BYTES;s>i.length&&(s=i.length);let o=i.slice(n,s),{plaintext:a,valid:c}=await t.decrypt(o,t.session);if(!c)throw new Error("Failed to validate decrypted chunk");yield a}}}}k1.decryptStream=lGe});var a0e=m(t7=>{l();"use strict";Object.defineProperty(t7,"__esModule",{value:!0});t7.KeyCache=void 0;var o0e=class{constructor(){this.storage=new Map}store(e,r){this.storage.set(e.id,r)}load(e){var r;return e&&(r=this.storage.get(e.id))!==null&&r!==void 0?r:null}resetStorage(){this.storage.clear()}},dGe=new o0e;t7.KeyCache=dGe});var KP=m(xo=>{l();"use strict";var hGe=xo&&xo.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),pGe=xo&&xo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yGe=xo&&xo.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&hGe(e,t,r);return pGe(e,t),e},r7=xo&&xo.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(xo,"__esModule",{value:!0});xo.Noise=void 0;var gGe=yGe(Bv()),Nm=Ht(),c0e=r7(ghe()),mGe=r7(_he()),u0e=r7(Lv()),bGe=r7(Nr()),f0e=fa(),vGe=qP(),wGe=e0e(),_Ge=i0e(),l0e=pl(),D1=km(),d0e=s0e(),FP=a0e(),EGe=A1(),h0e=Hv(),p0e=class{constructor(e,r){if(this.protocol="/noise",this.prologue=Nm.Buffer.alloc(0),this.earlyData=r??Nm.Buffer.alloc(0),this.useNoisePipes=!1,e){let i=gGe.generateKeyPairFromSeed(e);this.staticKeys={privateKey:Nm.Buffer.from(i.secretKey.buffer,i.secretKey.byteOffset,i.secretKey.length),publicKey:Nm.Buffer.from(i.publicKey.buffer,i.publicKey.byteOffset,i.publicKey.length)}}else this.staticKeys=l0e.generateKeypair()}async secureOutbound(e,r,i){let n=c0e.default(r,{lengthEncoder:D1.uint16BEEncode,lengthDecoder:D1.uint16BEDecode,maxDataLength:h0e.NOISE_MSG_MAX_LENGTH_BYTES}),s=await this.performHandshake({connection:n,isInitiator:!0,localPeer:e,remotePeer:i});return{conn:await this.createSecureConnection(n,s),remoteEarlyData:s.remoteEarlyData,remotePeer:s.remotePeer}}async secureInbound(e,r,i){let n=c0e.default(r,{lengthEncoder:D1.uint16BEEncode,lengthDecoder:D1.uint16BEDecode,maxDataLength:h0e.NOISE_MSG_MAX_LENGTH_BYTES}),s=await this.performHandshake({connection:n,isInitiator:!1,localPeer:e,remotePeer:i});return{conn:await this.createSecureConnection(n,s),remoteEarlyData:s.remoteEarlyData,remotePeer:s.remotePeer}}async performHandshake(e){var r;let i=await l0e.getPayload(e.localPeer,this.staticKeys.publicKey,this.earlyData),n=this.useNoisePipes;if(e.isInitiator&&FP.KeyCache.load(e.remotePeer)===null&&(n=!1),n){let{remotePeer:s,connection:o,isInitiator:a}=e,c=new wGe.IKHandshake(a,i,this.prologue,this.staticKeys,o,(r=FP.KeyCache.load(e.remotePeer))!==null&&r!==void 0?r:Nm.Buffer.alloc(32),s);try{return await this.performIKHandshake(c)}catch(u){let f;return e.isInitiator&&(f=c.getLocalEphemeralKeys()),await this.performXXFallbackHandshake(e,i,u.initialMsg,f)}}else return await this.performXXHandshake(e,i)}async performXXFallbackHandshake(e,r,i,n){let{isInitiator:s,remotePeer:o,connection:a}=e,c=new _Ge.XXFallbackHandshake(s,r,this.prologue,this.staticKeys,a,i,o,n);try{await c.propose(),await c.exchange(),await c.finish()}catch(u){EGe.logger(u);let f=u;throw new Error(`Error occurred during XX Fallback handshake: ${f.message}`)}return c}async performXXHandshake(e,r){let{isInitiator:i,remotePeer:n,connection:s}=e,o=new vGe.XXHandshake(i,r,this.prologue,this.staticKeys,s,n);try{await o.propose(),await o.exchange(),await o.finish(),this.useNoisePipes&&o.remotePeer&&FP.KeyCache.store(o.remotePeer,o.getRemoteStaticKey())}catch(a){let c=a;throw new Error(`Error occurred during XX handshake: ${c.message}`)}return o}async performIKHandshake(e){return await e.stage0(),await e.stage1(),e}async createSecureConnection(e,r){let[i,n]=mGe.default(),s=e.unwrap();return await bGe.default(i,u0e.default,d0e.encryptStream(r),f0e.encode({lengthEncoder:D1.uint16BEEncode}),s,f0e.decode({lengthDecoder:D1.uint16BEDecode}),u0e.default,d0e.decryptStream(r),i),n}};xo.Noise=p0e});var y0e=m(Nu=>{l();"use strict";var SGe=Nu&&Nu.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),xGe=Nu&&Nu.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&SGe(e,t,r)};Object.defineProperty(Nu,"__esModule",{value:!0});Nu.NOISE=void 0;var AGe=KP();xGe(KP(),Nu);Nu.NOISE=new AGe.Noise});var ma=m((JCt,m0e)=>{l();"use strict";function g0e(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function IGe(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return g0e(t,r)}catch(i){r.message=t.message,r.stack=t.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(t)),g0e(new n,r)}}m0e.exports=IGe});var w0e=m((eOt,v0e)=>{l();"use strict";var TGe=CR(),{EventEmitter:RGe}=br();function b0e(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let r=0,i=t.length;r<i;++r)if(t[r]!==e[r])return!1;return!0}function VP(){return{contacts:[],dontSplit:!1,left:null,right:null}}function Mm(t,e){if(!(e instanceof Uint8Array))throw new TypeError(t+" is not a Uint8Array")}var Lm=class extends RGe{constructor(e={}){super();this.localNodeId=e.localNodeId||TGe(20),this.numberOfNodesPerKBucket=e.numberOfNodesPerKBucket||20,this.numberOfNodesToPing=e.numberOfNodesToPing||3,this.distance=e.distance||Lm.distance,this.arbiter=e.arbiter||Lm.arbiter,this.metadata=Object.assign({},e.metadata),Mm("option.localNodeId as parameter 1",this.localNodeId),this.root=VP()}static arbiter(e,r){return e.vectorClock>r.vectorClock?e:r}static distance(e,r){let i=0,n=0,s=Math.min(e.length,r.length),o=Math.max(e.length,r.length);for(;n<s;++n)i=i*256+(e[n]^r[n]);for(;n<o;++n)i=i*256+255;return i}add(e){Mm("contact.id",(e||{}).id);let r=0,i=this.root;for(;i.contacts===null;)i=this._determineNode(i,e.id,r++);let n=this._indexOf(i,e.id);return n>=0?(this._update(i,n,e),this):i.contacts.length<this.numberOfNodesPerKBucket?(i.contacts.push(e),this.emit("added",e),this):i.dontSplit?(this.emit("ping",i.contacts.slice(0,this.numberOfNodesToPing),e),this):(this._split(i,r),this.add(e))}closest(e,r=1/0){if(Mm("id",e),!Number.isInteger(r)&&r!==1/0||r<=0)throw new TypeError("n is not positive number");let i=[];for(let n=[this.root],s=0;n.length>0&&i.length<r;){let o=n.pop();if(o.contacts===null){let a=this._determineNode(o,e,s++);n.push(o.left===a?o.right:o.left),n.push(a)}else i=i.concat(o.contacts)}return i.map(n=>[this.distance(n.id,e),n]).sort((n,s)=>n[0]-s[0]).slice(0,r).map(n=>n[1])}count(){let e=0;for(let r=[this.root];r.length>0;){let i=r.pop();i.contacts===null?r.push(i.right,i.left):e+=i.contacts.length}return e}_determineNode(e,r,i){let n=i>>3,s=i%8;return r.length<=n&&s!==0?e.left:r[n]&1<<7-s?e.right:e.left}get(e){Mm("id",e);let r=0,i=this.root;for(;i.contacts===null;)i=this._determineNode(i,e,r++);let n=this._indexOf(i,e);return n>=0?i.contacts[n]:null}_indexOf(e,r){for(let i=0;i<e.contacts.length;++i)if(b0e(e.contacts[i].id,r))return i;return-1}remove(e){Mm("the id as parameter 1",e);let r=0,i=this.root;for(;i.contacts===null;)i=this._determineNode(i,e,r++);let n=this._indexOf(i,e);if(n>=0){let s=i.contacts.splice(n,1)[0];this.emit("removed",s)}return this}_split(e,r){e.left=VP(),e.right=VP();for(let s of e.contacts)this._determineNode(e,s.id,r).contacts.push(s);e.contacts=null;let i=this._determineNode(e,this.localNodeId,r),n=e.left===i?e.right:e.left;n.dontSplit=!0}toArray(){let e=[];for(let r=[this.root];r.length>0;){let i=r.pop();i.contacts===null?r.push(i.right,i.left):e=e.concat(i.contacts)}return e}*toIterable(){for(let e=[this.root];e.length>0;){let r=e.pop();r.contacts===null?e.push(r.right,r.left):yield*r.contacts}}_update(e,r,i){if(!b0e(e.contacts[r].id,i.id))throw new Error("wrong index for _update");let n=e.contacts[r],s=this.arbiter(n,i);s===n&&n!==i||(e.contacts.splice(r,1),e.contacts.push(s),this.emit("updated",n,s))}};v0e.exports=Lm});var qm={};zt(qm,{xor:()=>PGe});function PGe(t,e){if(t.length!==e.length)throw new Error("Inputs should have the same length");let r=new Uint8Array(t.length);for(let i=0;i<t.length;i++)r[i]=t[i]^e[i];return r}var jm=bt(()=>{l()});var _0e=m((tOt,CGe)=>{CGe.exports=[77591,22417,43971,28421,740,29829,71467,228973,196661,78537,27689,36431,44415,14362,19456,106025,96308,2882,49509,21149,87173,131409,75844,23676,121838,30291,17492,2953,7564,110620,129477,127283,53113,72417,165166,109690,21200,102125,24049,71504,90342,25307,72039,26812,26715,32264,133800,71161,88956,171987,51779,24425,16671,30251,186294,247761,14202,2121,8465,35024,4876,85917,169730,3638,256836,96184,943,18678,6583,52907,35807,112254,214097,18796,11595,9243,23554,887,268203,382004,24590,111335,11625,16619,29039,102425,69006,97976,92362,32552,63717,41433,128974,137630,59943,10019,13986,35430,33665,108037,43799,43280,38195,29078,58629,18265,14425,46832,235538,40830,77881,110717,58937,3463,325358,51300,47623,117252,19007,10170,20540,91237,294813,4951,79841,56232,36270,128547,69209,66275,100156,32063,73531,34439,80937,28892,44466,88595,216307,32583,49620,16605,82127,45807,21630,78726,20235,40163,111007,96926,5567,72083,21665,58844,39419,179767,48328,42662,51550,5251,37811,49608,81056,50854,55513,20922,18891,197409,164656,32593,71449,220474,58919,85682,67854,13758,35066,3565,61905,214793,119572,141419,21504,10302,27354,67003,46131,32668,15165,64871,34450,17821,2757,11452,34189,5160,12257,85523,560,53385,65887,119549,135620,312353,115979,122356,10867,193231,124537,54783,90675,120791,4715,142253,50943,17271,43358,25331,4917,120566,34580,12878,33786,160528,32523,4869,301307,104817,81491,23276,8832,97911,31265,52065,7998,49622,9715,43998,34091,84587,20664,69041,29419,53205,10838,58288,116145,6185,5154,141795,35924,21307,144738,43730,12085,8279,10002,119,133779,199668,72938,31768,39176,67875,38453,9700,44144,4121,116048,41733,12868,82669,92308,128,34262,11332,7712,90764,36141,13553,71312,77470,117314,96549,49135,23602,54468,28605,6327,62308,17171,67531,21319,14105,894,107722,46157,8503,51069,100472,45138,15246,14577,35609,191464,1757,13364,161349,32067,91705,81144,52339,5408,91066,21983,14157,100545,4372,26630,129112,1423,29676,213626,4397,88436,99190,6877,49958,26122,114348,60661,29818,293118,50042,179738,16400,163423,89627,31040,43973,36638,45952,5153,1894,109322,1898,134021,12402,112077,68309,190269,69866,31938,107383,11522,105232,11248,14868,39852,71707,186525,16530,38162,106212,11700,5130,16608,26998,59586,108399,230033,43683,48135,82179,2073,5015,196684,189293,16378,23452,8301,35640,11632,214551,29240,57644,33137,91949,55157,52384,117313,5090,17717,89668,49363,82238,241035,66216,29066,184088,97206,62820,26595,4241,135635,173672,8202,459,71355,146294,29587,3008,135385,141203,14803,6634,45094,69362,50925,546,51884,62011,83296,234584,44515,56050,89476,87751,19373,12691,149923,19794,13833,35846,87557,58339,2884,19145,25647,12224,11024,77338,64608,122297,53025,7205,36189,36294,170779,21750,7739,173883,75192,35664,224240,113121,30181,26267,27036,117827,92015,106516,55628,203549,67949,60462,60844,35911,20457,1820,920,19773,8738,73173,181993,38521,98254,76257,46008,92796,5384,26868,151566,22124,2411,15919,186872,180021,28099,152961,78811,80237,62352,102653,74259,184890,16792,123702,224945,29940,19512,75283,14059,112691,92811,233329,20411,138569,53341,109802,50600,134528,66747,5529,166531,31578,64732,67189,1596,126357,967,167999,206598,109752,119431,207825,78791,91938,10301,27311,24233,252343,28831,32812,66002,112267,90895,8786,8095,16824,22866,21813,60507,174833,19549,130985,117051,52110,6938,81923,123864,38061,919,18680,53534,46739,112893,161529,85429,26761,11900,81121,91968,15390,217947,56524,1713,6654,37089,85630,138866,61850,16491,75577,16884,98296,73523,6140,44645,6062,36366,29844,57946,37932,42472,5266,20834,19309,33753,127182,134259,35810,41805,45878,312001,14881,47757,49251,120050,44252,3708,25856,107864,120347,1228,36550,41682,34496,47025,8393,173365,246526,12894,161607,35670,90785,126572,2095,124731,157033,58694,554,12786,9642,4817,16136,47864,174698,66992,4639,69284,10625,40710,27763,51738,30404,264105,137904,109882,52487,42824,57514,2740,10479,146799,107390,16586,88038,174951,9410,16185,44158,5568,40658,46108,12763,97385,26175,108859,664,230732,67470,46663,14395,50750,141320,93140,15361,47997,55784,6791,307840,118569,107326,18056,58281,260415,54691,8790,73332,45633,7511,45674,143373,14031,11799,94491,35646,96544,14560,26049,32983,25791,83814,42094,231370,63955,139212,2359,169908,3108,183486,105867,28197,32941,124968,26402,88267,149768,23053,3078,19091,52924,25383,19209,111548,97361,3959,24880,235061,9099,24921,161254,151405,20508,7159,34381,20133,11434,74036,19974,34769,36585,1076,22454,17354,38727,235160,111547,96454,117448,156940,91330,37299,7310,26915,117060,51369,22620,61861,322264,106850,111694,15091,2624,40345,300446,177064,1707,27389,54792,327783,132669,183543,59003,17744,20603,151134,106923,53084,71803,279424,319816,11579,21946,16728,38274,72711,5085,83391,88646,40159,25027,34680,10752,12988,54126,30365,18338,100445,230674,44874,84974,143877,123253,139372,28082,91477,144002,13096,219729,46016,50029,42377,14601,6660,58244,58978,23918,88206,113611,64452,17541,41032,10942,12021,49189,10978,40175,37156,10947,71709,106894,112538,57007,137486,150608,152719,40615,7746,279716,13101,19524,28708,40578,72320,1096,182051,94527,51275,22833,45164,81917,77519,48508,5421,140302,37845,149830,5587,27579,5357,428725,248187,6326,206760,39814,32585,89923,44341,288753,284443,96368,31201,94189,119504,20359,52073,103216,179,27934,32801,96035,34111,34309,101326,18198,20704,210266,37643,27880,141873,106e3,19414,56614,167714,66483,107885,86602,4379,20796,75467,4987,5017,118857,26003,34308,114428,29198,6686,29697,73632,3739,69795,16798,41504,7207,30722,21436,36735,28067,28545,3239,11221,36031,41889,100010,19247,317673,29495,174554,6424,129725,53845,94986,7955,59676,2604,191497,19735,102214,62954,23844,11872,179525,261436,34492,428,78404,142035,16747,17246,27578,37021,33672,57944,26056,135760,2369,61674,122066,31327,19374,157065,40553,130982,69619,71290,38855,72100,92903,95940,51422,165999,65713,57873,50726,7288,20272,2081,42326,22624,81120,57914,79352,19447,1684,72302,11774,302559,161481,96396,13692,414988,3721,79066,56627,46883,21150,11747,12184,5856,113458,176117,84416,52079,27933,3354,59765,141359,2212,216309,2555,23458,196722,142463,45701,44548,28798,19418,215,29916,9396,10574,114226,84475,13520,18694,34056,4524,90302,62930,13539,19407,77209,7728,38088,9535,2263,23875,183945,17750,26274,67172,10585,28042,22199,7478,51331,66030,26774,192929,31434,25850,50197,52926,178158,4679,181256,70184,229600,9959,105594,72158,73974,2726,35085,78087,23284,35568,51713,155676,5401,27254,11966,17569,223253,71993,103357,111477,55722,30504,26034,46774,35392,36285,214814,41143,163465,1051,16094,81044,6636,76489,179102,20712,39178,35683,125177,54219,30617,52994,25324,50123,2543,87529,58995,10688,125199,12388,60158,125481,131646,7642,133350,65874,3438,97277,101450,10075,56344,116821,50778,60547,98016,106135,13859,14255,16300,77373,173521,8285,45932,37426,4054,114295,55947,7703,39114,52,51119,128135,19714,60715,9554,50492,88180,2823,118271,52993,122625,97919,23859,37895,25040,33614,32102,20431,3577,9275,15686,43031,157741,110358,1884,40291,125391,13736,5008,64881,87336,77381,70711,43032,49155,118587,70494,4318,10168,30126,12580,10524,280104,104001,145413,2862,84140,6603,106005,13566,12780,11251,42830,571,179910,82443,13146,469,42714,32591,265217,424024,92553,54721,134100,6007,15242,114681,59030,16718,85465,200214,85982,55174,165013,23493,56964,82529,109150,32706,27568,82442,5350,14976,13165,44890,60021,21343,33978,17264,4655,22328,27819,75730,16567,55483,14510,17926,45827,150609,3704,7385,272531,161543,76904,122163,52405,2039,19165,41623,14423,228354,3369,176360,85491,7122,35789,303724,4465,13628,2233,55311,118771,20713,10006,221519,45115,71021,35650,29775,7337,10864,20665,21142,1746,15080,1624,32449,10905,105743,229797,7701,3940,22997,178467,57208,389057,39683,59403,63344,63125,54847,69691,18336,56448,3362,37202,18282,29648,138224,35867,10495,5911,28814,26653,31514,176702,26550,45621,11734,4525,40543,73944,121080,27858,155561,14887,44670,30742,8796,107455,113472,56369,75581,183777,240095,133699,153299,8768,160464,26058,49078,103971,21875,71486,44888,17156,9678,89541,123019,102337,3972,83930,21245,87852,109660,287918,183019,686,10100,39177,283941,11274,24736,26793,26214,25995,77011,141580,4070,23742,46285,46632,30700,26669,19056,35951,115575,174034,56097,35463,87425,24575,44245,38701,82317,85922,281616,100333,147697,61503,7730,84330,8530,59917,61597,17173,9092,32658,90288,193136,39023,20381,56654,31132,7779,1919,1375,117128,30819,11169,40938,23935,115201,101155,151034,4835,11231,74550,89388,59951,91704,107312,167882,115062,12732,72738,88703,464019,158267,57995,60496,737,14371,123867,4174,243339,159946,7568,16025,134556,110916,38103,191,80226,88794,29688,27230,10454,76308,57647,77409,113483,66864,14745,19808,12023,46583,84805,16015,17102,2231,20611,3547,95740,250131,34559,108894,8498,15853,159169,148920,20942,2813,93160,45188,210613,45531,52587,149062,39782,28194,57849,60965,84954,89766,84453,100927,16501,27658,165311,103841,54192,207341,19558,20084,319622,5672,205467,98462,61849,36279,13609,147177,24726,165015,209489,59591,31157,6551,117580,75060,141146,277310,21072,22023,106474,63041,137443,122965,68371,5383,42146,98961,113467,30863,23794,4843,99630,30392,82679,13699,241612,33601,93146,24319,18643,32155,95669,40440,15333,34089,67799,142144,58245,38633,114531,117400,77861,188726,5507,2568,8853,10987,107222,2663,2421,11530,13345,30075,41785,118661,104786,17459,12490,16281,71936,193555,17431,5944,71758,26485,77317,20803,367167,158,7362,93430,11735,172445,46002,11532,54482,930,62911,2235,23004,179236,4764,101859,208113,22477,55163,95579,14098,67320,162556,90709,156949,3826,57492,4025,34092,87442,104565,6718,186015,28214,14209,10039,107186,233912,58877,81637,55265,39828,6194,145813,50831,105849,4974,88319,122296,10272,197216,95714,51540,72418,23324,91555,8743,140452,250249,51666,34124,7229,38592,129641,78169,174242,22464,149964,51450,14034,10026,95376,26190,120062,14401,8700,265,31386,143573,7203,229889,61567,4227,140981,2466,72052,10787,10062,30958,6099,38471,30103,23202,208101,70847,467,58934,32271,32984,36637,24107,30771,17109,73353,13650,2098,157040,67366,66904,106018,265380,107238,18535,44025,32681,144983,62505,91295,56120,3082,77508,10322,63023,36700,81885,224127,16721,45023,239261,111272,13852,7866,149243,204199,32309,22084,42029,38316,126644,104973,14406,43454,67322,61310,15789,40285,24026,181047,6301,70927,23319,115823,27248,66693,115875,278566,63007,146844,56841,59007,87368,180001,22370,42114,80605,12022,10374,308,25079,14689,12618,63368,7936,264973,212291,136713,95999,105801,18965,32075,48700,52230,35119,96912,32992,8586,16606,101333,101812,14969,39930,759,193090,27387,42914,12937,5058,62646,64528,38624,25743,37502,3716,4435,30352,178687,26461,132611,42002,138442,35833,59582,16345,8048,60319,49349,309,47800,49739,90482,26405,34470,63786,32479,85028,39866,47846,11649,23934,29466,2816,42864,31828,7410,74885,49632,47629,111801,90749,19536,18767,105764,59606,21223,10746,76298,22220,39408,7190,79654,64856,11602,82156,272765,17079,70089,245473,51813,184407,384678,1576,122249,5064,27481,6188,25790,74361,27541,318284,45430,31488,620,93579,45723,192118,22670,51913,4162,70244,35966,26397,16199,50899,209613,121702,287507,2993,36101,132229,67345,33062,76295,118628,78705,52316,34375,107083,107454,44863,127561,33964,3073,154010,190914,55967,39074,6272,31047,5550,41123,26154,98638,47110,19998,148091,50229,31329,59900,195442,19106,61347,73497,70015,682,45850,25776,38022,148951,6288,37411,232526,109277,27286,32342,9262,5220,16651,23175,46740,129438,78614,121925,66914,88710,127952,5563,21500,34521,10739,14863,191006,62956,17359,16749,67027,56284,69134,43301,35039,58883,54466,60823,404451,75743,59856,86979,7923,34273,83785,32142,7693,268986,197428,282681,17049,22346,22990,92245,107180,3357,37104,96724,49153,7683,31197,43267,82231,164276,23696,20848,188364,22309,24821,158707,1018,22514,70922,27792,45589,59709,10765,736,35218,63479,51987,24275,63588,55361,92929,81964,4658,20122,12330,44058,13065,311456,72224,8337,211229,38979,22590,138478,52757,32595,133600,8838,31549,94412,43391,90056,1585,94802,127271,6223,31889,137038,132910,2165,57616,230152,6080,10748,36737,74579,134062,50525,180532,119270,34556,76155,82394,52595,29258,31435,87820,67996,26943,183878,38007,2410,13526,180297,69856,3503,187396,167700,7838,16701,9199,56267,3661,37407,65994,23767,5708,62508,221700,67088,86978,46776,84434,32088,5612,9149,88244,21685,95151,46750,189612,2979,506311,2594,3628,40074,105039,78243,28523,6651,38058,71999,30992,12764,68261,108991,6165,26450,61961,13400,22426,7490,60890,109623,2070,12958,50355,67979,257096,7213,42578,52121,35716,65461,7516,124758,39268,302,64712,14977,1467,219452,2840,34229,11121,21602,19270,63574,8024,1532,17331,79839,78885,52029,180767,57957,6069,91265,61380,55767,8927,32881,287603,22149,35029,68876,6428,199567,46926,13412,104132,21434,366616,45060,110046,81924,128910,45886,52821,130416,29416,77342,21762,67329,121432,79924,11724,38625,81006,102033,28338,13326,3250,82056,82526,38212,21112,12382,111495,3263,7414,86274,93490,40844,30224,45212,24019,48411,71367,24941,76729,57776,3769,38114,202019,197745,31953,237533,33270,201580,255648,100798,44741,32241,98468,106931,10085,15090,170358,33154,66787,18819,69760,25061,234005,82660,6295,131975,16874,9076,4094,25005,17740,40908,19533,220019,44330,99792,50040,19619,13950,55228,24423,31253,95308,103177,184795,28590,82285,5059,3210,75525,49894,70007,56178,10580,36051,139681,21617,98736,3555,106306,164189,37352,63915,47824,24883,145530,61904,28444,11483,19837,145446,30420,112972,85939,11835,191233,2262,20705,58630,1753,148334,1197,144714,6887,11223,107667,60879,77914,4151,57417,81594,96681,169430,1784,20444,95138,254041,27038,596,7117,72808,13759,3353,126776,21074,55322,27081,36942,39547,139830,179275,4453,713,8722,71399,19204,25785,22794,23923,104114,11291,25458,102309,88396,75288,230440,206396,104551,58447,130857,37247,94734,31548,176529,226077,65159,20104,10096,66881,94191,237909,27109,37404,1520,27421,25220,113003,23423,24884,50585,6286,231877,150800,11789,3226,90004,60642,5053,202400,61442,132531,175329,57138,30116,103847,9973,75367,16452,32360,59119,21246,10191,164804,23305,61051,37348,154530,13214,5468,50403,66754,130976,50559,80515,14436,155492,84017,5472,43107,41240,2890,90431,70188,382,76234,48040,50211,281038,237007,32115,142178,1536,22761,96429,1811,31243,1679,49143,55209,17402,235054,61494,7462,77030,34925,87609,78002,9499,9027,73289,201078,101379,63544,27666,5469,10642,30029,49816,132979,95620,58086,351930,116300,2110,2043,30845,6154,11279,16727,4122,2277,27281,4971,3650,39060,61970,65951,39674,75686,38151,11370,130809,177895,32665,63725,122267,7857,39618,118483,44792,157755,178624,136994,24260,41308,22471,12404,21707,12486,30473,52781,50246,20247,39065,909,56825,103158,128603,31542,1089,41935,32744,12428,37963,84420,33134,72921,208449,42622,168151,127335,147107,46699,38216,12591,94342,85814,31423,24944,2605,87542,67473,192551,4496,56321,91819,17630,6300,256183,114569,202090,33209,35289,34897,24967,40520,43470,5344,10199,34810,14283,10381,10017,62923,49924,23233,64539,13051,35686,19698,11570,135555,120868,44924,87065,52318,52335,47586,140906,245885,109834,78668,9065,46990,25258,72022,61243,40838,4545,146387,10537,11557,17470,36930,68104,46711,24264,79401,81043,18225,120488,24746,84338,81652,28266,13776,21878,46973,1047,230465,73357,95777,24973,210160,62210,58404,110633,169651,6937,41870,9909,26822,191062,76553,27519,96256,239070,2478,205678,67955,58532,20601,50120,19148,78501,195724,110740,8249,109665,27446,30568,57631,31425,49752,32820,65504,50079,3663,102256,219898,23849,211315,14645,4359,91767,9528,12449,49366,7941,49763,107848,8930,27086,50686,9744,10447,81935,39513,46514,1670,29229,6172,22312,137280,97759,9806,14445,22976,56458,73391,34983,93760,174219,52573,33149,59747,2429,136277,75123,165263,91040,7446,57632,48633,97140,246081,84766,151684,79918,93268,120346,54059,54875,77858,32996,103590,45276,11968,19600,25849,17159,132907,42828,16817,4913,99462,103303,27395,5737,74184,20749,21160,14377,77062,131403,158735,10999,27799,77785,9320,34366,51593,61070,33746,47048,29268,36675,30262,53297,9832,82e3,20188,122292,39917,7331,18160,68301,185935,134830,15031,4935,10004,165845,185534,46923,30109,44134,122631,18874,22903,112790,26561,18549,348902,82871,140345,255565,135390,63556,103747,145055,179600,145662,296111,61661,211987,23952,52342,126343,48450,32919,44277,82185,9591,62139,205363,376969,394874,108461,18040,120885,14798,39863,16571,16794,58271,81025,55206,14640,118656,6361,44092,85970,6262,153863,108244,180200,72264,79947,38044,10050,5735,61221,80712,5471,115689,11391,11661,184257,20010,60116,30320,19327,134598,45455,27542,18004,125092,452272,1549,91523,46567,180063,156026,2608,11174,58848,37788,65907,80194,30490,5786,40775,119519,106241,11323,156297,8425,61495,2617,29675,2425,59886,112582,49142,59618,4863,50597,86710,50650,168632,27693,85641,83643,18993,25768,84284,28090,93592,36627,312804,43381,9887,9402,100931,97165,3311,173330,66805,28935,4963,184460,3201,78102,19126,21607,37496,24938,22615,16153,32862,134792,153318,61120,6067,2812,12826,12792,23825,37559,64662,202250,102694,155488,85881,149193,46233,65383,15521,106982,11358,176786,25752,39717,34208,24510,32464,77742,39371,72028,138229,60688,71386,102834,132477,2208,11548,63670,271279,28351,30338,38620,32491,99845,143885,152266,13252,2825,178663,108097,1775,78201,14897,113573,163346,62292,171129,22183,96598,38733,64971,166776,117445,9968,146393,44677,74867,20908,97328,12761,25656,26785,9148,112344,26115,99176,110121,22437,49547,6180,79320,5835,31392,43328,33377,75870,119860,69497,80273,7325,155219,43167,111173,28347,20222,3763,71752,55041,47252,14618,28088,15012,97805,194698,54636,2036,41349,6173,96604,61530,51859,43782,13361,24334,22668,24792,7070,23441,16789,3209,36211,208475,26242,32880,122181,182407,21444,31060,88459,29929,77907,12716,10934,97005,20599,31690,8403,58445,30303,22700,10336,86731,103115,337709,72556,46788,112566,47684,67089,53548,36874,56487,41387,125985,26893,40071,106683,73712,18787,40105,72992,67246,137276,50802,36790,70328,138827,22466,39263,183295,29858,50975,9322,57397,10654,24364,30383,55799,41600,23584,127295,296610,129078,143558,244131,86397,36049,1085,80677,3820,108139,5476,34767,24683,7758,13060,7239,131671,250593,59556,103392,29810,4188,252323,39404,116877,7651,43600,40338,13554,157253,39196,25978,144387,61211,234,50104,6129,10449,93777,9240,356378,274148,4439,72970,3724,147770,78680,62570,115877,40027,40547,36817,224392,64609,34795,165027,67440,2477,37206,23431,50754,164797,46018,94995,170982,27051,7957,22767,3674,27900,56419,18930,60701,41302,2692,84749,339721,61996,111094,80221,50129,1045,8153,62945,19202,8250,37208,37418,32560,79477,41106,88569,33963,36693,5892,30570,1581,66471,49647,11922,160717,29442,5643,114865,82962,95982,132098,22633,22838,94726,54556,28566,205039,162340,33216,16849,35847,221339,94851,26533,71469,1805,3804,12935,45483,71020,36310,65381,192960,34240,35165,59773,1248,46954,155332,96864,4246,388800,16129,57133,74592,44807,442014,38203,42574,80818,91592,26377,36424,65760,977,77387,22628,147610,28018,30561,98454,6969,119628,63648,18170,36854,26601,64018,22027,37279,51395,152934,21153,9430,58760,194742,5330,55115,34158,28917,174111,13171,122326,1526,43896,66094,25325,4234,148354,11450,275,18999,112191,44365,22723,68409,8733,57746,96565,75007,14196,108844,29475,88599,177563,100792,106156,86323,93726,14248,135341,194131,40126,47099,14779,8272,39597,95983,171398,65882,28052,10393,47213,40689,22120,72212,106829,34964,109146,753,648,21660,30047,17527,181025,5619,145357,4085,216883,9359,186951,24779,53931,24545,36197,223296,62628,168101,4243,107313,30321,26642,13049,51059,31027,107912,807,73550,26551,84369,122422,165872,49754,74213,234264,33151,52014,33100,87183,22365,52500,40013,23302,5652,72723,21404,26107,48434,587,94049,168493,96418,32871,70860,31709,25128,443,71597,166253,15670,70994,26341,133675,28280,75491,54756,47955,56028,26182,11952,113272,472197,64640,110753,17919,337,50642,22576,142,87371,53391,93210,126694,15285,19642,85667,14148,1506,42092,52962,33243,11970,20734,135843,57044,58880,13002,219134,22876,64754,232519,4257,43120,321573,24799,64526,124728,52579,81472,70831,276848,17403,74359,23021,182101,74597,23744,148267,12055,7976,5349,11772,67540,167347,65318,18720,127832,108238,22828,90233,9987,259080,118185,73209,79270,13775,90100,137742,90799,70569,15699,19961,9087,67475,57872,39731,8810,134897,131868,146849,19898,3334,2281,167061,91073,60356,467742,74712,188,53179,137679,92769,29241,9537,132595,80119,1041,88962,5976,40171,44911,102859,139059,104558,98987,47761,19272,71472,113864,175377,73338,10857,23402,23758,1591,139864,5644,4076,118760,16427,134198,18853,20291,100849,37423,22038,36677,19071,195521,57445,11069,31869,55718,66882,148490,44,41296,75242,49704,166810,9906,20943,122258,49112,105667,15969,10344,6408,187694,21399,72742,58970,14867,14376,81889,41856,23225,15042,56993,16074,131389,74276,72407,53875,383108,53597,37363,68993,44854,122548,430927,198279,38430,80409,12245,2981,628,2818,17760,37437,238229,7968,46892,2200,3730,34190,65983,37959,112291,87850,70827,6522,20750,73913,111621,41652,19587,2780,58668,25916,85259,18200,168962,95781,42445,102050,7776,57662,103313,47742,96358,41964,66174,100396,29069,204735,19679,27978,7479,40264,22534,61183,36081,107436,58223,14680,23002,101311,24716,124108,12908,5646,31750,40380,14215,232799,102772,14122,96775,61398,50917,12096,149880,67833,598749,124194,155871,49216,790,14677,65319,56917,7440,145744,95701,12206,49405,129269,76199,45732,9767,11058,9047,210885,11051,7392,26307,2130,8132,147526,20802,232698,115660,50060,59789,57344,107623,80343,112676,23291,9866,160971,34032,118291,15719,59730,164911,28975,2659,58046,78480,21854,66209,53863,109085,116045,29021,46481,107552,22130,18764,70254,31272,11300,52460,43933,84738,20721,53869,190840,79673,105300,7561,321817,66924,13940,33281,101046,183181,32176,71878,5678,62924,79535,56646,40303,19559,27703,93042,73368,42187,3670,37376,46440,7023,36816,109628,20680,5940,276440,275233,170848,112093,136996,14984,20226,111441,77693,112960,48577,39370,55707,50314,123404,26570,54281,61372,123391,4857,35928,246740,132507,106646,44241,7196,92258,9825,37688,51197,303141,5590,15476,132986,10955,85782,34486,26696,7991,28813,18858,39546,11703,11365,38185,5716,93555,11925,40121,60002,6985,10976,171384,3887,43394,13337,56346,6381,252336,39573,75042,53711,1028,31781,44295,95925,131713,7214,68125,43571,70954,213234,1628,8760,13391,65485,17320,56038,1710,25248,60803,57399,19839,3870,326,281556,50945,72400,21460,316244,75619,56246,98775,481,13513,55765,50427,7388,123519,32929,57908,27124,61316,101097,57467,30228,48792,10788,20402,37318,50526,155730,34456,158065,145305,17832,43733,64052,4506,35072,205355,177028,184004,187081,68616,35938,83703,10367,36892,93186,260137,51934,89970,4985,23445,26755,21558,7948,78741,23376,124405,85594,68596,57536,49351,12619,56593,132668,99924,109728,71844,71935,196018,65464,17617,14987,89701,143773,33997,8687,22701,33258,2914,4436,72108,85610,9671,49067,2327,82988,1361,1672,44033,35777,30269,24057,10605,82236,616,15793,13919,47249,112086,116698,9484,80207,90574,33304,68624,93127,56101,42210,160929,4827,38995,38095,4701,125119,5027,33680,9236,231236,14135,87837,23318,70261,78893,30151,81482,14332,1084,74256,27532,46644,79185,3148,62615,6981,55672,31668,36825,1849,14536,37446,14738,23779,43058,162749,72199,1168,21346,5592,85932,85302,9668,18351,57135,150360,2080,228015,77953,34670,119302,151751,31009,106725,84265,45214,59289,74178,113071,263206,111009,4021,44449,188119,192629,123592,392506,292847,114487,12831,205858,9852,20780,79648,75767,357014,97721,18166,21005,67950,33226,204009,16536,2987,11335,66717,144910,47950,17262,55060,15063,2934,51038,26775,178497,66008,3427,49433,128592,20036,157553,63861,3089,23015,51210,28696,35933,49942,71135,231518,99620,17248,21835,176536,20676,16944,38700,165831,233253,295625,36723,13023,52745,10907,19423,67972,125868,95473,82875,1183,108455,52685,33417,64095,21433,52438,33191,127809,44505,211823,7810,2752,95548,162031,7185,91196,47563,61721,33359,17897,23682,42806,178101,22874,49707,199897,75419,82456,8618,11171,79712,116847,18783,44190,46564,5346,59046,95032,7893,14916,3214,26800,24172,121453,34362,10250,17408,18888,4840,68696,22831,13162,36005,32512,14800,62357,41723,45046,27247,37486,5372,2564,34261,298500,66509,133920,89138,31305,117697,19097,108304,81386,84106,23802,46411,63304,946,51417,41777,41041,19501,115864,60743,294354,37955,94165,18116,1156,17937,20645,57114,90804,58042,48643,92288,9861,2557,88546,61333,101008,12853,5148,87856,4152,144503,73841,18718,9789,147565,10846,42085,12789,30223,8993,56352,67203,2448,28215,6052,23540,126319,75933,36689,80235,23231,23561,21383,38800,77548,102798,21234,31468,158608,46188,63960,191679,8051,67014,11185,170078,42186,28827,34777,41930,212079,12421,34750,24111,110344,73918,45171,70826,141949,40063,23979,24254,37309,26724,27179,24718,83648,54938,14591,17425,29525,102675,48975,48654,12316,8929,60640,41709,50168,63264,89812,50716,48632,38755,138583,160123,55579,71829,24230,233277,46322,39650,166388,34718,24108,98252,7031,106695,62498,18258,35062,217827,78731,34824,33354,19520,60852,2432,60224,8587,2836,62955,702,20227,42285,40560,95592,62486,11094,53035,143291,18842,46177,77994,1770,9657,107422,172915,32655,128716,25886,25164,156740,119928,165875,85817,11007,89110,33956,12652,65156,180266,8494,36889,19958,20955,96,1264,118288,135769,44754,86671,5632,19026,168220,289120,33569,93821,66144,70635,7687,5642,2714,55445,56636,71545,184182,93133,7332,37389,12643,52315,22729,11014,158742,17050,152889,50178,34601,41945,52136,9948,26914,63548,95721,115951,40759,8960,158258,38938,49232,48325,42234,81523,253019,66128,40978,20048,238048,38760,62928,122560,118532,43687,137472,163689,26680,9878,17448,51035,16211,60834,36749,29178,14241,59868,150086,2305,26477,42422,34342,165341,83279,33894,14257,29928,12743,13957,125571,89134,66712,10952,16507,147839,30146,7249,16565,45399,39874,114565,215780,31990,230881,171477,102,196546,44538,10880,84948,281705,86651,10617,31395,2342,453658,43569,60561,132901,21845,17727,58556,258242,22262,58728,4008,77997,11806,37431,30599,81375,109137,185787,114085,217292,97453,169085,30593,60212,11544,102056,65580,2384,91655,4855,95725,7295,157994,16228,20669,53276,141590,105246,17334,25440,76067,17967,39321,38911,11362,28559,63807,21627,26468,85816,40120,1025,15234,58319,69516,66512,124548,75845,78873,22137,46681,51242,85683,32909,76747,35555,43396,101465,1765,73094,1077,2962,39028,66777,57831,42048,15828,13962,36041,63657,52412,5242,58846,2141,5506,219012,134451,3936,182230,17558,17153,152237,22621,49377,170216,35257,68233,65374,6510,11126,212151,7184,2480,22517,3437,33073,30156,16557,3768,55067,86829,91e3,12350,148650,66017,79424,70885,49066,28250,21369,51213,34533,11510,3258,18176,18465,84413,6315,36411,163765,4346,356,107618,598,13727,285026,162695,8749,14583,7132,63521,184253,32378,25991,5604,30961,53675,4874,84693,5086,34811,26978,56564,7904,33519,51221,113942,69253,6664,125563,22055,220680,102008,742,51930,19494,176108,44424,35123,13025,75685,11759,74335,22250,181453,131147,16984,132115,154311,11991,76452,52609,85351,196,30969,9198,74919,2529,56838,71779,29187,116304,3504,62330,41190,86153,28393,254926,104228,105189,13264,84359,3574,12415,8534,57147,10175,188174,59504,60932,66318,16407,107921,17638,99103,49278,28403,39786,145865,8462,3558,43406,142271,29139,21989,36552,93955,72365,7176,13556,106185,37957,321774,17782,129017,51154,27938,24952,1935,39366,2791,33489,41582,56078,24558,9311,5449,218786,27808,190429,68013,36020,86003,29735,3404,87348,119357,115714,2324,86796,81973,40992,43376,93621,28784,16808,36367,2517,2909,191926,24978,55303,53308,205724,60068,3098,21375,64784,23949,26579,63121,12319,80145,39967,97861,6757,70143,67642,37082,34698,69140,122883,46151,62187,80934,429,19437,135071,137885,222647,13331,154065,327,61778,74257,40116,37493,14855,85079,237641,42342,102164,199965,71204,4662,29368,5042,113914,122214,8955,13149,102503,43173,5659,163787,69003,307084,63392,171080,21390,81918,86666,36622,24126,28887,5736,28054,207170,163428,79891,346467,95363,38980,111806,80828,9200,19288,294896,114468,87405,111715,141705,7015,72754,68463,48738,243147,33397,101210,37051,98801,82847,20397,4940,185559,18716,54718,83491,11725,40803,1128,12128,23060,5174,7745,67007,46701,1571,27807,180186,256996,18975,16837,7877,212758,250379,15440,87954,57755,24719,124057,83461,258,50864,8874,29038,71289,31627,15429,9005,4061,113851,107716,82819,13651,79656,117851,17539,111446,12938,39724,190787,4352,15402,21070,62708,8539,23777,73853,13552,38810,86117,16285,56400,1718,75342,142863,29033,378,110113,180321,32586,23606,26393,160984,207987,23783,8406,16904,24596,47274,11693,46539,60524,78595,48423,31718,20170,9009,146268,15183,191060,172765,1349,138436,37365,10970,40509,225817,20021,70394,152138,21541,66559,66544,89352,2725,17258,91345,7313,3815,115868,8660,40362,4071,103524,39388,118275,21950,6549,38226,32754,209574,29201,43495,18028,20296,40597,18370,47520,202450,24134,2219,8195,69545,38041,136934,46374,19041,159811,84865,58620,846,98749,13569,30714,97246,32186,4479,27355,92973,35214,151491,75963,37631,1561,27200,238083,23182,60756,12291,25766,39355,102333,87362,65741,59906,19538,201575,48772,102938,24438,292580,39964,66366,9004,61379,50548,37622,38732,28379,68180,76622,17488,69849,5963,7219,48143,43413,55358,540,58691,29506,19245,52193,48621,5518,13048,118625,44755,191081,42061,89197,2259,60665,66994,71210,51232,3585,142096,55024,7892,8345,58653,463307,65658,64319,137941,136323,53499,12746,43492,6978,95163,29925,60175,5128,7352,41463,184756,121146,20473,18426,4598,5309,54580,14277,121151,10691,56711,43880,63409,76682,11830,172218,264898,32632,66536,81062,31649,25788,92774,60222,11100,63159,9432,224657,25240,53613,152,138620,163829,2397,85345,12501,37507,64932,38575,43522,65789,80198,78796,35226,3851,108891,73311,3060,28391,93671,39663,46142,30982,66041,37281,68157,26553,71872,81142,211527,39747,118119,22695,2859,11066,20232,168911,7933,197005,17066,111071,44434,133994,120798,12766,227798,45756,132852,29917,36076,55352,65281,129800,41958,18944,84678,18580,168093,132621,39997,54092,27740,32354,3770,114118,103242,43918,15899,18574,145944,3190,123469,219903,24169,100571,62403,16776,92779,14535,17168,16475,14304,37231,1712,28218,242754,61688,28980,1318,51359,222657,99200,67989,31772,23932,35351,201251,49041,27306,19128,40135,3986,77333,19649,120683,151927,21081,7076,78375,77501,101599,8011,89585,96715,58179,5378,102138,106793,26051,217276,4197,16297,27014,46721,13322,22806,5278,29629,70632,9647,71519,58818,40603,128530,8903,36770,56900,31483,26935,43845,34265,34920,87658,6114,84767,64250,47318,50720,19264,162514,33357,13117,6705,46696,75032,71054,87004,42035,69138,11903,99854,102328,19611,34525,69312,6431,49842,101600,133178,108751,41829,89939,225664,48916,99556,9195,130387,5960,36857,116724,53518,94002,39077,53996,6945,22261,64291,8314,152785,57588,16522,9091,5048,87671,35441,39509,1945,12423,158923,178413,37549,14095,1475,73188,62878,4819,24012,68534,42606,4010,120809,57497,59564,101758,103718,32701,80116,12345,95834,46918,21468,53213,15665,31200,3867,5140,96013,250744,21016,10069,13968,35449,180829,27683,39704,59956,22893,3115,26293,32785,75934,62445,141162,62720,2018,83638,19949,114012,95006,3330,99829,130935,309272,9565,55874,121727,37017,23586,319858,40970,27602,8625,112329,61060,100088,118525,25922,16232,1907,60671,51583,44553,80993,5262,94679,8676,940,20736,11823,3020,16476,12340,152600,97416,3703,25744,66826,16245,16876,46446,84798,74227,176020,45192,61955,75496,23946,23626,40372,26036,6149,11822,30582,16541,41914,82385,232823,40921,80773,14930,3631,7517,39619,4348,36180,126106,138939,62611,1477,113512,47321,25052,14546,118881,29060,23589,128322,36795,18401,137921,104699,267929,36194,172791,18113,4766,188215,30083,332586,94089,5805,77909,22194,68234,154976,43220,40660,70001,184893,138095,11128,103010,22663,5108,212615,8485,5565,49222,54614,26530,42639,16319,55062,152662,105595,21114,22216,10294,68158,10436,86950,7206,62115,3977,3657,59874,456,118617,18156,106663,112229,80992,17442,8217,55551,5133,34344,251927,51153,39364,201321,7816,66803,23057,156724,145664,14276,95705,979,2796,6875,13429,212525,50602,26276,28284,3424,19465,52397,46963,31420,51399,206476,92317,48851,637,100820,83349,10317,60227,21972,6908,282439,32857,224767,95629,83882,42106,87338,69757,29840,68709,37665,45244,114577,49188,175943,54009,186746,106158,70168,3358,234002,50555,9221,129338,9562,20118,32923,78479,118280,65752,4977,10474,102174,60947,129006,10570,83451,8598,8078,159367,123785,80438,16742,5905,5281,181513,42402,6977,163136,93179,42191,14968,50421,112401,105440,33456,57347,121611,4221,94954,36517,24046,27796,6255,33394,72990,135408,116627,1233,57874,25654,95419,68156,401399,313338,55208,45573,93124,119251,47200,38196,11909,130667,45391,73904,64964,167846,4137,115606,52036,62214,7969,160925,7187,1132,134835,40309,73195,64494,80472,444841,61111,26500,45323,40743,53625,52797,22659,15631,29739,36706,28841,39147,102836,26794,10536,14845,87305,45874,12241,127587,83833,57183,79722,30844,41304,84655,20825,92500,3722,25655,27811,10157,81634,31362,34088,92487,70123,22190,185100,72658,139035,192523,88241,2078,230490,44528,85638,100198,22088,29982,291233,241062,13865,4445,137791,37835,107218,31726,19718,38234,72528,23046,19177,66695,5109,17251,28077,5617,21554,47839,72425,133825,1486,73065,181275,141508,21768,62971,63082,2512,34200,9904,120309,6392,91243,68416,268253,41199,116757,138551,185526,41246,28986,4093,19057,17295,4148,245766,122360,35356,112075,20301,75441,10998,7977,19769,62922,937,63547,100196,26427,157820,20983,236696,22935,8140,90315,156004,47204,140973,7726,45097,52725,22636,23436,257282,105247,522,88389,216031,202204,46812,211666,19693,68828,81691,45925,11256,30292,372,5236,167826,88328,232776,151611,5360,82104,18841,80393,25465,18285,20320,72377,31730,33160,45803,38715,27705,37379,24163,18360,103586,4015,32305,269494,91252,20080,36567,54650,7797,57073,12650,31164,42209,6375,261663,105528,81661,106002,2800,5375,17247,43151,4442,15727,194619,100855,144898,62320,78465,39929,16454,1967,28311,61363,17219,9395,8745,121445,76939,80385,162380,22009,54191,44248,16299,122830,48151,74429,78291,64755,14238,44966,2511,17712,67954,93583,829,105899,49935,84750,11591,33185,85447,42717,27409,208542,28965,62052,52525,5597,25694,65594,16343,63224,276188,12475,9331,127507,38522,57287,24128,133161,79723,105548,133695,48917,27558,43278,46520,13778,141954,110785,83366,17715,46317,105763,66298,147013,41086,94180,16478,220447,44611,730,19722,78975,117889,125643,26254,16574,18480,65006,15806,38549,246418,46052,36056,8440,34984,30170,3163,59800,4458,115442,4283,41970,33507,104078,1653,22,121158,276486,3655,6338,24048,133421,23641,2161,24422,36006,8086,10675,181474,12307,29514,59143,14729,52509,87128,122470,19446,80852,33314,24573,119864,14237,9652,57779,6612,51851,15284,98871,90581,124466,156831,21190,22015,71380,161906,87247,69201,18392,17908,108470,72962,40719,14338,17911,95260,43339,20610,78916,20710,72451,11315,31448,17263,58853,178878,48111,116002,45497,80506,82605,85880,36300,121755,25215,36118,301929,88728,405223,276136,553,34704,212438,49970,78329,922,20711,25036,257130,38295,145369,18128,15385,30829,55656,48345,8012,3561,28004,122041,192900,58338,112508,41085,29976,87040,47117,23905,4336,92061,138880,97407,42083,172121,6256,25192,172671,5,93568,1420,12677,31605,56743,40620,6015,78415,231077,31298,80026,13902,19048,24924,170586,32955,176119,87859,36731,6773,27711,24658,26475,115216,133207,93250,95820,88522,8317,5714,124047,55219,86860,19677,23961,22928,162209,8904,225992,359835,56084,96201,29392,96558,86071,93643,55114,13347,8183,95129,82012,2017,123336,34219,115554,157159,47747,101684,41008,18735,193781,104151,226906,7552,179874,124113,31159,21162,44010,14771,51268,166128,31382,73124,77438,92830,205709,12113,1292,38937,13114,1334,2118,15597,69581,14449,21934,76618,48728,67038,14967,51495,24243,87736,147249,26720,11119,46063,43749,5843,44147,152629,133428,65703,14269,45604,57982,28672,55616,45957,8438,95433,37698,220862,132034,39456,61870,4161,26501,73560,56418,9845,4654,20916,10456,88920,119358,9015,65931,96507,48029,38534,21676,109081,43078,34943,25089,6131,28766,23665,5477,10255,16695,67,45778,42443,42770,29534,23733,100513,62617,42630,48746,14191,43753,50295,26007,8792,57243,43119,54725,164253,58250,112304,131796,25165,4651,3188,24831,47748,3705,19540,13211,102095,5593,18699,23666,32005,117571,33541,60584,74573,86311,99443,25172,27222,168938,7143,11853,53560,18834,19960,86522,28217,53266,117700,72989,34323,18721,66450,34346,74056,47217,202002,46269,9429,68582,75458,37823,82843,96652,32549,145144,27958,19820,158086,31955,201406,135379,31207,192545,12950,51704,9094,248263,76147,64028,110009,79407,89345,99284,223492,47966,26848,15359,201137,2861,110507,71231,72297,31851,118777,71039,151051,240855,16333,50766,14727,7939,4149,80908,418780,88378,59276,1327,7284,38576,79814,65820,42199,84860,49574,62596,12396,70598,40117,8648,7994,16836,7630,14047,359699,106878,525,29037,28064,13380,11675,50669,74216,103539,180314,27449,56299,172344,19274,7301,246099,32043,19422,36506,129317,6806,30140,4614,46639,66926,932,86600,6322,27847,233103,10541,39025,34887,3517,12972,26220,2031,66561,115015,48658,47596,12714,33845,3893,16165,35237,89983,14769,11962,147224,47018,29977,27979,5552,82338,86023,131368,1218,24853,237840,132193,15455,40873,3668,65351,53388,15229,59889,272245,47934,11858,34347,18038,90853,86981,300602,19343,114181,29362,84921,6095,106059,79472,38015,1206,48741,6208,8e4,21916,17423,6002,108083,24479,34931,56661,9511,26995,100694,163853,35997,81254,58321,18919,171890,86877,91341,74503,70477,53412,7027,59281,39892,131302,5864,15947,61301,67466,162369,47956,27874,35624,282324,21270,111847,102548,41482,30955,116737,28264,8592,55458,22301,75090,29821,30697,51709,3041,19208,8038,24634,30467,87509,126428,19389,18814,152686,20701,83474,45832,80891,105808,11378,153223,120770,98186,150633,49838,9141,12755,30962,5260,74490,21256,31678,65062,33326,289838,187831,20595,89768,2805,58535,10844,70085,12090,2451,138068,98544,24461,4511,6754,41684,28203,3383,65355,82833,30161,83924,234361,128424,28921,222594,33975,125491,34069,11508,67464,144226,41850,98703,34371,7901,21254,38398,65651,23549,53883,213340,123269,12028,71764,177701,28758,2623,68395,11549,15232,68603,9660,63116,36079,57093,31198,20475,48467,89984,35619,186847,107469,31389,43631,73867,41949,68841,114250,1605,30564,63403,17588,27680,99533,12641,70325,50428,73426,78379,11855,91651,72081,91720,60198,15743,12065,83398,140046,6761,46598,45900,5068,886,62448,148968,37347,19405,9680,15819,43496,63370,75667,163700,37639,3633,22774,34341,183131,134335,37200,23915,7054,14194,12970,26438,13350,285521,25594,8219,104410,91039,168804,138480,149734,15907,33818,61132,60082,4622,110187,56736,13551,73571,3945,73463,65498,17758,263266,17593,2710,27585,54469,38200,45367,63754,28881,3473,12791,98287,31895,65787,4463,94536,24951,36332,59901,28803,52130,86403,7668,181822,74831,18977,9850,177206,145485,109798,7292,31421,26280,77211,58511,12507,127004,11113,147,8729,56208,43066,79926,129937,31345,83947,39915,46146,98763,42566,1337,13192,18323,105163,80570,117753,16555,72883,11077,159438,40764,70933,83329,26066,12276,72059,21655,173836,126713,69454,153482,91585,70644,102558,110483,6764,127864,190133,3961,101798,20945,71138,82402,90884,69669,44753,923,16939,59700,164258,25969,27082,31399,43846,6306,246093,51342,6153,151581,202801,182731,56475,162188,89426,141356,14355,121815,27536,28023,65257,77523,106668,127314,24947,12790,38796,169698,23555,10725,44573,183083,42088,62716,43265,105958,32050,44067,50118,1668,3874,6243,318411,16599,1691,94999,52378,28671,216728,123258,2059,34969,69225,5913,136280,171443,141515,91662,22175,135282,80020,92270,1663,4808,4482,3495,34691,5226,109830,108512,17342,107488,11606,123190,100247,29666,146527,113014,15794,30894,13224,39585,243192,22351,9903,7836,47699,11078,25468,122291,48821,26780,122679,75521,81450,630,4895,92900,55074,74293,17441,3563,111657,103102,51613,12318,52370,36191,68245,34269,40445,41354,122901,168604,182500,62012,42557,11259,24428,115113,86345,12362,3909,78430,86852,134602,20459,47853,93879,22577,7659,3688,38555,13349,17381,56715,91639,12493,10895,92438,3142,37057,28928,2004,36427,32268,34222,209974,10432,67436,41989,173518,107930,27079,62729,30908,55558,5828,45031,14902,53546,8204,144263,60255,14520,88212,86582,109589,69356,8064,47449,8505,66558,16886,4844,52817,111260,215129,12941,91118,650,20770,6273,73089,40618,62790,2873,35002,14023,97208,19386,102646,36993,143736,135457,35385,113601,17893,32627,84439,100619,56016,6581,57264,172160,45452,111710,203627,70131,24100,322787,1996,35665,70078,22358,90922,83658,4097,63200,58499,14542,99153,52159,6615,12414,63415,31986,16823,1579,65405,137809,8841,16898,48082,259,33014,42375,12260,179850,73667,91389,98882,29532,17311,326251,41092,5928,20742,44964,48019,43505,9317,49265,6643,192712,48424,163487,19861,20113,70848,31928,105333,23685,78563,14638,54755,7158,24142,44018,20774,125255,20331,24280,10163,1285,2336,39851,4299,117269,46714,63816,87779,159624,11731,9971,990,137317,108831,50994,74554,162680,23640,131597,146962,170620,34829,91205,21184,1913,63616,18427,93136,156592,17519,67565,115882,138220,78622,88535,18115,2711,33554,109492,54298,971,24914,25863,36363,45715,27099,194995,14299,178181,111488,72395,322385,157719,130787,11897,81843,83999,11369,49280,118604,40922,61332,110343,53407,75639,40582,300440,54722,25637,13694,48248,48278,194521,56203,52779,48783,72627,10953,376,16733,280238,26351,230789,15132,25168,137270,3588,63704,73376,94031,74284,19443,159557,9697,39901,13351,119050,15406,146455,3460,29556,75195,37673,102524,92329,47289,98413,15311,100684,56345,7116,95480,11590,7200,167,23610,58426,17730,136656,27944,53151,2701,8824,103124,3017,90744,113588,53216,79736,65940,26931,498,29568,80540,143543,21292,1740,59268,16561,180816,42323,50174,40890,52866,10703,57169,4700,17191,4424,93511,49698,166650,26972,48631,165169,82879,69326,202970,4007,2376,231325,139592,22119,62851,37504,68816,58345,67398,186643,43331,277416,53749,15746,23102,17432,4793,151138,48822,54265,48203,198688,14305,54287,2291,18018,113378,123260,7180,97549,87027,120085,2920,76080,8190,102005,5641,64580,14955,59802,54028,58884,19367,81779,412567,85957,97053,103637,78871,29364,27637,141728,4767,30686,112738,130146,42745,12730,105040,14844,232,210944,36581,152317,135543,29744,3129,55647,58149,46319,27265,17499,28005,59948,7170,34138,5702,293047,110892,408,91760,218674,18469,46095,81403,14389,4610,35672,73060,11006,74848,104820,118143,190357,20043,105358,141735,5115,27093,45924,123073,52599,29433,9616,238350,78610,24851,58858,26769,31969,24613,18294,4982,32735,39639,143563,112073,202205,12567,4873,88601,44897,81503,101648,81362,34662,85277,17574,48173,21435,221188,40215,39576,80786,26544,64668,81841,10731,37733,247986,149188,127703,495,18382,54388,72446,43071,30974,198723,89608,41360,190,33045,8386,31658,19992,237838,119015,137622,50890,100913,6460,116233,267230,26621,104129,65114,14190,41542,14888,85962,23342,23041,26453,43725,71809,45186,4770,46452,53894,56616,221286,18973,9038,109299,55365,19366,26863,18808,60909,69353,41738,83463,12100,68561,72860,3980,13796,49340,12332,31311,27418,4255,53430,18976,45523,510,14224,30477,26581,4530,3651,101663,139840,22709,150861,31996,63923,120623,262522,3076,10528,2929,14672,130238,18087,9816,121894,100308,25085,55111,14565,18952,53293,2042,369988,23674,61789,133529,28783,108293,35477,47119,36448,71049,40015,33055,78598,198442,1833,159937,40654,77444,189245,113153,8621,18599,38553,35223,166072,2375,11659,21786,89523,6032,12116,63046,159398,18454,3678,32521,47626,11411,103527,38896,42946,15696,26370,10185,8413,37080,165583,4331,63555,14907,72220,50056,6623,62236,36565,49783,10049,17503,100581,55951,146244,24724,9626,17969,25524,109300,173965,99994,101056,46459,43647,53737,277968,8347,123521,74858,33829,44762,77574,877,81377,222525,123532,30602,43881,53145,2973,16284,81940,61281,127044,63620,9875,14756,114829,19032,9202,52759,119141,23928,120551,19607,3599,33401,76821,73233,117430,39968,36539,7071,5446,121735,194059,15206,45283,6706,15603,65615,1207,165723,92275,34773,104447,8396,32353,205240,164323,13600,60555,79205,25532,22907,33410,57480,107111,69630,32137,47832,70913,33161,20321,2371,117348,10714,86246,1625,11763,17900,268,78457,99175,97940,101092,86660,32221,14041,128504,125080,53744,124263,31017,13897,403,31859,21964,5633,111630,5547,77329,17961,18241,84995,25984,12983,67491,62168,47262,5241,297,51191,7351,8967,147212,82060,16821,782,11033,82431,62957,5026,43459,77963,203477,53528,6247,191852,87774,74164,215654,13467,1522,219964,28589,244104,16242,117821,67725,72570,156792,17186,15979,26990,44128,193014,35276,57125,16212,166451,68017,6905,77608,16364,53777,75921,76426,37975,26203,269296,64099,84122,12077,38533,830,4407,20139,963,43028,38902,42911,37503,83343,85045,16979,1165,60835,137387,58380,86990,110066,134540,56331,193845,81238,17922,163093,38744,110641,12502,56404,34862,26865,125964,12965,111648,25547,7771,27196,136980,9555,29551,107158,57885,18831,37705,35505,101742,13970,102109,62548,124657,23328,11124,89592,146376,248050,6241,22033,18337,80685,29898,11908,216623,67721,106162,146610,21377,15085,91552,42041,62560,122532,125336,102365,121537,142559,29693,223919,11515,110495,18776,22494,5895,185059,103592,229351,51220,100102,37027,257855,29359,54123,36066,106493,12244,79258,32002,432,56205,94836,90182,6726,14762,29391,48938,26864,38083,60364,3310,60192,14766,205567,57504,110760,22649,24666,46333,21517,3430,13135,28873,27052,158809,11597,20529,6695,23138,22960,37137,45574,6545,305877,43423,26153,24769,59844,14501,10430,134352,56169,13213,103432,49523,35181,13435,12408,129475,64620,230854,77390,51990,15653,83248,33466,44571,117828,51481,2187,10559,68019,18021,54895,48247,18354,33737,4554,108595,37288,39767,116707,9175,3726,108877,21616,83684,49862,1938,8543,276466,20134,108498,48770,102254,31914,131520,185291,100559,51890,209,19526,76471,50544,71814,99351,8172,198526,28816,20419,9109,98389,136777,76479,75596,30635,165417,48216,120220,25955,211071,39314,24308,32164,2559,146280,43403,9233,17947,90585,1786,86920,125662,2457,64741,32152,32918,122882,78538,44001,31723,56426,23375,103172,88177,145697,52506,49319,68016,31664,41488,18486,110400,7030,28241,986,109199,19900,42147,56864,65287,49183,7858,24e3,30453,840,16673,25907,68916,89927,6309,158335,36407,199737,130464,13137,59603,201778,195292,21015,42466,179062,172561,89492,11075,180407,31868,72493,20998,60217,9865,19530,39274,130266,54539,21623,12535,13505,40641,73375,4087,85633,2153,3117,70680,55788,92096,47509,98493,37490,271936,151475,3032,16171,96642,34106,78425,125761,19591,3366,19316,54508,24183,50786,194248,91528,33253,34622,108355,41741,705,3814,3883,108929,13203,67831,10142,59754,68208,29128,84820,56880,38794,24972,48571,40821,40476,18137,164254,24064,236309,79181,11282,395,39169,2013,51587,28551,9645,701,109513,115899,113566,12762,62045,58322,103726,41343,40866,244102,143816,2490,70346,40973,52618,15412,30720,104315,38917,42027,93676,17513,107418,20706,123890,13399,97727,24044,87962,65606,44250,98044,65276,74790,101473,19350,91570,1326,87790,172042,7577,100813,86896,85891,41512,108130,27794,14875,71431,12835,156250,58135,3759,22476,42176,115873,34686,56523,73643,108505,51491,20838,12721,32863,45700,29496,13700,34294,55360,29206,155942,123812,7706,163234,203,132720,49358,144431,8130,175788,35818,3270,76832,25710,54095,97274,28779,94621,74396,19092,128242,58067,20885,14670,93255,15107,63291,23654,126900,129421,59294,262659,9798,3251,67344,28600,44629,50672,29072,26999,31526,23183,49175,165843,175455,17282,175411,32022,45989,30298,90690,78118,83156,23749,35636,31317,7069,80381,94561,133756,14960,97404,6138,41065,78041,32843,16601,34123,9559,146529,123377,96395,54441,42012,84257,123541,10745,22139,106459,11720,150883,172651,154996,110538,4728,53447,25704,2009,71152,119354,21166,66604,1429,216162,8637,122250,63520,27180,29172,36124,276428,107787,77184,4680,14952,104903,24418,14793,51561,52931,8371,26342,48526,7118,92066,67280,40653,8847,34597,105438,14198,50163,61188,146286,50315,41205,170829,161496,585,197359,95056,1687,365794,91349,48507,5804,49263,5146,104902,96365,117343,132222,46084,96919,16875,8073,262381,79982,52663,13928,16056,153908,15145,109256,132308,18763,24904,167644,13618,40750,18686,147124,114709,150038,52849,2938,12568,48617,8778,5459,44202,44591,74914,17183,248689,13878,7822,80060,23116,194037,18487,2067,7798,43077,33678,244028,31320,74273,2794,19466,8218,36280,183997,48124,19416,29656,19280,98734,7715,18311,30701,133602,150307,126956,7378,2933,79903,13178,12593,86571,26604,92446,13574,44205,65699,427599,21118,8245,14407,27877,47936,33542,7916,26460,117762,21596,37818,2249,127359,209394,60044,47677,308089,36791,154971,31417,6998,150042,174360,12255,43009,29335,48739,3912,101398,53340,2580,146939,151295,45360,125275,15273,45383,27456,48761,23314,8750,60801,85823,104759,27894,123685,66968,39480,26917,55290,83305,2696,98390,57569,145853,340733,4919,20024,52268,30884,7413,203685,70989,112855,4129,50536,349518,68205,332641,159581,135361,236026,37563,176404,64899,6578,122033,63871,1850,85234,82089,66124,74145,121098,107351,12687,36881,117334,13136,14698,85933,93866,18047,32620,310,15094,46e3,88451,23632,36645,27940,87618,80520,58892,20976,27702,140090,96075,67841,103292,238964,87778,107338,17019,83427,67522,7302,8261,47570,116787,8730,80484,61772,174422,56005,131193,52875,14588,28471,59817,9586,15720,158155,51307,109734,15196,11025,59331,3884,52626,102602,84797,25158,27314,4437,20488,76214,189248,35023,114952,157376,2827,62439,102878,129749,36405,10329,109339,108633,36662,1254,13267,5470,87105,58004,15397,10434,159667,21864,52022,179464,3013,32147,31496,116832,18494,105502,129227,107267,50033,13481,9954,24267,22141,16257,116154,36185,950,115685,11305,176708,2048,178671,112573,287867,162328,497663,95170,50979,193861,50987,30368,136257,31830,46549,15119,169876,23788,17462,249887,57377,1949,35448,14791,43769,210091,3783,34612,282103,88380,245190,5457,20491,98908,11402,86899,117916,16028,162584,60644,320177,156096,31065,55876,22e3,77655,9992,23397,13757,317623,63978,215255,2443,17648,93231,27388,104529,93807,55505,140477,12046,112040,70887,40152,94365,112353,25063,114679,266061,71248,119555,15589,2244,617,14129,211431,70110,100652,7777,4383,85911,89221,21010,120615,58357,86405,37554,41647,18,15143,69662,60491,14714,186134,148344,42347,5410,168175,44535,42449,343894,129417,99682,20659,27272,140483,63455,222159,17536,13722,42637,62324,11976,114691,148109,2283,32057,182393,4295,147364,33705,2075,44303,30274,28331,63740,69740,29148,10346,44862,33716,73937,153333,12930,38784,247159,2515,41053,20256,83368,256189,54639,115240,5096,24661,175419,153552,26516,141,138176,63885,34115,47222,55709,2765,28479,38875,236608,12229,22921,77291,54426,45388,2860,57787,114579,295139,105782,17826,71066,19119,54364,69385,16568,12323,28057,33346,34919,124763,155533,101386,31644,8627,49001,303600,29868,63213,9103,77280,71333,9696,138789,37059,24823,5057,21352,32368,114208,56803,19424,10445,58514,8661,209508,26187,171838,10460,63454,14016,122504,41328,21329,46618,32493,38225,7855,31763,7945,29876,8734,6438,24205,97490,139977,130740,47323,33195,85390,57194,13813,60600,21313,96251,7699,27584,170521,139271,1363,4402,336738,129223,84983,69150,13147,3590,163929,207225,155260,55916,20288,4503,8398,98490,11773,27512,37113,84976,86558,28365,11756,116005,182148,13733,115313,47644,67208,85069,9347,14995,226141,14704,101835,41159,35314,13113,63526,214039,29978,50446,83339,17440,129441,72522,118641,97816,24907,73844,15717,118884,167255,96509,162793,30847,36849,51297,78974,77793,10427,1873,2972,9999,35074,28190,64297,146836,46298,60038,163007,108919,61219,2403,75022,127339,4233,110389,69022,9833,128097,88016,79390,222936,22570,94657,28462,56956,38803,81536,30474,152794,19566,16481,147408,74574,81895,20731,1918,1366,76367,187321,54494,24366,21690,61696,33283,107477,77499,31112,414383,74362,18463,218441,120929,59848,258629,201924,69269,454,19989,13054,59894,3623,58908,20681,35723,78523,102680,38988,184112,108087,50944,132704,52966,21699,18860,96349,201411,82697,85395,95658,5093,6427,177894,44191,32755,26961,155739,6249,31310,81030,26574,84311,120155,86730,113535,7424,48888,13516,45747,98098,20077,183995,81945,43210,26704,40420,75831,45648,11180,6855,57927,65528,124096,34851,2598,156633,107572,127352,38169,123845,60142,62722,105584,232364,23211,68120,1601,22169,89299,747,258039,80572,7258,152249,11862,101204,8834,121434,33761,19175,133142,46343,40178,48723,3589,41977,30210,38868,62257,10087,82658,87827,90646,16415,47552,351723,28298,72225,91146,272760,1701,11295,1652,109651,300747,51863,198800,29446,11794,32345,37538,22356,33102,37590,113544,37970,11478,179743,25454,103417,59905,221970,105196,145604,7817,164809,102360,16974,75840,255333,56902,6659,1954,645,59400,67769,7689,18675,5215,13793,20536,27852,3387,29523,259718,16860,94625,43143,29245,15848,233581,22685,63631,78557,22836,133302,84513,1348,51826,47129,98836,58284,1830,1749,94642,10933,6145,12506,10975,13879,103781,144434,10268,28409,32346,52968,121567,107374,77268,23686,35097,10501,155275,15303,47136,21102,168741,55332,90385,15996,84817,681,137803,25054,142275,6163,38175,8056,124296,240642,65621,4934,178205,16101,62803,60964,18230,100622,76465,44689,14545,9543,47514,16852,93380,28048,12047,107106,37575,101485,77047,57326,34819,96137,76916,6469,46264,115983,75768,87668,69942,13027,165,8373,114231,26434,52844,42799,182044,23580,146254,38081,43236,33883,146220,382894,14606,46035,36481,166621,35417,95382,2957,59384,60428,36358,66343,75378,22267,22950,83528,17577,56474,25285,4619,179691,75355,95836,53295,34588,171410,4487,14679,84208,44015,18562,109133,54101,11531,86052,174479,303157,28095,9953,35642,14564,39802,16145,77606,117406,53038,121117,53624,22062,1212,7632,127157,237292,189087,10478,127345,102515,181997,86752,87623,10966,121602,68783,68681,83042,114380,138349,191305,67176,50085,39016,1427,42384,1412,67118,122616,72389,25260,2237,13576,137346,19938,20304,2191,68759,5373,61364,238507,75814,23931,69565,38993,131741,38364,12528,87762,5679,129853,5310,186831,32653,90338,260176,389531,108118,26843,43985,50175,30563,25106,56965,18130,140428,4542,165503,117991,24219,229605,1819,129663,1240,3797,76093,18398,71339,51919,93043,27175,47060,216257,6483,35051,1217,16512,80798,129064,13225,69339,8548,237079,72298,2575,34280,51379,117910,55671,53345,247552,29486,39328,140821,34681,57045,60177,5004,90269,78522,2479,322607,48474,61296,13057,31558,4678,59271,6699,27044,31988,35944,12503,83480,4389,136508,3781,114121,70279,4488,155829,42214,2898,68191,75695,305850,45041,74344,106509,30087,17429,93292,12477,290,23080,114802,35714,18751,26554,105424,17775,2144,2412,100610,65192,113975,52975,180272,135050,129815,76238,106483,21440,63186,4260,46189,9711,28249,4169,23429,23390,8324,141585,63809,67668,38457,38063,39226,59972,1189,203916,62368,14403,16949,61767,85801,1739,40147,35049,76757,33124,62102,15780,103593,103009,53484,22952,67973,114645,6566,5245,50462,7601,8288,3513,194571,80276,1908,54592,5124,58571,2513,6800,273997,193904,1119,17991,117245,2508,129156,82366,26278,71465,63341,56943,39662,106116,94966,156875,9736,2204,122308,94418,27134,1280,24539,49022,45314,3764,50904,46424,30699,28087,293839,9400,33646,40165,822,147499,50263,116179,29085,11863,31314,5578,17797,5104,12454,1604,15342,219206,10232,67800,94261,25872,13565,90339,78971,75377,26649,41184,47695,11514,35369,20767,14227,41953,309396,148270,147938,33074,14453,27499,109019,39018,25738,240196,158931,52820,8612,95853,21524,137010,84901,70869,70021,116794,48404,38771,6732,1070,70990,187297,49140,5238,576,3564,253975,16027,16483,2811,37775,19034,25259,4053,2e3,70083,95774,19713,33431,92703,91314,42381,288770,48194,95985,3991,77418,13406,241328,245086,56533,35275,62725,9246,51924,70181,95331,16163,31410,79016,39312,120878,119371,275987,80124,27712,9186,220,23598,146167,85209,68238,282190,57048,31273,30555,80913,17594,75779,59160,135002,101219,189377,29225,96735,60126,62522,104e3,27620,86814,17240,147533,11001,5425,43682,410,49460,87270,69480,46315,59448,1816,76201,9431,11788,87960,29063,65539,47347,11678,33846,7008,196704,9895,6753,8633,120892,59970,572824,115934,6646,202559,892,48351,37611,251282,57823,67263,57750,26527,34485,90747,7685,88370,6144,64182,1709,41969,21458,62327,181657,49247,225330,122600,114574,107124,85361,111833,63243,71420,15655,191178,72430,18063,51425,54002,12364,53225,86557,18193,97580,41232,138398,67821,128724,8944,233212,101353,52099,42127,14006,120107,32789,32132,3498,18123,33758,56058,5779,128760,59888,98869,18445,84702,51911,13234,218379,20093,39031,8074,70195,20708,23462,24355,131384,60189,26390,10403,41060,7140,10781,49410,42261,87202,82566,41663,43105,60276,2768,5733,74176,28329,2297,145430,131632,83615,122915,105441,655,224102,5284,136426,67763,16294,188511,32538,61049,27893,3394,13951,159099,28542,17930,145360,9492,190122,32285,78855,26440,13570,58648,73908,4239,124561,2444,74172,53131,11468,10794,73566,11623,35343,64710,30481,4163,10328,38309,29901,10538,154377,76132,92405,24839,11679,3465,13449,11637,7824,2337,57754,1260,14458,41118,19878,38661,13416,159180,37074,163164,54137,28627,52134,184900,8520,40385,29546,30502,22386,66527,107458,6850,24022,47983,30603,35083,8934,304066,39500,9,28261,33026,77251,9374,44833,116312,34990,29236,63563,125639,135405,165398,159055,55690,88141,69643,236964,31983,25572,20436,36746,60896,31850,16179,11828,5888,3043,66368,9750,31167,7915,53111,36430,1333,64344,93659,20061,60596,180191,51630,6792,30244,43509,101058,22409,420,44210,109783,43223,27030,72477,72831,32679,29235,7675,47556,12258,39907,149412,84926,118247,24692,71717,105038,86009,45941,41189,89453,29856,52543,30627,226798,67303,59230,67415,34408,1367,99685,16867,128419,52147,4111,125381,117881,16173,44093,102224,31575,23234,24870,83790,127407,239098,3200,994,1255,100903,242275,117266,55116,38205,16140,29662,11307,40414,208793,123355,56470,4862,75600,30119,58218,70828,24075,26974,7802,192353,4851,5475,78720,66596,3409,28573,64396,30381,30690,59859,88256,5406,99945,103064,34463,37727,24238,86643,60088,4057,23741,5967,162904,38240,28356,93858,25510,122879,6897,3278,7057,11971,4400,35461,211413,21395,59615,39471,87233,55795,128426,3051,22470,41950,14705,3974,180108,80476,78442,204996,91987,15634,67610,139015,142373,35611,51134,10387,4353,153456,57749,181039,14183,68447,151532,21107,36452,20551,3186,46247,46383,129666,88736,140662,146243,2066,8360,7978,64818,106963,17896,47801,10723,114821,223295,74192,3293,3393,16987,74064,11277,91622,4270,29828,27951,387869,103235,1374,61988,120083,477,145892,128378,11779,211263,61354,18221,17869,46530,83061,108538,157981,90608,67199,95080,49064,195814,12302,66307,10348,231346,160732,112859,63633,146558,21271,31037,198802,47622,12862,95710,3910,77850,73961,85585,34752,61e3,4082,24595,103679,71107,8208,79568,150019,16615,24961,139857,32664,197366,4559,54735,32696,4126,162019,75698,13916,70108,159638,19834,9349,24675,175560,49643,18206,52459,27992,10809,88865,401975,133172,29e3,34558,30915,3658,25834,42430,36562,125265,18182,10155,40149,97082,208980,19575,60853,90529,66545,9600,789,46420,2317,88593,55595,98980,115302,5742,169155,1073,177901,3472,11189,63711,78643,65472,50459,127979,93,42202,67053,21720,157650,11145,141378,42033,22824,85705,79114,35584,15974,1510,54172,28562,12451,104226,19190,97151,73024,20948,5151,81741,21499,29006,84183,198074,54003,45120,170125,26240,35177,28389,64863,79974,60778,176915,232183,45342,2038,80253,41564,40703,32689,5430,100689,5366,23007,134279,14266,26712,73993,24934,64242,52113,102887,61801,46415,201049,54251,62133,122757,164883,30815,139966,2319,30842,766,13362,10287,134518,86111,81665,82440,28333,43019,18963,8804,161944,23439,102144,101145,80029,39052,248708,30350,117340,11878,128467,974,138625,63961,5237,74778,61834,67040,43814,13690,65947,33809,232476,115258,181745,28824,94013,9510,10246,93722,81976,7217,114383,3493,16014,69045,72692,12145,80981,9507,6692,1620,60820,330444,35474,33962,4797,7053,295463,46445,27026,12491,77988,49524,35675,90947,29114,166705,101385,133782,32704,6186,84595,176031,185623,45966,151302,63069,1699,107491,947,15458,74452,196212,6046,10498,12163,10239,35191,243951,9277,9090,29539,54460,22820,26514,112549,60372,51753,48756,21812,70861,260326,41,44222,10441,16961,48148,138771,216194,5914,52153,53400,212036,56519,26245,10117,45888,15294,138019,90913,26368,43842,42111,23348,6082,194845,161089,156206,51546,11647,30759,302912,262094,8635,78876,26535,35283,54183,31183,85484,147873,12989,5197,6356,72894,65347,20150,27370,73787,1493,45918,12366,190217,20724,13858,10981,67449,81213,7553,14115,72242,271517,11842,48310,88743,143726,22177,3290,243231,58452,62937,12592,1654,40066,33477,13751,9921,128442,15868,7106,75236,83773,10775,36938,10482,170465,17368,17469,161508,32752,98340,800,19824,264456,3901,87319,2867,26782,9630,113102,185815,24197,44584,86366,40224,3636,140916,31731,267731,9567,53678,72984,29389,27963,17106,50282,284911,60170,8322,12608,23374,89652,5268,39044,229766,8869,151350,31436,177342,12269,183212,120418,116270,2843,78888,69192,7865,184099,1086,129897,18383,70508,20242,18508,229924,124569,35749,50589,55626,9884,83115,40971,30671,18135,14452,38861,17844,201826,5549,26413,17189,13561,38539,10679,143331,3314,36785,171194,49685,187713,67506,4618,104039,17060,195080,50648,33159,19238,67559,134840,28599,157523,17130,38064,117398,94355,31918,13575,34538,40326,13997,3494,348283,62481,26862,3603,104426,244363,153709,112487,304612,199674,41239,35545,54869,293005,28223,26277,26899,4533,18518,15492,38587,80488,70485,160395,263,60162,11382,222152,4696,250751,51921,182609,10707,48463,46243,1227,49111,111564,46502,33342,56846,68541,63559,858,139927,16654,229375,76759,26478,33205,95828,23399,92945,2637,35630,28470,143992,50214,14174,21456,166191,65665,1711,21594,78019,97599,111701,36,147151,110246,189022,43021,30397,40757,131935,42065,73335,48039,26596,28984,15102,2361,7421,202167,69744,43766,52826,3642,83304,33873,75140,63169,192389,36551,92748,13039,123959,233220,21738,84447,77230,20228,187852,19095,25799,92136,108774,29237,53947,2299,118106,2687,8830,42331,202924,33667,2023,73763,30704,19363,19779,16737,35629,48081,24068,101013,162338,291912,13749,24745,328289,167679,70086,48299,23306,16732,17801,43322,54589,3586,63653,43624,53474,925,109177,251316,43805,13082,19511,86565,142182,92461,17117,101033,103319,64589,4022,4351,235897,5352,82705,107142,46391,156084,5860,61365,10558,13045,7717,18357,33922,12590,33065,6928,46993,783,46937,67846,8952,26295,6107,119656,18799,17458,50747,4229,179559,112727,118080,20683,41464,125468,51560,49749,44231,7359,35339,62988,136487,67015,5208,29150,24956,105186,48858,6143,18097,6972,16404,73489,58742,97196,36357,164616,5834,32267,13746,147733,15113,132091,34127,106298,39729,106426,22294,9780,15602,36213,71502,42808,66802,599,60755,5851,39120,67363,108623,126368,72770,91263,32486,30596,151717,7951,52002,43103,11768,68942,40901,39344,24037,127500,116890,48403,16926,86750,17745,48648,159545,34460,58419,5634,114317,67865,31462,23352,24010,98185,125708,69686,68337,13610,26271,70691,2980,4768,27225,102402,75453,28106,8104,6931,1176,6274,6475,112635,22498,6176,238686,26832,28893,90319,14441,15682,15087,39517,45270,109134,104440,45965,47645,81772,7876,52683,87720,12898,4505,185665,2769,113401,15664,57592,105229,137381,97059,119268,6876,43309,33886,128363,35476,144249,67013,143587,83367,25703,91436,59347,53236,2289,16519,19844,46309,58558,99834,23313,218816,231303,36388,51333,183535,109792,139277,54306,90139,18235,8275,32710,37677,82464,86025,92204,88842,117723,37570,128723,234242,76350,73795,34896,148247,58424,11105,11744,45746,63372,17118,49772,199520,81902,38004,22911,33752,3125,1995,53792,4689,26909,108150,146062,69674,41811,161444,84855,8999,28561,16731,93937,3189,21967,24890,22943,1356,145300,51569,28802,517,118679,31703,40607,48098,108854,25003,10233,73969,177495,5248,24516,215347,146192,48712,60626,69188,40735,5866,586,101541,6509,47590,52129,5969,222045,110933,25733,24223,65339,62812,2414,155418,35819,16022,78423,43138,20995,128255,240673,46745,236093,72176,57085,97841,61248,107,36068,193177,105427,55726,215229,20446,47228,100420,87091,14429,121708,23605,21157,187721,21880,2997,203976,99166,95068,25877,7724,98925,83401,4829,13182,18229,13718,239662,38653,116505,153497,30589,89029,38962,181302,43853,78872,180301,4786,248240,7401,106136,112590,77745,19731,60880,77789,125748,135487,5975,48627,34084,12419,215770,47557,254582,10364,106495,21856,67539,88981,38805,21428,48732,42316,12149,16078,52808,25327,51322,33850,51147,12253,122354,46077,56483,254553,115417,81834,150991,94662,86668,7381,12841,100650,18218,15741,22372,68294,50705,15535,84660,61887,22553,72299,31361,24824,17743,46820,64288,31582,77006,111674,116384,30760,80920,86149,77192,51979,79691,60342,122805,103800,240873,160744,233114,78962,54920,8608,3484,316104,72548,24337,5088,230040,21926,10172,36838,26,86221,83458,102176,12062,17571,41929,41170,28428,68239,41750,103930,2634,18313,53019,34825,97837,63115,24606,73157,152474,14715,91439,37033,109806,140259,30668,174760,380,135597,95673,136073,65073,134249,13829,17279,122305,4420,46444,10237,64848,203623,70728,10349,182885,65075,24519,25783,40318,34139,22222,63394,55266,102764,41422,20126,65100,90408,53640,35128,48932,11192,38935,96839,34782,39492,19396,41332,6250,5511,19492,51304,25936,104466,54099,73771,86115,5080,7669,30891,111700,13931,25276,72289,135447,14820,258641,25265,31005,281179,75286,393,95359,14623,13584,6680,101227,80173,44933,76666,54542,13244,39348,458,25379,109451,134348,81143,6959,65554,12027,51311,8716,57589,140731,28467,23316,17272,30458,25980,55229,77197,83798,28302,114784,7428,34548,26241,14712,39336,103304,18928,54080,12870,334,87722,15208,16895,142098,114262,39820,83913,57817,28682,7721,14900,108672,11250,62246,42849,415188,1724,26555,24549,25505,26443,107450,145899,61035,43528,6901,60726,65906,267741,21338,147590,42079,18924,73017,135236,15393,5206,4026,84185,1531,5988,113890,82647,303391,7386,69844,71611,189865,76523,31877,13315,19314,198575,32821,1928,67641,25913,104475,103489,3297,70391,18406,15446,113347,19295,93790,27856,1792,167471,116449,8541,4408,41757,63233,25765,86680,64501,27034,24816,34975,6079,4486,49693,36229,16917,21581,62426,27862,11612,54284,35702,194034,355,24277,48262,87411,70504,310164,118018,12516,47559,43502,57433,107139,9290,66533,80863,14634,34312,91725,28606,21342,67241,72355,43244,375789,37402,174015,105070,8342,44167,67494,1890,16365,11723,271002,1865,47918,8350,45564,27742,25110,125803,8553,49504,81925,62211,4534,15491,19011,80373,206920,667,102405,128623,245524,5553,113309,192739,65766,19567,22832,261958,29679,21293,71134,20962,105123,24721,860,21752,33448,18372,157167,94822,35770,173224,232737,75729,28937,46828,28062,25453,5207,140366,36665,30652,6169,67920,150458,92040,23186,184604,92330,20891,176492,49427,27828,38305,42495,143982,49560,25503,90043,29747,65328,47830,12932,11068,77721,9003,25213,94205,140426,46090,89945,138173,192691,33329,112232,129905,35709,27514,1841,19957,31411,127476,53572,17497,173549,55063,175135,19841,69314,5192,237921,117660,150697,4060,273045,50414,98940,65348,153665,164423,58804,156695,48994,213928,86036,28608,8355,39574,34540,16927,135680,18374,151587,10830,53805,16878,16623,4282,48030,8537,14986,46102,13062,72897,72,33050,108227,39451,45935,651,113320,40535,95176,57450,48843,5003,19019,10407,211163,3848,1068,4988,32091,30095,41692,15099,43602,107434,50744,7627,171349,16313,150832,352665,207750,33937,38256,51091,156e3,87889,90663,84175,24908,114900,50365,31494,83829,5398,169342,47521,54818,18935,8356,43094,41212,174536,10082,92550,6678,60614,23355,69721,14796,34149,128830,58187,3179,208,40325,28399,225029,401412,51150,31580,207268,6657,10993,69818,64282,289845,23308,12961,38447,6681,52944,31855,2572,47646,120728,179148,37240,45196,218274,4816,3695,21961,50084,35209,18073,51452,27004,6100,33941,1377,84831,171214,85,141510,9078,99227,32610,6417,11718,49868,65579,87902,73018,49062,46280,61742,21512,40862,107733,15941,29168,157765,144919,14487,5767,158014,140070,7241,573,71584,16921,223566,40331,179473,35081,47926,140885,41508,52104,59180,42310,32811,29048,123517,102413,80208,10104,14746,12649,153641,126022,37965,113017,4171,83,142592,2809,6362,50416,71323,116894,260776,16204,1524,5760,30351,12658,20703,54403,36083,45408,74772,4946,14485,50759,111222,10890,2195,167147,92962,130534,16283,177256,35016,15472,210156,151187,73922,117691,43250,52051,37392,24811,24358,30830,5775,818,21969,1476,127322,151783,58392,31021,106913,65215,89407,90802,28531,11690,20234,95249,44602,37256,18707,11928,5161,4410,26571,51903,49768,22008,25252,65780,209499,68769,203726,13249,137363,48845,86823,6658,5674,31881,1083,1823,108676,34518,166752,13791,14287,91576,91429,8665,11529,26401,16191,91972,30964,5254,28486,54697,79613,66520,18447,22870,45203,194466,22822,51703,12278,76716,44595,73455,33546,12235,144843,36154,51247,11116,33040,3180,225753,60864,1972,28469,12891,28879,10338,144157,56294,353058,38302,41447,87532,110616,27065,168438,6557,1213,50804,144643,24817,2390,136531,38174,247513,16190,4059,122791,131994,137430,39506,57650,16305,5188,54309,106128,20628,88071,67394,395446,250285,66176,91254,1399,114196,43915,60230,44853,27206,106353,43013,18733,345105,226453,51202,16607,57106,117175,35492,10476,89598,127439,15187,39624,13688,61570,10615,31111,59370,6238,175252,32143,224492,41388,95408,34384,148238,78307,38959,9340,160091,61443,15737,11216,41244,170,38299,102443,113097,26382,14027,33707,3957,76300,66160,19431,18900,6952,1717,108656,82206,188021,257335,27295,43999,41210,31777,46956,57457,12657,11489,15697,48060,204748,53583,82422,284790,30503,137341,8120,19615,220311,15991,10217,63424,9808,67431,70976,98221,4491,15177,28535,144789,751,13230,2394,1504,33977,132104,30316,22230,931,97193,185240,24826,22687,174322,15307,22988,1390,188745,180325,29580,59068,74903,18994,29195,79,15436,7622,38462,11566,138710,44828,45774,37768,99236,68137,84083,19282,22698,17134,74807,126662,173497,46248,16938,119735,3212,28292,213652,49013,9975,32180,45660,86250,4801,68788,95490,77482,113751,11994,44624,94452,46839,128497,100316,5798,58588,73184,202987,65417,37790,88524,1606,43156,97964,105717,34947,11203,100060,37742,130074,93653,107799,94311,196106,41347,8035,10780,16390,27883,118236,167395,1979,25006,19375,31628,18916,144723,78502,114047,103107,86492,107686,5844,20934,206963,23556,22591,16562,146333,20167,10471,117434,33085,2863,9740,36669,41849,37271,22790,18209,28979,8231,12952,54408,21731,25130,45208,55748,138120,75826,414,29593,9925,292865,25999,683,123149,7036,92159,86055,61827,103680,23176,54918,58466,57578,13305,5709,86479,16697,31064,17660,200919,10770,49793,33423,32370,52047,16488,62555,6459,8426,83493,7763,59725,82812,18628,67760,79405,68557,9612,7673,28102,56517,69620,171797,32458,29541,15870,81109,32080,207644,71495,21202,11039,91036,61230,2810,130800,32260,4613,60590,37112,75214,33979,126402,155062,30642,63875,12810,194463,82799,47664,16725,36685,43367,61099,449,172150,102867,21691,301838,36745,7130,18671,57316,34852,38034,54182,35578,65900,99486,19771,3456,2658,16914,99866,28390,28109,8262,21147,34353,20006,4228,137085,1675,203023,283196,198286,214375,163329,290603,152574,40471,83506,30068,14730,23177,131539,34759,27668,32178,71896,104799,116305,85430,119262,42860,25160,8911,23428,49437,105322,6519,16203,6349,74711,1230,38045,8540,75165,44736,25909,51026,317034,4984,32281,91312,27060,44431,17817,45363,155937,239085,35697,59784,91993,29531,126740,213757,76560,167776,285273,24262,8237,65030,41160,74437,48804,118916,13159,37842,1031,75349,1478,11655,108777,23435,277425,101734,67469,70231,124711,43532,28514,65526,54956,1e3,21882,17728,25302,40952,52214,149632,1999,2111,3259,63362,89961,220561,39777,26335,9063,10572,12416,34551,34623,38604,24723,5947,15588,69927,66252,119177,69173,46629,28714,70715,212408,20521,406913,74380,11716,50659,50862,37009,88460,130101,7210,53853,538,65120,151950,55806,163748,52837,13153,21100,16674,64536,6091,138201,44837,58547,3723,163,2177,32288,85454,34033,8497,14282,25742,10535,10741,79559,117493,243787,49337,100718,79495,40139,42956,7551,55433,15421,31509,23034,45081,547,61176,53434,328001,8470,36263,30145,4519,74173,53935,11845,73774,60211,78025,3,4102,73782,109293,315332,48412,26683,13714,6865,20128,18490,104141,325,39470,171970,115860,15707,7268,73301,74336,31370,2368,111827,107757,136231,142844,97138,96638,84053,38691,23801,1588,10573,122098,77039,240,186135,146101,11996,18143,112963,46171,155836,348769,47795,121213,116266,132515,3344,144804,31286,99187,255838,129694,35894,48779,55235,148582,71967,65282,15174,13920,47080,6147,108242,157593,125025,7136,1286,28957,127956,28402,98813,20805,7532,109417,40610,5041,32958,15142,18408,108596,33543,50517,27748,80114,233434,91447,487,37094,100048,30541,43477,10639,89862,155868,37667,8726,60684,237903,73408,99589,12190,38739,97348,3914,13594,2680,149016,13907,30171,28343,23530,115225,61104,35821,147679,14337,4297,244282,24085,326976,56428,7851,21303,131620,71446,83253,68692,111870,5224,15813,38197,49026,45057,13660,3306,76345,40671,27905,91072,996,68527,62085,91351,122634,55109,168209,2024,27560,112707,17352,8306,167115,169921,166958,5031,46020,11844,67284,19130,76185,6920,32849,5450,14610,22451,21002,17392,31872,66682,84796,13709,40210,59898,12029,8719,53564,21462,91884,21647,88379,194428,12754,37797,132826,160016,22567,54383,53186,77611,31107,8339,4694,19185,90355,23597,17222,140675,28442,23668,55977,9128,61555,28774,155229,17658,9390,24379,69357,15752,127381,239631,62460,93181,55913,45133,140155,18676,25249,33164,29581,82837,67223,22362,29975,7317,52813,1943,29613,20012,207130,49617,49651,5636,15334,36313,29226,28084,95247,72072,19e3,224932,15811,114,32127,38097,37508,88507,37225,27359,91626,12193,69279,20608,11055,88156,92808,2152,57259,55275,72789,24475,104414,1708,9882,3818,48661,66897,1631,34806,227930,85815,87753,18321,250664,72733,25107,206797,50891,8082,196411,92596,96764,152823,65514,22819,387277,62176,51225,40329,15563,189,3659,73670,64357,51793,275136,33482,86653,74615,67058,11318,125720,15388,22388,8267,1730,102663,170910,40784,7144,85373,13040,7088,94309,583,44224,140424,77439,18496,164026,36578,4722,9151,5824,63365,26510,35199,40500,79277,32495,44614,35233,9566,203293,152144,7097,2330,183480,98629,13423,330887,44130,68600,30939,97829,31012,345465,56747,94879,4939,160027,149761,99423,46099,32251,15332,8761,96094,128555,5763,235318,222223,55729,30241,55420,201746,3987,81382,8259,49325,23287,7719,24633,251100,92311,18591,110533,64759,170260,393860,7175,21144,132887,3593,75346,101277,91109,16387,259187,11627,57459,173829,44694,55780,49797,89192,120443,62622,3904,14814,23887,1027,112258,64955,99800,11132,66353,36202,48624,18158,88481,96882,43059,11040,2455,7077,21651,181159,99126,100434,61388,68186,19161,110468,120052,8819,55324,41494,7014,37689,3618,87729,92615,207943,9823,128657,12587,15857,6379,67628,51216,71775,157617,63244,1503,3864,218754,110864,5769,21492,7243,1192,87921,85529,31512,18537,42698,35350,73510,84474,34301,8991,21013,35034,566,38832,19838,35586,37216,39413,55006,12178,59742,856,84563,6900,25632,17437,49786,30723,13847,70845,4044,7843,23944,235976,55530,48942,6518,20939,73769,192653,52936,95207,23895,132542,142982,22632,87452,48042,54018,178468,10728,26230,23559,363,81269,142012,5718,346258,31456,84333,246476,51018,66692,101804,120570,39962,30373,70593,2864,60541,19425,54209,104092,7201,31545,48018,25865,15442,46257,40443,8328,6451,111782,47527,97754,33046,470,245116,31095,39,91934,87208,73470,36708,36521,12801,70624,36272,8892,79768,12427,55454,103756,5908,52390,62962,22720,141138,94634,41689,128402,126390,6628,106394,35527,134394,82727,254651,194502,148064,89549,3202,28359,957,21954,27906,49840,142747,8307,24206,48978,1186,71728,133038,71474,91306,6333,110959,74600,70387,18983,62609,56057,22970,1147,135850,1321,28834,3578,59715,102227,32827,81415,99952,55636,257598,390,22702,35701,85872,402916,39216,189795,14929,19467,10112,144422,61514,5279,63421,134686,41436,8424,51925,10598,132295,124416,4604,194739,210929,57866,31829,51626,50007,9976,91878,61906,56168,81906,60918,61859,40017,23059,16887,40927,62064,12785,32893,32913,21782,93965,20169,44387,79084,38463,11457,93950,27127,157050,2697,337088,5116,54128,48255,33279,8821,27352,25515,124022,65710,28906,38557,33390,1722,104435,72215,38551,12094,30978,25113,6671,37355,175109,42862,98024,65406,221276,59624,118012,64637,78760,86697,21426,1639,40350,12584,67193,84144,31396,7863,143011,69629,63112,9454,28666,65798,46372,134721,6314,51402,30837,151922,2847,38676,38008,92823,136245,17540,5504,109295,205242,37606,5211,214892,1586,20670,208711,137743,19328,40652,16995,20023,14657,154919,34422,12996,13918,38221,47690,16398,2959,37680,89122,6721,198469,91876,172043,83898,101992,26084,94570,3635,76958,22853,76497,38266,176590,168403,44464,142840,79180,184594,1984,41806,83147,11985,6546,366068,59732,24533,271505,8736,39084,222992,93429,28962,58985,86665,8432,30028,14548,32439,54424,165029,55175,27458,69046,121277,46168,33732,20661,24581,135574,123110,37556,79260,72611,16957,12939,46162,58238,44907,72936,253758,41324,32518,96480,11949,124438,65280,43256,34107,53533,43531,37037,28366,45970,32741,173438,6121,194202,62969,26355,30314,58370,28455,1848,50519,82830,90393,21761,295490,10936,256940,133568,44050,20269,4089,27457,21610,219460,36743,14821,101388,52005,13124,30979,140816,167362,26054,18458,60789,34917,40447,26606,33422,9066,3452,83614,5761,20263,137238,25038,91310,101,52322,74548,42572,38084,214054,186568,31802,17665,30620,141936,37730,14420,4265,187218,49640,188208,51441,55388,96452,66659,40869,42039,60967,221027,19234,178581,29105,96050,9165,196118,157335,3738,40354,117436,2965,34136,59659,15570,50843,230035,31444,71260,43886,18316,5387,38500,168508,17406,32174,8828,103373,143806,90367,3560,18719,122310,16508,26719,2541,105429,6645,37998,73190,10591,235916,49737,87112,233941,53188,32193,79154,4544,52905,126477,7580,63501,57314,3216,31337,6541,103083,60846,49,9756,15481,1355,43840,14319,13743,27486,10222,73114,230718,418644,16706,6674,279748,23058,45273,295831,86306,2743,5535,88773,21829,35253,120938,31153,3169,16839,42847,8751,80974,33942,36867,35514,16485,26474,77775,56877,5391,48346,3882,108713,31403,27804,55248,26235,43821,136104,40118,175507,28034,203908,18732,1788,34030,106427,36958,54359,7251,44936,15356,69139,455,157915,22173,140291,50348,43275,82066,49621,54952,15216,36226,96695,66855,6936,1987,8227,196087,4631,68827,99004,47541,110265,17953,147605,110242,58520,31312,38724,329975,642,3155,34497,75937,6207,73843,6120,17249,51429,117746,3218,910,68961,319671,14938,29555,34700,1649,66673,72268,9655,76800,153087,6941,210168,27130,35398,1780,73242,3135,56689,19556,165307,8765,35967,121458,13333,70453,17350,117253,22265,13340,44265,39869,441,3742,135025,23581,33309,16543,17731,13291,157637,283005,21408,101360,63887,52312,83873,5338,233779,23759,186949,34531,177320,38069,156465,91004,19353,59852,68160,14891,1338,1072,29823,1950,28901,81407,313445,73038,84807,162348,240257,37162,138934,16111,58013,41253,102951,16457,96056,19541,56402,67217,41638,94381,89674,29481,37456,80815,151579,13937,13683,132537,19699,134545,67020,29816,222341,141235,427578,48868,129557,233342,23077,87871,16213,18728,16184,9469,37913,19680,2798,171356,178328,13216,50049,72690,71904,124644,55455,7504,29052,41036,266546,19899,30391,188755,8659,59469,16,104298,112943,53865,76203,138226,68857,139953,14125,107625,119795,173133,4398,50273,48808,54390,16466,122086,31835,67035,50971,48859,7508,46427,66477,73021,84615,39985,83076,46779,201569,53336,36443,60865,168164,143810,51393,25548,169307,32896,24485,38424,21837,29087,275813,51674,6714,64883,46169,187369,55186,76192,12852,12018,62134,31067,118303,16542,12125,10579,4928,26291,43854,7091,10946,253716,109062,39283,17261,113012,258512,47764,125126,32646,55892,80279,201623,149872,3192,385,1208,48750,5376,58738,22335,5427,82416,47811,32435,143086,38930,94128,59975,156037,37977,38224,62485,7698,50405,71027,16462,21559,136153,34131,107506,162069,63703,3101,215029,40407,4178,3774,9187,80019,17880,97926,67579,2600,18405,8351,47924,86638,70820,92206,86453,29610,42241,119200,3198,15466,67813,57863,35454,4779,99518,4649,104641,144269,33730,38073,65864,6838,109456,193298,154007,5623,45741,30846,182578,25573,157224,1543,58575,138703,146140,44971,49356,18275,59064,20300,13122,11848,24453,11973,9797,86843,2919,25530,49210,1130,161220,76788,75373,85604,34926,36014,17777,17255,51533,11676,92226,51845,119859,21525,5936,18507,28050,1140,31418,14857,34207,47859,10750,36382,32079,106909,59426,87757,38393,110042,15965,97104,33757,35344,97993,53979,33651,45407,41884,82515,173089,7177,58371,35365,47543,51927,35587,10670,23544,29306,84233,39976,76076,62097,9007,8668,28119,78281,120790,19835,143020,54968,18670,64959,20649,34469,42570,33001,136570,87796,120044,1106,58700,63951,127623,12805,83057,40212,31773,49850,7361,54336,347524,101314,23751,19569,48791,29174,49369,20467,7465,75842,38281,623,112457,60210,28849,51003,94720,6426,90047,85560,43761,3579,85105,34607,90410,118528,7224,42907,111163,18168,6960,161135,191298,5247,100584,127552,171568,20121,91173,12636,54615,20199,63730,98105,2396,40387,14438,125012,4765,33235,12865,45299,37728,82098,77872,114037,59253,19675,24838,398016,102561,11446,17069,57508,178277,65836,99941,26114,2585,271882,136866,50126,11027,155648,118367,14585,8910,123015,335383,40434,41016,53021,14439,87098,176860,201543,121888,2358,9286,5739,22666,54270,37884,169381,33984,93859,16124,89364,72207,51639,76366,99029,65812,2198,12147,174891,194289,6986,30252,88822,21284,11445,288337,160821,33034,100869,43852,25761,52882,1144,103809,1924,84458,86079,43411,13542,139276,18141,34978,41298,7276,26481,173800,33210,17951,142652,33616,33677,2210,19941,98568,2486,192414,80136,12058,235883,50963,249638,29572,27221,47034,6124,72107,63346,97620,158513,299699,40388,23235,37176,224244,198386,121323,67992,23827,63170,17838,106622,158590,26807,5345,23489,91891,55474,74834,37981,13058,5977,72552,34706,26828,145172,19904,21367,34043,960,77092,91381,4733,47446,7680,41697,5170,16960,14741,46101,13656,473,51842,37433,11103,11551,121951,13191,97536,165932,50397,51628,129028,9069,44885,6590,59195,47045,32940,225472,90345,21833,13303,29407,96615,141951,5198,6028,18395,7181,3861,14966,156358,167182,36529,55253,25942,173153,30959,27261,50691,150176,162201,38467,48462,80602,42163,118482,168,108756,26011,17166,54149,456538,22512,91374,13816,90358,131615,18132,226707,1824,28139,26860,42253,93877,77351,65575,8980,80574,22020,27948,40422,91324,76376,13528,39281,91685,82215,122541,144066,1983,193851,17283,26320,2739,194978,4790,26845,42627,61300,65815,174612,55133,4200,191130,79771,158321,52280,166796,221620,62461,11278,4067,88152,83409,31717,121367,13522,47325,37945,10406,174348,249321,154101,64912,29938,51775,17220,15776,166138,78890,84425,54121,42861,16368,24572,291647,10197,32073,22651,11677,97509,26952,35787,18424,41910,71614,94977,72318,41594,70024,275419,37702,60199,7335,39107,61315,18271,18394,33768,87884,104277,123724,7277,56288,71981,189803,49320,3352,6798,14240,8954,69220,94433,57372,28620,68863,193727,85575,42309,41667,67689,42081,22543,44824,12719,28540,114236,101553,27638,27296,4300,5353,4663,19379,94098,3758,95888,95144,80344,87320,28447,259518,12718,71391,152731,37063,24132,31911,104896,15672,103782,1521,4945,72541,23717,122632,15619,87175,206120,29428,189780,61416,28350,44457,972,1175,47233,198738,95789,41907,21953,97034,59341,22864,53713,16873,32971,20693,20954,31336,21477,16169,38370,16412,9019,3841,24599,21938,17085,6484,81198,76413,5849,72514,12320,65247,276175,37234,59796,52642,16312,57349,198507,94148,46134,18958,125552,1747,18725,151873,14901,5490,68287,29470,3689,64794,40814,26018,25692,54450,2703,88278,124886,173087,174e3,24159,179477,24276,46004,201876,209202,445,52876,31948,30206,157610,39180,18439,44124,50469,5774,96278,222758,200216,50290,45486,20435,46986,46276,140133,142326,15569,13363,47522,92583,2182,7135,16853,22998,30272,4952,63263,35623,39096,53789,44864,20053,110392,124213,4630,16087,28221,127787,25839,77481,44693,13464,113146,6983,27069,55717,50102,4760,7107,26186,66507,59145,36032,104182,71328,29425,64317,50781,47465,94298,69706,74899,22754,120756,25108,93077,56834,73286,39928,16218,41699,176763,7555,70819,50083,26895,23315,26014,16773,123079,41712,5719,31516,90427,158540,85051,183128,40864,27505,55392,9058,45224,96857,30901,136622,96557,56304,120061,11501,151448,5773,89743,7769,86069,2935,18471,41628,10114,33660,110170,49479,26745,92846,33221,26731,18795,87076,8550,2100,29972,120289,3077,72490,33784,2630,208722,50861,63483,79029,6419,39467,14302,45286,64207,9686,67513,44170,1050,77246,59266,17055,53801,7150,11111,42432,4278,94579,362117,36175,42902,41933,39002,98489,22913,74161,84773,57036,17556,162288,74485,178760,93867,73635,128860,50362,261,67455,80001,46080,35662,4368,25247,19230,74393,22588,1822,27682,235324,13798,85998,13194,235067,23514,71669,147632,23191,134748,214683,105101,1518,25489,247114,7380,54842,26922,3971,26361,20844,68642,170517,77339,123255,8963,77818,150998,48466,36806,2732,23261,11741,236162,18243,126216,28690,50546,16385,92760,197383,246558,201295,88255,67588,71687,176076,172653,169058,33906,63747,24835,157621,43338,30050,46152,132741,2770,51371,94835,6614,15112,11749,56936,1250,19027,399017,58036,100215,23388,55815,308768,124152,94803,9521,64186,8971,28,30427,62163,7616,103838,35079,29203,131235,7743,17389,10882,37420,61460,228512,85363,41581,131077,62822,119647,10130,54445,26925,19968,29016,24446,74028,24176,61448,67185,9254,8563,119129,9771,99184,37716,39514,10532,221512,258753,218630,55980,23394,32141,61924,66749,32411,3741,36475,26678,77010,44946,91203,128749,116953,20476,49625,53116,13735,102335,29376,51946,83407,67892,59212,34685,21083,1546,112982,32972,74397,1078,190545,16082,86140,58591,89611,101531,10061,105104,76319,20035,17551,52611,169061,190842,100780,23907,90413,115619,9675,34710,193435,49443,129734,11183,258877,16318,136182,126808,44635,27304,192375,2599,125648,47051,12091,23814,721,58800,40137,66726,97930,60877,74487,7942,54326,9841,41428,13762,8211,85383,6950,99177,79806,201786,296464,124087,13144,29741,41721,47634,55088,254286,106408,17041,99064,12942,64086,45233,14005,2612,55827,255,7984,13980,38574,12776,46654,73499,249951,2101,26676,25996,132326,116415,119062,50449,31033,23038,11589,179252,20007,14860,129270,21143,17796,144715,60106,70758,69842,34674,282133,44014,16774,57268,38528,24053,46373,201667,28327,471023,51889,102667,21193,114909,84132,69317,96723,67969,16134,68145,15058,28765,32035,2524,101089,98664,25045,76571,14957,86040,118506,262428,154764,81573,39681,283900,73287,127825,544,80448,52347,38512,175971,15180,45467,33086,46552,48894,81107,43213,36672,54025,76703,8053,7608,13299,56619,20752,238099,54164,105133,1444,32942,953,37564,8e3,66316,119463,106817,404,13667,149108,128597,31267,10269,49836,106150,1484,52330,76965,160486,171648,38456,31263,22424,37738,66245,67467,143369,60471,75610,20895,115528,86070,60854,40796,49347,18989,15030,11371,37578,15779,79867,10187,86462,46402,155626,93200,40229,7090,57547,108053,99598,11088,47505,41218,206017,2173,20988,30219,22919,80563,57566,42369,93141,41675,2407,182519,120495,27154,16702,29456,14349,7958,16688,117177,140375,42467,261919,74916,153569,10836,34742,49526,7621,105997,12212,2270,392377,7755,17959,25086,232152,138791,33847,13860,35316,5811,1344,71259,50452,207539,92635,50359,5821,33674,30255,2086,2587,96264,17543,42,6029,9580,43007,139248,82831,12917,29607,25786,51467,42137,85161,100698,31561,88989,121990,278500,3602,109344,37982,15279,116442,28936,30880,87894,58079,128661,126731,67392,28051,146885,4861,16216,97344,42827,147561,153948,22684,21335,47685,1853,43349,15185,59642,10229,25520,187921,108972,5579,98037,24945,6697,19193,63734,137934,75056,89740,19767,224268,56138,63643,151661,39313,70618,84031,89723,84074,13703,85626,35460,8867,64845,3439,57906,99776,63968,49270,81130,34356,16210,23547,36446,34090,140028,72439,2221,22163,57058,363492,113754,18913,95451,48663,54464,54037,176097,68425,3023,34906,29482,117389,341780,80431,58330,16753,92616,60907,94846,147486,4498,48646,7773,46801,7778,18946,464978,47558,33223,177444,7328,15626,63337,94700,11743,9351,255024,39098,16447,42647,96230,39769,58840,10068,63439,35800,65843,58823,413844,9156,51258,7434,61791,85018,6872,3692,28096,7121,33024,6009,75532,31997,192535,9661,3304,9547,14753,31987,25314,55689,15896,20430,39472,31340,99744,25398,115569,54883,28719,205423,23071,57855,64638,149867,25671,82403,37616,20668,39989,77996,74948,140555,175248,64810,36515,46595,4958,248773,24045,28728,136673,168704,20804,114833,100325,27135,21205,96151,153134,45992,7093,13992,76047,1980,19432,145001,75159,87462,17710,1013,45556,34297,144882,20648,26061,11319,129567,108555,18872,464580,33386,22717,65948,167189,5603,135042,79542,8801,202632,18114,91882,5973,5239,67315,4431,60916,47819,71693,32597,32606,18183,45072,80329,76385,24749,51305,40314,156514,14693,130345,13168,66214,18029,12858,34801,27628,14544,10823,40522,40185,33739,148694,23548,9923,61012,28859,17933,19442,34364,99849,164107,141167,30629,21054,6744,36491,8096,42474,41706,155060,30650,10600,163442,1143,96655,61390,52359,7559,51568,64256,203854,4467,22453,14504,436398,7878,6980,8293,63610,293747,16167,35763,19627,147603,15419,18032,110744,51346,33681,54571,40472,48615,39073,21604,13754,173027,92560,11083,47299,63062,11813,52007,29883,9734,139722,15953,1550,20651,13616,49306,16113,90089,92326,7584,30712,72424,164858,6831,152871,55746,197721,34167,196442,6022,112107,55215,7538,123381,4920,43539,77165,8939,50392,34192,20225,79762,22505,58667,40770,29788,97180,82835,4568,8579,13273,363569,35898,49983,436,36598,3237,131691,62418,35591,8101,4073,379438,65218,76072,33887,2968,27573,212619,288680,68278,72851,150504,217896,6913,121339,22017,35340,51072,43616,75043,31437,10833,81487,4364,22968,41454,106687,85446,19863,109625,149241,524,141850,214404,54376,657,237023,9401,108137,53800,32474,49712,53334,126876,27337,45552,177696,8269,15036,12097,42240,2328,125374,119295,99715,2500,19624,39441,27220,102691,60957,94543,39101,18566,67362,13975,78230,25017,34017,239007,90027,39351,41681,35354,43822,1043,916,58587,141983,94818,38799,75459,41114,67432,16195,36606,59568,22272,126769,31424,68659,12287,134302,257977,5756,207285,95637,47248,117689,19583,77451,22373,12200,54993,117118,34244,29386,34562,53819,71267,64172,77665,49368,7716,59301,25749,45426,194789,17297,2650,1766,32501,45198,20403,20984,6600,14171,94604,19037,5402,29896,9938,59935,109708,88081,145182,44844,39167,352626,164173,35374,45982,6122,154,73419,220487,53834,53601,17992,8609,229321,5610,68098,66815,71012,95069,140968,27396,8957,134489,24656,86659,56598,134852,17316,123838,255436,6613,41610,138033,81452,32023,32396,123687,63398,8693,29712,30407,19296,121188,3551,36099,20032,111948,56624,16547,27453,35916,15378,52039,56849,13489,22214,73177,53097,277349,2157,14029,187886,10260,141743,246460,91880,50869,3788,49486,133566,54950,33120,129337,53768,18333,9525,26902,312251,10297,9020,70759,16647,112432,59260,84609,9818,82766,73569,468,46001,75780,55028,52106,11498,43645,108069,17150,17753,29417,16705,31799,9606,289,122254,115975,8620,6133,255357,56908,14456,133464,43554,79224,11247,29630,160,12756,25464,65960,350428,62521,321796,100359,67358,35169,46172,113128,48988,88868,31094,33266,6847,60887,98188,49659,69117,92977,220228,13947,80181,35103,62170,97351,13475,2440,199768,19498,36597,46971,25234,67806,62881,84717,73648,181966,10488,94149,21550,26655,63436,48375,14405,165650,9621,24439,28043,42735,4490,29963,56674,45373,1934,262446,50855,67098,26898,5261,52696,40644,33900,9440,180286,87162,22940,19704,26936,69769,10254,101759,27406,12243,48e3,73926,113215,54935,5726,192787,4312,106216,9366,11550,52949,23457,212271,277152,133895,108374,6191,96477,29980,218916,58024,54696,40853,91124,65894,91170,65908,252552,6793,29212,15389,44516,122515,52617,35058,9017,103536,39510,49136,19242,130652,662077,74699,47024,31422,8517,73351,24399,13867,128360,4810,4434,61779,111983,61036,17798,110240,59722,102960,39688,10001,23803,23039,176498,56659,44814,134295,17188,77577,74466,226175,102472,154333,63900,111747,18062,41171,79669,32773,408933,42562,28931,30907,107388,43487,2946,240310,23938,24354,319,184983,7927,6488,1422,10790,68809,68209,64775,4361,202,17123,59634,51200,44391,18188,17843,2619,74278,3230,9540,47187,21702,36274,56894,43907,16310,34790,16866,6150,5561,13587,107545,108873,126867,86986,28640,33427,19017,5762,80637,17430,46903,2047,131055,25958,13558,5444,47152,13900,44563,122857,45348,70863,39593,54332,38068,33637,318,40310,143467,18502,24520,11377,62013,28942,27246,28269,83545,17999,59015,90707,30065,15161,34720,1263,37008,2012,6060,98575,92933,5721,299,199555,24578,29223,2985,743,115825,109523,136657,47454,26378,53586,3733,174945,93340,244456,5693,37386,28782,89767,27545,23573,18798,136425,34320,84778,20041,48453,38215,7477,71958,40621,8773,5874,187927,105965,51100,43533,18083,8443,10180,43597,2003,183999,69689,12216,129696,146188,62389,34044,68410,12765,43273,26949,266807,3345,34477,79197,5688,47539,213110,21634,22257,50092,32222,42346,39530,63668,98,134978,74022,5152,59088,174145,37220,9934,9545,118937,5724,87240,19875,15784,40143,23263,87513,181654,285152,37881,263241,4966,43934,10433,186657,6470,74416,225854,25908,142677,246262,32280,6192,75890,45546,143264,135305,29742,47013,77787,11732,126658,8763,37950,21806,57557,113464,89465,108995,164574,23894,22996,23169,15369,23117,17642,130607,40503,36239,280990,44666,9981,40427,147487,26869,168452,32886,32991,46798,240839,15111,70502,65697,88548,44145,28701,48767,31139,206777,35659,181164,166262,14554,171445,31786,66523,76607,17956,6507,31279,90476,116611,167918,6560,1243,115324,80128,41867,55897,187323,37069,32596,189444,145931,13390,105530,65709,26805,6999,55714,41300,22915,68951,22138,21120,22264,10058,19945,33635,56123,99085,10032,5818,6016,46649,57476,35264,94413,112522,262288,93686,83038,14341,23204,28807,66084,77987,6101,126673,7133,38126,5923,122091,170240,97772,46874,215746,43948,41622,3272,55596,8332,146411,251315,13533,8561,81521,115449,48616,175175,2063,186556,3036,134537,75772,29728,82360,22973,186559,86348,89100,38388,82297,45610,2613,87082,9986,177812,57884,23591,47485,42543,33582,44713,74439,257444,252451,31825,35631,38540,33066,5147,13973,4343,51830,70378,22827,26448,95560,36896,241741,48067,203953,298860,61620,20450,3220,67272,6586,107662,100160,108684,6929,57226,4762,7457,1320,40404,77204,99309,62750,208653,59977,44e3,74315,34332,5819,172217,64904,114077,18147,84012,1791,98456,90930,21446,116669,103938,7422,85140,59713,5768,326211,16239,75411,13229,29398,10758,236107,1539,112472,95979,152154,151294,306,21196,38146,10700,6891,84282,109646,56492,40539,6589,119491,51354,30685,140209,136906,29622,73617,49553,70525,51671,166869,139616,74395,37439,49595,45678,11959,33211,86560,52434,9282,62690,112155,130810,5243,108261,99970,265613,72551,80049,6391,33365,90721,66737,69872,87011,1860,9032,112544,60905,37371,89015,140351,19076,850,373531,2802,36725,218795,72062,28990,16550,24614,7815,6187,26336,33373,32162,42791,73555,32062,23386,10244,56392,49442,27076,136262,12412,14883,1134,33675,97153,199281,15608,100152,74072,47942,254301,36451,16026,10687,65067,56708,254030,30290,50490,13864,57941,259331,35588,23485,43486,24869,21620,92971,22072,88645,1048,182050,13343,32452,14825,19509,3325,216938,45740,99716,189082,53740,78245,25609,24311,176777,47340,308354,40669,66085,14102,125339,9225,128709,97207,1271,200933,78439,113451,88975,18324,46521,11819,18570,141756,72512,170020,52754,63550,118515,103073,93330,32736,50499,14722,31600,68452,398867,29316,172786,18417,104924,2606,5670,84818,16288,67106,59580,82929,607401,291,85829,359,15897,35830,50696,65630,52672,22115,356968,29895,40837,231192,34024,38957,26722,406,23335,124952,72068,68804,13268,147101,164740,276569,162596,66943,11569,26654,66358,4777,23229,102127,5848,978,2921,59666,5371,28212,90108,42938,39320,2499,4271,108792,33510,125072,71653,65239,38250,66357,38577,13964,86251,35708,50755,36010,29448,12209,3844,38222,206337,100876,67827,137088,14167,252225,84163,195270,1306,5703,54198,779,46802,22028,51124,86759,70560,113164,35685,162145,45471,34561,422,2611,6464,47486,19223,38246,9191,18331,89942,243642,212364,15893,17518,22617,6409,30046,126182,59716,36560,104428,18846,26592,19458,50793,147333,30826,1388,27647,10922,14495,33545,19269,135828,39727,41601,46931,233379,49169,131130,182112,16276,82381,118209,142445,128310,19672,28740,82907,33436,3118,102206,28723,24819,41937,38854,5157,3881,111491,1142,9776,421673,152241,29309,14961,87854,6054,15424,3796,82656,54996,2108,55367,239450,154525,9643,118103,106041,64601,68549,48707,30266,25772,18740,9462,229669,91798,112152,191327,14493,72828,8175,66636,236474,25817,87351,129027,76653,20422,22983,71240,27846,44661,12399,46158,77704,53101,35032,11072,17300,109294,33638,24408,1895,11241,760,17584,82479,125877,63150,141075,34259,23274,81698,15732,43577,48340,91584,14688,16379,24481,150280,96420,262050,48635,43727,61819,56268,72003,88178,17281,79912,13218,122519,125295,166396,11811,2171,118930,67746,17636,178278,174656,95661,173039,83845,79689,17473,98555,127696,203415,54730,22925,232239,9309,12136,175026,20740,180188,10747,39816,314017,266131,10040,175732,112550,220651,31974,37393,888,23008,86799,4303,64905,148467,75337,251,3284,370102,50264,9835,5438,23655,4481,29851,329,12855,7162,64931,78141,12804,42372,296771,83547,18624,34874,86271,3360,48665,77735,88767,11463,63527,28889,22258,29140,194315,113924,25499,6406,31334,1845,4802,49184,43455,35469,127594,92970,61038,115005,38840,87761,106838,8811,20572,55637,11162,96721,132425,108925,2948,125457,36356,3502,75270,27622,127192,2561,123095,49394,61155,16897,110064,9699,89448,53356,19628,220310,21622,83036,9885,112214,6087,26713,17901,161912,91492,3440,68594,9266,92238,8087,6866,150194,72175,80701,13459,31836,43243,239700,95846,44749,50647,21945,230538,120612,132371,244604,5193,105637,34661,41341,68775,85393,1874,8771,33718,49672,77403,595452,99507,6490,58895,128742,7704,39239,73217,43816,62824,37804,199976,22361,80005,87514,94832,14089,4574,139975,59142,75523,100268,43906,53442,15152,2547,186002,17011,19513,204282,3343,60568,128318,119250,4298,51871,41336,71759,21921,45074,98169,145889,99427,11350,1237,5520,28799,7803,53702,21026,136352,38293,128690,12158,90132,44600,10184,26957,39459,126025,78904,82999,59373,39301,150198,120529,153042,20177,50089,14764,271571,30530,123161,38975,101562,22941,5648,124654,109243,69817,71675,49162,106884,21241,107795,30258,16572,188262,141456,7688,60718,8271,11044,32440,104608,103419,236109,93156,43293,128929,42107,67180,25201,115254,185488,130954,72813,167547,20537,39969,38432,22582,184022,1139,27199,5655,17767,97412,122606,209377,27070,35871,326617,188954,42680,73512,80911,22629,3011,95021,315242,157737,383,41821,41808,19335,27950,15674,25677,110950,35375,76835,59108,57370,35262,16569,160415,37706,78086,32041,49691,137143,9782,172080,50148,77917,6323,10110,69172,17711,21795,59511,76184,135114,31046,132319,59105,157578,20549,80778,57649,158421,65143,4575,72235,21899,10797,92745,34035,106079,80159,4508,78304,25350,75457,46458,32937,25623,47,8531,104751,84953,8138,36508,187199,66310,115274,13253,32461,38536,1916,42007,187160,35055,26325,84394,35963,94216,45590,97782]});var S0e=m((rOt,E0e)=>{l();"use strict";E0e.exports=(t,e=1,r)=>{if(r={indent:" ",includeEmptyLines:!1,...r},typeof t!="string")throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof t}\``);if(typeof e!="number")throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof e}\``);if(typeof r.indent!="string")throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof r.indent}\``);if(e===0)return t;let i=r.includeEmptyLines?/^/gm:/^(?!\s*$)/gm;return t.replace(i,r.indent.repeat(e))}});var x0e=m(()=>{l()});var R0e=m((sOt,T0e)=>{l();"use strict";var A0e=x0e(),I0e=/\s+at.*(?:\(|\s)(.*)\)?/,OGe=/^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/,kGe=typeof A0e.homedir=="undefined"?"":A0e.homedir();T0e.exports=(t,e)=>(e=Object.assign({pretty:!1},e),t.replace(/\\/g,"/").split(`
`).filter(r=>{let i=r.match(I0e);if(i===null||!i[1])return!0;let n=i[1];return n.includes(".app/Contents/Resources/electron.asar")||n.includes(".app/Contents/Resources/default_app.asar")?!1:!OGe.test(n)}).filter(r=>r.trim()!=="").map(r=>e.pretty?r.replace(I0e,(i,n)=>i.replace(n,n.replace(kGe,"~"))):r).join(`
`))});var zP=m((oOt,C0e)=>{l();"use strict";var DGe=S0e(),BGe=R0e(),NGe=t=>t.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g,""),P0e=class extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError(`Expected input to be an Array, got ${typeof e}`);e=[...e].map(i=>i instanceof Error?i:i!==null&&typeof i=="object"?Object.assign(new Error(i.message),i):new Error(i));let r=e.map(i=>typeof i.stack=="string"?NGe(BGe(i.stack)):String(i)).join(`
`);r=`
`+DGe(r,4);super(r);this.name="AggregateError",Object.defineProperty(this,"_errors",{value:e})}*[Symbol.iterator](){for(let e of this._errors)yield e}};C0e.exports=P0e});var HP=m((aOt,O0e)=>{l();"use strict";var MGe=zP();O0e.exports=async(t,e,{concurrency:r=1/0,stopOnError:i=!0}={})=>new Promise((n,s)=>{if(typeof e!="function")throw new TypeError("Mapper function is required");if(!((Number.isSafeInteger(r)||r===1/0)&&r>=1))throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${r}\` (${typeof r})`);let o=[],a=[],c=t[Symbol.iterator](),u=!1,f=!1,d=0,h=0,p=()=>{if(u)return;let y=c.next(),b=h;if(h++,y.done){f=!0,d===0&&(!i&&a.length!==0?s(new MGe(a)):n(o));return}d++,(async()=>{try{let E=await y.value;o[b]=await e(E,b),d--,p()}catch(E){i?(u=!0,s(E)):(a.push(E),d--,p())}})()};for(let y=0;y<r&&(p(),!f);y++);})});var B1=m((cOt,i7)=>{l();"use strict";var GP=class extends Error{constructor(e){super(e);this.name="TimeoutError"}},k0e=(t,e,r,i)=>{let n,s=new Promise((o,a)=>{if(typeof e!="number"||e<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(e===1/0){o(t);return}i={customTimers:{setTimeout,clearTimeout},...i},n=i.customTimers.setTimeout.call(void 0,()=>{if(typeof r=="function"){try{o(r())}catch(f){a(f)}return}let c=typeof r=="string"?r:`Promise timed out after ${e} milliseconds`,u=r instanceof Error?r:new GP(c);typeof t.cancel=="function"&&t.cancel(),a(u)},e),(async()=>{try{o(await t)}catch(c){a(c)}finally{i.customTimers.clearTimeout.call(void 0,n)}})()});return s.clear=()=>{clearTimeout(n),n=void 0},s};i7.exports=k0e;i7.exports.default=k0e;i7.exports.TimeoutError=GP});var Ii=m(mi=>{l();"use strict";var $P=Ee(),{sha256:D0e}=(di(),zs),{base58btc:LGe}=(li(),Fs),{Key:qGe}=(Br(),sy),{xor:jGe}=(jm(),qm),{compare:UGe}=(l5(),TA),FGe=HP(),{Record:KGe}=ad(),VGe=it(),zGe=ma(),{fromString:B0e}=(dt(),bi),{toString:N0e}=(tt(),hr),{concat:HGe}=(mn(),$s),M0e=B1();mi.convertBuffer=async t=>(await D0e.digest(t)).digest;mi.convertPeerId=async t=>(await D0e.digest(t.id)).digest;mi.bufferToKey=t=>new qGe("/"+mi.encodeBase32(t),!1);mi.keyForPublicKey=t=>HGe([B0e("/pk/"),t.id]);mi.isPublicKeyKey=t=>N0e(t.slice(0,4))==="/pk/";mi.fromPublicKeyKey=t=>new VGe(t.slice(4));mi.now=()=>Date.now();mi.encodeBase32=t=>N0e(t,"base32");mi.decodeBase32=t=>B0e(t,"base32");mi.sortClosestPeers=async(t,e)=>(await FGe(t,async i=>{let n=await mi.convertPeerId(i);return{peer:i,distance:jGe(n,e)}})).sort(mi.xorCompare).map(i=>i.peer);mi.xorCompare=(t,e)=>UGe(t.distance,e.distance);mi.pathSize=(t,e)=>Math.ceil(t/e);mi.createPutRecord=(t,e)=>{let r=new Date;return new KGe(t,e,r).serialize()};mi.logger=(t,e)=>{let r=["libp2p","dht"];return e&&r.push(e),t&&r.push(`${t.toB58String().slice(0,8)}`),$P.formatters.b=n=>LGe.baseEncode(n),Object.assign($P(r.join(":")),{error:$P(r.concat(["error"]).join(":"))})};mi.TimeoutError=class extends Error{get code(){return"ETIMEDOUT"}};mi.withTimeout=(t,e)=>{async function r(...i){if(!e)return t(...i);let n;try{n=await M0e(t(...i),e)}catch(s){throw s instanceof M0e.TimeoutError?zGe(s,"ETIMEDOUT"):s}return n}return r};mi.mapParallel=async function(t,e){let r=[];for await(let i of t)r.push(e(i));return Promise.all(r)}});var U0e=m((lOt,j0e)=>{l();"use strict";var GGe=w0e(),{xor:$Ge}=(jm(),qm),WGe=_0e(),{sha256:YGe}=(di(),zs),XGe=rc(),QGe=it(),n7=Ii(),L0e=Ee(),Mu=Object.assign(L0e("libp2p:dht:routing-table"),{error:L0e("libp2p:dht:routing-table:error")}),ZGe=c5(),s7=15,q0e=class{constructor(e,{kBucketSize:r,refreshInterval:i}={}){this.peerId=e.peerId,this.dht=e,this._kBucketSize=r||20,this._refreshInterval=i||3e4,this.kb=new GGe({numberOfNodesPerKBucket:this._kBucketSize,numberOfNodesToPing:1}),this.commonPrefixLengthRefreshedAt=[],this._refreshTable=this._refreshTable.bind(this),this._onPing=this._onPing.bind(this)}async start(){this.kb.localNodeId=await n7.convertPeerId(this.peerId),this.kb.on("ping",this._onPing),await this._refreshTable(!0)}async stop(){this._refreshTimeoutId&&clearTimeout(this._refreshTimeoutId)}async _refreshTable(e){Mu("refreshing routing table");let r=this._maxCommonPrefix(),i=this._getTrackedCommonPrefixLengthsForRefresh(r);Mu(`max common prefix length ${r}`),Mu(`tracked CPLs [ ${i.map(n=>`${n.getFullYear()}-${(n.getMonth()+1).toString().padStart(2,"0")}-${n.getDate().toString().padStart(2,"0")} ${n.getHours().toString().padStart(2,"0")}:${n.getMinutes().toString().padStart(2,"0")}:${n.getSeconds().toString().padStart(2,"0")}`).join(", ")} ]`),await Promise.all(i.map(async(n,s)=>{try{if(await this._refreshCommonPrefixLength(s,n,e===!0),this._numPeersForCpl(r)===0){let o=Math.min(2*(s+1),i.length-1);for(let a=s+1;a<o+1;a++)try{await this._refreshCommonPrefixLength(a,n,e===!0)}catch(c){Mu.error(c)}}}catch(o){Mu.error(o)}})),this._refreshTimeoutId=setTimeout(this._refreshTable,this._refreshInterval),this._refreshTimeoutId.unref()}async _refreshCommonPrefixLength(e,r,i){if(!i&&r.getTime()>Date.now()-this._refreshInterval){Mu(`not running refresh for cpl ${e} as time since last refresh not above interval`);return}let n=await this._generateRandomPeerId(e);Mu(`starting refreshing cpl ${e} with key ${n.toB58String()} (routing table size was ${this.kb.count()})`);let s=await ZGe(this.dht.getClosestPeers(n.toBytes(),{}));Mu(`found ${s} peers that were close to imaginary peer ${n.toB58String()}`),Mu(`finished refreshing cpl ${e} with key ${n.toB58String()} (routing table size was ${this.kb.count()})`)}_getTrackedCommonPrefixLengthsForRefresh(e){e>s7&&(e=s7);let r=[];for(let i=0;i<=e;i++)r[i]=this.commonPrefixLengthRefreshedAt[i]||new Date;return r}async _generateRandomPeerId(e){let r=XGe.randomBytes(2),i=(r[1]<<8)+r[0],n=await this._makePeerId(this.kb.localNodeId,i,e);return QGe.createFromBytes(n)}async _makePeerId(e,r,i){if(i>s7)throw new Error(`Cannot generate peer ID for common prefix length greater than ${s7}`);let o=new DataView(e.buffer,e.byteOffset,e.byteLength).getUint16(0,!1)^32768>>i,a=65535<<16-(i+1),c=o&a|r&~a,u=WGe[c],f=new ArrayBuffer(34),d=new DataView(f,0,f.byteLength);return d.setUint8(0,YGe.code),d.setUint8(1,32),d.setUint32(2,u,!1),new Uint8Array(d.buffer,d.byteOffset,d.byteLength)}_maxCommonPrefix(){if(!this.kb.localNodeId)return 0;let e=0;for(let r of this._prefixLengths())r>e&&(e=r);return e}_numPeersForCpl(e){let r=0;for(let i of this._prefixLengths())i===e&&r++;return r}*_prefixLengths(){for(let{id:e}of this.kb.toIterable()){let r=$Ge(this.kb.localNodeId,e),i=0;for(let n of r)if(n===0)i++;else break;yield i}}_onPing(e,r){let i=e[0];i&&this.kb.remove(i.id),this.kb.add(r)}get size(){return this.kb.count()}async find(e){let r=await n7.convertPeerId(e),i=this.closestPeer(r);if(i&&e.equals(i))return i}closestPeer(e){let r=this.closestPeers(e,1);if(r.length>0)return r[0]}closestPeers(e,r){return this.kb.closest(e,r).map(n=>n.peer)}async add(e){let r=await n7.convertPeerId(e);this.kb.add({id:r,peer:e})}async remove(e){let r=await n7.convertPeerId(e);this.kb.remove(r)}};j0e.exports=q0e});var hh=m(hs=>{l();"use strict";var F0e=hs.second=1e3,JGe=hs.minute=60*F0e,WP=hs.hour=60*JGe;hs.MAX_RECORD_AGE=36*WP;hs.PROTOCOL_DHT="/kad/1.0.0";hs.PROVIDERS_KEY_PREFIX="/providers/";hs.PROVIDERS_LRU_CACHE_SIZE=256;hs.PROVIDERS_VALIDITY=24*WP;hs.PROVIDERS_CLEANUP_INTERVAL=WP;hs.READ_MESSAGE_TIMEOUT=10*F0e;hs.GET_MANY_RECORD_COUNT=16;hs.K=20;hs.ALPHA=3});var Um=m((o7,K0e)=>{l();(function(t,e){typeof o7=="object"&&typeof K0e!="undefined"?e(o7):typeof define=="function"&&define.amd?define(["exports"],e):(t=typeof globalThis!="undefined"?globalThis:t||self,e(t.streamingIterables={}))})(o7,function(t){"use strict";async function*e(I,U){let z=[];for await(let N of U)z.push(N),z.length===I&&(yield z,z=[]);z.length>0&&(yield z)}function*r(I,U){let z=[];for(let N of U)z.push(N),z.length===I&&(yield z,z=[]);z.length>0&&(yield z)}function i(I,U){return U===void 0?z=>i(I,z):U[Symbol.asyncIterator]?e(I,U):r(I,U)}function n(I){if(typeof I.next=="function")return I;if(typeof I[Symbol.iterator]=="function")return I[Symbol.iterator]();if(typeof I[Symbol.asyncIterator]=="function")return I[Symbol.asyncIterator]();throw new TypeError('"values" does not to conform to any of the iterator or iterable protocols')}function s(){let I,U;return{promise:new Promise((N,Z)=>{U=N,I=Z}),reject:I,resolve:U}}function o(I,U){let z=n(U),N=[],Z=[],ie=!1,te=!1;function he(){for(;Z.length>0&&N.length>0;){let Pe=Z.shift(),{error:Ve,value:et}=N.shift();Ve?Pe.reject(Ve):Pe.resolve({done:!1,value:et})}for(;Z.length>0&&te;){let{resolve:Pe}=Z.shift();Pe({done:!0,value:void 0})}}async function we(){if(!te&&!ie&&!(N.length>=I)){ie=!0;try{let{done:Pe,value:Ve}=await z.next();Pe?te=!0:N.push({value:Ve})}catch(Pe){te=!0,N.push({error:Pe})}he(),ie=!1,we()}}async function _e(){if(N.length>0){let{error:Ve,value:et}=N.shift();if(Ve)throw Ve;return we(),{done:!1,value:et}}if(te)return{done:!0,value:void 0};let Pe=s();return Z.push(Pe),we(),Pe.promise}let Ke={next:_e,[Symbol.asyncIterator]:()=>Ke};return Ke}function*a(I,U){let z=[],N;try{for(let Z of U)z.push(Z),!(z.length<=I)&&(yield z.shift())}catch(Z){N=Z}for(let Z of z)yield Z;if(N)throw N}function c(I,U){return U===void 0?z=>c(I,z):I===0?U:U[Symbol.asyncIterator]?o(I,U):a(I,U)}async function u(I){let U=[];for await(let z of I)U.push(z);return U}function f(I){return I[Symbol.asyncIterator]?u(I):Array.from(I)}async function*d(I){for await(let U of I)yield*U}function*h(I){for(let U of I)yield*U}function p(...I){return I.find(z=>z[Symbol.asyncIterator]!==void 0)?d(I):h(I)}async function y(I){for await(let U of I);}function b(I){if(I[Symbol.asyncIterator])return y(I);for(let U of I);}async function*E(I,U){for await(let z of U)await I(z)&&(yield z)}function v(I,U){return U===void 0?z=>E(I,z):E(I,U)}async function*A(I){for await(let U of I)U&&typeof U!="string"&&(U[Symbol.iterator]||U[Symbol.asyncIterator])?yield*A(U):yield U}async function*R(I,U){for await(let z of U)yield await I(z)}function F(I,U){return U===void 0?z=>R(I,z):R(I,U)}function D(I,U){return U===void 0?z=>D(I,z):v(z=>z!=null,A(F(I,U)))}function B(I,U,z){let N=n(z),Z=[],ie=[],te=!1,he=!1,we=0,_e=null;function Ke(){for(;ie.length>0&&Z.length>0;){let{resolve:ze}=ie.shift(),mt=Z.shift();ze({done:!1,value:mt})}for(;ie.length>0&&we===0&&te;){let{resolve:ze,reject:mt}=ie.shift();_e?(mt(_e),_e=null):ze({done:!0,value:void 0})}}async function Pe(){if(te){Ke();return}if(!he&&!(we+Z.length>=I)){he=!0,we++;try{let{done:ze,value:mt}=await N.next();ze?(te=!0,we--,Ke()):Ve(mt)}catch(ze){te=!0,we--,_e=ze,Ke()}he=!1,Pe()}}async function Ve(ze){try{let mt=await U(ze);if(mt&&mt[Symbol.asyncIterator])for await(let tr of mt)Z.push(tr);else Z.push(mt)}catch(mt){te=!0,_e=mt}we--,Ke(),Pe()}async function et(){if(Z.length===0){let mt=s();return ie.push(mt),Pe(),mt.promise}let ze=Z.shift();return Pe(),{done:!1,value:ze}}let He={next:et,[Symbol.asyncIterator]:()=>He};return He}function H(I,U,z){return U===void 0?(N,Z)=>Z?H(I,N,Z):H(I,N):z===void 0?N=>H(I,U,N):v(N=>N!=null,A(B(I,U,z)))}async function W(I){return new Promise(U=>{I.once("readable",()=>{U()})})}async function*X(I){for(;;){let U=I.read();if(U!==null){yield U;continue}if(I._readableState.ended)break;await W(I)}}function P(I){return typeof I[Symbol.asyncIterator]=="function"?I:X(I)}async function*g(...I){let U=new Set(I.map(n));for(;U.size>0;)for(let z of U){let N=await z.next();N.done?U.delete(z):yield N.value}}function w(I,...U){let z=I();for(let N of U)z=N(z);return z}async function*S(I,U,z){let N=null,Z=we=>({value:U(we)}),ie=async function*(we){for await(let _e of we){if(N)return;yield _e}},te=w(()=>z,c(1),ie,F(Z),c(I-1)),he=n(te);for(;;){let{value:we,done:_e}=await he.next();if(_e)break;try{let Ke=await we.value;N||(yield Ke)}catch(Ke){N=Ke}}if(N)throw N}function C(I,U,z){return U===void 0?(N,Z)=>C(I,N,Z):z===void 0?N=>C(I,U,N):I===1?F(U,z):S(I,U,z)}function L(I,U,z){return U===void 0?(N,Z)=>Z?L(I,N,Z):L(I,N):z===void 0?N=>L(I,U,N):v(N=>N!=null,A(C(I,U,z)))}async function*Y(...I){let U=I.map(n),z=new Set,N=new Map,Z=null,ie=null,te=null,he=Pe=>{Z=Pe,ie&&ie(Pe)},we=Pe=>{te&&te(Pe)},_e=()=>new Promise((Pe,Ve)=>{if(Z&&Ve(Z),N.size>0)return Pe();te=Pe,ie=Ve}),Ke=Pe=>{let Ve=Promise.resolve(Pe.next()).then(async({done:et,value:He})=>{et||N.set(Pe,He),z.delete(Ve)});z.add(Ve),Ve.then(we,he)};for(let Pe of U)Ke(Pe);for(;;){if(z.size===0&&N.size===0)return;await _e();for(let[Pe,Ve]of N)N.delete(Pe),yield Ve,Ke(Pe)}}async function V(I,U,z){let N=U;for await(let Z of z)N=await I(N,Z);return N}function q(I,U,z){return U===void 0?(N,Z)=>Z?V(I,N,Z):q(I,N):z===void 0?N=>q(I,U,N):V(I,U,z)}async function*_(I,U){let z=0;for await(let N of U)if(yield await N,z++,z>=I)break}function*j(I,U){let z=0;for(let N of U)if(yield N,z++,z>=I)break}function de(I,U){return U===void 0?z=>de(I,z):U[Symbol.asyncIterator]?_(I,U):j(I,U)}async function*Q(I,U){for await(let z of U)await I(z),yield z}function ue(I,U){return U===void 0?z=>Q(I,z):Q(I,U)}function le(I,U){let z=I[0]+U[0],N=I[1]+U[1];if(N>=1e9){let Z=N%1e9;z+=(N-Z)/1e9,N=Z}return[z,N]}async function*me(I,U){let z=U[Symbol.asyncIterator](),N=[0,0];for(;;){let Z=process.hrtime(),{value:ie,done:te}=await z.next(),he=process.hrtime(Z);if(N=le(N,he),I.progress&&I.progress(he,N),te)return I.total&&I.total(N),ie;yield ie}}function*be(I,U){let z=U[Symbol.iterator](),N=[0,0];for(;;){let Z=process.hrtime(),{value:ie,done:te}=z.next(),he=process.hrtime(Z);if(N=le(N,he),I.progress&&I.progress(he,N),te)return I.total&&I.total(N),ie;yield ie}}function xe(I={},U){return U===void 0?z=>xe(I,z):U[Symbol.asyncIterator]!==void 0?me(I,U):be(I,U)}function k(I,U,z){let N=n(z),Z=[],ie=[],te=!1,he=!1,we=0,_e=null;function Ke(){for(;ie.length>0&&Z.length>0;){let{resolve:ze}=ie.shift(),mt=Z.shift();ze({done:!1,value:mt})}for(;ie.length>0&&we===0&&te;){let{resolve:ze,reject:mt}=ie.shift();_e?(mt(_e),_e=null):ze({done:!0,value:void 0})}}async function Pe(){if(te){Ke();return}if(!he&&!(we+Z.length>=I)){he=!0,we++;try{let{done:ze,value:mt}=await N.next();ze?(te=!0,we--,Ke()):Ve(mt)}catch(ze){te=!0,we--,_e=ze,Ke()}he=!1,Pe()}}async function Ve(ze){try{let mt=await U(ze);Z.push(mt)}catch(mt){te=!0,_e=mt}we--,Ke(),Pe()}async function et(){if(Z.length===0){let mt=s();return ie.push(mt),Pe(),mt.promise}let ze=Z.shift();return Pe(),{done:!1,value:ze}}let He={next:et,[Symbol.asyncIterator]:()=>He};return He}function K(I,U,z){return U===void 0?(N,Z)=>Z?K(I,N,Z):K(I,N):z===void 0?N=>K(I,U,N):k(I,U,z)}async function $(I,U){let z=null,N=null,Z=null,ie=_e=>{z=_e,N&&N(_e)},te=()=>{Z&&Z()},he=()=>{I.removeListener("error",ie),I.removeListener("drain",te)};I.once("error",ie);let we=()=>new Promise((_e,Ke)=>{if(z)return Ke(z);I.once("drain",te),Z=_e,N=Ke});for await(let _e of U)if(I.write(_e)===!1&&await we(),z)break;if(he(),z)throw z}function ee(I,U){return U===void 0?z=>$(I,z):$(I,U)}t.batch=i,t.buffer=c,t.collect=f,t.concat=p,t.consume=b,t.filter=v,t.flatMap=D,t.flatTransform=H,t.flatten=A,t.fromStream=P,t.getIterator=n,t.map=F,t.merge=g,t.parallelFlatMap=L,t.parallelMap=C,t.parallelMerge=Y,t.pipeline=w,t.reduce=q,t.take=de,t.tap=ue,t.time=xe,t.transform=K,t.writeToStream=ee,Object.defineProperty(t,"__esModule",{value:!0})})});var z0e=m((hOt,V0e)=>{l();"use strict";var yl=Vi(),N1=yl.Reader,YP=yl.Writer,We=yl.util,ni=yl.roots["libp2p-dht-message"]||(yl.roots["libp2p-dht-message"]={});ni.Record=function(){function t(r){if(r)for(var i=Object.keys(r),n=0;n<i.length;++n)r[i[n]]!=null&&(this[i[n]]=r[i[n]])}t.prototype.key=null,t.prototype.value=null,t.prototype.author=null,t.prototype.signature=null,t.prototype.timeReceived=null;var e;return Object.defineProperty(t.prototype,"_key",{get:We.oneOfGetter(e=["key"]),set:We.oneOfSetter(e)}),Object.defineProperty(t.prototype,"_value",{get:We.oneOfGetter(e=["value"]),set:We.oneOfSetter(e)}),Object.defineProperty(t.prototype,"_author",{get:We.oneOfGetter(e=["author"]),set:We.oneOfSetter(e)}),Object.defineProperty(t.prototype,"_signature",{get:We.oneOfGetter(e=["signature"]),set:We.oneOfSetter(e)}),Object.defineProperty(t.prototype,"_timeReceived",{get:We.oneOfGetter(e=["timeReceived"]),set:We.oneOfSetter(e)}),t.encode=function(i,n){return n||(n=YP.create()),i.key!=null&&Object.hasOwnProperty.call(i,"key")&&n.uint32(10).bytes(i.key),i.value!=null&&Object.hasOwnProperty.call(i,"value")&&n.uint32(18).bytes(i.value),i.author!=null&&Object.hasOwnProperty.call(i,"author")&&n.uint32(26).bytes(i.author),i.signature!=null&&Object.hasOwnProperty.call(i,"signature")&&n.uint32(34).bytes(i.signature),i.timeReceived!=null&&Object.hasOwnProperty.call(i,"timeReceived")&&n.uint32(42).string(i.timeReceived),n},t.decode=function(i,n){i instanceof N1||(i=N1.create(i));for(var s=n===void 0?i.len:i.pos+n,o=new ni.Record;i.pos<s;){var a=i.uint32();switch(a>>>3){case 1:o.key=i.bytes();break;case 2:o.value=i.bytes();break;case 3:o.author=i.bytes();break;case 4:o.signature=i.bytes();break;case 5:o.timeReceived=i.string();break;default:i.skipType(a&7);break}}return o},t.fromObject=function(i){if(i instanceof ni.Record)return i;var n=new ni.Record;return i.key!=null&&(typeof i.key=="string"?We.base64.decode(i.key,n.key=We.newBuffer(We.base64.length(i.key)),0):i.key.length&&(n.key=i.key)),i.value!=null&&(typeof i.value=="string"?We.base64.decode(i.value,n.value=We.newBuffer(We.base64.length(i.value)),0):i.value.length&&(n.value=i.value)),i.author!=null&&(typeof i.author=="string"?We.base64.decode(i.author,n.author=We.newBuffer(We.base64.length(i.author)),0):i.author.length&&(n.author=i.author)),i.signature!=null&&(typeof i.signature=="string"?We.base64.decode(i.signature,n.signature=We.newBuffer(We.base64.length(i.signature)),0):i.signature.length&&(n.signature=i.signature)),i.timeReceived!=null&&(n.timeReceived=String(i.timeReceived)),n},t.toObject=function(i,n){n||(n={});var s={};return i.key!=null&&i.hasOwnProperty("key")&&(s.key=n.bytes===String?We.base64.encode(i.key,0,i.key.length):n.bytes===Array?Array.prototype.slice.call(i.key):i.key,n.oneofs&&(s._key="key")),i.value!=null&&i.hasOwnProperty("value")&&(s.value=n.bytes===String?We.base64.encode(i.value,0,i.value.length):n.bytes===Array?Array.prototype.slice.call(i.value):i.value,n.oneofs&&(s._value="value")),i.author!=null&&i.hasOwnProperty("author")&&(s.author=n.bytes===String?We.base64.encode(i.author,0,i.author.length):n.bytes===Array?Array.prototype.slice.call(i.author):i.author,n.oneofs&&(s._author="author")),i.signature!=null&&i.hasOwnProperty("signature")&&(s.signature=n.bytes===String?We.base64.encode(i.signature,0,i.signature.length):n.bytes===Array?Array.prototype.slice.call(i.signature):i.signature,n.oneofs&&(s._signature="signature")),i.timeReceived!=null&&i.hasOwnProperty("timeReceived")&&(s.timeReceived=i.timeReceived,n.oneofs&&(s._timeReceived="timeReceived")),s},t.prototype.toJSON=function(){return this.constructor.toObject(this,yl.util.toJSONOptions)},t}();ni.Message=function(){function t(r){if(this.closerPeers=[],this.providerPeers=[],r)for(var i=Object.keys(r),n=0;n<i.length;++n)r[i[n]]!=null&&(this[i[n]]=r[i[n]])}t.prototype.type=null,t.prototype.clusterLevelRaw=null,t.prototype.key=null,t.prototype.record=null,t.prototype.closerPeers=We.emptyArray,t.prototype.providerPeers=We.emptyArray;var e;return Object.defineProperty(t.prototype,"_type",{get:We.oneOfGetter(e=["type"]),set:We.oneOfSetter(e)}),Object.defineProperty(t.prototype,"_clusterLevelRaw",{get:We.oneOfGetter(e=["clusterLevelRaw"]),set:We.oneOfSetter(e)}),Object.defineProperty(t.prototype,"_key",{get:We.oneOfGetter(e=["key"]),set:We.oneOfSetter(e)}),Object.defineProperty(t.prototype,"_record",{get:We.oneOfGetter(e=["record"]),set:We.oneOfSetter(e)}),t.encode=function(i,n){if(n||(n=YP.create()),i.type!=null&&Object.hasOwnProperty.call(i,"type")&&n.uint32(8).int32(i.type),i.key!=null&&Object.hasOwnProperty.call(i,"key")&&n.uint32(18).bytes(i.key),i.record!=null&&Object.hasOwnProperty.call(i,"record")&&n.uint32(26).bytes(i.record),i.closerPeers!=null&&i.closerPeers.length)for(var s=0;s<i.closerPeers.length;++s)ni.Message.Peer.encode(i.closerPeers[s],n.uint32(66).fork()).ldelim();if(i.providerPeers!=null&&i.providerPeers.length)for(var s=0;s<i.providerPeers.length;++s)ni.Message.Peer.encode(i.providerPeers[s],n.uint32(74).fork()).ldelim();return i.clusterLevelRaw!=null&&Object.hasOwnProperty.call(i,"clusterLevelRaw")&&n.uint32(80).int32(i.clusterLevelRaw),n},t.decode=function(i,n){i instanceof N1||(i=N1.create(i));for(var s=n===void 0?i.len:i.pos+n,o=new ni.Message;i.pos<s;){var a=i.uint32();switch(a>>>3){case 1:o.type=i.int32();break;case 10:o.clusterLevelRaw=i.int32();break;case 2:o.key=i.bytes();break;case 3:o.record=i.bytes();break;case 8:o.closerPeers&&o.closerPeers.length||(o.closerPeers=[]),o.closerPeers.push(ni.Message.Peer.decode(i,i.uint32()));break;case 9:o.providerPeers&&o.providerPeers.length||(o.providerPeers=[]),o.providerPeers.push(ni.Message.Peer.decode(i,i.uint32()));break;default:i.skipType(a&7);break}}return o},t.fromObject=function(i){if(i instanceof ni.Message)return i;var n=new ni.Message;switch(i.type){case"PUT_VALUE":case 0:n.type=0;break;case"GET_VALUE":case 1:n.type=1;break;case"ADD_PROVIDER":case 2:n.type=2;break;case"GET_PROVIDERS":case 3:n.type=3;break;case"FIND_NODE":case 4:n.type=4;break;case"PING":case 5:n.type=5;break}if(i.clusterLevelRaw!=null&&(n.clusterLevelRaw=i.clusterLevelRaw|0),i.key!=null&&(typeof i.key=="string"?We.base64.decode(i.key,n.key=We.newBuffer(We.base64.length(i.key)),0):i.key.length&&(n.key=i.key)),i.record!=null&&(typeof i.record=="string"?We.base64.decode(i.record,n.record=We.newBuffer(We.base64.length(i.record)),0):i.record.length&&(n.record=i.record)),i.closerPeers){if(!Array.isArray(i.closerPeers))throw TypeError(".Message.closerPeers: array expected");n.closerPeers=[];for(var s=0;s<i.closerPeers.length;++s){if(typeof i.closerPeers[s]!="object")throw TypeError(".Message.closerPeers: object expected");n.closerPeers[s]=ni.Message.Peer.fromObject(i.closerPeers[s])}}if(i.providerPeers){if(!Array.isArray(i.providerPeers))throw TypeError(".Message.providerPeers: array expected");n.providerPeers=[];for(var s=0;s<i.providerPeers.length;++s){if(typeof i.providerPeers[s]!="object")throw TypeError(".Message.providerPeers: object expected");n.providerPeers[s]=ni.Message.Peer.fromObject(i.providerPeers[s])}}return n},t.toObject=function(i,n){n||(n={});var s={};if((n.arrays||n.defaults)&&(s.closerPeers=[],s.providerPeers=[]),i.type!=null&&i.hasOwnProperty("type")&&(s.type=n.enums===String?ni.Message.MessageType[i.type]:i.type,n.oneofs&&(s._type="type")),i.key!=null&&i.hasOwnProperty("key")&&(s.key=n.bytes===String?We.base64.encode(i.key,0,i.key.length):n.bytes===Array?Array.prototype.slice.call(i.key):i.key,n.oneofs&&(s._key="key")),i.record!=null&&i.hasOwnProperty("record")&&(s.record=n.bytes===String?We.base64.encode(i.record,0,i.record.length):n.bytes===Array?Array.prototype.slice.call(i.record):i.record,n.oneofs&&(s._record="record")),i.closerPeers&&i.closerPeers.length){s.closerPeers=[];for(var o=0;o<i.closerPeers.length;++o)s.closerPeers[o]=ni.Message.Peer.toObject(i.closerPeers[o],n)}if(i.providerPeers&&i.providerPeers.length){s.providerPeers=[];for(var o=0;o<i.providerPeers.length;++o)s.providerPeers[o]=ni.Message.Peer.toObject(i.providerPeers[o],n)}return i.clusterLevelRaw!=null&&i.hasOwnProperty("clusterLevelRaw")&&(s.clusterLevelRaw=i.clusterLevelRaw,n.oneofs&&(s._clusterLevelRaw="clusterLevelRaw")),s},t.prototype.toJSON=function(){return this.constructor.toObject(this,yl.util.toJSONOptions)},t.MessageType=function(){var r={},i=Object.create(r);return i[r[0]="PUT_VALUE"]=0,i[r[1]="GET_VALUE"]=1,i[r[2]="ADD_PROVIDER"]=2,i[r[3]="GET_PROVIDERS"]=3,i[r[4]="FIND_NODE"]=4,i[r[5]="PING"]=5,i}(),t.ConnectionType=function(){var r={},i=Object.create(r);return i[r[0]="NOT_CONNECTED"]=0,i[r[1]="CONNECTED"]=1,i[r[2]="CAN_CONNECT"]=2,i[r[3]="CANNOT_CONNECT"]=3,i}(),t.Peer=function(){function r(n){if(this.addrs=[],n)for(var s=Object.keys(n),o=0;o<s.length;++o)n[s[o]]!=null&&(this[s[o]]=n[s[o]])}r.prototype.id=null,r.prototype.addrs=We.emptyArray,r.prototype.connection=null;var i;return Object.defineProperty(r.prototype,"_id",{get:We.oneOfGetter(i=["id"]),set:We.oneOfSetter(i)}),Object.defineProperty(r.prototype,"_connection",{get:We.oneOfGetter(i=["connection"]),set:We.oneOfSetter(i)}),r.encode=function(s,o){if(o||(o=YP.create()),s.id!=null&&Object.hasOwnProperty.call(s,"id")&&o.uint32(10).bytes(s.id),s.addrs!=null&&s.addrs.length)for(var a=0;a<s.addrs.length;++a)o.uint32(18).bytes(s.addrs[a]);return s.connection!=null&&Object.hasOwnProperty.call(s,"connection")&&o.uint32(24).int32(s.connection),o},r.decode=function(s,o){s instanceof N1||(s=N1.create(s));for(var a=o===void 0?s.len:s.pos+o,c=new ni.Message.Peer;s.pos<a;){var u=s.uint32();switch(u>>>3){case 1:c.id=s.bytes();break;case 2:c.addrs&&c.addrs.length||(c.addrs=[]),c.addrs.push(s.bytes());break;case 3:c.connection=s.int32();break;default:s.skipType(u&7);break}}return c},r.fromObject=function(s){if(s instanceof ni.Message.Peer)return s;var o=new ni.Message.Peer;if(s.id!=null&&(typeof s.id=="string"?We.base64.decode(s.id,o.id=We.newBuffer(We.base64.length(s.id)),0):s.id.length&&(o.id=s.id)),s.addrs){if(!Array.isArray(s.addrs))throw TypeError(".Message.Peer.addrs: array expected");o.addrs=[];for(var a=0;a<s.addrs.length;++a)typeof s.addrs[a]=="string"?We.base64.decode(s.addrs[a],o.addrs[a]=We.newBuffer(We.base64.length(s.addrs[a])),0):s.addrs[a].length&&(o.addrs[a]=s.addrs[a])}switch(s.connection){case"NOT_CONNECTED":case 0:o.connection=0;break;case"CONNECTED":case 1:o.connection=1;break;case"CAN_CONNECT":case 2:o.connection=2;break;case"CANNOT_CONNECT":case 3:o.connection=3;break}return o},r.toObject=function(s,o){o||(o={});var a={};if((o.arrays||o.defaults)&&(a.addrs=[]),s.id!=null&&s.hasOwnProperty("id")&&(a.id=o.bytes===String?We.base64.encode(s.id,0,s.id.length):o.bytes===Array?Array.prototype.slice.call(s.id):s.id,o.oneofs&&(a._id="id")),s.addrs&&s.addrs.length){a.addrs=[];for(var c=0;c<s.addrs.length;++c)a.addrs[c]=o.bytes===String?We.base64.encode(s.addrs[c],0,s.addrs[c].length):o.bytes===Array?Array.prototype.slice.call(s.addrs[c]):s.addrs[c]}return s.connection!=null&&s.hasOwnProperty("connection")&&(a.connection=o.enums===String?ni.Message.ConnectionType[s.connection]:s.connection,o.oneofs&&(a._connection="connection")),a},r.prototype.toJSON=function(){return this.constructor.toObject(this,yl.util.toJSONOptions)},r}(),t}();V0e.exports=ni});var Dc=m((pOt,W0e)=>{l();"use strict";var e$e=it(),{Multiaddr:t$e}=rt(),{Record:r$e}=ad(),a7=z0e(),i$e=a7.Message.MessageType,H0e=a7.Message.ConnectionType,M1=class{constructor(e,r,i){if(r&&!(r instanceof Uint8Array))throw new Error("Key must be a Uint8Array");this.type=e,this.key=r,this._clusterLevelRaw=i,this.closerPeers=[],this.providerPeers=[],this.record=void 0}get clusterLevel(){let e=this._clusterLevelRaw-1;return e<0?0:e}set clusterLevel(e){this._clusterLevelRaw=e}serialize(){let e={key:this.key,type:this.type,clusterLevelRaw:this._clusterLevelRaw,closerPeers:this.closerPeers.map(G0e),providerPeers:this.providerPeers.map(G0e),record:void 0};return this.record&&(this.record instanceof Uint8Array?e.record=this.record:e.record=this.record.serialize()),a7.Message.encode(e).finish()}static deserialize(e){let r=a7.Message.decode(e),i=new M1(r.type||0,r.key||Uint8Array.from([]),r.clusterLevelRaw||0);return i.closerPeers=r.closerPeers.map($0e),i.providerPeers=r.providerPeers.map($0e),r.record&&r.record.length&&(i.record=r$e.deserialize(r.record)),i}};M1.TYPES=i$e;M1.CONNECTION_TYPES=H0e;function G0e(t){return{id:t.id.id,addrs:(t.multiaddrs||[]).map(r=>r.bytes),connection:H0e.CONNECTED}}function $0e(t){return{id:new e$e(t.id),multiaddrs:(t.addrs||[]).map(e=>new t$e(e))}}W0e.exports=M1});var Q0e=m((yOt,X0e)=>{l();"use strict";var{Record:n$e}=ad(),s$e=ma(),Y0e=Dc(),XP=Ii();X0e.exports=t=>{let e=XP.logger(t.peerId,"rpc:get-value");async function r(i,n){let s=n.key;if(e("key: %b",s),!s||s.length===0)throw s$e(new Error("Invalid key"),"ERR_INVALID_KEY");let o=new Y0e(Y0e.TYPES.GET_VALUE,s,n.clusterLevel);if(XP.isPublicKeyKey(s)){e("is public key");let u=XP.fromPublicKeyKey(s),f;if(t._isSelf(u))f=t.peerId;else{let d=t.peerStore.get(u);f=d&&d.id}if(f&&f.pubKey)return e("returning found public key"),o.record=new n$e(s,f.pubKey.bytes),o}let[a,c]=await Promise.all([t._checkLocalDatastore(s),t._betterPeersToQuery(n,i)]);return a&&(e("got record"),o.record=a),c.length>0&&(e("got closer %s",c.length),o.closerPeers=c),o}return r}});var epe=m((gOt,J0e)=>{l();"use strict";var Z0e=Ii(),o$e=ma();J0e.exports=t=>{let e=Z0e.logger(t.peerId,"rpc:put-value");async function r(i,n){let s=n.key;e("key: %b",s);let o=n.record;if(!o){let c=`Empty record from: ${i.toB58String()}`;throw e.error(c),o$e(new Error(c),"ERR_EMPTY_RECORD")}await t._verifyRecordLocally(o),o.timeReceived=new Date;let a=Z0e.bufferToKey(o.key);return await t.datastore.put(a,o.serialize()),t.onPut(o,i),n}return r}});var rpe=m((mOt,tpe)=>{l();"use strict";var{equals:a$e}=(wi(),bn),c$e=Dc(),u$e=Ii();tpe.exports=t=>{let e=u$e.logger(t.peerId,"rpc:find-node");async function r(i,n){e("start");let s;a$e(n.key,t.peerId.id)?s=[{id:t.peerId,multiaddrs:t.libp2p.multiaddrs}]:s=await t._betterPeersToQuery(n,i);let o=new c$e(n.type,new Uint8Array(0),n.clusterLevel);return s.length>0?o.closerPeers=s:e("handle FindNode %s: could not find anything",i.toB58String()),o}return r}});var spe=m((bOt,npe)=>{l();"use strict";var{CID:f$e}=(Te(),Xu),ipe=ma(),l$e=Ii();npe.exports=t=>{let e=l$e.logger(t.peerId,"rpc:add-provider");async function r(i,n){if(e("start"),!n.key||n.key.length===0)throw ipe(new Error("Missing key"),"ERR_MISSING_KEY");let s;try{s=f$e.decode(n.key)}catch(o){let a=`Invalid CID: ${o.message}`;throw ipe(new Error(a),"ERR_INVALID_CID")}return n.providerPeers.forEach(o=>{if(!o.id.isEqual(i)){e("invalid provider peer %s from %s",o.id.toB58String(),i.toB58String());return}if(o.multiaddrs.length<1){e("no valid addresses for provider %s. Ignore",i.toB58String());return}if(e("received provider %s for %s (addrs %s)",i.toB58String(),s.toString(),o.multiaddrs.map(a=>a.toString())),!t._isSelf(o.id))return t.peerStore.addressBook.add(o.id,o.multiaddrs),t.providers.addProvider(s,o.id)}),t.providers.addProvider(s,i)}return r}});var cpe=m((vOt,ape)=>{l();"use strict";var{CID:d$e}=(Te(),Xu),h$e=ma(),p$e=Dc(),ope=Ii();ape.exports=t=>{let e=ope.logger(t.peerId,"rpc:get-providers");async function r(i,n){let s;try{s=d$e.decode(n.key)}catch(p){throw h$e(new Error(`Invalid CID: ${p.message}`),"ERR_INVALID_CID")}e("%s",s.toString());let o=ope.bufferToKey(s.bytes),[a,c,u]=await Promise.all([t.datastore.has(o),t.providers.getProviders(s),t._betterPeersToQuery(n,i)]),f=c.map(p=>({id:p,multiaddrs:[]})),d=u.map(p=>({id:p.id,multiaddrs:[]}));a&&f.push({id:t.peerId,multiaddrs:[]});let h=new p$e(n.type,n.key,n.clusterLevel);return f.length>0&&(h.providerPeers=f),d.length>0&&(h.closerPeers=d),e("got %s providers %s closerPeers",f.length,d.length),h}return r}});var fpe=m((wOt,upe)=>{l();"use strict";var y$e=Ii();upe.exports=t=>{let e=y$e.logger(t.peerId,"rpc:ping");function r(i,n){return e("from %s",i.toB58String()),n}return r}});var dpe=m((_Ot,lpe)=>{l();"use strict";var L1=Dc().TYPES;lpe.exports=t=>{let e={[L1.GET_VALUE]:Q0e()(t),[L1.PUT_VALUE]:epe()(t),[L1.FIND_NODE]:rpe()(t),[L1.ADD_PROVIDER]:spe()(t),[L1.GET_PROVIDERS]:cpe()(t),[L1.PING]:fpe()(t)};function r(i){return e[i]}return r}});var ype=m((EOt,ppe)=>{l();"use strict";var{pipe:g$e}=Nr(),hpe=fa(),m$e=Dc(),b$e=dpe(),v$e=Ii();ppe.exports=t=>{let e=v$e.logger(t.peerId,"rpc"),r=b$e(t);async function i(s,o){let a=r(o.type);try{await t._add(s)}catch(c){e.error("Failed to update the kbucket store",c)}if(!a){e.error(`no handler found for message type: ${o.type}`);return}return a(s,o)}async function n({stream:s,connection:o}){let a=o.remotePeer;try{await t._add(a)}catch(u){e.error(u)}let c=a.toB58String();e("from: %s",c),await g$e(s.source,hpe.decode(),u=>async function*(){for await(let f of u){let d=m$e.deserialize(f.slice()),h=await i(a,d);h&&(yield h.serialize())}}(),hpe.encode(),s.sink)}return n}});var vpe=m((SOt,bpe)=>{l();"use strict";var c7=ma(),{pipe:gpe}=Nr(),QP=fa(),w$e=B1(),{consume:_$e}=Um(),E$e=Sd(),S$e=b8(),x$e=ype(),A$e=hh(),I$e=Dc(),T$e=Ii(),mpe=class{constructor(e){this.dht=e,this.readMessageTimeout=A$e.READ_MESSAGE_TIMEOUT,this._log=T$e.logger(this.dht.peerId,"net"),this._rpc=x$e(this.dht),this._onPeerConnected=this._onPeerConnected.bind(this),this._running=!1}start(){if(this._running)return;if(!this.dht.isStarted)throw c7(new Error("Can not start network"),"ERR_CANNOT_START_NETWORK");this._running=!0,this.dht._clientMode===!1&&this.dht.registrar.handle(this.dht.protocol,this._rpc);let e=new S$e({multicodecs:[this.dht.protocol],handlers:{onConnect:this._onPeerConnected,onDisconnect:()=>{}}});this._registrarId=this.dht.registrar.register(e)}stop(){!this.dht.isStarted&&!this.isStarted||(this._running=!1,this._registrarId&&this.dht.registrar.unregister(this._registrarId))}get isStarted(){return this._running}get isConnected(){return this.dht.isStarted&&this.isStarted}async _onPeerConnected(e){await this.dht._add(e),this._log("added to the routing table: %s",e.toB58String())}async sendRequest(e,r){if(!this.isConnected)throw c7(new Error("Network is offline"),"ERR_NETWORK_OFFLINE");let i=e.toB58String();this._log("sending to: %s",i);let n=this.dht.registrar.connectionManager.get(e);n||(n=await this.dht.dialer.connectToPeer(e));let{stream:s}=await n.newStream(this.dht.protocol);return this._writeReadMessage(s,r.serialize())}async sendMessage(e,r){if(!this.isConnected)throw c7(new Error("Network is offline"),"ERR_NETWORK_OFFLINE");let i=e.toB58String();this._log("sending to: %s",i);let n=this.dht.registrar.connectionManager.get(e);n||(n=await this.dht.dialer.connectToPeer(e));let{stream:s}=await n.newStream(this.dht.protocol);return this._writeMessage(s,r.serialize())}async _writeReadMessage(e,r){return w$e(R$e(e,r),this.readMessageTimeout)}_writeMessage(e,r){return gpe([r],QP.encode(),e,_$e)}};async function R$e(t,e){let r=await gpe([e],QP.encode(),t,QP.decode(),async i=>{let n=await E$e(i);if(n)return n.slice()});if(r.length===0)throw c7(new Error("No message received"),"ERR_NO_MESSAGE_RECEIVED");return I$e.deserialize(r)}bpe.exports=mpe});var Ape=m((xOt,xpe)=>{l();"use strict";var wpe=Ii(),P$e=HP(),{equals:C$e}=(wi(),bn),{compare:_pe}=(l5(),TA),{xor:Epe}=(jm(),qm),Spe=class{constructor(e,r){this.originDhtKey=e,this.capacity=r,this.peerDistances=[]}get length(){return this.peerDistances.length}get peers(){return this.peerDistances.map(e=>e.peerId)}async add(e){if(this.peerDistances.find(n=>C$e(n.peerId.id,e.id)))return;let r=await wpe.convertPeerId(e),i={peerId:e,distance:Epe(this.originDhtKey,r)};this.peerDistances.push(i),this.peerDistances.sort((n,s)=>_pe(n.distance,s.distance)),this.peerDistances=this.peerDistances.slice(0,this.capacity)}async anyCloser(e){if(!e.length)return!1;if(!this.length)return!0;let r=await P$e(e,n=>wpe.convertPeerId(n)),i=this.peerDistances[this.peerDistances.length-1].distance;for(let n of r){let s=Epe(this.originDhtKey,n);if(_pe(s,i)<0)return!0}return!1}};xpe.exports=Spe});var Tpe=m((ZP,Ipe)=>{l();(function(){var t,e,r,i,n,s,o,a,c,u,f,d,h,p,y;r=Math.floor,u=Math.min,e=function(b,E){return b<E?-1:b>E?1:0},c=function(b,E,v,A,R){var F;if(v==null&&(v=0),R==null&&(R=e),v<0)throw new Error("lo must be non-negative");for(A==null&&(A=b.length);v<A;)F=r((v+A)/2),R(E,b[F])<0?A=F:v=F+1;return[].splice.apply(b,[v,v-v].concat(E)),E},s=function(b,E,v){return v==null&&(v=e),b.push(E),p(b,0,b.length-1,v)},n=function(b,E){var v,A;return E==null&&(E=e),v=b.pop(),b.length?(A=b[0],b[0]=v,y(b,0,E)):A=v,A},a=function(b,E,v){var A;return v==null&&(v=e),A=b[0],b[0]=E,y(b,0,v),A},o=function(b,E,v){var A;return v==null&&(v=e),b.length&&v(b[0],E)<0&&(A=[b[0],E],E=A[0],b[0]=A[1],y(b,0,v)),E},i=function(b,E){var v,A,R,F,D,B,H,W;for(E==null&&(E=e),B=function(){W=[];for(var X=0,P=r(b.length/2);0<=P?X<P:X>P;0<=P?X++:X--)W.push(X);return W}.apply(this).reverse(),H=[],A=0,F=B.length;A<F;A++)v=B[A],H.push(y(b,v,E));return H},h=function(b,E,v){var A;if(v==null&&(v=e),A=b.indexOf(E),A!==-1)return p(b,0,A,v),y(b,A,v)},f=function(b,E,v){var A,R,F,D,B;if(v==null&&(v=e),R=b.slice(0,E),!R.length)return R;for(i(R,v),B=b.slice(E),F=0,D=B.length;F<D;F++)A=B[F],o(R,A,v);return R.sort(v).reverse()},d=function(b,E,v){var A,R,F,D,B,H,W,X,P,g;if(v==null&&(v=e),E*10<=b.length){if(D=b.slice(0,E).sort(v),!D.length)return D;for(F=D[D.length-1],X=b.slice(E),B=0,W=X.length;B<W;B++)A=X[B],v(A,F)<0&&(c(D,A,0,null,v),D.pop(),F=D[D.length-1]);return D}for(i(b,v),g=[],R=H=0,P=u(E,b.length);0<=P?H<P:H>P;R=0<=P?++H:--H)g.push(n(b,v));return g},p=function(b,E,v,A){var R,F,D;for(A==null&&(A=e),R=b[v];v>E;){if(D=v-1>>1,F=b[D],A(R,F)<0){b[v]=F,v=D;continue}break}return b[v]=R},y=function(b,E,v){var A,R,F,D,B;for(v==null&&(v=e),R=b.length,B=E,F=b[E],A=2*E+1;A<R;)D=A+1,D<R&&!(v(b[A],b[D])<0)&&(A=D),b[E]=b[A],E=A,A=2*E+1;return b[E]=F,p(b,B,E,v)},t=function(){b.push=s,b.pop=n,b.replace=a,b.pushpop=o,b.heapify=i,b.updateItem=h,b.nlargest=f,b.nsmallest=d;function b(E){this.cmp=E??e,this.nodes=[]}return b.prototype.push=function(E){return s(this.nodes,E,this.cmp)},b.prototype.pop=function(){return n(this.nodes,this.cmp)},b.prototype.peek=function(){return this.nodes[0]},b.prototype.contains=function(E){return this.nodes.indexOf(E)!==-1},b.prototype.replace=function(E){return a(this.nodes,E,this.cmp)},b.prototype.pushpop=function(E){return o(this.nodes,E,this.cmp)},b.prototype.heapify=function(){return i(this.nodes,this.cmp)},b.prototype.updateItem=function(E){return h(this.nodes,E,this.cmp)},b.prototype.clear=function(){return this.nodes=[]},b.prototype.empty=function(){return this.nodes.length===0},b.prototype.size=function(){return this.nodes.length},b.prototype.clone=function(){var E;return E=new b,E.nodes=this.nodes.slice(0),E},b.prototype.toArray=function(){return this.nodes.slice(0)},b.prototype.insert=b.prototype.push,b.prototype.top=b.prototype.peek,b.prototype.front=b.prototype.peek,b.prototype.has=b.prototype.contains,b.prototype.copy=b.prototype.clone,b}(),function(b,E){return typeof define=="function"&&define.amd?define([],E):typeof ZP=="object"?Ipe.exports=E():b.Heap=E()}(this,function(){return t})}).call(ZP)});var Ppe=m((AOt,Rpe)=>{l();Rpe.exports=Tpe()});var Ope=m((IOt,Cpe)=>{l();"use strict";var O$e=Ppe(),{xor:k$e}=(jm(),qm),D$e=Ee(),u7=Ii(),JP=D$e("libp2p:dht:peer-queue"),Fm=class{static async fromPeerId(e){let r=await u7.convertPeerId(e);return new Fm(r)}static async fromKey(e){let r=await u7.convertBuffer(e);return new Fm(r)}constructor(e){JP("create: %b",e),this.from=e,this.heap=new O$e(u7.xorCompare)}async enqueue(e){JP("enqueue %s",e.toB58String());let r=await u7.convertPeerId(e),i={id:e,distance:k$e(this.from,r)};this.heap.push(i)}dequeue(){let e=this.heap.pop();return JP("dequeue %s",e.id.toB58String()),e.id}get length(){return this.heap.size()}};Cpe.exports=Fm});var Bpe=m((TOt,Dpe)=>{l();"use strict";var B$e=Ope(),N$e=Ii(),M$e=3e4,kpe=class{constructor(e,r){if(this.run=e,this.queryFunc=N$e.withTimeout(r,M$e),!this.queryFunc)throw new Error("Path requires a `queryFn` to be specified");if(typeof this.queryFunc!="function")throw new Error("Path expected `queryFn` to be a function. Got "+typeof this.queryFunc);this.initialPeers=[],this.peersToQuery=null,this.res=null}addInitialPeer(e){this.initialPeers.push(e)}async execute(){let e=await B$e.fromKey(this.run.query.key);this.peersToQuery=e,await Promise.all(this.initialPeers.map(r=>this.addPeerToQuery(r))),await this.run.workerQueue(this)}async addPeerToQuery(e){this.run.query.dht._isSelf(e)||this.run.peersSeen.has(e.toB58String())||this.peersToQuery&&await this.peersToQuery.enqueue(e)}};Dpe.exports=kpe});var Lpe=m((ROt,Mpe)=>{l();"use strict";var{default:L$e}=Yc(),Npe=class{constructor(e,r,i,n){this.dht=e,this.run=r,this.path=i,this.log=n,this.concurrency=this.dht.concurrency,this.queue=this.setupQueue(),this.execution=null,this.queuedPeerIds=new Set}setupQueue(){let e=new L$e({concurrency:this.concurrency});return e.on("idle",()=>{this.path.peersToQuery&&!this.path.peersToQuery.length&&(this.log("queue:drain"),this.stop())}),e.on("next",()=>{!this.running||e.pending<this.concurrency&&this.fill()}),e}stop(e){!this.running||(this.running=!1,this.queue.clear(),this.log("worker:stop, %d workers still running",this.run.workers.filter(r=>r.running).length),this.execution&&(e?this.execution.reject(e):this.execution.resolve()))}async execute(){this.running=!0,this.execution=null;let e=new Promise((r,i)=>{this.execution={resolve:r,reject:i}});this.fill(),await e}fill(){if(!!this.path.peersToQuery)for(;this.queue.pending+this.queue.size<this.concurrency&&this.path.peersToQuery.length>0;){let e=this.path.peersToQuery.dequeue();this.queuedPeerIds.add(e),this.queue.add(()=>this.processNext(e).catch(r=>{this.log.error("queue",r),this.stop(r)}).finally(()=>{this.queuedPeerIds.delete(e)}))}}async processNext(e){if(!this.running||this.run.peersSeen.has(e.toB58String()))return;let r,i;try{r=await this.run.continueQuerying(this)}catch(o){i=o}if(!this.running)return;if(i)throw i;if(!r){this.stop();return}if(this.run.peersSeen.has(e.toB58String()))return;this.run.peersSeen.add(e.toB58String()),this.log("queue:work");let n,s;try{n=await this.execQuery(e)}catch(o){s=o}if(!!this.running){if(this.log("queue:work:done",s,n),s)throw s;if(n&&n.queryComplete){this.log("query:complete"),this.run.stop();return}n&&n.pathComplete&&this.stop()}}async execQuery(e){let r,i;try{r=await this.path.queryFunc(e)}catch(n){i=n}if(!!this.running){if(i){this.run.errors.push(i);return}if(this.run.peersQueried&&await this.run.peersQueried.add(e),!!r){if(r.pathComplete||r.queryComplete)return this.path.res=r,{pathComplete:r.pathComplete,queryComplete:r.queryComplete};if(r.closerPeers&&r.closerPeers.length>0){let n=async s=>{this.dht._isSelf(s.id)||(this.dht._peerDiscovered(s.id,s.multiaddrs),await this.path.addPeerToQuery(s.id))};await Promise.all(r.closerPeers.map(n))}}}}};Mpe.exports=Npe});var Upe=m((POt,jpe)=>{l();"use strict";var q$e=Ape(),j$e=br(),U$e=Bpe(),F$e=Lpe(),K$e=Ii(),qpe=class extends j$e{constructor(e){super();this.query=e,this.running=!1,this.workers=[],this.peersSeen=new Set,this.errors=[],this.peersQueried=null}stop(){if(!!this.running){this.running=!1;for(let e of this.workers)e.stop()}}async execute(e){let r=[],i=Math.min(this.query.dht.disjointPaths,e.length);for(let s=0;s<i;s++)r.push(new U$e(this,this.query.makePath(s,i)));e.forEach((s,o)=>{r[o%i].addInitialPeer(s)}),await this.executePaths(r);let n={finalSet:new Set(this.peersQueried&&this.peersQueried.peers),paths:[]};for(let s of r)s.res&&(s.res.pathComplete||s.res.queryComplete)&&(s.res.success=!0,n.paths.push(s.res));return n}async executePaths(e){this.running=!0,this.emit("start");try{await Promise.all(e.map(r=>r.execute()))}finally{this.stop(),this.emit("complete")}if(this.errors.length===this.peersSeen.size)throw this.errors[0]}async workerQueue(e){await this.init(),await this.startWorker(e)}async startWorker(e){let r=new F$e(this.query.dht,this,e,this.query._log);this.workers.push(r),await r.execute()}async init(){if(!this.peersQueried){if(this.peersQueriedPromise){await this.peersQueriedPromise;return}this.peersQueriedPromise=(async()=>{let e=await K$e.convertBuffer(this.query.key);this.peersQueried=new q$e(e,this.query.dht.kBucketSize)})(),await this.peersQueriedPromise,delete this.peersQueriedPromise}}async continueQuerying(e){if(this.peersQueried&&this.peersQueried.length<this.peersQueried.capacity)return!0;let r=Array.from(e.queuedPeerIds);return!!(this.peersQueried&&await this.peersQueried.anyCloser(r))}};jpe.exports=qpe});var f7=m((COt,Kpe)=>{l();"use strict";var{base58btc:V$e}=(li(),Fs),z$e=Ii(),H$e=Upe(),Fpe=class{constructor(e,r,i){this.dht=e,this.key=r,this.makePath=i,this._log=z$e.logger(this.dht.peerId,"query:"+V$e.baseEncode(r)),this.running=!1,this._onStart=this._onStart.bind(this),this._onComplete=this._onComplete.bind(this)}async run(e){return this.dht._queryManager.running?e.length===0?(this._log.error("Running query with no peers"),{finalSet:new Set,paths:[]}):(this._run=new H$e(this),this._log(`query running with K=${this.dht.kBucketSize}, A=${this.dht.concurrency}, D=${Math.min(this.dht.disjointPaths,e.length)}`),this._run.once("start",this._onStart),this._run.once("complete",this._onComplete),this._run.execute(e)):(this._log.error("Attempt to run query after shutdown"),{finalSet:new Set,paths:[]})}_onStart(){this.running=!0,this._startTime=Date.now(),this._log("query:start"),this.dht._queryManager.queryStarted(this)}_onComplete(){this.stop()}stop(){this._log(`query:done in ${Date.now()-(this._startTime||0)}ms`),this._run&&this._log(`${this._run.errors.length} of ${this._run.peersSeen.size} peers errored (${this._run.errors.length/this._run.peersSeen.size*100}% fail rate)`),!!this.running&&(this.running=!1,this._run&&(this._run.removeListener("start",this._onStart),this._run.removeListener("complete",this._onComplete),this._run.stop()),this.dht._queryManager.queryCompleted(this))}};Kpe.exports=Fpe});var Gpe=m((OOt,Hpe)=>{l();"use strict";var eC=ma(),G$e=B1(),{equals:$$e}=(wi(),bn),{toString:Vpe}=(tt(),hr),zpe=ad(),tC=hh(),W$e=f7(),ph=Ii(),Y$e=zpe.Record;Hpe.exports=t=>{let e=async(n,s)=>t.datastore.put(ph.bufferToKey(n),s),r=async n=>{t._log(`getLocal ${Vpe(n,"base32")}`);let s=await t.datastore.get(ph.bufferToKey(n));t._log(`found ${Vpe(n,"base32")} in local datastore`);let o=Y$e.deserialize(s);return await t._verifyRecordLocally(o),o},i=async(n,s,o)=>{let a=await ph.createPutRecord(n,o);return Promise.all(s.map(async c=>{if(!$$e(c.val,o)){if(t._isSelf(c.from)){try{await t._putLocal(n,a)}catch(u){t._log.error("Failed error correcting self",u)}return}try{await t._putValueToPeer(n,a,c.from)}catch(u){t._log.error("Failed error correcting entry",u)}}}))};return{async _putLocal(n,s){return e(n,s)},async put(n,s,o={}){t._log("PutValue %b",n);let a=await ph.createPutRecord(n,s);await e(n,a);let c=0,u=0;await ph.mapParallel(t.getClosestPeers(n,{shallow:!0}),async d=>{try{c+=1,await t._putValueToPeer(n,a,d),u+=1}catch(h){t._log.error("Failed to put to peer (%b): %s",d.id,h)}});let f=o.minPeers||c;if(f>u){let d=eC(new Error(`Failed to put value to enough peers: ${u}/${f}`),"ERR_NOT_ENOUGH_PUT_PEERS");throw t._log.error(d),d}},async get(n,s={}){s.timeout=s.timeout||tC.minute,t._log("_get %b",n);let o=await t.getMany(n,tC.GET_MANY_RECORD_COUNT,s),a=o.map(f=>f.val),c=0;try{c=zpe.selection.bestRecord(t.selectors,n,a)}catch(f){if(f.code!=="ERR_NO_SELECTOR_FUNCTION_FOR_RECORD_KEY")throw f}let u=a[c];if(t._log("GetValue %b %s",n,u),!u)throw eC(new Error("best value was not found"),"ERR_NOT_FOUND");return await i(n,o,u),u},async getMany(n,s,o={}){o.timeout=o.timeout||tC.minute,t._log("getMany %b (%s)",n,s);let a=[],c;try{c=await r(n)}catch(y){if(s===0)throw y}if(c&&a.push({val:c.value,from:t.peerId}),a.length>=s)return a;let u=await ph.convertBuffer(n),f=t.routingTable.closestPeers(u,t.kBucketSize);if(t._log("peers in rt: %d",f.length),f.length===0){let y="Failed to lookup key! No peers from routing table!";if(t._log.error(y),a.length===0)throw eC(new Error(y),"ERR_NO_PEERS_IN_ROUTING_TABLE");return a}let d=a.length;function h(y,b){let E=ph.pathSize(s-d,b),v=0;async function A(R){let F,D,B;try{let W=await t._getValueOrPeers(R,n);F=W.record,D=W.peers}catch(W){if(W.code!=="ERR_INVALID_RECORD")throw W;B=W}let H={closerPeers:D};return F&&F.value?(a.push({val:F.value,from:R}),v++):B&&(a.push({err:B,from:R}),v++),v>=E&&(H.pathComplete=!0),H}return A}let p=new W$e(t,n,h);try{await G$e(p.run(f),o.timeout)}catch(y){if(a.length===0)throw y}finally{p.stop()}return a}}}});var Ype=m((kOt,Wpe)=>{l();"use strict";var $pe=class{constructor(){this.list=[]}push(e){return this.has(e.id)?!1:(this.list.push(e),!0)}has(e){let r=this.list.find(i=>i.id.equals(e));return Boolean(r)}toArray(){return this.list.slice()}pop(){return this.list.pop()}get length(){return this.list.length}};Wpe.exports=$pe});var Zpe=m((DOt,Qpe)=>{l();"use strict";var X$e=Ype(),Xpe=class extends X$e{constructor(e){super();this.limit=e}push(e){return this.length<this.limit?super.push(e):!1}};Qpe.exports=Xpe});var n1e=m((BOt,i1e)=>{l();"use strict";var Q$e=ma(),Jpe=B1(),e1e=hh(),t1e=Zpe(),l7=Dc(),Z$e=f7(),r1e=Ii();i1e.exports=t=>{let e=async(r,i)=>{let n=new l7(l7.TYPES.GET_PROVIDERS,i.bytes,0);return t.network.sendRequest(r,n)};return{async provide(r){t._log(`provide: ${r}`);let i=[];await t.providers.addProvider(r,t.peerId);let n=t.libp2p?t.libp2p.multiaddrs:[],s=new l7(l7.TYPES.ADD_PROVIDER,r.bytes,0);s.providerPeers=[{id:t.peerId,multiaddrs:n}];async function o(a){t._log(`putProvider ${r} to ${a.toB58String()}`);try{await t.network.sendMessage(a,s)}catch(c){i.push(c)}}if(await r1e.mapParallel(t.getClosestPeers(r.bytes),o),i.length)throw Q$e(new Error(`Failed to provide to ${i.length} of ${t.kBucketSize} peers`),"ERR_SOME_PROVIDES_FAILED",{errors:i})},async*findProviders(r,i={timeout:6e4,maxNumProviders:5}){let n=i.timeout||e1e.minute,s=i.maxNumProviders||e1e.K;t._log(`findProviders ${r}`);let o=new t1e(s);if((await t.providers.getProviders(r)).forEach(h=>{let p=t.peerStore.get(h);p?o.push({id:p.id,multiaddrs:p.addresses.map(y=>y.multiaddr)}):o.push({id:h,multiaddrs:[]})}),o.length>=s){for(let h of o.toArray())yield h;return}let c=[];function u(h,p){let y=r1e.pathSize(s-o.length,p),b=new t1e(y);c.push(b);async function E(v){let A=await e(v,r),R=A.providerPeers;return t._log(`Found ${R.length} provider entries for ${r}`),R.forEach(F=>{b.push({...F})}),b.length>=y?{pathComplete:!0}:{closerPeers:A.closerPeers}}return E}let f=new Z$e(t,r.bytes,u),d=t.routingTable.closestPeers(r.bytes,t.kBucketSize);try{await Jpe(f.run(d),n)}catch(h){if(h.name!==Jpe.TimeoutError.name)throw h}finally{f.stop()}c.forEach(h=>{h.toArray().forEach(p=>{o.push(p)})});for(let h of o.toArray())yield h}}}});var a1e=m((NOt,o1e)=>{l();"use strict";var Km=ma(),J$e=B1(),rC=it(),eWe=rc(),{toString:tWe}=(tt(),hr),rWe=hh(),d7=Dc(),s1e=f7(),Vm=Ii();o1e.exports=t=>{let e=async s=>{t._log(`findPeerLocal ${s.toB58String()}`);let o=await t.routingTable.find(s),a=o&&t.peerStore.get(o);if(a)return{id:a.id,multiaddrs:a.addresses.map(c=>c.multiaddr)}},r=async(s,o)=>{let a=new d7(d7.TYPES.GET_VALUE,o,0);return t.network.sendRequest(s,a)},i=async(s,o)=>(t._log(`closerPeersSingle ${tWe(s,"base32")} from ${o.toB58String()}`),(await t.peerRouting._findPeerSingle(o,new rC(s))).closerPeers.filter(c=>!t._isSelf(c.id)).map(c=>(t.peerStore.addressBook.add(c.id,c.multiaddrs),c))),n=async s=>{let o=Vm.keyForPublicKey(s),a=await r(s,o);if(!a.record||!a.record.value)throw Km(new Error(`Node not responding with its public key: ${s.toB58String()}`),"ERR_INVALID_RECORD");let c=await rC.createFromPubKey(a.record.value);if(!c.equals(s))throw Km(new Error("public key does not match id"),"ERR_PUBLIC_KEY_DOES_NOT_MATCH_ID");return c.pubKey};return{async _findPeerSingle(s,o){t._log("findPeerSingle %s",s.toB58String());let a=new d7(d7.TYPES.FIND_NODE,o.id,0);return t.network.sendRequest(s,a)},async findPeer(s,o={timeout:6e4}){o.timeout=o.timeout||rWe.minute,t._log("findPeer %s",s.toB58String());let a=await e(s);if(a!=null)return t._log("found local"),a;let c=await Vm.convertPeerId(s),u=t.routingTable.closestPeers(c,t.kBucketSize);if(u.length===0)throw Km(new Error("Peer lookup failed"),"ERR_LOOKUP_FAILED");if(u.find(b=>b.isEqual(s))){let b=t.peerStore.get(s);if(b)return t._log("found in peerStore"),{id:b.id,multiaddrs:b.addresses.map(E=>E.multiaddr)}}let d=new s1e(t,s.id,()=>async E=>{let v=await this._findPeerSingle(E,s),A=v.closerPeers.find(R=>R.id.isEqual(s));return A?{peer:A,queryComplete:!0}:{closerPeers:v.closerPeers}}),h;try{h=await J$e(d.run(u),o.timeout)}finally{d.stop()}let p=!1;if(h.paths.forEach(b=>{b.success&&b.peer&&(p=!0,t.peerStore.addressBook.add(b.peer.id,b.peer.multiaddrs))}),t._log("findPeer %s: %s",s.toB58String(),p),!p)throw Km(new Error("No peer found"),"ERR_NOT_FOUND");let y=t.peerStore.get(s);if(!y)throw Km(new Error("No peer found in peer store"),"ERR_NOT_FOUND");return{id:y.id,multiaddrs:y.addresses.map(b=>b.multiaddr)}},async*getClosestPeers(s,o={shallow:!1}){t._log("getClosestPeers to %b",s);let a=await Vm.convertBuffer(s),c=t.routingTable.closestPeers(a,t.kBucketSize),f=await new s1e(t,s,()=>async h=>({closerPeers:await i(s,h),pathComplete:o.shallow?!0:void 0})).run(c);if(!f||!f.finalSet)return[];let d=await Vm.sortClosestPeers(Array.from(f.finalSet),a);for(let h of d.slice(0,t.kBucketSize))yield h},async getPublicKey(s){t._log("getPublicKey %s",s.toB58String());let o=t.peerStore.get(s);if(o&&o.id.pubKey)return t._log("getPublicKey: found local copy"),o.id.pubKey;let a;try{a=await n(s)}catch(f){let d=Vm.keyForPublicKey(s),h=await t.get(d);a=eWe.keys.unmarshalPublicKey(h)}let c=new rC(s.id,void 0,a),u=(o&&o.addresses||[]).map(f=>f.multiaddr);return t.peerStore.addressBook.add(c,u),t.peerStore.keyBook.set(c,a),a}}}});var h1e=m((MOt,d1e)=>{l();"use strict";var iWe=g0(),c1e=Es(),nWe=it(),{Key:sWe}=(Br(),sy),{default:oWe}=Yc(),zm=hh(),Hm=Ii(),u1e=class{constructor(e,r,i){this.datastore=e,this._log=Hm.logger(r,"providers"),this.cleanupInterval=zm.PROVIDERS_CLEANUP_INTERVAL,this.provideValidity=zm.PROVIDERS_VALIDITY,this.lruCacheSize=i||zm.PROVIDERS_LRU_CACHE_SIZE,this.providers=iWe(this.lruCacheSize),this.syncQueue=new oWe({concurrency:1})}start(){this._started||(this._started=!0,this._cleaner=setInterval(()=>this._cleanup(),this.cleanupInterval))}stop(){this._started=!1,this._cleaner&&(clearInterval(this._cleaner),this._cleaner=null)}_cleanup(){return this.syncQueue.add(async()=>{this._log("start cleanup");let e=Date.now(),r=0,i=0,n=new Map,s=this.datastore.batch(),o=this.datastore.query({prefix:zm.PROVIDERS_KEY_PREFIX});for await(let a of o)try{let{cid:c,peerId:u}=f1e(a.key),f=l1e(a.value),d=Date.now(),h=d-f,p=h>this.provideValidity;if(this._log("comparing: %d - %d = %d > %d %s",d,f,h,this.provideValidity,p?"(expired)":""),p){i++,s.delete(a.key);let y=n.get(c)||new Set;y.add(u),n.set(c,y)}r++}catch(c){this._log.error(c.message)}this._log("deleting %d / %d entries",i,r),n.size&&await s.commit();for(let[a,c]of n){let u=Gm(a),f=this.providers.get(u);if(f){for(let d of c)f.delete(d);f.size===0?this.providers.remove(u):this.providers.set(u,f)}}this._log("Cleanup successful (%dms)",Date.now()-e)})}async _getProvidersMap(e){let r=Gm(e),i=this.providers.get(r);return i||(i=await cWe(this.datastore,e),this.providers.set(r,i)),i}async addProvider(e,r){return this.syncQueue.add(async()=>{this._log("addProvider %s",e.toString());let i=await this._getProvidersMap(e);this._log("loaded %s provs",i.size);let n=new Date;i.set(Hm.encodeBase32(r.id),n);let s=Gm(e);return this.providers.set(s,i),aWe(this.datastore,e,r,n)})}async getProviders(e){return this.syncQueue.add(async()=>(this._log("getProviders %s",e.toString()),[...(await this._getProvidersMap(e)).keys()].map(i=>new nWe(Hm.decodeBase32(i)))))}};function Gm(t){return t=typeof t=="string"?t:Hm.encodeBase32(t.bytes),zm.PROVIDERS_KEY_PREFIX+t}async function aWe(t,e,r,i){let n=[Gm(e),"/",Hm.encodeBase32(r.id)].join(""),s=new sWe(n),o=Uint8Array.from(c1e.encode(i.getTime()));return t.put(s,o)}function f1e(t){let e=t.toString().split("/");if(e.length!==4)throw new Error("incorrectly formatted provider entry key in datastore: "+t);return{cid:e[2],peerId:e[3]}}async function cWe(t,e){let r=new Map,i=t.query({prefix:Gm(e)});for await(let n of i){let{peerId:s}=f1e(n.key);r.set(s,l1e(n.value))}return r}function l1e(t){return c1e.decode(t)}d1e.exports=u1e});var g1e=m((LOt,y1e)=>{l();"use strict";var p1e=class{constructor(){this.queries=new Set,this.running=!1}queryStarted(e){this.queries.add(e)}queryCompleted(e){this.queries.delete(e)}start(){this.running=!0}stop(){this.running=!1;for(let e of this.queries)e.stop();this.queries.clear()}};y1e.exports=p1e});var v1e=m((qOt,sC)=>{l();"use strict";var{EventEmitter:uWe}=br(),h7=ma(),$m=ad(),{MemoryDatastore:fWe}=(JE(),ZV),{equals:m1e}=(wi(),bn),{toString:iC}=(tt(),hr),lWe=U0e(),q1=Ii(),Wm=hh(),dWe=vpe(),hWe=Gpe(),pWe=n1e(),yWe=a1e(),p7=Dc(),gWe=h1e(),mWe=g1e(),nC=$m.Record,b1e=class extends uWe{constructor({libp2p:e,dialer:r,peerId:i,peerStore:n,registrar:s,protocolPrefix:o="/ipfs",forceProtocolLegacy:a=!1,datastore:c=new fWe,kBucketSize:u=Wm.K,clientMode:f=!1,concurrency:d=Wm.ALPHA,validators:h={},selectors:p={},onPut:y=()=>{},onRemove:b=()=>{}}){super();if(!r)throw new Error("libp2p-kad-dht requires an instance of Dialer");this.libp2p=e,this.dialer=r,this.peerId=i,this.peerStore=n,this.registrar=s,this.protocol=o+(a?"":Wm.PROTOCOL_DHT),this.kBucketSize=u,this._clientMode=f,this.concurrency=d,this.disjointPaths=Math.ceil(this.kBucketSize/2),this.routingTable=new lWe(this,{kBucketSize:this.kBucketSize}),this.datastore=c,this.providers=new gWe(this.datastore,this.peerId),this.validators={pk:$m.validator.validators.pk,...h},this.selectors={pk:$m.selection.selectors.pk,...p},this.network=new dWe(this),this._log=q1.logger(this.peerId),this._queryManager=new mWe,this._running=!1,this.contentFetching=hWe(this),this.contentRouting=pWe(this),this.peerRouting=yWe(this),this.onPut=y,this.onRemove=b}get isStarted(){return this._running}start(){return this._running=!0,Promise.all([this.providers.start(),this._queryManager.start(),this.network.start(),this.routingTable.start()])}stop(){return this._running=!1,Promise.all([this.providers.stop(),this._queryManager.stop(),this.network.stop(),this.routingTable.stop()])}async put(e,r,i={}){return this.contentFetching.put(e,r,i)}async get(e,r={}){return this.contentFetching.get(e,r)}async getMany(e,r,i={}){return this.contentFetching.getMany(e,r,i)}async removeLocal(e){this._log(`removeLocal: ${iC(e,"base32")}`);let r=q1.bufferToKey(e);try{await this.datastore.delete(r)}catch(i){if(i.code==="ERR_NOT_FOUND")return;throw i}}async _putLocal(e,r){this._log(`_putLocal: ${iC(e,"base32")}`);let i=q1.bufferToKey(e);await this.datastore.put(i,r)}async provide(e){return this.contentRouting.provide(e)}async*findProviders(e,r={timeout:6e3,maxNumProviders:5}){for await(let i of this.contentRouting.findProviders(e,r))yield i}async findPeer(e,r={timeout:6e4}){return this.peerRouting.findPeer(e,r)}async*getClosestPeers(e,r={shallow:!1}){yield*this.peerRouting.getClosestPeers(e,r)}getPublicKey(e){return this.peerRouting.getPublicKey(e)}_peerDiscovered(e,r){this.emit("peer",{id:e,multiaddrs:r})}async _nearestPeersToQuery(e){let r=await q1.convertBuffer(e.key);return this.routingTable.closestPeers(r,this.kBucketSize).map(n=>{let s=this.peerStore.get(n);return{id:n,multiaddrs:s?s.addresses.map(o=>o.multiaddr):[]}})}async _betterPeersToQuery(e,r){return this._log("betterPeersToQuery"),(await this._nearestPeersToQuery(e)).filter(n=>this._isSelf(n.id)?(this._log.error("trying to return self as closer"),!1):!n.id.isEqual(r))}async _checkLocalDatastore(e){this._log(`checkLocalDatastore: ${iC(e)} %b`,e);let r=q1.bufferToKey(e),i;try{i=await this.datastore.get(r)}catch(s){if(s.code==="ERR_NOT_FOUND")return;throw s}let n=nC.deserialize(i);if(!n)throw h7(new Error("Invalid record"),"ERR_INVALID_RECORD");if(n.timeReceived==null||q1.now()-n.timeReceived.getTime()>Wm.MAX_RECORD_AGE){await this.datastore.delete(r),this.onRemove(n);return}return n}async _add(e){await this.routingTable.add(e)}async _verifyRecordLocally(e){this._log("verifyRecordLocally"),await $m.validator.verifyRecord(this.validators,e)}_isSelf(e){return e&&m1e(this.peerId.id,e.id)}async _putValueToPeer(e,r,i){let n=new p7(p7.TYPES.PUT_VALUE,e,0);n.record=nC.deserialize(r);let s=await this.network.sendRequest(i,n);if(s.record&&!m1e(s.record.value,nC.deserialize(r).value))throw h7(new Error("value not put correctly"),"ERR_PUT_VALUE_INVALID")}async _getValueOrPeers(e,r){let i=await this._getValueSingle(e,r),n=i.closerPeers,s=i.record;if(s){try{await this._verifyRecordOnline(s)}catch(o){let a="invalid record received, discarded";throw this._log(a),h7(new Error(a),"ERR_INVALID_RECORD")}return{record:s,peers:n}}if(n.length>0)return{peers:n};throw h7(new Error("Not found"),"ERR_NOT_FOUND")}async _getValueSingle(e,r){let i=new p7(p7.TYPES.GET_VALUE,r,0);return this.network.sendRequest(e,i)}async _verifyRecordOnline(e){await $m.validator.verifyRecord(this.validators,e)}};sC.exports=b1e;sC.exports.multicodec="/ipfs"+Wm.PROTOCOL_DHT});var k1e=m((oC,O1e)=>{l();"use strict";var bWe=it(),{Multiaddr:vWe}=rt(),wWe=Bl(),{EventEmitter:_We}=br(),P1e=Ee(),y7=Object.assign(P1e("libp2p:bootstrap"),{error:P1e("libp2p:bootstrap:error")}),C1e=class extends _We{constructor(e={list:[]}){if(!e.list||!e.list.length)throw new Error("Bootstrap requires a list of peer addresses");super();this._list=e.list,this._interval=e.interval||1e4,this._timer=null}start(){this._timer||(this._timer=setInterval(()=>this._discoverBootstrapPeers(),this._interval),y7("Starting bootstrap node discovery"),this._discoverBootstrapPeers())}_discoverBootstrapPeers(){!this._timer||this._list.forEach(e=>{if(!wWe.P2P.matches(e))return y7.error("Invalid multiaddr");let r=new vWe(e),i=r.getPeerId();if(!i){y7.error("Invalid bootstrap multiaddr without peer id");return}let n=bWe.createFromB58String(i);try{this.emit("peer",{id:n,multiaddrs:[r]})}catch(s){y7.error("Invalid bootstrap peer id",s)}})}stop(){this._timer&&clearInterval(this._timer),this._timer=null}};oC=O1e.exports=C1e;oC.tag="bootstrap"});var aC=m((VOt,D1e)=>{l();"use strict";var EWe=_r(),SWe=ea(),xWe=oo(),AWe=Z0();function IWe(t,e){return xWe(t,r=>(e.addressBook.add(r.id,r.multiaddrs),r))}function TWe(t){let e=new Set;return SWe(t,r=>e.has(r.id.toString())?!1:(e.add(r.id.toString()),!0))}async function*RWe(t,e=1){let r=0;for await(let i of t)r++,yield i;if(r<e)throw EWe(new Error("not found"),"NOT_FOUND")}function PWe(t,e){return e?AWe(t,e):t}D1e.exports={storeAddresses:IWe,uniquePeers:TWe,requirePeers:RWe,maybeLimitSource:PWe}});var cC=m((zOt,B1e)=>{l();"use strict";var j1=new Map,CWe=()=>`${Date.now()}:${Math.floor(Math.random()*1e6)}`;async function OWe(t,e,r){for(;j1.get(r);){try{await t()}catch(i){setTimeout(()=>{throw i},1);break}if(!j1.get(r))break;await new Promise(i=>{let n=setTimeout(i,e);j1.set(r,n)})}}function kWe(t,e,r){r=r||e;let i=CWe(),n=setTimeout(()=>{OWe(t,e,i)},r);return j1.set(i,n),i}function DWe(t){let e=j1.get(t);e&&(clearTimeout(e),j1.delete(t))}B1e.exports={setDelayedInterval:kWe,clearDelayedInterval:DWe}});var F1e=m((HOt,U1e)=>{l();"use strict";var N1e=Ee(),BWe=Object.assign(N1e("libp2p:peer-routing"),{error:N1e("libp2p:peer-routing:err")}),g7=_r(),{storeAddresses:M1e,uniquePeers:NWe,requirePeers:MWe}=aC(),L1e=ep(),{pipe:q1e}=Nr(),LWe=Sd(),qWe=ic(),jWe=ea(),{setDelayedInterval:UWe,clearDelayedInterval:FWe}=cC(),j1e=class{constructor(e){this._peerId=e.peerId,this._peerStore=e.peerStore,this._routers=e._modules.peerRouting||[],e._dht&&e._config.dht.enabled&&this._routers.push(e._dht),this._refreshManagerOptions=e._options.peerRouting.refreshManager,this._findClosestPeersTask=this._findClosestPeersTask.bind(this)}start(){!this._routers.length||this._timeoutId||!this._refreshManagerOptions.enabled||(this._timeoutId=UWe(this._findClosestPeersTask,this._refreshManagerOptions.interval,this._refreshManagerOptions.bootDelay))}async _findClosestPeersTask(){try{await qWe(this.getClosestPeers(this._peerId.id))}catch(e){BWe.error(e)}}stop(){FWe(this._timeoutId)}async findPeer(e,r){if(!this._routers.length)throw g7(new Error("No peer routers available"),"NO_ROUTERS_AVAILABLE");if(e.toB58String()===this._peerId.toB58String())throw g7(new Error("Should not try to find self"),"ERR_FIND_SELF");let i=await q1e(L1e(...this._routers.map(n=>[n.findPeer(e,r)])),n=>jWe(n,Boolean),n=>M1e(n,this._peerStore),n=>LWe(n));if(i)return i;throw g7(new Error("not found"),"NOT_FOUND")}async*getClosestPeers(e,r={timeout:3e4}){if(!this._routers.length)throw g7(new Error("No peer routers available"),"NO_ROUTERS_AVAILABLE");yield*q1e(L1e(...this._routers.map(i=>i.getClosestPeers(e,r))),i=>M1e(i,this._peerStore),i=>NWe(i),i=>MWe(i))}};U1e.exports=j1e});var z1e=m((GOt,V1e)=>{l();"use strict";var Ym=_r(),{messages:uC,codes:fC}=_i(),{storeAddresses:KWe,uniquePeers:VWe,requirePeers:zWe,maybeLimitSource:HWe}=aC(),GWe=ep(),{pipe:$We}=Nr(),K1e=class{constructor(e){this.libp2p=e,this.routers=e._modules.contentRouting||[],this.dht=e._dht,this.dht&&e._config.dht.enabled&&this.routers.push(this.dht)}async*findProviders(e,r={}){if(!this.routers.length)throw Ym(new Error("No content this.routers available"),"NO_ROUTERS_AVAILABLE");yield*$We(GWe(...this.routers.map(i=>i.findProviders(e,r))),i=>KWe(i,this.libp2p.peerStore),i=>VWe(i),i=>HWe(i,r.maxNumProviders),i=>zWe(i))}async provide(e){if(!this.routers.length)throw Ym(new Error("No content routers available"),"NO_ROUTERS_AVAILABLE");await Promise.all(this.routers.map(r=>r.provide(e)))}put(e,r,i){if(!this.libp2p.isStarted()||!this.dht.isStarted)throw Ym(new Error(uC.NOT_STARTED_YET),fC.DHT_NOT_STARTED);return this.dht.put(e,r,i)}get(e,r){if(!this.libp2p.isStarted()||!this.dht.isStarted)throw Ym(new Error(uC.NOT_STARTED_YET),fC.DHT_NOT_STARTED);return this.dht.get(e,r)}async getMany(e,r,i){if(!this.libp2p.isStarted()||!this.dht.isStarted)throw Ym(new Error(uC.NOT_STARTED_YET),fC.DHT_NOT_STARTED);return this.dht.getMany(e,r,i)}};V1e.exports=K1e});var lC=m(($Ot,W1e)=>{l();"use strict";var WWe=it(),{Multiaddr:H1e}=rt(),G1e=_r(),{codes:$1e}=_i();function YWe(t){typeof t=="string"&&(t=new H1e(t));let e;if(H1e.isMultiaddr(t)){e=t;let r=t.getPeerId();if(!r)throw G1e(new Error(`${t} does not have a valid peer type`),$1e.ERR_INVALID_MULTIADDR);try{t=WWe.createFromB58String(r)}catch(i){throw G1e(new Error(`${t} is not a valid peer type`),$1e.ERR_INVALID_MULTIADDR)}}return{id:t,multiaddrs:e?[e]:void 0}}W1e.exports=YWe});var Q1e=m((WOt,X1e)=>{l();"use strict";X1e.exports=Y1e;var XWe=mw(),gl=Y1e.prototype,QWe=new Date%1e9;function ZWe(){return(Math.random()*1e9>>>0)+QWe++}function Y1e(t){t=t||{},this.id=t.id||ZWe(),this.max=t.max||1/0,this.items=t.items||[],this._lookup={},this.size=this.items.length,this.lastModified=new Date(t.lastModified||new Date);for(var e,r,i=this.items.length;i--;)e=this.items[i],r=new Date(e.expires)-new Date,this._lookup[e.key]=e,r>0?this.expire(e.key,r):r<=0&&this.delete(e.key)}gl.has=function(t){return t in this._lookup};gl.get=function(t){if(!this.has(t))return null;var e=this._lookup[t];return e.refresh&&this.expire(t,e.refresh),this.items.splice(this.items.indexOf(e),1),this.items.push(e),e.value};gl.meta=function(t){if(!this.has(t))return null;var e=this._lookup[t];return"meta"in e?e.meta:null};gl.set=function(t,e,r){var i=this._lookup[t],n=this._lookup[t]={key:t,value:e};return this.lastModified=new Date,i?(clearTimeout(i.timeout),this.items.splice(this.items.indexOf(i),1,n)):(this.size>=this.max&&this.delete(this.items[0].key),this.items.push(n),this.size++),r&&("ttl"in r&&this.expire(t,r.ttl),"meta"in r&&(n.meta=r.meta),r.refresh&&(n.refresh=r.ttl)),this};gl.delete=function(t){var e=this._lookup[t];return e?(this.lastModified=new Date,this.items.splice(this.items.indexOf(e),1),clearTimeout(e.timeout),delete this._lookup[t],this.size--,this):!1};gl.expire=function(t,e){var r=e||0,i=this._lookup[t];if(!i)return this;if(typeof r=="string"&&(r=XWe(e)),typeof r!="number")throw new TypeError("Expiration time must be a string or number.");return clearTimeout(i.timeout),i.timeout=setTimeout(this.delete.bind(this,i.key),r),i.expires=Number(new Date)+r,this};gl.clear=function(){for(var t=this.items.length;t--;)this.delete(this.items[t].key);return this};gl.toJSON=function(){for(var t=new Array(this.items.length),e,r=t.length;r--;)e=this.items[r],t[r]={key:e.key,meta:e.meta,value:e.value,expires:e.expires,refresh:e.refresh};return{id:this.id,max:isFinite(this.max)?this.max:void 0,lastModified:this.lastModified,items:t}}});var J1e=m((YOt,Z1e)=>{l();"use strict";var{default:JWe,Headers:eYe}=Y9();function tYe({serverResolver:t,hostname:e,recordType:r}){return`${t}?name=${e}&type=${r}`}function rYe(t){return JWe(t,{headers:new eYe({accept:"application/dns-json"})})}function iYe(t,e){return`${e}_${t}`}Z1e.exports={buildResource:tYe,fetch:rYe,getCacheKey:iYe}});var r2e=m((XOt,t2e)=>{l();"use strict";var e2e=Ee(),m7=e2e("dns-over-http-resolver");m7.error=e2e("dns-over-http-resolver:error");var nYe=Q1e(),Ao=J1e(),b7=class{constructor({maxCache:e=100}={}){this._cache=new nYe({max:e}),this._servers=["https://cloudflare-dns.com/dns-query","https://dns.google/resolve"]}getServers(){return this._servers}_getShuffledServers(){let e=[].concat(this._servers);for(let r=e.length-1;r>0;r--){let i=Math.floor(Math.random()*r),n=e[r];e[r]=e[i],e[i]=n}return e}setServers(e){this._servers=e}resolve(e,r="A"){switch(r){case"A":return this.resolve4(e);case"AAAA":return this.resolve6(e);case"TXT":return this.resolveTxt(e);default:throw new Error(`${r} is not supported`)}}async resolve4(e){let r="A",i=this._cache.get(Ao.getCacheKey(e,r));if(i)return i;for(let n of this._getShuffledServers())try{let o=await(await Ao.fetch(Ao.buildResource({serverResolver:n,hostname:e,recordType:r}))).json(),a=o.Answer.map(u=>u.data),c=Math.min(o.Answer.map(u=>u.TTL));return this._cache.set(Ao.getCacheKey(e,r),a,{ttl:c}),a}catch(s){m7.error(`${n} could not resolve ${e} record ${r}`)}throw new Error(`Could not resolve ${e} record ${r}`)}async resolve6(e){let r="AAAA",i=this._cache.get(Ao.getCacheKey(e,r));if(i)return i;for(let n of this._getShuffledServers())try{let o=await(await Ao.fetch(Ao.buildResource({serverResolver:n,hostname:e,recordType:r}))).json(),a=o.Answer.map(u=>u.data),c=Math.min(o.Answer.map(u=>u.TTL));return this._cache.set(Ao.getCacheKey(e,r),a,{ttl:c}),a}catch(s){m7.error(`${n} could not resolve ${e} record ${r}`)}throw new Error(`Could not resolve ${e} record ${r}`)}async resolveTxt(e){let r="TXT",i=this._cache.get(Ao.getCacheKey(e,r));if(i)return i;for(let n of this._getShuffledServers())try{let o=await(await Ao.fetch(Ao.buildResource({serverResolver:n,hostname:e,recordType:r}))).json(),a=o.Answer.map(u=>[u.data.replace(/['"]+/g,"")]),c=Math.min(o.Answer.map(u=>u.TTL));return this._cache.set(Ao.getCacheKey(e,r),a,{ttl:c}),a}catch(s){m7.error(`${n} could not resolve ${e} record ${r}`)}throw new Error(`Could not resolve ${e} record ${r}`)}};b7.Resolver=b7;t2e.exports=b7});var n2e=m((QOt,i2e)=>{l();"use strict";var sYe=r2e();i2e.exports=sYe});var o2e=m((ZOt,s2e)=>{l();"use strict";var oYe=X2(),{code:aYe}=oYe("dnsaddr");async function cYe(t){let e=n2e(),r=new e,i=t.getPeerId(),[,n]=t.stringTuples().find(([a])=>a===aYe)||[],o=(await r.resolveTxt(`_dnsaddr.${n}`)).flat().map(a=>a.split("=")[1]);return i&&(o=o.filter(a=>a.includes(i))),o}s2e.exports={dnsaddrResolver:cYe}});var v7=m((JOt,a2e)=>{l();"use strict";a2e.exports={DIAL_TIMEOUT:3e4,MAX_PARALLEL_DIALS:100,MAX_PER_PEER_DIALS:4,MAX_ADDRS_TO_DIAL:25,METRICS:{computeThrottleMaxQueueSize:1e3,computeThrottleTimeout:2e3,movingAverageIntervals:[60*1e3,5*60*1e3,15*60*1e3],maxOldPeersRetention:50}}});var dC=m((ekt,uYe)=>{uYe.exports={name:"libp2p",version:"0.33.0",description:"JavaScript implementation of libp2p, a modular peer to peer network stack",leadMaintainer:"Jacob Heun <jacobheun@gmail.com>",main:"src/index.js",types:"dist/src/index.d.ts",typesVersions:{"*":{"src/*":["dist/src/*","dist/src/*/index"]}},files:["dist","src"],scripts:{lint:"aegir lint",build:"aegir build","build:proto":"npm run build:proto:circuit && npm run build:proto:identify && npm run build:proto:plaintext && npm run build:proto:address-book && npm run build:proto:proto-book && npm run build:proto:peer-record && npm run build:proto:envelope","build:proto:circuit":"pbjs -t static-module -w commonjs -r libp2p-circuit --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/circuit/protocol/index.js ./src/circuit/protocol/index.proto","build:proto:identify":"pbjs -t static-module -w commonjs -r libp2p-identify --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/identify/message.js ./src/identify/message.proto","build:proto:plaintext":"pbjs -t static-module -w commonjs -r libp2p-plaintext --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/insecure/proto.js ./src/insecure/proto.proto","build:proto:address-book":"pbjs -t static-module -w commonjs -r libp2p-address-book --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/peer-store/persistent/pb/address-book.js ./src/peer-store/persistent/pb/address-book.proto","build:proto:proto-book":"pbjs -t static-module -w commonjs -r libp2p-proto-book --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/peer-store/persistent/pb/proto-book.js ./src/peer-store/persistent/pb/proto-book.proto","build:proto:peer-record":"pbjs -t static-module -w commonjs -r libp2p-peer-record --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/record/peer-record/peer-record.js ./src/record/peer-record/peer-record.proto","build:proto:envelope":"pbjs -t static-module -w commonjs -r libp2p-envelope --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/record/envelope/envelope.js ./src/record/envelope/envelope.proto","build:proto-types":"npm run build:proto-types:circuit && npm run build:proto-types:identify && npm run build:proto-types:plaintext && npm run build:proto-types:address-book && npm run build:proto-types:proto-book && npm run build:proto-types:peer-record && npm run build:proto-types:envelope","build:proto-types:circuit":"pbts -o src/circuit/protocol/index.d.ts src/circuit/protocol/index.js","build:proto-types:identify":"pbts -o src/identify/message.d.ts src/identify/message.js","build:proto-types:plaintext":"pbts -o src/insecure/proto.d.ts src/insecure/proto.js","build:proto-types:address-book":"pbts -o src/peer-store/persistent/pb/address-book.d.ts src/peer-store/persistent/pb/address-book.js","build:proto-types:proto-book":"pbts -o src/peer-store/persistent/pb/proto-book.d.ts src/peer-store/persistent/pb/proto-book.js","build:proto-types:peer-record":"pbts -o src/record/peer-record/peer-record.d.ts src/record/peer-record/peer-record.js","build:proto-types:envelope":"pbts -o src/record/envelope/envelope.d.ts src/record/envelope/envelope.js",test:"aegir test","test:ts":"aegir build --no-bundle && npm run test --prefix test/ts-use","test:node":'aegir test -t node -f "./test/**/*.{node,spec}.js"',"test:browser":"aegir test -t browser","test:examples":"cd examples && npm run test:all",prepare:"aegir build --no-bundle",release:"aegir release -t node -t browser","release-minor":"aegir release --type minor -t node -t browser","release-major":"aegir release --type major -t node -t browser",coverage:"nyc --reporter=text --reporter=lcov npm run test:node"},repository:{type:"git",url:"https://github.com/libp2p/js-libp2p.git"},keywords:["libp2p","network","p2p","peer","peer-to-peer","IPFS"],bugs:{url:"https://github.com/libp2p/js-libp2p/issues"},homepage:"https://libp2p.io",license:"MIT",engines:{node:">=14.0.0"},browser:{"@motrix/nat-api":!1},eslintConfig:{extends:"ipfs",ignorePatterns:["!.aegir.js","test/ts-use"]},dependencies:{"abortable-iterator":"^3.0.0","@motrix/nat-api":"^0.3.1","@vascosantos/moving-average":"^1.1.0","abort-controller":"^3.0.0","aggregate-error":"^3.1.0","any-signal":"^2.1.1","bignumber.js":"^9.0.1","class-is":"^1.1.0",debug:"^4.3.1","err-code":"^3.0.0","es6-promisify":"^7.0.0",events:"^3.3.0",hashlru:"^2.3.0","interface-datastore":"^6.0.2","it-all":"^1.0.4","it-buffer":"^0.1.2","it-drain":"^1.0.3","it-filter":"^1.0.1","it-first":"^1.0.4","it-handshake":"^2.0.0","it-length-prefixed":"^5.0.2","it-map":"^1.0.4","it-merge":"^1.0.0","it-pipe":"^1.1.0","it-take":"^1.0.0","libp2p-crypto":"^0.19.4","libp2p-interfaces":"^1.0.0","libp2p-utils":"^0.4.0",mafmt:"^10.0.0","merge-options":"^3.0.4",multiaddr:"^10.0.0",multiformats:"^9.0.0","multistream-select":"^2.0.0","mutable-proxy":"^1.0.0","node-forge":"^0.10.0","p-any":"^3.0.0","p-fifo":"^1.0.0","p-retry":"^4.4.0","p-settle":"^4.1.1","peer-id":"^0.15.0","private-ip":"^2.1.0",protobufjs:"^6.10.2",retimer:"^3.0.0","sanitize-filename":"^1.6.3","set-delayed-interval":"^1.0.0","streaming-iterables":"^6.0.0","timeout-abort-controller":"^1.1.1",uint8arrays:"^3.0.0",varint:"^6.0.0",wherearewe:"^1.0.0",xsalsa20:"^1.1.0"},devDependencies:{"@chainsafe/libp2p-noise":"^4.0.0","@nodeutils/defaults-deep":"^1.1.0","@types/es6-promisify":"^6.0.0","@types/node":"^16.0.1","@types/node-forge":"^0.10.1","@types/varint":"^6.0.0",aegir:"^33.1.1",buffer:"^6.0.3","datastore-core":"^6.0.7",delay:"^5.0.0","interop-libp2p":"^0.4.0","into-stream":"^7.0.0","ipfs-http-client":"^52.0.2","it-concat":"^2.0.0","it-pair":"^1.0.0","it-pushable":"^1.4.0",libp2p:".","libp2p-bootstrap":"^0.13.0","libp2p-delegated-content-routing":"^0.11.0","libp2p-delegated-peer-routing":"^0.10.0","libp2p-floodsub":"^0.27.0","libp2p-gossipsub":"^0.11.0","libp2p-interfaces-compliance-tests":"^1.0.0","libp2p-kad-dht":"^0.24.2","libp2p-mdns":"^0.17.0","libp2p-mplex":"^0.10.1","libp2p-tcp":"^0.17.0","libp2p-webrtc-star":"^0.23.0","libp2p-websockets":"^0.16.0",nock:"^13.0.3","p-defer":"^3.0.0","p-times":"^3.0.0","p-wait-for":"^3.2.0",rimraf:"^3.0.2",sinon:"^11.1.1",util:"^0.12.3"},contributors:["Vasco Santos <vasco.santos@moxy.studio>","David Dias <daviddias.p@gmail.com>","Jacob Heun <jacobheun@gmail.com>","Alex Potsides <alex@achingbrain.net>","Alan Shaw <alan@tableflip.io>","Cayman <caymannava@gmail.com>","Pedro Teixeira <i@pgte.me>","Friedel Ziegelmayer <dignifiedquire@gmail.com>","Maciej Kr\xFCger <mkg20001@gmail.com>","Hugo Dias <mail@hugodias.me>","Chris Dostert <chrisdostert@users.noreply.github.com>","dirkmc <dirkmdev@gmail.com>","Volker Mische <volker.mische@gmail.com>","zeim839 <50573884+zeim839@users.noreply.github.com>","Richard Littauer <richard.littauer@gmail.com>","a1300 <matthias-knopp@gmx.net>","Ryan Bell <ryan@piing.net>","\u1D20\u026A\u1D04\u1D1B\u1D0F\u0280 \u0299\u1D0A\u1D07\u029F\u1D0B\u029C\u1D0F\u029F\u1D0D <victorbjelkholm@gmail.com>","Franck Royer <franck@royer.one>","Thomas Eizinger <thomas@eizinger.io>","Giovanni T. Parra <fiatjaf@gmail.com>","acolytec3 <17355484+acolytec3@users.noreply.github.com>","Elven <mon.samuel@qq.com>","Andrew Nesbitt <andrewnez@gmail.com>","Samlior <samlior@foxmail.com>","Didrik Nordstr\xF6m <didrik.nordstrom@gmail.com>","RasmusErik Voel Jensen <github@solsort.com>","Robert Kiel <robert.kiel@hoprnet.org>","Smite Chow <xiaopengyou@live.com>","Soeren <nikorpoulsen@gmail.com>","S\xF6nke Hahn <soenkehahn@gmail.com>","TJKoury <TJKoury@gmail.com>","Tiago Alves <alvesjtiago@gmail.com>","XiaoZhang <zxinmyth@gmail.com>","Yusef Napora <yusef@napora.org>","Zane Starr <zcstarr@gmail.com>","ebinks <elizabethjbinks@gmail.com>","Aditya Bose <13054902+adbose@users.noreply.github.com>","isan_rivkin <isanrivkin@gmail.com>","mayerwin <mayerwin@users.noreply.github.com>","mcclure <andi.m.mcclure@gmail.com>","phillmac <phillmac@users.noreply.github.com>","robertkiel <robert.kiel@validitylabs.org>","shresthagrawal <34920931+shresthagrawal@users.noreply.github.com>","swedneck <40505480+swedneck@users.noreply.github.com>","greenSnot <greenSnot@users.noreply.github.com>","Aleksei <vozhdb@gmail.com>","Bernd Strehl <bernd.strehl@gmail.com>","Chris Bratlien <chrisbratlien@gmail.com>","Cindy Wu <ciindy.wu@gmail.com>","Daijiro Wachi <daijiro.wachi@gmail.com>","Diogo Silva <fsdiogo@gmail.com>","Dmitriy Ryajov <dryajov@gmail.com>","Ethan Lam <elmemphis2000@gmail.com>","Fei Liu <liu.feiwood@gmail.com>","Felipe Martins <felipebrasil93@gmail.com>","Florian-Merle <florian.david.merle@gmail.com>","Francis Gulotta <wizard@roborooter.com>","Guy Sviry <32539816+guysv@users.noreply.github.com>","Henrique Dias <hacdias@gmail.com>","Irakli Gozalishvili <rfobic@gmail.com>","Joel Gustafson <joelg@mit.edu>","John Rees <johnrees@users.noreply.github.com>","Jo\xE3o Santos <joaosantos15@users.noreply.github.com>","Julien Bouquillon <contact@revolunet.com>","Kevin Kwok <antimatter15@gmail.com>","Kevin Lacker <lacker@gmail.com>","Lars Gierth <lgierth@users.noreply.github.com>","Leask Wong <i@leaskh.com>","Marcin Tojek <mtojek@users.noreply.github.com>","Michael Burns <5170+mburns@users.noreply.github.com>","Miguel Mota <miguelmota2@gmail.com>","Nuno Nogueira <nunofmn@gmail.com>","Philipp Muens <raute1337@gmx.de>"]}});var hC=m((tkt,Bc)=>{l();"use strict";var fYe=dC().version;Bc.exports.PROTOCOL_VERSION="ipfs/0.1.0";Bc.exports.AGENT_VERSION=`js-libp2p/${fYe}`;Bc.exports.MULTICODEC_IDENTIFY="/ipfs/id/1.0.0";Bc.exports.MULTICODEC_IDENTIFY_PUSH="/ipfs/id/push/1.0.0";Bc.exports.IDENTIFY_PROTOCOL_VERSION="0.1.0";Bc.exports.MULTICODEC_IDENTIFY_PROTOCOL_NAME="id";Bc.exports.MULTICODEC_IDENTIFY_PUSH_PROTOCOL_NAME="id/push";Bc.exports.MULTICODEC_IDENTIFY_PROTOCOL_VERSION="1.0.0";Bc.exports.MULTICODEC_IDENTIFY_PUSH_PROTOCOL_VERSION="1.0.0"});var w7=m((rkt,u2e)=>{l();"use strict";var c2e=60*1e3;u2e.exports={ADVERTISE_BOOT_DELAY:15*c2e,ADVERTISE_TTL:30*c2e,CIRCUIT_PROTO_CODE:290,HOP_METADATA_KEY:"hop_relay",HOP_METADATA_VALUE:"true",RELAY_RENDEZVOUS_NS:"/libp2p/relay"}});var f2e=m(Xm=>{l();(function(){var t,e,r,i,n,s,o,a;a=function(c){var u,f,d,h;return u=(c&255<<24)>>>24,f=(c&255<<16)>>>16,d=(c&255<<8)>>>8,h=c&255,[u,f,d,h].join(".")},o=function(c){var u,f,d,h,p,y;for(u=[],d=h=0;h<=3&&c.length!==0;d=++h){if(d>0){if(c[0]!==".")throw new Error("Invalid IP");c=c.substring(1)}y=e(c),p=y[0],f=y[1],c=c.substring(f),u.push(p)}if(c.length!==0)throw new Error("Invalid IP");switch(u.length){case 1:if(u[0]>4294967295)throw new Error("Invalid IP");return u[0]>>>0;case 2:if(u[0]>255||u[1]>16777215)throw new Error("Invalid IP");return(u[0]<<24|u[1])>>>0;case 3:if(u[0]>255||u[1]>255||u[2]>65535)throw new Error("Invalid IP");return(u[0]<<24|u[1]<<16|u[2])>>>0;case 4:if(u[0]>255||u[1]>255||u[2]>255||u[3]>255)throw new Error("Invalid IP");return(u[0]<<24|u[1]<<16|u[2]<<8|u[3])>>>0;default:throw new Error("Invalid IP")}},r=function(c){return c.charCodeAt(0)},i=r("0"),s=r("a"),n=r("A"),e=function(c){var u,f,d,h,p;for(h=0,u=10,f="9",d=0,c.length>1&&c[d]==="0"&&(c[d+1]==="x"||c[d+1]==="X"?(d+=2,u=16):"0"<=c[d+1]&&c[d+1]<="9"&&(d++,u=8,f="7")),p=d;d<c.length;){if("0"<=c[d]&&c[d]<=f)h=h*u+(r(c[d])-i)>>>0;else if(u===16)if("a"<=c[d]&&c[d]<="f")h=h*u+(10+r(c[d])-s)>>>0;else if("A"<=c[d]&&c[d]<="F")h=h*u+(10+r(c[d])-n)>>>0;else break;else break;if(h>4294967295)throw new Error("too large");d++}if(d===p)throw new Error("empty octet");return[h,d]},t=function(){function c(u,f){var d,h,p,y;if(typeof u!="string")throw new Error("Missing `net' parameter");if(f||(y=u.split("/",2),u=y[0],f=y[1]),f||(f=32),typeof f=="string"&&f.indexOf(".")>-1){try{this.maskLong=o(f)}catch(b){throw d=b,new Error("Invalid mask: "+f)}for(h=p=32;p>=0;h=--p)if(this.maskLong===4294967295<<32-h>>>0){this.bitmask=h;break}}else if(f||f===0)this.bitmask=parseInt(f,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0);else throw new Error("Invalid mask: empty");try{this.netLong=(o(u)&this.maskLong)>>>0}catch(b){throw d=b,new Error("Invalid net address: "+u)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+f);this.size=Math.pow(2,32-this.bitmask),this.base=a(this.netLong),this.mask=a(this.maskLong),this.hostmask=a(~this.maskLong),this.first=this.bitmask<=30?a(this.netLong+1):this.base,this.last=this.bitmask<=30?a(this.netLong+this.size-2):a(this.netLong+this.size-1),this.broadcast=this.bitmask<=30?a(this.netLong+this.size-1):void 0}return c.prototype.contains=function(u){return typeof u=="string"&&(u.indexOf("/")>0||u.split(".").length!==4)&&(u=new c(u)),u instanceof c?this.contains(u.base)&&this.contains(u.broadcast||u.last):(o(u)&this.maskLong)>>>0==(this.netLong&this.maskLong)>>>0},c.prototype.next=function(u){return u==null&&(u=1),new c(a(this.netLong+this.size*u),this.mask)},c.prototype.forEach=function(u){var f,d,h;for(h=o(this.first),d=o(this.last),f=0;h<=d;)u(a(h),h,f),f++,h++},c.prototype.toString=function(){return this.base+"/"+this.bitmask},c}(),Xm.ip2long=o,Xm.long2ip=a,Xm.Netmask=t}).call(Xm)});var h2e=m((nkt,d2e)=>{l();var lYe=f2e().Netmask,l2e=l9(),dYe=["0.0.0.0/8","10.0.0.0/8","100.64.0.0/10","127.0.0.0/8","169.254.0.0/16","172.16.0.0/12","192.0.0.0/24","192.0.0.0/29","192.0.0.8/32","192.0.0.9/32","192.0.0.10/32","192.0.0.170/32","192.0.0.171/32","192.0.2.0/24","192.31.196.0/24","192.52.193.0/24","192.88.99.0/24","192.168.0.0/16","192.175.48.0/24","198.18.0.0/15","198.51.100.0/24","203.0.113.0/24","240.0.0.0/4","255.255.255.255/32"],hYe=dYe.map(t=>new lYe(t));function pYe(t){for(let e of hYe)if(e.contains(t))return!0;return!1}function yYe(t){return/^::$/.test(t)||/^::1$/.test(t)||/^::f{4}:([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(t)||/^::f{4}:0.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(t)||/^64:ff9b::([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(t)||/^100::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^2001::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^2001:2[0-9a-fA-F]:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^2001:db8:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^2002:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^f[c-d]([0-9a-fA-F]{2,2}):/i.test(t)||/^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(t)||/^ff([0-9a-fA-F]{2,2}):/i.test(t)}d2e.exports=t=>l2e.v6().test(t)?yYe(t):l2e().test(t)||t.startsWith("0")?pYe(t):!1});var pC=m((skt,p2e)=>{l();"use strict";p2e.exports=h2e()});var g2e=m((okt,y2e)=>{l();"use strict";var gYe=pC();function mYe(t){let{address:e}=t.nodeAddress();return gYe(e)}y2e.exports=mYe});var yC=m((akt,b2e)=>{l();"use strict";var m2e=g2e();function bYe(t,e){let r=m2e(t.multiaddr),i=m2e(e.multiaddr);return r&&!i?1:!r&&i||t.isCertified&&!e.isCertified?-1:!t.isCertified&&e.isCertified?1:0}function vYe(t){return[...t].sort(bYe)}b2e.exports.publicAddressesFirst=vYe});var w2e=m((ckt,gC)=>{l();"use strict";var v2e=async t=>{try{let e=await t;return{isFulfilled:!0,isRejected:!1,value:e}}catch(e){return{isFulfilled:!1,isRejected:!0,reason:e}}};gC.exports=v2e;gC.exports.default=v2e});var E2e=m((ukt,mC)=>{l();"use strict";var _2e=(t,...e)=>new Promise(r=>{r(t(...e))});mC.exports=_2e;mC.exports.default=_2e});var x2e=m((fkt,bC)=>{l();"use strict";var wYe=E2e(),S2e=t=>{if(!((Number.isInteger(t)||t===1/0)&&t>0))return Promise.reject(new TypeError("Expected `concurrency` to be a number from 1 and up"));let e=[],r=0,i=()=>{r--,e.length>0&&e.shift()()},n=(a,c,...u)=>{r++;let f=wYe(a,...u);c(f),f.then(i,i)},s=(a,c,...u)=>{r<t?n(a,c,...u):e.push(n.bind(null,a,c,...u))},o=(a,...c)=>new Promise(u=>s(a,u,...c));return Object.defineProperties(o,{activeCount:{get:()=>r},pendingCount:{get:()=>e.length},clearQueue:{value:()=>{e.length=0}}}),o};bC.exports=S2e;bC.exports.default=S2e});var I2e=m((lkt,A2e)=>{l();"use strict";var vC=w2e(),_Ye=x2e();A2e.exports=async(t,e={})=>{let{concurrency:r=1/0}=e,i=_Ye(r);return Promise.all(t.map(n=>n&&typeof n.then=="function"?vC(n):typeof n=="function"?vC(i(()=>n())):vC(Promise.resolve(n))))}});var R2e=m((dkt,T2e)=>{l();"use strict";function EYe(t,e){return t.length===e.length&&e.sort()&&t.sort().every((r,i)=>e[i].equals(r))}T2e.exports=EYe});var O2e=m((hkt,C2e)=>{l();"use strict";var yh=Vi(),_7=yh.Reader,P2e=yh.Writer,si=yh.util,Io=yh.roots["libp2p-peer-record"]||(yh.roots["libp2p-peer-record"]={});Io.PeerRecord=function(){function t(e){if(this.addresses=[],e)for(var r=Object.keys(e),i=0;i<r.length;++i)e[r[i]]!=null&&(this[r[i]]=e[r[i]])}return t.prototype.peerId=si.newBuffer([]),t.prototype.seq=si.Long?si.Long.fromBits(0,0,!0):0,t.prototype.addresses=si.emptyArray,t.encode=function(r,i){if(i||(i=P2e.create()),r.peerId!=null&&Object.hasOwnProperty.call(r,"peerId")&&i.uint32(10).bytes(r.peerId),r.seq!=null&&Object.hasOwnProperty.call(r,"seq")&&i.uint32(16).uint64(r.seq),r.addresses!=null&&r.addresses.length)for(var n=0;n<r.addresses.length;++n)Io.PeerRecord.AddressInfo.encode(r.addresses[n],i.uint32(26).fork()).ldelim();return i},t.decode=function(r,i){r instanceof _7||(r=_7.create(r));for(var n=i===void 0?r.len:r.pos+i,s=new Io.PeerRecord;r.pos<n;){var o=r.uint32();switch(o>>>3){case 1:s.peerId=r.bytes();break;case 2:s.seq=r.uint64();break;case 3:s.addresses&&s.addresses.length||(s.addresses=[]),s.addresses.push(Io.PeerRecord.AddressInfo.decode(r,r.uint32()));break;default:r.skipType(o&7);break}}return s},t.fromObject=function(r){if(r instanceof Io.PeerRecord)return r;var i=new Io.PeerRecord;if(r.peerId!=null&&(typeof r.peerId=="string"?si.base64.decode(r.peerId,i.peerId=si.newBuffer(si.base64.length(r.peerId)),0):r.peerId.length&&(i.peerId=r.peerId)),r.seq!=null&&(si.Long?(i.seq=si.Long.fromValue(r.seq)).unsigned=!0:typeof r.seq=="string"?i.seq=parseInt(r.seq,10):typeof r.seq=="number"?i.seq=r.seq:typeof r.seq=="object"&&(i.seq=new si.LongBits(r.seq.low>>>0,r.seq.high>>>0).toNumber(!0))),r.addresses){if(!Array.isArray(r.addresses))throw TypeError(".PeerRecord.addresses: array expected");i.addresses=[];for(var n=0;n<r.addresses.length;++n){if(typeof r.addresses[n]!="object")throw TypeError(".PeerRecord.addresses: object expected");i.addresses[n]=Io.PeerRecord.AddressInfo.fromObject(r.addresses[n])}}return i},t.toObject=function(r,i){i||(i={});var n={};if((i.arrays||i.defaults)&&(n.addresses=[]),i.defaults)if(i.bytes===String?n.peerId="":(n.peerId=[],i.bytes!==Array&&(n.peerId=si.newBuffer(n.peerId))),si.Long){var s=new si.Long(0,0,!0);n.seq=i.longs===String?s.toString():i.longs===Number?s.toNumber():s}else n.seq=i.longs===String?"0":0;if(r.peerId!=null&&r.hasOwnProperty("peerId")&&(n.peerId=i.bytes===String?si.base64.encode(r.peerId,0,r.peerId.length):i.bytes===Array?Array.prototype.slice.call(r.peerId):r.peerId),r.seq!=null&&r.hasOwnProperty("seq")&&(typeof r.seq=="number"?n.seq=i.longs===String?String(r.seq):r.seq:n.seq=i.longs===String?si.Long.prototype.toString.call(r.seq):i.longs===Number?new si.LongBits(r.seq.low>>>0,r.seq.high>>>0).toNumber(!0):r.seq),r.addresses&&r.addresses.length){n.addresses=[];for(var o=0;o<r.addresses.length;++o)n.addresses[o]=Io.PeerRecord.AddressInfo.toObject(r.addresses[o],i)}return n},t.prototype.toJSON=function(){return this.constructor.toObject(this,yh.util.toJSONOptions)},t.AddressInfo=function(){function e(r){if(r)for(var i=Object.keys(r),n=0;n<i.length;++n)r[i[n]]!=null&&(this[i[n]]=r[i[n]])}return e.prototype.multiaddr=si.newBuffer([]),e.encode=function(i,n){return n||(n=P2e.create()),i.multiaddr!=null&&Object.hasOwnProperty.call(i,"multiaddr")&&n.uint32(10).bytes(i.multiaddr),n},e.decode=function(i,n){i instanceof _7||(i=_7.create(i));for(var s=n===void 0?i.len:i.pos+n,o=new Io.PeerRecord.AddressInfo;i.pos<s;){var a=i.uint32();switch(a>>>3){case 1:o.multiaddr=i.bytes();break;default:i.skipType(a&7);break}}return o},e.fromObject=function(i){if(i instanceof Io.PeerRecord.AddressInfo)return i;var n=new Io.PeerRecord.AddressInfo;return i.multiaddr!=null&&(typeof i.multiaddr=="string"?si.base64.decode(i.multiaddr,n.multiaddr=si.newBuffer(si.base64.length(i.multiaddr)),0):i.multiaddr.length&&(n.multiaddr=i.multiaddr)),n},e.toObject=function(i,n){n||(n={});var s={};return n.defaults&&(n.bytes===String?s.multiaddr="":(s.multiaddr=[],n.bytes!==Array&&(s.multiaddr=si.newBuffer(s.multiaddr)))),i.multiaddr!=null&&i.hasOwnProperty("multiaddr")&&(s.multiaddr=n.bytes===String?si.base64.encode(i.multiaddr,0,i.multiaddr.length):n.bytes===Array?Array.prototype.slice.call(i.multiaddr):i.multiaddr),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,yh.util.toJSONOptions)},e}(),t}();C2e.exports=Io});var D2e=m((pkt,k2e)=>{l();"use strict";var SYe="libp2p-peer-record",xYe=Uint8Array.from([3,1]);k2e.exports={ENVELOPE_DOMAIN_PEER_RECORD:SYe,ENVELOPE_PAYLOAD_TYPE_PEER_RECORD:xYe}});var E7=m((ykt,M2e)=>{l();"use strict";var{Multiaddr:AYe}=rt(),IYe=it(),TYe=R2e(),{PeerRecord:B2e}=O2e(),{ENVELOPE_DOMAIN_PEER_RECORD:N2e,ENVELOPE_PAYLOAD_TYPE_PEER_RECORD:RYe}=D2e(),gh=class{constructor({peerId:e,multiaddrs:r=[],seqNumber:i=Date.now()}){this.domain=N2e,this.codec=RYe,this.peerId=e,this.multiaddrs=r,this.seqNumber=i,this._marshal=void 0}marshal(){return this._marshal?this._marshal:(this._marshal=B2e.encode({peerId:this.peerId.toBytes(),seq:this.seqNumber,addresses:this.multiaddrs.map(e=>({multiaddr:e.bytes}))}).finish(),this._marshal)}equals(e){return!(!(e instanceof gh)||!this.peerId.equals(e.peerId)||this.seqNumber!==e.seqNumber||!TYe(this.multiaddrs,e.multiaddrs))}};gh.createFromProtobuf=t=>{let e=B2e.decode(t),r=IYe.createFromBytes(e.peerId),i=(e.addresses||[]).map(s=>new AYe(s.multiaddr)),n=Number(e.seq);return new gh({peerId:r,multiaddrs:i,seqNumber:n})};gh.DOMAIN=N2e;M2e.exports=gh});var wC=m((gkt,L2e)=>{l();"use strict";var PYe=dm(),CYe=E7();async function OYe(t){let e=new CYe({peerId:t.peerId,multiaddrs:t.multiaddrs}),r=await PYe.seal(e,t.peerId);t.peerStore.addressBook.consumePeerRecord(r)}L2e.exports.updateSelfPeerRecord=OYe});var EC=m((mkt,U2e)=>{l();"use strict";var q2e=Ee(),mh=Object.assign(q2e("libp2p:transports"),{error:q2e("libp2p:transports:err")}),kYe=I2e(),{codes:U1}=_i(),Qm=_r(),{updateSelfPeerRecord:j2e}=wC(),_C=class{constructor({libp2p:e,upgrader:r,faultTolerance:i=S7.FATAL_ALL}){this.libp2p=e,this.upgrader=r,this._transports=new Map,this._listeners=new Map,this._listenerOptions=new Map,this.faultTolerance=i}add(e,r,i={}){if(mh("adding %s",e),!e)throw Qm(new Error(`Transport must have a valid key, was given '${e}'`),U1.ERR_INVALID_KEY);if(this._transports.has(e))throw Qm(new Error("There is already a transport with this key"),U1.ERR_DUPLICATE_TRANSPORT);let n=new r({...i,libp2p:this.libp2p,upgrader:this.upgrader});this._transports.set(e,n),this._listenerOptions.set(e,i.listenerOptions||{}),this._listeners.has(e)||this._listeners.set(e,[])}async close(){let e=[];for(let[r,i]of this._listeners)for(mh("closing listeners for %s",r);i.length;){let n=i.pop();n.removeAllListeners("listening"),n.removeAllListeners("close"),e.push(n.close())}await Promise.all(e),mh("all listeners closed");for(let r of this._listeners.keys())this._listeners.set(r,[])}async dial(e,r){let i=this.transportForMultiaddr(e);if(!i)throw Qm(new Error(`No transport available for address ${String(e)}`),U1.ERR_TRANSPORT_UNAVAILABLE);try{return await i.dial(e,r)}catch(n){throw n.code||(n.code=U1.ERR_TRANSPORT_DIAL_FAILED),n}}getAddrs(){let e=[];for(let r of this._listeners.values())for(let i of r)e=[...e,...i.getAddrs()];return e}getTransports(){return this._transports.values()}transportForMultiaddr(e){for(let r of this._transports.values())if(r.filter([e]).length)return r;return null}async listen(e){if(!e||e.length===0){mh("no addresses were provided for listening, this node is dial only");return}let r=[];for(let[i,n]of this._transports.entries()){let s=n.filter(e),o=[];for(let u of s){mh("creating listener for %s on %s",i,u);let f=n.createListener(this._listenerOptions.get(i));this._listeners.get(i).push(f),f.on("listening",()=>j2e(this.libp2p)),f.on("close",()=>j2e(this.libp2p)),o.push(f.listen(u))}if(o.length===0){r.push(i);continue}if(!(await kYe(o)).find(u=>u.isFulfilled===!0)&&this.faultTolerance!==S7.NO_FATAL)throw Qm(new Error(`Transport (${i}) could not listen on any available address`),U1.ERR_NO_VALID_ADDRESSES)}if(r.length===this._transports.size){let i=`no valid addresses were provided for transports [${r}]`;if(this.faultTolerance===S7.FATAL_ALL)throw Qm(new Error(i),U1.ERR_NO_VALID_ADDRESSES);mh(`libp2p in dial mode only: ${i}`)}}async remove(e){if(mh("removing %s",e),this._listeners.has(e))for(let r of this._listeners.get(e))r.removeAllListeners("listening"),r.removeAllListeners("close"),await r.close();this._transports.delete(e),this._listeners.delete(e)}async removeAll(){let e=[];for(let r of this._transports.keys())e.push(this.remove(r));await Promise.all(e)}},S7={FATAL_ALL:0,NO_FATAL:1};_C.FaultTolerance=S7;U2e.exports=_C});var V2e=m((bkt,K2e)=>{l();"use strict";var DYe=Al(),{dnsaddrResolver:BYe}=o2e(),SC=v7(),{AGENT_VERSION:NYe}=hC(),F2e=w7(),{publicAddressesFirst:MYe}=yC(),{FaultTolerance:LYe}=EC(),qYe={addresses:{listen:[],announce:[],noAnnounce:[],announceFilter:t=>t},connectionManager:{minConnections:25},transportManager:{faultTolerance:LYe.FATAL_ALL},dialer:{maxParallelDials:SC.MAX_PARALLEL_DIALS,maxDialsPerPeer:SC.MAX_PER_PEER_DIALS,dialTimeout:SC.DIAL_TIMEOUT,resolvers:{dnsaddr:BYe},addressSorter:MYe},host:{agentVersion:NYe},metrics:{enabled:!1},peerStore:{persistence:!1,threshold:5},peerRouting:{refreshManager:{enabled:!0,interval:6e5,bootDelay:1e4}},config:{protocolPrefix:"ipfs",dht:{enabled:!1,kBucketSize:20,randomWalk:{enabled:!1,queriesPerPeriod:1,interval:3e5,timeout:1e4}},nat:{enabled:!0,ttl:7200,keepAlive:!0,gateway:null,externalIp:null,pmp:{enabled:!1}},peerDiscovery:{autoDial:!0},pubsub:{enabled:!0},relay:{enabled:!0,advertise:{bootDelay:F2e.ADVERTISE_BOOT_DELAY,enabled:!1,ttl:F2e.ADVERTISE_TTL},hop:{enabled:!1,active:!1},autoRelay:{enabled:!1,maxListeners:2}},transport:{}}};K2e.exports.validate=t=>{let e=DYe(qYe,t);if(e.modules.transport.length<1)throw new Error("'options.modules.transport' must contain at least 1 transport");return e}});var G2e=m((vkt,H2e)=>{l();"use strict";var{EventEmitter:jYe}=br(),{Multiaddr:Zm}=rt(),UYe=it(),z2e=class extends jYe{constructor(e,{listen:r=[],announce:i=[]}={}){super();this.peerId=e,this.listen=new Set(r.map(n=>n.toString())),this.announce=new Set(i.map(n=>n.toString())),this.observed=new Set}getListenAddrs(){return Array.from(this.listen).map(e=>new Zm(e))}getAnnounceAddrs(){return Array.from(this.announce).map(e=>new Zm(e))}getObservedAddrs(){return Array.from(this.observed).map(e=>new Zm(e))}addObservedAddr(e){let r=new Zm(e),i=r.getPeerId();i&&UYe.createFromB58String(i).equals(this.peerId)&&(r=r.decapsulate(new Zm(`/p2p/${this.peerId}`)));let n=r.toString();this.observed.has(n)||(this.observed.add(n),this.emit("change:addresses"))}};H2e.exports=z2e});var Y2e=m((wkt,W2e)=>{l();"use strict";var{EventEmitter:FYe}=br(),xC=Ee()("latency-monitor:VisibilityChangeEmitter"),$2e=class extends FYe{constructor(){super();if(typeof document=="undefined"){xC('This is not a browser, no "document" found. Stopping.');return}this._initializeVisibilityVarNames(),this._addVisibilityChangeListener()}_initializeVisibilityVarNames(){let e,r;typeof document.hidden!="undefined"?(e="hidden",r="visibilitychange"):typeof document.mozHidden!="undefined"?(e="mozHidden",r="mozvisibilitychange"):typeof document.msHidden!="undefined"?(e="msHidden",r="msvisibilitychange"):typeof document.webkitHidden!="undefined"&&(e="webkitHidden",r="webkitvisibilitychange"),this._hidden=e,this._visibilityChange=r}_addVisibilityChangeListener(){typeof document.addEventListener=="undefined"||typeof document[this._hidden]=="undefined"?xC("Checking page visibility requires a browser that supports the Page Visibility API."):document.addEventListener(this._visibilityChange,this._handleVisibilityChange.bind(this),!1)}isVisible(){if(!(this._hidden===void 0||document[this._hidden]===void 0))return!document[this._hidden]}_handleVisibilityChange(){let e=!document[this._hidden];xC(e?"Page Visible":"Page Hidden"),this.emit("visibilityChange",e)}};W2e.exports=$2e});var Z2e=m((_kt,Q2e)=>{l();"use strict";var{EventEmitter:KYe}=br(),VYe=Y2e(),Lu=Ee()("latency-monitor:LatencyMonitor"),X2e=class extends KYe{constructor({latencyCheckIntervalMs:e,dataEmitIntervalMs:r,asyncTestFn:i,latencyRandomPercentage:n}={}){super();let s=this;s.latencyCheckIntervalMs=e||500,s.latencyRandomPercentage=n||10,s._latecyCheckMultiply=2*(s.latencyRandomPercentage/100)*s.latencyCheckIntervalMs,s._latecyCheckSubtract=s._latecyCheckMultiply/2,s.dataEmitIntervalMs=r===null||r===0?void 0:r||5*1e3,Lu("latencyCheckIntervalMs: %s dataEmitIntervalMs: %s",s.latencyCheckIntervalMs,s.dataEmitIntervalMs),s.dataEmitIntervalMs?Lu("Expecting ~%s events per summary",s.latencyCheckIntervalMs/s.dataEmitIntervalMs):Lu("Not emitting summaries"),s.asyncTestFn=i}start(){globalThis.process&&globalThis.process.hrtime?(Lu("Using process.hrtime for timing"),this.now=globalThis.process.hrtime,this.getDeltaMS=e=>{let r=this.now(e);return r[0]*1e3+r[1]/1e6}):typeof window!="undefined"&&window.performance&&window.performance.now?(Lu("Using performance.now for timing"),this.now=window.performance.now.bind(window.performance),this.getDeltaMS=e=>Math.round(this.now()-e)):(Lu("Using Date.now for timing"),this.now=Date.now,this.getDeltaMS=e=>this.now()-e),this._latencyData=this._initLatencyData(),zYe()&&(this._visibilityChangeEmitter=new VYe,this._visibilityChangeEmitter.on("visibilityChange",e=>{e?this._startTimers():(this._emitSummary(),this._stopTimers())})),(!this._visibilityChangeEmitter||this._visibilityChangeEmitter.isVisible())&&this._startTimers()}stop(){this._stopTimers()}_startTimers(){this._checkLatencyID||(this._checkLatency(),this.dataEmitIntervalMs&&(this._emitIntervalID=setInterval(()=>this._emitSummary(),this.dataEmitIntervalMs),typeof this._emitIntervalID.unref=="function"&&this._emitIntervalID.unref()))}_stopTimers(){this._checkLatencyID&&(clearTimeout(this._checkLatencyID),this._checkLatencyID=void 0),this._emitIntervalID&&(clearInterval(this._emitIntervalID),this._emitIntervalID=void 0)}_emitSummary(){let e=this.getSummary();e.events>0&&this.emit("data",e)}getSummary(){let e={events:this._latencyData.events,minMs:this._latencyData.minMs,maxMs:this._latencyData.maxMs,avgMs:this._latencyData.events?this._latencyData.totalMs/this._latencyData.events:Number.POSITIVE_INFINITY,lengthMs:this.getDeltaMS(this._latencyData.startTime)};return this._latencyData=this._initLatencyData(),Lu("Summary: %O",e),e}_checkLatency(){let e=this,r=Math.random()*e._latecyCheckMultiply-e._latecyCheckSubtract,i={deltaOffset:Math.ceil(e.latencyCheckIntervalMs+r),startTime:e.now()},n=()=>{if(!this._checkLatencyID)return;let s=e.getDeltaMS(i.startTime)-i.deltaOffset;e._checkLatency(),e._latencyData.events++,e._latencyData.minMs=Math.min(e._latencyData.minMs,s),e._latencyData.maxMs=Math.max(e._latencyData.maxMs,s),e._latencyData.totalMs+=s,Lu("MS: %s Data: %O",s,e._latencyData)};Lu("localData: %O",i),this._checkLatencyID=setTimeout(()=>{e.asyncTestFn?(i.deltaOffset=0,i.startTime=e.now(),e.asyncTestFn(n)):(i.deltaOffset-=1,n())},i.deltaOffset),typeof this._checkLatencyID.unref=="function"&&this._checkLatencyID.unref()}_initLatencyData(){return{startTime:this.now(),minMs:Number.POSITIVE_INFINITY,maxMs:Number.NEGATIVE_INFINITY,events:0,totalMs:0}}};function zYe(){return typeof window!="undefined"}Q2e.exports=X2e});var eye=m((Ekt,J2e)=>{l();"use strict";J2e.exports=function(){return Date.now()}});var AC=m((Skt,rye)=>{l();"use strict";var x7=eye(),tye=class{constructor(e,r,i){let n=this;this._started=x7(),this._rescheduled=0,this._scheduled=r,this._args=i,this._triggered=!1,this._timerWrapper=()=>{n._rescheduled>0?(n._scheduled=n._rescheduled-(x7()-n._started),n._schedule(n._scheduled)):(n._triggered=!0,e.apply(null,n._args))},this._timer=setTimeout(this._timerWrapper,r)}reschedule(e){e||(e=this._scheduled);let r=x7();r+e-(this._started+this._scheduled)<0?(clearTimeout(this._timer),this._schedule(e)):this._triggered?this._schedule(e):(this._started=r,this._rescheduled=e)}_schedule(e){this._triggered=!1,this._started=x7(),this._rescheduled=0,this._scheduled=e,this._timer=setTimeout(this._timerWrapper,e)}clear(){clearTimeout(this._timer)}};function HYe(){if(typeof arguments[0]!="function")throw new Error("callback needed");if(typeof arguments[1]!="number")throw new Error("timeout needed");let t;if(arguments.length>0){t=new Array(arguments.length-2);for(var e=0;e<t.length;e++)t[e]=arguments[e+2]}return new tye(arguments[0],arguments[1],t)}rye.exports=HYe});var cye=m((xkt,aye)=>{l();"use strict";var iye=Ee(),ba=Object.assign(iye("libp2p:connection-manager"),{error:iye("libp2p:connection-manager:err")}),nye=_r(),GYe=Al(),$Ye=Z2e(),A7=AC(),{EventEmitter:WYe}=br(),YYe=it(),{codes:{ERR_INVALID_PARAMETERS:sye}}=_i(),XYe={maxConnections:1/0,minConnections:0,maxData:1/0,maxSentData:1/0,maxReceivedData:1/0,maxEventLoopDelay:1/0,pollInterval:2e3,autoDialInterval:1e4,movingAverageInterval:6e4,defaultPeerValue:1},oye=class extends WYe{constructor(e,r={}){super();if(this._libp2p=e,this._peerId=e.peerId.toB58String(),this._options=GYe.call({ignoreUndefined:!0},XYe,r),this._options.maxConnections<this._options.minConnections)throw nye(new Error("Connection Manager maxConnections must be greater than minConnections"),sye);ba("options: %j",this._options),this._peerValues=new Map,this.connections=new Map,this._started=!1,this._timer=null,this._autoDialTimeout=null,this._checkMetrics=this._checkMetrics.bind(this),this._autoDial=this._autoDial.bind(this),this._latencyMonitor=new $Ye({latencyCheckIntervalMs:this._options.pollInterval,dataEmitIntervalMs:this._options.pollInterval})}get size(){return Array.from(this.connections.values()).reduce((e,r)=>e+r.length,0)}start(){this._libp2p.metrics&&(this._timer=this._timer||A7(this._checkMetrics,this._options.pollInterval)),this._latencyMonitor.start(),this._onLatencyMeasure=this._onLatencyMeasure.bind(this),this._latencyMonitor.on("data",this._onLatencyMeasure),this._started=!0,ba("started"),this._options.autoDial&&this._autoDial()}async stop(){this._autoDialTimeout&&this._autoDialTimeout.clear(),this._timer&&this._timer.clear(),this._latencyMonitor.removeListener("data",this._onLatencyMeasure),this._latencyMonitor.stop(),this._started=!1,await this._close(),ba("stopped")}async _close(){let e=[];for(let r of this.connections.values())for(let i of r)e.push(i.close());await Promise.all(e),this.connections.clear()}setPeerValue(e,r){if(r<0||r>1)throw new Error("value should be a number between 0 and 1");this._peerValues.set(e.toB58String(),r)}_checkMetrics(){if(this._libp2p.metrics){let e=this._libp2p.metrics.global.movingAverages,r=e.dataReceived[this._options.movingAverageInterval].movingAverage();this._checkMaxLimit("maxReceivedData",r);let i=e.dataSent[this._options.movingAverageInterval].movingAverage();this._checkMaxLimit("maxSentData",i);let n=r+i;this._checkMaxLimit("maxData",n),ba("metrics update",n),this._timer=A7(this._checkMetrics,this._options.pollInterval)}}onConnect(e){let r=e.remotePeer,i=r.toB58String(),n=this.connections.get(i);this.emit("peer:connect",e),n?n.push(e):this.connections.set(i,[e]),this._libp2p.peerStore.keyBook.set(r,r.pubKey),this._peerValues.has(i)||this._peerValues.set(i,this._options.defaultPeerValue),this._checkMaxLimit("maxConnections",this.size)}onDisconnect(e){let r=e.remotePeer.toB58String(),i=this.connections.get(r);i&&i.length>1?(i=i.filter(n=>n.id!==e.id),this.connections.set(r,i)):i&&(this.connections.delete(r),this._peerValues.delete(e.remotePeer.toB58String()),this.emit("peer:disconnect",e))}get(e){let r=this.getAll(e);return r.length?r[0]:null}getAll(e){if(!YYe.isPeerId(e))throw nye(new Error("peerId must be an instance of peer-id"),sye);let r=e.toB58String(),i=this.connections.get(r);return i?i.filter(n=>n.stat.status==="open"):[]}_onLatencyMeasure(e){this._checkMaxLimit("maxEventLoopDelay",e.avgMs)}_checkMaxLimit(e,r){let i=this._options[e];ba("checking limit of %s. current value: %d of %d",e,r,i),r>i&&(ba("%s: limit exceeded: %s, %d",this._peerId,e,r),this._maybeDisconnectOne())}async _autoDial(){let e=this._options.minConnections;if(this.size>=e){this._autoDialTimeout=A7(this._autoDial,this._options.autoDialInterval);return}let r=Array.from(this._libp2p.peerStore.peers.values()).sort((i,n)=>n.protocols&&n.protocols.length&&(!i.protocols||!i.protocols.length)||n.id.pubKey&&!i.id.pubKey?1:-1);for(let i=0;i<r.length&&this.size<e;i++)if(!this.get(r[i].id)){ba("connecting to a peerStore stored peer %s",r[i].id.toB58String());try{if(await this._libp2p.dialer.connectToPeer(r[i].id),!this._started)return}catch(n){ba.error("could not connect to peerStore stored peer",n)}}this._autoDialTimeout=A7(this._autoDial,this._options.autoDialInterval)}_maybeDisconnectOne(){if(this._options.minConnections<this.connections.size){let e=Array.from(new Map([...this._peerValues.entries()].sort((i,n)=>i[1]-n[1])));ba("%s: sorted peer values: %j",this._peerId,e);let r=e[0];if(r){let i=r[0];ba("%s: lowest value peer is %s",this._peerId,i),ba("%s: closing a connection to %j",this._peerId,i);for(let n of this.connections.values())if(n[0].remotePeer.toB58String()===i){n[0].close();break}}}}};aye.exports=oye});var F1=m((Akt,fye)=>{l();"use strict";var bh=Vi(),I7=bh.Reader,uye=bh.Writer,To=bh.util,tn=bh.roots["libp2p-circuit"]||(bh.roots["libp2p-circuit"]={});tn.CircuitRelay=function(){function t(e){if(e)for(var r=Object.keys(e),i=0;i<r.length;++i)e[r[i]]!=null&&(this[r[i]]=e[r[i]])}return t.prototype.type=1,t.prototype.srcPeer=null,t.prototype.dstPeer=null,t.prototype.code=100,t.encode=function(r,i){return i||(i=uye.create()),r.type!=null&&Object.hasOwnProperty.call(r,"type")&&i.uint32(8).int32(r.type),r.srcPeer!=null&&Object.hasOwnProperty.call(r,"srcPeer")&&tn.CircuitRelay.Peer.encode(r.srcPeer,i.uint32(18).fork()).ldelim(),r.dstPeer!=null&&Object.hasOwnProperty.call(r,"dstPeer")&&tn.CircuitRelay.Peer.encode(r.dstPeer,i.uint32(26).fork()).ldelim(),r.code!=null&&Object.hasOwnProperty.call(r,"code")&&i.uint32(32).int32(r.code),i},t.decode=function(r,i){r instanceof I7||(r=I7.create(r));for(var n=i===void 0?r.len:r.pos+i,s=new tn.CircuitRelay;r.pos<n;){var o=r.uint32();switch(o>>>3){case 1:s.type=r.int32();break;case 2:s.srcPeer=tn.CircuitRelay.Peer.decode(r,r.uint32());break;case 3:s.dstPeer=tn.CircuitRelay.Peer.decode(r,r.uint32());break;case 4:s.code=r.int32();break;default:r.skipType(o&7);break}}return s},t.fromObject=function(r){if(r instanceof tn.CircuitRelay)return r;var i=new tn.CircuitRelay;switch(r.type){case"HOP":case 1:i.type=1;break;case"STOP":case 2:i.type=2;break;case"STATUS":case 3:i.type=3;break;case"CAN_HOP":case 4:i.type=4;break}if(r.srcPeer!=null){if(typeof r.srcPeer!="object")throw TypeError(".CircuitRelay.srcPeer: object expected");i.srcPeer=tn.CircuitRelay.Peer.fromObject(r.srcPeer)}if(r.dstPeer!=null){if(typeof r.dstPeer!="object")throw TypeError(".CircuitRelay.dstPeer: object expected");i.dstPeer=tn.CircuitRelay.Peer.fromObject(r.dstPeer)}switch(r.code){case"SUCCESS":case 100:i.code=100;break;case"HOP_SRC_ADDR_TOO_LONG":case 220:i.code=220;break;case"HOP_DST_ADDR_TOO_LONG":case 221:i.code=221;break;case"HOP_SRC_MULTIADDR_INVALID":case 250:i.code=250;break;case"HOP_DST_MULTIADDR_INVALID":case 251:i.code=251;break;case"HOP_NO_CONN_TO_DST":case 260:i.code=260;break;case"HOP_CANT_DIAL_DST":case 261:i.code=261;break;case"HOP_CANT_OPEN_DST_STREAM":case 262:i.code=262;break;case"HOP_CANT_SPEAK_RELAY":case 270:i.code=270;break;case"HOP_CANT_RELAY_TO_SELF":case 280:i.code=280;break;case"STOP_SRC_ADDR_TOO_LONG":case 320:i.code=320;break;case"STOP_DST_ADDR_TOO_LONG":case 321:i.code=321;break;case"STOP_SRC_MULTIADDR_INVALID":case 350:i.code=350;break;case"STOP_DST_MULTIADDR_INVALID":case 351:i.code=351;break;case"STOP_RELAY_REFUSED":case 390:i.code=390;break;case"MALFORMED_MESSAGE":case 400:i.code=400;break}return i},t.toObject=function(r,i){i||(i={});var n={};return i.defaults&&(n.type=i.enums===String?"HOP":1,n.srcPeer=null,n.dstPeer=null,n.code=i.enums===String?"SUCCESS":100),r.type!=null&&r.hasOwnProperty("type")&&(n.type=i.enums===String?tn.CircuitRelay.Type[r.type]:r.type),r.srcPeer!=null&&r.hasOwnProperty("srcPeer")&&(n.srcPeer=tn.CircuitRelay.Peer.toObject(r.srcPeer,i)),r.dstPeer!=null&&r.hasOwnProperty("dstPeer")&&(n.dstPeer=tn.CircuitRelay.Peer.toObject(r.dstPeer,i)),r.code!=null&&r.hasOwnProperty("code")&&(n.code=i.enums===String?tn.CircuitRelay.Status[r.code]:r.code),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,bh.util.toJSONOptions)},t.Status=function(){var e={},r=Object.create(e);return r[e[100]="SUCCESS"]=100,r[e[220]="HOP_SRC_ADDR_TOO_LONG"]=220,r[e[221]="HOP_DST_ADDR_TOO_LONG"]=221,r[e[250]="HOP_SRC_MULTIADDR_INVALID"]=250,r[e[251]="HOP_DST_MULTIADDR_INVALID"]=251,r[e[260]="HOP_NO_CONN_TO_DST"]=260,r[e[261]="HOP_CANT_DIAL_DST"]=261,r[e[262]="HOP_CANT_OPEN_DST_STREAM"]=262,r[e[270]="HOP_CANT_SPEAK_RELAY"]=270,r[e[280]="HOP_CANT_RELAY_TO_SELF"]=280,r[e[320]="STOP_SRC_ADDR_TOO_LONG"]=320,r[e[321]="STOP_DST_ADDR_TOO_LONG"]=321,r[e[350]="STOP_SRC_MULTIADDR_INVALID"]=350,r[e[351]="STOP_DST_MULTIADDR_INVALID"]=351,r[e[390]="STOP_RELAY_REFUSED"]=390,r[e[400]="MALFORMED_MESSAGE"]=400,r}(),t.Type=function(){var e={},r=Object.create(e);return r[e[1]="HOP"]=1,r[e[2]="STOP"]=2,r[e[3]="STATUS"]=3,r[e[4]="CAN_HOP"]=4,r}(),t.Peer=function(){function e(r){if(this.addrs=[],r)for(var i=Object.keys(r),n=0;n<i.length;++n)r[i[n]]!=null&&(this[i[n]]=r[i[n]])}return e.prototype.id=To.newBuffer([]),e.prototype.addrs=To.emptyArray,e.encode=function(i,n){if(n||(n=uye.create()),n.uint32(10).bytes(i.id),i.addrs!=null&&i.addrs.length)for(var s=0;s<i.addrs.length;++s)n.uint32(18).bytes(i.addrs[s]);return n},e.decode=function(i,n){i instanceof I7||(i=I7.create(i));for(var s=n===void 0?i.len:i.pos+n,o=new tn.CircuitRelay.Peer;i.pos<s;){var a=i.uint32();switch(a>>>3){case 1:o.id=i.bytes();break;case 2:o.addrs&&o.addrs.length||(o.addrs=[]),o.addrs.push(i.bytes());break;default:i.skipType(a&7);break}}if(!o.hasOwnProperty("id"))throw To.ProtocolError("missing required 'id'",{instance:o});return o},e.fromObject=function(i){if(i instanceof tn.CircuitRelay.Peer)return i;var n=new tn.CircuitRelay.Peer;if(i.id!=null&&(typeof i.id=="string"?To.base64.decode(i.id,n.id=To.newBuffer(To.base64.length(i.id)),0):i.id.length&&(n.id=i.id)),i.addrs){if(!Array.isArray(i.addrs))throw TypeError(".CircuitRelay.Peer.addrs: array expected");n.addrs=[];for(var s=0;s<i.addrs.length;++s)typeof i.addrs[s]=="string"?To.base64.decode(i.addrs[s],n.addrs[s]=To.newBuffer(To.base64.length(i.addrs[s])),0):i.addrs[s].length&&(n.addrs[s]=i.addrs[s])}return n},e.toObject=function(i,n){n||(n={});var s={};if((n.arrays||n.defaults)&&(s.addrs=[]),n.defaults&&(n.bytes===String?s.id="":(s.id=[],n.bytes!==Array&&(s.id=To.newBuffer(s.id)))),i.id!=null&&i.hasOwnProperty("id")&&(s.id=n.bytes===String?To.base64.encode(i.id,0,i.id.length):n.bytes===Array?Array.prototype.slice.call(i.id):i.id),i.addrs&&i.addrs.length){s.addrs=[];for(var o=0;o<i.addrs.length;++o)s.addrs[o]=n.bytes===String?To.base64.encode(i.addrs[o],0,i.addrs[o].length):n.bytes===Array?Array.prototype.slice.call(i.addrs[o]):i.addrs[o]}return s},e.prototype.toJSON=function(){return this.constructor.toObject(this,bh.util.toJSONOptions)},e}(),t}();fye.exports=tn});var hye=m((Ikt,dye)=>{l();"use strict";var{source:lye}=wc(),QYe=Ee(),ZYe=QYe("libp2p:stream:converter");function JYe({stream:t,remoteAddr:e,localAddr:r},i={}){let{sink:n,source:s}=t,o={async sink(c){i.signal&&(c=lye(c,i.signal));try{await n(c)}catch(u){u.type!=="aborted"&&ZYe(u)}a()},source:i.signal?lye(s,i.signal):s,conn:t,localAddr:r,remoteAddr:e,timeline:{open:Date.now(),close:void 0},close(){return n(new Uint8Array(0)),a()}};function a(){return o.timeline.close||(o.timeline.close=Date.now()),Promise.resolve()}return o}dye.exports=JYe});var Jm=m((Tkt,pye)=>{l();"use strict";pye.exports={relay:"/libp2p/circuit/relay/0.1.0"}});var gye=m((Rkt,yye)=>{l();"use strict";var{EventEmitter:eXe}=br(),{Multiaddr:tXe}=rt();yye.exports=t=>{let e=new Map;async function r(s){let o=String(s).split("/p2p-circuit").find(u=>u!==""),a=await t.dial(new tXe(o)),c=a.remoteAddr.encapsulate("/p2p-circuit");e.set(a.remotePeer.toB58String(),c),n.emit("listening")}function i(){let s=[];for(let o of e.values())s.push(o);return s}let n=Object.assign(new eXe,{close:()=>Promise.resolve(),listen:r,getAddrs:i});return t.connectionManager.on("peer:disconnect",s=>{e.delete(s.remotePeer.toB58String())&&n.emit("close")}),n}});var IC=m((Pkt,vye)=>{l();"use strict";var{Multiaddr:mye}=rt(),{CircuitRelay:vh}=F1();function bye(t,e){t.write({type:vh.Type.STATUS,code:e})}function rXe(t,e){try{t.dstPeer&&t.dstPeer.addrs&&t.dstPeer.addrs.forEach(r=>new mye(r))}catch(r){throw bye(e,t.type===vh.Type.HOP?vh.Status.HOP_DST_MULTIADDR_INVALID:vh.Status.STOP_DST_MULTIADDR_INVALID),r}try{t.srcPeer&&t.srcPeer.addrs&&t.srcPeer.addrs.forEach(r=>new mye(r))}catch(r){throw bye(e,t.type===vh.Type.HOP?vh.Status.HOP_SRC_MULTIADDR_INVALID:vh.Status.STOP_SRC_MULTIADDR_INVALID),r}}vye.exports={validateAddrs:rXe}});var R7=m((Ckt,xye)=>{l();"use strict";var wye=Ee(),T7=Object.assign(wye("libp2p:circuit:stream-handler"),{error:wye("libp2p:circuit:stream-handler:err")}),_ye=fa(),iXe=S1(),{CircuitRelay:Eye}=F1(),Sye=class{constructor({stream:e,maxLength:r=4096}){this.stream=e,this.shake=iXe(this.stream),this.decoder=_ye.decode.fromReader(this.shake.reader,{maxDataLength:r})}async read(){let e=await this.decoder.next();if(e.value){let r=Eye.decode(e.value.slice());return T7("read message type",r.type),r}T7("read received no value, closing stream"),this.close()}write(e){T7("write message type %s",e.type),this.shake.write(_ye.encode.single(Eye.encode(e).finish()))}rest(){return this.shake.rest(),this.shake.stream}end(e){this.write(e),this.close()}close(){T7("closing the stream"),this.rest().sink([])}};xye.exports=Sye});var PC=m((Okt,RC)=>{l();"use strict";var Aye=Ee(),e3=Object.assign(Aye("libp2p:circuit:stop"),{error:Aye("libp2p:circuit:stop:err")}),{CircuitRelay:TC}=F1(),nXe=Jm(),sXe=R7(),{validateAddrs:oXe}=IC();RC.exports.handleStop=function({connection:e,request:r,streamHandler:i}){try{oXe(r,i)}catch(n){return e3.error("invalid stop request via peer %s",e.remotePeer.toB58String(),n)}return e3("stop request is valid"),i.write({type:TC.Type.STATUS,code:TC.Status.SUCCESS}),i.rest()};RC.exports.stop=async function({connection:e,request:r}){let{stream:i}=await e.newStream([nXe.relay]);e3("starting stop request to %s",e.remotePeer.toB58String());let n=new sXe({stream:i});n.write(r);let s=await n.read();if(!s)return n.close();if(s.code===TC.Status.SUCCESS)return e3("stop request to %s was successful",e.remotePeer.toB58String()),n.rest();e3("stop request failed with code %d",s.code),n.close()}});var CC=m((kkt,Oye)=>{l();"use strict";var Iye=Ee(),qu=Object.assign(Iye("libp2p:circuit:hop"),{error:Iye("libp2p:circuit:hop:err")}),Tye=_r(),aXe=it(),{validateAddrs:cXe}=IC(),Rye=R7(),{CircuitRelay:Ds}=F1(),{pipe:uXe}=Nr(),{codes:Pye}=_i(),{stop:fXe}=PC(),Cye=Jm();async function lXe({connection:t,request:e,streamHandler:r,circuit:i}){if(!i._options.hop.enabled)return qu("HOP request received but we are not acting as a relay"),r.end({type:Ds.Type.STATUS,code:Ds.Status.HOP_CANT_SPEAK_RELAY});try{cXe(e,r)}catch(u){return qu.error("invalid hop request via peer %s",t.remotePeer.toB58String(),u)}if(!e.dstPeer){qu("HOP request received but we do not receive a dstPeer");return}let n=new aXe(e.dstPeer.id),s=i._connectionManager.get(n);if(!s&&!i._options.hop.active)return qu("HOP request received but we are not connected to the destination peer"),r.end({type:Ds.Type.STATUS,code:Ds.Status.HOP_NO_CONN_TO_DST});if(!s)return;let o={type:Ds.Type.STOP,dstPeer:e.dstPeer,srcPeer:e.srcPeer},a;try{a=await fXe({connection:s,request:o})}catch(u){return qu.error(u)}qu("hop request from %s is valid",t.remotePeer.toB58String()),r.write({type:Ds.Type.STATUS,code:Ds.Status.SUCCESS});let c=r.rest();return uXe(c,a,c)}async function dXe({connection:t,request:e}){let{stream:r}=await t.newStream([Cye.relay]),i=new Rye({stream:r});i.write(e);let n=await i.read();if(!n)throw Tye(new Error("HOP request had no response"),Pye.ERR_HOP_REQUEST_FAILED);if(n.code===Ds.Status.SUCCESS)return qu("hop request was successful"),i.rest();throw qu("hop request failed with code %d, closing stream",n.code),i.close(),Tye(new Error(`HOP request failed with code ${n.code}`),Pye.ERR_HOP_REQUEST_FAILED)}async function hXe({connection:t}){let{stream:e}=await t.newStream([Cye.relay]),r=new Rye({stream:e});r.write({type:Ds.Type.CAN_HOP});let i=await r.read();return await r.close(),!(!i||i.code!==Ds.Status.SUCCESS)}function pXe({connection:t,streamHandler:e,circuit:r}){let i=r._options.hop.enabled;qu("can hop (%s) request from %s",i,t.remotePeer.toB58String()),e.end({type:Ds.Type.STATUS,code:i?Ds.Status.SUCCESS:Ds.Status.HOP_CANT_SPEAK_RELAY})}Oye.exports={handleHop:lXe,hop:dXe,canHop:hXe,handleCanHop:pXe}});var Lye=m((Dkt,Mye)=>{l();"use strict";var kye=Ee(),ju=Object.assign(kye("libp2p:circuit"),{error:kye("libp2p:circuit:err")}),yXe=_r(),gXe=Bl(),{Multiaddr:t3}=rt(),Dye=it(),{CircuitRelay:r3}=F1(),{codes:mXe}=_i(),Bye=hye(),{relay:bXe}=Jm(),vXe=gye(),{handleCanHop:wXe,handleHop:_Xe,hop:EXe}=CC(),{handleStop:SXe}=PC(),xXe=R7(),AXe=Symbol.for("@libp2p/js-libp2p-circuit/circuit"),Nye=class{constructor({libp2p:e,upgrader:r}){this._dialer=e.dialer,this._registrar=e.registrar,this._connectionManager=e.connectionManager,this._upgrader=r,this._options=e._config.relay,this._libp2p=e,this.peerId=e.peerId,this._registrar.handle(bXe,this._onProtocol.bind(this))}async _onProtocol({connection:e,stream:r}){let i=new xXe({stream:r}),n=await i.read();if(!n)return;let s=this,o;switch(n.type){case r3.Type.CAN_HOP:{ju("received CAN_HOP request from %s",e.remotePeer.toB58String()),await wXe({circuit:s,connection:e,streamHandler:i});break}case r3.Type.HOP:{ju("received HOP request from %s",e.remotePeer.toB58String()),o=await _Xe({connection:e,request:n,streamHandler:i,circuit:s});break}case r3.Type.STOP:{ju("received STOP request from %s",e.remotePeer.toB58String()),o=await SXe({connection:e,request:n,streamHandler:i});break}default:ju("Request of type %s not supported",n.type)}if(o){let a=new t3(n.dstPeer.addrs[0]),c=new t3(n.srcPeer.addrs[0]),u=Bye({stream:o,remoteAddr:a,localAddr:c}),f=n.type===r3.Type.HOP?"relay":"inbound";ju("new %s connection %s",f,u.remoteAddr);let d=await this._upgrader.upgradeInbound(u);ju("%s connection %s upgraded",f,u.remoteAddr),this.handler&&this.handler(d)}}async dial(e,r){let i=e.toString().split("/p2p-circuit"),n=new t3(i[0]),s=new t3(i[i.length-1]),o=n.getPeerId(),a=s.getPeerId();if(!o||!a){let h="Circuit relay dial failed as addresses did not have peer id";throw ju.error(h),yXe(new Error(h),mXe.ERR_RELAYED_DIAL)}let c=Dye.createFromB58String(o),u=Dye.createFromB58String(a),f=!1,d=this._connectionManager.get(c);d||(d=await this._dialer.connectToPeer(n,r),f=!0);try{let h=await EXe({connection:d,request:{type:r3.Type.HOP,srcPeer:{id:this.peerId.toBytes(),addrs:this._libp2p.multiaddrs.map(b=>b.bytes)},dstPeer:{id:u.toBytes(),addrs:[new t3(s).bytes]}}}),p=n.encapsulate(`/p2p-circuit/p2p/${this.peerId.toB58String()}`),y=Bye({stream:h,remoteAddr:e,localAddr:p});return ju("new outbound connection %s",y.remoteAddr),this._upgrader.upgradeOutbound(y)}catch(h){throw ju.error("Circuit relay dial failed",h),f&&await d.close(),h}}createListener(e,r){return typeof e=="function"&&(r=e,e={}),this.handler=r,vXe(this._libp2p)}filter(e){return e=Array.isArray(e)?e:[e],e.filter(r=>gXe.Circuit.matches(r))}get[Symbol.toStringTag](){return"Circuit"}static isTransport(e){return Boolean(e&&e[AXe])}};Mye.exports=Nye});var OC=m((Bkt,qye)=>{l();"use strict";var{CID:IXe}=(Te(),Xu),{sha256:TXe}=(di(),zs);qye.exports.namespaceToCid=async t=>{let e=new TextEncoder().encode(t),r=await TXe.digest(e);return IXe.createV0(r)}});var Hye=m((Nkt,zye)=>{l();"use strict";var jye=Ee(),Uye=Object.assign(jye("libp2p:auto-relay"),{error:jye("libp2p:auto-relay:err")}),{fromString:RXe}=(dt(),bi),{toString:PXe}=(tt(),hr),{Multiaddr:CXe}=rt(),OXe=it(),{relay:kXe}=Jm(),{canHop:DXe}=CC(),{namespaceToCid:BXe}=OC(),{CIRCUIT_PROTO_CODE:NXe,HOP_METADATA_KEY:Fye,HOP_METADATA_VALUE:Kye,RELAY_RENDEZVOUS_NS:MXe}=w7(),Vye=class{constructor({libp2p:e,maxListeners:r=1,onError:i}){this._libp2p=e,this._peerId=e.peerId,this._peerStore=e.peerStore,this._connectionManager=e.connectionManager,this._transportManager=e.transportManager,this._addressSorter=e.dialer.addressSorter,this.maxListeners=r,this._listenRelays=new Set,this._onProtocolChange=this._onProtocolChange.bind(this),this._onPeerDisconnected=this._onPeerDisconnected.bind(this),this._peerStore.on("change:protocols",this._onProtocolChange),this._connectionManager.on("peer:disconnect",this._onPeerDisconnected),this._onError=(n,s)=>{Uye.error(s||n),i&&i(n,s)}}async _onProtocolChange({peerId:e,protocols:r}){let i=e.toB58String(),n=r.find(s=>s===kXe);if(!n&&this._listenRelays.has(i)){this._removeListenRelay(i);return}else if(!n||this._listenRelays.has(i))return;try{let s=this._connectionManager.get(e);if(!s)return;if(s.remoteAddr.protoCodes().includes(NXe)){Uye(`relayed connection to ${i} will not be used to hop on`);return}await DXe({connection:s})&&(this._peerStore.metadataBook.set(e,Fye,RXe(Kye)),await this._addListenRelay(s,i))}catch(s){this._onError(s)}}_onPeerDisconnected(e){let i=e.remotePeer.toB58String();!this._listenRelays.has(i)||this._removeListenRelay(i)}async _addListenRelay(e,r){if(this._listenRelays.size>=this.maxListeners)return;let i=this._peerStore.addressBook.getMultiaddrsForPeer(e.remotePeer,this._addressSorter);if(!i||!i.length)return;let n=`${i[0].toString()}/p2p-circuit`;this._listenRelays.add(r);try{await this._transportManager.listen([new CXe(n)])}catch(s){this._onError(s),this._listenRelays.delete(r)}}_removeListenRelay(e){this._listenRelays.delete(e)&&this._listenOnAvailableHopRelays([e])}async _listenOnAvailableHopRelays(e=[]){if(this._listenRelays.size>=this.maxListeners)return;let r=[];for(let[i,n]of this._peerStore.metadataBook.data.entries()){if(this._listenRelays.has(i)||e.includes(i))continue;let s=n.get(Fye);if(!s||PXe(s)!==Kye)continue;let o=OXe.createFromB58String(i),a=this._connectionManager.get(o);if(!a){r.push(o);continue}if(await this._addListenRelay(a,i),this._listenRelays.size>=this.maxListeners)return}for(let i of r)if(await this._tryToListenOnRelay(i),this._listenRelays.size>=this.maxListeners)return;try{let i=await BXe(MXe);for await(let n of this._libp2p.contentRouting.findProviders(i)){if(!n.multiaddrs.length)continue;let s=n.id;if(this._peerStore.addressBook.add(s,n.multiaddrs),await this._tryToListenOnRelay(s),this._listenRelays.size>=this.maxListeners)return}}catch(i){this._onError(i)}}async _tryToListenOnRelay(e){try{let r=await this._libp2p.dial(e);await this._addListenRelay(r,e.toB58String())}catch(r){this._onError(r,`could not connect and listen on known hop relay ${e.toB58String()}`)}}};zye.exports=Vye});var Xye=m((Mkt,Yye)=>{l();"use strict";var Gye=Ee(),$ye=Object.assign(Gye("libp2p:relay"),{error:Gye("libp2p:relay:err")}),{setDelayedInterval:LXe,clearDelayedInterval:qXe}=cC(),jXe=Hye(),{namespaceToCid:UXe}=OC(),{RELAY_RENDEZVOUS_NS:FXe}=w7(),Wye=class{constructor(e){this._libp2p=e,this._options={...e._config.relay},this._autoRelay=this._options.autoRelay.enabled&&new jXe({libp2p:e,...this._options.autoRelay}),this._advertiseService=this._advertiseService.bind(this)}start(){this._options.hop.enabled&&this._options.advertise.enabled&&(this._timeout=LXe(this._advertiseService,this._options.advertise.ttl,this._options.advertise.bootDelay))}stop(){qXe(this._timeout)}async _advertiseService(){try{let e=await UXe(FXe);await this._libp2p.contentRouting.provide(e)}catch(e){e.code==="NO_ROUTERS_AVAILABLE"?($ye.error("a content router, such as a DHT, must be provided in order to advertise the relay service",e),this.stop()):$ye.error(e)}}};Yye.exports=Wye});var ege=m((qkt,Jye)=>{l();var Qye=UE(),Zye=fu();Jye.exports=class{constructor(){this._buffer=new Qye,this._waitingConsumers=new Qye}push(e){let{promise:r,resolve:i}=Zye();return this._buffer.push({chunk:e,resolve:i}),this._consume(),r}_consume(){for(;!this._waitingConsumers.isEmpty()&&!this._buffer.isEmpty();){let e=this._waitingConsumers.shift(),r=this._buffer.shift();e.resolve(r.chunk),r.resolve()}}shift(){let{promise:e,resolve:r}=Zye();return this._waitingConsumers.push({resolve:r}),this._consume(),e}isEmpty(){return this._buffer.isEmpty()}}});var tge=m((jkt,DC)=>{l();"use strict";var kC=class extends Error{constructor(e){super(e||"Promise was canceled");this.name="CancelError"}get isCanceled(){return!0}},i3=class{static fn(e){return(...r)=>new i3((i,n,s)=>{r.push(s),e(...r).then(i,n)})}constructor(e){this._cancelHandlers=[],this._isPending=!0,this._isCanceled=!1,this._rejectOnCancel=!0,this._promise=new Promise((r,i)=>{this._reject=i;let n=a=>{(!this._isCanceled||!o.shouldReject)&&(this._isPending=!1,r(a))},s=a=>{this._isPending=!1,i(a)},o=a=>{if(!this._isPending)throw new Error("The `onCancel` handler was attached after the promise settled.");this._cancelHandlers.push(a)};return Object.defineProperties(o,{shouldReject:{get:()=>this._rejectOnCancel,set:a=>{this._rejectOnCancel=a}}}),e(n,s,o)})}then(e,r){return this._promise.then(e,r)}catch(e){return this._promise.catch(e)}finally(e){return this._promise.finally(e)}cancel(e){if(!(!this._isPending||this._isCanceled)){if(this._isCanceled=!0,this._cancelHandlers.length>0)try{for(let r of this._cancelHandlers)r()}catch(r){this._reject(r);return}this._rejectOnCancel&&this._reject(new kC(e))}}get isCanceled(){return this._isCanceled}};Object.setPrototypeOf(i3.prototype,Promise.prototype);DC.exports=i3;DC.exports.CancelError=kC});var ige=m((Ukt,P7)=>{l();"use strict";var rge=zP(),KXe=tge(),BC=class extends Error{},VXe=(t,e)=>new KXe((r,i,n)=>{let{count:s,filter:o=()=>!0}=e;if(!Number.isFinite(s)){i(new TypeError(`Expected a finite number, got ${typeof e.count}`));return}let a=[],c=[],u=0,f=!1,d=new Set,h=()=>(a.length===s&&(r(a),f=!0),u-c.length<s&&(i(new rge(c)),f=!0),f),p=()=>{for(let y of t)!d.has(y)&&typeof y.cancel=="function"&&y.cancel()};n(p);for(let y of t)u++,(async()=>{try{let b=await y;if(f)return;if(!o(b))throw new BC("Value does not satisfy filter");a.push(b)}catch(b){c.push(b)}finally{d.add(y),!f&&h()&&p()}})();s>u&&(i(new RangeError(`Expected input to contain at least ${e.count} items, but contains ${u} items`)),p())});P7.exports=VXe;P7.exports.AggregateError=rge;P7.exports.FilterError=BC});var nge=m((Fkt,MC)=>{l();"use strict";var NC=class extends Error{constructor(e){super(e||"Promise was canceled");this.name="CancelError"}get isCanceled(){return!0}},n3=class{static fn(e){return(...r)=>new n3((i,n,s)=>{r.push(s),e(...r).then(i,n)})}constructor(e){this._cancelHandlers=[],this._isPending=!0,this._isCanceled=!1,this._rejectOnCancel=!0,this._promise=new Promise((r,i)=>{this._reject=i;let n=a=>{(!this._isCanceled||!o.shouldReject)&&(this._isPending=!1,r(a))},s=a=>{this._isPending=!1,i(a)},o=a=>{if(!this._isPending)throw new Error("The `onCancel` handler was attached after the promise settled.");this._cancelHandlers.push(a)};return Object.defineProperties(o,{shouldReject:{get:()=>this._rejectOnCancel,set:a=>{this._rejectOnCancel=a}}}),e(n,s,o)})}then(e,r){return this._promise.then(e,r)}catch(e){return this._promise.catch(e)}finally(e){return this._promise.finally(e)}cancel(e){if(!(!this._isPending||this._isCanceled)){if(this._isCanceled=!0,this._cancelHandlers.length>0)try{for(let r of this._cancelHandlers)r()}catch(r){this._reject(r);return}this._rejectOnCancel&&this._reject(new NC(e))}}get isCanceled(){return this._isCanceled}};Object.setPrototypeOf(n3.prototype,Promise.prototype);MC.exports=n3;MC.exports.CancelError=NC});var oge=m((Kkt,LC)=>{l();"use strict";var sge=ige(),zXe=nge();LC.exports=(t,e)=>{let r=sge(t,{...e,count:1});return zXe.fn(async i=>{i(()=>{r.cancel()});let[n]=await r;return n})()};LC.exports.AggregateError=sge.AggregateError});var uge=m((Vkt,cge)=>{l();"use strict";var HXe=_r(),GXe=h0().default,{anySignal:$Xe}=sf(),WXe=ege(),YXe=oge(),age=class{constructor({addrs:e,dialAction:r,dialer:i}){this.addrs=e,this.dialer=i,this.dialAction=r}async run(e={}){let r=this.dialer.getTokens(this.addrs.length);if(r.length<1)throw HXe(new Error("No dial tokens available"),"ERR_NO_DIAL_TOKENS");let i=new WXe;r.forEach(o=>i.push(o));let n=this.addrs.map(()=>new GXe),s=0;try{return await YXe(this.addrs.map(async(o,a)=>{let c=await i.shift(),u;try{let f=n[a].signal;u=await this.dialAction(o,{...e,signal:e.signal?$Xe([f,e.signal]):f}),n.splice(a,1)}finally{s++,this.addrs.length-s>=r.length?i.push(c):this.dialer.releaseToken(r.splice(r.indexOf(c),1)[0])}return u}))}finally{n.map(o=>o.abort()),r.forEach(o=>this.dialer.releaseToken(o))}}};cge.exports=age});var hge=m((zkt,dge)=>{l();"use strict";var fge=Ee(),K1=Object.assign(fge("libp2p:dialer"),{error:fge("libp2p:dialer:err")}),qC=_r(),{Multiaddr:jC}=rt(),XXe=I6(),{AbortError:QXe}=wc(),{anySignal:ZXe}=sf(),JXe=uge(),{publicAddressesFirst:eQe}=yC(),tQe=lC(),{codes:C7}=_i(),{DIAL_TIMEOUT:rQe,MAX_PARALLEL_DIALS:iQe,MAX_PER_PEER_DIALS:nQe,MAX_ADDRS_TO_DIAL:sQe}=v7(),lge=class{constructor({transportManager:e,peerStore:r,addressSorter:i=eQe,maxParallelDials:n=iQe,maxAddrsToDial:s=sQe,dialTimeout:o=rQe,maxDialsPerPeer:a=nQe,resolvers:c={}}){this.transportManager=e,this.peerStore=r,this.addressSorter=i,this.maxParallelDials=n,this.maxAddrsToDial=s,this.timeout=o,this.maxDialsPerPeer=a,this.tokens=[...new Array(n)].map((u,f)=>f),this._pendingDials=new Map,this._pendingDialTargets=new Map;for(let[u,f]of Object.entries(c))jC.resolvers.set(u,f)}destroy(){for(let e of this._pendingDials.values())try{e.controller.abort()}catch(r){K1.error(r)}this._pendingDials.clear();for(let e of this._pendingDialTargets.values())e.reject(new QXe("Dialer was destroyed"));this._pendingDialTargets.clear()}async connectToPeer(e,r={}){let i=await this._createCancellableDialTarget(e);if(!i.addrs.length)throw qC(new Error("The dial request has no valid addresses"),C7.ERR_NO_VALID_ADDRESSES);let n=this._pendingDials.get(i.id)||this._createPendingDial(i,r);try{let s=await n.promise;return K1("dial succeeded to %s",i.id),s}catch(s){throw n.controller.signal.aborted&&(s.code=C7.ERR_TIMEOUT),K1.error(s),s}finally{n.destroy()}}async _createCancellableDialTarget(e){let r=`${parseInt(String(Math.random()*1e9),10).toString()+Date.now()}`,i=new Promise((s,o)=>{this._pendingDialTargets.set(r,{resolve:s,reject:o})}),n=await Promise.race([this._createDialTarget(e),i]);return this._pendingDialTargets.delete(r),n}async _createDialTarget(e){let{id:r,multiaddrs:i}=tQe(e);i&&this.peerStore.addressBook.add(r,i);let n=this.peerStore.addressBook.getMultiaddrsForPeer(r,this.addressSorter)||[];jC.isMultiaddr(e)&&(n=n.filter(a=>!e.equals(a)),n.unshift(e));let s=[];for(let a of n)(await this._resolve(a)).forEach(u=>s.push(u));let o=s.filter(a=>this.transportManager.transportForMultiaddr(a));if(o.length>this.maxAddrsToDial)throw this.peerStore.delete(r),qC(new Error("dial with more addresses than allowed"),C7.ERR_TOO_MANY_ADDRESSES);return{id:r.toB58String(),addrs:o}}_createPendingDial(e,r={}){let i=(u,f)=>{if(f.signal.aborted)throw qC(new Error("already aborted"),C7.ERR_ALREADY_ABORTED);return this.transportManager.dial(u,f)},n=new JXe({addrs:e.addrs,dialAction:i,dialer:this}),s=new XXe(this.timeout),o=[s.signal];r.signal&&o.push(r.signal);let a=ZXe(o),c={dialRequest:n,controller:s,promise:n.run({...r,signal:a}),destroy:()=>{s.clear(),this._pendingDials.delete(e.id)}};return this._pendingDials.set(e.id,c),c}getTokens(e){let r=Math.min(e,this.maxDialsPerPeer,this.tokens.length),i=this.tokens.splice(0,r);return K1("%d tokens request, returning %d, %d remaining",e,r,this.tokens.length),i}releaseToken(e){this.tokens.indexOf(e)>-1||(K1("token %d released",e),this.tokens.push(e))}async _resolve(e){if(!e.protoNames().includes("dnsaddr"))return[e];let i=await this._resolveRecord(e);return(await Promise.all(i.map(o=>this._resolve(o)))).flat().reduce((o,a)=>(o.find(c=>c.equals(a))||o.push(a),o),[])}async _resolveRecord(e){try{return e=new jC(e.toString()),await e.resolve()}catch(r){return K1.error(`multiaddr ${e} could not be resolved`),[]}}};dge.exports=lge});var yge=m((Hkt,pge)=>{l();"use strict";function oQe(t){return t>=55296&&t<=56319}function aQe(t){return t>=56320&&t<=57343}pge.exports=function(e,r,i){if(typeof r!="string")throw new Error("Input must be string");for(var n=r.length,s=0,o,a,c=0;c<n;c+=1){if(o=r.charCodeAt(c),a=r[c],oQe(o)&&aQe(r.charCodeAt(c+1))&&(c+=1,a+=r[c]),s+=e(a),s===i)return r.slice(0,c+1);if(s>i)return r.slice(0,c-a.length+1)}return r}});var mge=m((Gkt,gge)=>{l();"use strict";function cQe(t){return t>=55296&&t<=56319}function uQe(t){return t>=56320&&t<=57343}gge.exports=function(e){if(typeof e!="string")throw new Error("Input must be string");for(var r=e.length,i=0,n=null,s=null,o=0;o<r;o++)n=e.charCodeAt(o),uQe(n)?s!=null&&cQe(s)?i+=1:i+=3:n<=127?i+=1:n>=128&&n<=2047?i+=2:n>=2048&&n<=65535&&(i+=3),s=n;return i}});var vge=m(($kt,bge)=>{l();"use strict";var fQe=yge(),lQe=mge();bge.exports=fQe.bind(null,lQe)});var Ege=m((Wkt,_ge)=>{l();"use strict";var dQe=vge(),hQe=/[\/\?<>\\:\*\|"]/g,pQe=/[\x00-\x1f\x80-\x9f]/g,yQe=/^\.+$/,gQe=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,mQe=/[\. ]+$/;function wge(t,e){if(typeof t!="string")throw new Error("Input must be string");var r=t.replace(hQe,e).replace(pQe,e).replace(yQe,e).replace(gQe,e).replace(mQe,e);return dQe(r,255)}_ge.exports=function(t,e){var r=e&&e.replacement||"",i=wge(t,r);return r===""?i:wge(i,"")}});var Ige=m((Ykt,Age)=>{l();var V1=yt();Qc();nr();var Le=V1.asn1,z1=Age.exports=V1.pkcs7asn1=V1.pkcs7asn1||{};V1.pkcs7=V1.pkcs7||{};V1.pkcs7.asn1=z1;var Sge={name:"ContentInfo",tagClass:Le.Class.UNIVERSAL,type:Le.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:Le.Class.UNIVERSAL,type:Le.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:Le.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};z1.contentInfoValidator=Sge;var xge={name:"EncryptedContentInfo",tagClass:Le.Class.UNIVERSAL,type:Le.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:Le.Class.UNIVERSAL,type:Le.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:Le.Class.UNIVERSAL,type:Le.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:Le.Class.UNIVERSAL,type:Le.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:Le.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:Le.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};z1.envelopedDataValidator={name:"EnvelopedData",tagClass:Le.Class.UNIVERSAL,type:Le.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:Le.Class.UNIVERSAL,type:Le.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:Le.Class.UNIVERSAL,type:Le.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(xge)};z1.encryptedDataValidator={name:"EncryptedData",tagClass:Le.Class.UNIVERSAL,type:Le.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:Le.Class.UNIVERSAL,type:Le.Type.INTEGER,constructed:!1,capture:"version"}].concat(xge)};var bQe={name:"SignerInfo",tagClass:Le.Class.UNIVERSAL,type:Le.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:Le.Class.UNIVERSAL,type:Le.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:Le.Class.UNIVERSAL,type:Le.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:Le.Class.UNIVERSAL,type:Le.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:Le.Class.UNIVERSAL,type:Le.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:Le.Class.UNIVERSAL,type:Le.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:Le.Class.UNIVERSAL,type:Le.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:Le.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:Le.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:Le.Class.UNIVERSAL,type:Le.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:Le.Class.UNIVERSAL,type:Le.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:Le.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};z1.signedDataValidator={name:"SignedData",tagClass:Le.Class.UNIVERSAL,type:Le.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:Le.Class.UNIVERSAL,type:Le.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:Le.Class.UNIVERSAL,type:Le.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},Sge,{name:"SignedData.Certificates",tagClass:Le.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:Le.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:Le.Class.UNIVERSAL,type:Le.Type.SET,capture:"signerInfos",optional:!0,value:[bQe]}]};z1.recipientInfoValidator={name:"RecipientInfo",tagClass:Le.Class.UNIVERSAL,type:Le.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:Le.Class.UNIVERSAL,type:Le.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:Le.Class.UNIVERSAL,type:Le.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:Le.Class.UNIVERSAL,type:Le.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:Le.Class.UNIVERSAL,type:Le.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:Le.Class.UNIVERSAL,type:Le.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:Le.Class.UNIVERSAL,type:Le.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:Le.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:Le.Class.UNIVERSAL,type:Le.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}});var Rge=m((Xkt,Tge)=>{l();var wh=yt();nr();wh.mgf=wh.mgf||{};var vQe=Tge.exports=wh.mgf.mgf1=wh.mgf1=wh.mgf1||{};vQe.create=function(t){var e={generate:function(r,i){for(var n=new wh.util.ByteBuffer,s=Math.ceil(i/t.digestLength),o=0;o<s;o++){var a=new wh.util.ByteBuffer;a.putInt32(o),t.start(),t.update(r+a.getBytes()),n.putBuffer(t.digest())}return n.truncate(n.length()-i),n.getBytes()}};return e}});var Cge=m((Qkt,Pge)=>{l();var O7=yt();Rge();Pge.exports=O7.mgf=O7.mgf||{};O7.mgf.mgf1=O7.mgf1});var kge=m((Zkt,Oge)=>{l();var _h=yt();hf();nr();var wQe=Oge.exports=_h.pss=_h.pss||{};wQe.create=function(t){arguments.length===3&&(t={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var e=t.md,r=t.mgf,i=e.digestLength,n=t.salt||null;typeof n=="string"&&(n=_h.util.createBuffer(n));var s;if("saltLength"in t)s=t.saltLength;else if(n!==null)s=n.length();else throw new Error("Salt length not specified or specific salt not given.");if(n!==null&&n.length()!==s)throw new Error("Given salt length does not match length of given salt.");var o=t.prng||_h.random,a={};return a.encode=function(c,u){var f,d=u-1,h=Math.ceil(d/8),p=c.digest().getBytes();if(h<i+s+2)throw new Error("Message is too long to encrypt.");var y;n===null?y=o.getBytesSync(s):y=n.bytes();var b=new _h.util.ByteBuffer;b.fillWithByte(0,8),b.putBytes(p),b.putBytes(y),e.start(),e.update(b.getBytes());var E=e.digest().getBytes(),v=new _h.util.ByteBuffer;v.fillWithByte(0,h-s-i-2),v.putByte(1),v.putBytes(y);var A=v.getBytes(),R=h-i-1,F=r.generate(E,R),D="";for(f=0;f<R;f++)D+=String.fromCharCode(A.charCodeAt(f)^F.charCodeAt(f));var B=65280>>8*h-d&255;return D=String.fromCharCode(D.charCodeAt(0)&~B)+D.substr(1),D+E+String.fromCharCode(188)},a.verify=function(c,u,f){var d,h=f-1,p=Math.ceil(h/8);if(u=u.substr(-p),p<i+s+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(u.charCodeAt(p-1)!==188)throw new Error("Encoded message does not end in 0xBC.");var y=p-i-1,b=u.substr(0,y),E=u.substr(y,i),v=65280>>8*p-h&255;if((b.charCodeAt(0)&v)!=0)throw new Error("Bits beyond keysize not zero as expected.");var A=r.generate(E,y),R="";for(d=0;d<y;d++)R+=String.fromCharCode(b.charCodeAt(d)^A.charCodeAt(d));R=String.fromCharCode(R.charCodeAt(0)&~v)+R.substr(1);var F=p-i-s-2;for(d=0;d<F;d++)if(R.charCodeAt(d)!==0)throw new Error("Leftmost octets not zero as expected");if(R.charCodeAt(F)!==1)throw new Error("Inconsistent PSS signature, 0x01 marker not found");var D=R.substr(-s),B=new _h.util.ByteBuffer;B.fillWithByte(0,8),B.putBytes(c),B.putBytes(D),e.start(),e.update(B.getBytes());var H=e.digest().getBytes();return E===H},a}});var FC=m((Jkt,Mge)=>{l();var ke=yt();_0();Qc();z6();df();Cge();b0();W6();kge();my();nr();var O=ke.asn1,Re=Mge.exports=ke.pki=ke.pki||{},st=Re.oids,oi={};oi.CN=st.commonName;oi.commonName="CN";oi.C=st.countryName;oi.countryName="C";oi.L=st.localityName;oi.localityName="L";oi.ST=st.stateOrProvinceName;oi.stateOrProvinceName="ST";oi.O=st.organizationName;oi.organizationName="O";oi.OU=st.organizationalUnitName;oi.organizationalUnitName="OU";oi.E=st.emailAddress;oi.emailAddress="E";var Dge=ke.pki.rsa.publicKeyValidator,_Qe={name:"Certificate",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:O.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:O.Class.UNIVERSAL,type:O.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:O.Class.UNIVERSAL,type:O.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:O.Class.UNIVERSAL,type:O.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:O.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:O.Class.UNIVERSAL,type:O.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:O.Class.UNIVERSAL,type:O.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:O.Class.UNIVERSAL,type:O.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:O.Class.UNIVERSAL,type:O.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},Dge,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:O.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:O.Class.UNIVERSAL,type:O.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:O.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:O.Class.UNIVERSAL,type:O.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:O.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:O.Class.UNIVERSAL,type:O.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:O.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:O.Class.UNIVERSAL,type:O.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},EQe={name:"rsapss",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:O.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:O.Class.UNIVERSAL,type:O.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:O.Class.UNIVERSAL,type:O.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:O.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:O.Class.UNIVERSAL,type:O.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:O.Class.UNIVERSAL,type:O.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:O.Class.UNIVERSAL,type:O.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:O.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:O.Class.UNIVERSAL,type:O.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:O.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:O.Class.UNIVERSAL,type:O.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},SQe={name:"CertificationRequestInfo",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:O.Class.UNIVERSAL,type:O.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},Dge,{name:"CertificationRequestInfo.attributes",tagClass:O.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:O.Class.UNIVERSAL,type:O.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:O.Class.UNIVERSAL,type:O.Type.SET,constructed:!0}]}]}]},xQe={name:"CertificationRequest",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[SQe,{name:"CertificationRequest.signatureAlgorithm",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:O.Class.UNIVERSAL,type:O.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:O.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:O.Class.UNIVERSAL,type:O.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};Re.RDNAttributesAsArray=function(t,e){for(var r=[],i,n,s,o=0;o<t.value.length;++o){i=t.value[o];for(var a=0;a<i.value.length;++a)s={},n=i.value[a],s.type=O.derToOid(n.value[0].value),s.value=n.value[1].value,s.valueTagClass=n.value[1].type,s.type in st&&(s.name=st[s.type],s.name in oi&&(s.shortName=oi[s.name])),e&&(e.update(s.type),e.update(s.value)),r.push(s)}return r};Re.CRIAttributesAsArray=function(t){for(var e=[],r=0;r<t.length;++r)for(var i=t[r],n=O.derToOid(i.value[0].value),s=i.value[1].value,o=0;o<s.length;++o){var a={};if(a.type=n,a.value=s[o].value,a.valueTagClass=s[o].type,a.type in st&&(a.name=st[a.type],a.name in oi&&(a.shortName=oi[a.name])),a.type===st.extensionRequest){a.extensions=[];for(var c=0;c<a.value.length;++c)a.extensions.push(Re.certificateExtensionFromAsn1(a.value[c]))}e.push(a)}return e};function ml(t,e){typeof e=="string"&&(e={shortName:e});for(var r=null,i,n=0;r===null&&n<t.attributes.length;++n)i=t.attributes[n],(e.type&&e.type===i.type||e.name&&e.name===i.name||e.shortName&&e.shortName===i.shortName)&&(r=i);return r}var k7=function(t,e,r){var i={};if(t!==st["RSASSA-PSS"])return i;r&&(i={hash:{algorithmOid:st.sha1},mgf:{algorithmOid:st.mgf1,hash:{algorithmOid:st.sha1}},saltLength:20});var n={},s=[];if(!O.validate(e,EQe,n,s)){var o=new Error("Cannot read RSASSA-PSS parameter block.");throw o.errors=s,o}return n.hashOid!==void 0&&(i.hash=i.hash||{},i.hash.algorithmOid=O.derToOid(n.hashOid)),n.maskGenOid!==void 0&&(i.mgf=i.mgf||{},i.mgf.algorithmOid=O.derToOid(n.maskGenOid),i.mgf.hash=i.mgf.hash||{},i.mgf.hash.algorithmOid=O.derToOid(n.maskGenHashOid)),n.saltLength!==void 0&&(i.saltLength=n.saltLength.charCodeAt(0)),i};Re.certificateFromPem=function(t,e,r){var i=ke.pem.decode(t)[0];if(i.type!=="CERTIFICATE"&&i.type!=="X509 CERTIFICATE"&&i.type!=="TRUSTED CERTIFICATE"){var n=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw n.headerType=i.type,n}if(i.procType&&i.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var s=O.fromDer(i.body,r);return Re.certificateFromAsn1(s,e)};Re.certificateToPem=function(t,e){var r={type:"CERTIFICATE",body:O.toDer(Re.certificateToAsn1(t)).getBytes()};return ke.pem.encode(r,{maxline:e})};Re.publicKeyFromPem=function(t){var e=ke.pem.decode(t)[0];if(e.type!=="PUBLIC KEY"&&e.type!=="RSA PUBLIC KEY"){var r=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw r.headerType=e.type,r}if(e.procType&&e.procType.type==="ENCRYPTED")throw new Error("Could not convert public key from PEM; PEM is encrypted.");var i=O.fromDer(e.body);return Re.publicKeyFromAsn1(i)};Re.publicKeyToPem=function(t,e){var r={type:"PUBLIC KEY",body:O.toDer(Re.publicKeyToAsn1(t)).getBytes()};return ke.pem.encode(r,{maxline:e})};Re.publicKeyToRSAPublicKeyPem=function(t,e){var r={type:"RSA PUBLIC KEY",body:O.toDer(Re.publicKeyToRSAPublicKey(t)).getBytes()};return ke.pem.encode(r,{maxline:e})};Re.getPublicKeyFingerprint=function(t,e){e=e||{};var r=e.md||ke.md.sha1.create(),i=e.type||"RSAPublicKey",n;switch(i){case"RSAPublicKey":n=O.toDer(Re.publicKeyToRSAPublicKey(t)).getBytes();break;case"SubjectPublicKeyInfo":n=O.toDer(Re.publicKeyToAsn1(t)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+e.type+'".')}r.start(),r.update(n);var s=r.digest();if(e.encoding==="hex"){var o=s.toHex();return e.delimiter?o.match(/.{2}/g).join(e.delimiter):o}else{if(e.encoding==="binary")return s.getBytes();if(e.encoding)throw new Error('Unknown encoding "'+e.encoding+'".')}return s};Re.certificationRequestFromPem=function(t,e,r){var i=ke.pem.decode(t)[0];if(i.type!=="CERTIFICATE REQUEST"){var n=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw n.headerType=i.type,n}if(i.procType&&i.procType.type==="ENCRYPTED")throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var s=O.fromDer(i.body,r);return Re.certificationRequestFromAsn1(s,e)};Re.certificationRequestToPem=function(t,e){var r={type:"CERTIFICATE REQUEST",body:O.toDer(Re.certificationRequestToAsn1(t)).getBytes()};return ke.pem.encode(r,{maxline:e})};Re.createCertificate=function(){var t={};return t.version=2,t.serialNumber="00",t.signatureOid=null,t.signature=null,t.siginfo={},t.siginfo.algorithmOid=null,t.validity={},t.validity.notBefore=new Date,t.validity.notAfter=new Date,t.issuer={},t.issuer.getField=function(e){return ml(t.issuer,e)},t.issuer.addField=function(e){Ro([e]),t.issuer.attributes.push(e)},t.issuer.attributes=[],t.issuer.hash=null,t.subject={},t.subject.getField=function(e){return ml(t.subject,e)},t.subject.addField=function(e){Ro([e]),t.subject.attributes.push(e)},t.subject.attributes=[],t.subject.hash=null,t.extensions=[],t.publicKey=null,t.md=null,t.setSubject=function(e,r){Ro(e),t.subject.attributes=e,delete t.subject.uniqueId,r&&(t.subject.uniqueId=r),t.subject.hash=null},t.setIssuer=function(e,r){Ro(e),t.issuer.attributes=e,delete t.issuer.uniqueId,r&&(t.issuer.uniqueId=r),t.issuer.hash=null},t.setExtensions=function(e){for(var r=0;r<e.length;++r)Bge(e[r],{cert:t});t.extensions=e},t.getExtension=function(e){typeof e=="string"&&(e={name:e});for(var r=null,i,n=0;r===null&&n<t.extensions.length;++n)i=t.extensions[n],(e.id&&i.id===e.id||e.name&&i.name===e.name)&&(r=i);return r},t.sign=function(e,r){t.md=r||ke.md.sha1.create();var i=st[t.md.algorithm+"WithRSAEncryption"];if(!i){var n=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw n.algorithm=t.md.algorithm,n}t.signatureOid=t.siginfo.algorithmOid=i,t.tbsCertificate=Re.getTBSCertificate(t);var s=O.toDer(t.tbsCertificate);t.md.update(s.getBytes()),t.signature=e.sign(t.md)},t.verify=function(e){var r=!1;if(!t.issued(e)){var i=e.issuer,n=t.subject,s=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");throw s.expectedIssuer=i.attributes,s.actualIssuer=n.attributes,s}var o=e.md;if(o===null){if(e.signatureOid in st){var a=st[e.signatureOid];switch(a){case"sha1WithRSAEncryption":o=ke.md.sha1.create();break;case"md5WithRSAEncryption":o=ke.md.md5.create();break;case"sha256WithRSAEncryption":o=ke.md.sha256.create();break;case"sha384WithRSAEncryption":o=ke.md.sha384.create();break;case"sha512WithRSAEncryption":o=ke.md.sha512.create();break;case"RSASSA-PSS":o=ke.md.sha256.create();break}}if(o===null){var s=new Error("Could not compute certificate digest. Unknown signature OID.");throw s.signatureOid=e.signatureOid,s}var c=e.tbsCertificate||Re.getTBSCertificate(e),u=O.toDer(c);o.update(u.getBytes())}if(o!==null){var f;switch(e.signatureOid){case st.sha1WithRSAEncryption:f=void 0;break;case st["RSASSA-PSS"]:var d,h;if(d=st[e.signatureParameters.mgf.hash.algorithmOid],d===void 0||ke.md[d]===void 0){var s=new Error("Unsupported MGF hash function.");throw s.oid=e.signatureParameters.mgf.hash.algorithmOid,s.name=d,s}if(h=st[e.signatureParameters.mgf.algorithmOid],h===void 0||ke.mgf[h]===void 0){var s=new Error("Unsupported MGF function.");throw s.oid=e.signatureParameters.mgf.algorithmOid,s.name=h,s}if(h=ke.mgf[h].create(ke.md[d].create()),d=st[e.signatureParameters.hash.algorithmOid],d===void 0||ke.md[d]===void 0)throw{message:"Unsupported RSASSA-PSS hash function.",oid:e.signatureParameters.hash.algorithmOid,name:d};f=ke.pss.create(ke.md[d].create(),h,e.signatureParameters.saltLength);break}r=t.publicKey.verify(o.digest().getBytes(),e.signature,f)}return r},t.isIssuer=function(e){var r=!1,i=t.issuer,n=e.subject;if(i.hash&&n.hash)r=i.hash===n.hash;else if(i.attributes.length===n.attributes.length){r=!0;for(var s,o,a=0;r&&a<i.attributes.length;++a)s=i.attributes[a],o=n.attributes[a],(s.type!==o.type||s.value!==o.value)&&(r=!1)}return r},t.issued=function(e){return e.isIssuer(t)},t.generateSubjectKeyIdentifier=function(){return Re.getPublicKeyFingerprint(t.publicKey,{type:"RSAPublicKey"})},t.verifySubjectKeyIdentifier=function(){for(var e=st.subjectKeyIdentifier,r=0;r<t.extensions.length;++r){var i=t.extensions[r];if(i.id===e){var n=t.generateSubjectKeyIdentifier().getBytes();return ke.util.hexToBytes(i.subjectKeyIdentifier)===n}}return!1},t};Re.certificateFromAsn1=function(t,e){var r={},i=[];if(!O.validate(t,_Qe,r,i)){var n=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw n.errors=i,n}var s=O.derToOid(r.publicKeyOid);if(s!==Re.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var o=Re.createCertificate();o.version=r.certVersion?r.certVersion.charCodeAt(0):0;var a=ke.util.createBuffer(r.certSerialNumber);o.serialNumber=a.toHex(),o.signatureOid=ke.asn1.derToOid(r.certSignatureOid),o.signatureParameters=k7(o.signatureOid,r.certSignatureParams,!0),o.siginfo.algorithmOid=ke.asn1.derToOid(r.certinfoSignatureOid),o.siginfo.parameters=k7(o.siginfo.algorithmOid,r.certinfoSignatureParams,!1),o.signature=r.certSignature;var c=[];if(r.certValidity1UTCTime!==void 0&&c.push(O.utcTimeToDate(r.certValidity1UTCTime)),r.certValidity2GeneralizedTime!==void 0&&c.push(O.generalizedTimeToDate(r.certValidity2GeneralizedTime)),r.certValidity3UTCTime!==void 0&&c.push(O.utcTimeToDate(r.certValidity3UTCTime)),r.certValidity4GeneralizedTime!==void 0&&c.push(O.generalizedTimeToDate(r.certValidity4GeneralizedTime)),c.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(c.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(o.validity.notBefore=c[0],o.validity.notAfter=c[1],o.tbsCertificate=r.tbsCertificate,e){if(o.md=null,o.signatureOid in st){var s=st[o.signatureOid];switch(s){case"sha1WithRSAEncryption":o.md=ke.md.sha1.create();break;case"md5WithRSAEncryption":o.md=ke.md.md5.create();break;case"sha256WithRSAEncryption":o.md=ke.md.sha256.create();break;case"sha384WithRSAEncryption":o.md=ke.md.sha384.create();break;case"sha512WithRSAEncryption":o.md=ke.md.sha512.create();break;case"RSASSA-PSS":o.md=ke.md.sha256.create();break}}if(o.md===null){var n=new Error("Could not compute certificate digest. Unknown signature OID.");throw n.signatureOid=o.signatureOid,n}var u=O.toDer(o.tbsCertificate);o.md.update(u.getBytes())}var f=ke.md.sha1.create();o.issuer.getField=function(h){return ml(o.issuer,h)},o.issuer.addField=function(h){Ro([h]),o.issuer.attributes.push(h)},o.issuer.attributes=Re.RDNAttributesAsArray(r.certIssuer,f),r.certIssuerUniqueId&&(o.issuer.uniqueId=r.certIssuerUniqueId),o.issuer.hash=f.digest().toHex();var d=ke.md.sha1.create();return o.subject.getField=function(h){return ml(o.subject,h)},o.subject.addField=function(h){Ro([h]),o.subject.attributes.push(h)},o.subject.attributes=Re.RDNAttributesAsArray(r.certSubject,d),r.certSubjectUniqueId&&(o.subject.uniqueId=r.certSubjectUniqueId),o.subject.hash=d.digest().toHex(),r.certExtensions?o.extensions=Re.certificateExtensionsFromAsn1(r.certExtensions):o.extensions=[],o.publicKey=Re.publicKeyFromAsn1(r.subjectPublicKeyInfo),o};Re.certificateExtensionsFromAsn1=function(t){for(var e=[],r=0;r<t.value.length;++r)for(var i=t.value[r],n=0;n<i.value.length;++n)e.push(Re.certificateExtensionFromAsn1(i.value[n]));return e};Re.certificateExtensionFromAsn1=function(t){var e={};if(e.id=O.derToOid(t.value[0].value),e.critical=!1,t.value[1].type===O.Type.BOOLEAN?(e.critical=t.value[1].value.charCodeAt(0)!==0,e.value=t.value[2].value):e.value=t.value[1].value,e.id in st){if(e.name=st[e.id],e.name==="keyUsage"){var r=O.fromDer(e.value),i=0,n=0;r.value.length>1&&(i=r.value.charCodeAt(1),n=r.value.length>2?r.value.charCodeAt(2):0),e.digitalSignature=(i&128)==128,e.nonRepudiation=(i&64)==64,e.keyEncipherment=(i&32)==32,e.dataEncipherment=(i&16)==16,e.keyAgreement=(i&8)==8,e.keyCertSign=(i&4)==4,e.cRLSign=(i&2)==2,e.encipherOnly=(i&1)==1,e.decipherOnly=(n&128)==128}else if(e.name==="basicConstraints"){var r=O.fromDer(e.value);r.value.length>0&&r.value[0].type===O.Type.BOOLEAN?e.cA=r.value[0].value.charCodeAt(0)!==0:e.cA=!1;var s=null;r.value.length>0&&r.value[0].type===O.Type.INTEGER?s=r.value[0].value:r.value.length>1&&(s=r.value[1].value),s!==null&&(e.pathLenConstraint=O.derToInteger(s))}else if(e.name==="extKeyUsage")for(var r=O.fromDer(e.value),o=0;o<r.value.length;++o){var a=O.derToOid(r.value[o].value);a in st?e[st[a]]=!0:e[a]=!0}else if(e.name==="nsCertType"){var r=O.fromDer(e.value),i=0;r.value.length>1&&(i=r.value.charCodeAt(1)),e.client=(i&128)==128,e.server=(i&64)==64,e.email=(i&32)==32,e.objsign=(i&16)==16,e.reserved=(i&8)==8,e.sslCA=(i&4)==4,e.emailCA=(i&2)==2,e.objCA=(i&1)==1}else if(e.name==="subjectAltName"||e.name==="issuerAltName"){e.altNames=[];for(var c,r=O.fromDer(e.value),u=0;u<r.value.length;++u){c=r.value[u];var f={type:c.type,value:c.value};switch(e.altNames.push(f),c.type){case 1:case 2:case 6:break;case 7:f.ip=ke.util.bytesToIP(c.value);break;case 8:f.oid=O.derToOid(c.value);break;default:}}}else if(e.name==="subjectKeyIdentifier"){var r=O.fromDer(e.value);e.subjectKeyIdentifier=ke.util.bytesToHex(r.value)}}return e};Re.certificationRequestFromAsn1=function(t,e){var r={},i=[];if(!O.validate(t,xQe,r,i)){var n=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw n.errors=i,n}var s=O.derToOid(r.publicKeyOid);if(s!==Re.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var o=Re.createCertificationRequest();if(o.version=r.csrVersion?r.csrVersion.charCodeAt(0):0,o.signatureOid=ke.asn1.derToOid(r.csrSignatureOid),o.signatureParameters=k7(o.signatureOid,r.csrSignatureParams,!0),o.siginfo.algorithmOid=ke.asn1.derToOid(r.csrSignatureOid),o.siginfo.parameters=k7(o.siginfo.algorithmOid,r.csrSignatureParams,!1),o.signature=r.csrSignature,o.certificationRequestInfo=r.certificationRequestInfo,e){if(o.md=null,o.signatureOid in st){var s=st[o.signatureOid];switch(s){case"sha1WithRSAEncryption":o.md=ke.md.sha1.create();break;case"md5WithRSAEncryption":o.md=ke.md.md5.create();break;case"sha256WithRSAEncryption":o.md=ke.md.sha256.create();break;case"sha384WithRSAEncryption":o.md=ke.md.sha384.create();break;case"sha512WithRSAEncryption":o.md=ke.md.sha512.create();break;case"RSASSA-PSS":o.md=ke.md.sha256.create();break}}if(o.md===null){var n=new Error("Could not compute certification request digest. Unknown signature OID.");throw n.signatureOid=o.signatureOid,n}var a=O.toDer(o.certificationRequestInfo);o.md.update(a.getBytes())}var c=ke.md.sha1.create();return o.subject.getField=function(u){return ml(o.subject,u)},o.subject.addField=function(u){Ro([u]),o.subject.attributes.push(u)},o.subject.attributes=Re.RDNAttributesAsArray(r.certificationRequestInfoSubject,c),o.subject.hash=c.digest().toHex(),o.publicKey=Re.publicKeyFromAsn1(r.subjectPublicKeyInfo),o.getAttribute=function(u){return ml(o,u)},o.addAttribute=function(u){Ro([u]),o.attributes.push(u)},o.attributes=Re.CRIAttributesAsArray(r.certificationRequestInfoAttributes||[]),o};Re.createCertificationRequest=function(){var t={};return t.version=0,t.signatureOid=null,t.signature=null,t.siginfo={},t.siginfo.algorithmOid=null,t.subject={},t.subject.getField=function(e){return ml(t.subject,e)},t.subject.addField=function(e){Ro([e]),t.subject.attributes.push(e)},t.subject.attributes=[],t.subject.hash=null,t.publicKey=null,t.attributes=[],t.getAttribute=function(e){return ml(t,e)},t.addAttribute=function(e){Ro([e]),t.attributes.push(e)},t.md=null,t.setSubject=function(e){Ro(e),t.subject.attributes=e,t.subject.hash=null},t.setAttributes=function(e){Ro(e),t.attributes=e},t.sign=function(e,r){t.md=r||ke.md.sha1.create();var i=st[t.md.algorithm+"WithRSAEncryption"];if(!i){var n=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw n.algorithm=t.md.algorithm,n}t.signatureOid=t.siginfo.algorithmOid=i,t.certificationRequestInfo=Re.getCertificationRequestInfo(t);var s=O.toDer(t.certificationRequestInfo);t.md.update(s.getBytes()),t.signature=e.sign(t.md)},t.verify=function(){var e=!1,r=t.md;if(r===null){if(t.signatureOid in st){var i=st[t.signatureOid];switch(i){case"sha1WithRSAEncryption":r=ke.md.sha1.create();break;case"md5WithRSAEncryption":r=ke.md.md5.create();break;case"sha256WithRSAEncryption":r=ke.md.sha256.create();break;case"sha384WithRSAEncryption":r=ke.md.sha384.create();break;case"sha512WithRSAEncryption":r=ke.md.sha512.create();break;case"RSASSA-PSS":r=ke.md.sha256.create();break}}if(r===null){var n=new Error("Could not compute certification request digest. Unknown signature OID.");throw n.signatureOid=t.signatureOid,n}var s=t.certificationRequestInfo||Re.getCertificationRequestInfo(t),o=O.toDer(s);r.update(o.getBytes())}if(r!==null){var a;switch(t.signatureOid){case st.sha1WithRSAEncryption:break;case st["RSASSA-PSS"]:var c,u;if(c=st[t.signatureParameters.mgf.hash.algorithmOid],c===void 0||ke.md[c]===void 0){var n=new Error("Unsupported MGF hash function.");throw n.oid=t.signatureParameters.mgf.hash.algorithmOid,n.name=c,n}if(u=st[t.signatureParameters.mgf.algorithmOid],u===void 0||ke.mgf[u]===void 0){var n=new Error("Unsupported MGF function.");throw n.oid=t.signatureParameters.mgf.algorithmOid,n.name=u,n}if(u=ke.mgf[u].create(ke.md[c].create()),c=st[t.signatureParameters.hash.algorithmOid],c===void 0||ke.md[c]===void 0){var n=new Error("Unsupported RSASSA-PSS hash function.");throw n.oid=t.signatureParameters.hash.algorithmOid,n.name=c,n}a=ke.pss.create(ke.md[c].create(),u,t.signatureParameters.saltLength);break}e=t.publicKey.verify(r.digest().getBytes(),t.signature,a)}return e},t};function H1(t){for(var e=O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,[]),r,i,n=t.attributes,s=0;s<n.length;++s){r=n[s];var o=r.value,a=O.Type.PRINTABLESTRING;"valueTagClass"in r&&(a=r.valueTagClass,a===O.Type.UTF8&&(o=ke.util.encodeUtf8(o))),i=O.create(O.Class.UNIVERSAL,O.Type.SET,!0,[O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,[O.create(O.Class.UNIVERSAL,O.Type.OID,!1,O.oidToDer(r.type).getBytes()),O.create(O.Class.UNIVERSAL,a,!1,o)])]),e.value.push(i)}return e}function Ro(t){for(var e,r=0;r<t.length;++r){if(e=t[r],typeof e.name=="undefined"&&(e.type&&e.type in Re.oids?e.name=Re.oids[e.type]:e.shortName&&e.shortName in oi&&(e.name=Re.oids[oi[e.shortName]])),typeof e.type=="undefined")if(e.name&&e.name in Re.oids)e.type=Re.oids[e.name];else{var i=new Error("Attribute type not specified.");throw i.attribute=e,i}if(typeof e.shortName=="undefined"&&e.name&&e.name in oi&&(e.shortName=oi[e.name]),e.type===st.extensionRequest&&(e.valueConstructed=!0,e.valueTagClass=O.Type.SEQUENCE,!e.value&&e.extensions)){e.value=[];for(var n=0;n<e.extensions.length;++n)e.value.push(Re.certificateExtensionToAsn1(Bge(e.extensions[n])))}if(typeof e.value=="undefined"){var i=new Error("Attribute value not specified.");throw i.attribute=e,i}}}function Bge(t,e){if(e=e||{},typeof t.name=="undefined"&&t.id&&t.id in Re.oids&&(t.name=Re.oids[t.id]),typeof t.id=="undefined")if(t.name&&t.name in Re.oids)t.id=Re.oids[t.name];else{var r=new Error("Extension ID not specified.");throw r.extension=t,r}if(typeof t.value!="undefined")return t;if(t.name==="keyUsage"){var i=0,n=0,s=0;t.digitalSignature&&(n|=128,i=7),t.nonRepudiation&&(n|=64,i=6),t.keyEncipherment&&(n|=32,i=5),t.dataEncipherment&&(n|=16,i=4),t.keyAgreement&&(n|=8,i=3),t.keyCertSign&&(n|=4,i=2),t.cRLSign&&(n|=2,i=1),t.encipherOnly&&(n|=1,i=0),t.decipherOnly&&(s|=128,i=7);var o=String.fromCharCode(i);s!==0?o+=String.fromCharCode(n)+String.fromCharCode(s):n!==0&&(o+=String.fromCharCode(n)),t.value=O.create(O.Class.UNIVERSAL,O.Type.BITSTRING,!1,o)}else if(t.name==="basicConstraints")t.value=O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,[]),t.cA&&t.value.value.push(O.create(O.Class.UNIVERSAL,O.Type.BOOLEAN,!1,String.fromCharCode(255))),"pathLenConstraint"in t&&t.value.value.push(O.create(O.Class.UNIVERSAL,O.Type.INTEGER,!1,O.integerToDer(t.pathLenConstraint).getBytes()));else if(t.name==="extKeyUsage"){t.value=O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,[]);var a=t.value.value;for(var c in t)t[c]===!0&&(c in st?a.push(O.create(O.Class.UNIVERSAL,O.Type.OID,!1,O.oidToDer(st[c]).getBytes())):c.indexOf(".")!==-1&&a.push(O.create(O.Class.UNIVERSAL,O.Type.OID,!1,O.oidToDer(c).getBytes())))}else if(t.name==="nsCertType"){var i=0,n=0;t.client&&(n|=128,i=7),t.server&&(n|=64,i=6),t.email&&(n|=32,i=5),t.objsign&&(n|=16,i=4),t.reserved&&(n|=8,i=3),t.sslCA&&(n|=4,i=2),t.emailCA&&(n|=2,i=1),t.objCA&&(n|=1,i=0);var o=String.fromCharCode(i);n!==0&&(o+=String.fromCharCode(n)),t.value=O.create(O.Class.UNIVERSAL,O.Type.BITSTRING,!1,o)}else if(t.name==="subjectAltName"||t.name==="issuerAltName"){t.value=O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,[]);for(var u,f=0;f<t.altNames.length;++f){u=t.altNames[f];var o=u.value;if(u.type===7&&u.ip){if(o=ke.util.bytesFromIP(u.ip),o===null){var r=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw r.extension=t,r}}else u.type===8&&(u.oid?o=O.oidToDer(O.oidToDer(u.oid)):o=O.oidToDer(o));t.value.value.push(O.create(O.Class.CONTEXT_SPECIFIC,u.type,!1,o))}}else if(t.name==="nsComment"&&e.cert){if(!/^[\x00-\x7F]*$/.test(t.comment)||t.comment.length<1||t.comment.length>128)throw new Error('Invalid "nsComment" content.');t.value=O.create(O.Class.UNIVERSAL,O.Type.IA5STRING,!1,t.comment)}else if(t.name==="subjectKeyIdentifier"&&e.cert){var d=e.cert.generateSubjectKeyIdentifier();t.subjectKeyIdentifier=d.toHex(),t.value=O.create(O.Class.UNIVERSAL,O.Type.OCTETSTRING,!1,d.getBytes())}else if(t.name==="authorityKeyIdentifier"&&e.cert){t.value=O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,[]);var a=t.value.value;if(t.keyIdentifier){var h=t.keyIdentifier===!0?e.cert.generateSubjectKeyIdentifier().getBytes():t.keyIdentifier;a.push(O.create(O.Class.CONTEXT_SPECIFIC,0,!1,h))}if(t.authorityCertIssuer){var p=[O.create(O.Class.CONTEXT_SPECIFIC,4,!0,[H1(t.authorityCertIssuer===!0?e.cert.issuer:t.authorityCertIssuer)])];a.push(O.create(O.Class.CONTEXT_SPECIFIC,1,!0,p))}if(t.serialNumber){var y=ke.util.hexToBytes(t.serialNumber===!0?e.cert.serialNumber:t.serialNumber);a.push(O.create(O.Class.CONTEXT_SPECIFIC,2,!1,y))}}else if(t.name==="cRLDistributionPoints"){t.value=O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,[]);for(var a=t.value.value,b=O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,[]),E=O.create(O.Class.CONTEXT_SPECIFIC,0,!0,[]),u,f=0;f<t.altNames.length;++f){u=t.altNames[f];var o=u.value;if(u.type===7&&u.ip){if(o=ke.util.bytesFromIP(u.ip),o===null){var r=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw r.extension=t,r}}else u.type===8&&(u.oid?o=O.oidToDer(O.oidToDer(u.oid)):o=O.oidToDer(o));E.value.push(O.create(O.Class.CONTEXT_SPECIFIC,u.type,!1,o))}b.value.push(O.create(O.Class.CONTEXT_SPECIFIC,0,!0,[E])),a.push(b)}if(typeof t.value=="undefined"){var r=new Error("Extension value not specified.");throw r.extension=t,r}return t}function UC(t,e){switch(t){case st["RSASSA-PSS"]:var r=[];return e.hash.algorithmOid!==void 0&&r.push(O.create(O.Class.CONTEXT_SPECIFIC,0,!0,[O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,[O.create(O.Class.UNIVERSAL,O.Type.OID,!1,O.oidToDer(e.hash.algorithmOid).getBytes()),O.create(O.Class.UNIVERSAL,O.Type.NULL,!1,"")])])),e.mgf.algorithmOid!==void 0&&r.push(O.create(O.Class.CONTEXT_SPECIFIC,1,!0,[O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,[O.create(O.Class.UNIVERSAL,O.Type.OID,!1,O.oidToDer(e.mgf.algorithmOid).getBytes()),O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,[O.create(O.Class.UNIVERSAL,O.Type.OID,!1,O.oidToDer(e.mgf.hash.algorithmOid).getBytes()),O.create(O.Class.UNIVERSAL,O.Type.NULL,!1,"")])])])),e.saltLength!==void 0&&r.push(O.create(O.Class.CONTEXT_SPECIFIC,2,!0,[O.create(O.Class.UNIVERSAL,O.Type.INTEGER,!1,O.integerToDer(e.saltLength).getBytes())])),O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,r);default:return O.create(O.Class.UNIVERSAL,O.Type.NULL,!1,"")}}function AQe(t){var e=O.create(O.Class.CONTEXT_SPECIFIC,0,!0,[]);if(t.attributes.length===0)return e;for(var r=t.attributes,i=0;i<r.length;++i){var n=r[i],s=n.value,o=O.Type.UTF8;"valueTagClass"in n&&(o=n.valueTagClass),o===O.Type.UTF8&&(s=ke.util.encodeUtf8(s));var a=!1;"valueConstructed"in n&&(a=n.valueConstructed);var c=O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,[O.create(O.Class.UNIVERSAL,O.Type.OID,!1,O.oidToDer(n.type).getBytes()),O.create(O.Class.UNIVERSAL,O.Type.SET,!0,[O.create(O.Class.UNIVERSAL,o,a,s)])]);e.value.push(c)}return e}var IQe=new Date("1950-01-01T00:00:00Z"),TQe=new Date("2050-01-01T00:00:00Z");function Nge(t){return t>=IQe&&t<TQe?O.create(O.Class.UNIVERSAL,O.Type.UTCTIME,!1,O.dateToUtcTime(t)):O.create(O.Class.UNIVERSAL,O.Type.GENERALIZEDTIME,!1,O.dateToGeneralizedTime(t))}Re.getTBSCertificate=function(t){var e=Nge(t.validity.notBefore),r=Nge(t.validity.notAfter),i=O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,[O.create(O.Class.CONTEXT_SPECIFIC,0,!0,[O.create(O.Class.UNIVERSAL,O.Type.INTEGER,!1,O.integerToDer(t.version).getBytes())]),O.create(O.Class.UNIVERSAL,O.Type.INTEGER,!1,ke.util.hexToBytes(t.serialNumber)),O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,[O.create(O.Class.UNIVERSAL,O.Type.OID,!1,O.oidToDer(t.siginfo.algorithmOid).getBytes()),UC(t.siginfo.algorithmOid,t.siginfo.parameters)]),H1(t.issuer),O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,[e,r]),H1(t.subject),Re.publicKeyToAsn1(t.publicKey)]);return t.issuer.uniqueId&&i.value.push(O.create(O.Class.CONTEXT_SPECIFIC,1,!0,[O.create(O.Class.UNIVERSAL,O.Type.BITSTRING,!1,String.fromCharCode(0)+t.issuer.uniqueId)])),t.subject.uniqueId&&i.value.push(O.create(O.Class.CONTEXT_SPECIFIC,2,!0,[O.create(O.Class.UNIVERSAL,O.Type.BITSTRING,!1,String.fromCharCode(0)+t.subject.uniqueId)])),t.extensions.length>0&&i.value.push(Re.certificateExtensionsToAsn1(t.extensions)),i};Re.getCertificationRequestInfo=function(t){var e=O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,[O.create(O.Class.UNIVERSAL,O.Type.INTEGER,!1,O.integerToDer(t.version).getBytes()),H1(t.subject),Re.publicKeyToAsn1(t.publicKey),AQe(t)]);return e};Re.distinguishedNameToAsn1=function(t){return H1(t)};Re.certificateToAsn1=function(t){var e=t.tbsCertificate||Re.getTBSCertificate(t);return O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,[e,O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,[O.create(O.Class.UNIVERSAL,O.Type.OID,!1,O.oidToDer(t.signatureOid).getBytes()),UC(t.signatureOid,t.signatureParameters)]),O.create(O.Class.UNIVERSAL,O.Type.BITSTRING,!1,String.fromCharCode(0)+t.signature)])};Re.certificateExtensionsToAsn1=function(t){var e=O.create(O.Class.CONTEXT_SPECIFIC,3,!0,[]),r=O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,[]);e.value.push(r);for(var i=0;i<t.length;++i)r.value.push(Re.certificateExtensionToAsn1(t[i]));return e};Re.certificateExtensionToAsn1=function(t){var e=O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,[]);e.value.push(O.create(O.Class.UNIVERSAL,O.Type.OID,!1,O.oidToDer(t.id).getBytes())),t.critical&&e.value.push(O.create(O.Class.UNIVERSAL,O.Type.BOOLEAN,!1,String.fromCharCode(255)));var r=t.value;return typeof t.value!="string"&&(r=O.toDer(r).getBytes()),e.value.push(O.create(O.Class.UNIVERSAL,O.Type.OCTETSTRING,!1,r)),e};Re.certificationRequestToAsn1=function(t){var e=t.certificationRequestInfo||Re.getCertificationRequestInfo(t);return O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,[e,O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,[O.create(O.Class.UNIVERSAL,O.Type.OID,!1,O.oidToDer(t.signatureOid).getBytes()),UC(t.signatureOid,t.signatureParameters)]),O.create(O.Class.UNIVERSAL,O.Type.BITSTRING,!1,String.fromCharCode(0)+t.signature)])};Re.createCaStore=function(t){var e={certs:{}};e.getIssuer=function(o){var a=r(o.issuer);return a},e.addCertificate=function(o){if(typeof o=="string"&&(o=ke.pki.certificateFromPem(o)),i(o.subject),!e.hasCertificate(o))if(o.subject.hash in e.certs){var a=e.certs[o.subject.hash];ke.util.isArray(a)||(a=[a]),a.push(o),e.certs[o.subject.hash]=a}else e.certs[o.subject.hash]=o},e.hasCertificate=function(o){typeof o=="string"&&(o=ke.pki.certificateFromPem(o));var a=r(o.subject);if(!a)return!1;ke.util.isArray(a)||(a=[a]);for(var c=O.toDer(Re.certificateToAsn1(o)).getBytes(),u=0;u<a.length;++u){var f=O.toDer(Re.certificateToAsn1(a[u])).getBytes();if(c===f)return!0}return!1},e.listAllCertificates=function(){var o=[];for(var a in e.certs)if(e.certs.hasOwnProperty(a)){var c=e.certs[a];if(!ke.util.isArray(c))o.push(c);else for(var u=0;u<c.length;++u)o.push(c[u])}return o},e.removeCertificate=function(o){var a;if(typeof o=="string"&&(o=ke.pki.certificateFromPem(o)),i(o.subject),!e.hasCertificate(o))return null;var c=r(o.subject);if(!ke.util.isArray(c))return a=e.certs[o.subject.hash],delete e.certs[o.subject.hash],a;for(var u=O.toDer(Re.certificateToAsn1(o)).getBytes(),f=0;f<c.length;++f){var d=O.toDer(Re.certificateToAsn1(c[f])).getBytes();u===d&&(a=c[f],c.splice(f,1))}return c.length===0&&delete e.certs[o.subject.hash],a};function r(o){return i(o),e.certs[o.hash]||null}function i(o){if(!o.hash){var a=ke.md.sha1.create();o.attributes=Re.RDNAttributesAsArray(H1(o),a),o.hash=a.digest().toHex()}}if(t)for(var n=0;n<t.length;++n){var s=t[n];e.addCertificate(s)}return e};Re.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"};Re.verifyCertificateChain=function(t,e,r){typeof r=="function"&&(r={verify:r}),r=r||{},e=e.slice(0);var i=e.slice(0),n=r.validityCheckDate;typeof n=="undefined"&&(n=new Date);var s=!0,o=null,a=0;do{var c=e.shift(),u=null,f=!1;if(n&&(n<c.validity.notBefore||n>c.validity.notAfter)&&(o={message:"Certificate is not valid yet or has expired.",error:Re.certificateError.certificate_expired,notBefore:c.validity.notBefore,notAfter:c.validity.notAfter,now:n}),o===null){if(u=e[0]||t.getIssuer(c),u===null&&c.isIssuer(c)&&(f=!0,u=c),u){var d=u;ke.util.isArray(d)||(d=[d]);for(var h=!1;!h&&d.length>0;){u=d.shift();try{h=u.verify(c)}catch(D){}}h||(o={message:"Certificate signature is invalid.",error:Re.certificateError.bad_certificate})}o===null&&(!u||f)&&!t.hasCertificate(c)&&(o={message:"Certificate is not trusted.",error:Re.certificateError.unknown_ca})}if(o===null&&u&&!c.isIssuer(u)&&(o={message:"Certificate issuer is invalid.",error:Re.certificateError.bad_certificate}),o===null)for(var p={keyUsage:!0,basicConstraints:!0},y=0;o===null&&y<c.extensions.length;++y){var b=c.extensions[y];b.critical&&!(b.name in p)&&(o={message:"Certificate has an unsupported critical extension.",error:Re.certificateError.unsupported_certificate})}if(o===null&&(!s||e.length===0&&(!u||f))){var E=c.getExtension("basicConstraints"),v=c.getExtension("keyUsage");if(v!==null&&(!v.keyCertSign||E===null)&&(o={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:Re.certificateError.bad_certificate}),o===null&&E!==null&&!E.cA&&(o={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:Re.certificateError.bad_certificate}),o===null&&v!==null&&"pathLenConstraint"in E){var A=a-1;A>E.pathLenConstraint&&(o={message:"Certificate basicConstraints pathLenConstraint violated.",error:Re.certificateError.bad_certificate})}}var R=o===null?!0:o.error,F=r.verify?r.verify(R,a,i):R;if(F===!0)o=null;else throw R===!0&&(o={message:"The application rejected the certificate.",error:Re.certificateError.bad_certificate}),(F||F===0)&&(typeof F=="object"&&!ke.util.isArray(F)?(F.message&&(o.message=F.message),F.error&&(o.error=F.error)):typeof F=="string"&&(o.error=F)),o;s=!1,++a}while(e.length>0);return!0}});var jge=m((eDt,qge)=>{l();var Be=yt();_0();Qc();z6();b0();W6();Ige();hf();nr();FC();var ne=Be.asn1,$n=qge.exports=Be.pkcs7=Be.pkcs7||{};$n.messageFromPem=function(t){var e=Be.pem.decode(t)[0];if(e.type!=="PKCS7"){var r=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw r.headerType=e.type,r}if(e.procType&&e.procType.type==="ENCRYPTED")throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var i=ne.fromDer(e.body);return $n.messageFromAsn1(i)};$n.messageToPem=function(t,e){var r={type:"PKCS7",body:ne.toDer(t.toAsn1()).getBytes()};return Be.pem.encode(r,{maxline:e})};$n.messageFromAsn1=function(t){var e={},r=[];if(!ne.validate(t,$n.asn1.contentInfoValidator,e,r)){var i=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw i.errors=r,i}var n=ne.derToOid(e.contentType),s;switch(n){case Be.pki.oids.envelopedData:s=$n.createEnvelopedData();break;case Be.pki.oids.encryptedData:s=$n.createEncryptedData();break;case Be.pki.oids.signedData:s=$n.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+n+" is not (yet) supported.")}return s.fromAsn1(e.content.value[0]),s};$n.createSignedData=function(){var t=null;return t={type:Be.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(i){if(VC(t,i,$n.asn1.signedDataValidator),t.certificates=[],t.crls=[],t.digestAlgorithmIdentifiers=[],t.contentInfo=null,t.signerInfos=[],t.rawCapture.certificates)for(var n=t.rawCapture.certificates.value,s=0;s<n.length;++s)t.certificates.push(Be.pki.certificateFromAsn1(n[s]))},toAsn1:function(){t.contentInfo||t.sign();for(var i=[],n=0;n<t.certificates.length;++n)i.push(Be.pki.certificateToAsn1(t.certificates[n]));var s=[],o=ne.create(ne.Class.CONTEXT_SPECIFIC,0,!0,[ne.create(ne.Class.UNIVERSAL,ne.Type.SEQUENCE,!0,[ne.create(ne.Class.UNIVERSAL,ne.Type.INTEGER,!1,ne.integerToDer(t.version).getBytes()),ne.create(ne.Class.UNIVERSAL,ne.Type.SET,!0,t.digestAlgorithmIdentifiers),t.contentInfo])]);return i.length>0&&o.value[0].value.push(ne.create(ne.Class.CONTEXT_SPECIFIC,0,!0,i)),s.length>0&&o.value[0].value.push(ne.create(ne.Class.CONTEXT_SPECIFIC,1,!0,s)),o.value[0].value.push(ne.create(ne.Class.UNIVERSAL,ne.Type.SET,!0,t.signerInfos)),ne.create(ne.Class.UNIVERSAL,ne.Type.SEQUENCE,!0,[ne.create(ne.Class.UNIVERSAL,ne.Type.OID,!1,ne.oidToDer(t.type).getBytes()),o])},addSigner:function(i){var n=i.issuer,s=i.serialNumber;if(i.certificate){var o=i.certificate;typeof o=="string"&&(o=Be.pki.certificateFromPem(o)),n=o.issuer.attributes,s=o.serialNumber}var a=i.key;if(!a)throw new Error("Could not add PKCS#7 signer; no private key specified.");typeof a=="string"&&(a=Be.pki.privateKeyFromPem(a));var c=i.digestAlgorithm||Be.pki.oids.sha1;switch(c){case Be.pki.oids.sha1:case Be.pki.oids.sha256:case Be.pki.oids.sha384:case Be.pki.oids.sha512:case Be.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+c)}var u=i.authenticatedAttributes||[];if(u.length>0){for(var f=!1,d=!1,h=0;h<u.length;++h){var p=u[h];if(!f&&p.type===Be.pki.oids.contentType){if(f=!0,d)break;continue}if(!d&&p.type===Be.pki.oids.messageDigest){if(d=!0,f)break;continue}}if(!f||!d)throw new Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.")}t.signers.push({key:a,version:1,issuer:n,serialNumber:s,digestAlgorithm:c,signatureAlgorithm:Be.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:u,unauthenticatedAttributes:[]})},sign:function(i){if(i=i||{},(typeof t.content!="object"||t.contentInfo===null)&&(t.contentInfo=ne.create(ne.Class.UNIVERSAL,ne.Type.SEQUENCE,!0,[ne.create(ne.Class.UNIVERSAL,ne.Type.OID,!1,ne.oidToDer(Be.pki.oids.data).getBytes())]),"content"in t)){var n;t.content instanceof Be.util.ByteBuffer?n=t.content.bytes():typeof t.content=="string"&&(n=Be.util.encodeUtf8(t.content)),i.detached?t.detachedContent=ne.create(ne.Class.UNIVERSAL,ne.Type.OCTETSTRING,!1,n):t.contentInfo.value.push(ne.create(ne.Class.CONTEXT_SPECIFIC,0,!0,[ne.create(ne.Class.UNIVERSAL,ne.Type.OCTETSTRING,!1,n)]))}if(t.signers.length!==0){var s=e();r(s)}},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(i){typeof i=="string"&&(i=Be.pki.certificateFromPem(i)),t.certificates.push(i)},addCertificateRevokationList:function(i){throw new Error("PKCS#7 CRL support not yet implemented.")}},t;function e(){for(var i={},n=0;n<t.signers.length;++n){var s=t.signers[n],o=s.digestAlgorithm;o in i||(i[o]=Be.md[Be.pki.oids[o]].create()),s.authenticatedAttributes.length===0?s.md=i[o]:s.md=Be.md[Be.pki.oids[o]].create()}t.digestAlgorithmIdentifiers=[];for(var o in i)t.digestAlgorithmIdentifiers.push(ne.create(ne.Class.UNIVERSAL,ne.Type.SEQUENCE,!0,[ne.create(ne.Class.UNIVERSAL,ne.Type.OID,!1,ne.oidToDer(o).getBytes()),ne.create(ne.Class.UNIVERSAL,ne.Type.NULL,!1,"")]));return i}function r(i){var n;if(t.detachedContent?n=t.detachedContent:(n=t.contentInfo.value[1],n=n.value[0]),!n)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var s=ne.derToOid(t.contentInfo.value[0].value),o=ne.toDer(n);o.getByte(),ne.getBerValueLength(o),o=o.getBytes();for(var a in i)i[a].start().update(o);for(var c=new Date,u=0;u<t.signers.length;++u){var f=t.signers[u];if(f.authenticatedAttributes.length===0){if(s!==Be.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{f.authenticatedAttributesAsn1=ne.create(ne.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var d=ne.create(ne.Class.UNIVERSAL,ne.Type.SET,!0,[]),h=0;h<f.authenticatedAttributes.length;++h){var p=f.authenticatedAttributes[h];p.type===Be.pki.oids.messageDigest?p.value=i[f.digestAlgorithm].digest():p.type===Be.pki.oids.signingTime&&(p.value||(p.value=c)),d.value.push(KC(p)),f.authenticatedAttributesAsn1.value.push(KC(p))}o=ne.toDer(d).getBytes(),f.md.start().update(o)}f.signature=f.key.sign(f.md,"RSASSA-PKCS1-V1_5")}t.signerInfos=DQe(t.signers)}};$n.createEncryptedData=function(){var t=null;return t={type:Be.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:Be.pki.oids["aes256-CBC"]},fromAsn1:function(e){VC(t,e,$n.asn1.encryptedDataValidator)},decrypt:function(e){e!==void 0&&(t.encryptedContent.key=e),Lge(t)}},t};$n.createEnvelopedData=function(){var t=null;return t={type:Be.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:Be.pki.oids["aes256-CBC"]},fromAsn1:function(e){var r=VC(t,e,$n.asn1.envelopedDataValidator);t.recipients=CQe(r.recipientInfos.value)},toAsn1:function(){return ne.create(ne.Class.UNIVERSAL,ne.Type.SEQUENCE,!0,[ne.create(ne.Class.UNIVERSAL,ne.Type.OID,!1,ne.oidToDer(t.type).getBytes()),ne.create(ne.Class.CONTEXT_SPECIFIC,0,!0,[ne.create(ne.Class.UNIVERSAL,ne.Type.SEQUENCE,!0,[ne.create(ne.Class.UNIVERSAL,ne.Type.INTEGER,!1,ne.integerToDer(t.version).getBytes()),ne.create(ne.Class.UNIVERSAL,ne.Type.SET,!0,OQe(t.recipients)),ne.create(ne.Class.UNIVERSAL,ne.Type.SEQUENCE,!0,BQe(t.encryptedContent))])])])},findRecipient:function(e){for(var r=e.issuer.attributes,i=0;i<t.recipients.length;++i){var n=t.recipients[i],s=n.issuer;if(n.serialNumber===e.serialNumber&&s.length===r.length){for(var o=!0,a=0;a<r.length;++a)if(s[a].type!==r[a].type||s[a].value!==r[a].value){o=!1;break}if(o)return n}}return null},decrypt:function(e,r){if(t.encryptedContent.key===void 0&&e!==void 0&&r!==void 0)switch(e.encryptedContent.algorithm){case Be.pki.oids.rsaEncryption:case Be.pki.oids.desCBC:var i=r.decrypt(e.encryptedContent.content);t.encryptedContent.key=Be.util.createBuffer(i);break;default:throw new Error("Unsupported asymmetric cipher, OID "+e.encryptedContent.algorithm)}Lge(t)},addRecipient:function(e){t.recipients.push({version:0,issuer:e.issuer.attributes,serialNumber:e.serialNumber,encryptedContent:{algorithm:Be.pki.oids.rsaEncryption,key:e.publicKey}})},encrypt:function(e,r){if(t.encryptedContent.content===void 0){r=r||t.encryptedContent.algorithm,e=e||t.encryptedContent.key;var i,n,s;switch(r){case Be.pki.oids["aes128-CBC"]:i=16,n=16,s=Be.aes.createEncryptionCipher;break;case Be.pki.oids["aes192-CBC"]:i=24,n=16,s=Be.aes.createEncryptionCipher;break;case Be.pki.oids["aes256-CBC"]:i=32,n=16,s=Be.aes.createEncryptionCipher;break;case Be.pki.oids["des-EDE3-CBC"]:i=24,n=8,s=Be.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+r)}if(e===void 0)e=Be.util.createBuffer(Be.random.getBytes(i));else if(e.length()!=i)throw new Error("Symmetric key has wrong length; got "+e.length()+" bytes, expected "+i+".");t.encryptedContent.algorithm=r,t.encryptedContent.key=e,t.encryptedContent.parameter=Be.util.createBuffer(Be.random.getBytes(n));var o=s(e);if(o.start(t.encryptedContent.parameter.copy()),o.update(t.content),!o.finish())throw new Error("Symmetric encryption failed.");t.encryptedContent.content=o.output}for(var a=0;a<t.recipients.length;++a){var c=t.recipients[a];if(c.encryptedContent.content===void 0)switch(c.encryptedContent.algorithm){case Be.pki.oids.rsaEncryption:c.encryptedContent.content=c.encryptedContent.key.encrypt(t.encryptedContent.key.data);break;default:throw new Error("Unsupported asymmetric cipher, OID "+c.encryptedContent.algorithm)}}}},t};function RQe(t){var e={},r=[];if(!ne.validate(t,$n.asn1.recipientInfoValidator,e,r)){var i=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw i.errors=r,i}return{version:e.version.charCodeAt(0),issuer:Be.pki.RDNAttributesAsArray(e.issuer),serialNumber:Be.util.createBuffer(e.serial).toHex(),encryptedContent:{algorithm:ne.derToOid(e.encAlgorithm),parameter:e.encParameter.value,content:e.encKey}}}function PQe(t){return ne.create(ne.Class.UNIVERSAL,ne.Type.SEQUENCE,!0,[ne.create(ne.Class.UNIVERSAL,ne.Type.INTEGER,!1,ne.integerToDer(t.version).getBytes()),ne.create(ne.Class.UNIVERSAL,ne.Type.SEQUENCE,!0,[Be.pki.distinguishedNameToAsn1({attributes:t.issuer}),ne.create(ne.Class.UNIVERSAL,ne.Type.INTEGER,!1,Be.util.hexToBytes(t.serialNumber))]),ne.create(ne.Class.UNIVERSAL,ne.Type.SEQUENCE,!0,[ne.create(ne.Class.UNIVERSAL,ne.Type.OID,!1,ne.oidToDer(t.encryptedContent.algorithm).getBytes()),ne.create(ne.Class.UNIVERSAL,ne.Type.NULL,!1,"")]),ne.create(ne.Class.UNIVERSAL,ne.Type.OCTETSTRING,!1,t.encryptedContent.content)])}function CQe(t){for(var e=[],r=0;r<t.length;++r)e.push(RQe(t[r]));return e}function OQe(t){for(var e=[],r=0;r<t.length;++r)e.push(PQe(t[r]));return e}function kQe(t){var e=ne.create(ne.Class.UNIVERSAL,ne.Type.SEQUENCE,!0,[ne.create(ne.Class.UNIVERSAL,ne.Type.INTEGER,!1,ne.integerToDer(t.version).getBytes()),ne.create(ne.Class.UNIVERSAL,ne.Type.SEQUENCE,!0,[Be.pki.distinguishedNameToAsn1({attributes:t.issuer}),ne.create(ne.Class.UNIVERSAL,ne.Type.INTEGER,!1,Be.util.hexToBytes(t.serialNumber))]),ne.create(ne.Class.UNIVERSAL,ne.Type.SEQUENCE,!0,[ne.create(ne.Class.UNIVERSAL,ne.Type.OID,!1,ne.oidToDer(t.digestAlgorithm).getBytes()),ne.create(ne.Class.UNIVERSAL,ne.Type.NULL,!1,"")])]);if(t.authenticatedAttributesAsn1&&e.value.push(t.authenticatedAttributesAsn1),e.value.push(ne.create(ne.Class.UNIVERSAL,ne.Type.SEQUENCE,!0,[ne.create(ne.Class.UNIVERSAL,ne.Type.OID,!1,ne.oidToDer(t.signatureAlgorithm).getBytes()),ne.create(ne.Class.UNIVERSAL,ne.Type.NULL,!1,"")])),e.value.push(ne.create(ne.Class.UNIVERSAL,ne.Type.OCTETSTRING,!1,t.signature)),t.unauthenticatedAttributes.length>0){for(var r=ne.create(ne.Class.CONTEXT_SPECIFIC,1,!0,[]),i=0;i<t.unauthenticatedAttributes.length;++i){var n=t.unauthenticatedAttributes[i];r.values.push(KC(n))}e.value.push(r)}return e}function DQe(t){for(var e=[],r=0;r<t.length;++r)e.push(kQe(t[r]));return e}function KC(t){var e;if(t.type===Be.pki.oids.contentType)e=ne.create(ne.Class.UNIVERSAL,ne.Type.OID,!1,ne.oidToDer(t.value).getBytes());else if(t.type===Be.pki.oids.messageDigest)e=ne.create(ne.Class.UNIVERSAL,ne.Type.OCTETSTRING,!1,t.value.bytes());else if(t.type===Be.pki.oids.signingTime){var r=new Date("1950-01-01T00:00:00Z"),i=new Date("2050-01-01T00:00:00Z"),n=t.value;if(typeof n=="string"){var s=Date.parse(n);isNaN(s)?n.length===13?n=ne.utcTimeToDate(n):n=ne.generalizedTimeToDate(n):n=new Date(s)}n>=r&&n<i?e=ne.create(ne.Class.UNIVERSAL,ne.Type.UTCTIME,!1,ne.dateToUtcTime(n)):e=ne.create(ne.Class.UNIVERSAL,ne.Type.GENERALIZEDTIME,!1,ne.dateToGeneralizedTime(n))}return ne.create(ne.Class.UNIVERSAL,ne.Type.SEQUENCE,!0,[ne.create(ne.Class.UNIVERSAL,ne.Type.OID,!1,ne.oidToDer(t.type).getBytes()),ne.create(ne.Class.UNIVERSAL,ne.Type.SET,!0,[e])])}function BQe(t){return[ne.create(ne.Class.UNIVERSAL,ne.Type.OID,!1,ne.oidToDer(Be.pki.oids.data).getBytes()),ne.create(ne.Class.UNIVERSAL,ne.Type.SEQUENCE,!0,[ne.create(ne.Class.UNIVERSAL,ne.Type.OID,!1,ne.oidToDer(t.algorithm).getBytes()),ne.create(ne.Class.UNIVERSAL,ne.Type.OCTETSTRING,!1,t.parameter.getBytes())]),ne.create(ne.Class.CONTEXT_SPECIFIC,0,!0,[ne.create(ne.Class.UNIVERSAL,ne.Type.OCTETSTRING,!1,t.content.getBytes())])]}function VC(t,e,r){var i={},n=[];if(!ne.validate(e,r,i,n)){var s=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw s.errors=s,s}var o=ne.derToOid(i.contentType);if(o!==Be.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(i.encryptedContent){var a="";if(Be.util.isArray(i.encryptedContent))for(var c=0;c<i.encryptedContent.length;++c){if(i.encryptedContent[c].type!==ne.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");a+=i.encryptedContent[c].value}else a=i.encryptedContent;t.encryptedContent={algorithm:ne.derToOid(i.encAlgorithm),parameter:Be.util.createBuffer(i.encParameter.value),content:Be.util.createBuffer(a)}}if(i.content){var a="";if(Be.util.isArray(i.content))for(var c=0;c<i.content.length;++c){if(i.content[c].type!==ne.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");a+=i.content[c].value}else a=i.content;t.content=Be.util.createBuffer(a)}return t.version=i.version.charCodeAt(0),t.rawCapture=i,i}function Lge(t){if(t.encryptedContent.key===void 0)throw new Error("Symmetric key not available.");if(t.content===void 0){var e;switch(t.encryptedContent.algorithm){case Be.pki.oids["aes128-CBC"]:case Be.pki.oids["aes192-CBC"]:case Be.pki.oids["aes256-CBC"]:e=Be.aes.createDecryptionCipher(t.encryptedContent.key);break;case Be.pki.oids.desCBC:case Be.pki.oids["des-EDE3-CBC"]:e=Be.des.createDecryptionCipher(t.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+t.encryptedContent.algorithm)}if(e.start(t.encryptedContent.parameter),e.update(t.encryptedContent.content),!e.finish())throw new Error("Symmetric decryption failed.");t.content=e.output}}});var Kge=m((tDt,Fge)=>{l();"use strict";FC();var NQe=yt(),Uge=NQe.pki,MQe=(t,e)=>{let r=Uge.setRsaPublicKey(e.n,e.e),i=Uge.createCertificate();i.publicKey=r,i.serialNumber="01",i.validity.notBefore=new Date,i.validity.notAfter=new Date,i.validity.notAfter.setFullYear(i.validity.notBefore.getFullYear()+10);let n=[{name:"organizationName",value:"ipfs"},{shortName:"OU",value:"keystore"},{name:"commonName",value:t.id}];return i.setSubject(n),i.setIssuer(n),i.setExtensions([{name:"basicConstraints",cA:!0},{name:"keyUsage",keyCertSign:!0,digitalSignature:!0,nonRepudiation:!0,keyEncipherment:!0,dataEncipherment:!0},{name:"extKeyUsage",serverAuth:!0,clientAuth:!0,codeSigning:!0,emailProtection:!0,timeStamping:!0},{name:"nsCertType",client:!0,server:!0,email:!0,objsign:!0,sslCA:!0,emailCA:!0,objCA:!0}]),i.sign(e),i};async function LQe(t,e){let r=t.map(e),n=(await Promise.all(r)).findIndex(s=>s);return t[n]}Fge.exports={certificateForKey:MQe,findAsync:LQe}});var Gge=m((rDt,Hge)=>{l();"use strict";jge();E_();var bl=yt(),{certificateForKey:qQe,findAsync:jQe}=Kge(),G1=_r(),{fromString:Vge}=(dt(),bi),{toString:UQe}=(tt(),hr),zC=new WeakMap,zge=class{constructor(e,r){if(!e)throw G1(new Error("keychain is required"),"ERR_KEYCHAIN_REQUIRED");this.keychain=e,zC.set(this,{dek:r})}async encrypt(e,r){if(!(r instanceof Uint8Array))throw G1(new Error("Plain data must be a Uint8Array"),"ERR_INVALID_PARAMS");let i=await this.keychain.findKeyByName(e),n=await this.keychain._getPrivateKey(e),s=zC.get(this).dek,o=bl.pki.decryptRsaPrivateKey(n,s),a=await qQe(i,o),c=bl.pkcs7.createEnvelopedData();c.addRecipient(a),c.content=bl.util.createBuffer(r),c.encrypt();let u=bl.asn1.toDer(c.toAsn1()).getBytes();return Vge(u,"ascii")}async decrypt(e){if(!(e instanceof Uint8Array))throw G1(new Error("CMS data is required"),"ERR_INVALID_PARAMS");let r;try{let u=bl.util.createBuffer(UQe(e,"ascii")),f=bl.asn1.fromDer(u);r=bl.pkcs7.messageFromAsn1(f)}catch(u){throw G1(new Error("Invalid CMS: "+u.message),"ERR_INVALID_CMS")}let i=r.recipients.filter(u=>u.issuer.find(f=>f.shortName==="O"&&f.value==="ipfs")).filter(u=>u.issuer.find(f=>f.shortName==="CN")).map(u=>({recipient:u,keyId:u.issuer.find(f=>f.shortName==="CN").value})),n=await jQe(i,async u=>{try{if(await this.keychain.findKeyById(u.keyId))return!0}catch(f){return!1}return!1});if(!n){let u=i.map(f=>f.keyId);throw G1(new Error("Decryption needs one of the key(s): "+u.join(", ")),"ERR_MISSING_KEYS",{missingKeys:u})}let s=await this.keychain.findKeyById(n.keyId);if(!s)throw G1(new Error("No key available to decrypto"),"ERR_NO_KEY");let o=await this.keychain._getPrivateKey(s.name),a=zC.get(this).dek,c=bl.pki.decryptRsaPrivateKey(o,a);return r.decrypt(n.recipient,c),Vge(r.content.getBytes(),"ascii")}};Hge.exports=zge});var Jge=m((iDt,Zge)=>{l();"use strict";var $ge=Ee(),Wge=Object.assign($ge("libp2p:keychain"),{error:$ge("libp2p:keychain:err")}),FQe=Ege(),KQe=Al(),Eh=rc(),{Key:Yge}=(Br(),sy),VQe=Gge(),Or=_r(),{toString:Sh}=(tt(),hr),{fromString:Uu}=(dt(),bi);e4();var zQe="/pkcs8/",Xge="/info/",vl=new WeakMap,xh={minKeyLength:112/8,minSaltLength:128/8,minIterationCount:1e3},HC={dek:{keyLength:512/8,iterationCount:1e4,salt:"you should override this value with a crypto secure random number",hash:"sha2-512"}};function Fu(t){return!t||typeof t!="string"?!1:t===FQe(t.trim())}async function Jt(t){let e=200,r=1e3,i=Math.random()*(r-e)+e;throw await new Promise(n=>setTimeout(n,i)),t}function Nc(t){return new Yge(zQe+t)}function wl(t){return new Yge(Xge+t)}var Qge=class{constructor(e,r){if(!e)throw new Error("store is required");if(this.store=e,this.opts=KQe(HC,r),this.opts.pass&&this.opts.pass.length<20)throw new Error("pass must be least 20 characters");if(this.opts.dek.keyLength<xh.minKeyLength)throw new Error(`dek.keyLength must be least ${xh.minKeyLength} bytes`);if(this.opts.dek.salt.length<xh.minSaltLength)throw new Error(`dek.saltLength must be least ${xh.minSaltLength} bytes`);if(this.opts.dek.iterationCount<xh.minIterationCount)throw new Error(`dek.iterationCount must be least ${xh.minIterationCount}`);let i=this.opts.pass?Eh.pbkdf2(this.opts.pass,this.opts.dek.salt,this.opts.dek.iterationCount,this.opts.dek.keyLength,this.opts.dek.hash):"";vl.set(this,{dek:i})}get cms(){return new VQe(this,vl.get(this).dek)}static generateOptions(){let e=Object.assign({},HC),r=Math.ceil(xh.minSaltLength/3)*3;return e.dek.salt=Sh(Eh.randomBytes(r),"base64"),e}static get options(){return HC}async createKey(e,r,i=2048){let n=this;if(!Fu(e)||e==="self")return Jt(Or(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));if(typeof r!="string")return Jt(Or(new Error(`Invalid key type '${r}'`),"ERR_INVALID_KEY_TYPE"));let s=Nc(e);if(await n.store.has(s))return Jt(Or(new Error(`Key '${e}' already exists`),"ERR_KEY_ALREADY_EXISTS"));switch(r.toLowerCase()){case"rsa":if(!Number.isSafeInteger(i)||i<2048)return Jt(Or(new Error(`Invalid RSA key size ${i}`),"ERR_INVALID_KEY_SIZE"));break;default:break}let a;try{let c=await Eh.keys.generateKeyPair(r,i),u=await c.id(),f=vl.get(this).dek,d=await c.export(f);a={name:e,id:u};let h=n.store.batch();h.put(s,Uu(d)),h.put(wl(e),Uu(JSON.stringify(a))),await h.commit()}catch(c){return Jt(c)}return a}async listKeys(){let e=this,r={prefix:Xge},i=[];for await(let n of e.store.query(r))i.push(JSON.parse(Sh(n.value)));return i}async findKeyById(e){try{return(await this.listKeys()).find(i=>i.id===e)}catch(r){return Jt(r)}}async findKeyByName(e){if(!Fu(e))return Jt(Or(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));let r=wl(e);try{let i=await this.store.get(r);return JSON.parse(Sh(i))}catch(i){return Jt(Or(new Error(`Key '${e}' does not exist. ${i.message}`),"ERR_KEY_NOT_FOUND"))}}async removeKey(e){let r=this;if(!Fu(e)||e==="self")return Jt(Or(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));let i=Nc(e),n=await r.findKeyByName(e),s=r.store.batch();return s.delete(i),s.delete(wl(e)),await s.commit(),n}async renameKey(e,r){let i=this;if(!Fu(e)||e==="self")return Jt(Or(new Error(`Invalid old key name '${e}'`),"ERR_OLD_KEY_NAME_INVALID"));if(!Fu(r)||r==="self")return Jt(Or(new Error(`Invalid new key name '${r}'`),"ERR_NEW_KEY_NAME_INVALID"));let n=Nc(e),s=Nc(r),o=wl(e),a=wl(r);if(await i.store.has(s))return Jt(Or(new Error(`Key '${r}' already exists`),"ERR_KEY_ALREADY_EXISTS"));try{let u=await i.store.get(n),f=await i.store.get(o),d=JSON.parse(Sh(f));d.name=r;let h=i.store.batch();return h.put(s,u),h.put(a,Uu(JSON.stringify(d))),h.delete(n),h.delete(o),await h.commit(),d}catch(u){return Jt(u)}}async exportKey(e,r){if(!Fu(e))return Jt(Or(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));if(!r)return Jt(Or(new Error("Password is required"),"ERR_PASSWORD_REQUIRED"));let i=Nc(e);try{let n=await this.store.get(i),s=Sh(n),o=vl.get(this).dek;return(await Eh.keys.import(s,o)).export(r)}catch(n){return Jt(n)}}async importKey(e,r,i){let n=this;if(!Fu(e)||e==="self")return Jt(Or(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));if(!r)return Jt(Or(new Error("PEM encoded key is required"),"ERR_PEM_REQUIRED"));let s=Nc(e);if(await n.store.has(s))return Jt(Or(new Error(`Key '${e}' already exists`),"ERR_KEY_ALREADY_EXISTS"));let a;try{a=await Eh.keys.import(r,i)}catch(d){return Jt(Or(new Error("Cannot read the key, most likely the password is wrong"),"ERR_CANNOT_READ_KEY"))}let c;try{c=await a.id();let d=vl.get(this).dek;r=await a.export(d)}catch(d){return Jt(d)}let u={name:e,id:c},f=n.store.batch();return f.put(s,Uu(r)),f.put(wl(e),Uu(JSON.stringify(u))),await f.commit(),u}async importPeer(e,r){let i=this;if(!Fu(e))return Jt(Or(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));if(!r||!r.privKey)return Jt(Or(new Error("Peer.privKey is required"),"ERR_MISSING_PRIVATE_KEY"));let n=r.privKey,s=Nc(e);if(await i.store.has(s))return Jt(Or(new Error(`Key '${e}' already exists`),"ERR_KEY_ALREADY_EXISTS"));try{let a=await n.id(),c=vl.get(this).dek,u=await n.export(c),f={name:e,id:a},d=i.store.batch();return d.put(s,Uu(u)),d.put(wl(e),Uu(JSON.stringify(f))),await d.commit(),f}catch(a){return Jt(a)}}async _getPrivateKey(e){if(!Fu(e))return Jt(Or(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));try{let r=Nc(e),i=await this.store.get(r);return Sh(i)}catch(r){return Jt(Or(new Error(`Key '${e}' does not exist. ${r.message}`),"ERR_KEY_NOT_FOUND"))}}async rotateKeychainPass(e,r){if(typeof e!="string")return Jt(Or(new Error(`Invalid old pass type '${typeof e}'`),"ERR_INVALID_OLD_PASS_TYPE"));if(typeof r!="string")return Jt(Or(new Error(`Invalid new pass type '${typeof r}'`),"ERR_INVALID_NEW_PASS_TYPE"));if(r.length<20)return Jt(Or(new Error(`Invalid pass length ${r.length}`),"ERR_INVALID_PASS_LENGTH"));Wge("recreating keychain");let i=vl.get(this).dek;this.opts.pass=r;let n=r?Eh.pbkdf2(r,this.opts.dek.salt,this.opts.dek.iterationCount,this.opts.dek.keyLength,this.opts.dek.hash):"";vl.set(this,{dek:n});let s=await this.listKeys();for(let o of s){let a=await this.store.get(Nc(o.name)),c=Sh(a),u=await Eh.keys.import(c,i),f=n.toString(),d=await u.export(f),h=this.store.batch(),p={name:o.name,id:o.id};h.put(Nc(o.name),Uu(d)),h.put(wl(o.name),Uu(JSON.stringify(p))),await h.commit()}Wge("keychain reconstructed")}};Zge.exports=Qge});var tme=m((nDt,eme)=>{l();"use strict";var HQe=g0();eme.exports=t=>{let e=HQe(t);return e.delete=e.remove,e}});var ime=m((rme,D7)=>{l();(function(t){"use strict";var e,r=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,i=Math.ceil,n=Math.floor,s="[BigNumber Error] ",o=s+"Number primitive has more than 15 significant digits: ",a=1e14,c=14,u=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],d=1e7,h=1e9;function p(D){var B,H,W,X=Q.prototype={constructor:Q,toString:null,valueOf:null},P=new Q(1),g=20,w=4,S=-7,C=21,L=-1e7,Y=1e7,V=!1,q=1,_=0,j={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},de="0123456789abcdefghijklmnopqrstuvwxyz";function Q(k,K){var $,ee,I,U,z,N,Z,ie,te=this;if(!(te instanceof Q))return new Q(k,K);if(K==null){if(k&&k._isBigNumber===!0){te.s=k.s,!k.c||k.e>Y?te.c=te.e=null:k.e<L?te.c=[te.e=0]:(te.e=k.e,te.c=k.c.slice());return}if((N=typeof k=="number")&&k*0==0){if(te.s=1/k<0?(k=-k,-1):1,k===~~k){for(U=0,z=k;z>=10;z/=10,U++);U>Y?te.c=te.e=null:(te.e=U,te.c=[k]);return}ie=String(k)}else{if(!r.test(ie=String(k)))return W(te,ie,N);te.s=ie.charCodeAt(0)==45?(ie=ie.slice(1),-1):1}(U=ie.indexOf("."))>-1&&(ie=ie.replace(".","")),(z=ie.search(/e/i))>0?(U<0&&(U=z),U+=+ie.slice(z+1),ie=ie.substring(0,z)):U<0&&(U=ie.length)}else{if(v(K,2,de.length,"Base"),K==10)return te=new Q(k),be(te,g+te.e+1,w);if(ie=String(k),N=typeof k=="number"){if(k*0!=0)return W(te,ie,N,K);if(te.s=1/k<0?(ie=ie.slice(1),-1):1,Q.DEBUG&&ie.replace(/^0\.0*|\./,"").length>15)throw Error(o+k)}else te.s=ie.charCodeAt(0)===45?(ie=ie.slice(1),-1):1;for($=de.slice(0,K),U=z=0,Z=ie.length;z<Z;z++)if($.indexOf(ee=ie.charAt(z))<0){if(ee=="."){if(z>U){U=Z;continue}}else if(!I&&(ie==ie.toUpperCase()&&(ie=ie.toLowerCase())||ie==ie.toLowerCase()&&(ie=ie.toUpperCase()))){I=!0,z=-1,U=0;continue}return W(te,String(k),N,K)}N=!1,ie=H(ie,K,10,te.s),(U=ie.indexOf("."))>-1?ie=ie.replace(".",""):U=ie.length}for(z=0;ie.charCodeAt(z)===48;z++);for(Z=ie.length;ie.charCodeAt(--Z)===48;);if(ie=ie.slice(z,++Z)){if(Z-=z,N&&Q.DEBUG&&Z>15&&(k>u||k!==n(k)))throw Error(o+te.s*k);if((U=U-z-1)>Y)te.c=te.e=null;else if(U<L)te.c=[te.e=0];else{if(te.e=U,te.c=[],z=(U+1)%c,U<0&&(z+=c),z<Z){for(z&&te.c.push(+ie.slice(0,z)),Z-=c;z<Z;)te.c.push(+ie.slice(z,z+=c));z=c-(ie=ie.slice(z)).length}else z-=Z;for(;z--;ie+="0");te.c.push(+ie)}}else te.c=[te.e=0]}Q.clone=p,Q.ROUND_UP=0,Q.ROUND_DOWN=1,Q.ROUND_CEIL=2,Q.ROUND_FLOOR=3,Q.ROUND_HALF_UP=4,Q.ROUND_HALF_DOWN=5,Q.ROUND_HALF_EVEN=6,Q.ROUND_HALF_CEIL=7,Q.ROUND_HALF_FLOOR=8,Q.EUCLID=9,Q.config=Q.set=function(k){var K,$;if(k!=null)if(typeof k=="object"){if(k.hasOwnProperty(K="DECIMAL_PLACES")&&($=k[K],v($,0,h,K),g=$),k.hasOwnProperty(K="ROUNDING_MODE")&&($=k[K],v($,0,8,K),w=$),k.hasOwnProperty(K="EXPONENTIAL_AT")&&($=k[K],$&&$.pop?(v($[0],-h,0,K),v($[1],0,h,K),S=$[0],C=$[1]):(v($,-h,h,K),S=-(C=$<0?-$:$))),k.hasOwnProperty(K="RANGE"))if($=k[K],$&&$.pop)v($[0],-h,-1,K),v($[1],1,h,K),L=$[0],Y=$[1];else if(v($,-h,h,K),$)L=-(Y=$<0?-$:$);else throw Error(s+K+" cannot be zero: "+$);if(k.hasOwnProperty(K="CRYPTO"))if($=k[K],$===!!$)if($)if(typeof crypto!="undefined"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))V=$;else throw V=!$,Error(s+"crypto unavailable");else V=$;else throw Error(s+K+" not true or false: "+$);if(k.hasOwnProperty(K="MODULO_MODE")&&($=k[K],v($,0,9,K),q=$),k.hasOwnProperty(K="POW_PRECISION")&&($=k[K],v($,0,h,K),_=$),k.hasOwnProperty(K="FORMAT"))if($=k[K],typeof $=="object")j=$;else throw Error(s+K+" not an object: "+$);if(k.hasOwnProperty(K="ALPHABET"))if($=k[K],typeof $=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test($))de=$;else throw Error(s+K+" invalid: "+$)}else throw Error(s+"Object expected: "+k);return{DECIMAL_PLACES:g,ROUNDING_MODE:w,EXPONENTIAL_AT:[S,C],RANGE:[L,Y],CRYPTO:V,MODULO_MODE:q,POW_PRECISION:_,FORMAT:j,ALPHABET:de}},Q.isBigNumber=function(k){if(!k||k._isBigNumber!==!0)return!1;if(!Q.DEBUG)return!0;var K,$,ee=k.c,I=k.e,U=k.s;e:if({}.toString.call(ee)=="[object Array]"){if((U===1||U===-1)&&I>=-h&&I<=h&&I===n(I)){if(ee[0]===0){if(I===0&&ee.length===1)return!0;break e}if(K=(I+1)%c,K<1&&(K+=c),String(ee[0]).length==K){for(K=0;K<ee.length;K++)if($=ee[K],$<0||$>=a||$!==n($))break e;if($!==0)return!0}}}else if(ee===null&&I===null&&(U===null||U===1||U===-1))return!0;throw Error(s+"Invalid BigNumber: "+k)},Q.maximum=Q.max=function(){return le(arguments,X.lt)},Q.minimum=Q.min=function(){return le(arguments,X.gt)},Q.random=function(){var k=9007199254740992,K=Math.random()*k&2097151?function(){return n(Math.random()*k)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function($){var ee,I,U,z,N,Z=0,ie=[],te=new Q(P);if($==null?$=g:v($,0,h),z=i($/c),V)if(crypto.getRandomValues){for(ee=crypto.getRandomValues(new Uint32Array(z*=2));Z<z;)N=ee[Z]*131072+(ee[Z+1]>>>11),N>=9e15?(I=crypto.getRandomValues(new Uint32Array(2)),ee[Z]=I[0],ee[Z+1]=I[1]):(ie.push(N%1e14),Z+=2);Z=z/2}else if(crypto.randomBytes){for(ee=crypto.randomBytes(z*=7);Z<z;)N=(ee[Z]&31)*281474976710656+ee[Z+1]*1099511627776+ee[Z+2]*4294967296+ee[Z+3]*16777216+(ee[Z+4]<<16)+(ee[Z+5]<<8)+ee[Z+6],N>=9e15?crypto.randomBytes(7).copy(ee,Z):(ie.push(N%1e14),Z+=7);Z=z/7}else throw V=!1,Error(s+"crypto unavailable");if(!V)for(;Z<z;)N=K(),N<9e15&&(ie[Z++]=N%1e14);for(z=ie[--Z],$%=c,z&&$&&(N=f[c-$],ie[Z]=n(z/N)*N);ie[Z]===0;ie.pop(),Z--);if(Z<0)ie=[U=0];else{for(U=-1;ie[0]===0;ie.splice(0,1),U-=c);for(Z=1,N=ie[0];N>=10;N/=10,Z++);Z<c&&(U-=c-Z)}return te.e=U,te.c=ie,te}}(),Q.sum=function(){for(var k=1,K=arguments,$=new Q(K[0]);k<K.length;)$=$.plus(K[k++]);return $},H=function(){var k="0123456789";function K($,ee,I,U){for(var z,N=[0],Z,ie=0,te=$.length;ie<te;){for(Z=N.length;Z--;N[Z]*=ee);for(N[0]+=U.indexOf($.charAt(ie++)),z=0;z<N.length;z++)N[z]>I-1&&(N[z+1]==null&&(N[z+1]=0),N[z+1]+=N[z]/I|0,N[z]%=I)}return N.reverse()}return function($,ee,I,U,z){var N,Z,ie,te,he,we,_e,Ke,Pe=$.indexOf("."),Ve=g,et=w;for(Pe>=0&&(te=_,_=0,$=$.replace(".",""),Ke=new Q(ee),we=Ke.pow($.length-Pe),_=te,Ke.c=K(F(b(we.c),we.e,"0"),10,I,k),Ke.e=Ke.c.length),_e=K($,ee,I,z?(N=de,k):(N=k,de)),ie=te=_e.length;_e[--te]==0;_e.pop());if(!_e[0])return N.charAt(0);if(Pe<0?--ie:(we.c=_e,we.e=ie,we.s=U,we=B(we,Ke,Ve,et,I),_e=we.c,he=we.r,ie=we.e),Z=ie+Ve+1,Pe=_e[Z],te=I/2,he=he||Z<0||_e[Z+1]!=null,he=et<4?(Pe!=null||he)&&(et==0||et==(we.s<0?3:2)):Pe>te||Pe==te&&(et==4||he||et==6&&_e[Z-1]&1||et==(we.s<0?8:7)),Z<1||!_e[0])$=he?F(N.charAt(1),-Ve,N.charAt(0)):N.charAt(0);else{if(_e.length=Z,he)for(--I;++_e[--Z]>I;)_e[Z]=0,Z||(++ie,_e=[1].concat(_e));for(te=_e.length;!_e[--te];);for(Pe=0,$="";Pe<=te;$+=N.charAt(_e[Pe++]));$=F($,ie,N.charAt(0))}return $}}(),B=function(){function k(ee,I,U){var z,N,Z,ie,te=0,he=ee.length,we=I%d,_e=I/d|0;for(ee=ee.slice();he--;)Z=ee[he]%d,ie=ee[he]/d|0,z=_e*Z+ie*we,N=we*Z+z%d*d+te,te=(N/U|0)+(z/d|0)+_e*ie,ee[he]=N%U;return te&&(ee=[te].concat(ee)),ee}function K(ee,I,U,z){var N,Z;if(U!=z)Z=U>z?1:-1;else for(N=Z=0;N<U;N++)if(ee[N]!=I[N]){Z=ee[N]>I[N]?1:-1;break}return Z}function $(ee,I,U,z){for(var N=0;U--;)ee[U]-=N,N=ee[U]<I[U]?1:0,ee[U]=N*z+ee[U]-I[U];for(;!ee[0]&&ee.length>1;ee.splice(0,1));}return function(ee,I,U,z,N){var Z,ie,te,he,we,_e,Ke,Pe,Ve,et,He,ze,mt,tr,fr,Dn,Xt,Ot=ee.s==I.s?1:-1,ci=ee.c,nt=I.c;if(!ci||!ci[0]||!nt||!nt[0])return new Q(!ee.s||!I.s||(ci?nt&&ci[0]==nt[0]:!nt)?NaN:ci&&ci[0]==0||!nt?Ot*0:Ot/0);for(Pe=new Q(Ot),Ve=Pe.c=[],ie=ee.e-I.e,Ot=U+ie+1,N||(N=a,ie=y(ee.e/c)-y(I.e/c),Ot=Ot/c|0),te=0;nt[te]==(ci[te]||0);te++);if(nt[te]>(ci[te]||0)&&ie--,Ot<0)Ve.push(1),he=!0;else{for(tr=ci.length,Dn=nt.length,te=0,Ot+=2,we=n(N/(nt[0]+1)),we>1&&(nt=k(nt,we,N),ci=k(ci,we,N),Dn=nt.length,tr=ci.length),mt=Dn,et=ci.slice(0,Dn),He=et.length;He<Dn;et[He++]=0);Xt=nt.slice(),Xt=[0].concat(Xt),fr=nt[0],nt[1]>=N/2&&fr++;do{if(we=0,Z=K(nt,et,Dn,He),Z<0){if(ze=et[0],Dn!=He&&(ze=ze*N+(et[1]||0)),we=n(ze/fr),we>1)for(we>=N&&(we=N-1),_e=k(nt,we,N),Ke=_e.length,He=et.length;K(_e,et,Ke,He)==1;)we--,$(_e,Dn<Ke?Xt:nt,Ke,N),Ke=_e.length,Z=1;else we==0&&(Z=we=1),_e=nt.slice(),Ke=_e.length;if(Ke<He&&(_e=[0].concat(_e)),$(et,_e,He,N),He=et.length,Z==-1)for(;K(nt,et,Dn,He)<1;)we++,$(et,Dn<He?Xt:nt,He,N),He=et.length}else Z===0&&(we++,et=[0]);Ve[te++]=we,et[0]?et[He++]=ci[mt]||0:(et=[ci[mt]],He=1)}while((mt++<tr||et[0]!=null)&&Ot--);he=et[0]!=null,Ve[0]||Ve.splice(0,1)}if(N==a){for(te=1,Ot=Ve[0];Ot>=10;Ot/=10,te++);be(Pe,U+(Pe.e=te+ie*c-1)+1,z,he)}else Pe.e=ie,Pe.r=+he;return Pe}}();function ue(k,K,$,ee){var I,U,z,N,Z;if($==null?$=w:v($,0,8),!k.c)return k.toString();if(I=k.c[0],z=k.e,K==null)Z=b(k.c),Z=ee==1||ee==2&&(z<=S||z>=C)?R(Z,z):F(Z,z,"0");else if(k=be(new Q(k),K,$),U=k.e,Z=b(k.c),N=Z.length,ee==1||ee==2&&(K<=U||U<=S)){for(;N<K;Z+="0",N++);Z=R(Z,U)}else if(K-=z,Z=F(Z,U,"0"),U+1>N){if(--K>0)for(Z+=".";K--;Z+="0");}else if(K+=U-N,K>0)for(U+1==N&&(Z+=".");K--;Z+="0");return k.s<0&&I?"-"+Z:Z}function le(k,K){for(var $,ee=1,I=new Q(k[0]);ee<k.length;ee++)if($=new Q(k[ee]),$.s)K.call(I,$)&&(I=$);else{I=$;break}return I}function me(k,K,$){for(var ee=1,I=K.length;!K[--I];K.pop());for(I=K[0];I>=10;I/=10,ee++);return($=ee+$*c-1)>Y?k.c=k.e=null:$<L?k.c=[k.e=0]:(k.e=$,k.c=K),k}W=function(){var k=/^(-?)0([xbo])(?=\w[\w.]*$)/i,K=/^([^.]+)\.$/,$=/^\.([^.]+)$/,ee=/^-?(Infinity|NaN)$/,I=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(U,z,N,Z){var ie,te=N?z:z.replace(I,"");if(ee.test(te))U.s=isNaN(te)?null:te<0?-1:1;else{if(!N&&(te=te.replace(k,function(he,we,_e){return ie=(_e=_e.toLowerCase())=="x"?16:_e=="b"?2:8,!Z||Z==ie?we:he}),Z&&(ie=Z,te=te.replace(K,"$1").replace($,"0.$1")),z!=te))return new Q(te,ie);if(Q.DEBUG)throw Error(s+"Not a"+(Z?" base "+Z:"")+" number: "+z);U.s=null}U.c=U.e=null}}();function be(k,K,$,ee){var I,U,z,N,Z,ie,te,he=k.c,we=f;if(he){e:{for(I=1,N=he[0];N>=10;N/=10,I++);if(U=K-I,U<0)U+=c,z=K,Z=he[ie=0],te=Z/we[I-z-1]%10|0;else if(ie=i((U+1)/c),ie>=he.length)if(ee){for(;he.length<=ie;he.push(0));Z=te=0,I=1,U%=c,z=U-c+1}else break e;else{for(Z=N=he[ie],I=1;N>=10;N/=10,I++);U%=c,z=U-c+I,te=z<0?0:Z/we[I-z-1]%10|0}if(ee=ee||K<0||he[ie+1]!=null||(z<0?Z:Z%we[I-z-1]),ee=$<4?(te||ee)&&($==0||$==(k.s<0?3:2)):te>5||te==5&&($==4||ee||$==6&&(U>0?z>0?Z/we[I-z]:0:he[ie-1])%10&1||$==(k.s<0?8:7)),K<1||!he[0])return he.length=0,ee?(K-=k.e+1,he[0]=we[(c-K%c)%c],k.e=-K||0):he[0]=k.e=0,k;if(U==0?(he.length=ie,N=1,ie--):(he.length=ie+1,N=we[c-U],he[ie]=z>0?n(Z/we[I-z]%we[z])*N:0),ee)for(;;)if(ie==0){for(U=1,z=he[0];z>=10;z/=10,U++);for(z=he[0]+=N,N=1;z>=10;z/=10,N++);U!=N&&(k.e++,he[0]==a&&(he[0]=1));break}else{if(he[ie]+=N,he[ie]!=a)break;he[ie--]=0,N=1}for(U=he.length;he[--U]===0;he.pop());}k.e>Y?k.c=k.e=null:k.e<L&&(k.c=[k.e=0])}return k}function xe(k){var K,$=k.e;return $===null?k.toString():(K=b(k.c),K=$<=S||$>=C?R(K,$):F(K,$,"0"),k.s<0?"-"+K:K)}return X.absoluteValue=X.abs=function(){var k=new Q(this);return k.s<0&&(k.s=1),k},X.comparedTo=function(k,K){return E(this,new Q(k,K))},X.decimalPlaces=X.dp=function(k,K){var $,ee,I,U=this;if(k!=null)return v(k,0,h),K==null?K=w:v(K,0,8),be(new Q(U),k+U.e+1,K);if(!($=U.c))return null;if(ee=((I=$.length-1)-y(this.e/c))*c,I=$[I])for(;I%10==0;I/=10,ee--);return ee<0&&(ee=0),ee},X.dividedBy=X.div=function(k,K){return B(this,new Q(k,K),g,w)},X.dividedToIntegerBy=X.idiv=function(k,K){return B(this,new Q(k,K),0,1)},X.exponentiatedBy=X.pow=function(k,K){var $,ee,I,U,z,N,Z,ie,te,he=this;if(k=new Q(k),k.c&&!k.isInteger())throw Error(s+"Exponent not an integer: "+xe(k));if(K!=null&&(K=new Q(K)),N=k.e>14,!he.c||!he.c[0]||he.c[0]==1&&!he.e&&he.c.length==1||!k.c||!k.c[0])return te=new Q(Math.pow(+xe(he),N?2-A(k):+xe(k))),K?te.mod(K):te;if(Z=k.s<0,K){if(K.c?!K.c[0]:!K.s)return new Q(NaN);ee=!Z&&he.isInteger()&&K.isInteger(),ee&&(he=he.mod(K))}else{if(k.e>9&&(he.e>0||he.e<-1||(he.e==0?he.c[0]>1||N&&he.c[1]>=24e7:he.c[0]<8e13||N&&he.c[0]<=9999975e7)))return U=he.s<0&&A(k)?-0:0,he.e>-1&&(U=1/U),new Q(Z?1/U:U);_&&(U=i(_/c+2))}for(N?($=new Q(.5),Z&&(k.s=1),ie=A(k)):(I=Math.abs(+xe(k)),ie=I%2),te=new Q(P);;){if(ie){if(te=te.times(he),!te.c)break;U?te.c.length>U&&(te.c.length=U):ee&&(te=te.mod(K))}if(I){if(I=n(I/2),I===0)break;ie=I%2}else if(k=k.times($),be(k,k.e+1,1),k.e>14)ie=A(k);else{if(I=+xe(k),I===0)break;ie=I%2}he=he.times(he),U?he.c&&he.c.length>U&&(he.c.length=U):ee&&(he=he.mod(K))}return ee?te:(Z&&(te=P.div(te)),K?te.mod(K):U?be(te,_,w,z):te)},X.integerValue=function(k){var K=new Q(this);return k==null?k=w:v(k,0,8),be(K,K.e+1,k)},X.isEqualTo=X.eq=function(k,K){return E(this,new Q(k,K))===0},X.isFinite=function(){return!!this.c},X.isGreaterThan=X.gt=function(k,K){return E(this,new Q(k,K))>0},X.isGreaterThanOrEqualTo=X.gte=function(k,K){return(K=E(this,new Q(k,K)))===1||K===0},X.isInteger=function(){return!!this.c&&y(this.e/c)>this.c.length-2},X.isLessThan=X.lt=function(k,K){return E(this,new Q(k,K))<0},X.isLessThanOrEqualTo=X.lte=function(k,K){return(K=E(this,new Q(k,K)))===-1||K===0},X.isNaN=function(){return!this.s},X.isNegative=function(){return this.s<0},X.isPositive=function(){return this.s>0},X.isZero=function(){return!!this.c&&this.c[0]==0},X.minus=function(k,K){var $,ee,I,U,z=this,N=z.s;if(k=new Q(k,K),K=k.s,!N||!K)return new Q(NaN);if(N!=K)return k.s=-K,z.plus(k);var Z=z.e/c,ie=k.e/c,te=z.c,he=k.c;if(!Z||!ie){if(!te||!he)return te?(k.s=-K,k):new Q(he?z:NaN);if(!te[0]||!he[0])return he[0]?(k.s=-K,k):new Q(te[0]?z:w==3?-0:0)}if(Z=y(Z),ie=y(ie),te=te.slice(),N=Z-ie){for((U=N<0)?(N=-N,I=te):(ie=Z,I=he),I.reverse(),K=N;K--;I.push(0));I.reverse()}else for(ee=(U=(N=te.length)<(K=he.length))?N:K,N=K=0;K<ee;K++)if(te[K]!=he[K]){U=te[K]<he[K];break}if(U&&(I=te,te=he,he=I,k.s=-k.s),K=(ee=he.length)-($=te.length),K>0)for(;K--;te[$++]=0);for(K=a-1;ee>N;){if(te[--ee]<he[ee]){for($=ee;$&&!te[--$];te[$]=K);--te[$],te[ee]+=a}te[ee]-=he[ee]}for(;te[0]==0;te.splice(0,1),--ie);return te[0]?me(k,te,ie):(k.s=w==3?-1:1,k.c=[k.e=0],k)},X.modulo=X.mod=function(k,K){var $,ee,I=this;return k=new Q(k,K),!I.c||!k.s||k.c&&!k.c[0]?new Q(NaN):!k.c||I.c&&!I.c[0]?new Q(I):(q==9?(ee=k.s,k.s=1,$=B(I,k,0,3),k.s=ee,$.s*=ee):$=B(I,k,0,q),k=I.minus($.times(k)),!k.c[0]&&q==1&&(k.s=I.s),k)},X.multipliedBy=X.times=function(k,K){var $,ee,I,U,z,N,Z,ie,te,he,we,_e,Ke,Pe,Ve,et=this,He=et.c,ze=(k=new Q(k,K)).c;if(!He||!ze||!He[0]||!ze[0])return!et.s||!k.s||He&&!He[0]&&!ze||ze&&!ze[0]&&!He?k.c=k.e=k.s=null:(k.s*=et.s,!He||!ze?k.c=k.e=null:(k.c=[0],k.e=0)),k;for(ee=y(et.e/c)+y(k.e/c),k.s*=et.s,Z=He.length,he=ze.length,Z<he&&(Ke=He,He=ze,ze=Ke,I=Z,Z=he,he=I),I=Z+he,Ke=[];I--;Ke.push(0));for(Pe=a,Ve=d,I=he;--I>=0;){for($=0,we=ze[I]%Ve,_e=ze[I]/Ve|0,z=Z,U=I+z;U>I;)ie=He[--z]%Ve,te=He[z]/Ve|0,N=_e*ie+te*we,ie=we*ie+N%Ve*Ve+Ke[U]+$,$=(ie/Pe|0)+(N/Ve|0)+_e*te,Ke[U--]=ie%Pe;Ke[U]=$}return $?++ee:Ke.splice(0,1),me(k,Ke,ee)},X.negated=function(){var k=new Q(this);return k.s=-k.s||null,k},X.plus=function(k,K){var $,ee=this,I=ee.s;if(k=new Q(k,K),K=k.s,!I||!K)return new Q(NaN);if(I!=K)return k.s=-K,ee.minus(k);var U=ee.e/c,z=k.e/c,N=ee.c,Z=k.c;if(!U||!z){if(!N||!Z)return new Q(I/0);if(!N[0]||!Z[0])return Z[0]?k:new Q(N[0]?ee:I*0)}if(U=y(U),z=y(z),N=N.slice(),I=U-z){for(I>0?(z=U,$=Z):(I=-I,$=N),$.reverse();I--;$.push(0));$.reverse()}for(I=N.length,K=Z.length,I-K<0&&($=Z,Z=N,N=$,K=I),I=0;K;)I=(N[--K]=N[K]+Z[K]+I)/a|0,N[K]=a===N[K]?0:N[K]%a;return I&&(N=[I].concat(N),++z),me(k,N,z)},X.precision=X.sd=function(k,K){var $,ee,I,U=this;if(k!=null&&k!==!!k)return v(k,1,h),K==null?K=w:v(K,0,8),be(new Q(U),k,K);if(!($=U.c))return null;if(I=$.length-1,ee=I*c+1,I=$[I]){for(;I%10==0;I/=10,ee--);for(I=$[0];I>=10;I/=10,ee++);}return k&&U.e+1>ee&&(ee=U.e+1),ee},X.shiftedBy=function(k){return v(k,-u,u),this.times("1e"+k)},X.squareRoot=X.sqrt=function(){var k,K,$,ee,I,U=this,z=U.c,N=U.s,Z=U.e,ie=g+4,te=new Q("0.5");if(N!==1||!z||!z[0])return new Q(!N||N<0&&(!z||z[0])?NaN:z?U:1/0);if(N=Math.sqrt(+xe(U)),N==0||N==1/0?(K=b(z),(K.length+Z)%2==0&&(K+="0"),N=Math.sqrt(+K),Z=y((Z+1)/2)-(Z<0||Z%2),N==1/0?K="5e"+Z:(K=N.toExponential(),K=K.slice(0,K.indexOf("e")+1)+Z),$=new Q(K)):$=new Q(N+""),$.c[0]){for(Z=$.e,N=Z+ie,N<3&&(N=0);;)if(I=$,$=te.times(I.plus(B(U,I,ie,1))),b(I.c).slice(0,N)===(K=b($.c)).slice(0,N))if($.e<Z&&--N,K=K.slice(N-3,N+1),K=="9999"||!ee&&K=="4999"){if(!ee&&(be(I,I.e+g+2,0),I.times(I).eq(U))){$=I;break}ie+=4,N+=4,ee=1}else{(!+K||!+K.slice(1)&&K.charAt(0)=="5")&&(be($,$.e+g+2,1),k=!$.times($).eq(U));break}}return be($,$.e+g+1,w,k)},X.toExponential=function(k,K){return k!=null&&(v(k,0,h),k++),ue(this,k,K,1)},X.toFixed=function(k,K){return k!=null&&(v(k,0,h),k=k+this.e+1),ue(this,k,K)},X.toFormat=function(k,K,$){var ee,I=this;if($==null)k!=null&&K&&typeof K=="object"?($=K,K=null):k&&typeof k=="object"?($=k,k=K=null):$=j;else if(typeof $!="object")throw Error(s+"Argument not an object: "+$);if(ee=I.toFixed(k,K),I.c){var U,z=ee.split("."),N=+$.groupSize,Z=+$.secondaryGroupSize,ie=$.groupSeparator||"",te=z[0],he=z[1],we=I.s<0,_e=we?te.slice(1):te,Ke=_e.length;if(Z&&(U=N,N=Z,Z=U,Ke-=U),N>0&&Ke>0){for(U=Ke%N||N,te=_e.substr(0,U);U<Ke;U+=N)te+=ie+_e.substr(U,N);Z>0&&(te+=ie+_e.slice(U)),we&&(te="-"+te)}ee=he?te+($.decimalSeparator||"")+((Z=+$.fractionGroupSize)?he.replace(new RegExp("\\d{"+Z+"}\\B","g"),"$&"+($.fractionGroupSeparator||"")):he):te}return($.prefix||"")+ee+($.suffix||"")},X.toFraction=function(k){var K,$,ee,I,U,z,N,Z,ie,te,he,we,_e=this,Ke=_e.c;if(k!=null&&(N=new Q(k),!N.isInteger()&&(N.c||N.s!==1)||N.lt(P)))throw Error(s+"Argument "+(N.isInteger()?"out of range: ":"not an integer: ")+xe(N));if(!Ke)return new Q(_e);for(K=new Q(P),ie=$=new Q(P),ee=Z=new Q(P),we=b(Ke),U=K.e=we.length-_e.e-1,K.c[0]=f[(z=U%c)<0?c+z:z],k=!k||N.comparedTo(K)>0?U>0?K:ie:N,z=Y,Y=1/0,N=new Q(we),Z.c[0]=0;te=B(N,K,0,1),I=$.plus(te.times(ee)),I.comparedTo(k)!=1;)$=ee,ee=I,ie=Z.plus(te.times(I=ie)),Z=I,K=N.minus(te.times(I=K)),N=I;return I=B(k.minus($),ee,0,1),Z=Z.plus(I.times(ie)),$=$.plus(I.times(ee)),Z.s=ie.s=_e.s,U=U*2,he=B(ie,ee,U,w).minus(_e).abs().comparedTo(B(Z,$,U,w).minus(_e).abs())<1?[ie,ee]:[Z,$],Y=z,he},X.toNumber=function(){return+xe(this)},X.toPrecision=function(k,K){return k!=null&&v(k,1,h),ue(this,k,K,2)},X.toString=function(k){var K,$=this,ee=$.s,I=$.e;return I===null?ee?(K="Infinity",ee<0&&(K="-"+K)):K="NaN":(k==null?K=I<=S||I>=C?R(b($.c),I):F(b($.c),I,"0"):k===10?($=be(new Q($),g+I+1,w),K=F(b($.c),$.e,"0")):(v(k,2,de.length,"Base"),K=H(F(b($.c),I,"0"),10,k,ee,!0)),ee<0&&$.c[0]&&(K="-"+K)),K},X.valueOf=X.toJSON=function(){return xe(this)},X._isBigNumber=!0,D!=null&&Q.set(D),Q}function y(D){var B=D|0;return D>0||D===B?B:B-1}function b(D){for(var B,H,W=1,X=D.length,P=D[0]+"";W<X;){for(B=D[W++]+"",H=c-B.length;H--;B="0"+B);P+=B}for(X=P.length;P.charCodeAt(--X)===48;);return P.slice(0,X+1||1)}function E(D,B){var H,W,X=D.c,P=B.c,g=D.s,w=B.s,S=D.e,C=B.e;if(!g||!w)return null;if(H=X&&!X[0],W=P&&!P[0],H||W)return H?W?0:-w:g;if(g!=w)return g;if(H=g<0,W=S==C,!X||!P)return W?0:!X^H?1:-1;if(!W)return S>C^H?1:-1;for(w=(S=X.length)<(C=P.length)?S:C,g=0;g<w;g++)if(X[g]!=P[g])return X[g]>P[g]^H?1:-1;return S==C?0:S>C^H?1:-1}function v(D,B,H,W){if(D<B||D>H||D!==n(D))throw Error(s+(W||"Argument")+(typeof D=="number"?D<B||D>H?" out of range: ":" not an integer: ":" not a primitive number: ")+String(D))}function A(D){var B=D.c.length-1;return y(D.e/c)==B&&D.c[B]%2!=0}function R(D,B){return(D.length>1?D.charAt(0)+"."+D.slice(1):D)+(B<0?"e":"e+")+B}function F(D,B,H){var W,X;if(B<0){for(X=H+".";++B;X+=H);D=X+D}else if(W=D.length,++B>W){for(X=H,B-=W;--B;X+=H);D+=X}else B<W&&(D=D.slice(0,B)+"."+D.slice(B));return D}e=p(),e.default=e.BigNumber=e,typeof define=="function"&&define.amd?define(function(){return e}):typeof D7!="undefined"&&D7.exports?D7.exports=e:(t||(t=typeof self!="undefined"&&self?self:window),t.BigNumber=e)})(rme)});var GC=m((nme,sme)=>{l();"use strict";var GQe=Math.exp;nme=sme.exports=function(e){if(typeof e!="number")throw new Error("must provide a timespan to the moving average constructor");if(e<=0)throw new Error("must provide a timespan > 0 to the moving average constructor");let r,i=0,n=0,s=0,o,a={};function c(u,f){return 1-GQe(-(u-f)/e)}return a.push=function(f,d){if(o){let h=c(f,o),p=d-r,y=h*p;r=h*d+(1-h)*r,i=(1-h)*(i+p*y),n=Math.sqrt(i),s=r+h*p}else r=d;o=f},a.movingAverage=function(){return r},a.variance=function(){return i},a.deviation=function(){return n},a.forecast=function(){return s},a}});var ume=m((sDt,cme)=>{l();"use strict";var{EventEmitter:$Qe}=br(),{BigNumber:B7}=ime(),ome=GC(),WQe=AC(),ame=class extends $Qe{constructor(e,r){super();this._options=r,this._queue=[],this._stats={dataReceived:B7(0),dataSent:B7(0)},this._frequencyLastTime=Date.now(),this._frequencyAccumulators={},this._movingAverages={},this._update=this._update.bind(this);let i=this._options.movingAverageIntervals;for(let n=0;n<e.length;n++){let s=e[n];this._stats[s]=B7(0),this._movingAverages[s]={};for(let o=0;o<i.length;o++){let a=i[o];(this._movingAverages[s][a]=ome(a)).push(this._frequencyLastTime,0)}}}start(){this._queue.length&&this._resetComputeTimeout()}stop(){this._timeout&&(this._timeout.clear(),this._timeout=null)}get snapshot(){return Object.assign({},this._stats)}get movingAverages(){return Object.assign({},this._movingAverages)}toJSON(){let e=this.snapshot,r=this.movingAverages,i={dataReceived:e.dataReceived.toString(),dataSent:e.dataSent.toString(),movingAverages:{}},n=Object.keys(r);for(let s of n){i.movingAverages[s]={};for(let o of Object.keys(r[s]))i.movingAverages[s][o]=r[s][o].movingAverage()}return i}push(e,r){this._queue.push([e,r,Date.now()]),this._resetComputeTimeout()}_resetComputeTimeout(){this._timeout=WQe(this._update,this._nextTimeout())}_nextTimeout(){let e=this._queue.length/this._options.computeThrottleMaxQueueSize;return Math.max(this._options.computeThrottleTimeout*(1-e),0)}_update(){if(this._timeout=null,this._queue.length){let e;for(e of this._queue)this._applyOp(e);this._queue=[],this._updateFrequency(e[2]),this.emit("update",this._stats)}}_updateFrequency(e){let r=e-this._frequencyLastTime;Object.keys(this._stats).forEach(i=>{this._updateFrequencyFor(i,r,e)}),this._frequencyLastTime=e}_updateFrequencyFor(e,r,i){let n=this._frequencyAccumulators[e]||0;this._frequencyAccumulators[e]=0;let o=n/(r||1)*1e3,a=this._movingAverages[e];a||(a=this._movingAverages[e]={});let c=this._options.movingAverageIntervals;for(let u=0;u<c.length;u++){let f=c[u],d=a[f];d||(d=a[f]=ome(f)),d.push(i,o)}}_applyOp(e){let r=e[0],i=e[1];if(typeof i!="number")throw new Error(`invalid increment number: ${i}`);let n;Object.prototype.hasOwnProperty.call(this._stats,r)?n=this._stats[r]:n=this._stats[r]=B7(0),this._stats[r]=n.plus(i),this._frequencyAccumulators[r]||(this._frequencyAccumulators[r]=0),this._frequencyAccumulators[r]+=i}};cme.exports=ame});var dme=m((oDt,lme)=>{l();"use strict";var YQe=Al(),{pipe:XQe}=Nr(),{tap:fme}=Um(),QQe=tme(),{METRICS:ZQe}=v7(),$C=ume(),WC=["dataReceived","dataSent"],JQe={in:"dataReceived",out:"dataSent"},N7=class{constructor(e){this._options=YQe(ZQe,e),this._globalStats=new $C(WC,this._options),this._peerStats=new Map,this._protocolStats=new Map,this._oldPeers=QQe(this._options.maxOldPeersRetention),this._running=!1,this._onMessage=this._onMessage.bind(this),this._connectionManager=e.connectionManager,this._connectionManager.on("peer:disconnect",r=>{this.onPeerDisconnected(r.remotePeer)})}start(){this._running=!0}stop(){this._running=!1,this._globalStats.stop();for(let e of this._peerStats.values())e.stop();for(let e of this._protocolStats.values())e.stop()}get global(){return this._globalStats}get peers(){return Array.from(this._peerStats.keys())}forPeer(e){let r=e.toB58String();return this._peerStats.get(r)||this._oldPeers.get(r)}get protocols(){return Array.from(this._protocolStats.keys())}forProtocol(e){return this._protocolStats.get(e)}onPeerDisconnected(e){let r=e.toB58String(),i=this._peerStats.get(r);i&&(i.stop(),this._peerStats.delete(r),this._oldPeers.set(r,i))}_onMessage({remotePeer:e,protocol:r,direction:i,dataLength:n}){if(!this._running)return;let s=JQe[i],o=this.forPeer(e);if(o||(o=new $C(WC,this._options),this._peerStats.set(e.toB58String(),o)),o.push(s,n),this._globalStats.push(s,n),r){let a=this.forProtocol(r);a||(a=new $C(WC,this._options),this._protocolStats.set(r,a)),a.push(s,n)}}updatePlaceholder(e,r){if(!this._running)return;let i=this.forPeer(e),n=r.toB58String(),s=this.forPeer(r),o=i;s&&(o=N7.mergeStats(s,o),this._oldPeers.delete(n)),this._peerStats.delete(e.toB58String()),this._peerStats.set(n,o),o.start()}trackStream({stream:e,remotePeer:r,protocol:i}){let n=this,s=e.source;e.source=fme(a=>n._onMessage({remotePeer:r,protocol:i,direction:"in",dataLength:a.length}))(s);let o=e.sink;return e.sink=a=>XQe(a,fme(c=>n._onMessage({remotePeer:r,protocol:i,direction:"out",dataLength:c.length})),o),e}static mergeStats(e,r){return e.stop(),r.stop(),e._queue=[...e._queue,...r._queue],e}};lme.exports=N7});var YC=m((aDt,pme)=>{l();"use strict";function hme(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function eZe(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return hme(t,r)}catch(i){r.message=t.message,r.stack=t.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(t)),hme(new n,r)}}pme.exports=eZe});var M7=m(Ah=>{l();"use strict";var yme=Rn(),gme=fa(),tZe=Nr(),rZe=YC(),{fromString:iZe}=(dt(),bi),nZe=Sd(),mme=iZe(`
`);Ah.encode=t=>gme.encode.single(new yme([t,mme]));Ah.write=(t,e)=>t.push(Ah.encode(e));Ah.writeAll=(t,e)=>{t.push(e.reduce((r,i)=>r.append(Ah.encode(i)),new yme))};Ah.read=async t=>{let e=1,r={[Symbol.asyncIterator](){return this},next:()=>t.next(e)},i=s=>{e=s},n=await tZe(r,gme.decode({onLength:i}),nZe);if(n.get(n.length-1)!==mme[0])throw rZe(new Error("missing newline"),"ERR_INVALID_MULTISTREAM_SELECT_MESSAGE");return n.shallowSlice(0,-1)}});var vme=m((uDt,bme)=>{l();"use strict";var $1=Ee()("mss:select"),sZe=YC(),W1=M7(),oZe=S1();bme.exports=async(t,e,r)=>{e=Array.isArray(e)?[...e]:[e];let{reader:i,writer:n,rest:s,stream:o}=oZe(t),a=e.shift();r?($1('select: write ["%s", "%s"]',r,a),W1.writeAll(n,[r,a])):($1('select: write "%s"',a),W1.write(n,a));let c=(await W1.read(i)).toString();if($1('select: read "%s"',c),c===r&&(c=(await W1.read(i)).toString(),$1('select: read "%s"',c)),c===a)return s(),{stream:o,protocol:a};for(let u of e){$1('select: write "%s"',u),W1.write(n,u);let f=(await W1.read(i)).toString();if($1('select: read "%s" for "%s"',f,u),f===u)return s(),{stream:o,protocol:u}}throw s(),sZe(new Error("protocol selection failed"),"ERR_UNSUPPORTED_PROTOCOL")}});var XC=m(wme=>{l();"use strict";wme.PROTOCOL_ID="/multistream/1.0.0"});var Eme=m((lDt,_me)=>{l();"use strict";var s3=Ee()("mss:handle"),aZe=Rn(),Y1=M7(),cZe=S1(),{PROTOCOL_ID:QC}=XC();_me.exports=async(t,e)=>{e=Array.isArray(e)?e:[e];let{writer:r,reader:i,rest:n,stream:s}=cZe(t);for(;;){let o=(await Y1.read(i)).toString();if(s3('read "%s"',o),o===QC){s3('respond with "%s" for "%s"',QC,o),Y1.write(r,QC);continue}if(e.includes(o))return Y1.write(r,o),s3('respond with "%s" for "%s"',o,o),n(),{stream:s,protocol:o};if(o==="ls"){Y1.write(r,new aZe(e.map(a=>Y1.encode(a)))),s3('respond with "%s" for %s',e,o);continue}Y1.write(r,"na"),s3('respond with "na" for "%s"',o)}}});var Ame=m((dDt,xme)=>{l();"use strict";var uZe=Ab(),fZe=Ee()("it-multistream-select:ls"),Sme=M7(),lZe=S1(),dZe=fa(),hZe=Nr();xme.exports=async t=>{let{reader:e,writer:r,rest:i,stream:n}=lZe(t);fZe('write "ls"'),Sme.write(r,"ls"),i();let s=await Sme.read(e),o=uZe([s]),a=[];return await hZe(o,dZe.decode(),async c=>{for await(let u of c)a.push(u.shallowSlice(0,-1).toString())}),{stream:n,protocols:a}}});var Pme=m(L7=>{l();"use strict";var Ime=vme(),pZe=Eme(),yZe=Ame(),{PROTOCOL_ID:ZC}=XC();L7.PROTOCOL_ID=ZC;var JC=class{constructor(e){this._stream=e,this._shaken=!1}async _handshake(){if(this._shaken)return;let{stream:e}=await Ime(this._stream,ZC);this._stream=e,this._shaken=!0}},Tme=class extends JC{select(e){return Ime(this._stream,e,this._shaken?null:ZC)}async ls(){await this._handshake();let{stream:e,protocols:r}=await yZe(this._stream);return this._stream=e,r}};L7.Dialer=Tme;var Rme=class extends JC{handle(e){return pZe(this._stream,e)}};L7.Listener=Rme});var Ome=m((pDt,Cme)=>{l();"use strict";var gZe={OPEN:"open",CLOSING:"closing",CLOSED:"closed"};Cme.exports=gZe});var Lme=m((yDt,Mme)=>{l();"use strict";var kme=it(),{Multiaddr:mZe}=rt(),Bs=wT(),{OPEN:bZe,CLOSING:Dme,CLOSED:eO}=Ome(),Bme=Symbol.for("@libp2p/interface-connection/connection"),Nme=class{constructor({localAddr:e,remoteAddr:r,localPeer:i,remotePeer:n,newStream:s,close:o,getStreams:a,stat:c}){vZe(e,i,n,s,o,a,c),this.id=parseInt(String(Math.random()*1e9)).toString(36)+Date.now(),this.localAddr=e,this.remoteAddr=r,this.localPeer=i,this.remotePeer=n,this._stat={...c,status:bZe},this._newStream=s,this._close=o,this._getStreams=a,this.registry=new Map,this.tags=[]}get[Symbol.toStringTag](){return"Connection"}get[Bme](){return!0}static isConnection(e){return Boolean(e&&e[Bme])}get stat(){return this._stat}get streams(){return this._getStreams()}async newStream(e){if(this.stat.status===Dme)throw Bs(new Error("the connection is being closed"),"ERR_CONNECTION_BEING_CLOSED");if(this.stat.status===eO)throw Bs(new Error("the connection is closed"),"ERR_CONNECTION_CLOSED");Array.isArray(e)||(e=[e]);let{stream:r,protocol:i}=await this._newStream(e);return this.addStream(r,{protocol:i}),{stream:r,protocol:i}}addStream(e,{protocol:r,metadata:i={}}){this.registry.set(e.id,{protocol:r,...i})}removeStream(e){this.registry.delete(e)}async close(){if(this.stat.status!==eO){if(this._closing)return this._closing;this.stat.status=Dme,this._closing=await this._close(),this._stat.timeline.close=Date.now(),this.stat.status=eO}}};Mme.exports=Nme;function vZe(t,e,r,i,n,s,o){if(t&&!mZe.isMultiaddr(t))throw Bs(new Error("localAddr must be an instance of multiaddr"),"ERR_INVALID_PARAMETERS");if(!kme.isPeerId(e))throw Bs(new Error("localPeer must be an instance of peer-id"),"ERR_INVALID_PARAMETERS");if(!kme.isPeerId(r))throw Bs(new Error("remotePeer must be an instance of peer-id"),"ERR_INVALID_PARAMETERS");if(typeof i!="function")throw Bs(new Error("new stream must be a function"),"ERR_INVALID_PARAMETERS");if(typeof n!="function")throw Bs(new Error("close must be a function"),"ERR_INVALID_PARAMETERS");if(typeof s!="function")throw Bs(new Error("getStreams must be a function"),"ERR_INVALID_PARAMETERS");if(!o)throw Bs(new Error("connection metadata object must be provided"),"ERR_INVALID_PARAMETERS");if(o.direction!=="inbound"&&o.direction!=="outbound")throw Bs(new Error('direction must be "inbound" or "outbound"'),"ERR_INVALID_PARAMETERS");if(!o.timeline)throw Bs(new Error("connection timeline object must be provided in the stat object"),"ERR_INVALID_PARAMETERS");if(!o.timeline.open)throw Bs(new Error("connection open timestamp must be provided"),"ERR_INVALID_PARAMETERS");if(!o.timeline.upgraded)throw Bs(new Error("connection upgraded timestamp must be provided"),"ERR_INVALID_PARAMETERS")}});var jme=m(qme=>{l();"use strict";qme.Connection=Lme()});var Fme=m((mDt,Ume)=>{l();"use strict";function wZe(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}else return Array.from(t)}Ume.exports=function(e){var r=void 0,i=void 0;function n(a){if(!(a instanceof Object))throw new Error('Target "'+a+'" is not an object');i=a}function s(a){Object.keys(a).forEach(function(c){var u=a[c];if(typeof u!="function")throw new Error('Trap "'+c+": "+u+'" is not a function');if(!Reflect[c])throw new Error('Trap "'+c+": "+u+'" is not a valid trap')}),r=a}n(function(){}),e&&n(e),s(Reflect);var o=new Proxy({},{get:function(c,u){return function(){for(var f=arguments.length,d=Array(f),h=0;h<f;h++)d[h]=arguments[h];return r[u].apply(null,[i].concat(wZe(d.slice(1))))}}});return{setTarget:n,setHandler:s,getTarget:function(){return i},getHandler:function(){return r},proxy:new Proxy(i,o)}}});var Gme=m((bDt,Hme)=>{l();"use strict";var Kme=Ee(),Li=Object.assign(Kme("libp2p:upgrader"),{error:Kme("libp2p:upgrader:err")}),Ih=_r(),X1=Pme(),{Connection:_Ze}=jme(),EZe=it(),{pipe:SZe}=Nr(),Vme=Fme(),{codes:Q1}=_i(),zme=class{constructor({localPeer:e,metrics:r,cryptos:i=new Map,muxers:n=new Map,onConnectionEnd:s=()=>{},onConnection:o=()=>{}}){this.localPeer=e,this.metrics=r,this.cryptos=i,this.muxers=n,this.protector=null,this.protocols=new Map,this.onConnection=o,this.onConnectionEnd=s}async upgradeInbound(e){let r,i,n,s,o,a,c;if(this.metrics){({setTarget:a,proxy:c}=Vme());let f=(Math.random()*1e9).toString(36)+Date.now();a({toB58String:()=>f}),e=this.metrics.trackStream({stream:e,remotePeer:c})}Li("Starting the inbound connection upgrade");let u=e;this.protector&&(u=await this.protector.protect(e));try{({conn:r,remotePeer:i,protocol:o}=await this._encryptInbound(this.localPeer,u,this.cryptos)),this.muxers.size?{stream:n,Muxer:s}=await this._multiplexInbound(r,this.muxers):n=r}catch(f){throw Li.error("Failed to upgrade inbound connection",f),await e.close(f),f}return this.metrics&&(this.metrics.updatePlaceholder(c,i),a(i)),Li("Successfully upgraded inbound connection"),this._createConnection({cryptoProtocol:o,direction:"inbound",maConn:e,upgradedConn:n,Muxer:s,remotePeer:i})}async upgradeOutbound(e){let r=e.remoteAddr.getPeerId();if(!r)throw Ih(new Error("outbound connection must have a peer id"),Q1.ERR_INVALID_MULTIADDR);let i=EZe.createFromB58String(r),n,s,o,a,c,u,f;if(this.metrics){({setTarget:u,proxy:f}=Vme());let h=(Math.random()*1e9).toString(36)+Date.now();u({toB58String:()=>h}),e=this.metrics.trackStream({stream:e,remotePeer:f})}Li("Starting the outbound connection upgrade");let d=e;this.protector&&(d=await this.protector.protect(e));try{({conn:n,remotePeer:s,protocol:a}=await this._encryptOutbound(this.localPeer,d,i,this.cryptos)),this.muxers.size?{stream:o,Muxer:c}=await this._multiplexOutbound(n,this.muxers):o=n}catch(h){throw Li.error("Failed to upgrade outbound connection",h),await e.close(h),h}return this.metrics&&(this.metrics.updatePlaceholder(f,s),u(s)),Li("Successfully upgraded outbound connection"),this._createConnection({cryptoProtocol:a,direction:"outbound",maConn:e,upgradedConn:o,Muxer:c,remotePeer:s})}_createConnection({cryptoProtocol:e,direction:r,maConn:i,upgradedConn:n,Muxer:s,remotePeer:o}){let a,c,u;s&&(a=new s({onStream:async h=>{if(!u)return;let p=new X1.Listener(h);try{let{stream:y,protocol:b}=await p.handle(Array.from(this.protocols.keys()));Li("%s: incoming stream opened on %s",r,b),this.metrics&&this.metrics.trackStream({stream:y,remotePeer:o,protocol:b}),u.addStream(h,{protocol:b}),this._onStream({connection:u,stream:{...h,...y},protocol:b})}catch(y){Li.error(y)}},onStreamEnd:h=>{u.removeStream(h.id)}}),c=async h=>{Li("%s: starting new stream on %s",r,h);let p=a.newStream(),y=new X1.Dialer(p);try{let{stream:b,protocol:E}=await y.select(h);return this.metrics&&this.metrics.trackStream({stream:b,remotePeer:o,protocol:E}),{stream:{...p,...b},protocol:E}}catch(b){throw Li.error("could not create new stream",b),Ih(b,Q1.ERR_UNSUPPORTED_PROTOCOL)}},SZe(n,a,n).catch(Li.error));let f=i.timeline;i.timeline=new Proxy(f,{set:(...h)=>(u&&h[1]==="close"&&h[2]&&!f.close&&(async()=>{try{u.stat.status==="open"&&await u.close()}catch(p){Li.error(p)}finally{this.onConnectionEnd(u)}})(),Reflect.set(...h))}),i.timeline.upgraded=Date.now();let d=()=>{throw Ih(new Error("connection is not multiplexed"),"ERR_CONNECTION_NOT_MULTIPLEXED")};return u=new _Ze({localAddr:i.localAddr,remoteAddr:i.remoteAddr,localPeer:this.localPeer,remotePeer:o,stat:{direction:r,timeline:i.timeline,multiplexer:s&&s.multicodec,encryption:e},newStream:c||d,getStreams:()=>a?a.streams:d(),close:async()=>{await i.close(),a&&a.streams.map(h=>h.abort())}}),this.onConnection(u),u}_onStream({connection:e,stream:r,protocol:i}){this.protocols.get(i)({connection:e,stream:r,protocol:i})}async _encryptInbound(e,r,i){let n=new X1.Listener(r),s=Array.from(i.keys());Li("handling inbound crypto protocol selection",s);try{let{stream:o,protocol:a}=await n.handle(s),c=i.get(a);if(Li("encrypting inbound connection..."),!c)throw new Error(`no crypto module found for ${a}`);return{...await c.secureInbound(e,o),protocol:a}}catch(o){throw Ih(o,Q1.ERR_ENCRYPTION_FAILED)}}async _encryptOutbound(e,r,i,n){let s=new X1.Dialer(r),o=Array.from(n.keys());Li("selecting outbound crypto protocol",o);try{let{stream:a,protocol:c}=await s.select(o),u=n.get(c);if(Li("encrypting outbound connection to %j",i),!u)throw new Error(`no crypto module found for ${c}`);return{...await u.secureOutbound(e,a,i),protocol:c}}catch(a){throw Ih(a,Q1.ERR_ENCRYPTION_FAILED)}}async _multiplexOutbound(e,r){let i=new X1.Dialer(e),n=Array.from(r.keys());Li("outbound selecting muxer %s",n);try{let{stream:s,protocol:o}=await i.select(n);Li("%s selected as muxer protocol",o);let a=r.get(o);return{stream:s,Muxer:a}}catch(s){throw Ih(s,Q1.ERR_MUXER_UNAVAILABLE)}}async _multiplexInbound(e,r){let i=new X1.Listener(e),n=Array.from(r.keys());Li("inbound handling muxers %s",n);try{let{stream:s,protocol:o}=await i.handle(n),a=r.get(o);return{stream:s,Muxer:a}}catch(s){throw Ih(s,Q1.ERR_MUXER_UNAVAILABLE)}}};Hme.exports=zme});var o3=m((vDt,Xme)=>{l();"use strict";var tO=_r(),$me=it(),{codes:{ERR_INVALID_PARAMETERS:Wme}}=_i(),xZe=t=>t,Yme=class{constructor({peerStore:e,eventName:r,eventProperty:i,eventTransformer:n=xZe}){this._ps=e,this.eventName=r,this.eventProperty=i,this.eventTransformer=n,this.data=new Map}set(e,r){throw tO(new Error("set must be implemented by the subclass"),"ERR_NOT_IMPLEMENTED")}_setData(e,r,{emit:i=!0}={}){let n=e.toB58String();this.data.set(n,r),i&&this._emit(e,r)}_emit(e,r){this._ps.emit(this.eventName,{peerId:e,[this.eventProperty]:this.eventTransformer(r)})}get(e){if(!$me.isPeerId(e))throw tO(new Error("peerId must be an instance of peer-id"),Wme);let r=this.data.get(e.toB58String());return r?[...r]:void 0}delete(e){if(!$me.isPeerId(e))throw tO(new Error("peerId must be an instance of peer-id"),Wme);return this.data.delete(e.toB58String())?(this._emit(e,[]),!0):!1}};Xme.exports=Yme});var e3e=m((wDt,Jme)=>{l();"use strict";var Qme=Ee(),va=Object.assign(Qme("libp2p:peer-store:address-book"),{error:Qme("libp2p:peer-store:address-book:err")}),Z1=_r(),{Multiaddr:AZe}=rt(),q7=it(),IZe=o3(),TZe=E7(),{codes:{ERR_INVALID_PARAMETERS:J1}}=_i(),RZe=dm(),Zme=class extends IZe{constructor(e){super({peerStore:e,eventName:"change:multiaddrs",eventProperty:"multiaddrs",eventTransformer:r=>r.addresses?r.addresses.map(i=>i.multiaddr):[]});this.data=new Map}consumePeerRecord(e){let r;try{r=TZe.createFromProtobuf(e.payload)}catch(c){return va.error("invalid peer record received"),!1}if(!r.peerId.equals(e.peerId))return va("signing key does not match PeerId in the PeerRecord"),!1;if(!r.multiaddrs||!r.multiaddrs.length)return!1;let i=r.peerId,n=i.toB58String(),o=(this.data.get(n)||{record:void 0}).record;if(o&&o.seqNumber>=r.seqNumber)return!1;let a=this._toAddresses(r.multiaddrs,!0);return this._setData(i,{addresses:a,record:{raw:e.marshal(),seqNumber:r.seqNumber}}),va(`stored provided peer record for ${n}`),!0}getRawEnvelope(e){let r=this.data.get(e.toB58String());if(!(!r||!r.record||!r.record.raw))return r.record.raw}getPeerRecord(e){let r=this.getRawEnvelope(e);if(!!r)return RZe.createFromProtobuf(r)}set(e,r){if(!q7.isPeerId(e))throw va.error("peerId must be an instance of peer-id to store data"),Z1(new Error("peerId must be an instance of peer-id"),J1);let i=this._toAddresses(r);if(!i.length)return this;let n=e.toB58String(),s=this.data.get(n);return s&&s.addresses&&s.addresses.length===i.length&&s.addresses.filter(a=>i.some(c=>a.multiaddr.equals(c.multiaddr))).length===s.addresses.length?(va(`the addresses provided to store are equal to the already stored for ${n}`),this):(this._setData(e,{addresses:i,record:s&&s.record}),va(`stored provided multiaddrs for ${n}`),s||this._ps.emit("peer",e),this)}add(e,r){if(!q7.isPeerId(e))throw va.error("peerId must be an instance of peer-id to store data"),Z1(new Error("peerId must be an instance of peer-id"),J1);let i=this._toAddresses(r),n=e.toB58String();if(!i.length)return this;let s=this.data.get(n);return s&&s.addresses&&(s.addresses.forEach(o=>{i.find(a=>a.multiaddr.equals(o.multiaddr))||i.push(o)}),s.addresses.length===i.length)?(va(`the addresses provided to store are already stored for ${n}`),this):(this._setData(e,{addresses:i,record:s&&s.record}),va(`added provided multiaddrs for ${n}`),s&&s.addresses||this._ps.emit("peer",e),this)}get(e){if(!q7.isPeerId(e))throw Z1(new Error("peerId must be an instance of peer-id"),J1);let r=this.data.get(e.toB58String());return r&&r.addresses?[...r.addresses]:void 0}_toAddresses(e,r=!1){if(!e)throw va.error("multiaddrs must be provided to store data"),Z1(new Error("multiaddrs must be provided"),J1);let i=[];return e.forEach(n=>{if(!AZe.isMultiaddr(n))throw va.error(`multiaddr ${n} must be an instance of multiaddr`),Z1(new Error(`multiaddr ${n} must be an instance of multiaddr`),J1);i.find(s=>s.multiaddr.equals(n))||i.push({multiaddr:n,isCertified:r})}),i}getMultiaddrsForPeer(e,r=i=>i){if(!q7.isPeerId(e))throw Z1(new Error("peerId must be an instance of peer-id"),J1);let i=this.data.get(e.toB58String());if(!(!i||!i.addresses))return r(i.addresses||[]).map(n=>{let s=n.multiaddr,o=s.getPeerId();return o&&o===e.toB58String()?s:s.encapsulate(`/p2p/${e.toB58String()}`)})}};Jme.exports=Zme});var c3e=m((_Dt,a3e)=>{l();"use strict";var t3e=Ee(),r3e=Object.assign(t3e("libp2p:peer-store:key-book"),{error:t3e("libp2p:peer-store:key-book:err")}),i3e=_r(),n3e=it(),PZe=o3(),{codes:{ERR_INVALID_PARAMETERS:s3e}}=_i(),o3e=class extends PZe{constructor(e){super({peerStore:e,eventName:"change:pubkey",eventProperty:"pubkey",eventTransformer:r=>r.pubKey});this.data=new Map}set(e,r){if(!n3e.isPeerId(e))throw r3e.error("peerId must be an instance of peer-id to store data"),i3e(new Error("peerId must be an instance of peer-id"),s3e);let i=e.toB58String();return!this.data.get(i)&&r&&(e.pubKey=r,this._setData(e,e),r3e(`stored provided public key for ${i}`)),this}get(e){if(!n3e.isPeerId(e))throw i3e(new Error("peerId must be an instance of peer-id"),s3e);let r=this.data.get(e.toB58String());return r?r.pubKey:void 0}};a3e.exports=o3e});var d3e=m((EDt,l3e)=>{l();"use strict";var u3e=Ee(),rO=Object.assign(u3e("libp2p:peer-store:proto-book"),{error:u3e("libp2p:peer-store:proto-book:err")}),e2=_r(),{equals:CZe}=(wi(),bn),a3=it(),OZe=o3(),{codes:{ERR_INVALID_PARAMETERS:t2}}=_i(),f3e=class extends OZe{constructor(e){super({peerStore:e,eventName:"change:metadata",eventProperty:"metadata"});this.data=new Map}set(e,r,i){if(!a3.isPeerId(e))throw rO.error("peerId must be an instance of peer-id to store data"),e2(new Error("peerId must be an instance of peer-id"),t2);if(typeof r!="string"||!(i instanceof Uint8Array))throw rO.error("valid key and value must be provided to store data"),e2(new Error("valid key and value must be provided"),t2);return this._setValue(e,r,i),this}_setValue(e,r,i,{emit:n=!0}={}){let s=e.toB58String(),o=this.data.get(s)||new Map,a=o.get(r);if(a&&CZe(i,a)){rO(`the metadata provided to store is equal to the already stored for ${s} on ${r}`);return}o.set(r,i),this.data.set(s,o),n&&this._emit(e,r)}get(e){if(!a3.isPeerId(e))throw e2(new Error("peerId must be an instance of peer-id"),t2);return this.data.get(e.toB58String())}getValue(e,r){if(!a3.isPeerId(e))throw e2(new Error("peerId must be an instance of peer-id"),t2);let i=this.data.get(e.toB58String());return i&&i.get(r)}delete(e){if(!a3.isPeerId(e))throw e2(new Error("peerId must be an instance of peer-id"),t2);return this.data.delete(e.toB58String())?(this._emit(e),!0):!1}deleteValue(e,r){if(!a3.isPeerId(e))throw e2(new Error("peerId must be an instance of peer-id"),t2);let i=this.data.get(e.toB58String());return!i||!i.delete(r)?!1:(this._emit(e,r),!0)}};l3e.exports=f3e});var g3e=m((SDt,y3e)=>{l();"use strict";var h3e=Ee(),wa=Object.assign(h3e("libp2p:peer-store:proto-book"),{error:h3e("libp2p:peer-store:proto-book:err")}),r2=_r(),iO=it(),kZe=o3(),{codes:{ERR_INVALID_PARAMETERS:i2}}=_i(),p3e=class extends kZe{constructor(e){super({peerStore:e,eventName:"change:protocols",eventProperty:"protocols",eventTransformer:r=>Array.from(r)});this.data=new Map}set(e,r){if(!iO.isPeerId(e))throw wa.error("peerId must be an instance of peer-id to store data"),r2(new Error("peerId must be an instance of peer-id"),i2);if(!r)throw wa.error("protocols must be provided to store data"),r2(new Error("protocols must be provided"),i2);let i=e.toB58String(),n=this.data.get(i),s=new Set(r);return n&&((a,c)=>a.size===c.size&&[...a].every(u=>c.has(u)))(n,s)?(wa(`the protocols provided to store are equal to the already stored for ${i}`),this):(this._setData(e,s),wa(`stored provided protocols for ${i}`),this)}add(e,r){if(!iO.isPeerId(e))throw wa.error("peerId must be an instance of peer-id to store data"),r2(new Error("peerId must be an instance of peer-id"),i2);if(!r)throw wa.error("protocols must be provided to store data"),r2(new Error("protocols must be provided"),i2);let i=e.toB58String(),n=this.data.get(i)||new Set,s=new Set([...n,...r]);return n.size===s.size?(wa(`the protocols provided to store are already stored for ${i}`),this):(this._setData(e,s),wa(`added provided protocols for ${i}`),this)}remove(e,r){if(!iO.isPeerId(e))throw wa.error("peerId must be an instance of peer-id to store data"),r2(new Error("peerId must be an instance of peer-id"),i2);if(!r)throw wa.error("protocols must be provided to store data"),r2(new Error("protocols must be provided"),i2);let i=e.toB58String(),n=this.data.get(i);if(n){let s=new Set([...n].filter(o=>!r.includes(o)));if(n.size===s.size)return this;this._setData(e,s),wa(`removed provided protocols for ${i}`)}return this}};y3e.exports=p3e});var nO=m((xDt,v3e)=>{l();"use strict";var DZe=_r(),{EventEmitter:BZe}=br(),m3e=it(),NZe=e3e(),MZe=c3e(),LZe=d3e(),qZe=g3e(),{codes:{ERR_INVALID_PARAMETERS:jZe}}=_i(),b3e=class extends BZe{constructor({peerId:e}){super();this._peerId=e,this.addressBook=new NZe(this),this.keyBook=new MZe(this),this.metadataBook=new LZe(this),this.protoBook=new qZe(this)}start(){}stop(){}get peers(){let e=new Set([...this.addressBook.data.keys(),...this.keyBook.data.keys(),...this.protoBook.data.keys(),...this.metadataBook.data.keys()]);this._peerId&&e.delete(this._peerId.toB58String());let r=new Map;return e.forEach(i=>{r.set(i,this.get(m3e.createFromB58String(i)))}),r}delete(e){let r=this.addressBook.delete(e),i=this.keyBook.delete(e),n=this.protoBook.delete(e),s=this.metadataBook.delete(e);return r||i||n||s}get(e){if(!m3e.isPeerId(e))throw DZe(new Error("peerId must be an instance of peer-id"),jZe);let r=this.keyBook.data.get(e.toB58String()),i=this.addressBook.get(e),n=this.metadataBook.get(e),s=this.protoBook.get(e);if(!(!r&&!i&&!n&&!s))return{id:r||e,addresses:i||[],protocols:s||[],metadata:n}}};v3e.exports=b3e});var _3e=m((ADt,w3e)=>{l();"use strict";function UZe(t,e,r){let i=new t(e,r);i._subscribeAdapter=i.subscribe,i._unsubscribeAdapter=i.unsubscribe;function n(o,a){a&&i.on(o,a),i._subscribeAdapter(o)}function s(o,a){a?i.removeListener(o,a):i.removeAllListeners(o),i.listenerCount(o)===0&&i._unsubscribeAdapter(o)}return i.subscribe=n,i.unsubscribe=s,i}w3e.exports=UZe});var E3e=m((IDt,n2)=>{l();"use strict";n2.exports.NAMESPACE_COMMON="/peers/";n2.exports.NAMESPACE_ADDRESS="/peers/addrs/";n2.exports.NAMESPACE_KEYS="/peers/keys/";n2.exports.NAMESPACE_METADATA="/peers/metadata/";n2.exports.NAMESPACE_PROTOCOL="/peers/protos/"});var x3e=m((TDt,S3e)=>{l();"use strict";var _l=Vi(),s2=_l.Reader,sO=_l.Writer,ai=_l.util,qi=_l.roots["libp2p-address-book"]||(_l.roots["libp2p-address-book"]={});qi.Addresses=function(){function t(e){if(this.addrs=[],e)for(var r=Object.keys(e),i=0;i<r.length;++i)e[r[i]]!=null&&(this[r[i]]=e[r[i]])}return t.prototype.addrs=ai.emptyArray,t.prototype.certifiedRecord=null,t.encode=function(r,i){if(i||(i=sO.create()),r.addrs!=null&&r.addrs.length)for(var n=0;n<r.addrs.length;++n)qi.Addresses.Address.encode(r.addrs[n],i.uint32(10).fork()).ldelim();return r.certifiedRecord!=null&&Object.hasOwnProperty.call(r,"certifiedRecord")&&qi.Addresses.CertifiedRecord.encode(r.certifiedRecord,i.uint32(18).fork()).ldelim(),i},t.decode=function(r,i){r instanceof s2||(r=s2.create(r));for(var n=i===void 0?r.len:r.pos+i,s=new qi.Addresses;r.pos<n;){var o=r.uint32();switch(o>>>3){case 1:s.addrs&&s.addrs.length||(s.addrs=[]),s.addrs.push(qi.Addresses.Address.decode(r,r.uint32()));break;case 2:s.certifiedRecord=qi.Addresses.CertifiedRecord.decode(r,r.uint32());break;default:r.skipType(o&7);break}}return s},t.fromObject=function(r){if(r instanceof qi.Addresses)return r;var i=new qi.Addresses;if(r.addrs){if(!Array.isArray(r.addrs))throw TypeError(".Addresses.addrs: array expected");i.addrs=[];for(var n=0;n<r.addrs.length;++n){if(typeof r.addrs[n]!="object")throw TypeError(".Addresses.addrs: object expected");i.addrs[n]=qi.Addresses.Address.fromObject(r.addrs[n])}}if(r.certifiedRecord!=null){if(typeof r.certifiedRecord!="object")throw TypeError(".Addresses.certifiedRecord: object expected");i.certifiedRecord=qi.Addresses.CertifiedRecord.fromObject(r.certifiedRecord)}return i},t.toObject=function(r,i){i||(i={});var n={};if((i.arrays||i.defaults)&&(n.addrs=[]),i.defaults&&(n.certifiedRecord=null),r.addrs&&r.addrs.length){n.addrs=[];for(var s=0;s<r.addrs.length;++s)n.addrs[s]=qi.Addresses.Address.toObject(r.addrs[s],i)}return r.certifiedRecord!=null&&r.hasOwnProperty("certifiedRecord")&&(n.certifiedRecord=qi.Addresses.CertifiedRecord.toObject(r.certifiedRecord,i)),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,_l.util.toJSONOptions)},t.Address=function(){function e(r){if(r)for(var i=Object.keys(r),n=0;n<i.length;++n)r[i[n]]!=null&&(this[i[n]]=r[i[n]])}return e.prototype.multiaddr=ai.newBuffer([]),e.prototype.isCertified=!1,e.encode=function(i,n){return n||(n=sO.create()),i.multiaddr!=null&&Object.hasOwnProperty.call(i,"multiaddr")&&n.uint32(10).bytes(i.multiaddr),i.isCertified!=null&&Object.hasOwnProperty.call(i,"isCertified")&&n.uint32(16).bool(i.isCertified),n},e.decode=function(i,n){i instanceof s2||(i=s2.create(i));for(var s=n===void 0?i.len:i.pos+n,o=new qi.Addresses.Address;i.pos<s;){var a=i.uint32();switch(a>>>3){case 1:o.multiaddr=i.bytes();break;case 2:o.isCertified=i.bool();break;default:i.skipType(a&7);break}}return o},e.fromObject=function(i){if(i instanceof qi.Addresses.Address)return i;var n=new qi.Addresses.Address;return i.multiaddr!=null&&(typeof i.multiaddr=="string"?ai.base64.decode(i.multiaddr,n.multiaddr=ai.newBuffer(ai.base64.length(i.multiaddr)),0):i.multiaddr.length&&(n.multiaddr=i.multiaddr)),i.isCertified!=null&&(n.isCertified=Boolean(i.isCertified)),n},e.toObject=function(i,n){n||(n={});var s={};return n.defaults&&(n.bytes===String?s.multiaddr="":(s.multiaddr=[],n.bytes!==Array&&(s.multiaddr=ai.newBuffer(s.multiaddr))),s.isCertified=!1),i.multiaddr!=null&&i.hasOwnProperty("multiaddr")&&(s.multiaddr=n.bytes===String?ai.base64.encode(i.multiaddr,0,i.multiaddr.length):n.bytes===Array?Array.prototype.slice.call(i.multiaddr):i.multiaddr),i.isCertified!=null&&i.hasOwnProperty("isCertified")&&(s.isCertified=i.isCertified),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,_l.util.toJSONOptions)},e}(),t.CertifiedRecord=function(){function e(r){if(r)for(var i=Object.keys(r),n=0;n<i.length;++n)r[i[n]]!=null&&(this[i[n]]=r[i[n]])}return e.prototype.seq=ai.Long?ai.Long.fromBits(0,0,!0):0,e.prototype.raw=ai.newBuffer([]),e.encode=function(i,n){return n||(n=sO.create()),i.seq!=null&&Object.hasOwnProperty.call(i,"seq")&&n.uint32(8).uint64(i.seq),i.raw!=null&&Object.hasOwnProperty.call(i,"raw")&&n.uint32(18).bytes(i.raw),n},e.decode=function(i,n){i instanceof s2||(i=s2.create(i));for(var s=n===void 0?i.len:i.pos+n,o=new qi.Addresses.CertifiedRecord;i.pos<s;){var a=i.uint32();switch(a>>>3){case 1:o.seq=i.uint64();break;case 2:o.raw=i.bytes();break;default:i.skipType(a&7);break}}return o},e.fromObject=function(i){if(i instanceof qi.Addresses.CertifiedRecord)return i;var n=new qi.Addresses.CertifiedRecord;return i.seq!=null&&(ai.Long?(n.seq=ai.Long.fromValue(i.seq)).unsigned=!0:typeof i.seq=="string"?n.seq=parseInt(i.seq,10):typeof i.seq=="number"?n.seq=i.seq:typeof i.seq=="object"&&(n.seq=new ai.LongBits(i.seq.low>>>0,i.seq.high>>>0).toNumber(!0))),i.raw!=null&&(typeof i.raw=="string"?ai.base64.decode(i.raw,n.raw=ai.newBuffer(ai.base64.length(i.raw)),0):i.raw.length&&(n.raw=i.raw)),n},e.toObject=function(i,n){n||(n={});var s={};if(n.defaults){if(ai.Long){var o=new ai.Long(0,0,!0);s.seq=n.longs===String?o.toString():n.longs===Number?o.toNumber():o}else s.seq=n.longs===String?"0":0;n.bytes===String?s.raw="":(s.raw=[],n.bytes!==Array&&(s.raw=ai.newBuffer(s.raw)))}return i.seq!=null&&i.hasOwnProperty("seq")&&(typeof i.seq=="number"?s.seq=n.longs===String?String(i.seq):i.seq:s.seq=n.longs===String?ai.Long.prototype.toString.call(i.seq):n.longs===Number?new ai.LongBits(i.seq.low>>>0,i.seq.high>>>0).toNumber(!0):i.seq),i.raw!=null&&i.hasOwnProperty("raw")&&(s.raw=n.bytes===String?ai.base64.encode(i.raw,0,i.raw.length):n.bytes===Array?Array.prototype.slice.call(i.raw):i.raw),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,_l.util.toJSONOptions)},e}(),t}();S3e.exports=qi});var T3e=m((RDt,I3e)=>{l();"use strict";var o2=Vi(),A3e=o2.Reader,FZe=o2.Writer,KZe=o2.util,c3=o2.roots["libp2p-proto-book"]||(o2.roots["libp2p-proto-book"]={});c3.Protocols=function(){function t(e){if(this.protocols=[],e)for(var r=Object.keys(e),i=0;i<r.length;++i)e[r[i]]!=null&&(this[r[i]]=e[r[i]])}return t.prototype.protocols=KZe.emptyArray,t.encode=function(r,i){if(i||(i=FZe.create()),r.protocols!=null&&r.protocols.length)for(var n=0;n<r.protocols.length;++n)i.uint32(10).string(r.protocols[n]);return i},t.decode=function(r,i){r instanceof A3e||(r=A3e.create(r));for(var n=i===void 0?r.len:r.pos+i,s=new c3.Protocols;r.pos<n;){var o=r.uint32();switch(o>>>3){case 1:s.protocols&&s.protocols.length||(s.protocols=[]),s.protocols.push(r.string());break;default:r.skipType(o&7);break}}return s},t.fromObject=function(r){if(r instanceof c3.Protocols)return r;var i=new c3.Protocols;if(r.protocols){if(!Array.isArray(r.protocols))throw TypeError(".Protocols.protocols: array expected");i.protocols=[];for(var n=0;n<r.protocols.length;++n)i.protocols[n]=String(r.protocols[n])}return i},t.toObject=function(r,i){i||(i={});var n={};if((i.arrays||i.defaults)&&(n.protocols=[]),r.protocols&&r.protocols.length){n.protocols=[];for(var s=0;s<r.protocols.length;++s)n.protocols[s]=r.protocols[s]}return n},t.prototype.toJSON=function(){return this.constructor.toObject(this,o2.util.toJSONOptions)},t}();I3e.exports=c3});var D3e=m((PDt,k3e)=>{l();"use strict";var R3e=Ee(),rn=Object.assign(R3e("libp2p:persistent-peer-store"),{error:R3e("libp2p:persistent-peer-store:err")}),{Key:j7}=(Br(),sy),{Multiaddr:VZe}=rt(),oO=it(),{base32:zZe}=(yn(),Yu),HZe=nO(),{NAMESPACE_ADDRESS:GZe,NAMESPACE_COMMON:$Ze,NAMESPACE_KEYS:WZe,NAMESPACE_METADATA:YZe,NAMESPACE_PROTOCOL:XZe}=E3e(),{Addresses:P3e}=x3e(),{Protocols:C3e}=T3e(),O3e=class extends HZe{constructor({peerId:e,datastore:r,threshold:i=5}){super({peerId:e});this._datastore=r,this._dirtyPeers=new Set,this._dirtyMetadata=new Map,this.threshold=i,this._addDirtyPeer=this._addDirtyPeer.bind(this)}async start(){rn("PeerStore is starting"),this.on("change:protocols",this._addDirtyPeer),this.on("change:multiaddrs",this._addDirtyPeer),this.on("change:pubkey",this._addDirtyPeerKey),this.on("change:metadata",this._addDirtyPeerMetadata);for await(let e of this._datastore.query({prefix:$Ze}))await this._processDatastoreEntry(e);rn("PeerStore started")}async stop(){rn("PeerStore is stopping"),this.removeAllListeners(),await this._commitData(),rn("PeerStore stopped")}_addDirtyPeer({peerId:e}){let r=e.toB58String();rn("add dirty peer",r),this._dirtyPeers.add(r),this._dirtyPeers.size>=this.threshold&&this._commitData().catch(i=>{rn.error("error committing data",i)})}_addDirtyPeerKey({peerId:e}){if(e.hasInlinePublicKey())return;let r=e.toB58String();rn("add dirty peer key",r),this._dirtyPeers.add(r),this._dirtyPeers.size>=this.threshold&&this._commitData().catch(i=>{rn.error("error committing data",i)})}_addDirtyPeerMetadata({peerId:e,metadata:r}){let i=e.toB58String();rn("add dirty metadata peer",i),this._dirtyPeers.add(i);let n=this._dirtyMetadata.get(i)||new Set;n.add(r),this._dirtyMetadata.set(i,n),this._dirtyPeers.size>=this.threshold&&this._commitData().catch(s=>{rn.error("error committing data",s)})}async _commitData(){let e=Array.from(this._dirtyPeers);if(!e.length)return;this._dirtyPeers.clear(),rn("create batch commit");let r=this._datastore.batch();for(let i of e){let n=this.keyBook.data.get(i)||oO.createFromB58String(i);this._batchAddressBook(n,r),!n.hasInlinePublicKey()&&this._batchKeyBook(n,r),this._batchMetadataBook(n,r),this._batchProtoBook(n,r)}await r.commit(),rn("batch committed")}_batchAddressBook(e,r){let i=e.toString(),n=new j7(`${GZe}${i}`),s=this.addressBook.data.get(e.toB58String());try{if(!s){r.delete(n);return}let o=P3e.encode({addrs:s.addresses.map(a=>({multiaddr:a.multiaddr.bytes,isCertified:a.isCertified})),certifiedRecord:s.record?{seq:s.record.seqNumber,raw:s.record.raw}:void 0}).finish();r.put(n,o)}catch(o){rn.error(o)}}_batchKeyBook(e,r){let i=e.toString(),n=new j7(`${WZe}${i}`);try{if(!e.pubKey){r.delete(n);return}let s=e.marshalPubKey();r.put(n,s)}catch(s){rn.error(s)}}_batchMetadataBook(e,r){let i=e.toString(),n=this._dirtyMetadata.get(e.toB58String())||[];try{n.forEach(s=>{let o=new j7(`${YZe}${i}/${s}`),a=this.metadataBook.getValue(e,s);a?r.put(o,a):r.delete(o)})}catch(s){rn.error(s)}}_batchProtoBook(e,r){let i=e.toString(),n=new j7(`${XZe}${i}`),s=this.protoBook.get(e);try{if(!s){r.delete(n);return}let o=C3e.encode({protocols:s}).finish();r.put(n,o)}catch(o){rn.error(o)}}async _processDatastoreEntry({key:e,value:r}){try{let i=e.toString().split("/"),n=oO.createFromBytes(zZe.decode(i[3])),s;switch(i[2]){case"addrs":s=P3e.decode(r),this.addressBook._setData(n,{addresses:s.addrs.map(o=>({multiaddr:new VZe(o.multiaddr),isCertified:Boolean(o.isCertified)})),record:s.certifiedRecord?{raw:s.certifiedRecord.raw,seqNumber:s.certifiedRecord.seq}:void 0},{emit:!1});break;case"keys":s=await oO.createFromPubKey(r),this.keyBook._setData(s,s,{emit:!1});break;case"metadata":this.metadataBook._setValue(n,i[4],r,{emit:!1});break;case"protos":s=C3e.decode(r),this.protoBook._setData(n,new Set(s.protocols),{emit:!1});break;default:rn("invalid data persisted for: ",e.toString())}}catch(i){rn.error(i)}}};k3e.exports=O3e});var L3e=m((CDt,M3e)=>{l();"use strict";var B3e=Ee(),QZe=Object.assign(B3e("libp2p:registrar"),{error:B3e("libp2p:registrar:err")}),ZZe=_r(),{codes:{ERR_INVALID_PARAMETERS:JZe}}=_i(),eJe=_T(),N3e=class{constructor({peerStore:e,connectionManager:r}){this.peerStore=e,this.connectionManager=r,this.topologies=new Map,this._handle=void 0,this._onDisconnect=this._onDisconnect.bind(this),this.connectionManager.on("peer:disconnect",this._onDisconnect)}get handle(){return this._handle}set handle(e){this._handle=e}getConnection(e){return this.connectionManager.get(e)}register(e){if(!eJe.isTopology(e))throw QZe.error("topology must be an instance of interfaces/topology"),ZZe(new Error("topology must be an instance of interfaces/topology"),JZe);let r=(Math.random()*1e9).toString(36)+Date.now();return this.topologies.set(r,e),e.registrar=this,r}unregister(e){return this.topologies.delete(e)}_onDisconnect(e){for(let[,r]of this.topologies)r.disconnect(e.remotePeer)}};M3e.exports=N3e});var j3e=m((ODt,q3e)=>{l();"use strict";q3e.exports={PROTOCOL:"/ipfs/ping/1.0.0",PING_LENGTH:32,PROTOCOL_VERSION:"1.0.0",PROTOCOL_NAME:"ping"}});var V3e=m((U7,K3e)=>{l();"use strict";var U3e=Ee(),tJe=Object.assign(U3e("libp2p:ping"),{error:U3e("libp2p:ping:err")}),rJe=_r(),iJe=rc(),{pipe:F3e}=Nr(),{toBuffer:nJe}=Lv(),{collect:sJe,take:oJe}=Um(),{equals:aJe}=(wi(),bn),{PROTOCOL_NAME:aO,PING_LENGTH:cJe,PROTOCOL_VERSION:cO}=j3e();async function uJe(t,e){let r=`/${t._config.protocolPrefix}/${aO}/${cO}`;tJe("dialing %s to %s",r,e.toB58String?e.toB58String():e);let i=await t.dial(e),{stream:n}=await i.newStream(r),s=Date.now(),o=iJe.randomBytes(cJe),[a]=await F3e([o],n,u=>oJe(1,u),nJe,sJe),c=Date.now();if(!aJe(o,a))throw rJe(new Error("Received wrong ping ack"),"ERR_WRONG_PING_ACK");return c-s}function fJe(t){t.handle(`/${t._config.protocolPrefix}/${aO}/${cO}`,({stream:e})=>F3e(e,e))}function lJe(t){t.unhandle(`/${t._config.protocolPrefix}/${aO}/${cO}`)}U7=K3e.exports=uJe;U7.mount=fJe;U7.unmount=lJe});var G3e=m((kDt,H3e)=>{l();"use strict";var a2=Vi(),z3e=a2.Reader,dJe=a2.Writer,kr=a2.util,u3=a2.roots["libp2p-identify"]||(a2.roots["libp2p-identify"]={});u3.Identify=function(){function t(e){if(this.listenAddrs=[],this.protocols=[],e)for(var r=Object.keys(e),i=0;i<r.length;++i)e[r[i]]!=null&&(this[r[i]]=e[r[i]])}return t.prototype.protocolVersion="",t.prototype.agentVersion="",t.prototype.publicKey=kr.newBuffer([]),t.prototype.listenAddrs=kr.emptyArray,t.prototype.observedAddr=kr.newBuffer([]),t.prototype.protocols=kr.emptyArray,t.prototype.signedPeerRecord=kr.newBuffer([]),t.encode=function(r,i){if(i||(i=dJe.create()),r.publicKey!=null&&Object.hasOwnProperty.call(r,"publicKey")&&i.uint32(10).bytes(r.publicKey),r.listenAddrs!=null&&r.listenAddrs.length)for(var n=0;n<r.listenAddrs.length;++n)i.uint32(18).bytes(r.listenAddrs[n]);if(r.protocols!=null&&r.protocols.length)for(var n=0;n<r.protocols.length;++n)i.uint32(26).string(r.protocols[n]);return r.observedAddr!=null&&Object.hasOwnProperty.call(r,"observedAddr")&&i.uint32(34).bytes(r.observedAddr),r.protocolVersion!=null&&Object.hasOwnProperty.call(r,"protocolVersion")&&i.uint32(42).string(r.protocolVersion),r.agentVersion!=null&&Object.hasOwnProperty.call(r,"agentVersion")&&i.uint32(50).string(r.agentVersion),r.signedPeerRecord!=null&&Object.hasOwnProperty.call(r,"signedPeerRecord")&&i.uint32(66).bytes(r.signedPeerRecord),i},t.decode=function(r,i){r instanceof z3e||(r=z3e.create(r));for(var n=i===void 0?r.len:r.pos+i,s=new u3.Identify;r.pos<n;){var o=r.uint32();switch(o>>>3){case 5:s.protocolVersion=r.string();break;case 6:s.agentVersion=r.string();break;case 1:s.publicKey=r.bytes();break;case 2:s.listenAddrs&&s.listenAddrs.length||(s.listenAddrs=[]),s.listenAddrs.push(r.bytes());break;case 4:s.observedAddr=r.bytes();break;case 3:s.protocols&&s.protocols.length||(s.protocols=[]),s.protocols.push(r.string());break;case 8:s.signedPeerRecord=r.bytes();break;default:r.skipType(o&7);break}}return s},t.fromObject=function(r){if(r instanceof u3.Identify)return r;var i=new u3.Identify;if(r.protocolVersion!=null&&(i.protocolVersion=String(r.protocolVersion)),r.agentVersion!=null&&(i.agentVersion=String(r.agentVersion)),r.publicKey!=null&&(typeof r.publicKey=="string"?kr.base64.decode(r.publicKey,i.publicKey=kr.newBuffer(kr.base64.length(r.publicKey)),0):r.publicKey.length&&(i.publicKey=r.publicKey)),r.listenAddrs){if(!Array.isArray(r.listenAddrs))throw TypeError(".Identify.listenAddrs: array expected");i.listenAddrs=[];for(var n=0;n<r.listenAddrs.length;++n)typeof r.listenAddrs[n]=="string"?kr.base64.decode(r.listenAddrs[n],i.listenAddrs[n]=kr.newBuffer(kr.base64.length(r.listenAddrs[n])),0):r.listenAddrs[n].length&&(i.listenAddrs[n]=r.listenAddrs[n])}if(r.observedAddr!=null&&(typeof r.observedAddr=="string"?kr.base64.decode(r.observedAddr,i.observedAddr=kr.newBuffer(kr.base64.length(r.observedAddr)),0):r.observedAddr.length&&(i.observedAddr=r.observedAddr)),r.protocols){if(!Array.isArray(r.protocols))throw TypeError(".Identify.protocols: array expected");i.protocols=[];for(var n=0;n<r.protocols.length;++n)i.protocols[n]=String(r.protocols[n])}return r.signedPeerRecord!=null&&(typeof r.signedPeerRecord=="string"?kr.base64.decode(r.signedPeerRecord,i.signedPeerRecord=kr.newBuffer(kr.base64.length(r.signedPeerRecord)),0):r.signedPeerRecord.length&&(i.signedPeerRecord=r.signedPeerRecord)),i},t.toObject=function(r,i){i||(i={});var n={};if((i.arrays||i.defaults)&&(n.listenAddrs=[],n.protocols=[]),i.defaults&&(i.bytes===String?n.publicKey="":(n.publicKey=[],i.bytes!==Array&&(n.publicKey=kr.newBuffer(n.publicKey))),i.bytes===String?n.observedAddr="":(n.observedAddr=[],i.bytes!==Array&&(n.observedAddr=kr.newBuffer(n.observedAddr))),n.protocolVersion="",n.agentVersion="",i.bytes===String?n.signedPeerRecord="":(n.signedPeerRecord=[],i.bytes!==Array&&(n.signedPeerRecord=kr.newBuffer(n.signedPeerRecord)))),r.publicKey!=null&&r.hasOwnProperty("publicKey")&&(n.publicKey=i.bytes===String?kr.base64.encode(r.publicKey,0,r.publicKey.length):i.bytes===Array?Array.prototype.slice.call(r.publicKey):r.publicKey),r.listenAddrs&&r.listenAddrs.length){n.listenAddrs=[];for(var s=0;s<r.listenAddrs.length;++s)n.listenAddrs[s]=i.bytes===String?kr.base64.encode(r.listenAddrs[s],0,r.listenAddrs[s].length):i.bytes===Array?Array.prototype.slice.call(r.listenAddrs[s]):r.listenAddrs[s]}if(r.protocols&&r.protocols.length){n.protocols=[];for(var s=0;s<r.protocols.length;++s)n.protocols[s]=r.protocols[s]}return r.observedAddr!=null&&r.hasOwnProperty("observedAddr")&&(n.observedAddr=i.bytes===String?kr.base64.encode(r.observedAddr,0,r.observedAddr.length):i.bytes===Array?Array.prototype.slice.call(r.observedAddr):r.observedAddr),r.protocolVersion!=null&&r.hasOwnProperty("protocolVersion")&&(n.protocolVersion=r.protocolVersion),r.agentVersion!=null&&r.hasOwnProperty("agentVersion")&&(n.agentVersion=r.agentVersion),r.signedPeerRecord!=null&&r.hasOwnProperty("signedPeerRecord")&&(n.signedPeerRecord=i.bytes===String?kr.base64.encode(r.signedPeerRecord,0,r.signedPeerRecord.length):i.bytes===Array?Array.prototype.slice.call(r.signedPeerRecord):r.signedPeerRecord),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,a2.util.toJSONOptions)},t}();H3e.exports=u3});var t6e=m((DDt,e6e)=>{l();"use strict";var $3e=Ee(),Mc=Object.assign($3e("libp2p:identify"),{error:$3e("libp2p:identify:err")}),uO=_r(),F7=fa(),{pipe:K7}=Nr(),{collect:W3e,take:Y3e,consume:X3e}=Um(),{fromString:c2}=(dt(),bi),hJe=it(),{Multiaddr:fO}=rt(),{toBuffer:Q3e}=Lv(),f3=G3e(),Z3e=dm(),J3e=E7(),{MULTICODEC_IDENTIFY:pJe,MULTICODEC_IDENTIFY_PUSH:yJe,IDENTIFY_PROTOCOL_VERSION:gJe,MULTICODEC_IDENTIFY_PROTOCOL_NAME:mJe,MULTICODEC_IDENTIFY_PUSH_PROTOCOL_NAME:bJe,MULTICODEC_IDENTIFY_PROTOCOL_VERSION:vJe,MULTICODEC_IDENTIFY_PUSH_PROTOCOL_VERSION:wJe}=hC(),{codes:lO}=_i(),Th=class{static getProtocolStr(e){return{identifyProtocolStr:`/${e._config.protocolPrefix}/${mJe}/${vJe}`,identifyPushProtocolStr:`/${e._config.protocolPrefix}/${bJe}/${wJe}`}}constructor({libp2p:e}){this._libp2p=e,this.peerStore=e.peerStore,this.addressManager=e.addressManager,this.connectionManager=e.connectionManager,this.peerId=e.peerId,this.handleMessage=this.handleMessage.bind(this);let r=Th.getProtocolStr(e);this.identifyProtocolStr=r.identifyProtocolStr,this.identifyPushProtocolStr=r.identifyPushProtocolStr,this._host={protocolVersion:`${e._config.protocolPrefix}/${gJe}`,...e._options.host},this.peerStore.metadataBook.set(this.peerId,"AgentVersion",c2(this._host.agentVersion)),this.peerStore.metadataBook.set(this.peerId,"ProtocolVersion",c2(this._host.protocolVersion)),this.connectionManager.on("peer:connect",i=>{this.identify(i).catch(Mc.error)}),this.peerStore.on("change:multiaddrs",({peerId:i})=>{i.toString()===this.peerId.toString()&&this.pushToPeerStore()}),this.peerStore.on("change:protocols",({peerId:i})=>{i.toString()===this.peerId.toString()&&this.pushToPeerStore()})}async push(e){let r=await this.peerStore.addressBook.getRawEnvelope(this.peerId),i=this._libp2p.multiaddrs.map(o=>o.bytes),n=this.peerStore.protoBook.get(this.peerId)||[],s=e.map(async o=>{try{let{stream:a}=await o.newStream(this.identifyPushProtocolStr);await K7([f3.Identify.encode({listenAddrs:i,signedPeerRecord:r,protocols:n}).finish()],F7.encode(),a,X3e)}catch(a){Mc.error("could not push identify update to peer",a)}});return Promise.all(s)}pushToPeerStore(){if(!this._libp2p.isStarted())return;let e=[],r;for(let i of this.peerStore.peers.values())i.protocols.includes(this.identifyPushProtocolStr)&&(r=this.connectionManager.get(i.id))&&e.push(r);this.push(e)}async identify(e){let{stream:r}=await e.newStream(this.identifyProtocolStr),[i]=await K7([],r,F7.decode(),Y3e(1),Q3e,W3e);if(!i)throw uO(new Error("No data could be retrieved"),lO.ERR_CONNECTION_ENDED);let n;try{n=f3.Identify.decode(i)}catch(h){throw uO(h,lO.ERR_INVALID_MESSAGE)}let{publicKey:s,listenAddrs:o,protocols:a,observedAddr:c,signedPeerRecord:u}=n,f=await hJe.createFromPubKey(s);if(e.remotePeer.toB58String()!==f.toB58String())throw uO(new Error("identified peer does not match the expected peer"),lO.ERR_INVALID_PEER);let d=Th.getCleanMultiaddr(c);try{let h=await Z3e.openAndCertify(u,J3e.DOMAIN);if(this.peerStore.addressBook.consumePeerRecord(h)){this.peerStore.protoBook.set(f,a),this.peerStore.metadataBook.set(f,"AgentVersion",c2(n.agentVersion)),this.peerStore.metadataBook.set(f,"ProtocolVersion",c2(n.protocolVersion));return}}catch(h){Mc("received invalid envelope, discard it and fallback to listenAddrs is available",h)}try{this.peerStore.addressBook.set(f,o.map(h=>new fO(h)))}catch(h){Mc.error("received invalid addrs",h)}this.peerStore.protoBook.set(f,a),this.peerStore.metadataBook.set(f,"AgentVersion",c2(n.agentVersion)),this.peerStore.metadataBook.set(f,"ProtocolVersion",c2(n.protocolVersion)),Mc("received observed address of %s",d)}handleMessage({connection:e,stream:r,protocol:i}){switch(i){case this.identifyProtocolStr:return this._handleIdentify({connection:e,stream:r});case this.identifyPushProtocolStr:return this._handlePush({connection:e,stream:r});default:Mc.error("cannot handle unknown protocol %s",i)}}async _handleIdentify({connection:e,stream:r}){let i=new Uint8Array(0);this.peerId.pubKey&&(i=this.peerId.pubKey.bytes);let n=await this.peerStore.addressBook.getRawEnvelope(this.peerId),s=this.peerStore.protoBook.get(this.peerId)||[],o=f3.Identify.encode({protocolVersion:this._host.protocolVersion,agentVersion:this._host.agentVersion,publicKey:i,listenAddrs:this._libp2p.multiaddrs.map(a=>a.bytes),signedPeerRecord:n,observedAddr:e.remoteAddr.bytes,protocols:s}).finish();try{await K7([o],F7.encode(),r,X3e)}catch(a){Mc.error("could not respond to identify request",a)}}async _handlePush({connection:e,stream:r}){let i;try{let[s]=await K7([],r,F7.decode(),Y3e(1),Q3e,W3e);i=f3.Identify.decode(s)}catch(s){return Mc.error("received invalid message",s)}let n=e.remotePeer;try{let s=await Z3e.openAndCertify(i.signedPeerRecord,J3e.DOMAIN);if(this.peerStore.addressBook.consumePeerRecord(s)){this.peerStore.protoBook.set(n,i.protocols);return}}catch(s){Mc("received invalid envelope, discard it and fallback to listenAddrs is available",s)}try{this.peerStore.addressBook.set(n,i.listenAddrs.map(s=>new fO(s)))}catch(s){Mc.error("received invalid addrs",s)}this.peerStore.protoBook.set(n,i.protocols)}static getCleanMultiaddr(e){if(e&&e.length>0)try{return new fO(e)}catch(r){return null}return null}},_Je={IDENTIFY:pJe,IDENTIFY_PUSH:yJe};Th.multicodecs=_Je;Th.Messsage=f3;e6e.exports=Th});var r6e=m(()=>{l()});var i6e=m(dO=>{l();"use strict";Object.defineProperty(dO,"__esModule",{value:!0}),dO.promisify=V7;var EJe="__ES6-PROMISIFY--CUSTOM-ARGUMENTS__";function V7(t){if(typeof t!="function")throw new TypeError("Argument to promisify must be a function");var e=t[EJe],r=V7.Promise||Promise;if(typeof r!="function")throw new Error("No Promise implementation found; do you need a polyfill?");return function(){for(var i=this,n=arguments.length,s=Array(n),o=0;o<n;o++)s[o]=arguments[o];return new r(function(a,c){s.push(function(u){if(u)return c(u);for(var f=arguments.length,d=Array(1<f?f-1:0),h=1;h<f;h++)d[h-1]=arguments[h];if(d.length===1||!e)return a(d[0]);var p={};d.forEach(function(y,b){var E=e[b];E&&(p[E]=y)}),a(p)}),t.apply(i,s)})}}V7.argumentNames="__ES6-PROMISIFY--CUSTOM-ARGUMENTS__",V7.Promise=void 0});var s6e=m((LDt,n6e)=>{l();"use strict";var SJe=gw(),z7=typeof window=="object"&&typeof document=="object"&&document.nodeType===9,l3=SJe(),xJe=z7&&!l3,AJe=l3&&!z7,IJe=l3&&z7,TJe=typeof Ea=="function"&&typeof process!="undefined"&&typeof process.release!="undefined"&&process.release.name==="node"&&!l3,RJe=typeof importScripts=="function"&&typeof self!="undefined"&&typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope,PJe=typeof process!="undefined"&&typeof process.env!="undefined"&&!1;n6e.exports={isTest:PJe,isElectron:l3,isElectronMain:AJe,isElectronRenderer:IJe,isNode:TJe,isBrowser:xJe,isWebWorker:RJe,isEnvWithDom:z7}});var a6e=m((qDt,o6e)=>{l();function Po(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}o6e.exports=Po;Po.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};Po.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};Po.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),r=this._cachedTimeouts.slice(-1);else return!1;var i=this;return this._timer=setTimeout(function(){i._attempts++,i._operationTimeoutCb&&(i._timeout=setTimeout(function(){i._operationTimeoutCb(i._attempts)},i._operationTimeout),i._options.unref&&i._timeout.unref()),i._fn(i._attempts)},r),this._options.unref&&this._timer.unref(),!0};Po.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};Po.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};Po.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};Po.prototype.start=Po.prototype.try;Po.prototype.errors=function(){return this._errors};Po.prototype.attempts=function(){return this._attempts};Po.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,r=0,i=0;i<this._errors.length;i++){var n=this._errors[i],s=n.message,o=(t[s]||0)+1;t[s]=o,o>=r&&(e=n,r=o)}return e}});var c6e=m(Rh=>{l();var CJe=a6e();Rh.operation=function(t){var e=Rh.timeouts(t);return new CJe(e,{forever:t&&(t.forever||t.retries===1/0),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};Rh.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var i=[],n=0;n<e.retries;n++)i.push(this.createTimeout(n,e));return t&&t.forever&&!i.length&&i.push(this.createTimeout(n,e)),i.sort(function(s,o){return s-o}),i};Rh.createTimeout=function(t,e){var r=e.randomize?Math.random()+1:1,i=Math.round(r*Math.max(e.minTimeout,1)*Math.pow(e.factor,t));return i=Math.min(i,e.maxTimeout),i};Rh.wrap=function(t,e,r){if(e instanceof Array&&(r=e,e=null),!r){r=[];for(var i in t)typeof t[i]=="function"&&r.push(i)}for(var n=0;n<r.length;n++){var s=r[n],o=t[s];t[s]=function(c){var u=Rh.operation(e),f=Array.prototype.slice.call(arguments,1),d=f.pop();f.push(function(h){u.retry(h)||(h&&(arguments[0]=u.mainError()),d.apply(this,arguments))}),u.attempt(function(){c.apply(t,f)})}.bind(t,o),t[s].options=e}}});var f6e=m((UDt,u6e)=>{l();u6e.exports=c6e()});var d6e=m((FDt,H7)=>{l();"use strict";var OJe=f6e(),kJe=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"],hO=class extends Error{constructor(e){super();e instanceof Error?(this.originalError=e,{message:e}=e):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}},DJe=(t,e,r)=>{let i=r.retries-(e-1);return t.attemptNumber=e,t.retriesLeft=i,t},BJe=t=>kJe.includes(t),l6e=(t,e)=>new Promise((r,i)=>{e={onFailedAttempt:()=>{},retries:10,...e};let n=OJe.operation(e);n.attempt(async s=>{try{r(await t(s))}catch(o){if(!(o instanceof Error)){i(new TypeError(`Non-error was thrown: "${o}". You should only throw errors.`));return}if(o instanceof hO)n.stop(),i(o.originalError);else if(o instanceof TypeError&&!BJe(o.message))n.stop(),i(o);else{DJe(o,s,e);try{await e.onFailedAttempt(o)}catch(a){i(a);return}n.retry(o)||i(n.mainError())}}})});H7.exports=l6e;H7.exports.default=l6e;H7.exports.AbortError=hO});var p6e=m((KDt,h6e)=>{l();"use strict";function NJe(t){return/^127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(t)||/^::1$/.test(t)}h6e.exports=NJe});var g6e=m((VDt,y6e)=>{l();"use strict";var MJe=p6e();function LJe(t){let{address:e}=t.nodeAddress();return MJe(e)}y6e.exports=LJe});var E6e=m((zDt,_6e)=>{l();"use strict";var qJe=r6e(),m6e=Ee(),{promisify:pO}=i6e(),{Multiaddr:jJe}=rt(),u2=Object.assign(m6e("libp2p:nat"),{error:m6e("libp2p:nat:err")}),{isBrowser:b6e}=s6e(),yO=d6e(),UJe=pC(),v6e=dC(),FJe=_r(),{codes:{ERR_INVALID_PARAMETERS:KJe}}=_i(),VJe=g6e(),gO=7200;function zJe(t=1024,e=65535){return Math.floor(Math.random()*(e-t+1)+t)}var w6e=class{constructor({peerId:e,addressManager:r,transportManager:i,...n}){if(this._peerId=e,this._addressManager=r,this._transportManager=i,this._enabled=n.enabled,this._externalIp=n.externalIp,this._options={description:n.description||`${v6e.name}@${v6e.version} ${this._peerId}`,ttl:n.ttl||gO,autoUpdate:n.keepAlive||!0,gateway:n.gateway,enablePMP:Boolean(n.pmp&&n.pmp.enabled)},this._options.ttl<gO)throw FJe(new Error(`NatManager ttl should be at least ${gO} seconds`),KJe)}start(){b6e||!this._enabled||this._start().catch(e=>{u2.error(e)})}async _start(){let e=this._transportManager.getAddrs();for(let r of e){let{family:i,host:n,port:s,transport:o}=r.toOptions();if(!r.isThinWaistAddress()||o!=="tcp"||VJe(r)||i!==4)continue;let a=this._getClient(),c=this._externalIp||await a.externalIp();if(UJe(c))throw new Error(`${c} is private - please set config.nat.externalIp to an externally routable IP or ensure you are not behind a double NAT`);let u=zJe();u2(`opening uPnP connection from ${c}:${u} to ${n}:${s}`),await a.map({publicPort:u,privatePort:s,protocol:o.toUpperCase()}),this._addressManager.addObservedAddr(jJe.fromNodeAddress({family:4,address:c,port:u},o))}}_getClient(){if(this._client)return this._client;let e=new qJe(this._options),r=pO(e.map.bind(e)),i=pO(e.destroy.bind(e)),n=pO(e.externalIp.bind(e));return this._client={map:(...s)=>yO(()=>r(...s),{onFailedAttempt:u2.error,unref:!0}),destroy:(...s)=>yO(()=>i(...s),{onFailedAttempt:u2.error,unref:!0}),externalIp:(...s)=>yO(()=>n(...s),{onFailedAttempt:u2.error,unref:!0})},this._client}async stop(){if(!(b6e||!this._client))try{await this._client.destroy(),this._client=null}catch(e){u2.error(e)}}};_6e.exports=w6e});var R6e=m((HDt,T6e)=>{l();"use strict";var S6e=Ee(),Ns=Object.assign(S6e("libp2p"),{error:S6e("libp2p:err")}),{EventEmitter:HJe}=br(),mO=_r(),GJe=it(),{Multiaddr:$Je}=rt(),WJe=F1e(),YJe=z1e(),bO=lC(),{validate:XJe}=V2e(),{codes:G7,messages:QJe}=_i(),ZJe=G2e(),JJe=cye(),x6e=Lye(),eet=Xye(),tet=hge(),A6e=Jge(),ret=dme(),iet=EC(),net=Gme(),set=nO(),oet=_3e(),aet=D3e(),cet=L3e(),$7=V3e(),I6e=t6e(),uet=E6e(),{updateSelfPeerRecord:fet}=wC(),d3=class extends HJe{static async create(e){if(e.peerId)return new d3(e);let r=await GJe.create();return e.peerId=r,new d3(e)}constructor(e){super();if(this._options=XJe(e),this.peerId=this._options.peerId,this.datastore=this._options.datastore,this.peerStore=this.datastore&&this._options.peerStore.persistence?new aet({peerId:this.peerId,datastore:this.datastore,...this._options.peerStore}):new set({peerId:this.peerId}),this.addresses=this._options.addresses,this.addressManager=new ZJe(this.peerId,this._options.addresses),this.addressManager.on("change:addresses",()=>{fet(this).catch(i=>{Ns.error("Error updating self peer record",i)})}),this._modules=this._options.modules,this._config=this._options.config,this._transport=[],this._discovery=new Map,this.connectionManager=new JJe(this,{autoDial:this._config.peerDiscovery.autoDial,...this._options.connectionManager}),this._options.metrics.enabled&&(this.metrics=new ret({...this._options.metrics,connectionManager:this.connectionManager})),this._options.keychain&&this._options.keychain.datastore){Ns("creating keychain");let i=A6e.generateOptions();this.keychain=new A6e(this._options.keychain.datastore,{...i,...this._options.keychain}),Ns("keychain constructed")}if(this.upgrader=new net({localPeer:this.peerId,metrics:this.metrics,onConnection:i=>this.connectionManager.onConnect(i),onConnectionEnd:i=>this.connectionManager.onDisconnect(i)}),this.transportManager=new iet({libp2p:this,upgrader:this.upgrader,faultTolerance:this._options.transportManager.faultTolerance}),this.natManager=new uet({peerId:this.peerId,addressManager:this.addressManager,transportManager:this.transportManager,...this._options.config.nat}),this.registrar=new cet({peerStore:this.peerStore,connectionManager:this.connectionManager}),this.handle=this.handle.bind(this),this.registrar.handle=this.handle,!this._modules.connEncryption||!this._modules.connEncryption.length)throw mO(new Error(QJe.CONN_ENCRYPTION_REQUIRED),G7.CONN_ENCRYPTION_REQUIRED);if(this._modules.connEncryption.forEach(i=>{this.upgrader.cryptos.set(i.protocol,i)}),this.dialer=new tet({transportManager:this.transportManager,peerStore:this.peerStore,...this._options.dialer}),this._modules.transport.forEach(i=>{let n=i.prototype[Symbol.toStringTag],s=this._config.transport[n];this.transportManager.add(n,i,s)}),this._config.relay.enabled&&(this.transportManager.add(x6e.prototype[Symbol.toStringTag],x6e),this.relay=new eet(this)),this._modules.streamMuxer&&(this._modules.streamMuxer.forEach(n=>{this.upgrader.muxers.set(n.multicodec,n)}),this.identifyService=new I6e({libp2p:this}),this.handle(Object.values(I6e.getProtocolStr(this)),this.identifyService.handleMessage)),this._modules.connProtector)this.upgrader.protector=this._modules.connProtector;else if(globalThis.process!==void 0&&globalThis.process.env&&globalThis.process.env.LIBP2P_FORCE_PNET)throw new Error("Private network is enforced, but no protector was provided");if(this._modules.dht){let i=this._modules.dht;this._dht=new i({libp2p:this,dialer:this.dialer,peerId:this.peerId,peerStore:this.peerStore,registrar:this.registrar,datastore:this.datastore,...this._config.dht})}if(this._modules.pubsub){let i=this._modules.pubsub;this.pubsub=oet(i,this,this._config.pubsub)}this.peerRouting=new WJe(this),this.contentRouting=new YJe(this),$7.mount(this),this._onDiscoveryPeer=this._onDiscoveryPeer.bind(this)}emit(e,...r){return e==="error"&&!this._events.error?(Ns.error(r),!1):super.emit(e,...r)}async start(){Ns("libp2p is starting");try{await this._onStarting(),await this._onDidStart(),Ns("libp2p has started")}catch(e){throw this.emit("error",e),Ns.error("An error occurred starting libp2p",e),await this.stop(),e}}async stop(){Ns("libp2p is stopping");try{this._isStarted=!1,this.relay&&this.relay.stop(),this.peerRouting.stop();for(let e of this._discovery.values())e.removeListener("peer",this._onDiscoveryPeer);await Promise.all(Array.from(this._discovery.values(),e=>e.stop())),this._discovery=new Map,await this.peerStore.stop(),await this.connectionManager.stop(),await Promise.all([this.pubsub&&this.pubsub.stop(),this._dht&&this._dht.stop(),this.metrics&&this.metrics.stop()]),await this.natManager.stop(),await this.transportManager.close(),$7.unmount(this),this.dialer.destroy()}catch(e){e&&(Ns.error(e),this.emit("error",e))}Ns("libp2p has stopped")}async loadKeychain(){if(!!this.keychain)try{await this.keychain.findKeyByName("self")}catch(e){await this.keychain.importPeer("self",this.peerId)}}isStarted(){return this._isStarted}get connections(){return this.connectionManager.connections}dial(e,r){return this._dial(e,r)}async dialProtocol(e,r,i){if(!r||!r.length)throw mO(new Error("no protocols were provided to open a stream"),G7.ERR_INVALID_PROTOCOLS_FOR_STREAM);return(await this._dial(e,i)).newStream(r)}async _dial(e,r){let{id:i,multiaddrs:n}=bO(e);if(i.equals(this.peerId))throw mO(new Error("Cannot dial self"),G7.ERR_DIALED_SELF);let s=this.connectionManager.get(i);return s?n&&this.peerStore.addressBook.add(i,n):s=await this.dialer.connectToPeer(e,r),s}get multiaddrs(){let e=this.addressManager.getAnnounceAddrs().map(n=>n.toString());e.length||(e=this.transportManager.getAddrs().map(n=>n.toString())),e=e.concat(this.addressManager.getObservedAddrs().map(n=>n.toString()));let r=this._options.addresses.announceFilter,i=new Set(e);return r(Array.from(i).map(n=>new $Je(n)))}async hangUp(e){let{id:r}=bO(e),i=this.connectionManager.connections.get(r.toB58String());!i||await Promise.all(i.map(n=>n.close()))}ping(e){let{id:r,multiaddrs:i}=bO(e);return i?$7(this,i[0]):$7(this,r)}handle(e,r){e=Array.isArray(e)?e:[e],e.forEach(i=>{this.upgrader.protocols.set(i,r)}),this.peerStore.protoBook.add(this.peerId,e)}unhandle(e){e=Array.isArray(e)?e:[e],e.forEach(r=>{this.upgrader.protocols.delete(r)}),this.peerStore.protoBook.remove(this.peerId,e)}async _onStarting(){let e=this.addressManager.getListenAddrs();await this.transportManager.listen(e),this.natManager.start(),await this.peerStore.start(),this._config.pubsub.enabled&&this.pubsub&&this.pubsub.start(),this._config.dht.enabled&&(this._dht&&this._dht.start(),this._dht.on("peer",this._onDiscoveryPeer)),this.metrics&&this.metrics.start()}async _onDidStart(){this._isStarted=!0,this.peerStore.on("peer",e=>{this.emit("peer:discovery",e),this._maybeConnect(e)});for(let e of this.peerStore.peers.values())this.emit("peer:discovery",e.id);this.connectionManager.start(),await this._setupPeerDiscovery(),this.relay&&this.relay.start(),this.peerRouting.start()}_onDiscoveryPeer(e){if(e.id.toB58String()===this.peerId.toB58String()){Ns.error(new Error(G7.ERR_DISCOVERED_SELF));return}e.multiaddrs&&this.peerStore.addressBook.add(e.id,e.multiaddrs),e.protocols&&this.peerStore.protoBook.set(e.id,e.protocols)}async _maybeConnect(e){if(this._config.peerDiscovery.autoDial===!0&&!this.connectionManager.get(e)&&(this._options.connectionManager.minConnections||0)>this.connectionManager.size){Ns("connecting to discovered peer %s",e.toB58String());try{await this.dialer.connectToPeer(e)}catch(i){Ns.error(`could not connect to discovered peer ${e.toB58String()} with ${i}`)}}}async _setupPeerDiscovery(){let e=r=>{let i={enabled:!0};if(r.tag&&this._config.peerDiscovery&&this._config.peerDiscovery[r.tag]&&(i={...i,...this._config.peerDiscovery[r.tag]}),i.enabled&&!this._discovery.has(r.tag)){let n;typeof r=="function"?n=new r(Object.assign({},i,{peerId:this.peerId,libp2p:this})):n=r,n.on("peer",this._onDiscoveryPeer),this._discovery.set(r.tag,n)}};for(let r of this._modules.peerDiscovery||[])e(r);for(let r of this.transportManager.getTransports())r.discovery&&e(r.discovery);await Promise.all(Array.from(this._discovery.values(),r=>r.start()))}};T6e.exports=d3});var K6e=m((cBt,F6e)=>{l();F6e.exports=U6e;var j6e=128,wet=127,_et=~wet,Eet=Math.pow(2,31);function U6e(t,e,r){e=e||[],r=r||0;for(var i=r;t>=Eet;)e[r++]=t&255|j6e,t/=128;for(;t&_et;)e[r++]=t&255|j6e,t>>>=7;return e[r]=t|0,U6e.bytes=r-i+1,e}});var H6e=m((uBt,z6e)=>{l();z6e.exports=vO;var xet=128,V6e=127;function vO(t,e){var r=0,e=e||0,i=0,n=e,s,o=t.length;do{if(n>=o)throw vO.bytes=0,new RangeError("Could not decode varint");s=t[n++],r+=i<28?(s&V6e)<<i:(s&V6e)*Math.pow(2,i),i+=7}while(s>=xet);return vO.bytes=n-e,r}});var $6e=m((fBt,G6e)=>{l();var Aet=Math.pow(2,7),Iet=Math.pow(2,14),Tet=Math.pow(2,21),Ret=Math.pow(2,28),Pet=Math.pow(2,35),Cet=Math.pow(2,42),Oet=Math.pow(2,49),ket=Math.pow(2,56),Det=Math.pow(2,63);G6e.exports=function(t){return t<Aet?1:t<Iet?2:t<Tet?3:t<Ret?4:t<Pet?5:t<Cet?6:t<Oet?7:t<ket?8:t<Det?9:10}});var Y6e=m((lBt,W6e)=>{l();W6e.exports={encode:K6e(),decode:H6e(),encodingLength:$6e()}});var Z6e=m((dBt,Q6e)=>{l();"use strict";var X6e=Y6e();Q6e.exports=t=>{if(!(t instanceof Uint8Array))throw new Error("arg needs to be a Uint8Array");let e=[];for(;t.length>0;){let r=X6e.decode(t);e.push(r),t=t.slice(X6e.decode.bytes)}return e}});var r4e=m((IBt,t4e)=>{l();"use strict";function e4e(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function Met(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return e4e(t,r)}catch(i){r.message=t.message,r.stack=t.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(t)),e4e(new n,r)}}t4e.exports=Met});var l4e=m((qBt,f4e)=>{l();f4e.exports=Let;function Let(t,e,r){var i=null,n=null,s=function(){i&&(clearTimeout(i),n=null,i=null)},o=function(){var c=n;s(),c&&c()},a=function(){if(!e)return t.apply(this,arguments);var c=this,u=arguments,f=r&&!i;if(s(),n=function(){t.apply(c,u)},i=setTimeout(function(){if(i=null,!f){var d=n;return n=null,d()}},e),f)return n()};return a.cancel=s,a.flush=o,a}});var R4e=m((DNt,T4e)=>{l();"use strict";function I4e(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function zet(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return I4e(t,r)}catch(i){r.message=t.message,r.stack=t.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(t)),I4e(new n,r)}}T4e.exports=zet});var ott={};zt(ott,{CID:()=>ett,PeerId:()=>rtt,create:()=>Qet,crypto:()=>Zet,globSource:()=>itt,isIPFS:()=>Jet,multiaddr:()=>ttt,path:()=>stt,urlSource:()=>ntt});l();l();l();l();var Pk=M(Al()),Tt=Pk.default;var G4e=M(P2()),$4e=M(Ee()),HO=M(Rt());l();var H3=M(jk());l();var Vc=M(Vi()),Kh=Vc.default.Reader,Ow=Vc.default.Writer,Qe=Vc.default.util,nn=Vc.default.roots["ipfs-unixfs"]||(Vc.default.roots["ipfs-unixfs"]={}),MD=nn.Data=(()=>{function t(e){if(this.blocksizes=[],e)for(var r=Object.keys(e),i=0;i<r.length;++i)e[r[i]]!=null&&(this[r[i]]=e[r[i]])}return t.prototype.Type=0,t.prototype.Data=Qe.newBuffer([]),t.prototype.filesize=Qe.Long?Qe.Long.fromBits(0,0,!0):0,t.prototype.blocksizes=Qe.emptyArray,t.prototype.hashType=Qe.Long?Qe.Long.fromBits(0,0,!0):0,t.prototype.fanout=Qe.Long?Qe.Long.fromBits(0,0,!0):0,t.prototype.mode=0,t.prototype.mtime=null,t.encode=function(r,i){if(i||(i=Ow.create()),i.uint32(8).int32(r.Type),r.Data!=null&&Object.hasOwnProperty.call(r,"Data")&&i.uint32(18).bytes(r.Data),r.filesize!=null&&Object.hasOwnProperty.call(r,"filesize")&&i.uint32(24).uint64(r.filesize),r.blocksizes!=null&&r.blocksizes.length)for(var n=0;n<r.blocksizes.length;++n)i.uint32(32).uint64(r.blocksizes[n]);return r.hashType!=null&&Object.hasOwnProperty.call(r,"hashType")&&i.uint32(40).uint64(r.hashType),r.fanout!=null&&Object.hasOwnProperty.call(r,"fanout")&&i.uint32(48).uint64(r.fanout),r.mode!=null&&Object.hasOwnProperty.call(r,"mode")&&i.uint32(56).uint32(r.mode),r.mtime!=null&&Object.hasOwnProperty.call(r,"mtime")&&nn.UnixTime.encode(r.mtime,i.uint32(66).fork()).ldelim(),i},t.decode=function(r,i){r instanceof Kh||(r=Kh.create(r));for(var n=i===void 0?r.len:r.pos+i,s=new nn.Data;r.pos<n;){var o=r.uint32();switch(o>>>3){case 1:s.Type=r.int32();break;case 2:s.Data=r.bytes();break;case 3:s.filesize=r.uint64();break;case 4:if(s.blocksizes&&s.blocksizes.length||(s.blocksizes=[]),(o&7)==2)for(var a=r.uint32()+r.pos;r.pos<a;)s.blocksizes.push(r.uint64());else s.blocksizes.push(r.uint64());break;case 5:s.hashType=r.uint64();break;case 6:s.fanout=r.uint64();break;case 7:s.mode=r.uint32();break;case 8:s.mtime=nn.UnixTime.decode(r,r.uint32());break;default:r.skipType(o&7);break}}if(!s.hasOwnProperty("Type"))throw Qe.ProtocolError("missing required 'Type'",{instance:s});return s},t.fromObject=function(r){if(r instanceof nn.Data)return r;var i=new nn.Data;switch(r.Type){case"Raw":case 0:i.Type=0;break;case"Directory":case 1:i.Type=1;break;case"File":case 2:i.Type=2;break;case"Metadata":case 3:i.Type=3;break;case"Symlink":case 4:i.Type=4;break;case"HAMTShard":case 5:i.Type=5;break}if(r.Data!=null&&(typeof r.Data=="string"?Qe.base64.decode(r.Data,i.Data=Qe.newBuffer(Qe.base64.length(r.Data)),0):r.Data.length&&(i.Data=r.Data)),r.filesize!=null&&(Qe.Long?(i.filesize=Qe.Long.fromValue(r.filesize)).unsigned=!0:typeof r.filesize=="string"?i.filesize=parseInt(r.filesize,10):typeof r.filesize=="number"?i.filesize=r.filesize:typeof r.filesize=="object"&&(i.filesize=new Qe.LongBits(r.filesize.low>>>0,r.filesize.high>>>0).toNumber(!0))),r.blocksizes){if(!Array.isArray(r.blocksizes))throw TypeError(".Data.blocksizes: array expected");i.blocksizes=[];for(var n=0;n<r.blocksizes.length;++n)Qe.Long?(i.blocksizes[n]=Qe.Long.fromValue(r.blocksizes[n])).unsigned=!0:typeof r.blocksizes[n]=="string"?i.blocksizes[n]=parseInt(r.blocksizes[n],10):typeof r.blocksizes[n]=="number"?i.blocksizes[n]=r.blocksizes[n]:typeof r.blocksizes[n]=="object"&&(i.blocksizes[n]=new Qe.LongBits(r.blocksizes[n].low>>>0,r.blocksizes[n].high>>>0).toNumber(!0))}if(r.hashType!=null&&(Qe.Long?(i.hashType=Qe.Long.fromValue(r.hashType)).unsigned=!0:typeof r.hashType=="string"?i.hashType=parseInt(r.hashType,10):typeof r.hashType=="number"?i.hashType=r.hashType:typeof r.hashType=="object"&&(i.hashType=new Qe.LongBits(r.hashType.low>>>0,r.hashType.high>>>0).toNumber(!0))),r.fanout!=null&&(Qe.Long?(i.fanout=Qe.Long.fromValue(r.fanout)).unsigned=!0:typeof r.fanout=="string"?i.fanout=parseInt(r.fanout,10):typeof r.fanout=="number"?i.fanout=r.fanout:typeof r.fanout=="object"&&(i.fanout=new Qe.LongBits(r.fanout.low>>>0,r.fanout.high>>>0).toNumber(!0))),r.mode!=null&&(i.mode=r.mode>>>0),r.mtime!=null){if(typeof r.mtime!="object")throw TypeError(".Data.mtime: object expected");i.mtime=nn.UnixTime.fromObject(r.mtime)}return i},t.toObject=function(r,i){i||(i={});var n={};if((i.arrays||i.defaults)&&(n.blocksizes=[]),i.defaults){if(n.Type=i.enums===String?"Raw":0,i.bytes===String?n.Data="":(n.Data=[],i.bytes!==Array&&(n.Data=Qe.newBuffer(n.Data))),Qe.Long){var s=new Qe.Long(0,0,!0);n.filesize=i.longs===String?s.toString():i.longs===Number?s.toNumber():s}else n.filesize=i.longs===String?"0":0;if(Qe.Long){var s=new Qe.Long(0,0,!0);n.hashType=i.longs===String?s.toString():i.longs===Number?s.toNumber():s}else n.hashType=i.longs===String?"0":0;if(Qe.Long){var s=new Qe.Long(0,0,!0);n.fanout=i.longs===String?s.toString():i.longs===Number?s.toNumber():s}else n.fanout=i.longs===String?"0":0;n.mode=0,n.mtime=null}if(r.Type!=null&&r.hasOwnProperty("Type")&&(n.Type=i.enums===String?nn.Data.DataType[r.Type]:r.Type),r.Data!=null&&r.hasOwnProperty("Data")&&(n.Data=i.bytes===String?Qe.base64.encode(r.Data,0,r.Data.length):i.bytes===Array?Array.prototype.slice.call(r.Data):r.Data),r.filesize!=null&&r.hasOwnProperty("filesize")&&(typeof r.filesize=="number"?n.filesize=i.longs===String?String(r.filesize):r.filesize:n.filesize=i.longs===String?Qe.Long.prototype.toString.call(r.filesize):i.longs===Number?new Qe.LongBits(r.filesize.low>>>0,r.filesize.high>>>0).toNumber(!0):r.filesize),r.blocksizes&&r.blocksizes.length){n.blocksizes=[];for(var o=0;o<r.blocksizes.length;++o)typeof r.blocksizes[o]=="number"?n.blocksizes[o]=i.longs===String?String(r.blocksizes[o]):r.blocksizes[o]:n.blocksizes[o]=i.longs===String?Qe.Long.prototype.toString.call(r.blocksizes[o]):i.longs===Number?new Qe.LongBits(r.blocksizes[o].low>>>0,r.blocksizes[o].high>>>0).toNumber(!0):r.blocksizes[o]}return r.hashType!=null&&r.hasOwnProperty("hashType")&&(typeof r.hashType=="number"?n.hashType=i.longs===String?String(r.hashType):r.hashType:n.hashType=i.longs===String?Qe.Long.prototype.toString.call(r.hashType):i.longs===Number?new Qe.LongBits(r.hashType.low>>>0,r.hashType.high>>>0).toNumber(!0):r.hashType),r.fanout!=null&&r.hasOwnProperty("fanout")&&(typeof r.fanout=="number"?n.fanout=i.longs===String?String(r.fanout):r.fanout:n.fanout=i.longs===String?Qe.Long.prototype.toString.call(r.fanout):i.longs===Number?new Qe.LongBits(r.fanout.low>>>0,r.fanout.high>>>0).toNumber(!0):r.fanout),r.mode!=null&&r.hasOwnProperty("mode")&&(n.mode=r.mode),r.mtime!=null&&r.hasOwnProperty("mtime")&&(n.mtime=nn.UnixTime.toObject(r.mtime,i)),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,Vc.default.util.toJSONOptions)},t.DataType=function(){let e={},r=Object.create(e);return r[e[0]="Raw"]=0,r[e[1]="Directory"]=1,r[e[2]="File"]=2,r[e[3]="Metadata"]=3,r[e[4]="Symlink"]=4,r[e[5]="HAMTShard"]=5,r}(),t})(),jtt=nn.UnixTime=(()=>{function t(e){if(e)for(var r=Object.keys(e),i=0;i<r.length;++i)e[r[i]]!=null&&(this[r[i]]=e[r[i]])}return t.prototype.Seconds=Qe.Long?Qe.Long.fromBits(0,0,!1):0,t.prototype.FractionalNanoseconds=0,t.encode=function(r,i){return i||(i=Ow.create()),i.uint32(8).int64(r.Seconds),r.FractionalNanoseconds!=null&&Object.hasOwnProperty.call(r,"FractionalNanoseconds")&&i.uint32(21).fixed32(r.FractionalNanoseconds),i},t.decode=function(r,i){r instanceof Kh||(r=Kh.create(r));for(var n=i===void 0?r.len:r.pos+i,s=new nn.UnixTime;r.pos<n;){var o=r.uint32();switch(o>>>3){case 1:s.Seconds=r.int64();break;case 2:s.FractionalNanoseconds=r.fixed32();break;default:r.skipType(o&7);break}}if(!s.hasOwnProperty("Seconds"))throw Qe.ProtocolError("missing required 'Seconds'",{instance:s});return s},t.fromObject=function(r){if(r instanceof nn.UnixTime)return r;var i=new nn.UnixTime;return r.Seconds!=null&&(Qe.Long?(i.Seconds=Qe.Long.fromValue(r.Seconds)).unsigned=!1:typeof r.Seconds=="string"?i.Seconds=parseInt(r.Seconds,10):typeof r.Seconds=="number"?i.Seconds=r.Seconds:typeof r.Seconds=="object"&&(i.Seconds=new Qe.LongBits(r.Seconds.low>>>0,r.Seconds.high>>>0).toNumber())),r.FractionalNanoseconds!=null&&(i.FractionalNanoseconds=r.FractionalNanoseconds>>>0),i},t.toObject=function(r,i){i||(i={});var n={};if(i.defaults){if(Qe.Long){var s=new Qe.Long(0,0,!1);n.Seconds=i.longs===String?s.toString():i.longs===Number?s.toNumber():s}else n.Seconds=i.longs===String?"0":0;n.FractionalNanoseconds=0}return r.Seconds!=null&&r.hasOwnProperty("Seconds")&&(typeof r.Seconds=="number"?n.Seconds=i.longs===String?String(r.Seconds):r.Seconds:n.Seconds=i.longs===String?Qe.Long.prototype.toString.call(r.Seconds):i.longs===Number?new Qe.LongBits(r.Seconds.low>>>0,r.Seconds.high>>>0).toNumber():r.Seconds),r.FractionalNanoseconds!=null&&r.hasOwnProperty("FractionalNanoseconds")&&(n.FractionalNanoseconds=r.FractionalNanoseconds),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,Vc.default.util.toJSONOptions)},t})(),Utt=nn.Metadata=(()=>{function t(e){if(e)for(var r=Object.keys(e),i=0;i<r.length;++i)e[r[i]]!=null&&(this[r[i]]=e[r[i]])}return t.prototype.MimeType="",t.encode=function(r,i){return i||(i=Ow.create()),r.MimeType!=null&&Object.hasOwnProperty.call(r,"MimeType")&&i.uint32(10).string(r.MimeType),i},t.decode=function(r,i){r instanceof Kh||(r=Kh.create(r));for(var n=i===void 0?r.len:r.pos+i,s=new nn.Metadata;r.pos<n;){var o=r.uint32();switch(o>>>3){case 1:s.MimeType=r.string();break;default:r.skipType(o&7);break}}return s},t.fromObject=function(r){if(r instanceof nn.Metadata)return r;var i=new nn.Metadata;return r.MimeType!=null&&(i.MimeType=String(r.MimeType)),i},t.toObject=function(r,i){i||(i={});var n={};return i.defaults&&(n.MimeType=""),r.MimeType!=null&&r.hasOwnProperty("MimeType")&&(n.MimeType=r.MimeType),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,Vc.default.util.toJSONOptions)},t})();var zc=MD,LD=["raw","directory","file","metadata","symlink","hamt-sharded-directory"],F5e=["directory","hamt-sharded-directory"],qD=parseInt("0644",8),jD=parseInt("0755",8);function Pl(t){if(t!=null)return typeof t=="number"?t&4095:(t=t.toString(),t.substring(0,1)==="0"?parseInt(t,8)&4095:parseInt(t,10)&4095)}function Vh(t){if(t==null)return;let e;if(t.secs!=null&&(e={secs:t.secs,nsecs:t.nsecs}),t.Seconds!=null&&(e={secs:t.Seconds,nsecs:t.FractionalNanoseconds}),Array.isArray(t)&&(e={secs:t[0],nsecs:t[1]}),t instanceof Date){let r=t.getTime(),i=Math.floor(r/1e3);e={secs:i,nsecs:(r-i*1e3)*1e3}}if(!!Object.prototype.hasOwnProperty.call(e,"secs")){if(e!=null&&e.nsecs!=null&&(e.nsecs<0||e.nsecs>999999999))throw(0,H3.default)(new Error("mtime-nsecs must be within the range [0,999999999]"),"ERR_INVALID_MTIME_NSECS");return e}}var ct=class{static unmarshal(e){let r=zc.decode(e),i=zc.toObject(r,{defaults:!1,arrays:!0,longs:Number,objects:!1}),n=new ct({type:LD[i.Type],data:i.Data,blockSizes:i.blocksizes,mode:i.mode,mtime:i.mtime?{secs:i.mtime.Seconds,nsecs:i.mtime.FractionalNanoseconds}:void 0});return n._originalMode=i.mode||0,n}constructor(e={type:"file"}){let{type:r,data:i,blockSizes:n,hashType:s,fanout:o,mtime:a,mode:c}=e;if(r&&!LD.includes(r))throw(0,H3.default)(new Error("Type: "+r+" is not valid"),"ERR_INVALID_TYPE");this.type=r||"file",this.data=i,this.hashType=s,this.fanout=o,this.blockSizes=n||[],this._originalMode=0,this.mode=Pl(c),a&&(this.mtime=Vh(a),this.mtime&&!this.mtime.nsecs&&(this.mtime.nsecs=0))}set mode(e){this._mode=this.isDirectory()?jD:qD;let r=Pl(e);r!==void 0&&(this._mode=r)}get mode(){return this._mode}isDirectory(){return Boolean(this.type&&F5e.includes(this.type))}addBlockSize(e){this.blockSizes.push(e)}removeBlockSize(e){this.blockSizes.splice(e,1)}fileSize(){if(this.isDirectory())return 0;let e=0;return this.blockSizes.forEach(r=>{e+=r}),this.data&&(e+=this.data.length),e}marshal(){let e;switch(this.type){case"raw":e=zc.DataType.Raw;break;case"directory":e=zc.DataType.Directory;break;case"file":e=zc.DataType.File;break;case"metadata":e=zc.DataType.Metadata;break;case"symlink":e=zc.DataType.Symlink;break;case"hamt-sharded-directory":e=zc.DataType.HAMTShard;break;default:throw(0,H3.default)(new Error("Type: "+e+" is not valid"),"ERR_INVALID_TYPE")}let r=this.data;(!this.data||!this.data.length)&&(r=void 0);let i;this.mode!=null&&(i=this._originalMode&4294963200|(Pl(this.mode)||0),i===qD&&!this.isDirectory()&&(i=void 0),i===jD&&this.isDirectory()&&(i=void 0));let n;if(this.mtime!=null){let o=Vh(this.mtime);o&&(n={Seconds:o.secs,FractionalNanoseconds:o.nsecs},n.FractionalNanoseconds===0&&delete n.FractionalNanoseconds)}let s={Type:e,Data:r,filesize:this.isDirectory()?void 0:this.fileSize(),blocksizes:this.blockSizes,hashType:this.hashType,fanout:this.fanout,mode:i,mtime:n};return zc.encode(s).finish()}};var Nn={};zt(Nn,{code:()=>Pt,createLink:()=>cB,createNode:()=>aB,decode:()=>Bt,encode:()=>ot,name:()=>q8e,prepare:()=>zi,validate:()=>Fw});l();Te();l();var R8e=new TextDecoder;function jw(t,e){let r=0;for(let i=0;;i+=7){if(i>=64)throw new Error("protobuf: varint overflow");if(e>=t.length)throw new Error("protobuf: unexpected end of data");let n=t[e++];if(r+=i<28?(n&127)<<i:(n&127)*2**i,n<128)break}return[r,e]}function Q3(t,e){let r;[r,e]=jw(t,e);let i=e+r;if(r<0||i<0)throw new Error("protobuf: invalid length");if(i>t.length)throw new Error("protobuf: unexpected end of data");return[t.subarray(e,i),i]}function JD(t,e){let r;return[r,e]=jw(t,e),[r&7,r>>3,e]}function P8e(t){let e={},r=t.length,i=0;for(;i<r;){let n,s;if([n,s,i]=JD(t,i),s===1){if(e.Hash)throw new Error("protobuf: (PBLink) duplicate Hash section");if(n!==2)throw new Error(`protobuf: (PBLink) wrong wireType (${n}) for Hash`);if(e.Name!==void 0)throw new Error("protobuf: (PBLink) invalid order, found Name before Hash");if(e.Tsize!==void 0)throw new Error("protobuf: (PBLink) invalid order, found Tsize before Hash");[e.Hash,i]=Q3(t,i)}else if(s===2){if(e.Name!==void 0)throw new Error("protobuf: (PBLink) duplicate Name section");if(n!==2)throw new Error(`protobuf: (PBLink) wrong wireType (${n}) for Name`);if(e.Tsize!==void 0)throw new Error("protobuf: (PBLink) invalid order, found Tsize before Name");let o;[o,i]=Q3(t,i),e.Name=R8e.decode(o)}else if(s===3){if(e.Tsize!==void 0)throw new Error("protobuf: (PBLink) duplicate Tsize section");if(n!==0)throw new Error(`protobuf: (PBLink) wrong wireType (${n}) for Tsize`);[e.Tsize,i]=jw(t,i)}else throw new Error(`protobuf: (PBLink) invalid fieldNumber, expected 1, 2 or 3, got ${s}`)}if(i>r)throw new Error("protobuf: (PBLink) unexpected end of data");return e}function eB(t){let e=t.length,r=0,i,n=!1,s;for(;r<e;){let a,c;if([a,c,r]=JD(t,r),a!==2)throw new Error(`protobuf: (PBNode) invalid wireType, expected 2, got ${a}`);if(c===1){if(s)throw new Error("protobuf: (PBNode) duplicate Data section");[s,r]=Q3(t,r),i&&(n=!0)}else if(c===2){if(n)throw new Error("protobuf: (PBNode) duplicate Links section");i||(i=[]);let u;[u,r]=Q3(t,r),i.push(P8e(u))}else throw new Error(`protobuf: (PBNode) invalid fieldNumber, expected 1 or 2, got ${c}`)}if(r>e)throw new Error("protobuf: (PBNode) unexpected end of data");let o={};return s&&(o.Data=s),o.Links=i||[],o}l();var tB=new TextEncoder,rB=2**32,C8e=2**31;function O8e(t,e){let r=e.length;if(typeof t.Tsize=="number"){if(t.Tsize<0)throw new Error("Tsize cannot be negative");if(!Number.isSafeInteger(t.Tsize))throw new Error("Tsize too large for encoding");r=L2(e,r,t.Tsize)-1,e[r]=24}if(typeof t.Name=="string"){let i=tB.encode(t.Name);r-=i.length,e.set(i,r),r=L2(e,r,i.length)-1,e[r]=18}return t.Hash&&(r-=t.Hash.length,e.set(t.Hash,r),r=L2(e,r,t.Hash.length)-1,e[r]=10),e.length-r}function iB(t){let e=D8e(t),r=new Uint8Array(e),i=e;if(t.Data&&(i-=t.Data.length,r.set(t.Data,i),i=L2(r,i,t.Data.length)-1,r[i]=10),t.Links)for(let n=t.Links.length-1;n>=0;n--){let s=O8e(t.Links[n],r.subarray(0,i));i-=s,i=L2(r,i,s)-1,r[i]=18}return r}function k8e(t){let e=0;if(t.Hash){let r=t.Hash.length;e+=1+r+Yh(r)}if(typeof t.Name=="string"){let r=tB.encode(t.Name).length;e+=1+r+Yh(r)}return typeof t.Tsize=="number"&&(e+=1+Yh(t.Tsize)),e}function D8e(t){let e=0;if(t.Data){let r=t.Data.length;e+=1+r+Yh(r)}if(t.Links)for(let r of t.Links){let i=k8e(r);e+=1+i+Yh(i)}return e}function L2(t,e,r){e-=Yh(r);let i=e;for(;r>=C8e;)t[e++]=r&127|128,r/=128;for(;r>=128;)t[e++]=r&127|128,r>>>=7;return t[e]=r,i}function Yh(t){return t%2==0&&t++,Math.floor((B8e(t)+6)/7)}function B8e(t){let e=0;return t>=rB&&(t=Math.floor(t/rB),e=32),t>=1<<16&&(t>>>=16,e+=16),t>=1<<8&&(t>>>=8,e+=8),e+N8e[t]}var N8e=[0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8];l();Te();var M8e=["Data","Links"],L8e=["Hash","Name","Tsize"],Uw=new TextEncoder;function nB(t,e){if(t===e)return 0;let r=t.Name?Uw.encode(t.Name):[],i=e.Name?Uw.encode(e.Name):[],n=r.length,s=i.length;for(let o=0,a=Math.min(n,s);o<a;++o)if(r[o]!==i[o]){n=r[o],s=i[o];break}return n<s?-1:s<n?1:0}function sB(t,e){return!Object.keys(t).some(r=>!e.includes(r))}function oB(t){if(typeof t.asCID=="object"){let r=J.asCID(t);if(!r)throw new TypeError("Invalid DAG-PB form");return{Hash:r}}if(typeof t!="object"||Array.isArray(t))throw new TypeError("Invalid DAG-PB form");let e={};if(t.Hash){let r=J.asCID(t.Hash);try{r||(typeof t.Hash=="string"?r=J.parse(t.Hash):t.Hash instanceof Uint8Array&&(r=J.decode(t.Hash)))}catch(i){throw new TypeError(`Invalid DAG-PB form: ${i.message}`)}r&&(e.Hash=r)}if(!e.Hash)throw new TypeError("Invalid DAG-PB form");return typeof t.Name=="string"&&(e.Name=t.Name),typeof t.Tsize=="number"&&(e.Tsize=t.Tsize),e}function zi(t){if((t instanceof Uint8Array||typeof t=="string")&&(t={Data:t}),typeof t!="object"||Array.isArray(t))throw new TypeError("Invalid DAG-PB form");let e={};if(t.Data!==void 0)if(typeof t.Data=="string")e.Data=Uw.encode(t.Data);else if(t.Data instanceof Uint8Array)e.Data=t.Data;else throw new TypeError("Invalid DAG-PB form");if(t.Links!==void 0)if(Array.isArray(t.Links))e.Links=t.Links.map(oB),e.Links.sort(nB);else throw new TypeError("Invalid DAG-PB form");else e.Links=[];return e}function Fw(t){if(!t||typeof t!="object"||Array.isArray(t))throw new TypeError("Invalid DAG-PB form");if(!sB(t,M8e))throw new TypeError("Invalid DAG-PB form (extraneous properties)");if(t.Data!==void 0&&!(t.Data instanceof Uint8Array))throw new TypeError("Invalid DAG-PB form (Data must be a Uint8Array)");if(!Array.isArray(t.Links))throw new TypeError("Invalid DAG-PB form (Links must be an array)");for(let e=0;e<t.Links.length;e++){let r=t.Links[e];if(!r||typeof r!="object"||Array.isArray(r))throw new TypeError("Invalid DAG-PB form (bad link object)");if(!sB(r,L8e))throw new TypeError("Invalid DAG-PB form (extraneous properties on link object)");if(!r.Hash)throw new TypeError("Invalid DAG-PB form (link must have a Hash)");if(r.Hash.asCID!==r.Hash)throw new TypeError("Invalid DAG-PB form (link Hash must be a CID)");if(r.Name!==void 0&&typeof r.Name!="string")throw new TypeError("Invalid DAG-PB form (link Name must be a string)");if(r.Tsize!==void 0&&(typeof r.Tsize!="number"||r.Tsize%1!=0))throw new TypeError("Invalid DAG-PB form (link Tsize must be an integer)");if(e>0&&nB(r,t.Links[e-1])===-1)throw new TypeError("Invalid DAG-PB form (links must be sorted by Name bytes)")}}function aB(t,e=[]){return zi({Data:t,Links:e})}function cB(t,e,r){return oB({Hash:r,Name:t,Tsize:e})}var q8e="dag-pb",Pt=112;function ot(t){Fw(t);let e={};return t.Links&&(e.Links=t.Links.map(r=>{let i={};return r.Hash&&(i.Hash=r.Hash.bytes),r.Name!==void 0&&(i.Name=r.Name),r.Tsize!==void 0&&(i.Tsize=r.Tsize),i})),t.Data&&(e.Data=t.Data),iB(e)}function Bt(t){let e=eB(t),r={};return e.Data&&(r.Data=e.Data),e.Links&&(r.Links=e.Links.map(i=>{let n={};try{n.Hash=J.decode(i.Hash)}catch(s){}if(!n.Hash)throw new Error("Invalid Hash field found in link, expected CID");return i.Name!==void 0&&(n.Name=i.Name),i.Tsize!==void 0&&(n.Tsize=i.Tsize),n})),r}var z2={};zt(z2,{code:()=>Cl,decode:()=>Ol,encode:()=>Qw,name:()=>lve});l();l();l();l();var j8e=["string","number","bigint","symbol"],U8e=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function uB(t){if(t===null)return"null";if(t===void 0)return"undefined";if(t===!0||t===!1)return"boolean";let e=typeof t;if(j8e.includes(e))return e;if(e==="function")return"Function";if(Array.isArray(t))return"Array";if(F8e(t))return"Buffer";let r=K8e(t);return r||"Object"}function F8e(t){return t&&t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer.call(null,t)}function K8e(t){let e=Object.prototype.toString.call(t).slice(8,-1);if(U8e.includes(e))return e}l();var ge=class{constructor(e,r,i){this.major=e,this.majorEncoded=e<<5,this.name=r,this.terminal=i}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:this.major>e.major?1:0}};ge.uint=new ge(0,"uint",!0);ge.negint=new ge(1,"negint",!0);ge.bytes=new ge(2,"bytes",!0);ge.string=new ge(3,"string",!0);ge.array=new ge(4,"array",!1);ge.map=new ge(5,"map",!1);ge.tag=new ge(6,"tag",!1);ge.float=new ge(7,"float",!0);ge.false=new ge(7,"false",!0);ge.true=new ge(7,"true",!0);ge.null=new ge(7,"null",!0);ge.undefined=new ge(7,"undefined",!0);ge.break=new ge(7,"break",!0);var Fe=class{constructor(e,r,i){this.type=e,this.value=r,this.encodedLength=i,this.encodedBytes=void 0}toString(){return`Token[${this.type}].${this.value}`}};l();l();var Xh=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",V8e=new TextDecoder,z8e=new TextEncoder;function Z3(t){return Xh&&globalThis.Buffer.isBuffer(t)}function Kw(t){return t instanceof Uint8Array?Z3(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t:Uint8Array.from(t)}var fB=Xh?(t,e,r)=>r-e>64?globalThis.Buffer.from(t.subarray(e,r)).toString("utf8"):gB(t,e,r):(t,e,r)=>r-e>64?V8e.decode(t.subarray(e,r)):gB(t,e,r),lB=Xh?t=>t.length>64?globalThis.Buffer.from(t):yB(t):t=>t.length>64?z8e.encode(t):yB(t),Ca=t=>Uint8Array.from(t),J3=Xh?(t,e,r)=>Z3(t)?new Uint8Array(t.subarray(e,r)):t.slice(e,r):(t,e,r)=>t.slice(e,r),dB=Xh?(t,e)=>(t=t.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Kw(globalThis.Buffer.concat(t,e))):(t,e)=>{let r=new Uint8Array(e),i=0;for(let n of t)i+n.length>r.length&&(n=n.subarray(0,r.length-i)),r.set(n,i),i+=n.length;return r},hB=Xh?t=>globalThis.Buffer.allocUnsafe(t):t=>new Uint8Array(t);function pB(t,e){if(Z3(t)&&Z3(e))return t.compare(e);for(let r=0;r<t.length;r++)if(t[r]!==e[r])return t[r]<e[r]?-1:1;return 0}function yB(t,e=1/0){let r,i=t.length,n=null,s=[];for(let o=0;o<i;++o){if(r=t.charCodeAt(o),r>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function gB(t,e,r){let i=[];for(;e<r;){let n=t[e],s=null,o=n>239?4:n>223?3:n>191?2:1;if(e+o<=r){let a,c,u,f;switch(o){case 1:n<128&&(s=n);break;case 2:a=t[e+1],(a&192)==128&&(f=(n&31)<<6|a&63,f>127&&(s=f));break;case 3:a=t[e+1],c=t[e+2],(a&192)==128&&(c&192)==128&&(f=(n&15)<<12|(a&63)<<6|c&63,f>2047&&(f<55296||f>57343)&&(s=f));break;case 4:a=t[e+1],c=t[e+2],u=t[e+3],(a&192)==128&&(c&192)==128&&(u&192)==128&&(f=(n&15)<<18|(a&63)<<12|(c&63)<<6|u&63,f>65535&&f<1114112&&(s=f))}}s===null?(s=65533,o=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|s&1023),i.push(s),e+=o}return H8e(i)}var mB=4096;function H8e(t){let e=t.length;if(e<=mB)return String.fromCharCode.apply(String,t);let r="",i=0;for(;i<e;)r+=String.fromCharCode.apply(String,t.slice(i,i+=mB));return r}var G8e=256,e6=class{constructor(e=G8e){this.chunkSize=e,this.cursor=0,this.maxCursor=-1,this.chunks=[],this._initReuseChunk=null}reset(){this.chunks=[],this.cursor=0,this.maxCursor=-1,this._initReuseChunk!==null&&(this.chunks.push(this._initReuseChunk),this.maxCursor=this._initReuseChunk.length-1)}push(e){let r=this.chunks[this.chunks.length-1];if(this.cursor+e.length<=this.maxCursor+1){let n=r.length-(this.maxCursor-this.cursor)-1;r.set(e,n)}else{if(r){let n=r.length-(this.maxCursor-this.cursor)-1;n<r.length&&(this.chunks[this.chunks.length-1]=r.subarray(0,n),this.maxCursor=this.cursor-1)}e.length<64&&e.length<this.chunkSize?(r=hB(this.chunkSize),this.chunks.push(r),this.maxCursor+=r.length,this._initReuseChunk===null&&(this._initReuseChunk=r),r.set(e,0)):(this.chunks.push(e),this.maxCursor+=e.length)}this.cursor+=e.length}toBytes(e=!1){let r;if(this.chunks.length===1){let i=this.chunks[0];e&&this.cursor>i.length/2?(r=this.cursor===i.length?i:i.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):r=J3(i,0,this.cursor)}else r=dB(this.chunks,this.cursor);return e&&this.reset(),r}};l();var at="CBOR decode error:",Vw="CBOR encode error:",q2=[];q2[23]=1;q2[24]=2;q2[25]=3;q2[26]=5;q2[27]=9;function Hc(t,e,r){if(t.length-e<r)throw new Error(`${at} not enough data for type`)}l();l();var Hi=[24,256,65536,4294967296,BigInt("18446744073709551616")];function ms(t,e,r){Hc(t,e,1);let i=t[e];if(r.strict===!0&&i<Hi[0])throw new Error(`${at} integer encoded in more bytes than necessary (strict decode)`);return i}function bs(t,e,r){Hc(t,e,2);let i=t[e]<<8|t[e+1];if(r.strict===!0&&i<Hi[1])throw new Error(`${at} integer encoded in more bytes than necessary (strict decode)`);return i}function vs(t,e,r){Hc(t,e,4);let i=t[e]*16777216+(t[e+1]<<16)+(t[e+2]<<8)+t[e+3];if(r.strict===!0&&i<Hi[2])throw new Error(`${at} integer encoded in more bytes than necessary (strict decode)`);return i}function ws(t,e,r){Hc(t,e,8);let i=t[e]*16777216+(t[e+1]<<16)+(t[e+2]<<8)+t[e+3],n=t[e+4]*16777216+(t[e+5]<<16)+(t[e+6]<<8)+t[e+7],s=(BigInt(i)<<BigInt(32))+BigInt(n);if(r.strict===!0&&s<Hi[3])throw new Error(`${at} integer encoded in more bytes than necessary (strict decode)`);if(s<=Number.MAX_SAFE_INTEGER)return Number(s);if(r.allowBigInt===!0)return s;throw new Error(`${at} integers outside of the safe integer range are not supported`)}function bB(t,e,r,i){return new Fe(ge.uint,ms(t,e+1,i),2)}function vB(t,e,r,i){return new Fe(ge.uint,bs(t,e+1,i),3)}function wB(t,e,r,i){return new Fe(ge.uint,vs(t,e+1,i),5)}function _B(t,e,r,i){return new Fe(ge.uint,ws(t,e+1,i),9)}function Ks(t,e){return Xn(t,0,e.value)}function Xn(t,e,r){if(r<Hi[0]){let i=Number(r);t.push([e|i])}else if(r<Hi[1]){let i=Number(r);t.push([e|24,i])}else if(r<Hi[2]){let i=Number(r);t.push([e|25,i>>>8,i&255])}else if(r<Hi[3]){let i=Number(r);t.push([e|26,i>>>24&255,i>>>16&255,i>>>8&255,i&255])}else{let i=BigInt(r);if(i<Hi[4]){let n=[e|27,0,0,0,0,0,0,0],s=Number(i&BigInt(4294967295)),o=Number(i>>BigInt(32)&BigInt(4294967295));n[8]=s&255,s=s>>8,n[7]=s&255,s=s>>8,n[6]=s&255,s=s>>8,n[5]=s&255,n[4]=o&255,o=o>>8,n[3]=o&255,o=o>>8,n[2]=o&255,o=o>>8,n[1]=o&255,t.push(n)}else throw new Error(`${at} encountered BigInt larger than allowable range`)}}Ks.encodedSize=function(e){return Xn.encodedSize(e.value)};Xn.encodedSize=function(e){return e<Hi[0]?1:e<Hi[1]?2:e<Hi[2]?3:e<Hi[3]?5:9};Ks.compareTokens=function(e,r){return e.value<r.value?-1:e.value>r.value?1:0};l();function EB(t,e,r,i){return new Fe(ge.negint,-1-ms(t,e+1,i),2)}function SB(t,e,r,i){return new Fe(ge.negint,-1-bs(t,e+1,i),3)}function xB(t,e,r,i){return new Fe(ge.negint,-1-vs(t,e+1,i),5)}var zw=BigInt(-1),AB=BigInt(1);function IB(t,e,r,i){let n=ws(t,e+1,i);if(typeof n!="bigint"){let s=-1-n;if(s>=Number.MIN_SAFE_INTEGER)return new Fe(ge.negint,s,9)}if(i.allowBigInt!==!0)throw new Error(`${at} integers outside of the safe integer range are not supported`);return new Fe(ge.negint,zw-BigInt(n),9)}function t6(t,e){let r=e.value,i=typeof r=="bigint"?r*zw-AB:r*-1-1;Xn(t,e.type.majorEncoded,i)}t6.encodedSize=function(e){let r=e.value,i=typeof r=="bigint"?r*zw-AB:r*-1-1;return i<Hi[0]?1:i<Hi[1]?2:i<Hi[2]?3:i<Hi[3]?5:9};t6.compareTokens=function(e,r){return e.value<r.value?1:e.value>r.value?-1:0};l();function j2(t,e,r,i){Hc(t,e,r+i);let n=J3(t,e+r,e+r+i);return new Fe(ge.bytes,n,r+i)}function TB(t,e,r,i){return j2(t,e,1,r)}function RB(t,e,r,i){return j2(t,e,2,ms(t,e+1,i))}function PB(t,e,r,i){return j2(t,e,3,bs(t,e+1,i))}function CB(t,e,r,i){return j2(t,e,5,vs(t,e+1,i))}function OB(t,e,r,i){let n=ws(t,e+1,i);if(typeof n=="bigint")throw new Error(`${at} 64-bit integer bytes lengths not supported`);return j2(t,e,9,n)}function r6(t){return t.encodedBytes===void 0&&(t.encodedBytes=t.type===ge.string?lB(t.value):t.value),t.encodedBytes}function Qh(t,e){let r=r6(e);Xn(t,e.type.majorEncoded,r.length),t.push(r)}Qh.encodedSize=function(e){let r=r6(e);return Xn.encodedSize(r.length)+r.length};Qh.compareTokens=function(e,r){return $8e(r6(e),r6(r))};function $8e(t,e){return t.length<e.length?-1:t.length>e.length?1:pB(t,e)}l();function U2(t,e,r,i){let n=r+i;return Hc(t,e,n),new Fe(ge.string,fB(t,e+r,e+n),n)}function kB(t,e,r,i){return U2(t,e,1,r)}function DB(t,e,r,i){return U2(t,e,2,ms(t,e+1,i))}function BB(t,e,r,i){return U2(t,e,3,bs(t,e+1,i))}function NB(t,e,r,i){return U2(t,e,5,vs(t,e+1,i))}function MB(t,e,r,i){let n=ws(t,e+1,i);if(typeof n=="bigint")throw new Error(`${at} 64-bit integer string lengths not supported`);return U2(t,e,9,n)}var LB=Qh;l();function Zh(t,e,r,i){return new Fe(ge.array,i,r)}function qB(t,e,r,i){return Zh(t,e,1,r)}function jB(t,e,r,i){return Zh(t,e,2,ms(t,e+1,i))}function UB(t,e,r,i){return Zh(t,e,3,bs(t,e+1,i))}function FB(t,e,r,i){return Zh(t,e,5,vs(t,e+1,i))}function KB(t,e,r,i){let n=ws(t,e+1,i);if(typeof n=="bigint")throw new Error(`${at} 64-bit integer array lengths not supported`);return Zh(t,e,9,n)}function VB(t,e,r,i){if(i.allowIndefinite===!1)throw new Error(`${at} indefinite length items not allowed`);return Zh(t,e,1,1/0)}function Hw(t,e){Xn(t,ge.array.majorEncoded,e.value)}Hw.compareTokens=Ks.compareTokens;l();function Jh(t,e,r,i){return new Fe(ge.map,i,r)}function zB(t,e,r,i){return Jh(t,e,1,r)}function HB(t,e,r,i){return Jh(t,e,2,ms(t,e+1,i))}function GB(t,e,r,i){return Jh(t,e,3,bs(t,e+1,i))}function $B(t,e,r,i){return Jh(t,e,5,vs(t,e+1,i))}function WB(t,e,r,i){let n=ws(t,e+1,i);if(typeof n=="bigint")throw new Error(`${at} 64-bit integer map lengths not supported`);return Jh(t,e,9,n)}function YB(t,e,r,i){if(i.allowIndefinite===!1)throw new Error(`${at} indefinite length items not allowed`);return Jh(t,e,1,1/0)}function Gw(t,e){Xn(t,ge.map.majorEncoded,e.value)}Gw.compareTokens=Ks.compareTokens;l();function XB(t,e,r,i){return new Fe(ge.tag,r,1)}function QB(t,e,r,i){return new Fe(ge.tag,ms(t,e+1,i),2)}function ZB(t,e,r,i){return new Fe(ge.tag,bs(t,e+1,i),3)}function JB(t,e,r,i){return new Fe(ge.tag,vs(t,e+1,i),5)}function eN(t,e,r,i){return new Fe(ge.tag,ws(t,e+1,i),9)}function $w(t,e){Xn(t,ge.tag.majorEncoded,e.value)}$w.compareTokens=Ks.compareTokens;l();var W8e=20,Y8e=21,X8e=22,Q8e=23;function tN(t,e,r,i){if(i.allowUndefined===!1)throw new Error(`${at} undefined values are not supported`);return new Fe(ge.undefined,void 0,1)}function rN(t,e,r,i){if(i.allowIndefinite===!1)throw new Error(`${at} indefinite length items not allowed`);return new Fe(ge.break,void 0,1)}function Ww(t,e,r){if(r){if(r.allowNaN===!1&&Number.isNaN(t))throw new Error(`${at} NaN values are not supported`);if(r.allowInfinity===!1&&(t===1/0||t===-1/0))throw new Error(`${at} Infinity values are not supported`)}return new Fe(ge.float,t,e)}function iN(t,e,r,i){return Ww(Yw(t,e+1),3,i)}function nN(t,e,r,i){return Ww(Xw(t,e+1),5,i)}function sN(t,e,r,i){return Ww(uN(t,e+1),9,i)}function i6(t,e,r){let i=e.value;if(i===!1)t.push([ge.float.majorEncoded|W8e]);else if(i===!0)t.push([ge.float.majorEncoded|Y8e]);else if(i===null)t.push([ge.float.majorEncoded|X8e]);else if(i===void 0)t.push([ge.float.majorEncoded|Q8e]);else{let n,s=!1;(!r||r.float64!==!0)&&(aN(i),n=Yw(Lo,1),i===n||Number.isNaN(i)?(Lo[0]=249,t.push(Lo.slice(0,3)),s=!0):(cN(i),n=Xw(Lo,1),i===n&&(Lo[0]=250,t.push(Lo.slice(0,5)),s=!0))),s||(Z8e(i),n=uN(Lo,1),Lo[0]=251,t.push(Lo.slice(0,9)))}}i6.encodedSize=function(e,r){let i=e.value;if(i===!1||i===!0||i===null||i===void 0)return 1;let n;if(!r||r.float64!==!0){if(aN(i),n=Yw(Lo,1),i===n||Number.isNaN(i))return 3;if(cN(i),n=Xw(Lo,1),i===n)return 5}return 9};var oN=new ArrayBuffer(9),Vs=new DataView(oN,1),Lo=new Uint8Array(oN,0);function aN(t){if(t===1/0)Vs.setUint16(0,31744,!1);else if(t===-1/0)Vs.setUint16(0,64512,!1);else if(Number.isNaN(t))Vs.setUint16(0,32256,!1);else{Vs.setFloat32(0,t);let e=Vs.getUint32(0),r=(e&2139095040)>>23,i=e&8388607;if(r===255)Vs.setUint16(0,31744,!1);else if(r===0)Vs.setUint16(0,(t&2147483648)>>16|i>>13,!1);else{let n=r-127;n<-24?Vs.setUint16(0,0):n<-14?Vs.setUint16(0,(e&2147483648)>>16|1<<24+n,!1):Vs.setUint16(0,(e&2147483648)>>16|n+15<<10|i>>13,!1)}}}function Yw(t,e){if(t.length-e<2)throw new Error(`${at} not enough data for float16`);let r=(t[e]<<8)+t[e+1];if(r===31744)return 1/0;if(r===64512)return-1/0;if(r===32256)return NaN;let i=r>>10&31,n=r&1023,s;return i===0?s=n*2**-24:i!==31?s=(n+1024)*2**(i-25):s=n===0?1/0:NaN,r&32768?-s:s}function cN(t){Vs.setFloat32(0,t,!1)}function Xw(t,e){if(t.length-e<4)throw new Error(`${at} not enough data for float32`);let r=(t.byteOffset||0)+e;return new DataView(t.buffer,r,4).getFloat32(0,!1)}function Z8e(t){Vs.setFloat64(0,t,!1)}function uN(t,e){if(t.length-e<8)throw new Error(`${at} not enough data for float64`);let r=(t.byteOffset||0)+e;return new DataView(t.buffer,r,8).getFloat64(0,!1)}i6.compareTokens=Ks.compareTokens;function Gt(t,e,r){throw new Error(`${at} encountered invalid minor (${r}) for major ${t[e]>>>5}`)}function n6(t){return()=>{throw new Error(`${at} ${t}`)}}var De=[];for(let t=0;t<=23;t++)De[t]=Gt;De[24]=bB;De[25]=vB;De[26]=wB;De[27]=_B;De[28]=Gt;De[29]=Gt;De[30]=Gt;De[31]=Gt;for(let t=32;t<=55;t++)De[t]=Gt;De[56]=EB;De[57]=SB;De[58]=xB;De[59]=IB;De[60]=Gt;De[61]=Gt;De[62]=Gt;De[63]=Gt;for(let t=64;t<=87;t++)De[t]=TB;De[88]=RB;De[89]=PB;De[90]=CB;De[91]=OB;De[92]=Gt;De[93]=Gt;De[94]=Gt;De[95]=n6("indefinite length bytes/strings are not supported");for(let t=96;t<=119;t++)De[t]=kB;De[120]=DB;De[121]=BB;De[122]=NB;De[123]=MB;De[124]=Gt;De[125]=Gt;De[126]=Gt;De[127]=n6("indefinite length bytes/strings are not supported");for(let t=128;t<=151;t++)De[t]=qB;De[152]=jB;De[153]=UB;De[154]=FB;De[155]=KB;De[156]=Gt;De[157]=Gt;De[158]=Gt;De[159]=VB;for(let t=160;t<=183;t++)De[t]=zB;De[184]=HB;De[185]=GB;De[186]=$B;De[187]=WB;De[188]=Gt;De[189]=Gt;De[190]=Gt;De[191]=YB;for(let t=192;t<=215;t++)De[t]=XB;De[216]=QB;De[217]=ZB;De[218]=JB;De[219]=eN;De[220]=Gt;De[221]=Gt;De[222]=Gt;De[223]=Gt;for(let t=224;t<=243;t++)De[t]=n6("simple values are not supported");De[244]=Gt;De[245]=Gt;De[246]=Gt;De[247]=tN;De[248]=n6("simple values are not supported");De[249]=iN;De[250]=nN;De[251]=sN;De[252]=Gt;De[253]=Gt;De[254]=Gt;De[255]=rN;var qo=[];for(let t=0;t<24;t++)qo[t]=new Fe(ge.uint,t,1);for(let t=-1;t>=-24;t--)qo[31-t]=new Fe(ge.negint,t,1);qo[64]=new Fe(ge.bytes,new Uint8Array(0),1);qo[96]=new Fe(ge.string,"",1);qo[128]=new Fe(ge.array,0,1);qo[160]=new Fe(ge.map,0,1);qo[244]=new Fe(ge.false,!1,1);qo[245]=new Fe(ge.true,!0,1);qo[246]=new Fe(ge.null,null,1);function fN(t){switch(t.type){case ge.false:return Ca([244]);case ge.true:return Ca([245]);case ge.null:return Ca([246]);case ge.bytes:return t.value.length?void 0:Ca([64]);case ge.string:return t.value===""?Ca([96]):void 0;case ge.array:return t.value===0?Ca([128]):void 0;case ge.map:return t.value===0?Ca([160]):void 0;case ge.uint:return t.value<24?Ca([Number(t.value)]):void 0;case ge.negint:if(t.value>=-24)return Ca([31-Number(t.value)])}}var J8e={float64:!1,mapSorter:tve,quickEncodeToken:fN},Oa=[];Oa[ge.uint.major]=Ks;Oa[ge.negint.major]=t6;Oa[ge.bytes.major]=Qh;Oa[ge.string.major]=LB;Oa[ge.array.major]=Hw;Oa[ge.map.major]=Gw;Oa[ge.tag.major]=$w;Oa[ge.float.major]=i6;var lN=new e6,F2=class{constructor(e,r){this.obj=e,this.parent=r}includes(e){let r=this;do if(r.obj===e)return!0;while(r=r.parent);return!1}static createCheck(e,r){if(e&&e.includes(r))throw new Error(`${Vw} object contains circular references`);return new F2(r,e)}},Qu={null:new Fe(ge.null,null),undefined:new Fe(ge.undefined,void 0),true:new Fe(ge.true,!0),false:new Fe(ge.false,!1),emptyArray:new Fe(ge.array,0),emptyMap:new Fe(ge.map,0)},Zu={number(t,e,r,i){return!Number.isInteger(t)||!Number.isSafeInteger(t)?new Fe(ge.float,t):t>=0?new Fe(ge.uint,t):new Fe(ge.negint,t)},bigint(t,e,r,i){return t>=BigInt(0)?new Fe(ge.uint,t):new Fe(ge.negint,t)},Uint8Array(t,e,r,i){return new Fe(ge.bytes,t)},string(t,e,r,i){return new Fe(ge.string,t)},boolean(t,e,r,i){return t?Qu.true:Qu.false},null(t,e,r,i){return Qu.null},undefined(t,e,r,i){return Qu.undefined},ArrayBuffer(t,e,r,i){return new Fe(ge.bytes,new Uint8Array(t))},DataView(t,e,r,i){return new Fe(ge.bytes,new Uint8Array(t.buffer,t.byteOffset,t.byteLength))},Array(t,e,r,i){if(!t.length)return r.addBreakTokens===!0?[Qu.emptyArray,new Fe(ge.break)]:Qu.emptyArray;i=F2.createCheck(i,t);let n=[],s=0;for(let o of t)n[s++]=s6(o,r,i);return r.addBreakTokens?[new Fe(ge.array,t.length),n,new Fe(ge.break)]:[new Fe(ge.array,t.length),n]},Object(t,e,r,i){let n=e!=="Object",s=n?t.keys():Object.keys(t),o=n?t.size:s.length;if(!o)return r.addBreakTokens===!0?[Qu.emptyMap,new Fe(ge.break)]:Qu.emptyMap;i=F2.createCheck(i,t);let a=[],c=0;for(let u of s)a[c++]=[s6(u,r,i),s6(n?t.get(u):t[u],r,i)];return eve(a,r),r.addBreakTokens?[new Fe(ge.map,o),a,new Fe(ge.break)]:[new Fe(ge.map,o),a]}};Zu.Map=Zu.Object;Zu.Buffer=Zu.Uint8Array;for(let t of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))Zu[`${t}Array`]=Zu.DataView;function s6(t,e={},r){let i=uB(t),n=e&&e.typeEncoders&&e.typeEncoders[i]||Zu[i];if(typeof n=="function"){let o=n(t,i,e,r);if(o!=null)return o}let s=Zu[i];if(!s)throw new Error(`${Vw} unsupported type: ${i}`);return s(t,i,e,r)}function eve(t,e){e.mapSorter&&t.sort(e.mapSorter)}function tve(t,e){let r=Array.isArray(t[0])?t[0][0]:t[0],i=Array.isArray(e[0])?e[0][0]:e[0];if(r.type!==i.type)return r.type.compare(i.type);let n=r.type.major,s=Oa[n].compareTokens(r,i);return s===0&&console.warn("WARNING: complex key types used, CBOR key sorting guarantees are gone"),s}function dN(t,e,r,i){if(Array.isArray(e))for(let n of e)dN(t,n,r,i);else r[e.type.major](t,e,i)}function rve(t,e,r){let i=s6(t,r);if(!Array.isArray(i)&&r.quickEncodeToken){let n=r.quickEncodeToken(i);if(n)return n;let s=e[i.type.major];if(s.encodedSize){let o=s.encodedSize(i,r),a=new e6(o);if(s(a,i,r),a.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${i} was wrong`);return Kw(a.chunks[0])}}return dN(lN,i,e,r),lN.toBytes(!0)}function jo(t,e){return e=Object.assign({},J8e,e),rve(t,Oa,e)}l();var ive={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},hN=class{constructor(e,r={}){this.pos=0,this.data=e,this.options=r}done(){return this.pos>=this.data.length}next(){let e=this.data[this.pos],r=qo[e];if(r===void 0){let i=De[e];if(!i)throw new Error(`${at} no decoder for major type ${e>>>5} (byte 0x${e.toString(16).padStart(2,"0")})`);let n=e&31;r=i(this.data,this.pos,n,this.options)}return this.pos+=r.encodedLength,r}},K2=Symbol.for("DONE"),o6=Symbol.for("BREAK");function nve(t,e,r){let i=[];for(let n=0;n<t.value;n++){let s=V2(e,r);if(s===o6){if(t.value===1/0)break;throw new Error(`${at} got unexpected break to lengthed array`)}if(s===K2)throw new Error(`${at} found array but not enough entries (got ${n}, expected ${t.value})`);i[n]=s}return i}function sve(t,e,r){let i=r.useMaps===!0,n=i?void 0:{},s=i?new Map:void 0;for(let o=0;o<t.value;o++){let a=V2(e,r);if(a===o6){if(t.value===1/0)break;throw new Error(`${at} got unexpected break to lengthed map`)}if(a===K2)throw new Error(`${at} found map but not enough entries (got ${o} [no key], expected ${t.value})`);if(i!==!0&&typeof a!="string")throw new Error(`${at} non-string keys not supported (got ${typeof a})`);let c=V2(e,r);if(c===K2)throw new Error(`${at} found map but not enough entries (got ${o} [no value], expected ${t.value})`);i?s.set(a,c):n[a]=c}return i?s:n}function V2(t,e){if(t.done())return K2;let r=t.next();if(r.type===ge.break)return o6;if(r.type.terminal)return r.value;if(r.type===ge.array)return nve(r,t,e);if(r.type===ge.map)return sve(r,t,e);if(r.type===ge.tag){if(e.tags&&typeof e.tags[r.value]=="function"){let i=V2(t,e);return e.tags[r.value](i)}throw new Error(`${at} tag not supported (${r.value})`)}throw new Error("unsupported")}function Qn(t,e){if(!(t instanceof Uint8Array))throw new Error(`${at} data to decode must be a Uint8Array`);e=Object.assign({},ive,e);let r=e.tokenizer||new hN(t,e),i=V2(r,e);if(i===K2)throw new Error(`${at} did not find any content to decode`);if(i===o6)throw new Error(`${at} got unexpected break`);if(!r.done())throw new Error(`${at} too many terminals, data makes no sense`);return i}Te();var pN=42;function ove(t){if(t.asCID!==t)return null;let e=J.asCID(t);if(!e)return null;let r=new Uint8Array(e.bytes.byteLength+1);return r.set(e.bytes,1),[new Fe(ge.tag,pN),new Fe(ge.bytes,r)]}function ave(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function cve(t){if(Number.isNaN(t))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(t===1/0||t===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}var uve={float64:!0,typeEncoders:{Object:ove,undefined:ave,number:cve}};function fve(t){if(t[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return J.decode(t.subarray(1))}var yN={allowIndefinite:!1,allowUndefined:!1,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,tags:[]};yN.tags[pN]=fve;var lve="dag-cbor",Cl=113,Qw=t=>jo(t,uve),Ol=t=>Qn(t,yN);Gc();l6();l();function SN(){}l();var ef=class extends Error{constructor(e="not initialized"){super(e);this.name="NotInitializedError",this.code=ef.code}};ef.code="ERR_NOT_INITIALIZED";var xN=class extends Error{constructor(e="cannot initialize an initializing node"){super(e);this.name="AlreadyInitializingError",this.code=ka.code}};xN.code="ERR_ALREADY_INITIALIZING";var ka=class extends Error{constructor(e="cannot re-initialize an initialized node"){super(e);this.name="AlreadyInitializedError",this.code=ka.code}};ka.code="ERR_ALREADY_INITIALIZED";var tf=class extends Error{constructor(e="not started"){super(e);this.name="NotStartedError",this.code=tf.code}};tf.code="ERR_NOT_STARTED";var t0=class extends Error{constructor(e="cannot start, already startin"){super(e);this.name="AlreadyStartingError",this.code=t0.code}};t0.code="ERR_ALREADY_STARTING";var r0=class extends Error{constructor(e="cannot start, already started"){super(e);this.name="AlreadyStartedError",this.code=r0.code}};r0.code="ERR_ALREADY_STARTED";var Da=class extends Error{constructor(e="not enabled"){super(e);this.name="NotEnabledError",this.code=Da.code}};Da.code="ERR_NOT_ENABLED";dt();l();l();l();var pL=M(d0());Te();Br();var R6=M(Rt());l();var uL=M(I6()),fL=M(sf());l();var $7e=/(-?(?:\d+\.?\d*|\d*\.?\d+)(?:e[-+]?\d+)?)\s*([\p{L}]*)/uig;vt.nanosecond=vt.ns=1/1e6;vt.\u00B5s=vt.\u03BCs=vt.us=vt.microsecond=1/1e3;vt.millisecond=vt.ms=vt[""]=1;vt.second=vt.sec=vt.s=vt.ms*1e3;vt.minute=vt.min=vt.m=vt.s*60;vt.hour=vt.hr=vt.h=vt.m*60;vt.day=vt.d=vt.h*24;vt.week=vt.wk=vt.w=vt.d*7;vt.month=vt.b=vt.d*(365.25/12);vt.year=vt.yr=vt.y=vt.d*365.25;function vt(t="",e="ms"){var r=null;return t=(t+"").replace(/(\d)[,_](\d)/g,"$1$2"),t.replace($7e,function(i,n,s){s=cL(s),s&&(r=(r||0)+parseFloat(n,10)*s)}),r&&r/(cL(e)||1)}function cL(t){return vt[t]||vt[t.toLowerCase().replace(/s$/,"")]}var of=vt;l();var af=class extends Error{constructor(e="request timed out"){super(e);this.name="TimeoutError",this.code=af.code}};af.code="ERR_TIMEOUT";function ce(t,e){return(...r)=>{let i=r[e??r.length-1];if(!i||!i.timeout)return t(...r);let n=typeof i.timeout=="string"?of(i.timeout):i.timeout,s=new uL.default(n);i.signal=(0,fL.anySignal)([i.signal,s.signal]);let o=t(...r),a=new Promise((f,d)=>{s.signal.addEventListener("abort",()=>{d(new af)})}),c=Date.now(),u=()=>{if(s.signal.aborted)throw new af;if(Date.now()-c>n)throw s.abort(),new af};return o[Symbol.asyncIterator]?async function*(){let f=o[Symbol.asyncIterator]();try{for(;;){let{value:d,done:h}=await Promise.race([f.next(),a]);if(h)break;u(),yield d}}catch(d){throw u(),d}finally{s.clear(),f.return&&f.return()}}():(async()=>{try{let f=await Promise.race([o,a]);return u(),f}catch(f){throw u(),f}finally{s.clear()}})()}}l();Te();var j9=M(p0()),hL="/ipfs/";function Wc(t){if(t instanceof Uint8Array)try{t=J.decode(t)}catch(n){throw(0,j9.default)(n,"ERR_INVALID_CID")}let e=J.asCID(t);if(e)return{cid:e,path:void 0};t=t.toString(),t.startsWith(hL)&&(t=t.substring(hL.length));let r=t.split("/"),i;try{e=J.parse(r.shift()||"")}catch(n){throw(0,j9.default)(n,"ERR_INVALID_CID")}return r.length&&(i=`/${r.join("/")}`),{cid:e,path:i}}var Y7e="ERR_BAD_PATH",P6="This command must be run in online mode. Try running 'ipfs daemon' first.",ay=new qe("/local/filesroot"),cy=262144;var yL=t=>{if(J.asCID(t))return`/ipfs/${t}`;let r=t.toString();try{return`/ipfs/${J.parse(r)}`}catch{}if(pL.default.path(r))return r;throw(0,R6.default)(new Error(`invalid path: ${t}`),Y7e)},y0=t=>t instanceof Uint8Array?J.decode(t).toString():(t=t.toString(),t.indexOf("/ipfs/")===0&&(t=t.substring("/ipfs/".length)),t.charAt(t.length-1)==="/"&&(t=t.substring(0,t.length-1)),t),cf=async function(t,e,r,i={}){let{cid:n,path:s}=Wc(r);s&&(i.path=s);let o=n,a=i.path||"";if(a.startsWith("/")&&(a=a.substring(1)),i.path)try{for await(let{value:c,remainderPath:u}of uf(n,i.path,e,t,{signal:i.signal})){if(!J.asCID(c))break;a=u,o=c}}catch(c){throw c.message.startsWith("Object has no property")&&(c.message=`no link named "${a.split("/")[0]}" under ${o}`,c.code="ERR_NO_LINK"),c}return{cid:o,remainderPath:a||""}},U9=t=>{if(t.type!=="file"&&t.type!=="directory"&&t.type!=="raw")throw new Error(`Unknown node type '${t.type}'`);let e={cid:t.cid,path:t.path,name:t.name,size:t.size,type:"file"};return t.type==="directory"&&(e.type="dir"),t.type==="file"&&(e.size=t.unixfs.fileSize()),(t.type==="file"||t.type==="directory")&&(e.mode=t.unixfs.mode,t.unixfs.mtime!==void 0&&(e.mtime=t.unixfs.mtime)),e},gL=ce(async(t,e)=>await t),uf=async function*(t,e,r,i,n){let s=async u=>{let f=await r.getCodec(u.code),d=await i.blocks.get(u,n);return f.decode(d)},o=e.split("/").filter(Boolean),a=await s(t),c=t;for(o.length||(yield{value:a,remainderPath:""});o.length;){let u=o.shift();if(!u)throw(0,R6.default)(new Error(`Could not resolve path "${e}"`),"ERR_INVALID_PATH");if(t.code===Pt&&Array.isArray(a.Links)){let f=a.Links.find(d=>d.Name===u);if(f){yield{value:f.Hash,remainderPath:o.join("/")},a=await s(f.Hash),c=f.Hash;continue}}if(Object.prototype.hasOwnProperty.call(a,u))a=a[u],yield{value:a,remainderPath:o.join("/")};else throw(0,R6.default)(new Error(`no link named "${u}" under ${c}`),"ERR_NO_LINK");J.asCID(a)&&(c=a,a=await s(a))}};var Ln=class{static create({start:e,stop:r}){return new Ln(e,r)}static async start(e,r){let{state:i,activate:n}=e;switch(i.status){case"stopped":try{let s=n(r);e.state={status:"starting",ready:s};let o=await s;return e.state={status:"started",value:o},o}catch(s){throw e.state={status:"stopped"},s}case"starting":throw new t0;case"started":throw new r0;case"stopping":return await i.ready,await Ln.start(e,r);default:return Ln.panic(e)}}static async stop(e){let{state:r,deactivate:i}=e;switch(r.status){case"stopped":break;case"starting":{try{await r.ready}catch(n){}return await Ln.stop(e)}case"stopping":return await r.ready;case"started":{i&&await i(r.value),e.state={status:"stopped"};break}default:Ln.panic(r)}}static try({state:e}){switch(e.status){case"started":return e.value;default:return null}}static async use({state:e},r){switch(e.status){case"started":return e.value;case"starting":return await gL(e.ready,r);default:throw new tf}}static panic({state:e}){let r=JSON.stringify({status:e.status});throw RangeError(`Service in invalid state ${r}, should never happen if you see this please report a bug`)}constructor(e,r){this.activate=e,this.deactivate=r,this.state={status:"stopped"}}async use(e){return await Ln.use(this,e)}try(){return Ln.try(this)}};function mL({network:t,preload:e,peerId:r,keychain:i,repo:n,ipns:s,mfsPreload:o,print:a,options:c}){return async()=>{let{libp2p:f}=await Ln.start(t,{peerId:r,repo:n,print:a,options:c});await Promise.all([s.startOnline({keychain:i,libp2p:f,peerId:r,repo:n}),e.start(),o.start()])}}l();function bL({network:t,preload:e,ipns:r,repo:i,mfsPreload:n}){return async()=>{await Promise.all([e.stop(),r.stop(),n.stop(),Ln.stop(t),i.close()])}}l();l();l();var wL=M(g0()),F9=class{constructor(e){this.lru=(0,wL.default)(e)}get(e){let r=this.lru.get(e);if(r){if(r.expire&&r.expire<Date.now()){this.lru.remove(e);return}return r.value}}set(e,r,i){this.lru.set(e,{value:r,expire:Date.now()+i})}has(e){return!!this.get(e)}remove(e){this.lru.remove(e)}clear(){this.lru.clear()}};var B6=M(Yc()),WL=M(ly()),J9=new F9(1e3),Awe=60*1e3,Iwe=B6.default.default?B6.default.default:B6.default,Twe=new Iwe({concurrency:4}),YL=t=>{if(t.Path)return t.Path;throw new Error(t.Message)};async function XL(t,e){return(async(i,n={})=>{let s=new URLSearchParams(n);s.set("arg",i);let o=s.toString();if(!n.nocache&&J9.has(o)){let c=J9.get(o);return YL(c)}let a=await Twe.add(async()=>{let c=await WL.default.get("https://ipfs.io/api/v0/dns",{searchParams:s}),u=new URL(c.url).search.slice(1),f=await c.json();return J9.set(u,f,Awe),f});return YL(a)})(t,e)}function Rwe(t){return t.endsWith(".eth")&&(t=t.replace(/.eth$/,".eth.link")),t}function QL(){return ce(async(e,r={recursive:!0})=>{if(typeof e!="string")throw new Error("Invalid arguments, domain must be a string");return e=Rwe(e),XL(e,r)})}l();function ZL({network:t}){return()=>{let e=t.try();return e!=null&&Boolean(e.libp2p.isStarted())}}l();var yE=M(d0());Te();var PK=M(it());function CK({repo:t,codecs:e,bases:r,name:i}){async function n(s,o={}){if(!yE.default.path(s))throw new Error("invalid argument "+s);if(yE.default.ipnsPath(s))for await(let E of i.resolve(s,o))s=E;let[,a,c,...u]=s.split("/"),f=o.cidBase?await r.getBase(o.cidBase):void 0,d=CAe(c);if(u.length===0){let E=f?f.encoder.encode(d):c;return`/${a}/${E}`}let h=J.decode(d);s=u.join("/");let p=uf(h,s,e,t,o),y=h,b=s;for await(let E of p)J.asCID(E.value)&&(y=E.value,b=E.remainderPath);return`/ipfs/${y.toString(f&&f.encoder)}${b?"/"+b:""}`}return ce(n)}function CAe(t){try{return PK.default.parse(t).toBytes()}catch{return J.parse(t).bytes}}l();l();var kK=M(is());Te();function DK({addAll:t}){return(e,r={})=>{let i,n=J.asCID(e);return n?i=t([{cid:n,...r}],r):i=t([{path:e.toString(),...r}],r),(0,kK.default)(i)}}l();l();var z0=M(p0());Te();async function*tc(t){if(t==null)throw(0,z0.default)(new Error(`Unexpected input: ${t}`),"ERR_UNEXPECTED_INPUT");let e=J.asCID(t);if(e){yield Qo({cid:e});return}if(t instanceof String||typeof t=="string"){yield Qo({path:t});return}if(t.cid!=null||t.path!=null)return yield Qo(t);if(Symbol.iterator in t){let r=t[Symbol.iterator](),i=r.next();if(i.done)return r;if(J.asCID(i.value)||i.value instanceof String||typeof i.value=="string"){yield Qo({cid:i.value});for(let n of r)yield Qo({cid:n});return}if(i.value.cid!=null||i.value.path!=null){yield Qo(i.value);for(let n of r)yield Qo(n);return}throw(0,z0.default)(new Error("Unexpected input: "+typeof t),"ERR_UNEXPECTED_INPUT")}if(Symbol.asyncIterator in t){let r=t[Symbol.asyncIterator](),i=await r.next();if(i.done)return r;if(J.asCID(i.value)||i.value instanceof String||typeof i.value=="string"){yield Qo({cid:i.value});for await(let n of r)yield Qo({cid:n});return}if(i.value.cid!=null||i.value.path!=null){yield Qo(i.value);for await(let n of r)yield Qo(n);return}throw(0,z0.default)(new Error("Unexpected input: "+typeof t),"ERR_UNEXPECTED_INPUT")}throw(0,z0.default)(new Error("Unexpected input: "+typeof t),"ERR_UNEXPECTED_INPUT")}function Qo(t){let e=t.cid||`${t.path}`;if(!e)throw(0,z0.default)(new Error("Unexpected input: Please path either a CID or an IPFS path"),"ERR_UNEXPECTED_INPUT");let r={path:e,recursive:t.recursive!==!1};return t.metadata!=null&&(r.metadata=t.metadata),r}l();var Ct={direct:"direct",recursive:"recursive",indirect:"indirect",all:"all"};function BK({repo:t,codecs:e}){async function*r(i,n={}){let s=async function*(){for await(let{path:c,recursive:u,metadata:f}of tc(i)){let{cid:d}=await cf(t,e,c),{reason:h}=await t.pins.isPinnedWithType(d,[Ct.recursive,Ct.direct]);if(h==="recursive"&&!u)throw new Error(`${d} already pinned recursively`);u?await t.pins.pinRecursively(d,{metadata:f}):await t.pins.pinDirectly(d,{metadata:f}),yield d}};if(!Boolean(n.lock)){yield*s();return}let a=await t.gcLock.readLock();try{yield*s()}finally{a()}}return ce(r)}l();var gE=M(Rt());function My(t,e,r){let i={type:t,cid:e};return r&&(i.metadata=r),i}function NK({repo:t,codecs:e}){async function*r(i={}){let n=Ct.all;if(i.type&&(n=i.type,!Object.keys(Ct).includes(n)))throw(0,gE.default)(new Error("Invalid pin type"),"ERR_INVALID_PIN_TYPE");if(i.paths){let s=!1;for await(let{path:o}of tc(i.paths)){let{cid:a}=await cf(t,e,o),{reason:c,pinned:u,parent:f,metadata:d}=await t.pins.isPinnedWithType(a,n);if(!u)throw(0,gE.default)(new Error(`path '${o}' is not pinned`),"ERR_NOT_PINNED");switch(c){case Ct.direct:case Ct.recursive:s=!0,yield My(c,a,d);break;default:s=!0,yield My(`${Ct.indirect} through ${f}`,a,d)}}if(!s)throw new Error("No match found");return}if(n===Ct.recursive||n===Ct.all)for await(let{cid:s,metadata:o}of t.pins.recursiveKeys())yield My(Ct.recursive,s,o);if(n===Ct.indirect||n===Ct.all)for await(let s of t.pins.indirectKeys(i))yield My(Ct.indirect,s);if(n===Ct.direct||n===Ct.all)for await(let{cid:s,metadata:o}of t.pins.directKeys())yield My(Ct.direct,s,o)}return ce(r)}l();var MK=M(is());function LK({rmAll:t}){async function e(r,i={}){let n=await(0,MK.default)(t([{path:r,...i}],i));if(!n)throw new Error("CID expected");return n}return e}l();function qK({repo:t,codecs:e}){async function*r(i,n={}){let s=await t.gcLock.readLock();try{for await(let{path:o,recursive:a}of tc(i)){let{cid:c}=await cf(t,e,o),{pinned:u,reason:f}=await t.pins.isPinnedWithType(c,Ct.all);if(!u)throw new Error(`${c} is not pinned`);switch(f){case Ct.recursive:if(!a)throw new Error(`${c} is pinned recursively`);await t.pins.unpin(c),yield c;break;case Ct.direct:await t.pins.unpin(c),yield c;break;default:throw new Error(`${c} is pinned indirectly under ${f}`)}}}finally{s()}}return ce(r)}var mE=class{constructor({codecs:e,repo:r}){let i=BK({codecs:e,repo:r});this.addAll=i,this.add=DK({addAll:i});let n=qK({codecs:e,repo:r});this.rmAll=n,this.rm=LK({rmAll:n}),this.ls=NK({codecs:e,repo:r}),this.remote={add:(s,o={})=>Promise.reject(new Error("Not implemented")),ls:async function*(s,o={}){return Promise.reject(new Error("Not implemented"))},rm:(s,o={})=>Promise.reject(new Error("Not implemented")),rmAll:(s,o={})=>Promise.reject(new Error("Not implemented")),service:{add:(s,o)=>Promise.reject(new Error("Not implemented")),rm:(s,o={})=>Promise.reject(new Error("Not implemented")),ls:(s={})=>Promise.reject(new Error("Not implemented"))}}}};l();l();var MV=M(it()),LV=M(Rt()),ME=M(Ee());l();var Fy=M(it());Br();Zo();var In=M(Rt()),PE=M(Ee());tt();wi();l();var SV=M(KK());Br();var q4=M(rc()),j4=M(it());Bn();Gc();var Oi=M(iV());yn();dt();tt();mn();wi();var SE=M(pV()),xE=M(Ee());l();var ed=M(Vi()),yV=ed.default.Reader,HAe=ed.default.Writer,Ye=ed.default.util,Ly=ed.default.roots["ipfs-ipns"]||(ed.default.roots["ipfs-ipns"]={}),X0=Ly.IpnsEntry=(()=>{function t(e){if(e)for(var r=Object.keys(e),i=0;i<r.length;++i)e[r[i]]!=null&&(this[r[i]]=e[r[i]])}return t.prototype.value=Ye.newBuffer([]),t.prototype.signature=Ye.newBuffer([]),t.prototype.validityType=0,t.prototype.validity=Ye.newBuffer([]),t.prototype.sequence=Ye.Long?Ye.Long.fromBits(0,0,!0):0,t.prototype.ttl=Ye.Long?Ye.Long.fromBits(0,0,!0):0,t.prototype.pubKey=Ye.newBuffer([]),t.prototype.signatureV2=Ye.newBuffer([]),t.prototype.data=Ye.newBuffer([]),t.encode=function(r,i){return i||(i=HAe.create()),r.value!=null&&Object.hasOwnProperty.call(r,"value")&&i.uint32(10).bytes(r.value),r.signature!=null&&Object.hasOwnProperty.call(r,"signature")&&i.uint32(18).bytes(r.signature),r.validityType!=null&&Object.hasOwnProperty.call(r,"validityType")&&i.uint32(24).int32(r.validityType),r.validity!=null&&Object.hasOwnProperty.call(r,"validity")&&i.uint32(34).bytes(r.validity),r.sequence!=null&&Object.hasOwnProperty.call(r,"sequence")&&i.uint32(40).uint64(r.sequence),r.ttl!=null&&Object.hasOwnProperty.call(r,"ttl")&&i.uint32(48).uint64(r.ttl),r.pubKey!=null&&Object.hasOwnProperty.call(r,"pubKey")&&i.uint32(58).bytes(r.pubKey),r.signatureV2!=null&&Object.hasOwnProperty.call(r,"signatureV2")&&i.uint32(66).bytes(r.signatureV2),r.data!=null&&Object.hasOwnProperty.call(r,"data")&&i.uint32(74).bytes(r.data),i},t.decode=function(r,i){r instanceof yV||(r=yV.create(r));for(var n=i===void 0?r.len:r.pos+i,s=new Ly.IpnsEntry;r.pos<n;){var o=r.uint32();switch(o>>>3){case 1:s.value=r.bytes();break;case 2:s.signature=r.bytes();break;case 3:s.validityType=r.int32();break;case 4:s.validity=r.bytes();break;case 5:s.sequence=r.uint64();break;case 6:s.ttl=r.uint64();break;case 7:s.pubKey=r.bytes();break;case 8:s.signatureV2=r.bytes();break;case 9:s.data=r.bytes();break;default:r.skipType(o&7);break}}return s},t.fromObject=function(r){if(r instanceof Ly.IpnsEntry)return r;var i=new Ly.IpnsEntry;switch(r.value!=null&&(typeof r.value=="string"?Ye.base64.decode(r.value,i.value=Ye.newBuffer(Ye.base64.length(r.value)),0):r.value.length&&(i.value=r.value)),r.signature!=null&&(typeof r.signature=="string"?Ye.base64.decode(r.signature,i.signature=Ye.newBuffer(Ye.base64.length(r.signature)),0):r.signature.length&&(i.signature=r.signature)),r.validityType){case"EOL":case 0:i.validityType=0;break}return r.validity!=null&&(typeof r.validity=="string"?Ye.base64.decode(r.validity,i.validity=Ye.newBuffer(Ye.base64.length(r.validity)),0):r.validity.length&&(i.validity=r.validity)),r.sequence!=null&&(Ye.Long?(i.sequence=Ye.Long.fromValue(r.sequence)).unsigned=!0:typeof r.sequence=="string"?i.sequence=parseInt(r.sequence,10):typeof r.sequence=="number"?i.sequence=r.sequence:typeof r.sequence=="object"&&(i.sequence=new Ye.LongBits(r.sequence.low>>>0,r.sequence.high>>>0).toNumber(!0))),r.ttl!=null&&(Ye.Long?(i.ttl=Ye.Long.fromValue(r.ttl)).unsigned=!0:typeof r.ttl=="string"?i.ttl=parseInt(r.ttl,10):typeof r.ttl=="number"?i.ttl=r.ttl:typeof r.ttl=="object"&&(i.ttl=new Ye.LongBits(r.ttl.low>>>0,r.ttl.high>>>0).toNumber(!0))),r.pubKey!=null&&(typeof r.pubKey=="string"?Ye.base64.decode(r.pubKey,i.pubKey=Ye.newBuffer(Ye.base64.length(r.pubKey)),0):r.pubKey.length&&(i.pubKey=r.pubKey)),r.signatureV2!=null&&(typeof r.signatureV2=="string"?Ye.base64.decode(r.signatureV2,i.signatureV2=Ye.newBuffer(Ye.base64.length(r.signatureV2)),0):r.signatureV2.length&&(i.signatureV2=r.signatureV2)),r.data!=null&&(typeof r.data=="string"?Ye.base64.decode(r.data,i.data=Ye.newBuffer(Ye.base64.length(r.data)),0):r.data.length&&(i.data=r.data)),i},t.toObject=function(r,i){i||(i={});var n={};if(i.defaults){if(i.bytes===String?n.value="":(n.value=[],i.bytes!==Array&&(n.value=Ye.newBuffer(n.value))),i.bytes===String?n.signature="":(n.signature=[],i.bytes!==Array&&(n.signature=Ye.newBuffer(n.signature))),n.validityType=i.enums===String?"EOL":0,i.bytes===String?n.validity="":(n.validity=[],i.bytes!==Array&&(n.validity=Ye.newBuffer(n.validity))),Ye.Long){var s=new Ye.Long(0,0,!0);n.sequence=i.longs===String?s.toString():i.longs===Number?s.toNumber():s}else n.sequence=i.longs===String?"0":0;if(Ye.Long){var s=new Ye.Long(0,0,!0);n.ttl=i.longs===String?s.toString():i.longs===Number?s.toNumber():s}else n.ttl=i.longs===String?"0":0;i.bytes===String?n.pubKey="":(n.pubKey=[],i.bytes!==Array&&(n.pubKey=Ye.newBuffer(n.pubKey))),i.bytes===String?n.signatureV2="":(n.signatureV2=[],i.bytes!==Array&&(n.signatureV2=Ye.newBuffer(n.signatureV2))),i.bytes===String?n.data="":(n.data=[],i.bytes!==Array&&(n.data=Ye.newBuffer(n.data)))}return r.value!=null&&r.hasOwnProperty("value")&&(n.value=i.bytes===String?Ye.base64.encode(r.value,0,r.value.length):i.bytes===Array?Array.prototype.slice.call(r.value):r.value),r.signature!=null&&r.hasOwnProperty("signature")&&(n.signature=i.bytes===String?Ye.base64.encode(r.signature,0,r.signature.length):i.bytes===Array?Array.prototype.slice.call(r.signature):r.signature),r.validityType!=null&&r.hasOwnProperty("validityType")&&(n.validityType=i.enums===String?Ly.IpnsEntry.ValidityType[r.validityType]:r.validityType),r.validity!=null&&r.hasOwnProperty("validity")&&(n.validity=i.bytes===String?Ye.base64.encode(r.validity,0,r.validity.length):i.bytes===Array?Array.prototype.slice.call(r.validity):r.validity),r.sequence!=null&&r.hasOwnProperty("sequence")&&(typeof r.sequence=="number"?n.sequence=i.longs===String?String(r.sequence):r.sequence:n.sequence=i.longs===String?Ye.Long.prototype.toString.call(r.sequence):i.longs===Number?new Ye.LongBits(r.sequence.low>>>0,r.sequence.high>>>0).toNumber(!0):r.sequence),r.ttl!=null&&r.hasOwnProperty("ttl")&&(typeof r.ttl=="number"?n.ttl=i.longs===String?String(r.ttl):r.ttl:n.ttl=i.longs===String?Ye.Long.prototype.toString.call(r.ttl):i.longs===Number?new Ye.LongBits(r.ttl.low>>>0,r.ttl.high>>>0).toNumber(!0):r.ttl),r.pubKey!=null&&r.hasOwnProperty("pubKey")&&(n.pubKey=i.bytes===String?Ye.base64.encode(r.pubKey,0,r.pubKey.length):i.bytes===Array?Array.prototype.slice.call(r.pubKey):r.pubKey),r.signatureV2!=null&&r.hasOwnProperty("signatureV2")&&(n.signatureV2=i.bytes===String?Ye.base64.encode(r.signatureV2,0,r.signatureV2.length):i.bytes===Array?Array.prototype.slice.call(r.signatureV2):r.signatureV2),r.data!=null&&r.hasOwnProperty("data")&&(n.data=i.bytes===String?Ye.base64.encode(r.data,0,r.data.length):i.bytes===Array?Array.prototype.slice.call(r.data):r.data),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,ed.default.util.toJSONOptions)},t.ValidityType=function(){let e={},r=Object.create(e);return r[e[0]="EOL"]=0,r}(),t})();l();function M4(t){let e=new RegExp("(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d+)Z"),r=String(t).trim().match(e);if(!r)throw new Error("Invalid format");let i=parseInt(r[1],10),n=parseInt(r[2],10)-1,s=parseInt(r[3],10),o=parseInt(r[4],10),a=parseInt(r[5],10),c=parseInt(r[6],10),u=parseInt(r[7].slice(0,-6),10);return new Date(Date.UTC(i,n,s,o,a,c,u))}l();var gV="ERR_IPNS_EXPIRED_RECORD",EE="ERR_UNRECOGNIZED_VALIDITY",mV="ERR_SIGNATURE_CREATION",td="ERR_SIGNATURE_VERIFICATION",bV="ERR_UNRECOGNIZED_FORMAT",vV="ERR_PEER_ID_FROM_PUBLIC_KEY",wV="ERR_PUBLIC_KEY_FROM_ID",L4="ERR_UNDEFINED_PARAMETER",_V="ERR_INVALID_RECORD_DATA",EV="ERR_INVALID_EMBEDDED_KEY";var xs=Object.assign((0,xE.default)("jsipns"),{error:(0,xE.default)("jsipns:error")}),GAe=_s.code,$Ae=Xe("/ipns/"),qy="/ipns/",U4=qy.length,xV=(t,e,r,i)=>{let n=new SV.default(Date.now()+Number(i)),s=X0.ValidityType.EOL,[o,a]=i.toString().split("."),c=BigInt(o)*BigInt(1e5)+BigInt(a||0);return WAe(t,e,r,s,n,c)};var WAe=async(t,e,r,i,n,s)=>{r=BigInt(r);let o=Xe(n.toString()),a=await QAe(t,e,i,o),c=YAe(e,o,i,r,s),u=TV(c),f=await t.sign(u),d={value:e,signature:a,validityType:i,validity:o,sequence:r,ttl:s,signatureV2:f,data:c};return xs(`ipns entry for ${e} created`),d},YAe=(t,e,r,i,n)=>jo({Value:t,Validity:e,ValidityType:r,Sequence:i,TTL:n}),AE=async(t,e)=>{let{value:r,validityType:i,validity:n}=e,s,o;e.signatureV2&&e.data?(o=e.signatureV2,s=TV(e.data),XAe(e)):(o=e.signature,s=IV(r,i,n));let a;try{a=await t.verify(s,o)}catch(c){a=!1}if(!a)throw xs.error("record signature verification failed"),(0,Oi.default)(new Error("record signature verification failed"),td);if(i===X0.ValidityType.EOL){let c;try{c=M4(Ge(n))}catch(u){throw xs.error("unrecognized validity format (not an rfc3339 format)"),(0,Oi.default)(new Error("unrecognized validity format (not an rfc3339 format)"),bV)}if(c.getTime()<Date.now())throw xs.error("record has expired"),(0,Oi.default)(new Error("record has expired"),gV)}else if(i)throw xs.error("unrecognized validity type"),(0,Oi.default)(new Error("unrecognized validity type"),EE);xs(`ipns entry for ${r} is valid`)},XAe=t=>{if(!t.data)throw(0,Oi.default)(new Error("Record data is missing"),_V);let e=Qn(t.data);if(Number.isInteger(e.Sequence)&&(e.Sequence=BigInt(e.Sequence)),Number.isInteger(e.TTL)&&(e.TTL=BigInt(e.TTL)),!Ba(e.Value,t.value))throw(0,Oi.default)(new Error('Field "value" did not match between protobuf and CBOR'),td);if(!Ba(e.Validity,t.validity))throw(0,Oi.default)(new Error('Field "validity" did not match between protobuf and CBOR'),td);if(e.ValidityType!==t.validityType)throw(0,Oi.default)(new Error('Field "validityType" did not match between protobuf and CBOR'),td);if(e.Sequence!==t.sequence)throw(0,Oi.default)(new Error('Field "sequence" did not match between protobuf and CBOR'),td);if(e.TTL!==t.ttl)throw(0,Oi.default)(new Error('Field "ttl" did not match between protobuf and CBOR'),td)},AV=async(t,e)=>{if(!t||!t.bytes||!e){let n=new Error("one or more of the provided parameters are not defined");throw xs.error(n),(0,Oi.default)(n,L4)}let r;try{r=await j4.default.createFromPubKey(t.bytes)}catch(n){throw(0,Oi.default)(n,vV)}let i;try{i=JAe(r)}catch(n){throw xs.error(n),(0,Oi.default)(n,wV)}if(i)return null;try{e.pubKey=q4.default.keys.marshalPublicKey(t)}catch(n){throw xs.error(n),n}return e},IE=async(t,e)=>{if(!e||!t){let i=new Error("one or more of the provided parameters are not defined");throw xs.error(i),(0,Oi.default)(i,L4)}let r;if(e.pubKey){try{r=q4.default.keys.unmarshalPublicKey(e.pubKey)}catch(n){throw xs.error(n),n}if(!(await j4.default.createFromPubKey(e.pubKey)).equals(t))throw(0,Oi.default)(new Error("Embedded public key did not match PeerID"),EV)}else t.pubKey&&(r=t.pubKey);if(r)return r;throw(0,Oi.default)(new Error("no public key is available"),L4)},TE=t=>Lw.encode(t).slice(1),jy=t=>new qe(`/ipns/${TE(t)}`),rd=t=>{let e=Xe("/pk/"),r=Xe("/ipns/");return{routingPubKey:new qe(gn([e,t]),!1),pkKey:new qe(TE(gn([e,t]))),routingKey:new qe(gn([r,t]),!1),ipnsKey:new qe(TE(gn([r,t])))}},QAe=(t,e,r,i)=>{try{let n=IV(e,r,i);return t.sign(n)}catch(n){throw xs.error("record signature creation failed"),(0,Oi.default)(new Error("record signature creation failed: "+n.message),mV)}},ZAe=t=>{if(t.toString()==="0")return"EOL";let e=new Error(`unrecognized validity type ${t.toString()}`);throw xs.error(e),(0,Oi.default)(e,EE)},IV=(t,e,r)=>{let i=Xe(ZAe(e));return gn([t,r,i])},TV=t=>{let e=Xe("ipns-signature:");return gn([e,t])},JAe=t=>{let e=Ri(t.id);return e.code!==GAe?null:q4.default.keys.unmarshalPublicKey(e.digest)},RE=t=>X0.encode({...t,sequence:SE.default.fromString(t.sequence.toString()),ttl:t.ttl==null?void 0:SE.default.fromString(t.ttl.toString())}).finish(),cu=t=>{let e=X0.decode(t),r=X0.toObject(e,{defaults:!1,arrays:!0,objects:!1});return{value:r.value,signature:r.signature,validityType:r.validityType,validity:r.validity,sequence:Object.hasOwnProperty.call(r,"sequence")?BigInt(`${r.sequence}`):0,pubKey:r.pubKey,ttl:Object.hasOwnProperty.call(r,"ttl")?BigInt(`${r.ttl}`):void 0,signatureV2:r.signatureV2,data:r.data}},Uy={validate:async(t,e)=>{let r=cu(t),i=e.slice($Ae.length),n=j4.default.createFromBytes(i),s=await IE(n,r);await AE(s,r)},select:(t,e)=>{let r=cu(t),i=cu(e);if(r.signatureV2&&!i.signatureV2)return 0;if(i.signatureV2&&!r.signatureV2)return 1;if(r.sequence>i.sequence)return 0;if(r.sequence<i.sequence)return 1;let n=M4(Ge(r.validity));return M4(Ge(i.validity)).getTime()>n.getTime()?1:0}};var ki=Object.assign((0,PE.default)("ipfs:ipns:publisher"),{error:(0,PE.default)("ipfs:ipns:publisher:error")}),RV=un().code,PV=60*60*1e3,Q0=class{constructor(e,r){this._routing=e,this._datastore=r}async publishWithEOL(e,r,i){if(!e||!e.bytes)throw(0,In.default)(new Error("invalid private key"),"ERR_INVALID_PRIVATE_KEY");let n=await Fy.default.createFromPrivKey(e.bytes),s=await this._updateOrCreateRecord(e,r,i,n);return this._putRecordToRouting(s,n)}publish(e,r){return this.publishWithEOL(e,r,PV)}async _putRecordToRouting(e,r){if(!Fy.default.isPeerId(r)){let o="peerId received is not valid";throw ki.error(o),(0,In.default)(new Error(o),"ERR_INVALID_PEER_ID")}let i=r._pubKey,n=await AV(i,e),s=rd(r.toBytes());return await this._publishEntry(s.routingKey,n||e),await this._publishPublicKey(s.routingPubKey,i),n||e}async _publishEntry(e,r){let i=qe.asKey(e);if(!i){let s="datastore key does not have a valid format";throw ki.error(s),(0,In.default)(new Error(s),"ERR_INVALID_DATASTORE_KEY")}let n;try{n=RE(r)}catch(s){throw ki.error(s),s}try{let s=await this._routing.put(i.uint8Array(),n);return ki(`ipns record for ${Ge(i.uint8Array(),"base64")} was stored in the routing`),s}catch(s){let o=`ipns record for ${Ge(i.uint8Array(),"base64")} could not be stored in the routing`;throw ki.error(o),ki.error(s),(0,In.default)(new Error(o),"ERR_PUTTING_TO_ROUTING")}}async _publishPublicKey(e,r){let i=qe.asKey(e);if(!i){let n="datastore key does not have a valid format";throw ki.error(n),(0,In.default)(new Error(n),"ERR_INVALID_DATASTORE_KEY")}if(!r||!r.bytes){let n="one or more of the provided parameters are not defined";throw ki.error(n),(0,In.default)(new Error(n),"ERR_UNDEFINED_PARAMETER")}try{let n=await this._routing.put(i.uint8Array(),r.bytes);return ki(`public key for ${Ge(i.uint8Array(),"base64")} was stored in the routing`),n}catch(n){let s=`public key for ${Ge(i.uint8Array(),"base64")} could not be stored in the routing`;throw ki.error(s),ki.error(n),(0,In.default)(new Error(s),"ERR_PUTTING_TO_ROUTING")}}async _getPublished(e,r={}){if(!Fy.default.isPeerId(e)){let n="peerId received is not valid";throw ki.error(n),(0,In.default)(new Error(n),"ERR_INVALID_PEER_ID")}let i=r.checkRouting!==!1;try{let n=await this._datastore.get(jy(e.id));return this._unmarshalData(n)}catch(n){if(n.code!==RV){let s=`unexpected error getting the ipns record ${e.id} from datastore`;throw ki.error(s),(0,In.default)(new Error(s),"ERR_UNEXPECTED_DATASTORE_RESPONSE")}if(!i)throw(0,In.default)(n,"ERR_NOT_FOUND_AND_CHECK_ROUTING_NOT_ENABLED");try{let s=rd(e.toBytes()),o=await this._routing.get(s.routingKey.uint8Array());return this._unmarshalData(o)}catch(s){throw ki.error(s),s}}}_unmarshalData(e){try{return cu(e)}catch(r){throw(0,In.default)(r,"ERR_INVALID_RECORD_DATA")}}async _updateOrCreateRecord(e,r,i,n){if(!Fy.default.isPeerId(n)){let u="peerId received is not valid";throw ki.error(u),(0,In.default)(new Error(u),"ERR_INVALID_PEER_ID")}let s={checkRouting:!0},o;try{o=await this._getPublished(n,s)}catch(u){if(u.code!==RV){let f=`unexpected error when determining the last published IPNS record for ${n.id} ${u.stack}`;throw ki.error(f),(0,In.default)(new Error(f),"ERR_DETERMINING_PUBLISHED_RECORD")}}let a=0n;o&&o.sequence!==void 0&&(a=Ba(o.value,r)?BigInt(o.sequence):BigInt(o.sequence)+BigInt(1));let c;try{c=await xV(e,r,a,i)}catch(u){let f=`ipns record for ${r} could not be created`;throw ki.error(u),(0,In.default)(new Error(f),"ERR_CREATING_IPNS_RECORD")}try{let u=RE(c);return await this._datastore.put(jy(n.id),u),ki(`ipns record for ${Ge(r,"base32")} was stored in the datastore`),c}catch(u){let f=`ipns record for ${r} could not be stored in the datastore`;throw ki.error(f),(0,In.default)(new Error(f),"ERR_STORING_IN_DATASTORE")}}};Q0.defaultRecordLifetime=PV;l();var CV=M(rc()),CE=M(it()),If=M(Rt()),OE=M(Ee()),F4=Object.assign((0,OE.default)("ipfs:ipns:republisher"),{error:(0,OE.default)("ipfs:ipns:republisher:error")}),OV=60*1e3,kV=60*OV,eIe=4*kV,tIe=24*kV,kE=class{constructor(e,r,i,n,s={pass:""}){this._publisher=e,this._datastore=r,this._peerId=i,this._keychain=n,this._options=s,this._republishHandle=null}async start(){if(this._republishHandle)throw(0,If.default)(new Error("republisher is already running"),"ERR_REPUBLISH_ALREADY_RUNNING");let e={_task:null,_inflightTask:null,_timeoutId:null,runPeriodically:s=>{e._timeoutId=setTimeout(async()=>{e._timeoutId=null;try{e._inflightTask=e._task(),await e._inflightTask,e._task&&e.runPeriodically(s)}catch(o){F4.error(o)}},s())},cancel:async()=>{e._timeoutId!=null&&clearTimeout(e._timeoutId),e._task=null,await e._inflightTask}},{privKey:r}=this._peerId,{pass:i}=this._options,n=!0;e._task=()=>this._republishEntries(r,i),e.runPeriodically(()=>n?(n=!1,this._options.initialBroadcastInterval||OV):this._options.broadcastInterval||eIe),this._republishHandle=e}async stop(){let e=this._republishHandle;if(!e)throw(0,If.default)(new Error("republisher is not running"),"ERR_REPUBLISH_NOT_RUNNING");this._republishHandle=null,await e.cancel()}async _republishEntries(e,r){try{await this._republishEntry(e)}catch(i){let n="cannot republish entry for the node's private key";F4.error(n);return}if(r)try{let i=await this._keychain.listKeys();for(let n of i){if(n.name==="self")continue;let s=await this._keychain.exportKey(n.name,r),o=await CV.default.keys.import(s,r);await this._republishEntry(o)}}catch(i){F4.error(i)}}async _republishEntry(e){if(!e||!e.bytes)throw(0,If.default)(new Error("invalid private key"),"ERR_INVALID_PRIVATE_KEY");try{let r=await CE.default.createFromPrivKey(e.bytes),i=await this._getPreviousValue(r);await this._publisher.publishWithEOL(e,i,tIe)}catch(r){if(r.code==="ERR_NO_ENTRY_FOUND")return;throw r}}async _getPreviousValue(e){if(!CE.default.isPeerId(e))throw(0,If.default)(new Error("invalid peer ID"),"ERR_INVALID_PEER_ID");try{let r=await this._datastore.get(jy(e.id));if(!(r instanceof Uint8Array))throw(0,If.default)(new Error("found ipns record that we couldn't process"),"ERR_INVALID_IPNS_RECORD");try{return cu(r).value}catch(i){throw F4.error(i),(0,If.default)(new Error("found ipns record that we couldn't convert to a value"),"ERR_INVALID_IPNS_RECORD")}}catch(r){throw r&&r.notFound?(0,If.default)(new Error(`no previous entry for record with id: ${e.id}`),"ERR_NO_ENTRY_FOUND"):r}}};l();var DV=M(it()),id=M(Rt()),DE=M(Ee());tt();Zo();var K4=Object.assign((0,DE.default)("ipfs:ipns:resolver"),{error:(0,DE.default)("ipfs:ipns:resolver:error")}),rIe=un().code,BV=32,BE=class{constructor(e){this._routing=e}async resolve(e,r={}){if(typeof e!="string")throw(0,id.default)(new Error("invalid name"),"ERR_INVALID_NAME");let i=r.recursive&&r.recursive.toString()==="true",n=e.split("/");if(n.length!==3||n[0]!=="")throw(0,id.default)(new Error("invalid name"),"ERR_INVALID_NAME");let s=n[2],o=1/0;i&&(o=BV);let a=await this.resolver(s,o);return K4(`${e} was locally resolved correctly`),a}async resolver(e,r){if(r===0){let s=`could not resolve name (recursion limit of ${BV} exceeded)`;throw K4.error(s),(0,id.default)(new Error(s),"ERR_RESOLVE_RECURSION_LIMIT")}let i=await this._resolveName(e),n=i.split("/");return n[1]==="ipfs"||!r?i:this.resolver(n[2],r-1)}async _resolveName(e){let r=DV.default.parse(e),{routingKey:i}=rd(r.toBytes()),n;try{n=await this._routing.get(i.uint8Array())}catch(o){throw K4.error("could not get record from routing",o),o.code===rIe?(0,id.default)(new Error(`record requested for ${e} was not found in the network`),"ERR_NO_RECORD_FOUND"):(0,id.default)(new Error(`unexpected error getting the ipns record ${r.toString()}`),"ERR_UNEXPECTED_ERROR_GETTING_RECORD")}let s;try{s=cu(n)}catch(o){throw K4.error("could not unmarshal record",o),(0,id.default)(new Error("found ipns record that we couldn't convert to a value"),"ERR_INVALID_RECORD_RECEIVED")}return this._validateRecord(r,s)}async _validateRecord(e,r){let i=await IE(e,r);return await AE(i,r),Ge(r.value)}};l();var NV=M(g0()),NE=class{constructor(e){this.lru=(0,NV.default)(e)}get(e){let r=this.lru.get(e);if(r){if(r.expire&&r.expire<Date.now()){this.lru.remove(e);return}return r.value}}set(e,r,i){this.lru.set(e,{value:r,expire:Date.now()+i})}has(e){return!!this.get(e)}remove(e){this.lru.remove(e)}clear(){this.lru.clear()}};tt();var Ky=Object.assign((0,ME.default)("ipfs:ipns"),{error:(0,ME.default)("ipfs:ipns:error")}),qV=60*1e3,V4=class{constructor(e,r,i,n,s){this.publisher=new Q0(e,r),this.republisher=new kE(this.publisher,r,i,n,s),this.resolver=new BE(e),this.cache=new NE(1e3),this.routing=e}async publish(e,r,i=Q0.defaultRecordLifetime){try{let n=await(0,MV.createFromPrivKey)(e.bytes);await this.publisher.publishWithEOL(e,r,i),Ky(`IPNS value ${Ge(r,"base32")} was published correctly`);let s=n.toB58String(),o=parseFloat(i),a=o<qV?o:qV;return this.cache.set(s,r,a),Ky(`IPNS value ${Ge(r,"base32")} was cached correctly`),{name:s,value:r}}catch(n){throw Ky.error(n),n}}async resolve(e,r={}){if(typeof e!="string")throw(0,LV.default)(new Error("name received is not valid"),"ERR_INVALID_NAME");if(!r.nocache&&!r.recursive){let i=e.split("/")[2],n=this.cache.get(i);if(n)return n}try{let i=await this.resolver.resolve(e,r);return Ky(`IPNS record from ${e} was resolved correctly`),i}catch(i){throw Ky.error(i),i}}async initializeKeyspace(e,r){return this.publish(e,r,Q0.defaultRecordLifetime)}};l();l();od();Zo();var YV=M(Ee()),KE=M(nc()),VE=M(ic()),aIe=(0,YV.default)("datastore:core:tiered"),H4=class extends As{constructor(e){super();this.stores=e.slice()}async open(){try{await Promise.all(this.stores.map(e=>e.open()))}catch(e){throw O4()}}async put(e,r){try{await Promise.all(this.stores.map(i=>i.put(e,r)))}catch(i){throw D4()}}async get(e,r){for(let i of this.stores)try{let n=await i.get(e,r);if(n)return n}catch(n){aIe(n)}throw un()}async has(e,r){for(let i of this.stores)if(await i.has(e,r))return!0;return!1}async delete(e,r){try{await Promise.all(this.stores.map(i=>i.delete(e,r)))}catch(i){throw k4()}}async*putMany(e,r={}){let i,n=this.stores.map(s=>{let o=(0,KE.default)();return(0,VE.default)(s.putMany(o,r)).catch(a=>{i=a}),o});try{for await(let s of e){if(i)throw i;n.forEach(o=>o.push(s)),yield s}}finally{n.forEach(s=>s.end())}}async*deleteMany(e,r={}){let i,n=this.stores.map(s=>{let o=(0,KE.default)();return(0,VE.default)(s.deleteMany(o,r)).catch(a=>{i=a}),o});try{for await(let s of e){if(i)throw i;n.forEach(o=>o.push(s)),yield s}}finally{n.forEach(s=>s.end())}}async close(){await Promise.all(this.stores.map(e=>e.close()))}batch(){let e=this.stores.map(r=>r.batch());return{put:(r,i)=>{e.forEach(n=>n.put(r,i))},delete:r=>{e.forEach(i=>i.delete(r))},commit:async r=>{for(let i of e)await i.commit(r)}}}query(e,r){return this.stores[this.stores.length-1].query(e,r)}queryKeys(e,r){return this.stores[this.stores.length-1].queryKeys(e,r)}};var Z4=M(Vy());l();li();l();l();Br();l();Zo();var QE={};zt(QE,{NextToLast:()=>XE,PREFIX:()=>G4,Prefix:()=>WE,README_FN:()=>$E,SHARDING_FN:()=>$4,ShardBase:()=>zy,Suffix:()=>YE,parseShardFun:()=>XV,readShardFun:()=>QV,readme:()=>GE});l();Br();l();var GE=`This is a repository of IPLD objects. Each IPLD object is in a single file,
named <base32 encoding of cid>.data. Where <base32 encoding of cid> is the
"base32" encoding of the CID (as specified in
https://github.com/multiformats/multibase) without the 'B' prefix.
All the object files are placed in a tree of directories, based on a
function of the CID. This is a form of sharding similar to
the objects directory in git repositories. Previously, we used
prefixes, we now use the next-to-last two charters.
func NextToLast(base32cid string) {
nextToLastLen := 2
offset := len(base32cid) - nextToLastLen - 1
return str[offset : offset+nextToLastLen]
}
For example, an object with a base58 CIDv1 of
zb2rhYSxw4ZjuzgCnWSt19Q94ERaeFhu9uSqRgjSdx9bsgM6f
has a base32 CIDv1 of
BAFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA
and will be placed at
SC/AFKREIA22FLID5AJ2KU7URG47MDLROZIH6YF2KALU2PWEFPVI37YLKRSCA.data
with 'SC' being the last-to-next two characters and the 'B' at the
beginning of the CIDv1 string is the multibase prefix that is not
stored in the filename.
`;var G4="/repo/flatfs/shard/",$4="SHARDING",$E="_README",zy=class{constructor(e){this.param=e,this.name="base",this._padding=""}fun(e){return"implement me"}toString(){return`${G4}v1/${this.name}/${this.param}`}},WE=class extends zy{constructor(e){super(e);this._padding="".padStart(e,"_"),this.name="prefix"}fun(e){return(e+this._padding).slice(0,this.param)}},YE=class extends zy{constructor(e){super(e);this._padding="".padStart(e,"_"),this.name="suffix"}fun(e){let r=this._padding+e;return r.slice(r.length-this.param)}},XE=class extends zy{constructor(e){super(e);this._padding="".padStart(e+1,"_"),this.name="next-to-last"}fun(e){let r=this._padding+e,i=r.length-this.param-1;return r.slice(i,i+this.param)}};function XV(t){if(t=t.trim(),t.length===0)throw new Error("empty shard string");if(!t.startsWith(G4))throw new Error(`invalid or no path prefix: ${t}`);let e=t.slice(G4.length).split("/"),r=e[0];if(r!=="v1")throw new Error(`expect 'v1' version, got '${r}'`);let i=e[1];if(!e[2])throw new Error("missing param");let n=parseInt(e[2],10);switch(i){case"prefix":return new WE(n);case"suffix":return new YE(n);case"next-to-last":return new XE(n);default:throw new Error(`unkown sharding function: ${i}`)}}var QV=async(t,e)=>{let r=new qe(t).child(new qe($4)),n=await(typeof e.getRaw=="function"?e.getRaw.bind(e):e.get.bind(e))(r);return XV(new TextDecoder().decode(n||"").trim())};od();JE();l();od();var fIe=M(oo()),lIe=M(Nr());l();od();Zo();var aut=new qe($4),cut=new qe($E);l();var pIe=M(ea()),yIe=M(Z0()),gIe=M(ep());od();Zo();LE();Br();l();var tp={...bE},xut={...QE};l();var sz=M(rS());tt();dt();var Y4="/record/";function iS(t){return Ge(t,"base32")}function Hy(t){(typeof t=="string"||t instanceof String)&&(t=Xe(t.toString()));let e=Ge(t,"base64url");return`${Y4}${e}`}function oz(t){if(t.substring(0,Y4.length)!==Y4)throw(0,sz.default)(new Error("topic received is not from a record"),"ERR_TOPIC_IS_NOT_FROM_RECORD_NAMESPACE");let e=t.substring(Y4.length);return Xe(e,"base64url")}wi();var Is=M(rS()),nS=M(Ee()),Tn=Object.assign((0,nS.default)("datastore-pubsub:publisher"),{error:(0,nS.default)("datastore-pubsub:publisher:error")}),sS=class extends As{constructor(e,r,i,n,s){super();if(!n)throw(0,Is.default)(new TypeError("missing validator"),"ERR_INVALID_PARAMETERS");if(typeof n.validate!="function")throw(0,Is.default)(new TypeError("missing validate function"),"ERR_INVALID_PARAMETERS");if(typeof n.select!="function")throw(0,Is.default)(new TypeError("missing select function"),"ERR_INVALID_PARAMETERS");if(s&&typeof s!="function")throw(0,Is.default)(new TypeError("invalid subscriptionKeyFn received"),"ERR_INVALID_PARAMETERS");this._pubsub=e,this._datastore=r,this._peerId=i,this._validator=n,this._handleSubscriptionKeyFn=s,this._onMessage=this._onMessage.bind(this)}async put(e,r){if(!(e instanceof Uint8Array)){let n="datastore key does not have a valid format";throw Tn.error(n),(0,Is.default)(new Error(n),"ERR_INVALID_DATASTORE_KEY")}if(!(r instanceof Uint8Array)){let n="received value is not a Uint8Array";throw Tn.error(n),(0,Is.default)(new Error(n),"ERR_INVALID_VALUE_RECEIVED")}let i=Hy(e);Tn(`publish value for topic ${i}`),await this._pubsub.publish(i,r)}async get(e){if(!(e instanceof Uint8Array)){let n="datastore key does not have a valid format";throw Tn.error(n),(0,Is.default)(new Error(n),"ERR_INVALID_DATASTORE_KEY")}let r=Hy(e),i=await this._pubsub.getTopics();if(i&&Array.isArray(i)&&i.indexOf(r)>-1)return this._getLocal(e);try{this._pubsub.on(r,this._onMessage),await this._pubsub.subscribe(r)}catch(n){let s=`cannot subscribe topic ${r}`;throw Tn.error(s),(0,Is.default)(new Error(s),"ERR_SUBSCRIBING_TOPIC")}return Tn(`subscribed values for key ${r}`),this._getLocal(e)}unsubscribe(e){let r=Hy(e);return this._pubsub.removeListener(r,this._onMessage),this._pubsub.unsubscribe(r)}async _getLocal(e){let r=new qe("/"+iS(e),!1),i;try{i=await this._datastore.get(r)}catch(n){if(n.code!=="ERR_NOT_FOUND"){let o=`unexpected error getting the ipns record for ${r.toString()}`;throw Tn.error(o),(0,Is.default)(new Error(o),"ERR_UNEXPECTED_ERROR_GETTING_RECORD")}let s=`local record requested was not found for ${r.toString()}`;throw Tn.error(s),(0,Is.default)(new Error(s),"ERR_NOT_FOUND")}if(!(i instanceof Uint8Array)){let n="found record that we couldn't convert to a value";throw Tn.error(n),(0,Is.default)(new Error(n),"ERR_INVALID_RECORD_RECEIVED")}return i}async _onMessage(e){let{data:r,from:i,topicIDs:n}=e,s;try{s=oz(n[0])}catch(o){Tn.error(o);return}if(Tn(`message received for topic ${n[0]}`),i===this._peerId.toB58String()){Tn("message discarded as it is from the same peer");return}if(this._handleSubscriptionKeyFn){let o;try{o=await this._handleSubscriptionKeyFn(s)}catch(a){Tn.error("message discarded by the subscriptionKeyFn");return}s=o}try{await this._storeIfSubscriptionIsBetter(s,r)}catch(o){Tn.error(o)}}async _storeIfSubscriptionIsBetter(e,r){let i=!1;try{i=await this._isBetter(e,r)}catch(n){if(n.code!=="ERR_NOT_VALID_RECORD")throw n}i&&await this._storeRecord(e,r)}async _validateRecord(e,r){return this._validator.validate(e,r)}async _selectRecord(e,r){return await this._validator.select(e,r)===0}async _isBetter(e,r){try{await this._validateRecord(r,e)}catch(s){let o="record received through pubsub is not valid";throw Tn.error(o),(0,Is.default)(new Error(o),"ERR_NOT_VALID_RECORD")}let i=new qe(e),n;try{n=await this._getLocal(i.uint8Array())}catch(s){return!0}return Ba(n,r)?!1:this._selectRecord(e,[n,r])}async _storeRecord(e,r){let i=new qe("/"+iS(e),!1);await this._datastore.put(i,r),Tn(`record for ${Hy(e)} was stored in the datastore`)}};dt();tt();var oS=M(Rt()),aS=M(Ee()),cS=Object.assign((0,aS.default)("ipfs:ipns:pubsub"),{error:(0,aS.default)("ipfs:ipns:pubsub:error")}),rp=class{constructor(e,r,i){this._subscriptions={},this._handleSubscriptionKey=this._handleSubscriptionKey.bind(this),this._pubsubDs=new sS(e,r,i,Uy,this._handleSubscriptionKey)}put(e,r){return this._pubsubDs.put(e,r)}async get(e){let r,i;try{r=await this._pubsubDs.get(e)}catch(s){i=s}let n=e.slice(0,U4);if(Ge(n)===qy){let s=pt.encode(e).substring(1),o=pt.encode(e.slice(U4)).substring(1);this._subscriptions[s]=o,cS(`subscribed to pubsub topic ${s}, id ${o}`)}if(i)throw i;return r}_handleSubscriptionKey(e){e instanceof Uint8Array&&(e=Ge(e,"base58btc"));let r=this._subscriptions[e];if(!r)throw(0,oS.default)(new Error(`key ${e} does not correspond to a subscription`),"ERR_INVALID_KEY");let i;try{i=rd(Xe(r,"base58btc"))}catch(n){throw cS.error(n),n}return i.routingKey.uint8Array()}getSubscriptions(){return Object.values(this._subscriptions).filter(Boolean).map(r=>`${qy}${r}`)}async cancel(e){if(typeof e!="string")throw(0,oS.default)(new Error("invalid subscription name"),"ERR_INVALID_SUBSCRIPTION_NAME");e.startsWith(qy)&&(e=e.substring(U4));let r=Object.keys(this._subscriptions).find(n=>this._subscriptions[n]===e);if(!r)return{canceled:!1};let i=Xe(r);return this._pubsubDs.unsubscribe(i),delete this._subscriptions[r],cS(`unsubscribed pubsub ${r}: ${e}`),{canceled:!0}}};l();Br();var dS=M(ad()),np=M(Rt()),hS=M(Ee());tt();var pS=Object.assign((0,hS.default)("ipfs:ipns:offline-datastore"),{error:(0,hS.default)("ipfs:ipns:offline-datastore:error")}),Wy=class{constructor(e){this._repo=e,this.stores=[]}async put(e,r){if(!(e instanceof Uint8Array))throw(0,np.default)(new Error("Offline datastore key must be a Uint8Array"),"ERR_INVALID_KEY");if(!(r instanceof Uint8Array))throw(0,np.default)(new Error("Offline datastore value must be a Uint8Array"),"ERR_INVALID_VALUE");let i;try{i=this._routingKey(e)}catch(s){throw pS.error(s),(0,np.default)(new Error("Not possible to generate the routing key"),"ERR_GENERATING_ROUTING_KEY")}let n=new dS.Record(e,r);return this._repo.datastore.put(i,n.serialize())}async get(e){if(!(e instanceof Uint8Array))throw(0,np.default)(new Error("Offline datastore key must be a Uint8Array"),"ERR_INVALID_KEY");let r;try{r=this._routingKey(e)}catch(s){throw pS.error(s),(0,np.default)(new Error("Not possible to generate the routing key"),"ERR_GENERATING_ROUTING_KEY")}let i=await this._repo.datastore.get(r),n;try{n=dS.Record.deserialize(i)}catch(s){throw pS.error(s),s}return n.value}_routingKey(e){return new qe("/"+Ge(e,"base32upper"),!1)}};function Pz({libp2p:t,repo:e,peerId:r,options:i}){let n=[],s;if((0,Z4.default)(i,"EXPERIMENTAL.ipnsPubsub",!1)){let o=t.pubsub,a=e.datastore;s=new rp(o,a,r),n.push(s)}if((0,Z4.default)(i,"offline")||!(0,Z4.default)(i,"libp2p.config.dht.enabled",!1)){let o=new Wy(e);n.push(o)}else n.push(t._dht);return new H4(n)}var Cz=M(Ee()),CIe=(0,Cz.default)("ipfs:components:ipns"),yS=class{constructor(e={pass:""}){this.options=e,this.offline=null,this.online=null}getIPNS(){let e=this.online||this.offline;if(e)return e;throw new ef}get routing(){return this.getIPNS().routing}startOffline({repo:e,peerId:r,keychain:i}){if(this.offline!=null)throw new ka;CIe("initializing IPNS keyspace");let n=new Wy(e),s=new V4(n,e.datastore,r,i,this.options);this.offline=s}async startOnline({libp2p:e,repo:r,peerId:i,keychain:n}){if(this.online!=null)throw new ka;let s=Pz({libp2p:e,repo:r,peerId:i,options:this.options}),o=new V4(s,r.datastore,i,n,this.options);await o.republisher.start(),this.online=o}async stop(){let e=this.online;e&&(await e.republisher.stop(),this.online=null)}publish(e,r,i){return this.getIPNS().publish(e,r,i)}resolve(e,r){return this.getIPNS().resolve(e,r)}initializeKeyspace(e,r){return this.getIPNS().initializeKeyspace(e,r)}};l();l();var gS=M(Ee());var Bz=M(rc()),mS=M(Rt());dt();tt();l();var Oz=M(d0());var kz=M(ic());async function Dz({ipns:t,repo:e,codecs:r},i,n){if(Oz.default.ipnsPath(i))return t.resolve(i);let{cid:s,path:o}=Wc(i);await(0,kz.default)(uf(s,o||"",r,e,n))}var bS=Object.assign((0,gS.default)("ipfs:name:publish"),{error:(0,gS.default)("ipfs:name:publish:error")});function Nz({ipns:t,repo:e,codecs:r,peerId:i,isOnline:n,keychain:s}){let o=async c=>{if(c==="self")return i.privKey;try{let u=await s.exportKey(c,"temp");return await Bz.default.keys.import(u,"temp")}catch(u){throw bS.error(u),(0,mS.default)(u,"ERR_CANNOT_GET_KEY")}};async function a(c,u={}){let f=u.resolve!==!1,d=u.lifetime||"24h",h=u.key||"self";if(!n())throw(0,mS.default)(new Error(P6),"OFFLINE_ERROR");try{c=yL(c)}catch(v){throw bS.error(v),v}let p=0;try{p=of(d)||0,p=parseFloat(p.toFixed(6))}catch(v){throw bS.error(v),v}let y=await Promise.all([o(h),f?Dz({ipns:t,repo:e,codecs:r},c):Promise.resolve()]),b=Xe(c),E=await t.publish(y[0],b,p);return{name:E.name,value:Ge(E.value)}}return ce(a)}l();var vS=M(Ee()),J4=M(Rt());Te();var qz=M(it()),jz=M(Lz());tt();var kIe=Tt.bind({ignoreUndefined:!0}),DIe=Object.assign((0,vS.default)("ipfs:name:resolve"),{error:(0,vS.default)("ipfs:name:resolve:error")}),Uz=(t,e)=>e.length>0?t+"/"+e.join("/"):t;function Fz({dns:t,ipns:e,peerId:r,isOnline:i,options:{offline:n}}){async function*s(o,a={}){if(a=kIe({nocache:!1,recursive:!0},a),n&&a&&a.nocache)throw(0,J4.default)(new Error("cannot specify both offline and nocache"),"ERR_NOCACHE_AND_OFFLINE");o||(o=r.toB58String()),o.startsWith("/ipns/")||(o=`/ipns/${o}`);let[c,u,...f]=o.slice(1).split("/");try{u.substring(0,1)==="1"?qz.default.parse(u):J.parse(u)}catch(h){if((0,jz.default)(u)){yield Uz(await t(u,a),f);return}throw DIe.error(h),(0,J4.default)(new Error("Invalid IPNS name"),"ERR_IPNS_INVALID_NAME")}if(!i()&&!n)throw(0,J4.default)(new Error(P6),"OFFLINE_ERROR");let d=await e.resolve(`/${c}/${u}`,a);yield Uz(d instanceof Uint8Array?Ge(d):d,f)}return ce(s)}l();l();l();var wS=M(Rt());function sp(t,e){if(!t||!(e&&e.ipnsPubsub))throw(0,wS.default)(new Error("IPNS pubsub subsystem is not enabled"),"ERR_IPNS_PUBSUB_NOT_ENABLED");if(t.routing instanceof rp)return t.routing;let r=(t.routing.stores||[]).find(i=>i instanceof rp);if(!r)throw(0,wS.default)(new Error("IPNS pubsub datastore not found"),"ERR_PUBSUB_DATASTORE_NOT_FOUND");return r}function Kz({ipns:t,options:e}){let r=e.EXPERIMENTAL;async function i(n,s={}){return sp(t,r).cancel(n,s)}return ce(i)}l();function Vz({ipns:t,options:e}){let r=e.EXPERIMENTAL;async function i(n={}){try{return{enabled:Boolean(sp(t,r))}}catch(s){return{enabled:!1}}}return ce(i)}l();function zz({ipns:t,options:e}){let r=e.EXPERIMENTAL;async function i(n={}){return sp(t,r).getSubscriptions(n)}return ce(i)}var _S=class{constructor({ipns:e,options:r}){this.cancel=Kz({ipns:e,options:r}),this.state=Vz({ipns:e,options:r}),this.subs=zz({ipns:e,options:r})}};var ES=class{constructor({dns:e,ipns:r,repo:i,codecs:n,peerId:s,isOnline:o,keychain:a,options:c}){this.publish=Nz({ipns:r,repo:i,codecs:n,peerId:s,isOnline:o,keychain:a}),this.resolve=Fz({dns:e,ipns:r,peerId:s,isOnline:o,options:c}),this.pubsub=new _S({ipns:r,options:c})}};l();Zo();Te();var Hz=M(I6()),Gz=M(sf()),BIe=un().code,SS={default:"<dst>",edges:"<src> -> <dst>"};function $z({repo:t,codecs:e,resolve:r,preload:i}){async function*n(s,o={}){if(o.maxDepth===0)return;if(o.edges&&o.format&&o.format!==SS.default)throw new Error("Cannot set edges to true and also specify format");if(o.format=o.edges?SS.edges:o.format,typeof o.maxDepth!="number"&&(o.maxDepth=o.recursive?1/0:1),o.timeout){let u=new Hz.default(o.timeout);o.signal=(0,Gz.anySignal)([o.signal,u.signal])}let c=(Array.isArray(s)?s:[s]).map(u=>NIe(i,u,o));for(let u of c)try{yield*MIe(r,t,e,u,o)}catch(f){yield{ref:"",err:f.message}}}return n}function NIe(t,e,r){let{cid:i,path:n}=Wc(e);return r.preload!==!1&&t(i),`/ipfs/${i}${n||""}`}async function*MIe(t,e,r,i,n){let s=await t(i,n),{cid:o}=Wc(s),a=n.maxDepth!=null?n.maxDepth:1/0,c=n.unique||!1;for await(let u of qIe(e,r,o,a,c,n))!u.parent||u.isDuplicate||(yield{ref:LIe(u.parent.cid,u.node.cid,u.node.name,n.format)})}function LIe(t,e,r="",i=SS.default){let n=i.replace(/<src>/g,t.toString());return n=n.replace(/<dst>/g,e.toString()),n=n.replace(/<linkname>/g,r),n}async function*qIe(t,e,r,i,n,s){let o=new Set;async function*a(c,u){let f=u+1;if(!(f>i))try{for await(let d of jIe(t,e,c.cid,s))yield{parent:c,node:d,isDuplicate:n&&o.has(d.cid.toString())},n&&o.add(d.cid.toString()),yield*a(d,f)}catch(d){throw d.code===BIe&&(d.message=`Could not find object with CID: ${c.cid}`),d}}yield*a({cid:r},0)}async function*jIe(t,e,r,i){let n=await t.blocks.get(r,i),o=(await e.getCodec(r.code)).decode(n),a=r.code===Pt,c=[];for(let[u,f]of xS(o,c)){if(a){let d=u.match(/^Links\/(\d+)\/Hash$/);if(d){let h=Number(d[1]);if(h<o.Links.length){yield{name:o.Links[h].Name,cid:f};continue}}}yield{name:u,cid:f}}}var xS=function*(t,e){if(t!=null&&!(t instanceof Uint8Array)){for(let[r,i]of Object.entries(t)){let n=[...e,r];if(i!=null&&typeof i=="object")if(Array.isArray(i))for(let[s,o]of i.entries()){let a=[...n,s],c=J.asCID(o);c?yield[a.join("/"),c]:typeof o=="object"&&(yield*xS(o,a))}else{let s=J.asCID(i);s?yield[n.join("/"),s]:yield*xS(i,n)}}return[]}};l();function Wz({repo:t}){async function*e(r={}){for await(let i of t.blocks.queryKeys({},{signal:r.signal}))yield{ref:i.toString()}}return ce(e)}l();l();function Yz({network:t}){async function e(r={}){let{bitswap:i}=await t.use(r),n=i.getWantlist();return Array.from(n).map(s=>s[1].cid)}return ce(e)}l();var Xz=M(it());function Qz({network:t}){async function e(r,i={}){let{bitswap:n}=await t.use(i),s=n.wantlistForPeer(Xz.default.createFromB58String(r));return Array.from(s).map(o=>o[1].cid)}return ce(e)}l();function Zz({network:t}){async function e(r,i={}){let{bitswap:n}=await t.use(i);return Array.isArray(r)||(r=[r]),n.unwant(r)}return ce(e)}l();function eb({network:t}){async function e(r={}){let i=(await t.use(r)).bitswap,n=i.stat().snapshot;return{provideBufLen:parseInt(n.providesBufferLength.toString()),blocksReceived:BigInt(n.blocksReceived.toString()),wantlist:Array.from(i.getWantlist()).map(s=>s[1].cid),peers:i.peers().map(s=>s.toB58String()),dupBlksReceived:BigInt(n.dupBlksReceived.toString()),dupDataReceived:BigInt(n.dupDataReceived.toString()),dataReceived:BigInt(n.dataReceived.toString()),blocksSent:BigInt(n.blocksSent.toString()),dataSent:BigInt(n.dataSent.toString())}}return ce(e)}var AS=class{constructor({network:e}){this.wantlist=Yz({network:e}),this.wantlistForPeer=Qz({network:e}),this.unwant=Zz({network:e}),this.stat=eb({network:e})}};l();l();l();var Jz=M(Bl());function tb(t){try{return Jz.default.IPFS.matches(t)}catch(e){return!1}}function eH({repo:t}){async function e(r,i={}){if(!tb(r))throw new Error(`${r} is not a valid Multiaddr`);let n=await t.config.getAll(i),s=n.Bootstrap||[];return s.push(r.toString()),n.Bootstrap=Array.from(new Set(s)).sort((o,a)=>o.localeCompare(a)),await t.config.replace(n),{Peers:[r]}}return ce(e)}l();var tH=M(rt());function rH({repo:t}){async function e(r={}){let i=await t.config.getAll(r),n=i.Bootstrap||[];return i.Bootstrap=[],await t.config.replace(i),{Peers:n.map(s=>new tH.Multiaddr(s))}}return ce(e)}l();var iH=M(rt());function nH({repo:t}){async function e(r={}){return{Peers:(await t.config.get("Bootstrap",r)||[]).map(n=>new iH.Multiaddr(n))}}return ce(e)}l();l();var uu=()=>({Addresses:{Swarm:[],Announce:[],NoAnnounce:[],API:"",Gateway:"",RPC:"",Delegates:["/dns4/node0.delegate.ipfs.io/tcp/443/https","/dns4/node1.delegate.ipfs.io/tcp/443/https","/dns4/node2.delegate.ipfs.io/tcp/443/https","/dns4/node3.delegate.ipfs.io/tcp/443/https"]},Discovery:{MDNS:{Enabled:!1,Interval:10},webRTCStar:{Enabled:!0}},Bootstrap:["/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN","/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb","/dnsaddr/bootstrap.libp2p.io/p2p/QmZa1sAxajnQjVM8WjWXoMbmPd7NsWhfKsPkErzpm9wGkp","/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa","/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt","/dns4/node0.preload.ipfs.io/tcp/443/wss/p2p/QmZMxNdpMkewiVZLMRxaNxUeZpDUb34pWjZ1kZvsd16Zic","/dns4/node1.preload.ipfs.io/tcp/443/wss/p2p/Qmbut9Ywz9YEDrz8ySBSgWyJk41Uvm2QJPhwDJzJyGFsD6","/dns4/node2.preload.ipfs.io/tcp/443/wss/p2p/QmV7gnbW5VTcJ3oyM2Xk1rdFBJ3kTkvxc87UFGsun29STS","/dns4/node3.preload.ipfs.io/tcp/443/wss/p2p/QmY7JB6MQXhxHvq7dBDh4HpbH29v4yE9JRadAVpndvzySN"],Pubsub:{Enabled:!0},Swarm:{ConnMgr:{LowWater:200,HighWater:500},DisableNatPortMap:!0},Routing:{Type:"none"}});var sH=M(rt());function oH({repo:t}){async function e(r={}){let i=await t.config.getAll(r);return i.Bootstrap=uu().Bootstrap,await t.config.replace(i),{Peers:uu().Bootstrap.map(n=>new sH.Multiaddr(n))}}return ce(e)}l();function aH({repo:t}){async function e(r,i={}){if(!tb(r))throw new Error(`${r} is not a valid Multiaddr`);let n=await t.config.getAll(i);return n.Bootstrap=(n.Bootstrap||[]).filter(s=>s.toString()!==r.toString()),await t.config.replace(n),{Peers:[r]}}return ce(e)}var IS=class{constructor({repo:e}){this.add=eH({repo:e}),this.list=nH({repo:e}),this.rm=aH({repo:e}),this.clear=rH({repo:e}),this.reset=oH({repo:e})}};l();l();function cH({preload:t,repo:e}){async function r(i,n={}){return n.preload!==!1&&t(i),e.blocks.get(i,n)}return ce(r)}l();Te();function uH({codecs:t,hashers:e,repo:r,preload:i}){async function n(s,o={}){let a=o.pin?await r.gcLock.readLock():null;try{let c=o.version!=null?o.version:0,u=o.format||(c===0?"dag-pb":"raw"),d=await(await e.getHasher(o.mhtype||"sha2-256")).digest(s),h=await t.getCodec(u),p=J.create(c,h.code,d);return await r.blocks.put(p,s,{signal:o.signal}),o.preload!==!1&&i(p),o.pin===!0&&await r.pins.pinRecursively(p,{signal:o.signal}),p}finally{a&&a()}}return ce(n)}l();var SH=M(Rt()),xH=M(EH()),AH=M(oo()),IH=M(ea()),TH=M(Nr());l();Te();function sb(t){return t instanceof Uint8Array?J.decode(t):J.parse(t.toString())}var YIe=8;function RH({repo:t}){async function*e(r,i={}){Array.isArray(r)||(r=[r]);let n=await t.gcLock.writeLock();try{yield*(0,TH.pipe)(r,s=>(0,AH.default)(s,o=>async()=>{o=sb(o);let a={cid:o};try{if(!await t.blocks.has(o))throw(0,SH.default)(new Error("block not found"),"ERR_BLOCK_NOT_FOUND");await t.blocks.delete(o)}catch(c){i.force||(c.message=`cannot remove ${o}: ${c.message}`,a.error=c)}return a}),s=>(0,xH.default)(s,YIe),s=>(0,IH.default)(s,()=>!i.quiet))}finally{n()}}return ce(e)}l();function PH({repo:t,preload:e}){async function r(i,n={}){i=sb(i),n.preload!==!1&&e(i);let s=await t.blocks.get(i);return{cid:i,size:s.length}}return ce(r)}var RS=class{constructor({codecs:e,hashers:r,preload:i,repo:n}){this.get=cH({preload:i,repo:n}),this.put=uH({codecs:e,hashers:r,preload:i,repo:n}),this.rm=RH({repo:n}),this.stat=PH({preload:i,repo:n})}};l();l();var CH=M(is());function OH({addAll:t}){async function e(r,i={}){let n=await(0,CH.default)(t(r,i));if(n==null)throw Error("Failed to add a file, if you see this please report a bug");return n}return e}l();l();var YG=M(ab());l();di();l();H2();Y2();var PS=M(MH());function JIe(t){let e=new Array(4);for(let r=0;r<4;r++)e[r]=t&255,t=t>>8;return new Uint8Array(e)}var hdt=Ju({name:"murmur3-32",code:35,encode:t=>JIe(PS.default.x86.hash32(t))}),cd=Ju({name:"murmur3-128",code:34,encode:t=>Gh.fromHex(PS.default.x64.hash128(t))});async function eTe(t){return(await cd.encode(t)).slice(0,8).reverse()}var tTe={chunker:"fixed",strategy:"balanced",rawLeaves:!1,onlyHash:!1,reduceSingleLeafToSelf:!0,hasher:dr,leafType:"file",cidVersion:0,progress:()=>()=>{},shardSplitThreshold:1e3,fileImportConcurrency:50,blockWriteConcurrency:10,minChunkSize:262144,maxChunkSize:262144,avgChunkSize:262144,window:16,polynomial:17437180132763652,maxChildrenPerNode:174,layerRepeat:4,wrapWithDirectory:!1,recursive:!1,hidden:!1,timeout:void 0,hamtHashFn:eTe,hamtHashCode:34,hamtBucketBits:8},LH=(t={})=>Tt.bind({ignoreUndefined:!0})(tTe,t);l();l();l();Te();di();var rTe=async(t,e,r)=>{r.codec||(r.codec=Nn),r.hasher||(r.hasher=dr),r.cidVersion===void 0&&(r.cidVersion=1),r.codec===Nn&&r.hasher!==dr&&(r.cidVersion=1);let i=await r.hasher.digest(t),n=J.create(r.cidVersion,r.codec.code,i);return r.onlyHash||await e.put(n,t,{signal:r.signal}),n},ta=rTe;var iTe=async(t,e,r)=>{let i=new ct({type:"directory",mtime:t.mtime,mode:t.mode}),n=ot(zi({Data:i.marshal()})),s=await ta(n,e,r),o=t.path;return{cid:s,path:o,unixfs:i,size:n.length}},qH=iTe;l();var XH=M(Xy());var QH=M(ab());Hs();l();var FH=M(nd());async function sTe(t,e){return e(await(0,FH.default)(t))}var KH=sTe;l();var VH=M(ob());function oTe(t,e,r){return zH(t,e,r)}async function zH(t,e,r){let i=[];for await(let n of(0,VH.default)(t,r.maxChildrenPerNode))i.push(await e(n));return i.length>1?zH(i,e,r):i[0]}var HH=oTe;l();var GH=M(ob());async function aTe(t,e,r){let i=new WH(r.layerRepeat),n=0,s=1,o=i;for await(let a of(0,GH.default)(t,r.maxChildrenPerNode))o.isFull()&&(o!==i&&i.addChild(await o.reduce(e)),n&&n%r.layerRepeat==0&&s++,o=new CS(s,r.layerRepeat,n),n++),o.append(a);return o&&o!==i&&i.addChild(await o.reduce(e)),i.reduce(e)}var $H=aTe,CS=class{constructor(e,r,i=0){this.maxDepth=e,this.layerRepeat=r,this.currentDepth=1,this.iteration=i,this.root=this.node=this.parent={children:[],depth:this.currentDepth,maxDepth:e,maxChildren:(this.maxDepth-this.currentDepth)*this.layerRepeat}}isFull(){if(!this.root.data)return!1;if(this.currentDepth<this.maxDepth&&this.node.maxChildren)return this._addNextNodeToParent(this.node),!1;let e=this._findParent(this.node,this.currentDepth);return e?(this._addNextNodeToParent(e),!1):!0}_addNextNodeToParent(e){this.parent=e;let r={children:[],depth:e.depth+1,parent:e,maxDepth:this.maxDepth,maxChildren:Math.floor(e.children.length/this.layerRepeat)*this.layerRepeat};e.children.push(r),this.currentDepth=r.depth,this.node=r}append(e){this.node.data=e}reduce(e){return this._reduce(this.root,e)}async _reduce(e,r){let i=[];return e.children.length&&(i=await Promise.all(e.children.filter(n=>n.data).map(n=>this._reduce(n,r)))),r((e.data||[]).concat(i))}_findParent(e,r){let i=e.parent;if(!(!i||i.depth===0))return i.children.length===i.maxChildren||!i.maxChildren?this._findParent(i,r):i}},WH=class extends CS{constructor(e){super(0,e);this.root.depth=0,this.currentDepth=1}addChild(e){this.root.children.push(e)}reduce(e){return e((this.root.data||[]).concat(this.root.children))}};l();Hs();async function*cTe(t,e,r){for await(let i of t.content)yield async()=>{r.progress(i.length,t.path);let n,s={codec:Nn,cidVersion:r.cidVersion,hasher:r.hasher,onlyHash:r.onlyHash};return r.rawLeaves?(s.codec=W2,s.cidVersion=1):(n=new ct({type:r.leafType,data:i,mtime:t.mtime,mode:t.mode}),i=ot({Data:n.marshal(),Links:[]})),{cid:await ta(i,e,s),unixfs:n,size:i.length}}}var YH=cTe;var uTe={flat:KH,balanced:HH,trickle:$H};async function*fTe(t,e,r){let i=-1,n,s;typeof r.bufferImporter=="function"?s=r.bufferImporter:s=YH;for await(let o of(0,QH.default)(s(t,e,r),r.blockWriteConcurrency)){if(i++,i===0){n=o;continue}else i===1&&n&&(yield n,n=null);yield o}n&&(n.single=!0,yield n)}var lTe=(t,e,r)=>{async function i(n){if(n.length===1&&n[0].single&&r.reduceSingleLeafToSelf){let f=n[0];if(f.cid.code===Pi&&(t.mtime!==void 0||t.mode!==void 0)){let d=await e.get(f.cid);f.unixfs=new ct({type:"file",mtime:t.mtime,mode:t.mode,data:d}),d=ot(zi({Data:f.unixfs.marshal()})),f.cid=await ta(d,e,{...r,codec:Nn,hasher:r.hasher,cidVersion:r.cidVersion}),f.size=d.length}return{cid:f.cid,path:t.path,unixfs:f.unixfs,size:f.size}}let s=new ct({type:"file",mtime:t.mtime,mode:t.mode}),o=n.filter(f=>f.cid.code===Pi&&f.size||f.unixfs&&!f.unixfs.data&&f.unixfs.fileSize()?!0:Boolean(f.unixfs&&f.unixfs.data&&f.unixfs.data.length)).map(f=>f.cid.code===Pi?(s.addBlockSize(f.size),{Name:"",Tsize:f.size,Hash:f.cid}):(!f.unixfs||!f.unixfs.data?s.addBlockSize(f.unixfs&&f.unixfs.fileSize()||0):s.addBlockSize(f.unixfs.data.length),{Name:"",Tsize:f.size,Hash:f.cid})),a={Data:s.marshal(),Links:o},c=ot(zi(a));return{cid:await ta(c,e,r),path:t.path,unixfs:s,size:c.length+a.Links.reduce((f,d)=>f+d.Tsize,0)}}return i};function dTe(t,e,r){let i=uTe[r.strategy];if(!i)throw(0,XH.default)(new Error(`Unknown importer build strategy name: ${r.strategy}`),"ERR_BAD_STRATEGY");return i(fTe(t,e,r),lTe(t,e,r),r)}var ZH=dTe;var qS=M(Xy());l();var EG=M(Rn()),SG=M(_G()),MS=M(Xy());async function*xTe(t,e){let r,i,n;if(e.minChunkSize&&e.maxChunkSize&&e.avgChunkSize)n=e.avgChunkSize,r=e.minChunkSize,i=e.maxChunkSize;else if(e.avgChunkSize)n=e.avgChunkSize,r=n/3,i=n+n/2;else throw(0,MS.default)(new Error("please specify an average chunk size"),"ERR_INVALID_AVG_CHUNK_SIZE");if(r<16)throw(0,MS.default)(new Error("rabin min must be greater than 16"),"ERR_INVALID_MIN_CHUNK_SIZE");i<r&&(i=r),n<r&&(n=r);let s=Math.floor(Math.log2(n));for await(let o of ATe(t,{min:r,max:i,bits:s,window:e.window,polynomial:e.polynomial}))yield o}var xG=xTe;async function*ATe(t,e){let r=await(0,SG.create)(e.bits,e.min,e.max,e.window),i=new EG.default;for await(let n of t){i.append(n);let s=r.fingerprint(n);for(let o=0;o<s.length;o++){let a=s[o],c=i.slice(0,a);i.consume(a),yield c}}i.length&&(yield i.slice(0))}l();var lb=M(Rn());async function*ITe(t,e){let r=new lb.default,i=0,n=!1,s=e.maxChunkSize;for await(let o of t)for(r.append(o),i+=o.length;i>=s;)if(yield r.slice(0,s),n=!0,s===r.length)r=new lb.default,i=0;else{let a=new lb.default;a.append(r.shallowSlice(s)),r=a,i-=s}(!n||i)&&(yield r.slice(0,i))}var AG=ITe;l();var LS=M(Xy());dt();async function*TTe(t){for await(let e of t){if(e.length===void 0)throw(0,LS.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT");if(typeof e=="string"||e instanceof String)yield Xe(e.toString());else if(Array.isArray(e))yield Uint8Array.from(e);else if(e instanceof Uint8Array)yield e;else throw(0,LS.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT")}}var IG=TTe;function RTe(t){return Symbol.iterator in t}function PTe(t){return Symbol.asyncIterator in t}function CTe(t){try{if(t instanceof Uint8Array)return async function*(){yield t}();if(RTe(t))return async function*(){yield*t}();if(PTe(t))return t}catch{throw(0,qS.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT")}throw(0,qS.default)(new Error("Content was invalid"),"ERR_INVALID_CONTENT")}async function*OTe(t,e,r){for await(let i of t)if(i.path&&(i.path.substring(0,2)==="./"&&(r.wrapWithDirectory=!0),i.path=i.path.split("/").filter(n=>n&&n!==".").join("/")),i.content){let n;typeof r.chunker=="function"?n=r.chunker:r.chunker==="rabin"?n=xG:n=AG;let s;typeof r.chunkValidator=="function"?s=r.chunkValidator:s=IG;let o={path:i.path,mtime:i.mtime,mode:i.mode,content:n(s(CTe(i.content),r),r)};yield()=>ZH(o,e,r)}else if(i.path){let n={path:i.path,mtime:i.mtime,mode:i.mode};yield()=>qH(n,e,r)}else throw new Error("Import candidate must have content or path or both")}var TG=OTe;l();l();l();var RG=class{constructor(e,r){this.options=r||{},this.root=e.root,this.dir=e.dir,this.path=e.path,this.dirty=e.dirty,this.flat=e.flat,this.parent=e.parent,this.parentKey=e.parentKey,this.unixfs=e.unixfs,this.mode=e.mode,this.mtime=e.mtime,this.cid=void 0,this.size=void 0}async put(e,r){}get(e){return Promise.resolve(this)}async*eachChildSeries(){}async*flush(e){}},Tf=RG;var PG=class extends Tf{constructor(e,r){super(e,r);this._children={}}async put(e,r){this.cid=void 0,this.size=void 0,this._children[e]=r}get(e){return Promise.resolve(this._children[e])}childCount(){return Object.keys(this._children).length}directChildrenCount(){return this.childCount()}onlyChild(){return this._children[Object.keys(this._children)[0]]}async*eachChildSeries(){let e=Object.keys(this._children);for(let r=0;r<e.length;r++){let i=e[r];yield{key:i,child:this._children[i]}}}async*flush(e){let r=Object.keys(this._children),i=[];for(let u=0;u<r.length;u++){let f=this._children[r[u]];if(f instanceof Tf)for await(let d of f.flush(e))f=d,yield f;f.size!=null&&f.cid&&i.push({Name:r[u],Tsize:f.size,Hash:f.cid})}let n=new ct({type:"directory",mtime:this.mtime,mode:this.mode}),s={Data:n.marshal(),Links:i},o=ot(zi(s)),a=await ta(o,e,this.options),c=o.length+s.Links.reduce((u,f)=>u+(f.Tsize==null?0:f.Tsize),0);this.cid=a,this.size=c,yield{cid:a,unixfs:n,path:this.path,size:c}}},eg=PG;l();l();var pb=M(tg()),FG=class extends Tf{constructor(e,r){super(e,r);this._bucket=(0,pb.createHAMT)({hashFn:r.hamtHashFn,bits:r.hamtBucketBits})}async put(e,r){await this._bucket.put(e,r)}get(e){return this._bucket.get(e)}childCount(){return this._bucket.leafCount()}directChildrenCount(){return this._bucket.childrenCount()}onlyChild(){return this._bucket.onlyChild()}async*eachChildSeries(){for await(let{key:e,value:r}of this._bucket.eachLeafSeries())yield{key:e,child:r}}async*flush(e){for await(let r of VG(this._bucket,e,this,this.options))yield{...r,path:this.path}}},KG=FG;async function*VG(t,e,r,i){let n=t._children,s=[],o=0;for(let p=0;p<n.length;p++){let y=n.get(p);if(!y)continue;let b=p.toString(16).toUpperCase().padStart(2,"0");if(y instanceof pb.Bucket){let E;for await(let v of await VG(y,e,null,i))E=v;if(!E)throw new Error("Could not flush sharded directory, no subshard found");s.push({Name:b,Tsize:E.size,Hash:E.cid}),o+=E.size}else if(typeof y.value.flush=="function"){let E=y.value,v;for await(let R of E.flush(e))v=R,yield v;let A=b+y.key;s.push({Name:A,Tsize:v.size,Hash:v.cid}),o+=v.size}else{let E=y.value;if(!E.cid)continue;let v=b+y.key,A=E.size;s.push({Name:v,Tsize:A,Hash:E.cid}),o+=A}}let a=Uint8Array.from(n.bitField().reverse()),c=new ct({type:"hamt-sharded-directory",data:a,fanout:t.tableSize(),hashType:i.hamtHashCode,mtime:r&&r.mtime,mode:r&&r.mode}),u={Data:c.marshal(),Links:s},f=ot(zi(u)),d=await ta(f,e,i),h=f.length+o;yield{cid:d,unixfs:c,size:h}}async function zG(t,e,r,i){let n=e;e instanceof eg&&e.directChildrenCount()>=r&&(n=await YTe(e,i));let s=n.parent;if(s){if(n!==e){if(t&&(t.parent=n),!n.parentKey)throw new Error("No parent key found");await s.put(n.parentKey,n)}return zG(n,s,r,i)}return n}async function YTe(t,e){let r=new KG({root:t.root,dir:!0,parent:t.parent,parentKey:t.parentKey,path:t.path,dirty:t.dirty,flat:!1,mtime:t.mtime,mode:t.mode},e);for await(let{key:i,child:n}of t.eachChildSeries())await r.put(i,n);return r}var HG=zG;l();var XTe=(t="")=>(t.trim().match(/([^\\^/]|\\\/)+/g)||[]).filter(Boolean),GG=XTe;async function QTe(t,e,r){let i=GG(t.path||""),n=i.length-1,s=e,o="";for(let a=0;a<i.length;a++){let c=i[a];o+=`${o?"/":""}${c}`;let u=a===n;if(s.dirty=!0,s.cid=void 0,s.size=void 0,u)await s.put(c,t),e=await HG(null,s,r.shardSplitThreshold,r);else{let f=await s.get(c);(!f||!(f instanceof Tf))&&(f=new eg({root:!1,dir:!0,parent:s,parentKey:c,path:o,dirty:!0,flat:!0,mtime:f&&f.unixfs&&f.unixfs.mtime,mode:f&&f.unixfs&&f.unixfs.mode},r)),await s.put(c,f),s=f}}return e}async function*$G(t,e){if(!(t instanceof Tf)){t&&t.unixfs&&t.unixfs.isDirectory()&&(yield t);return}yield*t.flush(e)}async function*ZTe(t,e,r){let i=new eg({root:!0,dir:!0,path:"",dirty:!0,flat:!0},r);for await(let n of t)!n||(i=await QTe(n,i,r),(!n.unixfs||!n.unixfs.isDirectory())&&(yield n));if(r.wrapWithDirectory)yield*$G(i,e);else for await(let n of i.eachChildSeries())!n||(yield*$G(n.child,e))}var WG=ZTe;async function*ap(t,e,r={}){let i=LH(r),n;typeof r.dagBuilder=="function"?n=r.dagBuilder:n=TG;let s;typeof r.treeBuilder=="function"?s=r.treeBuilder:s=WG;let o;Symbol.asyncIterator in t||Symbol.iterator in t?o=t:o=[t];for await(let a of s((0,YG.default)(n(o,e,i),i.fileImportConcurrency),e,i))yield{cid:a.cid,path:a.path,unixfs:a.unixfs,size:a.size}}l();l();var t$=M(p0());dt();var r$=M(rg()),i$=M(JG()),n$=M(ig()),s$=M(nd()),o$=M(oo());l();function lu(t){return ArrayBuffer.isView(t)||t instanceof ArrayBuffer}function ud(t){return t.constructor&&(t.constructor.name==="Blob"||t.constructor.name==="File")&&typeof t.stream=="function"}function US(t){return typeof t=="object"&&(t.path||t.content)}var fd=t=>t&&typeof t.getReader=="function";async function a$(t){return rRe(t)}async function*rRe(t){if(lu(t)){yield FS(t);return}if(typeof t=="string"||t instanceof String){yield FS(t.toString());return}if(ud(t)){yield*(0,i$.default)(t);return}if(fd(t)&&(t=(0,r$.default)(t)),Symbol.iterator in t||Symbol.asyncIterator in t){let e=(0,n$.default)(t),{value:r,done:i}=await e.peek();if(i){yield*[];return}if(e.push(r),Number.isInteger(r)){yield Uint8Array.from(await(0,s$.default)(e));return}if(lu(r)||typeof r=="string"||r instanceof String){yield*(0,o$.default)(e,FS);return}}throw(0,t$.default)(new Error(`Unexpected input: ${t}`),"ERR_UNEXPECTED_INPUT")}function FS(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t instanceof ArrayBuffer?new Uint8Array(t):Array.isArray(t)?Uint8Array.from(t):Xe(t.toString())}l();var KS=M(p0()),c$=M(rg()),u$=M(ig()),yb=M(oo());async function*gb(t,e){if(t==null)throw(0,KS.default)(new Error(`Unexpected input: ${t}`),"ERR_UNEXPECTED_INPUT");if(typeof t=="string"||t instanceof String){yield ld(t.toString(),e);return}if(lu(t)||ud(t)){yield ld(t,e);return}if(fd(t)&&(t=(0,c$.default)(t)),Symbol.iterator in t||Symbol.asyncIterator in t){let r=(0,u$.default)(t),{value:i,done:n}=await r.peek();if(n){yield*[];return}if(r.push(i),Number.isInteger(i)||lu(i)){yield ld(r,e);return}if(i._readableState){yield*(0,yb.default)(r,s=>ld({content:s},e));return}if(US(i)||ud(i)||typeof i=="string"||i instanceof String){yield*(0,yb.default)(r,s=>ld(s,e));return}if(i[Symbol.iterator]||i[Symbol.asyncIterator]||fd(i)){yield*(0,yb.default)(r,s=>ld(s,e));return}}if(US(t)){yield ld(t,e);return}throw(0,KS.default)(new Error("Unexpected input: "+typeof t),"ERR_UNEXPECTED_INPUT")}async function ld(t,e){let{path:r,mode:i,mtime:n,content:s}=t,o={path:r||"",mode:Pl(i),mtime:Vh(n)};return s?o.content=await e(s):r||(o.content=await e(t)),o}function f$(t){return gb(t,a$)}l();var l$=t=>{if(t)if(t.startsWith("size-")){let e=t.split("-")[1],r=parseInt(e);if(isNaN(r))throw new Error("Chunker parameter size must be an integer");return{chunker:"fixed",maxChunkSize:r}}else{if(t.startsWith("rabin"))return{chunker:"rabin",...iRe(t)};throw new Error(`Unrecognized chunker option: ${t}`)}else return{chunker:"fixed"}},iRe=t=>{let e={},r=t.split("-");switch(r.length){case 1:e.avgChunkSize=262144;break;case 2:e.avgChunkSize=mb(r[1],"avg");break;case 4:e.minChunkSize=mb(r[1],"min"),e.avgChunkSize=mb(r[2],"avg"),e.maxChunkSize=mb(r[3],"max");break;default:throw new Error('Incorrect chunker format (expected "rabin" "rabin-[avg]" or "rabin-[min]-[avg]-[max]"')}return e},mb=(t,e)=>{let r=parseInt(t);if(isNaN(r))throw new Error(`Chunker parameter ${e} must be an integer`);return r};var d$=M(Nr());var nRe=Tt.bind({ignoreUndefined:!0});function h$({repo:t,preload:e,options:r}){let i=r&&r.sharding;async function*n(s,o={}){let a=nRe({shardSplitThreshold:i?1e3:1/0,strategy:"balanced"},o,{...l$(o.chunker)});a.hashAlg&&a.hashAlg!=="sha2-256"&&a.cidVersion!==1&&(a.cidVersion=1),a.trickle&&(a.strategy="trickle"),a.strategy==="trickle"&&(a.leafType="raw",a.reduceSingleLeafToSelf=!1),a.cidVersion>0&&a.rawLeaves===void 0&&(a.rawLeaves=!0),a.hashAlg!==void 0&&a.rawLeaves===void 0&&(a.rawLeaves=!0),delete a.trickle;let c={};if(a.progress){let d=a.progress;a.progress=(h,p)=>{c[p]||(c[p]=0),c[p]+=h,d(c[p],p)}}let u=(0,d$.pipe)(f$(s),d=>ap(d,t.blocks,{...a,pin:!1}),sRe(a),oRe(e,a),aRe(t,a)),f=await t.gcLock.readLock();try{for await(let d of u)delete c[d.path],yield d}finally{f()}}return ce(n)}function sRe(t){async function*e(r){for await(let i of r){let n=i.cid;t.cidVersion===1&&(n=n.toV1());let s=i.path?i.path:n.toString();t.wrapWithDirectory&&!i.path&&(s=""),yield{path:s,cid:n,size:i.size,mode:i.unixfs&&i.unixfs.mode,mtime:i.unixfs&&i.unixfs.mtime}}}return e}function oRe(t,e){async function*r(i){for await(let n of i)(!n.path||e.wrapWithDirectory?n.path==="":!n.path.includes("/"))&&!e.onlyHash&&e.preload!==!1&&t(n.cid),yield n}return r}function aRe(t,e){async function*r(i){for await(let n of i){let s=!(n.path&&n.path.includes("/"));(e.pin==null?!0:e.pin)&&s&&!e.onlyHash&&await t.pins.pinRecursively(n.cid),yield n}}return r}l();l();var _b=M(du());Te();l();var C$=M(du());Hs();Gc();l();var wb=M(du());l();var bb=M(tg());var uRe=async function(t){return(await cd.encode(t)).slice(0,8).reverse()},fRe=(t,e,r)=>Promise.all(t.map(i=>{if(i.Name==null)throw new Error("Unexpected Link without a Name");if(i.Name.length===2){let n=parseInt(i.Name,16);return e._putObjectAt(n,new bb.Bucket({hash:r._options.hash,bits:r._options.bits},e,n))}return r.put(i.Name.substring(2),!0)})),g$=t=>t.toString(16).toUpperCase().padStart(2,"0").substring(0,2),lRe=t=>{let e=t.bucket,r=[];for(;e._parent;)r.push(e),e=e._parent;return r.push(e),r.reverse()},m$=async(t,e,r,i,n)=>{if(!i){let f=(0,bb.createHAMT)({hashFn:uRe});i={rootBucket:f,hamtDepth:1,lastBucket:f}}await fRe(t.Links,i.lastBucket,i.rootBucket);let s=await i.rootBucket._findNewBucketAndPos(e),o=g$(s.pos),a=lRe(s);a.length>i.hamtDepth&&(i.lastBucket=a[i.hamtDepth],o=g$(i.lastBucket._posAtParent));let c=t.Links.find(f=>{if(f.Name==null)return!1;let d=f.Name.substring(0,2),h=f.Name.substring(2);return!(d!==o||h&&h!==e)});if(!c)return null;if(c.Name!=null&&c.Name.substring(2)===e)return c.Hash;i.hamtDepth++;let u=await r.get(c.Hash,n);return t=Bt(u),m$(t,e,r,i,n)},b$=m$;l();l();function dRe(t,e,r,i){let n=t.length,s=e+n;return r>=s||i<e?new Uint8Array(0):(i>=e&&i<s&&(t=t.slice(0,i-e)),r>=e&&r<s&&(t=t.slice(r-e)),t)}var dd=dRe;l();var vb=M(du()),hRe=(t,e,r)=>{if(e||(e=0),e<0)throw(0,vb.default)(new Error("Offset must be greater than or equal to 0"),"ERR_INVALID_PARAMS");if(e>t)throw(0,vb.default)(new Error("Offset must be less than the file size"),"ERR_INVALID_PARAMS");if(!r&&r!==0&&(r=t-e),r<0)throw(0,vb.default)(new Error("Length must be greater than or equal to 0"),"ERR_INVALID_PARAMS");return e+r>t&&(r=t-e),{offset:e,length:r}},cp=hRe;var VS=M(du());Hs();async function*v$(t,e,r,i,n=0,s){if(e instanceof Uint8Array){let c=dd(e,n,r,i);return c.length&&(yield c),n+=c.length,n}if(e.Data==null)throw(0,VS.default)(new Error("no data in PBNode"),"ERR_NOT_UNIXFS");let o;try{o=ct.unmarshal(e.Data)}catch(c){throw(0,VS.default)(c,"ERR_NOT_UNIXFS")}if(o.data&&o.data.length){let c=dd(o.data,n,r,i);c.length&&(yield c),n+=o.data.length}let a=n;for(let c=0;c<e.Links.length;c++){let u=e.Links[c],f=n+o.blockSizes[c];if(r>=a&&r<f||i>a&&i<=f||r<a&&i>f){let d=await t.get(u.Hash,{signal:s.signal}),h;switch(u.Hash.code){case Pt:h=await Bt(d);break;case Pi:h=d;break;case Cl:h=await Ol(d);break;default:throw Error(`Unsupported codec: ${u.Hash.code}`)}for await(let p of v$(t,h,r,i,n,s))n+=p.length,yield p}n=f,a=f+1}}var pRe=(t,e,r,i,n,s,o)=>{function a(c={}){let u=r.fileSize();if(u===void 0)throw new Error("File was a directory");let{offset:f,length:d}=cp(u,c.offset,c.length),h=f,p=f+d;return v$(o,e,h,p,0,c)}return a},zS=pRe;l();var yRe=(t,e,r,i,n,s,o)=>{async function*a(c={}){let u=c.offset||0,f=c.length||e.Links.length,d=e.Links.slice(u,f);for(let h of d){let p=await n(h.Hash,h.Name||"",`${i}/${h.Name||""}`,[],s+1,o,c);p.entry&&(yield p.entry)}}return a},w$=yRe;l();var gRe=(t,e,r,i,n,s,o)=>{function a(c={}){return _$(e,i,n,s,o,c)}return a};async function*_$(t,e,r,i,n,s){let o=t.Links;for(let a of o){let c=a.Name!=null?a.Name.substring(2):null;if(c)yield(await r(a.Hash,c,`${e}/${c}`,[],i+1,n,s)).entry;else{let u=await n.get(a.Hash);t=Bt(u);for await(let f of _$(t,e,r,i,n,s))yield f}}}var E$=gRe;var mRe=(t,e)=>{let r=t.Links.find(i=>i.Name===e);return r&&r.Hash},bRe={raw:zS,file:zS,directory:w$,"hamt-sharded-directory":E$,metadata:(t,e,r,i,n,s,o)=>()=>[],symlink:(t,e,r,i,n,s,o)=>()=>[]},vRe=async(t,e,r,i,n,s,o,a)=>{let c=await o.get(t,a),u=Bt(c),f,d;if(e||(e=t.toString()),u.Data==null)throw(0,wb.default)(new Error("no data in PBNode"),"ERR_NOT_UNIXFS");try{f=ct.unmarshal(u.Data)}catch(h){throw(0,wb.default)(h,"ERR_NOT_UNIXFS")}if(r||(r=e),i.length){let h;if(f&&f.type==="hamt-sharded-directory"?h=await b$(u,i[0],o):h=mRe(u,i[0]),!h)throw(0,wb.default)(new Error("file does not exist"),"ERR_NOT_FOUND");let p=i.shift(),y=`${r}/${p}`;d={cid:h,toResolve:i,name:p||"",path:y}}return{entry:{type:f.isDirectory()?"directory":"file",name:e,path:r,cid:t,content:bRe[f.type](t,u,f,r,n,s,o),unixfs:f,depth:s,node:u,size:f.fileSize()},next:d}},S$=vRe;l();var x$=M(du());var wRe=t=>{async function*e(r={}){let{offset:i,length:n}=cp(t.length,r.offset,r.length);yield dd(t,0,i,i+n)}return e},_Re=async(t,e,r,i,n,s,o,a)=>{if(i.length)throw(0,x$.default)(new Error(`No link named ${r} found in raw node ${t}`),"ERR_NOT_FOUND");let c=await o.get(t,a);return{entry:{type:"raw",name:e,path:r,cid:t,content:wRe(c),depth:s,size:c.length,node:c}}},A$=_Re;l();Te();var I$=M(du());var ERe=async(t,e,r,i,n,s,o,a)=>{let c=await o.get(t),u=Ol(c),f=u,d=r;for(;i.length;){let h=i[0];if(h in f){i.shift(),d=`${d}/${h}`;let p=J.asCID(f[h]);if(p)return{entry:{type:"object",name:e,path:r,cid:t,node:c,depth:s,size:c.length,content:async function*(){yield u}},next:{cid:p,name:h,path:d,toResolve:i}};f=f[h]}else throw(0,I$.default)(new Error(`No property named ${h} found in cbor node ${t}`),"ERR_NO_PROP")}return{entry:{type:"object",name:e,path:r,cid:t,node:c,depth:s,size:c.length,content:async function*(){yield u}}}},T$=ERe;l();var R$=M(du());Bn();var SRe=t=>{async function*e(r={}){let{offset:i,length:n}=cp(t.length,r.offset,r.length);yield dd(t,0,i,i+n)}return e},xRe=async(t,e,r,i,n,s,o,a)=>{if(i.length)throw(0,R$.default)(new Error(`No link named ${r} found in raw node ${t}`),"ERR_NOT_FOUND");let c=await Ri(t.multihash.bytes);return{entry:{type:"identity",name:e,path:r,cid:t,content:SRe(c.digest),depth:s,size:c.digest.length,node:c.digest}}},P$=xRe;var ARe={[Pt]:S$,[Pi]:A$,[Cl]:T$,[_s.code]:P$};function O$(t,e,r,i,n,s,o){let a=ARe[t.code];if(!a)throw(0,C$.default)(new Error(`No resolver for code ${t.code}`),"ERR_NO_RESOLVER");return a(t,e,r,i,O$,n,s,o)}var k$=O$;var D$=M(is()),IRe=(t="")=>(t.trim().match(/([^\\^/]|\\\/)+/g)||[]).filter(Boolean),TRe=t=>{if(t instanceof Uint8Array)return{cid:J.decode(t),toResolve:[]};let e=J.asCID(t);if(e)return{cid:e,toResolve:[]};if(typeof t=="string"){t.indexOf("/ipfs/")===0&&(t=t.substring(6));let r=IRe(t);return{cid:J.parse(r[0]),toResolve:r.slice(1)}}throw(0,_b.default)(new Error(`Unknown path type ${t}`),"ERR_BAD_PATH")};async function*HS(t,e,r={}){let{cid:i,toResolve:n}=TRe(t),s=i.toString(),o=s,a=n.length;for(;;){let c=await k$(i,s,o,n,a,e,r);if(!c.entry&&!c.next)throw(0,_b.default)(new Error(`Could not resolve ${t}`),"ERR_NOT_FOUND");if(c.entry&&(yield c.entry),!c.next)return;n=c.next.toResolve,i=c.next.cid,s=c.next.name,o=c.next.path}}async function fn(t,e,r={}){let i=await(0,D$.default)(HS(t,e,r));if(!i)throw(0,_b.default)(new Error(`Could not resolve ${t}`),"ERR_NOT_FOUND");return i}async function*Eb(t,e,r={}){let i=await fn(t,e,r);if(!i)return;if(yield i,i.type==="directory")for await(let s of n(i,r))yield s;async function*n(s,o){for await(let a of s.content(o))yield a,!(a instanceof Uint8Array)&&a.type==="directory"&&(yield*n(a,o))}}Te();function B$({repo:t,preload:e}){async function*r(i,n={}){if(i=y0(i),n.preload!==!1){let o=i.split("/");e(J.parse(o[0]))}let s=await fn(i,t.blocks,n);if(s.type==="directory")throw new Error("this dag node is a directory");if(!s.content)throw new Error("this dag node has no content");yield*s.content(n)}return ce(r)}l();var _p=M(Rt());Te();var Mx=M(Q$()),Lx=M(Nr()),qx=M(qY()),jx=M(oo()),Ux=M(UY()),FY=6;function KY({repo:t,preload:e}){async function*r(i,n={}){if(n.compressionLevel<0||n.compressionLevel>9)throw(0,_p.default)(new Error("Compression level must be between 1 and 9"),"ERR_INVALID_PARAMS");if(n.preload!==!1){let a;try{a=y0(i).split("/")}catch(c){throw(0,_p.default)(c,"ERR_INVALID_PATH")}e(J.parse(a[0]))}let s=J.asCID(i)||i,o=await fn(s,t.blocks,n);if(o.type==="file"||o.type==="raw"){let a=[];!n.compress||n.archive===!0?a.push([{header:{name:o.path,mode:o.type==="file"&&o.unixfs.mode,mtime:o.type==="file"&&o.unixfs.mtime?new Date(o.unixfs.mtime.secs*1e3):void 0,size:o.size,type:"file"},body:o.content()}],(0,Mx.pack)(),c=>(0,jx.default)(c,u=>u.slice())):a.push(o.content),n.compress&&a.push(async function*(c){let u=await(0,Ux.default)(c);yield qx.default.gzip(u,{level:n.compressionLevel||FY})}),yield*(0,Lx.pipe)(...a);return}if(o.type==="directory"){let a=[Eb(s,t.blocks,n),async function*(c){for await(let u of c){let f={header:{name:u.path,size:u.size}};if(u.type==="file")f.header.type="file",f.header.mode=u.unixfs.mode!=null?u.unixfs.mode:void 0,f.header.mtime=u.unixfs.mtime?new Date(u.unixfs.mtime.secs*1e3):void 0,f.body=u.content();else if(u.type==="raw")f.header.type="file",f.body=u.content();else if(u.type==="directory")f.header.type="directory",f.header.mode=u.unixfs.mode!=null?u.unixfs.mode:void 0,f.header.mtime=u.unixfs.mtime?new Date(u.unixfs.mtime.secs*1e3):void 0;else throw(0,_p.default)(new Error("Not a UnixFS node"),"ERR_NOT_UNIXFS");yield f}},(0,Mx.pack)(),c=>(0,jx.default)(c,u=>u.slice())];if(n.compress){if(!n.archive)throw(0,_p.default)(new Error("file is not regular"),"ERR_INVALID_PATH");n.compress&&a.push(async function*(c){let u=await(0,Ux.default)(c);yield qx.default.gzip(u,{level:n.compressionLevel||FY})})}yield*(0,Lx.pipe)(...a);return}throw(0,_p.default)(new Error("Not a UnixFS node"),"ERR_NOT_UNIXFS")}return ce(r)}l();var VY=M(Rt());Te();function zY({repo:t,preload:e}){async function*r(i,n={}){let s=y0(i),o=s.split("/");n.preload!==!1&&e(J.parse(o[0]));let a=J.asCID(s)||s,c=await fn(a,t.blocks,n);if(c.type==="file"){yield U9(c);return}if(c.type==="directory"){for await(let u of c.content())yield U9(u);return}throw(0,VY.default)(new Error(`Unknown UnixFS type ${c.type}`),"ERR_UNKNOWN_UNIXFS_TYPE")}return ce(r)}var Fx=class{constructor({preload:e,repo:r,options:i}){let n=h$({preload:e,repo:r,options:i});this.addAll=n,this.add=OH({addAll:n}),this.cat=B$({repo:r,preload:e}),this.get=KY({repo:r,preload:e}),this.ls=zY({repo:r,preload:e})}};l();l();var Ed="0.11.1",HY="5ddd0c555cc6577ee15667f4ef4e7f3a3b17d04c",GY="^0.151.1";function $Y({repo:t}){async function e(r={}){let i=await t.version.get();return{version:Ed,commit:HY,repo:`${i}`,"ipfs-core":Ed,"interface-ipfs-core":GY}}return ce(e)}l();var WY=M(rt());tt();var YY=M(it());function XY({peerId:t,network:e}){async function r(i={}){i.peerId===t.toB58String()&&delete i.peerId;let n=e.try();if(!n){if(i.peerId)throw new tf;return{id:t.toB58String(),publicKey:Ge(t.pubKey.bytes,"base64pad"),addresses:[],agentVersion:`js-ipfs/${Ed}`,protocolVersion:"9000",protocols:[]}}let s=i.peerId?YY.default.createFromB58String(i.peerId.toString()):t,{libp2p:o}=n,a=i.peerId?o.peerStore.keyBook.get(s):s.pubKey,c=i.peerId?o.peerStore.addressBook.getMultiaddrsForPeer(s):o.multiaddrs,u=i.peerId?o.peerStore.protoBook.get(s):Array.from(o.upgrader.protocols.keys()),f=Ge(o.peerStore.metadataBook.getValue(s,"AgentVersion")||new Uint8Array),d=Ge(o.peerStore.metadataBook.getValue(s,"ProtocolVersion")||new Uint8Array),h=s.toB58String();return{id:h,publicKey:Ge(a.bytes,"base64pad"),addresses:(c||[]).map(p=>{let y=p.toString();return y.endsWith(`/p2p/${h}`)?y:`${y}/p2p/${h}`}).sort().map(p=>new WY.Multiaddr(p)),agentVersion:f,protocolVersion:d,protocols:(u||[]).sort()}}return ce(r)}l();var JY=M(Ee());l();var Jr=M(Kx());var Ep={server:{description:"Recommended for nodes with public IPv4 address (servers, VPSes, etc.), disables host and content discovery and UPnP in local networks.",transform:t=>((0,Jr.default)(t,"Discovery.MDNS.Enabled",!1),(0,Jr.default)(t,"Discovery.webRTCStar.Enabled",!1),t.Swarm={...t.Swarm||{},DisableNatPortMap:!0},t)},"local-discovery":{description:"Sets default values to fields affected by `server` profile, enables discovery and UPnP in local networks.",transform:t=>((0,Jr.default)(t,"Discovery.MDNS.Enabled",!0),(0,Jr.default)(t,"Discovery.webRTCStar.Enabled",!0),(0,Jr.default)(t,"Swarm",{...t.Swarm||{},DisableNatPortMap:!1}),t)},test:{description:"Reduces external interference, useful for running ipfs in test environments. Note that with these settings node won't be able to talk to the rest of the network without manual bootstrap.",transform:t=>{let e=uu();return(0,Jr.default)(t,"Addresses.API",e.Addresses.API?"/ip4/127.0.0.1/tcp/0":""),(0,Jr.default)(t,"Addresses.Gateway",e.Addresses.Gateway?"/ip4/127.0.0.1/tcp/0":""),(0,Jr.default)(t,"Addresses.Swarm",e.Addresses.Swarm.length?["/ip4/127.0.0.1/tcp/0"]:[]),(0,Jr.default)(t,"Addresses.Delegates",[]),(0,Jr.default)(t,"Bootstrap",[]),(0,Jr.default)(t,"Discovery.MDNS.Enabled",!1),(0,Jr.default)(t,"Discovery.webRTCStar.Enabled",!1),(0,Jr.default)(t,"Swarm",{...t.Swarm||{},DisableNatPortMap:!0}),t}},"default-networking":{description:"Restores default network settings. Inverse profile of the `test` profile.",transform:t=>{let e=uu();return(0,Jr.default)(t,"Addresses.API",e.Addresses.API),(0,Jr.default)(t,"Addresses.Gateway",e.Addresses.Gateway),(0,Jr.default)(t,"Addresses.Swarm",e.Addresses.Swarm),(0,Jr.default)(t,"Addresses.Delegates",e.Addresses.Delegates),(0,Jr.default)(t,"Bootstrap",e.Bootstrap),(0,Jr.default)(t,"Discovery.MDNS.Enabled",e.Discovery.MDNS.Enabled),(0,Jr.default)(t,"Discovery.webRTCStar.Enabled",e.Discovery.webRTCStar.Enabled),(0,Jr.default)(t,"Swarm",{...t.Swarm||{},DisableNatPortMap:!1}),t}},lowpower:{description:"Reduces daemon overhead on the system. May affect node functionality,performance of content discovery and data fetching may be degraded. Recommended for low power systems.",transform:t=>{let e=t.Swarm||{},r=e.ConnMgr||{};return r.LowWater=20,r.HighWater=40,e.ConnMgr=r,t.Swarm=e,t}},"default-power":{description:'Inverse of "lowpower" profile.',transform:t=>{let e=uu();return t.Swarm=e.Swarm,t}}};var nOe=(0,JY.default)("ipfs:core:config");function eX({repo:t}){return{getAll:ce(e),get:ce(r),set:ce(i),replace:ce(n),profiles:{apply:ce(s),list:ce(sOe)}};async function e(o={}){return t.config.getAll(o)}async function r(o,a){return o?t.config.get(o,a):Promise.reject(new Error("key argument is required"))}async function i(o,a,c){return t.config.set(o,a,c)}async function n(o,a){return t.config.replace(o,a)}async function s(o,a={dryRun:!1}){let{dryRun:c}=a,u=Ep[o];if(!u)throw new Error(`No profile with name '${o}' exists`);try{let f=await t.config.getAll(a),d=JSON.parse(JSON.stringify(f));return d=u.transform(d),c||await t.config.replace(d,a),delete f.Identity.PrivKey,delete d.Identity.PrivKey,{original:f,updated:d}}catch(f){throw nOe(f),new Error(`Could not apply profile '${o}' to config: ${f.message}`)}}}async function sOe(t){return Object.keys(Ep).map(e=>({name:e,description:Ep[e].description}))}l();l();Te();l();Y2();var Vb=({enumerable:t=!0,configurable:e=!1}={})=>({enumerable:t,configurable:e,writable:!1}),Vx=function*(t,e){if(t!=null&&!(t instanceof Uint8Array))for(let[r,i]of Object.entries(t)){let n=[...e,r];if(i!=null&&typeof i=="object")if(Array.isArray(i))for(let[s,o]of i.entries()){let a=[...n,s],c=J.asCID(o);c?yield[a.join("/"),c]:typeof o=="object"&&(yield*Vx(o,a))}else{let s=J.asCID(i);s?yield[n.join("/"),s]:yield*Vx(i,n)}}},zx=function*(t,e){if(t!=null)for(let[r,i]of Object.entries(t)){let n=[...e,r];if(yield n.join("/"),i!=null&&!(i instanceof Uint8Array)&&typeof i=="object"&&!J.asCID(i))if(Array.isArray(i))for(let[s,o]of i.entries()){let a=[...n,s];yield a.join("/"),typeof o=="object"&&!J.asCID(o)&&(yield*zx(o,a))}else yield*zx(i,n)}},oOe=(t,e)=>{let r=t;for(let[i,n]of e.entries()){if(r=r[n],r==null)throw new Error(`Object has no property at ${e.slice(0,i+1).map(o=>`[${JSON.stringify(o)}]`).join("")}`);let s=J.asCID(r);if(s)return{value:s,remaining:e.slice(i+1).join("/")}}return{value:r}},tX=class{constructor({cid:e,bytes:r,value:i}){if(!e||!r||typeof i=="undefined")throw new Error("Missing required argument");this.cid=e,this.bytes=r,this.value=i,this.asBlock=this,Object.defineProperties(this,{cid:Vb(),bytes:Vb(),value:Vb(),asBlock:Vb()})}links(){return Vx(this.value,[])}tree(){return zx(this.value,[])}get(e="/"){return oOe(this.value,e.split("/").filter(Boolean))}};var Sp=({bytes:t,cid:e,value:r,codec:i})=>{let n=r!==void 0?r:i&&i.decode(t);if(n===void 0)throw new Error('Missing required argument, must either provide "value" or "codec"');return new tX({cid:e,bytes:t,value:n})};li();l();Te();l();var Hx=M(Es());function Gx(t){let e=Qw({version:1,roots:t}),r=Hx.default.encode(e.length),i=new Uint8Array(r.length+e.length);return i.set(r,0),i.set(e,r.length),i}function rX(t){return{async setRoots(e){let r=Gx(e);await t.write(r)},async writeBlock(e){let{cid:r,bytes:i}=e;await t.write(new Uint8Array(Hx.default.encode(r.bytes.length+i.length))),await t.write(r.bytes),i.length&&await t.write(i)},async close(){return t.end()}}}l();function zb(){}function iX(){let t=[],e=null,r=zb,i=!1,n=null,s=zb,o=()=>(e||(e=new Promise(u=>{r=()=>{e=null,r=zb,u()}})),e),a={write(u){t.push(u);let f=o();return s(),f},async end(){i=!0;let u=o();return s(),u}},c={async next(){let u=t.shift();return u?(t.length===0&&r(),{done:!1,value:u}):i?(r(),{done:!0,value:void 0}):(n||(n=new Promise(f=>{s=()=>(n=null,s=zb,f(c.next()))})),n)}};return{writer:a,iterator:c}}l();var Mf=M(Es());Te();Bn();var $x={SHA2_256:18,LENGTH:32,DAG_PB:112};async function Hb(t){let e=await t.upTo(8),r=Mf.default.decode(e);return t.seek(Mf.default.decode.bytes),r}async function Wx(t){let e=await Hb(t);if(e===0)throw new Error("Invalid CAR header (zero length)");let r=await t.exactly(e);t.seek(e);let i=Ol(r);if(i==null||Array.isArray(i)||typeof i!="object")throw new Error("Invalid CAR header format");if(i.version!==1)throw typeof i.version=="string"?new Error(`Invalid CAR version: "${i.version}"`):new Error(`Invalid CAR version: ${i.version}`);if(!Array.isArray(i.roots))throw new Error("Invalid CAR header format");if(Object.keys(i).filter(n=>n!=="roots"&&n!=="version").length)throw new Error("Invalid CAR header format");return i}async function aOe(t){let e=await t.upTo(8);Mf.default.decode(e);let r=Mf.default.decode.bytes,i=Mf.default.decode(e.subarray(Mf.default.decode.bytes)),n=Mf.default.decode.bytes,s=r+n+i,o=await t.exactly(s);return t.seek(s),o}async function cOe(t){let e=await t.exactly(2);if(e[0]===$x.SHA2_256&&e[1]===$x.LENGTH){let o=await t.exactly(34);t.seek(34);let a=Ri(o);return J.create(0,$x.DAG_PB,a)}let r=await Hb(t);if(r!==1)throw new Error(`Unexpected CID version (${r})`);let i=await Hb(t),n=await aOe(t),s=Ri(n);return J.create(r,i,s)}async function nX(t){let e=t.pos,r=await Hb(t);if(r===0)throw new Error("Invalid CAR section (zero length)");r+=t.pos-e;let i=await cOe(t),n=r-(t.pos-e);return{cid:i,length:r,blockLength:n}}async function uOe(t){let{cid:e,blockLength:r}=await nX(t),i=await t.exactly(r);return t.seek(r),{bytes:i,cid:e}}async function fOe(t){let e=t.pos,{cid:r,length:i,blockLength:n}=await nX(t),s={cid:r,length:i,blockLength:n,offset:e,blockOffset:t.pos};return t.seek(s.blockLength),s}function sX(t){let e=Wx(t);return{header:()=>e,async*blocks(){for(await e;(await t.upTo(8)).length>0;)yield await uOe(t)},async*blocksIndex(){for(await e;(await t.upTo(8)).length>0;)yield await fOe(t)}}}function Gb(t){let e=0;return{async upTo(r){return t.subarray(e,e+Math.min(r,t.length-e))},async exactly(r){if(r>t.length-e)throw new Error("Unexpected end of data");return t.subarray(e,e+r)},seek(r){e+=r},get pos(){return e}}}function lOe(t){let e=0,r=0,i=0,n=new Uint8Array(0),s=async o=>{r=n.length-i;let a=[n.subarray(i)];for(;r<o;){let u=await t();if(u==null)break;r<0?u.length>r&&a.push(u.subarray(-r)):a.push(u),r+=u.length}n=new Uint8Array(a.reduce((u,f)=>u+f.length,0));let c=0;for(let u of a)n.set(u,c),c+=u.length;i=0};return{async upTo(o){return n.length-i<o&&await s(o),n.subarray(i,i+Math.min(n.length-i,o))},async exactly(o){if(n.length-i<o&&await s(o),n.length-i<o)throw new Error("Unexpected end of data");return n.subarray(i,i+o)},seek(o){e+=o,i+=o},get pos(){return e}}}function oX(t){let e=t[Symbol.asyncIterator]();async function r(){let i=await e.next();return i.done?null:i.value}return lOe(r)}var xp=class{constructor(e,r){this._encoder=r,this._mutex=r.setRoots(e),this._ended=!1}async put(e){if(!(e.bytes instanceof Uint8Array)||!e.cid)throw new TypeError("Can only write {cid, bytes} objects");if(this._ended)throw new Error("Already closed");let r=J.asCID(e.cid);if(!r)throw new TypeError("Can only write {cid, bytes} objects");return this._mutex=this._mutex.then(()=>this._encoder.writeBlock({cid:r,bytes:e.bytes})),this._mutex}async close(){if(this._ended)throw new Error("Already closed");return await this._mutex,this._ended=!0,this._encoder.close()}static create(e){e=dOe(e);let{encoder:r,iterator:i}=aX(),n=new xp(e,r),s=new Yx(i);return{writer:n,out:s}}static createAppender(){let{encoder:e,iterator:r}=aX();e.setRoots=()=>Promise.resolve();let i=new xp([],e),n=new Yx(r);return{writer:i,out:n}}static async updateRootsInBytes(e,r){let i=Gb(e);await Wx(i);let n=Gx(r);if(i.pos!==n.length)throw new Error(`updateRoots() can only overwrite a header of the same length (old header is ${i.pos} bytes, new header is ${n.length} bytes)`);return e.set(n,0),e}},Yx=class{constructor(e){this._iterator=e}[Symbol.asyncIterator](){if(this._iterating)throw new Error("Multiple iterator not supported");return this._iterating=!0,this._iterator}};function aX(){let t=iX(),{writer:e,iterator:r}=t;return{encoder:rX(e),iterator:r}}function dOe(t){if(t===void 0)return[];if(!Array.isArray(t)){let r=J.asCID(t);if(!r)throw new TypeError("roots must be a single CID or an array of CIDs");return[r]}let e=[];for(let r of t){let i=J.asCID(r);if(!i)throw new TypeError("roots must be a single CID or an array of CIDs");e.push(i)}return e}var cX=M(Ee());Hs();a9();var uX=(0,cX.default)("ipfs:components:dag:import"),hOe=[Pi,s9];function fX({repo:t,preload:e,codecs:r}){async function*i(n,s={}){s.preload!==!1&&e(n);let o=J.asCID(n);if(!o)throw new Error(`Unexpected error converting CID type: ${n}`);uX(`Exporting ${o} as car`);let{writer:a,out:c}=await xp.create([o]),u=null;(async()=>{try{await lX(t,{signal:s.signal,timeout:s.timeout},o,a,r),a.close()}catch(f){u=f}})();for await(let f of c){if(u)break;yield f}if(u)throw u}return ce(i)}async function lX(t,e,r,i,n,s=new Set){let o=r.toString(pt);if(s.has(o))return;let a=await pOe(t,e,r,n);uX(`Adding block ${r} to car`),await i.put(a),s.add(o);for(let c of a.links)await lX(t,e,c,i,n,s)}async function pOe(t,e,r,i){let n=await t.blocks.get(r,e),s=[],o=await i.getCodec(r.code);if(o)s=[...Sp({bytes:n,cid:r,codec:o}).links()].map(c=>c[1]);else if(!hOe.includes(r.code))throw new Error(`Can't decode links in block with codec 0x${r.code.toString(16)} to form complete DAG`);return{cid:r,bytes:n,links:s}}l();var hX=M(Sd()),pX=M(is());var yX=M(Rt());function gX({codecs:t,repo:e,preload:r}){return ce(async function(s,o={}){if(o.preload!==!1&&r(s),o.path){let d=o.localResolve?await(0,hX.default)(uf(s,o.path,t,e,o)):await(0,pX.default)(uf(s,o.path,t,e,o));if(!d)throw(0,yX.default)(new Error("Not found"),"ERR_NOT_FOUND");return d}let a=await t.getCodec(s.code),c=await e.blocks.get(s,o);return{value:a.decode(c),remainderPath:""}})}l();l();var Xx=class{constructor(e,r,i){this._version=e,this._roots=r,this._iterable=i,this._decoded=!1}get version(){return this._version}async getRoots(){return this._roots}},Ap=class extends Xx{[Symbol.asyncIterator](){if(this._decoded)throw new Error("Cannot decode more than once");if(!this._iterable)throw new Error("Block iterable not found");return this._decoded=!0,this._iterable[Symbol.asyncIterator]()}static async fromBytes(e){let{version:r,roots:i,iterator:n}=await mX(e);return new Ap(r,i,n)}static async fromIterable(e){let{version:r,roots:i,iterator:n}=await bX(e);return new Ap(r,i,n)}},$b=class extends Xx{[Symbol.asyncIterator](){if(this._decoded)throw new Error("Cannot decode more than once");if(!this._iterable)throw new Error("Block iterable not found");this._decoded=!0;let e=this._iterable[Symbol.asyncIterator]();return{async next(){let r=await e.next();return r.done?r:{done:!1,value:r.value.cid}}}}static async fromBytes(e){let{version:r,roots:i,iterator:n}=await mX(e);return new $b(r,i,n)}static async fromIterable(e){let{version:r,roots:i,iterator:n}=await bX(e);return new $b(r,i,n)}};async function mX(t){if(!(t instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return vX(Gb(t))}async function bX(t){if(!t||typeof t[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return vX(oX(t))}async function vX(t){let e=sX(t),{version:r,roots:i}=await e.header();return{version:r,roots:i,iterator:e.blocks()}}var wX=M(ig()),_X=M(ic()),EX=M(oo()),SX=M(Ee()),xX=(0,SX.default)("ipfs:components:dag:import");function AX({repo:t}){async function*e(r,i={}){let n=await t.gcLock.readLock();try{let s={signal:i.signal,timeout:i.timeout},o=(0,wX.default)(r),{value:a,done:c}=await o.peek();if(c)return;a&&o.push(a);let u;a instanceof Uint8Array?u=[o]:u=o;for await(let f of u){let d=await gOe(t,s,f);if(i.pinRoots!==!1)for(let h of d){let p="";try{await t.blocks.has(h)?(xX(`Pinning root ${h}`),await t.pins.pinRecursively(h)):p="blockstore: block not found"}catch(y){p=y.message}yield{root:{cid:h,pinErrorMsg:p}}}}}finally{n()}}return ce(e)}async function gOe(t,e,r){let i=await Ap.fromIterable(r),n=await i.getRoots();return await(0,_X.default)(t.blocks.putMany((0,EX.default)(i,({cid:s,bytes:o})=>(xX(`Import block ${s}`),{key:s,value:o})),{signal:e.signal})),n}l();Te();function IX({repo:t,codecs:e,hashers:r,preload:i}){async function n(s,o={}){let a=o.pin?await t.gcLock.readLock():null;try{let c=o.format||"dag-cbor",u=o.version!=null?o.version:c==="dag-pb"?0:1,f=await e.getCodec(c);if(!f)throw new Error(`Unknown codec ${o.format}, please configure additional BlockCodecs for this IPFS instance`);let d=await r.getHasher(o.hashAlg||"sha2-256");if(!d)throw new Error(`Unknown hash algorithm ${o.hashAlg}, please configure additional MultihashHashers for this IPFS instance`);let h=f.encode(s),p=await d.digest(h),y=J.create(u,f.code,p);return await t.blocks.put(y,h,{signal:o.signal}),o.pin&&await t.pins.pinRecursively(y),o.preload!==!1&&i(y),y}finally{a&&a()}}return ce(n)}l();function TX({repo:t,codecs:e,preload:r}){async function i(n,s={}){let{cid:o}=Wc(n);return s.preload!==!1&&r(o),cf(t,e,n,s)}return ce(i)}var Qx=class{constructor({repo:e,codecs:r,hashers:i,preload:n}){this.export=fX({repo:e,preload:n,codecs:r}),this.get=gX({codecs:r,repo:e,preload:n}),this.import=AX({repo:e}),this.resolve=TX({repo:e,codecs:r,preload:n}),this.put=IX({repo:e,codecs:r,hashers:i,preload:n})}};l();var DX=M(Yb()),Jx=M(Ee()),BX=M(CX()),NX=M(wn());l();var OX=M(ly()),Zx=M(Ee()),Xb=M(Yc()),wOe=Object.assign((0,Zx.default)("ipfs:preload"),{error:(0,Zx.default)("ipfs:preload:error")}),_Oe=Xb.default.default?Xb.default.default:Xb.default,EOe=new _Oe({concurrency:4});function kX(t,e={}){return wOe(t),EOe.add(async()=>{let i=(await OX.default.post(t,{signal:e.signal})).body.getReader();try{for(;;){let{done:n}=await i.read();if(n)return}}finally{i.releaseLock()}})}var MX=M(g0()),Eg=Object.assign((0,Jx.default)("ipfs:preload"),{error:(0,Jx.default)("ipfs:preload:error")});function LX(t={}){if(t.enabled=Boolean(t.enabled),t.addresses=t.addresses||[],t.cache=t.cache||1e3,!t.enabled||!t.addresses.length)return Eg("preload disabled"),Object.assign(()=>{},{start:()=>{},stop:()=>{}});let e=!0,r=[],i=t.addresses.map(DX.default),n=(0,MX.default)(t.cache),s=async o=>{try{if(e)throw new Error(`preload ${o} but preloader is not started`);let a=o.toString();if(n.has(a))return;n.set(a,!0);let c=(0,BX.default)(i),u=!1,f=Date.now();for(let d of c){if(e)throw new Error(`preload aborted for ${a}`);let h;try{h=new NX.AbortController,r=r.concat(h),await kX(`${d}/api/v0/refs?r=true&arg=${encodeURIComponent(a)}`,{signal:h.signal}),u=!0}catch(p){p.type!=="aborted"&&Eg.error(p)}finally{r=r.filter(p=>p!==h)}if(u)break}Eg(`${u?"":"un"}successfully preloaded ${a} in ${Date.now()-f}ms`)}catch(a){Eg.error(a)}};return s.start=()=>{e=!1},s.stop=()=>{e=!0,Eg(`aborting ${r.length} pending preload request(s)`),r.forEach(o=>o.abort()),r=[]},s}l();var eA=M(Ee()),Qb=Object.assign((0,eA.default)("ipfs:mfs-preload"),{error:(0,eA.default)("ipfs:mfs-preload:error")});function qX({preload:t,files:e,options:r={}}){if(r.interval=r.interval||30*1e3,!r.enabled){Qb("MFS preload disabled");let o=async()=>{};return{start:o,stop:o}}let i="",n,s=async()=>{try{let o=await e.stat("/"),a=o.cid.toString();i!==a&&(Qb(`preloading updated MFS root ${i} -> ${o.cid}`),await t(o.cid),i=a)}catch(o){Qb.error("failed to preload MFS root",o)}finally{n=setTimeout(s,r.interval)}};return{async start(){let o=await e.stat("/");i=o.cid.toString(),Qb(`monitoring MFS root ${o.cid}`),n=setTimeout(s,r.interval)},stop(){clearTimeout(n)}}}l();l();var lQ=M(oA()),Jb;function xg(t=!1){if(Jb)return Jb;let e=(0,lQ.default)({singleProcess:t});return Jb={readLock:r=>async(...i)=>{let n=await e.readLock();try{return await r.apply(null,i)}finally{n()}},writeLock:r=>async(...i)=>{let n=await e.writeLock();try{return await r.apply(null,i)}finally{n()}}},Jb}var yA=M(d0());l();l();l();Te();di();var dQ=M(Ee()),aA=M(Rt());var hQ=(0,dQ.default)("ipfs:mfs:utils:with-mfs-root");async function Tp(t,e){if(e&&e.signal&&e.signal.aborted)throw(0,aA.default)(new Error("Request aborted"),"ERR_ABORTED",{name:"Aborted"});await t.repo.datastore.open();let r;try{let i=await t.repo.datastore.get(ay);r=J.decode(i)}catch(i){if(i.code!=="ERR_NOT_FOUND")throw i;hQ("Creating new MFS root");let n=ot({Data:new ct({type:"directory"}).marshal(),Links:[]}),s=await dr.digest(n);if(r=J.createV0(s),await t.repo.blocks.put(r,n),e&&e.signal&&e.signal.aborted)throw(0,aA.default)(new Error("Request aborted"),"ERR_ABORTED",{name:"Aborted"});await t.repo.datastore.put(ay,r.bytes)}return hQ(`Loaded MFS root /ipfs/${r}`),r}l();function Rp(t=""){return(t.trim().match(/([^\\^/]|\\\/)+/g)||[]).filter(Boolean)}var cA=M(Rt());Te();var uA="ipfs",ei=async(t,e,r)=>{let i=await Tp(t,r),n={entryType:"file"},s="";if(J.asCID(e)?s=`/ipfs/${e}`:s=e.toString(),s=s.trim(),s=s.replace(/(\/\/+)/g,"/"),s.endsWith("/")&&s.length>1&&(s=s.substring(0,s.length-1)),!s)throw(0,cA.default)(new Error("paths must not be empty"),"ERR_NO_PATH");if(s.substring(0,1)!=="/")throw(0,cA.default)(new Error("paths must start with a leading slash"),"ERR_INVALID_PATH");s.substring(s.length-1)==="/"&&(s=s.substring(0,s.length-1));let o=Rp(s);if(o[0]===uA){let c;o.length===2?c=`/${o.join("/")}`:c=`/${o.slice(0,o.length-1).join("/")}`,n={type:"ipfs",depth:o.length-2,entryType:"file",mfsPath:`/${o.join("/")}`,mfsDirectory:c,parts:o,path:`/${o.join("/")}`,name:o[o.length-1]}}else{let c=`/${uA}/${i}${o.length?"/"+o.join("/"):""}`,u=`/${uA}/${i}/${o.slice(0,o.length-1).join("/")}`;n={type:"mfs",depth:o.length,entryType:"file",mfsDirectory:u,mfsPath:c,parts:o,path:`/${o.join("/")}`,name:o[o.length-1]}}let a=n.type==="mfs"?n.mfsPath:n.path;try{let c=await fn(a,t.repo.blocks,r);n.cid=c.cid,n.mfsPath=`/ipfs/${c.path}`,n.entryType=c.type,n.content=c.content,(n.entryType==="file"||n.entryType==="directory")&&(c.type==="file"||c.type==="directory")&&(n.unixfs=c.unixfs)}catch(c){if(c.code!=="ERR_NOT_FOUND")throw c}return n.exists=Boolean(n.cid),n};var pQ=M(Ee()),yQ=M(Rt());var BOe=Tt.bind({ignoreUndefined:!0}),NOe=(0,pQ.default)("ipfs:mfs:stat"),MOe={withLocal:!1};function jf(t){async function e(r,i={}){i=BOe(MOe,i),NOe(`Fetching stats for ${r}`);let{type:n,cid:s,mfsPath:o}=await ei(t,r,i),a=n==="ipfs"&&s?s:o,c;try{c=await fn(a,t.repo.blocks)}catch(u){throw u.code==="ERR_NOT_FOUND"?(0,yQ.default)(new Error(`${r} does not exist`),"ERR_NOT_FOUND"):u}if(!gQ[c.type])throw new Error(`Cannot stat codec ${c.cid.code}`);return gQ[c.type](c)}return ce(e)}var gQ={raw:t=>({cid:t.cid,size:t.node.length,cumulativeSize:t.node.length,blocks:0,type:"file",local:void 0,sizeLocal:void 0,withLocality:!1}),file:t=>{let e={cid:t.cid,type:"file",size:t.unixfs.fileSize(),cumulativeSize:ot(t.node).length+(t.node.Links||[]).reduce((r,i)=>r+(i.Tsize||0),0),blocks:t.unixfs.blockSizes.length,local:void 0,sizeLocal:void 0,withLocality:!1,mode:t.unixfs.mode};return t.unixfs.mtime&&(e.mtime=t.unixfs.mtime),e},directory:t=>{let e={cid:t.cid,type:"directory",size:0,cumulativeSize:ot(t.node).length+(t.node.Links||[]).reduce((r,i)=>r+(i.Tsize||0),0),blocks:t.node.Links.length,local:void 0,sizeLocal:void 0,withLocality:!1,mode:t.unixfs.mode};return t.unixfs.mtime&&(e.mtime=t.unixfs.mtime),e},object:t=>({cid:t.cid,size:t.node.length,cumulativeSize:t.node.length,type:"file",blocks:0,local:void 0,sizeLocal:void 0,withLocality:!1}),identity:t=>({cid:t.cid,size:t.node.length,cumulativeSize:t.node.length,blocks:0,type:"file",local:void 0,sizeLocal:void 0,withLocality:!1})};l();var jQ=M(Ee()),kp=M(Rt());l();var mQ=M(Ee()),LOe=(0,mQ.default)("ipfs:mfs:utils:to-trail");async function lc(t,e){LOe(`Creating trail for path ${e}`);let r=[];for await(let i of HS(e,t.repo.blocks))r.push({name:i.name,cid:i.cid,size:i.size,type:i.type});return r}l();Te();var xQ=M(Ee());l();l();Te();di();var e5=async(t,e,r)=>{r.codec||(r.codec=Nn),r.hasher||(r.hasher=dr),r.cidVersion===void 0&&(r.cidVersion=1),r.codec===Nn&&r.hasher!==dr&&(r.cidVersion=1);let i=await r.hasher.digest(t),n=J.create(r.cidVersion,r.codec.code,i);return r.onlyHash||await e.put(n,t,{signal:r.signal}),n};var n5=M(tg());l();var t5=cd.code,r5=8;async function i5(t){return(await cd.encode(t)).slice(0,8).reverse()}var bQ=class{constructor(e,r){this.options=r||{},this.root=e.root,this.dir=e.dir,this.path=e.path,this.dirty=e.dirty,this.flat=e.flat,this.parent=e.parent,this.parentKey=e.parentKey,this.unixfs=e.unixfs,this.mode=e.mode,this.mtime=e.mtime,this.cid=void 0,this.size=void 0}async put(e,r){}get(e){return Promise.resolve(this)}async*eachChildSeries(){}async*flush(e){}},Ag=class extends bQ{constructor(e,r){super(e,r);this._bucket=(0,n5.createHAMT)({hashFn:i5,bits:r5})}async put(e,r){await this._bucket.put(e,r)}get(e){return this._bucket.get(e)}childCount(){return this._bucket.leafCount()}directChildrenCount(){return this._bucket.childrenCount()}onlyChild(){return this._bucket.onlyChild()}async*eachChildSeries(){for await(let{key:e,value:r}of this._bucket.eachLeafSeries())yield{key:e,child:r}}async*flush(e){yield*vQ(this._bucket,e,this,this.options)}};async function*vQ(t,e,r,i){let n=t._children,s=[],o=0;for(let p=0;p<n.length;p++){let y=n.get(p);if(!y)continue;let b=p.toString(16).toUpperCase().padStart(2,"0");if(y instanceof n5.Bucket){let E;for await(let v of await vQ(y,e,null,i))E=v;if(!E)throw new Error("Could not flush sharded directory, no subshard found");s.push({Name:b,Tsize:E.size,Hash:E.cid}),o+=E.size}else if(typeof y.value.flush=="function"){let E=y.value,v;for await(let R of E.flush(e))v=R,yield v;let A=b+y.key;s.push({Name:A,Tsize:v.size,Hash:v.cid}),o+=v.size}else{let E=y.value;if(!E.cid)continue;let v=b+y.key,A=E.size;s.push({Name:v,Tsize:A,Hash:E.cid}),o+=A}}let a=Uint8Array.from(n.bitField().reverse()),u={Data:new ct({type:"hamt-sharded-directory",data:a,fanout:t.tableSize(),hashType:t5,mtime:r&&r.mtime,mode:r&&r.mode}).marshal(),Links:s},f=ot(zi(u)),d=await e5(f,e,i),h=f.length+o;yield{cid:d,node:u,size:h}}l();var Ig=M(tg());var wQ=M(Ee());var _Q=M(is());Te();var s5=(0,wQ.default)("ipfs:mfs:core:utils:hamt-utils"),Pp=async(t,e,r,i)=>{if(!i.parent.Data)throw new Error("Could not update HAMT directory because parent had no data");let n=Uint8Array.from(r._children.bitField().reverse()),s=ct.unmarshal(i.parent.Data),o=new ct({type:"hamt-sharded-directory",data:n,fanout:r.tableSize(),hashType:t5,mode:s.mode,mtime:s.mtime}),a=await t.hashers.getHasher(i.hashAlg),c={Data:o.marshal(),Links:e.sort((h,p)=>(h.Name||"").localeCompare(p.Name||""))},u=ot(c),f=await a.digest(u),d=J.create(i.cidVersion,Pt,f);return i.flush&&await t.repo.blocks.put(d,u),{node:c,cid:d,size:e.reduce((h,p)=>h+(p.Tsize||0),u.length)}},fA=async(t,e,r,i)=>{let n=new Ig.Bucket({hash:e._options.hash,bits:e._options.bits},r,i);return r._putObjectAt(i,n),await Tg(t,n,e),n},lA=async t=>{let e=(0,Ig.createHAMT)({hashFn:i5,bits:r5});return await Tg(t,e,e),e},Tg=async(t,e,r)=>{await Promise.all(t.map(i=>{let n=i.Name||"";if(n.length===2){let s=parseInt(n,16);return e._putObjectAt(s,new Ig.Bucket({hash:r._options.hash,bits:r._options.bits},e,s)),Promise.resolve()}return r.put(n.substring(2),{size:i.Tsize,cid:i.Hash})}))},Ad=t=>t.toString(16).toUpperCase().padStart(2,"0").substring(0,2),EQ=async(t,e,r)=>{let i=await lA(r.Links),n=await i._findNewBucketAndPos(e),s=[{bucket:n.bucket,prefix:Ad(n.pos)}],o=n.bucket;for(;o!==i;)s.push({bucket:o,prefix:Ad(o._posAtParent)}),o=o._parent;s.reverse(),s[0].node=r;for(let a=0;a<s.length;a++){let c=s[a];if(!c.node)throw new Error("Could not generate HAMT path");let u=c.node.Links.filter(p=>(p.Name||"").substring(0,2)===c.prefix).pop();if(!u){s5(`Link ${c.prefix}${e} will be added`);continue}if(u.Name===`${c.prefix}${e}`){s5(`Link ${c.prefix}${e} will be replaced`);continue}s5(`Found subshard ${c.prefix}`);let f=await t.repo.blocks.get(u.Hash),d=Bt(f);if(!s[a+1]){s5(`Loaded new subshard ${c.prefix}`),await fA(d.Links,i,c.bucket,parseInt(c.prefix,16));let p=await i._findNewBucketAndPos(e);s.push({bucket:p.bucket,prefix:Ad(p.pos),node:d});continue}let h=s[a+1];await Tg(d.Links,h.bucket,i),h.node=d}return await i.put(e,!0),s.reverse(),{rootBucket:i,path:s}},SQ=async(t,e,r={})=>{let i=new Ag({root:!0,dir:!0,parent:void 0,parentKey:void 0,path:"",dirty:!0,flat:!1,mtime:r.mtime,mode:r.mode},r);for(let s=0;s<e.length;s++)await i._bucket.put(e[s].name,{size:e[s].size,cid:e[s].cid});let n=await(0,_Q.default)(i.flush(t.repo.blocks));if(!n)throw new Error("Flushing shard yielded no result");return n};var dc=M(Rt()),AQ=M(is()),hc=(0,xQ.default)("ipfs:mfs:core:utils:add-link");async function lo(t,e){let r=e.parent;if(e.parentCid){let n=J.asCID(e.parentCid);if(n===null)throw(0,dc.default)(new Error("Invalid CID passed to addLink"),"EINVALIDPARENTCID");if(n.code!==Pt)throw(0,dc.default)(new Error("Unsupported codec. Only DAG-PB is supported"),"EINVALIDPARENTCID");hc(`Loading parent node ${n}`);let s=await t.repo.blocks.get(n);r=Bt(s)}if(!r)throw(0,dc.default)(new Error("No parent node or CID passed to addLink"),"EINVALIDPARENT");if(!e.cid)throw(0,dc.default)(new Error("No child cid passed to addLink"),"EINVALIDCHILDCID");if(!e.name)throw(0,dc.default)(new Error("No child name passed to addLink"),"EINVALIDCHILDNAME");if(!e.size&&e.size!==0)throw(0,dc.default)(new Error("No child size passed to addLink"),"EINVALIDCHILDSIZE");if(!r.Data)throw(0,dc.default)(new Error("Parent node with no data passed to addLink"),"ERR_INVALID_PARENT");let i=ct.unmarshal(r.Data);return i.type==="hamt-sharded-directory"?(hc("Adding link to sharded directory"),UOe(t,{...e,parent:r})):r.Links.length>=e.shardSplitThreshold?(hc("Converting directory to sharded directory"),qOe(t,{...e,parent:r,mtime:i.mtime,mode:i.mode})):(hc(`Adding ${e.name} (${e.cid}) to regular directory`),jOe(t,{...e,parent:r}))}var qOe=async(t,e)=>{let r=await SQ(t,e.parent.Links.map(i=>({name:i.Name||"",size:i.Tsize||0,cid:i.Hash})).concat({name:e.name,size:e.size,cid:e.cid}),e);return hc(`Converted directory to sharded directory ${r.cid}`),r},jOe=async(t,e)=>{let r=e.parent.Links.filter(u=>u.Name!==e.name);if(r.push({Name:e.name,Tsize:e.size,Hash:e.cid}),!e.parent.Data)throw(0,dc.default)(new Error("Parent node with no data passed to addToDirectory"),"ERR_INVALID_PARENT");let i=ct.unmarshal(e.parent.Data),n;if(i.mtime){let u=Date.now(),f=Math.floor(u/1e3);i.mtime={secs:f,nsecs:(u-f*1e3)*1e3},n=i.marshal()}else n=e.parent.Data;e.parent=zi({Data:n,Links:r});let s=await t.hashers.getHasher(e.hashAlg),o=ot(e.parent),a=await s.digest(o),c=J.create(e.cidVersion,Pt,a);return e.flush&&await t.repo.blocks.put(c,o),{node:e.parent,cid:c,size:o.length}},UOe=async(t,e)=>{let{shard:r,path:i}=await FOe(t,e),n=await(0,AQ.default)(r.flush(t.repo.blocks));if(!n)throw new Error("No result from flushing shard");let s=await t.repo.blocks.get(n.cid),o=Bt(s),a=e.parent.Links.filter(u=>(u.Name||"").substring(0,2)!==i[0].prefix),c=o.Links.find(u=>(u.Name||"").substring(0,2)===i[0].prefix);if(!c)throw new Error(`No link found with prefix ${i[0].prefix}`);return a.push(c),Pp(t,a,i[0].bucket,e)},FOe=async(t,e)=>{let r={name:e.name,cid:e.cid,size:e.size};if(!e.parent.Data)throw(0,dc.default)(new Error("Parent node with no data passed to addFileToShardedDirectory"),"ERR_INVALID_PARENT");let i=await lA(e.parent.Links),n=ct.unmarshal(e.parent.Data),s=new Ag({root:!0,dir:!0,parent:void 0,parentKey:void 0,path:"",dirty:!0,flat:!1,mode:n.mode},e);s._bucket=i,n.mtime&&(s.mtime={secs:Math.round(Date.now()/1e3)});let o=await i._findNewBucketAndPos(r.name),a=KOe(o);a[0].node=e.parent;let c=0;for(;c<a.length;){let u=a[c];c++;let f=u.node;if(!f)throw new Error("Segment had no node");let d=f.Links.find(b=>(b.Name||"").substring(0,2)===u.prefix);if(!d){hc(`Link ${u.prefix}${r.name} will be added`),c=a.length;break}if(d.Name===`${u.prefix}${r.name}`){hc(`Link ${u.prefix}${r.name} will be replaced`),c=a.length;break}if((d.Name||"").length>2){hc(`Link ${d.Name} ${d.Hash} will be replaced with a subshard`),c=a.length;break}hc(`Found subshard ${u.prefix}`);let h=await t.repo.blocks.get(d.Hash),p=Bt(h);if(!a[c]){hc(`Loaded new subshard ${u.prefix}`),await fA(p.Links,i,u.bucket,parseInt(u.prefix,16));let b=await i._findNewBucketAndPos(r.name);a.push({bucket:b.bucket,prefix:Ad(b.pos),node:p});break}let y=a[c];await Tg(p.Links,y.bucket,i),y.node=p}return await s._bucket.put(r.name,{size:r.size,cid:r.cid}),{shard:s,path:a}},KOe=t=>{let e=[{bucket:t.bucket,prefix:Ad(t.pos)}],r=t.bucket._parent,i=t.bucket._posAtParent;for(;r;)e.push({bucket:r,prefix:Ad(i)}),i=r._posAtParent,r=r._parent;return e.reverse(),e};l();var IQ=M(Ee());var TQ=(0,IQ.default)("ipfs:mfs:utils:update-tree"),VOe={shardSplitThreshold:1e3};async function Rs(t,e,r){r=Object.assign({},VOe,r),TQ("Trail",e),e=e.slice().reverse();let i=0,n;for await(let o of t.repo.blocks.getMany(e.map(a=>a.cid))){let a=Bt(o),c=e[i].cid,u=e[i].name;if(i++,!n){n={cid:c,name:u,size:o.length};continue}let f=await lo(t,{parent:a,name:n.name,cid:n.cid,size:n.size,flush:r.flush,shardSplitThreshold:r.shardSplitThreshold,hashAlg:r.hashAlg,cidVersion:r.cidVersion});n={cid:f.cid,name:u,size:f.size}}let{cid:s}=n;return TQ(`Final CID ${s}`),s}l();var RQ=M(Ee());var PQ=M(Rt()),zOe=(0,RQ.default)("ipfs:mfs:utils:update-mfs-root");async function Ps(t,e,r){if(r&&r.signal&&r.signal.aborted)throw(0,PQ.default)(new Error("Request aborted"),"ERR_ABORTED",{name:"Aborted"});return zOe(`New MFS root will be ${e}`),await t.repo.datastore.put(ay,e.bytes),e}Te();var UQ=M(Nr());var FQ=M(is());l();l();var Id=M(Rt()),OQ=M(Ee());l();Te();async function CQ(t,e,r){let i=new ct({type:e,mode:r.mode,mtime:r.mtime}),n=await t.hashers.getHasher(r.hashAlg),s={Data:i.marshal(),Links:[]},o=ot(s),a=await n.digest(o),c=J.create(r.cidVersion,Pt,a);return r.flush&&await t.repo.blocks.put(c,o),{cid:c,node:s}}var HOe=Tt.bind({ignoreUndefined:!0}),kQ=(0,OQ.default)("ipfs:mfs:mkdir"),GOe={parents:!1,hashAlg:"sha2-256",cidVersion:0,shardSplitThreshold:1e3,flush:!0};function Td(t){async function e(r,i={}){let n=HOe(GOe,i);if(!r)throw new Error("no path given to Mkdir");if(r=r.trim(),r==="/"){if(n.parents)return;throw(0,Id.default)(new Error("cannot create directory '/': Already exists"),"ERR_INVALID_PATH")}if(r.substring(0,1)!=="/")throw(0,Id.default)(new Error("paths must start with a leading slash"),"ERR_INVALID_PATH");kQ(`Creating ${r}`);let s=Rp(r);if(s[0]==="ipfs")throw(0,Id.default)(new Error("path cannot have the prefix 'ipfs'"),"ERR_INVALID_PATH");let o=await Tp(t,n),a,c=[],u=await CQ(t,"directory",n);for(let d=0;d<=s.length;d++){let h=s.slice(0,d),p=`/ipfs/${o}/${h.join("/")}`;try{if(a=await fn(p,t.repo.blocks),a.type!=="file"&&a.type!=="directory")throw(0,Id.default)(new Error(`${r} was not a UnixFS node`),"ERR_NOT_UNIXFS");if(d===s.length){if(n.parents)return;throw(0,Id.default)(new Error("file already exists"),"ERR_ALREADY_EXISTS")}c.push({name:a.name,cid:a.cid})}catch(y){if(y.code==="ERR_NOT_FOUND"){if(d<s.length&&!n.parents)throw(0,Id.default)(new Error(`Intermediate directory path ${p} does not exist, use the -p flag to create it`),"ERR_NOT_FOUND");await $Oe(t,h[h.length-1],u,c[c.length-1],c,n)}else throw y}}let f=await Rs(t,c,n);await Ps(t,f,n)}return ce(e)}var $Oe=async(t,e,r,i,n,s)=>{kQ(`Adding empty dir called ${e} to ${i.cid}`);let o=await lo(t,{parent:i.node,parentCid:i.cid,size:0,cid:r.cid,name:e,hashAlg:s.hashAlg,cidVersion:s.cidVersion,flush:s.flush,shardSplitThreshold:s.shardSplitThreshold});n[n.length-1].cid=o.cid,n.push({name:e,cid:r.cid})};var DQ=M(Ee()),Uf=M(Rt());var WOe=Tt.bind({ignoreUndefined:!0}),o5=(0,DQ.default)("ipfs:mfs:cp"),YOe={parents:!1,flush:!0,hashAlg:"sha2-256",cidVersion:0,shardSplitThreshold:1e3};function Cp(t){async function e(r,i,n={}){let s=WOe(YOe,n);Array.isArray(r)||(r=[r]);let o=await Promise.all(r.map(h=>ei(t,h,s))),a=await ei(t,i,s);if(!o.length||!a)throw(0,Uf.default)(new Error("Please supply at least one source"),"ERR_INVALID_PARAMS");let c=o.find(h=>!h.exists);if(c)throw(0,Uf.default)(new Error(`${c.path} does not exist`),"ERR_INVALID_PARAMS");let u=BQ(a);if(a.exists){if(o5("Destination exists"),o.length===1&&!u)throw(0,Uf.default)(new Error("directory already has entry by that name"),"ERR_ALREADY_EXISTS")}else if(o5("Destination does not exist"),o.length>1){if(!s.parents)throw(0,Uf.default)(new Error("destination did not exist, pass -p to create intermediate directories"),"ERR_INVALID_PARAMS");await Td(t)(a.path,s),a=await ei(t,a.path,s)}else if(a.parts.length>1){let h=`/${a.parts.slice(0,-1).join("/")}`;try{await jf(t)(h,s)}catch(p){if(p.code!=="ERR_NOT_FOUND")throw p;if(!s.parents)throw(0,Uf.default)(new Error("destination did not exist, pass -p to create intermediate directories"),"ERR_INVALID_PARAMS");await Td(t)(h,s),a=await ei(t,a.path,s)}}let f=BQ(a)?a.mfsPath:a.mfsDirectory,d=await lc(t,f);if(o.length===1){let h=o.pop();if(!h)throw(0,Uf.default)(new Error("could not find source"),"ERR_INVALID_PARAMS");let p=u?h.name:a.name;return o5(`Only one source, copying to destination ${u?"directory":"file"} ${p}`),XOe(t,h,p,d,s)}return o5("Multiple sources, wrapping in a directory"),QOe(t,o,a,d,s)}return ce(e)}var BQ=t=>t.unixfs&&t.unixfs.type&&t.unixfs.type.includes("directory"),XOe=async(t,e,r,i,n)=>{let s=i.pop();if(!s)throw(0,Uf.default)(new Error("destination had no parent"),"ERR_INVALID_PARAMS");s=await NQ(t,e,r,s,n),i.push(s);let o=await Rs(t,i,n);await Ps(t,o,n)},QOe=async(t,e,r,i,n)=>{for(let o=0;o<e.length;o++){let a=e[o];r=await NQ(t,a,a.name,r,n)}i[i.length-1]=r;let s=await Rs(t,i,n);await Ps(t,s,n)},NQ=async(t,e,r,i,n)=>{let s=await t.repo.blocks.get(e.cid),{node:o,cid:a,size:c}=await lo(t,{parentCid:i.cid,size:s.length,cid:e.cid,name:r,hashAlg:n.hashAlg,cidVersion:n.cidVersion,flush:n.flush,shardSplitThreshold:n.shardSplitThreshold});return i.node=o,i.cid=a,i.size=c,i};l();var Rg=M(Rt());l();Te();var MQ=M(Ee());var Ff=M(Rt()),Kf=(0,MQ.default)("ipfs:mfs:core:utils:remove-link");async function LQ(t,e){let r=e.parent;if(e.parentCid){let n=J.asCID(e.parentCid);if(n===null)throw(0,Ff.default)(new Error("Invalid CID passed to removeLink"),"EINVALIDPARENTCID");Kf(`Loading parent node ${n}`);let s=await t.repo.blocks.get(n);r=Bt(s)}if(!r)throw(0,Ff.default)(new Error("No parent node or CID passed to removeLink"),"EINVALIDPARENT");if(!e.name)throw(0,Ff.default)(new Error("No child name passed to removeLink"),"EINVALIDCHILDNAME");if(!r.Data)throw(0,Ff.default)(new Error("Parent node had no data"),"ERR_INVALID_NODE");return ct.unmarshal(r.Data).type==="hamt-sharded-directory"?(Kf(`Removing ${e.name} from sharded directory`),JOe(t,{...e,parent:r})):(Kf(`Removing link ${e.name} regular directory`),ZOe(t,{...e,parent:r}))}var ZOe=async(t,e)=>{e.parent.Links=e.parent.Links.filter(o=>o.Name!==e.name);let r=await ot(e.parent),n=await(await t.hashers.getHasher(e.hashAlg)).digest(r),s=J.create(e.cidVersion,Pt,n);return await t.repo.blocks.put(s,r),Kf(`Updated regular directory ${s}`),{node:e.parent,cid:s}},JOe=async(t,e)=>{let{rootBucket:r,path:i}=await EQ(t,e.name,e.parent);await r.del(e.name);let{node:n}=await qQ(t,i,e.name,e);return Pp(t,n.Links,r,e)},qQ=async(t,e,r,i)=>{let n=e.pop();if(!n)throw(0,Ff.default)(new Error("Could not find parent"),"EINVALIDPARENT");let{bucket:s,prefix:o,node:a}=n;if(!a)throw(0,Ff.default)(new Error("Could not find parent"),"EINVALIDPARENT");let c=a.Links.find(p=>(p.Name||"").substring(0,2)===o);if(!c)throw(0,Ff.default)(new Error(`No link found with prefix ${o} for file ${r}`),"ERR_NOT_FOUND");if(c.Name===`${o}${r}`){Kf(`Removing existing link ${c.Name}`);let p=a.Links.filter(y=>y.Name!==c.Name);return await s.del(r),Pp(t,p,s,i)}Kf(`Descending into sub-shard ${c.Name} for ${o}${r}`);let u=await qQ(t,e,r,i),f=u.cid,d=u.size,h=o;if(u.node.Links.length===1){Kf(`Removing subshard for ${o}`);let p=u.node.Links[0];h=`${o}${(p.Name||"").substring(2)}`,f=p.Hash,d=p.Tsize||0}return Kf(`Updating shard ${o} with name ${h}`),eke(t,s,a,o,h,d,f,i)},eke=(t,e,r,i,n,s,o,a)=>{let c=r.Links.filter(u=>u.Name!==i);return c.push({Name:n,Tsize:s,Hash:o}),Pp(t,c,e,a)};var tke=Tt.bind({ignoreUndefined:!0}),rke={recursive:!1,cidVersion:0,hashAlg:"sha2-256",flush:!0,shardSplitThreshold:1e3};function Op(t){async function e(r,i={}){let n=tke(rke,i);Array.isArray(r)||(r=[r]);let s=await Promise.all(r.map(o=>ei(t,o,n)));if(!s.length)throw(0,Rg.default)(new Error("Please supply at least one path to remove"),"ERR_INVALID_PARAMS");s.forEach(o=>{if(o.path==="/")throw(0,Rg.default)(new Error("Cannot delete root"),"ERR_INVALID_PARAMS")});for(let o of s)await ike(t,o.path,n)}return ce(e)}var ike=async(t,e,r)=>{let i=await ei(t,e,r),n=await lc(t,i.mfsPath),s=n[n.length-1];n.pop();let o=n[n.length-1];if(!o)throw(0,Rg.default)(new Error(`${e} does not exist`),"ERR_NOT_FOUND");if(s.type==="directory"&&!r.recursive)throw(0,Rg.default)(new Error(`${e} is a directory, use -r to remove directories`),"ERR_WAS_DIR");let{cid:a}=await LQ(t,{parentCid:o.cid,name:s.name,hashAlg:r.hashAlg,cidVersion:r.cidVersion,flush:r.flush,shardSplitThreshold:r.shardSplitThreshold});o.cid=a;let c=await Rs(t,n,r);await Ps(t,c,r)};var nke=Tt.bind({ignoreUndefined:!0}),ske=(0,jQ.default)("ipfs:mfs:touch"),KQ={flush:!0,shardSplitThreshold:1e3,hashAlg:"sha2-256",cidVersion:0,recursive:!1};function oke(t,e,r){let i=0;return(t.includes("x")||t.includes("X")&&(r||e&1||e&8||e&64))&&(i+=1),t.includes("w")&&(i+=2),t.includes("r")&&(i+=4),i}function ake(t,e){let r=0;return t.includes("u")&&(r+=e<<6),t.includes("g")&&(r+=e<<3),t.includes("o")&&(r+=e),r}function cke(t,e,r){return e.includes("t")&&(r+=parseInt("1000",8)),e.includes("s")&&(t.includes("u")&&(r+=parseInt("4000",8)),t.includes("g")&&(r+=parseInt("2000",8))),r}function uke(t,e,r){e||(e=0);let i=t.match(/^(u?g?o?a?)(-?\+?=?)?(r?w?x?X?s?t?)$/);if(!i)throw new Error(`Invalid file mode: ${t}`);let[,n,s,o]=i;(n==="a"||!n)&&(n="ugo");let a=oke(o,e,r);return a=ake(n,a),a=cke(n,o,a),s==="="?(n.includes("u")&&(e=e&parseInt("7077",8),e=e|a),n.includes("g")&&(e=e&parseInt("7707",8),e=e|a),n.includes("o")&&(e=e&parseInt("7770",8),e=e|a),e):s==="+"?a|e:s==="-"?a^e:e}function VQ(t,e){if(t instanceof String||typeof t=="string"){let r=`${t}`;r.match(/^\d+$/g)?t=parseInt(r,8):t=0+r.split(",").reduce((i,n)=>uke(n,i,e.isDirectory()),e.mode||0)}return t}function zQ(t){async function e(r,i,n={}){let s=nke(KQ,n);ske(`Fetching stats for ${r}`);let{cid:o,mfsDirectory:a,name:c}=await ei(t,r,s);if(o.code!==Pt)throw(0,kp.default)(new Error(`${r} was not a UnixFS node`),"ERR_NOT_UNIXFS");if(s.recursive){let W=await(0,UQ.pipe)(async function*(){for await(let X of Eb(o,t.repo.blocks)){if(X.type!=="file"&&X.type!=="directory")throw(0,kp.default)(new Error(`${r} was not a UnixFS node`),"ERR_NOT_UNIXFS");X.unixfs.mode=VQ(i,X.unixfs);let P=zi({Data:X.unixfs.marshal(),Links:X.node.Links});yield{path:X.path,content:P}}},X=>ap(X,t.repo.blocks,{...s,pin:!1,dagBuilder:async function*(P,g,w){for await(let S of P)yield async function(){let C=S.content,L=ot(C),Y=await e5(L,g,w);if(!C.Data)throw(0,kp.default)(new Error(`${Y} had no data`),"ERR_INVALID_NODE");let V=ct.unmarshal(C.Data);return{cid:Y,size:L.length,path:S.path,unixfs:V}}}}),X=>(0,FQ.default)(X));if(!W)throw(0,kp.default)(new Error(`Could not chmod ${r}`),"ERR_COULD_NOT_CHMOD");await Op(t)(r,s),await Cp(t)(`/ipfs/${W.cid}`,r,s);return}let u=await t.repo.blocks.get(o),f=Bt(u);if(!f.Data)throw(0,kp.default)(new Error(`${o} had no data`),"ERR_INVALID_NODE");let d=ct.unmarshal(f.Data);d.mode=VQ(i,d);let h=ot({Data:d.marshal(),Links:f.Links}),p=s.hashAlg||KQ.hashAlg,b=await(await t.hashers.getHasher(p)).digest(h),E=J.create(s.cidVersion,Pt,b);s.flush&&await t.repo.blocks.put(E,h);let v=await lc(t,a),A=v[v.length-1],R=J.decode(A.cid.bytes),F=await t.repo.blocks.get(R),D=Bt(F),B=await lo(t,{parent:D,name:c,cid:E,size:h.length,flush:s.flush,hashAlg:p,cidVersion:o.version,shardSplitThreshold:1/0});A.cid=B.cid;let H=await Rs(t,v,s);await Ps(t,H,s)}return ce(e)}l();var fke=Tt.bind({ignoreUndefined:!0}),lke={};function HQ(t){async function e(r,i={}){i=fke(lke,i);let{cid:n}=await jf(t)(r,i);return n}return ce(e)}l();var dke=Tt.bind({ignoreUndefined:!0}),hke={parents:!1,flush:!0,cidVersion:0,hashAlg:"sha2-256",shardSplitThreshold:1e3};function GQ(t){async function e(r,i,n={}){let s=dke(hke,n);await Cp(t)(r,i,s),await Op(t)(r,{...s,recursive:!0})}return ce(e)}l();var $Q=M(Ee()),dA=M(Rt());Te();var pke=Tt.bind({ignoreUndefined:!0}),yke=(0,$Q.default)("ipfs:mfs:touch"),WQ={flush:!0,shardSplitThreshold:1e3,cidVersion:0,hashAlg:"sha2-256"};function YQ(t){async function e(r,i={}){let n=pke(WQ,i);n.mtime=n.mtime||new Date,yke(`Touching ${r} mtime: ${n.mtime}`);let{cid:s,mfsDirectory:o,name:a,exists:c}=await ei(t,r,n),u=i.hashAlg||WQ.hashAlg,f=await t.hashers.getHasher(u),d,h,p=n.cidVersion;if(c){if(s.code!==Pt)throw(0,dA.default)(new Error(`${r} was not a UnixFS node`),"ERR_NOT_UNIXFS");p=s.version;let D=await t.repo.blocks.get(s),B=Bt(D);if(!B.Data)throw(0,dA.default)(new Error(`${r} had no data`),"ERR_INVALID_NODE");let H=ct.unmarshal(B.Data);H.mtime=n.mtime,d=ot({Data:H.marshal(),Links:B.Links});let W=await f.digest(d);h=J.create(n.cidVersion,Pt,W),n.flush&&await t.repo.blocks.put(h,d)}else{let D=new ct({type:"file",mtime:n.mtime});d=ot({Data:D.marshal(),Links:[]});let B=await f.digest(d);h=J.create(n.cidVersion,Pt,B),n.flush&&await t.repo.blocks.put(h,d)}let y=await lc(t,o),b=y[y.length-1],E=b.cid,v=await t.repo.blocks.get(E),A=Bt(v),R=await lo(t,{parent:A,name:a,cid:h,size:d.length,flush:n.flush,shardSplitThreshold:n.shardSplitThreshold,hashAlg:n.hashAlg,cidVersion:p});b.cid=R.cid;let F=await Rs(t,y,n);await Ps(t,F,n)}return ce(e)}l();var hA=M(Rt());var gke=Tt.bind({ignoreUndefined:!0}),mke={offset:0,length:1/0};function XQ(t){function e(r,i={}){return i=gke(mke,i),{[Symbol.asyncIterator]:async function*(){let s=await ei(t,r,i),o=await fn(s.mfsPath,t.repo.blocks);if(o.type!=="file")throw(0,hA.default)(new Error(`${r} was not a file`),"ERR_NOT_FILE");if(!o.content)throw(0,hA.default)(new Error(`Could not load content stream from ${r}`),"ERR_NO_CONTENT");for await(let a of o.content({offset:i.offset,length:i.length}))yield a}}}return ce(e)}l();var JQ=M(Ee());di();l();var pA=M(Rt()),QQ=M(Ee());dt();var Pg=(0,QQ.default)("ipfs:mfs:utils:to-async-iterator");function ZQ(t){if(!t)throw(0,pA.default)(new Error("paths must start with a leading slash"),"ERR_INVALID_PATH");if((typeof t=="string"||t instanceof String)&&(Pg("Content was a string"),t=Xe(t.toString())),t.length)return Pg("Content was array-like"),{[Symbol.asyncIterator]:function*(){yield t}};if(t[Symbol.asyncIterator])return Pg("Content was an async iterator"),t;if(t[Symbol.iterator])return Pg("Content was an iterator"),t;if(globalThis.Blob&&t instanceof globalThis.Blob){Pg("Content was an HTML5 Blob");let e=0,r={next:()=>e>t.size?{done:!0}:new Promise((i,n)=>{let s=t.slice(e,cy);e+=cy;let o=new globalThis.FileReader,a=c=>{if(o.removeEventListener("loadend",a,!1),c.error)return n(c.error);i({done:!1,value:new Uint8Array(o.result)})};o.addEventListener("loadend",a),o.readAsArrayBuffer(s)})};return{[Symbol.asyncIterator]:()=>r}}throw(0,pA.default)(new Error(`Don't know how to convert ${t} into an async iterator`),"ERR_INVALID_PARAMS")}var pc=M(Rt());var eZ=M(is());var bke=Tt.bind({ignoreUndefined:!0}),yc=(0,JQ.default)("ipfs:mfs:write"),vke={offset:0,length:1/0,create:!1,truncate:!1,rawLeaves:!1,reduceSingleLeafToSelf:!1,cidVersion:0,hashAlg:"sha2-256",parents:!1,progress:(t,e)=>{},strategy:"trickle",flush:!0,leafType:"raw",shardSplitThreshold:1e3};function tZ(t){async function e(r,i,n={}){let s=bke(vke,n),o,a,c;if(yc("Reading source, destination and parent"),await xg().readLock(async()=>{o=await ZQ(i),a=await ei(t,r,s),c=await ei(t,a.mfsDirectory,s)})(),yc("Read source, destination and parent"),!s.parents&&!c.exists)throw(0,pc.default)(new Error("directory does not exist"),"ERR_NO_EXIST");if(o==null)throw(0,pc.default)(new Error("could not create source"),"ERR_NO_SOURCE");if(a==null)throw(0,pc.default)(new Error("could not create destination"),"ERR_NO_DESTINATION");if(!s.create&&!a.exists)throw(0,pc.default)(new Error("file does not exist"),"ERR_NO_EXIST");if(a.entryType!=="file")throw(0,pc.default)(new Error("not a file"),"ERR_NOT_A_FILE");return wke(t,r,o,a,s)}return ce(e)}var wke=async(t,e,r,i,n)=>{let s=await _ke(t,r,i,n);await xg().writeLock(async()=>{let o=Rp(e),a=o.pop();if(a==null)throw(0,pc.default)(new Error("source does not exist"),"ERR_NO_EXIST");let c=!1;try{await jf(t)(`/${o.join("/")}`,n),c=!0}catch(E){if(E.code!=="ERR_NOT_FOUND")throw E}c||await Td(t)(`/${o.join("/")}`,n);let u=await ei(t,e,n),f=await lc(t,u.mfsDirectory),d=f[f.length-1];if(!d)throw(0,pc.default)(new Error("directory does not exist"),"ERR_NO_EXIST");if(!d.type||!d.type.includes("directory"))throw(0,pc.default)(new Error(`cannot write to ${d.name}: Not a directory`),"ERR_NOT_A_DIRECTORY");let h=await t.repo.blocks.get(d.cid),p=Bt(h),y=await lo(t,{parent:p,name:a,cid:s.cid,size:s.size,flush:n.flush,shardSplitThreshold:n.shardSplitThreshold,hashAlg:n.hashAlg,cidVersion:n.cidVersion});d.cid=y.cid;let b=await Rs(t,f,n);await Ps(t,b,n)})()},_ke=async(t,e,r,i)=>{r.exists?yc(`Overwriting file ${r.cid} offset ${i.offset} length ${i.length}`):yc(`Writing file offset ${i.offset} length ${i.length}`);let n=[];if(i.offset>0)if(r.unixfs){if(yc(`Writing first ${i.offset} bytes of original file`),n.push(()=>r.content({offset:0,length:i.offset})),r.unixfs.fileSize()<i.offset){let f=i.offset-r.unixfs.fileSize();yc(`Writing zeros for extra ${f} bytes`),n.push(iZ(f))}}else yc(`Writing zeros for first ${i.offset} bytes`),n.push(iZ(i.offset));n.push(rZ(e,i.length));let s=Ske(Eke(n),f=>{if(r.unixfs&&!i.truncate){let d=r.unixfs.fileSize();if(d>f)return yc(`Writing last ${d-f} of ${d} bytes from original file starting at offset ${f}`),r.content({offset:f});yc("Not writing last bytes from original file")}return{[Symbol.asyncIterator]:async function*(){}}}),o;i.mode!==void 0&&i.mode!==null?o=Pl(i.mode):r&&r.unixfs&&(o=r.unixfs.mode);let a;i.mtime!=null?a=Vh(i.mtime):r&&r.unixfs&&(a=r.unixfs.mtime);let c;switch(i.hashAlg){case"sha2-256":c=dr;break;case"sha2-512":c=n9;break;default:throw new Error(`TODO vmx 2021-03-31: Proper error message for unsupported hash algorithms like ${i.hashAlg}`)}let u=await(0,eZ.default)(ap([{content:s,mode:o,mtime:a}],t.repo.blocks,{progress:i.progress,hasher:c,cidVersion:i.cidVersion,strategy:i.strategy,rawLeaves:i.rawLeaves,reduceSingleLeafToSelf:i.reduceSingleLeafToSelf,leafType:i.leafType}));if(!u)throw(0,pc.default)(new Error(`cannot write to ${parent.name}`),"ERR_COULD_NOT_WRITE");return yc(`Wrote ${u.cid}`),{cid:u.cid,size:u.size}},rZ=(t,e)=>async function*(){let i=0;for await(let n of t){if(i+=n.length,i>e){yield n.slice(0,e-i);return}yield n}},iZ=(t,e=cy)=>{let r=new Uint8Array(e);async function*i(){for(;;)yield r.slice()}return rZ(i(),t)},Eke=async function*(t){for(let e=0;e<t.length;e++)yield*t[e]()},Ske=async function*(t,e){let r=0;for await(let i of t)r+=i.length,yield i;for await(let i of e(r))r+=i.length,yield i};l();var nZ=M(oo()),sZ=t=>{let e={cid:t.cid,name:t.name,type:t.type==="directory"?"directory":"file",size:t.size};return(t.type==="file"||t.type==="directory")&&(e.mode=t.unixfs.mode,e.mtime=t.unixfs.mtime),e};function oZ(t){async function*e(r,i={}){let n=await ei(t,r,i),s=await fn(n.mfsPath,t.repo.blocks);if(s.type==="directory"){yield*(0,nZ.default)(s.content(i),sZ);return}yield sZ(s)}return ce(e)}var xke={stat:jf},Ake={chmod:zQ,cp:Cp,flush:HQ,mkdir:Td,mv:GQ,rm:Op,touch:YQ},aZ={write:tZ,read:XQ,ls:oZ},cZ=({options:t,mfs:e,operations:r,lock:i})=>{Object.keys(r).forEach(n=>{e[n]=i(r[n](t))})},Ike={repoOwner:!0,repo:null};function Tke(t){let{repoOwner:e}=Object.assign({},Ike||{},t),r=xg(e),i=o=>r.readLock(o),n=o=>r.writeLock(o),s={};return cZ({options:t,mfs:s,operations:xke,lock:i}),cZ({options:t,mfs:s,operations:Ake,lock:n}),Object.keys(aZ).forEach(o=>{s[o]=aZ[o](t)}),s}function uZ({repo:t,preload:e,hashers:r,options:i}){let n=Tke({repo:t,repoOwner:Boolean(i.repoOwner),hashers:r}),s=o=>(...c)=>{let u=c.filter(f=>yA.default.ipfsPath(f)||yA.default.cid(f));if(u.length){let f=c[c.length-1];f&&f.preload!==!1&&u.forEach(d=>e(d))}return o(...c)};return{...n,chmod:n.chmod,cp:s(n.cp),mkdir:n.mkdir,stat:s(n.stat),rm:n.rm,read:s(n.read),touch:n.touch,write:n.write,mv:s(n.mv),flush:n.flush,ls:s(async function*(...o){for await(let a of n.ls(...o))yield{...a,size:a.size||0}})}}l();l();function fZ({keychain:t}){return ce((r,i)=>t.exportKey(r,i))}l();var lZ="ed25519",dZ=2048;function hZ({keychain:t}){return ce((r,i={type:lZ,size:dZ})=>t.createKey(r,i.type||lZ,i.size||dZ))}l();function pZ({keychain:t}){return ce((r,i,n)=>t.importKey(r,i,n))}l();function yZ({keychain:t}){return ce(r=>t.findKeyByName(r))}l();function gZ({keychain:t}){return ce(()=>t.listKeys())}l();function mZ({keychain:t}){return ce(async(r,i)=>{let n=await t.renameKey(r,i);return{was:r,now:n.name,id:n.id,overwrite:!1}})}l();function bZ({keychain:t}){return ce(r=>t.removeKey(r))}var gA=class{constructor({keychain:e}){this.gen=hZ({keychain:e}),this.list=gZ({keychain:e}),this.rm=bZ({keychain:e}),this.rename=mZ({keychain:e}),this.export=fZ({keychain:e}),this.import=pZ({keychain:e}),this.info=yZ({keychain:e})}};l();l();l();function as({repo:t,preload:e}){async function r(i,n={}){n.preload!==!1&&e(i);let s=await t.blocks.get(i,n);return Bt(s)}return ce(r)}function vZ({repo:t,preload:e}){let r=as({repo:t,preload:e});async function i(n,s={}){return(await r(n,s)).Data||new Uint8Array(0)}return ce(i)}l();Hs();Te();function mA(t,e=[]){for(let r in t){let i=t[r];if(r==="/"&&Object.keys(t).length===1)try{e.push({Name:"",Tsize:0,Hash:J.parse(i)});continue}catch(s){}let n=J.asCID(i);if(n){e.push({Name:"",Tsize:0,Hash:n});continue}Array.isArray(i)&&mA(i,e),i&&typeof i=="object"&&mA(i,e)}return e}function wZ({repo:t,codecs:e}){async function r(i,n={}){let s=await e.getCodec(i.code),o=await t.blocks.get(i,n),a=s.decode(o);if(i.code===Pi)return[];if(i.code===Pt)return a.Links;if(i.code===Cl)return mA(a);throw new Error(`Cannot resolve links from codec ${i.code}`)}return ce(r)}l();di();Te();function _Z({repo:t,preload:e}){async function r(i={}){let n;if(i.template)if(i.template==="unixfs-dir")n=new ct({type:"directory"}).marshal();else throw new Error("unknown template");let s=ot({Data:n,Links:[]}),o=await dr.digest(s),a=J.createV0(o);return await t.blocks.put(a,s,{signal:i.signal}),i.preload!==!1&&e(a),a}return ce(r)}l();Te();di();function gc({repo:t,preload:e}){async function r(i,n={}){let s=await t.gcLock.readLock();try{let o=ot(i),a=await dr.digest(o),c=J.createV0(a);return await t.blocks.put(c,o,{signal:n.signal}),n.preload!==!1&&e(c),n.pin&&await t.pins.pinRecursively(c,{signal:n.signal}),c}finally{s()}}return ce(r)}l();function EZ({repo:t,preload:e}){let r=as({repo:t,preload:e});async function i(n,s={}){let o=await r(n,s),c=ot(o).length,u=o.Links.reduce((f,d)=>f+(d.Tsize||0),0);return{Hash:n,NumLinks:o.Links.length,BlockSize:c,LinksSize:c-(o.Data||[]).length,DataSize:(o.Data||[]).length,CumulativeSize:c+u}}return ce(i)}l();l();function SZ({repo:t,preload:e}){let r=as({repo:t,preload:e}),i=gc({repo:t,preload:e});async function n(s,o,a={}){let c=await r(s,a);return i({...c,Links:c.Links.concat([o])},a)}return ce(n)}l();mn();function xZ({repo:t,preload:e}){let r=as({repo:t,preload:e}),i=gc({repo:t,preload:e});async function n(s,o,a={}){let c=await r(s,a),u=gn([c.Data||[],o]);return i({...c,Data:u},a)}return ce(n)}l();function AZ({repo:t,preload:e}){let r=as({repo:t,preload:e}),i=gc({repo:t,preload:e});async function n(s,o,a={}){let c=await r(s,a),u=(typeof o=="string"?o:o.Name)||"";return c.Links=c.Links.filter(f=>f.Name!==u),i(c,a)}return ce(n)}l();function IZ({repo:t,preload:e}){let r=as({repo:t,preload:e}),i=gc({repo:t,preload:e});async function n(s,o,a={}){let c=await r(s,a);return i({...c,Data:o},a)}return ce(n)}var bA=class{constructor({repo:e,preload:r}){this.addLink=SZ({repo:e,preload:r}),this.appendData=xZ({repo:e,preload:r}),this.rmLink=AZ({repo:e,preload:r}),this.setData=IZ({repo:e,preload:r})}};var vA=class{constructor({repo:e,codecs:r,preload:i}){this.data=vZ({repo:e,preload:i}),this.get=as({repo:e,preload:i}),this.links=wZ({repo:e,codecs:r}),this.new=_Z({repo:e,preload:i}),this.put=gc({repo:e,preload:i}),this.stat=EZ({repo:e,preload:i}),this.patch=new bA({repo:e,preload:i})}};l();l();var TZ=M(Ee());var Rke=(0,TZ.default)("ipfs:repo:gc");function RZ({repo:t,hashers:e}){async function*r(i={}){let n=Date.now(),s;try{s=await Tp({repo:t,hashers:e},i),await t.pins.pinRecursively(s),yield*t.gc()}finally{s&&await t.pins.unpin(s)}Rke(`Complete (${Date.now()-n}ms)`)}return ce(r)}l();function a5({repo:t}){async function e(r={}){let i=await t.stat();return{numObjects:BigInt(i.numObjects.toString()),repoSize:BigInt(i.repoSize.toString()),repoPath:i.repoPath,version:`${i.version}`,storageMax:BigInt(i.storageMax.toString())}}return ce(e)}l();l();var Dp=11;function PZ({repo:t}){async function e(r={}){try{await t._checkInitialized(r)}catch(i){if([/Key not found in database \[\/version\]/,/ENOENT/,/repo is not initialized yet/].some(s=>s.test(i.message)))return Dp;throw i}return t.version.get()}return ce(e)}var wA=class{constructor({repo:e,hashers:r}){this.gc=RZ({repo:e,hashers:r}),this.stat=a5({repo:e}),this.version=PZ({repo:e}),this.setApiAddr=i=>e.apiAddr.set(i)}};l();l();var CZ=M(Rt());function OZ(t,e){let r;if(t.metrics?e.peer?r=t.metrics.forPeer(e.peer):e.proto?r=t.metrics.forProtocol(e.proto):r=t.metrics.global:r=void 0,!r)return{totalIn:BigInt(0),totalOut:BigInt(0),rateIn:0,rateOut:0};let{movingAverages:i,snapshot:n}=r;return{totalIn:BigInt(n.dataReceived.integerValue().toString()),totalOut:BigInt(n.dataSent.integerValue().toString()),rateIn:i.dataReceived[6e4].movingAverage()/60,rateOut:i.dataSent[6e4].movingAverage()/60}}function kZ({network:t}){return ce(async function*(r={}){let{libp2p:i}=await t.use(r);if(!r.poll){yield OZ(i,r);return}let n=r.interval||1e3,s=-1;try{if(s=typeof n=="string"?of(n)||-1:n,!s||s<0)throw new Error("invalid duration")}catch(a){throw(0,CZ.default)(a,"ERR_INVALID_POLL_INTERVAL")}let o;try{for(;;)yield OZ(i,r),await new Promise(a=>{o=setTimeout(a,s)})}finally{clearTimeout(o)}})}var _A=class{constructor({repo:e,network:r}){this.repo=a5({repo:e}),this.bw=kZ({network:r}),this.bitswap=eb({network:r})}};l();var N6e=M(Ee());l();l();var zA=M(EA()),YJ=M(Ee()),Bd=M(Rd());l();l();l();Te();Br();var LZ=M(Ee()),qZ=M(c5());yn();Hs();Bn();var kke=(0,LZ.default)("ipfs:repo:migrator:migration-8");function jZ(t){return t.child?jZ(t.child):t}function Dke(t){try{let e=rr.decode(`b${t.toString().toLowerCase().slice(1)}`),r=J.decode(e).multihash.bytes,i=rr.encode(r).slice(1).toUpperCase();return new qe(`/${i}`,!1)}catch(e){return t}}function Bke(t){try{let e=rr.decode(`b${t.toString().toLowerCase().slice(1)}`),r=Ri(e),i=rr.encode(J.createV1(Pi,r).bytes).slice(1);return new qe(`/${i.toUpperCase()}`,!1)}catch{return t}}async function UZ(t,e,r){let i=t.blocks;await i.open();let n=jZ(i),s=await(0,qZ.default)(n.queryKeys({filters:[o=>r(o).toString()!==o.toString()]}));try{let o=0;for await(let a of n.query({})){let c=r(a.key);c.toString()!==a.key.toString()&&(o+=1,kke(`Migrating Block from ${a.key} to ${c}`,await n.has(a.key)),await n.delete(a.key),await n.put(c,a.value),e(o/s*100,`Migrated Block from ${a.key} to ${c}`))}}finally{await i.close()}}var FZ={version:8,description:"Transforms key names into base32 encoding and converts Block store to use bare multihashes encoded as base32",migrate:(t,e=()=>{})=>UZ(t,e,Dke),revert:(t,e=()=>{})=>UZ(t,e,Bke)};l();Te();l();Te();l();var Pd=M(Vi()),KZ=Pd.default.Reader,Nke=Pd.default.Writer,y6t=Pd.default.util,u5=Pd.default.roots.default||(Pd.default.roots.default={}),VZ=u5.ipfs=(()=>{let t={};return t.pin=function(){let e={};return e.Set=function(){function r(i){if(i)for(var n=Object.keys(i),s=0;s<n.length;++s)i[n[s]]!=null&&(this[n[s]]=i[n[s]])}return r.prototype.version=0,r.prototype.fanout=0,r.prototype.seed=0,r.encode=function(n,s){return s||(s=Nke.create()),n.version!=null&&Object.hasOwnProperty.call(n,"version")&&s.uint32(8).uint32(n.version),n.fanout!=null&&Object.hasOwnProperty.call(n,"fanout")&&s.uint32(16).uint32(n.fanout),n.seed!=null&&Object.hasOwnProperty.call(n,"seed")&&s.uint32(29).fixed32(n.seed),s},r.decode=function(n,s){n instanceof KZ||(n=KZ.create(n));for(var o=s===void 0?n.len:n.pos+s,a=new u5.ipfs.pin.Set;n.pos<o;){var c=n.uint32();switch(c>>>3){case 1:a.version=n.uint32();break;case 2:a.fanout=n.uint32();break;case 3:a.seed=n.fixed32();break;default:n.skipType(c&7);break}}return a},r.fromObject=function(n){if(n instanceof u5.ipfs.pin.Set)return n;var s=new u5.ipfs.pin.Set;return n.version!=null&&(s.version=n.version>>>0),n.fanout!=null&&(s.fanout=n.fanout>>>0),n.seed!=null&&(s.seed=n.seed>>>0),s},r.toObject=function(n,s){s||(s={});var o={};return s.defaults&&(o.version=0,o.fanout=0,o.seed=0),n.version!=null&&n.hasOwnProperty("version")&&(o.version=n.version),n.fanout!=null&&n.hasOwnProperty("fanout")&&(o.fanout=n.fanout),n.seed!=null&&n.hasOwnProperty("seed")&&(o.seed=n.seed),o},r.prototype.toJSON=function(){return this.constructor.toObject(this,Pd.default.util.toJSONOptions)},r}(),e}(),t})();var $Z=M(HZ()),d5=M(Es());l();Br();yn();Te();var Cg=new qe("/local/pins"),f5=256,GZ=8192,xA=J.parse("QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n"),Cd={direct:"direct",recursive:"recursive"};function AA(t){return new qe(`/${rr.encode(t.multihash.bytes).toUpperCase().substring(1)}`)}mn();l5();tt();dt();di();var RA=VZ.pin.Set;function Mke(t){let e=t.Data;if(!e)throw new Error("No data present");let r=d5.default.decode(e),i=d5.default.decode.bytes;if(i<=0)throw new Error("Invalid Set header length");if(i+r>e.length)throw new Error("Impossibly large set header length");let n=e.slice(i,r+i),s=RA.toObject(RA.decode(n),{defaults:!1,arrays:!0,longs:Number,objects:!1});if(s.version!==1)throw new Error(`Unsupported Set version: ${s.version}`);if(s.fanout>t.Links.length)throw new Error("Impossibly large fanout");return{header:s,data:e.slice(r+i)}}function Lke(t,e){let r=new Uint8Array(4);new DataView(r.buffer).setUint32(0,t,!0);let n=Xe(e.toString()),s=gn([r,n],r.byteLength+n.byteLength);return(0,$Z.default)(Ge(s))}async function*WZ(t,e){let r=Mke(e),i=0;for(let n of e.Links){if(i<r.header.fanout){let s=n.Hash;if(!xA.equals(s)){let o=await t.get(s),a=Bt(o);yield*WZ(t,a)}}else yield n.Hash;i++}}async function*Og(t,e,r){let i=e.Links.find(o=>o.Name===r);if(!i)throw new Error("No link found with name "+r);let n=await t.get(i.Hash),s=Bt(n);yield*WZ(t,s)}function qke(t,e){return r(e,0);async function r(i,n){let s=RA.encode({version:1,fanout:f5,seed:n}).finish(),o=d5.default.encode(s.length),a=gn([o,s]),c=[];for(let f=0;f<f5;f++)c.push({Name:"",Tsize:1,Hash:xA});if(i.length<=GZ){let f=i.map(p=>({link:{Name:"",Tsize:1,Hash:p.key},data:p.data||new Uint8Array})).sort((p,y)=>IA(p.link.Hash.bytes,y.link.Hash.bytes)),d=c.concat(f.map(p=>p.link));return{Data:gn([a,...f.map(p=>p.data)]),Links:d}}else{let f=i.reduce((h,p)=>{let y=Lke(n,p.key)%f5;return h[y]=y in h?h[y].concat([p]):[p],h},[]),d=0;for(let h of f){let p=await r(h,n+1);await u(p,d),d++}return{Data:a,Links:c}}async function u(f,d){let h=ot(f),p=await dr.digest(h),y=J.createV0(p);await t.put(y,h);let b=f.Links.reduce((E,v)=>E+(v.Tsize||0),0)+h.length;c[d]={Name:"",Tsize:b,Hash:y}}}}async function PA(t,e,r){let i=await qke(t,r.map(c=>({key:c}))),n=ot(i),s=await dr.digest(n),o=J.createV0(s);await t.put(o,n);let a=i.Links.reduce((c,u)=>c+u.Tsize,0)+n.length;return{Name:e,Tsize:a,Hash:o}}var h5=M(c5());di();Bn();yn();async function jke(t,e,r,i){if(!await e.has(Cg))return;let n=await e.get(Cg),s=J.decode(n),o=await t.get(s),a=Bt(o),c=0,u=await(0,h5.default)(Og(t,a,Cd.recursive))+await(0,h5.default)(Og(t,a,Cd.direct));for await(let f of Og(t,a,Cd.recursive)){c++;let d={depth:1/0};f.version!==0&&(d.version=f.version),f.code!==Pt&&(d.codec=f.code),await r.put(AA(f),jo(d)),i(c/u*100,`Migrated recursive pin ${f}`)}for await(let f of Og(t,a,Cd.direct)){c++;let d={depth:0};f.version!==0&&(d.version=f.version),f.code!==Pt&&(d.codec=f.code),await r.put(AA(f),jo(d)),i(c/u*100,`Migrated direct pin ${f}`)}await t.delete(s),await e.delete(Cg)}async function Uke(t,e,r,i){let n=[],s=[],o=0,a=await(0,h5.default)(r.queryKeys({}));for await(let{key:h,value:p}of r.query({})){o++;let y=Qn(p),b=J.create(y.version||0,y.codec||Pt,Ri(rr.decode("b"+h.toString().toLowerCase().split("/").pop())));y.depth===0?(i(o/a*100,`Reverted direct pin ${b}`),s.push(b)):(i(o/a*100,`Reverted recursive pin ${b}`),n.push(b))}i(100,"Updating pin root");let c={Links:[await PA(t,Cd.direct,s),await PA(t,Cd.recursive,n)]},u=ot(c),f=await dr.digest(u),d=J.createV0(f);await t.put(d,u),await e.put(Cg,d.bytes)}async function YZ(t,e,r){let i=t.blocks,n=t.datastore,s=t.pins;await i.open(),await n.open(),await s.open();try{await r(i,n,s,e)}finally{await s.close(),await n.close(),await i.close()}}var XZ={version:9,description:"Migrates pins to datastore",migrate:(t,e=()=>{})=>YZ(t,e,jke),revert:(t,e=()=>{})=>YZ(t,e,Uke)};l();l();Br();Zo();var QZ=new qe("/config"),kg=new qe("/version");function Dg(t){let e=t;for(;e.db||e.child;)if(e=e.db||e.child,e.type==="level-js"||e.constructor.name==="Level")return e}async function Fke(t,e,r){let i=await e(t);if(i)return i;let n=Dg(r);return n?new Promise((s,o)=>{let a=n.store("readonly").get(t.toString());a.transaction.onabort=()=>{o(a.transaction.error)},a.transaction.oncomplete=()=>{s(Boolean(a.result))}}):!1}async function Kke(t,e,r,i){if(await r(t))return e(t);let n=Dg(i);if(!n)throw un();return new Promise((s,o)=>{let a=n.store("readonly").get(t.toString());a.transaction.onabort=()=>{o(a.transaction.error)},a.transaction.oncomplete=()=>{if(a.result)return s(a.result);o(un())}})}function p5(t){let e=t.get.bind(t),r=t.has.bind(t);return t.get=i=>Kke(i,e,r,t),t.has=i=>Fke(i,r,t),t}function CA(t){return{...t,root:p5(t.root),datastore:p5(t.datastore),pins:p5(t.pins),keys:p5(t.keys)}}dt();tt();async function Vke(t,e,r=()=>{}){let i=Dg(e);if(!i){r(`${t} did not need an upgrade`);return}r(`Upgrading ${t}`),await tJ(i,(s,o)=>[{type:"del",key:s},{type:"put",key:Xe(s),value:o}])}async function zke(t,e,r=()=>{}){let i=Dg(e);if(!i){r(`${t} did not need a downgrade`);return}r(`Downgrading ${t}`),await tJ(i,(s,o)=>[{type:"del",key:s},{type:"put",key:Ge(s),value:o}])}function ZZ(t){return t.child?ZZ(t.child):t}async function JZ(t,e,r){let i=Object.entries(t).map(([o,a])=>({key:o,backend:ZZ(a)})).filter(({key:o,backend:a})=>a.constructor.name==="LevelDatastore").map(({key:o,backend:a})=>({name:o,store:a}));e(0,`Migrating ${i.length} dbs`);let n=0,s=o=>{e(Math.round(n/i.length*100),o)};for(let{name:o,store:a}of i){await a.open();try{await r(o,a,s)}finally{n++,await a.close()}}e(100,`Migrated ${i.length} dbs`)}var eJ={version:10,description:"Migrates datastore-level keys to binary",migrate:(t,e=()=>{})=>JZ(t,e,Vke),revert:(t,e=()=>{})=>JZ(t,e,zke)};function tJ(t,e){function r(i,n){let s=t.store("readwrite"),o=s.transaction,a=0,c;o.onabort=()=>n(c||o.error||new Error("aborted by user")),o.oncomplete=()=>n();function u(){let f=i[a++],d=f.key,h;try{h=f.type==="del"?s.delete(d):s.put(f.value,d)}catch(p){c=p,o.abort();return}a<i.length&&(h.onsuccess=u)}u()}return new Promise((i,n)=>{let s=t.iterator(),o=c=>c;s._deserializeKey=s._deserializeValue=o,a();function a(){let c=(u,f,d)=>{if(u||f===void 0){let h=p=>{if(p){n(p);return}i()};s.end(h);return}r(e(f,d),a)};s.next(c)}})}l();Br();var Vf=new qe("/local/filesroot");async function Hke(t,e=()=>{}){if(e(100,"Migrating MFS root to repo datastore"),await t.root.open(),await t.datastore.open(),await t.root.has(Vf)){let r=await t.root.get(Vf);await t.datastore.put(Vf,r),await t.root.delete(Vf)}await t.datastore.close(),await t.root.close(),e(100,"Stored MFS root in repo datastore")}async function Gke(t,e=()=>{}){if(e(100,"Migrating MFS root to repo root datastore"),await t.root.open(),await t.datastore.open(),await t.datastore.has(Vf)){let r=await t.datastore.get(Vf);await t.root.put(Vf,r),await t.datastore.delete(Vf)}await t.datastore.close(),await t.root.close(),e(100,"Stored MFS root in repo root datastore")}var rJ={version:11,description:"Store mfs root in the datastore",migrate:Hke,revert:Gke};var Od={description:"Empty migration.",migrate:()=>{},revert:()=>{},empty:!0},y5=[Object.assign({version:1},Od),Object.assign({version:2},Od),Object.assign({version:3},Od),Object.assign({version:4},Od),Object.assign({version:5},Od),Object.assign({version:6},Od),Object.assign({version:7},Od),FZ,XZ,eJ,rJ];l();l();var iJ=M(Ee());var OA={};zt(OA,{InvalidValueError:()=>Mg,MissingRepoOptionsError:()=>mu,NonReversibleMigrationError:()=>Bg,NotInitializedRepoError:()=>kd,RequiredParameterError:()=>Ng});l();var Bg=class extends Error{constructor(e){super(e);this.name="NonReversibleMigrationError",this.code=Bg.code,this.message=e}};Bg.code="ERR_NON_REVERSIBLE_MIGRATION";var kd=class extends Error{constructor(e){super(e);this.name="NotInitializedRepoError",this.code=kd.code,this.message=e}};kd.code="ERR_NOT_INITIALIZED_REPO";var Ng=class extends Error{constructor(e){super(e);this.name="RequiredParameterError",this.code=Ng.code,this.message=e}};Ng.code="ERR_REQUIRED_PARAMETER";var Mg=class extends Error{constructor(e){super(e);this.name="InvalidValueError",this.code=Mg.code,this.message=e}};Mg.code="ERR_INVALID_VALUE";var mu=class extends Error{constructor(e){super(e);this.name="MissingRepoOptionsError",this.code=mu.code,this.message=e}};mu.code="ERR_MISSING_REPO_OPTIONS";var kA=(0,iJ.default)("ipfs:repo:migrator:repo:init");async function nJ(t){if(!t)throw new mu("Please pass repo options when trying to open a repo");let e=t.root;try{await e.open();let r=await e.has(kg),i=await e.has(QZ);return!r||!i?(kA(`Version entry present: ${r}`),kA(`Config entry present: ${i}`),!1):!0}catch(r){return kA("While checking if repo is initialized error was thrown: "+r.message),!1}finally{if(e!==void 0)try{await e.close()}catch{}}}dt();tt();async function DA(t){if(!await nJ(t))throw new kd("Repo is not initialized!");let e=t.root;await e.open();try{return parseInt(Ge(await e.get(kg)))}finally{await e.close()}}async function Lg(t,e){if(!e)throw new mu("Please pass repo options when trying to open a repo");let r=e.root;await r.open(),await r.put(kg,Xe(String(t))),await r.close()}var sJ=M(Ee()),oa=(0,sJ.default)("ipfs:repo:migrator");function $ke(t){return t=t||y5,!Array.isArray(t)||t.length===0?0:t[t.length-1].version}async function oJ(t,e,r,i,{ignoreLock:n=!1,onProgress:s,isDryRun:o=!1,migrations:a}){if(a=a||y5,!t)throw new ho.RequiredParameterError("Path argument is required!");if(!r)throw new ho.RequiredParameterError("repoOptions argument is required!");if(!i)throw new ho.RequiredParameterError("toVersion argument is required!");if(!Number.isInteger(i)||i<=0)throw new ho.InvalidValueError("Version has to be positive integer!");e=CA(e);let c=await DA(e);if(c===i){oa("Nothing to migrate.");return}if(c>i)throw new ho.InvalidValueError(`Current repo's version (${c}) is higher then toVersion (${i}), you probably wanted to revert it?`);cJ(a,c,i);let u;!o&&!n&&(u=await r.repoLock.lock(t));try{for(let f of a){if(i!==void 0&&f.version>i)break;if(!(f.version<=c)){oa(`Migrating version ${f.version}`);try{if(!o){let d=()=>{};s&&(d=(h,p)=>s(f.version,h.toFixed(2),p)),await f.migrate(e,d)}}catch(d){let h=f.version-1;throw oa(`An exception was raised during execution of migration. Setting the repo's version to last successfully migrated version: ${h}`),await Lg(h,e),new Error(`During migration to version ${f.version} exception was raised: ${d.stack||d.message||d}`)}oa(`Migrating to version ${f.version} finished`)}}o||await Lg(i||$ke(a),e),oa("Repo successfully migrated",i!==void 0?`to version ${i}!`:"to latest version!")}finally{!o&&!n&&u&&await u.close()}}async function aJ(t,e,r,i,{ignoreLock:n=!1,onProgress:s,isDryRun:o=!1,migrations:a}){if(a=a||y5,!t)throw new ho.RequiredParameterError("Path argument is required!");if(!r)throw new ho.RequiredParameterError("repoOptions argument is required!");if(!i)throw new ho.RequiredParameterError("When reverting migrations, you have to specify to which version to revert!");if(!Number.isInteger(i)||i<=0)throw new ho.InvalidValueError("Version has to be positive integer!");e=CA(e);let c=await DA(e);if(c===i){oa("Nothing to revert.");return}if(c<i)throw new ho.InvalidValueError(`Current repo's version (${c}) is lower then toVersion (${i}), you probably wanted to migrate it?`);cJ(a,i,c,!0);let u;!o&&!n&&(u=await r.repoLock.lock(t)),oa(`Reverting from version ${c} to ${i}`);try{let f=a.slice().reverse();for(let d of f){if(d.version<=i)break;if(!(d.version>c)){oa(`Reverting migration version ${d.version}`);try{if(!o){let h=()=>{};s&&(h=(p,y)=>s(d.version,p.toFixed(2),y)),await d.revert(e,h)}}catch(h){let p=d.version;throw oa(`An exception was raised during execution of migration. Setting the repo's version to last successfully reverted version: ${p}`),await Lg(p,e),h.message=`During reversion to version ${d.version} exception was raised: ${h.message}`,h}oa(`Reverting to version ${d.version} finished`)}}o||await Lg(i,e),oa(`All migrations successfully reverted to version ${i}!`)}finally{!o&&!n&&u&&await u.close()}}function cJ(t,e,r,i=!1){let n=0;for(let s of t){if(s.version>r)break;if(s.version>e){if(i&&!s.revert)throw new ho.NonReversibleMigrationError(`It is not possible to revert to version ${e} because migration version ${s.version} is not reversible. Cancelling reversion.`);n++}}if(n!==r-e)throw new ho.InvalidValueError(`The ipfs-repo-migrations package does not have all migration to migrate from version ${e} to ${r}`)}var ho=OA;var XJ=M(lJ());l();Br();var yJ=M(Ee());tt();dt();l();l();var Bp=class extends Error{constructor(e){super(e);this.name="LockExistsError",this.code=Bp.code}};Bp.code="ERR_LOCK_EXISTS";var po=class extends Error{constructor(e){super(e);this.name="NotFoundError",this.code=po.code}};po.code="ERR_NOT_FOUND";var Np=class extends Error{constructor(e){super(e);this.name="InvalidRepoVersionError",this.code=Np.code}};Np.code="ERR_INVALID_REPO_VERSION";var Dd="ERR_REPO_NOT_INITIALIZED",dJ="ERR_REPO_ALREADY_OPEN",hJ="ERR_REPO_ALREADY_CLOSED";async function m5(t,e,r){let i=await e(t);if(i)return i;let n=pJ(r);return n?new Promise((s,o)=>{let a=n.store("readonly").get(t.toString());a.transaction.onabort=()=>{o(a.transaction.error)},a.transaction.oncomplete=()=>{s(Boolean(a.result))}}):!1}async function b5(t,e,r,i){if(await r(t))return e(t);let n=pJ(i);if(!n)throw new po;return new Promise((s,o)=>{let a=n.store("readonly").get(t.toString());a.transaction.onabort=()=>{o(a.transaction.error)},a.transaction.oncomplete=()=>{if(a.result)return s(a.result);o(new po)}})}function pJ(t){let e=t;for(;e.db||e.child;)if(e=e.db||e.child,e.type==="level-js"||e.constructor.name==="Level")return e}var Zke=(0,yJ.default)("ipfs:repo:version"),BA=new qe("version");function gJ(t){return{async exists(){return m5(BA,t.has.bind(t),t)},async get(){let e=await b5(BA,t.get.bind(t),t.has.bind(t),t);return parseInt(Ge(e),10)},set(e){return t.put(BA,Xe(String(e)))},async check(e){let r=await this.get();return Zke("comparing version: %s and %s",r,e),r===e||(r===6&&e===7||e===6&&r===7)}}}l();Br();var v5=M(Yc()),mJ=M(EA()),bJ=M(Kx()),w5=M(Rd());tt();dt();var Jke=v5.default.default?v5.default.default:v5.default,NA=new qe("config");function vJ(t){let e=new Jke({concurrency:1}),r={async getAll(s={}){let o=await b5(NA,t.get.bind(t),t.has.bind(t),t);return JSON.parse(Ge(o))},async get(s,o={}){if(s==null)throw new po(`Key ${s} does not exist in config`);let a=await this.getAll(o),c=(0,mJ.default)(a,s);if(c===void 0)throw new po(`Key ${s} does not exist in config`);return c},set(s,o,a={}){if(typeof s!="string"&&!(s instanceof String))throw(0,w5.default)(new Error("Invalid key type: "+typeof s),"ERR_INVALID_KEY");if(o===void 0||o instanceof Uint8Array)throw(0,w5.default)(new Error("Invalid value type: "+typeof o),"ERR_INVALID_VALUE");return e.add(()=>i({key:s,value:o},a.signal))},replace(s,o={}){if(!s||s instanceof Uint8Array)throw(0,w5.default)(new Error("Invalid value type: "+typeof s),"ERR_INVALID_VALUE");return e.add(()=>i({key:void 0,value:s},o.signal))},async exists(){return m5(NA,t.has.bind(t),t)}};return r;async function i(s,o){if(o&&o.aborted)return;let a=s.key,c=s.value;if(a){let u=await r.getAll();return typeof u=="object"&&u!==null&&(0,bJ.default)(u,a,c),n(u)}return n(c)}function n(s){let o=Xe(JSON.stringify(s,null,2));return t.put(NA,o)}}l();var xJ=M(SJ());tt();dt();var LA=new qe("datastore_spec");function AJ(t){return{exists(){return t.has(LA)},async get(){let e=await t.get(LA);return JSON.parse(Ge(e))},async set(e){return t.put(LA,Xe(JSON.stringify((0,xJ.default)(e,{deep:!0}))))}}}l();Br();dt();var qA=new qe("api");function IJ(t){return{async get(){let e=await t.get(qA);return e&&e.toString()},set(e){return t.put(qA,Xe(e.toString()))},delete(){return t.delete(qA)}}}l();var TJ=M(ea()),RJ=M(nc()),PJ=M(ic());Te();var CJ=M(Rd());Gc();function OJ(t){return{open(){return t.open()},close(){return t.close()},query(e,r){return t.query(e,r)},queryKeys(e,r){return t.queryKeys(e,r)},async get(e,r){let i=Hf(e);return i.isIdentity?Promise.resolve(i.digest):t.get(e,r)},async*getMany(e,r){for await(let i of e)yield this.get(i,r)},async put(e,r,i){let{isIdentity:n}=Hf(e);n||await t.put(e,r,i)},async*putMany(e,r){let i=(0,RJ.default)();(process&&process.nextTick?process.nextTick:setImmediate)(async()=>{try{await(0,PJ.default)(t.putMany(async function*(){for await(let{key:s,value:o}of e)Hf(s).isIdentity||(yield{key:s,value:o}),i.push({key:s,value:o})}())),i.end()}catch(s){i.end(s)}}),yield*i},has(e,r){let{isIdentity:i}=Hf(e);return i?Promise.resolve(!0):t.has(e,r)},delete(e,r){let{isIdentity:i}=Hf(e);return i?Promise.resolve():t.delete(e,r)},deleteMany(e,r){return t.deleteMany((0,TJ.default)(e,i=>!Hf(i).isIdentity),r)},batch(){let e=t.batch();return{put(r,i){let{isIdentity:n}=Hf(r);n||e.put(r,i)},delete(r){let{isIdentity:i}=Hf(r);i||e.delete(r)},commit:r=>e.commit(r)}}}}function Hf(t){let e=J.asCID(t);if(e==null)throw(0,CJ.default)(new Error("Not a valid cid"),"ERR_INVALID_CID");return e.multihash.code!==_s.code?{isIdentity:!1}:{isIdentity:!0,digest:e.multihash.digest}}l();l();var kJ=M(Ee()),DJ=(0,kJ.default)("ipfs:repo:lock:memory"),BJ="repo.lock",qg={};async function eDe(t){let e=t+"/"+BJ;if(DJ("locking %s",e),qg[e]===!0)throw new Bp(`Lock already being held for file: ${e}`);return qg[e]=!0,{async close(){qg[e]&&delete qg[e]}}}async function tDe(t){let e=t+"/"+BJ;return DJ(`checking lock: ${e}`),Boolean(qg[e])}var _5={lock:eDe,locked:tDe};var NJ={autoMigrate:!0,onMigrationProgress:()=>{},repoOwner:!0,repoLock:_5};l();var jA={Spec:{type:"mount",mounts:[{mountpoint:"/blocks",type:"measure",prefix:"flatfs.datastore",child:{type:"flatfs",path:"blocks",sync:!0,shardFunc:"/repo/flatfs/shard/v1/next-to-last/2"}},{mountpoint:"/",type:"measure",prefix:"leveldb.datastore",child:{type:"levelds",path:"datastore",compression:"none"}}]}};l();Te();var qJ=M(Rd()),jJ=M(Ee()),FA=M(Sd());l();Br();Y2();Hs();var MJ=M(Rd());yn();Bn();function jg(t){let e=J.asCID(t);if(e==null)throw(0,MJ.default)(new Error("Not a valid cid"),"ERR_INVALID_CID");let r=rr.encode(e.multihash.bytes);return new qe("/"+r.slice(1).toUpperCase(),!1)}function UA(t){return Ri(rr.decode(`b${t.toString().toLowerCase().substring(1)}`))}l();var LJ=M(Ee());var rDe=(0,LJ.default)("ipfs:repo:utils:walk-dag");async function*Mp(t,e,r,i){try{let n=await e.get(t,i),s=await r(t.code),o=Sp({bytes:n,cid:t,codec:s});for(let[,a]of o.links())yield a,yield*Mp(a,e,r,i)}catch(n){throw rDe("Could not walk DAG for CID",t.toString(),n),n}}function iDe(t){let e=`Invalid type '${t}', must be one of {direct, indirect, recursive, all}`;return(0,qJ.default)(new Error(e),"ERR_INVALID_PIN_TYPE")}var KA=class{constructor({pinstore:e,blockstore:r,loadCodec:i}){this.pinstore=e,this.blockstore=r,this.loadCodec=i,this.log=(0,jJ.default)("ipfs:repo:pin"),this.directPins=new Set,this.recursivePins=new Set}async pinDirectly(e,r={}){await this.blockstore.get(e,r);let i={depth:0};return e.version!==0&&(i.version=e.version),e.code!==Pt&&(i.codec=e.code),r.metadata&&(i.metadata=r.metadata),this.pinstore.put(jg(e),jo(i))}unpin(e,r){return this.pinstore.delete(jg(e),r)}async pinRecursively(e,r={}){await this.fetchCompleteDag(e,r);let i={depth:1/0};e.version!==0&&(i.version=e.version),e.code!==Pt&&(i.codec=e.code),r.metadata&&(i.metadata=r.metadata),await this.pinstore.put(jg(e),jo(i))}async*directKeys(e){for await(let r of this.pinstore.query({filters:[i=>Qn(i.value).depth===0]})){let i=Qn(r.value),n=i.version||0,s=i.codec!=null?i.codec:Pt,o=UA(r.key);yield{cid:J.create(n,s,o),metadata:i.metadata}}}async*recursiveKeys(e){for await(let r of this.pinstore.query({filters:[i=>Qn(i.value).depth===1/0]})){let i=Qn(r.value),n=i.version||0,s=i.codec!=null?i.codec:Pt,o=UA(r.key);yield{cid:J.create(n,s,o),metadata:i.metadata}}}async*indirectKeys(e){for await(let{cid:r}of this.recursiveKeys())for await(let i of Mp(r,this.blockstore,this.loadCodec,e)){let n=[Ct.recursive];(await this.isPinnedWithType(i,n)).pinned||(yield i)}}async isPinnedWithType(e,r,i){Array.isArray(r)||(r=[r]);let n=r.includes(Ct.all),s=r.includes(Ct.direct),o=r.includes(Ct.recursive),a=r.includes(Ct.indirect);if(o||s||n){let f=await(0,FA.default)(this.pinstore.query({prefix:jg(e).toString(),filters:[d=>{if(n)return!0;let h=Qn(d.value);return r.includes(h.depth===0?Ct.direct:Ct.recursive)}],limit:1}));if(f){let d=Qn(f.value);return{cid:e,pinned:!0,reason:d.depth===0?Ct.direct:Ct.recursive,metadata:d.metadata}}}let c=this;async function*u(f,d){for await(let{cid:h}of d)for await(let p of Mp(h,c.blockstore,c.loadCodec))if(p.equals(f)){yield h;return}}if(n||a){let f=await(0,FA.default)(u(e,this.recursiveKeys()));if(f)return{cid:e,pinned:!0,reason:Ct.indirect,parent:f}}return{cid:e,pinned:!1}}async fetchCompleteDag(e,r){let i=new Set,n=async(s,o)=>{if(i.has(s.toString()))return;i.add(s.toString());let a=await this.blockstore.get(s,o),c=await this.loadCodec(s.code),u=Sp({bytes:a,cid:s,codec:c});await Promise.all([...u.links()].map(([,f])=>n(f,o)))};await n(e,r)}static checkPinType(e){if(typeof e!="string"||!Object.keys(Ct).includes(e))throw iDe(e);return!0}};l();var UJ=M(oo()),FJ=M(Rd());function KJ(t,e){return{open(){return e.open()},close(){return e.close()},query(r,i){return e.query(r,i)},queryKeys(r,i){return e.queryKeys(r,i)},async get(r,i){return e.get(r,i)},async*getMany(r,i){yield*e.getMany(r,i)},async put(r,i,n){await e.put(r,i,n)},async*putMany(r,i){yield*e.putMany(r,i)},has(r,i){return e.has(r,i)},async delete(r,i){return await VJ(r,t),e.delete(r,i)},deleteMany(r,i){return e.deleteMany((0,UJ.default)(r,async n=>(await VJ(n,t),n)),i)},batch(){return e.batch()}}}async function VJ(t,e){let{pinned:r,reason:i}=await e.isPinnedWithType(t,Ct.all);if(r)throw(0,FJ.default)(new Error(`pinned: ${i}`),"ERR_BLOCK_PINNED")}var QJ=M(oA());l();Te();var zJ=M(Ee());Zo();var HJ=M(ab()),GJ=M(Nr()),VA=M(ep()),E5=M(oo()),$J=M(ea());Br();yn();var Ug=(0,zJ.default)("ipfs:repo:gc"),nDe=un().code,sDe=256,oDe=new qe("/local/filesroot");function WJ({gcLock:t,pins:e,blockstore:r,root:i,loadCodec:n}){async function*s(){let o=Date.now();Ug("Creating set of marked blocks");let a=await t.writeLock();try{let c=await aDe({pins:e,blockstore:r,root:i,loadCodec:n}),u=r.queryKeys({});yield*cDe({blockstore:r},c,u),Ug(`Complete (${Date.now()-o}ms)`)}finally{a()}}return s}async function aDe({pins:t,blockstore:e,loadCodec:r,root:i}){let n=async function*(){let a;try{a=await i.get(oDe)}catch(u){if(u.code===nDe){Ug("No blocks in MFS");return}throw u}let c=J.decode(a);yield c,yield*Mp(c,e,r)}(),s=(0,VA.default)((0,E5.default)(t.recursiveKeys(),({cid:a})=>a),t.indirectKeys(),(0,E5.default)(t.directKeys(),({cid:a})=>a),n),o=new Set;for await(let a of(0,VA.default)(s,n))o.add(rr.encode(a.multihash.bytes));return o}async function*cDe({blockstore:t},e,r){let i=0,n=0;yield*(0,GJ.pipe)((0,HJ.default)((0,E5.default)(r,async o=>async function(){i++;try{let c=rr.encode(o.multihash.bytes);if(e.has(c))return null;try{await t.delete(o),n++}catch(u){return{err:new Error(`Could not delete block with CID ${o}: ${u.message}`)}}return{cid:o}}catch(c){let u=`Could delete block with CID ${o}`;return Ug(u,c),{err:new Error(u+`: ${c.message}`)}}}),sDe),o=>(0,$J.default)(o,Boolean)),Ug(`Marked set has ${e.size} unique blocks. Blockstore has ${i} blocks. Deleted ${n} blocks.`)}var cs=(0,YJ.default)("ipfs:repo"),uDe=Number.MAX_SAFE_INTEGER,fDe="repoAutoMigrate",ZJ=class{constructor(e,r,i,n){if(typeof e!="string")throw new Error("missing repo path");if(typeof r!="function")throw new Error("missing codec loader");this.options=Tt(NJ,n),this.closed=!0,this.path=e,this.root=i.root,this.datastore=i.datastore,this.keys=i.keys;let s=i.blocks,o=i.pins;this.pins=new KA({pinstore:o,blockstore:s,loadCodec:r});let a=KJ(this.pins,s);this.blocks=OJ(a),this.version=gJ(this.root),this.config=vJ(this.root),this.spec=AJ(this.root),this.apiAddr=IJ(this.root),this.gcLock=(0,QJ.default)(e,{singleProcess:this.options.repoOwner!==!1}),this.gc=WJ({gcLock:this.gcLock,pins:this.pins,blockstore:this.blocks,root:this.root,loadCodec:r})}async init(e){cs("initializing at: %s",this.path),await this._openRoot(),await this.config.replace(lDe(e)),await this.spec.set(dDe(e)),await this.version.set(Dp)}async isInitialized(){if(!this.closed)return!0;try{return await this._openRoot(),await this._checkInitialized(),await this.root.close(),!0}catch(e){return!1}}async open(){if(!this.closed)throw(0,Bd.default)(new Error("repo is already open"),dJ);cs("opening at: %s",this.path);try{if(await this._openRoot(),await this._checkInitialized(),this._lockfile=await this._openLock(),cs("acquired repo.lock"),!await this.version.check(Dp))if(await this._isAutoMigrationEnabled())await this._migrate(Dp,{root:this.root,datastore:this.datastore,pins:this.pins.pinstore,blocks:this.pins.blockstore,keys:this.keys});else throw new Np("Incompatible repo versions. Automatic migrations disabled. Please migrate the repo manually.");cs("creating datastore"),await this.datastore.open(),cs("creating blocks"),this.blocks.open(),cs("creating keystore"),await this.keys.open(),cs("creating pins"),await this.pins.pinstore.open(),this.closed=!1,cs("all opened")}catch(e){if(this._lockfile)try{await this._closeLock(),this._lockfile=null}catch(r){cs("error removing lock",r)}throw e}}async _openRoot(){try{await this.root.open()}catch(e){if(e.message!=="Already open")throw e}}async _openLock(){let e=await this.options.repoLock.lock(this.path);if(typeof e.close!="function")throw(0,Bd.default)(new Error("Locks must have a close method"),"ERR_NO_CLOSE_FUNCTION");return e}_closeLock(){return this._lockfile&&this._lockfile.close()}async _checkInitialized(){cs("init check");let e;try{[e]=await Promise.all([this.config.exists(),this.spec.exists(),this.version.exists()])}catch(r){throw r.code==="ERR_NOT_FOUND"?(0,Bd.default)(new Error("repo is not initialized yet"),Dd,{path:this.path}):r}if(!e)throw(0,Bd.default)(new Error("repo is not initialized yet"),Dd,{path:this.path})}async close(){if(this.closed)throw(0,Bd.default)(new Error("repo is already closed"),hJ);cs("closing at: %s",this.path);try{await this.apiAddr.delete()}catch(e){if(e.code!==Dd&&!e.message.startsWith("ENOENT"))throw e}await Promise.all([this.root,this.blocks,this.keys,this.datastore,this.pins.pinstore].map(e=>e&&e.close())),cs("unlocking"),this.closed=!0,await this._closeLock()}exists(){return this.version.exists()}async stat(){if(this.datastore&&this.keys){let[e,r,i,n,s]=await Promise.all([this._storageMaxStat(),this._blockStat(),this.version.get(),JJ(this.datastore),JJ(this.keys)]),o=r.size+n+s;return{repoPath:this.path,storageMax:e,version:i,numObjects:r.count,repoSize:o}}throw(0,Bd.default)(new Error("repo is not initialized yet"),Dd,{path:this.path})}async _isAutoMigrationEnabled(){if(this.options.autoMigrate!==void 0)return this.options.autoMigrate;let e;try{e=await this.config.get(fDe)}catch(r){if(r.code===po.code)e=!0;else throw r}return e}async _migrate(e,r){return await this.version.get()>e?(cs(`reverting to version ${e}`),aJ(this.path,r,this.options,e,{ignoreLock:!0,onProgress:this.options.onMigrationProgress})):(cs(`migrating to version ${e}`),oJ(this.path,r,this.options,e,{ignoreLock:!0,onProgress:this.options.onMigrationProgress}))}async _storageMaxStat(){try{let e=await this.config.get("Datastore.StorageMax");return BigInt((0,XJ.default)(e))}catch(e){return BigInt(uDe)}}async _blockStat(){let e=BigInt(0),r=BigInt(0);if(this.blocks)for await(let{key:i,value:n}of this.blocks.query({}))e+=BigInt(1),r+=BigInt(n.byteLength),r+=BigInt(i.bytes.byteLength);return{count:e,size:r}}};async function JJ(t){let e=BigInt(0);for await(let r of t.query({}))e+=BigInt(r.value.byteLength),e+=BigInt(r.key.uint8Array().byteLength);return e}function eee(t,e,r,i){return new ZJ(t,e,r,i)}function lDe(t){return t.Datastore=Object.assign({},jA,(0,zA.default)(t,"datastore")),t}function dDe(t){let e={...jA.Spec,...(0,zA.default)(t,"Datastore.Spec")};return{type:e.type,mounts:e.mounts.map(r=>({mountpoint:r.mountpoint,type:r.child.type,path:r.child.path,shardFunc:r.child.shardFunc}))}}l();var om=M(ea()),Bie=M(oo()),dT=M(Z0()),hT=M(ree()),Nie=M(Die()),Wd=class extends As{constructor(e,r){super();this.path=e,this.opts=r,r&&r.db?(this.database=r.db,delete r.db):this.database=Nie.default}_initDb(){return new Promise((e,r)=>{this.db=this.database(this.path,{...this.opts,valueEncoding:"binary",compression:!1},i=>{if(i)return r(i);e(this.db)})})}async open(){try{this.db?await this.db.open():this.db=await this._initDb()}catch(e){throw tp.dbOpenFailedError(e)}}async put(e,r){try{await this.db.put(e.toString(),r)}catch(i){throw tp.dbWriteFailedError(i)}}async get(e){let r;try{r=await this.db.get(e.toString())}catch(i){throw i.notFound?tp.notFoundError(i):tp.dbWriteFailedError(i)}return r}async has(e){try{await this.db.get(e.toString())}catch(r){if(r.notFound)return!1;throw r}return!0}async delete(e){try{await this.db.del(e.toString())}catch(r){throw tp.dbDeleteFailedError(r)}}close(){return this.db&&this.db.close()}batch(){let e=[];return{put:(r,i)=>{e.push({type:"put",key:r.toString(),value:i})},delete:r=>{e.push({type:"del",key:r.toString()})},commit:()=>this.db.batch(e)}}query(e){let r=this._query({values:!0,prefix:e.prefix});Array.isArray(e.filters)&&(r=e.filters.reduce((s,o)=>(0,om.default)(s,o),r)),Array.isArray(e.orders)&&(r=e.orders.reduce((s,o)=>(0,hT.default)(s,o),r));let{offset:i,limit:n}=e;if(i){let s=0;r=(0,om.default)(r,()=>s++>=i)}return n&&(r=(0,dT.default)(r,n)),r}queryKeys(e){let r=(0,Bie.default)(this._query({values:!1,prefix:e.prefix}),({key:s})=>s);Array.isArray(e.filters)&&(r=e.filters.reduce((s,o)=>(0,om.default)(s,o),r)),Array.isArray(e.orders)&&(r=e.orders.reduce((s,o)=>(0,hT.default)(s,o),r));let{offset:i,limit:n}=e;if(i){let s=0;r=(0,om.default)(r,()=>s++>=i)}return n&&(r=(0,dT.default)(r,n)),r}_query(e){let r={keys:!0,keyAsBuffer:!0,values:e.values};if(e.prefix!=null){let i=e.prefix.toString();r.gte=i,r.lt=i+"\xFF"}return LLe(this.db.iterator(r))}};function LLe(t){return{[Symbol.asyncIterator](){return{next:()=>new Promise((e,r)=>{t.next((i,n,s)=>{if(i)return r(i);if(n==null)return t.end(o=>{if(o)return r(o);e({done:!0,value:void 0})});e({done:!1,value:{key:new qe(n,!1),value:s}})})}),return:()=>new Promise((e,r)=>{t.end(i=>{if(i)return r(i);e({done:!0,value:void 0})})})}}}}l();var gT=M(ic()),mT=M(nc());Br();Te();Hs();Bn();yn();li();var Fie=M(qie());l();var pT=M(ic()),Yd=M(ea()),yT=M(Z0()),jie=M(nd()),Uie=(t,e)=>async function*(){yield*(await(0,jie.default)(t)).sort(e)}(),_u=class{open(){return Promise.reject(new Error(".open is not implemented"))}close(){return Promise.reject(new Error(".close is not implemented"))}put(e,r,i){return Promise.reject(new Error(".put is not implemented"))}get(e,r){return Promise.reject(new Error(".get is not implemented"))}has(e,r){return Promise.reject(new Error(".has is not implemented"))}delete(e,r){return Promise.reject(new Error(".delete is not implemented"))}async*putMany(e,r={}){for await(let{key:i,value:n}of e)await this.put(i,n,r),yield{key:i,value:n}}async*getMany(e,r={}){for await(let i of e)yield this.get(i,r)}async*deleteMany(e,r={}){for await(let i of e)await this.delete(i,r),yield i}batch(){let e=[],r=[];return{put(i,n){e.push({key:i,value:n})},delete(i){r.push(i)},commit:async i=>{await(0,pT.default)(this.putMany(e,i)),e=[],await(0,pT.default)(this.deleteMany(r,i)),r=[]}}}async*_all(e,r){throw new Error("._all is not implemented")}async*_allKeys(e,r){throw new Error("._allKeys is not implemented")}query(e,r){let i=this._all(e,r);if(e.prefix!=null&&(i=(0,Yd.default)(i,n=>n.key.toString().startsWith(e.prefix||""))),Array.isArray(e.filters)&&(i=e.filters.reduce((n,s)=>(0,Yd.default)(n,s),i)),Array.isArray(e.orders)&&(i=e.orders.reduce((n,s)=>Uie(n,s),i)),e.offset!=null){let n=0;i=(0,Yd.default)(i,()=>n++>=(e.offset||0))}return e.limit!=null&&(i=(0,yT.default)(i,e.limit)),i}queryKeys(e,r){let i=this._allKeys(e,r);if(e.prefix!=null&&(i=(0,Yd.default)(i,n=>n.toString().startsWith(e.prefix||""))),Array.isArray(e.filters)&&(i=e.filters.reduce((n,s)=>(0,Yd.default)(n,s),i)),Array.isArray(e.orders)&&(i=e.orders.reduce((n,s)=>Uie(n,s),i)),e.offset!=null){let n=0;i=(0,Yd.default)(i,()=>n++>=e.offset)}return e.limit!=null&&(i=(0,yT.default)(i,e.limit)),i}};function t1(t){let e=J.asCID(t);if(!e)throw(0,Fie.default)(new Error("Not a valid cid"),"ERR_INVALID_CID");return new qe("/"+rr.encode(e.multihash.bytes).slice(1).toUpperCase(),!1)}function tl(t){return J.createV1(Pi,Ri(rr.decode("b"+t.toString().slice(1).toLowerCase())))}function bT(t){let e=t.substring(0,1);if(e==="/")return bT(t.substring(1));let r;e.toLowerCase()==="b"?r=s=>rr.decode(s.toLowerCase()).subarray(2):e.toLowerCase()==="c"?r=s=>qw.decode(s.toLowerCase()).subarray(2):e==="z"?r=s=>pt.decode(s).subarray(2):e==="Q"?r=s=>pt.decode("z"+s):r=s=>rr.decode("b"+s.toLowerCase()).subarray(2);let i;for(let s=1;s<t.length;s++)try{i=r(t.substring(0,s))}catch(o){if(o.message!=="Unexpected end of data")throw o}let n="/C";return i&&(n=`/${rr.encode(i).slice(1,-1).toUpperCase()||"C"}`),n}function jLe(t){return{...t,prefix:t.prefix?bT(t.prefix):void 0,filters:t.filters?t.filters.map(e=>r=>e({key:tl(r.key),value:r.value})):void 0,orders:t.orders?t.orders.map(e=>(r,i)=>e({key:tl(r.key),value:r.value},{key:tl(i.key),value:i.value})):void 0}}function ULe(t){return{...t,prefix:t.prefix?bT(t.prefix):void 0,filters:t.filters?t.filters.map(e=>r=>e(tl(r))):void 0,orders:t.orders?t.orders.map(e=>(r,i)=>e(tl(r),tl(i))):void 0}}var vT=class extends _u{constructor(e){super();this.child=e}open(){return this.child.open()}close(){return this.child.close()}async*query(e,r){for await(let{key:i,value:n}of this.child.query(jLe(e),r))yield{key:tl(i),value:n}}async*queryKeys(e,r){for await(let i of this.child.queryKeys(ULe(e),r))yield tl(i)}async get(e,r){return this.child.get(t1(e),r)}async*getMany(e,r){for await(let i of e)yield this.get(i,r)}async put(e,r,i){await this.child.put(t1(e),r,i)}async*putMany(e,r){let i=(0,mT.default)();(process&&process.nextTick?process.nextTick:setImmediate)(async()=>{try{let s=this.child;await(0,gT.default)(this.child.putMany(async function*(){for await(let o of e){let a=t1(o.key);await s.has(a,r)||(yield{key:a,value:o.value}),i.push(o)}}())),i.end()}catch(s){i.end(s)}}),yield*i}has(e,r){return this.child.has(t1(e),r)}delete(e,r){return this.child.delete(t1(e),r)}deleteMany(e,r){let i=(0,mT.default)();return(0,gT.default)(this.child.deleteMany(async function*(){for await(let n of e)yield t1(n),i.push(n);i.end()}(),r)).catch(n=>{i.end(n)}),i}};function Kie(t,e,r){let i=r.path||"ipfs";return eee(i,n=>e.getCodec(n),{root:new Wd(i,{prefix:"",version:2}),blocks:new vT(new Wd(`${i}/blocks`,{prefix:"",version:2})),datastore:new Wd(`${i}/datastore`,{prefix:"",version:2}),keys:new Wd(`${i}/keys`,{prefix:"",version:2}),pins:new Wd(`${i}/pins`,{prefix:"",version:2})},{autoMigrate:r.autoMigrate,onMigrationProgress:r.onMigrationProgress||t,repoLock:_5})}dt();tt();var W7=M(it());l();var Vt=M(Vy());var P6e=M(Rt());l();var Kse=M(XT()),QT={gossipsub:Kse.default};var C6e=M(Wse()),O6e=M(eoe());l();l();var Xje=t=>Promise.reject(new Error(`No base found for "${t}"`)),hm=class{constructor(e){this._basesByName={},this._basesByPrefix={},this._loadBase=e.loadBase||Xje;for(let r of e.bases)this.addBase(r)}addBase(e){if(this._basesByName[e.name]||this._basesByPrefix[e.prefix])throw new Error(`Codec already exists for codec "${e.name}"`);this._basesByName[e.name]=e,this._basesByPrefix[e.prefix]=e}removeBase(e){delete this._basesByName[e.name],delete this._basesByPrefix[e.prefix]}async getBase(e){if(this._basesByName[e])return this._basesByName[e];if(this._basesByPrefix[e])return this._basesByPrefix[e];let r=await this._loadBase(e);return this._basesByName[r.name]==null&&this._basesByPrefix[r.prefix]==null&&this.addBase(r),r}listBases(){return Object.values(this._basesByName)}};l();var Qje=t=>Promise.reject(new Error(`No codec found for "${t}"`)),pm=class{constructor(e){this._codecsByName={},this._codecsByCode={},this._loadCodec=e.loadCodec||Qje;for(let r of e.codecs)this.addCodec(r)}addCodec(e){if(this._codecsByName[e.name]||this._codecsByCode[e.code])throw new Error(`Resolver already exists for codec "${e.name}"`);this._codecsByName[e.name]=e,this._codecsByCode[e.code]=e}removeCodec(e){delete this._codecsByName[e.name],delete this._codecsByCode[e.code]}async getCodec(e){let r=typeof e=="string"?this._codecsByName:this._codecsByCode;if(r[e])return r[e];let i=await this._loadCodec(e);return r[e]==null&&this.addCodec(i),i}listCodecs(){return Object.values(this._codecsByName)}};l();var Zje=t=>Promise.reject(new Error(`No hasher found for "${t}"`)),ym=class{constructor(e){this._hashersByName={},this._hashersByCode={},this._loadHasher=e.loadHasher||Zje;for(let r of e.hashers)this.addHasher(r)}addHasher(e){if(this._hashersByName[e.name]||this._hashersByCode[e.code])throw new Error(`Resolver already exists for codec "${e.name}"`);this._hashersByName[e.name]=e,this._hashersByCode[e.code]=e}removeHasher(e){delete this._hashersByName[e.name],delete this._hashersByCode[e.code]}async getHasher(e){let r=typeof e=="string"?this._hashersByName:this._hashersByCode;if(r[e])return r[e];let i=await this._loadHasher(e);return r[e]==null&&this.addHasher(i),i}listHashers(){return Object.values(this._hashersByName)}};Gc();l6();l();l();Te();l();l();var eR=M(rt()),Sc=M(P2());var noe=M(Ee()),th=M(ly());l();var toe=M(rt()),roe=M(Yb());function JT(t){try{t=(0,roe.default)(new toe.Multiaddr(t))}catch(e){}return t=t.toString(),t}l();var ioe=()=>{};var soe=(0,noe.default)("ipfs-http-client:lib:error-handler"),Jje=Tt.bind({ignoreUndefined:!0}),eUe=Sc.isBrowser||Sc.isWebWorker?location.protocol:"http",tUe=Sc.isBrowser||Sc.isWebWorker?location.hostname:"localhost",rUe=Sc.isBrowser||Sc.isWebWorker?location.port:"5001",iUe=(t={})=>{let e,r={},i;if(typeof t=="string"||eR.Multiaddr.isMultiaddr(t))e=new URL(JT(t));else if(t instanceof URL)e=t;else if(typeof t.url=="string"||eR.Multiaddr.isMultiaddr(t.url))e=new URL(JT(t.url)),r=t;else if(t.url instanceof URL)e=t.url,r=t;else{r=t||{};let n=(r.protocol||eUe).replace(":",""),s=(r.host||tUe).split(":")[0],o=r.port||rUe;e=new URL(`${n}://${s}:${o}`)}if(r.apiPath?e.pathname=r.apiPath:(e.pathname==="/"||e.pathname===void 0)&&(e.pathname="api/v0"),Sc.isNode){let n=ioe(e);i=r.agent||new n({keepAlive:!0,maxSockets:6})}return{...r,host:e.host,protocol:e.protocol.replace(":",""),port:Number(e.port),apiPath:e.pathname,url:e,agent:i}},nUe=async t=>{let e;try{if((t.headers.get("Content-Type")||"").startsWith("application/json")){let i=await t.json();soe(i),e=i.Message||i.message}else e=await t.text()}catch(i){soe("Failed to parse error response",i),e=i.message}let r=new th.default.HTTPError(t);throw e&&(e.includes("deadline has elapsed")&&(r=new th.default.TimeoutError),e&&e.includes("context deadline exceeded")&&(r=new th.default.TimeoutError)),e&&e.includes("request timed out")&&(r=new th.default.TimeoutError),e&&(r.message=e),r},sUe=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,ooe=t=>t.replace(sUe,function(e){return"-"+e.toLowerCase()}),oUe=t=>typeof t=="string"?of(t):t,rh=class extends th.default{constructor(e={}){let r=iUe(e);super({timeout:oUe(r.timeout||0)||void 0,headers:r.headers,base:`${r.url}`,handleError:nUe,transformSearchParams:n=>{let s=new URLSearchParams;for(let[o,a]of n)a!=="undefined"&&a!=="null"&&o!=="signal"&&s.append(ooe(o),a),o==="timeout"&&!isNaN(a)&&s.append(ooe(o),a);return s},agent:r.agent});delete this.get,delete this.put,delete this.delete,delete this.options;let i=this.fetch;this.fetch=(n,s={})=>(typeof n=="string"&&!n.startsWith("/")&&(n=`${r.url}/${n}`),i.call(this,n,Jje(s,{method:"POST"})))}},gvt=th.default.HTTPError;var re=t=>e=>t(new rh(e),e);l();l();function L8(t){if(t!=null)return typeof t=="string"?t:t.toString(8).padStart(4,"0")}l();var uoe=M(ih());function q8(t){if(t==null)return;let e;if(t.secs!=null&&(e={secs:t.secs,nsecs:t.nsecs}),t.Seconds!=null&&(e={secs:t.Seconds,nsecs:t.FractionalNanoseconds}),Array.isArray(t)&&(e={secs:t[0],nsecs:t[1]}),t instanceof Date){let r=t.getTime(),i=Math.floor(r/1e3);e={secs:i,nsecs:(r-i*1e3)*1e3}}if(!!Object.prototype.hasOwnProperty.call(e,"secs")){if(e!=null&&e.nsecs!=null&&(e.nsecs<0||e.nsecs>999999999))throw(0,uoe.default)(new Error("mtime-nsecs must be within the range [0,999999999]"),"ERR_INVALID_MTIME_NSECS");return e}}function oe({arg:t,searchParams:e,hashAlg:r,mtime:i,mode:n,...s}={}){e&&(s={...s,...e}),r&&(s.hash=r),i!=null&&(i=q8(i),s.mtime=i.secs,s.mtimeNsecs=i.nsecs),n!=null&&(s.mode=L8(n)),s.timeout&&!isNaN(s.timeout)&&(s.timeout=`${s.timeout}ms`),t==null?t=[]:Array.isArray(t)||(t=[t]);let o=new URLSearchParams(s);return t.forEach(a=>o.append("arg",a)),o}var foe=re(t=>{async function e(r={}){return((await(await t.post("bitswap/wantlist",{signal:r.signal,searchParams:oe(r),headers:r.headers})).json()).Keys||[]).map(n=>J.parse(n["/"]))}return e});l();Te();var loe=re(t=>{async function e(r,i={}){return((await(await t.post("bitswap/wantlist",{signal:i.signal,searchParams:oe({...i,peer:r.toString()}),headers:i.headers})).json()).Keys||[]).map(s=>J.parse(s["/"]))}return e});l();Te();var j8=re(t=>{async function e(r={}){let i=await t.post("bitswap/stat",{searchParams:oe(r),signal:r.signal,headers:r.headers});return cUe(await i.json())}return e});function cUe(t){return{provideBufLen:t.ProvideBufLen,wantlist:(t.Wantlist||[]).map(e=>J.parse(e["/"])),peers:t.Peers||[],blocksReceived:BigInt(t.BlocksReceived),dataReceived:BigInt(t.DataReceived),blocksSent:BigInt(t.BlocksSent),dataSent:BigInt(t.DataSent),dupBlksReceived:BigInt(t.DupBlksReceived),dupDataReceived:BigInt(t.DupDataReceived)}}l();var doe=re(t=>{async function e(r,i={}){return(await t.post("bitswap/unwant",{signal:i.signal,searchParams:oe({arg:r.toString(),...i}),headers:i.headers})).json()}return e});function hoe(t){return{wantlist:foe(t),wantlistForPeer:loe(t),unwant:doe(t),stat:j8(t)}}l();l();var U8=re(t=>{async function e(r,i={}){let n=await t.post("block/get",{signal:i.signal,searchParams:oe({arg:r.toString(),...i}),headers:i.headers});return new Uint8Array(await n.arrayBuffer())}return e});l();Te();l();l();l();var poe=M(p0()),yoe=M(ig()),goe=M(rg()),moe=M(nd());async function boe(t){if(lu(t))return new Blob([t]);if(typeof t=="string"||t instanceof String)return new Blob([t.toString()]);if(ud(t))return t;if(fd(t)&&(t=(0,goe.default)(t)),Symbol.iterator in t||Symbol.asyncIterator in t){let e=(0,yoe.default)(t),{value:r,done:i}=await e.peek();if(i)return voe(e);if(e.push(r),Number.isInteger(r))return new Blob([Uint8Array.from(await(0,moe.default)(e))]);if(lu(r)||typeof r=="string"||r instanceof String)return voe(e)}throw(0,poe.default)(new Error(`Unexpected input: ${t}`),"ERR_UNEXPECTED_INPUT")}async function voe(t){let e=[];for await(let r of t)e.push(r);return new Blob(e)}function woe(t){return gb(t,boe)}l();function _oe(t){if(t!=null)return typeof t=="string"?t:t.toString(8).padStart(4,"0")}async function Ei(t,e,r={}){let i=[],n=new FormData,s=0,o=0;for await(let{content:a,path:c,mode:u,mtime:f}of woe(t)){let d="",h=a?"file":"dir";s>0&&(d=`-${s}`);let p=h+d,y=[];if(u!=null&&y.push(`mode=${_oe(u)}`),f!=null){let{secs:b,nsecs:E}=f;y.push(`mtime=${b}`),E!=null&&y.push(`mtime-nsecs=${E}`)}if(y.length&&(p=`${p}?${y.join("&")}`),a){n.set(p,a,c!=null?encodeURIComponent(c):void 0);let b=o+a.size;i.push({name:c,start:o,end:b}),o=b}else if(c!=null)n.set(p,new File([""],encodeURIComponent(c),{type:"application/x-directory"}));else throw new Error("path or content or both must be set");s++}return{total:o,parts:i,headers:r,body:n}}l();var Eoe=M(sf());function uUe(t){return t.filter(Boolean)}function Si(...t){return(0,Eoe.anySignal)(uUe(t))}var Soe=M(wn()),xoe=re(t=>{async function e(r,i={}){let n=new Soe.AbortController,s=Si(n.signal,i.signal),o;try{o=await(await t.post("block/put",{signal:s,searchParams:oe(i),...await Ei(r,n,i.headers)})).json()}catch(a){if(i.format==="dag-pb")return e(r,{...i,format:"protobuf"});if(i.format==="dag-cbor")return e(r,{...i,format:"cbor"});throw a}return J.parse(o.Key)}return e});l();Te();var Aoe=re(t=>{async function*e(r,i={}){Array.isArray(r)||(r=[r]);let n=await t.post("block/rm",{signal:i.signal,searchParams:oe({arg:r.map(s=>s.toString()),"stream-channels":!0,...i}),headers:i.headers});for await(let s of n.ndjson())yield fUe(s)}return e});function fUe(t){let e={cid:J.parse(t.Hash)};return t.Error&&(e.error=new Error(t.Error)),e}l();Te();var Ioe=re(t=>{async function e(r,i={}){let s=await(await t.post("block/stat",{signal:i.signal,searchParams:oe({arg:r.toString(),...i}),headers:i.headers})).json();return{cid:J.parse(s.Key),size:s.Size}}return e});function Toe(t){return{get:U8(t),put:xoe(t),rm:Aoe(t),stat:Ioe(t)}}l();l();var Roe=M(rt()),Poe=re(t=>{async function e(r,i={}){let n=await t.post("bootstrap/add",{signal:i.signal,searchParams:oe({arg:r,...i}),headers:i.headers}),{Peers:s}=await n.json();return{Peers:s.map(o=>new Roe.Multiaddr(o))}}return e});l();var Coe=M(rt()),Ooe=re(t=>{async function e(r={}){let i=await t.post("bootstrap/rm",{signal:r.signal,searchParams:oe({...r,all:!0}),headers:r.headers}),{Peers:n}=await i.json();return{Peers:n.map(s=>new Coe.Multiaddr(s))}}return e});l();var koe=M(rt()),Doe=re(t=>{async function e(r={}){let i=await t.post("bootstrap/list",{signal:r.signal,searchParams:oe(r),headers:r.headers}),{Peers:n}=await i.json();return{Peers:n.map(s=>new koe.Multiaddr(s))}}return e});l();var Boe=M(rt()),Noe=re(t=>{async function e(r={}){let i=await t.post("bootstrap/add",{signal:r.signal,searchParams:oe({...r,default:!0}),headers:r.headers}),{Peers:n}=await i.json();return{Peers:n.map(s=>new Boe.Multiaddr(s))}}return e});l();var Moe=M(rt()),Loe=re(t=>{async function e(r,i={}){let n=await t.post("bootstrap/rm",{signal:i.signal,searchParams:oe({arg:r,...i}),headers:i.headers}),{Peers:s}=await n.json();return{Peers:s.map(o=>new Moe.Multiaddr(o))}}return e});function qoe(t){return{add:Poe(t),clear:Ooe(t),list:Doe(t),reset:Noe(t),rm:Loe(t)}}l();l();l();var joe=re(t=>{async function e(r,i={}){let s=await(await t.post("config/profile/apply",{signal:i.signal,searchParams:oe({arg:r,...i}),headers:i.headers})).json();return{original:s.OldCfg,updated:s.NewCfg}}return e});l();l();function lt(t){if(t==null)return t;let e=/^[A-Z]+$/,r={};return Object.keys(t).reduce((i,n)=>(e.test(n)?i[n.toLowerCase()]=t[n]:e.test(n[0])?i[n[0].toLowerCase()+n.slice(1)]=t[n]:i[n]=t[n],i),r)}var Uoe=re(t=>{async function e(r={}){return(await(await t.post("config/profile/list",{signal:r.signal,searchParams:oe(r),headers:r.headers})).json()).map(s=>lt(s))}return e});function Foe(t){return{apply:joe(t),list:Uoe(t)}}l();var Koe=re(t=>async(r,i={})=>{if(!r)throw new Error("key argument is required");return(await(await t.post("config",{signal:i.signal,searchParams:oe({arg:r,...i}),headers:i.headers})).json()).Value});l();var Voe=re(t=>async(r={})=>await(await t.post("config/show",{signal:r.signal,searchParams:oe({...r}),headers:r.headers})).json());l();dt();var zoe=M(wn()),Hoe=re(t=>async(r,i={})=>{let n=new zoe.AbortController,s=Si(n.signal,i.signal);await(await t.post("config/replace",{signal:s,searchParams:oe(i),...await Ei(Xe(JSON.stringify(r)),n,i.headers)})).text()});l();var Goe=re(t=>async(r,i,n={})=>{if(typeof r!="string")throw new Error("Invalid key type");let s={...n,...lUe(r,i)};await(await t.post("config",{signal:n.signal,searchParams:oe(s),headers:n.headers})).text()}),lUe=(t,e)=>{switch(typeof e){case"boolean":return{arg:[t,e.toString()],bool:!0};case"string":return{arg:[t,e]};default:return{arg:[t,JSON.stringify(e)],json:!0}}};function $oe(t){return{getAll:Voe(t),get:Koe(t),set:Goe(t),replace:Hoe(t),profiles:Foe(t)}}l();l();var Woe=re(t=>{async function*e(r,i={}){yield*(await t.post("dag/export",{signal:i.signal,searchParams:oe({arg:r.toString()}),headers:i.headers})).iterator()}return e});l();l();Te();var tR=M(ih());async function*rR(t,e,r,i,n){let s=async u=>{let f=await r.getCodec(u.code),d=await i(u,n);return f.decode(d)},o=e.split("/").filter(Boolean),a=await s(t),c=t;for(o.length||(yield{value:a,remainderPath:""});o.length;){let u=o.shift();if(!u)throw(0,tR.default)(new Error(`Could not resolve path "${e}"`),"ERR_INVALID_PATH");if(Object.prototype.hasOwnProperty.call(a,u))a=a[u],yield{value:a,remainderPath:o.join("/")};else throw(0,tR.default)(new Error(`no link named "${u}" under ${c}`),"ERR_NO_LINK");let f=J.asCID(a);f&&(c=f,a=await s(a))}}var Yoe=M(Sd()),Xoe=M(is()),Qoe=M(ih());var Zoe=(t,e)=>re((i,n)=>{let s=U8(n);return async(a,c={})=>{if(c.path){let p=c.localResolve?await(0,Yoe.default)(rR(a,c.path,t,s,c)):await(0,Xoe.default)(rR(a,c.path,t,s,c));if(!p)throw(0,Qoe.default)(new Error("Not found"),"ERR_NOT_FOUND");return p}let u=await t.getCodec(a.code),f=await s(a,c);return{value:u.decode(f),remainderPath:""}}})(e);l();var Joe=M(wn());Te();var eae=re(t=>{async function*e(r,i={}){let n=new Joe.AbortController,s=Si(n.signal,i.signal),{headers:o,body:a}=await Ei(r,n,i.headers),c=await t.post("dag/import",{signal:s,headers:o,body:a,searchParams:oe({"pin-roots":i.pinRoots})});for await(let{Root:u}of c.ndjson())if(u!==void 0){let{Cid:{"/":f},PinErrorMsg:d}=u;yield{root:{cid:J.parse(f),pinErrorMsg:d}}}}return e});l();Te();var tae=M(wn()),F8=(t,e)=>re(i=>async(s,o={})=>{let a={format:"dag-cbor",hashAlg:"sha2-256",inputEnc:"raw",...o},u=(await t.getCodec(a.format)).encode(s),f=new tae.AbortController,d=Si(f.signal,a.signal),p=await(await i.post("dag/put",{timeout:a.timeout,signal:d,searchParams:oe(a),...await Ei(u,f,a.headers)})).json();return J.parse(p.Cid["/"])})(e);l();Te();var rae=re(t=>async(r,i={})=>{let s=await(await t.post("dag/resolve",{signal:i.signal,searchParams:oe({arg:`${r}${i.path?`/${i.path}`.replace(/\/[/]+/g,"/"):""}`,...i}),headers:i.headers})).json();return{cid:J.parse(s.Cid["/"]),remainderPath:s.RemPath}});function iae(t,e){return{export:Woe(e),get:Zoe(t,e),import:eae(e),put:F8(t,e),resolve:rae(e)}}l();l();var aae=M(rt());l();var nae=2;var sae=4,oae=5;var cae=re(t=>{async function e(r,i={}){let n=await t.post("dht/findpeer",{signal:i.signal,searchParams:oe({arg:r,...i}),headers:i.headers});for await(let s of n.ndjson())if(s.Type===nae&&s.Responses){let{ID:o,Addrs:a}=s.Responses[0];return{id:o,addrs:(a||[]).map(c=>new aae.Multiaddr(c))}}throw new Error("not found")}return e});l();var uae=M(rt());var fae=re(t=>{async function*e(r,i={}){let n=await t.post("dht/findprovs",{signal:i.signal,searchParams:oe({arg:r.toString(),...i}),headers:i.headers});for await(let s of n.ndjson())if(s.Type===sae&&s.Responses)for(let{ID:o,Addrs:a}of s.Responses)yield{id:o,addrs:(a||[]).map(c=>new uae.Multiaddr(c))}}return e});l();dt();tt();var lae=re(t=>{async function e(r,i={}){let n=await t.post("dht/get",{signal:i.signal,searchParams:oe({arg:r instanceof Uint8Array?Ge(r):r,...i}),headers:i.headers});for await(let s of n.ndjson())if(s.Type===oae)return Xe(s.Extra,"base64pad");throw new Error("not found")}return e});l();var dae=M(rt());var hae=re(t=>{async function*e(r,i={recursive:!1}){let n=Array.isArray(r)?r:[r],s=await t.post("dht/provide",{signal:i.signal,searchParams:oe({arg:n.map(o=>o.toString()),...i}),headers:i.headers});for await(let o of s.ndjson())o=lt(o),o.responses?o.responses=o.responses.map(({ID:a,Addrs:c})=>({id:a,addrs:(c||[]).map(u=>new dae.Multiaddr(u))})):o.responses=[],yield o}return e});l();var pae=M(rt());var yae=M(wn());tt();var gae=re(t=>{async function*e(r,i,n={}){let s=new yae.AbortController,o=Si(s.signal,n.signal),a=await t.post("dht/put",{signal:o,searchParams:oe({arg:Ge(r),...n}),...await Ei(i,s,n.headers)});for await(let c of a.ndjson())c=lt(c),c.responses&&(c.responses=c.responses.map(({ID:u,Addrs:f})=>({id:u,addrs:(f||[]).map(d=>new pae.Multiaddr(d))}))),yield c}return e});l();var mae=M(rt());var bae=re(t=>{async function*e(r,i={}){let n=await t.post("dht/query",{signal:i.signal,searchParams:oe({arg:r.toString(),...i}),headers:i.headers});for await(let s of n.ndjson())s=lt(s),s.responses=(s.responses||[]).map(({ID:o,Addrs:a})=>({id:o,addrs:(a||[]).map(c=>new mae.Multiaddr(c))})),yield s}return e});function vae(t){return{findPeer:cae(t),findProvs:fae(t),get:lae(t),provide:hae(t),put:gae(t),query:bae(t)}}l();l();var wae=re(t=>{async function e(r={}){return(await t.post("diag/cmds",{signal:r.signal,searchParams:oe(r),headers:r.headers})).json()}return e});l();var _ae=re(t=>{async function e(r={}){return(await t.post("diag/net",{signal:r.signal,searchParams:oe(r),headers:r.headers})).json()}return e});l();var Eae=re(t=>{async function e(r={}){return(await t.post("diag/sys",{signal:r.signal,searchParams:oe(r),headers:r.headers})).json()}return e});function Sae(t){return{cmds:wae(t),net:_ae(t),sys:Eae(t)}}l();l();var xae=re(t=>{async function e(r,i,n={}){await(await t.post("files/chmod",{signal:n.signal,searchParams:oe({arg:r,mode:i,...n}),headers:n.headers})).text()}return e});l();Te();var Aae=re(t=>{async function e(r,i,n={}){let s=Array.isArray(r)?r:[r];await(await t.post("files/cp",{signal:n.signal,searchParams:oe({arg:s.concat(i).map(a=>J.asCID(a)?`/ipfs/${a}`:a),...n}),headers:n.headers})).text()}return e});l();Te();var Iae=re(t=>{async function e(r,i={}){if(!r||typeof r!="string")throw new Error("ipfs.files.flush requires a path");let s=await(await t.post("files/flush",{signal:i.signal,searchParams:oe({arg:r,...i}),headers:i.headers})).json();return J.parse(s.Cid)}return e});l();Te();l();function gm(t){let e=lt(t);return Object.prototype.hasOwnProperty.call(e,"mode")&&(e.mode=parseInt(e.mode,8)),Object.prototype.hasOwnProperty.call(e,"mtime")&&(e.mtime={secs:e.mtime,nsecs:e.mtimeNsecs||0},delete e.mtimeNsecs),e}var Tae=re(t=>{async function*e(r,i={}){if(!r)throw new Error("ipfs.files.ls requires a path");let n=await t.post("files/ls",{signal:i.signal,searchParams:oe({arg:J.asCID(r)?`/ipfs/${r}`:r,long:!0,...i,stream:!0}),headers:i.headers});for await(let s of n.ndjson())if("Entries"in s)for(let o of s.Entries||[])yield Rae(gm(o));else yield Rae(gm(s))}return e});function Rae(t){return t.hash&&(t.cid=J.parse(t.hash)),delete t.hash,t.type=t.type===1?"directory":"file",t}l();var Pae=re(t=>{async function e(r,i={}){await(await t.post("files/mkdir",{signal:i.signal,searchParams:oe({arg:r,...i}),headers:i.headers})).text()}return e});l();var Cae=re(t=>{async function e(r,i,n={}){Array.isArray(r)||(r=[r]),await(await t.post("files/mv",{signal:n.signal,searchParams:oe({arg:r.concat(i),...n}),headers:n.headers})).text()}return e});l();var kae=M(mm()),Dae=re(t=>{async function*e(r,i={}){let n=await t.post("files/read",{signal:i.signal,searchParams:oe({arg:r,count:i.length,...i}),headers:i.headers});yield*(0,kae.default)(n.body)}return e});l();var Bae=re(t=>{async function e(r,i={}){await(await t.post("files/rm",{signal:i.signal,searchParams:oe({arg:r,...i}),headers:i.headers})).text()}return e});l();Te();var K8=re(t=>{async function e(r,i={}){let s=await(await t.post("files/stat",{signal:i.signal,searchParams:oe({arg:r,...i}),headers:i.headers})).json();return s.WithLocality=s.WithLocality||!1,dUe(gm(s))}return e});function dUe(t){return t.cid=J.parse(t.hash),delete t.hash,t}l();var Nae=re(t=>{async function e(r,i={}){await(await t.post("files/touch",{signal:i.signal,searchParams:oe({arg:r,...i}),headers:i.headers})).text()}return e});l();var Mae=M(wn()),Lae=re(t=>{async function e(r,i,n={}){let s=new Mae.AbortController,o=Si(s.signal,n.signal);await(await t.post("files/write",{signal:o,searchParams:oe({arg:r,streamChannels:!0,count:n.length,...n}),...await Ei({content:i,path:"arg",mode:L8(n.mode),mtime:q8(n.mtime)},s,n.headers)})).text()}return e});function qae(t){return{chmod:xae(t),cp:Aae(t),flush:Iae(t),ls:Tae(t),mkdir:Pae(t),mv:Cae(t),read:Dae(t),rm:Bae(t),stat:K8(t),touch:Nae(t),write:Lae(t)}}l();l();var jae=M(ih()),Uae=re(t=>async(r,i,n={})=>{throw(0,jae.default)(new Error("Not implemented"),"ERR_NOT_IMPLEMENTED")});l();var Fae=re(t=>{async function e(r,i={type:"rsa",size:2048}){let s=await(await t.post("key/gen",{signal:i.signal,searchParams:oe({arg:r,...i}),headers:i.headers})).json();return lt(s)}return e});l();var Kae=re(t=>{async function e(r,i,n,s={}){let a=await(await t.post("key/import",{signal:s.signal,searchParams:oe({arg:r,pem:i,password:n,...s}),headers:s.headers})).json();return lt(a)}return e});l();var Vae=M(ih()),zae=re(t=>async(r,i={})=>{throw(0,Vae.default)(new Error("Not implemented"),"ERR_NOT_IMPLEMENTED")});l();var Hae=re(t=>{async function e(r={}){return((await(await t.post("key/list",{signal:r.signal,searchParams:oe(r),headers:r.headers})).json()).Keys||[]).map(s=>lt(s))}return e});l();var Gae=re(t=>{async function e(r,i,n={}){let s=await t.post("key/rename",{signal:n.signal,searchParams:oe({arg:[r,i],...n}),headers:n.headers});return lt(await s.json())}return e});l();var $ae=re(t=>{async function e(r,i={}){let s=await(await t.post("key/rm",{signal:i.signal,searchParams:oe({arg:r,...i}),headers:i.headers})).json();return lt(s.Keys[0])}return e});function Wae(t){return{export:Uae(t),gen:Fae(t),import:Kae(t),info:zae(t),list:Hae(t),rename:Gae(t),rm:$ae(t)}}l();l();var Yae=re(t=>{async function e(r,i,n={}){let s=await t.post("log/level",{signal:n.signal,searchParams:oe({arg:[r,i],...n}),headers:n.headers});return lt(await s.json())}return e});l();var Xae=re(t=>{async function e(r={}){return(await(await t.post("log/ls",{signal:r.signal,searchParams:oe(r),headers:r.headers})).json()).Strings}return e});l();var Qae=re(t=>{async function*e(r={}){yield*(await t.post("log/tail",{signal:r.signal,searchParams:oe(r),headers:r.headers})).ndjson()}return e});function Zae(t){return{level:Yae(t),ls:Xae(t),tail:Qae(t)}}l();l();var Jae=re(t=>{async function e(r,i={}){let n=await t.post("name/publish",{signal:i.signal,searchParams:oe({arg:`${r}`,...i}),headers:i.headers});return lt(await n.json())}return e});l();var ece=re(t=>{async function*e(r,i={}){let n=await t.post("name/resolve",{signal:i.signal,searchParams:oe({arg:r,stream:!0,...i}),headers:i.headers});for await(let s of n.ndjson())yield s.Path}return e});l();l();var tce=re(t=>{async function e(r,i={}){let n=await t.post("name/pubsub/cancel",{signal:i.signal,searchParams:oe({arg:r,...i}),headers:i.headers});return lt(await n.json())}return e});l();var rce=re(t=>{async function e(r={}){let i=await t.post("name/pubsub/state",{signal:r.signal,searchParams:oe(r),headers:r.headers});return lt(await i.json())}return e});l();var ice=re(t=>{async function e(r={}){return(await(await t.post("name/pubsub/subs",{signal:r.signal,searchParams:oe(r),headers:r.headers})).json()).Strings||[]}return e});function nce(t){return{cancel:tce(t),state:rce(t),subs:ice(t)}}function sce(t){return{publish:Jae(t),resolve:ece(t),pubsub:nce(t)}}l();l();Te();var oce=re(t=>{async function e(r,i={}){let s=await(await t.post("object/data",{signal:i.signal,searchParams:oe({arg:`${r instanceof Uint8Array?J.decode(r):r}`,...i}),headers:i.headers})).arrayBuffer();return new Uint8Array(s,0,s.byteLength)}return e});l();Te();dt();var ace=re(t=>{async function e(r,i={}){let s=await(await t.post("object/get",{signal:i.signal,searchParams:oe({arg:`${r instanceof Uint8Array?J.decode(r):r}`,dataEncoding:"base64",...i}),headers:i.headers})).json();return{Data:Xe(s.Data,"base64pad"),Links:(s.Links||[]).map(o=>({Name:o.Name,Hash:J.parse(o.Hash),Tsize:o.Size}))}}return e});l();Te();var cce=re(t=>{async function e(r,i={}){return((await(await t.post("object/links",{signal:i.signal,searchParams:oe({arg:`${r instanceof Uint8Array?J.decode(r):r}`,...i}),headers:i.headers})).json()).Links||[]).map(o=>({Name:o.Name,Tsize:o.Size,Hash:J.parse(o.Hash)}))}return e});l();Te();var uce=re(t=>{async function e(r={}){let i=await t.post("object/new",{signal:r.signal,searchParams:oe({arg:r.template,...r}),headers:r.headers}),{Hash:n}=await i.json();return J.parse(n)}return e});l();var fce=(t,e)=>re(i=>{let n=F8(t,e);async function s(o,a={}){return n(o,{...a,format:"dag-pb",hashAlg:"sha2-256",version:0})}return s})(e);l();Te();var lce=re(t=>{async function e(r,i={}){let s=await(await t.post("object/stat",{signal:i.signal,searchParams:oe({arg:`${r}`,...i}),headers:i.headers})).json();return{...s,Hash:J.parse(s.Hash)}}return e});l();l();Te();var dce=re(t=>{async function e(r,i,n={}){let s=await t.post("object/patch/add-link",{signal:n.signal,searchParams:oe({arg:[`${r}`,i.Name||i.name||"",(i.Hash||i.cid||"").toString()||null],...n}),headers:n.headers}),{Hash:o}=await s.json();return J.parse(o)}return e});l();Te();var hce=M(wn()),pce=re(t=>{async function e(r,i,n={}){let s=new hce.AbortController,o=Si(s.signal,n.signal),a=await t.post("object/patch/append-data",{signal:o,searchParams:oe({arg:`${r}`,...n}),...await Ei(i,s,n.headers)}),{Hash:c}=await a.json();return J.parse(c)}return e});l();Te();var yce=re(t=>{async function e(r,i,n={}){let s=await t.post("object/patch/rm-link",{signal:n.signal,searchParams:oe({arg:[`${r}`,i.Name||i.name||null],...n}),headers:n.headers}),{Hash:o}=await s.json();return J.parse(o)}return e});l();Te();var gce=M(wn()),mce=re(t=>{async function e(r,i,n={}){let s=new gce.AbortController,o=Si(s.signal,n.signal),a=await t.post("object/patch/set-data",{signal:o,searchParams:oe({arg:[`${r}`],...n}),...await Ei(i,s,n.headers)}),{Hash:c}=await a.json();return J.parse(c)}return e});function bce(t){return{addLink:dce(t),appendData:pce(t),rmLink:yce(t),setData:mce(t)}}function vce(t,e){return{data:oce(e),get:ace(e),links:cce(e),new:uce(e),put:fce(t,e),stat:lce(e),patch:bce(e)}}l();l();Te();var V8=re(t=>{async function*e(r,i={}){for await(let{path:n,recursive:s,metadata:o}of tc(r)){let a=await t.post("pin/add",{signal:i.signal,searchParams:oe({...i,arg:n,recursive:s,metadata:o?JSON.stringify(o):void 0,stream:!0}),headers:i.headers});for await(let c of a.ndjson()){if(c.Pins){for(let u of c.Pins)yield J.parse(u);continue}yield J.parse(c)}}}return e});l();var wce=M(is());function _ce(t){let e=V8(t);return re(()=>{async function r(i,n={}){return(0,wce.default)(e([{path:i,...n}],n))}return r})(t)}l();Te();function Ece(t,e,r){let i={type:t,cid:J.parse(e)};return r&&(i.metadata=r),i}var Sce=re(t=>{async function*e(r={}){let i=[];r.paths&&(i=Array.isArray(r.paths)?r.paths:[r.paths]);let n=await t.post("pin/ls",{signal:r.signal,searchParams:oe({...r,arg:i.map(s=>`${s}`),stream:!0}),headers:r.headers});for await(let s of n.ndjson()){if(s.Keys){for(let o of Object.keys(s.Keys))yield Ece(s.Keys[o].Type,o,s.Keys[o].Metadata);return}yield Ece(s.Type,s.Cid,s.Metadata)}}return e});l();Te();var z8=re(t=>{async function*e(r,i={}){for await(let{path:n,recursive:s}of tc(r)){let o=new URLSearchParams(i.searchParams);o.append("arg",`${n}`),s!=null&&o.set("recursive",String(s));let a=await t.post("pin/rm",{signal:i.signal,headers:i.headers,searchParams:oe({...i,arg:`${n}`,recursive:s})});for await(let c of a.ndjson()){if(c.Pins){yield*c.Pins.map(u=>J.parse(u));continue}yield J.parse(c)}}}return e});l();var xce=M(is());var Ace=t=>{let e=z8(t);return re(()=>{async function r(i,n={}){return(0,xce.default)(e([{path:i,...n}],n))}return r})(t)};l();l();l();Te();var H8=({Name:t,Status:e,Cid:r})=>({cid:J.parse(r),name:t,status:e}),Ice=t=>{if(typeof t=="string"&&t!=="")return t;throw new TypeError("service name must be passed")},Tce=t=>{if(J.asCID(t))return t.toString();throw new TypeError(`CID instance expected instead of ${typeof t}`)},f1=({service:t,cid:e,name:r,status:i,all:n})=>{let s=oe({service:Ice(t),name:r,force:n?!0:void 0});if(e)for(let o of e)s.append("cid",Tce(o));if(i)for(let o of i)s.append("status",o);return s},Rce=({cid:t,service:e,background:r,name:i,origins:n})=>{let s=oe({arg:Tce(t),service:Ice(e),name:i,background:r?!0:void 0});if(n)for(let o of n)s.append("origin",o.toString());return s};function Pce(t){async function e(r,{timeout:i,signal:n,headers:s,...o}){let a=await t.post("pin/remote/add",{timeout:i,signal:n,headers:s,searchParams:Rce({cid:r,...o})});return H8(await a.json())}return e}l();function Cce(t){async function*e({timeout:r,signal:i,headers:n,...s}){let o=await t.post("pin/remote/ls",{timeout:r,signal:i,headers:n,searchParams:f1(s)});for await(let a of o.ndjson())yield H8(a)}return e}l();function Oce(t){async function e({timeout:r,signal:i,headers:n,...s}){await t.post("pin/remote/rm",{timeout:r,signal:i,headers:n,searchParams:f1({...s,all:!1})})}return e}l();function kce(t){async function e({timeout:r,signal:i,headers:n,...s}){await t.post("pin/remote/rm",{timeout:r,signal:i,headers:n,searchParams:f1({...s,all:!0})})}return e}l();l();l();function Dce(t){let e=String(t);if(e==="undefined")throw Error("endpoint is required");return e[e.length-1]==="/"?e.slice(0,-1):e}function Bce(t){return{service:t.Service,endpoint:new URL(t.ApiEndpoint),...t.Stat&&{stat:hUe(t.Stat)}}}function hUe(t){switch(t.Status){case"valid":{let{Pinning:e,Pinned:r,Queued:i,Failed:n}=t.PinCount;return{status:"valid",pinCount:{queued:i,pinning:e,pinned:r,failed:n}}}case"invalid":return{status:"invalid"};default:return{status:t.Status}}}function Nce(t){async function e(r,i){let{endpoint:n,key:s,headers:o,timeout:a,signal:c}=i;await t.post("pin/remote/service/add",{timeout:a,signal:c,searchParams:oe({arg:[r,Dce(n),s]}),headers:o})}return e}l();function Mce(t){async function e(r={}){let{stat:i,headers:n,timeout:s,signal:o}=r,a=await t.post("pin/remote/service/ls",{timeout:s,signal:o,headers:n,searchParams:i===!0?oe({stat:i}):void 0}),{RemoteServices:c}=await a.json();return c.map(Bce)}return e}l();function Lce(t){async function e(r,i={}){await t.post("pin/remote/service/rm",{signal:i.signal,headers:i.headers,searchParams:oe({arg:r})})}return e}function qce(t){let e=new rh(t);return{add:Nce(e),ls:Mce(e),rm:Lce(e)}}function jce(t){let e=new rh(t);return{add:Pce(e),ls:Cce(e),rm:Oce(e),rmAll:kce(e),service:qce(t)}}function Uce(t){return{addAll:V8(t),add:_ce(t),ls:Sce(t),rmAll:z8(t),rm:Ace(t),remote:jce(t)}}l();l();var Fce=re(t=>{async function e(r={}){let{Strings:i}=await(await t.post("pubsub/ls",{signal:r.signal,searchParams:oe(r),headers:r.headers})).json();return i||[]}return e});l();var Kce=re(t=>{async function e(r,i={}){let n=await t.post("pubsub/peers",{signal:i.signal,searchParams:oe({arg:r,...i}),headers:i.headers}),{Strings:s}=await n.json();return s||[]}return e});l();var Vce=M(wn()),zce=re(t=>{async function e(r,i,n={}){let s=oe({arg:r,...n}),o=new Vce.AbortController,a=Si(o.signal,n.signal);await(await t.post("pubsub/pub",{signal:a,searchParams:s,...await Ei(i,o,n.headers)})).text()}return e});l();dt();tt();var Hce=M(Ee());var pUe=(0,Hce.default)("ipfs-http-client:pubsub:subscribe"),Gce=(t,e)=>re(r=>{async function i(n,s,o={}){o.signal=e.subscribe(n,s,o.signal);let a,c,u=new Promise((d,h)=>{a=d,c=h}),f=setTimeout(()=>a(),1e3);return r.post("pubsub/sub",{signal:o.signal,searchParams:oe({arg:n,...o}),headers:o.headers}).catch(d=>{e.unsubscribe(n,s),c(d)}).then(d=>{clearTimeout(f),!!d&&(yUe(d,{onMessage:s,onEnd:()=>e.unsubscribe(n,s),onError:o.onError}),a())}),u}return i})(t);async function yUe(t,{onMessage:e,onEnd:r,onError:i}){i=i||pUe;try{for await(let n of t.ndjson())try{if(!n.from)continue;e({from:Ge(Xe(n.from,"base64pad"),"base58btc"),data:Xe(n.data,"base64pad"),seqno:Xe(n.seqno,"base64pad"),topicIDs:n.topicIDs})}catch(s){s.message=`Failed to parse pubsub message: ${s.message}`,i(s,!1,n)}}catch(n){gUe(n)||i(n,!0)}finally{r()}}var gUe=t=>{switch(t.type){case"aborted":return!0;case"abort":return!0;default:return t.name==="AbortError"}};l();var $ce=(t,e)=>{async function r(i,n){e.unsubscribe(i,n)}return r};l();var Wce=M(wn()),iR=class{constructor(){this._subs=new Map}subscribe(e,r,i){let n=this._subs.get(e)||[];if(n.find(o=>o.handler===r))throw new Error(`Already subscribed to ${e} with this handler`);let s=new Wce.AbortController;return this._subs.set(e,[{handler:r,controller:s}].concat(n)),i&&i.addEventListener("abort",()=>this.unsubscribe(e,r)),s.signal}unsubscribe(e,r){let i=this._subs.get(e)||[],n;r?(this._subs.set(e,i.filter(s=>s.handler!==r)),n=i.filter(s=>s.handler===r)):(this._subs.set(e,[]),n=i),(this._subs.get(e)||[]).length||this._subs.delete(e),n.forEach(s=>s.controller.abort())}};function Yce(t){let e=new iR;return{ls:Fce(t),peers:Kce(t),publish:zce(t),subscribe:Gce(t,e),unsubscribe:$ce(t,e)}}l();Te();l();var Xce=re(t=>{async function*e(r={}){yield*(await t.post("refs/local",{signal:r.signal,transform:lt,searchParams:oe(r),headers:r.headers})).ndjson()}return e});var Qce=re((t,e)=>Object.assign(async function*(i,n={}){let s=Array.isArray(i)?i:[i];yield*(await t.post("refs",{signal:n.signal,searchParams:oe({arg:s.map(a=>`${a instanceof Uint8Array?J.decode(a):a}`),...n}),headers:n.headers,transform:lt})).ndjson()},{local:Xce(e)}));l();l();Te();var Zce=re(t=>{async function*e(r={}){yield*(await t.post("repo/gc",{signal:r.signal,searchParams:oe(r),headers:r.headers,transform:n=>({err:n.Error?new Error(n.Error):null,cid:(n.Key||{})["/"]?J.parse(n.Key["/"]):null})})).ndjson()}return e});l();var G8=re(t=>{async function e(r={}){let n=await(await t.post("repo/stat",{signal:r.signal,searchParams:oe(r),headers:r.headers})).json();return{numObjects:BigInt(n.NumObjects),repoSize:BigInt(n.RepoSize),repoPath:n.RepoPath,version:n.Version,storageMax:BigInt(n.StorageMax)}}return e});l();var Jce=re(t=>{async function e(r={}){return(await(await t.post("repo/version",{signal:r.signal,searchParams:oe(r),headers:r.headers})).json()).Version}return e});function eue(t){return{gc:Zce(t),stat:G8(t),version:Jce(t)}}l();l();var tue=re(t=>{async function*e(r={}){yield*(await t.post("stats/bw",{signal:r.signal,searchParams:oe(r),headers:r.headers,transform:n=>({totalIn:BigInt(n.TotalIn),totalOut:BigInt(n.TotalOut),rateIn:parseFloat(n.RateIn),rateOut:parseFloat(n.RateOut)})})).ndjson()}return e});function rue(t){return{bitswap:j8(t),repo:G8(t),bw:tue(t)}}l();l();var iue=M(rt());var nue=re(t=>{async function e(r={}){let i=await t.post("swarm/addrs",{signal:r.signal,searchParams:oe(r),headers:r.headers}),{Addrs:n}=await i.json();return Object.keys(n).map(s=>({id:s,addrs:(n[s]||[]).map(o=>new iue.Multiaddr(o))}))}return e});l();var sue=re(t=>{async function e(r,i={}){let n=await t.post("swarm/connect",{signal:i.signal,searchParams:oe({arg:r,...i}),headers:i.headers}),{Strings:s}=await n.json();return s||[]}return e});l();var oue=re(t=>{async function e(r,i={}){let n=await t.post("swarm/disconnect",{signal:i.signal,searchParams:oe({arg:r,...i}),headers:i.headers}),{Strings:s}=await n.json();return s||[]}return e});l();var aue=M(rt());var cue=re(t=>{async function e(r={}){let i=await t.post("swarm/addrs/local",{signal:r.signal,searchParams:oe(r),headers:r.headers}),{Strings:n}=await i.json();return(n||[]).map(s=>new aue.Multiaddr(s))}return e});l();var uue=M(rt());var fue=re(t=>{async function e(r={}){let i=await t.post("swarm/peers",{signal:r.signal,searchParams:oe(r),headers:r.headers}),{Peers:n}=await i.json();return(n||[]).map(s=>({addr:new uue.Multiaddr(s.Addr),peer:s.Peer,muxer:s.Muxer,latency:s.Latency,streams:s.Streams,direction:s.Direction==null?void 0:s.Direction===0?"inbound":"outbound"}))}return e});function lue(t){return{addrs:nue(t),connect:sue(t),disconnect:oue(t),localAddrs:cue(t),peers:fue(t)}}l();l();Te();var due=M(wn()),$8=re(t=>{async function*e(r,i={}){let n=new due.AbortController,s=Si(n.signal,i.signal),{headers:o,body:a,total:c,parts:u}=await Ei(r,n,i.headers),[f,d]=typeof i.progress=="function"?mUe(c,u,i.progress):[void 0,void 0],h=await t.post("add",{searchParams:oe({"stream-channels":!0,...i,progress:Boolean(f)}),onUploadProgress:d,signal:s,headers:o,body:a});for await(let p of h.ndjson())p=lt(p),p.hash!==void 0?yield vUe(p):f&&f(p.bytes||0,p.name)}return e}),mUe=(t,e,r)=>e?[void 0,bUe(t,e,r)]:[r,void 0],bUe=(t,e,r)=>{let i=0,n=e.length;return({loaded:s,total:o})=>{let a=Math.floor(s/o*t);for(;i<n;){let{start:c,end:u,name:f}=e[i];if(a<u){r(a-c,f);break}else r(u-c,f),i+=1}}};function vUe({name:t,hash:e,size:r,mode:i,mtime:n,mtimeNsecs:s}){let o={path:t,cid:J.parse(e),size:parseInt(r)};return i!=null&&(o.mode=parseInt(i,8)),n!=null&&(o.mtime={secs:n,nsecs:s||0}),o}var hue=M(is());function pue(t){let e=$8(t);return re(()=>{async function r(i,n={}){return await(0,hue.default)(e(i,n))}return r})(t)}l();var yue=re(t=>{async function*e(r,i={}){yield*(await t.post("cat",{signal:i.signal,searchParams:oe({arg:r.toString(),...i}),headers:i.headers})).iterator()}return e});l();var gue=re(t=>async(r={})=>(await t.post("commands",{signal:r.signal,searchParams:oe(r),headers:r.headers})).json());l();var mue=re(t=>async(r,i={})=>(await(await t.post("dns",{signal:i.signal,searchParams:oe({arg:r,...i}),headers:i.headers})).json()).Path);l();var bue=re(t=>()=>{let e=new URL(t.opts.base||"");return{host:e.hostname,port:e.port,protocol:e.protocol,pathname:e.pathname,"api-path":e.pathname}});l();Te();var vue=re(t=>{async function*e(r,i={}){let n={arg:`${r instanceof Uint8Array?J.decode(r):r}`,...i};n.compressionLevel&&(n["compression-level"]=n.compressionLevel,delete n.compressionLevel),yield*(await t.post("get",{signal:i.signal,searchParams:oe(n),headers:i.headers})).iterator()}return e});l();var wue=M(rt());var W8=re(t=>{async function e(r={}){let n=await(await t.post("id",{signal:r.signal,searchParams:oe({arg:r.peerId?r.peerId.toString():void 0,...r}),headers:r.headers})).json(),s={...lt(n)};return s.addresses&&(s.addresses=s.addresses.map(o=>new wue.Multiaddr(o))),s}return e});l();var _ue=t=>{let e=W8(t);async function r(i={}){let n=await e(i);return Boolean(n&&n.addresses&&n.addresses.length)}return r};l();Te();var Eue=re((t,e)=>{async function*r(i,n={}){let s=`${i instanceof Uint8Array?J.decode(i):i}`;async function o(c){let u=c.Hash;if(u.includes("/")){let d=u.startsWith("/ipfs/")?u:`/ipfs/${u}`;u=(await K8(e)(d)).cid}else u=J.parse(u);let f={name:c.Name,path:s+(c.Name?`/${c.Name}`:""),size:c.Size,cid:u,type:wUe(c)};return c.Mode&&(f.mode=parseInt(c.Mode,8)),c.Mtime!==void 0&&c.Mtime!==null&&(f.mtime={secs:c.Mtime},c.MtimeNsecs!==void 0&&c.MtimeNsecs!==null&&(f.mtime.nsecs=c.MtimeNsecs)),f}let a=await t.post("ls",{signal:n.signal,searchParams:oe({arg:s,...n}),headers:n.headers});for await(let c of a.ndjson()){if(c=c.Objects,!c)throw new Error("expected .Objects in results");if(c=c[0],!c)throw new Error("expected one array in results.Objects");let u=c.Links;if(!Array.isArray(u))throw new Error("expected one array in results.Objects[0].Links");if(!u.length){yield o(c);return}yield*u.map(o)}}return r});function wUe(t){switch(t.Type){case 1:case 5:return"dir";case 2:return"file";default:return"file"}}l();var Sue=re(t=>{async function e(r={}){let i=await t.post("dns",{signal:r.signal,searchParams:oe(r),headers:r.headers});return lt(await i.json())}return e});l();var xue=re(t=>{async function*e(r,i={}){yield*(await t.post("ping",{signal:i.signal,searchParams:oe({arg:`${r}`,...i}),headers:i.headers,transform:lt})).ndjson()}return e});l();var Aue=re(t=>{async function e(r,i={}){let n=await t.post("resolve",{signal:i.signal,searchParams:oe({arg:r,...i}),headers:i.headers}),{Path:s}=await n.json();return s}return e});l();var Iue=M(ih()),Tue=re(t=>async(r={})=>{throw(0,Iue.default)(new Error("Not implemented"),"ERR_NOT_IMPLEMENTED")});l();var Rue=re(t=>{async function e(r={}){await(await t.post("shutdown",{signal:r.signal,searchParams:oe(r),headers:r.headers})).text()}return e});l();var Pue=re(t=>{async function e(r={}){let i=await t.post("version",{signal:r.signal,searchParams:oe(r),headers:r.headers});return{...lt(await i.json()),"ipfs-http-client":"1.0.0"}}return e});var xUe=M(nR());Te();var AUe=M(rt()),IUe=M(sR());function Oue(t={}){let e={name:_s.name,code:_s.code,encode:u=>u,decode:u=>u},r=Object.values(kl);(t.ipld&&t.ipld.bases?t.ipld.bases:[]).forEach(u=>r.push(u));let i=new hm({bases:r,loadBase:t.ipld&&t.ipld.loadBase}),n=Object.values(f6);[Nn,z2,e].concat(t.ipld&&t.ipld.codecs||[]).forEach(u=>n.push(u));let s=new pm({codecs:n,loadCodec:t.ipld&&t.ipld.loadCodec}),o=Object.values(u6);(t.ipld&&t.ipld.hashers?t.ipld.hashers:[]).forEach(u=>o.push(u));let a=new ym({hashers:o,loadHasher:t.ipld&&t.ipld.loadHasher});return{add:pue(t),addAll:$8(t),bitswap:hoe(t),block:Toe(t),bootstrap:qoe(t),cat:yue(t),commands:gue(t),config:$oe(t),dag:iae(s,t),dht:vae(t),diag:Sae(t),dns:mue(t),files:qae(t),get:vue(t),getEndpointConfig:bue(t),id:W8(t),isOnline:_ue(t),key:Wae(t),log:Zae(t),ls:Eue(t),mount:Sue(t),name:sce(t),object:vce(s,t),pin:Uce(t),ping:xue(t),pubsub:Yce(t),refs:Qce(t),repo:eue(t),resolve:Aue(t),start:Tue(t),stats:rue(t),stop:Rue(t),swarm:lue(t),version:Pue(t),bases:i,codecs:s,hashers:a}}var k6e=M(rt());l();var E1e=M(Ofe()),S1e=M(Ide()),x1e=M(Yde()),A1e=M(y0e()),I1e=M(v1e()),T1e=M(XT());l();var w1e={func:(t,e)=>Uy.validate(e,t)};function _1e(t,e){return Uy.select(e[0],e[1])}function R1e(){return{dialer:{maxParallelDials:150,maxDialsPerPeer:4,dialTimeout:1e4},modules:{transport:[E1e.default,S1e.default],streamMuxer:[x1e.default],connEncryption:[A1e.NOISE],peerDiscovery:[],dht:I1e.default,pubsub:T1e.default},config:{peerDiscovery:{autoDial:!0,bootstrap:{enabled:!0},webRTCStar:{enabled:!0}},dht:{kBucketSize:20,enabled:!1,clientMode:!0,randomWalk:{enabled:!1},validators:{ipns:w1e},selectors:{ipns:_1e}},pubsub:{enabled:!0,emitSelf:!0},nat:{enabled:!1}},metrics:{enabled:!0},peerStore:{persistence:!0,threshold:1}}}var D6e=M(k1e()),B6e=M(R6e()),det=Tt.bind({ignoreUndefined:!0});function h3({options:t={},peerId:e,multiaddrs:r=[],repo:i,keychainConfig:n={},config:s={}}){let{datastore:o,keys:a}=i,c=het({options:t,config:s,datastore:o,keys:a,keychainConfig:n,peerId:e,multiaddrs:r});return typeof t.libp2p=="function"?t.libp2p({libp2pOptions:c,options:t,config:s,datastore:o,peerId:e}):B6e.default.create(c)}function het({options:t,config:e,datastore:r,keys:i,keychainConfig:n,peerId:s,multiaddrs:o}){let a=()=>{let y=(0,Vt.default)(e,"Pubsub.Router")||"gossipsub";if(!QT[y])throw(0,P6e.default)(new Error(`Router unavailable. Configure libp2p.modules.pubsub to use the ${y} router.`),"ERR_NOT_SUPPORTED");return QT[y]},c={datastore:r,peerId:s,modules:{}},u={modules:{pubsub:a(),contentRouting:[],peerRouting:[]},config:{peerDiscovery:{mdns:{enabled:(0,Vt.default)(t,"config.Discovery.MDNS.Enabled",(0,Vt.default)(e,"Discovery.MDNS.Enabled",!0))},webRTCStar:{enabled:(0,Vt.default)(t,"config.Discovery.webRTCStar.Enabled",(0,Vt.default)(e,"Discovery.webRTCStar.Enabled",!0))},bootstrap:{list:(0,Vt.default)(t,"config.Bootstrap",(0,Vt.default)(e,"Bootstrap",[]))}},relay:{enabled:(0,Vt.default)(t,"relay.enabled",(0,Vt.default)(e,"relay.enabled",!0)),hop:{enabled:(0,Vt.default)(t,"relay.hop.enabled",(0,Vt.default)(e,"relay.hop.enabled",!1)),active:(0,Vt.default)(t,"relay.hop.active",(0,Vt.default)(e,"relay.hop.active",!1))}},dht:{enabled:(0,Vt.default)(e,"Routing.Type","none")!=="none",clientMode:(0,Vt.default)(e,"Routing.Type","dht")!=="dhtserver",kBucketSize:(0,Vt.default)(t,"dht.kBucketSize",20)},pubsub:{enabled:(0,Vt.default)(t,"config.Pubsub.Enabled",(0,Vt.default)(e,"Pubsub.Enabled",!0))},nat:{enabled:!(0,Vt.default)(e,"Swarm.DisableNatPortMap",!1)}},addresses:{listen:o.map(y=>y.toString()),announce:(0,Vt.default)(t,"addresses.announce",(0,Vt.default)(e,"Addresses.Announce",[])),noAnnounce:(0,Vt.default)(t,"addresses.noAnnounce",(0,Vt.default)(e,"Addresses.NoAnnounce",[]))},connectionManager:(0,Vt.default)(t,"connectionManager",{maxConnections:(0,Vt.default)(t,"config.Swarm.ConnMgr.HighWater",(0,Vt.default)(e,"Swarm.ConnMgr.HighWater")),minConnections:(0,Vt.default)(t,"config.Swarm.ConnMgr.LowWater",(0,Vt.default)(e,"Swarm.ConnMgr.LowWater"))}),keychain:{datastore:i,...n},host:{agentVersion:`js-ipfs/${Ed}`}},f=(0,Vt.default)(t,"libp2p",void 0);typeof f=="function"&&(f=void 0);let d=det(c,R1e(),u,f);(0,Vt.default)(d,"config.peerDiscovery.bootstrap.list",[]).length>0&&d.modules.peerDiscovery.push(D6e.default);let p=(0,Vt.default)(t,"config.Addresses.Delegates",(0,Vt.default)(e,"Addresses.Delegates",[]));if(p.length>0){let y=p[Math.floor(Math.random()*p.length)],b=new k6e.Multiaddr(y).toOptions(),E={host:b.host,protocol:parseInt(b.port)===443?"https":"http",port:b.port},v=Oue(E);u.modules.contentRouting=u.modules.contentRouting||[],u.modules.contentRouting.push(new O6e.default(s,v)),u.modules.peerRouting=u.modules.peerRouting||[],u.modules.peerRouting.push(new C6e.default(v))}return d}var M6e=Tt.bind({ignoreUndefined:!0}),p3=(0,N6e.default)("ipfs:components:peer:storage"),y3=class{constructor(e,r,i,n,s){this.print=n,this.peerId=e,this.keychain=r,this.repo=i,this.print=n,this.isNew=s}static async start(e,r,i){let{repoAutoMigrate:n,repo:s,onMigrationProgress:o}=i,a=typeof s=="string"||s==null?Kie(e,r,{path:s,autoMigrate:n,onMigrationProgress:o}):s,{peerId:c,keychain:u,isNew:f}=await pet(e,a,i);return new y3(c,u,a,e,f)}},pet=async(t,e,r)=>{if(!e.closed)return{...await L6e(e,r),isNew:!1};try{return await e.open(),{...await L6e(e,r),isNew:!1}}catch(i){if(i.code!==Dd)throw i;if(r.init&&r.init.allowNew===!1)throw new Da("Initialization of new repos disabled by config, pass `config.init.isNew: true` to enable it");return{...await yet(t,e,r),isNew:!0}}},yet=async(t,e,r)=>{let i=r.init||{},n=await e.exists();if(p3("repo exists?",n),n===!0)throw new Error("repo already exists");let s=i.privateKey?await get(i.privateKey):await met(t,i),o=bet(s);p3("peer identity: %s",o.PeerID);let a={...M6e(q6e(uu(),i.profiles),r.config),Identity:o};await e.init(a),await e.open(),p3("repo opened");let c={pass:r.pass};try{c.dek=await e.config.get("Keychain.DEK")}catch(f){if(f.code!=="ERR_NOT_FOUND")throw f}let u=await h3({options:void 0,multiaddrs:void 0,peerId:s,repo:e,config:a,keychainConfig:c});return u.keychain&&u.keychain.opts&&(await u.loadKeychain(),await e.config.set("Keychain",{DEK:u.keychain.opts.dek})),{peerId:s,keychain:u.keychain}},get=t=>(p3("using user-supplied private-key"),typeof t=="object"?t:W7.default.createFromPrivKey(Xe(t,"base64pad"))),met=(t,{algorithm:e="Ed25519",bits:r=2048})=>(t("generating %s keypair...",e),W7.default.create({keyType:e,bits:r})),bet=t=>({PeerID:t.toB58String(),PrivKey:Ge(t.privKey.bytes,"base64pad")}),L6e=async(t,e)=>{let r=e.config,i=e.init&&e.init.profiles||[],n=e.pass,s=await t.config.getAll(),o=vet(q6e(s,i),r);if(s!==o&&await t.config.replace(o),!o.Identity||!o.Identity.PrivKey)throw new ef("No private key was found in the config, please intialize the repo");let a=await W7.default.createFromPrivKey(o.Identity.PrivKey),c=await h3({options:void 0,multiaddrs:void 0,peerId:a,repo:t,config:o,keychainConfig:{pass:n,...o.Keychain}});return c.keychain&&await c.loadKeychain(),{peerId:a,keychain:c.keychain}},vet=(t,e)=>e?M6e(t,e):t,q6e=(t,e)=>(e||[]).reduce((r,i)=>{let n=Ep[i];if(!n)throw new Error(`Could not find profile with name '${i}'`);return p3("applying profile %s",i),n.transform(r)},t);l();l();l();l();l();Te();di();li();var i4e=M(Z6e());l();var wO=M(Ee());wi();l();l();l();li();var Y7=class{constructor(e,r,i){this._refCounter=1,this.cid=e,this.priority=r||1,this.wantType=i}inc(){this._refCounter+=1}dec(){this._refCounter=Math.max(0,this._refCounter-1)}hasRefs(){return this._refCounter>0}get[Symbol.toStringTag](){return`WantlistEntry <key: ${this.cid.toString(pt)}, priority: ${this.priority}, refs: ${this._refCounter}>`}equals(e){return this._refCounter===e._refCounter&&this.cid.equals(e.cid)&&this.priority===e.priority&&this.wantType===e.wantType}};li();l();var _a=M(Vi()),Lc=_a.default.Reader,g3=_a.default.Writer,Yt=_a.default.util,qt=_a.default.roots["ipfs-bitswap"]||(_a.default.roots["ipfs-bitswap"]={}),Ms=qt.Message=(()=>{function t(e){if(this.blocks=[],this.payload=[],this.blockPresences=[],e)for(var r=Object.keys(e),i=0;i<r.length;++i)e[r[i]]!=null&&(this[r[i]]=e[r[i]])}return t.prototype.wantlist=null,t.prototype.blocks=Yt.emptyArray,t.prototype.payload=Yt.emptyArray,t.prototype.blockPresences=Yt.emptyArray,t.prototype.pendingBytes=0,t.encode=function(r,i){if(i||(i=g3.create()),r.wantlist!=null&&Object.hasOwnProperty.call(r,"wantlist")&&qt.Message.Wantlist.encode(r.wantlist,i.uint32(10).fork()).ldelim(),r.blocks!=null&&r.blocks.length)for(var n=0;n<r.blocks.length;++n)i.uint32(18).bytes(r.blocks[n]);if(r.payload!=null&&r.payload.length)for(var n=0;n<r.payload.length;++n)qt.Message.Block.encode(r.payload[n],i.uint32(26).fork()).ldelim();if(r.blockPresences!=null&&r.blockPresences.length)for(var n=0;n<r.blockPresences.length;++n)qt.Message.BlockPresence.encode(r.blockPresences[n],i.uint32(34).fork()).ldelim();return r.pendingBytes!=null&&Object.hasOwnProperty.call(r,"pendingBytes")&&i.uint32(40).int32(r.pendingBytes),i},t.decode=function(r,i){r instanceof Lc||(r=Lc.create(r));for(var n=i===void 0?r.len:r.pos+i,s=new qt.Message;r.pos<n;){var o=r.uint32();switch(o>>>3){case 1:s.wantlist=qt.Message.Wantlist.decode(r,r.uint32());break;case 2:s.blocks&&s.blocks.length||(s.blocks=[]),s.blocks.push(r.bytes());break;case 3:s.payload&&s.payload.length||(s.payload=[]),s.payload.push(qt.Message.Block.decode(r,r.uint32()));break;case 4:s.blockPresences&&s.blockPresences.length||(s.blockPresences=[]),s.blockPresences.push(qt.Message.BlockPresence.decode(r,r.uint32()));break;case 5:s.pendingBytes=r.int32();break;default:r.skipType(o&7);break}}return s},t.fromObject=function(r){if(r instanceof qt.Message)return r;var i=new qt.Message;if(r.wantlist!=null){if(typeof r.wantlist!="object")throw TypeError(".Message.wantlist: object expected");i.wantlist=qt.Message.Wantlist.fromObject(r.wantlist)}if(r.blocks){if(!Array.isArray(r.blocks))throw TypeError(".Message.blocks: array expected");i.blocks=[];for(var n=0;n<r.blocks.length;++n)typeof r.blocks[n]=="string"?Yt.base64.decode(r.blocks[n],i.blocks[n]=Yt.newBuffer(Yt.base64.length(r.blocks[n])),0):r.blocks[n].length&&(i.blocks[n]=r.blocks[n])}if(r.payload){if(!Array.isArray(r.payload))throw TypeError(".Message.payload: array expected");i.payload=[];for(var n=0;n<r.payload.length;++n){if(typeof r.payload[n]!="object")throw TypeError(".Message.payload: object expected");i.payload[n]=qt.Message.Block.fromObject(r.payload[n])}}if(r.blockPresences){if(!Array.isArray(r.blockPresences))throw TypeError(".Message.blockPresences: array expected");i.blockPresences=[];for(var n=0;n<r.blockPresences.length;++n){if(typeof r.blockPresences[n]!="object")throw TypeError(".Message.blockPresences: object expected");i.blockPresences[n]=qt.Message.BlockPresence.fromObject(r.blockPresences[n])}}return r.pendingBytes!=null&&(i.pendingBytes=r.pendingBytes|0),i},t.toObject=function(r,i){i||(i={});var n={};if((i.arrays||i.defaults)&&(n.blocks=[],n.payload=[],n.blockPresences=[]),i.defaults&&(n.wantlist=null,n.pendingBytes=0),r.wantlist!=null&&r.hasOwnProperty("wantlist")&&(n.wantlist=qt.Message.Wantlist.toObject(r.wantlist,i)),r.blocks&&r.blocks.length){n.blocks=[];for(var s=0;s<r.blocks.length;++s)n.blocks[s]=i.bytes===String?Yt.base64.encode(r.blocks[s],0,r.blocks[s].length):i.bytes===Array?Array.prototype.slice.call(r.blocks[s]):r.blocks[s]}if(r.payload&&r.payload.length){n.payload=[];for(var s=0;s<r.payload.length;++s)n.payload[s]=qt.Message.Block.toObject(r.payload[s],i)}if(r.blockPresences&&r.blockPresences.length){n.blockPresences=[];for(var s=0;s<r.blockPresences.length;++s)n.blockPresences[s]=qt.Message.BlockPresence.toObject(r.blockPresences[s],i)}return r.pendingBytes!=null&&r.hasOwnProperty("pendingBytes")&&(n.pendingBytes=r.pendingBytes),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,_a.default.util.toJSONOptions)},t.Wantlist=function(){function e(r){if(this.entries=[],r)for(var i=Object.keys(r),n=0;n<i.length;++n)r[i[n]]!=null&&(this[i[n]]=r[i[n]])}return e.prototype.entries=Yt.emptyArray,e.prototype.full=!1,e.encode=function(i,n){if(n||(n=g3.create()),i.entries!=null&&i.entries.length)for(var s=0;s<i.entries.length;++s)qt.Message.Wantlist.Entry.encode(i.entries[s],n.uint32(10).fork()).ldelim();return i.full!=null&&Object.hasOwnProperty.call(i,"full")&&n.uint32(16).bool(i.full),n},e.decode=function(i,n){i instanceof Lc||(i=Lc.create(i));for(var s=n===void 0?i.len:i.pos+n,o=new qt.Message.Wantlist;i.pos<s;){var a=i.uint32();switch(a>>>3){case 1:o.entries&&o.entries.length||(o.entries=[]),o.entries.push(qt.Message.Wantlist.Entry.decode(i,i.uint32()));break;case 2:o.full=i.bool();break;default:i.skipType(a&7);break}}return o},e.fromObject=function(i){if(i instanceof qt.Message.Wantlist)return i;var n=new qt.Message.Wantlist;if(i.entries){if(!Array.isArray(i.entries))throw TypeError(".Message.Wantlist.entries: array expected");n.entries=[];for(var s=0;s<i.entries.length;++s){if(typeof i.entries[s]!="object")throw TypeError(".Message.Wantlist.entries: object expected");n.entries[s]=qt.Message.Wantlist.Entry.fromObject(i.entries[s])}}return i.full!=null&&(n.full=Boolean(i.full)),n},e.toObject=function(i,n){n||(n={});var s={};if((n.arrays||n.defaults)&&(s.entries=[]),n.defaults&&(s.full=!1),i.entries&&i.entries.length){s.entries=[];for(var o=0;o<i.entries.length;++o)s.entries[o]=qt.Message.Wantlist.Entry.toObject(i.entries[o],n)}return i.full!=null&&i.hasOwnProperty("full")&&(s.full=i.full),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,_a.default.util.toJSONOptions)},e.WantType=function(){let r={},i=Object.create(r);return i[r[0]="Block"]=0,i[r[1]="Have"]=1,i}(),e.Entry=function(){function r(i){if(i)for(var n=Object.keys(i),s=0;s<n.length;++s)i[n[s]]!=null&&(this[n[s]]=i[n[s]])}return r.prototype.block=Yt.newBuffer([]),r.prototype.priority=0,r.prototype.cancel=!1,r.prototype.wantType=0,r.prototype.sendDontHave=!1,r.encode=function(n,s){return s||(s=g3.create()),n.block!=null&&Object.hasOwnProperty.call(n,"block")&&s.uint32(10).bytes(n.block),n.priority!=null&&Object.hasOwnProperty.call(n,"priority")&&s.uint32(16).int32(n.priority),n.cancel!=null&&Object.hasOwnProperty.call(n,"cancel")&&s.uint32(24).bool(n.cancel),n.wantType!=null&&Object.hasOwnProperty.call(n,"wantType")&&s.uint32(32).int32(n.wantType),n.sendDontHave!=null&&Object.hasOwnProperty.call(n,"sendDontHave")&&s.uint32(40).bool(n.sendDontHave),s},r.decode=function(n,s){n instanceof Lc||(n=Lc.create(n));for(var o=s===void 0?n.len:n.pos+s,a=new qt.Message.Wantlist.Entry;n.pos<o;){var c=n.uint32();switch(c>>>3){case 1:a.block=n.bytes();break;case 2:a.priority=n.int32();break;case 3:a.cancel=n.bool();break;case 4:a.wantType=n.int32();break;case 5:a.sendDontHave=n.bool();break;default:n.skipType(c&7);break}}return a},r.fromObject=function(n){if(n instanceof qt.Message.Wantlist.Entry)return n;var s=new qt.Message.Wantlist.Entry;switch(n.block!=null&&(typeof n.block=="string"?Yt.base64.decode(n.block,s.block=Yt.newBuffer(Yt.base64.length(n.block)),0):n.block.length&&(s.block=n.block)),n.priority!=null&&(s.priority=n.priority|0),n.cancel!=null&&(s.cancel=Boolean(n.cancel)),n.wantType){case"Block":case 0:s.wantType=0;break;case"Have":case 1:s.wantType=1;break}return n.sendDontHave!=null&&(s.sendDontHave=Boolean(n.sendDontHave)),s},r.toObject=function(n,s){s||(s={});var o={};return s.defaults&&(s.bytes===String?o.block="":(o.block=[],s.bytes!==Array&&(o.block=Yt.newBuffer(o.block))),o.priority=0,o.cancel=!1,o.wantType=s.enums===String?"Block":0,o.sendDontHave=!1),n.block!=null&&n.hasOwnProperty("block")&&(o.block=s.bytes===String?Yt.base64.encode(n.block,0,n.block.length):s.bytes===Array?Array.prototype.slice.call(n.block):n.block),n.priority!=null&&n.hasOwnProperty("priority")&&(o.priority=n.priority),n.cancel!=null&&n.hasOwnProperty("cancel")&&(o.cancel=n.cancel),n.wantType!=null&&n.hasOwnProperty("wantType")&&(o.wantType=s.enums===String?qt.Message.Wantlist.WantType[n.wantType]:n.wantType),n.sendDontHave!=null&&n.hasOwnProperty("sendDontHave")&&(o.sendDontHave=n.sendDontHave),o},r.prototype.toJSON=function(){return this.constructor.toObject(this,_a.default.util.toJSONOptions)},r}(),e}(),t.Block=function(){function e(r){if(r)for(var i=Object.keys(r),n=0;n<i.length;++n)r[i[n]]!=null&&(this[i[n]]=r[i[n]])}return e.prototype.prefix=Yt.newBuffer([]),e.prototype.data=Yt.newBuffer([]),e.encode=function(i,n){return n||(n=g3.create()),i.prefix!=null&&Object.hasOwnProperty.call(i,"prefix")&&n.uint32(10).bytes(i.prefix),i.data!=null&&Object.hasOwnProperty.call(i,"data")&&n.uint32(18).bytes(i.data),n},e.decode=function(i,n){i instanceof Lc||(i=Lc.create(i));for(var s=n===void 0?i.len:i.pos+n,o=new qt.Message.Block;i.pos<s;){var a=i.uint32();switch(a>>>3){case 1:o.prefix=i.bytes();break;case 2:o.data=i.bytes();break;default:i.skipType(a&7);break}}return o},e.fromObject=function(i){if(i instanceof qt.Message.Block)return i;var n=new qt.Message.Block;return i.prefix!=null&&(typeof i.prefix=="string"?Yt.base64.decode(i.prefix,n.prefix=Yt.newBuffer(Yt.base64.length(i.prefix)),0):i.prefix.length&&(n.prefix=i.prefix)),i.data!=null&&(typeof i.data=="string"?Yt.base64.decode(i.data,n.data=Yt.newBuffer(Yt.base64.length(i.data)),0):i.data.length&&(n.data=i.data)),n},e.toObject=function(i,n){n||(n={});var s={};return n.defaults&&(n.bytes===String?s.prefix="":(s.prefix=[],n.bytes!==Array&&(s.prefix=Yt.newBuffer(s.prefix))),n.bytes===String?s.data="":(s.data=[],n.bytes!==Array&&(s.data=Yt.newBuffer(s.data)))),i.prefix!=null&&i.hasOwnProperty("prefix")&&(s.prefix=n.bytes===String?Yt.base64.encode(i.prefix,0,i.prefix.length):n.bytes===Array?Array.prototype.slice.call(i.prefix):i.prefix),i.data!=null&&i.hasOwnProperty("data")&&(s.data=n.bytes===String?Yt.base64.encode(i.data,0,i.data.length):n.bytes===Array?Array.prototype.slice.call(i.data):i.data),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,_a.default.util.toJSONOptions)},e}(),t.BlockPresenceType=function(){let e={},r=Object.create(e);return r[e[0]="Have"]=0,r[e[1]="DontHave"]=1,r}(),t.BlockPresence=function(){function e(r){if(r)for(var i=Object.keys(r),n=0;n<i.length;++n)r[i[n]]!=null&&(this[i[n]]=r[i[n]])}return e.prototype.cid=Yt.newBuffer([]),e.prototype.type=0,e.encode=function(i,n){return n||(n=g3.create()),i.cid!=null&&Object.hasOwnProperty.call(i,"cid")&&n.uint32(10).bytes(i.cid),i.type!=null&&Object.hasOwnProperty.call(i,"type")&&n.uint32(16).int32(i.type),n},e.decode=function(i,n){i instanceof Lc||(i=Lc.create(i));for(var s=n===void 0?i.len:i.pos+n,o=new qt.Message.BlockPresence;i.pos<s;){var a=i.uint32();switch(a>>>3){case 1:o.cid=i.bytes();break;case 2:o.type=i.int32();break;default:i.skipType(a&7);break}}return o},e.fromObject=function(i){if(i instanceof qt.Message.BlockPresence)return i;var n=new qt.Message.BlockPresence;switch(i.cid!=null&&(typeof i.cid=="string"?Yt.base64.decode(i.cid,n.cid=Yt.newBuffer(Yt.base64.length(i.cid)),0):i.cid.length&&(n.cid=i.cid)),i.type){case"Have":case 0:n.type=0;break;case"DontHave":case 1:n.type=1;break}return n},e.toObject=function(i,n){n||(n={});var s={};return n.defaults&&(n.bytes===String?s.cid="":(s.cid=[],n.bytes!==Array&&(s.cid=Yt.newBuffer(s.cid))),s.type=n.enums===String?"Have":0),i.cid!=null&&i.hasOwnProperty("cid")&&(s.cid=n.bytes===String?Yt.base64.encode(i.cid,0,i.cid.length):n.bytes===Array?Array.prototype.slice.call(i.cid):i.cid),i.type!=null&&i.hasOwnProperty("type")&&(s.type=n.enums===String?qt.Message.BlockPresenceType[i.type]:i.type),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,_a.default.util.toJSONOptions)},e}(),t})();var J6e={Block:Ms.Wantlist.WantType.Block,Have:Ms.Wantlist.WantType.Have},Bet=(t,e)=>Array.prototype.slice.call(e,0).sort((r,i)=>{let n=t(r),s=t(i);return n<s?-1:n>s?1:0}),qc=class{constructor(e){this.set=new Map,this._stats=e}get length(){return this.set.size}add(e,r,i){let n=e.toString(pt),s=this.set.get(n);s?(s.inc(),s.priority=r,s.wantType===J6e.Have&&i===J6e.Block&&(s.wantType=i)):(this.set.set(n,new Y7(e,r,i)),this._stats&&this._stats.push(null,"wantListSize",1))}remove(e){let r=e.toString(pt),i=this.set.get(r);!i||(i.dec(),!i.hasRefs()&&(this.set.delete(r),this._stats&&this._stats.push(null,"wantListSize",-1)))}removeForce(e){this.set.has(e)&&this.set.delete(e)}forEach(e){return this.set.forEach(e)}entries(){return this.set.entries()}sortedEntries(){return new Map(Bet(e=>e[1].key,Array.from(this.set.entries())))}contains(e){let r=e.toString(pt);return this.set.has(r)}get(e){let r=e.toString(pt);return this.set.get(r)}};qc.Entry=Y7;li();var Net=qc.Entry,Ph=class{constructor(e,r,i,n,s){this.entry=new Net(e,r,i),this.cancel=Boolean(n),this.sendDontHave=Boolean(s)}get cid(){return this.entry.cid}set cid(e){this.entry.cid=e}get priority(){return this.entry.priority}set priority(e){this.entry.priority=e}get wantType(){return this.entry.wantType}set wantType(e){this.entry.wantType=e}get[Symbol.toStringTag](){return`BitswapMessageEntry ${this.cid.toString(pt)} <cancel: ${this.cancel}, priority: ${this.priority}>`}equals(e){return this.cancel===e.cancel&&this.sendDontHave===e.sendDontHave&&this.wantType===e.wantType&&this.entry.equals(e.entry)}};var Co=(t,e)=>{let r=["bitswap"];return e&&r.push(e),t&&r.push(`${t.toB58String().slice(0,8)}`),Object.assign((0,wO.default)(r.join(":")),{error:(0,wO.default)(r.concat(["error"]).join(":"))})};var X7=(t,e)=>{if(t.size!==e.size)return!1;for(let[r,i]of t){let n=e.get(r);if(n===void 0||i instanceof Uint8Array&&n instanceof Uint8Array&&!Ba(i,n)||i instanceof Ph&&n instanceof Ph&&!i.equals(n))return!1}return!0};mn();var n4e=M(r4e()),er=class{constructor(e){this.full=e,this.wantlist=new Map,this.blocks=new Map,this.blockPresences=new Map,this.pendingBytes=0}get empty(){return this.blocks.size===0&&this.wantlist.size===0&&this.blockPresences.size===0}addEntry(e,r,i,n,s){i==null&&(i=er.WantType.Block);let o=e.toString(pt),a=this.wantlist.get(o);a?(a.wantType===i&&(a.priority=r),n&&(a.cancel=Boolean(n)),s&&(a.sendDontHave=Boolean(s)),i===er.WantType.Block&&a.wantType===er.WantType.Have&&(a.wantType=i)):this.wantlist.set(o,new Ph(e,r,i,n,s))}addBlock(e,r){let i=e.toString(pt);this.blocks.set(i,r)}addHave(e){let r=e.toString(pt);this.blockPresences.has(r)||this.blockPresences.set(r,er.BlockPresenceType.Have)}addDontHave(e){let r=e.toString(pt);this.blockPresences.has(r)||this.blockPresences.set(r,er.BlockPresenceType.DontHave)}cancel(e){let r=e.toString(pt);this.wantlist.delete(r),this.addEntry(e,0,er.WantType.Block,!0,!1)}setPendingBytes(e){this.pendingBytes=e}serializeToBitswap100(){let e={wantlist:{entries:Array.from(this.wantlist.values()).map(r=>({block:r.cid.bytes,priority:Number(r.priority),cancel:Boolean(r.cancel)})),full:this.full?!0:void 0},blocks:Array.from(this.blocks.values())};return Ms.encode(e).finish()}serializeToBitswap110(){let e={wantlist:{entries:Array.from(this.wantlist.values()).map(r=>({block:r.cid.bytes,priority:Number(r.priority),wantType:r.wantType,cancel:Boolean(r.cancel),sendDontHave:Boolean(r.sendDontHave)})),full:this.full?!0:void 0},blockPresences:[],payload:[],pendingBytes:this.pendingBytes};for(let[r,i]of this.blocks.entries()){let n=J.parse(r),s=Uint8Array.from([n.code]),o=n.multihash.bytes.subarray(0,2),a=gn([[n.version],s,o],1+s.byteLength+o.byteLength);e.payload.push(new Ms.Block({prefix:a,data:i}))}for(let[r,i]of this.blockPresences)e.blockPresences.push(new Ms.BlockPresence({cid:J.parse(r).bytes,type:i}));return this.pendingBytes>0&&(e.pendingBytes=this.pendingBytes),Ms.encode(e).finish()}equals(e){return!(this.full!==e.full||this.pendingBytes!==e.pendingBytes||!X7(this.wantlist,e.wantlist)||!X7(this.blocks,e.blocks)||!X7(this.blockPresences,e.blockPresences))}get[Symbol.toStringTag](){let e=Array.from(this.wantlist.keys()),r=Array.from(this.blocks.keys());return`BitswapMessage <full: ${this.full}, list: ${e}, blocks: ${r}>`}};er.deserialize=async(t,e={})=>{let r=Ms.decode(t),i=r.wantlist&&r.wantlist.full||!1,n=new er(i);return r.wantlist&&r.wantlist.entries&&r.wantlist.entries.forEach(s=>{if(!s.block)return;let o=J.decode(s.block);n.addEntry(o,s.priority||0,s.wantType,Boolean(s.cancel),Boolean(s.sendDontHave))}),r.blockPresences&&r.blockPresences.forEach(s=>{if(!s.cid)return;let o=J.decode(s.cid);s.type===er.BlockPresenceType.Have?n.addHave(o):n.addDontHave(o)}),r.blocks.length>0?(await Promise.all(r.blocks.map(async s=>{let o=await dr.digest(s),a=J.createV0(o);n.addBlock(a,s)})),n):(r.payload.length>0&&(await Promise.all(r.payload.map(async s=>{if(!s.prefix||!s.data)return;let o=(0,i4e.default)(s.prefix),a=o[0],c=o[1],u=o[2],f=u===dr.code?dr:e[u];if(!f)throw(0,n4e.default)(new Error("Unknown hash algorithm"),"ERR_UNKNOWN_HASH_ALG");let d=await f.digest(s.data),h=J.create(a,c,d);n.addBlock(h,s.data)})),n.setPendingBytes(r.pendingBytes)),n)};er.blockPresenceSize=t=>t.bytes.length+1;er.Entry=Ph;er.WantType={Block:Ms.Wantlist.WantType.Block,Have:Ms.Wantlist.WantType.Have};er.BlockPresenceType={Have:Ms.BlockPresenceType.Have,DontHave:Ms.BlockPresenceType.DontHave};l();var _O=1e3,s4e=3,o4e=10*_O,NBt=15*_O,MBt=15*_O,a4e=Math.pow(2,31)-1,c4e=1e3,u4e=1;l();var d4e=M(l4e());var EO=class{constructor(e,r,i){this.peerId=r,this.network=i,this.refcnt=1,this._entries=[],this._log=Co(e,"msgqueue"),this.sendEntries=(0,d4e.default)(this._sendEntries.bind(this),u4e)}addMessage(e){e.empty||this.send(e)}addEntries(e){this._entries=this._entries.concat(e),this.sendEntries()}_sendEntries(){if(!this._entries.length)return;let e=new er(!1);this._entries.forEach(r=>{r.cancel?e.cancel(r.cid):e.addEntry(r.cid,r.priority)}),this._entries=[],this.addMessage(e)}async send(e){try{await this.network.connectTo(this.peerId)}catch(r){this._log.error("cant connect to peer %s: %s",this.peerId.toB58String(),r.message);return}this._log("sending message to peer %s",this.peerId.toB58String()),this.network.sendMessage(this.peerId,e).catch(r=>{this._log.error("send error: %s",r.message)})}};li();var SO=class{constructor(e,r,i){this.peers=new Map,this.wantlist=new qc(i),this.network=r,this._stats=i,this._peerId=e,this._log=Co(e,"want")}_addEntries(e,r,i){let n=e.map((s,o)=>new er.Entry(s,a4e-o,er.WantType.Block,r));n.forEach(s=>{s.cancel?i?this.wantlist.removeForce(s.cid.toString(pt)):this.wantlist.remove(s.cid):(this._log("adding to wl"),this.wantlist.add(s.cid,s.priority))});for(let s of this.peers.values())s.addEntries(n)}_startPeerHandler(e){let r=this.peers.get(e.toB58String());if(r){r.refcnt++;return}r=new EO(this._peerId,e,this.network);let i=new er(!0);for(let n of this.wantlist.entries())i.addEntry(n[1].cid,n[1].priority);return r.addMessage(i),this.peers.set(e.toB58String(),r),r}_stopPeerHandler(e){let r=this.peers.get(e.toB58String());!r||(r.refcnt--,!(r.refcnt>0)&&this.peers.delete(e.toB58String()))}wantBlocks(e,r={}){this._addEntries(e,!1),r&&r.signal&&r.signal.addEventListener("abort",()=>{this.cancelWants(e)})}unwantBlocks(e){this._log("unwant blocks: %s",e.length),this._addEntries(e,!0,!0)}cancelWants(e){this._log("cancel wants: %s",e.length),this._addEntries(e,!0)}connectedPeers(){return Array.from(this.peers.keys())}connected(e){this._startPeerHandler(e)}disconnected(e){this._stopPeerHandler(e)}start(){}stop(){this.peers.forEach(e=>this.disconnected(e.peerId))}};l();var xO=M(fa()),AO=M(Nr()),h4e=M(b8());var IO="/ipfs/bitswap/1.0.0",TO="/ipfs/bitswap/1.1.0",RO="/ipfs/bitswap/1.2.0",PO=class{constructor(e,r,i,n={}){this._log=Co(e.peerId,"network"),this._libp2p=e,this._bitswap=r,this._protocols=[IO],n.b100Only||(this._protocols.unshift(TO),this._protocols.unshift(RO)),this._stats=i,this._running=!1,this._onPeerConnect=this._onPeerConnect.bind(this),this._onPeerDisconnect=this._onPeerDisconnect.bind(this),this._onConnection=this._onConnection.bind(this),this._hashers=n.hashers||{}}start(){this._running=!0,this._libp2p.handle(this._protocols,this._onConnection);let e=new h4e.default({multicodecs:this._protocols,handlers:{onConnect:this._onPeerConnect,onDisconnect:this._onPeerDisconnect}});this._registrarId=this._libp2p.registrar.register(e);for(let r of this._libp2p.peerStore.peers.values()){let i=this._libp2p.connectionManager.get(r.id);i&&this._onPeerConnect(i.remotePeer)}}stop(){this._running=!1,this._libp2p.unhandle(this._protocols),this._registrarId!=null&&this._libp2p.registrar.unregister(this._registrarId)}async _onConnection({protocol:e,stream:r,connection:i}){if(!!this._running){this._log("incoming new bitswap %s connection from %s",e,i.remotePeer.toB58String());try{await(0,AO.pipe)(r,xO.default.decode(),async n=>{for await(let s of n)try{let o=await er.deserialize(s.slice(),this._hashers);await this._bitswap._receiveMessage(i.remotePeer,o)}catch(o){this._bitswap._receiveError(o);break}})}catch(n){this._log(n)}}}_onPeerConnect(e){this._bitswap._onPeerConnected(e)}_onPeerDisconnect(e){this._bitswap._onPeerDisconnected(e)}findProviders(e,r,i={}){return this._libp2p.contentRouting.findProviders(e,{timeout:o4e,maxNumProviders:r})}async findAndConnect(e,r){let i=[];for await(let n of this.findProviders(e,s4e,r))this._log(`connecting to provider ${n.id}`),i.push(this.connectTo(n.id,r).catch(s=>{this._log.error(s)}));await Promise.all(i)}async provide(e,r){await this._libp2p.contentRouting.provide(e,r)}async sendMessage(e,r){if(!this._running)throw new Error("network isn't running");let i=e.toB58String();this._log("sendMessage to %s",i,r);let n=await this._libp2p.dial(e),{stream:s,protocol:o}=await n.newStream([RO,TO,IO]),a;switch(o){case IO:a=r.serializeToBitswap100();break;case TO:case RO:a=r.serializeToBitswap110();break;default:throw new Error("Unknown protocol: "+o)}qet(s,a,this._log),this._updateSentStats(e,r.blocks)}async connectTo(e,r){if(!this._running)throw new Error("network isn't running");return this._libp2p.dial(e,r)}_updateSentStats(e,r){let i=e.toB58String();if(this._stats){for(let n of r.values())this._stats.push(i,"dataSent",n.length);this._stats.push(i,"blocksSent",r.size)}}};async function qet(t,e,r){try{await(0,AO.pipe)([e],xO.default.encode(),t)}catch(i){r(i)}}l();Te();li();l();var CO=class{constructor(e){this.partner=e,this.wantlist=new qc,this.exchangeCount=0,this.sentToPeer=new Map,this.accounting={bytesSent:0,bytesRecv:0}}sentBytes(e){this.exchangeCount++,this.lastExchange=new Date().getTime(),this.accounting.bytesSent+=e}receivedBytes(e){this.exchangeCount++,this.lastExchange=new Date().getTime(),this.accounting.bytesRecv+=e}wants(e,r,i){this.wantlist.add(e,r,i)}cancelWant(e){this.wantlist.remove(e)}wantlistContains(e){return this.wantlist.get(e)}debtRatio(){return this.accounting.bytesSent/(this.accounting.bytesRecv+1)}};l();l();var Q7=class extends Map{constructor(e,r){super();this._cmp=r||this._defaultSort,this._keys=[];for(let[i,n]of e||[])this.set(i,n)}update(e){if(e<0||e>=this._keys.length)return;let r=this._keys[e];this._keys.splice(e,1);let i=this._find(r);this._keys.splice(i,0,r)}set(e,r){if(this.has(e)){let n=this.indexOf(e);this._keys.splice(n,1)}super.set(e,r);let i=this._find(e);return this._keys.splice(i,0,e),this}clear(){super.clear(),this._keys=[]}delete(e){if(!this.has(e))return!1;let r=this.indexOf(e);return this._keys.splice(r,1),super.delete(e)}indexOf(e){if(!this.has(e))return-1;let r=this._find(e);if(this._keys[r]===e)return r;for(let i=1;i<this._keys.length;i++){if(this._keys[r+i]===e)return r+i;if(this._keys[r-i]===e)return r-i}return-1}_find(e){let r=0,i=this._keys.length;for(;r<i;){let n=r+i>>>1,s=this._kCmp(this._keys[n],e);if(s<0)r=n+1;else if(s>0)i=n;else return n}return r}*keys(){for(let e of this._keys)yield e}*values(){for(let e of this._keys)yield this.get(e)}*entries(){for(let e of this._keys)yield[e,this.get(e)]}*[Symbol.iterator](){yield*this.entries()}forEach(e,r){if(!!e)for(let i of this._keys)e.apply(r,[[i,this.get(i)]])}_defaultSort(e,r){return e[0]<r[0]?-1:r[0]<e[0]?1:0}_kCmp(e,r){return this._cmp([e,this.get(e)],[r,this.get(r)])}};var jet={hasNewInfo(){return!1},merge(){}},OO=class{constructor(e=jet){this._taskMerger=e,this._byPeer=new Q7([],kO.compare)}pushTasks(e,r){let i=this._byPeer.get(e.toB58String());i||(i=new kO(e,this._taskMerger)),i.pushTasks(r),this._byPeer.set(e.toB58String(),i)}popTasks(e){let r=this._head();if(r===void 0)return{tasks:[],pendingSize:0};let{tasks:i,pendingSize:n}=r.popTasks(e);if(i.length===0)return{tasks:i,pendingSize:n};let s=r.peerId;return r.isIdle()?this._byPeer.delete(s.toB58String()):this._byPeer.update(0),{peerId:s,tasks:i,pendingSize:n}}_head(){if(this._byPeer.size!==0)for(let[,e]of this._byPeer)return e}remove(e,r){let i=this._byPeer.get(r.toB58String());i&&i.remove(e)}tasksDone(e,r){let i=this._byPeer.get(e.toB58String());if(!i)return;let n=this._byPeer.indexOf(e.toB58String());for(let s of r)i.taskDone(s);this._byPeer.update(n)}},kO=class{constructor(e,r){this.peerId=e,this._taskMerger=r,this._activeTotalSize=0,this._pending=new p4e,this._active=new Set}pushTasks(e){for(let r of e)this._pushTask(r)}_pushTask(e){if(!this._taskHasMoreInfoThanActiveTasks(e))return;let r=this._pending.get(e.topic);if(r){e.priority>r.priority&&this._pending.updatePriority(e.topic,e.priority),this._taskMerger.merge(e,r);return}this._pending.add(e)}_taskHasMoreInfoThanActiveTasks(e){let r=[];for(let i of this._active)i.topic===e.topic&&r.push(i);return r.length===0?!0:this._taskMerger.hasNewInfo(e,r)}popTasks(e){let r=0,i=[],n=this._pending.tasks();for(let s=0;s<n.length&&r<e;s++){let o=n[s];i.push(o),r+=o.size,this._pending.delete(o.topic),this._activeTotalSize+=o.size,this._active.add(o)}return{tasks:i,pendingSize:this._pending.totalSize}}taskDone(e){this._active.has(e)&&(this._activeTotalSize-=e.size,this._active.delete(e))}remove(e){this._pending.delete(e)}isIdle(){return this._pending.length===0&&this._active.size===0}static compare(e,r){return e[1]._pending.length===0?1:r[1]._pending.length===0?-1:e[1]._activeTotalSize===r[1]._activeTotalSize?r[1]._pending.length-e[1]._pending.length:e[1]._activeTotalSize-r[1]._activeTotalSize}},p4e=class{constructor(){this._tasks=new Q7([],this._compare)}get length(){return this._tasks.size}get totalSize(){return[...this._tasks.values()].reduce((e,r)=>e+r.task.size,0)}get(e){return(this._tasks.get(e)||{}).task}add(e){this._tasks.set(e.topic,{created:Date.now(),task:e})}delete(e){this._tasks.delete(e)}tasks(){return[...this._tasks.values()].map(e=>e.task)}updatePriority(e,r){let i=this._tasks.get(e);if(!i)return;let n=this._tasks.indexOf(e);i.task.priority=r,this._tasks.update(n)}_compare(e,r){return e[1].task.priority===r[1].task.priority?e[1].created-r[1].created:r[1].task.priority-e[1].task.priority}};l();var y4e={hasNewInfo(t,e){let r=!1,i=!1;for(let n of e)n.data.haveBlock&&(r=!0),n.data.isWantBlock&&(i=!0);return!!(!i&&t.data.isWantBlock||!r&&t.data.haveBlock)},merge(t,e){let r=t.data,i=e.data;!i.haveBlock&&r.haveBlock&&(i.haveBlock=r.haveBlock,i.blockSize=r.blockSize),!i.isWantBlock&&r.isWantBlock&&(i.isWantBlock=!0,(!i.haveBlock||r.haveBlock)&&(i.haveBlock=r.haveBlock,e.size=t.size)),i.isWantBlock&&i.haveBlock&&(e.size=i.blockSize)}};var g4e=er.WantType,Uet=16*1024,Fet=1024,DO=class{constructor(e,r,i,n,s={}){this._log=Co(e,"engine"),this.blockstore=r,this.network=i,this._stats=n,this._opts=this._processOpts(s),this.ledgerMap=new Map,this._running=!1,this._requestQueue=new OO(y4e)}_processOpts(e){return{maxSizeReplaceHasWithBlock:Fet,targetMessageSize:Uet,...e}}_scheduleProcessTasks(){setTimeout(()=>{this._processTasks()})}async _processTasks(){if(!this._running)return;let{peerId:e,tasks:r,pendingSize:i}=this._requestQueue.popTasks(this._opts.targetMessageSize);if(r.length===0)return;let n=new er(!1);n.setPendingBytes(i);let s=[],o=new Map;for(let c of r){let u=J.parse(c.topic);c.data.haveBlock?c.data.isWantBlock?(s.push(u),o.set(c.topic,c.data)):n.addHave(u):n.addDontHave(u)}let a=await this._getBlocks(s);for(let[c,u]of o){let f=J.parse(c),d=a.get(c);d?n.addBlock(f,d):u.sendDontHave&&n.addDontHave(f)}if(n.empty){e&&this._requestQueue.tasksDone(e,r),this._scheduleProcessTasks();return}try{e&&await this.network.sendMessage(e,n);for(let[c,u]of a.entries())e&&this.messageSent(e,J.parse(c),u)}catch(c){this._log.error(c)}e&&this._requestQueue.tasksDone(e,r),this._scheduleProcessTasks()}wantlistForPeer(e){let r=e.toB58String(),i=this.ledgerMap.get(r);return i?i.wantlist.sortedEntries():new Map}ledgerForPeer(e){let r=e.toB58String(),i=this.ledgerMap.get(r);return i?{peer:i.partner,value:i.debtRatio(),sent:i.accounting.bytesSent,recv:i.accounting.bytesRecv,exchanged:i.exchangeCount}:null}peers(){return Array.from(this.ledgerMap.values()).map(e=>e.partner)}receivedBlocks(e){if(!!e.length){for(let r of this.ledgerMap.values())for(let i of e){let n=r.wantlistContains(i.cid);if(!n)continue;let s=i.data.length,o=this._sendAsBlock(n.wantType,s),a=s;o||(a=er.blockPresenceSize(n.cid)),this._requestQueue.pushTasks(r.partner,[{topic:n.cid.toString(pt),priority:n.priority,size:a,data:{blockSize:s,isWantBlock:o,haveBlock:!0,sendDontHave:!1}}])}this._scheduleProcessTasks()}}async messageReceived(e,r){let i=this._findOrCreate(e);if(r.empty)return;if(r.full&&(i.wantlist=new qc),this._updateBlockAccounting(r.blocks,i),r.wantlist.size===0){this._scheduleProcessTasks();return}let n=[],s=[];r.wantlist.forEach(o=>{o.cancel?(i.cancelWant(o.cid),n.push(o.cid)):(i.wants(o.cid,o.priority,o.wantType),s.push(o))}),this._cancelWants(e,n),await this._addWants(e,s),this._scheduleProcessTasks()}_cancelWants(e,r){for(let i of r)this._requestQueue.remove(i.toString(pt),e)}async _addWants(e,r){let i=await this._getBlockSizes(r.map(s=>s.cid)),n=[];for(let s of r){let o=s.cid.toString(pt),a=i.get(o);if(a==null)s.sendDontHave&&n.push({topic:o,priority:s.priority,size:er.blockPresenceSize(s.cid),data:{isWantBlock:s.wantType===g4e.Block,blockSize:0,haveBlock:!1,sendDontHave:s.sendDontHave}});else{let c=this._sendAsBlock(s.wantType,a),u=a;c||(u=er.blockPresenceSize(s.cid)),n.push({topic:o,priority:s.priority,size:u,data:{isWantBlock:c,blockSize:a,haveBlock:!0,sendDontHave:s.sendDontHave}})}this._requestQueue.pushTasks(e,n)}}_sendAsBlock(e,r){return e===g4e.Block||r<=this._opts.maxSizeReplaceHasWithBlock}async _getBlockSizes(e){let r=await this._getBlocks(e);return new Map([...r].map(([i,n])=>[i,n.length]))}async _getBlocks(e){let r=new Map;return await Promise.all(e.map(async i=>{try{let n=await this.blockstore.get(i);r.set(i.toString(pt),n)}catch(n){n.code!=="ERR_NOT_FOUND"&&this._log.error("failed to query blockstore for %s: %s",i,n)}})),r}_updateBlockAccounting(e,r){for(let i of e.values())this._log("got block (%s bytes)",i.length),r.receivedBytes(i.length)}messageSent(e,r,i){let n=this._findOrCreate(e);n.sentBytes(i.length),n.wantlist.remove(r)}numBytesSentTo(e){return this._findOrCreate(e).accounting.bytesSent}numBytesReceivedFrom(e){return this._findOrCreate(e).accounting.bytesRecv}peerDisconnected(e){}_findOrCreate(e){let r=e.toB58String(),i=this.ledgerMap.get(r);if(i)return i;let n=new CO(e);return this.ledgerMap.set(r,n),this._stats&&this._stats.push(r,"peerCount",1),n}start(){this._running=!0}stop(){this._running=!1}};l();var m4e=M(br());tt();var b4e=t=>`unwant:${Ge(t.multihash.bytes,"base64")}`,v4e=t=>`block:${Ge(t.multihash.bytes,"base64")}`,BO=class extends m4e.EventEmitter{constructor(e){super();this.setMaxListeners(c4e),this._log=Co(e,"notif")}hasBlock(e,r){let i=v4e(e);this._log(i),this.emit(i,r)}wantBlock(e,r={}){if(!e)throw new Error("Not a valid cid");let i=v4e(e),n=b4e(e);return this._log(`wantBlock:${e}`),new Promise((s,o)=>{let a=()=>{this.removeListener(i,c),o(new Error(`Block for ${e} unwanted`))},c=u=>{this.removeListener(n,a),s(u)};this.once(n,a),this.once(i,c),r&&r.signal&&r.signal.addEventListener("abort",()=>{this.removeListener(i,c),this.removeListener(n,a),o(new Error(`Want for ${e} aborted`))})})}unwantBlock(e){let r=b4e(e);this._log(r),this.emit(r)}};l();var _4e=M(br());l();var w4e=M(br()),NO=M(GC()),Z7=class extends w4e.EventEmitter{constructor(e,r){super();this._options=r,this._queue=[],this._stats={},this._frequencyLastTime=Date.now(),this._frequencyAccumulators={},this._movingAverages={},this._update=this._update.bind(this),e.forEach(i=>{this._stats[i]=BigInt(0),this._movingAverages[i]={},this._options.movingAverageIntervals.forEach(n=>{(this._movingAverages[i][n]=(0,NO.default)(n)).push(this._frequencyLastTime,0)})}),this._enabled=this._options.enabled}enable(){this._enabled=!0}disable(){this._disabled=!0}stop(){this._timeout&&clearTimeout(this._timeout)}get snapshot(){return Object.assign({},this._stats)}get movingAverages(){return Object.assign({},this._movingAverages)}push(e,r){this._enabled&&(this._queue.push([e,r,Date.now()]),this._resetComputeTimeout())}_resetComputeTimeout(){this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout(this._update,this._nextTimeout())}_nextTimeout(){let e=this._queue.length/this._options.computeThrottleMaxQueueSize;return Math.max(this._options.computeThrottleTimeout*(1-e),0)}_update(){if(this._timeout=null,this._queue.length){let e;for(;this._queue.length;){let r=e=this._queue.shift();r&&this._applyOp(r)}e&&this._updateFrequency(e[2]),this.emit("update",this._stats)}}_updateFrequency(e){let r=e-this._frequencyLastTime;r&&Object.keys(this._stats).forEach(i=>{this._updateFrequencyFor(i,r,e)}),this._frequencyLastTime=e}_updateFrequencyFor(e,r,i){let n=this._frequencyAccumulators[e]||0;this._frequencyAccumulators[e]=0;let s=n/r*1e3,o=this._movingAverages[e];o||(o=this._movingAverages[e]={}),this._options.movingAverageIntervals.forEach(a=>{let c=o[a];c||(c=o[a]=(0,NO.default)(a)),c.push(i,s)})}_applyOp(e){let r=e[0],i=e[1];if(typeof i!="number")throw new Error(`invalid increment number: ${i}`);Object.prototype.hasOwnProperty.call(this._stats,r)||(this._stats[r]=BigInt(0)),this._stats[r]=BigInt(this._stats[r])+BigInt(i),this._frequencyAccumulators[r]||(this._frequencyAccumulators[r]=0),this._frequencyAccumulators[r]+=i}};var E4e={enabled:!1,computeThrottleTimeout:1e3,computeThrottleMaxQueueSize:1e3,movingAverageIntervals:[60*1e3,5*60*1e3,15*60*1e3]},MO=class extends _4e.EventEmitter{constructor(e=[],r=E4e){super();let i=Object.assign({},E4e,r);if(typeof i.computeThrottleTimeout!="number")throw new Error("need computeThrottleTimeout");if(typeof i.computeThrottleMaxQueueSize!="number")throw new Error("need computeThrottleMaxQueueSize");this._initialCounters=e,this._options=i,this._enabled=this._options.enabled,this._global=new Z7(e,i),this._global.on("update",n=>this.emit("update",n)),this._peers=new Map}enable(){this._enabled=!0,this._options.enabled=!0,this._global.enable()}disable(){this._enabled=!1,this._options.enabled=!1,this._global.disable()}stop(){this._enabled=!1,this._global.stop();for(let e of this._peers)e[1].stop()}get snapshot(){return this._global.snapshot}get movingAverages(){return this._global.movingAverages}forPeer(e){let r=typeof e!="string"&&e.toB58String?e.toB58String():`${e}`;return this._peers.get(r)}push(e,r,i){if(this._enabled&&(this._global.push(r,i),e)){let n=this._peers.get(e);n||(n=new Z7(this._initialCounters,this._options),this._peers.set(e,n)),n.push(r,i)}}disconnected(e){let r=e.toB58String(),i=this._peers.get(r);i&&(i.stop(),this._peers.delete(r))}};var S4e=M(wn()),x4e=M(sf());Te();var Ket={statsEnabled:!1,statsComputeThrottleTimeout:1e3,statsComputeThrottleMaxQueueSize:1e3},Vet=["blocksReceived","dataReceived","dupBlksReceived","dupDataReceived","blocksSent","dataSent","providesBufferLength","wantListLength","peerCount"],LO=class extends _u{constructor(e,r,i={}){super();this._libp2p=e,this._log=Co(this.peerId),this._options=Object.assign({},Ket,i),this._stats=new MO(Vet,{enabled:this._options.statsEnabled,computeThrottleTimeout:this._options.statsComputeThrottleTimeout,computeThrottleMaxQueueSize:this._options.statsComputeThrottleMaxQueueSize}),this.network=new PO(e,this,this._stats,{hashers:i.hashers}),this.blockstore=r,this.engine=new DO(this.peerId,r,this.network,this._stats),this.wm=new SO(this.peerId,this.network,this._stats),this.notifications=new BO(this.peerId),this.started=!1}isStarted(){return this.started}get peerId(){return this._libp2p.peerId}async _receiveMessage(e,r){try{await this.engine.messageReceived(e,r)}catch(n){this._log("failed to receive message",r)}if(r.blocks.size===0)return;let i=[];for(let[n,s]of r.blocks.entries()){let o=J.parse(n);i.push({wasWanted:this.wm.wantlist.contains(o),cid:o,data:s})}this.wm.cancelWants(i.filter(({wasWanted:n})=>n).map(({cid:n})=>n)),await Promise.all(i.map(({cid:n,wasWanted:s,data:o})=>this._handleReceivedBlock(e,n,o,s)))}async _handleReceivedBlock(e,r,i,n){this._log("received block");let s=await this.blockstore.has(r);this._updateReceiveCounters(e.toB58String(),r,i,s),!!n&&await this.put(r,i)}_updateReceiveCounters(e,r,i,n){this._stats.push(e,"blocksReceived",1),this._stats.push(e,"dataReceived",i.length),n&&(this._stats.push(e,"dupBlksReceived",1),this._stats.push(e,"dupDataReceived",i.length))}_receiveError(e){this._log.error("ReceiveError: %s",e.message)}_onPeerConnected(e){this.wm.connected(e)}_onPeerDisconnected(e){this.wm.disconnected(e),this.engine.peerDisconnected(e),this._stats.disconnected(e)}enableStats(){this._stats.enable()}disableStats(){this._stats.disable()}wantlistForPeer(e,r){return this.engine.wantlistForPeer(e)}ledgerForPeer(e){return this.engine.ledgerForPeer(e)}async get(e,r={}){let i=(u,f)=>(this.wm.wantBlocks([u],f),this.notifications.wantBlock(u,f)),n=!1,s=async(u,f)=>{try{return await this.blockstore.get(u,f)}catch(d){if(d.code!=="ERR_NOT_FOUND")throw d;return n||(n=!0,this.network.findAndConnect(u).catch(h=>this._log.error(h))),i(u,f)}},o=new S4e.AbortController,a=r.signal?(0,x4e.anySignal)([r.signal,o.signal]):o.signal,c=await Promise.race([this.notifications.wantBlock(e,{signal:a}),s(e,{signal:a})]);return o.abort(),c}async*getMany(e,r={}){for await(let i of e)yield this.get(i,r)}unwant(e){let r=Array.isArray(e)?e:[e];this.wm.unwantBlocks(r),r.forEach(i=>this.notifications.unwantBlock(i))}cancelWants(e){this.wm.cancelWants(Array.isArray(e)?e:[e])}async put(e,r,i){await this.blockstore.put(e,r),this._sendHaveBlockNotifications(e,r)}async*putMany(e,r){for await(let{key:i,value:n}of this.blockstore.putMany(e,r))this._sendHaveBlockNotifications(i,n),yield{key:i,value:n}}_sendHaveBlockNotifications(e,r){this.notifications.hasBlock(e,r),this.engine.receivedBlocks([{cid:e,data:r}]),this.network.provide(e).catch(i=>{this._log.error("Failed to provide: %s",i.message)})}getWantlist(){return this.wm.wantlist.entries()}peers(){return this.engine.peers()}stat(){return this._stats}start(){this.wm.start(),this.network.start(),this.engine.start(),this.started=!0}stop(){this._stats.stop(),this.wm.stop(),this.network.stop(),this.engine.stop(),this.started=!1}unwrap(){return this.blockstore}};var A4e=(t,e,r={})=>new LO(t,e,r);var k4e=M(rt()),D4e=M(Rt());l();l();var jO={};zt(jO,{abortedError:()=>Het,notFoundError:()=>P4e});l();var qO=M(R4e());function P4e(t){return t=t||new Error("Not Found"),(0,qO.default)(t,"ERR_NOT_FOUND")}function Het(t){return t=t||new Error("Aborted"),(0,qO.default)(t,"ERR_ABORTED")}l();yn();Hs();Te();Bn();var KNt={...jO};var C4e=M(ep()),UO=M(nc()),O4e=M(ea()),FO=class extends _u{constructor(e,r){super();this.child=e,this.bitswap=r}open(){return this.child.open()}close(){return this.child.close()}unwrap(){return this.child}async put(e,r,i={}){await this.has(e)||(this.bitswap.isStarted()?await this.bitswap.put(e,r,i):await this.child.put(e,r,i))}async*putMany(e,r={}){let i=(0,O4e.default)(e,async({key:n})=>!await this.has(n));this.bitswap.isStarted()?yield*this.bitswap.putMany(i,r):yield*this.child.putMany(i,r)}async get(e,r={}){return!await this.has(e)&&this.bitswap.isStarted()?this.bitswap.get(e,r):this.child.get(e,r)}async*getMany(e,r={}){let i=(0,UO.default)(),n=(0,UO.default)();Promise.resolve().then(async()=>{for await(let s of e)!await this.has(s)&&this.bitswap.isStarted()?i.push(s):n.push(s);i.end(),n.end()}),yield*(0,C4e.default)(this.bitswap.getMany(i,r),this.child.getMany(n,r))}async delete(e,r){await this.child.delete(e,r)}async*deleteMany(e,r){yield*this.child.deleteMany(e,r)}async has(e,r={}){return this.child.has(e,r)}async*query(e,r={}){yield*this.child.query(e,r)}async*queryKeys(e,r={}){yield*this.child.queryKeys(e,r)}};var m3=class{constructor(e,r,i,n,s){this.peerId=e,this.libp2p=r,this.bitswap=i,this.repo=n,this.blockstore=s}static async start({peerId:e,repo:r,print:i,options:n}){r.closed&&await r.open();let s=await r.config.getAll(),o=await h3({options:n,repo:r,peerId:e,multiaddrs:Get(e,s),config:s,keychainConfig:void 0});o.keychain&&await o.loadKeychain(),await o.start();for(let u of o.multiaddrs)i(`Swarm listening on ${u}/p2p/${e.toB58String()}`);let a=A4e(o,r.blocks,{statsEnabled:!0});await a.start();let c=new FO(r.blocks,a);return r.blocks=c,r.pins.blockstore=c,new m3(e,o,a,r,c)}static async stop(e){e.repo.blocks=e.blockstore.unwrap(),e.repo.pins.blockstore=e.blockstore.unwrap(),await Promise.all([e.bitswap.stop(),e.libp2p.stop()])}},Get=(t,e)=>{let r=t.toB58String(),i=[],n=e.Addresses&&e.Addresses.Swarm||[];for(let s of n){let o=new k4e.Multiaddr(s);if(o.protoCodes().includes($et))throw(0,D4e.default)(new Error("websocket-star swarm addresses are not supported. See https://github.com/ipfs/js-ipfs/issues/2779"),"ERR_WEBSOCKET_STAR_SWARM_ADDR_NOT_SUPPORTED");let a=o.getPeerId();a&&a!==r&&(o=o.encapsulate(`/p2p/${r}`)),i.push(o)}return i},$et=479;l();l();function B4e({network:t}){async function e(r={}){let i=[],{libp2p:n}=await t.use(r);for(let[s,o]of n.peerStore.peers.entries())i.push({id:s,addrs:o.addresses.map(a=>a.multiaddr)});return i}return ce(e)}l();function N4e({network:t}){async function e(r,i={}){let{libp2p:n}=await t.use(i);await n.dial(r,i)}return ce(e)}l();function M4e({network:t}){async function e(r,i={}){let{libp2p:n}=await t.use(i);await n.hangUp(r)}return ce(e)}l();function L4e({network:t}){async function e(r={}){let{libp2p:i}=await t.use(r);return i.multiaddrs}return ce(e)}l();function q4e({network:t}){async function e(r={}){let{libp2p:i}=await t.use(r),n=[];for(let[s,o]of i.connections)for(let a of o){let c={addr:a.remoteAddr,peer:s};(r.verbose||r.direction)&&(c.direction=a.stat.direction),r.verbose&&(c.muxer=a.stat.multiplexer,c.latency="n/a",c.streams=[]),n.push(c)}return n}return ce(e)}var KO=class{constructor({network:e}){this.addrs=B4e({network:e}),this.connect=N4e({network:e}),this.disconnect=M4e({network:e}),this.localAddrs=L4e({network:e}),this.peers=q4e({network:e})}};l();var j4e=M(it());var b3={success:!0,time:0,text:""};function U4e({network:t}){async function*e(r,i={}){let{libp2p:n}=await t.use();i.count=i.count||10;let s=j4e.default.createFromB58String(r),o=n.peerStore.get(s),a=o&&o.id;if(!a){yield{...b3,text:`Looking up peer ${r}`};let f=await n.peerRouting.findPeer(s);a=f&&f.id}if(!a)throw new Error("Peer was not found");yield{...b3,text:`PING ${a.toB58String()}`};let c=0,u=0;for(let f=0;f<i.count;f++)try{let d=await n.ping(a);u+=d,c++,yield{...b3,time:d}}catch(d){yield{...b3,success:!1,text:d.toString()}}if(c){let f=u/c;yield{...b3,text:`Average latency: ${f}ms`}}}return ce(e)}l();var VO=M(it()),zO=M(Rt());var F4e=M(Vy());function K4e({network:t,repo:e}){let{get:r,put:i,findProvs:n,findPeer:s,provide:o,query:a}={async get(c,u={}){let{libp2p:f}=await f2(t,u);return f._dht.get(c,u)},async*put(c,u,f){let{libp2p:d}=await f2(t,f);yield*d._dht.put(c,u)},async*findProvs(c,u={numProviders:20}){let{libp2p:f}=await f2(t,u);for await(let d of f._dht.findProviders(c,{maxNumProviders:u.numProviders,signal:u.signal}))yield{id:d.id.toB58String(),addrs:d.addrs}},async findPeer(c,u){let{libp2p:f}=await f2(t,u),d=await f._dht.findPeer(VO.default.parse(c));return{id:d.id.toB58String(),addrs:d.multiaddrs}},async*provide(c,u={recursive:!1}){let{libp2p:f}=await f2(t,u),d=Array.isArray(c)?c:[c];if(!(await Promise.all(d.map(y=>e.blocks.has(y)))).every(y=>y))throw(0,zO.default)(new Error("block(s) not found locally, cannot provide"),"ERR_BLOCK_NOT_FOUND");if(u.recursive)throw(0,zO.default)(new Error("not implemented yet"),"ERR_NOT_IMPLEMENTED_YET");for(let y of d)yield f._dht.provide(y)},async*query(c,u){let{libp2p:f}=await f2(t,u);for await(let d of f._dht.getClosestPeers(VO.default.parse(c).toBytes()))yield{id:d.toB58String(),addrs:[]}}};return{get:ce(r),put:ce(i),findProvs:ce(n),findPeer:ce(s),provide:ce(o),query:ce(a)}}var f2=async(t,e)=>{let r=await t.use(e);if((0,F4e.default)(r.libp2p,"_config.dht.enabled",!1))return r;throw new Da("dht not enabled")};l();var V4e=M(Rt());var z4e=M(Vy());function H4e({network:t,config:e}){let r=(0,z4e.default)(e||{},"Pubsub.Enabled",!0);return{subscribe:r?ce(i):v3,unsubscribe:r?ce(n):v3,publish:r?ce(s):v3,ls:r?ce(o):v3,peers:r?ce(a):v3};async function i(c,u,f={}){let{libp2p:d}=await t.use(f);return d.pubsub.subscribe(c,u,f)}async function n(c,u,f={}){let{libp2p:d}=await t.use(f);d.pubsub.unsubscribe(c,u,f)}async function s(c,u,f={}){let{libp2p:d}=await t.use(f);if(!u)throw(0,V4e.default)(new Error('argument "data" is required'),"ERR_ARG_REQUIRED");await d.pubsub.publish(c,u)}async function o(c={}){let{libp2p:u}=await t.use(c);return u.pubsub.getTopics()}async function a(c,u={}){let{libp2p:f}=await t.use(u);return f.pubsub.getSubscribers(c)}}var v3=async()=>{throw new Da("pubsub not enabled")};var Wet=Tt.bind({ignoreUndefined:!0}),GO=(0,$4e.default)("ipfs"),W4e=class{constructor({print:e,storage:r,codecs:i,options:n}){let{peerId:s,repo:o,keychain:a}=r,c=Ln.create(m3),u=LX(n.preload),f=QL(),d=ZL({network:c}),h=new yS(n),p=Object.values(u6);(n.ipld&&n.ipld.hashers?n.ipld.hashers:[]).forEach(C=>p.push(C)),this.hashers=new ym({hashers:p,loadHasher:n.ipld&&n.ipld.loadHasher});let y=Object.values(kl);(n.ipld&&n.ipld.bases?n.ipld.bases:[]).forEach(C=>y.push(C)),this.bases=new hm({bases:y,loadBase:n.ipld&&n.ipld.loadBase});let b=new mE({repo:o,codecs:i}),E=new RS({codecs:i,hashers:this.hashers,preload:u,repo:o}),v=new ES({dns:f,ipns:h,repo:o,codecs:i,peerId:s,isOnline:d,keychain:a,options:n}),A=CK({repo:o,codecs:i,bases:this.bases,name:v}),R=new Qx({repo:o,codecs:i,hashers:this.hashers,preload:u}),F=Object.assign($z({repo:o,codecs:i,resolve:A,preload:u}),{local:Wz({repo:r.repo})}),{add:D,addAll:B,cat:H,get:W,ls:X}=new Fx({preload:u,repo:o,options:n.EXPERIMENTAL}),P=uZ({repo:o,preload:u,hashers:this.hashers,options:n}),g=qX({files:P,preload:u,options:n.preload});this.preload=u,this.name=v,this.ipns=h,this.pin=b,this.resolve=A,this.block=E,this.refs=F,this.start=mL({network:c,peerId:s,repo:o,preload:u,ipns:h,mfsPreload:g,print:e,keychain:a,options:n}),this.stop=bL({network:c,preload:u,mfsPreload:g,ipns:h,repo:o}),this.dht=K4e({network:c,repo:o}),this.pubsub=H4e({network:c,config:n.config}),this.dns=f,this.isOnline=d,this.id=XY({network:c,peerId:s}),this.version=$Y({repo:o}),this.bitswap=new AS({network:c}),this.bootstrap=new IS({repo:o}),this.config=eX({repo:o}),this.ping=U4e({network:c}),this.add=D,this.addAll=B,this.cat=H,this.get=W,this.ls=X,this.dag=R,this.files=P,this.key=new gA({keychain:a}),this.object=new vA({preload:u,codecs:i,repo:o}),this.repo=new wA({repo:o,hashers:this.hashers}),this.stats=new _A({repo:o,network:c}),this.swarm=new KO({network:c}),Object.defineProperty(this,"libp2p",{get(){let C=c.try();return C?C.libp2p:void 0}});let w=()=>Promise.reject((0,HO.default)(new Error("Not implemented"),"ERR_NOT_IMPLEMENTED")),S=async function*(){throw(0,HO.default)(new Error("Not implemented"),"ERR_NOT_IMPLEMENTED")};this.commands=w,this.diag={cmds:w,net:w,sys:w},this.log={level:w,ls:w,tail:S},this.mount=w,this.codecs=i}async init(){throw new ka}},Yet=async t=>{let e=ot({Data:new ct({type:"directory"}).marshal(),Links:[]}),r=await t.block.put(e,{mhtype:"sha2-256",format:"dag-pb"});return await t.pin.add(r),r},Xet=()=>({start:!0,EXPERIMENTAL:{},preload:{enabled:!G4e.isTest,addresses:["/dns4/node0.preload.ipfs.io/https","/dns4/node1.preload.ipfs.io/https","/dns4/node2.preload.ipfs.io/https","/dns4/node3.preload.ipfs.io/https"]}});async function Y4e(t={}){t=Wet(Xet(),t);let e=t.init||{},r={name:_s.name,code:_s.code,encode:u=>u,decode:u=>u},i=Object.values(f6);[Nn,z2,r].concat(t.ipld&&t.ipld.codecs||[]).forEach(u=>i.push(u));let n=new pm({codecs:i,loadCodec:t.ipld&&t.ipld.loadCodec}),s=t.silent?GO:console.log,o=await y3.start(s,n,t),a=await o.repo.config.getAll(),c=new W4e({storage:o,print:s,codecs:n,options:{...t,config:a}});if(await c.preload.start(),c.ipns.startOffline(o),o.isNew&&!e.emptyRepo){let u=await Yet(c);GO("adding default assets"),await SN({addAll:c.addAll,print:s}),GO("initializing IPNS keyspace"),await c.ipns.initializeKeyspace(o.peerId.privKey,Xe(`/ipfs/${u}`))}return t.start!==!1&&await c.start(),c}var X4e=M(rc()),Q4e=M(d0());Te();var Z4e=M(rt()),J4e=M(it()),ebe=M(nR()),tbe=M(sR()),rbe=Y4e,ibe=X4e.default,nbe=Q4e.default,sbe=J,obe=Z4e.Multiaddr,abe=J4e.default,cbe=ebe.default,ube=tbe.default;l();function fbe(){throw new Error("Not supported in browsers")}var Qet=rbe,Zet=ibe,Jet=nbe,ett=sbe,ttt=obe,rtt=abe,itt=cbe,ntt=ube,stt=fbe;return ott;})();
/*!
* prr
* (c) 2013 Rod Vagg <rod@vagg.org>
* https://github.com/rvagg/prr
* License: MIT
*/
/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
/*!
* bytes
* Copyright(c) 2012-2014 TJ Holowaychuk
* Copyright(c) 2015 Jed Watson
* MIT Licensed
*/
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
/*! simple-peer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
/**
* Timestamp for 64-bit time_t, nanosecond precision and strftime
*
* @author Yusuke Kawasaki
* @license MIT
* @see https://github.com/kawanet/timestamp-nano
*/
return Ipfs}));